aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidxl <davidxl@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-18 05:04:45 +0000
committerdavidxl <davidxl@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-18 05:04:45 +0000
commit9873b9a315dae199f00ebe6006cca79226d2edc4 (patch)
tree34f2fc57b88ffb6192ac653d0dc84f2af763d631
parentcef1eeea87b69a0c21e97d3bddb658e4d4ce1190 (diff)
Merged revisions 146828-146831,146837-146838,146842-146843,146846,146848-146850,146852-146856,146863-146864,146867-146872,146874-146878,146880-146883,146887-146889,146891-146892,146894,146896-146897,146899-146908,146912-146913,146915,146920-146921,146923,146926-146967,146969-146971,146973-146974,146976-146980,146982-146984,146988-146991,146994-146995,146997-147004,147006,147009-147010,147012,147018,147020-147021,147023-147024,147028-147029,147031,147033-147035,147044,147052-147055,147057-147058,147062,147064-147065,147068,147071-147078,147080,147082-147083,147085-147087,147090,147094,147096-147098,147100-147102,147104-147105,147108-147111,147115,147119,147122,147125,147127-147128,147130-147137,147143,147148-147152,147154,147156-147175,147177-147183,147185-147188,147192,147197-147198,147201,147203,147206-147209,147212-147214,147216-147217,147220,147222,147225,147227-147228,147241,147243-147244,147248-147250,147254,147256-147259,147263-147268,147270,147274,147279,147281-147283,147286,147290,147293-147295,147298-147299 via svnmerge from
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/lw-ipo@147650 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog18
-rw-r--r--MAINTAINERS10
-rwxr-xr-xconfig.guess5
-rw-r--r--config/ChangeLog11
-rw-r--r--config/tcl.m414
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac4
-rw-r--r--contrib/ChangeLog9
-rwxr-xr-xcontrib/dg-extract-results.sh29
-rw-r--r--fixincludes/ChangeLog24
-rw-r--r--fixincludes/fixincl.x436
-rw-r--r--fixincludes/inclhack.def150
-rw-r--r--fixincludes/tests/base/inttypes.h11
-rw-r--r--fixincludes/tests/base/stdint.h49
-rw-r--r--fixincludes/tests/base/stdlib.h6
-rw-r--r--fixincludes/tests/base/sys/_inttypes.h21
-rw-r--r--gcc/ChangeLog1659
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in68
-rw-r--r--gcc/ada/ChangeLog817
-rw-r--r--gcc/ada/Makefile.rtl2
-rw-r--r--gcc/ada/adaint.c60
-rw-r--r--gcc/ada/alloc.ads3
-rw-r--r--gcc/ada/clean.adb179
-rw-r--r--gcc/ada/comperr.adb29
-rw-r--r--gcc/ada/debug.adb6
-rw-r--r--gcc/ada/err_vars.ads24
-rw-r--r--gcc/ada/errout.adb6
-rw-r--r--gcc/ada/errout.ads27
-rw-r--r--gcc/ada/exp_aggr.adb136
-rw-r--r--gcc/ada/exp_attr.adb11
-rw-r--r--gcc/ada/exp_ch3.adb152
-rw-r--r--gcc/ada/exp_ch3.ads8
-rw-r--r--gcc/ada/exp_ch4.adb23
-rw-r--r--gcc/ada/exp_ch5.adb6
-rw-r--r--gcc/ada/exp_ch6.adb5
-rw-r--r--gcc/ada/exp_ch7.adb36
-rw-r--r--gcc/ada/exp_ch9.adb26
-rw-r--r--gcc/ada/exp_ch9.ads9
-rw-r--r--gcc/ada/exp_disp.adb96
-rw-r--r--gcc/ada/exp_disp.ads13
-rw-r--r--gcc/ada/exp_dist.adb35
-rw-r--r--gcc/ada/exp_dist.ads4
-rw-r--r--gcc/ada/exp_intr.adb8
-rw-r--r--gcc/ada/exp_tss.adb73
-rw-r--r--gcc/ada/exp_tss.ads22
-rw-r--r--gcc/ada/exp_util.adb4
-rw-r--r--gcc/ada/freeze.adb157
-rw-r--r--gcc/ada/g-comlin.ads9
-rw-r--r--gcc/ada/g-debuti.adb6
-rw-r--r--gcc/ada/g-dyntab.adb13
-rw-r--r--gcc/ada/g-dyntab.ads5
-rw-r--r--gcc/ada/g-expect-vms.adb24
-rw-r--r--gcc/ada/g-expect.adb24
-rw-r--r--gcc/ada/g-expect.ads86
-rw-r--r--gcc/ada/g-socket.adb101
-rw-r--r--gcc/ada/g-socket.ads10
-rw-r--r--gcc/ada/g-socthi-mingw.adb82
-rw-r--r--gcc/ada/g-socthi-mingw.ads31
-rw-r--r--gcc/ada/g-socthi-vms.adb162
-rw-r--r--gcc/ada/g-socthi-vms.ads31
-rw-r--r--gcc/ada/g-socthi-vxworks.adb70
-rw-r--r--gcc/ada/g-socthi-vxworks.ads33
-rw-r--r--gcc/ada/g-socthi.adb70
-rw-r--r--gcc/ada/g-socthi.ads33
-rw-r--r--gcc/ada/g-sothco.ads15
-rw-r--r--gcc/ada/g-stsifd-sockets.adb4
-rw-r--r--gcc/ada/g-table.adb13
-rw-r--r--gcc/ada/g-table.ads5
-rw-r--r--gcc/ada/g-tastus.ads38
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in251
-rw-r--r--gcc/ada/gcc-interface/Makefile.in78
-rw-r--r--gcc/ada/gnat1drv.adb2
-rw-r--r--gcc/ada/gnat_rm.texi81
-rw-r--r--gcc/ada/gnat_ugn.texi305
-rw-r--r--gcc/ada/gnatcmd.adb220
-rw-r--r--gcc/ada/init.c2
-rw-r--r--gcc/ada/initialize.c84
-rw-r--r--gcc/ada/lib-load.adb2
-rw-r--r--gcc/ada/lib-xref.adb112
-rw-r--r--gcc/ada/make.adb895
-rw-r--r--gcc/ada/makeutl.adb38
-rw-r--r--gcc/ada/makeutl.ads10
-rw-r--r--gcc/ada/mlib-prj.adb231
-rw-r--r--gcc/ada/mlib-tgt.adb28
-rw-r--r--gcc/ada/mlib-tgt.ads15
-rw-r--r--gcc/ada/opt.ads7
-rw-r--r--gcc/ada/osint.adb92
-rw-r--r--gcc/ada/osint.ads8
-rw-r--r--gcc/ada/par-ch12.adb19
-rw-r--r--gcc/ada/par-ch3.adb23
-rw-r--r--gcc/ada/par-ch4.adb5
-rw-r--r--gcc/ada/par-ch5.adb8
-rw-r--r--gcc/ada/par-ch6.adb11
-rw-r--r--gcc/ada/par-ch9.adb5
-rw-r--r--gcc/ada/par-endh.adb28
-rw-r--r--gcc/ada/par-load.adb6
-rw-r--r--gcc/ada/par-prag.adb4
-rw-r--r--gcc/ada/par-tchk.adb5
-rw-r--r--gcc/ada/par-util.adb14
-rw-r--r--gcc/ada/prepcomp.adb4
-rw-r--r--gcc/ada/prj-dect.adb55
-rw-r--r--gcc/ada/prj-dect.ads6
-rw-r--r--gcc/ada/prj-env.adb289
-rw-r--r--gcc/ada/prj-env.ads4
-rw-r--r--gcc/ada/prj-ext.adb4
-rw-r--r--gcc/ada/prj-makr.adb3
-rw-r--r--gcc/ada/prj-nmsc.adb1263
-rw-r--r--gcc/ada/prj-nmsc.ads23
-rw-r--r--gcc/ada/prj-pars.adb25
-rw-r--r--gcc/ada/prj-pars.ads36
-rw-r--r--gcc/ada/prj-part.adb96
-rw-r--r--gcc/ada/prj-part.ads8
-rw-r--r--gcc/ada/prj-pp.adb7
-rw-r--r--gcc/ada/prj-pp.ads3
-rw-r--r--gcc/ada/prj-proc.adb289
-rw-r--r--gcc/ada/prj-proc.ads57
-rw-r--r--gcc/ada/prj-util.adb16
-rw-r--r--gcc/ada/prj.adb185
-rw-r--r--gcc/ada/prj.ads65
-rw-r--r--gcc/ada/rtsfind.adb150
-rw-r--r--gcc/ada/rtsfind.ads19
-rw-r--r--gcc/ada/s-fileio.adb11
-rw-r--r--gcc/ada/s-linux-alpha.ads5
-rw-r--r--gcc/ada/s-linux-hppa.ads5
-rw-r--r--gcc/ada/s-linux-mipsel.ads118
-rw-r--r--gcc/ada/s-linux.ads5
-rw-r--r--gcc/ada/s-oscons-tmplt.c13
-rw-r--r--gcc/ada/s-osinte-darwin.ads2
-rw-r--r--gcc/ada/s-osinte-linux.ads6
-rw-r--r--gcc/ada/s-stausa.adb76
-rw-r--r--gcc/ada/s-stausa.ads40
-rw-r--r--gcc/ada/s-stusta.adb261
-rw-r--r--gcc/ada/s-stusta.ads77
-rw-r--r--gcc/ada/s-taskin.adb5
-rw-r--r--gcc/ada/scans.ads25
-rw-r--r--gcc/ada/scng.adb10
-rw-r--r--gcc/ada/sdefault.ads5
-rw-r--r--gcc/ada/sem.adb17
-rw-r--r--gcc/ada/sem_aggr.adb359
-rw-r--r--gcc/ada/sem_attr.adb27
-rw-r--r--gcc/ada/sem_cat.ads7
-rw-r--r--gcc/ada/sem_ch10.adb2
-rw-r--r--gcc/ada/sem_ch12.adb68
-rw-r--r--gcc/ada/sem_ch13.adb73
-rw-r--r--gcc/ada/sem_ch3.adb70
-rw-r--r--gcc/ada/sem_ch4.adb22
-rw-r--r--gcc/ada/sem_ch5.adb22
-rw-r--r--gcc/ada/sem_ch6.adb50
-rw-r--r--gcc/ada/sem_ch8.adb134
-rw-r--r--gcc/ada/sem_disp.adb14
-rw-r--r--gcc/ada/sem_elim.adb93
-rw-r--r--gcc/ada/sem_prag.adb117
-rw-r--r--gcc/ada/sem_res.adb350
-rw-r--r--gcc/ada/sem_util.adb74
-rw-r--r--gcc/ada/sem_util.ads5
-rw-r--r--gcc/ada/sem_warn.adb53
-rw-r--r--gcc/ada/sinfo.adb16
-rw-r--r--gcc/ada/sinfo.ads19
-rw-r--r--gcc/ada/sinput-l.adb8
-rw-r--r--gcc/ada/sinput.adb242
-rw-r--r--gcc/ada/sinput.ads14
-rw-r--r--gcc/ada/snames.ads-tmpl2
-rw-r--r--gcc/ada/styleg.adb16
-rw-r--r--gcc/ada/switch-m.adb3
-rw-r--r--gcc/ada/system-linux-mips64el.ads152
-rw-r--r--gcc/ada/table.adb11
-rw-r--r--gcc/ada/table.ads3
-rw-r--r--gcc/ada/targparm.adb4
-rw-r--r--gcc/ada/targparm.ads6
-rw-r--r--gcc/ada/vms_data.ads8
-rw-r--r--gcc/ada/xoscons.adb33
-rw-r--r--gcc/alloc-pool.c2
-rw-r--r--gcc/attribs.c17
-rw-r--r--gcc/bitmap.c2
-rw-r--r--gcc/builtins.c64
-rw-r--r--gcc/c-common.c58
-rw-r--r--gcc/c-common.h11
-rw-r--r--gcc/c-cppbuiltin.c13
-rw-r--r--gcc/c-decl.c264
-rw-r--r--gcc/c-gimplify.c15
-rw-r--r--gcc/c-lex.c12
-rw-r--r--gcc/c-objc-common.c23
-rw-r--r--gcc/c-opts.c18
-rw-r--r--gcc/c-parser.c21
-rw-r--r--gcc/c-pragma.c119
-rw-r--r--gcc/c-pretty-print.c108
-rw-r--r--gcc/c-pretty-print.h3
-rw-r--r--gcc/c-tree.h24
-rw-r--r--gcc/c-typeck.c162
-rw-r--r--gcc/c.opt4
-rw-r--r--gcc/calls.c1
-rw-r--r--gcc/cfgexpand.c70
-rw-r--r--gcc/cfgrtl.c17
-rw-r--r--gcc/cgraph.c331
-rw-r--r--gcc/cgraph.h47
-rw-r--r--gcc/cgraphbuild.c12
-rw-r--r--gcc/cgraphunit.c344
-rw-r--r--gcc/collect2.c4
-rw-r--r--gcc/common.opt10
-rw-r--r--gcc/config.gcc40
-rw-r--r--gcc/config.in12
-rw-r--r--gcc/config/alpha/alpha-protos.h1
-rw-r--r--gcc/config/alpha/alpha.c35
-rw-r--r--gcc/config/alpha/alpha.h20
-rw-r--r--gcc/config/alpha/alpha.md2
-rw-r--r--gcc/config/alpha/elf.h18
-rw-r--r--gcc/config/arm/arm-cores.def1
-rw-r--r--gcc/config/arm/arm-protos.h2
-rw-r--r--gcc/config/arm/arm-tune.md2
-rw-r--r--gcc/config/arm/arm.c35
-rw-r--r--gcc/config/arm/arm.h32
-rw-r--r--gcc/config/avr/avr-protos.h6
-rw-r--r--gcc/config/avr/avr.c23
-rw-r--r--gcc/config/avr/avr.h18
-rw-r--r--gcc/config/bfin/bfin-protos.h12
-rw-r--r--gcc/config/bfin/bfin.c303
-rw-r--r--gcc/config/bfin/bfin.h21
-rw-r--r--gcc/config/bfin/bfin.md147
-rw-r--r--gcc/config/cris/cris.h10
-rw-r--r--gcc/config/darwin.c2
-rw-r--r--gcc/config/frv/frv-protos.h1
-rw-r--r--gcc/config/frv/frv.c6
-rw-r--r--gcc/config/frv/frv.h10
-rw-r--r--gcc/config/h8300/h8300.h6
-rw-r--r--gcc/config/hpux-stdint.h34
-rw-r--r--gcc/config/i386/i386-protos.h2
-rw-r--r--gcc/config/i386/i386.c394
-rw-r--r--gcc/config/i386/i386.h28
-rw-r--r--gcc/config/i386/i386.md4
-rw-r--r--gcc/config/i386/predicates.md4
-rw-r--r--gcc/config/i386/sse.md6
-rw-r--r--gcc/config/ia64/hpux.h2
-rw-r--r--gcc/config/ia64/ia64.c2
-rw-r--r--gcc/config/ia64/ia64.h5
-rw-r--r--gcc/config/iq2000/iq2000.c71
-rw-r--r--gcc/config/iq2000/iq2000.h68
-rw-r--r--gcc/config/m32c/m32c-protos.h1
-rw-r--r--gcc/config/m32c/m32c.c48
-rw-r--r--gcc/config/m32c/m32c.h4
-rw-r--r--gcc/config/m32r/m32r.c14
-rw-r--r--gcc/config/m32r/m32r.h23
-rw-r--r--gcc/config/m68hc11/m68hc11-protos.h2
-rw-r--r--gcc/config/m68hc11/m68hc11.c8
-rw-r--r--gcc/config/m68hc11/m68hc11.h28
-rw-r--r--gcc/config/m68k/m68k.c81
-rw-r--r--gcc/config/m68k/m68k.h51
-rw-r--r--gcc/config/mcore/mcore.h5
-rw-r--r--gcc/config/mips/mips-protos.h1
-rw-r--r--gcc/config/mips/mips.c98
-rw-r--r--gcc/config/mips/mips.h25
-rw-r--r--gcc/config/mips/mips.md11
-rw-r--r--gcc/config/mn10300/mn10300-protos.h1
-rw-r--r--gcc/config/mn10300/mn10300.c8
-rw-r--r--gcc/config/mn10300/mn10300.h19
-rw-r--r--gcc/config/pa/linux-atomic.c5
-rw-r--r--gcc/config/pa/pa-hpux.h4
-rw-r--r--gcc/config/pa/pa-hpux10.h4
-rw-r--r--gcc/config/pa/pa-hpux11.h4
-rw-r--r--gcc/config/pa/pa-protos.h2
-rw-r--r--gcc/config/pa/pa.c4
-rw-r--r--gcc/config/pa/pa.h20
-rw-r--r--gcc/config/pdp11/pdp11.h8
-rw-r--r--gcc/config/picochip/libgccExtras/divmod15.asm2
-rw-r--r--gcc/config/picochip/picochip.h8
-rw-r--r--gcc/config/rs6000/option-defaults.h64
-rw-r--r--gcc/config/rs6000/rs6000-c.c2
-rw-r--r--gcc/config/rs6000/rs6000-protos.h1
-rw-r--r--gcc/config/rs6000/rs6000.c20
-rw-r--r--gcc/config/rs6000/rs6000.h48
-rw-r--r--gcc/config/rs6000/rs6000.md2
-rw-r--r--gcc/config/rs6000/t-xilinx56
-rw-r--r--gcc/config/rs6000/xilinx.h9
-rw-r--r--gcc/config/s390/s390-protos.h1
-rw-r--r--gcc/config/s390/s390.c17
-rw-r--r--gcc/config/s390/s390.h18
-rw-r--r--gcc/config/score/score-protos.h1
-rw-r--r--gcc/config/score/score.c16
-rw-r--r--gcc/config/score/score.h6
-rw-r--r--gcc/config/score/score3.c27
-rw-r--r--gcc/config/score/score3.h2
-rw-r--r--gcc/config/score/score7.c27
-rw-r--r--gcc/config/score/score7.h2
-rw-r--r--gcc/config/sh/sh-protos.h2
-rw-r--r--gcc/config/sh/sh.c84
-rw-r--r--gcc/config/sh/sh.h88
-rw-r--r--gcc/config/sol2-c.c8
-rw-r--r--gcc/config/sparc/sparc-protos.h1
-rw-r--r--gcc/config/sparc/sparc.c13
-rw-r--r--gcc/config/sparc/sparc.h21
-rw-r--r--gcc/config/sparc/sparc.md28
-rw-r--r--gcc/config/spu/constraints.md21
-rw-r--r--gcc/config/spu/predicates.md10
-rw-r--r--gcc/config/spu/spu-builtins.def8
-rw-r--r--gcc/config/spu/spu-builtins.md142
-rw-r--r--gcc/config/spu/spu-protos.h4
-rw-r--r--gcc/config/spu/spu.c127
-rw-r--r--gcc/config/spu/spu.h11
-rw-r--r--gcc/config/spu/spu.md91
-rw-r--r--gcc/config/stormy16/stormy16.h2
-rw-r--r--gcc/config/v850/v850.h6
-rw-r--r--gcc/config/xtensa/xtensa-protos.h1
-rw-r--r--gcc/config/xtensa/xtensa.c6
-rw-r--r--gcc/config/xtensa/xtensa.h11
-rwxr-xr-xgcc/configure104
-rw-r--r--gcc/configure.ac61
-rw-r--r--gcc/coverage.c111
-rw-r--r--gcc/cp/ChangeLog116
-rw-r--r--gcc/cp/call.c4
-rw-r--r--gcc/cp/class.c24
-rw-r--r--gcc/cp/cp-objcp-common.c2
-rw-r--r--gcc/cp/cp-tree.h86
-rw-r--r--gcc/cp/cxx-pretty-print.c138
-rw-r--r--gcc/cp/cxx-pretty-print.h3
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/cp/decl2.c1
-rw-r--r--gcc/cp/error.c155
-rw-r--r--gcc/cp/name-lookup.c1
-rw-r--r--gcc/cp/parser.c12
-rw-r--r--gcc/cp/pt.c14
-rw-r--r--gcc/cp/semantics.c23
-rw-r--r--gcc/cp/typeck.c12
-rw-r--r--gcc/cse.c62
-rw-r--r--gcc/dbgcnt.def9
-rw-r--r--gcc/dbxout.c4
-rw-r--r--gcc/dce.c14
-rw-r--r--gcc/debug.h2
-rw-r--r--gcc/defaults.h8
-rw-r--r--gcc/df-core.c8
-rw-r--r--gcc/df-problems.c115
-rw-r--r--gcc/df-scan.c4
-rw-r--r--gcc/df.h6
-rw-r--r--gcc/dfp.c84
-rw-r--r--gcc/doc/c-tree.texi12
-rw-r--r--gcc/doc/cfg.texi4
-rw-r--r--gcc/doc/collect2.texi4
-rw-r--r--gcc/doc/cpp.texi4
-rw-r--r--gcc/doc/extend.texi23
-rw-r--r--gcc/doc/gimple.texi4
-rw-r--r--gcc/doc/install.texi20
-rw-r--r--gcc/doc/invoke.texi101
-rw-r--r--gcc/doc/loop.texi2
-rw-r--r--gcc/doc/md.texi12
-rw-r--r--gcc/doc/options.texi2
-rw-r--r--gcc/doc/passes.texi2
-rw-r--r--gcc/doc/rtl.texi8
-rw-r--r--gcc/doc/tm.texi53
-rw-r--r--gcc/doc/trouble.texi2
-rw-r--r--gcc/dojump.c9
-rw-r--r--gcc/dwarf.h318
-rw-r--r--gcc/dwarf2out.c71
-rw-r--r--gcc/dyn-ipa.c63
-rw-r--r--gcc/except.c2
-rw-r--r--gcc/explow.c7
-rw-r--r--gcc/expmed.c88
-rw-r--r--gcc/expr.c204
-rw-r--r--gcc/final.c1
-rw-r--r--gcc/fixed-value.c4
-rw-r--r--gcc/flags.h5
-rw-r--r--gcc/fold-const.c12
-rw-r--r--gcc/fortran/ChangeLog145
-rw-r--r--gcc/fortran/decl.c307
-rw-r--r--gcc/fortran/dump-parse-tree.c19
-rw-r--r--gcc/fortran/error.c1
-rw-r--r--gcc/fortran/expr.c68
-rw-r--r--gcc/fortran/gfortran.h20
-rw-r--r--gcc/fortran/gfortran.texi47
-rw-r--r--gcc/fortran/interface.c5
-rw-r--r--gcc/fortran/intrinsic.c18
-rw-r--r--gcc/fortran/invoke.texi3
-rw-r--r--gcc/fortran/match.c16
-rw-r--r--gcc/fortran/module.c1
-rw-r--r--gcc/fortran/parse.c14
-rw-r--r--gcc/fortran/primary.c51
-rw-r--r--gcc/fortran/resolve.c172
-rw-r--r--gcc/fortran/st.c1
-rw-r--r--gcc/fortran/symbol.c10
-rw-r--r--gcc/fortran/trans-expr.c73
-rw-r--r--gcc/fortran/trans-intrinsic.c14
-rw-r--r--gcc/fortran/trans-io.c2
-rw-r--r--gcc/fortran/trans-stmt.c8
-rw-r--r--gcc/fortran/trans-stmt.h1
-rw-r--r--gcc/fortran/trans-types.c26
-rw-r--r--gcc/fortran/trans-types.h2
-rw-r--r--gcc/fortran/trans.c4
-rw-r--r--gcc/fortran/trans.h9
-rw-r--r--gcc/function.h4
-rw-r--r--gcc/fwprop.c127
-rw-r--r--gcc/gcc-plugin.h5
-rw-r--r--gcc/gcc.c16
-rw-r--r--gcc/gcov-io.c11
-rw-r--r--gcc/gcse.c1823
-rw-r--r--gcc/genpreds.c8
-rw-r--r--gcc/gensupport.c2
-rw-r--r--gcc/ggc-common.c2
-rw-r--r--gcc/gimple.c26
-rw-r--r--gcc/gimple.def13
-rw-r--r--gcc/gimple.h2
-rw-r--r--gcc/gimplify.c99
-rw-r--r--gcc/haifa-sched.c2
-rw-r--r--gcc/hooks.c9
-rw-r--r--gcc/hooks.h3
-rw-r--r--gcc/intl.c24
-rw-r--r--gcc/intl.h4
-rw-r--r--gcc/ipa-cp.c219
-rw-r--r--gcc/ipa-inline.c23
-rw-r--r--gcc/ipa-prop.c2
-rw-r--r--gcc/ipa-prop.h14
-rw-r--r--gcc/ipa-pure-const.c1
-rw-r--r--gcc/ipa-reference.c2
-rw-r--r--gcc/ipa-struct-reorg.c7
-rw-r--r--gcc/ipa-type-escape.c2
-rw-r--r--gcc/ipa-utils.c2
-rw-r--r--gcc/ipa.c55
-rw-r--r--gcc/ira-conflicts.c2
-rw-r--r--gcc/ira.c2
-rw-r--r--gcc/java/ChangeLog13
-rw-r--r--gcc/java/builtins.c72
-rw-r--r--gcc/java/constants.c9
-rw-r--r--gcc/java/verify-impl.c6
-rw-r--r--gcc/l-ipo.c13
-rw-r--r--gcc/l-ipo.h13
-rw-r--r--gcc/langhooks.c10
-rw-r--r--gcc/langhooks.h44
-rw-r--r--gcc/libgcov.c22
-rw-r--r--gcc/loop-invariant.c37
-rw-r--r--gcc/matrix-reorg.c2
-rw-r--r--gcc/objc/ChangeLog4
-rw-r--r--gcc/objc/objc-act.c4
-rw-r--r--gcc/optabs.c4
-rw-r--r--gcc/opts.c51
-rw-r--r--gcc/passes.c11
-rw-r--r--gcc/plugin-version.c36
-rw-r--r--gcc/plugin.c31
-rw-r--r--gcc/predict.c6
-rw-r--r--gcc/pretty-print.c230
-rw-r--r--gcc/pretty-print.h8
-rw-r--r--gcc/print-tree.c9
-rw-r--r--gcc/real.c4
-rw-r--r--gcc/regcprop.c1005
-rw-r--r--gcc/regrename.c984
-rw-r--r--gcc/resource.c55
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/sel-sched-ir.c20
-rw-r--r--gcc/sel-sched-ir.h5
-rw-r--r--gcc/sel-sched.c5
-rw-r--r--gcc/ssaexpand.h11
-rw-r--r--gcc/stmt.c7
-rw-r--r--gcc/stor-layout.c10
-rw-r--r--gcc/store-motion.c1265
-rw-r--r--gcc/system.h2
-rw-r--r--gcc/target-def.h5
-rw-r--r--gcc/target.h6
-rw-r--r--gcc/targhooks.c13
-rw-r--r--gcc/targhooks.h2
-rw-r--r--gcc/testsuite/ChangeLog698
-rw-r--r--gcc/testsuite/g++.dg/README1
-rw-r--r--gcc/testsuite/g++.dg/cpp/_Pragma1.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp/pragma-float-const-decimal64-1.C5
-rw-r--r--gcc/testsuite/g++.dg/dg.exp1
-rw-r--r--gcc/testsuite/g++.dg/eh/async-unwind2.C1
-rw-r--r--gcc/testsuite/g++.dg/eh/simd-5.C2
-rw-r--r--gcc/testsuite/g++.dg/ext/altivec-15.C7
-rw-r--r--gcc/testsuite/g++.dg/ext/ms-1.C17
-rw-r--r--gcc/testsuite/g++.dg/ext/visibility/class1.C1
-rw-r--r--gcc/testsuite/g++.dg/ext/vla7.C30
-rw-r--r--gcc/testsuite/g++.dg/other/PR23205.C2
-rw-r--r--gcc/testsuite/g++.dg/parse/parser-pr28152-2.C13
-rw-r--r--gcc/testsuite/g++.dg/parse/parser-pr28152.C13
-rw-r--r--gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C53
-rw-r--r--gcc/testsuite/g++.dg/plugin/dumb_plugin.c136
-rw-r--r--gcc/testsuite/g++.dg/plugin/plugin.exp66
-rw-r--r--gcc/testsuite/g++.dg/plugin/self-assign-test-1.C50
-rw-r--r--gcc/testsuite/g++.dg/plugin/self-assign-test-2.C50
-rw-r--r--gcc/testsuite/g++.dg/plugin/self-assign-test-3.C50
-rw-r--r--gcc/testsuite/g++.dg/plugin/selfassign.c365
-rw-r--r--gcc/testsuite/g++.dg/rtti/repo1.C1
-rw-r--r--gcc/testsuite/g++.dg/template/call7.C19
-rw-r--r--gcc/testsuite/g++.dg/template/overload9.C4
-rw-r--r--gcc/testsuite/g++.dg/template/repo1.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo2.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo3.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo4.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo5.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo6.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo7.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo8.C1
-rw-r--r--gcc/testsuite/g++.dg/template/repo9.C1
-rw-r--r--gcc/testsuite/g++.dg/warn/Wuninitialized-4.C22
-rw-r--r--gcc/testsuite/g++.dg/warn/Wuninitialized-5.C22
-rw-r--r--gcc/testsuite/g++.dg/warn/deprecated-6.C110
-rw-r--r--gcc/testsuite/g++.dg/warn/pr35652.C30
-rw-r--r--gcc/testsuite/g++.dg/warn/weak1.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/overload11.C9
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/repo1.C1
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/repo2.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/repo3.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/repo4.C2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/const-high-part.c19
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr39928-1.c8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr39928-2.c8
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr39937.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr39941.c12
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr39943.c7
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr39983.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr40023.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c6
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr40022.c51
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr40057.c37
-rw-r--r--gcc/testsuite/gcc.dg/20020103-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/20020312-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/20020919-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/Wconversion-real-integer.c1
-rw-r--r--gcc/testsuite/gcc.dg/Wconversion-real.c1
-rw-r--r--gcc/testsuite/gcc.dg/Wcxx-compat-5.c45
-rw-r--r--gcc/testsuite/gcc.dg/Wcxx-compat-6.c112
-rw-r--r--gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/asm-b.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-alias-5.c12
-rw-r--r--gcc/testsuite/gcc.dg/attr-weakref-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/c99-complex-3.c7
-rw-r--r--gcc/testsuite/gcc.dg/cdce1.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/_Pragma6.c2
-rw-r--r--gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c17
-rw-r--r--gcc/testsuite/gcc.dg/declspec-10.c8
-rw-r--r--gcc/testsuite/gcc.dg/declspec-11.c8
-rw-r--r--gcc/testsuite/gcc.dg/declspec-9.c8
-rw-r--r--gcc/testsuite/gcc.dg/deprecated-4.c88
-rw-r--r--gcc/testsuite/gcc.dg/deprecated-5.c7
-rw-r--r--gcc/testsuite/gcc.dg/deprecated-6.c11
-rw-r--r--gcc/testsuite/gcc.dg/dfp/float-constant-double.c21
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr39986.c31
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c85
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c86
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c83
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c46
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c46
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c46
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c39
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c174
-rw-r--r--gcc/testsuite/gcc.dg/div-double-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/format/plus-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/incomplete-5.c8
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp65
-rw-r--r--gcc/testsuite/gcc.dg/plugin/self-assign-test-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/plugin/self-assign-test-2.c23
-rw-r--r--gcc/testsuite/gcc.dg/plugin/selfassign.c365
-rw-r--r--gcc/testsuite/gcc.dg/pr35652.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr39323-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr39323-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr39565.c48
-rw-r--r--gcc/testsuite/gcc.dg/pr39666-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/pr39666-2.c22
-rw-r--r--gcc/testsuite/gcc.dg/pthread-init-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/sms-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/sms-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/sms-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/sms-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/sms-5.c7
-rw-r--r--gcc/testsuite/gcc.dg/sms-6.c6
-rw-r--r--gcc/testsuite/gcc.dg/sms-7.c6
-rw-r--r--gcc/testsuite/gcc.dg/sms-8.c (renamed from gcc/testsuite/gcc.dg/sms-antideps.c)7
-rw-r--r--gcc/testsuite/gcc.dg/ssp-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/alias-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/asm-subreg-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-add.c53
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mixed-add.c53
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mixed-div.c45
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mixed-mul.c53
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mixed-sub.c53
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mul-minus-one.c61
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mul-one.c61
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-mul.c53
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign-sub.c53
-rw-r--r--gcc/testsuite/gcc.dg/torture/complex-sign.h74
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr39903-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr39903-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/trampoline-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-10.c8
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-11.c5
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-12.c5
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-13.c13
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-7.c7
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-8.c14
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-9.c24
-rw-r--r--gcc/testsuite/gcc.dg/vect/Os-vect-95.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr20122.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr36493.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr37385.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-10.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-11.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-12b.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-33.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-9.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-35.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-40.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-42.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-44.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-46.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-48.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-52.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-54.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-56.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-58.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-60.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-74.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-75.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-76.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-77-global.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-77.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-78-global.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-78.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-80.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-85.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-87.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-88.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-92.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-93.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-95.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-97.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-4.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-complex-5.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-10.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-7.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-multitypes-9.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2b.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2c.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2d.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3b.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3c.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-5.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-6.c8
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-shift-2.c189
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-s16.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-s8.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c4
-rw-r--r--gcc/testsuite/gcc.target/arm/long-calls-1.c2
-rw-r--r--gcc/testsuite/gcc.target/bfin/20090411-1.c29
-rw-r--r--gcc/testsuite/gcc.target/i386/pr37191.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/pr39911.c57
-rw-r--r--gcc/testsuite/gcc.target/i386/reload-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundpd-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundpd-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundpd-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c1
-rw-r--r--gcc/testsuite/gcc.target/ia64/20071210-2.c68
-rw-r--r--gcc/testsuite/gcc.target/ia64/sync-1.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/dspr2-MULT.c5
-rw-r--r--gcc/testsuite/gcc.target/mips/dspr2-MULTU.c5
-rw-r--r--gcc/testsuite/gcc.target/mips/mips.exp1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/20020118-1.c2
-rw-r--r--gcc/testsuite/gcc.target/sparc/fexpand-2.c6
-rw-r--r--gcc/testsuite/gcc.target/sparc/fpmerge-2.c6
-rw-r--r--gcc/testsuite/gcc.target/sparc/fpmul-2.c14
-rw-r--r--gcc/testsuite/gcc.target/sparc/pdist-2.c6
-rw-r--r--gcc/testsuite/gcc.target/spu/intrinsics-3.c21
-rw-r--r--gcc/testsuite/gcc.target/spu/pr40001.c17
-rw-r--r--gcc/testsuite/gfortran.dg/advance_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/advance_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/advance_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f9061
-rw-r--r--gcc/testsuite/gfortran.dg/ambiguous_reference_2.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/append_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/backslash_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/backslash_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/backslash_3.f2
-rw-r--r--gcc/testsuite/gfortran.dg/backspace_10.f902
-rw-r--r--gcc/testsuite/gfortran.dg/backspace_3.f2
-rw-r--r--gcc/testsuite/gfortran.dg/backspace_4.f2
-rw-r--r--gcc/testsuite/gfortran.dg/backspace_5.f2
-rw-r--r--gcc/testsuite/gfortran.dg/backspace_8.f2
-rw-r--r--gcc/testsuite/gfortran.dg/backspace_9.f2
-rw-r--r--gcc/testsuite/gfortran.dg/complex_write.f902
-rw-r--r--gcc/testsuite/gfortran.dg/convert_implied_open.f902
-rw-r--r--gcc/testsuite/gfortran.dg/dollar_edit_descriptor_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/dos_eol.f2
-rw-r--r--gcc/testsuite/gfortran.dg/empty_format_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/endfile.f2
-rw-r--r--gcc/testsuite/gfortran.dg/eof_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_handling_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_handling_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_handling_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_handling_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_handling_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/error_recovery_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/f2003_inquire_1.f032
-rw-r--r--gcc/testsuite/gfortran.dg/f2003_io_4.f032
-rw-r--r--gcc/testsuite/gfortran.dg/f2003_io_5.f032
-rw-r--r--gcc/testsuite/gfortran.dg/f2003_io_7.f032
-rw-r--r--gcc/testsuite/gfortran.dg/fgetc_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fgetc_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/flush_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_exhaust.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_huge.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_read.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_t_7.f2
-rw-r--r--gcc/testsuite/gfortran.dg/fseek.f902
-rw-r--r--gcc/testsuite/gfortran.dg/ftell_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/ftell_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/func_derived_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic.f903
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_2.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_3.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/iostat_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/iostat_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_7.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_8.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_13.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_14.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_15.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_16.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_17.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_18.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_19.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_20.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_24.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_26.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_27.f904
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_28.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_37.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_38.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_39.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_40.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_43.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_44.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_45.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_46.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_47.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_48.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_49.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_50.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_51.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_52.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_56.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_char_only.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_use.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_use_only.f902
-rw-r--r--gcc/testsuite/gfortran.dg/noadv_size.f902
-rw-r--r--gcc/testsuite/gfortran.dg/open_access_append_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pad_no.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pointer_assign_7.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/pr12884.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr17090.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr17285.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr17286.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr18122.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr18210.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr18392.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr19155.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr19216.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr19467.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr19657.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr20257.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr39666-1.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/pr39666-2.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/proc_decl_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_16.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_17.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_1.f9065
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_2.f9064
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_3.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_4.f90120
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_5.f9047
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_6.f9064
-rw-r--r--gcc/testsuite/gfortran.dg/read_bad_advance.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_eof_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_eof_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_many_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/read_noadvance.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_repeat.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_size_noadvance.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_x_past.f2
-rw-r--r--gcc/testsuite/gfortran.dg/record_marker_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/record_marker_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/rewind_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/runtime_warning_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/shape_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/slash_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/stat_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/stat_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/streamio_11.f902
-rw-r--r--gcc/testsuite/gfortran.dg/streamio_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/streamio_4.f904
-rw-r--r--gcc/testsuite/gfortran.dg/streamio_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/tl_editing.f902
-rw-r--r--gcc/testsuite/gfortran.dg/unf_io_convert_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/unf_io_convert_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/unf_read_corrupted_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/unf_short_record_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/utf8_1.f034
-rw-r--r--gcc/testsuite/gfortran.dg/utf8_2.f032
-rw-r--r--gcc/testsuite/gfortran.dg/vect/fast-math-pr38968.f902
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/write_check3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/write_rewind_2.f2
-rw-r--r--gcc/testsuite/gfortran.dg/x_slash_2.f2
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f28
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f40
-rw-r--r--gcc/testsuite/gnat.dg/opt2.adb31
-rw-r--r--gcc/testsuite/lib/objc.exp5
-rw-r--r--gcc/testsuite/lib/plugin-support.exp109
-rw-r--r--gcc/testsuite/lib/target-supports.exp81
-rw-r--r--gcc/testsuite/objc.dg/bad-receiver-type.m2
-rw-r--r--gcc/testsuite/objc.dg/encode-5.m2
-rw-r--r--gcc/testsuite/objc.dg/id-1.m2
-rw-r--r--gcc/testsuite/objc.dg/method-1.m4
-rw-r--r--gcc/testsuite/objc.dg/method-11.m6
-rw-r--r--gcc/testsuite/objc.dg/method-20.m1
-rw-r--r--gcc/testsuite/objc.dg/method-6.m4
-rw-r--r--gcc/testsuite/objc.dg/method-7.m4
-rw-r--r--gcc/testsuite/objc.dg/method-9.m6
-rw-r--r--gcc/testsuite/objc.dg/private-1.m4
-rw-r--r--gcc/timevar.def6
-rw-r--r--gcc/toplev.c108
-rw-r--r--gcc/toplev.h4
-rw-r--r--gcc/tree-cfg.c64
-rw-r--r--gcc/tree-complex.c5
-rw-r--r--gcc/tree-data-ref.c3
-rw-r--r--gcc/tree-dfa.c21
-rw-r--r--gcc/tree-eh.c4
-rw-r--r--gcc/tree-flow-inline.h23
-rw-r--r--gcc/tree-flow.h26
-rw-r--r--gcc/tree-if-conv.c1
-rw-r--r--gcc/tree-inline.c232
-rw-r--r--gcc/tree-inline.h2
-rw-r--r--gcc/tree-into-ssa.c32
-rw-r--r--gcc/tree-mudflap.c8
-rw-r--r--gcc/tree-nomudflap.c2
-rw-r--r--gcc/tree-outof-ssa.c65
-rw-r--r--gcc/tree-pass.h10
-rw-r--r--gcc/tree-scalar-evolution.c8
-rw-r--r--gcc/tree-ssa-coalesce.c43
-rw-r--r--gcc/tree-ssa-copy.c49
-rw-r--r--gcc/tree-ssa-dom.c33
-rw-r--r--gcc/tree-ssa-forwprop.c20
-rw-r--r--gcc/tree-ssa-live.h4
-rw-r--r--gcc/tree-ssa-phiprop.c98
-rw-r--r--gcc/tree-ssa-pre.c9
-rw-r--r--gcc/tree-ssa-propagate.c6
-rw-r--r--gcc/tree-ssa-structalias.c2
-rw-r--r--gcc/tree-ssa-ter.c22
-rw-r--r--gcc/tree-ssa-threadedge.c33
-rw-r--r--gcc/tree-ssa.c42
-rw-r--r--gcc/tree-vect-data-refs.c54
-rw-r--r--gcc/tree-vect-loop-manip.c2
-rw-r--r--gcc/tree-vect-loop.c304
-rw-r--r--gcc/tree-vect-patterns.c8
-rw-r--r--gcc/tree-vect-slp.c19
-rw-r--r--gcc/tree-vect-stmts.c497
-rw-r--r--gcc/tree-vectorizer.c25
-rw-r--r--gcc/tree-vectorizer.h23
-rw-r--r--gcc/tree-vrp.c2
-rw-r--r--gcc/tree.c18
-rw-r--r--gcc/tree.h69
-rw-r--r--gcc/value-prof.c17
-rw-r--r--gcc/varasm.c13
-rw-r--r--gcc/varray.c2
-rw-r--r--gcc/vec.c3
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/charset.c2
-rw-r--r--libgcc/Makefile.in4
-rw-r--r--libgfortran/ChangeLog103
-rw-r--r--libgfortran/io/file_pos.c20
-rw-r--r--libgfortran/io/intrinsics.c14
-rw-r--r--libgfortran/io/transfer.c2
-rw-r--r--libgfortran/runtime/string.c5
-rw-r--r--libiberty/ChangeLog7
-rw-r--r--libiberty/pex-win32.c34
-rw-r--r--libjava/ChangeLog35
-rw-r--r--libjava/Makefile.am9
-rw-r--r--libjava/Makefile.in21
-rwxr-xr-xlibjava/configure2
-rw-r--r--libjava/configure.ac2
-rw-r--r--libjava/gnu/classpath/natConfiguration.cc2
-rw-r--r--libjava/include/config.h.in6
-rw-r--r--libjava/include/java-assert.h6
-rw-r--r--libjava/interpret-run.cc16
-rw-r--r--libjava/interpret.cc8
-rw-r--r--libjava/java/io/natVMObjectInputStream.cc2
-rw-r--r--libjava/java/lang/natVMClassLoader.cc2
-rw-r--r--libjava/prims.cc4
-rw-r--r--libjava/testsuite/lib/libjava.exp2
-rw-r--r--libjava/testsuite/libjava.jni/jni.exp5
-rw-r--r--libjava/testsuite/libjava.jvmti/jvmti-interp.exp3
-rw-r--r--libstdc++-v3/ChangeLog89
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver12
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.cc10
-rw-r--r--libstdc++-v3/config/io/basic_file_stdio.h18
-rwxr-xr-xlibstdc++-v3/configure2
-rw-r--r--libstdc++-v3/configure.ac2
-rw-r--r--libstdc++-v3/include/ext/throw_allocator.h309
-rw-r--r--libstdc++-v3/include/parallel/algo.h4
-rw-r--r--libstdc++-v3/include/parallel/settings.h2
-rw-r--r--libstdc++-v3/include/std/mutex13
-rw-r--r--libstdc++-v3/include/tr1_impl/functional_hash.h10
-rw-r--r--libstdc++-v3/libsupc++/eh_call.cc2
-rw-r--r--libstdc++-v3/libsupc++/unwind-cxx.h2
-rwxr-xr-xlibstdc++-v3/scripts/create_testsuite_files2
-rw-r--r--libstdc++-v3/scripts/run_doxygen42
-rw-r--r--libstdc++-v3/src/Makefile.am1
-rw-r--r--libstdc++-v3/src/Makefile.in20
-rw-r--r--libstdc++-v3/src/math_stubs_long_double.cc8
-rw-r--r--libstdc++-v3/src/mutex.cc34
-rw-r--r--libstdc++-v3/src/throw_allocator.cc95
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/find/39546.cc43
-rw-r--r--libstdc++-v3/testsuite/30_threads/call_once/39909.cc56
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_abi.cc1
975 files changed, 25611 insertions, 11818 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c04bc7da89..39ad00f9602 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-05-07 Paolo Bonzini <bonzini@gnu.org>
+
+ * config.guess: Sync with src.
+
+2009-05-07 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * configure.ac ($with_ppl): Default to no if not supplied.
+ ($with_cloog): Likewise.
+ configure: Regenerate.
+
+2009-04-27 James E. Wilson <wilson@codesourcery.com>
+
+ * MAINTAINERS: Update my e-mail address.
+
+2009-04-27 Nick Clifton <nickc@redhat.com>
+
+ * MAINTAINERS: Replace Aldy Hernandez as a maintainer for the FRV.
+
2009-04-25 Eric Botcazou <ebotcazou@adacore.com>
* Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Add GNATBIND.
diff --git a/MAINTAINERS b/MAINTAINERS
index 85bd8c2eeef..25cebf611a6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -32,7 +32,7 @@ Mark Mitchell mark@codesourcery.com
Diego Novillo dnovillo@google.com
Bernd Schmidt bernd.schmidt@analog.com
Ian Lance Taylor ian@airs.com
-Jim Wilson wilson@tuliptree.org
+Jim Wilson wilson@codesourcery.com
Note that while global reviewers can approve changes to any part of
the compiler or associated libraries, they still need approval for
@@ -50,7 +50,7 @@ bfin port Bernd Schmidt bernd.schmidt@analog.com
cris port Hans-Peter Nilsson hp@axis.com
crx port Pompapathi V Gadad Pompapathi.V.Gadad@nsc.com
fr30 port Nick Clifton nickc@redhat.com
-frv port Aldy Hernandez aldyh@redhat.com
+frv port Nick Clifton nickc@redhat.com
frv port Alexandre Oliva aoliva@redhat.com
h8 port Jeff Law law@redhat.com
h8 port Kazu Hirata kazu@codesourcery.com
@@ -59,7 +59,7 @@ hppa port John David Anglin dave.anglin@nrc-cnrc.gc.ca
i386 port Richard Henderson rth@redhat.com
i386 port Jan Hubicka jh@suse.cz
i386 port Uros Bizjak ubizjak@gmail.com
-ia64 port Jim Wilson wilson@tuliptree.org
+ia64 port Jim Wilson wilson@codesourcery.com
ia64 port Steve Ellcey sje@cup.hp.com
iq2000 port Nick Clifton nickc@redhat.com
m32c port DJ Delorie dj@redhat.com
@@ -155,7 +155,7 @@ libobjc Nicola Pero nicola.pero@meta-innovation.com
libobjc Andrew Pinski pinskia@gmail.com
loop discovery Michael Hayes m.hayes@elec.canterbury.ac.nz
soft-fp Joseph Myers jsm@polyomino.org.uk
-scheduler (+ haifa) Jim Wilson wilson@tuliptree.org
+scheduler (+ haifa) Jim Wilson wilson@codesourcery.com
scheduler (+ haifa) Michael Meissner gnu@the-meissners.org
scheduler (+ haifa) Jeff Law law@redhat.com
scheduler (+ haifa) Vladimir Makarov vmakarov@redhat.com
@@ -163,7 +163,7 @@ modulo-scheduler Ayal Zaks zaks@il.ibm.com
reorg Jeff Law law@redhat.com
caller-save.c Jeff Law law@redhat.com
callgraph Jan Hubicka jh@suse.cz
-debugging code Jim Wilson wilson@tuliptree.org
+debugging code Jim Wilson wilson@codesourcery.com
dwarf debugging code Jason Merrill jason@redhat.com
c++ runtime libs Paolo Carlini paolo.carlini@oracle.com
c++ runtime libs Gabriel Dos Reis gdr@integrable-solutions.net
diff --git a/config.guess b/config.guess
index e5716eea733..b8cdd22573d 100755
--- a/config.guess
+++ b/config.guess
@@ -1116,7 +1116,10 @@ EOF
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
diff --git a/config/ChangeLog b/config/ChangeLog
index d0342028fb2..d670de4e371 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-07 Paolo Bonzini
+
+ Sync from src:
+ 2009-02-02 Doug Evans <dje@google.com>
+
+ * tcl.m4 (SC_PATH_TCLCONFIG): Don't exit 0 if tclconfig fails.
+ (SC_PATH_TKCONFIG): Don't exit 0 if tkconfig fails.
+ (SC_LOAD_TCLCONFIG): Quote all uses of TCL_BIN_DIR, it may contain
+ "# no Tcl configs found".
+ (SC_LOAD_TKCONFIG): Similarily for TK_BIN_DIR.
+
2009-04-09 Jakub Jelinek <jakub@redhat.com>
* lead-dot.m4: Change copyright header to refer to version
diff --git a/config/tcl.m4 b/config/tcl.m4
index be0129b1bdf..900a2ceb81e 100644
--- a/config/tcl.m4
+++ b/config/tcl.m4
@@ -114,7 +114,6 @@ AC_DEFUN([SC_PATH_TCLCONFIG], [
if test x"${ac_cv_c_tclconfig}" = x ; then
TCL_BIN_DIR="# no Tcl configs found"
AC_MSG_WARN([Can't find Tcl configuration definitions])
- exit 0
else
no_tcl=
TCL_BIN_DIR=${ac_cv_c_tclconfig}
@@ -237,7 +236,6 @@ AC_DEFUN([SC_PATH_TKCONFIG], [
if test x"${ac_cv_c_tkconfig}" = x ; then
TK_BIN_DIR="# no Tk configs found"
AC_MSG_WARN([Can't find Tk configuration definitions])
- exit 0
else
no_tk=
TK_BIN_DIR=${ac_cv_c_tkconfig}
@@ -285,7 +283,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
# of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
# instead of TCL_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
- if test -f ${TCL_BIN_DIR}/Makefile ; then
+ if test -f "${TCL_BIN_DIR}/Makefile" ; then
TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
@@ -295,7 +293,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
# against Tcl.framework installed in an arbitary location.
case ${TCL_DEFS} in
*TCL_FRAMEWORK*)
- if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
+ if test -f "${TCL_BIN_DIR}/${TCL_LIB_FILE}"; then
for i in "`cd ${TCL_BIN_DIR}; pwd`" \
"`cd ${TCL_BIN_DIR}/../..; pwd`"; do
if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
@@ -304,7 +302,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
fi
done
fi
- if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
+ if test -f "${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"; then
TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
fi
@@ -368,7 +366,7 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [
# of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
# instead of TK_BUILD_LIB_SPEC since it will work with both an
# installed and uninstalled version of Tcl.
- if test -f ${TK_BIN_DIR}/Makefile ; then
+ if test -f "${TK_BIN_DIR}/Makefile" ; then
TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
@@ -378,7 +376,7 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [
# against Tk.framework installed in an arbitary location.
case ${TK_DEFS} in
*TK_FRAMEWORK*)
- if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
+ if test -f "${TK_BIN_DIR}/${TK_LIB_FILE}"; then
for i in "`cd ${TK_BIN_DIR}; pwd`" \
"`cd ${TK_BIN_DIR}/../..; pwd`"; do
if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
@@ -387,7 +385,7 @@ AC_DEFUN([SC_LOAD_TKCONFIG], [
fi
done
fi
- if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
+ if test -f "${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"; then
TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
fi
diff --git a/configure b/configure
index 45d85c98bd9..dd525c807ba 100755
--- a/configure
+++ b/configure
@@ -4843,6 +4843,8 @@ pplinc=
if test "${with_ppl+set}" = set; then
withval="$with_ppl"
+else
+ with_ppl=no
fi;
# Check whether --with-ppl_include or --without-ppl_include was given.
@@ -4961,6 +4963,8 @@ clooginc=" -DCLOOG_PPL_BACKEND "
if test "${with_cloog+set}" = set; then
withval="$with_cloog"
+else
+ with_cloog=no
fi;
# Check whether --with-cloog_include or --without-cloog_include was given.
diff --git a/configure.ac b/configure.ac
index 0bb26e83a4a..a1e11c65071 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1339,7 +1339,7 @@ pplinc=
AC_ARG_WITH(ppl, [ --with-ppl=PATH Specify prefix directory for the installed PPL package
Equivalent to --with-ppl-include=PATH/include
- plus --with-ppl-lib=PATH/lib])
+ plus --with-ppl-lib=PATH/lib],, with_ppl=no)
AC_ARG_WITH(ppl_include, [ --with-ppl-include=PATH Specify directory for installed PPL include files])
AC_ARG_WITH(ppl_lib, [ --with-ppl-lib=PATH Specify the directory for the installed PPL library])
@@ -1394,7 +1394,7 @@ clooginc=" -DCLOOG_PPL_BACKEND "
AC_ARG_WITH(cloog, [ --with-cloog=PATH Specify prefix directory for the installed CLooG-PPL package
Equivalent to --with-cloog-include=PATH/include
- plus --with-cloog-lib=PATH/lib])
+ plus --with-cloog-lib=PATH/lib],, with_cloog=no)
AC_ARG_WITH(cloog_include, [ --with-cloog-include=PATH Specify directory for installed CLooG include files])
AC_ARG_WITH(cloog_lib, [ --with-cloog-lib=PATH Specify the directory for the installed CLooG library])
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index b4c315bc5df..6ab29eb71d9 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,12 @@
+2009-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/39807
+ * dg-extract-results.sh: Close open files and use >> instead of >
+ to decrease number of concurrently open files from awk. Avoid
+ = at the beginning of a regexp and redirect to a file determined
+ by curfile variable rather than concatenated strings to workaround
+ Solaris nawk bug.
+
2009-04-25 Gerald Pfeifer <gerald@pfeifer.com>
* test_summary: Only include LAST_UPDATED if it exists.
diff --git a/contrib/dg-extract-results.sh b/contrib/dg-extract-results.sh
index 75ae38f70e8..518c19f6bee 100755
--- a/contrib/dg-extract-results.sh
+++ b/contrib/dg-extract-results.sh
@@ -6,7 +6,7 @@
# The resulting file can be used with test result comparison scripts for
# results from tests that were run in parallel. See usage() below.
-# Copyright (C) 2008 Free Software Foundation
+# Copyright (C) 2008, 2009 Free Software Foundation
# Contributed by Janis Johnson <janis187@us.ibm.com>
#
# This file is part of GCC.
@@ -148,26 +148,28 @@ if [ "$TOOL" = acats ]; then
ACATS_AWK=${TMP}/acats.awk
cat <<EOF > $ACATS_AWK
BEGIN {
- print_prologue=1; chapter=""; insummary=0
+ print_prologue=1; curfile=""; insummary=0
passcnt=0; failcnt=0; unsupcnt=0; failures=""
}
-/=== acats configuration ===/ {
+/^[ \t]*=== acats configuration ===/ {
insummary=0
if (print_prologue) print
next
}
-/=== acats tests ===/ {
+/^[ \t]*=== acats tests ===/ {
if (print_prologue) print
print_prologue=0
next
}
/^Running chapter / {
- chapter=\$3
- print > "${TMP}/chapter-"chapter
+ if (curfile) close (curfile)
+ curfile="${TMP}/chapter-"\$3
+ print >> curfile
next
}
-/=== acats Summary ===/ {
- chapter=""
+/^[ \t]*=== acats Summary ===/ {
+ if (curfile) close (curfile)
+ curfile=""
insummary=1
next
}
@@ -182,7 +184,7 @@ BEGIN {
}
{
if (print_prologue) { print; next }
- if (chapter) print > "${TMP}/chapter-"chapter
+ if (curfile) print >> curfile
}
END {
system ("cat ${TMP}/chapter-*")
@@ -194,6 +196,7 @@ END {
}
EOF
+ rm -f ${TMP}/chapter-*
$AWK -f $ACATS_AWK $SUM_FILES
exit 0
fi
@@ -270,6 +273,7 @@ BEGIN {
expfileno=1
cnt=0
print_using=0
+ need_close=0
}
/^EXPFILE: / {
expfiles[expfileno] = \$2
@@ -287,8 +291,10 @@ BEGIN {
/^Running / {
print_using=0
if (variant == curvar) {
+ if (need_close) close(curfile)
curfile="${TMP}/list"expfilesr[\$2]
expfileseen[\$2]=expfileseen[\$2] + 1
+ need_close=0
testname="00"
next
}
@@ -303,11 +309,12 @@ BEGIN {
/^$/ { if ("$MODE" == "sum") next }
{ if (variant == curvar && curfile) {
if ("$MODE" == "sum") {
- printf "%s %08d|", testname, cnt > curfile
+ printf "%s %08d|", testname, cnt >> curfile
cnt = cnt + 1
}
filewritten[curfile]=1
- print > curfile
+ need_close=1
+ print >> curfile
} else
next
}
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index d3a8641f565..a31631df12f 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,27 @@
+2009-04-28 Steve Ellcey <sje@cup.hp.com>
+
+ * inclhack.def (hpux11_uint32_c): Remove.
+ (hpux_long_double): Disable on hpux11.3*.
+ (hpux_long_double_2): New.
+ (hpux_c99_intptr): New.
+ (hpux_c99_inttypes): New.
+ (hpux_c99_inttypes2): New.
+ (hpux_stdint_least): New.
+ (hpux_stdint_fast): New.
+ (hpux_inttype_int_least8_t): New.
+ (hpux_inttype_int8_t): New.
+ * fixincl.x: Regenerate.
+ * tests/base/sys/_inttypes.h: New.
+ * tests/base/inttypes.h: Update.
+ * tests/base/stdlib.h: Update.
+ * tests/base/stdint.h: Update.
+
+2009-04-28 Joseph Myers <joseph@codesourcery.com>
+
+ * inclhack.def (glibc_stdint): New fix.
+ * fixincl.x: Regenerate.
+ * tests/base/stdint.h: Update.
+
2009-04-09 Jakub Jelinek <jakub@redhat.com>
* Makefile.in: Change copyright header to refer to version
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 505e2e875b7..d8d1fc7dd6e 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
- * It has been AutoGen-ed Tuesday March 31, 2009 at 05:01:22 PM UTC
+ * It has been AutoGen-ed Tuesday April 28, 2009 at 08:26:48 AM PDT
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Mar 31 17:01:22 UTC 2009
+/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Apr 28 08:26:48 PDT 2009
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
- * This file contains 180 fixup descriptions.
+ * This file contains 188 fixup descriptions.
*
* See README for more information.
*
@@ -2219,6 +2219,44 @@ s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n\
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Glibc_Stdint fix
+ */
+tSCC zGlibc_StdintName[] =
+ "glibc_stdint";
+
+/*
+ * File name selection pattern
+ */
+tSCC zGlibc_StdintList[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+#define apzGlibc_StdintMachs (const char**)NULL
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zGlibc_StdintSelect0[] =
+ "GNU C Library";
+
+#define GLIBC_STDINT_TEST_CT 1
+static tTestDesc aGlibc_StdintTests[] = {
+ { TT_EGREP, zGlibc_StdintSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Glibc_Stdint
+ */
+static const char* apzGlibc_StdintPatch[] = {
+ "format",
+ "# define UINT8_C(c)\tc\n\
+# define UINT16_C(c)\tc",
+ "# define UINT8_C\\(c\\)\tc ## U\n\
+# define UINT16_C\\(c\\)\tc ## U",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Glibc_Tgmath fix
*/
tSCC zGlibc_TgmathName[] =
@@ -2855,41 +2893,6 @@ static const char* apzHpux11_SnprintfPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
- * Description of Hpux11_Uint32_C fix
- */
-tSCC zHpux11_Uint32_CName[] =
- "hpux11_uint32_c";
-
-/*
- * File name selection pattern
- */
-tSCC zHpux11_Uint32_CList[] =
- "inttypes.h\0";
-/*
- * Machine/OS name selection pattern
- */
-#define apzHpux11_Uint32_CMachs (const char**)NULL
-
-/*
- * content selection pattern - do fix if pattern found
- */
-tSCC zHpux11_Uint32_CSelect0[] =
- "^#define UINT32_C\\(__c\\)[ \t]*__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
-
-#define HPUX11_UINT32_C_TEST_CT 1
-static tTestDesc aHpux11_Uint32_CTests[] = {
- { TT_EGREP, zHpux11_Uint32_CSelect0, (regex_t*)NULL }, };
-
-/*
- * Fix Command Arguments for Hpux11_Uint32_C
- */
-static const char* apzHpux11_Uint32_CPatch[] = {
- "format",
- "#define UINT32_C(__c) __CONCAT__(__c,ul)",
- (char*)NULL };
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * *
- *
* Description of Hpux11_Vsnprintf fix
*/
tSCC zHpux11_VsnprintfName[] =
@@ -3057,7 +3060,10 @@ tSCC zHpux_Long_DoubleList[] =
/*
* Machine/OS name selection pattern
*/
-#define apzHpux_Long_DoubleMachs (const char**)NULL
+tSCC* apzHpux_Long_DoubleMachs[] = {
+ "*-*-hpux10*",
+ "*-*-hpux11.[012]*",
+ (const char*)NULL };
/*
* content selection pattern - do fix if pattern found
@@ -3086,6 +3092,43 @@ static const char* apzHpux_Long_DoublePatch[] = { sed_cmd_z,
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Hpux_Long_Double_2 fix
+ */
+tSCC zHpux_Long_Double_2Name[] =
+ "hpux_long_double_2";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Long_Double_2List[] =
+ "stdlib.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Long_Double_2Machs[] = {
+ "hppa*-*-hpux11.3*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Long_Double_2Select0[] =
+ "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
+
+#define HPUX_LONG_DOUBLE_2_TEST_CT 1
+static tTestDesc aHpux_Long_Double_2Tests[] = {
+ { TT_EGREP, zHpux_Long_Double_2Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Long_Double_2
+ */
+static const char* apzHpux_Long_Double_2Patch[] = {
+ "format",
+ "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Hpux_Systime fix
*/
tSCC zHpux_SystimeName[] =
@@ -3322,6 +3365,257 @@ static const char* apzHpux_Pthread_InitializersPatch[] = { sed_cmd_z,
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Hpux_C99_Intptr fix
+ */
+tSCC zHpux_C99_IntptrName[] =
+ "hpux_c99_intptr";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_C99_IntptrList[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_C99_IntptrMachs[] = {
+ "*-hp-hpux11.3*",
+ (const char*)NULL };
+#define HPUX_C99_INTPTR_TEST_CT 0
+#define aHpux_C99_IntptrTests (tTestDesc*)NULL
+
+/*
+ * Fix Command Arguments for Hpux_C99_Intptr
+ */
+static const char* apzHpux_C99_IntptrPatch[] = { sed_cmd_z,
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_C99_Inttypes fix
+ */
+tSCC zHpux_C99_InttypesName[] =
+ "hpux_c99_inttypes";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_C99_InttypesList[] =
+ "inttypes.h\0stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_C99_InttypesMachs[] = {
+ "*-hp-hpux11.[23]*",
+ (const char*)NULL };
+#define HPUX_C99_INTTYPES_TEST_CT 0
+#define aHpux_C99_InttypesTests (tTestDesc*)NULL
+
+/*
+ * Fix Command Arguments for Hpux_C99_Inttypes
+ */
+static const char* apzHpux_C99_InttypesPatch[] = { sed_cmd_z,
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@#define UINT32_C(__c) __CONCAT__(__c,u)@",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_C99_Inttypes2 fix
+ */
+tSCC zHpux_C99_Inttypes2Name[] =
+ "hpux_c99_inttypes2";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_C99_Inttypes2List[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_C99_Inttypes2Machs[] = {
+ "*-hp-hpux11.2*",
+ (const char*)NULL };
+#define HPUX_C99_INTTYPES2_TEST_CT 0
+#define aHpux_C99_Inttypes2Tests (tTestDesc*)NULL
+
+/*
+ * Fix Command Arguments for Hpux_C99_Inttypes2
+ */
+static const char* apzHpux_C99_Inttypes2Patch[] = { sed_cmd_z,
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@",
+ "-e", "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_Stdint_Least fix
+ */
+tSCC zHpux_Stdint_LeastName[] =
+ "hpux_stdint_least";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Stdint_LeastList[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Stdint_LeastMachs[] = {
+ "*-hp-hpux11.2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Stdint_LeastSelect0[] =
+ "^[ \t]*#[ \t]*define[ \t]*UINT_LEAST64_MAX[ \t]*ULLONG_MAX";
+
+#define HPUX_STDINT_LEAST_TEST_CT 1
+static tTestDesc aHpux_Stdint_LeastTests[] = {
+ { TT_EGREP, zHpux_Stdint_LeastSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Stdint_Least
+ */
+static const char* apzHpux_Stdint_LeastPatch[] = {
+ "format",
+ "#ifdef __LP64__\n\
+# define\tUINT_LEAST64_MAX\tULONG_MAX\n\
+#else\n\
+%0\n\
+#endif\n",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_Stdint_Fast fix
+ */
+tSCC zHpux_Stdint_FastName[] =
+ "hpux_stdint_fast";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Stdint_FastList[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Stdint_FastMachs[] = {
+ "*-hp-hpux11.2*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Stdint_FastSelect0[] =
+ "^[ \t]*#[ \t]*define[ \t]*UINT_FAST64_MAX[ \t]*ULLONG_MAX";
+
+#define HPUX_STDINT_FAST_TEST_CT 1
+static tTestDesc aHpux_Stdint_FastTests[] = {
+ { TT_EGREP, zHpux_Stdint_FastSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Stdint_Fast
+ */
+static const char* apzHpux_Stdint_FastPatch[] = {
+ "format",
+ "#ifdef __LP64__\n\
+# define\tUINT_FAST64_MAX\t\tULONG_MAX\n\
+#else\n\
+%0\n\
+#endif\n",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_Inttype_Int_Least8_T fix
+ */
+tSCC zHpux_Inttype_Int_Least8_TName[] =
+ "hpux_inttype_int_least8_t";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Inttype_Int_Least8_TList[] =
+ "sys/_inttypes.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Inttype_Int_Least8_TMachs[] = {
+ "*-hp-hpux11.*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Inttype_Int_Least8_TSelect0[] =
+ "^[ \t]*typedef[ \t]*char[ \t]*int_least8_t.*";
+
+#define HPUX_INTTYPE_INT_LEAST8_T_TEST_CT 1
+static tTestDesc aHpux_Inttype_Int_Least8_TTests[] = {
+ { TT_EGREP, zHpux_Inttype_Int_Least8_TSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Inttype_Int_Least8_T
+ */
+static const char* apzHpux_Inttype_Int_Least8_TPatch[] = {
+ "format",
+ "typedef signed char int_least8_t;",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Hpux_Inttype_Int8_T fix
+ */
+tSCC zHpux_Inttype_Int8_TName[] =
+ "hpux_inttype_int8_t";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Inttype_Int8_TList[] =
+ "sys/_inttypes.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Inttype_Int8_TMachs[] = {
+ "*-hp-hpux11.*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Inttype_Int8_TSelect0[] =
+ "^[ \t]*typedef[ \t]*char[ \t]*int8_t.*";
+
+#define HPUX_INTTYPE_INT8_T_TEST_CT 1
+static tTestDesc aHpux_Inttype_Int8_TTests[] = {
+ { TT_EGREP, zHpux_Inttype_Int8_TSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Inttype_Int8_T
+ */
+static const char* apzHpux_Inttype_Int8_TPatch[] = {
+ "format",
+ "typedef signed char int8_t;",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Huge_Val_Hex fix
*/
tSCC zHuge_Val_HexName[] =
@@ -7325,9 +7619,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 225
+#define REGEX_COUNT 230
#define MACH_LIST_SIZE_LIMIT 181
-#define FIX_COUNT 180
+#define FIX_COUNT 188
/*
* Enumerate the fixes
@@ -7386,6 +7680,7 @@ typedef enum {
GLIBC_C99_INLINE_3_FIXIDX,
GLIBC_C99_INLINE_4_FIXIDX,
GLIBC_MUTEX_INIT_FIXIDX,
+ GLIBC_STDINT_FIXIDX,
GLIBC_TGMATH_FIXIDX,
GNU_TYPES_FIXIDX,
HP_INLINE_FIXIDX,
@@ -7401,18 +7696,25 @@ typedef enum {
HPUX11_PTHREAD_CONST_FIXIDX,
HPUX11_SIZE_T_FIXIDX,
HPUX11_SNPRINTF_FIXIDX,
- HPUX11_UINT32_C_FIXIDX,
HPUX11_VSNPRINTF_FIXIDX,
HPUX8_BOGUS_INLINES_FIXIDX,
HPUX_CTYPE_MACROS_FIXIDX,
HPUX_HTONL_FIXIDX,
HPUX_LONG_DOUBLE_FIXIDX,
+ HPUX_LONG_DOUBLE_2_FIXIDX,
HPUX_SYSTIME_FIXIDX,
HPUX_SPU_INFO_FIXIDX,
HPUX11_EXTERN_SENDFILE_FIXIDX,
HPUX11_EXTERN_SENDPATH_FIXIDX,
HPUX_EXTERN_ERRNO_FIXIDX,
HPUX_PTHREAD_INITIALIZERS_FIXIDX,
+ HPUX_C99_INTPTR_FIXIDX,
+ HPUX_C99_INTTYPES_FIXIDX,
+ HPUX_C99_INTTYPES2_FIXIDX,
+ HPUX_STDINT_LEAST_FIXIDX,
+ HPUX_STDINT_FAST_FIXIDX,
+ HPUX_INTTYPE_INT_LEAST8_T_FIXIDX,
+ HPUX_INTTYPE_INT8_T_FIXIDX,
HUGE_VAL_HEX_FIXIDX,
HUGE_VALF_HEX_FIXIDX,
HUGE_VALL_HEX_FIXIDX,
@@ -7781,6 +8083,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
GLIBC_MUTEX_INIT_TEST_CT, FD_MACH_ONLY,
aGlibc_Mutex_InitTests, apzGlibc_Mutex_InitPatch, 0 },
+ { zGlibc_StdintName, zGlibc_StdintList,
+ apzGlibc_StdintMachs,
+ GLIBC_STDINT_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aGlibc_StdintTests, apzGlibc_StdintPatch, 0 },
+
{ zGlibc_TgmathName, zGlibc_TgmathList,
apzGlibc_TgmathMachs,
GLIBC_TGMATH_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -7856,11 +8163,6 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX11_SNPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHpux11_SnprintfTests, apzHpux11_SnprintfPatch, 0 },
- { zHpux11_Uint32_CName, zHpux11_Uint32_CList,
- apzHpux11_Uint32_CMachs,
- HPUX11_UINT32_C_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
- aHpux11_Uint32_CTests, apzHpux11_Uint32_CPatch, 0 },
-
{ zHpux11_VsnprintfName, zHpux11_VsnprintfList,
apzHpux11_VsnprintfMachs,
HPUX11_VSNPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -7886,6 +8188,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX_LONG_DOUBLE_TEST_CT, FD_MACH_ONLY,
aHpux_Long_DoubleTests, apzHpux_Long_DoublePatch, 0 },
+ { zHpux_Long_Double_2Name, zHpux_Long_Double_2List,
+ apzHpux_Long_Double_2Machs,
+ HPUX_LONG_DOUBLE_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Long_Double_2Tests, apzHpux_Long_Double_2Patch, 0 },
+
{ zHpux_SystimeName, zHpux_SystimeList,
apzHpux_SystimeMachs,
HPUX_SYSTIME_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -7916,6 +8223,41 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX_PTHREAD_INITIALIZERS_TEST_CT, FD_MACH_ONLY,
aHpux_Pthread_InitializersTests, apzHpux_Pthread_InitializersPatch, 0 },
+ { zHpux_C99_IntptrName, zHpux_C99_IntptrList,
+ apzHpux_C99_IntptrMachs,
+ HPUX_C99_INTPTR_TEST_CT, FD_MACH_ONLY,
+ aHpux_C99_IntptrTests, apzHpux_C99_IntptrPatch, 0 },
+
+ { zHpux_C99_InttypesName, zHpux_C99_InttypesList,
+ apzHpux_C99_InttypesMachs,
+ HPUX_C99_INTTYPES_TEST_CT, FD_MACH_ONLY,
+ aHpux_C99_InttypesTests, apzHpux_C99_InttypesPatch, 0 },
+
+ { zHpux_C99_Inttypes2Name, zHpux_C99_Inttypes2List,
+ apzHpux_C99_Inttypes2Machs,
+ HPUX_C99_INTTYPES2_TEST_CT, FD_MACH_ONLY,
+ aHpux_C99_Inttypes2Tests, apzHpux_C99_Inttypes2Patch, 0 },
+
+ { zHpux_Stdint_LeastName, zHpux_Stdint_LeastList,
+ apzHpux_Stdint_LeastMachs,
+ HPUX_STDINT_LEAST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Stdint_LeastTests, apzHpux_Stdint_LeastPatch, 0 },
+
+ { zHpux_Stdint_FastName, zHpux_Stdint_FastList,
+ apzHpux_Stdint_FastMachs,
+ HPUX_STDINT_FAST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Stdint_FastTests, apzHpux_Stdint_FastPatch, 0 },
+
+ { zHpux_Inttype_Int_Least8_TName, zHpux_Inttype_Int_Least8_TList,
+ apzHpux_Inttype_Int_Least8_TMachs,
+ HPUX_INTTYPE_INT_LEAST8_T_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Inttype_Int_Least8_TTests, apzHpux_Inttype_Int_Least8_TPatch, 0 },
+
+ { zHpux_Inttype_Int8_TName, zHpux_Inttype_Int8_TList,
+ apzHpux_Inttype_Int8_TMachs,
+ HPUX_INTTYPE_INT8_T_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Inttype_Int8_TTests, apzHpux_Inttype_Int8_TPatch, 0 },
+
{ zHuge_Val_HexName, zHuge_Val_HexList,
apzHuge_Val_HexMachs,
HUGE_VAL_HEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index e1d413cc8db..f77845f77d2 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -1265,6 +1265,20 @@ fix = {
};
+/* glibc versions before 2.5 have a version of stdint.h that defines
+ UINT8_C and UINT16_C to produce unsigned constants, as do uClibc
+ versions with stdint.h based on those glibc versions. */
+fix = {
+ hackname = glibc_stdint;
+ files = stdint.h;
+ select = "GNU C Library";
+ c_fix = format;
+ c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
+ c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
+ test_text = "/* This file is part of the GNU C Library. */\n# define UINT8_C(c)\tc ## U\n# define UINT16_C(c)\tc ## U";
+};
+
+
/* glibc's tgmath.h relies on an expression that is not an integer
constant expression being treated as it was by GCC 4.4 and
earlier. */
@@ -1595,35 +1609,6 @@ fix = {
"extern int snprintf(char *, _hpux_size_t, char *, ...);";
};
-
-/*
- * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
- * of UINT32_C has undefined behavior according to ISO/ANSI:
- * the arguments to __CONCAT__ are not macro expanded before the
- * concatination happens so the trailing ')' in the first argument
- * is concatinated with the 'l' in the second argument creating an
- * invalid pp token. The behavior of invalid pp tokens is undefined.
- * GCC does not handle these invalid tokens the way the HP compiler does.
- * This problem will potentially occur anytime macros are used in the
- * arguments to __CONCAT__. A general solution to this problem would be to
- * insert another layer of macro between __CONCAT__ and its use
- * in UINT32_C. An example of this solution can be found in the C standard.
- * A more specific solution, the one used here, is to change the UINT32_C
- * macro to not used macros in the arguments to __CONCAT__.
- */
-fix = {
- hackname = hpux11_uint32_c;
- files = inttypes.h;
- select = "^#define UINT32_C\\(__c\\)[ \t]*"
- "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
- c_fix = format;
- c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
- test_text =
- "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
- "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
-};
-
-
/*
* Fix hpux 11.00 broken vsnprintf declaration
*/
@@ -1707,6 +1692,8 @@ fix = {
*/
fix = {
hackname = hpux_long_double;
+ mach = "*-*-hpux10*";
+ mach = "*-*-hpux11.[012]*";
files = stdlib.h;
select = "extern[ \t]long_double[ \t]strtold";
bypass = "long_double_t";
@@ -1722,6 +1709,20 @@ fix = {
"extern long_double strtold(const char *, char **);\n";
};
+ /*
+ * We cannot use the above rule on 11.31 because it removes the strtold
+ * definition. ia64 is OK with no hack, PA needs some help.
+ */
+fix = {
+ hackname = hpux_long_double_2;
+ mach = "hppa*-*-hpux11.3*";
+ files = stdlib.h;
+ select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
+ c_fix = format;
+ c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)";
+
+ test_text = "# if !defined(__ia64) || !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)\n";
+};
/*
* Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
@@ -1835,6 +1836,97 @@ fix = {
"}\n";
};
+fix = {
+ hackname = hpux_c99_intptr;
+ mach = "*-hp-hpux11.3*";
+ files = stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
+ test_text = "#define PTRDIFF_MAX INT32_MAX\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define UINTPTR_MAX UINT32_MAX\n"
+ "#define SIZE_MAX UINT32_MAX\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+
+fix = {
+ hackname = hpux_c99_inttypes;
+ mach = "*-hp-hpux11.[23]*";
+ files = inttypes.h;
+ files = stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@#define UINT32_C(__c) __CONCAT__(__c,u)@";
+ test_text = "#define UINT8_C(__c) __CONCAT_U__(__c)\n"
+ "#define UINT16_C(__c) __CONCAT_U__(__c)\n"
+ "#define INT32_C(__c) __CONCAT__(__c,l)\n"
+ "#define UINT32_C(__c) __CONCAT__(__c,ul)\n";
+};
+
+fix = {
+ hackname = hpux_c99_inttypes2;
+ mach = "*-hp-hpux11.2*";
+ files = stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
+ test_text = "# define INT8_C(__c) ((signed char)(__c))\n"
+ "# define UINT8_C(__c) ((unsigned char)(__c))\n"
+ "# define INT16_C(__c) ((short)(__c))\n"
+ "# define UINT16_C(__c) ((unsigned short)(__c))\n";
+};
+
+fix = {
+ hackname = hpux_stdint_least;
+ mach = "*-hp-hpux11.2*";
+ files = stdint.h;
+ select = "^[ \t]*#[ \t]*define[ \t]*UINT_LEAST64_MAX[ \t]*ULLONG_MAX";
+ c_fix = format;
+ c_fix_arg = "#ifdef __LP64__\n# define UINT_LEAST64_MAX ULONG_MAX\n#else\n%0\n#endif\n";
+ test_text ="# define UINT_LEAST64_MAX ULLONG_MAX\n";
+};
+
+fix = {
+ hackname = hpux_stdint_fast;
+ mach = "*-hp-hpux11.2*";
+ files = stdint.h;
+ select = "^[ \t]*#[ \t]*define[ \t]*UINT_FAST64_MAX[ \t]*ULLONG_MAX";
+ c_fix = format;
+ c_fix_arg = "#ifdef __LP64__\n# define UINT_FAST64_MAX ULONG_MAX\n#else\n%0\n#endif\n";
+ test_text ="# define UINT_FAST64_MAX ULLONG_MAX\n";
+};
+
+fix = {
+ hackname = hpux_inttype_int_least8_t;
+ mach = "*-hp-hpux11.*";
+ files = sys/_inttypes.h;
+ select = "^[ \t]*typedef[ \t]*char[ \t]*int_least8_t.*";
+ c_fix = format;
+ c_fix_arg = "typedef signed char int_least8_t;";
+ test_text ="typedef char int_least8_t;\n";
+};
+
+fix = {
+ hackname = hpux_inttype_int8_t;
+ mach = "*-hp-hpux11.*";
+ files = sys/_inttypes.h;
+ select = "^[ \t]*typedef[ \t]*char[ \t]*int8_t.*";
+ c_fix = format;
+ c_fix_arg = "typedef signed char int8_t;";
+ test_text ="typedef char int8_t;\n";
+};
+
/*
* Fix glibc definition of HUGE_VAL in terms of hex floating point constant
*/
diff --git a/fixincludes/tests/base/inttypes.h b/fixincludes/tests/base/inttypes.h
index 06d7ebd5ce3..3f556856a41 100644
--- a/fixincludes/tests/base/inttypes.h
+++ b/fixincludes/tests/base/inttypes.h
@@ -9,7 +9,10 @@
-#if defined( HPUX11_UINT32_C_CHECK )
-#define CONCAT_U__(__c) __CONCAT__(__c,u)
-#define UINT32_C(__c) __CONCAT__(__c,ul)
-#endif /* HPUX11_UINT32_C_CHECK */
+#if defined( HPUX_C99_INTTYPES_CHECK )
+#define UINT8_C(__c) (__c)
+#define UINT16_C(__c) (__c)
+#define INT32_C(__c) (__c)
+#define UINT32_C(__c) __CONCAT__(__c,u)
+
+#endif /* HPUX_C99_INTTYPES_CHECK */
diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h
index 9ca62aea785..653c5da69e8 100644
--- a/fixincludes/tests/base/stdint.h
+++ b/fixincludes/tests/base/stdint.h
@@ -9,6 +9,55 @@
+#if defined( GLIBC_STDINT_CHECK )
+/* This file is part of the GNU C Library. */
+# define UINT8_C(c) c
+# define UINT16_C(c) c
+#endif /* GLIBC_STDINT_CHECK */
+
+
+#if defined( HPUX_C99_INTPTR_CHECK )
+#define PTRDIFF_MAX __PTRDIFF_MAX__
+#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
+#define INTPTR_MAX (2147483647l)
+#define INTPTR_MIN (-INTPTR_MAX - 1)
+#define UINTPTR_MAX (4294967295ul)
+#define SIZE_MAX __SIZE_MAX__
+
+#endif /* HPUX_C99_INTPTR_CHECK */
+
+
+#if defined( HPUX_C99_INTTYPES2_CHECK )
+#define INT8_C(__c) (__c)
+#define UINT8_C(c) __UINT8_C(c)
+#define INT16_C(__c) (__c)
+#define UINT16_C(c) __UINT16_C(c)
+
+#endif /* HPUX_C99_INTTYPES2_CHECK */
+
+
+#if defined( HPUX_STDINT_LEAST_CHECK )
+#ifdef __LP64__
+# define UINT_LEAST64_MAX ULONG_MAX
+#else
+# define UINT_LEAST64_MAX ULLONG_MAX
+#endif
+
+
+#endif /* HPUX_STDINT_LEAST_CHECK */
+
+
+#if defined( HPUX_STDINT_FAST_CHECK )
+#ifdef __LP64__
+# define UINT_FAST64_MAX ULONG_MAX
+#else
+# define UINT_FAST64_MAX ULLONG_MAX
+#endif
+
+
+#endif /* HPUX_STDINT_FAST_CHECK */
+
+
#if defined( IRIX_STDINT_C99_CHECK )
#if 0
#error This header file is to be used only for c99 mode compilations
diff --git a/fixincludes/tests/base/stdlib.h b/fixincludes/tests/base/stdlib.h
index e7174e19108..d104cc7d517 100644
--- a/fixincludes/tests/base/stdlib.h
+++ b/fixincludes/tests/base/stdlib.h
@@ -20,6 +20,12 @@ extern long double strtold(const char *, char **);
#endif /* HPUX_LONG_DOUBLE_CHECK */
+#if defined( HPUX_LONG_DOUBLE_2_CHECK )
+# if !defined(__ia64) || !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)
+
+#endif /* HPUX_LONG_DOUBLE_2_CHECK */
+
+
#if defined( INT_ABORT_FREE_AND_EXIT_CHECK )
extern void abort(int);
extern void free(void*);
diff --git a/fixincludes/tests/base/sys/_inttypes.h b/fixincludes/tests/base/sys/_inttypes.h
new file mode 100644
index 00000000000..6773ab834c9
--- /dev/null
+++ b/fixincludes/tests/base/sys/_inttypes.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/sys/_inttypes.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( HPUX_INTTYPE_INT_LEAST8_T_CHECK )
+typedef signed char int_least8_t;
+
+#endif /* HPUX_INTTYPE_INT_LEAST8_T_CHECK */
+
+
+#if defined( HPUX_INTTYPE_INT8_T_CHECK )
+typedef signed char int8_t;
+
+#endif /* HPUX_INTTYPE_INT8_T_CHECK */
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67a820ee8be..83b14c34bf9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,1530 @@
+2009-05-07 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR tree-optimization/40049
+ * tree-vect-stmts.c (vectorizable_operation): If the machine has
+ only vector/vector shifts, convert the type of the constant to the
+ appropriate type to avoid building incorrect trees, which
+ eventually have problems with garbage collection.
+
+2009-05-08 Joseph Myers <joseph@codesourcery.com>
+
+ * fold-const.c (fold_binary): Do not fold multiplication by 1 or
+ -1 for complex floating-point types if honoring signed zeros.
+
+2009-05-08 Jan Hubicka <jh@suse.cz>
+
+ * cgraphbuild.c (compute_call_stmt_bb_frequency): Accept function argument;
+ handle correctly when profile is absent.
+ (build_cgraph_edges): Update.
+ (rebuild_cgraph_edges): Update.
+ * cgraph.c: Do not include varrau.h
+ (cgraph_set_call_stmt_including_clones, cgraph_create_edge_including_clones):
+ New function
+ (cgraph_update_edges_for_call_stmt_node): New stati cfunction.
+ (cgraph_update_edges_for_call_stmt): Handle clones.
+ (cgraph_remove_node): Handle clone tree.
+ (cgraph_remove_node_and_inline_clones): New function.
+ (dump_cgraph_node): Dump clone tree.
+ (cgraph_clone_node): Handle clone tree.
+ (clone_function_name): Bring here from tree-inline.c
+ (cgraph_create_virtual_clone): New function.
+ * cgraph.h (ipa_replace_map): Move ehre from ipa.h
+ (cgraph_clone_info): New function
+ (strut cgraph_node): Add clone_info and new clone tree pointers.
+ (cgraph_remove_node_and_inline_clones, cgraph_set_call_stmt_including_clones,
+ cgraph_create_edge_including_clones, cgraph_create_virtual_clone): Declare.
+ (cgraph_function_versioning): Use VEC argument.
+ (compute_call_stmt_bb_frequency): Update prototype.
+ (cgraph_materialize_all_clones): New function.
+ * ipa-cp.c (ipcp_update_cloned_node): Remove.
+ (ipcp_create_replace_map): Update to VECtors.
+ (ipcp_update_callgraph): Use virtual clones.
+ (ipcp_update_bb_counts, ipcp_update_edges_counts): Remove.
+ (ipcp_update_profiling): Do not update local profiling.
+ (ipcp_insert_stage): Use VECtors and virtual clones.
+ * cgraphunit.c (verify_cgraph_node): Verify clone tree.
+ (clone_of_p): New function.
+ (cgraph_preserve_function_body_p): Use clone tree.
+ (cgraph_optimize): Materialize clones.
+ (cgraph_function_versioning): Update for VECtors.
+ (save_inline_function_body): Use clone tree.
+ (cgraph_materialize_clone, cgraph_materialize_all_clones): New functions.
+ * ipa-inline.c (cgraph_default_inline_p): Use analyzed flags.
+ * ipa.c: Include gimple.h.
+ (cgraph_remove_unreachable_nodes): Use clone tree.
+ * ipa-prop.c (ipa_note_param_call): Update call of compute_call_stmt_bb_frequency.
+ * ipa-prop.h (ipa_replace_map): Move to cgraph.h.
+ * tree-inline.c: Do not include varray.h; do not include gt-tree-inline.h
+ (copy_bb): Handle updating of clone tree; add new edge when new call
+ appears.
+ (expand_call_inline): Be strict about every call having edge.
+ (clone_fn_id_num, clone_function_name): Move to cgraph.c.
+ (delete_unreachable_blocks_update_callgraph): New function.
+ (tree_function_versioning): Use VECtors; always remove unreachable blocks
+ and fold conditionals.
+ * tree-inline.h: Do not include varray.h
+ (tree_function_versioning): Remove.
+ * Makefile.in (GTFILES): Remove tree-inline.c
+ * passes.c (do_per_function): Do only functions having body.
+ * ipa-struct-reorg.c (do_reorg_1, collect_data_accesses): Handle cone tree.
+
+2009-05-08 H.J. Lu <hongjiu.lu@intel.com>
+ Andrew Morrow <acm@google.com>
+
+ PR c/36892
+ * c-common.c (c_common_attribute_table): Permit deprecated
+ attribute to take an optional argument.
+ (handle_deprecated_attribute): If the optional argument to
+ __attribute__((deprecated)) is not a string ignore the attribute
+ and emit a warning.
+
+ * c-decl.c (grokdeclarator): Updated warn_deprecated_use call.
+ * c-typeck.c (build_component_ref): Likewise.
+ (build_external_ref): Likewise.
+
+ * toplev.c (warn_deprecated_use): Add an attribute argument.
+ Emit the message associated with __attribute__((deprecated)).
+
+ * toplev.h (warn_deprecated_use): Updated.
+
+ * doc/extend.texi: Document new optional parameter to
+ __attribute__((deprecated))
+
+2009-05-08 Michael Eager <eager@eagercon.com>
+
+ * config/rs6000/rs6000.md (*movdf_softfloat32): replace
+ !TARGET_DOUBLE_FLOAT with TARGET_SINGLE_FLOAT.
+
+2009-05-08 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40062
+ * tree-scalar-evolution.c (follow_ssa_edge_in_condition_phi):
+ Avoid exponential behavior.
+
+2009-05-08 Paolo Bonzini <bonzini@gnu.org>
+
+ PR rtl-optimization/33928
+ PR 26854
+ * fwprop.c (use_def_ref, get_def_for_use, bitmap_only_bit_bitween,
+ process_uses, build_single_def_use_links): New.
+ (update_df): Update use_def_ref.
+ (forward_propagate_into): Use get_def_for_use instead of use-def
+ chains.
+ (fwprop_init): Call build_single_def_use_links and let it initialize
+ dataflow.
+ (fwprop_done): Free use_def_ref.
+ (fwprop_addr): Eliminate duplicate call to df_set_flags.
+ * df-problems.c (df_rd_simulate_artificial_defs_at_top,
+ df_rd_simulate_one_insn): New.
+ (df_rd_bb_local_compute_process_def): Update head comment.
+ (df_chain_create_bb): Use the new RD simulation functions.
+ * df.h (df_rd_simulate_artificial_defs_at_top,
+ df_rd_simulate_one_insn): New.
+ * opts.c (decode_options): Enable fwprop at -O1.
+ * doc/invoke.texi (-fforward-propagate): Document this.
+
+2009-05-08 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/24581
+ * c-typeck.c (build_binary_op): Handle arithmetic between one real
+ and one complex operand specially.
+ * tree-complex.c (some_nonzerop): Do not identify a real value as
+ zero if flag_signed_zeros.
+
+2009-05-08 Paolo Bonzini <bonzini@gnu.org>
+
+ PR rtl-optimization/33928
+ * loop-invariant.c (record_use): Fix && vs. || mishap.
+
+2009-05-08 Paolo Bonzini <bonzini@gnu.org>
+
+ PR rtl-optimization/33928
+ * loop-invariant.c (struct use): Add addr_use_p.
+ (struct def): Add n_addr_uses.
+ (struct invariant): Add cheap_address.
+ (create_new_invariant): Set cheap_address.
+ (record_use): Accept df_ref. Set addr_use_p and update n_addr_uses.
+ (record_uses): Pass df_ref to record_use.
+ (get_inv_cost): Do not add inv->cost to comp_cost for cheap addresses used
+ only as such.
+
+2009-05-08 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c: Do not include c-pragma.h.
+
+2009-05-07 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * config/spu/spu.c: Remove include of c-common.h.
+
+2009-05-07 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/39037
+ * c-common.h (mark_valid_location_for_stdc_pragma,
+ valid_location_for_stdc_pragma_p, set_float_const_decimal64,
+ clear_float_const_decimal64, float_const_decimal64_p): New.
+ * c.opt (Wunsuffixed-float-constants): New.
+ * c-lex.c (interpret_float): Use pragma FLOAT_CONST_DECIMAL64 for
+ unsuffixed float constant, handle new warning.
+ * c-cppbuiltin.c (c_cpp_builtins): Use cast for double constants.
+ * c-decl.c (c_scope): New flag float_const_decimal64.
+ (set_float_const_decimal64, clear_float_const_decimal64,
+ float_const_decimal64_p): New.
+ (push_scope): Set new flag.
+ * c-parser.c (c_parser_translation_unit): Mark when it's valid
+ to use STDC pragmas.
+ (c_parser_external_declaration): Ditto.
+ (c_parser_compound_statement_nostart): Ditto.
+ * c-pragma.c (valid_location_for_stdc_pragma,
+ mark_valid_location_for_stdc_pragma,
+ valid_location_for_stdc_pragma_p, handle_stdc_pragma,
+ handle_pragma_float_const_decimal64): New.
+ (init_pragma): Register new pragma FLOAT_CONST_DECIMAL64.
+ * cp/semantics.c (valid_location_for_stdc_pragma_p,
+ set_float_const_decimal64, clear_float_const_decimal64,
+ float_const_decimal64_p): New dummy functions.
+ * doc/extend.texi (Decimal Float): Remove statement that the
+ pragma, and suffix for double constants, are not supported.
+ * doc/invoke.texi (Warning Options): List new option.
+ (-Wunsuffixed-float-constants): New.
+
+2009-05-08 Steven Bosscher <steven@gcc.gnu.org>
+
+ * config/i386/i386.c: Do not include c-common.h.
+
+2009-05-07 Mark Heffernan <meheff@google.com>
+
+ * doc/invoke.texi (Debugging Options): Document change of debugging
+ dump location.
+ * opts.c (decode_options): Make dump_base_name relative to
+ aux_base_name directory.
+
+2009-05-07 Hariharan Sandanagobalane <hariharan@picochip.com>
+
+ * config/picochip/picochip.h (NO_DOLLAR_IN_LABEL): Added.
+ * config/picochip/libgccExtras/divmod15.asm : Removed redefiniton.
+
+2009-05-07 Rafael Avila de Espindola <espindola@google.com>
+
+ * Makefile.in (install-plugin): Simplify a bit.
+
+2009-05-07 Paolo Bonzini <bonzini@gnu.org>
+
+ * Makefile.in (OBJS-common): Add regcprop.o.
+ (regcprop.o): New.
+ * timevar.def (TV_CPROP_REGISTERS): New.
+ * regrename.c (regrename_optimize): Return 0.
+ (rest_of_handle_regrename): Delete.
+ (pass_rename_registers): Point to regrename_optimize.
+ (struct value_data_entry, struct value_data,
+ kill_value_one_regno, kill_value_regno, kill_value,
+ set_value_regno, init_value_data, kill_clobbered_value,
+ kill_set_value, kill_autoinc_value, copy_value,
+ mode_change_ok, maybe_mode_change, find_oldest_value_reg,
+ replace_oldest_value_reg, replace_oldest_value_addr,
+ replace_oldest_value_mem, copyprop_hardreg_forward_1,
+ debug_value_data, validate_value_data): Move...
+ * regcprop.c: ... here.
+ (rest_of_handle_cprop): Delete.
+ (pass_cprop_hardreg): Point to copyprop_hardreg_forward.
+
+2009-05-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/40057
+ * dojump.c (prefer_and_bit_test): Use immed_double_const instead of
+ GEN_INT for 1 << bitnum.
+ (do_jump) <case BIT_AND_EXPR>: Use build_int_cst_wide_type instead of
+ build_int_cst_type.
+
+2009-05-07 Uros Bizjak <ubizjak@gmail.com>
+
+ * doc/md.texi (Standard Pattern Names For Generation) [sync_nand]:
+ Remove wrong description of "nand" functionality.
+
+2009-05-06 Richard Guenther <rguenther@suse.de>
+ Adam Nemet <anemet@caviumnetworks.com>
+
+ * gimple.def (GIMPLE_ASSIGN): Fix incorrect information in the
+ comment. Add that if LHS is not a gimple register, then RHS1 has
+ to be a single object (GIMPLE_SINGLE_RHS).
+
+2009-05-06 Adam Nemet <anemet@caviumnetworks.com>
+
+ * expr.c (get_def_for_expr): Move it up in the file.
+ (store_field): When expanding a bit-field store, look at the
+ defining gimple stmt for the masking conversion.
+
+2009-05-06 Janis Johnson <janis187@us.ibm.com>
+
+ PR middle-end/39986
+ * dfp.c (encode_decimal32, decode_decimal32, encode_decimal64,
+ decode_decimal64, encode_decimal128, decode_decimal128): Avoid
+ 32-bit memcpy into long.
+
+2009-05-06 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (new_reg_loc_descr): Don't ever create DW_OP_regX.
+ (one_reg_loc_descriptor): Create DW_OP_regX here instead of calling
+ new_reg_loc_descr.
+ (loc_by_reference): If loc is DW_OP_regX, change it into DW_OP_bregX 0
+ instead of appending DW_OP_deref*.
+
+2009-05-06 Michael Matz <matz@suse.de>
+
+ PR middle-end/40021
+ * cfgexpand.c (maybe_cleanup_end_of_block): New static function.
+ (expand_gimple_cond): Use it to cleanup CFG and superfluous jumps.
+
+2009-05-06 Rafael Avila de Espindola <espindola@google.com>
+
+ * Makefile.in (install-plugin): Fix srcdir handling.
+
+2009-05-06 Andrey Belevantsev <abel@ispras.ru>
+
+ * tree-ssa.c (execute_update_address_taken): Handle TARGET_MEM_REF
+ when processing for not_regs_needed bitmap.
+ * gimple.c (walk_stmt_load_store_addr_ops): When visiting address,
+ handle TARGET_MEM_REF in lhs. Check TMR_BASE for NULL while
+ handling it for rhs.
+
+2009-05-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.md (unnamed inc/dec peephole): Use
+ optimize_insn_for_size_p instead of optimize_size.
+ * config/i386/predicates.md (incdec_operand): Likewise.
+ (aligned_operand): Likewise.
+ * config/i386/sse.md (divv8sf3): Likewise.
+ (sqrtv8sf2): Likewise.
+
+2009-05-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_build_signbit_mask): Make it static.
+
+ * config/i386/i386-protos.h (ix86_build_signbit_mask): Removed.
+
+2009-05-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.md (*avx_<code><mode>3_finite): Replace
+ ssemodesuffixf2c with avxmodesuffixf2c.
+
+2009-05-06 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/40032
+ * c-decl.c (grokdeclarator): Handle incomplete type of unnamed field.
+
+2009-05-05 Jakub Jelinek <jakub@redhat.com>
+
+ * tree.h: Remove DECL_BY_REFERENCE from private_flag comment.
+ (struct tree_base): Adjust spacing for 8 bit boundaries.
+ (struct tree_decl_common): Add decl_by_reference_flag bit.
+ (DECL_BY_REFERENCE): Adjust.
+ * print-tree.c (print_node): For VAR_DECL, PARM_DECL or RESULT_DECL,
+ print DECL_BY_REFERENCE bit.
+ * dbxout.c (DECL_ACCESSIBILITY_CHAR): Revert last change.
+ * dwarf2out.c (loc_by_reference, gen_decl_die): Check
+ DECL_BY_REFERENCE for all VAR_DECLs, not just non-static ones.
+ (gen_variable_die): Likewise. Check TREE_PRIVATE/TREE_PROTECTED
+ unconditionally.
+
+ PR middle-end/39666
+ * gimplify.c (gimplify_switch_expr): If case labels cover the whole
+ range of the type, but default label is missing, add it with one
+ of the existing labels instead of adding a new label for it.
+
+2009-05-05 Joseph Myers <joseph@codesourcery.com>
+
+ * dwarf.h: Remove.
+
+2009-05-05 Rafael Avila de Espindola <espindola@google.com>
+
+ * Makefile.in (enable_plugin, plugin_includedir): New.
+ (install): Depend on install-plugin.
+ (PLUGIN_HEADERS): New.
+ (install-plugin): New.
+ * config.gcc: Add vxworks-dummy.h to tm_file for x86 and x86-64.
+
+2009-05-05 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40022
+ * tree-ssa-phiprop.c (struct phiprop_d): Exchange vop_stmt for
+ the only vuse.
+ (phivn_valid_p): Fix tuplification error, simplify.
+ (phiprop_insert_phi): Add dumps.
+ (propagate_with_phi): Simplify.
+
+2009-05-05 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40023
+ * builtins.c (gimplify_va_arg_expr): Properly build the address.
+
+2009-05-05 Shujing Zhao <pearly.zhao@oracle.com>
+
+ * tree.h (strip_float_extensions): Remove duplicate declaration.
+ (build_low_bits_mask, debug_fold_checksum, expand_function_end,
+ expand_function_start, stack_protect_prologue, stack_protect_epilogue,
+ block_ultimate_origin): Rearrange the declarations line to match the
+ comment that indicates the .c file which the functions are defined.
+ (dwarf2out_*, set_decl_rtl): Add comment.
+ (get_base_address): Adjust comment.
+ (change_decl_assembler_name, maybe_fold_*, build_addr): Rearrange the
+ declarations line and add comment.
+ (is_builtin_name): Add blank after function name, for clarity.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * attribs.c (decl_attributes): Use %qE for identifiers in
+ diagnostics.
+ * cgraphunit.c (verify_cgraph_node): Translate function names to
+ locale character set in diagnostics.
+ * coverage.c (get_coverage_counts): Use %qE for identifiers in
+ diagnostics.
+ * doc/invoke.texi (-finstrument-functions-exclude-function-list):
+ Document that functions are named in UTF-8.
+ * expr.c (expand_expr_real_1): Translate function names to locale
+ character set in diagnostics.
+ * gimplify.c (omp_notice_variable, omp_is_private,
+ gimplify_scan_omp_clauses): Use %qE for identifiers in
+ diagnostics.
+ * langhooks.c (lhd_print_error_function): Translate function names
+ to locale character set.
+ * langhooks.h (decl_printable_name): Document that return value is
+ in internal character set.
+ * stmt.c: Include pretty-print.h
+ (tree_conflicts_with_clobbers_p): Use %qE for identifiers in
+ diagnostics.
+ (resolve_operand_name_1): Translate named operand name to locale
+ character set.
+ * stor-layout.c (finalize_record_size): Use %qE for identifiers in
+ diagnostics.
+ * toplev.c (announce_function): Translate function names to locale
+ character set.
+ (warn_deprecated_use): Use %qE for identifiers in diagnostics.
+ (default_tree_printer): Use pp_identifier or translate identifiers
+ to locale character set. Mark "<anonymous>" for translation.
+ * tree-mudflap.c (mx_register_decls, mudflap_finish_file): Use %qE
+ for identifiers in diagnostics.
+ * tree.c (handle_dll_attribute): Use %qE for identifiers in
+ diagnostics.
+ * varasm.c (output_constructor): Use %qE for identifiers in
+ diagnostics.
+
+2009-05-04 Rafael Avila de Espindola <espindola@google.com>
+
+ * configure.ac: use ` ` instead of $()
+ * configure: Regenerate.
+
+2009-05-05 Ben Elliston <bje@au.ibm.com>
+
+ * config/pa/linux-atomic.c: Eliminate conditional include of
+ errno.h on non-LP64 systems to simplify build requirements.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.c (handle_mode_attribute): Use %qE for identifiers in
+ diagnostics.
+ * c-decl.c (check_bitfield_type_and_width): Make orig_name a tree
+ and pass value to identifier_to_locale.
+ (warn_variable_length_array): Make name a tree.
+ (grokdeclarator): Separate diagnostic texts for named and unnamed
+ declarators. Use %qE for named declarators.
+ * c-parser.c (c_lex_one_token): Use %qE for identifiers in
+ diagnostics.
+ * c-pragma.c (pop_alignment, handle_pragma_pack): Use %qE for
+ identifiers in diagnostics.
+ * c-typeck.c (push_member_name, start_init): Pass identifiers to
+ identifier_to_locale. Mark "anonymous" strings for translation.
+
+2009-05-04 Michael Eager <eager@eagercon.com>
+
+ * config/rs6000/rs6000.c (rs6000_legitimate_address): Allow
+ address for DImode/DFmode only if double-precision FP regs.
+
+2009-05-04 Michael Eager <eager@eagercon.com>
+
+ * config/rs6000/rs6000.c (rs6000_libcall_value): Add
+ TARGET_SINGLE_FLOAT check.
+
+2009-05-04 Michael Eager <eager@eagercon.com>
+
+ * config/rs6000/xilinx.h: Add CPP_SPEC for -mxilinx-fpu options.
+
+2009-05-04 Michael Eager <eager@eagercon.com>
+
+ * gcc/config.gcc: (powerpc-xilinx-eabi*): Add tm t-xilinx
+ * config/rs6000/t-xilinx: New
+
+2009-05-04 Paolo Bonzini <bonzini@gnu.org>
+
+ * doc/tm.texi (LEGITIMIZE_ADDRESS): Revise documentation.
+ * gcc/defaults.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/explow.c (memory_address): Use target hook.
+ * gcc/targhooks.c (default_legitimize_address): New.
+ * gcc/targhooks.h (default_legitimize_address): New.
+ * gcc/target.h (legitimize_address): New.
+ * gcc/target-def.h (TARGET_LEGITIMIZE_ADDRESS): New.
+ (TARGET_INITIALIZER): Include it.
+ * gcc/system.h (LEGITIMIZE_ADDRESS): Poison.
+
+ * config/bfin/bfin-protos.h (legitimize_address): Remove.
+ * config/bfin/bfin.c (legitimize_address): Remove.
+ * config/bfin/bfin.h (LEGITIMIZE_ADDRESS): Remove.
+ * config/m68hc11/m68hc11-protos.h (m68hc11_legitimize_address):
+ Remove.
+ * config/m68hc11/m68hc11.c (m68hc11_legitimize_address): Remove.
+ * config/m68hc11/m68hc11.h (LEGITIMIZE_ADDRESS): Remove.
+
+ * gcc/config/arm/arm.h (LEGITIMIZE_ADDRESS, ARM_LEGITIMIZE_ADDRESS,
+ THUMB_LEGITIMIZE_ADDRESS, THUMB2_LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/s390/s390.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/m32c/m32c.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/sparc/sparc.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/m32r/m32r.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/i386/i386.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/sh/sh.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/avr/avr.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/m68hc11/m68hc11.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/iq2000/iq2000.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/mn10300/mn10300.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/m68k/m68k.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/score/score.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/pa/pa.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/mips/mips.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/alpha/alpha.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/frv/frv.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/spu/spu.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/xtensa/xtensa.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/cris/cris.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/rs6000/rs6000.h (LEGITIMIZE_ADDRESS): Delete.
+ * gcc/config/picochip/picochip.h (LEGITIMIZE_ADDRESS): Delete.
+
+ * gcc/config/s390/s390-protos.h (legitimize_address): Delete.
+ * gcc/config/m32c/m32c-protos.h (m32c_legitimize_address): Delete.
+ * gcc/config/sparc/sparc-protos.h (legitimize_address): Delete.
+ * gcc/config/i386/i386-protos.h (legitimize_address): Delete.
+ * gcc/config/avr/avr-protos.h (legitimize_address): Delete.
+ * gcc/config/mn10300/mn10300-protos.h (legitimize_address): Delete.
+ * gcc/config/score/score-protos.h (score_legitimize_address): Delete.
+ * gcc/config/arm/arm-protos.h (arm_legitimize_address,
+ (thumb_legitimize_address): Delete.
+ * gcc/config/pa/pa-protos.h (hppa_legitimize_address): Delete.
+ * gcc/config/mips/mips-protos.h (mips_legitimize_address): Delete.
+ * gcc/config/alpha/alpha-protos.h (alpha_legitimize_address): Delete.
+ * gcc/config/frv/frv-protos.h (frv_legitimize_address): Delete.
+ * gcc/config/spu/spu-protos.h (spu_legitimize_address): Delete.
+ * gcc/config/xtensa/xtensa-protos.h (xtensa_legitimize_address):
+ Delete.
+ * gcc/config/rs6000/rs6000-protos.h (rs6000_legitimize_address):
+ Delete.
+
+ * config/arm/arm.c (arm_legitimize_address): Maybe call Thumb version.
+ * config/m32c/m32c.c (m32c_legitimize_address): Standardize.
+ * config/m32r/m32r.c (m32r_legitimize_address): New.
+ * config/m68k/m68k.c (m68k_legitimize_address): New.
+ * config/score/score.c (score_legitimize_address): Standardize.
+ * config/score/score3.c (score3_legitimize_address): Standardize.
+ * config/score/score3.h (score3_legitimize_address): Adjust.
+ * config/score/score7.c (score7_legitimize_address): Standardize.
+ * config/score/score7.h (score7_legitimize_address): Adjust.
+ * config/sh/sh.c (sh_legitimize_address): New.
+ * config/iq2000/iq2000.c (iq2000_legitimize_address): New.
+
+ * gcc/config/s390/s390.c (legitimize_address): Rename to...
+ (s390_legitimize_address): ... this.
+ * gcc/config/sparc/sparc.c (legitimize_address): Rename to...
+ (sparc_legitimize_address): ... this.
+ * gcc/config/i386/i386.c (legitimize_address): Rename to...
+ (ix86_legitimize_address): ... this.
+ * gcc/config/avr/avr.c (legitimize_address): Rename to...
+ (avr_legitimize_address): ... this.
+ * gcc/config/mn10300/mn10300.c (legitimize_address): Rename to...
+ (mn10300_legitimize_address): ... this.
+ * config/alpha/alpha.c (alpha_legitimize_address): Wrap...
+ (alpha_legitimize_address_1): ... the old alpha_legitimize_address.
+ (alpha_expand_mov): Adjust call.
+
+ * config/frv/frv.c (frv_legitimize_address): Return x on failure.
+ * config/spu/spu.c (spu_legitimize_address): Likewise.
+ * config/xtensa/xtensa.c (xtensa_legitimize_address): Likewise.
+ * config/rs6000/rs6000.c (rs6000_legitimize_address): Likewise.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * intl.c (locale_encoding, locale_utf8): New.
+ (gcc_init_libintl): Initialize locale_encoding and locale_utf8.
+ * intl.h (locale_encoding, locale_utf8): Declare.
+ * pretty-print.c: Include ggc.h. Include iconv.h if HAVE_ICONV.
+ (pp_base_tree_identifier, decode_utf8_char, identifier_to_locale):
+ New.
+ * pretty-print.h (pp_identifier): Call identifier_to_locale on ID
+ argument.
+ (pp_tree_identifier): Define to call pp_base_tree_identifier.
+ (pp_base_tree_identifier): Declare as function.
+ (identifier_to_locale): Declare.
+ * Makefile.in (pretty-print.o): Update dependencies.
+ * varasm.c (finish_aliases_1): Use %qE for identifiers in diagnostics.
+
+2009-05-04 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40015
+ * builtins.c (fold_builtin_memory_op): Do not decay to element
+ type if the size matches the whole array.
+
+2009-05-04 Kazu Hirata <kazu@codesourcery.com>
+
+ * expmed.c (synth_mult): When trying out a shift, pass the result
+ of a signed shift.
+
+2009-05-04 Kazu Hirata <kazu@codesourcery.com>
+
+ * expmed.c (shiftsub_cost): Rename to shiftsub0_cost.
+ (shiftsub1_cost): New.
+ (init_expmed): Compute shiftsub1_cost.
+ (synth_mult): Optimize multiplications by constants of the form
+ -(2^^m-1) for some constant positive integer m.
+
+2009-05-03 Richard Guenther <rguenther@suse.de>
+
+ PR c/39983
+ * c-typeck.c (array_to_pointer_conversion): Do not built
+ ADDR_EXPRs of arrays of pointer-to-element type.
+ * c-gimplify.c (c_gimplify_expr): Revert change fixing
+ up wrong ADDR_EXPRs after-the-fact.
+ * c-common.c (strict_aliasing_warning): Strip pointer
+ conversions for obtaining the original type.
+ * builtins.c (fold_builtin_memset): Handle array types.
+ (fold_builtin_memory_op): Handle folded POINTER_PLUS_EXPRs
+ and array types
+
+2009-05-03 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/23329
+ * tree-ssa.c (useless_type_conversion_p_1): Use get_deref_alias_set.
+ Do not lose casts from array types with unknown extent to array
+ types with known extent.
+ * tree-ssa-copy.c (may_propagate_copy): Remove hack checking for
+ alias set compatibility.
+
+2009-05-03 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * flags.h (extra_warnings): Delete.
+ * toplev.c (process_options): Handle Wuninitialized here.
+ * opts.c (extra_warnings): Delete.
+ (set_Wextra): Delete.
+ (common_handle_option): -Wextra can be handled automatically.
+ * c-opts.c (c_common_handle_option): Delete obsolete code.
+ (c_common_post_options): Simplify comment.
+ * common.opt (W): Add Var.
+ (Wextra): Add Var.
+ (Wuninitialized): Initialize to -1.
+
+2009-05-03 Adam Nemet <anemet@caviumnetworks.com>
+ Richard Guenther <rguenther@suse.de>
+
+ * expr.c (get_def_for_expr): New function.
+ (expand_expr_real_1) <PLUS_EXPR, MINUS_EXPR>: Adjust to work with
+ SSA rather than trees.
+ <MULT_EXPR>: Likewise. Use subexp0 and subexp1 instead of
+ TREE_OPERAND (exp, 0) and TREE_OPERAND (exp, 1).
+
+2009-05-03 Joseph Myers <joseph@codesourcery.com>
+
+ * c-common.c (reswords): Add _Imaginary.
+ * c-common.c (enum rid): Add RID_IMAGINARY.
+
+2009-05-03 Paolo Bonzini <bonzini@gnu.org>
+
+ * tree.h (TYPE_VECTOR_OPAQUE): Fix documentation.
+ Patch by Richard Guenther.
+
+2009-05-03 Anatoly Sokolov <aesok@post.ru>
+
+ * defaults.h (FRAME_POINTER_REQUIRED): Provide default.
+ * doc/tm.texi (FRAME_POINTER_REQUIRED): Revise documentation.
+ * config/alpha/alpha.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/s390/s390.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/spu/spu.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/sh/sh.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/pdp11/pdp11.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/stormy16/stormy16.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/m68hc11/m68hc11.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/iq2000/iq2000.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/mn10300/mn10300.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/ia64/ia64.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/m68k/m68k.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/rs6000/rs6000.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/picochip/picochip.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/mcore/mcore.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/h8300/h8300.h (FRAME_POINTER_REQUIRED): Delete.
+ * config/v850/v850.h (FRAME_POINTER_REQUIRED): Delete.
+
+2009-05-02 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/39940
+ * tree-ssa-pre.c (eliminate): Make sure we may propagate before
+ doing so.
+
+2009-05-02 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40001
+ * tree-ssa.c (execute_update_addresses_taken): Properly check
+ if we can mark a variable DECL_GIMPLE_REG_P.
+ * gimple.c (is_gimple_reg): Re-order check for DECL_GIMPLE_REG_P
+ back to the end of the function.
+ (is_gimple_reg_type): Remove complex type special casing.
+ * gimplify.c (gimplify_bind_expr): Do not set DECL_GIMPLE_REG_P
+ if not optimizing.
+
+2009-05-02 Ben Elliston <bje@au.ibm.com>
+
+ * doc/collect2.texi (Collect2): Document search path behaviour
+ when configured with --with-ld.
+
+2009-05-02 Jan Hubicka <jh@suse.cz>
+
+ * tree-ssa-coalesce.c (coalesce_cost): Do not take ciritical
+ parameter; update callers.
+ (coalesce_cost_edge): EH edges are costier because they needs
+ splitting even if not critical and even more costier when there are
+ multiple EH predecestors.
+
+2009-05-02 Jan Hubicka <jh@suse.cz>
+
+ * except.c (remove_eh_handler_and_replace): Handle updating after
+ removing TRY blocks.
+
+2009-05-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * store-motion.c (compute_store_table): Add ENABLE_CHECKING guard.
+
+2009-05-02 Steven Bosscher <steven@gcc.gnu.org>
+
+ * varasm.c: Do not include c-pragma.h.
+ * attribs.c: Do not incude c-common.h.
+
+2009-05-01 Michael Matz <matz@suse.de>
+
+ * calls.c (initialize_argument_information): Handle SSA names like
+ decls with a non MEM_P DECL_RTL.
+
+2009-05-01 Steven Bosscher <steven@gcc.gnu.org>
+
+ * ipa-reference.c: Do not include c-common.h, include splay-tree.h.
+ * ipa-utils.c: Likewise.
+ * ipa-type-escape.c: Likewise.
+ * cgraphunit.c Do not include c-common.h.
+ * ipa-pure-const.c: Likewise.
+ * tree-if-conv.c: Likewise.
+ * matrix-reorg.c: Do not include c-common.h and c-tree.h.
+ * ipa-struct-reorg.c: Likewise.
+ * tree-nomudflap.c: Likewise.
+ * tree-ssa-structalias.c: Likewise.
+
+2009-05-01 Steven Bosscher <steven@gcc.gnu.org>
+
+ * store-motion.c: Many cleanups to make this pass a first-class
+ citizen instead of an appendix to gcse load motion. Add TODO list
+ to make this pass faster/cleaner/better.
+
+ (struct ls_expr): Post gcse.c-split cleanups.
+ Rename to st_expr. Rename "loads" field to "antic_stores". Rename
+ "stores" field to "avail_stores".
+ (pre_ldst_mems): Rename to store_motion_mems.
+ (pre_ldst_table): Rename to store_motion_mems_table.
+ (pre_ldst_expr_hash): Rename to pre_st_expr_hash, update users.
+ (pre_ldst_expr_eq): Rename to pre_st_expr_eq, update users.
+ (ldst_entry): Rename to st_expr_entry, update users.
+ (free_ldst_entry): Rename to free_st_expr_entry, update users.
+ (free_ldst_mems): Rename to free_store_motion_mems, update users.
+ (enumerate_ldsts): Rename to enumerate_store_motion_mems,
+ update caller.
+ (first_ls_expr): Rename to first_st_expr, update users.
+ (next_ls_expr): Rename to next_st_expr, update users.
+ (print_ldst_list): Rename to print_store_motion_mems. Print names of
+ fields properly for store motion instead of names inherited from load
+ motion in gcse.c.
+ (ANTIC_STORE_LIST, AVAIL_STORE_LIST): Remove.
+ (LAST_AVAIL_CHECK_FAILURE): Explain what this is. Undefine when we
+ are done with it.
+
+ (ae_kill): Rename to st_kill, update users.
+ (ae_gen): Rename to st_avloc, update users.
+ (transp): Rename to st_transp, update users.
+ (pre_insert_map): Rename to st_insert_map, update users.
+ (pre_delete_map): Rename to st_delete_map, update users.
+ (insert_store, build_store_vectors, free_store_memory,
+ one_store_motion_pass): Update for abovementioned changes.
+
+ (gcse_subst_count, gcse_create_count): Remove.
+ (one_store_motion_pass): New statistics counters "n_stores_deleted"
+ and "n_stores_created", local variables.
+
+ (extract_mentioned_regs, extract_mentioned_regs_1): Rewrite to
+ use for_each_rtx.
+
+ (regvec, compute_store_table_current_insn): Remove.
+ (reg_set_info, reg_clear_last_set): Remove.
+ (compute_store_table): Use DF caches instead of local dataflow
+ solvers.
+
+2009-05-01 Joseph Myers <joseph@codesourcery.com>
+
+ * c-objc-common.c (c_tree_printer): Print identifiers with
+ pp_identifier, not pp_string. Mark "({anonymous})" for
+ translation.
+ * c-pretty-print.c (pp_c_ws_string): New.
+ (pp_c_cv_qualifier, pp_c_type_specifier,
+ pp_c_specifier_qualifier_list, pp_c_parameter_type_list,
+ pp_c_storage_class_specifier, pp_c_function_specifier,
+ pp_c_attributes, pp_c_bool_constant, pp_c_constant,
+ pp_c_primary_expression, pp_c_postfix_expression,
+ pp_c_unary_expression, pp_c_shift_expression,
+ pp_c_relational_expression, pp_c_equality_expression,
+ pp_c_logical_and_expression, pp_c_logical_or_expression): Mostly
+ use pp_string and pp_c_ws_string in place of pp_identifier and
+ pp_c_identifier for non-identifiers. Mark English strings for
+ translation.
+ * c-pretty-print.h (pp_c_ws_string): Declare.
+
+2009-04-30 Paul Pluzhnikov <ppluzhnikov@google.com>
+ Roland McGrath <roland@redhat.com>
+
+ * configure.ac (HAVE_LD_BUILDID): New check for ld --build-id support.
+ (ENABLE_LD_BUILDID): New configuration option.
+ * gcc.c [HAVE_LD_BUILDID and ENABLE_LD_BUILDID]
+ (LINK_BUILDID_SPEC): New macro.
+ (init_spec): If defined, prepend it between LINK_EH_SPEC and
+ link_spec.
+ * doc/install.texi: Document --enable-linker-build-id option.
+ * configure: Rebuild.
+ * config.in: Rebuild.
+
+2009-04-30 Adam Nemet <anemet@caviumnetworks.com>
+
+ * config/mips/mips.h (FRAME_GROWS_DOWNWARD,
+ MIPS_GP_SAVE_AREA_SIZE): Define new macros.
+ (STARTING_FRAME_OFFSET): Return 0 if FRAME_GROWS_DOWNWARD. Use
+ MIPS_GP_SAVE_AREA_SIZE.
+ * config/mips/mips.c (struct mips_frame_info): Update comment
+ before arg_pointer_offset and hard_frame_pointer_offset.
+ (mips_compute_frame_info): Update diagram before function: to
+ correctly use stack_pointer_rtx for fp_sp_offset and gp_sp_offset, to
+ indicate the position of frame_pointer_rtx with -fstack-protector and
+ to show args_size. Don't allocate cprestore area for leaf functions
+ if FRAME_GROWS_DOWNWARD. Use MIPS_GP_SAVE_AREA_SIZE to set
+ cprestore_size.
+ (mips_initial_elimination_offset): Update for FRAME_GROWS_DOWNWARD.
+
+2009-04-30 Michael Matz <matz@suse.de>
+
+ PR tree-optimization/39955
+ * config/rs6000/rs6000.c (rs6000_check_sdmode): Also check SSA_NAMEs.
+
+2009-04-30 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * ira.c (setup_cover_and_important_classes): Use safe macro
+ REG_CLASS_FOR_CONSTRAINT instead of calling regclass_for_constraint
+ directly.
+ * genpreds.c (write_tm_preds_h): Output suitable definition of
+ REG_CLASS_FOR_CONSTRAINT.
+
+2009-04-30 Rafael Avila de Espindola <espindola@google.com>
+
+ * alloc-pool.c (alloc_pool_descriptor): Use an insert_opion value
+ instead of an int.
+ * bitmap.c (bitmap_descriptor): Likewise.
+ * ggc-common.c (loc_descriptor): Likewise.
+ * varray.c (varray_descriptor): Likewise.
+ * vec.c (vec_descriptor): Likewise.
+
+2009-04-30 Eric Botcazou <ebotcazou@adacore.com>
+
+ * Makefile.in (dce.o): Add $(EXCEPT_H).
+ * dce.c: Include except.h and delete redundant vector definitions.
+ (deletable_insn_p): Return false for non-call insns that can throw
+ if DF is running.
+
+2009-04-30 Steven Bosscher <steven@gcc.gnu.org>
+
+ * gcse.c (ae_gen): Remove.
+ (can_assign_to_reg_p): Rename to can_assign_to_reg_without_clobbers_p
+ and make non-static function to make it available in store-motion.c.
+ Update call sites with search-and-replace.
+ (enumerate_ldsts, reg_set_info, reg_clear_last_set, store_ops_ok,
+ extract_mentioned_regs, extract_mentioned_regs_helper,
+ find_moveable_store, compute_store_table, load_kills_store, find_loads,
+ store_killed_in_insn, store_killed_after, store_killed_before,
+ build_store_vectors, insert_insn_start_basic_block, insert-store,
+ remove_reachable_equiv_notes, replace_store_insn, delete_store,
+ free_store_memory, one_store_motion_pass, gate_rtl_store_motion,
+ execute_rtl_store_motion, pass_rtl_store_motion): Move to...
+ * store-motion.c: ...new file. Also copy data structures from gcse.c
+ and clean up to remove parts not used by store motion.
+ * rtl.h (can_assign_to_reg_without_clobbers_p): Add prototype.
+ * Makefile.in (store-motion.o): New rule. Add to OBJS-common.
+
+2009-04-30 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ PR target/38571
+ * config/arm/arm.h (FUNCTION_BOUNDARY): Set to 16 for thumb
+ when optimizing for size.
+
+2009-04-30 Hans-Peter Nilsson <hp@axis.com>
+
+ * gcse.c (gcse_constant_p): Fix typo in last change.
+
+2009-04-30 Rafael Avila de Espindola <espindola@google.com>
+
+ * plugin.c: Include plugin-version.h only if ENABLE_PLUGIN is defined.
+
+2009-04-30 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * gcse.c (gcse_constant_p): Make sure the constant is sharable.
+
+2009-04-29 James E. Wilson <wilson@codesourcery.com>
+
+ * config/mips/mips.c (mips_add_offset): Use gen_int_mode for
+ CONST_HIGH_PART result.
+
+2009-04-29 Anatoly Sokolov <aesok@post.ru>
+
+ * config/avr/avr.c (initial_elimination_offset): Rename to
+ avr_initial_elimination_offset.
+ (frame_pointer_required_p): Rename to avr_frame_pointer_required_p,
+ change return type to bool.
+ (avr_can_eliminate): New function.
+ * config/avr/avr.h (CAN_ELIMINATE): Use avr_can_eliminate.
+ (FRAME_POINTER_REQUIRED): Use avr_frame_pointer_required_p.
+ (INITIAL_ELIMINATION_OFFSET): Use avr_initial_elimination_offset.
+ * config/avr/avr-protos.h (initial_elimination_offset): Rename to
+ avr_initial_elimination_offset.
+ (frame_pointer_required_p): Rename to avr_frame_pointer_required_p.
+ (avr_initial_elimination_offset): Define.
+
+2009-04-29 Eric Botcazou <ebotcazou@adacore.com>
+ Steven Bosscher <steven@gcc.gnu.org>
+
+ PR rtl-optimization/39938
+ * Makefile.in (cfgrtl.o): Add $(INSN_ATTR_H).
+ * cfgrtl.c: Include insn-attr.h.
+ (rest_of_pass_free_cfg): New function.
+ (pass_free_cfg): Use rest_of_pass_free_cfg as execute function.
+ * resource.c (init_resource_info): Remove call to df_analyze.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ PR target/39943
+ * config/i386/i386.c (ix86_vectorize_builtin_conversion): Only
+ allow conversion to signed integers.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ * tree-cfg.c (verify_gimple_assign_binary): Allow vector
+ shifts of floating point vectors if the shift amount is
+ a constant multiple of the element size.
+
+2009-04-29 Andreas Krebbel <krebbel1@de.ibm.com>
+ Michael Matz <matz@suse.de>
+
+ PR middle-end/39927
+ PR bootstrap/39929
+ * tree-outof-ssa.c (emit_partition_copy): New function.
+ (insert_partition_copy_on_edge, insert_rtx_to_part_on_edge,
+ insert_part_to_rtx_on_edge): Perform the partition base var
+ copy using emit_partition_copy.
+ (insert_value_copy_on_edge): Convert constants to the right mode.
+ (insert_rtx_to_part_on_edge): Add UNSIGNEDSRCP parameter.
+ (elim_create): Pass the sign of the src to insert_rtx_to_part_on_edge.
+
+2009-04-29 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.c (bfin_optimize_loop): If we need a scratch reg,
+ scan backwards to try to find a constant to initialize it.
+
+ * config/bfin/bfin.c (bfin_optimize_loop): When looking for the last
+ insn before the loop_end instruction, don't look past labels.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/39937
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Do not
+ loose type conversions.
+ (forward_propagate_addr_expr): Fix tuplification bug. Remove
+ stmts only if there are no uses of its definition.
+
+2009-04-29 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.h (splitting_loops): Declare.
+ * config/bfin/bfin-protos.h (WA_05000257, WA_05000283, WA_05000315):
+ Reorder bit definitions to be ascending.
+ (WA_LOAD_LCREGS, ENABLE_WA_LOAD_LCREGS): New macros.
+ * config/bfin/bfin.c (splitting_loops): New variable.
+ (bfin_cpus): Add WA_LOAD_LCREGS as needed.
+ (struct loop_info): Remove members INIT and LOOP_INIT.
+ (bfin_optimize_loop): Don't set them. Reorder the code that generates
+ the LSETUP sequence. Allow LC to be loaded from any register, but
+ also add a case to push/pop a PREG scratch if ENABLE_WA_LOAD_LCREGS.
+ (bfin_reorg_loops): When done, split all BB_ENDs with splitting_loops
+ set to 1.
+ * config/bfin/bfin.md (loop_end splitter): Use splitting_loops instead
+ of reload_completed.
+
+ From Jie Zhang:
+ * config/bfin/bfin.md (movsi_insn): Refine constraints.
+
+2009-04-29 Rafael Avila de Espindola <espindola@google.com>
+
+ * Makefile.in (PLUGIN_VERSION_H): New.
+ (OBJS-common): Remove plugin-version.o.
+ (plugin.o): Depend on (PLUGIN_VERSION_H).
+ (plugin-version.o): Remove.
+ * configure: Regenerate
+ * configure.ac: Create plugin-version.h.
+ * gcc-plugin.h (plugin_gcc_version): Remove.
+ (plugin_default_version_check): Change signature.
+ * plugin-version.c: Remove.
+ * plugin.c: Include plugin-version.h.
+ (str_plugin_gcc_version_name): Remove.
+ (try_init_one_plugin): Pass gcc version to plugin_init.
+ (plugin_default_version_check): Both gcc and plugin versions are now
+ arguments.
+
+2009-04-29 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.c (bfin_optimize_loop): Unify handling of
+ problematic last insns. Test for TYPE_CALL rather than CALL_P.
+ Remove special case testing for last insn of inner loops. Don't fail
+ if the loop ends with a jump, emit an extra nop instead.
+
+ * config/bfin/bfin.c (bfin_register_move_cost): Test for subsets of
+ DREGS rather than comparing directly. Remove code that tries to
+ account for latencies.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/39941
+ * tree-ssa-pre.c (eliminate): Schedule update-ssa after
+ eliminating an indirect call.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ * tree-cfg.c (verify_types_in_gimple_reference): Add require_lvalue
+ parameter. Allow invariants as base if !require_lvalue.
+ (verify_gimple_assign_single): Adjust.
+
+2009-04-29 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * config/bfin/bfin.md (sp_or_sm, spm_string, spm_name): New macro.
+ (ss<spm_name>hi3, ss<spm_name>hi3_parts, ss<spm_name>hi3_low_parts,
+ ss<spm_name_hi3_high_parts): New patterns, replacing ssaddhi3,
+ ssubhi3, ssaddhi3_parts and sssubhi3_parts.
+ (flag_mulhi3_parts): Produce a HImode output rather than trying to set
+ a VEC_SELECT.
+ * config/bfin/bfin.c (bfin_expand_builtin,
+ case BFIN_BUILTIN_CPLX_SQU): Adjust accordingly.
+
+2009-04-28 Richard Guenther <rguenther@suse.de>
+
+ * tree-vect-loop.c (get_initial_def_for_induction): Use
+ correct types for pointer increment.
+
+2009-04-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * toplev.c (print_version): Update GMP version string calculation.
+
+2009-04-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/39938
+ * resource.c (init_resource_info): Add call to df_analyze.
+
+2009-04-28 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.md (usegp): Cast the result of
+ alpha_find_lo_sum_using_gp to enum attr_usegp.
+ * config/alpha/alpha.c (override_options): Remove end-of-structure
+ marker element from cpu_table. Use array size of cpu_table to handle
+ -mcpu and -mtune options.
+ (tls_symbolic_operand_type): Change 0 to TLS_MODEL_NONE.
+
+2009-04-28 Joseph Myers <joseph@codesourcery.com>
+
+ * config.gcc (powerpc*-*-* | rs6000-*-*): Add
+ rs6000/option-defaults.h to tm_file. Support cpu_32, cpu_64,
+ tune_32 and tune_64.
+ * doc/install.texi (--with-cpu-32, --with-cpu-64): Document
+ support on PowerPC.
+ * config/rs6000/rs6000.h (OPTION_DEFAULT_SPECS): Move to ...
+ * config/rs6000/option-defaults.h: ... here. New file.
+ (OPT_64, OPT_32): Define.
+ (MASK_64BIT): Define to 0 if not already defined.
+ (OPT_ARCH64, OPT_ARCH32): Define.
+ (OPTION_DEFAULT_SPECS): Add entries for cpu_32, cpu_64, tune_32
+ and tune_64.
+
+2009-04-28 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ * config/arm/arm.c (arm_override_options): Emit error on using
+ fpa with AAPCS.
+
+2009-04-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR rtl-optimization/39914
+ * ira-conflicts.c (ira_build_conflicts): Prohibit call used
+ registers for allocnos created from user-defined variables only
+ when not optimizing.
+
+2009-04-28 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/39937
+ * fold-const.c (fold_binary): Use distribute_real_division only
+ on float types.
+
+2009-04-28 Steve Ellcey <sje@cup.hp.com>
+
+ * config.gcc (hppa*64*-*-hpux11*): Set use_gcc_stdint and
+ add hpux-stdint.h to tm_file.
+ (hppa[12]*-*-hpux11*): Ditto.
+ (ia64*-*-hpux*): Ditto.
+ * config/hpux-stdint.h: New.
+ * config/ia64/hpux.h (TARGET_OS_CPP_BUILTINS): Set
+ __STDC_EXT__ for all compiles.
+ * config/pa/pa-hpux.h: Ditto.
+ * config/pa/pa-hpux10.h: Ditto.
+ * config/pa/pa-hpux11.h: Ditto.
+
+2009-04-28 Catherine Moore <clm@codesourcery.com>
+
+ * debug.h (set_name): Add comment.
+
+2009-04-28 Andrew Pinski <pinskia@gmail.com>
+
+ PR target/39929
+ * config/darwin.c (machopic_gen_offset): Check
+ currently_expanding_to_rtl if current_ir_type returns IR_GIMPLE.
+ * config/arm/arm.c (require_pic_register): Likewise.
+
+2009-04-28 Paolo Bonzini <bonzini@gnu.org>
+
+ * config/m32c/m32c.c (TARGET_PROMOTE_FUNCTION_RETURN,
+ m32c_promote_function_return, TARGET_PROMOTE_PROTOTYPES,
+ m32c_promote_prototypes): Delete.
+
+2009-04-28 Michael Matz <matz@suse.de>
+
+ PR middle-end/39922
+ * tree-outof-ssa.c (insert_value_copy_on_edge): Don't convert
+ constants.
+
+2009-04-28 Richard Guenther <rguenther@suse.de>
+
+ * tree-vect-stmts.c (vect_get_vec_def_for_operand): Fix type error.
+
+2009-04-28 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ * config/arm/arm-cores.def: Add support for arm1156t2f-s.
+ * doc/invoke.texi (ARM Options): Document support for arm1156t2f-s.
+ * config/arm/arm-tune.md: Regenerate.
+
+2009-04-28 Alexander Monakov <amonakov@ispras.ru>
+
+ * sel-sched-ir.c (maybe_tidy_empty_bb): Do not attempt to delete a
+ block if there are complex incoming edges.
+ (sel_merge_blocks): Remove useless assert.
+ (sel_redirect_edge_and_branch): Check that edge was redirected.
+ * sel-sched-ir.h (_eligible_successor_edge_p): Remove assert.
+ (sel_find_rgns): Delete declaration.
+ * sel-sched.c (purge_empty_blocks): Attempt to remove first block of
+ the region when it is not a preheader.
+
+2009-04-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR c/39323
+ * config/alpha/elf.h (MAX_OFILE_ALIGNMENT): Sync with elfos.h
+
+2009-04-28 Richard Guenther <rguenther@suse.de>
+
+ * tree.h (SSA_NAME_VALUE): Remove.
+ (struct tree_ssa_name): Remove value_handle member.
+ * tree-vrp.c (execute_vrp): Initialize/free the value-handle
+ array for jump threading.
+ * tree-ssa-propagate.c (ssa_prop_init): Do not initialize
+ SSA_NAME_VALUEs.
+ * print-tree.c (print_node): Do not dump SSA_NAME_VALUEs.
+ * tree-flow.h (threadedge_initialize_values): Declare.
+ (threadedge_finalize_values): Likewise.
+ * tree-ssa-threadedge.c (ssa_name_values): New global variable.
+ (SSA_NAME_VALUE): Define.
+ (threadedge_initialize_values): New function.
+ (threadedge_finalize_values): Likewise.
+ * tree-ssa-dom.c (ssa_name_values): New global variable.
+ (SSA_NAME_VALUE): Define.
+ (tree_ssa_dominator_optimize): Initialize/free the value-handle array.
+
+2009-04-28 Ira Rosen <irar@il.ibm.com>
+
+ * tree-vect-loop-manip.c (vect_create_cond_for_alias_checks):
+ Use REPORT_VECTORIZED_LOCATIONS instead
+ REPORT_VECTORIZED_LOOPS.
+ * tree-vectorizer.c (vect_verbosity_level): Make static.
+ (vect_loop_location): Rename to vect_location.
+ (vect_set_verbosity_level): Update comment.
+ (vect_set_dump_settings): Use REPORT_VECTORIZED_LOCATIONS
+ and vect_location.
+ (vectorize_loops): Fix comment. Use REPORT_VECTORIZED_LOCATIONS
+ and vect_location. Use REPORT_UNVECTORIZED_LOCATIONS
+ instead REPORT_UNVECTORIZED_LOOPS.
+ * tree-vectorizer.h (enum vect_def_type): Rename vect_invariant_def and
+ vect_loop_def to vect_external_def and vect_internal_def.
+ (enum verbosity_levels): Rename REPORT_VECTORIZED_LOOPS
+ and REPORT_UNVECTORIZED_LOOPS to REPORT_VECTORIZED_LOCATIONS and
+ REPORT_UNVECTORIZED_LOCATIONS.
+ (enum vect_relevant): Update comment. Rename vect_unused_in_loop
+ and vect_used_in_loop and to vect_unused_in_scope and
+ vect_used_in_scope.
+ (STMT_VINFO_RELEVANT_P): Use vect_unused_in_scope.
+ (vect_verbosity_level): Remove declaration.
+ (vect_analyze_operations): Likewise.
+ (vect_analyze_stmt): Declare.
+ * tree-vect-loop.c (vect_determine_vectorization_factor): Use
+ REPORT_UNVECTORIZED_LOCATIONS.
+ (vect_get_loop_niters): Fix indentation.
+ (vect_analyze_loop_form): Use REPORT_UNVECTORIZED_LOCATIONS.
+ (vect_analyze_loop_operations): New function.
+ (vect_analyze_loop): Call vect_analyze_loop_operations instead of
+ vect_analyze_operations.
+ (vect_is_simple_reduction): Use new names.
+ (vectorizable_live_operation, vect_transform_loop): Likewise.
+ * tree-vect-data-refs.c (vect_check_interleaving): Add a return value to
+ specify whether the data references can be a part of interleaving chain.
+ (vect_analyze_data_ref_dependence): Use new names.
+ (vect_analyze_data_refs_alignment, vect_analyze_data_refs): Likewise.
+ (vect_create_addr_base_for_vector_ref): Remove redundant code.
+ * tree-vect-patterns.c (widened_name_p): Use new names.
+ (vect_recog_dot_prod_pattern): Likewise.
+ * tree-vect-stmts.c (vect_stmt_relevant_p): Use new names.
+ (process_use, vect_mark_stmts_to_be_vectorized,
+ vect_model_simple_cost, vect_model_store_cost,
+ vect_get_vec_def_for_operand, vect_get_vec_def_for_stmt_copy,
+ vectorizable_call, vectorizable_conversion, vectorizable_assignment,
+ vectorizable_operation, vectorizable_type_demotion,
+ vectorizable_type_promotion, vectorizable_store, vectorizable_load,
+ vectorizable_condition): Likewise.
+ (vect_analyze_operations): Split into vect_analyze_loop_operations
+ and ...
+ (vect_analyze_stmt): ... new function.
+ (new_stmt_vec_info): Use new names.
+ (vect_is_simple_use): Use new names and fix comment.
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Use new names.
+ (vect_build_slp_tree, vect_analyze_slp, vect_schedule_slp): Likewise.
+
+2009-04-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/39911
+ * config/i386/i386.c (print_operand) ['Z']: Handle floating point
+ and integer modes for x87 operands. Do not ICE for unsupported size,
+ generate error instead. Generate error for unsupported operand types.
+ ['z']: Do not handle HImode memory operands specially. Warning
+ for floating-point operands. Fallthru to 'Z' for unsupported operand
+ types. Do not ICE for unsupported size, generate error instead.
+ (output_387_binary_op): Use %Z to output operands.
+ (output_fp_compare): Ditto.
+ (output_387_reg_move): Ditto.
+
+2009-04-28 Ben Elliston <bje@au.ibm.com>
+
+ PR c++/35652
+ Revert:
+
+ 2009-03-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * builtins.c (c_strlen): Do not warn here.
+ * c-typeck.c (build_binary_op): Adjust calls to pointer_int_sum.
+ * c-common.c (pointer_int_sum): Take an explicit location.
+ Warn about offsets out of bounds.
+ * c-common.h (pointer_int_sum): Adjust declaration.
+
+2009-04-27 Ian Lance Taylor <iant@google.com>
+
+ * collect2.c (is_ctor_dtor): Change type of ret field in struct
+ names to symkind.
+ * dce.c (run_fast_df_dce): Change type of old_flags to int.
+ * df-core.c (df_set_flags): Change return type to int. Change
+ type of old_flags to int.
+ (df_clear_flags): Likewise.
+ * df-scan.c (df_def_record_1): Change 0 to VOIDmode.
+ (df_get_conditional_uses): Likewise.
+ * df.h (df_set_flags, df_clear_flags): Update declarations.
+ * dwarf2out.c (struct indirect_string_node): Change type of form
+ field to enum dwarf_form.
+ (AT_string_form): Change return type to enum dwarf_form.
+ * fixed-value.c (fixed_compare): Add cast to enum type.
+ * fwprop.c (update_df): Change 0 to VOIDmode.
+ * gensupport.c: Change 0 to UNKNOWN.
+ * gimple.h (gimple_cond_code): Add cast to enum type.
+ * haifa-sched.c (reemit_notes): Add cast to enum type.
+ * hooks.c (hook_int_void_no_regs): Remove function.
+ * hooks.h (hook_int_void_no_regs): Remove declaration.
+ * optabs.c (expand_widen_pattern_expr): Change 0 to VOIDmode.
+ * predict.c (combine_predictions_for_insn): Add casts to enum type.
+ * real.c (real_arithmetic): Add cast to enum type.
+ (real_compare): Likewise.
+ * target.h (struct gcc_target): Change return type of
+ branch_target_register_class to enum reg_class.
+ * target-def.h (TARGET_BRANCH_TARGET_REGISTER_CLASS): Define as
+ default_branch_target_register_class.
+ * targhooks.c (default_branch_target_register_class): New function.
+ * targhooks.h (default_branch_target_register_class): Declare.
+ * tree-data-ref.c (print_direction_vector): Add cast to enum type.
+ * tree-vect-data-refs.c (vect_supportable_dr_alignment): Remove
+ cast to int.
+ * tree-vect-loop.c (vect_create_epilog_for_reduction): Change 0 to
+ ERROR_MARK.
+ * tree-vect-slp.c (vect_build_slp_tree): Change 0 to
+ vect_uninitialized_def. Change 0 to ERROR_MARK.
+ * tree-vect-stmts.c (supportable_widening_operation): Don't
+ initialize icode1 and icode2.
+ * tree-vectorizer.h (enum vect_def_type): Add vect_uninitialized_def.
+ * config/sol2-c.c (cmn_err_length_specs): Change 0 to FMT_LEN_none
+ and to STD_C89.
+ (cmn_err_flag_specs): Change 0 to STD_C89.
+ (cmn_err_char_table): Likewise.
+ * config/arm/arm.c (get_arm_condition_code): Change type of code
+ to enum arm_cond_code.
+ (IWMMXT_BUILTIN): Change 0 to UNKNOWN.
+ (IWMMXT_BUILTIN2): Likewise.
+ (neon_builtin_type_bits): Don't define typedef.
+ (neon_builtin_datum): Change type of bits field to int.
+ (arm_expand_neon_args): Add cast to enum type.
+ * config/ia64/ia64.c (tls_symbolic_operand_type): Change 0 to
+ TLS_MODEL_NONE.
+ * config/i386/i386.c (bdesc_multi_arg): Change 0 to UNKNOWN. Add
+ casts to enum type.
+ * config/mips/mips.c (LOONGSON_BUILTIN_ALIAS): Change 0 to
+ MIPS_FP_COND_f.
+ * config/mips/mips.md (jal_macro): Return enum constant.
+ (single_insn): Likewise.
+ * config/rs6000/rs6000.c (bdesc_altivec_preds): Change 0 to
+ CODE_FOR_nothing.
+ * config/rs6000/rs6000-c.c (altivec_overloaded_builtins): Add
+ casts to enum type.
+ * config/s390/s390.c (s390_tune_flags): Change type to int.
+ (s390_arch_flags): Likewise.
+ (s390_handle_arch_option): Change flags field of struct pta to int.
+ * config/s390/s390.h (s390_tune_flags): Update declaration.
+ (s390_arch_flags): Likewise.
+ * config/sh/sh.c (prepare_move_operands): Compare
+ tls_symbolic_operand result with enum constant.
+ (sh_reorg): Change PUT_MODE to PUT_REG_NOTE_KIND.
+ (sh_expand_prologue): Add cast to enum type.
+ (sh_expand_epilogue): Likewise.
+ (tls_symbolic_operand): Change return type to enum tls_model.
+ (fpscr_set_from_mem): Add cast to enum type.
+ (legitimize_pic_address): Compare tls_symbolic_operand result with
+ enum constant.
+ (sh_target_reg_class): Change return type to enum reg_class.
+ * config/sh/sh.h (OVERRIDE_OPTIONS): Change CPU_xxx to
+ PROCESSOR_xxx.
+ * config/sh/sh-protos.h (tls_symbolic_operand): Update declaration.
+ * config/sparc/sparc.c (sparc_override_options): Add cast to enum type.
+ * config/sparc/sparc.md (empty_delay_slot): Return enum constant.
+ (pic, calls_alloca, calls_eh_return, leaf_function): Likewise.
+ (delayed_branch, tls_call_delay): Likewise.
+ (eligible_for_sibcall_delay): Likewise.
+ (eligible_for_return_delay): Likewise.
+ * config/spu/spu.c (expand_builtin_args): Add cast to enum type.
+ (spu_expand_builtin_1): Likewise.
+
+ * c-typeck.c (convert_for_assignment): Issue -Wc++-compat warnings
+ for all types of conversions.
+ (output_init_element): Issue -Wc++-compat warning if needed when
+ initializing a bitfield with enum type.
+ * c-parser.c (c_parser_expression): Set original_type to
+ original_type of right hand operand of comman operator.
+
+2009-04-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * doc/c-tree.texi (Types, Functions, Expression trees): Fix
+ grammar nits.
+ * doc/cfg.texi (Maintaining the CFG, Liveness information): Likewise.
+ * doc/cpp.texi (Standard Predefined Macros)
+ (Implementation-defined behavior): Likewise.
+ * doc/extend.texi (Function Attributes, Type Attributes): Likewise.
+ * doc/gimple.texi (GIMPLE Exception Handling)
+ (@code{GIMPLE_ASSIGN}): Likewise.
+ * doc/install.texi (Prerequisites, Configuration, Specific): Likewise.
+ * doc/invoke.texi (Warning Options, Optimize Options)
+ (AVR Options, Darwin Options): Likewise.
+ (Optimize Options): Reformulate -fwhole-program description.
+ * doc/loop.texi (Lambda): Likewise.
+ * doc/md.texi (Output Template, Define Constraints)
+ (Standard Names, Insn Splitting): Likewise.
+ * doc/options.texi (Option properties): Likewise.
+ * doc/passes.texi (Tree-SSA passes): Likewise.
+ * doc/rtl.texi (Side Effects, Assembler, Insns): Likewise.
+ * doc/tm.texi (Register Classes, Old Constraints, Scalar Return)
+ (File Names and DBX): Likewise.
+ * doc/trouble.texi (Incompatibilities): Likewise.
+
+2009-04-27 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+
+ * spu.c (spu_machine_dependent_reorg): Make sure branch label on hint
+ instruction is correct.
+
+2009-04-27 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+
+ Allow non-constant arguments to conversion intrinsics.
+ * spu-protos.h (exp2_immediate_p, spu_gen_exp2): Declare.
+ * predicates.md (spu_inv_exp2_operand, spu_exp2_operand): New.
+ * spu.c (print_operand): Handle 'v' and 'w'.
+ (exp2_immediate_p, spu_gen_exp2): Define.
+ * spu-builtins.def (spu_convts, spu_convtu, spu_convtf_0,
+ spu_convtf_1): Update parameter descriptions.
+ * spu-builtins.md (spu_csflt, spu_cuflt, spu_cflts, spu_cfltu): Update.
+ * constraints.md ('v', 'w'): New.
+ * spu.md (UNSPEC_CSFLT, UNSPEC_CFLTS, UNSPEC_CUFLT, UNSPEC_CFLTU):
+ Remove.
+ (i2f, I2F): New define_mode_attr.
+ (floatsisf2, floatv4siv4sf2, fix_truncsfsi2, fix_truncv4sfv4si2,
+ floatunssisf2, floatunsv4siv4sf2, fixuns_truncsfsi2,
+ fixuns_truncv4sfv4si2): Update to use mode attribute.
+ (float<mode><i2f>2_mul, float<mode><i2f>2_div,
+ fix_trunc<mode><f2i>2_mul, floatuns<mode><i2f>2_mul,
+ floatuns<mode><i2f>2_div, fixuns_trunc<mode><f2i>2_mul): New
+ patterns for combine.
+
+2009-04-27 Steven Bosscher <steven@gcc.gnu.org>
+
+ * dbgcnt.def (cprop1, cprop2, gcse, jump_bypass): Remove
+ (cprop, hoist, pre, store_motion): New debug counters.
+ * tree-pass.h (pass_tracer): Move to list of gimple passes, it
+ is not an RTL pass anymore.
+ (pass_profiling): Remove extern decl for pass removed in 2005.
+ (pass_gcse, pass_jump_bypass): Remove.
+ * final.c (rest_of_clean_state): Set flag_rerun_cse_after_global_opts
+ to 0 for clean state.
+ * toplev.h (flag_rerun_cse_after_global_opts): Add extern declaration.
+ * cse.c (gate_handle_cse_after_global_opts,
+ rest_of_handle_cse_after_global_opts): New functions.
+ (pass_cse_after_global_opts): New pass, does local CSE.
+ * timevar.def (TV_GCSE, TV_CPROP1, TV_CPROP2, TV_BYPASS): Remove.
+ (TV_CPROP): New timevar.
+ * gcse.c (flag_rerun_cse_after_global_opts): New global variable.
+ (run_jump_opt_after_gcse, max_gcse_regno): Remove global vars.
+ (gcse_main, recompute_all_luids): Remove.
+ (compute_hash_table_work): Call max_reg_num instead of reading
+ max_gcse_regno.
+ (cprop_jump): Don't set run_jump_opt_after_gcse.
+ (constprop_register): Always allow to alter jumps.
+ (cprop_insn): Likewise.
+ (do_local_cprop): Likewise.
+ (local_cprop_pass): Likewise. Return non-zero if something changed.
+ (cprop): Remove function, fold interesting bits into one_cprop_pass.
+ (find_implicit_sets): Add note about missed optimization opportunity.
+ (one_cprop_pass): Rewrite to be "the" CPROP pass, called from the
+ pass_rtl_cprop execute function.
+ Don't bother tracking the pass number, each pass gets its own dumpfile
+ now anyway.
+ Always allow to alter jumpsand bypass jumps.
+ (bypass_block): Don't ignore regno >= max_gcse_regno, find_bypass_set
+ will just find no suitable set.
+ (pre_edge_insert): Fix dumping, this function is for PRE only.
+ (one_pre_gcse_pass): Rewrite to be "the" PRE pass, called from the
+ pass_rtl_pre execute function.
+ (hoist_code): Return non-zero if something changed. Keep track of
+ substitutions and insertions for statistics gathering similar to PRE.
+ (one_code_hoisting_pass): Rewrite to be "the" code hoisting pass,
+ called from the pass_rtl_hoist execute function. Show pass statistics.
+ (compute_store_table): Use max_reg_num directly instead of using the
+ formerly global max_gcse_regno.
+ (build_store_vectors): Likewise.
+ (replace_store_insn): Fix dumping.
+ (store_motion): Rename to ...
+ (one_store_motion_pass): ... this. Rewrite to be "the" STORE_MOTION
+ pass, called from the pass_rtl_store_motion execute function. Keep
+ track of substitutions and insertions for statistics gathering similar
+ to PRE.
+ (bypass_jumps): Remove, fold interesting bits into ...
+ (one_cprop_pass): ... this. Rewrite to be "the" CPROP pass, called
+ from the pass_rtl_cprop execute function.
+ (gate_handle_jump_bypass, rest_of_handle_jump_bypass,
+ pass_jump_bypass): Remove.
+ (gate_handle_gcse, rest_of_handle_gcse): Remove.
+ (gate_rtl_cprop, execute_rtl_cprop, pass_rtl_cprop): New.
+ (gate_rtl_pre, execute_rtl_pre, pass_rtl_pre): New.
+ (gate_rtl_hoist, execute_rtl_hoist, pass_rtl_hoist): New.
+ (gate_rtl_store_motion, execute_rtl_store_motion,
+ pass_rtl_store_motion): New.
+ * common.opt: Remove flag_cse_skip_blocks, adjust documentation to
+ make it clear that -fcse-skip-blocks is a no-op for backward compat.
+ * passes.c (init_optimization_passes): Remove pass_gcse and
+ pass_jump_bypass. Schedule cprop, pre, hoist, cprop, store_motion,
+ and cse_after_global_opts in place of pass_gcse. Schedule cprop
+ instead of pass_jump_bypass.
+
+2009-04-27 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/39928
+ * gimplify.c (gimplify_expr): If we are required to create
+ a temporary make sure it ends up as register.
+
+2009-04-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/39903
+ * config/i386/i386.c (construct_container): Don't call
+ gen_reg_or_parallel with BLKmode on X86_64_SSE_CLASS,
+ X86_64_SSESF_CLASS and X86_64_SSEDF_CLASS.
+
+2009-04-27 Michael Matz <matz@suse.de>
+
+ * ssaexpand.h (struct ssaexpand): Member 'values' is a bitmap.
+ (get_gimple_for_ssa_name): Adjust, lookup using SSA_NAME_DEF_STMT.
+ * tree-ssa-live.h: (find_replaceable_exprs): Return a bitmap.
+ (dump_replaceable_exprs): Take a bitmap.
+ * cfgexpand.c (gimple_cond_pred_to_tree): Handle bitmap instead of
+ array.
+ (expand_gimple_basic_block): Likewise.
+ * tree-ssa-ter.c (struct temp_expr_table_d): Make
+ replaceable_expressions member a bitmap.
+ (free_temp_expr_table): Pass back and deal with bitmap, not gimple*.
+ (mark_replaceable): Likewise.
+ (find_replaceable_in_bb, dump_replaceable_exprs): Likewise.
+ * tree-outof-ssa.c (remove_ssa_form): 'values' is a bitmap.
+
+2009-04-27 Richard Guenther <rguenther@suse.de>
+
+ * tree-cfg.c (remove_useless_stmts): Verify stmts afterwards.
+ (verify_stmts): Dispatch to gimple/type verification code.
+ * tree-inline.c (remap_gimple_op_r): Work around C++ FE
+ issue with call argument types.
+
+2009-04-27 Michael Matz <matz@suse.de>
+
+ * tree-into-ssa.c (regs_to_rename, mem_syms_to_rename): Remove.
+ (init_update_ssa, delete_update_ssa, update_ssa): Remove references
+ to above.
+
+2009-04-27 Richard Sandiford <rdsandiford@googlemail.com>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * resource.c (find_basic_block): Use BLOCK_FOR_INSN to look up
+ a label's basic block.
+ (mark_target_live_regs): Tidy and rework obsolete comments.
+ Change back DF problem to LIVE. If a label starts a basic block,
+ assume that all registers that used to be live then still are.
+ (init_resource_info): If a label starts a basic block, set its
+ BLOCK_FOR_INSN accordingly.
+ (fini_resource_info): Undo the setting of BLOCK_FOR_INSN.
+
+2009-04-27 Richard Guenther <rguenther@suse.de>
+
+ * tree-flow-inline.h (function_ann): Remove.
+ (get_function_ann): Likewise.
+ * tree-dfa.c (create_function_ann): Remove.
+ * tree-flow.h (struct static_var_ann_d): Remove.
+ (struct function_ann_d): Likewise.
+ (union tree_ann_d): Remove fdecl member.
+ (function_ann_t): Remove.
+ (function_ann, get_function_ann, create_function_ann): Remove
+ declarations.
+
2009-04-27 Uros Bizjak <ubizjak@gmail.com>
* config/alpha/alpha.c (code_for_builtin): Declare as enum insn_code.
@@ -765,7 +2292,7 @@
(current_function_special_page_vector): Likewise.
(m32c_expand_insv): Silence a warning.
-2009-04-21 Taras Glek <tglek@mozilla.com>
+2009-04-21 Taras Glek <tglek@mozilla.com>
* alias.c: Update GTY annotations to new syntax.
* basic-block.h: Likewise.
@@ -1425,7 +2952,7 @@
* config/spu/spu-protos.h (spu_expand_builtin): Update declaration.
2009-04-20 Joey Ye <joey.ye@intel.com>
- Xuepeng Guo <xuepeng.guo@intel.com>
+ Xuepeng Guo <xuepeng.guo@intel.com>
H.J. Lu <hongjiu.lu@intel.com>
* config/i386/atom.md: Add bypasses with ix86_dep_by_shift_count.
@@ -2178,7 +3705,7 @@
* dbxout.c (dbx_debug_hooks): Likewise.
* sdbout.c (sdb_debug_hooks): Likewise.
-2009-04-15 Michael Eager <eager@eagercon.com>
+2009-04-15 Michael Eager <eager@eagercon.com>
* config/rs6000/rs6000.c (rs6000_function_value): Set function return
reg for single-precision FPU.
@@ -2361,7 +3888,7 @@
comment suggests.
* omp-low.c (expand_omp_atomic_pipeline): Use the correct types.
-2009-04-13 Michael Eager <eager@eagercon.com>
+2009-04-13 Michael Eager <eager@eagercon.com>
* config/rs6000/rs6000-c.c: generate defines if rs6000_xilinx_fpu:
_XFPU, _XFPU_SP_LITE, _XFPU_SP_FULL, _XFPU_DP_LITE, _XFPU_DP_FULL
@@ -3062,7 +4589,7 @@
remove_c_maybe_const_expr on any input C_MAYBE_CONST_EXPR with
integer operands.
-2009-04-08 Bingfeng Mei <bmei@broadcom.com>
+2009-04-08 Bingfeng Mei <bmei@broadcom.com>
* fold-const.c (const_binop): Combine two VECTOR_CST under operation
CODE to produce a new one. Add a prototype to use fold_convert_const
@@ -3168,7 +4695,7 @@
* config/i386/i386.md: Revert 2 accidental checkins.
2009-04-06 Joey Ye <joey.ye@intel.com>
- Xuepeng Guo <xuepeng.guo@intel.com>
+ Xuepeng Guo <xuepeng.guo@intel.com>
H.J. Lu <hongjiu.lu@intel.com>
Atom pipeline model, tuning and insn selection.
@@ -3297,7 +4824,7 @@
delay slot.
(ic_invalidate_array): Likewise.
-2009-04-06 Hariharan Sandanagobalane <hariharan@picochip.com>
+2009-04-06 Hariharan Sandanagobalane <hariharan@picochip.com>
* calls.c (emit_library_call_value_1): Fix a problem with parameter
alignment for library calls.
@@ -3988,7 +5515,7 @@
* config.gcc (powerpc-*-linux*): Merge variants.
2009-04-02 Chao-ying Fu <fu@mips.com>
- James Grosbach <james.grosbach@microchip.com>
+ James Grosbach <james.grosbach@microchip.com>
* config/mips/mips.c (mips_frame_info): Add acc_mask, num_acc,
num_cop0_regs, acc_save_offset, cop0_save_offset, acc_sp_offset,
@@ -4166,81 +5693,81 @@
* config/i386/i386.c (legitimate_constant_p): Recognize
all one vector constant.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/vax.c: Add #includes to silence warnings.
+ * config/vax/vax.c: Add #includes to silence warnings.
Change #include order to silence two warnings.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/linux.h (TARGET_DEFAULT): Add the MASK_QMATH flag bit.
+ * config/vax/linux.h (TARGET_DEFAULT): Add the MASK_QMATH flag bit.
(ASM_SPEC): Pass -k to the assembler for PIC code.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config.gcc: Add vax-*-linux* to the switch.
- * gcc/config/vax/linux.h: New file. (TARGET_VERSION,
+ * config.gcc: Add vax-*-linux* to the switch.
+ * config/vax/linux.h: New file. (TARGET_VERSION,
TARGET_OS_CPP_BUILTINS, TARGET_DEFAULT, CPP_SPEC, LINK_SPEC): Define.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/vax.c (vax_output_int_move, adjacent_operands_p):
+ * config/vax/vax.c (vax_output_int_move, adjacent_operands_p):
Use predicate macros instead of GET_CODE() == foo.
- * gcc/config/vax/vax.md (movsi_2, movstrictqi, and<mode>3, ashrsi3,
+ * config/vax/vax.md (movsi_2, movstrictqi, and<mode>3, ashrsi3,
ashlsi3, rotrsi3, <unnamed>): Likewise.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/builtins.md (jbbssiqi, jbbssihi, jbbssisi, jbbcciqi,
+ * config/vax/builtins.md (jbbssiqi, jbbssihi, jbbssisi, jbbcciqi,
jbbccihi, jbbccisi): Remova trailing whitespace.
- * gcc/config/vax/constraints.md: Likewise.
- * gcc/config/vax/elf.h: (ASM_PREFERRED_EH_DATA_FORMAT): Likewise.
- * gcc/config/vax/openbsd1.h (OBSD_OLD_GAS): Likewise.
- * gcc/config/vax/predicates.md: Likewise.
- * gcc/config/vax/vax.c (print_operand_address, vax_output_int_move,
+ * config/vax/constraints.md: Likewise.
+ * config/vax/elf.h: (ASM_PREFERRED_EH_DATA_FORMAT): Likewise.
+ * config/vax/openbsd1.h (OBSD_OLD_GAS): Likewise.
+ * config/vax/predicates.md: Likewise.
+ * config/vax/vax.c (print_operand_address, vax_output_int_move,
vax_expand_addsub_di_operands, adjacent_operands_p): Likewise.
- * gcc/config/vax/vax.h: Likewise.
- * gcc/config/vax/vax.md (nonlocal_goto): Likewise.
+ * config/vax/vax.h: Likewise.
+ * config/vax/vax.md (nonlocal_goto): Likewise.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/vax.c (vax_float_literal, vax_output_int_move)
+ * config/vax/vax.c (vax_float_literal, vax_output_int_move)
(indirectable_address_p, adjacent_operands_p): Add spaces around
braces.
- * gcc/config/vax/vax-protos.h (adjacent_operands_p): Likewise.
+ * config/vax/vax-protos.h (adjacent_operands_p): Likewise.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/vax.c (legitimate_constant_address_p,
+ * config/vax/vax.c (legitimate_constant_address_p,
legitimate_constant_p, indirectable_address_p, nonindexed_address_p,
index_term_p, reg_plus_index_p, legitimate_address_p,
vax_mode_dependent_address_p): Update comments to match functions
modified by the recent int->bool conversion.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/builtins.md: Update copyright message.
- * gcc/config/vax/constraints.md: Likewise.
- * gcc/config/vax/netbsd-elf.h: Likewise.
- * gcc/config/vax/predicates.md: Likewise.
- * gcc/config/vax/vax-protos.h: Likewise.
- * gcc/config/vax/vax.c: Likewise.
- * gcc/config/vax/vax.h: Likewise.
- * gcc/config/vax/vax.md: Likewise.
- * gcc/config/vax/vax.opt: Likewise.
+ * config/vax/builtins.md: Update copyright message.
+ * config/vax/constraints.md: Likewise.
+ * config/vax/netbsd-elf.h: Likewise.
+ * config/vax/predicates.md: Likewise.
+ * config/vax/vax-protos.h: Likewise.
+ * config/vax/vax.c: Likewise.
+ * config/vax/vax.h: Likewise.
+ * config/vax/vax.md: Likewise.
+ * config/vax/vax.opt: Likewise.
-2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
+2009-04-01 Jan-Benedict Glaw <jbglaw@jbglaw-dev.homezone.telefonica.de>
- * gcc/config/vax/builtins.md (ffssi2, ffssi2_internal,
+ * config/vax/builtins.md (ffssi2, ffssi2_internal,
sync_lock_test_and_set<mode>, sync_lock_release<mode>): Fix indention.
- * gcc/config/vax/constraints.md (B, R): Likewise.
- * gcc/config/vax/predicates.md (external_memory_operand,
+ * config/vax/constraints.md (B, R): Likewise.
+ * config/vax/predicates.md (external_memory_operand,
nonimmediate_addsub_di_operand): Likewise.
- * gcc/config/vax/vax.c (vax_output_int_add): Likewise.
- * gcc/config/vax/vax.md (movsi, movsi_2, mov<mode>, call_value,
+ * config/vax/vax.c (vax_output_int_add): Likewise.
+ * config/vax/vax.md (movsi, movsi_2, mov<mode>, call_value,
untyped_call): Likewise.
-2009-04-01 Matt Thomas <matt@3am-software.com>
+2009-04-01 Matt Thomas <matt@3am-software.com>
* config/vax/predicates.md: New file.
(symbolic_operand, local_symbolic_operand, external_symbolic_operand,
@@ -4271,13 +5798,13 @@
(mov<mode>): Extend accepted operand types.
(subdi3_old): Rename from subdi3, change update constraints and use
a new implementation.
- * gcc/config/vax/vax.h (PCC_BITFIELD_TYPE_MATTERS): Add space.
+ * config/vax/vax.h (PCC_BITFIELD_TYPE_MATTERS): Add space.
(FRAME_POINTER_CFA_OFFSET, IRA_COVER_CLASSES, CLASS_MAX_NREGS,
MOVE_RATIO, CLEAR_RATIO): Define.
(REG_CLASS_FROM_LETTER, CONST_OK_FOR_LETTER_P,
CONST_DOUBLE_OK_FOR_LETTER_P, EXTRA_CONSTRAINT): Delete.
(PRINT_OPERAND): Redefine using a function instead of inlined code.
- * gcc/config/vax/vax.c (TARGET_BUILTIN_SETJMP_FRAME_VALUE): Define.
+ * config/vax/vax.c (TARGET_BUILTIN_SETJMP_FRAME_VALUE): Define.
(split_quadword_operands): Make static and really allow variable
splitting.
(print_operand_address): Update for PIC generation.
@@ -4359,7 +5886,7 @@
const char*.
2009-04-01 Kai Tietz <kai.tietz@onevision.com>
- Andrey Galkin <agalkin@hypercom.com>
+ Andrey Galkin <agalkin@hypercom.com>
PR/39492
* config/i386/host-mingw32.c (mingw32_gt_pch_use_address):
@@ -5428,7 +6955,7 @@
char pointer to cgraph_inline_failed_t.
(cgraph_inline_p): Adjust prototype to use cgraph_inline_failed_t.
(cgraph_default_inline_p): Ditto.
- * gcc/cgraphunit.c (cgraph_inline_p): Change type of parameter REASON
+ * cgraphunit.c (cgraph_inline_p): Change type of parameter REASON
to cgraph_inline_failed_t pointer.
* cif-code.def: New file.
* ipa-inline.c (cgraph_mark_inline_edge): Use an enum instead of a
@@ -5838,7 +7365,7 @@
(-mwindows): New.
(sub section "i386 and x86-64 Windows Options"): New.
-2009-03-25 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-03-25 Ralf Corsépius <ralf.corsepius@rtems.org>
* config/arm/rtems-elf.h: Remove LINK_GCC_C_SEQUENCE_SPEC.
* config/rs6000/t-rtems: Remove MULTILIB_EXTRA_OPTS.
@@ -5886,7 +7413,7 @@
* doc/invoke.texi (DEC Alpha Options): Document 'native' value for
-march and -mtune options.
-2009-03-24 Ralf Corsépius <ralf.corsepius@rtems.org>
+2009-03-24 Ralf Corsépius <ralf.corsepius@rtems.org>
* config/m68k/t-rtems: Add m5329 multilib.
@@ -5918,7 +7445,7 @@
PR tree-optimization/39516
* lambda-code.c (perfect_nestify): Fix type of the uboundvar variable.
-2009-03-23 Bingfeng Mei <bmei@broadcom.com>
+2009-03-23 Bingfeng Mei <bmei@broadcom.com>
* config.gcc (need_64bit_hwint): Make clear that need_64bit_hwint
should be set true if BITS_PER_WORD of target is bigger than 32
@@ -5953,7 +7480,7 @@
* reginfo.c (globalize_reg): Recompute derived reg sets.
-2009-03-19 Ozkan Sezer <sezeroz@gmail.com>
+2009-03-19 Ozkan Sezer <sezeroz@gmail.com>
PR target/39063
* libgcc2.c (mprotect): Do not use signed arguments for
@@ -6151,7 +7678,7 @@
mismatches for POINTER_TYPE_P (type).
(number_of_iterations_le): Likewise.
-2009-03-16 Hariharan Sandanagobalane <hariharan@picochip.com>
+2009-03-16 Hariharan Sandanagobalane <hariharan@picochip.com>
* config/picochip/picochip.c: Removed profiling support.
* config/picochip/picochip.md: Removed profiling instruction.
@@ -6184,7 +7711,7 @@
2009-03-13 Catherine Moore <clm@codesourcery.com>
- * gcc/config/i386/x-mingw32 (host-mingw32.o): Replace
+ * config/i386/x-mingw32 (host-mingw32.o): Replace
diagnostic.h with $(DIAGNOSTIC_H).
2009-03-12 Jakub Jelinek <jakub@redhat.com>
@@ -6650,11 +8177,11 @@
2009-02-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
- * gcc/config/s390/s390.c (s390_swap_cmp): Look for conditional
+ * config/s390/s390.c (s390_swap_cmp): Look for conditional
jumps if COND is NULL.
(find_cond_jump): New function.
(s390_z10_optimize_cmp): Handling for reg-reg compares added.
- * gcc/config/s390/s390.md: Remove z10_cobra attribute value.
+ * config/s390/s390.md: Remove z10_cobra attribute value.
2009-02-26 Uros Bizjak <ubizjak@gmail.com>
@@ -7032,7 +8559,7 @@
* config/picochip/picochip.md (lea_add): Allow any nonimmediate
in the lea_add. Reload eventually constraints it properly.
- * config/picochip/constraints.md : Remove the target constraint
+ * config/picochip/constraints.md: Remove the target constraint
"b", since it is not needed anymore.
2009-02-16 Jakub Jelinek <jakub@redhat.com>
@@ -7657,10 +9184,10 @@
2009-01-29 Robert Millan <rmh@aybabtu.com>
- * gcc/config.gcc: Recognize GNU/kOpenSolaris (*-*-kopensolaris*-gnu).
- * gcc/config/i386/kopensolaris-gnu.h: New file. Undefine
+ * config.gcc: Recognize GNU/kOpenSolaris (*-*-kopensolaris*-gnu).
+ * config/i386/kopensolaris-gnu.h: New file. Undefine
`MD_UNWIND_SUPPORT'.
- * gcc/config/kopensolaris-gnu.h: New file (based on kfreebsd-gnu.h).
+ * config/kopensolaris-gnu.h: New file (based on kfreebsd-gnu.h).
2009-01-29 Kazu Hirata <kazu@codesourcery.com>
@@ -8514,7 +10041,7 @@
2009-01-11 Markus Schoepflin <markus.schoepflin@comsoft.de>
PR debug/7055
- * gcc/mips-tfile.c (parse_def): Fix parsing of def strings
+ * mips-tfile.c (parse_def): Fix parsing of def strings
starting with digits.
2009-01-10 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 40a1b2e1b71..0dedc0283d6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20090427
+20090508
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index e7b9d103037..47939a699f4 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -286,6 +286,8 @@ CLOOGINC = @CLOOGINC@
# Libs and linker option needed for plugin support
PLUGINLIBS = @pluginlibs@
+enable_plugin = @enable_plugin@
+
CPPLIB = ../libcpp/libcpp.a
CPPINC = -I$(srcdir)/../libcpp/include
@@ -481,6 +483,8 @@ libexecdir = @libexecdir@
libsubdir = $(libdir)/gcc/$(target_noncanonical)/$(version)
# Directory in which the compiler finds executables
libexecsubdir = $(libexecdir)/gcc/$(target_noncanonical)/$(version)
+# Directory in which plugin headers are installed
+plugin_includedir = $(libsubdir)/plugin/include
# Used to produce a relative $(gcc_tooldir) in gcc.o
unlibsubdir = ../../..
# $(prefix), expressed as a path relative to $(libsubdir).
@@ -881,6 +885,7 @@ IPA_PROP_H = ipa-prop.h $(TREE_H) vec.h $(CGRAPH_H)
GSTAB_H = gstab.h stab.def
BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
PLUGIN_H = plugin.h gcc-plugin.h
+PLUGIN_VERSION_H = plugin-version.h configargs.h
#
# Now figure out from those variables how to compile and link.
@@ -1159,7 +1164,6 @@ OBJS-common = \
params.o \
passes.o \
plugin.o \
- plugin-version.o \
pointer-set.o \
postreload-gcse.o \
postreload.o \
@@ -1171,6 +1175,7 @@ OBJS-common = \
real.o \
recog.o \
reg-stack.o \
+ regcprop.o \
reginfo.o \
regmove.o \
regrename.o \
@@ -1200,6 +1205,7 @@ OBJS-common = \
statistics.o \
stmt.o \
stor-layout.o \
+ store-motion.o \
stringpool.o \
targhooks.o \
timevar.o \
@@ -2477,13 +2483,7 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
gt-passes.h $(DF_H) $(PREDICT_H)
plugin.o : plugin.c $(PLUGIN_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h
-
-plugin-version.o : plugin-version.c $(SYSTEM_H) gcc-plugin.h configargs.h
- $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
- -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
- -DREVISION=$(REVISION_s) -DDEVPHASE=$(DEVPHASE_s) -c \
- -DPLUGIN $(srcdir)/plugin-version.c $(OUTPUT_OPTION)
+ $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h $(PLUGIN_VERSION_H)
main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TOPLEV_H)
@@ -2689,7 +2689,7 @@ cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
$(EXCEPT_H) $(TARGET_H) $(PARAMS_H) rtlhooks-def.h $(TREE_PASS_H) \
$(REAL_H) $(DF_H) $(DBGCNT_H)
dce.o : dce.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(DF_H) cselib.h \
+ $(TREE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(EXCEPT_H) $(DF_H) cselib.h \
$(DBGCNT_H) dce.h $(TIMEVAR_H) $(TREE_PASS_H) $(DBGCNT_H) $(TM_P_H)
dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
@@ -2709,6 +2709,11 @@ see.o : see.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(GGC_H) \
$(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \
+ $(TM_P_H) $(PARAMS_H) $(EXCEPT_H) $(TREE_H) $(TIMEVAR_H) \
+ intl.h $(OBSTACK_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H)
+store-motion.o : store-motion.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
+ $(REGS_H) hard-reg-set.h $(FLAGS_H) $(REAL_H) insn-config.h $(GGC_H) \
+ $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) output.h $(TOPLEV_H) \
$(TM_P_H) $(PARAMS_H) $(EXCEPT_H) gt-gcse.h $(TREE_H) cselib.h $(TIMEVAR_H) \
intl.h $(OBSTACK_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H)
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) \
@@ -2811,7 +2816,8 @@ cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
value-prof.h $(TREE_INLINE_H) $(TARGET_H) $(SSAEXPAND_H)
cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
- output.h $(TOPLEV_H) $(FUNCTION_H) $(EXCEPT_H) $(TM_P_H) insn-config.h $(EXPR_H) \
+ output.h $(TOPLEV_H) $(FUNCTION_H) $(EXCEPT_H) $(TM_P_H) $(INSN_ATTR_H) \
+ insn-config.h $(EXPR_H) \
$(CFGLAYOUT_H) $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
$(TREE_PASS_H) $(DF_H) $(GGC_H)
cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
@@ -3048,6 +3054,10 @@ cfglayout.o : cfglayout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(DF_H)
timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TIMEVAR_H) $(FLAGS_H) intl.h $(TOPLEV_H) $(RTL_H) timevar.def
+regcprop.o : regcprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(RTL_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
+ output.h $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
+ addresses.h reload.h $(TOPLEV_H) $(TIMEVAR_H) $(TREE_PASS_H) $(DF_H)
regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
output.h $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
@@ -3071,7 +3081,7 @@ params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) $(TO
pointer-set.o: pointer-set.c pointer-set.h $(CONFIG_H) $(SYSTEM_H)
hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
pretty-print.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(PRETTY_PRINT_H) \
- $(TREE_H)
+ $(TREE_H) $(GGC_H)
errors.o : errors.c $(CONFIG_H) $(SYSTEM_H) errors.h $(BCONFIG_H)
dbgcnt.o: dbgcnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h errors.h $(DBGCNT_H) \
$(TM_H) $(RTL_H) output.h
@@ -3336,7 +3346,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/tree-ssa-propagate.c \
$(srcdir)/tree-phinodes.c \
$(srcdir)/ipa-reference.c \
- $(srcdir)/tree-ssa-structalias.c $(srcdir)/tree-inline.c \
+ $(srcdir)/tree-ssa-structalias.c \
$(srcdir)/tree-ssa-alias.h \
@all_gtfiles@
@@ -3976,6 +3986,10 @@ install: install-common $(INSTALL_HEADERS) \
install-cpp install-man install-info install-@POSUB@ \
install-driver
+ifeq ($(enable_plugin),yes)
+install: install-plugin
+endif
+
# Handle cpp installation.
install-cpp: installdirs cpp$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(CPP_INSTALL_NAME)$(exeext)
@@ -3997,6 +4011,36 @@ installdirs:
$(mkinstalldirs) $(DESTDIR)$(man1dir)
$(mkinstalldirs) $(DESTDIR)$(man7dir)
+PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(TOPLEV_H) $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_PASS_H) gcc-plugin.h intl.h \
+ $(PLUGIN_VERSION_H)
+
+# Install the headers needed to build a plugin.
+install-plugin: installdirs
+# We keep the directory structure for files in config and .def files. All
+# other files are flattened to a single directory.
+ $(mkinstalldirs) $(DESTDIR)$(plugin_includedir)
+ headers=`echo $(PLUGIN_HEADERS) | tr ' ' '\n' | sort -u`; \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \
+ for file in $$headers; do \
+ if [ -f $$file ] ; then \
+ path=$$file; \
+ elif [ -f $(srcdir)/$$file ]; then \
+ path=$(srcdir)/$$file; \
+ else continue; \
+ fi; \
+ case $$path in \
+ "$(srcdir)"/config/* | "$(srcdir)"/*.def ) \
+ base=`echo "$$path" | sed -e "s|$$srcdirstrip/||"`;; \
+ *) base=`basename $$path` ;; \
+ esac; \
+ dest=$(plugin_includedir)/$$base; \
+ echo $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+ dir=`dirname $$dest`; \
+ $(mkinstalldirs) $$dir; \
+ $(INSTALL_DATA) $$path $(DESTDIR)/$$dest; \
+ done
+
# Install the compiler executables built during cross compilation.
install-common: native lang.install-common installdirs
for file in $(COMPILERS); do \
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 46ae18aea16..473d8f37bbe 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,820 @@
+2009-05-07 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies
+
+2009-05-06 Laurent GUERBY <laurent@guerby.net>
+
+ * s-linux.ads, s-linux-alpha.ads, s-linux-hppa.ads,
+ osinte-linux.ads: Define sa_handler_pos.
+ * s-osinte-linux.ads: Use it.
+ * s-linux-mipsel.ads: New.
+ * system-linux-mips64el.ads: New.
+ * gcc-interface/Makefile.in: Multilib handling for
+ mipsel-linux and mips64el-linux.
+
+2009-05-06 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch5.adb, exp_util.adb, exp_attr.adb, sem_util.adb, sem_res.adb,
+ targparm.adb, targparm.ads, exp_ch4.adb, exp_ch6.adb, exp_disp.adb,
+ opt.ads, exp_aggr.adb, exp_intr.adb, sem_disp.adb, exp_ch3.adb
+ (Tagged_Type_Expansion): New flag.
+ Replace use of VM_Target related to tagged types expansion by
+ Tagged_Type_Expansion, since tagged type expansion is not necessarily
+ linked to VM targets.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_attr.adb: Add processing for Standard'Compiler_Version
+
+ * sinput.adb (Expr_Last_Char): Fix some copy-paste errors for paren
+ skipping.
+ (Expr_First_Char): Add ??? comment that paren skipping needs work
+ (Expr_Last_Char): Add ??? comment that paren skipping needs work
+
+ * exp_attr.adb: Add processing for Compiler_Version
+
+ * sem_attr.adb: New attribute Compiler_Version
+
+ * snames.ads-tmpl: Add entries for Compiler_Version attribute
+
+ * gnat_rm.texi: Document Compiler_Version attribute
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb: Minor reformatting
+
+ * scng.adb, sem_prag.adb, par-ch4.adb, sem_res.adb, par-ch6.adb,
+ sem_ch6.adb, par-prag.adb, sem_ch8.adb, sem_warn.adb, par-util.adb,
+ styleg.adb: Add stylized comments to error messages that are included
+ in the codefix circuitry of IDE's such as GPS.
+
+2009-05-06 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: For Misnamed_Identifiers rule all description of the
+ new form of the rule parameter that allows to specify the suffix for
+ access-to-access type names.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb (Warn_On_Useless_Assignment): Avoid false negative for
+ out parameter assigned when exception handlers are present.
+
+ * sem_ch5.adb (Analyze_Exit_Statement): Kill current value last
+ assignments on exit.
+
+ * par-ch9.adb, sem_aggr.adb, par-endh.adb, sem_res.adb, par-ch6.adb,
+ sinput-l.adb, par-load.adb, errout.ads, sem_ch4.adb, lib-load.adb,
+ prj-dect.adb, par-ch12.adb, sem_ch8.adb, par-util.adb, par-ch3.adb,
+ par-tchk.adb, par-ch5.adb: This patch adds stylized comments to error
+ messages that are included in the codefix circuitry of IDE's such as
+ GPS.
+
+ * sinput.ads, sinput.adb (Expr_First_Char): New function
+ (Expr_Last_Char): New function
+
+2009-05-06 Sergey Rybin <rybin@adacore.com>
+
+ * gnat_ugn.texi: Add subsection for Exits_From_Conditional_Loops rule
+ Add formal definition for extra exit point metric
+
+2009-05-06 Pascal Obry <obry@adacore.com>
+
+ * adaint.c: Support for setting attributes on unicode filename on
+ Windows.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb: Minor reformatting
+
+2009-05-06 Javier Miranda <miranda@adacore.com>
+
+ * sem_prag.adb (Process_Import_Or_Interface): Imported CPP types must
+ not have discriminants or components with default expressions.
+ (Analyze_Pragma): For pragma CPP_Class check that imported types
+ have no discriminants and components have no default expression.
+
+ * sem_aggr.adb (Resolve_Aggr_Expr): Add missing check on wrong use of
+ class-wide types in the expression of a record component association.
+
+2009-05-06 Sergey Rybin <rybin@adacore.com>
+
+ * vms_data.ads: Add qualifier for gnatmetric extra exit points metric
+
+ * gnat_ugn.texi: Add description for the new extra exit points metric
+ (gnatmetric section).
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * s-fileio.adb: Minor comment update
+
+ * sem_ch8.adb: Minor reformatting
+
+ * exp_ch3.adb: Update comments.
+
+2009-05-06 Tristan Gingold <gingold@adacore.com>
+
+ * init.c, s-osinte-darwin.ads: Reduce alternate stack size
+
+2009-05-06 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Makefile.in: Update LIBGNAT_TARGET_PAIRS for Xenomai.
+ Fix missing unit for rtp-smp runtime on both ppc and x86 vxworks
+
+ * gcc-interface/Make-lang.in: Update dependencies
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): Revert previous
+ change. The context clause of a generic instance declaration must be
+ preserved until the end of the compilation, because it may have to be
+ installed/removed repeatedly.
+ The latest change to sem.adb ensures that the context of both spec and
+ body of an instance is traversed before the instance itself, making
+ this patch redundant.
+
+2009-05-06 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb: Fix typo.
+
+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch3.adb (Expand_N_Object_Declaration): For a controlled object
+ declaration, do not adjust if the declaration is to be rewritten into
+ a renaming.
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Find_Type): Reject the use of a task type in its own
+ discriminant part.
+
+2009-05-06 Bob Duff <duff@adacore.com>
+
+ * s-fileio.adb (File_IO_Clean_Up_Type): Make this type limited, since
+ otherwise the compiler would be allowed to optimize away the cleanup
+ code.
+
+2009-05-06 Gary Dismukes <dismukes@adacore.com>
+
+ * gnat_ugn.texi: Fix typo.
+
+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * g-debuti.adb: Minor reformatting
+
+ * exp_attr.adb: Minor reformatting
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_aggr.adb: Minor reformatting.
+
+ * g-socthi-vms.adb: Minor reformatting
+
+2009-05-06 Bob Duff <duff@adacore.com>
+
+ * g-table.ads, g-table.adb, g-dyntab.ads, g-dyntab.adb:
+ (Append_All): Add Append_All to g-table and g-dyntab, similar to table.
+
+2009-05-06 Bob Duff <duff@adacore.com>
+
+ * gnat_ugn.texi, gnat_rm.texi: Add missing documentation for warnings
+ flags.
+
+2009-05-06 Javier Miranda <miranda@adacore.com>
+
+ * sem_aggr.adb (Valid_Ancestor_Type): Add support for C++ constructors.
+ (Resolve_Extension_Aggregate): Do not reject C++ constructors in
+ extension aggregates.
+ (Resolve_Record_Aggregate): Add support for C++ constructors in
+ extension aggregates.
+
+ * exp_aggr.adb (Build_Record_Aggr_Code): Add support for C++
+ constructors in extension aggregates.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb (Freeze_Record_Type): Improve error msg for bad size
+ clause.
+
+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * g-socthi-vms.adb (C_Recvmsg, C_Sendmsg): Convert Msg to appropriate
+ packed type, since on OpenVMS, struct msghdr is packed.
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Object_Renaming): If the object is a function
+ call returning an unconstrained composite value, create the proper
+ subtype for it, as is done for object dclarations with unconstrained
+ nominal subtypes. Perform this transformation regarless of whether
+ call comes from source.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * freeze.adb (Freeze_Record_Type): Implement Implicit_Packing for
+ records
+
+ * gnat_rm.texi:
+ Add documentation for pragma Implicit_Packing applied to record
+ types.
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem.adb (Walk_Library_Items): Place all with_clauses of an
+ instantiation on the spec, because late instance bodies may generate
+ with_clauses for the instance body but are inserted in the instance
+ spec.
+
+2009-05-06 Emmanuel Briot <briot@adacore.com>
+
+ * prj-nmsc.adb (Locate_Directory): Remove unused parameters, and add
+ support for returning the directory even if it doesn't exist. This is
+ used for the object directory, since we are always setting it to a
+ non-null value, and we should set it to an absolute name rather than a
+ relative name for the sake of external tools that might depend on it.
+ (Check_Library_Attributes): When Project.Library_Dir is known, check
+ that the directory exists.
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Check_Dereference): If the prefix of an attribute
+ reference is an implicit dereference, do not freeze the designated type
+ if within a default expression or when preanalyzing a pre/postcondtion.
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Object_Renaming): If the object is a function
+ call returning an unconstrained composite value, create the proper
+ subtype for it, as is done for object dclarations with unconstrained
+ nominal subtypes
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch13.adb (Check_Constant_Address_Clause): Minor error message
+ improvements
+
+ * freeze.adb: Minor reformatting
+
+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb (Access_Type_Declaration): An access type whose
+ designated type is a limited view from a limited with clause (flagged
+ From_With_Type) is not itself such a limited view.
+
+2009-05-06 Emmanuel Briot <briot@adacore.com>
+
+ * prj-nmsc.adb: Remove unused variable.
+
+ * clean.adb, gnatcmd.adb, makeutl.ads, prj-pars.adb, prj-pars.ads,
+ prj-proc.ads, prj.ads, switch-m.adb (Subdirs_Option): Moved to
+ makeutl.ads, since not all users of prj.ads need this.
+
+2009-05-06 Javier Miranda <miranda@adacore.com>
+
+ * exp_aggr.adb (Build_Record_Aggr_Code): Add implicit call to the C++
+ constructor in case of aggregates whose type is a CPP_Class type.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch13.adb: Minor comment additions
+
+ * osint.adb: Minor reformatting
+
+2009-05-06 Pascal Obry <obry@adacore.com>
+
+ * initialize.c: On Windows, keep full pathname to expanded command
+ line patterns.
+
+2009-05-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Record_Aggregate): If a defaulted component of
+ an aggregate with box default is of a discriminated private type, do
+ not build a subaggregate for it.
+ A proper call to the initialization procedure is generated for it.
+
+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * rtsfind.adb, rtsfind.ads, exp_dist.adb, exp_dist.ads
+ (Exp_Dist.Build_TC_Call, Build_From_Any_Call, Build_To_Any_Call):
+ Use PolyORB strings to represent Ada.Strings.Unbounded_String value;
+ use standard array code for Standard.String.
+ (Exp_Dist): Bump PolyORB s-parint API version to 3.
+ (Rtsfind): New entities TA_Std_String, Unbounded_String.
+
+2009-05-06 Robert Dewar <dewar@adacore.com>
+
+ * g-comlin.ads: Minor reformatting
+
+ * xoscons.adb: Minor reformatting
+
+2009-05-06 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb (Resolve_Record_Aggregate): In step 5, get the
+ Underlying_Type before retrieving the type definition for gathering
+ components, to account for the case where the type is private.
+
+2009-05-06 Tristan Gingold <gingold@adacore.com>
+
+ * g-comlin.ads: Fix minor typos (Getopt instead of Get_Opt).
+
+2009-05-06 Thomas Quinot <quinot@adacore.com>
+
+ * g-socthi-vms.adb, g-socthi-vms.ads, g-socthi-vxworks.adb,
+ g-socthi-vxworks.ads, g-socthi-mingw.adb g-socthi-mingw.ads,
+ g-socthi.adb, g-stsifd-sockets.adb, g-socthi.ads, g-socket.adb
+ (GNAT.Sockets.Thin.C_Sendmsg, GNAT.Sockets.Thin.C_Recvmsg,
+ Windows versions): Fix incorrect base
+ address of Iovec (it's Msg_Iov, not Msg_Iov'Address).
+ (GNAT.Sockets.Thin.C_Sendto, GNAT.Sockets.Thin.C_Recvfrom): Use a
+ System.Address for the To parameter instead of a Sockaddr_In_Access, to
+ achieve independance from AF_INET family, and also to allow this
+ parameter to be retrieved from a Msghdr for the Windows case where
+ these routines are used to implement C_Sendmsg and C_Recvmsg.
+
+2009-05-06 Bob Duff <duff@adacore.com>
+
+ * g-expect.adb, g-expect.ads: Minor reformatting
+
+ * sdefault.ads: Minor comment fix
+
+ * g-expect-vms.adb: Minor reformatting
+
+ * table.ads, table.adb (Append_All): New convenience procedure for
+ appending a whole array.
+
+ * comperr.adb (Compiler_Abort): Mention the -gnatd.n switch in the bug
+ box message. Call Osint.Dump_Source_File_Names to print out the file
+ list, instead of rummaging around in various data structures.
+
+ * debug.adb: New switch -gnatd.n, to print source file names as they
+ are read.
+
+ * alloc.ads: Add parameters for Osint.File_Name_Chars.
+
+ * osint.ads, osint.adb (Dump_Source_File_Names): New procedure to print
+ out source file names during a "bug box".
+ (Include_Dir_Default_Prefix): Use memo-izing to avoid repeated new/free.
+ (Read_Source_File): Print out the file name, if requested via -gnatd.n.
+ If it's not part of the runtimes, store it for later printing by
+ Dump_Source_File_Names.
+
+2009-05-06 Javier Miranda <miranda@adacore.com>
+
+ * gnat_rm.texi (CPP_Constructor): Avoid duplication of the
+ documentation and add reference to the GNAT user guide for further
+ details.
+
+2009-05-06 Javier Miranda <miranda@adacore.com>
+
+ * gnat_ugn.texi: Complete documentation for CPP_Constructor and remove
+ also wrong examples that use extension aggregates.
+
+2009-05-06 Albert Lee <lee@adacore.com>
+
+ * s-oscons-tmplt.c (System.OS_Constants): Do not use special definition
+ of Msg_Iovlen_T for VMS.
+
+2009-05-04 Laurent GUERBY <laurent@guerby.net>
+
+ PR ada/38874
+ * make.adb (Scan_Make_Arg): Pass --param= to compiler and linker.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
+ box-defaulted operator in an instantiation, when the type of the
+ operands is not directly visible.
+
+2009-04-29 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
+ (Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
+ analysis of the ancestor part. Remove prohibition against limited
+ interpretations of the ancestor expression in the case of Ada 2005.
+ Revise error message in overloaded case, adding a message to cover
+ the Ada 2005 case.
+
+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * xoscons.adb: Minor reformatting
+
+2009-04-29 Bob Duff <duff@adacore.com>
+
+ * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
+ attribute_definition_clauses for the following attributes when the
+ -gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
+ Storage_Size, Write. Otherwise, we get spurious errors (for example,
+ missing Read attribute on remote types).
+
+ * gnat_ugn.texi: Document the change, and add a stern warning.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Check_Local_Access): Indicate that value tracing is
+ disabled not just for the current scope, but for the innermost dynamic
+ scope as well.
+
+2009-04-29 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Make-lang.in: Update dependencies
+
+2009-04-29 Vincent Celier <celier@adacore.com>
+
+ * prj-part.adb: Minor comment update
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Record_Aggregate): handle properly
+ box-initialized records with discriminated subcomponents that are
+ constrained by discriminants of enclosing components. New subsidiary
+ procedures Add_Discriminant_Values, Propagate_Discriminants.
+
+2009-04-29 Arnaud Charlet <charlet@adacore.com>
+
+ * g-socket.adb: Code clean up.
+
+2009-04-29 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_aggr.adb (Valid_Limited_Ancestor): Add test for the name of a
+ function entity, to cover the case of a parameterless function call
+ that has not been resolved.
+
+2009-04-29 Robert Dewar <dewar@adacore.com>
+
+ * err_vars.ads, prj-part.adb, scans.ads, exp_tss.adb: Minor
+ reformatting and comment updates.
+
+2009-04-29 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat_ugn.texi: Update some documentation about interfacing with C++
+ Mention -fkeep-inline-functions.
+
+ * gnat_ugn.texi: Minor edits
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aggr.adb (Resolve_Record_Aggregate): When building an aggregate
+ for a defaulted component of an enclosing aggregate, inherit the type
+ from the component declaration of the enclosing type.
+
+2009-04-29 Albert Lee <lee@adacore.com>
+
+ * g-socthi-vms.ads, g-socthi-vxworks.ads, s-oscons-tmplt.c,
+ g-socthi-mingw.ads, g-socthi.ads, g-socket.adb, g-sothco.ads
+ (System.OS_Constants): New type Msg_Iovlen_T which follows whether the
+ msg_iovlen field in struct msghdr is 32 or 64 bits wide.
+ Relocate the Msghdr record type from GNAT.Sockets.Thin to
+ GNAT.Sockets.Common, and use System.OS_Constants.Msg_Iovlen_T as the
+ type for the Msg_Iovlen field.
+
+2009-04-29 Vincent Celier <celier@adacore.com>
+
+ * sinput-l.adb (Load_File): When preprocessing, set temporarily the
+ Source_File_Index_Table entries for the source, to avoid crash when
+ reporting an error.
+
+ * gnatcmd.adb (Test_If_Relative_Path): Use
+ Makeutl.Test_If_Relative_Path.
+
+ * makeutl.adb:(Test_If_Relative_Path): Process switches --RTS= only if
+ Including_RTS is True.
+
+ * makeutl.ads (Test_If_Relative_Path): New Boolean parameter
+ Including_RTS defaulted to False.
+
+ * sinput.ads, scans.ads, err_vars.ads: Initialize some variables with
+ a default value.
+
+2009-04-29 Javier Miranda <miranda@adacore.com>
+
+ * gnat_ugn.texi: Adding documentation for non-default C++ constructors.
+
+2009-04-29 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch3.adb (Analyze_Object_Declaration): Disable error message
+ associated with dyamically tagged expressions if the expression
+ initializing a tagged type corresponds with a non default CPP
+ constructor.
+ (OK_For_Limited_Init): CPP constructor calls are OK for initialization
+ of limited type objects.
+
+ * sem_ch5.adb (Analyze_Assignment): Improve the error message reported
+ when a CPP constructor is called in an assignment. Disable also the
+ error message associated with dyamically tagged expressions if the
+ exporession initializing a tagged type corresponds with a non default
+ CPP constructor.
+
+ * sem_prag.adb (Analyze_Pragma): Remove code disabling the use of
+ non-default C++ constructors.
+
+ * sem_util.ads, sem_util.adb (Is_CPP_Constructor_Call): New subprogram.
+
+ * exp_tss.ads, exp_tss.adb (Base_Init_Proc): Add support for
+ non-default constructors.
+ (Init_Proc): Add support for non-default constructors.
+
+ * exp_disp.adb (Set_Default_Constructor): Removed.
+ (Set_CPP_Constructors): Code based in removed Set_Default_Constructor
+ but extending its functionality to handle non-default constructors.
+
+ * exp_aggr.adb (Build_Record_Aggr_Code): Add support for non-default
+ constructors. Minor code cleanup removing unrequired label and goto
+ statement.
+
+ * exp_ch3.adb (Build_Initialization_Call): Add support for non-default
+ constructors.
+ (Build_Init_Statements): Add support for non-default constructors.
+ (Expand_N_Object_Declaration): Add support for non-default constructors.
+ (Freeze_Record_Type): Replace call to Set_Default_Constructor by call
+ to Set_CPP_Constructors.
+
+ * exp_ch5.adb (Expand_N_Assignment_Statement): Add support for
+ non-default constructors.
+ Required to handle its use in build-in-place statements.
+
+ * gnat_rm.texi (CPP_Constructor): Document new extended use of this
+ pragma for non-default C++ constructors and the new compiler support
+ that allows the use of these constructors in record components, limited
+ aggregates, and extended return statements.
+
+2009-04-29 Vincent Celier <celier@adacore.com>
+
+ * prj-part.adb (Parse_Single_Project): Do not attempt to find a
+ project extending an abstract project.
+
+2009-04-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * targparm.ads: Fix oversight.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * lib-xref.adb (Output_Overridden_Op): Follow several levels of
+ derivation when necessary, to find the user-subprogram that is actally
+ being overridden.
+
+2009-04-29 Robert Dewar <dewar@adacore.com>
+
+ * sem_util.adb (May_Be_Lvalue): Fix cases involving indexed/selected
+ components
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch9.ads, exp_ch9.adb (Build_Wrapper_Spec): Use source line of
+ primitive operation, rather than source line of synchronized type, when
+ building the wrapper for a primitive operation that overrides an
+ operation inherited from a progenitor, to improve the error message on
+ duplicate declarations.
+
+ * sem_ch3.adb (Process_Full_View): Use new signature of
+ Build_Wrapper_Spec.
+
+2009-04-29 Robert Dewar <dewar@adacore.com>
+
+ * prj-nmsc.ads: Minor reformatting
+
+2009-04-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Set the SLOC of the
+ expression on the existing parent If statement.
+
+2009-04-29 Robert Dewar <dewar@adacore.com>
+
+ * prj-proc.adb, prj.ads: Minor reformatting
+
+2009-04-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Set the SLOC of an
+ existing parent If statement on the newly created one.
+
+2009-04-29 Emmanuel Briot <briot@adacore.com>
+
+ * gnatcmd.adb, prj-proc.adb, prj-proc.ads, make.adb, prj-part.adb,
+ prj-part.ads, prj.adb, prj.ads, clean.adb, prj-dect.adb, prj-dect.ads,
+ prj-nmsc.adb, prj-nmsc.ads, prj-pars.adb, prj-pars.ads, prj-makr.adb
+ (Set_In_Configuration, In_Configuration): Removed.
+ Replaced by an extra parameter Is_Config_File in several parameter to
+ avoid global variables to store the state of the parser.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sinfo.ads, sinfo.adb: New attribute Next_Implicit_With, to chain
+ with_clauses generated for the same unit through rtsfind, and that
+ appear in the context of different units.
+
+ * rtsfind.adb: New attribute First_Implicit_With, component of the
+ Unit_Record that stores information about a unit loaded through rtsfind.
+
+2009-04-29 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch3.adb (Stream_Operation_OK): Return True for limited interfaces
+ (other conditions permitting), so that abstract stream subprograms will
+ be declared for them.
+
+2009-04-29 Bob Duff <duff@adacore.com>
+
+ * g-expect.adb (Expect_Internal): Fix check for overfull buffer.
+
+ * g-expect.ads: Minor comment fixes.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb, lib-xref.adb (Check_Dispatching_Operation): if the
+ dispatching operation is a body without previous spec, update the list
+ of primitive operations to ensure that cross-reference information is
+ up-to-date.
+
+2009-04-29 Albert Lee <lee@adacore.com>
+
+ * g-socthi-vms.adb, g-socthi-vms.ads, g-socthi-vxworks.adb,
+ g-socthi-vxworks.ads, g-socthi-mingw.adb, g-socthi-mingw.ads,
+ g-socthi.adb, g-socthi.ads, g-socket.adb, g-socket.ads
+ (GNAT.Sockets.Thin.C_Readv,
+ GNAT.Sockets.Thin.C_Writev): Remove unused subprograms.
+ (GNAT.Sockets.Thin.C_Recvmsg,
+ GNAT.Sockets.Thin.C_Sendmsg): New bindings to call recvmsg(2) and
+ sendmsg(2).
+ (GNAT.Sockets.Receive_Vector, GNAT.Sockets.Send_Vector): Use
+ C_Recvmsg/C_Sendmsg rather than Readv/C_Writev.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_disp.adb (Check_Dispatching_Operation): if the dispatching
+ operation is a body without previous spec, update the list of
+ primitive operations to ensure that cross-reference information is
+ up-to-date.
+
+ * sem_ch12.adb (Build_Instance_Compilation_Unit_Nodes): When creating a
+ new compilation unit node for the instance declaration, keep the
+ context items of the original unit on it, so that the context of the
+ instance body only holds the context inherited from the generic body.
+
+2009-04-29 Bob Duff <duff@adacore.com>
+
+ * sem_res.adb: Minor comment fix.
+
+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * sem_elim.adb: Minor reformatting
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_aggr.adb (Convert_To_Positional): if the current unit is a
+ predefined unit, allow arbitrary number of components in static
+ aggregate, to ensure that the same level of constant folding applies
+ for Ada 95 and Ada 05 versions of the file.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_elim.adb (Check_Eliminated): Handle new improved eliminate
+ information: no need for full scope check.
+ (Eliminate_Error): Do not emit error in a generic context.
+
+2009-04-29 Ed Falis <falis@adacore.com>
+
+ * adaint.c (__gnat_rmdir): return error code if VTHREADS is defined.
+ VxWorks 653 POS does not support rmdir.
+
+2009-04-29 Matteo Bordin <bordin@adacore.com>
+
+ * s-stausa.adb, s-stausa.ads: Get_Usage_Range: changing the way
+ results are printed.
+
+2009-04-29 Arnaud Charlet <charlet@adacore.com>
+
+ * s-taskin.adb (Initialize): Remove pragma Warnings Off and remove
+ unused assignment.
+
+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * make.adb: Minor reformatting.
+ Minor code reorganization throughout.
+
+2009-04-29 Matteo Bordin <bordin@adacore.com>
+
+ * s-stausa.ads: Changed visibility of type Task_Result: moved to
+ public part to give application visibility over it.
+ This is for future improvement and to build a public API on top of it.
+ Changed record components name of type Task_Result to reflect the new
+ way of reporting.
+
+ * s-stausa.adb: Actual_Size_Str changed to reflect the new way of
+ reporting Stack usage.
+
+ * gnat_ugn.texi: Update doc of stack usage report.
+
+ * g-tastus.ads, s-stusta.ads, s-stusta.adb: New files.
+
+ * Makefile.rtl: Add new run-time files.
+
+2009-04-29 Pascal Obry <obry@adacore.com>
+
+ * initialize.c: Do not expand quoted arguments.
+
+2009-04-29 Emmanuel Briot <briot@adacore.com>
+
+ * prj-ext.adb, prj.adb, prj.ads: Fix memory leaks.
+
+ * clean.adb (Ultimate_Extension_Of): removed, since duplicate of
+ Prj.Ultimate_Extending_Project_Of
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch7.adb (Build_Final_List): If the designated type is a Taft
+ Amendment type, add the with_clause for Finalization.List_Controller
+ only if the current context is a package body.
+
+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch12.adb: Minor reformatting
+
+ * sem_aggr.adb: Minor reformatting
+
+ * sem_ch6.adb, sem_cat.ads: Minor reformatting
+
+ * sem_ch10.adb, gnat1drv.adb, prj-nmsc.adb: Minor reformatting
+
+2009-04-29 Quentin Ochem <ochem@adacore.com>
+
+ * prj.ads (Source_Id): Now general pointer type.
+
+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch7.adb, rtsfind.adb: Minor reformatting
+
+ * sem_res.adb: Minor reformatting
+
+2009-04-29 Thomas Quinot <quinot@adacore.com>
+
+ * sem_res.adb (Static_Concatenation): An N_Op_Concat with static
+ operands is static only if it is a predefined concatenation operator.
+
+ * sem_util.adb: Minor reformatting
+
+ * sem_ch12.adb (Save_References): When propagating semantic information
+ from generic copy back to generic template, for the case of an
+ identifier that has been rewritten to an explicit dereference whose
+ prefix is either an object name or a parameterless funcion call
+ denoting a global object or function, properly capture the denoted
+ global entity: perform the corresponding rewriting in the template,
+ and point the rewritten identifier to the correct global entity (not
+ to the associated identifier in the generic copy).
+
+2009-04-29 Robert Dewar <dewar@adacore.com>
+
+ * rtsfind.adb, prj-env.adb: Minor reformatting
+ Minor code reorganization
+
+2009-04-29 Emmanuel Briot <briot@adacore.com>
+
+ * make.adb: Fix comment
+
+ * prj.adb (Ultimate_Extending_Project_Of): Fix handling when no project
+ is given as argument, as might happen in gnatmake.
+
+2009-04-29 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Check_Abstract_Overriding): Improve error message when
+ an abstract operation of a progenitor is not properly overridden by an
+ operation of a derived synchronized type.
+
+2009-04-29 Robert Dewar <dewar@adacore.com>
+
+ * mlib-prj.adb, mlib-tgt.adb, mlib-tgt.ads, prj-nmsc.adb,
+ prj-proc.adb: Minor reformatting
+ Minor code reorganization
+
+2009-04-29 Bob Duff <duff@adacore.com>
+
+ * exp_ch7.adb (Build_Final_List): For an access type that designates a
+ Taft Amendment type, if the access type needs finalization, make sure
+ the implicit with clause for List_Controller occurs on the package spec.
+
+ * rtsfind.adb (Text_IO_Kludge): Fine tune the creation of implicit
+ with's created for the pseudo-children of Text_IO and friends. In
+ particular, avoid cycles, such as Ada.Wide_Text_IO.Integer_IO and
+ Ada.Text_IO.Integer_IO both with-ing each other.
+
+ * sem.adb (Walk_Library_Items): Suppress assertion failure in certain
+ oddball cases when pragma Extend_System is used.
+
+ * sem_ch12.adb (Get_Associated_Node): Prevent direct 'with' cycles in
+ the case where a package spec instantiates a generic whose body with's
+ this package, so Walk_Library_Items won't complain about cyclic with's.
+
+2009-04-29 Emmanuel Briot <briot@adacore.com>
+
+ * gnatcmd.adb, prj-proc.adb, make.adb, mlib-prj.adb, prj.adb, prj.ads,
+ prj-pp.adb, prj-pp.ads, makeutl.adb, clean.adb, prj-nmsc.adb,
+ mlib-tgt.adb, mlib-tgt.ads, prj-util.adb, prj-env.adb, prj-env.ads
+ (Project_Id): now a real pointer to Project_Data, instead of an index
+ into the Projects_Table. This simplifies the API significantly, avoiding
+ extra lookups in this table and the need to pass the Project_Tree_Ref
+ parameter in several cases
+
+2009-04-29 Nicolas Setton <setton@adacore.com>
+
+ * gcc-interface/Makefile.in: Produce .dSYM files for shared libs on
+ darwin.
+
2009-04-25 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Subtype>: Put
diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl
index 66c48e06093..0b2bec599ef 100644
--- a/gcc/ada/Makefile.rtl
+++ b/gcc/ada/Makefile.rtl
@@ -41,6 +41,7 @@ GNATRTL_TASKING_OBJS= \
g-boumai$(objext) \
g-semaph$(objext) \
g-signal$(objext) \
+ g-tastus$(objext) \
g-thread$(objext) \
s-asthan$(objext) \
s-inmaop$(objext) \
@@ -50,6 +51,7 @@ GNATRTL_TASKING_OBJS= \
s-osinte$(objext) \
s-proinf$(objext) \
s-solita$(objext) \
+ s-stusta$(objext) \
s-taenca$(objext) \
s-taprob$(objext) \
s-taprop$(objext) \
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index e78440ac0c5..1f5e1546796 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -747,6 +747,9 @@ __gnat_rmdir (char *path)
S2WSC (wpath, path, GNAT_MAX_PATH_LEN);
return _trmdir (wpath);
}
+#elif defined (VTHREADS)
+ /* rmdir not available */
+ return -1;
#else
return rmdir (path);
#endif
@@ -3366,6 +3369,63 @@ __gnat_copy_attribs (char *from, char *to, int mode)
{
#if defined (VMS) || defined (__vxworks) || defined (__nucleus__)
return -1;
+
+#elif defined (_WIN32) && !defined (RTX)
+ TCHAR wfrom [GNAT_MAX_PATH_LEN + 2];
+ TCHAR wto [GNAT_MAX_PATH_LEN + 2];
+ BOOL res;
+ FILETIME fct, flat, flwt;
+ HANDLE hfrom, hto;
+
+ S2WSC (wfrom, from, GNAT_MAX_PATH_LEN + 2);
+ S2WSC (wto, to, GNAT_MAX_PATH_LEN + 2);
+
+ /* retrieve from times */
+
+ hfrom = CreateFile
+ (wfrom, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+ if (hfrom == INVALID_HANDLE_VALUE)
+ return -1;
+
+ res = GetFileTime (hfrom, &fct, &flat, &flwt);
+
+ CloseHandle (hfrom);
+
+ if (res == 0)
+ return -1;
+
+ /* retrieve from times */
+
+ hto = CreateFile
+ (wto, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+
+ if (hto == INVALID_HANDLE_VALUE)
+ return -1;
+
+ res = SetFileTime (hto, NULL, &flat, &flwt);
+
+ CloseHandle (hto);
+
+ if (res == 0)
+ return -1;
+
+ /* Set file attributes in full mode. */
+
+ if (mode == 1)
+ {
+ DWORD attribs = GetFileAttributes (wfrom);
+
+ if (attribs == INVALID_FILE_ATTRIBUTES)
+ return -1;
+
+ res = SetFileAttributes (wto, attribs);
+ if (res == 0)
+ return -1;
+ }
+
+ return 0;
+
#else
struct stat fbuf;
struct utimbuf tbuf;
diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads
index 61c3ba867f4..fa6c9d123f5 100644
--- a/gcc/ada/alloc.ads
+++ b/gcc/ada/alloc.ads
@@ -61,6 +61,9 @@ package Alloc is
Elmts_Initial : constant := 1_200; -- Elists
Elmts_Increment : constant := 100;
+ File_Name_Chars_Initial : constant := 10_000; -- Osint
+ File_Name_Chars_Increment : constant := 100;
+
Inlined_Bodies_Initial : constant := 50; -- Inline
Inlined_Bodies_Increment : constant := 200;
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index ce77b60577e..2c08d49daaf 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -25,7 +25,7 @@
with ALI; use ALI;
with Csets;
-with Makeutl;
+with Makeutl; use Makeutl;
with MLib.Tgt; use MLib.Tgt;
with Namet; use Namet;
with Opt; use Opt;
@@ -242,11 +242,6 @@ package body Clean is
-- Returns True iff Prj is an extension of Of_Project or if Of_Project is
-- an extension of Prj.
- function Ultimate_Extension_Of (Project : Project_Id) return Project_Id;
- -- Returns either Project, if it is not extended by another project, or
- -- the project that extends Project, directly or indirectly, and that is
- -- not itself extended. Returns No_Project if Project is No_Project.
-
procedure Usage;
-- Display the usage. If called several times, the usage is displayed only
-- the first time.
@@ -336,8 +331,6 @@ package body Clean is
procedure Clean_Archive (Project : Project_Id; Global : Boolean) is
Current_Dir : constant Dir_Name_Str := Get_Current_Dir;
- Data : constant Project_Data := Project_Tree.Projects.Table (Project);
-
Lib_Prefix : String_Access;
Archive_Name : String_Access;
-- The name of the archive file for this project
@@ -346,7 +339,7 @@ package body Clean is
-- The name of the archive dependency file for this project
Obj_Dir : constant String :=
- Get_Name_String (Data.Object_Directory.Display_Name);
+ Get_Name_String (Project.Object_Directory.Display_Name);
begin
Change_Dir (Obj_Dir);
@@ -356,10 +349,10 @@ package body Clean is
if Global then
Lib_Prefix :=
- new String'("lib" & Get_Name_String (Data.Display_Name));
+ new String'("lib" & Get_Name_String (Project.Display_Name));
else
Lib_Prefix :=
- new String'("lib" & Get_Name_String (Data.Library_Name));
+ new String'("lib" & Get_Name_String (Project.Library_Name));
end if;
Archive_Name := new String'(Lib_Prefix.all & '.' & Archive_Ext);
@@ -540,7 +533,6 @@ package body Clean is
procedure Clean_Interface_Copy_Directory (Project : Project_Id) is
Current : constant String := Get_Current_Dir;
- Data : constant Project_Data := Project_Tree.Projects.Table (Project);
Direc : Dir_Type;
@@ -551,10 +543,12 @@ package body Clean is
Unit : Unit_Data;
begin
- if Data.Library and then Data.Library_Src_Dir /= No_Path_Information then
+ if Project.Library
+ and then Project.Library_Src_Dir /= No_Path_Information
+ then
declare
Directory : constant String :=
- Get_Name_String (Data.Library_Src_Dir.Display_Name);
+ Get_Name_String (Project.Library_Src_Dir.Display_Name);
begin
Change_Dir (Directory);
@@ -583,7 +577,7 @@ package body Clean is
loop
Unit := Project_Tree.Units.Table (Index);
- if Ultimate_Extension_Of
+ if Ultimate_Extending_Project_Of
(Unit.File_Names (Body_Part).Project) = Project
and then
Get_Name_String
@@ -594,7 +588,7 @@ package body Clean is
exit;
end if;
- if Ultimate_Extension_Of
+ if Ultimate_Extending_Project_Of
(Unit.File_Names (Specification).Project) = Project
and then
Get_Name_String
@@ -634,9 +628,8 @@ package body Clean is
procedure Clean_Library_Directory (Project : Project_Id) is
Current : constant String := Get_Current_Dir;
- Data : constant Project_Data := Project_Tree.Projects.Table (Project);
- Lib_Filename : constant String := Get_Name_String (Data.Library_Name);
+ Lib_Filename : constant String := Get_Name_String (Project.Library_Name);
DLL_Name : String :=
DLL_Prefix & Lib_Filename & "." & DLL_Ext;
Archive_Name : String :=
@@ -652,22 +645,22 @@ package body Clean is
Major : String_Access := Empty_String'Access;
begin
- if Data.Library then
- if Data.Library_Kind /= Static
+ if Project.Library then
+ if Project.Library_Kind /= Static
and then MLib.Tgt.Library_Major_Minor_Id_Supported
- and then Data.Lib_Internal_Name /= No_Name
+ and then Project.Lib_Internal_Name /= No_Name
then
- Minor := new String'(Get_Name_String (Data.Lib_Internal_Name));
+ Minor := new String'(Get_Name_String (Project.Lib_Internal_Name));
Major := new String'(MLib.Major_Id_Name (DLL_Name, Minor.all));
end if;
declare
Lib_Directory : constant String :=
Get_Name_String
- (Data.Library_Dir.Display_Name);
+ (Project.Library_Dir.Display_Name);
Lib_ALI_Directory : constant String :=
Get_Name_String
- (Data.Library_ALI_Dir.Display_Name);
+ (Project.Library_ALI_Dir.Display_Name);
begin
Canonical_Case_File_Name (Archive_Name);
@@ -686,6 +679,7 @@ package body Clean is
declare
Filename : constant String := Name (1 .. Last);
+
begin
if Is_Regular_File (Filename)
or else Is_Symbolic_Link (Filename)
@@ -693,15 +687,18 @@ package body Clean is
Canonical_Case_File_Name (Name (1 .. Last));
Delete_File := False;
- if (Data.Library_Kind = Static
- and then Name (1 .. Last) = Archive_Name)
+ if (Project.Library_Kind = Static
+ and then Name (1 .. Last) = Archive_Name)
or else
- ((Data.Library_Kind = Dynamic or else
- Data.Library_Kind = Relocatable)
+ ((Project.Library_Kind = Dynamic
+ or else
+ Project.Library_Kind = Relocatable)
and then
(Name (1 .. Last) = DLL_Name
- or else Name (1 .. Last) = Minor.all
- or else Name (1 .. Last) = Major.all))
+ or else
+ Name (1 .. Last) = Minor.all
+ or else
+ Name (1 .. Last) = Major.all))
then
if not Do_Nothing then
Set_Writable (Filename);
@@ -747,7 +744,7 @@ package body Clean is
if Unit.File_Names (Body_Part).Project /=
No_Project
then
- if Ultimate_Extension_Of
+ if Ultimate_Extending_Project_Of
(Unit.File_Names (Body_Part).Project) =
Project
then
@@ -764,7 +761,7 @@ package body Clean is
end if;
end if;
- elsif Ultimate_Extension_Of
+ elsif Ultimate_Extending_Project_Of
(Unit.File_Names (Specification).Project) =
Project
then
@@ -817,8 +814,6 @@ package body Clean is
-- Name of the executable file
Current_Dir : constant Dir_Name_Str := Get_Current_Dir;
- Data : constant Project_Data :=
- Project_Tree.Projects.Table (Project);
U_Data : Unit_Data;
File_Name1 : File_Name_Type;
Index1 : Int;
@@ -834,7 +829,7 @@ package body Clean is
if Project = Main_Project
and then Osint.Number_Of_Files /= 0
- and then Data.Library
+ and then Project.Library
then
Osint.Fail
("Cannot specify executable(s) for a Library Project File");
@@ -842,17 +837,17 @@ package body Clean is
-- Nothing to clean in an externally built project
- if Data.Externally_Built then
+ if Project.Externally_Built then
if Verbose_Mode then
Put ("Nothing to do to clean externally built project """);
- Put (Get_Name_String (Data.Name));
+ Put (Get_Name_String (Project.Name));
Put_Line ("""");
end if;
else
if Verbose_Mode then
Put ("Cleaning project """);
- Put (Get_Name_String (Data.Name));
+ Put (Get_Name_String (Project.Name));
Put_Line ("""");
end if;
@@ -861,11 +856,11 @@ package body Clean is
Processed_Projects.Increment_Last;
Processed_Projects.Table (Processed_Projects.Last) := Project;
- if Data.Object_Directory /= No_Path_Information then
+ if Project.Object_Directory /= No_Path_Information then
declare
Obj_Dir : constant String :=
Get_Name_String
- (Data.Object_Directory.Display_Name);
+ (Project.Object_Directory.Display_Name);
begin
Change_Dir (Obj_Dir);
@@ -878,8 +873,8 @@ package body Clean is
-- Source_Dirs or Source_Files is specified as an empty list,
-- so always look for Ada units in extending projects.
- if Has_Ada_Sources (Data)
- or else Data.Extends /= No_Project
+ if Has_Ada_Sources (Project)
+ or else Project.Extends /= No_Project
then
for Unit in Unit_Table.First ..
Unit_Table.Last (Project_Tree.Units)
@@ -1022,19 +1017,23 @@ package body Clean is
-- Check if a global archive and it dependency file could have
-- been created and, if they exist, delete them.
- if Project = Main_Project and then not Data.Library then
+ if Project = Main_Project and then not Project.Library then
Global_Archive := False;
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Has_Foreign_Sources
- (Project_Tree.Projects.Table (Proj))
- then
- Global_Archive := True;
- exit;
- end if;
- end loop;
+ declare
+ Proj : Project_List;
+
+ begin
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ if Has_Foreign_Sources (Proj.Project) then
+ Global_Archive := True;
+ exit;
+ end if;
+
+ Proj := Proj.Next;
+ end loop;
+ end;
if Global_Archive then
Clean_Archive (Project, Global => True);
@@ -1050,21 +1049,21 @@ package body Clean is
-- The directories are cleaned only if switch -c is not specified
- if Data.Library then
+ if Project.Library then
if not Compile_Only then
Clean_Library_Directory (Project);
- if Data.Library_Src_Dir /= No_Path_Information then
+ if Project.Library_Src_Dir /= No_Path_Information then
Clean_Interface_Copy_Directory (Project);
end if;
end if;
- if Data.Standalone_Library and then
- Data.Object_Directory /= No_Path_Information
+ if Project.Standalone_Library and then
+ Project.Object_Directory /= No_Path_Information
then
Delete_Binder_Generated_Files
- (Get_Name_String (Data.Object_Directory.Display_Name),
- File_Name_Type (Data.Library_Name));
+ (Get_Name_String (Project.Object_Directory.Display_Name),
+ File_Name_Type (Project.Library_Name));
end if;
end if;
@@ -1085,7 +1084,7 @@ package body Clean is
-- For each imported project, call Clean_Project if the project
-- has not been processed already.
- Imported := Data.Imported_Projects;
+ Imported := Project.Imported_Projects;
while Imported /= null loop
Process := True;
@@ -1110,8 +1109,8 @@ package body Clean is
-- called before, because no other project may import or extend
-- this project.
- if Data.Extends /= No_Project then
- Clean_Project (Data.Extends);
+ if Project.Extends /= No_Project then
+ Clean_Project (Project.Extends);
end if;
end;
end if;
@@ -1122,11 +1121,11 @@ package body Clean is
-- The executables are deleted only if switch -c is not specified
if Project = Main_Project
- and then Data.Exec_Directory /= No_Path_Information
+ and then Project.Exec_Directory /= No_Path_Information
then
declare
Exec_Dir : constant String :=
- Get_Name_String (Data.Exec_Directory.Display_Name);
+ Get_Name_String (Project.Exec_Directory.Display_Name);
begin
Change_Dir (Exec_Dir);
@@ -1160,9 +1159,9 @@ package body Clean is
end;
end if;
- if Data.Object_Directory /= No_Path_Information then
+ if Project.Object_Directory /= No_Path_Information then
Delete_Binder_Generated_Files
- (Get_Name_String (Data.Object_Directory.Display_Name),
+ (Get_Name_String (Project.Object_Directory.Display_Name),
Strip_Suffix (Main_Source_File));
end if;
end loop;
@@ -1374,7 +1373,8 @@ package body Clean is
(Project => Main_Project,
In_Tree => Project_Tree,
Project_File_Name => Project_File_Name.all,
- Packages_To_Check => Packages_To_Check_By_Gnatmake);
+ Packages_To_Check => Packages_To_Check_By_Gnatmake,
+ Is_Config_File => False);
if Main_Project = No_Project then
Fail ("""" & Project_File_Name.all & """ processing failed");
@@ -1391,7 +1391,7 @@ package body Clean is
-- Add source directories and object directories to the search paths
Add_Source_Directories (Main_Project, Project_Tree);
- Add_Object_Directories (Main_Project, Project_Tree);
+ Add_Object_Directories (Main_Project);
end if;
Osint.Add_Default_Search_Dirs;
@@ -1402,9 +1402,8 @@ package body Clean is
if Main_Project /= No_Project and then Osint.Number_Of_Files = 0 then
declare
- Value : String_List_Id :=
- Project_Tree.Projects.Table (Main_Project).Mains;
Main : String_Element;
+ Value : String_List_Id := Main_Project.Mains;
begin
while Value /= Prj.Nil_String loop
Main := Project_Tree.String_Elements.Table (Value);
@@ -1466,7 +1465,7 @@ package body Clean is
(Of_Project : Project_Id;
Prj : Project_Id) return Boolean
is
- Data : Project_Data;
+ Proj : Project_Id;
begin
if Prj = No_Project or else Of_Project = No_Project then
@@ -1477,24 +1476,22 @@ package body Clean is
return True;
end if;
- Data := Project_Tree.Projects.Table (Of_Project);
-
- while Data.Extends /= No_Project loop
- if Data.Extends = Prj then
+ Proj := Of_Project;
+ while Proj.Extends /= No_Project loop
+ if Proj.Extends = Prj then
return True;
end if;
- Data := Project_Tree.Projects.Table (Data.Extends);
+ Proj := Proj.Extends;
end loop;
- Data := Project_Tree.Projects.Table (Prj);
-
- while Data.Extends /= No_Project loop
- if Data.Extends = Of_Project then
+ Proj := Prj;
+ while Proj.Extends /= No_Project loop
+ if Proj.Extends = Of_Project then
return True;
end if;
- Data := Project_Tree.Projects.Table (Data.Extends);
+ Proj := Proj.Extends;
end loop;
return False;
@@ -1904,26 +1901,6 @@ package body Clean is
return Src & Tree_Suffix;
end Tree_File_Name;
- ---------------------------
- -- Ultimate_Extension_Of --
- ---------------------------
-
- function Ultimate_Extension_Of (Project : Project_Id) return Project_Id is
- Result : Project_Id := Project;
- Data : Project_Data;
-
- begin
- if Project /= No_Project then
- loop
- Data := Project_Tree.Projects.Table (Result);
- exit when Data.Extended_By = No_Project;
- Result := Data.Extended_By;
- end loop;
- end if;
-
- return Result;
- end Ultimate_Extension_Of;
-
-----------
-- Usage --
-----------
diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb
index 157945bb0d9..43680b1b4bb 100644
--- a/gcc/ada/comperr.adb
+++ b/gcc/ada/comperr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -30,9 +30,7 @@
with Atree; use Atree;
with Debug; use Debug;
with Errout; use Errout;
-with Fname; use Fname;
with Gnatvsn; use Gnatvsn;
-with Lib; use Lib;
with Namet; use Namet;
with Osint; use Osint;
with Output; use Output;
@@ -395,26 +393,19 @@ package body Comperr is
Write_Line ("Note that list may not be accurate in some cases, ");
Write_Line ("so please double check that the problem can still ");
Write_Line ("be reproduced with the set of files listed.");
+ Write_Line ("Consider also -gnatd.n switch (see debug.adb).");
Write_Eol;
- for U in Main_Unit .. Last_Unit loop
- begin
- if not Is_Internal_File_Name
- (File_Name (Source_Index (U)))
- then
- Write_Name (Full_File_Name (Source_Index (U)));
- Write_Eol;
- end if;
+ begin
+ Dump_Source_File_Names;
- -- No point in double bug box if we blow up trying to print
- -- the list of file names! Output informative msg and quit.
+ -- If we blow up trying to print the list of file names, just output
+ -- informative msg and continue.
- exception
- when others =>
- Write_Str ("list may be incomplete");
- exit;
- end;
- end loop;
+ exception
+ when others =>
+ Write_Str ("list may be incomplete");
+ end;
Write_Eol;
Set_Standard_Output;
diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb
index 8cb47ac5886..d0b285abf34 100644
--- a/gcc/ada/debug.adb
+++ b/gcc/ada/debug.adb
@@ -104,7 +104,7 @@ package body Debug is
-- d.k
-- d.l Use Ada 95 semantics for limited function returns
-- d.m For -gnatl, print full source only for main unit
- -- d.n
+ -- d.n Print source file names
-- d.o
-- d.p
-- d.q
@@ -523,6 +523,10 @@ package body Debug is
-- main source (this corresponds to a previous behavior of -gnatl and
-- is used for running the ACATS tests).
+ -- d.n Print source file names as they are loaded. This is useful if the
+ -- compiler has a bug -- these are the files that need to be included
+ -- in a bug report.
+
-- d.r Forces the flag OK_To_Reorder_Components to be set in all record
-- base types that have no discriminants.
diff --git a/gcc/ada/err_vars.ads b/gcc/ada/err_vars.ads
index ac4860ee716..c4c28dafc36 100644
--- a/gcc/ada/err_vars.ads
+++ b/gcc/ada/err_vars.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -32,24 +32,31 @@ with Uintp; use Uintp;
package Err_Vars is
+ -- All of these variables are set when needed, so they do not need to be
+ -- initialized. However, there is code that saves and restores existing
+ -- values, which may malfunction in -gnatVa mode if the variable has never
+ -- been iniitalized, so we initialize some variables to avoid exceptions
+ -- from invalid values in such cases.
+
------------------
-- Error Counts --
------------------
- Serious_Errors_Detected : Nat;
+ Serious_Errors_Detected : Nat := 0;
-- This is a count of errors that are serious enough to stop expansion,
-- and hence to prevent generation of an object file even if the
-- switch -gnatQ is set. Initialized to zero at the start of compilation.
+ -- Initialized for -gnatVa use, see comment above.
- Total_Errors_Detected : Nat;
+ Total_Errors_Detected : Nat := 0;
-- Number of errors detected so far. Includes count of serious errors and
-- non-serious errors, so this value is always greater than or equal to the
-- Serious_Errors_Detected value. Initialized to zero at the start of
- -- compilation.
+ -- compilation. Initialized for -gnatVa use, see comment above.
- Warnings_Detected : Nat;
+ Warnings_Detected : Nat := 0;
-- Number of warnings detected. Initialized to zero at the start of
- -- compilation.
+ -- compilation. Initialized for -gnatVa use, see comment above.
----------------------------------
-- Error Message Mode Variables --
@@ -67,7 +74,7 @@ package Err_Vars is
-- note get reset by any Error_Msg call, so the caller is responsible
-- for resetting it.
- Warn_On_Instance : Boolean;
+ Warn_On_Instance : Boolean := False;
-- Normally if a warning is generated in a generic template from the
-- analysis of the template, then the warning really belongs in the
-- template, and the default value of False for this Boolean achieves
@@ -75,13 +82,14 @@ package Err_Vars is
-- generated on the instantiation (referring to the template) rather
-- than on the template itself.
- Raise_Exception_On_Error : Nat;
+ Raise_Exception_On_Error : Nat := 0;
-- If this value is non-zero, then any attempt to generate an error
-- message raises the exception Error_Msg_Exception, and the error
-- message is not output. This is used for defending against junk
-- resulting from illegalities, and also for substitution of more
-- appropriate error messages from higher semantic levels. It is
-- a counter so that the increment/decrement protocol nests neatly.
+ -- Initialized for -gnatVa use, see comment above.
Error_Msg_Exception : exception;
-- Exception raised if Raise_Exception_On_Error is true
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 76d465a05f3..c762be166fc 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -53,9 +53,9 @@ with Uname; use Uname;
package body Errout is
Errors_Must_Be_Ignored : Boolean := False;
- -- Set to True by procedure Set_Ignore_Errors (True), when calls to
- -- error message procedures should be ignored (when parsing irrelevant
- -- text in sources being preprocessed).
+ -- Set to True by procedure Set_Ignore_Errors (True), when calls to error
+ -- message procedures should be ignored (when parsing irrelevant text in
+ -- sources being preprocessed).
Finalize_Called : Boolean := False;
-- Set True if the Finalize routine has been called
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index 41daf243bab..e4d8a62e6dc 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -581,6 +581,33 @@ package Errout is
-- Triggering switch. If non-zero, then ignore errors mode is activated.
-- This is a counter to allow convenient nesting of enable/disable.
+ -----------------------
+ -- CODEFIX Facility --
+ -----------------------
+
+ -- The GPS and GNATBench IDE's have a codefix facility that allows for
+ -- automatic correction of a subset of the errors and warnings issued
+ -- by the compiler. This is done by recognizing the text of specific
+ -- messages using appropriate matching patterns.
+
+ -- The text of such messages should not be altered without coordinating
+ -- with the codefix code. All such messages are marked by a specific
+ -- style of comments, as shown by the following example:
+
+ -- Error_Msg_N -- CODEFIX
+ -- (parameters ....)
+
+ -- Any message marked with this -- CODEFIX comment should not be modified
+ -- without appropriate coordination. If new messages are added which may
+ -- be susceptible to automatic codefix action, they are marked using:
+
+ -- Error_Msg -- CODEFIX???
+ -- (parameters)
+
+ -- And subsequently either the appropriate code is added to codefix and the
+ -- ??? are removed, or it is determined that this is not an appropriate
+ -- case for codefix action, and the comment is removed.
+
------------------------------
-- Error Output Subprograms --
------------------------------
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 0ffbb453ade..db9e1d7784c 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,6 +35,7 @@ with Exp_Ch3; use Exp_Ch3;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Tss; use Exp_Tss;
+with Fname; use Fname;
with Freeze; use Freeze;
with Itypes; use Itypes;
with Lib; use Lib;
@@ -55,7 +56,6 @@ with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
@@ -506,7 +506,7 @@ package body Exp_Aggr is
-- 9. There cannot be any discriminated record components, since the
-- back end cannot handle this complex case.
- -- 10. No controlled actions need to be generated for components.
+ -- 10. No controlled actions need to be generated for components
function Backend_Processing_Possible (N : Node_Id) return Boolean is
Typ : constant Entity_Id := Etype (N);
@@ -622,7 +622,9 @@ package body Exp_Aggr is
-- with tagged components, but not clear whether it's worthwhile ???;
-- in the case of the JVM, object tags are handled implicitly)
- if Is_Tagged_Type (Component_Type (Typ)) and then VM_Target = No_VM then
+ if Is_Tagged_Type (Component_Type (Typ))
+ and then Tagged_Type_Expansion
+ then
return False;
end if;
@@ -1187,12 +1189,12 @@ package body Exp_Aggr is
Append_To (L, A);
-- Adjust the tag if tagged (because of possible view
- -- conversions), unless compiling for the Java VM where
+ -- conversions), unless compiling for a VM where
-- tags are implicit.
if Present (Comp_Type)
and then Is_Tagged_Type (Comp_Type)
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
A :=
Make_OK_Assignment_Statement (Loc,
@@ -2518,22 +2520,14 @@ package body Exp_Aggr is
Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
Set_Assignment_OK (Ref);
- if Has_Default_Init_Comps (N)
- or else Has_Task (Base_Type (Init_Typ))
- then
- Append_List_To (L,
- Build_Initialization_Call (Loc,
- Id_Ref => Ref,
- Typ => Init_Typ,
- In_Init_Proc => Within_Init_Proc,
- With_Default_Init => True));
- else
- Append_List_To (L,
- Build_Initialization_Call (Loc,
- Id_Ref => Ref,
- Typ => Init_Typ,
- In_Init_Proc => Within_Init_Proc));
- end if;
+ Append_List_To (L,
+ Build_Initialization_Call (Loc,
+ Id_Ref => Ref,
+ Typ => Init_Typ,
+ In_Init_Proc => Within_Init_Proc,
+ With_Default_Init => Has_Default_Init_Comps (N)
+ or else
+ Has_Task (Base_Type (Init_Typ))));
if Is_Constrained (Entity (A))
and then Has_Discriminants (Entity (A))
@@ -2541,6 +2535,21 @@ package body Exp_Aggr is
Check_Ancestor_Discriminants (Entity (A));
end if;
+ -- Handle calls to C++ constructors
+
+ elsif Is_CPP_Constructor_Call (A) then
+ Init_Typ := Etype (Etype (A));
+ Ref := Convert_To (Init_Typ, New_Copy_Tree (Target));
+ Set_Assignment_OK (Ref);
+
+ Append_List_To (L,
+ Build_Initialization_Call (Loc,
+ Id_Ref => Ref,
+ Typ => Init_Typ,
+ In_Init_Proc => Within_Init_Proc,
+ With_Default_Init => Has_Default_Init_Comps (N),
+ Constructor_Ref => A));
+
-- Ada 2005 (AI-287): If the ancestor part is an aggregate of
-- limited type, a recursive call expands the ancestor. Note that
-- in the limited case, the ancestor part must be either a
@@ -2611,7 +2620,7 @@ package body Exp_Aggr is
-- the subsequent deep_adjust works properly (unless VM_Target,
-- where tags are implicit).
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Instr :=
Make_OK_Assignment_Statement (Loc,
Name =>
@@ -2764,6 +2773,18 @@ package body Exp_Aggr is
end if;
end if;
+ -- For CPP types we generate an implicit call to the C++ default
+ -- constructor to ensure the proper initialization of the _Tag
+ -- component.
+
+ if Is_CPP_Class (Typ) then
+ pragma Assert (Present (Base_Init_Proc (Typ)));
+ Append_List_To (L,
+ Build_Initialization_Call (Loc,
+ Id_Ref => Lhs,
+ Typ => Typ));
+ end if;
+
-- Generate the assignments, component by component
-- tmp.comp1 := Expr1_From_Aggr;
@@ -2774,10 +2795,24 @@ package body Exp_Aggr is
while Present (Comp) loop
Selector := Entity (First (Choices (Comp)));
+ -- C++ constructors
+
+ if Is_CPP_Constructor_Call (Expression (Comp)) then
+ Append_List_To (L,
+ Build_Initialization_Call (Loc,
+ Id_Ref => Make_Selected_Component (Loc,
+ Prefix => New_Copy_Tree (Target),
+ Selector_Name => New_Occurrence_Of (Selector,
+ Loc)),
+ Typ => Etype (Selector),
+ Enclos_Type => Typ,
+ With_Default_Init => True,
+ Constructor_Ref => Expression (Comp)));
+
-- Ada 2005 (AI-287): For each default-initialized component generate
-- a call to the corresponding IP subprogram if available.
- if Box_Present (Comp)
+ elsif Box_Present (Comp)
and then Has_Non_Null_Base_Init_Proc (Etype (Selector))
then
if Ekind (Selector) /= E_Discriminant then
@@ -2821,12 +2856,9 @@ package body Exp_Aggr is
Enclos_Type => Typ,
With_Default_Init => True));
- goto Next_Comp;
- end if;
-
-- Prepare for component assignment
- if Ekind (Selector) /= E_Discriminant
+ elsif Ekind (Selector) /= E_Discriminant
or else Nkind (N) = N_Extension_Aggregate
then
-- All the discriminants have now been assigned
@@ -3001,7 +3033,9 @@ package body Exp_Aggr is
-- tmp.comp._tag := comp_typ'tag;
- if Is_Tagged_Type (Comp_Type) and then VM_Target = No_VM then
+ if Is_Tagged_Type (Comp_Type)
+ and then Tagged_Type_Expansion
+ then
Instr :=
Make_OK_Assignment_Statement (Loc,
Name =>
@@ -3106,8 +3140,6 @@ package body Exp_Aggr is
end;
end if;
- <<Next_Comp>>
-
Next (Comp);
end loop;
@@ -3119,7 +3151,14 @@ package body Exp_Aggr is
if Ancestor_Is_Expression then
null;
- elsif Is_Tagged_Type (Typ) and then VM_Target = No_VM then
+ -- For CPP types we generated a call to the C++ default constructor
+ -- before the components have been initialized to ensure the proper
+ -- initialization of the _Tag component (see above).
+
+ elsif Is_CPP_Class (Typ) then
+ null;
+
+ elsif Is_Tagged_Type (Typ) and then Tagged_Type_Expansion then
Instr :=
Make_OK_Assignment_Statement (Loc,
Name =>
@@ -3735,24 +3774,43 @@ package body Exp_Aggr is
-- Check for maximum others replication. Note that
-- we skip this test if either of the restrictions
-- No_Elaboration_Code or No_Implicit_Loops is
- -- active, or if this is a preelaborable unit.
+ -- active, if this is a preelaborable unit or a
+ -- predefined unit. This ensures that predefined
+ -- units get the same level of constant folding in
+ -- Ada 95 and Ada 05, where their categorization
+ -- has changed.
declare
P : constant Entity_Id :=
Cunit_Entity (Current_Sem_Unit);
begin
+ -- Check if duplication OK and if so continue
+ -- processing.
+
if Restriction_Active (No_Elaboration_Code)
or else Restriction_Active (No_Implicit_Loops)
or else Is_Preelaborated (P)
or else (Ekind (P) = E_Package_Body
and then
Is_Preelaborated (Spec_Entity (P)))
+ or else
+ Is_Predefined_File_Name
+ (Unit_File_Name (Get_Source_Unit (P)))
then
null;
+ -- If duplication not OK, then we return False
+ -- if the replication count is too high
+
elsif Rep_Count > Max_Others_Replicate then
return False;
+
+ -- Continue on if duplication not OK, but the
+ -- replication count is not excessive.
+
+ else
+ null;
end if;
end;
end if;
@@ -4989,7 +5047,7 @@ package body Exp_Aggr is
-- STEP 4
- -- Look if in place aggregate expansion is possible.
+ -- Look if in place aggregate expansion is possible
-- For object declarations we build the aggregate in place, unless
-- the array is bit-packed or the component is controlled.
@@ -5243,7 +5301,7 @@ package body Exp_Aggr is
else
Set_Etype (N, Typ);
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Expand_Record_Aggregate (N,
Orig_Tag =>
New_Occurrence_Of
@@ -5334,7 +5392,7 @@ package body Exp_Aggr is
or else (Is_Entity_Name (Expr_Q)
and then
Ekind (Entity (Expr_Q)) in Formal_Kind))
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
Static_Components := False;
return True;
@@ -5680,7 +5738,7 @@ package body Exp_Aggr is
if Present (Orig_Tag) then
Tag_Value := Orig_Tag;
- elsif VM_Target /= No_VM then
+ elsif not Tagged_Type_Expansion then
Tag_Value := Empty;
else
Tag_Value :=
@@ -5744,7 +5802,7 @@ package body Exp_Aggr is
-- For a root type, the tag component is added (unless compiling
-- for the VMs, where tags are implicit).
- elsif VM_Target = No_VM then
+ elsif Tagged_Type_Expansion then
declare
Tag_Name : constant Node_Id :=
New_Occurrence_Of
@@ -5846,7 +5904,7 @@ package body Exp_Aggr is
begin
return Static_Dispatch_Tables
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then RTU_Loaded (Ada_Tags)
-- Avoid circularity when rebuilding the compiler
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 5772d58487e..bdc3c53502e 100644
--- a/gcc/ada/exp_attr.adb
+++ b/gcc/ada/exp_attr.adb
@@ -1031,7 +1031,7 @@ package body Exp_Attr is
elsif Is_Class_Wide_Type (Ptyp)
and then Is_Interface (Ptyp)
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then not (Nkind (Pref) in N_Has_Entity
and then Is_Subprogram (Entity (Pref)))
then
@@ -1218,7 +1218,7 @@ package body Exp_Attr is
-- A reference to P'Body_Version or P'Version is expanded to
-- Vnn : Unsigned;
- -- pragma Import (C, Vnn, "uuuuT";
+ -- pragma Import (C, Vnn, "uuuuT");
-- ...
-- Get_Version_String (Vnn)
@@ -3118,7 +3118,7 @@ package body Exp_Attr is
-- accessibility check on virtual machines, so we omit it.
if Ada_Version >= Ada_05
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
Insert_Action (N,
Make_Implicit_If_Statement (N,
@@ -4355,7 +4355,7 @@ package body Exp_Attr is
-- For VMs we leave the type attribute unexpanded because
-- there's not a dispatching table to reference.
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Rewrite (N,
Unchecked_Convert_To (RTE (RE_Tag),
New_Reference_To
@@ -4380,7 +4380,7 @@ package body Exp_Attr is
-- Not needed for VM targets, since all handled by the VM
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Rewrite (N,
Make_Explicit_Dereference (Loc,
Unchecked_Convert_To (RTE (RE_Tag_Ptr),
@@ -5238,6 +5238,7 @@ package body Exp_Attr is
Attribute_Address_Size |
Attribute_Base |
Attribute_Class |
+ Attribute_Compiler_Version |
Attribute_Default_Bit_Order |
Attribute_Delta |
Attribute_Denorm |
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 8ffb6e0cead..4138dd01858 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1368,22 +1368,35 @@ package body Exp_Ch3 is
In_Init_Proc : Boolean := False;
Enclos_Type : Entity_Id := Empty;
Discr_Map : Elist_Id := New_Elmt_List;
- With_Default_Init : Boolean := False) return List_Id
+ With_Default_Init : Boolean := False;
+ Constructor_Ref : Node_Id := Empty) return List_Id
is
- First_Arg : Node_Id;
+ Res : constant List_Id := New_List;
+ Arg : Node_Id;
Args : List_Id;
- Decls : List_Id;
+ Controller_Typ : Entity_Id;
Decl : Node_Id;
+ Decls : List_Id;
Discr : Entity_Id;
- Arg : Node_Id;
- Proc : constant Entity_Id := Base_Init_Proc (Typ);
- Init_Type : constant Entity_Id := Etype (First_Formal (Proc));
- Full_Init_Type : constant Entity_Id := Underlying_Type (Init_Type);
- Res : constant List_Id := New_List;
+ First_Arg : Node_Id;
+ Full_Init_Type : Entity_Id;
Full_Type : Entity_Id := Typ;
- Controller_Typ : Entity_Id;
+ Init_Type : Entity_Id;
+ Proc : Entity_Id;
begin
+ pragma Assert (Constructor_Ref = Empty
+ or else Is_CPP_Constructor_Call (Constructor_Ref));
+
+ if No (Constructor_Ref) then
+ Proc := Base_Init_Proc (Typ);
+ else
+ Proc := Base_Init_Proc (Typ, Entity (Name (Constructor_Ref)));
+ end if;
+
+ Init_Type := Etype (First_Formal (Proc));
+ Full_Init_Type := Underlying_Type (Init_Type);
+
-- Nothing to do if the Init_Proc is null, unless Initialize_Scalars
-- is active (in which case we make the call anyway, since in the
-- actual compiled client it may be non null).
@@ -1579,6 +1592,10 @@ package body Exp_Ch3 is
and then Chars (Selector_Name (Id_Ref)) = Name_uParent
then
Append_To (Args, New_Occurrence_Of (Standard_False, Loc));
+
+ elsif Present (Constructor_Ref) then
+ Append_List_To (Args,
+ New_Copy_List (Parameter_Associations (Constructor_Ref)));
end if;
Append_To (Res,
@@ -1848,7 +1865,7 @@ package body Exp_Ch3 is
-- Suppress the tag adjustment when VM_Target because VM tags are
-- represented implicitly in objects.
- if Is_Tagged_Type (Typ) and then VM_Target = No_VM then
+ if Is_Tagged_Type (Typ) and then Tagged_Type_Expansion then
Append_To (Res,
Make_Assignment_Statement (Loc,
Name =>
@@ -1871,8 +1888,8 @@ package body Exp_Ch3 is
end if;
if Needs_Finalization (Typ)
- and then not (Kind = N_Aggregate or else Kind = N_Extension_Aggregate)
- and then not Is_Inherently_Limited_Type (Typ)
+ and then not (Nkind_In (Kind, N_Aggregate, N_Extension_Aggregate))
+ and then not Is_Inherently_Limited_Type (Typ)
then
Append_List_To (Res,
Make_Adjust_Call (
@@ -2142,7 +2159,7 @@ package body Exp_Ch3 is
if not Is_Tagged_Type (Rec_Type)
or else Etype (Rec_Type) = Rec_Type
or else not Has_Discriminants (Etype (Rec_Type))
- or else VM_Target /= No_VM
+ or else not Tagged_Type_Expansion
then
return;
end if;
@@ -2275,7 +2292,7 @@ package body Exp_Ch3 is
if Is_Tagged_Type (Rec_Type)
and then not Is_CPP_Class (Rec_Type)
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then not No_Run_Time_Mode
then
-- Initialize the primary tag
@@ -2589,7 +2606,21 @@ package body Exp_Ch3 is
-- Case of explicit initialization
if Present (Expression (Decl)) then
- Stmts := Build_Assignment (Id, Expression (Decl));
+ if Is_CPP_Constructor_Call (Expression (Decl)) then
+ Stmts :=
+ Build_Initialization_Call
+ (Loc,
+ Make_Selected_Component (Loc,
+ Prefix => Make_Identifier (Loc, Name_uInit),
+ Selector_Name => New_Occurrence_Of (Id, Loc)),
+ Typ,
+ In_Init_Proc => True,
+ Enclos_Type => Rec_Type,
+ Discr_Map => Discr_Map,
+ Constructor_Ref => Expression (Decl));
+ else
+ Stmts := Build_Assignment (Id, Expression (Decl));
+ end if;
-- Case of composite component with its own Init_Proc
@@ -4154,9 +4185,28 @@ package body Exp_Ch3 is
-- which case the init proc call must be inserted only after the bodies
-- of the shared variable procedures have been seen.
+ function Rewrite_As_Renaming return Boolean;
+ -- Indicate whether to rewrite a declaration with initialization into an
+ -- object renaming declaration (see below).
+
+ -------------------------
+ -- Rewrite_As_Renaming --
+ -------------------------
+
+ function Rewrite_As_Renaming return Boolean is
+ begin
+ return not Aliased_Present (N)
+ and then Is_Entity_Name (Expr_Q)
+ and then Ekind (Entity (Expr_Q)) = E_Variable
+ and then OK_To_Rename (Entity (Expr_Q))
+ and then Is_Entity_Name (Object_Definition (N));
+ end Rewrite_As_Renaming;
+
+ -- Start of processing for Expand_N_Object_Declaration
+
begin
- -- Don't do anything for deferred constants. All proper actions will
- -- be expanded during the full declaration.
+ -- Don't do anything for deferred constants. All proper actions will be
+ -- expanded during the full declaration.
if No (Expr) and Constant_Present (N) then
return;
@@ -4164,7 +4214,7 @@ package body Exp_Ch3 is
-- Force construction of dispatch tables of library level tagged types
- if VM_Target = No_VM
+ if Tagged_Type_Expansion
and then Static_Dispatch_Tables
and then Is_Library_Level_Entity (Def_Id)
and then Is_Library_Level_Tagged_Type (Base_Typ)
@@ -4473,7 +4523,7 @@ package body Exp_Ch3 is
or else
not Is_Ancestor (Root_Type (Typ), Etype (Expr)))
and then Comes_From_Source (Def_Id)
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
declare
Decl_1 : Node_Id;
@@ -4572,10 +4622,13 @@ package body Exp_Ch3 is
-- where the object was initialized by a call to a function whose
-- result is built in place, since no copy occurred. (Eventually
-- we plan to support in-place function results for some cases
- -- of nonlimited types. ???)
+ -- of nonlimited types. ???) Similarly, no adjustment is required
+ -- if we are going to rewrite the object declaration into a
+ -- renaming declaration.
if Needs_Finalization (Typ)
and then not Is_Inherently_Limited_Type (Typ)
+ and then not Rewrite_As_Renaming
then
Insert_Actions_After (Init_After,
Make_Adjust_Call (
@@ -4597,7 +4650,7 @@ package body Exp_Ch3 is
if Is_Tagged_Type (Typ)
and then not Is_Class_Wide_Type (Typ)
and then not Is_CPP_Class (Typ)
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then Nkind (Expr) /= N_Aggregate
then
-- The re-assignment of the tag has to be done even if the
@@ -4622,6 +4675,26 @@ package body Exp_Ch3 is
(Access_Disp_Table (Base_Type (Typ)))),
Loc))));
+ elsif Is_Tagged_Type (Typ)
+ and then Is_CPP_Constructor_Call (Expr)
+ then
+ -- The call to the initialization procedure does NOT freeze the
+ -- object being initialized.
+
+ Id_Ref := New_Reference_To (Def_Id, Loc);
+ Set_Must_Not_Freeze (Id_Ref);
+ Set_Assignment_OK (Id_Ref);
+
+ Insert_Actions_After (Init_After,
+ Build_Initialization_Call (Loc, Id_Ref, Typ,
+ Constructor_Ref => Expr));
+
+ -- We remove here the original call to the constructor
+ -- to avoid its management in the backend
+
+ Set_Expression (N, Empty);
+ return;
+
-- For discrete types, set the Is_Known_Valid flag if the
-- initializing value is known to be valid.
@@ -4699,14 +4772,9 @@ package body Exp_Ch3 is
-- X : typ renames expr
-- provided that X is not aliased. The aliased case has to be
- -- excluded in general because expr will not be aliased in general.
+ -- excluded in general because Expr will not be aliased in general.
- if not Aliased_Present (N)
- and then Is_Entity_Name (Expr_Q)
- and then Ekind (Entity (Expr_Q)) = E_Variable
- and then OK_To_Rename (Entity (Expr_Q))
- and then Is_Entity_Name (Object_Definition (N))
- then
+ if Rewrite_As_Renaming then
Rewrite (N,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Defining_Identifier (N),
@@ -5008,7 +5076,7 @@ package body Exp_Ch3 is
if Has_Task (Typ)
and then not Restriction_Active (No_Implicit_Heap_Allocations)
and then not Global_Discard_Names
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
Set_Uses_Sec_Stack (Proc_Id);
end if;
@@ -5629,11 +5697,11 @@ package body Exp_Ch3 is
if Is_CPP_Class (Def_Id) then
Set_All_DT_Position (Def_Id);
- Set_Default_Constructor (Def_Id);
+ Set_CPP_Constructors (Def_Id);
-- Create the tag entities with a minimum decoration
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Append_Freeze_Actions (Def_Id, Make_Tags (Def_Id));
end if;
@@ -5754,16 +5822,14 @@ package body Exp_Ch3 is
-- VM_Target because the dispatching mechanism is handled
-- internally by the VMs.
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Append_Freeze_Actions (Def_Id, Make_Tags (Def_Id));
-- Generate dispatch table of locally defined tagged type.
-- Dispatch tables of library level tagged types are built
-- later (see Analyze_Declarations).
- if VM_Target = No_VM
- and then not Has_Static_DT
- then
+ if not Has_Static_DT then
Append_Freeze_Actions (Def_Id, Make_DT (Def_Id));
end if;
end if;
@@ -5882,7 +5948,7 @@ package body Exp_Ch3 is
Adjust_Discriminants (Def_Id);
- if VM_Target = No_VM or else not Is_Interface (Def_Id) then
+ if Tagged_Type_Expansion or else not Is_Interface (Def_Id) then
-- Do not need init for interfaces on e.g. CIL since they're
-- abstract. Helps operation of peverify (the PE Verify tool).
@@ -7866,7 +7932,7 @@ package body Exp_Ch3 is
-- these bodies if No_Dispatching_Calls, Ravenscar or ZFP is active.
if Ada_Version >= Ada_05
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then not Restriction_Active (No_Dispatching_Calls)
and then not Restriction_Active (No_Select_Statements)
and then RTE_Available (RE_Select_Specific_Data)
@@ -8361,7 +8427,7 @@ package body Exp_Ch3 is
-- these bodies if No_Dispatching_Calls, Ravenscar or ZFP is active.
if Ada_Version >= Ada_05
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then not Is_Interface (Tag_Typ)
and then
((Is_Interface (Etype (Tag_Typ))
@@ -8634,7 +8700,14 @@ package body Exp_Ch3 is
-- If the type is not limited, or else is limited but the attribute is
-- explicitly specified or is predefined for the type, then return True,
-- unless other conditions prevail, such as restrictions prohibiting
- -- streams or dispatching operations.
+ -- streams or dispatching operations. We also return True for limited
+ -- interfaces, because they may be extended by nonlimited types and
+ -- permit inheritance in this case (addresses cases where an abstract
+ -- extension doesn't get 'Input declared, as per comments below, but
+ -- 'Class'Input must still be allowed). Note that attempts to apply
+ -- stream attributes to a limited interface or its class-wide type
+ -- (or limited extensions thereof) will still get properly rejected
+ -- by Check_Stream_Attribute.
-- We exclude the Input operation from being a predefined subprogram in
-- the case where the associated type is an abstract extension, because
@@ -8648,6 +8721,7 @@ package body Exp_Ch3 is
-- exception.
return (not Is_Limited_Type (Typ)
+ or else Is_Interface (Typ)
or else Has_Predefined_Or_Specified_Stream_Attribute)
and then (Operation /= TSS_Stream_Input
or else not Is_Abstract_Type (Typ)
diff --git a/gcc/ada/exp_ch3.ads b/gcc/ada/exp_ch3.ads
index d51724af3cd..6738ae958f9 100644
--- a/gcc/ada/exp_ch3.ads
+++ b/gcc/ada/exp_ch3.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -67,7 +67,8 @@ package Exp_Ch3 is
In_Init_Proc : Boolean := False;
Enclos_Type : Entity_Id := Empty;
Discr_Map : Elist_Id := New_Elmt_List;
- With_Default_Init : Boolean := False) return List_Id;
+ With_Default_Init : Boolean := False;
+ Constructor_Ref : Node_Id := Empty) return List_Id;
-- Builds a call to the initialization procedure for the base type of Typ,
-- passing it the object denoted by Id_Ref, plus additional parameters as
-- appropriate for the type (the _Master, for task types, for example).
@@ -88,6 +89,9 @@ package Exp_Ch3 is
-- Ada 2005 (AI-287): With_Default_Init is used to indicate that the
-- initialization call corresponds to a default initialized component
-- of an aggregate.
+ --
+ -- Constructor_Ref is a call to a constructor subprogram. It is currently
+ -- used only to support C++ constructors.
procedure Build_Master_Renaming (N : Node_Id; T : Entity_Id);
-- If the designated type of an access type is a task type or contains
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 5a7d713eaf5..6da8ff90e44 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -378,7 +378,7 @@ package body Exp_Ch4 is
-- Do nothing in case of VM targets: the virtual machine will handle
-- interfaces directly.
- if VM_Target /= No_VM then
+ if not Tagged_Type_Expansion then
return;
end if;
@@ -511,7 +511,7 @@ package body Exp_Ch4 is
-- there does not seem to be any practical way of implementing it.
if Ada_Version >= Ada_05
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then Is_Class_Wide_Type (DesigT)
and then not Scope_Suppress (Accessibility_Check)
and then
@@ -626,7 +626,7 @@ package body Exp_Ch4 is
if Is_Class_Wide_Type (Etype (Exp))
and then Is_Interface (Etype (Exp))
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
Set_Expression
(Expression (N),
@@ -795,7 +795,7 @@ package body Exp_Ch4 is
-- Suppress the tag assignment when VM_Target because VM tags are
-- represented implicitly in objects.
- if VM_Target /= No_VM then
+ if not Tagged_Type_Expansion then
null;
-- Ada 2005 (AI-251): Suppress the tag assignment with class-wide
@@ -3984,6 +3984,17 @@ package body Exp_Ch4 is
Name => New_Occurrence_Of (Cnn, Sloc (Elsex)),
Expression => Relocate_Node (Elsex))));
+ -- Move the SLOC of the parent If statement to the newly created
+ -- one and change it to the SLOC of the expression which, after
+ -- expansion, will correspond to what is being evaluated.
+
+ if Present (Parent (N))
+ and then Nkind (Parent (N)) = N_If_Statement
+ then
+ Set_Sloc (New_If, Sloc (Parent (N)));
+ Set_Sloc (Parent (N), Loc);
+ end if;
+
Set_Assignment_OK (Name (First (Then_Statements (New_If))));
Set_Assignment_OK (Name (First (Else_Statements (New_If))));
@@ -4291,7 +4302,7 @@ package body Exp_Ch4 is
-- are not explicitly represented in Java objects, so the
-- normal tagged membership expansion is not what we want).
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Rewrite (N, Tagged_Membership (N));
Analyze_And_Resolve (N, Rtyp);
end if;
@@ -7381,7 +7392,7 @@ package body Exp_Ch4 is
-- on such run-time unit.
and then
- (VM_Target /= No_VM
+ (not Tagged_Type_Expansion
or else not
(RTU_Loaded (Ada_Tags)
and then Nkind (Prefix (N)) = N_Selected_Component
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index c77ff0595bf..4cc66304ec9 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -4075,7 +4075,7 @@ package body Exp_Ch5 is
-- does not seem to be any practical way to implement this check.
elsif Ada_Version >= Ada_05
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then Is_Class_Wide_Type (R_Type)
and then not Scope_Suppress (Accessibility_Check)
and then
@@ -4285,7 +4285,7 @@ package body Exp_Ch5 is
Save_Tag : constant Boolean := Is_Tagged_Type (T)
and then not No_Ctrl_Actions (N)
- and then VM_Target = No_VM;
+ and then Tagged_Type_Expansion;
-- Tags are not saved and restored when VM_Target because VM tags are
-- represented implicitly in objects.
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 2ea49a3c4af..1da82bafd03 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -68,7 +68,6 @@ with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Validsw; use Validsw;
@@ -2574,7 +2573,7 @@ package body Exp_Ch6 is
if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement)
and then Present (Controlling_Argument (N))
then
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Expand_Dispatching_Call (N);
-- The following return is worrisome. Is it really OK to
@@ -4820,7 +4819,7 @@ package body Exp_Ch6 is
and then not Is_Abstract_Subprogram (Subp)
and then Present (DTC_Entity (Subp))
and then Present (Scope (DTC_Entity (Subp)))
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
and then not Restriction_Active (No_Dispatching_Calls)
and then RTE_Available (RE_Tag)
then
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index ea05b24b264..03f0909e7cb 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -442,6 +442,40 @@ package body Exp_Ch7 is
New_Reference_To
(RTE (RE_List_Controller), Loc));
+ if Has_Completion_In_Body (Directly_Designated_Type (Typ))
+ and then In_Package_Body (Current_Scope)
+ and then Nkind (Unit (Cunit (Current_Sem_Unit))) = N_Package_Body
+ and then
+ Nkind (Parent (Declaration_Node (Typ))) = N_Package_Specification
+ then
+ -- The type is declared in a package declaration and designates a
+ -- Taft amendment type that requires finalization. In general we
+ -- assume that TA types are controlled, but we inhibit this
+ -- worst-case assumption for runtime files, for efficiency reasons
+ -- (see exp_ch3.adb). The reference to RE_List_Controller may have
+ -- added a with_clause to the current body. Formally the spec needs
+ -- the with_clause as well, so we add it now, for use by Codepeer.
+ -- We verify that we are within a package body, because this code
+ -- can also be invoked within a package instantiation.
+
+ declare
+ Loc : constant Source_Ptr := Sloc (Typ);
+ Spec_Unit : constant Node_Id :=
+ Library_Unit (Cunit (Current_Sem_Unit));
+ List_Scope : constant Entity_Id :=
+ Scope (RTE (RE_List_Controller));
+ With_Clause : constant Node_Id :=
+ Make_With_Clause (Loc,
+ Name => New_Occurrence_Of (List_Scope, Loc));
+ begin
+ Set_Library_Unit
+ (With_Clause, Parent (Unit_Declaration_Node (List_Scope)));
+ Set_Corresponding_Spec (With_Clause, List_Scope);
+ Set_Implicit_With (With_Clause);
+ Append (With_Clause, Context_Items (Spec_Unit));
+ end;
+ end if;
+
-- The type may have been frozen already, and this is a late freezing
-- action, in which case the declaration must be elaborated at once.
-- If the call is for an allocator, the chain must also be created now,
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index f784e54ef3a..ddaa632f0ba 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1599,7 +1599,7 @@ package body Exp_Ch9 is
Body_Spec : Node_Id;
begin
- Body_Spec := Build_Wrapper_Spec (Loc, Subp_Id, Obj_Typ, Formals);
+ Body_Spec := Build_Wrapper_Spec (Subp_Id, Obj_Typ, Formals);
-- The subprogram is not overriding or is not a primitive declared
-- between two views.
@@ -1776,11 +1776,11 @@ package body Exp_Ch9 is
------------------------
function Build_Wrapper_Spec
- (Loc : Source_Ptr;
- Subp_Id : Entity_Id;
+ (Subp_Id : Entity_Id;
Obj_Typ : Entity_Id;
Formals : List_Id) return Node_Id
is
+ Loc : constant Source_Ptr := Sloc (Subp_Id);
First_Param : Node_Id;
Iface : Entity_Id;
Iface_Elmt : Elmt_Id;
@@ -2147,18 +2147,18 @@ package body Exp_Ch9 is
and then Ekind (Defining_Identifier (Decl)) = E_Entry
then
Wrap_Spec :=
- Build_Wrapper_Spec (Loc,
- Subp_Id => Defining_Identifier (Decl),
- Obj_Typ => Rec_Typ,
- Formals => Parameter_Specifications (Decl));
+ Build_Wrapper_Spec
+ (Subp_Id => Defining_Identifier (Decl),
+ Obj_Typ => Rec_Typ,
+ Formals => Parameter_Specifications (Decl));
elsif Nkind (Decl) = N_Subprogram_Declaration then
Wrap_Spec :=
- Build_Wrapper_Spec (Loc,
- Subp_Id => Defining_Unit_Name (Specification (Decl)),
- Obj_Typ => Rec_Typ,
- Formals =>
- Parameter_Specifications (Specification (Decl)));
+ Build_Wrapper_Spec
+ (Subp_Id => Defining_Unit_Name (Specification (Decl)),
+ Obj_Typ => Rec_Typ,
+ Formals =>
+ Parameter_Specifications (Specification (Decl)));
end if;
if Present (Wrap_Spec) then
diff --git a/gcc/ada/exp_ch9.ads b/gcc/ada/exp_ch9.ads
index 1cfa74d3635..8e795e12c0f 100644
--- a/gcc/ada/exp_ch9.ads
+++ b/gcc/ada/exp_ch9.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -154,8 +154,7 @@ package Exp_Ch9 is
-- Build_Task_Allocate_Block.
function Build_Wrapper_Spec
- (Loc : Source_Ptr;
- Subp_Id : Entity_Id;
+ (Subp_Id : Entity_Id;
Obj_Typ : Entity_Id;
Formals : List_Id) return Node_Id;
-- Ada 2005 (AI-345): Build the specification of a primitive operation
@@ -203,7 +202,9 @@ package Exp_Ch9 is
-- routine to make sure Complete_Master is called on exit).
procedure Expand_Access_Protected_Subprogram_Type (N : Node_Id);
- -- Build Equivalent_Type for an Access_to_protected_Subprogram
+ -- Build Equivalent_Type for an Access_To_Protected_Subprogram.
+ -- Equivalent_Type is a record type with two components: a pointer
+ -- to the protected object, and a pointer to the operation itself.
procedure Expand_Accept_Declarations (N : Node_Id; Ent : Entity_Id);
-- Expand declarations required for accept statement. See bodies of
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index 7df45501536..977a90fc4a7 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -59,7 +59,6 @@ with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
@@ -249,7 +248,7 @@ package body Exp_Disp is
begin
if not Expander_Active
- or else VM_Target /= No_VM
+ or else not Tagged_Type_Expansion
then
return;
end if;
@@ -806,7 +805,7 @@ package body Exp_Disp is
or else (not Is_Class_Wide_Type (Iface_Typ)
and then Is_Interface (Iface_Typ)));
- if VM_Target /= No_VM then
+ if not Tagged_Type_Expansion then
-- For VM, just do a conversion ???
@@ -6965,57 +6964,76 @@ package body Exp_Disp is
end if;
end Set_All_DT_Position;
- -----------------------------
- -- Set_Default_Constructor --
- -----------------------------
+ --------------------------
+ -- Set_CPP_Constructors --
+ --------------------------
- procedure Set_Default_Constructor (Typ : Entity_Id) is
+ procedure Set_CPP_Constructors (Typ : Entity_Id) is
Loc : Source_Ptr;
Init : Entity_Id;
- Param : Entity_Id;
E : Entity_Id;
+ Found : Boolean := False;
+ P : Node_Id;
+ Parms : List_Id;
begin
- -- Look for the default constructor entity. For now only the
- -- default constructor has the flag Is_Constructor.
+ -- Look for the constructor entities
E := Next_Entity (Typ);
- while Present (E)
- and then (Ekind (E) /= E_Function or else not Is_Constructor (E))
- loop
+ while Present (E) loop
+ if Ekind (E) = E_Function
+ and then Is_Constructor (E)
+ then
+ -- Create the init procedure
+
+ Found := True;
+ Loc := Sloc (E);
+ Init := Make_Defining_Identifier (Loc, Make_Init_Proc_Name (Typ));
+ Parms :=
+ New_List (
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Name_X),
+ Parameter_Type =>
+ New_Reference_To (Typ, Loc)));
+
+ if Present (Parameter_Specifications (Parent (E))) then
+ P := First (Parameter_Specifications (Parent (E)));
+ while Present (P) loop
+ Append_To (Parms,
+ Make_Parameter_Specification (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc,
+ Chars (Defining_Identifier (P))),
+ Parameter_Type => New_Copy_Tree (Parameter_Type (P))));
+ Next (P);
+ end loop;
+ end if;
+
+ Discard_Node (
+ Make_Subprogram_Declaration (Loc,
+ Make_Procedure_Specification (Loc,
+ Defining_Unit_Name => Init,
+ Parameter_Specifications => Parms)));
+
+ Set_Init_Proc (Typ, Init);
+ Set_Is_Imported (Init);
+ Set_Interface_Name (Init, Interface_Name (E));
+ Set_Convention (Init, Convention_C);
+ Set_Is_Public (Init);
+ Set_Has_Completion (Init);
+ end if;
+
Next_Entity (E);
end loop;
- -- Create the init procedure
-
- if Present (E) then
- Loc := Sloc (E);
- Init := Make_Defining_Identifier (Loc, Make_Init_Proc_Name (Typ));
- Param := Make_Defining_Identifier (Loc, Name_X);
-
- Discard_Node (
- Make_Subprogram_Declaration (Loc,
- Make_Procedure_Specification (Loc,
- Defining_Unit_Name => Init,
- Parameter_Specifications => New_List (
- Make_Parameter_Specification (Loc,
- Defining_Identifier => Param,
- Parameter_Type => New_Reference_To (Typ, Loc))))));
-
- Set_Init_Proc (Typ, Init);
- Set_Is_Imported (Init);
- Set_Interface_Name (Init, Interface_Name (E));
- Set_Convention (Init, Convention_C);
- Set_Is_Public (Init);
- Set_Has_Completion (Init);
-
-- If there are no constructors, mark the type as abstract since we
-- won't be able to declare objects of that type.
- else
+ if not Found then
Set_Is_Abstract_Type (Typ);
end if;
- end Set_Default_Constructor;
+ end Set_CPP_Constructors;
--------------------------
-- Set_DTC_Entity_Value --
diff --git a/gcc/ada/exp_disp.ads b/gcc/ada/exp_disp.ads
index ed866695246..c91798f2450 100644
--- a/gcc/ada/exp_disp.ads
+++ b/gcc/ada/exp_disp.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -328,10 +328,13 @@ package Exp_Disp is
-- Class case check that no pragma CPP_Virtual is missing and that the
-- DT_Position are coherent
- procedure Set_Default_Constructor (Typ : Entity_Id);
- -- Typ is a CPP_Class type. Create the Init procedure of that type to
- -- be the default constructor (i.e. the function returning this type,
- -- having a pragma CPP_Constructor and no parameter)
+ procedure Set_CPP_Constructors (Typ : Entity_Id);
+ -- Typ is a CPP_Class type. Create the Init procedures of that type
+ -- required to handle its default and non-default constructors. The
+ -- functions to which pragma CPP_Constructor is applied in the sources
+ -- are functions returning this type, and having an implicit access to the
+ -- target object in its first argument; such implicit argument is explicit
+ -- in the IP procedures built here.
procedure Set_DTC_Entity_Value
(Tagged_Type : Entity_Id;
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index 04a2187c8ce..75b400d2644 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -6630,13 +6630,13 @@ package body Exp_Dist is
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of
- (RTE (RE_TA_String), Loc),
+ (RTE (RE_TA_Std_String), Loc),
Parameter_Associations => New_List (
Make_String_Literal (Loc, Name_String))),
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of
- (RTE (RE_TA_String), Loc),
+ (RTE (RE_TA_Std_String), Loc),
Parameter_Associations => New_List (
Make_String_Literal (Loc,
Strval => Repo_Id_String))))))))))));
@@ -8465,7 +8465,7 @@ package body Exp_Dist is
elsif U_Type = RTE (RE_Long_Long_Unsigned) then
Lib_RE := RE_FA_LLU;
- elsif U_Type = Standard_String then
+ elsif Is_RTE (U_Type, RE_Unbounded_String) then
Lib_RE := RE_FA_String;
-- Special DSA types
@@ -8970,7 +8970,11 @@ package body Exp_Dist is
for J in 1 .. Ndim loop
Lnam := New_External_Name ('L', J);
Hnam := New_External_Name ('H', J);
- Indt := Etype (Indx);
+
+ -- Note, for empty arrays bounds may be out of
+ -- the range of Etype (Indx).
+
+ Indt := Base_Type (Etype (Indx));
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -9288,6 +9292,7 @@ package body Exp_Dist is
Typ : Entity_Id := Etype (N);
U_Type : Entity_Id;
+ C_Type : Entity_Id;
Fnam : Entity_Id := Empty;
Lib_RE : RE_Id := RE_Null;
@@ -9383,7 +9388,7 @@ package body Exp_Dist is
elsif U_Type = RTE (RE_Long_Long_Unsigned) then
Lib_RE := RE_TA_LLU;
- elsif U_Type = Standard_String then
+ elsif Is_RTE (U_Type, RE_Unbounded_String) then
Lib_RE := RE_TA_String;
-- Special DSA types
@@ -9416,11 +9421,23 @@ package body Exp_Dist is
Fnam := RTE (Lib_RE);
end if;
+ -- If Fnam is already analyzed, find the proper expected type,
+ -- else we have a newly constructed To_Any function and we know
+ -- that the expected type of its parameter is U_Type.
+
+ if Ekind (Fnam) = E_Function
+ and then Present (First_Formal (Fnam))
+ then
+ C_Type := Etype (First_Formal (Fnam));
+ else
+ C_Type := U_Type;
+ end if;
+
return
Make_Function_Call (Loc,
Name => New_Occurrence_Of (Fnam, Loc),
Parameter_Associations =>
- New_List (Unchecked_Convert_To (U_Type, N)));
+ New_List (OK_Convert_To (C_Type, N)));
end Build_To_Any_Call;
---------------------------
@@ -10153,7 +10170,7 @@ package body Exp_Dist is
elsif U_Type = RTE (RE_Long_Long_Unsigned) then
Lib_RE := RE_TC_LLU;
- elsif U_Type = Standard_String then
+ elsif Is_RTE (U_Type, RE_Unbounded_String) then
Lib_RE := RE_TC_String;
-- Special DSA types
@@ -10253,7 +10270,7 @@ package body Exp_Dist is
begin
Append_To (Parameter_List,
Make_Function_Call (Loc,
- Name => New_Occurrence_Of (RTE (RE_TA_String), Loc),
+ Name => New_Occurrence_Of (RTE (RE_TA_Std_String), Loc),
Parameter_Associations => New_List (
Make_String_Literal (Loc, S))));
end Add_String_Parameter;
diff --git a/gcc/ada/exp_dist.ads b/gcc/ada/exp_dist.ads
index 26995a8b9f9..d6fc1bb8ead 100644
--- a/gcc/ada/exp_dist.ads
+++ b/gcc/ada/exp_dist.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,7 @@ package Exp_Dist is
PCS_Version_Number : constant array (PCS_Names) of Int :=
(Name_No_DSA => 1,
Name_GARLIC_DSA => 1,
- Name_PolyORB_DSA => 2);
+ Name_PolyORB_DSA => 3);
-- PCS interface version. This is used to check for consistency between the
-- compiler used to generate distribution stubs and the PCS implementation.
-- It must be incremented whenever a change is made to the generated code
diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index d3f9334a607..b35c35ea9df 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -39,6 +39,7 @@ with Freeze; use Freeze;
with Namet; use Namet;
with Nmake; use Nmake;
with Nlists; use Nlists;
+with Opt; use Opt;
with Restrict; use Restrict;
with Rident; use Rident;
with Rtsfind; use Rtsfind;
@@ -52,7 +53,6 @@ with Sinput; use Sinput;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Urealp; use Urealp;
@@ -219,7 +219,7 @@ package body Exp_Intr is
-- checks are suppressed for the result type or VM_Target /= No_VM
if Tag_Checks_Suppressed (Etype (Result_Typ))
- or else VM_Target /= No_VM
+ or else not Tagged_Type_Expansion
then
null;
@@ -1034,7 +1034,7 @@ package body Exp_Intr is
-- free (Base_Address (Obj_Ptr))
if Is_Interface (Directly_Designated_Type (Typ))
- and then VM_Target = No_VM
+ and then Tagged_Type_Expansion
then
Set_Expression (Free_Node,
Unchecked_Convert_To (Typ,
diff --git a/gcc/ada/exp_tss.adb b/gcc/ada/exp_tss.adb
index b350644c24e..902d4e7b593 100644
--- a/gcc/ada/exp_tss.adb
+++ b/gcc/ada/exp_tss.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -27,6 +27,7 @@ with Atree; use Atree;
with Einfo; use Einfo;
with Elists; use Elists;
with Exp_Util; use Exp_Util;
+with Nlists; use Nlists;
with Lib; use Lib;
with Restrict; use Restrict;
with Rident; use Rident;
@@ -40,7 +41,10 @@ package body Exp_Tss is
-- Base_Init_Proc --
--------------------
- function Base_Init_Proc (Typ : Entity_Id) return Entity_Id is
+ function Base_Init_Proc
+ (Typ : Entity_Id;
+ Ref : Entity_Id := Empty) return Entity_Id
+ is
Full_Type : E;
Proc : Entity_Id;
@@ -55,6 +59,7 @@ package body Exp_Tss is
if No (Full_Type) then
return Empty;
+
elsif Is_Concurrent_Type (Full_Type)
and then Present (Corresponding_Record_Type (Base_Type (Full_Type)))
then
@@ -63,16 +68,17 @@ package body Exp_Tss is
-- and possibly an itype.
return Init_Proc
- (Base_Type (Corresponding_Record_Type (Base_Type (Full_Type))));
+ (Base_Type (Corresponding_Record_Type (Base_Type (Full_Type))),
+ Ref);
else
- Proc := Init_Proc (Base_Type (Full_Type));
+ Proc := Init_Proc (Base_Type (Full_Type), Ref);
if No (Proc)
and then Is_Composite_Type (Full_Type)
and then Is_Derived_Type (Full_Type)
then
- return Init_Proc (Root_Type (Full_Type));
+ return Init_Proc (Root_Type (Full_Type), Ref);
else
return Proc;
end if;
@@ -183,9 +189,14 @@ package body Exp_Tss is
-- Init_Proc --
---------------
- function Init_Proc (Typ : Entity_Id) return Entity_Id is
+ function Init_Proc
+ (Typ : Entity_Id;
+ Ref : Entity_Id := Empty) return Entity_Id
+ is
FN : constant Node_Id := Freeze_Node (Typ);
Elmt : Elmt_Id;
+ E1 : Entity_Id;
+ E2 : Entity_Id;
begin
if No (FN) then
@@ -194,11 +205,57 @@ package body Exp_Tss is
elsif No (TSS_Elist (FN)) then
return Empty;
- else
+ elsif No (Ref) then
Elmt := First_Elmt (TSS_Elist (FN));
while Present (Elmt) loop
if Is_Init_Proc (Node (Elmt)) then
- return Node (Elmt);
+ if not Is_CPP_Class (Typ) then
+ return Node (Elmt);
+
+ -- In case of CPP classes we are searching here for the
+ -- default constructor and hence we must skip non-default
+ -- constructors (if any)
+
+ elsif
+ No (Next
+ (First
+ (Parameter_Specifications (Parent (Node (Elmt))))))
+ then
+ return Node (Elmt);
+ end if;
+ end if;
+
+ Next_Elmt (Elmt);
+ end loop;
+
+ -- Non-default constructors are currently supported only in the
+ -- context of interfacing with C++
+
+ else pragma Assert (Is_CPP_Class (Typ));
+
+ -- Use the referenced function to locate the IP procedure that
+ -- corresponds with the C++ constructor
+
+ Elmt := First_Elmt (TSS_Elist (FN));
+ while Present (Elmt) loop
+ if Is_Init_Proc (Node (Elmt)) then
+ E1 := Next_Formal (First_Formal (Node (Elmt)));
+ E2 := First_Formal (Ref);
+ while Present (E1) and then Present (E2) loop
+ if Chars (E1) /= Chars (E2)
+ or else Ekind (E1) /= Ekind (E2)
+ or else Etype (E1) /= Etype (E2)
+ then
+ exit;
+ end if;
+
+ E1 := Next_Formal (E1);
+ E2 := Next_Formal (E2);
+ end loop;
+
+ if No (E1) and then No (E2) then
+ return Node (Elmt);
+ end if;
end if;
Next_Elmt (Elmt);
diff --git a/gcc/ada/exp_tss.ads b/gcc/ada/exp_tss.ads
index e72e38cc2c0..b81199ccf29 100644
--- a/gcc/ada/exp_tss.ads
+++ b/gcc/ada/exp_tss.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -187,8 +187,9 @@ package Exp_Tss is
-- used to initially install a TSS in the case where the subprogram for the
-- TSS has already been created and its declaration processed.
- function Init_Proc (Typ : Entity_Id) return Entity_Id;
- pragma Inline (Init_Proc);
+ function Init_Proc
+ (Typ : Entity_Id;
+ Ref : Entity_Id := Empty) return Entity_Id;
-- Obtains the _init TSS entry for the given type. This function call is
-- equivalent to TSS (Typ, Name_uInit). The _init TSS is the procedure
-- used to initialize otherwise uninitialized instances of a type. If
@@ -198,14 +199,21 @@ package Exp_Tss is
-- the corresponding base type (see Base_Init_Proc function). A special
-- case arises for concurrent types. Such types do not themselves have an
-- init proc TSS, but initialization is required. The init proc used is
- -- the one for the corresponding record type (see Base_Init_Proc).
+ -- the one for the corresponding record type (see Base_Init_Proc). If
+ -- Ref is present it is call to a subprogram whose profile matches the
+ -- profile of the required constructor (this argument is used to handle
+ -- non-default CPP constructors).
- function Base_Init_Proc (Typ : Entity_Id) return Entity_Id;
+ function Base_Init_Proc
+ (Typ : Entity_Id;
+ Ref : Entity_Id := Empty) return Entity_Id;
-- Obtains the _Init TSS entry from the base type of the entity, and also
-- deals with going indirect through the Corresponding_Record_Type field
-- for concurrent objects (which are initialized with the initialization
- -- routine for the corresponding record type). Returns Empty if there is
- -- no _Init TSS entry for the base type.
+ -- routine for the corresponding record type). Returns Empty if there is no
+ -- _Init TSS entry for the base type. If Ref is present it is a call to a
+ -- subprogram whose profile matches the profile of the required constructor
+ -- (this argument is used to handle non-default CPP constructors).
procedure Set_Init_Proc (Typ : Entity_Id; Init : Entity_Id);
pragma Inline (Set_Init_Proc);
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 8e5479738c8..1fe6526c77d 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -3880,7 +3880,7 @@ package body Exp_Util is
-- initialization itself (and doesn't need or want the
-- additional intermediate type to handle the assignment).
- if Expander_Active and then VM_Target = No_VM then
+ if Expander_Active and then Tagged_Type_Expansion then
EQ_Typ := Make_CW_Equivalent_Type (Unc_Typ, E);
end if;
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 7866432844e..1f91db98388 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -1,4 +1,4 @@
------------------------------------------------------------------------------
+------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
@@ -36,7 +36,6 @@ with Exp_Pakd; use Exp_Pakd;
with Exp_Util; use Exp_Util;
with Exp_Tss; use Exp_Tss;
with Layout; use Layout;
-with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
with Nlists; use Nlists;
with Nmake; use Nmake;
@@ -135,10 +134,6 @@ package body Freeze is
-- the designated type. Otherwise freezing the access type does not freeze
-- the designated type.
- procedure Generate_Prim_Op_References (Typ : Entity_Id);
- -- For a tagged type, generate implicit references to its primitive
- -- operations, for source navigation.
-
procedure Process_Default_Expressions
(E : Entity_Id;
After : in out Node_Id);
@@ -1550,7 +1545,16 @@ package body Freeze is
Placed_Component : Boolean := False;
-- Set True if we find at least one component with a component
- -- clause (used to warn about useless Bit_Order pragmas).
+ -- clause (used to warn about useless Bit_Order pragmas, and also
+ -- to detect cases where Implicit_Packing may have an effect).
+
+ All_Scalar_Components : Boolean := True;
+ -- Set False if we encounter a component of a non-scalar type
+
+ Scalar_Component_Total_RM_Size : Uint := Uint_0;
+ Scalar_Component_Total_Esize : Uint := Uint_0;
+ -- Accumulates total RM_Size values and total Esize values of all
+ -- scalar components. Used for processing of Implicit_Packing.
function Check_Allocator (N : Node_Id) return Node_Id;
-- If N is an allocator, possibly wrapped in one or more level of
@@ -1860,6 +1864,17 @@ package body Freeze is
end;
end if;
+ -- Gather data for possible Implicit_Packing later
+
+ if not Is_Scalar_Type (Etype (Comp)) then
+ All_Scalar_Components := False;
+ else
+ Scalar_Component_Total_RM_Size :=
+ Scalar_Component_Total_RM_Size + RM_Size (Etype (Comp));
+ Scalar_Component_Total_Esize :=
+ Scalar_Component_Total_Esize + Esize (Etype (Comp));
+ end if;
+
-- If the component is an Itype with Delayed_Freeze and is either
-- a record or array subtype and its base type has not yet been
-- frozen, we must remove this from the entity list of this
@@ -2066,7 +2081,7 @@ package body Freeze is
-- Finally, enforce the restriction that access attributes with a
-- current instance prefix can only apply to limited types.
- if Ekind (Rec) = E_Record_Type then
+ if Ekind (Rec) = E_Record_Type then
if Present (Corresponding_Remote_Type (Rec)) then
Freeze_And_Append
(Corresponding_Remote_Type (Rec), Loc, Result);
@@ -2168,6 +2183,36 @@ package body Freeze is
end if;
end;
end if;
+
+ -- See if Implicit_Packing would work
+
+ if not Is_Packed (Rec)
+ and then not Placed_Component
+ and then Has_Size_Clause (Rec)
+ and then All_Scalar_Components
+ and then not Has_Discriminants (Rec)
+ and then Esize (Rec) < Scalar_Component_Total_Esize
+ and then Esize (Rec) >= Scalar_Component_Total_RM_Size
+ then
+ -- If implicit packing enabled, do it
+
+ if Implicit_Packing then
+ Set_Is_Packed (Rec);
+
+ -- Otherwise flag the size clause
+
+ else
+ declare
+ Sz : constant Node_Id := Size_Clause (Rec);
+ begin
+ Error_Msg_NE
+ ("size given for& too small", Sz, Rec);
+ Error_Msg_N
+ ("\use explicit pragma Pack "
+ & "or use pragma Implicit_Packing", Sz);
+ end;
+ end if;
+ end if;
end Freeze_Record_Type;
-- Start of processing for Freeze_Entity
@@ -2583,29 +2628,10 @@ package body Freeze is
-- Here for other than a subprogram or type
else
- -- For a generic package, freeze types within, so that proper
- -- cross-reference information is generated for tagged types.
- -- This is the only freeze processing needed for generic packages.
-
- if Ekind (E) = E_Generic_Package then
- declare
- T : Entity_Id;
-
- begin
- T := First_Entity (E);
- while Present (T) loop
- if Is_Type (T) then
- Generate_Prim_Op_References (T);
- end if;
-
- Next_Entity (T);
- end loop;
- end;
-
-- If entity has a type, and it is not a generic unit, then
-- freeze it first (RM 13.14(10)).
- elsif Present (Etype (E))
+ if Present (Etype (E))
and then Ekind (E) /= E_Generic_Function
then
Freeze_And_Append (Etype (E), Loc, Result);
@@ -2873,7 +2899,7 @@ package body Freeze is
and then Rsiz mod System_Storage_Unit /= 0
then
-- For implicit packing mode, just set the
- -- component size silently
+ -- component size silently.
if Implicit_Packing then
Set_Component_Size (Btyp, Rsiz);
@@ -3269,7 +3295,7 @@ package body Freeze is
-- later when the full type is frozen).
elsif Ekind (E) = E_Record_Type
- or else Ekind (E) = E_Record_Subtype
+ or else Ekind (E) = E_Record_Subtype
then
Freeze_Record_Type (E);
@@ -3287,7 +3313,6 @@ package body Freeze is
end if;
Comp := First_Entity (E);
-
while Present (Comp) loop
if Is_Type (Comp) then
Freeze_And_Append (Comp, Loc, Result);
@@ -3598,10 +3623,6 @@ package body Freeze is
end if;
end if;
- -- Generate references to primitive operations for a tagged type
-
- Generate_Prim_Op_References (E);
-
-- Now that all types from which E may depend are frozen, see if the
-- size is known at compile time, if it must be unsigned, or if
-- strict alignment is required
@@ -5145,72 +5166,6 @@ package body Freeze is
end Is_Fully_Defined;
---------------------------------
- -- Generate_Prim_Op_References --
- ---------------------------------
-
- procedure Generate_Prim_Op_References (Typ : Entity_Id) is
- Base_T : Entity_Id;
- Prim : Elmt_Id;
- Prim_List : Elist_Id;
- Ent : Entity_Id;
-
- begin
- -- Handle subtypes of synchronized types
-
- if Ekind (Typ) = E_Protected_Subtype
- or else Ekind (Typ) = E_Task_Subtype
- then
- Base_T := Etype (Typ);
- else
- Base_T := Typ;
- end if;
-
- -- References to primitive operations are only relevant for tagged types
-
- if not Is_Tagged_Type (Base_T)
- or else Is_Class_Wide_Type (Base_T)
- then
- return;
- end if;
-
- -- Ada 2005 (AI-345): For synchronized types generate reference
- -- to the wrapper that allow us to dispatch calls through their
- -- implemented abstract interface types.
-
- -- The check for Present here is to protect against previously
- -- reported critical errors.
-
- if Is_Concurrent_Type (Base_T)
- and then Present (Corresponding_Record_Type (Base_T))
- then
- Prim_List := Primitive_Operations
- (Corresponding_Record_Type (Base_T));
- else
- Prim_List := Primitive_Operations (Base_T);
- end if;
-
- if No (Prim_List) then
- return;
- end if;
-
- Prim := First_Elmt (Prim_List);
- while Present (Prim) loop
-
- -- If the operation is derived, get the original for cross-reference
- -- reference purposes (it is the original for which we want the xref
- -- and for which the comes_from_source test must be performed).
-
- Ent := Node (Prim);
- while Present (Alias (Ent)) loop
- Ent := Alias (Ent);
- end loop;
-
- Generate_Reference (Typ, Ent, 'p', Set_Ref => False);
- Next_Elmt (Prim);
- end loop;
- end Generate_Prim_Op_References;
-
- ---------------------------------
-- Process_Default_Expressions --
---------------------------------
diff --git a/gcc/ada/g-comlin.ads b/gcc/ada/g-comlin.ads
index 1f393afd042..57a68c2ab2f 100644
--- a/gcc/ada/g-comlin.ads
+++ b/gcc/ada/g-comlin.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2008, AdaCore --
+-- Copyright (C) 1999-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -96,13 +96,13 @@
-- Goto_Section ("bargs");
-- loop
-- -- Same loop as above to get switches and arguments
--- -- The supported switches in Get_Opt might be different
+-- -- The supported switches in Getopt might be different
-- end loop;
-- Goto_Section ("cargs");
-- loop
-- -- Same loop as above to get switches and arguments
--- -- The supported switches in Get_Opt might be different
+-- -- The supported switches in Getopt might be different
-- end loop;
-- end;
@@ -112,6 +112,7 @@
-- contexts, either because your system does not support Ada.Command_Line, or
-- because you are manipulating other tools and creating their command line by
-- hand, or for any other reason.
+
-- To create the list of strings, it is recommended to use
-- GNAT.OS_Lib.Argument_String_To_List.
@@ -125,7 +126,7 @@
-- GNAT.OS_Lib.Argument_String_To_List ("-g -O1 -Ipath");
-- begin
-- Initialize_Option_Scan (Parser, Args);
--- while Get_Opt ("* g O! I=", Parser) /= ASCII.NUL loop
+-- while Getopt ("* g O! I=", Parser) /= ASCII.NUL loop
-- Put_Line ("Switch " & Full_Switch (Parser)
-- & " param=" & Parameter (Parser));
-- end loop;
diff --git a/gcc/ada/g-debuti.adb b/gcc/ada/g-debuti.adb
index 560f79f96d8..20731fb0c2d 100644
--- a/gcc/ada/g-debuti.adb
+++ b/gcc/ada/g-debuti.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2005, AdaCore --
+-- Copyright (C) 1997-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,8 +36,8 @@ with System.Storage_Elements; use System.Storage_Elements;
package body GNAT.Debug_Utilities is
- H : constant array (0 .. 15) of Character := "0123456789ABCDEF";
- -- Table of hex digits
+ H : constant array (0 .. 15) of Character := "0123456789ABCDEF";
+ -- Table of hex digits
-----------
-- Image --
diff --git a/gcc/ada/g-dyntab.adb b/gcc/ada/g-dyntab.adb
index 216ff5b5f1e..1ebebe4d95d 100644
--- a/gcc/ada/g-dyntab.adb
+++ b/gcc/ada/g-dyntab.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2008, AdaCore --
+-- Copyright (C) 2000-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -85,6 +85,17 @@ package body GNAT.Dynamic_Tables is
Set_Item (T, Table_Index_Type (T.P.Last_Val + 1), New_Val);
end Append;
+ ----------------
+ -- Append_All --
+ ----------------
+
+ procedure Append_All (T : in out Instance; New_Vals : Table_Type) is
+ begin
+ for J in New_Vals'Range loop
+ Append (T, New_Vals (J));
+ end loop;
+ end Append_All;
+
--------------------
-- Decrement_Last --
--------------------
diff --git a/gcc/ada/g-dyntab.ads b/gcc/ada/g-dyntab.ads
index 7768c88cd38..897d7008f82 100644
--- a/gcc/ada/g-dyntab.ads
+++ b/gcc/ada/g-dyntab.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2008, AdaCore --
+-- Copyright (C) 2000-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -169,6 +169,9 @@ package GNAT.Dynamic_Tables is
-- i.e. the table size is increased by one, and the given new item
-- stored in the newly created table element.
+ procedure Append_All (T : in out Instance; New_Vals : Table_Type);
+ -- Appends all components of New_Vals
+
procedure Set_Item
(T : in out Instance;
Index : Table_Index_Type;
diff --git a/gcc/ada/g-expect-vms.adb b/gcc/ada/g-expect-vms.adb
index bc74a5d261e..1162f50aa69 100644
--- a/gcc/ada/g-expect-vms.adb
+++ b/gcc/ada/g-expect-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2008, AdaCore --
+-- Copyright (C) 2002-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -249,7 +249,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : String;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
begin
@@ -265,7 +265,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexp : String;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
begin
@@ -284,7 +284,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Matched : GNAT.Regpat.Match_Array (0 .. 0);
@@ -298,7 +298,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
N : Expect_Match;
@@ -370,7 +370,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Patterns : Compiled_Regexp_Array (Regexps'Range);
@@ -392,7 +392,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Matched : GNAT.Regpat.Match_Array (0 .. 0);
@@ -404,7 +404,7 @@ package body GNAT.Expect is
procedure Expect
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Matched : GNAT.Regpat.Match_Array (0 .. 0);
@@ -418,7 +418,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexps : Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Patterns : Compiled_Regexp_Array (Regexps'Range);
@@ -442,7 +442,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
N : Expect_Match;
@@ -489,7 +489,7 @@ package body GNAT.Expect is
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
N : Expect_Match;
@@ -646,7 +646,7 @@ package body GNAT.Expect is
else
-- Add what we read to the buffer
- if Descriptors (J).Buffer_Index + N - 1 >
+ if Descriptors (J).Buffer_Index + N >
Descriptors (J).Buffer_Size
then
-- If the user wants to know when we have
diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb
index 124d43983a5..7ce2c89d771 100644
--- a/gcc/ada/g-expect.adb
+++ b/gcc/ada/g-expect.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2008, AdaCore --
+-- Copyright (C) 2000-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -261,7 +261,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : String;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
begin
@@ -277,7 +277,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexp : String;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
begin
@@ -296,7 +296,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Matched : GNAT.Regpat.Match_Array (0 .. 0);
@@ -310,7 +310,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
N : Expect_Match;
@@ -382,7 +382,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Patterns : Compiled_Regexp_Array (Regexps'Range);
@@ -406,7 +406,7 @@ package body GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Matched : GNAT.Regpat.Match_Array (0 .. 0);
@@ -418,7 +418,7 @@ package body GNAT.Expect is
procedure Expect
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Matched : GNAT.Regpat.Match_Array (0 .. 0);
@@ -432,7 +432,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexps : Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
Patterns : Compiled_Regexp_Array (Regexps'Range);
@@ -456,7 +456,7 @@ package body GNAT.Expect is
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
N : Expect_Match;
@@ -503,7 +503,7 @@ package body GNAT.Expect is
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False)
is
N : Expect_Match;
@@ -660,7 +660,7 @@ package body GNAT.Expect is
else
-- Add what we read to the buffer
- if Descriptors (J).Buffer_Index + N - 1 >
+ if Descriptors (J).Buffer_Index + N >
Descriptors (J).Buffer_Size
then
-- If the user wants to know when we have
diff --git a/gcc/ada/g-expect.ads b/gcc/ada/g-expect.ads
index 168a25554fb..1e50852522a 100644
--- a/gcc/ada/g-expect.ads
+++ b/gcc/ada/g-expect.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2008, AdaCore --
+-- Copyright (C) 2000-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -51,7 +51,7 @@
-- Non_Blocking_Spawn
-- (Fd, "ftp",
-- (1 => new String' ("machine@domain")));
--- Timeout := 10000; -- 10 seconds
+-- Timeout := 10_000; -- 10 seconds
-- Expect (Fd, Result, Regexp_Array'(+"\(user\)", +"\(passwd\)"),
-- Timeout);
-- case Result is
@@ -63,10 +63,10 @@
-- Close (Fd);
-- You can also combine multiple regular expressions together, and get the
--- specific string matching a parenthesis pair by doing something like. If you
--- expect either "lang=optional ada" or "lang=ada" from the external process,
--- you can group the two together, which is more efficient, and simply get the
--- name of the language by doing:
+-- specific string matching a parenthesis pair by doing something like this:
+-- If you expect either "lang=optional ada" or "lang=ada" from the external
+-- process, you can group the two together, which is more efficient, and
+-- simply get the name of the language by doing:
-- declare
-- Matched : Match_Array (0 .. 2);
@@ -116,10 +116,10 @@
-- -- Task Safety --
-- -----------------
--- This package is not task-safe: there should be not concurrent calls to
--- the functions defined in this package. In other words, separate tasks
--- may not access the facilities of this package without synchronization
--- that serializes access.
+-- This package is not task-safe: there should not be concurrent calls to the
+-- functions defined in this package. In other words, separate tasks must not
+-- access the facilities of this package without synchronization that
+-- serializes access.
with System;
with GNAT.OS_Lib;
@@ -132,21 +132,21 @@ package GNAT.Expect is
Null_Pid : constant Process_Id := 0;
type Filter_Type is (Output, Input, Died);
- -- The signals that are emitted by the Process_Descriptor upon state
- -- changed in the child. One can connect to any of this signal through
- -- the Add_Filter subprograms.
+ -- The signals that are emitted by the Process_Descriptor upon state change
+ -- in the child. One can connect to any of these signals through the
+ -- Add_Filter subprograms.
--
-- Output => Every time new characters are read from the process
-- associated with Descriptor, the filter is called with
- -- these new characters in argument.
+ -- these new characters in the argument.
--
- -- Note that output is only generated when the program is
+ -- Note that output is generated only when the program is
-- blocked in a call to Expect.
--
-- Input => Every time new characters are written to the process
-- associated with Descriptor, the filter is called with
- -- these new characters in argument.
- -- Note that input is only generated by calls to Send.
+ -- these new characters in the argument.
+ -- Note that input is generated only by calls to Send.
--
-- Died => The child process has died, or was explicitly killed
@@ -172,16 +172,16 @@ package GNAT.Expect is
-- the process and/or automatic parsing of the output.
--
-- The expect buffer associated with that process can contain at most
- -- Buffer_Size characters. Older characters are simply discarded when
- -- this buffer is full. Beware that if the buffer is too big, this could
- -- slow down the Expect calls if not output is matched, since Expect has
- -- to match all the regexp against all the characters in the buffer.
- -- If Buffer_Size is 0, there is no limit (i.e. all the characters are kept
+ -- Buffer_Size characters. Older characters are simply discarded when this
+ -- buffer is full. Beware that if the buffer is too big, this could slow
+ -- down the Expect calls if the output not is matched, since Expect has to
+ -- match all the regexp against all the characters in the buffer. If
+ -- Buffer_Size is 0, there is no limit (i.e. all the characters are kept
-- till Expect matches), but this is slower.
--
-- If Err_To_Out is True, then the standard error of the spawned process is
-- connected to the standard output. This is the only way to get the
- -- Except subprograms also match on output on standard error.
+ -- Except subprograms to also match on output on standard error.
--
-- Invalid_Process is raised if the process could not be spawned.
@@ -252,9 +252,9 @@ package GNAT.Expect is
--
-- Str is a string of all these characters.
--
- -- User_Data, if specified, is a user specific data that will be passed to
- -- the filter. Note that no checks are done on this parameter that should
- -- be used with cautiousness.
+ -- User_Data, if specified, is user specific data that will be passed to
+ -- the filter. Note that no checks are done on this parameter, so it should
+ -- be used with caution.
procedure Add_Filter
(Descriptor : in out Process_Descriptor;
@@ -262,10 +262,10 @@ package GNAT.Expect is
Filter_On : Filter_Type := Output;
User_Data : System.Address := System.Null_Address;
After : Boolean := False);
- -- Add a new filter for one of the filter type. This filter will be
- -- run before all the existing filters, unless After is set True,
- -- in which case it will be run after existing filters. User_Data
- -- is passed as is to the filter procedure.
+ -- Add a new filter for one of the filter types. This filter will be run
+ -- before all the existing filters, unless After is set True, in which case
+ -- it will be run after existing filters. User_Data is passed as is to the
+ -- filter procedure.
procedure Remove_Filter
(Descriptor : in out Process_Descriptor;
@@ -277,14 +277,14 @@ package GNAT.Expect is
(Descriptor : Process_Descriptor'Class;
Str : String;
User_Data : System.Address := System.Null_Address);
- -- Function that can be used a filter and that simply outputs Str on
+ -- Function that can be used as a filter and that simply outputs Str on
-- Standard_Output. This is mainly used for debugging purposes.
-- User_Data is ignored.
procedure Lock_Filters (Descriptor : in out Process_Descriptor);
-- Temporarily disables all output and input filters. They will be
-- reactivated only when Unlock_Filters has been called as many times as
- -- Lock_Filters;
+ -- Lock_Filters.
procedure Unlock_Filters (Descriptor : in out Process_Descriptor);
-- Unlocks the filters. They are reactivated only if Unlock_Filters
@@ -318,7 +318,7 @@ package GNAT.Expect is
-- If the buffer was full and some characters were discarded
Expect_Timeout : constant Expect_Match := -2;
- -- If not output matching the regexps was found before the timeout
+ -- If no output matching the regexps was found before the timeout
function "+" (S : String) return GNAT.OS_Lib.String_Access;
-- Allocate some memory for the string. This is merely a convenience
@@ -328,7 +328,7 @@ package GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : String;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Wait till a string matching Fd can be read from Fd, and return 1
-- if a match was found.
@@ -359,7 +359,7 @@ package GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as the previous one, but with a precompiled regular expression.
-- This is more efficient however, especially if you are using this
@@ -371,7 +371,7 @@ package GNAT.Expect is
Result : out Expect_Match;
Regexp : String;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as above, but it is now possible to get the indexes of the
-- substrings for the parentheses in the regexp (see the example at the
@@ -391,7 +391,7 @@ package GNAT.Expect is
Result : out Expect_Match;
Regexp : GNAT.Regpat.Pattern_Matcher;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as above, but with a precompiled regular expression
@@ -416,7 +416,7 @@ package GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Wait till a string matching one of the regular expressions in Regexps
-- is found. This function returns the index of the regexp that matched.
@@ -427,7 +427,7 @@ package GNAT.Expect is
(Descriptor : in out Process_Descriptor;
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as the previous one, but with precompiled regular expressions.
-- This can be much faster if you are using them multiple times.
@@ -437,7 +437,7 @@ package GNAT.Expect is
Result : out Expect_Match;
Regexps : Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as above, except that you can also access the parenthesis
-- groups inside the matching regular expression.
@@ -451,7 +451,7 @@ package GNAT.Expect is
Result : out Expect_Match;
Regexps : Compiled_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as above, but with precompiled regular expressions.
-- The first index in Matched must be 0, or Constraint_Error will be
@@ -472,14 +472,14 @@ package GNAT.Expect is
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
Matched : out GNAT.Regpat.Match_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as above, but for multi processes
procedure Expect
(Result : out Expect_Match;
Regexps : Multiprocess_Regexp_Array;
- Timeout : Integer := 10000;
+ Timeout : Integer := 10_000;
Full_Buffer : Boolean := False);
-- Same as the previous one, but for multiple processes.
-- This procedure finds the first regexp that match the associated process.
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index cc31d142c57..9cd471afd54 100644
--- a/gcc/ada/g-socket.adb
+++ b/gcc/ada/g-socket.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1644,7 +1644,7 @@ package body GNAT.Sockets is
Item'Address,
Item'Length,
To_Int (Flags),
- Sin'Unchecked_Access,
+ Sin'Address,
Len'Access);
if Res = Failure then
@@ -1657,6 +1657,41 @@ package body GNAT.Sockets is
From.Port := Port_Type (Network_To_Short (Sin.Sin_Port));
end Receive_Socket;
+ --------------------
+ -- Receive_Vector --
+ --------------------
+
+ procedure Receive_Vector
+ (Socket : Socket_Type;
+ Vector : Vector_Type;
+ Count : out Ada.Streams.Stream_Element_Count;
+ Flags : Request_Flag_Type := No_Request_Flag)
+ is
+ Res : ssize_t;
+
+ Msg : Msghdr :=
+ (Msg_Name => System.Null_Address,
+ Msg_Namelen => 0,
+ Msg_Iov => Vector'Address,
+ Msg_Iovlen => SOSC.Msg_Iovlen_T (Vector'Length),
+ Msg_Control => System.Null_Address,
+ Msg_Controllen => 0,
+ Msg_Flags => 0);
+
+ begin
+ Res :=
+ C_Recvmsg
+ (C.int (Socket),
+ Msg'Address,
+ To_Int (Flags));
+
+ if Res = ssize_t (Failure) then
+ Raise_Socket_Error (Socket_Errno);
+ end if;
+
+ Count := Ada.Streams.Stream_Element_Count (Res);
+ end Receive_Vector;
+
-------------------
-- Resolve_Error --
-------------------
@@ -1782,31 +1817,6 @@ package body GNAT.Sockets is
end if;
end Resolve_Exception;
- --------------------
- -- Receive_Vector --
- --------------------
-
- procedure Receive_Vector
- (Socket : Socket_Type;
- Vector : Vector_Type;
- Count : out Ada.Streams.Stream_Element_Count)
- is
- Res : C.int;
-
- begin
- Res :=
- C_Readv
- (C.int (Socket),
- Vector'Address,
- Vector'Length);
-
- if Res = Failure then
- Raise_Socket_Error (Socket_Errno);
- end if;
-
- Count := Ada.Streams.Stream_Element_Count (Res);
- end Receive_Vector;
-
-----------------
-- Send_Socket --
-----------------
@@ -1851,7 +1861,7 @@ package body GNAT.Sockets is
Res : C.int;
Sin : aliased Sockaddr_In;
- C_To : Sockaddr_In_Access;
+ C_To : System.Address;
Len : C.int;
begin
@@ -1861,11 +1871,11 @@ package body GNAT.Sockets is
Set_Port
(Sin'Unchecked_Access,
Short_To_Network (C.unsigned_short (To.Port)));
- C_To := Sin'Unchecked_Access;
+ C_To := Sin'Address;
Len := Sin'Size / 8;
else
- C_To := null;
+ C_To := System.Null_Address;
Len := 0;
end if;
@@ -1891,11 +1901,16 @@ package body GNAT.Sockets is
procedure Send_Vector
(Socket : Socket_Type;
Vector : Vector_Type;
- Count : out Ada.Streams.Stream_Element_Count)
+ Count : out Ada.Streams.Stream_Element_Count;
+ Flags : Request_Flag_Type := No_Request_Flag)
is
- Res : C.int;
- Iov_Count : C.int;
- This_Iov_Count : C.int;
+ use SOSC;
+ use Interfaces.C;
+
+ Res : ssize_t;
+ Iov_Count : SOSC.Msg_Iovlen_T;
+ This_Iov_Count : SOSC.Msg_Iovlen_T;
+ Msg : Msghdr;
begin
Count := 0;
@@ -1913,13 +1928,23 @@ package body GNAT.Sockets is
pragma Warnings (On);
+ Msg :=
+ (Msg_Name => System.Null_Address,
+ Msg_Namelen => 0,
+ Msg_Iov => Vector
+ (Vector'First + Integer (Iov_Count))'Address,
+ Msg_Iovlen => This_Iov_Count,
+ Msg_Control => System.Null_Address,
+ Msg_Controllen => 0,
+ Msg_Flags => 0);
+
Res :=
- C_Writev
+ C_Sendmsg
(C.int (Socket),
- Vector (Vector'First + Integer (Iov_Count))'Address,
- This_Iov_Count);
+ Msg'Address,
+ Set_Forced_Flags (To_Int (Flags)));
- if Res = Failure then
+ if Res = ssize_t (Failure) then
Raise_Socket_Error (Socket_Errno);
end if;
diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads
index 3680d751ff6..e84bd0fe996 100644
--- a/gcc/ada/g-socket.ads
+++ b/gcc/ada/g-socket.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -913,9 +913,11 @@ package GNAT.Sockets is
procedure Receive_Vector
(Socket : Socket_Type;
Vector : Vector_Type;
- Count : out Ada.Streams.Stream_Element_Count);
+ Count : out Ada.Streams.Stream_Element_Count;
+ Flags : Request_Flag_Type := No_Request_Flag);
-- Receive data from a socket and scatter it into the set of vector
-- elements Vector. Count is set to the count of received stream elements.
+ -- Flags allow control over reception.
function Resolve_Exception
(Occurrence : Ada.Exceptions.Exception_Occurrence) return Error_Type;
@@ -959,9 +961,11 @@ package GNAT.Sockets is
procedure Send_Vector
(Socket : Socket_Type;
Vector : Vector_Type;
- Count : out Ada.Streams.Stream_Element_Count);
+ Count : out Ada.Streams.Stream_Element_Count;
+ Flags : Request_Flag_Type := No_Request_Flag);
-- Transmit data gathered from the set of vector elements Vector to a
-- socket. Count is set to the count of transmitted stream elements.
+ -- Flags allow control over transmission.
procedure Set_Socket_Option
(Socket : Socket_Type;
diff --git a/gcc/ada/g-socthi-mingw.adb b/gcc/ada/g-socthi-mingw.adb
index c3a120f32a1..093731ce40d 100644
--- a/gcc/ada/g-socthi-mingw.adb
+++ b/gcc/ada/g-socthi-mingw.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -247,38 +247,45 @@ package body GNAT.Sockets.Thin is
return Res;
end C_Connect;
- -------------
- -- C_Readv --
- -------------
+ ---------------
+ -- C_Recvmsg --
+ ---------------
- function C_Readv
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
is
Res : C.int;
Count : C.int := 0;
- Iovec : array (0 .. Iovcnt - 1) of Vector_Element;
- for Iovec'Address use Iov;
+ MH : Msghdr;
+ for MH'Address use Msg;
+
+ Iovec : array (0 .. MH.Msg_Iovlen - 1) of Vector_Element;
+ for Iovec'Address use MH.Msg_Iov;
pragma Import (Ada, Iovec);
begin
+ -- Windows does not provide an implementation of recvmsg(). The spec for
+ -- WSARecvMsg() is incompatible with the data types we define, and is
+ -- not available in all versions of Windows. So, we use C_Recv instead.
+
for J in Iovec'Range loop
Res := C_Recv
- (Fd,
+ (S,
Iovec (J).Base.all'Address,
C.int (Iovec (J).Length),
- 0);
+ Flags);
if Res < 0 then
- return Res;
+ return ssize_t (Res);
else
Count := Count + Res;
end if;
end loop;
- return Count;
- end C_Readv;
+ return ssize_t (Count);
+ end C_Recvmsg;
--------------
-- C_Select --
@@ -348,7 +355,10 @@ package body GNAT.Sockets.Thin is
-- Check out-of-band data
Length := C_Recvfrom
- (S, Buffer'Address, 1, Flag, null, Fromlen'Unchecked_Access);
+ (S, Buffer'Address, 1, Flag,
+ From => System.Null_Address,
+ Fromlen => Fromlen'Unchecked_Access);
+ -- Is Fromlen necessary if From is Null_Address???
-- If the signal is not an out-of-band data, then it
-- is a connection failure notification.
@@ -372,40 +382,48 @@ package body GNAT.Sockets.Thin is
return Res;
end C_Select;
- --------------
- -- C_Writev --
- --------------
+ ---------------
+ -- C_Sendmsg --
+ ---------------
- function C_Writev
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
is
Res : C.int;
Count : C.int := 0;
- Iovec : array (0 .. Iovcnt - 1) of Vector_Element;
- for Iovec'Address use Iov;
+ MH : Msghdr;
+ for MH'Address use Msg;
+
+ Iovec : array (0 .. MH.Msg_Iovlen - 1) of Vector_Element;
+ for Iovec'Address use MH.Msg_Iov;
pragma Import (Ada, Iovec);
begin
+ -- Windows does not provide an implementation of sendmsg(). The spec for
+ -- WSASendMsg() is incompatible with the data types we define, and is
+ -- not available in all versions of Windows. So, we'll use C_Sendto
+ -- instead.
+
for J in Iovec'Range loop
Res := C_Sendto
- (Fd,
+ (S,
Iovec (J).Base.all'Address,
C.int (Iovec (J).Length),
- Flags => 0,
- To => null,
- Tolen => 0);
+ Flags => Flags,
+ To => MH.Msg_Name,
+ Tolen => C.int (MH.Msg_Namelen));
if Res < 0 then
- return Res;
+ return ssize_t (Res);
else
Count := Count + Res;
end if;
end loop;
- return Count;
- end C_Writev;
+ return ssize_t (Count);
+ end C_Sendmsg;
--------------
-- Finalize --
diff --git a/gcc/ada/g-socthi-mingw.ads b/gcc/ada/g-socthi-mingw.ads
index e93b3f7be49..922e64aa22f 100644
--- a/gcc/ada/g-socthi-mingw.ads
+++ b/gcc/ada/g-socthi-mingw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -49,6 +49,11 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
+ use type C.size_t;
+ type ssize_t is range -(2 ** (C.size_t'Size - 1))
+ .. +(2 ** (C.size_t'Size - 1) - 1);
+ -- Signed type of the same size as size_t
+
function Socket_Errno return Integer;
-- Returns last socket error number
@@ -124,11 +129,6 @@ package GNAT.Sockets.Thin is
(S : C.int;
Backlog : C.int) return C.int;
- function C_Readv
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
function C_Recv
(S : C.int;
Msg : System.Address;
@@ -140,9 +140,14 @@ package GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Select
(Nfds : C.int;
Readfds : access Fd_Set;
@@ -150,12 +155,17 @@ package GNAT.Sockets.Thin is
Exceptfds : access Fd_Set;
Timeout : Timeval_Access) return C.int;
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
function C_Setsockopt
@@ -180,11 +190,6 @@ package GNAT.Sockets.Thin is
function C_System
(Command : System.Address) return C.int;
- function C_Writev
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
function WSAStartup
(WS_Version : Interfaces.C.int;
WSADataAddress : System.Address) return Interfaces.C.int;
diff --git a/gcc/ada/g-socthi-vms.adb b/gcc/ada/g-socthi-vms.adb
index afadbb2e5b8..6384598f07a 100644
--- a/gcc/ada/g-socthi-vms.adb
+++ b/gcc/ada/g-socthi-vms.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -40,13 +40,18 @@ with Interfaces.C; use Interfaces.C;
package body GNAT.Sockets.Thin is
+ type VMS_Msghdr is new Msghdr;
+ pragma Pack (VMS_Msghdr);
+ -- On VMS (unlike other platforms), struct msghdr is packed, so a specific
+ -- derived type is required.
+
Non_Blocking_Sockets : aliased Fd_Set;
-- When this package is initialized with Process_Blocking_IO set to True,
-- sockets are set in non-blocking mode to avoid blocking the whole process
-- when a thread wants to perform a blocking IO operation. But the user can
-- also set a socket in non-blocking mode by purpose. In order to make a
-- difference between these two situations, we track the origin of
- -- non-blocking mode in Non_Blocking_Sockets. If S is in
+ -- non-blocking mode in Non_Blocking_Sockets. Note that if S is in
-- Non_Blocking_Sockets, it has been set in non-blocking mode by the user.
Quantum : constant Duration := 0.2;
@@ -87,16 +92,28 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
pragma Import (C, Syscall_Recvfrom, "recvfrom");
+ function Syscall_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return C.int;
+ pragma Import (C, Syscall_Recvmsg, "recvmsg");
+
+ function Syscall_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return C.int;
+ pragma Import (C, Syscall_Sendmsg, "sendmsg");
+
function Syscall_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
pragma Import (C, Syscall_Sendto, "sendto");
@@ -198,7 +215,6 @@ package body GNAT.Sockets.Thin is
if Res = Failure and then Errno = SOSC.EISCONN then
return Thin_Common.Success;
-
else
return Res;
end if;
@@ -259,7 +275,7 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int
is
Res : C.int;
@@ -277,6 +293,70 @@ package body GNAT.Sockets.Thin is
return Res;
end C_Recvfrom;
+ ---------------
+ -- C_Recvmsg --
+ ---------------
+
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
+ is
+ Res : C.int;
+
+ GNAT_Msg : Msghdr;
+ for GNAT_Msg'Address use Msg;
+ pragma Import (Ada, GNAT_Msg);
+
+ VMS_Msg : aliased VMS_Msghdr := VMS_Msghdr (GNAT_Msg);
+
+ begin
+ loop
+ Res := Syscall_Recvmsg (S, VMS_Msg'Address, Flags);
+ exit when SOSC.Thread_Blocking_IO
+ or else Res /= Failure
+ or else Non_Blocking_Socket (S)
+ or else Errno /= SOSC.EWOULDBLOCK;
+ delay Quantum;
+ end loop;
+
+ GNAT_Msg := Msghdr (VMS_Msg);
+
+ return ssize_t (Res);
+ end C_Recvmsg;
+
+ ---------------
+ -- C_Sendmsg --
+ ---------------
+
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
+ is
+ Res : C.int;
+
+ GNAT_Msg : Msghdr;
+ for GNAT_Msg'Address use Msg;
+ pragma Import (Ada, GNAT_Msg);
+
+ VMS_Msg : aliased VMS_Msghdr := VMS_Msghdr (GNAT_Msg);
+
+ begin
+ loop
+ Res := Syscall_Sendmsg (S, VMS_Msg'Address, Flags);
+ exit when SOSC.Thread_Blocking_IO
+ or else Res /= Failure
+ or else Non_Blocking_Socket (S)
+ or else Errno /= SOSC.EWOULDBLOCK;
+ delay Quantum;
+ end loop;
+
+ GNAT_Msg := Msghdr (VMS_Msg);
+
+ return ssize_t (Res);
+ end C_Sendmsg;
+
--------------
-- C_Sendto --
--------------
@@ -286,7 +366,7 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int
is
Res : C.int;
@@ -416,72 +496,4 @@ package body GNAT.Sockets.Thin is
end if;
end Socket_Error_Message;
- -------------
- -- C_Readv --
- -------------
-
- function C_Readv
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int
- is
- Res : C.int;
- Count : C.int := 0;
-
- Iovec : array (0 .. Iovcnt - 1) of Vector_Element;
- for Iovec'Address use Iov;
- pragma Import (Ada, Iovec);
-
- begin
- for J in Iovec'Range loop
- Res := C_Recv
- (Fd,
- Iovec (J).Base.all'Address,
- Interfaces.C.int (Iovec (J).Length),
- 0);
-
- if Res < 0 then
- return Res;
- else
- Count := Count + Res;
- end if;
- end loop;
- return Count;
- end C_Readv;
-
- --------------
- -- C_Writev --
- --------------
-
- function C_Writev
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int
- is
- Res : C.int;
- Count : C.int := 0;
-
- Iovec : array (0 .. Iovcnt - 1) of Vector_Element;
- for Iovec'Address use Iov;
- pragma Import (Ada, Iovec);
-
- begin
- for J in Iovec'Range loop
- Res := C_Sendto
- (Fd,
- Iovec (J).Base.all'Address,
- Interfaces.C.int (Iovec (J).Length),
- SOSC.MSG_Forced_Flags,
- To => null,
- Tolen => 0);
-
- if Res < 0 then
- return Res;
- else
- Count := Count + Res;
- end if;
- end loop;
- return Count;
- end C_Writev;
-
end GNAT.Sockets.Thin;
diff --git a/gcc/ada/g-socthi-vms.ads b/gcc/ada/g-socthi-vms.ads
index 6a67e21d8a4..3799da802d2 100644
--- a/gcc/ada/g-socthi-vms.ads
+++ b/gcc/ada/g-socthi-vms.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2008, AdaCore --
+-- Copyright (C) 2002-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -52,6 +52,11 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
+ use type C.size_t;
+ type ssize_t is range -(2 ** (C.size_t'Size - 1))
+ .. +(2 ** (C.size_t'Size - 1) - 1);
+ -- Signed type of the same size as size_t
+
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@@ -127,11 +132,6 @@ package GNAT.Sockets.Thin is
(S : C.int;
Backlog : C.int) return C.int;
- function C_Readv
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
function C_Recv
(S : C.int;
Msg : System.Address;
@@ -143,9 +143,14 @@ package GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Select
(Nfds : C.int;
Readfds : access Fd_Set;
@@ -153,12 +158,17 @@ package GNAT.Sockets.Thin is
Exceptfds : access Fd_Set;
Timeout : Timeval_Access) return C.int;
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
function C_Setsockopt
@@ -183,11 +193,6 @@ package GNAT.Sockets.Thin is
function C_System
(Command : System.Address) return C.int;
- function C_Writev
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
-------------------------------------------------------
-- Signalling file descriptors for selector abortion --
-------------------------------------------------------
diff --git a/gcc/ada/g-socthi-vxworks.adb b/gcc/ada/g-socthi-vxworks.adb
index d035b61f807..a35e429fbb2 100644
--- a/gcc/ada/g-socthi-vxworks.adb
+++ b/gcc/ada/g-socthi-vxworks.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2008, AdaCore --
+-- Copyright (C) 2002-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -98,16 +98,28 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
pragma Import (C, Syscall_Recvfrom, "recvfrom");
+ function Syscall_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return C.int;
+ pragma Import (C, Syscall_Recvmsg, "recvmsg");
+
+ function Syscall_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return C.int;
+ pragma Import (C, Syscall_Sendmsg, "sendmsg");
+
function Syscall_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
pragma Import (C, Syscall_Sendto, "sendto");
@@ -273,7 +285,7 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int
is
Res : C.int;
@@ -291,6 +303,54 @@ package body GNAT.Sockets.Thin is
return Res;
end C_Recvfrom;
+ ---------------
+ -- C_Recvmsg --
+ ---------------
+
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
+ is
+ Res : C.int;
+
+ begin
+ loop
+ Res := Syscall_Recvmsg (S, Msg, Flags);
+ exit when SOSC.Thread_Blocking_IO
+ or else Res /= Failure
+ or else Non_Blocking_Socket (S)
+ or else Errno /= SOSC.EWOULDBLOCK;
+ delay Quantum;
+ end loop;
+
+ return ssize_t (Res);
+ end C_Recvmsg;
+
+ ---------------
+ -- C_Sendmsg --
+ ---------------
+
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
+ is
+ Res : C.int;
+
+ begin
+ loop
+ Res := Syscall_Sendmsg (S, Msg, Flags);
+ exit when SOSC.Thread_Blocking_IO
+ or else Res /= Failure
+ or else Non_Blocking_Socket (S)
+ or else Errno /= SOSC.EWOULDBLOCK;
+ delay Quantum;
+ end loop;
+
+ return ssize_t (Res);
+ end C_Sendmsg;
+
--------------
-- C_Sendto --
--------------
@@ -300,7 +360,7 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int
is
Res : C.int;
diff --git a/gcc/ada/g-socthi-vxworks.ads b/gcc/ada/g-socthi-vxworks.ads
index 04e1278f2be..14b8ad92428 100644
--- a/gcc/ada/g-socthi-vxworks.ads
+++ b/gcc/ada/g-socthi-vxworks.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2002-2008, AdaCore --
+-- Copyright (C) 2002-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -50,6 +50,11 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
+ use type C.size_t;
+ type ssize_t is range -(2 ** (C.size_t'Size - 1))
+ .. +(2 ** (C.size_t'Size - 1) - 1);
+ -- Signed type of the same size as size_t
+
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@@ -125,11 +130,6 @@ package GNAT.Sockets.Thin is
(S : C.int;
Backlog : C.int) return C.int;
- function C_Readv
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
function C_Recv
(S : C.int;
Msg : System.Address;
@@ -141,9 +141,14 @@ package GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Select
(Nfds : C.int;
Readfds : access Fd_Set;
@@ -151,12 +156,17 @@ package GNAT.Sockets.Thin is
Exceptfds : access Fd_Set;
Timeout : Timeval_Access) return C.int;
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
function C_Setsockopt
@@ -181,11 +191,6 @@ package GNAT.Sockets.Thin is
function C_System
(Command : System.Address) return C.int;
- function C_Writev
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
-------------------------------------------------------
-- Signalling file descriptors for selector abortion --
-------------------------------------------------------
@@ -224,11 +229,9 @@ private
pragma Import (C, C_Getsockname, "getsockname");
pragma Import (C, C_Getsockopt, "getsockopt");
pragma Import (C, C_Listen, "listen");
- pragma Import (C, C_Readv, "readv");
pragma Import (C, C_Select, "select");
pragma Import (C, C_Setsockopt, "setsockopt");
pragma Import (C, C_Shutdown, "shutdown");
pragma Import (C, C_Strerror, "strerror");
pragma Import (C, C_System, "system");
- pragma Import (C, C_Writev, "writev");
end GNAT.Sockets.Thin;
diff --git a/gcc/ada/g-socthi.adb b/gcc/ada/g-socthi.adb
index fab5fb3ac9e..0ffee86af49 100644
--- a/gcc/ada/g-socthi.adb
+++ b/gcc/ada/g-socthi.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -94,16 +94,28 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
pragma Import (C, Syscall_Recvfrom, "recvfrom");
+ function Syscall_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+ pragma Import (C, Syscall_Recvmsg, "recvmsg");
+
+ function Syscall_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+ pragma Import (C, Syscall_Sendmsg, "sendmsg");
+
function Syscall_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
pragma Import (C, Syscall_Sendto, "sendto");
@@ -278,7 +290,7 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int
is
Res : C.int;
@@ -296,6 +308,54 @@ package body GNAT.Sockets.Thin is
return Res;
end C_Recvfrom;
+ ---------------
+ -- C_Recvmsg --
+ ---------------
+
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
+ is
+ Res : ssize_t;
+
+ begin
+ loop
+ Res := Syscall_Recvmsg (S, Msg, Flags);
+ exit when SOSC.Thread_Blocking_IO
+ or else Res /= ssize_t (Failure)
+ or else Non_Blocking_Socket (S)
+ or else Errno /= SOSC.EWOULDBLOCK;
+ delay Quantum;
+ end loop;
+
+ return Res;
+ end C_Recvmsg;
+
+ ---------------
+ -- C_Sendmsg --
+ ---------------
+
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t
+ is
+ Res : ssize_t;
+
+ begin
+ loop
+ Res := Syscall_Sendmsg (S, Msg, Flags);
+ exit when SOSC.Thread_Blocking_IO
+ or else Res /= ssize_t (Failure)
+ or else Non_Blocking_Socket (S)
+ or else Errno /= SOSC.EWOULDBLOCK;
+ delay Quantum;
+ end loop;
+
+ return Res;
+ end C_Sendmsg;
+
--------------
-- C_Sendto --
--------------
@@ -305,7 +365,7 @@ package body GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int
is
Res : C.int;
diff --git a/gcc/ada/g-socthi.ads b/gcc/ada/g-socthi.ads
index 303a942d385..cb19050250b 100644
--- a/gcc/ada/g-socthi.ads
+++ b/gcc/ada/g-socthi.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -54,6 +54,11 @@ package GNAT.Sockets.Thin is
package C renames Interfaces.C;
+ use type C.size_t;
+ type ssize_t is range -(2 ** (C.size_t'Size - 1))
+ .. +(2 ** (C.size_t'Size - 1) - 1);
+ -- Signed type of the same size as size_t
+
function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
-- Returns last socket error number
@@ -126,11 +131,6 @@ package GNAT.Sockets.Thin is
(S : C.int;
Backlog : C.int) return C.int;
- function C_Readv
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
function C_Recv
(S : C.int;
Msg : System.Address;
@@ -142,9 +142,14 @@ package GNAT.Sockets.Thin is
Msg : System.Address;
Len : C.int;
Flags : C.int;
- From : Sockaddr_In_Access;
+ From : System.Address;
Fromlen : not null access C.int) return C.int;
+ function C_Recvmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Select
(Nfds : C.int;
Readfds : access Fd_Set;
@@ -152,12 +157,17 @@ package GNAT.Sockets.Thin is
Exceptfds : access Fd_Set;
Timeout : Timeval_Access) return C.int;
+ function C_Sendmsg
+ (S : C.int;
+ Msg : System.Address;
+ Flags : C.int) return ssize_t;
+
function C_Sendto
(S : C.int;
Msg : System.Address;
Len : C.int;
Flags : C.int;
- To : Sockaddr_In_Access;
+ To : System.Address;
Tolen : C.int) return C.int;
function C_Setsockopt
@@ -182,11 +192,6 @@ package GNAT.Sockets.Thin is
function C_System
(Command : System.Address) return C.int;
- function C_Writev
- (Fd : C.int;
- Iov : System.Address;
- Iovcnt : C.int) return C.int;
-
-------------------------------------------------------
-- Signalling file descriptors for selector abortion --
-------------------------------------------------------
@@ -249,13 +254,11 @@ private
pragma Import (C, C_Getsockname, "getsockname");
pragma Import (C, C_Getsockopt, "getsockopt");
pragma Import (C, C_Listen, "listen");
- pragma Import (C, C_Readv, "readv");
pragma Import (C, C_Select, "select");
pragma Import (C, C_Setsockopt, "setsockopt");
pragma Import (C, C_Shutdown, "shutdown");
pragma Import (C, C_Strerror, "strerror");
pragma Import (C, C_System, "system");
- pragma Import (C, C_Writev, "writev");
pragma Import (C, Nonreentrant_Gethostbyname, "gethostbyname");
pragma Import (C, Nonreentrant_Gethostbyaddr, "gethostbyaddr");
diff --git a/gcc/ada/g-sothco.ads b/gcc/ada/g-sothco.ads
index 448677174a8..9a8672830fa 100644
--- a/gcc/ada/g-sothco.ads
+++ b/gcc/ada/g-sothco.ads
@@ -243,6 +243,21 @@ package GNAT.Sockets.Thin_Common is
pragma Convention (C, Hostent_Access);
-- Access to host entry
+ ------------------------------------
+ -- Scatter/gather vector handling --
+ ------------------------------------
+
+ type Msghdr is record
+ Msg_Name : System.Address;
+ Msg_Namelen : C.unsigned;
+ Msg_Iov : System.Address;
+ Msg_Iovlen : SOSC.Msg_Iovlen_T;
+ Msg_Control : System.Address;
+ Msg_Controllen : C.size_t;
+ Msg_Flags : C.int;
+ end record;
+ pragma Convention (C, Msghdr);
+
----------------------------
-- Socket sets management --
----------------------------
diff --git a/gcc/ada/g-stsifd-sockets.adb b/gcc/ada/g-stsifd-sockets.adb
index 23fdb59af76..3e3f4518820 100644
--- a/gcc/ada/g-stsifd-sockets.adb
+++ b/gcc/ada/g-stsifd-sockets.adb
@@ -229,8 +229,8 @@ package body Signalling_Fds is
return C_Sendto
(Wsig, Buf'Address, 1,
Flags => SOSC.MSG_Forced_Flags,
- To => null,
- Tolen => 0);
+ To => System.Null_Address,
+ Tolen => 0);
end Write;
end Signalling_Fds;
diff --git a/gcc/ada/g-table.adb b/gcc/ada/g-table.adb
index 60f373a4257..bcc025f42a7 100644
--- a/gcc/ada/g-table.adb
+++ b/gcc/ada/g-table.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2008, AdaCore --
+-- Copyright (C) 1998-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -96,6 +96,17 @@ package body GNAT.Table is
Set_Item (Table_Index_Type (Last_Val + 1), New_Val);
end Append;
+ ----------------
+ -- Append_All --
+ ----------------
+
+ procedure Append_All (New_Vals : Table_Type) is
+ begin
+ for J in New_Vals'Range loop
+ Append (New_Vals (J));
+ end loop;
+ end Append_All;
+
--------------------
-- Decrement_Last --
--------------------
diff --git a/gcc/ada/g-table.ads b/gcc/ada/g-table.ads
index b0aad3d44aa..3a344a532f3 100644
--- a/gcc/ada/g-table.ads
+++ b/gcc/ada/g-table.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2008, AdaCore --
+-- Copyright (C) 1998-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -184,6 +184,9 @@ package GNAT.Table is
-- i.e. the table size is increased by one, and the given new item
-- stored in the newly created table element.
+ procedure Append_All (New_Vals : Table_Type);
+ -- Appends all components of New_Vals
+
procedure Set_Item
(Index : Table_Index_Type;
Item : Table_Component_Type);
diff --git a/gcc/ada/g-tastus.ads b/gcc/ada/g-tastus.ads
new file mode 100644
index 00000000000..ccfdf456bdf
--- /dev/null
+++ b/gcc/ada/g-tastus.ads
@@ -0,0 +1,38 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T . T A S K _ S T A C K _ U S A G E --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit 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 Public License. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides an API to query for tasks stack usage at runtime
+-- and during debug.
+
+-- See file s-stusta.ads for full documentation of the interface
+
+with System.Stack_Usage.Tasking;
+
+package GNAT.Task_Stack_Usage renames System.Stack_Usage.Tasking;
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index f248193e74c..564919d793e 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -1243,22 +1243,22 @@ ada/ada.o : ada/ada.ads ada/system.ads
ada/ali-util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/ali.ads ada/ali-util.ads ada/ali-util.adb \
- ada/alloc.ads ada/binderr.ads ada/casing.ads ada/csets.ads \
- ada/debug.ads ada/err_vars.ads ada/gnat.ads ada/g-htable.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads ada/namet.ads \
- ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads ada/rident.ads \
- ada/scans.ads ada/scng.ads ada/scng.adb ada/sinput.ads ada/sinput.adb \
- ada/sinput-c.ads ada/snames.ads ada/stringt.ads ada/stringt.adb \
- ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
- ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
- ada/s-htable.ads ada/s-htable.adb ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads \
- ada/s-utf_32.adb ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/widechar.ads
+ ada/alloc.ads ada/atree.ads ada/binderr.ads ada/casing.ads \
+ ada/csets.ads ada/debug.ads ada/einfo.ads ada/err_vars.ads ada/gnat.ads \
+ ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads ada/interfac.ads \
+ ada/namet.ads ada/namet.adb ada/opt.ads ada/osint.ads ada/output.ads \
+ ada/rident.ads ada/scans.ads ada/scng.ads ada/scng.adb ada/sinfo.ads \
+ ada/sinput.ads ada/sinput.adb ada/sinput-c.ads ada/snames.ads \
+ ada/stringt.ads ada/stringt.adb ada/styleg.ads ada/styleg.adb \
+ ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-crc32.ads \
+ ada/s-crc32.adb ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-utf_32.ads ada/s-utf_32.adb ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/types.adb \
+ ada/uintp.ads ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/urealp.adb ada/widechar.ads
ada/ali.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/ali.ads ada/ali.adb ada/alloc.ads ada/butil.ads ada/casing.ads \
@@ -1415,22 +1415,18 @@ ada/checks.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/comperr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/comperr.ads ada/comperr.adb ada/debug.ads \
- ada/einfo.ads ada/einfo.adb ada/err_vars.ads ada/errout.ads \
- ada/erroutc.ads ada/fname.ads ada/gnat.ads ada/g-hesorg.ads \
- ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads ada/lib.ads \
- ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \
- ada/nlists.ads ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads \
- ada/output.adb ada/rident.ads ada/sdefault.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/sprint.ads ada/stand.ads ada/stringt.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/treepr.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/einfo.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
+ ada/gnatvsn.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/osint.ads ada/output.ads ada/output.adb \
+ ada/rident.ads ada/sdefault.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/sprint.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
+ ada/treepr.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads
ada/csets.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads ada/csets.ads \
ada/csets.adb ada/debug.ads ada/hostparm.ads ada/opt.ads ada/system.ads \
@@ -1527,17 +1523,18 @@ ada/errout.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/urealp.ads ada/widechar.ads
ada/erroutc.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/debug.ads \
- ada/err_vars.ads ada/erroutc.ads ada/erroutc.adb ada/hostparm.ads \
- ada/interfac.ads ada/namet.ads ada/namet.adb ada/opt.ads ada/output.ads \
- ada/output.adb ada/rident.ads ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/system.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/widechar.ads
+ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/casing.ads \
+ ada/debug.ads ada/einfo.ads ada/err_vars.ads ada/erroutc.ads \
+ ada/erroutc.adb ada/hostparm.ads ada/interfac.ads ada/namet.ads \
+ ada/namet.adb ada/opt.ads ada/output.ads ada/output.adb ada/rident.ads \
+ ada/sinfo.ads ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/eval_fat.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2460,34 +2457,33 @@ ada/inline.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb ada/elists.ads \
ada/elists.adb ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/exp_ch7.ads ada/exp_tss.ads ada/exp_tss.adb ada/exp_util.ads \
- ada/fname.ads ada/fname-uf.ads ada/gnat.ads ada/g-hesorg.ads \
- ada/g-htable.ads ada/hostparm.ads ada/inline.ads ada/inline.adb \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
- ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/sem.ads \
- ada/sem_aux.ads ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch8.ads \
- ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-stalib.ads \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/exp_ch7.ads ada/exp_tss.ads ada/fname.ads ada/fname-uf.ads \
+ ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
+ ada/inline.ads ada/inline.adb ada/lib.ads ada/lib.adb ada/lib-list.adb \
+ ada/lib-sort.adb ada/namet.ads ada/nlists.ads ada/nlists.adb \
+ ada/nmake.ads ada/opt.ads ada/output.ads ada/sem.ads ada/sem_aux.ads \
+ ada/sem_ch10.ads ada/sem_ch12.ads ada/sem_ch8.ads ada/sem_util.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
+ ada/stringt.ads ada/system.ads ada/s-exctab.ads ada/s-htable.ads \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/instpar.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/debug.ads \
- ada/gnatvsn.ads ada/hostparm.ads ada/instpar.ads ada/instpar.adb \
- ada/interfac.ads ada/namet.ads ada/opt.ads ada/output.ads \
- ada/sdefault.ads ada/sinput.ads ada/sinput.adb ada/sinput-l.ads \
+ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/casing.ads \
+ ada/debug.ads ada/einfo.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/instpar.ads ada/instpar.adb ada/interfac.ads ada/namet.ads \
+ ada/opt.ads ada/output.ads ada/sdefault.ads ada/sinfo.ads \
+ ada/sinput.ads ada/sinput.adb ada/sinput-l.ads ada/snames.ads \
ada/system.ads ada/s-carun8.ads ada/s-crc32.ads ada/s-crc32.adb \
ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/widechar.ads
+ ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/interfac.o : ada/interfac.ads ada/system.ads
@@ -2781,22 +2777,22 @@ ada/prep.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/unchdeal.ads ada/urealp.ads
ada/prepcomp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/csets.ads \
- ada/debug.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/gnat.ads ada/g-dyntab.ads ada/g-dyntab.adb ada/g-hesorg.ads \
- ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib-writ.ads \
- ada/namet.ads ada/opt.ads ada/osint.ads ada/output.ads ada/prep.ads \
- ada/prepcomp.ads ada/prepcomp.adb ada/scans.ads ada/scn.ads \
- ada/scng.ads ada/scng.adb ada/sinput.ads ada/sinput.adb \
- ada/sinput-l.ads ada/snames.ads ada/stringt.ads ada/stringt.adb \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-crc32.ads ada/s-crc32.adb ada/s-exctab.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-utf_32.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/casing.ads \
+ ada/csets.ads ada/debug.ads ada/einfo.ads ada/err_vars.ads \
+ ada/errout.ads ada/erroutc.ads ada/gnat.ads ada/g-dyntab.ads \
+ ada/g-dyntab.adb ada/g-hesorg.ads ada/hostparm.ads ada/interfac.ads \
+ ada/lib.ads ada/lib-writ.ads ada/namet.ads ada/opt.ads ada/osint.ads \
+ ada/output.ads ada/prep.ads ada/prepcomp.ads ada/prepcomp.adb \
+ ada/scans.ads ada/scn.ads ada/scng.ads ada/scng.adb ada/sinfo.ads \
+ ada/sinput.ads ada/sinput.adb ada/sinput-l.ads ada/snames.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-crc32.ads \
+ ada/s-crc32.adb ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
+ ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-utf_32.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -2865,9 +2861,8 @@ ada/s-assert.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
ada/s-stoele.adb ada/s-traent.ads
-ada/s-bitops.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/system.ads ada/s-bitops.ads ada/s-bitops.adb ada/s-parame.ads \
- ada/s-stalib.ads ada/s-traent.ads ada/s-unstyp.ads
+ada/s-bitops.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \
+ ada/s-bitops.ads ada/s-bitops.adb ada/s-unstyp.ads
ada/s-carun8.o : ada/ada.ads ada/a-unccon.ads ada/system.ads \
ada/s-addope.ads ada/s-addope.adb ada/s-carun8.ads ada/s-carun8.adb
@@ -3107,29 +3102,29 @@ ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/exp_disp.ads ada/exp_dist.ads ada/exp_pakd.ads ada/exp_tss.ads \
ada/exp_util.ads ada/exp_util.adb ada/expander.ads ada/fname.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-htable.ads \
- ada/hostparm.ads ada/inline.ads ada/itypes.ads ada/lib.ads \
- ada/lib-xref.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads ada/restrict.ads \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sdefault.ads \
- ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads ada/sem_attr.adb \
- ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads \
- ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
- ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
- ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads ada/sem_res.adb \
- ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
- ada/snames.adb ada/sprint.ads ada/stand.ads ada/stringt.ads \
- ada/stringt.adb ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-carun8.ads ada/s-exctab.ads \
- ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
- ada/tbuild.adb ada/tree_io.ads ada/ttypef.ads ada/ttypes.ads \
- ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/validsw.ads ada/widechar.ads
+ ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads ada/itypes.ads \
+ ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/sdefault.ads ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
+ ada/sem_attr.adb ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch13.ads \
+ ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch6.ads ada/sem_ch8.ads \
+ ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
+ ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads \
+ ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_warn.ads \
+ ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
+ ada/snames.ads ada/snames.adb ada/sprint.ads ada/stand.ads \
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-carun8.ads \
+ ada/s-exctab.ads ada/s-exctab.adb ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
+ ada/ttypef.ads ada/ttypes.ads ada/types.ads ada/types.adb ada/uintp.ads \
+ ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
+ ada/urealp.adb ada/validsw.ads ada/widechar.ads
ada/sem_aux.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3620,18 +3615,19 @@ ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
- ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/gnat.ads \
- ada/g-htable.ads ada/hostparm.ads ada/namet.ads ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads ada/sem.ads \
- ada/sem_elim.ads ada/sem_elim.adb ada/sem_prag.ads ada/sem_util.ads \
- ada/sinfo.ads ada/sinfo.adb ada/sinput.ads ada/sinput.adb \
- ada/snames.ads ada/stand.ads ada/stringt.ads ada/system.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb ada/s-imenne.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
- ada/uintp.adb ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/widechar.ads
+ ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/fname.ads \
+ ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
+ ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-sort.adb ada/namet.ads \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/opt.ads ada/output.ads \
+ ada/sem.ads ada/sem_elim.ads ada/sem_elim.adb ada/sem_prag.ads \
+ ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb ada/sinput.ads \
+ ada/sinput.adb ada/snames.ads ada/stand.ads ada/stringt.ads \
+ ada/system.ads ada/s-exctab.ads ada/s-htable.ads ada/s-htable.adb \
+ ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_eval.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
@@ -3957,14 +3953,17 @@ ada/sinput-l.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/urealp.ads ada/widechar.ads
ada/sinput.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/alloc.ads ada/casing.ads ada/debug.ads \
- ada/hostparm.ads ada/interfac.ads ada/namet.ads ada/namet.adb \
- ada/opt.ads ada/output.ads ada/sinput.ads ada/sinput.adb ada/system.ads \
- ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
+ ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/atree.adb \
+ ada/casing.ads ada/debug.ads ada/einfo.ads ada/hostparm.ads \
+ ada/interfac.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/opt.ads ada/output.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/sinput.adb ada/snames.ads ada/system.ads \
+ ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
+ ada/s-parame.ads ada/s-secsta.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
+ ada/urealp.ads ada/widechar.ads
ada/snames.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/hostparm.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 31f0a7b45c9..04553d4b2ce 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -497,6 +497,8 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(targ))),)
s-vxwext.ads<s-vxwext-kernel.ads \
s-vxwext.adb<s-vxwext-kernel.adb \
system.ads<system-vxworks-ppc-kernel.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
else
LIBGNAT_TARGET_PAIRS += \
system.ads<system-vxworks-ppc.ads
@@ -727,6 +729,8 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
s-vxwext.ads<s-vxwext-kernel.ads \
s-vxwext.adb<s-vxwext-kernel.adb \
system.ads<system-vxworks-x86-kernel.ads
+
+ EXTRA_GNATRTL_NONTASKING_OBJS=s-vxwexc.o
else
LIBGNAT_TARGET_PAIRS += \
system.ads<system-vxworks-x86.ads
@@ -937,7 +941,6 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
g-bytswa.adb<g-bytswa-x86.adb \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
- s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
g-sercom.adb<g-sercom-linux.adb
@@ -953,6 +956,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
s-osinte.ads<s-osinte-linux-marte.ads \
s-osprim.adb<s-osprim-posix.adb \
s-taprop.adb<s-taprop-linux-marte.adb \
+ s-taspri.ads<s-taspri-posix.ads \
system.ads<system-linux-x86.ads
EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o a-extiti.o
@@ -969,6 +973,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
s-osinte.ads<s-osinte-linux-xenomai.ads \
s-osprim.adb<s-osprim-linux-xenomai.adb \
s-taprop.adb<s-taprop-linux-xenomai.adb \
+ s-taspri.ads<s-taspri-linux-xenomai.ads \
system.ads<system-linux-x86-xenomai.ads
EH_MECHANISM=-gcc
@@ -977,6 +982,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
s-osinte.ads<s-osinte-linux.ads \
s-osprim.adb<s-osprim-posix.adb \
s-taprop.adb<s-taprop-linux.adb \
+ s-taspri.ads<s-taspri-posix.ads \
s-tasinf.ads<s-tasinf-linux.ads \
s-tasinf.adb<s-tasinf-linux.adb \
system.ads<system-linux-x86.ads
@@ -1549,11 +1555,11 @@ ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
endif
ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
- LIBGNAT_TARGET_PAIRS = \
+ LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
s-intman.adb<s-intman-posix.adb \
- s-linux.ads<s-linux.ads \
+ s-linux.ads<s-linux-mipsel.ads \
s-osinte.adb<s-osinte-posix.adb \
s-osinte.ads<s-osinte-linux.ads \
s-osprim.adb<s-osprim-posix.adb \
@@ -1562,9 +1568,65 @@ ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
s-tasinf.adb<s-tasinf-linux.adb \
s-taspri.ads<s-taspri-posix-noaltstack.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
- g-sercom.adb<g-sercom-linux.adb \
+ g-sercom.adb<g-sercom-linux.adb
+
+ LIBGNAT_TARGET_PAIRS_32 = \
+ system.ads<system-linux-mipsel.ads
+
+ LIBGNAT_TARGET_PAIRS_64 = \
+ system.ads<system-linux-mips64el.ads
+
+ ifeq ($(strip $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory)),../lib64)
+ LIBGNAT_TARGET_PAIRS = \
+ $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
+ else
+ LIBGNAT_TARGET_PAIRS = \
+ $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
+ endif
+
+ TOOLS_TARGET_PAIRS = \
+ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
+ indepsw.adb<indepsw-gnu.adb
+
+ EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
+ EH_MECHANISM=-gcc
+ THREADSLIB = -lpthread
+ GNATLIB_SHARED = gnatlib-shared-dual
+ GMEM_LIB = gmemlib
+ PREFIX_OBJS = $(PREFIX_REAL_OBJS)
+ LIBRARY_VERSION := $(LIB_VERSION)
+endif
+
+ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS_COMMON = \
+ a-intnam.ads<a-intnam-linux.ads \
+ s-inmaop.adb<s-inmaop-posix.adb \
+ s-intman.adb<s-intman-posix.adb \
+ s-linux.ads<s-linux-mipsel.ads \
+ s-osinte.adb<s-osinte-posix.adb \
+ s-osinte.ads<s-osinte-linux.ads \
+ s-osprim.adb<s-osprim-posix.adb \
+ s-taprop.adb<s-taprop-linux.adb \
+ s-tasinf.ads<s-tasinf-linux.ads \
+ s-tasinf.adb<s-tasinf-linux.adb \
+ s-taspri.ads<s-taspri-posix-noaltstack.ads \
+ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
+ g-sercom.adb<g-sercom-linux.adb
+
+ LIBGNAT_TARGET_PAIRS_32 = \
system.ads<system-linux-mipsel.ads
+ LIBGNAT_TARGET_PAIRS_64 = \
+ system.ads<system-linux-mips64el.ads
+
+ ifeq ($(strip $(shell $(GCC_FOR_TARGET) $(GNATLIBCFLAGS) -print-multi-os-directory)),../lib64)
+ LIBGNAT_TARGET_PAIRS = \
+ $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
+ else
+ LIBGNAT_TARGET_PAIRS = \
+ $(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
+ endif
+
TOOLS_TARGET_PAIRS = \
mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
indepsw.adb<indepsw-gnu.adb
@@ -2081,6 +2143,8 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
# of $(INSTALL_DATA). The latter may force a mode inappropriate
# for shared libraries on some targets, e.g. on HP-UX where the x
# permission is required.
+# Also install the .dSYM directories if they exist (these directories
+# contain the debug information for the shared libraries on darwin)
for file in gnat gnarl; do \
if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
$(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
@@ -2090,6 +2154,10 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
$(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
fi; \
+ if [ -d rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \
+ $(CP) -r rts/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \
+ $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+ fi; \
done
# This copy must be done preserving the date on the original file.
for file in $(RTSDIR)/*.ad?; do \
@@ -2297,6 +2365,8 @@ gnatlib-shared-darwin:
libgnat$(soext)
cd $(RTSDIR); $(LN_S) libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
libgnarl$(soext)
+ cd rts; dsymutil libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
+ cd rts; dsymutil libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext)
gnatlib-shared-vms:
$(MAKE) $(FLAGS_TO_PASS) \
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index f8fb53ab9a1..4dec895d1bc 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -512,7 +512,7 @@ begin
-- If we have a corresponding spec, and it comes from source
-- or it is not a generated spec for a child subprogram body,
- -- then we need object code for the spec unit as well
+ -- then we need object code for the spec unit as well.
if Nkind (Unit (Main_Unit_Node)) in N_Unit_Body
and then not Acts_As_Spec (Main_Unit_Node)
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 81b6a1140bc..2ff9c117680 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -222,6 +222,7 @@ Implementation Defined Attributes
* AST_Entry::
* Bit::
* Bit_Position::
+* Compiler_Version::
* Code_Address::
* Default_Bit_Order::
* Elaborated::
@@ -1502,7 +1503,7 @@ equality operators defined (such operations can be imported or declared
as subprograms as required). Initialization is allowed only by constructor
functions (see pragma @code{CPP_Constructor}). Such types are implicitly
limited if not explicitly declared as limited or derived from a limited
-type, and a warning is issued in that case.
+type, and an error is issued in that case.
Pragma @code{CPP_Class} is intended primarily for automatic generation
using an automatic binding generator tool.
@@ -1542,47 +1543,16 @@ must be of one of the following forms:
@end itemize
@noindent
-where @var{T} is a tagged type to which the pragma @code{CPP_Class} applies.
+where @var{T} is a tagged limited type imported from C++ with pragma
+@code{Import} and @code{Convention} = @code{CPP}.
The first form is the default constructor, used when an object of type
-@var{T} is created on the Ada side with no explicit constructor. Other
-constructors (including the copy constructor, which is simply a special
-case of the second form in which the one and only argument is of type
-@var{T}), can only appear in two contexts:
-
-@itemize @bullet
-@item
-On the right side of an initialization of an object of type @var{T}.
-@item
-In an extension aggregate for an object of a type derived from @var{T}.
-@end itemize
-
-@noindent
-Although the constructor is described as a function that returns a value
-on the Ada side, it is typically a procedure with an extra implicit
-argument (the object being initialized) at the implementation
-level. GNAT issues the appropriate call, whatever it is, to get the
-object properly initialized.
-
-In the case of derived objects, you may use one of two possible forms
-for declaring and creating an object:
-
-@itemize @bullet
-@item @code{New_Object : Derived_T}
-@item @code{New_Object : Derived_T := (@var{constructor-call with} @dots{})}
-@end itemize
-
-@noindent
-In the first case the default constructor is called and extension fields
-if any are initialized according to the default initialization
-expressions in the Ada declaration. In the second case, the given
-constructor is called and the extension aggregate indicates the explicit
-values of the extension fields.
+@var{T} is created on the Ada side with no explicit constructor. The
+second form covers all the non-default constructors of the type. See
+the GNAT users guide for details.
If no constructors are imported, it is impossible to create any objects
-on the Ada side. If no default constructor is imported, only the
-initialization forms using an explicit call to a constructor are
-permitted.
+on the Ada side and the type is implicitly declared abstract.
Pragma @code{CPP_Constructor} is intended primarily for automatic generation
using an automatic binding generator tool.
@@ -2440,7 +2410,8 @@ pragma Implicit_Packing;
@noindent
This is a configuration pragma that requests implicit packing for packed
arrays for which a size clause is given but no explicit pragma Pack or
-specification of Component_Size is present. Consider this example:
+specification of Component_Size is present. It also applies to records
+where no record representation clause is present. Consider this example:
@smallexample @c ada
type R is array (0 .. 7) of Boolean;
@@ -2462,6 +2433,21 @@ specify the exact size that corresponds to the length of the array multiplied
by the size in bits of the component type.
@cindex Array packing
+Similarly, the following example shows the use in the record case
+
+@smallexample @c ada
+type r is record
+ a, b, c, d, e, f, g, h : boolean;
+ chr : character;
+end record;
+for r'size use 16;
+@end smallexample
+
+@noindent
+Without a pragma Pack, each Boolean field requires 8 bits, so the
+minimum size is 72 bits, but with a pragma Pack, 16 bits would be
+sufficient. The use of pragma Implciit_Packing allows this record
+declaration to compile without an explicit pragma Pack.
@node Pragma Import_Exception
@unnumberedsec Pragma Import_Exception
@cindex OpenVMS
@@ -5162,6 +5148,8 @@ A turn off all optional warnings
.A turn off warnings for failing assertions
b turn on warnings for bad fixed value (not multiple of small)
B* turn off warnings for bad fixed value (not multiple of small)
+.b* turn on warnings for biased representation
+.B turn off warnings for biased representation
c turn on warnings for constant conditional
C* turn off warnings for constant conditional
.c turn on warnings for unrepped components
@@ -5169,6 +5157,7 @@ C* turn off warnings for constant conditional
d turn on warnings for implicit dereference
D* turn off warnings for implicit dereference
e treat all warnings as errors
+.e turn on every optional warning
f turn on warnings for unreferenced formal
F* turn off warnings for unreferenced formal
g* turn on warnings for unrecognized pragma
@@ -5192,6 +5181,8 @@ O turn off warnings for address clause overlay
.O* turn off warnings for out parameters assigned but not read
p turn on warnings for ineffective pragma Inline in frontend
P* turn off warnings for ineffective pragma Inline in frontend
+.p turn on warnings for parameter ordering
+.P* turn off warnings for parameter ordering
q* turn on warnings for questionable missing parentheses
Q turn off warnings for questionable missing parentheses
r turn on warnings for redundant construct
@@ -5207,6 +5198,8 @@ v* turn on warnings for unassigned variable
V turn off warnings for unassigned variable
w* turn on warnings for wrong low bound assumption
W turn off warnings for wrong low bound assumption
+.w turn on warnings for unnecessary Warnings Off pragmas
+.W* turn off warnings for unnecessary Warnings Off pragmas
x* turn on warnings for export/import
X turn off warnings for export/import
.x turn on warnings for non-local exceptions
@@ -5360,6 +5353,7 @@ consideration, you should minimize the use of these attributes.
* AST_Entry::
* Bit::
* Bit_Position::
+* Compiler_Version::
* Code_Address::
* Default_Bit_Order::
* Elaborated::
@@ -5512,6 +5506,15 @@ type @code{Universal_Integer}. The value depends only on the field
@var{C} and is independent of the alignment of
the containing record @var{R}.
+@node Compiler_Version
+@unnumberedsec Compiler_Version
+@findex Compiler_Version
+@noindent
+@code{Standard'Compiler_Version} (@code{Standard} is the only allowed
+prefix) yields a static string identifying the version of the compiler
+being used to compile the unit containing the attribute reference. A
+typical result would be something like "GNAT Pro 6.3.0w (20090221)".
+
@node Code_Address
@unnumberedsec Code_Address
@findex Code_Address
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index df66228bb00..4e5e2141fda 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -14,7 +14,7 @@
@setfilename gnat_ugn.info
@copying
-Copyright @copyright{} 1995-2005, 2006, 2007, 2008 Free Software Foundation,
+Copyright @copyright{} 1995-2009 Free Software Foundation,
Inc.
Permission is granted to copy, distribute and/or modify this document
@@ -2976,6 +2976,7 @@ with a new C++ compiler.
* Interfacing to C++::
* Linking a Mixed C++ & Ada Program::
* A Simple Example::
+* Interfacing with C++ constructors::
* Interfacing with C++ at the Class Level::
@end menu
@@ -2991,17 +2992,18 @@ Interface ---see http://www.codesourcery.com/archives/cxx-abi).
Interfacing can be done at 3 levels: simple data, subprograms, and
classes. In the first two cases, GNAT offers a specific @code{Convention
C_Plus_Plus} (or @code{CPP}) that behaves exactly like @code{Convention C}.
-Usually, C++ mangles the names of subprograms, and currently, GNAT does
-not provide any help to solve the demangling problem. This problem can be
-addressed in two ways:
+Usually, C++ mangles the names of subprograms. To generate proper mangled
+names automatically, see @ref{Generating Ada Bindings for C and C++ headers}).
+This problem can also be addressed manually in two ways:
+
@itemize @bullet
@item
by modifying the C++ code in order to force a C convention using
the @code{extern "C"} syntax.
@item
-by figuring out the mangled name and use it as the Link_Name argument of
-the pragma import.
+by figuring out the mangled name (using e.g. @command{nm}) and using it as the
+Link_Name argument of the pragma import.
@end itemize
@noindent
@@ -3024,15 +3026,17 @@ considered:
@item
Using GNAT and G++ (GNU C++ compiler) from the same GCC installation:
The C++ linker can simply be called by using the C++ specific driver
-called @code{c++}. Note that this setup is not very common because it
-may involve recompiling the whole GCC tree from sources, which makes it
-harder to upgrade the compilation system for one language without
-destabilizing the other.
+called @code{g++}.
+
+Note that if the C++ code uses inline functions, you will need to
+compile your C++ code with the @code{-fkeep-inline-functions} switch in
+order to provide an existing function implementation that the Ada code can
+link with.
@smallexample
-$ c++ -c file1.C
-$ c++ -c file2.C
-$ gnatmake ada_unit -largs file1.o file2.o --LINK=c++
+$ g++ -c -fkeep-inline-functions file1.C
+$ g++ -c -fkeep-inline-functions file2.C
+$ gnatmake ada_unit -largs file1.o file2.o --LINK=g++
@end smallexample
@item
@@ -3104,6 +3108,10 @@ a pre-linking phase using GNAT will be necessary.
@end enumerate
+Another alternative is to use the @command{gprbuild} multi-language builder
+which has a large knowledge base and knows how to link Ada and C++ code
+together automatically in most cases.
+
@node A Simple Example
@subsection A Simple Example
@noindent
@@ -3121,10 +3129,10 @@ languages.
Here are the compilation commands:
@smallexample
$ gnatmake -c simple_cpp_interface
-$ c++ -c cpp_main.C
-$ c++ -c ex7.C
+$ g++ -c cpp_main.C
+$ g++ -c ex7.C
$ gnatbind -n simple_cpp_interface
-$ gnatlink simple_cpp_interface -o cpp_main --LINK=$(CPLUSPLUS)
+$ gnatlink simple_cpp_interface -o cpp_main --LINK=g++
-lstdc++ ex7.o cpp_main.o
@end smallexample
@@ -3228,6 +3236,197 @@ package Simple_Cpp_Interface is
end Simple_Cpp_Interface;
@end smallexample
+@node Interfacing with C++ constructors
+@subsection Interfacing with C++ constructors
+@noindent
+
+In order to interface with C++ constructors GNAT provides the
+@code{pragma CPP_Constructor} (@xref{Interfacing to C++,,,
+gnat_rm, GNAT Reference Manual}, for additional information).
+In this section we present some common uses of C++ constructors
+in mixed-languages programs in GNAT.
+
+Let us assume that we need to interface with the following
+C++ class:
+
+@smallexample
+@b{class} Root @{
+@b{public}:
+ int a_value;
+ int b_value;
+ @b{virtual} int Get_Value ();
+ Root(); // Default constructor
+ Root(int v); // 1st non-default constructor
+ Root(int v, int w); // 2nd non-default constructor
+@};
+@end smallexample
+
+For this purpose we can write the following package spec (further
+information on how to build this spec is available in
+@ref{Interfacing with C++ at the Class Level} and
+@ref{Generating Ada Bindings for C and C++ headers}).
+
+@smallexample @c ada
+with Interfaces.C; use Interfaces.C;
+package Pkg_Root is
+ type Root is tagged limited record
+ A_Value : int;
+ B_Value : int;
+ end record;
+ pragma Import (CPP, Root);
+
+ function Get_Value (Obj : Root) return int;
+ pragma Import (CPP, Get_Value);
+
+ function Constructor return Root'Class;
+ pragma Cpp_Constructor (Constructor, "_ZN4RootC1Ev");
+
+ function Constructor (v : Integer) return Root'Class;
+ pragma Cpp_Constructor (Constructor, "_ZN4RootC1Ei");
+
+ function Constructor (v, w : Integer) return Root'Class;
+ pragma Cpp_Constructor (Constructor, "_ZN4RootC1Eii");
+end Pkg_Root;
+@end smallexample
+
+On the Ada side the constructor is represented by a function (whose
+name is arbitrary) that returns the classwide type corresponding to
+the imported C++ class. Although the constructor is described as a
+function, it is typically a procedure with an extra implicit argument
+(the object being initialized) at the implementation level. GNAT
+issues the appropriate call, whatever it is, to get the object
+properly initialized.
+
+Constructors can only appear in the following contexts:
+
+@itemize @bullet
+@item
+On the right side of an initialization of an object of type @var{T}.
+@item
+On the right side of an initialization of a record component of type @var{T}.
+@item
+In an Ada 2005 limited aggregate.
+@item
+In an Ada 2005 nested limited aggregate.
+@item
+In an Ada 2005 limited aggregate that initializes an object built in
+place by an extended return statement.
+@end itemize
+
+@noindent
+In a declaration of an object whose type is a class imported from C++,
+either the default C++ constructor is implicitly called by GNAT, or
+else the required C++ constructor must be explicitly called in the
+expression that initializes the object. For example:
+
+@smallexample @c ada
+ Obj1 : Root;
+ Obj2 : Root := Constructor;
+ Obj3 : Root := Constructor (v => 10);
+ Obj4 : Root := Constructor (30, 40);
+@end smallexample
+
+The first two declarations are equivalent: in both cases the default C++
+constructor is invoked (in the former case the call to the constructor is
+implicit, and in the latter case the call is explicit in the object
+declaration). @code{Obj3} is initialized by the C++ non-default constructor
+that takes an integer argument, and @code{Obj4} is initialized by the
+non-default C++ constructor that takes two integers.
+
+Let us derive the imported C++ class in the Ada side. For example:
+
+@smallexample @c ada
+ type DT is new Root with record
+ C_Value : Natural := 2009;
+ end record;
+@end smallexample
+
+In this case the components DT inherited from the C++ side must be
+initialized by a C++ constructor, and the additional Ada components
+of type DT are initialized by GNAT. The initialization of such an
+object is done either by default, or by means of a function returning
+an aggregate of type DT, or by means of an extension aggregate.
+
+@smallexample @c ada
+ Obj5 : DT;
+ Obj6 : DT := Function_Returning_DT (50);
+ Obj7 : DT := (Constructor (30,40) with C_Value => 50);
+@end smallexample
+
+The declaration of @code{Obj5} invokes the default constructors: the
+C++ default constructor of the parent type takes care of the initialization
+of the components inherited from Root, and GNAT takes care of the default
+initialization of the additional Ada components of type DT (that is,
+@code{C_Value} is initialized to value 2009). The order of invocation of
+the constructors is consistent with the order of elaboration required by
+Ada and C++. That is, the constructor of the parent type is always called
+before the constructor of the derived type.
+
+Let us now consider a record that has components whose type is imported
+from C++. For example:
+
+@smallexample @c ada
+ type Rec1 is limited record
+ Data1 : Root := Constructor (10);
+ Value : Natural := 1000;
+ end record;
+
+ type Rec2 (D : Integer := 20) is limited record
+ Rec : Rec1;
+ Data2 : Root := Constructor (D, 30);
+ end record;
+@end smallexample
+
+The initialization of an object of type @code{Rec2} will call the
+non-default C++ constructors specified for the imported components.
+For example:
+
+@smallexample @c ada
+ Obj8 : Rec2 (40);
+@end smallexample
+
+Using Ada 2005 we can use limited aggregates to initialize an object
+invoking C++ constructors that differ from those specified in the type
+declarations. For example:
+
+@smallexample @c ada
+ Obj9 : Rec2 := (Rec => (Data1 => Constructor (15, 16),
+ others => <>),
+ others => <>);
+@end smallexample
+
+The above declaration uses an Ada 2005 limited aggregate to
+initialize @code{Obj9}, and the C++ constructor that has two integer
+arguments is invoked to initialize the @code{Data1} component instead
+of the constructor specified in the declaration of type @code{Rec1}. In
+Ada 2005 the box in the aggregate indicates that unspecified components
+are initialized using the expression (if any) available in the component
+declaration. That is, in this case discriminant @code{D} is initialized
+to value @code{20}, @code{Value} is initialized to value 1000, and the
+non-default C++ constructor that handles two integers takes care of
+initializing component @code{Data2} with values @code{20,30}.
+
+In Ada 2005 we can use the extended return statement to build the Ada
+equivalent to C++ non-default constructors. For example:
+
+@smallexample @c ada
+ function Constructor (V : Integer) return Rec2 is
+ begin
+ return Obj : Rec2 := (Rec => (Data1 => Constructor (V, 20),
+ others => <>),
+ others => <>) do
+ -- Further actions required for construction of
+ -- objects of type Rec2
+ ...
+ end record;
+ end Constructor;
+@end smallexample
+
+In this example the extended return statement construct is used to
+build in place the returned object whose components are initialized
+by means of a limited aggregate. Any further action associated with
+the constructor can be placed inside the construct.
+
@node Interfacing with C++ at the Class Level
@subsection Interfacing with C++ at the Class Level
@noindent
@@ -3997,11 +4196,17 @@ see @ref{Character Set Control}.
@item ^-gnatI^/IGNORE_REP_CLAUSES^
@cindex @option{^-gnatI^IGNORE_REP_CLAUSES^} (@command{gcc})
-Ignore representation clauses. When this switch is used, all
+Ignore representation clauses. When this switch is used,
representation clauses are treated as comments. This is useful
when initially porting code where you want to ignore rep clause
problems, and also for compiling foreign code (particularly
-for use with ASIS).
+for use with ASIS). The representation clauses that are ignored
+are: enumeration_representation_clause, record_representation_clause,
+and attribute_definition_clause for the following attributes:
+Address, Alignment, Bit_Order, Component_Size, Machine_Radix,
+Object_Size, Size, Small, Stream_Size, and Value_Size.
+Note that this option should be used only for compiling -- the
+code is likely to malfunction at run time.
@item -gnatjnn
@cindex @option{-gnatjnn} (@command{gcc})
@@ -5285,6 +5490,20 @@ The default is that warnings for redundant constructs are not given.
@cindex @option{-gnatwR} (@command{gcc})
This switch suppresses warnings for redundant constructs.
+@item -gnatw.r
+@emph{Activate warnings for object renaming function.}
+@cindex @option{-gnatw.r} (@command{gcc})
+This switch activates warnings for an object renaming that renames a
+function call, which is equivalent to a constant declaration (as
+opposed to renaming the function itself). The default is that these
+warnings are given. This warning can also be turned on using
+@option{-gnatwa}.
+
+@item -gnatw.R
+@emph{Suppress warnings for object renaming function.}
+@cindex @option{-gnatwT} (@command{gcc})
+This switch suppresses warnings for object renaming function.
+
@item -gnatws
@emph{Suppress all warnings.}
@cindex @option{-gnatws} (@command{gcc})
@@ -17417,6 +17636,15 @@ bodies, task bodies, entry bodies and statement sequences in package bodies
Do not consider @code{exit} statements as @code{goto}s when
computing Essential Complexity
+@item ^--extra-exit-points^/EXTRA_EXIT_POINTS_ON^
+Report the extra exit points for subprogram bodies. As an exit point, this
+metric counts @code{return} statements and raise statements in case when the
+raised exception is not handled in the same body. In case of a function this
+metric subtracts 1 from the number of exit points, because a function body
+must contain at least one @code{return} statement.
+
+@item ^--no-extra-exit-points^/EXTRA_EXIT_POINTS_OFF^
+Do not report the extra exit points for subprogram bodies
@end table
@@ -20270,7 +20498,7 @@ output this info at program termination. Results are displayed in four
columns:
@noindent
-Index | Task Name | Stack Size | Actual Use [min - max]
+Index | Task Name | Stack Size | Stack Usage [Value +/- Variation]
@noindent
where:
@@ -20285,11 +20513,11 @@ is the name of the task analyzed.
@item Stack Size
is the maximum size for the stack.
-@item Actual Use
-is the measure done by the stack analyzer. In order to prevent overflow,
-the stack is not entirely analyzed, and it's not possible to know exactly how
-much has actually been used. The real amount of stack used is between the min
-and max values.
+@item Stack Usage
+is the measure done by the stack analyzer. In order to prevent overflow, the stack
+is not entirely analyzed, and it's not possible to know exactly how
+much has actually been used. The report thus contains the theoretical stack usage
+(Value) and the possible variation (Variation) around this value.
@end table
@@ -20665,6 +20893,7 @@ used as a parameter of the @option{+R} or @option{-R} options.
* Discriminated_Records::
* Enumeration_Ranges_In_CASE_Statements::
* Exceptions_As_Control_Flow::
+* Exits_From_Conditional_Loops::
* EXIT_Statements_With_No_Loop_Name::
* Expanded_Loop_Exit_Names::
* Explicit_Full_Discrete_Ranges::
@@ -20715,6 +20944,7 @@ used as a parameter of the @option{+R} or @option{-R} options.
* Slices::
* Unassigned_OUT_Parameters::
* Uncommented_BEGIN_In_Package_Bodies::
+* Unconditional_Exits::
* Unconstrained_Array_Returns::
* Universal_Ranges::
* Unnamed_Blocks_And_Loops::
@@ -20931,6 +21161,20 @@ package body, task body or entry body is not flagged.
The rule has no parameters.
+@node Exits_From_Conditional_Loops
+@subsection @code{Exits_From_Conditional_Loops}
+@cindex @code{Exits_From_Conditional_Loops} (for @command{gnatcheck})
+
+@noindent
+Flag any exit statement if it transfers the control out of a @code{for} loop
+or a @code{while} loop. This includes cases when the @code{exit} statement
+applies to a @code{FOR} or @code{while} loop, and cases when it is enclosed
+in some @code{for} or @code{while} loop, but transfers the control from some
+outer (inconditional) @code{loop} statement.
+
+The rule has no parameters.
+
+
@node EXIT_Statements_With_No_Loop_Name
@subsection @code{EXIT_Statements_With_No_Loop_Name}
@cindex @code{EXIT_Statements_With_No_Loop_Name} (for @command{gnatcheck})
@@ -21312,6 +21556,11 @@ Specifies the suffix for a type name.
Specifies the suffix for an access type name. If
this parameter is set, it overrides for access
types the suffix set by the @code{Type_Suffix} parameter.
+For access types, @emph{string} may have the following format:
+@emph{suffix1(suffix2)}. That means that an access type name
+should have the @emph{suffix1} suffix except for the case when
+the designated type is also an access type, in this case the
+type name should have the @emph{suffix1 & suffix2} suffix.
@item Constant_Suffix=@emph{string}
Specifies the suffix for a constant name.
@@ -22029,6 +22278,14 @@ diagnostic message is attached to the line containing the first statement.
This rule has no parameters.
+@node Unconditional_Exits
+@subsection @code{Unconditional_Exits}
+@cindex @code{Unconditional_Exits} rule (for @command{gnatcheck})
+
+@noindent
+Flag unconditional @code{exit} statements.
+
+This rule has no parameters.
@node Unconstrained_Array_Returns
@subsection @code{Unconstrained_Array_Returns}
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 86cd0955c53..8194a42ed8d 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -26,6 +26,7 @@
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with Csets;
+with Makeutl;
with MLib.Tgt; use MLib.Tgt;
with MLib.Utl;
with MLib.Fil;
@@ -327,20 +328,19 @@ procedure GNATCmd is
if Add_Sources then
declare
Current_Last : constant Integer := Last_Switches.Last;
+ Proj : Project_List;
+
begin
-- Gnatstack needs to add the .ci file for the binder
-- generated files corresponding to all of the library projects
-- and main units belonging to the application.
if The_Command = Stack then
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Check_Project (Proj, Project) then
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ if Check_Project (Proj.Project, Project) then
declare
- Data : Project_Data renames
- Project_Tree.Projects.Table (Proj);
- Main : String_List_Id := Data.Mains;
+ Main : String_List_Id := Proj.Project.Mains;
File : String_Access;
begin
@@ -349,7 +349,8 @@ procedure GNATCmd is
while Main /= Nil_String loop
File :=
new String'
- (Get_Name_String (Data.Object_Directory.Name) &
+ (Get_Name_String
+ (Proj.Project.Object_Directory.Name) &
Directory_Separator &
B_Start.all &
MLib.Fil.Ext_To
@@ -367,7 +368,7 @@ procedure GNATCmd is
Project_Tree.String_Elements.Table (Main).Next;
end loop;
- if Data.Library then
+ if Proj.Project.Library then
-- Include the .ci file for the binder generated
-- files that contains the initialization and
@@ -375,10 +376,11 @@ procedure GNATCmd is
File :=
new String'
- (Get_Name_String (Data.Object_Directory.Name) &
+ (Get_Name_String
+ (Proj.Project.Object_Directory.Name) &
Directory_Separator &
B_Start.all &
- Get_Name_String (Data.Library_Name) &
+ Get_Name_String (Proj.Project.Library_Name) &
".ci");
if Is_Regular_File (File.all) then
@@ -388,6 +390,8 @@ procedure GNATCmd is
end if;
end;
end if;
+
+ Proj := Proj.Next;
end loop;
end if;
@@ -516,9 +520,8 @@ procedure GNATCmd is
Last_Switches.Table (Last_Switches.Last) :=
new String'
(Get_Name_String
- (Project_Tree.Projects.Table
- (Unit_Data.File_Names
- (Body_Part).Project).
+ (Unit_Data.File_Names
+ (Body_Part).Project.
Object_Directory.Name) &
Directory_Separator &
MLib.Fil.Ext_To
@@ -546,9 +549,8 @@ procedure GNATCmd is
Last_Switches.Table (Last_Switches.Last) :=
new String'
(Get_Name_String
- (Project_Tree.Projects.Table
- (Unit_Data.File_Names
- (Specification).Project).
+ (Unit_Data.File_Names
+ (Specification).Project.
Object_Directory.Name) &
Dir_Separator &
MLib.Fil.Ext_To
@@ -646,6 +648,8 @@ procedure GNATCmd is
(Project : Project_Id;
Root_Project : Project_Id) return Boolean
is
+ Proj : Project_Id;
+
begin
if Project = No_Project then
return False;
@@ -654,19 +658,14 @@ procedure GNATCmd is
return True;
elsif The_Command = Metric then
- declare
- Data : Project_Data;
-
- begin
- Data := Project_Tree.Projects.Table (Root_Project);
- while Data.Extends /= No_Project loop
- if Project = Data.Extends then
- return True;
- end if;
+ Proj := Root_Project;
+ while Proj.Extends /= No_Project loop
+ if Project = Proj.Extends then
+ return True;
+ end if;
- Data := Project_Tree.Projects.Table (Data.Extends);
- end loop;
- end;
+ Proj := Proj.Extends;
+ end loop;
end if;
return False;
@@ -690,8 +689,7 @@ procedure GNATCmd is
end if;
end loop;
- Get_Name_String (Project_Tree.Projects.Table
- (Project).Exec_Directory.Name);
+ Get_Name_String (Project.Exec_Directory.Name);
if Name_Buffer (Name_Len) /= Directory_Separator then
Name_Len := Name_Len + 1;
@@ -714,7 +712,7 @@ procedure GNATCmd is
begin
Prj.Env.Create_Config_Pragmas_File
(Project, Project, Project_Tree, Include_Config_Files => False);
- return Project_Tree.Projects.Table (Project).Config_File_Name;
+ return Project.Config_File_Name;
end Configuration_Pragmas_File;
------------------------------
@@ -723,6 +721,7 @@ procedure GNATCmd is
procedure Delete_Temp_Config_Files is
Success : Boolean;
+ Proj : Project_List;
pragma Warnings (Off, Success);
begin
@@ -731,27 +730,22 @@ procedure GNATCmd is
pragma Assert (not Keep_Temporary_Files);
if Project /= No_Project then
- for Prj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if
- Project_Tree.Projects.Table (Prj).Config_File_Temp
- then
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ if Proj.Project.Config_File_Temp then
if Verbose_Mode then
Output.Write_Str ("Deleting temp configuration file """);
Output.Write_Str
- (Get_Name_String
- (Project_Tree.Projects.Table
- (Prj).Config_File_Name));
+ (Get_Name_String (Proj.Project.Config_File_Name));
Output.Write_Line ("""");
end if;
Delete_File
- (Name =>
- Get_Name_String
- (Project_Tree.Projects.Table (Prj).Config_File_Name),
+ (Name => Get_Name_String (Proj.Project.Config_File_Name),
Success => Success);
end if;
+
+ Proj := Proj.Next;
end loop;
end if;
@@ -946,7 +940,7 @@ procedure GNATCmd is
-- Check if there are library project files
if MLib.Tgt.Support_For_Libraries /= None then
- Set_Libraries (Project, Project_Tree, Libraries_Present);
+ Set_Libraries (Project, Libraries_Present);
end if;
-- If there are, add the necessary additional switches
@@ -993,7 +987,7 @@ procedure GNATCmd is
Last_Switches.Table (Index).all);
end loop;
- -- One switch for the standard GNAT library dir.
+ -- One switch for the standard GNAT library dir
Last_Switches.Increment_Last;
Last_Switches.Table
@@ -1129,9 +1123,7 @@ procedure GNATCmd is
Project_Loop : loop
declare
Dir : constant String :=
- Get_Name_String
- (Project_Tree.Projects.Table
- (Prj).Object_Directory.Name);
+ Get_Name_String (Prj.Object_Directory.Name);
begin
if Is_Regular_File
(Dir &
@@ -1154,8 +1146,7 @@ procedure GNATCmd is
-- Go to the project being extended, if any
- Prj :=
- Project_Tree.Projects.Table (Prj).Extends;
+ Prj := Prj.Extends;
exit Project_Loop when Prj = No_Project;
end loop Project_Loop;
end if;
@@ -1210,9 +1201,7 @@ procedure GNATCmd is
Last_Switches.Increment_Last;
Last_Switches.Table (Last_Switches.Last) :=
new String'("-o");
- Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Exec_Directory.Name);
+ Get_Name_String (Project.Exec_Directory.Name);
Last_Switches.Increment_Last;
Last_Switches.Table (Last_Switches.Last) :=
new String'(Name_Buffer (1 .. Name_Len) &
@@ -1240,39 +1229,30 @@ procedure GNATCmd is
begin
-- Case of library project
- if Project_Tree.Projects.Table (Project).Library then
+ if Project.Library then
Libraries_Present := True;
-- Add the -L switch
Last_Switches.Increment_Last;
Last_Switches.Table (Last_Switches.Last) :=
- new String'("-L" &
- Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Library_Dir.Name));
+ new String'("-L" & Get_Name_String (Project.Library_Dir.Name));
-- Add the -l switch
Last_Switches.Increment_Last;
Last_Switches.Table (Last_Switches.Last) :=
- new String'("-l" &
- Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Library_Name));
+ new String'("-l" & Get_Name_String (Project.Library_Name));
-- Add the directory to table Library_Paths, to be processed later
-- if library is not static and if Path_Option is not null.
- if Project_Tree.Projects.Table (Project).Library_Kind /=
- Static
+ if Project.Library_Kind /= Static
and then Path_Option /= null
then
Library_Paths.Increment_Last;
Library_Paths.Table (Library_Paths.Last) :=
- new String'(Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Library_Dir.Name));
+ new String'(Get_Name_String (Project.Library_Dir.Name));
end if;
end if;
end Set_Library_For;
@@ -1286,61 +1266,8 @@ procedure GNATCmd is
Parent : String)
is
begin
- if Switch /= null then
-
- declare
- Sw : String (1 .. Switch'Length);
- Start : Positive := 1;
-
- begin
- Sw := Switch.all;
-
- if Sw (1) = '-' then
- if Sw'Length >= 3
- and then (Sw (2) = 'A' or else
- Sw (2) = 'I' or else
- Sw (2) = 'L')
- then
- Start := 3;
-
- if Sw = "-I-" then
- return;
- end if;
-
- elsif Sw'Length >= 4
- and then (Sw (2 .. 3) = "aL" or else
- Sw (2 .. 3) = "aO" or else
- Sw (2 .. 3) = "aI")
- then
- Start := 4;
-
- elsif Sw'Length >= 7
- and then Sw (2 .. 6) = "-RTS="
- then
- Start := 7;
- else
- return;
- end if;
- end if;
-
- -- If the path is relative, test if it includes directory
- -- information. If it does, prepend Parent to the path.
-
- if not Is_Absolute_Path (Sw (Start .. Sw'Last)) then
- for J in Start .. Sw'Last loop
- if Sw (J) = Directory_Separator then
- Switch :=
- new String'
- (Sw (1 .. Start - 1) &
- Parent &
- Directory_Separator &
- Sw (Start .. Sw'Last));
- return;
- end if;
- end loop;
- end if;
- end;
- end if;
+ Makeutl.Test_If_Relative_Path
+ (Switch, Parent, Including_Non_Switch => False, Including_RTS => True);
end Test_If_Relative_Path;
-------------------
@@ -1733,15 +1660,17 @@ begin
-- --subdirs=... Specify Subdirs
- if Argv'Length > Subdirs_Option'Length and then
+ if Argv'Length > Makeutl.Subdirs_Option'Length and then
Argv
- (Argv'First .. Argv'First + Subdirs_Option'Length - 1) =
- Subdirs_Option
+ (Argv'First ..
+ Argv'First + Makeutl.Subdirs_Option'Length - 1) =
+ Makeutl.Subdirs_Option
then
Subdirs :=
new String'
(Argv
- (Argv'First + Subdirs_Option'Length .. Argv'Last));
+ (Argv'First + Makeutl.Subdirs_Option'Length ..
+ Argv'Last));
Remove_Switch (Arg_Num);
@@ -1905,7 +1834,8 @@ begin
(Project => Project,
In_Tree => Project_Tree,
Project_File_Name => Project_File.all,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => False);
if Project = Prj.No_Project then
Fail ("""" & Project_File.all & """ processing failed");
@@ -1915,13 +1845,10 @@ begin
-- file and if there is one, get the switches, if any, and scan them.
declare
- Data : constant Prj.Project_Data :=
- Project_Tree.Projects.Table (Project);
-
Pkg : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Tool_Package_Name,
- In_Packages => Data.Decl.Packages,
+ In_Packages => Project.Decl.Packages,
In_Tree => Project_Tree);
Element : Package_Element;
@@ -2019,10 +1946,7 @@ begin
or else The_Command = Link
or else The_Command = Elim
then
- Change_Dir
- (Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Object_Directory.Name));
+ Change_Dir (Get_Name_String (Project.Object_Directory.Name));
end if;
-- Set up the env vars for project path files
@@ -2044,13 +1968,10 @@ begin
-- Carg_Switches table.
declare
- Data : constant Prj.Project_Data :=
- Project_Tree.Projects.Table (Project);
-
Pkg : constant Prj.Package_Id :=
Prj.Util.Value_Of
(Name => Name_Compiler,
- In_Packages => Data.Decl.Packages,
+ In_Packages => Project.Decl.Packages,
In_Tree => Project_Tree);
Element : Package_Element;
@@ -2234,8 +2155,7 @@ begin
(Last_Switches.Table (J), Current_Work_Dir);
end loop;
- Get_Name_String
- (Project_Tree.Projects.Table (Project).Directory.Name);
+ Get_Name_String (Project.Directory.Name);
declare
Project_Dir : constant String := Name_Buffer (1 .. Name_Len);
@@ -2248,8 +2168,6 @@ begin
elsif The_Command = Stub then
declare
- Data : constant Prj.Project_Data :=
- Project_Tree.Projects.Table (Project);
File_Index : Integer := 0;
Dir_Index : Integer := 0;
Last : constant Integer := Last_Switches.Last;
@@ -2269,7 +2187,7 @@ begin
-- indicate to gnatstub the name of the body file with
-- a -o switch.
- if Body_Suffix_Id_Of (Project_Tree, Name_Ada, Data.Naming) /=
+ if Body_Suffix_Id_Of (Project_Tree, Name_Ada, Project.Naming) /=
Prj.Default_Ada_Spec_Suffix
then
if File_Index /= 0 then
@@ -2281,7 +2199,7 @@ begin
begin
Get_Name_String
(Spec_Suffix_Id_Of
- (Project_Tree, Name_Ada, Data.Naming));
+ (Project_Tree, Name_Ada, Project.Naming));
if Spec'Length > Name_Len
and then Spec (Last - Name_Len + 1 .. Last) =
@@ -2290,7 +2208,7 @@ begin
Last := Last - Name_Len;
Get_Name_String
(Body_Suffix_Id_Of
- (Project_Tree, Name_Ada, Data.Naming));
+ (Project_Tree, Name_Ada, Project.Naming));
Last_Switches.Increment_Last;
Last_Switches.Table (Last_Switches.Last) :=
new String'("-o");
@@ -2334,18 +2252,14 @@ begin
-- if there is no object directory available.
if The_Command = Metric
- and then
- Project_Tree.Projects.Table (Project).Object_Directory /=
- No_Path_Information
+ and then Project.Object_Directory /= No_Path_Information
then
First_Switches.Increment_Last;
First_Switches.Table (2 .. First_Switches.Last) :=
First_Switches.Table (1 .. First_Switches.Last - 1);
First_Switches.Table (1) :=
new String'("-d=" &
- Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Object_Directory.Name));
+ Get_Name_String (Project.Object_Directory.Name));
end if;
-- For gnat check, -rules and the following switches need to be the
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 16a9662b8e1..1a24b673a24 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -2102,7 +2102,7 @@ __gnat_install_handler(void)
#include <mach/vm_statistics.h>
/* This must be in keeping with System.OS_Interface.Alternate_Stack_Size. */
-char __gnat_alternate_stack[64 * 1024]; /* 2 * MINSIGSTKSZ */
+char __gnat_alternate_stack[32 * 1024]; /* 1 * MINSIGSTKSZ */
static void __gnat_error_handler (int sig, siginfo_t * si, void * uc);
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 8ad15bd8e91..ccad170c108 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -78,9 +78,38 @@ extern void __gnat_plist_init (void);
#define EXPAND_ARGV_RATE 128
static void
-append_arg (int *index, LPWSTR value, char ***argv, int *last)
+append_arg (int *index, LPWSTR dir, LPWSTR value,
+ char ***argv, int *last, int quoted)
{
int size;
+ LPWSTR fullvalue;
+ int vallen = _tcslen (value);
+ int dirlen;
+
+ if (dir == NULL)
+ {
+ /* no dir prefix */
+ dirlen = 0;
+ fullvalue = xmalloc ((vallen + 1) * sizeof(TCHAR));
+ }
+ else
+ {
+ /* Add dir first */
+ dirlen = _tcslen (dir);
+
+ fullvalue = xmalloc ((dirlen + vallen + 1) * sizeof(TCHAR));
+ _tcscpy (fullvalue, dir);
+ }
+
+ /* Append value */
+
+ if (quoted)
+ {
+ _tcsncpy (fullvalue + dirlen, value + 1, vallen - 1);
+ fullvalue [dirlen + vallen - sizeof(TCHAR)] = _T('\0');
+ }
+ else
+ _tcscpy (fullvalue + dirlen, value);
if (*last <= *index)
{
@@ -88,9 +117,11 @@ append_arg (int *index, LPWSTR value, char ***argv, int *last)
*argv = (char **) xrealloc (*argv, (*last) * sizeof (char *));
}
- size = WS2SC (NULL, value, 0);
- (*argv)[*index] = (char *) xmalloc (size + 1);
- WS2SC ((*argv)[*index], value, size);
+ size = WS2SC (NULL, fullvalue, 0);
+ (*argv)[*index] = (char *) xmalloc (size + sizeof(TCHAR));
+ WS2SC ((*argv)[*index], fullvalue, size);
+
+ free (fullvalue);
(*index)++;
}
@@ -130,6 +161,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
int last;
int argc_expanded = 0;
TCHAR result [MAX_PATH];
+ int quoted;
wargv = CommandLineToArgvW (GetCommandLineW(), &wargc);
@@ -142,39 +174,65 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
/* argv[0] is the executable full path-name. */
SearchPath (NULL, wargv[0], _T(".exe"), MAX_PATH, result, NULL);
- append_arg (&argc_expanded, result, &gnat_argv, &last);
+ append_arg (&argc_expanded, NULL, result, &gnat_argv, &last, 0);
for (k=1; k<wargc; k++)
{
- /* Check for wildcard expansion. */
- if (_tcsstr (wargv[k], _T("?")) != 0 ||
- _tcsstr (wargv[k], _T("*")) != 0)
+ quoted = (wargv[k][0] == _T('\''));
+
+ /* Check for wildcard expansion if the argument is not quoted. */
+ if (!quoted
+ && (_tcsstr (wargv[k], _T("?")) != 0 ||
+ _tcsstr (wargv[k], _T("*")) != 0))
{
/* Wilcards are present, append all corresponding matches. */
WIN32_FIND_DATA FileData;
HANDLE hDir = FindFirstFile (wargv[k], &FileData);
+ LPWSTR dir = NULL;
+ LPWSTR ldir = _tcsrchr (wargv[k], _T('\\'));
+
+ if (ldir == NULL)
+ ldir = _tcsrchr (wargv[k], _T('/'));
if (hDir == INVALID_HANDLE_VALUE)
{
/* No match, append arg as-is. */
- append_arg (&argc_expanded, wargv[k], &gnat_argv, &last);
+ append_arg (&argc_expanded, NULL, wargv[k],
+ &gnat_argv, &last, quoted);
}
else
{
+ if (ldir != NULL)
+ {
+ int n = ldir - wargv[k] + 1;
+ dir = xmalloc ((n + 1) * sizeof (TCHAR));
+ _tcsncpy (dir, wargv[k], n);
+ dir[n] = _T('\0');
+ }
+
/* Append first match and all remaining ones. */
do {
- append_arg (&argc_expanded,
- FileData.cFileName, &gnat_argv, &last);
+ /* Do not add . and .. special entries */
+
+ if (_tcscmp (FileData.cFileName, _T(".")) != 0
+ && _tcscmp (FileData.cFileName, _T("..")) != 0)
+ append_arg (&argc_expanded, dir, FileData.cFileName,
+ &gnat_argv, &last, 0);
} while (FindNextFile (hDir, &FileData));
FindClose (hDir);
+
+ if (dir != NULL)
+ free (dir);
}
}
else
{
- /* No wildcard. Store parameter as-is. */
- append_arg (&argc_expanded, wargv[k], &gnat_argv, &last);
+ /* No wildcard. Store parameter as-is. Remove quote if
+ needed. */
+ append_arg (&argc_expanded, NULL, wargv[k],
+ &gnat_argv, &last, quoted);
}
}
diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb
index 1d0c2d4e79d..ee956dc3f77 100644
--- a/gcc/ada/lib-load.adb
+++ b/gcc/ada/lib-load.adb
@@ -724,7 +724,7 @@ package body Lib.Load is
Check_Restricted_Unit (Load_Name, Error_Node);
Error_Msg_Unit_1 := Uname_Actual;
- Error_Msg
+ Error_Msg -- CODEFIX
("$$ is not a predefined library unit", Load_Msg_Sloc);
else
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index fac48642569..0e45e2e2bf6 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1998-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -93,6 +93,16 @@ package body Lib.Xref is
Table_Increment => Alloc.Xrefs_Increment,
Table_Name => "Xrefs");
+ ------------------------
+ -- Local Subprograms --
+ ------------------------
+
+ procedure Generate_Prim_Op_References (Typ : Entity_Id);
+ -- For a tagged type, generate implicit references to its primitive
+ -- operations, for source navigation. This is done right before emitting
+ -- cross-reference information rather than at the freeze point of the type
+ -- in order to handle late bodies that are primitive operations.
+
-------------------------
-- Generate_Definition --
-------------------------
@@ -196,6 +206,72 @@ package body Lib.Xref is
end if;
end Generate_Operator_Reference;
+ ---------------------------------
+ -- Generate_Prim_Op_References --
+ ---------------------------------
+
+ procedure Generate_Prim_Op_References (Typ : Entity_Id) is
+ Base_T : Entity_Id;
+ Prim : Elmt_Id;
+ Prim_List : Elist_Id;
+ Ent : Entity_Id;
+
+ begin
+ -- Handle subtypes of synchronized types
+
+ if Ekind (Typ) = E_Protected_Subtype
+ or else Ekind (Typ) = E_Task_Subtype
+ then
+ Base_T := Etype (Typ);
+ else
+ Base_T := Typ;
+ end if;
+
+ -- References to primitive operations are only relevant for tagged types
+
+ if not Is_Tagged_Type (Base_T)
+ or else Is_Class_Wide_Type (Base_T)
+ then
+ return;
+ end if;
+
+ -- Ada 2005 (AI-345): For synchronized types generate reference
+ -- to the wrapper that allow us to dispatch calls through their
+ -- implemented abstract interface types.
+
+ -- The check for Present here is to protect against previously
+ -- reported critical errors.
+
+ if Is_Concurrent_Type (Base_T)
+ and then Present (Corresponding_Record_Type (Base_T))
+ then
+ Prim_List := Primitive_Operations
+ (Corresponding_Record_Type (Base_T));
+ else
+ Prim_List := Primitive_Operations (Base_T);
+ end if;
+
+ if No (Prim_List) then
+ return;
+ end if;
+
+ Prim := First_Elmt (Prim_List);
+ while Present (Prim) loop
+
+ -- If the operation is derived, get the original for cross-reference
+ -- reference purposes (it is the original for which we want the xref
+ -- and for which the comes_from_source test must be performed).
+
+ Ent := Node (Prim);
+ while Present (Alias (Ent)) loop
+ Ent := Alias (Ent);
+ end loop;
+
+ Generate_Reference (Typ, Ent, 'p', Set_Ref => False);
+ Next_Elmt (Prim);
+ end loop;
+ end Generate_Prim_Op_References;
+
------------------------
-- Generate_Reference --
------------------------
@@ -1083,6 +1159,26 @@ package body Lib.Xref is
return;
end if;
+ -- First we add references to the primitive operations of tagged
+ -- types declared in the main unit.
+
+ Handle_Prim_Ops : declare
+ Ent : Entity_Id;
+
+ begin
+ for J in 1 .. Xrefs.Last loop
+ Ent := Xrefs.Table (J).Ent;
+
+ if Is_Type (Ent)
+ and then Is_Tagged_Type (Ent)
+ and then Ent = Base_Type (Ent)
+ and then In_Extended_Main_Source_Unit (Ent)
+ then
+ Generate_Prim_Op_References (Ent);
+ end if;
+ end loop;
+ end Handle_Prim_Ops;
+
-- Before we go ahead and output the references we have a problem
-- that needs dealing with. So far we have captured things that are
-- definitely referenced by the main unit, or defined in the main
@@ -1198,9 +1294,11 @@ package body Lib.Xref is
function Parent_Op (E : Entity_Id) return Entity_Id is
Orig_Op : constant Entity_Id := Alias (E);
+
begin
if No (Orig_Op) then
return Empty;
+
elsif not Comes_From_Source (E)
and then not Has_Xref_Entry (Orig_Op)
and then Comes_From_Source (Orig_Op)
@@ -1598,8 +1696,20 @@ package body Lib.Xref is
if No (Old_E) then
return;
+ -- Follow alias chain if one is present
+
elsif Present (Alias (Old_E)) then
+
+ -- The subprogram may have been implicitly inherited
+ -- through several levels of derivation, so find the
+ -- ultimate (source) ancestor.
+
Op := Alias (Old_E);
+ while Present (Alias (Op)) loop
+ Op := Alias (Op);
+ end loop;
+
+ -- Normal case of no alias present
else
Op := Old_E;
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index bc40cbab067..955e6185cad 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -64,6 +64,7 @@ with Ada.Exceptions; use Ada.Exceptions;
with Ada.Command_Line; use Ada.Command_Line;
with GNAT.Directory_Operations; use GNAT.Directory_Operations;
+with GNAT.Dynamic_HTables; use GNAT.Dynamic_HTables;
with GNAT.Case_Util; use GNAT.Case_Util;
with GNAT.OS_Lib; use GNAT.OS_Lib;
@@ -795,32 +796,41 @@ package body Make is
-- Mapping files
-----------------
- type Temp_Path_Names is
- array (Project_Id range <>, Positive range <>) of Path_Name_Type;
-
+ type Temp_Path_Names is array (Positive range <>) of Path_Name_Type;
type Temp_Path_Ptr is access Temp_Path_Names;
- type Indices is array (Project_Id range <>) of Natural;
+ type Free_File_Indices is array (Positive range <>) of Positive;
+ type Free_Indices_Ptr is access Free_File_Indices;
- type Indices_Ptr is access Indices;
+ type Project_Compilation_Data is record
+ Mapping_File_Names : Temp_Path_Ptr;
+ -- The name ids of the temporary mapping files used. This is indexed
+ -- on the maximum number of compilation processes we will be spawning
+ -- (-j parameter)
- type Free_File_Indices is array
- (Project_Id range <>, Positive range <>) of Positive;
+ Last_Mapping_File_Names : Natural;
+ -- Index of the last mapping file created for this project
- type Free_Indices_Ptr is access Free_File_Indices;
+ Free_Mapping_File_Indices : Free_Indices_Ptr;
+ -- Indices in Mapping_File_Names of the mapping file names that can be
+ -- reused for subsequent compilations.
- The_Mapping_File_Names : Temp_Path_Ptr;
- -- For each project, the name ids of the temporary mapping files used
+ Last_Free_Indices : Natural;
+ -- Number of mapping files that can be reused
+ end record;
+ -- Information necessary when compiling a project
- Last_Mapping_File_Names : Indices_Ptr;
- -- For each project, the index of the last mapping file created
+ type Project_Compilation_Access is access Project_Compilation_Data;
- The_Free_Mapping_File_Indices : Free_Indices_Ptr;
- -- For each project, the indices in The_Mapping_File_Names of the mapping
- -- file names that can be reused for subsequent compilations.
+ package Project_Compilation_Htable is new Simple_HTable
+ (Header_Num => Prj.Header_Num,
+ Element => Project_Compilation_Access,
+ No_Element => null,
+ Key => Project_Id,
+ Hash => Prj.Hash,
+ Equal => "=");
- Last_Free_Indices : Indices_Ptr;
- -- For each project, the number of mapping files that can be reused
+ Project_Compilation : Project_Compilation_Htable.Instance;
Gnatmake_Mapping_File : String_Access := null;
-- The path name of a mapping file specified by switch -C=
@@ -830,7 +840,8 @@ package body Make is
-- which ensures that Debug_Flag_N is False.
procedure Init_Mapping_File
- (Project : Project_Id;
+ (Project : Project_Id;
+ Data : in out Project_Compilation_Data;
File_Index : in out Natural);
-- Create a new temporary mapping file, and fill it with the project file
-- mappings, when using project file(s). The out parameter File_Index is
@@ -1074,8 +1085,7 @@ package body Make is
Add_Lib_Search_Dir (Normalize_Pathname (Path));
else
- Get_Name_String
- (Project_Tree.Projects.Table (Main_Project).Directory.Display_Name);
+ Get_Name_String (Main_Project.Directory.Display_Name);
Add_Lib_Search_Dir
(Normalize_Pathname (Path, Name_Buffer (1 .. Name_Len)));
end if;
@@ -1126,8 +1136,7 @@ package body Make is
Add_Src_Search_Dir (Normalize_Pathname (Path));
else
- Get_Name_String
- (Project_Tree.Projects.Table (Main_Project).Directory.Display_Name);
+ Get_Name_String (Main_Project.Directory.Display_Name);
Add_Src_Search_Dir
(Normalize_Pathname (Path, Name_Buffer (1 .. Name_Len)));
end if;
@@ -1258,15 +1267,14 @@ package body Make is
Unknown_Switches_To_The_Compiler;
if File_Name'Length > 0 then
- Name_Len := File_Name'Length;
- Name_Buffer (1 .. Name_Len) := File_Name;
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (File_Name);
Switches :=
Switches_Of
(Source_File => Name_Find,
Source_File_Name => File_Name,
Source_Index => Index,
- Naming => Project_Tree.Projects.Table
- (Main_Project).Naming,
+ Naming => Main_Project.Naming,
In_Package => The_Package,
Allow_ALI => Program = Binder or else Program = Linker);
@@ -1388,16 +1396,14 @@ package body Make is
if Project_Of_Current_Object_Directory /= Actual_Project then
Project_Of_Current_Object_Directory := Actual_Project;
- Object_Directory :=
- Project_Tree.Projects.Table (Actual_Project).Object_Directory.Name;
+ Object_Directory := Actual_Project.Object_Directory.Name;
-- Set the working directory to the object directory of the actual
-- project.
if Verbose_Mode then
Write_Str ("Changing to object directory of """);
- Write_Name
- (Project_Tree.Projects.Table (Actual_Project).Display_Name);
+ Write_Name (Actual_Project.Display_Name);
Write_Str (""": """);
Write_Name (Object_Directory);
Write_Line ("""");
@@ -1412,11 +1418,9 @@ package body Make is
when Directory_Error =>
Make_Failed ("unable to change to object directory """ &
Path_Or_File_Name
- (Project_Tree.Projects.Table
- (Actual_Project).Object_Directory.Name) &
+ (Actual_Project.Object_Directory.Name) &
""" of project " &
- Get_Name_String (Project_Tree.Projects.Table
- (Actual_Project).Display_Name));
+ Get_Name_String (Actual_Project.Display_Name));
end Change_To_Object_Directory;
-----------
@@ -1982,13 +1986,10 @@ package body Make is
Obj_Dir := Name_Find;
- while ALI_Project /= No_Project and then
- Obj_Dir /=
- Project_Tree.Projects.Table
- (ALI_Project).Object_Directory.Name
+ while ALI_Project /= No_Project
+ and then Obj_Dir /= ALI_Project.Object_Directory.Name
loop
- ALI_Project :=
- Project_Tree.Projects.Table (ALI_Project).Extended_By;
+ ALI_Project := ALI_Project.Extended_By;
end loop;
end;
@@ -2003,9 +2004,7 @@ package body Make is
-- If the ALI project is not extended, then it must be in
-- the correct object directory.
- if Project_Tree.Projects.Table (ALI_Project).Extended_By =
- No_Project
- then
+ if ALI_Project.Extended_By = No_Project then
return;
end if;
@@ -2019,7 +2018,7 @@ package body Make is
Num_Ext := 0;
Proj := ALI_Project;
loop
- Proj := Project_Tree.Projects.Table (Proj).Extended_By;
+ Proj := Proj.Extended_By;
exit when Proj = No_Project;
Num_Ext := Num_Ext + 1;
end loop;
@@ -2034,7 +2033,7 @@ package body Make is
begin
Proj := ALI_Project;
for J in Projects'Range loop
- Proj := Project_Tree.Projects.Table (Proj).Extended_By;
+ Proj := Proj.Extended_By;
Projects (J) := Proj;
end loop;
@@ -2328,7 +2327,6 @@ package body Make is
Get_Name_String (Source_File);
Compiler_Package : Prj.Package_Id;
Switches : Prj.Variable_Value;
- Data : Project_Data;
begin
Prj.Env.
@@ -2345,20 +2343,19 @@ package body Make is
if Arguments_Project = No_Project then
Add_Arguments (The_Saved_Gcc_Switches.all);
- elsif not Project_Tree.Projects.Table
- (Arguments_Project).Externally_Built
- then
+ elsif not Arguments_Project.Externally_Built then
-- We get the project directory for the relative path
-- switches and arguments.
Arguments_Project := Ultimate_Extending_Project_Of
- (Arguments_Project, Project_Tree);
- Data := Project_Tree.Projects.Table (Arguments_Project);
+ (Arguments_Project);
-- If building a dynamic or relocatable library, compile with
-- PIC option, if it exists.
- if Data.Library and then Data.Library_Kind /= Static then
+ if Arguments_Project.Library
+ and then Arguments_Project.Library_Kind /= Static
+ then
declare
PIC : constant String := MLib.Tgt.PIC_Option;
@@ -2375,7 +2372,7 @@ package body Make is
Compiler_Package :=
Prj.Util.Value_Of
(Name => Name_Compiler,
- In_Packages => Data.Decl.Packages,
+ In_Packages => Arguments_Project.Decl.Packages,
In_Tree => Project_Tree);
if Compiler_Package /= No_Package then
@@ -2389,7 +2386,7 @@ package body Make is
(Source_File => Source_File,
Source_File_Name => Source_File_Name,
Source_Index => Source_Index,
- Naming => Data.Naming,
+ Naming => Arguments_Project.Naming,
In_Package => Compiler_Package,
Allow_ALI => False);
@@ -2418,8 +2415,8 @@ package body Make is
declare
New_Args : Argument_List (1 .. Number);
Last_New : Natural := 0;
- Dir_Path : constant String :=
- Get_Name_String (Data.Directory.Name);
+ Dir_Path : constant String := Get_Name_String
+ (Arguments_Project.Directory.Name);
begin
Current := Switches.Values;
@@ -2461,7 +2458,8 @@ package body Make is
(1 => new String'
(Name_Buffer (1 .. Name_Len)));
Dir_Path : constant String :=
- Get_Name_String (Data.Directory.Name);
+ Get_Name_String
+ (Arguments_Project.Directory.Name);
begin
Test_If_Relative_Path
@@ -2705,6 +2703,7 @@ package body Make is
is
Pid : Process_Id;
Project : Project_Id;
+ Data : Project_Compilation_Access;
begin
pragma Assert (Outstanding_Compiles > 0);
@@ -2740,10 +2739,10 @@ package body Make is
-- get its file name for reuse by a subsequent compilation
if Running_Compile (J).Mapping_File /= No_Mapping_File then
- Last_Free_Indices (Project) :=
- Last_Free_Indices (Project) + 1;
- The_Free_Mapping_File_Indices
- (Project, Last_Free_Indices (Project)) :=
+ Data := Project_Compilation_Htable.Get
+ (Project_Compilation, Project);
+ Data.Last_Free_Indices := Data.Last_Free_Indices + 1;
+ Data.Free_Mapping_File_Indices (Data.Last_Free_Indices) :=
Running_Compile (J).Mapping_File;
end if;
@@ -2794,9 +2793,8 @@ package body Make is
Add_It : Boolean := True;
begin
- Name_Len := Standard_Library_Package_Body_Name'Length;
- Name_Buffer (1 .. Name_Len) :=
- Standard_Library_Package_Body_Name;
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (Standard_Library_Package_Body_Name);
Sfile := Name_Enter;
-- If we have a special runtime, we add the standard
@@ -2853,33 +2851,26 @@ package body Make is
-- check for an eventual library project, and use the full path.
if Arguments_Project /= No_Project then
- if not Project_Tree.Projects.Table
- (Arguments_Project).Externally_Built
- then
- Prj.Env.Set_Ada_Paths (Arguments_Project, Project_Tree, True);
+ if not Arguments_Project.Externally_Built then
+ Prj.Env.Set_Ada_Paths
+ (Arguments_Project,
+ Project_Tree,
+ Including_Libraries => True);
if not Unique_Compile
and then MLib.Tgt.Support_For_Libraries /= Prj.None
then
declare
- The_Data : Project_Data :=
- Project_Tree.Projects.Table
- (Arguments_Project);
-
- Prj : Project_Id := Arguments_Project;
+ Prj : constant Project_Id :=
+ Ultimate_Extending_Project_Of (Arguments_Project);
begin
- while The_Data.Extended_By /= No_Project loop
- Prj := The_Data.Extended_By;
- The_Data := Project_Tree.Projects.Table (Prj);
- end loop;
-
- if The_Data.Library
- and then not The_Data.Externally_Built
- and then not The_Data.Need_To_Build_Lib
+ if Prj.Library
+ and then not Prj.Externally_Built
+ and then not Prj.Need_To_Build_Lib
then
- -- Add to the Q all sources of the project that
- -- have not been marked
+ -- Add to the Q all sources of the project that have
+ -- not been marked.
Insert_Project_Sources
(The_Project => Prj,
@@ -2888,14 +2879,12 @@ package body Make is
-- Now mark the project as processed
- Project_Tree.Projects.Table
- (Prj).Need_To_Build_Lib := True;
+ Prj.Need_To_Build_Lib := True;
end if;
end;
end if;
- -- Change to the object directory of the project file,
- -- if necessary.
+ -- Change to object directory of the project file, if necessary
Change_To_Object_Directory (Arguments_Project);
@@ -3130,18 +3119,22 @@ package body Make is
----------------------
procedure Get_Mapping_File (Project : Project_Id) is
+ Data : Project_Compilation_Access;
+
begin
+ Data := Project_Compilation_Htable.Get (Project_Compilation, Project);
+
-- If there is a mapping file ready to be reused, reuse it
- if Last_Free_Indices (Project) > 0 then
- Mfile := The_Free_Mapping_File_Indices
- (Project, Last_Free_Indices (Project));
- Last_Free_Indices (Project) := Last_Free_Indices (Project) - 1;
+ if Data.Last_Free_Indices > 0 then
+ Mfile := Data.Free_Mapping_File_Indices (Data.Last_Free_Indices);
+ Data.Last_Free_Indices := Data.Last_Free_Indices - 1;
-- Otherwise, create and initialize a new one
else
- Init_Mapping_File (Project => Project, File_Index => Mfile);
+ Init_Mapping_File
+ (Project => Project, Data => Data.all, File_Index => Mfile);
end if;
-- Put the name in the mapping file argument for the invocation
@@ -3150,9 +3143,7 @@ package body Make is
Free (Mapping_File_Arg);
Mapping_File_Arg :=
new String'("-gnatem=" &
- Get_Name_String
- (The_Mapping_File_Names (Project, Mfile)));
-
+ Get_Name_String (Data.Mapping_File_Names (Mfile)));
end Get_Mapping_File;
-----------------------
@@ -3355,8 +3346,7 @@ package body Make is
-- Do nothing if project of source is externally built
if Arguments_Project = No_Project
- or else not Project_Tree.Projects.Table
- (Arguments_Project).Externally_Built
+ or else not Arguments_Project.Externally_Built
then
-- Don't waste any time if we have to recompile anyway
@@ -3748,9 +3738,7 @@ package body Make is
else
declare
Parent_Directory : constant String :=
- Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Directory.Display_Name);
+ Get_Name_String (Project.Directory.Display_Name);
begin
if Parent_Directory (Parent_Directory'Last) =
@@ -3772,18 +3760,12 @@ package body Make is
Prj.Env.Create_Config_Pragmas_File
(For_Project, Main_Project, Project_Tree);
- if Project_Tree.Projects.Table
- (For_Project).Config_File_Name /= No_Path
- then
- Temporary_Config_File :=
- Project_Tree.Projects.Table (For_Project).Config_File_Temp;
+ if For_Project.Config_File_Name /= No_Path then
+ Temporary_Config_File := For_Project.Config_File_Temp;
Last := 1;
Result (1) :=
new String'
- ("-gnatec=" &
- Get_Name_String
- (Project_Tree.Projects.Table
- (For_Project).Config_File_Name));
+ ("-gnatec=" & Get_Name_String (For_Project.Config_File_Name));
else
Temporary_Config_File := False;
@@ -3791,8 +3773,7 @@ package body Make is
-- Check for attribute Builder'Global_Configuration_Pragmas
- The_Packages := Project_Tree.Projects.Table
- (Main_Project).Decl.Packages;
+ The_Packages := Main_Project.Decl.Packages;
Gnatmake :=
Prj.Util.Value_Of
(Name => Name_Builder,
@@ -3835,8 +3816,7 @@ package body Make is
-- Check for attribute Compiler'Local_Configuration_Pragmas
- The_Packages :=
- Project_Tree.Projects.Table (For_Project).Decl.Packages;
+ The_Packages := For_Project.Decl.Packages;
Compiler :=
Prj.Util.Value_Of
(Name => Name_Compiler,
@@ -3927,21 +3907,29 @@ package body Make is
Success : Boolean;
pragma Warnings (Off, Success);
+ Proj : Project_List;
+ Data : Project_Compilation_Access;
+
begin
-- The caller is responsible for ensuring that Debug_Flag_N is False
pragma Assert (not Debug.Debug_Flag_N);
- if The_Mapping_File_Names /= null then
- for Project in The_Mapping_File_Names'Range (1) loop
- for Index in 1 .. Last_Mapping_File_Names (Project) loop
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ Data := Project_Compilation_Htable.Get
+ (Project_Compilation, Proj.Project);
+
+ if Data /= null and then Data.Mapping_File_Names /= null then
+ for Index in 1 .. Data.Last_Mapping_File_Names loop
Delete_File
- (Name => Get_Name_String
- (The_Mapping_File_Names (Project, Index)),
+ (Name => Get_Name_String (Data.Mapping_File_Names (Index)),
Success => Success);
end loop;
- end loop;
- end if;
+ end if;
+
+ Proj := Proj.Next;
+ end loop;
end Delete_Mapping_Files;
------------------------------
@@ -3950,6 +3938,7 @@ package body Make is
procedure Delete_Temp_Config_Files is
Success : Boolean;
+ Proj : Project_List;
pragma Warnings (Off, Success);
begin
@@ -3958,24 +3947,17 @@ package body Make is
pragma Assert (not Debug.Debug_Flag_N);
if Main_Project /= No_Project then
- for Project in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if
- Project_Tree.Projects.Table (Project).Config_File_Temp
- then
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ if Proj.Project.Config_File_Temp then
if Verbose_Mode then
Write_Str ("Deleting temp configuration file """);
- Write_Str (Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Config_File_Name));
+ Write_Str (Get_Name_String (Proj.Project.Config_File_Name));
Write_Line ("""");
end if;
Delete_File
- (Name => Get_Name_String
- (Project_Tree.Projects.Table
- (Project).Config_File_Name),
+ (Name => Get_Name_String (Proj.Project.Config_File_Name),
Success => Success);
-- Make sure that we don't have a config file for this project,
@@ -3983,13 +3965,11 @@ package body Make is
-- recreate another config file: we cannot reuse the one that
-- we just deleted!
- Project_Tree.Projects.Table (Project).
- Config_Checked := False;
- Project_Tree.Projects.Table (Project).
- Config_File_Name := No_Path;
- Project_Tree.Projects.Table (Project).
- Config_File_Temp := False;
+ Proj.Project.Config_Checked := False;
+ Proj.Project.Config_File_Name := No_Path;
+ Proj.Project.Config_File_Temp := False;
end if;
+ Proj := Proj.Next;
end loop;
end if;
end Delete_Temp_Config_Files;
@@ -4247,8 +4227,6 @@ package body Make is
Proj : Project_Id := No_Project;
-- The project of the current main
- Data : Project_Data;
-
Real_Path : String_Access;
begin
@@ -4286,25 +4264,23 @@ package body Make is
-- is the actual path of a source of a project.
if Main /= File_Name then
- Data :=
- Project_Tree.Projects.Table (Main_Project);
-
Real_Path :=
Locate_Regular_File
(Main &
- Body_Suffix_Of (Project_Tree, "ada", Data.Naming),
+ Body_Suffix_Of
+ (Project_Tree, "ada", Main_Project.Naming),
"");
if Real_Path = null then
Real_Path :=
Locate_Regular_File
(Main &
- Spec_Suffix_Of (Project_Tree, "ada", Data.Naming),
+ Spec_Suffix_Of
+ (Project_Tree, "ada", Main_Project.Naming),
"");
end if;
if Real_Path = null then
- Real_Path :=
- Locate_Regular_File (Main, "");
+ Real_Path := Locate_Regular_File (Main, "");
end if;
-- Fail if the file cannot be found
@@ -4365,9 +4341,7 @@ package body Make is
Make_Failed
("""" & Main &
""" is not a source of project " &
- Get_Name_String
- (Project_Tree.Projects.Table
- (Real_Main_Project).Name));
+ Get_Name_String (Real_Main_Project.Name));
end if;
end if;
end if;
@@ -4431,85 +4405,68 @@ package body Make is
No_Project
then
Get_Name_String (Unit.Name);
- Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "%b";
- Name_Len := Name_Len + 2;
+ Add_Str_To_Name_Buffer ("%b");
ALI_Unit := Name_Find;
ALI_Name :=
Lib_File_Name
(Unit.File_Names (Body_Part).Display_Name);
- ALI_Project :=
- Unit.File_Names (Body_Part).Project;
+ ALI_Project := Unit.File_Names (Body_Part).Project;
- -- Otherwise, if there is a spec, put it
- -- in the mapping.
+ -- Otherwise, if there is a spec, put it in the
+ -- mapping.
elsif Unit.File_Names (Specification).Name /= No_File
and then Unit.File_Names (Specification).Project /=
No_Project
then
Get_Name_String (Unit.Name);
- Name_Buffer (Name_Len + 1 .. Name_Len + 2) := "%s";
- Name_Len := Name_Len + 2;
+ Add_Str_To_Name_Buffer ("%s");
ALI_Unit := Name_Find;
ALI_Name :=
Lib_File_Name
(Unit.File_Names (Specification).Display_Name);
- ALI_Project :=
- Unit.File_Names (Specification).Project;
+ ALI_Project := Unit.File_Names (Specification).Project;
else
ALI_Name := No_File;
end if;
- -- If we have something to put in the mapping
- -- then we do it now. However, if the project
- -- is extended, we don't put anything in the
- -- mapping file, because we do not know where
- -- the ALI file is: it might be in the ext-
- -- ended project obj dir as well as in the
- -- extending project obj dir.
+ -- If we have something to put in the mapping then do it
+ -- now. However, if the project is extended, we don't put
+ -- anything in the mapping file, because we do not know
+ -- where the ALI file is: it might be in the extended
+ -- project obj dir as well as in the extending project
+ -- obj dir.
if ALI_Name /= No_File
- and then
- Project_Tree.Projects.Table
- (ALI_Project).Extended_By = No_Project
- and then
- Project_Tree.Projects.Table
- (ALI_Project).Extends = No_Project
+ and then ALI_Project.Extended_By = No_Project
+ and then ALI_Project.Extends = No_Project
then
-- First check if the ALI file exists. If it does not,
-- do not put the unit in the mapping file.
declare
- ALI : constant String :=
- Get_Name_String (ALI_Name);
- PD : Project_Data renames
- Project_Tree.Projects.Table (ALI_Project);
+ ALI : constant String := Get_Name_String (ALI_Name);
begin
-- For library projects, use the library directory,
-- for other projects, use the object directory.
- if PD.Library then
- Get_Name_String (PD.Library_Dir.Name);
+ if ALI_Project.Library then
+ Get_Name_String (ALI_Project.Library_Dir.Name);
else
- Get_Name_String (PD.Object_Directory.Name);
+ Get_Name_String
+ (ALI_Project.Object_Directory.Name);
end if;
if Name_Buffer (Name_Len) /=
- Directory_Separator
+ Directory_Separator
then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) :=
- Directory_Separator;
+ Add_Char_To_Name_Buffer (Directory_Separator);
end if;
- Name_Buffer
- (Name_Len + 1 ..
- Name_Len + ALI'Length) := ALI;
- Name_Len :=
- Name_Len + ALI'Length + 1;
- Name_Buffer (Name_Len) := ASCII.LF;
+ Add_Str_To_Name_Buffer (ALI);
+ Add_Char_To_Name_Buffer (ASCII.LF);
declare
ALI_Path_Name : constant String :=
@@ -4523,8 +4480,7 @@ package body Make is
-- First line is the unit name
Get_Name_String (ALI_Unit);
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := ASCII.LF;
+ Add_Char_To_Name_Buffer (ASCII.LF);
Bytes :=
Write
(Mapping_FD,
@@ -4537,8 +4493,7 @@ package body Make is
-- Second line it the ALI file name
Get_Name_String (ALI_Name);
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := ASCII.LF;
+ Add_Char_To_Name_Buffer (ASCII.LF);
Bytes :=
Write
(Mapping_FD,
@@ -4623,7 +4578,7 @@ package body Make is
-- And the project file cannot be a library project file
- elsif Project_Tree.Projects.Table (Main_Project).Library then
+ elsif Main_Project.Library then
Make_Failed ("-B cannot be used for a library project file");
else
@@ -4664,7 +4619,7 @@ package body Make is
-- cannot be specified on the command line.
if Osint.Number_Of_Files /= 0 then
- if Project_Tree.Projects.Table (Main_Project).Library
+ if Main_Project.Library
and then not Unique_Compile
and then ((not Make_Steps) or else Bind_Only or else Link_Only)
then
@@ -4691,8 +4646,7 @@ package body Make is
end if;
declare
- Value : String_List_Id :=
- Project_Tree.Projects.Table (Main_Project).Mains;
+ Value : String_List_Id := Main_Project.Mains;
begin
-- The attribute Main is an empty list or not specified,
@@ -4701,8 +4655,7 @@ package body Make is
if Value = Prj.Nil_String or else Unique_Compile then
if (not Make_Steps) or else Compile_Only
- or else not Project_Tree.Projects.Table
- (Main_Project).Library
+ or else not Main_Project.Library
then
-- First make sure that the binder and the linker
-- will not be invoked.
@@ -4740,13 +4693,10 @@ package body Make is
-- all the sources of the project.
declare
- Data : constant Project_Data :=
- Project_Tree.Projects.Table (Main_Project);
-
Languages : constant Variable_Value :=
Prj.Util.Value_Of
(Name_Languages,
- Data.Decl.Attributes,
+ Main_Project.Decl.Attributes,
Project_Tree);
Current : String_List_Id;
@@ -4783,8 +4733,7 @@ package body Make is
while Value /= Prj.Nil_String loop
Get_Name_String
- (Project_Tree.String_Elements.Table
- (Value).Value);
+ (Project_Tree.String_Elements.Table (Value).Value);
-- To know if a main is an Ada main, get its project.
-- It should be the project specified on the command
@@ -4832,8 +4781,7 @@ package body Make is
end if;
if Main_Project /= No_Project
- and then Project_Tree.Projects.Table
- (Main_Project).Externally_Built
+ and then Main_Project.Externally_Built
then
Make_Failed
("nothing to do for a main project that is externally built");
@@ -4841,11 +4789,10 @@ package body Make is
if Osint.Number_Of_Files = 0 then
if Main_Project /= No_Project
- and then Project_Tree.Projects.Table (Main_Project).Library
+ and then Main_Project.Library
then
if Do_Bind_Step
- and then not Project_Tree.Projects.Table
- (Main_Project).Standalone_Library
+ and then not Main_Project.Standalone_Library
then
Make_Failed ("only stand-alone libraries may be bound");
end if;
@@ -4939,9 +4886,7 @@ package body Make is
if Main_Project /= No_Project then
- if Project_Tree.Projects.Table
- (Main_Project).Object_Directory /= No_Path_Information
- then
+ if Main_Project.Object_Directory /= No_Path_Information then
-- Change current directory to object directory of main project
Project_Of_Current_Object_Directory := No_Project;
@@ -4967,8 +4912,7 @@ package body Make is
not Unique_Compile);
The_Packages : constant Package_Id :=
- Project_Tree.Projects.Table
- (Main_Project).Decl.Packages;
+ Main_Project.Decl.Packages;
Builder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
@@ -5316,51 +5260,52 @@ package body Make is
if not Unique_Compile
and then MLib.Tgt.Support_For_Libraries /= Prj.None
then
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Project_Tree.Projects.Table (Proj).Library then
- Project_Tree.Projects.Table
- (Proj).Need_To_Build_Lib :=
- (not MLib.Tgt.Library_Exists_For (Proj, Project_Tree))
- and then (not Project_Tree.Projects.Table
- (Proj).Externally_Built);
-
- if Project_Tree.Projects.Table (Proj).Need_To_Build_Lib then
+ declare
+ Proj : Project_List;
- -- If there is no object directory, then it will be
- -- impossible to build the library. So fail immediately.
+ begin
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ if Proj.Project.Library then
+ Proj.Project.Need_To_Build_Lib :=
+ not MLib.Tgt.Library_Exists_For
+ (Proj.Project, Project_Tree)
+ and then not Proj.Project.Externally_Built;
+
+ if Proj.Project.Need_To_Build_Lib then
+
+ -- If there is no object directory, then it will be
+ -- impossible to build the library. So fail
+ -- immediately.
+
+ if
+ Proj.Project.Object_Directory = No_Path_Information
+ then
+ Make_Failed
+ ("no object files to build library for project """
+ & Get_Name_String (Proj.Project.Name)
+ & """");
+ Proj.Project.Need_To_Build_Lib := False;
- if Project_Tree.Projects.Table (Proj).Object_Directory =
- No_Path_Information
- then
- Make_Failed
- ("no object files to build library for project """
- & Get_Name_String
- (Project_Tree.Projects.Table (Proj).Name)
- & """");
- Project_Tree.Projects.Table
- (Proj).Need_To_Build_Lib := False;
+ else
+ if Verbose_Mode then
+ Write_Str
+ ("Library file does not exist for project """);
+ Write_Str (Get_Name_String (Proj.Project.Name));
+ Write_Line ("""");
+ end if;
- else
- if Verbose_Mode then
- Write_Str
- ("Library file does not exist for project """);
- Write_Str
- (Get_Name_String
- (Project_Tree.Projects.Table
- (Proj).Name));
- Write_Line ("""");
+ Insert_Project_Sources
+ (The_Project => Proj.Project,
+ All_Projects => False,
+ Into_Q => True);
end if;
-
- Insert_Project_Sources
- (The_Project => Proj,
- All_Projects => False,
- Into_Q => True);
end if;
end if;
- end if;
- end loop;
+
+ Proj := Proj.Next;
+ end loop;
+ end;
end if;
-- If a relative path output file has been specified, we add
@@ -5374,19 +5319,13 @@ package body Make is
begin
if not Is_Absolute_Path (Exec_File_Name) then
- Get_Name_String
- (Project_Tree.Projects.Table
- (Main_Project).Exec_Directory.Name);
+ Get_Name_String (Main_Project.Exec_Directory.Name);
if Name_Buffer (Name_Len) /= Directory_Separator then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
+ Add_Char_To_Name_Buffer (Directory_Separator);
end if;
- Name_Buffer (Name_Len + 1 ..
- Name_Len + Exec_File_Name'Length) :=
- Exec_File_Name;
- Name_Len := Name_Len + Exec_File_Name'Length;
+ Add_Str_To_Name_Buffer (Exec_File_Name);
Saved_Linker_Switches.Table (J + 1) :=
new String'(Name_Buffer (1 .. Name_Len));
end if;
@@ -5403,9 +5342,7 @@ package body Make is
declare
Dir_Path : constant String :=
- Get_Name_String
- (Project_Tree.Projects.Table
- (Main_Project).Directory.Name);
+ Get_Name_String (Main_Project.Directory.Name);
begin
for J in 1 .. Binder_Switches.Last loop
Test_If_Relative_Path
@@ -5433,14 +5370,14 @@ package body Make is
for J in 1 .. Gcc_Switches.Last loop
Test_If_Relative_Path
(Gcc_Switches.Table (J),
- Parent => Dir_Path,
+ Parent => Dir_Path,
Including_Non_Switch => False);
end loop;
for J in 1 .. Saved_Gcc_Switches.Last loop
Test_If_Relative_Path
(Saved_Gcc_Switches.Table (J),
- Parent => Current_Work_Dir.all,
+ Parent => Current_Work_Dir.all,
Including_Non_Switch => False);
end loop;
end;
@@ -5471,9 +5408,7 @@ package body Make is
if Main_Project = No_Project then
for J in 1 .. Saved_Gcc_Switches.Last loop
Add_Switch
- (Saved_Gcc_Switches.Table (J),
- Compiler,
- And_Save => False);
+ (Saved_Gcc_Switches.Table (J), Compiler, And_Save => False);
end loop;
else
@@ -5490,8 +5425,7 @@ package body Make is
-- We never use gnat.adc when a project file is used
- The_Saved_Gcc_Switches (The_Saved_Gcc_Switches'Last) :=
- No_gnat_adc;
+ The_Saved_Gcc_Switches (The_Saved_Gcc_Switches'Last) := No_gnat_adc;
end if;
-- If there was a --GCC, --GNATBIND or --GNATLINK switch on
@@ -5522,32 +5456,45 @@ package body Make is
Saved_Maximum_Processes := Maximum_Processes;
end if;
- -- Allocate as many temporary mapping file names as the maximum
- -- number of compilation processed, for each possible project.
-
- The_Mapping_File_Names :=
- new Temp_Path_Names
- (No_Project .. Project_Table.Last (Project_Tree.Projects),
- 1 .. Saved_Maximum_Processes);
- Last_Mapping_File_Names :=
- new Indices'
- (No_Project .. Project_Table.Last (Project_Tree.Projects)
- => 0);
-
- The_Free_Mapping_File_Indices :=
- new Free_File_Indices
- (No_Project .. Project_Table.Last (Project_Tree.Projects),
- 1 .. Saved_Maximum_Processes);
- Last_Free_Indices :=
- new Indices'(No_Project .. Project_Table.Last
- (Project_Tree.Projects) => 0);
+ -- Allocate as many temporary mapping file names as the maximum number
+ -- of compilations processed, for each possible project.
+
+ declare
+ Data : Project_Compilation_Access;
+ Proj : Project_List := Project_Tree.Projects;
+ begin
+ while Proj /= null loop
+ Data := new Project_Compilation_Data'
+ (Mapping_File_Names => new Temp_Path_Names
+ (1 .. Saved_Maximum_Processes),
+ Last_Mapping_File_Names => 0,
+ Free_Mapping_File_Indices => new Free_File_Indices
+ (1 .. Saved_Maximum_Processes),
+ Last_Free_Indices => 0);
+
+ Project_Compilation_Htable.Set
+ (Project_Compilation, Proj.Project, Data);
+ Proj := Proj.Next;
+ end loop;
+
+ Data := new Project_Compilation_Data'
+ (Mapping_File_Names => new Temp_Path_Names
+ (1 .. Saved_Maximum_Processes),
+ Last_Mapping_File_Names => 0,
+ Free_Mapping_File_Indices => new Free_File_Indices
+ (1 .. Saved_Maximum_Processes),
+ Last_Free_Indices => 0);
+
+ Project_Compilation_Htable.Set
+ (Project_Compilation, No_Project, Data);
+ end;
Bad_Compilation.Init;
- -- If project files are used, create the mapping of all the sources,
- -- so that the correct paths will be found. Otherwise, if there is
- -- a file which is not a source with the same name in a source directory
- -- this file may be incorrectly found.
+ -- If project files are used, create the mapping of all the sources, so
+ -- that the correct paths will be found. Otherwise, if there is a file
+ -- which is not a source with the same name in a source directory this
+ -- file may be incorrectly found.
if Main_Project /= No_Project then
Prj.Env.Create_Mapping (Project_Tree);
@@ -5571,37 +5518,32 @@ package body Make is
-- Look inside the linker switches to see if the name of the final
-- executable program was specified.
- for
- J in reverse Linker_Switches.First .. Linker_Switches.Last
- loop
+ for J in reverse Linker_Switches.First .. Linker_Switches.Last loop
if Linker_Switches.Table (J).all = Output_Flag.all then
pragma Assert (J < Linker_Switches.Last);
- -- We cannot specify a single executable for several
- -- main subprograms!
+ -- We cannot specify a single executable for several main
+ -- subprograms
if Osint.Number_Of_Files > 1 then
Fail
- ("cannot specify a single executable " &
- "for several mains");
+ ("cannot specify a single executable for several mains");
end if;
- Name_Len := Linker_Switches.Table (J + 1)'Length;
- Name_Buffer (1 .. Name_Len) :=
- Linker_Switches.Table (J + 1).all;
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (Linker_Switches.Table (J + 1).all);
Executable := Name_Enter;
Verbose_Msg (Executable, "final executable");
end if;
end loop;
- -- If the name of the final executable program was not specified
- -- then construct it from the main input file.
+ -- If the name of the final executable program was not specified then
+ -- construct it from the main input file.
if Executable = No_File then
if Main_Project = No_Project then
- Executable :=
- Executable_Name (Strip_Suffix (Main_Source_File));
+ Executable := Executable_Name (Strip_Suffix (Main_Source_File));
else
-- If we are using a project file, we attempt to remove the
@@ -5617,9 +5559,7 @@ package body Make is
end if;
if Main_Project /= No_Project
- and then
- Project_Tree.Projects.Table
- (Main_Project).Exec_Directory /= No_Path_Information
+ and then Main_Project.Exec_Directory /= No_Path_Information
then
declare
Exec_File_Name : constant String :=
@@ -5627,20 +5567,13 @@ package body Make is
begin
if not Is_Absolute_Path (Exec_File_Name) then
- Get_Name_String
- (Project_Tree.Projects.Table
- (Main_Project).Exec_Directory.Display_Name);
+ Get_Name_String (Main_Project.Exec_Directory.Display_Name);
if Name_Buffer (Name_Len) /= Directory_Separator then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
+ Add_Char_To_Name_Buffer (Directory_Separator);
end if;
- Name_Buffer (Name_Len + 1 ..
- Name_Len + Exec_File_Name'Length) :=
- Exec_File_Name;
-
- Name_Len := Name_Len + Exec_File_Name'Length;
+ Add_Str_To_Name_Buffer (Exec_File_Name);
Executable := Name_Find;
end if;
@@ -5658,6 +5591,7 @@ package body Make is
Executable_Stamp : Time_Stamp_Type;
-- Executable is the final executable program
+ -- ??? comment seems unrelated to declaration
Library_Rebuilt : Boolean := False;
@@ -5700,6 +5634,7 @@ package body Make is
if Total_Compilation_Failures /= 0 then
if Keep_Going then
goto Next_Main;
+
else
List_Bad_Compilations;
Report_Compilation_Failed;
@@ -5721,6 +5656,7 @@ package body Make is
declare
Depth : Natural;
Current : Natural;
+ Proj1 : Project_List;
procedure Add_To_Library_Projs (Proj : Project_Id);
-- Add project Project to table Library_Projs in
@@ -5735,7 +5671,7 @@ package body Make is
begin
Library_Projs.Increment_Last;
- Depth := Project_Tree.Projects.Table (Proj).Depth;
+ Depth := Proj.Depth;
-- Put the projects in decreasing depth order, so that
-- if libA depends on libB, libB is first in order.
@@ -5743,8 +5679,7 @@ package body Make is
Current := Library_Projs.Last;
while Current > 1 loop
Prj := Library_Projs.Table (Current - 1);
- exit when Project_Tree.Projects.Table
- (Prj).Depth >= Depth;
+ exit when Prj.Depth >= Depth;
Library_Projs.Table (Current) := Prj;
Current := Current - 1;
end loop;
@@ -5756,44 +5691,37 @@ package body Make is
-- or probably better, break this out as a nested proc).
begin
- -- Put in Library_Projs table all library project
- -- file ids when the library need to be rebuilt.
+ -- Put in Library_Projs table all library project file
+ -- ids when the library need to be rebuilt.
- for Proj1 in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Project_Tree.Projects.Table
- (Proj1).Standalone_Library
- then
+ Proj1 := Project_Tree.Projects;
+ while Proj1 /= null loop
+ if Proj1.Project.Standalone_Library then
Stand_Alone_Libraries := True;
end if;
- if Project_Tree.Projects.Table (Proj1).Library then
- MLib.Prj.Check_Library (Proj1, Project_Tree);
+ if Proj1.Project.Library then
+ MLib.Prj.Check_Library
+ (Proj1.Project, Project_Tree);
end if;
- if Project_Tree.Projects.Table
- (Proj1).Need_To_Build_Lib
- then
- Add_To_Library_Projs (Proj1);
+ if Proj1.Project.Need_To_Build_Lib then
+ Add_To_Library_Projs (Proj1.Project);
end if;
+
+ Proj1 := Proj1.Next;
end loop;
-- Check if importing libraries should be regenerated
-- because at least an imported library will be
-- regenerated or is more recent.
- for Proj1 in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Project_Tree.Projects.Table (Proj1).Library
- and then
- Project_Tree.Projects.Table (Proj1).Library_Kind /=
- Static
- and then not Project_Tree.Projects.Table
- (Proj1).Need_To_Build_Lib
- and then not Project_Tree.Projects.Table
- (Proj1).Externally_Built
+ Proj1 := Project_Tree.Projects;
+ while Proj1 /= null loop
+ if Proj1.Project.Library
+ and then Proj1.Project.Library_Kind /= Static
+ and then not Proj1.Project.Need_To_Build_Lib
+ and then not Proj1.Project.Externally_Built
then
declare
List : Project_List;
@@ -5801,24 +5729,17 @@ package body Make is
Rebuild : Boolean := False;
Lib_Timestamp1 : constant Time_Stamp_Type :=
- Project_Tree.Projects.Table
- (Proj1).Library_TS;
+ Proj1.Project.Library_TS;
begin
- List := Project_Tree.Projects.Table (Proj1).
- All_Imported_Projects;
+ List := Proj1.Project.All_Imported_Projects;
while List /= null loop
Proj2 := List.Project;
- if
- Project_Tree.Projects.Table (Proj2).Library
- then
- if Project_Tree.Projects.Table (Proj2).
- Need_To_Build_Lib
+ if Proj2.Library then
+ if Proj2.Need_To_Build_Lib
or else
- (Lib_Timestamp1 <
- Project_Tree.Projects.Table
- (Proj2).Library_TS)
+ (Lib_Timestamp1 < Proj2.Library_TS)
then
Rebuild := True;
exit;
@@ -5829,22 +5750,22 @@ package body Make is
end loop;
if Rebuild then
- Project_Tree.Projects.Table
- (Proj1).Need_To_Build_Lib := True;
- Add_To_Library_Projs (Proj1);
+ Proj1.Project.Need_To_Build_Lib := True;
+ Add_To_Library_Projs (Proj1.Project);
end if;
end;
end if;
+
+ Proj1 := Proj1.Next;
end loop;
-- Reset the flags Need_To_Build_Lib for the next main,
-- to avoid rebuilding libraries uselessly.
- for Proj1 in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- Project_Tree.Projects.Table
- (Proj1).Need_To_Build_Lib := False;
+ Proj1 := Project_Tree.Projects;
+ while Proj1 /= null loop
+ Proj1.Project.Need_To_Build_Lib := False;
+ Proj1 := Proj1.Next;
end loop;
end;
@@ -5920,8 +5841,8 @@ package body Make is
-- If the objects were up-to-date check if the executable file
-- is also up-to-date. For now always bind and link on the JVM
- -- since there is currently no simple way to check the
- -- up-to-date status of objects
+ -- since there is currently no simple way to check whether
+ -- objects are up-to-date.
if Targparm.VM_Target /= JVM_Target
and then First_Compiled_File = No_File
@@ -5960,8 +5881,8 @@ package body Make is
Executable_Obsolete := Youngest_Obj_File /= No_File;
end if;
- -- Return if the executable is up to date
- -- and otherwise motivate the relink/rebind.
+ -- Return if the executable is up to date and otherwise
+ -- motivate the relink/rebind.
if not Executable_Obsolete then
if not Quiet_Output then
@@ -6008,9 +5929,9 @@ package body Make is
Change_To_Object_Directory (Main_Project);
end if;
- -- If we are here, it means that we need to rebuilt the current
- -- main. So we set Executable_Obsolete to True to make sure that
- -- the subsequent mains will be rebuilt.
+ -- If we are here, it means that we need to rebuilt the current main,
+ -- so we set Executable_Obsolete to True to make sure that subsequent
+ -- mains will be rebuilt.
Main_ALI_In_Place_Mode_Step : declare
ALI_File : File_Name_Type;
@@ -6051,6 +5972,8 @@ package body Make is
-- Set to True when there are shared library project files or
-- when gnatbind is invoked with -shared.
+ Proj : Project_List;
+
begin
-- Check if there are shared libraries, so that gnatbind is
-- called with -shared. Check also if gnatbind is called with
@@ -6060,17 +5983,16 @@ package body Make is
if Main_Project /= No_Project
and then MLib.Tgt.Support_For_Libraries /= Prj.None
then
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Project_Tree.Projects.Table (Proj).Library
- and then Project_Tree.Projects.Table
- (Proj).Library_Kind /= Static
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ if Proj.Project.Library
+ and then Proj.Project.Library_Kind /= Static
then
Shared_Libs := True;
Bind_Shared := Shared_Switch'Access;
exit;
end if;
+ Proj := Proj.Next;
end loop;
end if;
@@ -6157,6 +6079,7 @@ package body Make is
Current : Natural;
Proj2 : Project_Id;
Depth : Natural;
+ Proj1 : Project_List;
begin
if not Run_Path_Option then
@@ -6173,17 +6096,15 @@ package body Make is
-- Check for library projects
- for Proj1 in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- if Proj1 /= Main_Project
- and then
- Project_Tree.Projects.Table (Proj1).Library
+ Proj1 := Project_Tree.Projects;
+ while Proj1 /= null loop
+ if Proj1.Project /= Main_Project
+ and then Proj1.Project.Library
then
-- Add this project to table Library_Projs
Libraries_Present := True;
- Depth := Project_Tree.Projects.Table (Proj1).Depth;
+ Depth := Proj1.Project.Depth;
Library_Projs.Increment_Last;
Current := Library_Projs.Last;
@@ -6192,29 +6113,28 @@ package body Make is
while Current > 1 loop
Proj2 := Library_Projs.Table (Current - 1);
- exit when Project_Tree.Projects.Table
- (Proj2).Depth <= Depth;
+ exit when Proj2.Depth <= Depth;
Library_Projs.Table (Current) := Proj2;
Current := Current - 1;
end loop;
- Library_Projs.Table (Current) := Proj1;
+ Library_Projs.Table (Current) := Proj1.Project;
-- If it is not a static library and path option
-- is set, add it to the Library_Paths table.
- if Project_Tree.Projects.Table
- (Proj1).Library_Kind /= Static
+ if Proj1.Project.Library_Kind /= Static
and then Path_Option /= null
then
Library_Paths.Increment_Last;
Library_Paths.Table (Library_Paths.Last) :=
new String'
(Get_Name_String
- (Project_Tree.Projects.Table
- (Proj1).Library_Dir.Display_Name));
+ (Proj1.Project.Library_Dir.Display_Name));
end if;
end if;
+
+ Proj1 := Proj1.Next;
end loop;
for Index in 1 .. Library_Projs.Last loop
@@ -6225,9 +6145,8 @@ package body Make is
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-L" &
Get_Name_String
- (Project_Tree.Projects.Table
- (Library_Projs.Table (Index)).
- Library_Dir.Display_Name));
+ (Library_Projs.Table (Index).
+ Library_Dir.Display_Name));
-- Add the -l switch
@@ -6235,9 +6154,8 @@ package body Make is
Linker_Switches.Table (Linker_Switches.Last) :=
new String'("-l" &
Get_Name_String
- (Project_Tree.Projects.Table
- (Library_Projs.Table (Index)).
- Library_Name));
+ (Library_Projs.Table (Index).
+ Library_Name));
end loop;
end if;
@@ -6471,8 +6389,7 @@ package body Make is
not Unique_Compile);
The_Packages : constant Package_Id :=
- Project_Tree.Projects.Table
- (Main_Project).Decl.Packages;
+ Main_Project.Decl.Packages;
Binder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
@@ -6572,8 +6489,7 @@ package body Make is
declare
Dir_Path : constant String :=
Get_Name_String
- (Project_Tree.Projects.Table
- (Main_Project).Directory.Name);
+ (Main_Project.Directory.Name);
begin
for
@@ -6687,6 +6603,7 @@ package body Make is
procedure Init_Mapping_File
(Project : Project_Id;
+ Data : in out Project_Compilation_Data;
File_Index : in out Natural)
is
FD : File_Descriptor;
@@ -6696,8 +6613,7 @@ package body Make is
begin
-- Increase the index of the last mapping file for this project
- Last_Mapping_File_Names (Project) :=
- Last_Mapping_File_Names (Project) + 1;
+ Data.Last_Mapping_File_Names := Data.Last_Mapping_File_Names + 1;
-- If there is a project file, call Create_Mapping_File with
-- the project id.
@@ -6707,24 +6623,22 @@ package body Make is
(Project,
In_Tree => Project_Tree,
Language => No_Name,
- Name => The_Mapping_File_Names
- (Project, Last_Mapping_File_Names (Project)));
+ Name => Data.Mapping_File_Names
+ (Data.Last_Mapping_File_Names));
-- Otherwise, just create an empty file
else
Tempdir.Create_Temp_File
(FD,
- The_Mapping_File_Names
- (No_Project, Last_Mapping_File_Names (No_Project)));
+ Data.Mapping_File_Names (Data.Last_Mapping_File_Names));
if FD = Invalid_FD then
Make_Failed ("disk full");
else
Record_Temp_File
- (The_Mapping_File_Names
- (No_Project, Last_Mapping_File_Names (No_Project)));
+ (Data.Mapping_File_Names (Data.Last_Mapping_File_Names));
end if;
Close (FD, Status);
@@ -6736,7 +6650,7 @@ package body Make is
-- And return the index of the newly created file
- File_Index := Last_Mapping_File_Names (Project);
+ File_Index := Data.Last_Mapping_File_Names;
end Init_Mapping_File;
------------
@@ -6929,7 +6843,8 @@ package body Make is
(Project => Main_Project,
In_Tree => Project_Tree,
Project_File_Name => Project_File_Name.all,
- Packages_To_Check => Packages_To_Check_By_Gnatmake);
+ Packages_To_Check => Packages_To_Check_By_Gnatmake,
+ Is_Config_File => False);
-- The parsing of project files may have changed the current output
@@ -6958,18 +6873,22 @@ package body Make is
-- to the search paths.
Add_Source_Directories (Main_Project, Project_Tree);
- Add_Object_Directories (Main_Project, Project_Tree);
+ Add_Object_Directories (Main_Project);
Recursive_Compute_Depth (Main_Project);
-- For each project compute the list of the projects it imports
-- directly or indirectly.
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- Compute_All_Imported_Projects (Proj, Project_Tree);
- end loop;
+ declare
+ Proj : Project_List;
+ begin
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ Compute_All_Imported_Projects (Proj.Project);
+ Proj := Proj.Next;
+ end loop;
+ end;
else
@@ -7015,9 +6934,7 @@ package body Make is
Sfile : File_Name_Type;
Index : Int;
- Extending : constant Boolean :=
- Project_Tree.Projects.Table
- (The_Project).Extends /= No_Project;
+ Extending : constant Boolean := The_Project.Extends /= No_Project;
function Check_Project (P : Project_Id) return Boolean;
-- Returns True if P is The_Project or a project extended by The_Project
@@ -7033,17 +6950,16 @@ package body Make is
elsif Extending then
declare
- Data : Project_Data :=
- Project_Tree.Projects.Table (The_Project);
+ Proj : Project_Id;
begin
- loop
- if P = Data.Extends then
+ Proj := The_Project;
+ while Proj /= null loop
+ if P = Proj.Extends then
return True;
end if;
- Data := Project_Tree.Projects.Table (Data.Extends);
- exit when Data.Extends = No_Project;
+ Proj := Proj.Extends;
end loop;
end;
end if;
@@ -7064,7 +6980,7 @@ package body Make is
Index := 0;
-- If there is a source for the body, and the body has not been
- -- locally removed,
+ -- locally removed.
if Unit.File_Names (Body_Part).Name /= No_File
and then Unit.File_Names (Body_Part).Path.Name /= Slash
@@ -7074,7 +6990,7 @@ package body Make is
if Check_Project (Unit.File_Names (Body_Part).Project) then
-- If we don't have a spec, we cannot consider the source
- -- if it is a subunit
+ -- if it is a subunit.
if Unit.File_Names (Specification).Name = No_File then
declare
@@ -7261,7 +7177,6 @@ package body Make is
Get_Name_String (Source_File);
Saved_Verbosity : constant Verbosity := Current_Verbosity;
Project : Project_Id := No_Project;
- Data : Project_Data;
Path_Name : Path_Name_Type := No_Path;
pragma Warnings (Off, Path_Name);
@@ -7284,13 +7199,12 @@ package body Make is
-- ALI file will not be skipped.
if Project /= No_Project then
- Data := Project_Tree.Projects.Table (Project);
-
declare
Object_Directory : constant String :=
Normalize_Pathname
(Get_Name_String
- (Data.Object_Directory.Display_Name));
+ (Project.
+ Object_Directory.Display_Name));
Olast : Natural := Object_Directory'Last;
@@ -7462,48 +7376,42 @@ package body Make is
N : Name_Id;
B : Byte;
- begin
- if On_Command_Line then
- declare
- Real_Path : constant String := Normalize_Pathname (Dir);
+ function Base_Directory return String;
+ -- If Dir comes from the command line, empty string (relative paths
+ -- are resolved with respect to the current directory), else return
+ -- the main project's directory.
- begin
- if Real_Path'Length = 0 then
- Name_Len := Dir'Length;
- Name_Buffer (1 .. Name_Len) := Dir;
+ --------------------
+ -- Base_Directory --
+ --------------------
- else
- Name_Len := Real_Path'Length;
- Name_Buffer (1 .. Name_Len) := Real_Path;
- end if;
- end;
+ function Base_Directory return String is
+ begin
+ if On_Command_Line then
+ return "";
+ else
+ return Get_Name_String (Main_Project.Directory.Display_Name);
+ end if;
+ end Base_Directory;
- else
- declare
- Real_Path : constant String :=
- Normalize_Pathname
- (Dir,
- Get_Name_String
- (Project_Tree.Projects.Table
- (Main_Project).Directory.Display_Name));
+ Real_Path : constant String := Normalize_Pathname (Dir, Base_Directory);
- begin
- if Real_Path'Length = 0 then
- Name_Len := Dir'Length;
- Name_Buffer (1 .. Name_Len) := Dir;
+ -- Start of processing for Mark_Directory
- else
- Name_Len := Real_Path'Length;
- Name_Buffer (1 .. Name_Len) := Real_Path;
- end if;
- end;
+ begin
+ Name_Len := 0;
+
+ if Real_Path'Length = 0 then
+ Add_Str_To_Name_Buffer (Dir);
+
+ else
+ Add_Str_To_Name_Buffer (Real_Path);
end if;
-- Last character is supposed to be a directory separator
if not Is_Directory_Separator (Name_Buffer (Name_Len)) then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
+ Add_Char_To_Name_Buffer (Directory_Separator);
end if;
-- Add flags to the already existing flags
@@ -7528,28 +7436,25 @@ package body Make is
-------------
procedure Recurse (Prj : Project_Id; Depth : Natural) is
- Data : Project_Data renames Project_Tree.Projects.Table (Prj);
List : Project_List;
Proj : Project_Id;
begin
- if Data.Depth >= Depth
- or Get (Seen, Prj)
- then
+ if Prj.Depth >= Depth or else Get (Seen, Prj) then
return;
end if;
-- We need a test to avoid infinite recursions with limited withs:
-- If we have A -> B -> A, then when set level of A to n, we try and
- -- set level of B to n+1, and then level of A to n + 2,...
+ -- set level of B to n+1, and then level of A to n + 2, ...
Set (Seen, Prj, True);
- Data.Depth := Depth;
+ Prj.Depth := Depth;
-- Visit each imported project
- List := Data.Imported_Projects;
+ List := Prj.Imported_Projects;
while List /= null loop
Proj := List.Project;
List := List.Next;
@@ -7562,13 +7467,15 @@ package body Make is
Set (Seen, Prj, False);
end Recurse;
+ Proj : Project_List;
+
-- Start of processing for Recursive_Compute_Depth
begin
- for Proj in Project_Table.First ..
- Project_Table.Last (Project_Tree.Projects)
- loop
- Project_Tree.Projects.Table (Proj).Depth := 0;
+ Proj := Project_Tree.Projects;
+ while Proj /= null loop
+ Proj.Project.Depth := 0;
+ Proj := Proj.Next;
end loop;
Recurse (Project, Depth => 1);
@@ -7871,6 +7778,12 @@ package body Make is
end;
end if;
+ elsif Argv'Length >= 8 and then
+ Argv (1 .. 8) = "--param="
+ then
+ Add_Switch (Argv, Compiler, And_Save => And_Save);
+ Add_Switch (Argv, Linker, And_Save => And_Save);
+
else
Scan_Make_Switches (Argv, Success);
end if;
@@ -7885,6 +7798,7 @@ package body Make is
elsif (Argv'Length > 5 and then Argv (1 .. 5) = "-RTS=")
or else (Argv'Length > 5 and then Argv (1 .. 5) = "-GCC=")
+ or else (Argv'Length > 8 and then Argv (1 .. 7) = "-param=")
or else (Argv'Length > 10 and then Argv (1 .. 10) = "-GNATLINK=")
or else (Argv'Length > 10 and then Argv (1 .. 10) = "-GNATBIND=")
then
@@ -8252,8 +8166,8 @@ package body Make is
end if;
if Truncated then
- Name_Len := Last;
- Name_Buffer (1 .. Name_Len) := Name (1 .. Last);
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (Name (1 .. Last));
Switches :=
Prj.Util.Value_Of
(Index => Name_Find,
@@ -8261,18 +8175,17 @@ package body Make is
In_Array => Switches_Array,
In_Tree => Project_Tree);
- if Switches = Nil_Variable_Value
- and then Allow_ALI
- then
+ if Switches = Nil_Variable_Value and then Allow_ALI then
Last := Source_File_Name'Length;
while Name (Last) /= '.' loop
Last := Last - 1;
end loop;
- Name (Last + 1 .. Last + 3) := "ali";
- Name_Len := Last + 3;
- Name_Buffer (1 .. Name_Len) := Name (1 .. Name_Len);
+ Name_Len := 0;
+ Add_Str_To_Name_Buffer (Name (1 .. Last));
+ Add_Str_To_Name_Buffer ("ali");
+
Switches :=
Prj.Util.Value_Of
(Index => Name_Find,
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index b1b82398dae..17c34ff51f7 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -373,7 +373,6 @@ package body Makeutl is
procedure Recursive_Add (Proj : Project_Id; Dummy : in out Boolean) is
pragma Unreferenced (Dummy);
- Data : Project_Data renames In_Tree.Projects.Table (Proj);
Linker_Package : Package_Id;
Options : Variable_Value;
@@ -381,7 +380,7 @@ package body Makeutl is
Linker_Package :=
Prj.Util.Value_Of
(Name => Name_Linker,
- In_Packages => Data.Decl.Packages,
+ In_Packages => Proj.Decl.Packages,
In_Tree => In_Tree);
Options :=
@@ -412,20 +411,21 @@ package body Makeutl is
begin
Linker_Opts.Init;
- For_All_Projects (Project, In_Tree, Dummy, Imported_First => True);
+ For_All_Projects (Project, Dummy, Imported_First => True);
Last_Linker_Option := 0;
for Index in reverse 1 .. Linker_Opts.Last loop
declare
- Options : String_List_Id := Linker_Opts.Table (Index).Options;
+ Options : String_List_Id;
Proj : constant Project_Id :=
Linker_Opts.Table (Index).Project;
Option : Name_Id;
Dir_Path : constant String :=
- Get_Name_String (In_Tree.Projects.Table (Proj).Directory.Name);
+ Get_Name_String (Proj.Directory.Name);
begin
+ Options := Linker_Opts.Table (Index).Options;
while Options /= Nil_String loop
Option := In_Tree.String_Elements.Table (Options).Value;
Get_Name_String (Option);
@@ -444,8 +444,7 @@ package body Makeutl is
Including_L_Switch => True);
end if;
- Options :=
- In_Tree.String_Elements.Table (Options).Next;
+ Options := In_Tree.String_Elements.Table (Options).Next;
end loop;
end;
end loop;
@@ -599,7 +598,8 @@ package body Makeutl is
(Switch : in out String_Access;
Parent : String;
Including_L_Switch : Boolean := True;
- Including_Non_Switch : Boolean := True)
+ Including_Non_Switch : Boolean := True;
+ Including_RTS : Boolean := False)
is
begin
if Switch /= null then
@@ -629,13 +629,20 @@ package body Makeutl is
then
Start := 4;
+ elsif Including_RTS
+ and then Sw'Length >= 7
+ and then Sw (2 .. 6) = "-RTS="
+ then
+ Start := 7;
+
else
return;
end if;
-- Because relative path arguments to --RTS= may be relative
-- to the search directory prefix, those relative path
- -- arguments are not converted.
+ -- arguments are converted only when they include directory
+ -- information.
if not Is_Absolute_Path (Sw (Start .. Sw'Last)) then
if Parent'Length = 0 then
@@ -644,6 +651,19 @@ package body Makeutl is
& Sw
& """) are not allowed");
+ elsif Including_RTS then
+ for J in Start .. Sw'Last loop
+ if Sw (J) = Directory_Separator then
+ Switch :=
+ new String'
+ (Sw (1 .. Start - 1) &
+ Parent &
+ Directory_Separator &
+ Sw (Start .. Sw'Last));
+ return;
+ end if;
+ end loop;
+
else
Switch :=
new String'
diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads
index bb8ac84d6bf..c0dc9f16292 100644
--- a/gcc/ada/makeutl.ads
+++ b/gcc/ada/makeutl.ads
@@ -40,6 +40,10 @@ package Makeutl is
Project_Tree : constant Project_Tree_Ref := new Project_Tree_Data;
-- The project tree
+ Subdirs_Option : constant String := "--subdirs=";
+ -- Switch used to indicate that the real directories (object, exec,
+ -- library, ...) are subdirectories of those in the project file.
+
procedure Add
(Option : String_Access;
To : in out String_List_Access;
@@ -130,12 +134,14 @@ package Makeutl is
(Switch : in out String_Access;
Parent : String;
Including_L_Switch : Boolean := True;
- Including_Non_Switch : Boolean := True);
+ Including_Non_Switch : Boolean := True;
+ Including_RTS : Boolean := False);
-- Test if Switch is a relative search path switch.
-- If it is, fail if Parent is the empty string, otherwise prepend the path
-- with Parent. This subprogram is only called when using project files.
-- For gnatbind switches, Including_L_Switch is False, because the
- -- argument of the -L switch is not a path.
+ -- argument of the -L switch is not a path. If Including_RTS is True,
+ -- process also switches --RTS=.
function Path_Or_File_Name (Path : Path_Name_Type) return String;
-- Returns a file name if -df is used, otherwise return a path name
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb
index a1309d716ae..67d9330ae9e 100644
--- a/gcc/ada/mlib-prj.adb
+++ b/gcc/ada/mlib-prj.adb
@@ -229,12 +229,6 @@ package body MLib.Prj is
-- Indicate if Stand-Alone Libraries are automatically initialized using
-- the constructor mechanism.
- function Ultimate_Extension_Of
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref) return Project_Id;
- -- Returns the Project_Id of project Project. Returns No_Project
- -- if Project is No_Project.
-
------------------
-- Add_Argument --
------------------
@@ -309,9 +303,9 @@ package body MLib.Prj is
-- Set to True for the first warning about a unit missing from the
-- interface set.
- Data : Project_Data := In_Tree.Projects.Table (For_Project);
+ Current_Proj : Project_Id;
- Libgnarl_Needed : Yes_No_Unknown := Data.Libgnarl_Needed;
+ Libgnarl_Needed : Yes_No_Unknown := For_Project.Libgnarl_Needed;
-- Set to True if library needs to be linked with libgnarl
Libdecgnat_Needed : Boolean := False;
@@ -323,11 +317,11 @@ package body MLib.Prj is
Object_Directory_Path : constant String :=
Get_Name_String
- (Data.Object_Directory.Display_Name);
+ (For_Project.Object_Directory.Display_Name);
- Standalone : constant Boolean := Data.Standalone_Library;
+ Standalone : constant Boolean := For_Project.Standalone_Library;
- Project_Name : constant String := Get_Name_String (Data.Name);
+ Project_Name : constant String := Get_Name_String (For_Project.Name);
Current_Dir : constant String := Get_Current_Dir;
@@ -486,15 +480,16 @@ package body MLib.Prj is
elsif P /= No_Project then
declare
- Data : Project_Data :=
- In_Tree.Projects.Table (For_Project);
+ Proj : Project_Id;
+
begin
- while Data.Extends /= No_Project loop
- if P = Data.Extends then
+ Proj := For_Project;
+ while Proj.Extends /= No_Project loop
+ if P = Proj.Extends then
return True;
end if;
- Data := In_Tree.Projects.Table (Data.Extends);
+ Proj := Proj.Extends;
end loop;
end;
end if;
@@ -525,12 +520,12 @@ package body MLib.Prj is
Lib_File := Name_Find;
Text := Read_Library_Info (Lib_File, True);
- Id := ALI.Scan_ALI
- (F => Lib_File,
- T => Text,
- Ignore_ED => False,
- Err => True,
- Read_Lines => "D");
+ Id := ALI.Scan_ALI
+ (F => Lib_File,
+ T => Text,
+ Ignore_ED => False,
+ Err => True,
+ Read_Lines => "D");
Free (Text);
-- Look for s-osinte.ads in the dependencies
@@ -542,8 +537,7 @@ package body MLib.Prj is
Libgnarl_Needed := Yes;
if Main_Project then
- In_Tree.Projects.Table (For_Project).Libgnarl_Needed :=
- Yes;
+ For_Project.Libgnarl_Needed := Yes;
else
exit;
end if;
@@ -619,7 +613,7 @@ package body MLib.Prj is
if not Interface_ALIs.Get (Afile) then
if not Warning_For_Library then
Write_Str ("Warning: In library project """);
- Get_Name_String (Data.Name);
+ Get_Name_String (Current_Proj.Name);
To_Mixed (Name_Buffer (1 .. Name_Len));
Write_Str (Name_Buffer (1 .. Name_Len));
Write_Line ("""");
@@ -678,20 +672,19 @@ package body MLib.Prj is
---------------------
procedure Process_Project (Project : Project_Id) is
- Data : Project_Data := In_Tree.Projects.Table (Project);
Imported : Project_List;
begin
-- Nothing to do if process has already been processed
- if not Processed_Projects.Get (Data.Name) then
- Processed_Projects.Set (Data.Name, True);
+ if not Processed_Projects.Get (Project.Name) then
+ Processed_Projects.Set (Project.Name, True);
-- Call Process_Project recursively for any imported project.
-- We first process the imported projects to guarantee that
-- we have a proper reverse order for the libraries.
- Imported := Data.Imported_Projects;
+ Imported := Project.Imported_Projects;
while Imported /= null loop
if Imported.Project /= No_Project then
Process_Project (Imported.Project);
@@ -702,22 +695,22 @@ package body MLib.Prj is
-- If it is a library project, add it to Library_Projs
- if Project /= For_Project and then Data.Library then
+ if Project /= For_Project and then Project.Library then
Library_Projs.Increment_Last;
Library_Projs.Table (Library_Projs.Last) := Project;
-- Check if because of this library we need to use libgnarl
if Libgnarl_Needed = Unknown then
- if Data.Libgnarl_Needed = Unknown
- and then Data.Object_Directory /= No_Path_Information
+ if Project.Libgnarl_Needed = Unknown
+ and then Project.Object_Directory /= No_Path_Information
then
-- Check if libgnarl is needed for this library
declare
Object_Dir_Path : constant String :=
Get_Name_String
- (Data.Object_Directory.
+ (Project.Object_Directory.
Display_Name);
Object_Dir : Dir_Type;
Filename : String (1 .. 255);
@@ -755,10 +748,8 @@ package body MLib.Prj is
(ALI_File, Main_Project => False);
if Libgnarl_Needed = Yes then
- Data.Libgnarl_Needed := Yes;
- In_Tree.Projects.Table
- (For_Project).Libgnarl_Needed :=
- Yes;
+ Project.Libgnarl_Needed := Yes;
+ For_Project.Libgnarl_Needed := Yes;
exit;
end if;
end if;
@@ -770,10 +761,9 @@ package body MLib.Prj is
end;
end if;
- if Data.Libgnarl_Needed = Yes then
+ if Project.Libgnarl_Needed = Yes then
Libgnarl_Needed := Yes;
- In_Tree.Projects.Table (For_Project).Libgnarl_Needed :=
- Yes;
+ For_Project.Libgnarl_Needed := Yes;
end if;
end if;
end if;
@@ -795,8 +785,7 @@ package body MLib.Prj is
for Index in reverse 1 .. Library_Projs.Last loop
Current := Library_Projs.Table (Index);
- Get_Name_String
- (In_Tree.Projects.Table (Current).Library_Dir.Display_Name);
+ Get_Name_String (Current.Library_Dir.Display_Name);
Opts.Increment_Last;
Opts.Table (Opts.Last) :=
new String'("-L" & Name_Buffer (1 .. Name_Len));
@@ -807,11 +796,7 @@ package body MLib.Prj is
Opts.Increment_Last;
Opts.Table (Opts.Last) :=
- new String'
- ("-l" &
- Get_Name_String
- (In_Tree.Projects.Table
- (Current).Library_Name));
+ new String'("-l" & Get_Name_String (Current.Library_Name));
end loop;
end Process_Imported_Libraries;
@@ -822,13 +807,13 @@ package body MLib.Prj is
-- Fail if project is not a library project
- if not Data.Library then
+ if not For_Project.Library then
Com.Fail ("project """ & Project_Name & """ has no library");
end if;
-- Do not attempt to build the library if it is externally built
- if Data.Externally_Built then
+ if For_Project.Externally_Built then
return;
end if;
@@ -888,10 +873,11 @@ package body MLib.Prj is
end if;
Add_Argument
- (B_Start.all & Get_Name_String (Data.Library_Name) & ".adb");
- Add_Argument ("-L" & Get_Name_String (Data.Library_Name));
+ (B_Start.all
+ & Get_Name_String (For_Project.Library_Name) & ".adb");
+ Add_Argument ("-L" & Get_Name_String (For_Project.Library_Name));
- if Data.Lib_Auto_Init and then SALs_Use_Constructors then
+ if For_Project.Lib_Auto_Init and then SALs_Use_Constructors then
Add_Argument (Auto_Initialize);
end if;
@@ -902,7 +888,7 @@ package body MLib.Prj is
Binder_Package : constant Package_Id :=
Value_Of
(Name => Name_Binder,
- In_Packages => Data.Decl.Packages,
+ In_Packages => For_Project.Decl.Packages,
In_Tree => In_Tree);
begin
@@ -1172,7 +1158,7 @@ package body MLib.Prj is
if not Success then
Com.Fail ("could not bind standalone library "
- & Get_Name_String (Data.Library_Name));
+ & Get_Name_String (For_Project.Library_Name));
end if;
end if;
@@ -1204,7 +1190,8 @@ package body MLib.Prj is
end if;
Add_Argument
- (B_Start.all & Get_Name_String (Data.Library_Name) & ".adb");
+ (B_Start.all
+ & Get_Name_String (For_Project.Library_Name) & ".adb");
-- If necessary, add the PIC option
@@ -1264,7 +1251,7 @@ package body MLib.Prj is
if not Success then
Com.Fail
("could not compile binder generated file for library "
- & Get_Name_String (Data.Library_Name));
+ & Get_Name_String (For_Project.Library_Name));
end if;
-- Process binder generated file for pragmas Linker_Options
@@ -1280,15 +1267,15 @@ package body MLib.Prj is
-- If attributes Library_GCC or Linker'Driver were specified, get the
-- driver name.
- if Data.Config.Shared_Lib_Driver /= No_File then
- Driver_Name := Name_Id (Data.Config.Shared_Lib_Driver);
+ if For_Project.Config.Shared_Lib_Driver /= No_File then
+ Driver_Name := Name_Id (For_Project.Config.Shared_Lib_Driver);
end if;
-- If attribute Library_Options was specified, add these additional
-- options.
- Library_Options :=
- Value_Of (Name_Library_Options, Data.Decl.Attributes, In_Tree);
+ Library_Options := Value_Of
+ (Name_Library_Options, For_Project.Decl.Attributes, In_Tree);
if not Library_Options.Default then
declare
@@ -1313,10 +1300,11 @@ package body MLib.Prj is
end if;
Lib_Dirpath :=
- new String'(Get_Name_String (Data.Library_Dir.Display_Name));
- Lib_Filename := new String'(Get_Name_String (Data.Library_Name));
+ new String'(Get_Name_String (For_Project.Library_Dir.Display_Name));
+ Lib_Filename := new String'
+ (Get_Name_String (For_Project.Library_Name));
- case Data.Library_Kind is
+ case For_Project.Library_Kind is
when Static =>
The_Build_Mode := Static;
@@ -1334,9 +1322,9 @@ package body MLib.Prj is
-- Get the library version, if any
- if Data.Lib_Internal_Name /= No_Name then
+ if For_Project.Lib_Internal_Name /= No_Name then
Lib_Version :=
- new String'(Get_Name_String (Data.Lib_Internal_Name));
+ new String'(Get_Name_String (For_Project.Lib_Internal_Name));
end if;
-- Add the objects found in the object directory and the object
@@ -1347,14 +1335,16 @@ package body MLib.Prj is
In_Main_Object_Directory := True;
- Foreign_Sources := Has_Foreign_Sources (Data);
+ Foreign_Sources := Has_Foreign_Sources (For_Project);
+ Current_Proj := For_Project;
loop
- if Data.Object_Directory /= No_Path_Information then
+ if Current_Proj.Object_Directory /= No_Path_Information then
declare
Object_Dir_Path : constant String :=
Get_Name_String
- (Data.Object_Directory.Display_Name);
+ (Current_Proj.Object_Directory
+ .Display_Name);
Object_Dir : Dir_Type;
Filename : String (1 .. 255);
Last : Natural;
@@ -1527,15 +1517,15 @@ package body MLib.Prj is
when Directory_Error =>
Com.Fail ("cannot find object directory """
& Get_Name_String
- (Data.Object_Directory.Display_Name)
+ (Current_Proj.Object_Directory.Display_Name)
& """");
end;
end if;
- exit when Data.Extends = No_Project;
+ exit when Current_Proj.Extends = No_Project;
In_Main_Object_Directory := False;
- Data := In_Tree.Projects.Table (Data.Extends);
+ Current_Proj := Current_Proj.Extends;
end loop;
-- Add the -L and -l switches for the imported Library Project Files,
@@ -1743,10 +1733,10 @@ package body MLib.Prj is
-- the library directory (by Copy_ALI_Files, below).
if Standalone then
- Data := In_Tree.Projects.Table (For_Project);
+ Current_Proj := For_Project;
declare
- Iface : String_List_Id := Data.Lib_Interface_ALIs;
+ Iface : String_List_Id := For_Project.Lib_Interface_ALIs;
ALI : File_Name_Type;
begin
@@ -1761,7 +1751,7 @@ package body MLib.Prj is
Iface := In_Tree.String_Elements.Table (Iface).Next;
end loop;
- Iface := Data.Lib_Interface_ALIs;
+ Iface := For_Project.Lib_Interface_ALIs;
if not Opt.Quiet_Output then
@@ -1803,8 +1793,7 @@ package body MLib.Prj is
-- the library file and any ALI file of a source of the project.
begin
- Get_Name_String
- (In_Tree.Projects.Table (For_Project).Library_Dir.Name);
+ Get_Name_String (For_Project.Library_Dir.Name);
Change_Dir (Name_Buffer (1 .. Name_Len));
exception
@@ -1856,9 +1845,9 @@ package body MLib.Prj is
if Unit.File_Names (Body_Part).Project /=
No_Project
then
- if Ultimate_Extension_Of
- (Unit.File_Names (Body_Part).Project,
- In_Tree) = For_Project
+ if Ultimate_Extending_Project_Of
+ (Unit.File_Names (Body_Part).Project) =
+ For_Project
then
Get_Name_String
(Unit.File_Names (Body_Part).Name);
@@ -1873,9 +1862,9 @@ package body MLib.Prj is
end if;
end if;
- elsif Ultimate_Extension_Of
- (Unit.File_Names (Specification).Project,
- In_Tree) = For_Project
+ elsif Ultimate_Extending_Project_Of
+ (Unit.File_Names (Specification).Project) =
+ For_Project
then
Get_Name_String
(Unit.File_Names (Specification).Name);
@@ -1918,10 +1907,10 @@ package body MLib.Prj is
Interfaces => Arguments (1 .. Argument_Number),
Lib_Filename => Lib_Filename.all,
Lib_Dir => Lib_Dirpath.all,
- Symbol_Data => Data.Symbol_Data,
+ Symbol_Data => Current_Proj.Symbol_Data,
Driver_Name => Driver_Name,
Lib_Version => Lib_Version.all,
- Auto_Init => Data.Lib_Auto_Init);
+ Auto_Init => Current_Proj.Lib_Auto_Init);
when Static =>
MLib.Build_Library
@@ -1944,22 +1933,19 @@ package body MLib.Prj is
Copy_ALI_Files
(Files => Ali_Files.all,
- To => In_Tree.Projects.Table
- (For_Project).Library_ALI_Dir.Name,
+ To => For_Project.Library_ALI_Dir.Name,
Interfaces => Arguments (1 .. Argument_Number));
-- Copy interface sources if Library_Src_Dir specified
if Standalone
- and then In_Tree.Projects.Table
- (For_Project).Library_Src_Dir /= No_Path_Information
+ and then For_Project.Library_Src_Dir /= No_Path_Information
then
-- Clean the interface copy directory: remove any source that
-- could be a source of the project.
begin
- Get_Name_String
- (In_Tree.Projects.Table (For_Project).Library_Src_Dir.Name);
+ Get_Name_String (For_Project.Library_Src_Dir.Name);
Change_Dir (Name_Buffer (1 .. Name_Len));
exception
@@ -1997,9 +1983,8 @@ package body MLib.Prj is
for Index in 1 .. Unit_Table.Last (In_Tree.Units) loop
Unit := In_Tree.Units.Table (Index);
- if Ultimate_Extension_Of
- (Unit.File_Names (Body_Part).Project, In_Tree) =
- For_Project
+ if Ultimate_Extending_Project_Of
+ (Unit.File_Names (Body_Part).Project) = For_Project
and then
Get_Name_String
(Unit.File_Names (Body_Part).Name) =
@@ -2009,9 +1994,9 @@ package body MLib.Prj is
exit;
end if;
- if Ultimate_Extension_Of
- (Unit.File_Names (Specification).Project, In_Tree) =
- For_Project
+ if Ultimate_Extending_Project_Of
+ (Unit.File_Names (Specification).Project) =
+ For_Project
and then
Get_Name_String
(Unit.File_Names (Specification).Name) =
@@ -2036,8 +2021,7 @@ package body MLib.Prj is
(For_Project => For_Project,
In_Tree => In_Tree,
Interfaces => Arguments (1 .. Argument_Number),
- To_Dir => In_Tree.Projects.Table
- (For_Project).Library_Src_Dir.Display_Name);
+ To_Dir => For_Project.Library_Src_Dir.Display_Name);
end if;
end if;
@@ -2077,8 +2061,6 @@ package body MLib.Prj is
procedure Check_Library
(For_Project : Project_Id; In_Tree : Project_Tree_Ref)
is
- Data : constant Project_Data :=
- In_Tree.Projects.Table (For_Project);
Lib_TS : Time_Stamp_Type;
Current : constant Dir_Name_Str := Get_Current_Dir;
@@ -2086,19 +2068,19 @@ package body MLib.Prj is
-- No need to build the library if there is no object directory,
-- hence no object files to build the library.
- if Data.Library then
+ if For_Project.Library then
declare
Lib_Name : constant File_Name_Type :=
- Library_File_Name_For (For_Project, In_Tree);
+ Library_File_Name_For (For_Project, In_Tree);
begin
- Change_Dir (Get_Name_String (Data.Library_Dir.Name));
+ Change_Dir (Get_Name_String (For_Project.Library_Dir.Name));
Lib_TS := File_Stamp (Lib_Name);
- In_Tree.Projects.Table (For_Project).Library_TS := Lib_TS;
+ For_Project.Library_TS := Lib_TS;
end;
- if not Data.Externally_Built
- and then not Data.Need_To_Build_Lib
- and then Data.Object_Directory /= No_Path_Information
+ if not For_Project.Externally_Built
+ and then not For_Project.Need_To_Build_Lib
+ and then For_Project.Object_Directory /= No_Path_Information
then
declare
Obj_TS : Time_Stamp_Type;
@@ -2112,7 +2094,8 @@ package body MLib.Prj is
-- If the library file does not exist, then the time stamp will
-- be Empty_Time_Stamp, earlier than any other time stamp.
- Change_Dir (Get_Name_String (Data.Object_Directory.Name));
+ Change_Dir
+ (Get_Name_String (For_Project.Object_Directory.Name));
Open (Dir => Object_Dir, Dir_Name => ".");
-- For all entries in the object directory
@@ -2141,8 +2124,7 @@ package body MLib.Prj is
-- Library must be rebuilt
- In_Tree.Projects.Table
- (For_Project).Need_To_Build_Lib := True;
+ For_Project.Need_To_Build_Lib := True;
exit;
end if;
end if;
@@ -2244,7 +2226,7 @@ package body MLib.Prj is
return True;
end if;
- Ext := In_Tree.Projects.Table (Ext).Extends;
+ Ext := Ext.Extends;
end loop;
return False;
@@ -2255,9 +2237,7 @@ package body MLib.Prj is
begin
-- Change the working directory to the object directory
- Change_Dir
- (Get_Name_String
- (In_Tree.Projects.Table (For_Project).Object_Directory.Name));
+ Change_Dir (Get_Name_String (For_Project.Object_Directory.Name));
for Index in Interfaces'Range loop
@@ -2533,27 +2513,4 @@ package body MLib.Prj is
return C_SALs_Init_Using_Constructors /= 0;
end SALs_Use_Constructors;
- ---------------------------
- -- Ultimate_Extension_Of --
- ---------------------------
-
- function Ultimate_Extension_Of
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref) return Project_Id
- is
- Result : Project_Id := Project;
- Data : Project_Data;
-
- begin
- if Project /= No_Project then
- loop
- Data := In_Tree.Projects.Table (Result);
- exit when Data.Extended_By = No_Project;
- Result := Data.Extended_By;
- end loop;
- end if;
-
- return Result;
- end Ultimate_Extension_Of;
-
end MLib.Prj;
diff --git a/gcc/ada/mlib-tgt.adb b/gcc/ada/mlib-tgt.adb
index b2c7c952ede..b07bb74d687 100644
--- a/gcc/ada/mlib-tgt.adb
+++ b/gcc/ada/mlib-tgt.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -317,7 +317,8 @@ package body MLib.Tgt is
------------------------
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
begin
return Library_Exists_For_Ptr (Project, In_Tree);
@@ -328,10 +329,13 @@ package body MLib.Tgt is
--------------------------------
function Library_Exists_For_Default
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean
is
+ pragma Unreferenced (In_Tree);
+
begin
- if not In_Tree.Projects.Table (Project).Library then
+ if not Project.Library then
Prj.Com.Fail ("INTERNAL ERROR: Library_Exists_For called " &
"for non library project");
return False;
@@ -339,14 +343,12 @@ package body MLib.Tgt is
else
declare
Lib_Dir : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Dir.Name);
+ Get_Name_String (Project.Library_Dir.Name);
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String (Project.Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind = Static then
+ if Project.Library_Kind = Static then
return Is_Regular_File
(Lib_Dir & Directory_Separator & "lib" &
Fil.Append_To (Lib_Name, Archive_Ext));
@@ -380,8 +382,9 @@ package body MLib.Tgt is
(Project : Project_Id;
In_Tree : Project_Tree_Ref) return File_Name_Type
is
+ pragma Unreferenced (In_Tree);
begin
- if not In_Tree.Projects.Table (Project).Library then
+ if not Project.Library then
Prj.Com.Fail ("INTERNAL ERROR: Library_File_Name_For called " &
"for non library project");
return No_File;
@@ -389,11 +392,10 @@ package body MLib.Tgt is
else
declare
Lib_Name : constant String :=
- Get_Name_String
- (In_Tree.Projects.Table (Project).Library_Name);
+ Get_Name_String (Project.Library_Name);
begin
- if In_Tree.Projects.Table (Project).Library_Kind =
+ if Project.Library_Kind =
Static
then
Name_Len := 3;
diff --git a/gcc/ada/mlib-tgt.ads b/gcc/ada/mlib-tgt.ads
index ce36d7f0077..cbb15d3ac1d 100644
--- a/gcc/ada/mlib-tgt.ads
+++ b/gcc/ada/mlib-tgt.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2008, AdaCore --
+-- Copyright (C) 2001-2009, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -140,7 +140,8 @@ package MLib.Tgt is
-- are ignored.
function Library_Exists_For
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean;
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean;
-- Return True if the library file for a library project already exists.
-- This function can only be called for library projects.
@@ -166,6 +167,7 @@ private
type Is_Ext_Function is access function (Ext : String) return Boolean;
type String_List_Access_Function is access function
return String_List_Access;
+
type Build_Dynamic_Library_Function is access procedure
(Ofiles : Argument_List;
Options : Argument_List;
@@ -176,11 +178,15 @@ private
Driver_Name : Name_Id := No_Name;
Lib_Version : String := "";
Auto_Init : Boolean := False);
+
type Library_Exists_For_Function is access function
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean;
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean;
+
type Library_File_Name_For_Function is access function
(Project : Project_Id;
In_Tree : Project_Tree_Ref) return File_Name_Type;
+
type Boolean_Function is access function return Boolean;
type Library_Support_Function is access function return Library_Support;
@@ -233,7 +239,8 @@ private
Libgnat_Ptr : String_Function := Libgnat_Default'Access;
function Library_Exists_For_Default
- (Project : Project_Id; In_Tree : Project_Tree_Ref) return Boolean;
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref) return Boolean;
Library_Exists_For_Ptr : Library_Exists_For_Function :=
Library_Exists_For_Default'Access;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 229babfff00..e999c646b77 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -1110,6 +1110,13 @@ package Opt is
-- multiplied by the factor given here. The default value is used if no
-- -gnatT switch appears.
+ Tagged_Type_Expansion : Boolean := True;
+ -- GNAT
+ -- Set True if tagged types and interfaces should be expanded by the
+ -- front-end. If False, the original tree is left unexpanded for
+ -- tagged types and dispatching calls, assuming the underlying target
+ -- supports it (e.g. case of JVM).
+
Task_Dispatching_Policy : Character := ' ';
-- GNAT, GNATBIND
-- Set to ' ' for the default case (no task dispatching policy specified).
diff --git a/gcc/ada/osint.adb b/gcc/ada/osint.adb
index 04e2919cc24..770c499312b 100644
--- a/gcc/ada/osint.adb
+++ b/gcc/ada/osint.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -29,6 +29,8 @@ with System.Case_Util; use System.Case_Util;
with GNAT.HTable;
+with Alloc;
+with Debug;
with Fmap; use Fmap;
with Gnatvsn; use Gnatvsn;
with Hostparm;
@@ -111,6 +113,9 @@ package body Osint is
-- Converts a C String to an Ada String. Are we doing this to avoid withing
-- Interfaces.C.Strings ???
+ function Include_Dir_Default_Prefix return String_Access;
+ -- Same as exported version, except returns a String_Access
+
------------------------------
-- Other Local Declarations --
------------------------------
@@ -137,6 +142,20 @@ package body Osint is
-- latest source, library and object files opened by Read_Source_File and
-- Read_Library_Info.
+ package File_Name_Chars is new Table.Table (
+ Table_Component_Type => Character,
+ Table_Index_Type => Int,
+ Table_Low_Bound => 1,
+ Table_Initial => Alloc.File_Name_Chars_Initial,
+ Table_Increment => Alloc.File_Name_Chars_Increment,
+ Table_Name => "File_Name_Chars");
+ -- Table to store text to be printed by Dump_Source_File_Names
+
+ The_Include_Dir_Default_Prefix : String_Access := null;
+ -- Value returned by Include_Dir_Default_Prefix. We don't initialize it
+ -- here, because that causes an elaboration cycle with Sdefault; we
+ -- initialize it lazily instead.
+
------------------
-- Search Paths --
------------------
@@ -717,6 +736,16 @@ package body Osint is
end if;
end Dir_In_Src_Search_Path;
+ ----------------------------
+ -- Dump_Source_File_Names --
+ ----------------------------
+
+ procedure Dump_Source_File_Names is
+ subtype Rng is Int range File_Name_Chars.First .. File_Name_Chars.Last;
+ begin
+ Write_Str (String (File_Name_Chars.Table (Rng)));
+ end Dump_Source_File_Names;
+
---------------------
-- Executable_Name --
---------------------
@@ -1392,22 +1421,19 @@ package body Osint is
-- Include_Dir_Default_Prefix --
--------------------------------
- function Include_Dir_Default_Prefix return String is
- Include_Dir : String_Access :=
- String_Access (Update_Path (Include_Dir_Default_Name));
-
+ function Include_Dir_Default_Prefix return String_Access is
begin
- if Include_Dir = null then
- return "";
-
- else
- declare
- Result : constant String := Include_Dir.all;
- begin
- Free (Include_Dir);
- return Result;
- end;
+ if The_Include_Dir_Default_Prefix = null then
+ The_Include_Dir_Default_Prefix :=
+ String_Access (Update_Path (Include_Dir_Default_Name));
end if;
+
+ return The_Include_Dir_Default_Prefix;
+ end Include_Dir_Default_Prefix;
+
+ function Include_Dir_Default_Prefix return String is
+ begin
+ return Include_Dir_Default_Prefix.all;
end Include_Dir_Default_Prefix;
----------------
@@ -2268,6 +2294,32 @@ package body Osint is
return;
end if;
+ -- Print out the file name, if requested, and if it's not part of the
+ -- runtimes, store it in File_Name_Chars.
+
+ declare
+ Name : String renames Name_Buffer (1 .. Name_Len);
+ Inc : String renames Include_Dir_Default_Prefix.all;
+
+ begin
+ if Debug.Debug_Flag_Dot_N then
+ Write_Line (Name);
+ end if;
+
+ if Inc /= ""
+ and then Inc'Length < Name_Len
+ and then Name_Buffer (1 .. Inc'Length) = Inc
+ then
+ -- Part of runtimes, so ignore it
+
+ null;
+
+ else
+ File_Name_Chars.Append_All (File_Name_Chars.Table_Type (Name));
+ File_Name_Chars.Append (ASCII.LF);
+ end if;
+ end;
+
-- Prepare to read data from the file
Len := Integer (File_Length (Source_File_FD));
@@ -2292,9 +2344,9 @@ package body Osint is
begin
-- Allocate source buffer, allowing extra character at end for EOF
- -- Some systems (e.g. VMS) have file types that require one
- -- read per line, so read until we get the Len bytes or until
- -- there are no more characters.
+ -- Some systems (e.g. VMS) have file types that require one read per
+ -- line, so read until we get the Len bytes or until there are no
+ -- more characters.
Hi := Lo;
loop
@@ -2306,8 +2358,8 @@ package body Osint is
Actual_Ptr (Hi) := EOF;
-- Now we need to work out the proper virtual origin pointer to
- -- return. This is exactly Actual_Ptr (0)'Address, but we have
- -- to be careful to suppress checks to compute this address.
+ -- return. This is exactly Actual_Ptr (0)'Address, but we have to
+ -- be careful to suppress checks to compute this address.
declare
pragma Suppress (All_Checks);
diff --git a/gcc/ada/osint.ads b/gcc/ada/osint.ads
index 4d82c86a5a2..5de8eced2ac 100644
--- a/gcc/ada/osint.ads
+++ b/gcc/ada/osint.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -410,6 +410,12 @@ package Osint is
-- Cache => True access to source file data does not incur a penalty if
-- this data was previously retrieved.
+ procedure Dump_Source_File_Names;
+ -- Prints out the names of all source files that have been read by
+ -- Read_Source_File, except those that come from the run-time library
+ -- (i.e. Include_Dir_Default_Prefix). The text is sent to whatever Output
+ -- is currently using (e.g. standard output or standard error).
+
-------------------------------------------
-- Representation of Library Information --
-------------------------------------------
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb
index 951d3087540..046ac43e775 100644
--- a/gcc/ada/par-ch12.adb
+++ b/gcc/ada/par-ch12.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -100,7 +100,8 @@ package body Ch12 is
Scan; -- past GENERIC
if Token = Tok_Private then
- Error_Msg_SC ("PRIVATE goes before GENERIC, not after");
+ Error_Msg_SC -- CODEFIX
+ ("PRIVATE goes before GENERIC, not after");
Scan; -- past junk PRIVATE token
end if;
@@ -179,7 +180,7 @@ package body Ch12 is
Append (P_Formal_Subprogram_Declaration, Decls);
else
- Error_Msg_BC
+ Error_Msg_BC -- CODEFIX
("FUNCTION, PROCEDURE or PACKAGE expected here");
Resync_Past_Semicolon;
end if;
@@ -657,7 +658,8 @@ package body Ch12 is
else
if Token = Tok_Abstract then
- Error_Msg_SC ("ABSTRACT must come before LIMITED");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT must come before LIMITED");
Scan; -- past improper ABSTRACT
if Token = Tok_New then
@@ -805,15 +807,18 @@ package body Ch12 is
if Token = Tok_Abstract then
if Prev_Token = Tok_Tagged then
- Error_Msg_SC ("ABSTRACT must come before TAGGED");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT must come before TAGGED");
elsif Prev_Token = Tok_Limited then
- Error_Msg_SC ("ABSTRACT must come before LIMITED");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT must come before LIMITED");
end if;
Resync_Past_Semicolon;
elsif Token = Tok_Tagged then
- Error_Msg_SC ("TAGGED must come before LIMITED");
+ Error_Msg_SC -- CODEFIX
+ ("TAGGED must come before LIMITED");
Resync_Past_Semicolon;
end if;
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index b90e0840652..973f64360df 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -541,7 +541,8 @@ package body Ch3 is
end if;
if Token = Tok_Abstract then
- Error_Msg_SC ("ABSTRACT must come before TAGGED");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT must come before TAGGED");
Abstract_Present := True;
Abstract_Loc := Token_Ptr;
Scan; -- past ABSTRACT
@@ -606,11 +607,13 @@ package body Ch3 is
loop
if Token = Tok_Tagged then
- Error_Msg_SC ("TAGGED must come before LIMITED");
+ Error_Msg_SC -- CODEFIX
+ ("TAGGED must come before LIMITED");
Scan; -- past TAGGED
elsif Token = Tok_Abstract then
- Error_Msg_SC ("ABSTRACT must come before LIMITED");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT must come before LIMITED");
Scan; -- past ABSTRACT
else
@@ -1526,7 +1529,8 @@ package body Ch3 is
end if;
if Token = Tok_Aliased then
- Error_Msg_SC ("ALIASED should be before CONSTANT");
+ Error_Msg_SC -- CODEFIX
+ ("ALIASED should be before CONSTANT");
Scan; -- past ALIASED
Set_Aliased_Present (Decl_Node, True);
end if;
@@ -1888,7 +1892,8 @@ package body Ch3 is
end if;
if Token = Tok_Abstract then
- Error_Msg_SC ("ABSTRACT must come before NEW, not after");
+ Error_Msg_SC -- CODEFIX
+ ("ABSTRACT must come before NEW, not after");
Scan;
end if;
@@ -2306,7 +2311,8 @@ package body Ch3 is
-- Handle decimal fixed-point defn with DIGITS/DELTA in wrong order
if Token = Tok_Delta then
- Error_Msg_SC ("|DELTA must come before DIGITS");
+ Error_Msg_SC -- CODEFIX
+ ("|DELTA must come before DIGITS");
Def_Node := New_Node (N_Decimal_Fixed_Point_Definition, Digits_Loc);
Scan; -- past DELTA
Set_Delta_Expression (Def_Node, P_Expression_No_Right_Paren);
@@ -3791,7 +3797,8 @@ package body Ch3 is
Scan; -- past PROTECTED
if Token /= Tok_Procedure and then Token /= Tok_Function then
- Error_Msg_SC ("FUNCTION or PROCEDURE expected");
+ Error_Msg_SC -- CODEFIX
+ ("FUNCTION or PROCEDURE expected");
end if;
end if;
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 80a566beb5c..af91f1668d7 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -607,7 +607,8 @@ package body Ch4 is
elsif Token = Tok_Range then
if Expr_Form /= EF_Simple_Name then
- Error_Msg_SC ("subtype mark must precede RANGE");
+ Error_Msg_SC -- CODEFIX???
+ ("subtype mark must precede RANGE");
raise Error_Resync;
end if;
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb
index e0a7e0af6f8..f782f51e024 100644
--- a/gcc/ada/par-ch5.adb
+++ b/gcc/ada/par-ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -178,7 +178,8 @@ package body Ch5 is
procedure Junk_Declaration is
begin
if (not Declaration_Found) or All_Errors_Mode then
- Error_Msg_SC ("declarations must come before BEGIN");
+ Error_Msg_SC -- CODEFIX
+ ("declarations must come before BEGIN");
Declaration_Found := True;
end if;
@@ -450,7 +451,8 @@ package body Ch5 is
and then Block_Label = Name_Go
and then Token_Name = Name_To
then
- Error_Msg_SP ("goto is one word");
+ Error_Msg_SP -- CODEFIX
+ ("goto is one word");
Append_To (Statement_List, P_Goto_Statement);
Statement_Required := False;
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index d91b2d9f15d..ea5df6dfb3b 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -227,7 +227,8 @@ package body Ch6 is
Error_Msg_SC ("overriding indicator not allowed here!");
elsif Token /= Tok_Function and then Token /= Tok_Procedure then
- Error_Msg_SC ("FUNCTION or PROCEDURE expected!");
+ Error_Msg_SC -- CODEFIX
+ ("FUNCTION or PROCEDURE expected!");
end if;
end if;
@@ -1301,7 +1302,8 @@ package body Ch6 is
end if;
if Token = Tok_In then
- Error_Msg_SC ("IN must precede OUT in parameter mode");
+ Error_Msg_SC -- CODEFIX ???
+ ("IN must precede OUT in parameter mode");
Scan; -- past IN
Set_In_Present (Node, True);
end if;
@@ -1430,7 +1432,8 @@ package body Ch6 is
Set_Constant_Present (Decl_Node);
if Token = Tok_Aliased then
- Error_Msg_SC ("ALIASED should be before CONSTANT");
+ Error_Msg_SC -- CODEFIX
+ ("ALIASED should be before CONSTANT");
Scan; -- past ALIASED
Set_Aliased_Present (Decl_Node);
end if;
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index d5c3549f23d..1271d478a73 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -651,7 +651,8 @@ package body Ch9 is
Set_Must_Not_Override (Specification (Decl), Not_Overriding);
else
- Error_Msg_SC ("ENTRY, FUNCTION or PROCEDURE expected!");
+ Error_Msg_SC -- CODEFIX
+ ("ENTRY, FUNCTION or PROCEDURE expected!");
end if;
end if;
diff --git a/gcc/ada/par-endh.adb b/gcc/ada/par-endh.adb
index e04b154e506..94e753976aa 100644
--- a/gcc/ada/par-endh.adb
+++ b/gcc/ada/par-endh.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -717,7 +717,8 @@ package body Endh is
if Error_Msg_Name_1 > Error_Name then
if Is_Bad_Spelling_Of (Chars (Nam), Chars (End_Labl)) then
Error_Msg_Name_1 := Chars (Nam);
- Error_Msg_N ("misspelling of %", End_Labl);
+ Error_Msg_N -- CODEFIX
+ ("misspelling of %", End_Labl);
Syntax_OK := True;
return;
end if;
@@ -839,29 +840,32 @@ package body Endh is
end if;
if End_Type = E_Case then
- Error_Msg_SC ("`END CASE;` expected@ for CASE#!");
+ Error_Msg_SC -- CODEFIX
+ ("`END CASE;` expected@ for CASE#!");
elsif End_Type = E_If then
- Error_Msg_SC ("`END IF;` expected@ for IF#!");
+ Error_Msg_SC -- CODEFIX
+ ("`END IF;` expected@ for IF#!");
elsif End_Type = E_Loop then
if Error_Msg_Node_1 = Empty then
- Error_Msg_SC
+ Error_Msg_SC -- CODEFIX
("`END LOOP;` expected@ for LOOP#!");
else
- Error_Msg_SC ("`END LOOP &;` expected@!");
+ Error_Msg_SC -- CODEFIX
+ ("`END LOOP &;` expected@!");
end if;
elsif End_Type = E_Record then
- Error_Msg_SC
+ Error_Msg_SC -- CODEFIX
("`END RECORD;` expected@ for RECORD#!");
elsif End_Type = E_Return then
- Error_Msg_SC
+ Error_Msg_SC -- CODEFIX
("`END RETURN;` expected@ for RETURN#!");
elsif End_Type = E_Select then
- Error_Msg_SC
+ Error_Msg_SC -- CODEFIX
("`END SELECT;` expected@ for SELECT#!");
-- All remaining cases are cases with a name (we do not treat
@@ -870,9 +874,11 @@ package body Endh is
elsif End_Type = E_Name or else (not Ins) then
if Error_Msg_Node_1 = Empty then
- Error_Msg_SC ("`END;` expected@ for BEGIN#!");
+ Error_Msg_SC -- CODEFIX
+ ("`END;` expected@ for BEGIN#!");
else
- Error_Msg_SC ("`END &;` expected@!");
+ Error_Msg_SC -- CODEFIX
+ ("`END &;` expected@!");
end if;
-- The other possibility is a missing END for a subprogram with a
diff --git a/gcc/ada/par-load.adb b/gcc/ada/par-load.adb
index 544998b623e..e21fb0434c6 100644
--- a/gcc/ada/par-load.adb
+++ b/gcc/ada/par-load.adb
@@ -205,7 +205,8 @@ begin
begin
Error_Msg_Unit_1 := Expect_Name;
- Error_Msg ("$$ is not a predefined library unit!", Loc);
+ Error_Msg -- CODEFIX
+ ("$$ is not a predefined library unit!", Loc);
-- In the predefined file case, we know the user did not
-- construct their own package, but we got the wrong one.
@@ -229,7 +230,8 @@ begin
(Name_Id (Expect_Name), Name_Id (Actual_Name))
then
Error_Msg_Unit_1 := Actual_Name;
- Error_Msg ("possible misspelling of $$!", Loc);
+ Error_Msg -- CODEFIX
+ ("possible misspelling of $$!", Loc);
end if;
end;
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 7ca24703507..eb77f860b4f 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -818,7 +818,7 @@ begin
and then Num_SRef_Pragmas (Current_Source_File) = 0
and then Operating_Mode /= Check_Syntax
then
- Error_Msg
+ Error_Msg -- CODEFIX
("first % pragma must be first line of file", Pragma_Sloc);
raise Error_Resync;
end if;
diff --git a/gcc/ada/par-tchk.adb b/gcc/ada/par-tchk.adb
index a4c3b2d4999..9329b41cd14 100644
--- a/gcc/ada/par-tchk.adb
+++ b/gcc/ada/par-tchk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -443,7 +443,8 @@ package body Tchk is
-- the possibility of a "C" confusion.
elsif Token = Tok_Vertical_Bar then
- Error_Msg_SC ("unexpected occurrence of ""'|"", did you mean OR'?");
+ Error_Msg_SC -- CODEFIX
+ ("unexpected occurrence of ""'|"", did you mean OR'?");
Resync_Past_Semicolon;
return;
diff --git a/gcc/ada/par-util.adb b/gcc/ada/par-util.adb
index bf5680e2515..3672ca8145e 100644
--- a/gcc/ada/par-util.adb
+++ b/gcc/ada/par-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -86,7 +86,8 @@ package body Util is
M2 (P2 + J - 1) := Fold_Upper (S (J));
end loop;
- Error_Msg_SC (M2 (1 .. P2 - 1 + S'Last));
+ Error_Msg_SC -- CODEFIX???
+ (M2 (1 .. P2 - 1 + S'Last));
Token := T;
return True;
end if;
@@ -119,7 +120,8 @@ package body Util is
M1 (P1 + J - 1) := Fold_Upper (S (J));
end loop;
- Error_Msg_SC (M1 (1 .. P1 - 1 + S'Last));
+ Error_Msg_SC -- CODFIX
+ (M1 (1 .. P1 - 1 + S'Last));
Token := T;
return True;
@@ -161,7 +163,8 @@ package body Util is
if RM_Column_Check and then Token_Is_At_Start_Of_Line
and then Start_Column <= Scope.Table (Scope.Last).Ecol
then
- Error_Msg_BC ("(style) incorrect layout");
+ Error_Msg_BC -- CODEFIX
+ ("(style) incorrect layout");
end if;
end Check_Bad_Layout;
@@ -678,7 +681,8 @@ package body Util is
Error_Msg_Name_1 := First_Attribute_Name;
while Error_Msg_Name_1 <= Last_Attribute_Name loop
if Is_Bad_Spelling_Of (Token_Name, Error_Msg_Name_1) then
- Error_Msg_N ("\possible misspelling of %", Token_Node);
+ Error_Msg_N -- CODEFIX
+ ("\possible misspelling of %", Token_Node);
exit;
end if;
diff --git a/gcc/ada/prepcomp.adb b/gcc/ada/prepcomp.adb
index 18c2686e491..58ef7c3e5c1 100644
--- a/gcc/ada/prepcomp.adb
+++ b/gcc/ada/prepcomp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2003-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2003-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -659,7 +659,7 @@ package body Prepcomp is
if Deffile = No_Source_File then
Fail ("definition file """
& Get_Name_String (N)
- & """ cannot be found");
+ & """ not found");
end if;
-- Initialize the preprocessor and set the characteristics of the
diff --git a/gcc/ada/prj-dect.adb b/gcc/ada/prj-dect.adb
index 37ae74bfb10..001b2596d48 100644
--- a/gcc/ada/prj-dect.adb
+++ b/gcc/ada/prj-dect.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -63,7 +63,8 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id;
- Packages_To_Check : String_List_Access);
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean);
-- Parse a case construction
procedure Parse_Declarative_Items
@@ -73,16 +74,22 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id;
- Packages_To_Check : String_List_Access);
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean);
-- Parse declarative items. Depending on In_Zone, some declarative
-- items may be forbidden.
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
procedure Parse_Package_Declaration
(In_Tree : Project_Node_Tree_Ref;
Package_Declaration : out Project_Node_Id;
Current_Project : Project_Node_Id;
- Packages_To_Check : String_List_Access);
- -- Parse a package declaration
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean);
+ -- Parse a package declaration.
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
procedure Parse_String_Type_Declaration
(In_Tree : Project_Node_Tree_Ref;
@@ -108,7 +115,8 @@ package body Prj.Dect is
Declarations : out Project_Node_Id;
Current_Project : Project_Node_Id;
Extends : Project_Node_Id;
- Packages_To_Check : String_List_Access)
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean)
is
First_Declarative_Item : Project_Node_Id := Empty_Node;
@@ -126,7 +134,8 @@ package body Prj.Dect is
First_Attribute => Prj.Attr.Attribute_First,
Current_Project => Current_Project,
Current_Package => Empty_Node,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
Set_First_Declarative_Item_Of
(Declarations, In_Tree, To => First_Declarative_Item);
end Parse;
@@ -605,7 +614,8 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id;
- Packages_To_Check : String_List_Access)
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean)
is
Current_Item : Project_Node_Id := Empty_Node;
Next_Item : Project_Node_Id := Empty_Node;
@@ -728,7 +738,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute,
Current_Project => Current_Project,
Current_Package => Current_Package,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
-- "when others =>" must be the last branch, so save the
-- Case_Item and exit
@@ -754,7 +765,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute,
Current_Project => Current_Project,
Current_Package => Current_Package,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
Set_First_Declarative_Item_Of
(Current_Item, In_Tree, To => First_Declarative_Item);
@@ -799,7 +811,8 @@ package body Prj.Dect is
First_Attribute : Attribute_Node_Id;
Current_Project : Project_Node_Id;
Current_Package : Project_Node_Id;
- Packages_To_Check : String_List_Access)
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean)
is
Current_Declarative_Item : Project_Node_Id := Empty_Node;
Next_Declarative_Item : Project_Node_Id := Empty_Node;
@@ -893,7 +906,8 @@ package body Prj.Dect is
(In_Tree => In_Tree,
Package_Declaration => Current_Declaration,
Current_Project => Current_Project,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
Set_Previous_End_Node (Current_Declaration);
@@ -924,7 +938,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute,
Current_Project => Current_Project,
Current_Package => Current_Package,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
Set_Previous_End_Node (Current_Declaration);
@@ -977,7 +992,8 @@ package body Prj.Dect is
(In_Tree : Project_Node_Tree_Ref;
Package_Declaration : out Project_Node_Id;
Current_Project : Project_Node_Id;
- Packages_To_Check : String_List_Access)
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean)
is
First_Attribute : Attribute_Node_Id := Empty_Attribute;
Current_Package : Package_Node_Id := Empty_Package;
@@ -1036,9 +1052,9 @@ package body Prj.Dect is
end if;
if Index /= 0 then
- Error_Msg ("\?possible misspelling of """ &
- List (Index).all & """",
- Token_Ptr);
+ Error_Msg -- CODEFIX
+ ("\?possible misspelling of """ &
+ List (Index).all & """", Token_Ptr);
end if;
end;
end if;
@@ -1101,7 +1117,7 @@ package body Prj.Dect is
end if;
if Token = Tok_Renames then
- if In_Configuration then
+ if Is_Config_File then
Error_Msg
("no package renames in configuration projects", Token_Ptr);
end if;
@@ -1216,7 +1232,8 @@ package body Prj.Dect is
First_Attribute => First_Attribute,
Current_Project => Current_Project,
Current_Package => Package_Declaration,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
Set_First_Declarative_Item_Of
(Package_Declaration, In_Tree, To => First_Declarative_Item);
diff --git a/gcc/ada/prj-dect.ads b/gcc/ada/prj-dect.ads
index 287c39043df..d5a592daae7 100644
--- a/gcc/ada/prj-dect.ads
+++ b/gcc/ada/prj-dect.ads
@@ -34,7 +34,8 @@ private package Prj.Dect is
Declarations : out Prj.Tree.Project_Node_Id;
Current_Project : Prj.Tree.Project_Node_Id;
Extends : Prj.Tree.Project_Node_Id;
- Packages_To_Check : String_List_Access);
+ Packages_To_Check : String_List_Access;
+ Is_Config_File : Boolean);
-- Parse project declarative items
--
-- In_Tree is the project node tree
@@ -52,5 +53,8 @@ private package Prj.Dect is
-- For legal packages declared in project Current_Project that are not in
-- Packages_To_Check, only the syntax of the declarations are checked, not
-- the attribute names and kinds.
+ --
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
end Prj.Dect;
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index 778db9d89b2..0a06975ced8 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -65,8 +65,7 @@ package body Prj.Env is
-- Call Setenv, after calling To_Host_File_Spec
function Ultimate_Extension_Of
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref) return Project_Id;
+ (Project : Project_Id) return Project_Id;
-- Return a project that is either Project or an extended ancestor of
-- Project that itself is not extended.
@@ -88,7 +87,7 @@ package body Prj.Env is
procedure Add (Project : Project_Id; Dummy : in out Boolean) is
pragma Unreferenced (Dummy);
begin
- Add_To_Path (In_Tree.Projects.Table (Project).Source_Dirs, In_Tree);
+ Add_To_Path (Project.Source_Dirs, In_Tree);
end Add;
procedure For_All_Projects is
@@ -101,17 +100,17 @@ package body Prj.Env is
-- If it is the first time we call this function for
-- this project, compute the source path
- if In_Tree.Projects.Table (Project).Ada_Include_Path = null then
+ if Project.Ada_Include_Path = null then
In_Tree.Private_Part.Ada_Path_Length := 0;
- For_All_Projects (Project, In_Tree, Dummy);
+ For_All_Projects (Project, Dummy);
- In_Tree.Projects.Table (Project).Ada_Include_Path :=
+ Project.Ada_Include_Path :=
new String'
(In_Tree.Private_Part.Ada_Path_Buffer
(1 .. In_Tree.Private_Part.Ada_Path_Length));
end if;
- return In_Tree.Projects.Table (Project).Ada_Include_Path;
+ return Project.Ada_Include_Path;
end Ada_Include_Path;
----------------------
@@ -128,8 +127,7 @@ package body Prj.Env is
return Ada_Include_Path (Project, In_Tree).all;
else
In_Tree.Private_Part.Ada_Path_Length := 0;
- Add_To_Path
- (In_Tree.Projects.Table (Project).Source_Dirs, In_Tree);
+ Add_To_Path (Project.Source_Dirs, In_Tree);
return
In_Tree.Private_Part.Ada_Path_Buffer
(1 .. In_Tree.Private_Part.Ada_Path_Length);
@@ -156,7 +154,7 @@ package body Prj.Env is
pragma Unreferenced (Dummy);
Path : constant Path_Name_Type :=
Get_Object_Directory
- (In_Tree, Project,
+ (Project,
Including_Libraries => Including_Libraries,
Only_If_Ada => False);
begin
@@ -175,17 +173,17 @@ package body Prj.Env is
-- If it is the first time we call this function for
-- this project, compute the objects path
- if In_Tree.Projects.Table (Project).Ada_Objects_Path = null then
+ if Project.Ada_Objects_Path = null then
In_Tree.Private_Part.Ada_Path_Length := 0;
- For_All_Projects (Project, In_Tree, Dummy);
+ For_All_Projects (Project, Dummy);
- In_Tree.Projects.Table (Project).Ada_Objects_Path :=
+ Project.Ada_Objects_Path :=
new String'
(In_Tree.Private_Part.Ada_Path_Buffer
(1 .. In_Tree.Private_Part.Ada_Path_Length));
end if;
- return In_Tree.Projects.Table (Project).Ada_Objects_Path;
+ return Project.Ada_Objects_Path;
end Ada_Objects_Path;
------------------------
@@ -435,13 +433,10 @@ package body Prj.Env is
-----------
procedure Check (Project : Project_Id) is
- Data : constant Project_Data :=
- In_Tree.Projects.Table (Project);
-
begin
if Current_Verbosity = High then
Write_Str ("Checking project file """);
- Write_Str (Namet.Get_Name_String (Data.Name));
+ Write_Str (Namet.Get_Name_String (Project.Name));
Write_Str (""".");
Write_Eol;
end if;
@@ -469,7 +464,7 @@ package body Prj.Env is
Naming_Table.Last (In_Tree.Private_Part.Namings)
and then not Same_Naming_Scheme
(Left => In_Tree.Private_Part.Namings.Table (Current_Naming),
- Right => Data.Naming) loop
+ Right => Project.Naming) loop
Current_Naming := Current_Naming + 1;
end loop;
@@ -481,7 +476,7 @@ package body Prj.Env is
Naming_Table.Increment_Last (In_Tree.Private_Part.Namings);
In_Tree.Private_Part.Namings.Table
(Naming_Table.Last (In_Tree.Private_Part.Namings)) :=
- Data.Naming;
+ Project.Naming;
-- We need a temporary file to be created
@@ -495,14 +490,14 @@ package body Prj.Env is
(File, "pragma Source_File_Name_Project");
Put_Line
(File, " (Spec_File_Name => ""*" &
- Spec_Suffix_Of (In_Tree, "ada", Data.Naming) &
+ Spec_Suffix_Of (In_Tree, "ada", Project.Naming) &
""",");
Put_Line
(File, " Casing => " &
- Image (Data.Naming.Casing) & ",");
+ Image (Project.Naming.Casing) & ",");
Put_Line
(File, " Dot_Replacement => """ &
- Namet.Get_Name_String (Data.Naming.Dot_Replacement) &
+ Namet.Get_Name_String (Project.Naming.Dot_Replacement) &
""");");
-- and body
@@ -511,44 +506,44 @@ package body Prj.Env is
(File, "pragma Source_File_Name_Project");
Put_Line
(File, " (Body_File_Name => ""*" &
- Body_Suffix_Of (In_Tree, "ada", Data.Naming) &
+ Body_Suffix_Of (In_Tree, "ada", Project.Naming) &
""",");
Put_Line
(File, " Casing => " &
- Image (Data.Naming.Casing) & ",");
+ Image (Project.Naming.Casing) & ",");
Put_Line
(File, " Dot_Replacement => """ &
- Namet.Get_Name_String (Data.Naming.Dot_Replacement) &
+ Namet.Get_Name_String (Project.Naming.Dot_Replacement) &
""");");
-- and maybe separate
- if Body_Suffix_Of (In_Tree, "ada", Data.Naming) /=
- Get_Name_String (Data.Naming.Separate_Suffix)
+ if Body_Suffix_Of (In_Tree, "ada", Project.Naming) /=
+ Get_Name_String (Project.Naming.Separate_Suffix)
then
Put_Line
(File, "pragma Source_File_Name_Project");
Put_Line
(File, " (Subunit_File_Name => ""*" &
- Namet.Get_Name_String (Data.Naming.Separate_Suffix) &
+ Namet.Get_Name_String (Project.Naming.Separate_Suffix) &
""",");
Put_Line
(File, " Casing => " &
- Image (Data.Naming.Casing) &
+ Image (Project.Naming.Casing) &
",");
Put_Line
(File, " Dot_Replacement => """ &
- Namet.Get_Name_String (Data.Naming.Dot_Replacement) &
+ Namet.Get_Name_String (Project.Naming.Dot_Replacement) &
""");");
end if;
end if;
- if Data.Extends /= No_Project then
- Check (Data.Extends);
+ if Project.Extends /= No_Project then
+ Check (Project.Extends);
end if;
declare
- Current : Project_List := Data.Imported_Projects;
+ Current : Project_List := Project.Imported_Projects;
begin
while Current /= null loop
Check (Current.Project);
@@ -666,9 +661,7 @@ package body Prj.Env is
-- Start of processing for Create_Config_Pragmas_File
begin
- if not
- In_Tree.Projects.Table (For_Project).Config_Checked
- then
+ if not For_Project.Config_Checked then
-- Remove any memory of processed naming schemes, if any
@@ -738,13 +731,9 @@ package body Prj.Env is
Write_Line ("""");
end if;
- In_Tree.Projects.Table (For_Project).Config_File_Name :=
- File_Name;
- In_Tree.Projects.Table (For_Project).Config_File_Temp :=
- True;
-
- In_Tree.Projects.Table (For_Project).Config_Checked :=
- True;
+ For_Project.Config_File_Name := File_Name;
+ For_Project.Config_File_Temp := True;
+ For_Project.Config_Checked := True;
end if;
end Create_Config_Pragmas_File;
@@ -811,8 +800,7 @@ package body Prj.Env is
File : File_Descriptor := Invalid_FD;
Status : Boolean;
- Present : array (No_Project .. Project_Table.Last (In_Tree.Projects))
- of Boolean := (others => False);
+ Present : Project_Boolean_Htable.Instance;
-- For each project in the closure of Project, the corresponding flag
-- will be set to True.
@@ -893,16 +881,18 @@ package body Prj.Env is
-- Nothing to do for non existent project or project that has already
-- been flagged.
- if Prj /= No_Project and then not Present (Prj) then
- Present (Prj) := True;
+ if Prj /= No_Project
+ and then not Project_Boolean_Htable.Get (Present, Prj)
+ then
+ Project_Boolean_Htable.Set (Present, Prj, True);
- Imported := In_Tree.Projects.Table (Prj).Imported_Projects;
+ Imported := Prj.Imported_Projects;
while Imported /= null loop
Recursive_Flag (Imported.Project);
Imported := Imported.Next;
end loop;
- Recursive_Flag (In_Tree.Projects.Table (Prj).Extends);
+ Recursive_Flag (Prj.Extends);
end if;
end Recursive_Flag;
@@ -943,7 +933,9 @@ package body Prj.Env is
-- If there is a spec, put it mapping in the file if it is
-- from a project in the closure of Project.
- if Data.Name /= No_File and then Present (Data.Project) then
+ if Data.Name /= No_File
+ and then Project_Boolean_Htable.Get (Present, Data.Project)
+ then
Put_Data (Spec => True);
end if;
@@ -952,7 +944,9 @@ package body Prj.Env is
-- If there is a body (or subunit) put its mapping in the
-- file if it is from a project in the closure of Project.
- if Data.Name /= No_File and then Present (Data.Project) then
+ if Data.Name /= No_File
+ and then Project_Boolean_Htable.Get (Present, Data.Project)
+ then
Put_Data (Spec => False);
end if;
end if;
@@ -960,51 +954,61 @@ package body Prj.Env is
end if;
-- If language is defined
+
else
-- For all source of the Language of all projects in the closure
- for Proj in Present'Range loop
- if Present (Proj) then
+ declare
+ P : Project_List;
- Iter := For_Each_Source (In_Tree, Proj);
- loop
- Source := Prj.Element (Iter);
- exit when Source = No_Source;
+ begin
+ P := In_Tree.Projects;
+ while P /= null loop
+ if Project_Boolean_Htable.Get (Present, P.Project) then
- if Source.Language.Name = Language
- and then not Source.Locally_Removed
- and then Source.Replaced_By = No_Source
- and then Source.Path.Name /= No_Path
- then
- if Source.Unit /= No_Name then
- Get_Name_String (Source.Unit);
+ Iter := For_Each_Source (In_Tree, P.Project);
+ loop
+ Source := Prj.Element (Iter);
+ exit when Source = No_Source;
- if Source.Kind = Spec then
- Suffix :=
- Source.Language.Config.Mapping_Spec_Suffix;
- else
- Suffix :=
- Source.Language.Config.Mapping_Body_Suffix;
+ if Source.Language.Name = Language
+ and then not Source.Locally_Removed
+ and then Source.Replaced_By = No_Source
+ and then Source.Path.Name /= No_Path
+ then
+ if Source.Unit /= No_Name then
+ Get_Name_String (Source.Unit);
+
+ if Source.Kind = Spec then
+ Suffix :=
+ Source.Language.Config.Mapping_Spec_Suffix;
+ else
+ Suffix :=
+ Source.Language.Config.Mapping_Body_Suffix;
+ end if;
+
+ if Suffix /= No_File then
+ Add_Str_To_Name_Buffer
+ (Get_Name_String (Suffix));
+ end if;
+
+ Put_Name_Buffer;
end if;
- if Suffix /= No_File then
- Add_Str_To_Name_Buffer (Get_Name_String (Suffix));
- end if;
+ Get_Name_String (Source.File);
+ Put_Name_Buffer;
+ Get_Name_String (Source.Path.Name);
Put_Name_Buffer;
end if;
- Get_Name_String (Source.File);
- Put_Name_Buffer;
-
- Get_Name_String (Source.Path.Name);
- Put_Name_Buffer;
- end if;
+ Next (Iter);
+ end loop;
+ end if;
- Next (Iter);
- end loop;
- end if;
- end loop;
+ P := P.Next;
+ end loop;
+ end;
end if;
GNAT.OS_Lib.Close (File, Status);
@@ -1017,6 +1021,8 @@ package body Prj.Env is
Prj.Com.Fail ("disk full, could not write mapping file");
end if;
+
+ Project_Boolean_Htable.Reset (Present);
end Create_Mapping_File;
--------------------------
@@ -1050,7 +1056,7 @@ package body Prj.Env is
procedure Delete_All_Path_Files (In_Tree : Project_Tree_Ref) is
Disregard : Boolean := True;
- pragma Warnings (Off, Disregard);
+ pragma Unreferenced (Disregard);
begin
for Index in Path_File_Table.First ..
@@ -1092,16 +1098,14 @@ package body Prj.Env is
Full_Path : Boolean := False) return String
is
The_Project : Project_Id := Project;
- Data : Project_Data :=
- In_Tree.Projects.Table (Project);
Original_Name : String := Name;
Extended_Spec_Name : String :=
Name &
- Spec_Suffix_Of (In_Tree, "ada", Data.Naming);
+ Spec_Suffix_Of (In_Tree, "ada", Project.Naming);
Extended_Body_Name : String :=
Name &
- Body_Suffix_Of (In_Tree, "ada", Data.Naming);
+ Body_Suffix_Of (In_Tree, "ada", Project.Naming);
Unit : Unit_Data;
@@ -1281,12 +1285,12 @@ package body Prj.Env is
-- If we are not in an extending project, give up
- exit when (not Main_Project_Only) or else Data.Extends = No_Project;
+ exit when not Main_Project_Only
+ or else The_Project.Extends = No_Project;
-- Otherwise, look in the project we are extending
- The_Project := Data.Extends;
- Data := In_Tree.Projects.Table (The_Project);
+ The_Project := The_Project.Extends;
end loop;
-- We don't know this file name, return an empty string
@@ -1298,10 +1302,7 @@ package body Prj.Env is
-- For_All_Object_Dirs --
-------------------------
- procedure For_All_Object_Dirs
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref)
- is
+ procedure For_All_Object_Dirs (Project : Project_Id) is
procedure For_Project (Prj : Project_Id; Dummy : in out Integer);
-- Get all object directories of Prj
@@ -1311,15 +1312,12 @@ package body Prj.Env is
procedure For_Project (Prj : Project_Id; Dummy : in out Integer) is
pragma Unreferenced (Dummy);
-
- Data : Project_Data renames In_Tree.Projects.Table (Prj);
-
begin
-- ??? Set_Ada_Paths has a different behavior for library project
-- files, should we have the same ?
- if Data.Object_Directory /= No_Path_Information then
- Get_Name_String (Data.Object_Directory.Display_Name);
+ if Prj.Object_Directory /= No_Path_Information then
+ Get_Name_String (Prj.Object_Directory.Display_Name);
Action (Name_Buffer (1 .. Name_Len));
end if;
end For_Project;
@@ -1331,7 +1329,7 @@ package body Prj.Env is
-- Start of processing for For_All_Object_Dirs
begin
- Get_Object_Dirs (Project, In_Tree, Dummy);
+ Get_Object_Dirs (Project, Dummy);
end For_All_Object_Dirs;
-------------------------
@@ -1351,16 +1349,14 @@ package body Prj.Env is
procedure For_Project (Prj : Project_Id; Dummy : in out Integer) is
pragma Unreferenced (Dummy);
-
- Data : Project_Data renames In_Tree.Projects.Table (Prj);
- Current : String_List_Id := Data.Source_Dirs;
+ Current : String_List_Id := Prj.Source_Dirs;
The_String : String_Element;
begin
-- If there are Ada sources, call action with the name of every
-- source directory.
- if Has_Ada_Sources (In_Tree.Projects.Table (Project)) then
+ if Has_Ada_Sources (Project) then
while Current /= Nil_String loop
The_String := In_Tree.String_Elements.Table (Current);
Action (Get_Name_String (The_String.Display_Value));
@@ -1376,7 +1372,7 @@ package body Prj.Env is
-- Start of processing for For_All_Source_Dirs
begin
- Get_Source_Dirs (Project, In_Tree, Dummy);
+ Get_Source_Dirs (Project, Dummy);
end For_All_Source_Dirs;
-------------------
@@ -1422,8 +1418,7 @@ package body Prj.Env is
Original_Name)
then
Project := Ultimate_Extension_Of
- (Project => Unit.File_Names (Specification).Project,
- In_Tree => In_Tree);
+ (Project => Unit.File_Names (Specification).Project);
Path := Unit.File_Names (Specification).Path.Display_Name;
if Current_Verbosity > Default then
@@ -1443,8 +1438,7 @@ package body Prj.Env is
Original_Name)
then
Project := Ultimate_Extension_Of
- (Project => Unit.File_Names (Body_Part).Project,
- In_Tree => In_Tree);
+ (Project => Unit.File_Names (Body_Part).Project);
Path := Unit.File_Names (Body_Part).Path.Display_Name;
if Current_Verbosity > Default then
@@ -1503,8 +1497,7 @@ package body Prj.Env is
else
Write_Str (" Project: ");
Get_Name_String
- (In_Tree.Projects.Table
- (Unit.File_Names (Specification).Project).Path.Name);
+ (Unit.File_Names (Specification).Project.Path.Name);
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
@@ -1521,8 +1514,7 @@ package body Prj.Env is
else
Write_Str (" Project: ");
Get_Name_String
- (In_Tree.Projects.Table
- (Unit.File_Names (Body_Part).Project).Path.Name);
+ (Unit.File_Names (Body_Part).Project.Path.Name);
Write_Line (Name_Buffer (1 .. Name_Len));
end if;
@@ -1549,15 +1541,10 @@ package body Prj.Env is
Original_Name : String := Name;
- Data : constant Project_Data :=
- In_Tree.Projects.Table (Main_Project);
-
Extended_Spec_Name : String :=
- Name &
- Spec_Suffix_Of (In_Tree, "ada", Data.Naming);
+ Name & Spec_Suffix_Of (In_Tree, "ada", Main_Project.Naming);
Extended_Body_Name : String :=
- Name &
- Body_Suffix_Of (In_Tree, "ada", Data.Naming);
+ Name & Body_Suffix_Of (In_Tree, "ada", Main_Project.Naming);
Unit : Unit_Data;
@@ -1629,10 +1616,8 @@ package body Prj.Env is
-- Get the ultimate extending project
if Result /= No_Project then
- while In_Tree.Projects.Table (Result).Extended_By /=
- No_Project
- loop
- Result := In_Tree.Projects.Table (Result).Extended_By;
+ while Result.Extended_By /= No_Project loop
+ Result := Result.Extended_By;
end loop;
end if;
@@ -1671,7 +1656,6 @@ package body Prj.Env is
procedure Recursive_Add (Project : Project_Id; Dummy : in out Boolean) is
pragma Unreferenced (Dummy);
- Data : constant Project_Data := In_Tree.Projects.Table (Project);
Path : Path_Name_Type;
begin
@@ -1682,14 +1666,14 @@ package body Prj.Env is
-- Add to path all source directories of this project if there are
-- Ada sources.
- if Has_Ada_Sources (In_Tree.Projects.Table (Project)) then
- Add_To_Source_Path (Data.Source_Dirs, In_Tree);
+ if Has_Ada_Sources (Project) then
+ Add_To_Source_Path (Project.Source_Dirs, In_Tree);
end if;
end if;
if Process_Object_Dirs then
Path := Get_Object_Directory
- (In_Tree, Project,
+ (Project,
Including_Libraries => Including_Libraries,
Only_If_Ada => True);
@@ -1709,34 +1693,27 @@ package body Prj.Env is
-- If it is the first time we call this procedure for this project,
-- compute the source path and/or the object path.
- if In_Tree.Projects.Table (Project).Include_Path_File = No_Path then
+ if Project.Include_Path_File = No_Path then
Process_Source_Dirs := True;
Create_New_Path_File
- (In_Tree, Source_FD,
- In_Tree.Projects.Table (Project).Include_Path_File);
+ (In_Tree, Source_FD, Project.Include_Path_File);
end if;
-- For the object path, we make a distinction depending on
-- Including_Libraries.
if Including_Libraries then
- if In_Tree.Projects.Table
- (Project).Objects_Path_File_With_Libs = No_Path
- then
+ if Project.Objects_Path_File_With_Libs = No_Path then
Process_Object_Dirs := True;
Create_New_Path_File
- (In_Tree, Object_FD, In_Tree.Projects.Table (Project).
- Objects_Path_File_With_Libs);
+ (In_Tree, Object_FD, Project.Objects_Path_File_With_Libs);
end if;
else
- if In_Tree.Projects.Table
- (Project).Objects_Path_File_Without_Libs = No_Path
- then
+ if Project.Objects_Path_File_Without_Libs = No_Path then
Process_Object_Dirs := True;
Create_New_Path_File
- (In_Tree, Object_FD, In_Tree.Projects.Table (Project).
- Objects_Path_File_Without_Libs);
+ (In_Tree, Object_FD, Project.Objects_Path_File_Without_Libs);
end if;
end if;
@@ -1746,7 +1723,7 @@ package body Prj.Env is
if Process_Source_Dirs or Process_Object_Dirs then
Source_Path_Table.Set_Last (In_Tree.Private_Part.Source_Paths, 0);
Object_Path_Table.Set_Last (In_Tree.Private_Part.Object_Paths, 0);
- For_All_Projects (Project, In_Tree, Dummy);
+ For_All_Projects (Project, Dummy);
end if;
-- Write and close any file that has been created
@@ -1799,10 +1776,10 @@ package body Prj.Env is
-- corresponding flags.
if In_Tree.Private_Part.Current_Source_Path_File /=
- In_Tree.Projects.Table (Project).Include_Path_File
+ Project.Include_Path_File
then
In_Tree.Private_Part.Current_Source_Path_File :=
- In_Tree.Projects.Table (Project).Include_Path_File;
+ Project.Include_Path_File;
Set_Path_File_Var
(Project_Include_Path_File,
Get_Name_String (In_Tree.Private_Part.Current_Source_Path_File));
@@ -1811,11 +1788,10 @@ package body Prj.Env is
if Including_Libraries then
if In_Tree.Private_Part.Current_Object_Path_File /=
- In_Tree.Projects.Table (Project).Objects_Path_File_With_Libs
+ Project.Objects_Path_File_With_Libs
then
In_Tree.Private_Part.Current_Object_Path_File :=
- In_Tree.Projects.Table
- (Project).Objects_Path_File_With_Libs;
+ Project.Objects_Path_File_With_Libs;
Set_Path_File_Var
(Project_Objects_Path_File,
Get_Name_String
@@ -1825,11 +1801,10 @@ package body Prj.Env is
else
if In_Tree.Private_Part.Current_Object_Path_File /=
- In_Tree.Projects.Table (Project).Objects_Path_File_Without_Libs
+ Project.Objects_Path_File_Without_Libs
then
In_Tree.Private_Part.Current_Object_Path_File :=
- In_Tree.Projects.Table
- (Project).Objects_Path_File_Without_Libs;
+ Project.Objects_Path_File_Without_Libs;
Set_Path_File_Var
(Project_Objects_Path_File,
Get_Name_String
@@ -1871,14 +1846,14 @@ package body Prj.Env is
---------------------------
function Ultimate_Extension_Of
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref) return Project_Id
+ (Project : Project_Id) return Project_Id
is
- Result : Project_Id := Project;
+ Result : Project_Id;
begin
- while In_Tree.Projects.Table (Result).Extended_By /= No_Project loop
- Result := In_Tree.Projects.Table (Result).Extended_By;
+ Result := Project;
+ while Result.Extended_By /= No_Project loop
+ Result := Result.Extended_By;
end loop;
return Result;
diff --git a/gcc/ada/prj-env.ads b/gcc/ada/prj-env.ads
index 0f12ebbef26..3a92d996743 100644
--- a/gcc/ada/prj-env.ads
+++ b/gcc/ada/prj-env.ads
@@ -166,9 +166,7 @@ package Prj.Env is
generic
with procedure Action (Path : String);
- procedure For_All_Object_Dirs
- (Project : Project_Id;
- In_Tree : Project_Tree_Ref);
+ procedure For_All_Object_Dirs (Project : Project_Id);
-- Iterate through all the object directories of a project, including
-- those of imported or modified projects.
diff --git a/gcc/ada/prj-ext.adb b/gcc/ada/prj-ext.adb
index 5a7e9b97896..50751c22c3e 100644
--- a/gcc/ada/prj-ext.adb
+++ b/gcc/ada/prj-ext.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -281,6 +281,8 @@ package body Prj.Ext is
".." & Directory_Separator &
".." & Directory_Separator & "gnat");
end if;
+
+ Free (Prefix);
end;
end if;
diff --git a/gcc/ada/prj-makr.adb b/gcc/ada/prj-makr.adb
index 1274c4f3bf1..7ae8c3d9a21 100644
--- a/gcc/ada/prj-makr.adb
+++ b/gcc/ada/prj-makr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -845,6 +845,7 @@ package body Prj.Makr is
Project_File_Name => Output_Name.all,
Always_Errout_Finalize => False,
Store_Comments => True,
+ Is_Config_File => False,
Current_Directory => Get_Current_Dir,
Packages_To_Check => Packages_To_Check_By_Gnatname);
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index 9c1914371d7..f1f5550dc8c 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -192,8 +192,7 @@ package body Prj.Nmsc is
procedure Find_Excluded_Sources
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : Project_Data);
+ In_Tree : Project_Tree_Ref);
-- Find the list of files that should not be considered as source files
-- for this project. Sets the list in the Excluded_Sources_Htable.
@@ -257,8 +256,8 @@ package body Prj.Nmsc is
function Suffix_Matches
(Filename : String;
Suffix : File_Name_Type) return Boolean;
- -- True if the filename ends with the given suffix. It always returns False
- -- if Suffix is No_Name
+ -- True if the file name ends with the given suffix. Always returns False
+ -- if Suffix is No_Name.
procedure Replace_Into_Name_Buffer
(Str : String;
@@ -274,36 +273,32 @@ package body Prj.Nmsc is
-- Check that a name is a valid Ada unit name
procedure Check_Naming_Schemes
- (Data : in out Project_Data;
- Project : Project_Id;
- In_Tree : Project_Tree_Ref);
- -- Check the naming scheme part of Data
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
+ Is_Config_File : Boolean);
+ -- Check the naming scheme part of Data.
+ -- Is_Config_File should be True if Project is a config file (.cgpr)
procedure Check_Configuration
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data);
+ In_Tree : Project_Tree_Ref);
-- Check the configuration attributes for the project
procedure Check_If_Externally_Built
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data);
+ In_Tree : Project_Tree_Ref);
-- Check attribute Externally_Built of project Project in project tree
-- In_Tree and modify its data Data if it has the value "true".
procedure Check_Interfaces
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data);
+ In_Tree : Project_Tree_Ref);
-- If a list of sources is specified in attribute Interfaces, set
-- In_Interfaces only for the sources specified in the list.
procedure Check_Library_Attributes
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Current_Dir : String;
- Data : in out Project_Data);
+ In_Tree : Project_Tree_Ref);
-- Check the library attributes of project Project in project tree In_Tree
-- and modify its data Data accordingly.
-- Current_Dir should represent the current directory, and is passed for
@@ -311,15 +306,13 @@ package body Prj.Nmsc is
procedure Check_Package_Naming
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data);
+ In_Tree : Project_Tree_Ref);
-- Check package Naming of project Project in project tree In_Tree and
-- modify its data Data accordingly.
procedure Check_Programming_Languages
(In_Tree : Project_Tree_Ref;
- Project : Project_Id;
- Data : in out Project_Data);
+ Project : Project_Id);
-- Check attribute Languages for the project with data Data in project
-- tree In_Tree and set the components of Data for all the programming
-- languages indicated in attribute Languages, if any.
@@ -327,7 +320,6 @@ package body Prj.Nmsc is
function Check_Project
(P : Project_Id;
Root_Project : Project_Id;
- In_Tree : Project_Tree_Ref;
Extending : Boolean) return Boolean;
-- Returns True if P is Root_Project or, if Extending is True, a project
-- extended by Root_Project.
@@ -335,7 +327,6 @@ package body Prj.Nmsc is
procedure Check_Stand_Alone_Library
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Current_Dir : String;
Extending : Boolean);
-- Check if project Project in project tree In_Tree is a Stand-Alone
@@ -380,7 +371,6 @@ package body Prj.Nmsc is
procedure Search_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
For_All_Sources : Boolean);
-- Search the source directories to find the sources.
-- If For_All_Sources is True, check each regular file name against the
@@ -390,7 +380,6 @@ package body Prj.Nmsc is
procedure Check_File
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
@@ -416,11 +405,10 @@ package body Prj.Nmsc is
procedure Check_File_Naming_Schemes
(In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
+ Project : Project_Id;
File_Name : File_Name_Type;
Alternate_Languages : out Language_List;
Language : out Language_Ptr;
- Language_Name : out Name_Id;
Display_Language_Name : out Name_Id;
Unit : out Name_Id;
Lang_Kind : out Language_Kind;
@@ -440,8 +428,7 @@ package body Prj.Nmsc is
procedure Get_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Current_Dir : String;
- Data : in out Project_Data);
+ Current_Dir : String);
-- Get the object directory, the exec directory and the source directories
-- of a project.
--
@@ -450,8 +437,7 @@ package body Prj.Nmsc is
procedure Get_Mains
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data);
+ In_Tree : Project_Tree_Ref);
-- Get the mains of a project from attribute Main, if it exists, and put
-- them in the project data.
@@ -466,7 +452,6 @@ package body Prj.Nmsc is
procedure Find_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Proc_Data : in out Processing_Data);
-- Process the Source_Files and Source_List_File attributes, and store
-- the list of source files into the Source_Names htable.
@@ -510,28 +495,29 @@ package body Prj.Nmsc is
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
Name : File_Name_Type;
- Parent : Path_Name_Type;
- Dir : out Path_Name_Type;
- Display : out Path_Name_Type;
+ Path : out Path_Information;
+ Dir_Exists : out Boolean;
Create : String := "";
- Current_Dir : String;
Location : Source_Ptr := No_Location;
+ Must_Exist : Boolean := True;
Externally_Built : Boolean := False);
- -- Locate a directory. Name is the directory name. Parent is the root
- -- directory, if Name a relative path name. Dir is set to the canonical
- -- case path name of the directory, and Display is the directory path name
- -- for display purposes. If the directory does not exist and Setup_Projects
+ -- Locate a directory. Name is the directory name.
+ -- Relative paths are resolved relative to the project's directory.
+ -- If the directory does not exist and Setup_Projects
-- is True and Create is a non null string, an attempt is made to create
- -- the directory. If the directory does not exist and Setup_Projects is
- -- false, then Dir and Display are set to No_Name.
+ -- the directory.
+ -- If the directory does not exist, it is either created if Setup_Projects
+ -- is False (and then returned), or simply returned without checking for
+ -- its existence (if Must_Exist is False) or No_Path_Information is
+ -- returned. In all cases, Dir_Exists indicates whether the directory now
+ -- exists.
--
- -- Current_Dir should represent the current directory, and is passed for
- -- efficiency to avoid system calls to recompute it.
+ -- Create is also used for debugging traces to show which path we are
+ -- computing
procedure Look_For_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Proc_Data : in out Processing_Data);
-- Find all the sources of project Project in project tree In_Tree and
-- update its Data accordingly. This assumes that Data.First_Source has
@@ -579,7 +565,7 @@ package body Prj.Nmsc is
-- when there are no sources for language Lang_Name.
procedure Show_Source_Dirs
- (Data : Project_Data; In_Tree : Project_Tree_Ref);
+ (Project : Project_Id; In_Tree : Project_Tree_Ref);
-- List all the source directories of a project
procedure Warn_If_Not_Sources
@@ -804,9 +790,9 @@ package body Prj.Nmsc is
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Current_Dir : String;
- Proc_Data : in out Processing_Data)
+ Proc_Data : in out Processing_Data;
+ Is_Config_File : Boolean)
is
- Data : Project_Data renames In_Tree.Projects.Table (Project);
Extending : Boolean := False;
begin
@@ -815,55 +801,57 @@ package body Prj.Nmsc is
Recursive_Dirs.Reset;
- Check_If_Externally_Built (Project, In_Tree, Data);
+ Check_If_Externally_Built (Project, In_Tree);
-- Object, exec and source directories
- Get_Directories (Project, In_Tree, Current_Dir, Data);
+ Get_Directories (Project, In_Tree, Current_Dir);
-- Get the programming languages
- Check_Programming_Languages (In_Tree, Project, Data);
+ Check_Programming_Languages (In_Tree, Project);
- if Data.Qualifier = Dry and then Data.Source_Dirs /= Nil_String then
+ if Project.Qualifier = Dry
+ and then Project.Source_Dirs /= Nil_String
+ then
Error_Msg
(Project, In_Tree,
"an abstract project needs to have no language, no sources " &
"or no source directories",
- Data.Location);
+ Project.Location);
end if;
-- Check configuration in multi language mode
if Must_Check_Configuration then
- Check_Configuration (Project, In_Tree, Data);
+ Check_Configuration (Project, In_Tree);
end if;
-- Library attributes
- Check_Library_Attributes (Project, In_Tree, Current_Dir, Data);
+ Check_Library_Attributes (Project, In_Tree);
if Current_Verbosity = High then
- Show_Source_Dirs (Data, In_Tree);
+ Show_Source_Dirs (Project, In_Tree);
end if;
- Check_Package_Naming (Project, In_Tree, Data);
+ Check_Package_Naming (Project, In_Tree);
- Extending := Data.Extends /= No_Project;
+ Extending := Project.Extends /= No_Project;
- Check_Naming_Schemes (Data, Project, In_Tree);
+ Check_Naming_Schemes (Project, In_Tree, Is_Config_File);
if Get_Mode = Ada_Only then
Prepare_Ada_Naming_Exceptions
- (Data.Naming.Bodies, In_Tree, Body_Part);
+ (Project.Naming.Bodies, In_Tree, Body_Part);
Prepare_Ada_Naming_Exceptions
- (Data.Naming.Specs, In_Tree, Specification);
+ (Project.Naming.Specs, In_Tree, Specification);
end if;
-- Find the sources
- if Data.Source_Dirs /= Nil_String then
- Look_For_Sources (Project, In_Tree, Data, Proc_Data);
+ if Project.Source_Dirs /= Nil_String then
+ Look_For_Sources (Project, In_Tree, Proc_Data);
if Get_Mode = Ada_Only then
@@ -871,16 +859,16 @@ package body Prj.Nmsc is
-- of this project file.
Warn_If_Not_Sources
- (Project, In_Tree, Data.Naming.Bodies,
+ (Project, In_Tree, Project.Naming.Bodies,
Specs => False,
Extending => Extending);
Warn_If_Not_Sources
- (Project, In_Tree, Data.Naming.Specs,
+ (Project, In_Tree, Project.Naming.Specs,
Specs => True,
Extending => Extending);
elsif Get_Mode = Multi_Language and then
- (not Data.Externally_Built) and then
+ (not Project.Externally_Built) and then
(not Extending)
then
declare
@@ -891,7 +879,7 @@ package body Prj.Nmsc is
Iter : Source_Iterator;
begin
- Language := Data.Languages;
+ Language := Project.Languages;
while Language /= No_Language_Index loop
-- If there are no sources for this language, check whether
@@ -920,7 +908,7 @@ package body Prj.Nmsc is
(Project,
Get_Name_String (Language.Display_Name),
In_Tree,
- Data.Location,
+ Project.Location,
Continuation);
Continuation := True;
end if;
@@ -937,23 +925,19 @@ package body Prj.Nmsc is
-- If a list of sources is specified in attribute Interfaces, set
-- In_Interfaces only for the sources specified in the list.
- Check_Interfaces (Project, In_Tree, Data);
+ Check_Interfaces (Project, In_Tree);
end if;
-- If it is a library project file, check if it is a standalone library
- if Data.Library then
+ if Project.Library then
Check_Stand_Alone_Library
- (Project, In_Tree, Data, Current_Dir, Extending);
+ (Project, In_Tree, Current_Dir, Extending);
end if;
-- Put the list of Mains, if any, in the project data
- Get_Mains (Project, In_Tree, Data);
-
- -- Update the project data in the Projects table
-
- In_Tree.Projects.Table (Project) := Data;
+ Get_Mains (Project, In_Tree);
Free_Ada_Naming_Exceptions;
end Check;
@@ -1148,8 +1132,7 @@ package body Prj.Nmsc is
procedure Check_Configuration
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data)
+ In_Tree : Project_Tree_Ref)
is
Dot_Replacement : File_Name_Type := No_File;
Casing : Casing_Type := All_Lower_Case;
@@ -1192,7 +1175,7 @@ package body Prj.Nmsc is
-- Nothing to do if the language is the same as the current language
if Current_Language /= Real_Language then
- Lang_Index := Data.Languages;
+ Lang_Index := Project.Languages;
while Lang_Index /= No_Language_Index loop
exit when Lang_Index.Name = Real_Language;
Lang_Index := Lang_Index.Next;
@@ -1331,7 +1314,7 @@ package body Prj.Nmsc is
-- Attribute Executable_Suffix: the suffix of the
-- executables.
- Data.Config.Executable_Suffix :=
+ Project.Config.Executable_Suffix :=
Attribute.Value.Value;
end if;
end if;
@@ -1441,10 +1424,8 @@ package body Prj.Nmsc is
-- Attribute Driver (<language>)
- Get_Name_String (Element.Value.Value);
-
Lang_Index.Config.Compiler_Driver :=
- File_Name_Type (Element.Value.Value);
+ File_Name_Type (Element.Value.Value);
when Name_Required_Switches =>
Put (Into_List =>
@@ -1748,15 +1729,15 @@ package body Prj.Nmsc is
-- Attribute Linker'Driver: the default linker to use
- Data.Config.Linker :=
+ Project.Config.Linker :=
Path_Name_Type (Attribute.Value.Value);
-- Linker'Driver is also used to link shared libraries
-- if the obsolescent attribute Library_GCC has not been
-- specified.
- if Data.Config.Shared_Lib_Driver = No_File then
- Data.Config.Shared_Lib_Driver :=
+ if Project.Config.Shared_Lib_Driver = No_File then
+ Project.Config.Shared_Lib_Driver :=
File_Name_Type (Attribute.Value.Value);
end if;
@@ -1765,17 +1746,16 @@ package body Prj.Nmsc is
-- Attribute Required_Switches: the minimum
-- options to use when invoking the linker
- Put (Into_List =>
- Data.Config.Minimum_Linker_Options,
+ Put (Into_List => Project.Config.Minimum_Linker_Options,
From_List => Attribute.Value.Values,
In_Tree => In_Tree);
elsif Attribute.Name = Name_Map_File_Option then
- Data.Config.Map_File_Option := Attribute.Value.Value;
+ Project.Config.Map_File_Option := Attribute.Value.Value;
elsif Attribute.Name = Name_Max_Command_Line_Length then
begin
- Data.Config.Max_Command_Line_Length :=
+ Project.Config.Max_Command_Line_Length :=
Natural'Value (Get_Name_String
(Attribute.Value.Value));
@@ -1798,16 +1778,16 @@ package body Prj.Nmsc is
Name := Name_Find;
if Name = Name_None then
- Data.Config.Resp_File_Format := None;
+ Project.Config.Resp_File_Format := None;
elsif Name = Name_Gnu then
- Data.Config.Resp_File_Format := GNU;
+ Project.Config.Resp_File_Format := GNU;
elsif Name = Name_Object_List then
- Data.Config.Resp_File_Format := Object_List;
+ Project.Config.Resp_File_Format := Object_List;
elsif Name = Name_Option_List then
- Data.Config.Resp_File_Format := Option_List;
+ Project.Config.Resp_File_Format := Option_List;
else
Error_Msg
@@ -1819,8 +1799,7 @@ package body Prj.Nmsc is
end;
elsif Attribute.Name = Name_Response_File_Switches then
- Put (Into_List =>
- Data.Config.Resp_File_Options,
+ Put (Into_List => Project.Config.Resp_File_Options,
From_List => Attribute.Value.Values,
In_Tree => In_Tree);
end if;
@@ -1833,7 +1812,7 @@ package body Prj.Nmsc is
-- Start of processing for Process_Packages
begin
- Packages := Data.Decl.Packages;
+ Packages := Project.Decl.Packages;
while Packages /= No_Package loop
Element := In_Tree.Packages.Table (Packages);
@@ -1889,7 +1868,7 @@ package body Prj.Nmsc is
begin
-- Process non associated array attribute at project level
- Attribute_Id := Data.Decl.Attributes;
+ Attribute_Id := Project.Decl.Attributes;
while Attribute_Id /= No_Variable loop
Attribute :=
In_Tree.Variable_Elements.Table (Attribute_Id);
@@ -1899,14 +1878,14 @@ package body Prj.Nmsc is
-- Attribute Target: the target specified
- Data.Config.Target := Attribute.Value.Value;
+ Project.Config.Target := Attribute.Value.Value;
elsif Attribute.Name = Name_Library_Builder then
-- Attribute Library_Builder: the application to invoke
-- to build libraries.
- Data.Config.Library_Builder :=
+ Project.Config.Library_Builder :=
Path_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Archive_Builder then
@@ -1924,7 +1903,7 @@ package body Prj.Nmsc is
Attribute.Value.Location);
end if;
- Put (Into_List => Data.Config.Archive_Builder,
+ Put (Into_List => Project.Config.Archive_Builder,
From_List => List,
In_Tree => In_Tree);
@@ -1937,7 +1916,8 @@ package body Prj.Nmsc is
if List /= Nil_String then
Put
- (Into_List => Data.Config.Archive_Builder_Append_Option,
+ (Into_List =>
+ Project.Config.Archive_Builder_Append_Option,
From_List => List,
In_Tree => In_Tree);
end if;
@@ -1958,7 +1938,7 @@ package body Prj.Nmsc is
Attribute.Value.Location);
end if;
- Put (Into_List => Data.Config.Archive_Indexer,
+ Put (Into_List => Project.Config.Archive_Indexer,
From_List => List,
In_Tree => In_Tree);
@@ -1978,12 +1958,12 @@ package body Prj.Nmsc is
Attribute.Value.Location);
end if;
- Put (Into_List => Data.Config.Lib_Partial_Linker,
+ Put (Into_List => Project.Config.Lib_Partial_Linker,
From_List => List,
In_Tree => In_Tree);
elsif Attribute.Name = Name_Library_GCC then
- Data.Config.Shared_Lib_Driver :=
+ Project.Config.Shared_Lib_Driver :=
File_Name_Type (Attribute.Value.Value);
Error_Msg
(Project,
@@ -1993,7 +1973,7 @@ package body Prj.Nmsc is
Attribute.Value.Location);
elsif Attribute.Name = Name_Archive_Suffix then
- Data.Config.Archive_Suffix :=
+ Project.Config.Archive_Suffix :=
File_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Linker_Executable_Option then
@@ -2011,7 +1991,7 @@ package body Prj.Nmsc is
Attribute.Value.Location);
end if;
- Put (Into_List => Data.Config.Linker_Executable_Option,
+ Put (Into_List => Project.Config.Linker_Executable_Option,
From_List => List,
In_Tree => In_Tree);
@@ -2031,7 +2011,8 @@ package body Prj.Nmsc is
Attribute.Value.Location);
end if;
- Data.Config.Linker_Lib_Dir_Option := Attribute.Value.Value;
+ Project.Config.Linker_Lib_Dir_Option :=
+ Attribute.Value.Value;
elsif Attribute.Name = Name_Linker_Lib_Name_Option then
@@ -2049,7 +2030,8 @@ package body Prj.Nmsc is
Attribute.Value.Location);
end if;
- Data.Config.Linker_Lib_Name_Option := Attribute.Value.Value;
+ Project.Config.Linker_Lib_Name_Option :=
+ Attribute.Value.Value;
elsif Attribute.Name = Name_Run_Path_Option then
@@ -2059,7 +2041,7 @@ package body Prj.Nmsc is
List := Attribute.Value.Values;
if List /= Nil_String then
- Put (Into_List => Data.Config.Run_Path_Option,
+ Put (Into_List => Project.Config.Run_Path_Option,
From_List => List,
In_Tree => In_Tree);
end if;
@@ -2068,7 +2050,7 @@ package body Prj.Nmsc is
declare
pragma Unsuppress (All_Checks);
begin
- Data.Config.Separate_Run_Path_Options :=
+ Project.Config.Separate_Run_Path_Options :=
Boolean'Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
@@ -2085,7 +2067,7 @@ package body Prj.Nmsc is
declare
pragma Unsuppress (All_Checks);
begin
- Data.Config.Lib_Support :=
+ Project.Config.Lib_Support :=
Library_Support'Value (Get_Name_String
(Attribute.Value.Value));
exception
@@ -2100,18 +2082,18 @@ package body Prj.Nmsc is
end;
elsif Attribute.Name = Name_Shared_Library_Prefix then
- Data.Config.Shared_Lib_Prefix :=
+ Project.Config.Shared_Lib_Prefix :=
File_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Shared_Library_Suffix then
- Data.Config.Shared_Lib_Suffix :=
+ Project.Config.Shared_Lib_Suffix :=
File_Name_Type (Attribute.Value.Value);
elsif Attribute.Name = Name_Symbolic_Link_Supported then
declare
pragma Unsuppress (All_Checks);
begin
- Data.Config.Symbolic_Link_Supported :=
+ Project.Config.Symbolic_Link_Supported :=
Boolean'Value (Get_Name_String
(Attribute.Value.Value));
exception
@@ -2131,7 +2113,7 @@ package body Prj.Nmsc is
declare
pragma Unsuppress (All_Checks);
begin
- Data.Config.Lib_Maj_Min_Id_Supported :=
+ Project.Config.Lib_Maj_Min_Id_Supported :=
Boolean'Value (Get_Name_String
(Attribute.Value.Value));
exception
@@ -2149,7 +2131,7 @@ package body Prj.Nmsc is
declare
pragma Unsuppress (All_Checks);
begin
- Data.Config.Auto_Init_Supported :=
+ Project.Config.Auto_Init_Supported :=
Boolean'Value (Get_Name_String (Attribute.Value.Value));
exception
when Constraint_Error =>
@@ -2166,7 +2148,7 @@ package body Prj.Nmsc is
List := Attribute.Value.Values;
if List /= Nil_String then
- Put (Into_List => Data.Config.Shared_Lib_Min_Options,
+ Put (Into_List => Project.Config.Shared_Lib_Min_Options,
From_List => List,
In_Tree => In_Tree);
end if;
@@ -2175,7 +2157,7 @@ package body Prj.Nmsc is
List := Attribute.Value.Values;
if List /= Nil_String then
- Put (Into_List => Data.Config.Lib_Version_Options,
+ Put (Into_List => Project.Config.Lib_Version_Options,
From_List => List,
In_Tree => In_Tree);
end if;
@@ -2200,7 +2182,7 @@ package body Prj.Nmsc is
begin
-- Process the associative array attributes at project level
- Current_Array_Id := Data.Decl.Arrays;
+ Current_Array_Id := Project.Decl.Arrays;
while Current_Array_Id /= No_Array loop
Current_Array := In_Tree.Arrays.Table (Current_Array_Id);
@@ -2331,7 +2313,7 @@ package body Prj.Nmsc is
-- For unit based languages, set Casing, Dot_Replacement and
-- Separate_Suffix in Naming_Data.
- Lang_Index := Data.Languages;
+ Lang_Index := Project.Languages;
while Lang_Index /= No_Language_Index loop
if Lang_Index.Name = Name_Ada then
Lang_Index.Config.Naming_Data.Casing := Casing;
@@ -2351,19 +2333,19 @@ package body Prj.Nmsc is
-- Give empty names to various prefixes/suffixes, if they have not
-- been specified in the configuration.
- if Data.Config.Archive_Suffix = No_File then
- Data.Config.Archive_Suffix := Empty_File;
+ if Project.Config.Archive_Suffix = No_File then
+ Project.Config.Archive_Suffix := Empty_File;
end if;
- if Data.Config.Shared_Lib_Prefix = No_File then
- Data.Config.Shared_Lib_Prefix := Empty_File;
+ if Project.Config.Shared_Lib_Prefix = No_File then
+ Project.Config.Shared_Lib_Prefix := Empty_File;
end if;
- if Data.Config.Shared_Lib_Suffix = No_File then
- Data.Config.Shared_Lib_Suffix := Empty_File;
+ if Project.Config.Shared_Lib_Suffix = No_File then
+ Project.Config.Shared_Lib_Suffix := Empty_File;
end if;
- Lang_Index := Data.Languages;
+ Lang_Index := Project.Languages;
while Lang_Index /= No_Language_Index loop
Current_Language := Lang_Index.Display_Name;
@@ -2378,8 +2360,8 @@ package body Prj.Nmsc is
", ignoring all its sources",
No_Location);
- if Lang_Index = Data.Languages then
- Data.Languages := Lang_Index.Next;
+ if Lang_Index = Project.Languages then
+ Project.Languages := Lang_Index.Next;
else
Prev_Index.Next := Lang_Index.Next;
end if;
@@ -2442,13 +2424,12 @@ package body Prj.Nmsc is
procedure Check_If_Externally_Built
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data)
+ In_Tree : Project_Tree_Ref)
is
Externally_Built : constant Variable_Value :=
Util.Value_Of
(Name_Externally_Built,
- Data.Decl.Attributes, In_Tree);
+ Project.Decl.Attributes, In_Tree);
begin
if not Externally_Built.Default then
@@ -2456,7 +2437,7 @@ package body Prj.Nmsc is
To_Lower (Name_Buffer (1 .. Name_Len));
if Name_Buffer (1 .. Name_Len) = "true" then
- Data.Externally_Built := True;
+ Project.Externally_Built := True;
elsif Name_Buffer (1 .. Name_Len) /= "false" then
Error_Msg (Project, In_Tree,
@@ -2468,15 +2449,14 @@ package body Prj.Nmsc is
-- A virtual project extending an externally built project is itself
-- externally built.
- if Data.Virtual and then Data.Extends /= No_Project then
- Data.Externally_Built :=
- In_Tree.Projects.Table (Data.Extends).Externally_Built;
+ if Project.Virtual and then Project.Extends /= No_Project then
+ Project.Externally_Built := Project.Extends.Externally_Built;
end if;
if Current_Verbosity = High then
Write_Str ("Project is ");
- if not Data.Externally_Built then
+ if not Project.Externally_Built then
Write_Str ("not ");
end if;
@@ -2490,13 +2470,12 @@ package body Prj.Nmsc is
procedure Check_Interfaces
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data)
+ In_Tree : Project_Tree_Ref)
is
Interfaces : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Interfaces,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
List : String_List_Id;
@@ -2523,7 +2502,7 @@ package body Prj.Nmsc is
Next (Iter);
end loop;
- Project_2 := In_Tree.Projects.Table (Project_2).Extends;
+ Project_2 := Project_2.Extends;
end loop;
List := Interfaces.Values;
@@ -2562,12 +2541,12 @@ package body Prj.Nmsc is
Next (Iter);
end loop;
- Project_2 := In_Tree.Projects.Table (Project_2).Extends;
+ Project_2 := Project_2.Extends;
end loop Big_Loop;
if Source = No_Source then
Error_Msg_File_1 := File_Name_Type (Element.Value);
- Error_Msg_Name_1 := Data.Name;
+ Error_Msg_Name_1 := Project.Name;
Error_Msg
(Project,
@@ -2580,13 +2559,12 @@ package body Prj.Nmsc is
List := Element.Next;
end loop;
- Data.Interfaces_Defined := True;
+ Project.Interfaces_Defined := True;
- elsif Data.Extends /= No_Project then
- Data.Interfaces_Defined :=
- In_Tree.Projects.Table (Data.Extends).Interfaces_Defined;
+ elsif Project.Extends /= No_Project then
+ Project.Interfaces_Defined := Project.Extends.Interfaces_Defined;
- if Data.Interfaces_Defined then
+ if Project.Interfaces_Defined then
Iter := For_Each_Source (In_Tree, Project);
loop
Source := Prj.Element (Iter);
@@ -2658,12 +2636,12 @@ package body Prj.Nmsc is
--------------------------
procedure Check_Naming_Schemes
- (Data : in out Project_Data;
- Project : Project_Id;
- In_Tree : Project_Tree_Ref)
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
+ Is_Config_File : Boolean)
is
Naming_Id : constant Package_Id :=
- Util.Value_Of (Name_Naming, Data.Decl.Packages, In_Tree);
+ Util.Value_Of (Name_Naming, Project.Decl.Packages, In_Tree);
Naming : Package_Element;
procedure Check_Naming_Ada_Only;
@@ -3033,7 +3011,7 @@ package body Prj.Nmsc is
if Source /= No_Source then
Other_Project := Source.Project;
- if Is_Extending (Project, Other_Project, In_Tree) then
+ if Is_Extending (Project, Other_Project) then
Other_Part := Source.Other_Part;
-- Record the source to be removed
@@ -3043,8 +3021,7 @@ package body Prj.Nmsc is
else
Error_Msg_Name_1 := Unit;
- Error_Msg_Name_2 :=
- In_Tree.Projects.Table (Other_Project).Name;
+ Error_Msg_Name_2 := Other_Project.Name;
Error_Msg
(Project,
In_Tree,
@@ -3090,14 +3067,14 @@ package body Prj.Nmsc is
Prj.Util.Value_Of
(Index => Name_Ada,
Src_Index => 0,
- In_Array => Data.Naming.Spec_Suffix,
+ In_Array => Project.Naming.Spec_Suffix,
In_Tree => In_Tree);
Ada_Body_Suffix : constant Variable_Value :=
Prj.Util.Value_Of
(Index => Name_Ada,
Src_Index => 0,
- In_Array => Data.Naming.Body_Suffix,
+ In_Array => Project.Naming.Body_Suffix,
In_Tree => In_Tree);
begin
@@ -3108,13 +3085,13 @@ package body Prj.Nmsc is
and then Length_Of_Name (Ada_Body_Suffix.Value) /= 0
then
Body_Suffix := Canonical_Case_File_Name (Ada_Body_Suffix.Value);
- Data.Naming.Separate_Suffix := Body_Suffix;
- Set_Body_Suffix (In_Tree, "ada", Data.Naming, Body_Suffix);
+ Project.Naming.Separate_Suffix := Body_Suffix;
+ Set_Body_Suffix (In_Tree, "ada", Project.Naming, Body_Suffix);
else
Body_Suffix := Default_Ada_Body_Suffix;
- Data.Naming.Separate_Suffix := Body_Suffix;
- Set_Body_Suffix (In_Tree, "ada", Data.Naming, Body_Suffix);
+ Project.Naming.Separate_Suffix := Body_Suffix;
+ Set_Body_Suffix (In_Tree, "ada", Project.Naming, Body_Suffix);
end if;
Write_Attr ("Body_Suffix", Get_Name_String (Body_Suffix));
@@ -3122,26 +3099,26 @@ package body Prj.Nmsc is
-- We'll need the dot replacement below, so compute it now
Check_Common
- (Dot_Replacement => Data.Naming.Dot_Replacement,
- Casing => Data.Naming.Casing,
+ (Dot_Replacement => Project.Naming.Dot_Replacement,
+ Casing => Project.Naming.Casing,
Casing_Defined => Casing_Defined,
- Separate_Suffix => Data.Naming.Separate_Suffix,
+ Separate_Suffix => Project.Naming.Separate_Suffix,
Sep_Suffix_Loc => Sep_Suffix_Loc);
- Data.Naming.Bodies :=
+ Project.Naming.Bodies :=
Util.Value_Of (Name_Body, Naming.Decl.Arrays, In_Tree);
- if Data.Naming.Bodies /= No_Array_Element then
+ if Project.Naming.Bodies /= No_Array_Element then
Check_And_Normalize_Unit_Names
- (Project, In_Tree, Data.Naming.Bodies, "Naming.Bodies");
+ (Project, In_Tree, Project.Naming.Bodies, "Naming.Bodies");
end if;
- Data.Naming.Specs :=
+ Project.Naming.Specs :=
Util.Value_Of (Name_Spec, Naming.Decl.Arrays, In_Tree);
- if Data.Naming.Specs /= No_Array_Element then
+ if Project.Naming.Specs /= No_Array_Element then
Check_And_Normalize_Unit_Names
- (Project, In_Tree, Data.Naming.Specs, "Naming.Specs");
+ (Project, In_Tree, Project.Naming.Specs, "Naming.Specs");
end if;
-- Check Spec_Suffix
@@ -3150,10 +3127,10 @@ package body Prj.Nmsc is
and then Length_Of_Name (Ada_Spec_Suffix.Value) /= 0
then
Spec_Suffix := Canonical_Case_File_Name (Ada_Spec_Suffix.Value);
- Set_Spec_Suffix (In_Tree, "ada", Data.Naming, Spec_Suffix);
+ Set_Spec_Suffix (In_Tree, "ada", Project.Naming, Spec_Suffix);
if Is_Illegal_Suffix
- (Spec_Suffix, Data.Naming.Dot_Replacement)
+ (Spec_Suffix, Project.Naming.Dot_Replacement)
then
Err_Vars.Error_Msg_File_1 := Spec_Suffix;
Error_Msg
@@ -3164,14 +3141,16 @@ package body Prj.Nmsc is
else
Spec_Suffix := Default_Ada_Spec_Suffix;
- Set_Spec_Suffix (In_Tree, "ada", Data.Naming, Spec_Suffix);
+ Set_Spec_Suffix (In_Tree, "ada", Project.Naming, Spec_Suffix);
end if;
Write_Attr ("Spec_Suffix", Get_Name_String (Spec_Suffix));
-- Check Body_Suffix
- if Is_Illegal_Suffix (Body_Suffix, Data.Naming.Dot_Replacement) then
+ if Is_Illegal_Suffix
+ (Body_Suffix, Project.Naming.Dot_Replacement)
+ then
Err_Vars.Error_Msg_File_1 := Body_Suffix;
Error_Msg
(Project, In_Tree,
@@ -3194,13 +3173,13 @@ package body Prj.Nmsc is
Ada_Body_Suffix.Location);
end if;
- if Body_Suffix /= Data.Naming.Separate_Suffix
- and then Spec_Suffix = Data.Naming.Separate_Suffix
+ if Body_Suffix /= Project.Naming.Separate_Suffix
+ and then Spec_Suffix = Project.Naming.Separate_Suffix
then
Error_Msg
(Project, In_Tree,
"Separate_Suffix (""" &
- Get_Name_String (Data.Naming.Separate_Suffix) &
+ Get_Name_String (Project.Naming.Separate_Suffix) &
""") cannot be the same as Spec_Suffix.",
Sep_Suffix_Loc);
end if;
@@ -3237,7 +3216,7 @@ package body Prj.Nmsc is
or else Casing_Defined
or else Separate_Suffix /= No_File
then
- Lang_Id := Data.Languages;
+ Lang_Id := Project.Languages;
while Lang_Id /= No_Language_Index loop
if Lang_Id.Config.Kind = Unit_Based then
if Dot_Replacement /= No_File then
@@ -3261,7 +3240,7 @@ package body Prj.Nmsc is
-- Next, get the spec and body suffixes
- Lang_Id := Data.Languages;
+ Lang_Id := Project.Languages;
while Lang_Id /= No_Language_Index loop
Lang := Lang_Id.Name;
@@ -3319,7 +3298,7 @@ package body Prj.Nmsc is
-- Get the naming exceptions for all languages
for Kind in Spec .. Impl loop
- Lang_Id := Data.Languages;
+ Lang_Id := Project.Languages;
while Lang_Id /= No_Language_Index loop
case Lang_Id.Config.Kind is
when File_Based =>
@@ -3339,7 +3318,7 @@ package body Prj.Nmsc is
begin
-- No Naming package or parsing a configuration file? nothing to do
- if Naming_Id /= No_Package and not In_Configuration then
+ if Naming_Id /= No_Package and not Is_Config_File then
Naming := In_Tree.Packages.Table (Naming_Id);
if Current_Verbosity = High then
@@ -3361,11 +3340,9 @@ package body Prj.Nmsc is
procedure Check_Library_Attributes
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Current_Dir : String;
- Data : in out Project_Data)
+ In_Tree : Project_Tree_Ref)
is
- Attributes : constant Prj.Variable_Id := Data.Decl.Attributes;
+ Attributes : constant Prj.Variable_Id := Project.Decl.Attributes;
Lib_Dir : constant Prj.Variable_Value :=
Prj.Util.Value_Of
@@ -3407,15 +3384,12 @@ package body Prj.Nmsc is
-------------------
procedure Check_Library (Proj : Project_Id; Extends : Boolean) is
- Proj_Data : Project_Data;
Src_Id : Source_Id;
Iter : Source_Iterator;
begin
if Proj /= No_Project then
- Proj_Data := In_Tree.Projects.Table (Proj);
-
- if not Proj_Data.Library then
+ if not Proj.Library then
-- The only not library projects that are OK are those that
-- have no sources. However, header files from non-Ada
@@ -3431,38 +3405,38 @@ package body Prj.Nmsc is
end loop;
if Src_Id /= No_Source then
- Error_Msg_Name_1 := Data.Name;
- Error_Msg_Name_2 := Proj_Data.Name;
+ Error_Msg_Name_1 := Project.Name;
+ Error_Msg_Name_2 := Proj.Name;
if Extends then
- if Data.Library_Kind /= Static then
+ if Project.Library_Kind /= Static then
Error_Msg
(Project, In_Tree,
Continuation.all &
"shared library project %% cannot extend " &
"project %% that is not a library project",
- Data.Location);
+ Project.Location);
Continuation := Continuation_String'Access;
end if;
elsif (not Unchecked_Shared_Lib_Imports)
- and then Data.Library_Kind /= Static
+ and then Project.Library_Kind /= Static
then
Error_Msg
(Project, In_Tree,
Continuation.all &
"shared library project %% cannot import project %% " &
"that is not a shared library project",
- Data.Location);
+ Project.Location);
Continuation := Continuation_String'Access;
end if;
end if;
- elsif Data.Library_Kind /= Static and then
- Proj_Data.Library_Kind = Static
+ elsif Project.Library_Kind /= Static and then
+ Proj.Library_Kind = Static
then
- Error_Msg_Name_1 := Data.Name;
- Error_Msg_Name_2 := Proj_Data.Name;
+ Error_Msg_Name_1 := Project.Name;
+ Error_Msg_Name_2 := Proj.Name;
if Extends then
Error_Msg
@@ -3470,7 +3444,7 @@ package body Prj.Nmsc is
Continuation.all &
"shared library project %% cannot extend static " &
"library project %%",
- Data.Location);
+ Project.Location);
Continuation := Continuation_String'Access;
elsif not Unchecked_Shared_Lib_Imports then
@@ -3479,7 +3453,7 @@ package body Prj.Nmsc is
Continuation.all &
"shared library project %% cannot import static " &
"library project %%",
- Data.Location);
+ Project.Location);
Continuation := Continuation_String'Access;
end if;
@@ -3487,6 +3461,8 @@ package body Prj.Nmsc is
end if;
end Check_Library;
+ Dir_Exists : Boolean;
+
-- Start of processing for Check_Library_Attributes
begin
@@ -3494,54 +3470,49 @@ package body Prj.Nmsc is
-- Special case of extending project
- if Data.Extends /= No_Project then
- declare
- Extended_Data : constant Project_Data :=
- In_Tree.Projects.Table (Data.Extends);
+ if Project.Extends /= No_Project then
- begin
- -- If the project extended is a library project, we inherit the
- -- library name, if it is not redefined; we check that the library
- -- directory is specified.
+ -- If the project extended is a library project, we inherit the
+ -- library name, if it is not redefined; we check that the library
+ -- directory is specified.
- if Extended_Data.Library then
- if Data.Qualifier = Standard then
- Error_Msg
- (Project, In_Tree,
- "a standard project cannot extend a library project",
- Data.Location);
+ if Project.Extends.Library then
+ if Project.Qualifier = Standard then
+ Error_Msg
+ (Project, In_Tree,
+ "a standard project cannot extend a library project",
+ Project.Location);
- else
- if Lib_Name.Default then
- Data.Library_Name := Extended_Data.Library_Name;
- end if;
+ else
+ if Lib_Name.Default then
+ Project.Library_Name := Project.Extends.Library_Name;
+ end if;
- if Lib_Dir.Default then
- if not Data.Virtual then
- Error_Msg
- (Project, In_Tree,
- "a project extending a library project must " &
- "specify an attribute Library_Dir",
- Data.Location);
+ if Lib_Dir.Default then
+ if not Project.Virtual then
+ Error_Msg
+ (Project, In_Tree,
+ "a project extending a library project must " &
+ "specify an attribute Library_Dir",
+ Project.Location);
- else
- -- For a virtual project extending a library project,
- -- inherit library directory.
+ else
+ -- For a virtual project extending a library project,
+ -- inherit library directory.
- Data.Library_Dir := Extended_Data.Library_Dir;
- Library_Directory_Present := True;
- end if;
+ Project.Library_Dir := Project.Extends.Library_Dir;
+ Library_Directory_Present := True;
end if;
end if;
end if;
- end;
+ end if;
end if;
pragma Assert (Lib_Name.Kind = Single);
if Lib_Name.Value = Empty_String then
if Current_Verbosity = High
- and then Data.Library_Name = No_Name
+ and then Project.Library_Name = No_Name
then
Write_Line ("No library name");
end if;
@@ -3549,12 +3520,13 @@ package body Prj.Nmsc is
else
-- There is no restriction on the syntax of library names
- Data.Library_Name := Lib_Name.Value;
+ Project.Library_Name := Lib_Name.Value;
end if;
- if Data.Library_Name /= No_Name then
+ if Project.Library_Name /= No_Name then
if Current_Verbosity = High then
- Write_Attr ("Library name", Get_Name_String (Data.Library_Name));
+ Write_Attr
+ ("Library name", Get_Name_String (Project.Library_Name));
end if;
pragma Assert (Lib_Dir.Kind = Single);
@@ -3567,85 +3539,65 @@ package body Prj.Nmsc is
else
-- Find path name (unless inherited), check that it is a directory
- if Data.Library_Dir = No_Path_Information then
+ if Project.Library_Dir = No_Path_Information then
Locate_Directory
(Project,
In_Tree,
File_Name_Type (Lib_Dir.Value),
- Data.Directory.Display_Name,
- Data.Library_Dir.Name,
- Data.Library_Dir.Display_Name,
+ Path => Project.Library_Dir,
+ Dir_Exists => Dir_Exists,
Create => "library",
- Current_Dir => Current_Dir,
+ Must_Exist => False,
Location => Lib_Dir.Location,
- Externally_Built => Data.Externally_Built);
- end if;
+ Externally_Built => Project.Externally_Built);
- if Data.Library_Dir = No_Path_Information then
+ else
+ Dir_Exists :=
+ Is_Directory
+ (Get_Name_String
+ (Project.Library_Dir.Display_Name));
+ end if;
+ if not Dir_Exists then
-- Get the absolute name of the library directory that
-- does not exist, to report an error.
- declare
- Dir_Name : constant String :=
- Get_Name_String (Lib_Dir.Value);
-
- begin
- if Is_Absolute_Path (Dir_Name) then
- Err_Vars.Error_Msg_File_1 :=
- File_Name_Type (Lib_Dir.Value);
-
- else
- Get_Name_String (Data.Directory.Display_Name);
-
- if Name_Buffer (Name_Len) /= Directory_Separator then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
- end if;
-
- Name_Buffer
- (Name_Len + 1 .. Name_Len + Dir_Name'Length) :=
- Dir_Name;
- Name_Len := Name_Len + Dir_Name'Length;
- Err_Vars.Error_Msg_File_1 := Name_Find;
- end if;
-
- -- Report the error
-
- Error_Msg
- (Project, In_Tree,
- "library directory { does not exist",
- Lib_Dir.Location);
- end;
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Project.Library_Dir.Display_Name);
+ Error_Msg
+ (Project, In_Tree,
+ "library directory { does not exist",
+ Lib_Dir.Location);
-- The library directory cannot be the same as the Object
-- directory.
- elsif Data.Library_Dir.Name = Data.Object_Directory.Name then
+ elsif Project.Library_Dir.Name = Project.Object_Directory.Name then
Error_Msg
(Project, In_Tree,
"library directory cannot be the same " &
"as object directory",
Lib_Dir.Location);
- Data.Library_Dir := No_Path_Information;
+ Project.Library_Dir := No_Path_Information;
else
declare
OK : Boolean := True;
Dirs_Id : String_List_Id;
Dir_Elem : String_Element;
+ Pid : Project_List;
begin
-- The library directory cannot be the same as a source
-- directory of the current project.
- Dirs_Id := Data.Source_Dirs;
+ Dirs_Id := Project.Source_Dirs;
while Dirs_Id /= Nil_String loop
Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
- if
- Data.Library_Dir.Name = Path_Name_Type (Dir_Elem.Value)
+ if Project.Library_Dir.Name =
+ Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
@@ -3664,23 +3616,24 @@ package body Prj.Nmsc is
-- The library directory cannot be the same as a source
-- directory of another project either.
- Project_Loop :
- for Pid in 1 .. Project_Table.Last (In_Tree.Projects) loop
- if Pid /= Project then
- Dirs_Id := In_Tree.Projects.Table (Pid).Source_Dirs;
+ Pid := In_Tree.Projects;
+ Project_Loop : loop
+ exit Project_Loop when Pid = null;
+
+ if Pid.Project /= Project then
+ Dirs_Id := Pid.Project.Source_Dirs;
Dir_Loop : while Dirs_Id /= Nil_String loop
Dir_Elem :=
In_Tree.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
- if Data.Library_Dir.Name =
+ if Project.Library_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
- Err_Vars.Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Pid).Name;
+ Err_Vars.Error_Msg_Name_1 := Pid.Project.Name;
Error_Msg
(Project, In_Tree,
@@ -3692,11 +3645,13 @@ package body Prj.Nmsc is
end if;
end loop Dir_Loop;
end if;
+
+ Pid := Pid.Next;
end loop Project_Loop;
end if;
if not OK then
- Data.Library_Dir := No_Path_Information;
+ Project.Library_Dir := No_Path_Information;
elsif Current_Verbosity = High then
@@ -3704,7 +3659,7 @@ package body Prj.Nmsc is
Write_Attr
("Library directory",
- Get_Name_String (Data.Library_Dir.Display_Name));
+ Get_Name_String (Project.Library_Dir.Display_Name));
end if;
end;
end if;
@@ -3712,15 +3667,14 @@ package body Prj.Nmsc is
end if;
- Data.Library :=
- Data.Library_Dir /= No_Path_Information
- and then
- Data.Library_Name /= No_Name;
+ Project.Library :=
+ Project.Library_Dir /= No_Path_Information
+ and then Project.Library_Name /= No_Name;
- if Data.Extends = No_Project then
- case Data.Qualifier is
+ if Project.Extends = No_Project then
+ case Project.Qualifier is
when Standard =>
- if Data.Library then
+ if Project.Library then
Error_Msg
(Project, In_Tree,
"a standard project cannot be a library project",
@@ -3728,19 +3682,19 @@ package body Prj.Nmsc is
end if;
when Library =>
- if not Data.Library then
- if Data.Library_Dir = No_Path_Information then
+ if not Project.Library then
+ if Project.Library_Dir = No_Path_Information then
Error_Msg
(Project, In_Tree,
"\attribute Library_Dir not declared",
- Data.Location);
+ Project.Location);
end if;
- if Data.Library_Name = No_Name then
+ if Project.Library_Name = No_Name then
Error_Msg
(Project, In_Tree,
"\attribute Library_Name not declared",
- Data.Location);
+ Project.Location);
end if;
end if;
@@ -3750,9 +3704,9 @@ package body Prj.Nmsc is
end case;
end if;
- if Data.Library then
+ if Project.Library then
if Get_Mode = Multi_Language then
- Support_For_Libraries := Data.Config.Lib_Support;
+ Support_For_Libraries := Project.Config.Lib_Support;
else
Support_For_Libraries := MLib.Tgt.Support_For_Libraries;
@@ -3763,14 +3717,15 @@ package body Prj.Nmsc is
(Project, In_Tree,
"?libraries are not supported on this platform",
Lib_Name.Location);
- Data.Library := False;
+ Project.Library := False;
else
if Lib_ALI_Dir.Value = Empty_String then
if Current_Verbosity = High then
Write_Line ("No library ALI directory specified");
end if;
- Data.Library_ALI_Dir := Data.Library_Dir;
+
+ Project.Library_ALI_Dir := Project.Library_Dir;
else
-- Find path name, check that it is a directory
@@ -3779,81 +3734,55 @@ package body Prj.Nmsc is
(Project,
In_Tree,
File_Name_Type (Lib_ALI_Dir.Value),
- Data.Directory.Display_Name,
- Data.Library_ALI_Dir.Name,
- Data.Library_ALI_Dir.Display_Name,
+ Path => Project.Library_ALI_Dir,
Create => "library ALI",
- Current_Dir => Current_Dir,
+ Dir_Exists => Dir_Exists,
+ Must_Exist => False,
Location => Lib_ALI_Dir.Location,
- Externally_Built => Data.Externally_Built);
-
- if Data.Library_ALI_Dir = No_Path_Information then
+ Externally_Built => Project.Externally_Built);
+ if not Dir_Exists then
-- Get the absolute name of the library ALI directory that
-- does not exist, to report an error.
- declare
- Dir_Name : constant String :=
- Get_Name_String (Lib_ALI_Dir.Value);
-
- begin
- if Is_Absolute_Path (Dir_Name) then
- Err_Vars.Error_Msg_File_1 :=
- File_Name_Type (Lib_Dir.Value);
-
- else
- Get_Name_String (Data.Directory.Display_Name);
-
- if Name_Buffer (Name_Len) /= Directory_Separator then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) := Directory_Separator;
- end if;
-
- Name_Buffer
- (Name_Len + 1 .. Name_Len + Dir_Name'Length) :=
- Dir_Name;
- Name_Len := Name_Len + Dir_Name'Length;
- Err_Vars.Error_Msg_File_1 := Name_Find;
- end if;
-
- -- Report the error
-
- Error_Msg
- (Project, In_Tree,
- "library 'A'L'I directory { does not exist",
- Lib_ALI_Dir.Location);
- end;
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Project.Library_ALI_Dir.Display_Name);
+ Error_Msg
+ (Project, In_Tree,
+ "library 'A'L'I directory { does not exist",
+ Lib_ALI_Dir.Location);
end if;
- if Data.Library_ALI_Dir /= Data.Library_Dir then
+ if Project.Library_ALI_Dir /= Project.Library_Dir then
-- The library ALI directory cannot be the same as the
-- Object directory.
- if Data.Library_ALI_Dir = Data.Object_Directory then
+ if Project.Library_ALI_Dir = Project.Object_Directory then
Error_Msg
(Project, In_Tree,
"library 'A'L'I directory cannot be the same " &
"as object directory",
Lib_ALI_Dir.Location);
- Data.Library_ALI_Dir := No_Path_Information;
+ Project.Library_ALI_Dir := No_Path_Information;
else
declare
OK : Boolean := True;
Dirs_Id : String_List_Id;
Dir_Elem : String_Element;
+ Pid : Project_List;
begin
-- The library ALI directory cannot be the same as
-- a source directory of the current project.
- Dirs_Id := Data.Source_Dirs;
+ Dirs_Id := Project.Source_Dirs;
while Dirs_Id /= Nil_String loop
Dir_Elem := In_Tree.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
- if Data.Library_ALI_Dir.Name =
+ if Project.Library_ALI_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
@@ -3873,13 +3802,12 @@ package body Prj.Nmsc is
-- The library ALI directory cannot be the same as
-- a source directory of another project either.
- ALI_Project_Loop :
- for
- Pid in 1 .. Project_Table.Last (In_Tree.Projects)
- loop
- if Pid /= Project then
- Dirs_Id :=
- In_Tree.Projects.Table (Pid).Source_Dirs;
+ Pid := In_Tree.Projects;
+ ALI_Project_Loop : loop
+ exit ALI_Project_Loop when Pid = null;
+
+ if Pid.Project /= Project then
+ Dirs_Id := Pid.Project.Source_Dirs;
ALI_Dir_Loop :
while Dirs_Id /= Nil_String loop
@@ -3887,13 +3815,13 @@ package body Prj.Nmsc is
In_Tree.String_Elements.Table (Dirs_Id);
Dirs_Id := Dir_Elem.Next;
- if Data.Library_ALI_Dir.Name =
+ if Project.Library_ALI_Dir.Name =
Path_Name_Type (Dir_Elem.Value)
then
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Dir_Elem.Value);
Err_Vars.Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Pid).Name;
+ Pid.Project.Name;
Error_Msg
(Project, In_Tree,
@@ -3906,11 +3834,12 @@ package body Prj.Nmsc is
end if;
end loop ALI_Dir_Loop;
end if;
+ Pid := Pid.Next;
end loop ALI_Project_Loop;
end if;
if not OK then
- Data.Library_ALI_Dir := No_Path_Information;
+ Project.Library_ALI_Dir := No_Path_Information;
elsif Current_Verbosity = High then
@@ -3920,7 +3849,7 @@ package body Prj.Nmsc is
Write_Attr
("Library ALI dir",
Get_Name_String
- (Data.Library_ALI_Dir.Display_Name));
+ (Project.Library_ALI_Dir.Display_Name));
end if;
end;
end if;
@@ -3935,7 +3864,7 @@ package body Prj.Nmsc is
end if;
else
- Data.Lib_Internal_Name := Lib_Version.Value;
+ Project.Lib_Internal_Name := Lib_Version.Value;
end if;
pragma Assert (The_Lib_Kind.Kind = Single);
@@ -3956,13 +3885,13 @@ package body Prj.Nmsc is
begin
if Kind_Name = "static" then
- Data.Library_Kind := Static;
+ Project.Library_Kind := Static;
elsif Kind_Name = "dynamic" then
- Data.Library_Kind := Dynamic;
+ Project.Library_Kind := Dynamic;
elsif Kind_Name = "relocatable" then
- Data.Library_Kind := Relocatable;
+ Project.Library_Kind := Relocatable;
else
Error_Msg
@@ -3976,14 +3905,14 @@ package body Prj.Nmsc is
Write_Attr ("Library kind", Kind_Name);
end if;
- if Data.Library_Kind /= Static then
+ if Project.Library_Kind /= Static then
if Support_For_Libraries = Prj.Static_Only then
Error_Msg
(Project, In_Tree,
"only static libraries are supported " &
"on this platform",
The_Lib_Kind.Location);
- Data.Library := False;
+ Project.Library := False;
else
-- Check if (obsolescent) attribute Library_GCC or
@@ -3996,7 +3925,7 @@ package body Prj.Nmsc is
"?Library_'G'C'C is an obsolescent attribute, " &
"use Linker''Driver instead",
Lib_GCC.Location);
- Data.Config.Shared_Lib_Driver :=
+ Project.Config.Shared_Lib_Driver :=
File_Name_Type (Lib_GCC.Value);
else
@@ -4004,7 +3933,7 @@ package body Prj.Nmsc is
Linker : constant Package_Id :=
Value_Of
(Name_Linker,
- Data.Decl.Packages,
+ Project.Decl.Packages,
In_Tree);
Driver : constant Variable_Value :=
Value_Of
@@ -4019,7 +3948,7 @@ package body Prj.Nmsc is
if Driver /= Nil_Variable_Value
and then Driver.Value /= Empty_String
then
- Data.Config.Shared_Lib_Driver :=
+ Project.Config.Shared_Lib_Driver :=
File_Name_Type (Driver.Value);
end if;
end;
@@ -4029,15 +3958,15 @@ package body Prj.Nmsc is
end;
end if;
- if Data.Library then
+ if Project.Library then
if Current_Verbosity = High then
Write_Line ("This is a library project file");
end if;
if Get_Mode = Multi_Language then
- Check_Library (Data.Extends, Extends => True);
+ Check_Library (Project.Extends, Extends => True);
- Imported_Project_List := Data.Imported_Projects;
+ Imported_Project_List := Project.Imported_Projects;
while Imported_Project_List /= null loop
Check_Library
(Imported_Project_List.Project,
@@ -4054,11 +3983,12 @@ package body Prj.Nmsc is
-- Warn if they are declared, as it is a common error to think that
-- library are "linked" with Linker switches.
- if Data.Library then
+ if Project.Library then
declare
Linker_Package_Id : constant Package_Id :=
Util.Value_Of
- (Name_Linker, Data.Decl.Packages, In_Tree);
+ (Name_Linker,
+ Project.Decl.Packages, In_Tree);
Linker_Package : Package_Element;
Switches : Array_Element_Id := No_Array_Element;
@@ -4091,8 +4021,8 @@ package body Prj.Nmsc is
end;
end if;
- if Data.Extends /= No_Project then
- In_Tree.Projects.Table (Data.Extends).Library := False;
+ if Project.Extends /= No_Project then
+ Project.Extends.Library := False;
end if;
end Check_Library_Attributes;
@@ -4102,11 +4032,10 @@ package body Prj.Nmsc is
procedure Check_Package_Naming
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data)
+ In_Tree : Project_Tree_Ref)
is
Naming_Id : constant Package_Id :=
- Util.Value_Of (Name_Naming, Data.Decl.Packages, In_Tree);
+ Util.Value_Of (Name_Naming, Project.Decl.Packages, In_Tree);
Naming : Package_Element;
@@ -4141,7 +4070,7 @@ package body Prj.Nmsc is
-- in the project file or if there were none, the default.
if Spec_Suffixs /= No_Array_Element then
- Suffix := Data.Naming.Spec_Suffix;
+ Suffix := Project.Naming.Spec_Suffix;
while Suffix /= No_Array_Element loop
Element :=
@@ -4179,7 +4108,7 @@ package body Prj.Nmsc is
-- Put the resulting array as the specification suffixes
- Data.Naming.Spec_Suffix := Spec_Suffixs;
+ Project.Naming.Spec_Suffix := Spec_Suffixs;
end if;
end;
@@ -4188,7 +4117,7 @@ package body Prj.Nmsc is
Element : Array_Element;
begin
- Current := Data.Naming.Spec_Suffix;
+ Current := Project.Naming.Spec_Suffix;
while Current /= No_Array_Element loop
Element := In_Tree.Array_Elements.Table (Current);
Get_Name_String (Element.Value.Value);
@@ -4225,7 +4154,7 @@ package body Prj.Nmsc is
-- in the project file or if there were none, the default.
if Impl_Suffixs /= No_Array_Element then
- Suffix := Data.Naming.Body_Suffix;
+ Suffix := Project.Naming.Body_Suffix;
while Suffix /= No_Array_Element loop
Element :=
In_Tree.Array_Elements.Table (Suffix);
@@ -4261,7 +4190,7 @@ package body Prj.Nmsc is
-- Put the resulting array as the implementation suffixes
- Data.Naming.Body_Suffix := Impl_Suffixs;
+ Project.Naming.Body_Suffix := Impl_Suffixs;
end if;
end;
@@ -4270,7 +4199,7 @@ package body Prj.Nmsc is
Element : Array_Element;
begin
- Current := Data.Naming.Body_Suffix;
+ Current := Project.Naming.Body_Suffix;
while Current /= No_Array_Element loop
Element := In_Tree.Array_Elements.Table (Current);
Get_Name_String (Element.Value.Value);
@@ -4289,13 +4218,13 @@ package body Prj.Nmsc is
-- Get the exceptions, if any
- Data.Naming.Specification_Exceptions :=
+ Project.Naming.Specification_Exceptions :=
Util.Value_Of
(Name_Specification_Exceptions,
In_Arrays => Naming.Decl.Arrays,
In_Tree => In_Tree);
- Data.Naming.Implementation_Exceptions :=
+ Project.Naming.Implementation_Exceptions :=
Util.Value_Of
(Name_Implementation_Exceptions,
In_Arrays => Naming.Decl.Arrays,
@@ -4309,25 +4238,24 @@ package body Prj.Nmsc is
procedure Check_Programming_Languages
(In_Tree : Project_Tree_Ref;
- Project : Project_Id;
- Data : in out Project_Data)
+ Project : Project_Id)
is
Languages : Variable_Value := Nil_Variable_Value;
Def_Lang : Variable_Value := Nil_Variable_Value;
Def_Lang_Id : Name_Id;
begin
- Data.Languages := No_Language_Index;
+ Project.Languages := No_Language_Index;
Languages :=
- Prj.Util.Value_Of (Name_Languages, Data.Decl.Attributes, In_Tree);
+ Prj.Util.Value_Of (Name_Languages, Project.Decl.Attributes, In_Tree);
Def_Lang :=
Prj.Util.Value_Of
- (Name_Default_Language, Data.Decl.Attributes, In_Tree);
+ (Name_Default_Language, Project.Decl.Attributes, In_Tree);
-- Shouldn't these be set to False by default, and only set to True when
-- we actually find some source file???
- if Data.Source_Dirs /= Nil_String then
+ if Project.Source_Dirs /= Nil_String then
-- Check if languages are specified in this project
@@ -4347,7 +4275,7 @@ package body Prj.Nmsc is
(Project,
In_Tree,
"no languages defined for this project",
- Data.Location);
+ Project.Location);
Def_Lang_Id := No_Name;
else
Def_Lang_Id := Name_Ada;
@@ -4361,19 +4289,17 @@ package body Prj.Nmsc is
end if;
if Def_Lang_Id /= No_Name then
- Data.Languages :=
- new Language_Data'(No_Language_Data);
- Data.Languages.Name := Def_Lang_Id;
+ Project.Languages := new Language_Data'(No_Language_Data);
+ Project.Languages.Name := Def_Lang_Id;
Get_Name_String (Def_Lang_Id);
Name_Buffer (1) := GNAT.Case_Util.To_Upper (Name_Buffer (1));
- Data.Languages.Display_Name := Name_Find;
+ Project.Languages.Display_Name := Name_Find;
if Def_Lang_Id = Name_Ada then
- Data.Languages.Config.Kind := Unit_Based;
- Data.Languages.Config.Dependency_Kind :=
- ALI_File;
+ Project.Languages.Config.Kind := Unit_Based;
+ Project.Languages.Config.Dependency_Kind := ALI_File;
else
- Data.Languages.Config.Kind := File_Based;
+ Project.Languages.Config.Kind := File_Based;
end if;
end if;
@@ -4389,13 +4315,13 @@ package body Prj.Nmsc is
-- If there are no languages declared, there are no sources
if Current = Nil_String then
- Data.Source_Dirs := Nil_String;
+ Project.Source_Dirs := Nil_String;
- if Data.Qualifier = Standard then
+ if Project.Qualifier = Standard then
Error_Msg
(Project,
In_Tree,
- "a standard project cannot have no language declared",
+ "a standard project must have at least one language",
Languages.Location);
end if;
@@ -4412,7 +4338,7 @@ package body Prj.Nmsc is
-- If the language was not already specified (duplicates
-- are simply ignored).
- NL_Id := Data.Languages;
+ NL_Id := Project.Languages;
while NL_Id /= No_Language_Index loop
exit when Lang_Name = NL_Id.Name;
NL_Id := NL_Id.Next;
@@ -4422,7 +4348,7 @@ package body Prj.Nmsc is
Index := new Language_Data'(No_Language_Data);
Index.Name := Lang_Name;
Index.Display_Name := Element.Value;
- Index.Next := Data.Languages;
+ Index.Next := Project.Languages;
if Lang_Name = Name_Ada then
Index.Config.Kind := Unit_Based;
@@ -4433,7 +4359,7 @@ package body Prj.Nmsc is
Index.Config.Dependency_Kind := None;
end if;
- Data.Languages := Index;
+ Project.Languages := Index;
end if;
Current := Element.Next;
@@ -4451,27 +4377,22 @@ package body Prj.Nmsc is
function Check_Project
(P : Project_Id;
Root_Project : Project_Id;
- In_Tree : Project_Tree_Ref;
Extending : Boolean) return Boolean
is
+ Prj : Project_Id;
begin
if P = Root_Project then
return True;
elsif Extending then
- declare
- Data : Project_Data;
-
- begin
- Data := In_Tree.Projects.Table (Root_Project);
- while Data.Extends /= No_Project loop
- if P = Data.Extends then
- return True;
- end if;
+ Prj := Root_Project;
+ while Prj.Extends /= No_Project loop
+ if P = Prj.Extends then
+ return True;
+ end if;
- Data := In_Tree.Projects.Table (Data.Extends);
- end loop;
- end;
+ Prj := Prj.Extends;
+ end loop;
end if;
return False;
@@ -4484,44 +4405,43 @@ package body Prj.Nmsc is
procedure Check_Stand_Alone_Library
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Current_Dir : String;
Extending : Boolean)
is
Lib_Interfaces : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Interface,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Lib_Auto_Init : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Auto_Init,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Lib_Src_Dir : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Src_Dir,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Lib_Symbol_File : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Symbol_File,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Lib_Symbol_Policy : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Symbol_Policy,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Lib_Ref_Symbol_File : constant Prj.Variable_Value :=
Prj.Util.Value_Of
(Snames.Name_Library_Reference_Symbol_File,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Auto_Init_Supported : Boolean;
@@ -4532,7 +4452,7 @@ package body Prj.Nmsc is
begin
if Get_Mode = Multi_Language then
- Auto_Init_Supported := Data.Config.Auto_Init_Supported;
+ Auto_Init_Supported := Project.Config.Auto_Init_Supported;
else
Auto_Init_Supported :=
MLib.Tgt.Standalone_Library_Auto_Init_Is_Supported;
@@ -4593,7 +4513,7 @@ package body Prj.Nmsc is
-- Start of processing for SAL_Library
begin
- Data.Standalone_Library := True;
+ Project.Standalone_Library := True;
-- Library_Interface cannot be an empty list
@@ -4645,7 +4565,7 @@ package body Prj.Nmsc is
then
if Check_Project
(UData.File_Names (Body_Part).Project,
- Project, In_Tree, Extending)
+ Project, Extending)
then
-- There is a body for this unit.
-- If there is no spec, we need to check that it
@@ -4698,7 +4618,7 @@ package body Prj.Nmsc is
and then Check_Project
(UData.File_Names
(Specification).Project,
- Project, In_Tree, Extending)
+ Project, Extending)
then
-- The unit is part of the project, it has a spec,
@@ -4720,7 +4640,7 @@ package body Prj.Nmsc is
else
-- Multi_Language mode
- Next_Proj := Data.Extends;
+ Next_Proj := Project.Extends;
Iter := For_Each_Source (In_Tree, Project);
@@ -4736,8 +4656,7 @@ package body Prj.Nmsc is
Next_Proj = No_Project;
Iter := For_Each_Source (In_Tree, Next_Proj);
- Next_Proj :=
- In_Tree.Projects.Table (Next_Proj).Extends;
+ Next_Proj := Next_Proj.Extends;
end loop;
if Source /= No_Source then
@@ -4754,7 +4673,7 @@ package body Prj.Nmsc is
if Source /= No_Source then
if Source.Project /= Project
and then
- not Is_Extending (Project, Source.Project, In_Tree)
+ not Is_Extending (Project, Source.Project)
then
Source := No_Source;
end if;
@@ -4801,7 +4720,7 @@ package body Prj.Nmsc is
-- Put the list of Interface ALIs in the project data
- Data.Lib_Interface_ALIs := Interface_ALIs;
+ Project.Lib_Interface_ALIs := Interface_ALIs;
-- Check value of attribute Library_Auto_Init and set
-- Lib_Auto_Init accordingly.
@@ -4811,18 +4730,18 @@ package body Prj.Nmsc is
-- If no attribute Library_Auto_Init is declared, then set auto
-- init only if it is supported.
- Data.Lib_Auto_Init := Auto_Init_Supported;
+ Project.Lib_Auto_Init := Auto_Init_Supported;
else
Get_Name_String (Lib_Auto_Init.Value);
To_Lower (Name_Buffer (1 .. Name_Len));
if Name_Buffer (1 .. Name_Len) = "false" then
- Data.Lib_Auto_Init := False;
+ Project.Lib_Auto_Init := False;
elsif Name_Buffer (1 .. Name_Len) = "true" then
if Auto_Init_Supported then
- Data.Lib_Auto_Init := True;
+ Project.Lib_Auto_Init := True;
else
-- Library_Auto_Init cannot be "true" if auto init is not
@@ -4854,89 +4773,60 @@ package body Prj.Nmsc is
declare
Dir_Id : constant File_Name_Type :=
File_Name_Type (Lib_Src_Dir.Value);
+ Dir_Exists : Boolean;
begin
Locate_Directory
(Project,
In_Tree,
Dir_Id,
- Data.Directory.Display_Name,
- Data.Library_Src_Dir.Name,
- Data.Library_Src_Dir.Display_Name,
+ Path => Project.Library_Src_Dir,
+ Dir_Exists => Dir_Exists,
+ Must_Exist => False,
Create => "library source copy",
- Current_Dir => Current_Dir,
Location => Lib_Src_Dir.Location,
- Externally_Built => Data.Externally_Built);
+ Externally_Built => Project.Externally_Built);
-- If directory does not exist, report an error
- if Data.Library_Src_Dir = No_Path_Information then
-
+ if not Dir_Exists then
-- Get the absolute name of the library directory that does
-- not exist, to report an error.
- declare
- Dir_Name : constant String :=
- Get_Name_String (Dir_Id);
-
- begin
- if Is_Absolute_Path (Dir_Name) then
- Err_Vars.Error_Msg_File_1 := Dir_Id;
-
- else
- Get_Name_String (Data.Directory.Name);
-
- if Name_Buffer (Name_Len) /=
- Directory_Separator
- then
- Name_Len := Name_Len + 1;
- Name_Buffer (Name_Len) :=
- Directory_Separator;
- end if;
-
- Name_Buffer
- (Name_Len + 1 ..
- Name_Len + Dir_Name'Length) :=
- Dir_Name;
- Name_Len := Name_Len + Dir_Name'Length;
- Err_Vars.Error_Msg_Name_1 := Name_Find;
- end if;
-
- -- Report the error
-
- Error_Msg_File_1 := Dir_Id;
- Error_Msg
- (Project, In_Tree,
- "Directory { does not exist",
- Lib_Src_Dir.Location);
- end;
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Project.Library_Src_Dir.Display_Name);
+ Error_Msg
+ (Project, In_Tree,
+ "Directory { does not exist",
+ Lib_Src_Dir.Location);
-- Report error if it is the same as the object directory
- elsif Data.Library_Src_Dir = Data.Object_Directory then
+ elsif Project.Library_Src_Dir = Project.Object_Directory then
Error_Msg
(Project, In_Tree,
"directory to copy interfaces cannot be " &
"the object directory",
Lib_Src_Dir.Location);
- Data.Library_Src_Dir := No_Path_Information;
+ Project.Library_Src_Dir := No_Path_Information;
else
declare
Src_Dirs : String_List_Id;
Src_Dir : String_Element;
+ Pid : Project_List;
begin
-- Interface copy directory cannot be one of the source
-- directory of the current project.
- Src_Dirs := Data.Source_Dirs;
+ Src_Dirs := Project.Source_Dirs;
while Src_Dirs /= Nil_String loop
Src_Dir := In_Tree.String_Elements.Table (Src_Dirs);
-- Report error if it is one of the source directories
- if Data.Library_Src_Dir.Name =
+ if Project.Library_Src_Dir.Name =
Path_Name_Type (Src_Dir.Value)
then
Error_Msg
@@ -4944,23 +4834,23 @@ package body Prj.Nmsc is
"directory to copy interfaces cannot " &
"be one of the source directories",
Lib_Src_Dir.Location);
- Data.Library_Src_Dir := No_Path_Information;
+ Project.Library_Src_Dir := No_Path_Information;
exit;
end if;
Src_Dirs := Src_Dir.Next;
end loop;
- if Data.Library_Src_Dir /= No_Path_Information then
+ if Project.Library_Src_Dir /= No_Path_Information then
-- It cannot be a source directory of any other
-- project either.
- Project_Loop : for Pid in 1 ..
- Project_Table.Last (In_Tree.Projects)
- loop
- Src_Dirs :=
- In_Tree.Projects.Table (Pid).Source_Dirs;
+ Pid := In_Tree.Projects;
+ Project_Loop : loop
+ exit Project_Loop when Pid = null;
+
+ Src_Dirs := Pid.Project.Source_Dirs;
Dir_Loop : while Src_Dirs /= Nil_String loop
Src_Dir :=
In_Tree.String_Elements.Table (Src_Dirs);
@@ -4968,25 +4858,27 @@ package body Prj.Nmsc is
-- Report error if it is one of the source
-- directories
- if Data.Library_Src_Dir.Name =
+ if Project.Library_Src_Dir.Name =
Path_Name_Type (Src_Dir.Value)
then
Error_Msg_File_1 :=
File_Name_Type (Src_Dir.Value);
- Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Pid).Name;
+ Error_Msg_Name_1 := Pid.Project.Name;
Error_Msg
(Project, In_Tree,
"directory to copy interfaces cannot " &
"be the same as source directory { of " &
"project %%",
Lib_Src_Dir.Location);
- Data.Library_Src_Dir := No_Path_Information;
+ Project.Library_Src_Dir :=
+ No_Path_Information;
exit Project_Loop;
end if;
Src_Dirs := Src_Dir.Next;
end loop Dir_Loop;
+
+ Pid := Pid.Next;
end loop Project_Loop;
end if;
end;
@@ -4994,12 +4886,12 @@ package body Prj.Nmsc is
-- In high verbosity, if there is a valid Library_Src_Dir,
-- display its path name.
- if Data.Library_Src_Dir /= No_Path_Information
+ if Project.Library_Src_Dir /= No_Path_Information
and then Current_Verbosity = High
then
Write_Attr
("Directory to copy interfaces",
- Get_Name_String (Data.Library_Src_Dir.Name));
+ Get_Name_String (Project.Library_Src_Dir.Name));
end if;
end if;
end;
@@ -5019,19 +4911,19 @@ package body Prj.Nmsc is
-- Symbol policy must hove one of a limited number of values
if Value = "autonomous" or else Value = "default" then
- Data.Symbol_Data.Symbol_Policy := Autonomous;
+ Project.Symbol_Data.Symbol_Policy := Autonomous;
elsif Value = "compliant" then
- Data.Symbol_Data.Symbol_Policy := Compliant;
+ Project.Symbol_Data.Symbol_Policy := Compliant;
elsif Value = "controlled" then
- Data.Symbol_Data.Symbol_Policy := Controlled;
+ Project.Symbol_Data.Symbol_Policy := Controlled;
elsif Value = "restricted" then
- Data.Symbol_Data.Symbol_Policy := Restricted;
+ Project.Symbol_Data.Symbol_Policy := Restricted;
elsif Value = "direct" then
- Data.Symbol_Data.Symbol_Policy := Direct;
+ Project.Symbol_Data.Symbol_Policy := Direct;
else
Error_Msg
@@ -5046,7 +4938,7 @@ package body Prj.Nmsc is
-- cannot be Restricted.
if Lib_Symbol_File.Default then
- if Data.Symbol_Data.Symbol_Policy = Restricted then
+ if Project.Symbol_Data.Symbol_Policy = Restricted then
Error_Msg
(Project, In_Tree,
"Library_Symbol_File needs to be defined when " &
@@ -5057,7 +4949,7 @@ package body Prj.Nmsc is
else
-- Library_Symbol_File is defined
- Data.Symbol_Data.Symbol_File :=
+ Project.Symbol_Data.Symbol_File :=
Path_Name_Type (Lib_Symbol_File.Value);
Get_Name_String (Lib_Symbol_File.Value);
@@ -5097,8 +4989,8 @@ package body Prj.Nmsc is
-- symbol policy cannot be Compliant or Controlled.
if Lib_Ref_Symbol_File.Default then
- if Data.Symbol_Data.Symbol_Policy = Compliant
- or else Data.Symbol_Data.Symbol_Policy = Controlled
+ if Project.Symbol_Data.Symbol_Policy = Compliant
+ or else Project.Symbol_Data.Symbol_Policy = Controlled
then
Error_Msg
(Project, In_Tree,
@@ -5109,7 +5001,7 @@ package body Prj.Nmsc is
else
-- Library_Reference_Symbol_File is defined, check file exists
- Data.Symbol_Data.Reference :=
+ Project.Symbol_Data.Reference :=
Path_Name_Type (Lib_Ref_Symbol_File.Value);
Get_Name_String (Lib_Ref_Symbol_File.Value);
@@ -5124,15 +5016,15 @@ package body Prj.Nmsc is
if not Is_Absolute_Path (Name_Buffer (1 .. Name_Len)) then
Name_Len := 0;
Add_Str_To_Name_Buffer
- (Get_Name_String (Data.Directory.Name));
+ (Get_Name_String (Project.Directory.Name));
Add_Char_To_Name_Buffer (Directory_Separator);
Add_Str_To_Name_Buffer
(Get_Name_String (Lib_Ref_Symbol_File.Value));
- Data.Symbol_Data.Reference := Name_Find;
+ Project.Symbol_Data.Reference := Name_Find;
end if;
if not Is_Regular_File
- (Get_Name_String (Data.Symbol_Data.Reference))
+ (Get_Name_String (Project.Symbol_Data.Reference))
then
Error_Msg_File_1 :=
File_Name_Type (Lib_Ref_Symbol_File.Value);
@@ -5142,8 +5034,8 @@ package body Prj.Nmsc is
-- symbol policies, this is just a warning
Error_Msg_Warn :=
- Data.Symbol_Data.Symbol_Policy /= Controlled
- and then Data.Symbol_Data.Symbol_Policy /= Direct;
+ Project.Symbol_Data.Symbol_Policy /= Controlled
+ and then Project.Symbol_Data.Symbol_Policy /= Direct;
Error_Msg
(Project, In_Tree,
@@ -5155,9 +5047,9 @@ package body Prj.Nmsc is
-- is no reference to check against, and we don't want to
-- fail in this case.
- if Data.Symbol_Data.Symbol_Policy /= Controlled then
- if Data.Symbol_Data.Symbol_Policy = Compliant then
- Data.Symbol_Data.Symbol_Policy := Autonomous;
+ if Project.Symbol_Data.Symbol_Policy /= Controlled then
+ if Project.Symbol_Data.Symbol_Policy = Compliant then
+ Project.Symbol_Data.Symbol_Policy := Autonomous;
end if;
end if;
end if;
@@ -5165,15 +5057,15 @@ package body Prj.Nmsc is
-- If both the reference symbol file and the symbol file are
-- defined, then check that they are not the same file.
- if Data.Symbol_Data.Symbol_File /= No_Path then
- Get_Name_String (Data.Symbol_Data.Symbol_File);
+ if Project.Symbol_Data.Symbol_File /= No_Path then
+ Get_Name_String (Project.Symbol_Data.Symbol_File);
if Name_Len > 0 then
declare
Symb_Path : constant String :=
Normalize_Pathname
(Get_Name_String
- (Data.Object_Directory.Name) &
+ (Project.Object_Directory.Name) &
Directory_Separator &
Name_Buffer (1 .. Name_Len),
Directory => Current_Dir,
@@ -5182,7 +5074,7 @@ package body Prj.Nmsc is
Ref_Path : constant String :=
Normalize_Pathname
(Get_Name_String
- (Data.Symbol_Data.Reference),
+ (Project.Symbol_Data.Reference),
Directory => Current_Dir,
Resolve_Links =>
Opt.Follow_Links_For_Files);
@@ -5324,7 +5216,7 @@ package body Prj.Nmsc is
-- If location of error is unknown, use the location of the project
if Real_Location = No_Location then
- Real_Location := In_Tree.Projects.Table (Project).Location;
+ Real_Location := Project.Location;
end if;
if Error_Report = null then
@@ -5392,36 +5284,35 @@ package body Prj.Nmsc is
procedure Get_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Current_Dir : String;
- Data : in out Project_Data)
+ Current_Dir : String)
is
Object_Dir : constant Variable_Value :=
Util.Value_Of
- (Name_Object_Dir, Data.Decl.Attributes, In_Tree);
+ (Name_Object_Dir, Project.Decl.Attributes, In_Tree);
Exec_Dir : constant Variable_Value :=
Util.Value_Of
- (Name_Exec_Dir, Data.Decl.Attributes, In_Tree);
+ (Name_Exec_Dir, Project.Decl.Attributes, In_Tree);
Source_Dirs : constant Variable_Value :=
Util.Value_Of
- (Name_Source_Dirs, Data.Decl.Attributes, In_Tree);
+ (Name_Source_Dirs, Project.Decl.Attributes, In_Tree);
Excluded_Source_Dirs : constant Variable_Value :=
Util.Value_Of
(Name_Excluded_Source_Dirs,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Source_Files : constant Variable_Value :=
Util.Value_Of
- (Name_Source_Files, Data.Decl.Attributes, In_Tree);
+ (Name_Source_Files, Project.Decl.Attributes, In_Tree);
Last_Source_Dir : String_List_Id := Nil_String;
Languages : constant Variable_Value :=
Prj.Util.Value_Of
- (Name_Languages, Data.Decl.Attributes, In_Tree);
+ (Name_Languages, Project.Decl.Attributes, In_Tree);
procedure Find_Source_Dirs
(From : File_Name_Type;
@@ -5495,7 +5386,7 @@ package body Prj.Nmsc is
-- Check if directory is already in list
- List := Data.Source_Dirs;
+ List := Project.Source_Dirs;
Prev := Nil_String;
while List /= Nil_String loop
Element := In_Tree.String_Elements.Table (List);
@@ -5530,7 +5421,7 @@ package body Prj.Nmsc is
-- Case of first source directory
if Last_Source_Dir = Nil_String then
- Data.Source_Dirs := String_Element_Table.Last
+ Project.Source_Dirs := String_Element_Table.Last
(In_Tree.String_Elements);
-- Here we already have source directories
@@ -5553,7 +5444,7 @@ package body Prj.Nmsc is
elsif Removed and Found then
if Prev = Nil_String then
- Data.Source_Dirs :=
+ Project.Source_Dirs :=
In_Tree.String_Elements.Table (List).Next;
else
In_Tree.String_Elements.Table (Prev).Next :=
@@ -5628,7 +5519,7 @@ package body Prj.Nmsc is
Directory (Directory'Last - 2) = Directory_Separator)
then
if not Removed then
- Data.Known_Order_Of_Source_Dirs := False;
+ Project.Known_Order_Of_Source_Dirs := False;
end if;
Name_Len := Directory'Length - 3;
@@ -5657,7 +5548,8 @@ package body Prj.Nmsc is
Normalize_Pathname
(Name => Get_Name_String (Base_Dir),
Directory =>
- Get_Name_String (Data.Directory.Display_Name),
+ Get_Name_String
+ (Project.Directory.Display_Name),
Resolve_Links => False,
Case_Sensitive => True);
@@ -5669,7 +5561,7 @@ package body Prj.Nmsc is
Error_Msg
(Project, In_Tree,
"{ is not a valid directory.",
- Data.Location);
+ Project.Location);
else
Error_Msg
(Project, In_Tree,
@@ -5699,29 +5591,28 @@ package body Prj.Nmsc is
else
declare
- Path_Name : Path_Name_Type;
- Display_Path_Name : Path_Name_Type;
+ Path_Name : Path_Information;
List : String_List_Id;
Prev : String_List_Id;
+ Dir_Exists : Boolean;
begin
Locate_Directory
(Project => Project,
In_Tree => In_Tree,
Name => From,
- Parent => Data.Directory.Display_Name,
- Dir => Path_Name,
- Display => Display_Path_Name,
- Current_Dir => Current_Dir);
+ Path => Path_Name,
+ Dir_Exists => Dir_Exists,
+ Must_Exist => False);
- if Path_Name = No_Path then
+ if not Dir_Exists then
Err_Vars.Error_Msg_File_1 := From;
if Location = No_Location then
Error_Msg
(Project, In_Tree,
"{ is not a valid directory",
- Data.Location);
+ Project.Location);
else
Error_Msg
(Project, In_Tree,
@@ -5732,14 +5623,14 @@ package body Prj.Nmsc is
else
declare
Path : constant String :=
- Get_Name_String (Path_Name) &
+ Get_Name_String (Path_Name.Name) &
Directory_Separator;
Last_Path : constant Natural :=
Compute_Directory_Last (Path);
Path_Id : Name_Id;
Display_Path : constant String :=
Get_Name_String
- (Display_Path_Name) &
+ (Path_Name.Display_Name) &
Directory_Separator;
Last_Display_Path : constant Natural :=
Compute_Directory_Last
@@ -5775,7 +5666,7 @@ package body Prj.Nmsc is
-- This is the first source directory
- Data.Source_Dirs := String_Element_Table.Last
+ Project.Source_Dirs := String_Element_Table.Last
(In_Tree.String_Elements);
else
@@ -5798,11 +5689,11 @@ package body Prj.Nmsc is
else
-- Remove source dir, if present
- List := Data.Source_Dirs;
Prev := Nil_String;
-- Look for source dir in current list
+ List := Project.Source_Dirs;
while List /= Nil_String loop
Element := In_Tree.String_Elements.Table (List);
exit when Element.Value = Path_Id;
@@ -5814,7 +5705,7 @@ package body Prj.Nmsc is
-- Source dir was found, remove it from the list
if Prev = Nil_String then
- Data.Source_Dirs :=
+ Project.Source_Dirs :=
In_Tree.String_Elements.Table (List).Next;
else
@@ -5831,6 +5722,8 @@ package body Prj.Nmsc is
-- Start of processing for Get_Directories
+ Dir_Exists : Boolean;
+
begin
if Current_Verbosity = High then
Write_Line ("Starting to look for directories");
@@ -5842,15 +5735,14 @@ package body Prj.Nmsc is
if (((not Source_Files.Default)
and then Source_Files.Values = Nil_String)
or else
- ((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String)
- or else
- ((not Languages.Default) and then Languages.Values = Nil_String))
- and then Data.Extends = No_Project
+ ((not Source_Dirs.Default) and then Source_Dirs.Values = Nil_String)
+ or else
+ ((not Languages.Default) and then Languages.Values = Nil_String))
+ and then Project.Extends = No_Project
then
- Data.Object_Directory := No_Path_Information;
-
+ Project.Object_Directory := No_Path_Information;
else
- Data.Object_Directory := Data.Directory;
+ Project.Object_Directory := Project.Directory;
end if;
-- Check the object directory
@@ -5865,48 +5757,41 @@ package body Prj.Nmsc is
Object_Dir.Location);
else
- -- We check that the specified object directory does exist
+ -- We check that the specified object directory does exist.
+ -- However, even when it doesn't exist, we set it to a default
+ -- value. This is for the benefit of tools that recover from
+ -- errors; for example, these tools could create the non existent
+ -- directory.
+ -- We always return an absolute directory name though
Locate_Directory
(Project,
In_Tree,
File_Name_Type (Object_Dir.Value),
- Data.Directory.Display_Name,
- Data.Object_Directory.Name,
- Data.Object_Directory.Display_Name,
+ Path => Project.Object_Directory,
Create => "object",
+ Dir_Exists => Dir_Exists,
Location => Object_Dir.Location,
- Current_Dir => Current_Dir,
- Externally_Built => Data.Externally_Built);
+ Must_Exist => False,
+ Externally_Built => Project.Externally_Built);
- if Data.Object_Directory = No_Path_Information then
-
- -- The object directory does not exist, report an error if the
- -- project is not externally built.
-
- if not Data.Externally_Built then
- Err_Vars.Error_Msg_File_1 :=
- File_Name_Type (Object_Dir.Value);
- Error_Msg
- (Project, In_Tree,
- "object directory { not found",
- Data.Location);
- end if;
-
- -- Do not keep a nil Object_Directory. Set it to the specified
- -- (relative or absolute) path. This is for the benefit of
- -- tools that recover from errors; for example, these tools
- -- could create the non existent directory.
+ if not Dir_Exists
+ and then not Project.Externally_Built
+ then
+ -- The object directory does not exist, report an error if
+ -- the project is not externally built.
- Data.Object_Directory.Display_Name :=
- Path_Name_Type (Object_Dir.Value);
- Data.Object_Directory.Name :=
- Path_Name_Type (Canonical_Case_File_Name (Object_Dir.Value));
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Object_Dir.Value);
+ Error_Msg
+ (Project, In_Tree,
+ "object directory { not found",
+ Project.Location);
end if;
end if;
- elsif Data.Object_Directory /= No_Path_Information and then
- Subdirs /= null
+ elsif Project.Object_Directory /= No_Path_Information
+ and then Subdirs /= null
then
Name_Len := 1;
Name_Buffer (1) := '.';
@@ -5914,22 +5799,20 @@ package body Prj.Nmsc is
(Project,
In_Tree,
Name_Find,
- Data.Directory.Display_Name,
- Data.Object_Directory.Name,
- Data.Object_Directory.Display_Name,
+ Path => Project.Object_Directory,
Create => "object",
+ Dir_Exists => Dir_Exists,
Location => Object_Dir.Location,
- Current_Dir => Current_Dir,
- Externally_Built => Data.Externally_Built);
+ Externally_Built => Project.Externally_Built);
end if;
if Current_Verbosity = High then
- if Data.Object_Directory = No_Path_Information then
+ if Project.Object_Directory = No_Path_Information then
Write_Line ("No object directory");
else
Write_Attr
("Object directory",
- Get_Name_String (Data.Object_Directory.Display_Name));
+ Get_Name_String (Project.Object_Directory.Display_Name));
end if;
end if;
@@ -5937,7 +5820,7 @@ package body Prj.Nmsc is
-- We set the object directory to its default
- Data.Exec_Directory := Data.Object_Directory;
+ Project.Exec_Directory := Project.Object_Directory;
if Exec_Dir.Value /= Empty_String then
Get_Name_String (Exec_Dir.Value);
@@ -5955,30 +5838,28 @@ package body Prj.Nmsc is
(Project,
In_Tree,
File_Name_Type (Exec_Dir.Value),
- Data.Directory.Display_Name,
- Data.Exec_Directory.Name,
- Data.Exec_Directory.Display_Name,
+ Path => Project.Exec_Directory,
+ Dir_Exists => Dir_Exists,
Create => "exec",
Location => Exec_Dir.Location,
- Current_Dir => Current_Dir,
- Externally_Built => Data.Externally_Built);
+ Externally_Built => Project.Externally_Built);
- if Data.Exec_Directory = No_Path_Information then
+ if not Dir_Exists then
Err_Vars.Error_Msg_File_1 := File_Name_Type (Exec_Dir.Value);
Error_Msg
(Project, In_Tree,
"exec directory { not found",
- Data.Location);
+ Project.Location);
end if;
end if;
end if;
if Current_Verbosity = High then
- if Data.Exec_Directory = No_Path_Information then
+ if Project.Exec_Directory = No_Path_Information then
Write_Line ("No exec directory");
else
Write_Str ("Exec directory: """);
- Write_Str (Get_Name_String (Data.Exec_Directory.Display_Name));
+ Write_Str (Get_Name_String (Project.Exec_Directory.Display_Name));
Write_Line ("""");
end if;
end if;
@@ -5994,9 +5875,9 @@ package body Prj.Nmsc is
if (not Source_Files.Default) and then
Source_Files.Values = Nil_String
then
- Data.Source_Dirs := Nil_String;
+ Project.Source_Dirs := Nil_String;
- if Data.Qualifier = Standard then
+ if Project.Qualifier = Standard then
Error_Msg
(Project,
In_Tree,
@@ -6011,11 +5892,11 @@ package body Prj.Nmsc is
String_Element_Table.Increment_Last
(In_Tree.String_Elements);
- Data.Source_Dirs := String_Element_Table.Last
+ Project.Source_Dirs := String_Element_Table.Last
(In_Tree.String_Elements);
- In_Tree.String_Elements.Table (Data.Source_Dirs) :=
- (Value => Name_Id (Data.Directory.Name),
- Display_Value => Name_Id (Data.Directory.Display_Name),
+ In_Tree.String_Elements.Table (Project.Source_Dirs) :=
+ (Value => Name_Id (Project.Directory.Name),
+ Display_Value => Name_Id (Project.Directory.Display_Name),
Location => No_Location,
Flag => False,
Next => Nil_String,
@@ -6024,11 +5905,11 @@ package body Prj.Nmsc is
if Current_Verbosity = High then
Write_Attr
("Single source directory",
- Get_Name_String (Data.Directory.Display_Name));
+ Get_Name_String (Project.Directory.Display_Name));
end if;
elsif Source_Dirs.Values = Nil_String then
- if Data.Qualifier = Standard then
+ if Project.Qualifier = Standard then
Error_Msg
(Project,
In_Tree,
@@ -6036,7 +5917,7 @@ package body Prj.Nmsc is
Source_Dirs.Location);
end if;
- Data.Source_Dirs := Nil_String;
+ Project.Source_Dirs := Nil_String;
else
declare
@@ -6083,7 +5964,7 @@ package body Prj.Nmsc is
end if;
declare
- Current : String_List_Id := Data.Source_Dirs;
+ Current : String_List_Id := Project.Source_Dirs;
Element : String_Element;
begin
@@ -6106,29 +5987,27 @@ package body Prj.Nmsc is
procedure Get_Mains
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : in out Project_Data)
+ In_Tree : Project_Tree_Ref)
is
Mains : constant Variable_Value :=
- Prj.Util.Value_Of (Name_Main, Data.Decl.Attributes, In_Tree);
+ Prj.Util.Value_Of (Name_Main, Project.Decl.Attributes, In_Tree);
List : String_List_Id;
Elem : String_Element;
begin
- Data.Mains := Mains.Values;
+ Project.Mains := Mains.Values;
-- If no Mains were specified, and if we are an extending project,
-- inherit the Mains from the project we are extending.
if Mains.Default then
- if not Data.Library and then Data.Extends /= No_Project then
- Data.Mains :=
- In_Tree.Projects.Table (Data.Extends).Mains;
+ if not Project.Library and then Project.Extends /= No_Project then
+ Project.Mains := Project.Extends.Mains;
end if;
-- In a library project file, Main cannot be specified
- elsif Data.Library then
+ elsif Project.Library then
Error_Msg
(Project, In_Tree,
"a library project file cannot have Main specified",
@@ -6576,14 +6455,15 @@ package body Prj.Nmsc is
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
Name : File_Name_Type;
- Parent : Path_Name_Type;
- Dir : out Path_Name_Type;
- Display : out Path_Name_Type;
+ Path : out Path_Information;
+ Dir_Exists : out Boolean;
Create : String := "";
- Current_Dir : String;
Location : Source_Ptr := No_Location;
+ Must_Exist : Boolean := True;
Externally_Built : Boolean := False)
is
+ Parent : constant Path_Name_Type :=
+ Project.Directory.Display_Name;
The_Parent : constant String :=
Get_Name_String (Parent) & Directory_Separator;
The_Parent_Last : constant Natural :=
@@ -6623,8 +6503,8 @@ package body Prj.Nmsc is
Write_Line (""")");
end if;
- Dir := No_Path;
- Display := No_Path;
+ Path := No_Path_Information;
+ Dir_Exists := False;
if Is_Absolute_Path (Get_Name_String (The_Name)) then
Full_Name := The_Name;
@@ -6686,19 +6566,24 @@ package body Prj.Nmsc is
end if;
end if;
- if Is_Directory (Full_Path_Name.all) then
+ Dir_Exists := Is_Directory (Full_Path_Name.all);
+
+ if not Must_Exist or else Dir_Exists then
declare
Normed : constant String :=
Normalize_Pathname
(Full_Path_Name.all,
- Directory => Current_Dir,
+ Directory =>
+ The_Parent (The_Parent'First .. The_Parent_Last),
Resolve_Links => False,
Case_Sensitive => True);
Canonical_Path : constant String :=
Normalize_Pathname
(Normed,
- Directory => Current_Dir,
+ Directory =>
+ The_Parent
+ (The_Parent'First .. The_Parent_Last),
Resolve_Links =>
Opt.Follow_Links_For_Dirs,
Case_Sensitive => False);
@@ -6706,11 +6591,11 @@ package body Prj.Nmsc is
begin
Name_Len := Normed'Length;
Name_Buffer (1 .. Name_Len) := Normed;
- Display := Name_Find;
+ Path.Display_Name := Name_Find;
Name_Len := Canonical_Path'Length;
Name_Buffer (1 .. Name_Len) := Canonical_Path;
- Dir := Name_Find;
+ Path.Name := Name_Find;
end;
end if;
@@ -6724,18 +6609,17 @@ package body Prj.Nmsc is
procedure Find_Excluded_Sources
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
- Data : Project_Data)
+ In_Tree : Project_Tree_Ref)
is
Excluded_Source_List_File : constant Variable_Value :=
Util.Value_Of
(Name_Excluded_Source_List_File,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Excluded_Sources : Variable_Value := Util.Value_Of
(Name_Excluded_Source_Files,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Current : String_List_Id;
@@ -6755,7 +6639,7 @@ package body Prj.Nmsc is
Locally_Removed := True;
Excluded_Sources :=
Util.Value_Of
- (Name_Locally_Removed_Files, Data.Decl.Attributes, In_Tree);
+ (Name_Locally_Removed_Files, Project.Decl.Attributes, In_Tree);
end if;
Excluded_Sources_Htable.Reset;
@@ -6805,7 +6689,7 @@ package body Prj.Nmsc is
Path_Name_Of
(File_Name_Type
(Excluded_Source_List_File.Value),
- Data.Directory.Name);
+ Project.Directory.Name);
begin
if Source_File_Path_Name'Length = 0 then
@@ -6877,18 +6761,17 @@ package body Prj.Nmsc is
procedure Find_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Proc_Data : in out Processing_Data)
is
Sources : constant Variable_Value :=
Util.Value_Of
(Name_Source_Files,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Source_List_File : constant Variable_Value :=
Util.Value_Of
(Name_Source_List_File,
- Data.Decl.Attributes,
+ Project.Decl.Attributes,
In_Tree);
Name_Loc : Name_Location;
@@ -6922,16 +6805,16 @@ package body Prj.Nmsc is
begin
if Get_Mode = Multi_Language then
if Current = Nil_String then
- Data.Languages := No_Language_Index;
+ Project.Languages := No_Language_Index;
-- This project contains no source. For projects that don't
-- extend other projects, this also means that there is no
-- need for an object directory, if not specified.
- if Data.Extends = No_Project
- and then Data.Object_Directory = Data.Directory
+ if Project.Extends = No_Project
+ and then Project.Object_Directory = Project.Directory
then
- Data.Object_Directory := No_Path_Information;
+ Project.Object_Directory := No_Path_Information;
end if;
end if;
end if;
@@ -7006,7 +6889,8 @@ package body Prj.Nmsc is
declare
Source_File_Path_Name : constant String :=
Path_Name_Of
- (File_Name_Type (Source_List_File.Value), Data.Directory.Name);
+ (File_Name_Type (Source_List_File.Value),
+ Project.Directory.Name);
begin
Has_Explicit_Sources := True;
@@ -7041,7 +6925,7 @@ package body Prj.Nmsc is
else
Search_Directories
- (Project, In_Tree, Data,
+ (Project, In_Tree,
For_All_Sources =>
Sources.Default and then Source_List_File.Default);
end if;
@@ -7115,11 +6999,11 @@ package body Prj.Nmsc is
end if;
if Get_Mode = Ada_Only
- and then Data.Extends = No_Project
+ and then Project.Extends = No_Project
then
-- We should have found at least one source, if not report an error
- if not Has_Ada_Sources (Data) then
+ if not Has_Ada_Sources (Project) then
Report_No_Sources
(Project, "Ada", In_Tree, Source_List_File.Location);
end if;
@@ -7154,7 +7038,6 @@ package body Prj.Nmsc is
Explicit_Sources_Only : Boolean;
Proc_Data : in out Processing_Data)
is
- Data : Project_Data renames In_Tree.Projects.Table (Project);
Source_Dir : String_List_Id;
Element : String_Element;
Dir : Dir_Type;
@@ -7167,7 +7050,7 @@ package body Prj.Nmsc is
Write_Line ("Looking for Ada sources:");
end if;
- Ada_Language := Data.Languages;
+ Ada_Language := Project.Languages;
while Ada_Language /= No_Language_Index
and then Ada_Language.Name /= Name_Ada
loop
@@ -7177,7 +7060,7 @@ package body Prj.Nmsc is
-- We look in all source directories for the file names in the hash
-- table Source_Names.
- Source_Dir := Data.Source_Dirs;
+ Source_Dir := Project.Source_Dirs;
while Source_Dir /= Nil_String loop
Dir_Has_Source := False;
Element := In_Tree.String_Elements.Table (Source_Dir);
@@ -7300,11 +7183,10 @@ package body Prj.Nmsc is
procedure Check_File_Naming_Schemes
(In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
+ Project : Project_Id;
File_Name : File_Name_Type;
Alternate_Languages : out Language_List;
Language : out Language_Ptr;
- Language_Name : out Name_Id;
Display_Language_Name : out Name_Id;
Unit : out Name_Id;
Lang_Kind : out Language_Kind;
@@ -7328,7 +7210,7 @@ package body Prj.Nmsc is
-- Returns True if the file belongs to the current language and we
-- should stop searching for matching languages. Not that a given header
-- file could belong to several languages (C and C++ for instance). Thus
- -- if we found a header we'll check whether it matches other languages
+ -- if we found a header we'll check whether it matches other languages.
---------------------------
-- Check_File_Based_Lang --
@@ -7378,14 +7260,12 @@ package body Prj.Nmsc is
Lang_Kind := File_Based;
Kind := Spec;
- Tmp_Lang := Data.Languages;
+ Tmp_Lang := Project.Languages;
while Tmp_Lang /= No_Language_Index loop
- Language_Name := Tmp_Lang.Name;
-
if Current_Verbosity = High then
Write_Line
(" Testing language "
- & Get_Name_String (Language_Name)
+ & Get_Name_String (Tmp_Lang.Name)
& " Header_File=" & Header_File'Img);
end if;
@@ -7439,7 +7319,6 @@ package body Prj.Nmsc is
procedure Check_File
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Path : Path_Name_Type;
File_Name : File_Name_Type;
Display_File_Name : File_Name_Type;
@@ -7459,7 +7338,6 @@ package body Prj.Nmsc is
Src_Ind : Source_File_Index;
Unit : Name_Id;
Source_To_Replace : Source_Id := No_Source;
- Language_Name : Name_Id;
Display_Language_Name : Name_Id;
Lang_Kind : Language_Kind;
Kind : Source_Kind := Spec;
@@ -7475,7 +7353,7 @@ package body Prj.Nmsc is
-- Check if it is OK to have the same file name in several
-- source directories.
- if not Data.Known_Order_Of_Source_Dirs then
+ if not Project.Known_Order_Of_Source_Dirs then
Error_Msg_File_1 := File_Name;
Error_Msg
(Project, In_Tree,
@@ -7520,11 +7398,10 @@ package body Prj.Nmsc is
Check_File_Naming_Schemes
(In_Tree => In_Tree,
- Data => Data,
+ Project => Project,
File_Name => File_Name,
Alternate_Languages => Alternate_Languages,
Language => Language,
- Language_Name => Language_Name,
Display_Language_Name => Display_Language_Name,
Unit => Unit,
Lang_Kind => Lang_Kind,
@@ -7576,7 +7453,7 @@ package body Prj.Nmsc is
-- allowed if order of source directories is known.
if Project = Source.Project then
- if Data.Known_Order_Of_Source_Dirs then
+ if Project.Known_Order_Of_Source_Dirs then
Add_Src := False;
elsif Unit /= No_Name then
@@ -7601,7 +7478,7 @@ package body Prj.Nmsc is
-- a file in a project being extended, but it is allowed
-- to have the same file name in unrelated projects.
- elsif Is_Extending (Project, Source.Project, In_Tree) then
+ elsif Is_Extending (Project, Source.Project) then
Source_To_Replace := Source;
elsif Unit /= No_Name
@@ -7613,14 +7490,12 @@ package body Prj.Nmsc is
"unit %% cannot belong to several projects",
No_Location);
- Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Project).Name;
+ Error_Msg_Name_1 := Project.Name;
Error_Msg_Name_2 := Name_Id (Path);
Error_Msg
(Project, In_Tree, "\ project %%, %%", No_Location);
- Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Source.Project).Name;
+ Error_Msg_Name_1 := Source.Project.Name;
Error_Msg_Name_2 := Name_Id (Source.Path.Display_Name);
Error_Msg
(Project, In_Tree, "\ project %%, %%", No_Location);
@@ -7659,7 +7534,6 @@ package body Prj.Nmsc is
procedure Search_Directories
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
For_All_Sources : Boolean)
is
Source_Dir : String_List_Id;
@@ -7677,7 +7551,7 @@ package body Prj.Nmsc is
-- Loop through subdirectories
- Source_Dir := Data.Source_Dirs;
+ Source_Dir := Project.Source_Dirs;
while Source_Dir /= Nil_String loop
begin
Element := In_Tree.String_Elements.Table (Source_Dir);
@@ -7765,7 +7639,6 @@ package body Prj.Nmsc is
Check_File
(Project => Project,
In_Tree => In_Tree,
- Data => Data,
Path => Path,
File_Name => File_Name,
Display_File_Name => Display_File_Name,
@@ -7867,7 +7740,6 @@ package body Prj.Nmsc is
procedure Look_For_Sources
(Project : Project_Id;
In_Tree : Project_Tree_Ref;
- Data : in out Project_Data;
Proc_Data : in out Processing_Data)
is
Iter : Source_Iterator;
@@ -7908,7 +7780,7 @@ package body Prj.Nmsc is
is
begin
if Extended = Project
- or else Is_Extending (Project, Extended, In_Tree)
+ or else Is_Extending (Project, Extended)
then
OK := True;
@@ -7950,7 +7822,7 @@ package body Prj.Nmsc is
-- ??? This loop could be the same as for Multi_Language if
-- we were setting In_Tree.First_Source when we search for
-- Ada sources (basically once we have removed the use of
- -- Data.Ada_Sources).
+ -- Project.Ada_Sources).
For_Each_Unit :
for Index in Unit_Table.First ..
@@ -8044,7 +7916,7 @@ package body Prj.Nmsc is
exit when Src_Id = No_Source;
if Src_Id.Compiled and then Src_Id.Object_Exists
- and then Is_Extending (Project, Src_Id.Project, In_Tree)
+ and then Is_Extending (Project, Src_Id.Project)
then
if Src_Id.Unit = No_Name then
if Src_Id.Kind = Impl then
@@ -8096,17 +7968,17 @@ package body Prj.Nmsc is
begin
Source_Names.Reset;
- Find_Excluded_Sources (Project, In_Tree, Data);
+ Find_Excluded_Sources (Project, In_Tree);
- if (Get_Mode = Ada_Only and then Is_A_Language (Data, Name_Ada))
+ if (Get_Mode = Ada_Only and then Is_A_Language (Project, Name_Ada))
or else (Get_Mode = Multi_Language
- and then Data.Languages /= No_Language_Index)
+ and then Project.Languages /= No_Language_Index)
then
if Get_Mode = Multi_Language then
Load_Naming_Exceptions (Project, In_Tree);
end if;
- Find_Sources (Project, In_Tree, Data, Proc_Data);
+ Find_Sources (Project, In_Tree, Proc_Data);
Mark_Excluded_Sources;
if Get_Mode = Multi_Language then
@@ -8201,7 +8073,6 @@ package body Prj.Nmsc is
Location : Source_Ptr;
Source_Recorded : in out Boolean)
is
- Data : Project_Data renames In_Tree.Projects.Table (Project);
Canonical_File : File_Name_Type;
Canonical_Path : Path_Name_Type;
@@ -8254,9 +8125,7 @@ package body Prj.Nmsc is
and then UData.File_Names (Unit_Kind).Path.Name = Slash)
or else UData.File_Names (Unit_Kind).Name = No_File
or else Is_Extending
- (Data.Extends,
- UData.File_Names (Unit_Kind).Project,
- In_Tree)
+ (Project.Extends, UData.File_Names (Unit_Kind).Project)
then
if UData.File_Names (Unit_Kind).Path.Name = Slash then
Remove_Forbidden_File_Name
@@ -8282,7 +8151,7 @@ package body Prj.Nmsc is
elsif UData.File_Names (Unit_Kind).Project = Project
and then
- (Data.Known_Order_Of_Source_Dirs
+ (Project.Known_Order_Of_Source_Dirs
or else
UData.File_Names (Unit_Kind).Path.Name = Canonical_Path)
then
@@ -8293,7 +8162,7 @@ package body Prj.Nmsc is
else
if The_Location = No_Location then
- The_Location := In_Tree.Projects.Table (Project).Location;
+ The_Location := Project.Location;
end if;
Err_Vars.Error_Msg_Name_1 := Unit_Name;
@@ -8301,16 +8170,14 @@ package body Prj.Nmsc is
(Project, In_Tree, "duplicate unit %%", The_Location);
Err_Vars.Error_Msg_Name_1 :=
- In_Tree.Projects.Table
- (UData.File_Names (Unit_Kind).Project).Name;
+ UData.File_Names (Unit_Kind).Project.Name;
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (UData.File_Names (Unit_Kind).Path.Name);
Error_Msg
(Project, In_Tree,
"\ project file %%, {", The_Location);
- Err_Vars.Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Project).Name;
+ Err_Vars.Error_Msg_Name_1 := Project.Name;
Err_Vars.Error_Msg_File_1 := File_Name_Type (Canonical_Path);
Error_Msg
(Project, In_Tree, "\ project file %%, {", The_Location);
@@ -8331,7 +8198,7 @@ package body Prj.Nmsc is
and then Unit_Prj /= No_Project
then
Error_Msg_File_1 := File_Name;
- Error_Msg_Name_1 := In_Tree.Projects.Table (Unit_Prj).Name;
+ Error_Msg_Name_1 := Unit_Prj.Name;
Error_Msg
(Project, In_Tree,
"{ is already a source of project %%",
@@ -8399,7 +8266,7 @@ package body Prj.Nmsc is
Get_Unit
(In_Tree => In_Tree,
Canonical_File_Name => Canonical_File,
- Naming => Data.Naming,
+ Naming => Project.Naming,
Exception_Id => Exception_Id,
Unit_Name => Unit_Name,
Unit_Kind => Unit_Kind);
@@ -8540,7 +8407,7 @@ package body Prj.Nmsc is
----------------------
procedure Show_Source_Dirs
- (Data : Project_Data;
+ (Project : Project_Id;
In_Tree : Project_Tree_Ref)
is
Current : String_List_Id;
@@ -8549,7 +8416,7 @@ package body Prj.Nmsc is
begin
Write_Line ("Source_Dirs:");
- Current := Data.Source_Dirs;
+ Current := Project.Source_Dirs;
while Current /= Nil_String loop
Element := In_Tree.String_Elements.Table (Current);
Write_Str (" ");
@@ -8601,7 +8468,7 @@ package body Prj.Nmsc is
if Specs then
if not Check_Project
(The_Unit_Data.File_Names (Specification).Project,
- Project, In_Tree, Extending)
+ Project, Extending)
then
Error_Msg
(Project, In_Tree,
@@ -8613,7 +8480,7 @@ package body Prj.Nmsc is
else
if not Check_Project
(The_Unit_Data.File_Names (Body_Part).Project,
- Project, In_Tree, Extending)
+ Project, Extending)
then
Error_Msg
(Project, In_Tree,
diff --git a/gcc/ada/prj-nmsc.ads b/gcc/ada/prj-nmsc.ads
index 88b88702aae..4c0db4edf71 100644
--- a/gcc/ada/prj-nmsc.ads
+++ b/gcc/ada/prj-nmsc.ads
@@ -46,21 +46,20 @@ private package Prj.Nmsc is
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning;
Current_Dir : String;
- Proc_Data : in out Processing_Data);
+ Proc_Data : in out Processing_Data;
+ Is_Config_File : Boolean);
-- Perform consistency and semantic checks on a project, starting from the
-- project tree parsed from the .gpr file. This procedure interprets the
-- various case statements in the project based on the current environment
- -- variables (the "scenario").
- -- After checking the validity of the naming scheme, it searches for all
- -- the source files of the project.
- -- The result of this procedure is a filled data structure for Project_Id
- -- which contains all the information about the project. This information
- -- is only valid while the scenario variables are preserved.
- -- If the current mode is Ada_Only, this procedure will only search Ada
- -- sources; but in multi_language mode it will look for sources for all the
- -- supported languages.
+ -- variables (the "scenario"). After checking the validity of the naming
+ -- scheme, it searches for all the source files of the project. The result
+ -- of this procedure is a filled-in data structure for Project_Id which
+ -- contains all the information about the project. This information is only
+ -- valid while the scenario variables are preserved. If the current mode
+ -- is Ada_Only, this procedure will only search Ada sources, but in multi-
+ -- language mode it will look for sources for all supported languages.
--
- -- If Report_Error is null , use the standard error reporting mechanism
+ -- If Report_Error is null, use the standard error reporting mechanism
-- (Errout). Otherwise, report errors using Report_Error.
--
-- Current_Dir is for optimization purposes only, avoiding system calls to
@@ -68,6 +67,8 @@ private package Prj.Nmsc is
--
-- When_No_Sources indicates what should be done when no sources of a
-- language are found in a project where this language is declared.
+ --
+ -- Is_Config_File should be True if Project is config file (.cgpr)
private
type Processing_Data is record
diff --git a/gcc/ada/prj-pars.adb b/gcc/ada/prj-pars.adb
index 0cdd9ad3604..92010bf7cfa 100644
--- a/gcc/ada/prj-pars.adb
+++ b/gcc/ada/prj-pars.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -45,16 +45,18 @@ package body Prj.Pars is
Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error;
- Reset_Tree : Boolean := True)
+ Report_Error : Put_Line_Access := null;
+ Reset_Tree : Boolean := True;
+ Is_Config_File : Boolean := False)
is
- Project_Node_Tree : constant Project_Node_Tree_Ref :=
- new Project_Node_Tree_Data;
Project_Node : Project_Node_Id := Empty_Node;
The_Project : Project_Id := No_Project;
Success : Boolean := True;
Current_Dir : constant String := Get_Current_Dir;
+ Project_Node_Tree : Prj.Tree.Project_Node_Tree_Ref;
begin
+ Project_Node_Tree := new Project_Node_Tree_Data;
Prj.Tree.Initialize (Project_Node_Tree);
-- Parse the main project file into a tree
@@ -66,21 +68,24 @@ package body Prj.Pars is
Project_File_Name => Project_File_Name,
Always_Errout_Finalize => False,
Packages_To_Check => Packages_To_Check,
- Current_Directory => Current_Dir);
+ Current_Directory => Current_Dir,
+ Is_Config_File => Is_Config_File);
-- If there were no error, process the tree
- if Present (Project_Node) then
+ if Project_Node /= Empty_Node then
Prj.Proc.Process
(In_Tree => In_Tree,
Project => The_Project,
Success => Success,
From_Project_Node => Project_Node,
From_Project_Node_Tree => Project_Node_Tree,
- Report_Error => null,
- When_No_Sources => When_No_Sources,
+ Report_Error => Report_Error,
Reset_Tree => Reset_Tree,
- Current_Dir => Current_Dir);
+ When_No_Sources => When_No_Sources,
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
+
Prj.Err.Finalize;
if not Success then
@@ -90,6 +95,8 @@ package body Prj.Pars is
Project := The_Project;
+ -- ??? Should free the project_node_tree, no longer useful
+
exception
when X : others =>
diff --git a/gcc/ada/prj-pars.ads b/gcc/ada/prj-pars.ads
index 8c22ba48141..2c439ad115f 100644
--- a/gcc/ada/prj-pars.ads
+++ b/gcc/ada/prj-pars.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -23,7 +23,7 @@
-- --
------------------------------------------------------------------------------
--- Implements the parsing of project files
+-- General wrapper for the parsing of project files
package Prj.Pars is
@@ -36,22 +36,34 @@ package Prj.Pars is
Project_File_Name : String;
Packages_To_Check : String_List_Access := All_Packages;
When_No_Sources : Error_Warning := Error;
- Reset_Tree : Boolean := True);
- -- Parse a project files and all its imported project files, in the
- -- project tree In_Tree.
+ Report_Error : Prj.Put_Line_Access := null;
+ Reset_Tree : Boolean := True;
+ Is_Config_File : Boolean := False);
+ -- Parse and process a project files and all its imported project files, in
+ -- the project tree In_Tree.
+ -- All the project files are parsed (through Prj.Tree) to create a tree in
+ -- memory. That tree is then processed (through Prj.Proc) to create a
+ -- expanded representation of the tree based on the current scenario
+ -- variables. This function is only a convenient wrapper over other
+ -- services provided in the Prj.* package hierarchy.
--
- -- If parsing is successful, Project_Id is the project ID
- -- of the main project file; otherwise, Project_Id is set
- -- to No_Project.
+ -- If parsing is successful, Project is the project ID of the root project
+ -- file; otherwise, Project_Id is set to No_Project. Project_Node_Tree is
+ -- set to the tree (unprocessed) representation of the project file. This
+ -- tree is permanently correct, whereas Project will need to be recomputed
+ -- if the scenario variables change.
--
-- Packages_To_Check indicates the packages where any unknown attribute
- -- produces an error. For other packages, an unknown attribute produces
- -- a warning.
+ -- produces an error. For other packages, an unknown attribute produces a
+ -- warning.
--
- -- When_No_Sources indicates what should be done when no sources
- -- are found in a project for a specified or implied language.
+ -- When_No_Sources indicates what should be done when no sources are found
+ -- in a project for a specified or implied language.
--
-- When Reset_Tree is True, all the project data are removed from the
-- project table before processing.
+ --
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
end Prj.Pars;
diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb
index 77a98bc1f34..871517cba66 100644
--- a/gcc/ada/prj-part.adb
+++ b/gcc/ada/prj-part.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -164,21 +164,28 @@ package body Prj.Part is
In_Limited : Boolean;
Packages_To_Check : String_List_Access;
Depth : Natural;
- Current_Dir : String);
+ Current_Dir : String;
+ Is_Config_File : Boolean);
-- Parse a project file. This is a recursive procedure: it calls itself for
-- imported and extended projects. When From_Extended is not None, if the
-- project has already been parsed and is an extended project A, return the
-- ultimate (not extended) project that extends A. When In_Limited is True,
-- the importing path includes at least one "limited with". When parsing
-- configuration projects, do not allow a depth > 1.
+ --
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
procedure Pre_Parse_Context_Clause
(In_Tree : Project_Node_Tree_Ref;
- Context_Clause : out With_Id);
+ Context_Clause : out With_Id;
+ Is_Config_File : Boolean);
-- Parse the context clause of a project. Store the paths and locations of
-- the imported projects in table Withs. Does nothing if there is no
-- context clause (if the current token is not "with" or "limited" followed
-- by "with").
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
procedure Post_Parse_Context_Clause
(Context_Clause : With_Id;
@@ -190,13 +197,16 @@ package body Prj.Part is
In_Limited : Boolean;
Packages_To_Check : String_List_Access;
Depth : Natural;
- Current_Dir : String);
+ Current_Dir : String;
+ Is_Config_File : Boolean);
-- Parse the imported projects that have been stored in table Withs, if
-- any. From_Extended is used for the call to Parse_Single_Project below.
-- When In_Limited is True, the importing path includes at least one
-- "limited with". When Limited_Withs is False, only non limited withed
-- projects are parsed. When Limited_Withs is True, only limited withed
-- projects are parsed.
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
function Project_Path_Name_Of
(Project_File_Name : String;
@@ -210,7 +220,9 @@ package body Prj.Part is
-- This includes the directory separator as the last character.
-- Returns "./" if Path_Name contains no directory separator.
- function Project_Name_From (Path_Name : String) return Name_Id;
+ function Project_Name_From
+ (Path_Name : String;
+ Is_Config_File : Boolean) return Name_Id;
-- Returns the name of the project that corresponds to its path name.
-- Returns No_Name if the path name is invalid, because the corresponding
-- project name does not have the syntax of an ada identifier.
@@ -475,7 +487,8 @@ package body Prj.Part is
Always_Errout_Finalize : Boolean;
Packages_To_Check : String_List_Access := All_Packages;
Store_Comments : Boolean := False;
- Current_Directory : String := "")
+ Current_Directory : String := "";
+ Is_Config_File : Boolean)
is
Dummy : Boolean;
pragma Warnings (Off, Dummy);
@@ -533,7 +546,8 @@ package body Prj.Part is
In_Limited => False,
Packages_To_Check => Packages_To_Check,
Depth => 0,
- Current_Dir => Current_Directory);
+ Current_Dir => Current_Directory,
+ Is_Config_File => Is_Config_File);
-- If Project is an extending-all project, create the eventual
-- virtual extending projects and check that there are no illegally
@@ -642,7 +656,8 @@ package body Prj.Part is
procedure Pre_Parse_Context_Clause
(In_Tree : Project_Node_Tree_Ref;
- Context_Clause : out With_Id)
+ Context_Clause : out With_Id;
+ Is_Config_File : Boolean)
is
Current_With_Clause : With_Id := No_With;
Limited_With : Boolean := False;
@@ -663,7 +678,7 @@ package body Prj.Part is
Default_Project_Node (Of_Kind => N_With_Clause, In_Tree => In_Tree);
Limited_With := Token = Tok_Limited;
- if In_Configuration then
+ if Is_Config_File then
Error_Msg
("configuration project cannot import " &
"other configuration projects",
@@ -747,7 +762,8 @@ package body Prj.Part is
In_Limited : Boolean;
Packages_To_Check : String_List_Access;
Depth : Natural;
- Current_Dir : String)
+ Current_Dir : String;
+ Is_Config_File : Boolean)
is
Current_With_Clause : With_Id := Context_Clause;
@@ -886,7 +902,8 @@ package body Prj.Part is
In_Limited => Limited_Withs,
Packages_To_Check => Packages_To_Check,
Depth => Depth,
- Current_Dir => Current_Dir);
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
else
Extends_All := Is_Extending_All (Withed_Project, In_Tree);
@@ -947,7 +964,8 @@ package body Prj.Part is
In_Limited : Boolean;
Packages_To_Check : String_List_Access;
Depth : Natural;
- Current_Dir : String)
+ Current_Dir : String;
+ Is_Config_File : Boolean)
is
Normed_Path_Name : Path_Name_Type;
Canonical_Path_Name : Path_Name_Type;
@@ -963,7 +981,8 @@ package body Prj.Part is
Tree_Private_Part.Projects_Htable.Get_First
(In_Tree.Projects_HT);
- Name_From_Path : constant Name_Id := Project_Name_From (Path_Name);
+ Name_From_Path : constant Name_Id :=
+ Project_Name_From (Path_Name, Is_Config_File => Is_Config_File);
Name_Of_Project : Name_Id := No_Name;
Duplicated : Boolean := False;
@@ -1077,14 +1096,21 @@ package body Prj.Part is
(A_Project_Name_And_Node.Node, In_Tree);
Prj : Project_Node_Id :=
- Extending_Project_Of (Decl, In_Tree);
+ A_Project_Name_And_Node.Node;
begin
+ -- Loop through extending projects to find the ultimate
+ -- extending project, that is the one that is not
+ -- extended. For an abstract project, as it can be
+ -- extended several times, there is no extending project
+ -- registered, so the loop does not execute and the
+ -- resulting project is the abstract project.
+
+ while
+ Extending_Project_Of (Decl, In_Tree) /= Empty_Node
loop
- Decl := Project_Declaration_Of (Prj, In_Tree);
- exit when Extending_Project_Of (Decl, In_Tree) =
- Empty_Node;
Prj := Extending_Project_Of (Decl, In_Tree);
+ Decl := Project_Declaration_Of (Prj, In_Tree);
end loop;
A_Project_Name_And_Node.Node := Prj;
@@ -1124,7 +1150,7 @@ package body Prj.Part is
Tree.Reset_State;
Scan (In_Tree);
- if not In_Configuration and then Name_From_Path = No_Name then
+ if not Is_Config_File and then Name_From_Path = No_Name then
-- The project file name is not correct (no or bad extension, or not
-- following Ada identifier's syntax).
@@ -1147,6 +1173,7 @@ package body Prj.Part is
Pre_Parse_Context_Clause
(In_Tree => In_Tree,
+ Is_Config_File => Is_Config_File,
Context_Clause => First_With);
Project := Default_Project_Node
@@ -1185,7 +1212,7 @@ package body Prj.Part is
Scan (In_Tree);
when Snames.Name_Configuration =>
- if not In_Configuration then
+ if not Is_Config_File then
Error_Msg ("configuration projects cannot belong to a user" &
" project tree",
Token_Ptr);
@@ -1199,7 +1226,7 @@ package body Prj.Part is
end if;
if Proj_Qualifier /= Unspecified then
- if In_Configuration then
+ if Is_Config_File then
Error_Msg ("a configuration project cannot be qualified except " &
"as configuration project",
Qualifier_Location);
@@ -1257,7 +1284,7 @@ package body Prj.Part is
if Token = Tok_Extends then
- if In_Configuration then
+ if Is_Config_File then
Error_Msg
("extending configuration project not allowed", Token_Ptr);
end if;
@@ -1310,13 +1337,13 @@ package body Prj.Part is
begin
-- Output a warning if the actual name is not the expected name
- if not In_Configuration
+ if not Is_Config_File
and then (Name_From_Path /= No_Name)
and then Expected_Name /= Name_From_Path
then
Error_Msg_Name_1 := Expected_Name;
- if In_Configuration then
+ if Is_Config_File then
Extension := new String'(Config_Project_File_Extension);
else
@@ -1355,11 +1382,12 @@ package body Prj.Part is
In_Limited => In_Limited,
Packages_To_Check => Packages_To_Check,
Depth => Depth + 1,
- Current_Dir => Current_Dir);
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
Set_First_With_Clause_Of (Project, In_Tree, Imported_Projects);
end;
- if not In_Configuration then
+ if not Is_Config_File then
declare
Name_And_Node : Tree_Private_Part.Project_Name_And_Node :=
Tree_Private_Part.Projects_Htable.Get_First
@@ -1460,7 +1488,8 @@ package body Prj.Part is
In_Limited => In_Limited,
Packages_To_Check => Packages_To_Check,
Depth => Depth + 1,
- Current_Dir => Current_Dir);
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
end;
if Present (Extended_Project) then
@@ -1596,7 +1625,8 @@ package body Prj.Part is
Declarations => Project_Declaration,
Current_Project => Project,
Extends => Extended_Project,
- Packages_To_Check => Packages_To_Check);
+ Packages_To_Check => Packages_To_Check,
+ Is_Config_File => Is_Config_File);
Set_Project_Declaration_Of (Project, In_Tree, Project_Declaration);
if Present (Extended_Project)
@@ -1717,7 +1747,8 @@ package body Prj.Part is
In_Limited => In_Limited,
Packages_To_Check => Packages_To_Check,
Depth => Depth + 1,
- Current_Dir => Current_Dir);
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
Set_First_With_Clause_Of (Project, In_Tree, Imported_Projects);
end;
@@ -1745,7 +1776,10 @@ package body Prj.Part is
-- Project_Name_From --
-----------------------
- function Project_Name_From (Path_Name : String) return Name_Id is
+ function Project_Name_From
+ (Path_Name : String;
+ Is_Config_File : Boolean) return Name_Id
+ is
Canonical : String (1 .. Path_Name'Length) := Path_Name;
First : Natural := Canonical'Last;
Last : Natural := First;
@@ -1778,11 +1812,11 @@ package body Prj.Part is
-- If we have a dot, check that it is followed by the correct extension
if First > 0 and then Canonical (First) = '.' then
- if (not In_Configuration
+ if (not Is_Config_File
and then Canonical (First .. Last) = Project_File_Extension
and then First /= 1)
or else
- (In_Configuration
+ (Is_Config_File
and then
Canonical (First .. Last) = Config_Project_File_Extension
and then First /= 1)
diff --git a/gcc/ada/prj-part.ads b/gcc/ada/prj-part.ads
index e1c69c5ab83..3906ad7cb61 100644
--- a/gcc/ada/prj-part.ads
+++ b/gcc/ada/prj-part.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2000-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2000-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,7 +36,8 @@ package Prj.Part is
Always_Errout_Finalize : Boolean;
Packages_To_Check : String_List_Access := All_Packages;
Store_Comments : Boolean := False;
- Current_Directory : String := "");
+ Current_Directory : String := "";
+ Is_Config_File : Boolean);
-- Parse project file and all its imported project files and create a tree.
-- Return the node for the project (or Empty_Node if parsing failed). If
-- Always_Errout_Finalize is True, Errout.Finalize is called in all cases,
@@ -48,5 +49,8 @@ package Prj.Part is
--
-- Current_Directory is used for optimization purposes only, avoiding extra
-- system calls.
+ --
+ -- Is_Config_File should be set to True if the project represents a config
+ -- file (.cgpr) since some specific checks apply.
end Prj.Part;
diff --git a/gcc/ada/prj-pp.adb b/gcc/ada/prj-pp.adb
index 717a769c531..5ddafbc7799 100644
--- a/gcc/ada/prj-pp.adb
+++ b/gcc/ada/prj-pp.adb
@@ -74,8 +74,7 @@ package body Prj.PP is
W_Eol : Write_Eol_Ap := null;
W_Str : Write_Str_Ap := null;
Backward_Compatibility : Boolean;
- Id : Prj.Project_Id := Prj.No_Project;
- Id_Tree : Prj.Project_Tree_Ref := null)
+ Id : Prj.Project_Id := Prj.No_Project)
is
procedure Print (Node : Project_Node_Id; Indent : Natural);
-- A recursive procedure that traverses a project file tree and outputs
@@ -339,7 +338,7 @@ package body Prj.PP is
Write_String ("project ");
if Id /= Prj.No_Project then
- Output_Name (Id_Tree.Projects.Table (Id).Display_Name);
+ Output_Name (Id.Display_Name);
else
Output_Name (Name_Of (Node, In_Tree));
end if;
@@ -372,7 +371,7 @@ package body Prj.PP is
Write_String ("end ");
if Id /= Prj.No_Project then
- Output_Name (Id_Tree.Projects.Table (Id).Display_Name);
+ Output_Name (Id.Display_Name);
else
Output_Name (Name_Of (Node, In_Tree));
end if;
diff --git a/gcc/ada/prj-pp.ads b/gcc/ada/prj-pp.ads
index 7d599f406d8..ac6c03db326 100644
--- a/gcc/ada/prj-pp.ads
+++ b/gcc/ada/prj-pp.ads
@@ -53,8 +53,7 @@ package Prj.PP is
W_Eol : Write_Eol_Ap := null;
W_Str : Write_Str_Ap := null;
Backward_Compatibility : Boolean;
- Id : Prj.Project_Id := Prj.No_Project;
- Id_Tree : Prj.Project_Tree_Ref := null);
+ Id : Prj.Project_Id := Prj.No_Project);
-- Output a project file, using either the default output routines, or the
-- ones specified by W_Char, W_Eol and W_Str.
--
diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb
index a10d7fe7235..31efd8199a2 100644
--- a/gcc/ada/prj-proc.adb
+++ b/gcc/ada/prj-proc.adb
@@ -82,10 +82,12 @@ package body Prj.Proc is
(In_Tree : Project_Tree_Ref;
Project : Project_Id;
Current_Dir : String;
- When_No_Sources : Error_Warning);
+ When_No_Sources : Error_Warning;
+ Is_Config_File : Boolean);
-- Set all projects to not checked, then call Recursive_Check for the
-- main project Project. Project is set to No_Project if errors occurred.
-- Current_Dir is for optimization purposes, avoiding extra system calls.
+ -- Is_Config_File should be True if Project is a config file (.cgpr).
procedure Copy_Package_Declarations
(From : Declarations;
@@ -111,7 +113,6 @@ package body Prj.Proc is
function Imported_Or_Extended_Project_From
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
With_Name : Name_Id) return Project_Id;
-- Find an imported or extended project of Project whose name is With_Name
@@ -150,6 +151,7 @@ package body Prj.Proc is
Current_Dir : String_Access;
When_No_Sources : Error_Warning;
Proc_Data : Processing_Data;
+ Is_Config_File : Boolean;
end record;
-- Data passed to Recursive_Check
-- Current_Dir is for optimization purposes, avoiding extra system calls.
@@ -280,7 +282,8 @@ package body Prj.Proc is
(In_Tree : Project_Tree_Ref;
Project : Project_Id;
Current_Dir : String;
- When_No_Sources : Error_Warning)
+ When_No_Sources : Error_Warning;
+ Is_Config_File : Boolean)
is
Dir : aliased String := Current_Dir;
@@ -293,9 +296,10 @@ package body Prj.Proc is
Data.In_Tree := In_Tree;
Data.Current_Dir := Dir'Unchecked_Access;
Data.When_No_Sources := When_No_Sources;
+ Data.Is_Config_File := Is_Config_File;
Initialize (Data.Proc_Data);
- Check_All_Projects (Project, In_Tree, Data, Imported_First => True);
+ Check_All_Projects (Project, Data, Imported_First => True);
-- Set the Other_Part field for the units
@@ -683,7 +687,6 @@ package body Prj.Proc is
Name_Of (Term_Project, From_Project_Node_Tree);
The_Project := Imported_Or_Extended_Project_From
(Project => Project,
- In_Tree => In_Tree,
With_Name => The_Name);
end if;
@@ -693,8 +696,7 @@ package body Prj.Proc is
The_Name :=
Name_Of (Term_Package, From_Project_Node_Tree);
- The_Package := In_Tree.Projects.Table
- (The_Project).Decl.Packages;
+ The_Package := The_Project.Decl.Packages;
while The_Package /= No_Package
and then In_Tree.Packages.Table
@@ -767,13 +769,9 @@ package body Prj.Proc is
if Kind_Of (The_Current_Term, From_Project_Node_Tree) =
N_Variable_Reference
then
- The_Variable_Id :=
- In_Tree.Projects.Table
- (The_Project).Decl.Variables;
+ The_Variable_Id := The_Project.Decl.Variables;
else
- The_Variable_Id :=
- In_Tree.Projects.Table
- (The_Project).Decl.Attributes;
+ The_Variable_Id := The_Project.Decl.Attributes;
end if;
while The_Variable_Id /= No_Variable
@@ -811,9 +809,7 @@ package body Prj.Proc is
In_Tree.Packages.Table
(The_Package).Decl.Arrays;
else
- The_Array :=
- In_Tree.Projects.Table
- (The_Project).Decl.Arrays;
+ The_Array := The_Project.Decl.Arrays;
end if;
while The_Array /= No_Array
@@ -1137,10 +1133,8 @@ package body Prj.Proc is
function Imported_Or_Extended_Project_From
(Project : Project_Id;
- In_Tree : Project_Tree_Ref;
With_Name : Name_Id) return Project_Id
is
- Data : constant Project_Data := In_Tree.Projects.Table (Project);
List : Project_List;
Result : Project_Id;
Temp_Result : Project_Id;
@@ -1148,25 +1142,25 @@ package body Prj.Proc is
begin
-- First check if it is the name of an extended project
- Result := Data.Extends;
+ Result := Project.Extends;
while Result /= No_Project loop
- if In_Tree.Projects.Table (Result).Name = With_Name then
+ if Result.Name = With_Name then
return Result;
else
- Result := In_Tree.Projects.Table (Result).Extends;
+ Result := Result.Extends;
end if;
end loop;
-- Then check the name of each imported project
Temp_Result := No_Project;
- List := Data.Imported_Projects;
+ List := Project.Imported_Projects;
while List /= null loop
Result := List.Project;
-- If the project is directly imported, then returns its ID
- if In_Tree.Projects.Table (Result).Name = With_Name then
+ if Result.Name = With_Name then
return Result;
end if;
@@ -1175,16 +1169,17 @@ package body Prj.Proc is
-- if the project is not imported directly.
declare
- Proj : Project_Id := In_Tree.Projects.Table (Result).Extends;
+ Proj : Project_Id;
begin
+ Proj := Result.Extends;
while Proj /= No_Project loop
- if In_Tree.Projects.Table (Proj).Name = With_Name then
+ if Proj.Name = With_Name then
Temp_Result := Result;
exit;
end if;
- Proj := In_Tree.Projects.Table (Proj).Extends;
+ Proj := Proj.Extends;
end loop;
end;
@@ -1204,9 +1199,7 @@ package body Prj.Proc is
In_Tree : Project_Tree_Ref;
With_Name : Name_Id) return Package_Id
is
- Data : constant Project_Data :=
- In_Tree.Projects.Table (Project);
- Result : Package_Id := Data.Decl.Packages;
+ Result : Package_Id := Project.Decl.Packages;
begin
-- Check the name of each existing package of Project
@@ -1242,8 +1235,9 @@ package body Prj.Proc is
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
- Reset_Tree : Boolean := True;
- Current_Dir : String := "")
+ Reset_Tree : Boolean := True;
+ Current_Dir : String := "";
+ Is_Config_File : Boolean)
is
begin
Process_Project_Tree_Phase_1
@@ -1255,7 +1249,7 @@ package body Prj.Proc is
Report_Error => Report_Error,
Reset_Tree => Reset_Tree);
- if not In_Configuration then
+ if not Is_Config_File then
Process_Project_Tree_Phase_2
(In_Tree => In_Tree,
Project => Project,
@@ -1264,7 +1258,8 @@ package body Prj.Proc is
From_Project_Node_Tree => From_Project_Node_Tree,
Report_Error => Report_Error,
When_No_Sources => When_No_Sources,
- Current_Dir => Current_Dir);
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
end if;
end Process;
@@ -1342,10 +1337,8 @@ package body Prj.Proc is
New_Pkg;
else
- The_New_Package.Next :=
- In_Tree.Projects.Table (Project).Decl.Packages;
- In_Tree.Projects.Table (Project).Decl.Packages :=
- New_Pkg;
+ The_New_Package.Next := Project.Decl.Packages;
+ Project.Decl.Packages := New_Pkg;
end if;
In_Tree.Packages.Table (New_Pkg) :=
@@ -1364,7 +1357,7 @@ package body Prj.Proc is
Renamed_Project :
constant Project_Id :=
Imported_Or_Extended_Project_From
- (Project, In_Tree, Project_Name);
+ (Project, Project_Name);
Renamed_Package : constant Package_Id :=
Package_From
@@ -1398,9 +1391,8 @@ package body Prj.Proc is
Add_Attributes
(Project,
- In_Tree.Projects.Table (Project).Name,
- Name_Id
- (In_Tree.Projects.Table (Project).Directory.Name),
+ Project.Name,
+ Name_Id (Project.Directory.Name),
In_Tree,
In_Tree.Packages.Table (New_Pkg).Decl,
First_Attribute_Of
@@ -1488,6 +1480,8 @@ package body Prj.Proc is
-- associative array attribute may already have been
-- declared, and the array elements declared are reused.
+ Prj : Project_List;
+
begin
-- First find if the associative array attribute already
-- has elements declared.
@@ -1497,8 +1491,7 @@ package body Prj.Proc is
(Pkg).Decl.Arrays;
else
- New_Array := In_Tree.Projects.Table
- (Project).Decl.Arrays;
+ New_Array := Project.Decl.Arrays;
end if;
while New_Array /= No_Array
@@ -1531,11 +1524,9 @@ package body Prj.Proc is
(Name => Current_Item_Name,
Location => Current_Location,
Value => No_Array_Element,
- Next => In_Tree.Projects.Table
- (Project).Decl.Arrays);
+ Next => Project.Decl.Arrays);
- In_Tree.Projects.Table (Project).Decl.Arrays :=
- New_Array;
+ Project.Decl.Arrays := New_Array;
end if;
end if;
@@ -1547,16 +1538,13 @@ package body Prj.Proc is
(Current_Item, From_Project_Node_Tree),
From_Project_Node_Tree);
- for Index in Project_Table.First ..
- Project_Table.Last
- (In_Tree.Projects)
- loop
- if In_Tree.Projects.Table (Index).Name =
- Orig_Project_Name
- then
- Orig_Project := Index;
+ Prj := In_Tree.Projects;
+ while Prj /= null loop
+ if Prj.Project.Name = Orig_Project_Name then
+ Orig_Project := Prj.Project;
exit;
end if;
+ Prj := Prj.Next;
end loop;
pragma Assert (Orig_Project /= No_Project,
@@ -1565,9 +1553,7 @@ package body Prj.Proc is
if No (Associative_Package_Of
(Current_Item, From_Project_Node_Tree))
then
- Orig_Array :=
- In_Tree.Projects.Table
- (Orig_Project).Decl.Arrays;
+ Orig_Array := Orig_Project.Decl.Arrays;
else
-- If in a package, find the package where the value
@@ -1579,9 +1565,7 @@ package body Prj.Proc is
(Current_Item, From_Project_Node_Tree),
From_Project_Node_Tree);
- Orig_Package :=
- In_Tree.Projects.Table
- (Orig_Project).Decl.Packages;
+ Orig_Package := Orig_Project.Decl.Packages;
pragma Assert (Orig_Package /= No_Package,
"original package not found");
@@ -1595,8 +1579,7 @@ package body Prj.Proc is
end loop;
Orig_Array :=
- In_Tree.Packages.Table
- (Orig_Package).Decl.Arrays;
+ In_Tree.Packages.Table (Orig_Package).Decl.Arrays;
end if;
-- Now look for the array
@@ -1848,9 +1831,7 @@ package body Prj.Proc is
In_Tree.Packages.Table
(Pkg).Decl.Attributes;
else
- The_Variable :=
- In_Tree.Projects.Table
- (Project).Decl.Attributes;
+ The_Variable := Project.Decl.Attributes;
end if;
else
@@ -1859,9 +1840,7 @@ package body Prj.Proc is
In_Tree.Packages.Table
(Pkg).Decl.Variables;
else
- The_Variable :=
- In_Tree.Projects.Table
- (Project).Decl.Variables;
+ The_Variable := Project.Decl.Variables;
end if;
end if;
@@ -1911,14 +1890,10 @@ package body Prj.Proc is
else
In_Tree.Variable_Elements.Table (The_Variable) :=
- (Next =>
- In_Tree.Projects.Table
- (Project).Decl.Variables,
+ (Next => Project.Decl.Variables,
Name => Current_Item_Name,
Value => New_Value);
- In_Tree.Projects.Table
- (Project).Decl.Variables :=
- The_Variable;
+ Project.Decl.Variables := The_Variable;
end if;
-- If the variable/attribute has already been
@@ -1986,8 +1961,7 @@ package body Prj.Proc is
In_Tree.Packages.Table (Pkg).Decl.Arrays;
else
- The_Array :=
- In_Tree.Projects.Table (Project).Decl.Arrays;
+ The_Array := Project.Decl.Arrays;
end if;
while
@@ -2025,11 +1999,9 @@ package body Prj.Proc is
(Name => Current_Item_Name,
Location => Current_Location,
Value => No_Array_Element,
- Next => In_Tree.Projects.Table
- (Project).Decl.Arrays);
+ Next => Project.Decl.Arrays);
- In_Tree.Projects.Table
- (Project).Decl.Arrays := The_Array;
+ Project.Decl.Arrays := The_Array;
end if;
-- Otherwise initialize The_Array_Element as the
@@ -2131,8 +2103,7 @@ package body Prj.Proc is
(Variable_Node, From_Project_Node_Tree),
From_Project_Node_Tree);
The_Project :=
- Imported_Or_Extended_Project_From
- (Project, In_Tree, Name);
+ Imported_Or_Extended_Project_From (Project, Name);
end if;
-- If a package were specified for the case variable,
@@ -2178,8 +2149,7 @@ package body Prj.Proc is
No (Package_Node_Of
(Variable_Node, From_Project_Node_Tree))
then
- Var_Id := In_Tree.Projects.Table
- (The_Project).Decl.Variables;
+ Var_Id := The_Project.Decl.Variables;
while Var_Id /= No_Variable
and then
In_Tree.Variable_Elements.Table
@@ -2309,7 +2279,7 @@ package body Prj.Proc is
-- Make sure there are no projects in the data structure
- Project_Table.Set_Last (In_Tree.Projects, No_Project);
+ Free_List (In_Tree.Projects, Free_Project => True);
end if;
Processed_Projects.Reset;
@@ -2342,11 +2312,13 @@ package body Prj.Proc is
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
- Current_Dir : String)
+ Current_Dir : String;
+ Is_Config_File : Boolean)
is
Obj_Dir : Path_Name_Type;
Extending : Project_Id;
Extending2 : Project_Id;
+ Prj : Project_List;
-- Start of processing for Process_Project_Tree_Phase_2
@@ -2355,7 +2327,8 @@ package body Prj.Proc is
Success := True;
if Project /= No_Project then
- Check (In_Tree, Project, Current_Dir, When_No_Sources);
+ Check (In_Tree, Project, Current_Dir, When_No_Sources,
+ Is_Config_File => Is_Config_File);
end if;
-- If main project is an extending all project, set the object
@@ -2368,16 +2341,14 @@ package body Prj.Proc is
then
declare
Object_Dir : constant Path_Name_Type :=
- In_Tree.Projects.Table
- (Project).Object_Directory.Name;
+ Project.Object_Directory.Name;
begin
- for Index in
- Project_Table.First .. Project_Table.Last (In_Tree.Projects)
- loop
- if In_Tree.Projects.Table (Index).Virtual then
- In_Tree.Projects.Table (Index).Object_Directory.Name :=
- Object_Dir;
+ Prj := In_Tree.Projects;
+ while Prj /= null loop
+ if Prj.Project.Virtual then
+ Prj.Project.Object_Directory.Name := Object_Dir;
end if;
+ Prj := Prj.Next;
end loop;
end;
end if;
@@ -2386,13 +2357,12 @@ package body Prj.Proc is
-- the project(s) it extends.
if Project /= No_Project then
- for Proj in
- Project_Table.First .. Project_Table.Last (In_Tree.Projects)
- loop
- Extending := In_Tree.Projects.Table (Proj).Extended_By;
+ Prj := In_Tree.Projects;
+ while Prj /= null loop
+ Extending := Prj.Project.Extended_By;
if Extending /= No_Project then
- Obj_Dir := In_Tree.Projects.Table (Proj).Object_Directory.Name;
+ Obj_Dir := Prj.Project.Object_Directory.Name;
-- Check that a project being extended does not share its
-- object directory with any project that extends it, directly
@@ -2402,20 +2372,17 @@ package body Prj.Proc is
Extending2 := Extending;
while Extending2 /= No_Project loop
- if Has_Ada_Sources (In_Tree.Projects.Table (Extending2))
- and then
- In_Tree.Projects.Table
- (Extending2).Object_Directory.Name = Obj_Dir
+ if Has_Ada_Sources (Extending2)
+ and then Extending2.Object_Directory.Name = Obj_Dir
then
- if In_Tree.Projects.Table (Extending2).Virtual then
- Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Proj).Display_Name;
+ if Extending2.Virtual then
+ Error_Msg_Name_1 := Prj.Project.Display_Name;
if Error_Report = null then
Error_Msg
("project %% cannot be extended by a virtual" &
" project with the same object directory",
- In_Tree.Projects.Table (Proj).Location);
+ Prj.Project.Location);
else
Error_Report
("project """ &
@@ -2426,18 +2393,16 @@ package body Prj.Proc is
end if;
else
- Error_Msg_Name_1 :=
- In_Tree.Projects.Table (Extending2).Display_Name;
- Error_Msg_Name_2 :=
- In_Tree.Projects.Table (Proj).Display_Name;
+ Error_Msg_Name_1 := Extending2.Display_Name;
+ Error_Msg_Name_2 := Prj.Project.Display_Name;
if Error_Report = null then
Error_Msg
("project %% cannot extend project %%",
- In_Tree.Projects.Table (Extending2).Location);
+ Extending2.Location);
Error_Msg
("\they share the same object directory",
- In_Tree.Projects.Table (Extending2).Location);
+ Extending2.Location);
else
Error_Report
@@ -2455,10 +2420,11 @@ package body Prj.Proc is
-- Continue with the next extending project, if any
- Extending2 :=
- In_Tree.Projects.Table (Extending2).Extended_By;
+ Extending2 := Extending2.Extended_By;
end loop;
end if;
+
+ Prj := Prj.Next;
end loop;
end if;
@@ -2479,14 +2445,14 @@ package body Prj.Proc is
begin
if Verbose_Mode then
Write_Str ("Checking project file """);
- Write_Str
- (Get_Name_String (Data.In_Tree.Projects.Table (Project).Name));
+ Write_Str (Get_Name_String (Project.Name));
Write_Line ("""");
end if;
Prj.Nmsc.Check
(Project, Data.In_Tree, Error_Report, Data.When_No_Sources,
- Data.Current_Dir.all, Data.Proc_Data);
+ Data.Current_Dir.all, Data.Proc_Data,
+ Is_Config_File => Data.Is_Config_File);
end Recursive_Check;
-----------------------
@@ -2546,12 +2512,11 @@ package body Prj.Proc is
-- it is nil, then this imported project is our first.
if Imported = null then
- In_Tree.Projects.Table (Project).Imported_Projects :=
+ Project.Imported_Projects :=
new Project_List_Element'
(Project => New_Project,
Next => null);
- Imported :=
- In_Tree.Projects.Table (Project).Imported_Projects;
+ Imported := Project.Imported_Projects;
else
Imported.Next := new Project_List_Element'
(Project => New_Project,
@@ -2573,7 +2538,6 @@ package body Prj.Proc is
else
declare
- Processed_Data : Project_Data := Empty_Project (In_Tree);
Imported : Project_List;
Declaration_Node : Project_Node_Id := Empty_Node;
Tref : Source_Buffer_Ptr;
@@ -2595,22 +2559,22 @@ package body Prj.Proc is
-- This is for virtually extended projects.
if Extended_By /= No_Project then
- In_Tree.Projects.Table (Project).Extended_By := Extended_By;
+ Project.Extended_By := Extended_By;
end if;
return;
end if;
- Project_Table.Increment_Last (In_Tree.Projects);
- Project := Project_Table.Last (In_Tree.Projects);
+ Project := new Project_Data'(Empty_Project (In_Tree));
+ In_Tree.Projects := new Project_List_Element'
+ (Project => Project,
+ Next => In_Tree.Projects);
+
Processed_Projects.Set (Name, Project);
- Processed_Data.Name := Name;
- Processed_Data.Qualifier :=
+ Project.Name := Name;
+ Project.Qualifier :=
Project_Qualifier_Of (From_Project_Node, From_Project_Node_Tree);
- In_Tree.Projects.Table (Project).Name := Name;
- In_Tree.Projects.Table (Project).Qualifier :=
- Processed_Data.Qualifier;
Get_Name_String (Name);
@@ -2621,15 +2585,15 @@ package body Prj.Proc is
and then Name_Buffer (1 .. Virtual_Prefix'Length) =
Virtual_Prefix
then
- Processed_Data.Virtual := True;
- Processed_Data.Display_Name := Name;
+ Project.Virtual := True;
+ Project.Display_Name := Name;
-- If there is no file, for example when the project node tree is
-- built in memory by GPS, the Display_Name cannot be found in
-- the source, so its value is the same as Name.
elsif Location = No_Location then
- Processed_Data.Display_Name := Name;
+ Project.Display_Name := Name;
-- Get the spelling of the project name from the project file
@@ -2641,37 +2605,35 @@ package body Prj.Proc is
Location := Location + 1;
end loop;
- Processed_Data.Display_Name := Name_Find;
+ Project.Display_Name := Name_Find;
end if;
- Processed_Data.Path.Display_Name :=
+ Project.Path.Display_Name :=
Path_Name_Of (From_Project_Node, From_Project_Node_Tree);
- Get_Name_String (Processed_Data.Path.Display_Name);
+ Get_Name_String (Project.Path.Display_Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
- Processed_Data.Path.Name := Name_Find;
+ Project.Path.Name := Name_Find;
- Processed_Data.Location :=
+ Project.Location :=
Location_Of (From_Project_Node, From_Project_Node_Tree);
- Processed_Data.Directory.Display_Name :=
+ Project.Directory.Display_Name :=
Directory_Of (From_Project_Node, From_Project_Node_Tree);
- Get_Name_String (Processed_Data.Directory.Display_Name);
+ Get_Name_String (Project.Directory.Display_Name);
Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
- Processed_Data.Directory.Name := Name_Find;
+ Project.Directory.Name := Name_Find;
- Processed_Data.Extended_By := Extended_By;
+ Project.Extended_By := Extended_By;
Add_Attributes
(Project,
Name,
- Name_Id (Processed_Data.Directory.Name),
+ Name_Id (Project.Directory.Name),
In_Tree,
- Processed_Data.Decl,
+ Project.Decl,
Prj.Attr.Attribute_First,
Project_Level => True);
- In_Tree.Projects.Table (Project) := Processed_Data;
-
Process_Imported_Projects (Imported, Limited_With => False);
Declaration_Node :=
@@ -2680,7 +2642,7 @@ package body Prj.Proc is
Recursive_Process
(In_Tree => In_Tree,
- Project => In_Tree.Projects.Table (Project).Extends,
+ Project => Project.Extends,
From_Project_Node => Extended_Project_Of
(Declaration_Node,
From_Project_Node_Tree),
@@ -2702,27 +2664,22 @@ package body Prj.Proc is
-- or renamed. Also inherit the languages, if attribute Languages
-- is not explicitly defined.
- Processed_Data := In_Tree.Projects.Table (Project);
-
- if Processed_Data.Extends /= No_Project then
+ if Project.Extends /= No_Project then
declare
Extended_Pkg : Package_Id;
Current_Pkg : Package_Id;
Element : Package_Element;
First : constant Package_Id :=
- Processed_Data.Decl.Packages;
+ Project.Decl.Packages;
Attribute1 : Variable_Id;
Attribute2 : Variable_Id;
Attr_Value1 : Variable;
Attr_Value2 : Variable;
begin
- Extended_Pkg :=
- In_Tree.Projects.Table
- (Processed_Data.Extends).Decl.Packages;
+ Extended_Pkg := Project.Extends.Decl.Packages;
while Extended_Pkg /= No_Package loop
- Element :=
- In_Tree.Packages.Table (Extended_Pkg);
+ Element := In_Tree.Packages.Table (Extended_Pkg);
Current_Pkg := First;
while Current_Pkg /= No_Package
@@ -2741,8 +2698,8 @@ package body Prj.Proc is
(Name => Element.Name,
Decl => No_Declarations,
Parent => No_Package,
- Next => Processed_Data.Decl.Packages);
- Processed_Data.Decl.Packages := Current_Pkg;
+ Next => Project.Decl.Packages);
+ Project.Decl.Packages := Current_Pkg;
Copy_Package_Declarations
(From => Element.Decl,
To =>
@@ -2759,7 +2716,7 @@ package body Prj.Proc is
-- Check if attribute Languages is declared in the
-- extending project.
- Attribute1 := Processed_Data.Decl.Attributes;
+ Attribute1 := Project.Decl.Attributes;
while Attribute1 /= No_Variable loop
Attr_Value1 := In_Tree.Variable_Elements.
Table (Attribute1);
@@ -2774,9 +2731,7 @@ package body Prj.Proc is
-- project. Check if it is declared in the project being
-- extended.
- Attribute2 :=
- In_Tree.Projects.Table
- (Processed_Data.Extends).Decl.Attributes;
+ Attribute2 := Project.Extends.Decl.Attributes;
while Attribute2 /= No_Variable loop
Attr_Value2 := In_Tree.Variable_Elements.
Table (Attribute2);
@@ -2796,8 +2751,8 @@ package body Prj.Proc is
(In_Tree.Variable_Elements);
Attribute1 := Variable_Element_Table.Last
(In_Tree.Variable_Elements);
- Attr_Value1.Next := Processed_Data.Decl.Attributes;
- Processed_Data.Decl.Attributes := Attribute1;
+ Attr_Value1.Next := Project.Decl.Attributes;
+ Project.Decl.Attributes := Attribute1;
end if;
Attr_Value1.Name := Snames.Name_Languages;
@@ -2807,8 +2762,6 @@ package body Prj.Proc is
end if;
end if;
end;
-
- In_Tree.Projects.Table (Project) := Processed_Data;
end if;
Process_Imported_Projects (Imported, Limited_With => True);
diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads
index 1074f3ad202..e15c8efd283 100644
--- a/gcc/ada/prj-proc.ads
+++ b/gcc/ada/prj-proc.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2001-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,53 +31,64 @@ with Prj.Tree; use Prj.Tree;
package Prj.Proc is
- procedure Process
+ procedure Process_Project_Tree_Phase_1
(In_Tree : Project_Tree_Ref;
Project : out Project_Id;
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
- When_No_Sources : Error_Warning := Error;
- Reset_Tree : Boolean := True;
- Current_Dir : String := "");
- -- Process a project file tree into project file data structures. If
- -- Report_Error is null, use the error reporting mechanism. Otherwise,
- -- report errors using Report_Error.
+ Reset_Tree : Boolean := True);
+ -- Process a project tree (ie the direct resulting of parsing a .gpr file)
+ -- based on the current scenario variables.
--
- -- Current_Dir is for optimization purposes, avoiding extra system calls.
+ -- The result of this phase_1 is a partial project tree (Project) where
+ -- only a few fields have been initialized (in particular the list of
+ -- languages). These are the fields that are necessary to run gprconfig if
+ -- needed to automatically generate a configuration file. This first phase
+ -- of the processing does not require a configuration file.
+ --
+ -- If Report_Error is null, use the error reporting mechanism. Otherwise,
+ -- report errors using Report_Error.
--
-- When_No_Sources indicates what should be done when no sources are found
-- in a project for a specified or implied language.
--
-- When Reset_Tree is True, all the project data are removed from the
-- project table before processing.
- --
- -- Process is a bit of a junk name, how about Process_Project_Tree???
- -- The two procedures that follow are implementing procedure Process in
- -- two successive phases. They are used by gprbuild/gprclean to add the
- -- configuration attributes between the two phases.
-
- procedure Process_Project_Tree_Phase_1
+ procedure Process_Project_Tree_Phase_2
(In_Tree : Project_Tree_Ref;
- Project : out Project_Id;
+ Project : Project_Id;
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
- Reset_Tree : Boolean := True);
- -- See documentation of parameters in procedure Process above
+ When_No_Sources : Error_Warning := Error;
+ Current_Dir : String;
+ Is_Config_File : Boolean);
+ -- Perform the second phase of the processing, filling the rest of the
+ -- project with the information extracted from the project tree. This phase
+ -- requires that the configuration file has already been parsed (in fact
+ -- we currently assume that the contents of the configuration file has
+ -- been included in Project through Confgpr.Apply_Config_File). The
+ -- parameters are the same as for phase_1, with the addition of:
+ --
+ -- Current_Dir is for optimization purposes, avoiding extra system calls.
+ --
+ -- Is_Config_File should be true if Project is a config file (.cgpr)
- procedure Process_Project_Tree_Phase_2
+ procedure Process
(In_Tree : Project_Tree_Ref;
- Project : Project_Id;
+ Project : out Project_Id;
Success : out Boolean;
From_Project_Node : Project_Node_Id;
From_Project_Node_Tree : Project_Node_Tree_Ref;
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
- Current_Dir : String);
- -- See documentation of parameters in procedure Process above
+ Reset_Tree : Boolean := True;
+ Current_Dir : String := "";
+ Is_Config_File : Boolean);
+ -- Performs the two phases of the processing
end Prj.Proc;
diff --git a/gcc/ada/prj-util.adb b/gcc/ada/prj-util.adb
index 5894e4daf35..cd7696fdfed 100644
--- a/gcc/ada/prj-util.adb
+++ b/gcc/ada/prj-util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -114,8 +114,7 @@ package body Prj.Util is
is
pragma Assert (Project /= No_Project);
- The_Packages : constant Package_Id :=
- In_Tree.Projects.Table (Project).Decl.Packages;
+ The_Packages : constant Package_Id := Project.Decl.Packages;
Builder_Package : constant Prj.Package_Id :=
Prj.Util.Value_Of
@@ -135,7 +134,7 @@ package body Prj.Util is
Executable_Suffix_Name : Name_Id := No_Name;
- Naming : constant Naming_Data := In_Tree.Projects.Table (Project).Naming;
+ Naming : constant Naming_Data := Project.Naming;
Spec_Suffix : Name_Id := No_Name;
Body_Suffix : Name_Id := No_Name;
@@ -188,8 +187,7 @@ package body Prj.Util is
if Builder_Package /= No_Package then
if Get_Mode = Multi_Language then
- Executable_Suffix_Name :=
- In_Tree.Projects.Table (Project).Config.Executable_Suffix;
+ Executable_Suffix_Name := Project.Config.Executable_Suffix;
else
Executable_Suffix := Prj.Util.Value_Of
@@ -330,11 +328,9 @@ package body Prj.Util is
Result : File_Name_Type;
begin
- if In_Tree.Projects.Table (Project).Config.Executable_Suffix /=
- No_Name
- then
+ if Project.Config.Executable_Suffix /= No_Name then
Executable_Extension_On_Target :=
- In_Tree.Projects.Table (Project).Config.Executable_Suffix;
+ Project.Config.Executable_Suffix;
end if;
Result := Executable_Name (Name_Find);
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index 403e2c23ad7..30f40fb0035 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -49,8 +49,6 @@ package body Prj is
Current_Mode : Mode := Ada_Only;
- Configuration_Mode : Boolean := False;
-
The_Empty_String : Name_Id;
Default_Ada_Spec_Suffix_Id : File_Name_Type;
@@ -143,12 +141,11 @@ package body Prj is
-- Table to store the path name of all the created temporary files, so that
-- they can be deleted at the end, or when the program is interrupted.
- procedure Free (Project : in out Project_Data; Reset_Only : Boolean);
+ procedure Free (Project : in out Project_Id);
-- Free memory allocated for Project
procedure Free_List (Languages : in out Language_Ptr);
procedure Free_List (Source : in out Source_Id);
- procedure Free_List (List : in out Project_List);
procedure Free_List (Languages : in out Language_List);
-- Free memory allocated for the list of languages or sources
@@ -396,7 +393,7 @@ package body Prj is
procedure Project_Changed (Iter : in out Source_Iterator) is
begin
- Iter.Language := Iter.In_Tree.Projects.Table (Iter.Project).Languages;
+ Iter.Language := Iter.Project.Project.Languages;
Language_Changed (Iter);
end Project_Changed;
@@ -420,16 +417,14 @@ package body Prj is
if Iter.Language = No_Language_Index then
if Iter.All_Projects then
- Iter.Project := Iter.Project + 1;
+ Iter.Project := Iter.Project.Next;
- if Iter.Project > Project_Table.Last (Iter.In_Tree.Projects) then
- Iter.Project := No_Project;
- else
+ if Iter.Project /= null then
Project_Changed (Iter);
end if;
else
- Iter.Project := No_Project;
+ Iter.Project := null;
end if;
else
@@ -455,14 +450,18 @@ package body Prj is
begin
Iter := Source_Iterator'
(In_Tree => In_Tree,
- Project => Project,
+ Project => In_Tree.Projects,
All_Projects => Project = No_Project,
Language_Name => Language,
Language => No_Language_Index,
Current => No_Source);
- if Iter.Project = No_Project then
- Iter.Project := Project_Table.First;
+ if Project /= null then
+ while Iter.Project /= null
+ and then Iter.Project.Project /= Project
+ loop
+ Iter.Project := Iter.Project.Next;
+ end loop;
end if;
Project_Changed (Iter);
@@ -498,7 +497,6 @@ package body Prj is
procedure For_Every_Project_Imported
(By : Project_Id;
- In_Tree : Project_Tree_Ref;
With_State : in out State;
Imported_First : Boolean := False)
is
@@ -514,7 +512,6 @@ package body Prj is
---------------------
procedure Recursive_Check (Project : Project_Id) is
- Data : Project_Data renames In_Tree.Projects.Table (Project);
List : Project_List;
begin
@@ -527,13 +524,13 @@ package body Prj is
-- Visited all extended projects
- if Data.Extends /= No_Project then
- Recursive_Check (Data.Extends);
+ if Project.Extends /= No_Project then
+ Recursive_Check (Project.Extends);
end if;
-- Visited all imported projects
- List := Data.Imported_Projects;
+ List := Project.Imported_Projects;
while List /= null loop
Recursive_Check (List.Project);
List := List.Next;
@@ -585,7 +582,11 @@ package body Prj is
function Hash (Project : Project_Id) return Header_Num is
begin
- return Header_Num (Project mod Max_Header_Num);
+ if Project = No_Project then
+ return Header_Num'First;
+ else
+ return Hash (Get_Name_String (Project.Name));
+ end if;
end Hash;
-----------
@@ -597,15 +598,6 @@ package body Prj is
return The_Casing_Images (Casing).all;
end Image;
- ----------------------
- -- In_Configuration --
- ----------------------
-
- function In_Configuration return Boolean is
- begin
- return Configuration_Mode;
- end In_Configuration;
-
----------------
-- Initialize --
----------------
@@ -645,13 +637,13 @@ package body Prj is
-------------------
function Is_A_Language
- (Data : Project_Data;
+ (Project : Project_Id;
Language_Name : Name_Id) return Boolean
is
Lang_Ind : Language_Ptr;
begin
- Lang_Ind := Data.Languages;
+ Lang_Ind := Project.Languages;
while Lang_Ind /= No_Language_Index loop
if Lang_Ind.Name = Language_Name then
return True;
@@ -669,8 +661,7 @@ package body Prj is
function Is_Extending
(Extending : Project_Id;
- Extended : Project_Id;
- In_Tree : Project_Tree_Ref) return Boolean
+ Extended : Project_Id) return Boolean
is
Proj : Project_Id;
@@ -681,7 +672,7 @@ package body Prj is
return True;
end if;
- Proj := In_Tree.Projects.Table (Proj).Extends;
+ Proj := Proj.Extends;
end loop;
return False;
@@ -823,18 +814,21 @@ package body Prj is
-- Free --
----------
- procedure Free (Project : in out Project_Data; Reset_Only : Boolean) is
- begin
- Free (Project.Include_Path);
- Free (Project.Ada_Include_Path);
- Free (Project.Objects_Path);
- Free (Project.Ada_Objects_Path);
-
- Free_List (Project.Imported_Projects);
- Free_List (Project.All_Imported_Projects);
+ procedure Free (Project : in out Project_Id) is
+ procedure Unchecked_Free is new Ada.Unchecked_Deallocation
+ (Project_Data, Project_Id);
- if not Reset_Only then
+ begin
+ if Project /= null then
+ Free (Project.Include_Path);
+ Free (Project.Ada_Include_Path);
+ Free (Project.Objects_Path);
+ Free (Project.Ada_Objects_Path);
+ Free_List (Project.Imported_Projects, Free_Project => False);
+ Free_List (Project.All_Imported_Projects, Free_Project => False);
Free_List (Project.Languages);
+
+ Unchecked_Free (Project);
end if;
end Free;
@@ -875,13 +869,22 @@ package body Prj is
-- Free_List --
---------------
- procedure Free_List (List : in out Project_List) is
+ procedure Free_List
+ (List : in out Project_List;
+ Free_Project : Boolean)
+ is
procedure Unchecked_Free is new Ada.Unchecked_Deallocation
(Project_List_Element, Project_List);
Tmp : Project_List;
+
begin
while List /= null loop
Tmp := List.Next;
+
+ if Free_Project then
+ Free (List.Project);
+ end if;
+
Unchecked_Free (List);
List := Tmp;
end loop;
@@ -925,22 +928,19 @@ package body Prj is
Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
Unit_Sources_Htable.Reset (Tree.Unit_Sources_HT);
- for P in Project_Table.First ..
- Project_Table.Last (Tree.Projects)
- loop
- Free (Tree.Projects.Table (P), Reset_Only => False);
- end loop;
-
- Project_Table.Free (Tree.Projects);
+ Free_List (Tree.Projects, Free_Project => True);
-- Private part
- Naming_Table.Free (Tree.Private_Part.Namings);
- Path_File_Table.Free (Tree.Private_Part.Path_Files);
+ Naming_Table.Free (Tree.Private_Part.Namings);
+ Path_File_Table.Free (Tree.Private_Part.Path_Files);
Source_Path_Table.Free (Tree.Private_Part.Source_Paths);
Object_Path_Table.Free (Tree.Private_Part.Object_Paths);
- -- Naming data (nothing to free ?)
+ Free (Tree.Private_Part.Ada_Path_Buffer);
+
+ -- Naming data (nothing to free ???)
+
null;
Unchecked_Free (Tree);
@@ -966,15 +966,7 @@ package body Prj is
Source_Paths_Htable.Reset (Tree.Source_Paths_HT);
Unit_Sources_Htable.Reset (Tree.Unit_Sources_HT);
- if not Project_Table."=" (Tree.Projects.Table, null) then
- for P in Project_Table.First ..
- Project_Table.Last (Tree.Projects)
- loop
- Free (Tree.Projects.Table (P), Reset_Only => True);
- end loop;
- end if;
-
- Project_Table.Init (Tree.Projects);
+ Free_List (Tree.Projects, Free_Project => True);
-- Private part table
@@ -1056,15 +1048,6 @@ package body Prj is
In_Tree.Array_Elements.Table (Naming.Body_Suffix) := Element;
end Set_Body_Suffix;
- --------------------------
- -- Set_In_Configuration --
- --------------------------
-
- procedure Set_In_Configuration (Value : Boolean) is
- begin
- Configuration_Mode := Value;
- end Set_In_Configuration;
-
--------------
-- Set_Mode --
--------------
@@ -1235,7 +1218,7 @@ package body Prj is
-- Has_Ada_Sources --
---------------------
- function Has_Ada_Sources (Data : Project_Data) return Boolean is
+ function Has_Ada_Sources (Data : Project_Id) return Boolean is
Lang : Language_Ptr;
begin
@@ -1254,7 +1237,7 @@ package body Prj is
-- Has_Foreign_Sources --
-------------------------
- function Has_Foreign_Sources (Data : Project_Data) return Boolean is
+ function Has_Foreign_Sources (Data : Project_Id) return Boolean is
Lang : Language_Ptr;
begin
@@ -1317,30 +1300,27 @@ package body Prj is
--------------------------
function Get_Object_Directory
- (In_Tree : Project_Tree_Ref;
- Project : Project_Id;
+ (Project : Project_Id;
Including_Libraries : Boolean;
Only_If_Ada : Boolean := False) return Path_Name_Type
is
- Data : Project_Data renames In_Tree.Projects.Table (Project);
-
begin
- if (Data.Library and Including_Libraries)
+ if (Project.Library and Including_Libraries)
or else
- (Data.Object_Directory /= No_Path_Information
- and then (not Including_Libraries or else not Data.Library))
+ (Project.Object_Directory /= No_Path_Information
+ and then (not Including_Libraries or else not Project.Library))
then
-- For a library project, add the library ALI directory if there is
-- no object directory or if the library ALI directory contains ALI
-- files; otherwise add the object directory.
- if Data.Library then
- if Data.Object_Directory = No_Path_Information
- or else Contains_ALI_Files (Data.Library_ALI_Dir.Name)
+ if Project.Library then
+ if Project.Object_Directory = No_Path_Information
+ or else Contains_ALI_Files (Project.Library_ALI_Dir.Name)
then
- return Data.Library_ALI_Dir.Name;
+ return Project.Library_ALI_Dir.Name;
else
- return Data.Object_Directory.Name;
+ return Project.Object_Directory.Name;
end if;
-- For a non-library project, add object directory if it is not a
@@ -1349,7 +1329,7 @@ package body Prj is
-- adding the object directory could disrupt the order of the
-- object dirs in the path.
- elsif not Data.Virtual then
+ elsif not Project.Virtual then
declare
Add_Object_Dir : Boolean;
Prj : Project_Id;
@@ -1358,15 +1338,15 @@ package body Prj is
Add_Object_Dir := not Only_If_Ada;
Prj := Project;
while not Add_Object_Dir and then Prj /= No_Project loop
- if Has_Ada_Sources (In_Tree.Projects.Table (Prj)) then
+ if Has_Ada_Sources (Prj) then
Add_Object_Dir := True;
else
- Prj := In_Tree.Projects.Table (Prj).Extends;
+ Prj := Prj.Extends;
end if;
end loop;
if Add_Object_Dir then
- return Data.Object_Directory.Name;
+ return Project.Object_Directory.Name;
end if;
end;
end if;
@@ -1380,15 +1360,14 @@ package body Prj is
-----------------------------------
function Ultimate_Extending_Project_Of
- (Proj : Project_Id;
- In_Tree : Project_Tree_Ref) return Project_Id
+ (Proj : Project_Id) return Project_Id
is
Prj : Project_Id;
begin
Prj := Proj;
- while In_Tree.Projects.Table (Prj).Extended_By /= No_Project loop
- Prj := In_Tree.Projects.Table (Prj).Extended_By;
+ while Prj /= null and then Prj.Extended_By /= No_Project loop
+ Prj := Prj.Extended_By;
end loop;
return Prj;
@@ -1398,11 +1377,7 @@ package body Prj is
-- Compute_All_Imported_Projects --
-----------------------------------
- procedure Compute_All_Imported_Projects
- (Project : Project_Id; In_Tree : Project_Tree_Ref)
- is
- Data : Project_Data renames In_Tree.Projects.Table (Project);
-
+ procedure Compute_All_Imported_Projects (Project : Project_Id) is
procedure Recursive_Add (Prj : Project_Id; Dummy : in out Boolean);
-- Recursively add the projects imported by project Project, but not
-- those that are extended.
@@ -1420,13 +1395,13 @@ package body Prj is
-- A project is not importing itself
if Project /= Prj then
- Prj2 := Ultimate_Extending_Project_Of (Prj, In_Tree);
+ Prj2 := Ultimate_Extending_Project_Of (Prj);
-- Check that the project is not already in the list. We know the
-- one passed to Recursive_Add have never been visited before, but
-- the one passed it are the extended projects.
- List := Data.All_Imported_Projects;
+ List := Project.All_Imported_Projects;
while List /= null loop
if List.Project = Prj2 then
return;
@@ -1436,10 +1411,10 @@ package body Prj is
-- Add it to the list
- Data.All_Imported_Projects :=
+ Project.All_Imported_Projects :=
new Project_List_Element'
(Project => Prj2,
- Next => Data.All_Imported_Projects);
+ Next => Project.All_Imported_Projects);
end if;
end Recursive_Add;
@@ -1448,8 +1423,8 @@ package body Prj is
Dummy : Boolean := False;
begin
- Free_List (Data.All_Imported_Projects);
- For_All_Projects (Project, In_Tree, Dummy);
+ Free_List (Project.All_Imported_Projects, Free_Project => False);
+ For_All_Projects (Project, Dummy);
end Compute_All_Imported_Projects;
begin
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index b4d61720f88..09b65f84376 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -44,10 +44,6 @@ package Prj is
-- Name used to replace others as an index of an associative array
-- attribute in situations where this is allowed.
- Subdirs_Option : constant String := "--subdirs=";
- -- Switch used to indicate that the real directories (object, exec,
- -- library, ...) are subdirectories of those in the project file.
-
Subdirs : String_Ptr := null;
-- The value after the equal sign in switch --subdirs=...
-- Contains the relative subdirectory.
@@ -99,12 +95,6 @@ package Prj is
-- can ignore such errors when they don't need to build directly. Calling
-- Set_Mode will reset this variable, default is for Ada_Only.
- function In_Configuration return Boolean;
- pragma Inline (In_Configuration);
-
- procedure Set_In_Configuration (Value : Boolean);
- pragma Inline (Set_In_Configuration);
-
All_Packages : constant String_List_Access;
-- Default value of parameter Packages of procedures Parse, in Prj.Pars and
-- Prj.Part, indicating that all packages should be checked.
@@ -160,8 +150,9 @@ package Prj is
No_Path_Information : constant Path_Information := (No_Path, No_Path);
- type Project_Id is new Nat;
- No_Project : constant Project_Id := 0;
+ type Project_Data;
+ type Project_Id is access all Project_Data;
+ No_Project : constant Project_Id := null;
-- Id of a Project File
type String_List_Id is new Nat;
@@ -323,10 +314,8 @@ package Prj is
function Hash (Name : Name_Id) return Header_Num;
function Hash (Name : File_Name_Type) return Header_Num;
function Hash (Name : Path_Name_Type) return Header_Num;
- -- Used for computing hash values for names put into above hash table
-
function Hash (Project : Project_Id) return Header_Num;
- -- Used for hash tables where Project_Id is the Key
+ -- Used for computing hash values for names put into above hash table
type Language_Kind is (File_Based, Unit_Based);
-- Type for the kind of language. All languages are file based, except Ada
@@ -399,7 +388,7 @@ package Prj is
Body_Suffix => No_File);
type Source_Data;
- type Source_Id is access Source_Data;
+ type Source_Id is access all Source_Data;
No_Source : constant Source_Id := null;
@@ -605,7 +594,7 @@ package Prj is
Next => No_Language_Index);
type Language_List_Element;
- type Language_List is access Language_List_Element;
+ type Language_List is access all Language_List_Element;
type Language_List_Element is record
Language : Language_Ptr := No_Language_Index;
Next : Language_List;
@@ -896,8 +885,7 @@ package Prj is
Suffix : File_Name_Type);
function Get_Object_Directory
- (In_Tree : Project_Tree_Ref;
- Project : Project_Id;
+ (Project : Project_Id;
Including_Libraries : Boolean;
Only_If_Ada : Boolean := False) return Path_Name_Type;
-- Return the object directory to use for the project. This depends on
@@ -908,13 +896,12 @@ package Prj is
-- If Only_If_Ada is True, then No_Name will be returned when the project
-- doesn't Ada sources.
- procedure Compute_All_Imported_Projects
- (Project : Project_Id; In_Tree : Project_Tree_Ref);
+ procedure Compute_All_Imported_Projects (Project : Project_Id);
-- Compute, the list of the projects imported directly or indirectly by
-- project Project. The result is stored in Project.All_Imported_Projects
function Ultimate_Extending_Project_Of
- (Proj : Project_Id; In_Tree : Project_Tree_Ref) return Project_Id;
+ (Proj : Project_Id) return Project_Id;
-- Returns the ultimate extending project of project Proj. If project Proj
-- is not extended, returns Proj.
@@ -931,13 +918,18 @@ package Prj is
-- not considering Specs and Bodies.
type Project_List_Element;
- type Project_List is access Project_List_Element;
+ type Project_List is access all Project_List_Element;
type Project_List_Element is record
Project : Project_Id := No_Project;
Next : Project_List := null;
end record;
-- A list of projects
+ procedure Free_List
+ (List : in out Project_List;
+ Free_Project : Boolean);
+ -- Free the list of projects, if Free_Project, each project is also freed
+
type Response_File_Format is
(None,
GNU,
@@ -1119,7 +1111,8 @@ package Prj is
Config : Project_Configuration;
Path : Path_Information := No_Path_Information;
- -- The path name of the project file
+ -- The path name of the project file. This include base name of the
+ -- project file.
Virtual : Boolean := False;
-- True for virtual extending projects
@@ -1317,33 +1310,24 @@ package Prj is
function Is_Extending
(Extending : Project_Id;
- Extended : Project_Id;
- In_Tree : Project_Tree_Ref) return Boolean;
- -- ??? needs comment
+ Extended : Project_Id) return Boolean;
+ -- Return True if Extending is extending the Extended project
function Is_A_Language
- (Data : Project_Data;
+ (Project : Project_Id;
Language_Name : Name_Id) return Boolean;
-- Return True when Language_Name (which must be lower case) is one of the
-- languages used for the project.
- function Has_Ada_Sources (Data : Project_Data) return Boolean;
+ function Has_Ada_Sources (Data : Project_Id) return Boolean;
-- Return True if the project has Ada sources
- function Has_Foreign_Sources (Data : Project_Data) return Boolean;
+ function Has_Foreign_Sources (Data : Project_Id) return Boolean;
-- Return True if the project has foreign sources
Project_Error : exception;
-- Raised by some subprograms in Prj.Attr
- package Project_Table is new GNAT.Dynamic_Tables (
- Table_Component_Type => Project_Data,
- Table_Index_Type => Project_Id,
- Table_Low_Bound => 1,
- Table_Initial => 100,
- Table_Increment => 100);
- -- The set of all project files
-
type Spec_Or_Body is (Specification, Body_Part);
type File_Name_Data is record
@@ -1427,7 +1411,7 @@ package Prj is
Array_Elements : Array_Element_Table.Instance;
Arrays : Array_Table.Instance;
Packages : Package_Table.Instance;
- Projects : Project_Table.Instance;
+ Projects : Project_List;
Units : Unit_Table.Instance;
Units_HT : Units_Htable.Instance;
Source_Paths_HT : Source_Paths_Htable.Instance;
@@ -1486,7 +1470,6 @@ package Prj is
With_State : in out State);
procedure For_Every_Project_Imported
(By : Project_Id;
- In_Tree : Project_Tree_Ref;
With_State : in out State;
Imported_First : Boolean := False);
-- Call Action for each project imported directly or indirectly by project
@@ -1560,7 +1543,7 @@ private
type Source_Iterator is record
In_Tree : Project_Tree_Ref;
- Project : Project_Id;
+ Project : Project_List;
All_Projects : Boolean;
-- Current project and whether we should move on to the next
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 986ca3a7e9b..41dae0f59c9 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -79,16 +79,18 @@ package body Rtsfind is
-- the latter case it is critical to make a call to Set_RTU_Loaded to
-- ensure that the entry in this table reflects the load.
- -- Withed is True if an implicit with_clause has been added from some unit
- -- other than the main unit to this unit. Withed_By_Main is the same,
- -- except from the main unit.
+ -- A unit retrieved through rtsfind may end up in the context of several
+ -- other units, in addition to the main unit. These additional with_clauses
+ -- are needed to generate a proper traversal order for Inspector. To
+ -- minimize somewhat the redundancy created by numerous calls to rtsfind
+ -- from different units, we keep track of the list of implicit with_clauses
+ -- already created for the current loaded unit.
type RT_Unit_Table_Record is record
- Entity : Entity_Id;
- Uname : Unit_Name_Type;
- Unum : Unit_Number_Type;
- Withed : Boolean;
- Withed_By_Main : Boolean;
+ Entity : Entity_Id;
+ Uname : Unit_Name_Type;
+ First_Implicit_With : Node_Id;
+ Unum : Unit_Number_Type;
end record;
RT_Unit_Table : array (RTU_Id) of RT_Unit_Table_Record;
@@ -118,12 +120,12 @@ package body Rtsfind is
-- When a unit is implicitly loaded as a result of a call to RTE, it is
-- necessary to create one or two implicit with_clauses. We add such
-- with_clauses to the extended main unit if needed, and also to whatever
- -- unit first needs them, which is not necessarily the main unit. The
- -- former ensures that the object is correctly loaded by the binder. The
- -- latter is necessary for SofCheck Inspector.
+ -- unit needs them, which is not necessarily the main unit. The former
+ -- ensures that the object is correctly loaded by the binder. The latter
+ -- is necessary for SofCheck Inspector.
- -- The flags Withed and Withed_By_Main in the unit table record are used to
- -- avoid duplicates.
+ -- The field First_Implicit_With in the unit table record are used to
+ -- avoid creating duplicate with_clauses.
-----------------------
-- Local Subprograms --
@@ -303,6 +305,9 @@ package body Rtsfind is
elsif U_Id in Ada_Streams_Child then
Name_Buffer (12) := '.';
+ elsif U_Id in Ada_Strings_Child then
+ Name_Buffer (12) := '.';
+
elsif U_Id in Ada_Text_IO_Child then
Name_Buffer (12) := '.';
@@ -668,9 +673,8 @@ package body Rtsfind is
-- Otherwise we need to load the unit, First build unit name
-- from the enumeration literal name in type RTU_Id.
- U.Uname := Get_Unit_Name (U_Id);
- U.Withed := False;
- U.Withed_By_Main := False;
+ U.Uname := Get_Unit_Name (U_Id);
+ U. First_Implicit_With := Empty;
-- Now do the load call, note that setting Error_Node to Empty is
-- a signal to Load_Unit that we will regard a failure to find the
@@ -798,9 +802,6 @@ package body Rtsfind is
--------------------
procedure Maybe_Add_With (U : in out RT_Unit_Table_Record) is
- Is_Main : constant Boolean :=
- In_Extended_Main_Code_Unit (Cunit_Entity (Current_Sem_Unit));
-
begin
-- We do not need to generate a with_clause for a call issued from
-- RTE_Component_Available. However, for Inspector, we need these
@@ -818,42 +819,37 @@ package body Rtsfind is
return;
end if;
- -- If the current unit is the main one, add the with_clause unless it's
- -- already been done.
+ -- Add the with_clause, if not already in the context of the
+ -- current compilation unit.
- if Is_Main then
- if U.Withed_By_Main then
- return;
- else
- U.Withed_By_Main := True;
- end if;
+ declare
+ LibUnit : constant Node_Id := Unit (Cunit (U.Unum));
+ Clause : Node_Id;
+ Withn : Node_Id;
- -- If the current unit is not the main one, add the with_clause unless
- -- it's already been done for some non-main unit.
+ begin
+ Clause := U.First_Implicit_With;
+ while Present (Clause) loop
+ if Parent (Clause) = Cunit (Current_Sem_Unit) then
+ return;
+ end if;
- else
- if U.Withed then
- return;
- else
- U.Withed := True;
- end if;
- end if;
+ Clause := Next_Implicit_With (Clause);
+ end loop;
- -- Here if we've decided to add the with_clause
+ Withn :=
+ Make_With_Clause (Standard_Location,
+ Name =>
+ Make_Unit_Name
+ (U, Defining_Unit_Name (Specification (LibUnit))));
- declare
- LibUnit : constant Node_Id := Unit (Cunit (U.Unum));
- Withn : constant Node_Id :=
- Make_With_Clause (Standard_Location,
- Name =>
- Make_Unit_Name
- (U, Defining_Unit_Name (Specification (LibUnit))));
+ Set_Library_Unit (Withn, Cunit (U.Unum));
+ Set_Corresponding_Spec (Withn, U.Entity);
+ Set_First_Name (Withn, True);
+ Set_Implicit_With (Withn, True);
+ Set_Next_Implicit_With (Withn, U.First_Implicit_With);
- begin
- Set_Library_Unit (Withn, Cunit (U.Unum));
- Set_Corresponding_Spec (Withn, U.Entity);
- Set_First_Name (Withn, True);
- Set_Implicit_With (Withn, True);
+ U.First_Implicit_With := Withn;
Mark_Rewrite_Insertion (Withn);
Append (Withn, Context_Items (Cunit (Current_Sem_Unit)));
@@ -1342,14 +1338,14 @@ package body Rtsfind is
-- The RT_Unit_Table entry that may need updating
begin
- -- If entry is not set, set it now
+ -- If entry is not set, set it now, and indicate that it
+ -- was loaded through an explicit context clause..
if No (U.Entity) then
- U := (Entity => E,
- Uname => Get_Unit_Name (U_Id),
- Unum => Unum,
- Withed => False,
- Withed_By_Main => False);
+ U := (Entity => E,
+ Uname => Get_Unit_Name (U_Id),
+ Unum => Unum,
+ First_Implicit_With => Empty);
end if;
return;
@@ -1396,7 +1392,7 @@ package body Rtsfind is
begin
-- Nothing to do if name is not an identifier or a selected component
- -- whose selector_name is not an identifier.
+ -- whose selector_name is an identifier.
if Nkind (Nam) = N_Identifier then
Chrs := Chars (Nam);
@@ -1445,11 +1441,43 @@ package body Rtsfind is
goto Continue;
end if;
- Load_RTU
- (To_Load,
- Use_Setting => In_Use (Cunit_Entity (U)));
- Set_Is_Visible_Child_Unit
- (RT_Unit_Table (To_Load).Entity);
+ Load_RTU (To_Load, Use_Setting => In_Use (Cunit_Entity (U)));
+ Set_Is_Visible_Child_Unit (RT_Unit_Table (To_Load).Entity);
+
+ -- Prevent creation of an implicit 'with' from (for example)
+ -- Ada.Wide_Text_IO.Integer_IO to Ada.Text_IO.Integer_IO,
+ -- because these could create cycles. First check whether the
+ -- simple names match ("integer_io" = "integer_io"), and then
+ -- check whether the parent is indeed one of the
+ -- [[Wide_]Wide_]Text_IO packages.
+
+ if Chrs = Chars (Cunit_Entity (Current_Sem_Unit)) then
+ declare
+ Parent_Name : constant Unit_Name_Type :=
+ Get_Parent_Spec_Name
+ (Unit_Name (Current_Sem_Unit));
+
+ begin
+ if Parent_Name /= No_Unit_Name then
+ Get_Name_String (Parent_Name);
+
+ declare
+ P : String renames Name_Buffer (1 .. Name_Len);
+ begin
+ if P = "ada.text_io%s" or else
+ P = "ada.wide_text_io%s" or else
+ P = "ada.wide_wide_text_io%s"
+ then
+ goto Continue;
+ end if;
+ end;
+ end if;
+ end;
+ end if;
+
+ -- Add an implicit with clause from the current unit to the
+ -- [[Wide_]Wide_]Text_IO child (if necessary).
+
Maybe_Add_With (RT_Unit_Table (To_Load));
end if;
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index 5439f4e0e17..59c9835088c 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -61,6 +61,9 @@ package Rtsfind is
-- Names of the form Ada_Streams_xxx are second level children
-- of Ada.Streams.
+ -- Names of the form Ada_Strings_xxx are second level children
+ -- of Ada.Strings.
+
-- Names of the form Ada_Text_IO_xxx are second level children of
-- Ada.Text_IO.
@@ -120,6 +123,7 @@ package Rtsfind is
Ada_Interrupts,
Ada_Real_Time,
Ada_Streams,
+ Ada_Strings,
Ada_Tags,
Ada_Task_Identification,
Ada_Task_Termination,
@@ -149,6 +153,10 @@ package Rtsfind is
Ada_Streams_Stream_IO,
+ -- Children of Ada.Strings
+
+ Ada_Strings_Unbounded,
+
-- Children of Ada.Text_IO (for Text_IO_Kludge)
Ada_Text_IO_Decimal_IO,
@@ -404,6 +412,11 @@ package Rtsfind is
subtype Ada_Streams_Child is Ada_Child
range Ada_Streams_Stream_IO .. Ada_Streams_Stream_IO;
+ -- Range of values for children of Ada.Streams
+
+ subtype Ada_Strings_Child is Ada_Child
+ range Ada_Strings_Unbounded .. Ada_Strings_Unbounded;
+ -- Range of values for children of Ada.Strings
subtype Ada_Text_IO_Child is Ada_Child
range Ada_Text_IO_Decimal_IO .. Ada_Text_IO_Modular_IO;
@@ -530,6 +543,8 @@ package Rtsfind is
RE_Stream_Access, -- Ada.Streams.Stream_IO
+ RE_Unbounded_String, -- Ada.Strings.Unbounded
+
RE_Access_Level, -- Ada.Tags
RE_Address_Array, -- Ada.Tags
RE_Addr_Ptr, -- Ada.Tags
@@ -1226,6 +1241,7 @@ package Rtsfind is
RE_TA_WWC, -- System.Partition_Interface
RE_TA_String, -- System.Partition_Interface
RE_TA_ObjRef, -- System.Partition_Interface
+ RE_TA_Std_String, -- System.Partition_Interface
RE_TA_TC, -- System.Partition_Interface
RE_TC_Alias, -- System.Partition_Interface
@@ -1693,6 +1709,8 @@ package Rtsfind is
RE_Stream_Access => Ada_Streams_Stream_IO,
+ RE_Unbounded_String => Ada_Strings_Unbounded,
+
RE_Access_Level => Ada_Tags,
RE_Address_Array => Ada_Tags,
RE_Addr_Ptr => Ada_Tags,
@@ -2380,6 +2398,7 @@ package Rtsfind is
RE_TA_WWC => System_Partition_Interface,
RE_TA_String => System_Partition_Interface,
RE_TA_ObjRef => System_Partition_Interface,
+ RE_TA_Std_String => System_Partition_Interface,
RE_TA_TC => System_Partition_Interface,
RE_TC_Alias => System_Partition_Interface,
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb
index b3084775ff1..c6abba09bbf 100644
--- a/gcc/ada/s-fileio.adb
+++ b/gcc/ada/s-fileio.adb
@@ -73,12 +73,13 @@ package body System.File_IO is
-- Points to list of names of temporary files. Note that this global
-- variable must be properly protected to provide thread safety.
- type File_IO_Clean_Up_Type is new Controlled with null record;
+ type File_IO_Clean_Up_Type is new Limited_Controlled with null record;
-- The closing of all open files and deletion of temporary files is an
- -- action which takes place at the end of execution of the main program.
- -- This action can be implemented using a library level object which
- -- gets finalized at the end of the main program execution. The above is
- -- a controlled type introduced for this purpose.
+ -- action that takes place at the end of execution of the main program.
+ -- This action is implemented using a library level object which gets
+ -- finalized at the end of program execution. Note that the type is
+ -- limited, in order to stop the compiler optimizing away the declaration
+ -- which would be allowed in the non-limited case.
procedure Finalize (V : in out File_IO_Clean_Up_Type);
-- This is the finalize operation that is used to do the cleanup
diff --git a/gcc/ada/s-linux-alpha.ads b/gcc/ada/s-linux-alpha.ads
index 2f1112f7b2d..cdc716c727d 100644
--- a/gcc/ada/s-linux-alpha.ads
+++ b/gcc/ada/s-linux-alpha.ads
@@ -104,8 +104,9 @@ package System.Linux is
-- struct_sigaction offsets
- sa_mask_pos : constant := Standard'Address_Size / 8;
- sa_flags_pos : constant := 128 + sa_mask_pos;
+ sa_handler_pos : constant := 0;
+ sa_mask_pos : constant := Standard'Address_Size / 8;
+ sa_flags_pos : constant := 128 + sa_mask_pos;
SA_SIGINFO : constant := 16#40#;
SA_ONSTACK : constant := 16#01#;
diff --git a/gcc/ada/s-linux-hppa.ads b/gcc/ada/s-linux-hppa.ads
index 2ee2ad9011d..16393c539f6 100644
--- a/gcc/ada/s-linux-hppa.ads
+++ b/gcc/ada/s-linux-hppa.ads
@@ -96,8 +96,9 @@ package System.Linux is
-- struct_sigaction offsets
- sa_flags_pos : constant := Standard'Address_Size / 8;
- sa_mask_pos : constant := sa_flags_pos * 2;
+ sa_handler_pos : constant := 0;
+ sa_flags_pos : constant := Standard'Address_Size / 8;
+ sa_mask_pos : constant := sa_flags_pos * 2;
SA_SIGINFO : constant := 16#10#;
SA_ONSTACK : constant := 16#01#;
diff --git a/gcc/ada/s-linux-mipsel.ads b/gcc/ada/s-linux-mipsel.ads
new file mode 100644
index 00000000000..c0911d8d16a
--- /dev/null
+++ b/gcc/ada/s-linux-mipsel.ads
@@ -0,0 +1,118 @@
+------------------------------------------------------------------------------
+-- --
+-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . L I N U X --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- --
+-- GNARL is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+------------------------------------------------------------------------------
+
+-- This is the mipsel version of this package
+
+-- This package encapsulates cpu specific differences between implementations
+-- of GNU/Linux, in order to share s-osinte-linux.ads.
+
+-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
+-- Preelaborate. This package is designed to be a bottom-level (leaf) package
+
+package System.Linux is
+ pragma Preelaborate;
+
+ -----------
+ -- Errno --
+ -----------
+
+ EAGAIN : constant := 11;
+ EINTR : constant := 4;
+ EINVAL : constant := 22;
+ ENOMEM : constant := 12;
+ EPERM : constant := 1;
+ ETIMEDOUT : constant := 110;
+
+ -------------
+ -- Signals --
+ -------------
+
+ SIGHUP : constant := 1; -- hangup
+ SIGINT : constant := 2; -- interrupt (rubout)
+ SIGQUIT : constant := 3; -- quit (ASCD FS)
+ SIGILL : constant := 4; -- illegal instruction (not reset)
+ SIGTRAP : constant := 5; -- trace trap (not reset)
+ SIGIOT : constant := 6; -- IOT instruction
+ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
+ SIGFPE : constant := 8; -- floating point exception
+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
+ SIGBUS : constant := 7; -- bus error
+ SIGSEGV : constant := 11; -- segmentation violation
+ SIGPIPE : constant := 13; -- write on a pipe with no one to read it
+ SIGALRM : constant := 14; -- alarm clock
+ SIGTERM : constant := 15; -- software termination signal from kill
+ SIGUSR1 : constant := 10; -- user defined signal 1
+ SIGUSR2 : constant := 12; -- user defined signal 2
+ SIGCLD : constant := 17; -- alias for SIGCHLD
+ SIGCHLD : constant := 17; -- child status change
+ SIGPWR : constant := 30; -- power-fail restart
+ SIGWINCH : constant := 28; -- window size change
+ SIGURG : constant := 23; -- urgent condition on IO channel
+ SIGPOLL : constant := 29; -- pollable event occurred
+ SIGIO : constant := 29; -- I/O now possible (4.2 BSD)
+ SIGLOST : constant := 29; -- File lock lost
+ SIGSTOP : constant := 19; -- stop (cannot be caught or ignored)
+ SIGTSTP : constant := 20; -- user stop requested from tty
+ SIGCONT : constant := 18; -- stopped process has been continued
+ SIGTTIN : constant := 21; -- background tty read attempted
+ SIGTTOU : constant := 22; -- background tty write attempted
+ SIGVTALRM : constant := 26; -- virtual timer expired
+ SIGPROF : constant := 27; -- profiling timer expired
+ SIGXCPU : constant := 24; -- CPU time limit exceeded
+ SIGXFSZ : constant := 25; -- filesize limit exceeded
+ SIGUNUSED : constant := 31; -- unused signal (GNU/Linux)
+ SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux)
+ SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal
+ SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal
+ SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal
+
+ -- struct_sigaction offsets
+
+ sa_handler_pos : constant := Standard'Address_Size / 8;
+ sa_mask_pos : constant := 2 * Standard'Address_Size / 8;
+ sa_flags_pos : constant := 0;
+
+ SA_SIGINFO : constant := 16#04#;
+ SA_ONSTACK : constant := 16#08000000#;
+
+ type struct_pthread_fast_lock is record
+ status : Long_Integer;
+ spinlock : Integer;
+ end record;
+ pragma Convention (C, struct_pthread_fast_lock);
+
+ type pthread_mutex_t is record
+ m_reserved : Integer;
+ m_count : Integer;
+ m_owner : System.Address;
+ m_kind : Integer;
+ m_lock : struct_pthread_fast_lock;
+ end record;
+ pragma Convention (C, pthread_mutex_t);
+
+end System.Linux;
diff --git a/gcc/ada/s-linux.ads b/gcc/ada/s-linux.ads
index b0612bd2d42..83b07c018e6 100644
--- a/gcc/ada/s-linux.ads
+++ b/gcc/ada/s-linux.ads
@@ -94,8 +94,9 @@ package System.Linux is
-- struct_sigaction offsets
- sa_mask_pos : constant := Standard'Address_Size / 8;
- sa_flags_pos : constant := 128 + sa_mask_pos;
+ sa_handler_pos : constant := 0;
+ sa_mask_pos : constant := Standard'Address_Size / 8;
+ sa_flags_pos : constant := 128 + sa_mask_pos;
SA_SIGINFO : constant := 16#04#;
SA_ONSTACK : constant := 16#08000000#;
diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index c3511b9b52f..694fcf1b622 100644
--- a/gcc/ada/s-oscons-tmplt.c
+++ b/gcc/ada/s-oscons-tmplt.c
@@ -1181,6 +1181,19 @@ TXT(" subtype H_Length_T is Interfaces.C." h_length_t ";")
/*
+ -- Fields of struct msghdr
+*/
+
+#if defined (__sun__) || defined (__hpux__)
+# define msg_iovlen_t "int"
+#else
+# define msg_iovlen_t "size_t"
+#endif
+
+TXT(" subtype Msg_Iovlen_T is Interfaces.C." msg_iovlen_t ";")
+
+/*
+
----------------------------------------
-- Properties of supported interfaces --
----------------------------------------
diff --git a/gcc/ada/s-osinte-darwin.ads b/gcc/ada/s-osinte-darwin.ads
index 66c2ac0b92e..71cbe1517ab 100644
--- a/gcc/ada/s-osinte-darwin.ads
+++ b/gcc/ada/s-osinte-darwin.ads
@@ -285,7 +285,7 @@ package System.OS_Interface is
pragma Import (C, Alternate_Stack, "__gnat_alternate_stack");
-- The alternate signal stack for stack overflows
- Alternate_Stack_Size : constant := 64 * 1024;
+ Alternate_Stack_Size : constant := 32 * 1024;
-- This must be in keeping with init.c:__gnat_alternate_stack
Stack_Base_Available : constant Boolean := False;
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index a663aa8de9b..5d2fdccb69f 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -513,9 +513,9 @@ private
pragma Warnings (Off);
for struct_sigaction use record
- sa_handler at 0 range 0 .. Standard'Address_Size - 1;
- sa_mask at Linux.sa_mask_pos range 0 .. 1023;
- sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1;
+ sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1;
+ sa_mask at Linux.sa_mask_pos range 0 .. 1023;
+ sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1;
end record;
-- We intentionally leave sa_restorer unspecified and let the compiler
-- append it after the last field, so disable corresponding warning.
diff --git a/gcc/ada/s-stausa.adb b/gcc/ada/s-stausa.adb
index 859a9de8564..dfa8a1fc6bb 100644
--- a/gcc/ada/s-stausa.adb
+++ b/gcc/ada/s-stausa.adb
@@ -173,7 +173,7 @@ package body System.Stack_Usage is
Index_Str : constant String := "Index";
Task_Name_Str : constant String := "Task Name";
Stack_Size_Str : constant String := "Stack Size";
- Actual_Size_Str : constant String := "Stack usage [min - max]";
+ Actual_Size_Str : constant String := "Stack usage";
function Get_Usage_Range (Result : Task_Result) return String;
-- Return string representing the range of possible result of stack usage
@@ -203,10 +203,10 @@ package body System.Stack_Usage is
Result_Array := new Result_Array_Type (1 .. Buffer_Size);
Result_Array.all :=
(others =>
- (Task_Name => (others => ASCII.NUL),
- Min_Measure => 0,
- Max_Measure => 0,
- Max_Size => 0));
+ (Task_Name => (others => ASCII.NUL),
+ Variation => 0,
+ Value => 0,
+ Max_Size => 0));
-- Set the Is_Enabled flag to true, so that the task wrapper knows that
-- it has to handle dynamic stack analysis
@@ -222,16 +222,16 @@ package body System.Stack_Usage is
if Stack_Size_Chars /= Null_Address then
declare
- Stack_Size : Integer;
+ My_Stack_Size : Integer;
begin
- Stack_Size := System.CRTL.atoi (Stack_Size_Chars) * 1024;
+ My_Stack_Size := System.CRTL.atoi (Stack_Size_Chars) * 1024;
Initialize_Analyzer
(Environment_Task_Analyzer,
"ENVIRONMENT TASK",
- Stack_Size,
- Stack_Size,
+ My_Stack_Size,
+ My_Stack_Size,
System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address));
Fill_Stack (Environment_Task_Analyzer);
@@ -318,7 +318,7 @@ package body System.Stack_Usage is
procedure Initialize_Analyzer
(Analyzer : in out Stack_Analyzer;
Task_Name : String;
- Stack_Size : Natural;
+ My_Stack_Size : Natural;
Max_Pattern_Size : Natural;
Bottom : Stack_Address;
Pattern : Unsigned_32 := 16#DEAD_BEEF#)
@@ -327,12 +327,11 @@ package body System.Stack_Usage is
-- Initialize the analyzer fields
Analyzer.Bottom_Of_Stack := Bottom;
- Analyzer.Stack_Size := Stack_Size;
- Analyzer.Pattern_Size := Max_Pattern_Size;
- Analyzer.Pattern := Pattern;
- Analyzer.Result_Id := Next_Id;
-
- Analyzer.Task_Name := (others => ' ');
+ Analyzer.Stack_Size := My_Stack_Size;
+ Analyzer.Pattern_Size := Max_Pattern_Size;
+ Analyzer.Pattern := Pattern;
+ Analyzer.Result_Id := Next_Id;
+ Analyzer.Task_Name := (others => ' ');
-- Compute the task name, and truncate if bigger than Task_Name_Length
@@ -414,11 +413,12 @@ package body System.Stack_Usage is
---------------------
function Get_Usage_Range (Result : Task_Result) return String is
- Min_Used_Str : constant String := Natural'Image (Result.Min_Measure);
- Max_Used_Str : constant String := Natural'Image (Result.Max_Measure);
+ Variation_Used_Str : constant String :=
+ Natural'Image (Result.Variation);
+ Value_Used_Str : constant String :=
+ Natural'Image (Result.Value);
begin
- return "[" & Min_Used_Str (2 .. Min_Used_Str'Last) & " -"
- & Max_Used_Str & "]";
+ return Value_Used_Str & " +/- " & Variation_Used_Str;
end Get_Usage_Range;
---------------------
@@ -431,16 +431,16 @@ package body System.Stack_Usage is
Max_Stack_Size_Len : Natural;
Max_Actual_Use_Len : Natural)
is
- Result_Id_Str : constant String := Natural'Image (Result_Id);
- Stack_Size_Str : constant String := Natural'Image (Result.Max_Size);
- Actual_Use_Str : constant String := Get_Usage_Range (Result);
+ Result_Id_Str : constant String := Natural'Image (Result_Id);
+ My_Stack_Size_Str : constant String := Natural'Image (Result.Max_Size);
+ Actual_Use_Str : constant String := Get_Usage_Range (Result);
Result_Id_Blanks : constant
String (1 .. Index_Str'Length - Result_Id_Str'Length) :=
(others => ' ');
Stack_Size_Blanks : constant
- String (1 .. Max_Stack_Size_Len - Stack_Size_Str'Length) :=
+ String (1 .. Max_Stack_Size_Len - My_Stack_Size_Str'Length) :=
(others => ' ');
Actual_Use_Blanks : constant
@@ -453,7 +453,7 @@ package body System.Stack_Usage is
Put (" | ");
Put (Result.Task_Name);
Put (" | ");
- Put (Stack_Size_Blanks & Stack_Size_Str);
+ Put (Stack_Size_Blanks & My_Stack_Size_Str);
Put (" | ");
Put (Actual_Use_Blanks & Actual_Use_Str);
New_Line;
@@ -488,8 +488,8 @@ package body System.Stack_Usage is
for J in Result_Array'Range loop
exit when J >= Next_Id;
- if Result_Array (J).Max_Measure
- > Result_Array (Max_Actual_Use_Result_Id).Max_Measure
+ if Result_Array (J).Value >
+ Result_Array (Max_Actual_Use_Result_Id).Value
then
Max_Actual_Use_Result_Id := J;
end if;
@@ -559,28 +559,34 @@ package body System.Stack_Usage is
Result : Task_Result :=
(Task_Name => Analyzer.Task_Name,
Max_Size => Analyzer.Stack_Size,
- Min_Measure => 0,
- Max_Measure => 0);
+ Variation => 0,
+ Value => 0);
Overflow_Guard : constant Integer :=
Analyzer.Stack_Size
- Stack_Size (Analyzer.Top_Pattern_Mark, Analyzer.Bottom_Of_Stack);
+ Max, Min : Positive;
begin
if Analyzer.Pattern_Size = 0 then
+
-- If we have that result, it means that we didn't do any computation
-- at all. In other words, we used at least everything (and possibly
-- more).
- Result.Min_Measure := Analyzer.Stack_Size - Overflow_Guard;
- Result.Max_Measure := Analyzer.Stack_Size;
+ Min := Analyzer.Stack_Size - Overflow_Guard;
+ Max := Analyzer.Stack_Size;
+
else
- Result.Min_Measure := Stack_Size
- (Analyzer.Topmost_Touched_Mark,
- Analyzer.Bottom_Of_Stack);
- Result.Max_Measure := Result.Min_Measure + Overflow_Guard;
+ Min :=
+ Stack_Size
+ (Analyzer.Topmost_Touched_Mark, Analyzer.Bottom_Of_Stack);
+ Max := Min + Overflow_Guard;
end if;
+ Result.Value := (Max + Min) / 2;
+ Result.Variation := (Max - Min) / 2;
+
if Analyzer.Result_Id in Result_Array'Range then
-- If the result can be stored, then store it in Result_Array
diff --git a/gcc/ada/s-stausa.ads b/gcc/ada/s-stausa.ads
index af536560c1c..9aa432b129c 100644
--- a/gcc/ada/s-stausa.ads
+++ b/gcc/ada/s-stausa.ads
@@ -46,6 +46,26 @@ package System.Stack_Usage is
(Value : System.Address) return Stack_Address
renames System.Storage_Elements.To_Integer;
+ Task_Name_Length : constant := 32;
+ -- The maximum length of task name displayed.
+ -- ??? Consider merging this variable with Max_Task_Image_Length.
+
+ type Task_Result is record
+ Task_Name : String (1 .. Task_Name_Length);
+
+ Value : Natural;
+ -- Amount of stack used. The value is calculated on the basis of the
+ -- mechanism used by GNAT to allocate it, and it is NOT a precise value.
+
+ Variation : Natural;
+ -- Possible variation in the amount of used stack. The real stack usage
+ -- may vary in the range Value +/- Variation
+
+ Max_Size : Natural;
+ end record;
+
+ type Result_Array_Type is array (Positive range <>) of Task_Result;
+
type Stack_Analyzer is private;
-- Type of the stack analyzer tool. It is used to fill a portion of the
-- stack with Pattern, and to compute the stack used after some execution.
@@ -206,7 +226,7 @@ package System.Stack_Usage is
procedure Initialize_Analyzer
(Analyzer : in out Stack_Analyzer;
Task_Name : String;
- Stack_Size : Natural;
+ My_Stack_Size : Natural;
Max_Pattern_Size : Natural;
Bottom : Stack_Address;
Pattern : Interfaces.Unsigned_32 := 16#DEAD_BEEF#);
@@ -256,10 +276,6 @@ package System.Stack_Usage is
private
- Task_Name_Length : constant := 32;
- -- The maximum length of task name displayed.
- -- ??? Consider merging this variable with Max_Task_Image_Length.
-
package Unsigned_32_Addr is
new System.Address_To_Access_Conversions (Interfaces.Unsigned_32);
@@ -308,20 +324,6 @@ private
Compute_Environment_Task : Boolean;
- type Task_Result is record
- Task_Name : String (1 .. Task_Name_Length);
-
- Min_Measure : Natural;
- -- Minimum value for the measure
-
- Max_Measure : Natural;
- -- Maximum value for the measure, taking into account the actual size
- -- of the pattern filled.
-
- Max_Size : Natural;
- end record;
-
- type Result_Array_Type is array (Positive range <>) of Task_Result;
type Result_Array_Ptr is access all Result_Array_Type;
Result_Array : Result_Array_Ptr;
diff --git a/gcc/ada/s-stusta.adb b/gcc/ada/s-stusta.adb
new file mode 100644
index 00000000000..adea8dfcdc9
--- /dev/null
+++ b/gcc/ada/s-stusta.adb
@@ -0,0 +1,261 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . S T A C K _ U S A G E . T A S K I N G --
+-- --
+-- B o d y --
+-- --
+-- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- --
+-- GNARL is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNARL; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit 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 Public License. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- --
+------------------------------------------------------------------------------
+
+with System.Stack_Usage;
+
+-- This is why this package is part of GNARL:
+
+with System.Tasking.Debug;
+with System.Task_Primitives.Operations;
+
+with System.IO;
+
+package body System.Stack_Usage.Tasking is
+ use System.IO;
+
+ procedure Report_For_Task (Id : System.Tasking.Task_Id);
+ -- A generic procedure calculating stack usage for a given task
+
+ procedure Compute_All_Tasks;
+ -- Compute the stack usage for all tasks and saves it in
+ -- System.Stack_Usage.Result_Array
+
+ procedure Compute_Current_Task;
+ -- Compute the stack usage for a given task and saves it in the a precise
+ -- slot in System.Stack_Usage.Result_Array;
+
+ procedure Report_Impl (All_Tasks : Boolean; Do_Print : Boolean);
+ -- Report the stack usage of either all tasks (All_Tasks = True) or of the
+ -- current task (All_Task = False). If Print is True, then results are
+ -- printed on stderr
+
+ procedure Convert
+ (TS : System.Stack_Usage.Task_Result;
+ Res : out Stack_Usage_Result);
+ -- Convert an object of type System.Stack_Usage in a Stack_Usage_Result
+
+ --------------
+ -- Convert --
+ --------------
+
+ procedure Convert
+ (TS : System.Stack_Usage.Task_Result;
+ Res : out Stack_Usage_Result) is
+ begin
+ Res := TS;
+ end Convert;
+
+ ----------------------
+ -- Report_For_Task --
+ ----------------------
+
+ procedure Report_For_Task (Id : System.Tasking.Task_Id) is
+ begin
+ System.Stack_Usage.Compute_Result (Id.Common.Analyzer);
+ System.Stack_Usage.Report_Result (Id.Common.Analyzer);
+ end Report_For_Task;
+
+ ------------------------
+ -- Compute_All_Tasks --
+ ------------------------
+
+ procedure Compute_All_Tasks is
+ Id : System.Tasking.Task_Id;
+ use type System.Tasking.Task_Id;
+ begin
+ if not System.Stack_Usage.Is_Enabled then
+ Put ("Stack Usage not enabled: bind with -uNNN switch");
+ else
+
+ -- Loop over all tasks
+
+ for J in System.Tasking.Debug.Known_Tasks'First + 1
+ .. System.Tasking.Debug.Known_Tasks'Last
+ loop
+ Id := System.Tasking.Debug.Known_Tasks (J);
+ exit when Id = null;
+
+ -- Calculate the task usage for a given task
+
+ Report_For_Task (Id);
+ end loop;
+
+ end if;
+ end Compute_All_Tasks;
+
+ ---------------------------
+ -- Compute_Current_Task --
+ ---------------------------
+
+ procedure Compute_Current_Task is
+ begin
+ if not System.Stack_Usage.Is_Enabled then
+ Put ("Stack Usage not enabled: bind with -uNNN switch");
+ else
+
+ -- The current task
+
+ Report_For_Task (System.Tasking.Self);
+
+ end if;
+ end Compute_Current_Task;
+
+ ------------------
+ -- Report_Impl --
+ ------------------
+
+ procedure Report_Impl (All_Tasks : Boolean; Do_Print : Boolean) is
+ begin
+
+ -- Lock the runtime
+
+ System.Task_Primitives.Operations.Lock_RTS;
+
+ -- Calculate results
+
+ if All_Tasks then
+ Compute_All_Tasks;
+ else
+ Compute_Current_Task;
+ end if;
+
+ -- Output results
+ if Do_Print then
+ System.Stack_Usage.Output_Results;
+ end if;
+
+ -- Unlock the runtime
+
+ System.Task_Primitives.Operations.Unlock_RTS;
+
+ end Report_Impl;
+
+ ----------------------
+ -- Report_All_Task --
+ ----------------------
+
+ procedure Report_All_Tasks is
+ begin
+ Report_Impl (True, True);
+ end Report_All_Tasks;
+
+ --------------------------
+ -- Report_Current_Task --
+ --------------------------
+
+ procedure Report_Current_Task is
+ Res : Stack_Usage_Result;
+ begin
+ Res := Get_Current_Task_Usage;
+ Print (Res);
+ end Report_Current_Task;
+
+ --------------------------
+ -- Get_All_Tasks_Usage --
+ --------------------------
+
+ function Get_All_Tasks_Usage return Stack_Usage_Result_Array is
+ Res : Stack_Usage_Result_Array
+ (1 .. System.Stack_Usage.Result_Array'Length);
+ begin
+ Report_Impl (True, False);
+
+ for J in Res'Range loop
+ Convert (System.Stack_Usage.Result_Array (J), Res (J));
+ end loop;
+
+ return Res;
+ end Get_All_Tasks_Usage;
+
+ -----------------------------
+ -- Get_Current_Task_Usage --
+ -----------------------------
+
+ function Get_Current_Task_Usage return Stack_Usage_Result is
+ Res : Stack_Usage_Result;
+ Original : System.Stack_Usage.Task_Result;
+ Found : Boolean := False;
+ begin
+
+ Report_Impl (False, False);
+
+ -- Look for the task info in System.Stack_Usage.Result_Array;
+ -- the search is based on task name
+
+ for T in System.Stack_Usage.Result_Array'Range loop
+ if System.Stack_Usage.Result_Array (T).Task_Name =
+ System.Tasking.Self.Common.Analyzer.Task_Name
+ then
+ Original := System.Stack_Usage.Result_Array (T);
+ Found := True;
+ exit;
+ end if;
+ end loop;
+
+ -- Be sure a task has been found
+
+ pragma Assert (Found);
+
+ Convert (Original, Res);
+ return Res;
+ end Get_Current_Task_Usage;
+
+ ------------
+ -- Print --
+ ------------
+
+ procedure Print (Obj : Stack_Usage_Result) is
+ Pos : Positive;
+ begin
+
+ -- Simply trim the string containing the task name
+
+ for S in Obj.Task_Name'Range loop
+ if Obj.Task_Name (S) = ' ' then
+ Pos := S;
+ exit;
+ end if;
+ end loop;
+
+ declare
+ T_Name : constant String := Obj.Task_Name
+ (Obj.Task_Name'First .. Pos);
+ begin
+ Put_Line
+ ("| " & T_Name & " | " & Natural'Image (Obj.Max_Size) &
+ Natural'Image (Obj.Value) & " +/- " &
+ Natural'Image (Obj.Variation));
+ end;
+ end Print;
+
+end System.Stack_Usage.Tasking;
diff --git a/gcc/ada/s-stusta.ads b/gcc/ada/s-stusta.ads
new file mode 100644
index 00000000000..cc121d5fcf6
--- /dev/null
+++ b/gcc/ada/s-stusta.ads
@@ -0,0 +1,77 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
+-- --
+-- S Y S T E M . S T A C K _ U S A G E . T AS K I N G --
+-- --
+-- S p e c --
+-- --
+-- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- --
+-- GNARL is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
+-- OUT 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 distributed with GNARL; see file COPYING. If not, write --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit 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 Public License. --
+-- --
+-- GNARL was developed by the GNARL team at Florida State University. --
+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
+-- --
+------------------------------------------------------------------------------
+
+-- This package provides exported subprograms to be called at debug time to
+-- measure stack usage at run-time.
+
+-- Note: this package must be a child package of System.Stack_Usage to have
+-- visibility over its private part; it is however part of GNARL because it
+-- needs to access tasking features via System.Tasking.Debug and
+-- System.Task_Primitives.Operations;
+
+package System.Stack_Usage.Tasking is
+
+ procedure Report_All_Tasks;
+ -- Print the current stack usage of all tasks on stderr. Exported to be
+ -- called also in debug mode.
+
+ pragma Export
+ (C,
+ Report_All_Tasks,
+ "__gnat_tasks_stack_usage_report_all_tasks");
+
+ procedure Report_Current_Task;
+ -- Print the stack usage of current task on stderr. Exported to be called
+ -- also in debug mode.
+
+ pragma Export
+ (C,
+ Report_Current_Task,
+ "__gnat_tasks_stack_usage_report_current_task");
+
+ subtype Stack_Usage_Result is System.Stack_Usage.Task_Result;
+ -- This type is a descriptor for task stack usage result.
+
+ type Stack_Usage_Result_Array is
+ array (Positive range <>) of Stack_Usage_Result;
+
+ function Get_Current_Task_Usage return Stack_Usage_Result;
+ -- Return the current stack usage for the invoking task
+
+ function Get_All_Tasks_Usage return Stack_Usage_Result_Array;
+ -- Return an array containing the stack usage results for all tasks
+
+ procedure Print (Obj : Stack_Usage_Result);
+ -- Print Obj on stderr
+
+end System.Stack_Usage.Tasking;
diff --git a/gcc/ada/s-taskin.adb b/gcc/ada/s-taskin.adb
index ba5ef095345..35fcbdf92a1 100644
--- a/gcc/ada/s-taskin.adb
+++ b/gcc/ada/s-taskin.adb
@@ -176,9 +176,7 @@ package body System.Tasking is
procedure Initialize is
T : Task_Id;
Base_Priority : Any_Priority;
-
- Success : Boolean;
- pragma Warnings (Off, Success);
+ Success : Boolean;
begin
if Initialized then
@@ -195,7 +193,6 @@ package body System.Tasking is
Base_Priority := Priority (Main_Priority);
end if;
- Success := True;
T := STPO.New_ATCB (0);
Initialize_ATCB
(null, null, Null_Address, Null_Task, null, Base_Priority,
diff --git a/gcc/ada/scans.ads b/gcc/ada/scans.ads
index 1120f067b37..6f9bcb8c727 100644
--- a/gcc/ada/scans.ads
+++ b/gcc/ada/scans.ads
@@ -345,36 +345,43 @@ package Scans is
-- Note: these variables can only be referenced during the parsing of a
-- file. Reference to any of them from Sem or the expander is wrong.
- Scan_Ptr : Source_Ptr;
+ -- These variables are initialized as required by Scn.Initialize_Scanner,
+ -- and should not be referenced before such a call. However, there are
+ -- situations in which these variables are saved and restored, and this
+ -- may happen before the first Initialize_Scanner call, resulting in the
+ -- assignment of invalid values. To avoid this, and allow building with
+ -- the -gnatVa switch, we initialize some variables to known valid values.
+
+ Scan_Ptr : Source_Ptr := No_Location; -- init for -gnatVa
-- Current scan pointer location. After a call to Scan, this points
-- just past the end of the token just scanned.
- Token : Token_Type;
+ Token : Token_Type := No_Token; -- init for -gnatVa
-- Type of current token
- Token_Ptr : Source_Ptr;
+ Token_Ptr : Source_Ptr := No_Location; -- init for -gnatVa
-- Pointer to first character of current token
- Current_Line_Start : Source_Ptr;
- -- Pointer to first character of line containing current token
+ Current_Line_Start : Source_Ptr := No_Location; -- init for -gnatVa
+ -- Pointer to first character of line containing current token.
- Start_Column : Column_Number;
+ Start_Column : Column_Number := No_Column_Number; -- init for -gnatVa
-- Starting column number (zero origin) of the first non-blank character
-- on the line containing the current token. This is used for error
-- recovery circuits which depend on looking at the column line up.
- Type_Token_Location : Source_Ptr;
+ Type_Token_Location : Source_Ptr := No_Location; -- init for -gnatVa
-- Within a type declaration, gives the location of the TYPE keyword that
-- opened the type declaration. Used in checking the end column of a record
-- declaration, which can line up either with the TYPE keyword, or with the
-- start of the line containing the RECORD keyword.
- Checksum : Word;
+ Checksum : Word := 0; -- init for -gnatVa
-- Used to accumulate a CRC representing the tokens in the source
-- file being compiled. This CRC includes only program tokens, and
-- excludes comments.
- First_Non_Blank_Location : Source_Ptr;
+ First_Non_Blank_Location : Source_Ptr := No_Location; -- init for -gnatVa
-- Location of first non-blank character on the line containing the
-- current token (i.e. the location of the character whose column number
-- is stored in Start_Column).
diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb
index 914c101afdc..56b1e4cc404 100644
--- a/gcc/ada/scng.adb
+++ b/gcc/ada/scng.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -377,19 +377,19 @@ package body Scng is
if Source (Scan_Ptr) = '_' then
if Source (Scan_Ptr - 1) = '_' then
- Error_Msg_S
+ Error_Msg_S -- CODEFIX
("two consecutive underlines not permitted");
else
- Error_Msg_S
+ Error_Msg_S -- CODEFIX???
("underline cannot follow punctuation character");
end if;
else
if Source (Scan_Ptr - 1) = '_' then
- Error_Msg_S
+ Error_Msg_S -- CODEFIX???
("punctuation character cannot follow underline");
else
- Error_Msg_S
+ Error_Msg_S -- CODEFIX???
("two consecutive punctuation characters not permitted");
end if;
end if;
diff --git a/gcc/ada/sdefault.ads b/gcc/ada/sdefault.ads
index 3b3c8899875..21745fbb674 100644
--- a/gcc/ada/sdefault.ads
+++ b/gcc/ada/sdefault.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -25,7 +25,8 @@
-- This package contains functions that return the default values for the
-- include and object file directories, target name, default library
--- subdirectory (libsubdir) prefix, and the target OS.
+-- subdirectory (libsubdir) prefix, and the target OS. The body is generated
+-- automatically by the build process.
with Types; use Types;
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 2f8192b20cb..047460442fb 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -1618,9 +1618,12 @@ package body Sem is
Write_Unit_Info (Unit_Num, Item, Withs => True);
end if;
- -- Main unit should come last
+ -- Main unit should come last (except in the case where we
+ -- skipped System_Aux_Id, in which case we missed the things it
+ -- depends on).
- pragma Assert (not Done (Main_Unit));
+ pragma Assert
+ (not Done (Main_Unit) or else Present (System_Aux_Id));
-- We shouldn't do the same thing twice
@@ -1757,7 +1760,7 @@ package body Sem is
-- If it's a body, then ignore it, unless it's an instance (in
-- which case we do the spec), or it's the main unit (in which
-- case we do it). Note that it could be both, in which case we
- -- do the spec first.
+ -- do the with_clauses of spec and body first,
when N_Package_Body | N_Subprogram_Body =>
declare
@@ -1780,7 +1783,15 @@ package body Sem is
if Is_Generic_Instance (Entity) then
declare
Spec_Unit : constant Node_Id := Library_Unit (CU);
+
begin
+ -- Move context of body to that of spec, so it
+ -- appears before the spec itself, in case it
+ -- contains nested instances that generate late
+ -- with_clauses that got attached to the body.
+
+ Append_List
+ (Context_Items (CU), Context_Items (Spec_Unit));
Do_Unit_And_Dependents
(Spec_Unit, Unit (Spec_Unit));
end;
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 86c74cf6535..66653f643e9 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -756,12 +756,12 @@ package body Sem_Aggr is
-- Report at most two suggestions
if Nr_Of_Suggestions = 1 then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("\possible misspelling of&", Component, Suggestion_1);
elsif Nr_Of_Suggestions = 2 then
Error_Msg_Node_2 := Suggestion_2;
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("\possible misspelling of& or&", Component, Suggestion_1);
end if;
end Check_Misspelled_Component;
@@ -2175,6 +2175,11 @@ package body Sem_Aggr is
if Etype (Imm_Type) = Base_Type (A_Type) then
return True;
+ elsif Is_CPP_Constructor_Call (A)
+ and then Etype (Imm_Type) = Base_Type (Etype (A_Type))
+ then
+ return True;
+
-- The base type of the parent type may appear as a private
-- extension if it is declared as such in a parent unit of
-- the current one. For consistency of the subsequent analysis
@@ -2200,7 +2205,11 @@ package body Sem_Aggr is
-- Start of processing for Resolve_Extension_Aggregate
begin
+ -- Analyze the ancestor part and account for the case where it's
+ -- a parameterless function call.
+
Analyze (A);
+ Check_Parameterless_Call (A);
if not Is_Tagged_Type (Typ) then
Error_Msg_N ("type of extension aggregate must be tagged", N);
@@ -2247,8 +2256,11 @@ package body Sem_Aggr is
Get_First_Interp (A, I, It);
while Present (It.Typ) loop
+ -- Only consider limited interpretations in the Ada 2005 case
+
if Is_Tagged_Type (It.Typ)
- and then not Is_Limited_Type (It.Typ)
+ and then (Ada_Version >= Ada_05
+ or else not Is_Limited_Type (It.Typ))
then
if A_Type /= Any_Type then
Error_Msg_N ("cannot resolve expression", A);
@@ -2262,8 +2274,13 @@ package body Sem_Aggr is
end loop;
if A_Type = Any_Type then
- Error_Msg_N
- ("ancestor part must be non-limited tagged type", A);
+ if Ada_Version >= Ada_05 then
+ Error_Msg_N ("ancestor part must be of a tagged type", A);
+ else
+ Error_Msg_N
+ ("ancestor part must be of a nonlimited tagged type", A);
+ end if;
+
return;
end if;
@@ -2278,6 +2295,7 @@ package body Sem_Aggr is
if Is_Class_Wide_Type (Etype (A))
and then Nkind (Original_Node (A)) = N_Function_Call
+ and then not Is_CPP_Constructor_Call (Original_Node (A))
then
-- If the ancestor part is a dispatching call, it appears
-- statically to be a legal ancestor, but it yields any
@@ -2348,10 +2366,12 @@ package body Sem_Aggr is
procedure Add_Association
(Component : Entity_Id;
Expr : Node_Id;
+ Assoc_List : List_Id;
Is_Box_Present : Boolean := False);
-- Builds a new N_Component_Association node which associates
- -- Component to expression Expr and adds it to the new association
- -- list New_Assoc_List being built.
+ -- Component to expression Expr and adds it to the association
+ -- list being built, either New_Assoc_List, or the association
+ -- being build for an inner aggregate.
function Discr_Present (Discr : Entity_Id) return Boolean;
-- If aggregate N is a regular aggregate this routine will return True.
@@ -2398,6 +2418,7 @@ package body Sem_Aggr is
procedure Add_Association
(Component : Entity_Id;
Expr : Node_Id;
+ Assoc_List : List_Id;
Is_Box_Present : Boolean := False)
is
Choice_List : constant List_Id := New_List;
@@ -2410,7 +2431,7 @@ package body Sem_Aggr is
Choices => Choice_List,
Expression => Expr,
Box_Present => Is_Box_Present);
- Append (New_Assoc, New_Assoc_List);
+ Append (New_Assoc, Assoc_List);
end Add_Association;
-------------------
@@ -2764,6 +2785,14 @@ package body Sem_Aggr is
Check_Non_Static_Context (Expr);
Check_Unset_Reference (Expr);
+ -- Check wrong use of class-wide types
+
+ if Is_Class_Wide_Type (Etype (Expr))
+ and then not Is_CPP_Constructor_Call (Expr)
+ then
+ Error_Msg_N ("dynamically tagged expression not allowed", Expr);
+ end if;
+
if not Has_Expansion_Delayed (Expr) then
Aggregate_Constraint_Checks (Expr, Expr_Type);
end if;
@@ -2773,9 +2802,9 @@ package body Sem_Aggr is
end if;
if Relocate then
- Add_Association (New_C, Relocate_Node (Expr));
+ Add_Association (New_C, Relocate_Node (Expr), New_Assoc_List);
else
- Add_Association (New_C, Expr);
+ Add_Association (New_C, Expr, New_Assoc_List);
end if;
end Resolve_Aggr_Expr;
@@ -3050,12 +3079,27 @@ package body Sem_Aggr is
Parent_Typ_List := New_Elmt_List;
-- If this is an extension aggregate, the component list must
- -- include all components that are not in the given ancestor
- -- type. Otherwise, the component list must include components
- -- of all ancestors, starting with the root.
+ -- include all components that are not in the given ancestor type.
+ -- Otherwise, the component list must include components of all
+ -- ancestors, starting with the root.
if Nkind (N) = N_Extension_Aggregate then
- Root_Typ := Base_Type (Etype (Ancestor_Part (N)));
+
+ -- Handle case where ancestor part is a C++ constructor. In
+ -- this case it must be a function returning a class-wide type.
+ -- If the ancestor part is a C++ constructor, then it must be a
+ -- function returning a class-wide type, so handle that here.
+
+ if Is_CPP_Constructor_Call (Ancestor_Part (N)) then
+ pragma Assert
+ (Is_Class_Wide_Type (Etype (Ancestor_Part (N))));
+ Root_Typ := Root_Type (Etype (Ancestor_Part (N)));
+
+ -- Normal case, not a C++ constructor
+ else
+ Root_Typ := Base_Type (Etype (Ancestor_Part (N)));
+ end if;
+
else
Root_Typ := Root_Type (Typ);
@@ -3116,7 +3160,7 @@ package body Sem_Aggr is
-- Now collect components from all other ancestors, beginning
-- with the current type. If the type has unknown discriminants
- -- use the component list of the underlying_record_view, which
+ -- use the component list of the Underlying_Record_View, which
-- needs to be used for the subsequent expansion of the aggregate
-- into assignments.
@@ -3246,8 +3290,9 @@ package body Sem_Aggr is
New_Sloc => Sloc (N));
Add_Association
- (Component => Component,
- Expr => Expr);
+ (Component => Component,
+ Expr => Expr,
+ Assoc_List => New_Assoc_List);
Set_Has_Self_Reference (N);
-- A box-defaulted access component gets the value null. Also
@@ -3262,8 +3307,9 @@ package body Sem_Aggr is
Expr := Make_Null (Sloc (N));
Set_Etype (Expr, Ctyp);
Add_Association
- (Component => Component,
- Expr => Expr);
+ (Component => Component,
+ Expr => Expr,
+ Assoc_List => New_Assoc_List);
-- If the component's type is private with an access type as
-- its underlying type then we have to create an unchecked
@@ -3285,7 +3331,9 @@ package body Sem_Aggr is
begin
Analyze_And_Resolve (Convert_Null, Ctyp);
Add_Association
- (Component => Component, Expr => Convert_Null);
+ (Component => Component,
+ Expr => Convert_Null,
+ Assoc_List => New_Assoc_List);
end;
end if;
@@ -3294,103 +3342,228 @@ package body Sem_Aggr is
then
if Is_Record_Type (Ctyp)
and then Has_Discriminants (Ctyp)
+ and then not Is_Private_Type (Ctyp)
then
-- We build a partially initialized aggregate with the
-- values of the discriminants and box initialization
-- for the rest, if other components are present.
-
- declare
+ -- The type of the aggregate is the known subtype of
+ -- the component. The capture of discriminants must
+ -- be recursive because subcomponents may be contrained
+ -- (transitively) by discriminants of enclosing types.
+ -- For a private type with discriminants, a call to the
+ -- initialization procedure will be generated, and no
+ -- subaggregate is needed.
+
+ Capture_Discriminants : declare
Loc : constant Source_Ptr := Sloc (N);
- Assoc : Node_Id;
- Discr : Entity_Id;
- Discr_Elmt : Elmt_Id;
- Discr_Val : Node_Id;
Expr : Node_Id;
- begin
- Expr := Make_Aggregate (Loc, New_List, New_List);
+ procedure Add_Discriminant_Values
+ (New_Aggr : Node_Id;
+ Assoc_List : List_Id);
+ -- The constraint to a component may be given by a
+ -- discriminant of the enclosing type, in which case
+ -- we have to retrieve its value, which is part of the
+ -- enclosing aggregate. Assoc_List provides the
+ -- discriminant associations of the current type or
+ -- of some enclosing record.
+
+ procedure Propagate_Discriminants
+ (Aggr : Node_Id;
+ Assoc_List : List_Id;
+ Comp : Entity_Id);
+ -- Nested components may themselves be discriminated
+ -- types constrained by outer discriminants. Their
+ -- values must be captured before the aggregate is
+ -- expanded into assignments.
+
+ -----------------------------
+ -- Add_Discriminant_Values --
+ -----------------------------
+
+ procedure Add_Discriminant_Values
+ (New_Aggr : Node_Id;
+ Assoc_List : List_Id)
+ is
+ Assoc : Node_Id;
+ Discr : Entity_Id;
+ Discr_Elmt : Elmt_Id;
+ Discr_Val : Node_Id;
+ Val : Entity_Id;
- Discr_Elmt :=
- First_Elmt (Discriminant_Constraint (Ctyp));
- while Present (Discr_Elmt) loop
- Discr_Val := Node (Discr_Elmt);
-
- -- The constraint may be given by a discriminant
- -- of the enclosing type, in which case we have
- -- to retrieve its value, which is part of the
- -- current aggregate.
-
- if Is_Entity_Name (Discr_Val)
- and then
- Ekind (Entity (Discr_Val)) = E_Discriminant
- then
- Discr := Entity (Discr_Val);
-
- Assoc := First (New_Assoc_List);
- while Present (Assoc) loop
- if Present
- (Entity (First (Choices (Assoc))))
- and then
- Entity (First (Choices (Assoc))) = Discr
- then
- Discr_Val := Expression (Assoc);
- exit;
- end if;
- Next (Assoc);
- end loop;
- end if;
-
- Append
- (New_Copy_Tree (Discr_Val), Expressions (Expr));
+ begin
+ Discr := First_Discriminant (Etype (New_Aggr));
+ Discr_Elmt :=
+ First_Elmt
+ (Discriminant_Constraint (Etype (New_Aggr)));
+ while Present (Discr_Elmt) loop
+ Discr_Val := Node (Discr_Elmt);
+
+ -- If the constraint is given by a discriminant
+ -- it is a discriminant of an enclosing record,
+ -- and its value has already been placed in the
+ -- association list.
+
+ if Is_Entity_Name (Discr_Val)
+ and then
+ Ekind (Entity (Discr_Val)) = E_Discriminant
+ then
+ Val := Entity (Discr_Val);
+
+ Assoc := First (Assoc_List);
+ while Present (Assoc) loop
+ if Present
+ (Entity (First (Choices (Assoc))))
+ and then
+ Entity (First (Choices (Assoc)))
+ = Val
+ then
+ Discr_Val := Expression (Assoc);
+ exit;
+ end if;
+ Next (Assoc);
+ end loop;
+ end if;
- -- If the discriminant constraint is a current
- -- instance, mark the current aggregate so that
- -- the self-reference can be expanded later.
+ Add_Association
+ (Discr, New_Copy_Tree (Discr_Val),
+ Component_Associations (New_Aggr));
- if Nkind (Discr_Val) = N_Attribute_Reference
- and then Is_Entity_Name (Prefix (Discr_Val))
- and then Is_Type (Entity (Prefix (Discr_Val)))
- and then Etype (N) = Entity (Prefix (Discr_Val))
- then
- Set_Has_Self_Reference (N);
- end if;
+ -- If the discriminant constraint is a current
+ -- instance, mark the current aggregate so that
+ -- the self-reference can be expanded later.
- Next_Elmt (Discr_Elmt);
- end loop;
+ if Nkind (Discr_Val) = N_Attribute_Reference
+ and then Is_Entity_Name (Prefix (Discr_Val))
+ and then Is_Type (Entity (Prefix (Discr_Val)))
+ and then Etype (N) =
+ Entity (Prefix (Discr_Val))
+ then
+ Set_Has_Self_Reference (N);
+ end if;
- declare
- Comp : Entity_Id;
+ Next_Elmt (Discr_Elmt);
+ Next_Discriminant (Discr);
+ end loop;
+ end Add_Discriminant_Values;
+
+ ------------------------------
+ -- Propagate_Discriminants --
+ ------------------------------
+
+ procedure Propagate_Discriminants
+ (Aggr : Node_Id;
+ Assoc_List : List_Id;
+ Comp : Entity_Id)
+ is
+ Inner_Comp : Entity_Id;
+ Comp_Type : Entity_Id;
+ Needs_Box : Boolean := False;
+ New_Aggr : Node_Id;
begin
- -- Look for a component that is not a discriminant
- -- before creating an others box association.
-
- Comp := First_Component (Ctyp);
- while Present (Comp) loop
- if Ekind (Comp) = E_Component then
- Append
- (Make_Component_Association (Loc,
- Choices =>
- New_List (Make_Others_Choice (Loc)),
- Expression => Empty,
- Box_Present => True),
- Component_Associations (Expr));
- exit;
+
+ Inner_Comp := First_Component (Etype (Comp));
+ while Present (Inner_Comp) loop
+ Comp_Type := Etype (Inner_Comp);
+
+ if Is_Record_Type (Comp_Type)
+ and then Has_Discriminants (Comp_Type)
+ then
+ New_Aggr :=
+ Make_Aggregate (Loc, New_List, New_List);
+ Set_Etype (New_Aggr, Comp_Type);
+ Add_Association
+ (Inner_Comp, New_Aggr,
+ Component_Associations (Aggr));
+
+ -- Collect discriminant values and recurse
+
+ Add_Discriminant_Values
+ (New_Aggr, Assoc_List);
+ Propagate_Discriminants
+ (New_Aggr, Assoc_List, Inner_Comp);
+
+ else
+ Needs_Box := True;
end if;
- Next_Component (Comp);
+ Next_Component (Inner_Comp);
end loop;
- end;
+
+ if Needs_Box then
+ Append
+ (Make_Component_Association (Loc,
+ Choices =>
+ New_List (Make_Others_Choice (Loc)),
+ Expression => Empty,
+ Box_Present => True),
+ Component_Associations (Aggr));
+ end if;
+ end Propagate_Discriminants;
+
+ begin
+ Expr := Make_Aggregate (Loc, New_List, New_List);
+ Set_Etype (Expr, Ctyp);
+
+ -- If the enclosing type has discriminants, they
+ -- have been collected in the aggregate earlier, and
+ -- they may appear as constraints of subcomponents.
+ -- Similarly if this component has discriminants, they
+ -- might it turn be propagated to their components.
+
+ if Has_Discriminants (Typ) then
+ Add_Discriminant_Values (Expr, New_Assoc_List);
+ Propagate_Discriminants
+ (Expr, New_Assoc_List, Component);
+
+ elsif Has_Discriminants (Ctyp) then
+ Add_Discriminant_Values
+ (Expr, Component_Associations (Expr));
+ Propagate_Discriminants
+ (Expr, Component_Associations (Expr), Component);
+
+ else
+ declare
+ Comp : Entity_Id;
+
+ begin
+ -- If the type has additional components, create
+ -- an others box association for them.
+
+ Comp := First_Component (Ctyp);
+ while Present (Comp) loop
+ if Ekind (Comp) = E_Component then
+ if not Is_Record_Type (Etype (Comp)) then
+ Append
+ (Make_Component_Association (Loc,
+ Choices =>
+ New_List
+ (Make_Others_Choice (Loc)),
+ Expression => Empty,
+ Box_Present => True),
+ Component_Associations (Expr));
+ end if;
+ exit;
+ end if;
+
+ Next_Component (Comp);
+ end loop;
+ end;
+ end if;
Add_Association
- (Component => Component,
- Expr => Expr);
- end;
+ (Component => Component,
+ Expr => Expr,
+ Assoc_List => New_Assoc_List);
+ end Capture_Discriminants;
else
Add_Association
(Component => Component,
Expr => Empty,
+ Assoc_List => New_Assoc_List,
Is_Box_Present => True);
end if;
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index d4545c0a1e5..028d8b54ac3 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,6 +35,7 @@ with Exp_Dist; use Exp_Dist;
with Exp_Util; use Exp_Util;
with Expander; use Expander;
with Freeze; use Freeze;
+with Gnatvsn; use Gnatvsn;
with Itypes; use Itypes;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
@@ -420,7 +421,8 @@ package body Sem_Attr is
-- an access, we set a flag to kill all tracked values on any call
-- because this access value may be passed around, and any called
-- code might use it to access a local procedure which clobbers a
- -- tracked value.
+ -- tracked value. If the scope is a loop or block, indicate that
+ -- value tracking is disabled for the enclosing subprogram.
function Get_Kind (E : Entity_Id) return Entity_Kind;
-- Distinguish between access to regular/protected subprograms
@@ -433,6 +435,8 @@ package body Sem_Attr is
begin
if not Is_Library_Level_Entity (E) then
Set_Suppress_Value_Tracking_On_Call (Current_Scope);
+ Set_Suppress_Value_Tracking_On_Call
+ (Nearest_Dynamic_Scope (Current_Scope));
end if;
end Check_Local_Access;
@@ -1065,7 +1069,13 @@ package body Sem_Attr is
-- the designated type of the access type, since the type of
-- the referenced array is this type (see AI95-00106).
- Freeze_Before (N, Designated_Type (P_Type));
+ -- As done elsewhere, freezing must not happen when pre-analyzing
+ -- a pre- or postcondition or a default value for an object or
+ -- for a formal parameter.
+
+ if not In_Spec_Expression then
+ Freeze_Before (N, Designated_Type (P_Type));
+ end if;
Rewrite (P,
Make_Explicit_Dereference (Sloc (P),
@@ -2535,6 +2545,16 @@ package body Sem_Attr is
Set_Etype (N, RTE (RE_Address));
+ ----------------------
+ -- Compiler_Version --
+ ----------------------
+
+ when Attribute_Compiler_Version =>
+ Check_E0;
+ Check_Standard_Prefix;
+ Rewrite (N, Make_String_Literal (Loc, "GNAT " & Gnat_Version_String));
+ Analyze_And_Resolve (N, Standard_String);
+
--------------------
-- Component_Size --
--------------------
@@ -7473,6 +7493,7 @@ package body Sem_Attr is
Attribute_Caller |
Attribute_Class |
Attribute_Code_Address |
+ Attribute_Compiler_Version |
Attribute_Count |
Attribute_Default_Bit_Order |
Attribute_Elaborated |
diff --git a/gcc/ada/sem_cat.ads b/gcc/ada/sem_cat.ads
index c86bb3c0cc1..cc667aad123 100644
--- a/gcc/ada/sem_cat.ads
+++ b/gcc/ada/sem_cat.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -113,9 +113,8 @@ package Sem_Cat is
-- Apply semantic checks given in E2.3(10-14)
procedure Validate_RCI_Subprogram_Declaration (N : Node_Id);
- -- Check for RCI unit subprogram declarations with respect to
- -- in-lined subprogram and subprogram with access parameter or
- -- limited type parameter without Read and Write.
+ -- Check RCI subprogram declarations for illegal inlining and formals not
+ -- supporting external streaming.
procedure Validate_Remote_Access_To_Class_Wide_Type (N : Node_Id);
-- Checks that Storage_Pool and Storage_Size attribute references are
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 82b221f1a21..8882713a852 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -734,7 +734,7 @@ package body Sem_Ch10 is
-- in its scope. Finally we create a Units table entry for
-- the subprogram declaration, to maintain a one-to-one
-- correspondence with compilation unit nodes. This is
- -- critical for the tree traversals performed by Inspector.
+ -- critical for the tree traversals performed by Codepeer.
declare
Loc : constant Source_Ptr := Sloc (N);
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 697c3133334..b84cf1ea8d1 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -634,8 +634,8 @@ package body Sem_Ch12 is
-- loaded. In that case a missing body is acceptable.
procedure Inherit_Context (Gen_Decl : Node_Id; Inst : Node_Id);
- -- Add the context clause of the unit containing a generic unit to an
- -- instantiation that is a compilation unit.
+ -- Add the context clause of the unit containing a generic unit to a
+ -- compilation unit that is, or contains, an instantiation.
function Get_Associated_Node (N : Node_Id) return Node_Id;
-- In order to propagate semantic information back from the analyzed copy
@@ -4360,7 +4360,7 @@ package body Sem_Ch12 is
Old_Main : constant Entity_Id := Cunit_Entity (Main_Unit);
begin
- -- A new compilation unit node is built for the instance declaration
+ -- A new compilation unit node is built for the instance declaration.
Decl_Cunit :=
Make_Compilation_Unit (Sloc (N),
@@ -5740,9 +5740,9 @@ package body Sem_Ch12 is
then
if not Instantiating then
- -- Link both nodes in order to assign subsequently the
- -- entity of the copy to the original node, in case this
- -- is a global reference.
+ -- Link both nodes in order to assign subsequently the entity of
+ -- the copy to the original node, in case this is a global
+ -- reference.
Set_Associated_Node (N, New_N);
@@ -6935,9 +6935,19 @@ package body Sem_Ch12 is
Item := First (Context_Items (Parent (Gen_Decl)));
while Present (Item) loop
if Nkind (Item) = N_With_Clause then
- New_I := New_Copy (Item);
- Set_Implicit_With (New_I, True);
- Append (New_I, Current_Context);
+
+ -- Take care to prevent direct cyclic with's, which can happen
+ -- if the generic body with's the current unit. Such a case
+ -- would result in binder errors (or run-time errors if the
+ -- -gnatE switch is in effect), but we want to prevent it here,
+ -- because Sem.Walk_Library_Items doesn't like cycles. Note
+ -- that we don't bother to detect indirect cycles.
+
+ if Library_Unit (Item) /= Current_Unit then
+ New_I := New_Copy (Item);
+ Set_Implicit_With (New_I, True);
+ Append (New_I, Current_Context);
+ end if;
end if;
Next (Item);
@@ -8777,12 +8787,12 @@ package body Sem_Ch12 is
Act_Decl : constant Node_Id := Body_Info.Act_Decl;
Inst_Node : constant Node_Id := Body_Info.Inst_Node;
Loc : constant Source_Ptr := Sloc (Inst_Node);
- Gen_Id : constant Node_Id := Name (Inst_Node);
- Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node);
- Gen_Decl : constant Node_Id := Unit_Declaration_Node (Gen_Unit);
- Anon_Id : constant Entity_Id :=
+ Gen_Id : constant Node_Id := Name (Inst_Node);
+ Gen_Unit : constant Entity_Id := Get_Generic_Entity (Inst_Node);
+ Gen_Decl : constant Node_Id := Unit_Declaration_Node (Gen_Unit);
+ Anon_Id : constant Entity_Id :=
Defining_Unit_Name (Specification (Act_Decl));
- Pack_Id : constant Entity_Id :=
+ Pack_Id : constant Entity_Id :=
Defining_Unit_Name (Parent (Act_Decl));
Decls : List_Id;
Gen_Body : Node_Id;
@@ -11867,6 +11877,8 @@ package body Sem_Ch12 is
-- transformation is propagated to the generic unit.
procedure Save_References (N : Node_Id) is
+ Loc : constant Source_Ptr := Sloc (N);
+
begin
if N = Empty then
null;
@@ -12008,10 +12020,8 @@ package body Sem_Ch12 is
elsif Nkind (N2) = N_Explicit_Dereference then
- -- An identifier is rewritten as a dereference if it is
- -- the prefix in a selected component, and it denotes an
- -- access to a composite type, or a parameterless function
- -- call that returns an access type.
+ -- An identifier is rewritten as a dereference if it is the
+ -- prefix in an implicit dereference.
-- Check whether corresponding entity in prefix is global
@@ -12020,23 +12030,18 @@ package body Sem_Ch12 is
and then Is_Global (Entity (Prefix (N2)))
then
Rewrite (N,
- Make_Explicit_Dereference (Sloc (N),
- Prefix => Make_Identifier (Sloc (N),
- Chars => Chars (N))));
- Set_Associated_Node (Prefix (N), Prefix (N2));
-
+ Make_Explicit_Dereference (Loc,
+ Prefix =>
+ New_Occurrence_Of (Entity (Prefix (N2)), Loc)));
elsif Nkind (Prefix (N2)) = N_Function_Call
and then Is_Global (Entity (Name (Prefix (N2))))
then
Rewrite (N,
- Make_Explicit_Dereference (Sloc (N),
- Prefix => Make_Function_Call (Sloc (N),
- Name =>
- Make_Identifier (Sloc (N),
- Chars => Chars (N)))));
-
- Set_Associated_Node
- (Name (Prefix (N)), Name (Prefix (N2)));
+ Make_Explicit_Dereference (Loc,
+ Prefix => Make_Function_Call (Loc,
+ Name =>
+ New_Occurrence_Of (Entity (Name (Prefix (N2))),
+ Loc))));
else
Set_Associated_Node (N, Empty);
@@ -12063,7 +12068,6 @@ package body Sem_Ch12 is
else
declare
- Loc : constant Source_Ptr := Sloc (N);
Qual : Node_Id := Empty;
Typ : Entity_Id := Empty;
Nam : Node_Id;
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index b5a3c6bdbfa..89cfbb66cb6 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -691,9 +691,51 @@ package body Sem_Ch13 is
-- Start of processing for Analyze_Attribute_Definition_Clause
begin
+ -- Process Ignore_Rep_Clauses option
+
if Ignore_Rep_Clauses then
- Rewrite (N, Make_Null_Statement (Sloc (N)));
- return;
+ case Id is
+
+ -- The following should be ignored. They do not affect legality
+ -- and may be target dependent. The basic idea of -gnatI is to
+ -- ignore any rep clauses that may be target dependent but do not
+ -- affect legality (except possibly to be rejected because they
+ -- are incompatible with the compilation target).
+
+ when Attribute_Address |
+ Attribute_Alignment |
+ Attribute_Bit_Order |
+ Attribute_Component_Size |
+ Attribute_Machine_Radix |
+ Attribute_Object_Size |
+ Attribute_Size |
+ Attribute_Small |
+ Attribute_Stream_Size |
+ Attribute_Value_Size =>
+
+ Rewrite (N, Make_Null_Statement (Sloc (N)));
+ return;
+
+ -- The following should not be ignored, because in the first place
+ -- they are reasonably portable, and should not cause problems in
+ -- compiling code from another target, and also they do affect
+ -- legality, e.g. failing to provide a stream attribute for a
+ -- type may make a program illegal.
+
+ when Attribute_External_Tag |
+ Attribute_Input |
+ Attribute_Output |
+ Attribute_Read |
+ Attribute_Storage_Pool |
+ Attribute_Storage_Size |
+ Attribute_Write =>
+ null;
+
+ -- Other cases are errors, which will be caught below
+
+ when others =>
+ null;
+ end case;
end if;
Analyze (Nam);
@@ -2944,11 +2986,10 @@ package body Sem_Ch13 is
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
- Error_Msg_Name_1 := Chars (Entity (Nod));
- Error_Msg_Name_2 := Chars (U_Ent);
- Error_Msg_N
- ("\% must be defined before % (RM 13.1(22))!",
- Nod);
+ Error_Msg_Node_2 := U_Ent;
+ Error_Msg_NE
+ ("\& must be defined before & (RM 13.1(22))!",
+ Nod, Entity (Nod));
end if;
elsif Nkind (Nod) = N_Selected_Component then
@@ -3078,11 +3119,10 @@ package body Sem_Ch13 is
Error_Msg_NE
("invalid address clause for initialized object &!",
Nod, U_Ent);
- Error_Msg_Name_1 := Chars (Ent);
- Error_Msg_Name_2 := Chars (U_Ent);
- Error_Msg_N
- ("\% must be defined before % (RM 13.1(22))!",
- Nod);
+ Error_Msg_Node_2 := U_Ent;
+ Error_Msg_NE
+ ("\& must be defined before & (RM 13.1(22))!",
+ Nod, Ent);
end if;
elsif Nkind (Original_Node (Nod)) = N_Function_Call then
@@ -3094,10 +3134,9 @@ package body Sem_Ch13 is
Nod, U_Ent);
if Comes_From_Source (Ent) then
- Error_Msg_Name_1 := Chars (Ent);
- Error_Msg_N
- ("\reference to variable% not allowed"
- & " (RM 13.1(22))!", Nod);
+ Error_Msg_NE
+ ("\reference to variable& not allowed"
+ & " (RM 13.1(22))!", Nod, Ent);
else
Error_Msg_N
("non-static expression not allowed"
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index be87d0c8793..cb66334fc45 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1276,10 +1276,6 @@ package body Sem_Ch3 is
procedure Access_Type_Declaration (T : Entity_Id; Def : Node_Id) is
S : constant Node_Id := Subtype_Indication (Def);
P : constant Node_Id := Parent (Def);
-
- Desig : Entity_Id;
- -- Designated type
-
begin
-- Check for permissible use of incomplete type
@@ -1331,22 +1327,6 @@ package body Sem_Ch3 is
Init_Size_Align (T);
end if;
- Desig := Designated_Type (T);
-
- -- If designated type is an imported tagged type, indicate that the
- -- access type is also imported, and therefore restricted in its use.
- -- The access type may already be imported, so keep setting otherwise.
-
- -- Ada 2005 (AI-50217): If the non-limited view of the designated type
- -- is available, use it as the designated type of the access type, so
- -- that the back-end gets a usable entity.
-
- if From_With_Type (Desig)
- and then Ekind (Desig) /= E_Access_Type
- then
- Set_From_With_Type (T);
- end if;
-
-- Note that Has_Task is always false, since the access type itself
-- is not a task type. See Einfo for more description on this point.
-- Exactly the same consideration applies to Has_Controlled_Component.
@@ -2656,6 +2636,7 @@ package body Sem_Ch3 is
if (Is_Class_Wide_Type (Etype (E)) or else Is_Dynamically_Tagged (E))
and then Is_Tagged_Type (T)
and then not Is_Class_Wide_Type (T)
+ and then not Is_CPP_Constructor_Call (E)
then
Error_Msg_N ("dynamically tagged expression not allowed!", E);
end if;
@@ -8321,7 +8302,9 @@ package body Sem_Ch3 is
-- Error message below needs rewording (remember comma
-- in -gnatj mode) ???
- if Ekind (First_Formal (Subp)) = E_In_Parameter then
+ if Ekind (First_Formal (Subp)) = E_In_Parameter
+ and then Ekind (Subp) /= E_Function
+ then
if not Is_Predefined_Dispatching_Operation (Subp) then
Error_Msg_NE
("first formal of & must be of mode `OUT`, " &
@@ -8337,6 +8320,27 @@ package body Sem_Ch3 is
Error_Msg_NE
("interface subprogram & must be overridden",
T, Subp);
+
+ -- Examine primitive operations of synchronized type,
+ -- to find homonyms that have the wrong profile.
+
+ declare
+ Prim : Entity_Id;
+
+ begin
+ Prim :=
+ First_Entity (Corresponding_Concurrent_Type (T));
+ while Present (Prim) loop
+ if Chars (Prim) = Chars (Subp) then
+ Error_Msg_NE
+ ("profile is not type conformant with "
+ & "prefixed view profile of "
+ & "inherited operation&", Prim, Subp);
+ end if;
+
+ Next_Entity (Prim);
+ end loop;
+ end;
end if;
end if;
@@ -15288,9 +15292,10 @@ package body Sem_Ch3 is
function OK_For_Limited_Init (Exp : Node_Id) return Boolean is
begin
- return Ada_Version >= Ada_05
- and then not Debug_Flag_Dot_L
- and then OK_For_Limited_Init_In_05 (Exp);
+ return Is_CPP_Constructor_Call (Exp)
+ or else (Ada_Version >= Ada_05
+ and then not Debug_Flag_Dot_L
+ and then OK_For_Limited_Init_In_05 (Exp));
end OK_For_Limited_Init;
-------------------------------
@@ -16239,7 +16244,6 @@ package body Sem_Ch3 is
declare
Conc_Typ : constant Entity_Id :=
Corresponding_Record_Type (Full_T);
- Loc : constant Source_Ptr := Sloc (Conc_Typ);
Curr_Nod : Node_Id := Parent (Conc_Typ);
Wrap_Spec : Node_Id;
@@ -16251,14 +16255,14 @@ package body Sem_Ch3 is
and then not Is_Abstract_Subprogram (Prim)
then
Wrap_Spec :=
- Make_Subprogram_Declaration (Loc,
+ Make_Subprogram_Declaration (Sloc (Prim),
Specification =>
- Build_Wrapper_Spec (Loc,
- Subp_Id => Prim,
- Obj_Typ => Conc_Typ,
- Formals =>
- Parameter_Specifications (
- Parent (Prim))));
+ Build_Wrapper_Spec
+ (Subp_Id => Prim,
+ Obj_Typ => Conc_Typ,
+ Formals =>
+ Parameter_Specifications (
+ Parent (Prim))));
Insert_After (Curr_Nod, Wrap_Spec);
Curr_Nod := Wrap_Spec;
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 5ea961b1ae1..b8e8b42d211 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -446,7 +446,7 @@ package body Sem_Ch4 is
if Nkind (Constraint (E)) =
N_Index_Or_Discriminant_Constraint
then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\if qualified expression was meant, " &
"use apostrophe", Constraint (E));
end if;
@@ -483,7 +483,7 @@ package body Sem_Ch4 is
and then Nkind (Constraint (E)) =
N_Index_Or_Discriminant_Constraint
then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("if qualified expression was meant, " &
"use apostrophe!", Constraint (E));
end if;
@@ -2466,7 +2466,7 @@ package body Sem_Ch4 is
Formal := First_Formal (Nam);
while Present (Formal) loop
if Chars (Left_Opnd (Actual)) = Chars (Formal) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("possible misspelling of `='>`!", Actual);
exit;
end if;
@@ -4245,12 +4245,12 @@ package body Sem_Ch4 is
-- Report at most two suggestions
if Nr_Of_Suggestions = 1 then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("\possible misspelling of&", Sel, Suggestion_1);
elsif Nr_Of_Suggestions = 2 then
Error_Msg_Node_2 := Suggestion_2;
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("\possible misspelling of& or&", Sel, Suggestion_1);
end if;
end Check_Misspelled_Selector;
@@ -4359,8 +4359,8 @@ package body Sem_Ch4 is
if Nkind (Parent (N)) = N_Selected_Component
and then N = Prefix (Parent (N))
then
- Error_Msg_N (
- "\period should probably be semicolon", Parent (N));
+ Error_Msg_N -- CODEFIX
+ ("\period should probably be semicolon", Parent (N));
end if;
elsif Nkind (N) = N_Procedure_Call_Statement
@@ -5238,7 +5238,8 @@ package body Sem_Ch4 is
and then Valid_Boolean_Arg (Etype (R))
then
Error_Msg_N ("invalid operands for concatenation", N);
- Error_Msg_N ("\maybe AND was meant", N);
+ Error_Msg_N -- CODEFIX
+ ("\maybe AND was meant", N);
return;
-- A special case for comparison of access parameter with null
@@ -6073,7 +6074,8 @@ package body Sem_Ch4 is
if Nkind (Parent (Op)) = N_Full_Type_Declaration then
Error_Msg_N ("\possible interpretation (inherited)#", N);
else
- Error_Msg_N ("\possible interpretation#", N);
+ Error_Msg_N -- CODEFIX
+ ("\possible interpretation#", N);
end if;
end if;
end Report_Ambiguity;
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 5cf092c9917..4c047b49c53 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -436,9 +436,15 @@ package body Sem_Ch5 is
and then not Assignment_OK (Original_Node (Lhs))
and then not Is_Value_Type (T1)
then
- Error_Msg_N
- ("left hand of assignment must not be limited type", Lhs);
- Explain_Limited_Type (T1, Lhs);
+ -- CPP constructors can only be called in declarations
+
+ if Is_CPP_Constructor_Call (Rhs) then
+ Error_Msg_N ("invalid use of 'C'P'P constructor", Rhs);
+ else
+ Error_Msg_N
+ ("left hand of assignment must not be limited type", Lhs);
+ Explain_Limited_Type (T1, Lhs);
+ end if;
return;
-- Enforce RM 3.9.3 (8): left-hand side cannot be abstract
@@ -543,6 +549,7 @@ package body Sem_Ch5 is
or else (Is_Dynamically_Tagged (Rhs)
and then not Is_Access_Type (T1)))
and then not Is_Class_Wide_Type (T1)
+ and then not Is_CPP_Constructor_Call (Rhs)
then
Error_Msg_N ("dynamically tagged expression not allowed!", Rhs);
@@ -1201,6 +1208,13 @@ package body Sem_Ch5 is
Analyze_And_Resolve (Cond, Any_Boolean);
Check_Unset_Reference (Cond);
end if;
+
+ -- Since the exit may take us out of a loop, any previous assignment
+ -- statement is not useless, so clear last assignment indications. It
+ -- is OK to keep other current values, since if the exit statement
+ -- does not exit, then the current values are still valid.
+
+ Kill_Current_Values (Last_Assignment_Only => True);
end Analyze_Exit_Statement;
----------------------------
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 569800c3b6d..b51128705ae 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -2618,8 +2618,8 @@ package body Sem_Ch6 is
-- Start of processing for Analyze_Subprogram_Declaration
begin
- -- For a null procedure. capture the profile before analysis, for
- -- expansion at the freeze point, and at each point of call.
+ -- For a null procedure, capture the profile before analysis, for
+ -- expansion at the freeze point and at each point of call.
-- The body will only be used if the procedure has preconditions.
-- In that case the body is analyzed at the freeze point.
@@ -2631,7 +2631,8 @@ package body Sem_Ch6 is
Make_Subprogram_Body (Loc,
Specification =>
New_Copy_Tree (Specification (N)),
- Declarations => New_List,
+ Declarations =>
+ New_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (Make_Null_Statement (Loc))));
@@ -2834,12 +2835,15 @@ package body Sem_Ch6 is
-- inherited interface operation, and the controlling type is
-- a synchronized type, replace the type with its corresponding
-- record, to match the proper signature of an overriding operation.
+ -- Same processing for an access parameter whose designated type is
+ -- derived from a synchronized interface.
if Ada_Version >= Ada_05 then
declare
Formal : Entity_Id;
Formal_Typ : Entity_Id;
Rec_Typ : Entity_Id;
+ Desig_Typ : Entity_Id;
begin
Formal := First_Formal (Designator);
@@ -2854,6 +2858,19 @@ package body Sem_Ch6 is
if Present (Interfaces (Rec_Typ)) then
Set_Etype (Formal, Rec_Typ);
end if;
+
+ elsif Ekind (Formal_Typ) = E_Anonymous_Access_Type then
+ Desig_Typ := Designated_Type (Formal_Typ);
+
+ if Is_Concurrent_Type (Desig_Typ)
+ and then Present (Corresponding_Record_Type (Desig_Typ))
+ then
+ Rec_Typ := Corresponding_Record_Type (Desig_Typ);
+
+ if Present (Interfaces (Rec_Typ)) then
+ Set_Directly_Designated_Type (Formal_Typ, Rec_Typ);
+ end if;
+ end if;
end if;
Next_Formal (Formal);
@@ -3463,36 +3480,36 @@ package body Sem_Ch6 is
case Ctype is
when Type_Conformant =>
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("not type conformant with declaration#!", Enode);
when Mode_Conformant =>
if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX???
("not mode conformant with operation inherited#!",
Enode);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX???
("not mode conformant with declaration#!", Enode);
end if;
when Subtype_Conformant =>
if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX???
("not subtype conformant with operation inherited#!",
Enode);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX???
("not subtype conformant with declaration#!", Enode);
end if;
when Fully_Conformant =>
if Nkind (Parent (Old_Id)) = N_Full_Type_Declaration then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("not fully conformant with operation inherited#!",
Enode);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("not fully conformant with declaration#!", Enode);
end if;
end case;
@@ -4140,7 +4157,8 @@ package body Sem_Ch6 is
procedure Conformance_Error (Msg : String; N : Node_Id) is
begin
Error_Msg_Sloc := Sloc (Prev_Loc);
- Error_Msg_N ("not fully conformant with declaration#!", N);
+ Error_Msg_N -- CODEFIX
+ ("not fully conformant with declaration#!", N);
Error_Msg_NE (Msg, N, N);
end Conformance_Error;
@@ -4424,10 +4442,10 @@ package body Sem_Ch6 is
then
Set_Is_Overriding_Operation (Subp);
- -- If style checks are enabled, indicate that the indicator
- -- is missing. However, at the point of declaration, the type
- -- of which this is a primitive operation may be private, in
- -- which case the indicator would be premature.
+ -- If style checks are enabled, indicate that the indicator is
+ -- missing. However, at the point of declaration, the type of
+ -- which this is a primitive operation may be private, in which
+ -- case the indicator would be premature.
if Has_Private_Declaration (Etype (Subp))
or else Has_Private_Declaration (Etype (First_Formal (Subp)))
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 3f2ff18aaed..8ddefb58af0 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -866,37 +866,65 @@ package body Sem_Ch8 is
end if;
end if;
- -- Special processing for renaming function return object
+ -- Special processing for renaming function return object. Some errors
+ -- and warnings are produced only for calls that come from source.
- if Nkind (Nam) = N_Function_Call
- and then Comes_From_Source (Nam)
- then
+ if Nkind (Nam) = N_Function_Call then
case Ada_Version is
-- Usage is illegal in Ada 83
when Ada_83 =>
- Error_Msg_N
- ("(Ada 83) cannot rename function return object", Nam);
+ if Comes_From_Source (Nam) then
+ Error_Msg_N
+ ("(Ada 83) cannot rename function return object", Nam);
+ end if;
-- In Ada 95, warn for odd case of renaming parameterless function
- -- call if this is not a limited type (where this is useful)
+ -- call if this is not a limited type (where this is useful).
when others =>
if Warn_On_Object_Renames_Function
and then No (Parameter_Associations (Nam))
and then not Is_Limited_Type (Etype (Nam))
+ and then Comes_From_Source (Nam)
then
Error_Msg_N
- ("?renaming function result object is suspicious",
- Nam);
+ ("?renaming function result object is suspicious", Nam);
Error_Msg_NE
- ("\?function & will be called only once",
- Nam, Entity (Name (Nam)));
+ ("\?function & will be called only once", Nam,
+ Entity (Name (Nam)));
Error_Msg_N
("\?suggest using an initialized constant object instead",
Nam);
end if;
+
+ -- If the function call returns an unconstrained type, we must
+ -- build a constrained subtype for the new entity, in a way
+ -- similar to what is done for an object declaration with an
+ -- unconstrained nominal type.
+
+ if Is_Composite_Type (Etype (Nam))
+ and then not Is_Constrained (Etype (Nam))
+ and then not Has_Unknown_Discriminants (Etype (Nam))
+ and then Expander_Active
+ then
+ declare
+ Loc : constant Source_Ptr := Sloc (N);
+ Subt : constant Entity_Id :=
+ Make_Defining_Identifier (Loc,
+ Chars => New_Internal_Name ('T'));
+ begin
+ Remove_Side_Effects (Nam);
+ Insert_Action (N,
+ Make_Subtype_Declaration (Loc,
+ Defining_Identifier => Subt,
+ Subtype_Indication =>
+ Make_Subtype_From_Expr (Nam, Etype (Nam))));
+ Rewrite (Subtype_Mark (N), New_Occurrence_Of (Subt, Loc));
+ Set_Etype (Nam, Subt);
+ end;
+ end if;
end case;
end if;
@@ -918,6 +946,7 @@ package body Sem_Ch8 is
then
Error_Msg_NE ("invalid use of incomplete type&", Id, T2);
return;
+
elsif Ekind (Etype (T)) = E_Incomplete_Type then
Error_Msg_NE ("invalid use of incomplete type&", Id, T);
return;
@@ -935,8 +964,8 @@ package body Sem_Ch8 is
and then Nkind (Nam) in N_Has_Entity
then
declare
- Nam_Decl : Node_Id;
- Nam_Ent : Entity_Id;
+ Nam_Decl : Node_Id;
+ Nam_Ent : Entity_Id;
begin
if Nkind (Nam) = N_Attribute_Reference then
@@ -945,7 +974,7 @@ package body Sem_Ch8 is
Nam_Ent := Entity (Nam);
end if;
- Nam_Decl := Parent (Nam_Ent);
+ Nam_Decl := Parent (Nam_Ent);
if Has_Null_Exclusion (N)
and then not Has_Null_Exclusion (Nam_Decl)
@@ -958,7 +987,7 @@ package body Sem_Ch8 is
-- have a null exclusion or a null-excluding subtype.
if Is_Formal_Object (Nam_Ent)
- and then In_Generic_Scope (Id)
+ and then In_Generic_Scope (Id)
then
if not Can_Never_Be_Null (Etype (Nam_Ent)) then
Error_Msg_N
@@ -985,11 +1014,11 @@ package body Sem_Ch8 is
-- of the renamed actual in the instance will raise
-- constraint_error.
- elsif Nkind (Parent (Nam_Ent)) = N_Object_Declaration
+ elsif Nkind (Nam_Decl) = N_Object_Declaration
and then In_Instance
and then Present
- (Corresponding_Generic_Association (Parent (Nam_Ent)))
- and then Nkind (Expression (Parent (Nam_Ent)))
+ (Corresponding_Generic_Association (Nam_Decl))
+ and then Nkind (Expression (Nam_Decl))
= N_Raise_Constraint_Error
then
Error_Msg_N
@@ -1000,7 +1029,7 @@ package body Sem_Ch8 is
-- must not be null-excluding.
elsif No (Access_Definition (N))
- and then Can_Never_Be_Null (T)
+ and then Can_Never_Be_Null (T)
then
Error_Msg_NE
("`NOT NULL` not allowed (& already excludes null)",
@@ -1040,8 +1069,6 @@ package body Sem_Ch8 is
then
Error_Msg_N
("illegal renaming of discriminant-dependent component", Nam);
- else
- null;
end if;
-- A static function call may have been folded into a literal
@@ -1116,8 +1143,7 @@ package body Sem_Ch8 is
return;
end if;
- -- Apply Text_IO kludge here, since we may be renaming one of the
- -- children of Text_IO.
+ -- Apply Text_IO kludge here since we may be renaming a child of Text_IO
Text_IO_Kludge (Name (N));
@@ -1135,8 +1161,7 @@ package body Sem_Ch8 is
end if;
if Etype (Old_P) = Any_Type then
- Error_Msg_N
- ("expect package name in renaming", Name (N));
+ Error_Msg_N ("expect package name in renaming", Name (N));
elsif Ekind (Old_P) /= E_Package
and then not (Ekind (Old_P) = E_Generic_Package
@@ -1373,8 +1398,8 @@ package body Sem_Ch8 is
Inherit_Renamed_Profile (New_S, Old_S);
- -- The prefix can be an arbitrary expression that yields a task
- -- type, so it must be resolved.
+ -- The prefix can be an arbitrary expression that yields a task type,
+ -- so it must be resolved.
Resolve (Prefix (Nam), Scope (Old_S));
end if;
@@ -2370,10 +2395,12 @@ package body Sem_Ch8 is
declare
F1 : Entity_Id;
F2 : Entity_Id;
+ T1 : Entity_Id;
begin
F1 := First_Formal (Candidate_Renaming);
F2 := First_Formal (New_S);
+ T1 := First_Subtype (Etype (F1));
while Present (F1) and then Present (F2) loop
Next_Formal (F1);
@@ -2390,6 +2417,15 @@ package body Sem_Ch8 is
("\missing specification for &", Spec, F1);
end if;
end if;
+
+ if Nkind (Nam) = N_Operator_Symbol
+ and then From_Default (N)
+ then
+ Error_Msg_Node_2 := T1;
+ Error_Msg_NE
+ ("default & on & is not directly visible",
+ Nam, Nam);
+ end if;
end;
end if;
end if;
@@ -2545,11 +2581,12 @@ package body Sem_Ch8 is
and then Etype (Pack) /= Any_Type
then
if Ekind (Pack) = E_Generic_Package then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("a generic package is not allowed in a use clause",
Pack_Name);
else
- Error_Msg_N ("& is not a usable package", Pack_Name);
+ Error_Msg_N -- CODEFIX???
+ ("& is not a usable package", Pack_Name);
end if;
else
@@ -3705,12 +3742,14 @@ package body Sem_Ch8 is
while Present (Ent) loop
if Is_Potentially_Use_Visible (Ent) then
if not Hidden then
- Error_Msg_N ("multiple use clauses cause hiding!", N);
+ Error_Msg_N -- CODEFIX
+ ("multiple use clauses cause hiding!", N);
Hidden := True;
end if;
Error_Msg_Sloc := Sloc (Ent);
- Error_Msg_N ("hidden declaration#!", N);
+ Error_Msg_N -- CODEFIX
+ ("hidden declaration#!", N);
end if;
Ent := Homonym (Ent);
@@ -3743,7 +3782,8 @@ package body Sem_Ch8 is
if Is_Hidden (Ent) then
Error_Msg_N ("non-visible (private) declaration#!", N);
else
- Error_Msg_N ("non-visible declaration#!", N);
+ Error_Msg_N -- CODEFIX
+ ("non-visible declaration#!", N);
if Is_Compilation_Unit (Ent)
and then
@@ -3925,7 +3965,8 @@ package body Sem_Ch8 is
end loop;
if Present (Ematch) then
- Error_Msg_NE ("\possible misspelling of&", N, Ematch);
+ Error_Msg_NE -- CODEFIX
+ ("\possible misspelling of&", N, Ematch);
end if;
end;
end if;
@@ -4711,7 +4752,7 @@ package body Sem_Ch8 is
if Is_Bad_Spelling_Of (Chars (Id), Chars (Selector))
and then not Is_Internal_Name (Chars (Id))
then
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("possible misspelling of&", Selector, Id);
exit;
end if;
@@ -5040,10 +5081,12 @@ package body Sem_Ch8 is
Candidate_Renaming := Empty;
if not Is_Overloaded (Nam) then
- if Entity_Matches_Spec (Entity (Nam), New_S)
- and then Is_Visible_Operation (Entity (Nam))
- then
- Old_S := Entity (Nam);
+ if Entity_Matches_Spec (Entity (Nam), New_S) then
+ Candidate_Renaming := New_S;
+
+ if Is_Visible_Operation (Entity (Nam)) then
+ Old_S := Entity (Nam);
+ end if;
elsif
Present (First_Formal (Entity (Nam)))
@@ -5684,14 +5727,25 @@ package body Sem_Ch8 is
if Ekind (Base_Type (T_Name)) = E_Task_Type then
-- In Ada 2005, a task name can be used in an access
- -- definition within its own body.
+ -- definition within its own body. It cannot be used
+ -- in the discriminant part of the task declaration,
+ -- nor anywhere else in the declaration because entries
+ -- cannot have access parameters.
if Ada_Version >= Ada_05
and then Nkind (Parent (N)) = N_Access_Definition
then
Set_Entity (N, T_Name);
Set_Etype (N, T_Name);
- return;
+
+ if Has_Completion (T_Name) then
+ return;
+
+ else
+ Error_Msg_N
+ ("task type cannot be used as type mark " &
+ "within its own declaration", N);
+ end if;
else
Error_Msg_N
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 33044b3a810..7c69da1ade1 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -50,7 +50,6 @@ with Sem_Util; use Sem_Util;
with Snames; use Snames;
with Stand; use Stand;
with Sinfo; use Sinfo;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
@@ -865,7 +864,14 @@ package body Sem_Disp is
Prim => Subp));
end if;
- Generate_Reference (Tagged_Type, Subp, 'p', False);
+ -- Indicate that this is an overriding operation,
+ -- and replace the overriden entry in the list of
+ -- primitive operations, which is used for xref
+ -- generation subsequently.
+
+ Generate_Reference (Tagged_Type, Subp, 'P', False);
+ Override_Dispatching_Operation
+ (Tagged_Type, Old_Subp, Subp);
end if;
end if;
end if;
@@ -1735,7 +1741,7 @@ package body Sem_Disp is
-- the VM back-ends directly handle the generation of dispatching
-- calls and would have to undo any expansion to an indirect call.
- if VM_Target = No_VM then
+ if Tagged_Type_Expansion then
Expand_Dispatching_Call (Call_Node);
-- Expansion of a dispatching call results in an indirect call, which in
diff --git a/gcc/ada/sem_elim.adb b/gcc/ada/sem_elim.adb
index d285e08355c..e4c99fc01b6 100644
--- a/gcc/ada/sem_elim.adb
+++ b/gcc/ada/sem_elim.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -26,6 +26,7 @@
with Atree; use Atree;
with Einfo; use Einfo;
with Errout; use Errout;
+with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Sem; use Sem;
@@ -234,29 +235,6 @@ package body Sem_Elim is
Scop : Entity_Id;
Form : Entity_Id;
- function Original_Chars (S : Entity_Id) return Name_Id;
- -- If the candidate subprogram is a protected operation of a single
- -- protected object, the scope of the operation is the created
- -- protected type, and we have to retrieve the original name of
- -- the object.
-
- --------------------
- -- Original_Chars --
- --------------------
-
- function Original_Chars (S : Entity_Id) return Name_Id is
- begin
- if Ekind (S) /= E_Protected_Type
- or else Comes_From_Source (S)
- then
- return Chars (S);
- else
- return Chars (Defining_Identifier (Original_Node (Parent (S))));
- end if;
- end Original_Chars;
-
- -- Start of processing for Check_Eliminated
-
begin
if No_Elimination then
return;
@@ -308,33 +286,9 @@ package body Sem_Elim is
goto Continue;
end if;
- -- Then we need to see if the static scope matches within the
- -- compilation unit.
-
- -- At the moment, gnatelim does not consider block statements as
- -- scopes (even if a block is named)
+ -- Find enclosing unit
- Scop := Scope (E);
- while Ekind (Scop) = E_Block loop
- Scop := Scope (Scop);
- end loop;
-
- if Elmt.Entity_Scope /= null then
- for J in reverse Elmt.Entity_Scope'Range loop
- if Elmt.Entity_Scope (J) /= Original_Chars (Scop) then
- goto Continue;
- end if;
-
- Scop := Scope (Scop);
- while Ekind (Scop) = E_Block loop
- Scop := Scope (Scop);
- end loop;
-
- if not Is_Compilation_Unit (Scop) and then J = 1 then
- goto Continue;
- end if;
- end loop;
- end if;
+ Scop := Cunit_Entity (Current_Sem_Unit);
-- Now see if compilation unit matches
@@ -432,8 +386,8 @@ package body Sem_Elim is
function Skip_Spaces return Natural;
-- If Sloc_Trace (Idx) is not space character, returns
-- Idx. Otherwise returns the index of the nearest
- -- non-space character in Sloc_Trace to the right of
- -- Idx. Returns 0 if there is no such character.
+ -- non-space character in Sloc_Trace to the right of Idx.
+ -- Returns 0 if there is no such character.
-----------------------------
-- Different_Trace_Lengths --
@@ -487,17 +441,19 @@ package body Sem_Elim is
end if;
end loop;
- -- Find last non-space before this colon. If there
- -- is no space character before this colon, then
- -- return False. Otherwise, End_Idx set to point to
- -- this non-space character.
+ -- Find last non-space before this colon. If there is
+ -- no space character before this colon, then return
+ -- False. Otherwise, End_Idx is set to point to this
+ -- non-space character.
End_Idx := Tmp_Idx;
loop
if End_Idx < Idx then
return False;
+
elsif Sloc_Trace (End_Idx) /= ' ' then
exit;
+
else
End_Idx := End_Idx - 1;
end if;
@@ -605,8 +561,8 @@ package body Sem_Elim is
end;
end if;
- -- If we have a Result_Type, then we must have a function
- -- with the proper result type
+ -- If we have a Result_Type, then we must have a function with
+ -- the proper result type.
if Elmt.Result_Type /= No_Name then
if Ekind (E) /= E_Function
@@ -673,7 +629,10 @@ package body Sem_Elim is
Enclosing_Subp : Entity_Id;
begin
- if Is_Eliminated (Ultimate_Subp) and then not Inside_A_Generic then
+ if Is_Eliminated (Ultimate_Subp)
+ and then not Inside_A_Generic
+ and then not Is_Generic_Unit (Cunit_Entity (Current_Sem_Unit))
+ then
Enclosing_Subp := Current_Subprogram;
while Present (Enclosing_Subp) loop
if Is_Eliminated (Enclosing_Subp) then
@@ -701,9 +660,21 @@ package body Sem_Elim is
end if;
end loop;
- -- Should never fall through, since entry should be in table
+ -- If this is an internal operation generated for a protected operation,
+ -- its name does not match the source name, so just report the error.
+
+ if not Comes_From_Source (E)
+ and then Present (First_Entity (E))
+ and then Is_Concurrent_Record_Type (Etype (First_Entity (E)))
+ then
+ Error_Msg_NE
+ ("cannot reference eliminated protected subprogram", N, E);
- raise Program_Error;
+ -- Otherwise should not fall through, entry should be in table
+
+ else
+ raise Program_Error;
+ end if;
end Eliminate_Error_Msg;
----------------
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index daa607bb6ef..505fbea96fe 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -1967,7 +1967,8 @@ package body Sem_Prag is
(Chars (Arg), Names (Index1))
then
Error_Msg_Name_1 := Names (Index1);
- Error_Msg_N ("\possible misspelling of%", Arg);
+ Error_Msg_N -- CODEFIX
+ ("\possible misspelling of%", Arg);
exit;
end if;
end loop;
@@ -3105,7 +3106,7 @@ package body Sem_Prag is
Prag_Id = Pragma_Import_Valued_Procedure
then
if not Is_Imported (Ent) then
- Error_Pragma
+ Error_Pragma -- CODEFIX???
("pragma Import or Interface must precede pragma%");
end if;
@@ -3573,6 +3574,49 @@ package body Sem_Prag is
Set_Is_CPP_Class (Def_Id);
Set_Is_Limited_Record (Def_Id);
+
+ -- Imported CPP types must not have discriminants (because C++
+ -- classes do not have discriminants).
+
+ if Has_Discriminants (Def_Id) then
+ Error_Msg_N
+ ("imported 'C'P'P type cannot have discriminants",
+ First (Discriminant_Specifications
+ (Declaration_Node (Def_Id))));
+ end if;
+
+ -- Components of imported CPP types must not have default
+ -- expressions because the constructor (if any) is in the
+ -- C++ side.
+
+ declare
+ Tdef : constant Node_Id :=
+ Type_Definition (Declaration_Node (Def_Id));
+ Clist : Node_Id;
+ Comp : Node_Id;
+
+ begin
+ if Nkind (Tdef) = N_Record_Definition then
+ Clist := Component_List (Tdef);
+
+ else
+ pragma Assert (Nkind (Tdef) = N_Derived_Type_Definition);
+ Clist := Component_List (Record_Extension_Part (Tdef));
+ end if;
+
+ if Present (Clist) then
+ Comp := First (Component_Items (Clist));
+ while Present (Comp) loop
+ if Present (Expression (Comp)) then
+ Error_Msg_N
+ ("component of imported 'C'P'P type cannot have" &
+ " default expression", Expression (Comp));
+ end if;
+
+ Next (Comp);
+ end loop;
+ end if;
+ end;
end if;
else
@@ -4183,7 +4227,7 @@ package body Sem_Prag is
Error_Msg_String (1 .. Rnm'Length) :=
Name_Buffer (1 .. Name_Len);
Error_Msg_Strlen := Rnm'Length;
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\possible misspelling of ""~""",
Get_Pragma_Arg (Arg));
exit;
@@ -4937,7 +4981,7 @@ package body Sem_Prag is
for PN in First_Pragma_Name .. Last_Pragma_Name loop
if Is_Bad_Spelling_Of (Pname, PN) then
Error_Msg_Name_1 := PN;
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\?possible misspelling of %!", Pragma_Identifier (N));
exit;
end if;
@@ -6159,6 +6203,62 @@ package body Sem_Prag is
Set_Is_CPP_Class (Typ);
Set_Is_Limited_Record (Typ);
Set_Convention (Typ, Convention_CPP);
+
+ -- Imported CPP types must not have discriminants (because C++
+ -- classes do not have discriminants).
+
+ if Has_Discriminants (Typ) then
+ Error_Msg_N
+ ("imported 'C'P'P type cannot have discriminants",
+ First (Discriminant_Specifications
+ (Declaration_Node (Typ))));
+ end if;
+
+ -- Components of imported CPP types must not have default
+ -- expressions because the constructor (if any) is in the
+ -- C++ side.
+
+ if Is_Incomplete_Or_Private_Type (Typ)
+ and then No (Underlying_Type (Typ))
+ then
+ -- It should be an error to apply pragma CPP to a private
+ -- type if the underlying type is not visible (as it is
+ -- for any representation item). For now, for backward
+ -- compatibility we do nothing but we cannot check components
+ -- because they are not available at this stage. All this code
+ -- will be removed when we cleanup this obsolete GNAT pragma???
+
+ null;
+
+ else
+ declare
+ Tdef : constant Node_Id :=
+ Type_Definition (Declaration_Node (Typ));
+ Clist : Node_Id;
+ Comp : Node_Id;
+
+ begin
+ if Nkind (Tdef) = N_Record_Definition then
+ Clist := Component_List (Tdef);
+ else
+ pragma Assert (Nkind (Tdef) = N_Derived_Type_Definition);
+ Clist := Component_List (Record_Extension_Part (Tdef));
+ end if;
+
+ if Present (Clist) then
+ Comp := First (Component_Items (Clist));
+ while Present (Comp) loop
+ if Present (Expression (Comp)) then
+ Error_Msg_N
+ ("component of imported 'C'P'P type cannot have" &
+ " default expression", Expression (Comp));
+ end if;
+
+ Next (Comp);
+ end loop;
+ end if;
+ end;
+ end if;
end CPP_Class;
---------------------
@@ -6201,13 +6301,8 @@ package body Sem_Prag is
Process_Interface_Name (Def_Id, Arg2, Arg3);
end if;
- if No (Parameter_Specifications (Parent (Def_Id))) then
- Set_Has_Completion (Def_Id);
- Set_Is_Constructor (Def_Id);
- else
- Error_Pragma_Arg
- ("non-default constructors not implemented", Arg1);
- end if;
+ Set_Has_Completion (Def_Id);
+ Set_Is_Constructor (Def_Id);
else
Error_Pragma_Arg
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 0378bd542cc..d6113d88a7e 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -72,7 +72,6 @@ with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
with Style; use Style;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Urealp; use Urealp;
@@ -1996,7 +1995,7 @@ package body Sem_Res is
("ambiguous expression "
& "(cannot resolve indirect call)!", N);
else
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("ambiguous expression (cannot resolve&)!",
N, It.Nam);
end if;
@@ -2007,7 +2006,8 @@ package body Sem_Res is
Error_Msg_N
("\\possible interpretation (inherited)#!", N);
else
- Error_Msg_N ("\\possible interpretation#!", N);
+ Error_Msg_N -- CODEFIX
+ ("\\possible interpretation#!", N);
end if;
end if;
@@ -2089,7 +2089,8 @@ package body Sem_Res is
Error_Msg_N
("\\possible interpretation (inherited)#!", N);
else
- Error_Msg_N ("\\possible interpretation#!", N);
+ Error_Msg_N -- CODEFIX
+ ("\\possible interpretation#!", N);
end if;
end if;
@@ -3030,8 +3031,14 @@ package body Sem_Res is
when N_String_Literal =>
return True;
- when N_Op_Concat =>
- return Static_Concatenation (Left_Opnd (N))
+ when N_Op_Concat =>
+
+ -- Concatenation is static when both operands are static
+ -- and the concatenation operator is a predefined one.
+
+ return Scope (Entity (N)) = Standard_Standard
+ and then
+ Static_Concatenation (Left_Opnd (N))
and then
Static_Concatenation (Right_Opnd (N));
@@ -3042,8 +3049,8 @@ package body Sem_Res is
begin
return Ekind (Ent) = E_Constant
and then Present (Constant_Value (Ent))
- and then Is_Static_Expression
- (Constant_Value (Ent));
+ and then
+ Is_Static_Expression (Constant_Value (Ent));
end;
else
@@ -3067,9 +3074,9 @@ package body Sem_Res is
if No (A) and then Needs_No_Actuals (Nam) then
null;
- -- If we have an error in any actual or formal, indicated by
- -- a type of Any_Type, then abandon resolution attempt, and
- -- set result type to Any_Type.
+ -- If we have an error in any actual or formal, indicated by a type
+ -- of Any_Type, then abandon resolution attempt, and set result type
+ -- to Any_Type.
elsif (Present (A) and then Etype (A) = Any_Type)
or else Etype (F) = Any_Type
@@ -3145,9 +3152,9 @@ package body Sem_Res is
-- aliased, or neither (4.6 (8)).
-- The additional rule 4.6 (24.9.2) seems unduly
- -- restrictive: the privacy requirement should not
- -- apply to generic types, and should be checked in
- -- an instance. ARG query is in order.
+ -- restrictive: the privacy requirement should not apply
+ -- to generic types, and should be checked in an
+ -- instance. ARG query is in order ???
Error_Msg_N
("both component types in a view conversion must be"
@@ -3562,7 +3569,7 @@ package body Sem_Res is
end if;
-- Check that subprograms don't have improper controlling
- -- arguments (RM 3.9.2 (9))
+ -- arguments (RM 3.9.2 (9)).
-- A primitive operation may have an access parameter of an
-- incomplete tagged type, but a dispatching call is illegal
@@ -4741,7 +4748,11 @@ package body Sem_Res is
else
pragma Assert (Is_Overloaded (Subp));
- Nam := Empty; -- We know that it will be assigned in loop below
+
+ -- Initialize Nam to prevent warning (we know it will be assigned
+ -- in the loop below, but the compiler does not know that).
+
+ Nam := Empty;
Get_First_Interp (Subp, I, It);
while Present (It.Typ) loop
@@ -5186,9 +5197,9 @@ package body Sem_Res is
if Present (First_Formal (Nam)) then
Resolve_Actuals (N, Nam);
- -- Overloaded literals are rewritten as function calls, for
- -- purpose of resolution. After resolution, we can replace
- -- the call with the literal itself.
+ -- Overloaded literals are rewritten as function calls, for purpose of
+ -- resolution. After resolution, we can replace the call with the
+ -- literal itself.
elsif Ekind (Nam) = E_Enumeration_Literal then
Copy_Node (Subp, N);
@@ -5251,7 +5262,8 @@ package body Sem_Res is
A := First_Actual (N);
while Present (F) and then Present (A) loop
if (Ekind (F) = E_Out_Parameter
- or else Ekind (F) = E_In_Out_Parameter)
+ or else
+ Ekind (F) = E_In_Out_Parameter)
and then Warn_On_Modified_As_Out_Parameter (F)
and then Is_Entity_Name (A)
and then Present (Entity (A))
@@ -5374,14 +5386,14 @@ package body Sem_Res is
elsif Root_Type (B_Typ) = Standard_Wide_Wide_Character then
return;
- -- If the entity is already set, this has already been resolved in
- -- a generic context, or comes from expansion. Nothing else to do.
+ -- If the entity is already set, this has already been resolved in a
+ -- generic context, or comes from expansion. Nothing else to do.
elsif Present (Entity (N)) then
return;
- -- Otherwise we have a user defined character type, and we can use
- -- the standard visibility mechanisms to locate the referenced entity
+ -- Otherwise we have a user defined character type, and we can use the
+ -- standard visibility mechanisms to locate the referenced entity.
else
C := Current_Entity (N);
@@ -5419,10 +5431,10 @@ package body Sem_Res is
T : Entity_Id;
begin
- -- If this is an intrinsic operation which is not predefined, use
- -- the types of its declared arguments to resolve the possibly
- -- overloaded operands. Otherwise the operands are unambiguous and
- -- specify the expected type.
+ -- If this is an intrinsic operation which is not predefined, use the
+ -- types of its declared arguments to resolve the possibly overloaded
+ -- operands. Otherwise the operands are unambiguous and specify the
+ -- expected type.
if Scope (Entity (N)) /= Standard_Standard then
T := Etype (First_Entity (Entity (N)));
@@ -5439,9 +5451,9 @@ package body Sem_Res is
Generate_Reference (T, N, ' ');
if T /= Any_Type then
- if T = Any_String
- or else T = Any_Composite
- or else T = Any_Character
+ if T = Any_String or else
+ T = Any_Composite or else
+ T = Any_Character
then
if T = Any_Character then
Ambiguous_Character (L);
@@ -5472,12 +5484,10 @@ package body Sem_Res is
Condition : constant Node_Id := First (Expressions (N));
Then_Expr : constant Node_Id := Next (Condition);
Else_Expr : constant Node_Id := Next (Then_Expr);
-
begin
Resolve (Condition, Standard_Boolean);
Resolve (Then_Expr, Typ);
Resolve (Else_Expr, Typ);
-
Set_Etype (N, Typ);
Eval_Conditional_Expression (N);
end Resolve_Conditional_Expression;
@@ -5603,9 +5613,9 @@ package body Sem_Res is
Eval_Named_Real (N);
-- Allow use of subtype only if it is a concurrent type where we are
- -- currently inside the body. This will eventually be expanded
- -- into a call to Self (for tasks) or _object (for protected
- -- objects). Any other use of a subtype is invalid.
+ -- currently inside the body. This will eventually be expanded into a
+ -- call to Self (for tasks) or _object (for protected objects). Any
+ -- other use of a subtype is invalid.
elsif Is_Type (E) then
if Is_Concurrent_Type (E)
@@ -5645,9 +5655,9 @@ package body Sem_Res is
-- In all other cases, just do the possible static evaluation
else
- -- A deferred constant that appears in an expression must have
- -- a completion, unless it has been removed by in-place expansion
- -- of an aggregate.
+ -- A deferred constant that appears in an expression must have a
+ -- completion, unless it has been removed by in-place expansion of
+ -- an aggregate.
if Ekind (E) = E_Constant
and then Comes_From_Source (E)
@@ -5704,11 +5714,11 @@ package body Sem_Res is
function Actual_Discriminant_Ref (Bound : Node_Id) return Node_Id;
-- If the bound is given by a discriminant, replace with a reference
- -- to the discriminant of the same name in the target task.
- -- If the entry name is the target of a requeue statement and the
- -- entry is in the current protected object, the bound to be used
- -- is the discriminal of the object (see apply_range_checks for
- -- details of the transformation).
+ -- to the discriminant of the same name in the target task. If the
+ -- entry name is the target of a requeue statement and the entry is
+ -- in the current protected object, the bound to be used is the
+ -- discriminal of the object (see apply_range_checks for details of
+ -- the transformation).
-----------------------------
-- Actual_Discriminant_Ref --
@@ -5748,7 +5758,8 @@ package body Sem_Res is
begin
if not Has_Discriminants (Tsk)
or else (not Is_Entity_Name (Lo)
- and then not Is_Entity_Name (Hi))
+ and then
+ not Is_Entity_Name (Hi))
then
return Entry_Index_Type (E);
@@ -5784,23 +5795,23 @@ package body Sem_Res is
end if;
if Is_Entity_Name (E_Name) then
- -- Entry call to an entry (or entry family) in the current task.
- -- This is legal even though the task will deadlock. Rewrite as
- -- call to current task.
- -- This can also be a call to an entry in an enclosing task.
- -- If this is a single task, we have to retrieve its name,
- -- because the scope of the entry is the task type, not the
- -- object. If the enclosing task is a task type, the identity
- -- of the task is given by its own self variable.
+ -- Entry call to an entry (or entry family) in the current task. This
+ -- is legal even though the task will deadlock. Rewrite as call to
+ -- current task.
+
+ -- This can also be a call to an entry in an enclosing task. If this
+ -- is a single task, we have to retrieve its name, because the scope
+ -- of the entry is the task type, not the object. If the enclosing
+ -- task is a task type, the identity of the task is given by its own
+ -- self variable.
- -- Finally this can be a requeue on an entry of the same task
- -- or protected object.
+ -- Finally this can be a requeue on an entry of the same task or
+ -- protected object.
S := Scope (Entity (E_Name));
for J in reverse 0 .. Scope_Stack.Last loop
-
if Is_Task_Type (Scope_Stack.Table (J).Entity)
and then not Comes_From_Source (S)
then
@@ -5837,9 +5848,9 @@ package body Sem_Res is
elsif Nkind (Entry_Name) = N_Selected_Component
and then Is_Overloaded (Prefix (Entry_Name))
then
- -- Use the entry name (which must be unique at this point) to
- -- find the prefix that returns the corresponding task type or
- -- protected type.
+ -- Use the entry name (which must be unique at this point) to find
+ -- the prefix that returns the corresponding task type or protected
+ -- type.
declare
Pref : constant Node_Id := Prefix (Entry_Name);
@@ -5869,8 +5880,8 @@ package body Sem_Res is
Index := First (Expressions (Entry_Name));
Resolve (Index, Entry_Index_Type (Nam));
- -- Up to this point the expression could have been the actual
- -- in a simple entry call, and be given by a named association.
+ -- Up to this point the expression could have been the actual in a
+ -- simple entry call, and be given by a named association.
if Nkind (Index) = N_Parameter_Association then
Error_Msg_N ("expect expression for entry index", Index);
@@ -5895,8 +5906,8 @@ package body Sem_Res is
Was_Over : Boolean;
begin
- -- We kill all checks here, because it does not seem worth the
- -- effort to do anything better, an entry call is a big operation.
+ -- We kill all checks here, because it does not seem worth the effort to
+ -- do anything better, an entry call is a big operation.
Kill_All_Checks;
@@ -6036,17 +6047,17 @@ package body Sem_Res is
end if;
end if;
- -- After resolution, entry calls and protected procedure calls
- -- are changed into entry calls, for expansion. The structure
- -- of the node does not change, so it can safely be done in place.
- -- Protected function calls must keep their structure because they
- -- are subexpressions.
+ -- After resolution, entry calls and protected procedure calls are
+ -- changed into entry calls, for expansion. The structure of the node
+ -- does not change, so it can safely be done in place. Protected
+ -- function calls must keep their structure because they are
+ -- subexpressions.
if Ekind (Nam) /= E_Function then
-- A protected operation that is not a function may modify the
- -- corresponding object, and cannot apply to a constant.
- -- If this is an internal call, the prefix is the type itself.
+ -- corresponding object, and cannot apply to a constant. If this
+ -- is an internal call, the prefix is the type itself.
if Is_Protected_Type (Scope (Nam))
and then not Is_Variable (Obj)
@@ -6083,13 +6094,12 @@ package body Sem_Res is
-- Resolve_Equality_Op --
-------------------------
- -- Both arguments must have the same type, and the boolean context
- -- does not participate in the resolution. The first pass verifies
- -- that the interpretation is not ambiguous, and the type of the left
- -- argument is correctly set, or is Any_Type in case of ambiguity.
- -- If both arguments are strings or aggregates, allocators, or Null,
- -- they are ambiguous even though they carry a single (universal) type.
- -- Diagnose this case here.
+ -- Both arguments must have the same type, and the boolean context does
+ -- not participate in the resolution. The first pass verifies that the
+ -- interpretation is not ambiguous, and the type of the left argument is
+ -- correctly set, or is Any_Type in case of ambiguity. If both arguments
+ -- are strings or aggregates, allocators, or Null, they are ambiguous even
+ -- though they carry a single (universal) type. Diagnose this case here.
procedure Resolve_Equality_Op (N : Node_Id; Typ : Entity_Id) is
L : constant Node_Id := Left_Opnd (N);
@@ -6222,13 +6232,13 @@ package body Sem_Res is
Error_Msg_NE ("cannot call abstract subprogram &!", N, Entity (N));
end if;
- -- Ada 2005: If one operand is an anonymous access type, convert
- -- the other operand to it, to ensure that the underlying types
- -- match in the back-end. Same for access_to_subprogram, and the
- -- conversion verifies that the types are subtype conformant.
+ -- Ada 2005: If one operand is an anonymous access type, convert the
+ -- other operand to it, to ensure that the underlying types match in
+ -- the back-end. Same for access_to_subprogram, and the conversion
+ -- verifies that the types are subtype conformant.
- -- We apply the same conversion in the case one of the operands is
- -- a private subtype of the type of the other.
+ -- We apply the same conversion in the case one of the operands is a
+ -- private subtype of the type of the other.
-- Why the Expander_Active test here ???
@@ -6528,8 +6538,8 @@ package body Sem_Res is
elsif Typ /= Etype (Left_Opnd (N))
or else Typ /= Etype (Right_Opnd (N))
then
- -- Add explicit conversion where needed, and save interpretations
- -- in case operands are overloaded.
+ -- Add explicit conversion where needed, and save interpretations in
+ -- case operands are overloaded.
Arg1 := Convert_To (Typ, Left_Opnd (N));
Arg2 := Convert_To (Typ, Right_Opnd (N));
@@ -6683,7 +6693,7 @@ package body Sem_Res is
then
T := Etype (R);
- -- Ada 2005 (AI-251): Give support to the following case:
+ -- Ada 2005 (AI-251): Support the following case:
-- type I is interface;
-- type T is tagged ...
@@ -6693,7 +6703,7 @@ package body Sem_Res is
-- return O in T'Class.
-- end Test;
- -- In this case we have nothing else to do; the membership test will be
+ -- In this case we have nothing else to do. The membership test will be
-- done at run-time.
elsif Ada_Version >= Ada_05
@@ -6745,8 +6755,8 @@ package body Sem_Res is
and then Ekind (Typ) = E_Anonymous_Access_Type
and then Comes_From_Source (N)
then
- -- In the common case of a call which uses an explicitly null
- -- value for an access parameter, give specialized error message.
+ -- In the common case of a call which uses an explicitly null value
+ -- for an access parameter, give specialized error message.
if Nkind_In (Parent (N), N_Procedure_Call_Statement,
N_Function_Call)
@@ -6782,9 +6792,9 @@ package body Sem_Res is
end if;
end if;
- -- In a distributed context, null for a remote access to subprogram
- -- may need to be replaced with a special record aggregate. In this
- -- case, return after having done the transformation.
+ -- In a distributed context, null for a remote access to subprogram may
+ -- need to be replaced with a special record aggregate. In this case,
+ -- return after having done the transformation.
if (Ekind (Typ) = E_Record_Type
or else Is_Remote_Access_To_Subprogram_Type (Typ))
@@ -6811,7 +6821,7 @@ package body Sem_Res is
-- up the tree following Parent pointers, calling Resolve_Op_Concat_Rest
-- to do the rest of the work at each level. The Parent pointers allow
-- us to avoid recursion, and thus avoid running out of memory. See also
- -- Sem_Ch4.Analyze_Concatenation, where a similar hack is used.
+ -- Sem_Ch4.Analyze_Concatenation, where a similar approach is used.
NN : Node_Id := N;
Op1 : Node_Id;
@@ -6927,7 +6937,8 @@ package body Sem_Res is
or else Base_Type (It.Typ) =
Base_Type (Component_Type (Typ))
then
- Error_Msg_N ("\\possible interpretation#", Arg);
+ Error_Msg_N -- CODEFIX
+ ("\\possible interpretation#", Arg);
end if;
Get_Next_Interp (I, It);
@@ -6968,7 +6979,7 @@ package body Sem_Res is
begin
-- The parser folds an enormous sequence of concatenations of string
-- literals into "" & "...", where the Is_Folded_In_Parser flag is set
- -- in the right. If the expression resolves to a predefined "&"
+ -- in the right operand. If the expression resolves to a predefined "&"
-- operator, all is well. Otherwise, the parser's folding is wrong, so
-- we give an error. See P_Simple_Expression in Par.Ch4.
@@ -7007,9 +7018,9 @@ package body Sem_Res is
Eval_Concatenation (N);
end if;
- -- If this is not a static concatenation, but the result is a
- -- string type (and not an array of strings) ensure that static
- -- string operands have their subtypes properly constructed.
+ -- If this is not a static concatenation, but the result is a string
+ -- type (and not an array of strings) ensure that static string operands
+ -- have their subtypes properly constructed.
if Nkind (N) /= N_String_Literal
and then Is_Character_Type (Component_Type (Typ))
@@ -7717,8 +7728,8 @@ package body Sem_Res is
begin
if Is_Overloaded (Name) then
- -- Use the context type to select the prefix that yields the
- -- correct array type.
+ -- Use the context type to select the prefix that yields the correct
+ -- array type.
declare
I : Interp_Index;
@@ -7832,13 +7843,13 @@ package body Sem_Res is
-- undesired dependence on such run-time unit.
and then
- (VM_Target /= No_VM
- or else not
- (RTU_Loaded (Ada_Tags)
- and then Nkind (Prefix (N)) = N_Selected_Component
- and then Present (Entity (Selector_Name (Prefix (N))))
- and then Entity (Selector_Name (Prefix (N))) =
- RTE_Record_Component (RE_Prims_Ptr)))
+ (not Tagged_Type_Expansion
+ or else not
+ (RTU_Loaded (Ada_Tags)
+ and then Nkind (Prefix (N)) = N_Selected_Component
+ and then Present (Entity (Selector_Name (Prefix (N))))
+ and then Entity (Selector_Name (Prefix (N))) =
+ RTE_Record_Component (RE_Prims_Ptr)))
then
Apply_Range_Check (Drange, Etype (Index));
end if;
@@ -7891,8 +7902,8 @@ package body Sem_Res is
or else Typ = Standard_Wide_Wide_String)
and then Nkind (Original_Node (N)) /= N_String_Literal);
- -- If the resolving type is itself a string literal subtype, we
- -- can just reuse it, since there is no point in creating another.
+ -- If the resolving type is itself a string literal subtype, we can just
+ -- reuse it, since there is no point in creating another.
if Ekind (Typ) = E_String_Literal_Subtype then
Subtype_Id := Typ;
@@ -7930,8 +7941,8 @@ package body Sem_Res is
return;
end if;
- -- The validity of a null string has been checked in the
- -- call to Eval_String_Literal.
+ -- The validity of a null string has been checked in the call to
+ -- Eval_String_Literal.
if Strlen = 0 then
return;
@@ -7977,7 +7988,9 @@ package body Sem_Res is
-- If we are out of range, post error. This is one of the
-- very few places that we place the flag in the middle of
- -- a token, right under the offending wide character.
+ -- a token, right under the offending wide character. Not
+ -- quite clear if this is right wrt wide character encoding
+ -- sequences, but it's only an error message!
Error_Msg
("literal out of range of type Standard.Character",
@@ -8209,26 +8222,26 @@ package body Sem_Res is
Resolve (Operand);
-- Note: we do the Eval_Type_Conversion call before applying the
- -- required checks for a subtype conversion. This is important,
- -- since both are prepared under certain circumstances to change
- -- the type conversion to a constraint error node, but in the case
- -- of Eval_Type_Conversion this may reflect an illegality in the
- -- static case, and we would miss the illegality (getting only a
- -- warning message), if we applied the type conversion checks first.
+ -- required checks for a subtype conversion. This is important, since
+ -- both are prepared under certain circumstances to change the type
+ -- conversion to a constraint error node, but in the case of
+ -- Eval_Type_Conversion this may reflect an illegality in the static
+ -- case, and we would miss the illegality (getting only a warning
+ -- message), if we applied the type conversion checks first.
Eval_Type_Conversion (N);
- -- Even when evaluation is not possible, we may be able to simplify
- -- the conversion or its expression. This needs to be done before
- -- applying checks, since otherwise the checks may use the original
- -- expression and defeat the simplifications. This is specifically
- -- the case for elimination of the floating-point Truncation
- -- attribute in float-to-int conversions.
+ -- Even when evaluation is not possible, we may be able to simplify the
+ -- conversion or its expression. This needs to be done before applying
+ -- checks, since otherwise the checks may use the original expression
+ -- and defeat the simplifications. This is specifically the case for
+ -- elimination of the floating-point Truncation attribute in
+ -- float-to-int conversions.
Simplify_Type_Conversion (N);
- -- If after evaluation we still have a type conversion, then we
- -- may need to apply checks required for a subtype conversion.
+ -- If after evaluation we still have a type conversion, then we may need
+ -- to apply checks required for a subtype conversion.
-- Skip these type conversion checks if universal fixed operands
-- operands involved, since range checks are handled separately for
@@ -8242,9 +8255,9 @@ package body Sem_Res is
Apply_Type_Conversion_Checks (N);
end if;
- -- Issue warning for conversion of simple object to its own type
- -- We have to test the original nodes, since they may have been
- -- rewritten by various optimizations.
+ -- Issue warning for conversion of simple object to its own type. We
+ -- have to test the original nodes, since they may have been rewritten
+ -- by various optimizations.
Orig_N := Original_Node (N);
@@ -8274,7 +8287,7 @@ package body Sem_Res is
and then Covers (Orig_T, Etype (Entity (Orig_N)))))
then
Error_Msg_Node_2 := Orig_T;
- Error_Msg_NE
+ Error_Msg_NE -- CODEFIX
("?redundant conversion, & is of type &!", N, Entity (Orig_N));
end if;
end if;
@@ -8438,9 +8451,9 @@ package body Sem_Res is
end if;
end if;
- -- Generate warning for expressions like -5 mod 3 for integers. No
- -- need to worry in the floating-point case, since parens do not affect
- -- the result so there is no point in giving in a warning.
+ -- Generate warning for expressions like -5 mod 3 for integers. No need
+ -- to worry in the floating-point case, since parens do not affect the
+ -- result so there is no point in giving in a warning.
declare
Norig : constant Node_Id := Original_Node (N);
@@ -8468,7 +8481,7 @@ package body Sem_Res is
then
-- For mod, we always give the warning, since the value is
-- affected by the parenthesization (e.g. (-5) mod 315 /=
- -- (5 mod 315)). But for the other cases, the only concern is
+ -- -(5 mod 315)). But for the other cases, the only concern is
-- overflow, e.g. for the case of 8 big signed (-(2 * 64)
-- overflows, but (-2) * 64 does not). So we try to give the
-- message only when overflow is possible.
@@ -8490,8 +8503,8 @@ package body Sem_Res is
LB := Expr_Value (Type_Low_Bound (Base_Type (Typ)));
end if;
- -- Note that the test below is deliberately excluding
- -- the largest negative number, since that is a potentially
+ -- Note that the test below is deliberately excluding the
+ -- largest negative number, since that is a potentially
-- troublesome case (e.g. -2 * x, where the result is the
-- largest negative integer has an overflow with 2 * x).
@@ -8637,9 +8650,9 @@ package body Sem_Res is
Op_Node : Node_Id;
begin
- -- Rewrite the operator node using the real operator, not its
- -- renaming. Exclude user-defined intrinsic operations of the same
- -- name, which are treated separately and rewritten as calls.
+ -- Rewrite the operator node using the real operator, not its renaming.
+ -- Exclude user-defined intrinsic operations of the same name, which are
+ -- treated separately and rewritten as calls.
if Ekind (Op) /= E_Function
or else Chars (N) /= Nam
@@ -8674,7 +8687,7 @@ package body Sem_Res is
N_Op_Expon | N_Op_Mod | N_Op_Rem =>
Resolve_Intrinsic_Operator (N, Typ);
- when N_Op_Plus | N_Op_Minus | N_Op_Abs =>
+ when N_Op_Plus | N_Op_Minus | N_Op_Abs =>
Resolve_Intrinsic_Unary_Operator (N, Typ);
when others =>
@@ -8778,7 +8791,7 @@ package body Sem_Res is
procedure Set_String_Literal_Subtype (N : Node_Id; Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (N);
Low_Bound : constant Node_Id :=
- Type_Low_Bound (Etype (First_Index (Typ)));
+ Type_Low_Bound (Etype (First_Index (Typ)));
Subtype_Id : Entity_Id;
begin
@@ -8913,7 +8926,8 @@ package body Sem_Res is
Scop : Entity_Id;
procedure Fixed_Point_Error;
- -- If true ambiguity, give details
+ -- Give error messages for true ambiguity. Messages are posted on node
+ -- N, and entities T1, T2 are the possible interpretations.
-----------------------
-- Fixed_Point_Error --
@@ -9242,8 +9256,8 @@ package body Sem_Res is
N1 : Entity_Id;
begin
- -- Remove procedure calls, which syntactically cannot appear
- -- in this context, but which cannot be removed by type checking,
+ -- Remove procedure calls, which syntactically cannot appear in
+ -- this context, but which cannot be removed by type checking,
-- because the context does not impose a type.
-- When compiling for VMS, spurious ambiguities can be produced
@@ -9302,10 +9316,12 @@ package body Sem_Res is
Error_Msg_N ("ambiguous operand in conversion", Operand);
Error_Msg_Sloc := Sloc (It.Nam);
- Error_Msg_N ("\\possible interpretation#!", Operand);
+ Error_Msg_N -- CODEFIX
+ ("\\possible interpretation#!", Operand);
Error_Msg_Sloc := Sloc (N1);
- Error_Msg_N ("\\possible interpretation#!", Operand);
+ Error_Msg_N -- CODEFIX
+ ("\\possible interpretation#!", Operand);
return False;
end if;
@@ -9371,8 +9387,8 @@ package body Sem_Res is
and then Is_Interface (Directly_Designated_Type (Target_Type))
then
-- Check the static accessibility rule of 4.6(17). Note that the
- -- check is not enforced when within an instance body, since the RM
- -- requires such cases to be caught at run time.
+ -- check is not enforced when within an instance body, since the
+ -- RM requires such cases to be caught at run time.
if Ekind (Target_Type) /= E_Anonymous_Access_Type then
if Type_Access_Level (Opnd_Type) >
@@ -9403,16 +9419,16 @@ package body Sem_Res is
then
-- When the operand is a selected access discriminant the check
-- needs to be made against the level of the object denoted by
- -- the prefix of the selected name. (Object_Access_Level
- -- handles checking the prefix of the operand for this case.)
+ -- the prefix of the selected name (Object_Access_Level handles
+ -- checking the prefix of the operand for this case).
if Nkind (Operand) = N_Selected_Component
and then Object_Access_Level (Operand) >
Type_Access_Level (Target_Type)
then
- -- In an instance, this is a run-time check, but one we
- -- know will fail, so generate an appropriate warning.
- -- The raise will be generated by Expand_N_Type_Conversion.
+ -- In an instance, this is a run-time check, but one we know
+ -- will fail, so generate an appropriate warning. The raise
+ -- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
Error_Msg_N
@@ -9481,9 +9497,9 @@ package body Sem_Res is
if Type_Access_Level (Opnd_Type)
> Type_Access_Level (Target_Type)
then
- -- In an instance, this is a run-time check, but one we
- -- know will fail, so generate an appropriate warning.
- -- The raise will be generated by Expand_N_Type_Conversion.
+ -- In an instance, this is a run-time check, but one we know
+ -- will fail, so generate an appropriate warning. The raise
+ -- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
Error_Msg_N
@@ -9513,16 +9529,16 @@ package body Sem_Res is
-- When the operand is a selected access discriminant the check
-- needs to be made against the level of the object denoted by
- -- the prefix of the selected name. (Object_Access_Level
- -- handles checking the prefix of the operand for this case.)
+ -- the prefix of the selected name (Object_Access_Level handles
+ -- checking the prefix of the operand for this case).
if Nkind (Operand) = N_Selected_Component
and then Object_Access_Level (Operand) >
Type_Access_Level (Target_Type)
then
- -- In an instance, this is a run-time check, but one we
- -- know will fail, so generate an appropriate warning.
- -- The raise will be generated by Expand_N_Type_Conversion.
+ -- In an instance, this is a run-time check, but one we know
+ -- will fail, so generate an appropriate warning. The raise
+ -- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
Error_Msg_N
@@ -9559,6 +9575,8 @@ package body Sem_Res is
end if;
end if;
+ -- Need some comments here, and a name for this block ???
+
declare
function Full_Designated_Type (T : Entity_Id) return Entity_Id;
-- Helper function to handle limited views
@@ -9580,12 +9598,16 @@ package body Sem_Res is
end if;
end Full_Designated_Type;
+ -- Local Declarations
+
Target : constant Entity_Id := Full_Designated_Type (Target_Type);
Opnd : constant Entity_Id := Full_Designated_Type (Opnd_Type);
Same_Base : constant Boolean :=
Base_Type (Target) = Base_Type (Opnd);
+ -- Start of processing for ???
+
begin
if Is_Tagged_Type (Target) then
return Valid_Tagged_Conversion (Target, Opnd);
@@ -9747,8 +9769,8 @@ package body Sem_Res is
elsif (In_Instance or In_Inlined_Body)
and then
- Root_Type (Underlying_Type (Target_Type)) =
- Root_Type (Underlying_Type (Opnd_Type))
+ Root_Type (Underlying_Type (Target_Type)) =
+ Root_Type (Underlying_Type (Opnd_Type))
then
return True;
@@ -9759,13 +9781,11 @@ package body Sem_Res is
then
Error_Msg_N ("target type must be general access type!", N);
Error_Msg_NE ("add ALL to }!", N, Target_Type);
-
return False;
else
Error_Msg_NE ("invalid conversion, not compatible with }",
N, Opnd_Type);
-
return False;
end if;
end Valid_Conversion;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 337d1ac0cf0..31f3ccd1a4d 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -5161,9 +5161,7 @@ package body Sem_Util is
begin
Save_Interps (N, New_Prefix);
- Rewrite (N,
- Make_Explicit_Dereference (Sloc (N),
- Prefix => New_Prefix));
+ Rewrite (N, Make_Explicit_Dereference (Sloc (N), Prefix => New_Prefix));
Set_Etype (N, Designated_Type (Etype (New_Prefix)));
@@ -5520,6 +5518,19 @@ package body Sem_Util is
return False;
end Is_Controlling_Limited_Procedure;
+ -----------------------------
+ -- Is_CPP_Constructor_Call --
+ -----------------------------
+
+ function Is_CPP_Constructor_Call (N : Node_Id) return Boolean is
+ begin
+ return Nkind (N) = N_Function_Call
+ and then Is_Class_Wide_Type (Etype (N))
+ and then Is_CPP_Class (Etype (Etype (N)))
+ and then Is_Constructor (Entity (Name (N)))
+ and then Is_Imported (Entity (Name (N)));
+ end Is_CPP_Constructor_Call;
+
----------------------------------------------
-- Is_Dependent_Component_Of_Mutable_Object --
----------------------------------------------
@@ -5909,7 +5920,7 @@ package body Sem_Util is
-- uninitialized case. Note that this applies both to the
-- uTag entry and the main vtable pointer (CPP_Class case).
- and then (VM_Target = No_VM or else not Is_Tag (Ent))
+ and then (Tagged_Type_Expansion or else not Is_Tag (Ent))
then
return False;
end if;
@@ -7261,23 +7272,58 @@ package body Sem_Util is
return N = Prefix (P)
and then Name_Implies_Lvalue_Prefix (Attribute_Name (P));
- when N_Expanded_Name |
- N_Indexed_Component |
- N_Selected_Component |
- N_Slice =>
- if Is_Access_Type (Etype (N)) then
- return False; -- P is an implicit dereference
+ -- For an expanded name, the name is an lvalue if the expanded name
+ -- is an lvalue, but the prefix is never an lvalue, since it is just
+ -- the scope where the name is found.
+
+ when N_Expanded_Name =>
+ if N = Prefix (P) then
+ return May_Be_Lvalue (P);
+ else
+ return False;
+ end if;
+
+ -- For a selected component A.B, A is certainly an Lvalue if A.B is
+ -- an Lvalue. B is a little interesting, if we have A.B:=3, there is
+ -- some discussion as to whether B is an Lvalue or not, we choose to
+ -- say it is. Note however that A is not an Lvalue if it is of an
+ -- access type since this is an implicit dereference.
+
+ when N_Selected_Component =>
+ if N = Prefix (P)
+ and then Present (Etype (N))
+ and then Is_Access_Type (Etype (N))
+ then
+ return False;
else
- return N = Prefix (P);
+ return May_Be_Lvalue (P);
end if;
+ -- For an indexed component or slice, the index or slice bounds is
+ -- never an Lvalue. The prefix is an lvalue if the indexed component
+ -- or slice is an Lvalue, except if it is an access type, where we
+ -- have an implicit dereference.
+
+ when N_Indexed_Component =>
+ if N /= Prefix (P)
+ or else (Present (Etype (N)) and then Is_Access_Type (Etype (N)))
+ then
+ return False;
+ else
+ return May_Be_Lvalue (P);
+ end if;
+
+ -- Prefix of a reference is an Lvalue if the reference is an Lvalue
+
when N_Reference =>
- return N = Prefix (P);
+ return May_Be_Lvalue (P);
+
+ -- Prefix of explicit dereference is never an Lvalue
when N_Explicit_Dereference =>
return False;
- -- Function call arguments are never lvalues
+ -- Function call arguments are never Lvalues
when N_Function_Call =>
return False;
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 4046b785892..9e2d3ffcf1e 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -644,6 +644,9 @@ package Sem_Util is
-- Ada 2005 (AI-345): Determine whether Proc_Nam is a primitive procedure
-- of a limited interface with a controlling first parameter.
+ function Is_CPP_Constructor_Call (N : Node_Id) return Boolean;
+ -- Returns True if N is a call to a CPP constructor
+
function Is_Dependent_Component_Of_Mutable_Object
(Object : Node_Id) return Boolean;
-- Returns True if Object is the name of a subcomponent that
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index ec1d1d767e0..8132531cc0c 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -954,8 +954,8 @@ package body Sem_Warn is
-- here (note that the dereference may not be explicit in
-- the source, for example in the case of a dispatching call
-- with an anonymous access controlling formal, or of an
- -- assignment of a pointer involving discriminant check
- -- on the designated object).
+ -- assignment of a pointer involving discriminant check on
+ -- the designated object).
if not Warnings_Off_E1 then
Error_Msg_NE ("?& may be null!", UR, E1);
@@ -1005,7 +1005,7 @@ package body Sem_Warn is
and then not Has_Pragma_Unmodified_Check_Spec (E1)
then
if not Warnings_Off_E1 then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?& is not modified, "
& "could be declared constant!",
E1);
@@ -1155,7 +1155,7 @@ package body Sem_Warn is
elsif not Has_Unreferenced (E1)
and then not Warnings_Off_E1
then
- Output_Reference_Error
+ Output_Reference_Error -- CODEFIX
("?variable& is never read and never assigned!");
end if;
@@ -2342,7 +2342,7 @@ package body Sem_Warn is
end if;
if not Is_Visible_Renaming then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\?with clause might be moved to body!",
Name (Item));
end if;
@@ -2370,7 +2370,7 @@ package body Sem_Warn is
if Unit = Spec_Unit then
Set_Unreferenced_In_Spec (Item);
else
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?unit& is never instantiated!", Name (Item));
end if;
@@ -2381,7 +2381,7 @@ package body Sem_Warn is
elsif Unreferenced_In_Spec (Item) then
Error_Msg_N
("?unit& is not instantiated in spec!", Name (Item));
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("\?with clause can be moved to body!", Name (Item));
end if;
end if;
@@ -3782,7 +3782,7 @@ package body Sem_Warn is
and then No (Renamed_Object (E))
then
if not Has_Pragma_Unmodified_Check_Spec (E) then
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?variable & is assigned but never read!", E);
end if;
@@ -3871,11 +3871,11 @@ package body Sem_Warn is
Error_Msg_N ("?procedure & is not referenced!", E);
when E_Generic_Procedure =>
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?generic procedure & is never instantiated!", E);
when E_Generic_Function =>
- Error_Msg_N
+ Error_Msg_N -- CODEFIX
("?generic function & is never instantiated!", E);
when Type_Kind =>
@@ -3903,8 +3903,8 @@ package body Sem_Warn is
X : Node_Id;
function Check_Ref (N : Node_Id) return Traverse_Result;
- -- Used to instantiate Traverse_Func. Returns Abandon if
- -- a reference to the entity in question is found.
+ -- Used to instantiate Traverse_Func. Returns Abandon if a reference to
+ -- the entity in question is found.
function Test_No_Refs is new Traverse_Func (Check_Ref);
@@ -3935,7 +3935,7 @@ package body Sem_Warn is
-- variable with the last assignment field set, with warnings enabled,
-- and which is not imported or exported. We also check that it is OK
-- to capture the value. We are not going to capture any value, but
- -- the warning messages depends on the same kind of conditions.
+ -- the warning message depends on the same kind of conditions.
if Is_Assignable (Ent)
and then not Is_Return_Object (Ent)
@@ -4027,18 +4027,27 @@ package body Sem_Warn is
-- Otherwise we are at the outer level. An exception
-- handler is significant only if it references the
- -- variable in question.
+ -- variable in question, or if the entity in question
+ -- is an OUT or IN OUT parameter, which which case
+ -- the caller can reference it after the exception
+ -- hanlder completes
else
- X := First (Exception_Handlers (P));
- while Present (X) loop
- if Test_No_Refs (X) = Abandon then
- Set_Last_Assignment (Ent, Empty);
- return;
- end if;
+ if Is_Formal (Ent) then
+ Set_Last_Assignment (Ent, Empty);
+ return;
- X := Next (X);
- end loop;
+ else
+ X := First (Exception_Handlers (P));
+ while Present (X) loop
+ if Test_No_Refs (X) = Abandon then
+ Set_Last_Assignment (Ent, Empty);
+ return;
+ end if;
+
+ X := Next (X);
+ end loop;
+ end if;
end if;
end if;
end if;
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index 59ddd5ceabc..30ba9802a37 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -1979,6 +1979,14 @@ package body Sinfo is
return Node2 (N);
end Next_Entity;
+ function Next_Implicit_With
+ (N : Node_Id) return Node_Id is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ return Node3 (N);
+ end Next_Implicit_With;
+
function Next_Named_Actual
(N : Node_Id) return Node_Id is
begin
@@ -4759,6 +4767,14 @@ package body Sinfo is
Set_Node2 (N, Val); -- semantic field, no parent set
end Set_Next_Entity;
+ procedure Set_Next_Implicit_With
+ (N : Node_Id; Val : Node_Id) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_With_Clause);
+ Set_Node3 (N, Val); -- semantic field, no parent set
+ end Set_Next_Implicit_With;
+
procedure Set_Next_Named_Actual
(N : Node_Id; Val : Node_Id) is
begin
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 5aae9c059c9..7325b76ea53 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -1364,6 +1364,16 @@ package Sinfo is
-- scope are chained, and this field is used as the forward pointer for
-- this list. See Einfo for further details.
+ -- Next_Implicit_With (Node3-Sem)
+ -- Present in N_With_Clause. Part of a chain of with_clauses generated
+ -- in rtsfind to indicate implicit dependencies on predefined units. Used
+ -- to prevent multiple with_clauses for the same unit in a given context.
+ -- A postorder traversal of the tree whose nodes are units and whose
+ -- links are with_clauses defines the order in which Inspector must
+ -- examine a compiled unit and its full context. This ordering ensures
+ -- that any subprogram call is examined after the subprogram declartion
+ -- has been seen.
+
-- Next_Named_Actual (Node4-Sem)
-- Present in parameter association node. Set during semantic analysis to
-- point to the next named parameter, where parameters are ordered by
@@ -5450,6 +5460,7 @@ package Sinfo is
-- N_With_Clause
-- Sloc points to first token of library unit name
-- Name (Node2)
+ -- Next_Implicit_With (Node3-Sem)
-- Library_Unit (Node4-Sem)
-- Corresponding_Spec (Node5-Sem)
-- First_Name (Flag5) (set to True if first name or only one name)
@@ -8062,6 +8073,9 @@ package Sinfo is
function Next_Entity
(N : Node_Id) return Node_Id; -- Node2
+ function Next_Implicit_With
+ (N : Node_Id) return Node_Id; -- Node3
+
function Next_Named_Actual
(N : Node_Id) return Node_Id; -- Node4
@@ -8947,6 +8961,9 @@ package Sinfo is
procedure Set_Next_Entity
(N : Node_Id; Val : Node_Id); -- Node2
+ procedure Set_Next_Implicit_With
+ (N : Node_Id; Val : Node_Id); -- Node3
+
procedure Set_Next_Named_Actual
(N : Node_Id; Val : Node_Id); -- Node4
@@ -11064,6 +11081,7 @@ package Sinfo is
pragma Inline (Name);
pragma Inline (Names);
pragma Inline (Next_Entity);
+ pragma Inline (Next_Implicit_With);
pragma Inline (Next_Named_Actual);
pragma Inline (Next_Pragma);
pragma Inline (Next_Rep_Item);
@@ -11356,6 +11374,7 @@ package Sinfo is
pragma Inline (Set_Name);
pragma Inline (Set_Names);
pragma Inline (Set_Next_Entity);
+ pragma Inline (Set_Next_Implicit_With);
pragma Inline (Set_Next_Named_Actual);
pragma Inline (Set_Next_Pragma);
pragma Inline (Set_Next_Rep_Item);
diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb
index 08cc5f8301a..fe38b751dd2 100644
--- a/gcc/ada/sinput-l.adb
+++ b/gcc/ada/sinput-l.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -453,6 +453,12 @@ package body Sinput.L is
-- Preprocess the source if it needs to be preprocessed
if Preprocessing_Needed then
+
+ -- Temporarily set the Source_File_Index_Table entries for the
+ -- source, to avoid crash when reporting an error.
+
+ Set_Source_File_Index_Table (X);
+
if Opt.List_Preprocessing_Symbols then
Get_Name_String (N);
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index d780804b70f..020e69df26d 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -32,10 +32,12 @@
pragma Style_Checks (All_Checks);
-- Subprograms not all in alpha order
+with Atree; use Atree;
with Debug; use Debug;
with Opt; use Opt;
with Output; use Output;
with Tree_IO; use Tree_IO;
+with Sinfo; use Sinfo;
with System; use System;
with Widechar; use Widechar;
@@ -238,6 +240,246 @@ package body Sinput is
return;
end Build_Location_String;
+ ---------------------
+ -- Expr_First_Char --
+ ---------------------
+
+ function Expr_First_Char (Expr : Node_Id) return Source_Ptr is
+
+ function First_Char (Expr : Node_Id; PC : Nat) return Source_Ptr;
+ -- Internal recursive function used to traverse the expression tree.
+ -- Returns the source pointer corresponding to the first location of
+ -- the subexpression N, followed by backing up the given (PC) number of
+ -- preceding left parentheses.
+
+ ----------------
+ -- First_Char --
+ ----------------
+
+ function First_Char (Expr : Node_Id; PC : Nat) return Source_Ptr is
+ N : constant Node_Id := Original_Node (Expr);
+ Count : constant Nat := PC + Paren_Count (N);
+ Kind : constant N_Subexpr := Nkind (N);
+ Loc : Source_Ptr;
+
+ begin
+ case Kind is
+ when N_And_Then |
+ N_In |
+ N_Not_In |
+ N_Or_Else |
+ N_Binary_Op =>
+ return First_Char (Left_Opnd (N), Count);
+
+ when N_Attribute_Reference |
+ N_Expanded_Name |
+ N_Explicit_Dereference |
+ N_Indexed_Component |
+ N_Reference |
+ N_Selected_Component |
+ N_Slice =>
+ return First_Char (Prefix (N), Count);
+
+ when N_Function_Call =>
+ return First_Char (Sinfo.Name (N), Count);
+
+ when N_Qualified_Expression |
+ N_Type_Conversion =>
+ return First_Char (Subtype_Mark (N), Count);
+
+ when N_Range =>
+ return First_Char (Low_Bound (N), Count);
+
+ -- Nodes that should not appear in original expression trees
+
+ when N_Procedure_Call_Statement |
+ N_Raise_xxx_Error |
+ N_Subprogram_Info |
+ N_Unchecked_Expression |
+ N_Unchecked_Type_Conversion |
+ N_Conditional_Expression =>
+ raise Program_Error;
+
+ -- Cases where the Sloc points to the start of the tokem, but we
+ -- still need to handle the sequence of left parentheses.
+
+ when N_Identifier |
+ N_Operator_Symbol |
+ N_Character_Literal |
+ N_Integer_Literal |
+ N_Null |
+ N_Unary_Op |
+ N_Aggregate |
+ N_Allocator |
+ N_Extension_Aggregate |
+ N_Real_Literal |
+ N_String_Literal =>
+
+ Loc := Sloc (N);
+
+ -- Skip past parens
+
+ -- This is not right, it does not deal with skipping comments
+ -- and probably also has wide character problems ???
+
+ if Count > 0 then
+ declare
+ SFI : constant Source_File_Index :=
+ Get_Source_File_Index (Loc);
+ Src : constant Source_Buffer_Ptr := Source_Text (SFI);
+ Fst : constant Source_Ptr := Source_First (SFI);
+
+ begin
+ for J in 1 .. Count loop
+ loop
+ exit when Loc = Fst;
+ Loc := Loc - 1;
+ exit when Src (Loc) >= ' ';
+ end loop;
+
+ exit when Src (Loc) /= '(';
+ end loop;
+ end;
+ end if;
+
+ return Loc;
+ end case;
+ end First_Char;
+
+ -- Start of processing for Expr_First_Char
+
+ begin
+ pragma Assert (Nkind (Expr) in N_Subexpr);
+ return First_Char (Expr, 0);
+ end Expr_First_Char;
+
+ --------------------
+ -- Expr_Last_Char --
+ --------------------
+
+ function Expr_Last_Char (Expr : Node_Id) return Source_Ptr is
+
+ function Last_Char (Expr : Node_Id; PC : Nat) return Source_Ptr;
+ -- Internal recursive function used to traverse the expression tree.
+ -- Returns the source pointer corresponding to the last location of
+ -- the subexpression N, followed by ztepping to the last of the given
+ -- number of right parentheses.
+
+ ---------------
+ -- Last_Char --
+ ---------------
+
+ function Last_Char (Expr : Node_Id; PC : Nat) return Source_Ptr is
+ N : constant Node_Id := Original_Node (Expr);
+ Count : constant Nat := PC + Paren_Count (N);
+ Kind : constant N_Subexpr := Nkind (N);
+ Loc : Source_Ptr;
+
+ begin
+ case Kind is
+ when N_And_Then |
+ N_In |
+ N_Not_In |
+ N_Or_Else |
+ N_Binary_Op =>
+ return Last_Char (Right_Opnd (N), Count);
+
+ when N_Attribute_Reference |
+ N_Expanded_Name |
+ N_Explicit_Dereference |
+ N_Indexed_Component |
+ N_Reference |
+ N_Selected_Component |
+ N_Slice =>
+ return Last_Char (Prefix (N), Count);
+
+ when N_Function_Call =>
+ return Last_Char (Sinfo.Name (N), Count);
+
+ when N_Qualified_Expression |
+ N_Type_Conversion =>
+ return Last_Char (Subtype_Mark (N), Count);
+
+ when N_Range =>
+ return Last_Char (Low_Bound (N), Count);
+
+ -- Nodes that should not appear in original expression trees
+
+ when N_Procedure_Call_Statement |
+ N_Raise_xxx_Error |
+ N_Subprogram_Info |
+ N_Unchecked_Expression |
+ N_Unchecked_Type_Conversion |
+ N_Conditional_Expression =>
+ raise Program_Error;
+
+ -- Cases where the Sloc points to the start of the token, but we
+ -- still need to handle the sequence of left parentheses.
+
+ when N_Identifier |
+ N_Operator_Symbol |
+ N_Character_Literal |
+ N_Integer_Literal |
+ N_Null |
+ N_Unary_Op |
+ N_Aggregate |
+ N_Allocator |
+ N_Extension_Aggregate |
+ N_Real_Literal |
+ N_String_Literal =>
+
+ Loc := Sloc (N);
+
+ -- Now we have two tasks, first we are pointing to the start
+ -- of the token below, second, we need to skip parentheses.
+
+ -- Skipping to the end of a token is not easy, we can't just
+ -- skip to a space, since we may have e.g. X*YAR+Z, and if we
+ -- are finding the end of the subexpression X*YAR, we don't
+ -- want to skip past the +Z. Also we have to worry about
+ -- skipping comments, and about wide characters ???
+
+ declare
+ SFI : constant Source_File_Index :=
+ Get_Source_File_Index (Loc);
+ Src : constant Source_Buffer_Ptr := Source_Text (SFI);
+ Lst : constant Source_Ptr := Source_Last (SFI);
+
+ begin
+ -- Scan through first blank character, to get to the end
+ -- of this token. As noted above that's not really right???
+
+ loop
+ exit when Loc = Lst or else Src (Loc + 1) <= ' ';
+ Loc := Loc + 1;
+ end loop;
+
+ -- Skip past parens, but this also ignores comments ???
+
+ if Count > 0 then
+ for J in 1 .. Count loop
+ loop
+ exit when Loc = Lst;
+ Loc := Loc + 1;
+ exit when Src (Loc) >= ' ';
+ end loop;
+
+ exit when Src (Loc) /= ')';
+ end loop;
+ end if;
+ end;
+
+ return Loc;
+ end case;
+ end Last_Char;
+
+ -- Start of processing for Expr_Last_Char
+
+ begin
+ pragma Assert (Nkind (Expr) in N_Subexpr);
+ return Last_Char (Expr, 0);
+ end Expr_Last_Char;
+
-----------------------
-- Get_Column_Number --
-----------------------
diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads
index e2e4ec0d67f..c679e24d84b 100644
--- a/gcc/ada/sinput.ads
+++ b/gcc/ada/sinput.ads
@@ -423,8 +423,10 @@ package Sinput is
-- Global Data --
-----------------
- Current_Source_File : Source_File_Index;
- -- Source_File table index of source file currently being scanned
+ Current_Source_File : Source_File_Index := No_Source_File;
+ -- Source_File table index of source file currently being scanned.
+ -- Initialized so that some tools (such as gprbuild) can be built with
+ -- -gnatVa and pragma Initialized_Scalars without problems.
Current_Source_Unit : Unit_Number_Type;
-- Unit number of source file currently being scanned. The special value
@@ -469,6 +471,14 @@ package Sinput is
-- ASCII.NUL, with Name_Length indicating the length not including the
-- terminating Nul.
+ function Expr_First_Char (Expr : Node_Id) return Source_Ptr;
+ -- Given a node for a subexpression, returns the source location of the
+ -- first character of the expression.
+
+ function Expr_Last_Char (Expr : Node_Id) return Source_Ptr;
+ -- Given a node for a subexpression, returns the source location of the
+ -- last character of the expression.
+
function Get_Column_Number (P : Source_Ptr) return Column_Number;
-- The ones-origin column number of the specified Source_Ptr value is
-- determined and returned. Tab characters if present are assumed to
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 60a91a39b43..263269ca0a5 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -688,6 +688,7 @@ package Snames is
Name_Callable : constant Name_Id := N + $;
Name_Caller : constant Name_Id := N + $;
Name_Code_Address : constant Name_Id := N + $; -- GNAT
+ Name_Compiler_Version : constant Name_Id := N + $; -- GNAT
Name_Component_Size : constant Name_Id := N + $;
Name_Compose : constant Name_Id := N + $;
Name_Constrained : constant Name_Id := N + $;
@@ -1188,6 +1189,7 @@ package Snames is
Attribute_Callable,
Attribute_Caller,
Attribute_Code_Address,
+ Attribute_Compiler_Version,
Attribute_Component_Size,
Attribute_Compose,
Attribute_Constrained,
diff --git a/gcc/ada/styleg.adb b/gcc/ada/styleg.adb
index d3ce9e101d3..c92231d60b3 100644
--- a/gcc/ada/styleg.adb
+++ b/gcc/ada/styleg.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -145,7 +145,8 @@ package body Styleg is
begin
if Style_Check_Attribute_Casing then
if Determine_Token_Casing /= Mixed_Case then
- Error_Msg_SC ("(style) bad capitalization, mixed case required");
+ Error_Msg_SC -- CODEFIX
+ ("(style) bad capitalization, mixed case required");
end if;
end if;
end Check_Attribute_Name;
@@ -379,7 +380,8 @@ package body Styleg is
if Style_Check_Indentation /= 0 then
if Start_Column rem Style_Check_Indentation /= 0 then
if not Same_Column_As_Next_Non_Blank_Line then
- Error_Msg_S ("(style) bad column");
+ Error_Msg_S -- CODEFIX
+ ("(style) bad column");
end if;
return;
@@ -656,7 +658,7 @@ package body Styleg is
else
if Style_Check_Blank_Lines and then Blank_Lines > 1 then
- Error_Msg
+ Error_Msg -- CODEFIX
("(style) multiple blank lines", Blank_Line_Location);
end if;
@@ -720,7 +722,8 @@ package body Styleg is
begin
if Style_Check_Pragma_Casing then
if Determine_Token_Casing /= Mixed_Case then
- Error_Msg_SC ("(style) bad capitalization, mixed case required");
+ Error_Msg_SC -- CODEFIX
+ ("(style) bad capitalization, mixed case required");
end if;
end if;
end Check_Pragma_Name;
@@ -978,7 +981,8 @@ package body Styleg is
procedure Non_Lower_Case_Keyword is
begin
if Style_Check_Keyword_Casing then
- Error_Msg_SC ("(style) reserved words must be all lower case");
+ Error_Msg_SC -- CODEIX
+ ("(style) reserved words must be all lower case");
end if;
end Non_Lower_Case_Keyword;
diff --git a/gcc/ada/switch-m.adb b/gcc/ada/switch-m.adb
index 7be075d9896..d7ed40da0d2 100644
--- a/gcc/ada/switch-m.adb
+++ b/gcc/ada/switch-m.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -24,6 +24,7 @@
------------------------------------------------------------------------------
with Debug; use Debug;
+with Makeutl; use Makeutl;
with Osint; use Osint;
with Opt; use Opt;
with Prj; use Prj;
diff --git a/gcc/ada/system-linux-mips64el.ads b/gcc/ada/system-linux-mips64el.ads
new file mode 100644
index 00000000000..0c848717365
--- /dev/null
+++ b/gcc/ada/system-linux-mips64el.ads
@@ -0,0 +1,152 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT RUN-TIME COMPONENTS --
+-- --
+-- S Y S T E M --
+-- --
+-- S p e c --
+-- (GNU-Linux/MIPS64EL Version) --
+-- --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- --
+-- This specification is derived from the Ada Reference Manual for use with --
+-- GNAT. The copyright notice above, and the license provisions that follow --
+-- apply solely to the contents of the part following the private keyword. --
+-- --
+-- GNAT is free software; you can redistribute it and/or modify it under --
+-- terms of the GNU General Public License as published by the Free Soft- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. --
+-- --
+-- As a special exception under Section 7 of GPL version 3, you are granted --
+-- additional permissions described in the GCC Runtime Library Exception, --
+-- version 3.1, as published by the Free Software Foundation. --
+-- --
+-- You should have received a copy of the GNU General Public License and --
+-- a copy of the GCC Runtime Library Exception along with this program; --
+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
+-- <http://www.gnu.org/licenses/>. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc. --
+-- --
+------------------------------------------------------------------------------
+
+package System is
+ pragma Pure;
+ -- Note that we take advantage of the implementation permission to make
+ -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada
+ -- 2005, this is Pure in any case (AI-362).
+
+ type Name is (SYSTEM_NAME_GNAT);
+ System_Name : constant Name := SYSTEM_NAME_GNAT;
+
+ -- System-Dependent Named Numbers
+
+ Min_Int : constant := Long_Long_Integer'First;
+ Max_Int : constant := Long_Long_Integer'Last;
+
+ Max_Binary_Modulus : constant := 2 ** Long_Long_Integer'Size;
+ Max_Nonbinary_Modulus : constant := Integer'Last;
+
+ Max_Base_Digits : constant := Long_Long_Float'Digits;
+ Max_Digits : constant := Long_Long_Float'Digits;
+
+ Max_Mantissa : constant := 63;
+ Fine_Delta : constant := 2.0 ** (-Max_Mantissa);
+
+ Tick : constant := 0.000_001;
+
+ -- Storage-related Declarations
+
+ type Address is private;
+ Null_Address : constant Address;
+
+ Storage_Unit : constant := 8;
+ Word_Size : constant := 64;
+ Memory_Size : constant := 2 ** 64;
+
+ -- Address comparison
+
+ function "<" (Left, Right : Address) return Boolean;
+ function "<=" (Left, Right : Address) return Boolean;
+ function ">" (Left, Right : Address) return Boolean;
+ function ">=" (Left, Right : Address) return Boolean;
+ function "=" (Left, Right : Address) return Boolean;
+
+ pragma Import (Intrinsic, "<");
+ pragma Import (Intrinsic, "<=");
+ pragma Import (Intrinsic, ">");
+ pragma Import (Intrinsic, ">=");
+ pragma Import (Intrinsic, "=");
+
+ -- Other System-Dependent Declarations
+
+ type Bit_Order is (High_Order_First, Low_Order_First);
+ Default_Bit_Order : constant Bit_Order := Low_Order_First;
+ pragma Warnings (Off, Default_Bit_Order); -- kill constant condition warning
+
+ -- Priority-related Declarations (RM D.1)
+
+ Max_Priority : constant Positive := 30;
+ Max_Interrupt_Priority : constant Positive := 31;
+
+ subtype Any_Priority is Integer range 0 .. 31;
+ subtype Priority is Any_Priority range 0 .. 30;
+ subtype Interrupt_Priority is Any_Priority range 31 .. 31;
+
+ Default_Priority : constant Priority := 15;
+
+private
+
+ type Address is mod Memory_Size;
+ Null_Address : constant Address := 0;
+
+ --------------------------------------
+ -- System Implementation Parameters --
+ --------------------------------------
+
+ -- These parameters provide information about the target that is used
+ -- by the compiler. They are in the private part of System, where they
+ -- can be accessed using the special circuitry in the Targparm unit
+ -- whose source should be consulted for more detailed descriptions
+ -- of the individual switch values.
+
+ AAMP : constant Boolean := False;
+ Backend_Divide_Checks : constant Boolean := False;
+ Backend_Overflow_Checks : constant Boolean := False;
+ Command_Line_Args : constant Boolean := True;
+ Compiler_System_Version : constant Boolean := False;
+ Configurable_Run_Time : constant Boolean := False;
+ Denorm : constant Boolean := True;
+ Duration_32_Bits : constant Boolean := False;
+ Exit_Status_Supported : constant Boolean := True;
+ Fractional_Fixed_Ops : constant Boolean := False;
+ Frontend_Layout : constant Boolean := False;
+ Functions_Return_By_DSP : constant Boolean := False;
+ Machine_Overflows : constant Boolean := False;
+ Machine_Rounds : constant Boolean := True;
+ OpenVMS : constant Boolean := False;
+ Preallocated_Stacks : constant Boolean := False;
+ Signed_Zeros : constant Boolean := True;
+ Stack_Check_Default : constant Boolean := False;
+ Stack_Check_Probes : constant Boolean := False;
+ Support_64_Bit_Divides : constant Boolean := True;
+ Support_Aggregates : constant Boolean := True;
+ Support_Composite_Assign : constant Boolean := True;
+ Support_Composite_Compare : constant Boolean := True;
+ Support_Long_Shifts : constant Boolean := True;
+ Suppress_Standard_Library : constant Boolean := False;
+ Use_Ada_Main_Program_Name : constant Boolean := False;
+ ZCX_By_Default : constant Boolean := True;
+ GCC_ZCX_Support : constant Boolean := True;
+ Front_End_ZCX_Support : constant Boolean := False;
+
+ -- Obsolete entries, to be removed eventually (bootstrap issues!)
+
+ High_Integrity_Mode : constant Boolean := False;
+ Long_Shifts_Inlined : constant Boolean := True;
+
+end System;
diff --git a/gcc/ada/table.adb b/gcc/ada/table.adb
index 0953fe07062..3bf4eb69c87 100644
--- a/gcc/ada/table.adb
+++ b/gcc/ada/table.adb
@@ -83,6 +83,17 @@ package body Table is
Set_Item (Table_Index_Type (Last_Val + 1), New_Val);
end Append;
+ ----------------
+ -- Append_All --
+ ----------------
+
+ procedure Append_All (New_Vals : Table_Type) is
+ begin
+ for J in New_Vals'Range loop
+ Append (New_Vals (J));
+ end loop;
+ end Append_All;
+
--------------------
-- Decrement_Last --
--------------------
diff --git a/gcc/ada/table.ads b/gcc/ada/table.ads
index 79bf6705e33..2b398d762cd 100644
--- a/gcc/ada/table.ads
+++ b/gcc/ada/table.ads
@@ -187,6 +187,9 @@ package Table is
-- i.e. the table size is increased by one, and the given new item
-- stored in the newly created table element.
+ procedure Append_All (New_Vals : Table_Type);
+ -- Appends all components of New_Vals
+
procedure Set_Item
(Index : Table_Index_Type;
Item : Table_Component_Type);
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index da42ba8b7b5..d78201d3016 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -560,6 +560,7 @@ package body Targparm is
when CLI =>
if Result then
VM_Target := CLI_Target;
+ Tagged_Type_Expansion := False;
end if;
when CRT => Configurable_Run_Time_On_Target := Result;
@@ -571,6 +572,7 @@ package body Targparm is
when JVM =>
if Result then
VM_Target := JVM_Target;
+ Tagged_Type_Expansion := False;
end if;
when MOV => Machine_Overflows_On_Target := Result;
diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads
index ff4cd15f7bc..fd74ea5cbc9 100644
--- a/gcc/ada/targparm.ads
+++ b/gcc/ada/targparm.ads
@@ -220,7 +220,9 @@ package Targparm is
type Virtual_Machine_Kind is (No_VM, JVM_Target, CLI_Target);
VM_Target : Virtual_Machine_Kind := No_VM;
-- Kind of virtual machine targetted
- -- Needs comments, don't depend on names ???
+ -- No_VM: no virtual machine, default case of a standard processor
+ -- JVM_Target: Java Virtual Machine
+ -- CLI_Target: CLI/.NET Virtual Machine
-------------------------------
-- Backend Arithmetic Checks --
@@ -446,7 +448,7 @@ package Targparm is
-- Control of Stack Checking --
-------------------------------
- -- GNAT provides two methods of implementing exceptions:
+ -- GNAT provides three methods of implementing exceptions:
-- GCC Probing Mechanism
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index d61a82e5a33..f4841df6df7 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -5116,7 +5116,11 @@ package VMS_Data is
"AVERAGE_COMPLEXITY_ON " &
"--complexity-average " &
"AVERAGE_COMPLEXITY_OFF " &
- "--no-complexity-average";
+ "--no-complexity-average " &
+ "EXTRA_EXIT_POINTS_ON " &
+ "--extra-exit-points " &
+ "EXTRA_EXIT_POINTS_OFF " &
+ "--no-extra-exit-points";
-- /COMPLEXITY_METRICS=(option, option ...)
-- Specifies the complexity metrics to be computed (if at least one
@@ -5139,6 +5143,8 @@ package VMS_Data is
-- executable bodies
-- AVERAGE_COMPLEXITY_OFF Do not compute the average complexity for
-- executable bodies
+ -- EXTRA_EXIT_POINTS_ON Compute extra exit points metric
+ -- EXTRA_EXIT_POINTS_OFF Do not compute extra exit points metric
--
-- All combinations of line metrics options are allowed.
diff --git a/gcc/ada/xoscons.adb b/gcc/ada/xoscons.adb
index 64a9e799a3f..83b726b6b9b 100644
--- a/gcc/ada/xoscons.adb
+++ b/gcc/ada/xoscons.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2008, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -59,13 +59,13 @@ procedure XOSCons is
-- Information retrieved from assembly listing --
-------------------------------------------------
- -- We need to deal with integer values that can be signed or unsigned,
- -- so we need to cater for the maximum range of both cases.
-
type String_Access is access all String;
-- Note: we can't use GNAT.Strings for this definition, since that unit
-- is not available in older base compilers.
+ -- We need to deal with integer values that can be signed or unsigned, so
+ -- we need to accomodate the maximum range of both cases.
+
type Int_Value_Type is record
Positive : Boolean;
Abs_Value : Long_Unsigned := 0;
@@ -75,8 +75,8 @@ procedure XOSCons is
(CND, -- Constant (decimal)
CNS, -- Constant (freeform string)
TXT); -- Literal text
- -- Recognized markers found in assembly file. These markers are produced
- -- by the same-named macros from the C template.
+ -- Recognized markers found in assembly file. These markers are produced by
+ -- the same-named macros from the C template.
type Asm_Info (Kind : Asm_Info_Kind := TXT) is record
Line_Number : Integer;
@@ -98,16 +98,16 @@ procedure XOSCons is
-- Additional descriptive comment for constant, or free-form text (TXT)
end record;
- package Asm_Infos is new GNAT.Table (
- Table_Component_Type => Asm_Info,
+ package Asm_Infos is new GNAT.Table
+ (Table_Component_Type => Asm_Info,
Table_Index_Type => Integer,
Table_Low_Bound => 1,
Table_Initial => 100,
Table_Increment => 10);
- Max_Const_Name_Len : Natural := 0;
+ Max_Const_Name_Len : Natural := 0;
Max_Constant_Value_Len : Natural := 0;
- -- Longest name and longest value lengths
+ -- Lengths of longest name and longest value
type Language is (Lang_Ada, Lang_C);
@@ -152,6 +152,7 @@ procedure XOSCons is
Info : Asm_Info renames Asm_Infos.Table (Info_Index);
procedure Put (S : String);
+ -- Write S to OFile
---------
-- Put --
@@ -253,9 +254,7 @@ procedure XOSCons is
-- On some platforms, immediate integer values are prefixed with
-- a $ or # character in assembly output.
- if S (First) = '$'
- or else S (First) = '#'
- then
+ if S (First) = '$' or else S (First) = '#' then
First := First + 1;
end if;
@@ -306,6 +305,7 @@ procedure XOSCons is
if Info.Kind = CND then
Info.Int_Value := Parse_Int (Line (Index1 .. Index2 - 1));
Info.Value_Len := Index2 - Index1 - 1;
+
else
Info.Text_Value := Field_Alloc;
Info.Value_Len := Info.Text_Value'Length;
@@ -322,8 +322,8 @@ procedure XOSCons is
if Info.Kind = TXT then
Info.Text_Value := Info.Comment;
- -- Update Max_Constant_Value_Len, but only if this constant has
- -- a comment (else the value is allowed to be longer).
+ -- Update Max_Constant_Value_Len, but only if this constant has a
+ -- comment (else the value is allowed to be longer).
elsif Info.Comment'Length > 0 then
if Info.Value_Len > Max_Constant_Value_Len then
@@ -398,7 +398,7 @@ begin
-- Load C template and output definitions
- Open (Tmpl_File, In_File, Tmpl_File_Name);
+ Open (Tmpl_File, In_File, Tmpl_File_Name);
Create (Ada_OFile, Out_File, Ada_File_Name);
Create (C_OFile, Out_File, C_File_Name);
@@ -446,6 +446,7 @@ begin
Output_Info (Lang_C, C_OFile, Current_Info);
Current_Info := Current_Info + 1;
end if;
+
Current_Line := Current_Line + 1;
end if;
end loop;
diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
index 1734ba4d8bf..c9d990464ad 100644
--- a/gcc/alloc-pool.c
+++ b/gcc/alloc-pool.c
@@ -116,7 +116,7 @@ alloc_pool_descriptor (const char *name)
slot = (struct alloc_pool_descriptor **)
htab_find_slot_with_hash (alloc_pool_hash, name,
htab_hash_pointer (name),
- 1);
+ INSERT);
if (*slot)
return *slot;
*slot = XCNEW (struct alloc_pool_descriptor);
diff --git a/gcc/attribs.c b/gcc/attribs.c
index be360d36bf2..df4ca73124d 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -33,7 +33,6 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "langhooks.h"
#include "hashtab.h"
-#include "c-common.h"
static void init_attributes (void);
@@ -281,16 +280,16 @@ decl_attributes (tree *node, tree attributes, int flags)
if (spec == NULL)
{
- warning (OPT_Wattributes, "%qs attribute directive ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute directive ignored",
+ name);
continue;
}
else if (list_length (args) < spec->min_length
|| (spec->max_length >= 0
&& list_length (args) > spec->max_length))
{
- error ("wrong number of arguments specified for %qs attribute",
- IDENTIFIER_POINTER (name));
+ error ("wrong number of arguments specified for %qE attribute",
+ name);
continue;
}
gcc_assert (is_attribute_p (spec->name, name));
@@ -307,8 +306,8 @@ decl_attributes (tree *node, tree attributes, int flags)
}
else
{
- warning (OPT_Wattributes, "%qs attribute does not apply to types",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute does not apply to types",
+ name);
continue;
}
}
@@ -358,8 +357,8 @@ decl_attributes (tree *node, tree attributes, int flags)
&& TREE_CODE (*anode) != METHOD_TYPE)
{
warning (OPT_Wattributes,
- "%qs attribute only applies to function types",
- IDENTIFIER_POINTER (name));
+ "%qE attribute only applies to function types",
+ name);
continue;
}
}
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 6230adbc029..c9a226a5a2c 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -87,7 +87,7 @@ bitmap_descriptor (const char *file, const char *function, int line)
slot = (struct bitmap_descriptor **)
htab_find_slot_with_hash (bitmap_desc_hash, &loc,
htab_hash_pointer (file) + line,
- 1);
+ INSERT);
if (*slot)
return *slot;
*slot = XCNEW (struct bitmap_descriptor);
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8621e0db511..e12418983bf 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -479,13 +479,16 @@ c_strlen (tree src, int only_value)
else
offset = tree_low_cst (offset_node, 0);
- /* If the offset is known to be out of bounds, the front-end should
- have warned already. We call strlen at runtime.
-
- ??? Perhaps we should turn this into an assert and force
- front-ends to define offsets whtin boundaries. */
+ /* If the offset is known to be out of bounds, warn, and call strlen at
+ runtime. */
if (offset < 0 || offset > max)
{
+ /* Suppress multiple warnings for propagated constant strings. */
+ if (! TREE_NO_WARNING (src))
+ {
+ warning (0, "offset outside bounds of constant string");
+ TREE_NO_WARNING (src) = 1;
+ }
return NULL_TREE;
}
@@ -5030,7 +5033,7 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
if (TREE_CODE (TREE_TYPE (valist)) == ARRAY_TYPE)
{
tree p1 = build_pointer_type (TREE_TYPE (have_va_type));
- valist = build_fold_addr_expr_with_type (valist, p1);
+ valist = fold_convert (p1, build_fold_addr_expr (valist));
}
gimplify_expr (&valist, pre_p, post_p, is_gimple_val, fb_rvalue);
@@ -8734,7 +8737,7 @@ var_decl_component_p (tree var)
static tree
fold_builtin_memset (tree dest, tree c, tree len, tree type, bool ignore)
{
- tree var, ret;
+ tree var, ret, etype;
unsigned HOST_WIDE_INT length, cval;
if (! validate_arg (dest, POINTER_TYPE)
@@ -8761,15 +8764,19 @@ fold_builtin_memset (tree dest, tree c, tree len, tree type, bool ignore)
if (TREE_THIS_VOLATILE (var))
return NULL_TREE;
- if (!INTEGRAL_TYPE_P (TREE_TYPE (var))
- && !POINTER_TYPE_P (TREE_TYPE (var)))
+ etype = TREE_TYPE (var);
+ if (TREE_CODE (etype) == ARRAY_TYPE)
+ etype = TREE_TYPE (etype);
+
+ if (!INTEGRAL_TYPE_P (etype)
+ && !POINTER_TYPE_P (etype))
return NULL_TREE;
if (! var_decl_component_p (var))
return NULL_TREE;
length = tree_low_cst (len, 1);
- if (GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (var))) != length
+ if (GET_MODE_SIZE (TYPE_MODE (etype)) != length
|| get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT
< (int) length)
return NULL_TREE;
@@ -8791,8 +8798,10 @@ fold_builtin_memset (tree dest, tree c, tree len, tree type, bool ignore)
cval |= (cval << 31) << 1;
}
- ret = build_int_cst_type (TREE_TYPE (var), cval);
- ret = build2 (MODIFY_EXPR, TREE_TYPE (var), var, ret);
+ ret = build_int_cst_type (etype, cval);
+ var = build_fold_indirect_ref (fold_convert (build_pointer_type (etype),
+ dest));
+ ret = build2 (MODIFY_EXPR, etype, var, ret);
if (ignore)
return ret;
@@ -8944,8 +8953,39 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
Perhaps we ought to inherit type from non-VOID argument here? */
STRIP_NOPS (src);
STRIP_NOPS (dest);
+ /* As we fold (void *)(p + CST) to (void *)p + CST undo this here. */
+ if (TREE_CODE (src) == POINTER_PLUS_EXPR)
+ {
+ tree tem = TREE_OPERAND (src, 0);
+ STRIP_NOPS (tem);
+ if (tem != TREE_OPERAND (src, 0))
+ src = build1 (NOP_EXPR, TREE_TYPE (tem), src);
+ }
+ if (TREE_CODE (dest) == POINTER_PLUS_EXPR)
+ {
+ tree tem = TREE_OPERAND (dest, 0);
+ STRIP_NOPS (tem);
+ if (tem != TREE_OPERAND (dest, 0))
+ dest = build1 (NOP_EXPR, TREE_TYPE (tem), dest);
+ }
srctype = TREE_TYPE (TREE_TYPE (src));
+ if (srctype
+ && TREE_CODE (srctype) == ARRAY_TYPE
+ && !tree_int_cst_equal (TYPE_SIZE_UNIT (srctype), len))
+ {
+ srctype = TREE_TYPE (srctype);
+ STRIP_NOPS (src);
+ src = build1 (NOP_EXPR, build_pointer_type (srctype), src);
+ }
desttype = TREE_TYPE (TREE_TYPE (dest));
+ if (desttype
+ && TREE_CODE (desttype) == ARRAY_TYPE
+ && !tree_int_cst_equal (TYPE_SIZE_UNIT (desttype), len))
+ {
+ desttype = TREE_TYPE (desttype);
+ STRIP_NOPS (dest);
+ dest = build1 (NOP_EXPR, build_pointer_type (desttype), dest);
+ }
if (!srctype || !desttype
|| !TYPE_SIZE_UNIT (srctype)
|| !TYPE_SIZE_UNIT (desttype)
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 67fe8ad8ebd..df6673c000c 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -730,6 +730,7 @@ const struct c_common_resword c_common_reswords[] =
{
{ "_Bool", RID_BOOL, D_CONLY },
{ "_Complex", RID_COMPLEX, 0 },
+ { "_Imaginary", RID_IMAGINARY, D_CONLY },
{ "_Decimal32", RID_DFLOAT32, D_CONLY | D_EXT },
{ "_Decimal64", RID_DFLOAT64, D_CONLY | D_EXT },
{ "_Decimal128", RID_DFLOAT128, D_CONLY | D_EXT },
@@ -953,7 +954,7 @@ const struct attribute_spec c_common_attribute_table[] =
to prevent its usage in source code. */
{ "no vops", 0, 0, true, false, false,
handle_novops_attribute },
- { "deprecated", 0, 0, false, false, false,
+ { "deprecated", 0, 1, false, false, false,
handle_deprecated_attribute },
{ "vector_size", 1, 1, false, true, false,
handle_vector_size_attribute },
@@ -1761,6 +1762,10 @@ warn_logical_operator (location_t location, enum tree_code code,
bool
strict_aliasing_warning (tree otype, tree type, tree expr)
{
+ /* Strip pointer conversion chains and get to the correct original type. */
+ STRIP_NOPS (expr);
+ otype = TREE_TYPE (expr);
+
if (!(flag_strict_aliasing
&& POINTER_TYPE_P (type)
&& POINTER_TYPE_P (otype)
@@ -3767,8 +3772,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr,
of pointer PTROP and integer INTOP. */
tree
-pointer_int_sum (location_t location, enum tree_code resultcode,
- tree ptrop, tree intop)
+pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
{
tree size_exp, ret;
@@ -3777,19 +3781,19 @@ pointer_int_sum (location_t location, enum tree_code resultcode,
if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE)
{
- pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer of type %<void *%> used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE)
{
- pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to a function used in arithmetic");
size_exp = integer_one_node;
}
else if (TREE_CODE (TREE_TYPE (result_type)) == METHOD_TYPE)
{
- pedwarn (location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
+ pedwarn (input_location, pedantic ? OPT_pedantic : OPT_Wpointer_arith,
"pointer to member function used in arithmetic");
size_exp = integer_one_node;
}
@@ -3852,31 +3856,6 @@ pointer_int_sum (location_t location, enum tree_code resultcode,
if (resultcode == MINUS_EXPR)
intop = fold_build1 (NEGATE_EXPR, sizetype, intop);
- if (TREE_CODE (intop) == INTEGER_CST)
- {
- tree offset_node;
- tree string_cst = string_constant (ptrop, &offset_node);
-
- if (string_cst != 0
- && !(offset_node && TREE_CODE (offset_node) != INTEGER_CST))
- {
- HOST_WIDE_INT max = TREE_STRING_LENGTH (string_cst);
- HOST_WIDE_INT offset;
- if (offset_node == 0)
- offset = 0;
- else if (! host_integerp (offset_node, 0))
- offset = -1;
- else
- offset = tree_low_cst (offset_node, 0);
-
- offset = offset + tree_low_cst (intop, 0);
- if (offset < 0 || offset > max)
- warning_at (location, 0,
- "offset %<%wd%> outside bounds of constant string",
- tree_low_cst (intop, 0));
- }
- }
-
ret = fold_build2 (POINTER_PLUS_EXPR, result_type, ptrop, intop);
fold_undefer_and_ignore_overflow_warnings ();
@@ -6400,15 +6379,16 @@ handle_mode_attribute (tree *node, tree name, tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
tree type = *node;
+ tree ident = TREE_VALUE (args);
*no_add_attrs = true;
- if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
+ if (TREE_CODE (ident) != IDENTIFIER_NODE)
warning (OPT_Wattributes, "%qE attribute ignored", name);
else
{
int j;
- const char *p = IDENTIFIER_POINTER (TREE_VALUE (args));
+ const char *p = IDENTIFIER_POINTER (ident);
int len = strlen (p);
enum machine_mode mode = VOIDmode;
tree typefm;
@@ -6448,7 +6428,7 @@ handle_mode_attribute (tree *node, tree name, tree args,
if (mode == VOIDmode)
{
- error ("unknown machine mode %qs", p);
+ error ("unknown machine mode %qE", ident);
return NULL_TREE;
}
@@ -7199,13 +7179,21 @@ handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
static tree
handle_deprecated_attribute (tree *node, tree name,
- tree ARG_UNUSED (args), int flags,
+ tree args, int flags,
bool *no_add_attrs)
{
tree type = NULL_TREE;
int warn = 0;
tree what = NULL_TREE;
+ if (!args)
+ *no_add_attrs = true;
+ else if (TREE_CODE (TREE_VALUE (args)) != STRING_CST)
+ {
+ error ("deprecated message is not a string");
+ *no_add_attrs = true;
+ }
+
if (DECL_P (*node))
{
tree decl = *node;
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 1e313cf9e8e..250a7ff74fa 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -63,6 +63,10 @@ enum rid
/* ObjC */
RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF, RID_ONEWAY,
+ /* C (reserved and imaginary types not implemented, so any use is a
+ syntax error) */
+ RID_IMAGINARY,
+
/* C */
RID_INT, RID_CHAR, RID_FLOAT, RID_DOUBLE, RID_VOID,
RID_ENUM, RID_STRUCT, RID_UNION, RID_IF, RID_ELSE,
@@ -805,6 +809,11 @@ extern void warn_logical_operator (location_t, enum tree_code,
extern void check_main_parameter_types (tree decl);
extern bool c_determine_visibility (tree);
extern bool same_scalar_type_ignoring_signedness (tree, tree);
+extern void mark_valid_location_for_stdc_pragma (bool);
+extern bool valid_location_for_stdc_pragma_p (void);
+extern void set_float_const_decimal64 (void);
+extern void clear_float_const_decimal64 (void);
+extern bool float_const_decimal64_p (void);
#define c_sizeof(T) c_sizeof_or_alignof_type (T, true, 1)
#define c_alignof(T) c_sizeof_or_alignof_type (T, false, 1)
@@ -817,7 +826,7 @@ extern tree shorten_binary_op (tree result_type, tree op0, tree op1, bool bitwis
and, if so, perhaps change them both back to their original type. */
extern tree shorten_compare (tree *, tree *, tree *, enum tree_code *);
-extern tree pointer_int_sum (location_t, enum tree_code, tree, tree);
+extern tree pointer_int_sum (enum tree_code, tree, tree);
/* Add qualifiers to a type, in the fashion for C. */
extern tree c_build_qualified_type (tree, int);
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index 8b776b15dbc..921addbccf0 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -619,14 +619,11 @@ c_cpp_builtins (cpp_reader *pfile)
TARGET_DEC_EVAL_METHOD);
builtin_define_float_constants ("FLT", "F", "%s", float_type_node);
- /* Cast the double precision constants when single precision constants are
- specified. The correct result is computed by the compiler when using
- macros that include a cast. This has the side-effect of making the value
- unusable in const expressions. */
- if (flag_single_precision_constant)
- builtin_define_float_constants ("DBL", "L", "((double)%s)", double_type_node);
- else
- builtin_define_float_constants ("DBL", "", "%s", double_type_node);
+ /* Cast the double precision constants. This is needed when single
+ precision constants are specified or when pragma FLOAT_CONST_DECIMAL64
+ is used. The correct result is computed by the compiler when using
+ macros that include a cast. */
+ builtin_define_float_constants ("DBL", "L", "((double)%s)", double_type_node);
builtin_define_float_constants ("LDBL", "L", "%s", long_double_type_node);
/* For decfloat.h. */
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 8d3384b0745..df6806435f6 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -343,6 +343,9 @@ struct GTY((chain_next ("%h.outer"))) c_scope {
/* True means make a BLOCK for this scope no matter what. */
BOOL_BITFIELD keep : 1;
+
+ /* True means that an unsuffixed float constant is _Decimal64. */
+ BOOL_BITFIELD float_const_decimal64 : 1;
};
/* The scope currently in effect. */
@@ -441,19 +444,25 @@ static tree grokparms (struct c_arg_info *, bool);
static void layout_array_type (tree);
-/* LIPO */
+/* LIPO support */
static void pop_ext_scope (void);
+/* The list of block nodes. A member node is created
+ when an external scope is poped. */
static GTY (()) VEC(tree, gc) *ext_blocks = NULL;
-#define FOR_EACH_EXT_BLOCK_DO(func) \
- if (L_IPO_COMP_MODE) {\
- unsigned i, n; \
- n = VEC_length (tree, ext_blocks); \
- for (i = 0; i < n; i++) \
- { \
- tree eb = VEC_index (tree, ext_blocks, i); \
- func (BLOCK_VARS (eb)); \
- } \
+static inline void
+apply_for_each_ext_block (void (*func) (tree))
+{
+ if (L_IPO_COMP_MODE)
+ {
+ size_t i;
+ tree eb;
+
+ for (i = 0;
+ VEC_iterate (tree, ext_blocks, i, eb);
+ ++i)
+ func (BLOCK_VARS (eb));
}
+}
/* T is a statement. Add it to the statement-tree. This is the
@@ -693,6 +702,30 @@ keep_next_level (void)
keep_next_level_flag = true;
}
+/* Set the flag for the FLOAT_CONST_DECIMAL64 pragma being ON. */
+
+void
+set_float_const_decimal64 (void)
+{
+ current_scope->float_const_decimal64 = true;
+}
+
+/* Clear the flag for the FLOAT_CONST_DECIMAL64 pragma. */
+
+void
+clear_float_const_decimal64 (void)
+{
+ current_scope->float_const_decimal64 = false;
+}
+
+/* Return nonzero if an unsuffixed float constant is _Decimal64. */
+
+bool
+float_const_decimal64_p (void)
+{
+ return current_scope->float_const_decimal64;
+}
+
/* Identify this scope as currently being filled with parameters. */
void
@@ -724,6 +757,13 @@ push_scope (void)
keep_next_level_flag = false;
next_is_function_body = false;
+
+ /* The FLOAT_CONST_DECIMAL64 pragma applies to nested scopes. */
+ if (current_scope->outer)
+ current_scope->float_const_decimal64
+ = current_scope->outer->float_const_decimal64;
+ else
+ current_scope->float_const_decimal64 = false;
}
else
{
@@ -736,6 +776,12 @@ push_scope (void)
else
scope = GGC_CNEW (struct c_scope);
+ /* The FLOAT_CONST_DECIMAL64 pragma applies to nested scopes. */
+ if (current_scope)
+ scope->float_const_decimal64 = current_scope->float_const_decimal64;
+ else
+ scope->float_const_decimal64 = false;
+
scope->keep = keep_next_level_flag;
scope->outer = current_scope;
scope->depth = current_scope ? (current_scope->depth + 1) : 0;
@@ -2010,8 +2056,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
olddecl_arguments = DECL_ARGUMENTS (olddecl);
memcpy ((char *) olddecl + sizeof (struct tree_common),
- (char *) newdecl + sizeof (struct tree_common),
- sizeof (struct tree_decl_common) - sizeof (struct tree_common));
+ (char *) newdecl + sizeof (struct tree_common),
+ sizeof (struct tree_decl_common) - sizeof (struct tree_common));
switch (TREE_CODE (olddecl))
{
case FUNCTION_DECL:
@@ -2025,9 +2071,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
case RESULT_DECL:
case CONST_DECL:
case TYPE_DECL:
- memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
- (char *) newdecl + sizeof (struct tree_decl_common),
- tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common));
+ memcpy ((char *) olddecl + sizeof (struct tree_decl_common),
+ (char *) newdecl + sizeof (struct tree_decl_common),
+ tree_code_size (TREE_CODE (olddecl)) - sizeof (struct tree_decl_common));
break;
default:
@@ -3686,7 +3732,9 @@ finish_decl (tree decl, tree init, tree origtype, tree asmspec_tree)
But at end of compilation, do output code for them. */
DECL_DEFER_OUTPUT (decl) = 1;
- /* capture the module id info properly -- For LIPO. */
+ /* In LIPO mode, create cgraph_node or varpool_node early
+ enough so that module id of the current source file being
+ parsed is captured. */
if (L_IPO_COMP_MODE)
{
if (TREE_CODE (decl) == FUNCTION_DECL)
@@ -3958,12 +4006,14 @@ flexible_array_type_p (tree type)
/* Performs sanity checks on the TYPE and WIDTH of the bit-field NAME,
replacing with appropriate values if they are invalid. */
static void
-check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
+check_bitfield_type_and_width (tree *type, tree *width, tree orig_name)
{
tree type_mv;
unsigned int max_width;
unsigned HOST_WIDE_INT w;
- const char *name = orig_name ? orig_name: _("<anonymous>");
+ const char *name = (orig_name
+ ? identifier_to_locale (IDENTIFIER_POINTER (orig_name))
+ : _("<anonymous>"));
/* Detect and ignore out of range field width and process valid
field widths. */
@@ -4031,7 +4081,7 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name)
/* Print warning about variable length array if necessary. */
static void
-warn_variable_length_array (const char *name, tree size)
+warn_variable_length_array (tree name, tree size)
{
int const_size = TREE_CONSTANT (size);
@@ -4040,7 +4090,8 @@ warn_variable_length_array (const char *name, tree size)
if (const_size)
{
if (name)
- pedwarn (input_location, OPT_Wvla, "ISO C90 forbids array %qs whose size "
+ pedwarn (input_location, OPT_Wvla,
+ "ISO C90 forbids array %qE whose size "
"can%'t be evaluated",
name);
else
@@ -4050,7 +4101,8 @@ warn_variable_length_array (const char *name, tree size)
else
{
if (name)
- pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qs",
+ pedwarn (input_location, OPT_Wvla,
+ "ISO C90 forbids variable length array %qE",
name);
else
pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array");
@@ -4062,7 +4114,7 @@ warn_variable_length_array (const char *name, tree size)
{
if (name)
warning (OPT_Wvla,
- "the size of array %qs can"
+ "the size of array %qE can"
"%'t be evaluated", name);
else
warning (OPT_Wvla,
@@ -4072,7 +4124,7 @@ warn_variable_length_array (const char *name, tree size)
{
if (name)
warning (OPT_Wvla,
- "variable length array %qs is used",
+ "variable length array %qE is used",
name);
else
warning (OPT_Wvla,
@@ -4162,7 +4214,7 @@ grokdeclarator (const struct c_declarator *declarator,
int restrictp;
int volatilep;
int type_quals = TYPE_UNQUALIFIED;
- const char *name, *orig_name;
+ tree name = NULL_TREE;
bool funcdef_flag = false;
bool funcdef_syntax = false;
int size_varies = 0;
@@ -4190,10 +4242,9 @@ grokdeclarator (const struct c_declarator *declarator,
funcdef_flag = true, decl_context = NORMAL;
/* Look inside a declarator for the name being declared
- and get it as a string, for an error message. */
+ and get it as an IDENTIFIER_NODE, for an error message. */
{
const struct c_declarator *decl = declarator;
- name = 0;
while (decl)
switch (decl->kind)
@@ -4211,16 +4262,21 @@ grokdeclarator (const struct c_declarator *declarator,
case cdk_id:
if (decl->u.id)
- name = IDENTIFIER_POINTER (decl->u.id);
+ name = decl->u.id;
decl = 0;
break;
default:
gcc_unreachable ();
}
- orig_name = name;
if (name == 0)
- name = "type name";
+ {
+ gcc_assert (decl_context == PARM
+ || decl_context == TYPENAME
+ || (decl_context == FIELD
+ && declarator->kind == cdk_id));
+ gcc_assert (!initialized);
+ }
}
/* A function definition's declarator must have the form of
@@ -4236,13 +4292,16 @@ grokdeclarator (const struct c_declarator *declarator,
decl_context = PARM;
if (declspecs->deprecated_p && deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (declspecs->type);
+ warn_deprecated_use (declspecs->type, declspecs->decl_attr);
if ((decl_context == NORMAL || decl_context == FIELD)
&& current_scope == file_scope
&& variably_modified_type_p (type, NULL_TREE))
{
- error ("variably modified %qs at file scope", name);
+ if (name)
+ error ("variably modified %qE at file scope", name);
+ else
+ error ("variably modified field at file scope");
type = integer_type_node;
}
@@ -4258,9 +4317,16 @@ grokdeclarator (const struct c_declarator *declarator,
if ((warn_implicit_int || warn_return_type || flag_isoc99)
&& funcdef_flag)
warn_about_return_type = 1;
- else
- pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int,
- "type defaults to %<int%> in declaration of %qs", name);
+ else
+ {
+ if (name)
+ pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int,
+ "type defaults to %<int%> in declaration of %qE",
+ name);
+ else
+ pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int,
+ "type defaults to %<int%> in type name");
+ }
}
/* Adjust the type if a bit-field is being declared,
@@ -4334,11 +4400,17 @@ grokdeclarator (const struct c_declarator *declarator,
switch (decl_context)
{
case FIELD:
- error ("storage class specified for structure field %qs",
- name);
+ if (name)
+ error ("storage class specified for structure field %qE",
+ name);
+ else
+ error ("storage class specified for structure field");
break;
case PARM:
- error ("storage class specified for parameter %qs", name);
+ if (name)
+ error ("storage class specified for parameter %qE", name);
+ else
+ error ("storage class specified for unnamed parameter");
break;
default:
error ("storage class specified for typename");
@@ -4358,26 +4430,26 @@ grokdeclarator (const struct c_declarator *declarator,
/* It is fine to have 'extern const' when compiling at C
and C++ intersection. */
if (!(warn_cxx_compat && constp))
- warning (0, "%qs initialized and declared %<extern%>", name);
+ warning (0, "%qE initialized and declared %<extern%>", name);
}
else
- error ("%qs has both %<extern%> and initializer", name);
+ error ("%qE has both %<extern%> and initializer", name);
}
else if (current_scope == file_scope)
{
if (storage_class == csc_auto)
- error ("file-scope declaration of %qs specifies %<auto%>", name);
+ error ("file-scope declaration of %qE specifies %<auto%>", name);
if (pedantic && storage_class == csc_register)
pedwarn (input_location, OPT_pedantic,
- "file-scope declaration of %qs specifies %<register%>", name);
+ "file-scope declaration of %qE specifies %<register%>", name);
}
else
{
if (storage_class == csc_extern && funcdef_flag)
- error ("nested function %qs declared %<extern%>", name);
+ error ("nested function %qE declared %<extern%>", name);
else if (threadp && storage_class == csc_none)
{
- error ("function-scope %qs implicitly auto and declared "
+ error ("function-scope %qE implicitly auto and declared "
"%<__thread%>",
name);
threadp = false;
@@ -4471,13 +4543,19 @@ grokdeclarator (const struct c_declarator *declarator,
if (VOID_TYPE_P (type))
{
- error ("declaration of %qs as array of voids", name);
+ if (name)
+ error ("declaration of %qE as array of voids", name);
+ else
+ error ("declaration of type name as array of voids");
type = error_mark_node;
}
if (TREE_CODE (type) == FUNCTION_TYPE)
{
- error ("declaration of %qs as array of functions", name);
+ if (name)
+ error ("declaration of %qE as array of functions", name);
+ else
+ error ("declaration of type name as array of functions");
type = error_mark_node;
}
@@ -4508,22 +4586,34 @@ grokdeclarator (const struct c_declarator *declarator,
if (!INTEGRAL_TYPE_P (TREE_TYPE (size)))
{
- error ("size of array %qs has non-integer type", name);
+ if (name)
+ error ("size of array %qE has non-integer type", name);
+ else
+ error ("size of unnamed array has non-integer type");
size = integer_one_node;
}
size = c_fully_fold (size, false, &size_maybe_const);
if (pedantic && size_maybe_const && integer_zerop (size))
- pedwarn (input_location, OPT_pedantic,
- "ISO C forbids zero-size array %qs", name);
+ {
+ if (name)
+ pedwarn (input_location, OPT_pedantic,
+ "ISO C forbids zero-size array %qE", name);
+ else
+ pedwarn (input_location, OPT_pedantic,
+ "ISO C forbids zero-size array");
+ }
if (TREE_CODE (size) == INTEGER_CST && size_maybe_const)
{
constant_expression_warning (size);
if (tree_int_cst_sgn (size) < 0)
{
- error ("size of array %qs is negative", name);
+ if (name)
+ error ("size of array %qE is negative", name);
+ else
+ error ("size of unnamed array is negative");
size = integer_one_node;
}
/* Handle a size folded to an integer constant but
@@ -4538,16 +4628,17 @@ grokdeclarator (const struct c_declarator *declarator,
if ((decl_context == NORMAL || decl_context == FIELD)
&& current_scope == file_scope)
pedwarn (input_location, 0,
- "variably modified %qs at file scope", name);
+ "variably modified %qE at file scope",
+ name);
else
this_size_varies = size_varies = 1;
- warn_variable_length_array (orig_name, size);
+ warn_variable_length_array (name, size);
}
}
else if ((decl_context == NORMAL || decl_context == FIELD)
&& current_scope == file_scope)
{
- error ("variably modified %qs at file scope", name);
+ error ("variably modified %qE at file scope", name);
size = integer_one_node;
}
else
@@ -4556,7 +4647,7 @@ grokdeclarator (const struct c_declarator *declarator,
nonconstant even if it is (eg) a const variable
with known value. */
this_size_varies = size_varies = 1;
- warn_variable_length_array (orig_name, size);
+ warn_variable_length_array (name, size);
}
if (integer_zerop (size) && !this_size_varies)
@@ -4597,7 +4688,10 @@ grokdeclarator (const struct c_declarator *declarator,
if (TREE_CODE (itype) == INTEGER_CST
&& TREE_OVERFLOW (itype))
{
- error ("size of array %qs is too large", name);
+ if (name)
+ error ("size of array %qE is too large", name);
+ else
+ error ("size of unnamed array is too large");
type = error_mark_node;
continue;
}
@@ -4750,12 +4844,20 @@ grokdeclarator (const struct c_declarator *declarator,
/* Warn about some types functions can't return. */
if (TREE_CODE (type) == FUNCTION_TYPE)
{
- error ("%qs declared as function returning a function", name);
+ if (name)
+ error ("%qE declared as function returning a function",
+ name);
+ else
+ error ("type name declared as function "
+ "returning a function");
type = integer_type_node;
}
if (TREE_CODE (type) == ARRAY_TYPE)
{
- error ("%qs declared as function returning an array", name);
+ if (name)
+ error ("%qE declared as function returning an array", name);
+ else
+ error ("type name declared as function returning an array");
type = integer_type_node;
}
@@ -4870,7 +4972,7 @@ grokdeclarator (const struct c_declarator *declarator,
/* Check the type and width of a bit-field. */
if (bitfield)
- check_bitfield_type_and_width (&type, width, orig_name);
+ check_bitfield_type_and_width (&type, width, name);
/* Did array size calculations overflow? */
@@ -4879,7 +4981,10 @@ grokdeclarator (const struct c_declarator *declarator,
&& TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
&& TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
{
- error ("size of array %qs is too large", name);
+ if (name)
+ error ("size of array %qE is too large", name);
+ else
+ error ("size of unnamed array is too large");
/* If we proceed with the array type as it is, we'll eventually
crash in tree_low_cst(). */
type = error_mark_node;
@@ -4944,7 +5049,7 @@ grokdeclarator (const struct c_declarator *declarator,
&& !(storage_class == csc_static
|| storage_class == csc_register)))))
{
- error ("variable or field %qs declared void", name);
+ error ("variable or field %qE declared void", name);
type = integer_type_node;
}
@@ -5022,13 +5127,16 @@ grokdeclarator (const struct c_declarator *declarator,
if (TREE_CODE (type) == FUNCTION_TYPE)
{
- error ("field %qs declared as a function", name);
+ error ("field %qE declared as a function", name);
type = build_pointer_type (type);
}
else if (TREE_CODE (type) != ERROR_MARK
&& !COMPLETE_OR_UNBOUND_ARRAY_TYPE_P (type))
{
- error ("field %qs has incomplete type", name);
+ if (name)
+ error ("field %qE has incomplete type", name);
+ else
+ error ("unnamed field has incomplete type");
type = error_mark_node;
}
type = c_build_qualified_type (type, type_quals);
@@ -5045,7 +5153,7 @@ grokdeclarator (const struct c_declarator *declarator,
{
if (storage_class == csc_register || threadp)
{
- error ("invalid storage class for function %qs", name);
+ error ("invalid storage class for function %qE", name);
}
else if (current_scope != file_scope)
{
@@ -5055,10 +5163,11 @@ grokdeclarator (const struct c_declarator *declarator,
GCC allows 'auto', perhaps with 'inline', to support
nested functions. */
if (storage_class == csc_auto)
- pedwarn (input_location, OPT_pedantic, "invalid storage class for function %qs", name);
+ pedwarn (input_location, OPT_pedantic,
+ "invalid storage class for function %qE", name);
else if (storage_class == csc_static)
{
- error ("invalid storage class for function %qs", name);
+ error ("invalid storage class for function %qE", name);
if (funcdef_flag)
storage_class = declspecs->storage_class = csc_none;
else
@@ -8368,7 +8477,7 @@ c_write_global_declarations (void)
if (ext_block)
c_write_global_declarations_1 (BLOCK_VARS (ext_block));
/* LIPO */
- FOR_EACH_EXT_BLOCK_DO (c_write_global_declarations_1);
+ apply_for_each_ext_block (c_write_global_declarations_1);
/* LIPO: */
if (L_IPO_COMP_MODE)
@@ -8394,7 +8503,7 @@ c_write_global_declarations (void)
if (ext_block)
c_write_global_declarations_2 (BLOCK_VARS (ext_block));
/* LIPO */
- FOR_EACH_EXT_BLOCK_DO (c_write_global_declarations_2);
+ apply_for_each_ext_block (c_write_global_declarations_2);
timevar_pop (TV_SYMOUT);
}
@@ -8452,7 +8561,8 @@ c_add_built_in_decl (tree decl)
if (!flag_dyn_ipa)
return;
- if (at_eof) return;
+ if (at_eof)
+ return;
if (parsing_start)
return;
@@ -8536,8 +8646,9 @@ c_save_built_in_decl_pre_parsing (void)
size_t i;
c_saved_builtin *bi;
- for (i = 0; VEC_iterate (c_saved_builtin,
- saved_builtins, i, bi); ++i)
+ for (i = 0;
+ VEC_iterate (c_saved_builtin, saved_builtins, i, bi);
+ ++i)
c_save_built_in_decl_pre_parsing_1 (bi);
}
@@ -8552,8 +8663,9 @@ c_restore_built_in_decl_pre_parsing (void)
/* Now re-bind the builtins in the external scope. */
gcc_assert (current_scope && current_scope == external_scope);
- for (i = 0; VEC_iterate (c_saved_builtin,
- saved_builtins, i, bi); ++i)
+ for (i = 0;
+ VEC_iterate (c_saved_builtin, saved_builtins, i, bi);
+ ++i)
{
tree id;
tree decl = bi->decl;
@@ -8575,8 +8687,9 @@ c_save_built_in_decl_post_parsing (void)
size_t i;
c_saved_builtin *bi;
- for (i = 0; VEC_iterate (c_saved_builtin,
- saved_builtins, i, bi); ++i)
+ for (i = 0;
+ VEC_iterate (c_saved_builtin, saved_builtins, i, bi);
+ ++i)
{
/* Skip builtin decls in the predefined state.
The static flag for defined builtins are not set, so
@@ -8600,8 +8713,9 @@ c_restore_built_in_decl_post_parsing (void)
{
c_saved_builtin *bi;
unsigned i;
- for (i = 0; VEC_iterate (c_saved_builtin,
- saved_builtins, i, bi); ++i)
+ for (i = 0;
+ VEC_iterate (c_saved_builtin, saved_builtins, i, bi);
+ ++i)
{
tree decl = bi->decl;
/* Now restore the decl's state */
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index a361e904b93..9cb4a0b2d17 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -196,20 +196,5 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED,
&& !warn_init_self)
TREE_NO_WARNING (DECL_EXPR_DECL (*expr_p)) = 1;
- /* The C frontend is the only one producing &ARRAY with pointer-to-element
- type. This is invalid in gimple, so produce a properly typed
- ADDR_EXPR instead and wrap a conversion around it. */
- if (code == ADDR_EXPR
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (*expr_p, 0))) == ARRAY_TYPE
- && !lang_hooks.types_compatible_p (TREE_TYPE (TREE_TYPE (*expr_p)),
- TREE_TYPE (TREE_OPERAND (*expr_p, 0))))
- {
- tree type = TREE_TYPE (*expr_p);
- TREE_TYPE (*expr_p)
- = build_pointer_type (TREE_TYPE (TREE_OPERAND (*expr_p, 0)));
- *expr_p = build1 (NOP_EXPR, type, *expr_p);
- return GS_OK;
- }
-
return GS_UNHANDLED;
}
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index df6354843bf..fc89279a7d9 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -617,11 +617,21 @@ interpret_float (const cpp_token *token, unsigned int flags)
char *copy;
size_t copylen;
- /* Default (no suffix) is double. */
+ /* Default (no suffix) depends on whether the FLOAT_CONST_DECIMAL64
+ pragma has been used and is either double or _Decimal64. Types
+ that are not allowed with decimal float default to double. */
if (flags & CPP_N_DEFAULT)
{
flags ^= CPP_N_DEFAULT;
flags |= CPP_N_MEDIUM;
+
+ if (((flags & CPP_N_HEX) == 0) && ((flags & CPP_N_IMAGINARY) == 0))
+ {
+ warning (OPT_Wunsuffixed_float_constants,
+ "unsuffixed float constant");
+ if (float_const_decimal64_p ())
+ flags |= CPP_N_DFLOAT;
+ }
}
/* Decode _Fract and _Accum. */
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c
index 274f2701c96..d6729ac5d0f 100644
--- a/gcc/c-objc-common.c
+++ b/gcc/c-objc-common.c
@@ -1,5 +1,6 @@
/* Some code common to C and ObjC front ends.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007,
+ 2009 Free Software Foundation, Inc.
This file is part of GCC.
@@ -26,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "insn-config.h"
#include "integrate.h"
#include "c-tree.h"
+#include "intl.h"
#include "c-pretty-print.h"
#include "function.h"
#include "flags.h"
@@ -98,7 +100,6 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
{
tree t = va_arg (*text->args_ptr, tree);
tree name;
- const char *n = "({anonymous})";
c_pretty_printer *cpp = (c_pretty_printer *) pp;
pp->padding = pp_none;
@@ -124,7 +125,10 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
case 'F':
if (DECL_NAME (t))
- n = lang_hooks.decl_printable_name (t, 2);
+ {
+ pp_identifier (cpp, lang_hooks.decl_printable_name (t, 2));
+ return true;
+ }
break;
case 'T':
@@ -134,7 +138,7 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
if (name && TREE_CODE (name) == TYPE_DECL)
{
if (DECL_NAME (name))
- pp_string (cpp, lang_hooks.decl_printable_name (name, 2));
+ pp_identifier (cpp, lang_hooks.decl_printable_name (name, 2));
else
pp_type_id (cpp, t);
return true;
@@ -148,19 +152,16 @@ c_tree_printer (pretty_printer *pp, text_info *text, const char *spec,
case 'E':
if (TREE_CODE (t) == IDENTIFIER_NODE)
- n = IDENTIFIER_POINTER (t);
+ pp_identifier (cpp, IDENTIFIER_POINTER (t));
else
- {
- pp_expression (cpp, t);
- return true;
- }
- break;
+ pp_expression (cpp, t);
+ return true;
default:
return false;
}
- pp_string (cpp, n);
+ pp_string (cpp, _("({anonymous})"));
return true;
}
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index f6568fb9e7b..49a9281ee32 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
-
#include "config.h"
#include "system.h"
#include "coretypes.h"
@@ -402,11 +401,7 @@ c_common_handle_option (size_t scode, const char *arg, int value)
headers. */
warn_unknown_pragmas = value;
- /* 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 = (value ? 2 : 0);
+ warn_uninitialized = value;
if (!c_dialect_cxx ())
{
@@ -1061,11 +1056,8 @@ c_common_post_options (const char **pfilename)
if (flag_objc_exceptions && !flag_objc_sjlj_exceptions)
flag_exceptions = 1;
- /* -Wextra implies -Wtype-limits, -Wclobbered,
- -Wempty-body, -Wsign-compare,
- -Wmissing-field-initializers, -Wmissing-parameter-type
- -Wold-style-declaration, -Woverride-init and -Wignored-qualifiers
- but not if explicitly overridden. */
+ /* -Wextra implies the following flags
+ unless explicitly overridden. */
if (warn_type_limits == -1)
warn_type_limits = extra_warnings;
if (warn_clobbered == -1)
@@ -1243,8 +1235,6 @@ c_common_init (void)
return true;
}
-extern void set_parsing_context (struct cpp_reader*, int, bool);
-
/* Initialize the integrated preprocessor after debug output has been
initialized; loop over each input file. */
void
@@ -1491,8 +1481,6 @@ add_prefixed_path (const char *suffix, size_t chain)
add_path (path, chain, 0, false);
}
-extern void coverage_note_define (const char *cpp_def, bool is_def);
-
/* Handle -D, -U, -A, -imacros, and the first -include. */
static void
finish_options (void)
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 7fe7fae1cda..033c8350776 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -222,8 +222,8 @@ c_lex_one_token (c_parser *parser, c_token *token)
{
warning_at (token->location,
OPT_Wc___compat,
- "identifier %qs conflicts with C++ keyword",
- IDENTIFIER_POINTER (token->value));
+ "identifier %qE conflicts with C++ keyword",
+ token->value);
}
else if (c_dialect_objc ())
{
@@ -976,6 +976,7 @@ c_parser_translation_unit (c_parser *parser)
else
{
void *obstack_position = obstack_alloc (&parser_obstack, 0);
+ mark_valid_location_for_stdc_pragma (false);
do
{
ggc_collect ();
@@ -1060,7 +1061,9 @@ c_parser_external_declaration (c_parser *parser)
c_parser_consume_token (parser);
break;
case CPP_PRAGMA:
+ mark_valid_location_for_stdc_pragma (true);
c_parser_pragma (parser, pragma_external);
+ mark_valid_location_for_stdc_pragma (false);
break;
case CPP_PLUS:
case CPP_MINUS:
@@ -3350,17 +3353,20 @@ c_parser_compound_statement_nostart (c_parser *parser)
{
bool last_stmt = false;
bool last_label = false;
+ bool save_valid_for_pragma = valid_location_for_stdc_pragma_p ();
location_t label_loc = UNKNOWN_LOCATION; /* Quiet warning. */
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
c_parser_consume_token (parser);
return;
}
+ mark_valid_location_for_stdc_pragma (true);
if (c_parser_next_token_is_keyword (parser, RID_LABEL))
{
location_t err_loc = c_parser_peek_token (parser)->location;
/* Read zero or more forward-declarations for labels that nested
functions can jump to. */
+ mark_valid_location_for_stdc_pragma (false);
while (c_parser_next_token_is_keyword (parser, RID_LABEL))
{
c_parser_consume_token (parser);
@@ -3391,6 +3397,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
/* We must now have at least one statement, label or declaration. */
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
{
+ mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
c_parser_error (parser, "expected declaration or statement");
c_parser_consume_token (parser);
return;
@@ -3409,12 +3416,14 @@ c_parser_compound_statement_nostart (c_parser *parser)
label_loc = c_parser_peek_token (parser)->location;
last_label = true;
last_stmt = false;
+ mark_valid_location_for_stdc_pragma (false);
c_parser_label (parser);
}
else if (!last_label
&& c_parser_next_token_starts_declspecs (parser))
{
last_label = false;
+ mark_valid_location_for_stdc_pragma (false);
c_parser_declaration_or_fndef (parser, true, true, true, true);
if (last_stmt)
pedwarn_c90 (loc,
@@ -3441,6 +3450,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
ext = disable_extension_diagnostics ();
c_parser_consume_token (parser);
last_label = false;
+ mark_valid_location_for_stdc_pragma (false);
c_parser_declaration_or_fndef (parser, true, true, true, true);
/* Following the old parser, __extension__ does not
disable this diagnostic. */
@@ -3467,6 +3477,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
}
else if (c_parser_next_token_is (parser, CPP_EOF))
{
+ mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
c_parser_error (parser, "expected declaration or statement");
return;
}
@@ -3474,6 +3485,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
{
if (parser->in_if_block)
{
+ mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
error_at (loc, """expected %<}%> before %<else%>");
return;
}
@@ -3489,6 +3501,7 @@ c_parser_compound_statement_nostart (c_parser *parser)
statement:
last_label = false;
last_stmt = true;
+ mark_valid_location_for_stdc_pragma (false);
c_parser_statement_after_labels (parser);
}
@@ -3497,6 +3510,8 @@ c_parser_compound_statement_nostart (c_parser *parser)
if (last_label)
error_at (label_loc, "label at end of compound statement");
c_parser_consume_token (parser);
+ /* Restore the value we started with. */
+ mark_valid_location_for_stdc_pragma (save_valid_for_pragma);
}
/* Parse a label (C90 6.6.1, C99 6.8.1).
@@ -5784,7 +5799,7 @@ c_parser_expression (c_parser *parser)
next = default_function_array_conversion (next);
expr.value = build_compound_expr (expr.value, next.value);
expr.original_code = COMPOUND_EXPR;
- expr.original_type = NULL;
+ expr.original_type = next.original_type;
}
return expr;
}
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index f33ae50f430..bd71d1d79e8 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -112,8 +112,8 @@ pop_alignment (tree id)
}
if (entry == NULL)
warning (OPT_Wpragmas, "\
-#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s)"
- , IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id));
+#pragma pack(pop, %E) encountered without matching #pragma pack(push, %E)"
+ , id, id);
}
entry = alignment_stack->prev;
@@ -179,7 +179,7 @@ handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy))
else if (!strcmp (op, "pop"))
action = pop;
else
- GCC_BAD2 ("unknown action %qs for %<#pragma pack%> - ignored", op);
+ GCC_BAD2 ("unknown action %qE for %<#pragma pack%> - ignored", x);
while ((token = pragma_lex (&x)) == CPP_COMMA)
{
@@ -1162,6 +1162,116 @@ handle_pragma_message (cpp_reader *ARG_UNUSED(dummy))
inform (input_location, "#pragma message: %s", TREE_STRING_POINTER (message));
}
+/* Mark whether the current location is valid for a STDC pragma. */
+
+static bool valid_location_for_stdc_pragma;
+
+void
+mark_valid_location_for_stdc_pragma (bool flag)
+{
+ valid_location_for_stdc_pragma = flag;
+}
+
+/* Return true if the current location is valid for a STDC pragma. */
+
+bool
+valid_location_for_stdc_pragma_p (void)
+{
+ return valid_location_for_stdc_pragma;
+}
+
+enum pragma_switch_t { ON, OFF, DEFAULT, BAD };
+
+/* A STDC pragma must appear outside of external declarations or
+ preceding all explicit declarations and statements inside a compound
+ statement; its behavior is undefined if used in any other context.
+ It takes a switch of ON, OFF, or DEFAULT. */
+
+static enum pragma_switch_t
+handle_stdc_pragma (const char *pname)
+{
+ const char *arg;
+ tree t;
+ enum pragma_switch_t ret;
+
+ if (!valid_location_for_stdc_pragma_p ())
+ {
+ warning (OPT_Wpragmas, "invalid location for %<pragma %s%>, ignored",
+ pname);
+ return BAD;
+ }
+
+ if (pragma_lex (&t) != CPP_NAME)
+ {
+ warning (OPT_Wpragmas, "malformed %<#pragma %s%>, ignored", pname);
+ return BAD;
+ }
+
+ arg = IDENTIFIER_POINTER (t);
+
+ if (!strcmp (arg, "ON"))
+ ret = ON;
+ else if (!strcmp (arg, "OFF"))
+ ret = OFF;
+ else if (!strcmp (arg, "DEFAULT"))
+ ret = DEFAULT;
+ else
+ {
+ warning (OPT_Wpragmas, "malformed %<#pragma %s%>, ignored", pname);
+ return BAD;
+ }
+
+ if (pragma_lex (&t) != CPP_EOF)
+ {
+ warning (OPT_Wpragmas, "junk at end of %<#pragma %s%>", pname);
+ return BAD;
+ }
+
+ return ret;
+}
+
+/* #pragma STDC FLOAT_CONST_DECIMAL64 ON
+ #pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ #pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT */
+
+static void
+handle_pragma_float_const_decimal64 (cpp_reader *ARG_UNUSED (dummy))
+{
+ if (c_dialect_cxx ())
+ {
+ if (warn_unknown_pragmas > in_system_header)
+ warning (OPT_Wunknown_pragmas,
+ "%<#pragma STDC FLOAT_CONST_DECIMAL64%> is not supported"
+ " for C++");
+ return;
+ }
+
+ if (!targetm.decimal_float_supported_p ())
+ {
+ if (warn_unknown_pragmas > in_system_header)
+ warning (OPT_Wunknown_pragmas,
+ "%<#pragma STDC FLOAT_CONST_DECIMAL64%> is not supported"
+ " on this target");
+ return;
+ }
+
+ pedwarn (input_location, OPT_pedantic,
+ "ISO C does not support %<#pragma STDC FLOAT_CONST_DECIMAL64%>");
+
+ switch (handle_stdc_pragma ("STDC FLOAT_CONST_DECIMAL64"))
+ {
+ case ON:
+ set_float_const_decimal64 ();
+ break;
+ case OFF:
+ case DEFAULT:
+ clear_float_const_decimal64 ();
+ break;
+ case BAD:
+ break;
+ }
+}
+
/* A vector of registered pragma callbacks. */
DEF_VEC_O (pragma_handler);
@@ -1330,6 +1440,9 @@ init_pragma (void)
c_register_pragma ("GCC", "pop_options", handle_pragma_pop_options);
c_register_pragma ("GCC", "reset_options", handle_pragma_reset_options);
+ c_register_pragma ("STDC", "FLOAT_CONST_DECIMAL64",
+ handle_pragma_float_const_decimal64);
+
c_register_pragma_with_expansion (0, "redefine_extname", handle_pragma_redefine_extname);
c_register_pragma (0, "extern_prefix", handle_pragma_extern_prefix);
diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c
index ebfb8851ccf..efd15ac9b26 100644
--- a/gcc/c-pretty-print.c
+++ b/gcc/c-pretty-print.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "real.h"
#include "fixed-value.h"
+#include "intl.h"
#include "c-pretty-print.h"
#include "c-tree.h"
#include "tree-iterator.h"
@@ -177,7 +178,7 @@ pp_c_cv_qualifier (c_pretty_printer *pp, const char *cv)
logic in the C++ pretty-printer. */
if (p != NULL && (*p == '*' || *p == '&'))
pp_c_whitespace (pp);
- pp_c_identifier (pp, cv);
+ pp_c_ws_string (pp, cv);
}
/* Pretty-print T using the type-cast notation '( type-name )'. */
@@ -306,7 +307,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
switch (code)
{
case ERROR_MARK:
- pp_c_identifier (pp, "<type-error>");
+ pp_c_ws_string (pp, _("<type-error>"));
break;
case IDENTIFIER_NODE:
@@ -345,14 +346,14 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
{
case INTEGER_TYPE:
pp_string (pp, (TYPE_UNSIGNED (t)
- ? "<unnamed-unsigned:"
- : "<unnamed-signed:"));
+ ? _("<unnamed-unsigned:")
+ : _("<unnamed-signed:")));
break;
case REAL_TYPE:
- pp_string (pp, "<unnamed-float:");
+ pp_string (pp, _("<unnamed-float:"));
break;
case FIXED_POINT_TYPE:
- pp_string (pp, "<unnamed-fixed:");
+ pp_string (pp, _("<unnamed-fixed:"));
break;
default:
gcc_unreachable ();
@@ -367,25 +368,25 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t)
if (DECL_NAME (t))
pp_id_expression (pp, t);
else
- pp_c_identifier (pp, "<typedef-error>");
+ pp_c_ws_string (pp, _("<typedef-error>"));
break;
case UNION_TYPE:
case RECORD_TYPE:
case ENUMERAL_TYPE:
if (code == UNION_TYPE)
- pp_c_identifier (pp, "union");
+ pp_c_ws_string (pp, "union");
else if (code == RECORD_TYPE)
- pp_c_identifier (pp, "struct");
+ pp_c_ws_string (pp, "struct");
else if (code == ENUMERAL_TYPE)
- pp_c_identifier (pp, "enum");
+ pp_c_ws_string (pp, "enum");
else
- pp_c_identifier (pp, "<tag-error>");
+ pp_c_ws_string (pp, _("<tag-error>"));
if (TYPE_NAME (t))
pp_id_expression (pp, TYPE_NAME (t));
else
- pp_c_identifier (pp, "<anonymous>");
+ pp_c_ws_string (pp, _("<anonymous>"));
break;
default:
@@ -441,9 +442,9 @@ pp_c_specifier_qualifier_list (c_pretty_printer *pp, tree t)
case COMPLEX_TYPE:
pp_c_specifier_qualifier_list (pp, TREE_TYPE (t));
if (code == COMPLEX_TYPE)
- pp_c_identifier (pp, flag_isoc99 ? "_Complex" : "__complex__");
+ pp_c_ws_string (pp, flag_isoc99 ? "_Complex" : "__complex__");
else if (code == VECTOR_TYPE)
- pp_c_identifier (pp, "__vector__");
+ pp_c_ws_string (pp, "__vector__");
break;
default:
@@ -471,7 +472,7 @@ pp_c_parameter_type_list (c_pretty_printer *pp, tree t)
tree parms = want_parm_decl ? DECL_ARGUMENTS (t) : TYPE_ARG_TYPES (t);
pp_c_left_paren (pp);
if (parms == void_list_node)
- pp_c_identifier (pp, "void");
+ pp_c_ws_string (pp, "void");
else
{
bool first = true;
@@ -587,13 +588,13 @@ void
pp_c_storage_class_specifier (c_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == TYPE_DECL)
- pp_c_identifier (pp, "typedef");
+ pp_c_ws_string (pp, "typedef");
else if (DECL_P (t))
{
if (DECL_REGISTER (t))
- pp_c_identifier (pp, "register");
+ pp_c_ws_string (pp, "register");
else if (TREE_STATIC (t) && TREE_CODE (t) == VAR_DECL)
- pp_c_identifier (pp, "static");
+ pp_c_ws_string (pp, "static");
}
}
@@ -604,7 +605,7 @@ void
pp_c_function_specifier (c_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (t))
- pp_c_identifier (pp, "inline");
+ pp_c_ws_string (pp, "inline");
}
/* declaration-specifiers:
@@ -733,7 +734,7 @@ pp_c_attributes (c_pretty_printer *pp, tree attributes)
if (attributes == NULL_TREE)
return;
- pp_c_identifier (pp, "__attribute__");
+ pp_c_ws_string (pp, "__attribute__");
pp_c_left_paren (pp);
pp_c_left_paren (pp);
for (; attributes != NULL_TREE; attributes = TREE_CHAIN (attributes))
@@ -869,18 +870,18 @@ pp_c_bool_constant (c_pretty_printer *pp, tree b)
if (b == boolean_false_node)
{
if (c_dialect_cxx ())
- pp_c_identifier (pp, "false");
+ pp_c_ws_string (pp, "false");
else if (flag_isoc99)
- pp_c_identifier (pp, "_False");
+ pp_c_ws_string (pp, "_False");
else
pp_unsupported_tree (pp, b);
}
else if (b == boolean_true_node)
{
if (c_dialect_cxx ())
- pp_c_identifier (pp, "true");
+ pp_c_ws_string (pp, "true");
else if (flag_isoc99)
- pp_c_identifier (pp, "_True");
+ pp_c_ws_string (pp, "_True");
else
pp_unsupported_tree (pp, b);
}
@@ -1069,7 +1070,20 @@ pp_c_constant (c_pretty_printer *pp, tree e)
}
}
-/* Pretty-print an IDENTIFIER_NODE, preceded by whitespace is necessary. */
+/* Pretty-print a string such as an identifier, without changing its
+ encoding, preceded by whitespace is necessary. */
+
+void
+pp_c_ws_string (c_pretty_printer *pp, const char *str)
+{
+ pp_c_maybe_whitespace (pp);
+ pp_string (pp, str);
+ pp_base (pp)->padding = pp_before;
+}
+
+/* Pretty-print an IDENTIFIER_NODE, which may contain UTF-8 sequences
+ that need converting to the locale encoding, preceded by whitespace
+ is necessary. */
void
pp_c_identifier (c_pretty_printer *pp, const char *id)
@@ -1105,11 +1119,11 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e)
break;
case ERROR_MARK:
- pp_c_identifier (pp, "<erroneous-expression>");
+ pp_c_ws_string (pp, _("<erroneous-expression>"));
break;
case RESULT_DECL:
- pp_c_identifier (pp, "<return-value>");
+ pp_c_ws_string (pp, _("<return-value>"));
break;
case INTEGER_CST:
@@ -1120,7 +1134,7 @@ pp_c_primary_expression (c_pretty_printer *pp, tree e)
break;
case TARGET_EXPR:
- pp_c_identifier (pp, "__builtin_memcpy");
+ pp_c_ws_string (pp, "__builtin_memcpy");
pp_c_left_paren (pp);
pp_ampersand (pp);
pp_primary_expression (pp, TREE_OPERAND (e, 0));
@@ -1338,7 +1352,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
case POSTINCREMENT_EXPR:
case POSTDECREMENT_EXPR:
pp_postfix_expression (pp, TREE_OPERAND (e, 0));
- pp_identifier (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
+ pp_string (pp, code == POSTINCREMENT_EXPR ? "++" : "--");
break;
case ARRAY_REF:
@@ -1365,49 +1379,49 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
}
case UNORDERED_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "isunordered"
: "__builtin_isunordered");
goto two_args_fun;
case ORDERED_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isunordered"
: "!__builtin_isunordered");
goto two_args_fun;
case UNLT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isgreaterequal"
: "!__builtin_isgreaterequal");
goto two_args_fun;
case UNLE_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isgreater"
: "!__builtin_isgreater");
goto two_args_fun;
case UNGT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!islessequal"
: "!__builtin_islessequal");
goto two_args_fun;
case UNGE_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!isless"
: "!__builtin_isless");
goto two_args_fun;
case UNEQ_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "!islessgreater"
: "!__builtin_islessgreater");
goto two_args_fun;
case LTGT_EXPR:
- pp_c_identifier (pp, flag_isoc99
+ pp_c_ws_string (pp, flag_isoc99
? "islessgreater"
: "__builtin_islessgreater");
goto two_args_fun;
@@ -1421,7 +1435,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
break;
case ABS_EXPR:
- pp_c_identifier (pp, "__builtin_abs");
+ pp_c_ws_string (pp, "__builtin_abs");
pp_c_left_paren (pp);
pp_expression (pp, TREE_OPERAND (e, 0));
pp_c_right_paren (pp);
@@ -1491,7 +1505,7 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
break;
case VA_ARG_EXPR:
- pp_c_identifier (pp, "__builtin_va_arg");
+ pp_c_ws_string (pp, "__builtin_va_arg");
pp_c_left_paren (pp);
pp_assignment_expression (pp, TREE_OPERAND (e, 0));
pp_separate_with (pp, ',');
@@ -1580,7 +1594,7 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e)
{
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
- pp_identifier (pp, code == PREINCREMENT_EXPR ? "++" : "--");
+ pp_string (pp, code == PREINCREMENT_EXPR ? "++" : "--");
pp_c_unary_expression (pp, TREE_OPERAND (e, 0));
break;
@@ -1606,7 +1620,7 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e)
case REALPART_EXPR:
case IMAGPART_EXPR:
- pp_c_identifier (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
+ pp_c_ws_string (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
pp_c_whitespace (pp);
pp_unary_expression (pp, TREE_OPERAND (e, 0));
break;
@@ -1717,7 +1731,7 @@ pp_c_shift_expression (c_pretty_printer *pp, tree e)
case RSHIFT_EXPR:
pp_c_shift_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, code == LSHIFT_EXPR ? "<<" : ">>");
+ pp_string (pp, code == LSHIFT_EXPR ? "<<" : ">>");
pp_c_whitespace (pp);
pp_c_additive_expression (pp, TREE_OPERAND (e, 1));
break;
@@ -1751,9 +1765,9 @@ pp_c_relational_expression (c_pretty_printer *pp, tree e)
else if (code == GT_EXPR)
pp_greater (pp);
else if (code == LE_EXPR)
- pp_identifier (pp, "<=");
+ pp_string (pp, "<=");
else if (code == GE_EXPR)
- pp_identifier (pp, ">=");
+ pp_string (pp, ">=");
pp_c_whitespace (pp);
pp_c_shift_expression (pp, TREE_OPERAND (e, 1));
break;
@@ -1779,7 +1793,7 @@ pp_c_equality_expression (c_pretty_printer *pp, tree e)
case NE_EXPR:
pp_c_equality_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, code == EQ_EXPR ? "==" : "!=");
+ pp_string (pp, code == EQ_EXPR ? "==" : "!=");
pp_c_whitespace (pp);
pp_c_relational_expression (pp, TREE_OPERAND (e, 1));
break;
@@ -1863,7 +1877,7 @@ pp_c_logical_and_expression (c_pretty_printer *pp, tree e)
{
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, "&&");
+ pp_string (pp, "&&");
pp_c_whitespace (pp);
pp_c_inclusive_or_expression (pp, TREE_OPERAND (e, 1));
}
@@ -1883,7 +1897,7 @@ pp_c_logical_or_expression (c_pretty_printer *pp, tree e)
{
pp_c_logical_or_expression (pp, TREE_OPERAND (e, 0));
pp_c_whitespace (pp);
- pp_identifier (pp, "||");
+ pp_string (pp, "||");
pp_c_whitespace (pp);
pp_c_logical_and_expression (pp, TREE_OPERAND (e, 1));
}
diff --git a/gcc/c-pretty-print.h b/gcc/c-pretty-print.h
index 75f31ca139f..8f12bb05237 100644
--- a/gcc/c-pretty-print.h
+++ b/gcc/c-pretty-print.h
@@ -1,5 +1,5 @@
/* Various declarations for the C and C++ pretty-printers.
- Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
@@ -203,6 +203,7 @@ void pp_c_primary_expression (c_pretty_printer *, tree);
void pp_c_init_declarator (c_pretty_printer *, tree);
void pp_c_constant (c_pretty_printer *, tree);
void pp_c_id_expression (c_pretty_printer *, tree);
+void pp_c_ws_string (c_pretty_printer *, const char *);
void pp_c_identifier (c_pretty_printer *, const char *);
void pp_c_string_literal (c_pretty_printer *, tree);
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index 490130c5531..223fda0d4e0 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -694,18 +694,18 @@ extern bool c_cpp_error (cpp_reader *, int, location_t, unsigned int,
/* LIPO support. */
-int c_get_lang_decl_size (tree t);
-void c_lipo_dup_lang_type (tree src, tree dest);
-void c_lipo_copy_lang_type (tree src, tree dest);
-int c_is_global_scope (tree decl, void *scope);
-void c_clear_name_bindings (tree id);
-void c_add_built_in_decl (tree decl);
-void c_save_built_in_decl_pre_parsing (void);
-void c_restore_built_in_decl_pre_parsing (void);
-void c_save_built_in_decl_post_parsing (void);
-void c_restore_built_in_decl_post_parsing (void);
-int c_is_compiler_generated_type (tree t);
-int c_cmp_lang_type (tree t1, tree t2);
+extern int c_get_lang_decl_size (tree t);
+extern void c_lipo_dup_lang_type (tree src, tree dest);
+extern void c_lipo_copy_lang_type (tree src, tree dest);
+extern int c_is_global_scope (tree decl, void *scope);
+extern void c_clear_name_bindings (tree id);
+extern void c_add_built_in_decl (tree decl);
+extern void c_save_built_in_decl_pre_parsing (void);
+extern void c_restore_built_in_decl_pre_parsing (void);
+extern void c_save_built_in_decl_post_parsing (void);
+extern void c_restore_built_in_decl_post_parsing (void);
+extern int c_is_compiler_generated_type (tree t);
+extern int c_cmp_lang_type (tree t1, tree t2);
#endif /* ! GCC_C_TREE_H */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index b2d21095407..0a29d954a7d 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1634,21 +1634,6 @@ array_to_pointer_conversion (tree exp)
if (TREE_CODE (exp) == INDIRECT_REF)
return convert (ptrtype, TREE_OPERAND (exp, 0));
- if (TREE_CODE (exp) == VAR_DECL)
- {
- /* We are making an ADDR_EXPR of ptrtype. This is a valid
- ADDR_EXPR because it's the best way of representing what
- happens in C when we take the address of an array and place
- it in a pointer to the element type. */
- adr = build1 (ADDR_EXPR, ptrtype, exp);
- if (!c_mark_addressable (exp))
- return error_mark_node;
- 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 (EXPR_LOCATION (exp), ADDR_EXPR, exp, 1);
return convert (ptrtype, adr);
}
@@ -1979,7 +1964,7 @@ build_component_ref (tree datum, tree component)
TREE_THIS_VOLATILE (ref) = 1;
if (TREE_DEPRECATED (subdatum))
- warn_deprecated_use (subdatum);
+ warn_deprecated_use (subdatum, NULL_TREE);
datum = ref;
@@ -2240,7 +2225,7 @@ build_external_ref (tree id, int fun, location_t loc, tree *type)
return error_mark_node;
if (TREE_DEPRECATED (ref))
- warn_deprecated_use (ref);
+ warn_deprecated_use (ref, NULL_TREE);
/* Recursive call does not count as usage. */
if (ref != current_function_decl)
@@ -4581,21 +4566,15 @@ convert_for_assignment (tree type, tree rhs, tree origtype,
&& TREE_CODE (type) == ENUMERAL_TYPE
&& TYPE_MAIN_VARIANT (checktype) != TYPE_MAIN_VARIANT (type))
{
- /* FIXME: Until the gcc source code is converted, we only
- warn about assignment and parameter passing. We will add
- the other cases when bootstrap succeeds with them. */
- if (errtype == ic_argpass || errtype == ic_assign)
- {
- WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat,
- G_("enum conversion when passing argument "
- "%d of %qE is invalid in C++"),
- G_("enum conversion in assignment is "
- "invalid in C++"),
- G_("enum conversion in initialization is "
- "invalid in C++"),
- G_("enum conversion in return is "
- "invalid in C++"));
- }
+ WARN_FOR_ASSIGNMENT (input_location, OPT_Wc___compat,
+ G_("enum conversion when passing argument "
+ "%d of %qE is invalid in C++"),
+ G_("enum conversion in assignment is "
+ "invalid in C++"),
+ G_("enum conversion in initialization is "
+ "invalid in C++"),
+ G_("enum conversion in return is "
+ "invalid in C++"));
}
}
@@ -5167,7 +5146,9 @@ static void
push_member_name (tree decl)
{
const char *const string
- = DECL_NAME (decl) ? IDENTIFIER_POINTER (DECL_NAME (decl)) : "<anonymous>";
+ = (DECL_NAME (decl)
+ ? identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl)))
+ : _("<anonymous>"));
PUSH_SPELLING (SPELLING_MEMBER, string, u.s);
}
@@ -5786,13 +5767,13 @@ start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
|| 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));
+ locus = identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl)));
}
else
{
require_constant_value = 0;
require_constant_elements = 0;
- locus = "(anonymous)";
+ locus = _("(anonymous)");
}
constructor_stack = 0;
@@ -7024,6 +7005,24 @@ output_init_element (tree value, tree origtype, bool strict_string, tree type,
pedwarn_init (input_location, 0,
"initializer element is not a constant expression");
+ /* Issue -Wc++-compat warnings about initializing a bitfield with
+ enum type. */
+ if (warn_cxx_compat
+ && field != NULL_TREE
+ && TREE_CODE (field) == FIELD_DECL
+ && DECL_BIT_FIELD_TYPE (field) != NULL_TREE
+ && (TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field))
+ != TYPE_MAIN_VARIANT (type))
+ && TREE_CODE (DECL_BIT_FIELD_TYPE (field)) == ENUMERAL_TYPE)
+ {
+ tree checktype = origtype != NULL_TREE ? origtype : TREE_TYPE (value);
+ if (checktype != error_mark_node
+ && (TYPE_MAIN_VARIANT (checktype)
+ != TYPE_MAIN_VARIANT (DECL_BIT_FIELD_TYPE (field))))
+ warning_init (OPT_Wc___compat,
+ "enum conversion in initialization is invalid in C++");
+ }
+
/* If this field is empty (and not at the end of structure),
don't do anything other than checking the initializer. */
if (field
@@ -8870,12 +8869,12 @@ build_binary_op (location_t location, enum tree_code code,
/* Handle the pointer + int case. */
if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
- ret = pointer_int_sum (location, PLUS_EXPR, op0, op1);
+ ret = pointer_int_sum (PLUS_EXPR, op0, op1);
goto return_build_binary_op;
}
else if (code1 == POINTER_TYPE && code0 == INTEGER_TYPE)
{
- ret = pointer_int_sum (location, PLUS_EXPR, op1, op0);
+ ret = pointer_int_sum (PLUS_EXPR, op1, op0);
goto return_build_binary_op;
}
else
@@ -8894,7 +8893,7 @@ build_binary_op (location_t location, enum tree_code code,
/* Handle pointer minus int. Just like pointer plus int. */
else if (code0 == POINTER_TYPE && code1 == INTEGER_TYPE)
{
- ret = pointer_int_sum (location, MINUS_EXPR, op0, op1);
+ ret = pointer_int_sum (MINUS_EXPR, op0, op1);
goto return_build_binary_op;
}
else
@@ -9247,7 +9246,9 @@ build_binary_op (location_t location, enum tree_code code,
(code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE
|| code1 == FIXED_POINT_TYPE || code1 == VECTOR_TYPE))
{
- int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE);
+ bool first_complex = (code0 == COMPLEX_TYPE);
+ bool second_complex = (code1 == COMPLEX_TYPE);
+ int none_complex = (!first_complex && !second_complex);
if (shorten || common || short_compare)
{
@@ -9256,6 +9257,89 @@ build_binary_op (location_t location, enum tree_code code,
return error_mark_node;
}
+ if (first_complex != second_complex
+ && (code == PLUS_EXPR
+ || code == MINUS_EXPR
+ || code == MULT_EXPR
+ || (code == TRUNC_DIV_EXPR && first_complex))
+ && TREE_CODE (TREE_TYPE (result_type)) == REAL_TYPE
+ && flag_signed_zeros)
+ {
+ /* An operation on mixed real/complex operands must be
+ handled specially, but the language-independent code can
+ more easily optimize the plain complex arithmetic if
+ -fno-signed-zeros. */
+ tree real_type = TREE_TYPE (result_type);
+ tree real, imag;
+ if (type0 != orig_type0 || type1 != orig_type1)
+ {
+ gcc_assert (may_need_excess_precision && common);
+ real_result_type = c_common_type (orig_type0, orig_type1);
+ }
+ if (first_complex)
+ {
+ if (TREE_TYPE (op0) != result_type)
+ op0 = convert_and_check (result_type, op0);
+ if (TREE_TYPE (op1) != real_type)
+ op1 = convert_and_check (real_type, op1);
+ }
+ else
+ {
+ if (TREE_TYPE (op0) != real_type)
+ op0 = convert_and_check (real_type, op0);
+ if (TREE_TYPE (op1) != result_type)
+ op1 = convert_and_check (result_type, op1);
+ }
+ if (TREE_CODE (op0) == ERROR_MARK || TREE_CODE (op1) == ERROR_MARK)
+ return error_mark_node;
+ if (first_complex)
+ {
+ op0 = c_save_expr (op0);
+ real = build_unary_op (EXPR_LOCATION (orig_op0), REALPART_EXPR,
+ op0, 1);
+ imag = build_unary_op (EXPR_LOCATION (orig_op0), IMAGPART_EXPR,
+ op0, 1);
+ switch (code)
+ {
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ imag = build2 (resultcode, real_type, imag, op1);
+ /* Fall through. */
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ real = build2 (resultcode, real_type, real, op1);
+ break;
+ default:
+ gcc_unreachable();
+ }
+ }
+ else
+ {
+ op1 = c_save_expr (op1);
+ real = build_unary_op (EXPR_LOCATION (orig_op1), REALPART_EXPR,
+ op1, 1);
+ imag = build_unary_op (EXPR_LOCATION (orig_op1), IMAGPART_EXPR,
+ op1, 1);
+ switch (code)
+ {
+ case MULT_EXPR:
+ imag = build2 (resultcode, real_type, op0, imag);
+ /* Fall through. */
+ case PLUS_EXPR:
+ real = build2 (resultcode, real_type, op0, real);
+ break;
+ case MINUS_EXPR:
+ real = build2 (resultcode, real_type, op0, real);
+ imag = build1 (NEGATE_EXPR, real_type, imag);
+ break;
+ default:
+ gcc_unreachable();
+ }
+ }
+ ret = build2 (COMPLEX_EXPR, result_type, real, imag);
+ goto return_build_binary_op;
+ }
+
/* 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.
diff --git a/gcc/c.opt b/gcc/c.opt
index 7f71699faa7..fc34ff57f78 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -476,6 +476,10 @@ Wunknown-pragmas
C ObjC C++ ObjC++ Warning
Warn about unrecognized pragmas
+Wunsuffixed-float-constants
+C ObjC Var(warn_unsuffixed_float_constants) Warning
+Warn about unsuffixed float constants
+
Wunused-macros
C ObjC C++ ObjC++ Warning
Warn about macros defined in the main file that are not used
diff --git a/gcc/calls.c b/gcc/calls.c
index c05c2880c7c..219b1d3afa6 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1054,6 +1054,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
|| (callee_copies
&& !TREE_ADDRESSABLE (type)
&& (base = get_base_address (args[i].tree_value))
+ && TREE_CODE (base) != SSA_NAME
&& (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
{
/* We can't use sibcalls if a callee-copied argument is
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index a5765f81c47..ab9464fdcb5 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -94,8 +94,8 @@ gimple_cond_pred_to_tree (gimple stmt)
tree lhs = gimple_cond_lhs (stmt);
if (SA.values
&& TREE_CODE (lhs) == SSA_NAME
- && SA.values[SSA_NAME_VERSION (lhs)])
- lhs = gimple_assign_rhs_to_tree (SA.values[SSA_NAME_VERSION (lhs)]);
+ && bitmap_bit_p (SA.values, SSA_NAME_VERSION (lhs)))
+ lhs = gimple_assign_rhs_to_tree (SSA_NAME_DEF_STMT (lhs));
return build2 (gimple_cond_code (stmt), boolean_type_node,
lhs, gimple_cond_rhs (stmt));
@@ -1724,6 +1724,52 @@ label_rtx_for_bb (basic_block bb ATTRIBUTE_UNUSED)
}
+/* A subroutine of expand_gimple_cond. Given E, a fallthrough edge
+ of a basic block where we just expanded the conditional at the end,
+ possibly clean up the CFG and instruction sequence. */
+
+static void
+maybe_cleanup_end_of_block (edge e)
+{
+ /* Special case: when jumpif decides that the condition is
+ trivial it emits an unconditional jump (and the necessary
+ barrier). But we still have two edges, the fallthru one is
+ wrong. purge_dead_edges would clean this up later. Unfortunately
+ we have to insert insns (and split edges) before
+ find_many_sub_basic_blocks and hence before purge_dead_edges.
+ But splitting edges might create new blocks which depend on the
+ fact that if there are two edges there's no barrier. So the
+ barrier would get lost and verify_flow_info would ICE. Instead
+ of auditing all edge splitters to care for the barrier (which
+ normally isn't there in a cleaned CFG), fix it here. */
+ if (BARRIER_P (get_last_insn ()))
+ {
+ basic_block bb = e->src;
+ rtx insn;
+ remove_edge (e);
+ /* Now, we have a single successor block, if we have insns to
+ insert on the remaining edge we potentially will insert
+ it at the end of this block (if the dest block isn't feasible)
+ in order to avoid splitting the edge. This insertion will take
+ place in front of the last jump. But we might have emitted
+ multiple jumps (conditional and one unconditional) to the
+ same destination. Inserting in front of the last one then
+ is a problem. See PR 40021. We fix this by deleting all
+ jumps except the last unconditional one. */
+ insn = PREV_INSN (get_last_insn ());
+ /* Make sure we have an unconditional jump. Otherwise we're
+ confused. */
+ gcc_assert (JUMP_P (insn) && !any_condjump_p (insn));
+ for (insn = PREV_INSN (insn); insn != BB_HEAD (bb);)
+ {
+ insn = PREV_INSN (insn);
+ if (JUMP_P (NEXT_INSN (insn)))
+ delete_insn (NEXT_INSN (insn));
+ }
+ }
+}
+
+
/* A subroutine of expand_gimple_basic_block. Expand one GIMPLE_COND.
Returns a new basic block if we've terminated the current basic
block and created a new one. */
@@ -1767,19 +1813,7 @@ expand_gimple_cond (basic_block bb, gimple stmt)
true_edge->goto_block = NULL;
false_edge->flags |= EDGE_FALLTHRU;
ggc_free (pred);
- /* Special case: when jumpif decides that the condition is
- trivial it emits an unconditional jump (and the necessary
- barrier). But we still have two edges, the fallthru one is
- wrong. purge_dead_edges would clean this up later. Unfortunately
- we have to insert insns (and split edges) before
- find_many_sub_basic_blocks and hence before purge_dead_edges.
- But splitting edges might create new blocks which depend on the
- fact that if there are two edges there's no barrier. So the
- barrier would get lost and verify_flow_info would ICE. Instead
- of auditing all edge splitters to care for the barrier (which
- normally isn't there in a cleaned CFG), fix it here. */
- if (BARRIER_P (get_last_insn ()))
- remove_edge (false_edge);
+ maybe_cleanup_end_of_block (false_edge);
return NULL;
}
if (true_edge->dest == bb->next_bb)
@@ -1796,8 +1830,7 @@ expand_gimple_cond (basic_block bb, gimple stmt)
false_edge->goto_block = NULL;
true_edge->flags |= EDGE_FALLTHRU;
ggc_free (pred);
- if (BARRIER_P (get_last_insn ()))
- remove_edge (true_edge);
+ maybe_cleanup_end_of_block (true_edge);
return NULL;
}
@@ -2078,7 +2111,8 @@ expand_gimple_basic_block (basic_block bb)
/* Ignore this stmt if it is in the list of
replaceable expressions. */
if (SA.values
- && SA.values[SSA_NAME_VERSION (DEF_FROM_PTR (def_p))])
+ && bitmap_bit_p (SA.values,
+ SSA_NAME_VERSION (DEF_FROM_PTR (def_p))))
continue;
}
stmt_tree = gimple_to_tree (stmt);
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 36bc865916b..a2c0e0f2026 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "tm_p.h"
#include "obstack.h"
+#include "insn-attr.h"
#include "insn-config.h"
#include "cfglayout.h"
#include "expr.h"
@@ -408,13 +409,27 @@ free_bb_for_insn (void)
return 0;
}
+static unsigned int
+rest_of_pass_free_cfg (void)
+{
+#ifdef DELAY_SLOTS
+ /* The resource.c machinery uses DF but the CFG isn't guaranteed to be
+ valid at that point so it would be too late to call df_analyze. */
+ if (optimize > 0 && flag_delayed_branch)
+ df_analyze ();
+#endif
+
+ free_bb_for_insn ();
+ return 0;
+}
+
struct rtl_opt_pass pass_free_cfg =
{
{
RTL_PASS,
NULL, /* name */
NULL, /* gate */
- free_bb_for_insn, /* execute */
+ rest_of_pass_free_cfg, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 1bf99b5cf41..9d29aa5f130 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -78,7 +78,6 @@ The callgraph:
#include "target.h"
#include "basic-block.h"
#include "cgraph.h"
-#include "varray.h"
#include "output.h"
#include "intl.h"
#include "gimple.h"
@@ -508,7 +507,6 @@ cgraph_node (tree decl)
node = cgraph_create_node ();
node->decl = decl;
*slot = node;
-
if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)
{
node->origin = cgraph_node (DECL_CONTEXT (decl));
@@ -653,7 +651,7 @@ cgraph_edge (struct cgraph_node *node, gimple call_stmt)
}
-/* Change field call_smt of edge E to NEW_STMT. */
+/* Change field call_stmt of edge E to NEW_STMT. */
void
cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
@@ -680,6 +678,79 @@ cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt)
}
}
+/* Like cgraph_set_call_stmt but walk the clone tree and update all clones sharing
+ same function body. */
+
+void
+cgraph_set_call_stmt_including_clones (struct cgraph_node *orig,
+ gimple old_stmt, gimple new_stmt)
+{
+ struct cgraph_node *node;
+ struct cgraph_edge *edge = cgraph_edge (orig, old_stmt);
+
+ if (edge)
+ cgraph_set_call_stmt (edge, new_stmt);
+ if (orig->clones)
+ for (node = orig->clones; node != orig;)
+ {
+ struct cgraph_edge *edge = cgraph_edge (node, old_stmt);
+ if (edge)
+ cgraph_set_call_stmt (edge, new_stmt);
+ if (node->clones)
+ node = node->clones;
+ else if (node->next_sibling_clone)
+ node = node->next_sibling_clone;
+ else
+ {
+ while (node != orig && !node->next_sibling_clone)
+ node = node->clone_of;
+ if (node != orig)
+ node = node->next_sibling_clone;
+ }
+ }
+}
+
+/* Like cgraph_create_edge walk the clone tree and update all clones sharing
+ same function body.
+
+ TODO: COUNT and LOOP_DEPTH should be properly distributed based on relative
+ frequencies of the clones.
+ */
+
+void
+cgraph_create_edge_including_clones (struct cgraph_node *orig, struct cgraph_node *callee,
+ gimple stmt, gcov_type count, int freq,
+ int loop_depth,
+ cgraph_inline_failed_t reason)
+{
+ struct cgraph_node *node;
+
+ cgraph_create_edge (orig, callee, stmt, count, freq, loop_depth)->inline_failed =
+ reason;
+
+ if (orig->clones)
+ for (node = orig->clones; node != orig;)
+ {
+ /* It is possible that we already constant propagated into the clone
+ and turned indirect call into dirrect call. */
+ if (!cgraph_edge (node, stmt))
+ cgraph_create_edge (node, callee, stmt, count, freq,
+ loop_depth)->inline_failed = reason;
+
+ if (node->clones)
+ node = node->clones;
+ else if (node->next_sibling_clone)
+ node = node->next_sibling_clone;
+ else
+ {
+ while (node != orig && !node->next_sibling_clone)
+ node = node->clone_of;
+ if (node != orig)
+ node = node->next_sibling_clone;
+ }
+ }
+}
+
/* Give initial reasons why inlining would fail on EDGE. This gets either
nullified or usually overwritten by more precise reasons later. */
@@ -880,12 +951,12 @@ cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n)
/* Update or remove the corresponding cgraph edge if a GIMPLE_CALL
OLD_STMT changed into NEW_STMT. */
-void
-cgraph_update_edges_for_call_stmt (gimple old_stmt, gimple new_stmt)
+static void
+cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node,
+ gimple old_stmt, gimple new_stmt)
{
tree new_call = (is_gimple_call (new_stmt)) ? gimple_call_fn (new_stmt) : 0;
tree old_call = (is_gimple_call (old_stmt)) ? gimple_call_fn (old_stmt) : 0;
- struct cgraph_node *node = cgraph_node (cfun->decl);
if (old_call != new_call)
{
@@ -922,6 +993,34 @@ cgraph_update_edges_for_call_stmt (gimple old_stmt, gimple new_stmt)
}
}
+/* Update or remove the corresponding cgraph edge if a GIMPLE_CALL
+ OLD_STMT changed into NEW_STMT. */
+
+void
+cgraph_update_edges_for_call_stmt (gimple old_stmt, gimple new_stmt)
+{
+ struct cgraph_node *orig = cgraph_node (cfun->decl);
+ struct cgraph_node *node;
+
+ cgraph_update_edges_for_call_stmt_node (orig, old_stmt, new_stmt);
+ if (orig->clones)
+ for (node = orig->clones; node != orig;)
+ {
+ cgraph_update_edges_for_call_stmt_node (node, old_stmt, new_stmt);
+ if (node->clones)
+ node = node->clones;
+ else if (node->next_sibling_clone)
+ node = node->next_sibling_clone;
+ else
+ {
+ while (node != orig && !node->next_sibling_clone)
+ node = node->clone_of;
+ if (node != orig)
+ node = node->next_sibling_clone;
+ }
+ }
+}
+
/* Remove all callees from the node. */
@@ -1011,7 +1110,6 @@ cgraph_release_function_body (struct cgraph_node *node)
DECL_INITIAL (node->decl) = error_mark_node;
}
-
/* Remove the node from cgraph. */
void
@@ -1051,24 +1149,100 @@ cgraph_remove_node (struct cgraph_node *node)
slot = htab_find_slot (cgraph_hash, node, NO_INSERT);
if (*slot == node)
{
- if (node->next_clone)
- {
- struct cgraph_node *new_node = node->next_clone;
+ struct cgraph_node *next_inline_clone;
- *slot = new_node;
- node->next_clone->prev_clone = NULL;
- }
+ for (next_inline_clone = node->clones;
+ next_inline_clone && next_inline_clone->decl != node->decl;
+ next_inline_clone = next_inline_clone->next_sibling_clone)
+ ;
+
+ /* If there is inline clone of the node being removed, we need
+ to put it into the position of removed node and reorganize all
+ other clones to be based on it. */
+ if (next_inline_clone)
+ {
+ struct cgraph_node *n;
+ struct cgraph_node *new_clones;
+
+ *slot = next_inline_clone;
+
+ /* Unlink inline clone from the list of clones of removed node. */
+ if (next_inline_clone->next_sibling_clone)
+ next_inline_clone->next_sibling_clone->prev_sibling_clone
+ = next_inline_clone->prev_sibling_clone;
+ if (next_inline_clone->prev_sibling_clone)
+ {
+ next_inline_clone->prev_sibling_clone->next_sibling_clone
+ = next_inline_clone->next_sibling_clone;
+ }
+ else
+ node->clones = next_inline_clone->next_sibling_clone;
+
+ new_clones = node->clones;
+ node->clones = NULL;
+
+ /* Copy clone info. */
+ next_inline_clone->clone = node->clone;
+
+ /* Now place it into clone tree at same level at NODE. */
+ next_inline_clone->clone_of = node->clone_of;
+ next_inline_clone->prev_sibling_clone = NULL;
+ next_inline_clone->next_sibling_clone = NULL;
+ if (node->clone_of)
+ {
+ next_inline_clone->next_sibling_clone = node->clone_of->clones;
+ node->clone_of->clones = next_inline_clone;
+ }
+
+ /* Merge the clone list. */
+ if (new_clones)
+ {
+ if (!next_inline_clone->clones)
+ next_inline_clone->clones = new_clones;
+ else
+ {
+ n = next_inline_clone->clones;
+ while (n->next_sibling_clone)
+ n = n->next_sibling_clone;
+ n->next_sibling_clone = new_clones;
+ new_clones->prev_sibling_clone = n;
+ }
+ }
+
+ /* Update clone_of pointers. */
+ n = new_clones;
+ while (n)
+ {
+ n->clone_of = next_inline_clone;
+ n = n->next_sibling_clone;
+ }
+ }
else
{
htab_clear_slot (cgraph_hash, slot);
kill_body = true;
}
+
}
else
+ gcc_assert (node->clone_of);
+ if (node->prev_sibling_clone)
+ node->prev_sibling_clone->next_sibling_clone = node->next_sibling_clone;
+ else if (node->clone_of)
+ node->clone_of->clones = node->next_sibling_clone;
+ if (node->next_sibling_clone)
+ node->next_sibling_clone->prev_sibling_clone = node->prev_sibling_clone;
+ if (node->clones)
{
- node->prev_clone->next_clone = node->next_clone;
- if (node->next_clone)
- node->next_clone->prev_clone = node->prev_clone;
+ struct cgraph_node *n;
+
+ for (n = node->clones; n->next_sibling_clone; n = n->next_sibling_clone)
+ n->clone_of = node->clone_of;
+ n->clone_of = node->clone_of;
+ n->next_sibling_clone = node->clone_of->clones;
+ if (node->clone_of->clones)
+ node->clone_of->clones->prev_sibling_clone = n;
+ node->clone_of->clones = node->clones;
}
/* While all the clones are removed after being proceeded, the function
@@ -1078,7 +1252,7 @@ cgraph_remove_node (struct cgraph_node *node)
if (!kill_body && *slot)
{
struct cgraph_node *n = (struct cgraph_node *) *slot;
- if (!n->next_clone && !n->global.inlined_to
+ if (!n->clones && !n->clone_of && !n->global.inlined_to
&& (cgraph_global_info_ready
&& (TREE_ASM_WRITTEN (n->decl) || DECL_EXTERNAL (n->decl))))
kill_body = true;
@@ -1107,6 +1281,21 @@ cgraph_remove_node (struct cgraph_node *node)
free_nodes = node;
}
+/* Remove the node from cgraph. */
+
+void
+cgraph_remove_node_and_inline_clones (struct cgraph_node *node)
+{
+ struct cgraph_edge *e, *next;
+ for (e = node->callees; e; e = next)
+ {
+ next = e->next_callee;
+ if (!e->inline_failed)
+ cgraph_remove_node_and_inline_clones (e->callee);
+ }
+ cgraph_remove_node (node);
+}
+
/* Notify finalize_compilation_unit that given node is reachable. */
void
@@ -1214,6 +1403,10 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, " (inline copy in %s/%i)",
cgraph_node_name (node->global.inlined_to),
node->global.inlined_to->uid);
+ if (node->clone_of)
+ fprintf (f, " (clone of %s/%i)",
+ cgraph_node_name (node->clone_of),
+ node->clone_of->uid);
if (cgraph_function_flags_ready)
fprintf (f, " availability:%s",
cgraph_availability_names [cgraph_function_body_availability (node)]);
@@ -1431,6 +1624,7 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq,
new_node->rtl = n->rtl;
new_node->count = count;
new_node->is_versioned_clone = n->is_versioned_clone;
+ new_node->clone = n->clone;
if (n->count)
{
if (new_node->count > n->count)
@@ -1451,16 +1645,109 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq,
cgraph_clone_edge (e, new_node, e->call_stmt, count_scale, freq, loop_nest,
update_original);
- new_node->next_clone = n->next_clone;
- new_node->prev_clone = n;
- n->next_clone = new_node;
- if (new_node->next_clone)
- new_node->next_clone->prev_clone = new_node;
+ new_node->next_sibling_clone = n->clones;
+ if (n->clones)
+ n->clones->prev_sibling_clone = new_node;
+ n->clones = new_node;
+ new_node->clone_of = n;
cgraph_call_node_duplication_hooks (n, new_node);
return new_node;
}
+/* Create a new name for omp child function. Returns an identifier. */
+
+static GTY(()) unsigned int clone_fn_id_num;
+
+static tree
+clone_function_name (tree decl)
+{
+ tree name = DECL_ASSEMBLER_NAME (decl);
+ size_t len = IDENTIFIER_LENGTH (name);
+ char *tmp_name, *prefix;
+
+ prefix = XALLOCAVEC (char, len + strlen ("_clone") + 1);
+ memcpy (prefix, IDENTIFIER_POINTER (name), len);
+ strcpy (prefix + len, "_clone");
+#ifndef NO_DOT_IN_LABEL
+ prefix[len] = '.';
+#elif !defined NO_DOLLAR_IN_LABEL
+ prefix[len] = '$';
+#endif
+ ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++);
+ return get_identifier (tmp_name);
+}
+
+/* Create callgraph node clone with new declaration. The actual body will
+ be copied later at compilation stage.
+
+ TODO: after merging in ipa-sra use function call notes instead of args_to_skip
+ bitmap interface.
+ */
+struct cgraph_node *
+cgraph_create_virtual_clone (struct cgraph_node *old_node,
+ VEC(cgraph_edge_p,heap) *redirect_callers,
+ VEC(ipa_replace_map_p,gc) *tree_map,
+ bitmap args_to_skip)
+{
+ tree old_decl = old_node->decl;
+ struct cgraph_node *new_node = NULL;
+ tree new_decl;
+ struct cgraph_node key, **slot;
+ unsigned i;
+ struct cgraph_edge *e;
+
+ gcc_assert (tree_versionable_function_p (old_decl));
+
+ /* Make a new FUNCTION_DECL tree node */
+ if (!args_to_skip)
+ new_decl = copy_node (old_decl);
+ else
+ new_decl = build_function_decl_skip_args (old_decl, args_to_skip);
+ DECL_STRUCT_FUNCTION (new_decl) = NULL;
+
+ /* Generate a new name for the new version. */
+ DECL_NAME (new_decl) = clone_function_name (old_decl);
+ SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
+ SET_DECL_RTL (new_decl, NULL);
+
+ new_node = cgraph_clone_node (old_node, old_node->count,
+ CGRAPH_FREQ_BASE, 0, false);
+ new_node->decl = new_decl;
+ /* Update the properties.
+ Make clone visible only within this translation unit. Make sure
+ that is not weak also.
+ ??? We cannot use COMDAT linkage because there is no
+ ABI support for this. */
+ DECL_EXTERNAL (new_node->decl) = 0;
+ DECL_ONE_ONLY (new_node->decl) = 0;
+ TREE_PUBLIC (new_node->decl) = 0;
+ DECL_COMDAT (new_node->decl) = 0;
+ DECL_WEAK (new_node->decl) = 0;
+ new_node->clone.tree_map = tree_map;
+ new_node->clone.args_to_skip = args_to_skip;
+ new_node->local.externally_visible = 0;
+ new_node->local.local = 1;
+ new_node->is_versioned_clone = 1;
+ new_node->lowered = true;
+ new_node->reachable = true;
+
+ key.decl = new_decl;
+ slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT);
+ gcc_assert (!*slot);
+ *slot = new_node;
+ cgraph_add_assembler_hash_node (new_node);
+ cgraph_link_node (new_node);
+ for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++)
+ {
+ /* Redirect calls to the old version node to point to its new
+ version. */
+ cgraph_redirect_edge_callee (e, new_node);
+ }
+
+ return new_node;
+}
+
/* NODE is no longer nested function; update cgraph accordingly. */
void
cgraph_unnest_node (struct cgraph_node *node)
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index ec7227a4a64..c2a1264bd9a 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -119,6 +119,29 @@ struct GTY(()) cgraph_rtl_info {
unsigned int preferred_incoming_stack_boundary;
};
+/* Represent which DECL tree (or reference to such tree)
+ will be replaced by another tree while versioning. */
+struct GTY(()) ipa_replace_map
+{
+ /* The tree that will be replaced. */
+ tree old_tree;
+ /* The new (replacing) tree. */
+ tree new_tree;
+ /* True when a substitution should be done, false otherwise. */
+ bool replace_p;
+ /* True when we replace a reference to old_tree. */
+ bool ref_p;
+};
+typedef struct ipa_replace_map *ipa_replace_map_p;
+DEF_VEC_P(ipa_replace_map_p);
+DEF_VEC_ALLOC_P(ipa_replace_map_p,gc);
+
+struct GTY(()) cgraph_clone_info
+{
+ VEC(ipa_replace_map_p,gc)* tree_map;
+ bitmap args_to_skip;
+};
+
/* The cgraph data structure.
Each function decl has assigned cgraph_node listing callees and callers. */
@@ -137,8 +160,10 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
/* Pointer to the next function in cgraph_nodes_queue. */
struct cgraph_node *next_needed;
/* Pointer to the next clone. */
- struct cgraph_node *next_clone;
- struct cgraph_node *prev_clone;
+ struct cgraph_node *next_sibling_clone;
+ struct cgraph_node *prev_sibling_clone;
+ struct cgraph_node *clones;
+ struct cgraph_node *clone_of;
/* For functions with many calls sites it holds map from call expression
to the edge to speed up cgraph_edge function. */
htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
@@ -148,6 +173,7 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
struct cgraph_local_info local;
struct cgraph_global_info global;
struct cgraph_rtl_info rtl;
+ struct cgraph_clone_info clone;
/* Expected number of executions: calculated in profile.c. */
gcov_type count;
@@ -356,7 +382,7 @@ void cgraph_remove_assembler_hash_node (struct cgraph_node *);
void cgraph_remove_fake_indirect_call_in_edges (struct cgraph_node *);
extern int cgraph_need_artificial_indirect_call_edges;
extern bool cgraph_is_fake_indirect_call_edge (struct cgraph_edge *e);
-
+void cgraph_remove_node_and_inline_clones (struct cgraph_node *);
void cgraph_release_function_body (struct cgraph_node *);
void cgraph_node_remove_callees (struct cgraph_node *node);
struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
@@ -366,6 +392,11 @@ struct cgraph_node *cgraph_node (tree);
struct cgraph_node *cgraph_node_for_asm (tree asmname);
struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple);
void cgraph_set_call_stmt (struct cgraph_edge *, gimple);
+void cgraph_set_call_stmt_including_clones (struct cgraph_node *, gimple, gimple);
+void cgraph_create_edge_including_clones (struct cgraph_node *,
+ struct cgraph_node *,
+ gimple, gcov_type, int, int,
+ cgraph_inline_failed_t);
void cgraph_update_edges_for_call_stmt (gimple, gimple);
struct cgraph_local_info *cgraph_local_info (tree);
struct cgraph_global_info *cgraph_global_info (tree);
@@ -387,6 +418,10 @@ void cgraph_unnest_node (struct cgraph_node *);
enum availability cgraph_function_body_availability (struct cgraph_node *);
void cgraph_add_new_function (tree, bool);
const char* cgraph_inline_failed_string (cgraph_inline_failed_t);
+struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
+ VEC(cgraph_edge_p,heap)*,
+ VEC(ipa_replace_map_p,gc)* tree_map,
+ bitmap args_to_skip);
/* In cgraphunit.c */
void cgraph_finalize_function (tree, bool);
@@ -404,8 +439,9 @@ void cgraph_reset_static_var_maps (void);
void init_cgraph (void);
struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
VEC(cgraph_edge_p,heap)*,
- varray_type,
+ VEC(ipa_replace_map_p,gc)*,
bitmap);
+void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*, bool, bitmap);
void cgraph_analyze_function (struct cgraph_node *);
struct cgraph_node *save_inline_function_body (struct cgraph_node *);
void record_references_in_initializer (tree);
@@ -469,10 +505,11 @@ struct cgraph_2edge_hook_list *cgraph_add_edge_duplication_hook (cgraph_2edge_ho
void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
+void cgraph_materialize_all_clones (void);
/* In cgraphbuild.c */
unsigned int rebuild_cgraph_edges (void);
-int compute_call_stmt_bb_frequency (basic_block bb);
+int compute_call_stmt_bb_frequency (tree, basic_block bb);
/* In ipa.c */
bool cgraph_remove_unreachable_nodes (bool, FILE *);
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index d7f0d25fa3d..1f19eee273c 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -84,11 +84,14 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
/* Computes the frequency of the call statement so that it can be stored in
cgraph_edge. BB is the basic block of the call statement. */
int
-compute_call_stmt_bb_frequency (basic_block bb)
+compute_call_stmt_bb_frequency (tree decl, basic_block bb)
{
int entry_freq = ENTRY_BLOCK_PTR->frequency;
int freq = bb->frequency;
+ if (profile_status_for_function (DECL_STRUCT_FUNCTION (decl)) == PROFILE_ABSENT)
+ return CGRAPH_FREQ_BASE;
+
if (!entry_freq)
entry_freq = 1, freq++;
@@ -221,7 +224,7 @@ build_cgraph_edges (void)
size_t i;
size_t n = gimple_call_num_args (stmt);
cgraph_create_edge (node, cgraph_real_node (decl), stmt,
- bb->count, compute_call_stmt_bb_frequency (bb),
+ bb->count, compute_call_stmt_bb_frequency (current_function_decl, bb),
bb->loop_depth);
for (i = 0; i < n; i++)
walk_tree (gimple_call_arg_ptr (stmt, i), record_reference,
@@ -255,7 +258,6 @@ build_cgraph_edges (void)
}
}
-
/* Look for initializers of constant variables and private statics. */
for (step = cfun->local_decls;
step;
@@ -325,7 +327,9 @@ rebuild_cgraph_edges (void)
if (is_gimple_call (stmt) && (decl = gimple_call_fndecl (stmt)))
cgraph_create_edge (node, cgraph_real_node (decl), stmt,
- bb->count, compute_call_stmt_bb_frequency (bb),
+ bb->count,
+ compute_call_stmt_bb_frequency
+ (current_function_decl, bb),
bb->loop_depth);
}
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index da325f6cdc2..62bf54a0cba 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -126,7 +126,6 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "params.h"
#include "fibheap.h"
-#include "c-common.h"
#include "intl.h"
#include "function.h"
#include "ipa-prop.h"
@@ -458,7 +457,6 @@ cgraph_process_new_functions (void)
static void
cgraph_reset_node (struct cgraph_node *node)
{
- struct cgraph_node saved_node;
/* If node->process is set, then we have already begun whole-unit analysis.
This is *not* testing for whether we've already emitted the function.
That case can be sort-of legitimately seen with real function redefinition
@@ -466,7 +464,6 @@ cgraph_reset_node (struct cgraph_node *node)
such a case, but don't enforce that for now. */
gcc_assert (!node->process);
- saved_node = *node;
/* Reset our data structures so we can analyze the function again. */
memset (&node->local, 0, sizeof (node->local));
memset (&node->global, 0, sizeof (node->global));
@@ -568,12 +565,20 @@ cgraph_mark_if_needed (tree decl)
cgraph_mark_needed_node (node);
}
+/* Return TRUE if NODE2 is equivalent to NODE or its clone. */
+static bool
+clone_of_p (struct cgraph_node *node, struct cgraph_node *node2)
+{
+ while (node != node2 && node2)
+ node2 = node2->clone_of;
+ return node2 != NULL;
+}
+
/* Verify cgraph nodes of given cgraph node. */
void
verify_cgraph_node (struct cgraph_node *node)
{
struct cgraph_edge *e;
- struct cgraph_node *main_clone;
struct function *this_cfun = DECL_STRUCT_FUNCTION (node->decl);
struct function *saved_cfun = cfun;
basic_block this_block;
@@ -590,7 +595,8 @@ verify_cgraph_node (struct cgraph_node *node)
if (e->aux)
{
error ("aux field set for edge %s->%s",
- cgraph_node_name (e->caller), cgraph_node_name (e->callee));
+ identifier_to_locale (cgraph_node_name (e->caller)),
+ identifier_to_locale (cgraph_node_name (e->callee)));
error_found = true;
}
if (node->count < 0)
@@ -648,17 +654,53 @@ verify_cgraph_node (struct cgraph_node *node)
error_found = true;
}
- for (main_clone = cgraph_node (node->decl); main_clone;
- main_clone = main_clone->next_clone)
- if (main_clone == node)
- break;
if (!cgraph_node (node->decl))
{
error ("node not found in cgraph_hash");
error_found = true;
}
- if (node->analyzed
+ if (node->clone_of)
+ {
+ struct cgraph_node *n;
+ for (n = node->clone_of->clones; n; n = n->next_sibling_clone)
+ if (n == node)
+ break;
+ if (!n)
+ {
+ error ("node has wrong clone_of");
+ error_found = true;
+ }
+ }
+ if (node->clones)
+ {
+ struct cgraph_node *n;
+ for (n = node->clones; n; n = n->next_sibling_clone)
+ if (n->clone_of != node)
+ break;
+ if (n)
+ {
+ error ("node has wrong clone list");
+ error_found = true;
+ }
+ }
+ if ((node->prev_sibling_clone || node->next_sibling_clone) && !node->clone_of)
+ {
+ error ("node is in clone list but it is not clone");
+ error_found = true;
+ }
+ if (!node->prev_sibling_clone && node->clone_of && node->clone_of->clones != node)
+ {
+ error ("node has wrong prev_clone pointer");
+ error_found = true;
+ }
+ if (node->prev_sibling_clone && node->prev_sibling_clone->next_sibling_clone != node)
+ {
+ error ("double linked list of clones corrupted");
+ error_found = true;
+ }
+
+ if (node->analyzed && gimple_has_body_p (node->decl)
&& !cgraph_is_auxiliary (node->decl)
&& !TREE_ASM_WRITTEN (node->decl)
&& (!DECL_EXTERNAL (node->decl) || node->global.inlined_to))
@@ -688,10 +730,9 @@ verify_cgraph_node (struct cgraph_node *node)
debug_gimple_stmt (stmt);
error_found = true;
}
- if (e->inline_failed
- /* The master node may be deleted and cgraph_real_node
- may assert if not guarded. */
- && e->callee->decl != cgraph_real_node (decl)->decl)
+ if (!clone_of_p (cgraph_node (decl), e->callee)
+ && !clone_of_p (cgraph_real_node (decl), e->callee)
+ && !e->callee->global.inlined_to)
{
error ("edge points to wrong declaration:");
debug_tree (e->callee->decl);
@@ -719,8 +760,8 @@ verify_cgraph_node (struct cgraph_node *node)
if (!e->aux && !e->indirect_call)
{
error ("edge %s->%s has no corresponding call_stmt",
- cgraph_node_name (e->caller),
- cgraph_node_name (e->callee));
+ identifier_to_locale (cgraph_node_name (e->caller)),
+ identifier_to_locale (cgraph_node_name (e->callee)));
debug_gimple_stmt (e->call_stmt);
error_found = true;
}
@@ -949,6 +990,8 @@ cgraph_analyze_functions (void)
dump_cgraph (cgraph_dump_file);
}
+ if (cgraph_dump_file)
+ fprintf (cgraph_dump_file, "\nReclaiming functions:");
for (node = cgraph_nodes; node != first_analyzed; node = next)
{
@@ -1009,7 +1052,7 @@ cgraph_is_decl_external (struct cgraph_node *node)
/* Comdat or weak functions in aux modules are not external --
there is no guarantee that the definitition will be emitted
in the primary compilation of this auxiliary module. */
- if ((DECL_COMDAT (decl) || DECL_WEAK (decl)))
+ if (DECL_COMDAT (decl) || DECL_WEAK (decl))
return false;
/* The others from aux modules are external. */
@@ -1765,7 +1808,7 @@ cgraph_finalize_compilation_unit (void)
timevar_pop (TV_CGRAPH);
}
-/* In l-ipo mode compiation (light weight IPO), multiple bodies may
+/* In l-ipo mode compilation (light weight IPO), multiple bodies may
be available for the same inline declared function. cgraph linking
does not really merge them in order to keep the context (module info)
of each body. After inlining, the linkage of the function may require
@@ -1817,10 +1860,13 @@ cgraph_find_output_node (struct cgraph_node *node)
if (!L_IPO_COMP_MODE)
return node;
- gcc_assert (TREE_PUBLIC (node->decl));
+ /* We do not track non-public functions. */
+ if (!TREE_PUBLIC (node->decl))
+ return NULL;
+ /* Never addedd. */
if (!output_node_hash)
- return node;
+ return NULL;
name = DECL_ASSEMBLER_NAME (node->decl);
@@ -1833,42 +1879,33 @@ cgraph_find_output_node (struct cgraph_node *node)
return (struct cgraph_node *)(*aslot);
}
-/* A function used in validation. Return true if NODE was expanded and
- its body was reclaimed. */
+
+/* A function used in validation. Return true if NODE was
+ not expanded and its body was not reclaimed. */
static bool
-cgraph_output_cannot_be_skipped (struct cgraph_node *node)
+cgraph_node_expansion_skipped (struct cgraph_node *node)
{
struct cgraph_node *output_node;
if (!L_IPO_COMP_MODE)
- return true;
-
- if (!TREE_PUBLIC (node->decl))
return false;
output_node = cgraph_find_output_node (node);
+ if (output_node == node)
+ return false;
+
if (output_node)
- {
- /* This NODE can be skipped due to duplication. */
- gcc_assert (node != output_node);
- return false;
- }
+ return true;
- /* This may result in the caller node of this NODE being
- skipped due to duplication (and therefore never expanded).
- NODE must be itself an inlined clone. */
+ /* No output, no duplicate being output, and the node is not
+ inlined (and reclaimed) either -- check if the caller node
+ is output/expanded or not. */
if (node->global.inlined_to)
- {
- struct cgraph_node *caller_output =
- cgraph_find_output_node (node->global.inlined_to);
- /* If the caller is skipped (not expanded), the inlined callee
- is skipped and won't have a chance to be be reclaimed. */
- if (!caller_output || caller_output != node->global.inlined_to)
- return false;
- }
+ return cgraph_node_expansion_skipped (node->global.inlined_to);
+ /* External functions not marked for output. */
return true;
}
@@ -1921,6 +1958,7 @@ cgraph_mark_functions_to_output (void)
|| cgraph_is_auxiliary (node->decl));
}
+
}
}
@@ -2121,9 +2159,9 @@ cgraph_preserve_function_body_p (tree decl)
gcc_assert (cgraph_global_info_ready);
/* Look if there is any clone around. */
- for (node = cgraph_node (decl); node; node = node->next_clone)
- if (node->global.inlined_to)
- return true;
+ node = cgraph_node (decl);
+ if (node->clones)
+ return true;
return false;
}
@@ -2150,25 +2188,8 @@ ipa_passes (void)
bitmap_obstack_release (NULL);
}
-extern void cgraph_debug_find_node (struct cgraph_node *n);
-
-void
-cgraph_debug_find_node (struct cgraph_node *n)
-{
- struct cgraph_node * node;
- for (node = cgraph_nodes; node; node = node->next)
- {
- if (node == n)
- {
- fprintf (stderr," Node found \n");
- return;
- }
- }
- fprintf (stderr, "Not found\n");
-}
-
-
/* Perform simple optimizations based on callgraph. */
+
void
cgraph_optimize (void)
{
@@ -2232,6 +2253,7 @@ cgraph_optimize (void)
verify_cgraph ();
#endif
+ cgraph_materialize_all_clones ();
cgraph_mark_functions_to_output ();
cgraph_state = CGRAPH_STATE_EXPANSION;
@@ -2272,7 +2294,7 @@ cgraph_optimize (void)
if (node->analyzed
&& ((node->global.inlined_to && !cgraph_is_auxiliary (node->decl))
|| gimple_has_body_p (node->decl))
- && cgraph_output_cannot_be_skipped (node))
+ && !cgraph_node_expansion_skipped (node))
{
error_found = true;
dump_cgraph_node (stderr, node);
@@ -2455,7 +2477,7 @@ cgraph_copy_node_for_versioning (struct cgraph_node *old_version,
struct cgraph_node *
cgraph_function_versioning (struct cgraph_node *old_version_node,
VEC(cgraph_edge_p,heap) *redirect_callers,
- varray_type tree_map,
+ VEC (ipa_replace_map_p,gc)* tree_map,
bitmap args_to_skip)
{
tree old_decl = old_version_node->decl;
@@ -2509,19 +2531,50 @@ cgraph_function_versioning (struct cgraph_node *old_version_node,
struct cgraph_node *
save_inline_function_body (struct cgraph_node *node)
{
- struct cgraph_node *first_clone;
+ struct cgraph_node *first_clone, *n;
gcc_assert (node == cgraph_node (node->decl));
cgraph_lower_function (node);
- first_clone = node->next_clone;
+ first_clone = node->clones;
first_clone->decl = copy_node (node->decl);
- node->next_clone = NULL;
- first_clone->prev_clone = NULL;
cgraph_insert_node_to_hashtable (first_clone);
gcc_assert (first_clone == cgraph_node (first_clone->decl));
+ if (first_clone->next_sibling_clone)
+ {
+ for (n = first_clone->next_sibling_clone; n->next_sibling_clone; n = n->next_sibling_clone)
+ n->clone_of = first_clone;
+ n->clone_of = first_clone;
+ n->next_sibling_clone = first_clone->clones;
+ if (first_clone->clones)
+ first_clone->clones->prev_sibling_clone = n;
+ first_clone->clones = first_clone->next_sibling_clone;
+ first_clone->next_sibling_clone->prev_sibling_clone = NULL;
+ first_clone->next_sibling_clone = NULL;
+ gcc_assert (!first_clone->prev_sibling_clone);
+ }
+ first_clone->clone_of = NULL;
+ node->clones = NULL;
+
+ if (first_clone->clones)
+ for (n = first_clone->clones; n != first_clone;)
+ {
+ gcc_assert (n->decl == node->decl);
+ n->decl = first_clone->decl;
+ if (n->clones)
+ n = n->clones;
+ else if (n->next_sibling_clone)
+ n = n->next_sibling_clone;
+ else
+ {
+ while (n != first_clone && !n->next_sibling_clone)
+ n = n->clone_of;
+ if (n != first_clone)
+ n = n->next_sibling_clone;
+ }
+ }
/* Copy the OLD_VERSION_NODE function tree to the new version. */
tree_function_versioning (node->decl, first_clone->decl, NULL, true, NULL);
@@ -2531,12 +2584,161 @@ save_inline_function_body (struct cgraph_node *node)
TREE_PUBLIC (first_clone->decl) = 0;
DECL_COMDAT (first_clone->decl) = 0;
- for (node = first_clone->next_clone; node; node = node->next_clone)
- node->decl = first_clone->decl;
#ifdef ENABLE_CHECKING
verify_cgraph_node (first_clone);
#endif
return first_clone;
}
+/* Given virtual clone, turn it into actual clone. */
+static void
+cgraph_materialize_clone (struct cgraph_node *node)
+{
+ bitmap_obstack_initialize (NULL);
+ /* Copy the OLD_VERSION_NODE function tree to the new version. */
+ tree_function_versioning (node->clone_of->decl, node->decl,
+ node->clone.tree_map, true,
+ node->clone.args_to_skip);
+
+ /* Function is no longer clone. */
+ if (node->next_sibling_clone)
+ node->next_sibling_clone->prev_sibling_clone = node->prev_sibling_clone;
+ if (node->prev_sibling_clone)
+ node->prev_sibling_clone->next_sibling_clone = node->next_sibling_clone;
+ else
+ node->clone_of->clones = node->next_sibling_clone;
+ node->next_sibling_clone = NULL;
+ node->prev_sibling_clone = NULL;
+ node->clone_of = NULL;
+ bitmap_obstack_release (NULL);
+}
+
+/* Return the root node of clone tree. */
+
+static inline struct cgraph_node *
+get_clone_orig_node (struct cgraph_node *node)
+{
+ while (node->clone_of
+ && node->decl == node->clone_of->decl)
+ node = node->clone_of;
+ return node;
+}
+
+/* Once all functions from compilation unit are in memory, produce all clones
+ and update all calls.
+ We might also do this on demand if we don't want to bring all functions to
+ memory prior compilation, but current WHOPR implementation does that and it is
+ is bit easier to keep everything right in this order. */
+void
+cgraph_materialize_all_clones (void)
+{
+ struct cgraph_node *node;
+ bool stabilized = false;
+
+ if (cgraph_dump_file)
+ fprintf (cgraph_dump_file, "Materializing clones\n");
+#ifdef ENABLE_CHECKING
+ verify_cgraph ();
+#endif
+
+ /* We can also do topological order, but number of iterations should be
+ bounded by number of IPA passes since single IPA pass is probably not
+ going to create clones of clones it created itself. */
+ while (!stabilized)
+ {
+ stabilized = true;
+ for (node = cgraph_nodes; node; node = node->next)
+ {
+ if (node->clone_of && node->decl != node->clone_of->decl
+ && !gimple_has_body_p (node->decl))
+ {
+ if (gimple_has_body_p (node->clone_of->decl))
+ {
+ if (cgraph_dump_file)
+ fprintf (cgraph_dump_file, " clonning %s to %s",
+ cgraph_node_name (node->clone_of),
+ cgraph_node_name (node));
+ cgraph_materialize_clone (node);
+ }
+ else
+ stabilized = false;
+ }
+ }
+ }
+ if (cgraph_dump_file)
+ fprintf (cgraph_dump_file, "Updating call sites\n");
+ for (node = cgraph_nodes; node; node = node->next)
+ if (node->analyzed && gimple_has_body_p (node->decl)
+ && ((!node->clone_of || node->clone_of->decl != node->decl)
+ /* A clone node may be unreachable (and not needed) and
+ the node will be removed in unreachable node removal.
+ However its caller node which is external (inline extern,
+ or node from aux module) may still be reachable. Such
+ node (the caller) will need to be kept in the callgraph.
+ As a result, we will have a live caller node with the callee
+ edge to the cloned node be removed. This will lead to a missing
+ call edge fixup. */
+ || L_IPO_COMP_MODE))
+ {
+ struct cgraph_edge *e;
+ struct cgraph_node *orig_node;
+
+ orig_node = get_clone_orig_node (node);
+ current_function_decl = node->decl;
+ push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ for (e = node->callees; e; e = e->next_callee)
+ {
+ tree decl = gimple_call_fndecl (e->call_stmt);
+ if (decl != e->callee->decl
+ && (!L_IPO_COMP_MODE || !decl
+ || (cgraph_real_node (decl)
+ != cgraph_real_node (e->callee->decl))))
+ {
+ gimple new_stmt;
+ gimple_stmt_iterator gsi;
+
+ if (cgraph_dump_file)
+ {
+ fprintf (cgraph_dump_file, "updating call of %s in %s:",
+ cgraph_node_name (e->callee),
+ cgraph_node_name (node));
+ print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags);
+ }
+
+ if (e->callee->clone.args_to_skip)
+ new_stmt = gimple_call_copy_skip_args (e->call_stmt,
+ e->callee->clone.args_to_skip);
+ else
+ new_stmt = e->call_stmt;
+ if (gimple_vdef (new_stmt)
+ && TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
+ SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
+ gimple_call_set_fndecl (new_stmt, e->callee->decl);
+
+ gsi = gsi_for_stmt (e->call_stmt);
+ gsi_replace (&gsi, new_stmt, true);
+
+ /* Update EH information too, just in case. */
+ if (!stmt_could_throw_p (new_stmt)
+ && lookup_stmt_eh_region (new_stmt))
+ remove_stmt_from_eh_region (new_stmt);
+
+ cgraph_set_call_stmt_including_clones (orig_node, e->call_stmt, new_stmt);
+
+ if (cgraph_dump_file)
+ {
+ fprintf (cgraph_dump_file, " updated to:");
+ print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags);
+ }
+ }
+ }
+ pop_cfun ();
+ current_function_decl = NULL;
+#ifdef ENABLE_CHECKING
+ verify_cgraph_node (node);
+#endif
+ }
+ cgraph_remove_unreachable_nodes (false, cgraph_dump_file);
+}
+
#include "gt-cgraphunit.h"
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 3f62dfe40b3..277ddd6dc4c 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1,7 +1,7 @@
/* Collect static initialization info into data structures that can be
traversed by C++ initialization and finalization routines.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Chris Smith (csmith@convex.com).
Heavily modified by Michael Meissner (meissner@cygnus.com),
@@ -538,7 +538,7 @@ dump_file (const char *name, FILE *to)
static symkind
is_ctor_dtor (const char *s)
{
- struct names { const char *const name; const int len; const int ret;
+ struct names { const char *const name; const int len; symkind ret;
const int two_underscores; };
const struct names *p;
diff --git a/gcc/common.opt b/gcc/common.opt
index ceb12b3f5ab..3e26f57111e 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -70,7 +70,7 @@ Common Optimization
Optimize for space rather than speed
W
-Common RejectNegative
+Common RejectNegative Var(extra_warnings) Warning
This switch is deprecated; use -Wextra instead
Waggregate-return
@@ -106,7 +106,7 @@ Common Joined
Treat specified warning as error
Wextra
-Common Warning
+Common Var(extra_warnings) Warning
Print extra (possibly unwanted) warnings
Wfatal-errors
@@ -197,7 +197,7 @@ Common Var(warn_type_limits) Init(-1) Warning
Warn if a comparison is always true or always false due to the limited range of the data type
Wuninitialized
-Common Var(warn_uninitialized) Warning
+Common Var(warn_uninitialized) Init(-1) Warning
Warn about uninitialized automatic variables
Wunreachable-code
@@ -397,8 +397,8 @@ Common Report Var(flag_cse_follow_jumps) Optimization
When running CSE, follow jumps to their targets
fcse-skip-blocks
-Common Report Var(flag_cse_skip_blocks) Optimization
-When running CSE, follow conditional jumps
+Common
+Does nothing. Preserved for backward compatibility.
fcx-limited-range
Common Report Var(flag_cx_limited_range) Optimization
diff --git a/gcc/config.gcc b/gcc/config.gcc
index d4d3889f4f4..503babea088 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -375,12 +375,14 @@ i[34567]86-*-*)
if test "x$enable_cld" = xyes; then
tm_defines="${tm_defines} USE_IX86_CLD=1"
fi
+ tm_file="vxworks-dummy.h ${tm_file}"
;;
x86_64-*-*)
tm_file="i386/biarch64.h ${tm_file}"
if test "x$enable_cld" = xyes; then
tm_defines="${tm_defines} USE_IX86_CLD=1"
fi
+ tm_file="vxworks-dummy.h ${tm_file}"
;;
esac
@@ -975,6 +977,16 @@ hppa*64*-*-hpux11*)
;;
esac
gas=yes
+ case ${target} in
+ *-*-hpux11.[01]*)
+ use_gcc_stdint=provide
+ tm_file="${tm_file} hpux-stdint.h"
+ ;;
+ *-*-hpux11.[23]*)
+ use_gcc_stdint=wrap
+ tm_file="${tm_file} hpux-stdint.h"
+ ;;
+ esac
;;
hppa[12]*-*-hpux11*)
case ${target} in
@@ -1005,6 +1017,16 @@ hppa[12]*-*-hpux11*)
esac
use_collect2=yes
gas=yes
+ case ${target} in
+ *-*-hpux11.[01]*)
+ use_gcc_stdint=provide
+ tm_file="${tm_file} hpux-stdint.h"
+ ;;
+ *-*-hpux11.[23]*)
+ use_gcc_stdint=wrap
+ tm_file="${tm_file} hpux-stdint.h"
+ ;;
+ esac
;;
i[34567]86-*-darwin*)
need_64bit_hwint=yes
@@ -1360,6 +1382,8 @@ ia64*-*-hpux*)
c_target_objs="ia64-c.o"
cxx_target_objs="ia64-c.o"
extra_options="${extra_options} ia64/ilp32.opt"
+ use_gcc_stdint=wrap
+ tm_file="${tm_file} hpux-stdint.h"
;;
iq2000*-*-elf*)
tm_file="svr4.h elfos.h newlib-stdint.h iq2000/iq2000.h"
@@ -1795,7 +1819,7 @@ powerpc-*-eabialtivec*)
powerpc-xilinx-eabi*)
tm_file="${tm_file} dbxelf.h elfos.h usegas.h svr4.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/singlefp.h rs6000/xfpu.h rs6000/xilinx.h"
extra_options="${extra_options} rs6000/sysv4.opt"
- tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
+ tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm rs6000/t-xilinx"
use_gcc_stdint=wrap
;;
powerpc-*-eabi*)
@@ -2446,6 +2470,8 @@ i[34567]86-*-linux* | x86_64-*-linux*)
i[34567]86-*-* | x86_64-*-*)
tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
;;
+powerpc*-*-* | rs6000-*-*)
+ tm_file="${tm_file} rs6000/option-defaults.h"
esac
# Support for --with-cpu and related options (and a few unrelated options,
@@ -2908,12 +2934,20 @@ case "${target}" in
;;
powerpc*-*-* | rs6000-*-*)
- supported_defaults="cpu float tune"
+ supported_defaults="cpu cpu_32 cpu_64 float tune tune_32 tune_64"
- for which in cpu tune; do
+ for which in cpu cpu_32 cpu_64 tune tune_32 tune_64; do
eval "val=\$with_$which"
case ${val} in
default32 | default64)
+ case $which in
+ cpu | tune)
+ ;;
+ *)
+ echo "$val only valid for --with-cpu and --with-tune." 1>&2
+ exit 1
+ ;;
+ esac
with_which="with_$which"
eval $with_which=
;;
diff --git a/gcc/config.in b/gcc/config.in
index 9cbae32cd4d..76a7810f3d4 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -101,6 +101,12 @@
#endif
+/* Define if gcc should always pass --build-id to linker. */
+#ifndef USED_FOR_TARGET
+#undef ENABLE_LD_BUILDID
+#endif
+
+
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#ifndef USED_FOR_TARGET
@@ -1025,6 +1031,12 @@
#endif
+/* Define if your linker supports --build-id. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_LD_BUILDID
+#endif
+
+
/* Define if your linker supports --demangle option. */
#ifndef USED_FOR_TARGET
#undef HAVE_LD_DEMANGLE
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index bbbcd8f4f1a..66c68aebc91 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -39,7 +39,6 @@ extern rtx alpha_tablejump_best_label (rtx);
extern bool alpha_legitimate_constant_p (rtx);
extern bool alpha_legitimate_address_p (enum machine_mode, rtx, int);
-extern rtx alpha_legitimize_address (rtx, rtx, enum machine_mode);
extern rtx alpha_legitimize_reload_address (rtx, enum machine_mode,
int, int, int);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 931d0eac849..bb6542a37f9 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -275,10 +275,10 @@ override_options (void)
{ "ev6", PROCESSOR_EV6, MASK_BWX|MASK_MAX|MASK_FIX },
{ "21264", PROCESSOR_EV6, MASK_BWX|MASK_MAX|MASK_FIX },
{ "ev67", PROCESSOR_EV6, MASK_BWX|MASK_MAX|MASK_FIX|MASK_CIX },
- { "21264a", PROCESSOR_EV6, MASK_BWX|MASK_MAX|MASK_FIX|MASK_CIX },
- { 0, 0, 0 }
+ { "21264a", PROCESSOR_EV6, MASK_BWX|MASK_MAX|MASK_FIX|MASK_CIX }
};
+ int const ct_size = ARRAY_SIZE (cpu_table);
int i;
/* Unicos/Mk doesn't have shared libraries. */
@@ -370,7 +370,7 @@ override_options (void)
if (alpha_cpu_string)
{
- for (i = 0; cpu_table [i].name; i++)
+ for (i = 0; i < ct_size; i++)
if (! strcmp (alpha_cpu_string, cpu_table [i].name))
{
alpha_tune = alpha_cpu = cpu_table [i].processor;
@@ -378,19 +378,19 @@ override_options (void)
target_flags |= cpu_table [i].flags;
break;
}
- if (! cpu_table [i].name)
+ if (i == ct_size)
error ("bad value %qs for -mcpu switch", alpha_cpu_string);
}
if (alpha_tune_string)
{
- for (i = 0; cpu_table [i].name; i++)
+ for (i = 0; i < ct_size; i++)
if (! strcmp (alpha_tune_string, cpu_table [i].name))
{
alpha_tune = cpu_table [i].processor;
break;
}
- if (! cpu_table [i].name)
+ if (i == ct_size)
error ("bad value %qs for -mcpu switch", alpha_tune_string);
}
@@ -709,7 +709,7 @@ tls_symbolic_operand_type (rtx symbol)
enum tls_model model;
if (GET_CODE (symbol) != SYMBOL_REF)
- return 0;
+ return TLS_MODEL_NONE;
model = SYMBOL_REF_TLS_MODEL (symbol);
/* Local-exec with a 64-bit size is the same code as initial-exec. */
@@ -917,8 +917,8 @@ get_tls_get_addr (void)
/* Try machine-dependent ways of modifying an illegitimate address
to be legitimate. If we find one, return the new, valid address. */
-rtx
-alpha_legitimize_address (rtx x, rtx scratch, enum machine_mode mode)
+static rtx
+alpha_legitimize_address_1 (rtx x, rtx scratch, enum machine_mode mode)
{
HOST_WIDE_INT addend;
@@ -1112,6 +1112,18 @@ alpha_legitimize_address (rtx x, rtx scratch, enum machine_mode mode)
}
}
+
+/* Try machine-dependent ways of modifying an illegitimate address
+ to be legitimate. Return X or the new, valid address. */
+
+static rtx
+alpha_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
+{
+ rtx new_x = alpha_legitimize_address_1 (x, NULL_RTX, mode);
+ return new_x ? new_x : x;
+}
+
/* Primarily this is required for TLS symbols, but given that our move
patterns *ought* to be able to handle any symbol at any time, we
should never be spilling symbolic operands to the constant pool, ever. */
@@ -2137,7 +2149,7 @@ alpha_expand_mov (enum machine_mode mode, rtx *operands)
/* Allow legitimize_address to perform some simplifications. */
if (mode == Pmode && symbolic_operand (operands[1], mode))
{
- tmp = alpha_legitimize_address (operands[1], operands[0], mode);
+ tmp = alpha_legitimize_address_1 (operands[1], operands[0], mode);
if (tmp)
{
if (tmp == operands[0])
@@ -10725,6 +10737,9 @@ alpha_init_libfuncs (void)
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS alpha_init_libfuncs
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS alpha_legitimize_address
+
#if TARGET_ABI_UNICOSMK
#undef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START unicosmk_file_start
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 4df364071ba..f33e8e63854 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -475,12 +475,6 @@ extern enum alpha_fp_trap_mode alpha_fptm;
/* 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
@@ -1015,20 +1009,6 @@ do { \
} while (0)
#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. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-do { \
- rtx new_x = alpha_legitimize_address (X, NULL_RTX, MODE); \
- if (new_x) \
- { \
- X = new_x; \
- goto WIN; \
- } \
-} while (0)
-
/* 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. */
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index 486551a9aee..543ed533080 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -169,7 +169,7 @@
(cond [(eq_attr "type" "ldsym,jsr")
(const_string "yes")
(eq_attr "type" "ild,fld,ist,fst")
- (symbol_ref "alpha_find_lo_sum_using_gp(insn)")
+ (symbol_ref "((enum attr_usegp) alpha_find_lo_sum_using_gp (insn))")
]
(const_string "no")))
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index 0e5265c6472..24ab5f66b8c 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler, for DEC Alpha w/ELF.
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
Contributed by Richard Henderson (rth@tamu.edu).
This file is part of GCC.
@@ -142,18 +142,20 @@ do { \
ASM_OUTPUT_ALIGNED_LOCAL (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'.
+/* The biggest alignment supported by ELF in bits. 32-bit ELF
+ supports section alignment up to (0x80000000 * 8), while
+ 64-bit ELF supports (0x8000000000000000 * 8). If this macro
+ is not defined, the default is the largest alignment supported
+ by 32-bit ELF and representable on a 32-bit host. Use this
+ macro to limit the alignment which can be specified using
+ the `__attribute__ ((aligned (N)))' construct.
This value is really 2^63. Since gcc figures the alignment in bits,
we could only potentially get to 2^60 on suitable hosts. Due to other
considerations in varasm, we must restrict this to what fits in an int. */
#undef MAX_OFILE_ALIGNMENT
-#define MAX_OFILE_ALIGNMENT \
- (1 << (HOST_BITS_PER_INT < 64 ? HOST_BITS_PER_INT - 2 : 62))
+#define MAX_OFILE_ALIGNMENT (((unsigned int) 1 << 28) * 8)
/* This is the pseudo-op used to generate a contiguous sequence of byte
values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
diff --git a/gcc/config/arm/arm-cores.def b/gcc/config/arm/arm-cores.def
index fba42127225..4a2e6714687 100644
--- a/gcc/config/arm/arm-cores.def
+++ b/gcc/config/arm/arm-cores.def
@@ -117,6 +117,7 @@ ARM_CORE("arm1176jzf-s", arm1176jzfs, 6ZK, FL_LDSCHED | FL_VFPV2, 9e)
ARM_CORE("mpcorenovfp", mpcorenovfp, 6K, FL_LDSCHED, 9e)
ARM_CORE("mpcore", mpcore, 6K, FL_LDSCHED | FL_VFPV2, 9e)
ARM_CORE("arm1156t2-s", arm1156t2s, 6T2, FL_LDSCHED, 9e)
+ARM_CORE("arm1156t2f-s", arm1156t2fs, 6T2, FL_LDSCHED | FL_VFPV2, 9e)
ARM_CORE("cortex-a8", cortexa8, 7A, FL_LDSCHED, 9e)
ARM_CORE("cortex-a9", cortexa9, 7A, FL_LDSCHED, 9e)
ARM_CORE("cortex-r4", cortexr4, 7R, FL_LDSCHED, 9e)
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 6019dc697df..34d266b139b 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -58,8 +58,6 @@ extern int arm_legitimate_address_p (enum machine_mode, rtx, RTX_CODE, int);
extern int thumb1_legitimate_address_p (enum machine_mode, rtx, int);
extern int thumb2_legitimate_address_p (enum machine_mode, rtx, int);
extern int thumb_legitimate_offset_p (enum machine_mode, HOST_WIDE_INT);
-extern rtx arm_legitimize_address (rtx, rtx, enum machine_mode);
-extern rtx thumb_legitimize_address (rtx, rtx, enum machine_mode);
extern rtx thumb_legitimize_reload_address (rtx *, enum machine_mode, int, int,
int);
extern int arm_const_double_rtx (rtx);
diff --git a/gcc/config/arm/arm-tune.md b/gcc/config/arm/arm-tune.md
index 4d8ae2f11bc..e3000e76ab6 100644
--- a/gcc/config/arm/arm-tune.md
+++ b/gcc/config/arm/arm-tune.md
@@ -1,5 +1,5 @@
;; -*- buffer-read-only: t -*-
;; Generated automatically by gentune.sh from arm-cores.def
(define_attr "tune"
- "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1"
+ "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm3,cortexm1"
(const (symbol_ref "((enum attr_tune) arm_tune)")))
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 13f209a3a87..e6d2c5c67dc 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -73,6 +73,8 @@ static int arm_address_register_rtx_p (rtx, int);
static int arm_legitimate_index_p (enum machine_mode, rtx, RTX_CODE, int);
static int thumb2_legitimate_index_p (enum machine_mode, rtx, int);
static int thumb1_base_register_rtx_p (rtx, enum machine_mode, int);
+static rtx arm_legitimize_address (rtx, rtx, enum machine_mode);
+static rtx thumb_legitimize_address (rtx, rtx, enum machine_mode);
inline static int thumb1_index_register_rtx_p (rtx, int);
static int thumb_far_jump_used_p (void);
static bool thumb_force_lr_save (void);
@@ -205,6 +207,9 @@ static bool arm_allocate_stack_slots_for_args (void);
#define TARGET_MERGE_DECL_ATTRIBUTES merge_dllimport_decl_attributes
#endif
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS arm_legitimize_address
+
#undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE arm_attribute_table
@@ -1504,6 +1509,10 @@ arm_override_options (void)
if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
sorry ("-mfloat-abi=hard and VFP");
+ if (TARGET_AAPCS_BASED
+ && (arm_fp_model == ARM_FP_MODEL_FPA))
+ error ("FPA is unsupported in the AAPCS");
+
/* FPA and iWMMXt are incompatible because the insn encodings overlap.
VFP and iWMMXt can theoretically coexist, but it's unlikely such silicon
will ever exist. GCC makes no attempt to support this combination. */
@@ -3565,7 +3574,7 @@ require_pic_register (void)
/* Play games to avoid marking the function as needing pic
if we are being called as part of the cost-estimation
process. */
- if (current_ir_type () != IR_GIMPLE)
+ if (current_ir_type () != IR_GIMPLE || currently_expanding_to_rtl)
crtl->uses_pic_offset_table = 1;
}
else
@@ -3578,7 +3587,7 @@ require_pic_register (void)
/* Play games to avoid marking the function as needing pic
if we are being called as part of the cost-estimation
process. */
- if (current_ir_type () != IR_GIMPLE)
+ if (current_ir_type () != IR_GIMPLE || currently_expanding_to_rtl)
{
crtl->uses_pic_offset_table = 1;
start_sequence ();
@@ -4586,6 +4595,14 @@ legitimize_tls_address (rtx x, rtx reg)
rtx
arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode)
{
+ if (!TARGET_ARM)
+ {
+ /* TODO: legitimize_address for Thumb2. */
+ if (TARGET_THUMB2)
+ return x;
+ return thumb_legitimize_address (x, orig_x, mode);
+ }
+
if (arm_tls_symbol_p (x))
return legitimize_tls_address (x, NULL_RTX);
@@ -14027,7 +14044,7 @@ static enum arm_cond_code
get_arm_condition_code (rtx comparison)
{
enum machine_mode mode = GET_MODE (XEXP (comparison, 0));
- int code;
+ enum arm_cond_code code;
enum rtx_code comp_code = GET_CODE (comparison);
if (GET_MODE_CLASS (mode) != MODE_CC)
@@ -14824,7 +14841,7 @@ static const struct builtin_description bdesc_2arg[] =
{
#define IWMMXT_BUILTIN(code, string, builtin) \
{ FL_IWMMXT, CODE_FOR_##code, "__builtin_arm_" string, \
- ARM_BUILTIN_##builtin, 0, 0 },
+ ARM_BUILTIN_##builtin, UNKNOWN, 0 },
IWMMXT_BUILTIN (addv8qi3, "waddb", WADDB)
IWMMXT_BUILTIN (addv4hi3, "waddh", WADDH)
@@ -14886,7 +14903,7 @@ static const struct builtin_description bdesc_2arg[] =
IWMMXT_BUILTIN (iwmmxt_wmaddu, "wmaddu", WMADDU)
#define IWMMXT_BUILTIN2(code, builtin) \
- { FL_IWMMXT, CODE_FOR_##code, NULL, ARM_BUILTIN_##builtin, 0, 0 },
+ { FL_IWMMXT, CODE_FOR_##code, NULL, ARM_BUILTIN_##builtin, UNKNOWN, 0 },
IWMMXT_BUILTIN2 (iwmmxt_wpackhss, WPACKHSS)
IWMMXT_BUILTIN2 (iwmmxt_wpackwss, WPACKWSS)
@@ -15283,7 +15300,7 @@ arm_init_tls_builtins (void)
TREE_READONLY (decl) = 1;
}
-typedef enum {
+enum neon_builtin_type_bits {
T_V8QI = 0x0001,
T_V4HI = 0x0002,
T_V2SI = 0x0004,
@@ -15297,7 +15314,7 @@ typedef enum {
T_TI = 0x0400,
T_EI = 0x0800,
T_OI = 0x1000
-} neon_builtin_type_bits;
+};
#define v8qi_UP T_V8QI
#define v4hi_UP T_V4HI
@@ -15360,7 +15377,7 @@ typedef enum {
typedef struct {
const char *name;
const neon_itype itype;
- const neon_builtin_type_bits bits;
+ const int bits;
const enum insn_code codes[T_MAX];
const unsigned int num_vars;
unsigned int base_fcode;
@@ -16277,7 +16294,7 @@ arm_expand_neon_args (rtx target, int icode, int have_retval,
for (;;)
{
- builtin_arg thisarg = va_arg (ap, int);
+ builtin_arg thisarg = (builtin_arg) va_arg (ap, int);
if (thisarg == NEON_ARG_STOP)
break;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 93d75bb74a3..e7bc7a7a2d5 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -537,7 +537,7 @@ extern int arm_arch_hwdiv;
#define PREFERRED_STACK_BOUNDARY \
(arm_abi == ARM_ABI_ATPCS ? 64 : STACK_BOUNDARY)
-#define FUNCTION_BOUNDARY 32
+#define FUNCTION_BOUNDARY ((TARGET_THUMB && optimize_size) ? 16 : 32)
/* The lowest bit is used to indicate Thumb-mode functions, so the
vbit must go into the delta field of pointers to member
@@ -2204,36 +2204,6 @@ typedef struct
THUMB1_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN)
-/* Try machine-dependent ways of modifying an illegitimate address
- to be legitimate. If we find one, return the new, valid address. */
-#define ARM_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-do { \
- X = arm_legitimize_address (X, OLDX, MODE); \
-} while (0)
-
-/* ??? Implement LEGITIMIZE_ADDRESS for thumb2. */
-#define THUMB2_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-do { \
-} while (0)
-
-#define THUMB1_LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-do { \
- X = thumb_legitimize_address (X, OLDX, MODE); \
-} while (0)
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-do { \
- if (TARGET_ARM) \
- ARM_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
- else if (TARGET_THUMB2) \
- THUMB2_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
- else \
- THUMB1_LEGITIMIZE_ADDRESS (X, OLDX, MODE, WIN); \
- \
- if (memory_address_p (MODE, X)) \
- goto WIN; \
-} while (0)
-
/* Define this for compatibility reasons. */
#define HANDLE_PRAGMA_PACK_PUSH_POP
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 2df4a16d1cf..44246901b32 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -30,11 +30,12 @@ extern int avr_ret_register (void);
extern enum reg_class class_likely_spilled_p (int c);
extern enum reg_class avr_regno_reg_class (int r);
extern enum reg_class avr_reg_class_from_letter (int c);
-extern int frame_pointer_required_p (void);
+extern bool avr_frame_pointer_required_p (void);
extern void asm_globalize_label (FILE *file, const char *name);
extern void avr_asm_declare_function_name (FILE *, const char *, tree);
extern void order_regs_for_local_alloc (void);
-extern int initial_elimination_offset (int from, int to);
+extern bool avr_can_eliminate (int, int);
+extern int avr_initial_elimination_offset (int from, int to);
extern int avr_simple_epilogue (void);
extern void gas_output_limited_string (FILE *file, const char *str);
extern void gas_output_ascii (FILE *file, const char *str, size_t length);
@@ -97,7 +98,6 @@ extern const char *avr_out_sbxx_branch (rtx insn, rtx operands[]);
extern enum reg_class preferred_reload_class (rtx x, enum reg_class rclass);
extern int extra_constraint_Q (rtx x);
-extern rtx legitimize_address (rtx x, rtx oldx, enum machine_mode mode);
extern int adjust_insn_length (rtx insn, int len);
extern rtx avr_libcall_value (enum machine_mode mode);
extern const char *output_reload_inhi (rtx insn, rtx *operands, int *len);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 40835c70f51..449c0ee4f89 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -62,6 +62,7 @@ static const char *cond_string (enum rtx_code);
static int avr_num_arg_regs (enum machine_mode, tree);
static RTX_CODE compare_condition (rtx insn);
+static rtx avr_legitimize_address (rtx, rtx, enum machine_mode);
static int compare_sign_p (rtx insn);
static tree avr_handle_progmem_attribute (tree *, tree, tree, int, bool *);
static tree avr_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
@@ -349,6 +350,9 @@ static const struct mcu_type_s avr_mcu_types[] = {
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG avr_reorg
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS avr_legitimize_address
+
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY avr_return_in_memory
@@ -545,10 +549,21 @@ avr_regs_to_save (HARD_REG_SET *set)
return count;
}
+/* Return true if register FROM can be eliminated via register TO. */
+
+bool
+avr_can_eliminate (int from, int to)
+{
+ return ((from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
+ || ((from == FRAME_POINTER_REGNUM
+ || from == FRAME_POINTER_REGNUM + 1)
+ && !frame_pointer_needed));
+}
+
/* Compute offset between arg_pointer and frame_pointer. */
int
-initial_elimination_offset (int from, int to)
+avr_initial_elimination_offset (int from, int to)
{
if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
return 0;
@@ -1153,7 +1168,7 @@ legitimate_address_p (enum machine_mode mode, rtx x, int strict)
memory address for an operand of mode MODE */
rtx
-legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
+avr_legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
{
x = oldx;
if (TARGET_ALL_DEBUG)
@@ -2843,8 +2858,8 @@ out_movhi_mr_r (rtx insn, rtx op[], int *l)
/* Return 1 if frame pointer for current function required. */
-int
-frame_pointer_required_p (void)
+bool
+avr_frame_pointer_required_p (void)
{
return (cfun->calls_alloca
|| crtl->args.info.nregs == 0
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 5d50827144b..79d81b94923 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -350,7 +350,7 @@ enum reg_class {
#define STATIC_CHAIN_REGNUM 2
-#define FRAME_POINTER_REQUIRED frame_pointer_required_p()
+#define FRAME_POINTER_REQUIRED avr_frame_pointer_required_p()
/* Offset from the frame pointer register value to the top of the stack. */
#define FRAME_POINTER_CFA_OFFSET(FNDECL) 0
@@ -360,15 +360,10 @@ enum reg_class {
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM} \
,{FRAME_POINTER_REGNUM+1,STACK_POINTER_REGNUM+1}}
-#define CAN_ELIMINATE(FROM, TO) (((FROM) == ARG_POINTER_REGNUM \
- && (TO) == FRAME_POINTER_REGNUM) \
- || (((FROM) == FRAME_POINTER_REGNUM \
- || (FROM) == FRAME_POINTER_REGNUM+1) \
- && ! FRAME_POINTER_REQUIRED \
- ))
+#define CAN_ELIMINATE(FROM, TO) avr_can_eliminate (FROM, TO)
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
- OFFSET = initial_elimination_offset (FROM, TO)
+ OFFSET = avr_initial_elimination_offset (FROM, TO)
#define RETURN_ADDR_RTX(count, x) \
gen_rtx_MEM (Pmode, memory_address (Pmode, plus_constant (tem, 1)))
@@ -440,13 +435,6 @@ extern int avr_reg_order[];
#define REG_OK_FOR_INDEX_P(X) 0
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ \
- (X) = legitimize_address (X, OLDX, MODE); \
- if (memory_address_p (MODE, X)) \
- goto WIN; \
-}
-
#define XEXP_(X,Y) (X)
/* LEGITIMIZE_RELOAD_ADDRESS will allow register R26/27 to be used, where it
diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h
index 3e9ae4317c3..33de846da95 100644
--- a/gcc/config/bfin/bfin-protos.h
+++ b/gcc/config/bfin/bfin-protos.h
@@ -80,18 +80,23 @@ extern unsigned int bfin_workarounds;
#define ENABLE_WA_INDIRECT_CALLS \
((bfin_workarounds & WA_INDIRECT_CALLS) && !TARGET_ICPLB)
-#define WA_05000257 0x00000040
+#define WA_05000257 0x00000010
#define ENABLE_WA_05000257 \
(bfin_workarounds & WA_05000257)
-#define WA_05000283 0x00000010
+#define WA_05000283 0x00000020
#define ENABLE_WA_05000283 \
(bfin_workarounds & WA_05000283)
-#define WA_05000315 0x00000020
+#define WA_05000315 0x00000040
#define ENABLE_WA_05000315 \
(bfin_workarounds & WA_05000315)
+/* For the anomaly 05-00-0312 */
+#define WA_LOAD_LCREGS 0x00000080
+#define ENABLE_WA_LOAD_LCREGS \
+ (bfin_workarounds & WA_LOAD_LCREGS)
+
#define Mmode enum machine_mode
extern rtx function_arg (CUMULATIVE_ARGS *, Mmode, tree, int);
@@ -104,7 +109,6 @@ extern char *bfin_asm_long (void);
extern char *bfin_asm_short (void);
extern int log2constp (unsigned HOST_WIDE_INT);
-extern rtx legitimize_address (rtx, rtx, Mmode);
extern bool bfin_legitimate_constant_p (rtx);
extern int hard_regno_mode_ok (int, Mmode);
extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index adb72b077a8..17201c652e1 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -173,134 +173,135 @@ struct bfin_cpu bfin_cpus[] =
WA_SPECULATIVE_LOADS | WA_RETS},
{"bf531", BFIN_CPU_BF531, 0x0006,
- WA_SPECULATIVE_LOADS},
+ WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS},
{"bf531", BFIN_CPU_BF531, 0x0005,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS},
{"bf531", BFIN_CPU_BF531, 0x0004,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf531", BFIN_CPU_BF531, 0x0003,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf532", BFIN_CPU_BF532, 0x0006,
- WA_SPECULATIVE_LOADS},
+ WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS},
{"bf532", BFIN_CPU_BF532, 0x0005,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS},
{"bf532", BFIN_CPU_BF532, 0x0004,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf532", BFIN_CPU_BF532, 0x0003,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf533", BFIN_CPU_BF533, 0x0006,
- WA_SPECULATIVE_LOADS},
+ WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS},
{"bf533", BFIN_CPU_BF533, 0x0005,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS},
{"bf533", BFIN_CPU_BF533, 0x0004,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf533", BFIN_CPU_BF533, 0x0003,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf534", BFIN_CPU_BF534, 0x0003,
- WA_SPECULATIVE_LOADS | WA_RETS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS},
{"bf534", BFIN_CPU_BF534, 0x0002,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf534", BFIN_CPU_BF534, 0x0001,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf536", BFIN_CPU_BF536, 0x0003,
- WA_SPECULATIVE_LOADS | WA_RETS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS},
{"bf536", BFIN_CPU_BF536, 0x0002,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf536", BFIN_CPU_BF536, 0x0001,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf537", BFIN_CPU_BF537, 0x0003,
- WA_SPECULATIVE_LOADS | WA_RETS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS},
{"bf537", BFIN_CPU_BF537, 0x0002,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf537", BFIN_CPU_BF537, 0x0001,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf538", BFIN_CPU_BF538, 0x0005,
- WA_SPECULATIVE_LOADS},
+ WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS},
{"bf538", BFIN_CPU_BF538, 0x0004,
- WA_SPECULATIVE_LOADS | WA_RETS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS},
{"bf538", BFIN_CPU_BF538, 0x0003,
WA_SPECULATIVE_LOADS | WA_RETS
- | WA_05000283 | WA_05000315},
+ | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS},
{"bf538", BFIN_CPU_BF538, 0x0002,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_05000283 | WA_05000257 | WA_05000315},
+ WA_SPECULATIVE_LOADS | WA_RETS
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf539", BFIN_CPU_BF539, 0x0005,
- WA_SPECULATIVE_LOADS},
+ WA_SPECULATIVE_LOADS | WA_LOAD_LCREGS},
{"bf539", BFIN_CPU_BF539, 0x0004,
- WA_SPECULATIVE_LOADS | WA_RETS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_LOAD_LCREGS},
{"bf539", BFIN_CPU_BF539, 0x0003,
WA_SPECULATIVE_LOADS | WA_RETS
- | WA_05000283 | WA_05000315},
+ | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS},
{"bf539", BFIN_CPU_BF539, 0x0002,
WA_SPECULATIVE_LOADS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf542", BFIN_CPU_BF542, 0x0002,
WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS},
{"bf542", BFIN_CPU_BF542, 0x0001,
WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
{"bf542", BFIN_CPU_BF542, 0x0000,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS},
{"bf544", BFIN_CPU_BF544, 0x0002,
WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS},
{"bf544", BFIN_CPU_BF544, 0x0001,
WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
{"bf544", BFIN_CPU_BF544, 0x0000,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS},
{"bf547", BFIN_CPU_BF547, 0x0002,
WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS},
{"bf547", BFIN_CPU_BF547, 0x0001,
WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
{"bf547", BFIN_CPU_BF547, 0x0000,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS},
{"bf548", BFIN_CPU_BF548, 0x0002,
WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS},
{"bf548", BFIN_CPU_BF548, 0x0001,
WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
{"bf548", BFIN_CPU_BF548, 0x0000,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS},
{"bf549", BFIN_CPU_BF549, 0x0002,
WA_SPECULATIVE_LOADS | WA_INDIRECT_CALLS},
{"bf549", BFIN_CPU_BF549, 0x0001,
WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
{"bf549", BFIN_CPU_BF549, 0x0000,
- WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS},
+ WA_SPECULATIVE_LOADS | WA_RETS | WA_INDIRECT_CALLS | WA_LOAD_LCREGS},
{"bf561", BFIN_CPU_BF561, 0x0005, WA_RETS
- | WA_05000283 | WA_05000315},
+ | WA_05000283 | WA_05000315 | WA_LOAD_LCREGS},
{"bf561", BFIN_CPU_BF561, 0x0003,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{"bf561", BFIN_CPU_BF561, 0x0002,
WA_SPECULATIVE_LOADS | WA_SPECULATIVE_SYNCS | WA_RETS
- | WA_05000283 | WA_05000257 | WA_05000315},
+ | WA_05000283 | WA_05000257 | WA_05000315 | WA_LOAD_LCREGS},
{NULL, 0, 0, 0}
};
-int splitting_for_sched;
+int splitting_for_sched, splitting_loops;
static void
bfin_globalize_label (FILE *stream, const char *name)
@@ -1417,22 +1418,6 @@ bfin_return_addr_rtx (int count)
return get_hard_reg_initial_val (Pmode, REG_RETS);
}
-/* Try machine-dependent ways of modifying an illegitimate address X
- to be legitimate. If we find one, return the new, valid address,
- otherwise return NULL_RTX.
-
- 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 is the mode of the memory reference. */
-
-rtx
-legitimize_address (rtx x ATTRIBUTE_UNUSED, rtx oldx ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED)
-{
- return NULL_RTX;
-}
-
static rtx
bfin_delegitimize_address (rtx orig_x)
{
@@ -2331,20 +2316,14 @@ bfin_register_move_cost (enum machine_mode mode,
enum reg_class class1, enum reg_class class2)
{
/* These need secondary reloads, so they're more expensive. */
- if ((class1 == CCREGS && class2 != DREGS)
- || (class1 != DREGS && class2 == CCREGS))
+ if ((class1 == CCREGS && !reg_class_subset_p (class2, DREGS))
+ || (class2 == CCREGS && !reg_class_subset_p (class1, DREGS)))
return 4;
/* If optimizing for size, always prefer reg-reg over reg-memory moves. */
if (optimize_size)
return 2;
- /* There are some stalls involved when moving from a DREG to a different
- class reg, and using the value in one of the following instructions.
- Attempt to model this by slightly discouraging such moves. */
- if (class1 == DREGS && class2 != DREGS)
- return 2 * 2;
-
if (GET_MODE_CLASS (mode) == MODE_INT)
{
/* Discourage trying to use the accumulators. */
@@ -3646,12 +3625,6 @@ struct GTY (()) loop_info
/* The iteration register. */
rtx iter_reg;
- /* The new initialization insn. */
- rtx init;
-
- /* The new initialization instruction. */
- rtx loop_init;
-
/* The new label placed at the beginning of the loop. */
rtx start_label;
@@ -3792,10 +3765,10 @@ bfin_optimize_loop (loop_info loop)
{
basic_block bb;
loop_info inner;
- rtx insn, init_insn, last_insn, nop_insn;
+ rtx insn, last_insn;
rtx loop_init, start_label, end_label;
rtx reg_lc0, reg_lc1, reg_lt0, reg_lt1, reg_lb0, reg_lb1;
- rtx iter_reg;
+ rtx iter_reg, scratchreg, scratch_init, scratch_init_insn;
rtx lc_reg, lt_reg, lb_reg;
rtx seq, seq_end;
int length;
@@ -3841,13 +3814,49 @@ bfin_optimize_loop (loop_info loop)
/* Get the loop iteration register. */
iter_reg = loop->iter_reg;
- if (!DPREG_P (iter_reg))
+ if (!REG_P (iter_reg))
{
if (dump_file)
- fprintf (dump_file, ";; loop %d iteration count NOT in PREG or DREG\n",
+ fprintf (dump_file, ";; loop %d iteration count not in a register\n",
loop->loop_no);
goto bad_loop;
}
+ scratchreg = NULL_RTX;
+ scratch_init = iter_reg;
+ scratch_init_insn = NULL_RTX;
+ if (!PREG_P (iter_reg) && loop->incoming_src)
+ {
+ basic_block bb_in = loop->incoming_src;
+ int i;
+ for (i = REG_P0; i <= REG_P5; i++)
+ if ((df_regs_ever_live_p (i)
+ || (funkind (TREE_TYPE (current_function_decl)) == SUBROUTINE
+ && call_used_regs[i]))
+ && !REGNO_REG_SET_P (df_get_live_out (bb_in), i))
+ {
+ scratchreg = gen_rtx_REG (SImode, i);
+ break;
+ }
+ for (insn = BB_END (bb_in); insn != BB_HEAD (bb_in);
+ insn = PREV_INSN (insn))
+ {
+ rtx set;
+ if (NOTE_P (insn) || BARRIER_P (insn))
+ continue;
+ set = single_set (insn);
+ if (set && rtx_equal_p (SET_DEST (set), iter_reg))
+ {
+ if (CONSTANT_P (SET_SRC (set)))
+ {
+ scratch_init = SET_SRC (set);
+ scratch_init_insn = insn;
+ }
+ break;
+ }
+ else if (reg_mentioned_p (iter_reg, PATTERN (insn)))
+ break;
+ }
+ }
if (loop->incoming_src)
{
@@ -3866,7 +3875,7 @@ bfin_optimize_loop (loop_info loop)
for (; insn && insn != loop->start_label; insn = NEXT_INSN (insn))
length += length_for_loop (insn);
-
+
if (!insn)
{
if (dump_file)
@@ -3875,6 +3884,11 @@ bfin_optimize_loop (loop_info loop)
goto bad_loop;
}
+ /* Account for the pop of a scratch register where necessary. */
+ if (!PREG_P (iter_reg) && scratchreg == NULL_RTX
+ && ENABLE_WA_LOAD_LCREGS)
+ length += 2;
+
if (length > MAX_LSETUP_DISTANCE)
{
if (dump_file)
@@ -3982,6 +3996,7 @@ bfin_optimize_loop (loop_info loop)
break;
if (single_pred_p (bb)
+ && single_pred_edge (bb)->flags & EDGE_FALLTHRU
&& single_pred (bb) != ENTRY_BLOCK_PTR)
{
bb = single_pred (bb);
@@ -4003,42 +4018,34 @@ bfin_optimize_loop (loop_info loop)
goto bad_loop;
}
- if (JUMP_P (last_insn))
+ if (JUMP_P (last_insn) && !any_condjump_p (last_insn))
{
- loop_info inner = (loop_info) bb->aux;
- if (inner
- && inner->outer == loop
- && inner->loop_end == last_insn
- && inner->depth == 1)
- /* This jump_insn is the exact loop_end of an inner loop
- and to be optimized away. So use the inner's last_insn. */
- last_insn = inner->last_insn;
- else
+ if (dump_file)
+ fprintf (dump_file, ";; loop %d has bad last instruction\n",
+ loop->loop_no);
+ goto bad_loop;
+ }
+ /* In all other cases, try to replace a bad last insn with a nop. */
+ else if (JUMP_P (last_insn)
+ || CALL_P (last_insn)
+ || get_attr_type (last_insn) == TYPE_SYNC
+ || get_attr_type (last_insn) == TYPE_CALL
+ || get_attr_seq_insns (last_insn) == SEQ_INSNS_MULTI
+ || recog_memoized (last_insn) == CODE_FOR_return_internal
+ || GET_CODE (PATTERN (last_insn)) == ASM_INPUT
+ || asm_noperands (PATTERN (last_insn)) >= 0)
+ {
+ if (loop->length + 2 > MAX_LOOP_LENGTH)
{
if (dump_file)
- fprintf (dump_file, ";; loop %d has bad last instruction\n",
- loop->loop_no);
+ fprintf (dump_file, ";; loop %d too long\n", loop->loop_no);
goto bad_loop;
}
- }
- else if (CALL_P (last_insn)
- || (GET_CODE (PATTERN (last_insn)) != SEQUENCE
- && get_attr_type (last_insn) == TYPE_SYNC)
- || recog_memoized (last_insn) == CODE_FOR_return_internal)
- {
if (dump_file)
- fprintf (dump_file, ";; loop %d has bad last instruction\n",
+ fprintf (dump_file, ";; loop %d has bad last insn; replace with nop\n",
loop->loop_no);
- goto bad_loop;
- }
- if (GET_CODE (PATTERN (last_insn)) == ASM_INPUT
- || asm_noperands (PATTERN (last_insn)) >= 0
- || (GET_CODE (PATTERN (last_insn)) != SEQUENCE
- && get_attr_seq_insns (last_insn) == SEQ_INSNS_MULTI))
- {
- nop_insn = emit_insn_after (gen_nop (), last_insn);
- last_insn = nop_insn;
+ last_insn = emit_insn_after (gen_forced_nop (), last_insn);
}
loop->last_insn = last_insn;
@@ -4063,46 +4070,71 @@ bfin_optimize_loop (loop_info loop)
loop->clobber_loop0 = 1;
}
- /* If iter_reg is a DREG, we need generate an instruction to load
- the loop count into LC register. */
- if (D_REGNO_P (REGNO (iter_reg)))
+ loop->end_label = end_label;
+
+ /* Create a sequence containing the loop setup. */
+ start_sequence ();
+
+ /* LSETUP only accepts P registers. If we have one, we can use it,
+ otherwise there are several ways of working around the problem.
+ If we're not affected by anomaly 312, we can load the LC register
+ from any iteration register, and use LSETUP without initialization.
+ If we've found a P scratch register that's not live here, we can
+ instead copy the iter_reg into that and use an initializing LSETUP.
+ If all else fails, push and pop P0 and use it as a scratch. */
+ if (P_REGNO_P (REGNO (iter_reg)))
+ {
+ loop_init = gen_lsetup_with_autoinit (lt_reg, start_label,
+ lb_reg, end_label,
+ lc_reg, iter_reg);
+ seq_end = emit_insn (loop_init);
+ }
+ else if (!ENABLE_WA_LOAD_LCREGS && DPREG_P (iter_reg))
{
- init_insn = gen_movsi (lc_reg, iter_reg);
+ emit_insn (gen_movsi (lc_reg, iter_reg));
loop_init = gen_lsetup_without_autoinit (lt_reg, start_label,
lb_reg, end_label,
lc_reg);
+ seq_end = emit_insn (loop_init);
}
- else if (P_REGNO_P (REGNO (iter_reg)))
+ else if (scratchreg != NULL_RTX)
{
- init_insn = NULL_RTX;
+ emit_insn (gen_movsi (scratchreg, scratch_init));
loop_init = gen_lsetup_with_autoinit (lt_reg, start_label,
lb_reg, end_label,
- lc_reg, iter_reg);
+ lc_reg, scratchreg);
+ seq_end = emit_insn (loop_init);
+ if (scratch_init_insn != NULL_RTX)
+ delete_insn (scratch_init_insn);
}
else
- gcc_unreachable ();
-
- loop->init = init_insn;
- loop->end_label = end_label;
- loop->loop_init = loop_init;
+ {
+ rtx p0reg = gen_rtx_REG (SImode, REG_P0);
+ rtx push = gen_frame_mem (SImode,
+ gen_rtx_PRE_DEC (SImode, stack_pointer_rtx));
+ rtx pop = gen_frame_mem (SImode,
+ gen_rtx_POST_INC (SImode, stack_pointer_rtx));
+ emit_insn (gen_movsi (push, p0reg));
+ emit_insn (gen_movsi (p0reg, scratch_init));
+ loop_init = gen_lsetup_with_autoinit (lt_reg, start_label,
+ lb_reg, end_label,
+ lc_reg, p0reg);
+ emit_insn (loop_init);
+ seq_end = emit_insn (gen_movsi (p0reg, pop));
+ if (scratch_init_insn != NULL_RTX)
+ delete_insn (scratch_init_insn);
+ }
if (dump_file)
{
fprintf (dump_file, ";; replacing loop %d initializer with\n",
loop->loop_no);
- print_rtl_single (dump_file, loop->loop_init);
+ print_rtl_single (dump_file, loop_init);
fprintf (dump_file, ";; replacing loop %d terminator with\n",
loop->loop_no);
print_rtl_single (dump_file, loop->loop_end);
}
- /* Create a sequence containing the loop setup. */
- start_sequence ();
-
- if (loop->init != NULL_RTX)
- emit_insn (loop->init);
- seq_end = emit_insn (loop->loop_init);
-
/* If the loop isn't entered at the top, also create a jump to the entry
point. */
if (!loop->incoming_src && loop->head != loop->incoming_dest)
@@ -4120,7 +4152,7 @@ bfin_optimize_loop (loop_info loop)
seq_end = emit_insn (copy_rtx (PATTERN (last_insn)));
}
else
- seq_end = emit_insn (gen_jump (label));
+ seq_end = emit_jump_insn (gen_jump (label));
}
seq = get_insns ();
@@ -4169,7 +4201,7 @@ bfin_optimize_loop (loop_info loop)
redirect_edge_succ (e, new_bb);
}
}
-
+
delete_insn (loop->loop_end);
/* Insert the loop end label before the last instruction of the loop. */
emit_label_before (loop->end_label, loop->last_insn);
@@ -4230,7 +4262,6 @@ bfin_discover_loop (loop_info loop, basic_block tail_bb, rtx tail_insn)
loop->outer = NULL;
loop->loops = NULL;
loop->incoming = VEC_alloc (edge, gc, 2);
- loop->init = loop->loop_init = NULL_RTX;
loop->start_label = XEXP (XEXP (SET_SRC (XVECEXP (PATTERN (tail_insn), 0, 0)), 1), 0);
loop->end_label = NULL_RTX;
loop->bad = 0;
@@ -4604,7 +4635,7 @@ bfin_reorg_loops (FILE *dump_file)
fprintf (dump_file, ";; All loops found:\n\n");
bfin_dump_loops (loops);
}
-
+
/* Now apply the optimizations. */
for (loop = loops; loop; loop = loop->next)
bfin_optimize_loop (loop);
@@ -4622,6 +4653,17 @@ bfin_reorg_loops (FILE *dump_file)
FOR_EACH_BB (bb)
bb->aux = NULL;
+
+ splitting_loops = 1;
+ FOR_EACH_BB (bb)
+ {
+ rtx insn = BB_END (bb);
+ if (!JUMP_P (insn))
+ continue;
+
+ try_split (PATTERN (insn), insn, 1);
+ }
+ splitting_loops = 0;
}
/* Possibly generate a SEQUENCE out of three insns found in SLOT.
@@ -6169,15 +6211,14 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
emit_insn (gen_flag_mulv2hi (tmp1, op0, op0, GEN_INT (MACFLAG_NONE)));
- emit_insn (gen_flag_mulhi_parts (tmp2, op0, op0, const0_rtx,
+ emit_insn (gen_flag_mulhi_parts (gen_lowpart (HImode, tmp2), op0, op0,
const0_rtx, const1_rtx,
GEN_INT (MACFLAG_NONE)));
- emit_insn (gen_ssaddhi3_parts (target, tmp2, tmp2, const1_rtx,
- const0_rtx, const0_rtx));
-
- emit_insn (gen_sssubhi3_parts (target, tmp1, tmp1, const0_rtx,
- const0_rtx, const1_rtx));
+ emit_insn (gen_ssaddhi3_high_parts (target, tmp2, tmp2, tmp2, const0_rtx,
+ const0_rtx));
+ emit_insn (gen_sssubhi3_low_parts (target, target, tmp1, tmp1,
+ const0_rtx, const1_rtx));
return target;
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index c4f6771d619..d97fe8faaf4 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -948,25 +948,6 @@ typedef struct {
} while (0);
#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.
- */
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-do { \
- rtx _q = legitimize_address(X, OLDX, MODE); \
- if (_q) { X = _q; goto WIN; } \
-} while (0)
-
#define HAVE_POST_INCREMENT 1
#define HAVE_POST_DECREMENT 1
#define HAVE_PRE_DECREMENT 1
@@ -1322,7 +1303,7 @@ extern struct rtx_def *bfin_cc_rtx, *bfin_rets_rtx;
#define SIZE_ASM_OP "\t.size\t"
-extern int splitting_for_sched;
+extern int splitting_for_sched, splitting_loops;
#define PRINT_OPERAND_PUNCT_VALID_P(CHAR) ((CHAR) == '!')
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index 516a2052f78..4397b7a139a 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -532,20 +532,22 @@
;; with a PLUS. We generally require fewer secondary reloads this way.
(define_insn "*movsi_insn"
- [(set (match_operand:SI 0 "nonimmediate_operand" "=da,x*y,da,x,x,x,da,mr")
- (match_operand:SI 1 "general_operand" "da,x*y,xKs7,xKsh,xKuh,ix,mr,da"))]
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=da,x,da,y,da,x,x,x,da,mr")
+ (match_operand:SI 1 "general_operand" "da,x,y,da,xKs7,xKsh,xKuh,ix,mr,da"))]
"GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) == REG"
"@
%0 = %1;
%0 = %1;
+ %0 = %1;
+ %0 = %1;
%0 = %1 (X);
%0 = %1 (X);
%0 = %1 (Z);
#
%0 = %1%!
%0 = %1%!"
- [(set_attr "type" "move,move,mvi,mvi,mvi,*,mcld,mcst")
- (set_attr "length" "2,2,2,4,4,*,*,*")])
+ [(set_attr "type" "move,move,move,move,mvi,mvi,mvi,*,mcld,mcst")
+ (set_attr "length" "2,2,2,2,2,4,4,*,*,*")])
(define_insn "*movsi_insn32"
[(set (match_operand:SI 0 "register_operand" "=d,d")
@@ -1908,7 +1910,7 @@
(const_int -1)))
(unspec [(const_int 0)] UNSPEC_LSETUP_END)
(clobber (match_scratch:SI 2 "=&r"))]
- "reload_completed"
+ "splitting_loops"
[(set (match_dup 2) (match_dup 0))
(set (match_dup 2) (plus:SI (match_dup 2) (const_int -1)))
(set (match_dup 0) (match_dup 2))
@@ -2962,74 +2964,82 @@
;; Unusual arithmetic operations on 16-bit registers.
-(define_insn "ssaddhi3"
+(define_code_iterator sp_or_sm [ss_plus ss_minus])
+(define_code_attr spm_string [(ss_plus "+") (ss_minus "-")])
+(define_code_attr spm_name [(ss_plus "add") (ss_minus "sub")])
+
+(define_insn "ss<spm_name>hi3"
[(set (match_operand:HI 0 "register_operand" "=d")
- (ss_plus:HI (match_operand:HI 1 "register_operand" "d")
+ (sp_or_sm:HI (match_operand:HI 1 "register_operand" "d")
(match_operand:HI 2 "register_operand" "d")))]
""
- "%h0 = %h1 + %h2 (S)%!"
+ "%h0 = %h1 <spm_string> %h2 (S)%!"
[(set_attr "type" "dsp32")])
-(define_insn "ssaddhi3_parts"
- [(set (vec_select:HI
- (match_operand:V2HI 0 "register_operand" "d")
- (parallel [(match_operand 3 "const01_operand" "P0P1")]))
- (ss_plus:HI (vec_select:HI
- (match_operand:V2HI 1 "register_operand" "d")
- (parallel [(match_operand 4 "const01_operand" "P0P1")]))
- (vec_select:HI
- (match_operand:V2HI 2 "register_operand" "d")
- (parallel [(match_operand 5 "const01_operand" "P0P1")]))))]
- ""
+(define_insn "ss<spm_name>hi3_parts"
+ [(set (match_operand:HI 0 "register_operand" "=d")
+ (sp_or_sm:HI (vec_select:HI
+ (match_operand:V2HI 1 "register_operand" "d")
+ (parallel [(match_operand 3 "const01_operand" "P0P1")]))
+ (vec_select:HI
+ (match_operand:V2HI 2 "register_operand" "d")
+ (parallel [(match_operand 4 "const01_operand" "P0P1")]))))]
+ ""
{
const char *templates[] = {
- "%h0 = %h1 + %h2 (S)%!",
- "%d0 = %h1 + %h2 (S)%!",
- "%h0 = %d1 + %h2 (S)%!",
- "%d0 = %d1 + %h2 (S)%!",
- "%h0 = %h1 + %d2 (S)%!",
- "%d0 = %h1 + %d2 (S)%!",
- "%h0 = %d1 + %d2 (S)%!",
- "%d0 = %d1 + %d2 (S)%!" };
- int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
- + (INTVAL (operands[5]) << 2);
+ "%h0 = %h1 <spm_string> %h2 (S)%!",
+ "%h0 = %d1 <spm_string> %h2 (S)%!",
+ "%h0 = %h1 <spm_string> %d2 (S)%!",
+ "%h0 = %d1 <spm_string> %d2 (S)%!" };
+ int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
return templates[alt];
}
[(set_attr "type" "dsp32")])
-(define_insn "sssubhi3_parts"
- [(set (vec_select:HI
- (match_operand:V2HI 0 "register_operand" "d")
- (parallel [(match_operand 3 "const01_operand" "P0P1")]))
- (ss_minus:HI (vec_select:HI
- (match_operand:V2HI 1 "register_operand" "d")
- (parallel [(match_operand 4 "const01_operand" "P0P1")]))
- (vec_select:HI
- (match_operand:V2HI 2 "register_operand" "d")
- (parallel [(match_operand 5 "const01_operand" "P0P1")]))))]
- ""
+(define_insn "ss<spm_name>hi3_low_parts"
+ [(set (match_operand:V2HI 0 "register_operand" "=d")
+ (vec_concat:V2HI
+ (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
+ (parallel [(const_int 0)]))
+ (sp_or_sm:HI (vec_select:HI
+ (match_operand:V2HI 2 "register_operand" "d")
+ (parallel [(match_operand 4 "const01_operand" "P0P1")]))
+ (vec_select:HI
+ (match_operand:V2HI 3 "register_operand" "d")
+ (parallel [(match_operand 5 "const01_operand" "P0P1")])))))]
+ ""
{
const char *templates[] = {
- "%h0 = %h1 - %h2 (S)%!",
- "%d0 = %h1 - %h2 (S)%!",
- "%h0 = %d1 - %h2 (S)%!",
- "%d0 = %d1 - %h2 (S)%!",
- "%h0 = %h1 - %d2 (S)%!",
- "%d0 = %h1 - %d2 (S)%!",
- "%h0 = %d1 - %d2 (S)%!",
- "%d0 = %d1 - %d2 (S)%!" };
- int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
- + (INTVAL (operands[5]) << 2);
+ "%h0 = %h2 <spm_string> %h3 (S)%!",
+ "%h0 = %d2 <spm_string> %h3 (S)%!",
+ "%h0 = %h2 <spm_string> %d3 (S)%!",
+ "%h0 = %d2 <spm_string> %d3 (S)%!" };
+ int alt = INTVAL (operands[4]) + (INTVAL (operands[5]) << 1);
return templates[alt];
}
[(set_attr "type" "dsp32")])
-(define_insn "sssubhi3"
- [(set (match_operand:HI 0 "register_operand" "=d")
- (ss_minus:HI (match_operand:HI 1 "register_operand" "d")
- (match_operand:HI 2 "register_operand" "d")))]
- ""
- "%h0 = %h1 - %h2 (S)%!"
+(define_insn "ss<spm_name>hi3_high_parts"
+ [(set (match_operand:V2HI 0 "register_operand" "=d")
+ (vec_concat:V2HI
+ (sp_or_sm:HI (vec_select:HI
+ (match_operand:V2HI 2 "register_operand" "d")
+ (parallel [(match_operand 4 "const01_operand" "P0P1")]))
+ (vec_select:HI
+ (match_operand:V2HI 3 "register_operand" "d")
+ (parallel [(match_operand 5 "const01_operand" "P0P1")])))
+ (vec_select:HI (match_operand:V2HI 1 "register_operand" "0")
+ (parallel [(const_int 1)]))))]
+ ""
+{
+ const char *templates[] = {
+ "%d0 = %h2 <spm_string> %h3 (S)%!",
+ "%d0 = %d2 <spm_string> %h3 (S)%!",
+ "%d0 = %h2 <spm_string> %d3 (S)%!",
+ "%d0 = %d2 <spm_string> %d3 (S)%!" };
+ int alt = INTVAL (operands[4]) + (INTVAL (operands[5]) << 1);
+ return templates[alt];
+}
[(set_attr "type" "dsp32")])
;; V2HI vector insns
@@ -3239,30 +3249,23 @@
[(set_attr "type" "dsp32")])
(define_insn "flag_mulhi_parts"
- [(set (vec_select:HI
- (match_operand:V2HI 0 "register_operand" "d")
- (parallel [(match_operand 3 "const01_operand" "P0P1")]))
+ [(set (match_operand:HI 0 "register_operand" "=d")
(unspec:HI [(vec_select:HI
(match_operand:V2HI 1 "register_operand" "d")
- (parallel [(match_operand 4 "const01_operand" "P0P1")]))
+ (parallel [(match_operand 3 "const01_operand" "P0P1")]))
(vec_select:HI
(match_operand:V2HI 2 "register_operand" "d")
- (parallel [(match_operand 5 "const01_operand" "P0P1")]))
- (match_operand 6 "const_int_operand" "n")]
+ (parallel [(match_operand 4 "const01_operand" "P0P1")]))
+ (match_operand 5 "const_int_operand" "n")]
UNSPEC_MUL_WITH_FLAG))]
""
{
const char *templates[] = {
- "%h0 = %h1 * %h2 %M6%!",
- "%d0 = %h1 * %h2 %M6%!",
- "%h0 = %d1 * %h2 %M6%!",
- "%d0 = %d1 * %h2 %M6%!",
- "%h0 = %h1 * %d2 %M6%!",
- "%d0 = %h1 * %d2 %M6%!",
- "%h0 = %d1 * %d2 %M6%!",
- "%d0 = %d1 * %d2 %M6%!" };
- int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1)
- + (INTVAL (operands[5]) << 2);
+ "%h0 = %h1 * %h2 %M5%!",
+ "%h0 = %d1 * %h2 %M5%!",
+ "%h0 = %h1 * %d2 %M5%!",
+ "%h0 = %d1 * %d2 %M5%!" };
+ int alt = INTVAL (operands[3]) + (INTVAL (operands[4]) << 1);
return templates[alt];
}
[(set_attr "type" "dsp32")])
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 352be557818..47936d6e73e 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -1189,16 +1189,6 @@ struct cum_args {int regs;};
# define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
#endif
-/* For now, don't do anything. GCC does a good job most often.
-
- Maybe we could do something about gcc:s misbehavior when it
- recalculates frame offsets for local variables, from fp+offs to
- sp+offs. The resulting address expression gets screwed up
- sometimes, but I'm not sure that it may be fixed here, since it is
- already split up in several instructions (Is this still true?).
- FIXME: Check and adjust for gcc-2.9x. */
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) {}
-
/* Fix reloads known to cause suboptimal spilling. */
#define LEGITIMIZE_RELOAD_ADDRESS(X, MODE, OPNUM, TYPE, INDL, WIN) \
do \
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index f8c982e3842..88d032f2ef6 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -281,7 +281,7 @@ machopic_gen_offset (rtx orig)
{
/* Play games to avoid marking the function as needing pic if we
are being called as part of the cost-estimation process. */
- if (current_ir_type () != IR_GIMPLE)
+ if (current_ir_type () != IR_GIMPLE || currently_expanding_to_rtl)
crtl->uses_pic_offset_table = 1;
orig = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, orig),
UNSPEC_MACHOPIC_OFFSET);
diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h
index 911ed7c9170..c34d02cf96f 100644
--- a/gcc/config/frv/frv-protos.h
+++ b/gcc/config/frv/frv-protos.h
@@ -49,7 +49,6 @@ extern int frv_initial_elimination_offset (int, int);
#ifdef RTX_CODE
extern int frv_legitimate_address_p (enum machine_mode, rtx,
int, int, int);
-extern rtx frv_legitimize_address (rtx, rtx, enum machine_mode);
extern rtx frv_find_base_term (rtx);
#ifdef TREE_CODE
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index 56c99ae7c9f..4e8c1b24cf8 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -303,6 +303,7 @@ static int frv_check_constant_argument (enum insn_code, int, rtx);
static rtx frv_legitimize_target (enum insn_code, rtx);
static rtx frv_legitimize_argument (enum insn_code, int, rtx);
static rtx frv_legitimize_tls_address (rtx, enum tls_model);
+static rtx frv_legitimize_address (rtx, rtx, enum machine_mode);
static rtx frv_expand_set_builtin (enum insn_code, tree, rtx);
static rtx frv_expand_unop_builtin (enum insn_code, tree, rtx);
static rtx frv_expand_binop_builtin (enum insn_code, tree, rtx);
@@ -433,6 +434,9 @@ static bool frv_secondary_reload (bool, rtx, enum reg_class,
#undef TARGET_SCHED_ISSUE_RATE
#define TARGET_SCHED_ISSUE_RATE frv_issue_rate
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS frv_legitimize_address
+
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL frv_function_ok_for_sibcall
#undef TARGET_CANNOT_FORCE_CONST_MEM
@@ -3661,7 +3665,7 @@ frv_legitimize_address (rtx x,
return frv_legitimize_tls_address (x, model);
}
- return NULL_RTX;
+ return x;
}
/* Test whether a local function descriptor is canonical, i.e.,
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index abe275f444b..b6fdca4aa0a 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -2120,16 +2120,6 @@ __asm__("\n" \
will reload one or both registers only if neither labeling works. */
#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-do { \
- rtx new_x = frv_legitimize_address (X, OLDX, MODE); \
- if (new_x) \
- { \
- (X) = new_x; \
- goto WIN; \
- } \
-} while (0)
-
#define FIND_BASE_TERM frv_find_base_term
/* A C expression that is nonzero if X is a legitimate constant for an
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 701223e9c25..7e3711323aa 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -300,12 +300,6 @@ extern const char * const *h8_reg_names;
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM FP_REG
-/* 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 AP_REG
diff --git a/gcc/config/hpux-stdint.h b/gcc/config/hpux-stdint.h
new file mode 100644
index 00000000000..b06813b4769
--- /dev/null
+++ b/gcc/config/hpux-stdint.h
@@ -0,0 +1,34 @@
+
+/* These should be correct for ia64-hp-hpux11.23. */
+
+#define SIG_ATOMIC_TYPE "unsigned int"
+
+#define INT8_TYPE "signed char"
+#define INT16_TYPE "short int"
+#define INT32_TYPE "int"
+#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+#define UINT8_TYPE "unsigned char"
+#define UINT16_TYPE "short unsigned int"
+#define UINT32_TYPE "unsigned int"
+#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
+
+#define INT_LEAST8_TYPE "signed char"
+#define INT_LEAST16_TYPE "short int"
+#define INT_LEAST32_TYPE "int"
+#define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+#define UINT_LEAST8_TYPE "unsigned char"
+#define UINT_LEAST16_TYPE "short unsigned int"
+#define UINT_LEAST32_TYPE "unsigned int"
+#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
+
+#define INT_FAST8_TYPE "int"
+#define INT_FAST16_TYPE "int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
+#define UINT_FAST8_TYPE "unsigned int"
+#define UINT_FAST16_TYPE "unsigned int"
+#define UINT_FAST32_TYPE "unsigned int"
+#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
+
+#define INTPTR_TYPE "long int"
+#define UINTPTR_TYPE "long unsigned int"
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 5d92ec79f60..803a9da7ca3 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -57,7 +57,6 @@ extern bool constant_address_p (rtx);
extern bool legitimate_pic_operand_p (rtx);
extern int legitimate_pic_address_disp_p (rtx);
extern int legitimate_address_p (enum machine_mode, rtx, int);
-extern rtx legitimize_address (rtx, rtx, enum machine_mode);
extern void print_reg (rtx, int, FILE*);
extern void print_operand (FILE*, rtx, int);
@@ -97,7 +96,6 @@ extern void ix86_expand_convert_uns_sixf_sse (rtx, rtx);
extern void ix86_expand_convert_uns_sidf_sse (rtx, rtx);
extern void ix86_expand_convert_uns_sisf_sse (rtx, rtx);
extern void ix86_expand_convert_sign_didf_sse (rtx, rtx);
-extern rtx ix86_build_signbit_mask (enum machine_mode, bool, bool);
extern void ix86_expand_fp_absneg_operator (enum rtx_code, enum machine_mode,
rtx[]);
extern void ix86_expand_copysign (rtx []);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 72e9e7172e9..f3d35cea9c5 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3. If not see
#include "insn-codes.h"
#include "insn-attr.h"
#include "flags.h"
-#include "c-common.h"
#include "except.h"
#include "function.h"
#include "recog.h"
@@ -5466,7 +5465,10 @@ construct_container (enum machine_mode mode, enum machine_mode orig_mode,
case X86_64_SSE_CLASS:
case X86_64_SSESF_CLASS:
case X86_64_SSEDF_CLASS:
- return gen_reg_or_parallel (mode, orig_mode, SSE_REGNO (sse_regno));
+ if (mode != BLKmode)
+ return gen_reg_or_parallel (mode, orig_mode,
+ SSE_REGNO (sse_regno));
+ break;
case X86_64_X87_CLASS:
case X86_64_COMPLEX_X87_CLASS:
return gen_rtx_REG (mode, FIRST_STACK_REG);
@@ -9764,7 +9766,7 @@ get_thread_pointer (int to_reg)
return reg;
}
-/* A subroutine of legitimize_address and ix86_expand_move. FOR_MOV is
+/* A subroutine of ix86_legitimize_address and ix86_expand_move. FOR_MOV is
false if we expect this to be used for a memory address and true if
we expect to load the address into a register. */
@@ -10022,8 +10024,9 @@ legitimize_dllimport_symbol (rtx symbol, bool want_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 (rtx x, rtx oldx ATTRIBUTE_UNUSED, enum machine_mode mode)
+static rtx
+ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
{
int changed = 0;
unsigned log;
@@ -10848,7 +10851,7 @@ get_some_local_dynamic_name (void)
otherwise nothing
R -- print the prefix for register names.
z -- print the opcode suffix for the size of the current operand.
- Z -- likewise, with special suffixes for fild/fist instructions.
+ Z -- likewise, with special suffixes for x87 instructions.
* -- print a star (in certain assembler syntax)
A -- print an absolute memory reference.
w -- print the operand as if it's a "word" (HImode) even if it isn't.
@@ -10947,91 +10950,111 @@ print_operand (FILE *file, rtx x, int code)
putc ('t', file);
return;
- case 'Z':
- gcc_assert (MEM_P (x));
+ case 'z':
+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
+ {
+ /* Opcodes don't get size suffixes if using Intel opcodes. */
+ if (ASSEMBLER_DIALECT == ASM_INTEL)
+ return;
+
+ switch (GET_MODE_SIZE (GET_MODE (x)))
+ {
+ case 1:
+ putc ('b', file);
+ return;
- /* fild/fist don't get size suffixes if using Intel opcodes. */
+ case 2:
+ putc ('w', file);
+ return;
+
+ case 4:
+ putc ('l', file);
+ return;
+
+ case 8:
+ putc ('q', file);
+ return;
+
+ default:
+ output_operand_lossage
+ ("invalid operand size for operand code '%c'", code);
+ return;
+ }
+ }
+
+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
+ warning
+ (0, "non-integer operand used with operand code '%c'", code);
+ /* FALLTHRU */
+
+ case 'Z':
+ /* 387 opcodes don't get size suffixes if using Intel opcodes. */
if (ASSEMBLER_DIALECT == ASM_INTEL)
return;
- switch (GET_MODE_SIZE (GET_MODE (x)))
+ if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
{
- case 2:
+ switch (GET_MODE_SIZE (GET_MODE (x)))
+ {
+ case 2:
#ifdef HAVE_AS_IX86_FILDS
- putc ('s', file);
+ putc ('s', file);
#endif
- return;
+ return;
- case 4:
- putc ('l', file);
- return;
+ case 4:
+ putc ('l', file);
+ return;
- case 8:
+ case 8:
#ifdef HAVE_AS_IX86_FILDQ
- putc ('q', file);
+ putc ('q', file);
#else
- fputs ("ll", file);
+ fputs ("ll", file);
#endif
- return;
+ return;
- default:
- gcc_unreachable ();
+ default:
+ break;
+ }
}
-
- case 'z':
- /* 387 opcodes don't get size suffixes if the operands are
- registers. */
- if (STACK_REG_P (x))
- return;
-
- /* Likewise if using Intel opcodes. */
- if (ASSEMBLER_DIALECT == ASM_INTEL)
- return;
-
- /* This is the size of op from size of operand. */
- switch (GET_MODE_SIZE (GET_MODE (x)))
+ else if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT)
{
- case 1:
- putc ('b', file);
- return;
+ /* 387 opcodes don't get size suffixes
+ if the operands are registers. */
+ if (STACK_REG_P (x))
+ return;
- case 2:
- /* ??? This fails for HImode integer
- operator with memory operand. */
- if (MEM_P (x))
+ switch (GET_MODE_SIZE (GET_MODE (x)))
{
-#ifdef HAVE_AS_IX86_FILDS
+ case 4:
putc ('s', file);
-#endif
return;
- }
- else
- putc ('w', file);
- return;
- case 4:
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
- putc ('l', file);
- else
- putc ('s', file);
- return;
+ case 8:
+ putc ('l', file);
+ return;
- case 8:
- if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
- putc ('q', file);
- else
- putc ('l', file);
- return;
+ case 12:
+ case 16:
+ putc ('t', file);
+ return;
- case 12:
- case 16:
- putc ('t', file);
+ default:
+ break;
+ }
+ }
+ else
+ {
+ output_operand_lossage
+ ("invalid operand type used with operand code '%c'", code);
return;
-
- default:
- gcc_unreachable ();
}
+ output_operand_lossage
+ ("invalid operand size for operand code '%c'", code);
+ return;
+
case 'd':
case 'b':
case 'w':
@@ -11830,7 +11853,7 @@ output_387_binary_op (rtx insn, rtx *operands)
if (MEM_P (operands[2]))
{
- p = "%z2\t%2";
+ p = "%Z2\t%2";
break;
}
@@ -11860,13 +11883,13 @@ output_387_binary_op (rtx insn, rtx *operands)
case DIV:
if (MEM_P (operands[1]))
{
- p = "r%z1\t%1";
+ p = "r%Z1\t%1";
break;
}
if (MEM_P (operands[2]))
{
- p = "%z2\t%2";
+ p = "%Z2\t%2";
break;
}
@@ -12238,13 +12261,13 @@ output_fp_compare (rtx insn, rtx *operands, int eflags_p, int unordered_p)
static const char * const alt[16] =
{
- "fcom%z2\t%y2\n\tfnstsw\t%0",
- "fcomp%z2\t%y2\n\tfnstsw\t%0",
- "fucom%z2\t%y2\n\tfnstsw\t%0",
- "fucomp%z2\t%y2\n\tfnstsw\t%0",
+ "fcom%Z2\t%y2\n\tfnstsw\t%0",
+ "fcomp%Z2\t%y2\n\tfnstsw\t%0",
+ "fucom%Z2\t%y2\n\tfnstsw\t%0",
+ "fucomp%Z2\t%y2\n\tfnstsw\t%0",
- "ficom%z2\t%y2\n\tfnstsw\t%0",
- "ficomp%z2\t%y2\n\tfnstsw\t%0",
+ "ficom%Z2\t%y2\n\tfnstsw\t%0",
+ "ficomp%Z2\t%y2\n\tfnstsw\t%0",
NULL,
NULL,
@@ -13566,7 +13589,7 @@ ix86_expand_convert_uns_sisf_sse (rtx target, rtx input)
emit_move_insn (target, fp_hi);
}
-/* A subroutine of ix86_build_signbit_mask_vector. If VECT is true,
+/* A subroutine of ix86_build_signbit_mask. If VECT is true,
then replicate the value for all elements of the vector
register. */
@@ -13612,7 +13635,7 @@ ix86_build_const_vector (enum machine_mode mode, bool vect, rtx value)
all elements of the vector register. If INVERT is true, then create
a mask excluding the sign bit. */
-rtx
+static rtx
ix86_build_signbit_mask (enum machine_mode mode, bool vect, bool invert)
{
enum machine_mode vec_mode, imode;
@@ -21976,81 +21999,81 @@ enum multi_arg_type {
static const struct builtin_description bdesc_multi_arg[] =
{
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmaddv4sf4, "__builtin_ia32_fmaddss", IX86_BUILTIN_FMADDSS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmaddv2df4, "__builtin_ia32_fmaddsd", IX86_BUILTIN_FMADDSD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmaddv4sf4, "__builtin_ia32_fmaddps", IX86_BUILTIN_FMADDPS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmaddv2df4, "__builtin_ia32_fmaddpd", IX86_BUILTIN_FMADDPD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmsubv4sf4, "__builtin_ia32_fmsubss", IX86_BUILTIN_FMSUBSS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmsubv2df4, "__builtin_ia32_fmsubsd", IX86_BUILTIN_FMSUBSD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmsubv4sf4, "__builtin_ia32_fmsubps", IX86_BUILTIN_FMSUBPS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmsubv2df4, "__builtin_ia32_fmsubpd", IX86_BUILTIN_FMSUBPD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmaddv4sf4, "__builtin_ia32_fnmaddss", IX86_BUILTIN_FNMADDSS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmaddv2df4, "__builtin_ia32_fnmaddsd", IX86_BUILTIN_FNMADDSD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmaddv4sf4, "__builtin_ia32_fnmaddps", IX86_BUILTIN_FNMADDPS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmaddv2df4, "__builtin_ia32_fnmaddpd", IX86_BUILTIN_FNMADDPD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmsubv4sf4, "__builtin_ia32_fnmsubss", IX86_BUILTIN_FNMSUBSS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmsubv2df4, "__builtin_ia32_fnmsubsd", IX86_BUILTIN_FNMSUBSD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmsubv4sf4, "__builtin_ia32_fnmsubps", IX86_BUILTIN_FNMSUBPS, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmsubv2df4, "__builtin_ia32_fnmsubpd", IX86_BUILTIN_FNMSUBPD, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v2di, "__builtin_ia32_pcmov", IX86_BUILTIN_PCMOV, 0, (int)MULTI_ARG_3_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v2di, "__builtin_ia32_pcmov_v2di", IX86_BUILTIN_PCMOV_V2DI, 0, (int)MULTI_ARG_3_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v4si, "__builtin_ia32_pcmov_v4si", IX86_BUILTIN_PCMOV_V4SI, 0, (int)MULTI_ARG_3_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v8hi, "__builtin_ia32_pcmov_v8hi", IX86_BUILTIN_PCMOV_V8HI, 0, (int)MULTI_ARG_3_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v16qi, "__builtin_ia32_pcmov_v16qi",IX86_BUILTIN_PCMOV_V16QI,0, (int)MULTI_ARG_3_QI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v2df, "__builtin_ia32_pcmov_v2df", IX86_BUILTIN_PCMOV_V2DF, 0, (int)MULTI_ARG_3_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v4sf, "__builtin_ia32_pcmov_v4sf", IX86_BUILTIN_PCMOV_V4SF, 0, (int)MULTI_ARG_3_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pperm, "__builtin_ia32_pperm", IX86_BUILTIN_PPERM, 0, (int)MULTI_ARG_3_QI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_permv4sf, "__builtin_ia32_permps", IX86_BUILTIN_PERMPS, 0, (int)MULTI_ARG_3_PERMPS },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_permv2df, "__builtin_ia32_permpd", IX86_BUILTIN_PERMPD, 0, (int)MULTI_ARG_3_PERMPD },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssww, "__builtin_ia32_pmacssww", IX86_BUILTIN_PMACSSWW, 0, (int)MULTI_ARG_3_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsww, "__builtin_ia32_pmacsww", IX86_BUILTIN_PMACSWW, 0, (int)MULTI_ARG_3_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsswd, "__builtin_ia32_pmacsswd", IX86_BUILTIN_PMACSSWD, 0, (int)MULTI_ARG_3_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacswd, "__builtin_ia32_pmacswd", IX86_BUILTIN_PMACSWD, 0, (int)MULTI_ARG_3_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssdd, "__builtin_ia32_pmacssdd", IX86_BUILTIN_PMACSSDD, 0, (int)MULTI_ARG_3_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsdd, "__builtin_ia32_pmacsdd", IX86_BUILTIN_PMACSDD, 0, (int)MULTI_ARG_3_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssdql, "__builtin_ia32_pmacssdql", IX86_BUILTIN_PMACSSDQL, 0, (int)MULTI_ARG_3_SI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssdqh, "__builtin_ia32_pmacssdqh", IX86_BUILTIN_PMACSSDQH, 0, (int)MULTI_ARG_3_SI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsdql, "__builtin_ia32_pmacsdql", IX86_BUILTIN_PMACSDQL, 0, (int)MULTI_ARG_3_SI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsdqh, "__builtin_ia32_pmacsdqh", IX86_BUILTIN_PMACSDQH, 0, (int)MULTI_ARG_3_SI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmadcsswd, "__builtin_ia32_pmadcsswd", IX86_BUILTIN_PMADCSSWD, 0, (int)MULTI_ARG_3_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmadcswd, "__builtin_ia32_pmadcswd", IX86_BUILTIN_PMADCSWD, 0, (int)MULTI_ARG_3_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv2di3, "__builtin_ia32_protq", IX86_BUILTIN_PROTQ, 0, (int)MULTI_ARG_2_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv4si3, "__builtin_ia32_protd", IX86_BUILTIN_PROTD, 0, (int)MULTI_ARG_2_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv8hi3, "__builtin_ia32_protw", IX86_BUILTIN_PROTW, 0, (int)MULTI_ARG_2_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv16qi3, "__builtin_ia32_protb", IX86_BUILTIN_PROTB, 0, (int)MULTI_ARG_2_QI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv2di3, "__builtin_ia32_protqi", IX86_BUILTIN_PROTQ_IMM, 0, (int)MULTI_ARG_2_DI_IMM },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv4si3, "__builtin_ia32_protdi", IX86_BUILTIN_PROTD_IMM, 0, (int)MULTI_ARG_2_SI_IMM },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv8hi3, "__builtin_ia32_protwi", IX86_BUILTIN_PROTW_IMM, 0, (int)MULTI_ARG_2_HI_IMM },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv16qi3, "__builtin_ia32_protbi", IX86_BUILTIN_PROTB_IMM, 0, (int)MULTI_ARG_2_QI_IMM },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv2di3, "__builtin_ia32_pshaq", IX86_BUILTIN_PSHAQ, 0, (int)MULTI_ARG_2_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv4si3, "__builtin_ia32_pshad", IX86_BUILTIN_PSHAD, 0, (int)MULTI_ARG_2_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv8hi3, "__builtin_ia32_pshaw", IX86_BUILTIN_PSHAW, 0, (int)MULTI_ARG_2_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv16qi3, "__builtin_ia32_pshab", IX86_BUILTIN_PSHAB, 0, (int)MULTI_ARG_2_QI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv2di3, "__builtin_ia32_pshlq", IX86_BUILTIN_PSHLQ, 0, (int)MULTI_ARG_2_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv4si3, "__builtin_ia32_pshld", IX86_BUILTIN_PSHLD, 0, (int)MULTI_ARG_2_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv8hi3, "__builtin_ia32_pshlw", IX86_BUILTIN_PSHLW, 0, (int)MULTI_ARG_2_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv16qi3, "__builtin_ia32_pshlb", IX86_BUILTIN_PSHLB, 0, (int)MULTI_ARG_2_QI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vmfrczv4sf2, "__builtin_ia32_frczss", IX86_BUILTIN_FRCZSS, 0, (int)MULTI_ARG_2_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vmfrczv2df2, "__builtin_ia32_frczsd", IX86_BUILTIN_FRCZSD, 0, (int)MULTI_ARG_2_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_frczv4sf2, "__builtin_ia32_frczps", IX86_BUILTIN_FRCZPS, 0, (int)MULTI_ARG_1_SF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_frczv2df2, "__builtin_ia32_frczpd", IX86_BUILTIN_FRCZPD, 0, (int)MULTI_ARG_1_DF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_cvtph2ps, "__builtin_ia32_cvtph2ps", IX86_BUILTIN_CVTPH2PS, 0, (int)MULTI_ARG_1_PH2PS },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_cvtps2ph, "__builtin_ia32_cvtps2ph", IX86_BUILTIN_CVTPS2PH, 0, (int)MULTI_ARG_1_PS2PH },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddbw, "__builtin_ia32_phaddbw", IX86_BUILTIN_PHADDBW, 0, (int)MULTI_ARG_1_QI_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddbd, "__builtin_ia32_phaddbd", IX86_BUILTIN_PHADDBD, 0, (int)MULTI_ARG_1_QI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddbq, "__builtin_ia32_phaddbq", IX86_BUILTIN_PHADDBQ, 0, (int)MULTI_ARG_1_QI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddwd, "__builtin_ia32_phaddwd", IX86_BUILTIN_PHADDWD, 0, (int)MULTI_ARG_1_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddwq, "__builtin_ia32_phaddwq", IX86_BUILTIN_PHADDWQ, 0, (int)MULTI_ARG_1_HI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phadddq, "__builtin_ia32_phadddq", IX86_BUILTIN_PHADDDQ, 0, (int)MULTI_ARG_1_SI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddubw, "__builtin_ia32_phaddubw", IX86_BUILTIN_PHADDUBW, 0, (int)MULTI_ARG_1_QI_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddubd, "__builtin_ia32_phaddubd", IX86_BUILTIN_PHADDUBD, 0, (int)MULTI_ARG_1_QI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddubq, "__builtin_ia32_phaddubq", IX86_BUILTIN_PHADDUBQ, 0, (int)MULTI_ARG_1_QI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phadduwd, "__builtin_ia32_phadduwd", IX86_BUILTIN_PHADDUWD, 0, (int)MULTI_ARG_1_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phadduwq, "__builtin_ia32_phadduwq", IX86_BUILTIN_PHADDUWQ, 0, (int)MULTI_ARG_1_HI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddudq, "__builtin_ia32_phaddudq", IX86_BUILTIN_PHADDUDQ, 0, (int)MULTI_ARG_1_SI_DI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phsubbw, "__builtin_ia32_phsubbw", IX86_BUILTIN_PHSUBBW, 0, (int)MULTI_ARG_1_QI_HI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phsubwd, "__builtin_ia32_phsubwd", IX86_BUILTIN_PHSUBWD, 0, (int)MULTI_ARG_1_HI_SI },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phsubdq, "__builtin_ia32_phsubdq", IX86_BUILTIN_PHSUBDQ, 0, (int)MULTI_ARG_1_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmaddv4sf4, "__builtin_ia32_fmaddss", IX86_BUILTIN_FMADDSS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmaddv2df4, "__builtin_ia32_fmaddsd", IX86_BUILTIN_FMADDSD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmaddv4sf4, "__builtin_ia32_fmaddps", IX86_BUILTIN_FMADDPS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmaddv2df4, "__builtin_ia32_fmaddpd", IX86_BUILTIN_FMADDPD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmsubv4sf4, "__builtin_ia32_fmsubss", IX86_BUILTIN_FMSUBSS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfmsubv2df4, "__builtin_ia32_fmsubsd", IX86_BUILTIN_FMSUBSD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmsubv4sf4, "__builtin_ia32_fmsubps", IX86_BUILTIN_FMSUBPS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fmsubv2df4, "__builtin_ia32_fmsubpd", IX86_BUILTIN_FMSUBPD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmaddv4sf4, "__builtin_ia32_fnmaddss", IX86_BUILTIN_FNMADDSS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmaddv2df4, "__builtin_ia32_fnmaddsd", IX86_BUILTIN_FNMADDSD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmaddv4sf4, "__builtin_ia32_fnmaddps", IX86_BUILTIN_FNMADDPS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmaddv2df4, "__builtin_ia32_fnmaddpd", IX86_BUILTIN_FNMADDPD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmsubv4sf4, "__builtin_ia32_fnmsubss", IX86_BUILTIN_FNMSUBSS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_vmfnmsubv2df4, "__builtin_ia32_fnmsubsd", IX86_BUILTIN_FNMSUBSD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmsubv4sf4, "__builtin_ia32_fnmsubps", IX86_BUILTIN_FNMSUBPS, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5i_fnmsubv2df4, "__builtin_ia32_fnmsubpd", IX86_BUILTIN_FNMSUBPD, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v2di, "__builtin_ia32_pcmov", IX86_BUILTIN_PCMOV, UNKNOWN, (int)MULTI_ARG_3_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v2di, "__builtin_ia32_pcmov_v2di", IX86_BUILTIN_PCMOV_V2DI, UNKNOWN, (int)MULTI_ARG_3_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v4si, "__builtin_ia32_pcmov_v4si", IX86_BUILTIN_PCMOV_V4SI, UNKNOWN, (int)MULTI_ARG_3_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v8hi, "__builtin_ia32_pcmov_v8hi", IX86_BUILTIN_PCMOV_V8HI, UNKNOWN, (int)MULTI_ARG_3_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v16qi, "__builtin_ia32_pcmov_v16qi",IX86_BUILTIN_PCMOV_V16QI,UNKNOWN, (int)MULTI_ARG_3_QI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v2df, "__builtin_ia32_pcmov_v2df", IX86_BUILTIN_PCMOV_V2DF, UNKNOWN, (int)MULTI_ARG_3_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcmov_v4sf, "__builtin_ia32_pcmov_v4sf", IX86_BUILTIN_PCMOV_V4SF, UNKNOWN, (int)MULTI_ARG_3_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pperm, "__builtin_ia32_pperm", IX86_BUILTIN_PPERM, UNKNOWN, (int)MULTI_ARG_3_QI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_permv4sf, "__builtin_ia32_permps", IX86_BUILTIN_PERMPS, UNKNOWN, (int)MULTI_ARG_3_PERMPS },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_permv2df, "__builtin_ia32_permpd", IX86_BUILTIN_PERMPD, UNKNOWN, (int)MULTI_ARG_3_PERMPD },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssww, "__builtin_ia32_pmacssww", IX86_BUILTIN_PMACSSWW, UNKNOWN, (int)MULTI_ARG_3_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsww, "__builtin_ia32_pmacsww", IX86_BUILTIN_PMACSWW, UNKNOWN, (int)MULTI_ARG_3_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsswd, "__builtin_ia32_pmacsswd", IX86_BUILTIN_PMACSSWD, UNKNOWN, (int)MULTI_ARG_3_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacswd, "__builtin_ia32_pmacswd", IX86_BUILTIN_PMACSWD, UNKNOWN, (int)MULTI_ARG_3_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssdd, "__builtin_ia32_pmacssdd", IX86_BUILTIN_PMACSSDD, UNKNOWN, (int)MULTI_ARG_3_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsdd, "__builtin_ia32_pmacsdd", IX86_BUILTIN_PMACSDD, UNKNOWN, (int)MULTI_ARG_3_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssdql, "__builtin_ia32_pmacssdql", IX86_BUILTIN_PMACSSDQL, UNKNOWN, (int)MULTI_ARG_3_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacssdqh, "__builtin_ia32_pmacssdqh", IX86_BUILTIN_PMACSSDQH, UNKNOWN, (int)MULTI_ARG_3_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsdql, "__builtin_ia32_pmacsdql", IX86_BUILTIN_PMACSDQL, UNKNOWN, (int)MULTI_ARG_3_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmacsdqh, "__builtin_ia32_pmacsdqh", IX86_BUILTIN_PMACSDQH, UNKNOWN, (int)MULTI_ARG_3_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmadcsswd, "__builtin_ia32_pmadcsswd", IX86_BUILTIN_PMADCSSWD, UNKNOWN, (int)MULTI_ARG_3_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pmadcswd, "__builtin_ia32_pmadcswd", IX86_BUILTIN_PMADCSWD, UNKNOWN, (int)MULTI_ARG_3_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv2di3, "__builtin_ia32_protq", IX86_BUILTIN_PROTQ, UNKNOWN, (int)MULTI_ARG_2_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv4si3, "__builtin_ia32_protd", IX86_BUILTIN_PROTD, UNKNOWN, (int)MULTI_ARG_2_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv8hi3, "__builtin_ia32_protw", IX86_BUILTIN_PROTW, UNKNOWN, (int)MULTI_ARG_2_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vrotlv16qi3, "__builtin_ia32_protb", IX86_BUILTIN_PROTB, UNKNOWN, (int)MULTI_ARG_2_QI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv2di3, "__builtin_ia32_protqi", IX86_BUILTIN_PROTQ_IMM, UNKNOWN, (int)MULTI_ARG_2_DI_IMM },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv4si3, "__builtin_ia32_protdi", IX86_BUILTIN_PROTD_IMM, UNKNOWN, (int)MULTI_ARG_2_SI_IMM },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv8hi3, "__builtin_ia32_protwi", IX86_BUILTIN_PROTW_IMM, UNKNOWN, (int)MULTI_ARG_2_HI_IMM },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_rotlv16qi3, "__builtin_ia32_protbi", IX86_BUILTIN_PROTB_IMM, UNKNOWN, (int)MULTI_ARG_2_QI_IMM },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv2di3, "__builtin_ia32_pshaq", IX86_BUILTIN_PSHAQ, UNKNOWN, (int)MULTI_ARG_2_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv4si3, "__builtin_ia32_pshad", IX86_BUILTIN_PSHAD, UNKNOWN, (int)MULTI_ARG_2_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv8hi3, "__builtin_ia32_pshaw", IX86_BUILTIN_PSHAW, UNKNOWN, (int)MULTI_ARG_2_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_ashlv16qi3, "__builtin_ia32_pshab", IX86_BUILTIN_PSHAB, UNKNOWN, (int)MULTI_ARG_2_QI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv2di3, "__builtin_ia32_pshlq", IX86_BUILTIN_PSHLQ, UNKNOWN, (int)MULTI_ARG_2_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv4si3, "__builtin_ia32_pshld", IX86_BUILTIN_PSHLD, UNKNOWN, (int)MULTI_ARG_2_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv8hi3, "__builtin_ia32_pshlw", IX86_BUILTIN_PSHLW, UNKNOWN, (int)MULTI_ARG_2_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_lshlv16qi3, "__builtin_ia32_pshlb", IX86_BUILTIN_PSHLB, UNKNOWN, (int)MULTI_ARG_2_QI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vmfrczv4sf2, "__builtin_ia32_frczss", IX86_BUILTIN_FRCZSS, UNKNOWN, (int)MULTI_ARG_2_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vmfrczv2df2, "__builtin_ia32_frczsd", IX86_BUILTIN_FRCZSD, UNKNOWN, (int)MULTI_ARG_2_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_frczv4sf2, "__builtin_ia32_frczps", IX86_BUILTIN_FRCZPS, UNKNOWN, (int)MULTI_ARG_1_SF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_frczv2df2, "__builtin_ia32_frczpd", IX86_BUILTIN_FRCZPD, UNKNOWN, (int)MULTI_ARG_1_DF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_cvtph2ps, "__builtin_ia32_cvtph2ps", IX86_BUILTIN_CVTPH2PS, UNKNOWN, (int)MULTI_ARG_1_PH2PS },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_cvtps2ph, "__builtin_ia32_cvtps2ph", IX86_BUILTIN_CVTPS2PH, UNKNOWN, (int)MULTI_ARG_1_PS2PH },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddbw, "__builtin_ia32_phaddbw", IX86_BUILTIN_PHADDBW, UNKNOWN, (int)MULTI_ARG_1_QI_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddbd, "__builtin_ia32_phaddbd", IX86_BUILTIN_PHADDBD, UNKNOWN, (int)MULTI_ARG_1_QI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddbq, "__builtin_ia32_phaddbq", IX86_BUILTIN_PHADDBQ, UNKNOWN, (int)MULTI_ARG_1_QI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddwd, "__builtin_ia32_phaddwd", IX86_BUILTIN_PHADDWD, UNKNOWN, (int)MULTI_ARG_1_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddwq, "__builtin_ia32_phaddwq", IX86_BUILTIN_PHADDWQ, UNKNOWN, (int)MULTI_ARG_1_HI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phadddq, "__builtin_ia32_phadddq", IX86_BUILTIN_PHADDDQ, UNKNOWN, (int)MULTI_ARG_1_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddubw, "__builtin_ia32_phaddubw", IX86_BUILTIN_PHADDUBW, UNKNOWN, (int)MULTI_ARG_1_QI_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddubd, "__builtin_ia32_phaddubd", IX86_BUILTIN_PHADDUBD, UNKNOWN, (int)MULTI_ARG_1_QI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddubq, "__builtin_ia32_phaddubq", IX86_BUILTIN_PHADDUBQ, UNKNOWN, (int)MULTI_ARG_1_QI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phadduwd, "__builtin_ia32_phadduwd", IX86_BUILTIN_PHADDUWD, UNKNOWN, (int)MULTI_ARG_1_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phadduwq, "__builtin_ia32_phadduwq", IX86_BUILTIN_PHADDUWQ, UNKNOWN, (int)MULTI_ARG_1_HI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phaddudq, "__builtin_ia32_phaddudq", IX86_BUILTIN_PHADDUDQ, UNKNOWN, (int)MULTI_ARG_1_SI_DI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phsubbw, "__builtin_ia32_phsubbw", IX86_BUILTIN_PHSUBBW, UNKNOWN, (int)MULTI_ARG_1_QI_HI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phsubwd, "__builtin_ia32_phsubwd", IX86_BUILTIN_PHSUBWD, UNKNOWN, (int)MULTI_ARG_1_HI_SI },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_phsubdq, "__builtin_ia32_phsubdq", IX86_BUILTIN_PHSUBDQ, UNKNOWN, (int)MULTI_ARG_1_SI_DI },
{ OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vmmaskcmpv4sf3, "__builtin_ia32_comeqss", IX86_BUILTIN_COMEQSS, EQ, (int)MULTI_ARG_2_SF_CMP },
{ OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_vmmaskcmpv4sf3, "__builtin_ia32_comness", IX86_BUILTIN_COMNESS, NE, (int)MULTI_ARG_2_SF_CMP },
@@ -22184,32 +22207,32 @@ static const struct builtin_description bdesc_multi_arg[] =
{ OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_maskcmp_unsv2di3, "__builtin_ia32_pcomgtuq", IX86_BUILTIN_PCOMGTUQ, GTU, (int)MULTI_ARG_2_DI_CMP },
{ OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_maskcmp_unsv2di3, "__builtin_ia32_pcomgeuq", IX86_BUILTIN_PCOMGEUQ, GEU, (int)MULTI_ARG_2_DI_CMP },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comfalsess", IX86_BUILTIN_COMFALSESS, COM_FALSE_S, (int)MULTI_ARG_2_SF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comtruess", IX86_BUILTIN_COMTRUESS, COM_TRUE_S, (int)MULTI_ARG_2_SF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comfalseps", IX86_BUILTIN_COMFALSEPS, COM_FALSE_P, (int)MULTI_ARG_2_SF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comtrueps", IX86_BUILTIN_COMTRUEPS, COM_TRUE_P, (int)MULTI_ARG_2_SF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comfalsesd", IX86_BUILTIN_COMFALSESD, COM_FALSE_S, (int)MULTI_ARG_2_DF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comtruesd", IX86_BUILTIN_COMTRUESD, COM_TRUE_S, (int)MULTI_ARG_2_DF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comfalsepd", IX86_BUILTIN_COMFALSEPD, COM_FALSE_P, (int)MULTI_ARG_2_DF_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comtruepd", IX86_BUILTIN_COMTRUEPD, COM_TRUE_P, (int)MULTI_ARG_2_DF_TF },
-
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomfalseb", IX86_BUILTIN_PCOMFALSEB, PCOM_FALSE, (int)MULTI_ARG_2_QI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomfalsew", IX86_BUILTIN_PCOMFALSEW, PCOM_FALSE, (int)MULTI_ARG_2_HI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomfalsed", IX86_BUILTIN_PCOMFALSED, PCOM_FALSE, (int)MULTI_ARG_2_SI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomfalseq", IX86_BUILTIN_PCOMFALSEQ, PCOM_FALSE, (int)MULTI_ARG_2_DI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomfalseub",IX86_BUILTIN_PCOMFALSEUB,PCOM_FALSE, (int)MULTI_ARG_2_QI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomfalseuw",IX86_BUILTIN_PCOMFALSEUW,PCOM_FALSE, (int)MULTI_ARG_2_HI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomfalseud",IX86_BUILTIN_PCOMFALSEUD,PCOM_FALSE, (int)MULTI_ARG_2_SI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomfalseuq",IX86_BUILTIN_PCOMFALSEUQ,PCOM_FALSE, (int)MULTI_ARG_2_DI_TF },
-
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomtrueb", IX86_BUILTIN_PCOMTRUEB, PCOM_TRUE, (int)MULTI_ARG_2_QI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomtruew", IX86_BUILTIN_PCOMTRUEW, PCOM_TRUE, (int)MULTI_ARG_2_HI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomtrued", IX86_BUILTIN_PCOMTRUED, PCOM_TRUE, (int)MULTI_ARG_2_SI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomtrueq", IX86_BUILTIN_PCOMTRUEQ, PCOM_TRUE, (int)MULTI_ARG_2_DI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomtrueub", IX86_BUILTIN_PCOMTRUEUB, PCOM_TRUE, (int)MULTI_ARG_2_QI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomtrueuw", IX86_BUILTIN_PCOMTRUEUW, PCOM_TRUE, (int)MULTI_ARG_2_HI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomtrueud", IX86_BUILTIN_PCOMTRUEUD, PCOM_TRUE, (int)MULTI_ARG_2_SI_TF },
- { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomtrueuq", IX86_BUILTIN_PCOMTRUEUQ, PCOM_TRUE, (int)MULTI_ARG_2_DI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comfalsess", IX86_BUILTIN_COMFALSESS, (enum rtx_code) COM_FALSE_S, (int)MULTI_ARG_2_SF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comtruess", IX86_BUILTIN_COMTRUESS, (enum rtx_code) COM_TRUE_S, (int)MULTI_ARG_2_SF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comfalseps", IX86_BUILTIN_COMFALSEPS, (enum rtx_code) COM_FALSE_P, (int)MULTI_ARG_2_SF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv4sf3, "__builtin_ia32_comtrueps", IX86_BUILTIN_COMTRUEPS, (enum rtx_code) COM_TRUE_P, (int)MULTI_ARG_2_SF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comfalsesd", IX86_BUILTIN_COMFALSESD, (enum rtx_code) COM_FALSE_S, (int)MULTI_ARG_2_DF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comtruesd", IX86_BUILTIN_COMTRUESD, (enum rtx_code) COM_TRUE_S, (int)MULTI_ARG_2_DF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comfalsepd", IX86_BUILTIN_COMFALSEPD, (enum rtx_code) COM_FALSE_P, (int)MULTI_ARG_2_DF_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_com_tfv2df3, "__builtin_ia32_comtruepd", IX86_BUILTIN_COMTRUEPD, (enum rtx_code) COM_TRUE_P, (int)MULTI_ARG_2_DF_TF },
+
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomfalseb", IX86_BUILTIN_PCOMFALSEB, (enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_QI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomfalsew", IX86_BUILTIN_PCOMFALSEW, (enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_HI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomfalsed", IX86_BUILTIN_PCOMFALSED, (enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_SI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomfalseq", IX86_BUILTIN_PCOMFALSEQ, (enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_DI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomfalseub",IX86_BUILTIN_PCOMFALSEUB,(enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_QI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomfalseuw",IX86_BUILTIN_PCOMFALSEUW,(enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_HI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomfalseud",IX86_BUILTIN_PCOMFALSEUD,(enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_SI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomfalseuq",IX86_BUILTIN_PCOMFALSEUQ,(enum rtx_code) PCOM_FALSE, (int)MULTI_ARG_2_DI_TF },
+
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomtrueb", IX86_BUILTIN_PCOMTRUEB, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_QI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomtruew", IX86_BUILTIN_PCOMTRUEW, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_HI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomtrued", IX86_BUILTIN_PCOMTRUED, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_SI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomtrueq", IX86_BUILTIN_PCOMTRUEQ, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_DI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv16qi3, "__builtin_ia32_pcomtrueub", IX86_BUILTIN_PCOMTRUEUB, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_QI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv8hi3, "__builtin_ia32_pcomtrueuw", IX86_BUILTIN_PCOMTRUEUW, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_HI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv4si3, "__builtin_ia32_pcomtrueud", IX86_BUILTIN_PCOMTRUEUD, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_SI_TF },
+ { OPTION_MASK_ISA_SSE5, CODE_FOR_sse5_pcom_tfv2di3, "__builtin_ia32_pcomtrueuq", IX86_BUILTIN_PCOMTRUEUQ, (enum rtx_code) PCOM_TRUE, (int)MULTI_ARG_2_DI_TF },
};
/* Set up all the MMX/SSE builtins, even builtins for instructions that are not
@@ -25616,7 +25639,9 @@ ix86_veclibabi_acml (enum built_in_function fn, tree type_out, tree type_in)
static tree
ix86_vectorize_builtin_conversion (unsigned int code, tree type)
{
- if (TREE_CODE (type) != VECTOR_TYPE)
+ if (TREE_CODE (type) != VECTOR_TYPE
+ /* There are only conversions from/to signed integers. */
+ || TYPE_UNSIGNED (TREE_TYPE (type)))
return NULL_TREE;
switch (code)
@@ -28779,22 +28804,22 @@ output_387_reg_move (rtx insn, rtx *operands)
return "fstp\t%y0";
}
if (STACK_TOP_P (operands[0]))
- return "fld%z1\t%y1";
+ return "fld%Z1\t%y1";
return "fst\t%y0";
}
else if (MEM_P (operands[0]))
{
gcc_assert (REG_P (operands[1]));
if (find_regno_note (insn, REG_DEAD, REGNO (operands[1])))
- return "fstp%z0\t%y0";
+ return "fstp%Z0\t%y0";
else
{
/* There is no non-popping store to memory for XFmode.
So if we need one, follow the store with a load. */
if (GET_MODE (operands[0]) == XFmode)
- return "fstp%z0\t%y0\n\tfld%z0\t%y0";
+ return "fstp%Z0\t%y0\n\tfld%Z0\t%y0";
else
- return "fst%z0\t%y0";
+ return "fst%Z0\t%y0";
}
}
else
@@ -30019,6 +30044,9 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY ix86_return_in_memory
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS ix86_legitimize_address
+
#undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE ix86_attribute_table
#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index b3972a3f7c2..4aafd9c92fe 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1850,34 +1850,6 @@ do { \
#define FIND_BASE_TERM(X) ix86_find_base_term (X)
-/* 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) \
-do { \
- (X) = legitimize_address ((X), (OLDX), (MODE)); \
- if (memory_address_p ((MODE), (X))) \
- goto WIN; \
-} while (0)
-
/* 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. */
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index d315580139c..1bb96fd07db 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -36,7 +36,7 @@
;; otherwise nothing
;; R -- print the prefix for register names.
;; z -- print the opcode suffix for the size of the current operand.
-;; Z -- likewise, with special suffixes for fild/fist instructions.
+;; Z -- likewise, with special suffixes for x87 instructions.
;; * -- print a star (in certain assembler syntax)
;; A -- print an absolute memory reference.
;; w -- print the operand as if it's a "word" (HImode) even if it isn't.
@@ -21230,7 +21230,7 @@
(match_operator 1 "compare_operator"
[(match_operand 2 "register_operand" "")
(match_operand 3 "const_int_operand" "")]))]
- "(((!TARGET_FUSE_CMP_AND_BRANCH || optimize_size)
+ "(((!TARGET_FUSE_CMP_AND_BRANCH || optimize_insn_for_size_p ())
&& incdec_operand (operands[3], GET_MODE (operands[3])))
|| (!TARGET_FUSE_CMP_AND_BRANCH
&& INTVAL (operands[3]) == 128))
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index f1c71033333..785ff5d6033 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -702,7 +702,7 @@
{
/* On Pentium4, the inc and dec operations causes extra dependency on flag
registers, since carry flag is not set. */
- if (!TARGET_USE_INCDEC && !optimize_size)
+ if (!TARGET_USE_INCDEC && !optimize_insn_for_size_p ())
return 0;
return op == const1_rtx || op == constm1_rtx;
})
@@ -816,7 +816,7 @@
/* All patterns using aligned_operand on memory operands ends up
in promoting memory operand to 64bit and thus causing memory mismatch. */
- if (TARGET_MEMORY_MISMATCH_STALL && !optimize_size)
+ if (TARGET_MEMORY_MISMATCH_STALL && !optimize_insn_for_size_p ())
return 0;
/* Don't even try to do any aligned optimizations with volatiles. */
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 3368108d050..ae23746e2a0 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -649,7 +649,7 @@
{
ix86_fixup_binary_operands_no_copy (DIV, V8SFmode, operands);
- if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_size
+ if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_insn_for_size_p ()
&& flag_finite_math_only && !flag_trapping_math
&& flag_unsafe_math_optimizations)
{
@@ -800,7 +800,7 @@
(sqrt:V8SF (match_operand:V8SF 1 "nonimmediate_operand" "")))]
"TARGET_AVX"
{
- if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_size
+ if (TARGET_SSE_MATH && TARGET_RECIP && !optimize_insn_for_size_p ()
&& flag_finite_math_only && !flag_trapping_math
&& flag_unsafe_math_optimizations)
{
@@ -986,7 +986,7 @@
(match_operand:AVXMODEF2P 2 "nonimmediate_operand" "xm")))]
"AVX_VEC_FLOAT_MODE_P (<MODE>mode) && flag_finite_math_only
&& ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
- "v<maxminfprefix>p<ssemodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+ "v<maxminfprefix>p<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sseadd")
(set_attr "prefix" "vex")
(set_attr "mode" "<MODE>")])
diff --git a/gcc/config/ia64/hpux.h b/gcc/config/ia64/hpux.h
index 2ce6f70558f..f7918d21aa4 100644
--- a/gcc/config/ia64/hpux.h
+++ b/gcc/config/ia64/hpux.h
@@ -46,11 +46,11 @@ do { \
builtin_define("__IA64__"); \
builtin_define("_LONGLONG"); \
builtin_define("_INCLUDE_LONGLONG"); \
+ builtin_define("__STDC_EXT__"); \
builtin_define("_UINT128_T"); \
if (c_dialect_cxx () || !flag_iso) \
{ \
builtin_define("_HPUX_SOURCE"); \
- builtin_define("__STDC_EXT__"); \
builtin_define("__STDCPP__"); \
builtin_define("_INCLUDE__STDC_A1_SOURCE"); \
} \
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 54514256e4f..9acb5702112 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -737,7 +737,7 @@ ia64_depz_field_mask (rtx rop, rtx rshift)
static enum tls_model
tls_symbolic_operand_type (rtx addr)
{
- enum tls_model tls_kind = 0;
+ enum tls_model tls_kind = TLS_MODEL_NONE;
if (GET_CODE (addr) == CONST)
{
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index 74e50788326..05957ea12db 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -1005,11 +1005,6 @@ enum reg_class
/* Eliminating the Frame Pointer and the Arg Pointer */
-/* A C expression which is nonzero if a function must have and use a frame
- pointer. This expression is evaluated in the reload pass. If its value is
- nonzero the function will have a frame pointer. */
-#define FRAME_POINTER_REQUIRED 0
-
/* Show we can debug even without a frame pointer. */
#define CAN_DEBUG_WITHOUT_FP
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index d853b1fbfc6..3b9e1166b27 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -165,6 +165,7 @@ static void iq2000_setup_incoming_varargs (CUMULATIVE_ARGS *,
static bool iq2000_rtx_costs (rtx, int, int, int *, bool);
static int iq2000_address_cost (rtx, bool);
static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
+static rtx iq2000_legitimize_address (rtx, rtx, enum machine_mode);
static bool iq2000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
@@ -186,6 +187,9 @@ static void iq2000_va_start (tree, rtx);
#undef TARGET_ASM_SELECT_SECTION
#define TARGET_ASM_SELECT_SECTION iq2000_select_section
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS iq2000_legitimize_address
+
/* The assembler supports switchable .bss sections, but
iq2000_select_section doesn't yet make use of them. */
#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
@@ -3214,6 +3218,73 @@ print_operand (FILE *file, rtx op, int letter)
output_addr_const (file, op);
}
+
+/* For the IQ2000, transform:
+
+ memory(X + <large int>)
+ into:
+ Y = <large int> & ~0x7fff;
+ Z = X + Y
+ memory (Z + (<large int> & 0x7fff));
+*/
+
+rtx
+iq2000_legitimize_address (rtx xinsn, rtx old_x ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
+{
+ if (TARGET_DEBUG_B_MODE)
+ {
+ GO_PRINTF ("\n========== LEGITIMIZE_ADDRESS\n");
+ GO_DEBUG_RTX (xinsn);
+ }
+
+ if (iq2000_check_split (xinsn, mode))
+ {
+ return gen_rtx_LO_SUM (Pmode,
+ copy_to_mode_reg (Pmode,
+ gen_rtx_HIGH (Pmode, xinsn)),
+ xinsn);
+ }
+
+ if (GET_CODE (xinsn) == PLUS)
+ {
+ rtx xplus0 = XEXP (xinsn, 0);
+ rtx xplus1 = XEXP (xinsn, 1);
+ enum rtx_code code0 = GET_CODE (xplus0);
+ enum rtx_code code1 = GET_CODE (xplus1);
+
+ if (code0 != REG && code1 == REG)
+ {
+ xplus0 = XEXP (xinsn, 1);
+ xplus1 = XEXP (xinsn, 0);
+ code0 = GET_CODE (xplus0);
+ code1 = GET_CODE (xplus1);
+ }
+
+ if (code0 == REG && REG_MODE_OK_FOR_BASE_P (xplus0, mode)
+ && code1 == CONST_INT && !SMALL_INT (xplus1))
+ {
+ rtx int_reg = gen_reg_rtx (Pmode);
+ rtx ptr_reg = gen_reg_rtx (Pmode);
+
+ emit_move_insn (int_reg,
+ GEN_INT (INTVAL (xplus1) & ~ 0x7fff));
+
+ emit_insn (gen_rtx_SET (VOIDmode,
+ ptr_reg,
+ gen_rtx_PLUS (Pmode, xplus0, int_reg)));
+
+ return plus_constant (ptr_reg, INTVAL (xplus1) & 0x7fff);
+ }
+ }
+
+ if (TARGET_DEBUG_B_MODE)
+ GO_PRINTF ("LEGITIMIZE_ADDRESS could not fix.\n");
+
+ return xinsn;
+}
+
+
static bool
iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total,
bool speed ATTRIBUTE_UNUSED)
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index 916e4060a5e..30642b2a13f 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -345,8 +345,6 @@ enum reg_class
/* Eliminating the Frame Pointer and the Arg Pointer. */
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
@@ -546,72 +544,6 @@ typedef struct iq2000_args
#define REG_OK_FOR_INDEX_P(X) 0
-
-/* For the IQ2000, transform:
-
- memory(X + <large int>)
- into:
- Y = <large int> & ~0x7fff;
- Z = X + Y
- memory (Z + (<large int> & 0x7fff));
-*/
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ \
- rtx xinsn = (X); \
- \
- if (TARGET_DEBUG_B_MODE) \
- { \
- GO_PRINTF ("\n========== LEGITIMIZE_ADDRESS\n"); \
- GO_DEBUG_RTX (xinsn); \
- } \
- \
- if (iq2000_check_split (X, MODE)) \
- { \
- X = gen_rtx_LO_SUM (Pmode, \
- copy_to_mode_reg (Pmode, \
- gen_rtx_HIGH (Pmode, X)), \
- X); \
- goto WIN; \
- } \
- \
- if (GET_CODE (xinsn) == PLUS) \
- { \
- rtx xplus0 = XEXP (xinsn, 0); \
- rtx xplus1 = XEXP (xinsn, 1); \
- enum rtx_code code0 = GET_CODE (xplus0); \
- enum rtx_code code1 = GET_CODE (xplus1); \
- \
- if (code0 != REG && code1 == REG) \
- { \
- xplus0 = XEXP (xinsn, 1); \
- xplus1 = XEXP (xinsn, 0); \
- code0 = GET_CODE (xplus0); \
- code1 = GET_CODE (xplus1); \
- } \
- \
- if (code0 == REG && REG_MODE_OK_FOR_BASE_P (xplus0, MODE) \
- && code1 == CONST_INT && !SMALL_INT (xplus1)) \
- { \
- rtx int_reg = gen_reg_rtx (Pmode); \
- rtx ptr_reg = gen_reg_rtx (Pmode); \
- \
- emit_move_insn (int_reg, \
- GEN_INT (INTVAL (xplus1) & ~ 0x7fff)); \
- \
- emit_insn (gen_rtx_SET (VOIDmode, \
- ptr_reg, \
- gen_rtx_PLUS (Pmode, xplus0, int_reg))); \
- \
- X = plus_constant (ptr_reg, INTVAL (xplus1) & 0x7fff); \
- goto WIN; \
- } \
- } \
- \
- if (TARGET_DEBUG_B_MODE) \
- GO_PRINTF ("LEGITIMIZE_ADDRESS could not fix.\n"); \
-}
-
#define LEGITIMATE_CONSTANT_P(X) (1)
diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h
index ec98d81f93c..650c918b44a 100644
--- a/gcc/config/m32c/m32c-protos.h
+++ b/gcc/config/m32c/m32c-protos.h
@@ -79,7 +79,6 @@ rtx m32c_incoming_return_addr_rtx (void);
void m32c_initialize_trampoline (rtx, rtx, rtx);
int m32c_legitimate_address_p (MM, rtx, int);
int m32c_legitimate_constant_p (rtx);
-int m32c_legitimize_address (rtx *, rtx, MM);
int m32c_legitimize_reload_address (rtx *, MM, int, int, int);
rtx m32c_libcall_value (MM);
int m32c_limit_reload_class (MM, int);
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index cb09aef254c..6d386e3d8fd 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -442,14 +442,6 @@ m32c_init_expanders (void)
/* Storage Layout */
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN m32c_promote_function_return
-bool
-m32c_promote_function_return (const_tree fntype ATTRIBUTE_UNUSED)
-{
- return false;
-}
-
/* Register Basics */
/* Basic Characteristics of Registers */
@@ -1440,14 +1432,6 @@ m32c_initial_elimination_offset (int from, int to)
/* Passing Function Arguments on the Stack */
-#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES m32c_promote_prototypes
-static bool
-m32c_promote_prototypes (const_tree fntype ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
/* Implements PUSH_ROUNDING. The R8C and M16C have byte stacks, the
M32C has word stacks. */
int
@@ -1954,33 +1938,33 @@ m32c_reg_ok_for_base_p (rtx x, int strict)
displacement range. We deal with this by attempting to reload $fb
itself into an address register; that seems to result in the best
code. */
-int
-m32c_legitimize_address (rtx * x ATTRIBUTE_UNUSED,
- rtx oldx ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED)
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS m32c_legitimize_address
+static rtx
+m32c_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
{
#if DEBUG0
fprintf (stderr, "m32c_legitimize_address for mode %s\n", mode_name[mode]);
- debug_rtx (*x);
+ debug_rtx (x);
fprintf (stderr, "\n");
#endif
- if (GET_CODE (*x) == PLUS
- && GET_CODE (XEXP (*x, 0)) == REG
- && REGNO (XEXP (*x, 0)) == FB_REGNO
- && GET_CODE (XEXP (*x, 1)) == CONST_INT
- && (INTVAL (XEXP (*x, 1)) < -128
- || INTVAL (XEXP (*x, 1)) > (128 - GET_MODE_SIZE (mode))))
+ if (GET_CODE (x) == PLUS
+ && GET_CODE (XEXP (x, 0)) == REG
+ && REGNO (XEXP (x, 0)) == FB_REGNO
+ && GET_CODE (XEXP (x, 1)) == CONST_INT
+ && (INTVAL (XEXP (x, 1)) < -128
+ || INTVAL (XEXP (x, 1)) > (128 - GET_MODE_SIZE (mode))))
{
/* reload FB to A_REGS */
rtx temp = gen_reg_rtx (Pmode);
- *x = copy_rtx (*x);
- emit_insn (gen_rtx_SET (VOIDmode, temp, XEXP (*x, 0)));
- XEXP (*x, 0) = temp;
- return 1;
+ x = copy_rtx (x);
+ emit_insn (gen_rtx_SET (VOIDmode, temp, XEXP (x, 0)));
+ XEXP (x, 0) = temp;
}
- return 0;
+ return x;
}
/* Implements LEGITIMIZE_RELOAD_ADDRESS. See comment above. */
diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h
index 9e0c921f2ce..cb2b8bea1f0 100644
--- a/gcc/config/m32c/m32c.h
+++ b/gcc/config/m32c/m32c.h
@@ -587,10 +587,6 @@ typedef struct m32c_cumulative_args
/* #define FIND_BASE_TERM(X) when we do unspecs for symrefs */
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
- if (m32c_legitimize_address(&(X),OLDX,MODE)) \
- goto WIN;
-
#define LEGITIMIZE_RELOAD_ADDRESS(X,MODE,OPNUM,TYPE,IND_LEVELS,WIN) \
if (m32c_legitimize_reload_address(&(X),MODE,OPNUM,TYPE,IND_LEVELS)) \
goto WIN;
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index ff537382789..656c0eae1be 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -70,6 +70,7 @@ static void init_reg_tables (void);
static void block_move_call (rtx, rtx, rtx);
static int m32r_is_insn (rtx);
const struct attribute_spec m32r_attribute_table[];
+static rtx m32r_legitimize_address (rtx, rtx, enum machine_mode);
static tree m32r_handle_model_attribute (tree *, tree, tree, int, bool *);
static void m32r_output_function_prologue (FILE *, HOST_WIDE_INT);
static void m32r_output_function_epilogue (FILE *, HOST_WIDE_INT);
@@ -95,6 +96,9 @@ static int m32r_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
#undef TARGET_ATTRIBUTE_TABLE
#define TARGET_ATTRIBUTE_TABLE m32r_attribute_table
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS m32r_legitimize_address
+
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
#undef TARGET_ASM_ALIGNED_SI_OP
@@ -1728,6 +1732,16 @@ m32r_legitimize_pic_address (rtx orig, rtx reg)
return orig;
}
+
+static rtx
+m32r_legitimize_address (rtx x, rtx orig_x ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+ if (flag_pic)
+ return m32r_legitimize_pic_address (x, NULL_RTX);
+ else
+ return x;
+}
/* Nested function support. */
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index f2f7e891201..9bc0fa98a0a 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -1169,29 +1169,6 @@ L2: .word STATIC
} \
while (0)
-/* 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. */
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
- do \
- { \
- if (flag_pic) \
- (X) = m32r_legitimize_pic_address (X, NULL_RTX); \
- if (memory_address_p (MODE, X)) \
- 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. */
#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL) \
diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h
index 1e9cf585904..5412e1d3eea 100644
--- a/gcc/config/m68hc11/m68hc11-protos.h
+++ b/gcc/config/m68hc11/m68hc11-protos.h
@@ -50,8 +50,6 @@ extern enum reg_class preferred_reload_class (rtx, enum reg_class);
extern int m68hc11_go_if_legitimate_address (rtx, enum machine_mode, int);
-extern int m68hc11_legitimize_address (rtx*, rtx, enum machine_mode);
-
extern void m68hc11_notice_update_cc (rtx, rtx);
extern void m68hc11_notice_keep_cc (rtx);
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index 4fba4a39a1c..5050fa46415 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -789,14 +789,6 @@ m68hc11_go_if_legitimate_address (rtx operand, enum machine_mode mode,
return result;
}
-int
-m68hc11_legitimize_address (rtx *operand ATTRIBUTE_UNUSED,
- rtx old_operand ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED)
-{
- return 0;
-}
-
int
m68hc11_reload_operands (rtx operands[])
diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h
index ee28bb73eaa..35176592601 100644
--- a/gcc/config/m68hc11/m68hc11.h
+++ b/gcc/config/m68hc11/m68hc11.h
@@ -883,12 +883,6 @@ extern enum reg_class m68hc11_tmp_regs_class;
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}}
-/* 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
-
/* Given FROM and TO register numbers, say whether this elimination is allowed.
Frame pointer elimination is automatically handled.
@@ -1211,28 +1205,6 @@ extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER];
#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. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ rtx operand = (X); \
- if (m68hc11_legitimize_address (&operand, (OLDX), (MODE))) \
- { \
- (X) = operand; \
- GO_IF_LEGITIMATE_ADDRESS (MODE,X,WIN); \
- } \
-}
-
/* Nonzero if the constant value X is a legitimate general operand.
It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index bccb8348a55..e4bb1e2b4a2 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -143,6 +143,7 @@ static tree m68k_handle_fndecl_attribute (tree *node, tree name,
static void m68k_compute_frame_layout (void);
static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
static bool m68k_ok_for_sibcall_p (tree, tree);
+static rtx m68k_legitimize_address (rtx, rtx, enum machine_mode);
static bool m68k_rtx_costs (rtx, int, int, int *, bool);
#if M68K_HONOR_TARGET_STRICT_ALIGNMENT
static bool m68k_return_in_memory (const_tree, const_tree);
@@ -195,6 +196,9 @@ int m68k_last_compare_had_fp_operands;
#undef TARGET_ASM_FILE_START_APP_OFF
#define TARGET_ASM_FILE_START_APP_OFF true
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS m68k_legitimize_address
+
#undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST m68k_sched_adjust_cost
@@ -1422,6 +1426,83 @@ m68k_legitimize_sibcall_address (rtx x)
return replace_equiv_address (x, gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM));
}
+/* Convert X to a legitimate address and return it if successful. Otherwise
+ return X.
+
+ For the 68000, we handle X+REG by loading X into a register R and
+ using R+REG. R will go in an address 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 an address reg. */
+
+rtx
+m68k_legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
+{
+ if (GET_CODE (x) == PLUS)
+ {
+ int ch = (x) != (oldx);
+ int copied = 0;
+
+#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
+
+ if (GET_CODE (XEXP (x, 0)) == MULT)
+ {
+ COPY_ONCE (x);
+ XEXP (x, 0) = force_operand (XEXP (x, 0), 0);
+ }
+ if (GET_CODE (XEXP (x, 1)) == MULT)
+ {
+ COPY_ONCE (x);
+ XEXP (x, 1) = force_operand (XEXP (x, 1), 0);
+ }
+ if (ch)
+ {
+ if (GET_CODE (XEXP (x, 1)) == REG
+ && GET_CODE (XEXP (x, 0)) == REG)
+ {
+ if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT)
+ {
+ COPY_ONCE (x);
+ x = force_operand (x, 0);
+ }
+ return x;
+ }
+ if (memory_address_p (mode, x))
+ return x;
+ }
+ if (GET_CODE (XEXP (x, 0)) == REG
+ || (GET_CODE (XEXP (x, 0)) == SIGN_EXTEND
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
+ && GET_MODE (XEXP (XEXP (x, 0), 0)) == HImode))
+ {
+ rtx temp = gen_reg_rtx (Pmode);
+ rtx val = force_operand (XEXP (x, 1), 0);
+ emit_move_insn (temp, val);
+ COPY_ONCE (x);
+ XEXP (x, 1) = temp;
+ if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && GET_CODE (XEXP (x, 0)) == REG)
+ x = force_operand (x, 0);
+ }
+ else if (GET_CODE (XEXP (x, 1)) == REG
+ || (GET_CODE (XEXP (x, 1)) == SIGN_EXTEND
+ && GET_CODE (XEXP (XEXP (x, 1), 0)) == REG
+ && GET_MODE (XEXP (XEXP (x, 1), 0)) == HImode))
+ {
+ rtx temp = gen_reg_rtx (Pmode);
+ rtx val = force_operand (XEXP (x, 0), 0);
+ emit_move_insn (temp, val);
+ COPY_ONCE (x);
+ XEXP (x, 0) = temp;
+ if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (mode) == MODE_FLOAT
+ && GET_CODE (XEXP (x, 1)) == REG)
+ x = force_operand (x, 0);
+ }
+ }
+
+ return x;
+}
+
+
/* Output a dbCC; jCC sequence. Note we do not handle the
floating point version of this sequence (Fdbcc). We also
do not handle alternative conditions when CC_NO_OVERFLOW is
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index bb28e887aa9..875667dc428 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -453,8 +453,6 @@ along with GCC; see the file COPYING3. If not see
pointer is shifted to %a5 on this target. */
#define FRAME_POINTER_REGNUM A6_REG
-#define FRAME_POINTER_REQUIRED 0
-
/* Base register for access to arguments of the function.
* This isn't a hardware register. It will be eliminated to the
* stack pointer or frame pointer.
@@ -767,56 +765,9 @@ __transfer_from_trampoline () \
} \
while (0)
+
/* This address is OK as it stands. */
#define PIC_CASE_VECTOR_ADDRESS(index) index
-
-/* For the 68000, we handle X+REG by loading X into a register R and
- using R+REG. R will go in an address 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 an address reg. */
-#define COPY_ONCE(Y) if (!copied) { Y = copy_rtx (Y); copied = ch = 1; }
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ register int ch = (X) != (OLDX); \
- if (GET_CODE (X) == PLUS) \
- { int copied = 0; \
- if (GET_CODE (XEXP (X, 0)) == MULT) \
- { COPY_ONCE (X); XEXP (X, 0) = force_operand (XEXP (X, 0), 0);} \
- if (GET_CODE (XEXP (X, 1)) == MULT) \
- { COPY_ONCE (X); XEXP (X, 1) = force_operand (XEXP (X, 1), 0);} \
- if (ch && GET_CODE (XEXP (X, 1)) == REG \
- && GET_CODE (XEXP (X, 0)) == REG) \
- { if (TARGET_COLDFIRE_FPU \
- && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
- { COPY_ONCE (X); X = force_operand (X, 0);} \
- goto WIN; } \
- if (ch) { GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN); } \
- if (GET_CODE (XEXP (X, 0)) == REG \
- || (GET_CODE (XEXP (X, 0)) == SIGN_EXTEND \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == REG \
- && GET_MODE (XEXP (XEXP (X, 0), 0)) == HImode)) \
- { register rtx temp = gen_reg_rtx (Pmode); \
- register rtx val = force_operand (XEXP (X, 1), 0); \
- emit_move_insn (temp, val); \
- COPY_ONCE (X); \
- XEXP (X, 1) = temp; \
- if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && GET_CODE (XEXP (X, 0)) == REG) \
- X = force_operand (X, 0); \
- goto WIN; } \
- else if (GET_CODE (XEXP (X, 1)) == REG \
- || (GET_CODE (XEXP (X, 1)) == SIGN_EXTEND \
- && GET_CODE (XEXP (XEXP (X, 1), 0)) == REG \
- && GET_MODE (XEXP (XEXP (X, 1), 0)) == HImode)) \
- { register rtx temp = gen_reg_rtx (Pmode); \
- register rtx val = force_operand (XEXP (X, 0), 0); \
- emit_move_insn (temp, val); \
- COPY_ONCE (X); \
- XEXP (X, 0) = temp; \
- if (TARGET_COLDFIRE_FPU && GET_MODE_CLASS (MODE) == MODE_FLOAT \
- && GET_CODE (XEXP (X, 1)) == REG) \
- X = force_operand (X, 0); \
- goto WIN; }}}
-
#define CASE_VECTOR_MODE HImode
#define CASE_VECTOR_PC_RELATIVE 1
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 224491ab05c..bbdc24811b8 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -303,11 +303,6 @@ extern int mcore_stack_increment;
#define MODES_TIEABLE_P(MODE1, MODE2) \
((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
-/* 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. */
-#define FRAME_POINTER_REQUIRED 0
-
/* Definitions for register eliminations.
We have two registers that can be eliminated on the MCore. First, the
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index 1f8054ede9c..b95461a4c4f 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -196,7 +196,6 @@ extern rtx mips_pic_base_register (rtx);
extern rtx mips_got_load (rtx, rtx, enum mips_symbol_type);
extern bool mips_split_symbol (rtx, rtx, enum machine_mode, rtx *);
extern rtx mips_unspec_address (rtx, enum mips_symbol_type);
-extern bool mips_legitimize_address (rtx *, enum machine_mode);
extern void mips_move_integer (rtx, rtx, unsigned HOST_WIDE_INT);
extern bool mips_legitimize_move (enum machine_mode, rtx, rtx);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index a677f9392b4..b40ba3ba5fe 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -285,10 +285,10 @@ struct GTY(()) mips_frame_info {
HOST_WIDE_INT acc_sp_offset;
HOST_WIDE_INT cop0_sp_offset;
- /* The offset of arg_pointer_rtx from frame_pointer_rtx. */
+ /* The offset of arg_pointer_rtx from the bottom of the frame. */
HOST_WIDE_INT arg_pointer_offset;
- /* The offset of hard_frame_pointer_rtx from frame_pointer_rtx. */
+ /* The offset of hard_frame_pointer_rtx from the bottom of the frame. */
HOST_WIDE_INT hard_frame_pointer_offset;
};
@@ -2703,8 +2703,10 @@ mips_add_offset (rtx temp, rtx reg, HOST_WIDE_INT offset)
}
else
{
- /* Leave OFFSET as a 16-bit offset and put the excess in HIGH. */
- high = GEN_INT (CONST_HIGH_PART (offset));
+ /* Leave OFFSET as a 16-bit offset and put the excess in HIGH.
+ The addition inside the macro CONST_HIGH_PART may cause an
+ overflow, so we need to force a sign-extension check. */
+ high = gen_int_mode (CONST_HIGH_PART (offset), Pmode);
offset = CONST_LOW_PART (offset);
}
high = mips_force_temporary (temp, high);
@@ -2846,41 +2848,36 @@ mips_force_address (rtx x, enum machine_mode mode)
return x;
}
-/* This function is used to implement LEGITIMIZE_ADDRESS. If *XLOC can
+/* This function is used to implement LEGITIMIZE_ADDRESS. If X can
be legitimized in a way that the generic machinery might not expect,
- put the new address in *XLOC and return true. MODE is the mode of
+ return a new address, otherwise return NULL. MODE is the mode of
the memory being accessed. */
-bool
-mips_legitimize_address (rtx *xloc, enum machine_mode mode)
+static rtx
+mips_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
{
rtx base, addr;
HOST_WIDE_INT offset;
- if (mips_tls_symbol_p (*xloc))
- {
- *xloc = mips_legitimize_tls_address (*xloc);
- return true;
- }
+ if (mips_tls_symbol_p (x))
+ return mips_legitimize_tls_address (x);
/* See if the address can split into a high part and a LO_SUM. */
- if (mips_split_symbol (NULL, *xloc, mode, &addr))
- {
- *xloc = mips_force_address (addr, mode);
- return true;
- }
+ if (mips_split_symbol (NULL, x, mode, &addr))
+ return mips_force_address (addr, mode);
/* Handle BASE + OFFSET using mips_add_offset. */
- mips_split_plus (*xloc, &base, &offset);
+ mips_split_plus (x, &base, &offset);
if (offset != 0)
{
if (!mips_valid_base_register_p (base, mode, false))
base = copy_to_mode_reg (Pmode, base);
addr = mips_add_offset (NULL, base, offset);
- *xloc = mips_force_address (addr, mode);
- return true;
+ return mips_force_address (addr, mode);
}
- return false;
+
+ return x;
}
/* Load VALUE into DEST. TEMP is as for mips_force_temporary. */
@@ -8671,16 +8668,16 @@ mips_save_reg_p (unsigned int regno)
| | + UNITS_PER_WORD
| accumulator save area |
| |
- +-------------------------------+ <-- frame_pointer_rtx + fp_sp_offset
+ +-------------------------------+ <-- stack_pointer_rtx + fp_sp_offset
| | + UNITS_PER_HWFPVALUE
| FPR save area |
| |
- +-------------------------------+ <-- frame_pointer_rtx + gp_sp_offset
+ +-------------------------------+ <-- stack_pointer_rtx + gp_sp_offset
| | + UNITS_PER_WORD
| GPR save area |
| |
- +-------------------------------+
- | | \
+ +-------------------------------+ <-- frame_pointer_rtx with
+ | | \ -fstack-protector
| local variables | | var_size
| | /
+-------------------------------+
@@ -8688,16 +8685,17 @@ mips_save_reg_p (unsigned int regno)
| $gp save area | | cprestore_size
| | /
P +-------------------------------+ <-- hard_frame_pointer_rtx for
- | | MIPS16 code
- | outgoing stack arguments |
- | |
- +-------------------------------+
- | |
- | caller-allocated save area |
- | for register arguments |
- | |
+ | | \ MIPS16 code
+ | outgoing stack arguments | |
+ | | |
+ +-------------------------------+ | args_size
+ | | |
+ | caller-allocated save area | |
+ | for register arguments | |
+ | | /
+-------------------------------+ <-- stack_pointer_rtx
- frame_pointer_rtx
+ frame_pointer_rtx without
+ -fstack-protector
hard_frame_pointer_rtx for
non-MIPS16 code.
@@ -8742,11 +8740,11 @@ mips_compute_frame_info (void)
cfun->machine->global_pointer = mips_global_pointer ();
- /* The first STARTING_FRAME_OFFSET bytes contain the outgoing argument
- area and the $gp save slot. This area isn't needed in leaf functions,
- but if the target-independent frame size is nonzero, we're committed
- to allocating it anyway. */
- if (size == 0 && current_function_is_leaf)
+ /* The first two blocks contain the outgoing argument area and the $gp save
+ slot. This area isn't needed in leaf functions, but if the
+ target-independent frame size is nonzero, we have already committed to
+ allocating these in STARTING_FRAME_OFFSET for !FRAME_GROWS_DOWNWARD. */
+ if ((size == 0 || FRAME_GROWS_DOWNWARD) && current_function_is_leaf)
{
/* The MIPS 3.0 linker does not like functions that dynamically
allocate the stack and have 0 for STACK_DYNAMIC_OFFSET, since it
@@ -8761,7 +8759,7 @@ mips_compute_frame_info (void)
else
{
frame->args_size = crtl->outgoing_args_size;
- frame->cprestore_size = STARTING_FRAME_OFFSET - frame->args_size;
+ frame->cprestore_size = MIPS_GP_SAVE_AREA_SIZE;
}
offset = frame->args_size + frame->cprestore_size;
@@ -8940,12 +8938,16 @@ mips_initial_elimination_offset (int from, int to)
mips_compute_frame_info ();
- /* Set OFFSET to the offset from the soft frame pointer, which is also
- the offset from the end-of-prologue stack pointer. */
+ /* Set OFFSET to the offset from the end-of-prologue stack pointer. */
switch (from)
{
case FRAME_POINTER_REGNUM:
- offset = 0;
+ if (FRAME_GROWS_DOWNWARD)
+ offset = (cfun->machine->frame.args_size
+ + cfun->machine->frame.cprestore_size
+ + cfun->machine->frame.var_size);
+ else
+ offset = 0;
break;
case ARG_POINTER_REGNUM:
@@ -11642,8 +11644,9 @@ AVAIL_NON_MIPS16 (cache, TARGET_CACHE_BUILTIN)
for instruction CODE_FOR_loongson_<INSN>. FUNCTION_TYPE is a
builtin_description field. */
#define LOONGSON_BUILTIN_ALIAS(INSN, FN_NAME, FUNCTION_TYPE) \
- { CODE_FOR_loongson_ ## INSN, 0, "__builtin_loongson_" #FN_NAME, \
- MIPS_BUILTIN_DIRECT, FUNCTION_TYPE, mips_builtin_avail_loongson }
+ { CODE_FOR_loongson_ ## INSN, MIPS_FP_COND_f, \
+ "__builtin_loongson_" #FN_NAME, MIPS_BUILTIN_DIRECT, \
+ FUNCTION_TYPE, mips_builtin_avail_loongson }
/* Define a Loongson MIPS_BUILTIN_DIRECT function __builtin_loongson_<INSN>
for instruction CODE_FOR_loongson_<INSN>. FUNCTION_TYPE is a
@@ -14741,6 +14744,9 @@ mips_final_postscan_insn (FILE *file, rtx insn, rtx *opvec, int noperands)
#undef TARGET_ASM_ALIGNED_DI_OP
#define TARGET_ASM_ALIGNED_DI_OP "\t.dword\t"
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS mips_legitimize_address
+
#undef TARGET_ASM_FUNCTION_PROLOGUE
#define TARGET_ASM_FUNCTION_PROLOGUE mips_output_function_prologue
#undef TARGET_ASM_FUNCTION_EPILOGUE
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 7e3d57e7300..5c68688ccce 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2081,12 +2081,20 @@ enum reg_class
#define STACK_GROWS_DOWNWARD
-/* The offset of the first local variable from the beginning of the frame.
- See mips_compute_frame_info for details about the frame layout. */
+#define FRAME_GROWS_DOWNWARD flag_stack_protect
-#define STARTING_FRAME_OFFSET \
- (crtl->outgoing_args_size \
- + (TARGET_CALL_CLOBBERED_GP ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0))
+/* Size of the area allocated in the frame to save the GP. */
+
+#define MIPS_GP_SAVE_AREA_SIZE \
+ (TARGET_CALL_CLOBBERED_GP ? MIPS_STACK_ALIGN (UNITS_PER_WORD) : 0)
+
+/* The offset of the first local variable from the frame pointer. See
+ mips_compute_frame_info for details about the frame layout. */
+
+#define STARTING_FRAME_OFFSET \
+ (FRAME_GROWS_DOWNWARD \
+ ? 0 \
+ : crtl->outgoing_args_size + MIPS_GP_SAVE_AREA_SIZE)
#define RETURN_ADDR_RTX mips_return_addr
@@ -2518,13 +2526,6 @@ typedef struct mips_args {
#define LEGITIMATE_CONSTANT_P(X) (mips_const_insns (X) > 0)
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
- do { \
- if (mips_legitimize_address (&(X), MODE)) \
- goto WIN; \
- } while (0)
-
-
/* This handles the magic '..CURRENT_FUNCTION' symbol, which means
'the start of the function that this code is output in'. */
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 8453aab3deb..95ba6ba2620 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -285,10 +285,12 @@
;; the target address into a register.
(define_attr "jal_macro" "no,yes"
(cond [(eq_attr "jal" "direct")
- (symbol_ref "TARGET_CALL_CLOBBERED_GP
- || (flag_pic && !TARGET_ABSOLUTE_ABICALLS)")
+ (symbol_ref "((TARGET_CALL_CLOBBERED_GP
+ || (flag_pic && !TARGET_ABSOLUTE_ABICALLS))
+ ? JAL_MACRO_YES : JAL_MACRO_NO)")
(eq_attr "jal" "indirect")
- (symbol_ref "TARGET_CALL_CLOBBERED_GP")]
+ (symbol_ref "(TARGET_CALL_CLOBBERED_GP
+ ? JAL_MACRO_YES : JAL_MACRO_NO)")]
(const_string "no")))
;; Classification of moves, extensions and truncations. Most values
@@ -602,7 +604,8 @@
;; Is it a single instruction?
(define_attr "single_insn" "no,yes"
- (symbol_ref "get_attr_length (insn) == (TARGET_MIPS16 ? 2 : 4)"))
+ (symbol_ref "(get_attr_length (insn) == (TARGET_MIPS16 ? 2 : 4)
+ ? SINGLE_INSN_YES : SINGLE_INSN_NO)"))
;; Can the instruction be put into a delay slot?
(define_attr "can_delay" "no,yes"
diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h
index d8fe2bd50a1..935cb8f81f6 100644
--- a/gcc/config/mn10300/mn10300-protos.h
+++ b/gcc/config/mn10300/mn10300-protos.h
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see
#ifdef RTX_CODE
extern void mn10300_override_options (void);
-extern struct rtx_def *legitimize_address (rtx, rtx, enum machine_mode);
extern rtx legitimize_pic_address (rtx, rtx);
extern int legitimate_pic_operand_p (rtx);
extern bool legitimate_address_p (enum machine_mode, rtx, int);
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 1eb80ec78bb..ceb77e862c2 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -76,6 +76,7 @@ static void mn10300_file_start (void);
static bool mn10300_return_in_memory (const_tree, const_tree);
static rtx mn10300_builtin_saveregs (void);
static void mn10300_va_start (tree, rtx);
+static rtx mn10300_legitimize_address (rtx, rtx, enum machine_mode);
static bool mn10300_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static int mn10300_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
@@ -86,6 +87,9 @@ static unsigned int mn10300_case_values_threshold (void);
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS mn10300_legitimize_address
+
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS mn10300_rtx_costs
#undef TARGET_ADDRESS_COST
@@ -1795,8 +1799,8 @@ symbolic_operand (register rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
But on a few ports with segmented architectures and indexed addressing
(mn10300, hppa) it is used to rewrite certain problematical addresses. */
rtx
-legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED)
+mn10300_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED)
{
if (flag_pic && ! legitimate_pic_operand_p (x))
x = legitimize_pic_address (oldx, NULL_RTX);
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index b6486d9cf69..b35894435a2 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -491,7 +491,6 @@ enum reg_class {
/* We can debug without frame pointers on the mn10300, so eliminate
them whenever possible. */
-#define FRAME_POINTER_REQUIRED 0
#define CAN_DEBUG_WITHOUT_FP
/* Value is the number of bytes of arguments automatically
@@ -694,24 +693,6 @@ do \
while (0)
-/* 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. */
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ rtx orig_x = (X); \
- (X) = legitimize_address (X, OLDX, MODE); \
- if ((X) != orig_x && memory_address_p (MODE, X)) \
- goto WIN; }
/* Nonzero if the constant value X is a legitimate general operand.
It is given that X satisfies CONSTANT_P or is a CONST_DOUBLE. */
diff --git a/gcc/config/pa/linux-atomic.c b/gcc/config/pa/linux-atomic.c
index 00fdf526556..38e87297752 100644
--- a/gcc/config/pa/linux-atomic.c
+++ b/gcc/config/pa/linux-atomic.c
@@ -24,14 +24,9 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* FIXME: work around build failure for hppa64-linux-gnu target. */
-#ifndef _LP64
-#include <errno.h>
-#else
#define EFAULT 14
#define EBUSY 16
#define ENOSYS 251
-#endif
/* All PA-RISC implementations supported by linux have strongly
ordered loads and stores. Only cache flushes and purges can be
diff --git a/gcc/config/pa/pa-hpux.h b/gcc/config/pa/pa-hpux.h
index 937f8b92bdc..bd12d4fc68e 100644
--- a/gcc/config/pa/pa-hpux.h
+++ b/gcc/config/pa/pa-hpux.h
@@ -56,11 +56,11 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("__hpux__"); \
builtin_define ("__unix"); \
builtin_define ("__unix__"); \
+ builtin_define ("__STDC_EXT__"); \
if (c_dialect_cxx ()) \
{ \
builtin_define ("_HPUX_SOURCE"); \
builtin_define ("_INCLUDE_LONGLONG"); \
- builtin_define ("__STDC_EXT__"); \
} \
else if (!flag_iso) \
{ \
@@ -76,8 +76,6 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("_PWB"); \
builtin_define ("PWB"); \
} \
- else \
- builtin_define ("__STDC_EXT__"); \
} \
if (TARGET_SIO) \
builtin_define ("_SIO"); \
diff --git a/gcc/config/pa/pa-hpux10.h b/gcc/config/pa/pa-hpux10.h
index 72f753f09ad..c1294dfff0b 100644
--- a/gcc/config/pa/pa-hpux10.h
+++ b/gcc/config/pa/pa-hpux10.h
@@ -38,11 +38,11 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("__hpux__"); \
builtin_define ("__unix"); \
builtin_define ("__unix__"); \
+ builtin_define ("__STDC_EXT__"); \
if (c_dialect_cxx ()) \
{ \
builtin_define ("_HPUX_SOURCE"); \
builtin_define ("_INCLUDE_LONGLONG"); \
- builtin_define ("__STDC_EXT__"); \
builtin_define ("__STDCPP__"); \
} \
else if (!flag_iso) \
@@ -58,8 +58,6 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("_PWB"); \
builtin_define ("PWB"); \
} \
- else \
- builtin_define ("__STDC_EXT__"); \
} \
if (flag_pa_unix >= 1995) \
{ \
diff --git a/gcc/config/pa/pa-hpux11.h b/gcc/config/pa/pa-hpux11.h
index 8dd01d2563d..06b709c2350 100644
--- a/gcc/config/pa/pa-hpux11.h
+++ b/gcc/config/pa/pa-hpux11.h
@@ -37,11 +37,11 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("__hpux__"); \
builtin_define ("__unix"); \
builtin_define ("__unix__"); \
+ builtin_define ("__STDC_EXT__"); \
if (c_dialect_cxx ()) \
{ \
builtin_define ("_HPUX_SOURCE"); \
builtin_define ("_INCLUDE_LONGLONG"); \
- builtin_define ("__STDC_EXT__"); \
builtin_define ("__STDCPP__"); \
} \
else \
@@ -59,8 +59,6 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("_PWB"); \
builtin_define ("PWB"); \
} \
- else \
- builtin_define ("__STDC_EXT__"); \
} \
} \
if (!TARGET_64BIT) \
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index 7fc9dcad40f..3cd1f8580bc 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -29,8 +29,6 @@ extern int following_call (rtx);
extern int function_label_operand (rtx, enum machine_mode);
extern int lhs_lshift_cint_operand (rtx, enum machine_mode);
-extern rtx hppa_legitimize_address (rtx, rtx, enum machine_mode);
-
/* Define functions in pa.c and used in insn-output.c. */
extern const char *output_and (rtx *);
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 08c987fbedf..80f5fe90bc2 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -131,6 +131,7 @@ static bool pa_scalar_mode_supported_p (enum machine_mode);
static bool pa_commutative_p (const_rtx x, int outer_code);
static void copy_fp_args (rtx) ATTRIBUTE_UNUSED;
static int length_fp_args (rtx) ATTRIBUTE_UNUSED;
+static rtx hppa_legitimize_address (rtx, rtx, enum machine_mode);
static inline void pa_file_start_level (void) ATTRIBUTE_UNUSED;
static inline void pa_file_start_space (int) ATTRIBUTE_UNUSED;
static inline void pa_file_start_file (int) ATTRIBUTE_UNUSED;
@@ -228,6 +229,9 @@ static size_t n_deferred_plabels = 0;
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE pa_output_function_epilogue
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS hppa_legitimize_address
+
#undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST pa_adjust_cost
#undef TARGET_SCHED_ADJUST_PRIORITY
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index ee890935b30..303bdd341df 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1421,26 +1421,6 @@ do { \
} while (0)
-
-
-/* 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. */
-
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ rtx orig_x = (X); \
- (X) = hppa_legitimize_address (X, OLDX, MODE); \
- if ((X) != orig_x && memory_address_p (MODE, X)) \
- goto WIN; }
#define TARGET_ASM_SELECT_SECTION pa_select_section
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index 285b0e9cd6b..9dbb41eb7c1 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -246,14 +246,6 @@ extern const struct real_format pdp11_d_format;
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM 5
-/* 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 5
diff --git a/gcc/config/picochip/libgccExtras/divmod15.asm b/gcc/config/picochip/libgccExtras/divmod15.asm
index 777adf27968..b477e03a011 100644
--- a/gcc/config/picochip/libgccExtras/divmod15.asm
+++ b/gcc/config/picochip/libgccExtras/divmod15.asm
@@ -33,8 +33,6 @@ _picoMark_FUNCTION_BEGIN=
// picoChip Function Prologue : &__divmod15 = 0 bytes
-__divmod15:
-
// The picoChip instruction set has a divstep instruction which
// is used to perform one iteration of a binary division algorithm.
// The instruction allows 16-bit signed division to be implemented.
diff --git a/gcc/config/picochip/picochip.h b/gcc/config/picochip/picochip.h
index 24613d634d7..a3263d02e02 100644
--- a/gcc/config/picochip/picochip.h
+++ b/gcc/config/picochip/picochip.h
@@ -409,9 +409,6 @@ extern const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER];
pointers are eliminated wherever possible, by replacing them with
offsets from the stack pointer. */
-/* We want to get rid of the frame pointer. */
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
@@ -507,10 +504,6 @@ extern const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER];
#endif /* !REG_OK_STRICT */
-/* extern struct rtx_def *picochip_legitimize_address */
-/* PARAMS ((struct rtx_def *, struct rtx_def *, int)); */
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN);
-
/* Legitimize reload address tries machine dependent means of
reloading addresses. There seems to be a strange error in gcc,
which necessitates this macro. Consider:
@@ -736,6 +729,7 @@ enum picochip_builtins
PICOCHIP_BUILTIN_HALT
};
+#define NO_DOLLAR_IN_LABEL 1
#define NO_DOT_IN_LABEL 1
/* The assembler does support LEB128, despite the auto-configure test
diff --git a/gcc/config/rs6000/option-defaults.h b/gcc/config/rs6000/option-defaults.h
new file mode 100644
index 00000000000..682add7605d
--- /dev/null
+++ b/gcc/config/rs6000/option-defaults.h
@@ -0,0 +1,64 @@
+/* Definitions of default options for config/rs6000 configurations.
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, or (at your
+ option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+/* This header needs to be included after any other headers affecting
+ TARGET_DEFAULT. */
+
+#if TARGET_AIX
+#define OPT_64 "maix64"
+#define OPT_32 "maix32"
+#else
+#define OPT_64 "m64"
+#define OPT_32 "m32"
+#endif
+
+#ifndef MASK_64BIT
+#define MASK_64BIT 0
+#endif
+
+#if TARGET_DEFAULT & MASK_64BIT
+#define OPT_ARCH64 "!"OPT_32
+#define OPT_ARCH32 OPT_32
+#else
+#define OPT_ARCH64 OPT_64
+#define OPT_ARCH32 "!"OPT_64
+#endif
+
+/* Support for a compile-time default CPU, et cetera. The rules are:
+ --with-cpu is ignored if -mcpu is specified; likewise --with-cpu-32
+ and --with-cpu-64.
+ --with-tune is ignored if -mtune is specified; likewise --with-tune-32
+ and --with-tune-64.
+ --with-float is ignored if -mhard-float or -msoft-float are
+ specified. */
+#define OPTION_DEFAULT_SPECS \
+ {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }, \
+ {"cpu_32", "%{" OPT_ARCH32 ":%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+ {"cpu_64", "%{" OPT_ARCH64 ":%{!mcpu=*:-mcpu=%(VALUE)}}" }, \
+ {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+ {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \
+ {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:-mtune=%(VALUE)}}" }, \
+ {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 89e01c2a2eb..7ebc14cb1fc 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2884,7 +2884,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
- { 0, 0, 0, 0, 0, 0 }
+ { (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 }
};
diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h
index c898d51e3a3..4b8f5220a51 100644
--- a/gcc/config/rs6000/rs6000-protos.h
+++ b/gcc/config/rs6000/rs6000-protos.h
@@ -107,7 +107,6 @@ extern rtx create_TOC_reference (rtx);
extern void rs6000_split_multireg_move (rtx, rtx);
extern void rs6000_emit_move (rtx, rtx, enum machine_mode);
extern rtx rs6000_secondary_memory_needed_rtx (enum machine_mode);
-extern rtx rs6000_legitimize_address (rtx, rtx, enum machine_mode);
extern rtx rs6000_legitimize_reload_address (rtx, enum machine_mode,
int, int, int, int *);
extern int rs6000_legitimate_address (enum machine_mode, rtx, int);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 91b44affe42..4e230439098 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -917,6 +917,7 @@ static rtx generate_set_vrsave (rtx, rs6000_stack_t *, int);
int easy_vector_constant (rtx, enum machine_mode);
static rtx rs6000_dwarf_register_span (rtx);
static void rs6000_init_dwarf_reg_sizes_extra (tree);
+static rtx rs6000_legitimize_address (rtx, rtx, enum machine_mode);
static rtx rs6000_legitimize_tls_address (rtx, enum tls_model);
static void rs6000_output_dwarf_dtprel (FILE *, int, rtx) ATTRIBUTE_UNUSED;
static rtx rs6000_tls_get_addr (void);
@@ -1103,6 +1104,9 @@ static const char alt_reg_names[][8] =
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE rs6000_output_function_epilogue
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS rs6000_legitimize_address
+
#undef TARGET_SCHED_VARIABLE_ISSUE
#define TARGET_SCHED_VARIABLE_ISSUE rs6000_variable_issue
@@ -3873,7 +3877,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
|| mode == DImode)))
{
if (mode == DImode)
- return NULL_RTX;
+ return x;
/* We accept [reg + reg] and [reg + OFFSET]. */
if (GET_CODE (x) == PLUS)
@@ -3945,7 +3949,7 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
return create_TOC_reference (x);
}
else
- return NULL_RTX;
+ return x;
}
/* This is called from dwarf2out.c via TARGET_ASM_OUTPUT_DWARF_DTPREL.
@@ -4454,7 +4458,7 @@ rs6000_legitimate_address (enum machine_mode mode, rtx x, int reg_ok_strict)
if (mode != TImode
&& mode != TFmode
&& mode != TDmode
- && ((TARGET_HARD_FLOAT && TARGET_FPRS)
+ && ((TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT)
|| TARGET_POWERPC64
|| (mode != DFmode && mode != DDmode)
|| (TARGET_E500_DOUBLE && mode != DDmode))
@@ -7691,9 +7695,9 @@ static const struct builtin_description_predicates bdesc_altivec_preds[] =
{ MASK_ALTIVEC, CODE_FOR_altivec_predicate_v16qi, "*vcmpgtsb.", "__builtin_altivec_vcmpgtsb_p", ALTIVEC_BUILTIN_VCMPGTSB_P },
{ MASK_ALTIVEC, CODE_FOR_altivec_predicate_v16qi, "*vcmpgtub.", "__builtin_altivec_vcmpgtub_p", ALTIVEC_BUILTIN_VCMPGTUB_P },
- { MASK_ALTIVEC, 0, NULL, "__builtin_vec_vcmpeq_p", ALTIVEC_BUILTIN_VCMPEQ_P },
- { MASK_ALTIVEC, 0, NULL, "__builtin_vec_vcmpgt_p", ALTIVEC_BUILTIN_VCMPGT_P },
- { MASK_ALTIVEC, 0, NULL, "__builtin_vec_vcmpge_p", ALTIVEC_BUILTIN_VCMPGE_P }
+ { MASK_ALTIVEC, CODE_FOR_nothing, NULL, "__builtin_vec_vcmpeq_p", ALTIVEC_BUILTIN_VCMPEQ_P },
+ { MASK_ALTIVEC, CODE_FOR_nothing, NULL, "__builtin_vec_vcmpgt_p", ALTIVEC_BUILTIN_VCMPGT_P },
+ { MASK_ALTIVEC, CODE_FOR_nothing, NULL, "__builtin_vec_vcmpge_p", ALTIVEC_BUILTIN_VCMPGE_P }
};
/* SPE predicates. */
@@ -11545,6 +11549,7 @@ rs6000_check_sdmode (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
case PARM_DECL:
case FIELD_DECL:
case RESULT_DECL:
+ case SSA_NAME:
case REAL_CST:
case INDIRECT_REF:
case ALIGN_INDIRECT_REF:
@@ -22625,7 +22630,8 @@ rs6000_libcall_value (enum machine_mode mode)
/* _Decimal128 must use an even/odd register pair. */
regno = (mode == TDmode) ? FP_ARG_RETURN + 1 : FP_ARG_RETURN;
else if (SCALAR_FLOAT_MODE_P (mode)
- && TARGET_HARD_FLOAT && TARGET_FPRS)
+ && TARGET_HARD_FLOAT && TARGET_FPRS
+ && ((TARGET_SINGLE_FLOAT && mode == SFmode) || TARGET_DOUBLE_FLOAT))
regno = FP_ARG_RETURN;
else if (ALTIVEC_VECTOR_MODE (mode)
&& TARGET_ALTIVEC && TARGET_ALTIVEC_ABI)
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 7bffea52a41..f11ea1fe249 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -377,16 +377,6 @@ enum group_termination
previous_group
};
-/* Support for a compile-time default CPU, et cetera. The rules are:
- --with-cpu is ignored if -mcpu is specified.
- --with-tune is ignored if -mtune is specified.
- --with-float is ignored if -mhard-float or -msoft-float are
- specified. */
-#define OPTION_DEFAULT_SPECS \
- {"cpu", "%{!mcpu=*:-mcpu=%(VALUE)}" }, \
- {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
- {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }
-
/* rs6000_select[0] is reserved for the default cpu defined via --with-cpu */
struct rs6000_cpu_select
{
@@ -1037,12 +1027,6 @@ extern int rs6000_xilinx_fpu;
/* Base register for access to local variables of the function. */
#define FRAME_POINTER_REGNUM 113
-/* 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 67
@@ -1828,38 +1812,6 @@ typedef struct rs6000_args
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 RS/6000, first check for the sum of a register with a constant
- integer that is out of range. If so, generate code to add the
- constant with the low-order 16 bits masked to the register and force
- this result into another register (this can be done with `cau').
- Then generate an address of REG+(CONST&0xffff), allowing for the
- possibility of bit 16 being a one.
-
- Then check for the sum of a register and something not constant, try to
- load the other things into a register and return the sum. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ rtx result = rs6000_legitimize_address (X, OLDX, MODE); \
- if (result != NULL_RTX) \
- { \
- (X) = result; \
- 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.
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index cb7c404567a..cc37d911dbb 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -8595,7 +8595,7 @@
[(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
(match_operand:DF 1 "input_operand" "r,m,r,G,H,F"))]
"! TARGET_POWERPC64
- && ((TARGET_FPRS && !TARGET_DOUBLE_FLOAT)
+ && ((TARGET_FPRS && TARGET_SINGLE_FLOAT)
|| TARGET_SOFT_FLOAT || TARGET_E500_SINGLE)
&& (gpc_reg_operand (operands[0], DFmode)
|| gpc_reg_operand (operands[1], DFmode))"
diff --git a/gcc/config/rs6000/t-xilinx b/gcc/config/rs6000/t-xilinx
new file mode 100644
index 00000000000..11102f4d00d
--- /dev/null
+++ b/gcc/config/rs6000/t-xilinx
@@ -0,0 +1,56 @@
+# Multilibs for Xilinx powerpc embedded ELF targets.
+#
+# Copyright (C) 2009 Free Software Foundation, Inc.
+# Contributed by Michael Eager, eager@eagercon.com
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Switch synonyms
+MULTILIB_MATCHES = mfpu?sp_lite=msingle-float mfpu?dp_lite=mdouble-float mfpu?dp_lite=mhard-float mfpu?sp_lite=mfpu?sp_full mfpu?dp_lite=mfpu?dp_full
+
+MULTILIB_OPTIONS = mfpu=sp_lite/mfpu=dp_lite
+
+MULTILIB_DIRNAMES = single double
+
+# Multilibs for Xilinx powerpc embedded ELF targets.
+#
+# Copyright (C) 2009 Free Software Foundation, Inc.
+# Contributed by Michael Eager, eager@eagercon.com
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Switch synonyms
+MULTILIB_MATCHES = mfpu?sp_lite=msingle-float mfpu?dp_lite=mdouble-float mfpu?dp_lite=mhard-float mfpu?sp_lite=mfpu?sp_full mfpu?dp_lite=mfpu?dp_full
+
+MULTILIB_OPTIONS = mfpu=sp_lite/mfpu=dp_lite
+
+MULTILIB_DIRNAMES = single double
+
diff --git a/gcc/config/rs6000/xilinx.h b/gcc/config/rs6000/xilinx.h
index b423876e312..3b59141a2a2 100644
--- a/gcc/config/rs6000/xilinx.h
+++ b/gcc/config/rs6000/xilinx.h
@@ -20,6 +20,15 @@
/* Set defaults for Xilinx embedded target boards. */
+#undef CPP_SPEC
+#define CPP_SPEC "\
+-mxilinx-fpu \
+%{mfpu=sp_lite: -DHAVE_XFPU_SP_LITE} \
+%{mfpu=sp_full: -DHAVE_XFPU_SP_FULL} \
+%{mfpu=dp_lite: -DHAVE_XFPU_DP_LITE} \
+%{mfpu=dp_full: -DHAVE_XFPU_DP_FULL} \
+%{mfpu=*: -DHAVE_XFPU}"
+
#undef LIB_DEFAULT_SPEC
#define LIB_DEFAULT_SPEC "\
%{!nostdlib: --start-group -lxil -lc -lm --end-group \
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 76f73f9dd2c..3bde1c14b48 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -74,7 +74,6 @@ extern int legitimate_constant_p (rtx);
extern bool legitimate_reload_constant_p (rtx);
extern bool legitimate_address_p (enum machine_mode, rtx, int);
extern rtx legitimize_pic_address (rtx, rtx);
-extern rtx legitimize_address (rtx, rtx, enum machine_mode);
extern rtx legitimize_reload_address (rtx, enum machine_mode, int, int);
extern enum reg_class s390_preferred_reload_class (rtx, enum reg_class);
extern enum reg_class s390_secondary_input_reload_class (enum reg_class,
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 10fdb4e267c..e2ed4a0d407 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -248,10 +248,10 @@ struct s390_address
/* Which cpu are we tuning for. */
enum processor_type s390_tune = PROCESSOR_max;
-enum processor_flags s390_tune_flags;
+int s390_tune_flags;
/* Which instruction set architecture to use. */
enum processor_type s390_arch;
-enum processor_flags s390_arch_flags;
+int s390_arch_flags;
HOST_WIDE_INT s390_warn_framesize = 0;
HOST_WIDE_INT s390_stack_size = 0;
@@ -1471,13 +1471,13 @@ optimization_options (int level ATTRIBUTE_UNUSED, int size ATTRIBUTE_UNUSED)
static bool
s390_handle_arch_option (const char *arg,
enum processor_type *type,
- enum processor_flags *flags)
+ int *flags)
{
static struct pta
{
const char *const name; /* processor name or nickname. */
const enum processor_type processor;
- const enum processor_flags flags;
+ const int flags; /* From enum processor_flags. */
}
const processor_alias_table[] =
{
@@ -3734,9 +3734,9 @@ emit_symbolic_move (rtx *operands)
When -fpic is used, special handling is needed for symbolic references.
See comments by legitimize_pic_address for details. */
-rtx
-legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
- enum machine_mode mode ATTRIBUTE_UNUSED)
+static rtx
+s390_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED)
{
rtx constant_term = const0_rtx;
@@ -9909,6 +9909,9 @@ s390_reorg (void)
#undef TARGET_DELEGITIMIZE_ADDRESS
#define TARGET_DELEGITIMIZE_ADDRESS s390_delegitimize_address
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS s390_legitimize_address
+
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY s390_return_in_memory
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index c9eb60248fe..2b4d7ce72ca 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler, for IBM S/390
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008 Free Software Foundation, Inc.
+ 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Hartmut Penner (hpenner@de.ibm.com) and
Ulrich Weigand (uweigand@de.ibm.com).
Andreas Krebbel (Andreas.Krebbel@de.ibm.com)
@@ -58,14 +58,14 @@ enum processor_flags
};
extern enum processor_type s390_tune;
-extern enum processor_flags s390_tune_flags;
+extern int s390_tune_flags;
/* This is necessary to avoid a warning about comparing different enum
types. */
#define s390_tune_attr ((enum attr_cpu)s390_tune)
extern enum processor_type s390_arch;
-extern enum processor_flags s390_arch_flags;
+extern int s390_arch_flags;
/* These flags indicate that the generated code should run on a cpu
providing the respective hardware facility regardless of the
@@ -644,8 +644,6 @@ extern const enum reg_class regclass_map[FIRST_PSEUDO_REGISTER];
/* Frame pointer and argument pointer elimination. */
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
{ FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
@@ -766,16 +764,6 @@ used in insn definitions or inline assemblies. */
}
#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. */
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
-{ \
- (X) = legitimize_address (X, OLDX, MODE); \
- 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. */
diff --git a/gcc/config/score/score-protos.h b/gcc/config/score/score-protos.h
index 56cdce7ae3e..d6739b8cf4c 100644
--- a/gcc/config/score/score-protos.h
+++ b/gcc/config/score/score-protos.h
@@ -72,7 +72,6 @@ extern enum reg_class score_preferred_reload_class (rtx x,
extern HOST_WIDE_INT score_initial_elimination_offset (int from, int to);
extern void score_print_operand (FILE *file, rtx op, int letter);
extern void score_print_operand_address (FILE *file, rtx addr);
-extern int score_legitimize_address (rtx *xloc);
extern int score_arg_partial_bytes (CUMULATIVE_ARGS *cum,
enum machine_mode mode,
tree type, bool named);
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index e0887647708..2ac3021bf5e 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -68,6 +68,9 @@
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION score_handle_option
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS score_legitimize_address
+
#undef TARGET_SCHED_ISSUE_RATE
#define TARGET_SCHED_ISSUE_RATE score_issue_rate
@@ -540,16 +543,17 @@ score_address_p (enum machine_mode mode, rtx x, int strict)
gcc_unreachable ();
}
-/* This function is used to implement LEGITIMIZE_ADDRESS. If *XLOC can
+/* This function is used to implement LEGITIMIZE_ADDRESS. If X can
be legitimized in a way that the generic machinery might not expect,
- put the new address in *XLOC and return true. */
-int
-score_legitimize_address (rtx *xloc)
+ return the new address, else return X. */
+static rtx
+score_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED)
{
if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D)
- return score7_legitimize_address (xloc);
+ return score7_legitimize_address (x);
else if (TARGET_SCORE3)
- return score3_legitimize_address (xloc);
+ return score3_legitimize_address (x);
gcc_unreachable ();
}
diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h
index d2dd7405feb..d9fe8e65625 100644
--- a/gcc/config/score/score.h
+++ b/gcc/config/score/score.h
@@ -778,12 +778,6 @@ typedef struct score_args
#define REG_OK_FOR_INDEX_P(X) 0
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
- do { \
- if (score_legitimize_address (&(X))) \
- goto WIN; \
- } while (0)
-
#define LEGITIMATE_CONSTANT_P(X) 1
/* Condition Code Status. */
diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c
index 655ee4507a0..9e41452c03d 100644
--- a/gcc/config/score/score3.c
+++ b/gcc/config/score/score3.c
@@ -414,31 +414,28 @@ score3_split_symbol (rtx temp, rtx addr)
return gen_rtx_LO_SUM (Pmode, high, addr);
}
-/* This function is used to implement LEGITIMIZE_ADDRESS. If *XLOC can
+/* This function is used to implement LEGITIMIZE_ADDRESS. If X can
be legitimized in a way that the generic machinery might not expect,
- put the new address in *XLOC and return true. */
-int
-score3_legitimize_address (rtx *xloc)
+ return the new address. */
+rtx
+score3_legitimize_address (rtx x)
{
enum score_symbol_type symbol_type;
- if (score3_symbolic_constant_p (*xloc, &symbol_type)
+ if (score3_symbolic_constant_p (x, &symbol_type)
&& symbol_type == SYMBOL_GENERAL)
- {
- *xloc = score3_split_symbol (0, *xloc);
- return 1;
- }
+ return score3_split_symbol (0, x);
- if (GET_CODE (*xloc) == PLUS
- && GET_CODE (XEXP (*xloc, 1)) == CONST_INT)
+ if (GET_CODE (x) == PLUS
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
{
- rtx reg = XEXP (*xloc, 0);
+ rtx reg = XEXP (x, 0);
if (!score3_valid_base_register_p (reg, 0))
reg = copy_to_mode_reg (Pmode, reg);
- *xloc = score3_add_offset (reg, INTVAL (XEXP (*xloc, 1)));
- return 1;
+ return score3_add_offset (reg, INTVAL (XEXP (x, 1)));
}
- return 0;
+
+ return x;
}
/* Fill INFO with information about a single argument. CUM is the
diff --git a/gcc/config/score/score3.h b/gcc/config/score/score3.h
index f3aa0606dd0..c46a8e694d9 100644
--- a/gcc/config/score/score3.h
+++ b/gcc/config/score/score3.h
@@ -78,7 +78,7 @@ extern void score3_output_mi_thunk (FILE *file,
HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset,
tree function);
-extern int score3_legitimize_address (rtx *xloc);
+extern rtx score3_legitimize_address (rtx x);
extern void
score3_function_prologue (FILE *file,
HOST_WIDE_INT size ATTRIBUTE_UNUSED);
diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c
index 64ab5aadc5f..dc532764edd 100644
--- a/gcc/config/score/score7.c
+++ b/gcc/config/score/score7.c
@@ -413,31 +413,28 @@ score7_split_symbol (rtx temp, rtx addr)
return gen_rtx_LO_SUM (Pmode, high, addr);
}
-/* This function is used to implement LEGITIMIZE_ADDRESS. If *XLOC can
+/* This function is used to implement LEGITIMIZE_ADDRESS. If X can
be legitimized in a way that the generic machinery might not expect,
- put the new address in *XLOC and return true. */
-int
-score7_legitimize_address (rtx *xloc)
+ return the new address. */
+rtx
+score7_legitimize_address (rtx x)
{
enum score_symbol_type symbol_type;
- if (score7_symbolic_constant_p (*xloc, &symbol_type)
+ if (score7_symbolic_constant_p (x, &symbol_type)
&& symbol_type == SYMBOL_GENERAL)
- {
- *xloc = score7_split_symbol (0, *xloc);
- return 1;
- }
+ return score7_split_symbol (0, x);
- if (GET_CODE (*xloc) == PLUS
- && GET_CODE (XEXP (*xloc, 1)) == CONST_INT)
+ if (GET_CODE (x) == PLUS
+ && GET_CODE (XEXP (x, 1)) == CONST_INT)
{
- rtx reg = XEXP (*xloc, 0);
+ rtx reg = XEXP (x, 0);
if (!score7_valid_base_register_p (reg, 0))
reg = copy_to_mode_reg (Pmode, reg);
- *xloc = score7_add_offset (reg, INTVAL (XEXP (*xloc, 1)));
- return 1;
+ return score7_add_offset (reg, INTVAL (XEXP (x, 1)));
}
- return 0;
+
+ return x;
}
/* Fill INFO with information about a single argument. CUM is the
diff --git a/gcc/config/score/score7.h b/gcc/config/score/score7.h
index 473cc12a9a5..e2033c74498 100644
--- a/gcc/config/score/score7.h
+++ b/gcc/config/score/score7.h
@@ -78,7 +78,7 @@ extern void score7_output_mi_thunk (FILE *file,
HOST_WIDE_INT delta,
HOST_WIDE_INT vcall_offset,
tree function);
-extern int score7_legitimize_address (rtx *xloc);
+extern rtx score7_legitimize_address (rtx x);
extern void
score7_function_prologue (FILE *file,
HOST_WIDE_INT size ATTRIBUTE_UNUSED);
diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h
index caa40a667fa..a484b9c5d05 100644
--- a/gcc/config/sh/sh-protos.h
+++ b/gcc/config/sh/sh-protos.h
@@ -93,7 +93,7 @@ extern void fixup_addr_diff_vecs (rtx);
extern int get_dest_uid (rtx, int);
extern void final_prescan_insn (rtx, rtx *, int);
extern int symbol_ref_operand (rtx, enum machine_mode);
-extern int tls_symbolic_operand (rtx, enum machine_mode);
+extern enum tls_model tls_symbolic_operand (rtx, enum machine_mode);
extern int system_reg_operand (rtx, enum machine_mode);
extern int general_movsrc_operand (rtx, enum machine_mode);
extern int general_movdst_operand (rtx, enum machine_mode);
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index c9493dd6c9c..1c915a5bf8e 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -37,7 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "insn-attr.h"
#include "toplev.h"
#include "recog.h"
-#include "c-pragma.h"
#include "integrate.h"
#include "dwarf2.h"
#include "tm_p.h"
@@ -224,7 +223,7 @@ static int sh_variable_issue (FILE *, int, rtx, int);
static bool sh_function_ok_for_sibcall (tree, tree);
static bool sh_cannot_modify_jumps_p (void);
-static int sh_target_reg_class (void);
+static enum reg_class sh_target_reg_class (void);
static bool sh_optimize_target_register_callee_saved (bool);
static bool sh_ms_bitfield_layout_p (const_tree);
@@ -245,6 +244,7 @@ static bool sh_rtx_costs (rtx, int, int, int *, bool);
static int sh_address_cost (rtx, bool);
static int sh_pr_n_sets (void);
static rtx sh_allocate_initial_value (rtx);
+static rtx sh_legitimize_address (rtx, rtx, enum machine_mode);
static int shmedia_target_regs_stack_space (HARD_REG_SET *);
static int shmedia_reserve_space_for_target_registers_p (int, HARD_REG_SET *);
static int shmedia_target_regs_stack_adjust (HARD_REG_SET *);
@@ -374,6 +374,9 @@ static int sh2a_function_vector_p (tree);
#undef TARGET_SCHED_INIT
#define TARGET_SCHED_INIT sh_md_init
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS sh_legitimize_address
+
#undef TARGET_CANNOT_MODIFY_JUMPS_P
#define TARGET_CANNOT_MODIFY_JUMPS_P sh_cannot_modify_jumps_p
#undef TARGET_BRANCH_TARGET_REGISTER_CLASS
@@ -1218,7 +1221,7 @@ prepare_move_operands (rtx operands[], enum machine_mode mode)
if ((mode == SImode || mode == DImode)
&& flag_pic
&& ! ((mode == Pmode || mode == ptr_mode)
- && tls_symbolic_operand (operands[1], Pmode) != 0))
+ && tls_symbolic_operand (operands[1], Pmode) != TLS_MODEL_NONE))
{
rtx temp;
if (SYMBOLIC_CONST_P (operands[1]))
@@ -1290,7 +1293,8 @@ prepare_move_operands (rtx operands[], enum machine_mode mode)
op1 = operands[1];
if (GET_CODE (op1) == CONST
&& GET_CODE (XEXP (op1, 0)) == PLUS
- && tls_symbolic_operand (XEXP (XEXP (op1, 0), 0), Pmode))
+ && (tls_symbolic_operand (XEXP (XEXP (op1, 0), 0), Pmode)
+ != TLS_MODEL_NONE))
{
opc = XEXP (XEXP (op1, 0), 1);
op1 = XEXP (XEXP (op1, 0), 0);
@@ -1298,7 +1302,7 @@ prepare_move_operands (rtx operands[], enum machine_mode mode)
else
opc = NULL_RTX;
- if ((tls_kind = tls_symbolic_operand (op1, Pmode)))
+ if ((tls_kind = tls_symbolic_operand (op1, Pmode)) != TLS_MODEL_NONE)
{
rtx tga_op1, tga_ret, tmp, tmp2;
@@ -5125,7 +5129,7 @@ sh_reorg (void)
/* If we are not optimizing, then there may not be
a note. */
if (note)
- PUT_MODE (note, REG_INC);
+ PUT_REG_NOTE_KIND (note, REG_INC);
*last_float_addr = r0_inc_rtx;
}
@@ -6348,7 +6352,7 @@ sh_expand_prologue (void)
tmp_pnt = schedule.temps;
for (entry = &schedule.entries[1]; entry->mode != VOIDmode; entry++)
{
- enum machine_mode mode = entry->mode;
+ enum machine_mode mode = (enum machine_mode) entry->mode;
unsigned int reg = entry->reg;
rtx reg_rtx, mem_rtx, pre_dec = NULL_RTX;
rtx orig_reg_rtx;
@@ -6633,7 +6637,7 @@ sh_expand_epilogue (bool sibcall_p)
tmp_pnt = schedule.temps;
for (; entry->mode != VOIDmode; entry--)
{
- enum machine_mode mode = entry->mode;
+ enum machine_mode mode = (enum machine_mode) entry->mode;
int reg = entry->reg;
rtx reg_rtx, mem_rtx, post_inc = NULL_RTX, insn;
@@ -8452,11 +8456,11 @@ tertiary_reload_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
}
/* Return the TLS type for TLS symbols, 0 for otherwise. */
-int
+enum tls_model
tls_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
{
if (GET_CODE (op) != SYMBOL_REF)
- return 0;
+ return TLS_MODEL_NONE;
return SYMBOL_REF_TLS_MODEL (op);
}
@@ -8696,7 +8700,7 @@ get_free_reg (HARD_REG_SET regs_live)
void
fpscr_set_from_mem (int mode, HARD_REG_SET regs_live)
{
- enum attr_fp_mode fp_mode = mode;
+ enum attr_fp_mode fp_mode = (enum attr_fp_mode) mode;
enum attr_fp_mode norm_mode = ACTUAL_NORMAL_MODE (FP_MODE);
rtx addr_reg;
@@ -8844,7 +8848,7 @@ rtx
legitimize_pic_address (rtx orig, enum machine_mode mode ATTRIBUTE_UNUSED,
rtx reg)
{
- if (tls_symbolic_operand (orig, Pmode))
+ if (tls_symbolic_operand (orig, Pmode) != TLS_MODEL_NONE)
return orig;
if (GET_CODE (orig) == LABEL_REF
@@ -8867,6 +8871,60 @@ legitimize_pic_address (rtx orig, enum machine_mode mode ATTRIBUTE_UNUSED,
return orig;
}
+/* Try machine-dependent ways of modifying an illegitimate address
+ to be legitimate. If we find one, return the new, valid address.
+ Otherwise, return X.
+
+ For the SH, if X is almost suitable for indexing, but the offset is
+ out of range, convert it into a normal form so that CSE has a chance
+ of reducing the number of address registers used. */
+
+static rtx
+sh_legitimize_address (rtx x, rtx oldx, enum machine_mode mode)
+{
+ if (flag_pic)
+ x = legitimize_pic_address (oldx, mode, NULL_RTX);
+
+ if (GET_CODE (x) == PLUS
+ && (GET_MODE_SIZE (mode) == 4
+ || GET_MODE_SIZE (mode) == 8)
+ && GET_CODE (XEXP (x, 1)) == CONST_INT
+ && BASE_REGISTER_RTX_P (XEXP (x, 0))
+ && ! TARGET_SHMEDIA
+ && ! ((TARGET_SH4 || TARGET_SH2A_DOUBLE) && mode == DFmode)
+ && ! (TARGET_SH2E && mode == SFmode))
+ {
+ rtx index_rtx = XEXP (x, 1);
+ HOST_WIDE_INT offset = INTVAL (index_rtx), offset_base;
+ rtx sum;
+
+ /* On rare occasions, we might get an unaligned pointer
+ that is indexed in a way to give an aligned address.
+ Therefore, keep the lower two bits in offset_base. */
+ /* Instead of offset_base 128..131 use 124..127, so that
+ simple add suffices. */
+ if (offset > 127)
+ offset_base = ((offset + 4) & ~60) - 4;
+ else
+ offset_base = offset & ~60;
+
+ /* Sometimes the normal form does not suit DImode. We
+ could avoid that by using smaller ranges, but that
+ would give less optimized code when SImode is
+ prevalent. */
+ if (GET_MODE_SIZE (mode) + offset - offset_base <= 64)
+ {
+ sum = expand_binop (Pmode, add_optab, XEXP (x, 0),
+ GEN_INT (offset_base), NULL_RTX, 0,
+ OPTAB_LIB_WIDEN);
+
+ return gen_rtx_PLUS (Pmode, sum, GEN_INT (offset - offset_base));
+ }
+ }
+
+ return x;
+}
+
/* Mark the use of a constant in the literal table. If the constant
has multiple labels, make it unique. */
static rtx
@@ -9623,7 +9681,7 @@ sh_cannot_modify_jumps_p (void)
return (TARGET_SHMEDIA && (reload_in_progress || reload_completed));
}
-static int
+static enum reg_class
sh_target_reg_class (void)
{
return TARGET_SHMEDIA ? TARGET_REGS : NO_REGS;
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 8720fb77728..71e202a87dd 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1,6 +1,6 @@
/* Definitions of target machine for GNU compiler for Renesas / SuperH SH.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Steve Chamberlain (sac@cygnus.com).
Improved by Jim Wilson (wilson@cygnus.com).
@@ -545,35 +545,35 @@ do { \
= !flag_signaling_nans && TARGET_SH2E && ! TARGET_IEEE; \
if (TARGET_SH2E && !flag_finite_math_only) \
target_flags |= MASK_IEEE; \
- sh_cpu = CPU_SH1; \
+ sh_cpu = PROCESSOR_SH1; \
assembler_dialect = 0; \
if (TARGET_SH2) \
- sh_cpu = CPU_SH2; \
+ sh_cpu = PROCESSOR_SH2; \
if (TARGET_SH2E) \
- sh_cpu = CPU_SH2E; \
+ sh_cpu = PROCESSOR_SH2E; \
if (TARGET_SH2A) \
{ \
- sh_cpu = CPU_SH2A; \
+ sh_cpu = PROCESSOR_SH2A; \
if (TARGET_SH2A_DOUBLE) \
target_flags |= MASK_FMOVD; \
} \
if (TARGET_SH3) \
- sh_cpu = CPU_SH3; \
+ sh_cpu = PROCESSOR_SH3; \
if (TARGET_SH3E) \
- sh_cpu = CPU_SH3E; \
+ sh_cpu = PROCESSOR_SH3E; \
if (TARGET_SH4) \
{ \
assembler_dialect = 1; \
- sh_cpu = CPU_SH4; \
+ sh_cpu = PROCESSOR_SH4; \
} \
if (TARGET_SH4A_ARCH) \
{ \
assembler_dialect = 1; \
- sh_cpu = CPU_SH4A; \
+ sh_cpu = PROCESSOR_SH4A; \
} \
if (TARGET_SH5) \
{ \
- sh_cpu = CPU_SH5; \
+ sh_cpu = PROCESSOR_SH5; \
target_flags |= MASK_ALIGN_DOUBLE; \
if (TARGET_SHMEDIA_FPU) \
target_flags |= MASK_FMOVD; \
@@ -1262,12 +1262,6 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \
#define GOT_SYMBOL_NAME "*_GLOBAL_OFFSET_TABLE_"
-/* 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. */
-
-#define FRAME_POINTER_REQUIRED 0
-
/* Definitions for register eliminations.
We have three registers that can be eliminated on the SH. First, the
@@ -2450,68 +2444,6 @@ struct sh_args {
} \
}
-/* 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 SH, if X is almost suitable for indexing, but the offset is
- out of range, convert it into a normal form so that cse has a chance
- of reducing the number of address registers used. */
-
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ \
- if (flag_pic) \
- (X) = legitimize_pic_address (OLDX, MODE, NULL_RTX); \
- if (GET_CODE (X) == PLUS \
- && (GET_MODE_SIZE (MODE) == 4 \
- || GET_MODE_SIZE (MODE) == 8) \
- && GET_CODE (XEXP ((X), 1)) == CONST_INT \
- && BASE_REGISTER_RTX_P (XEXP ((X), 0)) \
- && ! TARGET_SHMEDIA \
- && ! ((TARGET_SH4 || TARGET_SH2A_DOUBLE) && (MODE) == DFmode) \
- && ! (TARGET_SH2E && (MODE) == SFmode)) \
- { \
- rtx index_rtx = XEXP ((X), 1); \
- HOST_WIDE_INT offset = INTVAL (index_rtx), offset_base; \
- rtx sum; \
- \
- GO_IF_LEGITIMATE_INDEX ((MODE), index_rtx, WIN); \
- /* On rare occasions, we might get an unaligned pointer \
- that is indexed in a way to give an aligned address. \
- Therefore, keep the lower two bits in offset_base. */ \
- /* Instead of offset_base 128..131 use 124..127, so that \
- simple add suffices. */ \
- if (offset > 127) \
- { \
- offset_base = ((offset + 4) & ~60) - 4; \
- } \
- else \
- offset_base = offset & ~60; \
- /* Sometimes the normal form does not suit DImode. We \
- could avoid that by using smaller ranges, but that \
- would give less optimized code when SImode is \
- prevalent. */ \
- if (GET_MODE_SIZE (MODE) + offset - offset_base <= 64) \
- { \
- sum = expand_binop (Pmode, add_optab, XEXP ((X), 0), \
- GEN_INT (offset_base), NULL_RTX, 0, \
- OPTAB_LIB_WIDEN); \
- \
- (X) = gen_rtx_PLUS (Pmode, sum, GEN_INT (offset - offset_base)); \
- goto WIN; \
- } \
- } \
-}
-
/* A C compound statement that attempts to replace X, which is an address
that needs reloading, with a valid memory address for an operand of
mode MODE. WIN is a C statement label elsewhere in the code.
diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c
index 69426a4596b..fc527b1beb7 100644
--- a/gcc/config/sol2-c.c
+++ b/gcc/config/sol2-c.c
@@ -1,5 +1,5 @@
/* Solaris support needed only by C/C++ frontends.
- Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC.
This file is part of GCC.
@@ -37,14 +37,14 @@ along with GCC; see the file COPYING3. If not see
static const format_length_info cmn_err_length_specs[] =
{
{ "l", FMT_LEN_l, STD_C89, "ll", FMT_LEN_ll, STD_C89 },
- { NULL, 0, 0, NULL, 0, 0 }
+ { NULL, FMT_LEN_none, STD_C89, NULL, FMT_LEN_none, STD_C89 }
};
static const format_flag_spec cmn_err_flag_specs[] =
{
{ 'w', 0, 0, N_("field width"), N_("field width in printf format"), STD_C89 },
{ 'L', 0, 0, N_("length modifier"), N_("length modifier in printf format"), STD_C89 },
- { 0, 0, 0, NULL, NULL, 0 }
+ { 0, 0, 0, NULL, NULL, STD_C89 }
};
@@ -66,7 +66,7 @@ static const format_char_info cmn_err_char_table[] =
{ "p", 1, STD_C89, { T89_V, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "c", NULL },
{ "s", 1, STD_C89, { T89_C, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "cR", NULL },
{ "b", 0, STD_C89, { T89_I, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN, BADLEN }, "w", "", &bitfield_string_type },
- { NULL, 0, 0, NOLENGTHS, NULL, NULL, NULL }
+ { NULL, 0, STD_C89, NOLENGTHS, NULL, NULL, NULL }
};
const format_kind_info solaris_format_types[] = {
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h
index 35ee06f43aa..40ac75e130c 100644
--- a/gcc/config/sparc/sparc-protos.h
+++ b/gcc/config/sparc/sparc-protos.h
@@ -72,7 +72,6 @@ extern bool legitimate_pic_operand_p (rtx);
extern int legitimate_address_p (enum machine_mode, rtx, int);
extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
extern rtx legitimize_tls_address (rtx);
-extern rtx legitimize_address (rtx, rtx, enum machine_mode);
extern void sparc_emit_call_insn (rtx, rtx);
extern void sparc_defer_case_vector (rtx, rtx, int);
extern bool sparc_expand_move (enum machine_mode, rtx *);
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 61c5700fa1b..ab2b57bbcd9 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -412,6 +412,7 @@ static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *);
static void sparc_va_start (tree, rtx);
static tree sparc_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *);
static bool sparc_vector_mode_supported_p (enum machine_mode);
+static rtx sparc_legitimize_address (rtx, rtx, enum machine_mode);
static bool sparc_pass_by_reference (CUMULATIVE_ARGS *,
enum machine_mode, const_tree, bool);
static int sparc_arg_partial_bytes (CUMULATIVE_ARGS *,
@@ -492,6 +493,9 @@ static bool fpu_option_set = false;
#undef TARGET_INIT_BUILTINS
#define TARGET_INIT_BUILTINS sparc_init_builtins
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS sparc_legitimize_address
+
#undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN sparc_expand_builtin
#undef TARGET_FOLD_BUILTIN
@@ -689,7 +693,7 @@ sparc_override_options (void)
/* UltraSPARC T1 */
{ "niagara", PROCESSOR_NIAGARA, MASK_ISA, MASK_V9|MASK_DEPRECATED_V8_INSNS},
{ "niagara2", PROCESSOR_NIAGARA, MASK_ISA, MASK_V9},
- { 0, 0, 0, 0 }
+ { 0, (enum processor_type) 0, 0, 0 }
};
const struct cpu_table *cpu;
const struct sparc_cpu_select *sel;
@@ -3370,10 +3374,13 @@ legitimize_pic_address (rtx orig, enum machine_mode mode ATTRIBUTE_UNUSED,
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 is the mode of the operand pointed to by X. */
+ MODE is the mode of the operand pointed to by X.
+
+ On SPARC, change REG+N into REG+REG, and REG+(X*Y) into REG+REG. */
rtx
-legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, enum machine_mode mode)
+sparc_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
{
rtx orig_x = x;
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index c0667700cd4..d21900135e2 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -1923,27 +1923,6 @@ do { \
} \
}
-/* 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. */
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
-{ \
- (X) = legitimize_address (X, OLDX, MODE); \
- 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.
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 8e8991129aa..4fae329cd9a 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -130,25 +130,30 @@
;; True if branch/call has empty delay slot and will emit a nop in it
(define_attr "empty_delay_slot" "false,true"
- (symbol_ref "empty_delay_slot (insn)"))
+ (symbol_ref "(empty_delay_slot (insn)
+ ? EMPTY_DELAY_SLOT_TRUE : EMPTY_DELAY_SLOT_FALSE)"))
(define_attr "branch_type" "none,icc,fcc,reg"
(const_string "none"))
(define_attr "pic" "false,true"
- (symbol_ref "flag_pic != 0"))
+ (symbol_ref "(flag_pic != 0 ? PIC_TRUE : PIC_FALSE)"))
(define_attr "calls_alloca" "false,true"
- (symbol_ref "cfun->calls_alloca != 0"))
+ (symbol_ref "(cfun->calls_alloca != 0
+ ? CALLS_ALLOCA_TRUE : CALLS_ALLOCA_FALSE)"))
(define_attr "calls_eh_return" "false,true"
- (symbol_ref "crtl->calls_eh_return !=0 "))
+ (symbol_ref "(crtl->calls_eh_return != 0
+ ? CALLS_EH_RETURN_TRUE : CALLS_EH_RETURN_FALSE)"))
(define_attr "leaf_function" "false,true"
- (symbol_ref "current_function_uses_only_leaf_regs != 0"))
+ (symbol_ref "(current_function_uses_only_leaf_regs != 0
+ ? LEAF_FUNCTION_TRUE : LEAF_FUNCTION_FALSE)"))
(define_attr "delayed_branch" "false,true"
- (symbol_ref "flag_delayed_branch != 0"))
+ (symbol_ref "(flag_delayed_branch != 0
+ ? DELAYED_BRANCH_TRUE : DELAYED_BRANCH_FALSE)"))
;; Length (in # of insns).
;; Beware that setting a length greater or equal to 3 for conditional branches
@@ -242,7 +247,8 @@
;; Attributes for instruction and branch scheduling
(define_attr "tls_call_delay" "false,true"
- (symbol_ref "tls_call_delay (insn)"))
+ (symbol_ref "(tls_call_delay (insn)
+ ? TLS_CALL_DELAY_TRUE : TLS_CALL_DELAY_FALSE)"))
(define_attr "in_call_delay" "false,true"
(cond [(eq_attr "type" "uncond_branch,branch,call,sibcall,call_no_delay_slot,multi")
@@ -257,10 +263,14 @@
(const_string "false"))))
(define_attr "eligible_for_sibcall_delay" "false,true"
- (symbol_ref "eligible_for_sibcall_delay (insn)"))
+ (symbol_ref "(eligible_for_sibcall_delay (insn)
+ ? ELIGIBLE_FOR_SIBCALL_DELAY_TRUE
+ : ELIGIBLE_FOR_SIBCALL_DELAY_FALSE)"))
(define_attr "eligible_for_return_delay" "false,true"
- (symbol_ref "eligible_for_return_delay (insn)"))
+ (symbol_ref "(eligible_for_return_delay (insn)
+ ? ELIGIBLE_FOR_RETURN_DELAY_TRUE
+ : ELIGIBLE_FOR_RETURN_DELAY_FALSE)"))
;; ??? !v9: Should implement the notion of predelay slots for floating-point
;; branches. This would allow us to remove the nop always inserted before
diff --git a/gcc/config/spu/constraints.md b/gcc/config/spu/constraints.md
index fe81b2f66a8..b1f5947064c 100644
--- a/gcc/config/spu/constraints.md
+++ b/gcc/config/spu/constraints.md
@@ -16,8 +16,14 @@
;; <http://www.gnu.org/licenses/>.
-;; GCC standard constraints: g, i, m, n, o, p, r, s, E-H, I-P, V, X
-;; unused for SPU: E-H, L, Q, d, e, h, q, t-z
+;; ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+;; GCC: ffffiiiiiiii x x x x xxxx xx
+;; SPU: xxxx xxx xxxx xxxx x xxx xx x xxx xx
+;; FREE: ffff i a a a a a aa aaa
+;; x - used
+;; a - available
+;; i - available for integer immediates
+;; f - available for floating point immediates
;; For most immediate constraints we have 3 variations to deal with the
;; fact const_int has no mode. One variation treats const_int as 32 bit,
@@ -159,4 +165,15 @@
&& INTVAL (XEXP (op, 0)) >= 0
&& INTVAL (XEXP (op, 0)) <= 0x3ffff")))
+
+;; Floating-point constant constraints.
+
+(define_constraint "v"
+ "Floating point power of 2 with exponent in [0..127]"
+ (and (match_code "const_double,const_vector")
+ (match_test "exp2_immediate_p (op, VOIDmode, 0, 127)")))
+(define_constraint "w"
+ "Floating point power of 2 with exponent in [-126..0]"
+ (and (match_code "const_double,const_vector")
+ (match_test "exp2_immediate_p (op, VOIDmode, -126, 0)")))
diff --git a/gcc/config/spu/predicates.md b/gcc/config/spu/predicates.md
index 7e5c6a9da6e..ce91ba230bb 100644
--- a/gcc/config/spu/predicates.md
+++ b/gcc/config/spu/predicates.md
@@ -104,3 +104,13 @@
(ior (match_test "GET_MODE (XEXP (op, 0)) == HImode")
(match_test "GET_MODE (XEXP (op, 0)) == SImode"))))
+(define_predicate "spu_inv_exp2_operand"
+ (and (match_code "const_double,const_vector")
+ (and (match_operand 0 "immediate_operand")
+ (match_test "exp2_immediate_p (op, mode, -126, 0)"))))
+
+(define_predicate "spu_exp2_operand"
+ (and (match_code "const_double,const_vector")
+ (and (match_operand 0 "immediate_operand")
+ (match_test "exp2_immediate_p (op, mode, 0, 127)"))))
+
diff --git a/gcc/config/spu/spu-builtins.def b/gcc/config/spu/spu-builtins.def
index b0f8e312f86..9e92781d311 100644
--- a/gcc/config/spu/spu-builtins.def
+++ b/gcc/config/spu/spu-builtins.def
@@ -235,8 +235,8 @@ DEF_BUILTIN (SI_FROM_PTR, CODE_FOR_spu_convert, "si_from_ptr", B_INSN,
/* definitions to support generic builtin functions: */
-DEF_BUILTIN (SPU_CONVTS, CODE_FOR_spu_cflts, "spu_convts", B_INSN, _A3(SPU_BTI_V4SI, SPU_BTI_V4SF, SPU_BTI_U7))
-DEF_BUILTIN (SPU_CONVTU, CODE_FOR_spu_cfltu, "spu_convtu", B_INSN, _A3(SPU_BTI_UV4SI, SPU_BTI_V4SF, SPU_BTI_U7))
+DEF_BUILTIN (SPU_CONVTS, CODE_FOR_spu_cflts, "spu_convts", B_INSN, _A3(SPU_BTI_V4SI, SPU_BTI_V4SF, SPU_BTI_INTSI))
+DEF_BUILTIN (SPU_CONVTU, CODE_FOR_spu_cfltu, "spu_convtu", B_INSN, _A3(SPU_BTI_UV4SI, SPU_BTI_V4SF, SPU_BTI_INTSI))
DEF_BUILTIN (SPU_ROUNDTF, CODE_FOR_spu_frds, "spu_roundtf", B_INSN, _A2(SPU_BTI_V4SF, SPU_BTI_V2DF))
DEF_BUILTIN (SPU_MULH, CODE_FOR_spu_mpyh, "spu_mulh", B_INSN, _A3(SPU_BTI_V4SI, SPU_BTI_V8HI, SPU_BTI_V8HI))
DEF_BUILTIN (SPU_MULSR, CODE_FOR_spu_mpys, "spu_mulsr", B_INSN, _A3(SPU_BTI_V4SI, SPU_BTI_V8HI, SPU_BTI_V8HI))
@@ -257,8 +257,8 @@ DEF_BUILTIN (SPU_TESTSV, CODE_FOR_dftsv, "spu_testsv", B_INSN,
/* definitions to support overloaded generic builtin functions: */
DEF_BUILTIN (SPU_CONVTF, CODE_FOR_nothing, "spu_convtf", B_OVERLOAD, _A1(SPU_BTI_VOID))
-DEF_BUILTIN (SPU_CONVTF_0, CODE_FOR_spu_cuflt, "spu_convtf_0", B_INTERNAL, _A3(SPU_BTI_V4SF, SPU_BTI_UV4SI, SPU_BTI_U7))
-DEF_BUILTIN (SPU_CONVTF_1, CODE_FOR_spu_csflt, "spu_convtf_1", B_INTERNAL, _A3(SPU_BTI_V4SF, SPU_BTI_V4SI, SPU_BTI_U7))
+DEF_BUILTIN (SPU_CONVTF_0, CODE_FOR_spu_cuflt, "spu_convtf_0", B_INTERNAL, _A3(SPU_BTI_V4SF, SPU_BTI_UV4SI, SPU_BTI_UINTSI))
+DEF_BUILTIN (SPU_CONVTF_1, CODE_FOR_spu_csflt, "spu_convtf_1", B_INTERNAL, _A3(SPU_BTI_V4SF, SPU_BTI_V4SI, SPU_BTI_UINTSI))
DEF_BUILTIN (SPU_EXTEND, CODE_FOR_nothing, "spu_extend", B_OVERLOAD, _A1(SPU_BTI_VOID))
DEF_BUILTIN (SPU_EXTEND_0, CODE_FOR_spu_xsbh, "spu_extend_0", B_INTERNAL, _A2(SPU_BTI_V8HI, SPU_BTI_V16QI))
DEF_BUILTIN (SPU_EXTEND_1, CODE_FOR_spu_xshw, "spu_extend_1", B_INTERNAL, _A2(SPU_BTI_V4SI, SPU_BTI_V8HI))
diff --git a/gcc/config/spu/spu-builtins.md b/gcc/config/spu/spu-builtins.md
index 325a80d6b29..ac3a3336106 100644
--- a/gcc/config/spu/spu-builtins.md
+++ b/gcc/config/spu/spu-builtins.md
@@ -527,37 +527,119 @@
[(set_attr "type" "br")])
;; float convert
-(define_insn "spu_csflt"
+(define_expand "spu_csflt"
+ [(set (match_operand:V4SF 0 "spu_reg_operand")
+ (unspec:V4SF [(match_operand:V4SI 1 "spu_reg_operand")
+ (match_operand:SI 2 "spu_nonmem_operand")] 0 ))]
+ ""
+{
+ if (GET_CODE (operands[2]) == CONST_INT
+ && (INTVAL (operands[2]) < 0 || INTVAL (operands[2]) > 127))
+ {
+ error ("spu_convtf expects an integer literal in the range [0, 127].");
+ operands[2] = force_reg (SImode, operands[2]);
+ }
+ if (GET_CODE (operands[2]) != CONST_INT)
+ {
+ rtx exp2;
+ rtx cnv = gen_reg_rtx (V4SFmode);
+ rtx scale = gen_reg_rtx (SImode);
+ rtx op2 = force_reg (SImode, operands[2]);
+ rtx m1 = spu_gen_exp2 (V4SFmode, GEN_INT (-1));
+ emit_insn (gen_subsi3 (scale, const1_rtx, op2));
+ exp2 = spu_gen_exp2 (V4SFmode, scale);
+ emit_insn (gen_floatv4siv4sf2_mul (cnv, operands[1], m1));
+ emit_insn (gen_mulv4sf3 (operands[0], cnv, exp2));
+ }
+ else
+ {
+ rtx exp2 = spu_gen_exp2 (V4SFmode, operands[2]);
+ emit_insn (gen_floatv4siv4sf2_div (operands[0], operands[1], exp2));
+ }
+ DONE;
+})
+
+(define_expand "spu_cflts"
+ [(set (match_operand:V4SI 0 "spu_reg_operand")
+ (unspec:V4SI [(match_operand:V4SF 1 "spu_reg_operand")
+ (match_operand:SI 2 "spu_nonmem_operand")] 0 ))]
+ ""
+{
+ rtx exp2;
+ if (GET_CODE (operands[2]) == CONST_INT
+ && (INTVAL (operands[2]) < 0 || INTVAL (operands[2]) > 127))
+ {
+ error ("spu_convts expects an integer literal in the range [0, 127].");
+ operands[2] = force_reg (SImode, operands[2]);
+ }
+ exp2 = spu_gen_exp2 (V4SFmode, operands[2]);
+ if (GET_CODE (operands[2]) != CONST_INT)
+ {
+ rtx mul = gen_reg_rtx (V4SFmode);
+ emit_insn (gen_mulv4sf3 (mul, operands[1], exp2));
+ emit_insn (gen_fix_truncv4sfv4si2 (operands[0], mul));
+ }
+ else
+ emit_insn (gen_fix_truncv4sfv4si2_mul (operands[0], operands[1], exp2));
+ DONE;
+})
+
+(define_expand "spu_cuflt"
[(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
- (unspec:V4SF [(match_operand:V4SI 1 "spu_reg_operand" "r")
- (match_operand:SI 2 "immediate_operand" "K")] UNSPEC_CSFLT ))]
- ""
- "csflt\t%0,%1,%2"
- [(set_attr "type" "fp7")])
-
-(define_insn "spu_cflts"
- [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
- (unspec:V4SI [(match_operand:V4SF 1 "spu_reg_operand" "r")
- (match_operand:SI 2 "immediate_operand" "J")] UNSPEC_CFLTS ))]
- ""
- "cflts\t%0,%1,%2"
- [(set_attr "type" "fp7")])
-
-(define_insn "spu_cuflt"
- [(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
- (unspec:V4SF [(match_operand:V4SI 1 "spu_reg_operand" "r")
- (match_operand:SI 2 "immediate_operand" "K")] UNSPEC_CUFLT ))]
- ""
- "cuflt\t%0,%1,%2"
- [(set_attr "type" "fp7")])
-
-(define_insn "spu_cfltu"
- [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
- (unspec:V4SI [(match_operand:V4SF 1 "spu_reg_operand" "r")
- (match_operand:SI 2 "immediate_operand" "J")] UNSPEC_CFLTU ))]
- ""
- "cfltu\t%0,%1,%2"
- [(set_attr "type" "fp7")])
+ (unspec:V4SF [(match_operand:V4SI 1 "spu_reg_operand")
+ (match_operand:SI 2 "spu_nonmem_operand")] 0 ))]
+ ""
+{
+ if (GET_CODE (operands[2]) == CONST_INT
+ && (INTVAL (operands[2]) < 0 || INTVAL (operands[2]) > 127))
+ {
+ error ("spu_convtf expects an integer literal in the range [0, 127].");
+ operands[2] = force_reg (SImode, operands[2]);
+ }
+ if (GET_CODE (operands[2]) != CONST_INT)
+ {
+ rtx exp2;
+ rtx cnv = gen_reg_rtx (V4SFmode);
+ rtx scale = gen_reg_rtx (SImode);
+ rtx op2 = force_reg (SImode, operands[2]);
+ rtx m1 = spu_gen_exp2 (V4SFmode, GEN_INT (-1));
+ emit_insn (gen_subsi3 (scale, const1_rtx, op2));
+ exp2 = spu_gen_exp2 (V4SFmode, scale);
+ emit_insn (gen_floatunsv4siv4sf2_mul (cnv, operands[1], m1));
+ emit_insn (gen_mulv4sf3 (operands[0], cnv, exp2));
+ }
+ else
+ {
+ rtx exp2 = spu_gen_exp2 (V4SFmode, operands[2]);
+ emit_insn (gen_floatunsv4siv4sf2_div (operands[0], operands[1], exp2));
+ }
+ DONE;
+})
+
+(define_expand "spu_cfltu"
+ [(set (match_operand:V4SI 0 "spu_reg_operand")
+ (unspec:V4SI [(match_operand:V4SF 1 "spu_reg_operand")
+ (match_operand:SI 2 "spu_nonmem_operand")] 0 ))]
+ ""
+{
+ rtx exp2;
+ if (GET_CODE (operands[2]) == CONST_INT
+ && (INTVAL (operands[2]) < 0 || INTVAL (operands[2]) > 127))
+ {
+ error ("spu_convtu expects an integer literal in the range [0, 127].");
+ operands[2] = force_reg (SImode, operands[2]);
+ }
+ exp2 = spu_gen_exp2 (V4SFmode, operands[2]);
+ if (GET_CODE (operands[2]) != CONST_INT)
+ {
+ rtx mul = gen_reg_rtx (V4SFmode);
+ emit_insn (gen_mulv4sf3 (mul, operands[1], exp2));
+ emit_insn (gen_fixuns_truncv4sfv4si2 (operands[0], mul));
+ }
+ else
+ emit_insn (gen_fixuns_truncv4sfv4si2_mul (operands[0], operands[1], exp2));
+ DONE;
+})
(define_expand "spu_frds"
[(set (match_operand:V4SF 0 "spu_reg_operand" "")
diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h
index 07eb654c7f3..06e02ba0b48 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -51,11 +51,12 @@ extern int logical_immediate_p (rtx op, enum machine_mode mode);
extern int iohl_immediate_p (rtx op, enum machine_mode mode);
extern int arith_immediate_p (rtx op, enum machine_mode mode,
HOST_WIDE_INT low, HOST_WIDE_INT high);
+extern bool exp2_immediate_p (rtx op, enum machine_mode mode, int low,
+ int high);
extern int spu_constant_address_p (rtx x);
extern int spu_legitimate_constant_p (rtx x);
extern int spu_legitimate_address (enum machine_mode mode, rtx x,
int reg_ok_strict);
-extern rtx spu_legitimize_address (rtx x, rtx oldx, enum machine_mode mode);
extern int spu_initial_elimination_offset (int from, int to);
extern rtx spu_function_value (const_tree type, const_tree func);
extern rtx spu_function_arg (int cum, enum machine_mode mode, tree type,
@@ -75,6 +76,7 @@ extern rtx gen_cpat_const (rtx * ops);
extern void constant_to_array (enum machine_mode mode, rtx x,
unsigned char *arr);
extern rtx array_to_constant (enum machine_mode mode, unsigned char *arr);
+extern rtx spu_gen_exp2 (enum machine_mode mode, rtx x);
extern void spu_allocate_stack (rtx op0, rtx op1);
extern void spu_restore_stack_nonlocal (rtx op0, rtx op1);
extern void spu_restore_stack_block (rtx op0, rtx op1);
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index a51170bad21..eb7ded6ec60 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -48,7 +48,6 @@
#include "sched-int.h"
#include "params.h"
#include "assert.h"
-#include "c-common.h"
#include "machmode.h"
#include "gimple.h"
#include "tm-constrs.h"
@@ -201,6 +200,7 @@ static void spu_init_libfuncs (void);
static bool spu_return_in_memory (const_tree type, const_tree fntype);
static void fix_range (const char *);
static void spu_encode_section_info (tree, rtx, int);
+static rtx spu_legitimize_address (rtx, rtx, enum machine_mode);
static tree spu_builtin_mul_widen_even (tree);
static tree spu_builtin_mul_widen_odd (tree);
static tree spu_builtin_mask_for_load (void);
@@ -280,6 +280,9 @@ spu_libgcc_shift_count_mode (void);
#undef TARGET_UNWIND_WORD_MODE
#define TARGET_UNWIND_WORD_MODE spu_unwind_word_mode
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS spu_legitimize_address
+
/* The .8byte directive doesn't seem to work well for a 32 bit
architecture. */
#undef TARGET_ASM_UNALIGNED_DI_OP
@@ -1586,6 +1589,13 @@ print_operand (FILE * file, rtx x, int code)
output_addr_const (file, GEN_INT (val));
return;
+ case 'v':
+ case 'w':
+ constant_to_array (mode, x, arr);
+ val = (((arr[0] << 1) + (arr[1] >> 7)) & 0xff) - 127;
+ output_addr_const (file, GEN_INT (code == 'w' ? -val : val));
+ return;
+
case 0:
if (xcode == REG)
fprintf (file, "%s", reg_names[REGNO (x)]);
@@ -1598,7 +1608,7 @@ print_operand (FILE * file, rtx x, int code)
return;
/* unused letters
- o qr uvw yz
+ o qr u yz
AB OPQR UVWXYZ */
default:
output_operand_lossage ("invalid %%xn code");
@@ -2757,6 +2767,25 @@ spu_machine_dependent_reorg (void)
pad_bb ();
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ if (NONJUMP_INSN_P (insn) && INSN_CODE (insn) == CODE_FOR_hbr)
+ {
+ /* Adjust the LABEL_REF in a hint when we have inserted a nop
+ between its branch label and the branch . We don't move the
+ label because GCC expects it at the beginning of the block. */
+ rtx unspec = SET_SRC (XVECEXP (PATTERN (insn), 0, 0));
+ rtx label_ref = XVECEXP (unspec, 0, 0);
+ rtx label = XEXP (label_ref, 0);
+ rtx branch;
+ int offset = 0;
+ for (branch = NEXT_INSN (label);
+ !JUMP_P (branch) && !CALL_P (branch);
+ branch = NEXT_INSN (branch))
+ if (NONJUMP_INSN_P (branch))
+ offset += get_attr_length (branch);
+ if (offset > 0)
+ XVECEXP (unspec, 0, 0) = plus_constant (label_ref, offset);
+ }
if (spu_flag_var_tracking)
{
@@ -3495,6 +3524,58 @@ arith_immediate_p (rtx op, enum machine_mode mode,
return val >= low && val <= high;
}
+/* TRUE when op is an immediate and an exact power of 2, and given that
+ OP is 2^scale, scale >= LOW && scale <= HIGH. When OP is a vector,
+ all entries must be the same. */
+bool
+exp2_immediate_p (rtx op, enum machine_mode mode, int low, int high)
+{
+ enum machine_mode int_mode;
+ HOST_WIDE_INT val;
+ unsigned char arr[16];
+ int bytes, i, j;
+
+ gcc_assert (GET_CODE (op) == CONST_INT || GET_CODE (op) == CONST_DOUBLE
+ || GET_CODE (op) == CONST_VECTOR);
+
+ if (GET_CODE (op) == CONST_VECTOR
+ && !const_vector_immediate_p (op))
+ return 0;
+
+ if (GET_MODE (op) != VOIDmode)
+ mode = GET_MODE (op);
+
+ constant_to_array (mode, op, arr);
+
+ if (VECTOR_MODE_P (mode))
+ mode = GET_MODE_INNER (mode);
+
+ bytes = GET_MODE_SIZE (mode);
+ int_mode = mode_for_size (GET_MODE_BITSIZE (mode), MODE_INT, 0);
+
+ /* Check that bytes are repeated. */
+ for (i = bytes; i < 16; i += bytes)
+ for (j = 0; j < bytes; j++)
+ if (arr[j] != arr[i + j])
+ return 0;
+
+ val = arr[0];
+ for (j = 1; j < bytes; j++)
+ val = (val << 8) | arr[j];
+
+ val = trunc_int_for_mode (val, int_mode);
+
+ /* Currently, we only handle SFmode */
+ gcc_assert (mode == SFmode);
+ if (mode == SFmode)
+ {
+ int exp = (val >> 23) - 127;
+ return val > 0 && (val & 0x007fffff) == 0
+ && exp >= low && exp <= high;
+ }
+ return FALSE;
+}
+
/* We accept:
- any 32-bit constant (SImode, SFmode)
- any constant that can be generated with fsmbi (any mode)
@@ -3605,7 +3686,7 @@ spu_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED,
register. */
rtx
spu_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
- enum machine_mode mode)
+ enum machine_mode mode ATTRIBUTE_UNUSED)
{
rtx op0, op1;
/* Make sure both operands are registers. */
@@ -3628,10 +3709,8 @@ spu_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
else if (GET_CODE (op1) != REG)
op1 = force_reg (Pmode, op1);
x = gen_rtx_PLUS (Pmode, op0, op1);
- if (spu_legitimate_address (mode, x, 0))
- return x;
}
- return NULL_RTX;
+ return x;
}
/* Handle an attribute requiring a FUNCTION_DECL; arguments as in
@@ -5951,7 +6030,7 @@ static int
expand_builtin_args (struct spu_builtin_description *d, tree exp,
rtx target, rtx ops[])
{
- enum insn_code icode = d->icode;
+ enum insn_code icode = (enum insn_code) d->icode;
int i = 0, a;
/* Expand the arguments into rtl. */
@@ -5979,7 +6058,7 @@ spu_expand_builtin_1 (struct spu_builtin_description *d,
{
rtx pat;
rtx ops[8];
- enum insn_code icode = d->icode;
+ enum insn_code icode = (enum insn_code) d->icode;
enum machine_mode mode, tmode;
int i, p;
int n_operands;
@@ -6364,4 +6443,36 @@ spu_section_type_flags (tree decl, const char *name, int reloc)
return default_section_type_flags (decl, name, reloc);
}
+/* Generate a constant or register which contains 2^SCALE. We assume
+ the result is valid for MODE. Currently, MODE must be V4SFmode and
+ SCALE must be SImode. */
+rtx
+spu_gen_exp2 (enum machine_mode mode, rtx scale)
+{
+ gcc_assert (mode == V4SFmode);
+ gcc_assert (GET_MODE (scale) == SImode || GET_CODE (scale) == CONST_INT);
+ if (GET_CODE (scale) != CONST_INT)
+ {
+ /* unsigned int exp = (127 + scale) << 23;
+ __vector float m = (__vector float) spu_splats (exp); */
+ rtx reg = force_reg (SImode, scale);
+ rtx exp = gen_reg_rtx (SImode);
+ rtx mul = gen_reg_rtx (mode);
+ emit_insn (gen_addsi3 (exp, reg, GEN_INT (127)));
+ emit_insn (gen_ashlsi3 (exp, exp, GEN_INT (23)));
+ emit_insn (gen_spu_splats (mul, gen_rtx_SUBREG (GET_MODE_INNER (mode), exp, 0)));
+ return mul;
+ }
+ else
+ {
+ HOST_WIDE_INT exp = 127 + INTVAL (scale);
+ unsigned char arr[16];
+ arr[0] = arr[4] = arr[8] = arr[12] = exp >> 1;
+ arr[1] = arr[5] = arr[9] = arr[13] = exp << 7;
+ arr[2] = arr[6] = arr[10] = arr[14] = 0;
+ arr[3] = arr[7] = arr[11] = arr[15] = 0;
+ return array_to_constant (mode, arr);
+ }
+}
+
#include "gt-spu.h"
diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h
index 8780d1b9002..ed92715cd01 100644
--- a/gcc/config/spu/spu.h
+++ b/gcc/config/spu/spu.h
@@ -314,8 +314,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
/* Elimination */
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \
@@ -429,15 +427,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \
goto ADDR; \
}
-#define LEGITIMIZE_ADDRESS(X,OLDX,MODE,WIN) \
- { rtx result = spu_legitimize_address (X, OLDX, MODE); \
- if (result != NULL_RTX) \
- { \
- (X) = result; \
- goto WIN; \
- } \
- }
-
#define LEGITIMATE_CONSTANT_P(X) spu_legitimate_constant_p(X)
diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md
index 1dccfcff66a..bd6936fd9e3 100644
--- a/gcc/config/spu/spu.md
+++ b/gcc/config/spu/spu.md
@@ -136,10 +136,6 @@
(UNSPEC_HEQ 31)
(UNSPEC_HGT 32)
(UNSPEC_HLGT 33)
- (UNSPEC_CSFLT 34)
- (UNSPEC_CFLTS 35)
- (UNSPEC_CUFLT 36)
- (UNSPEC_CFLTU 37)
(UNSPEC_STOP 38)
(UNSPEC_STOPD 39)
(UNSPEC_SET_INTR 40)
@@ -231,6 +227,10 @@
(DF "di") (V2DF "v2di")])
(define_mode_attr F2I [(SF "SI") (V4SF "V4SI")
(DF "DI") (V2DF "V2DI")])
+(define_mode_attr i2f [(SI "sf") (V4SI "v4sf")
+ (DI "df") (V2DI "v2df")])
+(define_mode_attr I2F [(SI "SF") (V4SI "V4SF")
+ (DI "DF") (V2DI "V2DF")])
(define_mode_attr DF2I [(DF "SI") (V2DF "V2DI")])
@@ -594,60 +594,81 @@
;; float conversions
-(define_insn "floatsisf2"
- [(set (match_operand:SF 0 "spu_reg_operand" "=r")
- (float:SF (match_operand:SI 1 "spu_reg_operand" "r")))]
+(define_insn "float<mode><i2f>2"
+ [(set (match_operand:<I2F> 0 "spu_reg_operand" "=r")
+ (float:<I2F> (match_operand:VSI 1 "spu_reg_operand" "r")))]
""
"csflt\t%0,%1,0"
[(set_attr "type" "fp7")])
-(define_insn "floatv4siv4sf2"
- [(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
- (float:V4SF (match_operand:V4SI 1 "spu_reg_operand" "r")))]
+(define_insn "fix_trunc<mode><f2i>2"
+ [(set (match_operand:<F2I> 0 "spu_reg_operand" "=r")
+ (fix:<F2I> (match_operand:VSF 1 "spu_reg_operand" "r")))]
""
- "csflt\t%0,%1,0"
+ "cflts\t%0,%1,0"
[(set_attr "type" "fp7")])
-(define_insn "fix_truncsfsi2"
- [(set (match_operand:SI 0 "spu_reg_operand" "=r")
- (fix:SI (match_operand:SF 1 "spu_reg_operand" "r")))]
+(define_insn "floatuns<mode><i2f>2"
+ [(set (match_operand:<I2F> 0 "spu_reg_operand" "=r")
+ (unsigned_float:<I2F> (match_operand:VSI 1 "spu_reg_operand" "r")))]
""
- "cflts\t%0,%1,0"
+ "cuflt\t%0,%1,0"
[(set_attr "type" "fp7")])
-(define_insn "fix_truncv4sfv4si2"
- [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
- (fix:V4SI (match_operand:V4SF 1 "spu_reg_operand" "r")))]
+(define_insn "fixuns_trunc<mode><f2i>2"
+ [(set (match_operand:<F2I> 0 "spu_reg_operand" "=r")
+ (unsigned_fix:<F2I> (match_operand:VSF 1 "spu_reg_operand" "r")))]
""
- "cflts\t%0,%1,0"
+ "cfltu\t%0,%1,0"
[(set_attr "type" "fp7")])
-(define_insn "floatunssisf2"
- [(set (match_operand:SF 0 "spu_reg_operand" "=r")
- (unsigned_float:SF (match_operand:SI 1 "spu_reg_operand" "r")))]
+(define_insn "float<mode><i2f>2_mul"
+ [(set (match_operand:<I2F> 0 "spu_reg_operand" "=r")
+ (mult:<I2F> (float:<I2F> (match_operand:VSI 1 "spu_reg_operand" "r"))
+ (match_operand:<I2F> 2 "spu_inv_exp2_operand" "w")))]
""
- "cuflt\t%0,%1,0"
+ "csflt\t%0,%1,%w2"
[(set_attr "type" "fp7")])
-(define_insn "floatunsv4siv4sf2"
- [(set (match_operand:V4SF 0 "spu_reg_operand" "=r")
- (unsigned_float:V4SF (match_operand:V4SI 1 "spu_reg_operand" "r")))]
+(define_insn "float<mode><i2f>2_div"
+ [(set (match_operand:<I2F> 0 "spu_reg_operand" "=r")
+ (div:<I2F> (float:<I2F> (match_operand:VSI 1 "spu_reg_operand" "r"))
+ (match_operand:<I2F> 2 "spu_exp2_operand" "v")))]
""
- "cuflt\t%0,%1,0"
+ "csflt\t%0,%1,%v2"
[(set_attr "type" "fp7")])
-(define_insn "fixuns_truncsfsi2"
- [(set (match_operand:SI 0 "spu_reg_operand" "=r")
- (unsigned_fix:SI (match_operand:SF 1 "spu_reg_operand" "r")))]
+
+(define_insn "fix_trunc<mode><f2i>2_mul"
+ [(set (match_operand:<F2I> 0 "spu_reg_operand" "=r")
+ (fix:<F2I> (mult:VSF (match_operand:VSF 1 "spu_reg_operand" "r")
+ (match_operand:VSF 2 "spu_exp2_operand" "v"))))]
""
- "cfltu\t%0,%1,0"
+ "cflts\t%0,%1,%v2"
[(set_attr "type" "fp7")])
-(define_insn "fixuns_truncv4sfv4si2"
- [(set (match_operand:V4SI 0 "spu_reg_operand" "=r")
- (unsigned_fix:V4SI (match_operand:V4SF 1 "spu_reg_operand" "r")))]
+(define_insn "floatuns<mode><i2f>2_mul"
+ [(set (match_operand:<I2F> 0 "spu_reg_operand" "=r")
+ (mult:<I2F> (unsigned_float:<I2F> (match_operand:VSI 1 "spu_reg_operand" "r"))
+ (match_operand:<I2F> 2 "spu_inv_exp2_operand" "w")))]
""
- "cfltu\t%0,%1,0"
+ "cuflt\t%0,%1,%w2"
+ [(set_attr "type" "fp7")])
+
+(define_insn "floatuns<mode><i2f>2_div"
+ [(set (match_operand:<I2F> 0 "spu_reg_operand" "=r")
+ (div:<I2F> (unsigned_float:<I2F> (match_operand:VSI 1 "spu_reg_operand" "r"))
+ (match_operand:<I2F> 2 "spu_exp2_operand" "v")))]
+ ""
+ "cuflt\t%0,%1,%v2"
+ [(set_attr "type" "fp7")])
+
+(define_insn "fixuns_trunc<mode><f2i>2_mul"
+ [(set (match_operand:<F2I> 0 "spu_reg_operand" "=r")
+ (unsigned_fix:<F2I> (mult:VSF (match_operand:VSF 1 "spu_reg_operand" "r")
+ (match_operand:VSF 2 "spu_exp2_operand" "v"))))]
+ ""
+ "cfltu\t%0,%1,%v2"
[(set_attr "type" "fp7")])
(define_insn "extendsfdf2"
diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h
index 2a7338106ee..675b94d9949 100644
--- a/gcc/config/stormy16/stormy16.h
+++ b/gcc/config/stormy16/stormy16.h
@@ -367,8 +367,6 @@ enum reg_class
/* Eliminating the Frame Pointer and the Arg Pointer */
-#define FRAME_POINTER_REQUIRED 0
-
#define ELIMINABLE_REGS \
{ \
{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h
index 79c293ab629..b841963bd2b 100644
--- a/gcc/config/v850/v850.h
+++ b/gcc/config/v850/v850.h
@@ -506,12 +506,6 @@ enum reg_class
/* Register in which static-chain is passed to a function. */
#define STATIC_CHAIN_REGNUM 20
-/* 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
-
/* If defined, this macro specifies a table of register pairs used to
eliminate unneeded registers that point into the stack frame. If
it is not defined, the only elimination attempted by the compiler
diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h
index 0447fae0a2e..5f8cd74fe36 100644
--- a/gcc/config/xtensa/xtensa-protos.h
+++ b/gcc/config/xtensa/xtensa-protos.h
@@ -55,7 +55,6 @@ extern char *xtensa_emit_bit_branch (bool, bool, rtx *);
extern char *xtensa_emit_movcc (bool, bool, bool, rtx *);
extern char *xtensa_emit_call (int, rtx *);
extern bool xtensa_legitimate_address_p (enum machine_mode, rtx, bool);
-extern rtx xtensa_legitimize_address (rtx, rtx, enum machine_mode);
extern bool xtensa_tls_referenced_p (rtx);
#ifdef TREE_CODE
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 14825c31de3..50467b4602c 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -132,6 +132,7 @@ static rtx gen_conditional_move (rtx);
static rtx fixup_subreg_mem (rtx);
static struct machine_function * xtensa_init_machine_status (void);
static rtx xtensa_legitimize_tls_address (rtx);
+static rtx xtensa_legitimize_address (rtx, rtx, enum machine_mode);
static bool xtensa_return_in_msb (const_tree);
static void printx (FILE *, signed int);
static void xtensa_function_epilogue (FILE *, HOST_WIDE_INT);
@@ -175,6 +176,9 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS (TARGET_DEFAULT | MASK_FUSED_MADD)
+#undef TARGET_LEGITIMIZE_ADDRESS
+#define TARGET_LEGITIMIZE_ADDRESS xtensa_legitimize_address
+
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS xtensa_rtx_costs
#undef TARGET_ADDRESS_COST
@@ -1873,7 +1877,7 @@ xtensa_legitimize_address (rtx x,
}
}
- return NULL_RTX;
+ return x;
}
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index 1427fd0e3da..73f68ef315f 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -810,17 +810,6 @@ typedef struct xtensa_args
&& GET_CODE (X) != LABEL_REF \
&& GET_CODE (X) != CONST)
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN) \
- do { \
- rtx new_x = xtensa_legitimize_address (X, OLDX, MODE); \
- if (new_x) \
- { \
- X = new_x; \
- goto WIN; \
- } \
- } while (0)
-
-
/* Treat constant-pool references as "mode dependent" since they can
only be accessed with SImode loads. This works around a bug in the
combiner where a constant pool reference is temporarily converted
diff --git a/gcc/configure b/gcc/configure
index 2415a6cb2d9..6033f33b6c7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1078,6 +1078,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-linker-build-id
+ compiler will always pass --build-id to linker
--enable-maintainer-mode
enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
@@ -13451,6 +13453,30 @@ static const struct {
} configure_default_options[] = $configure_default_options;
EOF
+gcc_BASEVER=`cat $srcdir/BASE-VER`
+gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
+gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
+if test -f $srcdir/REVISION ; then
+ gcc_REVISION=`cat $srcdir/REVISION`
+else
+ gcc_REVISION=""
+fi
+cat > plugin-version.h <<EOF
+#include "configargs.h"
+
+static char basever[] = "$gcc_BASEVER";
+static char datestamp[] = "$gcc_DATESTAMP";
+static char devphase[] = "$gcc_DEVPHASE";
+static char revision[] = "$gcc_REVISION";
+
+/* FIXME plugins: We should make the version information more precise.
+ One way to do is to add a checksum. */
+
+static struct plugin_gcc_version gcc_version = {basever, datestamp,
+ devphase, revision,
+ configuration_arguments};
+EOF
+
# Internationalization
# If we haven't got the data from the intl directory,
# assume NLS is disabled.
@@ -14359,13 +14385,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:14362: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:14388: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:14365: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:14391: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:14368: output\"" >&5)
+ (eval echo "\"\$as_me:14394: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -15522,7 +15548,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 15525 "configure"' > conftest.$ac_ext
+ echo '#line 15551 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -16821,11 +16847,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16824: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16850: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16828: \$? = $ac_status" >&5
+ echo "$as_me:16854: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17160,11 +17186,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17163: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17189: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:17167: \$? = $ac_status" >&5
+ echo "$as_me:17193: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -17265,11 +17291,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17268: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17294: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:17272: \$? = $ac_status" >&5
+ echo "$as_me:17298: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17320,11 +17346,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17323: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17349: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:17327: \$? = $ac_status" >&5
+ echo "$as_me:17353: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -20132,7 +20158,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20135 "configure"
+#line 20161 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20228,7 +20254,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20231 "configure"
+#line 20257 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -24093,6 +24119,56 @@ _ACEOF
;;
esac
+echo "$as_me:$LINENO: checking linker --build-id support" >&5
+echo $ECHO_N "checking linker --build-id support... $ECHO_C" >&6
+if test "${gcc_cv_ld_buildid+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_ld_buildid=no
+ if test $in_tree_ld = yes ; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a \
+ "$gcc_cv_gld_minor_version" -ge 18 -o \
+ "$gcc_cv_gld_major_version" -gt 2 \
+ && test $in_tree_ld_is_elf = yes; then
+ gcc_cv_ld_buildid=yes
+ fi
+ elif test x$gcc_cv_ld != x; then
+ if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
+ gcc_cv_ld_buildid=yes
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_ld_buildid" >&5
+echo "${ECHO_T}$gcc_cv_ld_buildid" >&6
+if test x"$gcc_cv_ld_buildid" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LD_BUILDID 1
+_ACEOF
+
+fi
+
+# Check whether --enable-linker-build-id or --disable-linker-build-id was given.
+if test "${enable_linker_build_id+set}" = set; then
+ enableval="$enable_linker_build_id"
+
+else
+ enable_linker_build_id=no
+fi;
+
+if test x"$enable_linker_build_id" = xyes; then
+ if test x"$gcc_cv_ld_buildid" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define ENABLE_LD_BUILDID 1
+_ACEOF
+
+ else
+ { echo "$as_me:$LINENO: WARNING: --build-id is not supported by your linker; --enable-linker-build-id ignored" >&5
+echo "$as_me: WARNING: --build-id is not supported by your linker; --enable-linker-build-id ignored" >&2;}
+ fi
+fi
+
echo "$as_me:$LINENO: checking linker --sysroot support" >&5
echo $ECHO_N "checking linker --sysroot support... $ECHO_C" >&6
if test "${gcc_cv_ld_sysroot+set}" = set; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 849b856f9c9..5f9276cbc74 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1495,6 +1495,32 @@ static const struct {
EOF
changequote([,])dnl
+changequote(,)dnl
+gcc_BASEVER=`cat $srcdir/BASE-VER`
+gcc_DEVPHASE=`cat $srcdir/DEV-PHASE`
+gcc_DATESTAMP=`cat $srcdir/DATESTAMP`
+if test -f $srcdir/REVISION ; then
+ gcc_REVISION=`cat $srcdir/REVISION`
+else
+ gcc_REVISION=""
+fi
+cat > plugin-version.h <<EOF
+#include "configargs.h"
+
+static char basever[] = "$gcc_BASEVER";
+static char datestamp[] = "$gcc_DATESTAMP";
+static char devphase[] = "$gcc_DEVPHASE";
+static char revision[] = "$gcc_REVISION";
+
+/* FIXME plugins: We should make the version information more precise.
+ One way to do is to add a checksum. */
+
+static struct plugin_gcc_version gcc_version = {basever, datestamp,
+ devphase, revision,
+ configuration_arguments};
+EOF
+changequote([,])dnl
+
# Internationalization
ZW_GNU_GETTEXT_SISTER_DIR
@@ -3484,6 +3510,41 @@ EOF
;;
esac
+AC_CACHE_CHECK(linker --build-id support,
+ gcc_cv_ld_buildid,
+ [gcc_cv_ld_buildid=no
+ if test $in_tree_ld = yes ; then
+ if test "$gcc_cv_gld_major_version" -eq 2 -a \
+ "$gcc_cv_gld_minor_version" -ge 18 -o \
+ "$gcc_cv_gld_major_version" -gt 2 \
+ && test $in_tree_ld_is_elf = yes; then
+ gcc_cv_ld_buildid=yes
+ fi
+ elif test x$gcc_cv_ld != x; then
+ if $gcc_cv_ld --help 2>/dev/null | grep build-id > /dev/null; then
+ gcc_cv_ld_buildid=yes
+ fi
+ fi])
+if test x"$gcc_cv_ld_buildid" = xyes; then
+ AC_DEFINE(HAVE_LD_BUILDID, 1,
+ [Define if your linker supports --build-id.])
+fi
+
+AC_ARG_ENABLE(linker-build-id,
+[ --enable-linker-build-id
+ compiler will always pass --build-id to linker],
+[],
+enable_linker_build_id=no)
+
+if test x"$enable_linker_build_id" = xyes; then
+ if test x"$gcc_cv_ld_buildid" = xyes; then
+ AC_DEFINE(ENABLE_LD_BUILDID, 1,
+ [Define if gcc should always pass --build-id to linker.])
+ else
+ AC_MSG_WARN(--build-id is not supported by your linker; --enable-linker-build-id ignored)
+ fi
+fi
+
AC_CACHE_CHECK(linker --sysroot support,
gcc_cv_ld_sysroot,
[gcc_cv_ld_sysroot=no
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 383617dce83..8720d252a55 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -72,7 +72,7 @@ struct cpp_def_list
typedef struct counts_entry
{
/* We hash by */
- unsigned HOST_WIDE_INT ident;
+ unsigned HOST_WIDEST_INT ident;
unsigned ctr;
/* Store */
@@ -522,8 +522,8 @@ get_coverage_counts (unsigned counter, unsigned expected,
if (!entry)
{
- warning (0, "no coverage for function %qs found", IDENTIFIER_POINTER
- (DECL_ASSEMBLER_NAME (current_function_decl)));
+ warning (0, "no coverage for function %qE found",
+ DECL_ASSEMBLER_NAME (current_function_decl));
return NULL;
}
@@ -532,14 +532,13 @@ get_coverage_counts (unsigned counter, unsigned expected,
|| entry->summary.num != expected)
{
static int warned = 0;
- const char *id = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME
- (current_function_decl));
+ tree id = DECL_ASSEMBLER_NAME (current_function_decl);
if (warn_coverage_mismatch)
warning (OPT_Wcoverage_mismatch, "coverage mismatch for function "
- "%qs while reading counter %qs", id, ctr_names[counter]);
+ "%qE while reading counter %qs", id, ctr_names[counter]);
else
- error ("coverage mismatch for function %qs while reading counter %qs",
+ error ("coverage mismatch for function %qE while reading counter %qs",
id, ctr_names[counter]);
if (!inhibit_warnings)
@@ -854,7 +853,7 @@ coverage_function_present (unsigned fn_ident)
struct function_list *item = functions_head;
while (item && item->ident != fn_ident)
item = item->next;
- return item != 0;
+ return item != NULL;
}
/* Update function and program direct-call coverage counts. */
@@ -1062,68 +1061,10 @@ build_ctr_info_value (unsigned int counter, tree type)
return value;
}
-#if 0
-static tree
-build_gcov_module_info_type (unsigned num_quote_paths,
- unsigned num_bracket_paths)
-{
- tree field, fields = NULL_TREE;
- tree string_type, index_type, path_array_type;
-
- tree type = lang_hooks.types.make_type (RECORD_TYPE);
-
- string_type = build_pointer_type (
- build_qualified_type (char_type_node,
- TYPE_QUAL_CONST));
- /* ident */
- field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* is_primary */
- field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* is_exported */
- field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* Lang field */
- field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* da filename */
- field = build_decl (FIELD_DECL, NULL_TREE, string_type);
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* Source name */
- field = build_decl (FIELD_DECL, NULL_TREE, string_type);
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* num_quote_paths */
- field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- TREE_CHAIN (field) = fields;
- fields = field;
-
- /* num_bracket_paths */
- field = build_decl (FIELD_DECL, NULL_TREE, get_gcov_unsigned_t ());
- TREE_CHAIN (field) = fields;
- fields = field;
-
- index_type = build_index_type (
- build_int_cst (NULL_TREE, num_quote_paths + num_bracket_paths));
- path_array_type = build_array_type (string_type, index_type);
-
- finish_builtin_struct (type, "__gcov_module_info", fields, NULL_TREE);
-
- return type;
-}
-#endif
+/* Returns an array (tree) of include path strings. STRING_TYPE is
+ the path string type, INC_PATH_VALUE is the initial value of the
+ path array, PATHS gives raw path string values, and NUM is the
+ number of paths. */
static tree
build_inc_path_array_value (tree string_type, tree inc_path_value,
@@ -1152,6 +1093,10 @@ build_inc_path_array_value (tree string_type, tree inc_path_value,
return inc_path_value;
}
+/* Returns an array (tree) of macro def strings. STRING_TYPE is
+ the string type, CPP_DEF_VALUE is the initial value of the
+ macro array, and HEAD gives the list of raw strings. */
+
static tree
build_cpp_def_array_value (tree string_type, tree cpp_def_value,
struct cpp_def_list *head)
@@ -1176,6 +1121,9 @@ build_cpp_def_array_value (tree string_type, tree cpp_def_value,
return cpp_def_value;
}
+/* Returns the value of the module info associated with the
+ current source module being compiled. */
+
static tree
build_gcov_module_info_value (void)
{
@@ -1292,9 +1240,9 @@ build_gcov_module_info_value (void)
num_bracket_paths +
num_cpp_defines));
string_array_type = build_array_type (string_type, index_type);
- string_array = build_inc_path_array_value (string_type, string_array,
+ string_array = build_inc_path_array_value (string_type, string_array,
quote_paths, num_quote_paths);
- string_array = build_inc_path_array_value (string_type, string_array,
+ string_array = build_inc_path_array_value (string_type, string_array,
bracket_paths, num_bracket_paths);
string_array = build_cpp_def_array_value (string_type, string_array,
cpp_defines_head);
@@ -1580,10 +1528,12 @@ rebuild_counts_hash (void)
counts_hash = new_counts_hash;
}
-/* Used in forced LIPO mode */
+/* Add the module information record for the module with id
+ MODULE_ID. IS_PRIMARY is true if the module is the primary module.
+ INDEX is the index of the new record in the module info array. */
+
void
-add_module_info (unsigned module_id, int is_primary,
- int index)
+add_module_info (unsigned module_id, int is_primary, int index)
{
struct gcov_module_info *cur_info;
module_infos = XRESIZEVEC (struct gcov_module_info *,
@@ -1600,6 +1550,10 @@ add_module_info (unsigned module_id, int is_primary,
primary_module_id = module_id;
}
+/* Set the prepreprocessing context (include search paths, -D/-U).
+ PARSE_IN is the preprocessor reader, I is the index of the module,
+ and VERBOSE is the verbose flag. */
+
void
set_parsing_context (struct cpp_reader *parse_in, int i, bool verbose)
{
@@ -1713,7 +1667,12 @@ coverage_finish (void)
}
}
-void coverage_note_define (const char *cpp_def, bool is_def)
+/* Copies the macro def or undef CPP_DEF and saves the copy
+ in a list. IS_DEF is a flag indicating if CPP_DEF represents
+ a -D or -U. */
+
+void
+coverage_note_define (const char *cpp_def, bool is_def)
{
struct cpp_def_list *d = XNEW (struct cpp_def_list);
d->cpp_def = XNEWVEC (char, strlen (cpp_def) + 2);
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3feda531fde..cc7b5f77848 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,113 @@
+2009-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c/36892
+ * call.c (build_call_a): Updated warn_deprecated_use call.
+ (build_over_call): Likewise.
+ * decl.c (grokdeclarator): Likewise.
+ (grokparms): Likewise.
+ * semantics.c (finish_id_expression): Likewise.
+ * typeck.c (build_class_member_access_expr): Likewise.
+ (finish_class_member_access_expr): Likewise.
+
+2009-05-06 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/17395
+ * pt.c (tsubst_copy) <case PARM_DECL>: We don't want to tsubst the
+ whole list of PARM_DECLs, just the current one.
+
+2009-05-05 Shujing Zhao <pearly.zhao@oracle.com>
+
+ * cp-tree.h:
+ (opname_tab, assignop_tab, update_member_visibility, yyerror, yyhook,
+ mangle_compound_literal): Remove unused declarations.
+ (build_vfield_ref, cxx_print_statistics, clone_function_decl,
+ adjust_clone_args, maybe_push_cleanup_level, pushtag, make_anon_name,
+ pushdecl_top_level_maybe_friend, pushdecl_top_level_and_finish,
+ check_for_out_of_scope_variable, print_other_binding_stack,
+ maybe_push_decl, cxx_mark_addressable, force_target_expr,
+ build_target_expr_with_type, finish_case_label,
+ cxx_maybe_build_cleanup, begin_eh_spec_block, finish_eh_spec_block,
+ check_template_keyword, cxx_omp_predetermined_sharing,
+ cxx_omp_clause_default_ctor, cxx_omp_clause_copy_ctor,
+ cxx_omp_clause_assign_op, cxx_omp_clause_dtor, cxx_omp_finish_clause,
+ cxx_omp_privatize_by_reference): Rearrange the declarations line to
+ match the comment that indicates the .c file which the functions are
+ defined.
+ (cxx_print_xnode, cxx_print_decl, cxx_print_type,
+ cxx_print_identifier, cxx_print_error_function, pushdecl): Add comment.
+
+2009-05-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * typeck.c (cp_build_compound_expr): Require RHS to have a known
+ type.
+ * class.c (resolve_address_of_overloaded_function): Use
+ OVL_CURRENT for error message.
+ (instantiate_type): Forbid COMPOUND_EXPRs and remove code dealing
+ with them. Do not copy the node.
+
+2009-05-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/40013
+ * pt.c (tsubst): If magic NOP_EXPR with side-effects has no type,
+ set it from its operand's type after tsubst_expr.
+
+2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c++/28152
+ * parser.c (cp_lexer_get_preprocessor_token): Do not store the
+ canonical spelling for keywords.
+ (cp_parser_attribute_list): Use the canonical spelling for
+ keywords in attributes.
+
+2009-05-01 Joseph Myers <joseph@codesourcery.com>
+
+ * cxx-pretty-print.c (is_destructor_name, pp_cxx_unqualified_id,
+ pp_cxx_template_keyword_if_needed, pp_cxx_postfix_expression,
+ pp_cxx_new_expression, pp_cxx_delete_expression,
+ pp_cxx_unary_expression, pp_cxx_assignment_operator,
+ pp_cxx_assignment_expression, pp_cxx_expression,
+ pp_cxx_function_specifier, pp_cxx_decl_specifier_seq,
+ pp_cxx_simple_type_specifier, pp_cxx_type_specifier_seq,
+ pp_cxx_exception_specification, pp_cxx_direct_declarator,
+ pp_cxx_ctor_initializer, pp_cxx_type_id, pp_cxx_statement,
+ pp_cxx_namespace_alias_definition, pp_cxx_template_parameter,
+ pp_cxx_canonical_template_parameter, pp_cxx_template_declaration,
+ pp_cxx_declaration, pp_cxx_typeid_expression,
+ pp_cxx_va_arg_expression, pp_cxx_offsetof_expression,
+ pp_cxx_trait_expression): Mostly use pp_string and
+ pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier
+ for non-identifiers. Mark English strings for translation.
+ * cxx-pretty-print.h (pp_cxx_ws_string): Define.
+ * error.c (dump_template_parameter, dump_template_bindings,
+ dump_type, dump_aggr_type, dump_type_prefix, dump_simple_decl,
+ dump_decl, dump_template_decl, dump_function_decl,
+ dump_parameters, dump_exception_spec, dump_template_parms,
+ dump_expr, dump_binary_op, dump_unary_op, op_to_string,
+ assop_to_string, args_to_string, cp_print_error_function,
+ print_instantiation_full_context,
+ print_instantiation_partial_context): Mostly use pp_string and
+ pp_cxx_ws_string in place of pp_identifier and pp_cxx_identifier
+ for non-identifiers. Mark English strings for translation.
+ (dump_global_iord): Mark strings for translation; use longer
+ strings instead of substituting single words.
+ (function_category): Return a format string marked for
+ translation, not a single word or phrase to substitute in a longer
+ phrase.
+
+2009-04-28 Ben Elliston <bje@au.ibm.com>
+
+ PR c++/35652
+ Revert:
+
+ 2009-03-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * typeck.c (cp_pointer_sum): Adjust call to pointer_int_sum.
+
+2009-04-27 Ian Lance Taylor <iant@google.com>
+
+ * semantics.c (finish_omp_clauses): Change type of c_kind to enum
+ omp_clause_code.
+
2009-04-27 Jakub Jelinek <jakub@redhat.com>
PR c++/39875
@@ -722,9 +832,9 @@
2009-02-01 Paolo Carlini <paolo.carlini@oracle.com>
- PR c++/39053
- * parser.c (cp_parser_pure_specifier): If there are no tokens left
- do not call cp_lexer_consume_token.
+ PR c++/39053
+ * parser.c (cp_parser_pure_specifier): If there are no tokens left
+ do not call cp_lexer_consume_token.
2009-01-30 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index ca45bee5bd8..ba8dac153a3 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -342,7 +342,7 @@ build_call_a (tree function, int n, tree *argarray)
current_function_returns_abnormally = 1;
if (decl && TREE_DEPRECATED (decl))
- warn_deprecated_use (decl);
+ warn_deprecated_use (decl, NULL_TREE);
require_complete_eh_spec_types (fntype, decl);
if (decl && DECL_CONSTRUCTOR_P (decl))
@@ -5457,7 +5457,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
/* Warn about deprecated virtual functions now, since we're about
to throw away the decl. */
if (TREE_DEPRECATED (fn))
- warn_deprecated_use (fn);
+ warn_deprecated_use (fn, NULL_TREE);
argarray[0] = build_base_path (PLUS_EXPR, argarray[0], binfo, 1);
if (TREE_SIDE_EFFECTS (argarray[0]))
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index a20b8c4c565..6ad941510ba 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6147,7 +6147,7 @@ resolve_address_of_overloaded_function (tree target_type,
if (flags & tf_error)
{
error ("no matches converting function %qD to type %q#T",
- DECL_NAME (OVL_FUNCTION (overload)),
+ DECL_NAME (OVL_CURRENT (overload)),
target_type);
/* print_candidates expects a chain with the functions in
@@ -6310,13 +6310,8 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
dependent on overload resolution. */
gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
|| TREE_CODE (rhs) == COMPONENT_REF
- || TREE_CODE (rhs) == COMPOUND_EXPR
- || really_overloaded_fn (rhs));
-
- /* 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);
+ || really_overloaded_fn (rhs)
+ || (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL));
/* This should really only be used when attempting to distinguish
what sort of a pointer to function we have. For now, any
@@ -6368,19 +6363,6 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
/*explicit_targs=*/NULL_TREE,
access_path);
- 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 ADDR_EXPR:
{
if (PTRMEM_OK_P (rhs))
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index f60d87ff87b..e9cbec6558f 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -625,7 +625,7 @@ cp_save_built_in_decl_post_parsing (void)
}
}
-/* Restore builtins and their bindings to their post parsing values */
+/* Restore builtins and their bindings to their post parsing values. */
void
cp_restore_built_in_decl_post_parsing (void)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 1887f5649c6..5f4b9a2f313 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3949,11 +3949,6 @@ enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
extern void init_reswords (void);
-/* Indexed by TREE_CODE, these tables give C-looking names to
- operators represented by TREE_CODES. For example,
- opname_tab[(int) MINUS_EXPR] == "-". */
-extern const char **opname_tab, **assignop_tab;
-
typedef struct GTY(()) operator_name_info_t {
/* The IDENTIFIER_NODE for the operator. */
tree identifier;
@@ -4169,7 +4164,6 @@ extern bool pragma_java_exceptions;
/* in call.c */
extern bool check_dtor_name (tree, tree);
-extern tree build_vfield_ref (tree, tree);
extern tree build_conditional_expr (tree, tree, tree,
tsubst_flags_t);
extern tree build_addr_func (tree);
@@ -4218,6 +4212,7 @@ extern void validate_conversion_obstack (void);
#endif /* ENABLE_CHECKING */
/* in class.c */
+extern tree build_vfield_ref (tree, tree);
extern tree build_base_path (enum tree_code, tree,
tree, int);
extern tree convert_to_base (tree, tree, bool, bool);
@@ -4245,14 +4240,6 @@ extern void push_lang_context (tree);
extern void pop_lang_context (void);
extern tree instantiate_type (tree, tree, tsubst_flags_t);
extern void print_class_statistics (void);
-extern void cxx_print_statistics (void);
-extern void cxx_print_xnode (FILE *, tree, int);
-extern void cxx_print_decl (FILE *, tree, int);
-extern void cxx_print_type (FILE *, tree, int);
-extern void cxx_print_identifier (FILE *, tree, int);
-extern void cxx_print_error_function (struct diagnostic_context *,
- const char *,
- struct diagnostic_info *);
extern void build_self_reference (void);
extern int same_signature_p (const_tree, const_tree);
extern void maybe_add_class_template_decl_list (tree, tree, int);
@@ -4274,6 +4261,8 @@ extern bool type_has_user_provided_constructor (tree);
extern bool type_has_user_provided_default_constructor (tree);
extern bool defaultable_fn_p (tree);
extern void fixup_type_variants (tree);
+extern void clone_function_decl (tree, int);
+extern void adjust_clone_args (tree);
/* in cvt.c */
extern tree convert_to_reference (tree, tree, int, int, tree);
@@ -4288,34 +4277,35 @@ extern tree convert_force (tree, tree, int);
extern tree build_expr_type_conversion (int, tree, bool);
extern tree type_promotes_to (tree);
extern tree perform_qualification_conversions (tree, tree);
-extern void clone_function_decl (tree, int);
-extern void adjust_clone_args (tree);
-/* decl.c */
-extern tree poplevel (int, int, int);
+/* in name-lookup.c */
extern tree pushdecl (tree);
extern tree pushdecl_maybe_friend (tree, bool);
+extern void maybe_push_cleanup_level (tree);
+extern tree pushtag (tree, tree, tag_scope);
+extern tree make_anon_name (void);
+extern tree pushdecl_top_level_maybe_friend (tree, bool);
+extern tree pushdecl_top_level_and_finish (tree, tree);
+extern tree check_for_out_of_scope_variable (tree);
+extern void print_other_binding_stack (struct cp_binding_level *);
+extern tree maybe_push_decl (tree);
+
+/* decl.c */
+extern tree poplevel (int, int, int);
extern void cxx_init_decl_processing (void);
enum cp_tree_node_structure_enum cp_tree_node_structure
(union lang_tree_node *);
-extern bool cxx_mark_addressable (tree);
-extern void maybe_push_cleanup_level (tree);
extern void finish_scope (void);
extern void push_switch (tree);
extern void pop_switch (void);
-extern tree pushtag (tree, tree, tag_scope);
-extern tree make_anon_name (void);
extern int decls_match (tree, tree);
extern tree duplicate_decls (tree, tree, bool);
-extern tree pushdecl_top_level_maybe_friend (tree, bool);
-extern tree pushdecl_top_level_and_finish (tree, tree);
extern tree declare_local_label (tree);
extern tree define_label (location_t, tree);
extern void check_goto (tree);
extern bool check_omp_return (void);
extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t);
extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t);
-extern tree check_for_out_of_scope_variable (tree);
extern tree build_library_fn_ptr (const char *, tree);
extern tree build_cp_library_fn_ptr (const char *, tree);
extern tree push_library_fn (tree, tree, tree);
@@ -4359,7 +4349,6 @@ extern void maybe_register_incomplete_var (tree);
extern void maybe_commonize_var (tree);
extern void complete_vars (tree);
extern void finish_stmt (void);
-extern void print_other_binding_stack (struct cp_binding_level *);
extern void revert_static_member_fn (tree);
extern void fixup_anonymous_aggr (tree);
extern int check_static_variable_definition (tree, tree);
@@ -4370,9 +4359,6 @@ extern int walk_namespaces (walk_namespaces_fn,
void *);
extern int wrapup_globals_for_namespace (tree, void *);
extern tree create_implicit_typedef (tree, tree);
-extern tree maybe_push_decl (tree);
-extern tree force_target_expr (tree, tree);
-extern tree build_target_expr_with_type (tree, tree);
extern int local_variable_p (const_tree);
extern tree register_dtor_fn (tree);
extern tmpl_spec_kind current_tmpl_spec_kind (int);
@@ -4389,6 +4375,8 @@ extern tree reshape_init (tree, tree);
extern bool defer_mark_used_calls;
extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls;
+extern tree finish_case_label (tree, tree);
+extern tree cxx_maybe_build_cleanup (tree);
/* in decl2.c */
extern bool check_java_method (tree);
@@ -4417,7 +4405,6 @@ extern tree coerce_delete_type (tree);
extern void comdat_linkage (tree);
extern void determine_visibility (tree);
extern void constrain_class_visibility (tree);
-extern void update_member_visibility (tree);
extern void import_export_decl (tree);
extern tree build_cleanup (tree);
extern tree build_offset_ref_call_from_tree (tree, tree);
@@ -4459,6 +4446,8 @@ extern int nothrow_libfn_p (const_tree);
extern void check_handlers (tree);
extern void choose_personality_routine (enum languages);
extern tree eh_type_info (tree);
+extern tree begin_eh_spec_block (void);
+extern void finish_eh_spec_block (tree, tree);
/* in expr.c */
extern tree cplus_expand_constant (tree);
@@ -4507,8 +4496,6 @@ extern tree copy_decl (tree);
extern tree copy_type (tree);
extern tree cxx_make_type (enum tree_code);
extern tree make_class_type (enum tree_code);
-extern void yyerror (const char *);
-extern void yyhook (int);
extern bool cxx_init (void);
extern void cxx_finish (void);
extern bool in_main_input_context (void);
@@ -4728,12 +4715,9 @@ extern tree finish_continue_stmt (void);
extern tree begin_switch_stmt (void);
extern void finish_switch_cond (tree, tree);
extern void finish_switch_stmt (tree);
-extern tree finish_case_label (tree, tree);
extern tree finish_goto_stmt (tree);
extern tree begin_try_block (void);
extern void finish_try_block (tree);
-extern tree begin_eh_spec_block (void);
-extern void finish_eh_spec_block (tree, tree);
extern void finish_handler_sequence (tree);
extern tree begin_function_try_block (tree *);
extern void finish_function_try_block (tree);
@@ -4780,7 +4764,6 @@ extern tree finish_base_specifier (tree, tree, bool);
extern void finish_member_declaration (tree);
extern void qualified_name_lookup_error (tree, tree, tree,
location_t);
-extern void check_template_keyword (tree);
extern tree finish_id_expression (tree, tree, tree,
cp_id_kind *,
bool, bool, bool *,
@@ -4815,13 +4798,6 @@ extern void finish_omp_atomic (enum tree_code, tree, tree);
extern void finish_omp_barrier (void);
extern void finish_omp_flush (void);
extern void finish_omp_taskwait (void);
-extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
-extern tree cxx_omp_clause_default_ctor (tree, tree, tree);
-extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
-extern tree cxx_omp_clause_assign_op (tree, tree, tree);
-extern tree cxx_omp_clause_dtor (tree, tree);
-extern void cxx_omp_finish_clause (tree);
-extern bool cxx_omp_privatize_by_reference (const_tree);
extern bool cxx_omp_create_clause_info (tree, tree, bool, bool, bool);
extern tree baselink_for_fns (tree);
extern void finish_static_assert (tree, tree, location_t,
@@ -4831,6 +4807,8 @@ extern tree finish_decltype_type (tree, bool);
extern tree finish_trait_expr (enum cp_trait_kind, tree, tree);
/* in tree.c */
+extern tree force_target_expr (tree, tree);
+extern tree build_target_expr_with_type (tree, tree);
extern void lang_check_failed (const char *, int,
const char *) ATTRIBUTE_NORETURN;
extern tree stabilize_expr (tree, tree *);
@@ -4838,7 +4816,6 @@ extern void stabilize_call (tree, tree *);
extern void stabilize_aggr_init (tree, tree *);
extern bool stabilize_init (tree, tree *);
extern tree add_stmt_to_compound (tree, tree);
-extern tree cxx_maybe_build_cleanup (tree);
extern void init_tree (void);
extern int pod_type_p (const_tree);
extern bool class_tmpl_impl_spec_p (const_tree);
@@ -4909,7 +4886,19 @@ extern tree cp_save_expr (tree);
extern bool cast_valid_in_integral_constant_expression_p (tree);
extern bool cxx_type_hash_eq (const_tree, const_tree);
+extern void cxx_print_statistics (void);
+
+/* in ptree.c */
+extern void cxx_print_xnode (FILE *, tree, int);
+extern void cxx_print_decl (FILE *, tree, int);
+extern void cxx_print_type (FILE *, tree, int);
+extern void cxx_print_identifier (FILE *, tree, int);
+extern void cxx_print_error_function (struct diagnostic_context *,
+ const char *,
+ struct diagnostic_info *);
+
/* in typeck.c */
+extern bool cxx_mark_addressable (tree);
extern int string_conv_p (const_tree, const_tree, int);
extern tree cp_truthvalue_conversion (tree);
extern tree condition_conversion (tree);
@@ -4998,6 +4987,7 @@ extern tree convert_member_func_to_ptr (tree, tree);
extern tree convert_ptrmem (tree, tree, bool, bool);
extern int lvalue_or_else (tree, enum lvalue_use,
tsubst_flags_t);
+extern void check_template_keyword (tree);
/* in typeck2.c */
extern void require_complete_eh_spec_types (tree, tree);
@@ -5035,7 +5025,6 @@ extern tree mangle_thunk (tree, int, tree, tree);
extern tree mangle_conv_op_name_for_type (tree);
extern tree mangle_guard_variable (tree);
extern tree mangle_ref_init_variable (tree);
-extern tree mangle_compound_literal (void);
/* in dump.c */
extern bool cp_dump_tree (void *, tree);
@@ -5071,6 +5060,13 @@ extern void cp_restore_built_in_decl_post_parsing (void);
extern int cp_gimplify_expr (tree *, gimple_seq *,
gimple_seq *);
extern void cp_genericize (tree);
+extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
+extern tree cxx_omp_clause_default_ctor (tree, tree, tree);
+extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
+extern tree cxx_omp_clause_assign_op (tree, tree, tree);
+extern tree cxx_omp_clause_dtor (tree, tree);
+extern void cxx_omp_finish_clause (tree);
+extern bool cxx_omp_privatize_by_reference (const_tree);
/* -- end of C++ */
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index cf9ed482e84..2edffd37548 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1,5 +1,6 @@
/* Implementation of subroutines for the GNU C++ pretty-printer.
- Copyright (C) 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
@@ -23,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "real.h"
+#include "intl.h"
#include "cxx-pretty-print.h"
#include "cp-tree.h"
#include "toplev.h"
@@ -116,7 +118,7 @@ is_destructor_name (tree name)
static inline void
pp_cxx_conversion_function_id (cxx_pretty_printer *pp, tree t)
{
- pp_cxx_identifier (pp, "operator");
+ pp_cxx_ws_string (pp, "operator");
pp_cxx_type_specifier_seq (pp, TREE_TYPE (t));
}
@@ -145,7 +147,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
switch (code)
{
case RESULT_DECL:
- pp_cxx_identifier (pp, "<return-value>");
+ pp_cxx_ws_string (pp, _("<return-value>"));
break;
case OVERLOAD:
@@ -164,7 +166,7 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
case IDENTIFIER_NODE:
if (t == NULL)
- pp_cxx_identifier (pp, "<unnamed>");
+ pp_cxx_ws_string (pp, _("<unnamed>"));
else if (IDENTIFIER_TYPENAME_P (t))
pp_cxx_conversion_function_id (pp, t);
else
@@ -237,7 +239,7 @@ pp_cxx_template_keyword_if_needed (cxx_pretty_printer *pp, tree scope, tree t)
{
if (TREE_CODE (t) == TEMPLATE_ID_EXPR
&& TYPE_P (scope) && dependent_type_p (scope))
- pp_cxx_identifier (pp, "template");
+ pp_cxx_ws_string (pp, "template");
}
/* nested-name-specifier:
@@ -566,13 +568,13 @@ pp_cxx_postfix_expression (cxx_pretty_printer *pp, tree t)
case REINTERPRET_CAST_EXPR:
case CONST_CAST_EXPR:
if (code == DYNAMIC_CAST_EXPR)
- pp_cxx_identifier (pp, "dynamic_cast");
+ pp_cxx_ws_string (pp, "dynamic_cast");
else if (code == STATIC_CAST_EXPR)
- pp_cxx_identifier (pp, "static_cast");
+ pp_cxx_ws_string (pp, "static_cast");
else if (code == REINTERPRET_CAST_EXPR)
- pp_cxx_identifier (pp, "reinterpret_cast");
+ pp_cxx_ws_string (pp, "reinterpret_cast");
else
- pp_cxx_identifier (pp, "const_cast");
+ pp_cxx_ws_string (pp, "const_cast");
pp_cxx_begin_template_argument_list (pp);
pp_cxx_type_id (pp, TREE_TYPE (t));
pp_cxx_end_template_argument_list (pp);
@@ -644,7 +646,7 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
case VEC_NEW_EXPR:
if (NEW_EXPR_USE_GLOBAL (t))
pp_cxx_colon_colon (pp);
- pp_cxx_identifier (pp, "new");
+ pp_cxx_ws_string (pp, "new");
if (TREE_OPERAND (t, 0))
{
pp_cxx_call_argument_list (pp, TREE_OPERAND (t, 0));
@@ -689,7 +691,7 @@ pp_cxx_delete_expression (cxx_pretty_printer *pp, tree t)
case VEC_DELETE_EXPR:
if (DELETE_EXPR_USE_GLOBAL (t))
pp_cxx_colon_colon (pp);
- pp_cxx_identifier (pp, "delete");
+ pp_cxx_ws_string (pp, "delete");
pp_space (pp);
if (code == VEC_DELETE_EXPR
|| DELETE_EXPR_USE_VEC (t))
@@ -743,8 +745,8 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
case SIZEOF_EXPR:
if (PACK_EXPANSION_P (TREE_OPERAND (t, 0)))
{
- pp_cxx_identifier (pp, "sizeof");
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "sizeof");
+ pp_cxx_ws_string (pp, "...");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
if (TYPE_P (TREE_OPERAND (t, 0)))
@@ -757,7 +759,7 @@ pp_cxx_unary_expression (cxx_pretty_printer *pp, tree t)
/* Fall through */
case ALIGNOF_EXPR:
- pp_cxx_identifier (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
+ pp_cxx_ws_string (pp, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
pp_cxx_whitespace (pp);
if (TYPE_P (TREE_OPERAND (t, 0)))
{
@@ -924,7 +926,7 @@ pp_cxx_assignment_operator (cxx_pretty_printer *pp, tree t)
break;
}
- pp_cxx_identifier (pp, op);
+ pp_cxx_ws_string (pp, op);
}
@@ -954,7 +956,7 @@ pp_cxx_assignment_expression (cxx_pretty_printer *pp, tree e)
break;
case THROW_EXPR:
- pp_cxx_identifier (pp, "throw");
+ pp_cxx_ws_string (pp, "throw");
if (TREE_OPERAND (e, 0))
pp_cxx_assignment_expression (pp, TREE_OPERAND (e, 0));
break;
@@ -1076,7 +1078,7 @@ pp_cxx_expression (cxx_pretty_printer *pp, tree t)
case EXPR_PACK_EXPANSION:
pp_cxx_expression (pp, PACK_EXPANSION_PATTERN (t));
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
break;
case NONTYPE_ARGUMENT_PACK:
@@ -1113,9 +1115,9 @@ pp_cxx_function_specifier (cxx_pretty_printer *pp, tree t)
{
case FUNCTION_DECL:
if (DECL_VIRTUAL_P (t))
- pp_cxx_identifier (pp, "virtual");
+ pp_cxx_ws_string (pp, "virtual");
else if (DECL_CONSTRUCTOR_P (t) && DECL_NONCONVERTING_P (t))
- pp_cxx_identifier (pp, "explicit");
+ pp_cxx_ws_string (pp, "explicit");
else
pp_c_function_specifier (pp_c_base (pp), t);
@@ -1148,7 +1150,7 @@ pp_cxx_decl_specifier_seq (cxx_pretty_printer *pp, tree t)
break;
case TYPE_DECL:
- pp_cxx_identifier (pp, "typedef");
+ pp_cxx_ws_string (pp, "typedef");
pp_cxx_decl_specifier_seq (pp, TREE_TYPE (t));
break;
@@ -1209,7 +1211,7 @@ pp_cxx_simple_type_specifier (cxx_pretty_printer *pp, tree t)
break;
case TYPENAME_TYPE:
- pp_cxx_identifier (pp, "typename");
+ pp_cxx_ws_string (pp, "typename");
pp_cxx_nested_name_specifier (pp, TYPE_CONTEXT (t));
pp_cxx_unqualified_id (pp, TYPE_NAME (t));
break;
@@ -1251,7 +1253,7 @@ pp_cxx_type_specifier_seq (cxx_pretty_printer *pp, tree t)
break;
case DECLTYPE_TYPE:
- pp_cxx_identifier (pp, "decltype");
+ pp_cxx_ws_string (pp, "decltype");
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, DECLTYPE_TYPE_EXPR (t));
pp_cxx_right_paren (pp);
@@ -1393,7 +1395,7 @@ pp_cxx_exception_specification (cxx_pretty_printer *pp, tree t)
if (!TYPE_NOTHROW_P (t) && ex_spec == NULL)
return;
- pp_cxx_identifier (pp, "throw");
+ pp_cxx_ws_string (pp, "throw");
pp_cxx_left_paren (pp);
for (; ex_spec && TREE_VALUE (ex_spec); ex_spec = TREE_CHAIN (ex_spec))
{
@@ -1447,7 +1449,7 @@ pp_cxx_direct_declarator (cxx_pretty_printer *pp, tree t)
|| template_parameter_pack_p (t))
/* A function parameter pack or non-type template
parameter pack. */
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
pp_cxx_id_expression (pp, DECL_NAME (t));
}
@@ -1523,7 +1525,7 @@ pp_cxx_ctor_initializer (cxx_pretty_printer *pp, tree t)
pp_cxx_primary_expression (pp, purpose);
pp_cxx_call_argument_list (pp, TREE_VALUE (t));
if (is_pack)
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
if (TREE_CHAIN (t))
pp_cxx_separate_with (pp, ',');
}
@@ -1647,7 +1649,7 @@ pp_cxx_type_id (cxx_pretty_printer *pp, tree t)
case TYPE_PACK_EXPANSION:
pp_cxx_type_id (pp, PACK_EXPANSION_PATTERN (t));
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
break;
default:
@@ -1730,15 +1732,15 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break;
case USING_STMT:
- pp_cxx_identifier (pp, "using");
- pp_cxx_identifier (pp, "namespace");
+ pp_cxx_ws_string (pp, "using");
+ pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_qualified_id (pp, USING_STMT_NAMESPACE (t));
break;
case USING_DECL:
- pp_cxx_identifier (pp, "using");
+ pp_cxx_ws_string (pp, "using");
pp_cxx_nested_name_specifier (pp, USING_DECL_SCOPE (t));
pp_cxx_unqualified_id (pp, DECL_NAME (t));
break;
@@ -1750,7 +1752,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
try compound-statement handler-seq */
case TRY_BLOCK:
pp_maybe_newline_and_indent (pp, 0);
- pp_cxx_identifier (pp, "try");
+ pp_cxx_ws_string (pp, "try");
pp_newline_and_indent (pp, 3);
pp_cxx_statement (pp, TRY_STMTS (t));
pp_newline_and_indent (pp, -3);
@@ -1772,7 +1774,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
type-specifier-seq abstract-declarator
... */
case HANDLER:
- pp_cxx_identifier (pp, "catch");
+ pp_cxx_ws_string (pp, "catch");
pp_cxx_left_paren (pp);
pp_cxx_exception_declaration (pp, HANDLER_PARMS (t));
pp_cxx_right_paren (pp);
@@ -1787,7 +1789,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
if ( expression ) statement
if ( expression ) statement else statement */
case IF_STMT:
- pp_cxx_identifier (pp, "if");
+ pp_cxx_ws_string (pp, "if");
pp_cxx_whitespace (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, IF_COND (t));
@@ -1798,7 +1800,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
if (ELSE_CLAUSE (t))
{
tree else_clause = ELSE_CLAUSE (t);
- pp_cxx_identifier (pp, "else");
+ pp_cxx_ws_string (pp, "else");
if (TREE_CODE (else_clause) == IF_STMT)
pp_cxx_whitespace (pp);
else
@@ -1810,7 +1812,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break;
case SWITCH_STMT:
- pp_cxx_identifier (pp, "switch");
+ pp_cxx_ws_string (pp, "switch");
pp_space (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, SWITCH_STMT_COND (t));
@@ -1827,7 +1829,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
for ( expression(opt) ; expression(opt) ; expression(opt) ) statement
for ( declaration expression(opt) ; expression(opt) ) statement */
case WHILE_STMT:
- pp_cxx_identifier (pp, "while");
+ pp_cxx_ws_string (pp, "while");
pp_space (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, WHILE_COND (t));
@@ -1839,11 +1841,11 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break;
case DO_STMT:
- pp_cxx_identifier (pp, "do");
+ pp_cxx_ws_string (pp, "do");
pp_newline_and_indent (pp, 3);
pp_cxx_statement (pp, DO_BODY (t));
pp_newline_and_indent (pp, -3);
- pp_cxx_identifier (pp, "while");
+ pp_cxx_ws_string (pp, "while");
pp_space (pp);
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, DO_COND (t));
@@ -1853,7 +1855,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break;
case FOR_STMT:
- pp_cxx_identifier (pp, "for");
+ pp_cxx_ws_string (pp, "for");
pp_space (pp);
pp_cxx_left_paren (pp);
if (FOR_INIT_STMT (t))
@@ -1882,7 +1884,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
return expression(opt) ; */
case BREAK_STMT:
case CONTINUE_STMT:
- pp_identifier (pp, TREE_CODE (t) == BREAK_STMT ? "break" : "continue");
+ pp_string (pp, TREE_CODE (t) == BREAK_STMT ? "break" : "continue");
pp_cxx_semicolon (pp);
pp_needs_newline (pp) = true;
break;
@@ -1896,11 +1898,11 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
break;
case CLEANUP_STMT:
- pp_cxx_identifier (pp, "try");
+ pp_cxx_ws_string (pp, "try");
pp_newline_and_indent (pp, 2);
pp_cxx_statement (pp, CLEANUP_BODY (t));
pp_newline_and_indent (pp, -2);
- pp_cxx_identifier (pp, CLEANUP_EH_ONLY (t) ? "catch" : "finally");
+ pp_cxx_ws_string (pp, CLEANUP_EH_ONLY (t) ? "catch" : "finally");
pp_newline_and_indent (pp, 2);
pp_cxx_statement (pp, CLEANUP_EXPR (t));
pp_newline_and_indent (pp, -2);
@@ -1924,7 +1926,7 @@ pp_cxx_statement (cxx_pretty_printer *pp, tree t)
static void
pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
{
- pp_cxx_identifier (pp, "namespace");
+ pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
if (DECL_NAME (t))
@@ -1948,7 +1950,7 @@ pp_cxx_original_namespace_definition (cxx_pretty_printer *pp, tree t)
static void
pp_cxx_namespace_alias_definition (cxx_pretty_printer *pp, tree t)
{
- pp_cxx_identifier (pp, "namespace");
+ pp_cxx_ws_string (pp, "namespace");
if (DECL_CONTEXT (t))
pp_cxx_nested_name_specifier (pp, DECL_CONTEXT (t));
pp_cxx_unqualified_id (pp, t);
@@ -2011,9 +2013,9 @@ pp_cxx_template_parameter (cxx_pretty_printer *pp, tree t)
switch (TREE_CODE (parameter))
{
case TYPE_DECL:
- pp_cxx_identifier (pp, "class");
+ pp_cxx_ws_string (pp, "class");
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
- pp_cxx_identifier (pp, "...");
+ pp_cxx_ws_string (pp, "...");
if (DECL_NAME (parameter))
pp_cxx_tree_identifier (pp, DECL_NAME (parameter));
/* FIXME: Check if we should print also default argument. */
@@ -2046,7 +2048,7 @@ pp_cxx_canonical_template_parameter (cxx_pretty_printer *pp, tree parm)
parm = TEMPLATE_TYPE_PARM_INDEX (parm);
pp_cxx_begin_template_argument_list (pp);
- pp_cxx_identifier (pp, "template-parameter-");
+ pp_cxx_ws_string (pp, _("template-parameter-"));
pp_wide_integer (pp, TEMPLATE_PARM_LEVEL (parm));
pp_minus (pp);
pp_wide_integer (pp, TEMPLATE_PARM_IDX (parm) + 1);
@@ -2067,7 +2069,7 @@ pp_cxx_template_declaration (cxx_pretty_printer *pp, tree t)
pp_maybe_newline_and_indent (pp, 0);
for (level = DECL_TEMPLATE_PARMS (tmpl); level; level = TREE_CHAIN (level))
{
- pp_cxx_identifier (pp, "template");
+ pp_cxx_ws_string (pp, "template");
pp_cxx_begin_template_argument_list (pp);
pp_cxx_template_parameter_list (pp, TREE_VALUE (level));
pp_cxx_end_template_argument_list (pp);
@@ -2114,7 +2116,7 @@ pp_cxx_declaration (cxx_pretty_printer *pp, tree t)
{
if (TREE_CODE (t) == STATIC_ASSERT)
{
- pp_cxx_identifier (pp, "static_assert");
+ pp_cxx_ws_string (pp, "static_assert");
pp_cxx_left_paren (pp);
pp_cxx_expression (pp, STATIC_ASSERT_CONDITION (t));
pp_cxx_separate_with (pp, ',');
@@ -2172,7 +2174,7 @@ static void
pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
{
t = TREE_OPERAND (t, 0);
- pp_cxx_identifier (pp, "typeid");
+ pp_cxx_ws_string (pp, "typeid");
pp_cxx_left_paren (pp);
if (TYPE_P (t))
pp_cxx_type_id (pp, t);
@@ -2184,7 +2186,7 @@ pp_cxx_typeid_expression (cxx_pretty_printer *pp, tree t)
void
pp_cxx_va_arg_expression (cxx_pretty_printer *pp, tree t)
{
- pp_cxx_identifier (pp, "va_arg");
+ pp_cxx_ws_string (pp, "va_arg");
pp_cxx_left_paren (pp);
pp_cxx_assignment_expression (pp, TREE_OPERAND (t, 0));
pp_cxx_separate_with (pp, ',');
@@ -2228,7 +2230,7 @@ pp_cxx_offsetof_expression_1 (cxx_pretty_printer *pp, tree t)
void
pp_cxx_offsetof_expression (cxx_pretty_printer *pp, tree t)
{
- pp_cxx_identifier (pp, "offsetof");
+ pp_cxx_ws_string (pp, "offsetof");
pp_cxx_left_paren (pp);
if (!pp_cxx_offsetof_expression_1 (pp, TREE_OPERAND (t, 0)))
pp_cxx_expression (pp, TREE_OPERAND (t, 0));
@@ -2243,55 +2245,55 @@ pp_cxx_trait_expression (cxx_pretty_printer *pp, tree t)
switch (kind)
{
case CPTK_HAS_NOTHROW_ASSIGN:
- pp_cxx_identifier (pp, "__has_nothrow_assign");
+ pp_cxx_ws_string (pp, "__has_nothrow_assign");
break;
case CPTK_HAS_TRIVIAL_ASSIGN:
- pp_cxx_identifier (pp, "__has_trivial_assign");
+ pp_cxx_ws_string (pp, "__has_trivial_assign");
break;
case CPTK_HAS_NOTHROW_CONSTRUCTOR:
- pp_cxx_identifier (pp, "__has_nothrow_constructor");
+ pp_cxx_ws_string (pp, "__has_nothrow_constructor");
break;
case CPTK_HAS_TRIVIAL_CONSTRUCTOR:
- pp_cxx_identifier (pp, "__has_trivial_constructor");
+ pp_cxx_ws_string (pp, "__has_trivial_constructor");
break;
case CPTK_HAS_NOTHROW_COPY:
- pp_cxx_identifier (pp, "__has_nothrow_copy");
+ pp_cxx_ws_string (pp, "__has_nothrow_copy");
break;
case CPTK_HAS_TRIVIAL_COPY:
- pp_cxx_identifier (pp, "__has_trivial_copy");
+ pp_cxx_ws_string (pp, "__has_trivial_copy");
break;
case CPTK_HAS_TRIVIAL_DESTRUCTOR:
- pp_cxx_identifier (pp, "__has_trivial_destructor");
+ pp_cxx_ws_string (pp, "__has_trivial_destructor");
break;
case CPTK_HAS_VIRTUAL_DESTRUCTOR:
- pp_cxx_identifier (pp, "__has_virtual_destructor");
+ pp_cxx_ws_string (pp, "__has_virtual_destructor");
break;
case CPTK_IS_ABSTRACT:
- pp_cxx_identifier (pp, "__is_abstract");
+ pp_cxx_ws_string (pp, "__is_abstract");
break;
case CPTK_IS_BASE_OF:
- pp_cxx_identifier (pp, "__is_base_of");
+ pp_cxx_ws_string (pp, "__is_base_of");
break;
case CPTK_IS_CLASS:
- pp_cxx_identifier (pp, "__is_class");
+ pp_cxx_ws_string (pp, "__is_class");
break;
case CPTK_IS_CONVERTIBLE_TO:
- pp_cxx_identifier (pp, "__is_convertible_to");
+ pp_cxx_ws_string (pp, "__is_convertible_to");
break;
case CPTK_IS_EMPTY:
- pp_cxx_identifier (pp, "__is_empty");
+ pp_cxx_ws_string (pp, "__is_empty");
break;
case CPTK_IS_ENUM:
- pp_cxx_identifier (pp, "__is_enum");
+ pp_cxx_ws_string (pp, "__is_enum");
break;
case CPTK_IS_POD:
- pp_cxx_identifier (pp, "__is_pod");
+ pp_cxx_ws_string (pp, "__is_pod");
break;
case CPTK_IS_POLYMORPHIC:
- pp_cxx_identifier (pp, "__is_polymorphic");
+ pp_cxx_ws_string (pp, "__is_polymorphic");
break;
case CPTK_IS_UNION:
- pp_cxx_identifier (pp, "__is_union");
+ pp_cxx_ws_string (pp, "__is_union");
break;
default:
diff --git a/gcc/cp/cxx-pretty-print.h b/gcc/cp/cxx-pretty-print.h
index e7c4220614f..a88d4c5ccdb 100644
--- a/gcc/cp/cxx-pretty-print.h
+++ b/gcc/cp/cxx-pretty-print.h
@@ -1,5 +1,5 @@
/* Interface for the GNU C++ pretty-printer.
- Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
This file is part of GCC.
@@ -57,6 +57,7 @@ typedef struct
#define pp_cxx_semicolon(PP) pp_c_semicolon (pp_c_base (PP))
#define pp_cxx_complement(PP) pp_c_complement (pp_c_base (PP))
+#define pp_cxx_ws_string(PP, I) pp_c_ws_string (pp_c_base (PP), I)
#define pp_cxx_identifier(PP, I) pp_c_identifier (pp_c_base (PP), I)
#define pp_cxx_tree_identifier(PP, T) \
pp_c_tree_identifier (pp_c_base (PP), T)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 2f065e0eebe..86ace9498e5 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2015,7 +2015,6 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
else 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);
@@ -7854,7 +7853,7 @@ grokdeclarator (const cp_declarator *declarator,
suppress reports of deprecated items. */
if (type && TREE_DEPRECATED (type)
&& deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (type);
+ warn_deprecated_use (type, NULL_TREE);
if (type && TREE_CODE (type) == TYPE_DECL)
{
typedef_decl = type;
@@ -7862,7 +7861,7 @@ grokdeclarator (const cp_declarator *declarator,
if (TREE_DEPRECATED (type)
&& DECL_ARTIFICIAL (typedef_decl)
&& deprecated_state != DEPRECATED_SUPPRESS)
- warn_deprecated_use (type);
+ warn_deprecated_use (type, NULL_TREE);
}
/* No type at all: default to `int', and set DEFAULTED_INT
because it was not a user-defined typedef. */
@@ -9716,7 +9715,7 @@ grokparms (tree parmlist, tree *parms)
{
tree deptype = type_is_deprecated (type);
if (deptype)
- warn_deprecated_use (deptype);
+ warn_deprecated_use (deptype, NULL_TREE);
}
/* Top-level qualifiers on the parameters are
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 12d23f83206..831807eaedf 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2758,6 +2758,7 @@ start_static_storage_duration_function (unsigned count)
TREE_CHAIN (initialize_p_decl) = priority_decl;
DECL_ARGUMENTS (ssdf_decl) = initialize_p_decl;
+ /* Put the function in the global scope. */
pushdecl (ssdf_decl);
/* Start the function itself. This is equivalent to declaring the
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 4e7e9ec30c7..13b32ad1850 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "diagnostic.h"
#include "langhooks-def.h"
+#include "intl.h"
#include "cxx-pretty-print.h"
#include "pointer-set.h"
@@ -231,9 +232,9 @@ dump_template_parameter (tree parm, int flags)
{
if (flags & TFF_DECL_SPECIFIERS)
{
- pp_cxx_identifier (cxx_pp, "class");
+ pp_cxx_ws_string (cxx_pp, "class");
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (p)))
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
if (DECL_NAME (p))
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (p));
}
@@ -297,7 +298,7 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames)
if (arg)
dump_template_argument (arg, TFF_PLAIN_IDENTIFIER);
else
- pp_identifier (cxx_pp, "<missing>");
+ pp_string (cxx_pp, _("<missing>"));
++arg_idx;
need_comma = 1;
@@ -338,9 +339,9 @@ dump_type (tree t, int flags)
{
case UNKNOWN_TYPE:
if (t == init_list_type_node)
- pp_identifier (cxx_pp, "<brace-enclosed initializer list>");
+ pp_string (cxx_pp, _("<brace-enclosed initializer list>"));
else
- pp_identifier (cxx_pp, "<unresolved overloaded function type>");
+ pp_string (cxx_pp, _("<unresolved overloaded function type>"));
break;
case TREE_LIST:
@@ -436,7 +437,7 @@ dump_type (tree t, int flags)
break;
}
pp_cxx_cv_qualifier_seq (cxx_pp, t);
- pp_cxx_identifier (cxx_pp,
+ pp_cxx_ws_string (cxx_pp,
TYPENAME_IS_ENUM_P (t) ? "enum"
: TYPENAME_IS_CLASS_P (t) ? "class"
: "typename");
@@ -446,12 +447,12 @@ dump_type (tree t, int flags)
case UNBOUND_CLASS_TEMPLATE:
dump_type (TYPE_CONTEXT (t), flags);
pp_cxx_colon_colon (cxx_pp);
- pp_cxx_identifier (cxx_pp, "template");
+ pp_cxx_ws_string (cxx_pp, "template");
dump_type (DECL_NAME (TYPE_NAME (t)), flags);
break;
case TYPEOF_TYPE:
- pp_cxx_identifier (cxx_pp, "__typeof__");
+ pp_cxx_ws_string (cxx_pp, "__typeof__");
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
dump_expr (TYPEOF_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
@@ -460,7 +461,7 @@ dump_type (tree t, int flags)
case TYPE_PACK_EXPANSION:
dump_type (PACK_EXPANSION_PATTERN (t), flags);
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
break;
case TYPE_ARGUMENT_PACK:
@@ -468,7 +469,7 @@ dump_type (tree t, int flags)
break;
case DECLTYPE_TYPE:
- pp_cxx_identifier (cxx_pp, "decltype");
+ pp_cxx_ws_string (cxx_pp, "decltype");
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
dump_expr (DECLTYPE_TYPE_EXPR (t), flags & ~TFF_EXPR_IN_PARENS);
@@ -480,7 +481,7 @@ dump_type (tree t, int flags)
/* Fall through to error. */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<type error>");
+ pp_string (cxx_pp, _("<type error>"));
break;
}
}
@@ -535,7 +536,7 @@ dump_aggr_type (tree t, int flags)
pp_cxx_cv_qualifier_seq (cxx_pp, t);
if (flags & TFF_CLASS_KEY_OR_ENUM)
- pp_cxx_identifier (cxx_pp, variety);
+ pp_cxx_ws_string (cxx_pp, variety);
name = TYPE_NAME (t);
@@ -577,9 +578,9 @@ dump_aggr_type (tree t, int flags)
if (name == 0 || ANON_AGGRNAME_P (name))
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
- pp_identifier (cxx_pp, "<anonymous>");
+ pp_string (cxx_pp, _("<anonymous>"));
else
- pp_printf (pp_base (cxx_pp), "<anonymous %s>", variety);
+ pp_printf (pp_base (cxx_pp), _("<anonymous %s>"), variety);
}
else
pp_cxx_tree_identifier (cxx_pp, name);
@@ -701,7 +702,7 @@ dump_type_prefix (tree t, int flags)
pp_unsupported_tree (cxx_pp, t);
/* fall through. */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<typeprefixerror>");
+ pp_string (cxx_pp, _("<typeprefixerror>"));
break;
}
}
@@ -811,13 +812,13 @@ dump_global_iord (tree t)
const char *p = NULL;
if (DECL_GLOBAL_CTOR_P (t))
- p = "initializers";
+ p = _("(static initializers for %s)");
else if (DECL_GLOBAL_DTOR_P (t))
- p = "destructors";
+ p = _("(static destructors for %s)");
else
gcc_unreachable ();
- pp_printf (pp_base (cxx_pp), "(static %s for %s)", p, input_filename);
+ pp_printf (pp_base (cxx_pp), p, input_filename);
}
static void
@@ -836,11 +837,11 @@ dump_simple_decl (tree t, tree type, int flags)
if ((flags & TFF_DECL_SPECIFIERS)
&& DECL_TEMPLATE_PARM_P (t)
&& TEMPLATE_PARM_PARAMETER_PACK (DECL_INITIAL (t)))
- pp_identifier (cxx_pp, "...");
+ pp_string (cxx_pp, "...");
if (DECL_NAME (t))
dump_decl (DECL_NAME (t), flags);
else
- pp_identifier (cxx_pp, "<anonymous>");
+ pp_string (cxx_pp, _("<anonymous>"));
if (flags & TFF_DECL_SPECIFIERS)
dump_type_suffix (type, flags);
}
@@ -863,18 +864,18 @@ dump_decl (tree t, int flags)
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
{
/* Say `class T' not just `T'. */
- pp_cxx_identifier (cxx_pp, "class");
+ pp_cxx_ws_string (cxx_pp, "class");
/* Emit the `...' for a parameter pack. */
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
}
dump_type (TREE_TYPE (t), flags);
break;
}
if (flags & TFF_DECL_SPECIFIERS)
- pp_cxx_identifier (cxx_pp, "typedef");
+ pp_cxx_ws_string (cxx_pp, "typedef");
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
? DECL_ORIGINAL_TYPE (t) : TREE_TYPE (t),
flags);
@@ -883,7 +884,7 @@ dump_decl (tree t, int flags)
case VAR_DECL:
if (DECL_NAME (t) && VTABLE_NAME_P (DECL_NAME (t)))
{
- pp_string (cxx_pp, "vtable for ");
+ pp_string (cxx_pp, _("vtable for "));
gcc_assert (TYPE_P (DECL_CONTEXT (t)));
dump_type (DECL_CONTEXT (t), flags);
break;
@@ -895,7 +896,7 @@ dump_decl (tree t, int flags)
break;
case RESULT_DECL:
- pp_string (cxx_pp, "<return value> ");
+ pp_string (cxx_pp, _("<return value> "));
dump_simple_decl (t, TREE_TYPE (t), flags);
break;
@@ -908,7 +909,7 @@ dump_decl (tree t, int flags)
dump_scope (CP_DECL_CONTEXT (t), flags);
flags &= ~TFF_UNQUALIFIED_NAME;
if (DECL_NAME (t) == NULL_TREE)
- pp_identifier (cxx_pp, "<unnamed>");
+ pp_string (cxx_pp, _("<unnamed>"));
else
pp_cxx_tree_identifier (cxx_pp, DECL_NAME (t));
}
@@ -948,7 +949,7 @@ dump_decl (tree t, int flags)
case IDENTIFIER_NODE:
if (IDENTIFIER_TYPENAME_P (t))
{
- pp_cxx_identifier (cxx_pp, "operator");
+ pp_cxx_ws_string (cxx_pp, "operator");
/* Not exactly IDENTIFIER_TYPE_VALUE. */
dump_type (TREE_TYPE (t), flags);
break;
@@ -982,7 +983,7 @@ dump_decl (tree t, int flags)
case FUNCTION_DECL:
if (! DECL_LANG_SPECIFIC (t))
- pp_identifier (cxx_pp, "<built-in>");
+ pp_string (cxx_pp, _("<built-in>"));
else if (DECL_GLOBAL_CTOR_P (t) || DECL_GLOBAL_DTOR_P (t))
dump_global_iord (t);
else
@@ -1021,11 +1022,11 @@ dump_decl (tree t, int flags)
else if (DECL_INITIAL (t))
dump_expr (DECL_INITIAL (t), flags | TFF_EXPR_IN_PARENS);
else
- pp_identifier (cxx_pp, "<enumerator>");
+ pp_string (cxx_pp, _("<enumerator>"));
break;
case USING_DECL:
- pp_cxx_identifier (cxx_pp, "using");
+ pp_cxx_ws_string (cxx_pp, "using");
dump_type (USING_DECL_SCOPE (t), flags);
pp_cxx_colon_colon (cxx_pp);
dump_decl (DECL_NAME (t), flags);
@@ -1061,7 +1062,7 @@ dump_decl (tree t, int flags)
/* Fall through to error. */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<declaration error>");
+ pp_string (cxx_pp, _("<declaration error>"));
break;
}
}
@@ -1085,7 +1086,7 @@ dump_template_decl (tree t, int flags)
tree inner_parms = INNERMOST_TEMPLATE_PARMS (parms);
int len = TREE_VEC_LENGTH (inner_parms);
- pp_cxx_identifier (cxx_pp, "template");
+ pp_cxx_ws_string (cxx_pp, "template");
pp_cxx_begin_template_argument_list (cxx_pp);
/* If we've shown the template prefix, we'd better show the
@@ -1106,11 +1107,11 @@ dump_template_decl (tree t, int flags)
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
{
/* Say `template<arg> class TT' not just `template<arg> TT'. */
- pp_cxx_identifier (cxx_pp, "class");
+ pp_cxx_ws_string (cxx_pp, "class");
/* If this is a parameter pack, print the ellipsis. */
if (TEMPLATE_TYPE_PARAMETER_PACK (TREE_TYPE (t)))
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
}
}
@@ -1241,9 +1242,9 @@ dump_function_decl (tree t, int flags)
if (!(flags & TFF_DECL_SPECIFIERS))
/* OK */;
else if (DECL_STATIC_FUNCTION_P (t))
- pp_cxx_identifier (cxx_pp, "static");
+ pp_cxx_ws_string (cxx_pp, "static");
else if (DECL_VIRTUAL_P (t))
- pp_cxx_identifier (cxx_pp, "virtual");
+ pp_cxx_ws_string (cxx_pp, "virtual");
/* Print the return type? */
if (show_return)
@@ -1291,7 +1292,7 @@ dump_function_decl (tree t, int flags)
{
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_bracket (cxx_pp);
- pp_cxx_identifier (cxx_pp, "with");
+ pp_cxx_ws_string (cxx_pp, _("with"));
pp_cxx_whitespace (cxx_pp);
dump_template_bindings (template_parms, template_args, typenames);
pp_cxx_right_bracket (cxx_pp);
@@ -1316,7 +1317,7 @@ dump_parameters (tree parmtypes, int flags)
first = 0;
if (!parmtypes)
{
- pp_cxx_identifier (cxx_pp, "...");
+ pp_cxx_ws_string (cxx_pp, "...");
break;
}
@@ -1341,7 +1342,7 @@ dump_exception_spec (tree t, int flags)
{
if (t)
{
- pp_cxx_identifier (cxx_pp, "throw");
+ pp_cxx_ws_string (cxx_pp, "throw");
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
if (TREE_VALUE (t) != NULL_TREE)
@@ -1397,7 +1398,7 @@ dump_function_name (tree t, int flags)
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. */
- pp_cxx_identifier (cxx_pp, "operator");
+ pp_cxx_ws_string (cxx_pp, "operator");
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
else if (IDENTIFIER_OPNAME_P (name))
@@ -1456,7 +1457,7 @@ dump_template_parms (tree info, int primary, int flags)
pp_separate_with_comma (cxx_pp);
if (!arg)
- pp_identifier (cxx_pp, "<template parameter error>");
+ pp_string (cxx_pp, _("<template parameter error>"));
else
dump_template_argument (arg, flags);
}
@@ -1476,7 +1477,7 @@ dump_template_parms (tree info, int primary, int flags)
if (TREE_VEC_ELT (parms, ix) == error_mark_node)
{
- pp_identifier (cxx_pp, "<template parameter error>");
+ pp_string (cxx_pp, _("<template parameter error>"));
continue;
}
@@ -1602,7 +1603,7 @@ dump_expr (tree t, int flags)
if (STATEMENT_CLASS_P (t))
{
- pp_cxx_identifier (cxx_pp, "<statement>");
+ pp_cxx_ws_string (cxx_pp, _("<statement>"));
return;
}
@@ -1631,7 +1632,7 @@ dump_expr (tree t, int flags)
case THROW_EXPR:
/* While waiting for caret diagnostics, avoid printing
__cxa_allocate_exception, __cxa_throw, and the like. */
- pp_cxx_identifier (cxx_pp, "<throw-expression>");
+ pp_cxx_ws_string (cxx_pp, _("<throw-expression>"));
break;
case PTRMEM_CST:
@@ -1662,7 +1663,7 @@ dump_expr (tree t, int flags)
case SAVE_EXPR:
if (TREE_HAS_CONSTRUCTOR (t))
{
- pp_cxx_identifier (cxx_pp, "new");
+ pp_cxx_ws_string (cxx_pp, "new");
pp_cxx_whitespace (cxx_pp);
dump_type (TREE_TYPE (TREE_TYPE (t)), flags);
}
@@ -1856,7 +1857,7 @@ dump_expr (tree t, int flags)
case POSTINCREMENT_EXPR:
pp_cxx_left_paren (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
- pp_cxx_identifier (cxx_pp, operator_name_info[(int)TREE_CODE (t)].name);
+ pp_cxx_ws_string (cxx_pp, operator_name_info[(int)TREE_CODE (t)].name);
pp_cxx_right_paren (cxx_pp);
break;
@@ -2027,16 +2028,16 @@ dump_expr (tree t, int flags)
break;
case STATIC_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "static_cast");
+ pp_cxx_ws_string (cxx_pp, "static_cast");
goto cast;
case REINTERPRET_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "reinterpret_cast");
+ pp_cxx_ws_string (cxx_pp, "reinterpret_cast");
goto cast;
case CONST_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "const_cast");
+ pp_cxx_ws_string (cxx_pp, "const_cast");
goto cast;
case DYNAMIC_CAST_EXPR:
- pp_cxx_identifier (cxx_pp, "dynamic_cast");
+ pp_cxx_ws_string (cxx_pp, "dynamic_cast");
cast:
pp_cxx_begin_template_argument_list (cxx_pp);
dump_type (TREE_TYPE (t), flags);
@@ -2054,11 +2055,11 @@ dump_expr (tree t, int flags)
case SIZEOF_EXPR:
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
- pp_cxx_identifier (cxx_pp, "sizeof");
+ pp_cxx_ws_string (cxx_pp, "sizeof");
else
{
gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
- pp_cxx_identifier (cxx_pp, "__alignof__");
+ pp_cxx_ws_string (cxx_pp, "__alignof__");
}
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
@@ -2071,13 +2072,13 @@ dump_expr (tree t, int flags)
case REALPART_EXPR:
case IMAGPART_EXPR:
- pp_cxx_identifier (cxx_pp, operator_name_info[TREE_CODE (t)].name);
+ pp_cxx_ws_string (cxx_pp, operator_name_info[TREE_CODE (t)].name);
pp_cxx_whitespace (cxx_pp);
dump_expr (TREE_OPERAND (t, 0), flags);
break;
case DEFAULT_ARG:
- pp_identifier (cxx_pp, "<unparsed>");
+ pp_string (cxx_pp, _("<unparsed>"));
break;
case TRY_CATCH_EXPR:
@@ -2223,7 +2224,7 @@ dump_expr (tree t, int flags)
pp_unsupported_tree (cxx_pp, t);
/* fall through to ERROR_MARK... */
case ERROR_MARK:
- pp_identifier (cxx_pp, "<expression error>");
+ pp_string (cxx_pp, _("<expression error>"));
break;
}
}
@@ -2235,9 +2236,9 @@ dump_binary_op (const char *opstring, tree t, int flags)
dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS);
pp_cxx_whitespace (cxx_pp);
if (opstring)
- pp_cxx_identifier (cxx_pp, opstring);
+ pp_cxx_ws_string (cxx_pp, opstring);
else
- pp_identifier (cxx_pp, "<unknown operator>");
+ pp_string (cxx_pp, _("<unknown operator>"));
pp_cxx_whitespace (cxx_pp);
dump_expr (TREE_OPERAND (t, 1), flags | TFF_EXPR_IN_PARENS);
pp_cxx_right_paren (cxx_pp);
@@ -2248,7 +2249,7 @@ dump_unary_op (const char *opstring, tree t, int flags)
{
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_left_paren (cxx_pp);
- pp_cxx_identifier (cxx_pp, opstring);
+ pp_cxx_ws_string (cxx_pp, opstring);
dump_expr (TREE_OPERAND (t, 0), flags & ~TFF_EXPR_IN_PARENS);
if (flags & TFF_EXPR_IN_PARENS)
pp_cxx_right_paren (cxx_pp);
@@ -2419,7 +2420,7 @@ static const char *
op_to_string (enum tree_code p)
{
tree id = operator_name_info[(int) p].identifier;
- return id ? IDENTIFIER_POINTER (id) : "<unknown>";
+ return id ? IDENTIFIER_POINTER (id) : _("<unknown>");
}
static const char *
@@ -2439,7 +2440,7 @@ static const char *
assop_to_string (enum tree_code p)
{
tree id = assignment_operator_name_info[(int) p].identifier;
- return id ? IDENTIFIER_POINTER (id) : "{unknown}";
+ return id ? IDENTIFIER_POINTER (id) : _("{unknown}");
}
static const char *
@@ -2459,7 +2460,7 @@ args_to_string (tree p, int verbose)
for (; p; p = TREE_CHAIN (p))
{
if (TREE_VALUE (p) == null_node)
- pp_cxx_identifier (cxx_pp, "NULL");
+ pp_cxx_ws_string (cxx_pp, "NULL");
else
dump_type (error_type (TREE_VALUE (p)), flags);
if (TREE_CHAIN (p))
@@ -2521,7 +2522,7 @@ cp_print_error_function (diagnostic_context *context,
pp_base_set_prefix (context->printer, new_prefix);
if (current_function_decl == NULL)
- pp_base_string (context->printer, "At global scope:");
+ pp_base_string (context->printer, _("At global scope:"));
else
{
tree fndecl, ao;
@@ -2539,8 +2540,7 @@ cp_print_error_function (diagnostic_context *context,
else
fndecl = current_function_decl;
- pp_printf (context->printer, "In %s %qs",
- function_category (fndecl),
+ pp_printf (context->printer, function_category (fndecl),
cxx_printable_name (fndecl, 2));
while (abstract_origin)
@@ -2591,18 +2591,18 @@ cp_print_error_function (diagnostic_context *context,
{
if (flag_show_column && s.column != 0)
pp_printf (context->printer,
- " inlined from %qs at %s:%d:%d",
+ _(" inlined from %qs at %s:%d:%d"),
cxx_printable_name (fndecl, 2),
s.file, s.line, s.column);
else
pp_printf (context->printer,
- " inlined from %qs at %s:%d",
+ _(" inlined from %qs at %s:%d"),
cxx_printable_name (fndecl, 2),
s.file, s.line);
}
else
- pp_printf (context->printer, " inlined from %qs",
+ pp_printf (context->printer, _(" inlined from %qs"),
cxx_printable_name (fndecl, 2));
}
}
@@ -2616,25 +2616,26 @@ cp_print_error_function (diagnostic_context *context,
}
}
-/* Returns a description of FUNCTION using standard terminology. */
+/* Returns a description of FUNCTION using standard terminology. The
+ result is a format string of the form "In CATEGORY %qs". */
static const char *
function_category (tree fn)
{
if (DECL_FUNCTION_MEMBER_P (fn))
{
if (DECL_STATIC_FUNCTION_P (fn))
- return "static member function";
+ return _("In static member function %qs");
else if (DECL_COPY_CONSTRUCTOR_P (fn))
- return "copy constructor";
+ return _("In copy constructor %qs");
else if (DECL_CONSTRUCTOR_P (fn))
- return "constructor";
+ return _("In constructor %qs");
else if (DECL_DESTRUCTOR_P (fn))
- return "destructor";
+ return _("In destructor %qs");
else
- return "member function";
+ return _("In member function %qs");
}
else
- return "function";
+ return _("In function %qs");
}
/* Report the full context of a current template instantiation,
@@ -2659,7 +2660,7 @@ print_instantiation_full_context (diagnostic_context *context)
/* Avoid redundancy with the "In function" line. */;
else
pp_verbatim (context->printer,
- "%s: In instantiation of %qs:\n",
+ _("%s: In instantiation of %qs:\n"),
LOCATION_FILE (location),
decl_as_string (p->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
@@ -2683,13 +2684,13 @@ print_instantiation_partial_context (diagnostic_context *context,
xloc = expand_location (loc);
if (t == NULL)
break;
- pp_verbatim (context->printer, "%s:%d: instantiated from %qs\n",
+ pp_verbatim (context->printer, _("%s:%d: instantiated from %qs\n"),
xloc.file, xloc.line,
decl_as_string (t->decl,
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
loc = t->locus;
}
- pp_verbatim (context->printer, "%s:%d: instantiated from here",
+ pp_verbatim (context->printer, _("%s:%d: instantiated from here"),
xloc.file, xloc.line);
pp_base_newline (context->printer);
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 697d43949fa..ce52e8e73e2 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -416,7 +416,6 @@ pop_binding (tree id, tree decl)
}
}
-
/* BINDING records an existing declaration for a name in the current scope.
But, DECL is another declaration for that same identifier in the
same scope. This is the `struct stat' hack whereby a non-typedef
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 224981bd1e3..2722699ca7f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -418,11 +418,6 @@ cp_lexer_get_preprocessor_token (cp_lexer *lexer, cp_token *token)
token->type = CPP_KEYWORD;
/* Record which keyword. */
token->keyword = C_RID_CODE (token->u.value);
- /* Update the value. Some keywords are mapped to particular
- entities, rather than simply having the value of the
- corresponding IDENTIFIER_NODE. For example, `__const' is
- mapped to `const'. */
- token->u.value = ridpointers[token->keyword];
}
else
{
@@ -16842,7 +16837,12 @@ cp_parser_attribute_list (cp_parser* parser)
/* Save away the identifier that indicates which attribute
this is. */
- identifier = token->u.value;
+ identifier = (token->type == CPP_KEYWORD)
+ /* For keywords, use the canonical spelling, not the
+ parsed identifier. */
+ ? ridpointers[(int) token->keyword]
+ : token->u.value;
+
attribute = build_tree_list (identifier, NULL_TREE);
/* Peek at the next token. */
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 99d317bf678..3b7fb1bc3f4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9184,6 +9184,14 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
max = tsubst_expr (omax, args, complain, in_decl,
/*integral_constant_expression_p=*/false);
+
+ /* Fix up type of the magic NOP_EXPR with TREE_SIDE_EFFECTS if
+ needed. */
+ if (TREE_CODE (max) == NOP_EXPR
+ && TREE_SIDE_EFFECTS (omax)
+ && !TREE_TYPE (max))
+ TREE_TYPE (max) = TREE_TYPE (TREE_OPERAND (max, 0));
+
max = fold_decl_constant_value (max);
/* If we're in a partial instantiation, preserve the magic NOP_EXPR
@@ -10014,11 +10022,15 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (r == NULL)
{
+ tree c;
/* This can happen for a parameter name used later in a function
declaration (such as in a late-specified return type). Just
make a dummy decl, since it's only used for its type. */
gcc_assert (skip_evaluation);
- r = tsubst_decl (t, args, complain);
+ /* We copy T because want to tsubst the PARM_DECL only,
+ not the following PARM_DECLs that are chained to T. */
+ c = copy_node (t);
+ r = tsubst_decl (c, args, complain);
/* Give it the template pattern as its context; its true context
hasn't been instantiated yet and this is good enough for
mangling. */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 2f02ba54157..287892a2fdc 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3042,7 +3042,7 @@ finish_id_expression (tree id_expression,
}
if (TREE_DEPRECATED (decl))
- warn_deprecated_use (decl);
+ warn_deprecated_use (decl, NULL_TREE);
return decl;
}
@@ -3662,7 +3662,7 @@ finish_omp_clauses (tree clauses)
for (pc = &clauses, c = clauses; c ; c = *pc)
{
- enum tree_code c_kind = OMP_CLAUSE_CODE (c);
+ enum omp_clause_code c_kind = OMP_CLAUSE_CODE (c);
bool remove = false;
bool need_complete_non_reference = false;
bool need_default_ctor = false;
@@ -5064,4 +5064,23 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2)
? boolean_true_node : boolean_false_node);
}
+/* Do-nothing variants of functions to handle pragma FLOAT_CONST_DECIMAL64,
+ which is ignored for C++. */
+
+void
+set_float_const_decimal64 (void)
+{
+}
+
+void
+clear_float_const_decimal64 (void)
+{
+}
+
+bool
+float_const_decimal64_p (void)
+{
+ return 0;
+}
+
#include "gt-cp-semantics.h"
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 69d5529476d..4486b9065a1 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -1909,7 +1909,7 @@ build_class_member_access_expr (tree object, tree member,
member_scope = DECL_CLASS_CONTEXT (member);
mark_used (member);
if (TREE_DEPRECATED (member))
- warn_deprecated_use (member);
+ warn_deprecated_use (member, NULL_TREE);
}
else
member_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (member));
@@ -2369,7 +2369,7 @@ finish_class_member_access_expr (tree object, tree name, bool template_p,
}
if (TREE_DEPRECATED (member))
- warn_deprecated_use (member);
+ warn_deprecated_use (member, NULL_TREE);
if (template_p)
check_template_keyword (member);
@@ -4054,7 +4054,7 @@ cp_pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
pointer_int_sum() anyway. */
complete_type (TREE_TYPE (res_type));
- return pointer_int_sum (input_location, resultcode, ptrop,
+ return pointer_int_sum (resultcode, ptrop,
fold_if_not_in_template (intop));
}
@@ -5034,6 +5034,12 @@ cp_build_compound_expr (tree lhs, tree rhs, tsubst_flags_t complain)
return rhs;
}
+ if (type_unknown_p (rhs))
+ {
+ error ("no context to resolve type of %qE", rhs);
+ return error_mark_node;
+ }
+
return build2 (COMPOUND_EXPR, TREE_TYPE (rhs), lhs, rhs);
}
diff --git a/gcc/cse.c b/gcc/cse.c
index 3f36a1c8371..2b814937535 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6997,3 +6997,65 @@ struct rtl_opt_pass pass_cse2 =
TODO_verify_flow /* todo_flags_finish */
}
};
+
+static bool
+gate_handle_cse_after_global_opts (void)
+{
+ return optimize > 0 && flag_rerun_cse_after_global_opts;
+}
+
+/* Run second CSE pass after loop optimizations. */
+static unsigned int
+rest_of_handle_cse_after_global_opts (void)
+{
+ int save_cfj;
+ int tem;
+
+ /* We only want to do local CSE, so don't follow jumps. */
+ save_cfj = flag_cse_follow_jumps;
+ flag_cse_follow_jumps = 0;
+
+ rebuild_jump_labels (get_insns ());
+ tem = cse_main (get_insns (), max_reg_num ());
+ purge_all_dead_edges ();
+ delete_trivially_dead_insns (get_insns (), max_reg_num ());
+
+ cse_not_expected = !flag_rerun_cse_after_loop;
+
+ /* If cse altered any jumps, rerun jump opts to clean things up. */
+ if (tem == 2)
+ {
+ timevar_push (TV_JUMP);
+ rebuild_jump_labels (get_insns ());
+ cleanup_cfg (0);
+ timevar_pop (TV_JUMP);
+ }
+ else if (tem == 1)
+ cleanup_cfg (0);
+
+ flag_cse_follow_jumps = save_cfj;
+ return 0;
+}
+
+struct rtl_opt_pass pass_cse_after_global_opts =
+{
+ {
+ RTL_PASS,
+ "cse_local", /* name */
+ gate_handle_cse_after_global_opts, /* gate */
+ rest_of_handle_cse_after_global_opts, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_CSE, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_df_finish | TODO_verify_rtl_sharing |
+ TODO_dump_func |
+ TODO_ggc_collect |
+ TODO_verify_flow /* todo_flags_finish */
+ }
+};
+
diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def
index a8dcc5bf744..9a0fa258eb1 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -146,8 +146,8 @@ DEBUG_COUNTER (auto_inc_dec)
DEBUG_COUNTER (ccp)
DEBUG_COUNTER (cfg_cleanup)
DEBUG_COUNTER (cse2_move2add)
-DEBUG_COUNTER (cprop1)
-DEBUG_COUNTER (cprop2)
+DEBUG_COUNTER (clone)
+DEBUG_COUNTER (cprop)
DEBUG_COUNTER (dce)
DEBUG_COUNTER (dce_fast)
DEBUG_COUNTER (dce_ud)
@@ -156,18 +156,18 @@ DEBUG_COUNTER (df_byte_scan)
DEBUG_COUNTER (dse)
DEBUG_COUNTER (dse1)
DEBUG_COUNTER (dse2)
-DEBUG_COUNTER (gcse)
DEBUG_COUNTER (gcse2_delete)
DEBUG_COUNTER (global_alloc_at_func)
DEBUG_COUNTER (global_alloc_at_reg)
+DEBUG_COUNTER (hoist)
DEBUG_COUNTER (ia64_sched2)
DEBUG_COUNTER (if_conversion)
DEBUG_COUNTER (if_after_combine)
DEBUG_COUNTER (if_after_reload)
DEBUG_COUNTER (inl)
-DEBUG_COUNTER (jump_bypass)
DEBUG_COUNTER (local_alloc_for_sched)
DEBUG_COUNTER (postreload_cse)
+DEBUG_COUNTER (pre)
DEBUG_COUNTER (pre_insn)
DEBUG_COUNTER (treepre_insert)
DEBUG_COUNTER (sched2_func)
@@ -179,5 +179,6 @@ DEBUG_COUNTER (sel_sched_cnt)
DEBUG_COUNTER (sel_sched_region_cnt)
DEBUG_COUNTER (sel_sched_insn_cnt)
DEBUG_COUNTER (sms_sched_loop)
+DEBUG_COUNTER (store_motion)
DEBUG_COUNTER (split_for_sched2)
DEBUG_COUNTER (tail_call)
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 077fc1a383e..dd05076bb63 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -1398,9 +1398,7 @@ dbxout_type_index (tree type)
/* Used in several places: evaluates to '0' for a private decl,
'1' for a protected decl, '2' for a public decl. */
#define DECL_ACCESSIBILITY_CHAR(DECL) \
-((TREE_CODE (DECL) != PARM_DECL && TREE_CODE (DECL) != RESULT_DECL \
- && (TREE_CODE (DECL) != VAR_DECL || TREE_STATIC (DECL)) \
- && TREE_PRIVATE (DECL)) ? '0' : TREE_PROTECTED (DECL) ? '1' : '2')
+(TREE_PRIVATE (DECL) ? '0' : TREE_PROTECTED (DECL) ? '1' : '2')
/* Subroutine of `dbxout_type'. Output the type fields of TYPE.
This must be a separate function because anonymous unions require
diff --git a/gcc/dce.c b/gcc/dce.c
index f6a10d6197e..abdd433cb0e 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "regs.h"
#include "hard-reg-set.h"
#include "flags.h"
+#include "except.h"
#include "df.h"
#include "cselib.h"
#include "dce.h"
@@ -35,9 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "tm_p.h"
-DEF_VEC_I(int);
-DEF_VEC_ALLOC_I(int,heap);
-
/* -------------------------------------------------------------------------
Core mark/delete routines
@@ -118,6 +116,10 @@ deletable_insn_p (rtx insn, bool fast, bitmap arg_stores)
if (!NONJUMP_INSN_P (insn))
return false;
+ /* Similarly, we cannot delete other insns that can throw either. */
+ if (df_in_progress && flag_non_call_exceptions && can_throw_internal (insn))
+ return false;
+
body = PATTERN (insn);
switch (GET_CODE (body))
{
@@ -1090,9 +1092,9 @@ run_fast_df_dce (void)
/* If dce is able to delete something, it has to happen
immediately. Otherwise there will be problems handling the
eq_notes. */
- enum df_changeable_flags old_flags
- = df_clear_flags (DF_DEFER_INSN_RESCAN + DF_NO_INSN_RESCAN);
-
+ int old_flags =
+ df_clear_flags (DF_DEFER_INSN_RESCAN + DF_NO_INSN_RESCAN);
+
df_in_progress = true;
rest_of_handle_fast_dce ();
df_in_progress = false;
diff --git a/gcc/debug.h b/gcc/debug.h
index 1169c51a66b..6d4911302d0 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -126,6 +126,8 @@ struct gcc_debug_hooks
text sections. */
void (* switch_text_section) (void);
+ /* Called from grokdeclarator. Replaces the anonymous name with the
+ type name. */
void (* set_name) (tree, tree);
/* This is 1 if the debug writer wants to see start and end commands for the
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 53ba930fff2..8ed40d93b54 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -878,10 +878,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define SHIFT_COUNT_TRUNCATED 0
#endif
-#ifndef LEGITIMIZE_ADDRESS
-#define LEGITIMIZE_ADDRESS(X, OLDX, MODE, WIN)
-#endif
-
#ifndef LEGITIMATE_PIC_OPERAND_P
#define LEGITIMATE_PIC_OPERAND_P(X) 1
#endif
@@ -969,4 +965,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define GO_IF_MODE_DEPENDENT_ADDRESS(X, WIN)
#endif
+#ifndef FRAME_POINTER_REQUIRED
+#define FRAME_POINTER_REQUIRED false
+#endif
+
#endif /* ! GCC_DEFAULTS_H */
diff --git a/gcc/df-core.c b/gcc/df-core.c
index e25d0e5faa3..a94dc48d95e 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -474,10 +474,10 @@ df_add_problem (struct df_problem *problem)
/* Set the MASK flags in the DFLOW problem. The old flags are
returned. If a flag is not allowed to be changed this will fail if
checking is enabled. */
-enum df_changeable_flags
+int
df_set_flags (int changeable_flags)
{
- enum df_changeable_flags old_flags = df->changeable_flags;
+ int old_flags = df->changeable_flags;
df->changeable_flags |= changeable_flags;
return old_flags;
}
@@ -486,10 +486,10 @@ df_set_flags (int changeable_flags)
/* Clear the MASK flags in the DFLOW problem. The old flags are
returned. If a flag is not allowed to be changed this will fail if
checking is enabled. */
-enum df_changeable_flags
+int
df_clear_flags (int changeable_flags)
{
- enum df_changeable_flags old_flags = df->changeable_flags;
+ int old_flags = df->changeable_flags;
df->changeable_flags &= ~changeable_flags;
return old_flags;
}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index a4853273214..f48da9bc8dc 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -316,7 +316,61 @@ df_rd_alloc (bitmap all_blocks)
}
-/* Process a list of DEFs for df_rd_bb_local_compute. */
+/* Add the effect of the top artificial defs of BB to the reaching definitions
+ bitmap LOCAL_RD. */
+
+void
+df_rd_simulate_artificial_defs_at_top (basic_block bb, bitmap local_rd)
+{
+ int bb_index = bb->index;
+ df_ref *def_rec;
+ for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
+ {
+ df_ref def = *def_rec;
+ if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
+ {
+ unsigned int dregno = DF_REF_REGNO (def);
+ if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
+ bitmap_clear_range (local_rd,
+ DF_DEFS_BEGIN (dregno),
+ DF_DEFS_COUNT (dregno));
+ bitmap_set_bit (local_rd, DF_REF_ID (def));
+ }
+ }
+}
+
+/* Add the effect of the defs of INSN to the reaching definitions bitmap
+ LOCAL_RD. */
+
+void
+df_rd_simulate_one_insn (basic_block bb ATTRIBUTE_UNUSED, rtx insn,
+ bitmap local_rd)
+{
+ unsigned uid = INSN_UID (insn);
+ df_ref *def_rec;
+
+ for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
+ {
+ df_ref def = *def_rec;
+ unsigned int dregno = DF_REF_REGNO (def);
+ if ((!(df->changeable_flags & DF_NO_HARD_REGS))
+ || (dregno >= FIRST_PSEUDO_REGISTER))
+ {
+ if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
+ bitmap_clear_range (local_rd,
+ DF_DEFS_BEGIN (dregno),
+ DF_DEFS_COUNT (dregno));
+ if (!(DF_REF_FLAGS (def)
+ & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
+ bitmap_set_bit (local_rd, DF_REF_ID (def));
+ }
+ }
+}
+
+/* Process a list of DEFs for df_rd_bb_local_compute. This is a bit
+ more complicated than just simulating, because we must produce the
+ gen and kill sets and hence deal with the two possible representations
+ of kill sets. */
static void
df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
@@ -2076,7 +2130,6 @@ df_chain_create_bb (unsigned int bb_index)
struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
rtx insn;
bitmap cpy = BITMAP_ALLOC (NULL);
- df_ref *def_rec;
bitmap_copy (cpy, bb_info->in);
bitmap_set_bit (df_chain->out_of_date_transfer_functions, bb_index);
@@ -2095,57 +2148,23 @@ df_chain_create_bb (unsigned int bb_index)
DF_REF_AT_TOP);
#endif
- for (def_rec = df_get_artificial_defs (bb_index); *def_rec; def_rec++)
- {
- df_ref def = *def_rec;
- if (DF_REF_FLAGS (def) & DF_REF_AT_TOP)
- {
- unsigned int dregno = DF_REF_REGNO (def);
- if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
- bitmap_clear_range (cpy,
- DF_DEFS_BEGIN (dregno),
- DF_DEFS_COUNT (dregno));
- bitmap_set_bit (cpy, DF_REF_ID (def));
- }
- }
+ df_rd_simulate_artificial_defs_at_top (bb, cpy);
/* Process the regular instructions next. */
FOR_BB_INSNS (bb, insn)
- {
- df_ref *def_rec;
- unsigned int uid = INSN_UID (insn);
-
- if (!INSN_P (insn))
- continue;
-
- /* Now scan the uses and link them up with the defs that remain
- in the cpy vector. */
-
- df_chain_create_bb_process_use (cpy, DF_INSN_UID_USES (uid), 0);
-
- if (df->changeable_flags & DF_EQ_NOTES)
- df_chain_create_bb_process_use (cpy, DF_INSN_UID_EQ_USES (uid), 0);
+ if (INSN_P (insn))
+ {
+ unsigned int uid = INSN_UID (insn);
+ /* First scan the uses and link them up with the defs that remain
+ in the cpy vector. */
+ df_chain_create_bb_process_use (cpy, DF_INSN_UID_USES (uid), 0);
+ if (df->changeable_flags & DF_EQ_NOTES)
+ df_chain_create_bb_process_use (cpy, DF_INSN_UID_EQ_USES (uid), 0);
- /* Since we are going forwards, process the defs second. This
- pass only changes the bits in cpy. */
- for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
- {
- df_ref def = *def_rec;
- unsigned int dregno = DF_REF_REGNO (def);
- if ((!(df->changeable_flags & DF_NO_HARD_REGS))
- || (dregno >= FIRST_PSEUDO_REGISTER))
- {
- if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
- bitmap_clear_range (cpy,
- DF_DEFS_BEGIN (dregno),
- DF_DEFS_COUNT (dregno));
- if (!(DF_REF_FLAGS (def)
- & (DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)))
- bitmap_set_bit (cpy, DF_REF_ID (def));
- }
- }
- }
+ /* Since we are going forwards, process the defs second. */
+ df_rd_simulate_one_insn (bb, insn, cpy);
+ }
/* Create the chains for the artificial uses of the hard registers
at the end of the block. */
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 7ffaa668c51..9337b6dbd8a 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -2888,7 +2888,7 @@ df_def_record_1 (struct df_collection_rec *collection_rec,
rtx dst;
int offset = -1;
int width = -1;
- enum machine_mode mode = 0;
+ enum machine_mode mode = VOIDmode;
enum df_ref_class cl = DF_REF_REGULAR;
/* We may recursively call ourselves on EXPR_LIST when dealing with PARALLEL
@@ -3299,7 +3299,7 @@ df_get_conditional_uses (struct df_collection_rec *collection_rec)
{
int width = -1;
int offset = -1;
- enum machine_mode mode = 0;
+ enum machine_mode mode = VOIDmode;
df_ref use;
if (DF_REF_FLAGS_IS_SET (ref, DF_REF_SIGN_EXTRACT | DF_REF_ZERO_EXTRACT))
diff --git a/gcc/df.h b/gcc/df.h
index 10b5e78d286..f8084e022d0 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -878,8 +878,8 @@ extern struct df *df;
/* Functions defined in df-core.c. */
extern void df_add_problem (struct df_problem *);
-extern enum df_changeable_flags df_set_flags (int);
-extern enum df_changeable_flags df_clear_flags (int);
+extern int df_set_flags (int);
+extern int df_clear_flags (int);
extern void df_set_blocks (bitmap);
extern void df_remove_problem (struct dataflow *);
extern void df_finish_pass (bool);
@@ -939,6 +939,8 @@ extern void df_grow_bb_info (struct dataflow *);
extern void df_chain_dump (struct df_link *, FILE *);
extern void df_print_bb_index (basic_block bb, FILE *file);
extern void df_rd_add_problem (void);
+extern void df_rd_simulate_artificial_defs_at_top (basic_block, bitmap);
+extern void df_rd_simulate_one_insn (basic_block, rtx, bitmap);
extern void df_lr_add_problem (void);
extern void df_lr_verify_transfer_functions (void);
extern void df_live_verify_transfer_functions (void);
diff --git a/gcc/dfp.c b/gcc/dfp.c
index 875e8c409a0..5e1dbcc41eb 100644
--- a/gcc/dfp.c
+++ b/gcc/dfp.c
@@ -133,6 +133,7 @@ encode_decimal32 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decNumber dn;
decimal32 d32;
decContext set;
+ int32_t image;
decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0;
@@ -140,7 +141,8 @@ encode_decimal32 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decimal_to_decnumber (r, &dn);
decimal32FromNumber (&d32, &dn, &set);
- memcpy (&buf[0], d32.bytes, sizeof (uint32_t));
+ memcpy (&image, d32.bytes, sizeof (int32_t));
+ buf[0] = image;
}
/* Decode an IEEE 754 decimal32 type into a real. */
@@ -152,11 +154,13 @@ decode_decimal32 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decNumber dn;
decimal32 d32;
decContext set;
+ int32_t image;
decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0;
- memcpy (&d32.bytes, &buf[0], sizeof (uint32_t));
+ image = buf[0];
+ memcpy (&d32.bytes, &image, sizeof (int32_t));
decimal32ToNumber (&d32, &dn);
decimal_from_decnumber (r, &dn, &set);
@@ -171,6 +175,7 @@ encode_decimal64 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decNumber dn;
decimal64 d64;
decContext set;
+ int32_t image;
decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0;
@@ -180,13 +185,17 @@ encode_decimal64 (const struct real_format *fmt ATTRIBUTE_UNUSED,
if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
{
- memcpy (&buf[0], &d64.bytes[0], sizeof (uint32_t));
- memcpy (&buf[1], &d64.bytes[4], sizeof (uint32_t));
+ memcpy (&image, &d64.bytes[0], sizeof (int32_t));
+ buf[0] = image;
+ memcpy (&image, &d64.bytes[4], sizeof (int32_t));
+ buf[1] = image;
}
else
{
- memcpy (&buf[0], &d64.bytes[4], sizeof (uint32_t));
- memcpy (&buf[1], &d64.bytes[0], sizeof (uint32_t));
+ memcpy (&image, &d64.bytes[4], sizeof (int32_t));
+ buf[0] = image;
+ memcpy (&image, &d64.bytes[0], sizeof (int32_t));
+ buf[1] = image;
}
}
@@ -199,19 +208,24 @@ decode_decimal64 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decNumber dn;
decimal64 d64;
decContext set;
+ int32_t image;
decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0;
if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
{
- memcpy (&d64.bytes[0], &buf[0], sizeof (uint32_t));
- memcpy (&d64.bytes[4], &buf[1], sizeof (uint32_t));
+ image = buf[0];
+ memcpy (&d64.bytes[0], &image, sizeof (int32_t));
+ image = buf[1];
+ memcpy (&d64.bytes[4], &image, sizeof (int32_t));
}
else
{
- memcpy (&d64.bytes[0], &buf[1], sizeof (uint32_t));
- memcpy (&d64.bytes[4], &buf[0], sizeof (uint32_t));
+ image = buf[1];
+ memcpy (&d64.bytes[0], &image, sizeof (int32_t));
+ image = buf[0];
+ memcpy (&d64.bytes[4], &image, sizeof (int32_t));
}
decimal64ToNumber (&d64, &dn);
@@ -227,6 +241,7 @@ encode_decimal128 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decNumber dn;
decContext set;
decimal128 d128;
+ int32_t image;
decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0;
@@ -236,17 +251,25 @@ encode_decimal128 (const struct real_format *fmt ATTRIBUTE_UNUSED,
if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
{
- memcpy (&buf[0], &d128.bytes[0], sizeof (uint32_t));
- memcpy (&buf[1], &d128.bytes[4], sizeof (uint32_t));
- memcpy (&buf[2], &d128.bytes[8], sizeof (uint32_t));
- memcpy (&buf[3], &d128.bytes[12], sizeof (uint32_t));
+ memcpy (&image, &d128.bytes[0], sizeof (int32_t));
+ buf[0] = image;
+ memcpy (&image, &d128.bytes[4], sizeof (int32_t));
+ buf[1] = image;
+ memcpy (&image, &d128.bytes[8], sizeof (int32_t));
+ buf[2] = image;
+ memcpy (&image, &d128.bytes[12], sizeof (int32_t));
+ buf[3] = image;
}
else
{
- memcpy (&buf[0], &d128.bytes[12], sizeof (uint32_t));
- memcpy (&buf[1], &d128.bytes[8], sizeof (uint32_t));
- memcpy (&buf[2], &d128.bytes[4], sizeof (uint32_t));
- memcpy (&buf[3], &d128.bytes[0], sizeof (uint32_t));
+ memcpy (&image, &d128.bytes[12], sizeof (int32_t));
+ buf[0] = image;
+ memcpy (&image, &d128.bytes[8], sizeof (int32_t));
+ buf[1] = image;
+ memcpy (&image, &d128.bytes[4], sizeof (int32_t));
+ buf[2] = image;
+ memcpy (&image, &d128.bytes[0], sizeof (int32_t));
+ buf[3] = image;
}
}
@@ -259,23 +282,32 @@ decode_decimal128 (const struct real_format *fmt ATTRIBUTE_UNUSED,
decNumber dn;
decimal128 d128;
decContext set;
+ int32_t image;
decContextDefault (&set, DEC_INIT_DECIMAL128);
set.traps = 0;
if (WORDS_BIGENDIAN == FLOAT_WORDS_BIG_ENDIAN)
{
- memcpy (&d128.bytes[0], &buf[0], sizeof (uint32_t));
- memcpy (&d128.bytes[4], &buf[1], sizeof (uint32_t));
- memcpy (&d128.bytes[8], &buf[2], sizeof (uint32_t));
- memcpy (&d128.bytes[12], &buf[3], sizeof (uint32_t));
+ image = buf[0];
+ memcpy (&d128.bytes[0], &image, sizeof (int32_t));
+ image = buf[1];
+ memcpy (&d128.bytes[4], &image, sizeof (int32_t));
+ image = buf[2];
+ memcpy (&d128.bytes[8], &image, sizeof (int32_t));
+ image = buf[3];
+ memcpy (&d128.bytes[12], &image, sizeof (int32_t));
}
else
{
- memcpy (&d128.bytes[0], &buf[3], sizeof (uint32_t));
- memcpy (&d128.bytes[4], &buf[2], sizeof (uint32_t));
- memcpy (&d128.bytes[8], &buf[1], sizeof (uint32_t));
- memcpy (&d128.bytes[12], &buf[0], sizeof (uint32_t));
+ image = buf[3];
+ memcpy (&d128.bytes[0], &image, sizeof (int32_t));
+ image = buf[2];
+ memcpy (&d128.bytes[4], &image, sizeof (int32_t));
+ image = buf[1];
+ memcpy (&d128.bytes[8], &image, sizeof (int32_t));
+ image = buf[0];
+ memcpy (&d128.bytes[12], &image, sizeof (int32_t));
}
decimal128ToNumber (&d128, &dn);
diff --git a/gcc/doc/c-tree.texi b/gcc/doc/c-tree.texi
index 0039228f18b..117b700ec08 100644
--- a/gcc/doc/c-tree.texi
+++ b/gcc/doc/c-tree.texi
@@ -373,7 +373,7 @@ The alignment of the type, in bits, represented as an @code{int}.
@item TYPE_NAME
This macro returns a declaration (in the form of a @code{TYPE_DECL}) for
-the type. (Note this macro does @emph{not} return a
+the type. (Note this macro does @emph{not} return an
@code{IDENTIFIER_NODE}, as you might expect, given its name!) You can
look at the @code{DECL_NAME} of the @code{TYPE_DECL} to obtain the
actual name of the type. The @code{TYPE_NAME} will be @code{NULL_TREE}
@@ -1256,7 +1256,7 @@ structures, something like the following should be used
@findex OVL_NEXT
A function is represented by a @code{FUNCTION_DECL} node. A set of
-overloaded functions is sometimes represented by a @code{OVERLOAD} node.
+overloaded functions is sometimes represented by an @code{OVERLOAD} node.
An @code{OVERLOAD} node is not a declaration, so none of the
@samp{DECL_} macros should be used on an @code{OVERLOAD}. An
@@ -2113,9 +2113,9 @@ comparisons, and so forth.
These nodes represent fixed-point constants. The type of these constants
is obtained with @code{TREE_TYPE}. @code{TREE_FIXED_CST_PTR} points to
-to struct fixed_value; @code{TREE_FIXED_CST} returns the structure itself.
-Struct fixed_value contains @code{data} with the size of two
-HOST_BITS_PER_WIDE_INT and @code{mode} as the associated fixed-point
+a @code{struct fixed_value}; @code{TREE_FIXED_CST} returns the structure
+itself. @code{struct fixed_value} contains @code{data} with the size of two
+@code{HOST_BITS_PER_WIDE_INT} and @code{mode} as the associated fixed-point
machine mode for @code{data}.
@item COMPLEX_CST
@@ -2569,7 +2569,7 @@ The statement-expression extension allows code like this:
@smallexample
int f() @{ return (@{ int j; j = 3; j + 7; @}); @}
@end smallexample
-In other words, an sequence of statements may occur where a single
+In other words, a sequence of statements may occur where a single
expression would normally appear. The @code{STMT_EXPR} node represents
such an expression. The @code{STMT_EXPR_STMT} gives the statement
contained in the expression. The value of the expression is the value
diff --git a/gcc/doc/cfg.texi b/gcc/doc/cfg.texi
index 323f6b51619..660c09c81ce 100644
--- a/gcc/doc/cfg.texi
+++ b/gcc/doc/cfg.texi
@@ -608,7 +608,7 @@ includes the creation of new basic blocks where needed. In the
iterator on an edge, and @code{bsi_commit_edge_inserts} which flushes
the instruction to actual instruction stream.
-While debugging the optimization pass, an @code{verify_flow_info}
+While debugging the optimization pass, a @code{verify_flow_info}
function may be useful to find bugs in the control flow graph updating
code.
@@ -638,7 +638,7 @@ used on some path from @code{P} to the end of the function. With
beginning of the function to @code{P} that defines the variable.
@code{LIVE} is the intersection of the @code{LR} and @code{UR} and a
variable is live at @code{P} if there is both an assignment that reaches
-it from the beginning of the function and a uses that can be reached on
+it from the beginning of the function and a use that can be reached on
some path from @code{P} to the end of the function.
In general @code{LIVE} is the most useful of the three. The macros
diff --git a/gcc/doc/collect2.texi b/gcc/doc/collect2.texi
index c3498c5317c..7cd5c935518 100644
--- a/gcc/doc/collect2.texi
+++ b/gcc/doc/collect2.texi
@@ -32,6 +32,10 @@ names:
@itemize @bullet
@item
+a hard coded linker file name, if GCC was configured with the
+@option{--with-ld} option.
+
+@item
@file{real-ld} in the directories listed in the compiler's search
directories.
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index d79991c16f7..ce4c0c3ff5d 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -1936,7 +1936,7 @@ in the near future.
@item __OBJC__
This macro is defined, with value 1, when the Objective-C compiler is in
use. You can use @code{__OBJC__} to test whether a header is compiled
-by a C compiler or a Objective-C compiler.
+by a C compiler or an Objective-C compiler.
@item __ASSEMBLER__
This macro is defined with value 1 when preprocessing assembly
@@ -4042,7 +4042,7 @@ The preprocessor and compiler interpret character constants in the
same way; i.e.@: escape sequences such as @samp{\a} are given the
values they would have on the target machine.
-The compiler values a multi-character character constant a character
+The compiler evaluates a multi-character character constant a character
at a time, shifting the previous value left by the number of bits per
target character, and then or-ing in the bit-pattern of the new
character truncated to the width of a target character. The final
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 4a7db02c902..6b626e2add7 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -958,10 +958,6 @@ is incomplete:
@itemize @bullet
@item
-Pragma @code{FLOAT_CONST_DECIMAL64} is not supported, nor is the @samp{d}
-suffix for literal constants of type @code{double}.
-
-@item
When the value of a decimal floating type cannot be represented in the
integer type to which it is being converted, the result is undefined
rather than the result value specified by the draft technical report.
@@ -2069,6 +2065,7 @@ objects (@pxref{C++ Attributes}).
These attributes are not currently implemented for Objective-C@.
@item deprecated
+@itemx deprecated (@var{msg})
@cindex @code{deprecated} attribute.
The @code{deprecated} attribute results in a warning if the function
is used anywhere in the source file. This is useful when identifying
@@ -2084,7 +2081,9 @@ int old_fn ();
int (*fn_ptr)() = old_fn;
@end smallexample
-results in a warning on line 3 but not line 2.
+results in a warning on line 3 but not line 2. The optional msg
+argument, which must be a string, will be printed in the warning if
+present.
The @code{deprecated} attribute can also be used for variables and
types (@pxref{Variable Attributes}, @pxref{Type Attributes}.)
@@ -2153,7 +2152,7 @@ On the SH Symbian OS target the @code{dllimport} attribute also has
another affect---it can cause the vtable and run-time type information
for a class to be exported. This happens when the class has a
dllimport'ed constructor or a non-inline, non-pure virtual function
-and, for either of those two conditions, the class also has a inline
+and, for either of those two conditions, the class also has an inline
constructor or destructor and has a key function that is defined in
the current translation unit.
@@ -3849,6 +3848,7 @@ These attributes override the default chosen by the
@option{-fno-common} and @option{-fcommon} flags respectively.
@item deprecated
+@itemx deprecated (@var{msg})
@cindex @code{deprecated} attribute
The @code{deprecated} attribute results in a warning if the variable
is used anywhere in the source file. This is useful when identifying
@@ -3864,7 +3864,9 @@ extern int old_var;
int new_fn () @{ return old_var; @}
@end smallexample
-results in a warning on line 3 but not line 2.
+results in a warning on line 3 but not line 2. The optional msg
+argument, which must be a string, will be printed in the warning if
+present.
The @code{deprecated} attribute can also be used for functions and
types (@pxref{Function Attributes}, @pxref{Type Attributes}.)
@@ -4422,7 +4424,7 @@ struct __attribute__ ((__packed__)) my_packed_struct
@};
@end smallexample
-You may only specify this attribute on the definition of a @code{enum},
+You may only specify this attribute on the definition of an @code{enum},
@code{struct} or @code{union}, not on a @code{typedef} which does not
also define the enumerated type, structure or union.
@@ -4494,6 +4496,7 @@ not referenced, but contain constructors and destructors that have
nontrivial bookkeeping functions.
@item deprecated
+@itemx deprecated (@var{msg})
The @code{deprecated} attribute results in a warning if the type
is used anywhere in the source file. This is useful when identifying
types that are expected to be removed in a future version of a program.
@@ -4516,7 +4519,9 @@ T3 z __attribute__ ((deprecated));
results in a warning on line 2 and 3 but not lines 4, 5, or 6. No
warning is issued for line 4 because T2 is not explicitly
deprecated. Line 5 has no warning because T3 is explicitly
-deprecated. Similarly for line 6.
+deprecated. Similarly for line 6. The optional msg
+argument, which must be a string, will be printed in the warning if
+present.
The @code{deprecated} attribute can also be used for functions and
variables (@pxref{Function Attributes}, @pxref{Variable Attributes}.)
diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi
index 34b768949f1..cc1e8903fdb 100644
--- a/gcc/doc/gimple.texi
+++ b/gcc/doc/gimple.texi
@@ -389,7 +389,7 @@ types, the associated handler code is executed. If the handler
code falls off the bottom, execution continues after the original
@code{GIMPLE_TRY_CATCH}.
-@item An @code{GIMPLE_EH_FILTER} statement. This has a list of
+@item A @code{GIMPLE_EH_FILTER} statement. This has a list of
permitted exception types, and code to handle a match failure. If the
thrown exception does not match one of the allowed types, the
associated match failure code is executed. If the thrown exception
@@ -1087,7 +1087,7 @@ statement @code{G}.
@end deftypefn
@deftypefn {GIMPLE function} bool gimple_assign_cast_p (gimple s)
-Return true if @code{S} is an type-cast assignment.
+Return true if @code{S} is a type-cast assignment.
@end deftypefn
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 7cba4d3df0e..5788e68fac5 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -464,7 +464,7 @@ the GCC-specific entry point. You can download a suitable jar from
@itemx antlr binary
If you wish to build the @command{gjdoc} binary in libjava, you will
-need to have a @file{antlr.jar} library available. The library is
+need to have an @file{antlr.jar} library available. The library is
searched in system locations but can be configured with
@option{--with-antlr-jar=} instead. When configuring with
@option{--enable-java-maintainer-mode}, you will need to have one of
@@ -1111,8 +1111,8 @@ Specify which cpu variant the compiler should generate code for by default.
This option is only supported on some targets, including ARM, i386, M68k,
PowerPC, and SPARC@. The @option{--with-cpu-32} and
@option{--with-cpu-64} options specify separate default CPUs for
-32-bit and 64-bit modes; these options are only supported for i386 and
-x86-64.
+32-bit and 64-bit modes; these options are only supported for i386,
+x86-64 and PowerPC.
@item --with-schedule=@var{cpu}
@itemx --with-arch=@var{cpu}
@@ -1536,6 +1536,14 @@ Convert source directory names using @option{-fdebug-prefix-map} when
building runtime libraries. @samp{@var{map}} is a space-separated
list of maps of the form @samp{@var{old}=@var{new}}.
+@item --enable-linker-build-id
+Tells GCC to pass @option{--build-id} option to the linker for all final
+links (links performed without the @option{-r} or @option{--relocatable}
+option), if the linker supports it. If you specify
+@option{--enable-linker-build-id}, but your linker does not
+support @option{--build-id} option, a warning is issued and the
+@option{--enable-linker-build-id} option is ignored. The default is off.
+
@end table
@subheading Cross-Compiler-Specific Options
@@ -1605,7 +1613,7 @@ that will be used while building GCC itself. This option can be useful
if the directory layouts are different between the system you are building
GCC on, and the system where you will deploy it.
-For example, on a @option{ia64-hp-hpux} system, you may have the GNU
+For example, on an @samp{ia64-hp-hpux} system, you may have the GNU
assembler and linker in @file{/usr/bin}, and the native tools in a
different path, and build a toolchain that expects to find the
native tools in @file{/usr/bin}.
@@ -3389,7 +3397,7 @@ The native AIX tools do interoperate with GCC@.
Building @file{libstdc++.a} requires a fix for an AIX Assembler bug
APAR IY26685 (AIX 4.3) or APAR IY25528 (AIX 5.1). It also requires a
fix for another AIX Assembler bug and a co-dependent AIX Archiver fix
-referenced as APAR IY53606 (AIX 5.2) or a APAR IY54774 (AIX 5.1)
+referenced as APAR IY53606 (AIX 5.2) or as APAR IY54774 (AIX 5.1)
@samp{libstdc++} in GCC 3.4 increments the major version number of the
shared object and GCC installation places the @file{libstdc++.a}
@@ -3944,7 +3952,7 @@ compiler. This is Sun bug 4974440. This is fixed with patch 112760-07.
GCC 3.4 changed the default debugging format from STABS to DWARF-2 for
32-bit code on Solaris 7 and later. If you use the Sun assembler, this
change apparently runs afoul of Sun bug 4910101 (which is referenced as
-a x86-only problem by Sun, probably because they do not use DWARF-2).
+an x86-only problem by Sun, probably because they do not use DWARF-2).
A symptom of the problem is that you cannot compile C++ programs like
@command{groff} 1.19.1 without getting messages similar to the following:
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 4757f22dcd7..b14238d4168 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -259,8 +259,8 @@ Objective-C and Objective-C++ Dialects}.
-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
-Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
--Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
--Wunused-value -Wunused-variable @gol
+-Wunsuffixed-float-constants -Wunused -Wunused-function @gol
+-Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable @gol
-Wvariadic-macros -Wvla @gol
-Wvolatile-register-var -Wwrite-strings}
@@ -3152,7 +3152,7 @@ Warn whenever a function is defined with a return-type that defaults
to @code{int}. Also warn about any @code{return} statement with no
return-value in a function whose return-type is not @code{void}
(falling off the end of the function body is considered returning
-without a value), and about a @code{return} statement with a
+without a value), and about a @code{return} statement with an
expression in a function whose return-type is @code{void}.
For C++, a function without return type always produces a diagnostic
@@ -4218,6 +4218,15 @@ minimum maximum, so we do not diagnose overlength strings in C++@.
This option is implied by @option{-pedantic}, and can be disabled with
@option{-Wno-overlength-strings}.
+
+@item -Wunsuffixed-float-constants
+@opindex Wunsuffixed-float-constants
+
+GCC will issue a warning for any floating constant that does not have
+a suffix. When used together with @option{-Wsystem-headers} it will
+warn about such constants in system header files. This can be useful
+when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
+from the decimal floating-point extension to C99.
@end table
@node Debugging Options
@@ -4593,13 +4602,14 @@ and dbg_cnt(tail_call) will return false always.
@itemx -fdump-rtl-@var{pass}
@opindex d
Says to make debugging dumps during compilation at times specified by
-@var{letters}. This is used for debugging the RTL-based passes of the
-compiler. The file names for most of the dumps are made by appending a
-pass number and a word to the @var{dumpname}. @var{dumpname} is generated
-from the name of the output file, if explicitly specified and it is not
-an executable, otherwise it is the basename of the source file. These
-switches may have different effects when @option{-E} is used for
-preprocessing.
+@var{letters}. This is used for debugging the RTL-based passes of the
+compiler. The file names for most of the dumps are made by appending
+a pass number and a word to the @var{dumpname}, and the files are
+created in the directory of the output file. @var{dumpname} is
+generated from the name of the output file, if explicitly specified
+and it is not an executable, otherwise it is the basename of the
+source file. These switches may have different effects when
+@option{-E} is used for preprocessing.
Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
@option{-d} option @var{letters}. Here are the possible
@@ -4927,7 +4937,8 @@ invocations with different options, in particular with and without
@opindex fdump-translation-unit
Dump a representation of the tree structure for the entire translation
unit to a file. The file name is made by appending @file{.tu} to the
-source file name. If the @samp{-@var{options}} form is used, @var{options}
+source file name, and the file is created in the same directory as the
+output file. If the @samp{-@var{options}} form is used, @var{options}
controls the details of the dump as described for the
@option{-fdump-tree} options.
@@ -4935,16 +4946,19 @@ controls the details of the dump as described for the
@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
@opindex fdump-class-hierarchy
Dump a representation of each class's hierarchy and virtual function
-table layout to a file. The file name is made by appending @file{.class}
-to the source file name. If the @samp{-@var{options}} form is used,
-@var{options} controls the details of the dump as described for the
-@option{-fdump-tree} options.
+table layout to a file. The file name is made by appending
+@file{.class} to the source file name, and the file is created in the
+same directory as the output file. If the @samp{-@var{options}} form
+is used, @var{options} controls the details of the dump as described
+for the @option{-fdump-tree} options.
@item -fdump-ipa-@var{switch}
@opindex fdump-ipa
Control the dumping at various stages of inter-procedural analysis
-language tree to a file. The file name is generated by appending a switch
-specific suffix to the source file name. The following dumps are possible:
+language tree to a file. The file name is generated by appending a
+switch specific suffix to the source file name, and the file is created
+in the same directory as the output file. The following dumps are
+possible:
@table @samp
@item all
@@ -4962,22 +4976,25 @@ Dump after function inlining.
@item -fdump-statistics-@var{option}
@opindex -fdump-statistics
Enable and control dumping of pass statistics in a separate file. The
-file name is generated by appending a suffix ending in @samp{.statistics}
-to the source file name. If the @samp{-@var{option}} form is used,
-@samp{-stats} will cause counters to be summed over the whole compilation unit
-while @samp{-details} will dump every event as the passes generate them.
-The default with no option is to sum counters for each function compiled.
+file name is generated by appending a suffix ending in
+@samp{.statistics} to the source file name, and the file is created in
+the same directory as the output file. If the @samp{-@var{option}}
+form is used, @samp{-stats} will cause counters to be summed over the
+whole compilation unit while @samp{-details} will dump every event as
+the passes generate them. The default with no option is to sum
+counters for each function compiled.
@item -fdump-tree-@var{switch}
@itemx -fdump-tree-@var{switch}-@var{options}
@opindex fdump-tree
Control the dumping at various stages of processing the intermediate
-language tree to a file. The file name is generated by appending a switch
-specific suffix to the source file name. If the @samp{-@var{options}}
-form is used, @var{options} is a list of @samp{-} separated options that
-control the details of the dump. Not all options are applicable to all
-dumps, those which are not meaningful will be ignored. The following
-options are available
+language tree to a file. The file name is generated by appending a
+switch specific suffix to the source file name, and the file is
+created in the same directory as the output file. If the
+@samp{-@var{options}} form is used, @var{options} is a list of
+@samp{-} separated options that control the details of the dump. Not
+all options are applicable to all dumps, those which are not
+meaningful will be ignored. The following options are available
@table @samp
@item address
@@ -5545,8 +5562,8 @@ instructions and checks if the result can be simplified. If loop unrolling
is active, two passes are performed and the second is scheduled after
loop unrolling.
-This option is enabled by default at optimization levels @option{-O2},
-@option{-O3}, @option{-Os}.
+This option is enabled by default at optimization levels @option{-O},
+@option{-O2}, @option{-O3}, @option{-Os}.
@item -fomit-frame-pointer
@opindex fomit-frame-pointer
@@ -6219,8 +6236,8 @@ This flag is enabled by default at @option{-O3}.
@item -fipa-matrix-reorg
@opindex fipa-matrix-reorg
Perform matrix flattening and transposing.
-Matrix flattening tries to replace a m-dimensional matrix
-with its equivalent n-dimensional matrix, where n < m.
+Matrix flattening tries to replace an @math{m}-dimensional matrix
+with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
This reduces the level of indirection needed for accessing the elements
of the matrix. The second optimization is matrix transposing that
attempts to change the order of the matrix's dimensions in order to
@@ -6784,13 +6801,13 @@ Enabled by default with @option{-funroll-loops}.
@item -fwhole-program
@opindex fwhole-program
-Assume that the current compilation unit represents whole program being
+Assume that the current compilation unit represents the whole program being
compiled. All public functions and variables with the exception of @code{main}
and those merged by attribute @code{externally_visible} become static functions
-and in a affect gets more aggressively optimized by interprocedural optimizers.
-While this option is equivalent to proper use of @code{static} keyword for
-programs consisting of single file, in combination with option
-@option{--combine} this flag can be used to compile most of smaller scale C
+and in effect are optimized more aggressively by interprocedural optimizers.
+While this option is equivalent to proper use of the @code{static} keyword for
+programs consisting of a single file, in combination with option
+@option{--combine} this flag can be used to compile many smaller scale C
programs since the functions and variables become local for the whole combined
compilation unit, not for the single source file itself.
@@ -9131,7 +9148,7 @@ assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
-@samp{arm1156t2-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
+@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
@samp{cortex-a8}, @samp{cortex-a9},
@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
@samp{cortex-m1},
@@ -9383,7 +9400,7 @@ Change only the low 8 bits of the stack pointer.
@item -mint8
@opindex mint8
Assume int to be 8 bit integer. This affects the sizes of all types: A
-char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
+char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
and long long will be 4 bytes. Please note that this option does not
comply to the C standards, but it will provide you with smaller code
size.
@@ -9754,7 +9771,7 @@ that GCC is targetting, like @option{-mcpu} or @option{-march}. The
The Darwin tools vary in their behavior when presented with an ISA
mismatch. The assembler, @file{as}, will only permit instructions to
be used that are valid for the subtype of the file it is generating,
-so you cannot put 64-bit instructions in an @samp{ppc750} object file.
+so you cannot put 64-bit instructions in a @samp{ppc750} object file.
The linker for shared libraries, @file{/usr/bin/libtool}, will fail
and print an error if asked to create a shared library with a less
restrictive subtype than its input files (for instance, trying to put
@@ -16141,7 +16158,9 @@ instrumentation. The function name to be matched is its user-visible
name, such as @code{vector<int> blah(const vector<int> &)}, not the
internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
match is done on substrings: if the @var{sym} parameter is a substring
-of the function name, it is considered to be a match.
+of the function name, it is considered to be a match. For C99 and C++
+extended identifiers, the function name must be given in UTF-8, not
+using universal character names.
@item -fstack-check
@opindex fstack-check
diff --git a/gcc/doc/loop.texi b/gcc/doc/loop.texi
index 567d7117af4..356c00d02b1 100644
--- a/gcc/doc/loop.texi
+++ b/gcc/doc/loop.texi
@@ -605,7 +605,7 @@ improve cache behavior or remove inner loop dependencies to allow
parallelization and vectorization to take place.
To perform these transformations, Lambda requires that the loopnest be
-converted into a internal form that can be matrix transformed easily.
+converted into an internal form that can be matrix transformed easily.
To do this conversion, the function
@code{gcc_loopnest_to_lambda_loopnest} is provided. If the loop cannot
be transformed using lambda, this function will return NULL.
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index a78233c8eaa..b966c27a880 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -552,7 +552,7 @@ As a special case, a template consisting of the single character @code{#}
instructs the compiler to first split the insn, and then output the
resulting instructions separately. This helps eliminate redundancy in the
output templates. If you have a @code{define_insn} that needs to emit
-multiple assembler instructions, and there is an matching @code{define_split}
+multiple assembler instructions, and there is a matching @code{define_split}
already defined, then you can simply use @code{#} as the output template
instead of writing an output template that emits the multiple assembler
instructions.
@@ -3323,7 +3323,7 @@ memory address of this type. If @samp{Q} is defined with
@code{define_memory_constraint}, a @samp{Q} constraint can handle any
memory operand, because @code{reload} knows it can simply copy the
memory address into a base register if required. This is analogous to
-the way a @samp{o} constraint can handle any memory operand.
+the way an @samp{o} constraint can handle any memory operand.
The syntax and semantics are otherwise identical to
@code{define_constraint}.
@@ -4729,7 +4729,7 @@ A label that precedes the table itself.
A label to jump to if the index has a value outside the bounds.
@end enumerate
-The table is a @code{addr_vec} or @code{addr_diff_vec} inside of a
+The table is an @code{addr_vec} or @code{addr_diff_vec} inside of a
@code{jump_insn}. The number of elements in the table is one plus the
difference between the upper bound and the lower bound.
@@ -4949,7 +4949,7 @@ the first three are normally used by the generic mechanism.
@cindex @code{builtin_setjmp_receiver} instruction pattern
@item @samp{builtin_setjmp_receiver}
-This pattern, if defined, contains code needed at the site of an
+This pattern, if defined, contains code needed at the site of a
built-in setjmp that isn't needed at the site of a nonlocal goto. You
will not normally need to define this pattern. A typical reason why you
might need this pattern is if some value, such as a pointer to a global
@@ -5115,8 +5115,6 @@ These patterns emit code for an atomic operation on memory.
Operand 0 is the memory on which the atomic operation is performed.
Operand 1 is the second operand to the binary operator.
-The ``nand'' operation is @code{~op0 & op1}.
-
This pattern must issue any memory barrier instructions such that all
memory operations before the atomic operation occur before the atomic
operation and all memory operations after the atomic operation occur
@@ -6116,7 +6114,7 @@ more assistance is needed. Splitter is required to create only unconditional
jumps, or simple conditional jump instructions. Additionally it must attach a
@code{REG_BR_PROB} note to each conditional jump. A global variable
@code{split_branch_probability} holds the probability of the original branch in case
-it was an simple conditional jump, @minus{}1 otherwise. To simplify
+it was a simple conditional jump, @minus{}1 otherwise. To simplify
recomputing of edge frequencies, the new sequence is required to have only
forward jumps to the newly created labels.
diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index a05a6b2c333..53ad66bb7f6 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -106,7 +106,7 @@ The option does not have a ``no-'' form. All options beginning with
property is used.
@item Negative(@var{othername})
-The option will turn off another option @var{othername}, which is the
+The option will turn off another option @var{othername}, which is
the option name with the leading ``-'' removed. This chain action will
propagate through the @code{Negative} property of the option to be
turned off.
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index 51dcc410143..3dcee398dd5 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -297,7 +297,7 @@ times throughout the optimization process. It is located in
This pass performs trivial dominator-based copy and constant propagation,
expression simplification, and jump threading. It is run multiple times
-throughout the optimization process. It it located in @file{tree-ssa-dom.c}
+throughout the optimization process. It is located in @file{tree-ssa-dom.c}
and is described by @code{pass_dominator}.
@item Forward propagation of single-use variables
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 1411f24e5d9..2567f10f4b0 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -2950,7 +2950,7 @@ store a value in @var{x}. @var{x} must be a @code{reg} expression.
In some situations, it may be tempting to add a @code{use} of a
register in a @code{parallel} to describe a situation where the value
of a special register will modify the behavior of the instruction.
-An hypothetical example might be a pattern for an addition that can
+A hypothetical example might be a pattern for an addition that can
either wrap around or use saturating addition depending on the value
of a special control register:
@@ -3256,7 +3256,7 @@ mode @var{m1} is the mode of the sum @code{x+y}; @var{m2} is that of
When an @code{asm} statement has multiple output values, its insn has
several such @code{set} RTX's inside of a @code{parallel}. Each @code{set}
-contains a @code{asm_operands}; all of these share the same assembler
+contains an @code{asm_operands}; all of these share the same assembler
template and vectors, but each contains the constraint for the respective
output operand. They are also distinguished by the output-operand index
number, which is 0, 1, @dots{} for successive output operands.
@@ -3680,7 +3680,7 @@ used, and flow optimization to build an accurate flow graph.
@findex REG_LABEL_TARGET
@item REG_LABEL_TARGET
-This insn is a @code{jump_insn} but not a @code{addr_vec} or
+This insn is a @code{jump_insn} but not an @code{addr_vec} or
@code{addr_diff_vec}. It uses @var{op}, a @code{code_label} as a
direct or indirect jump target. Its purpose is similar to that of
@code{REG_LABEL_OPERAND}. This note is only present if the insn has
@@ -3690,7 +3690,7 @@ insn-field) goes into the @code{JUMP_LABEL} field and does not have a
@findex REG_CROSSING_JUMP
@item REG_CROSSING_JUMP
-This insn is an branching instruction (either an unconditional jump or
+This insn is a branching instruction (either an unconditional jump or
an indirect jump) which crosses between hot and cold sections, which
could potentially be very far apart in the executable. The presence
of this note indicates to other optimizations that this branching
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 9c561b6e8a3..4c9b16279b5 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -2657,7 +2657,7 @@ allow copying all registers to and from memory, but require a scratch
register for stores to some memory locations (e.g., those with symbolic
address on the RT, and those with certain symbolic address on the SPARC
when compiling PIC)@. Scratch registers need not have the same mode
-as the value being copied, and usually hold a different value that
+as the value being copied, and usually hold a different value than
that being copied. Special patterns in the md file are needed to
describe how the copy is performed with the help of the scratch register;
these patterns also describe the number, register class(es) and mode(s)
@@ -3046,7 +3046,7 @@ If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT},
a @samp{Q} constraint can handle any memory operand, because the
reload pass knows it can be reloaded by copying the memory address
into a base register if required. This is analogous to the way
-a @samp{o} constraint can handle any memory operand.
+an @samp{o} constraint can handle any memory operand.
@end defmac
@defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str})
@@ -3738,15 +3738,16 @@ return @code{@var{regno}}.
This is about eliminating the frame pointer and arg pointer.
@defmac FRAME_POINTER_REQUIRED
-A C expression which is nonzero if a function must have and use a frame
+A C expression which is @code{true} if a function must have and use a frame
pointer. This expression is evaluated in the reload pass. If its value is
-nonzero the function will have a frame pointer.
+@code{true} the function will have a frame pointer.
The expression can in principle examine the current function and decide
-according to the facts, but on most machines the constant 0 or the
-constant 1 suffices. Use 0 when the machine allows code to be generated
-with no frame pointer, and doing so saves some time or space. Use 1
-when there is no possible advantage to avoiding a frame pointer.
+according to the facts, but on most machines the constant @code{false} or the
+constant @code{true} suffices. Use @code{false} when the machine allows code
+to be generated with no frame pointer, and doing so saves some time or space.
+Use @code{true} when there is no possible advantage to avoiding a frame
+pointer.
In certain cases, the compiler does not know how to produce valid code
without a frame pointer. The compiler recognizes those cases and
@@ -3757,6 +3758,8 @@ them.
In a function that does not require a frame pointer, the frame pointer
register can be allocated for ordinary usage, unless you mark it as a
fixed register. See @code{FIXED_REGISTERS} for more information.
+
+Default value is @code{false}.
@end defmac
@findex get_frame_size
@@ -4317,7 +4320,7 @@ values---values that can fit in registers.
Define this to return an RTX representing the place where a function
returns or receives a value of data type @var{ret_type}, a tree node
-node representing a data type. @var{fn_decl_or_type} is a tree node
+representing a data type. @var{fn_decl_or_type} is a tree node
representing @code{FUNCTION_DECL} or @code{FUNCTION_TYPE} of a
function being called. If @var{outgoing} is false, the hook should
compute the register in which the caller will see the return value.
@@ -5440,32 +5443,26 @@ The typical use of this macro is to handle addresses containing
a label_ref or symbol_ref within an UNSPEC@.
@end defmac
-@defmac LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
-A C compound statement that attempts to replace @var{x} with a valid
-memory address for an operand of mode @var{mode}. @var{win} will be a
-C statement label elsewhere in the code; the macro definition may use
-
-@smallexample
-GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
-@end smallexample
-
-@noindent
-to avoid further processing if the address has become legitimate.
+@deftypefn {Target Hook} rtx TARGET_LEGITIMIZE_ADDRESS (rtx @var{x}, rtx @var{oldx}, enum machine_mode @var{mode})
+This hook is given an invalid memory address @var{x} for an
+operand of mode @var{mode} and should try to return a valid memory
+address.
@findex break_out_memory_refs
@var{x} will always be the result of a call to @code{break_out_memory_refs},
and @var{oldx} will be the operand that was given to that function to produce
@var{x}.
-The code generated by this macro should not alter the substructure of
+The code of the hook should not alter the substructure of
@var{x}. If it transforms @var{x} into a more legitimate form, it
-should assign @var{x} (which will always be a C variable) a new value.
+should return the new @var{x}.
-It is not necessary for this macro to come up with a legitimate
-address. The compiler has standard ways of doing so in all cases. In
-fact, it is safe to omit this macro. But often a
-machine-dependent strategy can generate better code.
-@end defmac
+It is not necessary for this hook to come up with a legitimate address.
+The compiler has standard ways of doing so in all cases. In fact, it
+is safe to omit this hook or make it return @var{x} if it cannot find
+a valid way to legitimize the address. But often a machine-dependent
+strategy can generate better code.
+@end deftypefn
@defmac LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win})
A C compound statement that attempts to replace @var{x}, which is an address
@@ -8978,7 +8975,7 @@ of compilation, which is correct for most machines.
@defmac DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
Define this macro @emph{instead of} defining
@code{DBX_OUTPUT_MAIN_SOURCE_FILE_END}, if what needs to be output at
-the end of compilation is a @code{N_SO} stab with an empty string,
+the end of compilation is an @code{N_SO} stab with an empty string,
whose value is the highest absolute text address in the file.
@end defmac
diff --git a/gcc/doc/trouble.texi b/gcc/doc/trouble.texi
index a3d8187e649..c08e8b31b88 100644
--- a/gcc/doc/trouble.texi
+++ b/gcc/doc/trouble.texi
@@ -342,7 +342,7 @@ Declarations of external variables and functions within a block apply
only to the block containing the declaration. In other words, they
have the same scope as any other declaration in the same place.
-In some other C compilers, a @code{extern} declaration affects all the
+In some other C compilers, an @code{extern} declaration affects all the
rest of the file even if it happens within a block.
@item
diff --git a/gcc/dojump.c b/gcc/dojump.c
index 715e7373eee..36430851393 100644
--- a/gcc/dojump.c
+++ b/gcc/dojump.c
@@ -141,7 +141,8 @@ prefer_and_bit_test (enum machine_mode mode, int bitnum)
}
/* Fill in the integers. */
- XEXP (and_test, 1) = GEN_INT ((unsigned HOST_WIDE_INT) 1 << bitnum);
+ XEXP (and_test, 1)
+ = immed_double_const ((unsigned HOST_WIDE_INT) 1 << bitnum, 0, mode);
XEXP (XEXP (shift_test, 0), 1) = GEN_INT (bitnum);
return (rtx_cost (and_test, IF_THEN_ELSE, optimize_insn_for_speed_p ())
@@ -474,10 +475,10 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label)
&& prefer_and_bit_test (TYPE_MODE (argtype),
TREE_INT_CST_LOW (shift)))
{
- HOST_WIDE_INT mask = (HOST_WIDE_INT) 1
- << TREE_INT_CST_LOW (shift);
+ unsigned HOST_WIDE_INT mask
+ = (unsigned HOST_WIDE_INT) 1 << TREE_INT_CST_LOW (shift);
do_jump (build2 (BIT_AND_EXPR, argtype, arg,
- build_int_cst_type (argtype, mask)),
+ build_int_cst_wide_type (argtype, mask, 0)),
clr_label, set_label);
break;
}
diff --git a/gcc/dwarf.h b/gcc/dwarf.h
deleted file mode 100644
index 1350e669be5..00000000000
--- a/gcc/dwarf.h
+++ /dev/null
@@ -1,318 +0,0 @@
-/* Declarations and definitions of codes relating to the DWARF symbolic
- debugging information format.
-
- Written by Ron Guilmette (rfg@netcom.com)
-
-Copyright (C) 1992, 2004, 2007 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-/* This file is derived from the DWARF specification (a public document)
- Revision 1.0.1 (April 8, 1992) developed by the UNIX International
- Programming Languages Special Interest Group (UI/PLSIG) and distributed
- by UNIX International. Copies of this specification are available from
- UNIX International, 20 Waterview Boulevard, Parsippany, NJ, 07054.
-*/
-
-/* Tag names and codes. */
-
-enum dwarf_tag {
- TAG_padding = 0x0000,
- TAG_array_type = 0x0001,
- TAG_class_type = 0x0002,
- TAG_entry_point = 0x0003,
- TAG_enumeration_type = 0x0004,
- TAG_formal_parameter = 0x0005,
- TAG_global_subroutine = 0x0006,
- TAG_global_variable = 0x0007,
- /* 0x0008 -- reserved */
- /* 0x0009 -- reserved */
- TAG_label = 0x000a,
- TAG_lexical_block = 0x000b,
- TAG_local_variable = 0x000c,
- TAG_member = 0x000d,
- /* 0x000e -- reserved */
- TAG_pointer_type = 0x000f,
- TAG_reference_type = 0x0010,
- TAG_compile_unit = 0x0011,
- TAG_string_type = 0x0012,
- TAG_structure_type = 0x0013,
- TAG_subroutine = 0x0014,
- TAG_subroutine_type = 0x0015,
- TAG_typedef = 0x0016,
- TAG_union_type = 0x0017,
- TAG_unspecified_parameters = 0x0018,
- TAG_variant = 0x0019,
- TAG_common_block = 0x001a,
- TAG_common_inclusion = 0x001b,
- TAG_inheritance = 0x001c,
- TAG_inlined_subroutine = 0x001d,
- TAG_module = 0x001e,
- TAG_ptr_to_member_type = 0x001f,
- TAG_set_type = 0x0020,
- TAG_subrange_type = 0x0021,
- TAG_with_stmt = 0x0022,
-
- /* GNU extensions */
-
- TAG_format_label = 0x8000, /* for FORTRAN 77 and Fortran 90 */
- TAG_namelist = 0x8001, /* For Fortran 90 */
- TAG_function_template = 0x8002, /* for C++ */
- TAG_class_template = 0x8003 /* for C++ */
-};
-
-#define TAG_lo_user 0x8000 /* implementation-defined range start */
-#define TAG_hi_user 0xffff /* implementation-defined range end */
-#define TAG_source_file TAG_compile_unit /* for backward compatibility */
-
-/* Form names and codes. */
-
-enum dwarf_form {
- FORM_ADDR = 0x1,
- FORM_REF = 0x2,
- FORM_BLOCK2 = 0x3,
- FORM_BLOCK4 = 0x4,
- FORM_DATA2 = 0x5,
- FORM_DATA4 = 0x6,
- FORM_DATA8 = 0x7,
- FORM_STRING = 0x8
-};
-
-/* Attribute names and codes. */
-
-enum dwarf_attribute {
- AT_sibling = (0x0010|FORM_REF),
- AT_location = (0x0020|FORM_BLOCK2),
- AT_name = (0x0030|FORM_STRING),
- AT_fund_type = (0x0050|FORM_DATA2),
- AT_mod_fund_type = (0x0060|FORM_BLOCK2),
- AT_user_def_type = (0x0070|FORM_REF),
- AT_mod_u_d_type = (0x0080|FORM_BLOCK2),
- AT_ordering = (0x0090|FORM_DATA2),
- AT_subscr_data = (0x00a0|FORM_BLOCK2),
- AT_byte_size = (0x00b0|FORM_DATA4),
- AT_bit_offset = (0x00c0|FORM_DATA2),
- AT_bit_size = (0x00d0|FORM_DATA4),
- /* (0x00e0|FORM_xxxx) -- reserved */
- AT_element_list = (0x00f0|FORM_BLOCK4),
- AT_stmt_list = (0x0100|FORM_DATA4),
- AT_low_pc = (0x0110|FORM_ADDR),
- AT_high_pc = (0x0120|FORM_ADDR),
- AT_language = (0x0130|FORM_DATA4),
- AT_member = (0x0140|FORM_REF),
- AT_discr = (0x0150|FORM_REF),
- AT_discr_value = (0x0160|FORM_BLOCK2),
- /* (0x0170|FORM_xxxx) -- reserved */
- /* (0x0180|FORM_xxxx) -- reserved */
- AT_string_length = (0x0190|FORM_BLOCK2),
- AT_common_reference = (0x01a0|FORM_REF),
- AT_comp_dir = (0x01b0|FORM_STRING),
- AT_const_value_string = (0x01c0|FORM_STRING),
- AT_const_value_data2 = (0x01c0|FORM_DATA2),
- AT_const_value_data4 = (0x01c0|FORM_DATA4),
- AT_const_value_data8 = (0x01c0|FORM_DATA8),
- AT_const_value_block2 = (0x01c0|FORM_BLOCK2),
- AT_const_value_block4 = (0x01c0|FORM_BLOCK4),
- AT_containing_type = (0x01d0|FORM_REF),
- AT_default_value_addr = (0x01e0|FORM_ADDR),
- AT_default_value_data2 = (0x01e0|FORM_DATA2),
- AT_default_value_data4 = (0x01e0|FORM_DATA4),
- AT_default_value_data8 = (0x01e0|FORM_DATA8),
- AT_default_value_string = (0x01e0|FORM_STRING),
- AT_friends = (0x01f0|FORM_BLOCK2),
- AT_inline = (0x0200|FORM_STRING),
- AT_is_optional = (0x0210|FORM_STRING),
- AT_lower_bound_ref = (0x0220|FORM_REF),
- AT_lower_bound_data2 = (0x0220|FORM_DATA2),
- AT_lower_bound_data4 = (0x0220|FORM_DATA4),
- AT_lower_bound_data8 = (0x0220|FORM_DATA8),
- AT_private = (0x0240|FORM_STRING),
- AT_producer = (0x0250|FORM_STRING),
- AT_program = (0x0230|FORM_STRING),
- AT_protected = (0x0260|FORM_STRING),
- AT_prototyped = (0x0270|FORM_STRING),
- AT_public = (0x0280|FORM_STRING),
- AT_pure_virtual = (0x0290|FORM_STRING),
- AT_return_addr = (0x02a0|FORM_BLOCK2),
- AT_abstract_origin = (0x02b0|FORM_REF),
- AT_start_scope = (0x02c0|FORM_DATA4),
- AT_stride_size = (0x02e0|FORM_DATA4),
- AT_upper_bound_ref = (0x02f0|FORM_REF),
- AT_upper_bound_data2 = (0x02f0|FORM_DATA2),
- AT_upper_bound_data4 = (0x02f0|FORM_DATA4),
- AT_upper_bound_data8 = (0x02f0|FORM_DATA8),
- AT_virtual = (0x0300|FORM_STRING),
-
- /* GNU extensions. */
-
- AT_sf_names = (0x8000|FORM_DATA4),
- AT_src_info = (0x8010|FORM_DATA4),
- AT_mac_info = (0x8020|FORM_DATA4),
- AT_src_coords = (0x8030|FORM_DATA4),
- AT_body_begin = (0x8040|FORM_ADDR),
- AT_body_end = (0x8050|FORM_ADDR)
-};
-
-#define AT_lo_user 0x2000 /* implementation-defined range start */
-#define AT_hi_user 0x3ff0 /* implementation-defined range end */
-
-/* Location atom names and codes. */
-
-enum dwarf_location_atom {
- OP_REG = 0x01,
- OP_BASEREG = 0x02,
- OP_ADDR = 0x03,
- OP_CONST = 0x04,
- OP_DEREF2 = 0x05,
- OP_DEREF4 = 0x06,
- OP_ADD = 0x07,
-
- /* GNU extensions. */
-
- OP_MULT = 0x80
-};
-
-#define OP_LO_USER 0x80 /* implementation-defined range start */
-#define OP_HI_USER 0xff /* implementation-defined range end */
-
-/* Fundamental type names and codes. */
-
-enum dwarf_fundamental_type {
- FT_char = 0x0001,
- FT_signed_char = 0x0002,
- FT_unsigned_char = 0x0003,
- FT_short = 0x0004,
- FT_signed_short = 0x0005,
- FT_unsigned_short = 0x0006,
- FT_integer = 0x0007,
- FT_signed_integer = 0x0008,
- FT_unsigned_integer = 0x0009,
- FT_long = 0x000a,
- FT_signed_long = 0x000b,
- FT_unsigned_long = 0x000c,
- FT_pointer = 0x000d, /* an alias for (void *) */
- FT_float = 0x000e,
- FT_dbl_prec_float = 0x000f,
- FT_ext_prec_float = 0x0010, /* breaks "classic" svr4 SDB */
- FT_complex = 0x0011, /* breaks "classic" svr4 SDB */
- FT_dbl_prec_complex = 0x0012, /* breaks "classic" svr4 SDB */
- /* 0x0013 -- reserved */
- FT_void = 0x0014,
- FT_boolean = 0x0015, /* breaks "classic" svr4 SDB */
- FT_ext_prec_complex = 0x0016, /* breaks "classic" svr4 SDB */
- FT_label = 0x0017,
-
- /* GNU extensions
- The low order byte must indicate the size (in bytes) for the type.
- All of these types will probably break "classic" svr4 SDB. */
-
- FT_long_long = 0x8008,
- FT_signed_long_long = 0x8108,
- FT_unsigned_long_long = 0x8208,
-
- FT_int8 = 0x9001,
- FT_signed_int8 = 0x9101,
- FT_unsigned_int8 = 0x9201,
- FT_int16 = 0x9302,
- FT_signed_int16 = 0x9402,
- FT_unsigned_int16 = 0x9502,
- FT_int32 = 0x9604,
- FT_signed_int32 = 0x9704,
- FT_unsigned_int32 = 0x9804,
- FT_int64 = 0x9908,
- FT_signed_int64 = 0x9a08,
- FT_unsigned_int64 = 0x9b08,
- FT_int128 = 0x9c10,
- FT_signed_int128 = 0x9d10,
- FT_unsigned_int128 = 0x9e10,
-
- FT_real32 = 0xa004,
- FT_real64 = 0xa108,
- FT_real96 = 0xa20c,
- FT_real128 = 0xa310
-};
-
-#define FT_lo_user 0x8000 /* implementation-defined range start */
-#define FT_hi_user 0xffff /* implementation defined range end */
-
-/* Type modifier names and codes. */
-
-enum dwarf_type_modifier {
- MOD_pointer_to = 0x01,
- MOD_reference_to = 0x02,
- MOD_const = 0x03,
- MOD_volatile = 0x04
-};
-
-#define MOD_lo_user 0x80 /* implementation-defined range start */
-#define MOD_hi_user 0xff /* implementation-defined range end */
-
-/* Array ordering names and codes. */
-
-enum dwarf_array_dim_ordering {
- ORD_row_major = 0,
- ORD_col_major = 1
-};
-
-/* Array subscript format names and codes. */
-
-enum dwarf_subscr_data_formats {
- FMT_FT_C_C = 0x0,
- FMT_FT_C_X = 0x1,
- FMT_FT_X_C = 0x2,
- FMT_FT_X_X = 0x3,
- FMT_UT_C_C = 0x4,
- FMT_UT_C_X = 0x5,
- FMT_UT_X_C = 0x6,
- FMT_UT_X_X = 0x7,
- FMT_ET = 0x8
-};
-
-/* Derived from above for ease of use. */
-
-#define FMT_CODE(_FUNDAMENTAL_TYPE_P, _LB_CONST_P, _UB_CONST_P) \
- (((_FUNDAMENTAL_TYPE_P) ? 0 : 4) \
- | ((_LB_CONST_P) ? 0 : 2) \
- | ((_UB_CONST_P) ? 0 : 1))
-
-/* Source language names and codes. */
-
-enum dwarf_source_language {
- LANG_C89 = 0x00000001,
- LANG_C = 0x00000002,
- LANG_ADA83 = 0x00000003,
- LANG_C_PLUS_PLUS = 0x00000004,
- LANG_COBOL74 = 0x00000005,
- LANG_COBOL85 = 0x00000006,
- LANG_FORTRAN77 = 0x00000007,
- LANG_FORTRAN90 = 0x00000008,
- LANG_PASCAL83 = 0x00000009,
- LANG_MODULA2 = 0x0000000a,
- LANG_JAVA = 0x0000000b
-};
-
-#define LANG_lo_user 0x00008000 /* implementation-defined range start */
-#define LANG_hi_user 0x0000ffff /* implementation-defined range end */
-
-/* Names and codes for GNU "macinfo" extension. */
-
-enum dwarf_macinfo_record_type {
- MACINFO_start = 's',
- MACINFO_resume = 'r',
- MACINFO_define = 'd',
- MACINFO_undef = 'u'
-};
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 557d27f57c5..b18e2e31ce2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -375,7 +375,7 @@ static unsigned current_funcdef_fde;
struct GTY(()) indirect_string_node {
const char *str;
unsigned int refcount;
- unsigned int form;
+ enum dwarf_form form;
char *label;
};
@@ -3851,18 +3851,11 @@ new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1,
static inline dw_loc_descr_ref
new_reg_loc_descr (unsigned int reg, unsigned HOST_WIDE_INT offset)
{
- if (offset)
- {
- if (reg <= 31)
- return new_loc_descr ((enum dwarf_location_atom) (DW_OP_breg0 + reg),
- offset, 0);
- else
- return new_loc_descr (DW_OP_bregx, reg, offset);
- }
- else if (reg <= 31)
- return new_loc_descr ((enum dwarf_location_atom) (DW_OP_reg0 + reg), 0, 0);
+ if (reg <= 31)
+ return new_loc_descr ((enum dwarf_location_atom) (DW_OP_breg0 + reg),
+ offset, 0);
else
- return new_loc_descr (DW_OP_regx, reg, 0);
+ return new_loc_descr (DW_OP_bregx, reg, offset);
}
/* Add a location description term to a location description expression. */
@@ -4995,7 +4988,7 @@ static hashval_t debug_str_do_hash (const void *);
static int debug_str_eq (const void *, const void *);
static void add_AT_string (dw_die_ref, enum dwarf_attribute, const char *);
static inline const char *AT_string (dw_attr_ref);
-static int AT_string_form (dw_attr_ref);
+static enum dwarf_form AT_string_form (dw_attr_ref);
static void add_AT_die_ref (dw_die_ref, enum dwarf_attribute, dw_die_ref);
static void add_AT_specification (dw_die_ref, dw_die_ref);
static inline dw_die_ref AT_ref (dw_attr_ref);
@@ -6001,7 +5994,7 @@ AT_string (dw_attr_ref a)
/* Find out whether a string should be output inline in DIE
or out-of-line in .debug_str section. */
-static int
+static enum dwarf_form
AT_string_form (dw_attr_ref a)
{
struct indirect_string_node *node;
@@ -9702,7 +9695,13 @@ reg_loc_descriptor (rtx rtl, enum var_init_status initialized)
static dw_loc_descr_ref
one_reg_loc_descriptor (unsigned int regno, enum var_init_status initialized)
{
- dw_loc_descr_ref reg_loc_descr = new_reg_loc_descr (regno, 0);
+ dw_loc_descr_ref reg_loc_descr;
+
+ if (regno <= 31)
+ reg_loc_descr
+ = new_loc_descr ((enum dwarf_location_atom) (DW_OP_reg0 + regno), 0, 0);
+ else
+ reg_loc_descr = new_loc_descr (DW_OP_regx, regno, 0);
if (initialized == VAR_INIT_STATUS_UNINITIALIZED)
add_loc_descr (&reg_loc_descr, new_loc_descr (DW_OP_GNU_uninit, 0, 0));
@@ -11715,10 +11714,35 @@ loc_by_reference (dw_loc_descr_ref loc, tree decl)
if ((TREE_CODE (decl) != PARM_DECL
&& TREE_CODE (decl) != RESULT_DECL
- && (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl)))
+ && TREE_CODE (decl) != VAR_DECL)
|| !DECL_BY_REFERENCE (decl))
return loc;
+ /* If loc is DW_OP_reg{0...31,x}, don't add DW_OP_deref, instead
+ change it into corresponding DW_OP_breg{0...31,x} 0. Then the
+ location expression is considered to be address of a memory location,
+ rather than the register itself. */
+ if (((loc->dw_loc_opc >= DW_OP_reg0 && loc->dw_loc_opc <= DW_OP_reg31)
+ || loc->dw_loc_opc == DW_OP_regx)
+ && (loc->dw_loc_next == NULL
+ || (loc->dw_loc_next->dw_loc_opc == DW_OP_GNU_uninit
+ && loc->dw_loc_next->dw_loc_next == NULL)))
+ {
+ if (loc->dw_loc_opc == DW_OP_regx)
+ {
+ loc->dw_loc_opc = DW_OP_bregx;
+ loc->dw_loc_oprnd2.v.val_int = 0;
+ }
+ else
+ {
+ loc->dw_loc_opc
+ = (enum dwarf_location_atom)
+ (loc->dw_loc_opc + (DW_OP_breg0 - DW_OP_reg0));
+ loc->dw_loc_oprnd1.v.val_int = 0;
+ }
+ return loc;
+ }
+
size = int_size_in_bytes (TREE_TYPE (decl));
if (size > DWARF2_ADDR_SIZE || size == -1)
return 0;
@@ -14048,19 +14072,13 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
else
{
tree type = TREE_TYPE (decl);
- bool private_flag_valid = true;
add_name_and_src_coords_attributes (var_die, decl);
if ((TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == RESULT_DECL
- || (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl)))
+ || TREE_CODE (decl) == VAR_DECL)
&& DECL_BY_REFERENCE (decl))
- {
- add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die);
- /* DECL_BY_REFERENCE uses the same bit as TREE_PRIVATE,
- for PARM_DECL, RESULT_DECL or non-static VAR_DECL. */
- private_flag_valid = false;
- }
+ add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die);
else
add_type_attribute (var_die, type, TREE_READONLY (decl),
TREE_THIS_VOLATILE (decl), context_die);
@@ -14073,7 +14091,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
if (TREE_PROTECTED (decl))
add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (private_flag_valid && TREE_PRIVATE (decl))
+ else if (TREE_PRIVATE (decl))
add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_private);
}
@@ -15307,8 +15325,7 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die)
/* Output any DIEs that are needed to specify the type of this data
object. */
if ((TREE_CODE (decl_or_origin) == RESULT_DECL
- || (TREE_CODE (decl_or_origin) == VAR_DECL
- && !TREE_STATIC (decl_or_origin)))
+ || TREE_CODE (decl_or_origin) == VAR_DECL)
&& DECL_BY_REFERENCE (decl_or_origin))
gen_type_die (TREE_TYPE (TREE_TYPE (decl_or_origin)), context_die);
else
diff --git a/gcc/dyn-ipa.c b/gcc/dyn-ipa.c
index 7508ea56836..dceca485eda 100644
--- a/gcc/dyn-ipa.c
+++ b/gcc/dyn-ipa.c
@@ -1,7 +1,5 @@
/* Compile this one with gcc. */
-/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008. Free Software
- Foundation, Inc.
+/* Copyright (C) 2009. Free Software Foundation, Inc.
Contributed by Xinliang David Li (davidxl@google.com) and
Raksit Ashok (raksit@google.com)
@@ -9,27 +7,22 @@ This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, 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 into combinations with other programs,
-and to distribute those combinations 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 a combine
-executable.)
-
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
#include "tconfig.h"
#include "tsystem.h"
@@ -49,8 +42,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#endif
#include "gcov-io.h"
-struct dyn_pointer_set_t;
-struct dyn_vect_t;
+struct dyn_pointer_set;
+struct dyn_vect;
#define XNEWVEC(type,ne) (type *)malloc(sizeof(type) * (ne))
#define XNEW(type) (type *)malloc(sizeof(type))
@@ -61,7 +54,7 @@ struct dyn_cgraph_node
{
struct dyn_cgraph_edge *callees;
struct dyn_cgraph_edge *callers;
- struct dyn_pointer_set_t *imported_modules;
+ struct dyn_pointer_set *imported_modules;
gcov_type guid;
gcov_unsigned_t visited;
@@ -78,7 +71,7 @@ struct dyn_cgraph_edge
struct dyn_module_info
{
- struct dyn_pointer_set_t *imported_modules;
+ struct dyn_pointer_set *imported_modules;
};
struct dyn_cgraph
@@ -91,7 +84,7 @@ struct dyn_cgraph
unsigned num_modules;
};
-struct dyn_pointer_set_t
+struct dyn_pointer_set
{
size_t log_slots;
size_t n_slots; /* n_slots = 2^log_slots */
@@ -116,7 +109,7 @@ gcov_dump_cgraph_node_dot (struct dyn_cgraph_node *node,
unsigned m, unsigned f,
gcov_type cutoff_count);
static void
-pointer_set_destroy (struct dyn_pointer_set_t *pset);
+pointer_set_destroy (struct dyn_pointer_set *pset);
static struct dyn_cgraph the_dyn_call_graph;
@@ -490,10 +483,10 @@ hash1 (const void *p, unsigned long max, unsigned long logmax)
/* Allocate an empty pointer set. */
-static struct dyn_pointer_set_t *
+static struct dyn_pointer_set *
pointer_set_create (void)
{
- struct dyn_pointer_set_t *result = XNEW (struct dyn_pointer_set_t);
+ struct dyn_pointer_set *result = XNEW (struct dyn_pointer_set);
result->n_elements = 0;
result->log_slots = 8;
@@ -507,7 +500,7 @@ pointer_set_create (void)
/* Reclaim all memory associated with PSET. */
static void
-pointer_set_destroy (struct dyn_pointer_set_t *pset)
+pointer_set_destroy (struct dyn_pointer_set *pset)
{
XDELETEVEC (pset->slots);
XDELETE (pset);
@@ -536,7 +529,7 @@ insert_aux (const void *p, const void **slots, size_t n_slots, size_t log_slots)
if it was already there. P must be nonnull. */
static int
-pointer_set_insert (struct dyn_pointer_set_t *pset, const void *p)
+pointer_set_insert (struct dyn_pointer_set *pset, const void *p)
{
size_t n;
@@ -576,7 +569,7 @@ pointer_set_insert (struct dyn_pointer_set_t *pset, const void *p)
parameter DATA. If FN returns false, the iteration stops. */
static void
-pointer_set_traverse (const struct dyn_pointer_set_t *pset,
+pointer_set_traverse (const struct dyn_pointer_set *pset,
int (*fn) (const void *, void *), void *data)
{
size_t i;
@@ -590,8 +583,8 @@ pointer_set_traverse (const struct dyn_pointer_set_t *pset,
static int
gcov_propagate_imp_modules (const void *value, void *data)
{
- struct dyn_pointer_set_t *receiving_set
- = (struct dyn_pointer_set_t *) data;
+ struct dyn_pointer_set *receiving_set
+ = (struct dyn_pointer_set *) data;
pointer_set_insert (receiving_set, value);
return 1;
@@ -725,7 +718,7 @@ gcov_compute_cutoff_count (void)
/* Return the imported module set for NODE. */
-static struct dyn_pointer_set_t *
+static struct dyn_pointer_set *
gcov_get_imp_module_set (struct dyn_cgraph_node *node)
{
if (!node->imported_modules)
@@ -736,7 +729,7 @@ gcov_get_imp_module_set (struct dyn_cgraph_node *node)
/* Return the imported module set for MODULE MI. */
-static struct dyn_pointer_set_t *
+static struct dyn_pointer_set *
gcov_get_module_imp_module_set (struct dyn_module_info *mi)
{
if (!mi->imported_modules)
@@ -863,7 +856,7 @@ gcov_process_cgraph_node (struct dyn_cgraph_node *node,
if (callees->count >= cutoff_count)
{
unsigned callee_mod_id;
- struct dyn_pointer_set_t *imp_modules
+ struct dyn_pointer_set *imp_modules
= gcov_get_imp_module_set (node);
callee_mod_id
@@ -925,7 +918,7 @@ gcov_compute_module_groups (gcov_type cutoff_count)
{
struct dyn_cgraph_node *node;
unsigned mod_id;
- struct dyn_pointer_set_t *imp_modules;
+ struct dyn_pointer_set *imp_modules;
fi_ptr = the_dyn_call_graph.functions[m_ix][f_ix];
node = &the_dyn_call_graph.call_graph_nodes[m_ix][fi_ptr->ident];
@@ -970,7 +963,7 @@ gcov_compute_random_module_groups (unsigned max_group_size)
for (m_ix = 0; m_ix < the_dyn_call_graph.num_modules; m_ix++)
{
- struct dyn_pointer_set_t *imp_modules =
+ struct dyn_pointer_set *imp_modules =
gcov_get_module_imp_module_set (&the_dyn_call_graph.sup_modules[m_ix]);
int cur_group_size = random () % max_group_size;
int i = 0;
diff --git a/gcc/except.c b/gcc/except.c
index 91b177b3768..95eda85bdf0 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -2674,7 +2674,7 @@ remove_eh_handler_and_replace (struct eh_region *region,
outer = region->outer;
/* When we are moving the region in EH tree, update prev_try pointers. */
- if (outer != replace && region->inner)
+ if ((outer != replace || region->type == ERT_TRY) && region->inner)
{
struct eh_region *prev_try = find_prev_try (replace);
p = region->inner;
diff --git a/gcc/explow.c b/gcc/explow.c
index 11c2a477b84..2e8f6488501 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -446,7 +446,12 @@ memory_address (enum machine_mode mode, rtx x)
in certain cases. This is not necessary since the code
below can handle all possible cases, but machine-dependent
transformations can make better code. */
- LEGITIMIZE_ADDRESS (x, oldx, mode, done);
+ {
+ rtx orig_x = x;
+ x = targetm.legitimize_address (x, oldx, mode);
+ if (orig_x != x && memory_address_p (mode, x))
+ goto done;
+ }
/* PLUS and MULT can appear in special ways
as the result of attempts to make an address usable for indexing.
diff --git a/gcc/expmed.c b/gcc/expmed.c
index acbc09b1b87..d0c1621cc5e 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -103,7 +103,8 @@ static int add_cost[2][NUM_MACHINE_MODES];
static int neg_cost[2][NUM_MACHINE_MODES];
static int shift_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
static int shiftadd_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
-static int shiftsub_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
+static int shiftsub0_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
+static int shiftsub1_cost[2][NUM_MACHINE_MODES][MAX_BITS_PER_WORD];
static int mul_cost[2][NUM_MACHINE_MODES];
static int sdiv_cost[2][NUM_MACHINE_MODES];
static int udiv_cost[2][NUM_MACHINE_MODES];
@@ -130,7 +131,8 @@ init_expmed (void)
struct rtx_def shift; rtunion shift_fld1;
struct rtx_def shift_mult; rtunion shift_mult_fld1;
struct rtx_def shift_add; rtunion shift_add_fld1;
- struct rtx_def shift_sub; rtunion shift_sub_fld1;
+ struct rtx_def shift_sub0; rtunion shift_sub0_fld1;
+ struct rtx_def shift_sub1; rtunion shift_sub1_fld1;
} all;
rtx pow2[MAX_BITS_PER_WORD];
@@ -201,9 +203,13 @@ init_expmed (void)
XEXP (&all.shift_add, 0) = &all.shift_mult;
XEXP (&all.shift_add, 1) = &all.reg;
- PUT_CODE (&all.shift_sub, MINUS);
- XEXP (&all.shift_sub, 0) = &all.shift_mult;
- XEXP (&all.shift_sub, 1) = &all.reg;
+ PUT_CODE (&all.shift_sub0, MINUS);
+ XEXP (&all.shift_sub0, 0) = &all.shift_mult;
+ XEXP (&all.shift_sub0, 1) = &all.reg;
+
+ PUT_CODE (&all.shift_sub1, MINUS);
+ XEXP (&all.shift_sub1, 0) = &all.reg;
+ XEXP (&all.shift_sub1, 1) = &all.shift_mult;
for (speed = 0; speed < 2; speed++)
{
@@ -226,7 +232,8 @@ init_expmed (void)
PUT_MODE (&all.shift, mode);
PUT_MODE (&all.shift_mult, mode);
PUT_MODE (&all.shift_add, mode);
- PUT_MODE (&all.shift_sub, mode);
+ PUT_MODE (&all.shift_sub0, mode);
+ PUT_MODE (&all.shift_sub1, mode);
add_cost[speed][mode] = rtx_cost (&all.plus, SET, speed);
neg_cost[speed][mode] = rtx_cost (&all.neg, SET, speed);
@@ -254,8 +261,8 @@ init_expmed (void)
}
shift_cost[speed][mode][0] = 0;
- shiftadd_cost[speed][mode][0] = shiftsub_cost[speed][mode][0]
- = add_cost[speed][mode];
+ shiftadd_cost[speed][mode][0] = shiftsub0_cost[speed][mode][0]
+ = shiftsub1_cost[speed][mode][0] = add_cost[speed][mode];
n = MIN (MAX_BITS_PER_WORD, GET_MODE_BITSIZE (mode));
for (m = 1; m < n; m++)
@@ -265,7 +272,8 @@ init_expmed (void)
shift_cost[speed][mode][m] = rtx_cost (&all.shift, SET, speed);
shiftadd_cost[speed][mode][m] = rtx_cost (&all.shift_add, SET, speed);
- shiftsub_cost[speed][mode][m] = rtx_cost (&all.shift_sub, SET, speed);
+ shiftsub0_cost[speed][mode][m] = rtx_cost (&all.shift_sub0, SET, speed);
+ shiftsub1_cost[speed][mode][m] = rtx_cost (&all.shift_sub1, SET, speed);
}
}
}
@@ -2397,6 +2405,7 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
struct mult_cost best_cost;
struct mult_cost new_limit;
int op_cost, op_latency;
+ unsigned HOST_WIDE_INT orig_t = t;
unsigned HOST_WIDE_INT q;
int maxm = MIN (BITS_PER_WORD, GET_MODE_BITSIZE (mode));
int hash_index;
@@ -2542,6 +2551,38 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
best_alg->log[best_alg->ops] = m;
best_alg->op[best_alg->ops] = alg_shift;
}
+
+ /* See if treating ORIG_T as a signed number yields a better
+ sequence. Try this sequence only for a negative ORIG_T
+ as it would be useless for a non-negative ORIG_T. */
+ if ((HOST_WIDE_INT) orig_t < 0)
+ {
+ /* Shift ORIG_T as follows because a right shift of a
+ negative-valued signed type is implementation
+ defined. */
+ q = ~(~orig_t >> m);
+ /* The function expand_shift will choose between a shift
+ and a sequence of additions, so the observed cost is
+ given as MIN (m * add_cost[speed][mode],
+ shift_cost[speed][mode][m]). */
+ op_cost = m * add_cost[speed][mode];
+ if (shift_cost[speed][mode][m] < op_cost)
+ op_cost = shift_cost[speed][mode][m];
+ new_limit.cost = best_cost.cost - op_cost;
+ new_limit.latency = best_cost.latency - op_cost;
+ synth_mult (alg_in, q, &new_limit, mode);
+
+ alg_in->cost.cost += op_cost;
+ alg_in->cost.latency += op_cost;
+ if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
+ {
+ struct algorithm *x;
+ best_cost = alg_in->cost;
+ x = alg_in, alg_in = best_alg, best_alg = x;
+ best_alg->log[best_alg->ops] = m;
+ best_alg->op[best_alg->ops] = alg_shift;
+ }
+ }
}
if (cache_hit)
goto done;
@@ -2604,6 +2645,29 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
best_alg->op[best_alg->ops] = alg_add_t_m2;
}
}
+
+ /* We may be able to calculate a * -7, a * -15, a * -31, etc
+ quickly with a - a * n for some appropriate constant n. */
+ m = exact_log2 (-orig_t + 1);
+ if (m >= 0 && m < maxm)
+ {
+ op_cost = shiftsub1_cost[speed][mode][m];
+ new_limit.cost = best_cost.cost - op_cost;
+ new_limit.latency = best_cost.latency - op_cost;
+ synth_mult (alg_in, (unsigned HOST_WIDE_INT) (-orig_t + 1) >> m, &new_limit, mode);
+
+ alg_in->cost.cost += op_cost;
+ alg_in->cost.latency += op_cost;
+ if (CHEAPER_MULT_COST (&alg_in->cost, &best_cost))
+ {
+ struct algorithm *x;
+ best_cost = alg_in->cost;
+ x = alg_in, alg_in = best_alg, best_alg = x;
+ best_alg->log[best_alg->ops] = m;
+ best_alg->op[best_alg->ops] = alg_sub_t_m2;
+ }
+ }
+
if (cache_hit)
goto done;
}
@@ -2673,9 +2737,9 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
hardware the shift may be executed concurrently with the
earlier steps in the algorithm. */
op_cost = add_cost[speed][mode] + shift_cost[speed][mode][m];
- if (shiftsub_cost[speed][mode][m] < op_cost)
+ if (shiftsub0_cost[speed][mode][m] < op_cost)
{
- op_cost = shiftsub_cost[speed][mode][m];
+ op_cost = shiftsub0_cost[speed][mode][m];
op_latency = op_cost;
}
else
@@ -2738,7 +2802,7 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
m = exact_log2 (q);
if (m >= 0 && m < maxm)
{
- op_cost = shiftsub_cost[speed][mode][m];
+ op_cost = shiftsub0_cost[speed][mode][m];
new_limit.cost = best_cost.cost - op_cost;
new_limit.latency = best_cost.latency - op_cost;
synth_mult (alg_in, (t + 1) >> m, &new_limit, mode);
diff --git a/gcc/expr.c b/gcc/expr.c
index cf818429ef1..aca8c578c8e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2249,6 +2249,26 @@ use_group_regs (rtx *call_fusage, rtx regs)
use_reg (call_fusage, reg);
}
}
+
+/* Return the defining gimple statement for SSA_NAME NAME if it is an
+ assigment and the code of the expresion on the RHS is CODE. Return
+ NULL otherwise. */
+
+static gimple
+get_def_for_expr (tree name, enum tree_code code)
+{
+ gimple def_stmt;
+
+ if (TREE_CODE (name) != SSA_NAME)
+ return NULL;
+
+ def_stmt = get_gimple_for_ssa_name (name);
+ if (!def_stmt
+ || gimple_assign_rhs_code (def_stmt) != code)
+ return NULL;
+
+ return def_stmt;
+}
/* Determine whether the LEN bytes generated by CONSTFUN can be
@@ -5776,22 +5796,25 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
&& compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), bitsize) != 0))
{
rtx temp;
+ gimple nop_def;
/* If EXP is a NOP_EXPR of precision less than its mode, then that
implies a mask operation. If the precision is the same size as
the field we're storing into, that mask is redundant. This is
particularly common with bit field assignments generated by the
C front end. */
- if (TREE_CODE (exp) == NOP_EXPR)
+ nop_def = get_def_for_expr (exp, NOP_EXPR);
+ if (nop_def)
{
tree type = TREE_TYPE (exp);
if (INTEGRAL_TYPE_P (type)
&& TYPE_PRECISION (type) < GET_MODE_BITSIZE (TYPE_MODE (type))
&& bitsize == TYPE_PRECISION (type))
{
- type = TREE_TYPE (TREE_OPERAND (exp, 0));
+ tree op = gimple_assign_rhs1 (nop_def);
+ type = TREE_TYPE (op);
if (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) >= bitsize)
- exp = TREE_OPERAND (exp, 0);
+ exp = op;
}
}
@@ -7130,6 +7153,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
int ignore;
tree context, subexp0, subexp1;
bool reduce_bit_field;
+ gimple subexp0_def, subexp1_def;
+ tree top0, top1;
#define REDUCE_BIT_FIELD(expr) (reduce_bit_field \
? reduce_to_bit_field_precision ((expr), \
target, \
@@ -8033,14 +8058,14 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& (attr = lookup_attribute ("error",
DECL_ATTRIBUTES (fndecl))) != NULL)
error ("%Kcall to %qs declared with attribute error: %s",
- exp, lang_hooks.decl_printable_name (fndecl, 1),
+ exp, identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 1)),
TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
if (fndecl
&& (attr = lookup_attribute ("warning",
DECL_ATTRIBUTES (fndecl))) != NULL)
warning_at (tree_nonartificial_location (exp),
0, "%Kcall to %qs declared with attribute warning: %s",
- exp, lang_hooks.decl_printable_name (fndecl, 1),
+ exp, identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 1)),
TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr))));
/* Check for a built-in function. */
@@ -8322,27 +8347,30 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* Check if this is a case for multiplication and addition. */
if ((TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == FIXED_POINT_TYPE)
- && TREE_CODE (TREE_OPERAND (exp, 0)) == MULT_EXPR)
+ && (subexp0_def = get_def_for_expr (TREE_OPERAND (exp, 0),
+ MULT_EXPR)))
{
tree subsubexp0, subsubexp1;
- enum tree_code code0, code1, this_code;
+ gimple subsubexp0_def, subsubexp1_def;
+ enum tree_code this_code;
- subexp0 = TREE_OPERAND (exp, 0);
- subsubexp0 = TREE_OPERAND (subexp0, 0);
- subsubexp1 = TREE_OPERAND (subexp0, 1);
- code0 = TREE_CODE (subsubexp0);
- code1 = TREE_CODE (subsubexp1);
this_code = TREE_CODE (type) == INTEGER_TYPE ? NOP_EXPR
: FIXED_CONVERT_EXPR;
- if (code0 == this_code && code1 == this_code
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subsubexp0, 0)))
+ subsubexp0 = gimple_assign_rhs1 (subexp0_def);
+ subsubexp0_def = get_def_for_expr (subsubexp0, this_code);
+ subsubexp1 = gimple_assign_rhs2 (subexp0_def);
+ subsubexp1_def = get_def_for_expr (subsubexp1, this_code);
+ if (subsubexp0_def && subsubexp1_def
+ && (top0 = gimple_assign_rhs1 (subsubexp0_def))
+ && (top1 = gimple_assign_rhs1 (subsubexp1_def))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
< TYPE_PRECISION (TREE_TYPE (subsubexp0)))
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subsubexp0, 0)))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subsubexp1, 0))))
- && (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subsubexp0, 0)))
- == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subsubexp1, 0)))))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
+ == TYPE_PRECISION (TREE_TYPE (top1)))
+ && (TYPE_UNSIGNED (TREE_TYPE (top0))
+ == TYPE_UNSIGNED (TREE_TYPE (top1))))
{
- tree op0type = TREE_TYPE (TREE_OPERAND (subsubexp0, 0));
+ tree op0type = TREE_TYPE (top0);
enum machine_mode innermode = TYPE_MODE (op0type);
bool zextend_p = TYPE_UNSIGNED (op0type);
bool sat_p = TYPE_SATURATING (TREE_TYPE (subsubexp0));
@@ -8355,9 +8383,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& (optab_handler (this_optab, mode)->insn_code
!= CODE_FOR_nothing))
{
- expand_operands (TREE_OPERAND (subsubexp0, 0),
- TREE_OPERAND (subsubexp1, 0),
- NULL_RTX, &op0, &op1, EXPAND_NORMAL);
+ expand_operands (top0, top1, NULL_RTX, &op0, &op1,
+ EXPAND_NORMAL);
op2 = expand_expr (TREE_OPERAND (exp, 1), subtarget,
VOIDmode, EXPAND_NORMAL);
temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
@@ -8485,27 +8512,30 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* Check if this is a case for multiplication and subtraction. */
if ((TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == FIXED_POINT_TYPE)
- && TREE_CODE (TREE_OPERAND (exp, 1)) == MULT_EXPR)
+ && (subexp1_def = get_def_for_expr (TREE_OPERAND (exp, 1),
+ MULT_EXPR)))
{
tree subsubexp0, subsubexp1;
- enum tree_code code0, code1, this_code;
+ gimple subsubexp0_def, subsubexp1_def;
+ enum tree_code this_code;
- subexp1 = TREE_OPERAND (exp, 1);
- subsubexp0 = TREE_OPERAND (subexp1, 0);
- subsubexp1 = TREE_OPERAND (subexp1, 1);
- code0 = TREE_CODE (subsubexp0);
- code1 = TREE_CODE (subsubexp1);
this_code = TREE_CODE (type) == INTEGER_TYPE ? NOP_EXPR
: FIXED_CONVERT_EXPR;
- if (code0 == this_code && code1 == this_code
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subsubexp0, 0)))
+ subsubexp0 = gimple_assign_rhs1 (subexp1_def);
+ subsubexp0_def = get_def_for_expr (subsubexp0, this_code);
+ subsubexp1 = gimple_assign_rhs2 (subexp1_def);
+ subsubexp1_def = get_def_for_expr (subsubexp1, this_code);
+ if (subsubexp0_def && subsubexp1_def
+ && (top0 = gimple_assign_rhs1 (subsubexp0_def))
+ && (top1 = gimple_assign_rhs1 (subsubexp1_def))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
< TYPE_PRECISION (TREE_TYPE (subsubexp0)))
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subsubexp0, 0)))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subsubexp1, 0))))
- && (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subsubexp0, 0)))
- == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subsubexp1, 0)))))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
+ == TYPE_PRECISION (TREE_TYPE (top1)))
+ && (TYPE_UNSIGNED (TREE_TYPE (top0))
+ == TYPE_UNSIGNED (TREE_TYPE (top1))))
{
- tree op0type = TREE_TYPE (TREE_OPERAND (subsubexp0, 0));
+ tree op0type = TREE_TYPE (top0);
enum machine_mode innermode = TYPE_MODE (op0type);
bool zextend_p = TYPE_UNSIGNED (op0type);
bool sat_p = TYPE_SATURATING (TREE_TYPE (subsubexp0));
@@ -8518,9 +8548,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
&& (optab_handler (this_optab, mode)->insn_code
!= CODE_FOR_nothing))
{
- expand_operands (TREE_OPERAND (subsubexp0, 0),
- TREE_OPERAND (subsubexp1, 0),
- NULL_RTX, &op0, &op1, EXPAND_NORMAL);
+ expand_operands (top0, top1, NULL_RTX, &op0, &op1,
+ EXPAND_NORMAL);
op2 = expand_expr (TREE_OPERAND (exp, 0), subtarget,
VOIDmode, EXPAND_NORMAL);
temp = expand_ternary_op (mode, this_optab, op0, op1, op2,
@@ -8619,66 +8648,65 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
subexp0 = TREE_OPERAND (exp, 0);
subexp1 = TREE_OPERAND (exp, 1);
+ subexp0_def = get_def_for_expr (subexp0, NOP_EXPR);
+ subexp1_def = get_def_for_expr (subexp1, NOP_EXPR);
+ top0 = top1 = NULL_TREE;
+
/* First, check if we have a multiplication of one signed and one
unsigned operand. */
- if (TREE_CODE (subexp0) == NOP_EXPR
- && TREE_CODE (subexp1) == NOP_EXPR
+ if (subexp0_def
+ && (top0 = gimple_assign_rhs1 (subexp0_def))
+ && subexp1_def
+ && (top1 = gimple_assign_rhs1 (subexp1_def))
&& TREE_CODE (type) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subexp0, 0)))
- < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subexp0, 0)))
- == TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (subexp1, 0))))
- && (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subexp0, 0)))
- != TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subexp1, 0)))))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
+ < TYPE_PRECISION (TREE_TYPE (subexp0)))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
+ == TYPE_PRECISION (TREE_TYPE (top1)))
+ && (TYPE_UNSIGNED (TREE_TYPE (top0))
+ != TYPE_UNSIGNED (TREE_TYPE (top1))))
{
enum machine_mode innermode
- = TYPE_MODE (TREE_TYPE (TREE_OPERAND (subexp0, 0)));
+ = TYPE_MODE (TREE_TYPE (top0));
this_optab = usmul_widen_optab;
if (mode == GET_MODE_WIDER_MODE (innermode))
{
if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
{
- if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (subexp0, 0))))
- expand_operands (TREE_OPERAND (subexp0, 0),
- TREE_OPERAND (subexp1, 0),
- NULL_RTX, &op0, &op1, EXPAND_NORMAL);
+ if (TYPE_UNSIGNED (TREE_TYPE (top0)))
+ expand_operands (top0, top1, NULL_RTX, &op0, &op1,
+ EXPAND_NORMAL);
else
- expand_operands (TREE_OPERAND (subexp0, 0),
- TREE_OPERAND (subexp1, 0),
- NULL_RTX, &op1, &op0, EXPAND_NORMAL);
+ expand_operands (top0, top1, NULL_RTX, &op1, &op0,
+ EXPAND_NORMAL);
goto binop3;
}
}
}
- /* Check for a multiplication with matching signedness. */
- else if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
+ /* Check for a multiplication with matching signedness. If
+ valid, TOP0 and TOP1 were set in the previous if
+ condition. */
+ else if (top0
&& TREE_CODE (type) == INTEGER_TYPE
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
- < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
- && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
- && int_fits_type_p (TREE_OPERAND (exp, 1),
- TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
+ && (TYPE_PRECISION (TREE_TYPE (top0))
+ < TYPE_PRECISION (TREE_TYPE (subexp0)))
+ && ((TREE_CODE (subexp1) == INTEGER_CST
+ && int_fits_type_p (subexp1, TREE_TYPE (top0))
/* Don't use a widening multiply if a shift will do. */
- && ((GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1))))
+ && ((GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (subexp1)))
> HOST_BITS_PER_WIDE_INT)
- || exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0))
+ || exact_log2 (TREE_INT_CST_LOW (subexp1)) < 0))
||
- (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
- && (TYPE_PRECISION (TREE_TYPE
- (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
- == TYPE_PRECISION (TREE_TYPE
- (TREE_OPERAND
- (TREE_OPERAND (exp, 0), 0))))
+ (top1
+ && (TYPE_PRECISION (TREE_TYPE (top1))
+ == TYPE_PRECISION (TREE_TYPE (top0))
/* If both operands are extended, they must either both
be zero-extended or both be sign-extended. */
- && (TYPE_UNSIGNED (TREE_TYPE
- (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
- == TYPE_UNSIGNED (TREE_TYPE
- (TREE_OPERAND
- (TREE_OPERAND (exp, 0), 0)))))))
+ && (TYPE_UNSIGNED (TREE_TYPE (top1))
+ == TYPE_UNSIGNED (TREE_TYPE (top0)))))))
{
- tree op0type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0));
+ tree op0type = TREE_TYPE (top0);
enum machine_mode innermode = TYPE_MODE (op0type);
bool zextend_p = TYPE_UNSIGNED (op0type);
optab other_optab = zextend_p ? smul_widen_optab : umul_widen_optab;
@@ -8688,27 +8716,24 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{
if (optab_handler (this_optab, mode)->insn_code != CODE_FOR_nothing)
{
- if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
- expand_operands (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
- TREE_OPERAND (exp, 1),
- NULL_RTX, &op0, &op1, EXPAND_NORMAL);
+ if (TREE_CODE (subexp1) == INTEGER_CST)
+ expand_operands (top0, subexp1, NULL_RTX, &op0, &op1,
+ EXPAND_NORMAL);
else
- expand_operands (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
- TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
- NULL_RTX, &op0, &op1, EXPAND_NORMAL);
+ expand_operands (top0, top1, NULL_RTX, &op0, &op1,
+ EXPAND_NORMAL);
goto binop3;
}
else if (optab_handler (other_optab, mode)->insn_code != CODE_FOR_nothing
&& innermode == word_mode)
{
rtx htem, hipart;
- op0 = expand_normal (TREE_OPERAND (TREE_OPERAND (exp, 0), 0));
- if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
+ op0 = expand_normal (top0);
+ if (TREE_CODE (subexp1) == INTEGER_CST)
op1 = convert_modes (innermode, mode,
- expand_normal (TREE_OPERAND (exp, 1)),
- unsignedp);
+ expand_normal (subexp1), unsignedp);
else
- op1 = expand_normal (TREE_OPERAND (TREE_OPERAND (exp, 1), 0));
+ op1 = expand_normal (top1);
temp = expand_binop (mode, other_optab, op0, op1, target,
unsignedp, OPTAB_LIB_WIDEN);
hipart = gen_highpart (innermode, temp);
@@ -8721,8 +8746,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
}
}
- expand_operands (TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1),
- subtarget, &op0, &op1, EXPAND_NORMAL);
+ expand_operands (subexp0, subexp1, subtarget, &op0, &op1, EXPAND_NORMAL);
return REDUCE_BIT_FIELD (expand_mult (mode, op0, op1, target, unsignedp));
case TRUNC_DIV_EXPR:
diff --git a/gcc/final.c b/gcc/final.c
index 621bc28bcb1..551b3a0e8b0 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -4298,6 +4298,7 @@ rest_of_clean_state (void)
sdbout_types (NULL_TREE);
#endif
+ flag_rerun_cse_after_global_opts = 0;
reload_completed = 0;
epilogue_completed = 0;
#ifdef STACK_REGS
diff --git a/gcc/fixed-value.c b/gcc/fixed-value.c
index d0670e6f061..a13fd1340f4 100644
--- a/gcc/fixed-value.c
+++ b/gcc/fixed-value.c
@@ -1,5 +1,5 @@
/* Fixed-point arithmetic support.
- Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GCC.
@@ -784,7 +784,7 @@ bool
fixed_compare (int icode, const FIXED_VALUE_TYPE *op0,
const FIXED_VALUE_TYPE *op1)
{
- enum tree_code code = icode;
+ enum tree_code code = (enum tree_code) icode;
gcc_assert (op0->mode == op1->mode);
switch (code)
diff --git a/gcc/flags.h b/gcc/flags.h
index e606f601f6e..42158de0015 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -111,11 +111,6 @@ extern int optimize;
extern int optimize_size;
-/* Do print extra warnings (such as for uninitialized variables).
- -W/-Wextra. */
-
-extern bool extra_warnings;
-
/* Used to set the level of -Wstrict-aliasing, when no level is specified.
The external way to set the default level is to use
-Wstrict-aliasing=level.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 2b8f7333182..fb590492fb4 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10102,7 +10102,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
}
}
- if (flag_unsafe_math_optimizations
+ if (flag_unsafe_math_optimizations
&& (TREE_CODE (arg0) == RDIV_EXPR || TREE_CODE (arg0) == MULT_EXPR)
&& (TREE_CODE (arg1) == RDIV_EXPR || TREE_CODE (arg1) == MULT_EXPR)
&& (tem = distribute_real_division (code, type, arg0, arg1)))
@@ -10542,7 +10542,8 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
}
}
- if (flag_unsafe_math_optimizations
+ if (FLOAT_TYPE_P (type)
+ && flag_unsafe_math_optimizations
&& (TREE_CODE (arg0) == RDIV_EXPR || TREE_CODE (arg0) == MULT_EXPR)
&& (TREE_CODE (arg1) == RDIV_EXPR || TREE_CODE (arg1) == MULT_EXPR)
&& (tem = distribute_real_division (code, type, arg0, arg1)))
@@ -10646,13 +10647,18 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
&& real_zerop (arg1))
return omit_one_operand (type, arg1, arg0);
- /* In IEEE floating point, x*1 is not equivalent to x for snans. */
+ /* In IEEE floating point, x*1 is not equivalent to x for snans.
+ Likewise for complex arithmetic with signed zeros. */
if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
+ && (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
+ || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0)))
&& real_onep (arg1))
return non_lvalue (fold_convert (type, arg0));
/* Transform x * -1.0 into -x. */
if (!HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg0)))
+ && (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg0)))
+ || !COMPLEX_FLOAT_TYPE_P (TREE_TYPE (arg0)))
&& real_minus_onep (arg1))
return fold_convert (type, negate_expr (arg0));
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index daafc06d079..83ad8cdbe5b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,148 @@
+2009-05-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39876
+ * intrinsic.c (gfc_is_intrinsic): Do not add the EXTERNAL attribute if
+ the symbol is a module procedure.
+
+2009-05-08 Tobias Burnus <burnus@net-b.de>
+
+ * invoke.texi: Add do/recursion to the -fcheck= summary.
+
+2009-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/38830
+ * gfortran.texi: Document that we don't support variable FORMAT
+ expressions.
+
+2009-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/39576
+ * error.c (error_print): Add missing break statement.
+
+2009-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/36382
+ * invoke.texi: Document that -fdollar-ok does not allow $ to be
+ used in IMPLICIT statement.
+
+2009-05-06 Janus Weil <janus@gcc.gnu.org>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/39630
+ * decl.c (match_procedure_interface): New function to match the
+ interface for a PROCEDURE statement.
+ (match_procedure_decl): Call match_procedure_interface.
+ (match_ppc_decl): New function to match the declaration of a
+ procedure pointer component.
+ (gfc_match_procedure): Call match_ppc_decl.
+ (match_binding_attributes): Add new argument 'ppc' and handle the
+ POINTER attribute for procedure pointer components.
+ (match_procedure_in_type,gfc_match_generic): Added new argument to
+ match_binding_attributes.
+ * dump-parse-tree.c (show_expr,show_components,show_code_node): Handle
+ procedure pointer components.
+ * expr.c (free_expr0,gfc_copy_expr,gfc_simplify_expr): Handle EXPR_PPC.
+ (gfc_check_pointer_assign): Handle procedure pointer components, but no
+ full checking yet.
+ (is_proc_ptr_comp): New function to determine if an expression is a
+ procedure pointer component.
+ * gfortran.h (expr_t): Add EXPR_PPC.
+ (symbol_attribute): Add new member 'proc_pointer_comp'.
+ (gfc_component): Add new member 'formal'.
+ (gfc_exec_op): Add EXEC_CALL_PPC.
+ (gfc_get_default_type): Changed first argument.
+ (is_proc_ptr_comp): Add prototype.
+ (gfc_match_varspec): Add new argument.
+ * interface.c (compare_actual_formal): Handle procedure pointer
+ components.
+ * match.c (gfc_match_pointer_assignment,match_typebound_call): Handle
+ procedure pointer components.
+ * module.c (mio_expr): Handle EXPR_PPC.
+ * parse.c (parse_derived): Handle procedure pointer components.
+ * primary.c (gfc_match_varspec): Add new argument 'ppc_arg' and handle
+ procedure pointer components.
+ (gfc_variable_attr): Handle procedure pointer components.
+ (gfc_match_rvalue): Added new argument to gfc_match_varspec and changed
+ first argument of gfc_get_default_type.
+ (match_variable): Added new argument to gfc_match_varspec.
+ * resolve.c (resolve_entries,set_type,resolve_fl_parameter): Changed
+ first argument of gfc_get_default_type.
+ (resolve_structure_cons,resolve_actual_arglist): Handle procedure
+ pointer components.
+ (resolve_ppc_call): New function to resolve a call to a procedure
+ pointer component (subroutine).
+ (resolve_expr_ppc): New function to resolve a call to a procedure
+ pointer component (function).
+ (gfc_resolve_expr): Handle EXPR_PPC.
+ (resolve_code): Handle EXEC_CALL_PPC.
+ (resolve_fl_derived): Copy the interface for a procedure pointer
+ component.
+ (resolve_symbol): Fix overlong line.
+ * st.c (gfc_free_statement): Handle EXEC_CALL_PPC.
+ * symbol.c (gfc_get_default_type): Changed first argument.
+ (gfc_set_default_type): Changed first argument of gfc_get_default_type.
+ (gfc_add_component): Initialize ts.type to BT_UNKNOWN.
+ * trans.h (gfc_conv_function_call): Renamed.
+ * trans.c (gfc_trans_code): Handle EXEC_CALL_PPC.
+ * trans-expr.c (gfc_conv_component_ref): Ditto.
+ (gfc_conv_function_val): Rename to 'conv_function_val', add new
+ argument 'expr' and handle procedure pointer components.
+ (gfc_conv_operator_assign): Renamed gfc_conv_function_val.
+ (gfc_apply_interface_mapping_to_expr): Handle EXPR_PPC.
+ (gfc_conv_function_call): Rename to 'gfc_conv_procedure_call', add new
+ argument 'expr' and handle procedure pointer components.
+ (gfc_get_proc_ptr_comp): New function to get the backend decl for a
+ procedure pointer component.
+ (gfc_conv_function_expr): Renamed gfc_conv_function_call.
+ (gfc_conv_structure): Handle procedure pointer components.
+ * trans-intrinsic.c (gfc_conv_intrinsic_funcall,
+ conv_generic_with_optional_char_arg): Renamed gfc_conv_function_call.
+ * trans-stmt.h (gfc_get_proc_ptr_comp): Add prototype.
+ * trans-stmt.c (gfc_trans_call): Renamed gfc_conv_function_call.
+ * trans-types.h (gfc_get_ppc_type): Add prototype.
+ * trans-types.c (gfc_get_ppc_type): New function to build a tree node
+ for a procedure pointer component.
+ (gfc_get_derived_type): Handle procedure pointer components.
+
+2009-05-06 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40041
+ * resolve.c (resolve_symbol): Print no warning for implicitly
+ typed intrinsic functions.
+
+2009-05-05 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39998
+ * expr.c (gfc_check_pointer_assign): Check for statement functions and
+ internal procedures in procedure pointer assignments.
+
+2009-04-28 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39946
+ * resolve.c (resolve_symbol): Correctly copy the interface of a
+ PROCEDURE statement if the interface involves a RESULT variable.
+
+2009-04-28 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39930
+ PR fortran/39931
+ * expr.c (gfc_check_pointer_assign): Correctly detect if the left hand
+ side is a pointer.
+ * parse.c (gfc_fixup_sibling_symbols): Don't check for ambiguity.
+
+2009-04-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/39879
+ * trans_expr.c (gfc_conv_procedure_call): Deep copy a derived
+ type parentheses argument if it is a variable with allocatable
+ components.
+
+2009-04-27 Ian Lance Taylor <iant@google.com>
+
+ * trans-intrinsic.c (DEFINE_MATH_BUILTIN): Add casts to enum
+ type.
+ * trans-io.c (st_parameter_field): Add casts to enum type.
+
2009-04-26 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/39893
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index eaa310cf066..f3ff0e68380 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -4145,17 +4145,14 @@ add_hidden_procptr_result (gfc_symbol *sym)
}
-/* Match a PROCEDURE declaration (R1211). */
+/* Match the interface for a PROCEDURE declaration,
+ including brackets (R1212). */
static match
-match_procedure_decl (void)
+match_procedure_interface (gfc_symbol **proc_if)
{
match m;
locus old_loc, entry_loc;
- gfc_symbol *sym, *proc_if = NULL;
- int num;
- gfc_expr *initializer = NULL;
-
old_loc = entry_loc = gfc_current_locus;
gfc_clear_ts (&current_ts);
@@ -4180,45 +4177,43 @@ match_procedure_decl (void)
/* Get the name of the procedure or abstract interface
to inherit the interface from. */
- m = gfc_match_symbol (&proc_if, 1);
-
- if (m == MATCH_NO)
- goto syntax;
- else if (m == MATCH_ERROR)
+ m = gfc_match_symbol (proc_if, 1);
+ if (m != MATCH_YES)
return m;
/* Various interface checks. */
- if (proc_if)
+ if (*proc_if)
{
- proc_if->refs++;
+ (*proc_if)->refs++;
/* Resolve interface if possible. That way, attr.procedure is only set
if it is declared by a later procedure-declaration-stmt, which is
invalid per C1212. */
- while (proc_if->ts.interface)
- proc_if = proc_if->ts.interface;
+ while ((*proc_if)->ts.interface)
+ *proc_if = (*proc_if)->ts.interface;
- if (proc_if->generic)
+ if ((*proc_if)->generic)
{
- gfc_error ("Interface '%s' at %C may not be generic", proc_if->name);
+ gfc_error ("Interface '%s' at %C may not be generic",
+ (*proc_if)->name);
return MATCH_ERROR;
}
- if (proc_if->attr.proc == PROC_ST_FUNCTION)
+ if ((*proc_if)->attr.proc == PROC_ST_FUNCTION)
{
gfc_error ("Interface '%s' at %C may not be a statement function",
- proc_if->name);
+ (*proc_if)->name);
return MATCH_ERROR;
}
/* Handle intrinsic procedures. */
- if (!(proc_if->attr.external || proc_if->attr.use_assoc
- || proc_if->attr.if_source == IFSRC_IFBODY)
- && (gfc_is_intrinsic (proc_if, 0, gfc_current_locus)
- || gfc_is_intrinsic (proc_if, 1, gfc_current_locus)))
- proc_if->attr.intrinsic = 1;
- if (proc_if->attr.intrinsic
- && !gfc_intrinsic_actual_ok (proc_if->name, 0))
+ if (!((*proc_if)->attr.external || (*proc_if)->attr.use_assoc
+ || (*proc_if)->attr.if_source == IFSRC_IFBODY)
+ && (gfc_is_intrinsic ((*proc_if), 0, gfc_current_locus)
+ || gfc_is_intrinsic ((*proc_if), 1, gfc_current_locus)))
+ (*proc_if)->attr.intrinsic = 1;
+ if ((*proc_if)->attr.intrinsic
+ && !gfc_intrinsic_actual_ok ((*proc_if)->name, 0))
{
gfc_error ("Intrinsic procedure '%s' not allowed "
- "in PROCEDURE statement at %C", proc_if->name);
+ "in PROCEDURE statement at %C", (*proc_if)->name);
return MATCH_ERROR;
}
}
@@ -4230,7 +4225,26 @@ got_ts:
return MATCH_NO;
}
- /* Parse attributes. */
+ return MATCH_YES;
+}
+
+
+/* Match a PROCEDURE declaration (R1211). */
+
+static match
+match_procedure_decl (void)
+{
+ match m;
+ gfc_symbol *sym, *proc_if = NULL;
+ int num;
+ gfc_expr *initializer = NULL;
+
+ /* Parse interface (with brackets). */
+ m = match_procedure_interface (&proc_if);
+ if (m != MATCH_YES)
+ return m;
+
+ /* Parse attributes (with colons). */
m = match_attr_spec();
if (m == MATCH_ERROR)
return MATCH_ERROR;
@@ -4360,6 +4374,138 @@ cleanup:
}
+static match
+match_binding_attributes (gfc_typebound_proc* ba, bool generic, bool ppc);
+
+
+/* Match a procedure pointer component declaration (R445). */
+
+static match
+match_ppc_decl (void)
+{
+ match m;
+ gfc_symbol *proc_if = NULL;
+ gfc_typespec ts;
+ int num;
+ gfc_component *c;
+ gfc_expr *initializer = NULL;
+ gfc_typebound_proc* tb;
+ char name[GFC_MAX_SYMBOL_LEN + 1];
+
+ /* Parse interface (with brackets). */
+ m = match_procedure_interface (&proc_if);
+ if (m != MATCH_YES)
+ goto syntax;
+
+ /* Parse attributes. */
+ tb = XCNEW (gfc_typebound_proc);
+ tb->where = gfc_current_locus;
+ m = match_binding_attributes (tb, false, true);
+ if (m == MATCH_ERROR)
+ return m;
+
+ /* TODO: Implement PASS. */
+ if (!tb->nopass)
+ {
+ gfc_error ("Procedure Pointer Component with PASS at %C "
+ "not yet implemented");
+ return MATCH_ERROR;
+ }
+
+ gfc_clear_attr (&current_attr);
+ current_attr.procedure = 1;
+ current_attr.proc_pointer = 1;
+ current_attr.access = tb->access;
+ current_attr.flavor = FL_PROCEDURE;
+
+ /* Match the colons (required). */
+ if (gfc_match (" ::") != MATCH_YES)
+ {
+ gfc_error ("Expected '::' after binding-attributes at %C");
+ return MATCH_ERROR;
+ }
+
+ /* Check for C450. */
+ if (!tb->nopass && proc_if == NULL)
+ {
+ gfc_error("NOPASS or explicit interface required at %C");
+ return MATCH_ERROR;
+ }
+
+ /* Match PPC names. */
+ ts = current_ts;
+ for(num=1;;num++)
+ {
+ m = gfc_match_name (name);
+ if (m == MATCH_NO)
+ goto syntax;
+ else if (m == MATCH_ERROR)
+ return m;
+
+ if (gfc_add_component (gfc_current_block (), name, &c) == FAILURE)
+ return MATCH_ERROR;
+
+ /* Add current_attr to the symbol attributes. */
+ if (gfc_copy_attr (&c->attr, &current_attr, NULL) == FAILURE)
+ return MATCH_ERROR;
+
+ if (gfc_add_external (&c->attr, NULL) == FAILURE)
+ return MATCH_ERROR;
+
+ if (gfc_add_proc (&c->attr, name, NULL) == FAILURE)
+ return MATCH_ERROR;
+
+ /* Set interface. */
+ if (proc_if != NULL)
+ {
+ c->ts.interface = proc_if;
+ c->attr.untyped = 1;
+ c->attr.if_source = IFSRC_IFBODY;
+ }
+ else if (ts.type != BT_UNKNOWN)
+ {
+ c->ts = ts;
+ c->ts.interface = gfc_new_symbol ("", gfc_current_ns);
+ c->ts.interface->ts = ts;
+ c->ts.interface->attr.function = 1;
+ c->attr.function = c->ts.interface->attr.function;
+ c->attr.if_source = IFSRC_UNKNOWN;
+ }
+
+ if (gfc_match (" =>") == MATCH_YES)
+ {
+ m = gfc_match_null (&initializer);
+ if (m == MATCH_NO)
+ {
+ gfc_error ("Pointer initialization requires a NULL() at %C");
+ m = MATCH_ERROR;
+ }
+ if (gfc_pure (NULL))
+ {
+ gfc_error ("Initialization of pointer at %C is not allowed in "
+ "a PURE procedure");
+ m = MATCH_ERROR;
+ }
+ if (m != MATCH_YES)
+ {
+ gfc_free_expr (initializer);
+ return m;
+ }
+ c->initializer = initializer;
+ }
+
+ if (gfc_match_eos () == MATCH_YES)
+ return MATCH_YES;
+ if (gfc_match_char (',') != MATCH_YES)
+ goto syntax;
+ }
+
+syntax:
+ gfc_error ("Syntax error in procedure pointer component at %C");
+ return MATCH_ERROR;
+}
+
+
/* Match a PROCEDURE declaration inside an interface (R1206). */
static match
@@ -4425,9 +4571,8 @@ gfc_match_procedure (void)
m = match_procedure_in_interface ();
break;
case COMP_DERIVED:
- gfc_error ("Fortran 2003: Procedure components at %C are not yet"
- " implemented in gfortran");
- return MATCH_ERROR;
+ m = match_ppc_decl ();
+ break;
case COMP_DERIVED_CONTAINS:
m = match_procedure_in_type ();
break;
@@ -6830,9 +6975,10 @@ cleanup:
/* Match binding attributes. */
static match
-match_binding_attributes (gfc_typebound_proc* ba, bool generic)
+match_binding_attributes (gfc_typebound_proc* ba, bool generic, bool ppc)
{
bool found_passing = false;
+ bool seen_ptr = false;
match m;
/* Intialize to defaults. Do so even before the MATCH_NO check so that in
@@ -6907,38 +7053,6 @@ match_binding_attributes (gfc_typebound_proc* ba, bool generic)
continue;
}
- /* NON_OVERRIDABLE flag. */
- m = gfc_match (" non_overridable");
- if (m == MATCH_ERROR)
- goto error;
- if (m == MATCH_YES)
- {
- if (ba->non_overridable)
- {
- gfc_error ("Duplicate NON_OVERRIDABLE at %C");
- goto error;
- }
-
- ba->non_overridable = 1;
- continue;
- }
-
- /* DEFERRED flag. */
- m = gfc_match (" deferred");
- if (m == MATCH_ERROR)
- goto error;
- if (m == MATCH_YES)
- {
- if (ba->deferred)
- {
- gfc_error ("Duplicate DEFERRED at %C");
- goto error;
- }
-
- ba->deferred = 1;
- continue;
- }
-
/* PASS possibly including argument. */
m = gfc_match (" pass");
if (m == MATCH_ERROR)
@@ -6966,6 +7080,60 @@ match_binding_attributes (gfc_typebound_proc* ba, bool generic)
continue;
}
+ if (ppc)
+ {
+ /* POINTER flag. */
+ m = gfc_match (" pointer");
+ if (m == MATCH_ERROR)
+ goto error;
+ if (m == MATCH_YES)
+ {
+ if (seen_ptr)
+ {
+ gfc_error ("Duplicate POINTER attribute at %C");
+ goto error;
+ }
+
+ seen_ptr = true;
+ /*ba->ppc = 1;*/
+ continue;
+ }
+ }
+ else
+ {
+ /* NON_OVERRIDABLE flag. */
+ m = gfc_match (" non_overridable");
+ if (m == MATCH_ERROR)
+ goto error;
+ if (m == MATCH_YES)
+ {
+ if (ba->non_overridable)
+ {
+ gfc_error ("Duplicate NON_OVERRIDABLE at %C");
+ goto error;
+ }
+
+ ba->non_overridable = 1;
+ continue;
+ }
+
+ /* DEFERRED flag. */
+ m = gfc_match (" deferred");
+ if (m == MATCH_ERROR)
+ goto error;
+ if (m == MATCH_YES)
+ {
+ if (ba->deferred)
+ {
+ gfc_error ("Duplicate DEFERRED at %C");
+ goto error;
+ }
+
+ ba->deferred = 1;
+ continue;
+ }
+ }
+
}
/* Nothing matching found. */
@@ -6987,6 +7155,13 @@ match_binding_attributes (gfc_typebound_proc* ba, bool generic)
if (ba->access == ACCESS_UNKNOWN)
ba->access = gfc_typebound_default_access;
+ if (ppc && !seen_ptr)
+ {
+ gfc_error ("POINTER attribute is required for procedure pointer component"
+ " at %C");
+ goto error;
+ }
+
return MATCH_YES;
error:
@@ -7043,7 +7218,7 @@ match_procedure_in_type (void)
tb->is_generic = 0;
/* Match binding attributes. */
- m = match_binding_attributes (tb, false);
+ m = match_binding_attributes (tb, false, false);
if (m == MATCH_ERROR)
return m;
seen_attrs = (m == MATCH_YES);
@@ -7192,7 +7367,7 @@ gfc_match_generic (void)
gcc_assert (block && ns);
/* See if we get an access-specifier. */
- m = match_binding_attributes (&tbattr, true);
+ m = match_binding_attributes (&tbattr, true, false);
if (m == MATCH_ERROR)
goto error;
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index 6c915084db9..e007a54aea0 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -541,13 +541,20 @@ show_expr (gfc_expr *p)
case EXPR_FUNCTION:
if (p->value.function.name == NULL)
{
- fprintf (dumpfile, "%s[", p->symtree->n.sym->name);
+ fprintf (dumpfile, "%s", p->symtree->n.sym->name);
+ if (is_proc_ptr_comp (p, NULL))
+ show_ref (p->ref);
+ fputc ('[', dumpfile);
show_actual_arglist (p->value.function.actual);
fputc (']', dumpfile);
}
else
{
- fprintf (dumpfile, "%s[[", p->value.function.name);
+ fprintf (dumpfile, "%s", p->value.function.name);
+ if (is_proc_ptr_comp (p, NULL))
+ show_ref (p->ref);
+ fputc ('[', dumpfile);
+ fputc ('[', dumpfile);
show_actual_arglist (p->value.function.actual);
fputc (']', dumpfile);
fputc (']', dumpfile);
@@ -653,6 +660,8 @@ show_components (gfc_symbol *sym)
show_typespec (&c->ts);
if (c->attr.pointer)
fputs (" POINTER", dumpfile);
+ if (c->attr.proc_pointer)
+ fputs (" PPC", dumpfile);
if (c->attr.dimension)
fputs (" DIMENSION", dumpfile);
fputc (' ', dumpfile);
@@ -1212,6 +1221,12 @@ show_code_node (int level, gfc_code *c)
show_compcall (c->expr);
break;
+ case EXEC_CALL_PPC:
+ fputs ("CALL ", dumpfile);
+ show_expr (c->expr);
+ show_actual_arglist (c->ext.actual);
+ break;
+
case EXEC_RETURN:
fputs ("RETURN ", dumpfile);
if (c->expr)
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 29efbd1fee0..7cb23dd70e6 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -533,6 +533,7 @@ error_print (const char *type, const char *format0, va_list argp)
case 'u':
arg[pos].type = TYPE_UINTEGER;
+ break;
case 'l':
c = *format++;
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index c70d4d1e7a1..feaa6254840 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -182,6 +182,7 @@ free_expr0 (gfc_expr *e)
break;
case EXPR_COMPCALL:
+ case EXPR_PPC:
gfc_free_actual_arglist (e->value.compcall.actual);
break;
@@ -507,6 +508,7 @@ gfc_copy_expr (gfc_expr *p)
break;
case EXPR_COMPCALL:
+ case EXPR_PPC:
q->value.compcall.actual =
gfc_copy_actual_arglist (p->value.compcall.actual);
q->value.compcall.tbp = p->value.compcall.tbp;
@@ -1728,6 +1730,7 @@ gfc_simplify_expr (gfc_expr *p, int type)
break;
case EXPR_COMPCALL:
+ case EXPR_PPC:
gcc_unreachable ();
break;
}
@@ -3038,7 +3041,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
symbol_attribute attr;
gfc_ref *ref;
int is_pure;
- int pointer, check_intent_in;
+ int pointer, check_intent_in, proc_pointer;
if (lvalue->symtree->n.sym->ts.type == BT_UNKNOWN
&& !lvalue->symtree->n.sym->attr.proc_pointer)
@@ -3062,16 +3065,19 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
/* Check INTENT(IN), unless the object itself is the component or
sub-component of a pointer. */
check_intent_in = 1;
- pointer = lvalue->symtree->n.sym->attr.pointer
- | lvalue->symtree->n.sym->attr.proc_pointer;
+ pointer = lvalue->symtree->n.sym->attr.pointer;
+ proc_pointer = lvalue->symtree->n.sym->attr.proc_pointer;
for (ref = lvalue->ref; ref; ref = ref->next)
{
if (pointer)
check_intent_in = 0;
- if (ref->type == REF_COMPONENT && ref->u.c.component->attr.pointer)
- pointer = 1;
+ if (ref->type == REF_COMPONENT)
+ {
+ pointer = ref->u.c.component->attr.pointer;
+ proc_pointer = ref->u.c.component->attr.proc_pointer;
+ }
if (ref->type == REF_ARRAY && ref->next == NULL)
{
@@ -3107,7 +3113,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
return FAILURE;
}
- if (!pointer)
+ if (!pointer && !proc_pointer)
{
gfc_error ("Pointer assignment to non-POINTER at %L", &lvalue->where);
return FAILURE;
@@ -3129,11 +3135,12 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
return SUCCESS;
/* Checks on rvalue for procedure pointer assignments. */
- if (lvalue->symtree->n.sym->attr.proc_pointer)
+ if (proc_pointer)
{
attr = gfc_expr_attr (rvalue);
if (!((rvalue->expr_type == EXPR_NULL)
|| (rvalue->expr_type == EXPR_FUNCTION && attr.proc_pointer)
+ || (rvalue->expr_type == EXPR_VARIABLE && attr.proc_pointer)
|| (rvalue->expr_type == EXPR_VARIABLE
&& attr.flavor == FL_PROCEDURE)))
{
@@ -3148,6 +3155,25 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
rvalue->symtree->name, &rvalue->where);
return FAILURE;
}
+ /* Check for C727. */
+ if (attr.flavor == FL_PROCEDURE)
+ {
+ if (attr.proc == PROC_ST_FUNCTION)
+ {
+ gfc_error ("Statement function '%s' is invalid "
+ "in procedure pointer assignment at %L",
+ rvalue->symtree->name, &rvalue->where);
+ return FAILURE;
+ }
+ if (attr.proc == PROC_INTERNAL &&
+ gfc_notify_std (GFC_STD_F2008, "Internal procedure '%s' is "
+ "invalid in procedure pointer assignment at %L",
+ rvalue->symtree->name, &rvalue->where) == FAILURE)
+ return FAILURE;
+ }
+ /* TODO: Enable interface check for PPCs. */
+ if (is_proc_ptr_comp (rvalue, NULL))
+ return SUCCESS;
if (rvalue->expr_type == EXPR_VARIABLE
&& !gfc_compare_interfaces (lvalue->symtree->n.sym,
rvalue->symtree->n.sym, 0))
@@ -3481,6 +3507,34 @@ gfc_expr_set_symbols_referenced (gfc_expr *expr)
}
+/* Determine if an expression is a procedure pointer component. If yes, the
+ argument 'comp' will point to the component (provided that 'comp' was
+ provided). */
+
+bool
+is_proc_ptr_comp (gfc_expr *expr, gfc_component **comp)
+{
+ gfc_ref *ref;
+ bool ppc = false;
+
+ if (!expr || !expr->ref)
+ return false;
+
+ ref = expr->ref;
+ while (ref->next)
+ ref = ref->next;
+
+ if (ref->type == REF_COMPONENT)
+ {
+ ppc = ref->u.c.component->attr.proc_pointer;
+ if (ppc && comp)
+ *comp = ref->u.c.component;
+ }
+
+ return ppc;
+}
+
+
/* Walk an expression tree and check each variable encountered for being typed.
If strict is not set, a top-level variable is tolerated untyped in -std=gnu
mode as is a basic arithmetic expression using those; this is for things in
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index c4049545ec9..afd3edbf292 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -151,7 +151,7 @@ bt;
/* Expression node types. */
typedef enum
{ EXPR_OP = 1, EXPR_FUNCTION, EXPR_CONSTANT, EXPR_VARIABLE,
- EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL, EXPR_COMPCALL
+ EXPR_SUBSTRING, EXPR_STRUCTURE, EXPR_ARRAY, EXPR_NULL, EXPR_COMPCALL, EXPR_PPC
}
expr_t;
@@ -698,9 +698,11 @@ typedef struct
unsigned cray_pointer:1, cray_pointee:1;
/* The symbol is a derived type with allocatable components, pointer
- components or private components, possibly nested. zero_comp
- is true if the derived type has no component at all. */
- unsigned alloc_comp:1, pointer_comp:1, private_comp:1, zero_comp:1;
+ components or private components, procedure pointer components,
+ possibly nested. zero_comp is true if the derived type has no
+ component at all. */
+ unsigned alloc_comp:1, pointer_comp:1, proc_pointer_comp:1,
+ private_comp:1, zero_comp:1;
/* The namespace where the VOLATILE attribute has been set. */
struct gfc_namespace *volatile_ns;
@@ -851,6 +853,8 @@ typedef struct gfc_component
locus loc;
struct gfc_expr *initializer;
struct gfc_component *next;
+
+ struct gfc_formal_arglist *formal;
}
gfc_component;
@@ -1883,7 +1887,7 @@ typedef enum
EXEC_GOTO, EXEC_CALL, EXEC_COMPCALL, EXEC_ASSIGN_CALL, EXEC_RETURN,
EXEC_ENTRY, EXEC_PAUSE, EXEC_STOP, EXEC_CONTINUE, EXEC_INIT_ASSIGN,
EXEC_IF, EXEC_ARITHMETIC_IF, EXEC_DO, EXEC_DO_WHILE, EXEC_SELECT,
- EXEC_FORALL, EXEC_WHERE, EXEC_CYCLE, EXEC_EXIT,
+ EXEC_FORALL, EXEC_WHERE, EXEC_CYCLE, EXEC_EXIT, EXEC_CALL_PPC,
EXEC_ALLOCATE, EXEC_DEALLOCATE,
EXEC_OPEN, EXEC_CLOSE, EXEC_WAIT,
EXEC_READ, EXEC_WRITE, EXEC_IOLENGTH, EXEC_TRANSFER, EXEC_DT_END,
@@ -2265,7 +2269,7 @@ void gfc_set_implicit_none (void);
void gfc_check_function_type (gfc_namespace *);
bool gfc_is_intrinsic_typename (const char *);
-gfc_typespec *gfc_get_default_type (gfc_symbol *, gfc_namespace *);
+gfc_typespec *gfc_get_default_type (const char *, gfc_namespace *);
gfc_try gfc_set_default_type (gfc_symbol *, int, gfc_namespace *);
void gfc_set_sym_referenced (gfc_symbol *);
@@ -2484,6 +2488,8 @@ void gfc_expr_set_symbols_referenced (gfc_expr *);
gfc_try gfc_expr_check_typed (gfc_expr*, gfc_namespace*, bool);
void gfc_expr_replace_symbols (gfc_expr *, gfc_symbol *);
+bool is_proc_ptr_comp (gfc_expr *, gfc_component **);
+
/* st.c */
extern gfc_code new_st;
@@ -2592,7 +2598,7 @@ void gfc_free_use_stmts (gfc_use_list *);
symbol_attribute gfc_variable_attr (gfc_expr *, gfc_typespec *);
symbol_attribute gfc_expr_attr (gfc_expr *);
match gfc_match_rvalue (gfc_expr **);
-match gfc_match_varspec (gfc_expr*, int, bool);
+match gfc_match_varspec (gfc_expr*, int, bool, bool);
int gfc_check_digit (char, int);
/* trans.c */
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index af1d2961085..b7c8b82537c 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1641,7 +1641,7 @@ code that uses them running with the GNU Fortran compiler.
* STRUCTURE and RECORD::
@c * UNION and MAP::
* ENCODE and DECODE statements::
-@c * Expressions in FORMAT statements::
+* Variable FORMAT expressions::
@c * Q edit descriptor::
@c * AUTOMATIC statement::
@c * TYPE and ACCEPT I/O Statements::
@@ -1779,6 +1779,51 @@ c ... Code that sets A, B and C
@end smallexample
+@node Variable FORMAT expressions
+@subsection Variable @code{FORMAT} expressions
+@cindex @code{FORMAT}
+
+A variable @code{FORMAT} expression is format statement which includes
+angle brackets enclosing a Fortran expression: @code{FORMAT(I<N>)}. GNU
+Fortran does not support this legacy extension. The effect of variable
+format expressions can be reproduced by using the more powerful (and
+standard) combination of internal output and string formats. For example,
+replace a code fragment like this:
+
+@smallexample
+ WRITE(6,20) INT1
+ 20 FORMAT(I<N+1>)
+@end smallexample
+
+@noindent
+with the following:
+
+@smallexample
+c Variable declaration
+ CHARACTER(LEN=20) F
+c
+c Other code here...
+c
+ WRITE(FMT,'("(I", I0, ")")') N+1
+ WRITE(6,FM) INT1
+@end smallexample
+
+@noindent
+or with:
+
+@smallexample
+c Variable declaration
+ CHARACTER(LEN=20) FMT
+c
+c Other code here...
+c
+ WRITE(FMT,*) N+1
+ WRITE(6,"(I" // ADJUSTL(FMT) // ")") INT1
+@end smallexample
+
+
+
+
@c ---------------------------------------------------------------------
@c Intrinsic Procedures
@c ---------------------------------------------------------------------
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 489386c10a6..3c03f959fb2 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1864,7 +1864,8 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
/* Satisfy 12.4.1.3 by ensuring that a procedure pointer actual argument
is provided for a procedure pointer formal argument. */
if (f->sym->attr.proc_pointer
- && !a->expr->symtree->n.sym->attr.proc_pointer)
+ && !(a->expr->symtree->n.sym->attr.proc_pointer
+ || is_proc_ptr_comp (a->expr, NULL)))
{
if (where)
gfc_error ("Expected a procedure pointer for argument '%s' at %L",
@@ -1874,7 +1875,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
/* Satisfy 12.4.1.2 by ensuring that a procedure actual argument is
provided for a procedure formal argument. */
- if (a->expr->ts.type != BT_PROCEDURE
+ if (a->expr->ts.type != BT_PROCEDURE && !is_proc_ptr_comp (a->expr, NULL)
&& a->expr->expr_type == EXPR_VARIABLE
&& f->sym->attr.flavor == FL_PROCEDURE)
{
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index 7676fa221e5..ca125a36335 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -836,13 +836,17 @@ gfc_is_intrinsic (gfc_symbol* sym, int subroutine_flag, locus loc)
/* See if this intrinsic is allowed in the current standard. */
if (gfc_check_intrinsic_standard (isym, &symstd, false, loc) == FAILURE)
{
- if (gfc_option.warn_intrinsics_std)
- gfc_warning_now ("The intrinsic '%s' at %L is not included in the"
- " selected standard but %s and '%s' will be treated as"
- " if declared EXTERNAL. Use an appropriate -std=*"
- " option or define -fall-intrinsics to allow this"
- " intrinsic.", sym->name, &loc, symstd, sym->name);
- sym->attr.external = 1;
+ if (sym->attr.proc == PROC_UNKNOWN)
+ {
+ if (gfc_option.warn_intrinsics_std)
+ gfc_warning_now ("The intrinsic '%s' at %L is not included in the"
+ " selected standard but %s and '%s' will be"
+ " treated as if declared EXTERNAL. Use an"
+ " appropriate -std=* option or define"
+ " -fall-intrinsics to allow this intrinsic.",
+ sym->name, &loc, symstd, sym->name);
+ gfc_add_external (&sym->attr, &loc);
+ }
return false;
}
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 8c9bfced1a5..c471521bd1c 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -166,7 +166,7 @@ and warnings}.
@gccoptlist{-fno-automatic -ff2c -fno-underscoring @gol
-fwhole-file -fsecond-underscore @gol
-fbounds-check -fcheck-array-temporaries -fmax-array-constructor =@var{n} @gol
--fcheck=@var{<all|bounds|array-temps>}
+-fcheck=@var{<all|array-temps|bounds|do|recursion>}
-fmax-stack-var-size=@var{n} @gol
-fpack-derived -frepack-arrays -fshort-enums -fexternal-blas @gol
-fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol
@@ -259,6 +259,7 @@ the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless
Allow @samp{$} as a valid non-first character in a symbol name. Symbols
that start with @samp{$} are rejected since it is unclear which rules to
apply to implicit typing as different vendors implement different rules.
+Using @samp{$} in @code{IMPLICIT} statements is also rejected.
@item -fbackslash
@opindex @code{backslash}
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index a5c9f32199a..6faedec1ce8 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1336,7 +1336,8 @@ gfc_match_pointer_assignment (void)
goto cleanup;
}
- if (lvalue->symtree->n.sym->attr.proc_pointer)
+ if (lvalue->symtree->n.sym->attr.proc_pointer
+ || is_proc_ptr_comp (lvalue, NULL))
gfc_matching_procptr_assignment = 1;
m = gfc_match (" %e%t", &rvalue);
@@ -2629,7 +2630,7 @@ match_typebound_call (gfc_symtree* varst)
base->where = gfc_current_locus;
gfc_set_sym_referenced (varst->n.sym);
- m = gfc_match_varspec (base, 0, true);
+ m = gfc_match_varspec (base, 0, true, true);
if (m == MATCH_NO)
gfc_error ("Expected component reference at %C");
if (m != MATCH_YES)
@@ -2641,13 +2642,16 @@ match_typebound_call (gfc_symtree* varst)
return MATCH_ERROR;
}
- if (base->expr_type != EXPR_COMPCALL)
+ if (base->expr_type == EXPR_COMPCALL)
+ new_st.op = EXEC_COMPCALL;
+ else if (base->expr_type == EXPR_PPC)
+ new_st.op = EXEC_CALL_PPC;
+ else
{
- gfc_error ("Expected type-bound procedure reference at %C");
+ gfc_error ("Expected type-bound procedure or procedure pointer component "
+ "at %C");
return MATCH_ERROR;
}
-
- new_st.op = EXEC_COMPCALL;
new_st.expr = base;
return MATCH_YES;
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 86db7aa22c2..7f4dba5dcee 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -3043,6 +3043,7 @@ mio_expr (gfc_expr **ep)
break;
case EXPR_COMPCALL:
+ case EXPR_PPC:
gcc_unreachable ();
break;
}
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 81e4591b9be..59296b104fa 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -1878,15 +1878,11 @@ parse_derived (void)
unexpected_eof ();
case ST_DATA_DECL:
+ case ST_PROCEDURE:
accept_statement (st);
seen_component = 1;
break;
- case ST_PROCEDURE:
- gfc_error ("PROCEDURE binding at %C must be inside CONTAINS");
- error_flag = 1;
- break;
-
case ST_FINAL:
gfc_error ("FINAL declaration at %C must be inside CONTAINS");
error_flag = 1;
@@ -1993,6 +1989,12 @@ endType:
|| (c->ts.type == BT_DERIVED && c->ts.derived->attr.pointer_comp))
sym->attr.pointer_comp = 1;
+ /* Look for procedure pointer components. */
+ if (c->attr.proc_pointer
+ || (c->ts.type == BT_DERIVED
+ && c->ts.derived->attr.proc_pointer_comp))
+ sym->attr.proc_pointer_comp = 1;
+
/* Look for private components. */
if (sym->component_access == ACCESS_PRIVATE
|| c->attr.access == ACCESS_PRIVATE
@@ -3310,7 +3312,7 @@ gfc_fixup_sibling_symbols (gfc_symbol *sym, gfc_namespace *siblings)
sym->attr.referenced = 1;
for (ns = siblings; ns; ns = ns->sibling)
{
- gfc_find_sym_tree (sym->name, ns, 0, &st);
+ st = gfc_find_symtree (ns->sym_root, sym->name);
if (!st || (st->n.sym->attr.dummy && ns == st->n.sym->ns))
goto fixup_contained;
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 7e41535c266..96fbddce92a 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1708,10 +1708,13 @@ extend_ref (gfc_expr *primary, gfc_ref *tail)
variable like member references or substrings. If equiv_flag is
set we only match stuff that is allowed inside an EQUIVALENCE
statement. sub_flag tells whether we expect a type-bound procedure found
- to be a subroutine as part of CALL or a FUNCTION. */
+ to be a subroutine as part of CALL or a FUNCTION. For procedure pointer
+ components, 'ppc_arg' determines whether the PPC may be called (with an
+ argument list), or whether it may just be referred to as a pointer. */
match
-gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
+gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
+ bool ppc_arg)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
gfc_ref *substring, *tail;
@@ -1754,7 +1757,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
return MATCH_YES;
if (sym->ts.type == BT_UNKNOWN && gfc_peek_ascii_char () == '%'
- && gfc_get_default_type (sym, sym->ns)->type == BT_DERIVED)
+ && gfc_get_default_type (sym->name, sym->ns)->type == BT_DERIVED)
gfc_set_default_type (sym, 0, sym->ns);
if (sym->ts.type != BT_DERIVED || gfc_match_char ('%') != MATCH_YES)
@@ -1826,6 +1829,20 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag)
primary->ts = component->ts;
+ if (component->attr.proc_pointer && ppc_arg
+ && !gfc_matching_procptr_assignment)
+ {
+ primary->expr_type = EXPR_PPC;
+ m = gfc_match_actual_arglist (component->attr.subroutine,
+ &primary->value.compcall.actual);
+ if (m == MATCH_ERROR)
+ return MATCH_ERROR;
+ if (m == MATCH_NO)
+ primary->value.compcall.actual = NULL;
+
+ break;
+ }
+
if (component->as != NULL)
{
tail = extend_ref (primary, tail);
@@ -1847,7 +1864,7 @@ check_substring:
unknown = false;
if (primary->ts.type == BT_UNKNOWN)
{
- if (gfc_get_default_type (sym, sym->ns)->type == BT_CHARACTER)
+ if (gfc_get_default_type (sym->name, sym->ns)->type == BT_CHARACTER)
{
gfc_set_default_type (sym, 0, sym->ns);
primary->ts = sym->ts;
@@ -1925,7 +1942,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
allocatable = attr.allocatable;
target = attr.target;
- if (pointer)
+ if (pointer || attr.proc_pointer)
target = 1;
if (ts != NULL && expr->ts.type == BT_UNKNOWN)
@@ -1971,7 +1988,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
pointer = ref->u.c.component->attr.pointer;
allocatable = ref->u.c.component->attr.allocatable;
- if (pointer)
+ if (pointer || attr.proc_pointer)
target = 1;
break;
@@ -2478,7 +2495,7 @@ gfc_match_rvalue (gfc_expr **result)
e->expr_type = EXPR_VARIABLE;
e->symtree = symtree;
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
break;
case FL_PARAMETER:
@@ -2495,7 +2512,7 @@ gfc_match_rvalue (gfc_expr **result)
}
e->symtree = symtree;
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
if (sym->ts.is_c_interop || sym->ts.is_iso_c)
break;
@@ -2551,7 +2568,7 @@ gfc_match_rvalue (gfc_expr **result)
e = gfc_get_expr ();
e->expr_type = EXPR_VARIABLE;
e->symtree = symtree;
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
break;
}
@@ -2578,7 +2595,7 @@ gfc_match_rvalue (gfc_expr **result)
e->symtree = symtree;
e->expr_type = EXPR_VARIABLE;
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
break;
}
@@ -2658,7 +2675,7 @@ gfc_match_rvalue (gfc_expr **result)
if (gfc_peek_ascii_char () == '%'
&& sym->ts.type == BT_UNKNOWN
- && gfc_get_default_type (sym, sym->ns)->type == BT_DERIVED)
+ && gfc_get_default_type (sym->name, sym->ns)->type == BT_DERIVED)
gfc_set_default_type (sym, 0, sym->ns);
/* If the symbol has a dimension attribute, the expression is a
@@ -2676,7 +2693,7 @@ gfc_match_rvalue (gfc_expr **result)
e = gfc_get_expr ();
e->symtree = symtree;
e->expr_type = EXPR_VARIABLE;
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
break;
}
@@ -2701,7 +2718,7 @@ gfc_match_rvalue (gfc_expr **result)
/*FIXME:??? gfc_match_varspec does set this for us: */
e->ts = sym->ts;
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
break;
}
@@ -2725,7 +2742,7 @@ gfc_match_rvalue (gfc_expr **result)
implicit_char = false;
if (sym->ts.type == BT_UNKNOWN)
{
- ts = gfc_get_default_type (sym,NULL);
+ ts = gfc_get_default_type (sym->name, NULL);
if (ts->type == BT_CHARACTER)
implicit_char = true;
}
@@ -2790,7 +2807,7 @@ gfc_match_rvalue (gfc_expr **result)
/* If our new function returns a character, array or structure
type, it might have subsequent references. */
- m = gfc_match_varspec (e, 0, false);
+ m = gfc_match_varspec (e, 0, false, true);
if (m == MATCH_NO)
m = MATCH_YES;
@@ -2963,7 +2980,7 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
if (gfc_peek_ascii_char () == '%'
&& sym->ts.type == BT_UNKNOWN
- && gfc_get_default_type (sym, implicit_ns)->type == BT_DERIVED)
+ && gfc_get_default_type (sym->name, implicit_ns)->type == BT_DERIVED)
gfc_set_default_type (sym, 0, implicit_ns);
}
@@ -2975,7 +2992,7 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
expr->where = where;
/* Now see if we have to do more. */
- m = gfc_match_varspec (expr, equiv_flag, false);
+ m = gfc_match_varspec (expr, equiv_flag, false, false);
if (m != MATCH_YES)
{
gfc_free_expr (expr);
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 75078699168..34cb365a562 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -528,14 +528,14 @@ resolve_entries (gfc_namespace *ns)
fas = fas ? fas : ns->entries->sym->result->as;
fts = &ns->entries->sym->result->ts;
if (fts->type == BT_UNKNOWN)
- fts = gfc_get_default_type (ns->entries->sym->result, NULL);
+ fts = gfc_get_default_type (ns->entries->sym->result->name, NULL);
for (el = ns->entries->next; el; el = el->next)
{
ts = &el->sym->result->ts;
as = el->sym->as;
as = as ? as : el->sym->result->as;
if (ts->type == BT_UNKNOWN)
- ts = gfc_get_default_type (el->sym->result, NULL);
+ ts = gfc_get_default_type (el->sym->result->name, NULL);
if (! gfc_compare_types (ts, fts)
|| (el->sym->result->attr.dimension
@@ -612,7 +612,7 @@ resolve_entries (gfc_namespace *ns)
{
ts = &sym->ts;
if (ts->type == BT_UNKNOWN)
- ts = gfc_get_default_type (sym, NULL);
+ ts = gfc_get_default_type (sym->name, NULL);
switch (ts->type)
{
case BT_INTEGER:
@@ -878,7 +878,8 @@ resolve_structure_cons (gfc_expr *expr)
}
if (cons->expr->expr_type == EXPR_NULL
- && !(comp->attr.pointer || comp->attr.allocatable))
+ && !(comp->attr.pointer || comp->attr.allocatable
+ || comp->attr.proc_pointer))
{
t = FAILURE;
gfc_error ("The NULL in the derived type constructor at %L is "
@@ -1215,6 +1216,7 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype,
gfc_symtree *parent_st;
gfc_expr *e;
int save_need_full_assumed_size;
+ gfc_component *comp;
for (; arg; arg = arg->next)
{
@@ -1234,6 +1236,13 @@ resolve_actual_arglist (gfc_actual_arglist *arg, procedure_type ptype,
continue;
}
+ if (is_proc_ptr_comp (e, &comp))
+ {
+ e->ts = comp->ts;
+ e->expr_type = EXPR_VARIABLE;
+ goto argument_list;
+ }
+
if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.generic
&& no_formal_args
@@ -1906,7 +1915,7 @@ set_type:
expr->ts = sym->ts;
else
{
- ts = gfc_get_default_type (sym, sym->ns);
+ ts = gfc_get_default_type (sym->name, sym->ns);
if (ts->type == BT_UNKNOWN)
{
@@ -4804,6 +4813,61 @@ resolve_compcall (gfc_expr* e)
}
+/* Resolve a CALL to a Procedure Pointer Component (Subroutine). */
+
+static gfc_try
+resolve_ppc_call (gfc_code* c)
+{
+ gfc_component *comp;
+ gcc_assert (is_proc_ptr_comp (c->expr, &comp));
+
+ c->resolved_sym = c->expr->symtree->n.sym;
+ c->expr->expr_type = EXPR_VARIABLE;
+ c->ext.actual = c->expr->value.compcall.actual;
+
+ if (!comp->attr.subroutine)
+ gfc_add_subroutine (&comp->attr, comp->name, &c->expr->where);
+
+ if (resolve_actual_arglist (c->ext.actual, comp->attr.proc,
+ comp->formal == NULL) == FAILURE)
+ return FAILURE;
+
+ /* TODO: Check actual arguments.
+ gfc_procedure_use (stree->n.sym, &c->expr->value.compcall.actual,
+ &c->expr->where);*/
+
+ return SUCCESS;
+}
+
+
+/* Resolve a Function Call to a Procedure Pointer Component (Function). */
+
+static gfc_try
+resolve_expr_ppc (gfc_expr* e)
+{
+ gfc_component *comp;
+ gcc_assert (is_proc_ptr_comp (e, &comp));
+
+ /* Convert to EXPR_FUNCTION. */
+ e->expr_type = EXPR_FUNCTION;
+ e->value.function.isym = NULL;
+ e->value.function.actual = e->value.compcall.actual;
+ e->ts = comp->ts;
+
+ if (!comp->attr.function)
+ gfc_add_function (&comp->attr, comp->name, &e->where);
+
+ if (resolve_actual_arglist (e->value.function.actual, comp->attr.proc,
+ comp->formal == NULL) == FAILURE)
+ return FAILURE;
+
+ /* TODO: Check actual arguments.
+ gfc_procedure_use (stree->n.sym, &e->value.compcall.actual, &e->where); */
+
+ return SUCCESS;
+}
+
+
/* Resolve an expression. That is, make sure that types of operands agree
with their operators, intrinsic operators are converted to function calls
for overloaded types and unresolved function references are resolved. */
@@ -4853,6 +4917,10 @@ gfc_resolve_expr (gfc_expr *e)
t = SUCCESS;
break;
+ case EXPR_PPC:
+ t = resolve_expr_ppc (e);
+ break;
+
case EXPR_ARRAY:
t = FAILURE;
if (resolve_ref (e) == FAILURE)
@@ -6819,7 +6887,7 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
}
t = SUCCESS;
- if (code->op != EXEC_COMPCALL)
+ if (code->op != EXEC_COMPCALL && code->op != EXEC_CALL_PPC)
t = gfc_resolve_expr (code->expr);
forall_flag = forall_save;
@@ -6931,6 +6999,10 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
resolve_typebound_call (code);
break;
+ case EXEC_CALL_PPC:
+ resolve_ppc_call (code);
+ break;
+
case EXEC_SELECT:
/* Select is complicated. Also, a SELECT construct could be
a transformed computed GOTO. */
@@ -8906,6 +8978,78 @@ resolve_fl_derived (gfc_symbol *sym)
for (c = sym->components; c != NULL; c = c->next)
{
+ if (c->attr.proc_pointer && c->ts.interface)
+ {
+ if (c->ts.interface->attr.procedure)
+ gfc_error ("Interface '%s', used by procedure pointer component "
+ "'%s' at %L, is declared in a later PROCEDURE statement",
+ c->ts.interface->name, c->name, &c->loc);
+
+ /* Get the attributes from the interface (now resolved). */
+ if (c->ts.interface->attr.if_source
+ || c->ts.interface->attr.intrinsic)
+ {
+ gfc_symbol *ifc = c->ts.interface;
+
+ if (ifc->attr.intrinsic)
+ resolve_intrinsic (ifc, &ifc->declared_at);
+
+ if (ifc->result)
+ c->ts = ifc->result->ts;
+ else
+ c->ts = ifc->ts;
+ c->ts.interface = ifc;
+ c->attr.function = ifc->attr.function;
+ c->attr.subroutine = ifc->attr.subroutine;
+ /* TODO: gfc_copy_formal_args (c, ifc); */
+
+ c->attr.allocatable = ifc->attr.allocatable;
+ c->attr.pointer = ifc->attr.pointer;
+ c->attr.pure = ifc->attr.pure;
+ c->attr.elemental = ifc->attr.elemental;
+ c->attr.dimension = ifc->attr.dimension;
+ c->attr.recursive = ifc->attr.recursive;
+ c->attr.always_explicit = ifc->attr.always_explicit;
+ /* Copy array spec. */
+ c->as = gfc_copy_array_spec (ifc->as);
+ /*if (c->as)
+ {
+ int i;
+ for (i = 0; i < c->as->rank; i++)
+ {
+ gfc_expr_replace_symbols (c->as->lower[i], c);
+ gfc_expr_replace_symbols (c->as->upper[i], c);
+ }
+ }*/
+ /* Copy char length. */
+ if (ifc->ts.cl)
+ {
+ c->ts.cl = gfc_get_charlen();
+ c->ts.cl->resolved = ifc->ts.cl->resolved;
+ c->ts.cl->length = gfc_copy_expr (ifc->ts.cl->length);
+ /*gfc_expr_replace_symbols (c->ts.cl->length, c);*/
+ /* Add charlen to namespace. */
+ /*if (c->formal_ns)
+ {
+ c->ts.cl->next = c->formal_ns->cl_list;
+ c->formal_ns->cl_list = c->ts.cl;
+ }*/
+ }
+ }
+ else if (c->ts.interface->name[0] != '\0')
+ {
+ gfc_error ("Interface '%s' of procedure pointer component "
+ "'%s' at %L must be explicit", c->ts.interface->name,
+ c->name, &c->loc);
+ return FAILURE;
+ }
+ }
+ else if (c->attr.proc_pointer && c->ts.type == BT_UNKNOWN)
+ {
+ c->ts = *gfc_get_default_type (c->name, NULL);
+ c->attr.implicit_type = 1;
+ }
+
/* Check type-spec if this is not the parent-type component. */
if ((!sym->attr.extension || c != sym->components)
&& resolve_typespec_used (&c->ts, &c->loc, c->name) == FAILURE)
@@ -9157,7 +9301,8 @@ resolve_fl_parameter (gfc_symbol *sym)
matches the implicit type, since PARAMETER statements can precede
IMPLICIT statements. */
if (sym->attr.implicit_type
- && !gfc_compare_types (&sym->ts, gfc_get_default_type (sym, sym->ns)))
+ && !gfc_compare_types (&sym->ts, gfc_get_default_type (sym->name,
+ sym->ns)))
{
gfc_error ("Implicitly typed PARAMETER '%s' at %L doesn't match a "
"later IMPLICIT type", sym->name, &sym->declared_at);
@@ -9237,14 +9382,18 @@ resolve_symbol (gfc_symbol *sym)
sym->name,&sym->declared_at);
/* Get the attributes from the interface (now resolved). */
- if (sym->ts.interface->attr.if_source || sym->ts.interface->attr.intrinsic)
+ if (sym->ts.interface->attr.if_source
+ || sym->ts.interface->attr.intrinsic)
{
gfc_symbol *ifc = sym->ts.interface;
if (ifc->attr.intrinsic)
resolve_intrinsic (ifc, &ifc->declared_at);
- sym->ts = ifc->ts;
+ if (ifc->result)
+ sym->ts = ifc->result->ts;
+ else
+ sym->ts = ifc->ts;
sym->ts.interface = ifc;
sym->attr.function = ifc->attr.function;
sym->attr.subroutine = ifc->attr.subroutine;
@@ -9317,13 +9466,14 @@ resolve_symbol (gfc_symbol *sym)
if ((isym = gfc_find_function (sym->name)))
{
- if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising)
+ if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising
+ && !sym->attr.implicit_type)
gfc_warning ("Type specified for intrinsic function '%s' at %L is"
" ignored", sym->name, &sym->declared_at);
}
else if ((isym = gfc_find_subroutine (sym->name)))
{
- if (sym->ts.type != BT_UNKNOWN)
+ if (sym->ts.type != BT_UNKNOWN && !sym->attr.implicit_type)
{
gfc_error ("Intrinsic subroutine '%s' at %L shall not have a type"
" specifier", sym->name, &sym->declared_at);
diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c
index 4f82050bcc0..d0cdb0e868c 100644
--- a/gcc/fortran/st.c
+++ b/gcc/fortran/st.c
@@ -110,6 +110,7 @@ gfc_free_statement (gfc_code *p)
break;
case EXEC_COMPCALL:
+ case EXEC_CALL_PPC:
case EXEC_CALL:
case EXEC_ASSIGN_CALL:
gfc_free_actual_arglist (p->ext.actual);
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index a82e67558fb..2160afa14c0 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -219,11 +219,11 @@ gfc_merge_new_implicit (gfc_typespec *ts)
/* Given a symbol, return a pointer to the typespec for its default type. */
gfc_typespec *
-gfc_get_default_type (gfc_symbol *sym, gfc_namespace *ns)
+gfc_get_default_type (const char *name, gfc_namespace *ns)
{
char letter;
- letter = sym->name[0];
+ letter = name[0];
if (gfc_option.flag_allow_leading_underscore && letter == '_')
gfc_internal_error ("Option -fallow-leading-underscore is for use only by "
@@ -231,7 +231,7 @@ gfc_get_default_type (gfc_symbol *sym, gfc_namespace *ns)
"implicitly typed variables");
if (letter < 'a' || letter > 'z')
- gfc_internal_error ("gfc_get_default_type(): Bad symbol '%s'",sym->name);
+ gfc_internal_error ("gfc_get_default_type(): Bad symbol '%s'", name);
if (ns == NULL)
ns = gfc_current_ns;
@@ -252,7 +252,7 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns)
if (sym->ts.type != BT_UNKNOWN)
gfc_internal_error ("gfc_set_default_type(): symbol already has a type");
- ts = gfc_get_default_type (sym, ns);
+ ts = gfc_get_default_type (sym->name, ns);
if (ts->type == BT_UNKNOWN)
{
@@ -1779,6 +1779,7 @@ gfc_add_component (gfc_symbol *sym, const char *name,
p->name = gfc_get_string (name);
p->loc = gfc_current_locus;
+ p->ts.type = BT_UNKNOWN;
*component = p;
return SUCCESS;
@@ -4494,3 +4495,4 @@ gfc_get_tbp_symtree (gfc_symtree **root, const char *name)
return result;
}
+
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 2b67c6ddcd3..280a1922a8b 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -476,7 +476,8 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
se->string_length = tmp;
}
- if (c->attr.pointer && c->attr.dimension == 0 && c->ts.type != BT_CHARACTER)
+ if ((c->attr.pointer || c->attr.proc_pointer) && c->attr.dimension == 0
+ && c->ts.type != BT_CHARACTER)
se->expr = build_fold_indirect_ref (se->expr);
}
@@ -1487,11 +1488,13 @@ gfc_build_compare_string (tree len1, tree str1, tree len2, tree str2, int kind)
}
static void
-gfc_conv_function_val (gfc_se * se, gfc_symbol * sym)
+conv_function_val (gfc_se * se, gfc_symbol * sym, gfc_expr * expr)
{
tree tmp;
- if (sym->attr.dummy)
+ if (is_proc_ptr_comp (expr, NULL))
+ tmp = gfc_get_proc_ptr_comp (se, expr);
+ else if (sym->attr.dummy)
{
tmp = gfc_get_symbol_decl (sym);
if (sym->attr.proc_pointer)
@@ -1527,7 +1530,7 @@ gfc_conv_function_val (gfc_se * se, gfc_symbol * sym)
/* Translate the call for an elemental subroutine call used in an operator
- assignment. This is a simplified version of gfc_conv_function_call. */
+ assignment. This is a simplified version of gfc_conv_procedure_call. */
tree
gfc_conv_operator_assign (gfc_se *lse, gfc_se *rse, gfc_symbol *sym)
@@ -1556,7 +1559,7 @@ gfc_conv_operator_assign (gfc_se *lse, gfc_se *rse, gfc_symbol *sym)
/* Build the function call. */
gfc_init_se (&se, NULL);
- gfc_conv_function_val (&se, sym);
+ conv_function_val (&se, sym, NULL);
tmp = TREE_TYPE (TREE_TYPE (TREE_TYPE (se.expr)));
tmp = build_call_list (tmp, se.expr, args);
gfc_add_expr_to_block (&block, tmp);
@@ -2133,6 +2136,7 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping,
break;
case EXPR_COMPCALL:
+ case EXPR_PPC:
gcc_unreachable ();
break;
}
@@ -2402,11 +2406,13 @@ conv_arglist_function (gfc_se *se, gfc_expr *expr, const char *name)
/* Generate code for a procedure call. Note can return se->post != NULL.
If se->direct_byref is set then se->expr contains the return parameter.
- Return nonzero, if the call has alternate specifiers. */
+ Return nonzero, if the call has alternate specifiers.
+ 'expr' is only needed for procedure pointer components. */
int
-gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
- gfc_actual_arglist * arg, tree append_args)
+gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
+ gfc_actual_arglist * arg, gfc_expr * expr,
+ tree append_args)
{
gfc_interface_mapping mapping;
tree arglist;
@@ -2496,16 +2502,20 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
gfc_add_block_to_block (&se->post, &cptrse.post);
gfc_init_se (&fptrse, NULL);
- if (sym->intmod_sym_id == ISOCBINDING_F_POINTER)
- fptrse.want_pointer = 1;
+ if (sym->intmod_sym_id == ISOCBINDING_F_POINTER
+ || is_proc_ptr_comp (arg->next->expr, NULL))
+ fptrse.want_pointer = 1;
gfc_conv_expr (&fptrse, arg->next->expr);
gfc_add_block_to_block (&se->pre, &fptrse.pre);
gfc_add_block_to_block (&se->post, &fptrse.post);
- tmp = arg->next->expr->symtree->n.sym->backend_decl;
- se->expr = fold_build2 (MODIFY_EXPR, TREE_TYPE (tmp), fptrse.expr,
- fold_convert (TREE_TYPE (tmp), cptrse.expr));
+ if (is_proc_ptr_comp (arg->next->expr, NULL))
+ tmp = gfc_get_ppc_type (arg->next->expr->ref->u.c.component);
+ else
+ tmp = TREE_TYPE (arg->next->expr->symtree->n.sym->backend_decl);
+ se->expr = fold_build2 (MODIFY_EXPR, tmp, fptrse.expr,
+ fold_convert (tmp, cptrse.expr));
return 0;
}
@@ -2782,7 +2792,18 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
break;
}
+ if (e->expr_type == EXPR_OP
+ && e->value.op.op == INTRINSIC_PARENTHESES
+ && e->value.op.op1->expr_type == EXPR_VARIABLE)
+ {
+ tree local_tmp;
+ local_tmp = gfc_evaluate_now (tmp, &se->pre);
+ local_tmp = gfc_copy_alloc_comp (e->ts.derived, local_tmp, tmp, parm_rank);
+ gfc_add_expr_to_block (&se->post, local_tmp);
+ }
+
tmp = gfc_deallocate_alloc_comp (e->ts.derived, tmp, parm_rank);
+
gfc_add_expr_to_block (&se->post, tmp);
}
@@ -2931,7 +2952,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
arglist = chainon (arglist, append_args);
/* Generate the actual call. */
- gfc_conv_function_val (se, sym);
+ conv_function_val (se, sym, expr);
/* If there are alternate return labels, function type should be
integer. Can't modify the type in place though, since it can be shared
@@ -2958,7 +2979,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym,
something like
x = f()
where f is pointer valued, we have to dereference the result. */
- if (!se->want_pointer && !byref && sym->attr.pointer)
+ if (!se->want_pointer && !byref && sym->attr.pointer
+ && !is_proc_ptr_comp (expr, NULL))
se->expr = build_fold_indirect_ref (se->expr);
/* f2c calling conventions require a scalar default real function to
@@ -3335,6 +3357,20 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr)
}
+/* Return the backend_decl for a procedure pointer component. */
+
+tree
+gfc_get_proc_ptr_comp (gfc_se *se, gfc_expr *e)
+{
+ gfc_se comp_se;
+ gfc_init_se (&comp_se, NULL);
+ e->expr_type = EXPR_VARIABLE;
+ gfc_conv_expr (&comp_se, e);
+ comp_se.expr = build_fold_addr_expr (comp_se.expr);
+ return gfc_evaluate_now (comp_se.expr, &se->pre);
+}
+
+
/* Translate a function expression. */
static void
@@ -3361,7 +3397,9 @@ gfc_conv_function_expr (gfc_se * se, gfc_expr * expr)
sym = expr->value.function.esym;
if (!sym)
sym = expr->symtree->n.sym;
- gfc_conv_function_call (se, sym, expr->value.function.actual, NULL_TREE);
+
+ gfc_conv_procedure_call (se, sym, expr->value.function.actual, expr,
+ NULL_TREE);
}
@@ -3783,7 +3821,8 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init)
continue;
val = gfc_conv_initializer (c->expr, &cm->ts,
- TREE_TYPE (cm->backend_decl), cm->attr.dimension, cm->attr.pointer);
+ TREE_TYPE (cm->backend_decl), cm->attr.dimension,
+ cm->attr.pointer || cm->attr.proc_pointer);
/* Append it to the constructor list. */
CONSTRUCTOR_APPEND_ELT (v, cm->backend_decl, val);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 8705b94dd8d..d00a35b5eb8 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -92,9 +92,11 @@ gfc_intrinsic_map_t;
except for atan2. */
#define DEFINE_MATH_BUILTIN(ID, NAME, ARGTYPE) \
{ GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
- BUILT_IN_ ## ID ## L, BUILT_IN_ ## ID ## L, 0, 0, 0, 0, true, \
- false, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
- NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
+ BUILT_IN_ ## ID ## L, BUILT_IN_ ## ID ## L, (enum built_in_function) 0, \
+ (enum built_in_function) 0, (enum built_in_function) 0, \
+ (enum built_in_function) 0, true, false, true, NAME, NULL_TREE, \
+ NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
+ NULL_TREE},
#define DEFINE_MATH_BUILTIN_C(ID, NAME, ARGTYPE) \
{ GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
@@ -1700,7 +1702,8 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
}
}
- gfc_conv_function_call (se, sym, expr->value.function.actual, append_args);
+ gfc_conv_procedure_call (se, sym, expr->value.function.actual, expr,
+ append_args);
gfc_free (sym);
}
@@ -2875,7 +2878,8 @@ conv_generic_with_optional_char_arg (gfc_se* se, gfc_expr* expr,
/* Build the call itself. */
sym = gfc_get_symbol_for_expr (expr);
- gfc_conv_function_call (se, sym, expr->value.function.actual, append_args);
+ gfc_conv_procedure_call (se, sym, expr->value.function.actual, expr,
+ append_args);
gfc_free (sym);
}
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index d2b47a408a3..b1543051259 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -105,7 +105,7 @@ static GTY(()) gfc_st_parameter_field st_parameter_field[] =
{ #name, mask, IOPARM_ptype_##param_type, IOPARM_type_##type, NULL, NULL },
#include "ioparm.def"
#undef IOPARM
- { NULL, 0, 0, 0, NULL, NULL }
+ { NULL, 0, (enum ioparam_type) 0, (enum iofield_type) 0, NULL, NULL }
};
/* Library I/O subroutines */
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index e96c0afc4c7..d695759477a 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -356,8 +356,8 @@ gfc_trans_call (gfc_code * code, bool dependency_check)
/* Translate the call. */
has_alternate_specifier
- = gfc_conv_function_call (&se, code->resolved_sym, code->ext.actual,
- NULL_TREE);
+ = gfc_conv_procedure_call (&se, code->resolved_sym, code->ext.actual,
+ code->expr, NULL_TREE);
/* A subroutine without side-effect, by definition, does nothing! */
TREE_SIDE_EFFECTS (se.expr) = 1;
@@ -430,8 +430,8 @@ gfc_trans_call (gfc_code * code, bool dependency_check)
gfc_init_block (&block);
/* Add the subroutine call to the block. */
- gfc_conv_function_call (&loopse, code->resolved_sym, code->ext.actual,
- NULL_TREE);
+ gfc_conv_procedure_call (&loopse, code->resolved_sym, code->ext.actual,
+ code->expr, NULL_TREE);
gfc_add_expr_to_block (&loopse.pre, loopse.expr);
gfc_add_block_to_block (&block, &loopse.pre);
diff --git a/gcc/fortran/trans-stmt.h b/gcc/fortran/trans-stmt.h
index 5d92a9c756f..ff8a8384a4c 100644
--- a/gcc/fortran/trans-stmt.h
+++ b/gcc/fortran/trans-stmt.h
@@ -29,6 +29,7 @@ tree gfc_trans_code (gfc_code *);
tree gfc_trans_assign (gfc_code *);
tree gfc_trans_pointer_assign (gfc_code *);
tree gfc_trans_init_assign (gfc_code *);
+tree gfc_get_proc_ptr_comp (gfc_se *, gfc_expr *);
/* trans-stmt.c */
tree gfc_trans_cycle (gfc_code *);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index e83215c0686..694d0e28980 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1777,6 +1777,21 @@ copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to)
}
+/* Build a tree node for a procedure pointer component. */
+
+tree
+gfc_get_ppc_type (gfc_component* c)
+{
+ tree t;
+ if (c->attr.function)
+ t = gfc_typenode_for_spec (&c->ts);
+ else
+ t = void_type_node;
+ /* TODO: Build argument list. */
+ return build_pointer_type (build_function_type (t, NULL_TREE));
+}
+
+
/* Build a tree node for a derived type. If there are equal
derived types, with different local names, these are built
at the same time. If an equal derived type has been built
@@ -1823,16 +1838,9 @@ gfc_get_derived_type (gfc_symbol * derived)
/* derived->backend_decl != 0 means we saw it before, but its
components' backend_decl may have not been built. */
if (derived->backend_decl)
- {
- /* Its components' backend_decl have been built. */
- if (TYPE_FIELDS (derived->backend_decl))
- return derived->backend_decl;
- else
- typenode = derived->backend_decl;
- }
+ return derived->backend_decl;
else
{
-
/* We see this derived type first time, so build the type node. */
typenode = make_node (RECORD_TYPE);
TYPE_NAME (typenode) = get_identifier (derived->name);
@@ -1881,6 +1889,8 @@ gfc_get_derived_type (gfc_symbol * derived)
{
if (c->ts.type == BT_DERIVED)
field_type = c->ts.derived->backend_decl;
+ else if (c->attr.proc_pointer)
+ field_type = gfc_get_ppc_type (c);
else
{
if (c->ts.type == BT_CHARACTER)
diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h
index 7074913d4ef..c3e51a11c8e 100644
--- a/gcc/fortran/trans-types.h
+++ b/gcc/fortran/trans-types.h
@@ -89,4 +89,6 @@ int gfc_is_nodesc_array (gfc_symbol *);
/* Return the DTYPE for an array. */
tree gfc_get_dtype (tree);
+tree gfc_get_ppc_type (gfc_component *);
+
#endif
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index e926a950fcf..54d40d7c3e3 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -1115,6 +1115,10 @@ gfc_trans_code (gfc_code * code)
}
break;
+ case EXEC_CALL_PPC:
+ res = gfc_trans_call (code, false);
+ break;
+
case EXEC_ASSIGN_CALL:
res = gfc_trans_call (code, true);
break;
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index b6b3279b4a9..c75f40eb6fe 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -71,7 +71,7 @@ typedef struct gfc_se
are NULL. Used by intrinsic size. */
unsigned data_not_needed:1;
- /* If set, gfc_conv_function_call does not put byref calls into se->pre. */
+ /* If set, gfc_conv_procedure_call does not put byref calls into se->pre. */
unsigned no_function_call:1;
/* Scalarization parameters. */
@@ -313,9 +313,10 @@ int gfc_is_intrinsic_libcall (gfc_expr *);
/* Used to call the elemental subroutines used in operator assignments. */
tree gfc_conv_operator_assign (gfc_se *, gfc_se *, gfc_symbol *);
-/* Also used to CALL subroutines. */
-int gfc_conv_function_call (gfc_se *, gfc_symbol *, gfc_actual_arglist *,
- tree);
+/* Used to call ordinary functions/subroutines
+ and procedure pointer components. */
+int gfc_conv_procedure_call (gfc_se *, gfc_symbol *, gfc_actual_arglist *,
+ gfc_expr *, tree);
void gfc_conv_subref_array_arg (gfc_se *, gfc_expr *, int, sym_intent);
diff --git a/gcc/function.h b/gcc/function.h
index a5ba125f9ca..e07c7cdc95a 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -608,11 +608,11 @@ struct GTY(()) function {
#define GEN_FUNC_GLOBAL_ID(m,f) ((((HOST_WIDE_INT) (m)) << FUNC_ID_WIDTH) | (f))
#endif
-#define FUNC_ID_WIDTH HOST_BITS_PER_WIDE_INT/2
+#define FUNC_ID_WIDTH HOST_BITS_PER_WIDEST_INT/2
#define FUNC_ID_MASK ((1ll << FUNC_ID_WIDTH) - 1)
#define EXTRACT_MODULE_ID_FROM_GLOBAL_ID(gid) (unsigned)(((gid) >> FUNC_ID_WIDTH) & FUNC_ID_MASK)
#define EXTRACT_FUNC_ID_FROM_GLOBAL_ID(gid) (unsigned)((gid) & FUNC_ID_MASK)
-#define GEN_FUNC_GLOBAL_ID(m,f) ((((HOST_WIDE_INT) (m)) << FUNC_ID_WIDTH) | (f))
+#define GEN_FUNC_GLOBAL_ID(m,f) ((((HOST_WIDEST_INT) (m)) << FUNC_ID_WIDTH) | (f))
#define FUNC_DECL_MODULE_ID(func) ((func)->module_id)
#define FUNC_DECL_FUNC_ID(func) ((func)->funcdef_no + 1)
#define FUNC_DECL_GLOBAL_ID(func) \
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index a01de13e3c7..669d03cc066 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -105,6 +105,111 @@ along with GCC; see the file COPYING3. If not see
static int num_changes;
+DEF_VEC_P(df_ref);
+DEF_VEC_ALLOC_P(df_ref,heap);
+VEC(df_ref,heap) *use_def_ref;
+
+
+/* Return the only def in USE's use-def chain, or NULL if there is
+ more than one def in the chain. */
+
+static inline df_ref
+get_def_for_use (df_ref use)
+{
+ return VEC_index (df_ref, use_def_ref, DF_REF_ID (use));
+}
+
+
+/* Return the only bit between FIRST and LAST that is set in B,
+ or -1 if there are zero or more than one such bits. */
+
+static inline int
+bitmap_only_bit_between (const_bitmap b, unsigned first, unsigned last)
+{
+ bitmap_iterator bi;
+ unsigned bit, bit2;
+
+ if (last < first)
+ return -1;
+
+ bmp_iter_set_init (&bi, b, first, &bit);
+ if (bmp_iter_set (&bi, &bit) && bit <= last)
+ {
+ bit2 = bit;
+ bmp_iter_next (&bi, &bit2);
+ if (!bmp_iter_set (&bi, &bit2) || bit2 > last)
+ return bit;
+ }
+ return -1;
+}
+
+
+/* Fill the use_def_ref vector with values for the uses in USE_REC,
+ taking reaching definitions info from LOCAL_RD. TOP_FLAG says
+ which artificials uses should be used, when USE_REC is an
+ artificial use vector. */
+
+static void
+process_uses (bitmap local_rd, df_ref *use_rec, int top_flag)
+{
+ df_ref use;
+ while ((use = *use_rec++) != NULL)
+ if (top_flag == (DF_REF_FLAGS (use) & DF_REF_AT_TOP))
+ {
+ unsigned int uregno = DF_REF_REGNO (use);
+ unsigned int first = DF_DEFS_BEGIN (uregno);
+ unsigned int last = first + DF_DEFS_COUNT (uregno) - 1;
+ int defno = bitmap_only_bit_between (local_rd, first, last);
+ df_ref def = (defno == -1) ? NULL : DF_DEFS_GET (defno);
+
+ VEC_replace (df_ref, use_def_ref, DF_REF_ID (use), def);
+ }
+}
+
+
+/* Do dataflow analysis and use reaching definitions to build
+ a vector holding the reaching definitions of uses that have a
+ single RD. */
+
+static void
+build_single_def_use_links (void)
+{
+ basic_block bb;
+ bitmap local_rd = BITMAP_ALLOC (NULL);
+
+ /* We use reaching definitions to compute our restricted use-def chains. */
+ df_set_flags (DF_EQ_NOTES);
+ df_rd_add_problem ();
+ df_analyze ();
+ df_maybe_reorganize_use_refs (DF_REF_ORDER_BY_INSN_WITH_NOTES);
+
+ use_def_ref = VEC_alloc (df_ref, heap, DF_USES_TABLE_SIZE ());
+ VEC_safe_grow (df_ref, heap, use_def_ref, DF_USES_TABLE_SIZE ());
+
+ FOR_EACH_BB (bb)
+ {
+ int bb_index = bb->index;
+ struct df_rd_bb_info *bb_info = df_rd_get_bb_info (bb_index);
+ rtx insn;
+
+ bitmap_copy (local_rd, bb_info->in);
+ process_uses (local_rd, df_get_artificial_uses (bb_index), DF_REF_AT_TOP);
+
+ df_rd_simulate_artificial_defs_at_top (bb, local_rd);
+ FOR_BB_INSNS (bb, insn)
+ if (INSN_P (insn))
+ {
+ unsigned int uid = INSN_UID (insn);
+ process_uses (local_rd, DF_INSN_UID_USES (uid), 0);
+ process_uses (local_rd, DF_INSN_UID_EQ_USES (uid), 0);
+ df_rd_simulate_one_insn (bb, insn, local_rd);
+ }
+
+ process_uses (local_rd, df_get_artificial_uses (bb_index), 0);
+ }
+
+ BITMAP_FREE (local_rd);
+}
/* Do not try to replace constant addresses or addresses of local and
argument slots. These MEM expressions are made only once and inserted
@@ -694,7 +799,7 @@ update_df (rtx insn, rtx *loc, df_ref *use_rec, enum df_ref_type type,
df_ref orig_use = use, new_use;
int width = -1;
int offset = -1;
- enum machine_mode mode = 0;
+ enum machine_mode mode = VOIDmode;
rtx *new_loc = find_occurrence (loc, DF_REF_REG (orig_use));
use_rec++;
@@ -716,7 +821,8 @@ update_df (rtx insn, rtx *loc, df_ref *use_rec, enum df_ref_type type,
width, offset, mode);
/* Set up the use-def chain. */
- df_chain_copy (new_use, DF_REF_CHAIN (orig_use));
+ gcc_assert (DF_REF_ID (new_use) == (int) VEC_length (df_ref, use_def_ref));
+ VEC_safe_push (df_ref, heap, use_def_ref, get_def_for_use (orig_use));
changed = true;
}
if (changed)
@@ -1035,7 +1141,6 @@ forward_propagate_and_simplify (df_ref use, rtx def_insn, rtx def_set)
static void
forward_propagate_into (df_ref use)
{
- struct df_link *defs;
df_ref def;
rtx def_insn, def_set, use_insn;
rtx parent;
@@ -1046,11 +1151,9 @@ forward_propagate_into (df_ref use)
return;
/* Only consider uses that have a single definition. */
- defs = DF_REF_CHAIN (use);
- if (!defs || defs->next)
+ def = get_def_for_use (use);
+ if (!def)
return;
-
- def = defs->ref;
if (DF_REF_FLAGS (def) & DF_REF_READ_WRITE)
return;
if (DF_REF_IS_ARTIFICIAL (def))
@@ -1096,12 +1199,7 @@ fwprop_init (void)
insns (sadly) if we are not working in cfglayout mode. */
loop_optimizer_init (0);
- /* Now set up the dataflow problem (we only want use-def chains) and
- put the dataflow solver to work. */
- df_set_flags (DF_EQ_NOTES);
- df_chain_add_problem (DF_UD_CHAIN);
- df_analyze ();
- df_maybe_reorganize_use_refs (DF_REF_ORDER_BY_INSN_WITH_NOTES);
+ build_single_def_use_links ();
df_set_flags (DF_DEFER_INSN_RESCAN);
}
@@ -1110,6 +1208,7 @@ fwprop_done (void)
{
loop_optimizer_finalize ();
+ VEC_free (df_ref, heap, use_def_ref);
free_dominance_info (CDI_DOMINATORS);
cleanup_cfg (0);
delete_trivially_dead_insns (get_insns (), max_reg_num ());
@@ -1187,8 +1286,6 @@ fwprop_addr (void)
/* Go through all the uses. update_df will create new ones at the
end, and we'll go through them as well. */
- df_set_flags (DF_DEFER_INSN_RESCAN);
-
for (i = 0; i < DF_USES_TABLE_SIZE (); i++)
{
df_ref use = DF_USES_GET (i);
diff --git a/gcc/gcc-plugin.h b/gcc/gcc-plugin.h
index 543dc933742..96c867d4bc6 100644
--- a/gcc/gcc-plugin.h
+++ b/gcc/gcc-plugin.h
@@ -78,11 +78,10 @@ struct plugin_gcc_version
const char *configuration_arguments;
};
-extern struct plugin_gcc_version plugin_gcc_version;
-
/* The default version check. Compares every field in VERSION. */
-extern bool plugin_default_version_check(struct plugin_gcc_version *version);
+extern bool plugin_default_version_check (struct plugin_gcc_version *,
+ struct plugin_gcc_version *);
/* Function type for the plugin initialization routine. Each plugin module
should define this as an externally-visible function with name
diff --git a/gcc/gcc.c b/gcc/gcc.c
index af4081c4a17..e89f3994adc 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -730,6 +730,13 @@ proper position among the other output files. */
#endif
#endif
+#ifndef LINK_BUILDID_SPEC
+# if defined(HAVE_LD_BUILDID) && defined(ENABLE_LD_BUILDID)
+# define LINK_BUILDID_SPEC "%{!r:--build-id} "
+# endif
+#endif
+
+
/* -u* was put back because both BSD and SysV seem to support it. */
/* %{static:} simply prevents an error message if the target machine
doesn't handle -static. */
@@ -1844,9 +1851,16 @@ init_spec (void)
asm_spec = XOBFINISH (&obstack, const char *);
}
#endif
-#ifdef LINK_EH_SPEC
+
+#if defined LINK_EH_SPEC || defined LINK_BUILDID_SPEC
+# ifdef LINK_BUILDID_SPEC
+ /* Prepend LINK_BUILDID_SPEC to whatever link_spec we had before. */
+ obstack_grow (&obstack, LINK_BUILDID_SPEC, sizeof(LINK_BUILDID_SPEC) - 1);
+# endif
+# ifdef LINK_EH_SPEC
/* Prepend LINK_EH_SPEC to whatever link_spec we had before. */
obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
+# endif
obstack_grow0 (&obstack, link_spec, strlen (link_spec));
link_spec = XOBFINISH (&obstack, const char *);
#endif
diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c
index 90500a92dbb..e05ec7fc3e1 100644
--- a/gcc/gcov-io.c
+++ b/gcc/gcov-io.c
@@ -574,17 +574,6 @@ gcov_seek (gcov_position_t base)
gcov_var.start = ftell (gcov_var.file) >> 2;
}
-#if 0
-GCOV_LINKAGE void
-gcov_append (gcov_position_t tail_adjust)
-{
- gcc_assert (gcov_var.offset == 0 && gcov_var.mode > 0);
- fseek (gcov_var.file, -(long)(tail_adjust << 2), SEEK_END);
- gcov_var.start = ftell (gcov_var.file) >> 2;
- gcov_var.mode = -1;
- gcov_var.offset = 0;
-}
-#endif
#endif
#if IN_GCOV > 0
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 6bf1d502bbe..b3fa362aff3 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -280,13 +280,8 @@ along with GCC; see the file COPYING3. If not see
/* GCSE global vars. */
-/* Note whether or not we should run jump optimization after gcse. We
- want to do this for two cases.
-
- * If we changed any jumps via cprop.
-
- * If we added any labels via edge splitting. */
-static int run_jump_opt_after_gcse;
+/* Set to non-zero if CSE should run after all GCSE optimizations are done. */
+int flag_rerun_cse_after_global_opts;
/* An obstack for our working variables. */
static struct obstack gcse_obstack;
@@ -370,11 +365,6 @@ static struct hash_table expr_hash_table;
/* Copy propagation hash table. */
static struct hash_table set_hash_table;
-/* Maximum register number in function prior to doing gcse + 1.
- Registers created during this pass have regno >= max_gcse_regno.
- This is named with "gcse" to not collide with global of same name. */
-static unsigned int max_gcse_regno;
-
/* This is a list of expressions which are MEMs and will be used by load
or store motion.
Load motion tracks MEMs which aren't killed by
@@ -447,10 +437,9 @@ static int global_const_prop_count;
static int global_copy_prop_count;
/* For available exprs */
-static sbitmap *ae_kill, *ae_gen;
+static sbitmap *ae_kill;
static void compute_can_copy (void);
-static void recompute_all_luids (void);
static void *gmalloc (size_t) ATTRIBUTE_MALLOC;
static void *gcalloc (size_t, size_t) ATTRIBUTE_MALLOC;
static void *gcse_alloc (unsigned long);
@@ -461,7 +450,6 @@ static void hash_scan_set (rtx, rtx, struct hash_table *);
static void hash_scan_clobber (rtx, rtx, struct hash_table *);
static void hash_scan_call (rtx, rtx, struct hash_table *);
static int want_to_gcse_p (rtx);
-static bool can_assign_to_reg_p (rtx);
static bool gcse_constant_p (const_rtx);
static int oprs_unchanged_p (const_rtx, const_rtx, int);
static int oprs_anticipatable_p (const_rtx, const_rtx);
@@ -502,11 +490,10 @@ static int cprop_jump (basic_block, rtx, rtx, rtx, rtx);
static void mems_conflict_for_gcse_p (rtx, const_rtx, void *);
static int load_killed_in_block_p (const_basic_block, int, const_rtx, int);
static void canon_list_insert (rtx, const_rtx, void *);
-static int cprop_insn (rtx, int);
-static int cprop (int);
+static int cprop_insn (rtx);
static void find_implicit_sets (void);
-static int one_cprop_pass (int, bool, bool);
-static bool constprop_register (rtx, rtx, rtx, bool);
+static int one_cprop_pass (void);
+static bool constprop_register (rtx, rtx, rtx);
static struct expr *find_bypass_set (int, int);
static bool reg_killed_on_edge (const_rtx, const_edge);
static int bypass_block (basic_block, rtx, rtx);
@@ -521,14 +508,14 @@ static void pre_insert_copy_insn (struct expr *, rtx);
static void pre_insert_copies (void);
static int pre_delete (void);
static int pre_gcse (void);
-static int one_pre_gcse_pass (int);
+static int one_pre_gcse_pass (void);
static void add_label_notes (rtx, rtx);
static void alloc_code_hoist_mem (int, int);
static void free_code_hoist_mem (void);
static void compute_code_hoist_vbeinout (void);
static void compute_code_hoist_data (void);
static int hoist_expr_reaches_here_p (basic_block, int, basic_block, char *);
-static void hoist_code (void);
+static int hoist_code (void);
static int one_code_hoisting_pass (void);
static rtx process_insert_insn (struct expr *);
static int pre_edge_insert (struct edge_list *, struct expr **);
@@ -539,7 +526,6 @@ static void free_ldst_entry (struct ls_expr *);
static void free_ldst_mems (void);
static void print_ldst_list (FILE *);
static struct ls_expr * find_rtx_in_ldst (rtx);
-static int enumerate_ldsts (void);
static inline struct ls_expr * first_ls_expr (void);
static inline struct ls_expr * next_ls_expr (struct ls_expr *);
static int simple_mem (const_rtx);
@@ -547,33 +533,13 @@ static void invalidate_any_buried_refs (rtx);
static void compute_ld_motion_mems (void);
static void trim_ld_motion_mems (void);
static void update_ld_motion_stores (struct expr *);
-static void reg_set_info (rtx, const_rtx, void *);
-static void reg_clear_last_set (rtx, const_rtx, void *);
-static bool store_ops_ok (const_rtx, int *);
-static rtx extract_mentioned_regs (rtx);
-static rtx extract_mentioned_regs_helper (rtx, rtx);
-static void find_moveable_store (rtx, int *, int *);
-static int compute_store_table (void);
-static bool load_kills_store (const_rtx, const_rtx, int);
-static bool find_loads (const_rtx, const_rtx, int);
-static bool store_killed_in_insn (const_rtx, const_rtx, const_rtx, int);
-static bool store_killed_after (const_rtx, const_rtx, const_rtx, const_basic_block, int *, rtx *);
-static bool store_killed_before (const_rtx, const_rtx, const_rtx, const_basic_block, int *);
-static void build_store_vectors (void);
-static void insert_insn_start_basic_block (rtx, basic_block);
-static int insert_store (struct ls_expr *, edge);
-static void remove_reachable_equiv_notes (basic_block, struct ls_expr *);
-static void replace_store_insn (rtx, rtx, basic_block, struct ls_expr *);
-static void delete_store (struct ls_expr *, basic_block);
-static void free_store_memory (void);
-static void store_motion (void);
static void free_insn_expr_list_list (rtx *);
static void clear_modify_mem_tables (void);
static void free_modify_mem_tables (void);
static rtx gcse_emit_move_after (rtx, rtx, rtx);
static void local_cprop_find_used_regs (rtx *, void *);
-static bool do_local_cprop (rtx, rtx, bool);
-static void local_cprop_pass (bool);
+static bool do_local_cprop (rtx, rtx);
+static int local_cprop_pass (void);
static bool is_too_expensive (const char *);
#define GNEW(T) ((T *) gmalloc (sizeof (T)))
@@ -588,155 +554,6 @@ static bool is_too_expensive (const char *);
#define GOBNEW(T) ((T *) gcse_alloc (sizeof (T)))
#define GOBNEWVAR(T, S) ((T *) gcse_alloc ((S)))
-
-/* Entry point for global common subexpression elimination.
- F is the first instruction in the function. Return nonzero if a
- change is mode. */
-
-static int
-gcse_main (rtx f ATTRIBUTE_UNUSED)
-{
- int changed;
- /* Point to release obstack data from for each pass. */
- char *gcse_obstack_bottom;
-
- /* We do not construct an accurate cfg in functions which call
- setjmp, so just punt to be safe. */
- if (cfun->calls_setjmp)
- return 0;
-
- /* Assume that we do not need to run jump optimizations after gcse. */
- run_jump_opt_after_gcse = 0;
-
- /* Identify the basic block information for this function, including
- successors and predecessors. */
- max_gcse_regno = max_reg_num ();
-
- df_note_add_problem ();
- df_analyze ();
-
- if (dump_file)
- dump_flow_info (dump_file, dump_flags);
-
- /* Return if there's nothing to do, or it is too expensive. */
- if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
- || is_too_expensive (_("GCSE disabled")))
- return 0;
-
- gcc_obstack_init (&gcse_obstack);
- bytes_used = 0;
-
- /* We need alias. */
- init_alias_analysis ();
-
- gcse_obstack_bottom = GOBNEWVAR (char, 1);
- changed = 0;
-
- if (dump_file)
- fprintf (dump_file, "GCSE pass\n\n");
-
- max_gcse_regno = max_reg_num ();
-
- alloc_gcse_mem ();
-
- /* Don't allow constant propagation to modify jumps
- during this pass. */
- if (dbg_cnt (cprop1))
- {
- timevar_push (TV_CPROP1);
- changed = one_cprop_pass (1, false, false);
- if (changed)
- recompute_all_luids ();
- timevar_pop (TV_CPROP1);
- }
-
- if (optimize_function_for_speed_p (cfun))
- {
- timevar_push (TV_PRE);
- changed |= one_pre_gcse_pass (1);
- /* We may have just created new basic blocks. Release and
- recompute various things which are sized on the number of
- basic blocks.
- ??? There would be no need for this if we used a block
- based Lazy Code Motion variant, with all (or selected)
- edges split before running the pass. That would also
- help find_implicit_sets for cprop. FIXME. */
- if (changed)
- {
- free_modify_mem_tables ();
- modify_mem_list = GCNEWVEC (rtx, last_basic_block);
- canon_modify_mem_list = GCNEWVEC (rtx, last_basic_block);
- }
-
- df_analyze ();
- run_jump_opt_after_gcse = 1;
- timevar_pop (TV_PRE);
- }
- else
- {
- /* This function is being optimized for code size.
- It does not make sense to run code hoisting unless we are optimizing
- for code size -- it rarely makes programs faster, and can make
- them bigger if we did partial redundancy elimination (when optimizing
- for space, we don't run the partial redundancy algorithms). */
- timevar_push (TV_HOIST);
- max_gcse_regno = max_reg_num ();
- alloc_gcse_mem ();
- one_code_hoisting_pass ();
- timevar_pop (TV_HOIST);
- }
-
- free_gcse_mem ();
-
- if (dump_file)
- {
- fprintf (dump_file, "\n");
- fflush (dump_file);
- }
-
- obstack_free (&gcse_obstack, gcse_obstack_bottom);
-
- /* Do the second const/copy propagation pass, including cprop into
- conditional jumps. */
- if (dbg_cnt (cprop2))
- {
- max_gcse_regno = max_reg_num ();
- alloc_gcse_mem ();
-
- /* This time, go ahead and allow cprop to alter jumps. */
- timevar_push (TV_CPROP2);
- changed = one_cprop_pass (2, true, true);
- if (changed)
- recompute_all_luids ();
- timevar_pop (TV_CPROP2);
- free_gcse_mem ();
- }
-
- if (dump_file)
- {
- fprintf (dump_file, "GCSE of %s: %d basic blocks, ",
- current_function_name (), n_basic_blocks);
- fprintf (dump_file, "pass 1, %d bytes\n\n", bytes_used);
- }
-
- obstack_free (&gcse_obstack, NULL);
-
- /* We are finished with alias.
- ??? Actually we recompute alias in store_motion. */
- end_alias_analysis ();
-
- /* Run store motion. */
- if (optimize_function_for_speed_p (cfun) && flag_gcse_sm)
- {
- timevar_push (TV_LSM);
- store_motion ();
- timevar_pop (TV_LSM);
- }
-
- /* Record where pseudo-registers are set. */
- return run_jump_opt_after_gcse;
-}
-
/* Misc. utilities. */
/* Nonzero for each mode that supports (set (reg) (reg)).
@@ -790,19 +607,6 @@ can_copy_p (enum machine_mode mode)
return can_copy[mode] != 0;
}
-/* Recompute the DF LUIDs for all basic blocks. If a sub-pass in this
- file changes something, we have to recompute them for the next pass.
- FIXME: If we would track which basic blocks we touch, we could
- update LUIDs in only those basic blocks. */
-
-static void
-recompute_all_luids (void)
-{
- basic_block bb;
- FOR_EACH_BB (bb)
- df_recompute_luids (bb);
-}
-
/* Cover function to xmalloc to record bytes allocated. */
@@ -990,18 +794,23 @@ want_to_gcse_p (rtx x)
return 0;
default:
- return can_assign_to_reg_p (x);
+ return can_assign_to_reg_without_clobbers_p (x);
}
}
-/* Used internally by can_assign_to_reg_p. */
+/* Used internally by can_assign_to_reg_without_clobbers_p. */
static GTY(()) rtx test_insn;
-/* Return true if we can assign X to a pseudo register. */
+/* Return true if we can assign X to a pseudo register such that the
+ resulting insn does not result in clobbering a hard register as a
+ side-effect.
+ This function is typically used by code motion passes, to verify
+ that it is safe to insert an insn without worrying about clobbering
+ maybe live hard regs. */
-static bool
-can_assign_to_reg_p (rtx x)
+bool
+can_assign_to_reg_without_clobbers_p (rtx x)
{
int num_clobbers = 0;
int icode;
@@ -1447,11 +1256,10 @@ insert_set_in_table (rtx x, rtx insn, struct hash_table *table)
/* First occurrence of this expression in this basic block. */
cur_occr = GOBNEW (struct occr);
bytes_used += sizeof (struct occr);
-
- cur_occr->insn = insn;
- cur_occr->next = cur_expr->avail_occr;
- cur_occr->deleted_p = 0;
- cur_expr->avail_occr = cur_occr;
+ cur_occr->insn = insn;
+ cur_occr->next = cur_expr->avail_occr;
+ cur_occr->deleted_p = 0;
+ cur_expr->avail_occr = cur_occr;
}
}
@@ -1476,7 +1284,9 @@ gcse_constant_p (const_rtx x)
&& ! FLOAT_MODE_P (GET_MODE (XEXP (x, 1))))
return true;
- return CONSTANT_P (x);
+ /* Since X might be inserted more than once we have to take care that it
+ is sharable. */
+ return CONSTANT_P (x) && (GET_CODE (x) != CONST || shared_const_p (x));
}
/* Scan pattern PAT of INSN and add an entry to the hash TABLE (set or
@@ -1839,14 +1649,14 @@ record_last_set_info (rtx dest, const_rtx setter ATTRIBUTE_UNUSED, void *data)
static void
compute_hash_table_work (struct hash_table *table)
{
- unsigned int i;
+ int i;
/* re-Cache any INSN_LIST nodes we have allocated. */
clear_modify_mem_tables ();
/* Some working arrays used to track first and last set in each block. */
- reg_avail_info = GNEWVEC (struct reg_avail_info, max_gcse_regno);
+ reg_avail_info = GNEWVEC (struct reg_avail_info, max_reg_num ());
- for (i = 0; i < max_gcse_regno; ++i)
+ for (i = 0; i < max_reg_num (); ++i)
reg_avail_info[i].last_bb = NULL;
FOR_EACH_BB (current_bb)
@@ -2631,8 +2441,6 @@ cprop_jump (basic_block bb, rtx setcc, rtx jump, rtx from, rtx src)
delete_insn (setcc);
#endif
- run_jump_opt_after_gcse = 1;
-
global_const_prop_count++;
if (dump_file != NULL)
{
@@ -2666,14 +2474,13 @@ cprop_jump (basic_block bb, rtx setcc, rtx jump, rtx from, rtx src)
}
static bool
-constprop_register (rtx insn, rtx from, rtx to, bool alter_jumps)
+constprop_register (rtx insn, rtx from, rtx to)
{
rtx sset;
/* Check for reg or cc0 setting instructions followed by
conditional branch instructions first. */
- if (alter_jumps
- && (sset = single_set (insn)) != NULL
+ if ((sset = single_set (insn)) != NULL
&& NEXT_INSN (insn)
&& any_condjump_p (NEXT_INSN (insn)) && onlyjump_p (NEXT_INSN (insn)))
{
@@ -2694,7 +2501,7 @@ constprop_register (rtx insn, rtx from, rtx to, bool alter_jumps)
Right now the insn in question must look like
(set (pc) (if_then_else ...)) */
- else if (alter_jumps && any_condjump_p (insn) && onlyjump_p (insn))
+ else if (any_condjump_p (insn) && onlyjump_p (insn))
return cprop_jump (BLOCK_FOR_INSN (insn), NULL, insn, from, to);
return 0;
}
@@ -2703,7 +2510,7 @@ constprop_register (rtx insn, rtx from, rtx to, bool alter_jumps)
The result is nonzero if a change was made. */
static int
-cprop_insn (rtx insn, int alter_jumps)
+cprop_insn (rtx insn)
{
struct reg_use *reg_used;
int changed = 0;
@@ -2728,11 +2535,6 @@ cprop_insn (rtx insn, int alter_jumps)
rtx pat, src;
struct expr *set;
- /* Ignore registers created by GCSE.
- We do this because ... */
- if (regno >= max_gcse_regno)
- continue;
-
/* If the register has already been set in this block, there's
nothing we can do. */
if (! oprs_not_set_p (reg_used->reg_rtx, insn))
@@ -2753,7 +2555,7 @@ cprop_insn (rtx insn, int alter_jumps)
/* Constant propagation. */
if (gcse_constant_p (src))
{
- if (constprop_register (insn, reg_used->reg_rtx, src, alter_jumps))
+ if (constprop_register (insn, reg_used->reg_rtx, src))
{
changed = 1;
global_const_prop_count++;
@@ -2840,11 +2642,10 @@ local_cprop_find_used_regs (rtx *xptr, void *data)
find_used_regs (xptr, data);
}
-/* Try to perform local const/copy propagation on X in INSN.
- If ALTER_JUMPS is false, changing jump insns is not allowed. */
+/* Try to perform local const/copy propagation on X in INSN. */
static bool
-do_local_cprop (rtx x, rtx insn, bool alter_jumps)
+do_local_cprop (rtx x, rtx insn)
{
rtx newreg = NULL, newcnst = NULL;
@@ -2877,7 +2678,7 @@ do_local_cprop (rtx x, rtx insn, bool alter_jumps)
|| ! MEM_P (XEXP (note, 0))))
newreg = this_rtx;
}
- if (newcnst && constprop_register (insn, x, newcnst, alter_jumps))
+ if (newcnst && constprop_register (insn, x, newcnst))
{
if (dump_file != NULL)
{
@@ -2907,12 +2708,10 @@ do_local_cprop (rtx x, rtx insn, bool alter_jumps)
return false;
}
-/* Do local const/copy propagation (i.e. within each basic block).
- If ALTER_JUMPS is true, allow propagating into jump insns, which
- could modify the CFG. */
+/* Do local const/copy propagation (i.e. within each basic block). */
-static void
-local_cprop_pass (bool alter_jumps)
+static int
+local_cprop_pass (void)
{
basic_block bb;
rtx insn;
@@ -2938,7 +2737,7 @@ local_cprop_pass (bool alter_jumps)
for (reg_used = &reg_use_table[0]; reg_use_count > 0;
reg_used++, reg_use_count--)
{
- if (do_local_cprop (reg_used->reg_rtx, insn, alter_jumps))
+ if (do_local_cprop (reg_used->reg_rtx, insn))
{
changed = true;
break;
@@ -2958,52 +2757,6 @@ local_cprop_pass (bool alter_jumps)
cselib_finish ();
- /* Global analysis may get into infinite loops for unreachable blocks. */
- if (changed && alter_jumps)
- delete_unreachable_blocks ();
-}
-
-/* Forward propagate copies. This includes copies and constants. Return
- nonzero if a change was made. */
-
-static int
-cprop (int alter_jumps)
-{
- int changed;
- basic_block bb;
- rtx insn;
-
- /* Note we start at block 1. */
- if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR)
- {
- if (dump_file != NULL)
- fprintf (dump_file, "\n");
- return 0;
- }
-
- changed = 0;
- FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb)
- {
- /* Reset tables used to keep track of what's still valid [since the
- start of the block]. */
- reset_opr_set_tables ();
-
- FOR_BB_INSNS (bb, insn)
- if (INSN_P (insn))
- {
- changed |= cprop_insn (insn, alter_jumps);
-
- /* Keep track of everything modified by this insn. */
- /* ??? Need to be careful w.r.t. mods done to INSN. Don't
- call mark_oprs_set if we turned the insn into a NOTE. */
- if (! NOTE_P (insn))
- mark_oprs_set (insn);
- }
- }
-
- if (dump_file != NULL)
- fprintf (dump_file, "\n");
-
return changed;
}
@@ -3060,7 +2813,12 @@ implicit_set_cond_p (const_rtx cond)
following "if (x == 2)", the then branch may be optimized as though the
conditional performed an "explicit set", in this example, "x = 2". This
function records the set patterns that are implicit at the start of each
- basic block. */
+ basic block.
+
+ FIXME: This would be more effective if critical edges are pre-split. As
+ it is now, we can't record implicit sets for blocks that have
+ critical successor edges. This results in missed optimizations
+ and in more (unnecessary) work in cfgcleanup.c:thread_jump(). */
static void
find_implicit_sets (void)
@@ -3085,7 +2843,9 @@ find_implicit_sets (void)
dest = GET_CODE (cond) == EQ ? BRANCH_EDGE (bb)->dest
: FALLTHRU_EDGE (bb)->dest;
- if (dest && single_pred_p (dest)
+ if (dest
+ /* Record nothing for a critical edge. */
+ && single_pred_p (dest)
&& dest != EXIT_BLOCK_PTR)
{
new_rtx = gen_rtx_SET (VOIDmode, XEXP (cond, 0),
@@ -3106,63 +2866,6 @@ find_implicit_sets (void)
fprintf (dump_file, "Found %d implicit sets\n", count);
}
-/* Perform one copy/constant propagation pass.
- PASS is the pass count. If CPROP_JUMPS is true, perform constant
- propagation into conditional jumps. If BYPASS_JUMPS is true,
- perform conditional jump bypassing optimizations. */
-
-static int
-one_cprop_pass (int pass, bool cprop_jumps, bool bypass_jumps)
-{
- int changed = 0;
-
- global_const_prop_count = local_const_prop_count = 0;
- global_copy_prop_count = local_copy_prop_count = 0;
-
- if (cprop_jumps)
- local_cprop_pass (cprop_jumps);
-
- /* Determine implicit sets. */
- implicit_sets = XCNEWVEC (rtx, last_basic_block);
- find_implicit_sets ();
-
- alloc_hash_table (get_max_uid (), &set_hash_table, 1);
- compute_hash_table (&set_hash_table);
-
- /* Free implicit_sets before peak usage. */
- free (implicit_sets);
- implicit_sets = NULL;
-
- if (dump_file)
- dump_hash_table (dump_file, "SET", &set_hash_table);
- if (set_hash_table.n_elems > 0)
- {
- alloc_cprop_mem (last_basic_block, set_hash_table.n_elems);
- compute_cprop_data ();
- changed = cprop (cprop_jumps);
- if (bypass_jumps)
- changed |= bypass_conditional_jumps ();
- free_cprop_mem ();
- }
-
- free_hash_table (&set_hash_table);
-
- if (dump_file)
- {
- fprintf (dump_file, "CPROP of %s, pass %d: %d bytes needed, ",
- current_function_name (), pass, bytes_used);
- fprintf (dump_file, "%d local const props, %d local copy props, ",
- local_const_prop_count, local_copy_prop_count);
- fprintf (dump_file, "%d global const props, %d global copy props\n\n",
- global_const_prop_count, global_copy_prop_count);
- }
- /* Global analysis may get into infinite loops for unreachable blocks. */
- if (changed && cprop_jumps)
- delete_unreachable_blocks ();
-
- return changed;
-}
-
/* Bypass conditional jumps. */
/* The value of last_basic_block at the beginning of the jump_bypass
@@ -3302,9 +3005,6 @@ bypass_block (basic_block bb, rtx setcc, rtx jump)
struct expr *set;
rtx src, new_rtx;
- if (regno >= max_gcse_regno)
- continue;
-
set = find_bypass_set (regno, e->src->index);
if (! set)
@@ -3888,7 +3588,7 @@ pre_edge_insert (struct edge_list *edge_list, struct expr **index_map)
if (dump_file)
{
- fprintf (dump_file, "PRE/HOIST: edge (%d,%d), ",
+ fprintf (dump_file, "PRE: edge (%d,%d), ",
bb->index,
INDEX_EDGE_SUCC_BB (edge_list, e)->index);
fprintf (dump_file, "copy expression %d\n",
@@ -4232,13 +3932,25 @@ pre_gcse (void)
Return nonzero if a change was made. */
static int
-one_pre_gcse_pass (int pass)
+one_pre_gcse_pass (void)
{
int changed = 0;
gcse_subst_count = 0;
gcse_create_count = 0;
+ /* Return if there's nothing to do, or it is too expensive. */
+ if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
+ || is_too_expensive (_("PRE disabled")))
+ return 0;
+
+ /* We need alias. */
+ init_alias_analysis ();
+
+ bytes_used = 0;
+ gcc_obstack_init (&gcse_obstack);
+ alloc_gcse_mem ();
+
alloc_hash_table (get_max_uid (), &expr_hash_table, 0);
add_noreturn_fake_exit_edges ();
if (flag_gcse_lm)
@@ -4262,10 +3974,16 @@ one_pre_gcse_pass (int pass)
remove_fake_exit_edges ();
free_hash_table (&expr_hash_table);
+ free_gcse_mem ();
+ obstack_free (&gcse_obstack, NULL);
+
+ /* We are finished with alias. */
+ end_alias_analysis ();
+
if (dump_file)
{
- fprintf (dump_file, "\nPRE GCSE of %s, pass %d: %d bytes needed, ",
- current_function_name (), pass, bytes_used);
+ fprintf (dump_file, "PRE GCSE of %s, %d basic blocks, %d bytes needed, ",
+ current_function_name (), n_basic_blocks, bytes_used);
fprintf (dump_file, "%d substs, %d insns created\n",
gcse_subst_count, gcse_create_count);
}
@@ -4530,7 +4248,7 @@ hoist_expr_reaches_here_p (basic_block expr_bb, int expr_index, basic_block bb,
/* Actually perform code hoisting. */
-static void
+static int
hoist_code (void)
{
basic_block bb, dominated;
@@ -4538,6 +4256,7 @@ hoist_code (void)
unsigned int i,j;
struct expr **index_map;
struct expr *expr;
+ int changed = 0;
sbitmap_vector_zero (hoist_exprs, last_basic_block);
@@ -4669,6 +4388,9 @@ hoist_code (void)
gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn);
delete_insn (insn);
occr->deleted_p = 1;
+ changed = 1;
+ gcse_subst_count++;
+
if (!insn_inserted_p)
{
insert_insn_end_basic_block (index_map[i], bb, 0);
@@ -4682,6 +4404,8 @@ hoist_code (void)
}
free (index_map);
+
+ return changed;
}
/* Top level routine to perform one code hoisting (aka unification) pass
@@ -4693,6 +4417,21 @@ one_code_hoisting_pass (void)
{
int changed = 0;
+ gcse_subst_count = 0;
+ gcse_create_count = 0;
+
+ /* Return if there's nothing to do, or it is too expensive. */
+ if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
+ || is_too_expensive (_("GCSE disabled")))
+ return 0;
+
+ /* We need alias. */
+ init_alias_analysis ();
+
+ bytes_used = 0;
+ gcc_obstack_init (&gcse_obstack);
+ alloc_gcse_mem ();
+
alloc_hash_table (get_max_uid (), &expr_hash_table, 0);
compute_hash_table (&expr_hash_table);
if (dump_file)
@@ -4702,11 +4441,24 @@ one_code_hoisting_pass (void)
{
alloc_code_hoist_mem (last_basic_block, expr_hash_table.n_elems);
compute_code_hoist_data ();
- hoist_code ();
+ changed = hoist_code ();
free_code_hoist_mem ();
}
free_hash_table (&expr_hash_table);
+ free_gcse_mem ();
+ obstack_free (&gcse_obstack, NULL);
+
+ /* We are finished with alias. */
+ end_alias_analysis ();
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "HOIST of %s, %d basic blocks, %d bytes needed, ",
+ current_function_name (), n_basic_blocks, bytes_used);
+ fprintf (dump_file, "%d substs, %d insns created\n",
+ gcse_subst_count, gcse_create_count);
+ }
return changed;
}
@@ -4873,20 +4625,6 @@ find_rtx_in_ldst (rtx x)
return (struct ls_expr *) *slot;
}
-/* Assign each element of the list of mems a monotonically increasing value. */
-
-static int
-enumerate_ldsts (void)
-{
- struct ls_expr * ptr;
- int n = 0;
-
- for (ptr = pre_ldst_mems; ptr != NULL; ptr = ptr->next)
- ptr->index = n++;
-
- return n;
-}
-
/* Return first item in the list. */
static inline struct ls_expr *
@@ -5032,7 +4770,7 @@ compute_ld_motion_mems (void)
&& GET_CODE (src) != ASM_OPERANDS
/* Check for REG manually since want_to_gcse_p
returns 0 for all REGs. */
- && can_assign_to_reg_p (src))
+ && can_assign_to_reg_without_clobbers_p (src))
ptr->stores = alloc_INSN_LIST (insn, ptr->stores);
else
ptr->invalid = 1;
@@ -5151,1268 +4889,270 @@ update_ld_motion_stores (struct expr * expr)
}
}
-/* Store motion code. */
-
-#define ANTIC_STORE_LIST(x) ((x)->loads)
-#define AVAIL_STORE_LIST(x) ((x)->stores)
-#define LAST_AVAIL_CHECK_FAILURE(x) ((x)->reaching_reg)
-
-/* This is used to communicate the target bitvector we want to use in the
- reg_set_info routine when called via the note_stores mechanism. */
-static int * regvec;
-
-/* And current insn, for the same routine. */
-static rtx compute_store_table_current_insn;
-
-/* Used in computing the reverse edge graph bit vectors. */
-static sbitmap * st_antloc;
-
-/* Global holding the number of store expressions we are dealing with. */
-static int num_stores;
-
-/* Checks to set if we need to mark a register set. Called from
- note_stores. */
-
-static void
-reg_set_info (rtx dest, const_rtx setter ATTRIBUTE_UNUSED,
- void *data ATTRIBUTE_UNUSED)
-{
- if (GET_CODE (dest) == SUBREG)
- dest = SUBREG_REG (dest);
-
- if (REG_P (dest))
- regvec[REGNO (dest)] = INSN_UID (compute_store_table_current_insn);
-}
-
-/* Clear any mark that says that this insn sets dest. Called from
- note_stores. */
-
-static void
-reg_clear_last_set (rtx dest, const_rtx setter ATTRIBUTE_UNUSED,
- void *data)
-{
- int *dead_vec = (int *) data;
-
- if (GET_CODE (dest) == SUBREG)
- dest = SUBREG_REG (dest);
-
- if (REG_P (dest) &&
- dead_vec[REGNO (dest)] == INSN_UID (compute_store_table_current_insn))
- dead_vec[REGNO (dest)] = 0;
-}
-
-/* Return zero if some of the registers in list X are killed
- due to set of registers in bitmap REGS_SET. */
-
-static bool
-store_ops_ok (const_rtx x, int *regs_set)
-{
- const_rtx reg;
-
- for (; x; x = XEXP (x, 1))
- {
- reg = XEXP (x, 0);
- if (regs_set[REGNO(reg)])
- return false;
- }
-
- return true;
-}
-
-/* Returns a list of registers mentioned in X. */
-static rtx
-extract_mentioned_regs (rtx x)
-{
- return extract_mentioned_regs_helper (x, NULL_RTX);
-}
-
-/* Helper for extract_mentioned_regs; ACCUM is used to accumulate used
- registers. */
-static rtx
-extract_mentioned_regs_helper (rtx x, rtx accum)
-{
- int i;
- enum rtx_code code;
- const char * fmt;
-
- /* Repeat is used to turn tail-recursion into iteration. */
- repeat:
-
- if (x == 0)
- return accum;
-
- code = GET_CODE (x);
- switch (code)
- {
- case REG:
- return alloc_EXPR_LIST (0, x, accum);
-
- case MEM:
- x = XEXP (x, 0);
- goto repeat;
-
- case PRE_DEC:
- case PRE_INC:
- case PRE_MODIFY:
- case POST_DEC:
- case POST_INC:
- case POST_MODIFY:
- /* We do not run this function with arguments having side effects. */
- gcc_unreachable ();
-
- case PC:
- case CC0: /*FIXME*/
- case CONST:
- case CONST_INT:
- case CONST_DOUBLE:
- case CONST_FIXED:
- case CONST_VECTOR:
- case SYMBOL_REF:
- case LABEL_REF:
- case ADDR_VEC:
- case ADDR_DIFF_VEC:
- return accum;
-
- default:
- break;
- }
-
- i = GET_RTX_LENGTH (code) - 1;
- fmt = GET_RTX_FORMAT (code);
-
- for (; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- {
- rtx tem = XEXP (x, i);
-
- /* If we are about to do the last recursive call
- needed at this level, change it into iteration. */
- if (i == 0)
- {
- x = tem;
- goto repeat;
- }
-
- accum = extract_mentioned_regs_helper (tem, accum);
- }
- else if (fmt[i] == 'E')
- {
- int j;
-
- for (j = 0; j < XVECLEN (x, i); j++)
- accum = extract_mentioned_regs_helper (XVECEXP (x, i, j), accum);
- }
- }
-
- return accum;
-}
-
-/* Determine whether INSN is MEM store pattern that we will consider moving.
- REGS_SET_BEFORE is bitmap of registers set before (and including) the
- current insn, REGS_SET_AFTER is bitmap of registers set after (and
- including) the insn in this basic block. We must be passing through BB from
- head to end, as we are using this fact to speed things up.
-
- The results are stored this way:
-
- -- the first anticipatable expression is added into ANTIC_STORE_LIST
- -- if the processed expression is not anticipatable, NULL_RTX is added
- there instead, so that we can use it as indicator that no further
- expression of this type may be anticipatable
- -- if the expression is available, it is added as head of AVAIL_STORE_LIST;
- consequently, all of them but this head are dead and may be deleted.
- -- if the expression is not available, the insn due to that it fails to be
- available is stored in reaching_reg.
-
- The things are complicated a bit by fact that there already may be stores
- to the same MEM from other blocks; also caller must take care of the
- necessary cleanup of the temporary markers after end of the basic block.
- */
-
-static void
-find_moveable_store (rtx insn, int *regs_set_before, int *regs_set_after)
-{
- struct ls_expr * ptr;
- rtx dest, set, tmp;
- int check_anticipatable, check_available;
- basic_block bb = BLOCK_FOR_INSN (insn);
-
- set = single_set (insn);
- if (!set)
- return;
-
- dest = SET_DEST (set);
-
- if (! MEM_P (dest) || MEM_VOLATILE_P (dest)
- || GET_MODE (dest) == BLKmode)
- return;
-
- if (side_effects_p (dest))
- return;
-
- /* If we are handling exceptions, we must be careful with memory references
- that may trap. If we are not, the behavior is undefined, so we may just
- continue. */
- if (flag_non_call_exceptions && may_trap_p (dest))
- return;
-
- /* Even if the destination cannot trap, the source may. In this case we'd
- need to handle updating the REG_EH_REGION note. */
- if (find_reg_note (insn, REG_EH_REGION, NULL_RTX))
- return;
-
- /* Make sure that the SET_SRC of this store insns can be assigned to
- a register, or we will fail later on in replace_store_insn, which
- assumes that we can do this. But sometimes the target machine has
- oddities like MEM read-modify-write instruction. See for example
- PR24257. */
- if (!can_assign_to_reg_p (SET_SRC (set)))
- return;
-
- ptr = ldst_entry (dest);
- if (!ptr->pattern_regs)
- ptr->pattern_regs = extract_mentioned_regs (dest);
-
- /* Do not check for anticipatability if we either found one anticipatable
- store already, or tested for one and found out that it was killed. */
- check_anticipatable = 0;
- if (!ANTIC_STORE_LIST (ptr))
- check_anticipatable = 1;
- else
- {
- tmp = XEXP (ANTIC_STORE_LIST (ptr), 0);
- if (tmp != NULL_RTX
- && BLOCK_FOR_INSN (tmp) != bb)
- check_anticipatable = 1;
- }
- if (check_anticipatable)
- {
- if (store_killed_before (dest, ptr->pattern_regs, insn, bb, regs_set_before))
- tmp = NULL_RTX;
- else
- tmp = insn;
- ANTIC_STORE_LIST (ptr) = alloc_INSN_LIST (tmp,
- ANTIC_STORE_LIST (ptr));
- }
-
- /* It is not necessary to check whether store is available if we did
- it successfully before; if we failed before, do not bother to check
- until we reach the insn that caused us to fail. */
- check_available = 0;
- if (!AVAIL_STORE_LIST (ptr))
- check_available = 1;
- else
- {
- tmp = XEXP (AVAIL_STORE_LIST (ptr), 0);
- if (BLOCK_FOR_INSN (tmp) != bb)
- check_available = 1;
- }
- if (check_available)
- {
- /* Check that we have already reached the insn at that the check
- failed last time. */
- if (LAST_AVAIL_CHECK_FAILURE (ptr))
- {
- for (tmp = BB_END (bb);
- tmp != insn && tmp != LAST_AVAIL_CHECK_FAILURE (ptr);
- tmp = PREV_INSN (tmp))
- continue;
- if (tmp == insn)
- check_available = 0;
- }
- else
- check_available = store_killed_after (dest, ptr->pattern_regs, insn,
- bb, regs_set_after,
- &LAST_AVAIL_CHECK_FAILURE (ptr));
- }
- if (!check_available)
- AVAIL_STORE_LIST (ptr) = alloc_INSN_LIST (insn, AVAIL_STORE_LIST (ptr));
-}
-
-/* Find available and anticipatable stores. */
-
-static int
-compute_store_table (void)
-{
- int ret;
- basic_block bb;
- unsigned regno;
- rtx insn, pat, tmp;
- int *last_set_in, *already_set;
- struct ls_expr * ptr, **prev_next_ptr_ptr;
-
- max_gcse_regno = max_reg_num ();
-
- pre_ldst_mems = 0;
- pre_ldst_table = htab_create (13, pre_ldst_expr_hash,
- pre_ldst_expr_eq, NULL);
- last_set_in = XCNEWVEC (int, max_gcse_regno);
- already_set = XNEWVEC (int, max_gcse_regno);
-
- /* Find all the stores we care about. */
- FOR_EACH_BB (bb)
- {
- /* First compute the registers set in this block. */
- regvec = last_set_in;
-
- FOR_BB_INSNS (bb, insn)
- {
- if (! INSN_P (insn))
- continue;
-
- if (CALL_P (insn))
- {
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
- last_set_in[regno] = INSN_UID (insn);
- }
-
- pat = PATTERN (insn);
- compute_store_table_current_insn = insn;
- note_stores (pat, reg_set_info, NULL);
- }
-
- /* Now find the stores. */
- memset (already_set, 0, sizeof (int) * max_gcse_regno);
- regvec = already_set;
- FOR_BB_INSNS (bb, insn)
- {
- if (! INSN_P (insn))
- continue;
-
- if (CALL_P (insn))
- {
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno))
- already_set[regno] = 1;
- }
-
- pat = PATTERN (insn);
- note_stores (pat, reg_set_info, NULL);
-
- /* Now that we've marked regs, look for stores. */
- find_moveable_store (insn, already_set, last_set_in);
-
- /* Unmark regs that are no longer set. */
- compute_store_table_current_insn = insn;
- note_stores (pat, reg_clear_last_set, last_set_in);
- if (CALL_P (insn))
- {
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, regno)
- && last_set_in[regno] == INSN_UID (insn))
- last_set_in[regno] = 0;
- }
- }
-
-#ifdef ENABLE_CHECKING
- /* last_set_in should now be all-zero. */
- for (regno = 0; regno < max_gcse_regno; regno++)
- gcc_assert (!last_set_in[regno]);
-#endif
-
- /* Clear temporary marks. */
- for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
- {
- LAST_AVAIL_CHECK_FAILURE(ptr) = NULL_RTX;
- if (ANTIC_STORE_LIST (ptr)
- && (tmp = XEXP (ANTIC_STORE_LIST (ptr), 0)) == NULL_RTX)
- ANTIC_STORE_LIST (ptr) = XEXP (ANTIC_STORE_LIST (ptr), 1);
- }
- }
-
- /* Remove the stores that are not available anywhere, as there will
- be no opportunity to optimize them. */
- for (ptr = pre_ldst_mems, prev_next_ptr_ptr = &pre_ldst_mems;
- ptr != NULL;
- ptr = *prev_next_ptr_ptr)
- {
- if (!AVAIL_STORE_LIST (ptr))
- {
- *prev_next_ptr_ptr = ptr->next;
- htab_remove_elt_with_hash (pre_ldst_table, ptr, ptr->hash_index);
- free_ldst_entry (ptr);
- }
- else
- prev_next_ptr_ptr = &ptr->next;
- }
-
- ret = enumerate_ldsts ();
-
- if (dump_file)
- {
- fprintf (dump_file, "ST_avail and ST_antic (shown under loads..)\n");
- print_ldst_list (dump_file);
- }
-
- free (last_set_in);
- free (already_set);
- return ret;
-}
-
-/* Check to see if the load X is aliased with STORE_PATTERN.
- AFTER is true if we are checking the case when STORE_PATTERN occurs
- after the X. */
-
-static bool
-load_kills_store (const_rtx x, const_rtx store_pattern, int after)
-{
- if (after)
- return anti_dependence (x, store_pattern);
- else
- return true_dependence (store_pattern, GET_MODE (store_pattern), x,
- rtx_addr_varies_p);
-}
-
-/* Go through the entire insn X, looking for any loads which might alias
- STORE_PATTERN. Return true if found.
- AFTER is true if we are checking the case when STORE_PATTERN occurs
- after the insn X. */
-
-static bool
-find_loads (const_rtx x, const_rtx store_pattern, int after)
-{
- const char * fmt;
- int i, j;
- int ret = false;
-
- if (!x)
- return false;
-
- if (GET_CODE (x) == SET)
- x = SET_SRC (x);
-
- if (MEM_P (x))
- {
- if (load_kills_store (x, store_pattern, after))
- return true;
- }
-
- /* Recursively process the insn. */
- fmt = GET_RTX_FORMAT (GET_CODE (x));
-
- for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0 && !ret; i--)
- {
- if (fmt[i] == 'e')
- ret |= find_loads (XEXP (x, i), store_pattern, after);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- ret |= find_loads (XVECEXP (x, i, j), store_pattern, after);
- }
- return ret;
-}
-
-static inline bool
-store_killed_in_pat (const_rtx x, const_rtx pat, int after)
-{
- if (GET_CODE (pat) == SET)
- {
- rtx dest = SET_DEST (pat);
-
- if (GET_CODE (dest) == ZERO_EXTRACT)
- dest = XEXP (dest, 0);
-
- /* Check for memory stores to aliased objects. */
- if (MEM_P (dest)
- && !expr_equiv_p (dest, x))
- {
- if (after)
- {
- if (output_dependence (dest, x))
- return true;
- }
- else
- {
- if (output_dependence (x, dest))
- return true;
- }
- }
- }
-
- if (find_loads (pat, x, after))
- return true;
-
- return false;
-}
-
-/* Check if INSN kills the store pattern X (is aliased with it).
- AFTER is true if we are checking the case when store X occurs
- after the insn. Return true if it does. */
+/* Return true if the graph is too expensive to optimize. PASS is the
+ optimization about to be performed. */
static bool
-store_killed_in_insn (const_rtx x, const_rtx x_regs, const_rtx insn, int after)
+is_too_expensive (const char *pass)
{
- const_rtx reg, base, note, pat;
-
- if (!INSN_P (insn))
- return false;
+ /* Trying to perform global optimizations on flow graphs which have
+ a high connectivity will take a long time and is unlikely to be
+ particularly useful.
- if (CALL_P (insn))
+ In normal circumstances a cfg should have about twice as many
+ edges as blocks. But we do not want to punish small functions
+ which have a couple switch statements. Rather than simply
+ threshold the number of blocks, uses something with a more
+ graceful degradation. */
+ if (n_edges > 20000 + n_basic_blocks * 4)
{
- /* A normal or pure call might read from pattern,
- but a const call will not. */
- if (!RTL_CONST_CALL_P (insn))
- return true;
-
- /* But even a const call reads its parameters. Check whether the
- base of some of registers used in mem is stack pointer. */
- for (reg = x_regs; reg; reg = XEXP (reg, 1))
- {
- base = find_base_term (XEXP (reg, 0));
- if (!base
- || (GET_CODE (base) == ADDRESS
- && GET_MODE (base) == Pmode
- && XEXP (base, 0) == stack_pointer_rtx))
- return true;
- }
+ warning (OPT_Wdisabled_optimization,
+ "%s: %d basic blocks and %d edges/basic block",
+ pass, n_basic_blocks, n_edges / n_basic_blocks);
- return false;
+ return true;
}
- pat = PATTERN (insn);
- if (GET_CODE (pat) == SET)
- {
- if (store_killed_in_pat (x, pat, after))
- return true;
- }
- else if (GET_CODE (pat) == PARALLEL)
+ /* If allocating memory for the cprop bitmap would take up too much
+ storage it's better just to disable the optimization. */
+ if ((n_basic_blocks
+ * SBITMAP_SET_SIZE (max_reg_num ())
+ * sizeof (SBITMAP_ELT_TYPE)) > MAX_GCSE_MEMORY)
{
- int i;
-
- for (i = 0; i < XVECLEN (pat, 0); i++)
- if (store_killed_in_pat (x, XVECEXP (pat, 0, i), after))
- return true;
- }
- else if (find_loads (PATTERN (insn), x, after))
- return true;
-
- /* If this insn has a REG_EQUAL or REG_EQUIV note referencing a memory
- location aliased with X, then this insn kills X. */
- note = find_reg_equal_equiv_note (insn);
- if (! note)
- return false;
- note = XEXP (note, 0);
-
- /* However, if the note represents a must alias rather than a may
- alias relationship, then it does not kill X. */
- if (expr_equiv_p (note, x))
- return false;
-
- /* See if there are any aliased loads in the note. */
- return find_loads (note, x, after);
-}
-
-/* Returns true if the expression X is loaded or clobbered on or after INSN
- within basic block BB. REGS_SET_AFTER is bitmap of registers set in
- or after the insn. X_REGS is list of registers mentioned in X. If the store
- is killed, return the last insn in that it occurs in FAIL_INSN. */
-
-static bool
-store_killed_after (const_rtx x, const_rtx x_regs, const_rtx insn, const_basic_block bb,
- int *regs_set_after, rtx *fail_insn)
-{
- rtx last = BB_END (bb), act;
+ warning (OPT_Wdisabled_optimization,
+ "%s: %d basic blocks and %d registers",
+ pass, n_basic_blocks, max_reg_num ());
- if (!store_ops_ok (x_regs, regs_set_after))
- {
- /* We do not know where it will happen. */
- if (fail_insn)
- *fail_insn = NULL_RTX;
return true;
}
- /* Scan from the end, so that fail_insn is determined correctly. */
- for (act = last; act != PREV_INSN (insn); act = PREV_INSN (act))
- if (store_killed_in_insn (x, x_regs, act, false))
- {
- if (fail_insn)
- *fail_insn = act;
- return true;
- }
-
return false;
}
-/* Returns true if the expression X is loaded or clobbered on or before INSN
- within basic block BB. X_REGS is list of registers mentioned in X.
- REGS_SET_BEFORE is bitmap of registers set before or in this insn. */
-static bool
-store_killed_before (const_rtx x, const_rtx x_regs, const_rtx insn, const_basic_block bb,
- int *regs_set_before)
-{
- rtx first = BB_HEAD (bb);
-
- if (!store_ops_ok (x_regs, regs_set_before))
- return true;
-
- for ( ; insn != PREV_INSN (first); insn = PREV_INSN (insn))
- if (store_killed_in_insn (x, x_regs, insn, true))
- return true;
-
- return false;
-}
-
-/* Fill in available, anticipatable, transparent and kill vectors in
- STORE_DATA, based on lists of available and anticipatable stores. */
-static void
-build_store_vectors (void)
-{
- basic_block bb;
- int *regs_set_in_block;
- rtx insn, st;
- struct ls_expr * ptr;
-
- /* Build the gen_vector. This is any store in the table which is not killed
- by aliasing later in its block. */
- ae_gen = sbitmap_vector_alloc (last_basic_block, num_stores);
- sbitmap_vector_zero (ae_gen, last_basic_block);
-
- st_antloc = sbitmap_vector_alloc (last_basic_block, num_stores);
- sbitmap_vector_zero (st_antloc, last_basic_block);
-
- for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
- {
- for (st = AVAIL_STORE_LIST (ptr); st != NULL; st = XEXP (st, 1))
- {
- insn = XEXP (st, 0);
- bb = BLOCK_FOR_INSN (insn);
-
- /* If we've already seen an available expression in this block,
- we can delete this one (It occurs earlier in the block). We'll
- copy the SRC expression to an unused register in case there
- are any side effects. */
- if (TEST_BIT (ae_gen[bb->index], ptr->index))
- {
- rtx r = gen_reg_rtx_and_attrs (ptr->pattern);
- if (dump_file)
- fprintf (dump_file, "Removing redundant store:\n");
- replace_store_insn (r, XEXP (st, 0), bb, ptr);
- continue;
- }
- SET_BIT (ae_gen[bb->index], ptr->index);
- }
-
- for (st = ANTIC_STORE_LIST (ptr); st != NULL; st = XEXP (st, 1))
- {
- insn = XEXP (st, 0);
- bb = BLOCK_FOR_INSN (insn);
- SET_BIT (st_antloc[bb->index], ptr->index);
- }
- }
-
- ae_kill = sbitmap_vector_alloc (last_basic_block, num_stores);
- sbitmap_vector_zero (ae_kill, last_basic_block);
-
- transp = sbitmap_vector_alloc (last_basic_block, num_stores);
- sbitmap_vector_zero (transp, last_basic_block);
- regs_set_in_block = XNEWVEC (int, max_gcse_regno);
-
- FOR_EACH_BB (bb)
- {
- FOR_BB_INSNS (bb, insn)
- if (INSN_P (insn))
- {
- df_ref *def_rec;
- for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
- {
- unsigned int ref_regno = DF_REF_REGNO (*def_rec);
- if (ref_regno < max_gcse_regno)
- regs_set_in_block[DF_REF_REGNO (*def_rec)] = 1;
- }
- }
-
- for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
- {
- if (store_killed_after (ptr->pattern, ptr->pattern_regs, BB_HEAD (bb),
- bb, regs_set_in_block, NULL))
- {
- /* It should not be necessary to consider the expression
- killed if it is both anticipatable and available. */
- if (!TEST_BIT (st_antloc[bb->index], ptr->index)
- || !TEST_BIT (ae_gen[bb->index], ptr->index))
- SET_BIT (ae_kill[bb->index], ptr->index);
- }
- else
- SET_BIT (transp[bb->index], ptr->index);
- }
- }
-
- free (regs_set_in_block);
-
- if (dump_file)
- {
- dump_sbitmap_vector (dump_file, "st_antloc", "", st_antloc, last_basic_block);
- dump_sbitmap_vector (dump_file, "st_kill", "", ae_kill, last_basic_block);
- dump_sbitmap_vector (dump_file, "Transpt", "", transp, last_basic_block);
- dump_sbitmap_vector (dump_file, "st_avloc", "", ae_gen, last_basic_block);
- }
-}
-
-/* Insert an instruction at the beginning of a basic block, and update
- the BB_HEAD if needed. */
-
-static void
-insert_insn_start_basic_block (rtx insn, basic_block bb)
-{
- /* Insert at start of successor block. */
- rtx prev = PREV_INSN (BB_HEAD (bb));
- rtx before = BB_HEAD (bb);
- while (before != 0)
- {
- if (! LABEL_P (before)
- && !NOTE_INSN_BASIC_BLOCK_P (before))
- break;
- prev = before;
- if (prev == BB_END (bb))
- break;
- before = NEXT_INSN (before);
- }
-
- insn = emit_insn_after_noloc (insn, prev, bb);
-
- if (dump_file)
- {
- fprintf (dump_file, "STORE_MOTION insert store at start of BB %d:\n",
- bb->index);
- print_inline_rtx (dump_file, insn, 6);
- fprintf (dump_file, "\n");
- }
-}
-
-/* This routine will insert a store on an edge. EXPR is the ldst entry for
- the memory reference, and E is the edge to insert it on. Returns nonzero
- if an edge insertion was performed. */
+
+/* Main function for the CPROP pass. */
static int
-insert_store (struct ls_expr * expr, edge e)
+one_cprop_pass (void)
{
- rtx reg, insn;
- basic_block bb;
- edge tmp;
- edge_iterator ei;
-
- /* We did all the deleted before this insert, so if we didn't delete a
- store, then we haven't set the reaching reg yet either. */
- if (expr->reaching_reg == NULL_RTX)
- return 0;
+ int changed = 0;
- if (e->flags & EDGE_FAKE)
+ /* Return if there's nothing to do, or it is too expensive. */
+ if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
+ || is_too_expensive (_ ("const/copy propagation disabled")))
return 0;
- reg = expr->reaching_reg;
- insn = gen_move_insn (copy_rtx (expr->pattern), reg);
+ global_const_prop_count = local_const_prop_count = 0;
+ global_copy_prop_count = local_copy_prop_count = 0;
- /* If we are inserting this expression on ALL predecessor edges of a BB,
- insert it at the start of the BB, and reset the insert bits on the other
- edges so we don't try to insert it on the other edges. */
- bb = e->dest;
- FOR_EACH_EDGE (tmp, ei, e->dest->preds)
- if (!(tmp->flags & EDGE_FAKE))
- {
- int index = EDGE_INDEX (edge_list, tmp->src, tmp->dest);
-
- gcc_assert (index != EDGE_INDEX_NO_EDGE);
- if (! TEST_BIT (pre_insert_map[index], expr->index))
- break;
- }
+ bytes_used = 0;
+ gcc_obstack_init (&gcse_obstack);
+ alloc_gcse_mem ();
- /* If tmp is NULL, we found an insertion on every edge, blank the
- insertion vector for these edges, and insert at the start of the BB. */
- if (!tmp && bb != EXIT_BLOCK_PTR)
+ /* Do a local const/copy propagation pass first. The global pass
+ only handles global opportunities.
+ If the local pass changes something, remove any unreachable blocks
+ because the CPROP global dataflow analysis may get into infinite
+ loops for CFGs with unreachable blocks.
+
+ FIXME: This local pass should not be necessary after CSE (but for
+ some reason it still is). It is also (proven) not necessary
+ to run the local pass right after FWPWOP.
+
+ FIXME: The global analysis would not get into infinite loops if it
+ would use the DF solver (via df_simple_dataflow) instead of
+ the solver implemented in this file. */
+ if (local_cprop_pass ())
{
- FOR_EACH_EDGE (tmp, ei, e->dest->preds)
- {
- int index = EDGE_INDEX (edge_list, tmp->src, tmp->dest);
- RESET_BIT (pre_insert_map[index], expr->index);
- }
- insert_insn_start_basic_block (insn, bb);
- return 0;
+ delete_unreachable_blocks ();
+ df_analyze ();
}
- /* We can't put stores in the front of blocks pointed to by abnormal
- edges since that may put a store where one didn't used to be. */
- gcc_assert (!(e->flags & EDGE_ABNORMAL));
+ /* Determine implicit sets. */
+ implicit_sets = XCNEWVEC (rtx, last_basic_block);
+ find_implicit_sets ();
- insert_insn_on_edge (insn, e);
+ alloc_hash_table (get_max_uid (), &set_hash_table, 1);
+ compute_hash_table (&set_hash_table);
+
+ /* Free implicit_sets before peak usage. */
+ free (implicit_sets);
+ implicit_sets = NULL;
if (dump_file)
+ dump_hash_table (dump_file, "SET", &set_hash_table);
+ if (set_hash_table.n_elems > 0)
{
- fprintf (dump_file, "STORE_MOTION insert insn on edge (%d, %d):\n",
- e->src->index, e->dest->index);
- print_inline_rtx (dump_file, insn, 6);
- fprintf (dump_file, "\n");
- }
-
- return 1;
-}
-
-/* Remove any REG_EQUAL or REG_EQUIV notes containing a reference to the
- memory location in SMEXPR set in basic block BB.
-
- This could be rather expensive. */
-
-static void
-remove_reachable_equiv_notes (basic_block bb, struct ls_expr *smexpr)
-{
- edge_iterator *stack, ei;
- int sp;
- edge act;
- sbitmap visited = sbitmap_alloc (last_basic_block);
- rtx last, insn, note;
- rtx mem = smexpr->pattern;
-
- stack = XNEWVEC (edge_iterator, n_basic_blocks);
- sp = 0;
- ei = ei_start (bb->succs);
-
- sbitmap_zero (visited);
+ basic_block bb;
+ rtx insn;
- act = (EDGE_COUNT (ei_container (ei)) > 0 ? EDGE_I (ei_container (ei), 0) : NULL);
- while (1)
- {
- if (!act)
- {
- if (!sp)
- {
- free (stack);
- sbitmap_free (visited);
- return;
- }
- act = ei_edge (stack[--sp]);
- }
- bb = act->dest;
+ alloc_cprop_mem (last_basic_block, set_hash_table.n_elems);
+ compute_cprop_data ();
- if (bb == EXIT_BLOCK_PTR
- || TEST_BIT (visited, bb->index))
+ FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb, EXIT_BLOCK_PTR, next_bb)
{
- if (!ei_end_p (ei))
- ei_next (&ei);
- act = (! ei_end_p (ei)) ? ei_edge (ei) : NULL;
- continue;
- }
- SET_BIT (visited, bb->index);
+ /* Reset tables used to keep track of what's still valid [since
+ the start of the block]. */
+ reset_opr_set_tables ();
- if (TEST_BIT (st_antloc[bb->index], smexpr->index))
- {
- for (last = ANTIC_STORE_LIST (smexpr);
- BLOCK_FOR_INSN (XEXP (last, 0)) != bb;
- last = XEXP (last, 1))
- continue;
- last = XEXP (last, 0);
+ FOR_BB_INSNS (bb, insn)
+ if (INSN_P (insn))
+ {
+ changed |= cprop_insn (insn);
+
+ /* Keep track of everything modified by this insn. */
+ /* ??? Need to be careful w.r.t. mods done to INSN.
+ Don't call mark_oprs_set if we turned the
+ insn into a NOTE. */
+ if (! NOTE_P (insn))
+ mark_oprs_set (insn);
+ }
}
- else
- last = NEXT_INSN (BB_END (bb));
-
- for (insn = BB_HEAD (bb); insn != last; insn = NEXT_INSN (insn))
- if (INSN_P (insn))
- {
- note = find_reg_equal_equiv_note (insn);
- if (!note || !expr_equiv_p (XEXP (note, 0), mem))
- continue;
- if (dump_file)
- fprintf (dump_file, "STORE_MOTION drop REG_EQUAL note at insn %d:\n",
- INSN_UID (insn));
- remove_note (insn, note);
- }
-
- if (!ei_end_p (ei))
- ei_next (&ei);
- act = (! ei_end_p (ei)) ? ei_edge (ei) : NULL;
-
- if (EDGE_COUNT (bb->succs) > 0)
- {
- if (act)
- stack[sp++] = ei;
- ei = ei_start (bb->succs);
- act = (EDGE_COUNT (ei_container (ei)) > 0 ? EDGE_I (ei_container (ei), 0) : NULL);
- }
+ changed |= bypass_conditional_jumps ();
+ free_cprop_mem ();
}
-}
-
-/* This routine will replace a store with a SET to a specified register. */
-
-static void
-replace_store_insn (rtx reg, rtx del, basic_block bb, struct ls_expr *smexpr)
-{
- rtx insn, mem, note, set, ptr;
-
- mem = smexpr->pattern;
- insn = gen_move_insn (reg, SET_SRC (single_set (del)));
- for (ptr = ANTIC_STORE_LIST (smexpr); ptr; ptr = XEXP (ptr, 1))
- if (XEXP (ptr, 0) == del)
- {
- XEXP (ptr, 0) = insn;
- break;
- }
-
- /* Move the notes from the deleted insn to its replacement. */
- REG_NOTES (insn) = REG_NOTES (del);
-
- /* Emit the insn AFTER all the notes are transferred.
- This is cheaper since we avoid df rescanning for the note change. */
- insn = emit_insn_after (insn, del);
+ free_hash_table (&set_hash_table);
+ free_gcse_mem ();
+ obstack_free (&gcse_obstack, NULL);
if (dump_file)
{
- fprintf (dump_file,
- "STORE_MOTION delete insn in BB %d:\n ", bb->index);
- print_inline_rtx (dump_file, del, 6);
- fprintf (dump_file, "\nSTORE MOTION replaced with insn:\n ");
- print_inline_rtx (dump_file, insn, 6);
- fprintf (dump_file, "\n");
+ fprintf (dump_file, "CPROP of %s, %d basic blocks, %d bytes needed, ",
+ current_function_name (), n_basic_blocks, bytes_used);
+ fprintf (dump_file, "%d local const props, %d local copy props, ",
+ local_const_prop_count, local_copy_prop_count);
+ fprintf (dump_file, "%d global const props, %d global copy props\n\n",
+ global_const_prop_count, global_copy_prop_count);
}
- delete_insn (del);
-
- /* Now we must handle REG_EQUAL notes whose contents is equal to the mem;
- they are no longer accurate provided that they are reached by this
- definition, so drop them. */
- for (; insn != NEXT_INSN (BB_END (bb)); insn = NEXT_INSN (insn))
- if (INSN_P (insn))
- {
- set = single_set (insn);
- if (!set)
- continue;
- if (expr_equiv_p (SET_DEST (set), mem))
- return;
- note = find_reg_equal_equiv_note (insn);
- if (!note || !expr_equiv_p (XEXP (note, 0), mem))
- continue;
-
- if (dump_file)
- fprintf (dump_file, "STORE_MOTION drop REG_EQUAL note at insn %d:\n",
- INSN_UID (insn));
- remove_note (insn, note);
- }
- remove_reachable_equiv_notes (bb, smexpr);
+ return changed;
}
+
+/* All the passes implemented in this file. Each pass has its
+ own gate and execute function, and at the end of the file a
+ pass definition for passes.c.
-/* Delete a store, but copy the value that would have been stored into
- the reaching_reg for later storing. */
+ We do not construct an accurate cfg in functions which call
+ setjmp, so none of these passes runs if the function calls
+ setjmp.
+ FIXME: Should just handle setjmp via REG_SETJMP notes. */
-static void
-delete_store (struct ls_expr * expr, basic_block bb)
+static bool
+gate_rtl_cprop (void)
{
- rtx reg, i, del;
-
- if (expr->reaching_reg == NULL_RTX)
- expr->reaching_reg = gen_reg_rtx_and_attrs (expr->pattern);
-
- reg = expr->reaching_reg;
-
- for (i = AVAIL_STORE_LIST (expr); i; i = XEXP (i, 1))
- {
- del = XEXP (i, 0);
- if (BLOCK_FOR_INSN (del) == bb)
- {
- /* We know there is only one since we deleted redundant
- ones during the available computation. */
- replace_store_insn (reg, del, bb, expr);
- break;
- }
- }
+ return optimize > 0 && flag_gcse
+ && !cfun->calls_setjmp
+ && dbg_cnt (cprop);
}
-/* Free memory used by store motion. */
-
-static void
-free_store_memory (void)
+static unsigned int
+execute_rtl_cprop (void)
{
- free_ldst_mems ();
-
- if (ae_gen)
- sbitmap_vector_free (ae_gen);
- if (ae_kill)
- sbitmap_vector_free (ae_kill);
- if (transp)
- sbitmap_vector_free (transp);
- if (st_antloc)
- sbitmap_vector_free (st_antloc);
- if (pre_insert_map)
- sbitmap_vector_free (pre_insert_map);
- if (pre_delete_map)
- sbitmap_vector_free (pre_delete_map);
-
- ae_gen = ae_kill = transp = st_antloc = NULL;
- pre_insert_map = pre_delete_map = NULL;
+ delete_unreachable_blocks ();
+ df_note_add_problem ();
+ df_set_flags (DF_LR_RUN_DCE);
+ df_analyze ();
+ flag_rerun_cse_after_global_opts |= one_cprop_pass ();
+ return 0;
}
-/* Perform store motion. Much like gcse, except we move expressions the
- other way by looking at the flowgraph in reverse. */
-
-static void
-store_motion (void)
+static bool
+gate_rtl_pre (void)
{
- basic_block bb;
- int x;
- struct ls_expr * ptr;
- int update_flow = 0;
-
- if (dump_file)
- {
- fprintf (dump_file, "before store motion\n");
- print_rtl (dump_file, get_insns ());
- }
-
- init_alias_analysis ();
-
- /* Find all the available and anticipatable stores. */
- num_stores = compute_store_table ();
- if (num_stores == 0)
- {
- htab_delete (pre_ldst_table);
- pre_ldst_table = NULL;
- end_alias_analysis ();
- return;
- }
-
- /* Now compute kill & transp vectors. */
- build_store_vectors ();
- add_noreturn_fake_exit_edges ();
- connect_infinite_loops_to_exit ();
-
- edge_list = pre_edge_rev_lcm (num_stores, transp, ae_gen,
- st_antloc, ae_kill, &pre_insert_map,
- &pre_delete_map);
-
- /* Now we want to insert the new stores which are going to be needed. */
- for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
- {
- /* If any of the edges we have above are abnormal, we can't move this
- store. */
- for (x = NUM_EDGES (edge_list) - 1; x >= 0; x--)
- if (TEST_BIT (pre_insert_map[x], ptr->index)
- && (INDEX_EDGE (edge_list, x)->flags & EDGE_ABNORMAL))
- break;
-
- if (x >= 0)
- {
- if (dump_file != NULL)
- fprintf (dump_file,
- "Can't replace store %d: abnormal edge from %d to %d\n",
- ptr->index, INDEX_EDGE (edge_list, x)->src->index,
- INDEX_EDGE (edge_list, x)->dest->index);
- continue;
- }
-
- /* Now we want to insert the new stores which are going to be needed. */
-
- FOR_EACH_BB (bb)
- if (TEST_BIT (pre_delete_map[bb->index], ptr->index))
- delete_store (ptr, bb);
-
- for (x = 0; x < NUM_EDGES (edge_list); x++)
- if (TEST_BIT (pre_insert_map[x], ptr->index))
- update_flow |= insert_store (ptr, INDEX_EDGE (edge_list, x));
- }
-
- if (update_flow)
- commit_edge_insertions ();
-
- free_store_memory ();
- free_edge_list (edge_list);
- remove_fake_exit_edges ();
- end_alias_analysis ();
+ return optimize > 0 && flag_gcse
+ && !cfun->calls_setjmp
+ && optimize_function_for_speed_p (cfun)
+ && dbg_cnt (pre);
}
-
-/* Entry point for jump bypassing optimization pass. */
-
-static int
-bypass_jumps (void)
+static unsigned int
+execute_rtl_pre (void)
{
- int changed;
-
- /* We do not construct an accurate cfg in functions which call
- setjmp, so just punt to be safe. */
- if (cfun->calls_setjmp)
- return 0;
-
- /* Identify the basic block information for this function, including
- successors and predecessors. */
- max_gcse_regno = max_reg_num ();
-
- if (dump_file)
- dump_flow_info (dump_file, dump_flags);
-
- /* Return if there's nothing to do, or it is too expensive. */
- if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
- || is_too_expensive (_ ("jump bypassing disabled")))
- return 0;
-
- gcc_obstack_init (&gcse_obstack);
- bytes_used = 0;
-
- /* We need alias. */
- init_alias_analysis ();
-
- max_gcse_regno = max_reg_num ();
- alloc_gcse_mem ();
- changed = one_cprop_pass (3, true, true);
- free_gcse_mem ();
-
- if (dump_file)
- {
- fprintf (dump_file, "BYPASS of %s: %d basic blocks, ",
- current_function_name (), n_basic_blocks);
- fprintf (dump_file, "%d bytes\n\n", bytes_used);
- }
-
- obstack_free (&gcse_obstack, NULL);
-
- /* We are finished with alias. */
- end_alias_analysis ();
-
- return changed;
+ delete_unreachable_blocks ();
+ df_note_add_problem ();
+ df_analyze ();
+ flag_rerun_cse_after_global_opts |= one_pre_gcse_pass ();
+ return 0;
}
-/* Return true if the graph is too expensive to optimize. PASS is the
- optimization about to be performed. */
-
-static bool
-is_too_expensive (const char *pass)
-{
- /* Trying to perform global optimizations on flow graphs which have
- a high connectivity will take a long time and is unlikely to be
- particularly useful.
-
- In normal circumstances a cfg should have about twice as many
- edges as blocks. But we do not want to punish small functions
- which have a couple switch statements. Rather than simply
- threshold the number of blocks, uses something with a more
- graceful degradation. */
- if (n_edges > 20000 + n_basic_blocks * 4)
- {
- warning (OPT_Wdisabled_optimization,
- "%s: %d basic blocks and %d edges/basic block",
- pass, n_basic_blocks, n_edges / n_basic_blocks);
-
- return true;
- }
-
- /* If allocating memory for the cprop bitmap would take up too much
- storage it's better just to disable the optimization. */
- if ((n_basic_blocks
- * SBITMAP_SET_SIZE (max_reg_num ())
- * sizeof (SBITMAP_ELT_TYPE)) > MAX_GCSE_MEMORY)
- {
- warning (OPT_Wdisabled_optimization,
- "%s: %d basic blocks and %d registers",
- pass, n_basic_blocks, max_reg_num ());
-
- return true;
- }
-
- return false;
-}
-
static bool
-gate_handle_jump_bypass (void)
+gate_rtl_hoist (void)
{
return optimize > 0 && flag_gcse
- && dbg_cnt (jump_bypass);
+ && !cfun->calls_setjmp
+ /* It does not make sense to run code hoisting unless we are optimizing
+ for code size -- it rarely makes programs faster, and can make then
+ bigger if we did PRE (when optimizing for space, we don't run PRE). */
+ && optimize_function_for_size_p (cfun)
+ && dbg_cnt (hoist);
}
-/* Perform jump bypassing and control flow optimizations. */
static unsigned int
-rest_of_handle_jump_bypass (void)
+execute_rtl_hoist (void)
{
delete_unreachable_blocks ();
- if (bypass_jumps ())
- {
- delete_trivially_dead_insns (get_insns (), max_reg_num ());
- rebuild_jump_labels (get_insns ());
- cleanup_cfg (0);
- }
+ df_note_add_problem ();
+ df_analyze ();
+ flag_rerun_cse_after_global_opts |= one_code_hoisting_pass ();
return 0;
}
-struct rtl_opt_pass pass_jump_bypass =
+struct rtl_opt_pass pass_rtl_cprop =
{
{
RTL_PASS,
- "bypass", /* name */
- gate_handle_jump_bypass, /* gate */
- rest_of_handle_jump_bypass, /* execute */
+ "cprop", /* name */
+ gate_rtl_cprop, /* gate */
+ execute_rtl_cprop, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
- TV_BYPASS, /* tv_id */
+ TV_CPROP, /* tv_id */
PROP_cfglayout, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
+ TODO_df_finish | TODO_verify_rtl_sharing |
TODO_dump_func |
- TODO_ggc_collect | TODO_verify_flow /* todo_flags_finish */
+ TODO_verify_flow | TODO_ggc_collect /* todo_flags_finish */
}
};
-
-static bool
-gate_handle_gcse (void)
-{
- return optimize > 0 && flag_gcse
- && dbg_cnt (gcse);
-}
-
-
-static unsigned int
-rest_of_handle_gcse (void)
+struct rtl_opt_pass pass_rtl_pre =
{
- int save_csb, save_cfj;
- int tem2 = 0, tem;
- tem = gcse_main (get_insns ());
- delete_trivially_dead_insns (get_insns (), max_reg_num ());
- rebuild_jump_labels (get_insns ());
- save_csb = flag_cse_skip_blocks;
- save_cfj = flag_cse_follow_jumps;
- flag_cse_skip_blocks = flag_cse_follow_jumps = 0;
-
- /* If -fexpensive-optimizations, re-run CSE to clean up things done
- by gcse. */
- if (flag_expensive_optimizations)
- {
- timevar_push (TV_CSE);
- tem2 = cse_main (get_insns (), max_reg_num ());
- df_finish_pass (false);
- purge_all_dead_edges ();
- delete_trivially_dead_insns (get_insns (), max_reg_num ());
- timevar_pop (TV_CSE);
- cse_not_expected = !flag_rerun_cse_after_loop;
- }
-
- /* If gcse or cse altered any jumps, rerun jump optimizations to clean
- things up. */
- if (tem || tem2 == 2)
- {
- timevar_push (TV_JUMP);
- rebuild_jump_labels (get_insns ());
- cleanup_cfg (0);
- timevar_pop (TV_JUMP);
- }
- else if (tem2 == 1)
- cleanup_cfg (0);
-
- flag_cse_skip_blocks = save_csb;
- flag_cse_follow_jumps = save_cfj;
- return 0;
-}
+ {
+ RTL_PASS,
+ "pre", /* name */
+ gate_rtl_pre, /* gate */
+ execute_rtl_pre, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_PRE, /* tv_id */
+ PROP_cfglayout, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_df_finish | TODO_verify_rtl_sharing |
+ TODO_dump_func |
+ TODO_verify_flow | TODO_ggc_collect /* todo_flags_finish */
+ }
+};
-struct rtl_opt_pass pass_gcse =
+struct rtl_opt_pass pass_rtl_hoist =
{
{
RTL_PASS,
- "gcse1", /* name */
- gate_handle_gcse, /* gate */
- rest_of_handle_gcse, /* execute */
+ "hoist", /* name */
+ gate_rtl_hoist, /* gate */
+ execute_rtl_hoist, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
- TV_GCSE, /* tv_id */
+ TV_HOIST, /* tv_id */
PROP_cfglayout, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
@@ -6423,5 +5163,4 @@ struct rtl_opt_pass pass_gcse =
}
};
-
#include "gt-gcse.h"
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index 86c799aa1a6..5a4e249ceb4 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -1280,9 +1280,13 @@ write_tm_preds_h (void)
puts ("extern enum reg_class regclass_for_constraint "
"(enum constraint_num);\n"
"#define REG_CLASS_FROM_CONSTRAINT(c_,s_) \\\n"
- " regclass_for_constraint (lookup_constraint (s_))\n");
+ " regclass_for_constraint (lookup_constraint (s_))\n"
+ "#define REG_CLASS_FOR_CONSTRAINT(x_) \\\n"
+ " regclass_for_constraint (x_)\n");
else
- puts ("#define REG_CLASS_FROM_CONSTRAINT(c_,s_) NO_REGS");
+ puts ("#define REG_CLASS_FROM_CONSTRAINT(c_,s_) NO_REGS\n"
+ "#define REG_CLASS_FOR_CONSTRAINT(x_) \\\n"
+ " NO_REGS\n");
if (have_const_int_constraints)
puts ("extern bool insn_const_int_ok_for_constraint "
"(HOST_WIDE_INT, enum constraint_num);\n"
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index 28eb5b3f433..b913ee23b41 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -1358,7 +1358,7 @@ static const struct std_pred_table std_preds[] = {
{"register_operand", false, false, {SUBREG, REG}},
{"pmode_register_operand", true, false, {SUBREG, REG}},
{"scratch_operand", false, false, {SCRATCH, REG}},
- {"immediate_operand", false, true, {0}},
+ {"immediate_operand", false, true, {UNKNOWN}},
{"const_int_operand", false, false, {CONST_INT}},
{"const_double_operand", false, false, {CONST_INT, CONST_DOUBLE}},
{"nonimmediate_operand", false, false, {SUBREG, REG, MEM}},
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 747ec4cbdfc..b6b9e1e3400 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -845,7 +845,7 @@ loc_descriptor (const char *name, int line, const char *function)
if (!loc_hash)
loc_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL);
- slot = (struct loc_descriptor **) htab_find_slot (loc_hash, &loc, 1);
+ slot = (struct loc_descriptor **) htab_find_slot (loc_hash, &loc, INSERT);
if (*slot)
return *slot;
*slot = XCNEW (struct loc_descriptor);
diff --git a/gcc/gimple.c b/gcc/gimple.c
index db7f872b5cc..d81c3f35551 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2805,13 +2805,7 @@ is_gimple_id (tree t)
bool
is_gimple_reg_type (tree type)
{
- /* In addition to aggregate types, we also exclude complex types if not
- optimizing because they can be subject to partial stores in GNU C by
- means of the __real__ and __imag__ operators and we cannot promote
- them to total stores (see gimplify_modify_expr_complex_part). */
- return !(AGGREGATE_TYPE_P (type)
- || (TREE_CODE (type) == COMPLEX_TYPE && !optimize));
-
+ return !AGGREGATE_TYPE_P (type);
}
/* Return true if T is a non-aggregate register variable. */
@@ -2825,12 +2819,6 @@ is_gimple_reg (tree t)
if (!is_gimple_variable (t))
return false;
- /* Complex and vector values must have been put into SSA-like form.
- That is, no assignments to the individual components. */
- if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
- return DECL_GIMPLE_REG_P (t);
-
if (!is_gimple_reg_type (TREE_TYPE (t)))
return false;
@@ -2857,6 +2845,12 @@ is_gimple_reg (tree t)
if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
return false;
+ /* Complex and vector values must have been put into SSA-like form.
+ That is, no assignments to the individual components. */
+ if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ return DECL_GIMPLE_REG_P (t);
+
return true;
}
@@ -3238,12 +3232,18 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
if (TREE_CODE (rhs) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (rhs, 0), data);
else if (TREE_CODE (rhs) == TARGET_MEM_REF
+ && TMR_BASE (rhs) != NULL_TREE
&& TREE_CODE (TMR_BASE (rhs)) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (rhs), 0), data);
else if (TREE_CODE (rhs) == OBJ_TYPE_REF
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs)) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs),
0), data);
+ lhs = gimple_assign_lhs (stmt);
+ if (TREE_CODE (lhs) == TARGET_MEM_REF
+ && TMR_BASE (lhs) != NULL_TREE
+ && TREE_CODE (TMR_BASE (lhs)) == ADDR_EXPR)
+ ret |= visit_addr (stmt, TREE_OPERAND (TMR_BASE (lhs), 0), data);
}
if (visit_load)
{
diff --git a/gcc/gimple.def b/gcc/gimple.def
index 23eaae2e86e..26aa719f660 100644
--- a/gcc/gimple.def
+++ b/gcc/gimple.def
@@ -102,16 +102,17 @@ DEFGSCODE(GIMPLE_CHANGE_DYNAMIC_TYPE, "gimple_change_dynamic_type",
SUBCODE is the tree code for the expression computed by the RHS of the
assignment. It must be one of the tree codes accepted by
- get_gimple_rhs_class.
+ get_gimple_rhs_class. If LHS is not a gimple register according to
+ is_gimple_reg, SUBCODE must be of class GIMPLE_SINGLE_RHS.
LHS is the operand on the LHS of the assignment. It must be a tree node
- accepted by is_gimple_operand.
+ accepted by is_gimple_lvalue.
- RHS1 is the first operand on the RHS of the assignment. It must be a tree
- node accepted by is_gimple_operand.
+ RHS1 is the first operand on the RHS of the assignment. It must always be
+ present. It must be a tree node accepted by is_gimple_val.
- RHS2 is the second operand on the RHS of the assignemnt. It must be a tree
- node accepted by is_gimple_operand. This argument exists only if SUBCODE is
+ RHS2 is the second operand on the RHS of the assignment. It must be a tree
+ node accepted by is_gimple_val. This argument exists only if SUBCODE is
of class GIMPLE_BINARY_RHS. */
DEFGSCODE(GIMPLE_ASSIGN, "gimple_assign",
struct gimple_statement_with_memory_ops)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 5a4cb3e9ba5..d3f8f8fb8c4 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2202,7 +2202,7 @@ static inline enum tree_code
gimple_cond_code (const_gimple gs)
{
GIMPLE_CHECK (gs, GIMPLE_COND);
- return gs->gsbase.subcode;
+ return (enum tree_code) gs->gsbase.subcode;
}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f831e479cac..0c33dab479a 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1218,9 +1218,14 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
/* Preliminarily mark non-addressed complex variables as eligible
for promotion to gimple registers. We'll transform their uses
- as we find them. */
- if ((TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+ as we find them.
+ We exclude complex types if not optimizing because they can be
+ subject to partial stores in GNU C by means of the __real__ and
+ __imag__ operators and we cannot promote them to total stores
+ (see gimplify_modify_expr_complex_part). */
+ if (optimize
+ && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
&& !TREE_THIS_VOLATILE (t)
&& (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
&& !needs_to_live_in_memory (t))
@@ -1599,20 +1604,63 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
}
len = i;
+ if (!VEC_empty (tree, labels))
+ sort_case_labels (labels);
+
if (!default_case)
{
- gimple new_default;
+ tree type = TREE_TYPE (switch_expr);
/* If the switch has no default label, add one, so that we jump
- around the switch body. */
- default_case = build3 (CASE_LABEL_EXPR, void_type_node, NULL_TREE,
- NULL_TREE, create_artificial_label ());
- new_default = gimple_build_label (CASE_LABEL (default_case));
- gimplify_seq_add_stmt (&switch_body_seq, new_default);
- }
+ around the switch body. If the labels already cover the whole
+ range of type, add the default label pointing to one of the
+ existing labels. */
+ if (type == void_type_node)
+ type = TREE_TYPE (SWITCH_COND (switch_expr));
+ if (len
+ && INTEGRAL_TYPE_P (type)
+ && TYPE_MIN_VALUE (type)
+ && TYPE_MAX_VALUE (type)
+ && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),
+ TYPE_MIN_VALUE (type)))
+ {
+ tree low, high = CASE_HIGH (VEC_index (tree, labels, len - 1));
+ if (!high)
+ high = CASE_LOW (VEC_index (tree, labels, len - 1));
+ if (tree_int_cst_equal (high, TYPE_MAX_VALUE (type)))
+ {
+ for (i = 1; i < len; i++)
+ {
+ high = CASE_LOW (VEC_index (tree, labels, i));
+ low = CASE_HIGH (VEC_index (tree, labels, i - 1));
+ if (!low)
+ low = CASE_LOW (VEC_index (tree, labels, i - 1));
+ if ((TREE_INT_CST_LOW (low) + 1
+ != TREE_INT_CST_LOW (high))
+ || (TREE_INT_CST_HIGH (low)
+ + (TREE_INT_CST_LOW (high) == 0)
+ != TREE_INT_CST_HIGH (high)))
+ break;
+ }
+ if (i == len)
+ default_case = build3 (CASE_LABEL_EXPR, void_type_node,
+ NULL_TREE, NULL_TREE,
+ CASE_LABEL (VEC_index (tree,
+ labels, 0)));
+ }
+ }
- if (!VEC_empty (tree, labels))
- sort_case_labels (labels);
+ if (!default_case)
+ {
+ gimple new_default;
+
+ default_case = build3 (CASE_LABEL_EXPR, void_type_node,
+ NULL_TREE, NULL_TREE,
+ create_artificial_label ());
+ new_default = gimple_build_label (CASE_LABEL (default_case));
+ gimplify_seq_add_stmt (&switch_body_seq, new_default);
+ }
+ }
gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr),
default_case, labels);
@@ -5390,8 +5438,8 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
switch (default_kind)
{
case OMP_CLAUSE_DEFAULT_NONE:
- error ("%qs not specified in enclosing parallel",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("%qE not specified in enclosing parallel",
+ DECL_NAME (decl));
error ("%Henclosing parallel", &ctx->location);
/* FALLTHRU */
case OMP_CLAUSE_DEFAULT_SHARED:
@@ -5497,8 +5545,8 @@ omp_is_private (struct gimplify_omp_ctx *ctx, tree decl)
{
if (ctx == gimplify_omp_ctxp)
{
- error ("iteration variable %qs should be private",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("iteration variable %qE should be private",
+ DECL_NAME (decl));
n->value = GOVD_PRIVATE;
return true;
}
@@ -5511,11 +5559,11 @@ omp_is_private (struct gimplify_omp_ctx *ctx, tree decl)
&& gimplify_omp_ctxp->outer_context == ctx)))
{
if ((n->value & GOVD_FIRSTPRIVATE) != 0)
- error ("iteration variable %qs should not be firstprivate",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("iteration variable %qE should not be firstprivate",
+ DECL_NAME (decl));
else if ((n->value & GOVD_REDUCTION) != 0)
- error ("iteration variable %qs should not be reduction",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("iteration variable %qE should not be reduction",
+ DECL_NAME (decl));
}
return (ctx == gimplify_omp_ctxp
|| (ctx->region_type == ORT_COMBINED_PARALLEL
@@ -5677,8 +5725,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
&& region_type == ORT_WORKSHARE
&& omp_check_private (ctx, decl))
{
- error ("%s variable %qs is private in outer context",
- check_non_private, IDENTIFIER_POINTER (DECL_NAME (decl)));
+ error ("%s variable %qE is private in outer context",
+ check_non_private, DECL_NAME (decl));
remove = true;
}
break;
@@ -7184,7 +7232,12 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* The postqueue might change the value of the expression between
the initialization and use of the temporary, so we can't use a
formal temp. FIXME do we care? */
- *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+ {
+ *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+ if (TREE_CODE (TREE_TYPE (*expr_p)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (*expr_p)) == VECTOR_TYPE)
+ DECL_GIMPLE_REG_P (*expr_p) = 1;
+ }
else
*expr_p = get_formal_tmp_var (*expr_p, pre_p);
}
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 60aeac3a55f..f876b458d2d 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -1897,7 +1897,7 @@ reemit_notes (rtx insn)
{
if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
{
- enum insn_note note_type = INTVAL (XEXP (note, 0));
+ enum insn_note note_type = (enum insn_note) INTVAL (XEXP (note, 0));
last = emit_note_before (note_type, last);
remove_note (insn, note);
diff --git a/gcc/hooks.c b/gcc/hooks.c
index 78e0ad22177..796d915e1c6 100644
--- a/gcc/hooks.c
+++ b/gcc/hooks.c
@@ -1,5 +1,5 @@
/* General-purpose hooks.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -49,13 +49,6 @@ hook_bool_void_true (void)
return true;
}
-/* Generic hook that takes no arguments and returns NO_REGS. */
-int
-hook_int_void_no_regs (void)
-{
- return NO_REGS;
-}
-
/* Generic hook that takes (bool) and returns false. */
bool
hook_bool_bool_false (bool a ATTRIBUTE_UNUSED)
diff --git a/gcc/hooks.h b/gcc/hooks.h
index b47a6d980af..89e7f6dbf43 100644
--- a/gcc/hooks.h
+++ b/gcc/hooks.h
@@ -1,5 +1,5 @@
/* General-purpose hooks.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
@@ -62,7 +62,6 @@ extern int hook_int_const_tree_const_tree_1 (const_tree, const_tree);
extern int hook_int_rtx_0 (rtx);
extern int hook_int_rtx_bool_0 (rtx, bool);
extern int hook_int_size_t_constcharptr_int_0 (size_t, const char *, int);
-extern int hook_int_void_no_regs (void);
extern tree hook_tree_tree_tree_null (tree, tree);
extern tree hook_tree_tree_tree_tree_null (tree, tree, tree);
diff --git a/gcc/intl.c b/gcc/intl.c
index 4c8943a43a4..5b486151dcd 100644
--- a/gcc/intl.c
+++ b/gcc/intl.c
@@ -1,5 +1,5 @@
/* Message translation utilities.
- Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -34,6 +34,12 @@ const char *open_quote = "'";
/* Closing quotation mark for diagnostics. */
const char *close_quote = "'";
+/* The name of the locale encoding. */
+const char *locale_encoding = NULL;
+
+/* Whether the locale is using UTF-8. */
+bool locale_utf8 = false;
+
#ifdef ENABLE_NLS
/* Initialize the translation library for GCC. This performs the
@@ -60,20 +66,22 @@ gcc_init_libintl (void)
/* Closing quotation mark. */
close_quote = _("'");
- if (!strcmp (open_quote, "`") && !strcmp (close_quote, "'"))
- {
#if defined HAVE_LANGINFO_CODESET
- const char *encoding;
+ locale_encoding = nl_langinfo (CODESET);
+ if (locale_encoding != NULL
+ && (!strcasecmp (locale_encoding, "utf-8")
+ || !strcasecmp (locale_encoding, "utf8")))
+ locale_utf8 = true;
#endif
+
+ if (!strcmp (open_quote, "`") && !strcmp (close_quote, "'"))
+ {
/* Untranslated quotes that it may be possible to replace with
U+2018 and U+2019; but otherwise use "'" instead of "`" as
opening quote. */
open_quote = "'";
#if defined HAVE_LANGINFO_CODESET
- encoding = nl_langinfo (CODESET);
- if (encoding != NULL
- && (!strcasecmp (encoding, "utf-8")
- || !strcasecmp (encoding, "utf8")))
+ if (locale_utf8)
{
open_quote = "\xe2\x80\x98";
close_quote = "\xe2\x80\x99";
diff --git a/gcc/intl.h b/gcc/intl.h
index 3b6395f367d..902e7ae423c 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -1,5 +1,5 @@
/* intl.h - internationalization
- Copyright 1998, 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1998, 2001, 2003, 2004, 2007, 2009 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -56,5 +56,7 @@ extern size_t gcc_gettext_width (const char *);
extern const char *open_quote;
extern const char *close_quote;
+extern const char *locale_encoding;
+extern bool locale_utf8;
#endif /* intl.h */
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 1ffb68037c3..152bc2ad984 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -134,6 +134,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "fibheap.h"
#include "params.h"
+#include "dbgcnt.h"
/* Number of functions identified as candidates for cloning. When not cloning
we can simplify iterate stage not forcing it to go through the decision
@@ -186,34 +187,6 @@ ipcp_analyze_node (struct cgraph_node *node)
ipa_detect_param_modifications (node);
}
-/* Recompute all local information since node might've got new
- direct calls after cloning. */
-static void
-ipcp_update_cloned_node (struct cgraph_node *new_node)
-{
- /* We might've introduced new direct calls. */
- push_cfun (DECL_STRUCT_FUNCTION (new_node->decl));
- current_function_decl = new_node->decl;
- rebuild_cgraph_edges ();
-
- /* Indirect inlinng rely on fact that we've already analyzed
- the body.. */
- if (flag_indirect_inlining)
- {
- struct cgraph_edge *cs;
-
- ipcp_analyze_node (new_node);
-
- for (cs = new_node->callees; cs; cs = cs->next_callee)
- {
- ipa_count_arguments (cs);
- ipa_compute_jump_functions (cs);
- }
- }
- pop_cfun ();
- current_function_decl = NULL;
-}
-
/* Return scale for NODE. */
static inline gcov_type
ipcp_get_node_scale (struct cgraph_node *node)
@@ -756,98 +729,6 @@ ipcp_print_call_profile_counts (FILE * f)
}
}
-/* Print all counts and probabilities of cfg edges of all functions. */
-static void
-ipcp_print_edge_profiles (FILE * f)
-{
- struct cgraph_node *node;
- basic_block bb;
- edge_iterator ei;
- edge e;
-
- for (node = cgraph_nodes; node; node = node->next)
- {
- fprintf (f, "function %s: \n", cgraph_node_name (node));
- if (node->analyzed)
- {
- bb =
- ENTRY_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (node->decl));
- fprintf (f, "ENTRY: ");
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC
- " %d\n", (HOST_WIDE_INT) bb->count, bb->frequency);
-
- if (bb->succs)
- FOR_EACH_EDGE (e, ei, bb->succs)
- {
- if (e->dest ==
- EXIT_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION
- (node->decl)))
- fprintf (f, "edge ENTRY -> EXIT, Count");
- else
- fprintf (f, "edge ENTRY -> %d, Count", e->dest->index);
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC
- " Prob %d\n", (HOST_WIDE_INT) e->count,
- e->probability);
- }
- FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (node->decl))
- {
- fprintf (f, "bb[%d]: ", bb->index);
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC
- " %d\n", (HOST_WIDE_INT) bb->count, bb->frequency);
- FOR_EACH_EDGE (e, ei, bb->succs)
- {
- if (e->dest ==
- EXIT_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION
- (node->decl)))
- fprintf (f, "edge %d -> EXIT, Count", e->src->index);
- else
- fprintf (f, "edge %d -> %d, Count", e->src->index,
- e->dest->index);
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC " Prob %d\n",
- (HOST_WIDE_INT) e->count, e->probability);
- }
- }
- }
- }
-}
-
-/* Print counts and frequencies for all basic blocks of all functions. */
-static void
-ipcp_print_bb_profiles (FILE * f)
-{
- basic_block bb;
- struct cgraph_node *node;
-
- for (node = cgraph_nodes; node; node = node->next)
- {
- fprintf (f, "function %s: \n", cgraph_node_name (node));
- if (node->analyzed)
- {
- bb =
- ENTRY_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (node->decl));
- fprintf (f, "ENTRY: Count");
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC
- " Frequency %d\n", (HOST_WIDE_INT) bb->count,
- bb->frequency);
-
- FOR_EACH_BB_FN (bb, DECL_STRUCT_FUNCTION (node->decl))
- {
- fprintf (f, "bb[%d]: Count", bb->index);
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC
- " Frequency %d\n", (HOST_WIDE_INT) bb->count,
- bb->frequency);
- }
- bb =
- EXIT_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (node->decl));
- fprintf (f, "EXIT: Count");
- fprintf (f, " " HOST_WIDE_INT_PRINT_DEC
- " Frequency %d\n", (HOST_WIDE_INT) bb->count,
- bb->frequency);
-
- }
- }
-}
-
/* Print profile info for all functions. */
static void
ipcp_print_profile_data (FILE * f)
@@ -856,10 +737,6 @@ ipcp_print_profile_data (FILE * f)
ipcp_print_func_profile_counts (f);
fprintf (f, "\nCS COUNTS stage:\n");
ipcp_print_call_profile_counts (f);
- fprintf (f, "\nBB COUNTS and FREQUENCIES :\n");
- ipcp_print_bb_profiles (f);
- fprintf (f, "\nCFG EDGES COUNTS and PROBABILITIES :\n");
- ipcp_print_edge_profiles (f);
}
/* Build and initialize ipa_replace_map struct according to LAT. This struct is
@@ -872,7 +749,7 @@ ipcp_create_replace_map (tree parm_tree, struct ipcp_lattice *lat)
struct ipa_replace_map *replace_map;
tree const_val;
- replace_map = XCNEW (struct ipa_replace_map);
+ replace_map = GGC_NEW (struct ipa_replace_map);
const_val = build_const_val (lat, TREE_TYPE (parm_tree));
if (dump_file)
{
@@ -959,25 +836,7 @@ ipcp_update_callgraph (void)
for (cs = node->callers; cs; cs = next)
{
next = cs->next_caller;
- if (ipcp_node_is_clone (cs->caller) || !ipcp_need_redirect_p (cs))
- {
- gimple new_stmt;
- gimple_stmt_iterator gsi;
-
- current_function_decl = cs->caller->decl;
- push_cfun (DECL_STRUCT_FUNCTION (cs->caller->decl));
-
- new_stmt = gimple_call_copy_skip_args (cs->call_stmt,
- args_to_skip);
- if (gimple_vdef (new_stmt))
- SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
- gsi = gsi_for_stmt (cs->call_stmt);
- gsi_replace (&gsi, new_stmt, true);
- cgraph_set_call_stmt (cs, new_stmt);
- pop_cfun ();
- current_function_decl = NULL;
- }
- else
+ if (!ipcp_node_is_clone (cs->caller) && ipcp_need_redirect_p (cs))
{
cgraph_redirect_edge_callee (cs, orig_node);
gimple_call_set_fndecl (cs->call_stmt, orig_node->decl);
@@ -986,29 +845,6 @@ ipcp_update_callgraph (void)
}
}
-/* Update all cfg basic blocks in NODE according to SCALE. */
-static void
-ipcp_update_bb_counts (struct cgraph_node *node, gcov_type scale)
-{
- basic_block bb;
-
- FOR_ALL_BB_FN (bb, DECL_STRUCT_FUNCTION (node->decl))
- bb->count = bb->count * scale / REG_BR_PROB_BASE;
-}
-
-/* Update all cfg edges in NODE according to SCALE. */
-static void
-ipcp_update_edges_counts (struct cgraph_node *node, gcov_type scale)
-{
- basic_block bb;
- edge_iterator ei;
- edge e;
-
- FOR_ALL_BB_FN (bb, DECL_STRUCT_FUNCTION (node->decl))
- FOR_EACH_EDGE (e, ei, bb->succs)
- e->count = e->count * scale / REG_BR_PROB_BASE;
-}
-
/* Update profiling info for versioned functions and the functions they were
versioned from. */
static void
@@ -1038,10 +874,6 @@ ipcp_update_profiling (void)
cs->count = cs->count * scale / REG_BR_PROB_BASE;
for (cs = orig_node->callees; cs; cs = cs->next_callee)
cs->count = cs->count * scale_complement / REG_BR_PROB_BASE;
- ipcp_update_bb_counts (node, scale);
- ipcp_update_bb_counts (orig_node, scale_complement);
- ipcp_update_edges_counts (node, scale);
- ipcp_update_edges_counts (orig_node, scale_complement);
}
}
}
@@ -1166,13 +998,13 @@ ipcp_insert_stage (void)
struct cgraph_node *node, *node1 = NULL;
int i;
VEC (cgraph_edge_p, heap) * redirect_callers;
- varray_type replace_trees;
+ VEC (ipa_replace_map_p,gc)* replace_trees;
int node_callers, count;
tree parm_tree;
struct ipa_replace_map *replace_param;
fibheap_t heap;
- long overall_insns = 0, new_insns = 0;
- long max_new_insns;
+ long overall_size = 0, new_size = 0;
+ long max_new_size;
ipa_check_create_node_params ();
ipa_check_create_edge_args ();
@@ -1186,13 +1018,13 @@ ipcp_insert_stage (void)
{
if (node->count > max_count)
max_count = node->count;
- overall_insns += node->local.inline_summary.self_insns;
+ overall_size += node->local.inline_summary.self_insns;
}
- max_new_insns = overall_insns;
- if (max_new_insns < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
- max_new_insns = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
- max_new_insns = max_new_insns * PARAM_VALUE (PARAM_IPCP_UNIT_GROWTH) / 100 + 1;
+ max_new_size = overall_size;
+ if (max_new_size < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
+ max_new_size = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
+ max_new_size = max_new_size * PARAM_VALUE (PARAM_IPCP_UNIT_GROWTH) / 100 + 1;
/* First collect all functions we proved to have constant arguments to heap. */
heap = fibheap_new ();
@@ -1226,7 +1058,7 @@ ipcp_insert_stage (void)
growth = ipcp_estimate_growth (node);
- if (new_insns + growth > max_new_insns)
+ if (new_size + growth > max_new_size)
break;
if (growth
&& optimize_function_for_size_p (DECL_STRUCT_FUNCTION (node->decl)))
@@ -1236,21 +1068,24 @@ ipcp_insert_stage (void)
continue;
}
- new_insns += growth;
+ new_size += growth;
/* Look if original function becomes dead after clonning. */
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
if (cs->caller == node || ipcp_need_redirect_p (cs))
break;
+
+ if (!dbg_cnt (clone))
+ break;
+
if (!cs && !node->needed)
bitmap_set_bit (dead_nodes, node->uid);
info = IPA_NODE_REF (node);
count = ipa_get_param_count (info);
- VARRAY_GENERIC_PTR_INIT (replace_trees, ipcp_const_param_count (node),
- "replace_trees");
- args_to_skip = BITMAP_ALLOC (NULL);
+ replace_trees = VEC_alloc (ipa_replace_map_p, gc, 1);
+ args_to_skip = BITMAP_GGC_ALLOC ();
for (i = 0; i < count; i++)
{
struct ipcp_lattice *lat = ipcp_get_lattice (info, i);
@@ -1269,7 +1104,7 @@ ipcp_insert_stage (void)
{
replace_param =
ipcp_create_replace_map (parm_tree, lat);
- VARRAY_PUSH_GENERIC_PTR (replace_trees, replace_param);
+ VEC_safe_push (ipa_replace_map_p, gc, replace_trees, replace_param);
bitmap_set_bit (args_to_skip, i);
}
}
@@ -1285,20 +1120,20 @@ ipcp_insert_stage (void)
/* Redirecting all the callers of the node to the
new versioned node. */
node1 =
- cgraph_function_versioning (node, redirect_callers, replace_trees,
- args_to_skip);
- BITMAP_FREE (args_to_skip);
+ cgraph_create_virtual_clone (node, redirect_callers, replace_trees,
+ args_to_skip);
+ args_to_skip = NULL;
VEC_free (cgraph_edge_p, heap, redirect_callers);
- VARRAY_CLEAR (replace_trees);
+ replace_trees = NULL;
+
if (node1 == NULL)
continue;
if (dump_file)
fprintf (dump_file, "versioned function %s with growth %i, overall %i\n",
- cgraph_node_name (node), (int)growth, (int)new_insns);
+ cgraph_node_name (node), (int)growth, (int)new_size);
ipcp_init_cloned_node (node, node1);
- /* We've possibly introduced direct calls. */
- ipcp_update_cloned_node (node1);
+ /* TODO: We can use indirect inlning info to produce new calls. */
if (dump_file)
dump_function_to_file (node1->decl, dump_file, dump_flags);
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 19b8752974a..80a5f960505 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -438,7 +438,7 @@ cgraph_default_inline_p (struct cgraph_node *n, cgraph_inline_failed_t *reason)
return false;
}
- if (!DECL_STRUCT_FUNCTION (decl)->cfg)
+ if (!n->analyzed)
{
if (reason)
*reason = CIF_BODY_NOT_AVAILABLE;
@@ -969,6 +969,12 @@ cgraph_decide_inlining_of_small_functions (void)
edge->aux = NULL;
if (!edge->inline_failed)
continue;
+
+ if (!dbg_cnt (inl))
+ {
+ edge->inline_failed = CIF_UNSPECIFIED;
+ continue;
+ }
/* When not having profile info ready we don't weight by any way the
position of call in procedure itself. This means if call of
@@ -1717,7 +1723,12 @@ cgraph_early_inlining (void)
if (sorrycount || errorcount)
return 0;
- if (cgraph_decide_inlining_incrementally (node, INLINE_SIZE, false, 0))
+ /* In LIPO mode, we may want to allow inter-module early inlining as
+ it is after the tree_profiling pass. However allowing inlining cross
+ module inlining can potentially change the result of some analysis results
+ such as pure-const analysis. This in turn can result in changes in caller
+ function's CFG (removal of EH edges), which leads to coverage mismatch. */
+ if (cgraph_decide_inlining_incrementally (node, INLINE_SIZE, true, 0))
{
timevar_push (TV_INTEGRATION);
todo = optimize_inline_calls (current_function_decl);
@@ -1915,12 +1926,18 @@ inline_transform (struct cgraph_node *node)
return todo | execute_fixup_cfg ();
}
+static bool
+gate_ipa_inlining (void)
+{
+ return true;
+}
+
struct ipa_opt_pass pass_ipa_inline =
{
{
IPA_PASS,
"inline", /* name */
- NULL, /* gate */
+ gate_ipa_inlining, /* gate */
cgraph_decide_inlining, /* execute */
NULL, /* sub */
NULL, /* next */
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 88047e476b3..f4fa37d5a05 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -653,7 +653,7 @@ ipa_note_param_call (struct ipa_node_params *info, int formal_id,
note->formal_id = formal_id;
note->stmt = stmt;
note->count = bb->count;
- note->frequency = compute_call_stmt_bb_frequency (bb);
+ note->frequency = compute_call_stmt_bb_frequency (current_function_decl, bb);
note->next = info->param_calls;
info->param_calls = note;
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index 5943a2af6f4..c4c1ccc162a 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -99,20 +99,6 @@ struct ipcp_lattice
tree constant;
};
-/* Represent which DECL tree (or reference to such tree)
- will be replaced by another tree while versioning. */
-struct ipa_replace_map
-{
- /* The tree that will be replaced. */
- tree old_tree;
- /* The new (replacing) tree. */
- tree new_tree;
- /* True when a substitution should be done, false otherwise. */
- bool replace_p;
- /* True when we replace a reference to old_tree. */
- bool ref_p;
-};
-
/* Each instance of the following structure describes a statement that calls a
function parameter. Those referring to statements within the same function
are linked in a list. */
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index fa31dbd67e8..8bdf8eec446 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -43,7 +43,6 @@ along with GCC; see the file COPYING3. If not see
#include "pointer-set.h"
#include "ggc.h"
#include "ipa-utils.h"
-#include "c-common.h"
#include "gimple.h"
#include "cgraph.h"
#include "output.h"
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 0a42136ffbf..a8835550fcf 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -57,10 +57,10 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "langhooks.h"
#include "pointer-set.h"
+#include "splay-tree.h"
#include "ggc.h"
#include "ipa-utils.h"
#include "ipa-reference.h"
-#include "c-common.h"
#include "gimple.h"
#include "cgraph.h"
#include "output.h"
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 8b5360d00e9..6468d77f06a 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -34,7 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "pointer-set.h"
#include "hashtab.h"
-#include "c-tree.h"
#include "toplev.h"
#include "flags.h"
#include "debug.h"
@@ -53,7 +52,6 @@ along with GCC; see the file COPYING3. If not see
#include "opts.h"
#include "ipa-type-escape.h"
#include "tree-dump.h"
-#include "c-common.h"
#include "gimple.h"
/* This optimization implements structure peeling.
@@ -3643,7 +3641,7 @@ do_reorg_1 (void)
bitmap_obstack_initialize (NULL);
for (node = cgraph_nodes; node; node = node->next)
- if (node->analyzed && node->decl && !node->next_clone)
+ if (node->analyzed && node->decl)
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
current_function_decl = node->decl;
@@ -3811,8 +3809,7 @@ collect_data_accesses (void)
{
struct function *func = DECL_STRUCT_FUNCTION (c_node->decl);
- if (!c_node->next_clone)
- collect_accesses_in_func (func);
+ collect_accesses_in_func (func);
exclude_alloc_and_field_accs (c_node);
}
}
diff --git a/gcc/ipa-type-escape.c b/gcc/ipa-type-escape.c
index 7349f6b8478..62516d0f34c 100644
--- a/gcc/ipa-type-escape.c
+++ b/gcc/ipa-type-escape.c
@@ -43,10 +43,10 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "langhooks.h"
#include "pointer-set.h"
+#include "splay-tree.h"
#include "ggc.h"
#include "ipa-utils.h"
#include "ipa-type-escape.h"
-#include "c-common.h"
#include "gimple.h"
#include "cgraph.h"
#include "output.h"
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index 97a2b3c8237..5bd0b788cd1 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -28,10 +28,10 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "langhooks.h"
#include "pointer-set.h"
+#include "splay-tree.h"
#include "ggc.h"
#include "ipa-utils.h"
#include "ipa-reference.h"
-#include "c-common.h"
#include "gimple.h"
#include "cgraph.h"
#include "output.h"
diff --git a/gcc/ipa.c b/gcc/ipa.c
index ccb8ecdf73c..b18f8fec6f1 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "tree-pass.h"
#include "timevar.h"
+#include "gimple.h"
#include "ggc.h"
/* Fill array order with all nodes with output flag set in the reverse
@@ -144,6 +145,12 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
e->callee->aux = first;
first = e->callee;
}
+ while (node->clone_of && !node->clone_of->aux && !gimple_has_body_p (node->decl))
+ {
+ node = node->clone_of;
+ node->aux = first;
+ first = node;
+ }
}
/* Remove unreachable nodes. Extern inline functions need special care;
@@ -160,32 +167,36 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
if (!node->aux)
{
node->global.inlined_to = NULL;
- if (!node->analyzed || !cgraph_is_decl_external (node)
- || before_inlining_p)
+ if ((!node->analyzed || !cgraph_is_decl_external (node)
+ || before_inlining_p))
cgraph_remove_node (node);
else
{
struct cgraph_edge *e;
+ /* See if there is reachable caller. */
for (e = node->callers; e; e = e->next_caller)
if (e->caller->aux)
break;
+
+ /* If so, we need to keep node in the callgraph. */
if (e || node->needed)
{
struct cgraph_node *clone;
- for (clone = node->next_clone; clone;
- clone = clone->next_clone)
+ /* If there are still clones, we must keep body around.
+ Otherwise we can just remove the body but keep the clone. */
+ for (clone = node->clones; clone;
+ clone = clone->next_sibling_clone)
if (clone->aux)
break;
if (!clone)
{
cgraph_release_function_body (node);
+ cgraph_node_remove_callees (node);
node->analyzed = false;
+ node->local.inlinable = false;
}
- cgraph_node_remove_callees (node);
- node->analyzed = false;
- node->local.inlinable = false;
}
else
cgraph_remove_node (node);
@@ -194,7 +205,32 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
}
}
for (node = cgraph_nodes; node; node = node->next)
- node->aux = NULL;
+ {
+ /* Inline clones might be kept around so their materializing allows further
+ cloning. If the function the clone is inlined into is removed, we need
+ to turn it into normal clone. */
+ if (node->global.inlined_to
+ && !node->callers)
+ {
+ /* Clean up dangling references from callees as well.
+ TODO -- should be done recursively. */
+ if (L_IPO_COMP_MODE)
+ {
+ struct cgraph_edge *e;
+ for (e = node->callees; e; e = e->next_callee)
+ {
+ struct cgraph_node *callee_node;
+
+ callee_node = e->callee;
+ if (callee_node->global.inlined_to)
+ callee_node->global.inlined_to = node;
+ }
+ }
+ gcc_assert (node->clones);
+ node->global.inlined_to = false;
+ }
+ node->aux = NULL;
+ }
#ifdef ENABLE_CHECKING
verify_cgraph ();
#endif
@@ -247,7 +283,7 @@ function_and_variable_visibility (void)
gcc_assert (flag_whole_program || !TREE_PUBLIC (vnode->decl));
TREE_PUBLIC (vnode->decl) = 0;
}
- /* static variables defined in auxiliary modules are externalized to
+ /* Static variables defined in auxiliary modules are externalized to
allow cross module inlining. */
gcc_assert (TREE_STATIC (vnode->decl) || vnode->auxiliary);
}
@@ -445,4 +481,3 @@ debug_cgraph_node_set (cgraph_node_set set)
{
dump_cgraph_node_set (stderr, set);
}
-
diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c
index 399a28ae5cc..29c77c9be9f 100644
--- a/gcc/ira-conflicts.c
+++ b/gcc/ira-conflicts.c
@@ -806,7 +806,7 @@ ira_build_conflicts (void)
if ((! flag_caller_saves && ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
/* For debugging purposes don't put user defined variables in
callee-clobbered registers. */
- || (optimize <= 1
+ || (optimize == 0
&& (attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)])) != NULL
&& (decl = attrs->decl) != NULL
&& VAR_OR_FUNCTION_DECL_P (decl)
diff --git a/gcc/ira.c b/gcc/ira.c
index c105d837f83..a63351441c5 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -756,7 +756,7 @@ setup_cover_and_important_classes (void)
continue;
#ifdef CONSTRAINT_NUM_DEFINED_P
for (j = 0; j < CONSTRAINT__LIMIT; j++)
- if ((int) regclass_for_constraint ((enum constraint_num) j) == i)
+ if ((int) REG_CLASS_FOR_CONSTRAINT ((enum constraint_num) j) == i)
break;
if (j < CONSTRAINT__LIMIT)
{
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index f4f8a2afe89..f10c219b0d8 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,16 @@
+2009-04-27 Ian Lance Taylor <iant@google.com>
+
+ * builtins.c (java_builtins): Add casts to enum type.
+ * verify-impl.c (check_class_constant): Add cast to enum type.
+ (check_constant, check_wide_constant): Likewise.
+
+2009-04-27 Richard Guenther <rguenther@suse.de>
+
+ PR java/38374
+ * constants.c (build_constants_constructor): Retain the old
+ pointer type as valid TYPE_POINTER_TO after patching the
+ type of the constant pool decl.
+
2009-04-24 Ian Lance Taylor <iant@google.com>
* jcf-parse.c (handle_constant): Add cast to enum type.
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 4fac1446f97..39c73a5e7fa 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -80,9 +80,9 @@ struct GTY(()) builtin_record {
static GTY(()) struct builtin_record java_builtins[] =
{
- { { "java.lang.Math" }, { "min" }, min_builtin, 0 },
- { { "java.lang.Math" }, { "max" }, max_builtin, 0 },
- { { "java.lang.Math" }, { "abs" }, abs_builtin, 0 },
+ { { "java.lang.Math" }, { "min" }, min_builtin, (enum built_in_function) 0 },
+ { { "java.lang.Math" }, { "max" }, max_builtin, (enum built_in_function) 0 },
+ { { "java.lang.Math" }, { "abs" }, abs_builtin, (enum built_in_function) 0 },
{ { "java.lang.Math" }, { "acos" }, NULL, BUILT_IN_ACOS },
{ { "java.lang.Math" }, { "asin" }, NULL, BUILT_IN_ASIN },
{ { "java.lang.Math" }, { "atan" }, NULL, BUILT_IN_ATAN },
@@ -96,31 +96,47 @@ static GTY(()) struct builtin_record java_builtins[] =
{ { "java.lang.Math" }, { "sin" }, NULL, BUILT_IN_SIN },
{ { "java.lang.Math" }, { "sqrt" }, NULL, BUILT_IN_SQRT },
{ { "java.lang.Math" }, { "tan" }, NULL, BUILT_IN_TAN },
- { { "java.lang.Float" }, { "intBitsToFloat" }, convert_real, 0 },
- { { "java.lang.Double" }, { "longBitsToDouble" }, convert_real, 0 },
- { { "java.lang.Float" }, { "floatToRawIntBits" }, convert_real, 0 },
- { { "java.lang.Double" }, { "doubleToRawLongBits" }, convert_real, 0 },
- { { "sun.misc.Unsafe" }, { "putInt" }, putObject_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putLong" }, putObject_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putObject" }, putObject_builtin, 0},
- { { "sun.misc.Unsafe" }, { "compareAndSwapInt" },
- compareAndSwapInt_builtin, 0},
- { { "sun.misc.Unsafe" }, { "compareAndSwapLong" },
- compareAndSwapLong_builtin, 0},
- { { "sun.misc.Unsafe" }, { "compareAndSwapObject" },
- compareAndSwapObject_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putOrderedInt" }, putVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putOrderedLong" }, putVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putOrderedObject" }, putVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putIntVolatile" }, putVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putLongVolatile" }, putVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "putObjectVolatile" }, putVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "getObjectVolatile" }, getVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "getIntVolatile" }, getVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "getLongVolatile" }, getVolatile_builtin, 0},
- { { "sun.misc.Unsafe" }, { "getLong" }, getVolatile_builtin, 0},
- { { "java.util.concurrent.atomic.AtomicLong" }, { "VMSupportsCS8" },
- VMSupportsCS8_builtin, 0},
+ { { "java.lang.Float" }, { "intBitsToFloat" }, convert_real,
+ (enum built_in_function) 0 },
+ { { "java.lang.Double" }, { "longBitsToDouble" }, convert_real,
+ (enum built_in_function) 0 },
+ { { "java.lang.Float" }, { "floatToRawIntBits" }, convert_real,
+ (enum built_in_function) 0 },
+ { { "java.lang.Double" }, { "doubleToRawLongBits" }, convert_real,
+ (enum built_in_function) 0 },
+ { { "sun.misc.Unsafe" }, { "putInt" }, putObject_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putLong" }, putObject_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putObject" }, putObject_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "compareAndSwapInt" },
+ compareAndSwapInt_builtin, (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "compareAndSwapLong" },
+ compareAndSwapLong_builtin, (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "compareAndSwapObject" },
+ compareAndSwapObject_builtin, (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putOrderedInt" }, putVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putOrderedLong" }, putVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putOrderedObject" }, putVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putIntVolatile" }, putVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putLongVolatile" }, putVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "putObjectVolatile" }, putVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "getObjectVolatile" }, getVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "getIntVolatile" }, getVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "getLongVolatile" }, getVolatile_builtin, (enum built_in_function) 0},
+ { { "sun.misc.Unsafe" }, { "getLong" }, getVolatile_builtin,
+ (enum built_in_function) 0},
+ { { "java.util.concurrent.atomic.AtomicLong" }, { "VMSupportsCS8" },
+ VMSupportsCS8_builtin, (enum built_in_function) 0},
{ { NULL }, { NULL }, NULL, END_BUILTINS }
};
diff --git a/gcc/java/constants.c b/gcc/java/constants.c
index 526d9c777b5..70d628b4c5a 100644
--- a/gcc/java/constants.c
+++ b/gcc/java/constants.c
@@ -557,13 +557,22 @@ build_constants_constructor (void)
tree data_decl, tags_decl, tags_type;
tree max_index = build_int_cst (sizetype, outgoing_cpool->count - 1);
tree index_type = build_index_type (max_index);
+ tree tem;
/* Add dummy 0'th element of constant pool. */
tags_list = tree_cons (NULL_TREE, get_tag_node (0), tags_list);
data_list = tree_cons (NULL_TREE, null_pointer_node, data_list);
+ /* Change the type of the decl to have the proper array size.
+ ??? Make sure to transition the old type-pointer-to list to this
+ new type to not invalidate all build address expressions. */
data_decl = build_constant_data_ref (false);
+ tem = TYPE_POINTER_TO (TREE_TYPE (data_decl));
+ if (!tem)
+ tem = build_pointer_type (TREE_TYPE (data_decl));
+ TYPE_POINTER_TO (TREE_TYPE (data_decl)) = NULL_TREE;
TREE_TYPE (data_decl) = build_array_type (ptr_type_node, index_type);
+ TYPE_POINTER_TO (TREE_TYPE (data_decl)) = tem;
DECL_INITIAL (data_decl) = build_constructor_from_list
(TREE_TYPE (data_decl), data_list);
DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
diff --git a/gcc/java/verify-impl.c b/gcc/java/verify-impl.c
index 5c4de456bbd..759ee42c3db 100644
--- a/gcc/java/verify-impl.c
+++ b/gcc/java/verify-impl.c
@@ -1947,7 +1947,7 @@ check_pool_index (int index)
static type
check_class_constant (int index)
{
- type t = { 0, 0, 0 };
+ type t = { (type_val) 0, 0, 0 };
vfy_constants *pool;
check_pool_index (index);
@@ -1964,7 +1964,7 @@ check_class_constant (int index)
static type
check_constant (int index)
{
- type t = { 0, 0, 0 };
+ type t = { (type_val) 0, 0, 0 };
vfy_constants *pool;
check_pool_index (index);
@@ -1988,7 +1988,7 @@ check_constant (int index)
static type
check_wide_constant (int index)
{
- type t = { 0, 0, 0 };
+ type t = { (type_val) 0, 0, 0 };
vfy_constants *pool;
check_pool_index (index);
diff --git a/gcc/l-ipo.c b/gcc/l-ipo.c
index 34a9e208994..46e8506c862 100644
--- a/gcc/l-ipo.c
+++ b/gcc/l-ipo.c
@@ -1,6 +1,6 @@
-/* Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009. Free Software Foundation, Inc.
Contributed by Xinliang David Li (davidxl@google.com) and
- Raksit Ashok (raskit@google.com)
+ Raksit Ashok (raksit@google.com)
This file is part of GCC.
@@ -14,8 +14,13 @@ 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 GCC; see the file COPYING3. If not see
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "config.h"
diff --git a/gcc/l-ipo.h b/gcc/l-ipo.h
index 95f5b0b1f82..03779e6c2af 100644
--- a/gcc/l-ipo.h
+++ b/gcc/l-ipo.h
@@ -1,6 +1,6 @@
-/* Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2009. Free Software Foundation, Inc.
Contributed by Xinliang David Li (davidxl@google.com) and
- Raksit Ashok (raskit@google.com)
+ Raksit Ashok (raksit@google.com)
This file is part of GCC.
@@ -14,8 +14,13 @@ 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 GCC; see the file COPYING3. If not see
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_L_IPO_H
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index bbece183cc9..7b143261845 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -409,11 +409,11 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
if (TREE_CODE (TREE_TYPE (fndecl)) == METHOD_TYPE)
pp_printf
(context->printer, _("In member function %qs"),
- lang_hooks.decl_printable_name (fndecl, 2));
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
else
pp_printf
(context->printer, _("In function %qs"),
- lang_hooks.decl_printable_name (fndecl, 2));
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
while (abstract_origin)
{
@@ -464,18 +464,18 @@ lhd_print_error_function (diagnostic_context *context, const char *file,
if (flag_show_column && s.column != 0)
pp_printf (context->printer,
_(" inlined from %qs at %s:%d:%d"),
- lang_hooks.decl_printable_name (fndecl, 2),
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)),
s.file, s.line, s.column);
else
pp_printf (context->printer,
_(" inlined from %qs at %s:%d"),
- lang_hooks.decl_printable_name (fndecl, 2),
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)),
s.file, s.line);
}
else
pp_printf (context->printer, _(" inlined from %qs"),
- lang_hooks.decl_printable_name (fndecl, 2));
+ identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)));
}
}
pp_character (context->printer, ':');
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index eb8a9b01f3b..cca11b53aba 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -1,5 +1,5 @@
/* The lang_hooks data structure.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -227,20 +227,53 @@ struct lang_hooks_for_decls
struct lang_hooks_for_lipo
{
+ /* Add DECL to the list predefined builtins. */
void (*add_built_in_decl) (tree decl);
+
+ /* Save the tree (by making a copy) and binding values
+ for builtins before parsing start. */
void (*save_built_in_decl_pre_parsing) (void);
+
+ /* Restore builtins and their bindings to their values
+ before parsing. */
void (*restore_built_in_decl_pre_parsing) (void);
+
+ /* Save the tree (by making a copy) and binding values for
+ builtins after parsing of a file. */
void (*save_built_in_decl_post_module_parsing) (void);
+
+ /* Restore builtins and their bindings to their post
+ parsing values. */
void (*restore_built_in_decl_post_module_parsing) (void);
+
+ /* Clear symbol binding for name ID. */
void (*clear_global_name_bindings) (tree id);
+
+ /* Return 1 if DECL in SCOPE is scoped in global/namespace scope,
+ otherwise return 0. */
int (*has_global_name) (tree decl, void *scope);
- int (*get_lang_decl_size) (tree);
+
+ /* Return the actual size of the lang_decl struct for
+ decl T. */
+ int (*get_lang_decl_size) (tree t);
+
+ /* Duplicate language specific type information from SRC
+ to DEST. */
void (*dup_lang_type) (tree src, tree dest);
+
+ /* Copy DEST into SRC. */
void (*copy_lang_type) (tree src, tree dest);
+
+ /* Process decls after parsing of a source module. */
void (*process_pending_decls) (unsigned);
+
+ /* Clear the list of deferred functions. */
void (*clear_deferred_fns) (void);
+
+ /* Return 1 if T is compiler generated. */
int (*is_compiler_generated_type) (tree t);
- /* compare language specific types. */
+
+ /* Compare language specific types T1 and T2. */
int (*cmp_lang_type) (tree t1, tree t2);
};
@@ -353,7 +386,10 @@ struct lang_hooks
information will be printed: 0: DECL_NAME, demangled as
necessary. 1: and scope information. 2: and any other
information that might be interesting, such as function parameter
- types in C++. */
+ types in C++. The name is in the internal character set and
+ needs to be converted to the locale character set of diagnostics,
+ or to the execution character set for strings such as
+ __PRETTY_FUNCTION__. */
const char *(*decl_printable_name) (tree decl, int verbosity);
/* Computes the dwarf-2/3 name for a tree. VERBOSITY determines what
diff --git a/gcc/libgcov.c b/gcc/libgcov.c
index d2c94f312d6..08cd510cbb4 100644
--- a/gcc/libgcov.c
+++ b/gcc/libgcov.c
@@ -30,6 +30,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "coretypes.h"
#include "tm.h"
+#if 1
+#define THREAD_PREFIX __thread
+#else
+#define THREAD_PREFIX
+#endif
+
#if defined(inhibit_libc)
#define IN_LIBGCOV (-1)
#else
@@ -85,17 +91,17 @@ static gcov_unsigned_t gcov_cur_module_id = 0;
/* Pointer to the direct-call counters (per call-site counters).
Initialized by the caller. */
-__thread gcov_type *__gcov_direct_call_counters;
+THREAD_PREFIX gcov_type *__gcov_direct_call_counters;
/* Direct call callee address. */
-__thread void *__gcov_direct_call_callee;
+THREAD_PREFIX void *__gcov_direct_call_callee;
/* Pointer to the indirect-call counters (per call-site counters).
Initialized by the caller. */
-__thread gcov_type *__gcov_indirect_call_topn_counters;
+THREAD_PREFIX gcov_type *__gcov_indirect_call_topn_counters;
/* Indirect call callee address. */
-__thread void *__gcov_indirect_call_topn_callee;
+THREAD_PREFIX void *__gcov_indirect_call_topn_callee;
/* A program checksum allows us to distinguish program data for an
object file included in multiple programs. */
@@ -1178,8 +1184,8 @@ __gcov_indirect_call_profiler (gcov_type* counter, gcov_type value,
#ifdef L_gcov_indirect_call_topn_profiler
-extern __thread gcov_type *__gcov_indirect_call_topn_counters;
-extern __thread void *__gcov_indirect_call_topn_callee;
+extern THREAD_PREFIX gcov_type *__gcov_indirect_call_topn_counters;
+extern THREAD_PREFIX void *__gcov_indirect_call_topn_callee;
void
__gcov_indirect_call_topn_profiler (void *cur_func,
void *cur_module_gcov_info,
@@ -1205,8 +1211,8 @@ __gcov_indirect_call_topn_profiler (void *cur_func,
#endif
#ifdef L_gcov_direct_call_profiler
-extern __thread gcov_type *__gcov_direct_call_counters;
-extern __thread void *__gcov_direct_call_callee;
+extern THREAD_PREFIX gcov_type *__gcov_direct_call_counters;
+extern THREAD_PREFIX void *__gcov_direct_call_callee;
/* Direct call profiler. */
void
__gcov_direct_call_profiler (void *cur_func,
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 82e18297e20..8c1e0e6202d 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -71,7 +71,7 @@ struct use
{
rtx *pos; /* Position of the use. */
rtx insn; /* The insn in that the use occurs. */
-
+ unsigned addr_use_p; /* Whether the use occurs in an address. */
struct use *next; /* Next use in the list. */
};
@@ -82,6 +82,7 @@ struct def
struct use *uses; /* The list of uses that are uniquely reached
by it. */
unsigned n_uses; /* Number of such uses. */
+ unsigned n_addr_uses; /* Number of uses in addresses. */
unsigned invno; /* The corresponding invariant. */
};
@@ -111,6 +112,9 @@ struct invariant
/* Whether to move the invariant. */
bool move;
+ /* Whether the invariant is cheap when used as an address. */
+ bool cheap_address;
+
/* Cost of the invariant. */
unsigned cost;
@@ -679,9 +683,16 @@ create_new_invariant (struct def *def, rtx insn, bitmap depends_on,
/* If the set is simple, usually by moving it we move the whole store out of
the loop. Otherwise we save only cost of the computation. */
if (def)
- inv->cost = rtx_cost (set, SET, speed);
+ {
+ inv->cost = rtx_cost (set, SET, speed);
+ inv->cheap_address = address_cost (SET_SRC (set), word_mode,
+ speed) < COSTS_N_INSNS (1);
+ }
else
- inv->cost = rtx_cost (SET_SRC (set), SET, speed);
+ {
+ inv->cost = rtx_cost (SET_SRC (set), SET, speed);
+ inv->cheap_address = false;
+ }
inv->move = false;
inv->reg = NULL_RTX;
@@ -708,17 +719,19 @@ create_new_invariant (struct def *def, rtx insn, bitmap depends_on,
/* Record USE at DEF. */
static void
-record_use (struct def *def, rtx *use, rtx insn)
+record_use (struct def *def, df_ref use)
{
struct use *u = XNEW (struct use);
- gcc_assert (REG_P (*use));
-
- u->pos = use;
- u->insn = insn;
+ u->pos = DF_REF_REAL_LOC (use);
+ u->insn = DF_REF_INSN (use);
+ u->addr_use_p = (DF_REF_TYPE (use) == DF_REF_REG_MEM_LOAD
+ || DF_REF_TYPE (use) == DF_REF_REG_MEM_STORE);
u->next = def->uses;
def->uses = u;
def->n_uses++;
+ if (u->addr_use_p)
+ def->n_addr_uses++;
}
/* Finds the invariants USE depends on and store them to the DEPENDS_ON
@@ -865,14 +878,14 @@ record_uses (rtx insn)
df_ref use = *use_rec;
inv = invariant_for_use (use);
if (inv)
- record_use (inv->def, DF_REF_REAL_LOC (use), DF_REF_INSN (use));
+ record_use (inv->def, use);
}
for (use_rec = DF_INSN_INFO_EQ_USES (insn_info); *use_rec; use_rec++)
{
df_ref use = *use_rec;
inv = invariant_for_use (use);
if (inv)
- record_use (inv->def, DF_REF_REAL_LOC (use), DF_REF_INSN (use));
+ record_use (inv->def, use);
}
}
@@ -992,7 +1005,9 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed)
inv->stamp = actual_stamp;
(*regs_needed)++;
- (*comp_cost) += inv->cost;
+ if (!inv->cheap_address
+ || inv->def->n_addr_uses < inv->def->n_uses)
+ (*comp_cost) += inv->cost;
#ifdef STACK_REGS
{
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index 704dbe7ef82..9c5369417f2 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -115,7 +115,6 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "rtl.h"
-#include "c-tree.h"
#include "tree-inline.h"
#include "tree-flow.h"
#include "tree-flow-inline.h"
@@ -131,7 +130,6 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "params.h"
#include "fibheap.h"
-#include "c-common.h"
#include "intl.h"
#include "function.h"
#include "basic-block.h"
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 1dea5280288..5f5a4787caf 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,7 @@
+2009-04-27 Ian Lance Taylor <iant@google.com>
+
+ * objc-act.c (objc_gimplify_expr): Add casts to enum type.
+
2009-04-24 Ian Lance Taylor <iant@google.com>
* objc-act.c (get_super_receiver): Update calls to
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 89048e0f3af..741e344fd74 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -9552,9 +9552,9 @@ objc_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
}
#ifdef OBJCPLUS
- return cp_gimplify_expr (expr_p, pre_p, post_p);
+ return (enum gimplify_status) cp_gimplify_expr (expr_p, pre_p, post_p);
#else
- return c_gimplify_expr (expr_p, pre_p, post_p);
+ return (enum gimplify_status) c_gimplify_expr (expr_p, pre_p, post_p);
#endif
}
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 8bf8fa76297..7eab811f066 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -555,10 +555,10 @@ expand_widen_pattern_expr (tree exp, rtx op0, rtx op1, rtx wide_op, rtx target,
int unsignedp)
{
tree oprnd0, oprnd1, oprnd2;
- enum machine_mode wmode = 0, tmode0, tmode1 = 0;
+ enum machine_mode wmode = VOIDmode, tmode0, tmode1 = VOIDmode;
optab widen_pattern_optab;
int icode;
- enum machine_mode xmode0, xmode1 = 0, wxmode = 0;
+ enum machine_mode xmode0, xmode1 = VOIDmode, wxmode = VOIDmode;
rtx temp;
rtx pat;
rtx xop0, xop1, wxop;
diff --git a/gcc/opts.c b/gcc/opts.c
index 2f2b98efa39..63139f2bd77 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -54,9 +54,6 @@ bool sel_sched_switch_set;
/* True if we should exit after parsing options. */
bool exit_after_options;
-/* Print various extra warnings. -W/-Wextra. */
-bool extra_warnings;
-
/* True to warn about any objects definitions whose size is larger
than N bytes. Also want about function definitions whose returned
values are larger than N bytes, where N is `larger_than_size'. */
@@ -373,7 +370,6 @@ unsigned num_in_fnames;
static int common_handle_option (size_t scode, const char *arg, int value,
unsigned int lang_mask);
static void handle_param (const char *);
-static void set_Wextra (int);
static unsigned int handle_option (const char **argv, unsigned int lang_mask);
static char *write_langs (unsigned int lang_mask);
static void complain_wrong_lang (const char *, const struct cl_option *,
@@ -859,6 +855,7 @@ decode_options (unsigned int argc, const char **argv)
#endif
flag_guess_branch_prob = opt1;
flag_cprop_registers = opt1;
+ flag_forward_propagate = opt1;
flag_if_conversion = opt1;
flag_if_conversion2 = opt1;
flag_ipa_pure_const = opt1;
@@ -884,7 +881,6 @@ decode_options (unsigned int argc, const char **argv)
flag_thread_jumps = opt2;
flag_crossjumping = opt2;
flag_optimize_sibling_calls = opt2;
- flag_forward_propagate = opt2;
flag_cse_follow_jumps = opt2;
flag_gcse = opt2;
flag_expensive_optimizations = opt2;
@@ -972,6 +968,27 @@ decode_options (unsigned int argc, const char **argv)
handle_options (argc, argv, lang_mask);
+ /* Make DUMP_BASE_NAME relative to the AUX_BASE_NAME directory,
+ typically the directory to contain the object file. */
+ if (aux_base_name && ! IS_ABSOLUTE_PATH (dump_base_name))
+ {
+ const char *aux_base;
+
+ base_of_path (aux_base_name, &aux_base);
+ if (aux_base_name != aux_base)
+ {
+ int dir_len = aux_base - aux_base_name;
+ char *new_dump_base_name =
+ XNEWVEC (char, strlen(dump_base_name) + dir_len + 1);
+
+ /* Copy directory component from AUX_BASE_NAME. */
+ memcpy (new_dump_base_name, aux_base_name, dir_len);
+ /* Append existing DUMP_BASE_NAME. */
+ strcpy (new_dump_base_name + dir_len, dump_base_name);
+ dump_base_name = new_dump_base_name;
+ }
+ }
+
/* Handle related options for unit-at-a-time, toplevel-reorder, and
section-anchors. */
if (!flag_unit_at_a_time)
@@ -1579,19 +1596,10 @@ common_handle_option (size_t scode, const char *arg, int value,
/* Currently handled in a prescan. */
break;
- case OPT_W:
- /* For backward compatibility, -W is the same as -Wextra. */
- set_Wextra (value);
- break;
-
case OPT_Werror_:
enable_warning_as_error (arg, value, lang_mask);
break;
- case OPT_Wextra:
- set_Wextra (value);
- break;
-
case OPT_Wlarger_than_:
/* This form corresponds to -Wlarger-than-.
Kept for backward compatibility.
@@ -2108,21 +2116,6 @@ handle_param (const char *carg)
free (arg);
}
-/* Handle -W and -Wextra. */
-static void
-set_Wextra (int setting)
-{
- extra_warnings = 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 (setting == 0)
- warn_uninitialized = 0;
- else if (warn_uninitialized != 1)
- warn_uninitialized = 2;
-}
-
/* Used to set the level of strict aliasing warnings,
when no level is specified (i.e., when -Wstrict-aliasing, and not
-Wstrict-aliasing=level was given).
diff --git a/gcc/passes.c b/gcc/passes.c
index 30112c231ba..87e0363eeab 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -738,7 +738,12 @@ init_optimization_passes (void)
NEXT_PASS (pass_df_initialize_opt);
NEXT_PASS (pass_cse);
NEXT_PASS (pass_rtl_fwprop);
- NEXT_PASS (pass_gcse);
+ NEXT_PASS (pass_rtl_cprop);
+ NEXT_PASS (pass_rtl_pre);
+ NEXT_PASS (pass_rtl_hoist);
+ NEXT_PASS (pass_rtl_cprop);
+ NEXT_PASS (pass_rtl_store_motion);
+ NEXT_PASS (pass_cse_after_global_opts);
NEXT_PASS (pass_rtl_ifcvt);
/* Perform loop optimizations. It might be better to do them a bit
sooner, but we want the profile feedback to work more
@@ -755,7 +760,7 @@ init_optimization_passes (void)
*p = NULL;
}
NEXT_PASS (pass_web);
- NEXT_PASS (pass_jump_bypass);
+ NEXT_PASS (pass_rtl_cprop);
NEXT_PASS (pass_cse2);
NEXT_PASS (pass_rtl_dse1);
NEXT_PASS (pass_rtl_fwprop_addr);
@@ -850,7 +855,7 @@ do_per_function (void (*callback) (void *data), void *data)
{
struct cgraph_node *node;
for (node = cgraph_nodes; node; node = node->next)
- if (node->analyzed)
+ if (node->analyzed && gimple_has_body_p (node->decl))
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
current_function_decl = node->decl;
diff --git a/gcc/plugin-version.c b/gcc/plugin-version.c
deleted file mode 100644
index b6f35a9d18f..00000000000
--- a/gcc/plugin-version.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Version information for plugins.
- Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 3, or (at your option) any later
-version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-#include "system.h"
-#include "gcc-plugin.h"
-#include "configargs.h"
-
-static char basever[] = BASEVER;
-static char datestamp[] = DATESTAMP;
-static char devphase[] = DEVPHASE;
-static char revision[] = REVISION;
-
-/* FIXME plugins: We should make the version information more precise.
- One way to do is to add a checksum. */
-
-struct plugin_gcc_version plugin_gcc_version = {basever, datestamp, devphase,
- revision,
- configuration_arguments};
diff --git a/gcc/plugin.c b/gcc/plugin.c
index c406c38b5f3..dec336d70b7 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -38,6 +38,9 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "plugin.h"
#include "timevar.h"
+#ifdef ENABLE_PLUGIN
+#include "plugin-version.h"
+#endif
/* Event names as strings. Keep in sync with enum plugin_event. */
const char *plugin_event_name[] =
@@ -99,7 +102,6 @@ static struct pass_list_node *prev_added_pass_node;
/* Each plugin should define an initialization function with exactly
this name. */
static const char *str_plugin_init_func_name = "plugin_init";
-static const char *str_plugin_gcc_version_name = "plugin_gcc_version";
#endif
/* Helper function for the hash table that compares the base_name of the
@@ -567,10 +569,8 @@ try_init_one_plugin (struct plugin_name_args *plugin)
{
void *dl_handle;
plugin_init_func plugin_init;
- struct plugin_gcc_version *version;
char *err;
PTR_UNION_TYPE (plugin_init_func) plugin_init_union;
- PTR_UNION_TYPE (struct plugin_gcc_version*) version_union;
dl_handle = dlopen (plugin->full_name, RTLD_NOW);
if (!dl_handle)
@@ -593,12 +593,9 @@ try_init_one_plugin (struct plugin_name_args *plugin)
return false;
}
- PTR_UNION_AS_VOID_PTR (version_union) =
- dlsym (dl_handle, str_plugin_gcc_version_name);
- version = PTR_UNION_AS_CAST_PTR (version_union);
-
/* Call the plugin-provided initialization routine with the arguments. */
- if ((*plugin_init) (plugin->base_name, version, plugin->argc, plugin->argv))
+ if ((*plugin_init) (plugin->base_name, &gcc_version, plugin->argc,
+ plugin->argv))
{
error ("Fail to initialize plugin %s", plugin->full_name);
return false;
@@ -816,22 +813,22 @@ debug_active_plugins (void)
/* The default version check. Compares every field in VERSION. */
bool
-plugin_default_version_check(struct plugin_gcc_version *version)
+plugin_default_version_check (struct plugin_gcc_version *gcc_version,
+ struct plugin_gcc_version *plugin_version)
{
- /* version is NULL if the plugin was not linked with plugin-version.o */
- if (!version)
+ if (!gcc_version || !plugin_version)
return false;
- if (strcmp (version->basever, plugin_gcc_version.basever))
+ if (strcmp (gcc_version->basever, plugin_version->basever))
return false;
- if (strcmp (version->datestamp, plugin_gcc_version.datestamp))
+ if (strcmp (gcc_version->datestamp, plugin_version->datestamp))
return false;
- if (strcmp (version->devphase, plugin_gcc_version.devphase))
+ if (strcmp (gcc_version->devphase, plugin_version->devphase))
return false;
- if (strcmp (version->revision, plugin_gcc_version.revision))
+ if (strcmp (gcc_version->revision, plugin_version->revision))
return false;
- if (strcmp (version->configuration_arguments,
- plugin_gcc_version.configuration_arguments))
+ if (strcmp (gcc_version->configuration_arguments,
+ plugin_version->configuration_arguments))
return false;
return true;
}
diff --git a/gcc/predict.c b/gcc/predict.c
index e3fc6cedf75..732283d4c22 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -677,7 +677,8 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
if (REG_NOTE_KIND (note) == REG_BR_PRED)
{
- enum br_predictor predictor = INTVAL (XEXP (XEXP (note, 0), 0));
+ enum br_predictor predictor = ((enum br_predictor)
+ INTVAL (XEXP (XEXP (note, 0), 0)));
int probability = INTVAL (XEXP (XEXP (note, 0), 1));
found = true;
@@ -723,7 +724,8 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
{
if (REG_NOTE_KIND (*pnote) == REG_BR_PRED)
{
- enum br_predictor predictor = INTVAL (XEXP (XEXP (*pnote, 0), 0));
+ enum br_predictor predictor = ((enum br_predictor)
+ INTVAL (XEXP (XEXP (*pnote, 0), 0)));
int probability = INTVAL (XEXP (XEXP (*pnote, 0), 1));
dump_prediction (dump_file, predictor, probability, bb,
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index b611ec98516..d531075c933 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -26,6 +26,11 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "pretty-print.h"
#include "tree.h"
+#include "ggc.h"
+
+#if HAVE_ICONV
+#include <iconv.h>
+#endif
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
@@ -844,3 +849,228 @@ pp_base_maybe_space (pretty_printer *pp)
pp_base (pp)->padding = pp_none;
}
}
+
+/* Print the identifier ID to PRETTY-PRINTER. */
+
+void
+pp_base_tree_identifier (pretty_printer *pp, tree id)
+{
+ const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
+ pp_append_text (pp, text, text + strlen (text));
+}
+
+/* The string starting at P has LEN (at least 1) bytes left; if they
+ start with a valid UTF-8 sequence, return the length of that
+ sequence and set *VALUE to the value of that sequence, and
+ otherwise return 0 and set *VALUE to (unsigned int) -1. */
+
+static int
+decode_utf8_char (const unsigned char *p, size_t len, unsigned int *value)
+{
+ unsigned int t = *p;
+
+ if (len == 0)
+ abort ();
+ if (t & 0x80)
+ {
+ size_t utf8_len = 0;
+ unsigned int ch;
+ size_t i;
+ for (t = *p; t & 0x80; t <<= 1)
+ utf8_len++;
+
+ if (utf8_len > len || utf8_len < 2 || utf8_len > 6)
+ {
+ *value = (unsigned int) -1;
+ return 0;
+ }
+ ch = *p & ((1 << (7 - utf8_len)) - 1);
+ for (i = 1; i < utf8_len; i++)
+ {
+ unsigned int u = p[i];
+ if ((u & 0xC0) != 0x80)
+ {
+ *value = (unsigned int) -1;
+ return 0;
+ }
+ ch = (ch << 6) | (u & 0x3F);
+ }
+ if ( (ch <= 0x7F && utf8_len > 1)
+ || (ch <= 0x7FF && utf8_len > 2)
+ || (ch <= 0xFFFF && utf8_len > 3)
+ || (ch <= 0x1FFFFF && utf8_len > 4)
+ || (ch <= 0x3FFFFFF && utf8_len > 5)
+ || (ch >= 0xD800 && ch <= 0xDFFF))
+ {
+ *value = (unsigned int) -1;
+ return 0;
+ }
+ *value = ch;
+ return utf8_len;
+ }
+ else
+ {
+ *value = t;
+ return 1;
+ }
+}
+
+/* Given IDENT, an identifier in the internal encoding, return a
+ version of IDENT suitable for diagnostics in the locale character
+ set: either IDENT itself, or a garbage-collected string converted
+ to the locale character set and using escape sequences if not
+ representable in the locale character set or containing control
+ characters or invalid byte sequences. Existing backslashes in
+ IDENT are not doubled, so the result may not uniquely specify the
+ contents of an arbitrary byte sequence identifier. */
+
+const char *
+identifier_to_locale (const char *ident)
+{
+ const unsigned char *uid = (const unsigned char *) ident;
+ size_t idlen = strlen (ident);
+ bool valid_printable_utf8 = true;
+ bool all_ascii = true;
+ size_t i;
+
+ for (i = 0; i < idlen;)
+ {
+ unsigned int c;
+ size_t utf8_len = decode_utf8_char (&uid[i], idlen - i, &c);
+ if (utf8_len == 0 || c <= 0x1F || (c >= 0x7F && c <= 0x9F))
+ {
+ valid_printable_utf8 = false;
+ break;
+ }
+ if (utf8_len > 1)
+ all_ascii = false;
+ i += utf8_len;
+ }
+
+ /* If IDENT contains invalid UTF-8 sequences (which may occur with
+ attributes putting arbitrary byte sequences in identifiers), or
+ control characters, we use octal escape sequences for all bytes
+ outside printable ASCII. */
+ if (!valid_printable_utf8)
+ {
+ char *ret = GGC_NEWVEC (char, 4 * idlen + 1);
+ char *p = ret;
+ for (i = 0; i < idlen; i++)
+ {
+ if (uid[i] > 0x1F && uid[i] < 0x7F)
+ *p++ = uid[i];
+ else
+ {
+ sprintf (p, "\\%03o", uid[i]);
+ p += 4;
+ }
+ }
+ *p = 0;
+ return ret;
+ }
+
+ /* Otherwise, if it is valid printable ASCII, or printable UTF-8
+ with the locale character set being UTF-8, IDENT is used. */
+ if (all_ascii || locale_utf8)
+ return ident;
+
+ /* Otherwise IDENT is converted to the locale character set if
+ possible. */
+#if defined ENABLE_NLS && defined HAVE_LANGINFO_CODESET && HAVE_ICONV
+ if (locale_encoding != NULL)
+ {
+ iconv_t cd = iconv_open (locale_encoding, "UTF-8");
+ bool conversion_ok = true;
+ char *ret = NULL;
+ if (cd != (iconv_t) -1)
+ {
+ size_t ret_alloc = 4 * idlen + 1;
+ for (;;)
+ {
+ /* Repeat the whole conversion process as needed with
+ larger buffers so non-reversible transformations can
+ always be detected. */
+ ICONV_CONST char *inbuf = CONST_CAST (char *, ident);
+ char *outbuf;
+ size_t inbytesleft = idlen;
+ size_t outbytesleft = ret_alloc - 1;
+ size_t iconv_ret;
+
+ ret = GGC_NEWVEC (char, ret_alloc);
+ outbuf = ret;
+
+ if (iconv (cd, 0, 0, 0, 0) == (size_t) -1)
+ {
+ conversion_ok = false;
+ break;
+ }
+
+ iconv_ret = iconv (cd, &inbuf, &inbytesleft,
+ &outbuf, &outbytesleft);
+ if (iconv_ret == (size_t) -1 || inbytesleft != 0)
+ {
+ if (errno == E2BIG)
+ {
+ ret_alloc *= 2;
+ ggc_free (ret);
+ ret = NULL;
+ continue;
+ }
+ else
+ {
+ conversion_ok = false;
+ break;
+ }
+ }
+ else if (iconv_ret != 0)
+ {
+ conversion_ok = false;
+ break;
+ }
+ /* Return to initial shift state. */
+ if (iconv (cd, 0, 0, &outbuf, &outbytesleft) == (size_t) -1)
+ {
+ if (errno == E2BIG)
+ {
+ ret_alloc *= 2;
+ ggc_free (ret);
+ ret = NULL;
+ continue;
+ }
+ else
+ {
+ conversion_ok = false;
+ break;
+ }
+ }
+ *outbuf = 0;
+ break;
+ }
+ iconv_close (cd);
+ if (conversion_ok)
+ return ret;
+ }
+ }
+#endif
+
+ /* Otherwise, convert non-ASCII characters in IDENT to UCNs. */
+ {
+ char *ret = GGC_NEWVEC (char, 10 * idlen + 1);
+ char *p = ret;
+ for (i = 0; i < idlen;)
+ {
+ unsigned int c;
+ size_t utf8_len = decode_utf8_char (&uid[i], idlen - i, &c);
+ if (utf8_len == 1)
+ *p++ = uid[i];
+ else
+ {
+ sprintf (p, "\\U%08x", c);
+ p += 10;
+ }
+ i += utf8_len;
+ }
+ *p = 0;
+ return ret;
+ }
+}
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index dd3f0c0ad39..58292259604 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -273,10 +273,9 @@ struct pretty_print_info
pp_scalar (PP, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) I)
#define pp_pointer(PP, P) pp_scalar (PP, "%p", P)
-#define pp_identifier(PP, ID) pp_string (PP, ID)
+#define pp_identifier(PP, ID) pp_string (PP, identifier_to_locale (ID))
#define pp_tree_identifier(PP, T) \
- pp_append_text(PP, IDENTIFIER_POINTER (T), \
- IDENTIFIER_POINTER (T) + IDENTIFIER_LENGTH (T))
+ pp_base_tree_identifier (pp_base (PP), T)
#define pp_unsupported_tree(PP, T) \
pp_verbatim (pp_base (PP), "#%qs not supported by %s#", \
@@ -322,6 +321,7 @@ extern void pp_base_character (pretty_printer *, int);
extern void pp_base_string (pretty_printer *, const char *);
extern void pp_write_text_to_stream (pretty_printer *pp);
extern void pp_base_maybe_space (pretty_printer *);
+extern void pp_base_tree_identifier (pretty_printer *, tree);
/* Switch into verbatim mode and return the old mode. */
static inline pp_wrapping_mode_t
@@ -334,4 +334,6 @@ pp_set_verbatim_wrapping_ (pretty_printer *pp)
}
#define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (pp_base (PP))
+extern const char *identifier_to_locale (const char *);
+
#endif /* GCC_PRETTY_PRINT_H */
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 24ff249c108..0d352642157 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -448,6 +448,10 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
fprintf (file, " %s", GET_MODE_NAME (mode));
}
+ if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
+ && DECL_BY_REFERENCE (node))
+ fputs (" passed-by-reference", file);
+
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node))
fputs (" defer-output", file);
@@ -896,14 +900,11 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (SSA_NAME_IN_FREE_LIST (node))
fprintf (file, " in-free-list");
- if (SSA_NAME_PTR_INFO (node)
- || SSA_NAME_VALUE (node))
+ if (SSA_NAME_PTR_INFO (node))
{
indent_to (file, indent + 3);
if (SSA_NAME_PTR_INFO (node))
dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
- if (SSA_NAME_VALUE (node))
- dump_addr (file, " value ", SSA_NAME_VALUE (node));
}
break;
diff --git a/gcc/real.c b/gcc/real.c
index 1a63ecdb140..3803ed69c1b 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -997,7 +997,7 @@ bool
real_arithmetic (REAL_VALUE_TYPE *r, int icode, const REAL_VALUE_TYPE *op0,
const REAL_VALUE_TYPE *op1)
{
- enum tree_code code = icode;
+ enum tree_code code = (enum tree_code) icode;
if (op0->decimal || (op1 && op1->decimal))
return decimal_real_arithmetic (r, code, op0, op1);
@@ -1069,7 +1069,7 @@ bool
real_compare (int icode, const REAL_VALUE_TYPE *op0,
const REAL_VALUE_TYPE *op1)
{
- enum tree_code code = icode;
+ enum tree_code code = (enum tree_code) icode;
switch (code)
{
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
new file mode 100644
index 00000000000..87aaf02c409
--- /dev/null
+++ b/gcc/regcprop.c
@@ -0,0 +1,1005 @@
+/* Copy propagation on hard registers for the GNU compiler.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "rtl.h"
+#include "tm_p.h"
+#include "insn-config.h"
+#include "regs.h"
+#include "addresses.h"
+#include "hard-reg-set.h"
+#include "basic-block.h"
+#include "reload.h"
+#include "output.h"
+#include "function.h"
+#include "recog.h"
+#include "flags.h"
+#include "toplev.h"
+#include "obstack.h"
+#include "timevar.h"
+#include "tree-pass.h"
+#include "df.h"
+
+/* The following code does forward propagation of hard register copies.
+ The object is to eliminate as many dependencies as possible, so that
+ we have the most scheduling freedom. As a side effect, we also clean
+ up some silly register allocation decisions made by reload. This
+ code may be obsoleted by a new register allocator. */
+
+/* For each register, we have a list of registers that contain the same
+ value. The OLDEST_REGNO field points to the head of the list, and
+ the NEXT_REGNO field runs through the list. The MODE field indicates
+ what mode the data is known to be in; this field is VOIDmode when the
+ register is not known to contain valid data. */
+
+struct value_data_entry
+{
+ enum machine_mode mode;
+ unsigned int oldest_regno;
+ unsigned int next_regno;
+};
+
+struct value_data
+{
+ struct value_data_entry e[FIRST_PSEUDO_REGISTER];
+ unsigned int max_value_regs;
+};
+
+static void kill_value_one_regno (unsigned, struct value_data *);
+static void kill_value_regno (unsigned, unsigned, struct value_data *);
+static void kill_value (rtx, struct value_data *);
+static void set_value_regno (unsigned, enum machine_mode, struct value_data *);
+static void init_value_data (struct value_data *);
+static void kill_clobbered_value (rtx, const_rtx, void *);
+static void kill_set_value (rtx, const_rtx, void *);
+static int kill_autoinc_value (rtx *, void *);
+static void copy_value (rtx, rtx, struct value_data *);
+static bool mode_change_ok (enum machine_mode, enum machine_mode,
+ unsigned int);
+static rtx maybe_mode_change (enum machine_mode, enum machine_mode,
+ enum machine_mode, unsigned int, unsigned int);
+static rtx find_oldest_value_reg (enum reg_class, rtx, struct value_data *);
+static bool replace_oldest_value_reg (rtx *, enum reg_class, rtx,
+ struct value_data *);
+static bool replace_oldest_value_addr (rtx *, enum reg_class,
+ enum machine_mode, rtx,
+ struct value_data *);
+static bool replace_oldest_value_mem (rtx, rtx, struct value_data *);
+static bool copyprop_hardreg_forward_1 (basic_block, struct value_data *);
+extern void debug_value_data (struct value_data *);
+#ifdef ENABLE_CHECKING
+static void validate_value_data (struct value_data *);
+#endif
+
+/* Kill register REGNO. This involves removing it from any value
+ lists, and resetting the value mode to VOIDmode. This is only a
+ helper function; it does not handle any hard registers overlapping
+ with REGNO. */
+
+static void
+kill_value_one_regno (unsigned int regno, struct value_data *vd)
+{
+ unsigned int i, next;
+
+ if (vd->e[regno].oldest_regno != regno)
+ {
+ for (i = vd->e[regno].oldest_regno;
+ vd->e[i].next_regno != regno;
+ i = vd->e[i].next_regno)
+ continue;
+ vd->e[i].next_regno = vd->e[regno].next_regno;
+ }
+ else if ((next = vd->e[regno].next_regno) != INVALID_REGNUM)
+ {
+ for (i = next; i != INVALID_REGNUM; i = vd->e[i].next_regno)
+ vd->e[i].oldest_regno = next;
+ }
+
+ vd->e[regno].mode = VOIDmode;
+ vd->e[regno].oldest_regno = regno;
+ vd->e[regno].next_regno = INVALID_REGNUM;
+
+#ifdef ENABLE_CHECKING
+ validate_value_data (vd);
+#endif
+}
+
+/* Kill the value in register REGNO for NREGS, and any other registers
+ whose values overlap. */
+
+static void
+kill_value_regno (unsigned int regno, unsigned int nregs,
+ struct value_data *vd)
+{
+ unsigned int j;
+
+ /* Kill the value we're told to kill. */
+ for (j = 0; j < nregs; ++j)
+ kill_value_one_regno (regno + j, vd);
+
+ /* Kill everything that overlapped what we're told to kill. */
+ if (regno < vd->max_value_regs)
+ j = 0;
+ else
+ j = regno - vd->max_value_regs;
+ for (; j < regno; ++j)
+ {
+ unsigned int i, n;
+ if (vd->e[j].mode == VOIDmode)
+ continue;
+ n = hard_regno_nregs[j][vd->e[j].mode];
+ if (j + n > regno)
+ for (i = 0; i < n; ++i)
+ kill_value_one_regno (j + i, vd);
+ }
+}
+
+/* Kill X. This is a convenience function wrapping kill_value_regno
+ so that we mind the mode the register is in. */
+
+static void
+kill_value (rtx x, struct value_data *vd)
+{
+ rtx orig_rtx = x;
+
+ if (GET_CODE (x) == SUBREG)
+ {
+ x = simplify_subreg (GET_MODE (x), SUBREG_REG (x),
+ GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
+ if (x == NULL_RTX)
+ x = SUBREG_REG (orig_rtx);
+ }
+ if (REG_P (x))
+ {
+ unsigned int regno = REGNO (x);
+ unsigned int n = hard_regno_nregs[regno][GET_MODE (x)];
+
+ kill_value_regno (regno, n, vd);
+ }
+}
+
+/* Remember that REGNO is valid in MODE. */
+
+static void
+set_value_regno (unsigned int regno, enum machine_mode mode,
+ struct value_data *vd)
+{
+ unsigned int nregs;
+
+ vd->e[regno].mode = mode;
+
+ nregs = hard_regno_nregs[regno][mode];
+ if (nregs > vd->max_value_regs)
+ vd->max_value_regs = nregs;
+}
+
+/* Initialize VD such that there are no known relationships between regs. */
+
+static void
+init_value_data (struct value_data *vd)
+{
+ int i;
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ {
+ vd->e[i].mode = VOIDmode;
+ vd->e[i].oldest_regno = i;
+ vd->e[i].next_regno = INVALID_REGNUM;
+ }
+ vd->max_value_regs = 0;
+}
+
+/* Called through note_stores. If X is clobbered, kill its value. */
+
+static void
+kill_clobbered_value (rtx x, const_rtx set, void *data)
+{
+ struct value_data *const vd = (struct value_data *) data;
+ if (GET_CODE (set) == CLOBBER)
+ kill_value (x, vd);
+}
+
+/* Called through note_stores. If X is set, not clobbered, kill its
+ current value and install it as the root of its own value list. */
+
+static void
+kill_set_value (rtx x, const_rtx set, void *data)
+{
+ struct value_data *const vd = (struct value_data *) data;
+ if (GET_CODE (set) != CLOBBER)
+ {
+ kill_value (x, vd);
+ if (REG_P (x))
+ set_value_regno (REGNO (x), GET_MODE (x), vd);
+ }
+}
+
+/* Called through for_each_rtx. Kill any register used as the base of an
+ auto-increment expression, and install that register as the root of its
+ own value list. */
+
+static int
+kill_autoinc_value (rtx *px, void *data)
+{
+ rtx x = *px;
+ struct value_data *const vd = (struct value_data *) data;
+
+ if (GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC)
+ {
+ x = XEXP (x, 0);
+ kill_value (x, vd);
+ set_value_regno (REGNO (x), Pmode, vd);
+ return -1;
+ }
+
+ return 0;
+}
+
+/* Assert that SRC has been copied to DEST. Adjust the data structures
+ to reflect that SRC contains an older copy of the shared value. */
+
+static void
+copy_value (rtx dest, rtx src, struct value_data *vd)
+{
+ unsigned int dr = REGNO (dest);
+ unsigned int sr = REGNO (src);
+ unsigned int dn, sn;
+ unsigned int i;
+
+ /* ??? At present, it's possible to see noop sets. It'd be nice if
+ this were cleaned up beforehand... */
+ if (sr == dr)
+ return;
+
+ /* Do not propagate copies to the stack pointer, as that can leave
+ memory accesses with no scheduling dependency on the stack update. */
+ if (dr == STACK_POINTER_REGNUM)
+ return;
+
+ /* Likewise with the frame pointer, if we're using one. */
+ if (frame_pointer_needed && dr == HARD_FRAME_POINTER_REGNUM)
+ return;
+
+ /* Do not propagate copies to fixed or global registers, patterns
+ can be relying to see particular fixed register or users can
+ expect the chosen global register in asm. */
+ if (fixed_regs[dr] || global_regs[dr])
+ return;
+
+ /* If SRC and DEST overlap, don't record anything. */
+ dn = hard_regno_nregs[dr][GET_MODE (dest)];
+ sn = hard_regno_nregs[sr][GET_MODE (dest)];
+ if ((dr > sr && dr < sr + sn)
+ || (sr > dr && sr < dr + dn))
+ return;
+
+ /* If SRC had no assigned mode (i.e. we didn't know it was live)
+ assign it now and assume the value came from an input argument
+ or somesuch. */
+ if (vd->e[sr].mode == VOIDmode)
+ set_value_regno (sr, vd->e[dr].mode, vd);
+
+ /* If we are narrowing the input to a smaller number of hard regs,
+ and it is in big endian, we are really extracting a high part.
+ Since we generally associate a low part of a value with the value itself,
+ we must not do the same for the high part.
+ Note we can still get low parts for the same mode combination through
+ a two-step copy involving differently sized hard regs.
+ Assume hard regs fr* are 32 bits bits each, while r* are 64 bits each:
+ (set (reg:DI r0) (reg:DI fr0))
+ (set (reg:SI fr2) (reg:SI r0))
+ loads the low part of (reg:DI fr0) - i.e. fr1 - into fr2, while:
+ (set (reg:SI fr2) (reg:SI fr0))
+ loads the high part of (reg:DI fr0) into fr2.
+
+ We can't properly represent the latter case in our tables, so don't
+ record anything then. */
+ else if (sn < (unsigned int) hard_regno_nregs[sr][vd->e[sr].mode]
+ && (GET_MODE_SIZE (vd->e[sr].mode) > UNITS_PER_WORD
+ ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN))
+ return;
+
+ /* If SRC had been assigned a mode narrower than the copy, we can't
+ link DEST into the chain, because not all of the pieces of the
+ copy came from oldest_regno. */
+ else if (sn > (unsigned int) hard_regno_nregs[sr][vd->e[sr].mode])
+ return;
+
+ /* Link DR at the end of the value chain used by SR. */
+
+ vd->e[dr].oldest_regno = vd->e[sr].oldest_regno;
+
+ for (i = sr; vd->e[i].next_regno != INVALID_REGNUM; i = vd->e[i].next_regno)
+ continue;
+ vd->e[i].next_regno = dr;
+
+#ifdef ENABLE_CHECKING
+ validate_value_data (vd);
+#endif
+}
+
+/* Return true if a mode change from ORIG to NEW is allowed for REGNO. */
+
+static bool
+mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
+ unsigned int regno ATTRIBUTE_UNUSED)
+{
+ if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
+ return false;
+
+#ifdef CANNOT_CHANGE_MODE_CLASS
+ return !REG_CANNOT_CHANGE_MODE_P (regno, orig_mode, new_mode);
+#endif
+
+ return true;
+}
+
+/* Register REGNO was originally set in ORIG_MODE. It - or a copy of it -
+ was copied in COPY_MODE to COPY_REGNO, and then COPY_REGNO was accessed
+ in NEW_MODE.
+ Return a NEW_MODE rtx for REGNO if that's OK, otherwise return NULL_RTX. */
+
+static rtx
+maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode,
+ enum machine_mode new_mode, unsigned int regno,
+ unsigned int copy_regno ATTRIBUTE_UNUSED)
+{
+ if (GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (orig_mode)
+ && GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
+ return NULL_RTX;
+
+ if (orig_mode == new_mode)
+ return gen_rtx_raw_REG (new_mode, regno);
+ else if (mode_change_ok (orig_mode, new_mode, regno))
+ {
+ int copy_nregs = hard_regno_nregs[copy_regno][copy_mode];
+ int use_nregs = hard_regno_nregs[copy_regno][new_mode];
+ int copy_offset
+ = GET_MODE_SIZE (copy_mode) / copy_nregs * (copy_nregs - use_nregs);
+ int offset
+ = GET_MODE_SIZE (orig_mode) - GET_MODE_SIZE (new_mode) - copy_offset;
+ int byteoffset = offset % UNITS_PER_WORD;
+ int wordoffset = offset - byteoffset;
+
+ offset = ((WORDS_BIG_ENDIAN ? wordoffset : 0)
+ + (BYTES_BIG_ENDIAN ? byteoffset : 0));
+ return gen_rtx_raw_REG (new_mode,
+ regno + subreg_regno_offset (regno, orig_mode,
+ offset,
+ new_mode));
+ }
+ return NULL_RTX;
+}
+
+/* Find the oldest copy of the value contained in REGNO that is in
+ register class CL and has mode MODE. If found, return an rtx
+ of that oldest register, otherwise return NULL. */
+
+static rtx
+find_oldest_value_reg (enum reg_class cl, rtx reg, struct value_data *vd)
+{
+ unsigned int regno = REGNO (reg);
+ enum machine_mode mode = GET_MODE (reg);
+ unsigned int i;
+
+ /* If we are accessing REG in some mode other that what we set it in,
+ make sure that the replacement is valid. In particular, consider
+ (set (reg:DI r11) (...))
+ (set (reg:SI r9) (reg:SI r11))
+ (set (reg:SI r10) (...))
+ (set (...) (reg:DI r9))
+ Replacing r9 with r11 is invalid. */
+ if (mode != vd->e[regno].mode)
+ {
+ if (hard_regno_nregs[regno][mode]
+ > hard_regno_nregs[regno][vd->e[regno].mode])
+ return NULL_RTX;
+ }
+
+ for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
+ {
+ enum machine_mode oldmode = vd->e[i].mode;
+ rtx new_rtx;
+
+ if (!in_hard_reg_set_p (reg_class_contents[cl], mode, i))
+ return NULL_RTX;
+
+ new_rtx = maybe_mode_change (oldmode, vd->e[regno].mode, mode, i, regno);
+ if (new_rtx)
+ {
+ ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (reg);
+ REG_ATTRS (new_rtx) = REG_ATTRS (reg);
+ REG_POINTER (new_rtx) = REG_POINTER (reg);
+ return new_rtx;
+ }
+ }
+
+ return NULL_RTX;
+}
+
+/* If possible, replace the register at *LOC with the oldest register
+ in register class CL. Return true if successfully replaced. */
+
+static bool
+replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx insn,
+ struct value_data *vd)
+{
+ rtx new_rtx = find_oldest_value_reg (cl, *loc, vd);
+ if (new_rtx)
+ {
+ if (dump_file)
+ fprintf (dump_file, "insn %u: replaced reg %u with %u\n",
+ INSN_UID (insn), REGNO (*loc), REGNO (new_rtx));
+
+ validate_change (insn, loc, new_rtx, 1);
+ return true;
+ }
+ return false;
+}
+
+/* Similar to replace_oldest_value_reg, but *LOC contains an address.
+ Adapted from find_reloads_address_1. CL is INDEX_REG_CLASS or
+ BASE_REG_CLASS depending on how the register is being considered. */
+
+static bool
+replace_oldest_value_addr (rtx *loc, enum reg_class cl,
+ enum machine_mode mode, rtx insn,
+ struct value_data *vd)
+{
+ rtx x = *loc;
+ RTX_CODE code = GET_CODE (x);
+ const char *fmt;
+ int i, j;
+ bool changed = false;
+
+ switch (code)
+ {
+ case PLUS:
+ {
+ rtx orig_op0 = XEXP (x, 0);
+ rtx orig_op1 = XEXP (x, 1);
+ RTX_CODE code0 = GET_CODE (orig_op0);
+ RTX_CODE code1 = GET_CODE (orig_op1);
+ rtx op0 = orig_op0;
+ rtx op1 = orig_op1;
+ rtx *locI = NULL;
+ rtx *locB = NULL;
+ enum rtx_code index_code = SCRATCH;
+
+ if (GET_CODE (op0) == SUBREG)
+ {
+ op0 = SUBREG_REG (op0);
+ code0 = GET_CODE (op0);
+ }
+
+ if (GET_CODE (op1) == SUBREG)
+ {
+ op1 = SUBREG_REG (op1);
+ code1 = GET_CODE (op1);
+ }
+
+ if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE
+ || code0 == ZERO_EXTEND || code1 == MEM)
+ {
+ locI = &XEXP (x, 0);
+ locB = &XEXP (x, 1);
+ index_code = GET_CODE (*locI);
+ }
+ else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE
+ || code1 == ZERO_EXTEND || code0 == MEM)
+ {
+ locI = &XEXP (x, 1);
+ locB = &XEXP (x, 0);
+ index_code = GET_CODE (*locI);
+ }
+ else if (code0 == CONST_INT || code0 == CONST
+ || code0 == SYMBOL_REF || code0 == LABEL_REF)
+ {
+ locB = &XEXP (x, 1);
+ index_code = GET_CODE (XEXP (x, 0));
+ }
+ else if (code1 == CONST_INT || code1 == CONST
+ || code1 == SYMBOL_REF || code1 == LABEL_REF)
+ {
+ locB = &XEXP (x, 0);
+ index_code = GET_CODE (XEXP (x, 1));
+ }
+ else if (code0 == REG && code1 == REG)
+ {
+ int index_op;
+ unsigned regno0 = REGNO (op0), regno1 = REGNO (op1);
+
+ if (REGNO_OK_FOR_INDEX_P (regno1)
+ && regno_ok_for_base_p (regno0, mode, PLUS, REG))
+ index_op = 1;
+ else if (REGNO_OK_FOR_INDEX_P (regno0)
+ && regno_ok_for_base_p (regno1, mode, PLUS, REG))
+ index_op = 0;
+ else if (regno_ok_for_base_p (regno0, mode, PLUS, REG)
+ || REGNO_OK_FOR_INDEX_P (regno1))
+ index_op = 1;
+ else if (regno_ok_for_base_p (regno1, mode, PLUS, REG))
+ index_op = 0;
+ else
+ index_op = 1;
+
+ locI = &XEXP (x, index_op);
+ locB = &XEXP (x, !index_op);
+ index_code = GET_CODE (*locI);
+ }
+ else if (code0 == REG)
+ {
+ locI = &XEXP (x, 0);
+ locB = &XEXP (x, 1);
+ index_code = GET_CODE (*locI);
+ }
+ else if (code1 == REG)
+ {
+ locI = &XEXP (x, 1);
+ locB = &XEXP (x, 0);
+ index_code = GET_CODE (*locI);
+ }
+
+ if (locI)
+ changed |= replace_oldest_value_addr (locI, INDEX_REG_CLASS, mode,
+ insn, vd);
+ if (locB)
+ changed |= replace_oldest_value_addr (locB,
+ base_reg_class (mode, PLUS,
+ index_code),
+ mode, insn, vd);
+ return changed;
+ }
+
+ case POST_INC:
+ case POST_DEC:
+ case POST_MODIFY:
+ case PRE_INC:
+ case PRE_DEC:
+ case PRE_MODIFY:
+ return false;
+
+ case MEM:
+ return replace_oldest_value_mem (x, insn, vd);
+
+ case REG:
+ return replace_oldest_value_reg (loc, cl, insn, vd);
+
+ default:
+ break;
+ }
+
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ if (fmt[i] == 'e')
+ changed |= replace_oldest_value_addr (&XEXP (x, i), cl, mode,
+ insn, vd);
+ else if (fmt[i] == 'E')
+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+ changed |= replace_oldest_value_addr (&XVECEXP (x, i, j), cl,
+ mode, insn, vd);
+ }
+
+ return changed;
+}
+
+/* Similar to replace_oldest_value_reg, but X contains a memory. */
+
+static bool
+replace_oldest_value_mem (rtx x, rtx insn, struct value_data *vd)
+{
+ return replace_oldest_value_addr (&XEXP (x, 0),
+ base_reg_class (GET_MODE (x), MEM,
+ SCRATCH),
+ GET_MODE (x), insn, vd);
+}
+
+/* Perform the forward copy propagation on basic block BB. */
+
+static bool
+copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
+{
+ bool changed = false;
+ rtx insn;
+
+ for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
+ {
+ int n_ops, i, alt, predicated;
+ bool is_asm, any_replacements;
+ rtx set;
+ bool replaced[MAX_RECOG_OPERANDS];
+
+ if (! INSN_P (insn))
+ {
+ if (insn == BB_END (bb))
+ break;
+ else
+ continue;
+ }
+
+ set = single_set (insn);
+ extract_insn (insn);
+ if (! constrain_operands (1))
+ fatal_insn_not_found (insn);
+ preprocess_constraints ();
+ alt = which_alternative;
+ n_ops = recog_data.n_operands;
+ is_asm = asm_noperands (PATTERN (insn)) >= 0;
+
+ /* Simplify the code below by rewriting things to reflect
+ matching constraints. Also promote OP_OUT to OP_INOUT
+ in predicated instructions. */
+
+ predicated = GET_CODE (PATTERN (insn)) == COND_EXEC;
+ for (i = 0; i < n_ops; ++i)
+ {
+ int matches = recog_op_alt[i][alt].matches;
+ if (matches >= 0)
+ recog_op_alt[i][alt].cl = recog_op_alt[matches][alt].cl;
+ if (matches >= 0 || recog_op_alt[i][alt].matched >= 0
+ || (predicated && recog_data.operand_type[i] == OP_OUT))
+ recog_data.operand_type[i] = OP_INOUT;
+ }
+
+ /* For each earlyclobber operand, zap the value data. */
+ for (i = 0; i < n_ops; i++)
+ if (recog_op_alt[i][alt].earlyclobber)
+ kill_value (recog_data.operand[i], vd);
+
+ /* Within asms, a clobber cannot overlap inputs or outputs.
+ I wouldn't think this were true for regular insns, but
+ scan_rtx treats them like that... */
+ note_stores (PATTERN (insn), kill_clobbered_value, vd);
+
+ /* Kill all auto-incremented values. */
+ /* ??? REG_INC is useless, since stack pushes aren't done that way. */
+ for_each_rtx (&PATTERN (insn), kill_autoinc_value, vd);
+
+ /* Kill all early-clobbered operands. */
+ for (i = 0; i < n_ops; i++)
+ if (recog_op_alt[i][alt].earlyclobber)
+ kill_value (recog_data.operand[i], vd);
+
+ /* Special-case plain move instructions, since we may well
+ be able to do the move from a different register class. */
+ if (set && REG_P (SET_SRC (set)))
+ {
+ rtx src = SET_SRC (set);
+ unsigned int regno = REGNO (src);
+ enum machine_mode mode = GET_MODE (src);
+ unsigned int i;
+ rtx new_rtx;
+
+ /* If we are accessing SRC in some mode other that what we
+ set it in, make sure that the replacement is valid. */
+ if (mode != vd->e[regno].mode)
+ {
+ if (hard_regno_nregs[regno][mode]
+ > hard_regno_nregs[regno][vd->e[regno].mode])
+ goto no_move_special_case;
+ }
+
+ /* If the destination is also a register, try to find a source
+ register in the same class. */
+ if (REG_P (SET_DEST (set)))
+ {
+ new_rtx = find_oldest_value_reg (REGNO_REG_CLASS (regno), src, vd);
+ if (new_rtx && validate_change (insn, &SET_SRC (set), new_rtx, 0))
+ {
+ if (dump_file)
+ fprintf (dump_file,
+ "insn %u: replaced reg %u with %u\n",
+ INSN_UID (insn), regno, REGNO (new_rtx));
+ changed = true;
+ goto did_replacement;
+ }
+ }
+
+ /* Otherwise, try all valid registers and see if its valid. */
+ for (i = vd->e[regno].oldest_regno; i != regno;
+ i = vd->e[i].next_regno)
+ {
+ new_rtx = maybe_mode_change (vd->e[i].mode, vd->e[regno].mode,
+ mode, i, regno);
+ if (new_rtx != NULL_RTX)
+ {
+ if (validate_change (insn, &SET_SRC (set), new_rtx, 0))
+ {
+ ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (src);
+ REG_ATTRS (new_rtx) = REG_ATTRS (src);
+ REG_POINTER (new_rtx) = REG_POINTER (src);
+ if (dump_file)
+ fprintf (dump_file,
+ "insn %u: replaced reg %u with %u\n",
+ INSN_UID (insn), regno, REGNO (new_rtx));
+ changed = true;
+ goto did_replacement;
+ }
+ }
+ }
+ }
+ no_move_special_case:
+
+ any_replacements = false;
+
+ /* For each input operand, replace a hard register with the
+ eldest live copy that's in an appropriate register class. */
+ for (i = 0; i < n_ops; i++)
+ {
+ replaced[i] = false;
+
+ /* Don't scan match_operand here, since we've no reg class
+ information to pass down. Any operands that we could
+ substitute in will be represented elsewhere. */
+ if (recog_data.constraints[i][0] == '\0')
+ continue;
+
+ /* Don't replace in asms intentionally referencing hard regs. */
+ if (is_asm && REG_P (recog_data.operand[i])
+ && (REGNO (recog_data.operand[i])
+ == ORIGINAL_REGNO (recog_data.operand[i])))
+ continue;
+
+ if (recog_data.operand_type[i] == OP_IN)
+ {
+ if (recog_op_alt[i][alt].is_address)
+ replaced[i]
+ = replace_oldest_value_addr (recog_data.operand_loc[i],
+ recog_op_alt[i][alt].cl,
+ VOIDmode, insn, vd);
+ else if (REG_P (recog_data.operand[i]))
+ replaced[i]
+ = replace_oldest_value_reg (recog_data.operand_loc[i],
+ recog_op_alt[i][alt].cl,
+ insn, vd);
+ else if (MEM_P (recog_data.operand[i]))
+ replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
+ insn, vd);
+ }
+ else if (MEM_P (recog_data.operand[i]))
+ replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
+ insn, vd);
+
+ /* If we performed any replacement, update match_dups. */
+ if (replaced[i])
+ {
+ int j;
+ rtx new_rtx;
+
+ new_rtx = *recog_data.operand_loc[i];
+ recog_data.operand[i] = new_rtx;
+ for (j = 0; j < recog_data.n_dups; j++)
+ if (recog_data.dup_num[j] == i)
+ validate_unshare_change (insn, recog_data.dup_loc[j], new_rtx, 1);
+
+ any_replacements = true;
+ }
+ }
+
+ if (any_replacements)
+ {
+ if (! apply_change_group ())
+ {
+ for (i = 0; i < n_ops; i++)
+ if (replaced[i])
+ {
+ rtx old = *recog_data.operand_loc[i];
+ recog_data.operand[i] = old;
+ }
+
+ if (dump_file)
+ fprintf (dump_file,
+ "insn %u: reg replacements not verified\n",
+ INSN_UID (insn));
+ }
+ else
+ changed = true;
+ }
+
+ did_replacement:
+ /* Clobber call-clobbered registers. */
+ if (CALL_P (insn))
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
+ kill_value_regno (i, 1, vd);
+
+ /* Notice stores. */
+ note_stores (PATTERN (insn), kill_set_value, vd);
+
+ /* Notice copies. */
+ if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set)))
+ copy_value (SET_DEST (set), SET_SRC (set), vd);
+
+ if (insn == BB_END (bb))
+ break;
+ }
+
+ return changed;
+}
+
+/* Main entry point for the forward copy propagation optimization. */
+
+static unsigned int
+copyprop_hardreg_forward (void)
+{
+ struct value_data *all_vd;
+ basic_block bb;
+ sbitmap visited;
+
+ all_vd = XNEWVEC (struct value_data, last_basic_block);
+
+ visited = sbitmap_alloc (last_basic_block);
+ sbitmap_zero (visited);
+
+ FOR_EACH_BB (bb)
+ {
+ SET_BIT (visited, bb->index);
+
+ /* If a block has a single predecessor, that we've already
+ processed, begin with the value data that was live at
+ the end of the predecessor block. */
+ /* ??? Ought to use more intelligent queuing of blocks. */
+ if (single_pred_p (bb)
+ && TEST_BIT (visited, single_pred (bb)->index)
+ && ! (single_pred_edge (bb)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
+ all_vd[bb->index] = all_vd[single_pred (bb)->index];
+ else
+ init_value_data (all_vd + bb->index);
+
+ copyprop_hardreg_forward_1 (bb, all_vd + bb->index);
+ }
+
+ sbitmap_free (visited);
+ free (all_vd);
+ return 0;
+}
+
+/* Dump the value chain data to stderr. */
+
+void
+debug_value_data (struct value_data *vd)
+{
+ HARD_REG_SET set;
+ unsigned int i, j;
+
+ CLEAR_HARD_REG_SET (set);
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ if (vd->e[i].oldest_regno == i)
+ {
+ if (vd->e[i].mode == VOIDmode)
+ {
+ if (vd->e[i].next_regno != INVALID_REGNUM)
+ fprintf (stderr, "[%u] Bad next_regno for empty chain (%u)\n",
+ i, vd->e[i].next_regno);
+ continue;
+ }
+
+ SET_HARD_REG_BIT (set, i);
+ fprintf (stderr, "[%u %s] ", i, GET_MODE_NAME (vd->e[i].mode));
+
+ for (j = vd->e[i].next_regno;
+ j != INVALID_REGNUM;
+ j = vd->e[j].next_regno)
+ {
+ if (TEST_HARD_REG_BIT (set, j))
+ {
+ fprintf (stderr, "[%u] Loop in regno chain\n", j);
+ return;
+ }
+
+ if (vd->e[j].oldest_regno != i)
+ {
+ fprintf (stderr, "[%u] Bad oldest_regno (%u)\n",
+ j, vd->e[j].oldest_regno);
+ return;
+ }
+ SET_HARD_REG_BIT (set, j);
+ fprintf (stderr, "[%u %s] ", j, GET_MODE_NAME (vd->e[j].mode));
+ }
+ fputc ('\n', stderr);
+ }
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ if (! TEST_HARD_REG_BIT (set, i)
+ && (vd->e[i].mode != VOIDmode
+ || vd->e[i].oldest_regno != i
+ || vd->e[i].next_regno != INVALID_REGNUM))
+ fprintf (stderr, "[%u] Non-empty reg in chain (%s %u %i)\n",
+ i, GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno,
+ vd->e[i].next_regno);
+}
+
+#ifdef ENABLE_CHECKING
+static void
+validate_value_data (struct value_data *vd)
+{
+ HARD_REG_SET set;
+ unsigned int i, j;
+
+ CLEAR_HARD_REG_SET (set);
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ if (vd->e[i].oldest_regno == i)
+ {
+ if (vd->e[i].mode == VOIDmode)
+ {
+ if (vd->e[i].next_regno != INVALID_REGNUM)
+ internal_error ("validate_value_data: [%u] Bad next_regno for empty chain (%u)",
+ i, vd->e[i].next_regno);
+ continue;
+ }
+
+ SET_HARD_REG_BIT (set, i);
+
+ for (j = vd->e[i].next_regno;
+ j != INVALID_REGNUM;
+ j = vd->e[j].next_regno)
+ {
+ if (TEST_HARD_REG_BIT (set, j))
+ internal_error ("validate_value_data: Loop in regno chain (%u)",
+ j);
+ if (vd->e[j].oldest_regno != i)
+ internal_error ("validate_value_data: [%u] Bad oldest_regno (%u)",
+ j, vd->e[j].oldest_regno);
+
+ SET_HARD_REG_BIT (set, j);
+ }
+ }
+
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ if (! TEST_HARD_REG_BIT (set, i)
+ && (vd->e[i].mode != VOIDmode
+ || vd->e[i].oldest_regno != i
+ || vd->e[i].next_regno != INVALID_REGNUM))
+ internal_error ("validate_value_data: [%u] Non-empty reg in chain (%s %u %i)",
+ i, GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno,
+ vd->e[i].next_regno);
+}
+#endif
+
+static bool
+gate_handle_cprop (void)
+{
+ return (optimize > 0 && (flag_cprop_registers));
+}
+
+
+struct rtl_opt_pass pass_cprop_hardreg =
+{
+ {
+ RTL_PASS,
+ "cprop_hardreg", /* name */
+ gate_handle_cprop, /* gate */
+ copyprop_hardreg_forward, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_CPROP_REGISTERS, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func | TODO_verify_rtl_sharing /* todo_flags_finish */
+ }
+};
diff --git a/gcc/regrename.c b/gcc/regrename.c
index c678a093ca9..fcdaaf79e81 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -180,7 +180,7 @@ merge_overlapping_regs (basic_block b, HARD_REG_SET *pset,
/* Perform register renaming on the current function. */
-static void
+static unsigned int
regrename_optimize (void)
{
int tick[FIRST_PSEUDO_REGISTER];
@@ -355,6 +355,8 @@ regrename_optimize (void)
if (dump_file)
fputc ('\n', dump_file);
+
+ return 0;
}
static void
@@ -999,943 +1001,7 @@ dump_def_use_chain (struct du_chain *chains)
chains = chains->next_chain;
}
}
-
-/* The following code does forward propagation of hard register copies.
- The object is to eliminate as many dependencies as possible, so that
- we have the most scheduling freedom. As a side effect, we also clean
- up some silly register allocation decisions made by reload. This
- code may be obsoleted by a new register allocator. */
-
-/* For each register, we have a list of registers that contain the same
- value. The OLDEST_REGNO field points to the head of the list, and
- the NEXT_REGNO field runs through the list. The MODE field indicates
- what mode the data is known to be in; this field is VOIDmode when the
- register is not known to contain valid data. */
-
-struct value_data_entry
-{
- enum machine_mode mode;
- unsigned int oldest_regno;
- unsigned int next_regno;
-};
-
-struct value_data
-{
- struct value_data_entry e[FIRST_PSEUDO_REGISTER];
- unsigned int max_value_regs;
-};
-
-static void kill_value_one_regno (unsigned, struct value_data *);
-static void kill_value_regno (unsigned, unsigned, struct value_data *);
-static void kill_value (rtx, struct value_data *);
-static void set_value_regno (unsigned, enum machine_mode, struct value_data *);
-static void init_value_data (struct value_data *);
-static void kill_clobbered_value (rtx, const_rtx, void *);
-static void kill_set_value (rtx, const_rtx, void *);
-static int kill_autoinc_value (rtx *, void *);
-static void copy_value (rtx, rtx, struct value_data *);
-static bool mode_change_ok (enum machine_mode, enum machine_mode,
- unsigned int);
-static rtx maybe_mode_change (enum machine_mode, enum machine_mode,
- enum machine_mode, unsigned int, unsigned int);
-static rtx find_oldest_value_reg (enum reg_class, rtx, struct value_data *);
-static bool replace_oldest_value_reg (rtx *, enum reg_class, rtx,
- struct value_data *);
-static bool replace_oldest_value_addr (rtx *, enum reg_class,
- enum machine_mode, rtx,
- struct value_data *);
-static bool replace_oldest_value_mem (rtx, rtx, struct value_data *);
-static bool copyprop_hardreg_forward_1 (basic_block, struct value_data *);
-extern void debug_value_data (struct value_data *);
-#ifdef ENABLE_CHECKING
-static void validate_value_data (struct value_data *);
-#endif
-
-/* Kill register REGNO. This involves removing it from any value
- lists, and resetting the value mode to VOIDmode. This is only a
- helper function; it does not handle any hard registers overlapping
- with REGNO. */
-
-static void
-kill_value_one_regno (unsigned int regno, struct value_data *vd)
-{
- unsigned int i, next;
-
- if (vd->e[regno].oldest_regno != regno)
- {
- for (i = vd->e[regno].oldest_regno;
- vd->e[i].next_regno != regno;
- i = vd->e[i].next_regno)
- continue;
- vd->e[i].next_regno = vd->e[regno].next_regno;
- }
- else if ((next = vd->e[regno].next_regno) != INVALID_REGNUM)
- {
- for (i = next; i != INVALID_REGNUM; i = vd->e[i].next_regno)
- vd->e[i].oldest_regno = next;
- }
-
- vd->e[regno].mode = VOIDmode;
- vd->e[regno].oldest_regno = regno;
- vd->e[regno].next_regno = INVALID_REGNUM;
-
-#ifdef ENABLE_CHECKING
- validate_value_data (vd);
-#endif
-}
-
-/* Kill the value in register REGNO for NREGS, and any other registers
- whose values overlap. */
-
-static void
-kill_value_regno (unsigned int regno, unsigned int nregs,
- struct value_data *vd)
-{
- unsigned int j;
-
- /* Kill the value we're told to kill. */
- for (j = 0; j < nregs; ++j)
- kill_value_one_regno (regno + j, vd);
-
- /* Kill everything that overlapped what we're told to kill. */
- if (regno < vd->max_value_regs)
- j = 0;
- else
- j = regno - vd->max_value_regs;
- for (; j < regno; ++j)
- {
- unsigned int i, n;
- if (vd->e[j].mode == VOIDmode)
- continue;
- n = hard_regno_nregs[j][vd->e[j].mode];
- if (j + n > regno)
- for (i = 0; i < n; ++i)
- kill_value_one_regno (j + i, vd);
- }
-}
-
-/* Kill X. This is a convenience function wrapping kill_value_regno
- so that we mind the mode the register is in. */
-
-static void
-kill_value (rtx x, struct value_data *vd)
-{
- rtx orig_rtx = x;
-
- if (GET_CODE (x) == SUBREG)
- {
- x = simplify_subreg (GET_MODE (x), SUBREG_REG (x),
- GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
- if (x == NULL_RTX)
- x = SUBREG_REG (orig_rtx);
- }
- if (REG_P (x))
- {
- unsigned int regno = REGNO (x);
- unsigned int n = hard_regno_nregs[regno][GET_MODE (x)];
- kill_value_regno (regno, n, vd);
- }
-}
-
-/* Remember that REGNO is valid in MODE. */
-
-static void
-set_value_regno (unsigned int regno, enum machine_mode mode,
- struct value_data *vd)
-{
- unsigned int nregs;
-
- vd->e[regno].mode = mode;
-
- nregs = hard_regno_nregs[regno][mode];
- if (nregs > vd->max_value_regs)
- vd->max_value_regs = nregs;
-}
-
-/* Initialize VD such that there are no known relationships between regs. */
-
-static void
-init_value_data (struct value_data *vd)
-{
- int i;
- for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- {
- vd->e[i].mode = VOIDmode;
- vd->e[i].oldest_regno = i;
- vd->e[i].next_regno = INVALID_REGNUM;
- }
- vd->max_value_regs = 0;
-}
-
-/* Called through note_stores. If X is clobbered, kill its value. */
-
-static void
-kill_clobbered_value (rtx x, const_rtx set, void *data)
-{
- struct value_data *const vd = (struct value_data *) data;
- if (GET_CODE (set) == CLOBBER)
- kill_value (x, vd);
-}
-
-/* Called through note_stores. If X is set, not clobbered, kill its
- current value and install it as the root of its own value list. */
-
-static void
-kill_set_value (rtx x, const_rtx set, void *data)
-{
- struct value_data *const vd = (struct value_data *) data;
- if (GET_CODE (set) != CLOBBER)
- {
- kill_value (x, vd);
- if (REG_P (x))
- set_value_regno (REGNO (x), GET_MODE (x), vd);
- }
-}
-
-/* Called through for_each_rtx. Kill any register used as the base of an
- auto-increment expression, and install that register as the root of its
- own value list. */
-
-static int
-kill_autoinc_value (rtx *px, void *data)
-{
- rtx x = *px;
- struct value_data *const vd = (struct value_data *) data;
-
- if (GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC)
- {
- x = XEXP (x, 0);
- kill_value (x, vd);
- set_value_regno (REGNO (x), Pmode, vd);
- return -1;
- }
-
- return 0;
-}
-
-/* Assert that SRC has been copied to DEST. Adjust the data structures
- to reflect that SRC contains an older copy of the shared value. */
-
-static void
-copy_value (rtx dest, rtx src, struct value_data *vd)
-{
- unsigned int dr = REGNO (dest);
- unsigned int sr = REGNO (src);
- unsigned int dn, sn;
- unsigned int i;
-
- /* ??? At present, it's possible to see noop sets. It'd be nice if
- this were cleaned up beforehand... */
- if (sr == dr)
- return;
-
- /* Do not propagate copies to the stack pointer, as that can leave
- memory accesses with no scheduling dependency on the stack update. */
- if (dr == STACK_POINTER_REGNUM)
- return;
-
- /* Likewise with the frame pointer, if we're using one. */
- if (frame_pointer_needed && dr == HARD_FRAME_POINTER_REGNUM)
- return;
-
- /* Do not propagate copies to fixed or global registers, patterns
- can be relying to see particular fixed register or users can
- expect the chosen global register in asm. */
- if (fixed_regs[dr] || global_regs[dr])
- return;
-
- /* If SRC and DEST overlap, don't record anything. */
- dn = hard_regno_nregs[dr][GET_MODE (dest)];
- sn = hard_regno_nregs[sr][GET_MODE (dest)];
- if ((dr > sr && dr < sr + sn)
- || (sr > dr && sr < dr + dn))
- return;
-
- /* If SRC had no assigned mode (i.e. we didn't know it was live)
- assign it now and assume the value came from an input argument
- or somesuch. */
- if (vd->e[sr].mode == VOIDmode)
- set_value_regno (sr, vd->e[dr].mode, vd);
-
- /* If we are narrowing the input to a smaller number of hard regs,
- and it is in big endian, we are really extracting a high part.
- Since we generally associate a low part of a value with the value itself,
- we must not do the same for the high part.
- Note we can still get low parts for the same mode combination through
- a two-step copy involving differently sized hard regs.
- Assume hard regs fr* are 32 bits bits each, while r* are 64 bits each:
- (set (reg:DI r0) (reg:DI fr0))
- (set (reg:SI fr2) (reg:SI r0))
- loads the low part of (reg:DI fr0) - i.e. fr1 - into fr2, while:
- (set (reg:SI fr2) (reg:SI fr0))
- loads the high part of (reg:DI fr0) into fr2.
-
- We can't properly represent the latter case in our tables, so don't
- record anything then. */
- else if (sn < (unsigned int) hard_regno_nregs[sr][vd->e[sr].mode]
- && (GET_MODE_SIZE (vd->e[sr].mode) > UNITS_PER_WORD
- ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN))
- return;
-
- /* If SRC had been assigned a mode narrower than the copy, we can't
- link DEST into the chain, because not all of the pieces of the
- copy came from oldest_regno. */
- else if (sn > (unsigned int) hard_regno_nregs[sr][vd->e[sr].mode])
- return;
-
- /* Link DR at the end of the value chain used by SR. */
-
- vd->e[dr].oldest_regno = vd->e[sr].oldest_regno;
-
- for (i = sr; vd->e[i].next_regno != INVALID_REGNUM; i = vd->e[i].next_regno)
- continue;
- vd->e[i].next_regno = dr;
-
-#ifdef ENABLE_CHECKING
- validate_value_data (vd);
-#endif
-}
-
-/* Return true if a mode change from ORIG to NEW is allowed for REGNO. */
-
-static bool
-mode_change_ok (enum machine_mode orig_mode, enum machine_mode new_mode,
- unsigned int regno ATTRIBUTE_UNUSED)
-{
- if (GET_MODE_SIZE (orig_mode) < GET_MODE_SIZE (new_mode))
- return false;
-
-#ifdef CANNOT_CHANGE_MODE_CLASS
- return !REG_CANNOT_CHANGE_MODE_P (regno, orig_mode, new_mode);
-#endif
-
- return true;
-}
-
-/* Register REGNO was originally set in ORIG_MODE. It - or a copy of it -
- was copied in COPY_MODE to COPY_REGNO, and then COPY_REGNO was accessed
- in NEW_MODE.
- Return a NEW_MODE rtx for REGNO if that's OK, otherwise return NULL_RTX. */
-
-static rtx
-maybe_mode_change (enum machine_mode orig_mode, enum machine_mode copy_mode,
- enum machine_mode new_mode, unsigned int regno,
- unsigned int copy_regno ATTRIBUTE_UNUSED)
-{
- if (GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (orig_mode)
- && GET_MODE_SIZE (copy_mode) < GET_MODE_SIZE (new_mode))
- return NULL_RTX;
-
- if (orig_mode == new_mode)
- return gen_rtx_raw_REG (new_mode, regno);
- else if (mode_change_ok (orig_mode, new_mode, regno))
- {
- int copy_nregs = hard_regno_nregs[copy_regno][copy_mode];
- int use_nregs = hard_regno_nregs[copy_regno][new_mode];
- int copy_offset
- = GET_MODE_SIZE (copy_mode) / copy_nregs * (copy_nregs - use_nregs);
- int offset
- = GET_MODE_SIZE (orig_mode) - GET_MODE_SIZE (new_mode) - copy_offset;
- int byteoffset = offset % UNITS_PER_WORD;
- int wordoffset = offset - byteoffset;
-
- offset = ((WORDS_BIG_ENDIAN ? wordoffset : 0)
- + (BYTES_BIG_ENDIAN ? byteoffset : 0));
- return gen_rtx_raw_REG (new_mode,
- regno + subreg_regno_offset (regno, orig_mode,
- offset,
- new_mode));
- }
- return NULL_RTX;
-}
-
-/* Find the oldest copy of the value contained in REGNO that is in
- register class CL and has mode MODE. If found, return an rtx
- of that oldest register, otherwise return NULL. */
-
-static rtx
-find_oldest_value_reg (enum reg_class cl, rtx reg, struct value_data *vd)
-{
- unsigned int regno = REGNO (reg);
- enum machine_mode mode = GET_MODE (reg);
- unsigned int i;
-
- /* If we are accessing REG in some mode other that what we set it in,
- make sure that the replacement is valid. In particular, consider
- (set (reg:DI r11) (...))
- (set (reg:SI r9) (reg:SI r11))
- (set (reg:SI r10) (...))
- (set (...) (reg:DI r9))
- Replacing r9 with r11 is invalid. */
- if (mode != vd->e[regno].mode)
- {
- if (hard_regno_nregs[regno][mode]
- > hard_regno_nregs[regno][vd->e[regno].mode])
- return NULL_RTX;
- }
-
- for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
- {
- enum machine_mode oldmode = vd->e[i].mode;
- rtx new_rtx;
-
- if (!in_hard_reg_set_p (reg_class_contents[cl], mode, i))
- return NULL_RTX;
-
- new_rtx = maybe_mode_change (oldmode, vd->e[regno].mode, mode, i, regno);
- if (new_rtx)
- {
- ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (reg);
- REG_ATTRS (new_rtx) = REG_ATTRS (reg);
- REG_POINTER (new_rtx) = REG_POINTER (reg);
- return new_rtx;
- }
- }
-
- return NULL_RTX;
-}
-
-/* If possible, replace the register at *LOC with the oldest register
- in register class CL. Return true if successfully replaced. */
-
-static bool
-replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx insn,
- struct value_data *vd)
-{
- rtx new_rtx = find_oldest_value_reg (cl, *loc, vd);
- if (new_rtx)
- {
- if (dump_file)
- fprintf (dump_file, "insn %u: replaced reg %u with %u\n",
- INSN_UID (insn), REGNO (*loc), REGNO (new_rtx));
-
- validate_change (insn, loc, new_rtx, 1);
- return true;
- }
- return false;
-}
-
-/* Similar to replace_oldest_value_reg, but *LOC contains an address.
- Adapted from find_reloads_address_1. CL is INDEX_REG_CLASS or
- BASE_REG_CLASS depending on how the register is being considered. */
-
-static bool
-replace_oldest_value_addr (rtx *loc, enum reg_class cl,
- enum machine_mode mode, rtx insn,
- struct value_data *vd)
-{
- rtx x = *loc;
- RTX_CODE code = GET_CODE (x);
- const char *fmt;
- int i, j;
- bool changed = false;
-
- switch (code)
- {
- case PLUS:
- {
- rtx orig_op0 = XEXP (x, 0);
- rtx orig_op1 = XEXP (x, 1);
- RTX_CODE code0 = GET_CODE (orig_op0);
- RTX_CODE code1 = GET_CODE (orig_op1);
- rtx op0 = orig_op0;
- rtx op1 = orig_op1;
- rtx *locI = NULL;
- rtx *locB = NULL;
- enum rtx_code index_code = SCRATCH;
-
- if (GET_CODE (op0) == SUBREG)
- {
- op0 = SUBREG_REG (op0);
- code0 = GET_CODE (op0);
- }
-
- if (GET_CODE (op1) == SUBREG)
- {
- op1 = SUBREG_REG (op1);
- code1 = GET_CODE (op1);
- }
-
- if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE
- || code0 == ZERO_EXTEND || code1 == MEM)
- {
- locI = &XEXP (x, 0);
- locB = &XEXP (x, 1);
- index_code = GET_CODE (*locI);
- }
- else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE
- || code1 == ZERO_EXTEND || code0 == MEM)
- {
- locI = &XEXP (x, 1);
- locB = &XEXP (x, 0);
- index_code = GET_CODE (*locI);
- }
- else if (code0 == CONST_INT || code0 == CONST
- || code0 == SYMBOL_REF || code0 == LABEL_REF)
- {
- locB = &XEXP (x, 1);
- index_code = GET_CODE (XEXP (x, 0));
- }
- else if (code1 == CONST_INT || code1 == CONST
- || code1 == SYMBOL_REF || code1 == LABEL_REF)
- {
- locB = &XEXP (x, 0);
- index_code = GET_CODE (XEXP (x, 1));
- }
- else if (code0 == REG && code1 == REG)
- {
- int index_op;
- unsigned regno0 = REGNO (op0), regno1 = REGNO (op1);
-
- if (REGNO_OK_FOR_INDEX_P (regno1)
- && regno_ok_for_base_p (regno0, mode, PLUS, REG))
- index_op = 1;
- else if (REGNO_OK_FOR_INDEX_P (regno0)
- && regno_ok_for_base_p (regno1, mode, PLUS, REG))
- index_op = 0;
- else if (regno_ok_for_base_p (regno0, mode, PLUS, REG)
- || REGNO_OK_FOR_INDEX_P (regno1))
- index_op = 1;
- else if (regno_ok_for_base_p (regno1, mode, PLUS, REG))
- index_op = 0;
- else
- index_op = 1;
-
- locI = &XEXP (x, index_op);
- locB = &XEXP (x, !index_op);
- index_code = GET_CODE (*locI);
- }
- else if (code0 == REG)
- {
- locI = &XEXP (x, 0);
- locB = &XEXP (x, 1);
- index_code = GET_CODE (*locI);
- }
- else if (code1 == REG)
- {
- locI = &XEXP (x, 1);
- locB = &XEXP (x, 0);
- index_code = GET_CODE (*locI);
- }
-
- if (locI)
- changed |= replace_oldest_value_addr (locI, INDEX_REG_CLASS, mode,
- insn, vd);
- if (locB)
- changed |= replace_oldest_value_addr (locB,
- base_reg_class (mode, PLUS,
- index_code),
- mode, insn, vd);
- return changed;
- }
-
- case POST_INC:
- case POST_DEC:
- case POST_MODIFY:
- case PRE_INC:
- case PRE_DEC:
- case PRE_MODIFY:
- return false;
-
- case MEM:
- return replace_oldest_value_mem (x, insn, vd);
-
- case REG:
- return replace_oldest_value_reg (loc, cl, insn, vd);
-
- default:
- break;
- }
-
- fmt = GET_RTX_FORMAT (code);
- for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
- {
- if (fmt[i] == 'e')
- changed |= replace_oldest_value_addr (&XEXP (x, i), cl, mode,
- insn, vd);
- else if (fmt[i] == 'E')
- for (j = XVECLEN (x, i) - 1; j >= 0; j--)
- changed |= replace_oldest_value_addr (&XVECEXP (x, i, j), cl,
- mode, insn, vd);
- }
-
- return changed;
-}
-
-/* Similar to replace_oldest_value_reg, but X contains a memory. */
-
-static bool
-replace_oldest_value_mem (rtx x, rtx insn, struct value_data *vd)
-{
- return replace_oldest_value_addr (&XEXP (x, 0),
- base_reg_class (GET_MODE (x), MEM,
- SCRATCH),
- GET_MODE (x), insn, vd);
-}
-
-/* Perform the forward copy propagation on basic block BB. */
-
-static bool
-copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
-{
- bool changed = false;
- rtx insn;
-
- for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
- {
- int n_ops, i, alt, predicated;
- bool is_asm, any_replacements;
- rtx set;
- bool replaced[MAX_RECOG_OPERANDS];
-
- if (! INSN_P (insn))
- {
- if (insn == BB_END (bb))
- break;
- else
- continue;
- }
-
- set = single_set (insn);
- extract_insn (insn);
- if (! constrain_operands (1))
- fatal_insn_not_found (insn);
- preprocess_constraints ();
- alt = which_alternative;
- n_ops = recog_data.n_operands;
- is_asm = asm_noperands (PATTERN (insn)) >= 0;
-
- /* Simplify the code below by rewriting things to reflect
- matching constraints. Also promote OP_OUT to OP_INOUT
- in predicated instructions. */
-
- predicated = GET_CODE (PATTERN (insn)) == COND_EXEC;
- for (i = 0; i < n_ops; ++i)
- {
- int matches = recog_op_alt[i][alt].matches;
- if (matches >= 0)
- recog_op_alt[i][alt].cl = recog_op_alt[matches][alt].cl;
- if (matches >= 0 || recog_op_alt[i][alt].matched >= 0
- || (predicated && recog_data.operand_type[i] == OP_OUT))
- recog_data.operand_type[i] = OP_INOUT;
- }
-
- /* For each earlyclobber operand, zap the value data. */
- for (i = 0; i < n_ops; i++)
- if (recog_op_alt[i][alt].earlyclobber)
- kill_value (recog_data.operand[i], vd);
-
- /* Within asms, a clobber cannot overlap inputs or outputs.
- I wouldn't think this were true for regular insns, but
- scan_rtx treats them like that... */
- note_stores (PATTERN (insn), kill_clobbered_value, vd);
-
- /* Kill all auto-incremented values. */
- /* ??? REG_INC is useless, since stack pushes aren't done that way. */
- for_each_rtx (&PATTERN (insn), kill_autoinc_value, vd);
-
- /* Kill all early-clobbered operands. */
- for (i = 0; i < n_ops; i++)
- if (recog_op_alt[i][alt].earlyclobber)
- kill_value (recog_data.operand[i], vd);
-
- /* Special-case plain move instructions, since we may well
- be able to do the move from a different register class. */
- if (set && REG_P (SET_SRC (set)))
- {
- rtx src = SET_SRC (set);
- unsigned int regno = REGNO (src);
- enum machine_mode mode = GET_MODE (src);
- unsigned int i;
- rtx new_rtx;
-
- /* If we are accessing SRC in some mode other that what we
- set it in, make sure that the replacement is valid. */
- if (mode != vd->e[regno].mode)
- {
- if (hard_regno_nregs[regno][mode]
- > hard_regno_nregs[regno][vd->e[regno].mode])
- goto no_move_special_case;
- }
-
- /* If the destination is also a register, try to find a source
- register in the same class. */
- if (REG_P (SET_DEST (set)))
- {
- new_rtx = find_oldest_value_reg (REGNO_REG_CLASS (regno), src, vd);
- if (new_rtx && validate_change (insn, &SET_SRC (set), new_rtx, 0))
- {
- if (dump_file)
- fprintf (dump_file,
- "insn %u: replaced reg %u with %u\n",
- INSN_UID (insn), regno, REGNO (new_rtx));
- changed = true;
- goto did_replacement;
- }
- }
-
- /* Otherwise, try all valid registers and see if its valid. */
- for (i = vd->e[regno].oldest_regno; i != regno;
- i = vd->e[i].next_regno)
- {
- new_rtx = maybe_mode_change (vd->e[i].mode, vd->e[regno].mode,
- mode, i, regno);
- if (new_rtx != NULL_RTX)
- {
- if (validate_change (insn, &SET_SRC (set), new_rtx, 0))
- {
- ORIGINAL_REGNO (new_rtx) = ORIGINAL_REGNO (src);
- REG_ATTRS (new_rtx) = REG_ATTRS (src);
- REG_POINTER (new_rtx) = REG_POINTER (src);
- if (dump_file)
- fprintf (dump_file,
- "insn %u: replaced reg %u with %u\n",
- INSN_UID (insn), regno, REGNO (new_rtx));
- changed = true;
- goto did_replacement;
- }
- }
- }
- }
- no_move_special_case:
-
- any_replacements = false;
-
- /* For each input operand, replace a hard register with the
- eldest live copy that's in an appropriate register class. */
- for (i = 0; i < n_ops; i++)
- {
- replaced[i] = false;
-
- /* Don't scan match_operand here, since we've no reg class
- information to pass down. Any operands that we could
- substitute in will be represented elsewhere. */
- if (recog_data.constraints[i][0] == '\0')
- continue;
-
- /* Don't replace in asms intentionally referencing hard regs. */
- if (is_asm && REG_P (recog_data.operand[i])
- && (REGNO (recog_data.operand[i])
- == ORIGINAL_REGNO (recog_data.operand[i])))
- continue;
-
- if (recog_data.operand_type[i] == OP_IN)
- {
- if (recog_op_alt[i][alt].is_address)
- replaced[i]
- = replace_oldest_value_addr (recog_data.operand_loc[i],
- recog_op_alt[i][alt].cl,
- VOIDmode, insn, vd);
- else if (REG_P (recog_data.operand[i]))
- replaced[i]
- = replace_oldest_value_reg (recog_data.operand_loc[i],
- recog_op_alt[i][alt].cl,
- insn, vd);
- else if (MEM_P (recog_data.operand[i]))
- replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
- insn, vd);
- }
- else if (MEM_P (recog_data.operand[i]))
- replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
- insn, vd);
-
- /* If we performed any replacement, update match_dups. */
- if (replaced[i])
- {
- int j;
- rtx new_rtx;
-
- new_rtx = *recog_data.operand_loc[i];
- recog_data.operand[i] = new_rtx;
- for (j = 0; j < recog_data.n_dups; j++)
- if (recog_data.dup_num[j] == i)
- validate_unshare_change (insn, recog_data.dup_loc[j], new_rtx, 1);
-
- any_replacements = true;
- }
- }
-
- if (any_replacements)
- {
- if (! apply_change_group ())
- {
- for (i = 0; i < n_ops; i++)
- if (replaced[i])
- {
- rtx old = *recog_data.operand_loc[i];
- recog_data.operand[i] = old;
- }
-
- if (dump_file)
- fprintf (dump_file,
- "insn %u: reg replacements not verified\n",
- INSN_UID (insn));
- }
- else
- changed = true;
- }
-
- did_replacement:
- /* Clobber call-clobbered registers. */
- if (CALL_P (insn))
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
- kill_value_regno (i, 1, vd);
-
- /* Notice stores. */
- note_stores (PATTERN (insn), kill_set_value, vd);
-
- /* Notice copies. */
- if (set && REG_P (SET_DEST (set)) && REG_P (SET_SRC (set)))
- copy_value (SET_DEST (set), SET_SRC (set), vd);
-
- if (insn == BB_END (bb))
- break;
- }
-
- return changed;
-}
-
-/* Main entry point for the forward copy propagation optimization. */
-
-static void
-copyprop_hardreg_forward (void)
-{
- struct value_data *all_vd;
- basic_block bb;
- sbitmap visited;
-
- all_vd = XNEWVEC (struct value_data, last_basic_block);
-
- visited = sbitmap_alloc (last_basic_block);
- sbitmap_zero (visited);
-
- FOR_EACH_BB (bb)
- {
- SET_BIT (visited, bb->index);
-
- /* If a block has a single predecessor, that we've already
- processed, begin with the value data that was live at
- the end of the predecessor block. */
- /* ??? Ought to use more intelligent queuing of blocks. */
- if (single_pred_p (bb)
- && TEST_BIT (visited, single_pred (bb)->index)
- && ! (single_pred_edge (bb)->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)))
- all_vd[bb->index] = all_vd[single_pred (bb)->index];
- else
- init_value_data (all_vd + bb->index);
-
- copyprop_hardreg_forward_1 (bb, all_vd + bb->index);
- }
-
- sbitmap_free (visited);
- free (all_vd);
-}
-
-/* Dump the value chain data to stderr. */
-
-void
-debug_value_data (struct value_data *vd)
-{
- HARD_REG_SET set;
- unsigned int i, j;
-
- CLEAR_HARD_REG_SET (set);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (vd->e[i].oldest_regno == i)
- {
- if (vd->e[i].mode == VOIDmode)
- {
- if (vd->e[i].next_regno != INVALID_REGNUM)
- fprintf (stderr, "[%u] Bad next_regno for empty chain (%u)\n",
- i, vd->e[i].next_regno);
- continue;
- }
-
- SET_HARD_REG_BIT (set, i);
- fprintf (stderr, "[%u %s] ", i, GET_MODE_NAME (vd->e[i].mode));
-
- for (j = vd->e[i].next_regno;
- j != INVALID_REGNUM;
- j = vd->e[j].next_regno)
- {
- if (TEST_HARD_REG_BIT (set, j))
- {
- fprintf (stderr, "[%u] Loop in regno chain\n", j);
- return;
- }
-
- if (vd->e[j].oldest_regno != i)
- {
- fprintf (stderr, "[%u] Bad oldest_regno (%u)\n",
- j, vd->e[j].oldest_regno);
- return;
- }
- SET_HARD_REG_BIT (set, j);
- fprintf (stderr, "[%u %s] ", j, GET_MODE_NAME (vd->e[j].mode));
- }
- fputc ('\n', stderr);
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (! TEST_HARD_REG_BIT (set, i)
- && (vd->e[i].mode != VOIDmode
- || vd->e[i].oldest_regno != i
- || vd->e[i].next_regno != INVALID_REGNUM))
- fprintf (stderr, "[%u] Non-empty reg in chain (%s %u %i)\n",
- i, GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno,
- vd->e[i].next_regno);
-}
-
-#ifdef ENABLE_CHECKING
-static void
-validate_value_data (struct value_data *vd)
-{
- HARD_REG_SET set;
- unsigned int i, j;
-
- CLEAR_HARD_REG_SET (set);
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (vd->e[i].oldest_regno == i)
- {
- if (vd->e[i].mode == VOIDmode)
- {
- if (vd->e[i].next_regno != INVALID_REGNUM)
- internal_error ("validate_value_data: [%u] Bad next_regno for empty chain (%u)",
- i, vd->e[i].next_regno);
- continue;
- }
-
- SET_HARD_REG_BIT (set, i);
-
- for (j = vd->e[i].next_regno;
- j != INVALID_REGNUM;
- j = vd->e[j].next_regno)
- {
- if (TEST_HARD_REG_BIT (set, j))
- internal_error ("validate_value_data: Loop in regno chain (%u)",
- j);
- if (vd->e[j].oldest_regno != i)
- internal_error ("validate_value_data: [%u] Bad oldest_regno (%u)",
- j, vd->e[j].oldest_regno);
-
- SET_HARD_REG_BIT (set, j);
- }
- }
-
- for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
- if (! TEST_HARD_REG_BIT (set, i)
- && (vd->e[i].mode != VOIDmode
- || vd->e[i].oldest_regno != i
- || vd->e[i].next_regno != INVALID_REGNUM))
- internal_error ("validate_value_data: [%u] Non-empty reg in chain (%s %u %i)",
- i, GET_MODE_NAME (vd->e[i].mode), vd->e[i].oldest_regno,
- vd->e[i].next_regno);
-}
-#endif
static bool
gate_handle_regrename (void)
@@ -1943,22 +1009,13 @@ gate_handle_regrename (void)
return (optimize > 0 && (flag_rename_registers));
}
-
-/* Run the regrename and cprop passes. */
-static unsigned int
-rest_of_handle_regrename (void)
-{
- regrename_optimize ();
- return 0;
-}
-
struct rtl_opt_pass pass_regrename =
{
{
RTL_PASS,
"rnreg", /* name */
gate_handle_regrename, /* gate */
- rest_of_handle_regrename, /* execute */
+ regrename_optimize, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
@@ -1972,36 +1029,3 @@ struct rtl_opt_pass pass_regrename =
}
};
-static bool
-gate_handle_cprop (void)
-{
- return (optimize > 0 && (flag_cprop_registers));
-}
-
-
-/* Run the regrename and cprop passes. */
-static unsigned int
-rest_of_handle_cprop (void)
-{
- copyprop_hardreg_forward ();
- return 0;
-}
-
-struct rtl_opt_pass pass_cprop_hardreg =
-{
- {
- RTL_PASS,
- "cprop_hardreg", /* name */
- gate_handle_cprop, /* gate */
- rest_of_handle_cprop, /* execute */
- NULL, /* sub */
- NULL, /* next */
- 0, /* static_pass_number */
- TV_RENAME_REGISTERS, /* tv_id */
- 0, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- TODO_dump_func | TODO_verify_rtl_sharing /* todo_flags_finish */
- }
-};
diff --git a/gcc/resource.c b/gcc/resource.c
index 2f9a71bc651..91b86c9573b 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -135,8 +135,6 @@ update_live_status (rtx dest, const_rtx x, void *data ATTRIBUTE_UNUSED)
static int
find_basic_block (rtx insn, int search_limit)
{
- basic_block bb;
-
/* Scan backwards to the previous BARRIER. Then see if we can find a
label that starts a basic block. Return the basic block number. */
for (insn = prev_nonnote_insn (insn);
@@ -157,11 +155,8 @@ find_basic_block (rtx insn, int search_limit)
for (insn = next_nonnote_insn (insn);
insn && LABEL_P (insn);
insn = next_nonnote_insn (insn))
- {
- FOR_EACH_BB (bb)
- if (insn == BB_HEAD (bb))
- return bb->index;
- }
+ if (BLOCK_FOR_INSN (insn))
+ return BLOCK_FOR_INSN (insn)->index;
return -1;
}
@@ -848,13 +843,12 @@ return_insn_p (const_rtx insn)
(with no intervening active insns) to see if any of them start a basic
block. If we hit the start of the function first, we use block 0.
- Once we have found a basic block and a corresponding first insns, we can
- accurately compute the live status from basic_block_live_regs and
- reg_renumber. (By starting at a label following a BARRIER, we are immune
- to actions taken by reload and jump.) Then we scan all insns between
- that point and our target. For each CLOBBER (or for call-clobbered regs
- when we pass a CALL_INSN), mark the appropriate registers are dead. For
- a SET, mark them as live.
+ Once we have found a basic block and a corresponding first insn, we can
+ accurately compute the live status (by starting at a label following a
+ BARRIER, we are immune to actions taken by reload and jump.) Then we
+ scan all insns between that point and our target. For each CLOBBER (or
+ for call-clobbered regs when we pass a CALL_INSN), mark the appropriate
+ registers are dead. For a SET, mark them as live.
We have to be careful when using REG_DEAD notes because they are not
updated by such things as find_equiv_reg. So keep track of registers
@@ -954,13 +948,10 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
TARGET. Otherwise, we must assume everything is live. */
if (b != -1)
{
- regset regs_live = DF_LR_IN (BASIC_BLOCK (b));
+ regset regs_live = df_get_live_in (BASIC_BLOCK (b));
rtx start_insn, stop_insn;
- /* Compute hard regs live at start of block -- this is the real hard regs
- marked live, plus live pseudo regs that have been renumbered to
- hard regs. */
-
+ /* Compute hard regs live at start of block. */
REG_SET_TO_HARD_REG_SET (current_live_regs, regs_live);
/* Get starting and ending insn, handling the case where each might
@@ -1046,10 +1037,24 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
else if (LABEL_P (real_insn))
{
+ basic_block bb;
+
/* A label clobbers the pending dead registers since neither
reload nor jump will propagate a value across a label. */
AND_COMPL_HARD_REG_SET (current_live_regs, pending_dead_regs);
CLEAR_HARD_REG_SET (pending_dead_regs);
+
+ /* We must conservatively assume that all registers that used
+ to be live here still are. The fallthrough edge may have
+ left a live register uninitialized. */
+ bb = BLOCK_FOR_INSN (real_insn);
+ if (bb)
+ {
+ HARD_REG_SET extra_live;
+
+ REG_SET_TO_HARD_REG_SET (extra_live, df_get_live_in (bb));
+ IOR_HARD_REG_SET (current_live_regs, extra_live);
+ }
}
/* The beginning of the epilogue corresponds to the end of the
@@ -1121,6 +1126,7 @@ void
init_resource_info (rtx epilogue_insn)
{
int i;
+ basic_block bb;
/* Indicate what resources are required to be valid at the end of the current
function. The condition code never is and memory always is. If the
@@ -1189,6 +1195,11 @@ init_resource_info (rtx epilogue_insn)
/* Allocate and initialize the tables used by mark_target_live_regs. */
target_hash_table = XCNEWVEC (struct target_info *, TARGET_HASH_PRIME);
bb_ticks = XCNEWVEC (int, last_basic_block);
+
+ /* Set the BLOCK_FOR_INSN of each label that starts a basic block. */
+ FOR_EACH_BB (bb)
+ if (LABEL_P (BB_HEAD (bb)))
+ BLOCK_FOR_INSN (BB_HEAD (bb)) = bb;
}
/* Free up the resources allocated to mark_target_live_regs (). This
@@ -1197,6 +1208,8 @@ init_resource_info (rtx epilogue_insn)
void
free_resource_info (void)
{
+ basic_block bb;
+
if (target_hash_table != NULL)
{
int i;
@@ -1222,6 +1235,10 @@ free_resource_info (void)
free (bb_ticks);
bb_ticks = NULL;
}
+
+ FOR_EACH_BB (bb)
+ if (LABEL_P (BB_HEAD (bb)))
+ BLOCK_FOR_INSN (BB_HEAD (bb)) = NULL;
}
/* Clear any hashed information that we have stored for INSN. */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 9941a9736f6..1282b909cf7 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2222,6 +2222,7 @@ extern void expand_dec (rtx, rtx);
/* In gcse.c */
extern bool can_copy_p (enum machine_mode);
+extern bool can_assign_to_reg_without_clobbers_p (rtx);
extern rtx fis_get_condition (rtx);
/* In ira.c */
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 168b01f64d4..d3f35627815 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3481,6 +3481,8 @@ bool
maybe_tidy_empty_bb (basic_block bb)
{
basic_block succ_bb, pred_bb;
+ edge e;
+ edge_iterator ei;
bool rescan_p;
/* Keep empty bb only if this block immediately precedes EXIT and
@@ -3492,6 +3494,11 @@ maybe_tidy_empty_bb (basic_block bb)
|| !(single_pred_edge (bb)->flags & EDGE_FALLTHRU))))
return false;
+ /* Do not attempt to redirect complex edges. */
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ if (e->flags & EDGE_COMPLEX)
+ return false;
+
free_data_sets (bb);
/* Do not delete BB if it has more than one successor.
@@ -3510,9 +3517,6 @@ maybe_tidy_empty_bb (basic_block bb)
/* Redirect all non-fallthru edges to the next bb. */
while (rescan_p)
{
- edge e;
- edge_iterator ei;
-
rescan_p = false;
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -5244,8 +5248,6 @@ sel_create_recovery_block (insn_t orig_insn)
void
sel_merge_blocks (basic_block a, basic_block b)
{
- gcc_assert (can_merge_blocks_p (a, b));
-
sel_remove_empty_bb (b, true, false);
merge_blocks (a, b);
@@ -5290,6 +5292,7 @@ sel_redirect_edge_and_branch (edge e, basic_block to)
basic_block src;
int prev_max_uid;
rtx jump;
+ edge redirected;
latch_edge_p = (pipelining_p
&& current_loop_nest
@@ -5297,9 +5300,10 @@ sel_redirect_edge_and_branch (edge e, basic_block to)
src = e->src;
prev_max_uid = get_max_uid ();
-
- redirect_edge_and_branch (e, to);
- gcc_assert (last_added_blocks == NULL);
+
+ redirected = redirect_edge_and_branch (e, to);
+
+ gcc_assert (redirected && last_added_blocks == NULL);
/* When we've redirected a latch edge, update the header. */
if (latch_edge_p)
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 4bf21b21263..3d219e1568a 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -1358,10 +1358,6 @@ _eligible_successor_edge_p (edge e1, succ_iterator *ip)
e2 = EDGE_SUCC (bb, 0);
bb = e2->dest;
-
- /* This couldn't happen inside a region. */
- gcc_assert (! in_current_region_p (bb)
- || (flags & SUCCS_OUT));
}
/* Save the second edge for later checks. */
@@ -1584,7 +1580,6 @@ extern void sel_redirect_edge_and_branch_force (edge, basic_block);
extern void sel_init_pipelining (void);
extern void sel_finish_pipelining (void);
extern void sel_sched_region (int);
-extern void sel_find_rgns (void);
extern loop_p get_loop_nest_for_rgn (unsigned int);
extern bool considered_for_pipelining_p (struct loop *);
extern void make_region_from_loop_preheader (VEC(basic_block, heap) **);
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index e524d02516f..b1a33beb7d0 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -6483,9 +6483,10 @@ setup_current_loop_nest (int rgn)
static void
purge_empty_blocks (void)
{
- int i ;
+ /* Do not attempt to delete preheader. */
+ int i = sel_is_loop_preheader_p (BASIC_BLOCK (BB_TO_BLOCK (0))) ? 1 : 0;
- for (i = 1; i < current_nr_blocks; )
+ while (i < current_nr_blocks)
{
basic_block b = BASIC_BLOCK (BB_TO_BLOCK (i));
diff --git a/gcc/ssaexpand.h b/gcc/ssaexpand.h
index a42282d582f..95c55596a98 100644
--- a/gcc/ssaexpand.h
+++ b/gcc/ssaexpand.h
@@ -31,10 +31,9 @@ struct ssaexpand
/* The computed partitions of SSA names are stored here. */
var_map map;
- /* For a SSA name version V values[V] contains the gimple statement
- defining it iff TER decided that it should be forwarded, NULL
- otherwise. */
- gimple *values;
+ /* For an SSA name version V bit V is set iff TER decided that
+ its definition should be forwarded. */
+ bitmap values;
/* For a partition number I partition_to_pseudo[I] contains the
RTL expression of the allocated space of it (either a MEM or
@@ -67,8 +66,8 @@ static inline gimple
get_gimple_for_ssa_name (tree exp)
{
int v = SSA_NAME_VERSION (exp);
- if (SA.values)
- return SA.values[v];
+ if (SA.values && bitmap_bit_p (SA.values, v))
+ return SSA_NAME_DEF_STMT (exp);
return NULL;
}
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 6dc32fdfc12..7fc4038aaf5 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "regs.h"
#include "alloc-pool.h"
+#include "pretty-print.h"
/* Functions and data structures for expanding case statements. */
@@ -600,8 +601,8 @@ tree_conflicts_with_clobbers_p (tree t, HARD_REG_SET *clobbered_regs)
if (overlap)
{
- error ("asm-specifier for variable %qs conflicts with asm clobber list",
- IDENTIFIER_POINTER (DECL_NAME (overlap)));
+ error ("asm-specifier for variable %qE conflicts with asm clobber list",
+ DECL_NAME (overlap));
/* Reset registerness to stop multiple errors emitted for a single
variable. */
@@ -1322,7 +1323,7 @@ resolve_operand_name_1 (char *p, tree outputs, tree inputs)
}
*q = '\0';
- error ("undefined named operand %qs", p + 1);
+ error ("undefined named operand %qs", identifier_to_locale (p + 1));
op = 0;
found:
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index c2d367f38a7..fab5817d3c2 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1292,19 +1292,19 @@ finalize_record_size (record_layout_info rli)
if (TYPE_NAME (rli->t))
{
- const char *name;
+ tree name;
if (TREE_CODE (TYPE_NAME (rli->t)) == IDENTIFIER_NODE)
- name = IDENTIFIER_POINTER (TYPE_NAME (rli->t));
+ name = TYPE_NAME (rli->t);
else
- name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (rli->t)));
+ name = DECL_NAME (TYPE_NAME (rli->t));
if (STRICT_ALIGNMENT)
warning (OPT_Wpacked, "packed attribute causes inefficient "
- "alignment for %qs", name);
+ "alignment for %qE", name);
else
warning (OPT_Wpacked,
- "packed attribute is unnecessary for %qs", name);
+ "packed attribute is unnecessary for %qE", name);
}
else
{
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
new file mode 100644
index 00000000000..5dabd1a8f20
--- /dev/null
+++ b/gcc/store-motion.c
@@ -0,0 +1,1265 @@
+/* Store motion via Lazy Code Motion on the reverse CFG.
+ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "toplev.h"
+
+#include "rtl.h"
+#include "tree.h"
+#include "tm_p.h"
+#include "regs.h"
+#include "hard-reg-set.h"
+#include "flags.h"
+#include "real.h"
+#include "insn-config.h"
+#include "recog.h"
+#include "basic-block.h"
+#include "output.h"
+#include "function.h"
+#include "expr.h"
+#include "except.h"
+#include "ggc.h"
+#include "params.h"
+#include "intl.h"
+#include "timevar.h"
+#include "tree-pass.h"
+#include "hashtab.h"
+#include "df.h"
+#include "dbgcnt.h"
+
+/* This pass implements downward store motion.
+ As of May 1, 2009, the pass is not enabled by default on any target,
+ but bootstrap completes on ia64 and x86_64 with the pass enabled. */
+
+/* TODO:
+ - remove_reachable_equiv_notes is an incomprehensible pile of goo and
+ a compile time hog that needs a rewrite (maybe cache st_exprs to
+ invalidate REG_EQUAL/REG_EQUIV notes for?).
+ - pattern_regs in st_expr should be a regset (on its own obstack).
+ - antic_stores and avail_stores should be VECs instead of lists.
+ - store_motion_mems should be a VEC instead of a list.
+ - there should be an alloc pool for struct st_expr objects.
+ - investigate whether it is helpful to make the address of an st_expr
+ a cselib VALUE.
+ - when GIMPLE alias information is exported, the effectiveness of this
+ pass should be re-evaluated.
+*/
+
+/* This is a list of store expressions (MEMs). The structure is used
+ as an expression table to track stores which look interesting, and
+ might be moveable towards the exit block. */
+
+struct st_expr
+{
+ /* Pattern of this mem. */
+ rtx pattern;
+ /* List of registers mentioned by the mem. */
+ rtx pattern_regs;
+ /* INSN list of stores that are locally anticipatable. */
+ rtx antic_stores;
+ /* INSN list of stores that are locally available. */
+ rtx avail_stores;
+ /* Next in the list. */
+ struct st_expr * next;
+ /* Store ID in the dataflow bitmaps. */
+ int index;
+ /* Hash value for the hash table. */
+ unsigned int hash_index;
+ /* Register holding the stored expression when a store is moved.
+ This field is also used as a cache in find_moveable_store, see
+ LAST_AVAIL_CHECK_FAILURE below. */
+ rtx reaching_reg;
+};
+
+/* Head of the list of load/store memory refs. */
+static struct st_expr * store_motion_mems = NULL;
+
+/* Hashtable for the load/store memory refs. */
+static htab_t store_motion_mems_table = NULL;
+
+/* These bitmaps will hold the local dataflow properties per basic block. */
+static sbitmap *st_kill, *st_avloc, *st_antloc, *st_transp;
+
+/* Nonzero for expressions which should be inserted on a specific edge. */
+static sbitmap *st_insert_map;
+
+/* Nonzero for expressions which should be deleted in a specific block. */
+static sbitmap *st_delete_map;
+
+/* Global holding the number of store expressions we are dealing with. */
+static int num_stores;
+
+/* Contains the edge_list returned by pre_edge_lcm. */
+static struct edge_list *edge_list;
+
+static hashval_t
+pre_st_expr_hash (const void *p)
+{
+ int do_not_record_p = 0;
+ const struct st_expr *const x = (const struct st_expr *) p;
+ return hash_rtx (x->pattern, GET_MODE (x->pattern), &do_not_record_p, NULL, false);
+}
+
+static int
+pre_st_expr_eq (const void *p1, const void *p2)
+{
+ const struct st_expr *const ptr1 = (const struct st_expr *) p1,
+ *const ptr2 = (const struct st_expr *) p2;
+ return exp_equiv_p (ptr1->pattern, ptr2->pattern, 0, true);
+}
+
+/* This will search the st_expr list for a matching expression. If it
+ doesn't find one, we create one and initialize it. */
+
+static struct st_expr *
+st_expr_entry (rtx x)
+{
+ int do_not_record_p = 0;
+ struct st_expr * ptr;
+ unsigned int hash;
+ void **slot;
+ struct st_expr e;
+
+ hash = hash_rtx (x, GET_MODE (x), &do_not_record_p,
+ NULL, /*have_reg_qty=*/false);
+
+ e.pattern = x;
+ slot = htab_find_slot_with_hash (store_motion_mems_table, &e, hash, INSERT);
+ if (*slot)
+ return (struct st_expr *)*slot;
+
+ ptr = XNEW (struct st_expr);
+
+ ptr->next = store_motion_mems;
+ ptr->pattern = x;
+ ptr->pattern_regs = NULL_RTX;
+ ptr->antic_stores = NULL_RTX;
+ ptr->avail_stores = NULL_RTX;
+ ptr->reaching_reg = NULL_RTX;
+ ptr->index = 0;
+ ptr->hash_index = hash;
+ store_motion_mems = ptr;
+ *slot = ptr;
+
+ return ptr;
+}
+
+/* Free up an individual st_expr entry. */
+
+static void
+free_st_expr_entry (struct st_expr * ptr)
+{
+ free_INSN_LIST_list (& ptr->antic_stores);
+ free_INSN_LIST_list (& ptr->avail_stores);
+
+ free (ptr);
+}
+
+/* Free up all memory associated with the st_expr list. */
+
+static void
+free_store_motion_mems (void)
+{
+ if (store_motion_mems_table)
+ htab_delete (store_motion_mems_table);
+ store_motion_mems_table = NULL;
+
+ while (store_motion_mems)
+ {
+ struct st_expr * tmp = store_motion_mems;
+ store_motion_mems = store_motion_mems->next;
+ free_st_expr_entry (tmp);
+ }
+ store_motion_mems = NULL;
+}
+
+/* Assign each element of the list of mems a monotonically increasing value. */
+
+static int
+enumerate_store_motion_mems (void)
+{
+ struct st_expr * ptr;
+ int n = 0;
+
+ for (ptr = store_motion_mems; ptr != NULL; ptr = ptr->next)
+ ptr->index = n++;
+
+ return n;
+}
+
+/* Return first item in the list. */
+
+static inline struct st_expr *
+first_st_expr (void)
+{
+ return store_motion_mems;
+}
+
+/* Return the next item in the list after the specified one. */
+
+static inline struct st_expr *
+next_st_expr (struct st_expr * ptr)
+{
+ return ptr->next;
+}
+
+/* Dump debugging info about the store_motion_mems list. */
+
+static void
+print_store_motion_mems (FILE * file)
+{
+ struct st_expr * ptr;
+
+ fprintf (dump_file, "STORE_MOTION list of MEM exprs considered:\n");
+
+ for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
+ {
+ fprintf (file, " Pattern (%3d): ", ptr->index);
+
+ print_rtl (file, ptr->pattern);
+
+ fprintf (file, "\n ANTIC stores : ");
+
+ if (ptr->antic_stores)
+ print_rtl (file, ptr->antic_stores);
+ else
+ fprintf (file, "(nil)");
+
+ fprintf (file, "\n AVAIL stores : ");
+
+ if (ptr->avail_stores)
+ print_rtl (file, ptr->avail_stores);
+ else
+ fprintf (file, "(nil)");
+
+ fprintf (file, "\n\n");
+ }
+
+ fprintf (file, "\n");
+}
+
+/* Return zero if some of the registers in list X are killed
+ due to set of registers in bitmap REGS_SET. */
+
+static bool
+store_ops_ok (const_rtx x, int *regs_set)
+{
+ const_rtx reg;
+
+ for (; x; x = XEXP (x, 1))
+ {
+ reg = XEXP (x, 0);
+ if (regs_set[REGNO(reg)])
+ return false;
+ }
+
+ return true;
+}
+
+/* Helper for extract_mentioned_regs. */
+
+static int
+extract_mentioned_regs_1 (rtx *loc, void *data)
+{
+ rtx *mentioned_regs_p = (rtx *) data;
+
+ if (REG_P (*loc))
+ *mentioned_regs_p = alloc_EXPR_LIST (0, *loc, *mentioned_regs_p);
+
+ return 0;
+}
+
+/* Returns a list of registers mentioned in X.
+ FIXME: A regset would be prettier and less expensive. */
+
+static rtx
+extract_mentioned_regs (rtx x)
+{
+ rtx mentioned_regs = NULL;
+ for_each_rtx (&x, extract_mentioned_regs_1, &mentioned_regs);
+ return mentioned_regs;
+}
+
+/* Check to see if the load X is aliased with STORE_PATTERN.
+ AFTER is true if we are checking the case when STORE_PATTERN occurs
+ after the X. */
+
+static bool
+load_kills_store (const_rtx x, const_rtx store_pattern, int after)
+{
+ if (after)
+ return anti_dependence (x, store_pattern);
+ else
+ return true_dependence (store_pattern, GET_MODE (store_pattern), x,
+ rtx_addr_varies_p);
+}
+
+/* Go through the entire rtx X, looking for any loads which might alias
+ STORE_PATTERN. Return true if found.
+ AFTER is true if we are checking the case when STORE_PATTERN occurs
+ after the insn X. */
+
+static bool
+find_loads (const_rtx x, const_rtx store_pattern, int after)
+{
+ const char * fmt;
+ int i, j;
+ int ret = false;
+
+ if (!x)
+ return false;
+
+ if (GET_CODE (x) == SET)
+ x = SET_SRC (x);
+
+ if (MEM_P (x))
+ {
+ if (load_kills_store (x, store_pattern, after))
+ return true;
+ }
+
+ /* Recursively process the insn. */
+ fmt = GET_RTX_FORMAT (GET_CODE (x));
+
+ for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0 && !ret; i--)
+ {
+ if (fmt[i] == 'e')
+ ret |= find_loads (XEXP (x, i), store_pattern, after);
+ else if (fmt[i] == 'E')
+ for (j = XVECLEN (x, i) - 1; j >= 0; j--)
+ ret |= find_loads (XVECEXP (x, i, j), store_pattern, after);
+ }
+ return ret;
+}
+
+/* Go through pattern PAT looking for any loads which might kill the
+ store in X. Return true if found.
+ AFTER is true if we are checking the case when loads kill X occurs
+ after the insn for PAT. */
+
+static inline bool
+store_killed_in_pat (const_rtx x, const_rtx pat, int after)
+{
+ if (GET_CODE (pat) == SET)
+ {
+ rtx dest = SET_DEST (pat);
+
+ if (GET_CODE (dest) == ZERO_EXTRACT)
+ dest = XEXP (dest, 0);
+
+ /* Check for memory stores to aliased objects. */
+ if (MEM_P (dest)
+ && !exp_equiv_p (dest, x, 0, true))
+ {
+ if (after)
+ {
+ if (output_dependence (dest, x))
+ return true;
+ }
+ else
+ {
+ if (output_dependence (x, dest))
+ return true;
+ }
+ }
+ }
+
+ if (find_loads (pat, x, after))
+ return true;
+
+ return false;
+}
+
+/* Check if INSN kills the store pattern X (is aliased with it).
+ AFTER is true if we are checking the case when store X occurs
+ after the insn. Return true if it does. */
+
+static bool
+store_killed_in_insn (const_rtx x, const_rtx x_regs, const_rtx insn, int after)
+{
+ const_rtx reg, base, note, pat;
+
+ if (!INSN_P (insn))
+ return false;
+
+ if (CALL_P (insn))
+ {
+ /* A normal or pure call might read from pattern,
+ but a const call will not. */
+ if (!RTL_CONST_CALL_P (insn))
+ return true;
+
+ /* But even a const call reads its parameters. Check whether the
+ base of some of registers used in mem is stack pointer. */
+ for (reg = x_regs; reg; reg = XEXP (reg, 1))
+ {
+ base = find_base_term (XEXP (reg, 0));
+ if (!base
+ || (GET_CODE (base) == ADDRESS
+ && GET_MODE (base) == Pmode
+ && XEXP (base, 0) == stack_pointer_rtx))
+ return true;
+ }
+
+ return false;
+ }
+
+ pat = PATTERN (insn);
+ if (GET_CODE (pat) == SET)
+ {
+ if (store_killed_in_pat (x, pat, after))
+ return true;
+ }
+ else if (GET_CODE (pat) == PARALLEL)
+ {
+ int i;
+
+ for (i = 0; i < XVECLEN (pat, 0); i++)
+ if (store_killed_in_pat (x, XVECEXP (pat, 0, i), after))
+ return true;
+ }
+ else if (find_loads (PATTERN (insn), x, after))
+ return true;
+
+ /* If this insn has a REG_EQUAL or REG_EQUIV note referencing a memory
+ location aliased with X, then this insn kills X. */
+ note = find_reg_equal_equiv_note (insn);
+ if (! note)
+ return false;
+ note = XEXP (note, 0);
+
+ /* However, if the note represents a must alias rather than a may
+ alias relationship, then it does not kill X. */
+ if (exp_equiv_p (note, x, 0, true))
+ return false;
+
+ /* See if there are any aliased loads in the note. */
+ return find_loads (note, x, after);
+}
+
+/* Returns true if the expression X is loaded or clobbered on or after INSN
+ within basic block BB. REGS_SET_AFTER is bitmap of registers set in
+ or after the insn. X_REGS is list of registers mentioned in X. If the store
+ is killed, return the last insn in that it occurs in FAIL_INSN. */
+
+static bool
+store_killed_after (const_rtx x, const_rtx x_regs, const_rtx insn, const_basic_block bb,
+ int *regs_set_after, rtx *fail_insn)
+{
+ rtx last = BB_END (bb), act;
+
+ if (!store_ops_ok (x_regs, regs_set_after))
+ {
+ /* We do not know where it will happen. */
+ if (fail_insn)
+ *fail_insn = NULL_RTX;
+ return true;
+ }
+
+ /* Scan from the end, so that fail_insn is determined correctly. */
+ for (act = last; act != PREV_INSN (insn); act = PREV_INSN (act))
+ if (store_killed_in_insn (x, x_regs, act, false))
+ {
+ if (fail_insn)
+ *fail_insn = act;
+ return true;
+ }
+
+ return false;
+}
+
+/* Returns true if the expression X is loaded or clobbered on or before INSN
+ within basic block BB. X_REGS is list of registers mentioned in X.
+ REGS_SET_BEFORE is bitmap of registers set before or in this insn. */
+static bool
+store_killed_before (const_rtx x, const_rtx x_regs, const_rtx insn, const_basic_block bb,
+ int *regs_set_before)
+{
+ rtx first = BB_HEAD (bb);
+
+ if (!store_ops_ok (x_regs, regs_set_before))
+ return true;
+
+ for ( ; insn != PREV_INSN (first); insn = PREV_INSN (insn))
+ if (store_killed_in_insn (x, x_regs, insn, true))
+ return true;
+
+ return false;
+}
+
+/* The last insn in the basic block that compute_store_table is processing,
+ where store_killed_after is true for X.
+ Since we go through the basic block from BB_END to BB_HEAD, this is
+ also the available store at the end of the basic block. Therefore
+ this is in effect a cache, to avoid calling store_killed_after for
+ equivalent aliasing store expressions.
+ This value is only meaningful during the computation of the store
+ table. We hi-jack the REACHING_REG field of struct st_expr to save
+ a bit of memory. */
+#define LAST_AVAIL_CHECK_FAILURE(x) ((x)->reaching_reg)
+
+/* Determine whether INSN is MEM store pattern that we will consider moving.
+ REGS_SET_BEFORE is bitmap of registers set before (and including) the
+ current insn, REGS_SET_AFTER is bitmap of registers set after (and
+ including) the insn in this basic block. We must be passing through BB from
+ head to end, as we are using this fact to speed things up.
+
+ The results are stored this way:
+
+ -- the first anticipatable expression is added into ANTIC_STORES
+ -- if the processed expression is not anticipatable, NULL_RTX is added
+ there instead, so that we can use it as indicator that no further
+ expression of this type may be anticipatable
+ -- if the expression is available, it is added as head of AVAIL_STORES;
+ consequently, all of them but this head are dead and may be deleted.
+ -- if the expression is not available, the insn due to that it fails to be
+ available is stored in REACHING_REG (via LAST_AVAIL_CHECK_FAILURE).
+
+ The things are complicated a bit by fact that there already may be stores
+ to the same MEM from other blocks; also caller must take care of the
+ necessary cleanup of the temporary markers after end of the basic block.
+ */
+
+static void
+find_moveable_store (rtx insn, int *regs_set_before, int *regs_set_after)
+{
+ struct st_expr * ptr;
+ rtx dest, set, tmp;
+ int check_anticipatable, check_available;
+ basic_block bb = BLOCK_FOR_INSN (insn);
+
+ set = single_set (insn);
+ if (!set)
+ return;
+
+ dest = SET_DEST (set);
+
+ if (! MEM_P (dest) || MEM_VOLATILE_P (dest)
+ || GET_MODE (dest) == BLKmode)
+ return;
+
+ if (side_effects_p (dest))
+ return;
+
+ /* If we are handling exceptions, we must be careful with memory references
+ that may trap. If we are not, the behavior is undefined, so we may just
+ continue. */
+ if (flag_non_call_exceptions && may_trap_p (dest))
+ return;
+
+ /* Even if the destination cannot trap, the source may. In this case we'd
+ need to handle updating the REG_EH_REGION note. */
+ if (find_reg_note (insn, REG_EH_REGION, NULL_RTX))
+ return;
+
+ /* Make sure that the SET_SRC of this store insns can be assigned to
+ a register, or we will fail later on in replace_store_insn, which
+ assumes that we can do this. But sometimes the target machine has
+ oddities like MEM read-modify-write instruction. See for example
+ PR24257. */
+ if (!can_assign_to_reg_without_clobbers_p (SET_SRC (set)))
+ return;
+
+ ptr = st_expr_entry (dest);
+ if (!ptr->pattern_regs)
+ ptr->pattern_regs = extract_mentioned_regs (dest);
+
+ /* Do not check for anticipatability if we either found one anticipatable
+ store already, or tested for one and found out that it was killed. */
+ check_anticipatable = 0;
+ if (!ptr->antic_stores)
+ check_anticipatable = 1;
+ else
+ {
+ tmp = XEXP (ptr->antic_stores, 0);
+ if (tmp != NULL_RTX
+ && BLOCK_FOR_INSN (tmp) != bb)
+ check_anticipatable = 1;
+ }
+ if (check_anticipatable)
+ {
+ if (store_killed_before (dest, ptr->pattern_regs, insn, bb, regs_set_before))
+ tmp = NULL_RTX;
+ else
+ tmp = insn;
+ ptr->antic_stores = alloc_INSN_LIST (tmp, ptr->antic_stores);
+ }
+
+ /* It is not necessary to check whether store is available if we did
+ it successfully before; if we failed before, do not bother to check
+ until we reach the insn that caused us to fail. */
+ check_available = 0;
+ if (!ptr->avail_stores)
+ check_available = 1;
+ else
+ {
+ tmp = XEXP (ptr->avail_stores, 0);
+ if (BLOCK_FOR_INSN (tmp) != bb)
+ check_available = 1;
+ }
+ if (check_available)
+ {
+ /* Check that we have already reached the insn at that the check
+ failed last time. */
+ if (LAST_AVAIL_CHECK_FAILURE (ptr))
+ {
+ for (tmp = BB_END (bb);
+ tmp != insn && tmp != LAST_AVAIL_CHECK_FAILURE (ptr);
+ tmp = PREV_INSN (tmp))
+ continue;
+ if (tmp == insn)
+ check_available = 0;
+ }
+ else
+ check_available = store_killed_after (dest, ptr->pattern_regs, insn,
+ bb, regs_set_after,
+ &LAST_AVAIL_CHECK_FAILURE (ptr));
+ }
+ if (!check_available)
+ ptr->avail_stores = alloc_INSN_LIST (insn, ptr->avail_stores);
+}
+
+/* Find available and anticipatable stores. */
+
+static int
+compute_store_table (void)
+{
+ int ret;
+ basic_block bb;
+#ifdef ENABLE_CHECKING
+ unsigned regno;
+#endif
+ rtx insn, tmp;
+ df_ref *def_rec;
+ int *last_set_in, *already_set;
+ struct st_expr * ptr, **prev_next_ptr_ptr;
+ unsigned int max_gcse_regno = max_reg_num ();
+
+ store_motion_mems = NULL;
+ store_motion_mems_table = htab_create (13, pre_st_expr_hash,
+ pre_st_expr_eq, NULL);
+ last_set_in = XCNEWVEC (int, max_gcse_regno);
+ already_set = XNEWVEC (int, max_gcse_regno);
+
+ /* Find all the stores we care about. */
+ FOR_EACH_BB (bb)
+ {
+ /* First compute the registers set in this block. */
+ FOR_BB_INSNS (bb, insn)
+ {
+
+ if (! INSN_P (insn))
+ continue;
+
+ for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ last_set_in[DF_REF_REGNO (*def_rec)] = INSN_UID (insn);
+ }
+
+ /* Now find the stores. */
+ memset (already_set, 0, sizeof (int) * max_gcse_regno);
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (! INSN_P (insn))
+ continue;
+
+ for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ already_set[DF_REF_REGNO (*def_rec)] = INSN_UID (insn);
+
+ /* Now that we've marked regs, look for stores. */
+ find_moveable_store (insn, already_set, last_set_in);
+
+ /* Unmark regs that are no longer set. */
+ for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ if (last_set_in[DF_REF_REGNO (*def_rec)] == INSN_UID (insn))
+ last_set_in[DF_REF_REGNO (*def_rec)] = 0;
+ }
+
+#ifdef ENABLE_CHECKING
+ /* last_set_in should now be all-zero. */
+ for (regno = 0; regno < max_gcse_regno; regno++)
+ gcc_assert (!last_set_in[regno]);
+#endif
+
+ /* Clear temporary marks. */
+ for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
+ {
+ LAST_AVAIL_CHECK_FAILURE (ptr) = NULL_RTX;
+ if (ptr->antic_stores
+ && (tmp = XEXP (ptr->antic_stores, 0)) == NULL_RTX)
+ ptr->antic_stores = XEXP (ptr->antic_stores, 1);
+ }
+ }
+
+ /* Remove the stores that are not available anywhere, as there will
+ be no opportunity to optimize them. */
+ for (ptr = store_motion_mems, prev_next_ptr_ptr = &store_motion_mems;
+ ptr != NULL;
+ ptr = *prev_next_ptr_ptr)
+ {
+ if (! ptr->avail_stores)
+ {
+ *prev_next_ptr_ptr = ptr->next;
+ htab_remove_elt_with_hash (store_motion_mems_table,
+ ptr, ptr->hash_index);
+ free_st_expr_entry (ptr);
+ }
+ else
+ prev_next_ptr_ptr = &ptr->next;
+ }
+
+ ret = enumerate_store_motion_mems ();
+
+ if (dump_file)
+ print_store_motion_mems (dump_file);
+
+ free (last_set_in);
+ free (already_set);
+ return ret;
+}
+
+/* In all code following after this, REACHING_REG has its original
+ meaning again. Avoid confusion, and undef the accessor macro for
+ the temporary marks usage in compute_store_table. */
+#undef LAST_AVAIL_CHECK_FAILURE
+
+/* Insert an instruction at the beginning of a basic block, and update
+ the BB_HEAD if needed. */
+
+static void
+insert_insn_start_basic_block (rtx insn, basic_block bb)
+{
+ /* Insert at start of successor block. */
+ rtx prev = PREV_INSN (BB_HEAD (bb));
+ rtx before = BB_HEAD (bb);
+ while (before != 0)
+ {
+ if (! LABEL_P (before)
+ && !NOTE_INSN_BASIC_BLOCK_P (before))
+ break;
+ prev = before;
+ if (prev == BB_END (bb))
+ break;
+ before = NEXT_INSN (before);
+ }
+
+ insn = emit_insn_after_noloc (insn, prev, bb);
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "STORE_MOTION insert store at start of BB %d:\n",
+ bb->index);
+ print_inline_rtx (dump_file, insn, 6);
+ fprintf (dump_file, "\n");
+ }
+}
+
+/* This routine will insert a store on an edge. EXPR is the st_expr entry for
+ the memory reference, and E is the edge to insert it on. Returns nonzero
+ if an edge insertion was performed. */
+
+static int
+insert_store (struct st_expr * expr, edge e)
+{
+ rtx reg, insn;
+ basic_block bb;
+ edge tmp;
+ edge_iterator ei;
+
+ /* We did all the deleted before this insert, so if we didn't delete a
+ store, then we haven't set the reaching reg yet either. */
+ if (expr->reaching_reg == NULL_RTX)
+ return 0;
+
+ if (e->flags & EDGE_FAKE)
+ return 0;
+
+ reg = expr->reaching_reg;
+ insn = gen_move_insn (copy_rtx (expr->pattern), reg);
+
+ /* If we are inserting this expression on ALL predecessor edges of a BB,
+ insert it at the start of the BB, and reset the insert bits on the other
+ edges so we don't try to insert it on the other edges. */
+ bb = e->dest;
+ FOR_EACH_EDGE (tmp, ei, e->dest->preds)
+ if (!(tmp->flags & EDGE_FAKE))
+ {
+ int index = EDGE_INDEX (edge_list, tmp->src, tmp->dest);
+
+ gcc_assert (index != EDGE_INDEX_NO_EDGE);
+ if (! TEST_BIT (st_insert_map[index], expr->index))
+ break;
+ }
+
+ /* If tmp is NULL, we found an insertion on every edge, blank the
+ insertion vector for these edges, and insert at the start of the BB. */
+ if (!tmp && bb != EXIT_BLOCK_PTR)
+ {
+ FOR_EACH_EDGE (tmp, ei, e->dest->preds)
+ {
+ int index = EDGE_INDEX (edge_list, tmp->src, tmp->dest);
+ RESET_BIT (st_insert_map[index], expr->index);
+ }
+ insert_insn_start_basic_block (insn, bb);
+ return 0;
+ }
+
+ /* We can't put stores in the front of blocks pointed to by abnormal
+ edges since that may put a store where one didn't used to be. */
+ gcc_assert (!(e->flags & EDGE_ABNORMAL));
+
+ insert_insn_on_edge (insn, e);
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "STORE_MOTION insert insn on edge (%d, %d):\n",
+ e->src->index, e->dest->index);
+ print_inline_rtx (dump_file, insn, 6);
+ fprintf (dump_file, "\n");
+ }
+
+ return 1;
+}
+
+/* Remove any REG_EQUAL or REG_EQUIV notes containing a reference to the
+ memory location in SMEXPR set in basic block BB.
+
+ This could be rather expensive. */
+
+static void
+remove_reachable_equiv_notes (basic_block bb, struct st_expr *smexpr)
+{
+ edge_iterator *stack, ei;
+ int sp;
+ edge act;
+ sbitmap visited = sbitmap_alloc (last_basic_block);
+ rtx last, insn, note;
+ rtx mem = smexpr->pattern;
+
+ stack = XNEWVEC (edge_iterator, n_basic_blocks);
+ sp = 0;
+ ei = ei_start (bb->succs);
+
+ sbitmap_zero (visited);
+
+ act = (EDGE_COUNT (ei_container (ei)) > 0 ? EDGE_I (ei_container (ei), 0) : NULL);
+ while (1)
+ {
+ if (!act)
+ {
+ if (!sp)
+ {
+ free (stack);
+ sbitmap_free (visited);
+ return;
+ }
+ act = ei_edge (stack[--sp]);
+ }
+ bb = act->dest;
+
+ if (bb == EXIT_BLOCK_PTR
+ || TEST_BIT (visited, bb->index))
+ {
+ if (!ei_end_p (ei))
+ ei_next (&ei);
+ act = (! ei_end_p (ei)) ? ei_edge (ei) : NULL;
+ continue;
+ }
+ SET_BIT (visited, bb->index);
+
+ if (TEST_BIT (st_antloc[bb->index], smexpr->index))
+ {
+ for (last = smexpr->antic_stores;
+ BLOCK_FOR_INSN (XEXP (last, 0)) != bb;
+ last = XEXP (last, 1))
+ continue;
+ last = XEXP (last, 0);
+ }
+ else
+ last = NEXT_INSN (BB_END (bb));
+
+ for (insn = BB_HEAD (bb); insn != last; insn = NEXT_INSN (insn))
+ if (INSN_P (insn))
+ {
+ note = find_reg_equal_equiv_note (insn);
+ if (!note || !exp_equiv_p (XEXP (note, 0), mem, 0, true))
+ continue;
+
+ if (dump_file)
+ fprintf (dump_file, "STORE_MOTION drop REG_EQUAL note at insn %d:\n",
+ INSN_UID (insn));
+ remove_note (insn, note);
+ }
+
+ if (!ei_end_p (ei))
+ ei_next (&ei);
+ act = (! ei_end_p (ei)) ? ei_edge (ei) : NULL;
+
+ if (EDGE_COUNT (bb->succs) > 0)
+ {
+ if (act)
+ stack[sp++] = ei;
+ ei = ei_start (bb->succs);
+ act = (EDGE_COUNT (ei_container (ei)) > 0 ? EDGE_I (ei_container (ei), 0) : NULL);
+ }
+ }
+}
+
+/* This routine will replace a store with a SET to a specified register. */
+
+static void
+replace_store_insn (rtx reg, rtx del, basic_block bb, struct st_expr *smexpr)
+{
+ rtx insn, mem, note, set, ptr;
+
+ mem = smexpr->pattern;
+ insn = gen_move_insn (reg, SET_SRC (single_set (del)));
+
+ for (ptr = smexpr->antic_stores; ptr; ptr = XEXP (ptr, 1))
+ if (XEXP (ptr, 0) == del)
+ {
+ XEXP (ptr, 0) = insn;
+ break;
+ }
+
+ /* Move the notes from the deleted insn to its replacement. */
+ REG_NOTES (insn) = REG_NOTES (del);
+
+ /* Emit the insn AFTER all the notes are transferred.
+ This is cheaper since we avoid df rescanning for the note change. */
+ insn = emit_insn_after (insn, del);
+
+ if (dump_file)
+ {
+ fprintf (dump_file,
+ "STORE_MOTION delete insn in BB %d:\n ", bb->index);
+ print_inline_rtx (dump_file, del, 6);
+ fprintf (dump_file, "\nSTORE_MOTION replaced with insn:\n ");
+ print_inline_rtx (dump_file, insn, 6);
+ fprintf (dump_file, "\n");
+ }
+
+ delete_insn (del);
+
+ /* Now we must handle REG_EQUAL notes whose contents is equal to the mem;
+ they are no longer accurate provided that they are reached by this
+ definition, so drop them. */
+ for (; insn != NEXT_INSN (BB_END (bb)); insn = NEXT_INSN (insn))
+ if (INSN_P (insn))
+ {
+ set = single_set (insn);
+ if (!set)
+ continue;
+ if (exp_equiv_p (SET_DEST (set), mem, 0, true))
+ return;
+ note = find_reg_equal_equiv_note (insn);
+ if (!note || !exp_equiv_p (XEXP (note, 0), mem, 0, true))
+ continue;
+
+ if (dump_file)
+ fprintf (dump_file, "STORE_MOTION drop REG_EQUAL note at insn %d:\n",
+ INSN_UID (insn));
+ remove_note (insn, note);
+ }
+ remove_reachable_equiv_notes (bb, smexpr);
+}
+
+
+/* Delete a store, but copy the value that would have been stored into
+ the reaching_reg for later storing. */
+
+static void
+delete_store (struct st_expr * expr, basic_block bb)
+{
+ rtx reg, i, del;
+
+ if (expr->reaching_reg == NULL_RTX)
+ expr->reaching_reg = gen_reg_rtx_and_attrs (expr->pattern);
+
+ reg = expr->reaching_reg;
+
+ for (i = expr->avail_stores; i; i = XEXP (i, 1))
+ {
+ del = XEXP (i, 0);
+ if (BLOCK_FOR_INSN (del) == bb)
+ {
+ /* We know there is only one since we deleted redundant
+ ones during the available computation. */
+ replace_store_insn (reg, del, bb, expr);
+ break;
+ }
+ }
+}
+
+/* Fill in available, anticipatable, transparent and kill vectors in
+ STORE_DATA, based on lists of available and anticipatable stores. */
+static void
+build_store_vectors (void)
+{
+ basic_block bb;
+ int *regs_set_in_block;
+ rtx insn, st;
+ struct st_expr * ptr;
+ unsigned int max_gcse_regno = max_reg_num ();
+
+ /* Build the gen_vector. This is any store in the table which is not killed
+ by aliasing later in its block. */
+ st_avloc = sbitmap_vector_alloc (last_basic_block, num_stores);
+ sbitmap_vector_zero (st_avloc, last_basic_block);
+
+ st_antloc = sbitmap_vector_alloc (last_basic_block, num_stores);
+ sbitmap_vector_zero (st_antloc, last_basic_block);
+
+ for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
+ {
+ for (st = ptr->avail_stores; st != NULL; st = XEXP (st, 1))
+ {
+ insn = XEXP (st, 0);
+ bb = BLOCK_FOR_INSN (insn);
+
+ /* If we've already seen an available expression in this block,
+ we can delete this one (It occurs earlier in the block). We'll
+ copy the SRC expression to an unused register in case there
+ are any side effects. */
+ if (TEST_BIT (st_avloc[bb->index], ptr->index))
+ {
+ rtx r = gen_reg_rtx_and_attrs (ptr->pattern);
+ if (dump_file)
+ fprintf (dump_file, "Removing redundant store:\n");
+ replace_store_insn (r, XEXP (st, 0), bb, ptr);
+ continue;
+ }
+ SET_BIT (st_avloc[bb->index], ptr->index);
+ }
+
+ for (st = ptr->antic_stores; st != NULL; st = XEXP (st, 1))
+ {
+ insn = XEXP (st, 0);
+ bb = BLOCK_FOR_INSN (insn);
+ SET_BIT (st_antloc[bb->index], ptr->index);
+ }
+ }
+
+ st_kill = sbitmap_vector_alloc (last_basic_block, num_stores);
+ sbitmap_vector_zero (st_kill, last_basic_block);
+
+ st_transp = sbitmap_vector_alloc (last_basic_block, num_stores);
+ sbitmap_vector_zero (st_transp, last_basic_block);
+ regs_set_in_block = XNEWVEC (int, max_gcse_regno);
+
+ FOR_EACH_BB (bb)
+ {
+ FOR_BB_INSNS (bb, insn)
+ if (INSN_P (insn))
+ {
+ df_ref *def_rec;
+ for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
+ {
+ unsigned int ref_regno = DF_REF_REGNO (*def_rec);
+ if (ref_regno < max_gcse_regno)
+ regs_set_in_block[DF_REF_REGNO (*def_rec)] = 1;
+ }
+ }
+
+ for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
+ {
+ if (store_killed_after (ptr->pattern, ptr->pattern_regs, BB_HEAD (bb),
+ bb, regs_set_in_block, NULL))
+ {
+ /* It should not be necessary to consider the expression
+ killed if it is both anticipatable and available. */
+ if (!TEST_BIT (st_antloc[bb->index], ptr->index)
+ || !TEST_BIT (st_avloc[bb->index], ptr->index))
+ SET_BIT (st_kill[bb->index], ptr->index);
+ }
+ else
+ SET_BIT (st_transp[bb->index], ptr->index);
+ }
+ }
+
+ free (regs_set_in_block);
+
+ if (dump_file)
+ {
+ dump_sbitmap_vector (dump_file, "st_antloc", "", st_antloc, last_basic_block);
+ dump_sbitmap_vector (dump_file, "st_kill", "", st_kill, last_basic_block);
+ dump_sbitmap_vector (dump_file, "st_transp", "", st_transp, last_basic_block);
+ dump_sbitmap_vector (dump_file, "st_avloc", "", st_avloc, last_basic_block);
+ }
+}
+
+/* Free memory used by store motion. */
+
+static void
+free_store_memory (void)
+{
+ free_store_motion_mems ();
+
+ if (st_avloc)
+ sbitmap_vector_free (st_avloc);
+ if (st_kill)
+ sbitmap_vector_free (st_kill);
+ if (st_transp)
+ sbitmap_vector_free (st_transp);
+ if (st_antloc)
+ sbitmap_vector_free (st_antloc);
+ if (st_insert_map)
+ sbitmap_vector_free (st_insert_map);
+ if (st_delete_map)
+ sbitmap_vector_free (st_delete_map);
+
+ st_avloc = st_kill = st_transp = st_antloc = NULL;
+ st_insert_map = st_delete_map = NULL;
+}
+
+/* Perform store motion. Much like gcse, except we move expressions the
+ other way by looking at the flowgraph in reverse.
+ Return non-zero if transformations are performed by the pass. */
+
+static int
+one_store_motion_pass (void)
+{
+ basic_block bb;
+ int x;
+ struct st_expr * ptr;
+ int did_edge_inserts = 0;
+ int n_stores_deleted = 0;
+ int n_stores_created = 0;
+
+ init_alias_analysis ();
+
+ /* Find all the available and anticipatable stores. */
+ num_stores = compute_store_table ();
+ if (num_stores == 0)
+ {
+ htab_delete (store_motion_mems_table);
+ store_motion_mems_table = NULL;
+ end_alias_analysis ();
+ return 0;
+ }
+
+ /* Now compute kill & transp vectors. */
+ build_store_vectors ();
+ add_noreturn_fake_exit_edges ();
+ connect_infinite_loops_to_exit ();
+
+ edge_list = pre_edge_rev_lcm (num_stores, st_transp, st_avloc,
+ st_antloc, st_kill, &st_insert_map,
+ &st_delete_map);
+
+ /* Now we want to insert the new stores which are going to be needed. */
+ for (ptr = first_st_expr (); ptr != NULL; ptr = next_st_expr (ptr))
+ {
+ /* If any of the edges we have above are abnormal, we can't move this
+ store. */
+ for (x = NUM_EDGES (edge_list) - 1; x >= 0; x--)
+ if (TEST_BIT (st_insert_map[x], ptr->index)
+ && (INDEX_EDGE (edge_list, x)->flags & EDGE_ABNORMAL))
+ break;
+
+ if (x >= 0)
+ {
+ if (dump_file != NULL)
+ fprintf (dump_file,
+ "Can't replace store %d: abnormal edge from %d to %d\n",
+ ptr->index, INDEX_EDGE (edge_list, x)->src->index,
+ INDEX_EDGE (edge_list, x)->dest->index);
+ continue;
+ }
+
+ /* Now we want to insert the new stores which are going to be needed. */
+
+ FOR_EACH_BB (bb)
+ if (TEST_BIT (st_delete_map[bb->index], ptr->index))
+ {
+ delete_store (ptr, bb);
+ n_stores_deleted++;
+ }
+
+ for (x = 0; x < NUM_EDGES (edge_list); x++)
+ if (TEST_BIT (st_insert_map[x], ptr->index))
+ {
+ did_edge_inserts |= insert_store (ptr, INDEX_EDGE (edge_list, x));
+ n_stores_created++;
+ }
+ }
+
+ if (did_edge_inserts)
+ commit_edge_insertions ();
+
+ free_store_memory ();
+ free_edge_list (edge_list);
+ remove_fake_exit_edges ();
+ end_alias_analysis ();
+
+ if (dump_file)
+ {
+ fprintf (dump_file, "STORE_MOTION of %s, %d basic blocks, ",
+ current_function_name (), n_basic_blocks);
+ fprintf (dump_file, "%d insns deleted, %d insns created\n",
+ n_stores_deleted, n_stores_created);
+ }
+
+ return (n_stores_deleted > 0 || n_stores_created > 0);
+}
+
+
+static bool
+gate_rtl_store_motion (void)
+{
+ return optimize > 0 && flag_gcse_sm
+ && !cfun->calls_setjmp
+ && optimize_function_for_speed_p (cfun)
+ && dbg_cnt (store_motion);
+}
+
+static unsigned int
+execute_rtl_store_motion (void)
+{
+ delete_unreachable_blocks ();
+ df_note_add_problem ();
+ df_analyze ();
+ flag_rerun_cse_after_global_opts |= one_store_motion_pass ();
+ return 0;
+}
+
+struct rtl_opt_pass pass_rtl_store_motion =
+{
+ {
+ RTL_PASS,
+ "store_motion", /* name */
+ gate_rtl_store_motion, /* gate */
+ execute_rtl_store_motion, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_LSM, /* tv_id */
+ PROP_cfglayout, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_df_finish | TODO_verify_rtl_sharing |
+ TODO_dump_func |
+ TODO_verify_flow | TODO_ggc_collect /* todo_flags_finish */
+ }
+};
+
diff --git a/gcc/system.h b/gcc/system.h
index 80bfe619c3d..223a9dd01b4 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -681,7 +681,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
MUST_PASS_IN_STACK FUNCTION_ARG_PASS_BY_REFERENCE \
VECTOR_MODE_SUPPORTED_P TARGET_SUPPORTS_HIDDEN \
FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \
- ALLOCATE_INITIAL_VALUE
+ ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS
/* Other obsolete target macros, or macros that used to be in target
headers and were not used, and may be obsolete or may never have
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 7ff4ed624ea..0039f9a438f 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -480,11 +480,13 @@
/* In hooks.c. */
#define TARGET_CANNOT_MODIFY_JUMPS_P hook_bool_void_false
-#define TARGET_BRANCH_TARGET_REGISTER_CLASS hook_int_void_no_regs
+#define TARGET_BRANCH_TARGET_REGISTER_CLASS \
+ default_branch_target_register_class
#define TARGET_BRANCH_TARGET_REGISTER_CALLEE_SAVED hook_bool_bool_false
#define TARGET_CANNOT_FORCE_CONST_MEM hook_bool_rtx_false
#define TARGET_CANNOT_COPY_INSN_P NULL
#define TARGET_COMMUTATIVE_P hook_bool_const_rtx_commutative_p
+#define TARGET_LEGITIMIZE_ADDRESS default_legitimize_address
#define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity
#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_false
#define TARGET_MIN_ANCHOR_OFFSET 0
@@ -868,6 +870,7 @@
TARGET_CANNOT_FORCE_CONST_MEM, \
TARGET_CANNOT_COPY_INSN_P, \
TARGET_COMMUTATIVE_P, \
+ TARGET_LEGITIMIZE_ADDRESS, \
TARGET_DELEGITIMIZE_ADDRESS, \
TARGET_USE_BLOCKS_FOR_CONSTANT_P, \
TARGET_MIN_ANCHOR_OFFSET, \
diff --git a/gcc/target.h b/gcc/target.h
index ed08a09853a..63fab54c42e 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -586,7 +586,7 @@ struct gcc_target
/* Return a register class for which branch target register
optimizations should be applied. */
- int (* branch_target_register_class) (void);
+ enum reg_class (* branch_target_register_class) (void);
/* Return true if branch target register optimizations should include
callee-saved registers that are not already live during the current
@@ -603,6 +603,10 @@ struct gcc_target
/* True if X is considered to be commutative. */
bool (* commutative_p) (const_rtx, int);
+ /* Given an invalid address X for a given machine mode, try machine-specific
+ ways to make it legitimate. Return X or an invalid address on failure. */
+ rtx (* legitimize_address) (rtx, rtx, enum machine_mode);
+
/* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */
rtx (* delegitimize_address) (rtx);
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index c0bcac0d054..1dd6c7c6de8 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -112,6 +112,13 @@ default_return_in_memory (const_tree type,
}
rtx
+default_legitimize_address (rtx x, rtx orig_x ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+ return x;
+}
+
+rtx
default_expand_builtin_saveregs (void)
{
error ("__builtin_saveregs not supported by this target");
@@ -576,6 +583,12 @@ default_internal_arg_pointer (void)
return virtual_incoming_args_rtx;
}
+enum reg_class
+default_branch_target_register_class (void)
+{
+ return NO_REGS;
+}
+
#ifdef IRA_COVER_CLASSES
const enum reg_class *
default_ira_cover_classes (void)
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 63d419f819a..19b78cbca33 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -19,6 +19,7 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
extern void default_external_libcall (rtx);
+extern rtx default_legitimize_address (rtx, rtx, enum machine_mode);
extern int default_unspec_may_trap_p (const_rtx, unsigned);
@@ -89,6 +90,7 @@ extern const char *hook_invalid_arg_for_unprototyped_fn
extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
extern rtx default_function_value (const_tree, const_tree, bool);
extern rtx default_internal_arg_pointer (void);
+extern enum reg_class default_branch_target_register_class (void);
#ifdef IRA_COVER_CLASSES
extern const enum reg_class *default_ira_cover_classes (void);
#endif
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b5beac223bf..3099e1bded6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,701 @@
+2009-05-08 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR tree-optimization/40049
+ * gcc.dg/vect/vect-shift-2.c: New test.
+
+2009-05-08 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/torture/complex-sign-mul-minus-one.c,
+ gcc.dg/torture/complex-sign-mul-one.c: New tests.
+
+2009-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c/36892
+ * g++.dg/warn/deprecated-6.C: New.
+ * gcc.dg/deprecated-4.c: Likewise.
+ * gcc.dg/deprecated-5.c: Likewise.
+ * gcc.dg/deprecated-6.c: Likewise.
+
+2009-05-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.dg/vect/no-vfa-vect-37.c: Replace __aligned__(16) with
+ __aligned__(__BIGGEST_ALIGNMENT__).
+ * gcc.dg/vect/no-vfa-vect-43.c: Likewise.
+ * gcc.dg/vect/no-vfa-vect-49.c: Likewise.
+ * gcc.dg/vect/no-vfa-vect-53.c: Likewise.
+ * gcc.dg/vect/no-vfa-vect-57.c: Likewise.
+ * gcc.dg/vect/no-vfa-vect-61.c: Likewise.
+ * gcc.dg/vect/no-vfa-vect-79.c: Likewise.
+ * gcc.dg/vect/Os-vect-95.c: Likewise.
+ * gcc.dg/vect/pr20122.c: Likewise.
+ * gcc.dg/vect/pr36493.c: Likewise.
+ * gcc.dg/vect/pr37385.c: Likewise.
+ * gcc.dg/vect/slp-7.c: Likewise.
+ * gcc.dg/vect/slp-9.c: Likewise.
+ * gcc.dg/vect/slp-widen-mult-s16.c: Likewise.
+ * gcc.dg/vect/slp-widen-mult-u8.c: Likewise.
+ * gcc.dg/vect/vect-35.c: Likewise.
+ * gcc.dg/vect/vect-40.c: Likewise.
+ * gcc.dg/vect/vect-42.c: Likewise.
+ * gcc.dg/vect/vect-44.c: Likewise.
+ * gcc.dg/vect/vect-46.c: Likewise.
+ * gcc.dg/vect/vect-48.c: Likewise.
+ * gcc.dg/vect/vect-52.c: Likewise.
+ * gcc.dg/vect/vect-54.c: Likewise.
+ * gcc.dg/vect/vect-56.c: Likewise.
+ * gcc.dg/vect/vect-58.c: Likewise.
+ * gcc.dg/vect/vect-60.c: Likewise.
+ * gcc.dg/vect/vect-74.c: Likewise.
+ * gcc.dg/vect/vect-75.c: Likewise.
+ * gcc.dg/vect/vect-76.c: Likewise.
+ * gcc.dg/vect/vect-77-alignchecks.c: Likewise.
+ * gcc.dg/vect/vect-77.c: Likewise.
+ * gcc.dg/vect/vect-77-global.c: Likewise.
+ * gcc.dg/vect/vect-78-alignchecks.c: Likewise.
+ * gcc.dg/vect/vect-78.c: Likewise.
+ * gcc.dg/vect/vect-78-global.c: Likewise.
+ * gcc.dg/vect/vect-80.c: Likewise.
+ * gcc.dg/vect/vect-85.c: Likewise.
+ * gcc.dg/vect/vect-87.c: Likewise.
+ * gcc.dg/vect/vect-88.c: Likewise.
+ * gcc.dg/vect/vect-92.c: Likewise.
+ * gcc.dg/vect/vect-93.c: Likewise.
+ * gcc.dg/vect/vect-95.c: Likewise.
+ * gcc.dg/vect/vect-97.c: Likewise.
+ * gcc.dg/vect/vect-complex-1.c: Likewise.
+ * gcc.dg/vect/vect-complex-4.c: Likewise.
+ * gcc.dg/vect/vect-complex-5.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-10.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-11.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-12.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-13.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-14.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-15.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-16.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-17.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-3.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-6.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-7.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-8.c: Likewise.
+ * gcc.dg/vect/vect-multitypes-9.c: Likewise.
+ * gcc.dg/vect/vect-outer-1a.c: Likewise.
+ * gcc.dg/vect/vect-outer-1.c: Likewise.
+ * gcc.dg/vect/vect-outer-2a.c: Likewise.
+ * gcc.dg/vect/vect-outer-2b.c: Likewise.
+ * gcc.dg/vect/vect-outer-2.c: Likewise.
+ * gcc.dg/vect/vect-outer-2c.c: Likewise.
+ * gcc.dg/vect/vect-outer-2d.c: Likewise.
+ * gcc.dg/vect/vect-outer-3a.c: Likewise.
+ * gcc.dg/vect/vect-outer-3b.c: Likewise.
+ * gcc.dg/vect/vect-outer-3.c: Likewise.
+ * gcc.dg/vect/vect-outer-3c.c: Likewise.
+ * gcc.dg/vect/vect-outer-5.c: Likewise.
+ * gcc.dg/vect/vect-outer-6.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-s16a.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-s16b.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-s8a.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-s8b.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-s8c.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-u16a.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-u16b.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-u8a.c: Likewise.
+ * gcc.dg/vect/vect-reduc-dot-u8b.c: Likewise.
+ * gcc.dg/vect/vect-widen-mult-s16.c: Likewise.
+ * gcc.dg/vect/vect-widen-mult-s8.c: Likewise.
+ * gcc.dg/vect/vect-widen-mult-u16.c: Likewise.
+ * gcc.dg/vect/vect-widen-mult-u8.c: Likewise.
+ * gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c: Likewise.
+
+2009-05-08 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/24581
+ * gcc.dg/torture/complex-sign.h: New header.
+ * gcc.dg/torture/complex-sign-add.c,
+ gcc.dg/torture/complex-sign-mixed-add.c,
+ gcc.dg/torture/complex-sign-mixed-div.c,
+ gcc.dg/torture/complex-sign-mixed-mul.c,
+ gcc.dg/torture/complex-sign-mixed-sub.c,
+ gcc.dg/torture/complex-sign-mul.c,
+ gcc.dg/torture/complex-sign-sub.c: New tests.
+
+2009-05-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39876
+ * gfortran.dg/intrinsic_3.f90: New.
+
+2009-05-07 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/39037
+ * gcc.dg/Wunsuffixed-float-constants-1.c: New test.
+ * gcc.dg/cpp/pragma-float-const-decimal64-1.c: New test.
+ * gcc.dg/dfp/float-constant-double.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-1.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-2.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-3.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-4.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-5.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-6.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-7.c: New test.
+ * gcc.dg/dfp/pragma-float-const-decimal64-8.c: New test.
+ * g++.dg/cpp/pragma-float-const-decimal64-1.C: New test.
+
+2009-05-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/40057
+ * gcc.c-torture/execute/pr40057.c: New test.
+
+2009-05-06 James E. Wilson <wilson@codesourcery.com>
+
+ * gcc.c-torture/compile/const-high-part.c: New test.
+
+2009-05-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR testsuite/40050
+ * lib/plugin-support.exp (plugin-test-execute): Use HOSTCC to
+ build plugin.
+
+2009-05-06 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39630
+ * gfortran.dg/proc_decl_1.f90: Modified.
+ * gfortran.dg/proc_ptr_comp_1.f90: New.
+ * gfortran.dg/proc_ptr_comp_2.f90: New.
+ * gfortran.dg/proc_ptr_comp_3.f90: New.
+ * gfortran.dg/proc_ptr_comp_4.f90: New.
+ * gfortran.dg/proc_ptr_comp_5.f90: New.
+ * gfortran.dg/proc_ptr_comp_6.f90: New.
+
+2009-05-06 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/17395
+ * g++.dg/template/call7.C: New test.
+
+2009-05-06 Diego Novillo <dnovillo@google.com>
+
+ * lib/plugin-support.exp: Do not prefix $GMPINC with -I.
+
+2009-05-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gfortran.dg/pr40021.f: Moved to ...
+ * gfortran.fortran-torture/execute/pr40021.f: Here.
+
+2009-05-06 Janis Johnson <janis187@us.ibm.com>
+
+ PR middle-end/39986
+ * gcc.dg/dfp/pr39986.c: New test.
+
+2009-05-06 Michael Matz <matz@suse.de>
+
+ PR middle-end/40021
+ * gfortran.dg/pr40021.f: New test.
+
+2009-05-06 Le-Chun Wu <lcwu@google.com>
+
+ * lib/plugin-support.exp: New file containing support procs for
+ plugin testcases.
+ * lib/target-supports.exp (check_plugin_available): New proc.
+ * gcc.dg/plugin/plugin.exp: New driver script for gcc testcases.
+ * gcc.dg/plugin/selfassign.c: New plugin source file.
+ * gcc.dg/plugin/self-assign-test-1.c: New test.
+ * gcc.dg/plugin/self-assign-test-2.c: Likewise.
+ * g++.dg/README: Add description for plugin test.
+ * g++.dg/dg.exp: Exclude plugin tests from the general test list.
+ * g++.dg/plugin/plugin.exp: New driver script for g++ testcases.
+ * g++.dg/plugin/selfassign.c: New plugin source file.
+ * g++.dg/plugin/self-assign-test-1.C: New test.
+ * g++.dg/plugin/self-assign-test-2.C: Likewise.
+ * g++.dg/plugin/self-assign-test-3.C: Likewise.
+ * g++.dg/plugin/dumb_plugin.c: New plugin source file.
+ * g++.dg/plugin/dumb-plugin-test-1.C: New test.
+
+2009-05-06 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40041
+ * gfortran.dg/intrinsic_2.f90: New test.
+ * gfortran.dg/intrinsic.f90: Add old and this PR as comment.
+
+2009-05-06 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/40032
+ * gcc.dg/noncompile/incomplete-5.c: New test.
+
+2009-05-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/39666
+ * gcc.dg/pr39666-1.c: New test.
+ * gcc.dg/pr39666-2.c: Likewise.
+ * g++.dg/warn/Wuninitialized-4.C: Likewise.
+ * g++.dg/warn/Wuninitialized-5.C: Likewise.
+ * gfortran.dg/pr39666-1.f90: Likewise.
+ * gfortran.dg/pr39666-2.f90: Likewise.
+
+2009-05-05 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/mips.exp: Add -mtune= to mips_option_groups.
+ * gcc.target/mips/dspr2-MULT.c: Pass -mtune=74kc
+ * gcc.target/mips/dspr2-MULTU.c: Likewise.
+
+2009-05-05 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39998
+ * gfortran.dg/proc_ptr_17.f90: New.
+
+2009-05-05 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40022
+ * gcc.c-torture/execute/pr40022.c: New testcase.
+
+2009-05-05 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40023
+ * gcc.c-torture/compile/pr40023.c: New testcase.
+
+2009-05-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old-deja/g++.other/overload11.C: Adjust expected errors.
+ * g++.dg/template/overload9.C: Likewise.
+ * g++.dg/ext/ms-1.C: New.
+
+2009-05-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/40013
+ * g++.dg/ext/vla7.C: New test.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/ucnid-11.c, gcc.dg/ucnid-12.c, gcc.dg/ucnid-13.c: New tests.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/ucnid-8.c, gcc.dg/ucnid-9.c, gcc.dg/ucnid-10.c: New tests.
+ * gcc.dg/declspec-9.c, gcc.dg/declspec-10.c, gcc.dg/declspec-11.c:
+ Update expected errors.
+
+2009-05-04 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR c++/28152
+ * g++.dg/parse/parser-pr28152.C: New.
+ * g++.dg/parse/parser-pr28152-2.C: New.
+
+2009-05-04 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/attr-alias-5.c, gcc.dg/ucnid-7.c: New tests.
+
+2009-05-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.target/sparc/fpmul-2.c: Replace final_cleanup with optimized.
+ * gcc.target/sparc/fexpand-2.c: Likewise.
+ * gcc.target/sparc/fpmerge-2.c: Likewise.
+ * gcc.target/sparc/pdist-2.c: Likewise.
+
+2009-05-03 Richard Guenther <rguenther@suse.de>
+
+ PR c/39983
+ * gcc.c-torture/compile/pr39983.c: New testcase.
+
+2009-05-03 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c99-complex-3.c: New test.
+
+2009-05-03 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/cpp/utf8-5byte-1.c: New test.
+
+2009-05-02 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/ucnid-6.c: Fix typo in dg-do directive.
+
+2009-05-02 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40001
+ * gcc.target/spu/pr40001.c: New testcase.
+
+2009-04-30 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.dg/ssp-1.c (__stack_chk_fail): Remove static.
+
+2009-04-30 Steve Ellcey <sje@cup.hp.com>
+
+ PR middle-end/39579
+ * gcc.dg/vect/vect-35.c: XFAIL for IA64 and Sparc.
+ * gfortran.dg/vect/fast-math-pr38968.f90: Ditto.
+
+2009-04-30 Janis Johnson <janis187@us.ibm.com>
+
+ PR testsuite/39776
+ * g++.dg/ext/altivec-15.C: Remove dg-error for messages that are
+ no longer issued.
+
+2009-04-30 David Ayers <ayers@fsfe.org>
+
+ * lib/objc.exp (objc_init): Add and set gcc_warning_prefix
+ and gcc_error_prefix variables.
+ * objc.dg/bad-receiver-type.m: Update to match correct
+ diagnostics marker.
+ * objc.dg/encode-5.m: Likewise.
+ * objc.dg/id-1.m: Likewise.
+ * objc.dg/method-1.m: Likewise.
+ * objc.dg/method-6.m: Likewise.
+ * objc.dg/method-7.m: Likewise.
+ * objc.dg/method-9.m: Likewise.
+ * objc.dg/method-11.m: Likewise.
+ * objc.dg/method-20.m: Likewise.
+ * objc.dg/private-1.m: Likewise.
+
+2009-04-30 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/39667
+ * gfortran.dg/advance_1.f90: Don't require target fd_truncate.
+ * gfortran.dg/advance_4.f90: Likewise
+ * gfortran.dg/advance_5.f90: Likewise
+ * gfortran.dg/append_1.f90: Likewise
+ * gfortran.dg/backslash_1.f90: Likewise
+ * gfortran.dg/backslash_2.f90: Likewise
+ * gfortran.dg/backslash_3.f: Likewise
+ * gfortran.dg/backspace_10.f90: Likewise
+ * gfortran.dg/backspace_3.f: Likewise
+ * gfortran.dg/backspace_4.f: Likewise
+ * gfortran.dg/backspace_5.f: Likewise
+ * gfortran.dg/backspace_8.f: Likewise
+ * gfortran.dg/backspace_9.f: Likewise
+ * gfortran.dg/complex_write.f90: Likewise
+ * gfortran.dg/convert_implied_open.f90: Likewise
+ * gfortran.dg/dollar_edit_descriptor_1.f: Likewise
+ * gfortran.dg/dos_eol.f: Likewise
+ * gfortran.dg/empty_format_1.f90: Likewise
+ * gfortran.dg/endfile.f: Likewise
+ * gfortran.dg/eof_1.f90: Likewise
+ * gfortran.dg/eor_1.f90: Likewise
+ * gfortran.dg/eor_handling_1.f90: Likewise
+ * gfortran.dg/eor_handling_2.f90: Likewise
+ * gfortran.dg/eor_handling_3.f90: Likewise
+ * gfortran.dg/eor_handling_4.f90: Likewise
+ * gfortran.dg/eor_handling_5.f90: Likewise
+ * gfortran.dg/error_recovery_5.f90: Likewise
+ * gfortran.dg/f2003_inquire_1.f03: Likewise
+ * gfortran.dg/f2003_io_4.f03: Likewise
+ * gfortran.dg/f2003_io_5.f03: Likewise
+ * gfortran.dg/f2003_io_7.f03: Likewise
+ * gfortran.dg/fgetc_1.f90: Likewise
+ * gfortran.dg/fgetc_2.f90: Likewise
+ * gfortran.dg/flush_1.f90: Likewise
+ * gfortran.dg/fmt_exhaust.f90: Likewise
+ * gfortran.dg/fmt_huge.f90: Likewise
+ * gfortran.dg/fmt_read.f90: Likewise
+ * gfortran.dg/fmt_t_1.f90: Likewise
+ * gfortran.dg/fmt_t_2.f90: Likewise
+ * gfortran.dg/fmt_t_3.f90: Likewise
+ * gfortran.dg/fmt_t_4.f90: Likewise
+ * gfortran.dg/fmt_t_5.f90: Likewise
+ * gfortran.dg/fmt_t_7.f: Likewise
+ * gfortran.dg/fseek.f90: Likewise
+ * gfortran.dg/ftell_1.f90: Likewise
+ * gfortran.dg/ftell_2.f90: Likewise
+ * gfortran.dg/func_derived_3.f90: Likewise
+ * gfortran.dg/inquire_9.f90: Likewise
+ * gfortran.dg/iostat_1.f90: Likewise
+ * gfortran.dg/iostat_2.f90: Likewise
+ * gfortran.dg/list_read_1.f90: Likewise
+ * gfortran.dg/list_read_4.f90: Likewise
+ * gfortran.dg/list_read_5.f90: Likewise
+ * gfortran.dg/list_read_7.f90: Likewise
+ * gfortran.dg/list_read_8.f90: Likewise
+ * gfortran.dg/list_read_9.f90: Likewise
+ * gfortran.dg/namelist_13.f90: Likewise
+ * gfortran.dg/namelist_14.f90: Likewise
+ * gfortran.dg/namelist_15.f90: Likewise
+ * gfortran.dg/namelist_16.f90: Likewise
+ * gfortran.dg/namelist_17.f90: Likewise
+ * gfortran.dg/namelist_18.f90: Likewise
+ * gfortran.dg/namelist_19.f90: Likewise
+ * gfortran.dg/namelist_20.f90: Likewise
+ * gfortran.dg/namelist_24.f90: Likewise
+ * gfortran.dg/namelist_26.f90: Likewise
+ * gfortran.dg/namelist_27.f90: Likewise
+ * gfortran.dg/namelist_28.f90: Likewise
+ * gfortran.dg/namelist_37.f90: Likewise
+ * gfortran.dg/namelist_38.f90: Likewise
+ * gfortran.dg/namelist_39.f90: Likewise
+ * gfortran.dg/namelist_40.f90: Likewise
+ * gfortran.dg/namelist_43.f90: Likewise
+ * gfortran.dg/namelist_44.f90: Likewise
+ * gfortran.dg/namelist_45.f90: Likewise
+ * gfortran.dg/namelist_46.f90: Likewise
+ * gfortran.dg/namelist_47.f90: Likewise
+ * gfortran.dg/namelist_48.f90: Likewise
+ * gfortran.dg/namelist_49.f90: Likewise
+ * gfortran.dg/namelist_50.f90: Likewise
+ * gfortran.dg/namelist_51.f90: Likewise
+ * gfortran.dg/namelist_52.f90: Likewise
+ * gfortran.dg/namelist_56.f90: Likewise
+ * gfortran.dg/namelist_char_only.f90: Likewise
+ * gfortran.dg/namelist_use.f90: Likewise
+ * gfortran.dg/namelist_use_only.f90: Likewise
+ * gfortran.dg/noadv_size.f90: Likewise
+ * gfortran.dg/open_access_append_1.f90: Likewise
+ * gfortran.dg/pad_no.f90: Likewise
+ * gfortran.dg/pr12884.f: Likewise
+ * gfortran.dg/pr17090.f90: Likewise
+ * gfortran.dg/pr17285.f90: Likewise
+ * gfortran.dg/pr17286.f90: Likewise
+ * gfortran.dg/pr18122.f90: Likewise
+ * gfortran.dg/pr18210.f90: Likewise
+ * gfortran.dg/pr18392.f90: Likewise
+ * gfortran.dg/pr19155.f: Likewise
+ * gfortran.dg/pr19216.f: Likewise
+ * gfortran.dg/pr19467.f90: Likewise
+ * gfortran.dg/pr19657.f: Likewise
+ * gfortran.dg/pr20257.f90: Likewise
+ * gfortran.dg/read_bad_advance.f90: Likewise
+ * gfortran.dg/read_eof_2.f90: Likewise
+ * gfortran.dg/read_eof_4.f90: Likewise
+ * gfortran.dg/read_many_1.f: Likewise
+ * gfortran.dg/read_noadvance.f90: Likewise
+ * gfortran.dg/read_repeat.f90: Likewise
+ * gfortran.dg/read_size_noadvance.f90: Likewise
+ * gfortran.dg/read_x_past.f: Likewise
+ * gfortran.dg/record_marker_1.f90: Likewise
+ * gfortran.dg/record_marker_3.f90: Likewise
+ * gfortran.dg/rewind_1.f90: Likewise
+ * gfortran.dg/runtime_warning_1.f90: Likewise
+ * gfortran.dg/shape_3.f90: Likewise
+ * gfortran.dg/slash_1.f90: Likewise
+ * gfortran.dg/stat_1.f90: Likewise
+ * gfortran.dg/stat_2.f90: Likewise
+ * gfortran.dg/streamio_11.f90: Likewise
+ * gfortran.dg/streamio_3.f90: Likewise
+ * gfortran.dg/streamio_4.f90: Likewise
+ * gfortran.dg/streamio_9.f90: Likewise
+ * gfortran.dg/tl_editing.f90: Likewise
+ * gfortran.dg/unf_io_convert_1.f90: Likewise
+ * gfortran.dg/unf_io_convert_2.f90: Likewise
+ * gfortran.dg/unf_read_corrupted_2.f90: Likewise
+ * gfortran.dg/unf_short_record_1.f90: Likewise
+ * gfortran.dg/utf8_1.f03: Likewise
+ * gfortran.dg/utf8_2.f03: Likewise
+ * gfortran.dg/widechar_IO_1.f90: Likewise
+ * gfortran.dg/write_check3.f90: Likewise
+ * gfortran.dg/write_rewind_2.f: Likewise
+ * gfortran.dg/x_slash_2.f: Likewise
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ PR target/39943
+ * lib/target-supports.exp (check_effective_target_vect_uintfloat_cvt):
+ New.
+ (check_effective_target_vect_floatuint_cvt): Likewise.
+ * gcc.dg/vect/slp-10.c: Adjust.
+ * gcc.dg/vect/slp-11.c: Adjust.
+ * gcc.dg/vect/slp-12b.c: Adjust.
+ * gcc.dg/vect/slp-33.c: Adjust.
+ * gcc.c-torture/compile/pr39943.c: New testcase.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/39937
+ * gcc.c-torture/compile/pr39937.c: New testcase.
+
+2009-04-29 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/39941
+ * gcc.c-torture/compile/pr39941.c: New testcase.
+
+2009-04-29 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * gcc.target/bfin/20090411-1.c: New test.
+
+2009-04-29 Anmol P. Paralkar <anmol@freescale.com>
+
+ PR target/39565
+ * gcc.dg/pr39565.c: New testcase.
+
+2009-04-28 Nathan Sidwell <nathan@codesourcery.com>
+
+ * gcc.target/i386/sse4_1-roundps-1.c: Skip for vxworks kernel.
+ * gcc.target/i386/sse4_1-roundpd-1.c: Likewise.
+ * gcc.target/i386/sse4_1-roundps-3.c: Likewise.
+ * gcc.target/i386/sse4_1-roundpd-3.c: Likewise.
+ * gcc.target/i386/sse4_1-roundss-1.c: Likewise.
+ * gcc.target/i386/sse4_1-roundsd-1.c: Likewise.
+ * gcc.target/i386/sse4_1-roundss-3.c: Likewise.
+ * gcc.target/i386/sse4_1-roundsd-3.c: Likewise.
+ * gcc.target/i386/sse4_1-roundps-2.c: Likewise.
+ * gcc.target/i386/sse4_1-roundpd-2.c: Likewise.
+ * gcc.target/i386/sse4_1-roundss-2.c: Likewise.
+ * gcc.target/i386/sse4_1-roundsd-2.c: Likewise.
+ * gcc.target/i386/sse4_1-roundss-4.c: Likewise.
+ * gcc.target/i386/sse4_1-roundsd-4.c: Likewise.
+ * gcc.target/i386/pr37191.c: Likewise.
+ * gcc.target/i386/reload-1.c: Likewise.
+ * g++.old-deja/g++.pt/repo1.C: Skip for vxworks kernel.
+ * g++.old-deja/g++.pt/repo2.C: Likewise.
+ * g++.old-deja/g++.pt/repo3.C: Likewise.
+ * g++.old-deja/g++.pt/repo4.C: Likewise.
+ * g++.old-deja/g++.pt/instantiate4.C: Likewise.
+ * g++.old-deja/g++.pt/instantiate6.C: Likewise.
+ * g++.dg/template/repo1.C: Likewise.
+ * g++.dg/template/repo2.C: Likewise.
+ * g++.dg/template/repo3.C: Likewise.
+ * g++.dg/template/repo4.C: Likewise.
+ * g++.dg/template/repo5.C: Likewise.
+ * g++.dg/template/repo6.C: Likewise.
+ * g++.dg/template/repo7.C: Likewise.
+ * g++.dg/template/repo8.C: Likewise.
+ * g++.dg/template/repo9.C: Likewise.
+ * g++.dg/rtti/repo1.C: Likewise.
+ * gcc.dg/cpp/_Pragma6.c: Skip for vxworks.
+ * g++.dg/cpp/_Pragma1.C: Skip for vxworks.
+ * gcc.dg/pthread-init-1.c: Xfail for vxworks rtp.
+ * g++.dg/other/PR23205.C: Skip for vxworks.
+ * g++.dg/ext/visibility/class1.C: Requires PIC.
+ * g++.dg/eh/async-unwind2.C: Requires PIC.
+ * lib/target-supports.exp (check_cxa_atexit_available): Vxworks
+ does not have cxa_exit.
+
+2009-04-28 Jing Yu <jingyu@google.com>
+
+ PR testsuite/39790
+ * lib/target-supports.exp (check_effective_target_tls): Remove
+ comment of caching.
+ (check_effective_target_tls_native): Likewise.
+ (check_effective_target_tls_runtime): Likewise.
+ * gcc.dg/tls/alias-1.c (dg-require-effective-target): Change target
+ tls to tls_runtime.
+ * gcc.dg/tls/opt-2.c: Add dg-require-effective-target tls_runtime.
+
+2009-04-28 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39946
+ * gfortran.dg/proc_ptr_16.f90: New.
+
+2009-04-28 Steve Ellcey <sje@cup.hp.com>
+
+ * testsuite/gcc.target/ia64/sync-1.c: Check for cmpxchg8 only if
+ lp64 is true.
+
+2009-04-28 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/39937
+ * gfortran.fortran-torture/compile/pr39937.f: New testcase.
+
+2009-04-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ * g++.dg/warn/pr35652.C: Removed.
+ * gcc.dg/pr35652.c: Likewise.
+
+2009-04-28 Alexander Monakov <amonakov@ispras.ru>
+
+ * gcc.target/ia64/20071210-2.c: New testcase.
+
+2009-04-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR c/39323
+ * gcc.dg/pr39323-2.c: Also scan for alignment in log2 format.
+ * gcc.dg/pr39323-3.c: Ditto.
+
+2009-04-28 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/39930
+ PR fortran/39931
+ * gfortran.dg/ambiguous_reference_2.f90: New.
+ * gfortran.dg/pointer_assign_7.f90: New.
+
+2009-04-28 Nathan Froyd <froydnj@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ * gcc.target/powerpc/20020118-1.c: Skip on vxworks targets.
+ * gcc.dg/20020103-1.c: Check for __ppc.
+ * gcc.dg/asm-b.c: Check for __ppc.
+ * gcc.dg/20020919-1.c: Check for __ppc.
+ * gcc.dg/20020312-2.c: Likewise.
+ * gcc.dg/trampoline-1.c: Add appropriate NO_TRAMPOLINES #ifndefs.
+ * gcc.dg/torture/asm-subreg-1.c: Skip on sparc vxworks targets.
+ * gcc.dg/attr-weakref-1.c: Skip on selected vxworks targets.
+ * g++.dg/warn/weak1.C: Likewise.
+ * gcc.dg/tree-ssa/20030714-1.c (find_base_value): Declare as
+ static so appropriate optimizations kick in.
+ (find_base_value_wrapper): New function.
+ * g++.dg/eh/simd-5.C: Fix target triplet.
+ * gcc.target/arm/long-calls-1.c: Skip for -mlong-calls.
+
+2009-04-28 Uros Bizjak <ubizjak@gmail.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/39911
+ * gcc.target/i386/pr39911.c: New test.
+
+2009-04-28 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/39879
+ * gfortran.dg/alloc_comp_assign_10.f90: New test.
+
+2009-04-28 Ben Elliston <bje@au.ibm.com>
+
+ PR c++/35652
+ Revert:
+
+ 2009-03-27 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ * gcc.dg/pr35652.C: New.
+ * g++.dg/warn/pr35652.C: New.
+ * gcc.dg/format/plus-1.c: Adjust message.
+
+2009-04-27 DJ Delorie <dj@redhat.com>
+
+ * lib/target-supports.exp (check_effective_target_double64): New.
+ (check_effective_target_double64plus): New.
+ (check_effective_target_large_double): New.
+ * gcc.dg/Wconversion-real-integer.c: Require double64plus.
+ * gcc.dg/div-double-1.c: Likewise.
+ * gcc.dg/Wconversion-real.c: Require large_double.
+ * gcc.dg/cdce1.c: Require large_double instead of checking targets.
+
+ * gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c: Skip if doubles
+ are too small.
+
+ * gcc.c-torture/execute/ieee/20010226-1.c: Mark all floating point
+ constants as long.
+
+2009-04-27 Ian Lance Taylor <iant@google.com>
+
+ * gcc.dg/Wcxx-compat-5.c: New testcase.
+ * gcc.dg/Wcxx-compat-6.c: New testcase.
+
+2009-04-27 Trevor Smigiel <trevor_smigiel@playstation.sony.com>
+
+ Allow non-constant arguments to conversion intrinsics.
+ * gcc.target/spu/intrinsics-3.c: Update tests.
+
+2009-04-27 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/39928
+ * gcc.c-torture/compile/pr39928-1.c: New testcase.
+ * gcc.c-torture/compile/pr39928-2.c: Likewise.
+
+2009-04-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/39903
+ * gcc.dg/torture/pr39903-1.c: New.
+ * gcc.dg/torture/pr39903-2.c: Likewise.
+
+2009-04-27 Revital Eres <eres@il.ibm.com>
+
+ * gcc.dg/sms-1.c: Add noinline attribute, create sms dump file
+ and check it.
+ * gcc.dg/sms-2.c: Add dump check.
+ * gcc.dg/sms-3.c: Add noinline attribute, create sms dump file
+ and check it.
+ * gcc.dg/sms-4.c: Likewise.
+ * gcc.dg/sms-5.c: Likewise.
+ * gcc.dg/sms-6.c: Likewise.
+ * gcc.dg/sms-7.c: Likewise.
+ * gcc.dg/sms-antideps.c: Rename to...
+ * gcc.dg/sms-8.c: This and add sms dump file and check it.
+
+2009-04-27 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt2.adb: New test.
+
2009-04-27 Jakub Jelinek <jakub@redhat.com>
PR c++/39875
diff --git a/gcc/testsuite/g++.dg/README b/gcc/testsuite/g++.dg/README
index c63f7ccf53c..cdf6b14aee6 100644
--- a/gcc/testsuite/g++.dg/README
+++ b/gcc/testsuite/g++.dg/README
@@ -18,6 +18,7 @@ opt Tests for fixes of bugs with particular optimizations.
overload Tests for overload resolution and conversions.
parse Tests for parsing.
pch Tests for precompiled headers.
+plugin Tests for plugin support.
rtti Tests for run-time type identification (typeid, dynamic_cast, etc.)
template Tests for templates.
tc1 Tests for Technical Corrigendum 1 conformance.
diff --git a/gcc/testsuite/g++.dg/cpp/_Pragma1.C b/gcc/testsuite/g++.dg/cpp/_Pragma1.C
index e44709b4570..714d10edb7d 100644
--- a/gcc/testsuite/g++.dg/cpp/_Pragma1.C
+++ b/gcc/testsuite/g++.dg/cpp/_Pragma1.C
@@ -2,7 +2,7 @@
// This is supposed to succeed only if
// the target defines HANDLE_PRAGMA_PACK_PUSH_POP
// and doesn't define HANDLE_PRAGMA_PACK_WITH_EXPANSION.
-// { dg-do compile { target { ! { powerpc-ibm-aix* *-*-solaris2* fido-*-* m68k-*-* sh*-[us]*-elf m32c-*-* } } } }
+// { dg-do compile { target { ! { powerpc-ibm-aix* *-*-solaris2* fido-*-* m68k-*-* sh*-[us]*-elf m32c-*-* *-*-vxworks } } } }
#define push bar
#define foo _Pragma ("pack(push)")
diff --git a/gcc/testsuite/g++.dg/cpp/pragma-float-const-decimal64-1.C b/gcc/testsuite/g++.dg/cpp/pragma-float-const-decimal64-1.C
new file mode 100644
index 00000000000..31e1ad6d507
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp/pragma-float-const-decimal64-1.C
@@ -0,0 +1,5 @@
+// { dg-do compile }
+// { dg-options "-Wunknown-pragmas" }
+
+#pragma STDC FLOAT_CONST_DECIMAL64 ON // { dg-warning "not supported for C\\\+\\\+" }
+double d = 1.0;
diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp
index 86565a98a1e..a19bc2c2b60 100644
--- a/gcc/testsuite/g++.dg/dg.exp
+++ b/gcc/testsuite/g++.dg/dg.exp
@@ -37,6 +37,7 @@ set tests [prune $tests $srcdir/$subdir/compat/*]
set tests [prune $tests $srcdir/$subdir/debug/*]
set tests [prune $tests $srcdir/$subdir/gcov/*]
set tests [prune $tests $srcdir/$subdir/pch/*]
+set tests [prune $tests $srcdir/$subdir/plugin/*]
set tests [prune $tests $srcdir/$subdir/special/*]
set tests [prune $tests $srcdir/$subdir/tls/*]
set tests [prune $tests $srcdir/$subdir/vect/*]
diff --git a/gcc/testsuite/g++.dg/eh/async-unwind2.C b/gcc/testsuite/g++.dg/eh/async-unwind2.C
index 694fad6aca1..0c31f80e5e7 100644
--- a/gcc/testsuite/g++.dg/eh/async-unwind2.C
+++ b/gcc/testsuite/g++.dg/eh/async-unwind2.C
@@ -1,5 +1,6 @@
// PR rtl-optimization/36419
// { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } }
+// { dg-require-effective-target fpic }
// { dg-options "-Os -fasynchronous-unwind-tables -fpic -fno-inline" }
#include <stdarg.h>
diff --git a/gcc/testsuite/g++.dg/eh/simd-5.C b/gcc/testsuite/g++.dg/eh/simd-5.C
index d83d31392c6..71e117ead2a 100644
--- a/gcc/testsuite/g++.dg/eh/simd-5.C
+++ b/gcc/testsuite/g++.dg/eh/simd-5.C
@@ -1,7 +1,7 @@
// Test EH with V2SI SIMD registers actually restores correct values.
// Origin: Joseph Myers <joseph@codesourcery.com>
// { dg-options "-O" }
-// { dg-do run { target powerpc_spe } }
+// { dg-do run { target { powerpc_spe && { ! *-*-vxworks* } } } }
extern "C" void abort (void);
extern "C" int memcmp (const void *, const void *, __SIZE_TYPE__);
diff --git a/gcc/testsuite/g++.dg/ext/altivec-15.C b/gcc/testsuite/g++.dg/ext/altivec-15.C
index c3003489a17..ed1c088ccaa 100644
--- a/gcc/testsuite/g++.dg/ext/altivec-15.C
+++ b/gcc/testsuite/g++.dg/ext/altivec-15.C
@@ -2,12 +2,15 @@
/* { dg-require-effective-target powerpc_altivec_ok } */
/* { dg-options "-maltivec" } */
+/* This test was added for an internal compiler error. The number and
+ content of error messages is irrelevant. */
+
struct SubData
{
inline const Float Clamp(Float f, Float f0, Float f1) // { dg-error "" }
}
inline const void SinCos(Float angle, Float& sine, Float& cosine) // { dg-error "" }
{
- C0 = __builtin_vec_splat(_simdCosEstCoefficients, 0); // { dg-error "" }
- C1 = __builtin_vec_splat(_simdCosEstCoefficients, 1); // { dg-error "" }
+ C0 = __builtin_vec_splat(_simdCosEstCoefficients, 0);
+ C1 = __builtin_vec_splat(_simdCosEstCoefficients, 1);
diff --git a/gcc/testsuite/g++.dg/ext/ms-1.C b/gcc/testsuite/g++.dg/ext/ms-1.C
new file mode 100644
index 00000000000..dcd1d0466ef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/ms-1.C
@@ -0,0 +1,17 @@
+
+// MS allows more things to be pointers to member functions
+// { dg-options "-fms-extensions" }
+
+struct X
+{
+ void Foo (X *);
+ void Bar ();
+};
+
+void Quux (void (X::*) ());
+
+void X::Foo (X *ptr) // { dg-message "candidates" }
+{
+ Quux (Foo); // { dg-error "no matches" }
+ Quux (Bar);
+}
diff --git a/gcc/testsuite/g++.dg/ext/visibility/class1.C b/gcc/testsuite/g++.dg/ext/visibility/class1.C
index 22ad96b03ac..792fc789142 100644
--- a/gcc/testsuite/g++.dg/ext/visibility/class1.C
+++ b/gcc/testsuite/g++.dg/ext/visibility/class1.C
@@ -5,6 +5,7 @@
// { dg-do compile { target i?86-*-* x86_64-*-* } }
// { dg-skip-if "" { *-*-darwin* } { "*" } { "" } }
// { dg-require-visibility "" }
+// { dg-require-effective-target fpic }
// { dg-final { scan-assembler "InitEv@PLT" } }
#pragma GCC visibility push(hidden)
diff --git a/gcc/testsuite/g++.dg/ext/vla7.C b/gcc/testsuite/g++.dg/ext/vla7.C
new file mode 100644
index 00000000000..5246f9c8c38
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vla7.C
@@ -0,0 +1,30 @@
+// PR c++/40013
+// { dg-options "" }
+
+template <class T>
+struct A
+{
+ struct B
+ {
+ struct
+ {
+ int fn () { return 0; }
+ } b;
+ };
+ void test ();
+};
+
+template <class T>
+void
+A <T>::test ()
+{
+ B a;
+ int vla[a.b.fn ()];
+}
+
+int
+main ()
+{
+ A <char> a;
+ a.test ();
+}
diff --git a/gcc/testsuite/g++.dg/other/PR23205.C b/gcc/testsuite/g++.dg/other/PR23205.C
index ae2f0b16644..27353544482 100644
--- a/gcc/testsuite/g++.dg/other/PR23205.C
+++ b/gcc/testsuite/g++.dg/other/PR23205.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks } { "*" } { "" } } */
/* { dg-options "-gstabs+ -fno-eliminate-unused-debug-types" } */
const int foobar = 4;
diff --git a/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C b/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C
new file mode 100644
index 00000000000..bcccb94a0cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/parser-pr28152-2.C
@@ -0,0 +1,13 @@
+/* PR 28152: error messages should mention __complex__ */
+/* { dg-do compile } */
+/* { dg-options "" } */
+int
+main (void)
+{
+ __complex__ float z;
+
+ z = __complex__ (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '__complex__'" }
+ // { dg-error "expected .;. before .__complex__." "" { target *-*-* } 9 }
+ z = __complex__ (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '__complex__'" }
+ // { dg-error "expected .;. before '__complex__'" "" { target *-*-* } 11 }
+ // { dg-error "at end of input" "" { target *-*-* } 11 }
diff --git a/gcc/testsuite/g++.dg/parse/parser-pr28152.C b/gcc/testsuite/g++.dg/parse/parser-pr28152.C
new file mode 100644
index 00000000000..5b3a25e18c9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/parser-pr28152.C
@@ -0,0 +1,13 @@
+/* PR 28152: error messages should mention _Complex */
+/* { dg-do compile } */
+/* { dg-options "" } */
+int
+main (void)
+{
+ _Complex float z;
+
+ z = _Complex (1.90000007326203904e+19, 0.0); // { dg-error "expected primary-expression before '_Complex'" }
+ // { dg-error "expected .;. before ._Complex." "" { target *-*-* } 9 }
+ z = _Complex (1.0e+0, 0.0) / z; // { dg-error "expected primary-expression before '_Complex'" }
+ // { dg-error "expected .;. before '_Complex'" "" { target *-*-* } 11 }
+ // { dg-error "at end of input" "" { target *-*-* } 11 }
diff --git a/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C b/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C
new file mode 100644
index 00000000000..70101c86826
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/dumb-plugin-test-1.C
@@ -0,0 +1,53 @@
+// Test case for the dumb plugin.
+// { dg-do compile }
+// { dg-options "-O -fplugin-arg-dumb_plugin-ref-pass-name=ccp -fplugin-arg-dumb_plugin-ref-pass-instance-num=1" }
+
+class Foo {
+ private:
+ int a_;
+
+ public:
+ Foo() : a_(a_) {} // { dg-warning "Before genericizing function" }
+
+ void setA(int a) {
+ a_ = a_;
+ } // { dg-warning "Before genericizing function" }
+
+ void operator=(Foo& rhs) {
+ this->a_ = rhs.a_;
+ } // { dg-warning "Before genericizing function" }
+}; // { dg-warning "Process struct Foo" }
+
+struct Bar {
+ int b_;
+ int c_;
+}; // { dg-warning "Process struct Bar" }
+
+int g = g;
+Foo foo = foo;
+
+int func()
+{
+ Bar *bar1, bar2;
+ Foo local_foo;
+ int x = x;
+ static int y = y;
+ float *f;
+ Bar bar_array[5];
+ char n;
+ int overflow;
+
+ *f = *f;
+ bar1->b_ = bar1->b_;
+ bar2.c_ = bar2.c_;
+ local_foo = local_foo;
+ foo = foo;
+ foo.setA(5);
+ bar_array[3].c_ = bar_array[3].c_;
+ bar_array[x+g].b_ = bar_array[x+g].b_;
+ y = x;
+ x = y;
+} // { dg-warning "Before genericizing function" }
+
+// { dg-warning "Analyze function" "" { target *-*-* } 50 }
+// { dg-warning "End of compilation unit" "" { target *-*-* } 50 }
diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
new file mode 100644
index 00000000000..0c62f89e109
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c
@@ -0,0 +1,136 @@
+/* A trivial (dumb) plugin example that shows how to use the GCC plugin
+ mechanism. */
+
+#include <stdlib.h>
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "tree-pass.h"
+#include "intl.h"
+#include "gcc-plugin.h"
+
+
+/* Callback function to invoke after GCC finishes parsing a struct. */
+
+void
+handle_struct (void *event_data, void *data)
+{
+ tree type = (tree) event_data;
+ warning (0, G_("Process struct %s"),
+ IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type))));
+}
+
+/* Callback function to invoke before the program is genericized. */
+
+void
+handle_pre_generic (void *event_data, void *data)
+{
+ tree fndecl = (tree) event_data;
+ warning (0, G_("Before genericizing function %s"),
+ IDENTIFIER_POINTER (DECL_NAME (fndecl)));
+}
+
+/* Callback function to invoke after GCC finishes the compilation unit. */
+
+void
+handle_end_of_compilation_unit (void *event_data, void *data)
+{
+ warning (0, G_("End of compilation unit"));
+}
+
+
+static unsigned int
+execute_dumb_plugin_example (void)
+{
+ warning (0, G_("Analyze function %s"),
+ IDENTIFIER_POINTER (DECL_NAME (current_function_decl)));
+ return 0;
+}
+
+static bool
+gate_dumb_plugin_example (void)
+{
+ return true;
+}
+
+static struct gimple_opt_pass pass_dumb_plugin_example =
+{
+ {
+ GIMPLE_PASS,
+ "dumb_plugin_example", /* name */
+ gate_dumb_plugin_example, /* gate */
+ execute_dumb_plugin_example, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+ }
+};
+
+/* Initialization function that GCC calls. This plugin takes an argument
+ that specifies the name of the reference pass and an instance number,
+ both of which determine where the plugin pass should be inserted. */
+
+int
+plugin_init (const char *plugin_name,
+ struct plugin_gcc_version *version __attribute__((unused)),
+ int argc, struct plugin_argument *argv)
+{
+ struct plugin_pass pass_info;
+ char *ref_pass_name = NULL;
+ int ref_instance_number = 0;
+ int i;
+
+ /* Process the plugin arguments. This plugin takes the following arguments:
+ ref-pass-name=<PASS_NAME> and ref-pass-instance-num=<NUM>. */
+ for (i = 0; i < argc; ++i)
+ {
+ if (!strcmp (argv[i].key, "ref-pass-name"))
+ {
+ if (argv[i].value)
+ ref_pass_name = argv[i].value;
+ else
+ warning (0, G_("option '-fplugin-arg-%s-ref-pass-name'"
+ " requires a pass name"), plugin_name);
+ }
+ else if (!strcmp (argv[i].key, "ref-pass-instance-num"))
+ {
+ if (argv[i].value)
+ ref_instance_number = strtol (argv[i].value, NULL, 0);
+ else
+ warning (0, G_("option '-fplugin-arg-%s-ref-pass-instance-num'"
+ " requires an integer value"), plugin_name);
+ }
+ else
+ warning (0, G_("plugin %qs: unrecognized argument %qs ignored"),
+ plugin_name, argv[i].key);
+ }
+
+ if (!ref_pass_name)
+ {
+ error (G_("plugin %qs requires a reference pass name"), plugin_name);
+ return 1;
+ }
+
+ pass_info.pass = &pass_dumb_plugin_example.pass;
+ pass_info.reference_pass_name = ref_pass_name;
+ pass_info.ref_pass_instance_number = ref_instance_number;
+ pass_info.pos_op = PASS_POS_INSERT_AFTER;
+
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &pass_info);
+
+ register_callback (plugin_name, PLUGIN_FINISH_TYPE, handle_struct, NULL);
+
+ register_callback (plugin_name, PLUGIN_CXX_CP_PRE_GENERICIZE,
+ handle_pre_generic, NULL);
+
+ register_callback (plugin_name, PLUGIN_FINISH_UNIT,
+ handle_end_of_compilation_unit, NULL);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/plugin/plugin.exp b/gcc/testsuite/g++.dg/plugin/plugin.exp
new file mode 100644
index 00000000000..e1f6d89ae28
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/plugin.exp
@@ -0,0 +1,66 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# 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 3 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Test the functionality of the GCC plugin support
+
+load_lib target-supports.exp
+load_lib g++-dg.exp
+
+global TESTING_IN_BUILD_TREE
+global ENABLE_PLUGIN
+
+# The plugin testcases currently only work when the build tree is available.
+# Also check whether the host supports plugins.
+if { ![info exists TESTING_IN_BUILD_TREE] || ![info exists ENABLE_PLUGIN] } {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CXXFLAGS
+if ![info exists DEFAULT_CXXFLAGS] then {
+ set DEFAULT_CXXFLAGS " -ansi -pedantic-errors -Wno-long-long"
+}
+
+# The procedures in plugin-support.exp need these parameters.
+set default_flags $DEFAULT_CXXFLAGS
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Load support procs.
+load_lib plugin-support.exp
+
+# Specify the plugin source file and the associated test files in a list.
+# plugin_test_list={ {plugin1 test1 test2 ...} {plugin2 test1 ...} ... }
+set plugin_test_list [list \
+ { selfassign.c self-assign-test-1.C self-assign-test-2.C self-assign-test-3.C } \
+ { dumb_plugin.c dumb-plugin-test-1.C } ]
+
+foreach plugin_test $plugin_test_list {
+ # Replace each source file with its full-path name
+ for {set i 0} {$i < [llength $plugin_test]} {incr i} {
+ set basename [lindex $plugin_test $i]
+ set plugin_test [lreplace $plugin_test $i $i $srcdir/$subdir/$basename]
+ }
+ set plugin_src [lindex $plugin_test 0]
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $plugin_src] then {
+ continue
+ }
+ set plugin_input_tests [lreplace $plugin_test 0 0]
+ plugin-test-execute $plugin_src $plugin_input_tests
+}
diff --git a/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C b/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C
new file mode 100644
index 00000000000..607381fb403
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/self-assign-test-1.C
@@ -0,0 +1,50 @@
+// Test the self-assignemnt detection plugin.
+// { dg-do compile }
+// { dg-options "-O" }
+
+class Foo {
+ private:
+ int a_;
+
+ public:
+ Foo() : a_(a_) {} // { dg-warning "assigned to itself" }
+
+ void setA(int a) {
+ a_ = a_; // { dg-warning "assigned to itself" }
+ }
+
+ void operator=(Foo& rhs) {
+ this->a_ = rhs.a_;
+ }
+};
+
+struct Bar {
+ int b_;
+ int c_;
+};
+
+int g = g; // { dg-warning "assigned to itself" }
+Foo foo = foo; // { dg-warning "assigned to itself" }
+
+int func()
+{
+ Bar *bar1, bar2;
+ Foo local_foo;
+ int x = x; // { dg-warning "assigned to itself" }
+ static int y = y; // { dg-warning "assigned to itself" }
+ float *f;
+ Bar bar_array[5];
+ char n;
+ int overflow;
+
+ *f = *f; // { dg-warning "assigned to itself" }
+ bar1->b_ = bar1->b_; // { dg-warning "assigned to itself" }
+ bar2.c_ = bar2.c_; // { dg-warning "assigned to itself" }
+ local_foo = local_foo; // { dg-warning "assigned to itself" }
+ foo = foo; // { dg-warning "assigned to itself" }
+ foo.setA(5);
+ bar_array[3].c_ = bar_array[3].c_; // { dg-warning "assigned to itself" }
+ bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-warning "self-assignment detected" }
+ y = x;
+ x = y;
+}
diff --git a/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C b/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C
new file mode 100644
index 00000000000..35e1fb8f893
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/self-assign-test-2.C
@@ -0,0 +1,50 @@
+// Test the self-assignemnt detection plugin without checking of operator-eq.
+// { dg-do compile }
+// { dg-options "-O -fplugin-arg-selfassign-no-check-operator-eq" }
+
+class Foo {
+ private:
+ int a_;
+
+ public:
+ Foo() : a_(a_) {} // { dg-warning "assigned to itself" }
+
+ void setA(int a) {
+ a_ = a_; // { dg-warning "assigned to itself" }
+ }
+
+ void operator=(Foo& rhs) {
+ this->a_ = rhs.a_;
+ }
+};
+
+struct Bar {
+ int b_;
+ int c_;
+};
+
+int g = g; // { dg-warning "assigned to itself" }
+Foo foo = foo; // { dg-warning "assigned to itself" }
+
+int func()
+{
+ Bar *bar1, bar2;
+ Foo local_foo;
+ int x = x; // { dg-warning "assigned to itself" }
+ static int y = y; // { dg-warning "assigned to itself" }
+ float *f;
+ Bar bar_array[5];
+ char n;
+ int overflow;
+
+ *f = *f; // { dg-warning "assigned to itself" }
+ bar1->b_ = bar1->b_; // { dg-warning "assigned to itself" }
+ bar2.c_ = bar2.c_; // { dg-warning "assigned to itself" }
+ local_foo = local_foo; // { dg-bogus "assigned to itself" }
+ foo = foo; // { dg-bogus "assigned to itself" }
+ foo.setA(5);
+ bar_array[3].c_ = bar_array[3].c_; // { dg-warning "assigned to itself" }
+ bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-warning "self-assignment detected" }
+ y = x;
+ x = y;
+}
diff --git a/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C b/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C
new file mode 100644
index 00000000000..e5b354baff2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/self-assign-test-3.C
@@ -0,0 +1,50 @@
+// Test the self-assignemnt detection plugin with the 'disable' argument.
+// { dg-do compile }
+// { dg-options "-O -fplugin-arg-selfassign-disable" }
+
+class Foo {
+ private:
+ int a_;
+
+ public:
+ Foo() : a_(a_) {} // { dg-bogus "assigned to itself" }
+
+ void setA(int a) {
+ a_ = a_; // { dg-bogus "assigned to itself" }
+ }
+
+ void operator=(Foo& rhs) {
+ this->a_ = rhs.a_;
+ }
+};
+
+struct Bar {
+ int b_;
+ int c_;
+};
+
+int g = g; // { dg-bogus "assigned to itself" }
+Foo foo = foo; // { dg-bogus "assigned to itself" }
+
+int func()
+{
+ Bar *bar1, bar2;
+ Foo local_foo;
+ int x = x; // { dg-bogus "assigned to itself" }
+ static int y = y; // { dg-bogus "assigned to itself" }
+ float *f;
+ Bar bar_array[5];
+ char n;
+ int overflow;
+
+ *f = *f; // { dg-bogus "assigned to itself" }
+ bar1->b_ = bar1->b_; // { dg-bogus "assigned to itself" }
+ bar2.c_ = bar2.c_; // { dg-bogus "assigned to itself" }
+ local_foo = local_foo; // { dg-bogus "assigned to itself" }
+ foo = foo; // { dg-bogus "assigned to itself" }
+ foo.setA(5);
+ bar_array[3].c_ = bar_array[3].c_; // { dg-bogus "assigned to itself" }
+ bar_array[x+g].b_ = bar_array[x+g].b_; // { dg-bogus "self-assignment detected" }
+ y = x;
+ x = y;
+}
diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c
new file mode 100644
index 00000000000..6fbce83c01d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/plugin/selfassign.c
@@ -0,0 +1,365 @@
+/* This plugin contains an analysis pass that detects and warns about
+ self-assignment statements. */
+/* { dg-options "-O" } */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "toplev.h"
+#include "basic-block.h"
+#include "gimple.h"
+#include "tree.h"
+#include "tree-pass.h"
+#include "intl.h"
+#include "gcc-plugin.h"
+
+
+/* Indicate whether to check overloaded operator '=', which is performed by
+ default. To disable it, use -fplugin-arg-NAME-no-check-operator-eq. */
+bool check_operator_eq = true;
+
+/* Given a rhs EXPR of a gimple assign statement, if it is
+ - SSA_NAME : returns its var decl, or, if it is a temp variable,
+ returns the rhs of its SSA def statement.
+ - VAR_DECL, PARM_DECL, FIELD_DECL, or a reference expression :
+ returns EXPR itself.
+ - any other expression : returns NULL_TREE. */
+
+static tree
+get_real_ref_rhs (tree expr)
+{
+ switch (TREE_CODE (expr))
+ {
+ case SSA_NAME:
+ {
+ /* Given a self-assign statement, say foo.x = foo.x,
+ the IR (after SSA) looks like:
+
+ D.1797_14 = foo.x;
+ foo.x ={v} D.1797_14;
+
+ So if the rhs EXPR is an SSA_NAME of a temp variable,
+ e.g. D.1797_14, we need to grab the rhs of its SSA def
+ statement (i.e. foo.x). */
+ tree vdecl = SSA_NAME_VAR (expr);
+ if (DECL_ARTIFICIAL (vdecl)
+ && !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (expr);
+ /* We are only interested in an assignment with a single
+ rhs operand because if it is not, the original assignment
+ will not possibly be a self-assignment. */
+ if (is_gimple_assign (def_stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
+ == GIMPLE_SINGLE_RHS))
+ return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt));
+ else
+ return NULL_TREE;
+ }
+ else
+ return vdecl;
+ }
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ case COMPONENT_REF:
+ case INDIRECT_REF:
+ case ARRAY_REF:
+ return expr;
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Given an expression tree, EXPR, that may contains SSA names, returns an
+ equivalent tree with the SSA names converted to var/parm/field decls
+ so that it can be used with '%E' format modifier when emitting warning
+ messages.
+
+ This function currently only supports VAR/PARM/FIELD_DECL, reference
+ expressions (COMPONENT_REF, INDIRECT_REF, ARRAY_REF), integer constant,
+ and SSA_NAME. If EXPR contains any other tree nodes (e.g. an arithmetic
+ expression appears in array index), NULL_TREE is returned. */
+
+static tree
+get_non_ssa_expr (tree expr)
+{
+ switch (TREE_CODE (expr))
+ {
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ {
+ if (DECL_NAME (expr))
+ return expr;
+ else
+ return NULL_TREE;
+ }
+ case COMPONENT_REF:
+ {
+ tree base, orig_base = TREE_OPERAND (expr, 0);
+ tree component, orig_component = TREE_OPERAND (expr, 1);
+ base = get_non_ssa_expr (orig_base);
+ if (!base)
+ return NULL_TREE;
+ component = get_non_ssa_expr (orig_component);
+ if (!component)
+ return NULL_TREE;
+ /* If either BASE or COMPONENT is converted, build a new
+ component reference tree. */
+ if (base != orig_base || component != orig_component)
+ return build3 (COMPONENT_REF, TREE_TYPE (component),
+ base, component, NULL_TREE);
+ else
+ return expr;
+ }
+ case INDIRECT_REF:
+ {
+ tree orig_base = TREE_OPERAND (expr, 0);
+ tree base = get_non_ssa_expr (orig_base);
+ if (!base)
+ return NULL_TREE;
+ /* If BASE is converted, build a new indirect reference tree. */
+ if (base != orig_base)
+ return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base);
+ else
+ return expr;
+ }
+ case ARRAY_REF:
+ {
+ tree array, orig_array = TREE_OPERAND (expr, 0);
+ tree index, orig_index = TREE_OPERAND (expr, 1);
+ array = get_non_ssa_expr (orig_array);
+ if (!array)
+ return NULL_TREE;
+ index = get_non_ssa_expr (orig_index);
+ if (!index)
+ return NULL_TREE;
+ /* If either ARRAY or INDEX is converted, build a new array
+ reference tree. */
+ if (array != orig_array || index != orig_index)
+ return build4 (ARRAY_REF, TREE_TYPE (expr), array, index,
+ TREE_OPERAND (expr, 2), TREE_OPERAND (expr, 3));
+ else
+ return expr;
+ }
+ case SSA_NAME:
+ {
+ tree vdecl = SSA_NAME_VAR (expr);
+ if (DECL_ARTIFICIAL (vdecl)
+ && !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (expr);
+ if (is_gimple_assign (def_stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
+ == GIMPLE_SINGLE_RHS))
+ vdecl = gimple_assign_rhs1 (def_stmt);
+ }
+ return get_non_ssa_expr (vdecl);
+ }
+ case INTEGER_CST:
+ return expr;
+ default:
+ /* Return NULL_TREE for any other kind of tree nodes. */
+ return NULL_TREE;
+ }
+}
+
+/* Given the LHS and (real) RHS of a gimple assign statement, STMT, check if
+ they are the same. If so, print a warning message about self-assignment. */
+
+static void
+compare_and_warn (gimple stmt, tree lhs, tree rhs)
+{
+ if (operand_equal_p (lhs, rhs, OEP_PURE_SAME))
+ {
+ location_t location;
+ location = (gimple_has_location (stmt)
+ ? gimple_location (stmt)
+ : (DECL_P (lhs)
+ ? DECL_SOURCE_LOCATION (lhs)
+ : input_location));
+ /* If LHS contains any tree node not currently supported by
+ get_non_ssa_expr, simply emit a generic warning without
+ specifying LHS in the message. */
+ lhs = get_non_ssa_expr (lhs);
+ if (lhs)
+ warning (0, G_("%H%qE is assigned to itself"), &location, lhs);
+ else
+ warning (0, G_("%Hself-assignment detected"), &location);
+ }
+}
+
+/* Check and warn if STMT is a self-assign statement. */
+
+static void
+warn_self_assign (gimple stmt)
+{
+ tree rhs, lhs;
+
+ /* Check assigment statement. */
+ if (is_gimple_assign (stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_SINGLE_RHS))
+ {
+ rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt));
+ if (!rhs)
+ return;
+
+ lhs = gimple_assign_lhs (stmt);
+ if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ lhs = SSA_NAME_VAR (lhs);
+ if (DECL_ARTIFICIAL (lhs))
+ return;
+ }
+
+ compare_and_warn (stmt, lhs, rhs);
+ }
+ /* Check overloaded operator '=' (if enabled). */
+ else if (check_operator_eq && is_gimple_call (stmt))
+ {
+ tree fdecl = gimple_call_fndecl (stmt);
+ if (fdecl && (DECL_NAME (fdecl) == maybe_get_identifier ("operator=")))
+ {
+ /* If 'operator=' takes reference operands, the arguments will be
+ ADDR_EXPR trees. In this case, just remove the address-taken
+ operator before we compare the lhs and rhs. */
+ lhs = gimple_call_arg (stmt, 0);
+ if (TREE_CODE (lhs) == ADDR_EXPR)
+ lhs = TREE_OPERAND (lhs, 0);
+ rhs = gimple_call_arg (stmt, 1);
+ if (TREE_CODE (rhs) == ADDR_EXPR)
+ rhs = TREE_OPERAND (rhs, 0);
+
+ compare_and_warn (stmt, lhs, rhs);
+ }
+ }
+}
+
+/* Entry point for the self-assignment detection pass. */
+
+static unsigned int
+execute_warn_self_assign (void)
+{
+ gimple_stmt_iterator gsi;
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ {
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ warn_self_assign (gsi_stmt (gsi));
+ }
+
+ return 0;
+}
+
+/* Pass gate function. Currently always returns true. */
+
+static bool
+gate_warn_self_assign (void)
+{
+ return true;
+}
+
+static struct gimple_opt_pass pass_warn_self_assign =
+{
+ {
+ GIMPLE_PASS,
+ "warn_self_assign", /* name */
+ gate_warn_self_assign, /* gate */
+ execute_warn_self_assign, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+ }
+};
+
+/* The initialization routine exposed to and called by GCC. The spec of this
+ function is defined in gcc/gcc-plugin.h.
+
+ PLUGIN_NAME - name of the plugin (useful for error reporting)
+ ARGC - the size of the ARGV array
+ ARGV - an array of key-value argument pair
+
+ Returns 0 if initialization finishes successfully.
+
+ Note that this function needs to be named exactly "plugin_init". */
+
+int
+plugin_init (const char *plugin_name, struct plugin_gcc_version *version,
+ int argc, struct plugin_argument *argv)
+{
+ struct plugin_pass pass_info;
+ bool enabled = true;
+ int i;
+
+ if (!plugin_default_version_check (version, version))
+ return 1;
+
+ /* Self-assign detection should happen after SSA is constructed. */
+ pass_info.pass = &pass_warn_self_assign.pass;
+ pass_info.reference_pass_name = "ssa";
+ pass_info.ref_pass_instance_number = 1;
+ pass_info.pos_op = PASS_POS_INSERT_AFTER;
+
+ /* Process the plugin arguments. This plugin takes the following arguments:
+ check-operator-eq, no-check-operator-eq, enable, and disable.
+ By default, the analysis is enabled with 'operator=' checked. */
+ for (i = 0; i < argc; ++i)
+ {
+ if (!strcmp (argv[i].key, "check-operator-eq"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-check-operator-eq=%s'"
+ " ignored (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ check_operator_eq = true;
+ }
+ else if (!strcmp (argv[i].key, "no-check-operator-eq"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-no-check-operator-eq=%s'"
+ " ignored (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ check_operator_eq = false;
+ }
+ else if (!strcmp (argv[i].key, "enable"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-enable=%s' ignored"
+ " (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ enabled = true;
+ }
+ else if (!strcmp (argv[i].key, "disable"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-disable=%s' ignored"
+ " (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ enabled = false;
+ }
+ else
+ warning (0, G_("plugin %qs: unrecognized argument %qs ignored"),
+ plugin_name, argv[i].key);
+ }
+
+ /* Register this new pass with GCC if the analysis is enabled. */
+ if (enabled)
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL,
+ &pass_info);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/rtti/repo1.C b/gcc/testsuite/g++.dg/rtti/repo1.C
index 7ff813bcdfe..f72a9730ab9 100644
--- a/gcc/testsuite/g++.dg/rtti/repo1.C
+++ b/gcc/testsuite/g++.dg/rtti/repo1.C
@@ -1,6 +1,7 @@
// PR c++/22204
// { dg-options "-frepo" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
#include <typeinfo>
template<int>
diff --git a/gcc/testsuite/g++.dg/template/call7.C b/gcc/testsuite/g++.dg/template/call7.C
new file mode 100644
index 00000000000..00a912b3682
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/call7.C
@@ -0,0 +1,19 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/17395
+// { dg-do "compile" }
+
+template<int> struct X { };
+
+void fu(int a, X<sizeof(a)>) { }
+
+template<class T>
+void bhar(T a, X<sizeof(a)>) { }
+
+int
+main()
+{
+ int x;
+ X<sizeof(int)> y;
+ fu(x, y);
+ bhar(x, y);
+}
diff --git a/gcc/testsuite/g++.dg/template/overload9.C b/gcc/testsuite/g++.dg/template/overload9.C
index cef8ebe9fc8..8aeab9eaa8e 100644
--- a/gcc/testsuite/g++.dg/template/overload9.C
+++ b/gcc/testsuite/g++.dg/template/overload9.C
@@ -7,12 +7,12 @@ template <typename T> A<T>& operator<<(A<T>&, const B<T>&);
template <typename T>
struct A
{
- A<T>& operator<<(A<T>& (*)(A<T>&)); // { dg-message "candidate" }
+ A<T>& operator<<(A<T>& (*)(A<T>&));
};
template <typename T> A<T>& foo(A<T>&);
extern A<char> c;
int main () {
- c << (1, foo); // { dg-error "no match" }
+ c << (1, foo); // { dg-error "no context" }
}
diff --git a/gcc/testsuite/g++.dg/template/repo1.C b/gcc/testsuite/g++.dg/template/repo1.C
index cb4c5a1eb24..342993eca14 100644
--- a/gcc/testsuite/g++.dg/template/repo1.C
+++ b/gcc/testsuite/g++.dg/template/repo1.C
@@ -1,5 +1,6 @@
// { dg-options "-frepo" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
struct A {
A();
diff --git a/gcc/testsuite/g++.dg/template/repo2.C b/gcc/testsuite/g++.dg/template/repo2.C
index 3618997dc2a..e3224155e97 100644
--- a/gcc/testsuite/g++.dg/template/repo2.C
+++ b/gcc/testsuite/g++.dg/template/repo2.C
@@ -1,6 +1,7 @@
// PR c++/17163
// { dg-options "-frepo" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template <int __inst>
struct __Atomicity_lock
diff --git a/gcc/testsuite/g++.dg/template/repo3.C b/gcc/testsuite/g++.dg/template/repo3.C
index 49a8fa5bfe4..cfa38a9e435 100644
--- a/gcc/testsuite/g++.dg/template/repo3.C
+++ b/gcc/testsuite/g++.dg/template/repo3.C
@@ -1,5 +1,6 @@
// { dg-options "-frepo -DF='a'" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template <typename A, typename B> void f () {}
template <typename A, typename B> void g () { f<int,int>(); }
diff --git a/gcc/testsuite/g++.dg/template/repo4.C b/gcc/testsuite/g++.dg/template/repo4.C
index 27714b5f115..64882a8c694 100644
--- a/gcc/testsuite/g++.dg/template/repo4.C
+++ b/gcc/testsuite/g++.dg/template/repo4.C
@@ -2,6 +2,7 @@
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
namespace {
struct Foo {};
diff --git a/gcc/testsuite/g++.dg/template/repo5.C b/gcc/testsuite/g++.dg/template/repo5.C
index 0d2893eee91..e45ade7df48 100644
--- a/gcc/testsuite/g++.dg/template/repo5.C
+++ b/gcc/testsuite/g++.dg/template/repo5.C
@@ -2,6 +2,7 @@
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template< typename T, T N > struct integral_c {
static const T value = N;
diff --git a/gcc/testsuite/g++.dg/template/repo6.C b/gcc/testsuite/g++.dg/template/repo6.C
index b15bab5a28b..4b7178e2ad3 100644
--- a/gcc/testsuite/g++.dg/template/repo6.C
+++ b/gcc/testsuite/g++.dg/template/repo6.C
@@ -2,6 +2,7 @@
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template<typename T>
class A
diff --git a/gcc/testsuite/g++.dg/template/repo7.C b/gcc/testsuite/g++.dg/template/repo7.C
index 7443315f25b..dafb3f5597c 100644
--- a/gcc/testsuite/g++.dg/template/repo7.C
+++ b/gcc/testsuite/g++.dg/template/repo7.C
@@ -2,6 +2,7 @@
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
struct A
{
diff --git a/gcc/testsuite/g++.dg/template/repo8.C b/gcc/testsuite/g++.dg/template/repo8.C
index 840dc08bcad..c51592c9349 100644
--- a/gcc/testsuite/g++.dg/template/repo8.C
+++ b/gcc/testsuite/g++.dg/template/repo8.C
@@ -2,6 +2,7 @@
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
struct A
{
diff --git a/gcc/testsuite/g++.dg/template/repo9.C b/gcc/testsuite/g++.dg/template/repo9.C
index f55024cb001..7ddc6bf56d3 100644
--- a/gcc/testsuite/g++.dg/template/repo9.C
+++ b/gcc/testsuite/g++.dg/template/repo9.C
@@ -2,6 +2,7 @@
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template <typename C> struct A
{
diff --git a/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C b/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C
new file mode 100644
index 00000000000..3d2543fb175
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wuninitialized-4.C
@@ -0,0 +1,22 @@
+// PR middle-end/39666
+// { dg-do compile }
+// { dg-options "-O2 -Wuninitialized" }
+
+int
+foo (int i)
+{
+ int j;
+ switch (i)
+ {
+ case -__INT_MAX__ - 1 ... -1:
+ j = 6;
+ break;
+ case 0:
+ j = 5;
+ break;
+ case 1 ... __INT_MAX__:
+ j = 4;
+ break;
+ }
+ return j;
+}
diff --git a/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C b/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C
new file mode 100644
index 00000000000..26add34945f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wuninitialized-5.C
@@ -0,0 +1,22 @@
+// PR middle-end/39666
+// { dg-do compile }
+// { dg-options "-O2 -Wuninitialized" }
+
+int
+foo (int i)
+{
+ int j; // { dg-warning "may be used uninitialized" }
+ switch (i)
+ {
+ case -__INT_MAX__ - 1 ... -1:
+ j = 6;
+ break;
+ case 0:
+ j = 5;
+ break;
+ case 2 ... __INT_MAX__:
+ j = 4;
+ break;
+ }
+ return j;
+}
diff --git a/gcc/testsuite/g++.dg/warn/deprecated-6.C b/gcc/testsuite/g++.dg/warn/deprecated-6.C
new file mode 100644
index 00000000000..8ce6ac02d52
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/deprecated-6.C
@@ -0,0 +1,110 @@
+/* Test __attribute__ ((deprecated("message"))) */
+/* { dg-do compile } */
+/* { dg-options "-Wdeprecated-declarations -fmessage-length=0" } */
+
+typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
+typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));
+
+typedef INT1 INT1a; /* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
+
+INT1 should_be_unavailable; /* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
+INT1a should_not_be_deprecated;
+
+INT1 f1(void) __attribute__ ((deprecated("Please avoid f1")));
+INT1 f2(void) { return 0; } /* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
+
+INT2 f3(void) __attribute__ ((__deprecated__("Please avoid f3")));
+INT2 f4(void) { return 0; } /* { dg-warning "'INT2' is deprecated .declared at \[^\n\]*: Please avoid INT2" "" } */
+int f5(INT2 x); /* { dg-warning "'INT2' is deprecated" "" } */
+int f6(INT2 x) __attribute__ ((__deprecated__("Please avoid f6")));
+
+typedef enum Color {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));
+
+int g1;
+int g2 __attribute__ ((deprecated("Please avoid g2")));
+int g3 __attribute__ ((__deprecated__("Please avoid g3")));
+Color k; /* { dg-warning "'Color' is deprecated .declared at \[^\n\]*: Please avoid Color" "" } */
+
+typedef struct {
+ int field1;
+ int field2 __attribute__ ((deprecated("Please avoid field2")));
+ int field3;
+ int field4 __attribute__ ((__deprecated__("Please avoid field4")));
+ union {
+ int field5;
+ int field6 __attribute__ ((deprecated("Please avoid field6")));
+ } u1;
+ int field7:1;
+ int field8:1 __attribute__ ((deprecated("Please avoid field8")));
+ union {
+ int field9;
+ int field10;
+ } u2 __attribute__ ((deprecated("Please avoid u2")));
+} S1;
+
+int func1()
+{
+ INT1 w; /* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
+ int x __attribute__ ((deprecated("Please avoid x")));
+ int y __attribute__ ((__deprecated__("Please avoid y")));
+ int z;
+ int (*pf)() = f1; /* { dg-warning "'INT1 f1\\(\\)' is deprecated .declared at \[^\n\]*: Please avoid f1" "" } */
+
+ z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated .declared at \[^\n\]*: Please avoid x" "" } */
+ /* { dg-warning "'y' is deprecated .declared at \[^\n\]*: Please avoid y" "y" { target *-*-* } 53 } */
+ /* { dg-warning "'g2' is deprecated .declared at \[^\n\]*: Please avoid g2" "g2" { target *-*-* } 53 } */
+ /* { dg-warning "'g3' is deprecated .declared at \[^\n\]*: Please avoid g3" "g3" { target *-*-* } 53 } */
+ return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated .declared at \[^\n\]*: Please avoid f1" "f1" } */
+}
+
+int func2(S1 *p)
+{
+ S1 lp;
+
+ if (p->field1)
+ return p->field2; /* { dg-warning "'S1::field2' is deprecated .declared at \[^\n\]*: Please avoid field2" "" } */
+ else if (lp.field4) /* { dg-warning "'S1::field4' is deprecated .declared at \[^\n\]*: Please avoid field4" "" } */
+ return p->field3;
+
+ p->u1.field5 = g1 + p->field7;
+ p->u2.field9; /* { dg-warning "'S1::u2' is deprecated .declared at \[^\n\]*: Please avoid u2" "" } */
+ return p->u1.field6 + p->field8; /* { dg-warning "'S1::<anonymous union>::field6' is deprecated .declared at \[^\n\]*: Please avoid field6" "" } */
+ /* { dg-warning "'S1::field8' is deprecated .declared at \[^\n\]*: Please avoid field8" "field8" { target *-*-* } 71 } */
+}
+
+struct SS1 {
+ int x;
+ INT1 y; /* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
+} __attribute__ ((deprecated("Please avoid SS1")));
+
+struct SS1 *p1; /* { dg-warning "'SS1' is deprecated .declared at \[^\n\]*: Please avoid SS1" "" } */
+
+struct __attribute__ ((__deprecated__("Please avoid SS2"))) SS2 {
+ int x;
+ INT1 y; /* { dg-warning "'INT1' is deprecated .declared at \[^\n\]*: Please avoid INT1" "" } */
+};
+
+struct SS2 *p2; /* { dg-warning "'SS2' is deprecated .declared at \[^\n\]*: Please avoid SS2" "" } */
+
+class T {
+ public:
+ void member1(int) __attribute__ ((deprecated("Please avoid member1")));
+ void member2(INT1) __attribute__ ((__deprecated__("Please avoid member2"))); /* { dg-warning "'INT1' is deprecated" "" } */
+ int member3(T *);
+ int x;
+} __attribute__ ((deprecated("Please avoid T")));
+
+T *p3; // { dg-warning "'T' is deprecated .declared at \[^\n\]*: Please avoid T" }
+
+inline void T::member1(int) {}
+
+int T::member3(T *p) // { dg-warning "'T' is deprecated .declared at \[^\n\]*: Please avoid T" }
+{
+ p->member1(1); /* { dg-warning "'void T::member1\\(int\\)' is deprecated .declared at \[^\n\]*: Please avoid member1" "" } */
+ (*p).member1(2); /* { dg-warning "'void T::member1\\(int\\)' is deprecated .declared at \[^\n\]*: Please avoid member1" "" } */
+ p->member2(1); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated .declared at \[^\n\]*: Please avoid member2" "" } */
+ (*p).member2(2); /* { dg-warning "'void T::member2\\(INT1\\)' is deprecated .declared at \[^\n\]*: Please avoid member2" "" } */
+ p->member3(p);
+ (*p).member3(p);
+ return f1(); /* { dg-warning "'INT1 f1\\(\\)' is deprecated .declared at \[^\n\]*: Please avoid f1" "" } */
+}
diff --git a/gcc/testsuite/g++.dg/warn/pr35652.C b/gcc/testsuite/g++.dg/warn/pr35652.C
deleted file mode 100644
index 7ce9431eb2b..00000000000
--- a/gcc/testsuite/g++.dg/warn/pr35652.C
+++ /dev/null
@@ -1,30 +0,0 @@
-// PR c++/35652: wrong location and duplicated warning.
-// { dg-do compile }
-// { dg-options "-fshow-column" }
-#include <string>
-int foo() {
- // blank line padding, could also be code...
- //
- //
- //
- //
- //
- //
- //
- //
- //
- std::string s = "";
- s += 'x' + "y"; // { dg-warning "14:offset '120' outside bounds of constant string" }
- // { dg-bogus "offset '120' outside bounds of constant string.*offset '120' outside bounds of constant string" "duplicated" { target *-*-* } 17 }
-}
-
-int bar()
-{
- const char *s = 'z' + "y"; /* { dg-warning "25:offset '122' outside bounds of constant string" } */
-}
-
-int g()
-{
- char str[2];
- const char *p = str + sizeof(str);
-}
diff --git a/gcc/testsuite/g++.dg/warn/weak1.C b/gcc/testsuite/g++.dg/warn/weak1.C
index 8802a8fe8cd..efce90a2bcf 100644
--- a/gcc/testsuite/g++.dg/warn/weak1.C
+++ b/gcc/testsuite/g++.dg/warn/weak1.C
@@ -4,6 +4,10 @@
// { dg-skip-if "No unsat" { hppa*-*-hpux* } { "*" } { "" } }
// The darwin loader does, but they do need to exist at link time.
// { dg-skip-if "No link unsat" { *-*-darwin* } { "*" } { "" } }
+// For kernel modules and static RTPs, the loader treats undefined weak
+// symbols in the same way as undefined strong symbols. The test
+// therefore fails to load, so skip it.
+// { dg-skip-if "" { "*-*-vxworks*" && nonpic } "*" { "-non-static" } }
extern void foo (void) __attribute__ ((weak));
diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload11.C b/gcc/testsuite/g++.old-deja/g++.other/overload11.C
index 3b0cab79fd9..e8c88fd58ec 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/overload11.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/overload11.C
@@ -54,11 +54,10 @@ int main (int argc, char **argv)
ptr = (ovl); // ok
ptr = (&ovl); // ok
- // 13.4 indicates these are ok.
- ptr = (0, ovl); // ok { dg-bogus "" "" { xfail *-*-* } }
- ptr = (0, &ovl); // ok { dg-bogus "" "" { xfail *-*-* } }
- ptr = (argc ? ovl : ovl); // ok { dg-bogus "" "" { xfail *-*-* } }
- ptr = (argc ? &ovl : &ovl);// ok { dg-bogus "" "" { xfail *-*-* } }
+ ptr = (0, ovl); // ok { dg-error "no context" }
+ ptr = (0, &ovl); // ok { dg-error "no context" }
+ ptr = (argc ? ovl : ovl); // ok { dg-error "no context" }
+ ptr = (argc ? &ovl : &ovl);// ok { dg-error "no context" }
vptr = (ovl); // { dg-error "" } no matching candidates
vptr = (&ovl); // { dg-error "" } no matching candidates
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C
index 9c1aaf58f3e..d7a8cab31c5 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate4.C
@@ -1,7 +1,7 @@
// { dg-do link }
// { dg-options "-frepo -Werror" }
// { dg-require-host-local "" }
-// Build then link:
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
// Submitted by Melissa O'Neill <oneill@cs.sfu.ca>
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C
index a1223fc5d85..6726b216673 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate6.C
@@ -1,7 +1,7 @@
// { dg-do link }
// { dg-options "-frepo" }
// { dg-require-host-local "" }
-// Build then link:
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il>
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/repo1.C b/gcc/testsuite/g++.old-deja/g++.pt/repo1.C
index f3fdddc7f52..bdfe306b4ad 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/repo1.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/repo1.C
@@ -1,6 +1,7 @@
// { dg-do link }
// { dg-options "-frepo" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
// Bug: g++ complains about duplicate explicit instantiations with -frepo.
// From Jason Merrill <jason@cygnus.com>
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/repo2.C b/gcc/testsuite/g++.old-deja/g++.pt/repo2.C
index b40961c1558..a8d8b1217a1 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/repo2.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/repo2.C
@@ -1,6 +1,8 @@
// { dg-do link }
// { dg-options "-frepo" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
+
// Test that collect2 isn't confused by GNU ld's "In function `foo':" message.
// Contributed by Jason Merrill <jason@cygnus.com>
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/repo3.C b/gcc/testsuite/g++.old-deja/g++.pt/repo3.C
index 7995030fe03..53baf29f349 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/repo3.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/repo3.C
@@ -1,6 +1,8 @@
// { dg-do link }
// { dg-options "-frepo" }
// { dg-require-host-local "" }
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
+
// Test that we properly generate the vtable and such for C.
// Contributed by scott snyder <snyder@fnal.gov>
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/repo4.C b/gcc/testsuite/g++.old-deja/g++.pt/repo4.C
index 6a0a55aba55..84575cd9469 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/repo4.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/repo4.C
@@ -1,7 +1,7 @@
// { dg-do link }
// { dg-options "-frepo" }
// { dg-require-host-local "" }
-// Build then link:
+// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template <class T>
struct S {
diff --git a/gcc/testsuite/gcc.c-torture/compile/const-high-part.c b/gcc/testsuite/gcc.c-torture/compile/const-high-part.c
new file mode 100644
index 00000000000..95e2059704e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/const-high-part.c
@@ -0,0 +1,19 @@
+/* { dg-require-effective-target int32plus } */
+/* { dg-require-effective-target size32plus } */
+
+char *buf;
+int buflen;
+
+inline int
+sub (int length)
+{
+ if (length <= buflen)
+ buf[length] = '\0';
+ return 0;
+}
+
+int
+sub2 (void)
+{
+ return sub (0x7fffffff);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c
new file mode 100644
index 00000000000..3bee4380e5b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-1.c
@@ -0,0 +1,8 @@
+typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
+extern __m128 _mm_sub_ps (__m128 __A, __m128 __B);
+extern __m128 _mm_mul_ps (__m128 __A, __m128 __B);
+__m128
+vq_nbest(const __m128 *codebook, __m128 d, __m128 in)
+{
+ return _mm_sub_ps(d, _mm_mul_ps(in, *codebook++));
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c b/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c
new file mode 100644
index 00000000000..6f0d30cc0d1
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39928-2.c
@@ -0,0 +1,8 @@
+typedef _Complex float __m128;
+extern __m128 _mm_sub_ps (__m128 __A, __m128 __B);
+extern __m128 _mm_mul_ps (__m128 __A, __m128 __B);
+__m128
+vq_nbest(const __m128 *codebook, __m128 d, __m128 in)
+{
+ return _mm_sub_ps(d, _mm_mul_ps(in, *codebook++));
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39937.c b/gcc/testsuite/gcc.c-torture/compile/pr39937.c
new file mode 100644
index 00000000000..d0231053258
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39937.c
@@ -0,0 +1,12 @@
+int foo (__const char *__restrict __s);
+static void
+read_anisou(char line[])
+{
+ foo (line+1);
+}
+void
+read_pdbfile(void)
+{
+ char line[4096];
+ read_anisou (line);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39941.c b/gcc/testsuite/gcc.c-torture/compile/pr39941.c
new file mode 100644
index 00000000000..b6209086be9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39941.c
@@ -0,0 +1,12 @@
+typedef void (*entry_func) (void) __attribute__ ((noreturn));
+extern entry_func entry_addr;
+static void bsd_boot_entry (void)
+{
+ stop ();
+}
+void bsd_boot (void)
+{
+ entry_addr = (entry_func) bsd_boot_entry;
+ (*entry_addr) ();
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39943.c b/gcc/testsuite/gcc.c-torture/compile/pr39943.c
new file mode 100644
index 00000000000..537ba437029
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39943.c
@@ -0,0 +1,7 @@
+void gl_fog_index_pixels(float f, unsigned int n, unsigned int index[])
+{
+ unsigned int i;
+ for (i=0; i<n; i++)
+ index[i] = (unsigned int) ((float) index[i] + (1.0F-f));
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr39983.c b/gcc/testsuite/gcc.c-torture/compile/pr39983.c
new file mode 100644
index 00000000000..67081211cca
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr39983.c
@@ -0,0 +1,17 @@
+typedef struct {
+ int *p;
+} *A;
+
+extern const int a[1];
+extern const int b[1];
+
+void foo()
+{
+ A x;
+ A y;
+ static const int * const c[] = { b };
+
+ x->p = (int*)c[0];
+ y->p = (int*)a;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40023.c b/gcc/testsuite/gcc.c-torture/compile/pr40023.c
new file mode 100644
index 00000000000..93d8f68a5e5
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr40023.c
@@ -0,0 +1,11 @@
+typedef __builtin_va_list va_list;
+typedef struct {
+ va_list ap;
+} ScanfState;
+void
+GetInt(ScanfState *state, long llval)
+{
+ *__builtin_va_arg(state->ap,long *) = llval;
+ __builtin_va_end(state->ap);
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c
index daa2745e939..ec292aca3d4 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/20010226-1.c
@@ -1,6 +1,6 @@
#include <float.h>
-long double dfrom = 1.1;
+long double dfrom = 1.1L;
long double m1;
long double m2;
unsigned long mant_long;
@@ -13,8 +13,8 @@ int main()
if (LDBL_EPSILON > 0x1p-31L)
return 0;
- m1 = dfrom / 2.0;
- m2 = m1 * 4294967296.0;
+ m1 = dfrom / 2.0L;
+ m2 = m1 * 4294967296.0L;
mant_long = ((unsigned long) m2) & 0xffffffff;
if (mant_long == 0x8ccccccc)
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c
index c15653cd2e1..7021b99ad7f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/unsafe-fp-assoc-1.c
@@ -32,6 +32,8 @@ void func ( double x )
int main()
{
+ if (sizeof (double) == 4)
+ return 0;
func((double)1.00);
return 0;
}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40022.c b/gcc/testsuite/gcc.c-torture/execute/pr40022.c
new file mode 100644
index 00000000000..1e8f728ab44
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr40022.c
@@ -0,0 +1,51 @@
+extern void abort (void);
+
+struct A
+{
+ struct A *a;
+};
+
+struct B
+{
+ struct A *b;
+};
+
+__attribute__((noinline))
+struct A *
+foo (struct A *x)
+{
+ asm volatile ("" : : "g" (x) : "memory");
+ return x;
+}
+
+__attribute__((noinline))
+void
+bar (struct B *w, struct A *x, struct A *y, struct A *z)
+{
+ struct A **c;
+ c = &w->b;
+ *c = foo (x);
+ while (*c)
+ c = &(*c)->a;
+ *c = foo (y);
+ while (*c)
+ c = &(*c)->a;
+ *c = foo (z);
+}
+
+struct B d;
+struct A e, f, g;
+
+int
+main (void)
+{
+ f.a = &g;
+ bar (&d, &e, &f, 0);
+ if (d.b == 0
+ || d.b->a == 0
+ || d.b->a->a == 0
+ || d.b->a->a->a != 0)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40057.c b/gcc/testsuite/gcc.c-torture/execute/pr40057.c
new file mode 100644
index 00000000000..9d5c4e31e87
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr40057.c
@@ -0,0 +1,37 @@
+/* PR middle-end/40057 */
+
+extern void abort (void);
+
+__attribute__((noinline)) int
+foo (unsigned long long x)
+{
+ unsigned long long y = (x >> 31ULL) & 1ULL;
+ if (y == 0ULL)
+ return 0;
+ return -1;
+}
+
+__attribute__((noinline)) int
+bar (long long x)
+{
+ long long y = (x >> 31LL) & 1LL;
+ if (y == 0LL)
+ return 0;
+ return -1;
+}
+
+int
+main (void)
+{
+ if (sizeof (long long) != 8)
+ return 0;
+ if (foo (0x1682a9aaaULL))
+ abort ();
+ if (!foo (0x1882a9aaaULL))
+ abort ();
+ if (bar (0x1682a9aaaLL))
+ abort ();
+ if (!bar (0x1882a9aaaLL))
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/20020103-1.c b/gcc/testsuite/gcc.dg/20020103-1.c
index 81ffdb1b285..4209486b814 100644
--- a/gcc/testsuite/gcc.dg/20020103-1.c
+++ b/gcc/testsuite/gcc.dg/20020103-1.c
@@ -9,7 +9,7 @@
#if defined(__i386__)
#define clobber \
asm volatile("#asm" : : : "si", "di")
-#elif defined(__powerpc__) || defined(__PPC__) || defined(__ppc__) || defined(__POWERPC__) || defined(PPC) || defined (_IBMR2)
+#elif defined(__powerpc__) || defined(__PPC__) || defined(__ppc__) || defined(__POWERPC__) || defined(PPC) || defined (_IBMR2) || defined (__ppc)
#define clobber \
asm volatile("#asm" : : : "14", "15", "16", "17", "18", "19", "20", \
"21", "22", "23", "24", "25", "26", "27", "28", "29")
diff --git a/gcc/testsuite/gcc.dg/20020312-2.c b/gcc/testsuite/gcc.dg/20020312-2.c
index c4a27744ae8..bf7d99526cc 100644
--- a/gcc/testsuite/gcc.dg/20020312-2.c
+++ b/gcc/testsuite/gcc.dg/20020312-2.c
@@ -48,7 +48,7 @@ extern void abort (void);
/* PIC register is %r27 or %r19, but is used even without -fpic. */
#elif defined(__pdp11__)
/* No pic register. */
-#elif defined(__powerpc__) || defined(__PPC__) || defined(__POWERPC__)
+#elif defined(__powerpc__) || defined(__PPC__) || defined(__POWERPC__) || defined (__ppc)
# ifdef __MACH__
# define PIC_REG "31"
# else
diff --git a/gcc/testsuite/gcc.dg/20020919-1.c b/gcc/testsuite/gcc.dg/20020919-1.c
index e0fab27020a..dfb072109c1 100644
--- a/gcc/testsuite/gcc.dg/20020919-1.c
+++ b/gcc/testsuite/gcc.dg/20020919-1.c
@@ -38,7 +38,8 @@
# define REG1 "$8"
# define REG2 "$9"
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \
- || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2)
+ || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2) \
+ || defined (__ppc)
# define REG1 "6"
# define REG2 "7"
# if !defined(__powerpc64__) && !defined(__LP64__)
diff --git a/gcc/testsuite/gcc.dg/Wconversion-real-integer.c b/gcc/testsuite/gcc.dg/Wconversion-real-integer.c
index 1625fc03581..c61ea70c781 100644
--- a/gcc/testsuite/gcc.dg/Wconversion-real-integer.c
+++ b/gcc/testsuite/gcc.dg/Wconversion-real-integer.c
@@ -5,6 +5,7 @@
/* { dg-skip-if "doubles are floats,ints are 16bits" { "avr-*-*" } { "*" } { "" } } */
/* { dg-options "-std=c99 -Wconversion" } */
/* { dg-require-effective-target int32plus } */
+/* { dg-require-effective-target double64plus } */
#include <limits.h>
void fsi (signed int x);
diff --git a/gcc/testsuite/gcc.dg/Wconversion-real.c b/gcc/testsuite/gcc.dg/Wconversion-real.c
index 06396fba33c..ed7371b5123 100644
--- a/gcc/testsuite/gcc.dg/Wconversion-real.c
+++ b/gcc/testsuite/gcc.dg/Wconversion-real.c
@@ -3,6 +3,7 @@
/* { dg-do compile } */
/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
/* { dg-options "-std=c99 -Wconversion" } */
+/* { dg-require-effective-target large_double } */
float vfloat;
double vdouble;
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-5.c b/gcc/testsuite/gcc.dg/Wcxx-compat-5.c
new file mode 100644
index 00000000000..d7b2f96a6be
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wcxx-compat-5.c
@@ -0,0 +1,45 @@
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+enum E1 { A, B, C };
+enum E2 { D, E, F };
+
+int f1() { return A; }
+
+struct s { enum E1 e1 : 3; enum E2 e2 : 4; };
+
+enum E1
+f2 (int i, struct s sv, struct s *pv)
+{
+ int a;
+ enum E1 e1 = B;
+ enum E2 e2 = E;
+ switch (i)
+ {
+ case 0:
+ return A;
+ case 1:
+ return D; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ case 2:
+ return 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ case 3:
+ return (enum E1) 1;
+ case 4:
+ return (enum E2) 2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ case 5:
+ return e1;
+ case 6:
+ return e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ case 7:
+ return pv->e1;
+ case 8:
+ return sv.e1;
+ case 9:
+ return pv->e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ case 10:
+ return sv.e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ case 11:
+ return 1, A;
+ default:
+ return C;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-6.c b/gcc/testsuite/gcc.dg/Wcxx-compat-6.c
new file mode 100644
index 00000000000..2b327c4bf64
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wcxx-compat-6.c
@@ -0,0 +1,112 @@
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+enum E1 { A, B, C };
+enum E2 { D, E, F };
+
+enum E1 v1a = A;
+enum E1 v1b = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+enum E1 v1c = 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+enum E1 v1d = (enum E1) 0;
+enum E1 v1e = (enum E2) 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */
+
+enum E2 v2a;
+
+enum E1 a1[] =
+{
+ A,
+ D, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ 0, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ (enum E1) 0,
+ (enum E2) 0, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ A
+};
+
+struct s1
+{
+ enum E1 e1;
+};
+
+struct s1 a2[] =
+{
+ { A },
+ { D }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { (enum E1) 0 },
+ { (enum E2) 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { A }
+};
+
+struct s1 a3[] =
+{
+ [ 5 ] = { .e1 = A },
+ [ 4 ] = { .e1 = D }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ [ 3 ] = { .e1 = 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ [ 2 ] = { .e1 = (enum E1) 0 },
+ [ 1 ] = { .e1 = (enum E2) 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ [ 0 ] = { .e1 = A }
+};
+
+struct s2
+{
+ enum E1 e1 : 3;
+};
+
+struct s2 a4[] =
+{
+ { A },
+ { D }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { (enum E1) 0 },
+ { (enum E2) 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { A }
+};
+
+struct s2 a5[] =
+{
+ [ 5 ] = { .e1 = A },
+ [ 4 ] = { .e1 = D }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ [ 3 ] = { .e1 = 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ [ 2 ] = { .e1 = (enum E1) 0 },
+ [ 1 ] = { .e1 = (enum E2) 0 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ [ 0 ] = { .e1 = A }
+};
+
+void
+f(enum E1 e1, enum E2 e2, struct s1 vs1, struct s1 *vp1)
+{
+ enum E1 va1[] = {
+ e1,
+ e2, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ v1a,
+ v2a, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ vs1.e1,
+ vp1->e1,
+ e1 ? e1 : e1,
+ (0, e1)
+ };
+
+ struct s1 va2[] = {
+ { e1 },
+ { e2 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { v1a },
+ { v2a }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { vs1.e1 },
+ { vp1->e1 },
+ { e1 ? e1 : e1 },
+ { (0, e1) }
+ };
+
+ struct s2 va3[] = {
+ { e1 },
+ { e2 }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { v1a },
+ { v2a }, /* { dg-warning "invalid in C\[+\]\[+\]" } */
+ { vs1.e1 },
+ { vp1->e1 },
+ { e1 ? e1 : e1 },
+ { (0, e1) }
+ };
+}
+
+/* Match all extra informative notes. */
+/* { dg-warning "near initialization for" "expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c b/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c
new file mode 100644
index 00000000000..b4a38d5cb10
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wunsuffixed-float-constants-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wunsuffixed-float-constants" } */
+
+#define VAL 0.5;
+
+double a = 1.1d;
+
+/* With FLOAT_CONST_DECIMAL64 switched to ON these would have type
+ _Decimal64. */
+
+double b = VAL; /* { dg-warning "unsuffixed float constant" } */
+double c = 1.2; /* { dg-warning "unsuffixed float constant" } */
+
+/* With FLOAT_CONST_DECIMAL64 switched to ON these are still binary. */
+
+double d = 0x5.0p1; /* No warning for hex constant. */
+double e = 3.1i; /* No warning for imaginary constant. */
diff --git a/gcc/testsuite/gcc.dg/asm-b.c b/gcc/testsuite/gcc.dg/asm-b.c
index beb35f28d8a..f888839abf7 100644
--- a/gcc/testsuite/gcc.dg/asm-b.c
+++ b/gcc/testsuite/gcc.dg/asm-b.c
@@ -21,7 +21,7 @@ bar (void)
foo (&x);
const unsigned int y = x;
z = &x;
-#if defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER) || defined (__ppc64__)
+#if defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (_POWER) || defined (__ppc64__) || defined (__ppc)
__asm __volatile ("sthbrx %1,0,%2" : "=m" (*z) : "r" (y), "r" (z));
#elif defined __i386__ || defined __x86_64__
__asm __volatile ("movb %b1,1(%2)\n\tmovb %h1,(%2)"
diff --git a/gcc/testsuite/gcc.dg/attr-alias-5.c b/gcc/testsuite/gcc.dg/attr-alias-5.c
new file mode 100644
index 00000000000..554668d212f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-alias-5.c
@@ -0,0 +1,12 @@
+/* Verify diagnostics for aliases to strings containing extended
+ identifiers or bad characters. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+/* { dg-require-alias "" } */
+
+void f0 (void) __attribute__((alias("\xa1"))); /* { dg-error "undefined symbol '\\\\241'" } */
+void f1 (void) __attribute__((alias("\u00e9"))); /* { dg-error "undefined symbol '\\\\U000000e9'" } */
+void f2 (void) __attribute__((alias("\uffff"))); /* { dg-error "undefined symbol '\\\\U0000ffff'" } */
+void f3 (void) __attribute__((alias("\U000fffff"))); /* { dg-error "undefined symbol '\\\\U000fffff'" } */
+void f4 (void) __attribute__((alias("\U00ffffff"))); /* { dg-error "undefined symbol '\\\\U00ffffff'" } */
+void f5 (void) __attribute__((alias("\U0fffffff"))); /* { dg-error "undefined symbol '\\\\U0fffffff'" } */
diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1.c b/gcc/testsuite/gcc.dg/attr-weakref-1.c
index 19a511b8252..898bc4169a0 100644
--- a/gcc/testsuite/gcc.dg/attr-weakref-1.c
+++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c
@@ -5,6 +5,10 @@
// is not available on hppa*-*-hpux*. The test is skipped rather than
// xfailed to suppress the warning that would otherwise arise.
// { dg-skip-if "" { "*-*-darwin*" "hppa*-*-hpux*" } "*" { "" } }
+// For kernel modules and static RTPs, the loader treats undefined weak
+// symbols in the same way as undefined strong symbols. The test
+// therefore fails to load, so skip it.
+// { dg-skip-if "" { "*-*-vxworks*" && nonpic } "*" { "-non-static" } }
// { dg-options "-O2" }
// { dg-additional-sources "attr-weakref-1a.c" }
diff --git a/gcc/testsuite/gcc.dg/c99-complex-3.c b/gcc/testsuite/gcc.dg/c99-complex-3.c
new file mode 100644
index 00000000000..f1f7a1f874c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-complex-3.c
@@ -0,0 +1,7 @@
+/* Test for _Imaginary: when imaginary types are not implemented, this
+ is still a keyword and must give a syntax error if used rather than
+ being treated as an identifier. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+float _Imaginary; /* { dg-error "expected" } */
diff --git a/gcc/testsuite/gcc.dg/cdce1.c b/gcc/testsuite/gcc.dg/cdce1.c
index dda50207015..3bd35ecb786 100644
--- a/gcc/testsuite/gcc.dg/cdce1.c
+++ b/gcc/testsuite/gcc.dg/cdce1.c
@@ -1,8 +1,8 @@
/* { dg-do run } */
-/* { dg-skip-if "doubles are floats" { "avr-*-*" "m32c-*-*" } { "*" } { "" } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" } */
/* { dg-final { scan-tree-dump "cdce1.c:16: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { cleanup-tree-dump "cdce" } } */
+/* { dg-require-effective-target large_double } */
#include <stdlib.h>
#include <math.h>
diff --git a/gcc/testsuite/gcc.dg/cpp/_Pragma6.c b/gcc/testsuite/gcc.dg/cpp/_Pragma6.c
index 74511a10066..986b40cb156 100644
--- a/gcc/testsuite/gcc.dg/cpp/_Pragma6.c
+++ b/gcc/testsuite/gcc.dg/cpp/_Pragma6.c
@@ -2,7 +2,7 @@
/* This is supposed to succeed only if
the target defines HANDLE_PRAGMA_PACK_PUSH_POP
and doesn't define HANDLE_PRAGMA_PACK_WITH_EXPANSION. */
-/* { dg-do compile { target { ! { powerpc-ibm-aix* *-*-solaris2* fido-*-* m68k-*-* sh*-[us]*-elf m32c-*-* } } } } */
+/* { dg-do compile { target { ! { powerpc-ibm-aix* *-*-solaris2* fido-*-* m68k-*-* sh*-[us]*-elf m32c-*-* *-*-vxworks } } } } */
#define push bar
#define foo _Pragma ("pack(push)")
diff --git a/gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c b/gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c
new file mode 100644
index 00000000000..633383899dd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/pragma-float-const-decimal64-1.c
@@ -0,0 +1,5 @@
+/* { dg-do compile { target { ! dfp } } } */
+/* { dg-options "-std=gnu99 -Wunknown-pragmas" } */
+
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "not supported on this target" } */
+double d = 1.0;
diff --git a/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c b/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c
new file mode 100644
index 00000000000..7f96a56841c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c
@@ -0,0 +1,17 @@
+/* Test for bug in conversions from 5-byte UTF-8 sequences in
+ cpplib. */
+/* { dg-do run { target { 4byte_wchar_t } } } */
+/* { dg-options "-std=gnu99" } */
+
+extern void abort (void);
+extern void exit (int);
+
+__WCHAR_TYPE__ ws[] = L"û¿¿¿¿";
+
+int
+main (void)
+{
+ if (ws[0] != L'\U03FFFFFF' || ws[1] != 0)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/declspec-10.c b/gcc/testsuite/gcc.dg/declspec-10.c
index d29fb7ab45a..f938bf10e7a 100644
--- a/gcc/testsuite/gcc.dg/declspec-10.c
+++ b/gcc/testsuite/gcc.dg/declspec-10.c
@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } *
register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
-void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
void f5 (register int);
-void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
register int y; /* { dg-warning "file-scope declaration of 'y' specifies 'register'" } */
diff --git a/gcc/testsuite/gcc.dg/declspec-11.c b/gcc/testsuite/gcc.dg/declspec-11.c
index 4204b6f2188..c3fec469a81 100644
--- a/gcc/testsuite/gcc.dg/declspec-11.c
+++ b/gcc/testsuite/gcc.dg/declspec-11.c
@@ -9,11 +9,11 @@ auto void f0 (void) {} /* { dg-error "function definition declared 'auto'" } */
register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
-void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
void f5 (register int);
-void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
register int y; /* { dg-error "file-scope declaration of 'y' specifies 'register'" } */
diff --git a/gcc/testsuite/gcc.dg/declspec-9.c b/gcc/testsuite/gcc.dg/declspec-9.c
index 670fe25cbc1..ece47c66fb1 100644
--- a/gcc/testsuite/gcc.dg/declspec-9.c
+++ b/gcc/testsuite/gcc.dg/declspec-9.c
@@ -10,11 +10,11 @@ auto void f0 (void) {} /* { dg-warning "function definition declared 'auto'" } *
register void f1 (void) {} /* { dg-error "function definition declared 'register'" } */
typedef void f2 (void) {} /* { dg-error "function definition declared 'typedef'" } */
-void f3 (auto int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f4 (extern int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f3 (auto int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f4 (extern int); /* { dg-error "storage class specified for unnamed parameter" } */
void f5 (register int);
-void f6 (static int); /* { dg-error "storage class specified for parameter 'type name'" } */
-void f7 (typedef int); /* { dg-error "storage class specified for parameter 'type name'" } */
+void f6 (static int); /* { dg-error "storage class specified for unnamed parameter" } */
+void f7 (typedef int); /* { dg-error "storage class specified for unnamed parameter" } */
auto int x; /* { dg-error "file-scope declaration of 'x' specifies 'auto'" } */
register int y;
diff --git a/gcc/testsuite/gcc.dg/deprecated-4.c b/gcc/testsuite/gcc.dg/deprecated-4.c
new file mode 100644
index 00000000000..f36dbdf9af1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/deprecated-4.c
@@ -0,0 +1,88 @@
+/* Test __attribute__ ((deprecated("message"))) */
+/* { dg-do compile } */
+/* { dg-options "-Wdeprecated-declarations" } */
+
+typedef int INT1 __attribute__((deprecated("Please avoid INT1")));
+typedef INT1 INT2 __attribute__ ((__deprecated__("Please avoid INT2")));
+
+typedef INT1 INT1a; /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
+typedef INT1 INT1b __attribute__ ((deprecated("Please avoid INT1b")));
+
+INT1 should_be_unavailable; /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
+INT1a should_not_be_deprecated;
+
+INT1 f1(void) __attribute__ ((deprecated("Please avoid f1")));
+INT1 f2(void) { return 0; } /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
+
+INT2 f3(void) __attribute__ ((__deprecated__("Please avoid f3")));
+INT2 f4(void) { return 0; } /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
+int f5(INT2 x); /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
+int f6(INT2 x) __attribute__ ((__deprecated__("Please avoid f6"))); /* { dg-warning "'INT2' is deprecated: Please avoid INT2" "" } */
+
+typedef enum {red, green, blue} Color __attribute__((deprecated("Please avoid Color")));
+
+int g1;
+int g2 __attribute__ ((deprecated("Please avoid g2")));
+int g3 __attribute__ ((__deprecated__("Please avoid g3")));
+Color k; /* { dg-warning "'Color' is deprecated .declared at \[^\n\]*: Please avoid Color" "" } */
+
+typedef struct {
+ int field1;
+ int field2 __attribute__ ((deprecated("Please avoid field2")));
+ int field3;
+ int field4 __attribute__ ((__deprecated__("Please avoid field4")));
+ union {
+ int field5;
+ int field6 __attribute__ ((deprecated("Please avoid field6")));
+ } u1;
+ int field7:1;
+ int field8:1 __attribute__ ((deprecated("Please avoid field8")));
+ union {
+ int field9;
+ int field10;
+ } u2 __attribute__ ((deprecated("Please avoid u2")));
+} S1;
+
+int func1()
+{
+ INT1 w; /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
+ int x __attribute__ ((deprecated("Avoid x")));
+ int y __attribute__ ((__deprecated__("Bad y")));
+ int z;
+ int (*pf)() = f1; /* { dg-warning "'f1' is deprecated .declared at \[^\n\]*: Please avoid f1" "" } */
+
+ z = w + x + y + g1 + g2 + g3; /* { dg-warning "'x' is deprecated .declared at \[^\n\]*: Avoid x" "" } */
+ /* { dg-warning "'y' is deprecated .declared at \[^\n\]*: Bad y" "y" { target *-*-* } 54 } */
+ /* { dg-warning "'g2' is deprecated .declared at \[^\n\]*: Please avoid g2" "g2" { target *-*-* } 54 } */
+ /* { dg-warning "'g3' is deprecated .declared at \[^\n\]*: Please avoid g3" "g3" { target *-*-* } 54 } */
+ return f1(); /* { dg-warning "'f1' is deprecated .declared at \[^\n\]*: Please avoid f1" "" } */
+}
+
+int func2(S1 *p)
+{
+ S1 lp;
+
+ if (p->field1)
+ return p->field2; /* { dg-warning "'field2' is deprecated .declared at \[^\n\]*: Please avoid field2" "" } */
+ else if (lp.field4) /* { dg-warning "'field4' is deprecated .declared at \[^\n\]*: Please avoid field4" "" } */
+ return p->field3;
+
+ p->u1.field5 = g1 + p->field7;
+ p->u2.field9; /* { dg-warning "'u2' is deprecated .declared at \[^\n\]*: Please avoid u2" "" } */
+ return p->u1.field6 + p->field8; /* { dg-warning "'field6' is deprecated .declared at \[^\n\]*: Please avoid field6" "" } */
+ /* { dg-warning "'field8' is deprecated .declared at \[^\n\]*: Please avoid field8" "field8" { target *-*-* } 72 } */
+}
+
+struct SS1 {
+ int x;
+ INT1 y; /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
+} __attribute__ ((deprecated("Please avoid SS1")));
+
+struct SS1 *p1; /* { dg-warning "'SS1' is deprecated .declared at \[^\n\]*: Please avoid SS1" "" } */
+
+struct __attribute__ ((__deprecated__("Please avoid SS2"))) SS2 {
+ int x;
+ INT1 y; /* { dg-warning "'INT1' is deprecated: Please avoid INT1" "" } */
+};
+
+struct SS2 *p2; /* { dg-warning "'SS2' is deprecated .declared at \[^\n\]*: Please avoid SS2" "" } */
diff --git a/gcc/testsuite/gcc.dg/deprecated-5.c b/gcc/testsuite/gcc.dg/deprecated-5.c
new file mode 100644
index 00000000000..133e60e4057
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/deprecated-5.c
@@ -0,0 +1,7 @@
+/* Test __attribute__((deprecated)). Test types without names. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct { int a; } __attribute__((deprecated ("Do not use"))) x; /* { dg-warning "type is deprecated" } */
+typeof(x) y; /* { dg-warning "type is deprecated .declared at .*.: Do not use" } */
diff --git a/gcc/testsuite/gcc.dg/deprecated-6.c b/gcc/testsuite/gcc.dg/deprecated-6.c
new file mode 100644
index 00000000000..874e1a68e07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/deprecated-6.c
@@ -0,0 +1,11 @@
+/* Test __attribute__((deprecated)). Test merging with multiple
+ declarations. Bug 7425. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+void func(void);
+void func(void) __attribute__((deprecated ("Do not use")));
+
+void f(void) {
+ func(); /* { dg-warning "'func' is deprecated .declared at .*.: Do not use" } */
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/float-constant-double.c b/gcc/testsuite/gcc.dg/dfp/float-constant-double.c
new file mode 100644
index 00000000000..3f8de656bf6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/float-constant-double.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* Constant float values of type double in <float.h> are suffixed with L
+ and cast to double so they can be used within code that uses pragma
+ FLOAT_CONST_DECIMAL64. If they were not suffixed then use of the macro
+ would have them interpreted as _Decimal64, leading to errors when used
+ in expressions with other operands of type double. */
+
+#include <float.h>
+
+extern double a, b, c, d;
+
+void
+foo ()
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ a = 0.1d * DBL_MAX;
+ b = DBL_EPSILON * 10.0d;
+ c = DBL_MIN * 200.0d;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pr39986.c b/gcc/testsuite/gcc.dg/dfp/pr39986.c
new file mode 100644
index 00000000000..53bda3c824a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr39986.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* Check that the compiler generates the correct decimal float constants. */
+
+_Decimal32 a = 100.223df;
+_Decimal32 b = -2.3df;
+_Decimal64 c = 3.4e-4dd;
+_Decimal64 d = -4.500dd;
+_Decimal128 e = 5678901234567.89e+200dl;
+_Decimal128 f = -678901.234e-6dl;
+
+/* The first value is DPD, the second is BID. The order differs depending
+ on whether the target is big-endian or little-endian. */
+
+/* { dg-final { scan-assembler ".long\t(572653859|822183807)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(-1572863965|-1308622825)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(52|34)\n" } } */
+/* { dg-final { scan-assembler ".long\t(572784640|824180736)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(4736|4500)\n" } } */
+/* { dg-final { scan-assembler ".long\t(-1574174720|-1319108608)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(-1975952433|957645077)\n" } } */
+/* { dg-final { scan-assembler ".long\t(190215|132222)\n" } } */
+/* { dg-final { scan-assembler ".long\t(574193664|835452928)\n" } } */
+
+/* { dg-final { scan-assembler ".long\t(931280180|678901234)\n" } } */
+/* { dg-final { scan-assembler ".long\t(-1576681472|-1339162624)\n" } } */
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c
new file mode 100644
index 00000000000..79fabf34484
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-1.c
@@ -0,0 +1,85 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Verify that the pragma has the expected result by using unsuffixed
+ float constants as operands in expressions that would mix binary and
+ decimal operands if the pragma had no effect, or the wrong effect. */
+
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+double a = 1.0 * 2.0dd;
+
+double
+f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double b = 2.0 * 3.0d;
+
+ {
+ double c = 3.0 * 4.0d;
+ b = b + c;
+ }
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double d = 4.0 * 5.0dd;
+
+ b = b + d;
+ }
+
+ {
+ /* Default is OFF. */
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
+ double e = 5.0 * 6.0d;
+ b = b + e;
+ }
+
+ return b;
+}
+
+double
+f2 (void)
+{
+ /* Use value from outer scope, which is ON. */
+ double b = 2.0 * 3.0dd;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double c = 3.0 * 4.0d;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double d = 4.0 * 5.0dd;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
+ double e = 5.0 * 6.0d;
+
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double f = 6.0 * 7.0dd;
+
+ b = a + b + c + d + e + f;
+ }
+ }
+ }
+ }
+ return b;
+}
+
+/* Use previous value from this scope, which is ON. */
+double f = 6.0 * 7.0dd;
+
+double
+f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double b = 2.0 * 3.0d;
+
+ return b + f;
+}
+
+/* Return to the state from this scope, which is ON. */
+double g = 7.0 + 8.0dd;
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c
new file mode 100644
index 00000000000..212748c6c78
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-2.c
@@ -0,0 +1,86 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Verify that the pragma has the expected result by using unsuffixed
+ float constants as operands in expressions that would mix binary and
+ decimal operands if the pragma had no effect, or the wrong effect.
+ Use _Pragma rather than #pragma. */
+
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+double a = 1.0 * 2.0dd;
+
+double
+f1 (void)
+{
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF")
+ double b = 2.0 * 3.0d;
+
+ {
+ double c = 3.0 * 4.0d;
+ b = b + c;
+ }
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ double d = 4.0 * 5.0dd;
+
+ b = b + d;
+ }
+
+ {
+ /* Default is OFF. */
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT")
+ double e = 5.0 * 6.0d;
+ b = b + e;
+ }
+
+ return b;
+}
+
+double
+f2 (void)
+{
+ /* Use value from outer scope, which is ON. */
+ double b = 2.0 * 3.0dd;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF")
+ double c = 3.0 * 4.0d;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ double d = 4.0 * 5.0dd;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT")
+ double e = 5.0 * 6.0d;
+
+ {
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 ON")
+ double f = 6.0 * 7.0dd;
+
+ b = a + b + c + d + e + f;
+ }
+ }
+ }
+ }
+ return b;
+}
+
+/* Use previous value from this scope, which is ON. */
+double f = 6.0 * 7.0dd;
+
+double
+f3 (void)
+{
+_Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF")
+ double b = 2.0 * 3.0d;
+
+ return b + f;
+}
+
+/* Return to the state from this scope, which is ON. */
+double g = 7.0 + 8.0dd;
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c
new file mode 100644
index 00000000000..b9286aac11a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-3.c
@@ -0,0 +1,83 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New). */
+
+/* Check that defining macros whose names are the same as the tokens used
+ in the pragma doesn't affect use of the pragma. */
+
+#define ON YES
+#define OFF NO
+#define DEFAULT NOPE
+#define STDC OFFICIAL
+#define FLOAT_CONST_DECIMAL64 NEW_PRAGMA
+
+double a;
+
+void
+f1a (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ a = 1.0dd + 2.0;
+}
+
+void
+f1b (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ a = 2.0d + 3.0;
+}
+
+void
+f1c (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT
+ a = 3.0d + 4.0;
+}
+
+/* Check that a macro can be used for the entire pragma. */
+
+#define PRAGMA(x) _Pragma (#x)
+#define DEFAULT_FLOAT_IS_DECIMAL PRAGMA(STDC FLOAT_CONST_DECIMAL64 ON)
+#define DEFAULT_FLOAT_IS_BINARY PRAGMA(STDC FLOAT_CONST_DECIMAL64 OFF)
+
+void
+f2a (void)
+{
+ DEFAULT_FLOAT_IS_DECIMAL
+ a = 5.0 * 6.0dd;
+}
+
+void
+f2b (void)
+{
+ DEFAULT_FLOAT_IS_BINARY
+ a = 6.0 * 7.0d;
+}
+
+/* _Pragma can be used with macros, including the use of a macro for the
+ switch. */
+
+#undef ON
+#undef OFF
+#undef DEFAULT
+#undef STDC
+#undef FLOAT_CONST_DECIMAL64
+
+#define SWITCH ON
+#define FLOAT_CONST_DECIMAL64(x) PRAGMA(STDC FLOAT_CONST_DECIMAL64 x)
+
+void
+f3a (void)
+{
+ FLOAT_CONST_DECIMAL64(SWITCH)
+ a = 1.0 * 7.0dd;
+}
+
+void
+f3b (void)
+{
+ FLOAT_CONST_DECIMAL64(OFF)
+ a = 1.0 + 2.0d;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c
new file mode 100644
index 00000000000..86cec1dbd45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-4.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that malformed versions of pragma STDC FLOAT_CONST_DECIMAL64
+ are detected. */
+
+double a;
+
+void f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 /* { dg-warning "malformed" } */
+ a = 1.0;
+}
+
+void f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DFP /* { dg-warning "malformed" } */
+ a = 2.0;
+}
+
+void f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON DFP /* { dg-warning "junk at end" } */
+ a = 3.0;
+}
+
+void f4 (void)
+{
+ _Pragma ( "STDC FLOAT_CONST_DECIMAL64" ) /* { dg-warning "malformed" } */
+ a = 1.0;
+}
+
+void f5 (void)
+{
+ _Pragma ( "STDC FLOAT_CONST_DECIMAL64 DFP" ) /* { dg-warning "malformed" } */
+ a = 2.0;
+}
+
+void f6 (void)
+{
+ _Pragma ( "STDC FLOAT_CONST_DECIMAL64 ON DFP" ) /* { dg-warning "junk at end" } */
+ a = 3.0;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c
new file mode 100644
index 00000000000..75e9525dda0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-5.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that there is a pedantic warning for the use of pragma
+ STD FLOAT_CONST_DECIMAL64. */
+
+double a;
+
+void f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "ISO C" } */
+ a = 1.0;
+}
+
+void f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-warning "ISO C" } */
+ a = 2.0;
+}
+
+void f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT /* { dg-warning "ISO C" } */
+ a = 3.0;
+}
+
+void f4 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 ON") /* { dg-warning "ISO C" } */
+ a = 1.0;
+}
+
+void f5 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF") /* { dg-warning "ISO C" } */
+ a = 2.0;
+}
+
+void f6 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT") /* { dg-warning "ISO C" } */
+ a = 3.0;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c
new file mode 100644
index 00000000000..03c1715bee6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-6.c
@@ -0,0 +1,46 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -pedantic-errors" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that there is a pedantic error for the use of pragma
+ STD FLOAT_CONST_DECIMAL64. */
+
+double a;
+
+void f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "ISO C" } */
+ a = 1.0;
+}
+
+void f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-error "ISO C" } */
+ a = 2.0;
+}
+
+void f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT /* { dg-error "ISO C" } */
+ a = 3.0;
+}
+
+void f4 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 ON") /* { dg-error "ISO C" } */
+ a = 1.0;
+}
+
+void f5 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 OFF") /* { dg-error "ISO C" } */
+ a = 2.0;
+}
+
+void f6 (void)
+{
+ _Pragma ("STDC FLOAT_CONST_DECIMAL64 DEFAULT") /* { dg-error "ISO C" } */
+ a = 3.0;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c
new file mode 100644
index 00000000000..7533ee7f0de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-7.c
@@ -0,0 +1,39 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Check that when pragma FLOAT_CONST_DECIMAL64 is in effect so that
+ unsuffixed constants are _Decimal64, invalid types are still reported
+ as invalid. */
+
+double
+f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double a = 0x1.0p1;
+ double b = 1.0i;
+
+ return a + b;
+}
+
+double
+f2 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ double a = 0x1.0p1dd; /* { dg-error "with hex" } */
+ double b = 1.0idd; /* { dg-error "invalid suffix" } */
+
+ return a + b;
+}
+
+double
+f3 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ double a = 0x1.0p1; /* Hex constant is not affected by pragma. */
+ double b = 1.0i; /* Imaginary constant is not affected by pragma. */
+
+ return a + b;
+}
diff --git a/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c
new file mode 100644
index 00000000000..5dbbda5b8f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pragma-float-const-decimal64-8.c
@@ -0,0 +1,174 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -Wall" } */
+
+/* N1312 7.1.1: The FLOAT_CONST_DECIMAL64 pragma.
+ C99 6.4.4.2a (New).
+
+ Pragma STDC FLOAT_CONST_DECIMAL64 "shall occur either outside external
+ declarations or preceding all explicit declarations and statements
+ inside a compound statement." */
+
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+
+#define MAX 200
+
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+
+double a;
+
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+
+struct S1 {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ int i;
+ int j;
+};
+
+struct S2 {
+ int i;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ int j;
+};
+
+struct S3 {
+ int i;
+ int j;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+};
+
+enum E1 {
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+ one,
+ two
+};
+
+enum E2 {
+ red,
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+ blue
+};
+
+enum E3 {
+ cat,
+ dog
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+};
+
+double
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-error "#pragma" } */
+b;
+
+double
+f1 (void)
+{
+#pragma STDC FLOAT_CONST_DECIMAL64 ON
+ return a;
+}
+
+double
+f2 (void)
+{
+ double b;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ b = 0.5;
+ return a + b;
+}
+
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+
+double
+f3 (void)
+{
+ typedef double b32;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ b32 b = 0.5;
+ return b;
+}
+
+double
+f4 (int i)
+{
+top:
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-warning "invalid location" } */
+ if (i == 0)
+ return a;
+ a *= 2.;
+ i = 0;
+ goto top;
+}
+
+double
+f5 (int i)
+{
+ a = a * i;
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF /* { dg-warning "invalid location" } */
+ return a * 2.;
+}
+
+double
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+f6 (void)
+{
+ return a;
+}
+
+double
+f7
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-error "#pragma" } */
+(void) /* { dg-error "before" } */
+{
+ return a;
+}
+
+double
+f8 (void)
+{
+ {
+#pragma STDC FLOAT_CONST_DECIMAL64 OFF
+ }
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
+
+extern void foo9 (void *);
+
+double
+f9 (void)
+{
+ __label__ here;
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ foo9 (&&here);
+here:
+ return a;
+}
+
+double
+f10 (void)
+{
+ void foo10 (void)
+ {
+ a = 1.0;
+ }
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
+
+double
+f11 (void)
+{
+ __extension__
+ struct A {
+ struct { char a; };
+ char b;
+ };
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
+
+double
+f12 (void)
+{
+ __extension__ ({ a = 0.5; });
+#pragma STDC FLOAT_CONST_DECIMAL64 ON /* { dg-warning "invalid location" } */
+ return a;
+}
diff --git a/gcc/testsuite/gcc.dg/div-double-1.c b/gcc/testsuite/gcc.dg/div-double-1.c
index 0cb8268e868..f290ab06782 100644
--- a/gcc/testsuite/gcc.dg/div-double-1.c
+++ b/gcc/testsuite/gcc.dg/div-double-1.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-O2 -ffinite-math-only" } */
+/* { dg-require-effective-target double64plus } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/format/plus-1.c b/gcc/testsuite/gcc.dg/format/plus-1.c
index 0d8b62cd3c5..02a213d417d 100644
--- a/gcc/testsuite/gcc.dg/format/plus-1.c
+++ b/gcc/testsuite/gcc.dg/format/plus-1.c
@@ -15,9 +15,6 @@ foo (int i)
printf (3 + "%d\n"); /* { dg-warning "zero-length" "zero-length string" } */
printf ("%d\n" + i, i); /* { dg-warning "not a string" "non-constant addend" } */
printf ("%d\n" + 10); /* { dg-warning "not a string" "too large addend" } */
- /* { dg-warning "offset '10' outside bounds of constant string" "offset" { target *-*-* } 17 } */
printf ("%d\n" - 1, i); /* { dg-warning "not a string" "minus constant" } */
- /* { dg-warning "offset '-1' outside bounds of constant string" "offset" { target *-*-* } 19 } */
printf ("%d\n" + -1, i); /* { dg-warning "not a string" "negative addend" } */
- /* { dg-warning "offset '-1' outside bounds of constant string" "offset" { target *-*-* } 21 } */
}
diff --git a/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c b/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c
new file mode 100644
index 00000000000..049c34a20a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/incomplete-5.c
@@ -0,0 +1,8 @@
+/* ICE on unnamed field with incomplete enum type: PR 40032. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+struct A
+{
+ enum E : 8; /* { dg-warning "narrower than values of its type" } */
+ /* { dg-error "has incomplete type" "incomplete" { target *-*-* } 6 } */
+};
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
new file mode 100644
index 00000000000..93c0c5cb848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -0,0 +1,65 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# 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 3 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Test the functionality of the GCC plugin support
+
+load_lib target-supports.exp
+load_lib gcc-dg.exp
+
+global TESTING_IN_BUILD_TREE
+global ENABLE_PLUGIN
+
+# The plugin testcases currently only work when the build tree is available.
+# Also check whether the host supports plugins.
+if { ![info exists TESTING_IN_BUILD_TREE] || ![info exists ENABLE_PLUGIN] } {
+ return
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# The procedures in plugin-support.exp need these parameters.
+set default_flags $DEFAULT_CFLAGS
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Load support procs.
+load_lib plugin-support.exp
+
+# Specify the plugin source file and the associated test files in a list.
+# plugin_test_list={ {plugin1 test1 test2 ...} {plugin2 test1 ...} ... }
+set plugin_test_list [list \
+ { selfassign.c self-assign-test-1.c self-assign-test-2.c } ]
+
+foreach plugin_test $plugin_test_list {
+ # Replace each source file with its full-path name
+ for {set i 0} {$i < [llength $plugin_test]} {incr i} {
+ set basename [lindex $plugin_test $i]
+ set plugin_test [lreplace $plugin_test $i $i $srcdir/$subdir/$basename]
+ }
+ set plugin_src [lindex $plugin_test 0]
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $plugin_src] then {
+ continue
+ }
+ set plugin_input_tests [lreplace $plugin_test 0 0]
+ plugin-test-execute $plugin_src $plugin_input_tests
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/self-assign-test-1.c b/gcc/testsuite/gcc.dg/plugin/self-assign-test-1.c
new file mode 100644
index 00000000000..f6dc5240f1e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/self-assign-test-1.c
@@ -0,0 +1,23 @@
+/* Test the self-assignemnt detection plugin. */
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+struct Bar {
+ int b_;
+ int c_;
+};
+
+int g;
+
+int main()
+{
+ struct Bar *bar;
+ int x = x; /* { dg-warning "assigned to itself" } */
+ static int y;
+ struct Bar b_array[5];
+
+ b_array[x+g].b_ = b_array[x+g].b_; /* { dg-warning "self-assignment detected" } */
+ g = g; /* { dg-warning "assigned to itself" } */
+ y = y; /* { dg-warning "assigned to itself" } */
+ bar->b_ = bar->b_; /* { dg-warning "assigned to itself" } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/self-assign-test-2.c b/gcc/testsuite/gcc.dg/plugin/self-assign-test-2.c
new file mode 100644
index 00000000000..2ede371a69a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/self-assign-test-2.c
@@ -0,0 +1,23 @@
+/* Test the self-assignemnt detection plugin with the 'disable' argument. */
+/* { dg-do compile } */
+/* { dg-options "-O -fplugin-arg-selfassign-disable" } */
+
+struct Bar {
+ int b_;
+ int c_;
+};
+
+int g;
+
+int main()
+{
+ struct Bar *bar;
+ int x = x; /* { dg-bogus "assigned to itself" } */
+ static int y;
+ struct Bar b_array[5];
+
+ b_array[x+g].b_ = b_array[x+g].b_; /* { dg-bogus "self-assignment detected" } */
+ g = g; /* { dg-bogus "assigned to itself" } */
+ y = y; /* { dg-bogus "assigned to itself" } */
+ bar->b_ = bar->b_; /* { dg-bogus "assigned to itself" } */
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c
new file mode 100644
index 00000000000..6fbce83c01d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c
@@ -0,0 +1,365 @@
+/* This plugin contains an analysis pass that detects and warns about
+ self-assignment statements. */
+/* { dg-options "-O" } */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "toplev.h"
+#include "basic-block.h"
+#include "gimple.h"
+#include "tree.h"
+#include "tree-pass.h"
+#include "intl.h"
+#include "gcc-plugin.h"
+
+
+/* Indicate whether to check overloaded operator '=', which is performed by
+ default. To disable it, use -fplugin-arg-NAME-no-check-operator-eq. */
+bool check_operator_eq = true;
+
+/* Given a rhs EXPR of a gimple assign statement, if it is
+ - SSA_NAME : returns its var decl, or, if it is a temp variable,
+ returns the rhs of its SSA def statement.
+ - VAR_DECL, PARM_DECL, FIELD_DECL, or a reference expression :
+ returns EXPR itself.
+ - any other expression : returns NULL_TREE. */
+
+static tree
+get_real_ref_rhs (tree expr)
+{
+ switch (TREE_CODE (expr))
+ {
+ case SSA_NAME:
+ {
+ /* Given a self-assign statement, say foo.x = foo.x,
+ the IR (after SSA) looks like:
+
+ D.1797_14 = foo.x;
+ foo.x ={v} D.1797_14;
+
+ So if the rhs EXPR is an SSA_NAME of a temp variable,
+ e.g. D.1797_14, we need to grab the rhs of its SSA def
+ statement (i.e. foo.x). */
+ tree vdecl = SSA_NAME_VAR (expr);
+ if (DECL_ARTIFICIAL (vdecl)
+ && !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (expr);
+ /* We are only interested in an assignment with a single
+ rhs operand because if it is not, the original assignment
+ will not possibly be a self-assignment. */
+ if (is_gimple_assign (def_stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
+ == GIMPLE_SINGLE_RHS))
+ return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt));
+ else
+ return NULL_TREE;
+ }
+ else
+ return vdecl;
+ }
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ case COMPONENT_REF:
+ case INDIRECT_REF:
+ case ARRAY_REF:
+ return expr;
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Given an expression tree, EXPR, that may contains SSA names, returns an
+ equivalent tree with the SSA names converted to var/parm/field decls
+ so that it can be used with '%E' format modifier when emitting warning
+ messages.
+
+ This function currently only supports VAR/PARM/FIELD_DECL, reference
+ expressions (COMPONENT_REF, INDIRECT_REF, ARRAY_REF), integer constant,
+ and SSA_NAME. If EXPR contains any other tree nodes (e.g. an arithmetic
+ expression appears in array index), NULL_TREE is returned. */
+
+static tree
+get_non_ssa_expr (tree expr)
+{
+ switch (TREE_CODE (expr))
+ {
+ case VAR_DECL:
+ case PARM_DECL:
+ case FIELD_DECL:
+ {
+ if (DECL_NAME (expr))
+ return expr;
+ else
+ return NULL_TREE;
+ }
+ case COMPONENT_REF:
+ {
+ tree base, orig_base = TREE_OPERAND (expr, 0);
+ tree component, orig_component = TREE_OPERAND (expr, 1);
+ base = get_non_ssa_expr (orig_base);
+ if (!base)
+ return NULL_TREE;
+ component = get_non_ssa_expr (orig_component);
+ if (!component)
+ return NULL_TREE;
+ /* If either BASE or COMPONENT is converted, build a new
+ component reference tree. */
+ if (base != orig_base || component != orig_component)
+ return build3 (COMPONENT_REF, TREE_TYPE (component),
+ base, component, NULL_TREE);
+ else
+ return expr;
+ }
+ case INDIRECT_REF:
+ {
+ tree orig_base = TREE_OPERAND (expr, 0);
+ tree base = get_non_ssa_expr (orig_base);
+ if (!base)
+ return NULL_TREE;
+ /* If BASE is converted, build a new indirect reference tree. */
+ if (base != orig_base)
+ return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base);
+ else
+ return expr;
+ }
+ case ARRAY_REF:
+ {
+ tree array, orig_array = TREE_OPERAND (expr, 0);
+ tree index, orig_index = TREE_OPERAND (expr, 1);
+ array = get_non_ssa_expr (orig_array);
+ if (!array)
+ return NULL_TREE;
+ index = get_non_ssa_expr (orig_index);
+ if (!index)
+ return NULL_TREE;
+ /* If either ARRAY or INDEX is converted, build a new array
+ reference tree. */
+ if (array != orig_array || index != orig_index)
+ return build4 (ARRAY_REF, TREE_TYPE (expr), array, index,
+ TREE_OPERAND (expr, 2), TREE_OPERAND (expr, 3));
+ else
+ return expr;
+ }
+ case SSA_NAME:
+ {
+ tree vdecl = SSA_NAME_VAR (expr);
+ if (DECL_ARTIFICIAL (vdecl)
+ && !gimple_nop_p (SSA_NAME_DEF_STMT (expr)))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (expr);
+ if (is_gimple_assign (def_stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt))
+ == GIMPLE_SINGLE_RHS))
+ vdecl = gimple_assign_rhs1 (def_stmt);
+ }
+ return get_non_ssa_expr (vdecl);
+ }
+ case INTEGER_CST:
+ return expr;
+ default:
+ /* Return NULL_TREE for any other kind of tree nodes. */
+ return NULL_TREE;
+ }
+}
+
+/* Given the LHS and (real) RHS of a gimple assign statement, STMT, check if
+ they are the same. If so, print a warning message about self-assignment. */
+
+static void
+compare_and_warn (gimple stmt, tree lhs, tree rhs)
+{
+ if (operand_equal_p (lhs, rhs, OEP_PURE_SAME))
+ {
+ location_t location;
+ location = (gimple_has_location (stmt)
+ ? gimple_location (stmt)
+ : (DECL_P (lhs)
+ ? DECL_SOURCE_LOCATION (lhs)
+ : input_location));
+ /* If LHS contains any tree node not currently supported by
+ get_non_ssa_expr, simply emit a generic warning without
+ specifying LHS in the message. */
+ lhs = get_non_ssa_expr (lhs);
+ if (lhs)
+ warning (0, G_("%H%qE is assigned to itself"), &location, lhs);
+ else
+ warning (0, G_("%Hself-assignment detected"), &location);
+ }
+}
+
+/* Check and warn if STMT is a self-assign statement. */
+
+static void
+warn_self_assign (gimple stmt)
+{
+ tree rhs, lhs;
+
+ /* Check assigment statement. */
+ if (is_gimple_assign (stmt)
+ && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))
+ == GIMPLE_SINGLE_RHS))
+ {
+ rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt));
+ if (!rhs)
+ return;
+
+ lhs = gimple_assign_lhs (stmt);
+ if (TREE_CODE (lhs) == SSA_NAME)
+ {
+ lhs = SSA_NAME_VAR (lhs);
+ if (DECL_ARTIFICIAL (lhs))
+ return;
+ }
+
+ compare_and_warn (stmt, lhs, rhs);
+ }
+ /* Check overloaded operator '=' (if enabled). */
+ else if (check_operator_eq && is_gimple_call (stmt))
+ {
+ tree fdecl = gimple_call_fndecl (stmt);
+ if (fdecl && (DECL_NAME (fdecl) == maybe_get_identifier ("operator=")))
+ {
+ /* If 'operator=' takes reference operands, the arguments will be
+ ADDR_EXPR trees. In this case, just remove the address-taken
+ operator before we compare the lhs and rhs. */
+ lhs = gimple_call_arg (stmt, 0);
+ if (TREE_CODE (lhs) == ADDR_EXPR)
+ lhs = TREE_OPERAND (lhs, 0);
+ rhs = gimple_call_arg (stmt, 1);
+ if (TREE_CODE (rhs) == ADDR_EXPR)
+ rhs = TREE_OPERAND (rhs, 0);
+
+ compare_and_warn (stmt, lhs, rhs);
+ }
+ }
+}
+
+/* Entry point for the self-assignment detection pass. */
+
+static unsigned int
+execute_warn_self_assign (void)
+{
+ gimple_stmt_iterator gsi;
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ {
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ warn_self_assign (gsi_stmt (gsi));
+ }
+
+ return 0;
+}
+
+/* Pass gate function. Currently always returns true. */
+
+static bool
+gate_warn_self_assign (void)
+{
+ return true;
+}
+
+static struct gimple_opt_pass pass_warn_self_assign =
+{
+ {
+ GIMPLE_PASS,
+ "warn_self_assign", /* name */
+ gate_warn_self_assign, /* gate */
+ execute_warn_self_assign, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+ }
+};
+
+/* The initialization routine exposed to and called by GCC. The spec of this
+ function is defined in gcc/gcc-plugin.h.
+
+ PLUGIN_NAME - name of the plugin (useful for error reporting)
+ ARGC - the size of the ARGV array
+ ARGV - an array of key-value argument pair
+
+ Returns 0 if initialization finishes successfully.
+
+ Note that this function needs to be named exactly "plugin_init". */
+
+int
+plugin_init (const char *plugin_name, struct plugin_gcc_version *version,
+ int argc, struct plugin_argument *argv)
+{
+ struct plugin_pass pass_info;
+ bool enabled = true;
+ int i;
+
+ if (!plugin_default_version_check (version, version))
+ return 1;
+
+ /* Self-assign detection should happen after SSA is constructed. */
+ pass_info.pass = &pass_warn_self_assign.pass;
+ pass_info.reference_pass_name = "ssa";
+ pass_info.ref_pass_instance_number = 1;
+ pass_info.pos_op = PASS_POS_INSERT_AFTER;
+
+ /* Process the plugin arguments. This plugin takes the following arguments:
+ check-operator-eq, no-check-operator-eq, enable, and disable.
+ By default, the analysis is enabled with 'operator=' checked. */
+ for (i = 0; i < argc; ++i)
+ {
+ if (!strcmp (argv[i].key, "check-operator-eq"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-check-operator-eq=%s'"
+ " ignored (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ check_operator_eq = true;
+ }
+ else if (!strcmp (argv[i].key, "no-check-operator-eq"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-no-check-operator-eq=%s'"
+ " ignored (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ check_operator_eq = false;
+ }
+ else if (!strcmp (argv[i].key, "enable"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-enable=%s' ignored"
+ " (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ enabled = true;
+ }
+ else if (!strcmp (argv[i].key, "disable"))
+ {
+ if (argv[i].value)
+ warning (0, G_("option '-fplugin-arg-%s-disable=%s' ignored"
+ " (superfluous '=%s')"),
+ plugin_name, argv[i].value, argv[i].value);
+ else
+ enabled = false;
+ }
+ else
+ warning (0, G_("plugin %qs: unrecognized argument %qs ignored"),
+ plugin_name, argv[i].key);
+ }
+
+ /* Register this new pass with GCC if the analysis is enabled. */
+ if (enabled)
+ register_callback (plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL,
+ &pass_info);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr35652.c b/gcc/testsuite/gcc.dg/pr35652.c
deleted file mode 100644
index 50ec3acf10a..00000000000
--- a/gcc/testsuite/gcc.dg/pr35652.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* PR c++/35652: wrong location and duplicated warning.
- { dg-do compile }
- { dg-options "" } */
-int bar()
-{
- const char *s = 'z' + "y"; /* { dg-warning "offset '122' outside bounds of constant string" } */
-}
-
-int g()
-{
- char str[2];
- const char *p = str + sizeof(str);
-}
diff --git a/gcc/testsuite/gcc.dg/pr39323-2.c b/gcc/testsuite/gcc.dg/pr39323-2.c
index 2eaa6e96e73..9304c74bc4f 100644
--- a/gcc/testsuite/gcc.dg/pr39323-2.c
+++ b/gcc/testsuite/gcc.dg/pr39323-2.c
@@ -3,4 +3,4 @@
int bar __attribute__ ((aligned(1 << 28))) = 20;
-/* { dg-final { scan-assembler "\.align\[\\t \]*268435456" } } */
+/* { dg-final { scan-assembler ".align\[ \t\]+(268435456|28)\[ \t\]*\n" } } */
diff --git a/gcc/testsuite/gcc.dg/pr39323-3.c b/gcc/testsuite/gcc.dg/pr39323-3.c
index cbfed9dbcef..c045f17c832 100644
--- a/gcc/testsuite/gcc.dg/pr39323-3.c
+++ b/gcc/testsuite/gcc.dg/pr39323-3.c
@@ -4,4 +4,4 @@
typedef int __attribute__ ((aligned(1 << 28))) int28;
int28 foo = 20;
-/* { dg-final { scan-assembler "\.align\[\\t \]*268435456" } } */
+/* { dg-final { scan-assembler ".align\[ \t\]+(268435456|28)\[ \t\]*\n" } } */
diff --git a/gcc/testsuite/gcc.dg/pr39565.c b/gcc/testsuite/gcc.dg/pr39565.c
new file mode 100644
index 00000000000..9c14055a43a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr39565.c
@@ -0,0 +1,48 @@
+/* PR39565: Static variable leaves undefined symbol in object file.
+ Variables codestrs_4 and codestrs_8 should not be undefined,
+ when this program is compiled at -O2. As a basic sanity test,
+ verify that this program compiles into an executable and runs. */
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+extern void exit (int);
+extern int strcmp (const char *, const char *);
+
+static const union codestrs_t_4 {
+ struct {
+ char str_2[sizeof ("Illegal opcode")];
+ };
+ char str[0];
+} codestrs_4 = { {"Illegal opcode"} };
+
+static const union codestrs_t_8 {
+ struct {
+ char str_12[sizeof ("Integer divide by zero")];
+ };
+ char str[0];
+} codestrs_8 = { {"Integer divide by zero"} };
+
+const char *
+psiginfo (int pinfo)
+{
+ const char *base = ((void *)0);
+
+ switch (pinfo)
+ {
+ case 4: base = codestrs_4.str; break;
+ case 8: base = codestrs_8.str; break;
+ }
+ return base;
+}
+
+int
+main (void)
+{
+ if (strcmp (psiginfo (4), codestrs_4.str))
+ abort ();
+ if (strcmp (psiginfo (8), codestrs_8.str))
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/pr39666-1.c b/gcc/testsuite/gcc.dg/pr39666-1.c
new file mode 100644
index 00000000000..f1ba499c331
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr39666-1.c
@@ -0,0 +1,22 @@
+/* PR middle-end/39666 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+int
+foo (int i)
+{
+ int j;
+ switch (i)
+ {
+ case -__INT_MAX__ - 1 ... -1:
+ j = 6;
+ break;
+ case 0:
+ j = 5;
+ break;
+ case 1 ... __INT_MAX__:
+ j = 4;
+ break;
+ }
+ return j;
+}
diff --git a/gcc/testsuite/gcc.dg/pr39666-2.c b/gcc/testsuite/gcc.dg/pr39666-2.c
new file mode 100644
index 00000000000..e4ef1d5d2b7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr39666-2.c
@@ -0,0 +1,22 @@
+/* PR middle-end/39666 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+int
+foo (int i)
+{
+ int j; /* { dg-warning "may be used uninitialized" } */
+ switch (i)
+ {
+ case -__INT_MAX__ - 1 ... -1:
+ j = 6;
+ break;
+ case 0:
+ j = 5;
+ break;
+ case 2 ... __INT_MAX__:
+ j = 4;
+ break;
+ }
+ return j;
+}
diff --git a/gcc/testsuite/gcc.dg/pthread-init-1.c b/gcc/testsuite/gcc.dg/pthread-init-1.c
index 2f78844fe1f..8b600c3fb87 100644
--- a/gcc/testsuite/gcc.dg/pthread-init-1.c
+++ b/gcc/testsuite/gcc.dg/pthread-init-1.c
@@ -7,6 +7,9 @@
/* { dg-do compile } */
/* { dg-require-effective-target pthread_h } */
/* { dg-options "-Wextra -Wall" } */
+/* The RTP definition of PTHREAD_MUTEX_INITIALIZER is missing an
+ * initializer for mutexAttr.mutexAttrType. */
+/* { dg-xfail-if "missing initializer" { vxworks_rtp } } */
#include "pthread-init-common.h"
diff --git a/gcc/testsuite/gcc.dg/sms-1.c b/gcc/testsuite/gcc.dg/sms-1.c
index d915ef54f2b..26e502e2cca 100644
--- a/gcc/testsuite/gcc.dg/sms-1.c
+++ b/gcc/testsuite/gcc.dg/sms-1.c
@@ -1,13 +1,16 @@
/* The same test as loop-3c.c. It failed on ia64
due to not handling of subreg in the lhs that is fixed. */
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -w" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
#include <limits.h>
+extern void abort (void);
void * a[255];
+__attribute__ ((noinline))
+void
f (m)
{
int i;
@@ -21,6 +24,7 @@ f (m)
while (i < INT_MAX/2 + 1 + 4 * 4);
}
+int
main ()
{
a[0x10] = 0;
@@ -33,6 +37,9 @@ main ()
f (INT_MAX/2 + 1);
if (! a[0x10] || a[0x08])
abort ();
- exit (0);
+ return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* spu-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "sms" } } */
+
diff --git a/gcc/testsuite/gcc.dg/sms-2.c b/gcc/testsuite/gcc.dg/sms-2.c
index 04d0482ca8c..9ea63bd0f41 100644
--- a/gcc/testsuite/gcc.dg/sms-2.c
+++ b/gcc/testsuite/gcc.dg/sms-2.c
@@ -33,4 +33,5 @@ fun (nb)
}
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* powerpc*-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-3.c b/gcc/testsuite/gcc.dg/sms-3.c
index 66792b5993b..b78c2b27ee5 100644
--- a/gcc/testsuite/gcc.dg/sms-3.c
+++ b/gcc/testsuite/gcc.dg/sms-3.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -funroll-loops" } */
+/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms" } */
extern void abort (void);
@@ -8,6 +8,7 @@ int Y[1000]={0};
extern void abort (void);
+__attribute__ ((noinline))
int
foo (int len, long a)
{
@@ -37,3 +38,6 @@ main ()
return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* powerpc*-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "sms" } } */
+
diff --git a/gcc/testsuite/gcc.dg/sms-4.c b/gcc/testsuite/gcc.dg/sms-4.c
index 04e89bb2572..eafb395627d 100644
--- a/gcc/testsuite/gcc.dg/sms-4.c
+++ b/gcc/testsuite/gcc.dg/sms-4.c
@@ -1,6 +1,6 @@
/* Inspired from sbitmap_a_or_b_and_c_cg function in sbitmap.c. */
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
extern void abort (void);
@@ -9,6 +9,7 @@ int b[5] = { 0, 1, 0, 1, 0 };
int c[5] = { 0, 0, 1, 1, 0 };
int dst[5] = { 0, 0, 0, 0, 0 };
+__attribute__ ((noinline))
void
foo (int size, int *ap, int *bp, int *cp, int *dstp)
{
@@ -33,3 +34,6 @@ main ()
return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* powerpc*-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "sms" } } */
+
diff --git a/gcc/testsuite/gcc.dg/sms-5.c b/gcc/testsuite/gcc.dg/sms-5.c
index 9c2e0165c56..6fbb612e385 100644
--- a/gcc/testsuite/gcc.dg/sms-5.c
+++ b/gcc/testsuite/gcc.dg/sms-5.c
@@ -1,10 +1,11 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -funroll-loops" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -funroll-loops -fdump-rtl-sms" } */
/* This is the same test as loop-2e.c test. It is related to a fix in
the generation of the prolog and epilog. */
extern void abort (void);
+__attribute__ ((noinline))
void f (int *p, int **q)
{
int i;
@@ -45,3 +46,7 @@ int main ()
return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* spu-*-* } } } */
+
+/* { dg-final { cleanup-rtl-dump "sms" } } */
+
diff --git a/gcc/testsuite/gcc.dg/sms-6.c b/gcc/testsuite/gcc.dg/sms-6.c
index 3fe8ecda167..cd6356530a8 100644
--- a/gcc/testsuite/gcc.dg/sms-6.c
+++ b/gcc/testsuite/gcc.dg/sms-6.c
@@ -1,8 +1,9 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched " } */
+/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms" } */
extern void abort (void);
+__attribute__ ((noinline))
void foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c)
{
int i;
@@ -37,4 +38,7 @@ int main()
return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-7.c b/gcc/testsuite/gcc.dg/sms-7.c
index 7c4810d8610..a0aa14b1561 100644
--- a/gcc/testsuite/gcc.dg/sms-7.c
+++ b/gcc/testsuite/gcc.dg/sms-7.c
@@ -1,8 +1,9 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fstrict-aliasing " } */
+/* { dg-options "-O2 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms" } */
extern void abort (void);
+__attribute__ ((noinline))
void foo (int * __restrict__ a, int * __restrict__ b, short * c)
{
int i;
@@ -38,4 +39,7 @@ int main()
return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-antideps.c b/gcc/testsuite/gcc.dg/sms-8.c
index 85976d641de..afac55dadd1 100644
--- a/gcc/testsuite/gcc.dg/sms-antideps.c
+++ b/gcc/testsuite/gcc.dg/sms-8.c
@@ -3,10 +3,11 @@
that was not fixed by reg-moves. */
/* { dg-do run } */
- /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves" } */
+ /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
-#include <stdlib.h>
+extern void abort (void);
+__attribute__ ((noinline))
unsigned long long
foo (long long ixi, unsigned ctr)
{
@@ -34,5 +35,7 @@ main ()
return 0;
}
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/ssp-1.c b/gcc/testsuite/gcc.dg/ssp-1.c
index e71522bbfd3..5467f4dc36c 100644
--- a/gcc/testsuite/gcc.dg/ssp-1.c
+++ b/gcc/testsuite/gcc.dg/ssp-1.c
@@ -4,7 +4,7 @@
#include <stdlib.h>
-static void
+void
__stack_chk_fail (void)
{
exit (0); /* pass */
diff --git a/gcc/testsuite/gcc.dg/tls/alias-1.c b/gcc/testsuite/gcc.dg/tls/alias-1.c
index 28cb47e5041..722ad2154bb 100644
--- a/gcc/testsuite/gcc.dg/tls/alias-1.c
+++ b/gcc/testsuite/gcc.dg/tls/alias-1.c
@@ -1,7 +1,7 @@
/* { dg-do link } */
/* { dg-require-alias "" } */
/* { dg-require-visibility "" } */
-/* { dg-require-effective-target tls } */
+/* { dg-require-effective-target tls_runtime } */
/* Test that encode_section_info handles the change from externally
defined to locally defined (via hidden). Extracted from glibc. */
diff --git a/gcc/testsuite/gcc.dg/tls/opt-2.c b/gcc/testsuite/gcc.dg/tls/opt-2.c
index 8038d1c6ffb..0980fab612e 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-2.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-2.c
@@ -6,6 +6,7 @@
/* { dg-options "-O2 -ftls-model=initial-exec" } */
/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
/* { dg-require-effective-target tls_native } */
+/* { dg-require-effective-target tls_runtime } */
__thread int thr;
diff --git a/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c b/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c
index b935f134499..d3a14b24cdc 100644
--- a/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c
+++ b/gcc/testsuite/gcc.dg/torture/asm-subreg-1.c
@@ -1,7 +1,7 @@
/* PR middle-end/20491 */
/* { dg-do compile } */
-/* { dg-skip-if "" { hppa*64*-*-* } "*" "" } */
+/* { dg-skip-if "" { hppa*64*-*-* || sparc-*-vxworks* } "*" "" } */
/* Combine used to introduce invalid subregs for the asm input, and
we'd crash later on, when removing all subregs. */
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-add.c b/gcc/testsuite/gcc.dg/torture/complex-sign-add.c
new file mode 100644
index 00000000000..db921406671
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-add.c
@@ -0,0 +1,53 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ addition. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, +, -, -, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, +, -, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -, -); \
+ } while (0)
+
+void
+check_add_float (void)
+{
+ CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
+}
+
+void
+check_add_double (void)
+{
+ CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_add_long_double (void)
+{
+ CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_add_float ();
+ check_add_double ();
+ check_add_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-add.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-add.c
new file mode 100644
index 00000000000..5548fe431e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-add.c
@@ -0,0 +1,53 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ addition. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, -, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, -, ZERO, -, -); \
+ } while (0)
+
+void
+check_add_float (void)
+{
+ CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
+}
+
+void
+check_add_double (void)
+{
+ CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_add_long_double (void)
+{
+ CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_add_float ();
+ check_add_double ();
+ check_add_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-div.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-div.c
new file mode 100644
index 00000000000..4a315dcd529
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-div.c
@@ -0,0 +1,45 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ division. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_DIV(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, +, ONE, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, +, -, ONE, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, +, ONE, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, +, -, -, ONE, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, +, ONE, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, +, -, ONE, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, +, ONE, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, /, -, -, -, ONE, +, +); \
+ } while (0)
+
+void
+check_div_float (void)
+{
+ CHECK_DIV (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+}
+
+void
+check_div_double (void)
+{
+ CHECK_DIV (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_div_long_double (void)
+{
+ CHECK_DIV (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_div_float ();
+ check_div_double ();
+ check_div_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-mul.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-mul.c
new file mode 100644
index 00000000000..f5b1fc47e20
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-mul.c
@@ -0,0 +1,53 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ multiplication. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, +, -, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, +, -, -, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, +, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, +, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, +, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, *, -, -, -, ZERO, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if);
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-sub.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-sub.c
new file mode 100644
index 00000000000..adc384548c6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mixed-sub.c
@@ -0,0 +1,53 @@
+/* Test complex arithmetic with signed zeros. Mixed real/complex
+ subtraction. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -); \
+ CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, +, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, +, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, +, -, -, ZERO, +, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, +, ZERO, -, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, +, -, ZERO, +, +); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, +, ZERO, -, -); \
+ CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, -, -, -, -, ZERO, +, -); \
+ } while (0)
+
+void
+check_sub_float (void)
+{
+ CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
+}
+
+void
+check_sub_double (void)
+{
+ CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_sub_long_double (void)
+{
+ CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_sub_float ();
+ check_sub_double ();
+ check_sub_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mul-minus-one.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mul-minus-one.c
new file mode 100644
index 00000000000..6b9a905ae9c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mul-minus-one.c
@@ -0,0 +1,61 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication with -1.0 + 0.0i. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = -ONE + ZEROI; \
+ c1 = a1 * b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ c1 = a1 * (-ONE + ZEROI); \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = -ONE + ZEROI; \
+ c2 = a2 * b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ c2 = a2 * (-ONE + ZEROI); \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, -, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, +, -); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mul-one.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mul-one.c
new file mode 100644
index 00000000000..9d1d6c7ce10
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mul-one.c
@@ -0,0 +1,61 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication with 1.0 + 0.0i. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = ONE + ZEROI; \
+ c1 = a1 * b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ c1 = a1 * (ONE + ZEROI); \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = ONE + ZEROI; \
+ c2 = a2 * b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ c2 = a2 * (ONE + ZEROI); \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
+ do { \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \
+ CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-mul.c b/gcc/testsuite/gcc.dg/torture/complex-sign-mul.c
new file mode 100644
index 00000000000..d9a06a5359b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-mul.c
@@ -0,0 +1,53 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ multiplication. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_MUL(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, +, -, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, +, -, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, +, -, -, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, *, -, -, -, -, +, +); \
+ } while (0)
+
+void
+check_mul_float (void)
+{
+ CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if);
+}
+
+void
+check_mul_double (void)
+{
+ CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_mul_long_double (void)
+{
+ CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_mul_float ();
+ check_mul_double ();
+ check_mul_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign-sub.c b/gcc/testsuite/gcc.dg/torture/complex-sign-sub.c
new file mode 100644
index 00000000000..94ab17d7fc6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign-sub.c
@@ -0,0 +1,53 @@
+/* Test complex arithmetic with signed zeros. Pure complex
+ subtraction. */
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include "complex-sign.h"
+
+#define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
+ do { \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, +, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, +, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, -, -, +); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +, -); \
+ CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, -, +, +); \
+ } while (0)
+
+void
+check_sub_float (void)
+{
+ CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
+}
+
+void
+check_sub_double (void)
+{
+ CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
+}
+
+void
+check_sub_long_double (void)
+{
+ CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
+}
+
+int
+main (void)
+{
+ check_sub_float ();
+ check_sub_double ();
+ check_sub_long_double ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/complex-sign.h b/gcc/testsuite/gcc.dg/torture/complex-sign.h
new file mode 100644
index 00000000000..f12e25d656f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/complex-sign.h
@@ -0,0 +1,74 @@
+/* Common header for complex arithmetic sign tests. */
+
+extern void abort (void);
+extern void exit (int);
+
+#define CHECK_RES(VALUE, COPY, SIGN_REAL, SIGN_IMAG) \
+ do { \
+ if ((VALUE) != 0 \
+ || COPY (1.0, __real__ (VALUE)) != SIGN_REAL 1.0 \
+ || COPY (1.0, __imag__ (VALUE)) != SIGN_IMAG 1.0) \
+ abort (); \
+ } while (0)
+
+/* This definition is intended to work with or without imaginary
+ types, as long as mixed real/complex arithmetic is handled
+ correctly. */
+#define ENCODE(ZERO, ZEROI, SA, SB) \
+ (SA 1 == 1 \
+ ? SB 1 == 1 ? ZERO + ZEROI : ZERO - ZEROI \
+ : SB 1 == 1 ? -(ZERO - ZEROI) : -(ZERO + ZEROI))
+
+#define CHECK_ARITH(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, S4, SR, SI) \
+ do { \
+ _Complex TYPE a1, b1, c1; \
+ volatile _Complex TYPE a2, b2, c2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b1, COPY, S3, S4); \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b2, COPY, S3, S4); \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_ARITH_RC(TYPE, COPY, ZERO, ZEROI, OP, S1, S3, S4, SR, SI) \
+ do { \
+ TYPE a1; \
+ _Complex TYPE b1, c1; \
+ volatile TYPE a2; \
+ volatile _Complex TYPE b2, c2; \
+ a1 = S1 ZERO; \
+ b1 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b1, COPY, S3, S4); \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = S1 ZERO; \
+ b2 = ENCODE(ZERO, ZEROI, S3, S4); \
+ CHECK_RES (b2, COPY, S3, S4); \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
+
+#define CHECK_ARITH_CR(TYPE, COPY, ZERO, ZEROI, OP, S1, S2, S3, V3, SR, SI) \
+ do { \
+ _Complex TYPE a1, c1; \
+ TYPE b1; \
+ volatile _Complex TYPE a2, c2; \
+ volatile TYPE b2; \
+ a1 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a1, COPY, S1, S2); \
+ b1 = S3 V3; \
+ c1 = a1 OP b1; \
+ CHECK_RES (c1, COPY, SR, SI); \
+ a2 = ENCODE(ZERO, ZEROI, S1, S2); \
+ CHECK_RES (a2, COPY, S1, S2); \
+ b2 = S3 V3; \
+ c2 = a2 OP b2; \
+ CHECK_RES (c2, COPY, SR, SI); \
+ } while (0)
diff --git a/gcc/testsuite/gcc.dg/torture/pr39903-1.c b/gcc/testsuite/gcc.dg/torture/pr39903-1.c
new file mode 100644
index 00000000000..1a67dd79538
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr39903-1.c
@@ -0,0 +1,24 @@
+/* PR target/39903 */
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi" } */
+
+struct X {
+ double d;
+ double b[];
+};
+
+struct X __attribute__((noinline))
+foo (double d)
+{
+ struct X x;
+ x.d = d;
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ struct X x = foo(3.0);
+ if (x.d != 3.0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr39903-2.c b/gcc/testsuite/gcc.dg/torture/pr39903-2.c
new file mode 100644
index 00000000000..0cd74029b6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr39903-2.c
@@ -0,0 +1,24 @@
+/* PR target/39903 */
+/* { dg-do run } */
+/* { dg-options "-Wno-psabi" } */
+
+struct X {
+ float d;
+ float b[];
+};
+
+struct X __attribute__((noinline))
+foo (float d)
+{
+ struct X x;
+ x.d = d;
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ struct X x = foo(3.0);
+ if (x.d != 3.0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/trampoline-1.c b/gcc/testsuite/gcc.dg/trampoline-1.c
index e3dcf573a94..37a582c5703 100644
--- a/gcc/testsuite/gcc.dg/trampoline-1.c
+++ b/gcc/testsuite/gcc.dg/trampoline-1.c
@@ -5,6 +5,8 @@
/* { dg-require-effective-target trampolines } */
/* { dg-options "-O2" } */
+#ifndef NO_TRAMPOLINES
+
/* This used to fail on various versions of Solaris 2 because the
trampoline couldn't be made executable. */
@@ -44,9 +46,12 @@ void foo (void)
abort();
}
}
+#endif
int main (void)
{
+#ifndef NO_TRAMPOLINES
foo ();
+#endif
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c
index 397036f25b9..0225d58a48c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20030714-1.c
@@ -15,7 +15,7 @@ struct rtx_def
unsigned frame_related:1;
};
-rtx
+static rtx
find_base_value (src)
rtx src;
{
@@ -33,6 +33,12 @@ find_base_value (src)
find_base_value (src_1);
}
+rtx
+find_base_value_wrapper (src)
+ rtx src;
+{
+ return find_base_value (src);
+}
/* There should be no casts to short unsigned int. */
/* { dg-final { scan-tree-dump-times "\\(short unsigned int\\)" 0 "dom2"} } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-10.c b/gcc/testsuite/gcc.dg/ucnid-10.c
new file mode 100644
index 00000000000..39148108b33
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-10.c
@@ -0,0 +1,8 @@
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+ locale). Test #pragma pack diagnostics. */
+/* { dg-do compile { target *-*-linux* *-*-cygwin* powerpc*-*-eabi* } } */
+/* { dg-options "-std=gnu99 -fextended-identifiers" } */
+
+#pragma pack(push)
+#pragma pack(pop, \u00f3) /* { dg-warning "pop, \\\\U000000f3.*push, \\\\U000000f3" } */
+#pragma pack(\u00e7) /* { dg-warning "unknown action '\\\\U000000e7'" } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-11.c b/gcc/testsuite/gcc.dg/ucnid-11.c
new file mode 100644
index 00000000000..b4063306857
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-11.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-xfail-if "" { powerpc-ibm-aix* *-*-solaris2.* } { "*" } { "" } } */
+/* { dg-options "-std=c99 -fextended-identifiers -fdata-sections" } */
+
+#include "ucnid-3.c"
diff --git a/gcc/testsuite/gcc.dg/ucnid-12.c b/gcc/testsuite/gcc.dg/ucnid-12.c
new file mode 100644
index 00000000000..6c8789236b0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-12.c
@@ -0,0 +1,5 @@
+/* { dg-do run } */
+/* { dg-xfail-if "" { powerpc-ibm-aix* *-*-solaris2.* } { "*" } { "" } } */
+/* { dg-options "-std=c99 -fextended-identifiers -ffunction-sections" } */
+
+#include "ucnid-4.c"
diff --git a/gcc/testsuite/gcc.dg/ucnid-13.c b/gcc/testsuite/gcc.dg/ucnid-13.c
new file mode 100644
index 00000000000..8ec69fa3b93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-13.c
@@ -0,0 +1,13 @@
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+ locale). Miscellaneous diagnostics. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fextended-identifiers -Wpacked" } */
+
+int a __attribute__((\u00c0)); /* { dg-warning "'\\\\U000000c0' attribute directive ignored" } */
+
+extern void \u00c1 (void) __attribute__((deprecated));
+void g (void) { \u00c1 (); } /* { dg-warning "'\\\\U000000c1' is deprecated" } */
+
+struct \u00c2 { char c; } __attribute__((packed)); /* { dg-warning "'\\\\U000000c2'" } */
+
+void h (void) { asm ("%[\u00c3]" : : ); } /* { dg-error "undefined named operand '\\\\U000000c3'" } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-6.c b/gcc/testsuite/gcc.dg/ucnid-6.c
index 37433a1ebf2..5363c0396a5 100644
--- a/gcc/testsuite/gcc.dg/ucnid-6.c
+++ b/gcc/testsuite/gcc.dg/ucnid-6.c
@@ -1,4 +1,4 @@
-/* { dg-do run */
+/* { dg-do run } */
/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
/* { dg-options "-std=c99 -fextended-identifiers -save-temps" } */
void abort (void);
diff --git a/gcc/testsuite/gcc.dg/ucnid-7.c b/gcc/testsuite/gcc.dg/ucnid-7.c
new file mode 100644
index 00000000000..fe53a497ffa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-7.c
@@ -0,0 +1,7 @@
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+ locale). */
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -fextended-identifiers" } */
+
+void *p = &\u00e9; /* { dg-error "'\\\\U000000e9' undeclared" } */
+void *q = &\u1e00; /* { dg-error "'\\\\U00001e00' undeclared" } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-8.c b/gcc/testsuite/gcc.dg/ucnid-8.c
new file mode 100644
index 00000000000..4ec3eeba29f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-8.c
@@ -0,0 +1,14 @@
+/* Verify diagnostics for extended identifiers refer to UCNs (in the C
+ locale). Further tests of C front-end diagnostics. */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -fextended-identifiers -Wvla" } */
+
+int a __attribute__((__mode__(\u00e9))); /* { dg-error "unknown machine mode '\\\\U000000e9'" } */
+struct s1 { int \u00e9 : 0; }; /* { dg-error "zero width for bit-field '\\\\U000000e9'" } */
+
+void f (int b) { int \u00e9[b]; } /* { dg-warning "variable length array '\\\\U000000e9'" } */
+
+void g (static int \u00e9); /* { dg-error "storage class specified for parameter '\\\\U000000e9'" } */
+
+struct s2 { int \u00e1; } \u00e9 = { { 0 } }; /* { dg-warning "braces around scalar initializer" } */
+/* { dg-warning "near initialization for '\\\\U000000e9\\.\\\\U000000e1'" "UCN diag" { target *-*-* } 13 } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-9.c b/gcc/testsuite/gcc.dg/ucnid-9.c
new file mode 100644
index 00000000000..c563b91106d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ucnid-9.c
@@ -0,0 +1,24 @@
+/* Test __func__ with extended identifiers and character set
+ conversions. */
+/* { dg-do run } */
+/* { dg-xfail-if "" { "powerpc-ibm-aix*" } { "*" } { "" } } */
+/* { dg-options "-std=c99 -fextended-identifiers -fexec-charset=ISO-8859-1" } */
+/* { dg-require-iconv "ISO-8859-1" } */
+
+extern int strcmp (const char *, const char *);
+extern void abort (void);
+extern void exit (int);
+
+void
+\u00e9 (void)
+{
+ if (strcmp (__func__, "\u00e9") != 0)
+ abort ();
+}
+
+int
+main (void)
+{
+ \u00e9 ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/vect/Os-vect-95.c b/gcc/testsuite/gcc.dg/vect/Os-vect-95.c
index be7168b30ff..8f6e53a6f96 100644
--- a/gcc/testsuite/gcc.dg/vect/Os-vect-95.c
+++ b/gcc/testsuite/gcc.dg/vect/Os-vect-95.c
@@ -41,8 +41,8 @@ main1 (int n, float * __restrict__ pd, float * __restrict__ pa, float * __restri
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float d[N+1] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float d[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c
index bfa0802c0ce..dc17239a3b4 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-37.c
@@ -4,8 +4,8 @@
#include "tree-vect.h"
#define N 16
-char x[N] __attribute__ ((__aligned__(16)));
-char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline))
int main1 (char *y)
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c
index cd7bb01a50d..13fbc82a42f 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-43.c
@@ -25,8 +25,8 @@ __attribute__ ((noinline)) int
main1 (float *pa)
{
int i;
- float pb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
- float pc[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+ float pc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
/* Vectorizable: pa may not alias pb and/or pc, even though their
addresses escape. &pa would need to escape to point to escaped memory. */
@@ -66,7 +66,7 @@ main2 (float * pa)
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c
index f61dff6e341..b883a94a95e 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-49.c
@@ -31,7 +31,7 @@ void bar (float *pa, float *pb, float *pc)
__attribute__ ((noinline)) int
main1 (float *pb, float *pc)
{
- float pa[N] __attribute__ ((__aligned__(16)));
+ float pa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int i;
for (i = 0; i < N; i++)
@@ -47,8 +47,8 @@ main1 (float *pb, float *pc)
int main (void)
{
int i;
- float b[N+1] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
- float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float b[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c
index fe04694f657..28deeaeac26 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-53.c
@@ -31,7 +31,7 @@ void bar (const float *pa, const float *pb, const float *pc)
__attribute__ ((noinline)) int
main1 (int n, float *pb, float *pc)
{
- float pa[N] __attribute__ ((__aligned__(16)));
+ float pa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int i;
for (i = 0; i < n; i++)
@@ -47,9 +47,9 @@ main1 (int n, float *pb, float *pc)
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float b[N+1] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
- float c[N+1] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
+ float c[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c
index 69f79bf8823..63d332a39b2 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-57.c
@@ -43,8 +43,8 @@ __attribute__ ((noinline)) int
main1 (float *pa)
{
int i;
- float b[N] __attribute__ ((__aligned__(16)));
- float c[N] __attribute__ ((__aligned__(16)));
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float *pb = b;
float *pc = c;
@@ -63,7 +63,7 @@ main1 (float *pa)
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
main1 (a);
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c
index 47b268e148b..2df45fdfe85 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-61.c
@@ -44,8 +44,8 @@ __attribute__ ((noinline)) int
main1 (int n , float *pa)
{
int i;
- float b[N] __attribute__ ((__aligned__(16)));
- float c[N] __attribute__ ((__aligned__(16)));
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float *pb = b;
float *pc = c;
@@ -65,7 +65,7 @@ int main (void)
{
int i;
int n=N;
- float a[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
main1 (n,a);
diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c
index f653714942a..1a694b33e05 100644
--- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c
+++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-79.c
@@ -5,9 +5,9 @@
#define N 16
-float fa[N] __attribute__ ((__aligned__(16)));
-float fb[N+4] __attribute__ ((__aligned__(16))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
-float fc[N] __attribute__ ((__aligned__(16))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
+float fa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
+float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
/* Like vect-80.c but the pointers are not annotated as restricted,
and therefore can't be antialiased. */
diff --git a/gcc/testsuite/gcc.dg/vect/pr20122.c b/gcc/testsuite/gcc.dg/vect/pr20122.c
index 05948c7fc81..9d21fc60062 100644
--- a/gcc/testsuite/gcc.dg/vect/pr20122.c
+++ b/gcc/testsuite/gcc.dg/vect/pr20122.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-short Kernshort[24] __attribute__ ((__aligned__(16)));
+short Kernshort[24] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
static void VecBug(short Kernel[8][24]) __attribute__((noinline));
static void VecBug2(short Kernel[8][24]) __attribute__((noinline));
@@ -21,7 +21,7 @@ static void VecBug(short Kernel[8][24])
static void VecBug2(short Kernel[8][24])
{
int k,i;
- short Kernshort2[24] __attribute__ ((__aligned__(16)));
+ short Kernshort2[24] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
for (k = 0; k<8; k++)
for (i = 0; i<24; i++)
Kernshort2[i] = Kernel[k][i];
@@ -36,7 +36,7 @@ int main (int argc, char **argv)
{
check_vect ();
- short Kernel[8][24] __attribute__ ((__aligned__(16)));
+ short Kernel[8][24] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int k,i;
for (k = 0; k<8; k++)
diff --git a/gcc/testsuite/gcc.dg/vect/pr36493.c b/gcc/testsuite/gcc.dg/vect/pr36493.c
index 0a3d2029c9f..0a330b0f056 100644
--- a/gcc/testsuite/gcc.dg/vect/pr36493.c
+++ b/gcc/testsuite/gcc.dg/vect/pr36493.c
@@ -6,7 +6,7 @@ int
main (void)
{
int i;
- long x[12] __attribute__((aligned(16)));
+ long x[12] __attribute__((aligned(__BIGGEST_ALIGNMENT__)));
x[0] = 1;
for (i = 0; i < 12; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/pr37385.c b/gcc/testsuite/gcc.dg/vect/pr37385.c
index d6a477e634c..8b1cf3ae18a 100644
--- a/gcc/testsuite/gcc.dg/vect/pr37385.c
+++ b/gcc/testsuite/gcc.dg/vect/pr37385.c
@@ -4,7 +4,7 @@
typedef int int_t;
typedef void (*fun_t) (int);
-fun_t fun_tab[400] __attribute__ ((__aligned__(16)));
+fun_t fun_tab[400] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
void foo (int_t a);
diff --git a/gcc/testsuite/gcc.dg/vect/slp-10.c b/gcc/testsuite/gcc.dg/vect/slp-10.c
index 36dc0cca823..9185c7eeb52 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-10.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-10.c
@@ -104,11 +104,11 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {target {vect_intfloat_cvt && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {target {{! { vect_intfloat_cvt}} && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target {{! { vect_intfloat_cvt}} && { ! {vect_int_mult}}} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" {target {vect_intfloat_cvt && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" {target {{! { vect_intfloat_cvt}} && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target {{! { vect_intfloat_cvt}} && { ! {vect_int_mult}}} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {target {vect_uintfloat_cvt && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {target {{! { vect_uintfloat_cvt}} && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target {{! { vect_uintfloat_cvt}} && { ! {vect_int_mult}}} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" {target {vect_uintfloat_cvt && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" {target {{! { vect_uintfloat_cvt}} && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target {{! { vect_uintfloat_cvt}} && { ! {vect_int_mult}}} } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-11.c b/gcc/testsuite/gcc.dg/vect/slp-11.c
index 1e87eef4344..7e9c89c6b17 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-11.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-11.c
@@ -106,8 +106,8 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { { vect_intfloat_cvt && vect_strided_wide } && vect_int_mult } } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { { { ! vect_intfloat_cvt } && vect_strided_wide } && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { target { { vect_uintfloat_cvt && vect_strided_wide } && vect_int_mult } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { { { ! vect_uintfloat_cvt } && vect_strided_wide } && vect_int_mult } } } } */
/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target { ! { vect_int_mult && vect_strided_wide } } } } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-12b.c b/gcc/testsuite/gcc.dg/vect/slp-12b.c
index 9f7c7606b46..5c5d133f770 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-12b.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-12b.c
@@ -1,4 +1,4 @@
-/* { dg-require-effective-target vect_intfloat_cvt } */
+/* { dg-require-effective-target vect_uintfloat_cvt } */
#include <stdarg.h>
#include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/vect/slp-33.c b/gcc/testsuite/gcc.dg/vect/slp-33.c
index 7ee7a0b0420..288c748af90 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-33.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-33.c
@@ -102,11 +102,11 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {target {vect_intfloat_cvt && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {target {{! { vect_intfloat_cvt}} && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target {{! { vect_intfloat_cvt}} && {! {vect_int_mult}}} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" {target {vect_intfloat_cvt && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" {target {{! { vect_intfloat_cvt}} && vect_int_mult} } } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target {{! { vect_intfloat_cvt}} && {! {vect_int_mult}}} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" {target {vect_uintfloat_cvt && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" {target {{! { vect_uintfloat_cvt}} && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" {target {{! { vect_uintfloat_cvt}} && {! {vect_int_mult}}} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" {target {vect_uintfloat_cvt && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" {target {{! { vect_uintfloat_cvt}} && vect_int_mult} } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" {target {{! { vect_uintfloat_cvt}} && {! {vect_int_mult}}} } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-7.c b/gcc/testsuite/gcc.dg/vect/slp-7.c
index f00bf54aaa7..db9fb04099d 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-7.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-7.c
@@ -6,8 +6,8 @@
#define N 8
-unsigned int in[N*8] __attribute__ ((__aligned__(16))) = {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,31,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};
-unsigned short in2[N*16] __attribute__ ((__aligned__(16))) = {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,31,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,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,31,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};
+unsigned int in[N*8] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
+unsigned short in2[N*16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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,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,31,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};
int
main1 ()
diff --git a/gcc/testsuite/gcc.dg/vect/slp-9.c b/gcc/testsuite/gcc.dg/vect/slp-9.c
index 461f32e8241..eefb81680a4 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-9.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-9.c
@@ -5,8 +5,8 @@
#define N 64
-short X[N] __attribute__ ((__aligned__(16)));
-short Y[N] __attribute__ ((__aligned__(16)));
+short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int result[N];
/* short->int widening-mult */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c
index 32853d73a15..2eb73f38036 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-s16.c
@@ -5,8 +5,8 @@
#define N 64
-short X[N] __attribute__ ((__aligned__(16))) = {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,31,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};
-short Y[N] __attribute__ ((__aligned__(16))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
+short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
int result[N];
diff --git a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c
index 2f80ea085b6..fb3292ad468 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-widen-mult-u8.c
@@ -5,8 +5,8 @@
#define N 64
-unsigned char X[N] __attribute__ ((__aligned__(16))) = {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,31,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};
-unsigned char Y[N] __attribute__ ((__aligned__(16))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
+unsigned char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
unsigned short result[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-35.c b/gcc/testsuite/gcc.dg/vect/vect-35.c
index c6c3bf33860..0f4284a6257 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-35.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-35.c
@@ -9,8 +9,8 @@ __attribute__ ((noinline))
int main1 ()
{
union {
- unsigned char a[N] __attribute__ ((__aligned__(16)));
- unsigned char b[N] __attribute__ ((__aligned__(16)));
+ unsigned char a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ unsigned char b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
} s;
int i;
@@ -45,6 +45,6 @@ int main (void)
}
-/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail { ia64-*-* sparc*-*-* } } } } */
/* { dg-final { scan-tree-dump-times "can't determine dependence between" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-40.c b/gcc/testsuite/gcc.dg/vect/vect-40.c
index 83d8cabcd87..a73d1551643 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-40.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-40.c
@@ -30,9 +30,9 @@ __attribute__ ((noinline)) int
main1 ()
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
- float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
float *pa = a;
float *pb = b;
float *pc = c;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-42.c b/gcc/testsuite/gcc.dg/vect/vect-42.c
index 324e2f8da2a..f1764e13ecf 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-42.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-42.c
@@ -30,8 +30,8 @@ __attribute__ ((noinline)) int
main1 (float * __restrict__ pa)
{
int i;
- float pb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
- float pc[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+ float pc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
for (i = 0; i < N; i++)
{
@@ -44,9 +44,9 @@ main1 (float * __restrict__ pa)
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
- float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-44.c b/gcc/testsuite/gcc.dg/vect/vect-44.c
index d80df10bfd9..81c6c1b8e87 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-44.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-44.c
@@ -46,9 +46,9 @@ main1 (float * __restrict__ pa, float * __restrict__ pb, float * __restrict__ pc
int main (void)
{
int i;
- float a[N+4] __attribute__ ((__aligned__(16)));
- float b[N+4] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69};
- float c[N+4] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
+ float a[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69};
+ float c[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-46.c b/gcc/testsuite/gcc.dg/vect/vect-46.c
index abe35b4013f..2588a7b291e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-46.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-46.c
@@ -30,7 +30,7 @@ __attribute__ ((noinline)) int
main1 (int n)
{
int i;
- float a[N] __attribute__ ((__aligned__(16))); float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
float *pa = a;
float *pb = b;
float *pc = c;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-48.c b/gcc/testsuite/gcc.dg/vect/vect-48.c
index 011b868639f..e47ee00de91 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-48.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-48.c
@@ -18,7 +18,7 @@
__attribute__ ((noinline)) int
main1 (float *pb, float *pc)
{
- float pa[N] __attribute__ ((__aligned__(16)));
+ float pa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int i;
for (i = 0; i < N; i++)
@@ -39,8 +39,8 @@ main1 (float *pb, float *pc)
int main (void)
{
int i;
- float b[N+1] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
- float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+ float b[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
+ float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-52.c b/gcc/testsuite/gcc.dg/vect/vect-52.c
index 207e7007c41..af485abbd14 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-52.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-52.c
@@ -18,7 +18,7 @@
__attribute__ ((noinline)) int
main1 (int n, float *pb, float *pc)
{
- float pa[N] __attribute__ ((__aligned__(16)));
+ float pa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int i;
for (i = 0; i < n; i++)
@@ -39,9 +39,9 @@ main1 (int n, float *pb, float *pc)
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float b[N+1] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
- float c[N+1] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60};
+ float c[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-54.c b/gcc/testsuite/gcc.dg/vect/vect-54.c
index a44cdd41811..629e82df59b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-54.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-54.c
@@ -26,14 +26,14 @@ void bar (float *pa, float *pb, float *pc)
vect-58.c is similar to this one with one difference:
the loop bound is unknown. */
-float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
-float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
__attribute__ ((noinline)) int
main1 ()
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float *pa = a;
float *pb = b;
float *pc = c;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-56.c b/gcc/testsuite/gcc.dg/vect/vect-56.c
index 624a11287ea..e32d855d08d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-56.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-56.c
@@ -30,14 +30,14 @@ void bar (float *pa, float *pb, float *pc)
vect-57.c is similar to this one with two differences:
aliasing is a problem, and the write access has unknown alignment. */
-float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
-float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
__attribute__ ((noinline)) int
main1 ()
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float *pa = a;
float *pb = b;
float *pc = c;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-58.c b/gcc/testsuite/gcc.dg/vect/vect-58.c
index fe58860e000..fa8c91b3071 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-58.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-58.c
@@ -26,7 +26,7 @@ void bar (float *pa, float *pb, float *pc)
vect-54.c is similar to this one with one difference:
the loop bound is known. */
-float a[N] __attribute__ ((__aligned__(16))); float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))); float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57}; float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
__attribute__ ((noinline)) int
main1 (int n)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-60.c b/gcc/testsuite/gcc.dg/vect/vect-60.c
index efb1d5043c4..3319e360710 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-60.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-60.c
@@ -30,14 +30,14 @@ void bar (float *pa, float *pb, float *pc)
vect-61.c is similar to this one with two differences:
aliasing is not a problem, and the write access has unknown alignment. */
-float b[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
-float c[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
__attribute__ ((noinline)) int
main1 (int n)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float *pa = a;
float *pb = b;
float *pc = c;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-74.c b/gcc/testsuite/gcc.dg/vect/vect-74.c
index e1e2805c915..a680b9fb01b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-74.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-74.c
@@ -9,9 +9,9 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-float a[N] __attribute__ ((__aligned__(16)));
-float b[N+4] __attribute__ ((__aligned__(16))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
-float c[N] __attribute__ ((__aligned__(16))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
+float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float b[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
+float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
__attribute__ ((noinline)) int
main1 (float *__restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-75.c b/gcc/testsuite/gcc.dg/vect/vect-75.c
index 03c1868e420..092a3013e07 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-75.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-75.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
__attribute__ ((noinline))
int main1 (int *ib)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c
index 8a2f7514e7e..847b5e5259d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-76.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-76.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
__attribute__ ((noinline))
int main1 (int *pib)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c b/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
index a3d1b4cd6e9..4a05874b67e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-77-alignchecks.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
__attribute__ ((noinline))
int main1 (int *ib, int off)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-77-global.c b/gcc/testsuite/gcc.dg/vect/vect-77-global.c
index 38f1443bb39..ac29d7d3c44 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-77-global.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-77-global.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
int ia[N];
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-77.c b/gcc/testsuite/gcc.dg/vect/vect-77.c
index a6eb2ad8f23..07ee0fde18d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-77.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-77.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
__attribute__ ((noinline))
int main1 (int *ib, int off)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c b/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
index 5c97b410962..71c01ae1ce7 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-78-alignchecks.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
int off = 8;
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-78-global.c b/gcc/testsuite/gcc.dg/vect/vect-78-global.c
index dccc83903da..ec6520fd8a0 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-78-global.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-78-global.c
@@ -11,7 +11,7 @@
more involved than just an ssa_name. */
int ia[N];
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
int off = 8;
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-78.c b/gcc/testsuite/gcc.dg/vect/vect-78.c
index 67ce20fda1b..12ea12af9c5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-78.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-78.c
@@ -10,7 +10,7 @@
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(16))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
int off = 8;
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-80.c b/gcc/testsuite/gcc.dg/vect/vect-80.c
index beb8d259adf..fc0ed1b3938 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-80.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-80.c
@@ -5,9 +5,9 @@
#define N 16
-float fa[N] __attribute__ ((__aligned__(16)));
-float fb[N+4] __attribute__ ((__aligned__(16))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
-float fc[N] __attribute__ ((__aligned__(16))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
+float fa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
+float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
diff --git a/gcc/testsuite/gcc.dg/vect/vect-85.c b/gcc/testsuite/gcc.dg/vect/vect-85.c
index 6e8b43e79a3..a5bf5db078a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-85.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-85.c
@@ -35,7 +35,7 @@ int main1 (int *a)
int main (void)
{
- int a[N] __attribute__ ((__aligned__(16)));
+ int a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-87.c b/gcc/testsuite/gcc.dg/vect/vect-87.c
index 20a0d2ded45..151091a065b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-87.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-87.c
@@ -35,7 +35,7 @@ int main1 (int n, int *a)
int main (void)
{
- int a[N] __attribute__ ((__aligned__(16)));
+ int a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-88.c b/gcc/testsuite/gcc.dg/vect/vect-88.c
index 8c231c09240..a1666334916 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-88.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-88.c
@@ -35,7 +35,7 @@ int main1 (int n, int *a)
int main (void)
{
- int a[N+1] __attribute__ ((__aligned__(16)));
+ int a[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-92.c b/gcc/testsuite/gcc.dg/vect/vect-92.c
index 94fff980002..01c751fbfa3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-92.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-92.c
@@ -5,9 +5,9 @@
#define N 256
-float pa[N] __attribute__ ((__aligned__(16)));
-float pb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
-float pc[N] __attribute__ ((__aligned__(16))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
+float pa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float pb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
+float pc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
/* Check handling of unaligned accesses when the misalignment is
known at compile time and different accesses have the same
diff --git a/gcc/testsuite/gcc.dg/vect/vect-93.c b/gcc/testsuite/gcc.dg/vect/vect-93.c
index b2245c85a47..351ab04fe84 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-93.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-93.c
@@ -41,8 +41,8 @@ main1 (float *pa)
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float b[N] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-95.c b/gcc/testsuite/gcc.dg/vect/vect-95.c
index aeb5042ec81..ea9f32b994a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-95.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-95.c
@@ -42,8 +42,8 @@ main1 (int n, float * __restrict__ pd, float * __restrict__ pa, float * __restri
int main (void)
{
int i;
- float a[N] __attribute__ ((__aligned__(16)));
- float d[N+1] __attribute__ ((__aligned__(16)));
+ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float d[N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57};
float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
diff --git a/gcc/testsuite/gcc.dg/vect/vect-97.c b/gcc/testsuite/gcc.dg/vect/vect-97.c
index c95c503c941..6ea26149095 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-97.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-97.c
@@ -5,8 +5,8 @@
#define N 16
-char x[N] __attribute__ ((__aligned__(16)));
-char cb[N] __attribute__ ((__aligned__(16))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline))
int main1 ()
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-1.c b/gcc/testsuite/gcc.dg/vect/vect-complex-1.c
index e2d0adcf9fb..2c7d5ce616b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-complex-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-1.c
@@ -6,19 +6,19 @@
#define N 16
-_Complex float a[N] __attribute__ ((__aligned__(16))) =
+_Complex float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{ 10.0F + 20.0iF, 11.0F + 21.0iF, 12.0F + 22.0iF, 13.0F + 23.0iF,
14.0F + 24.0iF, 15.0F + 25.0iF, 16.0F + 26.0iF, 17.0F + 27.0iF,
18.0F + 28.0iF, 19.0F + 29.0iF, 20.0F + 30.0iF, 21.0F + 31.0iF,
22.0F + 32.0iF, 23.0F + 33.0iF, 24.0F + 34.0iF, 25.0F + 35.0iF };
-_Complex float b[N] __attribute__ ((__aligned__(16))) =
+_Complex float b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{ 30.0F + 40.0iF, 31.0F + 41.0iF, 32.0F + 42.0iF, 33.0F + 43.0iF,
34.0F + 44.0iF, 35.0F + 45.0iF, 36.0F + 46.0iF, 37.0F + 47.0iF,
38.0F + 48.0iF, 39.0F + 49.0iF, 40.0F + 50.0iF, 41.0F + 51.0iF,
42.0F + 52.0iF, 43.0F + 53.0iF, 44.0F + 54.0iF, 45.0F + 55.0iF };
-_Complex float c[N] __attribute__ ((__aligned__(16)));
-_Complex float res[N] __attribute__ ((__aligned__(16))) =
+_Complex float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+_Complex float res[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{ 40.0F + 60.0iF, 42.0F + 62.0iF, 44.0F + 64.0iF, 46.0F + 66.0iF,
48.0F + 68.0iF, 50.0F + 70.0iF, 52.0F + 72.0iF, 54.0F + 74.0iF,
56.0F + 76.0iF, 58.0F + 78.0iF, 60.0F + 80.0iF, 62.0F + 82.0iF,
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-4.c b/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
index 85c416597f6..0e00e789ac1 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-4.c
@@ -11,7 +11,7 @@ struct foostr {
_Complex short f2;
};
-struct foostr a[16] __attribute__ ((__aligned__(16))) =
+struct foostr a[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{
11 + 23i, 24 + 22i,
11 + 26i, 24 + 35i,
@@ -31,7 +31,7 @@ struct foostr a[16] __attribute__ ((__aligned__(16))) =
35 + 36i, 34 + 28i,
};
-struct foostr b[16] __attribute__ ((__aligned__(16))) =
+struct foostr b[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{
37 + 12i, 23 + 15i,
14 + 11i, 13 + 25i,
@@ -50,7 +50,7 @@ struct foostr b[16] __attribute__ ((__aligned__(16))) =
25 + 27i, 15 + 30i,
10 + 31i, 37 + 37i,
};
-struct foostr c[16] __attribute__ ((__aligned__(16)));
+struct foostr c[16] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
struct foostr res[N] =
{
48 + 35i, 47 + 37i,
diff --git a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
index 91eb1f54b3c..a17830fa917 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-complex-5.c
@@ -11,11 +11,11 @@ struct foostr {
_Complex short f2;
};
-_Complex short a1[64] __attribute__ ((__aligned__(16)));
-_Complex short a2[64] __attribute__ ((__aligned__(16)));
-_Complex short b1[64] __attribute__ ((__aligned__(16)));
-_Complex short b2[64] __attribute__ ((__aligned__(16)));
-struct foostr c[64] __attribute__ ((__aligned__(16)));
+_Complex short a1[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+_Complex short a2[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+_Complex short b1[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+_Complex short b2[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+struct foostr c[64] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo (void)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-10.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-10.c
index 757af63f124..175422a55fc 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-10.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-10.c
@@ -5,11 +5,11 @@
#define N 64
-unsigned char uX[N] __attribute__ ((__aligned__(16)));
-unsigned short uY[N] __attribute__ ((__aligned__(16)));
+unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned short uY[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned int uresult[N];
-signed char X[N] __attribute__ ((__aligned__(16)));
-signed short Y[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int result[N];
/* Unsigned type promotion (hi->si) */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-11.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-11.c
index ef66c734e9c..9cb8c1dfe44 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-11.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-11.c
@@ -5,7 +5,7 @@
#define N 64
-short x[N] __attribute__ ((__aligned__(16)));
+short x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) int
foo (int len, int *z) {
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c
index e4d5417547e..ca34ea42719 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-12.c
@@ -5,7 +5,7 @@
#define N 64
-char x[N] __attribute__ ((__aligned__(16)));
+char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) int
foo (int len, int *z) {
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c
index 32b3131ee20..a5012ab2317 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-13.c
@@ -5,9 +5,9 @@
#define N 64
-unsigned char uX[N] __attribute__ ((__aligned__(16)));
+unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned int uresult[N];
-signed char X[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int result[N];
/* Unsigned type promotion (qi->si) */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c
index 970535ff660..11ff337a960 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-14.c
@@ -5,9 +5,9 @@
#define N 64
-unsigned char uX[N] __attribute__ ((__aligned__(16)));
+unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned char uresultX[N];
-unsigned int uY[N] __attribute__ ((__aligned__(16)));
+unsigned int uY[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned char uresultY[N];
/* Unsigned type demotion (si->qi) */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c
index ad09ff95679..c96daf8ad9b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-15.c
@@ -9,9 +9,9 @@
#define DOT1 43680
#define DOT2 -20832
-signed char X[N] __attribute__ ((__aligned__(16)));
-signed char Y[N] __attribute__ ((__aligned__(16)));
-unsigned char CX[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned char CX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo1(int len) {
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c
index 4192e3d19ec..176333c2b03 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-16.c
@@ -5,7 +5,7 @@
#define N 64
-char x[N] __attribute__ ((__aligned__(16))) = {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,31,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};
+char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
__attribute__ ((noinline)) int
foo (int len, long long *z) {
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c
index 9084fc82a12..b2f81058260 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-17.c
@@ -5,9 +5,9 @@
#define N 64
-unsigned char uX[N] __attribute__ ((__aligned__(16))) = {16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
unsigned char uresultX[N];
-unsigned long long uY[N] __attribute__ ((__aligned__(16))) = {16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+unsigned long long uY[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
unsigned char uresultY[N];
/* Unsigned type demotion (si->qi) */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c
index 22711aa0ab1..ba1f6604861 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-3.c
@@ -5,11 +5,11 @@
#define N 32
-int ib[N] __attribute__ ((__aligned__(16))) =
+int ib[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-short sb[N] __attribute__ ((__aligned__(16))) =
+short sb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-char cb[N] __attribute__ ((__aligned__(16))) =
+char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c
index a4867e44f3d..7d8f5afe3e4 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-6.c
@@ -5,17 +5,17 @@
#define N 32
-unsigned int ic[N] __attribute__ ((__aligned__(16))) =
+unsigned int ic[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-unsigned int ib[N] __attribute__ ((__aligned__(16))) =
+unsigned int ib[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-unsigned short sc[N] __attribute__ ((__aligned__(16))) =
+unsigned short sc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-unsigned short sb[N] __attribute__ ((__aligned__(16))) =
+unsigned short sb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-unsigned char cc[N] __attribute__ ((__aligned__(16))) =
+unsigned char cc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
-unsigned char cb[N] __attribute__ ((__aligned__(16))) =
+unsigned char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) =
{0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-7.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-7.c
index 80604321b98..6114b5b8836 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-7.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-7.c
@@ -9,9 +9,9 @@
#define DOT1 43680
#define DOT2 -20832
-signed short X[N] __attribute__ ((__aligned__(16)));
-signed short Y[N] __attribute__ ((__aligned__(16)));
-unsigned char CX[N] __attribute__ ((__aligned__(16)));
+signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned char CX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo1(int len) {
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-8.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-8.c
index 6a71298a59f..25e442f5251 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-8.c
@@ -5,9 +5,9 @@
#define N 64
-unsigned char uX[N] __attribute__ ((__aligned__(16)));
+unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned char uresultX[N];
-unsigned int uY[N] __attribute__ ((__aligned__(16)));
+unsigned int uY[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned short uresultY[N];
/* Unsigned type demotion (si->hi) */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-9.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-9.c
index 4ac2d0c1a90..54dd25dc70a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-9.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-9.c
@@ -5,9 +5,9 @@
#define N 64
-unsigned char uX[N] __attribute__ ((__aligned__(16)));
+unsigned char uX[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned short uresult[N];
-signed char X[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
short result[N];
/* Unsigned type promotion (qi->hi) */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1.c
index f1892488603..f0df5d4cd9d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1.c
@@ -1,9 +1,9 @@
/* { dg-do compile } */
#define N 64
-signed short image[N][N] __attribute__ ((__aligned__(16)));
-signed short block[N][N] __attribute__ ((__aligned__(16)));
-signed short out[N] __attribute__ ((__aligned__(16)));
+signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short out[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* Can't do outer-loop vectorization because of non-consecutive access. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
index 2d903937f91..3d237b78e72 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
@@ -1,8 +1,8 @@
/* { dg-do compile } */
#define N 64
-signed short image[N][N] __attribute__ ((__aligned__(16)));
-signed short block[N][N] __attribute__ ((__aligned__(16)));
+signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* Can't do outer-loop vectorization because of non-consecutive access.
Currently fails to vectorize because the reduction pattern is not
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2.c
index 604c35a0c1a..38701977bc6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2.c
@@ -4,7 +4,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N] __attribute__ ((__aligned__(16)));
+float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
/* Outer-loop vectorization. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c
index aee79735e36..b8d0e51fee5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c
@@ -4,7 +4,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N][N] __attribute__ ((__aligned__(16)));
+float image[N][N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo (){
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2b.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2b.c
index 9d9fb5cb52d..df2e6a7b129 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2b.c
@@ -3,7 +3,7 @@
#include "tree-vect.h"
#define N 40
-float image[2*N][N][N] __attribute__ ((__aligned__(16)));
+float image[2*N][N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo (){
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c
index da3748dc223..0ca868637ad 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c
@@ -4,7 +4,7 @@
#include "tree-vect.h"
#define N 40
-float image[2*N][2*N][N] __attribute__ ((__aligned__(16)));
+float image[2*N][2*N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo (){
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2d.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2d.c
index af19867050e..3e19d47b315 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2d.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2d.c
@@ -3,7 +3,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N][N+1] __attribute__ ((__aligned__(16)));
+float image[N][N][N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
foo (){
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3.c
index 5f7a802f164..924700c5840 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3.c
@@ -3,7 +3,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N] __attribute__ ((__aligned__(16)));
+float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
/* Outer-loop vectoriation. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
index beade07c241..4b5107dcf4e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
@@ -3,7 +3,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N+1] __attribute__ ((__aligned__(16)));
+float image[N][N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
/* Outer-loop vectorization with misaliged accesses in the inner-loop. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3b.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3b.c
index a0ff0906ce2..f11cb751ca4 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3b.c
@@ -3,7 +3,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N] __attribute__ ((__aligned__(16)));
+float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
/* Outer-loop vectorization with non-consecutive access. Not vectorized yet. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3c.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3c.c
index 149823a5ef8..599137ba12e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3c.c
@@ -3,7 +3,7 @@
#include "tree-vect.h"
#define N 40
-float image[N][N+1] __attribute__ ((__aligned__(16)));
+float image[N][N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
/* Outer-loop vectorization. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-5.c b/gcc/testsuite/gcc.dg/vect/vect-outer-5.c
index 28dce1b94af..2fc421e9680 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-5.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-5.c
@@ -13,10 +13,10 @@ extern void abort(void);
__attribute__ ((noinline))
int main1 ()
{
- float A[N] __attribute__ ((__aligned__(16)));
- float B[N] __attribute__ ((__aligned__(16)));
- float C[N] __attribute__ ((__aligned__(16)));
- float D[N] __attribute__ ((__aligned__(16)));
+ float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float E[4] = {0,1,2,480};
float s;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-6.c b/gcc/testsuite/gcc.dg/vect/vect-outer-6.c
index c83943a5a59..572f433cf50 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-6.c
@@ -7,10 +7,10 @@
#define N 64
#define MAX 42
-float A[N] __attribute__ ((__aligned__(16)));
-float B[N] __attribute__ ((__aligned__(16)));
-float C[N] __attribute__ ((__aligned__(16)));
-float D[N] __attribute__ ((__aligned__(16)));
+float A[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float B[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float C[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float D[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
extern void abort(void);
__attribute__ ((noinline))
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c
index b768c6c8590..61517066ef0 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16a.c
@@ -6,8 +6,8 @@
#define N 64
#define DOT 43680
-signed short X[N] __attribute__ ((__aligned__(16)));
-signed short Y[N] __attribute__ ((__aligned__(16)));
+signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* short->int->int dot product.
Detected as a dot-product pattern.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16b.c
index 587800c032a..3459a30a03e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16b.c
@@ -7,8 +7,8 @@
#define DOT 43680
-signed short X[N] __attribute__ ((__aligned__(16)));
-signed short Y[N] __attribute__ ((__aligned__(16)));
+signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* short->short->int dot product. Should be vectorized on architectures
supporting vectorized multiplication of two short args with short result,
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c
index 66ca021a57a..95a4cdd88f3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c
@@ -7,8 +7,8 @@
#define DOT1 43680
-signed char X[N] __attribute__ ((__aligned__(16)));
-signed char Y[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* char->short->int dot product.
The dot-product pattern should be detected.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c
index 8db7797045b..ba24af26a03 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8b.c
@@ -7,8 +7,8 @@
#define DOT2 -21856
-signed char X[N] __attribute__ ((__aligned__(16)));
-signed char Y[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* char->short->short dot product.
The dot-product pattern should be detected.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c
index 80377bae9a4..758886ef8ad 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8c.c
@@ -7,8 +7,8 @@
#define DOT3 43680
-signed char X[N] __attribute__ ((__aligned__(16)));
-signed char Y[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* char->int->int dot product.
Not detected as a dot-product pattern. */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c
index eb89ac779e7..c09750d4454 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16a.c
@@ -8,8 +8,8 @@
#define DOT1 43680
#define DOT2 43680
-unsigned short X[N] __attribute__ ((__aligned__(16)));
-unsigned short Y[N] __attribute__ ((__aligned__(16)));
+unsigned short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* short->short->int dot product.
Not detected as a dot-product pattern.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c
index 270a3f420de..1a198218147 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u16b.c
@@ -7,8 +7,8 @@
#define DOT2 43680
-unsigned short X[N] __attribute__ ((__aligned__(16)));
-unsigned short Y[N] __attribute__ ((__aligned__(16)));
+unsigned short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
/* short->int->int dot product.
Currently not detected as a dot-product pattern: the multiplication
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
index 1934deb40d1..d856754c902 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
@@ -7,8 +7,8 @@
#define DOT 43680
-unsigned char X[N] __attribute__ ((__aligned__(16))) = {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,31,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};
-unsigned char Y[N] __attribute__ ((__aligned__(16))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
+unsigned char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
/* char->short->int dot product.
Detected as a dot-product pattern.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c
index 3266d1ca0b5..01c82b52c54 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8b.c
@@ -7,8 +7,8 @@
#define DOT 43680
-unsigned char X[N] __attribute__ ((__aligned__(16))) = {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,31,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};
-unsigned char Y[N] __attribute__ ((__aligned__(16))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
+unsigned char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
/* char->short->short dot product.
Detected as a dot-product pattern.
diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-2.c b/gcc/testsuite/gcc.dg/vect/vect-shift-2.c
new file mode 100644
index 00000000000..93e1154fb42
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-shift-2.c
@@ -0,0 +1,189 @@
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+/* Check the standard integer types for left and right shifts to see if the
+ compiler replaced a scalar instruction with a vector instruction whether the
+ correct value is generated. */
+
+#ifdef TRACE
+#include <stdio.h>
+#endif
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#ifndef ALIGN
+#define ALIGN __attribute__((__aligned__(__BIGGEST_ALIGNMENT__)))
+#endif
+
+#ifndef NOINLINE
+#define NOINLINE __attribute__((__noinline__))
+#endif
+
+#ifdef TRACE
+#define TRACE_FUNC(PREFIX, NAME) printf (#PREFIX #NAME "\n")
+#define TRACE_DONE() printf ("done!\n")
+#define TRACE_ABORT(I,E,G) \
+do { \
+ printf ("Element %d, expected 0x%lx, got 0x%lx\n", \
+ I, (long)(E), (long)(G)); \
+ abort (); \
+} while (0)
+
+#else
+#define TRACE_FUNC(PREFIX, A)
+#define TRACE_DONE()
+#define TRACE_ABORT(I,E,G) abort ()
+#endif
+
+#define NAME(A,B) A ## B
+
+#define VECT_TESTS(PREFIX, TYPE, N) \
+ /* Restrict the optimizer from optimizing the setup loops. */ \
+volatile TYPE NAME (PREFIX, zero) = 0; \
+ \
+TYPE NAME (PREFIX, a)[N] ALIGN; \
+TYPE NAME (PREFIX, b)[N] ALIGN; \
+TYPE NAME (PREFIX, c)[N] ALIGN; \
+TYPE NAME (PREFIX, d)[N] ALIGN; \
+ \
+static void NOINLINE \
+NAME (PREFIX, lshift_2) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, lshift_2); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] << 2; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, lshift_var) (int shift) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, lshift_var); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] << shift; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, lshift_vect) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, lshift_vect); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] << NAME (PREFIX, c)[i]; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, rshift_2) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, rshift_2); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] >> 2; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, rshift_var) (int shift) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, rshift_var); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] >> shift; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, rshift_vect) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, rshift_vect); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] >> NAME (PREFIX, c)[i]; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, check) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, check); \
+ for (i = 0; i < N; i++) \
+ if (NAME (PREFIX, a)[i] != NAME (PREFIX, d)[i]) \
+ TRACE_ABORT (i, NAME (PREFIX, d)[i], NAME (PREFIX, a)[i]); \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, tests) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, tests); \
+ for (i = 0; i < N; i++) \
+ { \
+ NAME (PREFIX, b)[i] = (i + NAME (PREFIX, zero)); \
+ NAME (PREFIX, c)[i] = 2; \
+ NAME (PREFIX, d)[i] = (i + NAME (PREFIX, zero)) << 2; \
+ } \
+ \
+ NAME (PREFIX, lshift_2) (); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, lshift_var) (2); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, lshift_vect) (); \
+ NAME (PREFIX, check) (); \
+ \
+ for (i = 0; i < N; i++) \
+ { \
+ NAME (PREFIX, b)[i] = ((i + NAME (PREFIX, zero)) << 4) \
+ | (((TYPE)0x80) << ((sizeof (TYPE) * 8) - 8)); \
+ NAME (PREFIX, c)[i] = 2; \
+ NAME (PREFIX, d)[i] = (TYPE)((NAME (PREFIX, b)[i] \
+ + NAME (PREFIX, zero)) >> 2); \
+ } \
+ \
+ NAME (PREFIX, rshift_2) (); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, rshift_var) (2); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, rshift_vect) (); \
+ NAME (PREFIX, check) (); \
+}
+
+VECT_TESTS(uc_, unsigned char, 16)
+VECT_TESTS(us_, unsigned short, 32)
+VECT_TESTS(ui_, unsigned int, 32)
+VECT_TESTS(ul_, unsigned long, 32)
+
+VECT_TESTS(sc_, signed char, 16)
+VECT_TESTS(ss_, short, 32)
+VECT_TESTS(si_, int, 32)
+VECT_TESTS(sl_, long, 32)
+
+int main ()
+{
+ int i;
+
+ check_vect ();
+
+ uc_tests ();
+ us_tests ();
+ ui_tests ();
+ ul_tests ();
+
+ sc_tests ();
+ ss_tests ();
+ si_tests ();
+ sl_tests ();
+
+ TRACE_DONE ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s16.c
index e63373b2c34..aeb065262a6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s16.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s16.c
@@ -5,8 +5,8 @@
#define N 64
-short X[N] __attribute__ ((__aligned__(16)));
-short Y[N] __attribute__ ((__aligned__(16)));
+short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int result[N];
/* short->int widening-mult */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s8.c
index 8f79e22711d..7578352c341 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-s8.c
@@ -5,8 +5,8 @@
#define N 64
-signed char X[N] __attribute__ ((__aligned__(16)));
-signed char Y[N] __attribute__ ((__aligned__(16)));
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
short result[N];
/* char->short widening-mult */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c
index 3aa0ff10dfe..9b98c19a160 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u16.c
@@ -5,8 +5,8 @@
#define N 64
-unsigned short X[N] __attribute__ ((__aligned__(16)));
-unsigned short Y[N] __attribute__ ((__aligned__(16)));
+unsigned short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned short Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned int result[N];
/* short->int widening-mult */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
index 63bd00227d7..1658f7b5a29 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-widen-mult-u8.c
@@ -5,8 +5,8 @@
#define N 64
-unsigned char X[N] __attribute__ ((__aligned__(16)));
-unsigned char Y[N] __attribute__ ((__aligned__(16)));
+unsigned char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+unsigned char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
unsigned short result[N];
/* char->short widening-mult */
diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c
index 7fc00e21a79..68caa8bd1dd 100644
--- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c
+++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-dot-s8b.c
@@ -7,8 +7,8 @@
#define DOT -21856
-signed char X[N] __attribute__ ((__aligned__(16))) = {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,31,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};
-signed char Y[N] __attribute__ ((__aligned__(16))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
+signed char X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {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,31,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};
+signed char Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1};
/* char->short->short dot product.
The dot-product pattern should be detected.
diff --git a/gcc/testsuite/gcc.target/arm/long-calls-1.c b/gcc/testsuite/gcc.target/arm/long-calls-1.c
index 587f6d6f25b..f10f10606a6 100644
--- a/gcc/testsuite/gcc.target/arm/long-calls-1.c
+++ b/gcc/testsuite/gcc.target/arm/long-calls-1.c
@@ -1,6 +1,8 @@
/* Check that long calls to different sections are not optimized to "bl". */
/* { dg-do compile { target { arm32 && nonpic } } } */
/* { dg-options "-O2" } */
+/* This test expects that short calls are the default. */
+/* { dg-skip-if "-mlong-calls in use" { "*-*-*" } { "-mlong-calls" } { "" } } */
#define section(S) __attribute__((section(S)))
#define weak __attribute__((weak))
diff --git a/gcc/testsuite/gcc.target/bfin/20090411-1.c b/gcc/testsuite/gcc.target/bfin/20090411-1.c
new file mode 100644
index 00000000000..e301518a51b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bfin/20090411-1.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target bfin-*-* } } */
+/* { dg-options "-O2" } */
+
+typedef short __v2hi __attribute__ ((vector_size (4)));
+typedef __v2hi raw2x16;
+typedef raw2x16 fract2x16;
+typedef short fract16;
+typedef struct complex_fract16
+{
+ fract16 re;
+ fract16 im;
+} __attribute__ ((aligned (4))) complex_fract16;
+
+
+__inline__ __attribute__ ((always_inline))
+ static complex_fract16 csqu_fr16 (complex_fract16 _a)
+{
+ complex_fract16 _x;
+ fract2x16 i =
+ __builtin_bfin_csqu_fr16 (__builtin_bfin_compose_2x16 ((_a).im, (_a).re));
+ (_x).re = __builtin_bfin_extract_lo (i);
+ (_x).im = __builtin_bfin_extract_hi (i);
+ return _x;
+}
+
+complex_fract16 f (complex_fract16 _a)
+{
+ return csqu_fr16 (_a);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr37191.c b/gcc/testsuite/gcc.target/i386/pr37191.c
index b7b65df12b1..b315ce072a4 100644
--- a/gcc/testsuite/gcc.target/i386/pr37191.c
+++ b/gcc/testsuite/gcc.target/i386/pr37191.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O1 -mmmx" } */
+/* { dg-skip-if "no stdint" { vxworks_kernel } } */
#include <mmintrin.h>
#include <stddef.h>
diff --git a/gcc/testsuite/gcc.target/i386/pr39911.c b/gcc/testsuite/gcc.target/i386/pr39911.c
new file mode 100644
index 00000000000..fe63ff005fe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr39911.c
@@ -0,0 +1,57 @@
+/* { dg-do assemble } */
+/* { dg-options "-O2" } */
+
+void
+bar1 ()
+{
+ char foo;
+ asm volatile ("mov%z0 %1, %0": "=m" (foo): "iq" (-23));
+ asm volatile ("add%z0 %1, %0": "+m" (foo): "iq" (23));
+ asm volatile ("mov%z0 %1, %0": "=q" (foo): "iq" (-23));
+ asm volatile ("add%z0 %1, %0": "+q" (foo): "iq" (23));
+}
+
+void
+bar2 ()
+{
+ short foo;
+ asm volatile ("mov%z0 %1, %0": "=m" (foo): "ir" (-23));
+ asm volatile ("add%z0 %1, %0": "+m" (foo): "ir" (23));
+ asm volatile ("mov%z0 %1, %0": "=r" (foo): "ir" (-23));
+ asm volatile ("add%z0 %1, %0": "+r" (foo): "ir" (23));
+
+ asm volatile ("pop%z0 %0": "=m" (foo));
+ asm volatile ("pop%z0 %0": "=r" (foo));
+}
+
+void
+bar3 ()
+{
+ int foo;
+ asm volatile ("mov%z0 %1, %0": "=m" (foo): "ir" (-23));
+ asm volatile ("add%z0 %1, %0": "+m" (foo): "ir" (23));
+ asm volatile ("mov%z0 %1, %0": "=r" (foo): "ir" (-23));
+ asm volatile ("add%z0 %1, %0": "+r" (foo): "ir" (23));
+
+ if (sizeof (void *) == sizeof (int))
+ {
+ asm volatile ("pop%z0 %0": "=m" (foo));
+ asm volatile ("pop%z0 %0": "=r" (foo));
+ }
+}
+
+void
+bar4 ()
+{
+ if (sizeof (void *) == sizeof (long long))
+ {
+ long long foo;
+ asm volatile ("mov%z0 %1, %0": "=m" (foo): "er" (-23));
+ asm volatile ("add%z0 %1, %0": "+m" (foo): "er" (23));
+ asm volatile ("mov%z0 %1, %0": "=r" (foo): "er" (-23));
+ asm volatile ("add%z0 %1, %0": "+r" (foo): "er" (23));
+
+ asm volatile ("pop%z0 %0": "=m" (foo));
+ asm volatile ("pop%z0 %0": "=r" (foo));
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/reload-1.c b/gcc/testsuite/gcc.target/i386/reload-1.c
index 8ccfcb55d7f..f8075acaed4 100644
--- a/gcc/testsuite/gcc.target/i386/reload-1.c
+++ b/gcc/testsuite/gcc.target/i386/reload-1.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target ilp32 } */
/* { dg-options "-O3 -msse2 -fdump-rtl-csa" } */
+/* { dg-skip-if "no stdint" { vxworks_kernel } } */
#include <emmintrin.h>
#include <stdint.h>
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-1.c
index 37f20285f54..8baee339017 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-1.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-1.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#ifndef CHECK_H
#define CHECK_H "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-2.c
index 7f0475f75ce..86b78ed7578 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-2.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#ifndef CHECK_H
#define CHECK_H "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-3.c
index 4a1f81026f0..6e6a05c59c2 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-3.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundpd-3.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#ifndef CHECK_H
#define CHECK_H "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c
index 65b891c146c..71bc51be232 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-1.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c
index 44b778f31ee..672e92067c8 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-2.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c
index 3f166b7128c..4bfc1cacc91 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundps-3.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c
index 33500d361bd..ae8881cf0f8 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-1.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c
index f6a51db61e8..70679bb07a0 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-2.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c
index 1e419644308..81a3f760638 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-3.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c
index dca97789f3a..124f825021d 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundsd-4.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c
index d7965781169..96dd8a6a76f 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-1.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c
index 019f2134492..f052c029f7a 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-2.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c
index 2adac1a6059..0a696b1cfb7 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-3.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c
index dc7f34edb5b..71042d1b777 100644
--- a/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c
+++ b/gcc/testsuite/gcc.target/i386/sse4_1-roundss-4.c
@@ -1,6 +1,7 @@
/* { dg-do run } */
/* { dg-require-effective-target sse4 } */
/* { dg-options "-O2 -msse4.1" } */
+/* { dg-skip-if "no M_PI" { vxworks_kernel } } */
#include "sse4_1-check.h"
diff --git a/gcc/testsuite/gcc.target/ia64/20071210-2.c b/gcc/testsuite/gcc.target/ia64/20071210-2.c
new file mode 100644
index 00000000000..96a20a73f87
--- /dev/null
+++ b/gcc/testsuite/gcc.target/ia64/20071210-2.c
@@ -0,0 +1,68 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -fselective-scheduling2" } */
+
+extern void abort (void);
+
+struct S
+{
+ int n1, n2, n3, n4;
+};
+
+__attribute__((noinline)) struct S
+foo (int x, int y, int z)
+{
+ if (x != 10 || y != 9 || z != 8)
+ abort ();
+ struct S s = { 1, 2, 3, 4 };
+ return s;
+}
+
+__attribute__((noinline)) void **
+bar (void **u, int *v)
+{
+ void **w = u;
+ int *s = v, x, y, z;
+ void **p, **q;
+ static void *l[] = { &&lab1, &&lab1, &&lab2, &&lab3, &&lab4 };
+
+ if (!u)
+ return l;
+
+ q = *w++;
+ goto *q;
+lab2:
+ p = q;
+ q = *w++;
+ x = s[2];
+ y = s[1];
+ z = s[0];
+ s -= 1;
+ struct S r = foo (x, y, z);
+ s[3] = r.n1;
+ s[2] = r.n2;
+ s[1] = r.n3;
+ s[0] = r.n4;
+ goto *q;
+lab3:
+ p = q;
+ q = *w++;
+ s += 1;
+ s[0] = 23;
+lab1:
+ goto *q;
+lab4:
+ return 0;
+}
+
+int
+main (void)
+{
+ void **u = bar ((void **) 0, (int *) 0);
+ void *t[] = { u[2], u[4] };
+ int s[] = { 7, 8, 9, 10, 11, 12 };
+ if (bar (t, &s[1]) != (void **) 0
+ || s[0] != 4 || s[1] != 3 || s[2] != 2 || s[3] != 1
+ || s[4] != 11 || s[5] != 12)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/ia64/sync-1.c b/gcc/testsuite/gcc.target/ia64/sync-1.c
index 95f6daeb997..2de04e57e9e 100644
--- a/gcc/testsuite/gcc.target/ia64/sync-1.c
+++ b/gcc/testsuite/gcc.target/ia64/sync-1.c
@@ -2,7 +2,7 @@
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler "xchg4 .*, r0" } } */
/* { dg-final { scan-assembler "cmpxchg4.*, r0, .*" } } */
-/* { dg-final { scan-assembler "cmpxchg8.*, r0, .*" } } */
+/* { dg-final { scan-assembler "cmpxchg8.*, r0, .*" { target lp64 } } } */
int
foo1 (int *p)
diff --git a/gcc/testsuite/gcc.target/mips/dspr2-MULT.c b/gcc/testsuite/gcc.target/mips/dspr2-MULT.c
index ab2c28a7321..8b815e5acb6 100644
--- a/gcc/testsuite/gcc.target/mips/dspr2-MULT.c
+++ b/gcc/testsuite/gcc.target/mips/dspr2-MULT.c
@@ -1,6 +1,7 @@
-/* Test MIPS32 DSP REV 2 MULT instruction */
+/* Test MIPS32 DSP REV 2 MULT instruction. Tune for a CPU that has
+ pipelined mult. */
/* { dg-do compile } */
-/* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo" } */
+/* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo -mtune=74kc" } */
/* { dg-final { scan-assembler "\tmult\t" } } */
/* { dg-final { scan-assembler "ac1" } } */
diff --git a/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c b/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c
index 312938ae57d..c457d245a31 100644
--- a/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c
+++ b/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c
@@ -1,6 +1,7 @@
-/* Test MIPS32 DSP REV 2 MULTU instruction */
+/* Test MIPS32 DSP REV 2 MULTU instruction. Tune for a CPU that has
+ pipelined multu. */
/* { dg-do compile } */
-/* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo" } */
+/* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo -mtune=74kc" } */
/* { dg-final { scan-assembler "\tmultu\t" } } */
/* { dg-final { scan-assembler "ac1" } } */
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 7befff5a1fa..a0b8fc39623 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -243,6 +243,7 @@ foreach option {
branch-cost
code-readable
r10k-cache-barrier
+ tune
} {
lappend mips_option_groups $option "-m$option=.*"
}
diff --git a/gcc/testsuite/gcc.target/powerpc/20020118-1.c b/gcc/testsuite/gcc.target/powerpc/20020118-1.c
index 393f3c2aa5b..49197b49032 100644
--- a/gcc/testsuite/gcc.target/powerpc/20020118-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/20020118-1.c
@@ -1,4 +1,6 @@
/* { dg-do run { target powerpc*-*-* } }*/
+/* VxWorks only guarantees 64 bits of alignment (STACK_BOUNDARY == 64). */
+/* { dg-skip-if "" { "powerpc*-*-vxworks*" } { "*" } { "" } } */
/* Test local alignment. Test new target macro STARTING_FRAME_PHASE. */
/* Origin: Aldy Hernandez <aldyh@redhat.com>. */
diff --git a/gcc/testsuite/gcc.target/sparc/fexpand-2.c b/gcc/testsuite/gcc.target/sparc/fexpand-2.c
index e8b0970fedf..c37b806c932 100644
--- a/gcc/testsuite/gcc.target/sparc/fexpand-2.c
+++ b/gcc/testsuite/gcc.target/sparc/fexpand-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-final_cleanup -mcpu=ultrasparc -mvis" } */
+/* { dg-options "-O1 -mcpu=ultrasparc -mvis -fdump-tree-optimized" } */
typedef short vec16 __attribute__((vector_size(8)));
typedef unsigned char vec8 __attribute__((vector_size(4)));
@@ -8,5 +8,5 @@ vec16 foo () {
return __builtin_vis_fexpand (a);
}
-/* { dg-final { scan-tree-dump "{ 16, 32, 64, 128 }" "final_cleanup" } } */
-/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
+/* { dg-final { scan-tree-dump "{ 16, 32, 64, 128 }" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/sparc/fpmerge-2.c b/gcc/testsuite/gcc.target/sparc/fpmerge-2.c
index 423172fbbbc..524c736f5d7 100644
--- a/gcc/testsuite/gcc.target/sparc/fpmerge-2.c
+++ b/gcc/testsuite/gcc.target/sparc/fpmerge-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mcpu=ultrasparc -mvis -O1 -fdump-tree-final_cleanup" } */
+/* { dg-options "-mcpu=ultrasparc -mvis -O1 -fdump-tree-optimized" } */
typedef unsigned char pixel __attribute__((vector_size(8)));
typedef unsigned char vec8 __attribute__((vector_size(4)));
@@ -12,5 +12,5 @@ pixel foo () {
}
/* { dg-final { scan-assembler-not "fpmerge\t%" } } */
-/* { dg-final { scan-tree-dump "{ 1, 2, 3, 4, 5, 6, 7, 8 }" "final_cleanup" } } */
-/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
+/* { dg-final { scan-tree-dump "{ 1, 2, 3, 4, 5, 6, 7, 8 }" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/sparc/fpmul-2.c b/gcc/testsuite/gcc.target/sparc/fpmul-2.c
index 376d47b400f..e04673e5dda 100644
--- a/gcc/testsuite/gcc.target/sparc/fpmul-2.c
+++ b/gcc/testsuite/gcc.target/sparc/fpmul-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mcpu=ultrasparc -mvis -O1 -fdump-tree-final_cleanup" } */
+/* { dg-options "-mcpu=ultrasparc -mvis -O1 -fdump-tree-optimized" } */
typedef int vec32 __attribute__((vector_size(8)));
typedef short vec16 __attribute__((vector_size(8)));
@@ -26,9 +26,9 @@ vec16 foo1_2 () {
return __builtin_vis_fmul8x16 (a, b);
}
/* { dg-final { scan-assembler-not "fmul8x16\t%" } } */
-/* { dg-final { scan-tree-dump "{ 0, 0, 0, 0 }" "final_cleanup" } } */
-/* { dg-final { scan-tree-dump "{ 1, 2, 4, 8 }" "final_cleanup" } } */
-/* { dg-final { scan-tree-dump "{ 255, 510, 1020, 32639 }" "final_cleanup" } } */
+/* { dg-final { scan-tree-dump "{ 0, 0, 0, 0 }" "optimized" } } */
+/* { dg-final { scan-tree-dump "{ 1, 2, 4, 8 }" "optimized" } } */
+/* { dg-final { scan-tree-dump "{ 255, 510, 1020, 32639 }" "optimized" } } */
vec16 foo2 () {
pixel a = { 1, 2, 3, 4 };
@@ -36,7 +36,7 @@ vec16 foo2 () {
return __builtin_vis_fmul8x16au (a, b);
}
/* { dg-final { scan-assembler-not "fmul8x16au\t%" } } */
-/* { dg-final { scan-tree-dump "{ 1, 2, 3, 4 }" "final_cleanup" } } */
+/* { dg-final { scan-tree-dump "{ 1, 2, 3, 4 }" "optimized" } } */
vec16 foo3 () {
pixel a = { 1, 2, 3, 4 };
@@ -44,5 +44,5 @@ vec16 foo3 () {
return __builtin_vis_fmul8x16al (a, b);
}
/* { dg-final { scan-assembler-not "fmul8x16al\t%" } } */
-/* { dg-final { scan-tree-dump "{ 2, 4, 6, 8 }" "final_cleanup" } } */
-/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
+/* { dg-final { scan-tree-dump "{ 2, 4, 6, 8 }" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/sparc/pdist-2.c b/gcc/testsuite/gcc.target/sparc/pdist-2.c
index 9e061fdfd53..b9cbb346137 100644
--- a/gcc/testsuite/gcc.target/sparc/pdist-2.c
+++ b/gcc/testsuite/gcc.target/sparc/pdist-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mcpu=ultrasparc -mvis -O1 -fdump-tree-final_cleanup" } */
+/* { dg-options "-mcpu=ultrasparc -mvis -O1 -fdump-tree-optimized" } */
typedef long long int64_t;
typedef unsigned char vec8 __attribute__((vector_size(8)));
@@ -15,5 +15,5 @@ int64_t foo () {
}
/* { dg-final { scan-assembler-not "pdist\t%" } } */
-/* { dg-final { scan-tree-dump "return 475" "final_cleanup" } } */
-/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
+/* { dg-final { scan-tree-dump "return 475" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/spu/intrinsics-3.c b/gcc/testsuite/gcc.target/spu/intrinsics-3.c
index d468b23b6d0..3d394664102 100644
--- a/gcc/testsuite/gcc.target/spu/intrinsics-3.c
+++ b/gcc/testsuite/gcc.target/spu/intrinsics-3.c
@@ -19,3 +19,24 @@ void f3 (vec_float4 *in)
{
vec_uint4 out = spu_convtu (in[0], 128); /* { dg-error "expects an integer literal in the range" "0, 127" }*/
}
+
+/* Test that these intrinsics accept non-literal arguments */
+void f4 (vec_uint4 *in, int n)
+{
+ vec_float4 out = spu_convtf (in[0], n);
+}
+
+void f5 (vec_int4 *in, int n)
+{
+ vec_float4 out = spu_convtf (in[0], n);
+}
+
+void f6 (vec_float4 *in, int n)
+{
+ vec_int4 out = spu_convts (in[0], n);
+}
+
+void f7 (vec_float4 *in, int n)
+{
+ vec_uint4 out = spu_convtu (in[0], n);
+}
diff --git a/gcc/testsuite/gcc.target/spu/pr40001.c b/gcc/testsuite/gcc.target/spu/pr40001.c
new file mode 100644
index 00000000000..442f72d4fa8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/spu/pr40001.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+void *
+sbrk (unsigned int increment)
+{
+ volatile register
+ __attribute__ ((__spu_vector__)) unsigned int sp_r1 __asm__ ("1");
+ unsigned int sps;
+
+ sps = __builtin_spu_extract (sp_r1, 0);
+ if (sps - 4096 >= increment)
+ return 0;
+ else
+ return ((void *) -1);
+}
+
diff --git a/gcc/testsuite/gfortran.dg/advance_1.f90 b/gcc/testsuite/gfortran.dg/advance_1.f90
index 7e55e94334c..9002c52b5f7 100644
--- a/gcc/testsuite/gfortran.dg/advance_1.f90
+++ b/gcc/testsuite/gfortran.dg/advance_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25463 Check that advance='no' works correctly.
! Derived from example given in PR by Thomas Koenig
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/advance_4.f90 b/gcc/testsuite/gfortran.dg/advance_4.f90
index 633f90a583a..3676558fb2b 100644
--- a/gcc/testsuite/gfortran.dg/advance_4.f90
+++ b/gcc/testsuite/gfortran.dg/advance_4.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31207 Last record truncated for read after short write
program main
character(10) :: answer
diff --git a/gcc/testsuite/gfortran.dg/advance_5.f90 b/gcc/testsuite/gfortran.dg/advance_5.f90
index f906c721f34..3a48e536606 100644
--- a/gcc/testsuite/gfortran.dg/advance_5.f90
+++ b/gcc/testsuite/gfortran.dg/advance_5.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31207 Last record truncated for read after short write.
character(len=20) :: b
! write something no advance
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90
new file mode 100644
index 00000000000..c85edea62fc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/alloc_comp_assign_10.f90
@@ -0,0 +1,61 @@
+! { dg-do run }
+!
+! Test the fix for PR39879, in which gfc gagged on the double
+! defined assignment where the rhs had a default initialiser.
+!
+! Contributed by David Sagan <david.sagan@gmail.com>
+!
+module test_struct
+ interface assignment (=)
+ module procedure tao_lat_equal_tao_lat
+ end interface
+ type bunch_params_struct
+ integer n_live_particle
+ end type
+ type tao_lattice_struct
+ type (bunch_params_struct), allocatable :: bunch_params(:)
+ type (bunch_params_struct), allocatable :: bunch_params2(:)
+ end type
+ type tao_universe_struct
+ type (tao_lattice_struct), pointer :: model, design
+ character(200), pointer :: descrip => NULL()
+ end type
+ type tao_super_universe_struct
+ type (tao_universe_struct), allocatable :: u(:)
+ end type
+ type (tao_super_universe_struct), save, target :: s
+ contains
+ subroutine tao_lat_equal_tao_lat (lat1, lat2)
+ implicit none
+ type (tao_lattice_struct), intent(inout) :: lat1
+ type (tao_lattice_struct), intent(in) :: lat2
+ if (allocated(lat2%bunch_params)) then
+ lat1%bunch_params = lat2%bunch_params
+ end if
+ if (allocated(lat2%bunch_params2)) then
+ lat1%bunch_params2 = lat2%bunch_params2
+ end if
+ end subroutine
+end module
+
+program tao_program
+ use test_struct
+ implicit none
+ type (tao_universe_struct), pointer :: u
+ integer n, i
+ allocate (s%u(1))
+ u => s%u(1)
+ allocate (u%design, u%model)
+ n = 112
+ allocate (u%model%bunch_params(0:n), u%design%bunch_params(0:n))
+ u%design%bunch_params%n_live_particle = [(i, i = 0, n)]
+ u%model = u%design
+ u%model = u%design ! The double assignment was the cause of the ICE
+ if (.not. allocated (u%model%bunch_params)) call abort
+ if (any (u%model%bunch_params%n_live_particle .ne. [(i, i = 0, n)])) call abort
+ Deallocate (u%model%bunch_params, u%design%bunch_params)
+ deallocate (u%design, u%model)
+ deallocate (s%u)
+end program
+
+! { dg-final { cleanup-modules "test_struct" } }
diff --git a/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90 b/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90
new file mode 100644
index 00000000000..3ffaa14591d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ambiguous_reference_2.f90
@@ -0,0 +1,33 @@
+! { dg-do compile }
+!
+! PR 39930: Bogus error: ambiguous reference
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module a1
+contains
+ subroutine myRoutine
+ end subroutine
+end module
+
+module a2
+contains
+ subroutine myRoutine
+ end subroutine
+end module
+
+module b
+contains
+
+ subroutine otherRoutine
+ use a1
+ use a2
+ end subroutine
+
+ subroutine myRoutine
+ end subroutine myRoutine ! this is not ambiguous !
+
+end module
+
+! { dg-final { cleanup-modules "a1 a2 b" } }
+
diff --git a/gcc/testsuite/gfortran.dg/append_1.f90 b/gcc/testsuite/gfortran.dg/append_1.f90
index e058914bf56..8b81bc38484 100644
--- a/gcc/testsuite/gfortran.dg/append_1.f90
+++ b/gcc/testsuite/gfortran.dg/append_1.f90
@@ -1,7 +1,7 @@
! PR libfortran/21471
! Testing POSITION="APPEND"
!
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
subroutine failed
close (10,status='delete')
call abort
diff --git a/gcc/testsuite/gfortran.dg/backslash_1.f90 b/gcc/testsuite/gfortran.dg/backslash_1.f90
index ab7fc6ffc94..b9851342bb2 100644
--- a/gcc/testsuite/gfortran.dg/backslash_1.f90
+++ b/gcc/testsuite/gfortran.dg/backslash_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
character(len=4) a
open (10, status='scratch')
write (10,'(A)') '1\n2'
diff --git a/gcc/testsuite/gfortran.dg/backslash_2.f90 b/gcc/testsuite/gfortran.dg/backslash_2.f90
index dc4714f32e8..2f954d53949 100644
--- a/gcc/testsuite/gfortran.dg/backslash_2.f90
+++ b/gcc/testsuite/gfortran.dg/backslash_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-fbackslash" }
integer :: i, e
open (10, status='scratch')
diff --git a/gcc/testsuite/gfortran.dg/backslash_3.f b/gcc/testsuite/gfortran.dg/backslash_3.f
index 8625b3724e4..905d2b4c302 100644
--- a/gcc/testsuite/gfortran.dg/backslash_3.f
+++ b/gcc/testsuite/gfortran.dg/backslash_3.f
@@ -1,4 +1,4 @@
-C { dg-do run { target fd_truncate } }
+C { dg-do run }
C { dg-options "-fbackslash" }
C PR fortran/30278
program a
diff --git a/gcc/testsuite/gfortran.dg/backspace_10.f90 b/gcc/testsuite/gfortran.dg/backspace_10.f90
index 368a75973a7..574d464c4b3 100644
--- a/gcc/testsuite/gfortran.dg/backspace_10.f90
+++ b/gcc/testsuite/gfortran.dg/backspace_10.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR33307 I/O read/positioning problem - in BACKSPACE
! Test case devloped from test in PR by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program gfcbug69b
diff --git a/gcc/testsuite/gfortran.dg/backspace_3.f b/gcc/testsuite/gfortran.dg/backspace_3.f
index 2006cd4f969..419063b94a2 100644
--- a/gcc/testsuite/gfortran.dg/backspace_3.f
+++ b/gcc/testsuite/gfortran.dg/backspace_3.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25598 Error on repeated backspaces.
! Derived from example given in PR by Dale Ranta
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/backspace_4.f b/gcc/testsuite/gfortran.dg/backspace_4.f
index 6891c3c3434..69e0f40c7a1 100644
--- a/gcc/testsuite/gfortran.dg/backspace_4.f
+++ b/gcc/testsuite/gfortran.dg/backspace_4.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25598 Error on repeated backspaces.
! Derived from example given in PR by Dale Ranta
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/backspace_5.f b/gcc/testsuite/gfortran.dg/backspace_5.f
index 8ae375284a5..4cd657a7838 100644
--- a/gcc/testsuite/gfortran.dg/backspace_5.f
+++ b/gcc/testsuite/gfortran.dg/backspace_5.f
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! PR26464 File I/O error related to buffering and BACKSPACE
! Test case derived from case by Dale Ranta.
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/backspace_8.f b/gcc/testsuite/gfortran.dg/backspace_8.f
index c25dd5b4300..8c8c96aacec 100644
--- a/gcc/testsuite/gfortran.dg/backspace_8.f
+++ b/gcc/testsuite/gfortran.dg/backspace_8.f
@@ -1,4 +1,4 @@
-C { dg-do run { target fd_truncate } }
+C { dg-do run }
C PR libfortran/31618 - backspace after an error didn't work.
program main
character*78 msg
diff --git a/gcc/testsuite/gfortran.dg/backspace_9.f b/gcc/testsuite/gfortran.dg/backspace_9.f
index 01713b96752..fe62ea5a6e0 100644
--- a/gcc/testsuite/gfortran.dg/backspace_9.f
+++ b/gcc/testsuite/gfortran.dg/backspace_9.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR32235 incorrectly position text file after backspace
! Test case from PR, prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program main
diff --git a/gcc/testsuite/gfortran.dg/complex_write.f90 b/gcc/testsuite/gfortran.dg/complex_write.f90
index 763f3ab1735..694c069e368 100644
--- a/gcc/testsuite/gfortran.dg/complex_write.f90
+++ b/gcc/testsuite/gfortran.dg/complex_write.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr 19071
! test case provided by
! Thomas.Koenig@online.de
diff --git a/gcc/testsuite/gfortran.dg/convert_implied_open.f90 b/gcc/testsuite/gfortran.dg/convert_implied_open.f90
index 1f0abf3f8a7..9c25b5d961c 100644
--- a/gcc/testsuite/gfortran.dg/convert_implied_open.f90
+++ b/gcc/testsuite/gfortran.dg/convert_implied_open.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-fconvert=swap" }
! PR 26735 - implied open didn't use to honor -fconvert
program main
diff --git a/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_1.f b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_1.f
index 93e5033293b..af22c453636 100644
--- a/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_1.f
+++ b/gcc/testsuite/gfortran.dg/dollar_edit_descriptor_1.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-w" }
! PR libfortran/20006
character*5 c
diff --git a/gcc/testsuite/gfortran.dg/dos_eol.f b/gcc/testsuite/gfortran.dg/dos_eol.f
index 77f36a5fb20..3a22a14b143 100644
--- a/gcc/testsuite/gfortran.dg/dos_eol.f
+++ b/gcc/testsuite/gfortran.dg/dos_eol.f
@@ -1,5 +1,5 @@
! PR libfortran/19678 and PR libfortran/19679
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer i, j
open (10,status='scratch')
diff --git a/gcc/testsuite/gfortran.dg/empty_format_1.f90 b/gcc/testsuite/gfortran.dg/empty_format_1.f90
index e49ea4a5aee..79a2d0c17d7 100644
--- a/gcc/testsuite/gfortran.dg/empty_format_1.f90
+++ b/gcc/testsuite/gfortran.dg/empty_format_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 17709
! We weren't resetting the internal EOR flag correctly, so the second read
! wasn't advancing to the next line.
diff --git a/gcc/testsuite/gfortran.dg/endfile.f b/gcc/testsuite/gfortran.dg/endfile.f
index 61b43b859f2..6ece5459fa3 100644
--- a/gcc/testsuite/gfortran.dg/endfile.f
+++ b/gcc/testsuite/gfortran.dg/endfile.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25550 file data corrupted after reading end of file.
! Derived from example given in PR from Dale Ranta.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/eof_1.f90 b/gcc/testsuite/gfortran.dg/eof_1.f90
index 09bf9234774..05726bd1413 100644
--- a/gcc/testsuite/gfortran.dg/eof_1.f90
+++ b/gcc/testsuite/gfortran.dg/eof_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Program to test for proper EOF errors when reading past the end of a file.
! We used to get this wrong when a formatted read followed a list formatted
! read.
diff --git a/gcc/testsuite/gfortran.dg/eor_1.f90 b/gcc/testsuite/gfortran.dg/eor_1.f90
index fecbe92a412..dd3b5e98f70 100644
--- a/gcc/testsuite/gfortran.dg/eor_1.f90
+++ b/gcc/testsuite/gfortran.dg/eor_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 19451: The test for advance='NO' with eor used to be reversed.
program main
character*2 c
diff --git a/gcc/testsuite/gfortran.dg/eor_handling_1.f90 b/gcc/testsuite/gfortran.dg/eor_handling_1.f90
index 20b1998b098..241f8a0fe4e 100644
--- a/gcc/testsuite/gfortran.dg/eor_handling_1.f90
+++ b/gcc/testsuite/gfortran.dg/eor_handling_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 17992: Reading an empty file should yield zero with pad='YES'
! (which is the default).
! Test case supplied by milan@cmm.ki.si.
diff --git a/gcc/testsuite/gfortran.dg/eor_handling_2.f90 b/gcc/testsuite/gfortran.dg/eor_handling_2.f90
index ece547b855d..9ae56384695 100644
--- a/gcc/testsuite/gfortran.dg/eor_handling_2.f90
+++ b/gcc/testsuite/gfortran.dg/eor_handling_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 19568: Don't read across end of line when the format is longer
! than the line length and pad='yes' (default)
program main
diff --git a/gcc/testsuite/gfortran.dg/eor_handling_3.f90 b/gcc/testsuite/gfortran.dg/eor_handling_3.f90
index 7ba5c4b82fd..4225e867a85 100644
--- a/gcc/testsuite/gfortran.dg/eor_handling_3.f90
+++ b/gcc/testsuite/gfortran.dg/eor_handling_3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 19595: Handle end-of-record condition with pad=yes (default)
program main
integer i1, i2
diff --git a/gcc/testsuite/gfortran.dg/eor_handling_4.f90 b/gcc/testsuite/gfortran.dg/eor_handling_4.f90
index ce9fe5e4deb..300c10b820a 100644
--- a/gcc/testsuite/gfortran.dg/eor_handling_4.f90
+++ b/gcc/testsuite/gfortran.dg/eor_handling_4.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 20092, 20131: Handle end-of-record condition with pad=yes (default)
! for standard input. This test case only really tests anything if,
! by changing unit 5, you get to manipulate the standard input.
diff --git a/gcc/testsuite/gfortran.dg/eor_handling_5.f90 b/gcc/testsuite/gfortran.dg/eor_handling_5.f90
index 661d67c9fb5..c116fb7bdea 100644
--- a/gcc/testsuite/gfortran.dg/eor_handling_5.f90
+++ b/gcc/testsuite/gfortran.dg/eor_handling_5.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 20661: Handle non-advancing I/O with iostat
! Test case by Walt Brainerd, The Fortran Company
diff --git a/gcc/testsuite/gfortran.dg/error_recovery_5.f90 b/gcc/testsuite/gfortran.dg/error_recovery_5.f90
index 9cb696cdb5e..88acf93ccf7 100644
--- a/gcc/testsuite/gfortran.dg/error_recovery_5.f90
+++ b/gcc/testsuite/gfortran.dg/error_recovery_5.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR34411 hang-up during read of non-expected input
! Test case derived from that given in PR
! Prior to patch, the do loop was infinite, limits set in this one
diff --git a/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03 b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03
index 5f3a9612a3b..544a8109a21 100644
--- a/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03
+++ b/gcc/testsuite/gfortran.dg/f2003_inquire_1.f03
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-std=gnu" }
character(25) :: sround, ssign, sasynchronous, sdecimal, sencoding
integer :: vsize, vid
diff --git a/gcc/testsuite/gfortran.dg/f2003_io_4.f03 b/gcc/testsuite/gfortran.dg/f2003_io_4.f03
index 92c708c2921..d253a81bb64 100644
--- a/gcc/testsuite/gfortran.dg/f2003_io_4.f03
+++ b/gcc/testsuite/gfortran.dg/f2003_io_4.f03
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
! Test of decimal= feature
diff --git a/gcc/testsuite/gfortran.dg/f2003_io_5.f03 b/gcc/testsuite/gfortran.dg/f2003_io_5.f03
index 3949b1a372f..b816ded69c5 100644
--- a/gcc/testsuite/gfortran.dg/f2003_io_5.f03
+++ b/gcc/testsuite/gfortran.dg/f2003_io_5.f03
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
! Test of decimal="comma" in namelist and complex
integer :: i
diff --git a/gcc/testsuite/gfortran.dg/f2003_io_7.f03 b/gcc/testsuite/gfortran.dg/f2003_io_7.f03
index f45741718dc..6d2c11dfcbe 100644
--- a/gcc/testsuite/gfortran.dg/f2003_io_7.f03
+++ b/gcc/testsuite/gfortran.dg/f2003_io_7.f03
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
! Test of sign=, decimal=, and blank= .
program iotests
diff --git a/gcc/testsuite/gfortran.dg/fgetc_1.f90 b/gcc/testsuite/gfortran.dg/fgetc_1.f90
index 6277f3c1d15..966e15a98a4 100644
--- a/gcc/testsuite/gfortran.dg/fgetc_1.f90
+++ b/gcc/testsuite/gfortran.dg/fgetc_1.f90
@@ -1,5 +1,5 @@
! Testcase for the FGETC and FPUTC intrinsics
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
character(len=5) s
integer st
diff --git a/gcc/testsuite/gfortran.dg/fgetc_2.f90 b/gcc/testsuite/gfortran.dg/fgetc_2.f90
index 9c1a5dad14b..6dd12c4e242 100644
--- a/gcc/testsuite/gfortran.dg/fgetc_2.f90
+++ b/gcc/testsuite/gfortran.dg/fgetc_2.f90
@@ -1,5 +1,5 @@
! Testcase for the FGETC and FPUTC intrinsics
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
character(len=5) s
integer st
diff --git a/gcc/testsuite/gfortran.dg/flush_1.f90 b/gcc/testsuite/gfortran.dg/flush_1.f90
index e35955a27f3..90875dc651b 100644
--- a/gcc/testsuite/gfortran.dg/flush_1.f90
+++ b/gcc/testsuite/gfortran.dg/flush_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 22390 Implement flush statement
program flush_1
diff --git a/gcc/testsuite/gfortran.dg/fmt_exhaust.f90 b/gcc/testsuite/gfortran.dg/fmt_exhaust.f90
index bea3f800532..5db34051485 100644
--- a/gcc/testsuite/gfortran.dg/fmt_exhaust.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_exhaust.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR27304 Test running out of data descriptors with data remaining.
! Derived from case in PR. Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
program test
diff --git a/gcc/testsuite/gfortran.dg/fmt_huge.f90 b/gcc/testsuite/gfortran.dg/fmt_huge.f90
index f7b243cd3b6..43c4e2ac273 100644
--- a/gcc/testsuite/gfortran.dg/fmt_huge.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_huge.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR32446 printing big numbers in F0.1 format.
! This segfaulted before the patch.
open (10, status="scratch")
diff --git a/gcc/testsuite/gfortran.dg/fmt_read.f90 b/gcc/testsuite/gfortran.dg/fmt_read.f90
index 779ebae4f56..3b33946a523 100644
--- a/gcc/testsuite/gfortran.dg/fmt_read.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_read.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr18398, missing data on sequential formatted reads
! test contributed by Thomas.Koenig@online.de
open(7,status='scratch')
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_1.f90 b/gcc/testsuite/gfortran.dg/fmt_t_1.f90
index a4562658291..157ba131e40 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_1.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_t_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer nrow, vec(15)
open (10, status="scratch")
write (10, fmt='(a)') '001 1 2 3 4 5 6'
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_2.f90 b/gcc/testsuite/gfortran.dg/fmt_t_2.f90
index 6fe8c38ba1d..c2b869481df 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_2.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_t_2.f90
@@ -1,5 +1,5 @@
! { dg-options "" }
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr24699, handle end-of-record on READ with T format
! test contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
character*132 :: foost1, foost2, foost3
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_3.f90 b/gcc/testsuite/gfortran.dg/fmt_t_3.f90
index c7bf8e8f8a2..1ec67e11839 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_3.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_t_3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31051 bug with x and t format descriptors.
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org> from PR.
program t
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_4.f90 b/gcc/testsuite/gfortran.dg/fmt_t_4.f90
index 62b8d49c046..e40a4fc46b7 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_4.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_t_4.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31199, test case from PR report.
program write_write
character(len=20) :: a,b,c
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_5.f90 b/gcc/testsuite/gfortran.dg/fmt_t_5.f90
index 0c27b6aa3eb..e3c69319bd1 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_5.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_t_5.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR32678 GFortan works incorrectly when writing with FORMAT Tx
! Before patch, NULLs were inserted in output.
! Test case from reporter enhanced to detect this problem.
diff --git a/gcc/testsuite/gfortran.dg/fmt_t_7.f b/gcc/testsuite/gfortran.dg/fmt_t_7.f
index 718668ff404..f73baab3efc 100644
--- a/gcc/testsuite/gfortran.dg/fmt_t_7.f
+++ b/gcc/testsuite/gfortran.dg/fmt_t_7.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR34974 null bytes when reverse-tabbing long records
! Test case prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test
diff --git a/gcc/testsuite/gfortran.dg/fseek.f90 b/gcc/testsuite/gfortran.dg/fseek.f90
index 2649063ac59..0189c408c6a 100644
--- a/gcc/testsuite/gfortran.dg/fseek.f90
+++ b/gcc/testsuite/gfortran.dg/fseek.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
PROGRAM test_fseek
INTEGER, PARAMETER :: SEEK_SET = 0, SEEK_CUR = 1, SEEK_END = 2, fd=10
diff --git a/gcc/testsuite/gfortran.dg/ftell_1.f90 b/gcc/testsuite/gfortran.dg/ftell_1.f90
index 59ea85edfc4..4f617acb0f4 100644
--- a/gcc/testsuite/gfortran.dg/ftell_1.f90
+++ b/gcc/testsuite/gfortran.dg/ftell_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer(kind=8) o, o2
open (10, status="scratch")
diff --git a/gcc/testsuite/gfortran.dg/ftell_2.f90 b/gcc/testsuite/gfortran.dg/ftell_2.f90
index d8fd34803d5..ec7c96c3da4 100644
--- a/gcc/testsuite/gfortran.dg/ftell_2.f90
+++ b/gcc/testsuite/gfortran.dg/ftell_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer(kind=8) o
open (10, status="scratch")
if (ftell(10) /= 0) call abort
diff --git a/gcc/testsuite/gfortran.dg/func_derived_3.f90 b/gcc/testsuite/gfortran.dg/func_derived_3.f90
index 5eb60cfa018..6facf218e09 100644
--- a/gcc/testsuite/gfortran.dg/func_derived_3.f90
+++ b/gcc/testsuite/gfortran.dg/func_derived_3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! This tests the "virtual fix" for PR19561, where pointers to derived
! types were not generating correct code. This testcase is based on
! the original PR example. This example not only tests the
diff --git a/gcc/testsuite/gfortran.dg/inquire_9.f90 b/gcc/testsuite/gfortran.dg/inquire_9.f90
index 407eddb5204..99cd1af19cf 100644
--- a/gcc/testsuite/gfortran.dg/inquire_9.f90
+++ b/gcc/testsuite/gfortran.dg/inquire_9.f90
@@ -1,5 +1,5 @@
! PR fortran/24774
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
logical :: l
l = .true.
inquire (file='inquire_9 file that should not exist', exist=l)
diff --git a/gcc/testsuite/gfortran.dg/intrinsic.f90 b/gcc/testsuite/gfortran.dg/intrinsic.f90
index 8bb41fdfdc4..e3ac35ef52a 100644
--- a/gcc/testsuite/gfortran.dg/intrinsic.f90
+++ b/gcc/testsuite/gfortran.dg/intrinsic.f90
@@ -1,5 +1,8 @@
! { dg-do compile }
! { dg-options "-c -Wall" }
+!
+! PR fortran/20373
+! cf. also PR fortran/40041
subroutine valid
intrinsic :: abs ! ok, intrinsic function
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_2.f90 b/gcc/testsuite/gfortran.dg/intrinsic_2.f90
new file mode 100644
index 00000000000..b4919a13cde
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_2.f90
@@ -0,0 +1,40 @@
+! { dg-do compile }
+! { dg-options "-c -Wall" }
+!
+! PR fortran/40041
+! cf. also PR fortran/20373
+
+subroutine valid_one
+ REAL :: a
+ INTEGER :: n
+ INTRINSIC ABS, MAX
+ a(n) = MAX(ABS(2),ABS(3),n)
+end subroutine
+
+subroutine valid_two
+ IMPLICIT NONE
+ REAL :: a
+ INTEGER :: n
+ INTRINSIC ABS, MAX
+ a(n) = MAX(ABS(2),ABS(3),n)
+end subroutine
+
+subroutine warnings_one
+ REAL :: a
+ INTEGER :: n
+ REAL :: ABS ! { dg-warning "Type specified for intrinsic function" }
+ REAL :: MAX ! { dg-warning "Type specified for intrinsic function" }
+ INTRINSIC ABS, MAX
+ a(n) = MAX(ABS(2),ABS(3),n)
+end subroutine
+
+subroutine warnings_two
+ IMPLICIT NONE
+ REAL :: a
+ INTEGER :: n
+ INTRINSIC ABS ! { dg-warning "Type specified for intrinsic function" }
+ INTRINSIC MAX ! { dg-warning "Type specified for intrinsic function" }
+ REAL :: ABS
+ REAL :: MAX
+ a(n) = MAX(ABS(2),ABS(3),n)
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_3.f90 b/gcc/testsuite/gfortran.dg/intrinsic_3.f90
new file mode 100644
index 00000000000..fcd40e94bbb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_3.f90
@@ -0,0 +1,40 @@
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR 39876: module procedure name that collides with the GNU intrinsic
+!
+! Contributed by Alexei Matveev <alexei.matveev+gcc@gmail.com>
+
+module p
+ implicit none
+
+ contains
+
+ subroutine test()
+ implicit none
+ print *, avg(erfc)
+ end subroutine test
+
+ function avg(f)
+ implicit none
+ double precision :: avg
+ interface
+ double precision function f(x)
+ implicit none
+ double precision, intent(in) :: x
+ end function f
+ end interface
+ avg = ( f(1.0D0) + f(2.0D0) ) / 2
+ end function avg
+
+ function erfc(x)
+ implicit none
+ double precision, intent(in) :: x
+ double precision :: erfc
+ erfc = x
+ end function erfc
+
+end module p
+
+! { dg-final { cleanup-modules "p" } }
+
diff --git a/gcc/testsuite/gfortran.dg/iostat_1.f90 b/gcc/testsuite/gfortran.dg/iostat_1.f90
index 2517eb99235..79bc0018fbd 100644
--- a/gcc/testsuite/gfortran.dg/iostat_1.f90
+++ b/gcc/testsuite/gfortran.dg/iostat_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 23598 - The iostat variable wasn't reset if the previous
! I/O library call had an error.
program main
diff --git a/gcc/testsuite/gfortran.dg/iostat_2.f90 b/gcc/testsuite/gfortran.dg/iostat_2.f90
index f4750646611..afda93e8092 100644
--- a/gcc/testsuite/gfortran.dg/iostat_2.f90
+++ b/gcc/testsuite/gfortran.dg/iostat_2.f90
@@ -1,5 +1,5 @@
! PR libfortran/23784
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer i
close(10, status="whatever", iostat=i) ! { dg-warning "STATUS specifier in CLOSE statement.*has invalid value" }
if (i == 0) call abort()
diff --git a/gcc/testsuite/gfortran.dg/list_read_1.f90 b/gcc/testsuite/gfortran.dg/list_read_1.f90
index 2a2c5d1755b..6fba90ae738 100644
--- a/gcc/testsuite/gfortran.dg/list_read_1.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Program to test terminators in list-directed input
program list_read_1
character(len=5) :: s
diff --git a/gcc/testsuite/gfortran.dg/list_read_4.f90 b/gcc/testsuite/gfortran.dg/list_read_4.f90
index ba17625473d..fb1770e2303 100644
--- a/gcc/testsuite/gfortran.dg/list_read_4.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_4.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Test of gfortran list directed read> check delimiters are correctly
! treated. Written in f77 so that g77 will run for comparison.
!
diff --git a/gcc/testsuite/gfortran.dg/list_read_5.f90 b/gcc/testsuite/gfortran.dg/list_read_5.f90
index 658c5249722..f69d1f3ccff 100644
--- a/gcc/testsuite/gfortran.dg/list_read_5.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_5.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25307 Check handling of end-of-file conditions for list directed reads.
! Prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program pr25307
diff --git a/gcc/testsuite/gfortran.dg/list_read_7.f90 b/gcc/testsuite/gfortran.dg/list_read_7.f90
index f9800f2a7e2..4ee08354b1d 100644
--- a/gcc/testsuite/gfortran.dg/list_read_7.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_7.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR33400 Formatted read fails if line ends without line break
! Test case modified from that in PR by <jvdelisle@gcc.gnu.org>
integer, parameter :: fgsl_strmax = 128
diff --git a/gcc/testsuite/gfortran.dg/list_read_8.f90 b/gcc/testsuite/gfortran.dg/list_read_8.f90
index 85fa857e8cd..4be75fdb4e2 100644
--- a/gcc/testsuite/gfortran.dg/list_read_8.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_8.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR34676 IO error delayed
! Test case from PR modified by <jvdelisle@gcc.gnu.org>
implicit none
diff --git a/gcc/testsuite/gfortran.dg/list_read_9.f90 b/gcc/testsuite/gfortran.dg/list_read_9.f90
index 2021859eb4f..dac0dc8cd1d 100644
--- a/gcc/testsuite/gfortran.dg/list_read_9.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_9.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr37083 formatted read of line without trailing new-line fails
real :: a, b, c
open(unit=10,file="atest",access='stream',form='unformatted',&
diff --git a/gcc/testsuite/gfortran.dg/namelist_13.f90 b/gcc/testsuite/gfortran.dg/namelist_13.f90
index 1688e8ddff1..185b522e7f0 100644
--- a/gcc/testsuite/gfortran.dg/namelist_13.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_13.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests simple derived types.
! Provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/namelist_14.f90 b/gcc/testsuite/gfortran.dg/namelist_14.f90
index d6ab2940bdb..729f1b2d5c4 100644
--- a/gcc/testsuite/gfortran.dg/namelist_14.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_14.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests various combinations of intrinsic types, derived types, arrays,
! dummy arguments and common to check nml_get_addr_expr in trans-io.c.
! See comments below for selection.
diff --git a/gcc/testsuite/gfortran.dg/namelist_15.f90 b/gcc/testsuite/gfortran.dg/namelist_15.f90
index 65b015cfeed..e900e71d143 100644
--- a/gcc/testsuite/gfortran.dg/namelist_15.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_15.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests arrays of derived types containing derived type arrays whose
! components are character arrays - exercises object name parser in
! list_read.c. Checks that namelist output can be reread.
diff --git a/gcc/testsuite/gfortran.dg/namelist_16.f90 b/gcc/testsuite/gfortran.dg/namelist_16.f90
index 023816f0d02..c6eb8f75595 100644
--- a/gcc/testsuite/gfortran.dg/namelist_16.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_16.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests namelist on complex variables
! provided by Paul Thomas - pault@gcc.gnu.org
program namelist_16
diff --git a/gcc/testsuite/gfortran.dg/namelist_17.f90 b/gcc/testsuite/gfortran.dg/namelist_17.f90
index a802a22254a..e3eac5210bf 100644
--- a/gcc/testsuite/gfortran.dg/namelist_17.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_17.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests namelist on logical variables
! provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/namelist_18.f90 b/gcc/testsuite/gfortran.dg/namelist_18.f90
index 92b18758b44..d54d91f9a05 100644
--- a/gcc/testsuite/gfortran.dg/namelist_18.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_18.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests character delimiters for namelist write
! provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/namelist_19.f90 b/gcc/testsuite/gfortran.dg/namelist_19.f90
index f7c6d69e8a2..c06abf5295b 100644
--- a/gcc/testsuite/gfortran.dg/namelist_19.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_19.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Test namelist error trapping.
! provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/namelist_20.f90 b/gcc/testsuite/gfortran.dg/namelist_20.f90
index 9b2d896514a..155cf6f8ed2 100644
--- a/gcc/testsuite/gfortran.dg/namelist_20.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_20.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! Tests namelist io for an explicit shape array with negative bounds
! provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/namelist_24.f90 b/gcc/testsuite/gfortran.dg/namelist_24.f90
index c89ab3d2744..11cd2d0a466 100644
--- a/gcc/testsuite/gfortran.dg/namelist_24.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_24.f90
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
!{ dg-options -std=gnu }
! Tests namelist read when more data is provided then specified by
! array qualifier in list.
diff --git a/gcc/testsuite/gfortran.dg/namelist_26.f90 b/gcc/testsuite/gfortran.dg/namelist_26.f90
index a9cf4fd6b4a..2c1b26062e1 100644
--- a/gcc/testsuite/gfortran.dg/namelist_26.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_26.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR30918 Failure to skip commented out NAMELIST
! Before the patch, this read the commented out namelist and iuse would
! equal 2 when done. Test case from PR.
diff --git a/gcc/testsuite/gfortran.dg/namelist_27.f90 b/gcc/testsuite/gfortran.dg/namelist_27.f90
index e645ca5bc04..35fe032a62c 100644
--- a/gcc/testsuite/gfortran.dg/namelist_27.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_27.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31052 Bad IOSTAT values when readings NAMELISTs past EOF.
! Patch derived from PR, submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program gfcbug61
@@ -103,4 +103,4 @@ contains
status = ios
end subroutine read_report
-end program gfcbug61 \ No newline at end of file
+end program gfcbug61
diff --git a/gcc/testsuite/gfortran.dg/namelist_28.f90 b/gcc/testsuite/gfortran.dg/namelist_28.f90
index 09015d56e63..53b1f0ff002 100644
--- a/gcc/testsuite/gfortran.dg/namelist_28.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_28.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31052 Bad IOSTAT values when readings NAMELISTs past EOF.
! Patch derived from PR, submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program gfcbug61
diff --git a/gcc/testsuite/gfortran.dg/namelist_37.f90 b/gcc/testsuite/gfortran.dg/namelist_37.f90
index e200ad0b364..9ff62977710 100644
--- a/gcc/testsuite/gfortran.dg/namelist_37.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_37.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR33039 Read NAMELIST: reads wrong namelist name
! Test case from PR modified by Jerry DeLisle <jvdelisle@gcc.gnu.org>
PROGRAM namelist
diff --git a/gcc/testsuite/gfortran.dg/namelist_38.f90 b/gcc/testsuite/gfortran.dg/namelist_38.f90
index ed053690386..5578654eea4 100644
--- a/gcc/testsuite/gfortran.dg/namelist_38.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_38.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR33253 namelist: reading back a string, also fixed writing with delimiters.
! Test case modified from that of the PR by
! Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/namelist_39.f90 b/gcc/testsuite/gfortran.dg/namelist_39.f90
index 82e631e0dd0..36721409fa5 100644
--- a/gcc/testsuite/gfortran.dg/namelist_39.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_39.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR33421 and PR33253 Weird quotation of namelist output of character arrays
! Test case from Toon Moone, adapted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/namelist_40.f90 b/gcc/testsuite/gfortran.dg/namelist_40.f90
index 5e2c9d871a2..3c9d813343a 100644
--- a/gcc/testsuite/gfortran.dg/namelist_40.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_40.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR33672 Additional runtime checks needed for namelist reads
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/namelist_43.f90 b/gcc/testsuite/gfortran.dg/namelist_43.f90
index 0dc8dac04ae..fbfd3d5e69d 100644
--- a/gcc/testsuite/gfortran.dg/namelist_43.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_43.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-mieee" { target alpha*-*-* sh*-*-* } }
! { dg-skip-if "NaN not supported" { spu-*-* } { "*" } { "" } }
!
diff --git a/gcc/testsuite/gfortran.dg/namelist_44.f90 b/gcc/testsuite/gfortran.dg/namelist_44.f90
index 35ea667d3b9..143990261fe 100644
--- a/gcc/testsuite/gfortran.dg/namelist_44.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_44.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
!
! PR fortran/34530
!
diff --git a/gcc/testsuite/gfortran.dg/namelist_45.f90 b/gcc/testsuite/gfortran.dg/namelist_45.f90
index 2357223676b..3512d08b7cc 100644
--- a/gcc/testsuite/gfortran.dg/namelist_45.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_45.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR35617 read namelist error with '!'
program test
character(len=128) :: mhdpath
diff --git a/gcc/testsuite/gfortran.dg/namelist_46.f90 b/gcc/testsuite/gfortran.dg/namelist_46.f90
index c3e0d1c0bb7..0f048cf2100 100644
--- a/gcc/testsuite/gfortran.dg/namelist_46.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_46.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR35627 Namelist read problem with short logical followed by read real
program test
implicit none
diff --git a/gcc/testsuite/gfortran.dg/namelist_47.f90 b/gcc/testsuite/gfortran.dg/namelist_47.f90
index 8a8dd9d0997..bc9110fa3cd 100644
--- a/gcc/testsuite/gfortran.dg/namelist_47.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_47.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
module nml_47
type :: mt
diff --git a/gcc/testsuite/gfortran.dg/namelist_48.f90 b/gcc/testsuite/gfortran.dg/namelist_48.f90
index 0d1570bf304..e9a29285b17 100644
--- a/gcc/testsuite/gfortran.dg/namelist_48.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_48.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-fbackslash" }
! PR36538 namelist failure with tabs preceding object name
program check1
diff --git a/gcc/testsuite/gfortran.dg/namelist_49.f90 b/gcc/testsuite/gfortran.dg/namelist_49.f90
index e8efab33f3d..aec83eea965 100644
--- a/gcc/testsuite/gfortran.dg/namelist_49.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_49.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-fbackslash" }
! PR36546 Namelist error with tab following a comma and newline
program check1
diff --git a/gcc/testsuite/gfortran.dg/namelist_50.f90 b/gcc/testsuite/gfortran.dg/namelist_50.f90
index 678161b56d1..57e93fcbf25 100644
--- a/gcc/testsuite/gfortran.dg/namelist_50.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_50.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR36657 Namelist string constant immediately followed by comment
program gfcbug79
implicit none
diff --git a/gcc/testsuite/gfortran.dg/namelist_51.f90 b/gcc/testsuite/gfortran.dg/namelist_51.f90
index 152f9f8d8df..9663bd68d9f 100644
--- a/gcc/testsuite/gfortran.dg/namelist_51.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_51.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR36676 Namelist comment problems
! test case from PR, reduced by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program mem_nml
diff --git a/gcc/testsuite/gfortran.dg/namelist_52.f90 b/gcc/testsuite/gfortran.dg/namelist_52.f90
index e0975cf3ee8..6e31382927f 100644
--- a/gcc/testsuite/gfortran.dg/namelist_52.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_52.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR36582 Namelist I/O error: Bogus "Cannot match namelist object"
! Test case derived from PR.
module mod1
diff --git a/gcc/testsuite/gfortran.dg/namelist_56.f90 b/gcc/testsuite/gfortran.dg/namelist_56.f90
index 8d879fc910b..03fda759f5c 100644
--- a/gcc/testsuite/gfortran.dg/namelist_56.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_56.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR37707 Namelist read of array of derived type incorrect
! Test case from Tobias Burnus
IMPLICIT NONE
diff --git a/gcc/testsuite/gfortran.dg/namelist_char_only.f90 b/gcc/testsuite/gfortran.dg/namelist_char_only.f90
index ff06171bcee..9993669b38a 100644
--- a/gcc/testsuite/gfortran.dg/namelist_char_only.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_char_only.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-O0" }
! Test patch for PR24416.f90 - a used to come back from the read with var
! prepended.
diff --git a/gcc/testsuite/gfortran.dg/namelist_use.f90 b/gcc/testsuite/gfortran.dg/namelist_use.f90
index ab846862649..0460630dd33 100644
--- a/gcc/testsuite/gfortran.dg/namelist_use.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_use.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! This tests the fix for PR22010, where namelists were not being written to
! and read back from modules. It has two namelists: one that is USE
! associated and another that is concatenated by USE and host association.
diff --git a/gcc/testsuite/gfortran.dg/namelist_use_only.f90 b/gcc/testsuite/gfortran.dg/namelist_use_only.f90
index ce80d5e410d..a9adf015ded 100644
--- a/gcc/testsuite/gfortran.dg/namelist_use_only.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_use_only.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! This tests the fix for PR22010, where namelists were not being written to
! and read back from modules. It checks that namelists from modules that are
! selected by an ONLY declaration work correctly, even when the variables in
diff --git a/gcc/testsuite/gfortran.dg/noadv_size.f90 b/gcc/testsuite/gfortran.dg/noadv_size.f90
index cfc507a6fd8..a3a88b18ca7 100644
--- a/gcc/testsuite/gfortran.dg/noadv_size.f90
+++ b/gcc/testsuite/gfortran.dg/noadv_size.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 20774: Handle size parameter for non-advancing I/O correctly
program main
open(77,status='scratch')
diff --git a/gcc/testsuite/gfortran.dg/open_access_append_1.f90 b/gcc/testsuite/gfortran.dg/open_access_append_1.f90
index f67a8a93d34..8dae327968d 100644
--- a/gcc/testsuite/gfortran.dg/open_access_append_1.f90
+++ b/gcc/testsuite/gfortran.dg/open_access_append_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Testcase for the GNU extension OPEN(...,ACCESS="APPEND")
open (10,file="foo")
close (10,status="delete")
diff --git a/gcc/testsuite/gfortran.dg/pad_no.f90 b/gcc/testsuite/gfortran.dg/pad_no.f90
index 1b5fb2fd9da..c023adec815 100644
--- a/gcc/testsuite/gfortran.dg/pad_no.f90
+++ b/gcc/testsuite/gfortran.dg/pad_no.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Test correct operation for pad='no'.
program main
character(len=1) line(2)
diff --git a/gcc/testsuite/gfortran.dg/pointer_assign_7.f90 b/gcc/testsuite/gfortran.dg/pointer_assign_7.f90
new file mode 100644
index 00000000000..5ec32e8d66e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pointer_assign_7.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! PR 39931: ICE on invalid Fortran 95 code (bad pointer assignment)
+!
+! Contributed by Thomas Orgis <thomas.orgis@awi.de>
+
+program point_of_no_return
+
+implicit none
+
+type face_t
+ integer :: bla
+end type
+
+integer, pointer :: blu
+type(face_t), pointer :: face
+
+allocate(face)
+allocate(blu)
+
+face%bla => blu ! { dg-error "Pointer assignment to non-POINTER" }
+
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/pr12884.f b/gcc/testsuite/gfortran.dg/pr12884.f
index 811bef1f6f6..425604c02c5 100644
--- a/gcc/testsuite/gfortran.dg/pr12884.f
+++ b/gcc/testsuite/gfortran.dg/pr12884.f
@@ -1,4 +1,4 @@
-c { dg-do run { target fd_truncate } }
+c { dg-do run }
c pr 12884
c test namelist with input file containg / before namelist. Also checks
c non-standard use of $ instead of &
diff --git a/gcc/testsuite/gfortran.dg/pr17090.f90 b/gcc/testsuite/gfortran.dg/pr17090.f90
index bae2bb7da0e..6a685c2eddd 100644
--- a/gcc/testsuite/gfortran.dg/pr17090.f90
+++ b/gcc/testsuite/gfortran.dg/pr17090.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr 17090 Runtime I/O error
! bdavis9659@comcast.net
! 9/12/2004
diff --git a/gcc/testsuite/gfortran.dg/pr17285.f90 b/gcc/testsuite/gfortran.dg/pr17285.f90
index 8aa353cd853..58aee327aef 100644
--- a/gcc/testsuite/gfortran.dg/pr17285.f90
+++ b/gcc/testsuite/gfortran.dg/pr17285.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr 17285
! Test that namelist can read its own output.
! At the same time, check arrays and different terminations
diff --git a/gcc/testsuite/gfortran.dg/pr17286.f90 b/gcc/testsuite/gfortran.dg/pr17286.f90
index 5b946944468..e9beb6d375d 100644
--- a/gcc/testsuite/gfortran.dg/pr17286.f90
+++ b/gcc/testsuite/gfortran.dg/pr17286.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR17286
! Namelist read failed when spaces exist between the '=' and the numbers
! This is a libgfortran bug
diff --git a/gcc/testsuite/gfortran.dg/pr18122.f90 b/gcc/testsuite/gfortran.dg/pr18122.f90
index 6e7f200efd7..3907f0ae158 100644
--- a/gcc/testsuite/gfortran.dg/pr18122.f90
+++ b/gcc/testsuite/gfortran.dg/pr18122.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! test namelist with scalars and arrays.
! Based on example provided by thomas.koenig@online.de
diff --git a/gcc/testsuite/gfortran.dg/pr18210.f90 b/gcc/testsuite/gfortran.dg/pr18210.f90
index 253f2919816..60959841378 100644
--- a/gcc/testsuite/gfortran.dg/pr18210.f90
+++ b/gcc/testsuite/gfortran.dg/pr18210.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Names in upper case and object names starting column 2
! Based on example provided by thomas.koenig@online.de
diff --git a/gcc/testsuite/gfortran.dg/pr18392.f90 b/gcc/testsuite/gfortran.dg/pr18392.f90
index 3c15d4b3dff..de156f5a5fd 100644
--- a/gcc/testsuite/gfortran.dg/pr18392.f90
+++ b/gcc/testsuite/gfortran.dg/pr18392.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr 18392
! test namelist with derived types
! Based on example provided by thomas.koenig@online.de
diff --git a/gcc/testsuite/gfortran.dg/pr19155.f b/gcc/testsuite/gfortran.dg/pr19155.f
index 003c7fdcc44..6387c3f9ce3 100644
--- a/gcc/testsuite/gfortran.dg/pr19155.f
+++ b/gcc/testsuite/gfortran.dg/pr19155.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
!
! PR libfortran/19155
! We accept 'E+00' as a valid real number. The standard says it is not,
diff --git a/gcc/testsuite/gfortran.dg/pr19216.f b/gcc/testsuite/gfortran.dg/pr19216.f
index 40b3b5a7ae1..76c393836c9 100644
--- a/gcc/testsuite/gfortran.dg/pr19216.f
+++ b/gcc/testsuite/gfortran.dg/pr19216.f
@@ -1,5 +1,5 @@
! PR libfortran/19216
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer dat(3), i, j
data dat / 3,2,1 /
diff --git a/gcc/testsuite/gfortran.dg/pr19467.f90 b/gcc/testsuite/gfortran.dg/pr19467.f90
index 03cc7451e8e..ab4fa99c40b 100644
--- a/gcc/testsuite/gfortran.dg/pr19467.f90
+++ b/gcc/testsuite/gfortran.dg/pr19467.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr 19467
! test namelist with character arrays
! Based on example provided by paulthomas2@wanadoo.fr
diff --git a/gcc/testsuite/gfortran.dg/pr19657.f b/gcc/testsuite/gfortran.dg/pr19657.f
index a8e2012ee1b..1fe32ac7497 100644
--- a/gcc/testsuite/gfortran.dg/pr19657.f
+++ b/gcc/testsuite/gfortran.dg/pr19657.f
@@ -1,4 +1,4 @@
-c { dg-do run { target fd_truncate } }
+c { dg-do run }
c pr 19657
c test namelist not skipped if ending with logical.
c Based on example provided by fuyuki@ccsr.u-tokyo.ac.jp
diff --git a/gcc/testsuite/gfortran.dg/pr20257.f90 b/gcc/testsuite/gfortran.dg/pr20257.f90
index 77c885f48fc..aebfc03543f 100644
--- a/gcc/testsuite/gfortran.dg/pr20257.f90
+++ b/gcc/testsuite/gfortran.dg/pr20257.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-skip-if "Too big for local store" { spu-*-* } { "*" } { "" } }
integer,parameter :: n = 10000
real(8) array(10000)
diff --git a/gcc/testsuite/gfortran.dg/pr39666-1.f90 b/gcc/testsuite/gfortran.dg/pr39666-1.f90
new file mode 100644
index 00000000000..31840ec1df8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr39666-1.f90
@@ -0,0 +1,14 @@
+! PR middle-end/39666
+! { dg-do compile }
+! { dg-options "-O2 -Wuninitialized" }
+
+FUNCTION f(n)
+ INTEGER, INTENT(in) :: n
+ REAL :: f
+
+ SELECT CASE (n)
+ CASE (:-1); f = -1.0
+ CASE (0); f = 0.0
+ CASE (1:); f = 1.0
+ END SELECT
+END FUNCTION
diff --git a/gcc/testsuite/gfortran.dg/pr39666-2.f90 b/gcc/testsuite/gfortran.dg/pr39666-2.f90
new file mode 100644
index 00000000000..720a716ae31
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr39666-2.f90
@@ -0,0 +1,14 @@
+! PR middle-end/39666
+! { dg-do compile }
+! { dg-options "-O2 -Wuninitialized" }
+
+FUNCTION f(n) ! { dg-warning "may be used uninitialized" }
+ INTEGER, INTENT(in) :: n
+ REAL :: f
+
+ SELECT CASE (n)
+ CASE (:-1); f = -1.0
+ CASE (0); f = 0.0
+ CASE (2:); f = 1.0
+ END SELECT
+END FUNCTION
diff --git a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 b/gcc/testsuite/gfortran.dg/proc_decl_1.f90
index 1df8b277c3f..25c018301f3 100644
--- a/gcc/testsuite/gfortran.dg/proc_decl_1.f90
+++ b/gcc/testsuite/gfortran.dg/proc_decl_1.f90
@@ -47,10 +47,6 @@ program prog
procedure(dcos) :: my1
procedure(amax0) :: my2 ! { dg-error "not allowed in PROCEDURE statement" }
- type t
- procedure(),pointer:: p ! { dg-error "not yet implemented" }
- end type
-
real f, x
f(x) = sin(x**2)
external oo
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_16.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_16.f90
new file mode 100644
index 00000000000..904b550b5e9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_16.f90
@@ -0,0 +1,20 @@
+! { dg-do compile }
+!
+! PR 39946: PROCEDURE statements: interface with RESULT variable
+!
+! Original test case by Juergen Reuter <reuter@physik.uni-freiburg.de>
+! Modified by Janus Weil <janus@gcc.gnu.org>
+
+ procedure(prc_is_allowed), pointer :: fptr
+
+ interface
+ function prc_is_allowed (flv, hel, col) result (is_allowed)
+ logical :: is_allowed
+ integer, intent(in) :: flv, hel, col
+ end function prc_is_allowed
+ end interface
+
+ fptr => prc_is_allowed
+
+end
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_17.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_17.f90
new file mode 100644
index 00000000000..20e059fca3a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_17.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR39998: Procedure Pointer Assignments: Statement Functions & Internal Functions.
+!
+! Contributed by Tobias Burnus <burnus@net-b.de>
+
+ procedure(), pointer :: p
+ f(x) = x**2
+ p => f ! { dg-error "invalid in procedure pointer assignment" }
+ p => sub ! { dg-error "invalid in procedure pointer assignment" }
+contains
+ subroutine sub
+ end subroutine sub
+end
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_1.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_1.f90
new file mode 100644
index 00000000000..cbb69f1d50e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_1.f90
@@ -0,0 +1,65 @@
+! { dg-do run }
+!
+! PR39630: Fortran 2003: Procedure pointer components.
+!
+! Basic test for PPCs with SUBROUTINE interface and NOPASS.
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+ type t
+ integer :: i
+ procedure(sub), pointer, nopass :: ppc
+ procedure(), pointer, nopass :: proc
+ end type
+
+ type, extends(t) :: t2
+ procedure(), pointer, nopass :: proc2
+ end type t2
+
+ type(t) :: x
+ type(t2) :: x2
+
+ procedure(sub),pointer :: pp
+ integer :: sum = 0
+
+ x%i = 1
+ x%ppc => sub
+ pp => x%ppc
+
+ call sub(1)
+ if (sum/=1) call abort
+ call pp(2)
+ if (sum/=3) call abort
+ call x%ppc(3)
+ if (sum/=6) call abort
+
+ ! calling object as argument
+ x%proc => sub2
+ call x%proc(x)
+ if (x%i/=7) call abort
+
+ ! type extension
+ x%proc => sub
+ call x%proc(4)
+ if (sum/=10) call abort
+ x2%proc => sub
+ call x2%proc(5)
+ if (sum/=15) call abort
+ x2%proc2 => sub
+ call x2%proc2(6)
+ if (sum/=21) call abort
+
+contains
+
+ subroutine sub(y)
+ integer, intent(in) :: y
+ sum = sum + y
+ end subroutine
+
+ subroutine sub2(arg)
+ type(t),intent(inout) :: arg
+ arg%i = arg%i + sum
+ end subroutine
+
+end
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_2.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_2.f90
new file mode 100644
index 00000000000..886e8bf70fe
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_2.f90
@@ -0,0 +1,64 @@
+! { dg-do run }
+!
+! PR39630: Fortran 2003: Procedure pointer components.
+!
+! Basic test for PPCs with FUNCTION interface and NOPASS.
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+ type t
+ procedure(fcn), pointer, nopass :: ppc
+ procedure(abstr), pointer, nopass :: ppc1
+ procedure(), nopass, pointer:: iptr3
+ integer :: i
+ end type
+
+ abstract interface
+ integer function abstr(x)
+ integer, intent(in) :: x
+ end function
+ end interface
+
+ type(t) :: obj
+ procedure(fcn), pointer :: f
+ integer :: base
+
+ intrinsic :: iabs
+
+! Check with interface from contained function
+ obj%ppc => fcn
+ base=obj%ppc(2)
+ if (base/=4) call abort
+ call foo (obj%ppc,3)
+
+! Check with abstract interface
+ obj%ppc1 => obj%ppc
+ base=obj%ppc1(4)
+ if (base/=8) call abort
+ call foo (obj%ppc1,5)
+
+! Check compatibility components with non-components
+ f => obj%ppc
+ base=f(6)
+ if (base/=12) call abort
+ call foo (f,7)
+
+! Check with implicit interface
+ obj%iptr3 => iabs
+ base=obj%iptr3(-9)
+ if (base/=9) call abort
+
+contains
+
+ integer function fcn(x)
+ integer, intent(in) :: x
+ fcn = 2 * x
+ end function
+
+ subroutine foo (arg, i)
+ procedure (fcn), pointer :: arg
+ integer :: i
+ if (arg(i)/=2*i) call abort
+ end subroutine
+
+end
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_3.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_3.f90
new file mode 100644
index 00000000000..34c27f3c451
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_3.f90
@@ -0,0 +1,46 @@
+! { dg-do compile }
+!
+! PR39630: Fortran 2003: Procedure pointer components.
+!
+! Probing some error messages.
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+implicit none
+
+interface
+ subroutine sub
+ end subroutine
+end interface
+
+external :: aaargh
+
+type :: t
+ procedure(sub), pointer :: ptr1 ! { dg-error "not yet implemented" }
+ procedure(real), pointer, nopass :: ptr2
+ procedure(sub), pointer, nopass :: ptr3
+ procedure(), pointer, nopass ptr4 ! { dg-error "Expected '::'" }
+ procedure(), pointer, nopass, pointer :: ptr5 ! { dg-error "Duplicate" }
+ procedure, pointer, nopass :: ptr6 ! { dg-error "Syntax error" }
+ procedure(), pointer, nopass :: ptr7 => ptr2 ! { dg-error "requires a NULL" }
+ procedure(), nopass :: ptr8 ! { dg-error "POINTER attribute is required" }
+ procedure(pp), pointer, nopass :: ptr9 ! { dg-error "declared in a later PROCEDURE statement" }
+ procedure(aaargh), pointer, nopass :: ptr10 ! { dg-error "must be explicit" }
+ real :: y
+end type t
+
+procedure(sub), pointer :: pp
+
+type(t) :: x
+
+x%ptr2 => x ! { dg-error "Invalid procedure pointer assignment" }
+
+x => x%ptr2 ! { dg-error "Pointer assignment to non-POINTER" }
+
+call x%ptr2() ! { dg-error "attribute conflicts with" }
+print *,x%ptr3() ! { dg-error "attribute conflicts with" }
+
+call x%y ! { dg-error "Expected type-bound procedure or procedure pointer component" }
+
+end
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_4.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_4.f90
new file mode 100644
index 00000000000..b904a2f86aa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_4.f90
@@ -0,0 +1,120 @@
+! { dg-do compile }
+!
+! PR39630: Fortran 2003: Procedure pointer components.
+!
+! Original code by Juergen Reuter <juergen.reuter@physik.uni-freiburg.de>
+!
+! Adapted by Janus Weil <janus@gcc.gnu.org>
+
+
+! Test for infinte recursion in trans-types.c when a PPC interface
+! refers to the original type.
+
+module expressions
+
+ type :: eval_node_t
+ logical, pointer :: lval => null ()
+ type(eval_node_t), pointer :: arg1 => null ()
+ procedure(unary_log), nopass, pointer :: op1_log => null ()
+ end type eval_node_t
+
+ abstract interface
+ logical function unary_log (arg)
+ import eval_node_t
+ type(eval_node_t), intent(in) :: arg
+ end function unary_log
+ end interface
+
+contains
+
+ subroutine eval_node_set_op1_log (en, op)
+ type(eval_node_t), intent(inout) :: en
+ procedure(unary_log) :: op
+ en%op1_log => op
+ end subroutine eval_node_set_op1_log
+
+ subroutine eval_node_evaluate (en)
+ type(eval_node_t), intent(inout) :: en
+ en%lval = en%op1_log (en%arg1)
+ end subroutine
+
+end module
+
+
+! Test for C_F_PROCPOINTER and pointers to derived types
+
+module process_libraries
+
+ implicit none
+
+ type :: process_library_t
+ procedure(), nopass, pointer :: write_list
+ end type process_library_t
+
+contains
+
+ subroutine process_library_load (prc_lib)
+ use iso_c_binding
+ type(process_library_t) :: prc_lib
+ type(c_funptr) :: c_fptr
+ call c_f_procpointer (c_fptr, prc_lib%write_list)
+ end subroutine process_library_load
+
+ subroutine process_libraries_test ()
+ type(process_library_t), pointer :: prc_lib
+ call prc_lib%write_list ()
+ end subroutine process_libraries_test
+
+end module process_libraries
+
+
+! Test for argument resolution
+
+module hard_interactions
+
+ implicit none
+
+ type :: hard_interaction_t
+ procedure(), nopass, pointer :: new_event
+ end type hard_interaction_t
+
+ interface afv
+ module procedure afv_1
+ end interface
+
+contains
+
+ function afv_1 () result (a)
+ real, dimension(0:3) :: a
+ end function
+
+ subroutine hard_interaction_evaluate (hi)
+ type(hard_interaction_t) :: hi
+ call hi%new_event (afv ())
+ end subroutine
+
+end module hard_interactions
+
+
+! Test for derived types with PPC working properly as function result.
+
+ implicit none
+
+ type :: var_entry_t
+ procedure(), nopass, pointer :: obs1_int
+ end type var_entry_t
+
+ type(var_entry_t), pointer :: var
+
+ var => var_list_get_var_ptr ()
+
+contains
+
+ function var_list_get_var_ptr ()
+ type(var_entry_t), pointer :: var_list_get_var_ptr
+ end function var_list_get_var_ptr
+
+end
+
+! { dg-final { cleanup-modules "expressions process_libraries hard_interactions" } }
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_5.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_5.f90
new file mode 100644
index 00000000000..216cb4e9b3a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_5.f90
@@ -0,0 +1,47 @@
+! { dg-do run }
+!
+! PR39630: Fortran 2003: Procedure pointer components.
+!
+! Nested types / double component references.
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+abstract interface
+ subroutine as
+ end subroutine
+ integer function af()
+ end function
+end interface
+
+type :: t1
+ procedure(as), pointer, nopass :: s
+ procedure(af), pointer, nopass :: f
+end type
+
+type :: t2
+ type(t1) :: c
+end type
+
+type(t2) :: x
+integer :: j = 0
+
+x%c%s => is
+call x%c%s
+if (j/=5) call abort
+
+x%c%f => if
+j=x%c%f()
+if (j/=42) call abort
+
+contains
+
+subroutine is
+ j = 5
+end subroutine
+
+integer function if()
+ if = 42
+end function
+
+end
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_6.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_6.f90
new file mode 100644
index 00000000000..f0dcf4ccf01
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_6.f90
@@ -0,0 +1,64 @@
+! { dg-do run }
+!
+! PR39630: Fortran 2003: Procedure pointer components.
+!
+! test case taken from:
+! http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/4a827e8ced6efb0f/884b9eca6d7e6742?#884b9eca6d7e6742
+! http://fortranwiki.org/fortran/show/proc_component_example
+
+module proc_component_example
+
+ type t
+ real :: a
+ procedure(print_int), pointer, &
+ nopass :: proc
+ end type t
+
+ abstract interface
+ subroutine print_int (arg, lun)
+ import
+ type(t), intent(in) :: arg
+ integer, intent(in) :: lun
+ end subroutine print_int
+ end interface
+
+ integer :: calls = 0
+
+contains
+
+ subroutine print_me (arg, lun)
+ type(t), intent(in) :: arg
+ integer, intent(in) :: lun
+ write (lun,*) arg%a
+ calls = calls + 1
+ end subroutine print_me
+
+ subroutine print_my_square (arg, lun)
+ type(t), intent(in) :: arg
+ integer, intent(in) :: lun
+ write (lun,*) arg%a**2
+ calls = calls + 1
+ end subroutine print_my_square
+
+end module proc_component_example
+
+program main
+
+ use proc_component_example
+ use iso_fortran_env, only : output_unit
+
+ type(t) :: x
+
+ x%a = 2.71828
+
+ x%proc => print_me
+ call x%proc(x, output_unit)
+ x%proc => print_my_square
+ call x%proc(x, output_unit)
+
+ if (calls/=2) call abort
+
+end program main
+
+! { dg-final { cleanup-modules "proc_component_example" } }
+
diff --git a/gcc/testsuite/gfortran.dg/read_bad_advance.f90 b/gcc/testsuite/gfortran.dg/read_bad_advance.f90
index 3ca4493c451..5b43cfecc7f 100644
--- a/gcc/testsuite/gfortran.dg/read_bad_advance.f90
+++ b/gcc/testsuite/gfortran.dg/read_bad_advance.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR27138 Failure to advance line on bad list directed read.
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test
diff --git a/gcc/testsuite/gfortran.dg/read_eof_2.f90 b/gcc/testsuite/gfortran.dg/read_eof_2.f90
index 539553d53d8..9017548d463 100644
--- a/gcc/testsuite/gfortran.dg/read_eof_2.f90
+++ b/gcc/testsuite/gfortran.dg/read_eof_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25835 Check that reading from a file that is at end-of-file does not
! segfault or give error. Test case derived from example in PR from Dale Ranta.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/read_eof_4.f90 b/gcc/testsuite/gfortran.dg/read_eof_4.f90
index da0ae5c185d..ee95268d50d 100644
--- a/gcc/testsuite/gfortran.dg/read_eof_4.f90
+++ b/gcc/testsuite/gfortran.dg/read_eof_4.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 27575 and PR 30009: This test checks the error checking for end
! of file condition.
! Derived from test case in PR.
diff --git a/gcc/testsuite/gfortran.dg/read_many_1.f b/gcc/testsuite/gfortran.dg/read_many_1.f
index d015cf833ea..4fac689ac48 100644
--- a/gcc/testsuite/gfortran.dg/read_many_1.f
+++ b/gcc/testsuite/gfortran.dg/read_many_1.f
@@ -1,4 +1,4 @@
-!{ dg-do run { target fd_truncate } }
+!{ dg-do run }
! PR26423 Large file I/O error related to buffering
! Test case derived from case by Dale Ranta.
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/read_noadvance.f90 b/gcc/testsuite/gfortran.dg/read_noadvance.f90
index 987d811409b..e55763ad8bb 100644
--- a/gcc/testsuite/gfortran.dg/read_noadvance.f90
+++ b/gcc/testsuite/gfortran.dg/read_noadvance.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! pr24719, non-advancing read should read more than one line
! test contributed by jerry delisle <jvdelisle@gcc.gnu.org>
implicit none
diff --git a/gcc/testsuite/gfortran.dg/read_repeat.f90 b/gcc/testsuite/gfortran.dg/read_repeat.f90
index ab7a6a4c7d5..192ebe81ffb 100644
--- a/gcc/testsuite/gfortran.dg/read_repeat.f90
+++ b/gcc/testsuite/gfortran.dg/read_repeat.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR39528 repeated entries not read when using list-directed input.
! Test case derived from reporters example.
program rread
diff --git a/gcc/testsuite/gfortran.dg/read_size_noadvance.f90 b/gcc/testsuite/gfortran.dg/read_size_noadvance.f90
index 37ecff90d65..819a28dcccb 100644
--- a/gcc/testsuite/gfortran.dg/read_size_noadvance.f90
+++ b/gcc/testsuite/gfortran.dg/read_size_noadvance.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR26890 Test for use of SIZE variable in IO list.
! Test case from Paul Thomas.
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/read_x_past.f b/gcc/testsuite/gfortran.dg/read_x_past.f
index 16f66234548..4a6d05369d3 100644
--- a/gcc/testsuite/gfortran.dg/read_x_past.f
+++ b/gcc/testsuite/gfortran.dg/read_x_past.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options -w }
! PR 26661 : Test reading X's past file end with no LF or CR.
! PR 26880 : Tests that rewind clears the gfc_unit read_bad flag.
diff --git a/gcc/testsuite/gfortran.dg/record_marker_1.f90 b/gcc/testsuite/gfortran.dg/record_marker_1.f90
index d5d5a2ebb20..5bcfbc611a5 100644
--- a/gcc/testsuite/gfortran.dg/record_marker_1.f90
+++ b/gcc/testsuite/gfortran.dg/record_marker_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-frecord-marker=4" }
program main
diff --git a/gcc/testsuite/gfortran.dg/record_marker_3.f90 b/gcc/testsuite/gfortran.dg/record_marker_3.f90
index dd9d45505e0..7459d7210a4 100644
--- a/gcc/testsuite/gfortran.dg/record_marker_3.f90
+++ b/gcc/testsuite/gfortran.dg/record_marker_3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-frecord-marker=8" }
program main
diff --git a/gcc/testsuite/gfortran.dg/rewind_1.f90 b/gcc/testsuite/gfortran.dg/rewind_1.f90
index 61392abfdf5..cbd2ef17b8f 100644
--- a/gcc/testsuite/gfortran.dg/rewind_1.f90
+++ b/gcc/testsuite/gfortran.dg/rewind_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Check that rewind doesn't delete a file.
! Writing to the file truncates it at the end of the current record. Out
! IO library was defering the actual truncation until the file was rewound.
diff --git a/gcc/testsuite/gfortran.dg/runtime_warning_1.f90 b/gcc/testsuite/gfortran.dg/runtime_warning_1.f90
index c27e7a27db7..6af85c344ef 100644
--- a/gcc/testsuite/gfortran.dg/runtime_warning_1.f90
+++ b/gcc/testsuite/gfortran.dg/runtime_warning_1.f90
@@ -3,7 +3,7 @@
! Contributor Francois-Xavier Coudert <coudert@clipper.ens.fr>
!
! { dg-options "-pedantic" }
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
!
character*5 c
open (42,status='scratch')
diff --git a/gcc/testsuite/gfortran.dg/shape_3.f90 b/gcc/testsuite/gfortran.dg/shape_3.f90
index f715645b924..ea725a014e9 100644
--- a/gcc/testsuite/gfortran.dg/shape_3.f90
+++ b/gcc/testsuite/gfortran.dg/shape_3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 34980 - we got a segfault for calling shape
! with a scalar.
program main
diff --git a/gcc/testsuite/gfortran.dg/slash_1.f90 b/gcc/testsuite/gfortran.dg/slash_1.f90
index b62b338c07c..d4a59a31acf 100644
--- a/gcc/testsuite/gfortran.dg/slash_1.f90
+++ b/gcc/testsuite/gfortran.dg/slash_1.f90
@@ -1,5 +1,5 @@
! PR libfortran/22170
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
integer i
open (10,status='scratch')
write (10,'(A,2/,A)') '12', '17'
diff --git a/gcc/testsuite/gfortran.dg/stat_1.f90 b/gcc/testsuite/gfortran.dg/stat_1.f90
index 2fceaab9f7e..f3c185a52c3 100644
--- a/gcc/testsuite/gfortran.dg/stat_1.f90
+++ b/gcc/testsuite/gfortran.dg/stat_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
! { dg-options "-std=gnu" }
character(len=*), parameter :: f = "testfile"
diff --git a/gcc/testsuite/gfortran.dg/stat_2.f90 b/gcc/testsuite/gfortran.dg/stat_2.f90
index 72661aced41..3c4b2529ce7 100644
--- a/gcc/testsuite/gfortran.dg/stat_2.f90
+++ b/gcc/testsuite/gfortran.dg/stat_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-skip-if "" { *-*-mingw* spu-*-* } { "*" } { "" } }
! { dg-options "-std=gnu" }
character(len=*), parameter :: f = "testfile"
diff --git a/gcc/testsuite/gfortran.dg/streamio_11.f90 b/gcc/testsuite/gfortran.dg/streamio_11.f90
index 0ec2f2e8d35..2084a23159b 100644
--- a/gcc/testsuite/gfortran.dg/streamio_11.f90
+++ b/gcc/testsuite/gfortran.dg/streamio_11.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR29277 Stream IO test 11, tests formatted form.
! Contributed by Tobias Burnas.
program stream_test
diff --git a/gcc/testsuite/gfortran.dg/streamio_3.f90 b/gcc/testsuite/gfortran.dg/streamio_3.f90
index 0cbab67f6d8..d73e431a09f 100644
--- a/gcc/testsuite/gfortran.dg/streamio_3.f90
+++ b/gcc/testsuite/gfortran.dg/streamio_3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25828 Stream IO test 3, tests read_x and inquire.
! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
program streamio_3
@@ -15,4 +15,4 @@ program streamio_3
inquire(unit=10, access=myaccess)
if (myaccess.ne."STREAM") call abort()
close(10,status="delete")
-end program streamio_3 \ No newline at end of file
+end program streamio_3
diff --git a/gcc/testsuite/gfortran.dg/streamio_4.f90 b/gcc/testsuite/gfortran.dg/streamio_4.f90
index 957df8c53c8..ce638a415ad 100644
--- a/gcc/testsuite/gfortran.dg/streamio_4.f90
+++ b/gcc/testsuite/gfortran.dg/streamio_4.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR25828 Stream IO test 4, Tests string read and writes, single byte.
! Verifies buffering is working correctly and position="append"
! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
@@ -35,4 +35,4 @@ program streamtest
end do
close(10,status="delete")
-end program streamtest \ No newline at end of file
+end program streamtest
diff --git a/gcc/testsuite/gfortran.dg/streamio_9.f90 b/gcc/testsuite/gfortran.dg/streamio_9.f90
index a134d549e1f..150c1c6c393 100644
--- a/gcc/testsuite/gfortran.dg/streamio_9.f90
+++ b/gcc/testsuite/gfortran.dg/streamio_9.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR29053 Stream IO test 9.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
! Test case derived from that given in PR by Steve Kargl.
diff --git a/gcc/testsuite/gfortran.dg/tl_editing.f90 b/gcc/testsuite/gfortran.dg/tl_editing.f90
index aa3a01cfd02..d2a7ede436f 100644
--- a/gcc/testsuite/gfortran.dg/tl_editing.f90
+++ b/gcc/testsuite/gfortran.dg/tl_editing.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Test of fix to bug triggered by NIST fm908.for.
! Left tabbing, followed by X or T-tabbing to the right would
! cause spaces to be overwritten on output data.
diff --git a/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 b/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
index ad79fd76950..3d35312c92c 100644
--- a/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
+++ b/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-pedantic" }
! This test verifies the most basic sequential unformatted I/O
! with convert="swap".
diff --git a/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90 b/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90
index b38da247037..f29f6ee249e 100644
--- a/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90
+++ b/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
program main
complex(kind=4) :: c
real(kind=4) :: a(2)
diff --git a/gcc/testsuite/gfortran.dg/unf_read_corrupted_2.f90 b/gcc/testsuite/gfortran.dg/unf_read_corrupted_2.f90
index 4dd5234fb60..1788b457d19 100644
--- a/gcc/testsuite/gfortran.dg/unf_read_corrupted_2.f90
+++ b/gcc/testsuite/gfortran.dg/unf_read_corrupted_2.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR31880 silent data corruption in gfortran read statement
! Test from PR.
program r3
diff --git a/gcc/testsuite/gfortran.dg/unf_short_record_1.f90 b/gcc/testsuite/gfortran.dg/unf_short_record_1.f90
index 9dca08e5ece..45c94c29405 100644
--- a/gcc/testsuite/gfortran.dg/unf_short_record_1.f90
+++ b/gcc/testsuite/gfortran.dg/unf_short_record_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 29627 - partial reads of unformatted records
program main
character a(3)
diff --git a/gcc/testsuite/gfortran.dg/utf8_1.f03 b/gcc/testsuite/gfortran.dg/utf8_1.f03
index f2d62f65b0b..c07a6b85ab4 100644
--- a/gcc/testsuite/gfortran.dg/utf8_1.f03
+++ b/gcc/testsuite/gfortran.dg/utf8_1.f03
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-fbackslash" }
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test1
@@ -28,4 +28,4 @@ program test1
end program test1
! The following examples require UTF-8 enabled editor to see correctly.
! ジエリー Sample of Japanese characters.
-! Οá½Ï‡á½¶ Sample of Greek characters. \ No newline at end of file
+! Οá½Ï‡á½¶ Sample of Greek characters.
diff --git a/gcc/testsuite/gfortran.dg/utf8_2.f03 b/gcc/testsuite/gfortran.dg/utf8_2.f03
index 3e409970bed..0146a2e281b 100644
--- a/gcc/testsuite/gfortran.dg/utf8_2.f03
+++ b/gcc/testsuite/gfortran.dg/utf8_2.f03
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! { dg-options "-fbackslash" }
! Contributed by Tobias Burnus
program test2
diff --git a/gcc/testsuite/gfortran.dg/vect/fast-math-pr38968.f90 b/gcc/testsuite/gfortran.dg/vect/fast-math-pr38968.f90
index e16131502db..abb3c5f10df 100644
--- a/gcc/testsuite/gfortran.dg/vect/fast-math-pr38968.f90
+++ b/gcc/testsuite/gfortran.dg/vect/fast-math-pr38968.f90
@@ -17,5 +17,5 @@ program mymatmul
end program mymatmul
-! { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } }
+! { dg-final { scan-tree-dump "vectorized 1 loops" "vect" { xfail { ia64-*-* sparc*-*-* } } } }
! { dg-final { cleanup-tree-dump "vect" } }
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
index 0c7c5f3f807..0fe479cda64 100644
--- a/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! Wide chracter I/O test 1, formatted and mixed kind
! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test1
diff --git a/gcc/testsuite/gfortran.dg/write_check3.f90 b/gcc/testsuite/gfortran.dg/write_check3.f90
index 48950965a66..802a06d27a9 100644
--- a/gcc/testsuite/gfortran.dg/write_check3.f90
+++ b/gcc/testsuite/gfortran.dg/write_check3.f90
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR29936 Missed constraint on RECL=specifier in unformatted sequential WRITE
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program us_recl
diff --git a/gcc/testsuite/gfortran.dg/write_rewind_2.f b/gcc/testsuite/gfortran.dg/write_rewind_2.f
index e1a8dec22eb..501995c6eb5 100644
--- a/gcc/testsuite/gfortran.dg/write_rewind_2.f
+++ b/gcc/testsuite/gfortran.dg/write_rewind_2.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 26499 Test write with rewind sequences to make sure buffering and
! end-of-file conditions are handled correctly. Derived from test case by Dale
! Ranta. Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
diff --git a/gcc/testsuite/gfortran.dg/x_slash_2.f b/gcc/testsuite/gfortran.dg/x_slash_2.f
index 9c42f671d81..6023b647d24 100644
--- a/gcc/testsuite/gfortran.dg/x_slash_2.f
+++ b/gcc/testsuite/gfortran.dg/x_slash_2.f
@@ -1,4 +1,4 @@
-! { dg-do run { target fd_truncate } }
+! { dg-do run }
! PR 34887 - reverse tabs followed by a slash used to confuse I/O.
program main
character(len=2) :: b, a
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f b/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f
new file mode 100644
index 00000000000..5ead135d807
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/compile/pr39937.f
@@ -0,0 +1,28 @@
+ SUBROUTINE DTREVC( SIDE, HOWMNY, SELECT, N, T, LDT, VL, LDVL, VR,
+ $ LDVR, MM, M, WORK, INFO )
+ DOUBLE PRECISION T( LDT, * ), VL( LDVL, * ), VR( LDVR, * ),
+ $ WORK( * )
+ DOUBLE PRECISION X( 2, 2 )
+ CALL DLALN2( .FALSE., 1, 1, SMIN, ONE, T( J, J ),
+ $ ZERO, X, 2, SCALE, XNORM, IERR )
+ CALL DSCAL( KI, SCALE, WORK( 1+N ), 1 )
+ DO 90 J = KI - 2, 1, -1
+ IF( J.GT.JNXT )
+ $ GO TO 90
+ JNXT = J - 1
+ IF( J.GT.1 ) THEN
+ IF( T( J, J-1 ).NE.ZERO ) THEN
+ IF( WORK( J ).GT.BIGNUM / XNORM ) THEN
+ X( 1, 1 ) = X( 1, 1 ) / XNORM
+ END IF
+ END IF
+ CALL DLALN2( .FALSE., 2, 2, SMIN, ONE,
+ $ T( J-1, J-1 ), LDT, ONE, ONE,
+ $ XNORM, IERR )
+ CALL DAXPY( J-2, -X( 1, 1 ), T( 1, J-1 ), 1,
+ $ WORK( 1+N ), 1 )
+ CALL DAXPY( J-2, -X( 2, 2 ), T( 1, J ), 1,
+ $ WORK( 1+N2 ), 1 )
+ END IF
+ 90 CONTINUE
+ END
diff --git a/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f b/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f
new file mode 100644
index 00000000000..ddd269f2a46
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/execute/pr40021.f
@@ -0,0 +1,40 @@
+C Derived from lapack
+ PROGRAM test
+ DOUBLE PRECISION DA
+ INTEGER I, N
+ DOUBLE PRECISION DX(9),DY(9)
+
+ EXTERNAL DAXPY
+ N=5
+ DA=1.0
+ DATA DX/-2, -1, -3, -4, 1, 2, 10, 15, 14/
+ DATA DY/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/
+ CALL DAXPY (N,DA,DX,DY)
+ DO 10 I = 1, N
+ if (DX(I).ne.DY(I)) call abort
+10 CONTINUE
+ STOP
+ END
+
+ SUBROUTINE DAXPY(N,DA,DX,DY)
+ DOUBLE PRECISION DA
+ INTEGER N
+ DOUBLE PRECISION DX(*),DY(*)
+ INTEGER I,IX,IY,M,MP1
+ INTRINSIC MOD
+ IF (N.LE.0) RETURN
+ 20 M = MOD(N,4)
+ IF (M.EQ.0) GO TO 40
+ DO 30 I = 1,M
+ DY(I) = DY(I) + DA*DX(I)
+ 30 CONTINUE
+ IF (N.LT.4) RETURN
+ 40 MP1 = M + 1
+ DO 50 I = MP1,N,4
+ DY(I) = DY(I) + DA*DX(I)
+ DY(I+1) = DY(I+1) + DA*DX(I+1)
+ DY(I+2) = DY(I+2) + DA*DX(I+2)
+ DY(I+3) = DY(I+3) + DA*DX(I+3)
+ 50 CONTINUE
+ RETURN
+ END
diff --git a/gcc/testsuite/gnat.dg/opt2.adb b/gcc/testsuite/gnat.dg/opt2.adb
new file mode 100644
index 00000000000..a6c247fdb9b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt2.adb
@@ -0,0 +1,31 @@
+-- { dg-do run }
+-- { dg-options "-O2 -fno-inline" }
+
+procedure Opt2 is
+ function Get return String is
+ begin
+ return "[]";
+ end Get;
+
+ Message : String := Get;
+
+ F, L : Integer;
+begin
+ for J in Message'Range loop
+ if Message (J) = '[' then
+ F := J;
+ elsif Message (J) = ']' then
+ L := J;
+ exit;
+ end if;
+ end loop;
+
+ declare
+ M : String :=
+ Message (Message'First .. F) & Message (L .. Message'Last);
+ begin
+ if M /= "[]" then
+ raise Program_Error;
+ end if;
+ end;
+end;
diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp
index e763fc2f0f6..934f31dabdc 100644
--- a/gcc/testsuite/lib/objc.exp
+++ b/gcc/testsuite/lib/objc.exp
@@ -95,6 +95,8 @@ proc objc_init { args } {
global OBJC_UNDER_TEST
global TOOL_EXECUTABLE
global objc_libgcc_s_path
+ global gcc_warning_prefix
+ global gcc_error_prefix
# We set LC_ALL and LANG to C so that we get the same error messages as expected.
setenv LC_ALL C
@@ -114,6 +116,9 @@ proc objc_init { args } {
set tmpdir /tmp
}
+ set gcc_warning_prefix "warning:"
+ set gcc_error_prefix "error:"
+
objc_maybe_build_wrapper "${tmpdir}/objc-testglue.o"
set objc_libgcc_s_path [gcc-set-multilib-library-path $OBJC_UNDER_TEST]
diff --git a/gcc/testsuite/lib/plugin-support.exp b/gcc/testsuite/lib/plugin-support.exp
new file mode 100644
index 00000000000..79ccc93ba75
--- /dev/null
+++ b/gcc/testsuite/lib/plugin-support.exp
@@ -0,0 +1,109 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# 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 3 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 GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+
+# This file contains the support procedures for testing the plugin mechanism.
+
+load_lib dg.exp
+load_lib gcc.exp
+
+#
+# plugin-get-options -- process test directives
+#
+# SRC is the full pathname of the plugin source file.
+#
+proc plugin-get-options { src } {
+ # dg-options sets a variable called dg-extra-tool-flags.
+ set dg-extra-tool-flags ""
+
+ # dg-require-* sets dg-do-what.
+ upvar dg-do-what dg-do-what
+
+ set tmp [dg-get-options $src]
+ foreach op $tmp {
+ set cmd [lindex $op 0]
+ if { ![string compare "dg-options" $cmd] } {
+ set status [catch "$op" errmsg]
+ if { $status != 0 } {
+ perror "src: $errmsg for \"$op\"\n"
+ unresolved "$src: $errmsg for \"$op\""
+ return
+ }
+ } else {
+ # Ignore unrecognized dg- commands, but warn about them.
+ warning "plugin.exp does not support $cmd"
+ }
+ }
+
+ # Return flags to use for compiling the plugin source file
+ return ${dg-extra-tool-flags}
+}
+
+#
+# plugin-test-execute -- build the plugin first and then compile the
+# test files with the plugin.
+#
+# PLUGIN_SRC is the full pathname of the plugin source file.
+# PLUGIN_TESTS is a list of input test source files.
+#
+proc plugin-test-execute { plugin_src plugin_tests } {
+ global srcdir objdir
+ global verbose
+ global GMPINC
+ global HOSTCC
+ global HOSTCFLAGS
+
+ set basename [file tail $plugin_src]
+ set base [file rootname $basename]
+ set plugin_lib $base.so
+
+ verbose "Test the plugin $basename" 1
+
+ # Build the plugin itself
+ set extra_flags [plugin-get-options $plugin_src]
+
+ # Note that the plugin test support currently only works when the GCC
+ # build tree is available. (We make sure that is the case in plugin.exp.)
+ # Once we have figured out how/where to package/install GCC header files
+ # for general plugin support, we should modify the following include paths
+ # accordingly.
+ set gcc_srcdir "$srcdir/../.."
+ set gcc_objdir "$objdir/../../.."
+ set includes "-I. -I${srcdir} -I${gcc_srcdir}/gcc -I${gcc_objdir}/gcc \
+ -I${gcc_srcdir}/include -I${gcc_srcdir}/libcpp/include \
+ $GMPINC"
+
+ set optstr "$includes $extra_flags -DIN_GCC -fPIC -shared"
+
+ # Temporarily switch to the environment for the host compiler.
+ restore_ld_library_path_env_vars
+ set status [remote_exec build "$HOSTCC $HOSTCFLAGS $plugin_src $optstr -o $plugin_lib"]
+ set status [lindex $status 0]
+ set_ld_library_path_env_vars
+
+ if { $status != 0 } then {
+ unresolved "$basename compilation, $optstr"
+ return
+ }
+
+ # Compile the input source files with the plugin
+ global default_flags
+ set plugin_enabling_flags "-fplugin=./$plugin_lib"
+ dg-runtest $plugin_tests $plugin_enabling_flags $default_flags
+
+ # Clean up
+ remote_file build delete $plugin_lib
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 884e743d405..92bde7886a9 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -544,8 +544,6 @@ proc check_effective_target_pcc_bitfield_type_matters { } {
}
# Return 1 if thread local storage (TLS) is supported, 0 otherwise.
-#
-# This won't change for different subtargets so cache the result.
proc check_effective_target_tls {} {
return [check_no_compiler_messages tls assembly {
@@ -556,8 +554,6 @@ proc check_effective_target_tls {} {
}
# Return 1 if *native* thread local storage (TLS) is supported, 0 otherwise.
-#
-# This won't change for different subtargets so cache the result.
proc check_effective_target_tls_native {} {
# VxWorks uses emulated TLS machinery, but with non-standard helper
@@ -575,8 +571,6 @@ proc check_effective_target_tls_native {} {
}
# Return 1 if TLS executables can run correctly, 0 otherwise.
-#
-# This won't change for different subtargets so cache the result.
proc check_effective_target_tls_runtime {} {
return [check_runtime tls_runtime {
@@ -1078,6 +1072,9 @@ proc check_cxa_atexit_available { } {
if { [istarget "hppa*-*-hpux10*"] } {
# HP-UX 10 doesn't have __cxa_atexit but subsequent test passes.
expr 0
+ } elseif { [istarget "*-*-vxworks"] } {
+ # vxworks doesn't have __cxa_atexit but subsequent test passes.
+ expr 0
} else {
check_runtime_nocache cxa_atexit_available {
// C++
@@ -1194,6 +1191,33 @@ proc check_effective_target_large_long_double { } {
}]
}
+# Return 1 if the target supports double larger than float,
+# 0 otherwise.
+
+proc check_effective_target_large_double { } {
+ return [check_no_compiler_messages large_double object {
+ int dummy[sizeof(double) > sizeof(float) ? 1 : -1];
+ }]
+}
+
+# Return 1 if the target supports double of 64 bits,
+# 0 otherwise.
+
+proc check_effective_target_double64 { } {
+ return [check_no_compiler_messages double64 object {
+ int dummy[sizeof(double) == 8 ? 1 : -1];
+ }]
+}
+
+# Return 1 if the target supports double of at least 64 bits,
+# 0 otherwise.
+
+proc check_effective_target_double64plus { } {
+ return [check_no_compiler_messages double64plus object {
+ int dummy[sizeof(double) >= 8 ? 1 : -1];
+ }]
+}
+
# Return 1 if the target supports compiling fixed-point,
# 0 otherwise.
@@ -1314,7 +1338,7 @@ proc check_effective_target_vect_int { } {
return $et_vect_int_saved
}
-# Return 1 if the target supports int->float conversion
+# Return 1 if the target supports signed int->float conversion
#
proc check_effective_target_vect_intfloat_cvt { } {
@@ -1337,7 +1361,28 @@ proc check_effective_target_vect_intfloat_cvt { } {
}
-# Return 1 if the target supports float->int conversion
+# Return 1 if the target supports unsigned int->float conversion
+#
+
+proc check_effective_target_vect_uintfloat_cvt { } {
+ global et_vect_uintfloat_cvt_saved
+
+ if [info exists et_vect_uintfloat_cvt_saved] {
+ verbose "check_effective_target_vect_uintfloat_cvt: using cached result" 2
+ } else {
+ set et_vect_uintfloat_cvt_saved 0
+ if { ([istarget powerpc*-*-*]
+ && ![istarget powerpc-*-linux*paired*]) } {
+ set et_vect_uintfloat_cvt_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_uintfloat_cvt: returning $et_vect_uintfloat_cvt_saved" 2
+ return $et_vect_uintfloat_cvt_saved
+}
+
+
+# Return 1 if the target supports signed float->int conversion
#
proc check_effective_target_vect_floatint_cvt { } {
@@ -1359,6 +1404,26 @@ proc check_effective_target_vect_floatint_cvt { } {
return $et_vect_floatint_cvt_saved
}
+# Return 1 if the target supports unsigned float->int conversion
+#
+
+proc check_effective_target_vect_floatuint_cvt { } {
+ global et_vect_floatuint_cvt_saved
+
+ if [info exists et_vect_floatuint_cvt_saved] {
+ verbose "check_effective_target_vect_floatuint_cvt: using cached result" 2
+ } else {
+ set et_vect_floatuint_cvt_saved 0
+ if { ([istarget powerpc*-*-*]
+ && ![istarget powerpc-*-linux*paired*]) } {
+ set et_vect_floatuint_cvt_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_floatuint_cvt: returning $et_vect_floatuint_cvt_saved" 2
+ return $et_vect_floatuint_cvt_saved
+}
+
# Return 1 is this is an arm target using 32-bit instructions
proc check_effective_target_arm32 { } {
return [check_no_compiler_messages arm32 assembly {
diff --git a/gcc/testsuite/objc.dg/bad-receiver-type.m b/gcc/testsuite/objc.dg/bad-receiver-type.m
index 36f4cf3e433..8ab296257db 100644
--- a/gcc/testsuite/objc.dg/bad-receiver-type.m
+++ b/gcc/testsuite/objc.dg/bad-receiver-type.m
@@ -11,5 +11,5 @@ extern int foo();
void baz()
{
[foo test]; /* { dg-warning "invalid receiver type" } */
- /* { dg-warning "cannot convert to a pointer type" "" { target *-*-* } 13 } */
+ /* { dg-error "cannot convert to a pointer type" "" { target *-*-* } 13 } */
}
diff --git a/gcc/testsuite/objc.dg/encode-5.m b/gcc/testsuite/objc.dg/encode-5.m
index f2cb693b1b7..35b6148872e 100644
--- a/gcc/testsuite/objc.dg/encode-5.m
+++ b/gcc/testsuite/objc.dg/encode-5.m
@@ -28,7 +28,7 @@
@interface Test : Object
{ float j; }
-(void) test2: (int [5])a with: (int [])b;
--(id) test3: (Test **)b; /* { dg-warning "previous declaration of .\\-\\(id\\)test3:\\(Test \\*\\*\\)b." } */
+-(id) test3: (Test **)b; /* { dg-message "previous declaration of .\\-\\(id\\)test3:\\(Test \\*\\*\\)b." } */
@end
@implementation Test
diff --git a/gcc/testsuite/objc.dg/id-1.m b/gcc/testsuite/objc.dg/id-1.m
index ceb4d898131..2bfcc63f9e7 100644
--- a/gcc/testsuite/objc.dg/id-1.m
+++ b/gcc/testsuite/objc.dg/id-1.m
@@ -2,6 +2,6 @@
/* { dg-do compile } */
typedef int id; /* { dg-error "conflicting types for .id." } */
-/* { dg-error "previous declaration of .id. was here" "" { target *-*-* } 0 } */
+/* { dg-message "previous declaration of .id. was here" "" { target *-*-* } 0 } */
id b;
diff --git a/gcc/testsuite/objc.dg/method-1.m b/gcc/testsuite/objc.dg/method-1.m
index a73a0f4921d..ce2aab12129 100644
--- a/gcc/testsuite/objc.dg/method-1.m
+++ b/gcc/testsuite/objc.dg/method-1.m
@@ -16,7 +16,7 @@
@end
@implementation class3
-- (int) meth1 { return 0; } /* { dg-error "previous definition" } */
+- (int) meth1 { return 0; } /* { dg-message "previous definition" } */
- (int) meth1 { return 0; } /* { dg-error "redefinition of" } */
@end
@@ -25,6 +25,6 @@
@end
@implementation class4
-+ (void) meth1 {} /* { dg-error "previous definition" } */
++ (void) meth1 {} /* { dg-message "previous definition" } */
+ (void) meth1 {} /* { dg-error "redefinition of" } */
@end
diff --git a/gcc/testsuite/objc.dg/method-11.m b/gcc/testsuite/objc.dg/method-11.m
index 5921292c1ba..ddd0121b0d5 100644
--- a/gcc/testsuite/objc.dg/method-11.m
+++ b/gcc/testsuite/objc.dg/method-11.m
@@ -24,9 +24,9 @@ void foo(void) {
id obj1, obj2 = 0;
obj2 = [obj1 initWithData: obj2];
/* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 25 } */
- /* { dg-warning "using .\\-\\(void\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 12 } */
- /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 16 } */
- /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(Object2 \\*\\)data." "" { target *-*-* } 20 } */
+ /* { dg-message "using .\\-\\(void\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 12 } */
+ /* { dg-message "also found .\\-\\(id\\)initWithData:\\(Object1 \\*\\)data." "" { target *-*-* } 16 } */
+ /* { dg-message "also found .\\-\\(id\\)initWithData:\\(Object2 \\*\\)data." "" { target *-*-* } 20 } */
/* The following error is a consequence of picking the "wrong" method signature. */
/* { dg-error "void value not ignored as it ought to be" "" { target *-*-* } 25 } */
diff --git a/gcc/testsuite/objc.dg/method-20.m b/gcc/testsuite/objc.dg/method-20.m
index 653e047281d..722463ce2b6 100644
--- a/gcc/testsuite/objc.dg/method-20.m
+++ b/gcc/testsuite/objc.dg/method-20.m
@@ -5,4 +5,5 @@
@ implementation NGActiveSocket
+ (void) socketPair:(int[m]) _pair {} /* { dg-error "" } */
+ /* { dg-warning "" "" { target *-*-* } 7 } */
@end
diff --git a/gcc/testsuite/objc.dg/method-6.m b/gcc/testsuite/objc.dg/method-6.m
index aa94bac6775..8d868d13cc9 100644
--- a/gcc/testsuite/objc.dg/method-6.m
+++ b/gcc/testsuite/objc.dg/method-6.m
@@ -20,8 +20,8 @@ void foo(void) {
Class receiver;
[receiver port]; /* { dg-warning "multiple methods named .\\+port. found" } */
- /* { dg-warning "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 10 } */
- /* { dg-warning "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 15 } */
+ /* { dg-message "using .\\-\\(unsigned( int)?\\)port." "" { target *-*-* } 10 } */
+ /* { dg-message "also found .\\+\\(Protocol \\*\\)port." "" { target *-*-* } 15 } */
[receiver starboard]; /* { dg-warning "no .\\+starboard. method found" } */
/* { dg-warning "Messages without a matching method signature" "" { target *-*-* } 26 } */
diff --git a/gcc/testsuite/objc.dg/method-7.m b/gcc/testsuite/objc.dg/method-7.m
index 60ec455e182..310976a2d71 100644
--- a/gcc/testsuite/objc.dg/method-7.m
+++ b/gcc/testsuite/objc.dg/method-7.m
@@ -22,8 +22,8 @@ id foo(void) {
/* { dg-warning "will be assumed to return .id. and accept" "" { target *-*-* } 20 } */
/* { dg-warning ".\.\.\.. as arguments" "" { target *-*-* } 20 } */
[obj2 setWindow:nil]; /* { dg-warning "multiple methods named .\\-setWindow:. found" } */
- /* { dg-warning "using .\\-\\(void\\)setWindow:\\(Object \\*\\)wdw." "" { target *-*-* } 10 } */
- /* { dg-warning "also found .\\-\\(void\\)setWindow:\\(Class1 \\*\\)window." "" { target *-*-* } 14 } */
+ /* { dg-message "using .\\-\\(void\\)setWindow:\\(Object \\*\\)wdw." "" { target *-*-* } 10 } */
+ /* { dg-message "also found .\\-\\(void\\)setWindow:\\(Class1 \\*\\)window." "" { target *-*-* } 14 } */
return obj;
}
diff --git a/gcc/testsuite/objc.dg/method-9.m b/gcc/testsuite/objc.dg/method-9.m
index ade5d64e71a..d29b8881c0d 100644
--- a/gcc/testsuite/objc.dg/method-9.m
+++ b/gcc/testsuite/objc.dg/method-9.m
@@ -34,9 +34,9 @@
{
NTGridDataObject *result = [[NTGridDataObject alloc] initWithData:data];
/* { dg-warning "multiple methods named .\\-initWithData:. found" "" { target *-*-* } 35 } */
- /* { dg-warning "using .\\-\\(id\\)initWithData:\\(Object \\*\\)data." "" { target *-*-* } 11 } */
- /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 19 } */
- /* { dg-warning "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 15 } */
+ /* { dg-message "using .\\-\\(id\\)initWithData:\\(Object \\*\\)data." "" { target *-*-* } 11 } */
+ /* { dg-message "also found .\\-\\(id\\)initWithData:\\(id <MyObject, MyCoding>\\)data." "" { target *-*-* } 19 } */
+ /* { dg-message "also found .\\-\\(id\\)initWithData:\\(int\\)data." "" { target *-*-* } 15 } */
/* The following warning is a consequence of picking the "wrong" method signature. */
/* { dg-warning "passing argument 1 of .initWithData:. from distinct Objective\\-C type" "" { target *-*-* } 35 } */
diff --git a/gcc/testsuite/objc.dg/private-1.m b/gcc/testsuite/objc.dg/private-1.m
index f4d8a5268ba..a6ae82f6e8c 100644
--- a/gcc/testsuite/objc.dg/private-1.m
+++ b/gcc/testsuite/objc.dg/private-1.m
@@ -50,8 +50,8 @@ int main (void)
{
int access;
- access = m->private; /* { dg-error "is @private" } */
- access = m->protected; /* { dg-error "is @protected" } */
+ access = m->private; /* { dg-warning "is @private" } */
+ access = m->protected; /* { dg-warning "is @protected" } */
access = m->public; /* Ok */
}
diff --git a/gcc/timevar.def b/gcc/timevar.def
index d65c7389a68..e6853756e66 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -154,13 +154,10 @@ DEFTIMEVAR (TV_DCE , "dead code elimination")
DEFTIMEVAR (TV_DSE1 , "dead store elim1")
DEFTIMEVAR (TV_DSE2 , "dead store elim2")
DEFTIMEVAR (TV_LOOP , "loop analysis")
-DEFTIMEVAR (TV_GCSE , "global CSE")
-DEFTIMEVAR (TV_CPROP1 , "CPROP 1")
+DEFTIMEVAR (TV_CPROP , "CPROP")
DEFTIMEVAR (TV_PRE , "PRE")
DEFTIMEVAR (TV_HOIST , "code hoisting")
-DEFTIMEVAR (TV_CPROP2 , "CPROP 2")
DEFTIMEVAR (TV_LSM , "LSM")
-DEFTIMEVAR (TV_BYPASS , "bypass jumps")
DEFTIMEVAR (TV_TRACER , "tracer")
DEFTIMEVAR (TV_WEB , "web")
DEFTIMEVAR (TV_AUTO_INC_DEC , "auto inc dec")
@@ -185,6 +182,7 @@ DEFTIMEVAR (TV_THREAD_PROLOGUE_AND_EPILOGUE, "thread pro- & epilogue")
DEFTIMEVAR (TV_IFCVT2 , "if-conversion 2")
DEFTIMEVAR (TV_PEEPHOLE2 , "peephole 2")
DEFTIMEVAR (TV_RENAME_REGISTERS , "rename registers")
+DEFTIMEVAR (TV_CPROP_REGISTERS , "hard reg cprop")
DEFTIMEVAR (TV_SCHED2 , "scheduling 2")
DEFTIMEVAR (TV_MACH_DEP , "machine dep reorg")
DEFTIMEVAR (TV_DBR_SCHED , "delay branch sched")
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 89c482c82eb..ffeb10529c1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -436,9 +436,11 @@ announce_function (tree decl)
if (!quiet_flag)
{
if (rtl_dump_and_exit)
- fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
+ fprintf (stderr, "%s ",
+ identifier_to_locale (IDENTIFIER_POINTER (DECL_NAME (decl))));
else
- fprintf (stderr, " %s", lang_hooks.decl_printable_name (decl, 2));
+ fprintf (stderr, " %s",
+ identifier_to_locale (lang_hooks.decl_printable_name (decl, 2)));
fflush (stderr);
pp_needs_newline (global_dc->printer) = true;
diagnostic_set_last_function (global_dc, (diagnostic_info *) NULL);
@@ -915,30 +917,58 @@ emit_debug_global_declarations (tree *vec, int len)
/* Warn about a use of an identifier which was marked deprecated. */
void
-warn_deprecated_use (tree node)
+warn_deprecated_use (tree node, tree attr)
{
+ const char *msg;
+
if (node == 0 || !warn_deprecated_decl)
return;
+ if (!attr)
+ {
+ if (DECL_P (node))
+ attr = DECL_ATTRIBUTES (node);
+ else if (TYPE_P (node))
+ {
+ tree decl = TYPE_STUB_DECL (node);
+ if (decl)
+ attr = lookup_attribute ("deprecated",
+ TYPE_ATTRIBUTES (TREE_TYPE (decl)));
+ }
+ }
+
+ if (attr)
+ attr = lookup_attribute ("deprecated", attr);
+
+ if (attr)
+ msg = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr)));
+ else
+ msg = NULL;
+
if (DECL_P (node))
{
expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
- warning (OPT_Wdeprecated_declarations,
- "%qD is deprecated (declared at %s:%d)",
- node, xloc.file, xloc.line);
+ if (msg)
+ warning (OPT_Wdeprecated_declarations,
+ "%qD is deprecated (declared at %s:%d): %s",
+ node, xloc.file, xloc.line, msg);
+ else
+ warning (OPT_Wdeprecated_declarations,
+ "%qD is deprecated (declared at %s:%d)",
+ node, xloc.file, xloc.line);
}
else if (TYPE_P (node))
{
- const char *what = NULL;
+ tree what = NULL_TREE;
tree decl = TYPE_STUB_DECL (node);
if (TYPE_NAME (node))
{
if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
- what = IDENTIFIER_POINTER (TYPE_NAME (node));
+ what = TYPE_NAME (node);
else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
&& DECL_NAME (TYPE_NAME (node)))
- what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
+ what = DECL_NAME (TYPE_NAME (node));
}
if (decl)
@@ -946,20 +976,46 @@ warn_deprecated_use (tree node)
expanded_location xloc
= expand_location (DECL_SOURCE_LOCATION (decl));
if (what)
- warning (OPT_Wdeprecated_declarations,
- "%qs is deprecated (declared at %s:%d)", what,
- xloc.file, xloc.line);
+ {
+ if (msg)
+ warning (OPT_Wdeprecated_declarations,
+ "%qE is deprecated (declared at %s:%d): %s",
+ what, xloc.file, xloc.line, msg);
+ else
+ warning (OPT_Wdeprecated_declarations,
+ "%qE is deprecated (declared at %s:%d)", what,
+ xloc.file, xloc.line);
+ }
else
- warning (OPT_Wdeprecated_declarations,
- "type is deprecated (declared at %s:%d)",
- xloc.file, xloc.line);
+ {
+ if (msg)
+ warning (OPT_Wdeprecated_declarations,
+ "type is deprecated (declared at %s:%d): %s",
+ xloc.file, xloc.line, msg);
+ else
+ warning (OPT_Wdeprecated_declarations,
+ "type is deprecated (declared at %s:%d)",
+ xloc.file, xloc.line);
+ }
}
else
{
if (what)
- warning (OPT_Wdeprecated_declarations, "%qs is deprecated", what);
+ {
+ if (msg)
+ warning (OPT_Wdeprecated_declarations, "%qE is deprecated: %s",
+ what, msg);
+ else
+ warning (OPT_Wdeprecated_declarations, "%qE is deprecated", what);
+ }
else
- warning (OPT_Wdeprecated_declarations, "type is deprecated");
+ {
+ if (msg)
+ warning (OPT_Wdeprecated_declarations, "type is deprecated: %s",
+ msg);
+ else
+ warning (OPT_Wdeprecated_declarations, "type is deprecated");
+ }
}
}
}
@@ -1142,10 +1198,14 @@ print_version (FILE *file, const char *indent)
indent, __VERSION__);
/* We need to stringify the GMP macro values. Ugh, gmp_version has
- two string formats, "i.j.k" and "i.j" when k is zero. */
+ two string formats, "i.j.k" and "i.j" when k is zero. As of
+ gmp-4.3.0, GMP always uses the 3 number format. */
#define GCC_GMP_STRINGIFY_VERSION3(X) #X
#define GCC_GMP_STRINGIFY_VERSION2(X) GCC_GMP_STRINGIFY_VERSION3(X)
-#if __GNU_MP_VERSION_PATCHLEVEL == 0
+#define GCC_GMP_VERSION_NUM(X,Y,Z) (((X) << 16L) | ((Y) << 8) | (Z))
+#define GCC_GMP_VERSION \
+ GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
+#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,0) && __GNU_MP_VERSION_PATCHLEVEL == 0
#define GCC_GMP_STRINGIFY_VERSION GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION) "." \
GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_MINOR)
#else
@@ -1519,7 +1579,7 @@ default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
t = va_arg (*text->args_ptr, tree);
if (TREE_CODE (t) == IDENTIFIER_NODE)
{
- pp_string (pp, IDENTIFIER_POINTER (t));
+ pp_identifier (pp, IDENTIFIER_POINTER (t));
return true;
}
break;
@@ -1545,8 +1605,8 @@ default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
if (DECL_P (t))
{
const char *n = DECL_NAME (t)
- ? lang_hooks.decl_printable_name (t, 2)
- : "<anonymous>";
+ ? identifier_to_locale (lang_hooks.decl_printable_name (t, 2))
+ : _("<anonymous>");
pp_string (pp, n);
}
else
@@ -1696,6 +1756,10 @@ process_options (void)
if (warn_unused_value == -1)
warn_unused_value = warn_unused;
+ /* This replaces set_Wextra. */
+ if (warn_uninitialized == -1)
+ warn_uninitialized = extra_warnings;
+
/* Allow the front end to perform consistency checks and do further
initialization based on the command line options. This hook also
sets the original filename if appropriate (e.g. foo.i -> foo.c)
diff --git a/gcc/toplev.h b/gcc/toplev.h
index ce637582990..3c0e971bd5a 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -84,7 +84,7 @@ extern void announce_function (tree);
extern void error_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
extern void warning_for_asm (const_rtx, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void warn_deprecated_use (tree);
+extern void warn_deprecated_use (tree, tree);
extern bool parse_optimize_options (tree, bool);
#ifdef BUFSIZ
@@ -136,6 +136,7 @@ extern int flag_if_conversion;
extern int flag_if_conversion2;
extern int flag_keep_static_consts;
extern int flag_peel_loops;
+extern int flag_rerun_cse_after_global_opts;
extern int flag_rerun_cse_after_loop;
extern int flag_thread_jumps;
extern int flag_tracer;
@@ -149,7 +150,6 @@ extern int flag_ira_move_spills;
extern int flag_ira_share_save_slots;
extern int flag_ira_share_spill_slots;
-
/* Things to do with target switches. */
extern void print_version (FILE *, const char *);
extern void * default_get_pch_validity (size_t *);
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1a2d415db0f..fe8cef58272 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2084,6 +2084,11 @@ remove_useless_stmts (void)
remove_useless_stmts_1 (&gsi, &data);
}
while (data.repeat);
+
+#ifdef ENABLE_TYPES_CHECKING
+ verify_types_in_gimple_seq (gimple_body (current_function_decl));
+#endif
+
return 0;
}
@@ -3130,11 +3135,12 @@ verify_types_in_gimple_min_lval (tree expr)
return false;
}
-/* Verify if EXPR is a valid GIMPLE reference expression. Returns true
+/* Verify if EXPR is a valid GIMPLE reference expression. If
+ REQUIRE_LVALUE is true verifies it is an lvalue. Returns true
if there is an error, otherwise false. */
static bool
-verify_types_in_gimple_reference (tree expr)
+verify_types_in_gimple_reference (tree expr, bool require_lvalue)
{
while (handled_component_p (expr))
{
@@ -3206,7 +3212,8 @@ verify_types_in_gimple_reference (tree expr)
expr = op;
}
- return verify_types_in_gimple_min_lval (expr);
+ return ((require_lvalue || !is_gimple_min_invariant (expr))
+ && verify_types_in_gimple_min_lval (expr));
}
/* Returns true if there is one pointer type in TYPE_POINTER_TO (SRC_OBJ)
@@ -3273,7 +3280,8 @@ verify_gimple_call (gimple stmt)
returning java.lang.Object.
For now simply allow arbitrary pointer type conversions. */
&& !(POINTER_TYPE_P (TREE_TYPE (gimple_call_lhs (stmt)))
- && POINTER_TYPE_P (TREE_TYPE (fntype))))
+ && POINTER_TYPE_P (TREE_TYPE (fntype)))
+ && !L_IPO_COMP_MODE)
{
error ("invalid conversion in gimple call");
debug_generic_stmt (TREE_TYPE (gimple_call_lhs (stmt)));
@@ -3553,7 +3561,8 @@ verify_gimple_assign_binary (gimple stmt)
{
if (TREE_CODE (rhs1_type) != VECTOR_TYPE
|| !(INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
- || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type)))
+ || FIXED_POINT_TYPE_P (TREE_TYPE (rhs1_type))
+ || SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type)))
|| (!INTEGRAL_TYPE_P (rhs2_type)
&& (TREE_CODE (rhs2_type) != VECTOR_TYPE
|| !INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type))))
@@ -3565,6 +3574,16 @@ verify_gimple_assign_binary (gimple stmt)
debug_generic_expr (rhs2_type);
return true;
}
+ /* For shifting a vector of floating point components we
+ only allow shifting by a constant multiple of the element size. */
+ if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs1_type))
+ && (TREE_CODE (rhs2) != INTEGER_CST
+ || !div_if_zero_remainder (EXACT_DIV_EXPR, rhs2,
+ TYPE_SIZE (TREE_TYPE (rhs1_type)))))
+ {
+ error ("non-element sized vector shift of floating point vector");
+ return true;
+ }
return false;
}
@@ -3733,7 +3752,9 @@ verify_gimple_assign_single (gimple stmt)
tree rhs1_type = TREE_TYPE (rhs1);
bool res = false;
- if (!useless_type_conversion_p (lhs_type, rhs1_type))
+ if (!useless_type_conversion_p (lhs_type, rhs1_type)
+ /* Relax for LIPO. TODO add structural or name check. */
+ && !L_IPO_COMP_MODE)
{
error ("non-trivial conversion at assignment");
debug_generic_expr (lhs_type);
@@ -3742,7 +3763,7 @@ verify_gimple_assign_single (gimple stmt)
}
if (handled_component_p (lhs))
- res |= verify_types_in_gimple_reference (lhs);
+ res |= verify_types_in_gimple_reference (lhs, true);
/* Special codes we cannot handle via their class. */
switch (rhs_code)
@@ -3757,7 +3778,9 @@ verify_gimple_assign_single (gimple stmt)
}
if (!one_pointer_to_useless_type_conversion_p (lhs_type,
- TREE_TYPE (op)))
+ TREE_TYPE (op))
+ /* TODO add lipo specific check. */
+ && !L_IPO_COMP_MODE)
{
error ("type mismatch in address expression");
debug_generic_stmt (lhs_type);
@@ -3765,7 +3788,7 @@ verify_gimple_assign_single (gimple stmt)
return true;
}
- return verify_types_in_gimple_reference (op);
+ return verify_types_in_gimple_reference (op, true);
}
/* tcc_reference */
@@ -3788,7 +3811,7 @@ verify_gimple_assign_single (gimple stmt)
debug_generic_stmt (rhs1);
return true;
}
- return res || verify_types_in_gimple_reference (rhs1);
+ return res || verify_types_in_gimple_reference (rhs1, false);
/* tcc_constant */
case SSA_NAME:
@@ -3885,7 +3908,8 @@ verify_gimple_return (gimple stmt)
decl is a reference type while the return type is an aggregate. */
&& !(TREE_CODE (op) == RESULT_DECL
&& TREE_CODE (TREE_TYPE (op)) == REFERENCE_TYPE
- && useless_type_conversion_p (restype, TREE_TYPE (TREE_TYPE (op)))))
+ && useless_type_conversion_p (restype, TREE_TYPE (TREE_TYPE (op))))
+ && !L_IPO_COMP_MODE)
{
error ("invalid conversion in return statement");
debug_generic_stmt (restype);
@@ -4313,6 +4337,14 @@ verify_stmts (void)
err |= true;
}
}
+
+#ifdef ENABLE_TYPES_CHECKING
+ if (verify_gimple_phi (phi))
+ {
+ debug_gimple_stmt (phi);
+ err |= true;
+ }
+#endif
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
@@ -4349,6 +4381,14 @@ verify_stmts (void)
}
err |= verify_stmt (&gsi);
+
+#ifdef ENABLE_TYPES_CHECKING
+ if (verify_types_in_gimple_stmt (gsi_stmt (gsi)))
+ {
+ debug_gimple_stmt (stmt);
+ err |= true;
+ }
+#endif
addr = walk_gimple_op (gsi_stmt (gsi), verify_node_sharing, &wi);
if (addr)
{
@@ -7046,7 +7086,7 @@ struct gimple_opt_pass pass_split_crit_edges =
PROP_no_crit_edges, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func /* todo_flags_finish */
+ TODO_dump_func | TODO_verify_flow /* todo_flags_finish */
}
};
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 7dbc63ab12d..2835220c206 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -99,7 +99,10 @@ some_nonzerop (tree t)
{
int zerop = false;
- if (TREE_CODE (t) == REAL_CST)
+ /* Operations with real or imaginary part of a complex number zero
+ cannot be treated the same as operations with a real or imaginary
+ operand if we care about the signs of zeros in the result. */
+ if (TREE_CODE (t) == REAL_CST && !flag_signed_zeros)
zerop = REAL_VALUES_IDENTICAL (TREE_REAL_CST (t), dconst0);
else if (TREE_CODE (t) == FIXED_CST)
zerop = fixed_zerop (t);
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 0a1850f85bb..de2ad5f921b 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -284,7 +284,8 @@ print_direction_vector (FILE *outf,
for (eq = 0; eq < length; eq++)
{
- enum data_dependence_direction dir = dirv[eq];
+ enum data_dependence_direction dir = ((enum data_dependence_direction)
+ dirv[eq]);
switch (dir)
{
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 1bd54cd99a3..d00324a348e 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -138,27 +138,6 @@ create_var_ann (tree t)
return ann;
}
-/* Create a new annotation for a FUNCTION_DECL node T. */
-
-function_ann_t
-create_function_ann (tree t)
-{
- function_ann_t ann;
-
- gcc_assert (t);
- gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
- gcc_assert (!t->base.ann || t->base.ann->common.type == FUNCTION_ANN);
-
- ann = (function_ann_t) ggc_alloc (sizeof (*ann));
- memset ((void *) ann, 0, sizeof (*ann));
-
- ann->common.type = FUNCTION_ANN;
-
- t->base.ann = (tree_ann_t) ann;
-
- return ann;
-}
-
/* Renumber all of the gimple stmt uids. */
void
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 208bfb04527..8e6044f3c03 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1959,6 +1959,10 @@ make_eh_edge (struct eh_region *region, void *data)
stmt = (gimple) data;
lab = get_eh_region_tree_label (region);
+ /* The code region is removed. */
+ if (!lab)
+ return;
+
src = gimple_bb (stmt);
dst = label_to_block (lab);
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 536a111bb44..6a1ae4ce7db 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -172,29 +172,6 @@ get_var_ann (tree var)
return (ann) ? ann : create_var_ann (var);
}
-/* Return the function annotation for T, which must be a FUNCTION_DECL node.
- Return NULL if the function annotation doesn't already exist. */
-static inline function_ann_t
-function_ann (const_tree t)
-{
- gcc_assert (t);
- gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
- gcc_assert (!t->base.ann
- || t->base.ann->common.type == FUNCTION_ANN);
-
- return (function_ann_t) t->base.ann;
-}
-
-/* Return the function annotation for T, which must be a FUNCTION_DECL node.
- Create the function annotation if it doesn't exist. */
-static inline function_ann_t
-get_function_ann (tree var)
-{
- function_ann_t ann = function_ann (var);
- gcc_assert (!var->base.ann || var->base.ann->common.type == FUNCTION_ANN);
- return (ann) ? ann : create_function_ann (var);
-}
-
/* Get the number of the next statement uid to be allocated. */
static inline unsigned int
gimple_stmt_max_uid (struct function *fn)
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 71e58a8fc30..a02eca5275b 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -32,8 +32,6 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-reference.h"
#include "tree-ssa-alias.h"
-struct static_var_ann_d;
-
/* Gimple dataflow datastructure. All publicly available fields shall have
gimple_ accessor defined in tree-flow-inline.h, all publicly modifiable
@@ -221,17 +219,6 @@ struct GTY(()) var_ann_d {
tree current_def;
};
-/* Container for variable annotation used by hashtable for annotations for
- static variables. */
-struct GTY(()) static_var_ann_d {
- struct var_ann_d ann;
- unsigned int uid;
-};
-
-struct GTY(()) function_ann_d {
- struct tree_ann_common_d common;
-};
-
/* Immediate use lists are used to directly access all uses for an SSA
name and get pointers to the statement for each use.
@@ -330,20 +317,16 @@ typedef struct immediate_use_iterator_d
union GTY((desc ("ann_type ((tree_ann_t)&%h)"))) tree_ann_d {
struct tree_ann_common_d GTY((tag ("TREE_ANN_COMMON"))) common;
struct var_ann_d GTY((tag ("VAR_ANN"))) vdecl;
- struct function_ann_d GTY((tag ("FUNCTION_ANN"))) fdecl;
};
typedef union tree_ann_d *tree_ann_t;
typedef struct var_ann_d *var_ann_t;
-typedef struct function_ann_d *function_ann_t;
typedef struct tree_ann_common_d *tree_ann_common_t;
static inline tree_ann_common_t tree_common_ann (const_tree);
static inline tree_ann_common_t get_tree_common_ann (tree);
static inline var_ann_t var_ann (const_tree);
static inline var_ann_t get_var_ann (tree);
-static inline function_ann_t function_ann (const_tree);
-static inline function_ann_t get_function_ann (tree);
static inline enum tree_ann_type ann_type (tree_ann_t);
static inline void update_stmt (gimple);
static inline int get_lineno (const_gimple);
@@ -566,7 +549,6 @@ extern const char *op_symbol_code (enum tree_code);
/* In tree-dfa.c */
extern var_ann_t create_var_ann (tree);
-extern function_ann_t create_function_ann (tree);
extern void renumber_gimple_stmt_uids (void);
extern tree_ann_common_t create_tree_common_ann (tree);
extern void dump_dfa_stats (FILE *);
@@ -821,6 +803,14 @@ bool stmt_dominates_stmt_p (gimple, gimple);
void mark_virtual_ops_for_renaming (gimple);
/* In tree-ssa-threadedge.c */
+extern void threadedge_initialize_values (void);
+extern void threadedge_finalize_values (void);
+extern VEC(tree,heap) *ssa_name_values;
+#define SSA_NAME_VALUE(x) \
+ (SSA_NAME_VERSION(x) < VEC_length(tree, ssa_name_values) \
+ ? VEC_index(tree, ssa_name_values, SSA_NAME_VERSION(x)) \
+ : NULL_TREE)
+extern void set_ssa_name_value (tree, tree);
extern bool potentially_threadable_block (basic_block);
extern void thread_across_edge (gimple, edge, bool,
VEC(tree, heap) **, tree (*) (gimple, gimple));
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index f9b942a9520..70c6149a494 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -85,7 +85,6 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "c-common.h"
#include "flags.h"
#include "timevar.h"
#include "varray.h"
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index d682f771e59..9aec49d07fa 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "input.h"
#include "insn-config.h"
-#include "varray.h"
#include "hashtab.h"
#include "langhooks.h"
#include "basic-block.h"
@@ -706,6 +705,13 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
gcc_assert (new_decl);
/* Replace this variable with the copy. */
STRIP_TYPE_NOPS (new_decl);
+ /* ??? The C++ frontend uses void * pointer zero to initialize
+ any other type. This confuses the middle-end type verification.
+ As cloned bodies do not go through gimplification again the fixup
+ there doesn't trigger. */
+ if (TREE_CODE (new_decl) == INTEGER_CST
+ && !useless_type_conversion_p (TREE_TYPE (*tp), TREE_TYPE (new_decl)))
+ new_decl = fold_convert (TREE_TYPE (*tp), new_decl);
*tp = new_decl;
*walk_subtrees = 0;
}
@@ -1387,6 +1393,8 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
need to process all of them. */
do
{
+ tree fn;
+
stmt = gsi_stmt (copy_gsi);
if (is_gimple_call (stmt)
&& gimple_call_va_arg_pack_p (stmt)
@@ -1475,34 +1483,24 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
callgraph edges and update or duplicate them. */
if (is_gimple_call (stmt))
{
- struct cgraph_node *node;
- struct cgraph_edge *edge;
+ struct cgraph_edge *edge = cgraph_edge (id->src_node, orig_stmt);
int flags;
switch (id->transform_call_graph_edges)
{
case CB_CGE_DUPLICATE:
- edge = cgraph_edge (id->src_node, orig_stmt);
- if (edge)
+ if (edge)
cgraph_clone_edge (edge, id->dst_node, stmt,
REG_BR_PROB_BASE, 1,
edge->frequency, true);
break;
case CB_CGE_MOVE_CLONES:
- for (node = id->dst_node->next_clone;
- node;
- node = node->next_clone)
- {
- edge = cgraph_edge (node, orig_stmt);
- if (edge)
- cgraph_set_call_stmt (edge, stmt);
- }
- /* FALLTHRU */
+ cgraph_set_call_stmt_including_clones (id->dst_node, orig_stmt, stmt);
+ break;
case CB_CGE_MOVE:
- edge = cgraph_edge (id->dst_node, orig_stmt);
- if (edge)
+ if (edge)
cgraph_set_call_stmt (edge, stmt);
break;
@@ -1510,6 +1508,36 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
gcc_unreachable ();
}
+ /* Constant propagation on argument done during inlining
+ may create new direct call. Produce an edge for it. */
+ if (!edge && is_gimple_call (stmt)
+ && (fn = gimple_call_fndecl (stmt)) != NULL
+ && !cgraph_edge (id->dst_node, stmt))
+ {
+ struct cgraph_node *dest = cgraph_node (fn);
+
+ /* We have missing edge in the callgraph. This can happen in one case
+ where previous inlining turned indirect call into direct call by
+ constant propagating arguments. In all other cases we hit a bug
+ (incorrect node sharing is most common reason for missing edges. */
+ gcc_assert (dest->needed || !dest->analyzed);
+ if (id->transform_call_graph_edges == CB_CGE_MOVE_CLONES)
+ cgraph_create_edge_including_clones (id->dst_node, dest, stmt,
+ bb->count, CGRAPH_FREQ_BASE,
+ bb->loop_depth,
+ CIF_ORIGINALLY_INDIRECT_CALL);
+ else
+ cgraph_create_edge (id->dst_node, dest, stmt,
+ bb->count, CGRAPH_FREQ_BASE,
+ bb->loop_depth)->inline_failed
+ = CIF_ORIGINALLY_INDIRECT_CALL;
+ if (dump_file)
+ {
+ fprintf (dump_file, "Created new direct edge to %s",
+ cgraph_node_name (dest));
+ }
+ }
+
flags = gimple_call_flags (stmt);
if (flags & ECF_MAY_BE_ALLOCA)
@@ -1932,7 +1960,6 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency,
FOR_EACH_BB_FN (bb, cfun_to_copy)
{
basic_block new_bb = copy_bb (id, bb, frequency_scale, count_scale);
-
bb->aux = new_bb;
new_bb->aux = bb;
}
@@ -3227,29 +3254,6 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
cg_edge = cgraph_edge (id->dst_node, stmt);
- /* Constant propagation on argument done during previous inlining
- may create new direct call. Produce an edge for it. */
- if (!cg_edge)
- {
- struct cgraph_node *dest = cgraph_node (fn);
-
- /* We have missing edge in the callgraph. This can happen in one case
- where previous inlining turned indirect call into direct call by
- constant propagating arguments. In all other cases we hit a bug
- (incorrect node sharing is most common reason for missing edges. */
- gcc_assert (dest->needed);
- cgraph_create_edge (id->dst_node, dest, stmt,
- bb->count, CGRAPH_FREQ_BASE,
- bb->loop_depth)->inline_failed
- = CIF_ORIGINALLY_INDIRECT_CALL;
- if (dump_file)
- {
- fprintf (dump_file, "Created new direct edge to %s",
- cgraph_node_name (dest));
- }
- goto egress;
- }
-
/* Don't try to inline functions that are not well-suited to
inlining. */
if (!cgraph_inline_p (cg_edge, &reason))
@@ -3498,10 +3502,6 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
remove the cgraph node. */
(*debug_hooks->outlining_inline_function) (cg_edge->callee->decl);
- /* inform (input_location, "Inlined call to %s in %s",
- lang_hooks.decl_printable_name (fn, 3),
- cgraph_node_name (cg_edge->caller)); */
-
/* Update callgraph if needed. */
cgraph_remove_node (cg_edge->callee);
@@ -4307,27 +4307,98 @@ tree_versionable_function_p (tree fndecl)
return true;
}
-/* Create a new name for omp child function. Returns an identifier. */
-
-static GTY(()) unsigned int clone_fn_id_num;
+/* Delete all unreachable basic blocks and update callgraph.
+ Doing so is somewhat nontrivial because we need to update all clones and
+ remove inline function that become unreachable. */
-static tree
-clone_function_name (tree decl)
+static bool
+delete_unreachable_blocks_update_callgraph (copy_body_data *id)
{
- tree name = DECL_ASSEMBLER_NAME (decl);
- size_t len = IDENTIFIER_LENGTH (name);
- char *tmp_name, *prefix;
-
- prefix = XALLOCAVEC (char, len + strlen ("_clone") + 1);
- memcpy (prefix, IDENTIFIER_POINTER (name), len);
- strcpy (prefix + len, "_clone");
-#ifndef NO_DOT_IN_LABEL
- prefix[len] = '.';
-#elif !defined NO_DOLLAR_IN_LABEL
- prefix[len] = '$';
+ bool changed = false;
+ basic_block b, next_bb;
+
+ find_unreachable_blocks ();
+
+ /* Delete all unreachable basic blocks. */
+
+ for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
+ {
+ next_bb = b->next_bb;
+
+ if (!(b->flags & BB_REACHABLE))
+ {
+ gimple_stmt_iterator bsi;
+
+ for (bsi = gsi_start_bb (b); !gsi_end_p (bsi); gsi_next (&bsi))
+ if (gimple_code (gsi_stmt (bsi)) == GIMPLE_CALL)
+ {
+ struct cgraph_edge *e;
+ struct cgraph_node *node;
+
+ if ((e = cgraph_edge (id->dst_node, gsi_stmt (bsi))) != NULL)
+ {
+ if (!e->inline_failed)
+ cgraph_remove_node_and_inline_clones (e->callee);
+ else
+ cgraph_remove_edge (e);
+ }
+ if (id->transform_call_graph_edges == CB_CGE_MOVE_CLONES
+ && id->dst_node->clones)
+ for (node = id->dst_node->clones; node != id->dst_node;)
+ {
+ if ((e = cgraph_edge (node, gsi_stmt (bsi))) != NULL)
+ {
+ if (!e->inline_failed)
+ cgraph_remove_node_and_inline_clones (e->callee);
+ else
+ cgraph_remove_edge (e);
+ }
+
+ if (node->clones)
+ node = node->clones;
+ else if (node->next_sibling_clone)
+ node = node->next_sibling_clone;
+ else
+ {
+ while (node != id->dst_node && !node->next_sibling_clone)
+ node = node->clone_of;
+ if (node != id->dst_node)
+ node = node->next_sibling_clone;
+ }
+ }
+ }
+ delete_basic_block (b);
+ changed = true;
+ }
+ }
+
+ if (changed)
+ tidy_fallthru_edges ();
+#ifdef ENABLE_CHECKING0
+ verify_cgraph_node (id->dst_node);
+ if (id->transform_call_graph_edges == CB_CGE_MOVE_CLONES
+ && id->dst_node->clones)
+ {
+ struct cgraph_node *node;
+ for (node = id->dst_node->clones; node != id->dst_node;)
+ {
+ verify_cgraph_node (node);
+
+ if (node->clones)
+ node = node->clones;
+ else if (node->next_sibling_clone)
+ node = node->next_sibling_clone;
+ else
+ {
+ while (node != id->dst_node && !node->next_sibling_clone)
+ node = node->clone_of;
+ if (node != id->dst_node)
+ node = node->next_sibling_clone;
+ }
+ }
+ }
#endif
- ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++);
- return get_identifier (tmp_name);
+ return changed;
}
/* Create a copy of a function's tree.
@@ -4339,7 +4410,7 @@ clone_function_name (tree decl)
trees. If UPDATE_CLONES is set, the call_stmt fields
of edges of clones of the function will be updated. */
void
-tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
+tree_function_versioning (tree old_decl, tree new_decl, VEC(ipa_replace_map_p,gc)* tree_map,
bool update_clones, bitmap args_to_skip)
{
struct cgraph_node *old_version_node;
@@ -4375,15 +4446,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
memset (&id, 0, sizeof (id));
/* Generate a new name for the new version. */
- if (!update_clones)
- {
- cgraph_remove_assembler_hash_node (new_version_node);
- DECL_NAME (new_decl) = clone_function_name (old_decl);
- SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
- SET_DECL_RTL (new_decl, NULL_RTX);
- id.statements_to_fold = pointer_set_create ();
- cgraph_add_assembler_hash_node (new_version_node);
- }
+ id.statements_to_fold = pointer_set_create ();
id.decl_map = pointer_map_create ();
id.src_fn = old_decl;
@@ -4416,11 +4479,10 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
/* If there's a tree_map, prepare for substitution. */
if (tree_map)
- for (i = 0; i < VARRAY_ACTIVE_SIZE (tree_map); i++)
+ for (i = 0; i < VEC_length (ipa_replace_map_p, tree_map); i++)
{
gimple init;
- replace_info
- = (struct ipa_replace_map *) VARRAY_GENERIC_PTR (tree_map, i);
+ replace_info = VEC_index (ipa_replace_map_p, tree_map, i);
if (replace_info->replace_p)
{
tree op = replace_info->new_tree;
@@ -4459,6 +4521,7 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
number_blocks (id.dst_fn);
declare_inline_vars (DECL_INITIAL (new_decl), vars);
+
if (DECL_STRUCT_FUNCTION (old_decl)->local_decls != NULL_TREE)
/* Add local vars. */
for (t_step = DECL_STRUCT_FUNCTION (old_decl)->local_decls;
@@ -4497,14 +4560,15 @@ tree_function_versioning (tree old_decl, tree new_decl, varray_type tree_map,
pointer_map_destroy (id.decl_map);
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
- if (!update_clones)
- {
- fold_marked_statements (0, id.statements_to_fold);
- pointer_set_destroy (id.statements_to_fold);
- fold_cond_expr_cond ();
- delete_unreachable_blocks ();
- update_ssa (TODO_update_ssa);
- }
+
+ fold_marked_statements (0, id.statements_to_fold);
+ pointer_set_destroy (id.statements_to_fold);
+ fold_cond_expr_cond ();
+ delete_unreachable_blocks_update_callgraph (&id);
+ update_ssa (TODO_update_ssa);
+ free_dominance_info (CDI_DOMINATORS);
+ free_dominance_info (CDI_POST_DOMINATORS);
+
VEC_free (gimple, heap, init_stmts);
pop_cfun ();
current_function_decl = old_current_function_decl;
@@ -4572,5 +4636,3 @@ tree_can_inline_p (tree caller, tree callee)
/* Allow the backend to decide if inlining is ok. */
return targetm.target_option.can_inline_p (caller, callee);
}
-
-#include "gt-tree-inline.h"
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 2a4e38b1657..d55f84a14d4 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -21,7 +21,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_TREE_INLINE_H
#define GCC_TREE_INLINE_H
-#include "varray.h"
#include "pointer-set.h"
@@ -156,7 +155,6 @@ int estimate_num_insns (gimple, eni_weights *);
int estimate_num_insns_fn (tree, eni_weights *);
int count_insns_seq (gimple_seq, eni_weights *);
bool tree_versionable_function_p (tree);
-void tree_function_versioning (tree, tree, varray_type, bool, bitmap);
bool tree_can_inline_p (tree, tree);
extern gimple_seq remap_gimple_seq (gimple_seq, copy_body_data *);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 938eefc868a..d1f0ff7820e 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -113,14 +113,6 @@ static sbitmap old_ssa_names;
static sbitmap new_ssa_names;
-/* Subset of SYMS_TO_RENAME. Contains all the GIMPLE register symbols
- that have been marked for renaming. */
-static bitmap regs_to_rename;
-
-/* Subset of SYMS_TO_RENAME. Contains all the memory symbols
- that have been marked for renaming. */
-static bitmap mem_syms_to_rename;
-
/* Set of SSA names that have been marked to be released after they
were registered in the replacement table. They will be finally
released after we finish updating the SSA web. */
@@ -2635,8 +2627,6 @@ init_update_ssa (struct function *fn)
sbitmap_zero (new_ssa_names);
repl_tbl = htab_create (20, repl_map_hash, repl_map_eq, repl_map_free);
- regs_to_rename = BITMAP_ALLOC (NULL);
- mem_syms_to_rename = BITMAP_ALLOC (NULL);
names_to_release = NULL;
memset (&update_ssa_stats, 0, sizeof (update_ssa_stats));
update_ssa_stats.virtual_symbols = BITMAP_ALLOC (NULL);
@@ -2662,8 +2652,6 @@ delete_update_ssa (void)
repl_tbl = NULL;
bitmap_clear (SYMS_TO_RENAME (update_ssa_initialized_fn));
- BITMAP_FREE (regs_to_rename);
- BITMAP_FREE (mem_syms_to_rename);
BITMAP_FREE (update_ssa_stats.virtual_symbols);
if (names_to_release)
@@ -3152,26 +3140,6 @@ update_ssa (unsigned update_flags)
if (insert_phi_p && switch_virtuals_to_full_rewrite_p ())
switch_virtuals_to_full_rewrite ();
- /* If there are symbols to rename, identify those symbols that are
- GIMPLE registers into the set REGS_TO_RENAME and those that are
- memory symbols into the set MEM_SYMS_TO_RENAME. */
- if (!bitmap_empty_p (SYMS_TO_RENAME (cfun)))
- {
- unsigned i;
- bitmap_iterator bi;
-
- EXECUTE_IF_SET_IN_BITMAP (SYMS_TO_RENAME (cfun), 0, i, bi)
- {
- tree sym = referenced_var (i);
- if (is_gimple_reg (sym))
- bitmap_set_bit (regs_to_rename, i);
- }
-
- /* Memory symbols are those not in REGS_TO_RENAME. */
- bitmap_and_compl (mem_syms_to_rename,
- SYMS_TO_RENAME (cfun), regs_to_rename);
- }
-
/* If there are names defined in the replacement table, prepare
definition and use sites for all the names in NEW_SSA_NAMES and
OLD_SSA_NAMES. */
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index e2116e5a380..0c07b97c873 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -1061,8 +1061,8 @@ mx_register_decls (tree decl, gimple_seq seq, location_t location)
{
if (!DECL_ARTIFICIAL (decl))
warning (OPT_Wmudflap,
- "mudflap cannot track %qs in stub function",
- IDENTIFIER_POINTER (DECL_NAME (decl)));
+ "mudflap cannot track %qE in stub function",
+ DECL_NAME (decl));
}
else
{
@@ -1305,8 +1305,8 @@ mudflap_finish_file (void)
if (! COMPLETE_TYPE_P (TREE_TYPE (obj)))
{
warning (OPT_Wmudflap,
- "mudflap cannot track unknown size extern %qs",
- IDENTIFIER_POINTER (DECL_NAME (obj)));
+ "mudflap cannot track unknown size extern %qE",
+ DECL_NAME (obj));
continue;
}
diff --git a/gcc/tree-nomudflap.c b/gcc/tree-nomudflap.c
index 253dd2372e9..1021b31757a 100644
--- a/gcc/tree-nomudflap.c
+++ b/gcc/tree-nomudflap.c
@@ -26,8 +26,6 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "tree-inline.h"
-#include "c-tree.h"
-#include "c-common.h"
#include "gimple.h"
#include "diagnostic.h"
#include "hashtab.h"
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 6000a823c10..50d3089340a 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -128,6 +128,25 @@ set_location_for_edge (edge e)
}
}
+/* Emit insns to copy SRC into DEST converting SRC if necessary. */
+
+static inline rtx
+emit_partition_copy (rtx dest, rtx src, int unsignedsrcp)
+{
+ rtx seq;
+
+ start_sequence ();
+
+ if (GET_MODE (src) != VOIDmode && GET_MODE (src) != GET_MODE (dest))
+ src = convert_to_mode (GET_MODE (dest), src, unsignedsrcp);
+ emit_move_insn (dest, src);
+
+ seq = get_insns ();
+ end_sequence ();
+
+ return seq;
+}
+
/* Insert a copy instruction from partition SRC to DEST onto edge E. */
static void
@@ -149,12 +168,10 @@ insert_partition_copy_on_edge (edge e, int dest, int src)
set_location_for_edge (e);
- /* Partition copy between same base variables only, so it's the same mode,
- hence we can use emit_move_insn. */
- start_sequence ();
- emit_move_insn (SA.partition_to_pseudo[dest], SA.partition_to_pseudo[src]);
- seq = get_insns ();
- end_sequence ();
+ seq = emit_partition_copy (SA.partition_to_pseudo[dest],
+ SA.partition_to_pseudo[src],
+ TYPE_UNSIGNED (TREE_TYPE (
+ partition_to_var (SA.map, src))));
insert_insn_on_edge (seq, e);
}
@@ -184,8 +201,12 @@ insert_value_copy_on_edge (edge e, int dest, tree src)
start_sequence ();
mode = GET_MODE (SA.partition_to_pseudo[dest]);
x = expand_expr (src, SA.partition_to_pseudo[dest], mode, EXPAND_NORMAL);
- if (GET_MODE (x) != mode)
+ if (GET_MODE (x) != VOIDmode && GET_MODE (x) != mode)
x = convert_to_mode (mode, x, TYPE_UNSIGNED (TREE_TYPE (src)));
+ if (CONSTANT_P (x) && GET_MODE (x) == VOIDmode
+ && mode != TYPE_MODE (TREE_TYPE (src)))
+ x = convert_modes (mode, TYPE_MODE (TREE_TYPE (src)),
+ x, TYPE_UNSIGNED (TREE_TYPE (src)));
if (x != SA.partition_to_pseudo[dest])
emit_move_insn (SA.partition_to_pseudo[dest], x);
seq = get_insns ();
@@ -198,7 +219,7 @@ insert_value_copy_on_edge (edge e, int dest, tree src)
onto edge E. */
static void
-insert_rtx_to_part_on_edge (edge e, int dest, rtx src)
+insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp)
{
rtx seq;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -214,11 +235,9 @@ insert_rtx_to_part_on_edge (edge e, int dest, rtx src)
gcc_assert (SA.partition_to_pseudo[dest]);
set_location_for_edge (e);
- start_sequence ();
- gcc_assert (GET_MODE (src) == GET_MODE (SA.partition_to_pseudo[dest]));
- emit_move_insn (SA.partition_to_pseudo[dest], src);
- seq = get_insns ();
- end_sequence ();
+ seq = emit_partition_copy (SA.partition_to_pseudo[dest],
+ src,
+ unsignedsrcp);
insert_insn_on_edge (seq, e);
}
@@ -243,11 +262,10 @@ insert_part_to_rtx_on_edge (edge e, rtx dest, int src)
gcc_assert (SA.partition_to_pseudo[src]);
set_location_for_edge (e);
- start_sequence ();
- gcc_assert (GET_MODE (dest) == GET_MODE (SA.partition_to_pseudo[src]));
- emit_move_insn (dest, SA.partition_to_pseudo[src]);
- seq = get_insns ();
- end_sequence ();
+ seq = emit_partition_copy (dest,
+ SA.partition_to_pseudo[src],
+ TYPE_UNSIGNED (TREE_TYPE (
+ partition_to_var (SA.map, src))));
insert_insn_on_edge (seq, e);
}
@@ -522,14 +540,17 @@ elim_create (elim_graph g, int T)
if (elim_unvisited_predecessor (g, T))
{
- rtx U = get_temp_reg (partition_to_var (g->map, T));
+ tree var = partition_to_var (g->map, T);
+ rtx U = get_temp_reg (var);
+ int unsignedsrcp = TYPE_UNSIGNED (TREE_TYPE (var));
+
insert_part_to_rtx_on_edge (g->e, U, T);
FOR_EACH_ELIM_GRAPH_PRED (g, T, P,
{
if (!TEST_BIT (g->visited, P))
{
elim_backward (g, P);
- insert_rtx_to_part_on_edge (g->e, P, U);
+ insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp);
}
});
}
@@ -791,7 +812,7 @@ expand_phi_nodes (struct ssaexpand *sa)
static void
remove_ssa_form (bool perform_ter, struct ssaexpand *sa)
{
- gimple *values = NULL;
+ bitmap values = NULL;
var_map map;
unsigned i;
@@ -926,7 +947,7 @@ finish_out_of_ssa (struct ssaexpand *sa)
{
free (sa->partition_to_pseudo);
if (sa->values)
- free (sa->values);
+ BITMAP_FREE (sa->values);
delete_var_map (sa->map);
BITMAP_FREE (sa->partition_has_default_def);
memset (sa, 0, sizeof *sa);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 9a51829d29a..a19ac4336b0 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -395,6 +395,7 @@ extern struct gimple_opt_pass pass_rebuild_cgraph_edges;
extern struct gimple_opt_pass pass_remove_cgraph_callee_edges;
extern struct gimple_opt_pass pass_build_cgraph_edges;
extern struct gimple_opt_pass pass_local_pure_const;
+extern struct gimple_opt_pass pass_tracer;
/* IPA Passes */
extern struct ipa_opt_pass pass_ipa_inline;
@@ -434,11 +435,12 @@ extern struct rtl_opt_pass pass_rtl_dce;
extern struct rtl_opt_pass pass_rtl_dse1;
extern struct rtl_opt_pass pass_rtl_dse2;
extern struct rtl_opt_pass pass_rtl_dse3;
-extern struct rtl_opt_pass pass_gcse;
-extern struct rtl_opt_pass pass_jump_bypass;
-extern struct rtl_opt_pass pass_profiling;
+extern struct rtl_opt_pass pass_rtl_cprop;
+extern struct rtl_opt_pass pass_rtl_pre;
+extern struct rtl_opt_pass pass_rtl_hoist;
+extern struct rtl_opt_pass pass_rtl_store_motion;
+extern struct rtl_opt_pass pass_cse_after_global_opts;
extern struct rtl_opt_pass pass_rtl_ifcvt;
-extern struct gimple_opt_pass pass_tracer;
extern struct rtl_opt_pass pass_into_cfg_layout_mode;
extern struct rtl_opt_pass pass_outof_cfg_layout_mode;
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index 2d31f9f534c..b3990c6bfe1 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -1319,11 +1319,7 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
*evolution_of_loop = evolution_of_branch;
- /* If the phi node is just a copy, do not increase the limit. */
n = gimple_phi_num_args (condition_phi);
- if (n > 1)
- limit++;
-
for (i = 1; i < n; i++)
{
/* Quickly give up when the evolution of one of the branches is
@@ -1331,10 +1327,12 @@ follow_ssa_edge_in_condition_phi (struct loop *loop,
if (*evolution_of_loop == chrec_dont_know)
return t_true;
+ /* Increase the limit by the PHI argument number to avoid exponential
+ time and memory complexity. */
res = follow_ssa_edge_in_condition_phi_branch (i, loop, condition_phi,
halting_phi,
&evolution_of_branch,
- init, limit);
+ init, limit + i);
if (res == t_false || res == t_dont_know)
return res;
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index ab18bcad4b1..ec26a5dc959 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -71,11 +71,10 @@ typedef struct coalesce_list_d
#define MUST_COALESCE_COST INT_MAX
-/* Return cost of execution of copy instruction with FREQUENCY
- possibly on CRITICAL edge and in HOT basic block. */
+/* Return cost of execution of copy instruction with FREQUENCY. */
static inline int
-coalesce_cost (int frequency, bool optimize_for_size, bool critical)
+coalesce_cost (int frequency, bool optimize_for_size)
{
/* Base costs on BB frequencies bounded by 1. */
int cost = frequency;
@@ -86,9 +85,6 @@ coalesce_cost (int frequency, bool optimize_for_size, bool critical)
if (optimize_for_size)
cost = 1;
- /* Inserting copy on critical edge costs more than inserting it elsewhere. */
- if (critical)
- cost *= 2;
return cost;
}
@@ -98,7 +94,7 @@ coalesce_cost (int frequency, bool optimize_for_size, bool critical)
static inline int
coalesce_cost_bb (basic_block bb)
{
- return coalesce_cost (bb->frequency, optimize_bb_for_size_p (bb), false);
+ return coalesce_cost (bb->frequency, optimize_bb_for_size_p (bb));
}
@@ -107,12 +103,38 @@ coalesce_cost_bb (basic_block bb)
static inline int
coalesce_cost_edge (edge e)
{
+ int mult = 1;
+
+ /* Inserting copy on critical edge costs more than inserting it elsewhere. */
+ if (EDGE_CRITICAL_P (e))
+ mult = 2;
if (e->flags & EDGE_ABNORMAL)
return MUST_COALESCE_COST;
+ if (e->flags & EDGE_EH)
+ {
+ edge e2;
+ edge_iterator ei;
+ FOR_EACH_EDGE (e2, ei, e->dest->preds)
+ if (e2 != e)
+ {
+ /* Putting code on EH edge that leads to BB
+ with multiple predecestors imply splitting of
+ edge too. */
+ if (mult < 2)
+ mult = 2;
+ /* If there are multiple EH predecestors, we
+ also copy EH regions and produce separate
+ landing pad. This is expensive. */
+ if (e2->flags & EDGE_EH)
+ {
+ mult = 5;
+ break;
+ }
+ }
+ }
return coalesce_cost (EDGE_FREQUENCY (e),
- optimize_edge_for_size_p (e),
- EDGE_CRITICAL_P (e));
+ optimize_edge_for_size_p (e)) * mult;
}
@@ -1094,8 +1116,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
if (SSA_NAME_VAR (outputs[match]) == SSA_NAME_VAR (input))
{
cost = coalesce_cost (REG_BR_PROB_BASE,
- optimize_bb_for_size_p (bb),
- false);
+ optimize_bb_for_size_p (bb));
add_coalesce (cl, v1, v2, cost);
bitmap_set_bit (used_in_copy, v1);
bitmap_set_bit (used_in_copy, v2);
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index f582ed0f996..9dad1cdc940 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -78,55 +78,6 @@ may_propagate_copy (tree dest, tree orig)
if (!useless_type_conversion_p (type_d, type_o))
return false;
- /* FIXME. GIMPLE is allowing pointer assignments and comparisons of
- pointers that have different alias sets. This means that these
- pointers will have different memory tags associated to them.
-
- If we allow copy propagation in these cases, statements de-referencing
- the new pointer will now have a reference to a different memory tag
- with potentially incorrect SSA information.
-
- This was showing up in libjava/java/util/zip/ZipFile.java with code
- like:
-
- struct java.io.BufferedInputStream *T.660;
- struct java.io.BufferedInputStream *T.647;
- struct java.io.InputStream *is;
- struct java.io.InputStream *is.662;
- [ ... ]
- T.660 = T.647;
- is = T.660; <-- This ought to be type-casted
- is.662 = is;
-
- Also, f/name.c exposed a similar problem with a COND_EXPR predicate
- that was causing DOM to generate and equivalence with two pointers of
- alias-incompatible types:
-
- struct _ffename_space *n;
- struct _ffename *ns;
- [ ... ]
- if (n == ns)
- goto lab;
- ...
- lab:
- return n;
-
- I think that GIMPLE should emit the appropriate type-casts. For the
- time being, blocking copy-propagation in these cases is the safe thing
- to do. */
- if (TREE_CODE (dest) == SSA_NAME
- && TREE_CODE (orig) == SSA_NAME
- && POINTER_TYPE_P (type_d)
- && POINTER_TYPE_P (type_o))
- {
- if (get_alias_set (TREE_TYPE (type_d))
- != get_alias_set (TREE_TYPE (type_o)))
- return false;
- else if (DECL_NO_TBAA_P (SSA_NAME_VAR (dest))
- != DECL_NO_TBAA_P (SSA_NAME_VAR (orig)))
- return false;
- }
-
/* Propagating virtual operands is always ok. */
if (TREE_CODE (dest) == SSA_NAME && !is_gimple_reg (dest))
{
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 1a851fa6770..a134244bd9f 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -619,7 +619,6 @@ static unsigned int
tree_ssa_dominator_optimize (void)
{
struct dom_walk_data walk_data;
- unsigned int i;
memset (&opt_stats, 0, sizeof (opt_stats));
@@ -659,6 +658,9 @@ tree_ssa_dominator_optimize (void)
that we update the loop info. */
loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES);
+ /* Initialize the value-handle array. */
+ threadedge_initialize_values ();
+
/* We need accurate information regarding back edges in the CFG
for jump threading; this may include back edges that are not part of
a single loop. */
@@ -716,23 +718,6 @@ tree_ssa_dominator_optimize (void)
bitmap_zero (need_eh_cleanup);
}
- /* Finally, remove everything except invariants in SSA_NAME_VALUE.
-
- Long term we will be able to let everything in SSA_NAME_VALUE
- persist. However, for now, we know this is the safe thing to do. */
- for (i = 0; i < num_ssa_names; i++)
- {
- tree name = ssa_name (i);
- tree value;
-
- if (!name)
- continue;
-
- value = SSA_NAME_VALUE (name);
- if (value && !is_gimple_min_invariant (value))
- SSA_NAME_VALUE (name) = NULL;
- }
-
statistics_counter_event (cfun, "Redundant expressions eliminated",
opt_stats.num_re);
statistics_counter_event (cfun, "Constants propagated",
@@ -759,6 +744,10 @@ tree_ssa_dominator_optimize (void)
VEC_free (tree, heap, const_and_copies_stack);
VEC_free (gimple_p, heap, stmts_to_rescan);
+ /* Free the value-handle array. */
+ threadedge_finalize_values ();
+ ssa_name_values = NULL;
+
return 0;
}
@@ -912,7 +901,7 @@ restore_vars_to_original_value (void)
}
prev_value = VEC_pop (tree, const_and_copies_stack);
- SSA_NAME_VALUE (dest) = prev_value;
+ set_ssa_name_value (dest, prev_value);
}
}
@@ -1124,7 +1113,7 @@ record_equivalences_from_phis (basic_block bb)
inferred from a comparison. All uses of this ssa name are dominated
by this assignment, so unwinding just costs time and space. */
if (i == gimple_phi_num_args (phi) && may_propagate_copy (lhs, rhs))
- SSA_NAME_VALUE (lhs) = rhs;
+ set_ssa_name_value (lhs, rhs);
}
}
@@ -1437,7 +1426,7 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted)
static void
record_const_or_copy_1 (tree x, tree y, tree prev_x)
{
- SSA_NAME_VALUE (x) = y;
+ set_ssa_name_value (x, y);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -1956,7 +1945,7 @@ record_equivalences_from_stmt (gimple stmt, int may_optimize_p)
fprintf (dump_file, "\n");
}
- SSA_NAME_VALUE (lhs) = rhs;
+ set_ssa_name_value (lhs, rhs);
}
}
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index c596e8b7541..65b02af27f6 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -862,12 +862,21 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
of the elements in X into &x[C1 + C2/element size]. */
if (TREE_CODE (rhs2) == INTEGER_CST)
{
- tree new_rhs = maybe_fold_stmt_addition (gimple_expr_type (use_stmt),
+ tree new_rhs = maybe_fold_stmt_addition (TREE_TYPE (def_rhs),
def_rhs, rhs2);
if (new_rhs)
{
- gimple_assign_set_rhs_from_tree (use_stmt_gsi,
- unshare_expr (new_rhs));
+ tree type = TREE_TYPE (gimple_assign_lhs (use_stmt));
+ new_rhs = unshare_expr (new_rhs);
+ if (!useless_type_conversion_p (type, TREE_TYPE (new_rhs)))
+ {
+ if (!is_gimple_min_invariant (new_rhs))
+ new_rhs = force_gimple_operand_gsi (use_stmt_gsi, new_rhs,
+ true, NULL_TREE,
+ true, GSI_SAME_STMT);
+ new_rhs = fold_convert (type, new_rhs);
+ }
+ gimple_assign_set_rhs_from_tree (use_stmt_gsi, new_rhs);
use_stmt = gsi_stmt (*use_stmt_gsi);
update_stmt (use_stmt);
tidy_after_forward_propagate_addr (use_stmt);
@@ -950,9 +959,8 @@ forward_propagate_addr_expr (tree name, tree rhs)
use_rhs = gimple_assign_rhs1 (use_stmt);
if (result
&& TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
- && (TREE_CODE (use_rhs) == SSA_NAME
- || (CONVERT_EXPR_P (use_rhs)
- && TREE_CODE (TREE_OPERAND (use_rhs, 0)) == SSA_NAME)))
+ && TREE_CODE (use_rhs) == SSA_NAME
+ && has_zero_uses (gimple_assign_lhs (use_stmt)))
{
gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
release_defs (use_stmt);
diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h
index d97a2133759..d7dd10dc0dc 100644
--- a/gcc/tree-ssa-live.h
+++ b/gcc/tree-ssa-live.h
@@ -341,8 +341,8 @@ extern var_map coalesce_ssa_name (void);
/* From tree-ssa-ter.c */
-extern gimple *find_replaceable_exprs (var_map);
-extern void dump_replaceable_exprs (FILE *, gimple *);
+extern bitmap find_replaceable_exprs (var_map);
+extern void dump_replaceable_exprs (FILE *, bitmap);
#endif /* _TREE_SSA_LIVE_H */
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 4e6e09c477d..6ccc30ec808 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -90,12 +90,12 @@ along with GCC; see the file COPYING3. If not see
/* Structure to keep track of the value of a dereferenced PHI result
- and the set of virtual operands used for that dereference. */
+ and the virtual operand used for that dereference. */
struct phiprop_d
{
tree value;
- gimple vop_stmt;
+ tree vuse;
};
/* Verify if the value recorded for NAME in PHIVN is still valid at
@@ -104,34 +104,27 @@ struct phiprop_d
static bool
phivn_valid_p (struct phiprop_d *phivn, tree name, basic_block bb)
{
- gimple vop_stmt = phivn[SSA_NAME_VERSION (name)].vop_stmt;
- tree vuse;
+ tree vuse = phivn[SSA_NAME_VERSION (name)].vuse;
+ gimple use_stmt;
+ imm_use_iterator ui2;
+ bool ok = true;
- /* The def stmts of all virtual uses need to be post-dominated
- by bb. */
- if ((vuse = gimple_vuse (vop_stmt)))
- {
- gimple use_stmt;
- imm_use_iterator ui2;
- bool ok = true;
+ /* The def stmts of the virtual uses need to be dominated by bb. */
+ gcc_assert (vuse != NULL_TREE);
- FOR_EACH_IMM_USE_STMT (use_stmt, ui2, vuse)
+ FOR_EACH_IMM_USE_STMT (use_stmt, ui2, vuse)
+ {
+ /* If BB does not dominate a VDEF, the value is invalid. */
+ if ((gimple_vdef (use_stmt) != NULL_TREE
+ || gimple_code (use_stmt) == GIMPLE_PHI)
+ && !dominated_by_p (CDI_DOMINATORS, gimple_bb (use_stmt), bb))
{
- /* If BB does not dominate a VDEF, the value is invalid. */
- if (((is_gimple_assign (use_stmt)
- && gimple_vdef (use_stmt))
- || gimple_code (use_stmt) == GIMPLE_PHI)
- && !dominated_by_p (CDI_DOMINATORS, gimple_bb (use_stmt), bb))
- {
- ok = false;
- BREAK_FROM_IMM_USE_STMT (ui2);
- }
+ ok = false;
+ BREAK_FROM_IMM_USE_STMT (ui2);
}
- if (!ok)
- return false;
}
- return true;
+ return ok;
}
/* Insert a new phi node for the dereference of PHI at basic_block
@@ -154,6 +147,12 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
res = gimple_assign_lhs (use_stmt);
SSA_NAME_DEF_STMT (res) = new_phi = create_phi_node (res, bb);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Inserting PHI for result of load ");
+ print_gimple_stmt (dump_file, use_stmt, 0, 0);
+ }
+
/* Add PHI arguments for each edge inserting loads of the
addressable operands. */
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -171,8 +170,19 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
}
if (TREE_CODE (old_arg) == SSA_NAME)
- /* Reuse a formerly created dereference. */
- new_var = phivn[SSA_NAME_VERSION (old_arg)].value;
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " for edge defining ");
+ print_generic_expr (dump_file, PHI_ARG_DEF_FROM_EDGE (phi, e), 0);
+ fprintf (dump_file, " reusing PHI result ");
+ print_generic_expr (dump_file,
+ phivn[SSA_NAME_VERSION (old_arg)].value, 0);
+ fprintf (dump_file, "\n");
+ }
+ /* Reuse a formerly created dereference. */
+ new_var = phivn[SSA_NAME_VERSION (old_arg)].value;
+ }
else
{
gcc_assert (TREE_CODE (old_arg) == ADDR_EXPR);
@@ -188,9 +198,15 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
gimple_assign_set_lhs (tmp, new_var);
gsi_insert_on_edge (e, tmp);
-
update_stmt (tmp);
- mark_symbols_for_renaming (tmp);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " for edge defining ");
+ print_generic_expr (dump_file, PHI_ARG_DEF_FROM_EDGE (phi, e), 0);
+ fprintf (dump_file, " inserting load ");
+ print_gimple_stmt (dump_file, tmp, 0, 0);
+ }
}
add_phi_arg (new_phi, new_var, e);
@@ -198,6 +214,9 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
update_stmt (new_phi);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ print_gimple_stmt (dump_file, new_phi, 0, 0);
+
return res;
}
@@ -270,6 +289,7 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
phi_inserted = false;
FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
{
+ gimple def_stmt;
tree vuse;
/* Check whether this is a load of *ptr. */
@@ -281,17 +301,15 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
&& !stmt_can_throw_internal (use_stmt)))
continue;
- /* Check if we can move the loads. The def stmts of all virtual uses
- need to be post-dominated by bb. */
- if ((vuse = gimple_vuse (use_stmt)) != NULL_TREE)
- {
- gimple def_stmt = SSA_NAME_DEF_STMT (vuse);
- if (!SSA_NAME_IS_DEFAULT_DEF (vuse)
- && (gimple_bb (def_stmt) == bb
- || !dominated_by_p (CDI_DOMINATORS,
- bb, gimple_bb (def_stmt))))
- goto next;
- }
+ /* Check if we can move the loads. The def stmt of the virtual use
+ needs to be in a different basic block dominating bb. */
+ vuse = gimple_vuse (use_stmt);
+ def_stmt = SSA_NAME_DEF_STMT (vuse);
+ if (!SSA_NAME_IS_DEFAULT_DEF (vuse)
+ && (gimple_bb (def_stmt) == bb
+ || !dominated_by_p (CDI_DOMINATORS,
+ bb, gimple_bb (def_stmt))))
+ goto next;
/* Found a proper dereference. Insert a phi node if this
is the first load transformation. */
@@ -301,7 +319,7 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
/* Remember the value we created for *ptr. */
phivn[SSA_NAME_VERSION (ptr)].value = res;
- phivn[SSA_NAME_VERSION (ptr)].vop_stmt = use_stmt;
+ phivn[SSA_NAME_VERSION (ptr)].vuse = vuse;
/* Remove old stmt. The phi is taken care of by DCE, if we
want to delete it here we also have to delete all intermediate
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 61207b2f849..8c6dcb736d7 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -4131,6 +4131,11 @@ eliminate (void)
update_stmt (stmt);
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
gimple_purge_dead_eh_edges (b);
+
+ /* Changing an indirect call to a direct call may
+ have exposed different semantics. This may
+ require an SSA update. */
+ todo |= TODO_update_ssa_only_virtuals;
}
}
}
@@ -4210,7 +4215,9 @@ eliminate (void)
/* If there is a single use only, propagate the equivalency
instead of keeping the copy. */
if (TREE_CODE (lhs) == SSA_NAME
- && single_imm_use (lhs, &use_p, &use_stmt))
+ && single_imm_use (lhs, &use_p, &use_stmt)
+ && may_propagate_copy (USE_FROM_PTR (use_p),
+ gimple_assign_rhs1 (stmt)))
{
SET_USE (use_p, gimple_assign_rhs1 (stmt));
update_stmt (use_stmt);
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 89bbe08adbd..3e8d1219c80 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -487,7 +487,6 @@ ssa_prop_init (void)
edge e;
edge_iterator ei;
basic_block bb;
- size_t i;
/* Worklists of SSA edges. */
interesting_ssa_edges = VEC_alloc (gimple, gc, 20);
@@ -505,11 +504,6 @@ ssa_prop_init (void)
cfg_blocks = VEC_alloc (basic_block, heap, 20);
VEC_safe_grow (basic_block, heap, cfg_blocks, 20);
- /* Initialize the values for every SSA_NAME. */
- for (i = 1; i < num_ssa_names; i++)
- if (ssa_name (i))
- SSA_NAME_VALUE (ssa_name (i)) = NULL_TREE;
-
/* Initially assume that every edge in the CFG is not executable.
(including the edges coming out of ENTRY_BLOCK_PTR). */
FOR_ALL_BB (bb)
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index b0768d0c20b..3bcaeb1e011 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -32,11 +32,9 @@
#include "basic-block.h"
#include "output.h"
#include "tree.h"
-#include "c-common.h"
#include "tree-flow.h"
#include "tree-inline.h"
#include "varray.h"
-#include "c-tree.h"
#include "diagnostic.h"
#include "toplev.h"
#include "gimple.h"
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 6fd7ca14485..3bbc8b9f866 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -159,7 +159,7 @@ typedef struct temp_expr_table_d
{
var_map map;
bitmap *partition_dependencies; /* Partitions expr is dependent on. */
- gimple *replaceable_expressions; /* Replacement expression table. */
+ bitmap replaceable_expressions; /* Replacement expression table. */
bitmap *expr_decl_uids; /* Base uids of exprs. */
bitmap *kill_list; /* Expr's killed by a partition. */
int virtual_partition; /* Pseudo partition for virtual ops. */
@@ -216,10 +216,10 @@ new_temp_expr_table (var_map map)
/* Free TER table T. If there are valid replacements, return the expression
vector. */
-static gimple *
+static bitmap
free_temp_expr_table (temp_expr_table_p t)
{
- gimple *ret = NULL;
+ bitmap ret = NULL;
#ifdef ENABLE_CHECKING
unsigned x;
@@ -255,7 +255,7 @@ version_to_be_replaced_p (temp_expr_table_p tab, int version)
{
if (!tab->replaceable_expressions)
return false;
- return tab->replaceable_expressions[version] != NULL;
+ return bitmap_bit_p (tab->replaceable_expressions, version);
}
@@ -562,8 +562,8 @@ mark_replaceable (temp_expr_table_p tab, tree var, bool more_replacing)
/* Set the replaceable expression. */
if (!tab->replaceable_expressions)
- tab->replaceable_expressions = XCNEWVEC (gimple, num_ssa_names + 1);
- tab->replaceable_expressions[version] = SSA_NAME_DEF_STMT (var);
+ tab->replaceable_expressions = BITMAP_ALLOC (NULL);
+ bitmap_set_bit (tab->replaceable_expressions, version);
}
@@ -653,12 +653,12 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
NULL is returned by the function, otherwise an expression vector indexed
by SSA_NAME version numbers. */
-extern gimple *
+extern bitmap
find_replaceable_exprs (var_map map)
{
basic_block bb;
temp_expr_table_p table;
- gimple *ret;
+ bitmap ret;
table = new_temp_expr_table (map);
FOR_EACH_BB (bb)
@@ -676,19 +676,19 @@ find_replaceable_exprs (var_map map)
/* Dump TER expression table EXPR to file F. */
void
-dump_replaceable_exprs (FILE *f, gimple *expr)
+dump_replaceable_exprs (FILE *f, bitmap expr)
{
tree var;
unsigned x;
fprintf (f, "\nReplacing Expressions\n");
for (x = 0; x < num_ssa_names; x++)
- if (expr[x])
+ if (bitmap_bit_p (expr, x))
{
var = ssa_name (x);
print_generic_expr (f, var, TDF_SLIM);
fprintf (f, " replace with --> ");
- print_gimple_stmt (f, expr[x], 0, TDF_SLIM);
+ print_gimple_stmt (f, SSA_NAME_DEF_STMT (var), 0, TDF_SLIM);
fprintf (f, "\n");
}
fprintf (f, "\n");
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index 1429c18c998..473bc9b90b4 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -49,6 +49,35 @@ along with GCC; see the file COPYING3. If not see
to copy as part of the jump threading process. */
static int stmt_count;
+/* Array to record value-handles per SSA_NAME. */
+VEC(tree,heap) *ssa_name_values;
+
+/* Set the value for the SSA name NAME to VALUE. */
+
+void
+set_ssa_name_value (tree name, tree value)
+{
+ if (SSA_NAME_VERSION (name) >= VEC_length (tree, ssa_name_values))
+ VEC_safe_grow_cleared (tree, heap, ssa_name_values,
+ SSA_NAME_VERSION (name) + 1);
+ VEC_replace (tree, ssa_name_values, SSA_NAME_VERSION (name), value);
+}
+
+/* Initialize the per SSA_NAME value-handles array. Returns it. */
+void
+threadedge_initialize_values (void)
+{
+ gcc_assert (ssa_name_values == NULL);
+ ssa_name_values = VEC_alloc(tree, heap, num_ssa_names);
+}
+
+/* Free the per SSA_NAME value-handle array. */
+void
+threadedge_finalize_values (void)
+{
+ VEC_free(tree, heap, ssa_name_values);
+}
+
/* Return TRUE if we may be able to thread an incoming edge into
BB to an outgoing edge from BB. Return FALSE otherwise. */
@@ -126,7 +155,7 @@ remove_temporary_equivalences (VEC(tree, heap) **stack)
break;
prev_value = VEC_pop (tree, *stack);
- SSA_NAME_VALUE (dest) = prev_value;
+ set_ssa_name_value (dest, prev_value);
}
}
@@ -145,7 +174,7 @@ record_temporary_equivalence (tree x, tree y, VEC(tree, heap) **stack)
y = tmp ? tmp : y;
}
- SSA_NAME_VALUE (x) = y;
+ set_ssa_name_value (x, y);
VEC_reserve (tree, heap, *stack, 2);
VEC_quick_push (tree, *stack, prev_x);
VEC_quick_push (tree, *stack, x);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index ddf52022b54..10f84828fa8 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -961,12 +961,9 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
&& TYPE_VOLATILE (TREE_TYPE (outer_type)))
return false;
- /* Do not lose casts between pointers with different
- TYPE_REF_CAN_ALIAS_ALL setting or alias sets. */
- if ((TYPE_REF_CAN_ALIAS_ALL (inner_type)
- != TYPE_REF_CAN_ALIAS_ALL (outer_type))
- || (get_alias_set (TREE_TYPE (inner_type))
- != get_alias_set (TREE_TYPE (outer_type))))
+ /* Do not lose casts between pointers that when dereferenced access
+ memory with different alias sets. */
+ if (get_deref_alias_set (inner_type) != get_deref_alias_set (outer_type))
return false;
/* We do not care for const qualification of the pointed-to types
@@ -1002,6 +999,13 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
return false;
+ /* Conversions from array types with unknown extent to
+ array types with known extent are not useless. */
+ if (TREE_CODE (inner_type) == ARRAY_TYPE
+ && !TYPE_DOMAIN (inner_type)
+ && TYPE_DOMAIN (outer_type))
+ return false;
+
/* ??? This seems to be necessary even for aggregates that don't
have TYPE_STRUCTURAL_EQUALITY_P set. */
@@ -1514,14 +1518,20 @@ execute_update_addresses_taken (bool do_optimize)
a local decl that requires not to be a gimple register. */
if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
{
- tree lhs = gimple_get_lhs (stmt);
- /* A plain decl does not need it set. */
- if (lhs && handled_component_p (lhs))
- {
- var = get_base_address (lhs);
- if (DECL_P (var))
- bitmap_set_bit (not_reg_needs, DECL_UID (var));
- }
+ tree lhs = gimple_get_lhs (stmt);
+
+ /* We may not rewrite TMR_SYMBOL to SSA. */
+ if (lhs && TREE_CODE (lhs) == TARGET_MEM_REF
+ && TMR_SYMBOL (lhs))
+ bitmap_set_bit (not_reg_needs, DECL_UID (TMR_SYMBOL (lhs)));
+
+ /* A plain decl does not need it set. */
+ else if (lhs && handled_component_p (lhs))
+ {
+ var = get_base_address (lhs);
+ if (DECL_P (var))
+ bitmap_set_bit (not_reg_needs, DECL_UID (var));
+ }
}
}
@@ -1573,7 +1583,9 @@ execute_update_addresses_taken (bool do_optimize)
if (!DECL_GIMPLE_REG_P (var)
&& !bitmap_bit_p (not_reg_needs, DECL_UID (var))
&& (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE
- || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE))
+ || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE)
+ && !TREE_THIS_VOLATILE (var)
+ && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var)))
{
DECL_GIMPLE_REG_P (var) = 1;
mark_sym_for_renaming (var);
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 637075cbb65..a117898e146 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -321,7 +321,7 @@ vect_equal_offsets (tree offset1, tree offset2)
Check if DRA and DRB are a part of interleaving. In case they are, insert
DRA and DRB in an interleaving chain. */
-static void
+static bool
vect_check_interleaving (struct data_reference *dra,
struct data_reference *drb)
{
@@ -337,12 +337,13 @@ vect_check_interleaving (struct data_reference *dra,
|| !vect_equal_offsets (DR_OFFSET (dra), DR_OFFSET (drb))
|| !tree_int_cst_compare (DR_INIT (dra), DR_INIT (drb))
|| DR_IS_READ (dra) != DR_IS_READ (drb))
- return;
+ return false;
/* Check:
1. data-refs are of the same type
2. their steps are equal
- 3. the step is greater than the difference between data-refs' inits */
+ 3. the step (if greater than zero) is greater than the difference between
+ data-refs' inits. */
type_size_a = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dra))));
type_size_b = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (drb))));
@@ -350,7 +351,7 @@ vect_check_interleaving (struct data_reference *dra,
|| tree_int_cst_compare (DR_STEP (dra), DR_STEP (drb))
|| !types_compatible_p (TREE_TYPE (DR_REF (dra)),
TREE_TYPE (DR_REF (drb))))
- return;
+ return false;
init_a = TREE_INT_CST_LOW (DR_INIT (dra));
init_b = TREE_INT_CST_LOW (DR_INIT (drb));
@@ -363,7 +364,7 @@ vect_check_interleaving (struct data_reference *dra,
diff_mod_size = (init_a - init_b) % type_size_a;
if ((init_a - init_b) > step)
- return;
+ return false;
if (diff_mod_size == 0)
{
@@ -375,7 +376,7 @@ vect_check_interleaving (struct data_reference *dra,
fprintf (vect_dump, " and ");
print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM);
}
- return;
+ return true;
}
}
else
@@ -385,7 +386,7 @@ vect_check_interleaving (struct data_reference *dra,
diff_mod_size = (init_b - init_a) % type_size_a;
if ((init_b - init_a) > step)
- return;
+ return false;
if (diff_mod_size == 0)
{
@@ -397,9 +398,11 @@ vect_check_interleaving (struct data_reference *dra,
fprintf (vect_dump, " and ");
print_generic_expr (vect_dump, DR_REF (drb), TDF_SLIM);
}
- return;
+ return true;
}
}
+
+ return false;
}
/* Check if data references pointed by DR_I and DR_J are same or
@@ -584,7 +587,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
continue;
}
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump,
"not vectorized, possible dependence "
@@ -868,7 +871,7 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo)
supportable_dr_alignment = vect_supportable_dr_alignment (dr);
if (!supportable_dr_alignment)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
if (DR_IS_READ (dr))
fprintf (vect_dump,
@@ -1347,14 +1350,14 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
Return FALSE if a data reference is found that cannot be vectorized. */
bool
-vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo)
+vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo)
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "=== vect_analyze_data_refs_alignment ===");
if (!vect_compute_data_refs_alignment (loop_vinfo))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump,
"not vectorized: can't calculate alignment for data ref.");
return false;
@@ -1663,7 +1666,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo)
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
if (!vect_analyze_data_ref_access (dr))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "not vectorized: complicated access pattern.");
return false;
}
@@ -1787,7 +1790,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
if (!dr || !DR_REF (dr))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "not vectorized: unhandled data-ref ");
return false;
}
@@ -1799,7 +1802,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
if (!DR_BASE_ADDRESS (dr) || !DR_OFFSET (dr) || !DR_INIT (dr)
|| !DR_STEP (dr))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump, "not vectorized: data ref analysis failed ");
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
@@ -1809,7 +1812,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
if (TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "not vectorized: base addr of dr is a "
"constant");
return false;
@@ -1930,7 +1933,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
if (STMT_VINFO_DATA_REF (stmt_info))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump,
"not vectorized: more than one data ref in stmt: ");
@@ -1938,6 +1941,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
}
return false;
}
+
STMT_VINFO_DATA_REF (stmt_info) = dr;
/* Set vectype for STMT. */
@@ -1946,7 +1950,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo)
get_vectype_for_scalar_type (scalar_type);
if (!STMT_VINFO_VECTYPE (stmt_info))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump,
"not vectorized: no vectype for stmt: ");
@@ -2056,7 +2060,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
gimple_seq seq = NULL;
tree base_offset = unshare_expr (DR_OFFSET (dr));
tree init = unshare_expr (DR_INIT (dr));
- tree vect_ptr_type, addr_expr2;
+ tree vect_ptr_type;
tree step = TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr)));
gcc_assert (loop);
@@ -2108,15 +2112,12 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
vect_ptr_type = build_pointer_type (STMT_VINFO_VECTYPE (stmt_info));
- /* addr_expr = addr_base */
+ vec_stmt = fold_convert (vect_ptr_type, addr_base);
addr_expr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
get_name (base_name));
+
add_referenced_var (addr_expr);
- vec_stmt = fold_convert (vect_ptr_type, addr_base);
- addr_expr2 = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
- get_name (base_name));
- add_referenced_var (addr_expr2);
- vec_stmt = force_gimple_operand (vec_stmt, &seq, false, addr_expr2);
+ vec_stmt = force_gimple_operand (vec_stmt, &seq, false, addr_expr);
gimple_seq_add_seq (new_stmt_list, seq);
if (vect_print_dump_info (REPORT_DETAILS))
@@ -2124,6 +2125,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
fprintf (vect_dump, "created ");
print_generic_expr (vect_dump, vec_stmt, TDF_SLIM);
}
+
return vec_stmt;
}
@@ -3231,7 +3233,7 @@ vect_supportable_dr_alignment (struct data_reference *dr)
gimple stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
- enum machine_mode mode = (int) TYPE_MODE (vectype);
+ enum machine_mode mode = TYPE_MODE (vectype);
struct loop *vect_loop = LOOP_VINFO_LOOP (STMT_VINFO_LOOP_VINFO (stmt_info));
bool nested_in_vect_loop = nested_in_vect_loop_p (vect_loop, stmt);
bool invariant_in_outerloop = false;
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 56f9bba513d..3d7f5938afa 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -2290,7 +2290,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo,
else
*cond_expr = part_cond_expr;
}
- if (vect_print_dump_info (REPORT_VECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS))
fprintf (vect_dump, "created %u versioning for alias checks.\n",
VEC_length (ddr_p, may_alias_ddrs));
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index efcaaaff3d0..6c239dbf6e9 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -212,7 +212,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump,
"not vectorized: unsupported data-type ");
@@ -262,7 +262,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (gimple_get_lhs (stmt) == NULL_TREE)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump, "not vectorized: irregular stmt.");
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
@@ -272,7 +272,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (VECTOR_MODE_P (TYPE_MODE (gimple_expr_type (stmt))))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump, "not vectorized: vector stmt in loop:");
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
@@ -306,7 +306,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
{
fprintf (vect_dump,
"not vectorized: unsupported data-type ");
@@ -339,7 +339,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
fprintf (vect_dump, "vectorization factor = %d", vectorization_factor);
if (vectorization_factor <= 1)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "not vectorized: unsupported data-type");
return false;
}
@@ -533,7 +533,6 @@ vect_analyze_scalar_cycles (loop_vec_info loop_vinfo)
vect_analyze_scalar_cycles_1 (loop_vinfo, loop->inner);
}
-
/* Function vect_get_loop_niters.
Determine how many iterations the loop is executed.
@@ -557,10 +556,10 @@ vect_get_loop_niters (struct loop *loop, tree *number_of_iterations)
*number_of_iterations = niters;
if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "==> get_loop_niters:" );
- print_generic_expr (vect_dump, *number_of_iterations, TDF_SLIM);
- }
+ {
+ fprintf (vect_dump, "==> get_loop_niters:" );
+ print_generic_expr (vect_dump, *number_of_iterations, TDF_SLIM);
+ }
}
return get_loop_exit_condition (loop);
@@ -1025,7 +1024,7 @@ vect_analyze_loop_form (struct loop *loop)
}
else if (TREE_INT_CST_LOW (number_of_iterations) == 0)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "not vectorized: number of iterations = 0.");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, false);
@@ -1047,6 +1046,237 @@ vect_analyze_loop_form (struct loop *loop)
return loop_vinfo;
}
+
+/* Function vect_analyze_loop_operations.
+
+ Scan the loop stmts and make sure they are all vectorizable. */
+
+static bool
+vect_analyze_loop_operations (loop_vec_info loop_vinfo)
+{
+ struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
+ basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
+ int nbbs = loop->num_nodes;
+ gimple_stmt_iterator si;
+ unsigned int vectorization_factor = 0;
+ int i;
+ gimple phi;
+ stmt_vec_info stmt_info;
+ bool need_to_vectorize = false;
+ int min_profitable_iters;
+ int min_scalar_loop_bound;
+ unsigned int th;
+ bool only_slp_in_loop = true, ok;
+
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "=== vect_analyze_loop_operations ===");
+
+ gcc_assert (LOOP_VINFO_VECT_FACTOR (loop_vinfo));
+ vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
+
+ for (i = 0; i < nbbs; i++)
+ {
+ basic_block bb = bbs[i];
+
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ {
+ phi = gsi_stmt (si);
+ ok = true;
+
+ stmt_info = vinfo_for_stmt (phi);
+ if (vect_print_dump_info (REPORT_DETAILS))
+ {
+ fprintf (vect_dump, "examining phi: ");
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
+ }
+
+ if (! is_loop_header_bb_p (bb))
+ {
+ /* inner-loop loop-closed exit phi in outer-loop vectorization
+ (i.e. a phi in the tail of the outer-loop).
+ FORNOW: we currently don't support the case that these phis
+ are not used in the outerloop, cause this case requires
+ to actually do something here. */
+ if (!STMT_VINFO_RELEVANT_P (stmt_info)
+ || STMT_VINFO_LIVE_P (stmt_info))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump,
+ "Unsupported loop-closed phi in outer-loop.");
+ return false;
+ }
+ continue;
+ }
+
+ gcc_assert (stmt_info);
+
+ if (STMT_VINFO_LIVE_P (stmt_info))
+ {
+ /* FORNOW: not yet supported. */
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump, "not vectorized: value used after loop.");
+ return false;
+ }
+
+ if (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_scope
+ && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def)
+ {
+ /* A scalar-dependence cycle that we don't support. */
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump, "not vectorized: scalar dependence cycle.");
+ return false;
+ }
+
+ if (STMT_VINFO_RELEVANT_P (stmt_info))
+ {
+ need_to_vectorize = true;
+ if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def)
+ ok = vectorizable_induction (phi, NULL, NULL);
+ }
+
+ if (!ok)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump,
+ "not vectorized: relevant phi not supported: ");
+ print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
+ }
+ return false;
+ }
+ }
+
+ for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ {
+ gimple stmt = gsi_stmt (si);
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+
+ gcc_assert (stmt_info);
+
+ if (!vect_analyze_stmt (stmt, &need_to_vectorize))
+ return false;
+
+ if (STMT_VINFO_RELEVANT_P (stmt_info) && !PURE_SLP_STMT (stmt_info))
+ /* STMT needs both SLP and loop-based vectorization. */
+ only_slp_in_loop = false;
+ }
+ } /* bbs */
+
+ /* All operations in the loop are either irrelevant (deal with loop
+ control, or dead), or only used outside the loop and can be moved
+ out of the loop (e.g. invariants, inductions). The loop can be
+ optimized away by scalar optimizations. We're better off not
+ touching this loop. */
+ if (!need_to_vectorize)
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump,
+ "All the computation can be taken out of the loop.");
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump,
+ "not vectorized: redundant loop. no profit to vectorize.");
+ return false;
+ }
+
+ /* If all the stmts in the loop can be SLPed, we perform only SLP, and
+ vectorization factor of the loop is the unrolling factor required by the
+ SLP instances. If that unrolling factor is 1, we say, that we perform
+ pure SLP on loop - cross iteration parallelism is not exploited. */
+ if (only_slp_in_loop)
+ vectorization_factor = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo);
+ else
+ vectorization_factor = least_common_multiple (vectorization_factor,
+ LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo));
+
+ LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
+
+ if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ && vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump,
+ "vectorization_factor = %d, niters = " HOST_WIDE_INT_PRINT_DEC,
+ vectorization_factor, LOOP_VINFO_INT_NITERS (loop_vinfo));
+
+ if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ && (LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor))
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump, "not vectorized: iteration count too small.");
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump,"not vectorized: iteration count smaller than "
+ "vectorization factor.");
+ return false;
+ }
+
+ /* Analyze cost. Decide if worth while to vectorize. */
+
+ /* Once VF is set, SLP costs should be updated since the number of created
+ vector stmts depends on VF. */
+ vect_update_slp_costs_according_to_vf (loop_vinfo);
+
+ min_profitable_iters = vect_estimate_min_profitable_iters (loop_vinfo);
+ LOOP_VINFO_COST_MODEL_MIN_ITERS (loop_vinfo) = min_profitable_iters;
+
+ if (min_profitable_iters < 0)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump, "not vectorized: vectorization not profitable.");
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "not vectorized: vector version will never be "
+ "profitable.");
+ return false;
+ }
+
+ min_scalar_loop_bound = ((PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)
+ * vectorization_factor) - 1);
+
+ /* Use the cost model only if it is more conservative than user specified
+ threshold. */
+
+ th = (unsigned) min_scalar_loop_bound;
+ if (min_profitable_iters
+ && (!min_scalar_loop_bound
+ || min_profitable_iters > min_scalar_loop_bound))
+ th = (unsigned) min_profitable_iters;
+
+ if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ && LOOP_VINFO_INT_NITERS (loop_vinfo) <= th)
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump, "not vectorized: vectorization not "
+ "profitable.");
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "not vectorized: iteration count smaller than "
+ "user specified loop bound parameter or minimum "
+ "profitable iterations (whichever is more conservative).");
+ return false;
+ }
+
+ if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
+ || LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0
+ || LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "epilog loop required.");
+ if (!vect_can_advance_ivs_p (loop_vinfo))
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump,
+ "not vectorized: can't create epilog loop 1.");
+ return false;
+ }
+ if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ fprintf (vect_dump,
+ "not vectorized: can't create epilog loop 2.");
+ return false;
+ }
+ }
+
+ return true;
+}
+
+
/* Function vect_analyze_loop.
Apply a set of analyses on LOOP, and create a loop_vec_info struct
@@ -1197,7 +1427,7 @@ vect_analyze_loop (struct loop *loop)
/* Scan all the operations in the loop and make sure they are
vectorizable. */
- ok = vect_analyze_operations (loop_vinfo);
+ ok = vect_analyze_loop_operations (loop_vinfo);
if (!ok)
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -1445,7 +1675,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi)
/* Check that one def is the reduction def, defined by PHI,
- the other def is either defined in the loop ("vect_loop_def"),
+ the other def is either defined in the loop ("vect_internal_def"),
or it's an induction (defined by a loop-header phi-node). */
if (def2 == phi
@@ -1453,7 +1683,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi)
&& (is_gimple_assign (def1)
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1)) == vect_induction_def
|| (gimple_code (def1) == GIMPLE_PHI
- && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1)) == vect_loop_def
+ && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1)) == vect_internal_def
&& !is_loop_header_bb_p (gimple_bb (def1)))))
{
if (vect_print_dump_info (REPORT_DETAILS))
@@ -1465,7 +1695,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi)
&& (is_gimple_assign (def2)
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2)) == vect_induction_def
|| (gimple_code (def2) == GIMPLE_PHI
- && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2)) == vect_loop_def
+ && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2)) == vect_internal_def
&& !is_loop_header_bb_p (gimple_bb (def2)))))
{
/* Swap operands (just for simplicity - so that the rest of the code
@@ -1993,6 +2223,7 @@ get_initial_def_for_induction (gimple iv_phi)
tree loop_arg;
gimple_stmt_iterator si;
basic_block bb = gimple_bb (iv_phi);
+ tree stepvectype;
vectype = get_vectype_for_scalar_type (scalar_type);
gcc_assert (vectype);
@@ -2005,8 +2236,10 @@ get_initial_def_for_induction (gimple iv_phi)
/* Find the first insertion point in the BB. */
si = gsi_after_labels (bb);
- if (INTEGRAL_TYPE_P (scalar_type) || POINTER_TYPE_P (scalar_type))
+ if (INTEGRAL_TYPE_P (scalar_type))
step_expr = build_int_cst (scalar_type, 0);
+ else if (POINTER_TYPE_P (scalar_type))
+ step_expr = build_int_cst (sizetype, 0);
else
step_expr = build_real (scalar_type, dconst0);
@@ -2090,16 +2323,19 @@ get_initial_def_for_induction (gimple iv_phi)
{
/* iv_loop is the loop to be vectorized. Generate:
vec_step = [VF*S, VF*S, VF*S, VF*S] */
- expr = build_int_cst (scalar_type, vf);
- new_name = fold_build2 (MULT_EXPR, scalar_type, expr, step_expr);
+ expr = build_int_cst (TREE_TYPE (step_expr), vf);
+ new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
+ expr, step_expr);
}
t = NULL_TREE;
for (i = 0; i < nunits; i++)
t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
gcc_assert (CONSTANT_CLASS_P (new_name));
- vec = build_vector (vectype, t);
- vec_step = vect_init_vector (iv_phi, vec, vectype, NULL);
+ stepvectype = get_vectype_for_scalar_type (TREE_TYPE (new_name));
+ gcc_assert (stepvectype);
+ vec = build_vector (stepvectype, t);
+ vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL);
/* Create the following def-use cycle:
@@ -2147,14 +2383,15 @@ get_initial_def_for_induction (gimple iv_phi)
gcc_assert (!nested_in_vect_loop);
/* Create the vector that holds the step of the induction. */
- expr = build_int_cst (scalar_type, nunits);
- new_name = fold_build2 (MULT_EXPR, scalar_type, expr, step_expr);
+ expr = build_int_cst (TREE_TYPE (step_expr), nunits);
+ new_name = fold_build2 (MULT_EXPR, TREE_TYPE (step_expr),
+ expr, step_expr);
t = NULL_TREE;
for (i = 0; i < nunits; i++)
t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
gcc_assert (CONSTANT_CLASS_P (new_name));
- vec = build_vector (vectype, t);
- vec_step = vect_init_vector (iv_phi, vec, vectype, NULL);
+ vec = build_vector (stepvectype, t);
+ vec_step = vect_init_vector (iv_phi, vec, stepvectype, NULL);
vec_def = induc_def;
prev_stmt_vinfo = vinfo_for_stmt (induction_phi);
@@ -2584,7 +2821,7 @@ vect_create_epilog_for_reduction (tree vect_def, gimple stmt,
}
else
{
- enum tree_code shift_code = 0;
+ enum tree_code shift_code = ERROR_MARK;
bool have_whole_vector_shift = true;
int bit_offset;
int element_bitsize = tree_low_cst (bitsize, 1);
@@ -2895,7 +3132,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
/* Reductions that are not used even in an enclosing outer-loop,
are expected to be "live" (used out of the loop). */
- if (STMT_VINFO_RELEVANT (stmt_info) == vect_unused_in_loop
+ if (STMT_VINFO_RELEVANT (stmt_info) == vect_unused_in_scope
&& !STMT_VINFO_LIVE_P (stmt_info))
return false;
@@ -2970,14 +3207,15 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
is_simple_use = vect_is_simple_use (ops[i], loop_vinfo, &def_stmt,
&def, &dt);
gcc_assert (is_simple_use);
- if (dt != vect_loop_def
- && dt != vect_invariant_def
+ if (dt != vect_internal_def
+ && dt != vect_external_def
&& dt != vect_constant_def
&& dt != vect_induction_def)
return false;
}
- is_simple_use = vect_is_simple_use (ops[i], loop_vinfo, &def_stmt, &def, &dt);
+ is_simple_use = vect_is_simple_use (ops[i], loop_vinfo, &def_stmt, &def,
+ &dt);
gcc_assert (is_simple_use);
gcc_assert (dt == vect_reduction_def);
gcc_assert (gimple_code (def_stmt) == GIMPLE_PHI);
@@ -3140,7 +3378,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
from the vectorized reduction operation generated in the previous iteration.
*/
- if (STMT_VINFO_RELEVANT (stmt_info) == vect_unused_in_loop)
+ if (STMT_VINFO_RELEVANT (stmt_info) == vect_unused_in_scope)
{
single_defuse_cycle = true;
epilog_copies = 1;
@@ -3361,7 +3599,7 @@ vectorizable_live_operation (gimple stmt,
return false;
}
- if (dt != vect_invariant_def && dt != vect_constant_def)
+ if (dt != vect_external_def && dt != vect_constant_def)
return false;
}
@@ -3577,8 +3815,8 @@ vect_transform_loop (loop_vec_info loop_vinfo)
until all the loops have been transformed? */
update_ssa (TODO_update_ssa);
- if (vect_print_dump_info (REPORT_VECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS))
fprintf (vect_dump, "LOOP VECTORIZED.");
- if (loop->inner && vect_print_dump_info (REPORT_VECTORIZED_LOOPS))
+ if (loop->inner && vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS))
fprintf (vect_dump, "OUTER LOOP VECTORIZED.");
}
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index e9dd0a9263e..febbd643680 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -81,8 +81,8 @@ widened_name_p (tree name, gimple use_stmt, tree *half_type, gimple *def_stmt)
if (!vect_is_simple_use (name, loop_vinfo, def_stmt, &def, &dt))
return false;
- if (dt != vect_loop_def
- && dt != vect_invariant_def && dt != vect_constant_def)
+ if (dt != vect_internal_def
+ && dt != vect_external_def && dt != vect_constant_def)
return false;
if (! *def_stmt)
@@ -259,7 +259,7 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
return NULL;
stmt_vinfo = vinfo_for_stmt (stmt);
gcc_assert (stmt_vinfo);
- if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_internal_def)
return NULL;
if (gimple_assign_rhs_code (stmt) != MULT_EXPR)
return NULL;
@@ -272,7 +272,7 @@ vect_recog_dot_prod_pattern (gimple last_stmt, tree *type_in, tree *type_out)
return NULL;
stmt_vinfo = vinfo_for_stmt (stmt);
gcc_assert (stmt_vinfo);
- gcc_assert (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_loop_def);
+ gcc_assert (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_internal_def);
oprnd00 = gimple_assign_rhs1 (stmt);
oprnd01 = gimple_assign_rhs2 (stmt);
}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 058438dc5e9..eb1ca62a3a3 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -239,10 +239,10 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
switch (dt[i])
{
case vect_constant_def:
- case vect_invariant_def:
+ case vect_external_def:
break;
- case vect_loop_def:
+ case vect_internal_def:
if (i == 0)
VEC_safe_push (gimple, heap, *def_stmts0, def_stmt);
else
@@ -283,8 +283,9 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
unsigned int i;
VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (*node);
gimple stmt = VEC_index (gimple, stmts, 0);
- enum vect_def_type first_stmt_dt0 = 0, first_stmt_dt1 = 0;
- enum tree_code first_stmt_code = 0, rhs_code;
+ enum vect_def_type first_stmt_dt0 = vect_uninitialized_def;
+ enum vect_def_type first_stmt_dt1 = vect_uninitialized_def;
+ enum tree_code first_stmt_code = ERROR_MARK, rhs_code;
tree first_stmt_def1_type = NULL_TREE, first_stmt_def0_type = NULL_TREE;
tree lhs;
bool stop_recursion = false, need_same_oprnds = false;
@@ -580,7 +581,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
}
/* Create SLP_TREE nodes for the definition node/s. */
- if (first_stmt_dt0 == vect_loop_def)
+ if (first_stmt_dt0 == vect_internal_def)
{
slp_tree left_node = XNEW (struct _slp_tree);
SLP_TREE_SCALAR_STMTS (left_node) = def_stmts0;
@@ -597,7 +598,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, slp_tree *node,
SLP_TREE_LEFT (*node) = left_node;
}
- if (first_stmt_dt1 == vect_loop_def)
+ if (first_stmt_dt1 == vect_internal_def)
{
slp_tree right_node = XNEW (struct _slp_tree);
SLP_TREE_SCALAR_STMTS (right_node) = def_stmts1;
@@ -951,7 +952,7 @@ vect_analyze_slp (loop_vec_info loop_vinfo)
if (!vect_analyze_slp_instance (loop_vinfo, store))
{
/* SLP failed. No instance can be SLPed in the loop. */
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "SLP failed.");
return false;
@@ -1693,8 +1694,8 @@ vect_schedule_slp (loop_vec_info loop_vinfo)
is_store = vect_schedule_slp_instance (SLP_INSTANCE_TREE (instance),
instance, LOOP_VINFO_VECT_FACTOR (loop_vinfo));
- if (vect_print_dump_info (REPORT_VECTORIZED_LOOPS)
- || vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS)
+ || vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "vectorizing stmts using SLP.");
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index ec4ba060df0..06d51e2d318 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -116,13 +116,14 @@ vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo,
use_operand_p use_p;
def_operand_p def_p;
- *relevant = vect_unused_in_loop;
+ *relevant = vect_unused_in_scope;
*live_p = false;
/* cond stmt other than loop exit cond. */
if (is_ctrl_stmt (stmt)
- && STMT_VINFO_TYPE (vinfo_for_stmt (stmt)) != loop_exit_ctrl_vec_info_type)
- *relevant = vect_used_in_loop;
+ && STMT_VINFO_TYPE (vinfo_for_stmt (stmt))
+ != loop_exit_ctrl_vec_info_type)
+ *relevant = vect_used_in_scope;
/* changing memory. */
if (gimple_code (stmt) != GIMPLE_PHI)
@@ -130,7 +131,7 @@ vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo,
{
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "vec_stmt_relevant_p: stmt has vdefs.");
- *relevant = vect_used_in_loop;
+ *relevant = vect_used_in_scope;
}
/* uses outside the loop. */
@@ -249,7 +250,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
if (!vect_is_simple_use (use, loop_vinfo, &def_stmt, &def, &dt))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
fprintf (vect_dump, "not vectorized: unsupported use in stmt.");
return false;
}
@@ -284,7 +285,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
dstmt_vinfo = vinfo_for_stmt (STMT_VINFO_RELATED_STMT (dstmt_vinfo));
gcc_assert (STMT_VINFO_RELEVANT (dstmt_vinfo) < vect_used_by_reduction);
gcc_assert (STMT_VINFO_LIVE_P (dstmt_vinfo)
- || STMT_VINFO_RELEVANT (dstmt_vinfo) > vect_unused_in_loop);
+ || STMT_VINFO_RELEVANT (dstmt_vinfo) > vect_unused_in_scope);
return true;
}
@@ -301,18 +302,18 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
fprintf (vect_dump, "outer-loop def-stmt defining inner-loop stmt.");
switch (relevant)
{
- case vect_unused_in_loop:
+ case vect_unused_in_scope:
relevant = (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def) ?
- vect_used_by_reduction : vect_unused_in_loop;
+ vect_used_by_reduction : vect_unused_in_scope;
break;
case vect_used_in_outer_by_reduction:
relevant = vect_used_by_reduction;
break;
case vect_used_in_outer:
- relevant = vect_used_in_loop;
+ relevant = vect_used_in_scope;
break;
case vect_used_by_reduction:
- case vect_used_in_loop:
+ case vect_used_in_scope:
break;
default:
@@ -333,9 +334,9 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
fprintf (vect_dump, "inner-loop def-stmt defining outer-loop stmt.");
switch (relevant)
{
- case vect_unused_in_loop:
+ case vect_unused_in_scope:
relevant = (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def) ?
- vect_used_in_outer_by_reduction : vect_unused_in_loop;
+ vect_used_in_outer_by_reduction : vect_unused_in_scope;
break;
case vect_used_in_outer_by_reduction:
@@ -346,7 +347,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
relevant = vect_used_in_outer_by_reduction;
break;
- case vect_used_in_loop:
+ case vect_used_in_scope:
relevant = vect_used_in_outer;
break;
@@ -468,18 +469,18 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
Here are the expected values of "relevant" for reduction phis/stmts:
relevance: phi stmt
- vect_unused_in_loop ok
+ vect_unused_in_scope ok
vect_used_in_outer_by_reduction ok ok
vect_used_in_outer ok ok
vect_used_by_reduction ok
- vect_used_in_loop */
+ vect_used_in_scope */
if (STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)
{
enum vect_relevant tmp_relevant = relevant;
switch (tmp_relevant)
{
- case vect_unused_in_loop:
+ case vect_unused_in_scope:
gcc_assert (gimple_code (stmt) != GIMPLE_PHI);
relevant = vect_used_by_reduction;
break;
@@ -496,7 +497,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
if (gimple_code (stmt) == GIMPLE_PHI)
break;
/* fall through */
- case vect_used_in_loop:
+ case vect_used_in_scope:
default:
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "unsupported use of reduction.");
@@ -571,7 +572,7 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies,
/* FORNOW: Assuming maximum 2 args per stmts. */
for (i = 0; i < 2; i++)
{
- if (dt[i] == vect_constant_def || dt[i] == vect_invariant_def)
+ if (dt[i] == vect_constant_def || dt[i] == vect_external_def)
outside_cost += TARG_SCALAR_TO_VEC_COST;
}
@@ -619,7 +620,7 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
if (PURE_SLP_STMT (stmt_info))
return;
- if (dt == vect_constant_def || dt == vect_invariant_def)
+ if (dt == vect_constant_def || dt == vect_external_def)
outside_cost = TARG_SCALAR_TO_VEC_COST;
/* Strided access? */
@@ -889,6 +890,9 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
/* Case 1: operand is a constant. */
case vect_constant_def:
{
+ vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
+ gcc_assert (vector_type);
+
if (scalar_def)
*scalar_def = op;
@@ -900,12 +904,12 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
{
t = tree_cons (NULL_TREE, op, t);
}
- vec_cst = build_vector (vectype, t);
- return vect_init_vector (stmt, vec_cst, vectype, NULL);
+ vec_cst = build_vector (vector_type, t);
+ return vect_init_vector (stmt, vec_cst, vector_type, NULL);
}
/* Case 2: operand is defined outside the loop - loop invariant. */
- case vect_invariant_def:
+ case vect_external_def:
{
vector_type = get_vectype_for_scalar_type (TREE_TYPE (def));
gcc_assert (vector_type);
@@ -929,7 +933,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
}
/* Case 3: operand is defined inside the loop. */
- case vect_loop_def:
+ case vect_internal_def:
{
if (scalar_def)
*scalar_def = NULL/* FIXME tuples: def_stmt*/;
@@ -1042,7 +1046,7 @@ vect_get_vec_def_for_stmt_copy (enum vect_def_type dt, tree vec_oprnd)
stmt_vec_info def_stmt_info;
/* Do nothing; can reuse same def. */
- if (dt == vect_invariant_def || dt == vect_constant_def )
+ if (dt == vect_external_def || dt == vect_constant_def )
return vec_oprnd;
vec_stmt_for_operand = SSA_NAME_DEF_STMT (vec_oprnd);
@@ -1190,7 +1194,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt)
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* FORNOW: SLP not supported. */
@@ -1508,7 +1512,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
if (!is_gimple_assign (stmt))
@@ -1771,7 +1775,7 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* Is vectorizable assignment? */
@@ -1885,7 +1889,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* Is STMT a vectorizable binary/unary operation? */
@@ -1947,7 +1951,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
shift_p = true;
/* vector shifted by vector */
- if (dt[1] == vect_loop_def)
+ if (dt[1] == vect_internal_def)
{
optab = optab_for_tree_code (code, vectype, optab_vector);
if (vect_print_dump_info (REPORT_DETAILS))
@@ -1956,7 +1960,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
/* See if the machine has a vector shifted by scalar insn and if not
then see if it has a vector shifted by vector insn */
- else if (dt[1] == vect_constant_def || dt[1] == vect_invariant_def)
+ else if (dt[1] == vect_constant_def || dt[1] == vect_external_def)
{
optab = optab_for_tree_code (code, vectype, optab_scalar);
if (optab
@@ -1970,11 +1974,20 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
else
{
optab = optab_for_tree_code (code, vectype, optab_vector);
- if (vect_print_dump_info (REPORT_DETAILS)
- && optab
+ if (optab
&& (optab_handler (optab, TYPE_MODE (vectype))->insn_code
!= CODE_FOR_nothing))
- fprintf (vect_dump, "vector/vector shift/rotate found.");
+ {
+ if (vect_print_dump_info (REPORT_DETAILS))
+ fprintf (vect_dump, "vector/vector shift/rotate found.");
+
+ /* Unlike the other binary operators, shifts/rotates have
+ the rhs being int, instead of the same type as the lhs,
+ so make sure the scalar is the right type if we are
+ dealing with vectors of short/char. */
+ if (dt[1] == vect_constant_def)
+ op1 = fold_convert (TREE_TYPE (vectype), op1);
+ }
}
}
@@ -2323,7 +2336,7 @@ vectorizable_type_demotion (gimple stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* Is STMT a vectorizable type-demotion operation? */
@@ -2590,7 +2603,7 @@ vectorizable_type_promotion (gimple stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* Is STMT a vectorizable type-promotion operation? */
@@ -2836,7 +2849,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* Is vectorizable store? */
@@ -3204,7 +3217,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* Is vectorizable load? */
@@ -3703,7 +3716,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
if (!STMT_VINFO_RELEVANT_P (stmt_info))
return false;
- if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_loop_def)
+ if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_internal_def)
return false;
/* FORNOW: SLP not supported. */
@@ -3803,336 +3816,125 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
}
-/* Function vect_analyze_operations.
-
- Scan the loop stmts and make sure they are all vectorizable. */
+/* Make sure the statement is vectorizable. */
bool
-vect_analyze_operations (loop_vec_info loop_vinfo)
+vect_analyze_stmt (gimple stmt, bool *need_to_vectorize)
{
- struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
- basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
- int nbbs = loop->num_nodes;
- gimple_stmt_iterator si;
- unsigned int vectorization_factor = 0;
- int i;
+ stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
+ enum vect_relevant relevance = STMT_VINFO_RELEVANT (stmt_info);
bool ok;
- gimple phi;
- stmt_vec_info stmt_info;
- bool need_to_vectorize = false;
- int min_profitable_iters;
- int min_scalar_loop_bound;
- unsigned int th;
- bool only_slp_in_loop = true;
if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "=== vect_analyze_operations ===");
-
- gcc_assert (LOOP_VINFO_VECT_FACTOR (loop_vinfo));
- vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
-
- for (i = 0; i < nbbs; i++)
{
- basic_block bb = bbs[i];
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
- {
- phi = gsi_stmt (si);
- ok = true;
-
- stmt_info = vinfo_for_stmt (phi);
- if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "examining phi: ");
- print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
- }
-
- if (! is_loop_header_bb_p (bb))
- {
- /* inner-loop loop-closed exit phi in outer-loop vectorization
- (i.e. a phi in the tail of the outer-loop).
- FORNOW: we currently don't support the case that these phis
- are not used in the outerloop, cause this case requires
- to actually do something here. */
- if (!STMT_VINFO_RELEVANT_P (stmt_info)
- || STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump,
- "Unsupported loop-closed phi in outer-loop.");
- return false;
- }
- continue;
- }
-
- gcc_assert (stmt_info);
-
- if (STMT_VINFO_LIVE_P (stmt_info))
- {
- /* FORNOW: not yet supported. */
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump, "not vectorized: value used after loop.");
- return false;
- }
-
- if (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_loop
- && STMT_VINFO_DEF_TYPE (stmt_info) != vect_induction_def)
- {
- /* A scalar-dependence cycle that we don't support. */
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump, "not vectorized: scalar dependence cycle.");
- return false;
- }
-
- if (STMT_VINFO_RELEVANT_P (stmt_info))
- {
- need_to_vectorize = true;
- if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def)
- ok = vectorizable_induction (phi, NULL, NULL);
- }
-
- if (!ok)
- {
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- {
- fprintf (vect_dump,
- "not vectorized: relevant phi not supported: ");
- print_gimple_stmt (vect_dump, phi, 0, TDF_SLIM);
- }
- return false;
- }
- }
-
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
- {
- gimple stmt = gsi_stmt (si);
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
- enum vect_relevant relevance = STMT_VINFO_RELEVANT (stmt_info);
-
- if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "==> examining statement: ");
- print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
- }
-
- gcc_assert (stmt_info);
-
- /* skip stmts which do not need to be vectorized.
- this is expected to include:
- - the COND_EXPR which is the loop exit condition
- - any LABEL_EXPRs in the loop
- - computations that are used only for array indexing or loop
- control */
-
- if (!STMT_VINFO_RELEVANT_P (stmt_info)
- && !STMT_VINFO_LIVE_P (stmt_info))
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "irrelevant.");
- continue;
- }
-
- switch (STMT_VINFO_DEF_TYPE (stmt_info))
- {
- case vect_loop_def:
- break;
-
- case vect_reduction_def:
- gcc_assert (relevance == vect_used_in_outer
- || relevance == vect_used_in_outer_by_reduction
- || relevance == vect_unused_in_loop);
- break;
-
- case vect_induction_def:
- case vect_constant_def:
- case vect_invariant_def:
- case vect_unknown_def_type:
- default:
- gcc_unreachable ();
- }
-
- if (STMT_VINFO_RELEVANT_P (stmt_info))
- {
- gcc_assert (!VECTOR_MODE_P (TYPE_MODE (gimple_expr_type (stmt))));
- gcc_assert (STMT_VINFO_VECTYPE (stmt_info));
- need_to_vectorize = true;
- }
-
- ok = true;
- if (STMT_VINFO_RELEVANT_P (stmt_info)
- || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
- ok = (vectorizable_type_promotion (stmt, NULL, NULL, NULL)
- || vectorizable_type_demotion (stmt, NULL, NULL, NULL)
- || vectorizable_conversion (stmt, NULL, NULL, NULL)
- || vectorizable_operation (stmt, NULL, NULL, NULL)
- || vectorizable_assignment (stmt, NULL, NULL, NULL)
- || vectorizable_load (stmt, NULL, NULL, NULL, NULL)
- || vectorizable_call (stmt, NULL, NULL)
- || vectorizable_store (stmt, NULL, NULL, NULL)
- || vectorizable_condition (stmt, NULL, NULL)
- || vectorizable_reduction (stmt, NULL, NULL));
-
- if (!ok)
- {
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- {
- fprintf (vect_dump, "not vectorized: relevant stmt not ");
- fprintf (vect_dump, "supported: ");
- print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
- }
- return false;
- }
+ fprintf (vect_dump, "==> examining statement: ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
- /* Stmts that are (also) "live" (i.e. - that are used out of the loop)
- need extra handling, except for vectorizable reductions. */
- if (STMT_VINFO_LIVE_P (stmt_info)
- && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type)
- ok = vectorizable_live_operation (stmt, NULL, NULL);
+ /* Skip stmts that do not need to be vectorized. In loops this is expected
+ to include:
+ - the COND_EXPR which is the loop exit condition
+ - any LABEL_EXPRs in the loop
+ - computations that are used only for array indexing or loop control.
+ In basic blocks we only analyze statements that are a part of some SLP
+ instance, therefore, all the statements are relevant. */
- if (!ok)
- {
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- {
- fprintf (vect_dump, "not vectorized: live stmt not ");
- fprintf (vect_dump, "supported: ");
- print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
- }
- return false;
- }
-
- if (!PURE_SLP_STMT (stmt_info))
- {
- /* STMT needs loop-based vectorization. */
- only_slp_in_loop = false;
-
- /* Groups of strided accesses whose size is not a power of 2 are
- not vectorizable yet using loop-vectorization. Therefore, if
- this stmt feeds non-SLP-able stmts (i.e., this stmt has to be
- both SLPed and loop-based vectorized), the loop cannot be
- vectorized. */
- if (STMT_VINFO_STRIDED_ACCESS (stmt_info)
- && exact_log2 (DR_GROUP_SIZE (vinfo_for_stmt (
- DR_GROUP_FIRST_DR (stmt_info)))) == -1)
- {
- if (vect_print_dump_info (REPORT_DETAILS))
- {
- fprintf (vect_dump, "not vectorized: the size of group "
- "of strided accesses is not a power of 2");
- print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
- }
- return false;
- }
- }
- } /* stmts in bb */
- } /* bbs */
-
- /* All operations in the loop are either irrelevant (deal with loop
- control, or dead), or only used outside the loop and can be moved
- out of the loop (e.g. invariants, inductions). The loop can be
- optimized away by scalar optimizations. We're better off not
- touching this loop. */
- if (!need_to_vectorize)
+ if (!STMT_VINFO_RELEVANT_P (stmt_info)
+ && !STMT_VINFO_LIVE_P (stmt_info))
{
if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump,
- "All the computation can be taken out of the loop.");
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump,
- "not vectorized: redundant loop. no profit to vectorize.");
- return false;
- }
+ fprintf (vect_dump, "irrelevant.");
- /* If all the stmts in the loop can be SLPed, we perform only SLP, and
- vectorization factor of the loop is the unrolling factor required by the
- SLP instances. If that unrolling factor is 1, we say, that we perform
- pure SLP on loop - cross iteration parallelism is not exploited. */
- if (only_slp_in_loop)
- vectorization_factor = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo);
- else
- vectorization_factor = least_common_multiple (vectorization_factor,
- LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo));
+ return true;
+ }
- LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
+ switch (STMT_VINFO_DEF_TYPE (stmt_info))
+ {
+ case vect_internal_def:
+ break;
- if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump,
- "vectorization_factor = %d, niters = " HOST_WIDE_INT_PRINT_DEC,
- vectorization_factor, LOOP_VINFO_INT_NITERS (loop_vinfo));
+ case vect_reduction_def:
+ gcc_assert (relevance == vect_used_in_outer
+ || relevance == vect_used_in_outer_by_reduction
+ || relevance == vect_unused_in_scope);
+ break;
+
+ case vect_induction_def:
+ case vect_constant_def:
+ case vect_external_def:
+ case vect_unknown_def_type:
+ default:
+ gcc_unreachable ();
+ }
- if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && (LOOP_VINFO_INT_NITERS (loop_vinfo) < vectorization_factor))
+ if (STMT_VINFO_RELEVANT_P (stmt_info))
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump, "not vectorized: iteration count too small.");
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump,"not vectorized: iteration count smaller than "
- "vectorization factor.");
- return false;
+ gcc_assert (!VECTOR_MODE_P (TYPE_MODE (gimple_expr_type (stmt))));
+ gcc_assert (STMT_VINFO_VECTYPE (stmt_info));
+ *need_to_vectorize = true;
}
- /* Analyze cost. Decide if worth while to vectorize. */
-
- /* Once VF is set, SLP costs should be updated since the number of created
- vector stmts depends on VF. */
- vect_update_slp_costs_according_to_vf (loop_vinfo);
-
- min_profitable_iters = vect_estimate_min_profitable_iters (loop_vinfo);
- LOOP_VINFO_COST_MODEL_MIN_ITERS (loop_vinfo) = min_profitable_iters;
-
- if (min_profitable_iters < 0)
+ ok = true;
+ if (STMT_VINFO_RELEVANT_P (stmt_info)
+ || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
+ ok = (vectorizable_type_promotion (stmt, NULL, NULL, NULL)
+ || vectorizable_type_demotion (stmt, NULL, NULL, NULL)
+ || vectorizable_conversion (stmt, NULL, NULL, NULL)
+ || vectorizable_operation (stmt, NULL, NULL, NULL)
+ || vectorizable_assignment (stmt, NULL, NULL, NULL)
+ || vectorizable_load (stmt, NULL, NULL, NULL, NULL)
+ || vectorizable_call (stmt, NULL, NULL)
+ || vectorizable_store (stmt, NULL, NULL, NULL)
+ || vectorizable_condition (stmt, NULL, NULL)
+ || vectorizable_reduction (stmt, NULL, NULL));
+
+ if (!ok)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump, "not vectorized: vectorization not profitable.");
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "not vectorized: vector version will never be "
- "profitable.");
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump, "not vectorized: relevant stmt not ");
+ fprintf (vect_dump, "supported: ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+
return false;
}
- min_scalar_loop_bound = ((PARAM_VALUE (PARAM_MIN_VECT_LOOP_BOUND)
- * vectorization_factor) - 1);
-
- /* Use the cost model only if it is more conservative than user specified
- threshold. */
-
- th = (unsigned) min_scalar_loop_bound;
- if (min_profitable_iters
- && (!min_scalar_loop_bound
- || min_profitable_iters > min_scalar_loop_bound))
- th = (unsigned) min_profitable_iters;
+ /* Stmts that are (also) "live" (i.e. - that are used out of the loop)
+ need extra handling, except for vectorizable reductions. */
+ if (STMT_VINFO_LIVE_P (stmt_info)
+ && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type)
+ ok = vectorizable_live_operation (stmt, NULL, NULL);
- if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && LOOP_VINFO_INT_NITERS (loop_vinfo) <= th)
+ if (!ok)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump, "not vectorized: vectorization not "
- "profitable.");
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "not vectorized: iteration count smaller than "
- "user specified loop bound parameter or minimum "
- "profitable iterations (whichever is more conservative).");
- return false;
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump, "not vectorized: live stmt not ");
+ fprintf (vect_dump, "supported: ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+
+ return false;
}
- if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- || LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0
- || LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
+ if (!PURE_SLP_STMT (stmt_info))
{
- if (vect_print_dump_info (REPORT_DETAILS))
- fprintf (vect_dump, "epilog loop required.");
- if (!vect_can_advance_ivs_p (loop_vinfo))
+ /* Groups of strided accesses whose size is not a power of 2 are not
+ vectorizable yet using loop-vectorization. Therefore, if this stmt
+ feeds non-SLP-able stmts (i.e., this stmt has to be both SLPed and
+ loop-based vectorized), the loop cannot be vectorized. */
+ if (STMT_VINFO_STRIDED_ACCESS (stmt_info)
+ && exact_log2 (DR_GROUP_SIZE (vinfo_for_stmt (
+ DR_GROUP_FIRST_DR (stmt_info)))) == -1)
{
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump,
- "not vectorized: can't create epilog loop 1.");
- return false;
- }
- if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
- {
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS))
- fprintf (vect_dump,
- "not vectorized: can't create epilog loop 2.");
+ if (vect_print_dump_info (REPORT_DETAILS))
+ {
+ fprintf (vect_dump, "not vectorized: the size of group "
+ "of strided accesses is not a power of 2");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+
return false;
}
}
@@ -4343,7 +4145,7 @@ new_stmt_vec_info (gimple stmt, loop_vec_info loop_vinfo)
STMT_VINFO_TYPE (res) = undef_vec_info_type;
STMT_VINFO_STMT (res) = stmt;
STMT_VINFO_LOOP_VINFO (res) = loop_vinfo;
- STMT_VINFO_RELEVANT (res) = vect_unused_in_loop;
+ STMT_VINFO_RELEVANT (res) = vect_unused_in_scope;
STMT_VINFO_LIVE_P (res) = false;
STMT_VINFO_VECTYPE (res) = NULL;
STMT_VINFO_VEC_STMT (res) = NULL;
@@ -4361,7 +4163,8 @@ new_stmt_vec_info (gimple stmt, loop_vec_info loop_vinfo)
&& is_loop_header_bb_p (gimple_bb (stmt)))
STMT_VINFO_DEF_TYPE (res) = vect_unknown_def_type;
else
- STMT_VINFO_DEF_TYPE (res) = vect_loop_def;
+ STMT_VINFO_DEF_TYPE (res) = vect_internal_def;
+
STMT_VINFO_SAME_ALIGN_REFS (res) = VEC_alloc (dr_p, heap, 5);
STMT_VINFO_INSIDE_OF_LOOP_COST (res) = 0;
STMT_VINFO_OUTSIDE_OF_LOOP_COST (res) = 0;
@@ -4499,7 +4302,7 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, gimple *def_stmt,
if (is_gimple_min_invariant (operand))
{
*def = operand;
- *dt = vect_invariant_def;
+ *dt = vect_external_def;
return true;
}
@@ -4530,18 +4333,18 @@ vect_is_simple_use (tree operand, loop_vec_info loop_vinfo, gimple *def_stmt,
print_gimple_stmt (vect_dump, *def_stmt, 0, TDF_SLIM);
}
- /* empty stmt is expected only in case of a function argument.
+ /* Empty stmt is expected only in case of a function argument.
(Otherwise - we expect a phi_node or a GIMPLE_ASSIGN). */
if (gimple_nop_p (*def_stmt))
{
*def = operand;
- *dt = vect_invariant_def;
+ *dt = vect_external_def;
return true;
}
bb = gimple_bb (*def_stmt);
if (!flow_bb_inside_loop_p (loop, bb))
- *dt = vect_invariant_def;
+ *dt = vect_external_def;
else
{
stmt_vinfo = vinfo_for_stmt (*def_stmt);
@@ -4618,7 +4421,7 @@ supportable_widening_operation (enum tree_code code, gimple stmt, tree vectype,
struct loop *vect_loop = LOOP_VINFO_LOOP (loop_info);
bool ordered_p;
enum machine_mode vec_mode;
- enum insn_code icode1 = 0, icode2 = 0;
+ enum insn_code icode1, icode2;
optab optab1, optab2;
tree type = gimple_expr_type (stmt);
tree wide_vectype = get_vectype_for_scalar_type (type);
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 7f2768e1633..b4985475d78 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -74,10 +74,10 @@ FILE *vect_dump;
/* vect_verbosity_level set to an invalid value
to mark that it's uninitialized. */
-enum verbosity_levels vect_verbosity_level = MAX_VERBOSITY_LEVEL;
+static enum verbosity_levels vect_verbosity_level = MAX_VERBOSITY_LEVEL;
/* Loop location. */
-LOC vect_loop_location;
+LOC vect_location;
/* Bitmap of virtual variables to be renamed. */
bitmap vect_memsyms_to_rename;
@@ -89,7 +89,7 @@ VEC(vec_void_p,heap) *stmt_vec_info_vec;
/* Function vect_set_verbosity_level.
- Called from toplev.c upon detection of the
+ Called from opts.c upon detection of the
-ftree-vectorizer-verbose=N option. */
void
@@ -132,7 +132,7 @@ vect_set_dump_settings (void)
if (dump_file && (dump_flags & TDF_DETAILS))
vect_verbosity_level = REPORT_DETAILS;
else if (dump_file && (dump_flags & TDF_STATS))
- vect_verbosity_level = REPORT_UNVECTORIZED_LOOPS;
+ vect_verbosity_level = REPORT_UNVECTORIZED_LOCATIONS;
else
vect_verbosity_level = REPORT_NONE;
@@ -153,13 +153,13 @@ vect_print_dump_info (enum verbosity_levels vl)
if (!current_function_decl || !vect_dump)
return false;
- if (vect_loop_location == UNKNOWN_LOC)
+ if (vect_location == UNKNOWN_LOC)
fprintf (vect_dump, "\n%s:%d: note: ",
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl));
else
fprintf (vect_dump, "\n%s:%d: note: ",
- LOC_FILE (vect_loop_location), LOC_LINE (vect_loop_location));
+ LOC_FILE (vect_location), LOC_LINE (vect_location));
return true;
}
@@ -167,7 +167,7 @@ vect_print_dump_info (enum verbosity_levels vl)
/* Function vectorize_loops.
- Entry Point to loop vectorization phase. */
+ Entry point to loop vectorization phase. */
unsigned
vectorize_loops (void)
@@ -187,7 +187,7 @@ vectorize_loops (void)
/* Fix the verbosity level if not defined explicitly by the user. */
vect_set_dump_settings ();
- /* Allocate the bitmap that records which virtual variables that
+ /* Allocate the bitmap that records which virtual variables
need to be renamed. */
vect_memsyms_to_rename = BITMAP_ALLOC (NULL);
@@ -203,7 +203,7 @@ vectorize_loops (void)
{
loop_vec_info loop_vinfo;
- vect_loop_location = find_loop_location (loop);
+ vect_location = find_loop_location (loop);
loop_vinfo = vect_analyze_loop (loop);
loop->aux = loop_vinfo;
@@ -213,11 +213,12 @@ vectorize_loops (void)
vect_transform_loop (loop_vinfo);
num_vectorized_loops++;
}
- vect_loop_location = UNKNOWN_LOC;
+
+ vect_location = UNKNOWN_LOC;
statistics_counter_event (cfun, "Vectorized loops", num_vectorized_loops);
- if (vect_print_dump_info (REPORT_UNVECTORIZED_LOOPS)
- || (vect_print_dump_info (REPORT_VECTORIZED_LOOPS)
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)
+ || (vect_print_dump_info (REPORT_VECTORIZED_LOCATIONS)
&& num_vectorized_loops > 0))
fprintf (vect_dump, "vectorized %u loops in function.\n",
num_vectorized_loops);
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 1f3247d1a75..2422f4416e1 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -55,9 +55,10 @@ enum dr_alignment_support {
/* Define type of def-use cross-iteration cycle. */
enum vect_def_type {
+ vect_uninitialized_def = 0,
vect_constant_def = 1,
- vect_invariant_def,
- vect_loop_def,
+ vect_external_def,
+ vect_internal_def,
vect_induction_def,
vect_reduction_def,
vect_unknown_def_type
@@ -66,8 +67,8 @@ enum vect_def_type {
/* Define verbosity levels. */
enum verbosity_levels {
REPORT_NONE,
- REPORT_VECTORIZED_LOOPS,
- REPORT_UNVECTORIZED_LOOPS,
+ REPORT_VECTORIZED_LOCATIONS,
+ REPORT_UNVECTORIZED_LOCATIONS,
REPORT_COST,
REPORT_ALIGNMENT,
REPORT_DR_DETAILS,
@@ -299,9 +300,10 @@ enum stmt_vec_info_type {
loop_exit_ctrl_vec_info_type
};
-/* Indicates whether/how a variable is used in the loop. */
+/* Indicates whether/how a variable is used in the scope of loop/basic
+ block. */
enum vect_relevant {
- vect_unused_in_loop = 0,
+ vect_unused_in_scope = 0,
vect_used_in_outer_by_reduction,
vect_used_in_outer,
@@ -313,7 +315,7 @@ enum vect_relevant {
computed. */
vect_used_by_reduction,
- vect_used_in_loop
+ vect_used_in_scope
};
/* The type of vectorization that can be applied to the stmt: regular loop-based
@@ -474,7 +476,7 @@ typedef struct _stmt_vec_info {
#define DR_GROUP_SAME_DR_STMT(S) (S)->same_dr_stmt
#define DR_GROUP_READ_WRITE_DEPENDENCE(S) (S)->read_write_dep
-#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_loop)
+#define STMT_VINFO_RELEVANT_P(S) ((S)->relevant != vect_unused_in_scope)
#define STMT_VINFO_OUTSIDE_OF_LOOP_COST(S) (S)->cost.outside_of_loop
#define STMT_VINFO_INSIDE_OF_LOOP_COST(S) (S)->cost.inside_of_loop
@@ -692,12 +694,9 @@ known_alignment_for_access_p (struct data_reference *data_ref_info)
extern FILE *vect_dump;
extern LOC vect_loop_location;
-extern enum verbosity_levels vect_verbosity_level;
-
/* Bitmap of virtual variables to be renamed. */
extern bitmap vect_memsyms_to_rename;
-
/*-----------------------------------------------------------------*/
/* Function prototypes. */
/*-----------------------------------------------------------------*/
@@ -743,7 +742,7 @@ extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree);
extern bool vect_transform_stmt (gimple, gimple_stmt_iterator *,
bool *, slp_tree, slp_instance);
extern void vect_remove_stores (gimple);
-extern bool vect_analyze_operations (loop_vec_info);
+extern bool vect_analyze_stmt (gimple, bool *);
/* In tree-vect-data-refs.c. */
extern bool vect_can_force_dr_alignment_p (const_tree, unsigned int);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 8464ffddd89..09c634246ec 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -7277,6 +7277,7 @@ execute_vrp (void)
to_remove_edges = VEC_alloc (edge, heap, 10);
to_update_switch_stmts = VEC_alloc (switch_update, heap, 5);
+ threadedge_initialize_values ();
vrp_initialize ();
ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node);
@@ -7322,6 +7323,7 @@ execute_vrp (void)
VEC_free (edge, heap, to_remove_edges);
VEC_free (switch_update, heap, to_update_switch_stmts);
+ threadedge_finalize_values ();
scev_finalize ();
loop_optimizer_finalize ();
diff --git a/gcc/tree.c b/gcc/tree.c
index 57e1d3210a8..295358c527b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4063,8 +4063,8 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
}
else
{
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute ignored",
+ name);
*no_add_attrs = true;
return NULL_TREE;
}
@@ -4075,8 +4075,8 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
&& TREE_CODE (node) != TYPE_DECL)
{
*no_add_attrs = true;
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute ignored",
+ name);
return NULL_TREE;
}
@@ -4085,8 +4085,8 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
&& TREE_CODE (TREE_TYPE (node)) != UNION_TYPE)
{
*no_add_attrs = true;
- warning (OPT_Wattributes, "%qs attribute ignored",
- IDENTIFIER_POINTER (name));
+ warning (OPT_Wattributes, "%qE attribute ignored",
+ name);
return NULL_TREE;
}
@@ -4141,7 +4141,7 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
|| TREE_CODE (node) == FUNCTION_DECL))
{
error ("external linkage required for symbol %q+D because of "
- "%qs attribute", node, IDENTIFIER_POINTER (name));
+ "%qE attribute", node, name);
*no_add_attrs = true;
}
@@ -4154,9 +4154,9 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags,
{
if (DECL_VISIBILITY_SPECIFIED (node)
&& DECL_VISIBILITY (node) != VISIBILITY_DEFAULT)
- error ("%qs implies default visibility, but %qD has already "
+ error ("%qE implies default visibility, but %qD has already "
"been declared with a different visibility",
- IDENTIFIER_POINTER (name), node);
+ name, node);
DECL_VISIBILITY (node) = VISIBILITY_DEFAULT;
DECL_VISIBILITY_SPECIFIED (node) = 1;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index d6550b51c50..cb4b369cd63 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -362,8 +362,8 @@ struct GTY(()) tree_base {
unsigned protected_flag : 1;
unsigned deprecated_flag : 1;
unsigned saturating_flag : 1;
- unsigned default_def_flag : 1;
+ unsigned default_def_flag : 1;
unsigned lang_flag_0 : 1;
unsigned lang_flag_1 : 1;
unsigned lang_flag_2 : 1;
@@ -371,6 +371,7 @@ struct GTY(()) tree_base {
unsigned lang_flag_4 : 1;
unsigned lang_flag_5 : 1;
unsigned lang_flag_6 : 1;
+
unsigned visited : 1;
unsigned spare : 23;
@@ -475,9 +476,6 @@ struct GTY(()) tree_common {
CALL_EXPR_RETURN_SLOT_OPT in
CALL_EXPR
- DECL_BY_REFERENCE in
- PARM_DECL, RESULT_DECL, VAR_DECL (only !TREE_STATIC)
-
OMP_SECTION_LAST in
OMP_SECTION
@@ -1294,10 +1292,12 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
#define CALL_EXPR_RETURN_SLOT_OPT(NODE) \
(CALL_EXPR_CHECK (NODE)->base.private_flag)
-/* In a RESULT_DECL, PARM_DECL or VAR_DECL without TREE_STATIC, means that it is
+/* In a RESULT_DECL, PARM_DECL and VAR_DECL, means that it is
passed by invisible reference (and the TREE_TYPE is a pointer to the true
type). */
-#define DECL_BY_REFERENCE(NODE) (DECL_COMMON_CHECK (NODE)->base.private_flag)
+#define DECL_BY_REFERENCE(NODE) \
+ (TREE_CHECK3 (NODE, VAR_DECL, PARM_DECL, \
+ RESULT_DECL)->decl_common.decl_by_reference_flag)
/* In a CALL_EXPR, means that the call is the jump from a thunk to the
thunked-to function. */
@@ -1854,10 +1854,6 @@ struct GTY(()) tree_exp {
#define SSA_NAME_PTR_INFO(N) \
SSA_NAME_CHECK (N)->ssa_name.ptr_info
-/* Get the value of this SSA_NAME, if available. */
-#define SSA_NAME_VALUE(N) \
- SSA_NAME_CHECK (N)->ssa_name.value_handle
-
#ifndef _TREE_FLOW_H
struct ptr_info_def;
#endif
@@ -1896,13 +1892,6 @@ struct GTY(()) tree_ssa_name {
/* Pointer attributes used for alias analysis. */
struct ptr_info_def *ptr_info;
- /* Value for SSA name used by various passes.
-
- Right now only invariants are allowed to persist beyond a pass in
- this field; in the future we will allow VALUE_HANDLEs to persist
- as well. */
- tree value_handle;
-
/* Immediate uses list for this SSA_NAME. */
struct ssa_use_operand_d imm_uses;
};
@@ -2208,8 +2197,8 @@ extern enum machine_mode vector_type_mode (const_tree);
#define SET_TYPE_VECTOR_SUBPARTS(VECTOR_TYPE, X) \
(VECTOR_TYPE_CHECK (VECTOR_TYPE)->type.precision = exact_log2 (X))
-/* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose
- uses are to be substituted for uses of the TREE_CHAINed identifier. */
+/* Nonzero in a VECTOR_TYPE if the frontends should not emit warnings
+ about missing conversions to other vector types of the same size. */
#define TYPE_VECTOR_OPAQUE(NODE) \
(VECTOR_TYPE_CHECK (NODE)->base.deprecated_flag)
@@ -2662,8 +2651,10 @@ struct GTY(()) tree_decl_common {
unsigned gimple_reg_flag : 1;
/* In a DECL with pointer type, set if no TBAA should be done. */
unsigned no_tbaa_flag : 1;
+ /* In VAR_DECL, PARM_DECL and RESULT_DECL, this is DECL_BY_REFERENCE. */
+ unsigned decl_by_reference_flag : 1;
/* Padding so that 'off_align' can be on a 32-bit boundary. */
- unsigned decl_common_unused : 2;
+ unsigned decl_common_unused : 1;
/* DECL_OFFSET_ALIGN, used only for FIELD_DECLs. */
unsigned int off_align : 8;
@@ -4622,7 +4613,6 @@ extern unsigned crc32_string (unsigned, const char *);
extern void clean_symbol_name (char *);
extern tree get_file_function_name (const char *);
extern tree get_callee_fndecl (const_tree);
-extern void change_decl_assembler_name (tree, tree);
extern int type_num_arguments (const_tree);
extern bool associative_tree_code (enum tree_code);
extern bool commutative_tree_code (enum tree_code);
@@ -4637,6 +4627,10 @@ extern const char *get_name (tree);
extern bool stdarg_p (tree);
extern bool prototype_p (tree);
extern bool auto_var_in_fn_p (const_tree, const_tree);
+extern tree build_low_bits_mask (tree, unsigned);
+
+/* In cgraph.c */
+extern void change_decl_assembler_name (tree, tree);
/* In gimplify.c */
extern tree unshare_expr (tree);
@@ -4697,9 +4691,6 @@ extern void fold_defer_overflow_warnings (void);
extern void fold_undefer_overflow_warnings (bool, const_gimple, int);
extern void fold_undefer_and_ignore_overflow_warnings (void);
extern bool fold_deferring_overflow_warnings_p (void);
-extern tree maybe_fold_offset_to_reference (tree, tree, tree);
-extern tree maybe_fold_offset_to_address (tree, tree, tree);
-extern tree maybe_fold_stmt_addition (tree, tree, tree);
extern tree force_fit_type_double (tree, unsigned HOST_WIDE_INT, HOST_WIDE_INT,
int, bool);
@@ -4762,7 +4753,6 @@ extern tree build_fold_addr_expr_with_type (tree, tree);
extern tree build_fold_indirect_ref (tree);
extern tree fold_indirect_ref (tree);
extern tree constant_boolean_node (int, tree);
-extern tree build_low_bits_mask (tree, unsigned);
extern tree div_if_zero_remainder (enum tree_code, const_tree, const_tree);
extern bool tree_swap_operands_p (const_tree, const_tree, bool);
@@ -4789,6 +4779,7 @@ extern bool tree_expr_nonzero_warnv_p (tree, bool *);
extern bool fold_real_zero_addition_p (const_tree, const_tree, int);
extern tree combine_comparisons (enum tree_code, enum tree_code,
enum tree_code, tree, tree, tree);
+extern void debug_fold_checksum (const_tree);
/* Return nonzero if CODE is a tree code that represents a truth value. */
static inline bool
@@ -4816,10 +4807,8 @@ extern bool fold_builtin_next_arg (tree, bool);
extern enum built_in_function builtin_mathfn_code (const_tree);
extern tree build_function_call_expr (tree, tree);
extern tree fold_builtin_call_array (tree, tree, int, tree *);
-extern void debug_fold_checksum (const_tree);
extern tree build_call_expr (tree, int, ...);
extern tree mathfn_built_in (tree, enum built_in_function fn);
-extern tree strip_float_extensions (tree);
extern tree c_strlen (tree, int);
extern tree std_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
extern tree build_va_arg_indirect_ref (tree);
@@ -4827,7 +4816,7 @@ extern tree build_string_literal (int, const char *);
extern bool validate_arglist (const_tree, ...);
extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode);
extern int get_pointer_alignment (tree, unsigned int);
-extern bool is_builtin_name(const char*);
+extern bool is_builtin_name (const char*);
extern int get_object_alignment (tree, unsigned int, unsigned int);
extern tree fold_call_stmt (gimple, bool);
extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function);
@@ -4858,10 +4847,6 @@ extern tree type_hash_lookup (unsigned int, tree);
extern void type_hash_add (unsigned int, tree);
extern int simple_cst_list_equal (const_tree, const_tree);
extern void dump_tree_statistics (void);
-extern void expand_function_end (void);
-extern void expand_function_start (tree);
-extern void stack_protect_prologue (void);
-extern void stack_protect_epilogue (void);
extern void recompute_tree_invariant_for_addr_expr (tree);
extern bool needs_to_live_in_memory (const_tree);
extern tree reconstruct_complex_type (tree, tree);
@@ -4876,7 +4861,6 @@ extern void build_common_builtin_nodes (void);
extern tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT, int);
extern tree build_range_type (tree, tree, tree);
extern HOST_WIDE_INT int_cst_value (const_tree);
-extern tree build_addr (tree, tree);
extern bool fields_compatible_p (const_tree, const_tree);
extern tree find_compatible_field (tree, tree);
@@ -4887,8 +4871,17 @@ extern tree *tree_block (tree);
extern location_t *block_nonartificial_location (tree);
extern location_t tree_nonartificial_location (tree);
+extern tree block_ultimate_origin (const_tree);
+
+/* In tree-nested.c */
+extern tree build_addr (tree, tree);
+
/* In function.c */
extern void expand_main_function (void);
+extern void expand_function_end (void);
+extern void expand_function_start (tree);
+extern void stack_protect_prologue (void);
+extern void stack_protect_epilogue (void);
extern void init_dummy_function_start (void);
extern void expand_dummy_function_end (void);
extern unsigned int init_function_for_compilation (void);
@@ -4967,7 +4960,6 @@ extern bool gimple_alloca_call_p (const_gimple);
extern bool alloca_call_p (const_tree);
extern bool must_pass_in_stack_var_size (enum machine_mode, const_tree);
extern bool must_pass_in_stack_var_size_or_pad (enum machine_mode, const_tree);
-extern tree block_ultimate_origin (const_tree);
/* In attribs.c. */
@@ -5023,6 +5015,7 @@ extern tree tree_overlaps_hard_reg_set (tree, HARD_REG_SET *);
#endif
+/* In dwarf2out.c */
/* Interface of the DWARF2 unwind info support. */
/* Generate a new label for the CFI info to refer to. */
@@ -5082,6 +5075,7 @@ extern tree walk_tree_without_duplicates_1 (tree*, walk_tree_fn, void*,
#define walk_tree_without_duplicates(a,b,c) \
walk_tree_without_duplicates_1 (a, b, c, NULL)
+/* In emit-rtl.c */
/* Assign the RTX to declaration. */
extern void set_decl_rtl (tree, rtx);
@@ -5120,7 +5114,7 @@ extern int tree_node_sizes[];
restricted to creating gimple expressions. */
extern bool in_gimple_form;
-/* In tree-gimple.c. */
+/* In gimple.c. */
extern tree get_base_address (tree t);
/* In tree-vectorizer.c. */
@@ -5172,6 +5166,11 @@ struct GTY(()) tree_priority_map {
#define tree_priority_map_hash tree_map_base_hash
#define tree_priority_map_marked_p tree_map_base_marked_p
+/* In tree-ssa-ccp.c */
+extern tree maybe_fold_offset_to_reference (tree, tree, tree);
+extern tree maybe_fold_offset_to_address (tree, tree, tree);
+extern tree maybe_fold_stmt_addition (tree, tree, tree);
+
/* In tree-ssa-address.c. */
extern tree tree_mem_ref_addr (tree, tree);
extern void copy_mem_ref_info (tree, tree);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 68ee8b9531d..d63a111889c 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -601,7 +601,7 @@ gimple_value_profile_transformations (void)
if (changed)
{
counts_to_freqs ();
- /* value profile transformations may change inline parameters
+ /* Value profile transformations may change inline parameters
a lot (e.g., indirect call promotion introduces new direct calls).
The update is also needed to avoid compiler ICE -- when MULTI target icall
promotion happens, the caller's size may become negative when the promoted
@@ -1157,7 +1157,7 @@ static htab_t gid_map = NULL;
typedef struct func_gid_entry
{
struct cgraph_node *node;
- unsigned HOST_WIDE_INT gid;
+ unsigned HOST_WIDEST_INT gid;
} func_gid_entry_t;
static hashval_t
@@ -1363,7 +1363,6 @@ gimple_ic (gimple stmt, gimple call, struct cgraph_node *direct_call,
return stmt1;
}
-
/*
For every checked indirect/virtual call determine if most common pid of
function/class method has probability more than 50%. If yes modify code of
@@ -1425,6 +1424,10 @@ gimple_ic_transform_single_targ (gimple stmt, histogram_value histogram)
return true;
}
+/* Convert indirect function call STMT into guarded direct function
+ calls. Multiple indirect call targets are supported. HISTOGRAM
+ is the target distribution for the callsite. */
+
static bool
gimple_ic_transform_mult_targ (gimple stmt, histogram_value histogram)
{
@@ -1552,12 +1555,8 @@ gimple_ic_transform_mult_targ (gimple stmt, histogram_value histogram)
return true;
}
-
-/*
- For every checked indirect/virtual call determine if most common pid of
- function/class method has probability more than 50%. If yes modify code of
- this call to:
- */
+/* Perform indirect call (STMT) to guarded direct function call
+ transformation using value profile data. */
static bool
gimple_ic_transform (gimple stmt)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index c8bc694650e..cf12229d463 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -42,7 +42,6 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "toplev.h"
#include "hashtab.h"
-#include "c-pragma.h"
#include "ggc.h"
#include "langhooks.h"
#include "tm_p.h"
@@ -4776,8 +4775,8 @@ output_constructor (tree exp, unsigned HOST_WIDE_INT size,
total_bytes += fieldsize;
}
else if (val != 0 && TREE_CODE (val) != INTEGER_CST)
- error ("invalid initial value for member %qs",
- IDENTIFIER_POINTER (DECL_NAME (field)));
+ error ("invalid initial value for member %qE",
+ DECL_NAME (field));
else
{
/* Element that is a bit-field. */
@@ -5359,8 +5358,8 @@ finish_aliases_1 (void)
if (target_decl == NULL)
{
if (! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)))
- error ("%q+D aliased to undefined symbol %qs",
- p->decl, IDENTIFIER_POINTER (p->target));
+ error ("%q+D aliased to undefined symbol %qE",
+ p->decl, p->target);
}
else if (DECL_EXTERNAL (target_decl)
&& ! lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)))
@@ -5368,8 +5367,8 @@ finish_aliases_1 (void)
/* In lightweight IPO, find the merged decl and check that it is defined. */
tree real_target_decl = cgraph_find_decl (p->target);
if (!real_target_decl || DECL_EXTERNAL (real_target_decl))
- error ("%q+D aliased to external symbol %qs",
- p->decl, IDENTIFIER_POINTER (p->target));
+ error ("%q+D aliased to external symbol %qE",
+ p->decl, p->target);
}
}
}
diff --git a/gcc/varray.c b/gcc/varray.c
index d8e35b1a83c..91e5b5d588a 100644
--- a/gcc/varray.c
+++ b/gcc/varray.c
@@ -71,7 +71,7 @@ varray_descriptor (const char *name)
slot = (struct varray_descriptor **)
htab_find_slot_with_hash (varray_hash, name,
htab_hash_pointer (name),
- 1);
+ INSERT);
if (*slot)
return *slot;
*slot = XCNEW (struct varray_descriptor);
diff --git a/gcc/vec.c b/gcc/vec.c
index 14567827dcd..530cd1abc4b 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -113,7 +113,8 @@ vec_descriptor (const char *name, int line, const char *function)
if (!vec_desc_hash)
vec_desc_hash = htab_create (10, hash_descriptor, eq_descriptor, NULL);
- slot = (struct vec_descriptor **) htab_find_slot (vec_desc_hash, &loc, 1);
+ slot = (struct vec_descriptor **) htab_find_slot (vec_desc_hash, &loc,
+ INSERT);
if (*slot)
return *slot;
*slot = XCNEW (struct vec_descriptor);
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 24f3f8debcf..a541b69211c 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-03 Joseph Myers <joseph@codesourcery.com>
+
+ * charset.c (one_utf8_to_cppchar): Correct mask used for 5-byte
+ UTF-8 sequences.
+
2009-04-25 Joseph Myers <joseph@codesourcery.com>
PR preprocessor/39559
diff --git a/libcpp/charset.c b/libcpp/charset.c
index e743b1e277f..f1da4265ddd 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -169,7 +169,7 @@ static inline int
one_utf8_to_cppchar (const uchar **inbufp, size_t *inbytesleftp,
cppchar_t *cp)
{
- static const uchar masks[6] = { 0x7F, 0x1F, 0x0F, 0x07, 0x02, 0x01 };
+ static const uchar masks[6] = { 0x7F, 0x1F, 0x0F, 0x07, 0x03, 0x01 };
static const uchar patns[6] = { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
cppchar_t c;
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 11f97e04b66..a7b3d829d3b 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -731,8 +731,8 @@ dyn-ipa.o: %$(objext): $(gcc_srcdir)/libgcov.c
# Static libraries.
-libgcc.a: $(libgcc-objects) dyn-ipa$(objext)
-libgcov.a: $(libgcov-objects)
+libgcc.a: $(libgcc-objects)
+libgcov.a: $(libgcov-objects) dyn-ipa$(objext)
libunwind.a: $(libunwind-objects)
libgcc_eh.a: $(libgcc-eh-objects)
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6763ad1a993..383527990dd 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,16 @@
+2009-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/22423
+ * io/transfer.c (read_block_direct): Avoid warning.
+ * runtime/string.c (compare0): Avoid warning.
+
+2009-04-30 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/39667
+ * io/file_pos.c (st_rewind): Don't truncate or flush.
+ * io/intrinsics.c (fgetc): Flush if switching mode.
+ (fputc): Likewise.
+
2009-04-18 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/39782
@@ -25,25 +38,25 @@
2009-04-15 Danny Smith <dannysmith@clear.net.nz>
- * io/write.c (itoa) : Rename back to gfc_itoa.
- (write_i): Adjust call to write_decimal.
- (write_integer): Use gfc_itoa.
+ * io/write.c (itoa) : Rename back to gfc_itoa.
+ (write_i): Adjust call to write_decimal.
+ (write_integer): Use gfc_itoa.
2009-04-10 Janne Blomqvist <jb@gcc.gnu.org>
- * io/io.h (move_pos_offset): Remove prototype.
- * io/transfer.c (formatted_transfer_scalar_read): Use sseek
- instead of move_pos_offset.
- * io/unix.c (move_pos_offset): Remove.
+ * io/io.h (move_pos_offset): Remove prototype.
+ * io/transfer.c (formatted_transfer_scalar_read): Use sseek
+ instead of move_pos_offset.
+ * io/unix.c (move_pos_offset): Remove.
2009-04-10 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/39665 libfortran/39702 libfortran/39709
* io/io.h (st_parameter_dt): Revert aligned attribute from u.p.value.
- * io/list_read.c (read_complex): Read directly into user pointer.
- (read_real): Likewise.
- (list_formatted_read_scalar): Update read_complex and read_real calls.
- (nml_read_obj): Read directly into user pointer.
+ * io/list_read.c (read_complex): Read directly into user pointer.
+ (read_real): Likewise.
+ (list_formatted_read_scalar): Update read_complex and read_real calls.
+ (nml_read_obj): Read directly into user pointer.
2009-04-09 Janne Blomqvist <jb@gcc.gnu.org>
@@ -679,43 +692,43 @@
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org>
- * io/open.c (already_open): Test for POSIX close return value.
- * io/unit.c (close_unit_1): Likewise.
- * io/unix.c (raw_close): Return 0 for success for preconnected units.
+ * io/open.c (already_open): Test for POSIX close return value.
+ * io/unit.c (close_unit_1): Likewise.
+ * io/unix.c (raw_close): Return 0 for success for preconnected units.
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org>
- * runtime/string.c (compare0): Use gfc_charlen_type.
- * runtime/error.c (gfc_itoa): Move to io/write.c
- (xtoa): Rename to gfc_xtoa.
- * runtime/backtrace.c (show_backtrace): Call gfc_xtoa.
- * intrinsics/cshift0.c (cshift0): Use index_type for shift arg.
- * intrinsics/date_and_time.c (date_and_time): Use index_type.
- (itime_i4): Likewise.
- (itime_i8): Likewise.
- (idate_i4): Likewise.
- (idate_i8): Likewise.
- (gmtime_i4): Likewise.
- (gmtime_i8): Likewise.
- (ltime_i4): Likewise.
- (ltime_i8): Likewise.
- * libgfortran.h (gfc_itoa): Remove prototype.
- (xtoa): Rename prototype to gfc_xtoa.
- * io/list_read.c (nml_read_obj): Use size_t for string length.
- * io/transfer.c (read_block_direct): Change nbytes arg from
- pointer to value.
- (unformatted_read): Minor cleanup, call read_block_directly properly.
- (skip_record): Use ssize_t.
- (next_record_w_unf): Avoid stell() call by calling sseek with SEEK_CUR.
- (iolength_transfer): Make sure to multiply before cast.
- * io/intrinsics.c (fgetc): Remove unnecessary variable.
- * io/format.c (format_hash): Use gfc_charlen_type.
- * io/write.c (itoa): Move from runtime/error.c:gfc_itoa, rename,
- make static.
- (write_i): Call with pointer to itoa.
- (write_z): Call with pointer to gfc_xtoa.
- (write_integer): Pointer to itoa.
- (nml_write_obj): Type cleanup, don't call strlen in loop.
+ * runtime/string.c (compare0): Use gfc_charlen_type.
+ * runtime/error.c (gfc_itoa): Move to io/write.c
+ (xtoa): Rename to gfc_xtoa.
+ * runtime/backtrace.c (show_backtrace): Call gfc_xtoa.
+ * intrinsics/cshift0.c (cshift0): Use index_type for shift arg.
+ * intrinsics/date_and_time.c (date_and_time): Use index_type.
+ (itime_i4): Likewise.
+ (itime_i8): Likewise.
+ (idate_i4): Likewise.
+ (idate_i8): Likewise.
+ (gmtime_i4): Likewise.
+ (gmtime_i8): Likewise.
+ (ltime_i4): Likewise.
+ (ltime_i8): Likewise.
+ * libgfortran.h (gfc_itoa): Remove prototype.
+ (xtoa): Rename prototype to gfc_xtoa.
+ * io/list_read.c (nml_read_obj): Use size_t for string length.
+ * io/transfer.c (read_block_direct): Change nbytes arg from
+ pointer to value.
+ (unformatted_read): Minor cleanup, call read_block_directly properly.
+ (skip_record): Use ssize_t.
+ (next_record_w_unf): Avoid stell() call by calling sseek with SEEK_CUR.
+ (iolength_transfer): Make sure to multiply before cast.
+ * io/intrinsics.c (fgetc): Remove unnecessary variable.
+ * io/format.c (format_hash): Use gfc_charlen_type.
+ * io/write.c (itoa): Move from runtime/error.c:gfc_itoa, rename,
+ make static.
+ (write_i): Call with pointer to itoa.
+ (write_z): Call with pointer to gfc_xtoa.
+ (write_integer): Pointer to itoa.
+ (nml_write_obj): Type cleanup, don't call strlen in loop.
2009-04-06 H.J. Lu <hongjiu.lu@intel.com>
diff --git a/libgfortran/io/file_pos.c b/libgfortran/io/file_pos.c
index 84992323918..c1690173658 100644
--- a/libgfortran/io/file_pos.c
+++ b/libgfortran/io/file_pos.c
@@ -341,26 +341,8 @@ st_rewind (st_parameter_filepos *fpp)
u->previous_nonadvancing_write = 0;
- /* Flush the buffers. If we have been writing to the file, the last
- written record is the last record in the file, so truncate the
- file now. Reset to read mode so two consecutive rewind
- statements do not delete the file contents. */
- if (u->mode == WRITING)
- {
- /* unit_truncate takes care of flushing. */
- unit_truncate (u, stell (u->s), &fpp->common);
- /* .. but we still need to reset since we're going to seek. */
- fbuf_reset (u);
- }
- else
- {
- /* Make sure buffers are reset. */
- if (u->flags.form == FORM_FORMATTED)
- fbuf_reset (u);
- sflush (u->s);
- }
+ fbuf_reset (u);
- u->mode = READING;
u->last_record = 0;
if (sseek (u->s, 0, SEEK_SET) < 0)
diff --git a/libgfortran/io/intrinsics.c b/libgfortran/io/intrinsics.c
index 0a894aac43e..0e33e8490da 100644
--- a/libgfortran/io/intrinsics.c
+++ b/libgfortran/io/intrinsics.c
@@ -46,6 +46,13 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len)
if (u == NULL)
return -1;
+ fbuf_reset (u);
+ if (u->mode == WRITING)
+ {
+ sflush (u->s);
+ u->mode = READING;
+ }
+
memset (c, ' ', c_len);
ret = sread (u->s, c, 1);
unlock_unit (u);
@@ -118,6 +125,13 @@ PREFIX(fputc) (const int * unit, char * c,
if (u == NULL)
return -1;
+ fbuf_reset (u);
+ if (u->mode == READING)
+ {
+ sflush (u->s);
+ u->mode = WRITING;
+ }
+
s = swrite (u->s, c, 1);
unlock_unit (u);
if (s < 0)
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 27ae8994918..ea1ef7a44bf 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -465,7 +465,7 @@ read_block_direct (st_parameter_dt *dtp, void *buf, size_t nbytes)
/* Check whether we exceed the total record length. */
if (dtp->u.p.current_unit->flags.has_recl
- && (nbytes > dtp->u.p.current_unit->bytes_left))
+ && ((gfc_offset) nbytes > dtp->u.p.current_unit->bytes_left))
{
to_read_record = dtp->u.p.current_unit->bytes_left;
short_record = 1;
diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c
index 5a81bd6d950..a102c3bd49a 100644
--- a/libgfortran/runtime/string.c
+++ b/libgfortran/runtime/string.c
@@ -36,7 +36,10 @@ compare0 (const char *s1, gfc_charlen_type s1_len, const char *s2)
/* Strip trailing blanks from the Fortran string. */
len = fstrlen (s1, s1_len);
- if (len != strlen(s2)) return 0; /* don't match */
+
+ if ((size_t) len != strlen(s2))
+ return 0; /* don't match */
+
return strncasecmp (s1, s2, len) == 0;
}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 2e93c985e7a..13c7fd5dd1f 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-29 Julian Brown <julian@codesourcery.com>
+
+ * pex-win32.c (pex_win32_pipe): Add _O_NOINHERIT.
+ (pex_win32_exec_child): Ensure each process has only one handle open
+ on pipe endpoints. Close standard input after creating child for
+ symmetry with standard output/standard error.
+
2009-04-25 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (needed-list): Target removed (not used in GCC
diff --git a/libiberty/pex-win32.c b/libiberty/pex-win32.c
index 3f377519366..30ef4359200 100644
--- a/libiberty/pex-win32.c
+++ b/libiberty/pex-win32.c
@@ -746,6 +746,25 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
OSVERSIONINFO version_info;
STARTUPINFO si;
PROCESS_INFORMATION pi;
+ int orig_out, orig_in, orig_err;
+ BOOL separate_stderr = !(flags & PEX_STDERR_TO_STDOUT);
+
+ /* Ensure we have inheritable descriptors to pass to the child, and close the
+ original descriptors. */
+ orig_in = in;
+ in = _dup (orig_in);
+ _close (orig_in);
+
+ orig_out = out;
+ out = _dup (orig_out);
+ _close (orig_out);
+
+ if (separate_stderr)
+ {
+ orig_err = errdes;
+ errdes = _dup (orig_err);
+ _close (orig_err);
+ }
stdin_handle = INVALID_HANDLE_VALUE;
stdout_handle = INVALID_HANDLE_VALUE;
@@ -753,7 +772,7 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
stdin_handle = (HANDLE) _get_osfhandle (in);
stdout_handle = (HANDLE) _get_osfhandle (out);
- if (!(flags & PEX_STDERR_TO_STDOUT))
+ if (separate_stderr)
stderr_handle = (HANDLE) _get_osfhandle (errdes);
else
stderr_handle = stdout_handle;
@@ -822,12 +841,15 @@ pex_win32_exec_child (struct pex_obj *obj ATTRIBUTE_UNUSED, int flags,
*errmsg = "CreateProcess";
}
- /* Close the standard output and standard error handles in the
- parent. */
+ /* Close the standard input, standard output and standard error handles
+ in the parent. */
+
+ if (in != STDIN_FILENO)
+ _close (in);
if (out != STDOUT_FILENO)
- obj->funcs->close (obj, out);
+ _close (out);
if (errdes != STDERR_FILENO)
- obj->funcs->close (obj, errdes);
+ _close (errdes);
return pid;
}
@@ -883,7 +905,7 @@ static int
pex_win32_pipe (struct pex_obj *obj ATTRIBUTE_UNUSED, int *p,
int binary)
{
- return _pipe (p, 256, binary ? _O_BINARY : _O_TEXT);
+ return _pipe (p, 256, (binary ? _O_BINARY : _O_TEXT) | _O_NOINHERIT);
}
/* Get a FILE pointer to read from a file descriptor. */
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 878797a96fa..cb57e6f71eb 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,38 @@
+2009-04-28 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * testsuite/libjava.jvmti/jvmti-interp.exp
+ (gcj_jni_compile_c_to_so): Fix so extension to '.dll' on win32.
+ * testsuite/lib/libjava.exp (libjava_init): Likewise.
+ * testsuite/libjava.jni/jni.exp
+ (gcj_jni_compile_c_to_so): Likewise.
+ (gcj_jni_test_one): Likewise.
+
+2009-04-28 Andrew Haley <aph@redhat.com>
+
+ PR libgcj/39899
+ * Makefile.am (libgcj_tools_la_LDFLAGS): Add
+ -fno-bootstrap-classes to libgcj_tools_la_GCJFLAGS.
+ * Makefile.in: Regenerate.
+
+2009-04-28 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * interpret.cc (DEBUG): Rename this ...
+ (__GCJ_DEBUG): ... to this throughout.
+ * configure.ac: Likewise.
+ * interpret-run.cc: Likewise.
+ * prims.cc: Likewise.
+ * gnu/classpath/natConfiguration.cc: Likewise.
+ * include/java-assert.h: Likewise.
+ * java/io/natVMObjectInputStream.cc: Likewise.
+
+ * configure: Regenerate.
+ * include/config.h.in: Regenerate.
+
+2009-04-28 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * java/lang/natVMClassLoader.cc
+ (java::lang::VMClassLoader::defineClass): Fix assert.
+
2009-04-26 Matthias Klose <doko@ubuntu.com>
* contrib/aot-compile.in: Print diagnostics for malformed or invalid
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 7db8a444a5f..839d2963c52 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -305,8 +305,15 @@ libgcj_la_LINK = $(LIBLINK)
## compiled.
EXTRA_libgcj_la_SOURCES = java/lang/Object.java
+# We compile libgcj_tools with -findirect-dispatch so that they can
+# depend on external classes: in particular, gjdoc uses antlr. In
+# addition, -fno-bootstrap-classes ensures that the tools are loaded
+# by the system class loader rather than the bootstrap class loader:
+# only core library classes should be loaded by the bootstrap loader.
libgcj_tools_la_SOURCES = classpath/tools/tools.zip
-libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch -fno-indirect-classes -fsource-filename=$(here)/classpath/tools/all-classes.lst
+libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch \
+ -fno-bootstrap-classes -fno-indirect-classes \
+ -fsource-filename=$(here)/classpath/tools/all-classes.lst
libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index b9e38dfb8bc..4e2c89f0393 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -72,6 +72,7 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/../compile \
$(top_srcdir)/contrib/aot-compile-rpm.in \
$(top_srcdir)/contrib/aot-compile.in \
$(top_srcdir)/contrib/aotcompile.py.in \
+ $(top_srcdir)/contrib/generate-cacerts.pl.in \
$(top_srcdir)/contrib/rebuild-gcj-db.in \
$(top_srcdir)/scripts/jar.in COPYING ChangeLog NEWS THANKS
@MAINTAINER_MODE_TRUE@@NATIVE_TRUE@am__append_19 = gen-from-JIS
@@ -111,9 +112,10 @@ CONFIG_HEADER = $(top_builddir)/include/config.h \
$(top_builddir)/gcj/libgcj-config.h
CONFIG_CLEAN_FILES = libgcj.pc libgcj.spec libgcj-test.spec \
contrib/aotcompile.py contrib/aot-compile \
- contrib/aot-compile-rpm contrib/rebuild-gcj-db scripts/jar \
- java/io/natFile.cc java/lang/natConcreteProcess.cc \
- java/net/natVMInetAddress.cc java/net/natVMNetworkInterface.cc \
+ contrib/aot-compile-rpm contrib/generate-cacerts.pl \
+ contrib/rebuild-gcj-db scripts/jar java/io/natFile.cc \
+ java/lang/natConcreteProcess.cc java/net/natVMInetAddress.cc \
+ java/net/natVMNetworkInterface.cc \
gnu/java/net/natPlainSocketImpl.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
gnu/java/nio/natVMPipe.cc gnu/java/nio/natVMSelector.cc \
@@ -1028,8 +1030,17 @@ libgcj_la_DEPENDENCIES = libgcj-$(gcc_version).jar java/lang/Object.lo \
$(libgcj_la_LIBADD) $(am__append_18)
libgcj_la_LINK = $(LIBLINK)
EXTRA_libgcj_la_SOURCES = java/lang/Object.java
+
+# We compile libgcj_tools with -findirect-dispatch so that they can
+# depend on external classes: in particular, gjdoc uses antlr. In
+# addition, -fno-bootstrap-classes ensures that the tools are loaded
+# by the system class loader rather than the bootstrap class loader:
+# only core library classes should be loaded by the bootstrap loader.
libgcj_tools_la_SOURCES = classpath/tools/tools.zip
-libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch -fno-indirect-classes -fsource-filename=$(here)/classpath/tools/all-classes.lst
+libgcj_tools_la_GCJFLAGS = $(AM_GCJFLAGS) -findirect-dispatch \
+ -fno-bootstrap-classes -fno-indirect-classes \
+ -fsource-filename=$(here)/classpath/tools/all-classes.lst
+
libgcj_tools_la_LDFLAGS = -rpath $(toolexeclibdir) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
@@ -8686,6 +8697,8 @@ contrib/aot-compile: $(top_builddir)/config.status $(top_srcdir)/contrib/aot-com
cd $(top_builddir) && $(SHELL) ./config.status $@
contrib/aot-compile-rpm: $(top_builddir)/config.status $(top_srcdir)/contrib/aot-compile-rpm.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+contrib/generate-cacerts.pl: $(top_builddir)/config.status $(top_srcdir)/contrib/generate-cacerts.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
contrib/rebuild-gcj-db: $(top_builddir)/config.status $(top_srcdir)/contrib/rebuild-gcj-db.in
cd $(top_builddir) && $(SHELL) ./config.status $@
scripts/jar: $(top_builddir)/config.status $(top_srcdir)/scripts/jar.in
diff --git a/libjava/configure b/libjava/configure
index ffb46822ed7..b2c24670474 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -5268,7 +5268,7 @@ if test "${enable_libgcj_debug+set}" = set; then
if test "$enable_libgcj_debug" = yes; then
cat >>confdefs.h <<\_ACEOF
-#define DEBUG 1
+#define __GCJ_DEBUG 1
_ACEOF
LIBGCJDEBUG="enable"
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 05d2371724d..c57356a8cde 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -244,7 +244,7 @@ AC_ARG_ENABLE(libgcj-debug,
AS_HELP_STRING([--enable-libgcj-debug],
[enable runtime debugging code]),
[if test "$enable_libgcj_debug" = yes; then
- AC_DEFINE(DEBUG, 1, [Define this if you want runtime debugging enabled.])
+ AC_DEFINE(__GCJ_DEBUG, 1, [Define this if you want runtime debugging enabled.])
LIBGCJDEBUG="enable"
fi])
diff --git a/libjava/gnu/classpath/natConfiguration.cc b/libjava/gnu/classpath/natConfiguration.cc
index 06f119c2b97..b7b8161e709 100644
--- a/libjava/gnu/classpath/natConfiguration.cc
+++ b/libjava/gnu/classpath/natConfiguration.cc
@@ -25,7 +25,7 @@ gnu::classpath::Configuration::classpath_home()
jboolean
gnu::classpath::Configuration::debug()
{
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
return true;
#else
return false;
diff --git a/libjava/include/config.h.in b/libjava/include/config.h.in
index 3fdde3944f2..b81e0d3e1f4 100644
--- a/libjava/include/config.h.in
+++ b/libjava/include/config.h.in
@@ -3,9 +3,6 @@
/* Name of default AWT toolkit */
#undef AWT_TOOLKIT
-/* Define this if you want runtime debugging enabled. */
-#undef DEBUG
-
/* Define if system properties shouldn't be read from
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
@@ -457,5 +454,8 @@
/* Required define if using POSIX threads */
#undef _REENTRANT
+/* Define this if you want runtime debugging enabled. */
+#undef __GCJ_DEBUG
+
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
diff --git a/libjava/include/java-assert.h b/libjava/include/java-assert.h
index 6f178bd9e98..57962418b7d 100644
--- a/libjava/include/java-assert.h
+++ b/libjava/include/java-assert.h
@@ -16,7 +16,7 @@ details. */
void _Jv_Abort (const char *, const char *, int, const char *)
__attribute__ ((__noreturn__));
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
#define _Jv_AssertDoCall(Message) _Jv_Abort (__FUNCTION__, __FILE__, __LINE__, Message)
#define JvAssertMessage(Expr, Message) \
@@ -26,13 +26,13 @@ void _Jv_Abort (const char *, const char *, int, const char *)
#define JvFail(Message) _Jv_AssertDoCall (Message)
-#else /* DEBUG */
+#else /* __GCJ_DEBUG */
#define _Jv_AssertDoCall(Message)
#define JvAssertMessage(Expr, Message)
#define JvAssert(Expr)
#define JvFail(Message) _Jv_Abort (0, 0, 0, Message)
-#endif /* not DEBUG */
+#endif /* not __GCJ_DEBUG */
#endif /* __JAVA_ASSERT_H__ */
diff --git a/libjava/interpret-run.cc b/libjava/interpret-run.cc
index 059195360ed..a4c2d4dab43 100644
--- a/libjava/interpret-run.cc
+++ b/libjava/interpret-run.cc
@@ -23,7 +23,7 @@ details. */
// returns.
java::lang::Thread *thread = java::lang::Thread::currentThread();
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
_Jv_InterpFrame frame_desc (meth, thread, NULL, &pc);
#else
_Jv_InterpFrame frame_desc (meth, thread);
@@ -38,7 +38,7 @@ details. */
_Jv_word locals[meth->max_locals];
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
// This is the information needed to get and set local variables with
// proper type checking.
frame_desc.locals = locals;
@@ -126,7 +126,7 @@ details. */
continue;
}
}
-#endif /* DEBUG */
+#endif /* __GCJ_DEBUG */
#define INSN_LABEL(op) &&insn_##op
@@ -347,7 +347,7 @@ details. */
#ifdef DIRECT_THREADED
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
#undef NEXT_INSN
#define NEXT_INSN \
do \
@@ -392,7 +392,7 @@ details. */
#undef INTERP_REPORT_EXCEPTION
#define INTERP_REPORT_EXCEPTION(Jthrowable) REPORT_EXCEPTION (Jthrowable)
-#else // !DEBUG
+#else // !__GCJ_DEBUG
#undef NEXT_INSN
#define NEXT_INSN goto *((pc++)->insn)
@@ -416,7 +416,7 @@ details. */
#undef INTERP_REPORT_EXCEPTION
#define INTERP_REPORT_EXCEPTION(Jthrowable) /* not needed when not debugging */
-#endif // !DEBUG
+#endif // !__GCJ_DEBUG
#define INTVAL() ((pc++)->int_val)
#define AVAL() ((pc++)->datum)
@@ -450,7 +450,7 @@ details. */
#else
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
#define NEXT_INSN \
do \
{ \
@@ -2677,7 +2677,7 @@ details. */
{
sp = stack;
sp++->o = ex; // Push exception.
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
if (JVMTI_REQUESTED_EVENT (ExceptionCatch))
{
using namespace gnu::gcj::jvmti;
diff --git a/libjava/interpret.cc b/libjava/interpret.cc
index dc1114f65f1..3f690d7b27c 100644
--- a/libjava/interpret.cc
+++ b/libjava/interpret.cc
@@ -983,7 +983,7 @@ void
_Jv_InterpMethod::run (void *retp, INTERP_FFI_RAW_TYPE *args,
_Jv_InterpMethod *meth)
{
-#undef DEBUG
+#undef __GCJ_DEBUG
#undef DEBUG_LOCALS_INSN
#define DEBUG_LOCALS_INSN(s, t) do {} while (0)
@@ -994,7 +994,7 @@ void
_Jv_InterpMethod::run_debug (void *retp, INTERP_FFI_RAW_TYPE *args,
_Jv_InterpMethod *meth)
{
-#define DEBUG
+#define __GCJ_DEBUG
#undef DEBUG_LOCALS_INSN
#define DEBUG_LOCALS_INSN(s, t) \
do \
@@ -1719,7 +1719,7 @@ throw_class_format_error (const char *msg)
CATCH_LOCATION with the method and location where the catch will
occur. If the exception is not caught, these are set to 0.
- This function should only be used with the DEBUG interpreter. */
+ This function should only be used with the __GCJ_DEBUG interpreter. */
static void
find_catch_location (::java::lang::Throwable *exc, jthread thread,
jmethodID *catch_method, jlong *catch_loc)
@@ -1751,7 +1751,7 @@ find_catch_location (::java::lang::Throwable *exc, jthread thread,
caught (if it is caught).
Like find_catch_location, this should only be called with the
- DEBUG interpreter. Since a few exceptions occur outside the
+ __GCJ_DEBUG interpreter. Since a few exceptions occur outside the
interpreter proper, it is important to not call this function
without checking JVMTI_REQUESTED_EVENT(Exception) first. */
void
diff --git a/libjava/java/io/natVMObjectInputStream.cc b/libjava/java/io/natVMObjectInputStream.cc
index 86410a4e76b..eccf0eb0255 100644
--- a/libjava/java/io/natVMObjectInputStream.cc
+++ b/libjava/java/io/natVMObjectInputStream.cc
@@ -26,7 +26,7 @@ details. */
#include <java/lang/reflect/Method.h>
#include <java-stack.h>
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
#include <java/lang/System.h>
#include <java/io/PrintStream.h>
#endif
diff --git a/libjava/java/lang/natVMClassLoader.cc b/libjava/java/lang/natVMClassLoader.cc
index 3e5ff3ec70e..4edff7dafda 100644
--- a/libjava/java/lang/natVMClassLoader.cc
+++ b/libjava/java/lang/natVMClassLoader.cc
@@ -96,7 +96,7 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
}
// if everything proceeded sucessfully, we're loaded.
- JvAssert (klass->state == JV_STATE_LOADED);
+ JvAssert (klass->state == JV_STATE_READ);
}
#endif // INTERPRETER
diff --git a/libjava/prims.cc b/libjava/prims.cc
index d94cd92cbc7..90f8dc5ca23 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -460,7 +460,7 @@ _Jv_makeUtf8Const (jstring string)
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
void
_Jv_Abort (const char *function, const char *file, int line,
const char *message)
@@ -469,7 +469,7 @@ void
_Jv_Abort (const char *, const char *, int, const char *message)
#endif
{
-#ifdef DEBUG
+#ifdef __GCJ_DEBUG
fprintf (stderr,
"libgcj failure: %s\n in function %s, file %s, line %d\n",
message, function, file, line);
diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp
index a31c2bc63d3..510e4ac80d8 100644
--- a/libjava/testsuite/lib/libjava.exp
+++ b/libjava/testsuite/lib/libjava.exp
@@ -202,6 +202,8 @@ proc libjava_init { args } {
if { [istarget "*-*-darwin*"] } {
set so_extension "dylib"
+ } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
+ set so_extension "dll"
} else {
set so_extension "so"
}
diff --git a/libjava/testsuite/libjava.jni/jni.exp b/libjava/testsuite/libjava.jni/jni.exp
index 4ed27cdf0d1..65051287b5a 100644
--- a/libjava/testsuite/libjava.jni/jni.exp
+++ b/libjava/testsuite/libjava.jni/jni.exp
@@ -21,6 +21,9 @@ proc gcj_jni_compile_c_to_so {file {options {}}} {
} elseif { [istarget "hppa*-hp-hpux*"] } {
set so_extension "sl"
set so_flag "-shared"
+ } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
+ set so_extension "dll"
+ set so_flag "-shared"
} else {
set so_extension "so"
set so_flag "-shared"
@@ -99,6 +102,8 @@ proc gcj_jni_test_one {file} {
set so_extension "dylib"
} elseif { [istarget "hppa*-hp-hpux*"] } {
set so_extension "sl"
+ } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
+ set so_extension "dll"
} else {
set so_extension "so"
}
diff --git a/libjava/testsuite/libjava.jvmti/jvmti-interp.exp b/libjava/testsuite/libjava.jvmti/jvmti-interp.exp
index 68b1fc8c177..e81eda52025 100644
--- a/libjava/testsuite/libjava.jvmti/jvmti-interp.exp
+++ b/libjava/testsuite/libjava.jvmti/jvmti-interp.exp
@@ -25,6 +25,9 @@ proc gcj_jni_compile_c_to_so {file {options {}}} {
} elseif { [istarget "hppa*-hp-hpux*"] } {
set so_extension "sl"
set so_flag "-shared"
+ } elseif { [istarget "*-*-cygwin*"] || [istarget "*-*-mingw*"] } {
+ set so_extension "dll"
+ set so_flag "-shared"
} else {
set so_extension "so"
set so_flag "-shared"
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 970e1672ae6..45e0f2b6b39 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,92 @@
+2009-05-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/ext/throw_allocator.h: Remove redundante include.
+
+2009-05-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/ext/throw_allocator.h (throw_allocator_base): Avoid
+ out of line member functions definitions.
+ (throw_allocator_base::_S_g, _S_map, _S_throw_prob, _S_label):
+ Remove, use static locals instead.
+ (throw_allocator_base::do_check_allocated, print_to_string): Declare.
+ * src/throw_allocator.cc: New.
+ * src/Makefile.am: Add.
+ * config/abi/pre/gnu.ver: Add exports.
+ * src/Makefile.in: Regenerate.
+
+2009-05-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * configure.ac: Bump libtool_VERSION to 6:12:0.
+ * configure: Regenerate.
+
+2009-05-07 Matthias Klose <doko@ubuntu.com>
+
+ PR libstdc++/40038
+ * src/math_stubs_long_double.cc: Add ceill.
+
+2009-05-06 Johannes Singler <singler@ira.uka.de>
+
+ PR libstdc++/39546
+ * include/parallel/algo.h (find_switch):
+ Parametrize binder2nd with const T& instead of T.
+ * testsuite/25_algorithms/find/39546.cc: new test case
+
+2009-05-06 Paolo Carlini <paolo.carlini@oracle.com>
+
+ Revert:
+ 2009-05-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * acinclude.m4 ([GLIBCXX_ENABLE_ATOMIC_BUILTINS]): Do link tests when
+ possible.
+ * configure: Regenerate.
+
+2009-05-05 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/39909
+ * include/std/mutex (__get_once_functor_lock, __get_once_mutex,
+ __set_once_functor_lock_ptr): Replace global lock object with local
+ locks on global mutex.
+ * src/mutex.cc (__get_once_functor_lock, __get_once_mutex,
+ __set_once_functor_lock_ptr): Likewise, keeping old function to
+ preserve ABI.
+ (__once_proxy): Use pointer to local lock if set, global lock
+ otherwise.
+ * config/abi/pre/gnu.ver: Add new symbols to new ABI version.
+ * testsuite/util/testsuite_abi.cc: Add GLIBCX_3.4.12 version.
+ * testsuite/30_threads/call_once/39909.cc: New.
+
+2009-05-03 Jan Hubicka <jh@suse.cz>
+
+ * include/parallel/settings.h (get): Mark const.
+ * libsupc++/unwind-cxx.h (__cxa_call_terminate): Mark throw ().
+ * libsupc++/eh_call.cc (__cxa_call_terminate): Mark throw ().
+ * config/io/basic_file_stdio.cc (sys_open, is_open, fd, seekoff): Mark
+ throw ().
+ * config/io/basic_file_stdio.h (__basic_file, sys_open): Mark throw ().
+ (is_open, fd): Mark pure and throw ().
+ (seekoff): Mark throw ().
+
+2009-05-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * acinclude.m4 ([GLIBCXX_ENABLE_ATOMIC_BUILTINS]): Do link tests when
+ possible.
+ * configure: Regenerate.
+
+2009-05-02 Jan Hubicka <jh@suse.cz>
+
+ * include/tr1_impl/functional_hash.h (explicit specializations of ()
+ operator): Mark pure.
+
+2009-04-30 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * scripts/create_testsuite_files: Remove thread directory.
+
+2009-04-28 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/39868
+ * scripts/run_doxygen: Uncomment removal of includes.
+ (problematic): Rewrite __cxxabiv1 namespace to abi.
+
2009-04-26 Paolo Carlini <paolo.carlini@oracle.com>
Revert the last commit.
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 57183c1a670..f40fd97ef38 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -958,6 +958,18 @@ GLIBCXX_3.4.11 {
} GLIBCXX_3.4.10;
+GLIBCXX_3.4.12 {
+
+ # mutex
+ _ZSt27__set_once_functor_lock_ptrPSt11unique_lockISt5mutexE;
+ _ZSt16__get_once_mutexv;
+
+ # throw_allocator
+ _ZN9__gnu_cxx20throw_allocator_base18do_check_allocated*;
+ _ZN9__gnu_cxx20throw_allocator_base15print_to_string*;
+
+} GLIBCXX_3.4.11;
+
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
diff --git a/libstdc++-v3/config/io/basic_file_stdio.cc b/libstdc++-v3/config/io/basic_file_stdio.cc
index fd20d1aba7f..b07a48360f0 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.cc
+++ b/libstdc++-v3/config/io/basic_file_stdio.cc
@@ -210,7 +210,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
__basic_file<char>*
- __basic_file<char>::sys_open(int __fd, ios_base::openmode __mode)
+ __basic_file<char>::sys_open(int __fd, ios_base::openmode __mode) throw ()
{
__basic_file* __ret = NULL;
const char* __c_mode = fopen_mode(__mode);
@@ -247,15 +247,15 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
bool
- __basic_file<char>::is_open() const
+ __basic_file<char>::is_open() const throw ()
{ return _M_cfile != 0; }
int
- __basic_file<char>::fd()
+ __basic_file<char>::fd() throw ()
{ return fileno(_M_cfile); }
__c_file*
- __basic_file<char>::file()
+ __basic_file<char>::file() throw ()
{ return _M_cfile; }
__basic_file<char>*
@@ -315,7 +315,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
}
streamoff
- __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way)
+ __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way) throw ()
{
#ifdef _GLIBCXX_USE_LFS
return lseek64(this->fd(), __off, __way);
diff --git a/libstdc++-v3/config/io/basic_file_stdio.h b/libstdc++-v3/config/io/basic_file_stdio.h
index eedb73be13a..7f30c4e81e9 100644
--- a/libstdc++-v3/config/io/basic_file_stdio.h
+++ b/libstdc++-v3/config/io/basic_file_stdio.h
@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
bool _M_cfile_created;
public:
- __basic_file(__c_lock* __lock = 0);
+ __basic_file(__c_lock* __lock = 0) throw ();
__basic_file*
open(const char* __name, ios_base::openmode __mode, int __prot = 0664);
@@ -67,19 +67,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
sys_open(__c_file* __file, ios_base::openmode);
__basic_file*
- sys_open(int __fd, ios_base::openmode __mode);
+ sys_open(int __fd, ios_base::openmode __mode) throw ();
__basic_file*
close();
- bool
- is_open() const;
+ _GLIBCXX_PURE bool
+ is_open() const throw ();
- int
- fd();
+ _GLIBCXX_PURE int
+ fd() throw ();
- __c_file*
- file();
+ _GLIBCXX_PURE __c_file*
+ file() throw ();
~__basic_file();
@@ -94,7 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
xsgetn(char* __s, streamsize __n);
streamoff
- seekoff(streamoff __off, ios_base::seekdir __way);
+ seekoff(streamoff __off, ios_base::seekdir __way) throw ();
int
sync();
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 31678ebf212..a80bbaecb43 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -1567,7 +1567,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:11:0
+libtool_VERSION=6:12:0
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index a07d9ff98f4..334e918e349 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:11:0
+libtool_VERSION=6:12:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h
index 13030546943..21e235c1200 100644
--- a/libstdc++-v3/include/ext/throw_allocator.h
+++ b/libstdc++-v3/include/ext/throw_allocator.h
@@ -47,7 +47,6 @@
#include <cmath>
#include <ctime>
#include <map>
-#include <set>
#include <string>
#include <ostream>
#include <stdexcept>
@@ -64,13 +63,24 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
std::tr1::mt19937 _M_generator;
public:
- twister_rand_gen(unsigned int s = static_cast<unsigned int>(std::time(0)));
-
+ twister_rand_gen(unsigned int seed =
+ static_cast<unsigned int>(std::time(0)))
+ : _M_generator(seed) { }
+
void
- init(unsigned int);
-
+ init(unsigned int seed)
+ { _M_generator.seed(seed); }
+
double
- get_prob();
+ get_prob()
+ {
+ const double min = _M_generator.min();
+ const double res = static_cast<const double>(_M_generator() - min);
+ const double range = static_cast<const double>(_M_generator.max() - min);
+ const double ret = res / range;
+ _GLIBCXX_DEBUG_ASSERT(ret >= 0 && ret <= 1);
+ return ret;
+ }
};
/**
@@ -96,30 +106,40 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{
public:
void
- init(unsigned long seed);
+ init(unsigned long seed)
+ { rand_gen().init(seed); }
static void
- set_throw_prob(double throw_prob);
+ set_throw_prob(double t_p)
+ { throw_prob() = t_p; }
static double
- get_throw_prob();
+ get_throw_prob()
+ { return throw_prob(); }
static void
- set_label(size_t l);
+ set_label(size_t l)
+ { label() = l; }
+
+ static size_t
+ get_label()
+ { return label(); }
static bool
- empty();
+ empty()
+ { return map().empty(); }
struct group_throw_prob_adjustor
{
- group_throw_prob_adjustor(size_t size) : _M_throw_prob_orig(_S_throw_prob)
+ group_throw_prob_adjustor(size_t size)
+ : _M_throw_prob_orig(get_throw_prob())
{
- _S_throw_prob =
- 1 - std::pow(double(1 - _S_throw_prob), double(0.5 / (size + 1)));
+ set_throw_prob(1 - std::pow(double(1 - get_throw_prob()),
+ double(0.5 / (size + 1))));
}
~group_throw_prob_adjustor()
- { _S_throw_prob = _M_throw_prob_orig; }
+ { set_throw_prob(_M_throw_prob_orig); }
private:
const double _M_throw_prob_orig;
@@ -127,11 +147,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
struct zero_throw_prob_adjustor
{
- zero_throw_prob_adjustor() : _M_throw_prob_orig(_S_throw_prob)
- { _S_throw_prob = 0; }
+ zero_throw_prob_adjustor()
+ : _M_throw_prob_orig(get_throw_prob())
+ { set_throw_prob(0); }
~zero_throw_prob_adjustor()
- { _S_throw_prob = _M_throw_prob_orig; }
+ { set_throw_prob(_M_throw_prob_orig); }
private:
const double _M_throw_prob_orig;
@@ -139,22 +160,43 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
protected:
static void
- insert(void*, size_t);
+ insert(void* p, size_t size)
+ {
+ const_iterator found_it = map().find(p);
+ if (found_it != map().end())
+ {
+ std::string error("throw_allocator_base::insert double insert!\n");
+ print_to_string(error, make_entry(p, size));
+ print_to_string(error, *found_it);
+ std::__throw_logic_error(error.c_str());
+ }
+ map().insert(make_entry(p, size));
+ }
static void
- erase(void*, size_t);
+ erase(void* p, size_t size)
+ {
+ check_allocated(p, size);
+ map().erase(p);
+ }
static void
- throw_conditionally();
+ throw_conditionally()
+ {
+ if (rand_gen().get_prob() < get_throw_prob())
+ __throw_forced_exception_error();
+ }
// See if a particular address and size has been allocated by this
// allocator.
static void
- check_allocated(void*, size_t);
+ check_allocated(void* p, size_t size)
+ { do_check_allocated(map().find(p), map().end(), p, size); }
// See if a given label has been allocated by this allocator.
static void
- check_allocated(size_t);
+ check_allocated(size_t label)
+ { do_check_allocated(map().begin(), map().end(), label); }
private:
typedef std::pair<size_t, size_t> alloc_data_type;
@@ -167,20 +209,59 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
operator<<(std::ostream&, const throw_allocator_base&);
static entry_type
- make_entry(void*, size_t);
+ make_entry(void* p, size_t size)
+ { return std::make_pair(p, alloc_data_type(get_label(), size)); }
+
+ static void
+ do_check_allocated(const_iterator, const_iterator, void*, size_t);
static void
- print_to_string(std::string&);
+ do_check_allocated(const_iterator, const_iterator, size_t);
static void
print_to_string(std::string&, const_reference);
- static twister_rand_gen _S_g;
- static map_type _S_map;
- static double _S_throw_prob;
- static size_t _S_label;
+ static map_type&
+ map()
+ {
+ static map_type mp;
+ return mp;
+ }
+
+ static twister_rand_gen&
+ rand_gen()
+ {
+ static twister_rand_gen rg;
+ return rg;
+ }
+
+ static double&
+ throw_prob()
+ {
+ static double tp;
+ return tp;
+ }
+
+ static size_t&
+ label()
+ {
+ static size_t ll;
+ return ll;
+ }
};
+ inline std::ostream&
+ operator<<(std::ostream& os, const throw_allocator_base&)
+ {
+ std::string error;
+ typedef throw_allocator_base alloc_type;
+ alloc_type::const_iterator beg = alloc_type::map().begin();
+ alloc_type::const_iterator end = alloc_type::map().end();
+ for (; beg != end; ++beg)
+ alloc_type::print_to_string(error, *beg);
+ return os << error;
+ }
+
/**
* @brief Allocator class with logging and exception control.
* @ingroup allocators
@@ -273,176 +354,6 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
operator!=(const throw_allocator<T>&, const throw_allocator<T>&)
{ return false; }
- std::ostream&
- operator<<(std::ostream& os, const throw_allocator_base& alloc)
- {
- std::string error;
- throw_allocator_base::print_to_string(error);
- os << error;
- return os;
- }
-
- // XXX Should be in .cc.
- twister_rand_gen::
- twister_rand_gen(unsigned int seed) : _M_generator(seed) { }
-
- void
- twister_rand_gen::
- init(unsigned int seed)
- { _M_generator.seed(seed); }
-
- double
- twister_rand_gen::
- get_prob()
- {
- const double min = _M_generator.min();
- const double res = static_cast<const double>(_M_generator() - min);
- const double range = static_cast<const double>(_M_generator.max() - min);
- const double ret = res / range;
- _GLIBCXX_DEBUG_ASSERT(ret >= 0 && ret <= 1);
- return ret;
- }
-
- twister_rand_gen throw_allocator_base::_S_g;
-
- throw_allocator_base::map_type
- throw_allocator_base::_S_map;
-
- double throw_allocator_base::_S_throw_prob;
-
- size_t throw_allocator_base::_S_label = 0;
-
- throw_allocator_base::entry_type
- throw_allocator_base::make_entry(void* p, size_t size)
- { return std::make_pair(p, alloc_data_type(_S_label, size)); }
-
- void
- throw_allocator_base::init(unsigned long seed)
- { _S_g.init(seed); }
-
- void
- throw_allocator_base::set_throw_prob(double throw_prob)
- { _S_throw_prob = throw_prob; }
-
- double
- throw_allocator_base::get_throw_prob()
- { return _S_throw_prob; }
-
- void
- throw_allocator_base::set_label(size_t l)
- { _S_label = l; }
-
- void
- throw_allocator_base::insert(void* p, size_t size)
- {
- const_iterator found_it = _S_map.find(p);
- if (found_it != _S_map.end())
- {
- std::string error("throw_allocator_base::insert");
- error += "double insert!";
- error += '\n';
- print_to_string(error, make_entry(p, size));
- print_to_string(error, *found_it);
- std::__throw_logic_error(error.c_str());
- }
- _S_map.insert(make_entry(p, size));
- }
-
- bool
- throw_allocator_base::empty()
- { return _S_map.empty(); }
-
- void
- throw_allocator_base::erase(void* p, size_t size)
- {
- check_allocated(p, size);
- _S_map.erase(p);
- }
-
- void
- throw_allocator_base::check_allocated(void* p, size_t size)
- {
- const_iterator found_it = _S_map.find(p);
- if (found_it == _S_map.end())
- {
- std::string error("throw_allocator_base::check_allocated by value ");
- error += "null erase!";
- error += '\n';
- print_to_string(error, make_entry(p, size));
- std::__throw_logic_error(error.c_str());
- }
-
- if (found_it->second.second != size)
- {
- std::string error("throw_allocator_base::check_allocated by value ");
- error += "wrong-size erase!";
- error += '\n';
- print_to_string(error, make_entry(p, size));
- print_to_string(error, *found_it);
- std::__throw_logic_error(error.c_str());
- }
- }
-
- void
- throw_allocator_base::check_allocated(size_t label)
- {
- std::string found;
- const_iterator it = _S_map.begin();
- while (it != _S_map.end())
- {
- if (it->second.first == label)
- {
- print_to_string(found, *it);
- }
- ++it;
- }
-
- if (!found.empty())
- {
- std::string error("throw_allocator_base::check_allocated by label ");
- error += '\n';
- error += found;
- std::__throw_logic_error(error.c_str());
- }
- }
-
- void
- throw_allocator_base::throw_conditionally()
- {
- if (_S_g.get_prob() < _S_throw_prob)
- __throw_forced_exception_error();
- }
-
- void
- throw_allocator_base::print_to_string(std::string& s)
- {
- const_iterator begin = throw_allocator_base::_S_map.begin();
- const_iterator end = throw_allocator_base::_S_map.end();
- for (; begin != end; ++begin)
- print_to_string(s, *begin);
- }
-
- void
- throw_allocator_base::print_to_string(std::string& s, const_reference ref)
- {
- char buf[40];
- const char tab('\t');
- s += "address: ";
- __builtin_sprintf(buf, "%p", ref.first);
- s += buf;
- s += tab;
- s += "label: ";
- unsigned long l = static_cast<unsigned long>(ref.second.first);
- __builtin_sprintf(buf, "%lu", l);
- s += buf;
- s += tab;
- s += "size: ";
- l = static_cast<unsigned long>(ref.second.second);
- __builtin_sprintf(buf, "%lu", l);
- s += buf;
- s += '\n';
- }
-
_GLIBCXX_END_NAMESPACE
#endif
diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h
index 59106b2d364..a0fbd8d91d6 100644
--- a/libstdc++-v3/include/parallel/algo.h
+++ b/libstdc++-v3/include/parallel/algo.h
@@ -149,8 +149,8 @@ namespace __parallel
if (_GLIBCXX_PARALLEL_CONDITION(true))
{
- binder2nd<__gnu_parallel::equal_to<value_type, T> >
- comp(__gnu_parallel::equal_to<value_type, T>(), val);
+ binder2nd<__gnu_parallel::equal_to<value_type, const T&> >
+ comp(__gnu_parallel::equal_to<value_type, const T&>(), val);
return __gnu_parallel::find_template(begin, end, begin, comp,
__gnu_parallel::
find_if_selector()).first;
diff --git a/libstdc++-v3/include/parallel/settings.h b/libstdc++-v3/include/parallel/settings.h
index 946e39caba1..e4873b4100b 100644
--- a/libstdc++-v3/include/parallel/settings.h
+++ b/libstdc++-v3/include/parallel/settings.h
@@ -265,7 +265,7 @@ namespace __gnu_parallel
sequence_index_t qsb_steals;
/// Get the global settings.
- static const _Settings&
+ _GLIBCXX_CONST static const _Settings&
get() throw();
/// Set the global settings.
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index f26acc02f4f..c090608cb53 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -729,8 +729,11 @@ namespace std
#else
extern function<void()> __once_functor;
- extern unique_lock<mutex>&
- __get_once_functor_lock();
+ extern void
+ __set_once_functor_lock_ptr(unique_lock<mutex>*);
+
+ extern mutex&
+ __get_once_mutex();
#endif
extern "C" void __once_proxy();
@@ -745,16 +748,16 @@ namespace std
__once_callable = &__bound_functor;
__once_call = &__once_call_impl<decltype(__bound_functor)>;
#else
- unique_lock<mutex>& __functor_lock = __get_once_functor_lock();
- __functor_lock.lock();
+ unique_lock<mutex> __functor_lock(__get_once_mutex());
__once_functor = bind(__f, __args...);
+ __set_once_functor_lock_ptr(&__functor_lock);
#endif
int __e = __gthread_once(&(__once._M_once), &__once_proxy);
#ifndef _GLIBCXX_HAVE_TLS
if (__functor_lock)
- __functor_lock.unlock();
+ __set_once_functor_lock_ptr(0);
#endif
if (__e)
diff --git a/libstdc++-v3/include/tr1_impl/functional_hash.h b/libstdc++-v3/include/tr1_impl/functional_hash.h
index 665168c0f5f..0b963e00f17 100644
--- a/libstdc++-v3/include/tr1_impl/functional_hash.h
+++ b/libstdc++-v3/include/tr1_impl/functional_hash.h
@@ -157,25 +157,25 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
/// Explicit specializations for long double.
template<>
- size_t
+ _GLIBCXX_PURE size_t
hash<long double>::operator()(long double __val) const;
/// Explicit specialization of member operator for non-builtin types.
template<>
- size_t
+ _GLIBCXX_PURE size_t
hash<string>::operator()(string) const;
template<>
- size_t
+ _GLIBCXX_PURE size_t
hash<const string&>::operator()(const string&) const;
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
- size_t
+ _GLIBCXX_PURE size_t
hash<wstring>::operator()(wstring) const;
template<>
- size_t
+ _GLIBCXX_PURE size_t
hash<const wstring&>::operator()(const wstring&) const;
#endif
diff --git a/libstdc++-v3/libsupc++/eh_call.cc b/libstdc++-v3/libsupc++/eh_call.cc
index a737eb88938..0054e52016d 100644
--- a/libstdc++-v3/libsupc++/eh_call.cc
+++ b/libstdc++-v3/libsupc++/eh_call.cc
@@ -37,7 +37,7 @@ using namespace __cxxabiv1;
// terminate.
extern "C" void
-__cxa_call_terminate(_Unwind_Exception* ue_header)
+__cxa_call_terminate(_Unwind_Exception* ue_header) throw ()
{
if (ue_header)
diff --git a/libstdc++-v3/libsupc++/unwind-cxx.h b/libstdc++-v3/libsupc++/unwind-cxx.h
index e4918b211bf..6033caf1705 100644
--- a/libstdc++-v3/libsupc++/unwind-cxx.h
+++ b/libstdc++-v3/libsupc++/unwind-cxx.h
@@ -187,7 +187,7 @@ extern "C" void __cxa_bad_typeid () __attribute__((__noreturn__));
// throws, and if bad_exception needs to be thrown. Called from the
// compiler.
extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
-extern "C" void __cxa_call_terminate (_Unwind_Exception*) __attribute__((noreturn));
+extern "C" void __cxa_call_terminate (_Unwind_Exception*) throw () __attribute__((noreturn));
#ifdef __ARM_EABI_UNWINDER__
// Arm EABI specified routines.
diff --git a/libstdc++-v3/scripts/create_testsuite_files b/libstdc++-v3/scripts/create_testsuite_files
index 8d87e09d017..edb9e4a2ce8 100755
--- a/libstdc++-v3/scripts/create_testsuite_files
+++ b/libstdc++-v3/scripts/create_testsuite_files
@@ -32,7 +32,7 @@ cd $srcdir
# This is the ugly version of "everything but the current directory". It's
# what has to happen when find(1) doesn't support -mindepth, or -xtype.
dlist=`echo [0-9][0-9]*`
-dlist="$dlist abi backward ext performance thread tr1"
+dlist="$dlist abi backward ext performance tr1"
find $dlist "(" -type f -o -type l ")" -name "*.cc" -print > $tmp.01
find $dlist "(" -type f -o -type l ")" -name "*.c" -print > $tmp.02
cat $tmp.01 $tmp.02 | sort > $tmp.1
diff --git a/libstdc++-v3/scripts/run_doxygen b/libstdc++-v3/scripts/run_doxygen
index 4c65813a9eb..bcb442be219 100644
--- a/libstdc++-v3/scripts/run_doxygen
+++ b/libstdc++-v3/scripts/run_doxygen
@@ -1,7 +1,8 @@
#!/bin/bash
# Runs doxygen and massages the output files.
-# Copyright (C) 2001, 2002, 2003, 2004, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009
+# Free Software Foundation, Inc.
#
# Synopsis: run_doxygen --mode=[html|man|xml] --host_alias=<alias> \
# v3srcdir v3builddir
@@ -217,19 +218,11 @@ rm -rf ext
# File names with embedded spaces (EVIL!) need to be....? renamed or removed?
find . -name "* *" -print0 | xargs -0r rm # requires GNU tools
-# Cleanups before tr1* files get killed.
-mv tr1_random_distributions.3 random_distributions.3
-mv tr1_random_distributions_continuous.3 random_distributions_continuous.3
-mv tr1_random_distributions_discrete.3 random_distributions_discrete.3
-mv tr1_random_generators.3 random_generators.3
-
# man pages are for functions/types/other entities, not source files
# directly. who the heck would type "man foo.h" anyhow?
-#find . -name "[a-z]*" -a ! -name "std_*" -print | xargs rm
+find . -name "[a-z]*" -a ! -name "std_*" -print | xargs rm
rm -f *.h.3 *.hpp.3 *config* *.cc.3 *.tcc.3 *_t.3
-rm ext_*.3
-rm tr1_*.3
-rm debug_*.3
+#rm ext_*.3 tr1_*.3 debug_*.3
# this is used to examine what we would have deleted, for debugging
#mkdir trash
@@ -254,18 +247,18 @@ rm stdheader
# Some of the pages for generated modules have text that confuses certain
# implementations of man(1), e.g., Linux's. We need to have another top-level
# *roff tag to /stop/ the .SH NAME entry.
-#problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
-
+problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3`
#problematic='Containers.3 Sequences.3 Assoc_containers.3 Iterator_types.3'
-#for f in $problematic; do
-# sed '/^\.SH NAME/{
-#n
-#a\
-#\
-#.SH SYNOPSIS
-# }' $f > TEMP
-# mv TEMP $f
-#done
+
+for f in $problematic; do
+ sed '/^\.SH NAME/{
+n
+a\
+\
+.SH SYNOPSIS
+ }' $f > TEMP
+ mv TEMP $f
+done
# Also, break this (generated) line up. It's ugly as sin.
problematic=`grep -l '[^^]Definition at line' *.3`
@@ -320,7 +313,10 @@ for f in __atomic2_*; do
newname=`echo $f | sed 's/^__atomic2_/std::__atomic2::/'`
mv $f $newname
done
-
+for f in __cxxabiv1_*; do
+ newname=`echo $f | sed 's/^__cxxabiv1_/abi::/'`
+ mv $f $newname
+done
# Generic removal bits, where there are things in the generated man
# pages that need to be killed.
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index d218ceaa9ca..288243aab26 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -182,6 +182,7 @@ sources = \
streambuf-inst.cc \
streambuf.cc \
string-inst.cc \
+ throw_allocator.cc \
valarray-inst.cc \
wlocale-inst.cc \
wstring-inst.cc \
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 9ee5275198b..24187af1dae 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -85,12 +85,13 @@ am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \
fstream-inst.cc ext-inst.cc ios-inst.cc iostream-inst.cc \
istream-inst.cc istream.cc locale-inst.cc misc-inst.cc \
ostream-inst.cc sstream-inst.cc streambuf-inst.cc streambuf.cc \
- string-inst.cc valarray-inst.cc wlocale-inst.cc \
- wstring-inst.cc mutex.cc condition_variable.cc chrono.cc \
- thread.cc atomicity.cc codecvt_members.cc collate_members.cc \
- ctype_members.cc messages_members.cc monetary_members.cc \
- numeric_members.cc time_members.cc basic_file.cc c++locale.cc \
- compatibility-ldbl.cc parallel_list.cc parallel_settings.cc
+ string-inst.cc throw_allocator.cc valarray-inst.cc \
+ wlocale-inst.cc wstring-inst.cc mutex.cc condition_variable.cc \
+ chrono.cc thread.cc atomicity.cc codecvt_members.cc \
+ collate_members.cc ctype_members.cc messages_members.cc \
+ monetary_members.cc numeric_members.cc time_members.cc \
+ basic_file.cc c++locale.cc compatibility-ldbl.cc \
+ parallel_list.cc parallel_settings.cc
am__objects_1 = atomicity.lo codecvt_members.lo collate_members.lo \
ctype_members.lo messages_members.lo monetary_members.lo \
numeric_members.lo time_members.lo
@@ -111,9 +112,9 @@ am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
fstream-inst.lo ext-inst.lo ios-inst.lo iostream-inst.lo \
istream-inst.lo istream.lo locale-inst.lo misc-inst.lo \
ostream-inst.lo sstream-inst.lo streambuf-inst.lo streambuf.lo \
- string-inst.lo valarray-inst.lo wlocale-inst.lo \
- wstring-inst.lo mutex.lo condition_variable.lo chrono.lo \
- thread.lo $(am__objects_1) $(am__objects_4)
+ string-inst.lo throw_allocator.lo valarray-inst.lo \
+ wlocale-inst.lo wstring-inst.lo mutex.lo condition_variable.lo \
+ chrono.lo thread.lo $(am__objects_1) $(am__objects_4)
am_libstdc___la_OBJECTS = $(am__objects_5)
libstdc___la_OBJECTS = $(am_libstdc___la_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
@@ -434,6 +435,7 @@ sources = \
streambuf-inst.cc \
streambuf.cc \
string-inst.cc \
+ throw_allocator.cc \
valarray-inst.cc \
wlocale-inst.cc \
wstring-inst.cc \
diff --git a/libstdc++-v3/src/math_stubs_long_double.cc b/libstdc++-v3/src/math_stubs_long_double.cc
index 1b59034eb71..9f760cfb32f 100644
--- a/libstdc++-v3/src/math_stubs_long_double.cc
+++ b/libstdc++-v3/src/math_stubs_long_double.cc
@@ -70,6 +70,14 @@ extern "C"
}
#endif
+#ifndef _GLIBCXX_HAVE_CEILL
+ long double
+ ceill(long double x)
+ {
+ return ceil((double) x);
+ }
+#endif
+
#ifndef _GLIBCXX_HAVE_COSL
long double
cosl(long double x)
diff --git a/libstdc++-v3/src/mutex.cc b/libstdc++-v3/src/mutex.cc
index e0a94892158..fcc1eb97a89 100644
--- a/libstdc++-v3/src/mutex.cc
+++ b/libstdc++-v3/src/mutex.cc
@@ -28,11 +28,11 @@
#ifndef _GLIBCXX_HAVE_TLS
namespace
{
- std::mutex&
- get_once_mutex()
+ inline std::unique_lock<std::mutex>*&
+ __get_once_functor_lock_ptr()
{
- static std::mutex once_mutex;
- return once_mutex;
+ static std::unique_lock<std::mutex>* __once_functor_lock_ptr = 0;
+ return __once_functor_lock_ptr;
}
}
#endif
@@ -55,10 +55,25 @@ namespace std
template class function<void()>;
function<void()> __once_functor;
+ mutex&
+ __get_once_mutex()
+ {
+ static mutex once_mutex;
+ return once_mutex;
+ }
+
+ // code linked against ABI 3.4.12 and later uses this
+ void
+ __set_once_functor_lock_ptr(unique_lock<mutex>* __ptr)
+ {
+ __get_once_functor_lock_ptr() = __ptr;
+ }
+
+ // unsafe - retained for compatibility with ABI 3.4.11
unique_lock<mutex>&
__get_once_functor_lock()
{
- static unique_lock<mutex> once_functor_lock(get_once_mutex(), defer_lock);
+ static unique_lock<mutex> once_functor_lock(__get_once_mutex(), defer_lock);
return once_functor_lock;
}
#endif
@@ -69,7 +84,14 @@ namespace std
{
#ifndef _GLIBCXX_HAVE_TLS
function<void()> __once_call = std::move(__once_functor);
- __get_once_functor_lock().unlock();
+ if (unique_lock<mutex>* __lock = __get_once_functor_lock_ptr())
+ {
+ // caller is using new ABI and provided lock ptr
+ __get_once_functor_lock_ptr() = 0;
+ __lock->unlock();
+ }
+ else
+ __get_once_functor_lock().unlock(); // global lock
#endif
__once_call();
}
diff --git a/libstdc++-v3/src/throw_allocator.cc b/libstdc++-v3/src/throw_allocator.cc
new file mode 100644
index 00000000000..a8247ad9782
--- /dev/null
+++ b/libstdc++-v3/src/throw_allocator.cc
@@ -0,0 +1,95 @@
+// Throw Allocator. Out of line function definitions. -*- C++ -*-
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 3, 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 General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <ext/throw_allocator.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ void
+ throw_allocator_base::do_check_allocated(const_iterator found,
+ const_iterator end,
+ void* p, size_t size)
+ {
+ if (found == end)
+ {
+ std::string error("throw_allocator_base::check_allocated by value "
+ "null erase!\n");
+ print_to_string(error, make_entry(p, size));
+ std::__throw_logic_error(error.c_str());
+ }
+
+ if (found->second.second != size)
+ {
+ std::string error("throw_allocator_base::check_allocated by value "
+ "wrong-size erase!\n");
+ print_to_string(error, make_entry(p, size));
+ print_to_string(error, *found);
+ std::__throw_logic_error(error.c_str());
+ }
+ }
+
+ void
+ throw_allocator_base::do_check_allocated(const_iterator beg,
+ const_iterator end,
+ size_t label)
+ {
+ std::string found;
+ while (beg != end)
+ {
+ if (beg->second.first == label)
+ print_to_string(found, *beg);
+ ++beg;
+ }
+
+ if (!found.empty())
+ {
+ std::string error("throw_allocator_base::check_allocated by label \n");
+ error += found;
+ std::__throw_logic_error(error.c_str());
+ }
+ }
+
+ void
+ throw_allocator_base::print_to_string(std::string& s,
+ const_reference ref)
+ {
+ char buf[40];
+ const char tab('\t');
+ s += "address: ";
+ __builtin_sprintf(buf, "%p", ref.first);
+ s += buf;
+ s += tab;
+ s += "label: ";
+ unsigned long l = static_cast<unsigned long>(ref.second.first);
+ __builtin_sprintf(buf, "%lu", l);
+ s += buf;
+ s += tab;
+ s += "size: ";
+ l = static_cast<unsigned long>(ref.second.second);
+ __builtin_sprintf(buf, "%lu", l);
+ s += buf;
+ s += '\n';
+ }
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/testsuite/25_algorithms/find/39546.cc b/libstdc++-v3/testsuite/25_algorithms/find/39546.cc
new file mode 100644
index 00000000000..b83a8553436
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/find/39546.cc
@@ -0,0 +1,43 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 3, 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.3.1 algorithms, find()
+
+#include <vector>
+#include <string>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+// libstdc++/39546
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<std::string> dict;
+ dict.push_back("one");
+ dict.push_back("two");
+ dict.push_back("three");
+
+ VERIFY( std::find(dict.begin(), dict.end(), "two") == dict.begin() + 1 );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/30_threads/call_once/39909.cc b/libstdc++-v3/testsuite/30_threads/call_once/39909.cc
new file mode 100644
index 00000000000..aa125919bf8
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/call_once/39909.cc
@@ -0,0 +1,56 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } }
+// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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 3, 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 General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <mutex>
+#include <thread>
+#include <testsuite_hooks.h>
+
+std::once_flag flag;
+int value = 0;
+
+struct Inc { void operator()() const { ++value; } };
+
+struct Func
+{
+ void operator()() const
+ {
+ Inc inc;
+ for (int i = 0; i < 10000; ++i)
+ std::call_once(flag, inc);
+ }
+};
+
+int main()
+{
+ Func f;
+ std::thread t1(f);
+ std::thread t2(f);
+ std::thread t3(f);
+ t1.join();
+ t2.join();
+ t3.join();
+ VERIFY( value == 1 );
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc
index e9df9f80299..ca1bb912ce5 100644
--- a/libstdc++-v3/testsuite/util/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc
@@ -183,6 +183,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.9");
known_versions.push_back("GLIBCXX_3.4.10");
known_versions.push_back("GLIBCXX_3.4.11");
+ known_versions.push_back("GLIBCXX_3.4.12");
known_versions.push_back("GLIBCXX_LDBL_3.4");
known_versions.push_back("GLIBCXX_LDBL_3.4.7");
known_versions.push_back("GLIBCXX_LDBL_3.4.10");