summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-04 05:48:56 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-04 05:48:56 +0000
commite6e189fa270c5aa4aa168eef3935aa7e40f30175 (patch)
treea92ff5b1a65fe78279e0fd8b82fac273d28a6181
parent469cf0eb8ebe007ed2ed6d9b694396fb8216f80b (diff)
downloadgcc-e6e189fa270c5aa4aa168eef3935aa7e40f30175.tar.gz
2009-05-04 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r147090 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@147091 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.MELT3
-rw-r--r--MAINTAINERS10
-rw-r--r--contrib/ChangeLog9
-rwxr-xr-xcontrib/dg-extract-results.sh29
-rw-r--r--fixincludes/ChangeLog24
-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/ChangeLog1099
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in21
-rw-r--r--gcc/ada/ChangeLog437
-rw-r--r--gcc/ada/Makefile.rtl2
-rw-r--r--gcc/ada/adaint.c3
-rw-r--r--gcc/ada/clean.adb177
-rw-r--r--gcc/ada/err_vars.ads24
-rw-r--r--gcc/ada/exp_aggr.adb51
-rw-r--r--gcc/ada/exp_ch3.adb83
-rw-r--r--gcc/ada/exp_ch3.ads8
-rw-r--r--gcc/ada/exp_ch4.adb11
-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.adb91
-rw-r--r--gcc/ada/exp_disp.ads13
-rw-r--r--gcc/ada/exp_tss.adb73
-rw-r--r--gcc/ada/exp_tss.ads22
-rw-r--r--gcc/ada/freeze.adb96
-rw-r--r--gcc/ada/g-expect.adb4
-rw-r--r--gcc/ada/g-expect.ads64
-rw-r--r--gcc/ada/g-socket.adb93
-rw-r--r--gcc/ada/g-socket.ads10
-rw-r--r--gcc/ada/g-socthi-mingw.adb76
-rw-r--r--gcc/ada/g-socthi-mingw.ads27
-rw-r--r--gcc/ada/g-socthi-vms.adb130
-rw-r--r--gcc/ada/g-socthi-vms.ads27
-rw-r--r--gcc/ada/g-socthi-vxworks.adb62
-rw-r--r--gcc/ada/g-socthi-vxworks.ads29
-rw-r--r--gcc/ada/g-socthi.adb62
-rw-r--r--gcc/ada/g-socthi.ads29
-rw-r--r--gcc/ada/g-sothco.ads15
-rw-r--r--gcc/ada/g-tastus.ads38
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in58
-rw-r--r--gcc/ada/gcc-interface/Makefile.in8
-rw-r--r--gcc/ada/gnat1drv.adb2
-rw-r--r--gcc/ada/gnat_rm.texi29
-rw-r--r--gcc/ada/gnat_ugn.texi230
-rw-r--r--gcc/ada/gnatcmd.adb208
-rw-r--r--gcc/ada/initialize.c25
-rw-r--r--gcc/ada/lib-xref.adb112
-rw-r--r--gcc/ada/make.adb888
-rw-r--r--gcc/ada/makeutl.adb38
-rw-r--r--gcc/ada/makeutl.ads6
-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/prepcomp.adb4
-rw-r--r--gcc/ada/prj-dect.adb47
-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.adb1021
-rw-r--r--gcc/ada/prj-nmsc.ads23
-rw-r--r--gcc/ada/prj-pars.adb11
-rw-r--r--gcc/ada/prj-pars.ads8
-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.ads10
-rw-r--r--gcc/ada/prj-util.adb16
-rw-r--r--gcc/ada/prj.adb185
-rw-r--r--gcc/ada/prj.ads61
-rw-r--r--gcc/ada/rtsfind.adb147
-rw-r--r--gcc/ada/s-oscons-tmplt.c13
-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/sem.adb7
-rw-r--r--gcc/ada/sem_aggr.adb312
-rw-r--r--gcc/ada/sem_attr.adb7
-rw-r--r--gcc/ada/sem_cat.ads7
-rw-r--r--gcc/ada/sem_ch10.adb2
-rw-r--r--gcc/ada/sem_ch12.adb63
-rw-r--r--gcc/ada/sem_ch13.adb36
-rw-r--r--gcc/ada/sem_ch3.adb50
-rw-r--r--gcc/ada/sem_ch5.adb15
-rw-r--r--gcc/ada/sem_ch6.adb33
-rw-r--r--gcc/ada/sem_ch8.adb21
-rw-r--r--gcc/ada/sem_disp.adb11
-rw-r--r--gcc/ada/sem_elim.adb93
-rw-r--r--gcc/ada/sem_prag.adb9
-rw-r--r--gcc/ada/sem_res.adb316
-rw-r--r--gcc/ada/sem_util.adb72
-rw-r--r--gcc/ada/sem_util.ads5
-rw-r--r--gcc/ada/sinfo.adb16
-rw-r--r--gcc/ada/sinfo.ads19
-rw-r--r--gcc/ada/sinput-l.adb7
-rw-r--r--gcc/ada/sinput.ads6
-rw-r--r--gcc/ada/targparm.ads2
-rw-r--r--gcc/ada/xoscons.adb35
-rw-r--r--gcc/alloc-pool.c2
-rw-r--r--gcc/attribs.c1
-rw-r--r--gcc/bitmap.c2
-rw-r--r--gcc/builtins.c60
-rw-r--r--gcc/c-common.c39
-rw-r--r--gcc/c-common.h6
-rw-r--r--gcc/c-gimplify.c15
-rw-r--r--gcc/c-objc-common.c23
-rw-r--r--gcc/c-opts.c13
-rw-r--r--gcc/c-parser.c2
-rw-r--r--gcc/c-pretty-print.c108
-rw-r--r--gcc/c-pretty-print.h3
-rw-r--r--gcc/c-typeck.c63
-rw-r--r--gcc/calls.c1
-rw-r--r--gcc/cfgexpand.c7
-rw-r--r--gcc/cfgrtl.c17
-rw-r--r--gcc/cgraphunit.c1
-rw-r--r--gcc/collect2.c4
-rw-r--r--gcc/common.opt10
-rw-r--r--gcc/config.gcc36
-rw-r--r--gcc/config.in12
-rw-r--r--gcc/config/alpha/alpha.c16
-rw-r--r--gcc/config/alpha/alpha.h6
-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-tune.md2
-rw-r--r--gcc/config/arm/arm.c22
-rw-r--r--gcc/config/arm/arm.h2
-rw-r--r--gcc/config/avr/avr-protos.h5
-rw-r--r--gcc/config/avr/avr.c17
-rw-r--r--gcc/config/avr/avr.h11
-rw-r--r--gcc/config/bfin/bfin-protos.h11
-rw-r--r--gcc/config/bfin/bfin.c287
-rw-r--r--gcc/config/bfin/bfin.h2
-rw-r--r--gcc/config/bfin/bfin.md147
-rw-r--r--gcc/config/darwin.c2
-rw-r--r--gcc/config/h8300/h8300.h6
-rw-r--r--gcc/config/hpux-stdint.h34
-rw-r--r--gcc/config/i386/i386.c379
-rw-r--r--gcc/config/i386/i386.md2
-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.h2
-rw-r--r--gcc/config/m32c/m32c.c16
-rw-r--r--gcc/config/m68hc11/m68hc11.h6
-rw-r--r--gcc/config/m68k/m68k.h2
-rw-r--r--gcc/config/mcore/mcore.h5
-rw-r--r--gcc/config/mips/mips.c64
-rw-r--r--gcc/config/mips/mips.h18
-rw-r--r--gcc/config/mips/mips.md11
-rw-r--r--gcc/config/mn10300/mn10300.h1
-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/pdp11/pdp11.h8
-rw-r--r--gcc/config/picochip/picochip.h3
-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.c7
-rw-r--r--gcc/config/rs6000/rs6000.h16
-rw-r--r--gcc/config/s390/s390.c8
-rw-r--r--gcc/config/s390/s390.h8
-rw-r--r--gcc/config/sh/sh-protos.h2
-rw-r--r--gcc/config/sh/sh.c25
-rw-r--r--gcc/config/sh/sh.h26
-rw-r--r--gcc/config/sol2-c.c8
-rw-r--r--gcc/config/sparc/sparc.c2
-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.h3
-rw-r--r--gcc/config/spu/spu.c116
-rw-r--r--gcc/config/spu/spu.h2
-rw-r--r--gcc/config/spu/spu.md91
-rw-r--r--gcc/config/stormy16/stormy16.h2
-rw-r--r--gcc/config/v850/v850.h6
-rwxr-xr-xgcc/configure104
-rw-r--r--gcc/configure.ac61
-rw-r--r--gcc/cp/ChangeLog55
-rw-r--r--gcc/cp/cvt.c6
-rw-r--r--gcc/cp/cxx-pretty-print.c138
-rw-r--r--gcc/cp/cxx-pretty-print.h3
-rw-r--r--gcc/cp/error.c155
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/cse.c62
-rw-r--r--gcc/dbgcnt.def8
-rw-r--r--gcc/dce.c14
-rw-r--r--gcc/debug.h2
-rw-r--r--gcc/defaults.h4
-rw-r--r--gcc/df-core.c8
-rw-r--r--gcc/df-scan.c4
-rw-r--r--gcc/df.h4
-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.texi4
-rw-r--r--gcc/doc/gimple.texi4
-rw-r--r--gcc/doc/install.texi20
-rw-r--r--gcc/doc/invoke.texi22
-rw-r--r--gcc/doc/loop.texi2
-rw-r--r--gcc/doc/md.texi10
-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.texi23
-rw-r--r--gcc/doc/trouble.texi2
-rw-r--r--gcc/dwarf2out.c6
-rw-r--r--gcc/except.c2
-rw-r--r--gcc/expmed.c88
-rw-r--r--gcc/expr.c191
-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.c5
-rw-r--r--gcc/fortran/ChangeLog27
-rw-r--r--gcc/fortran/expr.c4
-rw-r--r--gcc/fortran/parse.c2
-rw-r--r--gcc/fortran/resolve.c5
-rw-r--r--gcc/fortran/trans-expr.c11
-rw-r--r--gcc/fortran/trans-intrinsic.c8
-rw-r--r--gcc/fortran/trans-io.c2
-rw-r--r--gcc/fwprop.c2
-rw-r--r--gcc/gcc-plugin.h5
-rw-r--r--gcc/gcc.c16
-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.c20
-rw-r--r--gcc/gimple.h2
-rw-r--r--gcc/gimplify.c18
-rw-r--r--gcc/haifa-sched.c2
-rw-r--r--gcc/hooks.c9
-rw-r--r--gcc/hooks.h3
-rw-r--r--gcc/ipa-pure-const.c1
-rw-r--r--gcc/ipa-reference.c2
-rw-r--r--gcc/ipa-struct-reorg.c2
-rw-r--r--gcc/ipa-type-escape.c2
-rw-r--r--gcc/ipa-utils.c2
-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/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.c28
-rw-r--r--gcc/passes.c9
-rw-r--r--gcc/plugin-version.c36
-rw-r--r--gcc/plugin.c30
-rw-r--r--gcc/predict.c6
-rw-r--r--gcc/print-tree.c5
-rw-r--r--gcc/real.c4
-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/store-motion.c1265
-rw-r--r--gcc/target-def.h3
-rw-r--r--gcc/target.h2
-rw-r--r--gcc/targhooks.c6
-rw-r--r--gcc/targhooks.h1
-rw-r--r--gcc/testsuite/ChangeLog420
-rw-r--r--gcc/testsuite/g++.dg/cpp/_Pragma1.C2
-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/visibility/class1.C1
-rw-r--r--gcc/testsuite/g++.dg/other/PR23205.C2
-rw-r--r--gcc/testsuite/g++.dg/rtti/repo1.C1
-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/Wunused-15.C11
-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++.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/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/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.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/asm-b.c2
-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/utf8-5byte-1.c17
-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/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/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/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-6.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/vect-35.c2
-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/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/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/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/proc_ptr_16.f9020
-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/gnat.dg/opt2.adb31
-rw-r--r--gcc/testsuite/lib/objc.exp5
-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.def5
-rw-r--r--gcc/toplev.c12
-rw-r--r--gcc/toplev.h1
-rw-r--r--gcc/tree-cfg.c48
-rw-r--r--gcc/tree-data-ref.c3
-rw-r--r--gcc/tree-dfa.c21
-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.c7
-rw-r--r--gcc/tree-into-ssa.c32
-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-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-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.c20
-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.c482
-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.h15
-rw-r--r--gcc/varasm.c1
-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--libgfortran/ChangeLog7
-rw-r--r--libgfortran/io/file_pos.c20
-rw-r--r--libgfortran/io/intrinsics.c14
-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/ChangeLog32
-rw-r--r--libstdc++-v3/acinclude.m4134
-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/configure369
-rw-r--r--libstdc++-v3/include/parallel/settings.h2
-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
609 files changed, 12693 insertions, 7243 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c04bc7da89..e3907beef71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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/ChangeLog.MELT b/ChangeLog.MELT
index 67c7cbdb2bd..226ccf119b7 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,3 +1,6 @@
+2009-05-04 Basile Starynkevitch <basile@starynkevitch.net>
+ MELT branch merged with trunk r147090
+
2009-04-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r146824
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/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/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 1231e593a7d..dcc0070b232 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,963 @@
+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.
+
2009-04-27 Jan Hubicka <jh@suse.cz>
* ipa-pure-const.c (struct funct_state_d): New fields
@@ -13,8 +973,7 @@
2009-04-26 Michael Matz <matz@suse.de>
- * tree-flow.h (tree_ann_common_d): Remove aux and value_handle
- members.
+ * tree-flow.h (tree_ann_common_d): Remove aux and value_handle members.
2009-04-26 Michael Matz <matz@suse.de>
@@ -61,8 +1020,7 @@
* ssaexpand.h: New file.
* expr.c (toplevel): Include ssaexpand.h.
- (expand_assignment): Handle SSA names the same as register
- variables.
+ (expand_assignment): Handle SSA names the same as register variables.
(expand_expr_real_1): Expand SSA names.
* cfgexpand.c (toplevel): Include ssaexpand.h.
(SA): New global variable.
@@ -112,8 +1070,7 @@
(set_location_for_edge): New static helper.
(create_temp): Remove.
(insert_partition_copy_on_edge, insert_part_to_rtx_on_edge,
- insert_value_copy_on_edge, insert_rtx_to_part_on_edge): New
- functions.
+ insert_value_copy_on_edge, insert_rtx_to_part_on_edge): New functions.
(new_elim_graph): Allocate const_dests member.
(clean_elim_graph): Truncate const_dests member.
(delete_elim_graph): Free const_dests member.
@@ -764,7 +1721,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.
@@ -1424,7 +2381,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.
@@ -2177,7 +3134,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.
@@ -2360,7 +3317,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
@@ -3061,7 +4018,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
@@ -3167,7 +4124,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.
@@ -3296,7 +4253,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.
@@ -3987,7 +4944,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,
@@ -4165,81 +5122,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,
@@ -4270,13 +5227,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.
@@ -4358,7 +5315,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):
@@ -5427,7 +6384,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
@@ -5837,7 +6794,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.
@@ -5885,7 +6842,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.
@@ -5917,7 +6874,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
@@ -5952,7 +6909,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
@@ -6150,7 +7107,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.
@@ -6183,7 +7140,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>
@@ -6649,11 +7606,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>
@@ -7656,10 +8613,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>
@@ -8513,7 +9470,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..2af1cce02d6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20090427
+20090504
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index b482d84bea2..34e93141479 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -909,6 +909,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.
@@ -1188,7 +1189,6 @@ OBJS-common = \
params.o \
passes.o \
plugin.o \
- plugin-version.o \
pointer-set.o \
postreload-gcse.o \
postreload.o \
@@ -1229,6 +1229,7 @@ OBJS-common = \
statistics.o \
stmt.o \
stor-layout.o \
+ store-motion.o \
stringpool.o \
targhooks.o \
timevar.o \
@@ -2544,13 +2545,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)
@@ -2755,7 +2750,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 \
@@ -2775,6 +2770,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) \
@@ -2877,7 +2877,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) \
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 46ae18aea16..c11325e1197 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,440 @@
+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..83da18b4e5b 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
diff --git a/gcc/ada/clean.adb b/gcc/ada/clean.adb
index ce77b60577e..04512e7778f 100644
--- a/gcc/ada/clean.adb
+++ b/gcc/ada/clean.adb
@@ -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/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/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 0ffbb453ade..516905f8873 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;
@@ -506,7 +507,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);
@@ -2774,10 +2775,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 +2836,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
@@ -3106,8 +3118,6 @@ package body Exp_Aggr is
end;
end if;
- <<Next_Comp>>
-
Next (Comp);
end loop;
@@ -3735,24 +3745,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 +5018,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.
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 8ffb6e0cead..5ba57dea134 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,
@@ -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
@@ -4622,6 +4653,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.
@@ -5629,7 +5680,7 @@ 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
@@ -8634,7 +8685,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 +8706,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..42f6199f2af 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -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))));
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..23dc728f988 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- --
@@ -6965,57 +6965,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_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/freeze.adb b/gcc/ada/freeze.adb
index 7866432844e..fdacb091afc 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -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);
@@ -2583,29 +2578,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);
@@ -3598,10 +3574,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 +5117,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-expect.adb b/gcc/ada/g-expect.adb
index 124d43983a5..256f2564d8f 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- --
@@ -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..31dda4134b1 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- --
@@ -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
diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb
index cc31d142c57..4caa5f47244 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- --
@@ -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 --
-----------------
@@ -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..c77048671bc 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,49 @@ 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'Address;
pragma Import (Ada, Iovec);
+ pragma Unreferenced (Flags);
+
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'll use C_Recv instead. Note that this means the Flags
+ -- argument is ignored.
+
for J in Iovec'Range loop
Res := C_Recv
- (Fd,
+ (S,
Iovec (J).Base.all'Address,
C.int (Iovec (J).Length),
0);
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 --
@@ -372,26 +383,37 @@ 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'Address;
pragma Import (Ada, Iovec);
+ pragma Unreferenced (Flags);
+
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. Note that this means the Flags
+ -- argument is ignored.
+
for J in Iovec'Range loop
Res := C_Sendto
- (Fd,
+ (S,
Iovec (J).Base.all'Address,
C.int (Iovec (J).Length),
Flags => 0,
@@ -399,13 +421,13 @@ package body GNAT.Sockets.Thin is
Tolen => 0);
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..7b24eeec4e1 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;
@@ -143,6 +143,11 @@ package GNAT.Sockets.Thin is
From : Sockaddr_In_Access;
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,6 +155,11 @@ 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;
@@ -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..14576805602 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- --
@@ -91,6 +91,18 @@ package body GNAT.Sockets.Thin is
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;
@@ -277,6 +289,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 --
--------------
@@ -416,72 +476,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..2fd5009db15 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;
@@ -146,6 +146,11 @@ package GNAT.Sockets.Thin is
From : Sockaddr_In_Access;
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,6 +158,11 @@ 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;
@@ -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..0f682f4c04e 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- --
@@ -102,6 +102,18 @@ package body GNAT.Sockets.Thin is
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;
@@ -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 --
--------------
diff --git a/gcc/ada/g-socthi-vxworks.ads b/gcc/ada/g-socthi-vxworks.ads
index 04e1278f2be..4b6bd34d080 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;
@@ -144,6 +144,11 @@ package GNAT.Sockets.Thin is
From : Sockaddr_In_Access;
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,6 +156,11 @@ 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;
@@ -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..daf69140ed1 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- --
@@ -98,6 +98,18 @@ package body GNAT.Sockets.Thin is
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;
@@ -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 --
--------------
diff --git a/gcc/ada/g-socthi.ads b/gcc/ada/g-socthi.ads
index 303a942d385..b5186d062c6 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;
@@ -145,6 +145,11 @@ package GNAT.Sockets.Thin is
From : Sockaddr_In_Access;
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,6 +157,11 @@ 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;
@@ -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-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..a5b29b97f54 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -2460,21 +2460,19 @@ 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 \
@@ -2865,9 +2863,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
@@ -3620,18 +3617,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 \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 31f0a7b45c9..c19c0995941 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2081,6 +2081,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 +2092,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 +2303,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..509717f681d 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -1542,19 +1542,30 @@ 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
+@var{T} is created on the Ada side with no explicit constructor. The
+second form covers all the non-default constructors of the type.
+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:
+@var{T}), 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 extension aggregate for an object of a type derived from @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
@@ -1564,8 +1575,10 @@ 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:
+In the case of objects of derived types, in addition to the use of Ada
+2005 limited aggregates and extended return statements, you may also
+use one of the following two possible forms for declaring and creating
+an object:
@itemize @bullet
@item @code{New_Object : Derived_T}
@@ -1580,9 +1593,7 @@ constructor is called and the extension aggregate indicates the explicit
values of the extension fields.
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.
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index df66228bb00..4ab16ee75a9 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -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,176 @@ 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.
+
+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 extended 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 +4175,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})
@@ -20270,7 +20454,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 +20469,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
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index 86cd0955c53..8310cd2b697 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
@@ -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;
-------------------
@@ -1905,7 +1832,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 +1843,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 +1944,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 +1966,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 +2153,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 +2166,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 +2185,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 +2197,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 +2206,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 +2250,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/initialize.c b/gcc/ada/initialize.c
index 8ad15bd8e91..705cbf20e3c 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -130,6 +130,7 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
int last;
int argc_expanded = 0;
TCHAR result [MAX_PATH];
+ int quoted;
wargv = CommandLineToArgvW (GetCommandLineW(), &wargc);
@@ -146,9 +147,12 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
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;
@@ -173,8 +177,19 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
}
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. */
+ if (quoted)
+ {
+ int len = _tcslen (wargv[k]);
+
+ /* Remove ending quote */
+ wargv[k][len-1] = _T('\0');
+ append_arg
+ (&argc_expanded, &wargv[k][1], &gnat_argv, &last);
+ }
+ else
+ append_arg (&argc_expanded, wargv[k], &gnat_argv, &last);
}
}
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..3206bc1b009 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);
@@ -8252,8 +8159,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 +8168,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..3c9b4d97242 100644
--- a/gcc/ada/makeutl.ads
+++ b/gcc/ada/makeutl.ads
@@ -130,12 +130,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/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..49bd50e0e4c 100644
--- a/gcc/ada/prj-dect.adb
+++ b/gcc/ada/prj-dect.adb
@@ -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;
@@ -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..5a76d397a29 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,33 @@ 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);
+ Current_Dir : String);
-- 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 +307,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 +321,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 +328,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 +372,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 +381,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,7 +406,7 @@ 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;
@@ -440,8 +430,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 +439,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 +454,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.
@@ -531,7 +518,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);
-- 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, Current_Dir);
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;
@@ -1748,15 +1731,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 +1748,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 +1780,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 +1801,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 +1814,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 +1870,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 +1880,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 +1905,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 +1918,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 +1940,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 +1960,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 +1975,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 +1993,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 +2013,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 +2032,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 +2043,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 +2052,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 +2069,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 +2084,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 +2115,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 +2133,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 +2150,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 +2159,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 +2184,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 +2315,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 +2335,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 +2362,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 +2426,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 +2439,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 +2451,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 +2472,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 +2504,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 +2543,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 +2561,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 +2638,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 +3013,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 +3023,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 +3069,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 +3087,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 +3101,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 +3129,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 +3143,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 +3175,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 +3218,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 +3242,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 +3300,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 +3320,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
@@ -3362,10 +3343,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)
+ Current_Dir : String)
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 +3387,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 +3408,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 +3447,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 +3456,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;
@@ -3494,54 +3471,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 +3521,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,21 +3540,21 @@ 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,
+ Project.Directory.Display_Name,
+ Project.Library_Dir.Name,
+ Project.Library_Dir.Display_Name,
Create => "library",
Current_Dir => Current_Dir,
Location => Lib_Dir.Location,
- Externally_Built => Data.Externally_Built);
+ Externally_Built => Project.Externally_Built);
end if;
- if Data.Library_Dir = No_Path_Information then
+ if Project.Library_Dir = No_Path_Information then
-- Get the absolute name of the library directory that
-- does not exist, to report an error.
@@ -3596,7 +3569,7 @@ package body Prj.Nmsc is
File_Name_Type (Lib_Dir.Value);
else
- Get_Name_String (Data.Directory.Display_Name);
+ Get_Name_String (Project.Directory.Display_Name);
if Name_Buffer (Name_Len) /= Directory_Separator then
Name_Len := Name_Len + 1;
@@ -3621,31 +3594,32 @@ package body Prj.Nmsc is
-- 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 +3638,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 +3667,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 +3681,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 +3689,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 +3704,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 +3726,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 +3739,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,15 +3756,15 @@ 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,
+ Project.Directory.Display_Name,
+ Project.Library_ALI_Dir.Name,
+ Project.Library_ALI_Dir.Display_Name,
Create => "library ALI",
Current_Dir => Current_Dir,
Location => Lib_ALI_Dir.Location,
- Externally_Built => Data.Externally_Built);
+ Externally_Built => Project.Externally_Built);
- if Data.Library_ALI_Dir = No_Path_Information then
+ if Project.Library_ALI_Dir = No_Path_Information then
-- Get the absolute name of the library ALI directory that
-- does not exist, to report an error.
@@ -3802,7 +3779,7 @@ package body Prj.Nmsc is
File_Name_Type (Lib_Dir.Value);
else
- Get_Name_String (Data.Directory.Display_Name);
+ Get_Name_String (Project.Directory.Display_Name);
if Name_Buffer (Name_Len) /= Directory_Separator then
Name_Len := Name_Len + 1;
@@ -3825,35 +3802,36 @@ package body Prj.Nmsc is
end;
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 +3851,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 +3864,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 +3883,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 +3898,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 +3913,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 +3934,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 +3954,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 +3974,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 +3982,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 +3997,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 +4007,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 +4032,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 +4070,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 +4081,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 +4119,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 +4157,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 +4166,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 +4203,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 +4239,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 +4248,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 +4267,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 +4287,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 +4324,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 +4338,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 +4364,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 +4387,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 +4397,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 +4408,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 +4426,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 +4454,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 +4501,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 +4562,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 +4614,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 +4667,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 +4689,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 +4705,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 +4722,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 +4769,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 +4779,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
@@ -4860,17 +4828,17 @@ package body Prj.Nmsc is
(Project,
In_Tree,
Dir_Id,
- Data.Directory.Display_Name,
- Data.Library_Src_Dir.Name,
- Data.Library_Src_Dir.Display_Name,
+ Project.Directory.Display_Name,
+ Project.Library_Src_Dir.Name,
+ Project.Library_Src_Dir.Display_Name,
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 Project.Library_Src_Dir = No_Path_Information then
-- Get the absolute name of the library directory that does
-- not exist, to report an error.
@@ -4884,7 +4852,7 @@ package body Prj.Nmsc is
Err_Vars.Error_Msg_File_1 := Dir_Id;
else
- Get_Name_String (Data.Directory.Name);
+ Get_Name_String (Project.Directory.Name);
if Name_Buffer (Name_Len) /=
Directory_Separator
@@ -4913,30 +4881,31 @@ package body Prj.Nmsc is
-- 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 +4913,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 +4937,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 +4965,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 +4990,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 +5017,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 +5028,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 +5068,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 +5080,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 +5095,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 +5113,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 +5126,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 +5136,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 +5153,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 +5295,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 +5363,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 +5465,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 +5500,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 +5523,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 +5598,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 +5627,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 +5640,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,
@@ -5709,7 +5680,7 @@ package body Prj.Nmsc is
(Project => Project,
In_Tree => In_Tree,
Name => From,
- Parent => Data.Directory.Display_Name,
+ Parent => Project.Directory.Display_Name,
Dir => Path_Name,
Display => Display_Path_Name,
Current_Dir => Current_Dir);
@@ -5721,7 +5692,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,
@@ -5775,7 +5746,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 +5769,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 +5785,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
@@ -5842,15 +5813,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
@@ -5871,26 +5841,26 @@ package body Prj.Nmsc is
(Project,
In_Tree,
File_Name_Type (Object_Dir.Value),
- Data.Directory.Display_Name,
- Data.Object_Directory.Name,
- Data.Object_Directory.Display_Name,
+ Project.Directory.Display_Name,
+ Project.Object_Directory.Name,
+ Project.Object_Directory.Display_Name,
Create => "object",
Location => Object_Dir.Location,
Current_Dir => Current_Dir,
- Externally_Built => Data.Externally_Built);
+ Externally_Built => Project.Externally_Built);
- if Data.Object_Directory = No_Path_Information then
+ if Project.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
+ if not Project.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);
+ Project.Location);
end if;
-- Do not keep a nil Object_Directory. Set it to the specified
@@ -5898,14 +5868,14 @@ package body Prj.Nmsc is
-- tools that recover from errors; for example, these tools
-- could create the non existent directory.
- Data.Object_Directory.Display_Name :=
+ Project.Object_Directory.Display_Name :=
Path_Name_Type (Object_Dir.Value);
- Data.Object_Directory.Name :=
+ Project.Object_Directory.Name :=
Path_Name_Type (Canonical_Case_File_Name (Object_Dir.Value));
end if;
end if;
- elsif Data.Object_Directory /= No_Path_Information and then
+ elsif Project.Object_Directory /= No_Path_Information and then
Subdirs /= null
then
Name_Len := 1;
@@ -5914,22 +5884,22 @@ package body Prj.Nmsc is
(Project,
In_Tree,
Name_Find,
- Data.Directory.Display_Name,
- Data.Object_Directory.Name,
- Data.Object_Directory.Display_Name,
+ Project.Directory.Display_Name,
+ Project.Object_Directory.Name,
+ Project.Object_Directory.Display_Name,
Create => "object",
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 +5907,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 +5925,30 @@ 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,
+ Project.Directory.Display_Name,
+ Project.Exec_Directory.Name,
+ Project.Exec_Directory.Display_Name,
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 Project.Exec_Directory = No_Path_Information 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 +5964,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 +5981,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 +5994,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 +6006,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 +6053,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 +6076,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",
@@ -6724,18 +6692,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 +6722,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 +6772,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 +6844,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 +6888,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 +6972,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 +7008,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 +7082,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 +7121,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 +7133,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 +7143,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,7 +7266,7 @@ 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;
@@ -7328,7 +7294,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,7 +7344,7 @@ 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;
@@ -7439,7 +7405,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;
@@ -7475,7 +7440,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,7 +7485,7 @@ 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,
@@ -7576,7 +7541,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 +7566,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 +7578,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 +7622,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 +7639,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 +7727,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 +7828,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 +7868,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 +7910,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 +8004,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 +8056,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 +8161,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 +8213,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 +8239,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 +8250,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 +8258,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 +8286,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 +8354,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 +8495,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 +8504,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 +8556,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 +8568,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..86f47ec67d2 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,7 +45,8 @@ 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)
+ Reset_Tree : Boolean := True;
+ Is_Config_File : Boolean)
is
Project_Node_Tree : constant Project_Node_Tree_Ref :=
new Project_Node_Tree_Data;
@@ -66,7 +67,8 @@ 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
@@ -80,7 +82,8 @@ package body Prj.Pars is
Report_Error => null,
When_No_Sources => When_No_Sources,
Reset_Tree => Reset_Tree,
- Current_Dir => Current_Dir);
+ Current_Dir => Current_Dir,
+ Is_Config_File => Is_Config_File);
Prj.Err.Finalize;
if not Success then
diff --git a/gcc/ada/prj-pars.ads b/gcc/ada/prj-pars.ads
index 8c22ba48141..02f149131a9 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- --
@@ -36,7 +36,8 @@ 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);
+ Reset_Tree : Boolean := True;
+ Is_Config_File : Boolean);
-- Parse a project files and all its imported project files, in the
-- project tree In_Tree.
--
@@ -53,5 +54,8 @@ package Prj.Pars is
--
-- 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..f95f210a50e 100644
--- a/gcc/ada/prj-proc.ads
+++ b/gcc/ada/prj-proc.ads
@@ -40,7 +40,8 @@ package Prj.Proc is
Report_Error : Put_Line_Access;
When_No_Sources : Error_Warning := Error;
Reset_Tree : Boolean := True;
- Current_Dir : String := "");
+ Current_Dir : String := "";
+ Is_Config_File : Boolean);
-- 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.
@@ -54,10 +55,12 @@ package Prj.Proc is
-- 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.
+ --
+ -- Is_Config_File should be true if Project is a config file (.cgpr)
procedure Process_Project_Tree_Phase_1
(In_Tree : Project_Tree_Ref;
@@ -77,7 +80,8 @@ package 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);
-- See documentation of parameters in procedure Process above
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..83f49442617 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -99,12 +99,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 +154,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 +318,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 +392,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 +598,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 +889,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 +900,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 +922,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 +1115,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 +1314,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 +1415,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 +1474,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 +1547,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..d05aef01162 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 --
@@ -668,9 +670,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 +799,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 +816,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 +1335,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 +1389,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 +1438,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/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c
index c3511b9b52f..24555f1278a 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 (__VMS) || 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-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/sem.adb b/gcc/ada/sem.adb
index 2f8192b20cb..084a7200a06 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
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 86c74cf6535..9b5efbccd42 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -2200,7 +2200,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 +2251,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 +2269,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;
@@ -2348,10 +2360,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 +2412,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 +2425,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;
-------------------
@@ -2773,9 +2788,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;
@@ -3116,7 +3131,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 +3261,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 +3278,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 +3302,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;
@@ -3298,99 +3317,220 @@ package body Sem_Aggr is
-- We build a partially initialized aggregate with the
-- values of the discriminants and box initialization
-- for the rest, if other components are present.
+ -- 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.
- declare
+ 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);
-
- 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;
+ 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;
- 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 disciminant 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..449b0556c85 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- --
@@ -420,7 +420,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 +434,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;
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..9a4f1e34b41 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,16 +4360,19 @@ 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.
+ -- Place the context of the compilation this declaration, so that it
+ -- it is processed before the instance in CodePeer.
Decl_Cunit :=
Make_Compilation_Unit (Sloc (N),
- Context_Items => Empty_List,
+ Context_Items => Context_Items (Parent (N)),
Unit => Act_Decl,
Aux_Decls_Node =>
Make_Compilation_Unit_Aux (Sloc (N)));
Set_Parent_Spec (Act_Decl, Parent_Spec (N));
+ Set_Context_Items (Parent (N), Empty_List);
-- The new compilation unit is linked to its body, but both share the
-- same file, so we do not set Body_Required on the new unit so as not
@@ -5740,9 +5743,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 +6938,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);
@@ -11867,6 +11880,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 +12023,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 +12033,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 +12071,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..61ca642e27b 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -692,8 +692,40 @@ package body Sem_Ch13 is
begin
if Ignore_Rep_Clauses then
- Rewrite (N, Make_Null_Statement (Sloc (N)));
- return;
+ case Id is
+
+ -- The following should be ignored
+
+ 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
+
+ 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);
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index be87d0c8793..9bd9a001260 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- --
@@ -2656,6 +2656,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 +8322,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 +8340,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 +15312,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 +16264,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 +16275,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_ch5.adb b/gcc/ada/sem_ch5.adb
index 5cf092c9917..37975bc73a7 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);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 569800c3b6d..1e7bf886d6a 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);
@@ -4424,10 +4441,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..7b41282288a 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -2370,10 +2370,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 +2392,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;
@@ -5040,10 +5051,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)))
diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index 33044b3a810..c44c8e8d0fc 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- --
@@ -865,7 +865,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;
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..926f750405d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -6201,13 +6201,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..c6f79de4915 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3030,8 +3030,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 +3048,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 +3073,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 +3151,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 +3568,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 +4747,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 +5196,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 +5261,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 +5385,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 +5430,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 +5450,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 +5483,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 +5612,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 +5654,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 +5713,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 +5757,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 +5794,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 +5847,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 +5879,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 +5905,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 +6046,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 +6093,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 +6231,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 +6537,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 +6692,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 +6702,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 +6754,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 +6791,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 +6820,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;
@@ -6968,7 +6977,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 +7016,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 +7726,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;
@@ -7891,8 +7900,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 +7939,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 +7986,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 +8220,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 +8253,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);
@@ -8438,9 +8449,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 +8479,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 +8501,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 +8648,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 +8685,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 +8789,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 +8924,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 +9254,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
@@ -9371,8 +9383,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 +9415,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 +9493,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 +9525,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 +9571,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 +9594,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 +9765,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 +9777,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..d7e85261dfe 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 --
----------------------------------------------
@@ -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/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..32f8bdedd6b 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,11 @@ package body Sinput.L is
-- Preprocess the source if it needs to be preprocessed
if Preprocessing_Needed then
+ -- Set temporarily 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.ads b/gcc/ada/sinput.ads
index e2e4ec0d67f..ca97716145e 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
diff --git a/gcc/ada/targparm.ads b/gcc/ada/targparm.ads
index ff4cd15f7bc..55f56652608 100644
--- a/gcc/ada/targparm.ads
+++ b/gcc/ada/targparm.ads
@@ -446,7 +446,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/xoscons.adb b/gcc/ada/xoscons.adb
index 64a9e799a3f..08aac903c33 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- --
@@ -30,7 +30,7 @@
-- - the preprocessed C file: s-oscons-tmplt.i
-- - the generated assembly file: s-oscons-tmplt.s
--- The contents of s-oscons.ads is written on standard output
+-- The contents of s-oscons.ads is written on standard output.
with Ada.Characters.Handling; use Ada.Characters.Handling;
with Ada.Exceptions; use Ada.Exceptions;
@@ -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..a020f461934 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);
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..e3c91dc635b 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;
}
@@ -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,37 @@ 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)
+ {
+ 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)
+ {
+ 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 267900e4b35..c38ec8bd994 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -736,6 +736,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 },
@@ -1773,6 +1774,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)
@@ -3779,8 +3784,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;
@@ -3789,19 +3793,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;
}
@@ -3864,31 +3868,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 ();
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 1e313cf9e8e..14448800ce0 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,
@@ -817,7 +821,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-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-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 4dffc78f14d..967be5200a7 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -400,11 +400,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 ())
{
@@ -1057,11 +1053,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)
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 7fe7fae1cda..cdc2cee4f68 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -5784,7 +5784,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-pretty-print.c b/gcc/c-pretty-print.c
index 0f9164adb3f..29842b57f45 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-typeck.c b/gcc/c-typeck.c
index b2d21095407..f00e0dbcf5e 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);
}
@@ -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++"));
}
}
@@ -7024,6 +7003,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 +8867,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 +8891,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
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..03d0996989a 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));
@@ -2078,7 +2078,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/cgraphunit.c b/gcc/cgraphunit.c
index a99b7dfe96d..7b87d38060d 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"
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 db91e3ba8de..7bb6f011a22 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
@@ -471,8 +471,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..b75f0d06e8a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -975,6 +975,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 +1015,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 +1380,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"
@@ -2446,6 +2468,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 +2932,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 d4172f5449d..d7aeb5950b9 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -113,6 +113,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
@@ -1043,6 +1049,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.c b/gcc/config/alpha/alpha.c
index 8597e662f44..8a7c313d7b3 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. */
@@ -6357,7 +6357,7 @@ enum alpha_builtin
ALPHA_BUILTIN_max
};
-static unsigned int const code_for_builtin[ALPHA_BUILTIN_max] = {
+static enum insn_code const code_for_builtin[ALPHA_BUILTIN_max] = {
CODE_FOR_builtin_cmpbge,
CODE_FOR_builtin_extbl,
CODE_FOR_builtin_extwl,
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 4df364071ba..433823dbbd0 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
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-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..a7847f3235d 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -1504,6 +1504,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 +3569,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 +3582,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 ();
@@ -14027,7 +14031,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 +14828,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 +14890,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 +15287,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 +15301,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 +15364,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 +16281,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..8d97864861e 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
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 2df4a16d1cf..ef5286ee878 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);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 40835c70f51..7683c380e74 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -545,10 +545,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;
@@ -2843,8 +2854,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..45d02c4c414 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)))
diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h
index 3e9ae4317c3..e92a7b6e48d 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);
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index adb72b077a8..63f60e1f60c 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)
@@ -2331,20 +2332,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 +3641,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 +3781,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 +3830,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 +3891,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 +3900,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 +4012,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 +4034,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 +4086,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 +4168,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 +4217,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 +4278,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 +4651,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 +4669,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 +6227,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..f7f2cd492eb 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -1322,7 +1322,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/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/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.c b/gcc/config/i386/i386.c
index 72e9e7172e9..5e7689b837d 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5466,7 +5466,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);
@@ -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;
+
+ 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 */
- /* fild/fist don't get size suffixes if using Intel opcodes. */
+ 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,
@@ -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
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index d315580139c..29794313716 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.
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.h b/gcc/config/iq2000/iq2000.h
index 916e4060a5e..acbe569503f 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}, \
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index cb09aef254c..bd33934dbed 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
diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h
index ee28bb73eaa..5496640b040 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.
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index bb28e887aa9..11477c61ba9 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.
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.c b/gcc/config/mips/mips.c
index a677f9392b4..e03e6adb304 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);
@@ -8671,16 +8673,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 +8690,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 +8745,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 +8764,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 +8943,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 +11649,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
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 7e3d57e7300..e14073ab2be 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
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.h b/gcc/config/mn10300/mn10300.h
index b6486d9cf69..2737d15345c 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
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/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/picochip.h b/gcc/config/picochip/picochip.h
index 24613d634d7..497c1307839 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}}
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.c b/gcc/config/rs6000/rs6000.c
index 91b44affe42..00cf3bdcd2f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -7691,9 +7691,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 +11545,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:
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 7bffea52a41..5feae4d0db9 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
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 10fdb4e267c..61471bb41ba 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[] =
{
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index c9eb60248fe..c62f6bfa621 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 }, \
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..f8a046b81e5 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -224,7 +224,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);
@@ -1218,7 +1218,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 +1290,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 +1299,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 +5126,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 +6349,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 +6634,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 +8453,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 +8697,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 +8845,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
@@ -9623,7 +9624,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..5f5006f7ff4 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
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.c b/gcc/config/sparc/sparc.c
index 61c5700fa1b..60067b5dfdd 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -689,7 +689,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;
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..d8376d86d0f 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -51,6 +51,8 @@ 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,
@@ -75,6 +77,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..f5041658223 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -1586,6 +1586,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 +1605,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 +2764,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 +3521,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)
@@ -5951,7 +6029,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 +6057,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 +6442,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..f8375f18c82 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}, \
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/configure b/gcc/configure
index d08ec85efb4..7fa46750669 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1090,6 +1090,8 @@ compiler-probe feature is also recommended.
--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
@@ -14102,6 +14104,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.
@@ -15010,13 +15036,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:15013: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:15039: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:15016: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:15042: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:15019: output\"" >&5)
+ (eval echo "\"\$as_me:15045: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -16173,7 +16199,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 16176 "configure"' > conftest.$ac_ext
+ echo '#line 16202 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -17472,11 +17498,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:17475: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17501: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:17479: \$? = $ac_status" >&5
+ echo "$as_me:17505: \$? = $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.
@@ -17811,11 +17837,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:17814: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17840: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:17818: \$? = $ac_status" >&5
+ echo "$as_me:17844: \$? = $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.
@@ -17916,11 +17942,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:17919: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17945: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:17923: \$? = $ac_status" >&5
+ echo "$as_me:17949: \$? = $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
@@ -17971,11 +17997,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:17974: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18000: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:17978: \$? = $ac_status" >&5
+ echo "$as_me:18004: \$? = $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
@@ -20783,7 +20809,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20786 "configure"
+#line 20812 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -20879,7 +20905,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 20882 "configure"
+#line 20908 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -24744,6 +24770,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 8527e434d26..fab1d03d480 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1806,6 +1806,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
@@ -3795,6 +3821,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/cp/ChangeLog b/gcc/cp/ChangeLog
index e15834dd945..785dbb1b6b2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,58 @@
+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
+ * cvt.c (convert_to_void) <case INDIRECT_REF>: Only warn about
+ -Wunused-value if implicit.
+
2009-04-24 Ian Lance Taylor <iant@google.com>
* call.c (build_temp): Change 0 to enum constant.
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 6d35245e823..c86fbdfe0da 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -787,7 +787,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
make it impossible to ignore the reference return value from functions. We
issue warnings in the confusing cases.
- IMPLICIT is tells us the context of an implicit void conversion. */
+ IMPLICIT is non-NULL iff an expression is being implicitly converted; it
+ is NULL when the user is explicitly converting an expression to void via
+ a cast. When non-NULL, IMPLICIT is a string indicating the context of
+ the implicit conversion. */
tree
convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
@@ -885,6 +888,7 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
- automatic dereferencing of references, since the user cannot
control it. (See also warn_if_unused_value() in stmt.c.) */
if (warn_unused_value
+ && implicit
&& (complain & tf_warning)
&& !TREE_NO_WARNING (expr)
&& !is_reference)
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/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/semantics.c b/gcc/cp/semantics.c
index 50e036d40ee..dd84891d73b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3648,7 +3648,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;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 69d5529476d..5486c546b68 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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));
}
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 5a2f8f0c505..82dd988a86c 100644
--- a/gcc/dbgcnt.def
+++ b/gcc/dbgcnt.def
@@ -145,8 +145,7 @@ DEBUG_COUNTER (auto_inc_dec)
DEBUG_COUNTER (ccp)
DEBUG_COUNTER (cfg_cleanup)
DEBUG_COUNTER (cse2_move2add)
-DEBUG_COUNTER (cprop1)
-DEBUG_COUNTER (cprop2)
+DEBUG_COUNTER (cprop)
DEBUG_COUNTER (dce)
DEBUG_COUNTER (dce_fast)
DEBUG_COUNTER (dce_ud)
@@ -155,17 +154,17 @@ 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 (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)
@@ -177,5 +176,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/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..0be7057fd31 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -969,4 +969,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-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..ab3a661bbc1 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);
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..4e06be3daca 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2153,7 +2153,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.
@@ -4422,7 +4422,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.
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 209c342f242..fc0450e8841 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -3157,7 +3157,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
@@ -6216,8 +6216,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
@@ -6781,13 +6781,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.
@@ -9119,7 +9119,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},
@@ -9371,7 +9371,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.
@@ -9742,7 +9742,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
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..7c4da3192c5 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
@@ -6116,7 +6116,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..4765cf6401a 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.
@@ -8978,7 +8981,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/dwarf2out.c b/gcc/dwarf2out.c
index 3c72dc69ffd..f441fb80efb 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;
};
@@ -4995,7 +4995,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 +6001,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;
diff --git a/gcc/except.c b/gcc/except.c
index 5b8ed7c3743..3ba3b67a197 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/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..c3e4d818cee 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6992,6 +6992,26 @@ expand_constructor (tree exp, rtx target, enum expand_modifier modifier,
return target;
}
+/* 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;
+}
+
/* expand_expr: generate code for computing expression EXP.
An rtx for the computed value is returned. The value is never null.
@@ -7130,6 +7150,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, \
@@ -8322,27 +8344,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 +8380,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 +8509,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 +8545,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 +8645,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 +8713,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 +8743,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..14b9f100b51 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)))
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index daafc06d079..e60eca618d3 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,30 @@
+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/expr.c b/gcc/fortran/expr.c
index c70d4d1e7a1..e76197e5338 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3070,8 +3070,8 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
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;
if (ref->type == REF_ARRAY && ref->next == NULL)
{
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 81e4591b9be..c67e99400f2 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -3310,7 +3310,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/resolve.c b/gcc/fortran/resolve.c
index 75078699168..fe79e4a6703 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9244,7 +9244,10 @@ resolve_symbol (gfc_symbol *sym)
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;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 2b67c6ddcd3..a541a79eb33 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2782,7 +2782,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);
}
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 8705b94dd8d..1d6e8bb3b51 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, \
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/fwprop.c b/gcc/fwprop.c
index a01de13e3c7..11c948f2127 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -694,7 +694,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++;
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/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 43fed45734b..3a86dcfd4da 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -856,7 +856,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..6ea1470df57 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;
}
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..24481d15c43 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))
@@ -7184,7 +7189,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/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 9575468ec7c..41791d463c5 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 36cb5f3f5f9..fce851e0eef 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..5b1670e0de1 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.
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/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/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 659c1050cf9..1170967b949 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'. */
@@ -372,7 +369,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 *,
@@ -1572,19 +1568,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.
@@ -2101,21 +2088,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 c0643bea178..26804df7a7b 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -758,7 +758,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
@@ -775,7 +780,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);
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..a8c2eeaffb2 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,23 @@ 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/print-tree.c b/gcc/print-tree.c
index 24ff249c108..2e514436394 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -896,14 +896,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/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/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/target-def.h b/gcc/target-def.h
index 7ff4ed624ea..30172d0e693 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -480,7 +480,8 @@
/* 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
diff --git a/gcc/target.h b/gcc/target.h
index ed08a09853a..d3a4af6c31f 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
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index c0bcac0d054..7035c494331 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -576,6 +576,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..cbd6e9085dc 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -89,6 +89,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 4e1816a8ade..8e85e53f509 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,423 @@
+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
+ * g++.dg/warn/Wunused-15.C: New test.
+
2009-04-26 Michael Matz <matz@suse.de>
Expand from SSA.
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/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/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/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/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/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/Wunused-15.C b/gcc/testsuite/g++.dg/warn/Wunused-15.C
new file mode 100644
index 00000000000..efaebc006e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-15.C
@@ -0,0 +1,11 @@
+// PR c++/39875
+// { dg-do compile }
+// { dg-options "-Wunused-value" }
+
+int *i;
+void
+foo ()
+{
+ *i++; // { dg-warning "value computed is not used" }
+ (void) *i++; // { dg-bogus "value computed is not used" }
+}
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++.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/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/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.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/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-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/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/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/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/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/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-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/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/vect-35.c b/gcc/testsuite/gcc.dg/vect/vect-35.c
index c6c3bf33860..62782e75799 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-35.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-35.c
@@ -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.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/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/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/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/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/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/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/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 b44d502127a..66324c5a9c7 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")
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 2e35e2fb1ec..5a2aff2e7c4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1146,10 +1146,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
@@ -1713,6 +1717,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 15180c36f95..28f5d0c4b17 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -132,6 +132,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;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 329932dd314..b5c67cd8a08 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)
@@ -3553,7 +3560,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 +3573,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;
}
@@ -3742,7 +3760,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)
@@ -3765,7 +3783,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 +3806,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:
@@ -4313,6 +4331,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 +4375,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)
{
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-flow-inline.h b/gcc/tree-flow-inline.h
index 1298f5cc585..5be4f8597b2 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 93448802d3f..b134ae53d15 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -705,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;
}
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-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 e7c2a27ea08..78b239b3741 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -394,6 +394,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;
@@ -455,11 +456,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-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-pre.c b/gcc/tree-ssa-pre.c
index 61207b2f849..3273c194981 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;
}
}
}
@@ -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..10ec35bd230 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. */
@@ -1573,7 +1577,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..0ab9883887c 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
@@ -2323,7 +2327,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 +2594,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 +2840,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 +3208,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 +3707,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 +3807,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;
- }
-
- /* 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);
+ fprintf (vect_dump, "==> examining statement: ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
- 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;
- }
+ /* 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 (!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 +4136,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 +4154,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 +4293,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 +4324,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 +4412,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.h b/gcc/tree.h
index d6550b51c50..5b8eb21f2e4 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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)
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 9dcae52e344..061ff06dd76 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"
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/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 6763ad1a993..8b2fb21704f 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,10 @@
+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
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/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 868c4f70a0d..6217bb1dd76 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..b42f1799025 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,35 @@
+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/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 186916c2e47..2d046e94f04 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2429,8 +2429,7 @@ dnl is intended to be an all-or-nothing switch, so all the atomic operations
dnl that are used should be checked.
dnl
dnl Note:
-dnl libgomp and libgfortran do this with a link test, instead of an asm test.
-dnl see: CHECK_SYNC_FETCH_AND_ADD
+dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
dnl
dnl Defines:
dnl _GLIBCXX_ATOMIC_BUILTINS_1
@@ -2442,12 +2441,110 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
old_CXXFLAGS="$CXXFLAGS"
-
+
+ # Do link tests if possible, instead asm tests.
+ if test x$gcc_no_link != xyes; then
+
+ # Can do link tests.
+
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ AC_MSG_CHECKING([for atomic builtins for bool])
+ AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef bool atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_bool=yes],
+ [glibcxx_cv_atomic_bool=no])
+ ])
+ if test $glibcxx_cv_atomic_bool = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
+ [Define if builtin atomic operations for bool are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_bool)
+
+ AC_MSG_CHECKING([for atomic builtins for short])
+ AC_CACHE_VAL(glibcxx_cv_atomic_short, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef short atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_short=yes],
+ [glibcxx_cv_atomic_short=no])
+ ])
+ if test $glibcxx_cv_atomic_short = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
+ [Define if builtin atomic operations for short are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_short)
+
+ AC_MSG_CHECKING([for atomic builtins for int])
+ AC_CACHE_VAL(glibcxx_cv_atomic_int, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef int atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_int=yes],
+ [glibcxx_cv_atomic_int=no])
+ ])
+ if test $glibcxx_cv_atomic_int = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
+ [Define if builtin atomic operations for int are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_int)
+
+ AC_MSG_CHECKING([for atomic builtins for long long])
+ AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
+ AC_TRY_LINK(
+ [ ],
+ [typedef long long atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();],
+ [glibcxx_cv_atomic_long_long=yes],
+ [glibcxx_cv_atomic_long_long=no])
+ ])
+ if test $glibcxx_cv_atomic_long_long = yes; then
+ AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
+ [Define if builtin atomic operations for long long are supported on this host.])
+ fi
+ AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
+
+ else
+
+ # Do asm tests.
+
# Compile unoptimized.
CXXFLAGS='-O0 -S'
- # Fake what AC_TRY_COMPILE does, without linking as this is
- # unnecessary for a builtins test.
+ # Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
[#]line __oline__ "configure"
@@ -2469,14 +2566,14 @@ EOF
AC_MSG_CHECKING([for atomic builtins for bool])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsb=no
+ glibcxx_cv_atomic_bool=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
[Define if builtin atomic operations for bool are supported on this host.])
- enable_atomic_builtinsb=yes
+ glibcxx_cv_atomic_bool=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsb)
+ AC_MSG_RESULT($glibcxx_cv_atomic_bool)
rm -f conftest*
cat > conftest.$ac_ext << EOF
@@ -2499,14 +2596,14 @@ EOF
AC_MSG_CHECKING([for atomic builtins for short])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinss=no
+ glibcxx_cv_atomic_short=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
[Define if builtin atomic operations for short are supported on this host.])
- enable_atomic_builtinss=yes
+ glibcxx_cv_atomic_short=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinss)
+ AC_MSG_RESULT($glibcxx_cv_atomic_short)
rm -f conftest*
cat > conftest.$ac_ext << EOF
@@ -2530,14 +2627,14 @@ EOF
AC_MSG_CHECKING([for atomic builtins for int])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsi=no
+ glibcxx_cv_atomic_int=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
[Define if builtin atomic operations for int are supported on this host.])
- enable_atomic_builtinsi=yes
+ glibcxx_cv_atomic_int=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsi)
+ AC_MSG_RESULT($glibcxx_cv_atomic_int)
rm -f conftest*
cat > conftest.$ac_ext << EOF
@@ -2560,22 +2657,23 @@ EOF
AC_MSG_CHECKING([for atomic builtins for long long])
if AC_TRY_EVAL(ac_compile); then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsll=no
+ glibcxx_cv_atomic_long_long=no
else
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
[Define if builtin atomic operations for long long are supported on this host.])
- enable_atomic_builtinsll=yes
+ glibcxx_cv_atomic_long_long=yes
fi
fi
- AC_MSG_RESULT($enable_atomic_builtinsll)
+ AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
rm -f conftest*
+ fi
CXXFLAGS="$old_CXXFLAGS"
AC_LANG_RESTORE
# Set atomicity_dir to builtins if either of above tests pass.
- if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then
+ if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
atomicity_dir=cpu/generic/atomicity_builtins
fi
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..98429fb719b 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -14757,14 +14757,336 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
old_CXXFLAGS="$CXXFLAGS"
+ # Do link tests if possible, instead asm tests.
+ if test x$gcc_no_link != xyes; then
+
+ # Can do link tests.
+
+ CXXFLAGS="$CXXFLAGS -fno-exceptions"
+
+ echo "$as_me:$LINENO: checking for atomic builtins for bool" >&5
+echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6
+ if test "${glibcxx_cv_atomic_bool+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+typedef bool atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_atomic_bool=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_atomic_bool=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+ if test $glibcxx_cv_atomic_bool = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_ATOMIC_BUILTINS_1 1
+_ACEOF
+
+ fi
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_bool" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_bool" >&6
+
+ echo "$as_me:$LINENO: checking for atomic builtins for short" >&5
+echo $ECHO_N "checking for atomic builtins for short... $ECHO_C" >&6
+ if test "${glibcxx_cv_atomic_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+typedef short atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_atomic_short=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_atomic_short=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+ if test $glibcxx_cv_atomic_short = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_ATOMIC_BUILTINS_2 1
+_ACEOF
+
+ fi
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_short" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_short" >&6
+
+ echo "$as_me:$LINENO: checking for atomic builtins for int" >&5
+echo $ECHO_N "checking for atomic builtins for int... $ECHO_C" >&6
+ if test "${glibcxx_cv_atomic_int+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+typedef int atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_atomic_int=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_atomic_int=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+ if test $glibcxx_cv_atomic_int = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_ATOMIC_BUILTINS_4 1
+_ACEOF
+
+ fi
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_int" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_int" >&6
+
+ echo "$as_me:$LINENO: checking for atomic builtins for long long" >&5
+echo $ECHO_N "checking for atomic builtins for long long... $ECHO_C" >&6
+ if test "${glibcxx_cv_atomic_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ if test x$gcc_no_link = xyes; then
+ { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+typedef long long atomic_type;
+ atomic_type c1;
+ atomic_type c2;
+ const atomic_type c3(0);
+ __sync_fetch_and_add(&c1, c2);
+ __sync_val_compare_and_swap(&c1, c3, c2);
+ __sync_lock_test_and_set(&c1, c3);
+ __sync_lock_release(&c1);
+ __sync_synchronize();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_cxx_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ glibcxx_cv_atomic_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+glibcxx_cv_atomic_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+ if test $glibcxx_cv_atomic_long_long = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_ATOMIC_BUILTINS_8 1
+_ACEOF
+
+ fi
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_long_long" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_long_long" >&6
+
+ else
+
+ # Do asm tests.
+
# Compile unoptimized.
CXXFLAGS='-O0 -S'
- # Fake what AC_TRY_COMPILE does, without linking as this is
- # unnecessary for a builtins test.
+ # Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 14767 "configure"
+#line 15089 "configure"
int main()
{
typedef bool atomic_type;
@@ -14788,22 +15110,22 @@ echo $ECHO_N "checking for atomic builtins for bool... $ECHO_C" >&6
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsb=no
+ glibcxx_cv_atomic_bool=no
else
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_ATOMIC_BUILTINS_1 1
_ACEOF
- enable_atomic_builtinsb=yes
+ glibcxx_cv_atomic_bool=yes
fi
fi
- echo "$as_me:$LINENO: result: $enable_atomic_builtinsb" >&5
-echo "${ECHO_T}$enable_atomic_builtinsb" >&6
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_bool" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_bool" >&6
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 14806 "configure"
+#line 15128 "configure"
int main()
{
typedef short atomic_type;
@@ -14827,22 +15149,22 @@ echo $ECHO_N "checking for atomic builtins for short... $ECHO_C" >&6
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinss=no
+ glibcxx_cv_atomic_short=no
else
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_ATOMIC_BUILTINS_2 1
_ACEOF
- enable_atomic_builtinss=yes
+ glibcxx_cv_atomic_short=yes
fi
fi
- echo "$as_me:$LINENO: result: $enable_atomic_builtinss" >&5
-echo "${ECHO_T}$enable_atomic_builtinss" >&6
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_short" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_short" >&6
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 14845 "configure"
+#line 15167 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -14867,22 +15189,22 @@ echo $ECHO_N "checking for atomic builtins for int... $ECHO_C" >&6
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsi=no
+ glibcxx_cv_atomic_int=no
else
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_ATOMIC_BUILTINS_4 1
_ACEOF
- enable_atomic_builtinsi=yes
+ glibcxx_cv_atomic_int=yes
fi
fi
- echo "$as_me:$LINENO: result: $enable_atomic_builtinsi" >&5
-echo "${ECHO_T}$enable_atomic_builtinsi" >&6
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_int" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_int" >&6
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 14885 "configure"
+#line 15207 "configure"
int main()
{
typedef long long atomic_type;
@@ -14906,20 +15228,21 @@ echo $ECHO_N "checking for atomic builtins for long long... $ECHO_C" >&6
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
- enable_atomic_builtinsll=no
+ glibcxx_cv_atomic_long_long=no
else
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_ATOMIC_BUILTINS_8 1
_ACEOF
- enable_atomic_builtinsll=yes
+ glibcxx_cv_atomic_long_long=yes
fi
fi
- echo "$as_me:$LINENO: result: $enable_atomic_builtinsll" >&5
-echo "${ECHO_T}$enable_atomic_builtinsll" >&6
+ echo "$as_me:$LINENO: result: $glibcxx_cv_atomic_long_long" >&5
+echo "${ECHO_T}$glibcxx_cv_atomic_long_long" >&6
rm -f conftest*
+ fi
CXXFLAGS="$old_CXXFLAGS"
ac_ext=c
@@ -14930,7 +15253,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Set atomicity_dir to builtins if either of above tests pass.
- if test $enable_atomic_builtinsi = yes || test $enable_atomic_builtinsb = yes ; then
+ if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
atomicity_dir=cpu/generic/atomicity_builtins
fi
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/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.