aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-18 23:50:40 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2009-08-18 23:50:40 +0000
commit3432788f391c5762cbfd5394f8652882e50ec4a3 (patch)
tree8c3f71a1d38386e99fb4aafe79b0ec9473e2bc83
parent70cb9c9191143e6a0637301e6a29d8937cd08403 (diff)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/var-tracking-assignments-branch@150917 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog28
-rw-r--r--MAINTAINERS1
-rw-r--r--boehm-gc/ChangeLog4
-rw-r--r--boehm-gc/configure.ac2
-rwxr-xr-xconfig.guess12
-rwxr-xr-xconfig.sub20
-rw-r--r--config/ChangeLog15
-rw-r--r--config/extensions.m47
-rw-r--r--config/no-executables.m44
-rw-r--r--config/override.m412
-rw-r--r--config/tls.m44
-rwxr-xr-xconfigure16
-rw-r--r--configure.ac16
-rw-r--r--contrib/ChangeLog9
-rwxr-xr-xcontrib/test_summary2
-rw-r--r--fixincludes/ChangeLog33
-rw-r--r--fixincludes/Makefile.in11
-rw-r--r--fixincludes/fixincl.x343
-rw-r--r--fixincludes/inclhack.def129
-rw-r--r--fixincludes/tests/base/complex.h21
-rw-r--r--fixincludes/tests/base/stdint.h39
-rw-r--r--gcc/ChangeLog2100
-rw-r--r--gcc/ChangeLog.graphite5334
-rw-r--r--gcc/ChangeLog.vta4
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in111
-rw-r--r--gcc/aclocal.m410
-rw-r--r--gcc/ada/ChangeLog242
-rw-r--r--gcc/ada/a-caldel-vms.adb11
-rw-r--r--gcc/ada/a-calend-vms.adb15
-rw-r--r--gcc/ada/a-calfor.adb19
-rw-r--r--gcc/ada/a-cdlili.adb10
-rw-r--r--gcc/ada/a-chahan.adb13
-rw-r--r--gcc/ada/a-cidlli.adb10
-rw-r--r--gcc/ada/a-coinve.adb12
-rw-r--r--gcc/ada/a-comlin.adb5
-rw-r--r--gcc/ada/a-crbtgk.adb14
-rw-r--r--gcc/ada/a-crdlli.adb10
-rw-r--r--gcc/ada/a-direct.adb9
-rw-r--r--gcc/ada/a-teioed.adb10
-rw-r--r--gcc/ada/adaint.c2
-rw-r--r--gcc/ada/comperr.adb16
-rw-r--r--gcc/ada/exp_ch3.adb14
-rw-r--r--gcc/ada/exp_ch4.adb25
-rw-r--r--gcc/ada/exp_ch7.adb12
-rw-r--r--gcc/ada/exp_ch9.adb62
-rw-r--r--gcc/ada/exp_disp.adb14
-rw-r--r--gcc/ada/exp_util.adb8
-rw-r--r--gcc/ada/frontend.adb2
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in23
-rw-r--r--gcc/ada/gcc-interface/Makefile.in4
-rw-r--r--gcc/ada/gcc-interface/gigi.h3
-rw-r--r--gcc/ada/gcc-interface/trans.c19
-rw-r--r--gcc/ada/gcc-interface/utils.c6
-rw-r--r--gcc/ada/gnat_ugn.texi201
-rw-r--r--gcc/ada/gnatcmd.adb182
-rw-r--r--gcc/ada/make.adb191
-rw-r--r--gcc/ada/mlib-prj.adb102
-rw-r--r--gcc/ada/prj-conf.adb15
-rw-r--r--gcc/ada/prj-env.adb294
-rw-r--r--gcc/ada/prj-nmsc.adb19
-rw-r--r--gcc/ada/prj-part.adb4
-rw-r--r--gcc/ada/prj.adb7
-rw-r--r--gcc/ada/prj.ads25
-rw-r--r--gcc/ada/s-linux-hppa.ads2
-rw-r--r--gcc/ada/s-linux.ads2
-rw-r--r--gcc/ada/s-osinte-kfreebsd-gnu.ads19
-rw-r--r--gcc/ada/s-taprop-posix.adb9
-rw-r--r--gcc/ada/s-tasini.adb7
-rw-r--r--gcc/ada/sem.adb4
-rw-r--r--gcc/ada/sem_cat.adb6
-rw-r--r--gcc/ada/sem_ch10.adb4
-rw-r--r--gcc/ada/sem_ch12.ads16
-rw-r--r--gcc/ada/sem_ch3.adb56
-rw-r--r--gcc/ada/sem_ch3.ads53
-rw-r--r--gcc/ada/sem_ch6.adb19
-rw-r--r--gcc/ada/sem_ch7.adb2
-rw-r--r--gcc/ada/sem_warn.adb6
-rw-r--r--gcc/ada/sem_warn.ads2
-rw-r--r--gcc/ada/switch-c.adb15
-rw-r--r--gcc/ada/sysdep.c13
-rw-r--r--gcc/ada/targparm.adb2
-rw-r--r--gcc/ada/types.ads8
-rw-r--r--gcc/ada/xref_lib.adb8
-rw-r--r--gcc/alias.c20
-rw-r--r--gcc/bb-reorder.c2
-rw-r--r--gcc/builtins.c19
-rw-r--r--gcc/c-common.c33
-rw-r--r--gcc/c-cppbuiltin.c3
-rw-r--r--gcc/c-lex.c2
-rw-r--r--gcc/c-pragma.c8
-rw-r--r--gcc/c-typeck.c11
-rw-r--r--gcc/calls.c107
-rw-r--r--gcc/cfgexpand.c7
-rw-r--r--gcc/cfgloop.c1
-rw-r--r--gcc/cfgloop.h5
-rw-r--r--gcc/cfgloopmanip.c84
-rw-r--r--gcc/combine.c65
-rw-r--r--gcc/common.opt13
-rw-r--r--gcc/config.build20
-rw-r--r--gcc/config.gcc48
-rw-r--r--gcc/config.host28
-rw-r--r--gcc/config.in21
-rw-r--r--gcc/config/alpha/alpha-protos.h14
-rw-r--r--gcc/config/alpha/alpha.c473
-rw-r--r--gcc/config/alpha/alpha.h6
-rw-r--r--gcc/config/alpha/alpha.md46
-rw-r--r--gcc/config/alpha/t-vms41
-rw-r--r--gcc/config/alpha/vms-dwarf2eh.asm2
-rw-r--r--gcc/config/alpha/vms-gcc_shell_handler.c124
-rw-r--r--gcc/config/alpha/vms-unwind.h332
-rw-r--r--gcc/config/alpha/vms.h174
-rw-r--r--gcc/config/alpha/vms64.h34
-rw-r--r--gcc/config/alpha/vms_tramp.asm46
-rw-r--r--gcc/config/arc/arc.c6
-rw-r--r--gcc/config/arm/arm-protos.h4
-rw-r--r--gcc/config/arm/arm.c1095
-rw-r--r--gcc/config/arm/arm.h105
-rw-r--r--gcc/config/arm/bpabi.h14
-rw-r--r--gcc/config/arm/lib1funcs.asm63
-rw-r--r--gcc/config/arm/t-arm-elf7
-rw-r--r--gcc/config/avr/avr.c23
-rw-r--r--gcc/config/avr/avr.h1
-rw-r--r--gcc/config/bfin/bfin.c8
-rw-r--r--gcc/config/cris/cris.c27
-rw-r--r--gcc/config/cris/cris.h14
-rw-r--r--gcc/config/elfos.h49
-rw-r--r--gcc/config/frv/frv.h4
-rw-r--r--gcc/config/i386/att.h3
-rw-r--r--gcc/config/i386/bsd.h1
-rw-r--r--gcc/config/i386/cygwin.h2
-rw-r--r--gcc/config/i386/darwin.h2
-rw-r--r--gcc/config/i386/djgpp-stdint.h62
-rw-r--r--gcc/config/i386/i386-interix.h12
-rw-r--r--gcc/config/i386/i386.c122
-rw-r--r--gcc/config/i386/i386.md4
-rw-r--r--gcc/config/i386/i386elf.h6
-rw-r--r--gcc/config/i386/sse.md49
-rw-r--r--gcc/config/i386/sysv4.h14
-rw-r--r--gcc/config/ia64/fde-glibc.c3
-rw-r--r--gcc/config/ia64/fde-vms.c157
-rw-r--r--gcc/config/ia64/ia64.c10
-rw-r--r--gcc/config/ia64/linux-unwind.h26
-rw-r--r--gcc/config/ia64/t-vms49
-rw-r--r--gcc/config/ia64/unwind-ia64.c99
-rw-r--r--gcc/config/ia64/unwind-ia64.h16
-rw-r--r--gcc/config/ia64/vms-crtinit.asm24
-rw-r--r--gcc/config/ia64/vms-unwind.h307
-rw-r--r--gcc/config/ia64/vms.h231
-rw-r--r--gcc/config/ia64/vms64.h41
-rw-r--r--gcc/config/ia64/vms_symvec_libgcc_s.opt89
-rw-r--r--gcc/config/iq2000/iq2000.c13
-rw-r--r--gcc/config/m32c/m32c.c85
-rw-r--r--gcc/config/m32c/m32c.md2
-rw-r--r--gcc/config/m32c/prologue.md17
-rw-r--r--gcc/config/mcore/mcore.c11
-rw-r--r--gcc/config/mep/mep.c12
-rw-r--r--gcc/config/mips/constraints.md16
-rw-r--r--gcc/config/mips/mips-protos.h7
-rw-r--r--gcc/config/mips/mips.c184
-rw-r--r--gcc/config/mips/mips.h146
-rw-r--r--gcc/config/mips/mips.md145
-rw-r--r--gcc/config/mips/predicates.md33
-rw-r--r--gcc/config/mips/sdemtk.h4
-rw-r--r--gcc/config/mips/sync.md117
-rw-r--r--gcc/config/mmix/mmix.c36
-rw-r--r--gcc/config/mmix/mmix.h17
-rw-r--r--gcc/config/moxie/moxie.c18
-rw-r--r--gcc/config/moxie/moxie.h20
-rw-r--r--gcc/config/moxie/uclinux.h39
-rw-r--r--gcc/config/pa/pa.c25
-rw-r--r--gcc/config/picochip/picochip.c10
-rw-r--r--gcc/config/rs6000/altivec.h59
-rw-r--r--gcc/config/rs6000/altivec.md67
-rw-r--r--gcc/config/rs6000/freebsd.h5
-rw-r--r--gcc/config/rs6000/power7.md318
-rw-r--r--gcc/config/rs6000/ppc-asm.h139
-rw-r--r--gcc/config/rs6000/predicates.md10
-rw-r--r--gcc/config/rs6000/rs6000-c.c242
-rw-r--r--gcc/config/rs6000/rs6000.c713
-rw-r--r--gcc/config/rs6000/rs6000.h11
-rw-r--r--gcc/config/rs6000/rs6000.md233
-rw-r--r--gcc/config/rs6000/rs6000.opt4
-rw-r--r--gcc/config/rs6000/t-rs60002
-rw-r--r--gcc/config/rs6000/vector.md388
-rw-r--r--gcc/config/rs6000/vsx.md1339
-rw-r--r--gcc/config/s390/s390-protos.h2
-rw-r--r--gcc/config/s390/s390.c29
-rw-r--r--gcc/config/s390/s390.h11
-rw-r--r--gcc/config/score/score.c7
-rw-r--r--gcc/config/score/score3.c5
-rw-r--r--gcc/config/score/score7.c5
-rw-r--r--gcc/config/sh/linux-atomic.asm90
-rw-r--r--gcc/config/sh/sh.c55
-rw-r--r--gcc/config/sh/sh.md2
-rw-r--r--gcc/config/sol2.h2
-rw-r--r--gcc/config/sparc/sparc.c58
-rw-r--r--gcc/config/sparc/sparc.h10
-rw-r--r--gcc/config/stormy16/stormy16.c6
-rw-r--r--gcc/config/xtensa/xtensa.c6
-rw-r--r--gcc/config/xtensa/xtensa.h2
-rwxr-xr-xgcc/configure105
-rw-r--r--gcc/configure.ac27
-rw-r--r--gcc/cp/ChangeLog110
-rw-r--r--gcc/cp/call.c86
-rw-r--r--gcc/cp/cp-tree.h5
-rw-r--r--gcc/cp/cvt.c9
-rw-r--r--gcc/cp/decl.c78
-rw-r--r--gcc/cp/decl2.c115
-rw-r--r--gcc/cp/error.c5
-rw-r--r--gcc/cp/init.c30
-rw-r--r--gcc/cp/name-lookup.c28
-rw-r--r--gcc/cp/name-lookup.h1
-rw-r--r--gcc/cp/pt.c81
-rw-r--r--gcc/cp/tree.c13
-rw-r--r--gcc/cp/typeck.c49
-rw-r--r--gcc/doc/extend.texi166
-rw-r--r--gcc/doc/install.texi7
-rw-r--r--gcc/doc/invoke.texi79
-rw-r--r--gcc/doc/md.texi17
-rw-r--r--gcc/doc/options.texi11
-rw-r--r--gcc/doc/tm.texi51
-rw-r--r--gcc/dse.c116
-rw-r--r--gcc/dwarf2out.c72
-rw-r--r--gcc/except.c302
-rw-r--r--gcc/explow.c97
-rw-r--r--gcc/expr.c12
-rw-r--r--gcc/expr.h13
-rw-r--r--gcc/final.c4
-rw-r--r--gcc/fold-const.c10
-rw-r--r--gcc/fortran/ChangeLog280
-rw-r--r--gcc/fortran/array.c32
-rw-r--r--gcc/fortran/check.c22
-rw-r--r--gcc/fortran/data.c10
-rw-r--r--gcc/fortran/decl.c286
-rw-r--r--gcc/fortran/dump-parse-tree.c6
-rw-r--r--gcc/fortran/error.c39
-rw-r--r--gcc/fortran/expr.c58
-rw-r--r--gcc/fortran/gfortran.h37
-rw-r--r--gcc/fortran/gfortranspec.c2
-rw-r--r--gcc/fortran/interface.c163
-rw-r--r--gcc/fortran/io.c75
-rw-r--r--gcc/fortran/iresolve.c88
-rw-r--r--gcc/fortran/match.c22
-rw-r--r--gcc/fortran/misc.c7
-rw-r--r--gcc/fortran/module.c12
-rw-r--r--gcc/fortran/openmp.c6
-rw-r--r--gcc/fortran/options.c3
-rw-r--r--gcc/fortran/parse.c129
-rw-r--r--gcc/fortran/primary.c24
-rw-r--r--gcc/fortran/resolve.c960
-rw-r--r--gcc/fortran/scanner.c2
-rw-r--r--gcc/fortran/simplify.c32
-rw-r--r--gcc/fortran/symbol.c190
-rw-r--r--gcc/fortran/target-memory.c10
-rw-r--r--gcc/fortran/trans-array.c114
-rw-r--r--gcc/fortran/trans-common.c4
-rw-r--r--gcc/fortran/trans-const.c4
-rw-r--r--gcc/fortran/trans-decl.c194
-rw-r--r--gcc/fortran/trans-expr.c189
-rw-r--r--gcc/fortran/trans-intrinsic.c6
-rw-r--r--gcc/fortran/trans-io.c19
-rw-r--r--gcc/fortran/trans-stmt.c20
-rw-r--r--gcc/fortran/trans-types.c143
-rw-r--r--gcc/function.c32
-rw-r--r--gcc/function.h2
-rw-r--r--gcc/gimple-low.c25
-rw-r--r--gcc/gimple-pretty-print.c16
-rw-r--r--gcc/gimplify.c10
-rw-r--r--gcc/graphite-blocking.c221
-rw-r--r--gcc/graphite-clast-to-gimple.c1323
-rw-r--r--gcc/graphite-clast-to-gimple.h66
-rw-r--r--gcc/graphite-dependences.c718
-rw-r--r--gcc/graphite-dependences.h50
-rw-r--r--gcc/graphite-interchange.c360
-rw-r--r--gcc/graphite-poly.c726
-rw-r--r--gcc/graphite-poly.h661
-rw-r--r--gcc/graphite-ppl.c647
-rw-r--r--gcc/graphite-ppl.h162
-rw-r--r--gcc/graphite-scop-detection.c1640
-rw-r--r--gcc/graphite-scop-detection.h27
-rw-r--r--gcc/graphite-sese-to-poly.c2098
-rw-r--r--gcc/graphite-sese-to-poly.h27
-rw-r--r--gcc/graphite.c6158
-rw-r--r--gcc/graphite.h552
-rw-r--r--gcc/gthr-dce.h12
-rw-r--r--gcc/ipa-cp.c43
-rw-r--r--gcc/ipa-inline.c25
-rw-r--r--gcc/ipa-prop.c637
-rw-r--r--gcc/ipa-prop.h136
-rw-r--r--gcc/ipa-struct-reorg.c2
-rw-r--r--gcc/java/ChangeLog35
-rw-r--r--gcc/java/Make-lang.in6
-rw-r--r--gcc/java/builtins.c13
-rw-r--r--gcc/java/decl.c46
-rw-r--r--gcc/java/gcj.texi7
-rw-r--r--gcc/java/java-tree.h3
-rw-r--r--gcc/java/jvspec.c1
-rw-r--r--gcc/java/lang.c50
-rw-r--r--gcc/java/lang.opt4
-rw-r--r--gcc/lambda-code.c12
-rw-r--r--gcc/longlong.h4
-rw-r--r--gcc/omp-low.c20
-rw-r--r--gcc/opt-functions.awk8
-rw-r--r--gcc/optabs.c3
-rw-r--r--gcc/opts.c27
-rw-r--r--gcc/passes.c5
-rw-r--r--gcc/po/ChangeLog4
-rw-r--r--gcc/po/es.po286
-rw-r--r--gcc/predict.c202
-rw-r--r--gcc/predict.h1
-rw-r--r--gcc/real.h3
-rw-r--r--gcc/reload.c30
-rw-r--r--gcc/reload1.c37
-rw-r--r--gcc/rtl.h1
-rw-r--r--gcc/rtlanal.c17
-rw-r--r--gcc/sese.c1398
-rw-r--r--gcc/sese.h475
-rw-r--r--gcc/simplify-rtx.c1
-rw-r--r--gcc/stmt.c32
-rw-r--r--gcc/system.h5
-rw-r--r--gcc/target-def.h13
-rw-r--r--gcc/target.h14
-rw-r--r--gcc/targhooks.c29
-rw-r--r--gcc/targhooks.h5
-rw-r--r--gcc/testsuite/ChangeLog920
-rw-r--r--gcc/testsuite/ada/acats/support/impdef.a6
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c940005.a2
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c940007.a2
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c94001c.ada4
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c94006a.ada2
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c94008c.ada4
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c951002.a8
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c954a01.a4
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c96001a.ada2
-rw-r--r--gcc/testsuite/ada/acats/tests/c9/c97307a.ada4
-rw-r--r--gcc/testsuite/c-c++-common/Wconversion-real.c (renamed from gcc/testsuite/gcc.dg/Wconversion-real.c)3
-rw-r--r--gcc/testsuite/g++.dg/cdce3.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/initlist22.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/named.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/overload.C69
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/overloadn.C708
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv-cast.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv1n.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv1p.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv2n.C161
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv2p.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv3n.C255
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv3p.C52
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv4n.C283
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv4p.C51
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv5n.C197
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv5p.C29
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv6n.C78
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv6p.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv7n.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv7p.C3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/rv8p.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/template_deduction.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C7
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/inline1.C18
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C13
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C4
-rw-r--r--gcc/testsuite/g++.dg/dg.exp4
-rw-r--r--gcc/testsuite/g++.dg/expr/stmt-expr-1.C36
-rw-r--r--gcc/testsuite/g++.dg/ext/anon-struct4.C1
-rw-r--r--gcc/testsuite/g++.dg/ext/complit12.C65
-rw-r--r--gcc/testsuite/g++.dg/lookup/anon2.C6
-rw-r--r--gcc/testsuite/g++.dg/other/anon3.C2
-rw-r--r--gcc/testsuite/g++.dg/other/linkage2.C31
-rw-r--r--gcc/testsuite/g++.dg/other/pragma-re-1.C1
-rw-r--r--gcc/testsuite/g++.dg/other/pragma-re-2.C1
-rw-r--r--gcc/testsuite/g++.dg/overload/defarg4.C26
-rw-r--r--gcc/testsuite/g++.dg/parse/pr16696-permissive.C17
-rw-r--r--gcc/testsuite/g++.dg/parse/pr16696.C17
-rw-r--r--gcc/testsuite/g++.dg/template/arg2.C2
-rw-r--r--gcc/testsuite/g++.dg/template/local4.C2
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40924.C111
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40991.C113
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C36
-rw-r--r--gcc/testsuite/g++.dg/tree-prof/partition1.C53
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr33615.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wconversion-real.C85
-rw-r--r--gcc/testsuite/g++.dg/warn/pr36069.C16
-rw-r--r--gcc/testsuite/g++.old-deja/g++.law/operators32.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/anon9.C5
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/linkage1.C13
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/linkage2.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/enum6.C2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr40570.c22
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr40964.c10
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr41006-1.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr41006-2.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr41016.c17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20090814-1.c23
-rw-r--r--gcc/testsuite/gcc.dg/builtin-apply2.c1
-rw-r--r--gcc/testsuite/gcc.dg/builtins-10.c4
-rw-r--r--gcc/testsuite/gcc.dg/debug/20020224-1.c19
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c70
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr39902.c8
-rw-r--r--gcc/testsuite/gcc.dg/dg.exp4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-0.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-6.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/graphite.exp59
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-10.c15
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-11.c14
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-12.c10
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-13.c11
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-14.c19
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-15.c118
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-3.c11
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-4.c7
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-5.c15
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-6.c29
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-7.c16
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-8.c14
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-9.c26
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-0.c17
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-3.c19
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-4.c18
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-5.c16
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-6.c17
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-7.c14
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-8.c45
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-9.c14
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr35356-1.c26
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr35356-2.c32
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr35356-3.c40
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr37485.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr37684.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr37828.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr37883.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr37928.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr37943.c1
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr38409.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr38498.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr38559.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr39335.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr39335_1.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr40157.c12
-rw-r--r--gcc/testsuite/gcc.dg/graphite/run-id-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-0.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-10.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-14.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-17.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-18.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-19.c1
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-20.c27
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-21.c31
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-9.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-matmult.c4
-rw-r--r--gcc/testsuite/gcc.dg/optimize-bswapdi-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/overflow-warn-8.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr40971.c23
-rw-r--r--gcc/testsuite/gcc.dg/pr41033.c24
-rw-r--r--gcc/testsuite/gcc.dg/pragma-re-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/pragma-re-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/pragma-re-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/pragma-re-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-math-7.c74
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-power-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr41094.c19
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20050314-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-32.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-33.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-34.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-35.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/loop-7.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr23109.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr32964.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/restrict-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/restrict-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-27.c24
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c6
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-6.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/structopt-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-11.c1
-rw-r--r--gcc/testsuite/gcc.dg/ucnid-12.c1
-rw-r--r--gcc/testsuite/gcc.dg/uninit-6-O0.c2
-rw-r--r--gcc/testsuite/gcc.dg/uninit-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/uninit-pr40943.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/O1-pr41008.c23
-rw-r--r--gcc/testsuite/gcc.dg/vect/aligned-section-anchors-nest-1.c (renamed from gcc/testsuite/gcc.dg/vect/section-anchors-nest-1.c)3
-rw-r--r--gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect.exp6
-rw-r--r--gcc/testsuite/gcc.dg/vector-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/vmx/vmx.exp2
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp35
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/abitest.h122
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp1.c17
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp10.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp11.c39
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp12.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp13.c39
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp14.c24
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp15.c20
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp16.c22
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp17.c20
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp2.c19
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp3.c21
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp4.c20
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp5.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp6.c30
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp7.c37
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp8.c37
-rw-r--r--gcc/testsuite/gcc.target/arm/aapcs/vfp9.c38
-rw-r--r--gcc/testsuite/gcc.target/arm/eabi1.c71
-rw-r--r--gcc/testsuite/gcc.target/arm/mmx-1.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/neon/polytypes.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/synchronize.c6
-rw-r--r--gcc/testsuite/gcc.target/bfin/loop-autoinc.c16
-rw-r--r--gcc/testsuite/gcc.target/i386/pr40906-1.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/pr40906-2.c26
-rw-r--r--gcc/testsuite/gcc.target/i386/pr40906-3.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/pr40934.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr40957.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr41019.c19
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-3.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-4.c11
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-5.c11
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-6.c11
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-7.c11
-rw-r--r--gcc/testsuite/gcc.target/mips/ext-8.c11
-rw-r--r--gcc/testsuite/gcc.target/mips/extend-2.c12
-rw-r--r--gcc/testsuite/gcc.target/mips/interrupt_handler.c32
-rw-r--r--gcc/testsuite/gcc.target/mips/mips.exp39
-rw-r--r--gcc/testsuite/gcc.target/mips/smartmips-lwxs.c3
-rw-r--r--gcc/testsuite/gcc.target/mips/truncate-4.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/truncate-5.c1
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-32.c59
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-6.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap-run.c102
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap16.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap32.c8
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap64-1.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap64-2.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/bswap64-3.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-2.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-3.c36
-rw-r--r--gcc/testsuite/gcc.target/powerpc/optimize-bswapsi-2.c55
-rw-r--r--gcc/testsuite/gcc.target/powerpc/popcount-2.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/popcount-3.c9
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr39457.c56
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr39902-2.c28
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-1.c38
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-2.c38
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c212
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-4.c142
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-5.c14
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-6.c146
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c150
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-vector-1.c152
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-vector-2.c152
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-vector-3.c48
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-vector-4.c48
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-vector-5.c392
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-vector-6.c81
-rw-r--r--gcc/testsuite/gfortran.dg/aliasing_dummy_1.f905
-rw-r--r--gcc/testsuite/gfortran.dg/altreturn_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/altreturn_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/altreturn_6.f903
-rw-r--r--gcc/testsuite/gfortran.dg/altreturn_7.f901
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_13.f902
-rw-r--r--gcc/testsuite/gfortran.dg/arrayio_7.f902
-rw-r--r--gcc/testsuite/gfortran.dg/arrayio_8.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_charlen_function_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_charlen_function_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/assumed_charlen_function_5.f908
-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/char_comparison_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/char_decl_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_initialiser_actual.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_pointer_assign.f905
-rw-r--r--gcc/testsuite/gfortran.dg/char_pointer_dependency.f902
-rw-r--r--gcc/testsuite/gfortran.dg/char_pointer_dummy.f905
-rw-r--r--gcc/testsuite/gfortran.dg/char_pointer_func.f902
-rw-r--r--gcc/testsuite/gfortran.dg/class_1.f0340
-rw-r--r--gcc/testsuite/gfortran.dg/class_2.f0347
-rw-r--r--gcc/testsuite/gfortran.dg/common_8.f901
-rw-r--r--gcc/testsuite/gfortran.dg/constant_substring.f2
-rw-r--r--gcc/testsuite/gfortran.dg/data_char_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_array_io_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_array_io_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_array_io_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/der_io_3.f903
-rw-r--r--gcc/testsuite/gfortran.dg/dev_null.F902
-rw-r--r--gcc/testsuite/gfortran.dg/direct_io_2.f901
-rw-r--r--gcc/testsuite/gfortran.dg/do_iterator_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/e_d_fmt.f902
-rw-r--r--gcc/testsuite/gfortran.dg/empty_format_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/entry_17.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/entry_7.f902
-rw-r--r--gcc/testsuite/gfortran.dg/eor_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/equiv_2.f903
-rw-r--r--gcc/testsuite/gfortran.dg/equiv_constraint_2.f906
-rw-r--r--gcc/testsuite/gfortran.dg/equiv_substr.f901
-rw-r--r--gcc/testsuite/gfortran.dg/extended_char_comparison_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_bz_bn_err.f2
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_error_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_read_bz_bn.f902
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_tl.f2
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_white.f2
-rw-r--r--gcc/testsuite/gfortran.dg/func_derived_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/g77/1832.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/19981216-0.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/19990525-0.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/19990826-2.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/20000630-2.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/20010116.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/20010519-1.f18
-rw-r--r--gcc/testsuite/gfortran.dg/g77/980419-2.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/980520-1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/check0.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/cpp3.F2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/cpp4.F4
-rw-r--r--gcc/testsuite/gfortran.dg/g77/f77-edit-i-in.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77/short.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f2
-rw-r--r--gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f2
-rw-r--r--gcc/testsuite/gfortran.dg/global_references_2.f905
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/block-1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/block-2.f2
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/block-3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/block-4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/graphite.exp55
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-1.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-10.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-11.f14
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-12.f19
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-13.f12
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-14.f20
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-15.f16
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-16.f10
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-17.f16
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-5.f19
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-6.f22
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-7.f14
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-8.f17
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/id-9.f20
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/interchange-1.f38
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/interchange-2.f38
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr37852.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr37857.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr37980.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr38083.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/pr38953.f902
-rw-r--r--gcc/testsuite/gfortran.dg/graphite/scop-1.f4
-rw-r--r--gcc/testsuite/gfortran.dg/hollerith.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/hollerith_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/hollerith_f95.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/ichar_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/implicit_9.f902
-rw-r--r--gcc/testsuite/gfortran.dg/initialization_23.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/inquire.f902
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_13.f902
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/inquire_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_4.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/intrinsic_subroutine.f904
-rw-r--r--gcc/testsuite/gfortran.dg/io_constraints_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/io_constraints_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/list_read_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/loc_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/logical_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/longline.f1
-rw-r--r--gcc/testsuite/gfortran.dg/merge_char_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/module_md5_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_12.f2
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_14.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_21.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_22.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_37.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_40.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_47.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_54.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_55.f902
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_58.f9025
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_empty.f903
-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/nested_modules_4.f901
-rw-r--r--gcc/testsuite/gfortran.dg/nested_modules_5.f901
-rw-r--r--gcc/testsuite/gfortran.dg/open-options-blanks.f2
-rw-r--r--gcc/testsuite/gfortran.dg/output_exponents_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/parens_5.f902
-rw-r--r--gcc/testsuite/gfortran.dg/parens_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/parent_result_ref_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pointer_function_actual_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr15129.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr15332.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr16597.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr17143.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr17164.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr17229.f9
-rw-r--r--gcc/testsuite/gfortran.dg/pr18210.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr19155.f1
-rw-r--r--gcc/testsuite/gfortran.dg/pr20086.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr20124.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr20755.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr20865.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr20950.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr21730.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr22491.f2
-rw-r--r--gcc/testsuite/gfortran.dg/pr29713.f902
-rw-r--r--gcc/testsuite/gfortran.dg/pr32921.f4
-rw-r--r--gcc/testsuite/gfortran.dg/pr40999.f11
-rw-r--r--gcc/testsuite/gfortran.dg/pr41011.f23
-rw-r--r--gcc/testsuite/gfortran.dg/print_parentheses_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/print_parentheses_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/proc_assign_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/proc_decl_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_17.f902
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_13.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_14.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_2.f904
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_3.f904
-rw-r--r--gcc/testsuite/gfortran.dg/read_eor.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_float_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/read_logical.f904
-rw-r--r--gcc/testsuite/gfortran.dg/recursive_statement_functions.f902
-rw-r--r--gcc/testsuite/gfortran.dg/return_1.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/scalar_return_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/stfunc_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/stfunc_3.f902
-rw-r--r--gcc/testsuite/gfortran.dg/stfunc_4.f902
-rw-r--r--gcc/testsuite/gfortran.dg/stfunc_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/streamio_2.f905
-rw-r--r--gcc/testsuite/gfortran.dg/string_ctor_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/string_null_compare_1.f2
-rw-r--r--gcc/testsuite/gfortran.dg/structure_constructor_10.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/substr_6.f902
-rw-r--r--gcc/testsuite/gfortran.dg/tl_editing.f902
-rw-r--r--gcc/testsuite/gfortran.dg/transfer_resolve_1.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_10.f032
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_2.f036
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_3.f032
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_4.f032
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_generic_3.f034
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_generic_4.f034
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_operator_1.f0350
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_operator_2.f0370
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_1.f086
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_5.f036
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_proc_6.f0316
-rw-r--r--gcc/testsuite/gfortran.dg/unf_io_convert_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/unlimited_fmt_1.f0817
-rw-r--r--gcc/testsuite/gfortran.dg/use_only_4.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/warnings_are_errors_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_10.f9032
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_11.f9037
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_12.f9033
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_13.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_14.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_7.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_8.f9036
-rw-r--r--gcc/testsuite/gfortran.dg/whole_file_9.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/winapi.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/x_slash_1.f2
-rw-r--r--gcc/testsuite/gnat.dg/itype.adb8
-rw-r--r--gcc/testsuite/gnat.dg/itype.ads5
-rw-r--r--gcc/testsuite/lib/options.exp8
-rw-r--r--gcc/testsuite/lib/target-supports.exp100
-rw-r--r--gcc/testsuite/lib/wrapper.exp3
-rw-r--r--gcc/timevar.def4
-rw-r--r--gcc/toplev.c8
-rw-r--r--gcc/tree-cfg.c12
-rw-r--r--gcc/tree-cfgcleanup.c7
-rw-r--r--gcc/tree-chrec.c39
-rw-r--r--gcc/tree-chrec.h1
-rw-r--r--gcc/tree-data-ref.c63
-rw-r--r--gcc/tree-data-ref.h11
-rw-r--r--gcc/tree-dfa.c26
-rw-r--r--gcc/tree-flow-inline.h41
-rw-r--r--gcc/tree-flow.h9
-rw-r--r--gcc/tree-inline.c29
-rw-r--r--gcc/tree-inline.h4
-rw-r--r--gcc/tree-into-ssa.c38
-rw-r--r--gcc/tree-loop-distribution.c7
-rw-r--r--gcc/tree-outof-ssa.c127
-rw-r--r--gcc/tree-parloops.c526
-rw-r--r--gcc/tree-phinodes.c10
-rw-r--r--gcc/tree-predcom.c8
-rw-r--r--gcc/tree-scalar-evolution.c21
-rw-r--r--gcc/tree-scalar-evolution.h8
-rw-r--r--gcc/tree-sra.c3
-rw-r--r--gcc/tree-ssa-alias.c12
-rw-r--r--gcc/tree-ssa-ccp.c28
-rw-r--r--gcc/tree-ssa-dce.c13
-rw-r--r--gcc/tree-ssa-ifcombine.c31
-rw-r--r--gcc/tree-ssa-loop-ivopts.c323
-rw-r--r--gcc/tree-ssa-loop-manip.c144
-rw-r--r--gcc/tree-ssa-loop-prefetch.c79
-rw-r--r--gcc/tree-ssa-loop.c6
-rw-r--r--gcc/tree-ssa-phiopt.c16
-rw-r--r--gcc/tree-ssa-phiprop.c6
-rw-r--r--gcc/tree-ssa-pre.c34
-rw-r--r--gcc/tree-ssa-sccvn.c35
-rw-r--r--gcc/tree-ssa-structalias.c59
-rw-r--r--gcc/tree-ssa-threadupdate.c6
-rw-r--r--gcc/tree-ssa.c231
-rw-r--r--gcc/tree-switch-conversion.c4
-rw-r--r--gcc/tree-tailcall.c10
-rw-r--r--gcc/tree-vect-data-refs.c2
-rw-r--r--gcc/tree-vect-loop-manip.c44
-rw-r--r--gcc/tree-vect-loop.c29
-rw-r--r--gcc/tree-vect-stmts.c3
-rw-r--r--gcc/tree.c28
-rw-r--r--gcc/tree.h2
-rw-r--r--gcc/value-prof.c5
-rw-r--r--gnattools/ChangeLog5
-rw-r--r--gnattools/Makefile.in11
-rw-r--r--intl/ChangeLog5
-rw-r--r--intl/Makefile.in32
-rw-r--r--libada/ChangeLog9
-rw-r--r--libada/Makefile.in12
-rw-r--r--libada/configure.ac2
-rw-r--r--libcpp/ChangeLog5
-rw-r--r--libcpp/charset.c2
-rw-r--r--libcpp/po/ChangeLog4
-rw-r--r--libcpp/po/es.po10
-rw-r--r--libdecnumber/ChangeLog12
-rw-r--r--libdecnumber/Makefile.in8
-rw-r--r--libdecnumber/decCommon.c2
-rw-r--r--libdecnumber/decContext.c4
-rw-r--r--libffi/ChangeLog4
-rw-r--r--libffi/configure.ac2
-rw-r--r--libgcc/ChangeLog14
-rw-r--r--libgcc/Makefile.in11
-rw-r--r--libgcc/config.host5
-rw-r--r--libgcc/configure23
-rw-r--r--libgcc/configure.ac15
-rw-r--r--libgfortran/ChangeLog56
-rw-r--r--libgfortran/Makefile.am7
-rw-r--r--libgfortran/Makefile.in14
-rwxr-xr-xlibgfortran/configure7
-rw-r--r--libgfortran/configure.ac6
-rw-r--r--libgfortran/configure.host7
-rw-r--r--libgfortran/fmain.c3
-rw-r--r--libgfortran/gfortran.map14
-rw-r--r--libgfortran/intrinsics/string_intrinsics_inc.c6
-rw-r--r--libgfortran/io/format.c36
-rw-r--r--libgfortran/io/io.h2
-rw-r--r--libgfortran/io/list_read.c2
-rw-r--r--libgfortran/io/unix.c21
-rw-r--r--libgfortran/libgfortran.h7
-rw-r--r--libgomp/ChangeLog21
-rw-r--r--libgomp/config/linux/mips/mutex.h27
-rw-r--r--libgomp/config/linux/mutex.h10
-rw-r--r--libgomp/configure.ac2
-rw-r--r--libgomp/testsuite/libgomp.fortran/fortran.exp11
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-1.c30
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-2.c30
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-3.c38
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-4.c55
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-5.c39
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-6.c38
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-7.c36
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-8.c40
-rw-r--r--libgomp/testsuite/libgomp.graphite/force-parallel-9.c37
-rw-r--r--libgomp/testsuite/libgomp.graphite/graphite.exp55
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/Makefile.in10
-rw-r--r--libjava/ChangeLog34
-rw-r--r--libjava/Makefile.am2
-rw-r--r--libjava/Makefile.in4
-rwxr-xr-xlibjava/configure7
-rw-r--r--libjava/configure.ac5
-rw-r--r--libjava/configure.host6
-rw-r--r--libjava/gcj/Makefile.in2
-rwxr-xr-xlibjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc1
-rw-r--r--libjava/include/Makefile.in2
-rw-r--r--libjava/libgcj.spec.in2
-rw-r--r--libjava/sysdep/arm/locks.h58
-rw-r--r--libjava/testsuite/Makefile.in2
-rw-r--r--libjava/testsuite/libjava.jni/jni.exp5
-rw-r--r--libjava/testsuite/libjava.jvmti/jvmti-interp.exp7
-rw-r--r--libjava/testsuite/libjava.jvmti/jvmti.exp4
-rw-r--r--libmudflap/ChangeLog4
-rw-r--r--libmudflap/configure.ac2
-rw-r--r--libobjc/ChangeLog10
-rw-r--r--libobjc/Makefile.in20
-rw-r--r--libobjc/aclocal.m46
-rw-r--r--libobjc/configure.ac2
-rw-r--r--libssp/ChangeLog4
-rw-r--r--libssp/configure.ac2
-rw-r--r--libstdc++-v3/ChangeLog551
-rw-r--r--libstdc++-v3/acinclude.m429
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver12
-rwxr-xr-xlibstdc++-v3/configure644
-rw-r--r--libstdc++-v3/configure.ac31
-rw-r--r--libstdc++-v3/doc/html/api.html2
-rw-r--r--libstdc++-v3/doc/html/manual/abi.html20
-rw-r--r--libstdc++-v3/doc/html/manual/algorithms.html2
-rw-r--r--libstdc++-v3/doc/html/manual/api.html4
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_contributing.html2
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_free.html2
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_gpl.html4
-rw-r--r--libstdc++-v3/doc/html/manual/appendix_porting.html2
-rw-r--r--libstdc++-v3/doc/html/manual/backwards.html48
-rw-r--r--libstdc++-v3/doc/html/manual/bitmap_allocator.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01ix01.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt02pr01.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt09pr02.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html4
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bk01pt12pr03.html2
-rw-r--r--libstdc++-v3/doc/html/manual/bugs.html24
-rw-r--r--libstdc++-v3/doc/html/manual/codecvt.html20
-rw-r--r--libstdc++-v3/doc/html/manual/configure.html41
-rw-r--r--libstdc++-v3/doc/html/manual/containers.html2
-rw-r--r--libstdc++-v3/doc/html/manual/diagnostics.html2
-rw-r--r--libstdc++-v3/doc/html/manual/documentation_style.html4
-rw-r--r--libstdc++-v3/doc/html/manual/extensions.html2
-rw-r--r--libstdc++-v3/doc/html/manual/facets.html16
-rw-r--r--libstdc++-v3/doc/html/manual/intro.html2
-rw-r--r--libstdc++-v3/doc/html/manual/io.html2
-rw-r--r--libstdc++-v3/doc/html/manual/iterators.html2
-rw-r--r--libstdc++-v3/doc/html/manual/locales.html14
-rw-r--r--libstdc++-v3/doc/html/manual/localization.html2
-rw-r--r--libstdc++-v3/doc/html/manual/memory.html20
-rw-r--r--libstdc++-v3/doc/html/manual/messages.html18
-rw-r--r--libstdc++-v3/doc/html/manual/numerics.html2
-rw-r--r--libstdc++-v3/doc/html/manual/parallel_mode.html4
-rw-r--r--libstdc++-v3/doc/html/manual/shared_ptr.html22
-rw-r--r--libstdc++-v3/doc/html/manual/spine.html4
-rw-r--r--libstdc++-v3/doc/html/manual/status.html6
-rw-r--r--libstdc++-v3/doc/html/manual/strings.html2
-rw-r--r--libstdc++-v3/doc/html/manual/support.html2
-rw-r--r--libstdc++-v3/doc/html/manual/using_headers.html10
-rw-r--r--libstdc++-v3/doc/html/manual/utilities.html2
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml14
-rw-r--r--libstdc++-v3/doc/xml/manual/using.xml15
-rw-r--r--libstdc++-v3/include/bits/basic_string.tcc4
-rw-r--r--libstdc++-v3/include/bits/forward_list.h7
-rw-r--r--libstdc++-v3/include/bits/functexcept.h3
-rw-r--r--libstdc++-v3/include/bits/functional_hash.h4
-rw-r--r--libstdc++-v3/include/bits/istream.tcc40
-rw-r--r--libstdc++-v3/include/bits/move.h24
-rw-r--r--libstdc++-v3/include/bits/ostream.tcc8
-rw-r--r--libstdc++-v3/include/bits/ostream_insert.h2
-rw-r--r--libstdc++-v3/include/bits/random.h360
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h4
-rw-r--r--libstdc++-v3/include/bits/stl_list.h10
-rw-r--r--libstdc++-v3/include/bits/stl_map.h41
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h43
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h41
-rw-r--r--libstdc++-v3/include/bits/stl_set.h40
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h110
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h20
-rw-r--r--libstdc++-v3/include/ext/cast.h2
-rw-r--r--libstdc++-v3/include/ext/pointer.h104
-rw-r--r--libstdc++-v3/include/precompiled/extc++.h2
-rw-r--r--libstdc++-v3/include/precompiled/stdc++.h3
-rw-r--r--libstdc++-v3/include/std/future57
-rw-r--r--libstdc++-v3/include/std/istream18
-rw-r--r--libstdc++-v3/include/std/ostream18
-rw-r--r--libstdc++-v3/include/std/random6
-rw-r--r--libstdc++-v3/include/std/thread5
-rw-r--r--libstdc++-v3/include/std/tuple13
-rw-r--r--libstdc++-v3/include/tr1_impl/functional2
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h4
-rw-r--r--libstdc++-v3/src/Makefile.am4
-rw-r--r--libstdc++-v3/src/Makefile.in30
-rw-r--r--libstdc++-v3/src/compatibility-ldbl.cc18
-rw-r--r--libstdc++-v3/src/compatibility.cc4
-rw-r--r--libstdc++-v3/src/functexcept.cc15
-rw-r--r--libstdc++-v3/src/future.cc10
-rw-r--r--libstdc++-v3/src/hash.cc25
-rw-r--r--libstdc++-v3/src/hash_c++0x.cc11
-rw-r--r--libstdc++-v3/src/hash_tr1.cc36
-rw-r--r--libstdc++-v3/src/hashtable.cc15
-rw-r--r--libstdc++-v3/src/hashtable_c++0x.cc7
-rw-r--r--libstdc++-v3/src/hashtable_tr1.cc31
-rw-r--r--libstdc++-v3/src/istream.cc18
-rw-r--r--libstdc++-v3/src/limits_c++0x.cc4
-rw-r--r--libstdc++-v3/src/pool_allocator.cc4
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/all.cc138
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/all_assert_neg.cc88
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc139
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc139
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc87
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/all_c++200x_compatibility.cc24
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc181
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/all_no_exceptions.cc21
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/all_pedantic_errors.cc21
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++.cc49
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc35
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_multiple_inclusion.cc75
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc252
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_exceptions.cc21
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc21
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc (renamed from libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc)77
-rw-r--r--libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc111
-rw-r--r--libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/forward/requirements/explicit_instantiation.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/20_util/tuple/swap.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/operators/1.cc22
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/operators/2.cc50
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/1.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/5.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/dr130.cc77
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/dr130.cc87
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/dr130.cc85
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/dr130.cc75
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/15523.cc39
-rw-r--r--libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc4
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc47
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc47
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc5
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mt19937.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc47
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc50
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc50
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms_neg.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms_neg.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc1
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc46
-rw-r--r--libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc1
-rw-r--r--libstdc++-v3/testsuite/27_io/rvalue_streams.cc42
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/requirements/typedefs.cc28
-rw-r--r--libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/shared_future/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/shared_future/cons/copy.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/unique_future/cons/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/unique_future/cons/copy_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc16
-rw-r--r--libstdc++-v3/testsuite/util/replacement_memory_operators.h15
-rw-r--r--zlib/ChangeLog.gcj4
-rw-r--r--zlib/configure.ac2
1220 files changed, 48217 insertions, 14411 deletions
diff --git a/ChangeLog b/ChangeLog
index 50a2ec58942..8e853ee82aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2009-08-17 Ben Elliston <bje@au.ibm.com>
+
+ * config.sub, config.guess: Update from upstream sources.
+
+2009-08-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Sync from src, merge:
+
+ 2009-07-02 Tristan Gingold <gingold@adacore.com>
+
+ * configure.ac: Do not exclude gas for i386-*-darwin.
+ Add a case for x86_64-*-darwin.
+ * configure: Regenerate.
+
+2009-08-06 Neil Vachharajani <nvachhar@gmail.com>
+
+ * MAINTAINERS: Add my name to Write After Approval list.
+
+2009-08-06 Michael Eager <eager@eagercon.com>
+
+ * configure.ac: Add Microblaze target.
+ * configure: Regenerate.
+
+2009-07-31 Christian Bruel <christian.bruel@st.com>
+
+ * configure.ac (sh*-*-elf): Don't add target-libgloss to noconfigdirs.
+ * configure: Regenerate.
+
2009-07-28 Rask Ingemann Lambertsen <ccc94453@vip.cybercity.dk>
* MAINTAINERS (Write After Approval): Update my e-mail address.
diff --git a/MAINTAINERS b/MAINTAINERS
index 065948470a4..04e48b6e385 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -456,6 +456,7 @@ Samuel Tardieu sam@rfc1149.net
Kresten Krab Thorup krab@gcc.gnu.org
Caroline Tice ctice@apple.com
David Ung davidu@mips.com
+Neil Vachharajani nvachhar@gmail.com
Kris Van Hees kris.van.hees@oracle.com
Jonathan Wakely redi@gcc.gnu.org
Feng Wang fengwang@nudt.edu.cn
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index fa53669ca2a..0e37031371e 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-17 Michael Meissner <meissner@linux.vnet.ibm.com>
PR boehm-gc/40785
diff --git a/boehm-gc/configure.ac b/boehm-gc/configure.ac
index 2206f76eaa2..52ab0b5fa47 100644
--- a/boehm-gc/configure.ac
+++ b/boehm-gc/configure.ac
@@ -49,7 +49,7 @@ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
AC_PROG_CXX
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AM_PROG_CC_C_O
diff --git a/config.guess b/config.guess
index 7c480734b7c..e3a2116a7dc 100755
--- a/config.guess
+++ b/config.guess
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2009-06-03'
+timestamp='2009-06-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep __ELF__ >/dev/null
+ | grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -656,7 +656,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
+ grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -927,7 +927,7 @@ EOF
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
@@ -1046,7 +1046,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1154,7 +1154,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
diff --git a/config.sub b/config.sub
index 67a635efec8..32d764c386b 100755
--- a/config.sub
+++ b/config.sub
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
-timestamp='2009-06-03'
+timestamp='2009-08-17'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -149,10 +149,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray)
+ -apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
+ -bluegene*)
+ os=-cnk
+ ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -337,7 +340,7 @@ case $basic_machine in
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -467,6 +470,10 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
@@ -719,6 +726,9 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -1260,7 +1270,7 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
@@ -1613,7 +1623,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -aix*)
+ -cnk*|-aix*)
vendor=ibm
;;
-beos*)
diff --git a/config/ChangeLog b/config/ChangeLog
index 6bd7bbf5416..c9a51dc988c 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,13 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): Do not expand
+ for Autoconf 2.62 or newer.
+ * tls.m4 (GCC_CHECK_TLS): Fix m4 quotation.
+ * no-executables.m4 (_AC_COMPILER_EXEEXT): Fix m4 quotation.
+ * override.m4 (m4_copy_force, m4_rename_force): Provide
+ macros if not defined.
+ (AC_PREREQ): Use m4_copy_force.
+
2009-07-17 Joseph Myers <joseph@codesourcery.com>
PR other/40784
@@ -25,10 +35,7 @@
* bootstrap-O3.mk: New.
* bootstrap-debug.mk: New.
-2009-05-07 Paolo Bonzini
-
- Sync from src:
- 2009-02-02 Doug Evans <dje@google.com>
+2009-02-02 Doug Evans <dje@google.com>
* tcl.m4 (SC_PATH_TCLCONFIG): Don't exit 0 if tclconfig fails.
(SC_PATH_TKCONFIG): Don't exit 0 if tkconfig fails.
diff --git a/config/extensions.m4 b/config/extensions.m4
index 8ae4a675e2b..eb59f272119 100644
--- a/config/extensions.m4
+++ b/config/extensions.m4
@@ -1,7 +1,7 @@
-# serial 5 -*- Autoconf -*-
+# serial 6 -*- Autoconf -*-
# Enable extensions on systems that normally disable them.
-# Copyright (C) 2003, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2007, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -12,6 +12,8 @@
# enough in this area it's likely we'll need to redefine
# AC_USE_SYSTEM_EXTENSIONS for quite some time.
+m4_version_prereq([2.62],, [
+
# AC_USE_SYSTEM_EXTENSIONS
# ------------------------
# Enable extensions on systems that normally disable them,
@@ -74,3 +76,4 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_DEFINE([_TANDEM_SOURCE])
])# AC_USE_SYSTEM_EXTENSIONS
+])
diff --git a/config/no-executables.m4 b/config/no-executables.m4
index c4d0b70c375..90616245ef9 100644
--- a/config/no-executables.m4
+++ b/config/no-executables.m4
@@ -25,7 +25,7 @@ AC_BEFORE([$0], [_AC_COMPILER_EXEEXT])
AC_BEFORE([$0], [AC_LINK_IFELSE])
m4_define([_AC_COMPILER_EXEEXT],
-AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
+[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
# FIXME: Cleanup?
AS_IF([AC_TRY_EVAL(ac_link)], [gcc_no_link=no], [gcc_no_link=yes])
if test x$gcc_no_link = xyes; then
@@ -35,7 +35,7 @@ if test x$gcc_no_link = xyes; then
cross_compiling=yes
EXEEXT=
else
- m4_defn([_AC_COMPILER_EXEEXT])dnl
+ ]m4_defn([_AC_COMPILER_EXEEXT])dnl
fi
)
diff --git a/config/override.m4 b/config/override.m4
index 9bb149620c4..bf112db99a8 100644
--- a/config/override.m4
+++ b/config/override.m4
@@ -12,6 +12,16 @@ dnl
dnl The _GCC_AUTOCONF_VERSION_TEST ensures that exactly the desired
dnl Autoconf version is used. It should be kept for consistency.
+dnl Provide m4_copy_force and m4_rename_force for old Autoconf versions.
+
+m4_ifndef([m4_copy_force],
+[m4_define([m4_copy_force],
+[m4_ifdef([$2], [m4_undefine([$2])])m4_copy($@)])])
+
+m4_ifndef([m4_rename_force],
+[m4_define([m4_rename_force],
+[m4_ifdef([$2], [m4_undefine([$2])])m4_rename($@)])])
+
dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
dnl We use it because this fix is intended for 2.59 only.
dnl A feature test for the broken AC_CONFIG_SUBDIRS instead
@@ -25,7 +35,7 @@ ifdef([m4_PACKAGE_VERSION],
[dnl AC_DEFUN a commonly used macro so this file is picked up.
m4_copy([AC_PREREQ], [_AC_PREREQ])
AC_DEFUN([AC_PREREQ], [frob])
-m4_copy([_AC_PREREQ], [AC_PREREQ])
+m4_copy_force([_AC_PREREQ], [AC_PREREQ])
dnl Ensure exactly this Autoconf version is used
diff --git a/config/tls.m4 b/config/tls.m4
index 099bdc257a8..ef7e6d0b555 100644
--- a/config/tls.m4
+++ b/config/tls.m4
@@ -11,8 +11,8 @@ AC_DEFUN([GCC_CHECK_TLS], [
chktls_save_LDFLAGS="$LDFLAGS"
LDFLAGS="-static $LDFLAGS"
AC_LINK_IFELSE([int main() { return 0; }],
- AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
- [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],[]),
+ [AC_RUN_IFELSE([__thread int a; int b; int main() { return a = b; }],
+ [gcc_cv_have_tls=yes], [gcc_cv_have_tls=no],[])],
[gcc_cv_have_tls=yes])
LDFLAGS="$chktls_save_LDFLAGS"
if test $gcc_cv_have_tls = yes; then
diff --git a/configure b/configure
index 8ba3c9cfe83..ed4791b1288 100755
--- a/configure
+++ b/configure
@@ -2226,7 +2226,11 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- i[3456789]86-*-darwin* | x86_64-*-darwin[912]*)
+ i[3456789]86-*-darwin*)
+ noconfigdirs="$noconfigdirs ld gprof"
+ noconfigdirs="$noconfigdirs sim target-rda"
+ ;;
+ x86_64-*-darwin[912]*)
noconfigdirs="$noconfigdirs ld gas gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
@@ -2612,6 +2616,9 @@ case "${target}" in
m68k-apollo-*)
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
;;
+ microblaze*)
+ noconfigdirs="$noconfigdirs gprof ${libgcj}"
+ ;;
mips*-sde-elf*)
skipdirs="$skipdirs target-libiberty"
noconfigdirs="$noconfigdirs ${libgcj}"
@@ -2650,7 +2657,12 @@ case "${target}" in
i[3456789]86-*-msdosdjgpp*) ;; # don't add gprof back in
*) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
esac
- noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
+ case "${target}" in
+ sh*-*-elf)
+ noconfigdirs="$noconfigdirs ${libgcj}" ;;
+ *)
+ noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;;
+ esac
;;
sparclet-*-aout* | sparc86x-*-*)
libgloss_dir=sparc
diff --git a/configure.ac b/configure.ac
index 22cd976bbbd..7508758f01f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,7 +450,11 @@ case "${target}" in
noconfigdirs="$noconfigdirs ld gas gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
- i[[3456789]]86-*-darwin* | x86_64-*-darwin[[912]]*)
+ i[[3456789]]86-*-darwin*)
+ noconfigdirs="$noconfigdirs ld gprof"
+ noconfigdirs="$noconfigdirs sim target-rda"
+ ;;
+ x86_64-*-darwin[[912]]*)
noconfigdirs="$noconfigdirs ld gas gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
@@ -836,6 +840,9 @@ case "${target}" in
m68k-apollo-*)
noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss ${libgcj}"
;;
+ microblaze*)
+ noconfigdirs="$noconfigdirs gprof ${libgcj}"
+ ;;
mips*-sde-elf*)
skipdirs="$skipdirs target-libiberty"
noconfigdirs="$noconfigdirs ${libgcj}"
@@ -874,7 +881,12 @@ case "${target}" in
i[[3456789]]86-*-msdosdjgpp*) ;; # don't add gprof back in
*) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
esac
- noconfigdirs="$noconfigdirs target-libgloss ${libgcj}"
+ case "${target}" in
+ sh*-*-elf)
+ noconfigdirs="$noconfigdirs ${libgcj}" ;;
+ *)
+ noconfigdirs="$noconfigdirs target-libgloss ${libgcj}" ;;
+ esac
;;
sparclet-*-aout* | sparc86x-*-*)
libgloss_dir=sparc
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 072c904b067..778f380eddc 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,12 @@
+2009-08-18 Alexandre Oliva <aoliva@redhat.com>
+
+ * compare-debug: Drop .eh_frame relocations too.
+
+2009-08-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR testsuite/40704
+ * test_summary: Filter out "\r".
+
2009-06-02 Alexandre Oliva <aoliva@redhat.com>
* compare-debug: Don't fail just because of .eh_frame differences.
diff --git a/contrib/test_summary b/contrib/test_summary
index 9bb06051efd..f7cddf4af78 100755
--- a/contrib/test_summary
+++ b/contrib/test_summary
@@ -131,7 +131,7 @@ configflags == "" {
$2 == "version" { save = $0; $1 = ""; $2 = ""; version = $0; gsub(/^ */, "", version); gsub(/\r$/, "", version); $0 = save; }
/\===.*Summary/ { print ""; print; blanks=1; }
/tests ===/ || /^(Target|Host|Native)/ || $2 == "version" { print; blanks=1; }
-/^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { print; }
+/^(XPASS|FAIL|UNRESOLVED|WARNING|ERROR|# of )/ { sub ("\r", ""); print; }
/^using:/ { print ""; print; print ""; }
# dumpall != 0 && /^X?(PASS|FAIL|UNTESTED)|^testcase/ { dumpall=0; }
# dumpall != 0 { print; }
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 35260caca66..3933f28dfd8 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,36 @@
+2009-08-17 David Edelsohn <edelsohn@gnu.org>
+
+ * inclhack.def (aix_complex): Redefine _Complex_I. Do not
+ redefine I.
+ * (aix_stdint_[12345]): New fixes.
+ * fixincl.x: Regenerate.
+ * tests/base/complex.h: Update check.
+ * tests/base/stdint.h: Add AIX stdint.h checks.
+
+2009-08-14 Steve Ellcey <sje@cup.hp.com>
+
+ * inclhack.def (hpux_imaginary_i): New fix.
+ * fixincl.x: Regenerate.
+ * tests/base/complex.h: New file.
+
+2009-08-12 David Edelsohn <edelsohn@gnu.org>
+
+ * inclhack.def (aix_complex): New fix.
+ * fixincl.x: Regenerate.
+
+2009-08-01 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * inclhack.def (hpux_inttype_int_least8_t): Also apply on hpux10*.
+ (hpux_inttype_int8_t): Likewise.
+ * fixincl.x: Regenerate.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, AUTOHEADER, ACLOCAL, ACLOCAL_AMFLAGS):
+ New variables.
+ ($(srcdir)/configure, $(srcdir)/config.h.in, $(srcdir)/aclocal.m4):
+ Use them.
+
2009-07-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* inclhack.def (darwin_stdint_5, darwin_stdint_6,
diff --git a/fixincludes/Makefile.in b/fixincludes/Makefile.in
index 1f89cf9edeb..f91a70d2e6e 100644
--- a/fixincludes/Makefile.in
+++ b/fixincludes/Makefile.in
@@ -63,6 +63,11 @@ itoolsdatadir = $(libsubdir)/install-tools
# Locate mkinstalldirs.
mkinstalldirs=$(SHELL) $(srcdir)/../mkinstalldirs
+AUTOCONF = autoconf
+AUTOHEADER = autoheader
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I ../gcc -I .. -I ../config
+
default : all
# Now figure out from those variables how to compile and link.
@@ -159,13 +164,13 @@ config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/aclocal.m4
- cd $(srcdir) && autoconf
+ cd $(srcdir) && $(AUTOCONF)
$(srcdir)/config.h.in: @MAINT@ $(srcdir)/configure.ac
- cd $(srcdir) && autoheader
+ cd $(srcdir) && $(AUTOHEADER)
$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/configure.ac
- cd $(srcdir) && aclocal -I ../gcc -I .. -I ../config
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
check : all
autogen -T $(srcdir)/check.tpl $(srcdir)/inclhack.def
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 90eb9370aef..1ee1dc06106 100644
--- a/fixincludes/fixincl.x
+++ b/fixincludes/fixincl.x
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
- * It has been AutoGen-ed Saturday July 4, 2009 at 10:06:21 AM CEST
+ * It has been AutoGen-ed Sunday August 16, 2009 at 08:59:30 AM EDT
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jul 4 10:06:21 CEST 2009
+/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Aug 16 08:59:30 EDT 2009
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
- * This file contains 199 fixup descriptions.
+ * This file contains 206 fixup descriptions.
*
* See README for more information.
*
@@ -485,6 +485,43 @@ static const char* apzAab_Sun_MemcpyPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Aix_Complex fix
+ */
+tSCC zAix_ComplexName[] =
+ "aix_complex";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAix_ComplexList[] =
+ "complex.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAix_ComplexMachs[] = {
+ "*-*-aix*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAix_ComplexSelect0[] =
+ "#define[ \t]_Complex_I[ \t]__I";
+
+#define AIX_COMPLEX_TEST_CT 1
+static tTestDesc aAix_ComplexTests[] = {
+ { TT_EGREP, zAix_ComplexSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Aix_Complex
+ */
+static const char* apzAix_ComplexPatch[] = {
+ "format",
+ "#define _Complex_I (__extension__ 1.0iF)",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Aix_Pthread fix
*/
tSCC zAix_PthreadName[] =
@@ -522,6 +559,219 @@ static const char* apzAix_PthreadPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Aix_Stdint_1 fix
+ */
+tSCC zAix_Stdint_1Name[] =
+ "aix_stdint_1";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAix_Stdint_1List[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAix_Stdint_1Machs[] = {
+ "*-*-aix*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAix_Stdint_1Select0[] =
+ "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n\
+#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
+
+#define AIX_STDINT_1_TEST_CT 1
+static tTestDesc aAix_Stdint_1Tests[] = {
+ { TT_EGREP, zAix_Stdint_1Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Aix_Stdint_1
+ */
+static const char* apzAix_Stdint_1Patch[] = {
+ "format",
+ "#define UINT8_MAX\t(255)\n\
+#define UINT16_MAX\t(65535)",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Aix_Stdint_2 fix
+ */
+tSCC zAix_Stdint_2Name[] =
+ "aix_stdint_2";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAix_Stdint_2List[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAix_Stdint_2Machs[] = {
+ "*-*-aix*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAix_Stdint_2Select0[] =
+ "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n\
+#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n\
+#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n\
+#else\n\
+#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n\
+#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n\
+#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
+
+#define AIX_STDINT_2_TEST_CT 1
+static tTestDesc aAix_Stdint_2Tests[] = {
+ { TT_EGREP, zAix_Stdint_2Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Aix_Stdint_2
+ */
+static const char* apzAix_Stdint_2Patch[] = {
+ "format",
+ "#define INTPTR_MIN\t(-INTPTR_MAX-1)\n\
+#define INTPTR_MAX\t9223372036854775807L\n\
+#define UINTPTR_MAX\t18446744073709551615UL\n\
+#else\n\
+#define INTPTR_MIN\t(-INTPTR_MAX-1)\n\
+#define INTPTR_MAX\t2147483647L\n\
+#define UINTPTR_MAX\t4294967295UL",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Aix_Stdint_3 fix
+ */
+tSCC zAix_Stdint_3Name[] =
+ "aix_stdint_3";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAix_Stdint_3List[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAix_Stdint_3Machs[] = {
+ "*-*-aix*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAix_Stdint_3Select0[] =
+ "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n\
+#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n\
+#else\n\
+#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n\
+#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
+
+#define AIX_STDINT_3_TEST_CT 1
+static tTestDesc aAix_Stdint_3Tests[] = {
+ { TT_EGREP, zAix_Stdint_3Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Aix_Stdint_3
+ */
+static const char* apzAix_Stdint_3Patch[] = {
+ "format",
+ "#define PTRDIFF_MIN\t(-9223372036854775807L - 1)\n\
+#define PTRDIFF_MAX\t9223372036854775807L\n\
+#else\n\
+#define PTRDIFF_MIN\t(-2147483647L - 1)\n\
+#define PTRDIFF_MAX\t2147483647L",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Aix_Stdint_4 fix
+ */
+tSCC zAix_Stdint_4Name[] =
+ "aix_stdint_4";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAix_Stdint_4List[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAix_Stdint_4Machs[] = {
+ "*-*-aix*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAix_Stdint_4Select0[] =
+ "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n\
+#else\n\
+#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
+
+#define AIX_STDINT_4_TEST_CT 1
+static tTestDesc aAix_Stdint_4Tests[] = {
+ { TT_EGREP, zAix_Stdint_4Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Aix_Stdint_4
+ */
+static const char* apzAix_Stdint_4Patch[] = {
+ "format",
+ "#define SIZE_MAX\t18446744073709551615UL\n\
+#else\n\
+#define SIZE_MAX\t4294967295UL",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Aix_Stdint_5 fix
+ */
+tSCC zAix_Stdint_5Name[] =
+ "aix_stdint_5";
+
+/*
+ * File name selection pattern
+ */
+tSCC zAix_Stdint_5List[] =
+ "stdint.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzAix_Stdint_5Machs[] = {
+ "*-*-aix*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zAix_Stdint_5Select0[] =
+ "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n\
+#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
+
+#define AIX_STDINT_5_TEST_CT 1
+static tTestDesc aAix_Stdint_5Tests[] = {
+ { TT_EGREP, zAix_Stdint_5Select0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Aix_Stdint_5
+ */
+static const char* apzAix_Stdint_5Patch[] = {
+ "format",
+ "#define UINT8_C(c)\tc\n\
+#define UINT16_C(c)\tc",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Aix_Sysmachine fix
*/
tSCC zAix_SysmachineName[] =
@@ -3874,7 +4124,7 @@ tSCC zHpux_Inttype_Int_Least8_TList[] =
* Machine/OS name selection pattern
*/
tSCC* apzHpux_Inttype_Int_Least8_TMachs[] = {
- "*-hp-hpux11.*",
+ "*-hp-hpux1[01].*",
(const char*)NULL };
/*
@@ -3911,7 +4161,7 @@ tSCC zHpux_Inttype_Int8_TList[] =
* Machine/OS name selection pattern
*/
tSCC* apzHpux_Inttype_Int8_TMachs[] = {
- "*-hp-hpux11.*",
+ "*-hp-hpux1[01].*",
(const char*)NULL };
/*
@@ -3934,6 +4184,43 @@ static const char* apzHpux_Inttype_Int8_TPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Hpux_Imaginary_I fix
+ */
+tSCC zHpux_Imaginary_IName[] =
+ "hpux_imaginary_i";
+
+/*
+ * File name selection pattern
+ */
+tSCC zHpux_Imaginary_IList[] =
+ "complex.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzHpux_Imaginary_IMachs[] = {
+ "ia64-hp-hpux11.*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zHpux_Imaginary_ISelect0[] =
+ "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
+
+#define HPUX_IMAGINARY_I_TEST_CT 1
+static tTestDesc aHpux_Imaginary_ITests[] = {
+ { TT_EGREP, zHpux_Imaginary_ISelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Hpux_Imaginary_I
+ */
+static const char* apzHpux_Imaginary_IPatch[] = {
+ "format",
+ "# define _Complex_I (__extension__ 1.0iF)",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Huge_Val_Hex fix
*/
tSCC zHuge_Val_HexName[] =
@@ -8093,9 +8380,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 242
+#define REGEX_COUNT 249
#define MACH_LIST_SIZE_LIMIT 181
-#define FIX_COUNT 199
+#define FIX_COUNT 206
/*
* Enumerate the fixes
@@ -8109,7 +8396,13 @@ typedef enum {
AAB_FD_ZERO_SELECTBITS_H_FIXIDX,
AAB_SOLARIS_SYS_VARARGS_H_FIXIDX,
AAB_SUN_MEMCPY_FIXIDX,
+ AIX_COMPLEX_FIXIDX,
AIX_PTHREAD_FIXIDX,
+ AIX_STDINT_1_FIXIDX,
+ AIX_STDINT_2_FIXIDX,
+ AIX_STDINT_3_FIXIDX,
+ AIX_STDINT_4_FIXIDX,
+ AIX_STDINT_5_FIXIDX,
AIX_SYSMACHINE_FIXIDX,
AIX_SYSWAIT_2_FIXIDX,
AIX_VOLATILE_FIXIDX,
@@ -8196,6 +8489,7 @@ typedef enum {
HPUX_STDINT_FAST_FIXIDX,
HPUX_INTTYPE_INT_LEAST8_T_FIXIDX,
HPUX_INTTYPE_INT8_T_FIXIDX,
+ HPUX_IMAGINARY_I_FIXIDX,
HUGE_VAL_HEX_FIXIDX,
HUGE_VALF_HEX_FIXIDX,
HUGE_VALL_HEX_FIXIDX,
@@ -8343,11 +8637,41 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
AAB_SUN_MEMCPY_TEST_CT, FD_MACH_ONLY | FD_REPLACEMENT,
aAab_Sun_MemcpyTests, apzAab_Sun_MemcpyPatch, 0 },
+ { zAix_ComplexName, zAix_ComplexList,
+ apzAix_ComplexMachs,
+ AIX_COMPLEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAix_ComplexTests, apzAix_ComplexPatch, 0 },
+
{ zAix_PthreadName, zAix_PthreadList,
apzAix_PthreadMachs,
AIX_PTHREAD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aAix_PthreadTests, apzAix_PthreadPatch, 0 },
+ { zAix_Stdint_1Name, zAix_Stdint_1List,
+ apzAix_Stdint_1Machs,
+ AIX_STDINT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAix_Stdint_1Tests, apzAix_Stdint_1Patch, 0 },
+
+ { zAix_Stdint_2Name, zAix_Stdint_2List,
+ apzAix_Stdint_2Machs,
+ AIX_STDINT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAix_Stdint_2Tests, apzAix_Stdint_2Patch, 0 },
+
+ { zAix_Stdint_3Name, zAix_Stdint_3List,
+ apzAix_Stdint_3Machs,
+ AIX_STDINT_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAix_Stdint_3Tests, apzAix_Stdint_3Patch, 0 },
+
+ { zAix_Stdint_4Name, zAix_Stdint_4List,
+ apzAix_Stdint_4Machs,
+ AIX_STDINT_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAix_Stdint_4Tests, apzAix_Stdint_4Patch, 0 },
+
+ { zAix_Stdint_5Name, zAix_Stdint_5List,
+ apzAix_Stdint_5Machs,
+ AIX_STDINT_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aAix_Stdint_5Tests, apzAix_Stdint_5Patch, 0 },
+
{ zAix_SysmachineName, zAix_SysmachineList,
apzAix_SysmachineMachs,
AIX_SYSMACHINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
@@ -8778,6 +9102,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
HPUX_INTTYPE_INT8_T_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aHpux_Inttype_Int8_TTests, apzHpux_Inttype_Int8_TPatch, 0 },
+ { zHpux_Imaginary_IName, zHpux_Imaginary_IList,
+ apzHpux_Imaginary_IMachs,
+ HPUX_IMAGINARY_I_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aHpux_Imaginary_ITests, apzHpux_Imaginary_IPatch, 0 },
+
{ zHuge_Val_HexName, zHuge_Val_HexList,
apzHuge_Val_HexMachs,
HUGE_VAL_HEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 8cb6b7ed61d..96ed41c7337 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -356,6 +356,21 @@ fix = {
/*
+ * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
+ * which only is provided by AIX xlc C99.
+ */
+fix = {
+ hackname = aix_complex;
+ mach = "*-*-aix*";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]__I";
+ c_fix = format;
+ c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
+ test_text = "#define _Complex_I __I\n";
+};
+
+
+/*
* pthread.h on AIX 4.3.3 tries to define a macro without whitspace
* which violates a requirement of ISO C.
*/
@@ -371,6 +386,106 @@ fix = {
/*
+ * AIX stdint.h fixes.
+ */
+fix = {
+ hackname = aix_stdint_1;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
+ "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
+ c_fix = format;
+ c_fix_arg = "#define UINT8_MAX (255)\n"
+ "#define UINT16_MAX (65535)";
+ test_text = "#define UINT8_MAX (255U)\n"
+ "#define UINT16_MAX (65535U)";
+};
+
+
+fix = {
+ hackname = aix_stdint_2;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
+ "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
+ "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
+ "#else\n"
+ "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
+ "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
+ "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#define INTPTR_MAX 9223372036854775807L\n"
+ "#define UINTPTR_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#define INTPTR_MAX 2147483647L\n"
+ "#define UINTPTR_MAX 4294967295UL";
+ test_text = "#define INTPTR_MIN INT64_MIN\n"
+ "#define INTPTR_MAX INT64_MAX\n"
+ "#define UINTPTR_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define UINTPTR_MAX UINT32_MAX";
+};
+
+
+fix = {
+ hackname = aix_stdint_3;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
+ "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
+ "#else\n"
+ "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
+ "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
+ "#define PTRDIFF_MAX 9223372036854775807L\n"
+ "#else\n"
+ "#define PTRDIFF_MIN (-2147483647L - 1)\n"
+ "#define PTRDIFF_MAX 2147483647L";
+ test_text = "#define PTRDIFF_MIN INT64_MIN\n"
+ "#define PTRDIFF_MAX INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define PTRDIFF_MAX INT32_MAX";
+};
+
+
+fix = {
+ hackname = aix_stdint_4;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
+ "#else\n"
+ "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define SIZE_MAX 4294967295UL";
+ test_text = "#define SIZE_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX UINT32_MAX";
+};
+
+
+fix = {
+ hackname = aix_stdint_5;
+ mach = "*-*-aix*";
+ files = stdint.h;
+ select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
+ "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
+ c_fix = format;
+ c_fix_arg = "#define UINT8_C(c) c\n"
+ "#define UINT16_C(c) c";
+ test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
+ "#define UINT16_C(c) __CONCAT__(c,U)";
+};
+
+
+/*
* sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
* in an otherwise harmless (and #ifed out) macro definition
*/
@@ -2096,7 +2211,7 @@ fix = {
fix = {
hackname = hpux_inttype_int_least8_t;
- mach = "*-hp-hpux11.*";
+ mach = "*-hp-hpux1[01].*";
files = sys/_inttypes.h;
select = "^[ \t]*typedef[ \t]*char[ \t]*int_least8_t.*";
c_fix = format;
@@ -2106,7 +2221,7 @@ fix = {
fix = {
hackname = hpux_inttype_int8_t;
- mach = "*-hp-hpux11.*";
+ mach = "*-hp-hpux1[01].*";
files = sys/_inttypes.h;
select = "^[ \t]*typedef[ \t]*char[ \t]*int8_t.*";
c_fix = format;
@@ -2114,6 +2229,16 @@ fix = {
test_text ="typedef char int8_t;\n";
};
+fix = {
+ hackname = hpux_imaginary_i;
+ mach = "ia64-hp-hpux11.*";
+ files = complex.h;
+ select = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
+ c_fix = format;
+ c_fix_arg = "# define _Complex_I (__extension__ 1.0iF)";
+ test_text = "# define _Complex_I (0.f+_Imaginary_I)\n";
+};
+
/*
* Fix glibc definition of HUGE_VAL in terms of hex floating point constant
*/
diff --git a/fixincludes/tests/base/complex.h b/fixincludes/tests/base/complex.h
new file mode 100644
index 00000000000..d7f2c3120f3
--- /dev/null
+++ b/fixincludes/tests/base/complex.h
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/complex.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( AIX_COMPLEX_CHECK )
+#define _Complex_I (__extension__ 1.0iF)
+
+#endif /* AIX_COMPLEX_CHECK */
+
+
+#if defined( HPUX_IMAGINARY_I_CHECK )
+# define _Complex_I (__extension__ 1.0iF)
+
+#endif /* HPUX_IMAGINARY_I_CHECK */
diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h
index 77e77fae079..ae7b12e46d3 100644
--- a/fixincludes/tests/base/stdint.h
+++ b/fixincludes/tests/base/stdint.h
@@ -9,6 +9,45 @@
+#if defined( AIX_STDINT_1_CHECK )
+#define UINT8_MAX (255U)
+#define UINT16_MAX (65535U)
+#endif /* AIX_STDINT_1_CHECK */
+
+
+#if defined( AIX_STDINT_2_CHECK )
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+#else
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+#endif /* AIX_STDINT_2_CHECK */
+
+
+#if defined( AIX_STDINT_3_CHECK )
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+#else
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+#endif /* AIX_STDINT_3_CHECK */
+
+
+#if defined( AIX_STDINT_4_CHECK )
+#define SIZE_MAX UINT64_MAX
+#else
+#define SIZE_MAX UINT32_MAX
+#endif /* AIX_STDINT_4_CHECK */
+
+
+#if defined( AIX_STDINT_5_CHECK )
+#define UINT8_C(c) __CONCAT__(c,U)
+#define UINT16_C(c) __CONCAT__(c,U)
+#endif /* AIX_STDINT_5_CHECK */
+
+
#if defined( DARWIN_STDINT_1_CHECK )
#define UINT8_C(c) __UINT8_C(c)
#define UINT16_C(c) __UINT16_C(c)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0b69427eb63..206656d6c0c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,1895 @@
+2009-08-18 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Allocate insn
+ locators before emit_insn is called. Remove assert that
+ cfun->is_thunk.
+ (alpha_end_function): Clear crtl->emit structure and free insn
+ locators if cfun->is_thunk is true.
+
+2009-08-18 Jason Merrill <jason@redhat.com>
+
+ * config/elfos.h (ASM_DECLARE_OBJECT_NAME): Use gnu_unique_object
+ type if available.
+ * configure.ac: Test for it.
+ * configure, config.in: Regenerate.
+ * doc/install.texi: Document --enable-gnu-unique-object.
+
+2009-08-18 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41094
+ * builtins.c (fold_builtin_pow): Fold pow(pow(x,y),z) to
+ pow(x,y*z) only if x is nonnegative.
+
+2009-08-18 Jakub Jelinek <jakub@redhat.com>
+
+ * bb-reorder.c (fix_up_fall_thru_edges): Only call invert_jump
+ on jumps.
+
+ PR target/40971
+ * config/rs6000/rs6000.c (rs6000_legitimize_address): For
+ [DT][FDI]mode ensure the offset isn't 4/8/12 bytes below 0x8000.
+
+2009-08-17 DJ Delorie <dj@redhat.com>
+
+ * config/m32c/m32c.md (UNS_FSETB, UNS_FREIT): New.
+ * config/m32c/prologue.md (epilogue_freit): New.
+ (fset_b): New.
+ * config/m32c/m32c.c (m32c_function_needs_enter): Add prototype.
+ (bank_switch_p): Likewise.
+ (fast_interrupt_p): Likewise.
+ (interrupt_p): Likewise.
+ (m32c_conditional_register_usage): Round memregs size up.
+ (need_to_save): We only need to save $a0 when we use ENTER.
+ (interrupt_p): Check for fast_interrupt too.
+ (bank_switch_p): New.
+ (fast_interrupt_p): New.
+ (m32c_attribute_table): Add bank_switch and fast_interrupt.
+ (m32c_emit_prolog): Support bank switching and fast interrupts.
+ * doc/extend.texi (Function Attributes): Add bank_switch and
+ fast_interrupt.
+
+2009-08-17 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (vms_valid_pointer_mode): New function.
+ * config/alpha/vms.h (TARGET_VALID_POINTER_MODE): Define.
+
+2009-08-16 Douglas B Rupp <rupp@gnat.com>
+
+ * doc/invoke.texi (Target options):
+ Add new option list for IA-64/VMS.
+ (menu): Add IA-64/VMS Options.
+ (IA-64/VMS Options): Likewise.
+
+2009-08-16 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR target/38599
+ * config/mips/mips.md (*lwxs): Use :P for pointer values.
+
+2009-08-16 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips-protos.h (mips_push_asm_switch): New function.
+ (mips_pop_asm_switch): Likewise.
+ * config/mips/mips.c (set_noreorder, set_nomacro, set_noat): Replace
+ with...
+ (mips_noreorder, mips_nomacro, mips_noat): ...these new variables.
+ (mips_push_asm_switch_1, mips_pop_asm_switch_1): New functions.
+ (mips_push_asm_switch, mips_pop_asm_switch): Likewise.
+ (mips_print_operand_punctuation): Use them. Check mips_noreorder
+ instead of set_noreorder.
+ (mips_output_function_prologue): Use the new functions.
+ (mips_output_function_epilogue): Likewise.
+ (mips_need_noat_wrapper_p): New function, split out from...
+ (mips_final_prescan_insn, mips_final_postscan_insn): ...here.
+ Use mips_push_asm_switch and mips_pop_asm_switch.
+ * config/mips/mips.h (FUNCTION_PROFILER): Use mips_push_asm_switch
+ and mips_pop_asm_switch.
+ (ASM_OUTPUT_REG_POP): Likewise.
+ (DBR_OUTPUT_SEQEND): Remove boilerplate comment.
+ Use mips_pop_asm_switch.
+ (mips_asm_switch): New structure.
+ (set_noreorder, set_nomacro): Replace with...
+ (mips_noreorder, mips_nomacro, mips_noat): ...these new variables.
+ * config/mips/mips.md (fix_truncdfsi2_macro): Use mips_nomacro
+ instead of set_nomacro.
+ (fix_truncsfsi2_macro): Likewise.
+ (cprestore): Likewise.
+ (hazard): Use mips_noreorder instead of set_noreorder.
+ * config/mips/sdemtk.h (FUNCTION_PROFILER): As for mips.h.
+
+2009-08-16 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_and_function): Handle NULL_RTX returned
+ from prev_active_insn.
+
+2009-08-16 Anatoly Sokolov <aesok@post.ru>
+
+ * config/avr/avr.h (AVR_HAVE_8BIT_SP): New macros.
+ * config/avr/avr.c (avr_override_options): Initialize
+ avr_current_arch variable.
+ (avr_cpu_cpp_builtins): Define __AVR_HAVE_8BIT_SP__ or
+ __AVR_HAVE_16BIT_SP__ according to the device type.
+ (expand_prologue, output_movhi): Use AVR_HAVE_8BIT_SP instead of
+ TARGET_TINY_STACK.
+ (expand_epilogue): Use correct QI mode frame pointer for tiny stack.
+ Use AVR_HAVE_8BIT_SP instead of TARGET_TINY_STACK.
+
+2009-08-16 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/37801
+ * gcc/dwarf2out.c (gen_inlined_subroutine_die): Concentrate on
+ generating inlined subroutine die only. We shouldn't be
+ called for anything else.
+ (gen_block_die): Don't generate inline subroutine debug info for
+ abstract blocks.
+
+2009-08-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pbb): Print PBB index.
+
+2009-08-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/40981
+ * graphite-interchange.c (ppl_max_for_le): Moved...
+ * graphite-poly.c (pbb_number_of_iterations): Call ppl_max_for_le.
+ * graphite-ppl.c (ppl_max_for_le): ... here. Correct the use of
+ ppl_Pointset_Powerset_C_Polyhedron_maximize.
+ * graphite-ppl.h (ppl_max_for_le): Declared.
+
+2009-08-14 Olatunji Ruwase <tjruwase@google.com>
+
+ * doc/extend.texi (Symbol-Renaming Pragmas): redefine_extname is
+ supported on all platforms.
+ * target.h (struct gcc_target): Remove
+ handle_pragma_redefine_extname.
+ * c-cppbuiltin.c: Remove use of
+ targetm.handle_pragma_redefine_extname.
+ * c-pragma.c: Likewise.
+ * target-def.h (TARGET_INITIALIZER): Remove
+ TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
+ * config/sol2.h: Remove use of
+ TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME.
+
+2009-08-14 Douglas B Rupp <rupp@gnat.com>
+
+ * config/ia64/fde-vms.c: New file.
+ * config/ia64/fde-glibc.c (_Unwind_FindTableEntry): Add dummy arg.
+ * config/ia64/unwind-ia64.c (UNW_ accessors): Move to unwind-ia64.h
+ (MD_UNW_COMPATIBLE_PERSONALITY_P): Provide default.
+ (uw_frame_state_for): Only register a personality routine if it is
+ known to be compatible with our expectations.
+ (_Unwind_FindEnclosingFunction, uw_frame_state_for):
+ Declare unw_table_entry stack variable and
+ mod all calls to _Unwind_FindTableEntry to add arg.
+ * config/ia64/unwind-ia64.h (UNW_ accessors): Move here.
+ (_Unwind_FindTableEntry): Add arg to prototype.
+
+2009-08-14 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/ia64/unwind-ia64.c (struct _Unwind_Context): Add new
+ field 'signal_pfs_loc'.
+ (uw_frame_state_for): Remove duplicate code dealing with leaf
+ procedures without unwind info.
+ If in the frame after unwinding through a signal handler, restore
+ the AR.PFS register instead of the CFM if AR.PFS has not been saved.
+ * config/ia64/linux-unwind.h (ia64_fallback_frame_state): Do not set
+ 'pfs_loc' to the AR.PFS location in the signal context; instead
+ set 'signal_pfs_loc'.
+ Manually generate the unwind info for the AR.PFS register.
+ (ABI_MARKER_OLD_LINUX_SIGTRAMP, ABI_MARKER_OLD_LINUX_INTERRUPT,
+ ABI_MARKER_LINUX_SIGTRAMP, ABI_MARKER_LINUX_INTERRUPT): Define.
+ (ia64_handle_unwabi): Test 'fs->unwabi' against them.
+ Do not set 'pfs_loc' to the AR.PFS location in the signal context;
+ instead set 'signal_pfs_loc'.
+ Remove code preventing the AR.PFS register from being restored
+ from the signal context.
+
+2009-08-14 Douglas B Rupp <rupp@gnat.com>
+ Tristan Gingold <gingold@adacore.com>
+
+ * config.gcc (ia64-hp-*vms*): Insert ia64/t-ia64 in tmake_file.
+ * config/ia64/t-vms: New file.
+ * config/ia64/vms64.h: New file.
+ * config/ia64/vms.h: New file.
+ * config/ia64/vms-crtinit.asm: New file.
+ * config/ia64/vms_symvec_libgcc_s.opt: New file.
+ * config/ia64/vms-unwind.h: New file.
+
+2009-08-14 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_emit_conditional_move): Handle
+ TFmode compares.
+
+2009-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ PR middle-end/30789
+ * builtins.c (do_mpc_arg2): Make extern, define for any MPC
+ version. Move declaration...
+ * real.h (do_mpc_arg2): ... here.
+ * fold-const.c (const_binop): Use MPC for complex MULT_EXPR
+ and RDIV_EXPR.
+
+2009-08-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * final.c (add_debug_prefix_map): Don't use GC memory for
+ old_prefix and new_prefix.
+
+2009-08-14 Richard Guenther <rguenther@suse.de>
+
+ * ipa-prop.c (compute_complex_pass_through): If we cannot
+ compute a non-varying offset for IPA_JF_ANCESTOR punt.
+
+2009-08-14 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * c-lex.c (c_lex_with_flags): Increase size of local variable
+ to avoid memory clobber.
+
+2009-08-14 Paolo Bonzini <bonzini@gnu.org>
+
+ PR target/40934
+ * config/i386/i386.c (ix86_fp_comparison_strategy):
+ Only enable/disable sahf at function granularity.
+
+2009-08-14 Hans-Peter Nilsson <hp@axis.com>
+
+ PR rtl-optimization/41064
+ * reload1.c (reload_as_needed): Don't call extract_insn
+ for known invalid replacements after calling
+ validate_replace_rtx_group and verify_changes.
+
+2009-08-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/41019
+ * config/i386/sse.md (SSEMODE124C8): New mode iterator.
+ (vcond<SSEMODEF2P:mode>): Assert that operation is supported by
+ ix86_expand_fp_vcond.
+ (vcond<SSEMODE124C8:mode>): Use SSEMODE124C8 instead of SSEMODE124.
+ Assert that operation is supported by ix86_expand_int_vcond.
+ (vcondu<SSEMODE124C8:mode>): Ditto.
+
+2009-08-13 DJ Delorie <dj@redhat.com>
+
+ * config/i386/djgpp-stdint.h: New.
+ * config.gcc (djgpp): Use it.
+
+2009-08-13 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (sh_override_options): When flag_exceptions or
+ flag_unwind_tables is on, turn flag_reorder_blocks_and_partition off.
+
+2009-08-13 Ghassan Shobaki <ghassan.shobaki@amd.com>
+
+ * tree-ssa-loop-prefetch.c
+ (prune_ref_by_group_reuse): Enhance probabilistic analysis
+ for long-stride pruning.
+ (compute_miss_rate): New function to compute the probability
+ that two memory references access different cache lines.
+
+2009-08-13 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * gcc/config/i386/cygwin.h (LINK_SPEC): Add --enable-auto-image-base.
+
+2009-08-13 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41047
+ * tree-ssa-ccp.c (ccp_fold): When folding pointer additions
+ use the constant pointer type.
+ * gimplify.c (canonicalize_addr_expr): Canonicalize independent
+ of CV qualifiers on the target pointer type.
+ * tree-ssa.c (useless_type_conversion_p): Move incomplete pointer
+ conversion check before restrict check.
+
+2009-08-12 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ PR target/41029
+ * config/sh/sh.md (reload_outdf__RnFRm+4): Fix thinko.
+
+2009-08-12 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (sh_promote_function_mode): Add ATTRIBUTE_UNUSED.
+
+2009-08-12 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/41011
+ * ipa-cp.c (ipcp_lattice_from_jfunc): Deal with failing fold
+ and reference constructing.
+
+2009-08-12 Xinliang David Li <davidxl@google.com>
+
+ PR tree-optimization/41012
+ * tree-flow.h : New external interface.
+ * gimple-low.c (check_call_arg): Change to public function.
+ Remove argument mismatch check in lowering.
+ * tree-inline.h (tree_can_inline_p): Interface change.
+ * tree-inline.c (tree_can_inline_p): Fold argument mismatch check
+ into this function.
+ * ipa-inline.c (cgraph_decide_inlining_of_small_functions):
+ Call change to tree_can_inline_p function.
+ (cgraph_decide_inlining_incrementally): Ditto.
+
+2009-08-12 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR tree-optimization/41031
+ * tree-outof-ssa.c (insert_value_copy_on_edge): Use promote_decl_mode
+ on the partition variable rather than promote_mode on the source
+ type. Assert that the partition variable's type has the same
+ mode as the source value's.
+
+2009-08-12 Paolo Bonzini <bonzini@gnu.org>
+
+ * doc/tm.texi (TARGET_PROMOTE_FUNCTION_MODE): Add documentation
+ for for_return == 2.
+ * function.c (assign_parm_setup_reg): Use for_return == 2, improve
+ comments.
+ * calls.c (expand_call): Fix typo.
+ * explow.c (promote_decl_mode): Use for_return == 2 for RESULT_DECL
+ and PARM_DECL.
+ * stmt.c (expand_value_return): Use promote_function_mode to copy out
+ of pseudo.
+ * targhooks.c (default_promote_function_mode): Handle for_return == 2.
+ * config/cris/cris.c (cris_promote_function_mode): Likewise.
+ * config/mmix/mmix.c (mmix_promote_function_mode): Likewise.
+ * config/pa/pa.c (pa_promote_function_mode): Likewise.
+
+2009-08-11 Andrew Haley <aph@redhat.com>
+
+ * config/arm/arm.c (arm_init_libfuncs): Add __sync_synchronize.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR bootstrap/40103
+ * graphite.c: Remove pragma GCC diagnostic warning "-Wc++-compat".
+
+2009-08-12 Richard Guenther <rguenther@suse.de>
+
+ * alias.c (get_alias_set): Honor TYPE_STRUCTURAL_EQUALITY_P.
+ * gimplify.c (gimplify_modify_expr): Do not use
+ lang_hooks.types_compatible_p.
+ * tree-ssa.c (useless_type_conversion_p): For aggregates
+ just return false if the canonical types differ.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/40980
+ * sese.c (convert_for_phi_arg): New.
+ (add_guard_exit_phis): Use convert_for_phi_arg.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): Dont add
+ unknown subscript upper bounds.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+ Pranav Garg <pranav.garg2107@gmail.com>
+
+ * graphite-interchange.c (gather_access_strides): Removed.
+ (ppl_max_for_le): New.
+ (build_linearized_memory_access): New.
+ (memory_stride_in_loop): New.
+ (pbb_interchange_profitable_p): Reimplemented.
+ * graphite-ppl.h (ppl_new_id_map): New.
+ (ppl_interchange): New.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_subscript): Removed.
+ (compute_array_size_cstr): Removed.
+ (compute_array_size_poly): Removed.
+ (compute_array_size): Removed.
+ (gather_access_strides_poly): Removed.
+ (gather_access_strides): Empty.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (dependence_polyhedron_1): Replace
+ pdr_nb_subscripts with PDR_NB_SUBSCRIPTS.
+ (graphite_legal_transform_dr): Same.
+ (graphite_carried_dependence_level_k): Same.
+ * graphite-poly.c (new_poly_dr): Add a parameter nb_subscripts.
+ Initialize PDR_NB_SUBSCRIPTS.
+ (print_pdr_access_layout): Replace pdr_nb_subscripts with
+ PDR_NB_SUBSCRIPTS.
+ * graphite-poly.h (struct poly_dr): Add nb_subscripts field.
+ (PDR_NB_SUBSCRIPTS): New.
+ (pdr_nb_subscripts): Removed.
+ (pdr_dim): Simplified.
+ * graphite-sese-to-poly.c (build_poly_dr): Replace pdr_nb_subscripts
+ with PDR_NB_SUBSCRIPTS.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_array_size): Remove use of
+ PDR_DATA_CONTAINER.
+ * graphite-poly.c (new_poly_dr): Remove argument data_container.
+ Do not initialize PDR_DATA_CONTAINER.
+ (print_pdr): Do not print PDR_DATA_CONTAINER.
+ * graphite-poly.h (struct poly_dr): Remove data_container field.
+ (PDR_DATA_CONTAINER): Removed.
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): Remove use of
+ PDR_DATA_CONTAINER.
+ (build_poly_dr): Same.
+
+2009-08-12 Konrad Trifunovic <konrad.trifunovic@gmail.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (graphite_legal_transform_dr): Work on a
+ copy of the dependence polyhedron. Free the temporary objects.
+ (graphite_carried_dependence_level_k): Free unused objects before
+ returning.
+
+ * testsuite/gcc.dg/graphite/interchange-1.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-2.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-3.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-4.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-7.c: XFAILed.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-blocking.c (scop_do_strip_mine): Call store_scattering.
+ Early return without analyzing the data dependences if no
+ transform has been done. Call restore_scattering if the transform
+ is not legal.
+ (graphite-interchange.c): Same.
+ * graphite-poly.c (print_scattering_function): Test for
+ PBB_TRANSFORMED.
+ (graphite_read_transforms): Initialize PBB_TRANSFORMED.
+ (apply_poly_transforms): Do not gcc_assert that
+ the transform is legal.
+ (new_poly_bb): Initialize PBB_TRANSFORMED, PBB_SAVED and PBB_ORIGINAL.
+ Do not initialize PBB_NB_SCATTERING_TRANSFORM, PBB_NB_LOCAL_VARIABLES,
+ PBB_TRANSFORMED_SCATTERING, and PBB_ORIGINAL_SCATTERING.
+ (free_poly_dr): Free PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL.
+ * graphite-poly.h (struct poly_scattering): New.
+ (struct poly_bb): Add original, transformed, and saved fields.
+ Remove transformed_scattering, original_scattering,
+ nb_local_variables and nb_scattering_transform fields.
+ (PBB_ORIGINAL, PBB_TRANSFORMED, PBB_SAVED): New.
+ (poly_scattering_new): New.
+ (poly_scattering_free): New.
+ (poly_scattering_copy): New.
+ (store_scattering_pbb): New.
+ (store_scattering): New.
+ (restore_scattering_pbb): New.
+ (restore_scattering): New.
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons):
+ Initialize PBB_TRANSFORMED and PBB_ORIGINAL.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pbb): Add parentheses in the pretty print.
+ (print_scop): Same.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (graphite.o): Depends on PREDICT_H.
+ * graphite.c: Include predict.h.
+ (graphite_finalize): Call tree_estimate_probability.
+ * predict.c (predict_loops): Do not call scev_initialize and
+ scev_finalize.
+ (tree_estimate_probability_bb): New.
+ (tree_estimate_probability): Do not initialize loops: move that
+ code to the driver. Call tree_estimate_probability_bb.
+ (tree_estimate_probability_driver): New.
+ (pass_profile): Use tree_estimate_probability_driver.
+ * predict.h (tree_estimate_probability): Declared.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (gloog): Add time to TV_GRAPHITE_CODE_GEN.
+ * graphite-dependences.c (graphite_legal_transform): Add time to
+ TV_GRAPHITE_DATA_DEPS.
+ (dependency_between_pbbs_p): Same.
+ * timevar.def (TV_GRAPHITE_DATA_DEPS, TV_GRAPHITE_CODE_GEN): New.
+
+2009-08-12 Andrey Belevantsev <abel@ispras.ru>
+
+ PR rtl-optimization/41033
+ * alias.c (nonoverlapping_component_refs_p): Punt when strict
+ aliasing is disabled.
+
+2009-08-11 Adam Nemet <anemet@caviumnetworks.com>
+
+ * config/mips/predicates.md (qi_mask_operand, hi_mask_operand,
+ si_mask_operand, and_load_operand, low_bitmask_operand,
+ and_reg_operand, and_operand): New predicates.
+ * config/mips/constraints.md (Yb, Yh, Yw, Yz): New constraints.
+ * config/mips/mips.c (and_operands_ok): New function.
+ * config/mips/mips-protos.h (and_operands_ok): Declare it.
+ * config/mips/mips.md (move_type): Add ext_ins and logical.
+ (type): Handle them.
+ (and<mode>3): Use and_reg_operand as the second operand's predicate.
+ (*and<mode>3): Add alternatives for lbu, lhu, lwu, <d>ext and
+ shift_shift. Remove commutative constraint modifier.
+ (*and<mode>3_mips16): Add alternatives for lbu, lhu, lwu and
+ shift_shift.
+ (*clear_upper32_dext): Remove define_insn_and_split.
+ (*clear_upper32): Turn this define_insn_and_split ...
+ (splitter for ANDing register with 0xffff_ffff): .. into this.
+
+2009-08-11 Adam Nemet <anemet@caviumnetworks.com>
+
+ * combine.c (try_widen_shift_mode): Factor out code to check if an
+ integer constant is a low-order bitmask from here ...
+ * rtlanal.c (low_bitmask_len): ... to here.
+ * rtl.h (low_bitmask_len): Declare.
+
+2009-08-11 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/8603
+ * config/alpha/alpha.md (addsi3): Remove expander.
+ (addsi3): Rename from *addsi3_internal insn pattern.
+ (subsi3): Remove expander.
+ (subsi3): Rename from *subsi3_internal insn pattern.
+
+2009-08-11 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (alpha_init_builtins): Nullify FWRITE and
+ FWRITE_UNLOCKED.
+
+2009-08-11 Vasiliy Fofanov <fofanov@adacore.com>
+ Eric Botcazou <botcazou@adacore.com>
+ Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (alpha_return_in_memory): On VMS, ensure
+ that records that fit in 64 bits are returned by immediate value,
+ as required by OpenVMS Calling Standard.
+ (function_value): Adjust for above modification.
+ (alpha_va_start) <TARGET_ABI_OPEN_VMS>: Use
+ virtual_incoming_args_rtx as base object, not next_arg.
+ * config/alpha/vms.h: (DEFAULT_PCC_STRUCT_RETURN): Define as 0.
+
+2009-08-11 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * reload.c (find_reloads_subreg_address): Check the original
+ req_equiv_mem address to detect the case where an address is
+ not valid in the outer mode.
+
+2009-08-11 Richard Guenther <rguenther@suse.de>
+
+ PR bootstrap/40788
+ * builtins.c (gimplify_va_arg_expr): Do not call SET_EXPR_LOCATION.
+
+2009-08-10 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/vms.h (OPTIMIZATION_OPTIONS): Remove
+ (OVERRIDE_OPTIONS): Incorporate removed OPTIMIZATION_OPTIONS.
+
+2009-08-10 Olivier Hainque <hainqueu@adacore.com>
+ Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (alpha_sa_size): Force procedure type to
+ PT_STACK when frame_pointer_needed on OpenVMS.
+ (alpha_pv_save_size, alpha_using_fp): Remove.
+ (alpha_vms_can_eliminate): New function. Support for CAN_ELIMINATE
+ with proper processing for PT_NULL.
+ (alpha_vms_initial_elimination_offset): New function. Support for
+ INITIAL_ELIMINATION_OFFSET with proper processing for PT_NULL.
+ (alpha_sa_size): Force procedure type to PT_STACK when
+ frame_pointer_needed on OpenVMS.
+ * config/alpha/alpha-protos.h (alpha_pv_save_size): Remove prototype.
+ (alpha_using_fp): Likewise.
+ (alpha_vms_can_eliminate): Add prototype.
+ (alpha_vms_initial_elimination_offset): Likewise.
+ * config/alpha/vms.h (CAN_ELIMINATE, INITIAL_ELIMINATION_OFFSET):
+ Call alpha_vms_can_eliminate and alpha_vms_initial_elimination_offset.
+
+2009-08-10 Eric Botcazou <botcazou@adacore.com>
+ Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (common_object_handler): New function.
+ (vms_attribute_table): Declare a single attribute "common_object".
+ (vms_output_aligned_decl_common): New global function.
+ (SECTION_VMS_OVERLAY): Delete.
+ (SECTION_VMS_GLOBAL): Likewise.
+ (SECTION_VMS_INITIALIZE): Likewise.
+ (vms_asm_named_section): Remove support for above flags.
+ (vms_section_type_flags): Delete.
+ (TARGET_SECTION_TYPE_FLAGS): Likewise.
+ * config/alpha/alpha-protos.h (vms_output_aligned_decl_common): New.
+ * config/alpha/vms.h (ASM_OUTPUT_ALIGNED_COMMON): Delete.
+ (ASM_OUTPUT_ALIGNED_DECL_COMMON): New macro.
+
+2009-08-10 SUGIOKA Toshinobu <sugioka@itonet.co.jp>
+
+ PR target/41015
+ * longlong.h [__sh__] (udiv_qrnnd): Add T register to clobber list.
+ (sub_ddmmss): Likewise.
+
+2009-08-10 Andreas Tobler <a.tobler@schweiz.org>
+
+ PR bootstrap/41018
+ * config/rs6000/freebsd.h: Define SVR4_ASM_SPEC. Adjust copyright
+ year.
+
+2009-08-10 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ PR target/37053
+ * reload1.c (reload_as_needed): Use cancel_changes to completely
+ undo a failed replacement attempt.
+
+2009-08-10 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41006
+ * tree-ssa.c (useless_type_conversion_p_1): Fold into ...
+ (useless_type_conversion_p): ... here. Require pointer targets
+ to be compatible.
+
+2009-08-10 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/40866
+ * tree-inline.c (copy_statement_list): The resulting copy shouldn't
+ loose the original type of the statement list.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c: Include libfuncs.h
+ (avms_asm_output_extern): New function.
+ (alpha_init_libfuncs): Init some decc libfuncs.
+ * config/alpha/alpha-protos.h (avms_asm_output_external): Declare.
+ * config/alpha/vms.h (ASM_OUTPUT_EXTERNAL): Define.
+ (DO_CRTL_NAMES): Define.
+ (LIB_SPEC): Remove.
+ * config/alpha/vms64.h: (POINTERS_EXTEND_UNSIGNED): Remove undef.
+ (LONG_TYPE_SIZE): Define.
+ (TARGET_OS_CPP_BUILTINS): Define with __LONG_POINTERS=1
+ (SUBTARGET_SWITCHES): Define malloc64 switch.
+ (TARGET_DEFAULT): Default MASK_MALLOC64 set.
+ (MASK_RETURN_ADDR): Define.
+ doc/invoke.texi (mmalloc64): Document switch.
+
+2009-08-09 Olivier Hainque <hainque@adacore.com>
+ Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (struct machine_function): New flag for VMS,
+ uses_condition_handler.
+ (alpha_expand_builtin_establish_vms_condition_handler): New expander.
+ (alpha_expand_builtin_revert_vms_condition_handler): New expander.
+ (enum alpha_builtin): New ALPHA_BUILTIN_REVERT_VMS_CONDITION_HANDLER
+ and ALPHA_BUILTIN_ESTABLISH_VMS_CONDITION_HANDLER values.
+ (code_for_builtin): New insn codes for the new alpha_builtins.
+ (alpha_init_builtins): Register the new functions as BUILT_IN_MD.
+ (alpha_sa_size): Account for uses_condition_handler.
+ (alpha_expand_prologue): Likewise.
+ (alpha_start_function): Likewise.
+ (alpha_expand_epilogue): Likewise.
+ * config/alpha/alpha-protos.h: Prototype the new alpha.c builtin
+ establish/revert expanders.
+ * config/alpha/alpha.h (DWARF_FRAME_REGNUM): Define.
+ * config/alpha/alpha.md (builtin_establish_vms_condition_handler):
+ New expander, resorting to the alpha.c associated function.
+ (builtin_revert_vms_condition_handler): Likewise.
+ * config/alpha/vms-gcc_shell_handler.c: New file. Implements
+ __gcc_shell_handler, the static VMS condition handler used as
+ an indirection wrapper to the current dynamically established
+ handler.
+ * config/alpha/vms-unwind.h: Complete rewrite.
+ * config/alpha/t-vms (LIB2FUNCS_EXTRA): Add vms-gcc_shell_handler.c
+ * config/alpha/vms.h (MD_UNWIND_SUPPORT):
+
+2009-08-09 Eric Botcazou <botcazou@adacore.com>
+ Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (alpha_links): Add 'target' field.
+ (alpha_need_linkage): Handle aliases. Return function symbol.
+ (alpha_use_linkage): Rename 'linkage' argument to 'func'.
+ Use ultimate alias target for the linkage name.
+ * config/alpha/alpha.md (movmemdi): Use the symbol returned
+ by alpha_need_linkage for the function symbol.
+ (setmemdi): Likewise.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (TARGET_ASM_UNALIGNED_*_OP): Define if on VMS.
+ * config/alpha/vms.h (OBJECT_FORMAT_ELF): Define.
+ (ASM_WEAKEN_LABEL): Define.
+ (CRT_CALL_STATIC_FUNCTION): Define.
+ (STARTFILE_SPEC): Add crtbegin.o crtbeginS.o.
+ (ENDFILE_SPEC): Define.
+ (INIT_SECTION_ASM_OP): Define.
+ * config/alpha/vms-dwarf2eh.asm (__EH_FRAME_BEGIN__): Remove.
+ * config/alpha/t-vms (EXTRA_PARTS): Add crtbegin.o crtbeginS.o
+ crtend.o crtendS.o.
+ (MULTILIB_OSDIRNAMES): Define.
+ (shlib_version): Define.
+ (SHLIB_EXT): Define.
+ (SHLIB_OBJS): Define.
+ (SHLIB_NAME): Define.
+ (SHLIB_MULTILIB): Define.
+ (SHLIB_INSTALL): Define.
+ (SHLIB_SYMVEC): Define.
+ (SHLIB_SYMVECX2): Define.
+ (SHLIB_LINK): Define.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/alpha.c (alpha_initialize_trampoline):
+ Initialize VMS trampoline IAW ABI for bounded procedure calls.
+ (alpha_start_function): Emit transfer address on nested functions
+ for VMS trampoline call.
+ * config/alpha/t-vms (LIB2FUNCS_EXTRA): Remove vms_tramp.asm
+ since no longer used.
+ * config/alpha/vms-tramp.asm: Remove.
+ * config/alpha/vms.h (TRAMPOLINE_TEMPLATE): Leave undefined
+ since now only data initialized at runtime.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
+ * config/alpha/vms.h (HANDLE_SYSV_PRAGMA): Define.
+ (LINK_GCC_C_SEQUENCE_SPEC): Define.
+ (MD_EXEC_PREFIX): Remove, no longer used.
+ (MD_STARTFILE_PREFIX): Likewise.
+ (INCLUDE_DEFAULTS): Likewise.
+ * config/alpha/t-vms:
+ (vms-dwarf2.o, vms-dwarf2eh.o): Use GCC_FOR_TARGET to compile.
+
+2009-08-09 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/41016
+ * tree-ssa-ifcombine.c (get_name_for_bit_test): Fix tuplification bug.
+ (operand_precision): Remove.
+ (integral_operand_p): Likewise.
+ (recognize_single_bit_test): Adjust.
+
+2009-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * c-common.c (c_fully_fold_internal): Issue a warning if a binary
+ operation overflows. Likewise non-cast unary arithmetic.
+ If one arm of a conditional expression is always taken,
+ inhibit evaluation warnings for the other arm. Likewise inhibit
+ evaluation warnings for the second && or || operand if the first
+ operand is enough to determine the result.
+ * c-typeck.c (build_conditional_expr): Apply the same inhibition
+ rules here.
+ (build_binary_op): Prevent duplicate evaluation warnings.
+
+2009-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * tree-out-of-ssa.c (insert_value_copy_on_edge): If the source
+ and destination have different modes, Use promote_mode to
+ determine the signedness of the conversion. Assert that the
+ promoted source mode matches the destination mode. Don't pass
+ the destination and destination mode to expand_expr if the source
+ mode is different. Simplify conversion logic.
+
+2009-08-09 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/41008
+ * tree-vect-loop.c (vect_is_simple_reduction): Get operands
+ from condition only in case it's a comparison. Adjust checks.
+
+2009-08-09 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * tree-dfa.c (renumber_gimple_stmt_uids_in_blocks): New function.
+ * tree-flow.h (renumber_gimple_stmt_uids_in_blocks): Declare it.
+ * tree-ssa-loop-ivopts.c (comp_cost): Make COST an integer.
+ (enum iv_position): Add IP_AFTER_USE and IP_BEFORE_USE.
+ (dump_cand): Handle them.
+ (struct iv_cand): New members COST_STEP and AINC_USE.
+ (stmt_after_increment): Likewise.
+ (stmt_after_inc_pos): Renamed from stmt_after_ip_original_pos. All
+ callers changed. Use gimple_uid comparison instead of scanning.
+ (add_candidate_1): When looking for identical candidates, take
+ AINC_USE into account. Set it for new candidates.
+ (force_expr_to_var_cost): Cast target_spill_cost to int.
+ (get_address_cost): New arguments STMT_AFTER_INC and MAY_AUTOINC.
+ All callers changed. Check for availability of autoinc addressing
+ modes, both in general for a given mode, and in the specific use case.
+ (get_computation_cost_at): New argument CAN_AUTOINC. All callers
+ changed.
+ (get_computation_cost): Likewise.
+ (autoinc_possible_for_pair, set_autoinc_for_original_candidates,
+ add_autoinc_candidates): New static functions.
+ (add_candidate): Call add_autoinc_candidates for candidates based on
+ a USE_ADDRESS use.
+ (find_iv_candidates): Call set_autoinc_for_original_candidates.
+ (determine_use_iv_cost_address): If we have an autoinc candidate at
+ the matching use, verify autoinc is possible and subtract the cost
+ of the candidate's step from the cost.
+ (determine_iv_cost): Record the cost of the increment in the COST_STEP
+ member of the candidate.
+ (tree_ssa_iv_optimize_loop): Swap the calls to determine_iv_costs and
+ determine_use_iv_costs. Call renumber_gimple_stmt_uids_in_blocks.
+
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
+ * config.build (ia64-hp-*vms*): New target.
+ (alpha64-dec-*vms*,alpha*-dec-*vms*): Fix for config/vms and unify
+ with ia64-hp-*vms*.
+ * config.gcc (ia64-hp-*vms*): New target.
+ (alpha64-dec-*vms*,alpha*-dec-*vms*): Fix for config/vms and unify
+ with ia64-hp-*vms*.
+ * config.host (ia64-hp-*vms*): New target.
+ (alpha64-dec-*vms*,alpha*-dec-*vms*): Fix for config/vms and unify
+ with ia64-hp-*vms*.
+
+2009-08-08 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40991
+ * tree-ssa-pre.c (eliminate): Delay purging EH edges.
+
+2009-08-08 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * combine.c (gen_lowpart_or_truncate): Exclude CONST_INTs from
+ mode check. Do truncations in an integer mode.
+ (force_to_mode): Handle subregs for all mode types. Only do
+ arithmetic simplifications on integer modes.
+
+2009-08-07 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40999
+ * tree-ssa-ccp.c (get_symbol_constant_value): Handle CONST_DECLs.
+ (maybe_fold_reference): Lookup constant initializers.
+ (fold_gimple_assign): Likewise.
+
+2009-08-07 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa.c (useless_type_conversion_p_1): Only for types
+ that require structural equality defer to the langhook.
+
+2009-08-07 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.h (enum jump_func_type): New value IPA_JF_ANCESTOR, changed
+ comments.
+ (struct ipa_pass_through_data): New type.
+ (struct ipa_ancestor_jf_data): New type.
+ (union jump_func_value): Removed field formal_id, added fields
+ pass_through and ancestor.
+ (struct ipa_param_call_note): Changed type of formal_id to int from
+ unsigned.
+ * ipa-prop.c (ipa_print_node_jump_functions): Print pass through with
+ operations jump functions and ancestor jump functions.
+ (compute_complex_pass_through): New function.
+ (compute_scalar_jump_functions): Call compute_complex_pass_through,
+ reflect changes in the jump function strucutre.
+ (update_jump_functions_after_inlining): Ignore complex pass-through
+ and ancestor jump functions.
+ * ipa-cp.c (ipcp_lattice_from_jfunc): Added support for ancestor and
+ polynomial pass-through with operation jump functions.
+
+2009-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (output_fde): When doing hot/cold partitioning, use
+ fde->dw_fde_begin as begin label instead of hot/cold label.
+ Use LLSDAC label instead of LLSDA for second section lsda.
+ (dwarf2out_do_cfi_startproc): Add SECOND argument. Use LLSDAC
+ label instead of LLSDA if it is true.
+ (dwarf2out_begin_prologue, dwarf2out_switch_text_section): Adjust
+ callers.
+ * except.c (add_call_site, dw2_size_of_call_site_table): Add
+ SECTION argument. Use it as index into crtl->eh.call_site_record
+ array.
+ (dw2_output_call_site_table): Likewise. Add CS_FORMAT argument,
+ use it to determine how to print table entries instead of using
+ #ifdef HAVE_AS_LEB128. For SECTION > 0 use hot resp. cold
+ label instead of normal begin label as base.
+ (sjlj_assign_call_site_values): Adjust add_call_site caller.
+ (convert_to_eh_region_ranges): When doing hot/cold partitioning,
+ ensure no EH range spans between sections and that landing pads
+ are always in the corresponding section.
+ (sjlj_size_of_call_site_table, sjlj_output_call_site_table): Adjust
+ for crtl->eh.call_site_record being an array rather than scalar.
+ (output_one_function_exception_table): New function, copied
+ from output_function_exception_table. Adjust
+ dw2_size_of_call_site_table, dw2_output_call_site_table
+ callers. For SECOND section use *C suffixed labels.
+ (output_function_exception_table): Call
+ output_one_function_exception_table and, when doing hot/cold
+ partitioning, also another time for the second section.
+ * opts.c: Include except.h.
+ (decode_options): Allow -freorder-blocks-and-partition with
+ exceptions, unless SJLJ or TARGET_UNWIND_INFO.
+ * Makefile.in (opts.o): Depend on $(EXCEPT_H).
+ * function.h (struct rtl_eh): Change call_site_record from
+ scalar into array of 2 elements.
+
+2009-08-07 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-prop.c (count_formal_params_1): New function.
+ (ipa_get_vector_of_formal_parms): New function.
+ (get_vector_of_formal_parm_types): New function.
+ (ipa_modify_formal_parameters): New function.
+ (ipa_modify_call_arguments): New function.
+ (index_in_adjustments_multiple_times_p): New function.
+ (ipa_combine_adjustments): New function.
+ (ipa_dump_param_adjustments): New function.
+ * ipa-prop.h (struct ipa_parm_adjustment): New type.
+ (ipa_get_vector_of_formal_parms): Declare.
+ (ipa_modify_formal_parameters): Declare.
+ (ipa_modify_call_arguments): Declare.
+ (ipa_combine_adjustments): Declare.
+ (ipa_dump_param_adjustments): Declare.
+ (build_ref_for_offset): Declare.
+ * Makefile.in (tree-sra.o): Add ipa-prop.h to dependencies.
+ * tree-sra.c: Include ipa-prop.c.
+ (build_ref_for_offset): Make public.
+
+2009-08-06 Neil Vachharajani <nvachhar@gmail.com>
+
+ * value-prof.c (init_pid_map): Replace xmalloc with XCNEWVEC.
+
+2009-08-06 Thomas Schwinge <tschwinge@gnu.org>
+
+ * gcc/doc/extend.texi (__builtin_extract_return_address)
+ (__builtin_frob_return_address): Document.
+
+2009-08-06 Paul Brook <paul@codesourcery.com>
+
+ * config/arm/lib1funcs.asm (ARM_DIV_BODY): Add Thumb-2 implementation.
+ (udivsi3, aeabi_uidivmod, divsi3, aeabi_idivmod): Only use Thumb-1
+ implementation on ARMv6-M.
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ * doc/extend.texi (pcs): Document new attribute for ARM.
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm.c (pcs_attribute_args): Comment out unsupported attribute
+ variants.
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm.c (arm_handle_pcs_attribute): Pass the entire name object to
+ warning ().
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm.c (arm_handle_pcs_attribute): Use %qE in warning.
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ Merge ARM/hard_vfp_branch to trunk.
+
+ 2009-08-04 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm.c (libcall_eq): New function.
+ (libcall_hash): New function.
+ (add_libcall): New function.
+ (arm_libcall_uses_aapcs_base): New function.
+ (arm_libcall_value): Use arm_libcall_uses_aapcs_base to check for
+ libcalls using the base PCS.
+ (arm_init_cumulative_args): Likewise.
+
+ 2009-07-20 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/arm.c (arm_libcall_value, arm_init_cumulative_args):
+ Use base ABI for conversion libfuncs between HFmode and SFmode.
+
+ 2009-05-12 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/arm.c (aapcs_vfp_sub_candidate): Use V2SImode and
+ V4SImode as representatives of all 64-bit and 128-bit vector
+ types. Allow vector types without vector modes.
+ (aapcs_vfp_is_call_or_return_candidate): Handle vector types
+ without vector modes like BLKmode.
+ (aapcs_vfp_allocate): Handle TImode for non-TARGET_NEON like
+ BLKmode. Avoid unsupported vector modes or TImode moves for
+ non-TARGET_NEON.
+ (aapcs_vfp_allocate_return_reg): Likewise.
+ (arm_vector_mode_supported_p): Only support V2SImode, V4HImode and
+ V8QImode if TARGET_NEON || TARGET_IWMMXT.
+
+ 2009-05-12 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/arm.c (arm_handle_pcs_attribute): New.
+ (arm_get_pcs_model): Pass attribute arguments to
+ arm_pcs_from_attribute.
+ (arm_init_cumulative_args): Use base AAPCS for conversions from
+ floating-point types to DImode.
+ (arm_attribute_table): Add pcs attribute.
+ (arm_handle_pcs_attribute): New.
+ * config/arm/bpabi.h (DECLARE_LIBRARY_RENAMES): When renaming
+ conversions from floating-point types to DImode, also declare them
+ to use base AAPCS and declare functions they call to use base
+ AAPCS and their RTABI names.
+
+ 2009-05-12 Joseph Myers <joseph@codesourcery.com>
+
+ * doc/invoke.texi (-mfloat-abi=@var{name}): Remove statement about
+ -mfloat-abi=hard not being supported for VFP.
+
+ 2009-05-11 Kazu Hirata <kazu@codesourcery.com>
+
+ * config/sparc/sparc.c (sparc_emit_float_lib_cmp): Pass a libcall
+ SYMBOL_REF to hard_libcall_value.
+
+ 2009-03-05 Joseph Myers <joseph@codesourcery.com>
+ Richard Earnshaw <rearnsha@arm.com>
+
+ * config/arm/arm.c (aapcs_layout_arg): Once a co-processor argument
+ has been put on the stack, all remaining co-processory arguments for
+ that co-processor also go on the stack.
+
+ 2009-03-05 Joseph Myers <joseph@codesourcery.com>
+
+ * config/arm/arm.c (arm_return_in_memory): Handle returning
+ vectors of suitable size in registers also for AAPCS case.
+
+ 2009-01-13 Richard Earnshaw <rearnsha@arm.com>
+
+ * doc/tm.texi (TARGET_LIBCALL_VALUE): Add missing end statement.
+
+ 2008-12-09 Richard Earnshaw <rearnsha@arm.com>
+
+ ARM Hard-VFP calling convention
+ * target-def.h (TARGET_LIBCALL_VALUE): New hook.
+ * target.h (gcc_target): Add libcall_value to table of call hooks.
+ * targhooks.h (default_libcall_value): Default implementation.
+ * targhooks.c (default_libcall_value): Likewise.
+ * doc/tm.texi (TARGET_LIBCALL_VALUE): Document it.
+ * optabs.c (expand_unop): Use it.
+ * expr.h (hard_libcall_value): Pass the function RTX through.
+ * calls.c (emit_library_call_value_1): Update call to
+ hard_libcall_value.
+ * explow.c (hard_libcall_value): Use new target hook.
+ * testsuite/lib/target-supports.exp
+ (check_effective_target_arm_hard_vfp_ok): New hook.
+ (check_effective_target_arm_neon_ok): Improve test for neon
+ availability.
+ * testsuite/gcc.target/arm/eabi1.c: Only run test in base variant.
+ * config/arm/arm.c: Include cgraph.h
+ (TARGET_FUNCTION_VALUE): Override default hook.
+ (arm_pcs_default): New variable.
+ (arm_override_options): Don't fault hard calling convention with VFP.
+ Add support for AAPCS variants.
+ (arm_function_value): Make static. Handle AAPCS variants.
+ (arm_libcall_value): New function.
+ (arm_apply_result_size): Handle VFP registers in results.
+ (arm_return_in_memory): Rework all AAPCS variants; handle hard-vfp
+ conventions.
+ (pcs_attribute_args): New variable.
+ (arm_pcs_from_attribute): New function.
+ (arm_get_pcs_model): New function.
+ (aapcs_vfp_cum_init): New function.
+ (aapcs_vfp_sub_candidate): New function.
+ (aapcs_vfp_is_return_candidate): New function.
+ (aapcs_vfp_is_call_candidate): New function.
+ (aapcs_vfp_allocate): New function.
+ (aapcs_vfp_allocate_return_reg): New function.
+ (aapcs_vfp_advance): New function.
+ (aapcs_cp_arg_layout): New variable.
+ (aapcs_select_call_coproc): New function.
+ (aapcs_select_return_coproc): New function.
+ (aapcs_allocate_return_reg): New function.
+ (aapcs_libcall_value): New function.
+ (aapcs_layout_arg): New function.
+ (arm_init_cumulative_args): Initialize AAPCS args data.
+ (arm_function_arg): Handle AAPCS variants using new interface.
+ (arm_arg_parital_bytes): Likewise.
+ (arm_function_arg_advance): New function.
+ (arm_function_ok_for_sibcall): Ensure that sibling calls agree on
+ calling conventions.
+ (arm_setup_incoming_varargs): Handle new AAPCS args data.
+ * arm.h (NUM_VFP_ARG_REGS): Define.
+ (LIBCALL_VALUE): Update.
+ (FUNCTION_VALUE): Delete.
+ (FUNCTION_VALUE_REGNO_P): Add VFP regs.
+ (arm_pcs): New enum.
+ (CUMULATIVE_ARGS): New data to support AAPCS argument marshalling.
+ (FUNCTION_ARG_ADVANCE): Call arm_function_arg_advance.
+ (FUNCTION_ARG_REGNO_P): Add VFP regs.
+ * arm-protos.h (arm_function_arg_advance): Add.
+ (aapcs_libcall_value): Add.
+ (arm_function_value): Delete.
+
+2009-08-06 Uros Bizjak <ubizjak@gmail.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/40957
+ * config/i386/i386.c (standard_sse_mode_p): Remove.
+ (standard_sse_constant_p): Return 2 for integer mode
+ vector_all_ones_operand when SSE2 is enabled.
+ (standard_sse_constant_opcode)<case 2>: Always return [v]pcmpeqd.
+ (ix86_expand_vector_move): Do not check for negative values from
+ standard_sse_constant_p.
+
+2009-08-06 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa.c (useless_type_conversion_p_1): Make function and
+ array type comparisons frontend independent.
+ * Makefile.in (tree-ssa.o): Add $(TARGET_H) dependency.
+ * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Always fill
+ out array reference lower bound and element size operands.
+ (ao_ref_init_from_vn_reference): Properly compute the offset
+ for ARRAY_RANGE_REF.
+ (vn_reference_fold_indirect): Fill out array reference lower
+ bound and element size operands.
+ * tree-ssa-pre.c (phi_translate_1): Fail if we have to translate
+ a non gimple valued reference operand which can happen for
+ array reference lower bound or element size.
+ (create_component_ref_by_pieces_1): Properly generate the
+ element size operand for array references.
+
+2009-08-06 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40964
+ * tree.c (iterative_hash_host_wide_int): Export.
+ * tree.h (iterative_hash_host_wide_int): Declare.
+ * tree-ssa-structalias.c (heapvar_map): New struct.
+ (heapvar_map_eq): New function.
+ (heapvar_map_hash): Likewise.
+ (heapvar_lookup): Adjust.
+ (heapvar_insert): Likewise.
+ (make_constraint_from_heapvar): Allow multiple heap variables
+ per decl at different offsets.
+ (init_alias_heapvars): Adjust.
+
+2009-08-04 David Daney <ddaney@caviumnetworks.com>
+
+ * config/mips/mips.h (TARGET_SYNC_AFTER_SC): New macro.
+ * mips_output_sync_loop (mips_output_sync_loop): Only emit
+ trailing sync if TARGET_SYNC_AFTER_SC.
+
+2009-08-05 David Daney <ddaney@caviumnetworks.com>
+
+ * gcc/config/mips/sync.md (sync_compare_and_swap<mode>,
+ compare_and_swap_12, sync_add<mode>, sync_<optab>_12,
+ sync_old_<optab>_12, sync_new_<optab>_12, sync_nand_12,
+ sync_old_nand_12, sync_new_nand_12, sync_sub<mode>,
+ sync_old_add<mode>, sync_old_sub<mode>, sync_new_add<mode>,
+ sync_new_sub<mode>, sync_<optab><mode>, sync_old_<optab><mode>,
+ sync_new_<optab><mode>, sync_nand<mode>, sync_old_nand<mode>,
+ sync_new_nand<mode>, sync_lock_test_and_set<mode>,
+ test_and_set_12): Rewrite calls to mips_output_sync_loop.
+ * gcc/config/mips/mips-protos.h (mips_output_sync_loop): Make
+ the prototype declaration match the definition.
+ * gcc/config/mips/mips.c (mips_output_sync_loop): Emit sync
+ instructions explicitly. Add barrier_before and operands
+ parameters.
+ * gcc/config/mips/mips.h (MIPS_COMPARE_AND_SWAP,
+ MIPS_COMPARE_AND_SWAP_12, MIPS_SYNC_OP, MIPS_SYNC_OP_12,
+ MIPS_SYNC_OLD_OP_12, MIPS_SYNC_NEW_OP_12, MIPS_SYNC_OLD_OP,
+ MIPS_SYNC_NEW_OP, MIPS_SYNC_NAND, MIPS_SYNC_OLD_NAND,
+ MIPS_SYNC_NEW_NAND, MIPS_SYNC_EXCHANGE,
+ MIPS_SYNC_EXCHANGE_12): Remove sync instructions.
+
+2009-08-05 Andrew Pinski <pinskia@gmail.com>
+
+ * tree-ssa-alias.c: Fix intervals to use [) syntax.
+
+2009-08-05 Uros Bizjak <ubizjak@gmail.com>
+ Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
+
+ PR target/40906
+ * config/i386/i386.c (ix86_split_long_move): Fix push of multi-part
+ source operand.
+
+2009-08-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/40924
+ * dse.c (canon_address): Before calling cselib_expand_value_rtx
+ make sure canon_rtx (mem_address) isn't simpler than
+ canon_rtx (expanded_mem_address).
+
+2009-08-05 Li Feng <nemokingdom@gmail.com>
+
+ * graphite-sese-to-poly.c (build_pbb_drs): Remove build alias set
+ for each poly_bb_p.
+ (build_scop_drs): Build alias set for each SCoP.
+
+2009-08-04 Sandra Loosemore <sandra@codesourcery.com>
+
+ * doc/invoke.texi (MIPS Options): Document new 1004K -march options.
+ * config/mips/mips.c (mips_cpu_info_table): Add 1004K cores.
+ * config/mips/mips.h (MIPS_ISA_LEVEL_SPEC): Add pattern for 1004K.
+ (MIPS_ARCH_FLOAT_SPEC): Likewise.
+ (BASE_DRIVER_SELF_SPECS): Likewise.
+
+2009-08-04 Andrew Pinski <pinskia@gmail.com>
+
+ * tree-ssa-alias.c: Fix some comment typos.
+
+2009-08-04 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/linux-atomic.asm (ATOMIC_BOOL_COMPARE_AND_SWAP,
+ ATOMIC_OP_AND_FETCH, ATOMIC_COMBOP_AND_FETCH): Define.
+
+2009-08-03 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/39902
+ * simplify-rtx.c (simplify_binary_operation_1): Disable
+ simplifications for decimal float operations.
+
+2009-08-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/40943
+ * tree-ssa.c (warn_uninitialized_var): Even on LHS warn for
+ operand of INDIRECT_REF.
+
+2009-08-03 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_legitimate_constant_p): Reject CONST
+ constants referencing TLS symbols.
+
+2009-08-03 SUGIOKA Toshinobu <sugioka@itonet.co.jp>
+
+ * config/sh/linux-atomic.asm (ATOMIC_COMPARE_AND_SWAP): Rename
+ __sync_compare_and_swap_* to __sync_val_compare_and_swap_*.
+
+2009-08-03 Richard Guenther <rguenther@suse.de>
+
+ * tree.c (make_vector_type): Build a main variant first,
+ get the canonical one and then build the variant.
+ * tree-ssa.c (useless_type_conversion_p_1): Handle
+ fixed-point types.
+ (useless_type_conversion_p): Conversions to pointers to
+ incomplete record types are useless.
+
+2009-08-03 Richard Guenther <rguenther@suse.de>
+
+ * tree-cfg.c (pass_warn_unused_result): Mark name that no dump
+ file will be created.
+ * omp-low.c (pass_diagnose_omp_blocks): Likewise.
+ * toplev.c (compile_file): Adjust comment.
+
+2009-08-03 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh-protos.h (sh_promote_function_mode): Remove.
+ * config/sh/sh.c (sh_promote_function_mode): Wrap long lines.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS): Remove.
+ (sh_promote_function_mode): Fix typo.
+
+2009-08-03 Andreas Krebbel <krebbel1@de.ibm.com>
+
+ * explow.c (promote_mode): Mark TYPE and PUNSIGNEDP as possibly unused.
+
+2009-08-02 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * pa.c (pa_promote_function_mode): Remove ATTRIBUTE_UNUSED from
+ declaration arguments.
+
+2009-08-02 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (ix86_expand_fp_compare): Use const0_rtx instead
+ of GEN_INT (0x00) and const1_rtx instead of GEN_INT (0x01).
+ (ix86_split_ashl): Ditto.
+ (ix86_expand_vector_init_one_nonzero): Ditto.
+ (ix86_expand_vector_set): Ditto.
+ (ix86_expand_reduc_v4sf): Ditto.
+
+2009-08-02 Paolo Bonzini <bonzini@gnu.org>
+
+ * explow.c (promote_function_mode): Remove assert.
+ * config/sh/sh.c (sh_promote_function_mode): Declare.
+
+2009-08-01 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * config/pa/pa.c (pa_promote_function_mode): Declare.
+ Change to static. Fix promote_mode call.
+
+ * gthr-dce.h (CONST_CAST2): Define if not defined.
+ (__gthread_setspecific): Use CONST_CAST2 to fix warning.
+
+ * config.gcc (hppa[12]*-*-hpux10*): Add stdint support.
+
+2009-08-01 Paolo Bonzini <bonzini@gnu.org>
+
+ * expr.c (store_constructor): Use promote_decl_mode. Remove
+ now write-only variable unsignedp.
+ (expand_expr_real_1): Use promote_decl_mode.
+ * expr.h (promote_function_mode, promote_decl_mode): New.
+ (promote_mode): Remove last argument.
+ * function.c (assign_temp): Drop last argument of promote_mode.
+ (assign_parm_find_data_types): Use promote_function_mode.
+ (assign_parm_setup_reg): Likewise.
+ (expand_function_end): Use promote_function_mode.
+ * calls.c (initialize_argument_information): Use promote_function_mode.
+ (precompute_arguments): Use promote_mode instead of checking if
+ only PROMOTE_FUNCTION_MODE is defined.
+ (expand_call): When making sibcall decisions, use promote_function_mode.
+ Below, remove an if for targetm.calls.promote_function_return and
+ and use promote_function_mode.
+ (emit_library_call_value_1): Use promote_function_mode, fix bug
+ where promote_mode was passed FOR_CALL == 0 for a return value in an
+ assertion.
+ * cfgexpand.c (expand_one_register_var): Use promote_decl_mode.
+ * explow.c (promote_function_mode, promote_decl_mode): New.
+ (promote_mode): Keep only the FOR_CALL == 0 case.
+ * combine.c (setup_incoming_promotion): Remove test of
+ promote_function_args. Use promote_function_mode.
+ * stmt.c (expand_value_return): Use promote_decl_mode.
+ (expand_decl): Use promote_decl_mode.
+
+ * expr.c (store_constructor): Use promote_decl_mode. Remove
+ now write-only variable unsignedp.
+ (expand_expr_real_1): Use promote_decl_mode.
+ * expr.h (promote_function_mode, promote_decl_mode): New.
+ (promote_mode): Remove last argument.
+ * function.c (assign_temp): Drop last argument of promote_mode.
+ (assign_parm_find_data_types): Use promote_function_mode.
+ (assign_parm_setup_reg): Likewise.
+ (expand_function_end): Use promote_function_mode.
+ * calls.c (initialize_argument_information): Use promote_function_mode.
+ (precompute_arguments): Use promote_mode instead of checking if
+ only PROMOTE_FUNCTION_MODE is defined.
+ (expand_call): When making sibcall decisions, use promote_function_mode.
+ Below, remove an if for targetm.calls.promote_function_return and
+ and use promote_function_mode.
+ (emit_library_call_value_1): Use promote_function_mode, fix bug
+ where promote_mode was passed FOR_CALL == 0 for a return value in an
+ assertion.
+ * cfgexpand.c (expand_one_register_var): Use promote_decl_mode.
+ * explow.c (promote_function_mode, promote_decl_mode): New.
+ (promote_mode): Keep only the FOR_CALL == 0 case.
+ * combine.c (setup_incoming_promotion): Remove test of
+ promote_function_args. Use promote_function_mode.
+ * stmt.c (expand_value_return): Use promote_decl_mode.
+ (expand_decl): Use promote_decl_mode.
+
+ * explow.c (promote_function_mode): Just call the target hook.
+ * targhooks.c (default_promote_function_mode,
+ default_promote_function_mode_always_promote): New.
+ * targhooks.h (default_promote_function_mode,
+ default_promote_function_mode_always_promote): Declare.
+ * target.h (promote_function_args, promote_function_return): Remove.
+ (promote_function_mode): New.
+ * target-def.h (TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+ (TARGET_PROMOTE_FUNCTION_MODE): New.
+ (TARGET_CALLS): Adjust.
+ * system.h (TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN, PROMOTE_FUNCTION_MODE): Poison.
+
+ * config/s390/s390.h (PROMOTE_FUNCTION_MODE): Move...
+ * config/s390/s390.c (s390_promote_function_mode): ... here,
+ with pointer handling.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+
+ * config/sparc/sparc.h (PROMOTE_FUNCTION_MODE): Move...
+ * config/sparc/sparc.c (sparc_promote_function_mode): ... here,
+ with pointer handling.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+
+ * config/sh/sh-protos.h (sh_promote_function_mode): New.
+ * config/sh/sh.c (sh_promote_function_mode): New.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+
+ * config/cris/cris.h (PROMOTE_FUNCTION_MODE): Move...
+ * config/cris/cris.c (cris_promote_function_mode): ... here.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS): Remove.
+
+ * config/mmix/mmix.h (PROMOTE_FUNCTION_MODE): Move...
+ * config/mmix/mmix.c (mmix_promote_function_mode): ... here.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS): Remove.
+
+ * config/arm/arm.h (PROMOTE_FUNCTION_MODE): Move...
+ * config/arm/arm.c (arm_promote_function_mode): ... here, without
+ complex type handling.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+
+ * config/pa/pa.c (pa_promote_function_mode): New.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define.
+ (TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+
+ * config/alpha/alpha.c (TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN): Remove.
+ (TARGET_PROMOTE_FUNCTION_MODE): Define equivalently.
+ * config/xtensa/xtensa.c: Likewise.
+ * config/stormy16/stormy16.c: Likewise.
+ * config/iq2000/iq2000.c: Likewise.
+ * config/rs6000/rs6000.c: Likewise.
+ * config/picochip/picochip.c: Likewise.
+ * config/arc/arc.c: Likewise.
+ * config/mcore/mcore.c: Likewise.
+ * config/score/score.c: Likewise.
+ * config/mips/mips.c: Likewise.
+ * config/bfin/bfin.c: Likewise.
+ * config/ia64/ia64.c: Likewise (disabled though).
+
+ * config/frv/frv.h: Remove pointless remark.
+
+ * doc/tm.texi (PROMOTE_FUNCTION_MODE,
+ TARGET_PROMOTE_FUNCTION_ARGS,
+ TARGET_PROMOTE_FUNCTION_RETURN): Consolidate into...
+ (TARGET_PROMOTE_FUNCTION_MODE): ... this.
+
+2009-08-01 Sebastian Pop <sebastian.pop@amd.com>
+
+ * doc/invoke.texi (-fgraphite-force-parallel): Renamed
+ -floop-parallelize-all.
+ * toplev.c (process_options): Rename flag_graphite_force_parallel to
+ flag_loop_parallelize_all.
+ * tree-ssa-loop.c (gate_graphite_transforms): Same.
+ * graphite.c (graphite_transform_loops): Same.
+ * common.opt: Same.
+ * graphite-poly.c (apply_poly_transforms): Same.
+
+2009-07-31 Richard Earnshaw <rearnsha@arm.com>
+
+ PR tree-optimization/40914
+ * ipa-prop.c (ipa_get_ptr_load_param): New argument use_delta,
+ if set, then check the delta field of the PMF record.
+ (ipa_get_stmt_member_ptr_load_param): Propagate new param use_delta.
+ (ipa_analyze_call_uses): Handle machines where the vbit for a PMF
+ call is stored in the delta.
+
+2009-07-31 Adam Nemet <anemet@caviumnetworks.com>
+
+ * config/mips/mips.md (*clear_upper32_dext): New pattern.
+
+2009-07-31 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/bsd.h (ASM_BYTE): New define.
+ * config/i386/darwin.h (ASM_BYTE): Rename from ASM_BYTE_OP.
+ * config/i386/att.h (ASM_BYTE): New define. Use ASM_BYTE instead of
+ .byte. Use fputs or putc instead of fprintf where appropriate.
+ * config/i386/i386-interix.h: Use ASM_BYTE instead of .byte. Use
+ fputs or putc instead of fprintf where appropriate.
+ * config/i386/i386elf.h: Ditto.
+ * config/i386/sysv4.h: Ditto.
+
+ * config/i386/i386.c (TARGET_ASM_BYTE_OP): New define.
+ * config/i386/i386.md (x86_sahf_1): Use ASM_BYTE instead of .byte.
+ (*tls_global_dynamic_64): Ditto.
+
+2009-07-31 Christian Bruel <christian.bruel@st.com>
+
+ * gcc/config.gcc (sh*-*-elf): test with_libgloss.
+
+2009-07-31 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
+
+ * config/arm/arm.c (arm_arm_address_cost): Fix typo.
+ Remove dead code for MINUS.
+
+2009-07-31 Anthony Green <green@moxielogic.com>
+
+ * config/moxie/moxie.c (moxie_expand_prologue): Use $r5 instead of
+ $r12 in prologue.
+ (moxie_expand_epilogue): Ditto for epilogue.
+ (moxie_setup_incoming_varargs): ABI change. Use 5 registers for
+ incoming arguments.
+ (moxie_function_arg): Ditto.
+ (moxie_pass_by_reference): Ditto.
+ (moxie_arg_partial_bytes): Ditto.
+ * config/moxie/moxie.h (CALL_USED_REGISTERS): Ditto.
+ (FUNCTION_ARG_ADVANCE) Ditto.
+ (REG_PARM_STACK_SPACE) Ditto.
+ (FUNCTION_ARG_REGNO_P) Dito.
+
+ * config.gcc: Add moxie linux config support.
+ * gcc/config/moxie/uclinux.h: New file.
+
+2009-07-31 DJ Delorie <dj@redhat.com>
+
+ * config/sh/sh.md (UNSPECV_SP_SWITCH_B): New.
+ (UNSPECV_SP_SWITCH_E): New.
+ (sp_switch_1): Change to an unspec.
+ (sp_switch_2): Change to an unspec. Don't use post-inc when we
+ replace $r15.
+ * config/sh/sh.c (sh_expand_prologue): Use the constant pool to
+ reference the new stack's address
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (OBJS-common): Added dependence on graphite-blocking.o,
+ graphite-clast-to-gimple.o, graphite-dependences.o,
+ graphite-interchange.o, graphite-poly.o, graphite-ppl.o,
+ graphite-scop-detection.o, graphite-sese-to-poly.o, and sese.o.
+ (graphite-blocking.o,
+ graphite-clast-to-gimple.o, graphite-dependences.o,
+ graphite-interchange.o, graphite-poly.o, graphite-ppl.o,
+ graphite-scop-detection.o, graphite-sese-to-poly.o, and sese.o): New.
+ * cfgloop.c (alloc_loop): Set loop->can_be_parallel to false.
+ * cfgloop.h (struct loop): Add can_be_parallel field.
+ * common.opt (fgraphite-identity): Moved up.
+ (fgraphite-force-parallel): New flag.
+ * graphite.c: Rewrite.
+ * graphite.h: Rewrite.
+ * passes.c (init_optimization_passes): Schedule a pass of DCE and LIM
+ after Graphite.
+ * toplev.c (graphite_out_file): New file descriptor.
+ (graphite_in_file): New.
+ (process_options): flag_graphite_force_parallel cannot be used without
+ Graphite.
+ * tree-ssa-loop.c: Include toplev.h.
+ (gate_graphite_transforms): Enable flag_graphite for
+ flag_graphite_force_parallel.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * ChangeLog.graphite: New.
+ * graphite-blocking.c: New.
+ * graphite-clast-to-gimple.c: New.
+ * graphite-clast-to-gimple.h: New.
+ * graphite-dependences.c: New.
+ * graphite-dependences.h: New.
+ * graphite-interchange.c: New.
+ * graphite-poly.c: New.
+ * graphite-poly.h: New.
+ * graphite-ppl.c: New.
+ * graphite-ppl.h: New.
+ * graphite-scop-detection.c: New.
+ * graphite-scop-detection.h: New.
+ * graphite-sese-to-poly.c: New.
+ * graphite-sese-to-poly.h: New.
+ * sese.c: New.
+ * sese.h: New.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-chrec.c (evolution_function_right_is_integer_cst): New.
+ * tree-chrec.h (evolution_function_right_is_integer_cst): Declared.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-chrec.c (operator_is_linear): Handle BIT_NOT_EXPR.
+ (scev_is_linear_expression): Return false if the evolution is not
+ affine multivariate.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-data-ref.c (graphite_find_data_references_in_stmt): New.
+ * tree-data-ref.h (graphite_find_data_references_in_stmt): Declared.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-data-ref.c (debug_data_references): New.
+ (debug_data_reference): New.
+ * tree-data-ref.h (debug_data_references): Declared.
+ (debug_data_reference): Declared.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-data-ref.c (stmt_simple_memref_p: Removed.
+ * tree-data-ref.h (scop_p): Removed.
+ (struct data_reference): Remove field scop.
+ (DR_SCOP): Removed.
+ (stmt_simple_memref_p): Removed.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloop.h (create_empty_loop_on_edge): Pass an extra argument.
+ * cfgloopmanip.c (create_empty_loop_on_edge): Leave the loop_latch
+ basic block empty.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * doc/invoke.texi (-fgraphite-force-parallel): Documented.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * doc/invoke.texi (-fgraphite-identity): Documented.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c: Fix comment.
+ (instantiate_scev_1): Return unknow from scev instantiation if the
+ result is not above instantiate_below.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c (compute_overall_effect_of_inner_loop): Not
+ static anymore. Instantiate the symbols that may have been introduced
+ by chrec_apply.
+ * tree-scalar-evolution.h (compute_overall_effect_of_inner_loop):
+ Declared.
+
+2009-07-30 DJ Delorie <dj@redhat.com>
+
+ * config/mep/mep.c (mep_asm_init_sections): Add section flags and
+ .vliw directive to VLIW sections.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, ACLOCAL, ACLOCAL_AMFLAGS, aclocal_deps):
+ New variables.
+ ($(srcdir)/configure, $(srcdir)/aclocal.m4): New rules.
+ (AUTOHEADER): New variable.
+ ($(srcdir)/cstamp-h.in): Use it.
+
+2009-07-30 Michael Meissner <meissner@linux.vnet.ibm.com>
+ Pat Haugen <pthaugen@us.ibm.com>
+ Revital Eres <ERES@il.ibm.com>
+
+ * config/rs6000/vector.md (VEC_F): Add VSX support.
+ (VEC_A): Ditto.
+ (VEC_N): Ditto.
+ (mov<mode>): Ditto.
+ (vector_load_<mode>): Ditto.
+ (vector_store_<mode>): Ditto.
+ (vector GPR move split): Ditto.
+ (vec_reload_and_plus_<mptrsize>): Ditto.
+ (vec_reload_and_reg_<mptrsize>): Ditto.
+ (add<mode>3): Ditto.
+ (sub<mode>3): Ditto.
+ (mul<mode>3): Ditto.
+ (neg<mode>2): Ditto.
+ (abs<mode>2): Ditto.
+ (smin<mode>3): Ditto.
+ (smax<mode>3): Ditto.
+ (vector_eq<mode>): Ditto.
+ (vector_gt<mode>): Ditto.
+ (vector_ge<mode>): Ditto.
+ (vector_gtu<mode>): Ditto.
+ (vector_select_<mode>_uns): Ditto.
+ (vector_eq_<mode>_p): Ditto.
+ (vector_gt_<mode>_p): Ditto.
+ (vector_ge_<mode>_p): Ditto.
+ (vector_gtu_<mode>_p): Ditto.
+ (cr6_test_for_zero): Ditto.
+ (cr6_test_for_zero_reverse): Ditto.
+ (cr6_test_for_lt): Ditto.
+ (cr6_test_for_lt_reverse): Ditto.
+ (xor<mode>3): Ditto.
+ (ior<mode>3): Ditto.
+ (and<mode>3): Ditto.
+ (one_cmpl<mode>2): Ditto.
+ (nor<mode>2): Ditto.
+ (andc<mode>2): Ditto.
+ (float<VEC_int<mode>2): Ditto.
+ (unsigned_float<VEC_int><mode>2): Ditto.
+ (fix_trunc<mode><VEC_int>2): Ditto.
+ (fixuns_trunc<mode><VEC_int>2): Ditto.
+ (vec_init<mode>):
+ (vec_set<mode>): Ditto.
+ (vec_extract<mode>): Ditto.
+ (vec_interleave_highv4sf): Ditto.
+ (vec_interleave_lowv4sf): Ditto.
+ (vec_realign_load_<mode>): Ditto.
+ (vec_shl_<mode>): Ditto.
+ (vec_shr_<mode>): Ditto.
+ (div<mode>3): New patterns for VSX.
+ (vec_interleave_highv2df): Ditto.
+ (vec_interleave_lowv2df): Ditto.
+ (vec_pack_trunc_v2df): Ditto.
+ (vec_pack_sfix_trunc_v2df): Ditto.
+ (vec_pack_ufix_trunc_v2df): Ditto.
+ (vec_unpacks_hi_v4sf): Ditto.
+ (vec_unpacks_lo_v4sf): Ditto.
+ (vec_unpacks_float_hi_v4si): Ditto.
+ (vec_unpacks_float_lo_v4si): Ditto.
+ (vec_unpacku_float_hi_v4si): Ditto.
+ (vec_unpacku_float_lo_v4si): Ditto.
+ (movmisalign<mode>): Ditto.
+ (vector_ceil<mode>2): New patterns for vectorizing math library.
+ (vector_floor<mode>2): Ditto.
+ (vector_btrunc<mode>2): Ditto.
+ (vector_copysign<mode>3): Ditto.
+
+ * config/rs6000/predicates.md (easy_vector_constant_msb): New
+ predicate for setting the high bit in each word, used for copysign.
+
+ * config/rs6000/ppc-asm.h (f19): Whitespace.
+ (f32-f63): Define if VSX.
+ (v0-v31): Define if Altivec.
+ (vs0-vs63): Define if VSX.
+
+ * config/rs6000/t-rs6000 (MD_INCLUDES): Add power7.md and vsx.md.
+
+ * config/rs6000/power7.md: New file, provide tuning parameters for
+ -mcpu=power7.
+
+ * config/rs6000/rs6000-c.c (rs6000_macro_to_expand): Add VSX support.
+ (rs6000_cpu_cpp_builtins): Ditto.
+ (altivec_overloaded_builtins): Ditto.
+ (altivec_resolve_overloaded_builtin): Ditto.
+
+ * config/rs6000/rs6000.opt (-mno-vectorize-builtins): Add new
+ debug switch to disable vectorizing simple math builtin
+ functions.
+
+ * config/rs6000/rs6000.c (rs6000_builtin_vectorized_function):
+ Vectorize simple math builtin functions.
+ (TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION): Define target
+ hook to vectorize math builtins.
+ (rs6000_override_options): Enable -mvsx on -mcpu=power7.
+ (rs6000_builtin_conversion): Add VSX/power7 support.
+ (rs6000_builtin_vec_perm): Ditto.
+ (vsplits_constant): Add support for loading up a vector constant
+ with just the high bit set in each part.
+ (rs6000_expand_vector_init): Add VSX/power7 support.
+ (rs6000_expand_vector_set): Ditto.
+ (rs6000_expand_vector_extract): Ditto.
+ (rs6000_emit_move): Ditto.
+ (bdesc_3arg): Ditto.
+ (bdesc_2arg): Ditto.
+ (bdesc_1arg): Ditto.
+ (rs6000_expand_ternop_builtin): Ditto.
+ (altivec_expand_builtin): Ditto.
+ (rs6000_expand_unop_builtin): Ditto.
+ (rs6000_init_builtins): Ditto.
+ (altivec_init_builtins): Ditto.
+ (builtin_function_type): Ditto.
+ (rs6000_common_init_builtins): Ditto.
+ (rs6000_handle_altivec_attribute); Ditto.
+ (rs6000_mangle_type): Ditto.
+ (rs6000_vector_mode_supported_p): Ditto.
+ (rs6000_mode_dependent_address): Altivec addresses with AND -16
+ are mode dependent.
+
+ * config/rs6000/vsx.md: New file for VSX support.
+
+ * config/rs6000/rs6000.h (EASY_VECTOR_MSB): New macro for
+ identifing values with just the most significant bit set.
+ (enum rs6000_builtins): Add builtins for VSX. Add simple math
+ vectorized builtins.
+
+ * config/rs6000/altivec.md (UNSPEC_VRFIP): Delete.
+ (UNSPEC_VRFIM): Delete.
+ (splitter for loading up vector with most significant bit): New
+ splitter for vectorizing copysign.
+ (altivec_vrfiz): Rename from altivec_fturncv4sf2. Add support for
+ vectorizing simple math functions.
+ (altivec_vrfip): Add support for vectorizing simple math functions.
+ (altivec_vrfim): Ditto.
+ (altivec_copysign_v4sf3): New insn for Altivec copysign support.
+
+ * config/rs6000/rs6000.md (UNSPEC_BPERM): New constant.
+ (power7.md, vsx.md): Include for power7 support.
+ (copysigndf3): Use VSX instructions if -mvsx.
+ (negdf2_fpr): Ditto.
+ (absdf2_fpr): Ditto.
+ (nabsdf2_fpr): Ditto.
+ (adddf3_fpr): Ditto.
+ (subdf3_fpr): Ditto.
+ (muldf3_fpr): Ditto.
+ (divdf3_fpr): Ditto.
+ (fix_truncdfdi2_fpr): Ditto.
+ (cmpdf_internal1): Ditto.
+ (fred, fred_fpr): Convert into expander/insn to add VSX support.
+ (btruncdf2, btruncdf2_fpr): Ditto.
+ (ceildf2, ceildf2_fpr): Ditto.
+ (floordf2, floordf2_fpr): Ditto.
+ (floatdidf2, floatdidf2_fpr): Ditto.
+ (fmadddf4_fpr): Name insn. Use VSX instructions if -mvsx.
+ (fmsubdf4_fpr): Ditto.
+ (fnmadddf4_fpr_1): Ditto.
+ (fnmadddf4_fpr_2): Ditto.
+ (fnmsubdf4_fpr_1): Ditto.
+ (fnmsubdf4_fpr_2): Ditto.
+ (fixuns_truncdfdi2): Add expander for VSX support.
+ (fix_truncdfdi2): Ditto.
+ (fix_truncdfsi2): Ditto.
+ (ftruncdf2): Ditto.
+ (btruncsf2): Whitespace.
+ (movdf_hardfloat32): Add support for VSX registers.
+ (movdf_softfloat32): Ditto.
+ (movdf_hardfloat64): Ditto.
+ (movdf_hardfloat64_mfpgpr): Ditto.
+ (movdf_softfloat64): Ditto.
+ (movti splitters): Add check for vector registers supporting
+ TImode in the future.
+ (bpermd): Add power7 bpermd instruction.
+
+ * config/rs6000/altivec.h (vec_div): Define if VSX.
+ (vec_mul): Ditto.
+ (vec_msub): Ditto.
+ (vec_nmadd): Ditto.
+ (vec_nearbyint): Ditto.
+ (vec_rint): Ditto.
+ (vec_sqrt): Ditto.
+ (all predicates): Use the generic builtin function, and not the V4SF
+ specific function so that the predicates will work with VSX's V2DF.
+ (vec_all_*): Ditto.
+ (vec_any_*): Ditto.
+
+ * doc/extend.texi (PowerPC Altivec/VSX Built-in Functions):
+ Document new VSX functions and types.
+
+ * doc/invoke.texi (PowerPc options): Document -mpopcntd, -mvsx
+ switches.
+
+ * doc/md.texi (PowerPC constraints): Document "wd", "wf", "ws",
+ "wa", and "j" constraints. Modify "v" to talk about Altivec
+ instead of just vector.
+
+2009-07-30 Andrew MacLeod <amacleod@redhat.com>
+
+ PR debug/26475
+ * tree-into-ssa.c (insert_phi_nodes_for, rewrite_add_phi_arguments): Set
+ location for phi arguments.
+ (rewrite_update_phi_arguments): Find locations for reaching defs.
+ * tree-ssa-threadupdate.c (create_edge_and_update_destination_phis):
+ Add location to add_phi_arg calls.
+ * tree-loop-districbution.c (update_phis_for_loop_copy): Add locations.
+ * tree-ssa-loop-manip.c (create_iv, add_exit_phis_edge,
+ split_loop_exit_edge, tree_transform_and_unroll_loop): Add locations.
+ * tree-tailcall.c (add_successor_phi_arg, eliminate_tail_call,
+ create_tailcall_accumulator, tree_optimize_tail_calls_1): Add locations.
+ * tree.h (struct phi_arg_d): Add location_t to PHI arguments.
+ * tree-phinodes.c (make_phi_node): Initialize location.
+ (resize_phi_node): Initialize location to UNKNOWN_LOCATION.
+ (add_phi_arg): Add location parameter.
+ (remove_phi_arg_num): Move location when moving phi argument.
+ * omp-low.c (expand_parallel_call, expand_omp_for_static_chunk): Set
+ location.
+ * tree-vect-loop-manip.c (slpeel_update_phis_for_duplicate_loop,
+ slpeel_update_phi_nodes_for_guard1,
+ slpeel_update_phi_nodes_for_guard2,
+ slpeel_tree_duplicate_loop_to_edge_cfg, set_prologue_iterations,
+ vect_loop_versioning): Set locations.
+ * tree-parloops.c (create_phi_for_local_result,
+ transform_to_exit_first_loop, create_parallel_loop): Add locations.
+ * gimple-pretty-print.c (dump_gimple_phi): Dump lineno's if present.
+ * tree-vect-loop.c (get_initial_def_for_induction,
+ vect_create_epilog_for_reduction, vect_finalize_reduction): Add
+ locations.
+ * tree-flow-inline.h (gimple_phi_arg_location): New. Return locus.
+ (gimple_phi_arg_location_from_edge): New. Return locus from an edge.
+ (gimple_phi_arg_set_location): New. Set locus.
+ (gimple_phi_arg_has_location): New. Check for locus.
+ (redirect_edge_var_map_location): New. Return locus from var_map.
+ * tree-vect-data-refs.c (vect_setup_realignment): Set location.
+ * tree-ssa-phiopt.c (conditional_replacement): Set locus when
+ combining PHI arguments.
+ (cond_store_replacement): Set location.
+ * cfgexpand.c (gimple_assign_rhs_to_tree): Transfer locus if possible.
+ * grpahite.c (add_loop_exit_phis, add_guard_exit_phis,
+ scop_add_exit_phis_edge): Add locations.
+ * tree-cfgcleanup.c (remove_forwarder_block,
+ remove_forwarder_block_with_phi): Add locations.
+ * tree-ssa-pre.c (insert_into_preds_of_block): Add locations.
+ * tree-predcom.c (initialize_root_vars, initialize_root_vars_lm): Add
+ locations.
+ * tree-ssa-dce.c (forward_edge_to_pdom): Add locations.
+ * tree-ssa.c (redirect_edge_var_map_add, ssa_redirect_edge,
+ flush_pending_stmts): Add source location.
+ * lambda-code.c (perfect_nestify): Maintain location stack with argument
+ stack to preserve locations.
+ * tree-vect-stmts.c (vectorizable_load): Add location.
+ * tree-inline.c (copy_phis_for_bb): Copy locus.
+ (setup_one_parameter): Add call locus to inlined parameter stmts.
+ (initialize_inlined_parameters): Pass in call location as parameter
+ assignment locus.
+ (tree_function_versioning): Pass location to setup_one_parameter.
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Set locations.
+ * tree-outof-ssa.c (struct _elim_graph): Add source_location vecs for
+ copy and edge lists.
+ (insert_partition_copy_on_edge, insert_value_copy_on_edge,
+ insert_rtx_to_part_on_edge, insert_part_to_rtx_on_edge): Provide a
+ locus parameter and override the stmt default if provided.
+ (new_elim_graph, clear_elim_graph, delete_elim_graph,
+ elim_graph_add_edge, elim_graph_remove_succ_edge,
+ FOR_EACH_ELIM_GRAPH_SUCC, FOR_EACH_ELIM_GRAPH_PRED, eliminate_build,
+ elim_forward, elim_unvisited_predecessor, elim_backward, elim_create,
+ eliminate_phi): Add locus info in elimination graph for each edge and
+ value copy.
+ (insert_backedge_copies): Copy locus if present.
+ * tree-flow.h (struct _edge_var_map): Add locus field.
+ * tree-switch_conversions.c (fix_phi_nodes): Add locations.
+ * tree-cfg.c (reinstall_phi_args, gimple_make_forwarder_block,
+ add_phi_args_after_copy_edge, gimple_lv_adjust_loop_header_phi): Add
+ locations.
+ * ipa-struct-reorg.c (make_edge_and_fix_phis_of_dest): Add locations.
+
+2009-07-30 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/40570
+ * ipa-inline.c (cgraph_decide_inlining): Watch out for dead single
+ use inlining loops.
+
+2009-07-30 Razya Ladelsky <razya@il.ibm.com>
+
+ * ssa-loop-manip.c: Include langhooks.h.
+ (rewrite_phi_with_iv): New.
+ (rewrite_all_phi_nodes_with_iv): New.
+ (canonicalize_loop_ivs): Move here from tree-parloops.c.
+ Remove reduction_list argument. Use rewrite_all_phi_nodes_with_iv.
+ * tree-parloops.c (loop_parallel_p): Move out all conditions
+ except dependency check.
+ (canonicalize_loop_ivs): Move to tree-ssa-loop-manip.c.
+ (gen_parallel_loop): Call canonicalize_loop_ivs without
+ reduction_list argument.
+ (build_new_reduction): New.
+ (gather_scalar_reductions): New.
+ (try_get_loop_niter): New.
+ (try_create_reduction_list): New.
+ (parallleize_loops): Change the parallel conditions check.
+ * tree-flow.h (canonicalize_loop_ivs): Remove one argument.
+ * Makefile.in (tree-ssa-loop-manip.o): Add langhooks.h dependency.
+
+2009-07-30 Dave Korn <dave.korn.cygwin@gmail.com>
+
+ * opt-functions.awk (opt_args): Allow argument to be enclosed in
+ curly braces.
+ * doc/options.texi (Option properties): Mention new quoting syntax.
+
2009-07-29 Douglas B Rupp <rupp@gnat.com>
* config/alpha/alpha.c (alpha_start_function):
@@ -178,7 +2070,7 @@
2009-07-25 David Daney <ddaney@caviumnetworks.com>
* cfgcleanup.c (old_insns_match_p): Handle the case of empty blocks.
-
+
2009-07-25 Martin Jambor <mjambor@suse.cz>
* c-common.c (c_common_attribute_table): New element for noclone.
@@ -240,7 +2132,7 @@
(ipa_pop_func_from_list): Clear node_enqueued flag.
2009-07-24 Andreas Krebbel <krebbel1@de.ibm.com>
-
+
* config/s390/s390.c (override_options): Default
max-unrolled-insns to 100 for z10 tuning.
@@ -412,7 +2304,7 @@
(-msched-groups): Ditto.
(-malways-hint): Ditto.
(-malign-branch-targets): Ditto.
-
+
* config/rs6000/rs6000.h (IRA_COVER_CLASSES): Delete, use target
hook instead.
(IRA_COVER_CLASSES_PRE_VSX): Cover classes if not -mvsx.
@@ -456,7 +2348,7 @@
2009-07-23 Richard Earnshaw <rearnsha@arm.com>
- * arm.md (split for ior/xor with shift and zero-extend): Cast op3 to
+ * arm.md (split for ior/xor with shift and zero-extend): Cast op3 to
unsigned HWI.
2009-07-23 Uros Bizjak <ubizjak@gmail.com>
@@ -487,7 +2379,7 @@
* doc/tm.texi (TARGET_IRA_COVER_CLASSES): Add a comment about
importance of order of cover classes in the array.
-
+
2009-07-22 Diego Novillo <dnovillo@google.com>
* tree-pass.h (TDF_EH): Define.
@@ -520,7 +2412,7 @@
* config/s390/constraints.md (ZQ, ZR, ZS, ZT): New constraints.
(U, W): Constraints are now deprecated and will be removed if we
- run out of letters.
+ run out of letters.
* config/s390/s390.md (U, W): Replaced with ZQZR, ZSZT throughout
the file.
("prefetch"): Add the stcmh instruction for prefetching.
@@ -640,24 +2532,24 @@
(get_initial_def_for_reduction): Likewise.
(vectorizable_reduction): Skip the check of first operand in case
of COND_EXPR. Add check that it is outer loop vectorization if
- nested cycle was detected. Call vectorizable_condition() for
+ nested cycle was detected. Call vectorizable_condition() for
COND_EXPR. If reduction epilogue cannot be created do not fail for
nested cycles (if it is not double reduction). Assert that there
is only one type in the loop in case of COND_EXPR. Call
vectorizable_condition() to vectorize COND_EXPR.
* tree-vect-stmts.c (vectorizable_condition): Update comment.
- Add parameters. Allow nested cycles if called from
+ Add parameters. Allow nested cycles if called from
vectorizable_reduction(). Use reduction vector variable if provided.
(vect_analyze_stmt): Call vectorizable_reduction() before
vectorizable_condition().
(vect_transform_stmt): Update call to vectorizable_condition().
2009-07-20 Christian Bruel <christian.bruel@st.com>
-
+
* config/sh/sh.opt (-mfmovd): Resurrect and document.
* doc/invoke.texi (-mfmovd): Likewise.
* config/sh/sh.h (TARGET_FMOVD, MASK_FMOVD): Remove default setting.
-
+
2009-07-20 Jan Hubicka <jh@suse.cz>
* tree-ssa-dce.c (remove_dead_phis): Only look for abnormal PHIs
@@ -822,7 +2714,7 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
- PR 40435
+ PR 40435
* tree-complex.c, tree-loop-distribution.c, tree.c, tree.h,
builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c,
tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c,
@@ -942,10 +2834,10 @@
(sibcall_value_internal): Likewise.
2009-07-14 Ghassan Shobaki <ghassan.shobaki@amd.com>
-
+
* doc/invoke.texi: Added descriptions of the scheduling heuristics
that are enabled/disabled by the flags introduced by a previous patch.
-
+
2009-07-14 DJ Delorie <dj@redhat.com>
* config/mep/mep.md (sibcall_internal): Include non-toggling
@@ -965,7 +2857,7 @@
* tree-vrp.c (vrp_evaluate_conditional): Mark strings for
translation.
-
+
2009-07-14 DJ Delorie <dj@redhat.com>
* config/mep/mep.c (mep_vliw_jmp_match): New function.
@@ -1055,14 +2947,14 @@
calculations.
2009-07-13 Ghassan Shobaki <ghassan.shobaki@amd.com>
-
+
* haifa-sched.c (rank_for_schedule): Introduced flags to
enable/disable individual scheduling heuristics.
* common.opt: Introduced flags to enable/disable individual
- heuristics in the scheduler.
+ heuristics in the scheduler.
* doc/invoke.texi: Introduced flags to enable/disable individual
heuristics in the scheduler.
-
+
2009-07-13 Kai Tietz <kai.tietz@onevision.com>
* config/i386/t-gthr-win32 (LIB2FUNCS_EXTRA): Remove file
@@ -1071,7 +2963,7 @@
2009-07-13 Ira Rosen <irar@il.ibm.com>
- * tree-vect-loop.c (get_initial_def_for_reduction): Ensure that the
+ * tree-vect-loop.c (get_initial_def_for_reduction): Ensure that the
checks access only relevant statements.
(vectorizable_reduction): Likewise.
@@ -1266,7 +3158,7 @@
2009-07-09 Basile Starynkevitch <basile@starynkevitch.net>
- * plugin.c (try_init_one_plugin): passes RTLD_GLOBAL to dlopen.
+ * plugin.c (try_init_one_plugin): passes RTLD_GLOBAL to dlopen.
2009-07-09 Jakub Jelinek <jakub@redhat.com>
@@ -1827,7 +3719,7 @@
2009-06-30 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/40542
- * tree-vect-stmts.c (vect_analyze_stmt): Don't vectorize volatile
+ * tree-vect-stmts.c (vect_analyze_stmt): Don't vectorize volatile
types.
2009-06-30 Martin Jambor <mjambor@suse.cz>
@@ -1977,13 +3869,13 @@
* config/cris/cris.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/cris/cris.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
(cris_frame_pointer_required): New function.
-
+
* config/crx/crx.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/fr30/fr30.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/fr30/fr30.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
(fr30_frame_pointer_required): New function.
-
+
* config/frv/frv.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/frv/frv.c (TARGET_FRAME_POINTER_REQUIRED): Define.
(frv_frame_pointer_required): Make as static, change return type
@@ -2002,14 +3894,14 @@
* config/m32r/m32r.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/mcore/mcore.h (CAN_ELIMINATE): Remove macro.
-
+
* config/mep/mep.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/mips/mips.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/mips/mips.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
(mips_frame_pointer_required): Make as static.
* config/mips/mips-protos.h (mips_frame_pointer_required): Remove.
-
+
* config/mmix/mmix.h (FRAME_POINTER_REQUIRED): Remove macro.
* config/mmix/mmix.c (TARGET_FRAME_POINTER_REQUIRED): Define macro.
(mmix_frame_pointer_required): Mew function.
@@ -2292,7 +4184,7 @@
* domwalk.h (struct dom_walk_data): Remove all callbacks except
before_dom_children_before_stmts and after_dom_children_after_stmts.
- Rename the two remaining callbacks to just before_dom_children and
+ Rename the two remaining callbacks to just before_dom_children and
after_dom_children. Remove other GIMPLE statement walking bits.
* domwalk.c (walk_dominator_tree): Remove now unsupported features.
* graphite.c: Do not include domwalk.h.
@@ -2308,7 +4200,7 @@
(rewrite_leave_block): ... this, place after called functions.
(rewrite_update_init_block): Rename to...
(rewrite_update_enter_block): ... this, place after called functions.
- Test interesting_blocks, call rewrite_update_stmt and
+ Test interesting_blocks, call rewrite_update_stmt and
rewrite_update_phi_arguments.
(rewrite_update_fini_block): Rename to...
(rewrite_leave_block): ... this, place after called functions.
@@ -2454,7 +4346,7 @@
* config/rs6000/rs6000-protos.h (rs6000_secondary_reload_class):
Change some of the functions called by macros to being called
through a pointer, so debug functions can be inserted if
- -mdebug=addr or -mdebug=cost.
+ -mdebug=addr or -mdebug=cost.
(rs6000_preferred_reload_class_ptr): Ditto.
(rs6000_secondary_reload_class_ptr): Ditto.
(rs6000_secondary_memory_needed_ptr): Ditto.
@@ -2619,7 +4511,7 @@
PR target/40515
* doc/invoke.texi (SH Options): Document -m2a, -m2a-single,
-m2a-single-only and -m2a-nofpu.
- * config/sh/sh.opt: Document m2a generates FPU code.
+ * config/sh/sh.opt: Document m2a generates FPU code.
2009-06-24 Anatoly Sokolov <aesok@post.ru>
@@ -2646,10 +4538,10 @@
2009-06-24 Denis Chertykov <chertykov@gmail.com>
- * doc/contrib.texi (Contributors):
+ * doc/contrib.texi (Contributors):
2009-06-24 Andreas Krebbel <krebbel1@de.ibm.com>
-
+
PR middle-end/40501
* tree-ssa-math-opts.c (execute_optimize_bswap): Convert the bswap
src and dst operands if necessary.
@@ -2938,7 +4830,7 @@
away, don't fill in pos_src. For dst_l == 2 avoid qsort.
Avoid quadratic comparison if !flag_var_tracking_uninit.
(variable_canonicalize): Pass VAR_INIT_STATUS_UNKNOWN to
- unshare_variable unconditionally.
+ unshare_variable unconditionally.
(dataflow_set_different_2): Removed.
(dataflow_set_different): Don't traverse second hash table.
(compute_bb_dataflow): Pass VAR_INIT_STATUS_UNINITIALIZED
@@ -3131,7 +5023,7 @@
* Makefile.in (install-plugin): Always use DESTDIR.
2009-06-22 Olivier Hainque <hainque@adacore.com>
-
+
* config/pa/pa.c (output_call): Don't optimize post call jumps
into return address adjustments if the call may throw.
@@ -3428,13 +5320,13 @@
* Makefile.in (OBJS-common): Remove see.o.
(see.o): Remove.
* common.opt (fsee): Mark as preserved for backward compatibility.
- * opts.c (common_handle_option): Add OPT_fsee to the backward
+ * opts.c (common_handle_option): Add OPT_fsee to the backward
compatibility section.
* passes.c (init_optimization_passes, pass_see): Remove pass.
* timevar.def (TV_SEE): Remove.
* tree-pass.h (pass_see): Remove declaration.
* doc/invoke.texi (-fsee): Remove documentation.
-
+
2009-06-18 Martin Jambor <mjambor@suse.cz>
* tree-sra.c: Include statistics.h
@@ -3533,7 +5425,7 @@
* collect2.c (main): Use CONST_CAST2 to perform char ** to
const char ** conversion in AIX specific section.
-
+
2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c (ix86_special_builtin_type): Remove
@@ -3646,7 +5538,7 @@
2009-06-17 Basile Starynkevitch <basile@starynkevitch.net>
- * doc/plugins.texi (Building GCC plugins): Added new section.
+ * doc/plugins.texi (Building GCC plugins): Added new section.
2009-06-17 Ian Lance Taylor <iant@google.com>
@@ -3871,7 +5763,7 @@
reduction variable.
(vect_finalize_reduction): Handle subtraction, fix comments.
(vectorizable_reduction): Handle nested cycles. In case of nested
- cycle keep track of the reduction variable position. Call
+ cycle keep track of the reduction variable position. Call
vect_is_simple_reduction with additional parameter. Use original
statement code in reduction epilogue for nested cycle. Call
vect_create_epilog_for_reduction with additional parameter.
@@ -4131,7 +6023,7 @@
PR target/40327
* arm/constraints.md (Pa, Pb): New constraints.
- * arm/arm.md (thumb1_addsi3): Support more complex additions. Add a
+ * arm/arm.md (thumb1_addsi3): Support more complex additions. Add a
split pattern to deal with them.
2009-06-13 Joerg Sonnenberger <joerg@britannica.bec.de>
@@ -4824,23 +6716,23 @@
2009-06-08 Ghassan Shobaki <ghassan.shobaki@amd.com>
Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
-
- * tree-ssa-loop-prefetch.c
- (gather_memory_references): Introduced a counter for the number of
+
+ * tree-ssa-loop-prefetch.c
+ (gather_memory_references): Introduced a counter for the number of
memory references.
- (anything_to_prefetch_p): Introduced a counter for the number of
+ (anything_to_prefetch_p): Introduced a counter for the number of
prefetches.
- (is_loop_prefetching_profitable): New function with a cost model
+ (is_loop_prefetching_profitable): New function with a cost model
for prefetching.
- (loop_prefetch_arrays): Use the new cost model to determine if
+ (loop_prefetch_arrays): Use the new cost model to determine if
prefetching is profitable.
- * params.def (MIN_INSN_TO_PREFETCH_RATIO,
+ * params.def (MIN_INSN_TO_PREFETCH_RATIO,
PREFETCH_MIN_INSN_TO_MEM_RATIO): New parameters.
- * params.h (MIN_INSN_TO_PREFETCH_RATIO,
+ * params.h (MIN_INSN_TO_PREFETCH_RATIO,
PREFETCH_MIN_INSN_TO_MEM_RATIO): New parameters.
- * doc/invoke.texi (MIN_INSN_TO_PREFETCH_RATIO,
+ * doc/invoke.texi (MIN_INSN_TO_PREFETCT_RATIO,
PREFETCH_MIN_INSN_TO_MEM_RATIO): New parameters.
-
+
2009-06-08 Michael Matz <matz@suse.de>
PR debug/40012
@@ -5168,15 +7060,15 @@
2009-06-03 Andrey Belevantsev <abel@ispras.ru>
- * statistics.c (statistics_counter_event): Do not record event
+ * statistics.c (statistics_counter_event): Do not record event
in pass dump if its number == -1.
- (curr_statistics_hash): Add assert that we never get passes
+ (curr_statistics_hash): Add assert that we never get passes
with static number == -1.
2009-06-03 Richard Guenther <rguenther@suse.de>
Andrey Belevantsev <abel@ispras.ru>
- * cfgexpand.c (discover_nonconstant_array_refs_r): Make only
+ * cfgexpand.c (discover_nonconstant_array_refs_r): Make only
non-BLKmode arrays addressable.
2009-06-03 Maxim Kuvyrkov <maxim@codesourcery.com>
@@ -5562,8 +7454,8 @@
2009-05-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* configure.ac: Add MPC support.
-
- * config.in, configure: Regenerate.
+
+ * config.in, configure: Regenerate.
2009-05-29 Richard Henderson <rth@redhat.com>
@@ -5911,7 +7803,7 @@
PR rtl-optimization/40101
* sel-sched-ir.c (get_seqno_by_preds): Allow returning negative
seqno. Adjust comment.
- * sel-sched.c (find_seqno_for_bookkeeping): Assert that when
+ * sel-sched.c (find_seqno_for_bookkeeping): Assert that when
inserting bookkeeping before a jump, the jump is not scheduled.
When no positive seqno found, provide a value. Add comment.
@@ -5940,7 +7832,7 @@
2009-05-29 David Billinghurst <billingd@gcc.gnu.org>
* config.gcc: Add i386/t-fprules-softfp and soft-fp/t-softfp
- to tmake_file for i[34567]86-*-cygwin*.
+ to tmake_file for i[34567]86-*-cygwin*.
2009-05-29 Jakub Jelinek <jakub@redhat.com>
@@ -5970,7 +7862,7 @@
2009-05-28 Steve Ellcey <sje@cup.hp.com>
* doc/invoke.texi (IA-64 Options):
- Add -msdata, -mfused-madd, -mno-inline-float-divide,
+ Add -msdata, -mfused-madd, -mno-inline-float-divide,
-mno-inline-int-divide, -mno-inline-sqrt, -msched-spec-ldc,
-msched-spec-control-ldc, -msched-prefer-non-data-spec-insns,
-msched-prefer-non-control-spec-insns,
@@ -6132,7 +8024,7 @@
(highest_pow2_factor_for_target): Use it instead of relying on
immediate tree attributes of TARGET, not necessarily honored when
intermediate bitfields are involved.
-
+
2009-05-27 H.J. Lu <hongjiu.lu@intel.com>
PR target/40266
@@ -6363,7 +8255,7 @@
callused solutions.
* tree-ssa-structalias.c (pass_build_ealias): New.
* tree-pass.h (pass_build_ealias): Declare.
- * passes.c (init_optimization_passes): Add PTA during
+ * passes.c (init_optimization_passes): Add PTA during
early optimizations.
* tree-ssa-alias.c (dump_alias_info): Dump the ESCAPED
and CALLUSED solutions.
@@ -6383,7 +8275,7 @@
PR tree-optimization/40238
* tree-vect-stmts.c (vect_init_vector): Insert initialization
statements after basic block's labels.
- * tree-vect-slp.c (vect_slp_transform_bb): Call destroy_bb_vec_info()
+ * tree-vect-slp.c (vect_slp_transform_bb): Call destroy_bb_vec_info()
to free the allocated memory.
2009-05-24 Kaz Kojima <kkojima@gcc.gnu.org>
@@ -6412,7 +8304,7 @@
(fini_ssa_operands): Do not free it.
(push_stmt_changes, pop_stmt_changes, discard_stmt_changes): Delete.
- * tree-cfg.c (replace_uses_by): Replace pop_stmt_changes with
+ * tree-cfg.c (replace_uses_by): Replace pop_stmt_changes with
update_stmt, remove the others. Fix comments.
* tree-dfa.c (optimize_stack_restore): Likewise.
* tree-ssa-forwprop.c (forward_propagate_addr_expr): Likewise.
@@ -6757,7 +8649,7 @@
nmadddf4_truncsf, maddxf4, maddxf4_truncsf, maddxf4_truncdf,
msubxf4, msubxf4_truncsf msubxf4_truncdf, nmaddxf4,
nmaddxf4_truncsf, nmaddxf4_truncdf): Check TARGET_FUSED_MADD.
- * config/ia64/vect.md (addv2sf3, subv2sf3): Force fpma/fpms
+ * config/ia64/vect.md (addv2sf3, subv2sf3): Force fpma/fpms
instruction if !TARGET_FUSED_MADD.
(fpma, fpms): Remove colon from name.
@@ -7028,7 +8920,7 @@
* config/arm/arm.c (const_ok_for_op): Split case for IOR for Thumb2.
(arm_gen_constant): Set can_invert for IOR and Thumb2, Add comments.
Don't invert remainder for IOR.
-
+
2009-05-19 Zdenek Dvorak <ook@ucw.cz>
PR tree-optimization/40087
@@ -7057,7 +8949,7 @@
* c-opt (c_common_post_options): Do not enable Wlogical-op with
Wextra.
* doc/invoke.texi (Wlogical-op): Likewise.
-
+
2009-05-19 Eric Botcazou <ebotcazou@adacore.com>
* tree-scalar-evolution.c (follow_ssa_edge_expr) <NOP_EXPR>: Turn
@@ -7121,7 +9013,7 @@
(add_fdes): Likewise.
(binary_search_unencoded_fdes): Likewise.
(linear_search_fdes): Eliminate type puns.
-
+
2009-05-19 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Do
@@ -7139,7 +9031,7 @@
(TARGET_LEGITIMATE_ADDRESS_P): New.
* config/sh/sh.h (GO_IF_LEGITIMATE_ADDRESS): Delete.
* config/sh/sh.md: Clean up references to GO_IF_LEGITIMATE_ADDRESS.
-
+
2009-05-18 Dodji Seketeli <dodji@redhat.com>
PR debug/40109
@@ -7387,7 +9279,7 @@
PR 16302
* fold-const.c (make_range,build_range_check,merge_ranges): Move
declaration to...
- (merge_ranges): Returns bool.
+ (merge_ranges): Returns bool.
* tree.h (make_range): .. to here.
(build_range_check): Likewise.
(merge_ranges): Likewise. Renamed from merge_ranges.
@@ -7395,11 +9287,11 @@
warn_logical_operator.
* c-common.c (warn_logical_operator): Add new warning.
* c-common.h (warn_logical_operator): Update declaration.
-
+
2009-05-15 Manuel López-Ibáñez <manu@gcc.gnu.org>
* ira-conflicts.c (add_insn_allocno_copies): Fix wrong conditional.
-
+
2009-05-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* doc/install.texi: Document MPC requirements, flags etc.
@@ -8106,11 +9998,11 @@
(stack probe test): Use cbranchdi4.
* config/alpha/predicates.md (alpha_cbranch_operator): New.
- * config/arc/arc.c (gen_compare_reg): Do not emit cmp.
+ * config/arc/arc.c (gen_compare_reg): Do not emit cmp.
* config/arc/arc.h (movsicc, movsfcc): Use it.
(movdicc, *movdicc_insn, movdfcc, *movdfcc_insn): Remove.
(cbranchsi4, cstoresi4): New.
- (cmpsi, bCC and sCC expanders): Remove.
+ (cmpsi, bCC and sCC expanders): Remove.
* config/arm/arm.c (arm_compare_op0, arm_compare_op1): Delete.
* config/arm/arm.h (arm_compare_op0, arm_compare_op1): Delete.
@@ -8147,7 +10039,7 @@
* config/bfin/predicates.md (bfin_cbranch_operator): Rename to...
(bfin_bimode_comparison_operator): ... this.
(bfin_direct_comparison_operator): New.
-
+
* config/cris/cris.c (cris_normal_notice_update_cc): Look
inside (compare FOO (const_int 0)).
(cris_rtx_costs): Handle ZERO_EXTRACT.
@@ -8226,7 +10118,7 @@
from *expr. Update *expr with the BImode comparison to do.
* config/ia64/ia64.md (cmpbi, cmpsi, cmpdi, cmpsf, cmpdf, cmpxf,
cmptf, bCC, sCC, conditional_trap): Delete.
- (cbranchbi4, cbranchsi4, cbranchdi4, cbranchsf4, cbranchdf4,
+ (cbranchbi4, cbranchsi4, cbranchdi4, cbranchsf4, cbranchdf4,
cbranchxf4, cbranchtf4, cstorebi4, cstoresi4, cstoredi4, cstoresf4,
cstoredf4, cstorexf4, cstoretf4, ctrapbi4, ctrapsi4, ctrapdi4,
ctrapsf4, ctrapdf4, ctrapxf4, ctraptf4): New.
@@ -8270,7 +10162,7 @@
* config/m32r/m32r.h (m32r_compare_op0, m32r_compare_op1): Delete.
* config/m32r/m32r.md (cmpsi, bCC, sCC): Delete.
(cbranchsi4, cstoresi4): New.
-
+
* config/m68hc11/m68hc11.c (m68hc11_compare_op0, m68hc11_compare_op1):
Delete.
(m68hc11_rtx_costs_1, m68hc11_rtx_costs): Handle ZERO_EXTRACT.
@@ -8313,7 +10205,7 @@
* config/mcore/mcore-protos.h (arch_compare_op0, arch_compare_op1,
mcore_modify_comparison, mcore_gen_compare_reg): Remove.
- (mcore_gen_compare): New.
+ (mcore_gen_compare): New.
* config/mcore/mcore.c (arch_compare_op0, arch_compare_op1): Delete.
(mcore_modify_comparison, mcore_gen_compare_reg): Fold into...
(mcore_gen_compare): ... this.
@@ -8328,7 +10220,7 @@
always succeed.
(fixuns_truncdfsi2, fixuns_truncdfdi2, fixuns_truncsfsi2,
fixuns_truncsfdi2): Use cbranch patterns.
- (cmp<GPR:mode>, cmp<SCALARF:mode>): Delete.
+ (cmp<GPR:mode>, cmp<SCALARF:mode>): Delete.
(b<code>): Change to cbranch<GPR:mode>4 and cbranch<SCALARF:mode>4.
Adjust call to mips_expand_conditional_branch.
(seq, sne, slt<u>, sle<u>, sgt<u>, sge<u>): Change to
@@ -8341,7 +10233,7 @@
that it succeeds. Use op0/op1 instead of cmp_operands.
(mips_expand_conditional_branch, mips_expand_conditional_move,
mips_expand_conditional_trap): Likewise.
- (mips_block_move_loop): Use cbranch patterns.
+ (mips_block_move_loop): Use cbranch patterns.
* config/mips/mips.h (cmp_operands): Delete.
* config/mmix/mmix.c (mmix_valid_comparison): Delete.
@@ -8403,7 +10295,7 @@
* config/rs6000/rs6000-protos.h (rs6000_emit_sCOND,
rs6000_emit_cbranch): Accept mode and operands.
* config/rs6000/rs6000.c (rs6000_compare_op0, rs6000_compare_op1,
- rs6000_compare_fp_p): Delete.
+ rs6000_compare_fp_p): Delete.
(rs6000_generate_compare): Accept mode and comparison. Extract code
and op0/op1 from there. Replace references to rs6000_compare_op0
and rs6000_compare_op1.
@@ -8421,7 +10313,7 @@
(stack_protect_test): Use cbranchsi4.
(conditional_trap): Replace with ctrap<GPR>4.
(conditional trap insn): Replace trap_comparison_operator with
- ordered_comparison_operator.
+ ordered_comparison_operator.
* config/s390/s390.c (s390_compare_op0, s390_compare_op1): Delete.
(s390_emit_prologue): Use ctrap.
@@ -8497,7 +10389,7 @@
* config/sparc/sparc.c (sparc_compare_op0, sparc_compare_op1): Delete.
(gen_compare_reg): Accept comparison, extract part of it to...
- (gen_compare_reg_1): ... this.
+ (gen_compare_reg_1): ... this.
(gen_compare_operator): Delete.
(gen_v9_scc): Accept separate destination, comparison code and arms.
Do not use sparc_compare_op0/sparc_compare_op1.
@@ -8528,14 +10420,14 @@
* config/spu/spu-protos.h (spu_emit_branch_or_set): Change second
argument to rtx.
- * config/spu/spu.c (spu_compare_op0, spu_compare_op1): Remove.
+ * config/spu/spu.c (spu_compare_op0, spu_compare_op1): Remove.
(spu_emit_branch_or_set): Get code/op0/op1 from second argument.
Change spu_compare_op0/op1 to op0/op1 throughout. Get target
from operands[0] or operands[3] depending on is_set.
* config/spu/spu.h (spu_compare_op0, spu_compare_op1): Remove.
* config/spu/spu.md (cmp<mode:VQHSI>, cmp<mode:DTI>, cmp<mode:VSF>,
cmpdf, bCC), sCC: Remove.
- (cbranch<mode:VQHSI>4, cbranch<mode:DTI>, cbranch<mode:VSF>4,
+ (cbranch<mode:VQHSI>4, cbranch<mode:DTI>, cbranch<mode:VSF>4,
cbranchdf4, cstore<mode:VQHSI>4, cstore<mode:DTI>, cstore<mode:VSF>4,
cstoredf4): New.
(mov<mode>cc): Accept ordered_comparison_operator, adjust call to
@@ -8546,7 +10438,7 @@
* config/stormy16/stormy16.h (xstormy16_compare_op0,
xstormy16_compare_op1): Delete.
* config/stormy16/stormy16.c (xstormy16_compare_op0,
- xstormy16_compare_op1): Delete.
+ xstormy16_compare_op1): Delete.
(xstormy16_emit_cbranch): Get op0/op1 from the new arguments.
Adjust calls.
* config/stormy16/stormy16.md (cbranchsi4, cbranchhi4): New.
@@ -8558,7 +10450,7 @@
(bCC expanders): Delete.
(sCC insns): Fold into...
(*setcc): ... this one.
- (casesi): Do not use gen_cmpsi and gen_bgtu.
+ (casesi): Do not use gen_cmpsi and gen_bgtu.
(various splits): Wrap "naked" RHS of a cc0 set with COMPARE.
(movsicc): Simplify.
* config/v850/v850.c (v850_rtx_costs): Handle ZERO_EXTRACT in COMPARE.
@@ -8616,7 +10508,7 @@
2009-05-11 Martin Jambor <mjambor@suse.cz>
* ipa-cp.c (ipcp_cloning_candidate_p): Add missing return false.
-
+
2009-05-11 Jan Hubicka <jh@suse.cz>
* tree-ssa-loop-ivcanon.c: Include target.h
@@ -8892,7 +10784,7 @@
* tree-eh.c (struct leh_state): Remove prev_try.
(lower_try_finally, lower_catch, lower_eh_filter, lower_cleanup): Do
not track prev_try.
- * except.c (gen_eh_region_cleanup, duplicate_eh_regions,
+ * except.c (gen_eh_region_cleanup, duplicate_eh_regions,
copy_eh_region_1, copy_eh_region, redirect_eh_edge_to_label,
remove_eh_handler_and_replace, foreach_reachable_handler,
verify_eh_region, verify_eh_tree): Remove tracking of prev_try pointer.
@@ -9028,11 +10920,11 @@
dataflow.
(fwprop_done): Free use_def_ref.
(fwprop_addr): Eliminate duplicate call to df_set_flags.
- * df-problems.c (df_rd_simulate_artificial_defs_at_top,
+ * df-problems.c (df_rd_simulate_artificial_defs_at_top,
df_rd_simulate_one_insn): New.
(df_rd_bb_local_compute_process_def): Update head comment.
(df_chain_create_bb): Use the new RD simulation functions.
- * df.h (df_rd_simulate_artificial_defs_at_top,
+ * df.h (df_rd_simulate_artificial_defs_at_top,
df_rd_simulate_one_insn): New.
* opts.c (decode_options): Enable fwprop at -O1.
* doc/invoke.texi (-fforward-propagate): Document this.
@@ -9129,7 +11021,7 @@
* regrename.c (regrename_optimize): Return 0.
(rest_of_handle_regrename): Delete.
(pass_rename_registers): Point to regrename_optimize.
- (struct value_data_entry, struct value_data,
+ (struct value_data_entry, struct value_data,
kill_value_one_regno, kill_value_regno, kill_value,
set_value_regno, init_value_data, kill_clobbered_value,
kill_set_value, kill_autoinc_value, copy_value,
@@ -9197,8 +11089,8 @@
* tree-ssa.c (execute_update_address_taken): Handle TARGET_MEM_REF
when processing for not_regs_needed bitmap.
* gimple.c (walk_stmt_load_store_addr_ops): When visiting address,
- handle TARGET_MEM_REF in lhs. Check TMR_BASE for NULL while
- handling it for rhs.
+ handle TARGET_MEM_REF in lhs. Check TMR_BASE for NULL while
+ handling it for rhs.
2009-05-06 H.J. Lu <hongjiu.lu@intel.com>
@@ -9538,7 +11430,7 @@
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.
@@ -9902,7 +11794,7 @@
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
@@ -10075,7 +11967,7 @@
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
+ Use REPORT_VECTORIZED_LOCATIONS instead
REPORT_VECTORIZED_LOOPS.
* tree-vectorizer.c (vect_verbosity_level): Make static.
(vect_loop_location): Rename to vect_location.
@@ -10088,10 +11980,10 @@
* 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
+ 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
+ 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.
@@ -10115,7 +12007,7 @@
* 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,
+ (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,
@@ -10243,7 +12135,7 @@
(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.
+ (eligible_for_return_delay): Likewise.
* config/spu/spu.c (expand_builtin_args): Add cast to enum type.
(spu_expand_builtin_1): Likewise.
@@ -10483,7 +12375,7 @@
* builtins.c (fold_builtin_next_arg): Handle SSA names.
* tree-ssa-copyrename.c (rename_ssa_copies): Use ssa_name() directly.
* tree-ssa-coalesce.c (create_outofssa_var_map): Mark only useful
- SSA names.
+ SSA names.
(compare_pairs): Swap cost comparison.
(coalesce_ssa_name): Don't use change_partition_var.
* tree-nrv.c (struct nrv_data): Add modified member.
@@ -10877,7 +12769,7 @@
* config/i386/gas.h (GAS_MNEMONICS): Remove.
2009-04-25 Ben Elliston <bje@au.ibm.com>
-
+
* genrecog.c (validate_pattern): Do not warn for VOIDmode CALLs as
the source of a set operation.
@@ -10912,7 +12804,7 @@
CONSTRAINT_NUM_DEFINED_P macro.
* ira.c (setup_cover_and_important_classes): Use
CONSTRAINT_NUM_DEFINED_P instead of CONSTRAINT__LIMIT in #ifdef.
-
+
2009-04-24 DJ Delorie <dj@redhat.com>
* config/sh/sh.h (LIBGCC2_DOUBLE_TYPE_SIZE): Test
@@ -11318,8 +13210,8 @@
2009-04-22 Andrey Belevantsev <abel@ispras.ru>
PR rtl-optimization/39580
- * sel-sched-ir.c (insert_in_history_vect): Remove incorrect gcc_assert.
-
+ * sel-sched-ir.c (insert_in_history_vect): Remove incorrect gcc_assert.
+
2009-04-22 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* function.c (expand_function_end): Do not emit a jump to the "naked"
@@ -11360,7 +13252,7 @@
* config/alpha/alpha.md: Ditto.
* config/alpha/constraints.md: Ditto.
* config/alpha/predicates.md: Ditto.
-
+
2009-04-22 Paolo Bonzini <bonzini@gnu.org>
* defaults.h (GO_IF_MODE_DEPENDENT_ADDRESS): Provide empty default.
@@ -11427,7 +13319,7 @@
(push_fpscr): Use add_reg_note.
(pop_fpscr, movdf_i4+1, reload_outdf__RnFRm+3, reload_outdf__RnFRm+4,
reload_outdf__RnFRm+5, fpu_switch+1, fpu_switch+2): Likewise.
-
+
2009-04-21 Joseph Myers <joseph@codesourcery.com>
* ABOUT-GCC-NLS, ChangeLog, ChangeLog-1997, ChangeLog-1998,
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
new file mode 100644
index 00000000000..ec52e267e04
--- /dev/null
+++ b/gcc/ChangeLog.graphite
@@ -0,0 +1,5334 @@
+2009-08-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/40981
+ * graphite-ppl.c (ppl_max_for_le): Correct the use of
+ ppl_Pointset_Powerset_C_Polyhedron_maximize.
+
+2009-08-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pbb): Print PBB index.
+
+2009-08-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r150672:150764).
+
+2009-08-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (ppl_max_for_le): Moved...
+ * graphite-poly.c (pbb_number_of_iterations): Call ppl_max_for_le.
+ * graphite-ppl.c (ppl_max_for_le): ... here.
+ * graphite-ppl.h (ppl_max_for_le): Declared.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r150372:150672).
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/40980
+ * sese.c (convert_for_phi_arg): New.
+ (add_guard_exit_phis): Use convert_for_phi_arg.
+
+ * testsuite/gfortran.dg/graphite/id-17.f: New.
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): Dont add
+ unknown subscript upper bounds.
+
+ * testsuite/gcc.dg/graphite/interchange-6.c: Un-XFAIL.
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+ Pranav Garg <pranav.garg2107@gmail.com>
+
+ * graphite-interchange.c (gather_access_strides): Removed.
+ (ppl_max_for_le): New.
+ (build_linearized_memory_access): New.
+ (memory_stride_in_loop): New.
+ (pbb_interchange_profitable_p): Reimplemented.
+ * graphite-ppl.h (ppl_new_id_map): New.
+ (ppl_interchange): New.
+
+ * testsuite/gcc.dg/graphite/interchange-6.c: XFAILed.
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_subscript): Removed.
+ (compute_array_size_cstr): Removed.
+ (compute_array_size_poly): Removed.
+ (compute_array_size): Removed.
+ (gather_access_strides_poly): Removed.
+ (gather_access_strides): Empty.
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (dependence_polyhedron_1): Replace
+ pdr_nb_subscripts with PDR_NB_SUBSCRIPTS.
+ (graphite_legal_transform_dr): Same.
+ (graphite_carried_dependence_level_k): Same.
+ * graphite-poly.c (new_poly_dr): Add a parameter nb_subscripts.
+ Initialize PDR_NB_SUBSCRIPTS.
+ (print_pdr_access_layout): Replace pdr_nb_subscripts with
+ PDR_NB_SUBSCRIPTS.
+ * graphite-poly.h (struct poly_dr): Add nb_subscripts field.
+ (PDR_NB_SUBSCRIPTS): New.
+ (pdr_nb_subscripts): Removed.
+ (pdr_dim): Simplified.
+ * graphite-sese-to-poly.c (build_poly_dr): Replace pdr_nb_subscripts
+ with PDR_NB_SUBSCRIPTS.
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_array_size): Remove use of
+ PDR_DATA_CONTAINER.
+ * graphite-poly.c (new_poly_dr): Remove argument data_container.
+ Do not initialize PDR_DATA_CONTAINER.
+ (print_pdr): Do not print PDR_DATA_CONTAINER.
+ * graphite-poly.h (struct poly_dr): Remove data_container field.
+ (PDR_DATA_CONTAINER): Removed.
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): Remove use of
+ PDR_DATA_CONTAINER.
+ (build_poly_dr): Same.
+
+2009-08-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/interchange-9.c: New.
+
+2009-08-05 Konrad Trifunovic <konrad.trifunovic@gmail.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (graphite_legal_transform_dr): Work on a
+ copy of the dependence polyhedron. Free the temporary objects.
+ (graphite_carried_dependence_level_k): Free unused objects before
+ returning.
+
+ * testsuite/gcc.dg/graphite/interchange-1.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-2.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-3.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-4.c: XFAILed.
+ * testsuite/gcc.dg/graphite/interchange-7.c: XFAILed.
+
+2009-08-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-blocking.c (scop_do_strip_mine): Call store_scattering.
+ Early return without analyzing the data dependences if no
+ transform has been done. Call restore_scattering if the transform
+ is not legal.
+ (graphite-interchange.c): Same.
+ * graphite-poly.c (print_scattering_function): Test for PBB_TRANSFORMED.
+ (graphite_read_transforms): Initialize PBB_TRANSFORMED.
+ (apply_poly_transforms): Do not gcc_assert that
+ the transform is legal.
+ (new_poly_bb): Initialize PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL.
+ Do not initialize PBB_NB_SCATTERING_TRANSFORM, PBB_NB_LOCAL_VARIABLES,
+ PBB_TRANSFORMED_SCATTERING, and PBB_ORIGINAL_SCATTERING.
+ (free_poly_dr): Free PBB_TRANSFORMED, PBB_SAVED, and PBB_ORIGINAL.
+ * graphite-poly.h (struct poly_scattering): New.
+ (struct poly_bb): Add original, transformed, and saved fields.
+ Remove transformed_scattering, original_scattering, nb_local_variables,
+ and nb_scattering_transform fields.
+ (PBB_ORIGINAL, PBB_TRANSFORMED, PBB_SAVED): New.
+ (poly_scattering_new): New.
+ (poly_scattering_free): New.
+ (poly_scattering_copy): New.
+ (store_scattering_pbb): New.
+ (store_scattering): New.
+ (restore_scattering_pbb): New.
+ (restore_scattering): New.
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons):
+ Initialize PBB_TRANSFORMED and PBB_ORIGINAL.
+
+2009-08-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pbb): Add parentheses in the pretty print.
+ (print_scop): Same.
+
+2009-08-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (graphite.o): Depends on PREDICT_H.
+ * graphite.c: Include predict.h.
+ (graphite_finalize): Call tree_estimate_probability.
+ * predict.c (predict_loops): Do not call scev_initialize and
+ scev_finalize.
+ (tree_estimate_probability_bb): New.
+ (tree_estimate_probability): Do not initialize loops: move that
+ code to the driver. Call tree_estimate_probability_bb.
+ (tree_estimate_probability_driver): New.
+ (pass_profile): Use tree_estimate_probability_driver.
+ * predict.h (tree_estimate_probability): Declared.
+
+2009-08-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (gloog): Add time to TV_GRAPHITE_CODE_GEN.
+ * graphite-dependences.c (graphite_legal_transform): Add time to
+ TV_GRAPHITE_DATA_DEPS.
+ (dependency_between_pbbs_p): Same.
+ * timevar.def (TV_GRAPHITE_DATA_DEPS, TV_GRAPHITE_CODE_GEN): New.
+
+2009-08-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r149952:150372).
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * ChangeLog.graphite: Fix indenting, white spaces and 80 columns.
+ * graphite-blocking.c: Same.
+ * graphite-clast-to-gimple.c: Same.
+ * graphite-dependences.c: Same.
+ * graphite-poly.c: Same.
+ * graphite-poly.h: Same.
+ * graphite-ppl.c: Same.
+ * graphite-scop-detection.c: Same.
+ * graphite-sese-to-poly.c: Same.
+ * graphite.c: Same.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (loop_entry_phi_arg): New.
+ (remove_simple_copy_phi): New.
+ (remove_invariant_phi): New.
+ (simple_copy_phi_p): New.
+ (reduction_phi_p): New.
+ (gsi_for_ssa_name_def): New.
+ (insert_out_of_ssa_copy): New.
+ (insert_out_of_ssa_copy_on_edge): New.
+ (create_zero_dim_array): New.
+ (scalar_close_phi_node_p): New.
+ (rewrite_close_phi_out_of_ssa): New.
+ (rewrite_phi_out_of_ssa): New.
+ (rewrite_reductions_out_of_ssa): New.
+ (build_poly_scop): Call rewrite_reductions_out_of_ssa.
+
+ * testsuite/gcc.dg/graphite/id-11.c: New.
+ * testsuite/gcc.dg/graphite/id-15.c: New.
+ * testsuite/gcc.dg/graphite/interchange-1.c: Un-XFAIL.
+ * testsuite/gcc.dg/graphite/interchange-2.c: Un-XFAIL.
+ * testsuite/gcc.dg/graphite/interchange-3.c: Un-XFAIL.
+ * testsuite/gcc.dg/graphite/interchange-4.c: Un-XFAIL.
+ * testsuite/gcc.dg/graphite/interchange-7.c: Un-XFAIL.
+ * testsuite/gcc.dg/graphite/scop-matmult.c: Un-XFAIL.
+ * testsuite/gfortran.dg/graphite/id-13.f: New.
+ * testsuite/gfortran.dg/graphite/id-5.f: New.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (graphite_loop_normal_form): Do not
+ check that nb_reductions_in_loop is zero.
+ * graphite-scop-detection.c (harmful_stmt_in_bb): Don't filter out
+ reduction phi nodes.
+ (nb_reductions_in_loop): Removed.
+ (graphite_can_represent_loop): Do not call nb_reductions_in_loop.
+ * graphite-sese-to-poly.c (phi_node_is_iv): Removed.
+ (bb_contains_non_iv_scalar_phi_nodes): Removed.
+ (scop_contains_non_iv_scalar_phi_nodes): Removed.
+ (build_poly_scop): Do not call scop_contains_non_iv_scalar_phi_nodes.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (build_cloog_prog): Do not code generate
+ statements that have an empty iteration domain.
+ * testsuite/gfortran.dg/graphite/id-16.f: New.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c (instantiate_scev_1): Return
+ chrec_dont_know when the result is not above instantiate_below.
+ * graphite-scop-detection.c (scopdet_basic_block_info): Fix formatting.
+ * graphite-sese-to-poly.c (create_linear_expr_from_tree): Assert that
+ the tree has a known scalar evolution.
+ * testsuite/gfortran.dg/graphite/id-14.f: New.
+ * testsuite/gfortran.dg/graphite/id-15.f: New.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (rename_variables_in_stmt): Pass in an extra parameter
+ insert_gsi.
+ (rename_variables): Keep inserting renames after the ones already
+ inserted.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (compare_bb_depths): New.
+ (graphite_sort_dominated_info): New.
+ (build_scop_bbs_1): Call graphite_sort_dominated_info.
+ (build_scop_scattering): Fix comment.
+
+2009-07-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_finalize): Call print_loops instead of
+ dump_function_to_file.
+ * testsuite/gcc.dg/graphite/graphite.exp: Fix formatting.
+ * testsuite/gcc.dg/graphite/pr35356-1.c: New. Look for the number of
+ loops generated in the graphite output file.
+ * testsuite/gcc.dg/graphite/pr35356-2.c: New.
+ * testsuite/gcc.dg/graphite/pr35356-3.c: New. XFAILed for now.
+ * testsuite/gfortran.dg/graphite/id-12.f: New.
+
+2009-07-24 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-8.c:
+ Remove 2 XFAIL.
+
+2009-07-24 Li Feng <nemokingdom@gmail.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (pdr_add_alias_set): Use data reference's
+ alias set number build alias in ACCESSES polyhedron.
+ (build_alias_set_for_drs): New.
+ (build_pbb_drs): Added build_alias_set_for_drs.
+ * graphite-dependences.c (poly_drs_may_alias_p): New.
+ (graphite_carried_dependence_level_k): Check alias information
+ before building polyhedron.
+
+2009-07-24 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Makefile.in (lambda-code.o): Fix formatting.
+
+2009-07-24 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Merge from mainline (r149350-149952)
+
+2009-07-18 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c (apply_poly_transforms): Move strip_mine
+ before interchange to prepare for loop blocking.
+
+2009-07-18 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c (apply_poly_transforms): Add checks after every
+ transformation.
+ * graphite-sese-to-poly.c (build_poly_scop): Remove check, as already
+ done in apply_poly_transforms.
+
+2009-07-17 Konrad Trifunovic <konrad.trifunovic@gmail.com>
+
+ * graphite-dependences.c (build_lexicographically_gt_constraint):
+ Replace RES parameter with *RES.
+ (dependence_polyhedron_1): Pass an address of the parameter RES
+ instead of value of RES.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_finalize): Fix comment.
+ (graphite_transform_loops): Reset scev info after code generation
+ of each scop.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_finalize): Call scev_reset.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (compute_cloog_iv_types): Do not create
+ GBB_CLOOG_IV_TYPES hash table twice.
+ * graphite-sese-to-poly.c (free_gimple_bb): Call free_data_refs.
+ (add_condition_to_domain): Clear GMP values.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c: Fix formatting.
+ * graphite-poly.c (free_poly_dr): Also free PDR_DATA_CONTAINER.
+ (pbb_number_of_iterations): Free ppl_Linear_Expression.
+ * graphite-sese-to-poly.c: Fix formatting.
+ * graphite.c (graphite_transform_loops): Create the hash table
+ after the early return.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/id-14.c: New.
+ * testsuite/gcc.dg/graphite/pr40157.c: New.
+ * testsuite/gfortran.dg/graphite/id-11.f: New.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (nb_pbbs_in_loops): New.
+ (build_poly_scop): Return false when there are no pbbs within
+ loops to avoid to pass to cloog scops with no loops.
+
+2009-07-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Avoid
+ useless test "i % 2".
+ (build_pbb_scattering_polyhedrons): Fix formatting.
+ (build_poly_dr): Same.
+ * graphite.c (graphite_transform_loops): Restructure.
+
+2009-07-14 Razya Ladelsky <razya@il.ibm.com>
+
+ * tree-ssa-loop-manip.c (rewrite_phi_with_iv): Remove
+ reduction_list parameter.
+ (rewrite_all_phi_nodes_with_iv): Same.
+ (canonicalize_loop_ivs): Same.
+ * tree-parloops.c (struct brli): Removed.
+ (build_reduction_list_info): Removed.
+ (build_new_reduction): New.
+ (analyze_reduction_list): Removed.
+ (gather_scalar_reductions): Find reductions instead of phi
+ nodes that can't be canonicalized.
+ (try_create_reduction_list): Remove reduction_list parameter.
+ (gen_parallel_loop): Same.
+ (parallelize_loops): Remove analyze_reductions variable,
+ initialization and free.
+ Change reduction_list htab initialization to reduction_info
+ elements instead of ssa names.
+ Call try_create_reduction_list and gen_parallel_loop without
+ analyzed_reduction argument.
+ * graphite-clast-to-gimple (graphite_loop_normal_form): Call
+ canonicalize_loop_ivs with one less argument.
+ * tree-flow.h (canonicalize_loop_ivs): Remove one argument.
+
+2009-07-14 Konrad Trifunovic <konrad.trifunovic@gmail.com>
+
+ * graphite-dependences.c (new_poly_dr_pair): New.
+ (dependence_polyhedron): Renamed into dependence_polyhedron_1.
+ (new_poly_dr_pair): New.
+ (eq_poly_dr_pair_p): New.
+ (hash_poly_dr_pair_p): New.
+ * graphite-dependences.h (struct poly_dr_pair): New.
+ (eq_poly_dr_pair_p): Declared.
+ (hash_poly_dr_pair_p): Declared.
+ * graphite-poly.c (new_scop): Initialize SCOP_ORIGINAL_PDR_PAIRS.
+ (free_scop): Free SCOP_ORIGINAL_PDR_PAIRS.
+ * graphite-poly.h (struct scop): Add original_pdr_pairs field.
+ * Makefile.in (graphite-poly.o): Add dependence on
+ graphite-dependences.h.
+
+2009-07-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (graphite_can_represent_scev): Do not let
+ polynomials of degree > 1 pass to Graphite.
+ * tree-chrec.c (scev_is_linear_expression): Call
+ evolution_function_is_affine_multivariate_p.
+ * testsuite/gfortran.dg/graphite/id-10.f90: New.
+
+2009-07-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c (compute_overall_effect_of_inner_loop):
+ Instantiate scevs varying in outer loops.
+ * testsuite/gfortran.dg/graphite/id-9.f: Correct testcase.
+
+2009-07-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (build_loop_iteration_domains): Do not insert
+ redundant constraint.
+
+2009-07-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/graphite.exp: Fix comments.
+ * testsuite/gfortran.dg/graphite/graphite.exp: Trigger actions
+ based on the file names as in the C testsuite.
+ * testsuite/gfortran.dg/graphite/block-1.f90: Fix patterns.
+ * testsuite/gfortran.dg/graphite/block-2.f: Same.
+ * testsuite/gfortran.dg/graphite/block-3.f90: Same.
+ * testsuite/gfortran.dg/graphite/block-4.f90: Same.
+ * testsuite/gfortran.dg/graphite/id-1.f90: Same.
+ * testsuite/gfortran.dg/graphite/id-2.f90: Same.
+ * testsuite/gfortran.dg/graphite/id-3.f90: Same.
+ * testsuite/gfortran.dg/graphite/id-4.f90: Same.
+ * testsuite/gfortran.dg/graphite/id-6.f: Same.
+ * testsuite/gfortran.dg/graphite/id-9.f: Same.
+ * testsuite/gfortran.dg/graphite/interchange-1.f: Same.
+ * testsuite/gfortran.dg/graphite/interchange-2.f: Same.
+ * testsuite/gfortran.dg/graphite/scop-1.f: Same.
+
+2009-07-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_call): New.
+ (expand_scalar_variables_ssa_name): Handle calls in expander.
+
+2009-07-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-6.c:
+ Expect to see the pattern twice.
+ * testsuite/gcc.dg/graphite/interchange-0.c: Un-XFAIL.
+ * testsuite/gcc.dg/graphite/interchange-5.c: Same.
+ * testsuite/gcc.dg/graphite/interchange-6.c: Same.
+
+2009-07-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/id-10.c: New.
+ * testsuite/gcc.dg/graphite/id-12.c: New.
+ * testsuite/gfortran.dg/graphite/id-7.f: New.
+ * testsuite/gfortran.dg/graphite/id-8.f: New.
+
+2009-07-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): Fix division by
+ zero.
+
+2009-07-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (rename_variables_in_stmt): Call fold_convert during renaming.
+
+2009-07-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_stmt): Avoid unnecessary expansion.
+
+2009-07-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (pdr_add_memory_accesses): Fix order of
+ building PDR subscripts.
+
+2009-07-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): Fix the
+ computation of array sizes.
+
+2009-07-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (add_param_constraints): Disabled.
+
+2009-07-10 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-dependences.c (map_into_dep_poly, map_dr_into_dep_poly,
+ build_pairwise_constraint, dr_equality_constraints,
+ build_pairwise_scheduling_equality,
+ build_pairwise_scheduling_inequality, lexicographically_gt_p,
+ build_lexicographically_gt_constraint, dependence_polyhedron,
+ graphite_legal_transform_dr, graphite_carried_dependence_level_k):
+ Move from NNC_Polyhedron to C_Polyhedron.
+ * graphite-interchange.c (compute_array_size_poly,
+ gather_access_strides): Dito.
+ * graphite-poly.c (apply_poly_transforms, new_poly_dr, free_poly_bb,
+ free_scop, pbb_number_of_iterations): Dito.
+ * graphite-poly.h (struct poly_dr, pdr_nb_subscripts, struct poly_bb,
+ pbb_dim_iter_domain, struct scop): Dito.
+ * graphite-ppl.c (new_Constraint_System_from_Cloog_Matrix,
+ new_Cloog_Domain_from_ppl_Polyhedron,
+ new_Cloog_Domain_from_ppl_Pointset_Powerset, ppl_set_coef_gmp,
+ ppl_insert_dimensions_pointset, ppl_insert_dimensions_pointset,
+ ppl_strip_loop, ppl_strip_loop, ppl_print_polyhedron_matrix,
+ ppl_print_powerset_matrix, debug_ppl_polyhedron_matrix,
+ debug_ppl_powerset_matrix, ppl_read_polyhedron_matrix): Dito.
+ * graphite-ppl.h (ppl_Pointset_Powerset_C_Polyhedron_t,
+ new_C_Polyhedron_from_Cloog_Matrix, ppl_print_powerset_matrix,
+ debug_ppl_powerset_matrix, ppl_insert_dimensions_pointset): Dito.
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons,
+ build_loop_iteration_domains, ppl_constraint_type_from_tree_code,
+ add_condition_to_domain, add_condition_to_pbb, build_scop_context,
+ build_scop_iteration_domain, build_poly_dr): Dito
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/graphite.exp: Added a rule to execute
+ run-id-*.c files.
+ * testsuite/gcc.dg/graphite/run-id-1.c: New.
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (build_loop_iteration_domains): Add the
+ positivity constraint on the symbolic number of iterations.
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (build_loop_iteration_domains): Rewrite.
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (build_scop_context): Removed.
+ (build_cloog_prog): Directly use SCOP_CONTEXT.
+ * graphite-poly.c (new_scop): Initialize SCOP_CONTEXT.
+ (free_scop): Free SCOP_CONTEXT.
+ (print_scop_context): New.
+ (print_scop): Call print_scop_context.
+ (debug_scop_context): New.
+ * graphite-poly.h (print_scop_context, debug_scop_context): Declared.
+ (struct scop): Added field context.
+ (SCOP_CONTEXT): New.
+ * graphite-sese-to-poly.c (add_param_constraints): New.
+ (build_scop_context): New.
+ (build_poly_scop): Call build_scop_context.
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (gmp_cst_to_tree): Moved...
+ * graphite-ppl.c (ppl_set_inhomogeneous_gmp, ppl_set_coef_gmp): New.
+ (ppl_set_inhomogeneous, ppl_set_coef): Moved...
+ * graphite-ppl.h: Include double-int.h and tree.h.
+ (ppl_set_inhomogeneous_gmp, ppl_set_coef_gmp): Declared.
+ (ppl_set_inhomogeneous, ppl_set_coef): ...here.
+ (gmp_cst_to_tree): ...here. Reimplemented using mpz_get_double_int.
+ (tree_int_to_gmp, ppl_set_inhomogeneous_tree, ppl_set_coef_tree): New.
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (clast_to_gcc_expression_red): Generate
+ POINTER_PLUS_EXPR for pointer types.
+ (clast_to_gcc_expression): Same.
+
+2009-07-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_scattering_function): Early return when
+ PBB_TRANSFORMED_SCATTERING is not initialized.
+ (print_pbb_domain): Early return when PBB_DOMAIN is not initialized.
+
+2009-07-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-parloops.c (analyze_reduction_list): Remove unused variable
+ to fix bootstrap.
+
+2009-07-08 Razya Ladelsky <razya@il.ibm.com>
+
+ * tree-parloops.c (analyze_reduction_list): Change return
+ value to void.
+ (try_create_reduction_list): Move the call to
+ analyze_reduction_list to the beginining.
+ Call reduction_phi with analyzed_reductions as argument
+ instead of reduction_list.
+
+2009-07-08 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Merge from mainline (r148296:149346)
+
+2009-07-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (graphite_can_represent_init): New.
+ (graphite_can_represent_scev): Call graphite_can_represent_init:
+ check that the initial value does not contain multiplications of
+ parameters.
+ (stmt_has_simple_data_refs_p): New.
+ (stmt_simple_for_scop_p): Call stmt_simple_for_scop_p.
+ (is_simple_operand): Fix formatting.
+ * graphite-sese-to-poly.c (try_generate_gimple_bb): Fix formatting.
+
+2009-07-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/id-13.c: New.
+ * graphite-sese-to-poly.c (graphite_stmt_p): Do not call
+ analyze_scalar_evolution, use scalar_evolution_in_region.
+ (scan_tree_for_params_right_scev): Add extra assert.
+ (parameter_index_in_region_1): Split from parameter_index_in_region.
+ (idx_record_params): Use scalar_evolution_in_region.
+ (find_params_in_bb): Same.
+ (find_scop_parameters): Same.
+ (build_loop_iteration_domains): Same.
+ (create_linear_expr_from_tree): Same.
+ * sese.c (scalar_evolution_in_region): New.
+ * sese.h (scalar_evolution_in_region): Declared.
+ (defined_in_sese_p): New.
+ * tree-scalar-evolution.c (compute_overall_effect_of_inner_loop): Not
+ static anymore.
+ * tree-scalar-evolution.h (compute_overall_effect_of_inner_loop):
+ Declared.
+
+2009-07-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in: Replace dependences on tree-chrec.h with SCEV_H.
+ TREE_DATA_REF_H also implies SCEV_H.
+
+2009-07-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_scop_params): New.
+ (print_scop): Call print_scop_params.
+ (debug_scop_params): New.
+ * graphite-poly.h (print_scop_params, debug_scop_params): Declared.
+
+2009-07-07 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-4.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-5.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-6.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-7.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-8.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-9.c: New.
+
+2009-07-07 Li Feng <nemokingdom@gmail.com>
+
+ * graphite-clast-to-gimple.c (mark_loops_parallel): Dump information
+ for dependency checking part.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-1.c: Add
+ tests for dependency checking.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-2.c: Ditto.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-3.c: Ditto.
+ * testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: Add
+ flag -fdump-tree-graphite-all for autopar testsuites.
+
+2009-07-06 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (tree-ssa-loop-manip.o): Depends on langhooks.h.
+ * tree-parloops.c (rewrite_phi_with_iv, rewrite_all_phi_nodes_with_iv,
+ canonicalize_loop_ivs): Moved...
+ * tree-ssa-loop-manip.c: ... here. Include langhooks.h.
+
+2009-07-06 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-parloops.c (try_create_reduction_list): Pass an extra
+ argument analyzed_reductions. Call analyze_reduction_list.
+ (gen_parallel_loop): Do not call analyze_reduction_list.
+ (parallelize_loops): Init and finalize analyzed_reductions.
+
+2009-07-06 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp:
+ Added flag -fno-loop-strip-mine for autopar testcase.
+
+2009-07-04 Li Feng <nemokingdom@gmail.com>
+
+ * graphite-dependences.c (graphite_carried_dependence_level_k): Use
+ transformed scattering dimension instead of unmatch orignal when
+ calling dependence_polyhedron.
+
+2009-06-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * opts.c (decode_options): Enable flag_loop_strip_mine at -O2.
+
+2009-06-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (pbb_number_of_iterations): Check for returned
+ value 1 from ppl_Pointset_Powerset_NNC_Polyhedron_maximize.
+
+2009-06-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-blocking.c (pbb_strip_mine_profitable_p): New.
+ (pbb_do_strip_mine): Call pbb_strip_mine_profitable_p.
+ * graphite-poly.c (pbb_number_of_iterations): New.
+ * graphite-poly.h (pbb_number_of_iterations): Declared.
+ (pbb_iterator_dim, pbb_parameter_dim): New.
+
+2009-06-29 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (graphite_create_new_loop): Revert the
+ last commit on type of lower and upper bound of loops.
+
+2009-06-29 Li Feng <nemokingdom@gmail.com>
+
+ * Makefile.in (graphite-clast-to-gimple.o): Added dependence on
+ graphite-dependences.h.
+ * graphite-clast-to-gimple.c (new_bb_pbb_def): New.
+ (mark_bb_with_pbb): New.
+ (get_stmtfor_depth): New.
+ (find_pbb_via_hash): New.
+ (dependency_in_loop_p): New.
+ (mark_loops_parallel): New.
+ (free_aux_in_new_loops): New.
+ (translate_clast): Add parameter BB_PBB_MAPPING. Mark newly created
+ bb with it's relevant pbb. Mark newly created loops. Remove mark
+ innermost loop parallel without checking.
+ (gloog): Add parameter BB_PBB_MAPPING.
+ * graphite-clast-to-gimple.h (struct bb_pbb_def): New.
+ (gloog): Change declaration.
+ (mark_loop_parallel): Make extern.
+ (free_aux_in_new_loops): Declare.
+ (bb_pbb_map_hash): New.
+ (eq_bb_pbb_map): New.
+ * graphite.c (graphite_transform_loops): Added BB_PBB_MAPPING. Trigger
+ auto parallelization when flag_graphite_force_parallel is set.
+ (graphite_finalize): Added free_aux_in_new_loops.
+ * tree-parloops.c (parallelize_loops): Only generate parallel code for
+ the innermost loop that marked parallel. Use
+ flag_graphite_force_parallel instead of loop->can_be_parallel.
+ (loop_parallel_p): Move inner most checking out of function.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (graphite_create_new_loop): Make the
+ type of lower and upper bound of loops signed long int.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (create_empty_loop_on_edge): Gimplify the loop exit
+ expression outside the loop.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/interchange-8.c: New.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/interchange-0.c: XFailed.
+ * gcc.dg/graphite/interchange-5.c: XFailed.
+ * gcc.dg/graphite/interchange-6.c: XFailed.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_array_size_poly): The end of the
+ recursion should return 1.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_array_size_cstr): Allow the
+ subscript multiplier to be -1.
+ (compute_array_size): Use PDR_DATA_CONTAINER and not PDR_ACCESSES.
+ * graphite-poly.c (new_poly_dr): Takes an extra argument for the
+ data_container. Initializes PDR_DATA_CONTAINER.
+ (print_pdr_access_layout): New.
+ (print_pdr): Call print_pdr_access_layout. Print PDR_DATA_CONTAINER.
+ * graphite-poly.h (struct poly_dr): Adjust comment. Add a new field
+ data_container.
+ (PDR_DATA_CONTAINER): New.
+ (new_poly_dr): Update declaration.
+ * graphite-sese-to-poly.c (pdr_add_data_dimensions): New.
+ (build_poly_dr): Call pdr_add_data_dimensions.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.h (struct poly_dr): Fix comment.
+ * graphite-sese-to-poly.c (pdr_add_alias_set): New.
+ (pdr_add_memory_accesses): New.
+ (build_poly_dr): Call pdr_add_memory_accesses and pdr_add_alias_set.
+
+2009-06-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pdrs, debug_pdrs): New.
+ (print_pbb): Add call to print_pdrs.
+ * graphite-poly.h (print_pdrs, debug_pdrs): Declared.
+
+2009-06-24 Konrad Trifunovic <konrad.trifunovic@gmail.com>
+ Li Feng <nemokingdom@gmail.com>
+
+ * graphite-dependences.c (graphite_carried_dependence_level_k): New.
+ (dependency_between_pbbs_p): New.
+ (lexicographically_gt_p): Assure !empty_p before polyhedron
+ intersection assign.
+ (build_lexicographically_gt_constraint): Correct lexicographically
+ judging.
+ * graphite-dependences.h: New.
+ * Makefile.in (graphite-dependences.o): Add graphite-dependences.h.
+
+2009-06-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (print_clast_stmt): New.
+ (gloog): Print to dump_file the generated clast.
+ * graphite-clast-to-gimple.h (print_clast_stmt): Declared.
+ * graphite-interchange.c (pbb_do_interchange): Fix dump formatting.
+
+2009-06-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (extend_scattering): Increment
+ PBB_NB_LOCAL_VARIABLES by the number of added dimensions.
+
+2009-06-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_array_size_poly): Added exit of
+ recursion condition. Continue iterating even after the first equality.
+ (compute_array_size): Same.
+
+2009-06-24 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-1.c: Update
+ -fdump-tree-final_cleanup to -fdump-tree-optimized.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-2.c: Ditto.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-3.c: Ditto.
+ * testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: Ditto.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_stmt): Expand scalar variables
+ only when the use verifies is_gimple_reg.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (build_cloog_prog): Fix memory corruption.
+ Allocate scaldims after call to unify_scattering_dimensions.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (translate_clast): Fix memory leak.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+ Albert Cohen <albert.cohen@inria.fr>
+
+ * graphite-blocking.c (pbb_strip_mine_loop_depth): Do not use local
+ variables for the strip mining.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+ Pranav Garg <pranav.garg2107@gmail.com>
+
+ * Makefile.in (OBJS-common): Added graphite-blocking.o.
+ (graphite-sese-to-poly.o): Moved down to be in lexicographical order.
+ (graphite-blocking.o): New rule.
+ (graphite-poly.o, graphite-ppl.o): Moved to be in lexicographical order.
+ * graphite-blocking.c: New.
+ * graphite-poly.c (apply_poly_transforms): Call scop_do_strip_mine for
+ flag_loop_strip_mine.
+ (psct_scattering_dim_for_loop_depth): New.
+ * graphite-poly.h (scop_do_strip_mine): Declared.
+ (psct_add_local_variable): Increment PBB_NB_LOCAL_VARIABLES.
+ * tree-ssa-loop.c (gate_graphite_transforms): Do not fail when using
+ flag_loop_strip_mine.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (extend_scattering): Avoid initializing and freeing
+ a GMP value and a PPL coefficient at each iteration of a loop.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (dependence_polyhedron): Do not use
+ pbb_nb_scattering_dims anymore. Use pbb_nb_scattering_orig and
+ pbb_nb_scattering_transform.
+ (graphite_legal_transform_dr): Same.
+ * graphite-poly.c (extend_scattering): Same.
+ (unify_scattering_dimensions): Same.
+ (print_scattering_function): Same.
+ (new_poly_bb): Initialize PBB_NB_SCATTERING_TRANSFORM and
+ PBB_NB_LOCAL_VARIABLES.
+ * graphite-poly.h (pbb_nb_scattering): Removed declaration.
+ (struct poly_bb): Added nb_local_variables and nb_scattering_transform.
+ (PBB_NB_LOCAL_VARIABLES, PBB_NB_SCATTERING_TRANSFORM): New.
+ (pbb_nb_scattering_orig, pbb_nb_scattering_transform): New.
+ (pbb_nb_scattering_dims, pbb_nb_scattering): Removed.
+ (pbb_nb_scattering_transform): New.
+ (pbb_nb_local_vars): Return PBB_NB_LOCAL_VARIABLES.
+ (psco_scattering_dim): Add assert on parameters.
+ (psct_scattering_dim): Same.
+ (psct_scattering_dim_for_loop_depth): Declared.
+ (psct_local_var_dim): New.
+ (psco_iterator_dim, psco_parameter_dim): Add assert on parameters.
+ (psct_iterator_dim, psct_parameter_dim): Same. To maintain the
+ correct layout, call pbb_nb_local_vars.
+ (psct_add_local_variable, psct_add_scattering_dimension): New.
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons):
+ Initialize PBB_NB_SCATTERING_TRANSFORM.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-ppl.c (set_inhomogeneous): Renamed ppl_set_inhomogeneous.
+ (set_coef): Renamed ppl_set_coef.
+ * graphite-ppl.h (ppl_set_inhomogeneous, ppl_set_coef): Declared.
+
+2009-06-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (build_pairwise_scheduling_inequality): Don't
+ test a boolean against 1.
+ * graphite-interchange.c (pbb_interchange_loop_depths): Do not build
+ a new polyhedron for the PBB_TRANSFORMED_SCATTERING.
+ (pbb_do_interchange): Returns true when a transform has been performed.
+ (scop_do_interchange): Same.
+ * graphite-poly.c (apply_poly_transforms): Use the return value of
+ scop_do_interchange.
+ * graphite-poly.h (scop_do_interchange): Update declaration.
+
+2009-06-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (gloog): Reset loop->aux right
+ after last use.
+ * sese.c (sese_reset_aux_in_loops): New.
+ * sese.h (sese_reset_aux_in_loops): New.
+
+2009-06-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (scan_tree_for_params_int): Pass in the
+ multiplier and multiply the constant by the multiplier.
+ (scan_tree_for_params): Bound the multiplier to its MULT_EXPR.
+ (build_poly_dr): Do not use the multiplier to define the subscript.
+
+2009-06-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (new_poly_dr): Pass an extra argument for the
+ compiler's data reference. Initialize PDR_CDR.
+ (print_pdr): Call dump_data_reference.
+ * graphite-poly.h (struct poly_dr): Rename black_box into pbb.
+ Add compiler_dr field.
+ (PDR_BB): Renamed PDR_PBB.
+ (PDR_CDR): New.
+ * graphite-sese-to-poly.c (build_poly_dr): Pass to new_poly_dr
+ GCC's data reference representation.
+ * tree-data-ref.c (debug_data_references, debug_data_reference): New.
+ * tree-data-ref.h (debug_data_references, debug_data_reference): Decl.
+
+2009-06-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_scattering_function): Also print the layout.
+ * graphite-poly.h (pbb_nb_local_vars): New.
+
+2009-06-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pbb_domain): Also print the layout names.
+
+2009-06-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pdr, debug_pdr): New.
+ * graphite-poly.h (print_pdr, debug_pdr): Declared.
+ (PDR_BASE): Removed.
+
+2009-06-18 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc/testsuite/gcc.dg/graphite/interchange-{1..7}.c: New avatars of
+ ltrans-{1..6,8}.c.
+
+2009-06-18 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-interchange.c (compute_subscript): Allow also -1 in the
+ subscript identification column.
+ (pbb_do_interchange): Print to dump_file that some loops "will be
+ interchanged". Rely on that chain of characters in the testcases.
+ * gcc.dg/graphite/interchange-0.c: New.
+ * gcc.dg/graphite/graphite.exp: Iterate over the testsuite
+ interchange-*.c files and compile them with -floop-interchange.
+
+2009-06-18 Pranav Garg <pranav.garg2107@gmail.com>
+
+ * graphite-interchange.c (interchange_profitable_p): Renamed
+ pbb_interchange_profitable_p.
+
+2009-06-18 Sebastian Pop <sebastian.pop@amd.com>
+ Harsha Jagasia <harsha.jagasia@amd.com>
+ Pranav Garg <pranav.garg2107@gmail.com>
+
+ * graphite-interchange.c (interchange_profitable_p): Make static.
+ (pbb_interchange_loop_depths, pbb_do_interchange,
+ scop_do_interchange): New.
+ * graphite-poly.c (apply_poly_transforms): Call scop_do_interchange
+ for flag_loop_interchange.
+ * graphite-poly.h (scop_do_interchange): Declared.
+ * tree-ssa-loop.c (gate_graphite_transforms): Do not fail when
+ flag_loop_interchange is used.
+
+2009-06-18 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (dependence_polyhedron): Update use of
+ pbb_nb_scattering_dims.
+ * graphite-poly.h (pbb_nb_scattering_dims): Do not pass SCOP.
+ (pbb_nb_scattering): Update use of pbb_nb_scattering_dims.
+ (psco_scattering_dim, psct_scattering_dim, psco_iterator_dim,
+ psct_iterator_dim, psco_parameter_dim, psct_parameter_dim): New.
+
+2009-06-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Cleanup foo.
+
+2009-06-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r143684:148293).
+ * Disabled libpcp until it gets fixed.
+
+2009-06-05 Sebastian Pop <sebastian.pop@amd.com>
+ Harsha Jagasia <harsha.jagasia@amd.com>
+
+ * graphite-interchange.c: New.
+ * Makefile.in (graphite-interchange.o): New.
+ * graphite-poly.h (interchange_profitable_p): Declared.
+ * graphite-ppl.h (value_max): New.
+
+2009-06-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (dependence_polyhedron): Use pdr_dim.
+ * graphite-poly.h: Fix some comments.
+ (pdr_dim): New.
+ (pdr_scop): New.
+
+2009-06-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.h
+ (pdr_accessp_nb_subscripts): Renamed pdr_nb_subscripts.
+ (pdr_accessp_nb_iterators): Renamed pdr_dim_iter_domain.
+ (pdr_accessp_nb_params): Renamed pdr_nb_params.
+ (pdr_accessp_alias_set_dim): Renamed pdr_alias_set_dim.
+ (pdr_accessp_subscript_dim): Renamed pdr_subscript_dim.
+ (pdr_accessp_iterator_dim): Renamed pdr_iterator_dim.
+ (pdr_accessp_param_dim): Renamed pdr_parameter_dim.
+ (pbb_nb_loops): Renamed pbb_dim_iter_domain.
+ * graphite-clast-to-gimple.c: Same.
+ * graphite-dependences.c: Same.
+ * graphite-poly.c: Same.
+ * graphite-sese-to-poly.c: Same.
+
+2009-06-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (build_iv_mapping): Insert full
+ expressions for an IV rename, as returned by clast_to_gcc_expression.
+ (copy_renames): Rename new_name to expr.
+ * sese.c (debug_rename_elt): Same.
+ (get_rename): Same.
+ (set_rename): Same.
+ (sese_adjust_liveout_phis): Call force_gimple_operand before using
+ the information from the rename map.
+ (rename_variables_in_stmt): Same.
+ (add_loop_exit_phis): Rename new_name to expr.
+ (insert_loop_close_phis): Same.
+ (add_guard_exit_phis): Same. Call force_gimple_operand.
+ * sese.h (struct rename_map_elt): Rename new_name to expr.
+ (new_rename_map_elt): Same.
+
+2009-06-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (build_iv_mapping): Use set_rename.
+ * sese.c (set_rename): Make it extern.
+ * sese.h (set_rename): Declared.
+
+2009-06-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (extend_scattering): Free values.
+ * graphite-ppl.c (new_Cloog_Domain_from_ppl_Pointset_Powerset):
+ Free iterators.
+ (ppl_print_powerset_matrix): Same.
+ * graphite-scop-detection.c (free_scops_1): New.
+ (limit_scops): Call free_scops_1.
+ * graphite-sese-to-poly.c (build_scop_bbs_1): Free dom.
+ (build_poly_dr): Free PPL coefficients.
+ * tree-parloops.c (rewrite_all_phi_nodes_with_iv): Free bbs.
+
+2009-06-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c: New.
+ * graphite-data-ref.c: Removed.
+ * graphite-data-ref.h: Removed.
+ * Makefile.in (graphite-data-ref.o): Removed.
+ (graphite-dependences.o): Added.
+ * graphite-clast-to-gimple.c: Remove dependence on graphite-data-ref.h.
+ * graphite-poly.c: Same.
+ Move the data dependence testing to graphite-dependences.c.
+
+2009-05-19 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (graphite_can_represent_loop): Renamed
+ from graphite_cannot_represent_loop. Code refactored.
+ (scopdet_basic_block_info): Call graphite_can_represent_loop.
+
+2009-05-17 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp:
+ Cover all the testcases (not only the filtered ones).
+
+2009-05-17 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (stmt_simple_for_scop_p): Remove
+ unnecessary check. Update comments. Move check for REAL_TYPE here.
+ (harmful_stmt_in_bb): Remove checks for conditions. This is already
+ done in (stmt_simple_for_scop_p).
+
+2009-05-14 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_global_statistics): New.
+ (print_graphite_scop_statistic): New.
+ (print_graphite_statistics): New.
+ (graphite_initialize, graphite_transform_loops): Print statistics.
+ * graphite-scop-detection (build_scops): Print statistics.
+ (print_graphite_scop_statistics): New.
+ (print_graphite_statistics): New.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (struct clast_name_index): Removed.
+ (debug_clast_name_index): Removed.
+ (debug_clast_name_indexes_1): Removed.
+ (debug_clast_name_indexes): Removed.
+ (clast_name_index_elt_info): Removed.
+ (eq_clast_name_indexes): Removed.
+ (clast_name_to_index): Removed.
+ (new_clast_name_index): Removed.
+ (save_clast_name_index): Removed.
+ (save_var_name): Moved...
+ (init_sese_params_index): Removed.
+ (clast_name_to_gcc): Remove use of name_tree.
+ (initialize_cloog_names): Same.
+ (gloog): Do not call init_sese_params_index.
+ * graphite-sese-to-poly.c (save_var_name): ...here.
+ (parameter_index_in_region): New.
+ * sese.c (new_sese): Initialize SESE_PARAMS_NAMES.
+ (parameter_index_in_region): Removed.
+ (is_parameter): Remove use of name_tree.
+ * sese.h (struct name_tree): Removed.
+ (struct sese): Remove use of name_tree. New field params_names.
+ (SESE_PARAMS_NAMES): New.
+ (SESE_PARAMS): Remove duplicate.
+ (parameter_index_in_region): Removed.
+ (sese_nb_params): Remove use of name_tree.
+ (struct clast_name_index): New.
+ (new_clast_name_index): New.
+ (clast_name_to_index): New.
+ (save_clast_name_index): New.
+ (debug_clast_name_index): New.
+ (debug_clast_name_indexes_1): New.
+ (debug_clast_name_indexes): New.
+ (clast_name_index_elt_info): New.
+ (eq_clast_name_indexes): New.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (compute_cloog_iv_types_1): Call
+ pbb_to_depth_to_oldiv. Remove call to oldiv_for_loop.
+ (graphite_loop_normal_form): Do not pass region. Do not
+ initialize SESE_OLDIVS.
+ (build_graphite_loop_normal_form): Update call to
+ graphite_loop_normal_form.
+ * sese.c (debug_oldivs): Removed.
+ (new_sese): Do not initialize SESE_OLDIVS.
+ (free_sese): Do not free SESE_OLDIVS.
+ (oldiv_for_loop): Removed.
+ * sese.h (struct sese): Remove old_ivs.
+ (SESE_OLDIVS): Removed.
+ (oldiv_for_loop): Removed.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (clast_name_to_gcc): Pass newivs,
+ remove ivstack. Remove call to loop_iv_stack_get_iv_from_name,
+ replaced by a call to newivs_to_depth_to_newiv.
+ (clast_to_gcc_expression): Pass newivs, remove ivstack.
+ (clast_to_gcc_expression_red): Same.
+ (gcc_type_for_clast_expr): Same.
+ (gcc_type_for_clast_eq): Same.
+ (graphite_translate_clast_equation): Same.
+ (graphite_create_guard_cond_expr): Same.
+ (graphite_create_new_guard): Same.
+ (graphite_create_new_loop): Same.
+ (build_iv_mapping): Same.
+ (translate_clast): Same.
+ (gloog): Same.
+ (loop_iv_stack_patch_for_consts): Removed. *
+ sese.c (iv_stack_entry_is_constant): Removed.
+ (iv_stack_entry_is_iv): Removed.
+ (loop_iv_stack_push_iv): Removed.
+ (loop_iv_stack_insert_constant): Removed.
+ (loop_iv_stack_pop): Removed.
+ (loop_iv_stack_get_iv): Removed.
+ (loop_iv_stack_get_iv_from_name): Removed.
+ (debug_loop_iv_stack): Removed.
+ (free_loop_iv_stack): Removed.
+ (loop_iv_stack_remove_constants): Removed. *
+ sese.h (iv_stack_entry_kind): Removed.
+ (iv_stack_entry_data_union): Removed.
+ (iv_stack_entry_struct): Removed.
+ (iv_stack_entry_p): Removed.
+ (debug_oldivs, debug_loop_iv_stack, loop_iv_stack_insert_constant,
+ loop_iv_stack_get_iv_from_name, loop_iv_stack_push_iv,
+ loop_iv_stack_get_iv, loop_iv_stack_remove_constants,
+ loop_iv_stack_pop, free_loop_iv_stack): Removed.
+ (gbb_loop_at_index): Fix indenting.
+ (gbb_loop_index): Removed.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (clast_name_to_gcc): Do not use strcmp.
+ Call clast_name_to_index.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (clast_name_to_gcc): Pass region,
+ do not pass params. Get params from SESE_PARAMS.
+ (clast_to_gcc_expression): Same.
+ (clast_to_gcc_expression_red): Same.
+ (gcc_type_for_clast_eq): Same.
+ (graphite_translate_clast_equation): Same.
+ (graphite_create_new_loop): Same.
+ * sese.c (rename_variables_in_stmt): Fix comment.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (graphite_create_new_loop): Pass
+ newivs_index.
+ Call save_clast_name_index.
+ (translate_clast): Pass newivs_index.
+ (gloog): Create and free newivs_index.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (clast_name_index): New structure.
+ (clast_name_index_p): New type.
+ (debug_clast_name_index): New.
+ (debug_clast_name_indexes_1): New.
+ (debug_clast_name_indexes): New.
+ (clast_name_index_elt_info): New.
+ (eq_clast_name_indexes): New.
+ (clast_name_to_index): New.
+ (new_clast_name_index): New.
+ (save_clast_name_index): New.
+ (init_sese_params_index): New.
+ (gloog): Call init_sese_params_index.
+ * graphite-clast-to-gimple.h (debug_clast_name_indexes): Declared.
+ * sese.c (new_sese): Initialize SESE_PARAMS_INDEX.
+ (free_sese): Free SESE_PARAMS_INDEX.
+ * sese.h (struct sese): Add params_index.
+ (SESE_PARAMS_INDEX): New.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (newivs_to_depth_to_newiv): New.
+ (graphite_create_new_loop): Pass the newivs vector. Push the
+ newly created IV to newivs.
+ (translate_clast): Pass the newivs vector.
+ (gloog): Create and destroy the newivs vector.
+
+2009-05-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (pbb_to_depth_to_oldiv): New.
+ (graphite_loop_normal_form): Initialize loop->aux with the unique
+ IV that has been created.
+
+2009-05-13 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * tree-chrec.c (evolution_function_right_is_integer_cst): Allow
+ scev with parameters in the base part. They where forbidden
+ exidently.
+
+2009-05-11 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite.exp: Set different default
+ compile options by file names.
+ * testsuite/gcc.dg/graphite/block{0-6}.c: Remove dg-option line.
+ * testsuite/gcc.dg/graphite/id-{1-9}.c: Ditto.
+ * testsuite/gcc.dg/graphite/scop-{0-20}.c: Ditto.
+ * testsuite/gcc.dg/graphite/scop-matmult.c: Ditto.
+
+2009-05-08 Li Feng <nemokingdom@gmail.com>
+
+ * testsuite/gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-1.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-2.c: New.
+ * testsuite/gcc.dg/graphite/graphite_autopar/force-parallel-3.c: New.
+
+2009-05-07 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection (build_scops_1): Fix little bug introduced
+ by final cleanup.
+
+2009-05-07 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (graphite_can_represent_scev): Only
+ allow integer constant strides.
+ (graphite_can_represent_expr): Depend on outermost_loop.
+ (stmt_simple_memref_p, graphite_cannot_represent_loop,
+ harmful_stmt_in_bb, is_simple_operand, stmt_simple_for_scop_p,
+ build_scops_1): Same.
+ (scopdet_basic_block_info): Same and insert layered SCoP
+ detection.
+ (try_generate_gimple_bb): Cleanup.
+ (build_scops): Enable data references.
+
+ * testsuite/gcc.dg/graphite/id-5.c: New.
+ * testsuite/gcc.dg/graphite/id-9.c: New.
+ * tree-chrec.c (evolution_function_right_is_integer_cst): New.
+ * tree-chrec.h (evolution_function_right_is_integer_cst): New.
+
+2009-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * sese.c (expand_scalar_variables_ssa_name): Only build expressions,
+ that we have not yet built for this SCoP.
+
+2009-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * sese.c (expand_scalar_variables_expr): Fix expand_scalar_variables
+ for complex numbers.
+
+2009-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-ppl.c: Fix build if cloog is not available.
+
+2009-05-04 Li Feng <nemokingdom@gmail.com>
+
+ * tree-parloops.c (loop_parallel_p): Remove construction of
+ NITER and REDUCTION_LIST.
+ (try_get_loop_niter): New.
+ (try_create_reduction_list): New.
+ (parallelize_loops): Bypass the failed checkings in autopar
+ when can_be_parallel in loop structure is set to true.
+
+2009-05-01 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * testsuite/gcc.dg/graphite/id-6.c: Update testcase.
+ * testsuite/gcc.dg/graphite/scop-3.c: Dito.
+
+2009-05-01 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (stmt_simple_for_scop_p):
+ Enable EQ_EXPR and NE_EXPR again.
+
+2009-04-30 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (graphite_can_represent_scev):
+ Add check if scev is affine multivariate.
+ (harmful_stmt_in_bb): Check if we can represent the conditions.
+ (scopdet_basic_block_info (basic_block bb, VEC): Pass the loop to
+ harmful_stmt_in_bb.
+ * testsuite/gcc.dg/graphite/id-7.c: New.
+
+2009-04-30 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (bb_contains_non_iv_scalar_phi_nodes):
+ Check all bbs in region, not only the bbs that are represented in
+ GRAPHITE.
+ (build_poly_scop): Add newline.
+ * testsuite/gcc.dg/graphite/id-8.c: New.
+
+2009-04-30 Li Feng <nemokingdom@gmail.com>
+
+ * cfgloop.c (alloc_loop): Initialize can_be_parallel to false
+ when loop initialize.
+ * cfgloop.h (struct loop): Introduce flag can_be_parallel.
+ * common.opt: Declare flag_graphite_force_parallel.
+ * graphite-clast-to-gimple.c (translate_clast): Mark the innermost
+ loop parallel.
+ * graphite-poly.c (apply_poly_transforms): Introduce
+ flag_graphite_force_parallel.
+ * tree-ssa-loop.c (gate_graphite_transforms): ditto.
+ * toplev.c (process_options): ditto and replace a not correctly
+ encoded space.
+
+2009-04-30 Li Feng <nemokingdom@gmail.com>
+
+ * graphite-clast-to-gimple.c (loop_iv_stack_patch_for_consts):
+ Change the call of gbb_loop_at_index and/or gbb_loop_index due
+ to the redefinition.
+ (compute_cloog_iv_types_1): ditto.
+ (build_iv_mapping): ditto.
+ * graphite-sese-to-poly.c (new_gimple_bb): Remove GBB_LOOPS related
+ initialization.
+ (free_gimple_bb): Removed GBB_LOOPS related free part.
+ (build_bb_loops): Removed.
+ * sese.h (struct gimple_bb): Removed loops.
+ (GBB_LOOPS): Removed.
+ (gbb_loop_at_index): Instead of using GBB_LOOPS, we use sese instead.
+ (gbb_loop_index): ditto.
+
+2009-04-24 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (graphite_can_represent_scev): Do not
+ allow non constant strides.
+ * testsuite/gcc.dg/graphite/scop-20.c: New.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (dot_all_scops): Fix system call
+ return value warning.
+ (dot_scop): Same.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/id-6.c: Fix pattern.
+ * testsuite/gcc.dg/graphite/scop-3.c: Same.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (map_into_dep_poly, map_dr_into_dep_poly,
+ build_pairwise_constraint, dr_equality_constraints,
+ build_pairwise_scheduling_equality,
+ build_pairwise_scheduling_inequality, lexicographically_gt_p,
+ build_lexicographically_gt_constraint, dependence_polyhedron,
+ graphite_legal_transform_dr, graphite_legal_transform_bb,
+ graphite_legal_transform): New.
+ * graphite-poly.h (graphite_legal_transform): Declared.
+ * graphite-sese-to-poly.c (build_poly_scop): Call to
+ graphite_legal_transform is disabled for the moment.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.h (pbb_nb_scattering_dims): New.
+ (pbb_nb_scattering): Use it.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-ppl.c (ppl_insert_dimensions_pointset): Add
+ Pointset_Powerset version of ppl_insert_dimensions.
+ * graphite-ppl.h (ppl_insert_dimensions_pointset): Declared.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-ppl.c (ppl_insert_dimensions): Fix formatting.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.h: Fix comment.
+
+2009-04-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (build_poly_dr): Fix data ref multiplier.
+
+2009-04-24 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * sese.c (expand_scalar_variables_stmt): Only iterate over the old
+ statements.
+
+2009-04-24 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (var_used_in_not_loop_header_phi_node): New.
+ (graphite_stmt_p): Represent bbs necessary to build the phi nodes of
+ conditions.
+
+2009-04-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (stmt_simple_for_scop_p): Do not
+ handle EQ_EXPR and NE_EXPR.
+
+2009-04-17 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.h (poly_dr): Fix comment.
+
+2009-04-09 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c (new_poly_bb): Do not initialize PBB_DOMAIN
+ with a zero dimension polyhedron.
+ (find_scop_parameters): Move the call to scop_set_nb_params here.
+ (build_loop_iteration_domains): Store in loop->aux the iteration
+ domain polyhedron.
+ (build_scop_iteration_domain): Fix PBB_DOMAIN for bbs not surrounded
+ by any loop in scop.
+ (build_poly_scop): Do not call scop_set_nb_params.
+
+2009-04-09 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (add_condition_to_pbb): Pass code to
+ add_condition_to_domain not GT_EXPR.
+
+2009-04-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-ppl.c (debug_ppl_powerset_matrix): New.
+ * graphite-ppl.h (debug_ppl_powerset_matrix): New.
+ * graphite-sese-to-poly.c (add_condition_to_pbb): Use
+ upper_bound_assign to calculate unions.
+ * testsuite/gcc.dg/graphite/id-6.c: New.
+
+2009-04-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (canonicalize_loop_closed_ssa): Do not
+ handle abnormal edges.
+
+2009-04-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c (new_poly_dr, free_poly_dr): New.
+ (free_poly_bb): Also free poly_drs.
+ * graphite-poly.h (new_poly_dr, free_poly_dr): New.
+ (poly_dr): Polyhedron to Pointset_Powerset.
+ (pdr_accessp_nb_subscripts): Same.
+ * graphite-sese-to-poly.c (build_poly_dr): Same. And actually build
+ poly_drs.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (initialize_cloog_names): Change cloog
+ names into more meaningful names.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gfortran.dg/graphite/interchange-1.c: New.
+ * testsuite/gfortran.dg/graphite/interchange-2.c: New.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (graphite_loop_normal_form): Do not build
+ the reduction_list.
+ * tree-parloops.c (rewrite_phi_with_iv): New.
+ (rewrite_all_phi_nodes_with_iv): New.
+ (canonicalize_loop_ivs): Call them.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (try_generate_gimple_bb): Use
+ graphite_find_data_references_in_stmt.
+ * tree-data-ref.c (graphite_find_data_references_in_stmt): New.
+ * tree-data-ref.h (graphite_find_data_references_in_stmt): Declared.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (add_loop_exit_phis): Don't fail on non SSA_NAME renames.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (build_scop_bbs_1): Use bb_in_sese_p
+ instead of bb_in_region.
+ (flag_bb_in_region): Same. Renamed flag_bb_in_sese.
+ (build_sese_conditions): Use flag_bb_in_sese.
+ * sese.c (register_bb_in_sese): Removed.
+ (new_sese): Remove initialization of SESE_REGION_BBS.
+ (free_sese): Do not free SESE_REGION_BBS.
+ * sese.h (struct sese): Remove field region_basic_blocks.
+ (SESE_REGION_BBS): Removed.
+ (bb_in_sese_p): Implement in function of bb_in_region.
+
+2009-04-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (limit_scops): Deal only with single exit
+ loops.
+
+2009-04-08 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (stmt_simple_for_scop_p): Allow NE_EXPR
+ and EQ_EXPR.
+ * graphite-sese-to-poly.c (create_linear_expr_from_tree): New.
+ (add_condition_to_domain): New.
+ (add_condition_to_pbb): New.
+ (add_conditions_to_domain): Cleanup and handle of NE_EXPR and EQ_EXPR.
+ * testsuite/gcc.dg/graphite/scop-3.c: Update number of detected SCoPs.
+
+2009-04-08 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (build_cloog_prog): ppl_Polyhedron ->
+ ppl_Pointset_Powerset.
+ * graphite-poly.c (new_poly_bb, free_poly_bb): Same.
+ * graphite-poly.h (poly_bb): poly_bb.domain Same.
+ (pbb_nb_loops): Same.
+ * graphite-sese-to-poly.c (build_loop_iteration_domains,
+ add_conditions_to_domain): Same.
+ * graphite-ppl.c (new_Cloog_Domain_from_ppl_Pointset_Powerset): New.
+ (ppl_print_polyhedron_matrix): ppl_Polyhedron_t ->
+ ppl_const_Polyhedron_t.
+ (ppl_print_powerset_matrix): New.
+ * graphite-ppl.h (new_Cloog_Domain_from_ppl_Pointset_Powerset,
+ ppl_print_powerset_matrix): New.
+ (ppl_print_polyhedron_matrix): Updated.
+
+2009-04-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c (analyze_scalar_evolution_1): Fix comment.
+
+2009-04-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (extend_scattering): Fix indenting. Free cstr.
+ (print_iteration_domains, debug_iteration_domain,
+ debug_iteration_domains): New.
+ * graphite-poly.h (print_iteration_domains, debug_iteration_domain,
+ debug_iteration_domains): Declared.
+ * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Fix
+ indenting.
+
+2009-04-03 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.h (print_iteration_domain): New.
+ * graphite-sese-to-poly.c (add_conditions_to_domain): Fixed bug.
+ (build_sese_conditions_1, build_sese_conditions_after,
+ build_sese_conditions_before): New.
+ (build_sese_conditions): Rewritten.
+
+2009-04-03 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ Cleanup of code generation liveouts.
+ * graphite-clast-to-gimple.c (translate_clast): Use a single
+ rename_map instead of one per translated statement.
+ Do not use SESE_LIVEOUT_RENAMES.
+ (graphite_loop_normal_form): Do not use SESE_REDUCTION_LIST.
+ (gloog): Do not use SESE_LIVEOUT_RENAMES.
+ * graphite-scop-detection.c (harmful_stmt_in_bb): Return the close
+ phi node of a reduction: when a loop contains a reduction used outside
+ the loop, there should be a scalar close phi node on the exit block.
+ * sese.c (new_sese): Do not initialize SESE_LIVEOUT,
+ SESE_LIVEOUT_RENAMES, and SESE_REDUCTION_LIST.
+ (free_sese): Do not free them.
+ (sese_build_liveouts_use): Do not use them.
+ (sese_build_liveouts_bb): Same.
+ (sese_build_liveouts): Same.
+ (sese_insert_phis_for_liveouts): Same.
+ (sese_adjust_phis_for_liveouts): Same. Renamed sese_adjust_liveout_phis.
+ (defined_in_loop_p): New.
+ (alive_after_loop): New.
+ (close_phi_not_yet_inserted_p): New.
+ (struct alep, alep_p): New.
+ (add_loop_exit_phis): Remove from the rename_map all the names defined
+ in the code generated loop.
+ (insert_loop_close_phis): Traverse the rename_map passed to it.
+ Don't use SESE_LIVEOUT_RENAMES.
+ (default_liveout_before_guard): Renamed default_before_guard.
+ (insert_guard_phis): Do not use SESE_LIVEOUT_RENAMES.
+ (graphite_copy_stmts_from_block): Do not directly call set_rename.
+ (register_sese_liveout_renames): Removed.
+ (copy_bb_and_scalar_dependences): Do not call it.
+ * sese.h (struct sese): Removed fields: liveout, liveout_renames, and
+ reduction_list.
+ (SESE_LIVEOUT): Removed.
+ (SESE_LIVEOUT_RENAMES): Removed.
+ (SESE_REDUCTION_LIST): Removed.
+ (sese_build_liveouts): Removed.
+ (sese_adjust_phis_for_liveouts): Renamed sese_adjust_liveout_phis.
+ (insert_loop_close_phis): Pass a htab_t instead of a sese.
+ (insert_guard_phis): Same.
+ (rename_map_elt): Declare a VEC of them.
+ * tree-parloops.c (canonicalize_loop_ivs): reduction_list contains
+ trees not pointers to trees.
+
+ Rewrite in canonical close SSA form:
+ * graphite-scop-detection.c (contains_only_close_phi_nodes): New.
+ (limit_scops): Close the scop after the block containing the close phi
+ nodes.
+ (canonicalize_loop_closed_ssa): New.
+ (canonicalize_loop_closed_ssa_form): New.
+ (build_scops): Call canonicalize_loop_closed_ssa_form.
+
+ * graphite-sese-to-poly.c: Fix typos.
+
+2009-04-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_scattering_function, print_pbb_domain):
+ Extended.
+ (dump_gbb_conditions, dump_gbb_cases, print_iteration_domain): New.
+ (print_pbb): Add conditions.
+
+2009-04-01 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (bb_in_sd_region): Use bb_in_region.
+ * graphite-sese-to-poly.c (all_non_dominated_preds_marked_p): New.
+ (build_scop_bbs_1): New.
+ (build_scop_bbs): Rewrite.
+ * sese.h (bb_in_region): New.
+
+2009-03-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c (new_poly_bb, free_poly_bb): Initialize/free
+ poly_drs vector.
+ (print_scop): Style.
+ * graphite-poly.h (poly_bb): Add drs vector.
+ (PBB_DRS): Add accessor.
+ * graphite-sese-to-poly.c (build_poly_dr): New.
+ (build_pbb_drs, build_scop_drs): New.
+ (build_poly_scop): call build_scop_drs (Disabled at the moment).
+
+2009-03-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * tree-ssa-loop.c: Include forgotten toplev.h
+
+2009-03-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c: (apply_poly_transforms): sorry -> gcc_unreachable.
+ * testsuite/gcc.dg/graphite/pr37883.c: Remove -floop-*
+ * testsuite/gcc.dg/graphite/pr37928.c: Same
+ * testsuite/gcc.dg/graphite/pr38409.c: Same
+ * testsuite/gcc.dg/graphite/pr38498.c: Same
+ * testsuite/gcc.dg/graphite/pr38559.c: Same
+ * testsuite/gcc.dg/graphite/pr39335.c: Same
+ * testsuite/gcc.dg/graphite/pr39335_1.c: Same
+ * testsuite/gfortran.dg/graphite/block-2.f: Same
+ * tree-ssa-loop.c (gate_graphite_transforms): Always fail if called
+ with -floop-*.
+
+2009-03-28 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (ref_nb_loops, build_access_matrix_with_af,
+ build_access_matrix, build_scop_data_accesses): Remove access function
+ building. (We get a new version soon).
+ (build_bb_loops, scan_tree_for_params_right_scev): Update.
+ * sese.h (nb_loops_around_loop_in_sese): Remove.
+ (sese_loop_depth): Do not use SESE_LOOP_NEST any more.
+
+2009-03-27 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (struct scopdet_info): Rename last
+ field to exit.
+ (scopdet_basic_block_info, build_scops_1): Don't use
+ CDI_POST_DOMINATORS. CDI_POST_DOMINATORS should never be used.
+
+2009-03-26 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (gloog): Call sese_build_liveouts.
+ * sese.c (sese_build_liveouts_use): Renamed from
+ sese_build_livein_liveouts_use. Remove liveins.
+ (sese_build_liveouts_bb): Renamed from sese_build_livein_liveouts_bb.
+ Call sese_build_liveouts_use.
+ (sese_build_liveouts): Renamed from sese_build_livein_liveouts.
+ Call sese_build_liveouts_bb.
+ (new_sese, free_sese): Remove liveins.
+ (sese_add_exit_phis_var): Deleted.
+ (sese_insert_phis_for_liveouts): Call sese_add_exit_phis_edge
+ directly.
+ (graphite_copy_stmts_from_block): Remove SESE_NUM_VER.
+
+ * sese.h (sese): Remove num_ver and livein.
+ (SESE_LIVEIN, SESE_LIVEIN_VER, SESE_NUM_VER): Removed.
+
+2009-03-25 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (build_scop_scattering): Fix compile.
+
+2009-03-25 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (compare_prefix_loops): Removed.
+ (build_scop_scattering): Do not use compare_prefix_loops any more.
+ (nb_common_loops): New.
+
+2009-03-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (get_new_name_from_old_name): Renamed get_rename.
+ (register_old_and_new_names): Renamed set_rename.
+
+2009-03-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.h (nb_reductions_in_loop): Revert removal
+ of the decl from the previous commit.
+
+2009-03-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (dot_scop): New.
+ * graphite-scop-detection.h (dot_scop): Declared.
+
+2009-03-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-sese-to-poly.c (compare_prefix_loops): Fix compare.
+
+2009-03-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (create_empty_loop_on_edge): Generate the loop exit
+ condition at the end of the loop.
+ * graphite.c (graphite_initialize, graphite_finalize): Print to
+ dump_file the compiled function.
+ * graphite-clast-to-gimple.c (graphite_create_new_loop): Update use
+ of create_empty_loop_on_edge.
+ (translate_clast): Update the code generation of loops for the new
+ shape of loops.
+ * cfgloop.h (create_empty_loop_on_edge): Update declaration.
+
+2009-03-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ Reverted the patch from 2009-03-19.
+
+2009-03-19 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-poly.c (new_poly_bb, free_poly_bb): Initialize/free
+ poly_drs vector.
+ (print_scop): Style.
+ * graphite-poly.h (poly_bb): Add drs vector.
+ (PBB_DRS): Add accessor.
+ * graphite-sese-to-poly.c (ref_nb_loops): Remove.
+ (build_access_matrix_with_af, build_access_matrix,
+ build_scop_data_accesses): Delete.
+ (build_poly_dr): New.
+ (build_pbb_drs, build_scop_drs): New.
+ (build_poly_scop): call build_scop_drs.
+
+2009-03-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (dot_all_scops_1): Close the table
+ once per basic block.
+
+2009-03-13 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (graphite_can_represent_scev): New.
+ (graphite_can_represent_expr): Renamed from loop_affine_expr
+ and enhanced.
+ (stmt_simple_for_scop_p): Call graphite_can_represent_expr.
+ (graphite_cannot_represent_loop): Add scop_entry to parameters.
+ (scopdet_basic_block_info): Actually define entry_block.
+ (stmt_simple_memref_p): Moved here from ...
+
+ * tree-data-ref.c (stmt_simple_memref_p): here.
+ * tree-data-ref.h (stmt_simple_memref_p): Removed.
+
+2009-03-13 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * testsuite/gcc.dg/graphite/id-4.c: New.
+
+2009-03-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_expr): Handle tcc_comparison.
+ (register_old_and_new_names): Update the content of the map.
+ When there was already a rename_map_elt in the map at that
+ location, free it.
+ (copy_bb_and_scalar_dependences): Do rename_variables after
+ expand_scalar_variables.
+ * graphite-clast-to-gimple.c (build_iv_mapping): Update the content
+ of the map. When there was already a rename_map_elt in the
+ map at that location, free it.
+ (translate_clast): Pass the rename_map. Do not initialize and free
+ a rename_map per stmt_user.
+ (gloog): Initialize and free one rename_map and pass it to
+ translate_clast.
+
+2009-03-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_stmt,
+ expand_scalar_variables_ssa_name): Add a gimple_stmt_iterator
+ parameter.
+ (expand_scalar_variables_expr): Handle REALPART_EXPR and IMAGPART_EXPR.
+ (expand_scalar_variables): Pass to expand_scalar_variables_stmt
+ the gimple_stmt_iterator of the statement to be expanded.
+ * graphite-scop-detection.c (is_simple_operand): Do handle
+ REALPART_EXPR.
+
+2009-03-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (is_simple_operand): Do not handle
+ REALPART_EXPR.
+ * testsuite/gcc.dg/graphite/id-2.c: New.
+
+ * graphite-sese-to-poly.c (build_bb_loops,
+ add_value_to_dim, scan_tree_for_params_right_scev,
+ scan_tree_for_params_int, scan_tree_for_params, idx_record_params,
+ find_params_in_bb, build_loop_iteration_domains,
+ add_conditions_to_domain): Remove subtract.
+
+2009-03-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (loop_iv_stack_patch_for_consts,
+ build_iv_mapping, compute_cloog_iv_types_1, build_cloog_prog):
+ pbb_loop_at_index -> gbb_loop_at_index.
+ * graphite-poly.c (new_poly_bb, new_scop): New accessors.
+ (debug_loop_vec): Delete.
+ * graphite-poly.h (poly_bb, scop): Change black_box and region to void
+ pointer. Move LOOPS to gimple_bb_p and insert nb_params.
+ (PBB_LOOPS): Removed.
+ (PBB_BLACK_BOX): Insert cast.
+ (pbb_set_black_box): New setter.
+ (pbb_loop_at_index, pbb_loop_index): Removed.
+ (scop_set_region, scop_set_nb_params): New.
+ * graphite-sese-to-poly.c (new_gimple_bb, free_gimple_bb,
+ build_scop_scattering, build_bb_loops): Add GBB_LOOPS.
+ (build_poly_scop): Use scop_set_nb_params.
+ * sese.h (gimple_bb): Add LOOPS.
+ (GBB_LOOPS, gbb_loop_index, gbb_loop_at_index): New.
+
+2009-03-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ Revert previous commit.
+
+2009-03-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_expr): Handle tcc_comparison.
+ (register_old_and_new_names): Update the content of the map.
+ When there was already a rename_map_elt in the map at that
+ location, free it.
+ (copy_bb_and_scalar_dependences): Do rename_variables after
+ expand_scalar_variables.
+ * graphite-clast-to-gimple.c (build_iv_mapping): Update the content
+ of the map. When there was already a rename_map_elt in the
+ map at that location, free it.
+ (translate_clast): Pass the rename_map. Do not initialize and free
+ a rename_map per stmt_user.
+ (gloog): Initialize and free one rename_map and pass it to
+ translate_clast.
+
+2009-03-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ Remove forgotten line in revert.
+
+2009-03-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ Revert previous commit.
+
+2009-03-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (register_old_and_new_names): Update the content
+ of the map. When there was already a rename_map_elt in the
+ map at that location, free it.
+ (copy_bb_and_scalar_dependences): Do rename_variables after
+ expand_scalar_variables.
+ * graphite-clast-to-gimple.c (build_iv_mapping): Update the content
+ of the map. When there was already a rename_map_elt in the
+ map at that location, free it.
+ (translate_clast): Pass the rename_map. Do not initialize and free
+ a rename_map per stmt_user.
+ (gloog): Initialize and free one rename_map and pass it to
+ translate_clast.
+
+2009-03-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (translate_clast): context_loop
+ is never NULL.
+
+2009-03-10 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-ppl.c (ppl_insert_dimensions): Fix stupid mistake
+ of the use of ppl_Polyhedron_map_space_dimensions.
+
+2009-03-10 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (unify_scattering_dimensions): Fix types.
+ * graphite-poly.h (poly_dr_p, poly_dr, POLY_DR_TYPE, PDR_BB,
+ PDR_TYPE, PDR_ACCESSES, pdr_accessp_nb_subscripts,
+ pdr_accessp_nb_iterators, pdr_accessp_nb_params,
+ pdr_accessp_alias_set_dim, pdr_accessp_subscript_dim,
+ pdr_accessp_iterator_dim, pdr_accessp_param_dim,
+ pbb_nb_params): New.
+ (pbb_nb_loops, pbb_nb_scattering, scop_nb_params,
+ nb_loops_around_pbb): Adapt return types.
+
+2009-03-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Makefile.in (graphite.o, graphite-sese-to-poly.o,
+ graphite-clast-to-gimple.o, graphite-data-ref.o,
+ graphite-scop-detection.o, graphite-poly.o): Add
+ more headers.
+
+2009-03-05 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Makefile.in (graphite.o, graphite-sese-to-poly.o,
+ graphite-clast-to-gimple.o, graphite-data-ref.o,
+ graphite-scop-detection.o, graphite-poly.o): Add graphite-poly.h.
+
+2009-03-04 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * testsuite/gcc.dg/graphite/pr37485.c: Remove -floop-block
+ * testsuite/gcc.dg/graphite/pr37828.c: Same.
+ * testsuite/gcc.dg/graphite/pr37684.c: Same.
+ * testsuite/gcc.dg/graphite/block-0.c: Same.
+ * testsuite/gcc.dg/graphite/block-1.c: Same.
+ * testsuite/gcc.dg/graphite/block-2.c: Same.
+ * testsuite/gcc.dg/graphite/block-3.c: Same.
+ * testsuite/gcc.dg/graphite/block-4.c: Same.
+ * testsuite/gcc.dg/graphite/block-5.c: Same.
+ * testsuite/gcc.dg/graphite/block-6.c: Same.
+ * testsuite/gfortran.dg/graphite/pr38083.f90: Same.
+ * testsuite/gfortran.dg/graphite/block-1.f90: Same.
+ * testsuite/gfortran.dg/graphite/block-3.f90: Same.
+ * testsuite/gfortran.dg/graphite/pr37852.f90: Same.
+ * testsuite/gfortran.dg/graphite/block-4.f90: Same.
+ * testsuite/gfortran.dg/graphite/pr37980.f90: Same.
+ * testsuite/gfortran.dg/graphite/pr38953.f90: Same.
+ * testsuite/gfortran.dg/graphite/pr37857.f90: Same.
+ * opts.c: Remove -floop-block from -O2.
+ * graphite-poly.c: Fail if -floop-block -floop-interchange or
+ -floop-strip-mine are used.
+
+2009-03-04 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-clast-to-gimple.c (build_cloog_prog): Unify scattering
+ dimensions.
+ * graphite-poly.c (pbb_compare, graphite_sort_pbbs,
+ graphite_trans_bb_move_loop, graphite_trans_bb_strip_mine,
+ strip_mine_profitable_p, is_interchange_valid,
+ graphite_trans_bb_block, graphite_trans_loop_block,
+ graphite_trans_scop_block): Temporary removed.
+ (extend_scattering, unify_scattering_dimensions): New.
+ (print_scattering_function, graphite_read_transforms):
+ PBB_SCATTERING -> PBB_TRANSFORMED_SCATTERING.
+ (graphite_generate_scattering_fns): Removed.
+ (apply_poly_transforms): Cleanup.
+ (free_poly_bb): Add PBB_SCATTERING -> PBB_TRANSFORMED_SCATTERING.
+ (schedule_to_scattering): Moved.
+ (PBB_STATIC_SCHEDULE, PBB_SCATTERING): Removed.
+ (PBB_ORIGINAL_SCATTERING, PBB_TRANSFORMED_SCATTERING): New.
+ (pbb_nb_scattering): New.
+ (SCOP_ENTRY, SCOP_EXIT, SCOP_REGION_BBS, SCOP_DEP_GRAPH, SCOP_PARAMS,
+ SCOP_LOOP_NEST, SCOP_PARAMS, SCOP_OLDIVS, SCOP_LIVEOUT_RENAMES):
+ Removed.
+ * graphite-ppl.c (ppl_insert_dimensions): Extended and renamed from
+ shift_poly.
+ (ppl_strip_loop): PBB_SCATTERING -> PBB_TRANSFORMED_SCATTERING.
+ * graphite-scop-detection.c (dot_all_scops_1): PBB_SCATTERING
+ -> PBB_TRANSFORMED_SCATTERING.
+ * graphite-sese-to-poly.c (build_scop_bbs): Remove region.
+ (build_pbb_scattering_polyhedron): Moved from schedule_to_scattering.
+ (build_scop_scattering): Renamed from build_scop_canonical_schedules.
+ (check_poly_representation): Do not return bool.
+ (graphite_transform_loops): Reformat.
+ * sese.h (SESE_ENTRY_BB, SESE_EXIT_BB): New.
+
+2009-03-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c (print_pbb_domain, print_pbb, print_scop,
+ debug_pbb_domain, debug_pbb, debug_scop): New.
+ * graphite-poly.h (print_pbb_domain, print_pbb, print_scop,
+ debug_pbb_domain, debug_pbb, debug_scop): Declared.
+
+2009-03-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/39335
+ * tree-parloops.c (canonicalize_loop_ivs): Call fold_convert
+ when the type precision of the induction variable should be
+ larger than the type precision of nit.
+ (gen_parallel_loop): Update use of canonicalize_loop_ivs.
+ * graphite-clast-to-gimple.c (graphite_loop_normal_form): Same.
+ * tree-flow.h (canonicalize_loop_ivs): Update declaration.
+
+ * testsuite/gcc.dg/graphite/pr39335_1.c: New.
+ * testsuite/gcc.dg/graphite/pr39335.c: New.
+
+2009-03-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-parloops.c (canonicalize_loop_ivs): reduction_list contains
+ SSA_NAMES not struct reduction_info.
+
+2009-03-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * sese.c (expand_scalar_variables_expr): Handle ADDR_EXPR.
+
+2009-02-27 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * sese.c (new_sese): Initialize SESE_REDUCTION_LIST.
+ (free_sese): Free SESE_REDUCTION_LIST.
+ * sese.h (struct sese): Add field reduction_list.
+ (SESE_REDUCTION_LIST): New.
+ * graphite-clast-to-gimple.c (graphite_loop_normal_form): Call
+ canonicalize_loop_ivs on SESE_REDUCTION_LIST.
+
+2009-02-27 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * tree-flow.h (gather_scalar_reductions): Use struct loop * instead
+ of loop_p.
+
+2009-02-27 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * tree-parloops.c (struct brli, build_reduction_list_info,
+ analyze_reduction_list, gather_scalar_reductions): New.
+ (loop_parallel_p): Build a reduction list containing only
+ PHI_RESULT SSA_NAMEs: call gather_scalar_reductions.
+ (gen_parallel_loop): Call the analysis analyze_reduction_list.
+ (parallelize_loops): Now reduction_list is a htab_t of SSA_NAMEs.
+ * tree-flow.h (gather_scalar_reductions): Declared.
+
+2009-02-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/39308
+ * graphite-clast-to-gimple.c (graphite_loop_normal_form): Do not call
+ number_of_iterations_exit from a gcc_assert.
+
+2009-02-25 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * output.h (graphite_out_file, graphite_in_file): Declared.
+ * toplev.c (graphite_out_file, graphite_in_file): New.
+ (init_asm_output): Initialize graphite_in_file and graphite_out_file.
+ * graphite-clast-to-gimple.c (build_cloog_prog): Read PBB_SCATTERING.
+ Don't call schedule_to_scattering.
+ * common.opt (fgraphite-write, fgraphite-read): New.
+ * graphite-poly.c: Include output.h.
+ (print_scattering_function, print_scattering_functions,
+ debug_scattering_function, debug_scattering_functions,
+ graphite_write_transforms, graphite_read_transforms,
+ graphite_generate_scattering_fns): New.
+ (apply_poly_transforms): Do not apply transform if flag_graphite_read.
+ Call graphite_generate_scattering_fns, graphite_write_transforms,
+ graphite_read_transforms.
+ (new_poly_bb): Initialize PBB_SCATTERING.
+ (free_poly_bb): Free PBB_SCATTERING.
+ (schedule_to_scattering): Does not return, initialize PBB_SCATTERING.
+ * graphite-poly.h (struct poly_bb): Add field scattering.
+ (PBB_SCATTERING): New.
+ (print_scattering_function, print_scattering_functions,
+ debug_scattering_function, debug_scattering_functions): Declared.
+ * graphite-ppl.c (cloog_matrix_to_ppl_constraint): Matrices contain
+ GMP values, not integers!
+ (ppl_print_polyhedron_matrix, debug_ppl_polyhedron_matrix,
+ ppl_read_polyhedron_matrix): New.
+ * graphite-ppl.h (ppl_print_polyhedron_matrix,
+ debug_ppl_polyhedron_matrix,
+ ppl_read_polyhedron_matrix): Declared.
+ * Makefile.in (graphite-poly.o): Depends on output.h.
+
+2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ Revert this change:
+ * graphite-scop-detection.c (stmt_simple_for_scop_p): Analyze
+ scalar evolutions in the scop_entry->loop_father.
+
+2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.h (ref_nb_loops): Remove declaration.
+ (struct gimple_bb, gimple_bb_p, GBB_BB, GBB_DATA_REFS, GBB_CONDITIONS,
+ GBB_CONDITION_CASES, GBB_CLOOG_IV_TYPES, gbb_loop, print_gimple_bb,
+ debug_gbb): Moved to sese.h.
+ * sese.h: As said.
+
+2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-data-ref.[ch]: Disable.
+
+2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (stmt_simple_for_scop_p): Analyze
+ scalar evolutions in the scop_entry->loop_father.
+
+2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-scop-detection.c (nb_reductions_in_loop): Moved here...
+ (graphite_cannot_represent_loop_niter): Renamed
+ graphite_cannot_represent_loop. Call nb_reductions_in_loop.
+ (limit_scops): build_sese_loop_nests does not return a bool.
+ * graphite-scop-detection.h (nb_reductions_in_loop): Declared.
+ * sese.c (nb_reductions_in_loop): ... from here.
+ (graphite_loop_normal_form): ... from here.
+ (sese_record_loop): Does not fail, so does not return a bool.
+ (build_sese_loop_nests): Same.
+ * sese.h (build_sese_loop_nests): Update declaration.
+ * graphite-clast-to-gimple.c (graphite_loop_normal_form): Moved here...
+ (build_graphite_loop_normal_form): New.
+ (gloog): Call build_graphite_loop_normal_form.
+ * graphite-sese-to-poly.c (build_poly_scop): Don't fail on
+ build_sese_loop_nests.
+
+ * testsuite/gcc.dg/graphite/id-1.c: New.
+
+2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-sese-to-poly.c (scan_tree_for_params): Remove REAL_CST.
+ The SCoP detection fix is sufficient.
+
+2009-02-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/39260
+ * graphite-scop-detection.c (harmful_stmt_in_bb): Stop a SCoP when
+ the basic block contains a condition with a real type.
+ * graphite-sese-to-poly.c (scan_tree_for_params): Handle REAL_CST.
+
+ * gcc.dg/graphite/pr39260.c: New.
+
+2009-02-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-poly.c: Inlcude params.h.
+ (graphite_trans_loop_block): Use PARAM_LOOP_BLOCK_TILE_SIZE for
+ the size of a tile.
+ * Makefile.in (graphite-poly.o): Depend on PARAMS_H.
+ * params.def (PARAM_LOOP_BLOCK_TILE_SIZE): Define.
+
+2009-02-20 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-scop-detection.c (dot_all_scops_1,
+ dot_all_scops): Moved here.
+ * graphite-scop-detection.h (dot_all_scops): Declared here.
+ * graphite.c (graphite_initialize, graphite_finalize): New.
+ (graphite_transform_loops): Cleaned up.
+ * sese.c (debug_oldivs): Moved here.
+ * graphite-poly.c (graphite_apply_transformations): Renamed
+ apply_poly_transforms.
+ (debug_loop_vec): Moved here.
+ * graphite-sese-to-poly.c (build_bb_loops, build_sese_conditions_1,
+ scop_contains_non_iv_scalar_phi_nodes, build_sese_conditions,
+ find_scop_parameters, build_scop_iteration_domain,
+ add_conditions_to_constraints, build_scop_canonical_schedules,
+ build_scop_data_accesses): Now static.
+ (build_poly_scop, check_poly_representation): New.
+
+2009-02-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_stmt_p, new_gimple_bb, free_gimple_bb,
+ remove_gbbs_in_scop, free_scops, try_generate_gimple_bb,
+ build_scop_bbs, ref_nb_loops, compare_prefix_loops,
+ build_scop_canonical_schedules, build_bb_loops, add_value_to_dim,
+ scan_tree_for_params_right_scev, scan_tree_for_params_int,
+ scan_tree_for_params, struct irp_data, dx_record_params,
+ find_params_in_bb, find_scop_parameters, gbb_from_bb,
+ build_loop_iteration_domains, add_conditions_to_domain,
+ phi_node_is_iv, bb_contains_non_iv_scalar_phi_nodes,
+ scop_contains_non_iv_scalar_phi_nodes, build_sese_conditions_1,
+ build_sese_conditions, add_conditions_to_constraints,
+ build_scop_iteration_domain, build_access_matrix_with_af,
+ build_access_matrix,
+ build_scop_data_accesses): Moved to graphite-sese-to-poly.c.
+
+ * graphite-sese-to-poly.c: New.
+ * graphite-sese-to-poly.h: New.
+
+ * Makefile.in: Add new rule for graphite-sese-to-poly.o.
+
+2009-02-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Split graphite code generation to a new file.
+ (graphite_verify, gmp_cst_to_tree, clast_name_to_gcc,
+ max_precision_type, clast_to_gcc_expression_red,
+ clast_to_gcc_expression, gcc_type_for_clast_expr,
+ gcc_type_for_clast_eq, loop_iv_stack_patch_for_consts,
+ graphite_translate_clast_equation, graphite_create_guard_cond_expr,
+ graphite_create_new_guard, clast_get_body_of_loop,
+ gcc_type_for_cloog_iv, gcc_type_for_iv_of_clast_loop,
+ graphite_create_new_loop, build_iv_mapping, copy_renames,
+ translate_clast, find_cloog_iv_in_expr, compute_cloog_iv_types_1,
+ compute_cloog_iv_types, free_scattering, save_var_name,
+ initialize_cloog_names, build_scop_context, build_cloog_prog,
+ set_cloog_options, debug_clast_stmt, scop_to_clast,
+ print_generated_program, debug_generated_program,
+ gloog): Moved to graphite-clast-to-gimple.c.
+
+ (struct cloog_prog_clast): Moved to graphite-clast-to-gimple.h.
+
+ (iv_stack_entry_is_constant, iv_stack_entry_is_iv,
+ loop_iv_stack_push_iv, loop_iv_stack_insert_constant,
+ loop_iv_stack_pop, loop_iv_stack_get_iv,
+ loop_iv_stack_get_iv_from_name, debug_loop_iv_stack,
+ free_loop_iv_stack, loop_iv_stack_remove_constants,
+ debug_rename_elt, debug_rename_map_1, debug_rename_map,
+ rename_map_elt_info, eq_rename_map_elts, debug_ivtype_elt,
+ debug_ivtype_map_1, debug_ivtype_map, ivtype_map_elt_info,
+ eq_ivtype_map_elts, sese_add_exit_phis_edge,
+ sese_add_exit_phis_var, sese_insert_phis_for_liveouts,
+ get_vdef_before_sese, sese_adjust_vphi,
+ get_new_name_from_old_name, sese_adjust_phis_for_liveouts,
+ oldiv_for_loop, rename_variables_in_stmt, is_parameter,
+ is_iv, expand_scalar_variables_ssa_name,
+ expand_scalar_variables_expr, expand_scalar_variables_stmt,
+ expand_scalar_variables, rename_variables, remove_condition,
+ get_true_edge_from_guard_bb, get_false_edge_from_guard_bb,
+ add_loop_exit_phis, insert_loop_close_phis, struct igp,
+ default_liveout_before_guard, add_guard_exit_phis,
+ insert_guard_phis, register_old_and_new_names,
+ graphite_copy_stmts_from_block, register_sese_liveout_renames,
+ copy_bb_and_scalar_dependences, outermost_loop_in_sese,
+ if_region_set_false_region, create_if_region_on_edge,
+ move_sese_in_condition): Moved to sese.c.
+
+ (nb_loops_around_loop_in_sese, struct ifsese, if_region_entry,
+ if_region_exit, if_region_get_condition_block,
+ struct rename_map_elt, new_rename_map_elt, enum iv_stack_entry_kind,
+ union iv_stack_entry_data_union, struct iv_stack_entry_struct,
+ iv_stack_entry_p, loop_iv_stack, struct ivtype_map_elt,
+ ivtype_map_elt, new_ivtype_map_elt,
+ recompute_all_dominators): Moved to sese.h.
+
+ * graphite-clast-to-gimple.c: New.
+ * graphite-clast-to-gimple.h: New.
+ * Makefile.in: Add new rule for graphite-clast-to-gimple.o.
+ * sese.c: Modified as said above.
+ * sese.h: Same.
+
+2009-02-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Split scop detection to a new file.
+ (enum gbb_type, gbb_type, get_bb_type, struct sd_region_p, sd_region,
+ move_sd_regions, loop_affine_expr, exclude_component_ref,
+ is_simple_operand, stmt_simple_for_scop_p, harmful_stmt_in_bb,
+ graphite_cannot_represent_loop_niter, struct scopdet_info,
+ scopdet_basic_block_info, build_scops_1, bb_in_sd_region,
+ find_single_entry_edge, find_single_exit_edge,
+ create_single_entry_edge, sd_region_without_exit,
+ create_single_exit_edge, unmark_exit_edges, mark_exit_edges,
+ create_sese_edges, build_graphite_scops, limit_scops, build_scops):
+ Moved to graphite-scop-detection.c.
+
+ * graphite-scop-detection.c: New.
+ * graphite-scop-detection.h: New.
+ * Makefile.in: Add new rule for graphite-scop-detection.o.
+
+ * sese.c: Include tree-chrec.h, tree-data-ref.h, and
+ tree-scalar-evolution.h.
+ (nb_reductions_in_loop, graphite_loop_normal_form, sese_record_loop,
+ build_sese_loop_nests): Moved here from graphite.c.
+ (param_index): Renamed parameter_index_in_region.
+
+2009-02-18 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/block-0.c: Expected to fail now.
+ * gcc.dg/graphite/block-1.c: Same.
+ * gcc.dg/graphite/block-5.c: Same.
+ * gcc.dg/graphite/block-6.c: Same.
+
+2009-02-18 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.h: Separate from graphite_bb_p the polyhedral
+ representation in poly_bb_p and the GCC specifics in gimple_bb_p.
+ (struct data_dependence_polyhedron, RDGE_DDP, ddp_p): Moved to
+ graphite-data-ref.h.
+ (struct poly_bb, PBB_SCOP, PBB_STATIC_SCHEDULE, PBB_DOMAIN,
+ PBB_BLACK_BOX, PBB_LOOPS, pbb_nb_loops, pbb_loop_at_index,
+ pbb_loop_index, struct scop, SCOP_BBS, SCOP_REGION, SCOP_ENTRY,
+ SCOP_EXIT, SCOP_REGION_BBS, SCOP_DEP_GRAPH, SCOP_PARAMS,
+ SCOP_LOOP_NEST, SCOP_PARAMS, SCOP_OLDIVS, SCOP_LIVEOUT_RENAMES,
+ scop_nb_params): Moved to graphite-poly.h.
+ * graphite-data-ref.c: Same.
+ * graphite-data-ref.h: New.
+ * graphite.c: Same.
+ (pbb_compare, graphite_sort_pbbs, graphite_trans_bb_move_loop,
+ graphite_trans_bb_strip_mine, strip_mine_profitable_p,
+ is_interchange_valid, graphite_trans_bb_block,
+ graphite_trans_loop_block, scop_max_loop_depth,
+ graphite_trans_scop_block, graphite_apply_transformations,
+ new_poly_bb, free_poly_bb, new_scop, free_scop): Moved to
+ graphite-poly.c.
+ * graphite-poly.h: New.
+ * graphite-poly.c: New.
+ * Makefile.in (OBJS-common): Add graphite-poly.o.
+ (graphite-poly.o): New rule.
+ * tree-data-ref.h (struct data_reference): Remove unused scop field.
+ (DR_SCOP): Removed.
+
+2009-02-18 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c: Replace gb -> gbb.
+ * graphite.h: Same.
+ * graphite-data-ref.c: Same.
+
+2009-02-18 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Makefile.in (OBJS-commmon): Add sese.o.
+ (sese.o): New.
+ (graphite.o): Add sese.h.
+ * graphite.c (bb_in_ss_p, loop_in_sese_p,
+ sese_build_livein_liveouts_use, sese_build_livein_liveouts_bb,
+ sese_build_livein_liveouts, register_bb_in_sese, new_sese, free_sese):
+ Move to sese.
+ (block_before_scop): Add missing return.
+ (new_scop, free_scop): Remove SESE data structures.
+ (scop_record_loop, scan_tree_for_params, find_params_in_bb,
+ find_scop_parameters, build_loop_iteration_domains,
+ add_conditions_to_domain, register_scop_liveout_renames,
+ copy_bb_and_scalar_dependences): Scop -> SESE.
+
+ (add_conditions_to_domain): SCoP -> SESE and remove check
+ (scop_contains_non_iv_scalar_phi_nodes): New.
+ (build_scop_conditions_1, build_scop_conditions): Remove check for
+ non iv scalar phi nodes.
+ (print_scop_statistics): New.
+ (graphite_transform_loops): Cleanup.
+
+ * graphite.h: Move to sese & cleanup.
+ * sese.c: New.
+ * sese.h: New.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_scop_conditions_1): Conditions are only
+ at the end of a basic block.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau>
+
+ * graphite.h (struct graphite_bb): Remove compressed_alpha_matrix
+ field.
+ (GBB_ALPHA): Removed.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-data-ref.c (graphite_test_dependence): Don't use
+ GBB_DYNAMIC_SCHEDULE.
+ * graphite.c (new_graphite_bb): Same.
+ (free_graphite_bb): Same.
+ (build_scop_dynamic_schedules): Removed.
+ (graphite_transform_loops): Don't call it.
+ * graphite.h (struct graphite_bb): Remove dynamic_schedule field.
+ (GBB_DYNAMIC_SCHEDULE): Removed.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (schedule_to_scattering): Don't use CloogMatrix.
+ (print_graphite_bb): Same.
+ (build_cloog_prog): Same.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_cloog_prog): Don't use CloogMatrix.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_scop_context): Don't use CloogMatrix.
+ * graphite-ppl.c (new_Cloog_Domain_from_ppl_Polyhedron): New.
+ * graphite-ppl.h (new_Cloog_Domain_from_ppl_Polyhedron): Declared.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.h (struct scop): Move params, old_ivs, loops, loop_nest,
+ liveout_renames, add_params fields...
+ (struct sese): ... here.
+ (SESE_PARAMS, SESE_LOOPS, SESE_LOOP_NEST, SESE_ADD_PARAMS,
+ SESE_PARAMS, SESE_OLDIVS, SESE_LIVEOUT_RENAMES): New.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_scop): Do not print the CLooG program.
+ (new_scop, free_scop, initialize_cloog_names, build_scop_context,
+ build_cloog_prog, gloog): Don't use SCOP_PROG.
+ (find_transform): Renamed scop_to_clast.
+ (print_generated_program, debug_generated_program): New.
+ (graphite_transform_loops): Adapt to new interface.
+ * graphite.h (struct scop): Remove program field.
+ (SCOP_PROG): Removed.
+ (print_generated_program, debug_generated_program): Declared.
+
+2009-02-16 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-data-ref.c (schedule_precedes_p, schedule_same_p): New.
+ (statement_precedes_p): Use schedule_same_p and schedule_precedes_p.
+ * graphite.c (gbb_compare, schedule_to_scattering, print_graphite_bb,
+ free_graphite_bb, build_scop_canonical_schedules,
+ graphite_trans_bb_strip_mine, graphite_trans_scop_block): Static
+ schedules are now represented using a ppl_Linear_Expression_t.
+ * graphite.h (struct graphite_bb): Same.
+ * graphite-ppl.c (ppl_lexico_compare_linear_expressions): New.
+ * graphite-ppl.h (ppl_lexico_compare_linear_expressions): Declared.
+
+2009-02-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Free local memory.
+ * graphite-ppl.c: Same.
+
+2009-02-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (const_column_index, get_first_matching_sign_row_index,
+ get_lower_bound_row, get_upper_bound_row, copy_constraint,
+ swap_constraint_variables, scale_constraint_variable): Removed.
+ (graphite_trans_bb_strip_mine): Remove pong.
+ * graphite-ppl.c: Include missing header files.
+ (set_inhomogeneous, set_coef, shift_poly, ppl_strip_loop): New.
+ * graphite-ppl.h (ppl_strip_loop): Declared.
+ * Makefile.in (graphite-ppl.o): Adjust dependences.
+
+2009-02-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_loop_iteration_domains): Remove ping pong.
+ (build_scop_iteration_domain): Same.
+
+2009-02-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scan_tree_for_params, add_conditions_to_domain): Remove
+ ping pong.
+ (add_value_to_dim, scan_tree_for_params_right_scev,
+ scan_tree_for_params_int): New.
+ * graphite-ppl.c (oppose_constraint): New.
+ (insert_constraint_into_matrix): Implement missing cases.
+ * graphite-ppl.h (insert_constraint_into_matrix): Declared.
+
+2009-02-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_trans_bb_move_loop): Remove ping pong,
+ use ppl_move_dimension.
+
+2009-02-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-data-ref.c: Domains are now ppl_Polyhedra_t.
+ * graphite.c: Same.
+ * graphite.h: Same.
+ * graphite-ppl.c: Same.
+ * graphite-ppl.h: Same.
+
+2009-02-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ Revert last 3 commits.
+
+2009-02-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scan_tree_for_params, add_conditions_to_domain): Remove
+ ping pong.
+ (add_value_to_dim, scan_tree_for_params_right_scev,
+ scan_tree_for_params_int): New.
+ * graphite-ppl.c (oppose_constraint): New.
+ (insert_constraint_into_matrix): Implement missing cases.
+ * graphite-ppl.h (insert_constraint_into_matrix): Declared.
+
+2009-02-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_trans_bb_move_loop): Remove unused variables.
+
+2009-02-10 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_trans_bb_move_loop): Remove ping pong,
+ use ppl_move_dimension.
+ * graphite-ppl.c (ppl_move_dimension): New.
+ * graphite-ppl.h (ppl_move_dimension): Declared.
+
+2009-02-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Do not include cloog/cloog.h.
+ (print_graphite_bb): Remove ping pong, call PPL print function.
+
+2009-02-10 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * Makefile.in (OBJS-common): Add graphite-ppl.o.
+ (graphite.o): Add dependence on graphite-ppl.h.
+ (graphite-ppl.o): New.
+ (graphite-data-ref.c): Ping pong between PPL data structures
+ and matrices.
+ * graphite-ppl.c: New.
+ * graphite-ppl.h: New.
+ * graphite.c: Include graphite-ppl.h.
+ (print_graphite_bb, add_conditions_to_domain, build_cloog_prog,
+ graphite_trans_bb_move_loop, graphite_trans_bb_strip_mine):
+ Ping pong between PPL data structures and matrices.
+ (new_graphite_bb): Create a PPL constraint system.
+ Call ppl_delete_Constraint_System instead of cloog_matrix_free.
+ (build_loop_iteration_domains): Use PPL functions.
+ * graphite.h: Include graphite-ppl.h. Fix comments.
+ (graphite_bb): Use a ppl_Constraint_System_t instead of
+ CloogMatrix for representing the domain.
+ (scop): Remove static_schedule.
+ (gbb_nb_loops): Ping pong between PPL data structures and matrices.
+
+2009-02-06 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Fix some comments.
+
+2009-02-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/38953
+ * graphite.c (if_region_set_false_region): After moving a region
+ in the false branch of a condition, remove the empty dummy
+ basic block.
+ (gloog): Remove wrong fix for PR38953.
+
+2009-02-03 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (bb_in_sese_p, sese_build_livein_liveouts_use,
+ sese_build_livein_liveouts_bb, sese_build_livein_liveouts,
+ register_bb_in_sese, new_sese, free_sese): Moved.
+ (dot_scop_1, build_scop_loop_nests, build_loop_iteration_domains,
+ outermost_loop_in_scop, build_scop_iteration_domain,
+ expand_scalar_variables_ssa_name, get_vdef_before_scop,
+ limit_scops): Use bb_in_sese_p instead of bb_in_scop_p.
+ Use loop_in_sese_p instead of loop_in_scop_p.
+ (new_graphite_bb, new_scop, gloog): Do not initialize SCOP_BBS_B.
+ (free_scop): Do not free SCOP_BBS_B.
+ (nb_loops_around_loop_in_scop, nb_loops_around_gb,
+ ref_nb_loops): Moved here...
+ * graphite.h (ref_nb_loops): ... from here.
+ (struct scop): Remove bbs_b bitmap.
+ (SCOP_BBS_B, bb_in_scop_p, loop_in_scop_p): Removed.
+ * testsuite/gcc.dg/graphite/scop-19.c: New
+
+2009-02-03 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scopdet_basic_block_info): Fix bug in scop
+ detection.
+
+2009-01-30 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (new_loop_to_cloog_loop_str, hash_loop_to_cloog_loop,
+ eq_loop_to_cloog_loop): Remove.
+ (new_scop, free_scop): Remove SCOP_LOOP2CLOOG_LOOP.
+ * graphite.h (struct scop): Remove loop2cloog_loop.
+ (loop_domain_dim, loop_iteration_vector_dim): Remove.
+
+2009-01-30 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * opts.c (decode_options): Only add graphite options to O2
+ if we compile with graphite enabled.
+
+2009-01-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r143163:143684).
+
+2009-01-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (debug_value): Removed.
+ * graphite.h (debug_value): Removed.
+
+2009-01-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * passes.c (init_optimization_passes): Do not call pass_copy_prop
+ after graphite: pass_copy_prop does not maintain a proper loop closed
+ SSA form. pass_copy_prop should be fixed.
+
+2009-01-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scop_adjust_phis_for_liveouts): Fix warning.
+
+2009-01-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_verify): Add a call to verify_loop_closed_ssa.
+ (gloog): Split the exit of the scop when the scop exit is a loop exit.
+ (graphite_transform_loops): Only call cleanup_tree_cfg if gloog
+ changed the CFG.
+
+2009-01-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (gloog): Return true when code gen succeeded.
+ (graphite_transform_loops): Do not call cleanup_tree_cfg if
+ the code of the function did not changed. After cleanup_tree_cfg
+ call rewrite_into_loop_closed_ssa to maintain the loop closed ssa
+ form.
+
+2009-01-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (stmt_simple_for_scop_p): Also handle cases when
+ gimple_call_lhs is NULL.
+
+2009-01-16 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <tobi.grosser@amd.com>
+
+ * graphite.c (graphite_trans_scop_block): Do not block single
+ nested loops.
+
+2009-01-15 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <tobi.grosser@amd.com>
+
+ * graphite.c (build_scop_canonical_schedules): Start schedules at
+ zero.
+
+2009-01-15 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <tobi.grosser@amd.com>
+
+ * graphite.c (compare_prefix_loops): New.
+ (build_scop_canonical_schedules): Rewritten.
+ (graphite_transform_loops): Move build_scop_canonical_schedules
+ after build_scop_iteration_domain.
+
+2009-01-14 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <tobi.grosser@amd.com>
+
+ * graphite.c (add_conditions_to_domain): Add the loops to
+ the dimension of the iteration domain. Do copy the domain
+ only when it exists.
+ (build_scop_conditions_1): Do not call add_conditions_to_domain.
+ (add_conditions_to_constraints): New.
+ (can_generate_code_stmt, can_generate_code): Removed.
+ (gloog): Do not call can_generate_code.
+ (graphite_transform_loops): Call add_conditions_to_constraints
+ after building the iteration domain.
+
+2009-01-14 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <tobi.grosser@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (scan_tree_for_params): On substractions negate
+ all the coefficients of the term.
+ (clast_to_gcc_expression_red): New. Handle reduction expressions
+ of more than two operands.
+ (clast_to_gcc_expression): Call clast_to_gcc_expression_red.
+ (get_vdef_before_scop): Handle also the case of default definitions.
+
+2009-01-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/38431
+ * graphite.c (get_vdef_before_scop, scop_adjust_vphi): New.
+ (scop_adjust_phis_for_liveouts): Call scop_adjust_vphi.
+ (gloog): Do not call cleanup_tree_cfg.
+ (graphite_transform_loops): Call cleanup_tree_cfg after all
+ scops have been code generated.
+
+2009-01-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * passes.c (init_optimization_passes): Schedule after
+ graphite transforms pass_copy_prop, pass_dce_loop and pass_lim.
+
+2009-01-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (expand_scalar_variables_stmt): Do not pass loop_p.
+ Fix comment.
+ (expand_scalar_variables_ssa_name): Do not pass loop_p. Fix comment.
+ Set the type of an expression to the type of its assign statement.
+ (expand_scalar_variables_expr): Do not pass loop_p.
+ Fix comment. Stop recursion on tcc_constant or tcc_declaration.
+ (copy_bb_and_scalar_dependences): Do not pass loop_p.
+ (translate_clast): Update call to copy_bb_and_scalar_dependences.
+
+2009-01-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (expand_scalar_variables_ssa_name): Set the type of
+ an expression to the gimple_expr_type of its assign statement.
+ (expand_scalar_variables_expr): Stop recursion on tcc_constant
+ or tcc_declaration.
+
+2009-01-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/38786
+ * testsuite/gcc.dg/graphite/pr38786.c: New.
+ * graphite.c (expand_scalar_variables_ssa_name): New, outlined from
+ the SSA_NAME case of expand_scalar_variables_expr.
+ (expand_scalar_variables_expr): Also gather the scalar computation
+ used to index the memory access.
+ (expand_scalar_variables_stmt): Pass to expand_scalar_variables_expr
+ the gimple_stmt_iterator where it inserts new code.
+
+2009-01-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/block-3.c: Fix compile error on 32bit.
+
+2009-01-10 Sebastian Pop <sebastian.pop@amd.com>
+
+ * opts.c (decode_options): Enable flag_graphite_identity and
+ flag_loop_block in -O2 and above.
+
+2009-01-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * libjava/classpath/lib/gnu/java/awt/peer/gtk/GtkMouseInfoPeer.class:
+ Fix merge problem: replace with the file from trunk.
+
+2009-01-08 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r141727:143163).
+
+2009-01-07 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ PR tree-optimization/38559
+ * testsuite/gcc.dg/graphite/pr38559.c: New.
+
+ * graphite.c (debug_value, copy_constraint,
+ swap_constraint_variables, scale_constraint_variable, ): New.
+ (get_lower_bound, get_upper_bound): Removed.
+ (graphite_trans_bb_strip_mine): Clean up this code that works
+ only for constant number of iterations. Fully copy upper and
+ lower bound constraints, not only the constant part of them.
+ * graphite.h (debug_value): Declared.
+
+2009-01-06 Jan Sjodin <jan.sjodin@amd.com>
+
+ PR tree-optimization/38492
+ PR tree-optimization/38498
+ * tree-check.c (operator_is_linear, scev_is_linear_expression): New.
+ * tree-chrec.h (scev_is_linear_expression): Declared.
+ * graphite.c (graphite_cannot_represent_loop_niter): New.
+ (scopdet_basic_block_info): Call graphite_cannot_represent_loop_niter.
+ (graphite_loop_normal_form): Use gcc_assert.
+ (scan_tree_for_params): Use CASE_CONVERT.
+ (phi_node_is_iv, bb_contains_non_iv_scalar_phi_nodes): New.
+ (build_scop_conditions_1): Call bb_contains_non_iv_scalar_phi_nodes.
+ Use gcc_assert. Discard scops that contain unhandled cases.
+ (build_scop_conditions): Return a boolean status for unhandled cases.
+ (strip_mine_profitable_p): Print the loop number, not its depth.
+ (is_interchange_valid): Pass the depth of the loop nest, don't
+ recompute it wrongly.
+ (graphite_trans_bb_block): Same.
+ (graphite_trans_bb_block): Print tentative of loop blocking.
+ (graphite_trans_scop_block): Do not print that the loop has been
+ blocked.
+ (graphite_transform_loops): Do not handle scops that contain condition
+ scalar phi nodes.
+
+ * testsuite/gcc.dg/graphite/pr38500.c: Fixed warning as committed
+ in trunk.
+ * testsuite/gcc.dg/graphite/block-0.c: Update test.
+ * testsuite/gcc.dg/graphite/block-1.c: Same.
+ * testsuite/gcc.dg/graphite/block-2.c: Remove xfail and test for
+ blocking.
+ * testsuite/gcc.dg/graphite/block-4.c: Remove test for strip mine.
+ * testsuite/gcc.dg/graphite/block-3.c: New.
+ * testsuite/gcc.dg/graphite/pr38498.c: New.
+
+2008-12-22 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ PR tree-optimization/38510
+ * gcc.dg/graphite/pr38510.c: New.
+ * graphite.c (recompute_all_dominators): Call mark_irreducible_loops.
+ (translate_clast): Call recompute_all_dominators before
+ graphite_verify.
+ (gloog): Call recompute_all_dominators before graphite_verify.
+
+2008-12-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/38492
+ * graphite.c (rename_map_elt, debug_rename_elt,
+ debug_rename_map_1, debug_rename_map, new_rename_map_elt,
+ rename_map_elt_info, eq_rename_map_elts,
+ get_new_name_from_old_name, bb_in_sese_p): Moved around.
+ (sese_find_uses_to_rename_use): Renamed sese_build_livein_liveouts_use.
+ (sese_find_uses_to_rename_bb): Renamed sese_build_livein_liveouts_bb.
+ (sese_build_livein_liveouts): New.
+ (new_sese, free_sese): New.
+ (new_scop): Call new_sese.
+ (free_scop): Call free_sese.
+ (rename_variables_from_edge, rename_phis_end_scop): Removed.
+ (register_old_new_names): Renamed register_old_and_new_names.
+ (register_scop_liveout_renames, add_loop_exit_phis,
+ insert_loop_close_phis, struct igp,
+ default_liveout_before_guard, add_guard_exit_phis,
+ insert_guard_phis, copy_renames): New.
+ (translate_clast): Call insert_loop_close_phis and insert_guard_phis.
+ (sese_add_exit_phis_edge): Renamed scop_add_exit_phis_edge.
+ (rewrite_into_sese_closed_ssa): Renamed scop_insert_phis_for_liveouts.
+ (scop_adjust_phis_for_liveouts): New.
+ (gloog): Call scop_adjust_phis_for_liveouts.
+
+ * graphite.h (struct sese): Documented. Added fields liveout,
+ num_ver and livein.
+ (SESE_LIVEOUT, SESE_LIVEIN, SESE_LIVEIN_VER, SESE_NUM_VER): New.
+ (new_sese, free_sese, sese_build_livein_liveouts): Declared.
+ (struct scop): Added field liveout_renames.
+ (SCOP_LIVEOUT_RENAMES): New.
+
+2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/38409
+ * gcc.dg/graphite/pr38409.c: New.
+ * graphite.c (nb_reductions_in_loop): Use simple_iv.
+
+2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (gcc_type_for_cloog_iv): By default return
+ integer_type_node.
+ (graphite_create_new_loop): Don't fold_convert the already
+ fold_convert-ed expression.
+
+2008-12-11 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ PR tree-optimization/38446
+ * gcc.dg/graphite/pr38446.c: New.
+ * graphite.c (register_bb_in_sese): New.
+ (bb_in_sese_p): Check if bb belongs to sese region by explicitly
+ looking at the bbs in the region.
+ * graphite.h (sese): Add region_basic_blocks pointer set to
+ structure and initialize at the time of defining new scop.
+
+2008-12-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (new_graphite_bb): Initialize GBB_STATIC_SCHEDULE.
+ (find_params_in_bb): Do not free data refs.
+ (free_graphite_bb): Add FIXME on disabled free_data_refs.
+
+2008-12-11 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/scop-16.c: Test only scop specific info.
+ * testsuite/gcc.dg/graphite/scop-17.c: Same.
+ * testsuite/gcc.dg/graphite/block-5.c: New.
+ * testsuite/gcc.dg/graphite/block-6.c: New.
+ * testsuite/gcc.dg/graphite/pr37485.c: Clean dump file after.
+ * testsuite/gcc.dg/graphite/pr37684.c: Same.
+ * testsuite/gcc.dg/graphite/block-2.c: Same.
+
+ * graphite.c (struct ivtype_map_elt): New.
+ (debug_ivtype_elt, debug_ivtype_map_1, debug_ivtype_map,
+ new_ivtype_map_elt, ivtype_map_elt_info, eq_ivtype_map_elts,
+ gcc_type_for_cloog_iv): New.
+ (loop_iv_stack_patch_for_consts): Use the type of the induction
+ variable from the original loop, except for the automatically
+ generated loops, i.e., in the case of a strip-mined loop, in
+ which case there is no original loop: in that case just use
+ integer_type_node.
+ (new_graphite_bb): Initialize GBB_CLOOG_IV_TYPES.
+ (free_graphite_bb): Free GBB_CLOOG_IV_TYPES.
+ (clast_name_to_gcc): Accept params to be NULL.
+ (clast_to_gcc_expression): Take an extra parameter for the type.
+ Convert to that type all the expressions built by this function.
+ (gcc_type_for_clast_expr, gcc_type_for_clast_eq): New.
+ (graphite_translate_clast_equation): Compute the type of the
+ clast_equation before translating its LHS and RHS.
+ (clast_get_body_of_loop, gcc_type_for_iv_of_clast_loop): New.
+ (graphite_create_new_loop): Compute the type of the induction
+ variable before translating the lower and upper bounds and before
+ creating the induction variable.
+ (rename_variables_from_edge, rename_phis_end_scop): New.
+ (copy_bb_and_scalar_dependences): Call rename_phis_end_scop.
+ (sese_add_exit_phis_edge): Do not use integer_zero_node.
+ (find_cloog_iv_in_expr, compute_cloog_iv_types_1,
+ compute_cloog_iv_types): New.
+ (gloog): Call compute_cloog_iv_types before starting the
+ translation of the clast.
+
+ * graphite.h (struct graphite_bb): New field cloog_iv_types.
+ (GBB_CLOOG_IV_TYPES): New.
+ (debug_ivtype_map): Declared.
+ (oldiv_for_loop): New.
+
+2008-12-10 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ PR middle-end/38459
+ * graphite.c (new_scop): Initialize SCOP_ADD_PARAMS.
+ (param_index): Assert if parameter is not know after parameter
+ detection.
+ (find_params_in_bb): Detect params directly in GBB_CONDITIONS.
+ (find_scop_parameters): Mark, that we have finished parameter
+ detection.
+ (graphite_transform_loops): Move condition detection before parameter
+ detection.
+ * graphite.h (struct scop): Add SCOP_ADD_PARAMS.
+ * testsuite/gfortran.dg/graphite/pr38459.f90: New.
+
+2008-12-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_transform_loops): Always call find_transform ()
+ in ENABLE_CHECKING. So we test these code paths, even if we do not
+ generate code.
+
+2008-12-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb): Fix printing to file != dump_file.
+ (print_scop): Ditto.
+
+2008-12-08 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ PR middle-end/38084
+ Fix testsuite/gfortran.dg/graphite/id-3.f90.
+ * graphite.c (scopdet_basic_block_info): Fix bug that found some
+ regions more than once.
+
+2008-12-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ Fix testsuite/gfortran.dg/graphite/id-4.f90.
+ * graphite.c (scan_tree_for_params): Do not compute the multiplicand
+ when not needed.
+
+2008-12-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ Fix testsuite/gfortran.dg/graphite/id-1.f90.
+ * graphite.c (gmp_cst_to_tree): Pass the type in parameter.
+ (loop_iv_stack_patch_for_consts): Update use of gmp_cst_to_tree.
+ (max_precision_type): New.
+ (value_clast): Removed.
+ (clast_to_gcc_expression): Be more careful to types of expressions.
+ Use max_precision_type and update use of gmp_cst_to_tree.
+ (graphite_translate_clast_equation): Use max_precision_type.
+ (graphite_create_guard_cond_expr): Do not use integer_type_node,
+ use the type of the condition.
+ (graphite_create_new_loop): Do not use integer_type_node, use the
+ max_precision_type of lb and ub.
+
+2008-12-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_scops_1): Initialize open_scop.exit
+ and sinfo.last.
+
+2008-12-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/pr38084.c: New.
+ * testsuite/gfortran.dg/graphite/id-1.f90: New.
+ * testsuite/gfortran.dg/graphite/id-2.f90: New.
+ * testsuite/gfortran.dg/graphite/id-3.f90: New.
+ * testsuite/gfortran.dg/graphite/id-4.f90: New.
+ * testsuite/gfortran.dg/graphite/pr37857.f90: New.
+
+2008-12-02 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+ Harsha Jagasia <harsha.jagasia@amd.com>
+
+ PR middle-end/37852
+ PR middle-end/37883
+ PR middle-end/37928
+ PR middle-end/37980
+ PR middle-end/38038
+ PR middle-end/38039
+ PR middle-end/38073
+ PR middle-end/38083
+ PR middle-end/38125
+
+ * testsuite/gcc.dg/graphite/pr38073.c: New.
+ * testsuite/gcc.dg/graphite/pr37928.c: New.
+ * testsuite/gcc.dg/graphite/pr37883.c: New.
+ * testsuite/gcc.dg/graphite/pr38125.c: New.
+ * testsuite/gfortran.dg/graphite/pr38083.f90: New.
+ * testsuite/gfortran.dg/graphite/pr37852.f90: New.
+ * testsuite/gfortran.dg/graphite/pr37980.f90: New.
+
+ * testsuite/gcc.dg/graphite/scop-18.c: Remove reduction, test for
+ the number of detected scops. Copy exact same test for loop
+ blocking...
+ * testsuite/gcc.dg/graphite/block-1.c: Fix the number of expected
+ loops to be blocked as reductions are not handled.
+ * testsuite/gcc.dg/graphite/block-4.c: ...here. New.
+
+ * tree-phinodes.c (remove_phi_nodes): New, extracted from...
+ * tree-cfg.c (remove_phi_nodes_and_edges_for_unreachable_block):
+ ...here.
+ * tree-flow.h (remove_phi_nodes, canonicalize_loop_ivs): Declared.
+ * Makefile.in (graphite.o): Depend on value-prof.h.
+ (graphite.o-warn): Removed -Wno-error.
+ * tree-parloops.c (canonicalize_loop_ivs): Allow reduction_list
+ to be a NULL pointer. Call update_stmt. Return the newly created
+ cannonical induction variable.
+
+ * graphite.h (debug_rename_map): Declared. Fix some comments.
+
+ * graphite.c: Reimplement the code generation from graphite to gimple.
+ Include value-prof.h.
+ (loop_iv_stack_get_iv): Do not return NULL for constant substitutions.
+ (get_old_iv_from_ssa_name): Removed.
+ (graphite_stmt_p): New.
+ (new_graphite_bb): Test for useful statements before building a
+ graphite statement for the basic block.
+ (free_graphite_bb): Do not free GBB_DATA_REFS: this is a bug
+ in free_data_ref that calls BITMAP_FREE (DR_VOPS (dr)) without
+ reason.
+ (recompute_all_dominators, graphite_verify,
+ nb_reductions_in_loop, graphite_loop_normal_form): New.
+ (scop_record_loop): Call graphite_loop_normal_form.
+ (build_scop_loop_nests): Iterate over all the blocks of the
+ function instead of relying on the incomplete information from
+ SCOP_BBS. Return the success of the operation.
+ (find_params_in_bb): Use the data from GBB_DATA_REFS.
+ (add_bb_domains): Removed.
+ (build_loop_iteration_domains): Don't call add_bb_domains.
+ Add the iteration domain only to the basic blocks that have been
+ translated to graphite.
+ (build_scop_conditions_1): Add constraints only if the basic
+ block have been translated to graphite.
+ (build_scop_data_accesses): Completely disabled until data
+ dependence is correctly implemented.
+ (debug_rename_elt, debug_rename_map_1, debug_rename_map): New.
+ (remove_all_edges_1, remove_all_edges): Removed.
+ (get_new_name_from_old_name): New.
+ (graphite_rename_variables_in_stmt): Renamed
+ rename_variables_in_stmt. Call get_new_name_from_old_name.
+ Use replace_exp and update_stmt.
+ (is_old_iv): Renamed is_iv.
+ (expand_scalar_variables_stmt): Extra parameter for renaming map.
+ Use replace_exp and update_stmt.
+ (expand_scalar_variables_expr): Same. Use the map to get the
+ new names for the renaming of induction variables and for the
+ renaming of variables after a basic block has been copied.
+ (expand_scalar_variables): Same.
+ (graphite_rename_variables): Renamed rename_variables.
+ (move_phi_nodes): Removed.
+ (get_false_edge_from_guard_bb): New.
+ (build_iv_mapping): Do not insert the induction variable of a
+ loop in the renaming iv map if the basic block does not belong
+ to that loop.
+ (register_old_new_names, graphite_copy_stmts_from_block,
+ copy_bb_and_scalar_dependences): New.
+ (translate_clast): Heavily reimplemented: copy basic blocks,
+ do not move them. Finally, in call cleanup_tree_cfg in gloog.
+ At each translation step call graphite_verify ensuring the
+ consistency of the SSA, loops and dominators information.
+ (collect_virtual_phis, find_vdef_for_var_in_bb,
+ find_vdef_for_var_1, find_vdef_for_var,
+ patch_phis_for_virtual_defs): Removed huge hack.
+ (mark_old_loops, remove_dead_loops, skip_phi_defs,
+ collect_scop_exit_phi_args, patch_scop_exit_phi_args,
+ gbb_can_be_ignored, scop_remove_ignoreable_gbbs, ): Removed.
+ (remove_sese_region, ifsese, if_region_entry, if_region_exit,
+ if_region_get_condition_block, if_region_set_false_region,
+ create_if_region_on_edge, move_sese_in_condition, bb_in_sese_p,
+ sese_find_uses_to_rename_use, sese_find_uses_to_rename_bb,
+ sese_add_exit_phis_edge, sese_add_exit_phis_var,
+ rewrite_into_sese_closed_ssa): New.
+ (gloog): Remove dead code. Early return if code cannot be
+ generated. Call cleanup_tree_cfg once the scop has been code
+ generated.
+ (graphite_trans_scop_block, graphite_trans_loop_block): Do not
+ block loops with less than two loops.
+ (graphite_apply_transformations): Remove the call to
+ scop_remove_ignoreable_gbbs.
+ (limit_scops): When build_scop_loop_nests fails, continue on
+ the next scop. Fix open_scop.entry.
+ (graphite_transform_loops): Call recompute_all_dominators: force the
+ recomputation of correct CDI_DOMINATORS and CDI_POST_DOMINATORS.
+ Call initialize_original_copy_tables and free_original_copy_tables
+ to be able to copy basic blocks during code generation.
+ When build_scop_loop_nests fails, continue on next scop.
+ (value_clast): New union.
+ (clast_to_gcc_expression): Fix type cast warning.
+
+2008-11-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r140838:141727).
+
+2008-11-05 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ PR middle-end/37833
+
+ * graphite.c (scan_tree_for_params): Add POINTER_PLUS_EXPR.
+
+2008-11-05 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ PR middle-end/37943
+
+ * graphite.c (scopdet_basic_block_info): Fix loops with multiple
+ exits and conditions.
+ * testsuite/gcc.dg/graphite/pr37943.c: New.
+
+2008-10-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ PR middle-end/37886
+ * graphite.c (gloog): Replace EXIT_BLOCK_PTR with scop exit.
+
+2008-10-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * doc/invoke.texi: Fix spaces.
+
+2008-10-22 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR tree-optimization/37891
+ Reverted last commit.
+ * graphite.c (create_single_entry_edge): Set
+ EDGE_IRREDUCIBLE_LOOP and BB_IRREDUCIBLE_LOOP.
+
+2008-10-21 Sebastian Pop <sebastian.pop@amd.com>
+ Mitul Thakkar <mitul.thakkar@amd.com>
+
+ * graphite.c (create_single_entry_edge): Set
+ EDGE_IRREDUCIBLE_LOOP and BB_IRREDUCIBLE_LOOP.
+
+2008-10-16 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * doc/invoke.texi: Add -fgraphite-identity.
+ * graphite.c (graphite_apply_transformations): Check for
+ -fgraphite-identity.
+ * toplev.c (process_options): Add flag_graphite_identity.
+ * tree-ssa-loop.c: Add flag_graphite_identity.
+
+2008-10-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ Undo changes from 2008-10-02:
+ * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Convert
+ operand type when copying the operand to a variable of different type.
+ * cfgloopmanip.c (create_empty_loop_on_edge): Write exit condition
+ with the IV name after increment.
+
+2008-10-14 Sebastian Pop <sebastian.pop@amd.com>
+ Harsha Jagasia <harsha.jagasia@amd.com>
+
+ PR tree-optimization/37828
+ * testsuite/gcc.dg/graphite/pr37828.c: New.
+ * graphite.c (graphite_trans_loop_block): Do not loop block
+ single nested loops.
+
+2008-10-09 Harsha Jagasia <harsha.jagasia@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (struct rename_map_elt, new_rename_map_elt,
+ rename_map_elt_info, eq_rename_map_elts): New.
+ (graphite_rename_ivs_stmt): Renamed graphite_rename_variables_in_stmt.
+ (expand_scalar_variables_expr): Change parameters.
+ (expand_scalar_variables_stmt): Same.
+ (expand_scalar_variables): Same.
+ (graphite_rename_ivs): Rename graphite_rename_variables.
+ (build_iv_mapping): New.
+ (translate_clast): Call build_iv_mapping.
+ * graphite.h (gbb_p): New name.
+
+2008-10-03 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ PR tree-optimization/37684
+ * gcc.dg/graphite/pr37684.c: New.
+ * graphite.c (exclude_component_ref): New.
+ (is_simple_operand): Call exclude_component_ref.
+
+2008-10-02 Jan Sjodin <jan.sjodin@amd.com>
+ Harsha Jagasia <harsha.jagasia@amd.com>
+
+ PR tree-optimization/37485
+ * gcc.dg/graphite/block-2.c: New
+ * graphite.c (gmp_cst_to_tree): Moved.
+ (iv_stack_entry_is_constant): New.
+ (iv_stack_entry_is_iv): New.
+ (loop_iv_stack_push): Renamed to loop_iv_stack_push_iv.
+ (loop_iv_stack_insert_constant): New.
+ (loop_iv_stack_pop): Use new datatpype.
+ (loop_iv_stack_get_iv): Same.
+ (loop_iv_stack_get_iv_from_name): Same.
+ (loop_iv_stack_debug): Renamed to debug_loop_iv_stack.
+ (loop_iv_stack_patch_for_consts): New.
+ (loop_iv_stack_remove_constants): New.
+ (graphite_create_new_loop): Use loop_iv_stack_push_iv.
+ (translate_clast): Call loop_iv_stack_patch_for_consts and
+ loop_iv_stack_remove_constants.
+ (gloog): Use new datatype. Redirect construction edge to end
+ block to avoid accidental deletion.
+ * graphite.h (enum iv_stack_entry_kind): New. Tag for data in
+ iv stack entry.
+ (union iv_stack_entry_data): New. Data in iv stack entry.
+ (struct iv_stack_entry): New. Datatype for iv stack entries.
+
+2008-10-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Convert
+ operand type when copying the operand to a variable of different type.
+
+2008-10-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (create_empty_loop_on_edge): Write exit condition
+ with the IV name after increment.
+
+2008-10-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (r140164:140838).
+
+2008-09-10 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite-data-ref.c: New.
+ * graphite.c (print_scop): Also dump the dependence graph.
+ (bb_in_scop_p, loop_in_scop_p, nb_loops_around_gb): Moved...
+ (new_scop): Initialize SCOP_DEP_GRAPH.
+ (build_scop_dynamic_schedules): New.
+ (build_access_matrix_with_af): Fixed column numbering.
+ (graphite_transform_loops): Call build_scop_dynamic_schedules.
+ * graphite.h: Add ifndef/define guards against multiple inclusion.
+ (struct scop): Add dep_graph field.
+ (SCOP_DEP_GRAPH): Defined.
+ (ref_nb_loops): Fixed and moved to other position.
+ (bb_in_scop_p, loop_in_scop_p, nb_loops_around_gb): ... here.
+ (nb_loops_around_loop_in_scop): New.
+ (graphite_dump_dependence_graph): Declared.
+ (graphite_build_rdg_all_levels): Declared.
+ (graphite_test_dependence): Declared.
+ * Makefile.in (graphite-data-ref.o): New target.
+
+2008-09-09 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (139870:140164).
+
+2008-09-01 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (138275:139870).
+ * testsuite/gcc.dg/graphite/scop-matmult.c: XFailed as one of
+ the commits from trunk broke the niter detection.
+
+2008-09-01 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Add more documentation. Fix formatting.
+ (debug_loop_vec, debug_oldivs, loop_iv_stack,
+ loop_iv_stack_debug): Moved...
+ (schedule_to_scattering): Move before use.
+ (dot_all_scops): Include in "#if 0" the code for system
+ call dotty.
+
+ * graphite.h: (debug_loop_vec, debug_oldivs, loop_iv_stack,
+ loop_iv_stack_debug): ...here.
+
+2008-08-29 Jan Sjodin <jan.sjodin@amd.com>
+
+ * tree-phinodes.c (make_phi_node): Extern.
+ (add_phi_node_to_bb): New.
+ (create_phi_node): Call add_phi_node_to_bb.
+ * tree-ssa-loop-ivopts.c (get_phi_with_result): New.
+ (remove_statement): Handle case where stored phi was updated
+ and is no longer the same.
+ * graphite.c (is_parameter): New.
+ (is_old_iv): New.
+ (expand_scalar_variables_expr): New.
+ (expand_scalar_variables_stmt): New.
+ (expand_scalar_variables): New.
+ (move_phi_nodes): Create new phi instead of moving old one.
+ (translate_clast): Call expand_scalar_variables.
+ (find_vdef_for_var_in_bb): Also scan regular definitions.
+ (skip_phi_defs): New.
+ (collect_scop_exit_phi_args): New.
+ (patch_scop_exit_phi_args): New.
+ (gloog): Patch phis after scop.
+ * tree-flow.h: (add_phi_node_to_bb): Declared.
+ (make_phi_node): Declared.
+
+2008-08-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (end_scop): Split the entry of the scop when it
+ is the header of the loop in which the scop is ending.
+ (build_scops_1, limit_scops): Update uses of end_scop.
+
+2008-08-26 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (dot_all_scops_1): Do not fail on uninitialized
+ SCOP_ENTRY or SCOP_EXIT.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (get_construction_edge): Removed.
+ (gloog): Construction edge is the scop entry edge.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (can_generate_for_scop): Removed.
+ (gloog): Do not call it.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (new_scop): Entry of a scop is an edge.
+ Initialize SESE region.
+ (free_scop): Free SESE region.
+ (build_scops_1, scopdet_bb_info): Work on edges, not on bbs.
+ (split_difficult_bb): New, split from end_scop.
+ (end_scop): Exit of a scop is an edge.
+ (build_scop_bbs): Never check CDI_POST_DOMINATORS: this info is
+ not automatically updated and thus is always wrong.
+ * graphite.h (struct sese): New.
+ (SESE_ENTRY): New.
+ (SESE_EXIT): New.
+ (struct scop): New field for a SESE region. Remove entry, exit.
+ (SCOP_ENTRY, SCOP_EXIT): Update definitions to match same
+ semantics as before. Moved comment around.
+
+2008-08-25 Tobias Grosser <grosser@fim.uni-passau.de>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_transform_loops): Always enable gloog
+ and find_transform when ENABLE_CHECKING.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_transform_loops): Move pretty printer
+ of SCOPs before doing any transform. Remove call to print_scops
+ and dot_all_scops_1.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (dump_gbb_conditions): Don't try to print NULL pointers.
+ (print_graphite_bb): Same.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (dot_all_scops_1): Cleanup.
+ (move_scops): Fix comment.
+
+2008-08-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_scop_bbs): Revert commit 139355:
+
+ 2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * graphite.c (build_scop_bbs): Factor up code.
+
+2008-08-25 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (gloog): Update dominator info.
+
+2008-08-25 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (remove_cond_exprs): Do not fail on empty bbs.
+
+2008-08-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (new_graphite_bb): Remove GBB_INDEX_TO_NUM_MAP
+ initialization.
+ (free_graphite_bb): Remove GBB_INDEX_TO_NUM_MAP free.
+ (translate_clast): Correct formatting.
+ * graphite.h (struct num_map): Removed.
+ (struct graphite_bb): Remove num_map field.
+ (GBB_INDEX_TO_NUM_MAP): Removed.
+
+2008-08-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_access_matrix_with_af): Fix comments.
+ (build_scop_data_accesses): Same.
+
+2008-08-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_scop_data_accesses): Don't construct
+ access matrices. Add a FIXME and an assert condition that
+ should pass when the access matrices will be needed.
+
+2008-08-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-data-ref.c (stmt_simple_memref_p): Don't call
+ really_constant_p.
+ * graphite.c (build_graphite_bb): Renamed new_graphite_bb.
+ Moved close by free_graphite_bb.
+ (free_graphite_bb): Call free_data_refs. Reset bb->aux.
+ (new_scop): Move close by free_scop.
+ (graphite_transform_loops): Avoid linear scan to reset bb->aux.
+
+2008-08-22 Jan Sjodin <jan.sjodin@amd.com>
+
+ * cfgloopmanip.c (create_empty_if_region_on_edge): New.
+ * graphite.c (clast_to_gcc_expression): Call gmp_cst_to_tree
+ instead of recursive call.
+ (graphite_translate_clast_equation): New.
+ (graphite_create_guard_cond_expr): New.
+ (graphite_create_new_guard): New.
+ (get_stack_index_from_iv): Removed.
+ (graphite_rename_ivs_stmt): Use gbb_loop_index.
+ (get_true_edge_from_guard_bb): New.
+ (translate_clast): Handle stmt_guard in clast.
+ (get_construction_edge): Allow construction edge detection for
+ a scope entry with multiple predecessors if one predecessor is
+ the immediate dominator of scope entry.
+ (can_generate_code_stmt): Enable code generation for clast_guard.
+ (gloog): Use correct context loop. Removed check for post dominators.
+ * cfgloop.h (create_empty_if_region_on_edge): Declared.
+
+2008-08-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (remove_dead_loops): Document better which
+ loops are removed.
+
+2008-08-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in: Rename POLYLIBLIBS and POLYLIBINC to PPLLIBS
+ and PPLINC.
+ (graphite.o): Also depends on pointer-set.h.
+
+2008-08-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scop_record_loop): Fix compile warning.
+
+2008-08-21 Harsha Jagasia <harsha.jagasia@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scop_record_loop): DECL_NAME can be NULL.
+
+2008-08-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_graphite_bb): Initialize bb->aux to
+ point to the graphite_bb_p.
+ (graphite_bb_from_bb): Renamed gbb_from_bb; returns the
+ content of bb->aux.
+ (add_bb_domains): Does not use the scop parameter.
+ (graphite_transform_loops): Clean bb->aux at the end.
+
+2008-08-20 Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/lib/target-supports.exp
+ (check_effective_target_fgraphite): New.
+
+ * testsuite/gcc.dg/graphite/graphite.exp: Early exit when
+ check_effective_target_fgraphite returns false.
+ Set dg-do-what-default to compile.
+ (scan-graphite-dump-times): Removed.
+ * testsuite/gfortran.dg/graphite/graphite.exp: Same.
+
+ * testsuite/gcc.dg/graphite/scop-0.c: Do not use "dg-do compile".
+ Use scan-tree-dump-times instead of scan-graphite-dump-times.
+ * testsuite/gcc.dg/graphite/scop-1.c: Same.
+ * testsuite/gcc.dg/graphite/scop-2.c: Same.
+ * testsuite/gcc.dg/graphite/scop-3.c: Same.
+ * testsuite/gcc.dg/graphite/scop-4.c: Same.
+ * testsuite/gcc.dg/graphite/scop-5.c: Same.
+ * testsuite/gcc.dg/graphite/scop-6.c: Same.
+ * testsuite/gcc.dg/graphite/scop-7.c: Same.
+ * testsuite/gcc.dg/graphite/scop-8.c: Same.
+ * testsuite/gcc.dg/graphite/scop-9.c: Same.
+ * testsuite/gcc.dg/graphite/scop-10.c: Same.
+ * testsuite/gcc.dg/graphite/scop-11.c: Same.
+ * testsuite/gcc.dg/graphite/scop-12.c: Same.
+ * testsuite/gcc.dg/graphite/scop-13.c: Same.
+ * testsuite/gcc.dg/graphite/scop-matmult.c: Same.
+ * testsuite/gcc.dg/graphite/scop-14.c: Same.
+ * testsuite/gcc.dg/graphite/scop-15.c: Same.
+ * testsuite/gcc.dg/graphite/block-0.c: Same.
+ * testsuite/gcc.dg/graphite/scop-16.c: Same.
+ * testsuite/gcc.dg/graphite/block-1.c: Same.
+ * testsuite/gcc.dg/graphite/scop-17.c: Same.
+ * testsuite/gcc.dg/graphite/scop-18.c: Same.
+ * testsuite/gfortran.dg/graphite/block-1.f90: Same.
+ * testsuite/gfortran.dg/graphite/scop-1.f: Same.
+ * testsuite/gfortran.dg/graphite/block-2.f: Same.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Fix some XXX comments.
+ (build_scop_dynamic_schedules): Removed.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.h (scop_max_loop_depth): Moved...
+ * graphite.c (scop_max_loop_depth): ...here.
+ (remove_all_edges_1): New.
+ (remove_all_edges): Factored code.
+ (remove_cond_exprs): Check only the last statement for
+ a GIMPLE_COND expression.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scan_tree_for_params): Early return when the
+ expression is a chrec_dont_know. Handle case NEGATE_EXPR.
+ (find_scop_parameters): Factor out code.
+ (graphite_trans_bb_strip_mine): Remove dead code.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (clast_to_gcc_expression, graphite_create_new_loop,
+ graphite_trans_bb_move_loop): Factor asserts.
+ (gloog): Perform sanity checks only for ENABLE_CHECKING.
+ Do not call calculate_dominance_info and estimate_bb_frequencies.
+
+2008-08-20 Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (create_loops_mapping, free_loops_mapping,
+ create_loops_mapping_num, debug_loop_mapping_1,
+ debug_loop_mapping, graphite_loops_mapping_max_loop_num,
+ get_loop_mapping_for_num, graphite_loops_mapping_add_child,
+ graphite_loops_mapping_add_child_num,
+ graphite_loops_mapping_insert_child,
+ graphite_loops_mapping_parent, get_loop_mapped_depth_for_num,
+ get_loop_mapped_depth, split_loop_mapped_depth_for_num,
+ loop_mapped_depth_split_loop, swap_loop_mapped_depth_for_num,
+ create_num_from_index, get_num_from_index,
+ swap_loop_mapped_depth): Removed.
+ (new_scop): Do not initialize SCOP_LOOPS_MAPPING.
+ (free_scop): Do not call free_loops_mapping.
+ (graphite_get_new_iv_stack_index_from_old_iv): Renamed
+ get_stack_index_from_iv. Use GBB_LOOPS instead of calling
+ get_loop_mapped_depth.
+ (graphite_trans_bb_move_loop): Do not update the loop mapping.
+ (graphite_trans_bb_strip_mine): Same.
+ * graphite.h (graphite_loops_mapping, graphite_loop_node): Removed.
+ (struct scop): Remove field loops_mapping.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * graphite.c (scop_record_loop): Factor out one level of the
+ condition by early return.
+ (build_scop_loop_nests): Format following FSF coding style.
+ (build_scop_dynamic_schedules): Factor out code.
+ (scopdet_bb_info): Reindent. Default case should not be reachable.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * graphite.c (loop_affine_expr): Check for DECL_P or struct
+ assignments that are not handled as simple operands for now.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * graphite.c (build_scop_bbs): Factor up code.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * graphite.c (stmt_simple_for_scop_p): Factor code out
+ of the loop.
+ (enum gbb_type): New. Group all the GBB_* types under it.
+ (is_loop_exit): Moved...
+ (end_scop): Enable BB spliting.
+ * cfgloop.c (is_loop_exit): ...here. Reimplemented.
+ * cfgloop.h (is_loop_exit): Declared.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * doc/invoke.texi: Remove strides from examples containing
+ DO loops when the strides are equal to 1.
+
+2008-08-20 Harsha Jagasia <harsha.jagasia@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * graphite.c (graphite_trans_scop_block): Or the result with
+ the result from graphite_trans_loop_block.
+ * testsuite/gcc.dg/graphite/block-1.c: New.
+ * testsuite/gfortran.dg/graphite/block-1.f90: New.
+ * testsuite/gfortran.dg/graphite/block-2.f: New.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (graphite_transform_loops): Call cloog_initialize
+ and cloog_finalize.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-data-ref.c) (stmt_simple_memref_p): New.
+ * tree-data-ref.h (stmt_simple_memref_p): Declared.
+ * graphite.c (stmt_simple_memref_for_scop_p): Removed.
+ (is_simple_operand): Call stmt_simple_memref_p.
+
+ * testsuite/gcc.dg/graphite/scop-matmult.c: Updated for not
+ using pointer arithmetic, as this is optimized by PRE and
+ makes the code too difficult to analyze.
+
+ * testsuite/gcc.dg/graphite/scop-18.c: Same.
+
+2008-08-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gdbinit.in (pgg): New.
+
+2008-08-15 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_trans_loop_block): Fix warning.
+
+2008-08-15 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_trans_loop_block): Fix my merge error.
+
+2008-08-15 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_trans_bb_block): Remove check for
+ flag_loop_strip_mine, flag_loop_block, flag_loop_interchange.
+ Check if loop blocking is profitable for every loop, before applying
+ the changes.
+ (graphite_apply_transformations): Call graphite_trans_bb_block only,
+ if flag_loop_block is set.
+
+2008-08-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Add some more documentation for the loop
+ mapping.
+
+2008-08-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (tree-data-ref.o): Remove dependence on graphite.h.
+ * graphite.c: Format on less than 80 columns.
+ * graphite.h: Same.
+
+2008-08-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (loopify): Use update_dominators_in_loop.
+
+2008-08-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * doc/invoke.texi (floop-block, floop-strip-mine,
+ floop-interchange): Update documentation with examples.
+
+2008-08-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (create_empty_loop_on_edge): Don't call
+ add_referenced_var.
+ * graphite.c (graphite_create_new_loop): Call add_referenced_var.
+
+2008-08-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (create_empty_loop_on_edge): Improve documentation.
+ Factor gcc_asserts into a single one. Use force_gimple_operand_gsi.
+ * tree-scalar-evolution.c: Revert useless changes.
+ * tree-phinodes.c: Same.
+ * cfghooks.c: Same.
+ * vec.h: Same.
+ * tree-vectorizer.h: Same.
+ * tree-flow.h: Same.
+ * tree-cfg.c: Same.
+ * common.opt (fgraphite): Update documentation.
+
+2008-08-12 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ * doc/invoke.texi (-floop-block, -floop-strip-mine,
+ -floop-interchange): Add more text for explaining what each of these
+ flags is doing.
+ * tree-into-ssa.c (gimple_vec): Moved to...
+ * graphite.c: Include gimple.h.
+ (gimple_vec): Moved to...
+ (del_loop_to_cloog_loop): Removed.
+ (loop_affine_expr): Do not call create_data_ref when the
+ operand is a constant.
+ (new_scop): Use free instead of del_loop_to_cloog_loop.
+ * Makefile.in (graphite.o): Depend on GIMPLE_H.
+ * gimple.h (gimple_vec): ... here.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scopdet_bb_info): Only allow loops with known number of
+ latch executions.
+ (build_loop_iteration_domains): Fail, if latch executions unknown.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (add_conditions_to_domain): New.
+ (build_scop_conditions_1): Call add_conditions_to_domain.
+ (set_cloog_options): Allow to disable optimizations.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (find_params_in_bb): Look for parameters in conditions.
+ Do not use walk_dominator_tree.
+ (find_scop_parameters): Do not use walk_dominator_tree.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scan_tree_for_params) Add / Subtract inequality.
+ (idx_record_params): Adapt.
+ * graphite.h (scop_gimple_loop_depth): New.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_scop_dynamic_schedules): Remove value_init.
+ (scan_tree_for_params): Remove value_init.
+ (build_scop_context): Remove value_init.
+ (build_loop_iteration_domains): Remove value_init.
+ (schedule_to_scattering): Remove value_init.
+ (graphite_trans_bb_strip_mine): Remove value_init.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * gcc/graphite.c (limit_scops): New.
+ (graphite_transform_loops): Add limit SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-0.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-1.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-10.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-11.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-12.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-13.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-14.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-15.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-16.c: Update number of SCoPs.
+ Change loop numbers.
+ * gcc/testsuite/gcc.dg/graphite/scop-17.c: Update number of SCoPs.
+ Change loop numbers.
+ * gcc/testsuite/gcc.dg/graphite/scop-18.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-2.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-3.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-4.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-5.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-6.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-7.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-8.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-9.c: Update number of SCoPs.
+ * gcc/testsuite/gcc.dg/graphite/scop-matmult.c: Update number of SCoPs.
+
+2008-08-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_transform_loops): Call always find_transform.
+
+2008-08-08 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (free_loops_mapping): New.
+ (stmt_simple_for_scop_p): Fix typo.
+ (stmt_simple_for_scop_p): Fix tuples functions, that
+ broke polyhedron.
+ (free_graphite_bb): Fix some memleaks.
+ (free_scop): Fix some memleaks.
+ (scopdet_bb_info): Do not forget some tmp SCoPs.
+ (find_params_in_bb): Fix some memleaks.
+ (clast_to_gcc_expression): Fix warning.
+
+2008-08-07 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * testsuite/gcc.dg/graphite/scop-16.c: Fix for 32bit.
+ * testsuite/gcc.dg/graphite/scop-17.c: Fix for 32bit.
+
+2008-08-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-ssa-loop.c (tree-ssa-loop.o): Do not include toplev.h.
+ Move code ifdef-ed HAVE_cloog...
+ * graphite.c: Include toplev.h.
+ ... here.
+ * Makefile.in (OBJS-common): Always build graphite.o.
+ (BACKEND): Remove @GRAPHITE@.
+ (tree-ssa-loop.o): Do not depend on TOPLEV_H.
+ (graphite.o): Depend on TOPLEV_H.
+
+2008-08-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Makefile.in (tree-ssa-loop.o): Depend on TOPLEV_H.
+ Remove typo left from polylib to ppl conversion.
+ * graphite.c (graphite_transforms): Use sorry instead of fatal.
+
+2008-08-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * toplev.c (process_options): Move the graphite loop optimization
+ flags...
+ * tree-ssa-loop.c (graphite_transforms): ... here.
+ When not configured with CLooG, print to dump_file that
+ Graphite transforms were not performed.
+ * testsuite/gcc.dg/graphite/graphite.exp (scan-graphite-dump-times):
+ New.
+ * testsuite/gcc.dg/graphite/*.c: Updated all testcases to use
+ scan-graphite-dump-times.
+
+2008-08-03 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (dot_scop, dot_all_scops): Do not call system.
+ Do not open /tmp/scop.dot and /tmp/allscops.dot.
+
+2008-08-02 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * configure: Regenerated.
+ * omp-low.c (expand_omp_sections): Remove now unused code.
+ * config.in (HAVE_polylib): Removed.
+ * configure.ac (HAVE_polylib, POLYLIBLIBS, POLYLIBINC): Removed.
+ (PPLLIBS, PPLINC): Added.
+ * graphite.c: Replace unsigned with int wherever possible.
+ Don't access Cloog's data structures, but use accessor functions.
+ Clast's stmt->type is now implemented as a vtable: change the
+ switches of stmt->type into ifs.
+ (polylib/polylibgmp.h): Don't include.
+ (initialize_dependence_polyhedron,
+ initialize_data_dependence_polyhedron, is_empty_polyhedron,
+ statement_precedes_p, test_dependence, build_rdg_all_levels,
+ dump_dependence_graph): Removed until this code is cleaned up
+ or ported to Cloog.
+ * Makefile.in (POLYLIBLIBS): Renamed PPLLIBS.
+ (POLYLIBINC): Renamed PPLINC.
+
+2008-08-01 Harsha Jagasia <harsha.jagasia@amd.com>
+ Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ Finish the merge and tuplification of graphite.
+
+2008-07-24 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ Partial merge from mainline (138072:138275).
+ * graphite.c still has to be tuplified.
+
+2008-07-29 Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (graphite_loops_mapping_max_loop_num): New.
+ (create_num_from_index): New.
+ (get_num_from_index): Also pass in the graphite BB.
+ (free_graphite_bb): Free GBB_INDEX_TO_NUM_MAP.
+ (build_graphite_bb): Initialize GBB_INDEX_TO_NUM_MAP.
+ (graphite_trans_bb_strip_mine): Call create_num_from_index.
+ (is_interchange_valid): Return false when failing.
+ * graphite.h (struct num_map): New.
+ (struct graphite_bb): New field num_map.
+ (GBB_LOOPS_MAPPING): Renamed GBB_INDEX_TO_NUM_MAP.
+
+2008-07-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (dump_gbb_conditions): Print also conditions like
+ "if (a)". Remove dublicated code and use print_generic_expr ().
+ (stmt_simple_for_scop_p): Only allow conditions we can handle
+ {<, <=, >, >=}.
+
+2008-07-25 Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.h (struct scop): Removed new_ivs field.
+ (SCOP_NEWIVS): Deleted.
+ * graphite.c (new_scop, free_scop, clast_name_to_gcc,
+ clast_to_gcc_expression, graphite_create_new_loop):
+ Removed use of new_ivs.
+
+2008-07-25 Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (debug_oldivs, debug_loop_vec, create_loops_mapping,
+ create_loops_mapping_num, debug_loop_mapping_1): New.
+ (debug_loop_mapping): Call debug_loop_mapping_1.
+ (get_loop_mapping_for_num,
+ graphite_loops_mapping_add_child,
+ graphite_loops_mapping_add_child_num,
+ graphite_loops_mapping_insert_child,
+ graphite_loops_mapping_parent,
+ split_loop_mapped_depth_for_num,
+ loop_mapped_depth_split_loop): New.
+ (increment_loop_mapped_depths): Removed.
+ (swap_loop_mapped_depth_for_num): Reimplemented.
+ (new_scop): Call create_loops_mapping.
+ (scop_record_loop): Call graphite_loops_mapping_insert_child.
+ (translate_clast): Pass the old loop father in parameter, and pass
+ it to get_old_iv_from_ssa_name.
+ (remove_edges_around_useless_blocks, can_generate_code_stmt,
+ can_generate_code, can_generate_for_scop): New.
+ (graphite_trans_bb_block): Returns false when it fails to transform.
+ * graphite.h (graphite_loop_node, graphite_loops_mapping): New.
+
+2008-07-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ Reverted all the changes related to the streamization and
+ loop fusion.
+ These changes are now tracked in the streamization branch.
+
+2008-07-25 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (gbb_compare): Correctly constify.
+ (gbb_can_be_ignored): Indent.
+ (graphite_trans_scop_swap_1and2): Add legality check.
+ Remove dead FIXMEs.
+
+2008-07-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ Remove fallouts from "Reverted the Condate changes".
+ * tree.h: Remove unused decl.
+ * testsuite/gcc.dg/tree-checker: Same.
+ * timevar.def: Remove counter.
+
+2008-07-24 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (135673:138072).
+
+ Reverted the MIRO changes (from 2008-04-05) that are now
+ tracked in the miro branch.
+ * tree-bounds.c: Removed.
+ * tree-bounds.h: Removed.
+
+ Reverted the Condate changes (from 2006-07-04, 2007-03-20) that
+ are now tracked in the condate branch.
+ * tree-check.c: Removed.
+ * tree-match.c: Removed.
+ * condate.y: Removed.
+
+2008-07-24 Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+
+ * common.opt: New user flag -floop-block, -floop-strip-mine
+ and -floop-interchange.
+ * toplev.c (process_options): Enable -fgraphite pass if any one of the
+ graphite loop optimization flags is turned on.
+ * graphite.c (graphite_apply_transformations): Add flag_loop_block,
+ flag_loop_strip_mine and flag_loop_interchange checks before
+ optimizations.
+ * doc/invoke.texi: Remove -fgraphite and add -floop-block,
+ -floop-strip-mine and -floop-interchange.
+ * testsuite/gcc.dg/graphite/block-0.c: Add -floop-block and remove
+ -fgraphite.
+ * testsuite/gcc.dg/graphite/scop-16.c: Ditto.
+ * testsuite/gcc.dg/graphite/scop-17.c: Ditto.
+ * testsuite/gcc.dg/graphite/scop-18.c: Ditto.
+
+2008-07-23 Jan Sjodin <jan.sjodin@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c (update_dominators_in_loop): Make it static.
+ (create_empty_loop_on_edge): More fixes.
+ * tree-phinodes.c (resize_phi_node): Extern.
+ (unlink_phi_node, move_phi_node): New split from remove_phi_node.
+ * cfghooks.c (update_dominator_information): New split from
+ split_edge.
+ * tree-vectorizer.c (rename_variables_in_bb): Extern.
+ * tree-dfa.c (collect_dfa_stats): Start walking the CFG on the
+ successor of the function entry block.
+
+ * graphite.c: Include pointer-set.h.
+ (debug_loop_mapping, increment_loop_mapped_depths,
+ get_loop_mapped_depth_for_num, get_loop_mapped_depth,
+ set_loop_mapped_depth_for_num, set_loop_mapped_depth,
+ swap_loop_mapped_depth_for_num, get_num_from_index,
+ swap_loop_mapped_depth, loop_iv_stack_debug,
+ loop_iv_stack_push, loop_iv_stack_pop, loop_iv_stack_get_iv,
+ loop_iv_stack_get_iv_from_name, loop_iv_stack_debug,
+ get_old_iv_from_ssa_name): New.
+ (new_scop): Initialize SCOP_LOOPS_MAPPING.
+ (free_scop): Free SCOP_LOOPS_MAPPING.
+ (scop_record_loop): Record old ivs.
+ (create_var_name): Removed.
+ (initialize_cloog_names): Allocate double space in case strip mine
+ applies to all loops once.
+ (clast_name_to_gcc): Look up in the map ivstack passed in parameter.
+ (clast_to_gcc_expression): Same. Implement more clast to gimple
+ translation.
+ (graphite_create_new_loop): Pass in ivstack.
+ (remove_all_edges): Pass in the construction_edge.
+ (graphite_remove_iv): Removed.
+ (graphite_rename_ivs, graphite_rename_ivs_stmt,
+ remove_cond_exprs): Rewritten.
+ (move_phi_nodes): New.
+ (disconnect_virtual_phi_nodes, disconnect_cond_expr): Removed.
+ (translate_clast): Pass in ivstack. Rewrite some cases.
+ (set_cloog_options, debug_clast_stmt): New.
+ (find_transform): Use set_cloog_options.
+ (outermost_loop_layer): Removed.
+ (get_construction_edge, collect_virtual_phis, find_vdef_for_var_in_bb,
+ find_vdef_for_var_1, find_vdef_for_var, patch_phis_for_virtual_defs,
+ mark_old_loops, remove_dead_loops): New.
+ (gloog): Rewritten.
+ (graphite_trans_bb_move_loop): Call swap_loop_mapped_depth.
+ (const_column_index, get_first_matching_sign_row_index,
+ get_lower_bound_row, get_upper_bound_row, get_lower_bound,
+ get_upper_bound): New.
+ (graphite_trans_bb_strip_mine): Also update the iv map.
+
+ * graphite.h (graphite_loops_mapping, GBB_LOOPS_MAPPING): New.
+ (struct name_tree): Add a loop field.
+ (struct scop): Add a graphite_loops_mapping field.
+ (SCOP_LOOPS_MAPPING): New.
+ (debug_clast_stmt): Declare.
+ * lambda.h (find_induction_var_from_exit_cond): Declare.
+ (lambda-code.c): (find_induction_var_from_exit_cond): Extern.
+ * cfgloop.h (update_dominators_in_loop): Removed declaration.
+ (create_empty_loop_on_edge): Updated.
+ * tree-flow.h (remove_bb, resize_phi_node, move_phi_node,
+ rename_variables_in_bb): Declare.
+ * tree-cfg.c (remove_bb): Extern.
+
+ * testsuite/gcc.dg/graphite/block-0.c: New.
+
+2008-07-21 Dwarakanath Rajagopal <dwarak.rajagopal@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (strip_mine_profitable_p): New.
+ (graphite_trans_bb_block): Disable strip mining if not profitable.
+
+ * testsuite/gcc.dg/graphite/scop-18.c: New.
+ * testsuite/gcc.dg/graphite/scop-17.c: Fixed.
+ * testsuite/gcc.dg/graphite/scop-16.c: Fixed.
+
+2008-07-17 Harsha Jagasia <harsha.jagasia@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (is_interchange_valid): New.
+ (graphite_trans_bb_block): Check loop nest of basic block for legality
+ of interchange.
+
+ * graphite.h (gbb_inner_most_loop_index, outer_most_loop_1,
+ outer_most_loop, gbb_outer_most_loop_index): New.
+
+ * tree-loop-linear.c (perfect_loop_nest_depth): Remove static.
+ * tree-flow.h (perfect_loop_nest_depth): Declare as extern.
+ * testsuite/gcc.dg/graphite/scop-16.c: New.
+ * testsuite/gcc.dg/graphite/scop-17.c: New.
+
+2008-07-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scop_remove_ignoreable_gbbs): Also update bitmap.
+ (graphite_trans_scop_block): Ignore SCoPs without bbs.
+
+2008-07-11 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (new_scop): Initialize SCOP_EXIT.
+ (scopdet_info): Add.
+ (scopdet_bb_info): Rename from is_bb_addable. Cleanup, bugfixes.
+ (build_scops_1): Cleanup, bugfixes.
+ (build_scops): Cleanup.
+
+ * testsuite/gcc.dg/graphite/scop-matmult.c: Remove duplicated code.
+ * testsuite/gcc.dg/graphite/scop-15.c: Add SCoP numbers.
+
+2008-07-10 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ * testsuite/gfortran.dg/graphite/scop-1.f: Update to reduced test case.
+
+ * testsuite/gfortran.dg/graphite/graphite.exp: Use
+ DEFAULT_GRAPHITE_FLAGS.
+
+ * testsuite/gcc.dg/graphite/scop-15.c: Update to reduced test case.
+
+2008-07-10 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ * graphite.c (scan_tree_for_params): Do not assert any more if
+ MULT_EXPR parameter is negative.
+
+ * testsuite/gfortran.dg/graphite/scop-1.f: New.
+
+ * testsuite/gfortran.dg/graphite/graphite.exp: New.
+
+ * testsuite/gcc.dg/graphite/scop-15.c: New.
+
+2008-07-10 Harsha Jagasia <harsha.jagasia@amd.com>
+
+ * graphite.c (is_bb_addable): Fix segfault in spec gzip and reformat.
+
+2008-07-10 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_trans_bb_swap_loops): Rename from
+ graphite_swap_loops.
+ (graphite_trans_bb_move_loop): New.
+ (graphite_trans_bb_strip_mine): Rename from graphite_strip_mine_loop.
+ (graphite_trans_bb_block): New.
+ (graphite_trans_loop_block): New.
+ (graphite_trans_scop_swap_1and2): Rename from
+ graphite_trans_swap_1and2.
+ (graphite_trans_scop_strip): Rename from graphite_trans_strip.
+ (graphite_trans_scop_block): New.
+ (graphite_apply_transformations): Rename from
+ graphite_transformations.
+
+ * testsuite/gcc.dg/graphite/scop-matmult.c: New.
+
+2008-07-10 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (gbb_compare): New.
+ (graphite_sort_gbbs): New.
+ (gbb_can_be_ignored): New.
+ (scop_remove_ignoreable_gbbs): New.
+ (graphite_transformations): Cleanup and add
+ scop_remove_ignoreable_gbbs.
+ * lambda.h (lambda_vector_compare): New.
+
+2008-07-09 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb): Correct printing of static schedule.
+ (graphite_swap_loops): int -> unsigned
+ (graphite_strip_mine_loop): int -> unsigned, Fix SCHEDULE
+ (graphite_transformations): New.
+ (graphite_transform_loops): Move to graphite_transformations.
+ * graphite.h (gbb_nb_loops): Return unsigned.
+
+2008-07-04 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scan_tree_for_params): Fix insertion of parameters into
+ the domain matrix. This makes scop-0.c work again.
+
+2008-06-20 Richard Guenther <rguenther@suse.de>
+
+ * graphite.h: Adjust copyright to GPLv3.
+ * graphite.c: Likewise.
+ (stmt_simple_memref_for_scop_p): Split out from ...
+ (stmt_simple_for_scop_p): ... here. Fix handling of calls
+ and simplify.
+ (get_bb_type): Optimize.
+ (is_pred): Remove.
+ (is_bb_addable): Fix memleak, replace is_pred call with
+ single_pred.
+ (build_scops): Use current_loops.
+ (param_index): Fix memleak.
+
+2008-06-20 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite.c: Fix formatting.
+
+2008-06-19 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite.c (new_scop): Memory allocation for SCOP_{NEWIVS, OLDIVS}.
+ (free_scop): Memory deallocation for SCOP_NEWIVS, SCOP_OLDIVS.
+ (create_var_name, save_var_name): Newly defined functions.
+ (initialize_cloog_names): Part of the code factored out to
+ save_var_name.
+ (clast_to_gcc_expression): Now handles the case of clast_red_sum
+ in clast_reduction statement.
+ (graphite_create_new_loop): Now takes a new parameter
+ for outer_loop.
+ (translate_clast): Now also takes the context_loop and bb_exit
+ parameters. Rewritten the code so that it creates a gimple code
+ inside the given context.
+ (outermost_loop_layer, graphite_remove_iv, graphite_rename_ivs,
+ remove_cond_expr, disconnect_cond_expr,
+ disconnect_virtual_phi_nodes): Newly defined functions.
+ * graphite.h (struct scop): added old_ivs vector.
+ SCOP_OLDIVS: New macro.
+
+2008-06-19 Sebastian Pop <sebastian.pop@amd.com>
+
+ * cfgloopmanip.c: Add missing function comments, fix formatting.
+
+2008-06-18 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * cfgloopmanip.c (update_dominators_in_loop): Defined.
+ (create_empty_loop_on_edge): Defined.
+ * tree-parloops.c (canonicalize_loop_ivs): Returns tree
+ instead of void.
+ * cfgloop.h (create_empty_loop_on_edge): Declared as extern.
+ (update_dominators_in_loop): Declared as extern
+ * tree-flow.h (canonicalize_loop_ivs): Declared as extern.
+
+2008-06-16 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb): Allow changing number of loops
+ in SCoP domain.
+ (initialize_cloog_names): Allow changing number of loops.
+ (build_cloog_prog): Simplify.
+ (find_transform): Enable cloog option --strides.
+ (graphite_swap_loops): New.
+ (graphite_strip_mine_loop): New.
+ (graphite_trans_swap_1and2): New.
+ (graphite_trans_strip): New.
+ (graphite_transform_loops): Add graphite_trans_strip.
+ * graphite.h (scop_max_loop_depth): New.
+
+2008-06-15 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_scop_iteration_domain): Remove forgotten
+ line. (Fixes compile)
+
+2008-06-15 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb): Add output of GBB_LOOPS.
+ (build_graphite_bb): Add GBB_LOOPS and GBB_DOMAIN and reorder.
+ (build_bb_loops): New.
+ (graphite_transform_loops): Add build_bb_loops.
+ (schedule_to_scattering): Use gbb_nb_loops to support changing loop
+ numbers.
+ * graphite.h (graphite_bb): Add loops.
+ (gbb_nb_loops): New.
+ (gbb_loop_at_index): New.
+ (gbb_loop_index): New.
+ (nb_params_in_scop): Renamed to scop_nb_params. Updated all functions
+ using nb_params_in_scop.
+
+2008-06-14 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb): Adapt to minimized schedule.
+ (build_scop_canonical_schedules): Build minimized schedule.
+ (schedule_to_scattering): Adapt to minimized schedule.
+ * graphite.h (graphite_bb): Add/Update descriptions.
+
+2008-06-14 Adrien Eliche <aeliche@isty.uvsq.fr>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb): Add condition printing.
+ (dump_value): New.
+ (dump_gbb_conditions): New.
+ (build_scop_conditions_1): New.
+ (build_scop_conditions): New.
+ * graphite.h (graphite_bb): Add conditions.
+
+2008-06-14 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (print_graphite_bb):
+ (free_graphite_bb): New.
+ (free_scop): Free bbs.
+ (get_bb_type): Free doms.
+ (build_scop_context): Free context matrix.
+ (build_loop_iteration_domains): Remove unused code.
+ (build_cloog_prog): Free scattering function and blocklist.
+ (find_transform): Free options.
+
+2008-06-13 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (loop_body_to_cloog_stmts): Rename to add_bb_domains.
+ Remove unnecessery cloog data structures. Make a copy of the domain
+ (setup_cloog_loop): Rename to build_loop_iteration_domains. Remove
+ unnecessary cloog data structures. Fix memory leaks. Remove insert
+ into SCOP_LOOP2CLOOG_LOOP as the inserted CloogLoops will never be
+ used.
+ (build_scop_iteration_domain): Remove unnecessary cloog
+ data structures. Fix memory leaks.
+ (graphite_transform_loops): Disable build_scop_dynamic_schedules as it
+ uses SCOP_LOOP2CLOOG_LOOP, that is at the moment not working.
+
+2008-06-12 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (find_scop_params): Remove initialize_cloog_names.
+
+2008-06-12 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (end_scop): Style fix.
+ (schedule_to_scattering): Style and comment fix.
+
+2008-06-12 Tobias Grosser <grosser@fim.uni-passau.de>
+ * graphite.c (print_graphite_bb): Fix definiton of
+ schedule_to_scattering.
+ (initialize_cloog_names): Change nb_scattdims to max loop
+ depth in SCoP.
+ (schedule_to_scattering): Take parameter for number of scattering
+ dimensions.
+ (build_cloog_prog): Only build as much scattering dimensions as
+ necessary.
+
+2008-06-12 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (end_scop): Disable bb splitting. Fixes SIGSEGV
+ in polyhedron/aermod.f90.
+
+2008-06-11 Tobias Grosser <grosser@fim.uni-passau.de>
+ Dwarak Rajagopal <dwarak.rajagopal@amd.com>
+ Harsha Jagasia <harsha.jagasia@amd.com>
+
+ * graphite.c (is_bb_addable): Fix segfault.
+
+2008-06-10 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (is_bb_addable): Fix memory leak, handling of loops
+ with multiple exits and conditional handling in edge cases.
+ (is_loop_exit): Fix memory leak. (Forgotten in last commit)
+
+ * testsuite/gcc.dg/graphite/scop-14.c: New.
+
+2008-06-06 Tobias Grosser <grosser@fim.uni-passau.de>
+ Adrien Eliche <aeliche@isty.uvsq.fr>
+
+ * graphite.c (is_bb_addable): Add more comments and enhance
+ readablity of the source code. Fix memory leak.
+ (is_loop_exit): Fix memory leak.
+
+2008-06-05 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (first_loop_in_scop): Deleted.
+ (setup_cloog_loop): Only walk the loop chain for inner loops.
+ (build_scop_iteration_domain): Execute setup_cloog_loop for
+ all loops in the first layer.
+
+2008-06-05 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scan_tree_for_params): Change the way params are
+ added to be indepenent of the number of loops.
+ (setup_cloog_loop): Revert to short matrix format. Fix parameter
+ handling.
+ (build_cloog_prog): Revert to short matrix format.
+
+2008-06-05 Sebastian Pop <sebastian.pop@amd.com>
+ Dwarak Rajagopal <dwarak.rajagopal@amd.com>
+
+ * tree-loop-fusion.c (fuse_loops): Fix uninitialized variable
+ warning.
+
+2008-06-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (nb_data_refs_in_scop): New.
+ (graphite_transform_loops): Print more stats: number of
+ loops, basic blocks and data references per scop.
+
+2008-06-04 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (loop_affine_expr, idx_record_params,
+ find_scop_parameters, setup_cloog_loop): Use instantiate_scev
+ instead of instantiate_parameters.
+
+2008-06-04 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (schedule_to_scattering): Fix scattering dimensions,
+ add support for parameters, add STATIC_SCHEDULE at the right places,
+ cleanup.
+
+2008-06-04 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_scop_loop_nests): Only add the loops, that
+ are contained completely in the SCoP.
+ (build_cloog_prog): Disable scattering, until schedule_to_scattering
+ and the domains are fixed.
+ (build_scop_canonical_schedules): Add support for bbs not contained
+ in any SCoP.
+
+2008-06-04 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.h (scop_contains_loop): Update comments to match
+ the actual behavior.
+ (scop_contains_loop): New.
+ * graphite.c (schedule_to_scattering): Use scop_contains_loop.
+
+2008-06-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (get_bb_type): On function body, i.e. loop_0,
+ don't mark blocks as GBB_LOOP_SING_EXIT_HEADER, mark them
+ as GBB_COND_HEADER.
+
+2008-06-04 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (graphite_transform_loops): Early return when
+ there are no loops in the function.
+
+2008-05-31 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (scan_tree_for_params, setup_cloog_loop): Compute the
+ offset of the last loop.
+ (setup_cloog_loop): Copy the entire outer constraint matrix.
+
+2008-05-31 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (stmt_in_scop_p, function_parameter_p,
+ invariant_in_scop_p): Removed.
+ (scan_tree_for_params): Can be used with no constraint
+ matrix for gathering parameters.
+ (idx_record_params): Don't use idx_record_param, instead use
+ scan_tree_for_params.
+ (find_scop_parameters): Same.
+ (setup_cloog_loop, build_scop_iteration_domain, build_cloog_prog):
+ Fix the size of loop domains.
+ (schedule_to_scattering): Exit when the outer loop is not in scop.
+ (find_transform): Enable build_cloog_prog.
+
+2008-05-31 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (schedule_to_scattering): Make scattering domains
+ uniformly of the same size, as required by CLooG 0.14.0 and before.
+
+2008-05-31 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (schedule_to_scattering): Rewrite, correct the
+ translation of the scheduling function to scattering.
+ (build_cloog_prog): Call schedule_to_scattering only once.
+ * graphite.h (scop_loop_index): Do not fail for loops not
+ in the scop: return -1.
+
+2008-05-30 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (build_graphite_bb): Initialize GBB_DOMAIN.
+ (loop_body_to_cloog_stmts): Export GBB_DOMAIN.
+ (setup_cloog_loop): Export GBB_DOMAIN.
+ (build_cloog_prog): New. Create new CLOOG_PROG, which should be
+ able to rebuild the original control flow.
+ * graphite.h (graphite_bb): Add domain field and access macro.
+ (GBB_DOMAIN): New.
+
+2008-05-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (debug_gbb): New.
+ (print_scop, build_graphite_bb): Use SCOP_BBS.
+ (build_scop_bbs): Reimplemented.
+ (dfs_bb_in_scop_p): Removed.
+ (build_scop_loop_nests): Reorder loops inserted in
+ SCOP_LOOP_NEST: outer loops should come first.
+ (build_scop_canonical_schedules): Reinitialize at zero
+ the components of the SCOP_STATIC_SCHEDULE for the loops
+ that have already been parsed.
+
+ * graphite.h (debug_gbb): Declared.
+
+2008-05-30 Sebastian Pop <sebastian.pop@amd.com>
+ Jan Sjodin <jan.sjodin@amd.com>
+
+ * graphite.c (create_empty_loop): Renamed graphite_create_new_loop.
+ (graphite_loop_to_gcc_loop): Removed.
+ (remove_all_edges): New.
+ (graphite_stmt_to_gcc_stmt): Renamed translate_clast.
+ (gloog): Remove useless code.
+
+2008-05-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (get_bb_type): Reworked. We distinguish between
+ loops with one or multiple exits.
+ (is_loop_exit): New.
+ (is_pred): New.
+ (is_bb_addable): Rework condition handling, now support for case
+ case statements and loops with multiple exits.
+
+ * testsuite/gcc.dg/graphite/scop-11.c: New.
+ * testsuite/gcc.dg/graphite/scop-12.c: New.
+ * testsuite/gcc.dg/graphite/scop-13.c: New.
+
+2008-05-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (dot_all_scops_1): Fix some colors. Reuse colors, if
+ we have too many colors.
+
+2008-05-22 Sandeep Maram <smaram_b04@iiita.ac.in>
+
+ * doc/invoke.texi (-ftree-loop-fusion): Document.
+ * tree-pass.h (pass_loop_fusion): Declared.
+ * tree-loop-fusion.c: New.
+ * timevar.def (TV_TREE_LOOP_FUSION): Declared.
+ * tree-data-ref.c (find_data_references_in_loop): Make extern.
+ * tree-data-ref.h (find_data_references_in_loop): Declared.
+ * common.opt (ftree-loop-fusion): Declared.
+ * Makefile.in (tree-loop-fusion.o): Added rule and to OBJS-common.
+
+2008-05-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_access_matrix): Fix typo from the merge.
+
+2008-05-20 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (130800:135673).
+
+2008-05-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (end_scop): The exit of the scop is not part of the scop.
+ Update dominators after splitting.
+
+2008-05-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (is_bb_addable): Return the harmful statement.
+ Factor up some code.
+ (end_scop): New. Splits end of scope bbs on a harmful statement.
+ (build_scops_1): Call end_scop.
+
+2008-05-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: (succs_at_same_depth, end_scop, all_preds_visited_p,
+ all_succs_visited_p, start_new_scop_for_each_succ, start_new_scop,
+ add_dominators_to_open_scops, stop_last_open_scop, scop_end_loop,
+ build_scops_1): Removed.
+ (build_scops_2): Renamed build_scops_1.
+
+2008-05-06 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Fix formatting.
+
+2008-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (get_bb_type): New.
+ (move_scops): New.
+ (build_scops_2): New.
+ (is_bb_addable): New.
+ (build_scops): Switch the scop detection.
+ (build_scop_bbs): Add entry bb to scop.
+ * graphite.h (struct scop): Update comment.
+
+2008-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (dot_all_scops_1): Fix some incorrect colors and add
+ more colors.
+
+2008-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * testsuite/gcc.dg/graphite/scop-1.c: Update.
+ * testsuite/gcc.dg/graphite/scop-2.c: Update.
+ * testsuite/gcc.dg/graphite/scop-4.c: Update.
+ * testsuite/gcc.dg/graphite/scop-5.c: Add.
+ * testsuite/gcc.dg/graphite/scop-6.c: Add.
+
+2008-05-06 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/scop-0.c: Add.
+ * testsuite/gcc.dg/graphite/scop-7.c: Add.
+ * testsuite/gcc.dg/graphite/scop-8.c: Add.
+ * testsuite/gcc.dg/graphite/scop-9.c: Add.
+ * testsuite/gcc.dg/graphite/scop-10.c: Add.
+
+2008-05-06 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (scop_affine_expr): Renamed to loop_affine_expr.
+ Check affine expressions depending on the outermost loop
+ instead of a scop.
+ (stmt_simple_for_scop_p): Same.
+ (harmfule_stmt_in_scop): Same.
+
+2008-04-28 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (dot_all_scops): Remove incorrect difficult bb coloring,
+ mark entry and exit, that are not part of the SCoP and update HTML
+ formatting.
+
+2008-04-25 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (basic_block_simple_for_scop_p): Renamed
+ harmful_stmt_in_bb.
+ (save_scop, preds_at_same_depth, test_for_scop_bound): Removed.
+ (add_dominators_to_open_scops, build_scops_1): Reimplemented.
+ (all_preds_visited_p, all_succs_visited_p,
+ start_new_scop_for_each_succ, start_new_scop, stop_last_open_scop,
+ scop_end_loop): New.
+ (build_scops): Do not use dfs_enumerate_from.
+
+ * testsuite/gcc.dg/graphite/scop-{1,2,4}.c: Updated.
+
+2008-04-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c: Add comments to functions that are missing a
+ description.
+ (graphite_create_iv): Removed. Merged in graphite_loop_to_gcc_loop.
+
+2008-04-23 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (nb_params_in_scop): Moved...
+ (graphite_bb_from_bb, loop_body_to_cloog_stmts): New.
+ (setup_cloog_loop): Call loop_body_to_cloog_stmts.
+ (clast_to_gcc_expression): Reduce column size to less than 80.
+ (graphite_create_iv): Return the new name of the IV.
+ (find_transform): Set options->esp and options->cpp.
+ (gloog): Comment out the invalidation of the old loop code.
+ (initialize_dependence_polyhedron): Replace scop_nb_params with
+ nb_params_in_scop.
+
+ * graphite.h (nb_params_in_scop): ... here.
+ (scop_nb_params): Removed.
+ (loop_domain_dim): Return something even when the loop was not
+ found in the hash table: avoid ICEing on all the graphite.exp
+ testcases.
+
+2008-04-14 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * tree-chrec.c (for_each_scev_op): SCEV can have 3 operands.
+
+ * graphite.c (build_scop_dynamic_schedules): Schedule is built
+ according to nesting level.
+ (find_scop_parameters): Call instantiate_parameters.
+ (scan_tree_for_params): Extend it to handle general affine bounds.
+ Inner loop bound can depend on outer loop induction variable.
+ (setup_cloog_loop): tmp variable is allocated on stack. Call
+ instantiate_parameters with respect to outermost_loop_in_scop.
+ (loop_domain_dim, ref_nb_loops, loop_iteration_vector_dim): moved to
+ graphite.h.
+ (create_empty_loop): Function loopify should be given edge
+ probability, instead of edge frequency. Dominance relation from
+ switch_bb to loop_header.
+ (clast_to_gcc_expression): Added handling of clast_reduction node.
+ (gloog): New functionality for removing old loop.
+ (test_dependence): Factored out from build_rdg_all_levels.
+ (build_rdg_all_levels): Dependence testing factored out to
+ test_dependence function.
+
+ * graphite.h (struct graphite_bb): Extended with dynamic_schedule.
+ (loop_domain_dim, ref_nb_loops, loop_iteration_vector_dim): Moved
+ from graphite.c
+
+2008-04-07 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (free_scop, param_index, initialize_cloog_names,
+ nb_params_in_scop): Use name_tree map instead of just a tree
+ for keeping track of the variable name associated to that tree.
+ (create_empty_loop, gmp_cst_to_tree, clast_name_to_gcc,
+ clast_to_gcc_expression, graphite_create_iv,
+ graphite_loop_to_gcc_loop, graphite_cond_to_gcc_cond,
+ graphite_stmt_to_gcc_stmt): New.
+ (gloog): Call these.
+ * graphite.h (struct name_tree): New.
+ (struct scop): Use name_tree instead of tree for params.
+ Store a vector of name_tree for new_ivs.
+ (SCOP_NEWIVS): New.
+ (scop_nb_params): Use name_tree instead of tree.
+
+2008-04-05 Alexander Lamaison <awl03@doc.ic.ac.uk>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-bounds.c: New.
+ * tree-bounds.h: New.
+ * tree-pass.h: Declare pass_bounds_early and pass_bounds_late.
+ * passes.c: Schedule pass_bounds_early, pass_bounds_late.
+ * builtins.c (expand_builtin_alloca): Add flag_bounds as for
+ flag_mudflap.
+ * gcc.c: Same.
+ * toplev.c: Same.
+ * c-cppbuiltin.c: Same.
+ * c-pragma.c: Same.
+ * common.opt: Same.
+ * varasm.c: Same.
+ * tree-outof-ssa.c: Same.
+ * c-common.c: Same.
+ * Makefile.in: Same.
+
+2008-03-15 Antoniu Pop <antoniu.pop@gmail.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-loop-distribution.c (remaining_stmts,
+ upstream_mem_writes): Removed static variables.
+ (copy_loop_before, create_bb_after_loop,
+ mark_nodes_having_upstream_mem_writes, free_rdg_components,
+ rdg_build_components, rdg_build_partitions,
+ dump_rdg_partitions): Extern.
+ (generate_loops_for_partition, generate_code_for_partition): Do not
+ return a bool.
+ (already_processed_vertex_p, predecessor_has_mem_write,
+ mark_nodes_having_upstream_mem_writes, has_upstream_mem_writes,
+ rdg_flag_all_uses, rdg_flag_uses, rdg_flag_vertex_and_dependent,
+ rdg_flag_loop_exits, rdg_flag_similar_memory_accesses,
+ build_rdg_partition_for_component, rdg_build_partitions, ldist_gen):
+ Pass remaining_stmts and upstream_mem_writes as parameters.
+ (rdg_component): Moved...
+ (build_rdg_partition_for_component): Do not aggregate components when
+ flag_streamize_loops is set.
+ (gen_sequential_loops): New.
+ (ldist_gen): Call gen_sequential_loops.
+
+ * tree-pass.h (pass_loop_streamization): Declared.
+
+ * omp-low.c (expand_omp_sections): Call add_bb_to_loop on created
+ basic blocks when loops structures exist.
+
+ * builtin-types.def (BT_FN_VOID_PTR_PTR_INT): New.
+
+ * tree-ssa-loop-ivopts.c (expr_invariant_in_region_p): New.
+
+ * tree-parloops.c (take_address_of, eliminate_local_variables_1,
+ eliminate_local_variables_stmt, eliminate_local_variables,
+ separate_decls_in_loop_name, separate_decls_in_loop_stmt,
+ separate_decls_in_loop, gen_parallel_loop): Make them work on a region
+ of code delimited by two edges in the CFG.
+ (separate_decls_in_loop_name): Renamed separate_decls_in_region_name.
+ (separate_decls_in_loop_stmt): Renamed separate_decls_in_region_stmt.
+ (separate_decls_in_loop): Renamed separate_decls_in_region. Isolate
+ the case of parallelisation of reductions.
+ (create_loop_fn): Extern.
+ (create_omp_parallel_region): New.
+
+ * tree-data-ref.c (dump_data_dependence_relation): Don't call
+ dump_data_reference for printing dra and drb.
+ (create_rdg_edge_for_ddr, create_rdg_edges_for_scalar): Initialise
+ RDGE_RELATION.
+ (build_rdg): Don't call free_dependence_relations for the moment, as
+ we attach dependence relations on each edge of the RDG.
+ To be fixed later.
+
+ * tree-data-ref.h (rdg_component): ...here.
+ (struct rdg_edge): New field ddr_p relation.
+ (RDGE_RELATION): New.
+ (create_bb_after_loop, copy_loop_before,
+ mark_nodes_having_upstream_mem_writes, rdg_build_components,
+ rdg_build_partitions, dump_rdg_partitions,
+ free_rdg_components): Declared.
+
+ * omp-builtins.def (BUILT_IN_GOMP_STREAM_ALIGN_PUSH,
+ BUILT_IN_GOMP_STREAM_ALIGN_POP): New.
+
+ * tree-loop-streamization.c: New.
+
+ * tree-flow.h (gather_blocks_in_sese_region, create_loop_fn,
+ create_omp_parallel_region, expr_invariant_in_region_p): Declared.
+
+ * Makefile.in (tree-loop-streamization.o): Added to OBJS-common.
+
+ * tree-cfg.c (gather_blocks_in_sese_region): Extern.
+
+ * passes.c: Schedule pass_loop_streamization.
+
+2008-03-08 Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (dot_all_scops_1): Fix formatting for difficult bbs and
+ update comment.
+
+2008-03-07 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (dot_all_scops): Update formatting.
+ Bbs can now be part of more than one SCoP.
+
+2008-03-04 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (new_loop_to_cloog_loop_str, setup_cloog_loop): Fix
+ malloc problems.
+ (loop_domain_dim): Check for unregistered toplev SCOP loop.
+ * graphite.h (loop_to_cloog_loop): New.
+
+2008-03-04 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite.c (loop_domain_dim, ref_nb_loops,
+ loop_iteration_vector_dim): New.
+ (build_access_matrix_with_af, build_access_matrix,
+ initialize_dependence_polyhedron): Fixed for new matrix layout.
+ No longer assume that all iteration domains are of the same
+ dimensionality.
+
+2008-03-02 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME
+ defined in a loop at depth 0 is invariant.
+ * tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
+ * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Should never
+ be called at loop depth 0.
+
+ * graphite.c (basic_block_simple_for_scop_p): Take the scop as
+ a parameter.
+ (dot_all_scops_1): Update use of basic_block_simple_for_scop_p.
+ (down_open_scop): Removed.
+ (loop_in_scop_p): Redefined.
+ (scop_affine_expr): New argument: scop.
+ (stmt_simple_for_scop_p): New argument: scop. RETURN_EXPR is not
+ a harmful statement ending a scop.
+ (basic_block_simple_for_scop_p): New argument: scop.
+ (get_loop_start): Removed.
+ (new_scop): Initialize SCOP_LOOPS.
+ (free_scop): Free SCOP_LOOPS.
+ (succs_at_same_depth, preds_at_same_depth): New.
+ (end_scop): Test the validity of a scop.
+ (add_dominators_to_open_scops): New.
+ (test_for_scop_bound): Call add_dominators_to_open_scops.
+ Add cases for opening and closing multiple scops.
+ (build_scops, build_scop_bbs): Iterate over basic blocks in
+ depth first order.
+ (build_graphite_bb): Pass scop directly.
+ (dfs_bb_in_scop_p): New.
+ (scop_record_loop): Use SCOP_LOOPS for not recording the same loop
+ several times.
+ (nb_loops_around_gb): Use loop_in_scop_p.
+ (schedule_to_scattering): Disabled for the moment the code computing
+ the "textual order for outer loop".
+
+ * graphite.h (struct scop): New field loops.
+ (SCOP_LOOPS): New.
+ (scop_loop_index): Test that the given loop belongs to SCOP_LOOPS.
+
+ * testsuite/gcc.dg/graphite/scop-{1,...,7}.c: Updated.
+
+2008-02-27 Antoniu Pop <antoniu.pop@gmail.com>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ * builtin-types.def (BT_FN_PTR_SIZE_UINT, BT_FN_BOOL_PTR): New.
+ * common.opt (fstreamize-loops): New.
+ * omp-builtins.def (BUILT_IN_GOMP_STREAM_CREATE,
+ BUILT_IN_GOMP_STREAM_PUSH, BUILT_IN_GOMP_STREAM_HEAD,
+ BUILT_IN_GOMP_STREAM_POP, BUILT_IN_GOMP_STREAM_EOS_P,
+ BUILT_IN_GOMP_STREAM_SET_EOS, BUILT_IN_GOMP_STREAM_DESTROY): New.
+
+2008-02-22 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * tree-data-ref.c (build_empty_rdg): New.
+ (build_rdg): Use it.
+ * tree-data-ref.h (build_empty_rdg): Declared.
+ * graphite.c (free_scop): Free SCOP_LOOP2CLOOG_LOOP.
+ (find_vertex_for_stmt): Removed.
+ (build_rdg_all_levels): Use build_empty_rdg and rdg_vertex_for_stmt.
+
+2008-02-21 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-loop-distribution.c (generate_builtin): After cancelling the
+ loop tree, also delete basic blocks.
+ (rdg_flag_uses): Stop recursion when a vertex has already been
+ processed.
+
+2008-02-15 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite.c (build_scop_alpha): Removed.
+ (graphite_transform_loops): Add a dummy call to build_all_rdg_levels
+ and dump_dependence_graph to avoid compiler warnings.
+
+2008-02-14 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * tree-data-ref.c (dr_may_alias_p, create_rdg_vertices): Extern.
+ * tree-data-ref.h (dr_may_alias_p, create_rdg_vertices): Declared.
+ * graphite.c (new_loop_to_cloog_loop_str, hash_loop_to_cloog_loop,
+ eq_loop_to_cloog_loop, del_loop_to_cloog_loop): New.
+ (new_scop, setup_cloog_loop): Initialize SCOP_LOOP2CLOOG_LOOP.
+ (initialize_dependence_polyhedron, find_vertex_for_stmt,
+ initialize_data_dependence_polyhedron, is_empty_polyhedron,
+ statement_precedes_p, build_rdg_all_levels, build_scop_alpha,
+ dump_dependence_graph): New.
+ * graphite.h (struct graphite_bb): New field compressed_alpha_matrix.
+ (GBB_ALPHA): New.
+ (struct scop): New field loop2cloog_loop.
+ (SCOP_LOOP2CLOOG_LOOP, struct data_dependence_polyhedron,
+ RDGE_DDP, ddp_p, struct loop_to_cloog_loop_str): New.
+
+2008-02-10 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite.c (build_graphite_bb): Fix initialization
+ of the graphite basic block.
+
+2008-02-05 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (scan_tree_for_params): Rewrite for the new layout of
+ loop domain matrix. Pass in the number of loops contained in the
+ constraint matrix.
+ (nb_loops_around_gb): Moved before setup_cloog_loop that uses it.
+ (setup_cloog_loop): Rewrite for the new layout of loop domain matrix:
+ loops that are not surrounding the current loop are not represented
+ in the domain constraint matrix.
+ (build_scop_iteration_domain): Initial domain constraint matrix
+ contains only the eq/ineq, cst, and scop parameters columns.
+
+2008-01-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (schedule_to_scattering, nb_loops_around_gb): New.
+ (print_graphite_bb): Print scattering.
+
+2008-01-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (initialize_cloog_names): Initialize names of
+ scattering variables.
+
+2009-01-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (dot_all_scops_1): Disable debug output while
+ printing graph.
+
+2008-01-29 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite.c (find_transform): Change cloog output language to C.
+
+2008-01-27 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-loop-distribution.c (generate_memset_zero,
+ generate_builtin, generate_code_for_partition,
+ rdg_flag_all_uses): New.
+ (rdg_flag_uses): Gather in the same partition the statements defining
+ the VUSES of the current statement.
+ (rdg_flag_similar_stores): Renamed rdg_flag_similar_memory_accesses.
+ Gather in the same partition not only the stores to the same memory
+ access, but also the reads.
+ (ldist_generate_loops): Renamed ldist_gen.
+
+2008-01-24 Sebastian Pop <sebastian.pop@amd.com>
+ Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (setup_cloog_loop): Chain all cloog loops with the
+ next pointer, don't use the inner pointer.
+
+2008-01-20 Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (dot_all_scops, dot_all_scops_1): New.
+ (find_transform): Call dot_all_1.
+ * graphite.h (dot_all_scops): Declared.
+
+2007-12-14 Sebastian Pop <sebastian.pop@amd.com>
+
+ * tree-loop-distribution.c: Fix apsi.f ICE.
+ (create_bb_after_loop): New.
+ (generate_loops_for_partition): Use it.
+ * testsuite/gfortran.dg/ldist-1.f90: New.
+
+ * tree-data-ref.c (dot_rdg): Use /tmp/rdg.dot for dotty format.
+ * graphite.c (dot_scop): Use /tmp/scop.dot for dotty format.
+
+2007-12-13 Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (find_transform): Dump cloog program sent to cloog.
+
+2007-12-13 Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (initialize_cloog_names): Initialize cloog
+ iterator names.
+
+2007-12-13 Tobias Grosser <grosser@fmi.uni-passau.de>
+
+ * graphite.c (build_scop_context): Fix typo, for the matrix
+ format: insert '0 >= 0' instead of '-1 >= 0'.
+
+2007-12-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Fix merge problems.
+
+2007-12-13 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (setup_cloog_loop): Fix typo.
+
+2007-12-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * doc/invoke.texi (-ftree-loop-distribution): Documented.
+ * tree-loop-distribution.c: Reimplemented.
+ * tree-pass.h (pass_loop_distribution): New.
+ * tree-scalar-evolution.c (number_of_iterations_for_all_loops): Use
+ print_loops.
+ * graphds.h (struct graph): New field indexes.
+ * timevar.def (TV_TREE_LOOP_DISTRIBUTION): New.
+
+ * tree-vect-analyze.c: Remove declaration of static functions when not
+ needed.
+ * tree-vectorizer.c: Same.
+ (rename_variables_in_loop): Now extern.
+ (slpeel_tree_duplicate_loop_to_edge_cfg): Renamed
+ tree_duplicate_loop_to_edge_cfg. Reset PENDING_STMT for edges after
+ calling redirect_edge_and_branch_force.
+
+ * tree-vectorizer.h (tree_duplicate_loop_on_edge): Declared.
+
+ * tree-data-ref.c: Don't include tree-chrec.h.
+ (debug_data_dependence_relations): New.
+ (dump_data_dependence_relation): Call dump_data_reference on data refs
+ in the relation.
+ (same_access_functions): Moved...
+ (find_vertex_for_stmt): Renamed rdg_vertex_for_stmt.
+ (dump_rdg_vertex, debug_rdg_vertex, dump_rdg_component,
+ debug_rdg_component, dump_rdg, debug_rdg, dot_rdg_1, dot_rdg,
+ struct rdg_vertex_info, ): New.
+ (create_rdg_edge_for_ddr): Compute the dependence level before looking
+ at DDR_REVERSED_P.
+ (create_rdg_vertices): Initialize the htab of graph->indexes.
+ Initialize RDG_MEM_WRITE_STMT and RDG_MEM_READS_STMT.
+ (stmts_from_loop): Don't save LABEL_EXPR.
+ (hash_stmt_vertex_info, eq_stmt_vertex_info,
+ hash_stmt_vertex_del): New.
+ (build_rdg): Initialize rdg->indexes.
+ (free_rdg, stores_from_loop, ref_base_address,
+ rdg_defs_used_in_other_loops_p, have_similar_memory_accesses,
+ have_similar_memory_accesses_1, ref_base_address_1,
+ remove_similar_memory_refs): New.
+
+ * tree-data-ref.h: Include tree-chrec.h.
+ (debug_data_dependence_relations): Declared.
+ (same_access_functions): ...here. Now static inline.
+ (ddr_is_anti_dependent, ddrs_have_anti_deps,
+ ddr_dependence_level): New.
+ (struct rdg_vertex): New fields has_mem_write, has_mem_reads.
+ (RDGV_HAS_MEM_WRITE, RDGV_HAS_MEM_READS, RDG_STMT, RDG_MEM_WRITE_STMT,
+ RDG_MEM_READS_STMT): New.
+ (dump_rdg_vertex, debug_rdg_vertex, dump_rdg_component,
+ debug_rdg_component, dump_rdg, debug_rdg, dot_rdg,
+ rdg_vertex_for_stmt): Declared.
+ (struct rdg_edge): New field level.
+ (RDGE_LEVEL, free_rdg): New.
+ (stores_from_loop, remove_similar_memory_refs,
+ rdg_defs_used_in_other_loops_p,
+ have_similar_memory_accesses): Declared.
+ (rdg_has_similar_memory_accesses): New.
+
+ * lambda.h (dependence_level): New.
+ * common.opt (ftree-loop-distribution): New.
+ * tree-flow.h (debug_loop_ir): Renamed debug_loops.
+ (print_loop_ir): Renamed print_loops.
+ (debug_loop, debug_loop_num, print_loops_bb, mark_virtual_ops_in_bb,
+ tree_duplicate_loop_to_edge_cfg, rename_variables_in_loop): Declared.
+ * Makefile.in (TREE_DATA_REF_H): Depends on tree-chrec.h.
+ (tree-loop-distribution.o): Added.
+ * tree-cfg.c (mark_virtual_ops_in_region): Use mark_virtual_ops_in_bb.
+ (mark_virtual_ops_in_bb): New.
+ (print_loops_bb, debug_loop_num, debug_loop): New.
+ * passes.c: Scheduled pass_loop_distribution.
+
+2007-12-12 Konrad Trifunovic <konrad.trifunovic@inria.fr>
+
+ * graphite.c (scan_tree_for_params): Correct the number of columns
+ for polylib format.
+ (nb_flat_iterator): New.
+ (setup_cloog_loop): Initialize to 1 the first column for inequalities.
+ (build_scop_iteration_domain): Correct the number of columns for
+ polylib format.
+
+2007-12-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (129697:130800).
+
+2007-10-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (build_graphite_bb): SCoP's basic blocks are post
+ dominated by SCoP's exit.
+ (graphite_transform_loops): Compute post dominators.
+
+2007-10-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * Merge from mainline (127169:129697).
+
+2007-10-28 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite.c (affine_expr): Renamed scop_affine_expr. Use an extra
+ parameter for the basic block that contains the expression. Use
+ outermost_loop_in_scop for evolution_function_is_affine_multivariate_p.
+ (stmt_simple_for_scop_p): Pass to scop_affine_expr the basic block of
+ the expression.
+ * graphite.h (gbb_loop): New.
+ (GBB_LOOP): Removed.
+
+2007-08-03 Sebastian Pop <sebpop@gmail.com>
+
+ * Makefile.in: Fix merge problem.
+
+2007-08-03 Sebastian Pop <sebpop@gmail.com>
+
+ * Merge from mainline (125309:127169).
+ * tree-loop-distribution.c: Disabled.
+
+2007-06-05 Sebastian Pop <sebpop@gmail.com>
+
+ * Merge from mainline (r123693:125309).
+
+2007-05-30 Sebastian Pop <sebpop@gmail.com>
+
+ * tree-loop-distribution.c (correct_modify_expr_p): Renamed
+ correct_modify_p
+ (correct_modify_p, check_statements, number_of_lvalue_uses,
+ number_of_scalar_dependences, create_edges): Use GIMPLE_MODIFY_STMT
+ instead of MODIFY_EXPR.
+ (update_edge_with_ddv): Don't pass index_of_edge. Initialize
+ and push new edges.
+
+2007-05-24 Sebastian Pop <sebpop@gmail.com>
+
+ * tree-loop-distribution.c (struct rdg): Replace arrays by
+ VECs for edges and vertices.
+ (RDG_NBV, RDG_NBE, RDG_VERTEX, RDG_EDGE): Removed.
+ (RDGV_NB_PARTITIONS): New.
+ (PRDG_NBV, PRDG_NBE): Removed.
+ (build_scc_graph, correct_partitions_p, mark_partitions, build_prdg,
+ dump_rdg, find_vertex_with_stmt, create_vertices, free_rdg,
+ number_of_scalar_dependences, create_edges, build_rdg): Use VECs.
+
+2007-05-17 Georges-Andre Silber <silber@cri.ensmp.fr>
+ Sebastian Pop <sebpop@gmail.com>
+
+ * doc/invoke.texi (-ftree-loop-distribution): Document.
+ * tree-loop-distribution.c: New file.
+ * tree-pass.h (pass_loop_distribution): Declared.
+ * timevar.def (TV_TREE_LOOP_DISTRIBUTION): New.
+ * tree-data-ref.c (initialize_data_dependence_relation): Initialize
+ and set reversed_p.
+ * tree-data-ref.h (data_dependence_relation): Add reversed_p.
+ (DDR_REVERSED_P): New.
+ * common.opt (-ftree-loop-distribution): New.
+ * tree-flow.h (distribute_loops): Declared.
+ * Makefile.in (OBJS-common): Depend on tree-loop-distribution.o.
+ * passes.c (init_optimization_passes): Schedule loop distribution.
+
+2007-05-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * graphite.c (print_graphite_bb): Don't call dump_data_references.
+ (print_scop): Don't print when scop is NULL.
+ (build_scop_context, find_transform): Don't output to stderr.
+
+2007-05-09 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * tree-data-ref.c: Don't include graphite.h.
+ Comment out the code for printing data reference's scop.
+ (build_access_matrix_with_af): Moved...
+ * tree-data-ref.h (build_access_matrix_with_af): Removed declaration.
+ * graphite.c (build_access_matrix_with_af): ... here. Now static.
+ (print_graphite_bb): Print basic block's schedule.
+ (print_scop): Don't print the schedule, call cloog's pretty printer.
+ (bb_in_scop_p): A basic block is in a scop only if it is both
+ dominated and postdominated by the scop's entry and exit basic blocks.
+ (function_parameter_p): New.
+ (invariant_in_scop_p): Use function_parameter_p.
+ (new_scop, save_scop): New.
+ (end_scop, test_for_scop_bound, build_scops): Use new_scop, and
+ save_scop.
+ (scan_tree_for_params): Directly build the constraint as CloogMatrix.
+ (loop_in_scop_p): New.
+ (scop_record_loop): Use loop_in_scop_p.
+ (build_scop_domain): Renamed build_scop_iteration_domain.
+ (setup_cloog_loop, initialize_cloog_names, find_scop_parameters,
+ nb_params_in_scop, build_scop_context, first_loop_in_scop,
+ setup_cloog_loop, dot_scop_1, dot_scop): New.
+ * graphite.h (GBB_LOOP, SCOP_PROG, dot_scop): New.
+ (struct scop): Add a pointer to cloog's representation of a program.
+
+2007-04-14 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * doc/invoke.texi (-ftree-check-verbose): Renamed
+ -ftree-checks-verbose.
+ * common.opt (flag_tree_check_verbose): Renamed
+ flag_tree_checks_verbose.
+ * tree-check.c (tree_check_warning): Use flag_tree_checks_verbose.
+
+2007-04-14 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * configure: Regenerated.
+ * config.in: Regenerated.
+ * tree-ssa-loop.c (graphite_transforms): Execute
+ graphite_transform_loops only when HAVE_cloog.
+ * configure.ac (HAVE_polylib, HAVE_cloog, GRAPHITE): Defined.
+ * graphite.c: Include polylibgmp.h and cloog.h.
+ (graphite_transform_loops): Removed loops parameter.
+ * tree-flow.h (graphite_transform_loops): Update declaration.
+ * Makefile.in (POLYLIBLIBS, POLYLIBINC, CLOOGLIBS, CLOOGINC): New.
+ (LIBS): Depend on CLOOGLIBS and on POLYLIBLIBS.
+ (INCLUDES): Depend on POLYLIBINC and on CLOOGINC.
+ (OBJS-common): Remove dependence on graphite.o.
+ (BACKEND): Depend on @GRAPHITE@.
+
+2007-04-13 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * doc/invoke.texi (-ftree-check-verbose): Documented.
+ * testsuite/gcc.dg/tree-checker/tree-checks-1.c: New.
+ * testsuite/gcc.dg/tree-checker/tree-checks-2.c: New.
+ * testsuite/gcc.dg/tree-checker/tree-checks-3.c: New.
+ * testsuite/gcc.dg/tree-checker/tree-checks-4.c: New.
+ * testsuite/gcc.dg/tree-checker/tree-checks.exp: New.
+ * testsuite/gcc.dg/tree-checker/condates.crp: New.
+ * common.opt (ftree-checks-verbose): New.
+ * tree-check.c (tree_check_warning): Move extra stderr output
+ under control of flag_tree_check_verbose.
+
+2007-04-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * tree-match.c: Fix comments formatting.
+ * tree-match.h: Fix comments formatting.
+ * tree-check.c: Fix comments formatting.
+ (tree_check_init): Restructure.
+
+2007-04-12 Nic Volanschi <nic.volanschi@free.fr>
+
+ * doc/invoke.texi (-ftree-check, -ftree-checks): Documented.
+
+2007-04-10 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * Merge from mainline (r120733:123693).
+
+2007-03-20 Nic Volanschi <nic.volanschi@free.fr>
+
+ * condate.y: New file.
+ * tree-match.h (struct patt_info_s): New field sign.
+ (struct condate_s): New field msg.
+ (normalize_condate, name_condate, add_condate): New.
+ (conds[], condate_parse): Made extern.
+ * tree-check.c (tree_check_warning): First arg changed to cond;
+ warning reformatted.
+ (tree_check_init): Reset the TREE_VISITED bit on every CFG node.
+ (tree_scan): New.
+ (tree_check): Process trivial condates.
+ (read_delimited_string): Removed.
+ (print_cond): Print name and msg.
+ (conds[]): Made extern.
+ (parse_tree_check_file_once): Rewritten to use the parser in
+ condate.y.
+ Processing of option --tree_check_string moved to tree_scan().
+ * Makefile.in: Added condate.y
+
+2007-03-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * tree-pretty-print.c (dump_generic_bb_buff, lazy_dump_generic_node):
+ Use VECs instead of varrays.
+ * diagnostic.h (lazy_dump_generic_node): Update declaration.
+ * Makefile.in (pretty-print.o): Depend on vec.h.
+ * pretty-print.c: Include tree.h and vec.h.
+ (pp_clear_state, pp_write_list_to_stream, pp_base_format,
+ pp_base_format, pp_construct, pp_base_string, pp_lazy_mode,
+ new_tree_chunk, pp_add_tree, pp_add_string, pp_add_char, pp_write_list,
+ pp_free_list): Use VECs instead of varrays.
+ * pretty-print.h: Do not include varray.h.
+ (struct tree_chunk_s): Declaration moved before its use.
+ (output_buffer): Rename varray field to chunks.
+ * tree-match.c (tree_equal, chunk_1st_char, chunks_lookahead,
+ tree_1st_char, match_chunks_pattinfo, match_tree_pattinfo,
+ save_global_holes): Use VECs instead of varrays.
+ * tree-match.h: Declare VECs of cfg_node, and hole_p.
+ * tree-check.c (scan_cfg_stmts, push_node,
+ print_matching_stmt): Removed.
+ (tree_check_instance, push_global_holes_if_new, tree_check,
+ execute_tree_check): Use VECs instead of varrays.
+ (gate_tree_check): Don't execute the CFG check when basic_block_info
+ is not available.
+
+2007-01-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * Merge from mainline (r115016:120733).
+
+2007-01-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * Merge from mainline (r117632:117661).
+
+2007-01-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * tree-dump.c (dump_option_value_in): Add TDF_DEBUG.
+ * tree-pass.h (TDF_DEBUG, debug_p): New.
+ * tree-scalar-evolution.c (set_scalar_evolution, get_scalar_evolution,
+ get_scalar_evolution, add_to_evolution, set_nb_iterations_in_loop,
+ get_loop_exit_condition, analyze_evolution_in_loop,
+ analyze_initial_condition, analyze_scalar_evolution,
+ instantiate_parameters, number_of_latch_executions): Use debug_p.
+ * tree-chrec.c (chrec_apply): Use debug_p.
+ * tree-data-ref.c: Include graphite.h.
+ (dump_data_reference): Print also the access matrix.
+ (analyze_array, analyze_indirect_ref, init_data_ref,
+ analyze_offset_expr, address_analysis, object_analysis,
+ create_data_ref, finalize_ddr_dependent,
+ non_affine_dependence_relation, analyze_ziv_subscript,
+ analyze_siv_subscript_cst_affine,
+ compute_overlap_steps_for_affine_1_2, analyze_subscript_affine_affine,
+ can_use_analyze_subscript_affine_affine, analyze_siv_subscript,
+ analyze_miv_subscript, analyze_overlapping_iterations,
+ build_classic_dist_vector, subscript_dependence_tester,
+ compute_affine_dependence, analyze_all_data_dependences): Use debug_p.
+ (build_access_matrix_with_af): No longer static.
+ * tree-data-ref.h (scop_p): ... declaration here.
+ (data_reference.scop): New field.
+ (DR_SCOP, DR_ACCESS_MATRIX): New.
+ (build_access_matrix_with_af, dr_num_subscripts): Declared.
+ * graphite.c (print_graphite_bb): Call dump_data_references.
+ (print_scop): Use scop_nb_loops and scop_dim_domain.
+ (test_for_scop_bound): Use debug_p.
+ (scan_tree_for_params): Use scop_nb_loops, scop_nb_loops and
+ scop_nb_params.
+ (scop_loop_index): Moved...
+ (scop_record_loop): New.
+ (build_scop_loop_nests): Use scop_record_loop.
+ (build_scop_domain): Use scop_dim_domain.
+ (build_access_matrix): Implemented.
+ (build_scop_canonical_schedules): Use scop_nb_loops.
+ (build_graphite_bb): Initialize GBB_SCOP.
+ * graphite.h (scop_p): Moved...
+ (graphite_bb.scop): New field.
+ (graphite_bb.iteration_domain, GBB_DOMAIN, scop.nb_params,
+ scop.nb_loops, scop.dim_domain, SCOP_NB_LOOPS, SCOP_NB_PARAMS,
+ SCOP_DIM_DOMAIN, SCOP_STMTS): Removed.
+ (scop_nb_params, scop_nb_loops, scop_dim_domain, gbb_dim_domain,
+ scop_loop_index): New.
+ * Makefile.in (tree-data-ref.o): Depends on graphite.h.
+
+2007-01-05 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * Merge from mainline (r117661:120450).
+
+2006-10-12 Sebastian Pop <sebastian.pop@inria.fr>
+
+ * tree-scalar-evolution.c (instantiate_parameters_1): Don't stop
+ at the first declaration outside the varying loop, instantiate as
+ far as possible.
+ * tree-chrec.c (for_each_scev_op): New.
+ * tree-chrec.h (for_each_scev_op): Declared.
+ * tree-ssa-loop.c (pass_graphite_trans): Don't dump the function.
+ * tree-data-ref.c (get_references_in_stmt,
+ find_data_references_in_stmt): New, from trunk.
+ (find_data_references_in_loop): Use get_references_in_stmt
+ and find_data_references_in_loop, modified as in trunk.
+ (build_access_matrix_with_af): New.
+ * tree-data-ref.h (data_reference): Add a field access_matrix.
+ (data_ref_loc): New, as in trunk.
+ * graphite.c (print_graphite_bb, bb_in_scop_p, stmt_in_scop_p,
+ invariant_in_scop_p, param_index, scan_tree_for_params,
+ scop_loop_index, build_scop_loop_nests, build_scop_domain, irp_data,
+ idx_record_param, idx_record_params, build_access_matrix,
+ build_scop_data_accesses, build_scop_canonical_schedules,
+ build_graphite_bb, build_scop_bbs, find_params_in_bb,
+ build_scop_params): New.
+ * graphite.h (graphite_bb): New.
+ (scop): Add fields static_schedule, params, loop_nest,
+ iteration_domain.
+ * lambda.h: Declare vecs of lambda_matrix.
+ * tree-flow.h (print_loop_ir_bb): Declared.
+ * tree-cfg.c (print_loop_ir_bb): New.
+ (print_loop): Use print_loop_ir_bb.
+
+2006-10-12 Sebastian Pop <pop@cri.ensmp.fr>
+
+ * Merge from mainline (r115016:117632).
+
+2006-10-11 Sebastian Pop <pop@cri.ensmp.fr>
+
+ * graphite.c (debug_scops): Adjust definition for avoiding a bootstrap
+ break due to a warning.
+
+2006-10-10 Sebastian Pop <pop@cri.ensmp.fr>
+
+ * graphite.c (print_scops, debug_scops): New.
+ (graphite_transform): Renamed graphite_find_transform.
+ * graphite.h (debug_scops): Declared.
+
+2006-08-17 Sebastian Pop <pop@cri.ensmp.fr>
+
+ * tree-match.c: Reformat following the GNU style.
+ * tree-match.h: Reformat following the GNU style.
+ * tree-pattern.h: Removed empty file.
+ * Makefile.in: Remove references to tree-pattern.h.
+ * tree-check.c: Reformat following the GNU style.
+ (execute_tree_check): Move gate condition code to...
+ (gate_tree_check): ...here. New function.
+ (pass_check): Use the gate function.
+
+2006-07-04 Nic Volanschi <nic.volanschi@free.fr>
+
+ * tree-pattern.h: New. Tree pattern matching and checking using
+ concrete syntax.
+ * tree-check.c: New. Tree/CFG checking pass.
+ * tree-match.c: New. Library for tree pattern matching.
+ * opts.c, common.opt: Add options --ftree-check & --ftree-checks.
+ * toplev.c, flags.h: Add globals for tree-check pass.
+ * Makefile.in: Integrate the files in tree-check pass.
+ * timevar.def, tree-optimize.c, tree-pass.h: Register tree-check pass.
+ * pretty-print.c, pretty-print.h, tree-pretty-print.c, diagnostic.h:
+ Introduce a "lazy" pretty-print mode.
+ * tree.c, tree.h: Add tree_name.
+
+2006-07-04 Sebastian Pop <pop@cri.ensmp.fr>
+
+ * doc/invoke.texi (-fgraphite): Correct typo.
+ * tree-scalar-evolution.c (number_of_iterations_for_all_loops): Update
+ use of print_loop_ir.
+ * testsuite/gcc.dg/graphite/scop-1.c: New.
+ * testsuite/gcc.dg/graphite/scop-2.c: New.
+ * testsuite/gcc.dg/graphite/graphite.exp: New.
+ * graphite.c: Include domwalk.h.
+ (print_scop): Print only the entry and exit blocks.
+ (debug_scop): No longer static.
+ (affine_expr): Fix formating. Return also true when the expression is
+ constant.
+ (stmt_simple_for_scop_p): Fix formating.
+ (build_scops): Use domwalk.
+ (get_loop_start, end_scop, test_for_scop_bound): New.
+ (graphite_transform_loops): Avoid printing on stderr.
+ * graphite.h (debug_scop): Declared.
+ * tree-flow.h (debug_loop_ir, print_loop_ir): Update declarations.
+ * Makefile.in (graphite.o): Depend on domwalk.h.
+ * tree-cfg.c (print_loop, print_pred_bbs, print_succ_bbs): Remove
+ declarations for static functions.
+ (print_loop, print_loop_ir, debug_loop_ir): Use an extra parameter for
+ controlling output verbosity.
+
+2006-06-26 Sebastian Pop <pop@cri.ensmp.fr>
+ Plesco Alexandru <shurikx@gmail.com>
+
+ * doc/invoke.texi (-fgraphite): Document.
+ * tree-pass.h (pass_graphite_transforms): Declared.
+ * timevar.def (TV_GRAPHITE_TRANSFORMS): New.
+ * tree-ssa-loop.c (graphite_transforms, gate_graphite_transforms): New.
+ (pass_graphite_transforms): Defined.
+ * tree-data-ref.c (free_data_ref, data_reference): Extern.
+ * tree-data-ref.h (free_data_ref, data_reference): Declared.
+ * graphite.c, graphite.h: New.
+ * common.opt (fgraphite): Declared.
+ * tree-flow.h (graphite_transform_loops): Declared.
+ * Makefile.in (OBJS-common): Add graphite.o.
+ (graphite.o): New rule.
+ * passes.c (pass_graphite_transforms): Scheduled.
+
diff --git a/gcc/ChangeLog.vta b/gcc/ChangeLog.vta
index 775188375e3..3022323c4fe 100644
--- a/gcc/ChangeLog.vta
+++ b/gcc/ChangeLog.vta
@@ -1,5 +1,9 @@
2009-08-18 Alexandre Oliva <aoliva@redhat.com>
+ Merged with trunk@150905.
+
+2009-08-18 Alexandre Oliva <aoliva@redhat.com>
+
* testsuite/gcc.dg/guality/guality.h (main): Error-check GDB pipe
operations.
(guality_check): Likewise. Update comment. Time-out GDB attach.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index dbbb8700ffb..13fb2c60b85 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20090730
+20090818
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 554bc473004..f8d3f1438c4 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1178,6 +1178,14 @@ OBJS-common = \
graph.o \
graphds.o \
graphite.o \
+ graphite-blocking.o \
+ graphite-clast-to-gimple.o \
+ graphite-dependences.o \
+ graphite-interchange.o \
+ graphite-poly.o \
+ graphite-ppl.o \
+ graphite-scop-detection.o \
+ graphite-sese-to-poly.o \
gtype-desc.o \
haifa-sched.o \
hooks.o \
@@ -1251,6 +1259,7 @@ OBJS-common = \
sel-sched-ir.o \
sel-sched-dump.o \
sel-sched.o \
+ sese.o \
simplify-rtx.o \
sparseset.o \
sreal.o \
@@ -1592,9 +1601,35 @@ cs-tm_p.h: Makefile
# might be on a read-only file system. If configured for maintainer mode
# then do allow autoconf to be run.
-$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/aclocal.m4 \
- $(srcdir)/acinclude.m4
- (cd $(srcdir) && autoconf)
+AUTOCONF = autoconf
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I ../config -I ..
+aclocal_deps = \
+ $(srcdir)/../libtool.m4 \
+ $(srcdir)/../ltoptions.m4 \
+ $(srcdir)/../ltsugar.m4 \
+ $(srcdir)/../ltversion.m4 \
+ $(srcdir)/../lt~obsolete.m4 \
+ $(srcdir)/../config/acx.m4 \
+ $(srcdir)/../config/codeset.m4 \
+ $(srcdir)/../config/extensions.m4 \
+ $(srcdir)/../config/gettext-sister.m4 \
+ $(srcdir)/../config/iconv.m4 \
+ $(srcdir)/../config/lcmessage.m4 \
+ $(srcdir)/../config/lib-ld.m4 \
+ $(srcdir)/../config/lib-link.m4 \
+ $(srcdir)/../config/lib-prefix.m4 \
+ $(srcdir)/../config/override.m4 \
+ $(srcdir)/../config/progtest.m4 \
+ $(srcdir)/../config/unwind_ipinfo.m4 \
+ $(srcdir)/../config/warnings.m4 \
+ $(srcdir)/acinclude.m4
+
+$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/aclocal.m4
+ (cd $(srcdir) && $(AUTOCONF))
+
+$(srcdir)/aclocal.m4 : @MAINT@ $(aclocal_deps)
+ (cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS))
gccbug: $(srcdir)/gccbug.in
CONFIG_FILES=gccbug CONFIG_HEADERS= ./config.status
@@ -1611,9 +1646,10 @@ gccbug: $(srcdir)/gccbug.in
# Don't run autoheader automatically either.
# Only run it if maintainer mode is enabled.
+@MAINT@ AUTOHEADER = autoheader
@MAINT@ $(srcdir)/config.in: $(srcdir)/cstamp-h.in
@MAINT@ $(srcdir)/cstamp-h.in: $(srcdir)/configure.ac
-@MAINT@ (cd $(srcdir) && autoheader)
+@MAINT@ (cd $(srcdir) && $(AUTOHEADER))
@MAINT@ @rm -f $(srcdir)/cstamp-h.in
@MAINT@ echo timestamp > $(srcdir)/cstamp-h.in
auto-host.h: cstamp-h ; @true
@@ -2157,7 +2193,7 @@ tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(TOPLEV_H) $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
$(TREE_DUMP_H) langhooks.h $(TREE_PASS_H) $(BASIC_BLOCK_H) $(BITMAP_H) \
$(FLAGS_H) $(GGC_H) hard-reg-set.h $(HASHTAB_H) pointer-set.h \
- $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H)
+ $(GIMPLE_H) $(TREE_INLINE_H) $(VARRAY_H) $(TARGET_H)
tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
$(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) \
@@ -2356,7 +2392,7 @@ tree-ssa-loop-manip.o : tree-ssa-loop-manip.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) hard-reg-set.h \
$(BASIC_BLOCK_H) output.h $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) \
$(TIMEVAR_H) $(CFGLOOP_H) $(TREE_PASS_H) $(CFGLAYOUT_H) \
- $(SCEV_H) $(PARAMS_H) $(TREE_INLINE_H)
+ $(SCEV_H) $(PARAMS_H) $(TREE_INLINE_H) langhooks.h
tree-ssa-loop-im.o : tree-ssa-loop-im.c $(TREE_FLOW_H) $(CONFIG_H) \
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) domwalk.h \
$(PARAMS_H) output.h $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
@@ -2423,11 +2459,64 @@ tree-data-ref.o: tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
$(TREE_DATA_REF_H) $(TREE_PASS_H) langhooks.h
+sese.o: sese.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
+ domwalk.h pointer-set.h value-prof.h
graphite.o: graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
$(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
- $(TREE_DATA_REF_H) $(SCEV_H) $(TREE_PASS_H) tree-chrec.h graphite.h \
- pointer-set.h value-prof.h
+ $(PREDICT_H) $(TREE_DATA_REF_H) tree-pass.h graphite.h \
+ pointer-set.h value-prof.h graphite-ppl.h sese.h \
+ graphite-scop-detection.h graphite-clast-to-gimple.h \
+ graphite-poly.h graphite-sese-to-poly.h
+graphite-blocking.o: graphite-blocking.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h \
+ $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
+ $(TOPLEV_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
+ $(GIMPLE_H) $(TREE_DATA_REF_H) tree-pass.h \
+ graphite.h graphite-poly.h graphite-ppl.h
+graphite-clast-to-gimple.o: graphite-clast-to-gimple.c $(CONFIG_H) \
+ $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
+ $(TREE_DATA_REF_H) tree-pass.h graphite.h \
+ pointer-set.h value-prof.h graphite-ppl.h sese.h \
+ graphite-scop-detection.h graphite-clast-to-gimple.h graphite-poly.h \
+ graphite-dependences.h
+graphite-dependences.o: graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h \
+ $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
+ $(TOPLEV_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
+ $(GIMPLE_H) $(TREE_DATA_REF_H) tree-pass.h \
+ graphite.h graphite-poly.h graphite-ppl.h graphite-dependences.h
+graphite-interchange.o: graphite-interchange.c $(CONFIG_H) $(SYSTEM_H) \
+ coretypes.h \
+ $(TM_H) $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
+ $(TOPLEV_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
+ $(GIMPLE_H) $(TREE_DATA_REF_H) tree-pass.h \
+ graphite.h graphite-poly.h graphite-ppl.h
+graphite-poly.o: graphite-poly.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
+ $(TREE_DATA_REF_H) tree-pass.h graphite.h graphite-dependences.h \
+ pointer-set.h value-prof.h graphite-ppl.h sese.h output.h graphite-poly.h
+graphite-ppl.o: graphite-ppl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(GGC_H) graphite-ppl.h
+graphite-scop-detection.o: graphite-scop-detection.c $(CONFIG_H) $(SYSTEM_H) \
+ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
+ $(TREE_DATA_REF_H) tree-pass.h graphite.h $(TM_H) \
+ value-prof.h graphite-ppl.h sese.h pointer-set.h coretypes.h \
+ graphite-scop-detection.h graphite-poly.h
+graphite-sese-to-poly.o: graphite-sese-to-poly.c $(CONFIG_H) \
+ $(SYSTEM_H) coretypes.h $(TM_H) \
+ $(GGC_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TOPLEV_H) \
+ $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) $(GIMPLE_H) \
+ $(TREE_DATA_REF_H) tree-pass.h graphite.h \
+ pointer-set.h value-prof.h graphite-ppl.h sese.h \
+ graphite-scop-detection.h graphite-sese-to-poly.h $(PARAMS_H) \
+ graphite-clast-to-gimple.h graphite-poly.h
tree-vect-loop.o: tree-vect-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) \
$(TREE_DUMP_H) $(CFGLOOP_H) $(EXPR_H) $(RECOG_H) $(OPTABS_H) $(TOPLEV_H) \
@@ -2506,7 +2595,7 @@ opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \
output.h $(DIAGNOSTIC_H) $(TM_P_H) $(INSN_ATTR_H) intl.h $(TARGET_H) \
$(FLAGS_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H) debug.h varray.h \
- $(PLUGIN_H)
+ $(PLUGIN_H) $(EXCEPT_H)
opts-common.o : opts-common.c opts.h $(CONFIG_H) $(SYSTEM_H) \
coretypes.h intl.h
targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
@@ -2799,8 +2888,8 @@ tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \
$(TREE_DUMP_H) $(BASIC_BLOCK_H) $(TREE_PASS_H) langhooks.h \
tree-ssa-propagate.h value-prof.h $(FLAGS_H) $(TARGET_H) $(TOPLEV_H)
tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) coretypes.h alloc-pool.h \
- $(TM_H) $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) statistics.h \
- $(TREE_DUMP_H) $(TIMEVAR_H) $(PARAMS_H) $(TARGET_H) $(FLAGS_H)
+ $(TM_H) $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) $(IPA_PROP_H) $(DIAGNOSTIC_H) \
+ statistics.h $(TREE_DUMP_H) $(TIMEVAR_H) $(PARAMS_H) $(TARGET_H) $(FLAGS_H)
tree-switch-conversion.o : tree-switch-conversion.c $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) $(GIMPLE_H) \
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 72765902458..99756b180cf 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -92,6 +92,11 @@ if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
fi
])
+m4_include([../libtool.m4])
+m4_include([../ltoptions.m4])
+m4_include([../ltsugar.m4])
+m4_include([../ltversion.m4])
+m4_include([../lt~obsolete.m4])
m4_include([../config/acx.m4])
m4_include([../config/codeset.m4])
m4_include([../config/extensions.m4])
@@ -105,9 +110,4 @@ m4_include([../config/override.m4])
m4_include([../config/progtest.m4])
m4_include([../config/unwind_ipinfo.m4])
m4_include([../config/warnings.m4])
-m4_include([../libtool.m4])
-m4_include([../ltoptions.m4])
-m4_include([../ltsugar.m4])
-m4_include([../ltversion.m4])
-m4_include([../lt~obsolete.m4])
m4_include([acinclude.m4])
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 90120e89d55..04712c2cd3a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,238 @@
+2009-08-17 Aurelien Jarno <aurelien@aurel32.net>
+
+ * s-osinte-kfreebsd-gnu.ads (SA_ONSTACK): New constant.
+ (stack_t): New record type.
+ (sigaltstack): New imported function.
+ (Alternate_Stack): New imported variable.
+ (Alternate_Stack_Size): New constant.
+
+2009-08-17 Vasiliy Fofanov <fofanov@adacore.com>
+
+ * a-calend-vms.adb: Fix typo.
+
+2009-08-17 Tristan Gingold <gingold@adacore.com>
+
+ * s-taprop-posix.adb: Round up the stack size to avoid failure on
+ Darwin.
+
+2009-08-17 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_cat.adb (Validate_Static_Object_Name): Update comment.
+
+2009-08-17 Vincent Celier <celier@adacore.com>
+
+ * make.adb (Arguments_Collected): Unneeded, removed
+ (Change_To_Object_Directory): Use Project directly. Add pragma Assert to
+ ensure caller does not pass in No_Project.
+ (Compile): Add new parameter Project. Let procedure
+ Collect_Arguments_And_Compile provide the proper value.
+
+ * switch-c.adb: Add documentation for -gnatea and -gnatez
+
+2009-08-17 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Changed name of package in SAL example, to avoid
+ clash with Ada 2005 reserved word (interface).
+
+2009-08-17 Robert Dewar <dewar@adacore.com>
+
+ * a-crbtgk.adb, a-crdlli.adb, a-direct.adb, a-caldel-vms.adb,
+ a-calend-vms.adb, a-calfor.adb, a-cdlili.adb, a-chahan.adb,
+ a-cidlli.adb, a-coinve.adb, a-comlin.adb: Minor code reorganization
+ (use conditional expressions).
+
+2009-08-17 Robert Dewar <dewar@adacore.com>
+
+ * make.adb: Add ??? comment
+ * tbuild.adb: Minor reformatting
+
+2009-08-17 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch4.adb (Exp_Ch4.Expand_N_Slice.Make_Temporary): Rename to
+ Make_Temporary_For_Slice to avoid confusion with Tbuild.Make_Temporary.
+ Use Tbuild.Make_Temporary to create entity for the temporary.
+
+2009-08-17 Arnaud Charlet <charlet@adacore.com>
+
+ * make.adb (Process_Multilib, Scan_Make_Arg): Refine previous change
+ and ignore -mieee switch to avoid spawning an extra gcc in this case.
+
+2009-08-17 Thomas Quinot <quinot@adacore.com>
+
+ * tbuild.adb: Minor reformatting
+
+2009-08-17 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch3.adb (Build_Discriminant_Formals): If the discriminals already
+ exist, as is the case for synchronized types, use the type of the
+ discriminal in the parameter specification, to prevent a spurious
+ subtype mismatch in gigi.
+
+2009-08-17 Robert Dewar <dewar@adacore.com>
+
+ * prj-env.adb: Minor reformatting
+ * make.adb: Minor reformatting
+ Comment updates
+
+2009-08-17 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch7.adb (Wrap_Transient_Expression): Update comments.
+
+2009-08-17 Emmanuel Briot <briot@adacore.com>
+
+ * prj-part.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-conf.adb
+ (Processing_Flags.Require_Obj_Dirs): new field, which controls whether
+ object directories must be present. In the case of gprclean at least,
+ these are optional (if they do not exist there is nothing to clean)
+
+2009-08-17 Robert Dewar <dewar@adacore.com>
+
+ * prj-env.adb: Minor reformatting
+ * sem_ch3.adb: Minor reformatting
+
+2009-08-17 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sysdep.c (__gnat_localtime_tzoff): VxWorks case - Flip the sign of
+ the time zone since VxWorks chose positive values to represent west
+ time zones and negative for east zones.
+
+2009-08-17 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Definition): Do not create an Itype reference for
+ an anonymous access type whose designated type is generic.
+
+2009-08-17 Arnaud Charlet <charlet@adacore.com>
+
+ * comperr.adb (Compiler_Abort): Do not generate a bug box when in
+ codepeer mode, friendlier.
+
+2009-08-10 Laurent GUERBY <laurent@guerby.net>
+
+ * make.adb: Handle multilib
+
+2009-08-10 Vincent Celier <celier@adacore.com>
+
+ * prj-env.adb (Create_Config_Pragmas_File.Write_Temp_File): Do not use
+ the temporary file name in the error message when the temporary file
+ cannot be created.
+
+2009-08-10 Yannick Moy <moy@adacore.com>
+
+ * gnat_ugn.texi: Fix typo
+
+2009-08-10 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch7.adb: Add ??? comment for last change
+
+2009-08-10 Vincent Celier <celier@adacore.com>
+
+ * prj-env.adb (Add_To_Buffer): New procedure
+ (Create_Config_Pragmas_File): Write to temporary file in one shot
+ (Create_Mapping_File): Ditto
+ (Set_Ada_Paths): Ditto
+
+2009-08-10 Vincent Celier <celier@adacore.com>
+
+ PR ada/17566
+ * xref_lib.adb (Print_Xref): Make sure that there is at least one space
+ between a declaration name and its type.
+
+2009-08-07 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch7.adb (Wrap_Transient_Expression): Add missing adjustment of
+ SCIL node.
+
+2009-08-07 Robert Dewar <dewar@adacore.com>
+
+ * sem_warn.adb (Warn_On_Unreferenced_Entity): Fix obvious typo.
+
+2009-08-07 Vincent Celier <celier@adacore.com>
+
+ * gnatcmd.adb (GNATCmd): If -U is not used, one and only one main is
+ specified on the command line and there are switches in the Compiler
+ package of the project file, use these compilation switches to invoke
+ the tool.
+
+2009-08-07 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Wordsmithing edits at beginning of gnatcheck chapter.
+
+2009-08-07 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch10.adb (Analyze_Proper_Body): Indicate name of missing subunit
+ even if not in main unit, to simplify debugging.
+
+2009-08-07 Arnaud Charlet <charlet@adacore.com>
+
+ * gcc-interface/Makefile.in: Fix handling of GCC_FOR_TARGET.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2009-08-07 Robert Dewar <dewar@adacore.com>
+
+ * types.ads: Minor reformatting
+ * sem_ch12.ads (Check_Generic_Child_Unit): Add missing documentation.
+ * frontend.adb, sem_warn.adb, sem_warn.ads: Fix spelling of
+ Output_Non_Modified_In_Out_Warnings.
+ * sem_ch13.adb: Remove ??? comment.
+
+2009-08-07 Vincent Celier <celier@adacore.com>
+
+ * mlib-prj.adb (Build_Library): Include binder generate object file
+ for SAL when library name is only one character.
+
+2009-08-07 Thomas Quinot <quinot@adacore.com>
+
+ * targparm.adb: Minor reformatting
+ * sem.adb: Minor reformatting
+ * exp_ch4.adb (Expand_N_Conditional_Expression): Add comment.
+
+2009-08-07 Emmanuel Briot <briot@adacore.com>
+
+ * prj-conf.adb: Remove duplicate directory separator in the output when
+ an object directory does not exist.
+
+2009-08-07 Robert Dewar <dewar@adacore.com>
+
+ * exp_util.adb: Minor reformatting
+
+2009-08-07 Vincent Celier <celier@adacore.com>
+
+ * mlib-prj.adb (Build_Library): Fixed bug in name of ALI file (wrong
+ length used).
+
+2009-08-07 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch9.adb (Expand_N_Protected_Type_Declaration): In Ravenscar mode,
+ detect non-static private components that will violate restriction
+ No_Implicit_Heap_Allocation.
+
+2009-08-07 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Edited Rule Exemption section of gnatcheck chapter.
+
+2009-08-02 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/gigi.h (end_subprog_body): Tweak comment.
+ * gcc-interface/utils.c (end_subprog_body): Likewise.
+ * gcc-interface/trans.c (gigi): Likewise.
+ (gnat_to_gnu): Likewise.
+
+2009-07-30 Ben Brosgol <brosgol@adacore.com>
+
+ * gnat_ugn.texi: Correct minor texi glitch.
+
+2009-07-30 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_util.adb (Expand_Subtype_From_Expr): If the type of the
+ expression has an underlying representation that is an unchecked union,
+ there is no subtype to build.
+
+2009-07-30 Robert Dewar <dewar@adacore.com>
+
+ * a-teioed.adb, exp_disp.adb, s-linux-hppa.ads, s-linux.ads,
+ s-tasini.adb, sem_ch13.adb, sem_ch3.adb, sem_ch3.ads, sem_ch6.adb,
+ sem_ch7.adb, adaint.c: Minor reformatting
+
2009-07-29 Javier Miranda <miranda@adacore.com>
* sem_ch3.ads, sem_ch3.adb (Add_Internal_Interface_Entities): Routine
@@ -504,9 +739,14 @@
2009-07-23 Thomas Quinot <quinot@adacore.com>
* scos.ads: Minor typo fix
+
* gcc-interface/decl.c (validate_alignment): For the case of an
implicit array base type, look for alignment clause on first subtype.
- Code clean up.
+
+2009-07-23 Robert Dewar <dewar@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_field): Don't check for overlap
+ with tagged parent if tagged parent is fully repped.
2009-07-23 Ed Schonberg <schonberg@adacore.com>
diff --git a/gcc/ada/a-caldel-vms.adb b/gcc/ada/a-caldel-vms.adb
index 8b7715744d6..128918a9ac6 100644
--- a/gcc/ada/a-caldel-vms.adb
+++ b/gcc/ada/a-caldel-vms.adb
@@ -7,7 +7,7 @@
-- B o d y --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2008, AdaCore --
+-- Copyright (C) 1995-2009, AdaCore --
-- --
-- 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- --
@@ -79,15 +79,10 @@ package body Ada.Calendar.Delays is
-- A value distant enough to emulate "end of time" but which does not
-- cause overflow.
- Safe_T : Time;
+ Safe_T : constant Time :=
+ (if T > Safe_Ada_High then Safe_Ada_High else T);
begin
- if T > Safe_Ada_High then
- Safe_T := Safe_Ada_High;
- else
- Safe_T := T;
- end if;
-
return OSP.To_Duration (OSP.OS_Time (Safe_T), OSP.Absolute_Calendar);
end To_Duration;
diff --git a/gcc/ada/a-calend-vms.adb b/gcc/ada/a-calend-vms.adb
index 374ea715ff6..788ff28a4d0 100644
--- a/gcc/ada/a-calend-vms.adb
+++ b/gcc/ada/a-calend-vms.adb
@@ -921,11 +921,7 @@ package body Ada.Calendar is
-- Step 3: Handle leap second occurrences
- if Leap_Sec then
- tm_sec := 60;
- else
- tm_sec := Second;
- end if;
+ tm_sec := (if Leap_Sec then 60 else Second);
end To_Struct_Tm;
------------------
@@ -1195,11 +1191,10 @@ package body Ada.Calendar is
else
-- Sub second extraction
- if Day_Secs > 0.0 then
- Int_Day_Secs := Integer (Day_Secs - 0.5);
- else
- Int_Day_Secs := Integer (Day_Secs);
- end if;
+ Int_Day_Secs :=
+ (if Day_Secs > 0.0
+ then Integer (Day_Secs - 0.5)
+ else Integer (Day_Secs));
H := Int_Day_Secs / 3_600;
Mi := (Int_Day_Secs / 60) mod 60;
diff --git a/gcc/ada/a-calfor.adb b/gcc/ada/a-calfor.adb
index 10e9617022c..b8e6222475d 100644
--- a/gcc/ada/a-calfor.adb
+++ b/gcc/ada/a-calfor.adb
@@ -156,17 +156,8 @@ package body Ada.Calendar.Formatting is
-- Determine the two slice bounds for the result string depending on
-- whether the input is negative and whether fractions are requested.
- if Elapsed_Time < 0.0 then
- Low := 1;
- else
- Low := 2;
- end if;
-
- if Include_Time_Fraction then
- High := 12;
- else
- High := 9;
- end if;
+ Low := (if Elapsed_Time < 0.0 then 1 else 2);
+ High := (if Include_Time_Fraction then 12 else 9);
-- Prevent rounding when converting to natural
@@ -457,11 +448,7 @@ package body Ada.Calendar.Formatting is
raise Constraint_Error;
end if;
- if Seconds = 0.0 then
- Secs := 0;
- else
- Secs := Natural (Seconds - 0.5);
- end if;
+ Secs := (if Seconds = 0.0 then 0 else Natural (Seconds - 0.5));
Sub_Second := Second_Duration (Seconds - Day_Duration (Secs));
Hour := Hour_Number (Secs / 3_600);
diff --git a/gcc/ada/a-cdlili.adb b/gcc/ada/a-cdlili.adb
index c0fae213a4f..f9d7db832da 100644
--- a/gcc/ada/a-cdlili.adb
+++ b/gcc/ada/a-cdlili.adb
@@ -561,15 +561,9 @@ package body Ada.Containers.Doubly_Linked_Lists is
----------
procedure Sort (Front, Back : Node_Access) is
- Pivot : Node_Access;
-
+ Pivot : constant Node_Access :=
+ (if Front = null then Container.First else Front.Next);
begin
- if Front = null then
- Pivot := Container.First;
- else
- Pivot := Front.Next;
- end if;
-
if Pivot /= Back then
Partition (Pivot, Back);
Sort (Front, Pivot);
diff --git a/gcc/ada/a-chahan.adb b/gcc/ada/a-chahan.adb
index e6a93617857..61419b090ee 100644
--- a/gcc/ada/a-chahan.adb
+++ b/gcc/ada/a-chahan.adb
@@ -457,11 +457,7 @@ package body Ada.Characters.Handling is
Substitute : ISO_646 := ' ') return ISO_646
is
begin
- if Item in ISO_646 then
- return Item;
- else
- return Substitute;
- end if;
+ return (if Item in ISO_646 then Item else Substitute);
end To_ISO_646;
function To_ISO_646
@@ -472,11 +468,8 @@ package body Ada.Characters.Handling is
begin
for J in Item'Range loop
- if Item (J) in ISO_646 then
- Result (J - (Item'First - 1)) := Item (J);
- else
- Result (J - (Item'First - 1)) := Substitute;
- end if;
+ Result (J - (Item'First - 1)) :=
+ (if Item (J) in ISO_646 then Item (J) else Substitute);
end loop;
return Result;
diff --git a/gcc/ada/a-cidlli.adb b/gcc/ada/a-cidlli.adb
index 510b7707b09..0d01502e05d 100644
--- a/gcc/ada/a-cidlli.adb
+++ b/gcc/ada/a-cidlli.adb
@@ -605,15 +605,9 @@ package body Ada.Containers.Indefinite_Doubly_Linked_Lists is
----------
procedure Sort (Front, Back : Node_Access) is
- Pivot : Node_Access;
-
+ Pivot : constant Node_Access :=
+ (if Front = null then Container.First else Front.Next);
begin
- if Front = null then
- Pivot := Container.First;
- else
- Pivot := Front.Next;
- end if;
-
if Pivot /= Back then
Partition (Pivot, Back);
Sort (Front, Pivot);
diff --git a/gcc/ada/a-coinve.adb b/gcc/ada/a-coinve.adb
index ffa2d1b4e2b..9169e086ebd 100644
--- a/gcc/ada/a-coinve.adb
+++ b/gcc/ada/a-coinve.adb
@@ -1171,7 +1171,6 @@ package body Ada.Containers.Indefinite_Vectors is
and then Index_Type'Last >= 0
then
CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
-
else
CC := UInt (Int (Index_Type'Last) - First + 1);
end if;
@@ -1610,7 +1609,6 @@ package body Ada.Containers.Indefinite_Vectors is
and then Index_Type'Last >= 0
then
CC := UInt (Index_Type'Last) + UInt (-Index_Type'First) + 1;
-
else
CC := UInt (Int (Index_Type'Last) - First + 1);
end if;
@@ -2283,15 +2281,9 @@ package body Ada.Containers.Indefinite_Vectors is
Item : Element_Type;
Index : Index_Type := Index_Type'Last) return Extended_Index
is
- Last : Index_Type'Base;
-
+ Last : constant Index_Type'Base :=
+ (if Index > Container.Last then Container.Last else Index);
begin
- if Index > Container.Last then
- Last := Container.Last;
- else
- Last := Index;
- end if;
-
for Indx in reverse Index_Type'First .. Last loop
if Container.Elements.EA (Indx) /= null
and then Container.Elements.EA (Indx).all = Item
diff --git a/gcc/ada/a-comlin.adb b/gcc/ada/a-comlin.adb
index 2b6c32e104f..b29693638d6 100644
--- a/gcc/ada/a-comlin.adb
+++ b/gcc/ada/a-comlin.adb
@@ -29,7 +29,9 @@
-- --
------------------------------------------------------------------------------
-with System; use System;
+pragma Compiler_Unit;
+
+with System; use System;
package body Ada.Command_Line is
@@ -71,7 +73,6 @@ package body Ada.Command_Line is
declare
Arg : aliased String (1 .. Len_Arg (Num));
-
begin
Fill_Arg (Arg'Address, Num);
return Arg;
diff --git a/gcc/ada/a-crbtgk.adb b/gcc/ada/a-crbtgk.adb
index c06f31e1d07..59d25be4557 100644
--- a/gcc/ada/a-crbtgk.adb
+++ b/gcc/ada/a-crbtgk.adb
@@ -125,12 +125,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
while X /= null loop
Y := X;
Inserted := Is_Less_Key_Node (Key, X);
-
- if Inserted then
- X := Ops.Left (X);
- else
- X := Ops.Right (X);
- end if;
+ X := (if Inserted then Ops.Left (X) else Ops.Right (X));
end loop;
-- If Inserted is True, then this means either that Tree is
@@ -440,12 +435,7 @@ package body Ada.Containers.Red_Black_Trees.Generic_Keys is
while X /= null loop
Y := X;
Before := Is_Less_Key_Node (Key, X);
-
- if Before then
- X := Ops.Left (X);
- else
- X := Ops.Right (X);
- end if;
+ X := (if Before then Ops.Left (X) else Ops.Right (X));
end loop;
Insert_Post (Tree, Y, Before, Node);
diff --git a/gcc/ada/a-crdlli.adb b/gcc/ada/a-crdlli.adb
index acdc57d1a08..137290b11e0 100644
--- a/gcc/ada/a-crdlli.adb
+++ b/gcc/ada/a-crdlli.adb
@@ -561,15 +561,9 @@ package body Ada.Containers.Restricted_Doubly_Linked_Lists is
----------
procedure Sort (Front, Back : Count_Type) is
- Pivot : Count_Type;
-
+ Pivot : constant Count_Type :=
+ (if Front = 0 then Container.First else N (Front).Next);
begin
- if Front = 0 then
- Pivot := Container.First;
- else
- Pivot := N (Front).Next;
- end if;
-
if Pivot /= Back then
Partition (Pivot, Back);
Sort (Front, Pivot);
diff --git a/gcc/ada/a-direct.adb b/gcc/ada/a-direct.adb
index d38745fbd8b..f0182c68e7a 100644
--- a/gcc/ada/a-direct.adb
+++ b/gcc/ada/a-direct.adb
@@ -1065,14 +1065,9 @@ package body Ada.Directories is
Cut_End : Natural;
begin
- -- Cut_Start point to the first simple name character
+ -- Cut_Start pointS to the first simple name character
- if Cut_Start = 0 then
- Cut_Start := Path'First;
-
- else
- Cut_Start := Cut_Start + 1;
- end if;
+ Cut_Start := (if Cut_Start = 0 then Path'First else Cut_Start + 1);
-- Cut_End point to the last simple name character
diff --git a/gcc/ada/a-teioed.adb b/gcc/ada/a-teioed.adb
index e2408a45194..cfe64c3b64e 100644
--- a/gcc/ada/a-teioed.adb
+++ b/gcc/ada/a-teioed.adb
@@ -71,16 +71,16 @@ package body Ada.Text_IO.Editing is
case Picture (Picture_Index) is
when '(' =>
- Int_IO.Get (Picture (Picture_Index + 1 .. Picture'Last),
- Count, Last);
+ Int_IO.Get
+ (Picture (Picture_Index + 1 .. Picture'Last), Count, Last);
if Picture (Last + 1) /= ')' then
raise Picture_Error;
end if;
- -- In what follows note that one copy of the repeated
- -- character has already been made, so a count of one is a
- -- no-op, and a count of zero erases a character.
+ -- In what follows note that one copy of the repeated character
+ -- has already been made, so a count of one is a no-op, and a
+ -- count of zero erases a character.
if Result_Index + Count - 2 > Result'Last then
raise Picture_Error;
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 19bbf7075ee..c3405daaf44 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3502,7 +3502,7 @@ __gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED,
return -1;
if (close_on_exec_p)
return ! SetHandleInformation (h, HANDLE_FLAG_INHERIT, 0);
- return ! SetHandleInformation (h, HANDLE_FLAG_INHERIT,
+ return ! SetHandleInformation (h, HANDLE_FLAG_INHERIT,
HANDLE_FLAG_INHERIT);
#else
/* TODO: Unimplemented. */
diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb
index 43680b1b4bb..da6c8a688ed 100644
--- a/gcc/ada/comperr.adb
+++ b/gcc/ada/comperr.adb
@@ -32,6 +32,7 @@ with Debug; use Debug;
with Errout; use Errout;
with Gnatvsn; use Gnatvsn;
with Namet; use Namet;
+with Opt; use Opt;
with Osint; use Osint;
with Output; use Output;
with Sinput; use Sinput;
@@ -121,19 +122,26 @@ package body Comperr is
-- practical interface, since giving scary bug boxes on unsupported
-- features is definitely not helpful.
+ -- Similarly if we are generating SCIL, an error message is sufficient
+ -- instead of generating a bug box.
+
-- Note that the call to Error_Msg_N below sets Serious_Errors_Detected
-- to 1, so we use the regular mechanism below in order to display a
-- "compilation abandoned" message and exit, so we still know we have
-- this case (and -gnatdk can still be used to get the bug box).
- if VM_Target = CLI_Target
+ if (VM_Target = CLI_Target or else CodePeer_Mode)
and then Serious_Errors_Detected = 0
and then not Debug_Flag_K
and then Sloc (Current_Error_Node) > No_Location
then
- Error_Msg_N
- ("unsupported construct in this context",
- Current_Error_Node);
+ if VM_Target = CLI_Target then
+ Error_Msg_N
+ ("unsupported construct in this context",
+ Current_Error_Node);
+ else
+ Error_Msg_N ("cannot generate 'S'C'I'L", Current_Error_Node);
+ end if;
end if;
-- If any errors have already occurred, then we guess that the abort
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index c0861e30890..414e5670115 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -95,10 +95,11 @@ package body Exp_Ch3 is
(Rec_Id : Entity_Id;
Use_Dl : Boolean) return List_Id;
-- This function uses the discriminants of a type to build a list of
- -- formal parameters, used in the following function. If the flag Use_Dl
- -- is set, the list is built using the already defined discriminals
- -- of the type. Otherwise new identifiers are created, with the source
- -- names of the discriminants.
+ -- formal parameters, used in Build_Init_Procedure among other places.
+ -- If the flag Use_Dl is set, the list is built using the already
+ -- defined discriminals of the type, as is the case for concurrent
+ -- types with discriminants. Otherwise new identifiers are created,
+ -- with the source names of the discriminants.
function Build_Equivalent_Array_Aggregate (T : Entity_Id) return Node_Id;
-- This function builds a static aggregate that can serve as the initial
@@ -1141,6 +1142,7 @@ package body Exp_Ch3 is
Parameter_List : constant List_Id := New_List;
D : Entity_Id;
Formal : Entity_Id;
+ Formal_Type : Entity_Id;
Param_Spec_Node : Node_Id;
begin
@@ -1151,15 +1153,17 @@ package body Exp_Ch3 is
if Use_Dl then
Formal := Discriminal (D);
+ Formal_Type := Etype (Formal);
else
Formal := Make_Defining_Identifier (Loc, Chars (D));
+ Formal_Type := Etype (D);
end if;
Param_Spec_Node :=
Make_Parameter_Specification (Loc,
Defining_Identifier => Formal,
Parameter_Type =>
- New_Reference_To (Etype (D), Loc));
+ New_Reference_To (Formal_Type, Loc));
Append (Param_Spec_Node, Parameter_List);
Next_Discriminant (D);
end loop;
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 955d3f6a898..949027dd0ae 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -4039,8 +4039,10 @@ package body Exp_Ch4 is
-- and replace the conditional expression by a reference to Cnn
-- ??? Note: this expansion is wrong for limited types, since it does
- -- a copy of a limited value. The proper fix would be to do the
- -- following expansion:
+ -- a copy of a limited value. Similarly it's wrong for unconstrained or
+ -- class-wide types since in neither case can we have an uninitialized
+ -- object declaration The proper fix would be to do the following
+ -- expansion:
-- Cnn : access typ;
-- if cond then
@@ -7445,7 +7447,7 @@ package body Exp_Ch4 is
-- processing will still generate the appropriate copy in operation,
-- which will take care of the slice.
- procedure Make_Temporary;
+ procedure Make_Temporary_For_Slice;
-- Create a named variable for the value of the slice, in cases where
-- the back-end cannot handle it properly, e.g. when packed types or
-- unaligned slices are involved.
@@ -7484,14 +7486,13 @@ package body Exp_Ch4 is
end loop;
end Is_Procedure_Actual;
- --------------------
- -- Make_Temporary --
- --------------------
+ ------------------------------
+ -- Make_Temporary_For_Slice --
+ ------------------------------
- procedure Make_Temporary is
+ procedure Make_Temporary_For_Slice is
Decl : Node_Id;
- Ent : constant Entity_Id :=
- Make_Defining_Identifier (Loc, New_Internal_Name ('T'));
+ Ent : constant Entity_Id := Make_Temporary (Loc, 'T', N);
begin
Decl :=
Make_Object_Declaration (Loc,
@@ -7508,7 +7509,7 @@ package body Exp_Ch4 is
Rewrite (N, New_Occurrence_Of (Ent, Loc));
Analyze_And_Resolve (N, Typ);
- end Make_Temporary;
+ end Make_Temporary_For_Slice;
-- Start of processing for Expand_N_Slice
@@ -7563,7 +7564,7 @@ package body Exp_Ch4 is
if Nkind (Parent (N)) = N_Function_Call
and then Is_Possibly_Unaligned_Slice (N)
then
- Make_Temporary;
+ Make_Temporary_For_Slice;
end if;
elsif Nkind (Parent (N)) = N_Assignment_Statement
@@ -7584,7 +7585,7 @@ package body Exp_Ch4 is
return;
else
- Make_Temporary;
+ Make_Temporary_For_Slice;
end if;
end Expand_N_Slice;
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
index 3e8fc6a7d7a..a4f6a66fd9b 100644
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -3554,8 +3554,18 @@ package body Exp_Ch7 is
Loc : constant Source_Ptr := Sloc (N);
E : constant Entity_Id := Make_Temporary (Loc, 'E', N);
Etyp : constant Entity_Id := Etype (N);
+ Expr : constant Node_Id := Relocate_Node (N);
begin
+ -- If the relocated node is a function call then check if some SCIL
+ -- node references it and needs readjustment.
+
+ if Generate_SCIL
+ and then Nkind (N) = N_Function_Call
+ then
+ Adjust_SCIL_Node (N, Expr);
+ end if;
+
Insert_Actions (N, New_List (
Make_Object_Declaration (Loc,
Defining_Identifier => E,
@@ -3565,7 +3575,7 @@ package body Exp_Ch7 is
Action =>
Make_Assignment_Statement (Loc,
Name => New_Reference_To (E, Loc),
- Expression => Relocate_Node (N)))));
+ Expression => Expr))));
Rewrite (N, New_Reference_To (E, Loc));
Analyze_And_Resolve (N, Etyp);
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index 3a7fa25065d..526a2dd552c 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -53,6 +53,7 @@ with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch11; use Sem_Ch11;
with Sem_Elab; use Sem_Elab;
+with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
@@ -7522,7 +7523,7 @@ package body Exp_Ch9 is
Loc : constant Source_Ptr := Sloc (N);
Prot_Typ : constant Entity_Id := Defining_Identifier (N);
- Pdef : constant Node_Id := Protected_Definition (N);
+ Pdef : constant Node_Id := Protected_Definition (N);
-- This contains two lists; one for visible and one for private decls
Rec_Decl : Node_Id;
@@ -7547,6 +7548,13 @@ package body Exp_Ch9 is
-- to the internal body, for possible inlining later on. The source
-- operation is invisible to the back-end and is never actually called.
+ function Static_Component_Size (Comp : Entity_Id) return Boolean;
+ -- When compiling under the Ravenscar profile, private components must
+ -- have a static size, or else a protected object will require heap
+ -- allocation, violating the corresponding restriction. It is preferable
+ -- to make this check here, because it provides a better error message
+ -- than the back-end, which refers to the object as a whole.
+
procedure Register_Handler;
-- For a protected operation that is an interrupt handler, add the
-- freeze action that will register it as such.
@@ -7563,6 +7571,40 @@ package body Exp_Ch9 is
end if;
end Check_Inlining;
+ ---------------------------------
+ -- Check_Static_Component_Size --
+ ---------------------------------
+
+ function Static_Component_Size (Comp : Entity_Id) return Boolean is
+ Typ : constant Entity_Id := Etype (Comp);
+ C : Entity_Id;
+
+ begin
+ if Is_Scalar_Type (Typ) then
+ return True;
+
+ elsif Is_Array_Type (Typ) then
+ return Compile_Time_Known_Bounds (Typ);
+
+ elsif Is_Record_Type (Typ) then
+ C := First_Component (Typ);
+ while Present (C) loop
+ if not Static_Component_Size (C) then
+ return False;
+ end if;
+
+ Next_Component (C);
+ end loop;
+
+ return True;
+
+ -- Any other types will be checked by the back-end
+
+ else
+ return True;
+ end if;
+ end Static_Component_Size;
+
----------------------
-- Register_Handler --
----------------------
@@ -7754,6 +7796,24 @@ package body Exp_Ch9 is
while Present (Priv) loop
if Nkind (Priv) = N_Component_Declaration then
+ if not Static_Component_Size (Defining_Identifier (Priv)) then
+
+ -- When compiling for a restricted profile, the private
+ -- components must have a static size. If not, this is an
+ -- error for a single protected declaration, and rates a
+ -- warning on a protected type declaration.
+
+ if not Comes_From_Source (Prot_Typ) then
+ Check_Restriction (No_Implicit_Heap_Allocations, Priv);
+
+ elsif Restriction_Active (No_Implicit_Heap_Allocations) then
+ Error_Msg_N ("component has non-static size?", Priv);
+ Error_Msg_NE
+ ("\creation of protected object of type& will violate"
+ & " restriction No_Implicit_Heap_Allocations?",
+ Priv, Prot_Typ);
+ end if;
+ end if;
-- The component definition consists of a subtype indication,
-- or (in Ada 2005) an access definition. Make a copy of the
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb
index a38e4d8b943..f34b1e9af33 100644
--- a/gcc/ada/exp_disp.adb
+++ b/gcc/ada/exp_disp.adb
@@ -6915,13 +6915,12 @@ package body Exp_Disp is
begin
pragma Assert (Present (First_Tag_Component (Typ)));
- -- Set the DT_Position for each primitive operation. Perform some
- -- sanity checks to avoid to build completely inconsistent dispatch
- -- tables.
+ -- Set the DT_Position for each primitive operation. Perform some sanity
+ -- checks to avoid building inconsistent dispatch tables.
- -- First stage: Set the DTC entity of all the primitive operations
- -- This is required to properly read the DT_Position attribute in
- -- the latter stages.
+ -- First stage: Set the DTC entity of all the primitive operations. This
+ -- is required to properly read the DT_Position attribute in the latter
+ -- stages.
Prim_Elmt := First_Prim;
Count_Prim := 0;
@@ -6931,7 +6930,8 @@ package body Exp_Disp is
-- Predefined primitives have a separate dispatch table
if not (Is_Predefined_Dispatching_Operation (Prim)
- or else Is_Predefined_Dispatching_Alias (Prim))
+ or else
+ Is_Predefined_Dispatching_Alias (Prim))
then
Count_Prim := Count_Prim + 1;
end if;
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
index 36b03387e38..fcf3878f61d 100644
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -1320,13 +1320,15 @@ package body Exp_Util is
Rewrite (Subtype_Indic, New_Reference_To (T, Loc));
- -- nothing needs to be done for private types with unknown discriminants
- -- if the underlying type is not an unconstrained composite type.
+ -- Nothing needs to be done for private types with unknown discriminants
+ -- if the underlying type is not an unconstrained composite type or it
+ -- is an unchecked union.
elsif Is_Private_Type (Unc_Type)
and then Has_Unknown_Discriminants (Unc_Type)
and then (not Is_Composite_Type (Underlying_Type (Unc_Type))
- or else Is_Constrained (Underlying_Type (Unc_Type)))
+ or else Is_Constrained (Underlying_Type (Unc_Type))
+ or else Is_Unchecked_Union (Underlying_Type (Unc_Type)))
then
null;
diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
index 581d977436a..3285acc401c 100644
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -351,7 +351,7 @@ begin
-- Output waiting warning messages
- Sem_Warn.Output_Non_Modifed_In_Out_Warnings;
+ Sem_Warn.Output_Non_Modified_In_Out_Warnings;
Sem_Warn.Output_Unreferenced_Messages;
Sem_Warn.Check_Unused_Withs;
Sem_Warn.Output_Unused_Warnings_Off_Warnings;
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index c5efdb5d214..eec47d4c009 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -3235,17 +3235,18 @@ ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/restrict.ads ada/rident.ads ada/rtsfind.ads ada/rtsfind.adb \
ada/sem.ads ada/sem_aux.ads ada/sem_ch13.ads ada/sem_ch13.adb \
- ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_dist.ads ada/sem_eval.ads \
- ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_warn.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-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
- ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
- ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uintp.adb ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
+ ada/sem_ch3.ads ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_dist.ads \
+ ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
+ ada/sem_warn.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-soflin.ads \
+ ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
+ ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
+ ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb
ada/sem_ch2.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 d487716cc53..d454a5faead 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -2349,7 +2349,7 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
$(MAKE) -C $(RTSDIR) \
CC="`echo \"$(GCC_FOR_TARGET)\" \
- | sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
+ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
INCLUDES="$(INCLUDES_FOR_SUBDIR) -I./../.." \
CFLAGS="$(GNATLIBCFLAGS_FOR_C)" \
FORCE_DEBUG_ADAFLAGS="$(FORCE_DEBUG_ADAFLAGS)" \
@@ -2357,7 +2357,7 @@ gnatlib: ../stamp-gnatlib1-$(RTSDIR) ../stamp-gnatlib2-$(RTSDIR)
-f ../Makefile $(LIBGNAT_OBJS)
$(MAKE) -C $(RTSDIR) \
CC="`echo \"$(GCC_FOR_TARGET)\" \
- | sed -e 's,^\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
+ | sed -e 's,\./xgcc,../../xgcc,' -e 's,-B\./,-B../../,'`" \
ADA_INCLUDES="" \
CFLAGS="$(GNATLIBCFLAGS)" \
ADAFLAGS="$(GNATLIBFLAGS)" \
diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
index 05a46869f6e..a6171b26578 100644
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -677,8 +677,7 @@ extern tree create_label_decl (tree label_name);
appearing in the subprogram. */
extern void begin_subprog_body (tree subprog_decl);
-/* Finish the definition of the current subprogram BODY and compile it all the
- way to assembler language output. */
+/* Finish the definition of the current subprogram BODY and finalize it. */
extern void end_subprog_body (tree body);
/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 0dcc5937e1a..84053a4c2e8 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -626,8 +626,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
/* Finally see if we have any elaboration procedures to deal with. */
for (info = elab_info_list; info; info = info->next)
{
- tree gnu_body = DECL_SAVED_TREE (info->elab_proc);
- tree gnu_stmts;
+ tree gnu_body = DECL_SAVED_TREE (info->elab_proc), gnu_stmts;
/* Unshare SAVE_EXPRs between subprograms. These are not unshared by
the gimplifier for obvious reasons, but it turns out that we need to
@@ -639,21 +638,16 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
an upstream bug for which we would not change the outcome. */
walk_tree_without_duplicates (&gnu_body, unshare_save_expr, NULL);
-
- /* We should have a BIND_EXPR, but it may or may not have any statements
- in it. If it doesn't have any, we have nothing to do. */
+ /* We should have a BIND_EXPR but it may not have any statements in it.
+ If it doesn't have any, we have nothing to do except for setting the
+ flag on the GNAT node. Otherwise, process the function as others. */
gnu_stmts = gnu_body;
if (TREE_CODE (gnu_stmts) == BIND_EXPR)
gnu_stmts = BIND_EXPR_BODY (gnu_stmts);
-
- /* If there are no statements, there is no elaboration code. */
if (!gnu_stmts || !STATEMENT_LIST_HEAD (gnu_stmts))
- {
- Set_Has_No_Elaboration_Code (info->gnat_node, 1);
- }
+ Set_Has_No_Elaboration_Code (info->gnat_node, 1);
else
{
- /* Process the function as others. */
begin_subprog_body (info->elab_proc);
end_subprog_body (gnu_body);
}
@@ -5294,12 +5288,11 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result = alloc_stmt_list ();
break;
- /* SCIL nodes require no processing by this backend */
-
case N_SCIL_Dispatch_Table_Object_Init:
case N_SCIL_Dispatch_Table_Tag_Init:
case N_SCIL_Dispatching_Call:
case N_SCIL_Tag_Init:
+ /* SCIL nodes require no processing for GCC. */
gnu_result = alloc_stmt_list ();
break;
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 1548f6de8bd..e61a0fad537 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -2069,8 +2069,7 @@ gnat_genericize (tree fndecl)
pointer_set_destroy (p_set);
}
-/* Finish the definition of the current subprogram BODY and compile it all the
- way to assembler language output. */
+/* Finish the definition of the current subprogram BODY and finalize it. */
void
end_subprog_body (tree body)
@@ -2109,8 +2108,7 @@ end_subprog_body (tree body)
/* Dump functions before gimplification. */
dump_function (TDI_original, fndecl);
- /* We do different things for nested and non-nested functions.
- ??? This should be in cgraph. */
+ /* ??? This special handling of nested functions is probably obsolete. */
if (!DECL_CONTEXT (fndecl))
cgraph_finalize_function (fndecl, false);
else
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index c1feece8654..7a65203b7fe 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -19433,7 +19433,7 @@ or @code{pragma Convention}.
Here is an example of simple library interface for use with C main program:
@smallexample @c ada
-package Interface is
+package My_Package is
procedure Do_Something;
pragma Export (C, Do_Something, "do_something");
@@ -19441,7 +19441,7 @@ package Interface is
procedure Do_Something_Else;
pragma Export (C, Do_Something_Else, "do_something_else");
-end Interface;
+end My_Package;
@end smallexample
@noindent
@@ -20689,7 +20689,8 @@ rules to be checked by @command{gnatcheck} (@pxref{gnatcheck Rule Options}).
@end itemize
@noindent
-Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supplied.
+Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be
+supplied.
@menu
* Format of the Report File::
@@ -20709,18 +20710,18 @@ Either a @file{@var{filename}} or an @file{@var{arg_list_filename}} must be supp
The @command{gnatcheck} tool outputs on @file{stdout} all messages concerning
rule violations.
It also creates a text file that
-contains the complete report of the last gnatcheck run. By default this file is
-named named @file{^gnatcheck.out^GNATCHECK.OUT^} and it is located in the current
-directory, @option{^-o^/OUTPUT^} option can be used to change the name and/or
-location of the report file. This report contains:
+contains the complete report of the last gnatcheck run. By default this file
+is named named @file{^gnatcheck.out^GNATCHECK.OUT^} and it is located in the
+current directory; the @option{^-o^/OUTPUT^} option can be used to change the
+name and/or location of the report file. This report contains:
@itemize @bullet
@item date and time of @command{gnatcheck} run, the version of
-the tool that has generated this report and the full paarmeters
+the tool that has generated this report and the full parameters
of the @command{gnatcheck} invocation;
-@item the list of enabled rules;
-@item the total number of detected violations;
-@item list of source files for that rule violations have been detected;
-@item list of source files with no violations detected;
+@item list of enabled rules;
+@item total number of detected violations;
+@item list of source files where rule violations have been detected;
+@item list of source files where no violations have been detected.
@end itemize
@node General gnatcheck Switches
@@ -20734,7 +20735,7 @@ The following switches control the general @command{gnatcheck} behavior
@cindex @option{^-a^/ALL^} (@command{gnatcheck})
@item ^-a^/ALL^
Process all units including those with read-only ALI files such as
-those from GNAT Run-Time library.
+those from the GNAT Run-Time library.
@ifclear vms
@ignore
@@ -20745,7 +20746,7 @@ Debug mode
@cindex @option{-dd} (@command{gnatcheck})
@item -dd
-Progress indicator mode (for use in GPS)
+Progress indicator mode (for use in GPS).
@end ifclear
@cindex @option{^-h^/HELP^} (@command{gnatcheck})
@@ -20762,19 +20763,20 @@ instantiated.
@cindex @option{^-log^/LOG^} (@command{gnatcheck})
@item ^-log^/LOG^
-Duplicate all the output sent to Stderr into a log file. The log file is
-named @var{gnatcheck.log} and is located in the current directory.
+Duplicate all the output sent to @file{stderr} into a log file. The log file
+is named @file{gnatcheck.log} and is located in the current directory.
@cindex @option{^-m^/DIAGNOSTIC_LIMIT^} (@command{gnatcheck})
-@item ^-m@i{nnn}^/DIAGNOSTIC_LIMIT=@i{nnn}^
-Maximum number of diagnoses to be sent to Stdout, @i{nnn} from o@dots{}1000,
+@item ^-m@i{nnnn}^/DIAGNOSTIC_LIMIT=@i{nnnn}^
+Maximum number of diagnostics to be sent to @file{stdout}, where @i{nnnn} is in
+the range 0@dots{}1000;
the default value is 500. Zero means that there is no limitation on
-the number of diagnostic messages to be printed into Stdout.
+the number of diagnostic messages to be output.
@cindex @option{^-q^/QUIET^} (@command{gnatcheck})
@item ^-q^/QUIET^
-Quiet mode. All the diagnoses about rule violations are placed in the
-@command{gnatcheck} report file only, without duplicating in @file{stdout}.
+Quiet mode. All the diagnostics about rule violations are placed in the
+@command{gnatcheck} report file only, without duplication on @file{stdout}.
@cindex @option{^-s^/SHORT^} (@command{gnatcheck})
@item ^-s^/SHORT^
@@ -20787,11 +20789,11 @@ Include the compiler-style section in the report file
@cindex @option{^-s2^/BY_RULES^} (@command{gnatcheck})
@item ^-s2^/BY_RULES^
-Include the section containing diagnoses ordered by rules in the report file
+Include the section containing diagnostics ordered by rules in the report file
@cindex @option{^-s3^/BY_FILES_BY_RULES^} (@command{gnatcheck})
@item ^-s3^/BY_FILES_BY_RULES^
-Include the section containing diagnoses ordered by files and then by rules
+Include the section containing diagnostics ordered by files and then by rules
in the report file
@cindex @option{^-t^/TIME^} (@command{gnatcheck})
@@ -20884,30 +20886,43 @@ the following rule identifiers and parameters:
@table @option
@item Restrictions
-To record restrictions violations (that are performed by the compiler if the
+To record restrictions violations (which are performed by the compiler if the
pragma @code{Restrictions} or @code{Restriction_Warnings} are given),
-use the rule named
-@code{Restrictions} with the same parameters as pragma
+use the @code{Restrictions} rule
+with the same parameters as pragma
@code{Restrictions} or @code{Restriction_Warnings}.
@item Style_Checks
-To record compiler style checks(@pxref{Style Checking}), use the rule named
-@code{Style_Checks}. A parameter of this rule can be either @code{All_Checks},
-which enables all the standard style checks that corresponds to @option{-gnatyy}
-GNAT style check option, or a string that has exactly the same
-structure and semantics as the @code{string_LITERAL} parameter of GNAT pragma
-@code{Style_Checks} (for further information about this pragma,
-@pxref{Pragma Style_Checks,,, gnat_rm, GNAT Reference Manual}). For example,
-@code{+RStyle_Checks:O} rule option activates and adds to @command{gnatcheck}
-output the compiler style check that corresponds to
+To record compiler style checks (@pxref{Style Checking}), use the
+@code{Style_Checks} rule.
+This rule takes a parameter in one of the following forms:
+@itemize
+@item
+@code{All_Checks},
+which enables the standard style checks corresponding to the @option{-gnatyy}
+GNAT style check option, or
+
+@item
+a string with the same
+structure and semantics as the @code{string_LITERAL} parameter of the
+GNAT pragma @code{Style_Checks}
+(for further information about this pragma,
+@pxref{Pragma Style_Checks,,, gnat_rm, GNAT Reference Manual}).
+@end itemize
+
+@noindent
+For example, the
+@code{+RStyle_Checks:O} rule option activates
+the compiler style check that corresponds to
@code{-gnatyO} style check option.
@item Warnings
-To record compiler warnings (@pxref{Warning Message Control}), use the rule
-named @code{Warnings} with a parameter that is a valid
-@i{static_string_expression} argument of GNAT pragma @code{Warnings}
-(for further information about this pragma, @pxref{Pragma Warnings,,,
-gnat_rm, GNAT Reference Manual}). Note, that in case of gnatcheck
+To record compiler warnings (@pxref{Warning Message Control}), use the
+@code{Warnings} rule with a parameter that is a valid
+@i{static_string_expression} argument of the GNAT pragma @code{Warnings}
+(for further information about this pragma,
+@pxref{Pragma Warnings,,,gnat_rm, GNAT Reference Manual}).
+Note that in case of gnatcheck
's' parameter, that corresponds to the GNAT @option{-gnatws} option, disables
all the specific warnings, but not suppresses the warning mode,
and 'e' parameter, corresponding to @option{-gnatwe} that means
@@ -20953,19 +20968,24 @@ the @option{-U} option followed by the name of the main unit:
@cindex Rule exemption (for @command{gnatcheck})
@noindent
-@command{gnatcheck} can be used to inforce a coding standard. It may be
-appropriate, in some circumstances, to accept violations of the coding
-standard. In such a case, it is a good idea to justify the violation within
-the sources themselves. It makes it possible to maintain the justification
-for such violations along with the sources containing them.
-@command{gnatcheck} supports such justified violations with the notion of
-``exemption'' covering a specific source code section. Usually,
-@command{gnatcheck} issues rule violation messages both on @file{stderr}
-and in a report file. Exempted violations are not reported at all on
-@file{stderr} so that users using @command{gnatcheck} in interactive mode
+One of the most useful applications of @command{gnatcheck} is to
+automate the enforcement of project-specific coding standards,
+for example in safety-critical systems where particular features
+must be restricted in order to simplify the certification effort.
+However, it may sometimes be appropriate to violate a coding standard rule,
+and in such cases the rationale for the violation should be provided
+in the source program itself so that the individuals
+reviewing or maintaining the program can immediately understand the intent.
+
+The @command{gnatcheck} tool supports this practice with the notion of
+a ``rule exemption'' covering a specific source code section. Normally
+rule violation messages are issued both on @file{stderr}
+and in a report file. In contrast, exempted violations are not listed on
+@file{stderr}; thus users invoking @command{gnatcheck} interactively
(e.g. in its GPS interface) do not need to pay attention to known and
-justified violations. The @command{gnatcheck} report includes exempted
-violations in a special section along with their justification.
+justified violations. However, exempted violations along with their
+justification are documented in a special section of the report file that
+@command{gnatcheck} generates.
@menu
* Using pragma Annotate to Control Rule Exemption::
@@ -20977,33 +20997,36 @@ violations in a special section along with their justification.
@cindex Using pragma Annotate to control rule exemption
@noindent
-Rule exemption is controlled by pragma @code{Annotate} when its first parameter is
-``gnatcheck''. Here is the syntax of @command{gnatcheck} annotations:
+Rule exemption is controlled by pragma @code{Annotate} when its first
+argument is ``gnatcheck''. The syntax of @command{gnatcheck}'s
+exemption control annotations is as follows:
@smallexample @c ada
-pragma Annotate (gnatcheck, exemption_control, Rule_Name, [justification]);
-
-exemption_control ::= "Exempt_On" | "Exempt_Off"
+@group
+pragma Annotate (gnatcheck, @i{exemption_control}, @i{Rule_Name}, [@i{justification}]);
-Rule_Name ::= string_literal
+@i{exemption_control} ::= "Exempt_On" | "Exempt_Off"
-justification ::= string_literal
+@i{Rule_Name} ::= string_literal
+@i{justification} ::= string_literal
+@end group
@end smallexample
@noindent
-When a @command{gnatcheck} annotatation has more then four parameters,
-@command{gnatcheck} issues a warning and ignore additional parameters.
-If the additional parameters do not follow the syntax above,
+When a @command{gnatcheck} annotation has more then four arguments,
+@command{gnatcheck} issues a warning and ignores the additional arguments.
+If the additional arguments do not follow the syntax above,
@command{gnatcheck} emits a warning and ignores the annotation.
-@code{Rule_Name} should be the name of some existing @command{gnatcheck} rule.
-If this is not the case, the warning message is generated and the pragma is
+The @i{@code{Rule_Name}} argument should be the name of some existing
+@command{gnatcheck} rule.
+Otherwise a warning message is generated and the pragma is
ignored. If @code{Rule_Name} denotes a rule that is not activated by the given
-@command{gnatcheck} call, the pragma is ignored silently.
+@command{gnatcheck} call, the pragma is ignored and no warning is issued.
-A source code section where an exemption is active for a given rule starts with
-an extempt_on annotation and terminates with an exempt_off one:
+A source code section where an exemption is active for a given rule is
+delimited by an @code{exempt_on} and @code{exempt_off} annotation pair:
@smallexample @c ada
pragma Annotate (gnatcheck, "Exempt_On", Rule_Name, "justification");
@@ -21019,34 +21042,32 @@ pragma Annotate (gnatcheck, "Exempt_Off", Rule_Name);
@itemize @bullet
@item
-an ``Exempt_Off'' annotation can only appear after a corresponding
-``Exempt_On'' annotation in order to create a properly formed exempted source
-code section;
+An ``Exempt_Off'' annotation can only appear after a corresponding
+``Exempt_On'' annotation.
@item
-exempted source code sections are only based on the source location of the
-annotations. Any source construct having a source location in between the two
-annotations is part of the exempted source code section;
+Exempted source code sections are only based on the source location of the
+annotations. Any source construct between the two
+annotations is part of the exempted source code section.
@item
-exempted source code sections for different rules are independent. They can
-be nested or intersect with one another without limitation. It is not allowed
-to create nested or intersecting source code sections for the same rule;
+Exempted source code sections for different rules are independent. They can
+be nested or intersect with one another without limitation.
+Creating nested or intersecting source code sections for the same rule is
+not allowed.
@item
-malformed exempted source code sections are reported by a warning and
-the corresponding rule exemption is ignored;
+Malformed exempted source code sections are reported by a warning, and
+the corresponding rule exemptions are ignored.
@item
-when an exempted source code section does not contain at least one violation
-of the exempted rule, a warning is emitted on @file{stderr}. This allow proper
-maintenance of exempted source code sections;
+When an exempted source code section does not contain at least one violation
+of the exempted rule, a warning is emitted on @file{stderr}.
@item
-if an exempted source code section reaches the end of the compilation unit
-source and there is no @code{Annotate} pragma closing this section, then the
-exemption for the given rule is turned off and a warning is issued.
-
+If an ``Exempt_On'' annotation pragma does not have a matching
+``Exempt_Off'' annotation pragma in the same compilation unit, then the
+exemption for the given rule is ignored and a warning is issued.
@end itemize
@@ -21374,14 +21395,14 @@ a type with no parent and no progenitor, and otherwise as 1 + max of the
depths of the immediate parent and immediate progenitors.
This rule does not flag private extension
-declarations. In the case of a private extension, the correspondong full
+declarations. In the case of a private extension, the corresponding full
declaration is checked.
This rule has the following (mandatory) parameter for the @option{+R} option:
@table @emph
@item N
-Integer not less then -1 specifying the maximal allowed depth of any inheritance
+Integer not less than -1 specifying the maximal allowed depth of any inheritance
hierarchy. If the rule parameter is set to -1, the rule flags all the declarations
of tagged and interface types.
@end table
@@ -24960,7 +24981,7 @@ GNAT always follows the Alpha implementation.
For GNAT running on other than VMS systems, all the HP Ada 83 pragmas and
attributes are recognized, although only a subset of them can sensibly
be implemented. The description of pragmas in
-@xref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual}
+@xref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual},
indicates whether or not they are applicable to non-VMS systems.
@menu
@@ -25407,7 +25428,7 @@ pragma Extend_System (Aux_DEC);
@noindent
The pragma @code{Extend_System} is a configuration pragma that
is most conveniently placed in the @file{gnat.adc} file. @xref{Pragma
-Extend_System,,, gnat_rm, GNAT Reference Manual} for further details.
+Extend_System,,, gnat_rm, GNAT Reference Manual}, for further details.
HP Ada does not allow the recompilation of the package
@code{SYSTEM}. Instead HP Ada provides several pragmas
@@ -25438,7 +25459,7 @@ are virtually identical to those provided by the HP Ada 83 package
@code{TO_ADDRESS}
function for type @code{UNSIGNED_LONGWORD} is changed to
@code{TO_ADDRESS_LONG}.
-@xref{Address Clauses,,, gnat_rm, GNAT Reference Manual} for a
+@xref{Address Clauses,,, gnat_rm, GNAT Reference Manual}, for a
discussion of why this change was necessary.
@noindent
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb
index f0e7e7494cb..42d08dcd48f 100644
--- a/gcc/ada/gnatcmd.adb
+++ b/gcc/ada/gnatcmd.adb
@@ -1308,10 +1308,8 @@ begin
Normalize_Pathname
(Command (Command'First .. Index));
- PATH : constant String :=
- Absolute_Dir &
- Path_Separator &
- Getenv ("PATH").all;
+ PATH : constant String :=
+ Absolute_Dir & Path_Separator & Getenv ("PATH").all;
begin
Setenv ("PATH", PATH);
@@ -1460,6 +1458,7 @@ begin
begin
if The_Command = Stack then
+
-- Never call gnatstack with a prefix
Program := new String'(Command_List (The_Command).Unixcmd.all);
@@ -1488,68 +1487,56 @@ begin
end loop;
end if;
- -- For BIND, CHECK, ELIM, FIND, LINK, LIST, PRETTY, STACK, STUB,
- -- METRIC ad XREF, look for project file related switches.
-
- if The_Command = Bind
- or else The_Command = Check
- or else The_Command = Sync
- or else The_Command = Elim
- or else The_Command = Find
- or else The_Command = Link
- or else The_Command = List
- or else The_Command = Xref
- or else The_Command = Pretty
- or else The_Command = Stack
- or else The_Command = Stub
- or else The_Command = Metric
- then
- case The_Command is
- when Bind =>
- Tool_Package_Name := Name_Binder;
- Packages_To_Check := Packages_To_Check_By_Binder;
- when Check =>
- Tool_Package_Name := Name_Check;
- Packages_To_Check := Packages_To_Check_By_Check;
- when Sync =>
- Tool_Package_Name := Name_Synchronize;
- Packages_To_Check := Packages_To_Check_By_Sync;
- when Elim =>
- Tool_Package_Name := Name_Eliminate;
- Packages_To_Check := Packages_To_Check_By_Eliminate;
- when Find =>
- Tool_Package_Name := Name_Finder;
- Packages_To_Check := Packages_To_Check_By_Finder;
- when Link =>
- Tool_Package_Name := Name_Linker;
- Packages_To_Check := Packages_To_Check_By_Linker;
- when List =>
- Tool_Package_Name := Name_Gnatls;
- Packages_To_Check := Packages_To_Check_By_Gnatls;
- when Metric =>
- Tool_Package_Name := Name_Metrics;
- Packages_To_Check := Packages_To_Check_By_Metric;
- when Pretty =>
- Tool_Package_Name := Name_Pretty_Printer;
- Packages_To_Check := Packages_To_Check_By_Pretty;
- when Stack =>
- Tool_Package_Name := Name_Stack;
- Packages_To_Check := Packages_To_Check_By_Stack;
- when Stub =>
- Tool_Package_Name := Name_Gnatstub;
- Packages_To_Check := Packages_To_Check_By_Gnatstub;
- when Xref =>
- Tool_Package_Name := Name_Cross_Reference;
- Packages_To_Check := Packages_To_Check_By_Xref;
- when others =>
- null;
- end case;
+ -- For BIND, CHECK, ELIM, FIND, LINK, LIST, METRIC, PRETTY, STACK, STUB,
+ -- SYNC and XREF, look for project file related switches.
+
+ case The_Command is
+ when Bind =>
+ Tool_Package_Name := Name_Binder;
+ Packages_To_Check := Packages_To_Check_By_Binder;
+ when Check =>
+ Tool_Package_Name := Name_Check;
+ Packages_To_Check := Packages_To_Check_By_Check;
+ when Elim =>
+ Tool_Package_Name := Name_Eliminate;
+ Packages_To_Check := Packages_To_Check_By_Eliminate;
+ when Find =>
+ Tool_Package_Name := Name_Finder;
+ Packages_To_Check := Packages_To_Check_By_Finder;
+ when Link =>
+ Tool_Package_Name := Name_Linker;
+ Packages_To_Check := Packages_To_Check_By_Linker;
+ when List =>
+ Tool_Package_Name := Name_Gnatls;
+ Packages_To_Check := Packages_To_Check_By_Gnatls;
+ when Metric =>
+ Tool_Package_Name := Name_Metrics;
+ Packages_To_Check := Packages_To_Check_By_Metric;
+ when Pretty =>
+ Tool_Package_Name := Name_Pretty_Printer;
+ Packages_To_Check := Packages_To_Check_By_Pretty;
+ when Stack =>
+ Tool_Package_Name := Name_Stack;
+ Packages_To_Check := Packages_To_Check_By_Stack;
+ when Stub =>
+ Tool_Package_Name := Name_Gnatstub;
+ Packages_To_Check := Packages_To_Check_By_Gnatstub;
+ when Sync =>
+ Tool_Package_Name := Name_Synchronize;
+ Packages_To_Check := Packages_To_Check_By_Sync;
+ when Xref =>
+ Tool_Package_Name := Name_Cross_Reference;
+ Packages_To_Check := Packages_To_Check_By_Xref;
+ when others =>
+ Tool_Package_Name := No_Name;
+ end case;
+
+ if Tool_Package_Name /= No_Name then
-- Check that the switches are consistent. Detect project file
-- related switches.
- Inspect_Switches :
- declare
+ Inspect_Switches : declare
Arg_Num : Positive := 1;
Argv : String_Access;
@@ -1909,29 +1896,72 @@ begin
Element : Package_Element;
- Default_Switches_Array : Array_Element_Id;
+ Switches_Array : Array_Element_Id;
The_Switches : Prj.Variable_Value;
Current : Prj.String_List_Id;
The_String : String_Element;
+ Main : String_Access := null;
+ Main_Id : Name_Id;
+
begin
if Pkg /= No_Package then
+
+ -- First, check if there is a single main specified.
+
+ for J in 1 .. Last_Switches.Last loop
+ if Last_Switches.Table (J) (1) /= '-' then
+ if Main = null then
+ Main := Last_Switches.Table (J);
+
+ else
+ Main := null;
+ exit;
+ end if;
+ end if;
+ end loop;
+
Element := Project_Tree.Packages.Table (Pkg);
- Default_Switches_Array :=
- Prj.Util.Value_Of
- (Name => Name_Default_Switches,
- In_Arrays => Element.Decl.Arrays,
- In_Tree => Project_Tree);
- The_Switches := Prj.Util.Value_Of
- (Index => Name_Ada,
- Src_Index => 0,
- In_Array => Default_Switches_Array,
- In_Tree => Project_Tree);
-
- -- If there are switches specified in the package of the
- -- project file corresponding to the tool, scan them.
+ -- If there is a single main and there is compilation
+ -- switches specified in the project file, use them.
+
+ if Main /= null and then not All_Projects then
+ Name_Len := Main'Length;
+ Name_Buffer (1 .. Name_Len) := Main.all;
+ Canonical_Case_File_Name (Name_Buffer (1 .. Name_Len));
+ Main_Id := Name_Find;
+
+ Switches_Array :=
+ Prj.Util.Value_Of
+ (Name => Name_Switches,
+ In_Arrays => Element.Decl.Arrays,
+ In_Tree => Project_Tree);
+ The_Switches := Prj.Util.Value_Of
+ (Index => Main_Id,
+ Src_Index => 0,
+ In_Array => Switches_Array,
+ In_Tree => Project_Tree);
+ end if;
+
+ -- Otherwise, get the Default_Switches ("Ada")
+
+ if The_Switches.Kind = Undefined then
+ Switches_Array :=
+ Prj.Util.Value_Of
+ (Name => Name_Default_Switches,
+ In_Arrays => Element.Decl.Arrays,
+ In_Tree => Project_Tree);
+ The_Switches := Prj.Util.Value_Of
+ (Index => Name_Ada,
+ Src_Index => 0,
+ In_Array => Switches_Array,
+ In_Tree => Project_Tree);
+ end if;
+
+ -- If there are switches specified, put them in the
+ -- Carg_Switches table.
case The_Switches.Kind is
when Prj.Undefined =>
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index 998e1e4a2da..20fc989a015 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -197,6 +197,9 @@ package body Make is
RTS_Specified : String_Access := null;
-- Used to detect multiple --RTS= switches
+ N_M_Switch : Natural := 0;
+ -- Used to count -mxxx switches that can affect multilib
+
type Q_Record is record
File : File_Name_Type;
Unit : Unit_Name_Type;
@@ -516,10 +519,6 @@ package body Make is
Last_Argument : Natural := 0;
-- Last index of arguments in Arguments above
- Arguments_Collected : Boolean := False;
- -- Set to True when the arguments for the next invocation of the compiler
- -- have been collected.
-
Arguments_Project : Project_Id;
-- Project id, if any, of the source to be compiled
@@ -641,6 +640,9 @@ package body Make is
-- directory of the ultimate extending project. If it is not, we ignore
-- the fact that this ALI file is read-only.
+ procedure Process_Multilib;
+ -- Add appropriate --RTS argument to handle multilib
+
----------------------------------------------------
-- Compiler, Binder & Linker Data and Subprograms --
----------------------------------------------------
@@ -1353,32 +1355,24 @@ package body Make is
--------------------------------
procedure Change_To_Object_Directory (Project : Project_Id) is
- Actual_Project : Project_Id;
Object_Directory : Path_Name_Type;
begin
- -- For sources outside of any project, compilation occurs in the object
- -- directory of the main project, otherwise we use the project given.
-
- if Project = No_Project then
- Actual_Project := Main_Project;
- else
- Actual_Project := Project;
- end if;
+ pragma Assert (Project /= No_Project);
-- Nothing to do if the current working directory is already the correct
-- object directory.
- if Project_Of_Current_Object_Directory /= Actual_Project then
- Project_Of_Current_Object_Directory := Actual_Project;
- Object_Directory := Actual_Project.Object_Directory.Name;
+ if Project_Of_Current_Object_Directory /= Project then
+ Project_Of_Current_Object_Directory := Project;
+ Object_Directory := 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 (Actual_Project.Display_Name);
+ Write_Name (Project.Display_Name);
Write_Str (""": """);
Write_Name (Object_Directory);
Write_Line ("""");
@@ -1393,9 +1387,9 @@ package body Make is
when Directory_Error =>
Make_Failed ("unable to change to object directory """ &
Path_Or_File_Name
- (Actual_Project.Object_Directory.Name) &
+ (Project.Object_Directory.Name) &
""" of project " &
- Get_Name_String (Actual_Project.Display_Name));
+ Get_Name_String (Project.Display_Name));
end Change_To_Object_Directory;
-----------
@@ -2195,7 +2189,6 @@ package body Make is
Args : Argument_List)
is
begin
- Arguments_Collected := True;
Arguments_Project := No_Project;
Last_Argument := 0;
Add_Arguments (Args);
@@ -2496,13 +2489,12 @@ package body Make is
procedure Check_Standard_Library;
-- Check if s-stalib.adb needs to be compiled
- procedure Collect_Arguments_And_Compile
- (Source_File : File_Name_Type;
- Source_Index : Int);
+ procedure Collect_Arguments_And_Compile (Source_Index : Int);
-- Collect arguments from project file (if any) and compile
function Compile
- (S : File_Name_Type;
+ (Project : Project_Id;
+ S : File_Name_Type;
L : File_Name_Type;
Source_Index : Int;
Args : Argument_List) return Process_Id;
@@ -2703,23 +2695,13 @@ package body Make is
-- Collect_Arguments_And_Compile --
-----------------------------------
- procedure Collect_Arguments_And_Compile
- (Source_File : File_Name_Type;
- Source_Index : Int)
- is
+ procedure Collect_Arguments_And_Compile (Source_Index : Int) is
begin
-- Process_Created will be set True if an attempt is made to compile
-- the source, that is if it is not in an externally built project.
Process_Created := False;
- -- If arguments not yet collected (in Check), collect them now
-
- if not Arguments_Collected then
- Collect_Arguments
- (Source_File, Source_Index, Source_File = Main_Source, Args);
- end if;
-
-- If we use mapping file (-P or -C switches), then get one
if Create_Mapping_File then
@@ -2763,13 +2745,10 @@ package body Make is
end;
end if;
- -- Change to object directory of the project file, if necessary
-
- Change_To_Object_Directory (Arguments_Project);
-
Pid :=
Compile
- (File_Name_Type (Arguments_Path_Name),
+ (Arguments_Project,
+ File_Name_Type (Arguments_Path_Name),
Lib_File,
Source_Index,
Arguments (1 .. Last_Argument));
@@ -2780,12 +2759,13 @@ package body Make is
-- If this is a source outside of any project file, make sure it
-- will be compiled in object directory of the main project file.
- if Main_Project /= No_Project then
- Change_To_Object_Directory (Arguments_Project);
- end if;
-
- Pid := Compile (Full_Source_File, Lib_File, Source_Index,
- Arguments (1 .. Last_Argument));
+ Pid :=
+ Compile
+ (Main_Project,
+ Full_Source_File,
+ Lib_File,
+ Source_Index,
+ Arguments (1 .. Last_Argument));
Process_Created := True;
end if;
end Collect_Arguments_And_Compile;
@@ -2795,7 +2775,8 @@ package body Make is
-------------
function Compile
- (S : File_Name_Type;
+ (Project : Project_Id;
+ S : File_Name_Type;
L : File_Name_Type;
Source_Index : Int;
Args : Argument_List) return Process_Id
@@ -2979,6 +2960,12 @@ package body Make is
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := new String'(Name_Buffer (1 .. Name_Len));
+ -- Change to object directory of the project file, if necessary
+
+ if Project /= No_Project then
+ Change_To_Object_Directory (Project);
+ end if;
+
GNAT.OS_Lib.Normalize_Arguments (Comp_Args (Args'First .. Comp_Last));
Comp_Last := Comp_Last + 1;
@@ -3219,8 +3206,6 @@ package body Make is
-- The source file that we are checking can be located
else
- Arguments_Collected := False;
-
Collect_Arguments (Source_File, Source_Index,
Source_File = Main_Source, Args);
@@ -3308,8 +3293,7 @@ package body Make is
-- Start the compilation and record it. We can do
-- this because there is at least one free process.
- Collect_Arguments_And_Compile
- (Source_File, Source_Index);
+ Collect_Arguments_And_Compile (Source_Index);
-- Make sure we could successfully start
-- the Compilation.
@@ -6570,6 +6554,7 @@ package body Make is
Dependencies.Init;
RTS_Specified := null;
+ N_M_Switch := 0;
Mains.Delete;
@@ -6629,6 +6614,10 @@ package body Make is
Scan_Make_Arg (Argument (Next_Arg), And_Save => True);
end loop Scan_Args;
+ if N_M_Switch > 0 and RTS_Specified = null then
+ Process_Multilib;
+ end if;
+
if Commands_To_Stdout then
Set_Standard_Output;
end if;
@@ -7288,6 +7277,99 @@ package body Make is
Set_Name_Table_Byte (N, B or Mark);
end Mark_Directory;
+ ----------------------
+ -- Process_Multilib --
+ ----------------------
+
+ procedure Process_Multilib is
+ Output_FD : File_Descriptor;
+ Output_Name : String_Access;
+ Arg_Index : Natural := 0;
+ Success : Boolean := False;
+ Return_Code : Integer := 0;
+ Multilib_Gcc_Path : String_Access;
+ Multilib_Gcc : String_Access;
+ N_Read : Integer := 0;
+ Line : String (1 .. 1000);
+ Args : Argument_List (1 .. N_M_Switch + 1);
+
+ begin
+ pragma Assert (N_M_Switch > 0 and RTS_Specified = null);
+
+ -- This loop needs commenting ??? In fact this entire body is
+ -- under-commented ??? And the spec is not much help :-(
+
+ for Next_Arg in 1 .. Argument_Count loop
+ declare
+ Argv : constant String := Argument (Next_Arg);
+ begin
+ if Argv'Length > 2
+ and then Argv (1) = '-'
+ and then Argv (2) = 'm'
+ and then Argv /= "-margs"
+
+ -- Ignore -mieee to avoid spawning an extra gcc in this case
+
+ and then Argv /= "-mieee"
+ then
+ Arg_Index := Arg_Index + 1;
+ Args (Arg_Index) := new String'(Argv);
+ end if;
+ end;
+ end loop;
+
+ pragma Assert (Arg_Index = N_M_Switch);
+
+ Args (Args'Last) := new String'("-print-multi-directory");
+
+ if Saved_Gcc /= null then
+ Multilib_Gcc := Saved_Gcc;
+ else
+ Multilib_Gcc := Gcc;
+ end if;
+
+ Multilib_Gcc_Path := GNAT.OS_Lib.Locate_Exec_On_Path (Multilib_Gcc.all);
+
+ Create_Temp_File (Output_FD, Output_Name);
+
+ if Output_FD = Invalid_FD then
+ return;
+ end if;
+
+ GNAT.OS_Lib.Spawn
+ (Multilib_Gcc_Path.all, Args, Output_FD, Return_Code, False);
+ Close (Output_FD);
+
+ if Return_Code /= 0 then
+ return;
+ end if;
+
+ Output_FD := Open_Read (Output_Name.all, Binary);
+
+ if Output_FD = Invalid_FD then
+ return;
+ end if;
+
+ N_Read := Read (Output_FD, Line (1)'Address, Line'Length);
+ Close (Output_FD);
+ Delete_File (Output_Name.all, Success);
+
+ for J in reverse 1 .. N_Read loop
+ if Line (J) = ASCII.CR or else Line (J) = ASCII.LF then
+ N_Read := N_Read - 1;
+ else
+ exit;
+ end if;
+ end loop;
+
+ if N_Read = 0 or else Line (1 .. N_Read) = "." then
+ return;
+ end if;
+
+ Scan_Make_Arg ("-margs", And_Save => True);
+ Scan_Make_Arg ("--RTS=" & Line (1 .. N_Read), And_Save => True);
+ end Process_Multilib;
+
-----------------------------
-- Recursive_Compute_Depth --
-----------------------------
@@ -7297,6 +7379,7 @@ package body Make is
Seen : Project_Boolean_Htable.Instance := Project_Boolean_Htable.Nil;
procedure Recurse (Prj : Project_Id; Depth : Natural);
+ -- Recursive procedure that does the work, keeping track of the depth
-------------
-- Recurse --
@@ -7762,6 +7845,12 @@ package body Make is
Add_Switch (Argv, Compiler, And_Save => And_Save);
Add_Switch (Argv, Linker, And_Save => And_Save);
+ if Argv (2) = 'm'
+ and then Argv /= "-mieee"
+ then
+ N_M_Switch := N_M_Switch + 1;
+ end if;
+
-- -C=<mapping file>
elsif Argv'Last > 2 and then Argv (2) = 'C' then
diff --git a/gcc/ada/mlib-prj.adb b/gcc/ada/mlib-prj.adb
index d01a329945b..f15b7c06d27 100644
--- a/gcc/ada/mlib-prj.adb
+++ b/gcc/ada/mlib-prj.adb
@@ -1337,18 +1337,23 @@ package body MLib.Prj is
Foreign_Sources := For_Project.Languages.Next /= null;
Current_Proj := For_Project;
-
loop
if Current_Proj.Object_Directory /= No_Path_Information then
+
+ -- The following code gets far too indented, I suggest some
+ -- procedural abstraction here. How about making this declare
+ -- block a named procedure???
+
declare
Object_Dir_Path : constant String :=
Get_Name_String
(Current_Proj.Object_Directory
.Display_Name);
- Object_Dir : Dir_Type;
- Filename : String (1 .. 255);
- Last : Natural;
- Id : Name_Id;
+
+ Object_Dir : Dir_Type;
+ Filename : String (1 .. 255);
+ Last : Natural;
+ Id : Name_Id;
begin
Open (Dir => Object_Dir, Dir_Name => Object_Dir_Path);
@@ -1364,11 +1369,12 @@ package body MLib.Prj is
if Is_Obj (Filename (1 .. Last)) then
declare
- Object_Path : constant String :=
- Normalize_Pathname
- (Object_Dir_Path &
- Directory_Separator &
- Filename (1 .. Last));
+ Object_Path : constant String :=
+ Normalize_Pathname
+ (Object_Dir_Path
+ & Directory_Separator
+ & Filename (1 .. Last));
+
C_Object_Path : String := Object_Path;
C_Filename : String := Filename (1 .. Last);
@@ -1395,21 +1401,27 @@ package body MLib.Prj is
Ext_To
(C_Filename
(1 .. Last), "ali");
+
ALI_Path : constant String :=
Ext_To (C_Object_Path, "ali");
- Add_It : Boolean :=
- Foreign_Sources
- or else
- (Last > 5
- and then
- C_Filename
- (1 .. B_Start'Length) =
- B_Start.all);
- Fname : File_Name_Type;
- Proj : Project_Id;
- Index : Unit_Index;
+
+ Add_It : Boolean;
+ Fname : File_Name_Type;
+ Proj : Project_Id;
+ Index : Unit_Index;
begin
+ -- The following assignment could use
+ -- a comment ???
+
+ Add_It :=
+ Foreign_Sources
+ or else
+ (Last >= 5
+ and then
+ C_Filename (1 .. B_Start'Length)
+ = B_Start.all);
+
if Is_Regular_File (ALI_Path) then
-- If there is an ALI file, check if
@@ -1419,8 +1431,9 @@ package body MLib.Prj is
-- the library.
if not Add_It then
- Index := Units_Htable.Get_First
- (In_Tree.Units_HT);
+ Index :=
+ Units_Htable.Get_First
+ (In_Tree.Units_HT);
while Index /= null loop
if Index.File_Names (Impl) /=
null
@@ -1472,8 +1485,9 @@ package body MLib.Prj is
exit when Add_It;
- Index := Units_Htable.Get_Next
- (In_Tree.Units_HT);
+ Index :=
+ Units_Htable.Get_Next
+ (In_Tree.Units_HT);
end loop;
end if;
@@ -1812,13 +1826,13 @@ package body MLib.Prj is
Canonical_Case_File_Name (Name (1 .. Last));
Delete := False;
- if (The_Build_Mode = Static and then
- Name (1 .. Last) = Archive_Name)
+ if (The_Build_Mode = Static
+ and then Name (1 .. Last) = Archive_Name)
or else
- ((The_Build_Mode = Dynamic or else
- The_Build_Mode = Relocatable)
- and then
- Name (1 .. Last) = DLL_Name)
+ ((The_Build_Mode = Dynamic
+ or else
+ The_Build_Mode = Relocatable)
+ and then Name (1 .. Last) = DLL_Name)
then
Delete := True;
@@ -1835,17 +1849,19 @@ package body MLib.Prj is
while Unit /= No_Unit_Index loop
if Unit.File_Names (Impl) /= null
and then Unit.File_Names (Impl).Project /=
- No_Project
+ No_Project
then
if Ultimate_Extending_Project_Of
- (Unit.File_Names (Impl).Project) =
- For_Project
+ (Unit.File_Names (Impl).Project) =
+ For_Project
then
Get_Name_String
(Unit.File_Names (Impl).File);
- Name_Len := Name_Len -
- File_Extension
- (Name (1 .. Name_Len))'Length;
+ Name_Len :=
+ Name_Len -
+ File_Extension
+ (Name (1 .. Name_Len))'Length;
+
if Name_Buffer (1 .. Name_Len) =
Name (1 .. Last - 4)
then
@@ -1856,18 +1872,16 @@ package body MLib.Prj is
elsif Unit.File_Names (Spec) /= null
and then Ultimate_Extending_Project_Of
- (Unit.File_Names (Spec).Project) =
- For_Project
+ (Unit.File_Names (Spec).Project) =
+ For_Project
then
- Get_Name_String
- (Unit.File_Names (Spec).File);
+ Get_Name_String (Unit.File_Names (Spec).File);
Name_Len :=
Name_Len -
- File_Extension
- (Name (1 .. Name_Len))'Length;
+ File_Extension (Name (1 .. Last))'Length;
if Name_Buffer (1 .. Name_Len) =
- Name (1 .. Last - 4)
+ Name (1 .. Last - 4)
then
Delete := True;
exit;
diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb
index e893ee87c8e..879178de122 100644
--- a/gcc/ada/prj-conf.adb
+++ b/gcc/ada/prj-conf.adb
@@ -29,6 +29,7 @@ with Makeutl; use Makeutl;
with MLib.Tgt;
with Opt; use Opt;
with Output; use Output;
+with Prj.Err;
with Prj.Part;
with Prj.PP;
with Prj.Proc; use Prj.Proc;
@@ -675,7 +676,6 @@ package body Prj.Conf is
Name_Len := 0;
Add_Str_To_Name_Buffer
(Get_Name_String (Project.Directory.Name));
- Add_Char_To_Name_Buffer (Directory_Separator);
Add_Str_To_Name_Buffer (Get_Name_String (Obj_Dir.Value));
end if;
end if;
@@ -723,8 +723,17 @@ package body Prj.Conf is
end if;
if not Is_Directory (Obj_Dir) then
- raise Invalid_Config
- with "object directory " & Obj_Dir & " does not exist";
+ case Flags.Require_Obj_Dirs is
+ when Error =>
+ raise Invalid_Config
+ with "object directory " & Obj_Dir & " does not exist";
+ when Warning =>
+ Prj.Err.Error_Msg
+ (Flags,
+ "?object directory " & Obj_Dir & " does not exist");
+ when Silent =>
+ null;
+ end case;
end if;
-- Invoke gprconfig
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index b070847c89a..0ffacdbdc5b 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -32,6 +32,9 @@ with Tempdir;
package body Prj.Env is
+ Buffer_Initial : constant := 1_000;
+ -- Initial size of Buffer
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -52,6 +55,12 @@ package body Prj.Env is
Table_Increment => 100);
-- A table to store the object dirs, before creating the object path file
+ procedure Add_To_Buffer
+ (S : String;
+ Buffer : in out String_Access;
+ Buffer_Last : in out Natural);
+ -- Add a string to Buffer, extending Buffer if needed
+
procedure Add_To_Path
(Source_Dirs : String_List_Id;
In_Tree : Project_Tree_Ref;
@@ -209,6 +218,33 @@ package body Prj.Env is
return Project.Ada_Objects_Path;
end Ada_Objects_Path;
+ -------------------
+ -- Add_To_Buffer --
+ -------------------
+
+ procedure Add_To_Buffer
+ (S : String;
+ Buffer : in out String_Access;
+ Buffer_Last : in out Natural)
+ is
+ Last : constant Natural := Buffer_Last + S'Length;
+
+ begin
+ while Last > Buffer'Last loop
+ declare
+ New_Buffer : constant String_Access :=
+ new String (1 .. 2 * Buffer'Last);
+ begin
+ New_Buffer (1 .. Buffer_Last) := Buffer (1 .. Buffer_Last);
+ Free (Buffer);
+ Buffer := New_Buffer;
+ end;
+ end loop;
+
+ Buffer (Buffer_Last + 1 .. Last) := S;
+ Buffer_Last := Last;
+ end Add_To_Buffer;
+
------------------------
-- Add_To_Object_Path --
------------------------
@@ -410,6 +446,9 @@ package body Prj.Env is
Namings : Naming_Table.Instance;
-- Table storing the naming data for gnatmake/gprmake
+ Buffer : String_Access := new String (1 .. Buffer_Initial);
+ Buffer_Last : Natural := 0;
+
File_Name : Path_Name_Type := No_Path;
File : File_Descriptor := Invalid_FD;
@@ -417,25 +456,22 @@ package body Prj.Env is
Iter : Source_Iterator;
Source : Source_Id;
- Status : Boolean;
- -- For call to Close
-
procedure Check (Project : Project_Id; State : in out Integer);
-- Recursive procedure that put in the config pragmas file any non
-- standard naming schemes, if it is not already in the file, then call
-- itself for any imported project.
- procedure Check_Temp_File;
- -- Check that a temporary file has been opened.
- -- If not, create one, and put its name in the project data,
- -- with the indication that it is a temporary file.
-
procedure Put (Source : Source_Id);
-- Put an SFN pragma in the temporary file
- procedure Put (File : File_Descriptor; S : String);
- procedure Put_Line (File : File_Descriptor; S : String);
- -- Output procedures, analogous to normal Text_IO procs of same name
+ procedure Put (S : String);
+ procedure Put_Line (S : String);
+ -- Output procedures, analogous to normal Text_IO procs of same name.
+ -- The text is put in Buffer, then it will be writen into a temporary
+ -- file with procedure Write_Temp_File below.
+
+ procedure Write_Temp_File;
+ -- Create a temporary file and put the content of the buffer in it
-----------
-- Check --
@@ -485,113 +521,86 @@ package body Prj.Env is
Naming_Table.Increment_Last (Namings);
Namings.Table (Naming_Table.Last (Namings)) := Naming;
- -- We need a temporary file to be created
-
- Check_Temp_File;
-
-- Put the SFN pragmas for the naming scheme
-- Spec
Put_Line
- (File, "pragma Source_File_Name_Project");
+ ("pragma Source_File_Name_Project");
Put_Line
- (File, " (Spec_File_Name => ""*" &
+ (" (Spec_File_Name => ""*" &
Get_Name_String (Naming.Spec_Suffix) & """,");
Put_Line
- (File, " Casing => " &
+ (" Casing => " &
Image (Naming.Casing) & ",");
Put_Line
- (File, " Dot_Replacement => """ &
+ (" Dot_Replacement => """ &
Get_Name_String (Naming.Dot_Replacement) & """);");
-- and body
Put_Line
- (File, "pragma Source_File_Name_Project");
+ ("pragma Source_File_Name_Project");
Put_Line
- (File, " (Body_File_Name => ""*" &
+ (" (Body_File_Name => ""*" &
Get_Name_String (Naming.Body_Suffix) & """,");
Put_Line
- (File, " Casing => " &
+ (" Casing => " &
Image (Naming.Casing) & ",");
Put_Line
- (File, " Dot_Replacement => """ &
+ (" Dot_Replacement => """ &
Get_Name_String (Naming.Dot_Replacement) &
""");");
-- and maybe separate
if Naming.Body_Suffix /= Naming.Separate_Suffix then
- Put_Line (File, "pragma Source_File_Name_Project");
+ Put_Line ("pragma Source_File_Name_Project");
Put_Line
- (File, " (Subunit_File_Name => ""*" &
+ (" (Subunit_File_Name => ""*" &
Get_Name_String (Naming.Separate_Suffix) & """,");
Put_Line
- (File, " Casing => " &
+ (" Casing => " &
Image (Naming.Casing) & ",");
Put_Line
- (File, " Dot_Replacement => """ &
+ (" Dot_Replacement => """ &
Get_Name_String (Naming.Dot_Replacement) &
""");");
end if;
end if;
end Check;
- ---------------------
- -- Check_Temp_File --
- ---------------------
-
- procedure Check_Temp_File is
- begin
- if File = Invalid_FD then
- Create_Temp_File
- (In_Tree, File, File_Name, "configuration pragmas");
- end if;
- end Check_Temp_File;
-
---------
-- Put --
---------
procedure Put (Source : Source_Id) is
begin
- -- A temporary file needs to be open
-
- Check_Temp_File;
-
-- Put the pragma SFN for the unit kind (spec or body)
- Put (File, "pragma Source_File_Name_Project (");
- Put (File, Namet.Get_Name_String (Source.Unit.Name));
+ Put ("pragma Source_File_Name_Project (");
+ Put (Namet.Get_Name_String (Source.Unit.Name));
if Source.Kind = Spec then
- Put (File, ", Spec_File_Name => """);
+ Put (", Spec_File_Name => """);
else
- Put (File, ", Body_File_Name => """);
+ Put (", Body_File_Name => """);
end if;
- Put (File, Namet.Get_Name_String (Source.File));
- Put (File, """");
+ Put (Namet.Get_Name_String (Source.File));
+ Put ("""");
if Source.Index /= 0 then
- Put (File, ", Index =>");
- Put (File, Source.Index'Img);
+ Put (", Index =>");
+ Put (Source.Index'Img);
end if;
- Put_Line (File, ");");
+ Put_Line (");");
end Put;
- procedure Put (File : File_Descriptor; S : String) is
- Last : Natural;
-
+ procedure Put (S : String) is
begin
- Last := Write (File, S (S'First)'Address, S'Length);
-
- if Last /= S'Length then
- Prj.Com.Fail
- ("Disk full when creating " & Get_Name_String (File_Name));
- end if;
+ Add_To_Buffer (S, Buffer, Buffer_Last);
if Current_Verbosity = High then
Write_Str (S);
@@ -602,10 +611,7 @@ package body Prj.Env is
-- Put_Line --
--------------
- procedure Put_Line (File : File_Descriptor; S : String) is
- S0 : String (1 .. S'Length + 1);
- Last : Natural;
-
+ procedure Put_Line (S : String) is
begin
-- Add an ASCII.LF to the string. As this config file is supposed to
-- be used only by the compiler, we don't care about the characters
@@ -613,29 +619,43 @@ package body Prj.Env is
-- it is more convenient to be able to read gnat.adc during
-- development, for which the ASCII.LF is fine.
- S0 (1 .. S'Length) := S;
- S0 (S0'Last) := ASCII.LF;
- Last := Write (File, S0'Address, S0'Length);
+ Put (S);
+ Put (S => (1 => ASCII.LF));
+ end Put_Line;
+
+ ---------------------
+ -- Write_Temp_File --
+ ---------------------
+
+ procedure Write_Temp_File is
+ Status : Boolean := False;
+ Last : Natural;
+
+ begin
+ Tempdir.Create_Temp_File (File, File_Name);
+
+ if File /= Invalid_FD then
+ Last := Write (File, Buffer (1)'Address, Buffer_Last);
- if Last /= S'Length + 1 then
- Prj.Com.Fail
- ("Disk full when creating " & Get_Name_String (File_Name));
+ if Last = Buffer_Last then
+ Close (File, Status);
+ end if;
end if;
- if Current_Verbosity = High then
- Write_Line (S);
+ if not Status then
+ Prj.Com.Fail ("unable to create temporary file");
end if;
- end Put_Line;
+ end Write_Temp_File;
+
+ procedure Check_Imported_Projects is
+ new For_Every_Project_Imported (Integer, Check);
- procedure Check_Imported_Projects is new For_Every_Project_Imported
- (Integer, Check);
Dummy : Integer := 0;
-- Start of processing for Create_Config_Pragmas_File
begin
if not For_Project.Config_Checked then
-
Naming_Table.Init (Namings);
-- Check the naming schemes
@@ -662,31 +682,25 @@ package body Prj.Env is
-- standard naming scheme. This will tell the compiler that
-- a project file is used and will forbid any pragma SFN.
- if File = Invalid_FD then
- Check_Temp_File;
+ if Buffer_Last = 0 then
- Put_Line (File, "pragma Source_File_Name_Project");
- Put_Line (File, " (Spec_File_Name => ""*.ads"",");
- Put_Line (File, " Dot_Replacement => ""-"",");
- Put_Line (File, " Casing => lowercase);");
+ Put_Line ("pragma Source_File_Name_Project");
+ Put_Line (" (Spec_File_Name => ""*.ads"",");
+ Put_Line (" Dot_Replacement => ""-"",");
+ Put_Line (" Casing => lowercase);");
- Put_Line (File, "pragma Source_File_Name_Project");
- Put_Line (File, " (Body_File_Name => ""*.adb"",");
- Put_Line (File, " Dot_Replacement => ""-"",");
- Put_Line (File, " Casing => lowercase);");
+ Put_Line ("pragma Source_File_Name_Project");
+ Put_Line (" (Body_File_Name => ""*.adb"",");
+ Put_Line (" Dot_Replacement => ""-"",");
+ Put_Line (" Casing => lowercase);");
end if;
-- Close the temporary file
- GNAT.OS_Lib.Close (File, Status);
-
- if not Status then
- Prj.Com.Fail
- ("Disk full when creating " & Get_Name_String (File_Name));
- end if;
+ Write_Temp_File;
if Opt.Verbose_Mode then
- Write_Str ("Closing configuration file """);
+ Write_Str ("Created configuration file """);
Write_Str (Get_Name_String (File_Name));
Write_Line ("""");
end if;
@@ -695,6 +709,8 @@ package body Prj.Env is
For_Project.Config_File_Temp := True;
For_Project.Config_Checked := True;
end if;
+
+ Free (Buffer);
end Create_Config_Pragmas_File;
--------------------
@@ -739,33 +755,30 @@ package body Prj.Env is
Name : out Path_Name_Type)
is
File : File_Descriptor := Invalid_FD;
- Status : Boolean;
+
+ Buffer : String_Access := new String (1 .. Buffer_Initial);
+ Buffer_Last : Natural := 0;
procedure Put_Name_Buffer;
- -- Put the line contained in the Name_Buffer in the mapping file
+ -- Put the line contained in the Name_Buffer in the global buffer
procedure Process (Project : Project_Id; State : in out Integer);
-- Generate the mapping file for Project (not recursively)
- ---------
- -- Put --
- ---------
+ ---------------------
+ -- Put_Name_Buffer --
+ ---------------------
procedure Put_Name_Buffer is
- Last : Natural;
-
begin
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := ASCII.LF;
- Last := Write (File, Name_Buffer (1)'Address, Name_Len);
if Current_Verbosity = High then
Write_Str ("Mapping file: " & Name_Buffer (1 .. Name_Len));
end if;
- if Last /= Name_Len then
- Prj.Com.Fail ("Disk full, cannot write mapping file");
- end if;
+ Add_To_Buffer (Name_Buffer (1 .. Name_Len), Buffer, Buffer_Last);
end Put_Name_Buffer;
-------------
@@ -851,22 +864,29 @@ package body Prj.Env is
-- Start of processing for Create_Mapping_File
begin
+ For_Every_Imported_Project (Project, Dummy);
- -- Create the temporary file
+ declare
+ Last : Natural;
+ Status : Boolean := False;
- Create_Temp_File (In_Tree, File, Name, "mapping");
+ begin
+ Create_Temp_File (In_Tree, File, Name, "mapping");
- For_Every_Imported_Project (Project, Dummy);
- GNAT.OS_Lib.Close (File, Status);
+ if File /= Invalid_FD then
+ Last := Write (File, Buffer (1)'Address, Buffer_Last);
- if not Status then
+ if Last = Buffer_Last then
+ GNAT.OS_Lib.Close (File, Status);
+ end if;
+ end if;
- -- We were able to create the temporary file, so there is no problem
- -- of protection. However, we are not able to close it, so there must
- -- be a capacity problem that we express using "disk full".
+ if not Status then
+ Prj.Com.Fail ("could not write mapping file");
+ end if;
+ end;
- Prj.Com.Fail ("disk full, could not write mapping file");
- end if;
+ Free (Buffer);
end Create_Mapping_File;
----------------------
@@ -1505,7 +1525,9 @@ package body Prj.Env is
Status : Boolean;
-- For calls to Close
- Len : Natural;
+ Last : Natural;
+ Buffer : String_Access := new String (1 .. Buffer_Initial);
+ Buffer_Last : Natural := 0;
procedure Recursive_Add (Project : Project_Id; Dummy : in out Boolean);
-- Recursive procedure to add the source/object paths of extended/
@@ -1547,6 +1569,7 @@ package body Prj.Env is
procedure For_All_Projects is
new For_Every_Project_Imported (Boolean, Recursive_Add);
+
Dummy : Boolean := False;
-- Start of processing for Set_Ada_Paths
@@ -1594,44 +1617,53 @@ package body Prj.Env is
-- the previous version of the file.
if Source_FD /= Invalid_FD then
+ Buffer_Last := 0;
+
for Index in Source_Path_Table.First ..
Source_Path_Table.Last (Source_Paths)
loop
Get_Name_String (Source_Paths.Table (Index));
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := ASCII.LF;
- Len := Write (Source_FD, Name_Buffer (1)'Address, Name_Len);
-
- if Len /= Name_Len then
- Prj.Com.Fail ("disk full");
- end if;
+ Add_To_Buffer (Name_Buffer (1 .. Name_Len), Buffer, Buffer_Last);
end loop;
- Close (Source_FD, Status);
+ Last := Write (Source_FD, Buffer (1)'Address, Buffer_Last);
+
+ if Last = Buffer_Last then
+ Close (Source_FD, Status);
+
+ else
+ Status := False;
+ end if;
if not Status then
- Prj.Com.Fail ("disk full");
+ Prj.Com.Fail ("could not write temporary file");
end if;
end if;
if Object_FD /= Invalid_FD then
+ Buffer_Last := 0;
+
for Index in Object_Path_Table.First ..
Object_Path_Table.Last (Object_Paths)
loop
Get_Name_String (Object_Paths.Table (Index));
Name_Len := Name_Len + 1;
Name_Buffer (Name_Len) := ASCII.LF;
- Len := Write (Object_FD, Name_Buffer (1)'Address, Name_Len);
-
- if Len /= Name_Len then
- Prj.Com.Fail ("disk full");
- end if;
+ Add_To_Buffer (Name_Buffer (1 .. Name_Len), Buffer, Buffer_Last);
end loop;
- Close (Object_FD, Status);
+ Last := Write (Object_FD, Buffer (1)'Address, Buffer_Last);
+
+ if Last = Buffer_Last then
+ Close (Object_FD, Status);
+ else
+ Status := False;
+ end if;
if not Status then
- Prj.Com.Fail ("disk full");
+ Prj.Com.Fail ("could not write temporary file");
end if;
end if;
@@ -1672,6 +1704,8 @@ package body Prj.Env is
(In_Tree.Private_Part.Current_Object_Path_File));
end if;
end if;
+
+ Free (Buffer);
end Set_Ada_Paths;
-----------------------
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index 75e4c6ea717..1a0371855c5 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -5148,10 +5148,21 @@ package body Prj.Nmsc is
Err_Vars.Error_Msg_File_1 :=
File_Name_Type (Object_Dir.Value);
- Error_Msg
- (Data.Flags,
- "object directory { not found",
- Project.Location, Project);
+
+ case Data.Flags.Require_Obj_Dirs is
+ when Error =>
+ Error_Msg
+ (Data.Flags,
+ "object directory { not found",
+ Project.Location, Project);
+ when Warning =>
+ Error_Msg
+ (Data.Flags,
+ "?object directory { not found",
+ Project.Location, Project);
+ when Silent =>
+ null;
+ end case;
end if;
end if;
diff --git a/gcc/ada/prj-part.adb b/gcc/ada/prj-part.adb
index 8a0f6a52c15..84e3f6dab7f 100644
--- a/gcc/ada/prj-part.adb
+++ b/gcc/ada/prj-part.adb
@@ -583,6 +583,10 @@ package body Prj.Part is
if No (Project) or else Always_Errout_Finalize then
Prj.Err.Finalize;
+
+ -- Reinitialize to avoid duplicate warnings later on
+
+ Prj.Err.Initialize;
end if;
end;
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index 2ad790324a7..2bed1a81dc2 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -1189,7 +1189,9 @@ package body Prj is
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
- Error_On_Unknown_Language : Boolean := True) return Processing_Flags
+ Error_On_Unknown_Language : Boolean := True;
+ Require_Obj_Dirs : Error_Warning := Error)
+ return Processing_Flags
is
begin
return Processing_Flags'
@@ -1198,7 +1200,8 @@ package body Prj is
Require_Sources_Other_Lang => Require_Sources_Other_Lang,
Allow_Duplicate_Basenames => Allow_Duplicate_Basenames,
Error_On_Unknown_Language => Error_On_Unknown_Language,
- Compiler_Driver_Mandatory => Compiler_Driver_Mandatory);
+ Compiler_Driver_Mandatory => Compiler_Driver_Mandatory,
+ Require_Obj_Dirs => Require_Obj_Dirs);
end Create_Flags;
begin
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 8f95c08b59f..76eb59aecbb 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -1386,7 +1386,9 @@ package Prj is
Require_Sources_Other_Lang : Boolean := True;
Allow_Duplicate_Basenames : Boolean := True;
Compiler_Driver_Mandatory : Boolean := False;
- Error_On_Unknown_Language : Boolean := True) return Processing_Flags;
+ Error_On_Unknown_Language : Boolean := True;
+ Require_Obj_Dirs : Error_Warning := Error)
+ return Processing_Flags;
-- Function used to create Processing_Flags structure
--
-- If Allow_Duplicate_Basenames, then files with the same base names are
@@ -1410,8 +1412,13 @@ package Prj is
--
-- If Error_On_Unknown_Language is true, an error is displayed if some of
-- the source files listed in the project do not match any naming scheme
+ --
+ -- If Require_Obj_Dirs is true, then all object directories must exist
+ -- (possibly after they have been created automatically if the appropriate
+ -- switches were specified), or an error is raised.
Gprbuild_Flags : constant Processing_Flags;
+ Gprclean_Flags : constant Processing_Flags;
Gnatmake_Flags : constant Processing_Flags;
-- Flags used by the various tools. They all display the error messages
-- through Prj.Err.
@@ -1516,6 +1523,7 @@ private
Allow_Duplicate_Basenames : Boolean;
Compiler_Driver_Mandatory : Boolean;
Error_On_Unknown_Language : Boolean;
+ Require_Obj_Dirs : Error_Warning;
end record;
Gprbuild_Flags : constant Processing_Flags :=
@@ -1524,7 +1532,17 @@ private
Require_Sources_Other_Lang => True,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => True,
- Error_On_Unknown_Language => True);
+ Error_On_Unknown_Language => True,
+ Require_Obj_Dirs => Error);
+
+ Gprclean_Flags : constant Processing_Flags :=
+ (Report_Error => null,
+ When_No_Sources => Warning,
+ Require_Sources_Other_Lang => True,
+ Allow_Duplicate_Basenames => False,
+ Compiler_Driver_Mandatory => True,
+ Error_On_Unknown_Language => True,
+ Require_Obj_Dirs => Warning);
Gnatmake_Flags : constant Processing_Flags :=
(Report_Error => null,
@@ -1532,6 +1550,7 @@ private
Require_Sources_Other_Lang => False,
Allow_Duplicate_Basenames => False,
Compiler_Driver_Mandatory => False,
- Error_On_Unknown_Language => False);
+ Error_On_Unknown_Language => False,
+ Require_Obj_Dirs => Error);
end Prj;
diff --git a/gcc/ada/s-linux-hppa.ads b/gcc/ada/s-linux-hppa.ads
index 16393c539f6..6176376cbeb 100644
--- a/gcc/ada/s-linux-hppa.ads
+++ b/gcc/ada/s-linux-hppa.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-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- --
diff --git a/gcc/ada/s-linux.ads b/gcc/ada/s-linux.ads
index 83b07c018e6..29918d7d4ca 100644
--- a/gcc/ada/s-linux.ads
+++ b/gcc/ada/s-linux.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-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- --
diff --git a/gcc/ada/s-osinte-kfreebsd-gnu.ads b/gcc/ada/s-osinte-kfreebsd-gnu.ads
index ad33e54164b..e85af994422 100644
--- a/gcc/ada/s-osinte-kfreebsd-gnu.ads
+++ b/gcc/ada/s-osinte-kfreebsd-gnu.ads
@@ -188,6 +188,7 @@ package System.OS_Interface is
SIG_IGN : constant := 1;
SA_SIGINFO : constant := 16#0040#;
+ SA_ONSTACK : constant := 16#0001#;
function sigaction
(sig : Signal;
@@ -280,6 +281,24 @@ package System.OS_Interface is
-- Stack --
-----------
+ type stack_t is record
+ ss_sp : System.Address;
+ ss_size : size_t;
+ ss_flags : int;
+ end record;
+ pragma Convention (C, stack_t);
+
+ function sigaltstack
+ (ss : not null access stack_t;
+ oss : access stack_t) return int;
+ pragma Import (C, sigaltstack, "sigaltstack");
+
+ Alternate_Stack : aliased System.Address;
+ -- This is a dummy definition, never used (Alternate_Stack_Size is null)
+
+ Alternate_Stack_Size : constant := 0;
+ -- No alternate signal stack is used on this platform
+
function Get_Stack_Base (thread : pthread_t) return Address;
pragma Inline (Get_Stack_Base);
-- This is a dummy procedure to share some GNULLI files
diff --git a/gcc/ada/s-taprop-posix.adb b/gcc/ada/s-taprop-posix.adb
index 8e9ba26ce64..ac147000b7a 100644
--- a/gcc/ada/s-taprop-posix.adb
+++ b/gcc/ada/s-taprop-posix.adb
@@ -926,6 +926,7 @@ package body System.Task_Primitives.Operations is
is
Attributes : aliased pthread_attr_t;
Adjusted_Stack_Size : Interfaces.C.size_t;
+ Page_Size : constant Interfaces.C.size_t := Get_Page_Size;
Result : Interfaces.C.int;
function Thread_Body_Access is new
@@ -946,9 +947,15 @@ package body System.Task_Primitives.Operations is
-- to be sure the effective stack size is greater than what
-- has been asked.
- Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Get_Page_Size;
+ Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Page_Size;
end if;
+ -- Round stack size as this is required by some OSes (Darwin)
+
+ Adjusted_Stack_Size := Adjusted_Stack_Size + Page_Size - 1;
+ Adjusted_Stack_Size :=
+ Adjusted_Stack_Size - Adjusted_Stack_Size mod Page_Size;
+
Result := pthread_attr_init (Attributes'Access);
pragma Assert (Result = 0 or else Result = ENOMEM);
diff --git a/gcc/ada/s-tasini.adb b/gcc/ada/s-tasini.adb
index 28b86cb5765..cacd86c4c22 100644
--- a/gcc/ada/s-tasini.adb
+++ b/gcc/ada/s-tasini.adb
@@ -190,13 +190,14 @@ package body System.Tasking.Initialization is
return;
end if;
+ -- The following assertion is by default disabled. See the comment in
+ -- Defer_Abort on the situations in which it may be useful to uncomment
+ -- this assertion and enable the test.
+
-- pragma Assert
-- (Self_ID.Pending_ATC_Level >= Self_ID.ATC_Nesting_Level or else
-- Self_ID.Deferral_Level > 0);
- -- See comment in Defer_Abort on the situations in which it may be
- -- useful to uncomment the above assertion.
-
Self_ID.Deferral_Level := Self_ID.Deferral_Level + 1;
end Defer_Abort_Nestable;
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index bac147c96b9..071d38fdb45 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -1978,9 +1978,7 @@ package body Sem is
-- See if it belongs to current unit, and if so, include its
-- with_clauses. Do not process main unit prematurely.
- if Pnode = CU
- and then CU /= Cunit (Main_Unit)
- then
+ if Pnode = CU and then CU /= Cunit (Main_Unit) then
Walk_Immediate (Cunit (S), Include_Limited);
end if;
end;
diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb
index d5d38235f36..c8d06e8cfec 100644
--- a/gcc/ada/sem_cat.adb
+++ b/gcc/ada/sem_cat.adb
@@ -2191,10 +2191,8 @@ package body Sem_Cat is
Flag_Non_Static_Expr
("non-static object name in preelaborated unit", N);
- -- We take the view that a constant defined in another preelaborated
- -- unit is preelaborable, even though it may have a private type and
- -- thus appear non-static in a client. This must be the intent of
- -- the language, but currently is an RM gap ???
+ -- Give an error for a reference to a nonstatic constant, unless the
+ -- constant is in another GNAT library unit that is preelaborable.
elsif Ekind (Entity (N)) = E_Constant
and then not Is_Static_Expression (N)
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index a67acb5539f..170f261a36e 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -1747,6 +1747,8 @@ package body Sem_Ch10 is
Error_Node => N);
-- Give message if we did not get the unit
+ -- Emit warning even if missing subunit is not
+ -- within main unit, to simplify debugging.
if Original_Operating_Mode = Generate_Code
and then Unum = No_Unit
@@ -1755,7 +1757,7 @@ package body Sem_Ch10 is
Error_Msg_File_1 :=
Get_File_Name (Subunit_Name, Subunit => True);
Error_Msg_N
- ("subunit$$ in file{ not found?", N);
+ ("subunit$$ in file{ not found?!!", N);
Subunits_Missing := True;
end if;
diff --git a/gcc/ada/sem_ch12.ads b/gcc/ada/sem_ch12.ads
index c3b34173e18..a79463767ce 100644
--- a/gcc/ada/sem_ch12.ads
+++ b/gcc/ada/sem_ch12.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- --
@@ -47,12 +47,14 @@ package Sem_Ch12 is
procedure Check_Generic_Child_Unit
(Gen_Id : Node_Id;
Parent_Installed : in out Boolean);
- -- If the name of the generic unit in an instantiation or a renaming
- -- is a selected component, then the prefix may be an instance and the
- -- selector may designate a child unit. Retrieve the parent generic
- -- and search for the child unit that must be declared within. Similarly,
- -- if this is the name of a generic child unit within an instantiation of
- -- its own parent, retrieve the parent generic.
+ -- If the name of the generic unit in an instantiation or a renaming is a
+ -- selected component, then the prefix may be an instance and the selector
+ -- may designate a child unit. Retrieve the parent generic and search for
+ -- the child unit that must be declared within. Similarly, if this is the
+ -- name of a generic child unit within an instantiation of its own parent,
+ -- retrieve the parent generic. If the parent is installed as a result of
+ -- this call, then Parent_Installed is set True, otherwise Parent_Intalled
+ -- is unchanged by the call.
function Copy_Generic_Node
(N : Node_Id;
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index d8f1e1dd36b..c514206c00d 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -753,6 +753,7 @@ package body Sem_Ch3 is
-- is associated with one of the protected operations, and must
-- be available in the scope that encloses the protected declaration.
-- Otherwise the type is in the scope enclosing the subprogram.
+
-- If the function has formals, The return type of a subprogram
-- declaration is analyzed in the scope of the subprogram (see
-- Process_Formals) and thus the protected type, if present, is
@@ -931,16 +932,20 @@ package body Sem_Ch3 is
Build_Itype_Reference (Anon_Type, Parent (Parent (Related_Nod)));
-- Similarly, if the access definition is the return result of a
- -- function, create an itype reference for it because it
- -- will be used within the function body. For a regular function that
- -- is not a compilation unit, insert reference after the declaration.
- -- For a protected operation, insert it after the enclosing protected
- -- type declaration. In either case, do not create a reference for a
- -- type obtained through a limited_with clause, because this would
- -- introduce semantic dependencies.
+ -- function, create an itype reference for it because it will be used
+ -- within the function body. For a regular function that is not a
+ -- compilation unit, insert reference after the declaration. For a
+ -- protected operation, insert it after the enclosing protected type
+ -- declaration. In either case, do not create a reference for a type
+ -- obtained through a limited_with clause, because this would introduce
+ -- semantic dependencies.
+
+ -- Similarly, do not create a reference if the designated type is a
+ -- generic formal, because no use of it will reach the backend.
elsif Nkind (Related_Nod) = N_Function_Specification
and then not From_With_Type (Desig_Type)
+ and then not Is_Generic_Type (Desig_Type)
then
if Present (Enclosing_Prot_Type) then
Build_Itype_Reference (Anon_Type, Parent (Enclosing_Prot_Type));
@@ -951,10 +956,10 @@ package body Sem_Ch3 is
Build_Itype_Reference (Anon_Type, Parent (Related_Nod));
end if;
- -- Finally, create an itype reference for an object declaration of
- -- an anonymous access type. This is strictly necessary only for
- -- deferred constants, but in any case will avoid out-of-scope
- -- problems in the back-end.
+ -- Finally, create an itype reference for an object declaration of an
+ -- anonymous access type. This is strictly necessary only for deferred
+ -- constants, but in any case will avoid out-of-scope problems in the
+ -- back-end.
elsif Nkind (Related_Nod) = N_Object_Declaration then
Build_Itype_Reference (Anon_Type, Related_Nod);
@@ -1532,11 +1537,10 @@ package body Sem_Ch3 is
while Present (Iface_Elmt) loop
Iface := Node (Iface_Elmt);
- -- Exclude from this processing interfaces that are parents
- -- of Tagged_Type because their primitives are located in the
- -- primary dispatch table (and hence no auxiliary internal
- -- entities are required to handle secondary dispatch tables
- -- in such case).
+ -- Exclude from this processing interfaces that are parents of
+ -- Tagged_Type because their primitives are located in the primary
+ -- dispatch table (and hence no auxiliary internal entities are
+ -- required to handle secondary dispatch tables in such case).
if not Is_Ancestor (Iface, Tagged_Type) then
Elmt := First_Elmt (Primitive_Operations (Iface));
@@ -1572,19 +1576,19 @@ package body Sem_Ch3 is
Set_Interface_Alias (New_Subp, Iface_Prim);
-- Internal entities associated with interface types are
- -- only registered in the list of primitives of the
- -- tagged type. They are only used to fill the contents
- -- of the secondary dispatch tables. Therefore they are
- -- not needed in the homonym chains.
+ -- only registered in the list of primitives of the tagged
+ -- type. They are only used to fill the contents of the
+ -- secondary dispatch tables. Therefore they are not needed
+ -- in the homonym chains.
Remove_Homonym (New_Subp);
- -- Hidden entities associated with interfaces must have
- -- set the Has_Delay_Freeze attribute to ensure that, in
- -- case of locally defined tagged types (or compiling
- -- with static dispatch tables generation disabled) the
- -- corresponding entry of the secondary dispatch table is
- -- filled when such entity is frozen.
+ -- Hidden entities associated with interfaces must have set
+ -- the Has_Delay_Freeze attribute to ensure that, in case of
+ -- locally defined tagged types (or compiling with static
+ -- dispatch tables generation disabled) the corresponding
+ -- entry of the secondary dispatch table is filled when
+ -- such an entity is frozen.
Set_Has_Delayed_Freeze (New_Subp);
end if;
diff --git a/gcc/ada/sem_ch3.ads b/gcc/ada/sem_ch3.ads
index 477f0205f38..6bfa52844d0 100644
--- a/gcc/ada/sem_ch3.ads
+++ b/gcc/ada/sem_ch3.ads
@@ -100,23 +100,22 @@ package Sem_Ch3 is
-- Could both mechanisms be merged ???
procedure Check_Abstract_Overriding (T : Entity_Id);
- -- Check that all abstract subprograms inherited from T's parent type
- -- have been overridden as required, and that nonabstract subprograms
- -- have not been incorrectly overridden with an abstract subprogram.
+ -- Check that all abstract subprograms inherited from T's parent type have
+ -- been overridden as required, and that nonabstract subprograms have not
+ -- been incorrectly overridden with an abstract subprogram.
procedure Check_Aliased_Component_Types (T : Entity_Id);
-- Given an array type or record type T, check that if the type is
- -- nonlimited, then the nominal subtype of any components of T
- -- that have discriminants must be constrained.
+ -- nonlimited, then the nominal subtype of any components of T that
+ -- have discriminants must be constrained.
procedure Check_Completion (Body_Id : Node_Id := Empty);
- -- At the end of a declarative part, verify that all entities that
- -- require completion have received one. If Body_Id is absent, the
- -- error indicating a missing completion is placed on the declaration
- -- that needs completion. If Body_Id is present, it is the defining
- -- identifier of a package body, and errors are posted on that node,
- -- rather than on the declarations that require completion in the package
- -- declaration.
+ -- At the end of a declarative part, verify that all entities that require
+ -- completion have received one. If Body_Id is absent, the error indicating
+ -- a missing completion is placed on the declaration that needs completion.
+ -- If Body_Id is present, it is the defining identifier of a package body,
+ -- and errors are posted on that node, rather than on the declarations that
+ -- require completion in the package declaration.
procedure Derive_Subprogram
(New_Subp : in out Entity_Id;
@@ -143,8 +142,8 @@ package Sem_Ch3 is
-- the derived subprograms are aliased to those of the actual, not those of
-- the ancestor.
--
- -- Note: one might expect this to be private to the package body, but
- -- there is one rather unusual usage in package Exp_Dist.
+ -- Note: one might expect this to be private to the package body, but there
+ -- is one rather unusual usage in package Exp_Dist.
function Find_Hidden_Interface
(Src : Elist_Id;
@@ -167,8 +166,8 @@ package Sem_Ch3 is
Typ_For_Constraint : Entity_Id;
Constraint : Elist_Id) return Node_Id;
-- ??? MORE DOCUMENTATION
- -- Given a discriminant somewhere in the Typ_For_Constraint tree
- -- and a Constraint, return the value of that discriminant.
+ -- Given a discriminant somewhere in the Typ_For_Constraint tree and a
+ -- Constraint, return the value of that discriminant.
function Is_Null_Extension (T : Entity_Id) return Boolean;
-- Returns True if the tagged type T has an N_Full_Type_Declaration that
@@ -237,7 +236,7 @@ package Sem_Ch3 is
-- of the dependant private subtypes. The second action is to recopy the
-- primitive operations of the private view (in the tagged case).
-- N is the N_Full_Type_Declaration node.
-
+ --
-- Full_T is the full view of the type whose full declaration is in N.
--
-- Priv_T is the private view of the type whose full declaration is in N.
@@ -248,16 +247,16 @@ package Sem_Ch3 is
Check_List : List_Id := Empty_List;
R_Check_Off : Boolean := False);
-- Process a range expression that appears in a declaration context. The
- -- range is analyzed and resolved with the base type of the given type,
- -- and an appropriate check for expressions in non-static contexts made
- -- on the bounds. R is analyzed and resolved using T, so the caller should
- -- if necessary link R into the tree before the call, and in particular in
- -- the case of a subtype declaration, it is appropriate to set the parent
- -- pointer of R so that the types get properly frozen. The Check_List
- -- parameter is used when the subprogram is called from
- -- Build_Record_Init_Proc and is used to return a set of constraint
- -- checking statements generated by the Checks package. R_Check_Off is set
- -- to True when the call to Range_Check is to be skipped.
+ -- range is analyzed and resolved with the base type of the given type, and
+ -- an appropriate check for expressions in non-static contexts made on the
+ -- bounds. R is analyzed and resolved using T, so the caller should if
+ -- necessary link R into the tree before the call, and in particular in the
+ -- case of a subtype declaration, it is appropriate to set the parent
+ -- pointer of R so that the types get properly frozen. Check_List is used
+ -- when the subprogram is called from Build_Record_Init_Proc and is used to
+ -- return a set of constraint checking statements generated by the Checks
+ -- package. R_Check_Off is set to True when the call to Range_Check is to
+ -- be skipped.
function Process_Subtype
(S : Node_Id;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index c72b3137ef8..32323400b6d 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -4496,25 +4496,26 @@ package body Sem_Ch6 is
elsif Nkind (Subp) = N_Defining_Operator_Symbol then
declare
- Typ : constant Entity_Id :=
- Base_Type (Etype (First_Formal (Subp)));
+ Typ : constant Entity_Id :=
+ Base_Type (Etype (First_Formal (Subp)));
+
Can_Override : constant Boolean :=
- Operator_Matches_Spec (Subp, Subp)
- and then Scope (Subp) = Scope (Typ)
- and then not Is_Class_Wide_Type (Typ);
+ Operator_Matches_Spec (Subp, Subp)
+ and then Scope (Subp) = Scope (Typ)
+ and then not Is_Class_Wide_Type (Typ);
begin
if Must_Not_Override (Spec) then
- -- If this is not a primitive or a protected subprogram,
- -- then "not overriding" is illegal.
+ -- If this is not a primitive or a protected subprogram, then
+ -- "not overriding" is illegal.
if not Is_Primitive
and then Ekind (Scope (Subp)) /= E_Protected_Type
then
Error_Msg_N
("overriding indicator only allowed "
- & "if subprogram is primitive", Subp);
+ & "if subprogram is primitive", Subp);
elsif Can_Override then
Error_Msg_NE
@@ -4535,7 +4536,7 @@ package body Sem_Ch6 is
and then Can_Override
and then
not Is_Predefined_File_Name
- (Unit_File_Name (Get_Source_Unit (Subp)))
+ (Unit_File_Name (Get_Source_Unit (Subp)))
then
Set_Is_Overriding_Operation (Subp);
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 4edcfe76bcb..27505f215a9 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -1912,7 +1912,7 @@ package body Sem_Ch7 is
Set_Is_Limited_Record (Id, Limited_Present (Def));
Set_Has_Delayed_Freeze (Id, True);
- -- Create a class-wide type with the same attributes.
+ -- Create a class-wide type with the same attributes
Make_Class_Wide_Type (Id);
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index e917ccf7327..407171f1d7b 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -2603,7 +2603,7 @@ package body Sem_Warn is
-- Output_Non_Modified_In_Out_Warnings --
-----------------------------------------
- procedure Output_Non_Modifed_In_Out_Warnings is
+ procedure Output_Non_Modified_In_Out_Warnings is
function No_Warn_On_In_Out (E : Entity_Id) return Boolean;
-- Given a formal parameter entity E, determines if there is a reason to
@@ -2700,7 +2700,7 @@ package body Sem_Warn is
end if;
end;
end loop;
- end Output_Non_Modifed_In_Out_Warnings;
+ end Output_Non_Modified_In_Out_Warnings;
----------------------------------------
-- Output_Obsolescent_Entity_Warnings --
@@ -3966,7 +3966,7 @@ package body Sem_Warn is
if Ekind (E) = E_In_Parameter
or else not Referenced_As_LHS_Check_Spec (E)
- or else Is_Scalar_Type (E)
+ or else Is_Scalar_Type (Etype (E))
then
if Present (Body_E) then
E := Body_E;
diff --git a/gcc/ada/sem_warn.ads b/gcc/ada/sem_warn.ads
index 1e0f96814bd..4ab97be7d67 100644
--- a/gcc/ada/sem_warn.ads
+++ b/gcc/ada/sem_warn.ads
@@ -138,7 +138,7 @@ package Sem_Warn is
-- Output Routines --
---------------------
- procedure Output_Non_Modifed_In_Out_Warnings;
+ procedure Output_Non_Modified_In_Out_Warnings;
-- Warnings about IN OUT parameters that could be IN are collected till
-- the end of the compilation process (see body of this routine for a
-- discussion of why this is done). This procedure outputs the warnings.
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 6825f4ec038..1ecae61a013 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -309,6 +309,11 @@ package body Switch.C is
case Switch_Chars (Ptr) is
+ -- -gnatea (initial delimiter of explicit switches)
+ -- All switches that come before -gnatea have been added by
+ -- the GCC driver and are not stored in the ALI file.
+ -- See also -gnatez below.
+
when 'a' =>
Store_Switch := False;
Enable_Switch_Storing;
@@ -462,14 +467,20 @@ package body Switch.C is
Ptr := Max + 1;
- -- -gnatez ???
+ -- -gnatez (final delimiter of explicit switches)
+ -- All switches that come after -gnatez have been added by
+ -- the GCC driver and are not stored in the ALI file.
+ -- See also -gnatea above.
when 'z' =>
Store_Switch := False;
Disable_Switch_Storing;
Ptr := Ptr + 1;
- -- -gnateS (Store SCO information)
+ -- -gnateS (generate SCO information)
+ -- Include Source Coverage Obligation information in ALI
+ -- files for the benefit of source coverage analysis tools
+ -- (xcov).
when 'S' =>
Generate_SCO := True;
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c
index ffda3abaeec..608246e2530 100644
--- a/gcc/ada/sysdep.c
+++ b/gcc/ada/sysdep.c
@@ -868,6 +868,8 @@ __gnat_localtime_tzoff (const time_t *timer, long *off)
(*Unlock_Task) ();
+ /* Correct the offset if Daylight Saving Time is in effect */
+
if (tp.tm_isdst > 0)
*off = *off + 3600;
}
@@ -902,9 +904,16 @@ __gnat_localtime_tzoff (const time_t *timer, long *off)
tz_end = index (tz_start, ':');
tz_end = '\0';
- /* The Ada layer expects an offset in seconds */
+ /* The Ada layer expects an offset in seconds. Note that we must reverse
+ the sign of the result since west is positive and east is negative on
+ VxWorks targets. */
+
+ *off = -atol (tz_start) * 60;
+
+ /* Correct the offset if Daylight Saving Time is in effect */
- *off = atol (tz_start) * 60;
+ if (tp.tm_isdst > 0)
+ *off = *off + 3600;
}
(*Unlock_Task) ();
diff --git a/gcc/ada/targparm.adb b/gcc/ada/targparm.adb
index d78201d3016..b8cc154c88c 100644
--- a/gcc/ada/targparm.adb
+++ b/gcc/ada/targparm.adb
@@ -510,7 +510,7 @@ package body Targparm is
goto Line_Loop_Continue;
- -- Next See if we have a configuration parameter
+ -- Next see if we have a configuration parameter
else
Config_Param_Loop : for K in Targparm_Tags loop
diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
index 714018d1ff6..7340f64129e 100644
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -196,8 +196,8 @@ package Types is
-- which are one greater than the previous upper bound.
subtype Big_Source_Buffer is Text_Buffer (0 .. Text_Ptr'Last);
- -- This is a virtual type used as the designated type of the access
- -- type Source_Buffer_Ptr, see Osint.Read_Source_File for details.
+ -- This is a virtual type used as the designated type of the access type
+ -- Source_Buffer_Ptr, see Osint.Read_Source_File for details.
type Source_Buffer_Ptr is access all Big_Source_Buffer;
for Source_Buffer_Ptr'Storage_Size use 0;
@@ -234,8 +234,8 @@ package Types is
-- Used for all nodes in the presentation of package Standard.ASCII
System_Location : constant Source_Ptr := -4;
- -- Used to identify locations of pragmas scanned by Targparm, where we
- -- know the location is in System, but we don't know exactly what line.
+ -- Used to identify locations of pragmas scanned by Targparm, where we know
+ -- the location is in System, but we don't know exactly what line.
First_Source_Ptr : constant Source_Ptr := 0;
-- Starting source pointer index value for first source program
diff --git a/gcc/ada/xref_lib.adb b/gcc/ada/xref_lib.adb
index 475f15e3816..f4d0fc29a36 100644
--- a/gcc/ada/xref_lib.adb
+++ b/gcc/ada/xref_lib.adb
@@ -1607,10 +1607,16 @@ package body Xref_Lib is
Write_Str (Get_Symbol (Decl));
- while Column < Type_Position loop
+ -- Put the declaration type in column Type_Position, but if the
+ -- declaration name is too long, put at least one space between its
+ -- name and its type.
+
+ while Column < Type_Position - 1 loop
Write_Char (' ');
end loop;
+ Write_Char (' ');
+
Write_Line (Get_Full_Type (Decl));
Write_Parent_Info : declare
diff --git a/gcc/alias.c b/gcc/alias.c
index fc259b8ef2d..eaa127ec8e5 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -680,11 +680,20 @@ get_alias_set (tree t)
}
/* Variant qualifiers don't affect the alias set, so get the main
- variant. Always use the canonical type as well.
- If this is a type with a known alias set, return it. */
+ variant. */
t = TYPE_MAIN_VARIANT (t);
- if (TYPE_CANONICAL (t))
- t = TYPE_CANONICAL (t);
+
+ /* Always use the canonical type as well. If this is a type that
+ requires structural comparisons to identify compatible types
+ use alias set zero. */
+ if (TYPE_STRUCTURAL_EQUALITY_P (t))
+ return 0;
+ t = TYPE_CANONICAL (t);
+ /* Canonical types shouldn't form a tree nor should the canonical
+ type require structural equality checks. */
+ gcc_assert (!TYPE_STRUCTURAL_EQUALITY_P (t) && TYPE_CANONICAL (t) == t);
+
+ /* If this is a type with a known alias set, return it. */
if (TYPE_ALIAS_SET_KNOWN_P (t))
return TYPE_ALIAS_SET (t);
@@ -1980,6 +1989,9 @@ nonoverlapping_component_refs_p (const_tree x, const_tree y)
{
const_tree fieldx, fieldy, typex, typey, orig_y;
+ if (!flag_strict_aliasing)
+ return false;
+
do
{
/* The comparison has to be done at a common type, since we don't
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index d1a36c13346..35b4f1724e4 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -1420,7 +1420,7 @@ fix_up_fall_thru_edges (void)
fall_thru_label = block_label (fall_thru->dest);
- if (old_jump && fall_thru_label)
+ if (old_jump && JUMP_P (old_jump) && fall_thru_label)
invert_worked = invert_jump (old_jump,
fall_thru_label,0);
if (invert_worked)
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 57c0c1bce59..1a9e96653df 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -60,9 +60,6 @@ along with GCC; see the file COPYING3. If not see
#endif
#ifdef HAVE_mpc
static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
-#ifdef HAVE_mpc_pow
-static tree do_mpc_arg2 (tree, tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
-#endif
#endif
/* Define the names of the builtin function types and codes. */
@@ -5104,7 +5101,6 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
return GS_ALL_DONE;
*expr_p = targetm.gimplify_va_arg_expr (valist, type, pre_p, post_p);
- SET_EXPR_LOCATION (*expr_p, loc);
return GS_OK;
}
}
@@ -8741,15 +8737,18 @@ fold_builtin_pow (location_t loc, tree fndecl, tree arg0, tree arg1, tree type)
}
}
- /* Optimize pow(pow(x,y),z) = pow(x,y*z). */
+ /* Optimize pow(pow(x,y),z) = pow(x,y*z) iff x is nonnegative. */
if (fcode == BUILT_IN_POW
|| fcode == BUILT_IN_POWF
|| fcode == BUILT_IN_POWL)
{
tree arg00 = CALL_EXPR_ARG (arg0, 0);
- tree arg01 = CALL_EXPR_ARG (arg0, 1);
- tree narg1 = fold_build2_loc (loc, MULT_EXPR, type, arg01, arg1);
- return build_call_expr_loc (loc, fndecl, 2, arg00, narg1);
+ if (tree_expr_nonnegative_p (arg00))
+ {
+ tree arg01 = CALL_EXPR_ARG (arg0, 1);
+ tree narg1 = fold_build2_loc (loc, MULT_EXPR, type, arg01, arg1);
+ return build_call_expr_loc (loc, fndecl, 2, arg00, narg1);
+ }
}
}
@@ -13825,8 +13824,8 @@ do_mpc_arg1 (tree arg, tree type, int (*func)(mpc_ptr, mpc_srcptr, mpc_rnd_t))
TYPE. We assume that function FUNC returns zero if the result
could be calculated exactly within the requested precision. */
-#ifdef HAVE_mpc_pow
-static tree
+#ifdef HAVE_mpc
+tree
do_mpc_arg2 (tree arg0, tree arg1, tree type,
int (*func)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t))
{
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 0ebb9f1b1f5..ee4991ad623 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1133,6 +1133,7 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
bool op0_const = true, op1_const = true, op2_const = true;
bool op0_const_self = true, op1_const_self = true, op2_const_self = true;
bool nowarning = TREE_NO_WARNING (expr);
+ int unused_p;
/* This function is not relevant to C++ because C++ folds while
parsing, and may need changes to be correct for C++ when C++
@@ -1308,6 +1309,10 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
: fold_build2_loc (loc, code, TREE_TYPE (expr), op0, op1);
else
ret = fold (expr);
+ if (TREE_OVERFLOW_P (ret)
+ && !TREE_OVERFLOW_P (op0)
+ && !TREE_OVERFLOW_P (op1))
+ overflow_warning (EXPR_LOCATION (expr), ret);
goto out;
case INDIRECT_REF:
@@ -1342,6 +1347,20 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
TREE_SIDE_EFFECTS (ret) = TREE_SIDE_EFFECTS (expr);
TREE_THIS_VOLATILE (ret) = TREE_THIS_VOLATILE (expr);
}
+ switch (code)
+ {
+ case FIX_TRUNC_EXPR:
+ case FLOAT_EXPR:
+ CASE_CONVERT:
+ /* Don't warn about explicit conversions. We will already
+ have warned about suspect implicit conversions. */
+ break;
+
+ default:
+ if (TREE_OVERFLOW_P (ret) && !TREE_OVERFLOW_P (op0))
+ overflow_warning (EXPR_LOCATION (expr), ret);
+ break;
+ }
goto out;
case TRUTH_ANDIF_EXPR:
@@ -1351,7 +1370,14 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
orig_op0 = op0 = TREE_OPERAND (expr, 0);
orig_op1 = op1 = TREE_OPERAND (expr, 1);
op0 = c_fully_fold_internal (op0, in_init, &op0_const, &op0_const_self);
+
+ unused_p = (op0 == (code == TRUTH_ANDIF_EXPR
+ ? truthvalue_false_node
+ : truthvalue_true_node));
+ c_inhibit_evaluation_warnings += unused_p;
op1 = c_fully_fold_internal (op1, in_init, &op1_const, &op1_const_self);
+ c_inhibit_evaluation_warnings -= unused_p;
+
if (op0 != orig_op0 || op1 != orig_op1 || in_init)
ret = in_init
? fold_build2_initializer_loc (loc, code, TREE_TYPE (expr), op0, op1)
@@ -1380,8 +1406,15 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands,
orig_op1 = op1 = TREE_OPERAND (expr, 1);
orig_op2 = op2 = TREE_OPERAND (expr, 2);
op0 = c_fully_fold_internal (op0, in_init, &op0_const, &op0_const_self);
+
+ c_inhibit_evaluation_warnings += (op0 == truthvalue_false_node);
op1 = c_fully_fold_internal (op1, in_init, &op1_const, &op1_const_self);
+ c_inhibit_evaluation_warnings -= (op0 == truthvalue_false_node);
+
+ c_inhibit_evaluation_warnings += (op0 == truthvalue_true_node);
op2 = c_fully_fold_internal (op2, in_init, &op2_const, &op2_const_self);
+ c_inhibit_evaluation_warnings -= (op0 == truthvalue_true_node);
+
if (op0 != orig_op0 || op1 != orig_op1 || op2 != orig_op2)
ret = fold_build3_loc (loc, code, TREE_TYPE (expr), op0, op1, op2);
else
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c
index 921addbccf0..d9b95aff443 100644
--- a/gcc/c-cppbuiltin.c
+++ b/gcc/c-cppbuiltin.c
@@ -782,8 +782,7 @@ c_cpp_builtins (cpp_reader *pfile)
cpp_define (pfile, "__NEXT_RUNTIME__");
/* Show the availability of some target pragmas. */
- if (flag_mudflap || targetm.handle_pragma_redefine_extname)
- cpp_define (pfile, "__PRAGMA_REDEFINE_EXTNAME");
+ cpp_define (pfile, "__PRAGMA_REDEFINE_EXTNAME");
if (targetm.handle_pragma_extern_prefix)
cpp_define (pfile, "__PRAGMA_EXTERN_PREFIX");
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 0b6fcc00b31..0c6cdab9dff 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -390,7 +390,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags,
case CPP_HASH:
case CPP_PASTE:
{
- unsigned char name[4];
+ unsigned char name[8];
*cpp_spell_token (parse_in, tok, name, true) = 0;
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index c91ee991dba..b707d165944 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -561,14 +561,6 @@ handle_pragma_redefine_extname (cpp_reader * ARG_UNUSED (dummy))
if (t != CPP_EOF)
warning (OPT_Wpragmas, "junk at end of %<#pragma redefine_extname%>");
- if (!flag_mudflap && !targetm.handle_pragma_redefine_extname)
- {
- if (warn_unknown_pragmas > in_system_header)
- warning (OPT_Wunknown_pragmas,
- "#pragma redefine_extname not supported on this target");
- return;
- }
-
decl = identifier_global_value (oldname);
if (decl
&& (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 42bebe3543c..01cdcd201fe 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -3912,10 +3912,19 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
that folding in this case even without
warn_sign_compare to avoid warning options
possibly affecting code generation. */
+ c_inhibit_evaluation_warnings
+ += (ifexp == truthvalue_false_node);
op1 = c_fully_fold (op1, require_constant_value,
&op1_maybe_const);
+ c_inhibit_evaluation_warnings
+ -= (ifexp == truthvalue_false_node);
+
+ c_inhibit_evaluation_warnings
+ += (ifexp == truthvalue_true_node);
op2 = c_fully_fold (op2, require_constant_value,
&op2_maybe_const);
+ c_inhibit_evaluation_warnings
+ -= (ifexp == truthvalue_true_node);
if (warn_sign_compare)
{
@@ -9509,10 +9518,12 @@ build_binary_op (location_t location, enum tree_code code,
build_conditional_expr. This requires the
"original" values to be folded, not just op0 and
op1. */
+ c_inhibit_evaluation_warnings++;
op0 = c_fully_fold (op0, require_constant_value,
&op0_maybe_const);
op1 = c_fully_fold (op1, require_constant_value,
&op1_maybe_const);
+ c_inhibit_evaluation_warnings--;
orig_op0_folded = c_fully_fold (orig_op0,
require_constant_value,
NULL);
diff --git a/gcc/calls.c b/gcc/calls.c
index bac4f8bb5d9..cdb934a2785 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1122,13 +1122,9 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
}
}
- mode = TYPE_MODE (type);
unsignedp = TYPE_UNSIGNED (type);
-
- if (targetm.calls.promote_function_args (fndecl
- ? TREE_TYPE (fndecl)
- : fntype))
- mode = promote_mode (type, mode, &unsignedp, 1);
+ mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp,
+ fndecl ? TREE_TYPE (fndecl) : fntype, 0);
args[i].unsignedp = unsignedp;
args[i].mode = mode;
@@ -1308,29 +1304,33 @@ precompute_arguments (int num_actuals, struct arg_data *args)
for (i = 0; i < num_actuals; i++)
{
+ tree type;
enum machine_mode mode;
if (TREE_CODE (args[i].tree_value) != CALL_EXPR)
continue;
/* If this is an addressable type, we cannot pre-evaluate it. */
- gcc_assert (!TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)));
+ type = TREE_TYPE (args[i].tree_value);
+ gcc_assert (!TREE_ADDRESSABLE (type));
args[i].initial_value = args[i].value
= expand_normal (args[i].tree_value);
- mode = TYPE_MODE (TREE_TYPE (args[i].tree_value));
+ mode = TYPE_MODE (type);
if (mode != args[i].mode)
{
+ int unsignedp = args[i].unsignedp;
args[i].value
= convert_modes (args[i].mode, mode,
args[i].value, args[i].unsignedp);
-#if defined(PROMOTE_FUNCTION_MODE) && !defined(PROMOTE_MODE)
+
/* CSE will replace this only if it contains args[i].value
pseudo, so convert it down to the declared mode using
a SUBREG. */
if (REG_P (args[i].value)
- && GET_MODE_CLASS (args[i].mode) == MODE_INT)
+ && GET_MODE_CLASS (args[i].mode) == MODE_INT
+ && promote_mode (type, mode, &unsignedp) != args[i].mode)
{
args[i].initial_value
= gen_lowpart_SUBREG (mode, args[i].value);
@@ -1338,7 +1338,6 @@ precompute_arguments (int num_actuals, struct arg_data *args)
SUBREG_PROMOTED_UNSIGNED_SET (args[i].initial_value,
args[i].unsignedp);
}
-#endif
}
}
}
@@ -2346,17 +2345,17 @@ expand_call (tree exp, rtx target, int ignore)
tree caller_res = DECL_RESULT (current_function_decl);
caller_unsignedp = TYPE_UNSIGNED (TREE_TYPE (caller_res));
- caller_mode = caller_promoted_mode = DECL_MODE (caller_res);
+ caller_mode = DECL_MODE (caller_res);
callee_unsignedp = TYPE_UNSIGNED (TREE_TYPE (funtype));
- callee_mode = callee_promoted_mode = TYPE_MODE (TREE_TYPE (funtype));
- if (targetm.calls.promote_function_return (TREE_TYPE (current_function_decl)))
- caller_promoted_mode
- = promote_mode (TREE_TYPE (caller_res), caller_mode,
- &caller_unsignedp, 1);
- if (targetm.calls.promote_function_return (funtype))
- callee_promoted_mode
- = promote_mode (TREE_TYPE (funtype), callee_mode,
- &callee_unsignedp, 1);
+ callee_mode = TYPE_MODE (TREE_TYPE (funtype));
+ caller_promoted_mode
+ = promote_function_mode (TREE_TYPE (caller_res), caller_mode,
+ &caller_unsignedp,
+ TREE_TYPE (current_function_decl), 1);
+ callee_promoted_mode
+ = promote_function_mode (TREE_TYPE (funtype), callee_mode,
+ &callee_unsignedp,
+ funtype, 1);
if (caller_mode != VOIDmode
&& (caller_promoted_mode != callee_promoted_mode
|| ((caller_mode != caller_promoted_mode
@@ -3030,38 +3029,37 @@ expand_call (tree exp, rtx target, int ignore)
else
target = copy_to_reg (avoid_likely_spilled_reg (valreg));
- if (targetm.calls.promote_function_return(funtype))
+ /* If we promoted this return value, make the proper SUBREG.
+ TARGET might be const0_rtx here, so be careful. */
+ if (REG_P (target)
+ && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
+ && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
{
- /* If we promoted this return value, make the proper SUBREG.
- TARGET might be const0_rtx here, so be careful. */
- if (REG_P (target)
- && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
- && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
+ tree type = TREE_TYPE (exp);
+ int unsignedp = TYPE_UNSIGNED (type);
+ int offset = 0;
+ enum machine_mode pmode;
+
+ /* Ensure we promote as expected, and get the new unsignedness. */
+ pmode = promote_function_mode (type, TYPE_MODE (type), &unsignedp,
+ funtype, 1);
+ gcc_assert (GET_MODE (target) == pmode);
+
+ if ((WORDS_BIG_ENDIAN || BYTES_BIG_ENDIAN)
+ && (GET_MODE_SIZE (GET_MODE (target))
+ > GET_MODE_SIZE (TYPE_MODE (type))))
{
- tree type = TREE_TYPE (exp);
- int unsignedp = TYPE_UNSIGNED (type);
- int offset = 0;
- enum machine_mode pmode;
-
- pmode = promote_mode (type, TYPE_MODE (type), &unsignedp, 1);
- /* If we don't promote as expected, something is wrong. */
- gcc_assert (GET_MODE (target) == pmode);
-
- if ((WORDS_BIG_ENDIAN || BYTES_BIG_ENDIAN)
- && (GET_MODE_SIZE (GET_MODE (target))
- > GET_MODE_SIZE (TYPE_MODE (type))))
- {
- offset = GET_MODE_SIZE (GET_MODE (target))
- - GET_MODE_SIZE (TYPE_MODE (type));
- if (! BYTES_BIG_ENDIAN)
- offset = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
- else if (! WORDS_BIG_ENDIAN)
- offset %= UNITS_PER_WORD;
- }
- target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
- SUBREG_PROMOTED_VAR_P (target) = 1;
- SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp);
+ offset = GET_MODE_SIZE (GET_MODE (target))
+ - GET_MODE_SIZE (TYPE_MODE (type));
+ if (! BYTES_BIG_ENDIAN)
+ offset = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
+ else if (! WORDS_BIG_ENDIAN)
+ offset %= UNITS_PER_WORD;
}
+
+ target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
+ SUBREG_PROMOTED_VAR_P (target) = 1;
+ SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp);
}
/* If size of args is variable or this was a constructor call for a stack
@@ -3807,7 +3805,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
cse'ing of library calls could delete a call and leave the pop. */
NO_DEFER_POP;
valreg = (mem_value == 0 && outmode != VOIDmode
- ? hard_libcall_value (outmode) : NULL_RTX);
+ ? hard_libcall_value (outmode, orgfun) : NULL_RTX);
/* Stack must be properly aligned now. */
gcc_assert (!(stack_pointer_delta
@@ -3876,15 +3874,14 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
}
else
{
- /* Convert to the proper mode if PROMOTE_MODE has been active. */
+ /* Convert to the proper mode if a promotion has been active. */
if (GET_MODE (valreg) != outmode)
{
int unsignedp = TYPE_UNSIGNED (tfom);
- gcc_assert (targetm.calls.promote_function_return (tfom));
- gcc_assert (promote_mode (tfom, outmode, &unsignedp, 0)
+ gcc_assert (promote_function_mode (tfom, outmode, &unsignedp,
+ fndecl ? TREE_TYPE (fndecl) : fntype, 1)
== GET_MODE (valreg));
-
valreg = convert_modes (outmode, GET_MODE (valreg), valreg, 0);
}
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 7b16dfd3c73..fdf88b42339 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -74,6 +74,9 @@ gimple_assign_rhs_to_tree (gimple stmt)
else
gcc_unreachable ();
+ if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (t))
+ SET_EXPR_LOCATION (t, gimple_location (stmt));
+
return t;
}
@@ -1199,9 +1202,7 @@ expand_one_register_var (tree var)
{
tree decl = SSAVAR (var);
tree type = TREE_TYPE (decl);
- int unsignedp = TYPE_UNSIGNED (type);
- enum machine_mode reg_mode
- = promote_mode (type, DECL_MODE (decl), &unsignedp, 0);
+ enum machine_mode reg_mode = promote_decl_mode (decl, NULL);
rtx x = gen_reg_rtx (reg_mode);
set_rtl (var, x);
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index e74284e8988..b9af098d070 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -338,6 +338,7 @@ alloc_loop (void)
loop->exits = GGC_CNEW (struct loop_exit);
loop->exits->next = loop->exits->prev = loop->exits;
+ loop->can_be_parallel = false;
return loop;
}
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 2bc965b577b..d6c26bf0ba0 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -157,6 +157,9 @@ struct GTY ((chain_next ("%h.next"))) loop {
/* Head of the cyclic list of the exits of the loop. */
struct loop_exit *exits;
+
+ /* True if the loop can be parallel. */
+ bool can_be_parallel;
};
/* Flags for state of loop structure. */
@@ -283,7 +286,7 @@ extern bool can_duplicate_loop_p (const struct loop *loop);
extern edge create_empty_if_region_on_edge (edge, tree);
extern struct loop *create_empty_loop_on_edge (edge, tree, tree, tree, tree,
- tree *, struct loop *);
+ tree *, tree *, struct loop *);
extern struct loop * duplicate_loop (struct loop *, struct loop *);
extern bool duplicate_loop_to_header_edge (struct loop *, edge,
unsigned, sbitmap, edge,
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index 28cfa3cfc9a..40e3f8e9a59 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -588,31 +588,35 @@ create_empty_if_region_on_edge (edge entry_edge, tree condition)
/* create_empty_loop_on_edge
|
- | ------------- ------------------------
- | | pred_bb | | pred_bb |
- | ------------- | IV_0 = INITIAL_VALUE |
- | | ------------------------
- | | ______ | ENTRY_EDGE
- | | ENTRY_EDGE / V V
- | | ====> | -----------------------------
- | | | | IV_BEFORE = phi (IV_0, IV) |
- | | | | loop_header |
- | V | | IV_BEFORE <= UPPER_BOUND |
- | ------------- | -----------------------\-----
- | | succ_bb | | | \
- | ------------- | | \ exit_e
- | | V V---------
- | | -------------- | succ_bb |
- | | | loop_latch | ----------
- | | |IV = IV_BEFORE + STRIDE
- | | --------------
- | \ /
- | \ ___ /
+ | - pred_bb - ------ pred_bb ------
+ | | | | iv0 = initial_value |
+ | -----|----- ---------|-----------
+ | | ______ | entry_edge
+ | | entry_edge / | |
+ | | ====> | -V---V- loop_header -------------
+ | V | | iv_before = phi (iv0, iv_after) |
+ | - succ_bb - | ---|-----------------------------
+ | | | | |
+ | ----------- | ---V--- loop_body ---------------
+ | | | iv_after = iv_before + stride |
+ | | | if (iv_after <= upper_bound) |
+ | | ---|--------------\--------------
+ | | | \ exit_e
+ | | V \
+ | | - loop_latch - V- succ_bb -
+ | | | | | |
+ | | /------------- -----------
+ | \ ___ /
Creates an empty loop as shown above, the IV_BEFORE is the SSA_NAME
that is used before the increment of IV. IV_BEFORE should be used for
adding code to the body that uses the IV. OUTER is the outer loop in
- which the new loop should be inserted. */
+ which the new loop should be inserted.
+
+ Both INITIAL_VALUE and UPPER_BOUND expressions are gimplified and
+ inserted on the loop entry edge. This implies that this function
+ should be used only when the UPPER_BOUND expression is a loop
+ invariant. */
struct loop *
create_empty_loop_on_edge (edge entry_edge,
@@ -620,6 +624,7 @@ create_empty_loop_on_edge (edge entry_edge,
tree stride, tree upper_bound,
tree iv,
tree *iv_before,
+ tree *iv_after,
struct loop *outer)
{
basic_block loop_header, loop_latch, succ_bb, pred_bb;
@@ -627,13 +632,11 @@ create_empty_loop_on_edge (edge entry_edge,
int freq;
gcov_type cnt;
gimple_stmt_iterator gsi;
- bool insert_after;
gimple_seq stmts;
gimple cond_expr;
tree exit_test;
edge exit_e;
int prob;
- tree upper_bound_gimplified;
gcc_assert (entry_edge && initial_value && stride && upper_bound && iv);
@@ -667,6 +670,11 @@ create_empty_loop_on_edge (edge entry_edge,
/* Update dominators. */
update_dominators_in_loop (loop);
+ /* Modify edge flags. */
+ exit_e = single_exit (loop);
+ exit_e->flags = EDGE_LOOP_EXIT | EDGE_FALSE_VALUE;
+ single_pred_edge (loop_latch)->flags = EDGE_TRUE_VALUE;
+
/* Construct IV code in loop. */
initial_value = force_gimple_operand (initial_value, &stmts, true, iv);
if (stmts)
@@ -675,24 +683,20 @@ create_empty_loop_on_edge (edge entry_edge,
gsi_commit_edge_inserts ();
}
- standard_iv_increment_position (loop, &gsi, &insert_after);
- create_iv (initial_value, stride, iv, loop, &gsi, insert_after,
- iv_before, NULL);
-
- /* Modify edge flags. */
- exit_e = single_exit (loop);
- exit_e->flags = EDGE_LOOP_EXIT | EDGE_FALSE_VALUE;
- single_pred_edge (loop_latch)->flags = EDGE_TRUE_VALUE;
+ upper_bound = force_gimple_operand (upper_bound, &stmts, true, NULL);
+ if (stmts)
+ {
+ gsi_insert_seq_on_edge (loop_preheader_edge (loop), stmts);
+ gsi_commit_edge_inserts ();
+ }
- gsi = gsi_last_bb (exit_e->src);
+ gsi = gsi_last_bb (loop_header);
+ create_iv (initial_value, stride, iv, loop, &gsi, false,
+ iv_before, iv_after);
- upper_bound_gimplified =
- force_gimple_operand_gsi (&gsi, upper_bound, true, NULL,
- false, GSI_NEW_STMT);
- gsi = gsi_last_bb (exit_e->src);
-
- cond_expr = gimple_build_cond
- (LE_EXPR, *iv_before, upper_bound_gimplified, NULL_TREE, NULL_TREE);
+ /* Insert loop exit condition. */
+ cond_expr = gimple_build_cond
+ (LE_EXPR, *iv_after, upper_bound, NULL_TREE, NULL_TREE);
exit_test = gimple_cond_lhs (cond_expr);
exit_test = force_gimple_operand_gsi (&gsi, exit_test, true, NULL,
@@ -701,6 +705,8 @@ create_empty_loop_on_edge (edge entry_edge,
gsi = gsi_last_bb (exit_e->src);
gsi_insert_after (&gsi, cond_expr, GSI_NEW_STMT);
+ split_block_after_labels (loop_header);
+
return loop;
}
diff --git a/gcc/combine.c b/gcc/combine.c
index 3689f6446e8..bc61fbedcf4 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1333,9 +1333,6 @@ setup_incoming_promotions (rtx first)
tree arg;
bool strictly_local = false;
- if (!targetm.calls.promote_function_args (TREE_TYPE (cfun->decl)))
- return;
-
for (arg = DECL_ARGUMENTS (current_function_decl); arg;
arg = TREE_CHAIN (arg))
{
@@ -1365,7 +1362,8 @@ setup_incoming_promotions (rtx first)
/* The mode and signedness of the argument as it is actually passed,
after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */
- mode3 = promote_mode (DECL_ARG_TYPE (arg), mode2, &uns3, 1);
+ mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3,
+ TREE_TYPE (cfun->decl), 0);
/* The mode of the register in which the argument is being passed. */
mode4 = GET_MODE (reg);
@@ -7524,13 +7522,20 @@ canon_reg_for_combine (rtx x, rtx reg)
static rtx
gen_lowpart_or_truncate (enum machine_mode mode, rtx x)
{
- if (GET_MODE_SIZE (GET_MODE (x)) <= GET_MODE_SIZE (mode)
- || TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
- GET_MODE_BITSIZE (GET_MODE (x)))
- || (REG_P (x) && reg_truncated_to_mode (mode, x)))
- return gen_lowpart (mode, x);
- else
- return simplify_gen_unary (TRUNCATE, mode, x, GET_MODE (x));
+ if (!CONST_INT_P (x)
+ && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x))
+ && !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode),
+ GET_MODE_BITSIZE (GET_MODE (x)))
+ && !(REG_P (x) && reg_truncated_to_mode (mode, x)))
+ {
+ /* Bit-cast X into an integer mode. */
+ if (!SCALAR_INT_MODE_P (GET_MODE (x)))
+ x = gen_lowpart (int_mode_for_mode (GET_MODE (x)), x);
+ x = simplify_gen_unary (TRUNCATE, int_mode_for_mode (mode),
+ x, GET_MODE (x));
+ }
+
+ return gen_lowpart (mode, x);
}
/* See if X can be simplified knowing that we will only refer to it in
@@ -7617,9 +7622,20 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask,
&& (GET_MODE_MASK (GET_MODE (x)) & ~mask) == 0)
return gen_lowpart (mode, x);
- /* The arithmetic simplifications here do the wrong thing on vector modes. */
- if (VECTOR_MODE_P (mode) || VECTOR_MODE_P (GET_MODE (x)))
- return gen_lowpart (mode, x);
+ /* We can ignore the effect of a SUBREG if it narrows the mode or
+ if the constant masks to zero all the bits the mode doesn't have. */
+ if (GET_CODE (x) == SUBREG
+ && subreg_lowpart_p (x)
+ && ((GET_MODE_SIZE (GET_MODE (x))
+ < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
+ || (0 == (mask
+ & GET_MODE_MASK (GET_MODE (x))
+ & ~GET_MODE_MASK (GET_MODE (SUBREG_REG (x)))))))
+ return force_to_mode (SUBREG_REG (x), mode, mask, next_select);
+
+ /* The arithmetic simplifications here only work for scalar integer modes. */
+ if (!SCALAR_INT_MODE_P (mode) || !SCALAR_INT_MODE_P (GET_MODE (x)))
+ return gen_lowpart_or_truncate (mode, x);
switch (code)
{
@@ -7637,19 +7653,6 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask,
return force_to_mode (x, mode, mask, next_select);
break;
- case SUBREG:
- if (subreg_lowpart_p (x)
- /* We can ignore the effect of this SUBREG if it narrows the mode or
- if the constant masks to zero all the bits the mode doesn't
- have. */
- && ((GET_MODE_SIZE (GET_MODE (x))
- < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
- || (0 == (mask
- & GET_MODE_MASK (GET_MODE (x))
- & ~GET_MODE_MASK (GET_MODE (SUBREG_REG (x)))))))
- return force_to_mode (SUBREG_REG (x), mode, mask, next_select);
- break;
-
case TRUNCATE:
/* Similarly for a truncate. */
return force_to_mode (XEXP (x, 0), mode, mask, next_select);
@@ -9303,13 +9306,9 @@ try_widen_shift_mode (enum rtx_code code, rtx op, int count,
/* We can also widen if the bits brought in will be masked off. This
operation is performed in ORIG_MODE. */
- if (outer_code == AND
- && GET_MODE_BITSIZE (orig_mode) <= HOST_BITS_PER_WIDE_INT)
+ if (outer_code == AND)
{
- int care_bits;
-
- outer_const &= GET_MODE_MASK (orig_mode);
- care_bits = exact_log2 (outer_const + 1);
+ int care_bits = low_bitmask_len (orig_mode, outer_const);
if (care_bits >= 0
&& GET_MODE_BITSIZE (orig_mode) - care_bits >= count)
diff --git a/gcc/common.opt b/gcc/common.opt
index 5f4962a0599..6e8e23b25cb 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -571,6 +571,14 @@ fgraphite
Common Report Var(flag_graphite)
Enable in and out of Graphite representation
+fgraphite-identity
+Common Report Var(flag_graphite_identity) Optimization
+Enable Graphite Identity transformation
+
+floop-parallelize-all
+Common Report Var(flag_loop_parallelize_all) Optimization
+Mark all loops as parallel
+
floop-strip-mine
Common Report Var(flag_loop_strip_mine) Optimization
Enable Loop Strip Mining transformation
@@ -583,11 +591,6 @@ floop-block
Common Report Var(flag_loop_block) Optimization
Enable Loop Blocking transformation
-; This option is not documented as it does not perform any useful optimization.
-fgraphite-identity
-Common Report Var(flag_graphite_identity) Optimization
-Enable Graphite Identity transformation
-
fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
diff --git a/gcc/config.build b/gcc/config.build
index d08143493d9..0ed87546d80 100644
--- a/gcc/config.build
+++ b/gcc/config.build
@@ -1,5 +1,5 @@
# GCC build-specific configuration file.
-# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008
+# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008, 2009
# Free Software Foundation, Inc.
#This file is part of GCC.
@@ -56,12 +56,19 @@ case $build in
# a broken tar, so we use cpio instead.
build_install_headers_dir=install-headers-cpio
;;
+ alpha64-dec-*vms*)
+ build_xm_file="vms/xm-vms.h vms/xm-vms64.h"
+ build_exeext=.exe
+ build_install_headers_dir=install-headers-cp
+ prefix=/gnu
+ local_prefix=/gnu/local
+ ;;
alpha*-dec-*vms*)
- build_xm_file=alpha/xm-vms.h
+ build_xm_file="vms/xm-vms.h"
build_exeext=.exe
build_install_headers_dir=install-headers-cp
prefix=/gnu
- local_prefix=/gnu
+ local_prefix=/gnu/local
;;
hppa1.0-*-hpux1[01]* | \
hppa*64*-*-hpux11* | \
@@ -111,6 +118,13 @@ case $build in
i386-*-vsta)
# Intel 80386's running VSTa kernel
;;
+ ia64-hp-*vms*)
+ build_xm_file="vms/xm-vms.h vms/xm-vms64.h"
+ build_exeext=.exe
+ build_install_headers_dir=install-headers-cp
+ prefix=/gnu
+ local_prefix=/gnu/local
+ ;;
m68000-hp-hpux* | m68k-hp-hpux*)
# HP 9000 series 300
build_install_headers_dir=install-headers-cpio
diff --git a/gcc/config.gcc b/gcc/config.gcc
index ddc8fc869eb..c8eb88e1665 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -669,17 +669,21 @@ alpha*-dec-osf[45]*)
;;
alpha64-dec-*vms*)
tm_file="${tm_file} alpha/vms.h alpha/vms64.h"
- xm_file="alpha/xm-vms.h"
- tmake_file="alpha/t-alpha alpha/t-vms alpha/t-vms64 alpha/t-ieee"
- prefix=/gnu
- local_prefix=/gnu
+ xm_file="alpha/xm-vms.h vms/xm-vms64.h"
+ tmake_file="alpha/t-alpha vms/t-vms vms/t-vms64 alpha/t-vms alpha/t-ieee"
+ xmake_file=vms/x-vms
+ exeext=.exe
+ install_headers_dir=install-headers-cp
+ extra_options="${extra_options} vms/vms.opt"
;;
alpha*-dec-*vms*)
tm_file="${tm_file} alpha/vms.h"
- xm_file=alpha/xm-vms.h
- tmake_file="alpha/t-alpha alpha/t-vms alpha/t-ieee"
- prefix=/gnu
- local_prefix=/gnu
+ xm_file="alpha/xm-vms.h"
+ tmake_file="alpha/t-alpha vms/t-vms alpha/t-vms alpha/t-ieee"
+ xmake_file=vms/x-vms
+ exeext=.exe
+ install_headers_dir=install-headers-cp
+ extra_options="${extra_options} vms/vms.opt"
;;
arc-*-elf*)
tm_file="dbxelf.h elfos.h svr4.h newlib-stdint.h ${tm_file}"
@@ -894,6 +898,15 @@ moxie-*-elf)
extra_parts="crti.o crtn.o crtbegin.o crtend.o"
tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp soft-fp/t-softfp"
;;
+moxie-*-uclinux*)
+ gas=yes
+ gnu_ld=yes
+ tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h glibc-stdint.h moxie/uclinux.h"
+ extra_parts="crti.o crtn.o crtbegin.o crtend.o"
+ tmake_file="${tmake_file} moxie/t-moxie moxie/t-moxie-softfp soft-fp/t-softfp"
+ tm_defines="${tm_defines} UCLIBC_DEFAULT=1"
+ extra_options="${extra_options} linux.opt"
+ ;;
h8300-*-rtems*)
tmake_file="h8300/t-h8300 h8300/t-elf t-rtems h8300/t-rtems"
tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h rtems.h newlib-stdint.h"
@@ -942,6 +955,8 @@ hppa[12]*-*-hpux10*)
extra_options="${extra_options} pa/pa-hpux1010.opt"
;;
esac
+ use_gcc_stdint=provide
+ tm_file="${tm_file} hpux-stdint.h"
tmake_file="pa/t-pa-hpux10 pa/t-pa-hpux pa/t-hpux-shlib"
case ${enable_threads} in
"")
@@ -1157,6 +1172,7 @@ i[34567]86-pc-msdosdjgpp*)
extra_options="${extra_options} i386/djgpp.opt"
gnu_ld=yes
gas=yes
+ use_gcc_stdint=wrap
;;
i[34567]86-*-lynxos*)
xm_defines=POSIX
@@ -1405,6 +1421,20 @@ ia64*-*-hpux*)
use_gcc_stdint=wrap
tm_file="${tm_file} hpux-stdint.h"
;;
+ia64-hp-*vms*)
+ tm_file="${tm_file} elfos.h ia64/sysv4.h ia64/elf.h ia64/vms.h ia64/vms64.h"
+ xm_file="vms/xm-vms.h vms/xm-vms64.h"
+ tmake_file="vms/t-vms vms/t-vms64 ia64/t-ia64 ia64/t-vms"
+ xmake_file=vms/x-vms
+ target_cpu_default="0"
+ if test x$gas = xyes
+ then
+ target_cpu_default="${target_cpu_default}|MASK_GNU_AS"
+ fi
+ exeext=.exe
+ install_headers_dir=install-headers-cp
+ extra_options="${extra_options} vms/vms.opt"
+ ;;
iq2000*-*-elf*)
tm_file="svr4.h elfos.h newlib-stdint.h iq2000/iq2000.h"
tmake_file=iq2000/t-iq2000
@@ -2087,7 +2117,7 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
sh*-*-linux*) tmake_file="${tmake_file} sh/t-linux"
tm_file="${tm_file} linux.h glibc-stdint.h sh/linux.h" ;;
sh*-*-netbsd*) tm_file="${tm_file} netbsd.h netbsd-elf.h sh/netbsd-elf.h" ;;
- sh*-superh-elf) if test x$with_libgloss != xno; then
+ sh*-*-elf) if test x$with_libgloss != xno; then
with_libgloss=yes
tm_file="${tm_file} sh/newlib.h"
fi
diff --git a/gcc/config.host b/gcc/config.host
index b06d1648c73..a8ec32455aa 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -1,5 +1,5 @@
# GCC host-specific configuration file.
-# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008
+# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
#This file is part of GCC.
@@ -155,17 +155,21 @@ esac
# Machine-specific settings.
case ${host} in
+ alpha64-dec-*vms*)
+ host_xm_file="vms/xm-vms.h vms/xm-vms64.h"
+ host_xmake_file=vms/x-vms
+ host_exeext=.exe
+ host_can_use_collect2=no
+ prefix=/gnu
+ local_prefix=/gnu/local
+ ;;
alpha*-dec-*vms*)
- host_xm_file=alpha/xm-vms.h
- host_xmake_file="${host_xmake_file} alpha/x-vms"
- extra_programs="ld.exe decc.exe"
+ host_xm_file="vms/xm-vms.h"
+ host_xmake_file=vms/x-vms
host_exeext=.exe
host_can_use_collect2=no
- # This removes the cpu type and manufacturer components and
- # replaces "." with "_" in the operating system version.
- target_noncanonical=`echo $host | sed 's/.*-.*-\(.*\)$/\1/' | sed 's/\./_/g'`
prefix=/gnu
- local_prefix=/gnu
+ local_prefix=/gnu/local
;;
hppa1.0-*-hpux10* | hppa1.1-*-hpux10* | hppa2*-*-hpux10*)
out_host_hook_obj=host-hpux.o
@@ -218,6 +222,14 @@ case ${host} in
out_host_hook_obj="${out_host_hook_obj} host-i386-darwin.o"
host_xmake_file="${host_xmake_file} i386/x-darwin"
;;
+ ia64-hp-*vms*)
+ host_xm_file="vms/xm-vms.h vms/xm-vms64.h"
+ host_xmake_file=vms/x-vms
+ host_exeext=.exe
+ host_can_use_collect2=no
+ prefix=/gnu
+ local_prefix=/gnu/local
+ ;;
powerpc-*-beos*)
host_can_use_collect2=no
;;
diff --git a/gcc/config.in b/gcc/config.in
index cc0202beec2..ee6535e8990 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -321,6 +321,12 @@
#endif
+/* Define if your assembler supports LWSYNC instructions. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_LWSYNC
+#endif
+
+
/* Define if your assembler supports mfcr field. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_MFCRF
@@ -351,22 +357,17 @@
#endif
-/* Define if your assembler supports popcntb instruction. */
+/* Define if your assembler supports popcntb field. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_POPCNTB
#endif
-/* Define if your assembler supports popcntd instruction. */
+/* Define if your assembler supports POPCNTD instructions. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_POPCNTD
#endif
-/* Define if your assembler supports lwsync instruction. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_LWSYNC
-#endif
-
/* Define if your assembler supports .register. */
#ifndef USED_FOR_TARGET
@@ -886,6 +887,12 @@
#endif
+/* Define if your assembler supports @gnu_unique_object. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_GAS_GNU_UNIQUE_OBJECT
+#endif
+
+
/* Define if your assembler and linker support .hidden. */
#undef HAVE_GAS_HIDDEN
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index 80c1e4f8f63..43665d3af20 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -1,5 +1,5 @@
/* Prototypes for alpha.c functions used in the md file & elsewhere.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -28,8 +28,6 @@ extern int direct_return (void);
extern int alpha_sa_size (void);
extern HOST_WIDE_INT alpha_initial_elimination_offset (unsigned int,
unsigned int);
-extern int alpha_pv_save_size (void);
-extern int alpha_using_fp (void);
extern void alpha_expand_prologue (void);
extern void alpha_expand_epilogue (void);
extern void alpha_output_filename (FILE *, const char *);
@@ -67,6 +65,9 @@ extern rtx alpha_expand_zap_mask (HOST_WIDE_INT);
extern void alpha_expand_builtin_vector_binop (rtx (*)(rtx, rtx, rtx),
enum machine_mode,
rtx, rtx, rtx);
+extern void alpha_expand_builtin_establish_vms_condition_handler (rtx, rtx);
+extern void alpha_expand_builtin_revert_vms_condition_handler (rtx);
+
extern rtx alpha_return_addr (int, rtx);
extern rtx alpha_gp_save_rtx (void);
extern void print_operand (FILE *, rtx, int);
@@ -109,6 +110,13 @@ extern rtx alpha_use_linkage (rtx, tree, int, int);
#if TARGET_ABI_OPEN_VMS
extern enum avms_arg_type alpha_arg_type (enum machine_mode);
extern rtx alpha_arg_info_reg_val (CUMULATIVE_ARGS);
+extern void avms_asm_output_external (FILE *, tree, const char *);
+extern void vms_output_aligned_decl_common (FILE *, tree, const char *,
+ unsigned HOST_WIDE_INT,
+ unsigned int);
+extern int alpha_vms_can_eliminate (unsigned int, unsigned int);
+extern HOST_WIDE_INT alpha_vms_initial_elimination_offset (unsigned int,
+ unsigned int);
#endif
extern rtx unicosmk_add_call_info_word (rtx);
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index a9f5fba7ca5..e1644918850 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-stdarg.h"
#include "tm-constrs.h"
#include "df.h"
+#include "libfuncs.h"
/* Specify which cpu to schedule for. */
enum processor_type alpha_tune;
@@ -199,6 +200,7 @@ static rtx alpha_emit_xfloating_compare (enum rtx_code *, rtx, rtx);
#if TARGET_ABI_OPEN_VMS
static void alpha_write_linkage (FILE *, const char *, tree);
+static bool vms_valid_pointer_mode (enum machine_mode);
#endif
static void unicosmk_output_deferred_case_vectors (FILE *);
@@ -773,6 +775,12 @@ alpha_in_small_data_p (const_tree exp)
#if TARGET_ABI_OPEN_VMS
static bool
+vms_valid_pointer_mode (enum machine_mode mode)
+{
+ return (mode == SImode || mode == DImode);
+}
+
+static bool
alpha_linkage_symbol_p (const char *symname)
{
int symlen = strlen (symname);
@@ -2062,11 +2070,22 @@ alpha_legitimate_constant_p (rtx x)
switch (GET_CODE (x))
{
- case CONST:
case LABEL_REF:
case HIGH:
return true;
+ case CONST:
+ if (GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT)
+ x = XEXP (XEXP (x, 0), 0);
+ else
+ return true;
+
+ if (GET_CODE (x) != SYMBOL_REF)
+ return true;
+
+ /* FALLTHRU */
+
case SYMBOL_REF:
/* TLS symbols are never valid. */
return SYMBOL_REF_TLS_MODEL (x) == 0;
@@ -2654,6 +2673,13 @@ alpha_emit_conditional_move (rtx cmp, enum machine_mode mode)
int local_fast_math = flag_unsafe_math_optimizations;
rtx tem;
+ if (cmp_mode == TFmode)
+ {
+ op0 = alpha_emit_xfloating_compare (&code, op0, op1);
+ op1 = const0_rtx;
+ cmp_mode = DImode;
+ }
+
gcc_assert (cmp_mode == DFmode || cmp_mode == DImode);
if (FLOAT_MODE_P (cmp_mode) != FLOAT_MODE_P (mode))
@@ -4768,6 +4794,9 @@ struct GTY(()) machine_function
/* For TARGET_LD_BUGGY_LDGP. */
struct rtx_def *gp_save_rtx;
+
+ /* For VMS condition handlers. */
+ bool uses_condition_handler;
};
/* How to allocate a 'struct machine_function'. */
@@ -4779,6 +4808,63 @@ alpha_init_machine_status (void)
ggc_alloc_cleared (sizeof (struct machine_function)));
}
+/* Support for frame based VMS condition handlers. */
+
+/* A VMS condition handler may be established for a function with a call to
+ __builtin_establish_vms_condition_handler, and cancelled with a call to
+ __builtin_revert_vms_condition_handler.
+
+ The VMS Condition Handling Facility knows about the existence of a handler
+ from the procedure descriptor .handler field. As the VMS native compilers,
+ we store the user specified handler's address at a fixed location in the
+ stack frame and point the procedure descriptor at a common wrapper which
+ fetches the real handler's address and issues an indirect call.
+
+ The indirection wrapper is "__gcc_shell_handler", provided by libgcc.
+
+ We force the procedure kind to PT_STACK, and the fixed frame location is
+ fp+8, just before the register save area. We use the handler_data field in
+ the procedure descriptor to state the fp offset at which the installed
+ handler address can be found. */
+
+#define VMS_COND_HANDLER_FP_OFFSET 8
+
+/* Expand code to store the currently installed user VMS condition handler
+ into TARGET and install HANDLER as the new condition handler. */
+
+void
+alpha_expand_builtin_establish_vms_condition_handler (rtx target, rtx handler)
+{
+ rtx handler_slot_address
+ = plus_constant (hard_frame_pointer_rtx, VMS_COND_HANDLER_FP_OFFSET);
+
+ rtx handler_slot
+ = gen_rtx_MEM (DImode, handler_slot_address);
+
+ emit_move_insn (target, handler_slot);
+ emit_move_insn (handler_slot, handler);
+
+ /* Notify the start/prologue/epilogue emitters that the condition handler
+ slot is needed. In addition to reserving the slot space, this will force
+ the procedure kind to PT_STACK so ensure that the hard_frame_pointer_rtx
+ use above is correct. */
+ cfun->machine->uses_condition_handler = true;
+}
+
+/* Expand code to store the current VMS condition handler into TARGET and
+ nullify it. */
+
+void
+alpha_expand_builtin_revert_vms_condition_handler (rtx target)
+{
+ /* We implement this by establishing a null condition handler, with the tiny
+ side effect of setting uses_condition_handler. This is a little bit
+ pessimistic if no actual builtin_establish call is ever issued, which is
+ not a real problem and expected never to happen anyway. */
+
+ alpha_expand_builtin_establish_vms_condition_handler (target, const0_rtx);
+}
+
/* Functions to save and restore alpha_return_addr_rtx. */
/* Start the ball rolling with RETURN_ADDR_RTX. */
@@ -5480,6 +5566,35 @@ alpha_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt,
cxt = convert_memory_address (mode, cxt);
#endif
+ if (TARGET_ABI_OPEN_VMS)
+ {
+ rtx temp1, traddr;
+ const char *fnname;
+ char *trname;
+
+ /* Construct the name of the trampoline entry point. */
+ fnname = XSTR (fnaddr, 0);
+ trname = (char *) alloca (strlen (fnname) + 5);
+ strcpy (trname, fnname);
+ strcat (trname, "..tr");
+ traddr = gen_rtx_SYMBOL_REF
+ (mode, ggc_alloc_string (trname, strlen (trname) + 1));
+
+ /* Trampoline (or "bounded") procedure descriptor is constructed from
+ the function's procedure descriptor with certain fields zeroed IAW
+ the VMS calling standard. This is stored in the first quadword. */
+ temp1 = force_reg (DImode, gen_rtx_MEM (DImode, fnaddr));
+ temp1 = expand_and (DImode, temp1,
+ GEN_INT (0xffff0fff0000fff0), NULL_RTX);
+ addr = memory_address (mode, plus_constant (tramp, 0));
+ emit_move_insn (gen_rtx_MEM (DImode, addr), temp1);
+
+ /* Trampoline transfer address is stored in the second quadword
+ of the trampoline. */
+ addr = memory_address (mode, plus_constant (tramp, 8));
+ emit_move_insn (gen_rtx_MEM (mode, addr), traddr);
+ }
+
/* Store function address and CXT. */
addr = memory_address (mode, plus_constant (tramp, fnofs));
emit_move_insn (gen_rtx_MEM (mode, addr), fnaddr);
@@ -5670,7 +5785,14 @@ alpha_return_in_memory (const_tree type, const_tree fndecl ATTRIBUTE_UNUSED)
{
mode = TYPE_MODE (type);
- /* All aggregates are returned in memory. */
+ /* All aggregates are returned in memory, except on OpenVMS where
+ records that fit 64 bits should be returned by immediate value
+ as required by section 3.8.7.1 of the OpenVMS Calling Standard. */
+ if (TARGET_ABI_OPEN_VMS
+ && TREE_CODE (type) != ARRAY_TYPE
+ && (unsigned HOST_WIDE_INT) int_size_in_bytes(type) <= 8)
+ return false;
+
if (AGGREGATE_TYPE_P (type))
return true;
}
@@ -5741,7 +5863,10 @@ function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
switch (mclass)
{
case MODE_INT:
- PROMOTE_MODE (mode, dummy, valtype);
+ /* Do the same thing as PROMOTE_MODE except for libcalls on VMS,
+ where we have them returning both SImode and DImode. */
+ if (!(TARGET_ABI_OPEN_VMS && valtype && AGGREGATE_TYPE_P (valtype)))
+ PROMOTE_MODE (mode, dummy, valtype);
/* FALLTHRU */
case MODE_COMPLEX_INT:
@@ -5766,6 +5891,12 @@ function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
GEN_INT (GET_MODE_SIZE (cmode)))));
}
+ case MODE_RANDOM:
+ /* We should only reach here for BLKmode on VMS. */
+ gcc_assert (TARGET_ABI_OPEN_VMS && mode == BLKmode);
+ regnum = 0;
+ break;
+
default:
gcc_unreachable ();
}
@@ -6159,12 +6290,11 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
if (TARGET_ABI_OPEN_VMS)
{
- nextarg = plus_constant (nextarg, offset);
- nextarg = plus_constant (nextarg, NUM_ARGS * UNITS_PER_WORD);
- t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist,
- make_tree (ptr_type_node, nextarg));
+ t = make_tree (ptr_type_node, virtual_incoming_args_rtx);
+ t = build2 (POINTER_PLUS_EXPR, ptr_type_node, t,
+ size_int (offset + NUM_ARGS * UNITS_PER_WORD));
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
TREE_SIDE_EFFECTS (t) = 1;
-
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
else
@@ -6340,6 +6470,8 @@ enum alpha_builtin
ALPHA_BUILTIN_RPCC,
ALPHA_BUILTIN_THREAD_POINTER,
ALPHA_BUILTIN_SET_THREAD_POINTER,
+ ALPHA_BUILTIN_ESTABLISH_VMS_CONDITION_HANDLER,
+ ALPHA_BUILTIN_REVERT_VMS_CONDITION_HANDLER,
/* TARGET_MAX */
ALPHA_BUILTIN_MINUB8,
@@ -6395,6 +6527,8 @@ static enum insn_code const code_for_builtin[ALPHA_BUILTIN_max] = {
CODE_FOR_builtin_rpcc,
CODE_FOR_load_tp,
CODE_FOR_set_tp,
+ CODE_FOR_builtin_establish_vms_condition_handler,
+ CODE_FOR_builtin_revert_vms_condition_handler,
/* TARGET_MAX */
CODE_FOR_builtin_minub8,
@@ -6513,6 +6647,12 @@ alpha_init_builtins (void)
dimode_integer_type_node = lang_hooks.types.type_for_mode (DImode, 0);
+ /* Fwrite on VMS is non-standard. */
+#if TARGET_ABI_OPEN_VMS
+ implicit_built_in_decls[(int) BUILT_IN_FWRITE] = NULL_TREE;
+ implicit_built_in_decls[(int) BUILT_IN_FWRITE_UNLOCKED] = NULL_TREE;
+#endif
+
ftype = build_function_type (dimode_integer_type_node, void_list_node);
alpha_add_builtins (zero_arg_builtins, ARRAY_SIZE (zero_arg_builtins),
ftype);
@@ -6540,6 +6680,21 @@ alpha_init_builtins (void)
NULL, NULL);
TREE_NOTHROW (decl) = 1;
+ if (TARGET_ABI_OPEN_VMS)
+ {
+ ftype = build_function_type_list (ptr_type_node, ptr_type_node,
+ NULL_TREE);
+ add_builtin_function ("__builtin_establish_vms_condition_handler", ftype,
+ ALPHA_BUILTIN_ESTABLISH_VMS_CONDITION_HANDLER,
+ BUILT_IN_MD, NULL, NULL_TREE);
+
+ ftype = build_function_type_list (ptr_type_node, void_type_node,
+ NULL_TREE);
+ add_builtin_function ("__builtin_revert_vms_condition_handler", ftype,
+ ALPHA_BUILTIN_REVERT_VMS_CONDITION_HANDLER,
+ BUILT_IN_MD, NULL, NULL_TREE);
+ }
+
alpha_v8qi_u = build_vector_type (unsigned_intQI_type_node, 8);
alpha_v8qi_s = build_vector_type (intQI_type_node, 8);
alpha_v4hi_u = build_vector_type (unsigned_intHI_type_node, 4);
@@ -7233,10 +7388,10 @@ alpha_sa_size (void)
}
else if (TARGET_ABI_OPEN_VMS)
{
- /* Start by assuming we can use a register procedure if we don't
- make any calls (REG_RA not used) or need to save any
- registers and a stack procedure if we do. */
- if ((mask[0] >> REG_RA) & 1)
+ /* Start with a stack procedure if we make any calls (REG_RA used), or
+ need a frame pointer, with a register procedure if we otherwise need
+ at least a slot, and with a null procedure in other cases. */
+ if ((mask[0] >> REG_RA) & 1 || frame_pointer_needed)
alpha_procedure_type = PT_STACK;
else if (get_frame_size() != 0)
alpha_procedure_type = PT_REGISTER;
@@ -7269,7 +7424,10 @@ alpha_sa_size (void)
if (! fixed_regs[i] && call_used_regs[i] && ! df_regs_ever_live_p (i))
vms_save_fp_regno = i;
- if (vms_save_fp_regno == -1 && alpha_procedure_type == PT_REGISTER)
+ /* A VMS condition handler requires a stack procedure in our
+ implementation. (not required by the calling standard). */
+ if ((vms_save_fp_regno == -1 && alpha_procedure_type == PT_REGISTER)
+ || cfun->machine->uses_condition_handler)
vms_base_regno = REG_PV, alpha_procedure_type = PT_STACK;
else if (alpha_procedure_type == PT_NULL)
vms_base_regno = REG_PV;
@@ -7278,9 +7436,10 @@ alpha_sa_size (void)
vms_unwind_regno = (vms_base_regno == REG_PV
? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM);
- /* If this is a stack procedure, allow space for saving FP and RA. */
+ /* If this is a stack procedure, allow space for saving FP, RA and
+ a condition handler slot if needed. */
if (alpha_procedure_type == PT_STACK)
- sa_size += 2;
+ sa_size += 2 + cfun->machine->uses_condition_handler;
}
else
{
@@ -7322,31 +7481,140 @@ alpha_initial_elimination_offset (unsigned int from,
return ret;
}
+#if TARGET_ABI_OPEN_VMS
+
int
-alpha_pv_save_size (void)
+alpha_vms_can_eliminate (unsigned int from ATTRIBUTE_UNUSED, unsigned int to)
{
+ /* We need the alpha_procedure_type to decide. Evaluate it now. */
alpha_sa_size ();
- return alpha_procedure_type == PT_STACK ? 8 : 0;
+
+ switch (alpha_procedure_type)
+ {
+ case PT_NULL:
+ /* NULL procedures have no frame of their own and we only
+ know how to resolve from the current stack pointer. */
+ return to == STACK_POINTER_REGNUM;
+
+ case PT_REGISTER:
+ case PT_STACK:
+ /* We always eliminate except to the stack pointer if there is no
+ usable frame pointer at hand. */
+ return (to != STACK_POINTER_REGNUM
+ || vms_unwind_regno != HARD_FRAME_POINTER_REGNUM);
+ }
+
+ gcc_unreachable ();
}
-int
-alpha_using_fp (void)
-{
- alpha_sa_size ();
- return vms_unwind_regno == HARD_FRAME_POINTER_REGNUM;
+/* FROM is to be eliminated for TO. Return the offset so that TO+offset
+ designates the same location as FROM. */
+
+HOST_WIDE_INT
+alpha_vms_initial_elimination_offset (unsigned int from, unsigned int to)
+{
+ /* The only possible attempts we ever expect are ARG or FRAME_PTR to
+ HARD_FRAME or STACK_PTR. We need the alpha_procedure_type to decide
+ on the proper computations and will need the register save area size
+ in most cases. */
+
+ HOST_WIDE_INT sa_size = alpha_sa_size ();
+
+ /* PT_NULL procedures have no frame of their own and we only allow
+ elimination to the stack pointer. This is the argument pointer and we
+ resolve the soft frame pointer to that as well. */
+
+ if (alpha_procedure_type == PT_NULL)
+ return 0;
+
+ /* For a PT_STACK procedure the frame layout looks as follows
+
+ -----> decreasing addresses
+
+ < size rounded up to 16 | likewise >
+ --------------#------------------------------+++--------------+++-------#
+ incoming args # pretended args | "frame" | regs sa | PV | outgoing args #
+ --------------#---------------------------------------------------------#
+ ^ ^ ^ ^
+ ARG_PTR FRAME_PTR HARD_FRAME_PTR STACK_PTR
+
+
+ PT_REGISTER procedures are similar in that they may have a frame of their
+ own. They have no regs-sa/pv/outgoing-args area.
+
+ We first compute offset to HARD_FRAME_PTR, then add what we need to get
+ to STACK_PTR if need be. */
+
+ {
+ HOST_WIDE_INT offset;
+ HOST_WIDE_INT pv_save_size = alpha_procedure_type == PT_STACK ? 8 : 0;
+
+ switch (from)
+ {
+ case FRAME_POINTER_REGNUM:
+ offset = ALPHA_ROUND (sa_size + pv_save_size);
+ break;
+ case ARG_POINTER_REGNUM:
+ offset = (ALPHA_ROUND (sa_size + pv_save_size
+ + get_frame_size ()
+ + crtl->args.pretend_args_size)
+ - crtl->args.pretend_args_size);
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ if (to == STACK_POINTER_REGNUM)
+ offset += ALPHA_ROUND (crtl->outgoing_args_size);
+
+ return offset;
+ }
}
-#if TARGET_ABI_OPEN_VMS
+#define COMMON_OBJECT "common_object"
+
+static tree
+common_object_handler (tree *node, tree name ATTRIBUTE_UNUSED,
+ tree args ATTRIBUTE_UNUSED, int flags ATTRIBUTE_UNUSED,
+ bool *no_add_attrs ATTRIBUTE_UNUSED)
+{
+ tree decl = *node;
+ gcc_assert (DECL_P (decl));
+
+ DECL_COMMON (decl) = 1;
+ return NULL_TREE;
+}
static const struct attribute_spec vms_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
- { "overlaid", 0, 0, true, false, false, NULL },
- { "global", 0, 0, true, false, false, NULL },
- { "initialize", 0, 0, true, false, false, NULL },
- { NULL, 0, 0, false, false, false, NULL }
+ { COMMON_OBJECT, 0, 1, true, false, false, common_object_handler },
+ { NULL, 0, 0, false, false, false, NULL }
};
+void
+vms_output_aligned_decl_common(FILE *file, tree decl, const char *name,
+ unsigned HOST_WIDE_INT size,
+ unsigned int align)
+{
+ tree attr = DECL_ATTRIBUTES (decl);
+ fprintf (file, "%s", COMMON_ASM_OP);
+ assemble_name (file, name);
+ fprintf (file, "," HOST_WIDE_INT_PRINT_UNSIGNED, size);
+ /* ??? Unlike on OSF/1, the alignment factor is not in log units. */
+ fprintf (file, ",%u", align / BITS_PER_UNIT);
+ if (attr)
+ {
+ attr = lookup_attribute (COMMON_OBJECT, attr);
+ if (attr)
+ fprintf (file, ",%s",
+ IDENTIFIER_POINTER (TREE_VALUE (TREE_VALUE (attr))));
+ }
+ fputc ('\n', file);
+}
+
+#undef COMMON_OBJECT
+
#endif
static int
@@ -7532,7 +7800,7 @@ alpha_expand_prologue (void)
+ crtl->args.pretend_args_size));
if (TARGET_ABI_OPEN_VMS)
- reg_offset = 8;
+ reg_offset = 8 + 8 * cfun->machine->uses_condition_handler;
else
reg_offset = ALPHA_ROUND (crtl->outgoing_args_size);
@@ -7827,6 +8095,7 @@ alpha_start_function (FILE *file, const char *fnname,
/* Offset from base reg to register save area. */
HOST_WIDE_INT reg_offset;
char *entry_label = (char *) alloca (strlen (fnname) + 6);
+ char *tramp_label = (char *) alloca (strlen (fnname) + 6);
int i;
/* Don't emit an extern directive for functions defined in the same file. */
@@ -7869,7 +8138,7 @@ alpha_start_function (FILE *file, const char *fnname,
+ crtl->args.pretend_args_size));
if (TARGET_ABI_OPEN_VMS)
- reg_offset = 8;
+ reg_offset = 8 + 8 * cfun->machine->uses_condition_handler;
else
reg_offset = ALPHA_ROUND (crtl->outgoing_args_size);
@@ -7915,6 +8184,20 @@ alpha_start_function (FILE *file, const char *fnname,
fputs ("..ng:\n", file);
}
}
+ /* Nested functions on VMS that are potentially called via trampoline
+ get a special transfer entry point that loads the called functions
+ procedure descriptor and static chain. */
+ if (TARGET_ABI_OPEN_VMS
+ && !TREE_PUBLIC (decl)
+ && DECL_CONTEXT (decl)
+ && !TYPE_P (DECL_CONTEXT (decl)))
+ {
+ strcpy (tramp_label, fnname);
+ strcat (tramp_label, "..tr");
+ ASM_OUTPUT_LABEL (file, tramp_label);
+ fprintf (file, "\tldq $1,24($27)\n");
+ fprintf (file, "\tldq $27,16($27)\n");
+ }
strcpy (entry_label, fnname);
if (TARGET_ABI_OPEN_VMS)
@@ -7994,6 +8277,16 @@ alpha_start_function (FILE *file, const char *fnname,
}
#if TARGET_ABI_OPEN_VMS
+ /* If a user condition handler has been installed at some point, emit
+ the procedure descriptor bits to point the Condition Handling Facility
+ at the indirection wrapper, and state the fp offset at which the user
+ handler may be found. */
+ if (cfun->machine->uses_condition_handler)
+ {
+ fprintf (file, "\t.handler __gcc_shell_handler\n");
+ fprintf (file, "\t.handler_data %d\n", VMS_COND_HANDLER_FP_OFFSET);
+ }
+
/* Ifdef'ed cause link_section are only available then. */
switch_to_section (readonly_data_section);
fprintf (file, "\t.align 3\n");
@@ -8065,7 +8358,7 @@ alpha_expand_epilogue (void)
if (TARGET_ABI_OPEN_VMS)
{
if (alpha_procedure_type == PT_STACK)
- reg_offset = 8;
+ reg_offset = 8 + 8 * cfun->machine->uses_condition_handler;
else
reg_offset = 0;
}
@@ -8317,12 +8610,15 @@ alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
insn = get_last_insn ();
if (!INSN_P (insn))
insn = prev_active_insn (insn);
- if (CALL_P (insn))
+ if (insn && CALL_P (insn))
output_asm_insn (get_insn_template (CODE_FOR_nop, NULL), NULL);
#if TARGET_ABI_OSF
if (cfun->is_thunk)
- free_after_compilation (cfun);
+ {
+ memset (&crtl->emit, 0, sizeof (struct emit_status));
+ insn_locators_free ();
+ }
#endif
#if TARGET_ABI_OPEN_VMS
@@ -8346,6 +8642,15 @@ alpha_end_function (FILE *file, const char *fnname, tree decl ATTRIBUTE_UNUSED)
}
}
+#if TARGET_ABI_OPEN_VMS
+void avms_asm_output_external (FILE *file, tree decl ATTRIBUTE_UNUSED, const char *name)
+{
+#ifdef DO_CRTL_NAMES
+ DO_CRTL_NAMES;
+#endif
+}
+#endif
+
#if TARGET_ABI_OSF
/* Emit a tail call to FUNCTION after adjusting THIS by DELTA.
@@ -8364,7 +8669,7 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
HOST_WIDE_INT hi, lo;
rtx this_rtx, insn, funexp;
- gcc_assert (cfun->is_thunk);
+ insn_locators_alloc ();
/* We always require a valid GP. */
emit_insn (gen_prologue_ldgp ());
@@ -8442,7 +8747,6 @@ alpha_output_mi_thunk_osf (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
instruction scheduling worth while. Note that use_thunk calls
assemble_start_function and assemble_end_function. */
insn = get_insns ();
- insn_locators_alloc ();
shorten_branches (insn);
final_start_function (insn, file, 1);
final (insn, file, 1);
@@ -9528,6 +9832,7 @@ enum reloc_kind {KIND_LINKAGE, KIND_CODEADDR};
struct GTY(()) alpha_links
{
int num;
+ const char *target;
rtx linkage;
enum links_kind lkind;
enum reloc_kind rkind;
@@ -9580,17 +9885,17 @@ alpha_arg_info_reg_val (CUMULATIVE_ARGS cum)
return GEN_INT (regval);
}
-/* Make (or fake) .linkage entry for function call.
-
- IS_LOCAL is 0 if name is used in call, 1 if name is used in definition.
-
- Return an SYMBOL_REF rtx for the linkage. */
+/* Register the need for a (fake) .linkage entry for calls to function NAME.
+ IS_LOCAL is 1 if this is for a definition, 0 if this is for a real call.
+ Return a SYMBOL_REF suited to the call instruction. */
rtx
alpha_need_linkage (const char *name, int is_local)
{
splay_tree_node node;
struct alpha_links *al;
+ const char *target;
+ tree id;
if (name[0] == '*')
name++;
@@ -9645,19 +9950,18 @@ alpha_need_linkage (const char *name, int is_local)
/* Assume external if no definition. */
al->lkind = (is_local ? KIND_UNUSED : KIND_EXTERN);
- /* Ensure we have an IDENTIFIER so assemble_name can mark it used. */
- get_identifier (name);
+ /* Ensure we have an IDENTIFIER so assemble_name can mark it used
+ and find the ultimate alias target like assemble_name. */
+ id = get_identifier (name);
+ target = NULL;
+ while (IDENTIFIER_TRANSPARENT_ALIAS (id))
+ {
+ id = TREE_CHAIN (id);
+ target = IDENTIFIER_POINTER (id);
+ }
- /* Construct a SYMBOL_REF for us to call. */
- {
- size_t name_len = strlen (name);
- char *linksym = XALLOCAVEC (char, name_len + 6);
- linksym[0] = '$';
- memcpy (linksym + 1, name, name_len);
- memcpy (linksym + 1 + name_len, "..lk", 5);
- al->linkage = gen_rtx_SYMBOL_REF (Pmode,
- ggc_alloc_string (linksym, name_len + 5));
- }
+ al->target = target ? target : name;
+ al->linkage = gen_rtx_SYMBOL_REF (Pmode, name);
splay_tree_insert (alpha_links_tree, (splay_tree_key) name,
(splay_tree_value) al);
@@ -9665,13 +9969,19 @@ alpha_need_linkage (const char *name, int is_local)
return al->linkage;
}
+/* Return a SYMBOL_REF representing the reference to the .linkage entry
+ of function FUNC built for calls made from CFUNDECL. LFLAG is 1 if
+ this is the reference to the linkage pointer value, 0 if this is the
+ reference to the function entry value. RFLAG is 1 if this a reduced
+ reference (code address only), 0 if this is a full reference. */
+
rtx
-alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
+alpha_use_linkage (rtx func, tree cfundecl, int lflag, int rflag)
{
splay_tree_node cfunnode;
struct alpha_funcs *cfaf;
struct alpha_links *al;
- const char *name = XSTR (linkage, 0);
+ const char *name = XSTR (func, 0);
cfaf = (struct alpha_funcs *) 0;
al = (struct alpha_links *) 0;
@@ -9696,7 +10006,6 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
{
size_t name_len;
size_t buflen;
- char buf [512];
char *linksym;
splay_tree_node node = 0;
struct alpha_links *anl;
@@ -9705,6 +10014,7 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
name++;
name_len = strlen (name);
+ linksym = (char *) alloca (name_len + 50);
al = (struct alpha_links *) ggc_alloc (sizeof (struct alpha_links));
al->num = cfaf->num;
@@ -9714,12 +10024,11 @@ alpha_use_linkage (rtx linkage, tree cfundecl, int lflag, int rflag)
{
anl = (struct alpha_links *) node->value;
al->lkind = anl->lkind;
+ name = anl->target;
}
- sprintf (buf, "$%d..%s..lk", cfaf->num, name);
- buflen = strlen (buf);
- linksym = XALLOCAVEC (char, buflen + 1);
- memcpy (linksym, buf, buflen + 1);
+ sprintf (linksym, "$%d..%s..lk", cfaf->num, name);
+ buflen = strlen (linksym);
al->linkage = gen_rtx_SYMBOL_REF
(Pmode, ggc_alloc_string (linksym, buflen + 1));
@@ -9808,31 +10117,6 @@ alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
}
}
-/* Given a decl, a section name, and whether the decl initializer
- has relocs, choose attributes for the section. */
-
-#define SECTION_VMS_OVERLAY SECTION_FORGET
-#define SECTION_VMS_GLOBAL SECTION_MACH_DEP
-#define SECTION_VMS_INITIALIZE (SECTION_VMS_GLOBAL << 1)
-
-static unsigned int
-vms_section_type_flags (tree decl, const char *name, int reloc)
-{
- unsigned int flags = default_section_type_flags (decl, name, reloc);
-
- if (decl && DECL_ATTRIBUTES (decl)
- && lookup_attribute ("overlaid", DECL_ATTRIBUTES (decl)))
- flags |= SECTION_VMS_OVERLAY;
- if (decl && DECL_ATTRIBUTES (decl)
- && lookup_attribute ("global", DECL_ATTRIBUTES (decl)))
- flags |= SECTION_VMS_GLOBAL;
- if (decl && DECL_ATTRIBUTES (decl)
- && lookup_attribute ("initialize", DECL_ATTRIBUTES (decl)))
- flags |= SECTION_VMS_INITIALIZE;
-
- return flags;
-}
-
/* Switch to an arbitrary section NAME with attributes as specified
by FLAGS. ALIGN specifies any known alignment requirements for
the section; 0 if the default should be used. */
@@ -9844,12 +10128,6 @@ vms_asm_named_section (const char *name, unsigned int flags,
fputc ('\n', asm_out_file);
fprintf (asm_out_file, ".section\t%s", name);
- if (flags & SECTION_VMS_OVERLAY)
- fprintf (asm_out_file, ",OVR");
- if (flags & SECTION_VMS_GLOBAL)
- fprintf (asm_out_file, ",GBL");
- if (flags & SECTION_VMS_INITIALIZE)
- fprintf (asm_out_file, ",NOMOD");
if (flags & SECTION_DEBUG)
fprintf (asm_out_file, ",NOWRT");
@@ -9889,7 +10167,7 @@ alpha_need_linkage (const char *name ATTRIBUTE_UNUSED,
}
rtx
-alpha_use_linkage (rtx linkage ATTRIBUTE_UNUSED,
+alpha_use_linkage (rtx func ATTRIBUTE_UNUSED,
tree cfundecl ATTRIBUTE_UNUSED,
int lflag ATTRIBUTE_UNUSED,
int rflag ATTRIBUTE_UNUSED)
@@ -10700,6 +10978,11 @@ alpha_init_libfuncs (void)
set_optab_libfunc (smod_optab, DImode, "OTS$REM_L");
set_optab_libfunc (umod_optab, SImode, "OTS$REM_UI");
set_optab_libfunc (umod_optab, DImode, "OTS$REM_UL");
+ abort_libfunc = init_one_libfunc ("decc$abort");
+ memcmp_libfunc = init_one_libfunc ("decc$memcmp");
+#ifdef MEM_LIBFUNCS_INIT
+ MEM_LIBFUNCS_INIT;
+#endif
}
}
@@ -10708,8 +10991,6 @@ alpha_init_libfuncs (void)
#if TARGET_ABI_OPEN_VMS
# undef TARGET_ATTRIBUTE_TABLE
# define TARGET_ATTRIBUTE_TABLE vms_attribute_table
-# undef TARGET_SECTION_TYPE_FLAGS
-# define TARGET_SECTION_TYPE_FLAGS vms_section_type_flags
#endif
#undef TARGET_IN_SMALL_DATA_P
@@ -10737,7 +11018,7 @@ alpha_init_libfuncs (void)
/* Default unaligned ops are provided for ELF systems. To get unaligned
data for non-ELF systems, we have to turn off auto alignment. */
-#ifndef OBJECT_FORMAT_ELF
+#if !defined (OBJECT_FORMAT_ELF) || TARGET_ABI_OPEN_VMS
#undef TARGET_ASM_UNALIGNED_HI_OP
#define TARGET_ASM_UNALIGNED_HI_OP "\t.align 0\n\t.word\t"
#undef TARGET_ASM_UNALIGNED_SI_OP
@@ -10818,10 +11099,8 @@ alpha_init_libfuncs (void)
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG alpha_reorg
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_false
#undef TARGET_RETURN_IN_MEMORY
diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h
index 5b74fe1a886..cd8c11e3286 100644
--- a/gcc/config/alpha/alpha.h
+++ b/gcc/config/alpha/alpha.h
@@ -882,6 +882,12 @@ do { \
#define RETURN_ADDR_RTX alpha_return_addr
+/* Provide a definition of DWARF_FRAME_REGNUM here so that fallback unwinders
+ can use DWARF_ALT_FRAME_RETURN_COLUMN defined below. This is just the same
+ as the default definition in dwarf2out.c. */
+#undef DWARF_FRAME_REGNUM
+#define DWARF_FRAME_REGNUM(REG) DBX_REGISTER_NUMBER (REG)
+
/* Before the prologue, RA lives in $26. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26)
#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26)
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index e6a05780bba..18817c80c52 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -1,6 +1,6 @@
;; Machine description for DEC Alpha for GNU C compiler
;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-;; 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+;; 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
;; Free Software Foundation, Inc.
;; Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
;;
@@ -256,16 +256,7 @@
(sign_extend:DI (match_dup 1)))]
"")
-;; Don't say we have addsi3 if optimizing. This generates better code. We
-;; have the anonymous addsi3 pattern below in case combine wants to make it.
-(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (plus:SI (match_operand:SI 1 "reg_or_0_operand" "")
- (match_operand:SI 2 "add_operand" "")))]
- "! optimize"
- "")
-
-(define_insn "*addsi_internal"
+(define_insn "addsi3"
[(set (match_operand:SI 0 "register_operand" "=r,r,r,r")
(plus:SI (match_operand:SI 1 "reg_or_0_operand" "%rJ,rJ,rJ,rJ")
(match_operand:SI 2 "add_operand" "rI,O,K,L")))]
@@ -619,14 +610,7 @@
""
"subqv $31,%1,%0")
-(define_expand "subsi3"
- [(set (match_operand:SI 0 "register_operand" "")
- (minus:SI (match_operand:SI 1 "reg_or_0_operand" "")
- (match_operand:SI 2 "reg_or_8bit_operand" "")))]
- "! optimize"
- "")
-
-(define_insn "*subsi_internal"
+(define_insn "subsi3"
[(set (match_operand:SI 0 "register_operand" "=r")
(minus:SI (match_operand:SI 1 "reg_or_0_operand" "rJ")
(match_operand:SI 2 "reg_or_8bit_operand" "rI")))]
@@ -4976,6 +4960,24 @@
return "call_pal 0x9f";
}
[(set_attr "type" "callpal")])
+
+;; Special builtins for establishing and reverting VMS condition handlers.
+
+(define_expand "builtin_establish_vms_condition_handler"
+ [(set (reg:DI 0) (match_operand:DI 0 "register_operand" ""))
+ (use (match_operand:DI 1 "address_operand" ""))]
+ "TARGET_ABI_OPEN_VMS"
+{
+ alpha_expand_builtin_establish_vms_condition_handler (operands[0],
+ operands[1]);
+})
+
+(define_expand "builtin_revert_vms_condition_handler"
+ [(set (reg:DI 0) (match_operand:DI 0 "register_operand" ""))]
+ "TARGET_ABI_OPEN_VMS"
+{
+ alpha_expand_builtin_revert_vms_condition_handler (operands[0]);
+})
;; Finally, we have the basic data motion insns. The byte and word insns
;; are done via define_expand. Start with the floating-point insns, since
@@ -6460,8 +6462,7 @@
(clobber (reg:DI 27))])]
"TARGET_ABI_OPEN_VMS"
{
- operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$MOVE");
- alpha_need_linkage (XSTR (operands[4], 0), 0);
+ operands[4] = alpha_need_linkage ("OTS$MOVE", 0);
})
(define_insn "*movmemdi_1"
@@ -6528,8 +6529,7 @@
if (operands[2] != const0_rtx)
FAIL;
- operands[4] = gen_rtx_SYMBOL_REF (Pmode, "OTS$ZERO");
- alpha_need_linkage (XSTR (operands[4], 0), 0);
+ operands[4] = alpha_need_linkage ("OTS$ZERO", 0);
})
(define_insn "*clrmemdi_1"
diff --git a/gcc/config/alpha/t-vms b/gcc/config/alpha/t-vms
index 5e86f14e14b..410e219ff5b 100644
--- a/gcc/config/alpha/t-vms
+++ b/gcc/config/alpha/t-vms
@@ -17,22 +17,49 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/vms_tramp.asm
+LIB2FUNCS_EXTRA = $(srcdir)/config/alpha/vms-gcc_shell_handler.c
-# VMS_EXTRA_PARTS is defined in x-vms and represent object files that
-# are only needed for VMS targets, but can only be compiled on a VMS host
-# (because they need DEC C).
-EXTRA_PARTS = vms-dwarf2.o vms-dwarf2eh.o $(VMS_EXTRA_PARTS)
+EXTRA_PARTS = vms-dwarf2.o vms-dwarf2eh.o $(VMS_EXTRA_PARTS) \
+ crtbegin.o crtbeginS.o crtend.o crtendS.o
# This object must be linked with in order to make the executable debuggable.
# vms-ld handles it automatically when passed -g.
$(T)vms-dwarf2.o : $(srcdir)/config/alpha/vms-dwarf2.asm
- gcc -c -x assembler $< -o $@
+ $(GCC_FOR_TARGET) -c -x assembler $< -o $@
$(T)vms-dwarf2eh.o : $(srcdir)/config/alpha/vms-dwarf2eh.asm
- gcc -c -x assembler $< -o $@
+ $(GCC_FOR_TARGET) -c -x assembler $< -o $@
MULTILIB_OPTIONS = mcpu=ev6
MULTILIB_DIRNAMES = ev6
+MULTILIB_OSDIRNAMES = ev6
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
+
+shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
+SHLIB_EXT = .exe
+SHLIB_OBJS = @shlib_objs@
+SHLIB_NAME = @shlib_base_name@.exe
+SHLIB_MULTILIB =
+SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_NAME)
+SHLIB_SYMVEC = \
+ grep -F -e "\$$BSS\$$" -e "\$$DATA\$$" -e " sdata " -e " data.rel " -e " data.rel.ro " -e " sbss " \
+ -e "\$$LINK\$$" -e "\$$READONLY\$$" | \
+ sed -e "s/.*\$$LINK\$$ \(.*\)/SYMBOL_VECTOR=(\1=PROCEDURE)/" \
+ -e "s/.*\$$DATA\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* sbss \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* sdata \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* data.rel \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.* data.rel.ro \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.*\$$BSS\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/" \
+ -e "s/.*\$$READONLY\$$ \(.*\)/SYMBOL_VECTOR=(\1=DATA)/"
+SHLIB_SYMVECX2 := $(subst $$,$$$$,$(SHLIB_SYMVEC))
+SHLIB_LINK = \
+ echo "case_sensitive=yes" > SYMVEC_$$$$$$$$.opt; \
+ objdump --syms $(SHLIB_OBJS) | \
+ $(SHLIB_SYMVECX2) >> SYMVEC_$$$$$$$$.opt ; \
+ echo "case_sensitive=NO" >> SYMVEC_$$$$$$$$.opt; \
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
+ -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
+ --for-linker=SYMVEC_$$$$$$$$.opt \
+ --for-linker=gsmatch=equal,$(shlib_version)
diff --git a/gcc/config/alpha/vms-dwarf2eh.asm b/gcc/config/alpha/vms-dwarf2eh.asm
index 76650ae9048..e0eaf9d3741 100644
--- a/gcc/config/alpha/vms-dwarf2eh.asm
+++ b/gcc/config/alpha/vms-dwarf2eh.asm
@@ -28,5 +28,3 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
.section .eh_frame,NOWRT
.align 0
- .global __EH_FRAME_BEGIN__
-__EH_FRAME_BEGIN__:
diff --git a/gcc/config/alpha/vms-gcc_shell_handler.c b/gcc/config/alpha/vms-gcc_shell_handler.c
new file mode 100644
index 00000000000..67d0fe7f9aa
--- /dev/null
+++ b/gcc/config/alpha/vms-gcc_shell_handler.c
@@ -0,0 +1,124 @@
+/* Static condition handler for Alpha/VMS.
+ Copyright (C) 2005-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 file implements __gcc_shell_handler, the static VMS condition handler
+ used as the indirection wrapper around user level handlers installed with
+ establish_vms_condition_handler GCC builtin.
+
+ [ABI] in comments refers to the "HP OpenVMS calling standard" document
+ dated January 2005. */
+
+#include <vms/chfdef.h>
+#include <vms/pdscdef.h>
+#include <vms/ssdef.h>
+
+typedef void * ADDR;
+typedef unsigned long long REG;
+
+#define REG_AT(addr) (*(REG *)(addr))
+
+/* Compute pointer to procedure descriptor (Procedure Value) from Frame
+ Pointer FP, according to the rules in [ABI-3.5.1 Current Procedure]. */
+#define PV_FOR(FP) \
+ (((FP) != 0) \
+ ? (((REG_AT (FP) & 0x7) == 0) ? *(PDSCDEF **)(FP) : (PDSCDEF *)(FP)) : 0)
+
+long
+__gcc_shell_handler (struct chf$signal_array *sig_arr,
+ struct chf$mech_array *mech_arr);
+
+/* Helper for __gcc_shell_handler. Fetch the pointer to procedure currently
+ registered as the VMS condition handler for the live function with a frame
+ pointer FP. */
+
+static ADDR
+get_dyn_handler_pointer (REG fp)
+{
+ /* From the frame pointer we find the procedure descriptor, and fetch
+ the handler_data field from there. This field contains the offset
+ from FP at which the address of the currently installed handler is
+ to be found. */
+
+ PDSCDEF * pd = PV_FOR (fp);
+ /* Procedure descriptor pointer for the live subprogram with FP as the frame
+ pointer, and to which _gcc_shell_handler is attached as a condition
+ handler. */
+
+ REG handler_slot_offset;
+ /* Offset from FP at which the address of the currently established real
+ condition handler is to be found. This offset is available from the
+ handler_data field of the procedure descriptor. */
+
+ REG handler_data_offset;
+ /* The handler_data field position in the procedure descriptor, which
+ depends on the kind of procedure at hand. */
+
+ switch (pd->pdsc$w_flags & 0xf)
+ {
+ case PDSC$K_KIND_FP_STACK: /* [3.4.2 PD for stack frame procedures] */
+ handler_data_offset = 40;
+ break;
+
+ case PDSC$K_KIND_FP_REGISTER: /* [3.4.5 PD for reg frame procedures] */
+ handler_data_offset = 32;
+ break;
+
+ default:
+ handler_data_offset = 0;
+ break;
+ }
+
+ /* If we couldn't determine the handler_data field position, give up. */
+ if (handler_data_offset == 0)
+ return 0;
+
+ /* Otherwise, fetch the fp offset at which the real handler address is to be
+ found, then fetch and return the latter in turn. */
+
+ handler_slot_offset = REG_AT ((REG)pd + handler_data_offset);
+
+ return (ADDR) REG_AT (fp + handler_slot_offset);
+}
+
+/* The static VMS condition handler for GCC code. Fetch the address of the
+ currently established condition handler, then resignal if there is none or
+ call the handler with the VMS condition arguments. */
+
+long
+__gcc_shell_handler (struct chf$signal_array *sig_arr,
+ struct chf$mech_array *mech_arr)
+{
+ long ret;
+ long (*user_handler) (struct chf$signal_array *, struct chf$mech_array *);
+
+ user_handler = get_dyn_handler_pointer (mech_arr->chf$q_mch_frame);
+ if (!user_handler)
+ ret = SS$_RESIGNAL;
+ else
+ ret = user_handler (sig_arr, mech_arr);
+
+ return ret;
+}
+
diff --git a/gcc/config/alpha/vms-unwind.h b/gcc/config/alpha/vms-unwind.h
index 78c774426e7..09b2f8f23e0 100644
--- a/gcc/config/alpha/vms-unwind.h
+++ b/gcc/config/alpha/vms-unwind.h
@@ -1,71 +1,291 @@
-/* DWARF2 EH unwinding support for Alpha VMS.
- Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+/* Fallback frame unwinding for Alpha/VMS.
+ Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2009
+ Free Software Foundation, Inc.
-This file is part of GCC.
+ 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 free software; you can 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.
+ 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/>. */
+ 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.
-#include <pdscdef.h>
+ 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/>. */
-#define MD_FALLBACK_FRAME_STATE_FOR alpha_fallback_frame_state
+#include <stdlib.h>
+#include <stdio.h>
+#include <vms/pdscdef.h>
+#include <vms/libicb.h>
+#include <vms/chfctxdef.h>
+#include <vms/chfdef.h>
-static _Unwind_Reason_Code
-alpha_fallback_frame_state (struct _Unwind_Context *context,
- _Unwind_FrameState *fs)
+#define MD_FALLBACK_FRAME_STATE_FOR alpha_vms_fallback_frame_state
+
+typedef void * ADDR;
+typedef unsigned long long REG;
+typedef PDSCDEF * PV;
+
+#define REG_AT(addr) (*(REG *)(addr))
+#define ADDR_AT(addr) (*(ADDR *)(addr))
+
+/* Compute pointer to procedure descriptor (Procedure Value) from Frame
+ Pointer FP, according to the rules in [ABI-3.5.1 Current Procedure]. */
+#define PV_FOR(FP) \
+ (((FP) != 0) \
+ ? (((REG_AT (FP) & 0x7) == 0) ? *(PDSCDEF **)(FP) : (PDSCDEF *)(FP)) : 0)
+
+extern int SYS$GL_CALL_HANDL;
+/* This is actually defined as a "long", but in system code where longs
+ are always 4bytes while GCC longs might be 8bytes. */
+
+#define UPDATE_FS_FOR_CFA_GR(FS, GRN, LOC, CFA) \
+do { \
+(FS)->regs.reg[GRN].how = REG_SAVED_OFFSET; \
+(FS)->regs.reg[GRN].loc.offset = (_Unwind_Sword) ((REG) (LOC) - (REG) (CFA)); \
+} while (0);
+
+#define GIVEUP_ON_FAILURE(STATUS) \
+ { if ((((STATUS) & 1) != 1)) return _URC_END_OF_STACK; }
+#define DENOTES_EXC_DISPATCHER(PV) ((PV) == (ADDR) (REG) SYS$GL_CALL_HANDL)
+
+#define RA_COLUMN (DWARF_ALT_FRAME_RETURN_COLUMN)
+
+static int
+alpha_vms_fallback_frame_state (struct _Unwind_Context *context,
+ _Unwind_FrameState *fs)
{
- PDSCDEF *pv = *((PDSCDEF **) context->reg [29]);
+ static int eh_debug = -1;
+
+ /* Our goal is to update FS to reflect the state one step up CONTEXT, that
+ is: the CFA, return address and *saved* registers locations associated
+ with the function designated by CONTEXT->ra. We are called when the
+ libgcc unwinder has not found any dwarf FDE for this address, which
+ typically happens when trying to propagate a language exception through a
+ signal global vector or frame based handler.
+
+ The CONTEXT->reg[] entries reflect the state/location of register saves
+ so designate values live at the CONTEXT->ra point. Of precious value to
+ us here is the frame pointer (r29), which gets us a procedure value. */
+
+ PV pv = (context->reg[29] != 0) ? PV_FOR (ADDR_AT (context->reg[29])) : 0;
+
+ int pkind = pv ? pv->pdsc$w_flags & 0xf : 0;
+ /* VMS procedure kind, as indicated by the procedure descriptor. We only
+ know how to deal with FP_STACK or FP_REGISTER here. */
+
+ ADDR new_cfa = 0;
+ /* CFA we will establish for the caller, computed in different ways,
+ e.g. depending whether we cross an exception dispatcher frame. */
+
+ CHFCTX *chfctx = 0;
+ /* Pointer to the VMS CHF context associated with an exception dispatcher
+ frame, if we happen to come across one. */
+
+ int i,j;
+
+ if (eh_debug == -1)
+ {
+ char * eh_debug_env = getenv ("EH_DEBUG");
+ eh_debug = eh_debug_env ? atoi (eh_debug_env) : 0;
+ }
+
+ if (eh_debug)
+ printf ("MD_FALLBACK running ...\n");
+
+ /* We only know how to deal with stack or reg frame procedures, so give
+ up if we're handed anything else. */
+ if (pkind != PDSC$K_KIND_FP_STACK && pkind != PDSC$K_KIND_FP_REGISTER)
+ return _URC_END_OF_STACK;
+
+ if (eh_debug)
+ printf ("FALLBACK: CTX FP = 0x%p, PV = 0x%p, EN = 0x%llx, RA = 0x%p\n",
+ ADDR_AT (context->reg[29]), pv, pv->pdsc$q_entry, context->ra);
+
+ fs->retaddr_column = RA_COLUMN;
+
+ /* If PV designates a VMS exception vector or condition handler, we need to
+ do as if the caller was the signaling point and estabish the state of the
+ intermediate VMS code (CFA, RA and saved register locations) as if it was
+ a single regular function. This requires special processing.
+
+ The datastructures available from an condition dispatcher frame (signal
+ context) do not contain the values of most callee-saved registers, so
+ whathever PV designates, we need to account for the registers it saves.
+
+ Besides, we need to express all the locations with respect to a
+ consistent CFA value, so we compute this first. */
+
+ if (DENOTES_EXC_DISPATCHER (pv))
+ {
+ /* The CFA to establish is the signaling point's stack pointer. We
+ compute it using the system invocation context unwinding services and
+ save the CHF context data pointer along the way for later uses. */
+
+ INVO_CONTEXT_BLK icb;
+ int status, invo_handle;
+
+ if (eh_debug)
+ printf ("FALLBACK: SYS$HANDLER\n");
+
+ icb.libicb$q_ireg [29] = REG_AT (context->reg[29]);
+ icb.libicb$q_ireg [30] = 0;
+ invo_handle = LIB$GET_INVO_HANDLE (&icb);
+
+ status = LIB$GET_INVO_CONTEXT (invo_handle, &icb);
+ GIVEUP_ON_FAILURE (status);
+
+ chfctx = (CHFCTX *) icb.libicb$ph_chfctx_addr;
+
+ status = LIB$GET_PREV_INVO_CONTEXT (&icb);
+ GIVEUP_ON_FAILURE (status);
- if (pv && ((long) pv & 0x7) == 0) /* low bits 0 means address */
- pv = *(PDSCDEF **) pv;
+ new_cfa = (ADDR) icb.libicb$q_ireg[30];
+ }
+ else
+ {
+ /* The CFA to establish is the SP value on entry of the procedure
+ designated by PV, which we compute as the corresponding frame base
+ register value + frame size. Note that the frame base may differ
+ from CONTEXT->cfa, typically if the caller has performed dynamic
+ stack allocations. */
+
+ int base_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30;
+ ADDR base_addr = ADDR_AT (context->reg[base_reg]);
+
+ new_cfa = base_addr + pv->pdsc$l_size;
+ }
+
+ /* State to compute the caller's CFA by adding an offset to the current
+ one in CONTEXT. */
+ fs->regs.cfa_how = CFA_REG_OFFSET;
+ fs->regs.cfa_reg = __builtin_dwarf_sp_column ();
+ fs->regs.cfa_offset = new_cfa - context->cfa;
- if (pv && ((pv->pdsc$w_flags & 0xf) == PDSC$K_KIND_FP_STACK))
+ /* Regular unwind first, accounting for the register saves performed by
+ the procedure designated by PV. */
+
+ switch (pkind)
{
- int i, j;
-
- fs->regs.cfa_offset = pv->pdsc$l_size;
- fs->regs.cfa_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30;
- fs->retaddr_column = 26;
- fs->regs.cfa_how = CFA_REG_OFFSET;
- fs->regs.reg[27].loc.offset = -pv->pdsc$l_size;
- fs->regs.reg[27].how = REG_SAVED_OFFSET;
- fs->regs.reg[26].loc.offset
- = -(pv->pdsc$l_size - pv->pdsc$w_rsa_offset);
- fs->regs.reg[26].how = REG_SAVED_OFFSET;
-
- for (i = 0, j = 0; i < 32; i++)
- if (1<<i & pv->pdsc$l_ireg_mask)
- {
- fs->regs.reg[i].loc.offset
- = -(pv->pdsc$l_size - pv->pdsc$w_rsa_offset - 8 * ++j);
- fs->regs.reg[i].how = REG_SAVED_OFFSET;
- }
-
- return _URC_NO_REASON;
+ case PDSC$K_KIND_FP_STACK:
+ {
+ /* The saved registers are all located in the Register Save Area,
+ except for the procedure value register (R27) found at the frame
+ base address. */
+
+ int base_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30;
+ ADDR base_addr = ADDR_AT (context->reg[base_reg]);
+ ADDR rsa_addr = base_addr + pv->pdsc$w_rsa_offset;
+
+ if (eh_debug)
+ printf ("FALLBACK: STACK frame procedure\n");
+
+ UPDATE_FS_FOR_CFA_GR (fs, 27, base_addr, new_cfa);
+
+ /* The first RSA entry is for the return address register, R26. */
+
+ UPDATE_FS_FOR_CFA_GR (fs, 26, rsa_addr, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, RA_COLUMN, rsa_addr, new_cfa);
+
+ /* The following entries are for registers marked as saved according
+ to ireg_mask. */
+ for (i = 0, j = 0; i < 32; i++)
+ if ((1 << i) & pv->pdsc$l_ireg_mask)
+ UPDATE_FS_FOR_CFA_GR (fs, i, rsa_addr + 8 * ++j, new_cfa);
+
+ /* ??? floating point registers ? */
+
+ break;
+ }
+
+ case PDSC$K_KIND_FP_REGISTER:
+ {
+ if (eh_debug)
+ printf ("FALLBACK: REGISTER frame procedure\n");
+
+ fs->regs.reg[RA_COLUMN].how = REG_SAVED_REG;
+ fs->regs.reg[RA_COLUMN].loc.reg = pv->pdsc$b_save_ra;
+
+ fs->regs.reg[29].how = REG_SAVED_REG;
+ fs->regs.reg[29].loc.reg = pv->pdsc$b_save_fp;
+
+ break;
+ }
+
+ default:
+ /* Should never reach here. */
+ return _URC_END_OF_STACK;
}
- else if (pv && ((pv->pdsc$w_flags & 0xf) == PDSC$K_KIND_FP_REGISTER))
+
+ /* If PV designates an exception dispatcher, we have to adjust the return
+ address column to get at the signal occurrence point, and account for
+ for what the CHF context contains. */
+
+ if (DENOTES_EXC_DISPATCHER (pv))
{
- fs->regs.cfa_offset = pv->pdsc$l_size;
- fs->regs.cfa_reg = pv->pdsc$w_flags & PDSC$M_BASE_REG_IS_FP ? 29 : 30;
- fs->retaddr_column = 26;
- fs->regs.cfa_how = CFA_REG_OFFSET;
- fs->regs.reg[26].loc.reg = pv->pdsc$b_save_ra;
- fs->regs.reg[26].how = REG_SAVED_REG;
- fs->regs.reg[29].loc.reg = pv->pdsc$b_save_fp;
- fs->regs.reg[29].how = REG_SAVED_REG;
-
- return _URC_NO_REASON;
+ /* The PC of the instruction causing the condition is available from the
+ signal argument vector. Extra saved register values are available
+ from the mechargs array. */
+
+ CHF$SIGNAL_ARRAY *sigargs
+ = (CHF$SIGNAL_ARRAY *) chfctx->chfctx$q_sigarglst;
+
+ CHF$MECH_ARRAY *mechargs
+ = (CHF$MECH_ARRAY *) chfctx->chfctx$q_mcharglst;
+
+ ADDR condpc_addr
+ = &((int *)(&sigargs->chf$l_sig_name)) [sigargs->chf$is_sig_args-2];
+
+ ADDR rei_frame_addr = (void *) mechargs->chf$q_mch_esf_addr;
+
+ /* Adjust the return address location. */
+
+ UPDATE_FS_FOR_CFA_GR (fs, RA_COLUMN, condpc_addr, new_cfa);
+
+ /* The frame pointer at the condition point is available from the
+ chf context directly. */
+
+ UPDATE_FS_FOR_CFA_GR (fs, 29, &chfctx->chfctx$q_expt_fp, new_cfa);
+
+ /* Registers available from the mechargs array. */
+
+ UPDATE_FS_FOR_CFA_GR (fs, 0, &mechargs->chf$q_mch_savr0, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 1, &mechargs->chf$q_mch_savr1, new_cfa);
+
+ UPDATE_FS_FOR_CFA_GR (fs, 16, &mechargs->chf$q_mch_savr16, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 17, &mechargs->chf$q_mch_savr17, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 18, &mechargs->chf$q_mch_savr18, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 19, &mechargs->chf$q_mch_savr19, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 20, &mechargs->chf$q_mch_savr20, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 21, &mechargs->chf$q_mch_savr21, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 22, &mechargs->chf$q_mch_savr22, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 23, &mechargs->chf$q_mch_savr23, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 24, &mechargs->chf$q_mch_savr24, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 25, &mechargs->chf$q_mch_savr25, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 26, &mechargs->chf$q_mch_savr26, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 27, &mechargs->chf$q_mch_savr27, new_cfa);
+ UPDATE_FS_FOR_CFA_GR (fs, 28, &mechargs->chf$q_mch_savr28, new_cfa);
+
+ /* Registers R2 to R7 are available from the rei frame pointer. */
+
+ for (i = 2; i <= 7; i ++)
+ UPDATE_FS_FOR_CFA_GR (fs, i, rei_frame_addr+(i - 2)*8, new_cfa);
+
+ /* ??? floating point registers ? */
}
- return _URC_END_OF_STACK;
+
+ return _URC_NO_REASON;
}
+
+
+
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index d7a6389512f..e3781b57163 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -22,6 +22,10 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_OBJECT_SUFFIX ".obj"
#define TARGET_EXECUTABLE_SUFFIX ".exe"
+/* Alpha/VMS object format is not really Elf, but this makes compiling
+ crtstuff.c and dealing with shared library initialization much easier. */
+#define OBJECT_FORMAT_ELF
+
/* This enables certain macros in alpha.h, which will make an indirect
reference to an external symbol an invalid address. This needs to be
defined before we include alpha.h, since it determines which macros
@@ -65,8 +69,14 @@ along with GCC; see the file COPYING3. If not see
#define POINTER_SIZE 32
#define POINTERS_EXTEND_UNSIGNED 0
+#define HANDLE_SYSV_PRAGMA 1
+
#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
+/* The maximum alignment 'malloc' honors. */
+#undef MALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT ((TARGET_MALLOC64 ? 16 : 8) * BITS_PER_UNIT)
+
#undef FIXED_REGISTERS
#define FIXED_REGISTERS \
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
@@ -134,27 +144,12 @@ along with GCC; see the file COPYING3. If not see
#undef CAN_ELIMINATE
#define CAN_ELIMINATE(FROM, TO) \
-((TO) != STACK_POINTER_REGNUM || ! alpha_using_fp ())
+ (alpha_vms_can_eliminate ((FROM), (TO)))
#undef INITIAL_ELIMINATION_OFFSET
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
-{ switch (FROM) \
- { \
- case FRAME_POINTER_REGNUM: \
- (OFFSET) = alpha_sa_size () + alpha_pv_save_size (); \
- break; \
- case ARG_POINTER_REGNUM: \
- (OFFSET) = (ALPHA_ROUND (alpha_sa_size () + alpha_pv_save_size () \
- + get_frame_size () \
- + crtl->args.pretend_args_size) \
- - crtl->args.pretend_args_size); \
- break; \
- default: \
- gcc_unreachable (); \
- } \
- if ((TO) == STACK_POINTER_REGNUM) \
- (OFFSET) += ALPHA_ROUND (crtl->outgoing_args_size); \
-}
+ ((OFFSET) = alpha_vms_initial_elimination_offset(FROM, TO))
+
/* Define a data type for recording info about an argument list
during the scan of that argument list. This data type should
@@ -196,13 +191,19 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
(CUM).num_args += ALPHA_ARG_SIZE (MODE, TYPE, NAMED); \
}
-/* ABI has stack checking, but it's broken. */
-#undef STACK_CHECK_BUILTIN
-#define STACK_CHECK_BUILTIN 0
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+#undef ASM_WEAKEN_LABEL
+#define ASM_WEAKEN_LABEL(FILE, NAME) \
+ do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \
+ fputc ('\n', FILE); } while (0)
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
#define CTORS_SECTION_ASM_OP "\t.ctors"
#define DTORS_SECTION_ASM_OP "\t.dtors"
+#define SDATA_SECTION_ASM_OP "\t.sdata"
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n\t.long " #FUNC"\n");
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
@@ -224,30 +225,11 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
#define COMMON_ASM_OP "\t.comm\t"
-#undef ASM_OUTPUT_ALIGNED_COMMON
-#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \
-do { \
- fprintf ((FILE), "%s", COMMON_ASM_OP); \
- assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED ",%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \
-} while (0)
-
+#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
+ vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
-/* Output assembler code for a block containing the constant parts
- of a trampoline, leaving space for the variable parts.
-
- The trampoline should set the static chain pointer to value placed
- into the trampoline and should branch to the specified routine.
- Note that $27 has been set to the address of the trampoline, so we can
- use it for addressability of the two data items. */
-
#undef TRAMPOLINE_TEMPLATE
-#define TRAMPOLINE_TEMPLATE(FILE) \
-{ \
- fprintf (FILE, "\t.quad 0\n"); \
- fprintf (FILE, "\t.linkage __tramp\n"); \
- fprintf (FILE, "\t.quad 0\n"); \
-}
/* Length in units of the trampoline for entering a nested function. */
@@ -285,8 +267,64 @@ do { \
gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, 8))
#define LINK_EH_SPEC "vms-dwarf2eh.o%s "
+#define LINK_GCC_C_SEQUENCE_SPEC "%G"
+
+#ifdef IN_LIBGCC2
+/* Get the definition for MD_FALLBACK_FRAME_STATE_FOR from a separate
+ file. This avoids having to recompile the world instead of libgcc only
+ when changes to this macro are exercised. */
#define MD_UNWIND_SUPPORT "config/alpha/vms-unwind.h"
+#endif
+
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
+ avms_asm_output_external (FILE, DECL, NAME)
+
+typedef struct crtl_name_spec
+{
+ const char *const name;
+ const char *deccname;
+ int referenced;
+} crtl_name_spec;
+
+#include "config/vms/vms-crtl.h"
+
+/* Alias CRTL names to 32/64bit DECCRTL functions.
+ Fixme: This should do a binary search. */
+#define DO_CRTL_NAMES \
+ do \
+ { \
+ int i; \
+ static crtl_name_spec vms_crtl_names[] = CRTL_NAMES; \
+ static int malloc64_init = 0; \
+ \
+ if ((malloc64_init == 0) && TARGET_MALLOC64) \
+ { \
+ for (i=0; vms_crtl_names [i].name; i++) \
+ { \
+ if (strcmp ("calloc", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_calloc64"; \
+ else \
+ if (strcmp ("malloc", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_malloc64"; \
+ else \
+ if (strcmp ("realloc", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_realloc64"; \
+ else \
+ if (strcmp ("strdup", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_strdup64"; \
+ } \
+ malloc64_init = 1; \
+ } \
+ for (i=0; vms_crtl_names [i].name; i++) \
+ if (!vms_crtl_names [i].referenced && \
+ (strcmp (name, vms_crtl_names [i].name) == 0)) \
+ { \
+ fprintf (file, "\t%s=%s\n", \
+ name, vms_crtl_names [i].deccname); \
+ vms_crtl_names [i].referenced = 1; \
+ } \
+ } while (0)
/* This is how to output an assembler line
that says to advance the location counter
@@ -321,22 +359,18 @@ do { \
#undef ASM_FINAL_SPEC
/* The VMS convention is to always provide minimal debug info
- for a traceback unless specifically overridden. Defaulting this here
- is a kludge. */
+ for a traceback unless specifically overridden. */
-#define OPTIMIZATION_OPTIONS(OPTIMIZE, OPTIMIZE_SIZE) \
-{ \
- write_symbols = VMS_DEBUG; \
- debug_info_level = (enum debug_info_level) 1; \
-}
-
-/* Override traceback debug info on -g0. */
#undef OVERRIDE_OPTIONS
-#define OVERRIDE_OPTIONS \
-{ \
- if (write_symbols == NO_DEBUG) \
- debug_info_level = (enum debug_info_level) 0; \
- override_options (); \
+#define OVERRIDE_OPTIONS \
+{ \
+ if (write_symbols == NO_DEBUG \
+ && debug_info_level == DINFO_LEVEL_NONE) \
+ { \
+ write_symbols = VMS_DEBUG; \
+ debug_info_level = DINFO_LEVEL_TERSE; \
+ } \
+ override_options (); \
}
/* Link with vms-dwarf2.o if -g (except -g0). This causes the
@@ -346,26 +380,20 @@ do { \
%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC "%{!shared:%{mvms-return-codes:vcrt0.o%s} \
-%{!mvms-return-codes:pcrt0.o%s}}"
+#define STARTFILE_SPEC \
+"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
+ crtbegin.o%s} \
+ %{!static:%{shared:crtbeginS.o%s}}"
-#undef LIB_SPEC
-#define LIB_SPEC "-lc"
+#define ENDFILE_SPEC \
+"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
#define NAME__MAIN "__gccmain"
#define SYMBOL__MAIN __gccmain
-#define MD_EXEC_PREFIX "/gnu/lib/gcc-lib/"
-#define MD_STARTFILE_PREFIX "/gnu/lib/gcc-lib/"
-
-/* Specify the list of include file directories. */
-#define INCLUDE_DEFAULTS \
-{ \
- { "/gnu/lib/gcc-lib/include", 0, 0, 0 }, \
- { "/gnu_gxx_include", 0, 1, 1 }, \
- { "/gnu_cc_include", 0, 0, 0 }, \
- { "/gnu/include", 0, 0, 0 }, \
- { 0, 0, 0, 0 } \
-}
+#define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
#define LONGLONG_STANDALONE 1
+
+#undef TARGET_VALID_POINTER_MODE
+#define TARGET_VALID_POINTER_MODE vms_valid_pointer_mode
diff --git a/gcc/config/alpha/vms64.h b/gcc/config/alpha/vms64.h
index 99b338a40f4..07424d0f292 100644
--- a/gcc/config/alpha/vms64.h
+++ b/gcc/config/alpha/vms64.h
@@ -1,5 +1,5 @@
/* Output variables, constants and external declarations, for GNU compiler.
- Copyright (C) 2001, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2007, 2009 Free Software Foundation, Inc.
Contributed by Douglas Rupp (rupp@gnat.com).
This file is part of GCC.
@@ -18,14 +18,36 @@ 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/>. */
-/* Defaults to BITS_PER_WORD, e.g. 64 which is what is wanted.
- This is incompatible with DEC C, but matches DEC Ada */
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define_std ("vms"); \
+ builtin_define_std ("VMS"); \
+ builtin_define ("__ALPHA"); \
+ builtin_assert ("system=vms"); \
+ builtin_define ("__IEEE_FLOAT"); \
+ builtin_define ("__LONG_POINTERS=1"); \
+ } while (0)
+
+#undef SUBTARGET_SWITCHES
+#define SUBTARGET_SWITCHES \
+ { "malloc64", MASK_MALLOC64, "Malloc data into P2 space" },
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_FPREGS | MASK_GAS | MASK_MALLOC64)
+
#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 64
+
+#undef POINTER_SIZE
+#define POINTER_SIZE 64
+
+/* Eventhough pointers are 64bits, only 32bit ever remain significant in code
+ addresses. */
+#define MASK_RETURN_ADDR (GEN_INT (0xffffffff))
/* Defaults to "long int" */
#undef SIZE_TYPE
#undef PTRDIFF_TYPE
-#undef POINTERS_EXTEND_UNSIGNED
-#undef POINTER_SIZE
-#define POINTER_SIZE 64
+# include "config/vms/vms-crtl-64.h"
diff --git a/gcc/config/alpha/vms_tramp.asm b/gcc/config/alpha/vms_tramp.asm
deleted file mode 100644
index 84a4e9cfab9..00000000000
--- a/gcc/config/alpha/vms_tramp.asm
+++ /dev/null
@@ -1,46 +0,0 @@
-/* VMS trampoline for nested functions
- Copyright (C) 2001, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Douglas B. Rupp (rupp@gnat.com).
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
-
-GCC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-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/>. */
-
-;# Alpha OpenVMS trampoline
-;#
- .set noreorder
- .set volatile
- .set noat
-.text
- .align 3
- .globl __tramp
- .ent __tramp
-__tramp..en:
-
-.link
- .align 3
-__tramp:
- .pdesc __tramp..en,null
-.text
- ldq $1,24($27)
- ldq $27,16($27)
- ldq $28,8($27)
- jmp $31,($28),0
- .end __tramp
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 66709c7f31c..f53c8988b4f 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -133,10 +133,8 @@ static const struct attribute_spec arc_attribute_table[] =
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST arc_address_cost
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h
index 07772eb8c88..ed70926e9a2 100644
--- a/gcc/config/arm/arm-protos.h
+++ b/gcc/config/arm/arm-protos.h
@@ -151,13 +151,15 @@ extern bool arm_output_addr_const_extra (FILE *, rtx);
#if defined TREE_CODE
extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
+extern void arm_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
+ tree, bool);
extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree);
extern bool arm_pad_arg_upward (enum machine_mode, const_tree);
extern bool arm_pad_reg_upward (enum machine_mode, tree, int);
extern bool arm_needs_doubleword_align (enum machine_mode, tree);
-extern rtx arm_function_value(const_tree, const_tree);
#endif
extern int arm_apply_result_size (void);
+extern rtx aapcs_libcall_value (enum machine_mode);
#endif /* RTX_CODE */
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 85b4995ab0c..993d1219bde 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -43,6 +43,7 @@
#include "optabs.h"
#include "toplev.h"
#include "recog.h"
+#include "cgraph.h"
#include "ggc.h"
#include "except.h"
#include "c-pragma.h"
@@ -54,6 +55,7 @@
#include "langhooks.h"
#include "df.h"
#include "intl.h"
+#include "libfuncs.h"
/* Forward definitions of types. */
typedef struct minipool_node Mnode;
@@ -112,6 +114,7 @@ static unsigned long arm_compute_save_reg_mask (void);
static unsigned long arm_isr_value (tree);
static unsigned long arm_compute_func_type (void);
static tree arm_handle_fndecl_attribute (tree *, tree, tree, int, bool *);
+static tree arm_handle_pcs_attribute (tree *, tree, tree, int, bool *);
static tree arm_handle_isr_attribute (tree *, tree, tree, int, bool *);
#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
static tree arm_handle_notshared_attribute (tree *, tree, tree, int, bool *);
@@ -125,6 +128,13 @@ static int arm_adjust_cost (rtx, rtx, rtx, int);
static int count_insns_for_constant (HOST_WIDE_INT, int);
static int arm_get_strip_length (int);
static bool arm_function_ok_for_sibcall (tree, tree);
+static enum machine_mode arm_promote_function_mode (const_tree,
+ enum machine_mode, int *,
+ const_tree, int);
+static bool arm_return_in_memory (const_tree, const_tree);
+static rtx arm_function_value (const_tree, const_tree, bool);
+static rtx arm_libcall_value (enum machine_mode, rtx);
+
static void arm_internal_label (FILE *, const char *, unsigned long);
static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
tree);
@@ -150,6 +160,9 @@ static void emit_constant_insn (rtx cond, rtx pattern);
static rtx emit_set_insn (rtx, rtx);
static int arm_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode,
tree, bool);
+static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree,
+ const_tree);
+static int aapcs_select_return_coproc (const_tree, const_tree);
#ifdef OBJECT_FORMAT_ELF
static void arm_elf_asm_constructor (rtx, int) ATTRIBUTE_UNUSED;
@@ -218,6 +231,8 @@ static const struct attribute_spec arm_attribute_table[] =
/* Whereas these functions are always known to reside within the 26 bit
addressing range. */
{ "short_call", 0, 0, false, true, true, NULL },
+ /* Specify the procedure call conventions for a function. */
+ { "pcs", 1, 1, false, true, true, arm_handle_pcs_attribute },
/* Interrupt Service Routines have special prologue and epilogue requirements. */
{ "isr", 0, 1, false, false, false, arm_handle_isr_attribute },
{ "interrupt", 0, 1, false, false, false, arm_handle_isr_attribute },
@@ -303,6 +318,12 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_FUNCTION_OK_FOR_SIBCALL
#define TARGET_FUNCTION_OK_FOR_SIBCALL arm_function_ok_for_sibcall
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE arm_function_value
+
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE arm_libcall_value
+
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK arm_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
@@ -329,10 +350,8 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS arm_init_libfuncs
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE arm_promote_function_mode
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES arm_promote_prototypes
#undef TARGET_PASS_BY_REFERENCE
@@ -656,6 +675,8 @@ static int after_arm_reorg = 0;
/* The maximum number of insns to be used when loading a constant. */
static int arm_constant_limit = 3;
+static enum arm_pcs arm_pcs_default;
+
/* For an explanation of these variables, see final_prescan_insn below. */
int arm_ccfsm_state;
/* arm_current_cc is also used for Thumb-2 cond_exec blocks. */
@@ -1042,6 +1063,9 @@ arm_init_libfuncs (void)
default:
break;
}
+
+ if (TARGET_AAPCS_BASED)
+ synchronize_libfunc = init_one_libfunc ("__sync_synchronize");
}
/* On AAPCS systems, this is the "struct __va_list". */
@@ -1644,9 +1668,6 @@ arm_override_options (void)
else
arm_float_abi = TARGET_DEFAULT_FLOAT_ABI;
- 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");
@@ -1678,6 +1699,28 @@ arm_override_options (void)
if (TARGET_SOFT_FLOAT)
arm_fpu_arch = FPUTYPE_NONE;
+ if (TARGET_AAPCS_BASED)
+ {
+ if (arm_abi == ARM_ABI_IWMMXT)
+ arm_pcs_default = ARM_PCS_AAPCS_IWMMXT;
+ else if (arm_float_abi == ARM_FLOAT_ABI_HARD
+ && TARGET_HARD_FLOAT
+ && TARGET_VFP)
+ arm_pcs_default = ARM_PCS_AAPCS_VFP;
+ else
+ arm_pcs_default = ARM_PCS_AAPCS;
+ }
+ else
+ {
+ if (arm_float_abi == ARM_FLOAT_ABI_HARD && TARGET_VFP)
+ sorry ("-mfloat-abi=hard and VFP");
+
+ if (arm_abi == ARM_ABI_APCS)
+ arm_pcs_default = ARM_PCS_APCS;
+ else
+ arm_pcs_default = ARM_PCS_ATPCS;
+ }
+
/* For arm2/3 there is no need to do any scheduling if there is only
a floating point emulator, or we are doing software floating-point. */
if ((TARGET_SOFT_FLOAT
@@ -3071,17 +3114,22 @@ arm_canonicalize_comparison (enum rtx_code code, enum machine_mode mode,
/* Define how to find the value returned by a function. */
-rtx
-arm_function_value(const_tree type, const_tree func ATTRIBUTE_UNUSED)
+static rtx
+arm_function_value(const_tree type, const_tree func,
+ bool outgoing ATTRIBUTE_UNUSED)
{
enum machine_mode mode;
int unsignedp ATTRIBUTE_UNUSED;
rtx r ATTRIBUTE_UNUSED;
mode = TYPE_MODE (type);
+
+ if (TARGET_AAPCS_BASED)
+ return aapcs_allocate_return_reg (mode, type, func);
+
/* Promote integer types. */
if (INTEGRAL_TYPE_P (type))
- PROMOTE_FUNCTION_MODE (mode, unsignedp, type);
+ mode = arm_promote_function_mode (type, mode, &unsignedp, func, 1);
/* Promotes small structs returned in a register to full-word size
for big-endian AAPCS. */
@@ -3095,7 +3143,88 @@ arm_function_value(const_tree type, const_tree func ATTRIBUTE_UNUSED)
}
}
- return LIBCALL_VALUE(mode);
+ return LIBCALL_VALUE (mode);
+}
+
+static int
+libcall_eq (const void *p1, const void *p2)
+{
+ return rtx_equal_p ((const_rtx) p1, (const_rtx) p2);
+}
+
+static hashval_t
+libcall_hash (const void *p1)
+{
+ return hash_rtx ((const_rtx) p1, VOIDmode, NULL, NULL, FALSE);
+}
+
+static void
+add_libcall (htab_t htab, rtx libcall)
+{
+ *htab_find_slot (htab, libcall, INSERT) = libcall;
+}
+
+static bool
+arm_libcall_uses_aapcs_base (rtx libcall)
+{
+ static bool init_done = false;
+ static htab_t libcall_htab;
+
+ if (!init_done)
+ {
+ init_done = true;
+
+ libcall_htab = htab_create (31, libcall_hash, libcall_eq,
+ NULL);
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sfloat_optab, SFmode, SImode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sfloat_optab, DFmode, SImode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sfloat_optab, SFmode, DImode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sfloat_optab, DFmode, DImode));
+
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (ufloat_optab, SFmode, SImode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (ufloat_optab, DFmode, SImode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (ufloat_optab, SFmode, DImode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (ufloat_optab, DFmode, DImode));
+
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sext_optab, SFmode, HFmode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (trunc_optab, HFmode, SFmode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sfix_optab, DImode, DFmode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (ufix_optab, DImode, DFmode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (sfix_optab, DImode, SFmode));
+ add_libcall (libcall_htab,
+ convert_optab_libfunc (ufix_optab, DImode, SFmode));
+ }
+
+ return libcall && htab_find (libcall_htab, libcall) != NULL;
+}
+
+rtx
+arm_libcall_value (enum machine_mode mode, rtx libcall)
+{
+ if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS
+ && GET_MODE_CLASS (mode) == MODE_FLOAT)
+ {
+ /* The following libcalls return their result in integer registers,
+ even though they return a floating point value. */
+ if (arm_libcall_uses_aapcs_base (libcall))
+ return gen_rtx_REG (mode, ARG_REGISTER(1));
+
+ }
+
+ return LIBCALL_VALUE (mode);
}
/* Determine the amount of memory needed to store the possible return
@@ -3105,10 +3234,12 @@ arm_apply_result_size (void)
{
int size = 16;
- if (TARGET_ARM)
+ if (TARGET_32BIT)
{
if (TARGET_HARD_FLOAT_ABI)
{
+ if (TARGET_VFP)
+ size += 32;
if (TARGET_FPA)
size += 12;
if (TARGET_MAVERICK)
@@ -3121,27 +3252,56 @@ arm_apply_result_size (void)
return size;
}
-/* Decide whether a type should be returned in memory (true)
- or in a register (false). This is called as the target hook
- TARGET_RETURN_IN_MEMORY. */
+/* Decide whether TYPE should be returned in memory (true)
+ or in a register (false). FNTYPE is the type of the function making
+ the call. */
static bool
-arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+arm_return_in_memory (const_tree type, const_tree fntype)
{
HOST_WIDE_INT size;
- size = int_size_in_bytes (type);
+ size = int_size_in_bytes (type); /* Negative if not fixed size. */
+
+ if (TARGET_AAPCS_BASED)
+ {
+ /* Simple, non-aggregate types (ie not including vectors and
+ complex) are always returned in a register (or registers).
+ We don't care about which register here, so we can short-cut
+ some of the detail. */
+ if (!AGGREGATE_TYPE_P (type)
+ && TREE_CODE (type) != VECTOR_TYPE
+ && TREE_CODE (type) != COMPLEX_TYPE)
+ return false;
+
+ /* Any return value that is no larger than one word can be
+ returned in r0. */
+ if (((unsigned HOST_WIDE_INT) size) <= UNITS_PER_WORD)
+ return false;
+
+ /* Check any available co-processors to see if they accept the
+ type as a register candidate (VFP, for example, can return
+ some aggregates in consecutive registers). These aren't
+ available if the call is variadic. */
+ if (aapcs_select_return_coproc (type, fntype) >= 0)
+ return false;
+
+ /* Vector values should be returned using ARM registers, not
+ memory (unless they're over 16 bytes, which will break since
+ we only have four call-clobbered registers to play with). */
+ if (TREE_CODE (type) == VECTOR_TYPE)
+ return (size < 0 || size > (4 * UNITS_PER_WORD));
+
+ /* The rest go in memory. */
+ return true;
+ }
- /* Vector values should be returned using ARM registers, not memory (unless
- they're over 16 bytes, which will break since we only have four
- call-clobbered registers to play with). */
if (TREE_CODE (type) == VECTOR_TYPE)
return (size < 0 || size > (4 * UNITS_PER_WORD));
if (!AGGREGATE_TYPE_P (type) &&
- !(TARGET_AAPCS_BASED && TREE_CODE (type) == COMPLEX_TYPE))
- /* All simple types are returned in registers.
- For AAPCS, complex types are treated the same as aggregates. */
- return 0;
+ (TREE_CODE (type) != VECTOR_TYPE))
+ /* All simple types are returned in registers. */
+ return false;
if (arm_abi != ARM_ABI_APCS)
{
@@ -3158,7 +3318,7 @@ arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
the aggregate is either huge or of variable size, and in either case
we will want to return it via memory and not in a register. */
if (size < 0 || size > UNITS_PER_WORD)
- return 1;
+ return true;
if (TREE_CODE (type) == RECORD_TYPE)
{
@@ -3178,18 +3338,18 @@ arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
continue;
if (field == NULL)
- return 0; /* An empty structure. Allowed by an extension to ANSI C. */
+ return false; /* An empty structure. Allowed by an extension to ANSI C. */
/* Check that the first field is valid for returning in a register. */
/* ... Floats are not allowed */
if (FLOAT_TYPE_P (TREE_TYPE (field)))
- return 1;
+ return true;
/* ... Aggregates that are not themselves valid for returning in
a register are not allowed. */
if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
- return 1;
+ return true;
/* Now check the remaining fields, if any. Only bitfields are allowed,
since they are not addressable. */
@@ -3201,10 +3361,10 @@ arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
continue;
if (!DECL_BIT_FIELD_TYPE (field))
- return 1;
+ return true;
}
- return 0;
+ return false;
}
if (TREE_CODE (type) == UNION_TYPE)
@@ -3221,18 +3381,18 @@ arm_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
continue;
if (FLOAT_TYPE_P (TREE_TYPE (field)))
- return 1;
+ return true;
if (arm_return_in_memory (TREE_TYPE (field), NULL_TREE))
- return 1;
+ return true;
}
- return 0;
+ return false;
}
#endif /* not ARM_WINCE */
/* Return all other types in memory. */
- return 1;
+ return true;
}
/* Indicate whether or not words of a double are in big-endian order. */
@@ -3257,14 +3417,753 @@ arm_float_words_big_endian (void)
return 1;
}
+const struct pcs_attribute_arg
+{
+ const char *arg;
+ enum arm_pcs value;
+} pcs_attribute_args[] =
+ {
+ {"aapcs", ARM_PCS_AAPCS},
+ {"aapcs-vfp", ARM_PCS_AAPCS_VFP},
+#if 0
+ /* We could recognize these, but changes would be needed elsewhere
+ * to implement them. */
+ {"aapcs-iwmmxt", ARM_PCS_AAPCS_IWMMXT},
+ {"atpcs", ARM_PCS_ATPCS},
+ {"apcs", ARM_PCS_APCS},
+#endif
+ {NULL, ARM_PCS_UNKNOWN}
+ };
+
+static enum arm_pcs
+arm_pcs_from_attribute (tree attr)
+{
+ const struct pcs_attribute_arg *ptr;
+ const char *arg;
+
+ /* Get the value of the argument. */
+ if (TREE_VALUE (attr) == NULL_TREE
+ || TREE_CODE (TREE_VALUE (attr)) != STRING_CST)
+ return ARM_PCS_UNKNOWN;
+
+ arg = TREE_STRING_POINTER (TREE_VALUE (attr));
+
+ /* Check it against the list of known arguments. */
+ for (ptr = pcs_attribute_args; ptr->arg != NULL; ptr++)
+ if (streq (arg, ptr->arg))
+ return ptr->value;
+
+ /* An unrecognized interrupt type. */
+ return ARM_PCS_UNKNOWN;
+}
+
+/* Get the PCS variant to use for this call. TYPE is the function's type
+ specification, DECL is the specific declartion. DECL may be null if
+ the call could be indirect or if this is a library call. */
+static enum arm_pcs
+arm_get_pcs_model (const_tree type, const_tree decl)
+{
+ bool user_convention = false;
+ enum arm_pcs user_pcs = arm_pcs_default;
+ tree attr;
+
+ gcc_assert (type);
+
+ attr = lookup_attribute ("pcs", TYPE_ATTRIBUTES (type));
+ if (attr)
+ {
+ user_pcs = arm_pcs_from_attribute (TREE_VALUE (attr));
+ user_convention = true;
+ }
+
+ if (TARGET_AAPCS_BASED)
+ {
+ /* Detect varargs functions. These always use the base rules
+ (no argument is ever a candidate for a co-processor
+ register). */
+ bool base_rules = (TYPE_ARG_TYPES (type) != 0
+ && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (type)))
+ != void_type_node));
+
+ if (user_convention)
+ {
+ if (user_pcs > ARM_PCS_AAPCS_LOCAL)
+ sorry ("Non-AAPCS derived PCS variant");
+ else if (base_rules && user_pcs != ARM_PCS_AAPCS)
+ error ("Variadic functions must use the base AAPCS variant");
+ }
+
+ if (base_rules)
+ return ARM_PCS_AAPCS;
+ else if (user_convention)
+ return user_pcs;
+ else if (decl && flag_unit_at_a_time)
+ {
+ /* Local functions never leak outside this compilation unit,
+ so we are free to use whatever conventions are
+ appropriate. */
+ /* FIXME: remove CONST_CAST_TREE when cgraph is constified. */
+ struct cgraph_local_info *i = cgraph_local_info (CONST_CAST_TREE(decl));
+ if (i && i->local)
+ return ARM_PCS_AAPCS_LOCAL;
+ }
+ }
+ else if (user_convention && user_pcs != arm_pcs_default)
+ sorry ("PCS variant");
+
+ /* For everything else we use the target's default. */
+ return arm_pcs_default;
+}
+
+
+static void
+aapcs_vfp_cum_init (CUMULATIVE_ARGS *pcum ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ rtx libcall ATTRIBUTE_UNUSED,
+ const_tree fndecl ATTRIBUTE_UNUSED)
+{
+ /* Record the unallocated VFP registers. */
+ pcum->aapcs_vfp_regs_free = (1 << NUM_VFP_ARG_REGS) - 1;
+ pcum->aapcs_vfp_reg_alloc = 0;
+}
+
+/* Walk down the type tree of TYPE counting consecutive base elements.
+ If *MODEP is VOIDmode, then set it to the first valid floating point
+ type. If a non-floating point type is found, or if a floating point
+ type that doesn't match a non-VOIDmode *MODEP is found, then return -1,
+ otherwise return the count in the sub-tree. */
+static int
+aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
+{
+ enum machine_mode mode;
+ HOST_WIDE_INT size;
+
+ switch (TREE_CODE (type))
+ {
+ case REAL_TYPE:
+ mode = TYPE_MODE (type);
+ if (mode != DFmode && mode != SFmode)
+ return -1;
+
+ if (*modep == VOIDmode)
+ *modep = mode;
+
+ if (*modep == mode)
+ return 1;
+
+ break;
+
+ case COMPLEX_TYPE:
+ mode = TYPE_MODE (TREE_TYPE (type));
+ if (mode != DFmode && mode != SFmode)
+ return -1;
+
+ if (*modep == VOIDmode)
+ *modep = mode;
+
+ if (*modep == mode)
+ return 2;
+
+ break;
+
+ case VECTOR_TYPE:
+ /* Use V2SImode and V4SImode as representatives of all 64-bit
+ and 128-bit vector types, whether or not those modes are
+ supported with the present options. */
+ size = int_size_in_bytes (type);
+ switch (size)
+ {
+ case 8:
+ mode = V2SImode;
+ break;
+ case 16:
+ mode = V4SImode;
+ break;
+ default:
+ return -1;
+ }
+
+ if (*modep == VOIDmode)
+ *modep = mode;
+
+ /* Vector modes are considered to be opaque: two vectors are
+ equivalent for the purposes of being homogeneous aggregates
+ if they are the same size. */
+ if (*modep == mode)
+ return 1;
+
+ break;
+
+ case ARRAY_TYPE:
+ {
+ int count;
+ tree index = TYPE_DOMAIN (type);
+
+ /* Can't handle incomplete types. */
+ if (!COMPLETE_TYPE_P(type))
+ return -1;
+
+ count = aapcs_vfp_sub_candidate (TREE_TYPE (type), modep);
+ if (count == -1
+ || !index
+ || !TYPE_MAX_VALUE (index)
+ || !host_integerp (TYPE_MAX_VALUE (index), 1)
+ || !TYPE_MIN_VALUE (index)
+ || !host_integerp (TYPE_MIN_VALUE (index), 1)
+ || count < 0)
+ return -1;
+
+ count *= (1 + tree_low_cst (TYPE_MAX_VALUE (index), 1)
+ - tree_low_cst (TYPE_MIN_VALUE (index), 1));
+
+ /* There must be no padding. */
+ if (!host_integerp (TYPE_SIZE (type), 1)
+ || (tree_low_cst (TYPE_SIZE (type), 1)
+ != count * GET_MODE_BITSIZE (*modep)))
+ return -1;
+
+ return count;
+ }
+
+ case RECORD_TYPE:
+ {
+ int count = 0;
+ int sub_count;
+ tree field;
+
+ /* Can't handle incomplete types. */
+ if (!COMPLETE_TYPE_P(type))
+ return -1;
+
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ {
+ if (TREE_CODE (field) != FIELD_DECL)
+ continue;
+
+ sub_count = aapcs_vfp_sub_candidate (TREE_TYPE (field), modep);
+ if (sub_count < 0)
+ return -1;
+ count += sub_count;
+ }
+
+ /* There must be no padding. */
+ if (!host_integerp (TYPE_SIZE (type), 1)
+ || (tree_low_cst (TYPE_SIZE (type), 1)
+ != count * GET_MODE_BITSIZE (*modep)))
+ return -1;
+
+ return count;
+ }
+
+ case UNION_TYPE:
+ case QUAL_UNION_TYPE:
+ {
+ /* These aren't very interesting except in a degenerate case. */
+ int count = 0;
+ int sub_count;
+ tree field;
+
+ /* Can't handle incomplete types. */
+ if (!COMPLETE_TYPE_P(type))
+ return -1;
+
+ for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+ {
+ if (TREE_CODE (field) != FIELD_DECL)
+ continue;
+
+ sub_count = aapcs_vfp_sub_candidate (TREE_TYPE (field), modep);
+ if (sub_count < 0)
+ return -1;
+ count = count > sub_count ? count : sub_count;
+ }
+
+ /* There must be no padding. */
+ if (!host_integerp (TYPE_SIZE (type), 1)
+ || (tree_low_cst (TYPE_SIZE (type), 1)
+ != count * GET_MODE_BITSIZE (*modep)))
+ return -1;
+
+ return count;
+ }
+
+ default:
+ break;
+ }
+
+ return -1;
+}
+
+static bool
+aapcs_vfp_is_call_or_return_candidate (enum machine_mode mode, const_tree type,
+ int *base_mode,
+ int *count)
+{
+ if (GET_MODE_CLASS (mode) == MODE_FLOAT
+ || GET_MODE_CLASS (mode) == MODE_VECTOR_INT
+ || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT)
+ {
+ *count = 1;
+ *base_mode = mode;
+ return true;
+ }
+ else if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
+ {
+ *count = 2;
+ *base_mode = (mode == DCmode ? DFmode : SFmode);
+ return true;
+ }
+ else if (type && (mode == BLKmode || TREE_CODE (type) == VECTOR_TYPE))
+ {
+ enum machine_mode aggregate_mode = VOIDmode;
+ int ag_count = aapcs_vfp_sub_candidate (type, &aggregate_mode);
+
+ if (ag_count > 0 && ag_count <= 4)
+ {
+ *count = ag_count;
+ *base_mode = aggregate_mode;
+ return true;
+ }
+ }
+ return false;
+}
+
+static bool
+aapcs_vfp_is_return_candidate (enum arm_pcs pcs_variant,
+ enum machine_mode mode, const_tree type)
+{
+ int count ATTRIBUTE_UNUSED;
+ int ag_mode ATTRIBUTE_UNUSED;
+
+ if (!(pcs_variant == ARM_PCS_AAPCS_VFP
+ || (pcs_variant == ARM_PCS_AAPCS_LOCAL
+ && TARGET_32BIT && TARGET_VFP && TARGET_HARD_FLOAT)))
+ return false;
+ return aapcs_vfp_is_call_or_return_candidate (mode, type, &ag_mode, &count);
+}
+
+static bool
+aapcs_vfp_is_call_candidate (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
+ const_tree type)
+{
+ if (!(pcum->pcs_variant == ARM_PCS_AAPCS_VFP
+ || (pcum->pcs_variant == ARM_PCS_AAPCS_LOCAL
+ && TARGET_32BIT && TARGET_VFP && TARGET_HARD_FLOAT)))
+ return false;
+ return aapcs_vfp_is_call_or_return_candidate (mode, type,
+ &pcum->aapcs_vfp_rmode,
+ &pcum->aapcs_vfp_rcount);
+}
+
+static bool
+aapcs_vfp_allocate (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
+ const_tree type ATTRIBUTE_UNUSED)
+{
+ int shift = GET_MODE_SIZE (pcum->aapcs_vfp_rmode) / GET_MODE_SIZE (SFmode);
+ unsigned mask = (1 << (shift * pcum->aapcs_vfp_rcount)) - 1;
+ int regno;
+
+ for (regno = 0; regno < NUM_VFP_ARG_REGS; regno += shift)
+ if (((pcum->aapcs_vfp_regs_free >> regno) & mask) == mask)
+ {
+ pcum->aapcs_vfp_reg_alloc = mask << regno;
+ if (mode == BLKmode || (mode == TImode && !TARGET_NEON))
+ {
+ int i;
+ int rcount = pcum->aapcs_vfp_rcount;
+ int rshift = shift;
+ enum machine_mode rmode = pcum->aapcs_vfp_rmode;
+ rtx par;
+ if (!TARGET_NEON)
+ {
+ /* Avoid using unsupported vector modes. */
+ if (rmode == V2SImode)
+ rmode = DImode;
+ else if (rmode == V4SImode)
+ {
+ rmode = DImode;
+ rcount *= 2;
+ rshift /= 2;
+ }
+ }
+ par = gen_rtx_PARALLEL (mode, rtvec_alloc (rcount));
+ for (i = 0; i < rcount; i++)
+ {
+ rtx tmp = gen_rtx_REG (rmode,
+ FIRST_VFP_REGNUM + regno + i * rshift);
+ tmp = gen_rtx_EXPR_LIST
+ (VOIDmode, tmp,
+ GEN_INT (i * GET_MODE_SIZE (rmode)));
+ XVECEXP (par, 0, i) = tmp;
+ }
+
+ pcum->aapcs_reg = par;
+ }
+ else
+ pcum->aapcs_reg = gen_rtx_REG (mode, FIRST_VFP_REGNUM + regno);
+ return true;
+ }
+ return false;
+}
+
+static rtx
+aapcs_vfp_allocate_return_reg (enum arm_pcs pcs_variant ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ const_tree type ATTRIBUTE_UNUSED)
+{
+ if (!(pcs_variant == ARM_PCS_AAPCS_VFP
+ || (pcs_variant == ARM_PCS_AAPCS_LOCAL
+ && TARGET_32BIT && TARGET_VFP && TARGET_HARD_FLOAT)))
+ return false;
+ if (mode == BLKmode || (mode == TImode && !TARGET_NEON))
+ {
+ int count;
+ int ag_mode;
+ int i;
+ rtx par;
+ int shift;
+
+ aapcs_vfp_is_call_or_return_candidate (mode, type, &ag_mode, &count);
+
+ if (!TARGET_NEON)
+ {
+ if (ag_mode == V2SImode)
+ ag_mode = DImode;
+ else if (ag_mode == V4SImode)
+ {
+ ag_mode = DImode;
+ count *= 2;
+ }
+ }
+ shift = GET_MODE_SIZE(ag_mode) / GET_MODE_SIZE(SFmode);
+ par = gen_rtx_PARALLEL (mode, rtvec_alloc (count));
+ for (i = 0; i < count; i++)
+ {
+ rtx tmp = gen_rtx_REG (ag_mode, FIRST_VFP_REGNUM + i * shift);
+ tmp = gen_rtx_EXPR_LIST (VOIDmode, tmp,
+ GEN_INT (i * GET_MODE_SIZE (ag_mode)));
+ XVECEXP (par, 0, i) = tmp;
+ }
+
+ return par;
+ }
+
+ return gen_rtx_REG (mode, FIRST_VFP_REGNUM);
+}
+
+static void
+aapcs_vfp_advance (CUMULATIVE_ARGS *pcum ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED)
+{
+ pcum->aapcs_vfp_regs_free &= ~pcum->aapcs_vfp_reg_alloc;
+ pcum->aapcs_vfp_reg_alloc = 0;
+ return;
+}
+
+#define AAPCS_CP(X) \
+ { \
+ aapcs_ ## X ## _cum_init, \
+ aapcs_ ## X ## _is_call_candidate, \
+ aapcs_ ## X ## _allocate, \
+ aapcs_ ## X ## _is_return_candidate, \
+ aapcs_ ## X ## _allocate_return_reg, \
+ aapcs_ ## X ## _advance \
+ }
+
+/* Table of co-processors that can be used to pass arguments in
+ registers. Idealy no arugment should be a candidate for more than
+ one co-processor table entry, but the table is processed in order
+ and stops after the first match. If that entry then fails to put
+ the argument into a co-processor register, the argument will go on
+ the stack. */
+static struct
+{
+ /* Initialize co-processor related state in CUMULATIVE_ARGS structure. */
+ void (*cum_init) (CUMULATIVE_ARGS *, const_tree, rtx, const_tree);
+
+ /* Return true if an argument of mode MODE (or type TYPE if MODE is
+ BLKmode) is a candidate for this co-processor's registers; this
+ function should ignore any position-dependent state in
+ CUMULATIVE_ARGS and only use call-type dependent information. */
+ bool (*is_call_candidate) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
+
+ /* Return true if the argument does get a co-processor register; it
+ should set aapcs_reg to an RTX of the register allocated as is
+ required for a return from FUNCTION_ARG. */
+ bool (*allocate) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
+
+ /* Return true if a result of mode MODE (or type TYPE if MODE is
+ BLKmode) is can be returned in this co-processor's registers. */
+ bool (*is_return_candidate) (enum arm_pcs, enum machine_mode, const_tree);
+
+ /* Allocate and return an RTX element to hold the return type of a
+ call, this routine must not fail and will only be called if
+ is_return_candidate returned true with the same parameters. */
+ rtx (*allocate_return_reg) (enum arm_pcs, enum machine_mode, const_tree);
+
+ /* Finish processing this argument and prepare to start processing
+ the next one. */
+ void (*advance) (CUMULATIVE_ARGS *, enum machine_mode, const_tree);
+} aapcs_cp_arg_layout[ARM_NUM_COPROC_SLOTS] =
+ {
+ AAPCS_CP(vfp)
+ };
+
+#undef AAPCS_CP
+
+static int
+aapcs_select_call_coproc (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
+ tree type)
+{
+ int i;
+
+ for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
+ if (aapcs_cp_arg_layout[i].is_call_candidate (pcum, mode, type))
+ return i;
+
+ return -1;
+}
+
+static int
+aapcs_select_return_coproc (const_tree type, const_tree fntype)
+{
+ /* We aren't passed a decl, so we can't check that a call is local.
+ However, it isn't clear that that would be a win anyway, since it
+ might limit some tail-calling opportunities. */
+ enum arm_pcs pcs_variant;
+
+ if (fntype)
+ {
+ const_tree fndecl = NULL_TREE;
+
+ if (TREE_CODE (fntype) == FUNCTION_DECL)
+ {
+ fndecl = fntype;
+ fntype = TREE_TYPE (fntype);
+ }
+
+ pcs_variant = arm_get_pcs_model (fntype, fndecl);
+ }
+ else
+ pcs_variant = arm_pcs_default;
+
+ if (pcs_variant != ARM_PCS_AAPCS)
+ {
+ int i;
+
+ for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
+ if (aapcs_cp_arg_layout[i].is_return_candidate (pcs_variant,
+ TYPE_MODE (type),
+ type))
+ return i;
+ }
+ return -1;
+}
+
+static rtx
+aapcs_allocate_return_reg (enum machine_mode mode, const_tree type,
+ const_tree fntype)
+{
+ /* We aren't passed a decl, so we can't check that a call is local.
+ However, it isn't clear that that would be a win anyway, since it
+ might limit some tail-calling opportunities. */
+ enum arm_pcs pcs_variant;
+ int unsignedp ATTRIBUTE_UNUSED;
+
+ if (fntype)
+ {
+ const_tree fndecl = NULL_TREE;
+
+ if (TREE_CODE (fntype) == FUNCTION_DECL)
+ {
+ fndecl = fntype;
+ fntype = TREE_TYPE (fntype);
+ }
+
+ pcs_variant = arm_get_pcs_model (fntype, fndecl);
+ }
+ else
+ pcs_variant = arm_pcs_default;
+
+ /* Promote integer types. */
+ if (type && INTEGRAL_TYPE_P (type))
+ mode = arm_promote_function_mode (type, mode, &unsignedp, fntype, 1);
+
+ if (pcs_variant != ARM_PCS_AAPCS)
+ {
+ int i;
+
+ for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
+ if (aapcs_cp_arg_layout[i].is_return_candidate (pcs_variant, mode,
+ type))
+ return aapcs_cp_arg_layout[i].allocate_return_reg (pcs_variant,
+ mode, type);
+ }
+
+ /* Promotes small structs returned in a register to full-word size
+ for big-endian AAPCS. */
+ if (type && arm_return_in_msb (type))
+ {
+ HOST_WIDE_INT size = int_size_in_bytes (type);
+ if (size % UNITS_PER_WORD != 0)
+ {
+ size += UNITS_PER_WORD - size % UNITS_PER_WORD;
+ mode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0);
+ }
+ }
+
+ return gen_rtx_REG (mode, R0_REGNUM);
+}
+
+rtx
+aapcs_libcall_value (enum machine_mode mode)
+{
+ return aapcs_allocate_return_reg (mode, NULL_TREE, NULL_TREE);
+}
+
+/* Lay out a function argument using the AAPCS rules. The rule
+ numbers referred to here are those in the AAPCS. */
+static void
+aapcs_layout_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
+ tree type, int named)
+{
+ int nregs, nregs2;
+ int ncrn;
+
+ /* We only need to do this once per argument. */
+ if (pcum->aapcs_arg_processed)
+ return;
+
+ pcum->aapcs_arg_processed = true;
+
+ /* Special case: if named is false then we are handling an incoming
+ anonymous argument which is on the stack. */
+ if (!named)
+ return;
+
+ /* Is this a potential co-processor register candidate? */
+ if (pcum->pcs_variant != ARM_PCS_AAPCS)
+ {
+ int slot = aapcs_select_call_coproc (pcum, mode, type);
+ pcum->aapcs_cprc_slot = slot;
+
+ /* We don't have to apply any of the rules from part B of the
+ preparation phase, these are handled elsewhere in the
+ compiler. */
+
+ if (slot >= 0)
+ {
+ /* A Co-processor register candidate goes either in its own
+ class of registers or on the stack. */
+ if (!pcum->aapcs_cprc_failed[slot])
+ {
+ /* C1.cp - Try to allocate the argument to co-processor
+ registers. */
+ if (aapcs_cp_arg_layout[slot].allocate (pcum, mode, type))
+ return;
+
+ /* C2.cp - Put the argument on the stack and note that we
+ can't assign any more candidates in this slot. We also
+ need to note that we have allocated stack space, so that
+ we won't later try to split a non-cprc candidate between
+ core registers and the stack. */
+ pcum->aapcs_cprc_failed[slot] = true;
+ pcum->can_split = false;
+ }
+
+ /* We didn't get a register, so this argument goes on the
+ stack. */
+ gcc_assert (pcum->can_split == false);
+ return;
+ }
+ }
+
+ /* C3 - For double-word aligned arguments, round the NCRN up to the
+ next even number. */
+ ncrn = pcum->aapcs_ncrn;
+ if ((ncrn & 1) && arm_needs_doubleword_align (mode, type))
+ ncrn++;
+
+ nregs = ARM_NUM_REGS2(mode, type);
+
+ /* Sigh, this test should really assert that nregs > 0, but a GCC
+ extension allows empty structs and then gives them empty size; it
+ then allows such a structure to be passed by value. For some of
+ the code below we have to pretend that such an argument has
+ non-zero size so that we 'locate' it correctly either in
+ registers or on the stack. */
+ gcc_assert (nregs >= 0);
+
+ nregs2 = nregs ? nregs : 1;
+
+ /* C4 - Argument fits entirely in core registers. */
+ if (ncrn + nregs2 <= NUM_ARG_REGS)
+ {
+ pcum->aapcs_reg = gen_rtx_REG (mode, ncrn);
+ pcum->aapcs_next_ncrn = ncrn + nregs;
+ return;
+ }
+
+ /* C5 - Some core registers left and there are no arguments already
+ on the stack: split this argument between the remaining core
+ registers and the stack. */
+ if (ncrn < NUM_ARG_REGS && pcum->can_split)
+ {
+ pcum->aapcs_reg = gen_rtx_REG (mode, ncrn);
+ pcum->aapcs_next_ncrn = NUM_ARG_REGS;
+ pcum->aapcs_partial = (NUM_ARG_REGS - ncrn) * UNITS_PER_WORD;
+ return;
+ }
+
+ /* C6 - NCRN is set to 4. */
+ pcum->aapcs_next_ncrn = NUM_ARG_REGS;
+
+ /* C7,C8 - arugment goes on the stack. We have nothing to do here. */
+ return;
+}
+
/* Initialize a variable CUM of type CUMULATIVE_ARGS
for a call to a function whose data type is FNTYPE.
For a library call, FNTYPE is NULL. */
void
arm_init_cumulative_args (CUMULATIVE_ARGS *pcum, tree fntype,
- rtx libname ATTRIBUTE_UNUSED,
+ rtx libname,
tree fndecl ATTRIBUTE_UNUSED)
{
+ /* Long call handling. */
+ if (fntype)
+ pcum->pcs_variant = arm_get_pcs_model (fntype, fndecl);
+ else
+ pcum->pcs_variant = arm_pcs_default;
+
+ if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
+ {
+ if (arm_libcall_uses_aapcs_base (libname))
+ pcum->pcs_variant = ARM_PCS_AAPCS;
+
+ pcum->aapcs_ncrn = pcum->aapcs_next_ncrn = 0;
+ pcum->aapcs_reg = NULL_RTX;
+ pcum->aapcs_partial = 0;
+ pcum->aapcs_arg_processed = false;
+ pcum->aapcs_cprc_slot = -1;
+ pcum->can_split = true;
+
+ if (pcum->pcs_variant != ARM_PCS_AAPCS)
+ {
+ int i;
+
+ for (i = 0; i < ARM_NUM_COPROC_SLOTS; i++)
+ {
+ pcum->aapcs_cprc_failed[i] = false;
+ aapcs_cp_arg_layout[i].cum_init (pcum, fntype, libname, fndecl);
+ }
+ }
+ return;
+ }
+
+ /* Legacy ABIs */
+
/* On the ARM, the offset starts at 0. */
pcum->nregs = 0;
pcum->iwmmxt_nregs = 0;
@@ -3318,6 +4217,17 @@ arm_function_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
{
int nregs;
+ /* Handle the special case quickly. Pick an arbitrary value for op2 of
+ a call insn (op3 of a call_value insn). */
+ if (mode == VOIDmode)
+ return const0_rtx;
+
+ if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
+ {
+ aapcs_layout_arg (pcum, mode, type, named);
+ return pcum->aapcs_reg;
+ }
+
/* Varargs vectors are treated the same as long long.
named_count avoids having to change the way arm handles 'named' */
if (TARGET_IWMMXT_ABI
@@ -3359,10 +4269,16 @@ arm_function_arg (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
static int
arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
- tree type, bool named ATTRIBUTE_UNUSED)
+ tree type, bool named)
{
int nregs = pcum->nregs;
+ if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
+ {
+ aapcs_layout_arg (pcum, mode, type, named);
+ return pcum->aapcs_partial;
+ }
+
if (TARGET_IWMMXT_ABI && arm_vector_mode_supported_p (mode))
return 0;
@@ -3374,6 +4290,39 @@ arm_arg_partial_bytes (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
return 0;
}
+void
+arm_function_arg_advance (CUMULATIVE_ARGS *pcum, enum machine_mode mode,
+ tree type, bool named)
+{
+ if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
+ {
+ aapcs_layout_arg (pcum, mode, type, named);
+
+ if (pcum->aapcs_cprc_slot >= 0)
+ {
+ aapcs_cp_arg_layout[pcum->aapcs_cprc_slot].advance (pcum, mode,
+ type);
+ pcum->aapcs_cprc_slot = -1;
+ }
+
+ /* Generic stuff. */
+ pcum->aapcs_arg_processed = false;
+ pcum->aapcs_ncrn = pcum->aapcs_next_ncrn;
+ pcum->aapcs_reg = NULL_RTX;
+ pcum->aapcs_partial = 0;
+ }
+ else
+ {
+ pcum->nargs += 1;
+ if (arm_vector_mode_supported_p (mode)
+ && pcum->named_count > pcum->nargs
+ && TARGET_IWMMXT_ABI)
+ pcum->iwmmxt_nregs += 1;
+ else
+ pcum->nregs += ARM_NUM_REGS2 (mode, type);
+ }
+}
+
/* Variable sized types are passed by reference. This is a GCC
extension to the ARM ABI. */
@@ -3490,6 +4439,20 @@ arm_handle_isr_attribute (tree *node, tree name, tree args, int flags,
return NULL_TREE;
}
+/* Handle a "pcs" attribute; arguments as in struct
+ attribute_spec.handler. */
+static tree
+arm_handle_pcs_attribute (tree *node ATTRIBUTE_UNUSED, tree name, tree args,
+ int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+{
+ if (arm_pcs_from_attribute (args) == ARM_PCS_UNKNOWN)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+ return NULL_TREE;
+}
+
#if TARGET_DLLIMPORT_DECL_ATTRIBUTES
/* Handle the "notshared" attribute. This attribute is another way of
requesting hidden visibility. ARM's compiler supports
@@ -3651,7 +4614,7 @@ arm_is_long_call_p (tree decl)
/* Return nonzero if it is ok to make a tail-call to DECL. */
static bool
-arm_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
+arm_function_ok_for_sibcall (tree decl, tree exp)
{
unsigned long func_type;
@@ -3684,6 +4647,21 @@ arm_function_ok_for_sibcall (tree decl, tree exp ATTRIBUTE_UNUSED)
if (IS_INTERRUPT (func_type))
return false;
+ if (!VOID_TYPE_P (TREE_TYPE (DECL_RESULT (cfun->decl))))
+ {
+ /* Check that the return value locations are the same. For
+ example that we aren't returning a value from the sibling in
+ a VFP register but then need to transfer it to a core
+ register. */
+ rtx a, b;
+
+ a = arm_function_value (TREE_TYPE (exp), decl, false);
+ b = arm_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)),
+ cfun->decl, false);
+ if (!rtx_equal_p (a, b))
+ return false;
+ }
+
/* Never tailcall if function may be called with a misaligned SP. */
if (IS_STACKALIGN (func_type))
return false;
@@ -6329,9 +7307,9 @@ arm_arm_address_cost (rtx x)
if (c == MEM || c == LABEL_REF || c == SYMBOL_REF)
return 10;
- if (c == PLUS || c == MINUS)
+ if (c == PLUS)
{
- if (GET_CODE (XEXP (x, 0)) == CONST_INT)
+ if (GET_CODE (XEXP (x, 1)) == CONST_INT)
return 2;
if (ARITHMETIC_P (XEXP (x, 0)) || ARITHMETIC_P (XEXP (x, 1)))
@@ -18948,19 +19926,24 @@ arm_output_load_gr (rtx *operands)
that way. */
static void
-arm_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
+arm_setup_incoming_varargs (CUMULATIVE_ARGS *pcum,
enum machine_mode mode,
tree type,
int *pretend_size,
int second_time ATTRIBUTE_UNUSED)
{
- int nregs = cum->nregs;
- if (nregs & 1
- && ARM_DOUBLEWORD_ALIGN
- && arm_needs_doubleword_align (mode, type))
- nregs++;
-
+ int nregs;
+
cfun->machine->uses_anonymous_args = 1;
+ if (pcum->pcs_variant <= ARM_PCS_AAPCS_LOCAL)
+ {
+ nregs = pcum->aapcs_ncrn;
+ if ((nregs & 1) && arm_needs_doubleword_align (mode, type))
+ nregs++;
+ }
+ else
+ nregs = pcum->nregs;
+
if (nregs < NUM_ARG_REGS)
*pretend_size = (NUM_ARG_REGS - nregs) * UNITS_PER_WORD;
}
@@ -19094,6 +20077,19 @@ arm_promote_prototypes (const_tree t ATTRIBUTE_UNUSED)
return !TARGET_AAPCS_BASED;
}
+static enum machine_mode
+arm_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ if (GET_MODE_CLASS (mode) == MODE_INT
+ && GET_MODE_SIZE (mode) < 4)
+ return SImode;
+
+ return mode;
+}
/* AAPCS based ABIs use short enums by default. */
@@ -19344,9 +20340,10 @@ arm_vector_mode_supported_p (enum machine_mode mode)
|| mode == V16QImode || mode == V4SFmode || mode == V2DImode))
return true;
- if ((mode == V2SImode)
- || (mode == V4HImode)
- || (mode == V8QImode))
+ if ((TARGET_NEON || TARGET_IWMMXT)
+ && ((mode == V2SImode)
+ || (mode == V4HImode)
+ || (mode == V8QImode)))
return true;
return false;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 58ced2e7e51..59d35dd6833 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -501,11 +501,6 @@ extern int arm_arch_hwdiv;
(MODE) = SImode; \
}
-#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < 4) \
- (MODE) = SImode;
-
/* Define this if most significant bit is lowest numbered
in instructions that operate on numbered bit-fields. */
#define BITS_BIG_ENDIAN 0
@@ -898,6 +893,9 @@ extern int arm_structure_size_boundary;
/* The number of (integer) argument register available. */
#define NUM_ARG_REGS 4
+/* And similarly for the VFP. */
+#define NUM_VFP_ARG_REGS 16
+
/* Return the register number of the N'th (integer) argument. */
#define ARG_REGISTER(N) (N - 1)
@@ -1507,9 +1505,10 @@ do { \
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
-#define LIBCALL_VALUE(MODE) \
- (TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
- && GET_MODE_CLASS (MODE) == MODE_FLOAT \
+#define LIBCALL_VALUE(MODE) \
+ (TARGET_AAPCS_BASED ? aapcs_libcall_value (MODE) \
+ : (TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
+ && GET_MODE_CLASS (MODE) == MODE_FLOAT) \
? gen_rtx_REG (MODE, FIRST_FPA_REGNUM) \
: TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK \
&& GET_MODE_CLASS (MODE) == MODE_FLOAT \
@@ -1518,22 +1517,16 @@ do { \
? gen_rtx_REG (MODE, FIRST_IWMMXT_REGNUM) \
: gen_rtx_REG (MODE, ARG_REGISTER (1)))
-/* Define how to find the value returned by a function.
- VALTYPE is the data type of the value (as a tree).
- If the precise function being called is known, FUNC is its FUNCTION_DECL;
- otherwise, FUNC is 0. */
-#define FUNCTION_VALUE(VALTYPE, FUNC) \
- arm_function_value (VALTYPE, FUNC);
-
-/* 1 if N is a possible register number for a function value.
- On the ARM, only r0 and f0 can return results. */
-/* On a Cirrus chip, mvf0 can return results. */
-#define FUNCTION_VALUE_REGNO_P(REGNO) \
- ((REGNO) == ARG_REGISTER (1) \
- || (TARGET_32BIT && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
- && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
- || ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
- || (TARGET_32BIT && ((REGNO) == FIRST_FPA_REGNUM) \
+/* 1 if REGNO is a possible register number for a function value. */
+#define FUNCTION_VALUE_REGNO_P(REGNO) \
+ ((REGNO) == ARG_REGISTER (1) \
+ || (TARGET_AAPCS_BASED && TARGET_32BIT \
+ && TARGET_VFP && TARGET_HARD_FLOAT \
+ && (REGNO) == FIRST_VFP_REGNUM) \
+ || (TARGET_32BIT && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
+ && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
+ || ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
+ || (TARGET_32BIT && ((REGNO) == FIRST_FPA_REGNUM) \
&& TARGET_HARD_FLOAT_ABI && TARGET_FPA))
/* Amount of memory needed for an untyped call to save all possible return
@@ -1636,9 +1629,27 @@ machine_function;
that is in text_section. */
extern GTY(()) rtx thumb_call_via_label[14];
+/* The number of potential ways of assigning to a co-processor. */
+#define ARM_NUM_COPROC_SLOTS 1
+
+/* Enumeration of procedure calling standard variants. We don't really
+ support all of these yet. */
+enum arm_pcs
+{
+ ARM_PCS_AAPCS, /* Base standard AAPCS. */
+ ARM_PCS_AAPCS_VFP, /* Use VFP registers for floating point values. */
+ ARM_PCS_AAPCS_IWMMXT, /* Use iWMMXT registers for vectors. */
+ /* This must be the last AAPCS variant. */
+ ARM_PCS_AAPCS_LOCAL, /* Private call within this compilation unit. */
+ ARM_PCS_ATPCS, /* ATPCS. */
+ ARM_PCS_APCS, /* APCS (legacy Linux etc). */
+ ARM_PCS_UNKNOWN
+};
+
+/* We can't define this inside a generator file because it needs enum
+ machine_mode. */
/* A C type for declaring a variable that is used as the first argument of
- `FUNCTION_ARG' and other related values. For some target machines, the
- type `int' suffices and can hold the number of bytes of argument so far. */
+ `FUNCTION_ARG' and other related values. */
typedef struct
{
/* This is the number of registers of arguments scanned so far. */
@@ -1647,9 +1658,33 @@ typedef struct
int iwmmxt_nregs;
int named_count;
int nargs;
- int can_split;
+ /* Which procedure call variant to use for this call. */
+ enum arm_pcs pcs_variant;
+
+ /* AAPCS related state tracking. */
+ int aapcs_arg_processed; /* No need to lay out this argument again. */
+ int aapcs_cprc_slot; /* Index of co-processor rules to handle
+ this argument, or -1 if using core
+ registers. */
+ int aapcs_ncrn;
+ int aapcs_next_ncrn;
+ rtx aapcs_reg; /* Register assigned to this argument. */
+ int aapcs_partial; /* How many bytes are passed in regs (if
+ split between core regs and stack.
+ Zero otherwise. */
+ int aapcs_cprc_failed[ARM_NUM_COPROC_SLOTS];
+ int can_split; /* Argument can be split between core regs
+ and the stack. */
+ /* Private data for tracking VFP register allocation */
+ unsigned aapcs_vfp_regs_free;
+ unsigned aapcs_vfp_reg_alloc;
+ int aapcs_vfp_rcount;
+ /* Can't include insn-modes.h because this header is needed before we
+ generate it. */
+ int /* enum machine_mode */ aapcs_vfp_rmode;
} CUMULATIVE_ARGS;
+
/* Define where to put the arguments to a function.
Value is zero to push the argument on the stack,
or a hard register in which to store the argument.
@@ -1693,13 +1728,7 @@ typedef struct
of mode MODE and data type TYPE.
(TYPE is null for libcalls where that information may not be available.) */
#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \
- (CUM).nargs += 1; \
- if (arm_vector_mode_supported_p (MODE) \
- && (CUM).named_count > (CUM).nargs \
- && TARGET_IWMMXT_ABI) \
- (CUM).iwmmxt_nregs += 1; \
- else \
- (CUM).nregs += ARM_NUM_REGS2 (MODE, TYPE)
+ arm_function_arg_advance (&(CUM), (MODE), (TYPE), (NAMED))
/* If defined, a C expression that gives the alignment boundary, in bits, of an
argument with the specified mode and type. If it is not defined,
@@ -1711,9 +1740,11 @@ typedef struct
/* 1 if N is a possible register number for function argument passing.
On the ARM, r0-r3 are used to pass args. */
-#define FUNCTION_ARG_REGNO_P(REGNO) \
- (IN_RANGE ((REGNO), 0, 3) \
- || (TARGET_IWMMXT_ABI \
+#define FUNCTION_ARG_REGNO_P(REGNO) \
+ (IN_RANGE ((REGNO), 0, 3) \
+ || (TARGET_AAPCS_BASED && TARGET_VFP && TARGET_HARD_FLOAT \
+ && IN_RANGE ((REGNO), FIRST_VFP_REGNUM, FIRST_VFP_REGNUM + 15)) \
+ || (TARGET_IWMMXT_ABI \
&& IN_RANGE ((REGNO), FIRST_IWMMXT_REGNUM, FIRST_IWMMXT_REGNUM + 9)))
diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h
index 4d2974e32da..bc0c62f401e 100644
--- a/gcc/config/arm/bpabi.h
+++ b/gcc/config/arm/bpabi.h
@@ -90,16 +90,22 @@
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (muldi3, lmul)
#endif
#ifdef L_fixdfdi
-#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz)
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixdfdi, d2lz) \
+ extern DWtype __fixdfdi (DFtype) __attribute__((pcs("aapcs"))); \
+ extern UDWtype __fixunsdfdi (DFtype) __asm__("__aeabi_d2ulz") __attribute__((pcs("aapcs")));
#endif
#ifdef L_fixunsdfdi
-#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz)
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunsdfdi, d2ulz) \
+ extern UDWtype __fixunsdfdi (DFtype) __attribute__((pcs("aapcs")));
#endif
#ifdef L_fixsfdi
-#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz)
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixsfdi, f2lz) \
+ extern DWtype __fixsfdi (SFtype) __attribute__((pcs("aapcs"))); \
+ extern UDWtype __fixunssfdi (SFtype) __asm__("__aeabi_f2ulz") __attribute__((pcs("aapcs")));
#endif
#ifdef L_fixunssfdi
-#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz)
+#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (fixunssfdi, f2ulz) \
+ extern UDWtype __fixunssfdi (SFtype) __attribute__((pcs("aapcs")));
#endif
#ifdef L_floatdidf
#define DECLARE_LIBRARY_RENAMES RENAME_LIBRARY (floatdidf, l2d)
diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
index 03446f8d03b..9f7cc63e469 100644
--- a/gcc/config/arm/lib1funcs.asm
+++ b/gcc/config/arm/lib1funcs.asm
@@ -446,6 +446,27 @@ pc .req r15
#if __ARM_ARCH__ >= 5 && ! defined (__OPTIMIZE_SIZE__)
+#if defined (__thumb2__)
+ clz \curbit, \dividend
+ clz \result, \divisor
+ sub \curbit, \result, \curbit
+ rsb \curbit, \curbit, #31
+ adr \result, 1f
+ add \curbit, \result, \curbit, lsl #4
+ mov \result, #0
+ mov pc, \curbit
+.p2align 3
+1:
+ .set shift, 32
+ .rept 32
+ .set shift, shift - 1
+ cmp.w \dividend, \divisor, lsl #shift
+ nop.n
+ adc.w \result, \result, \result
+ it cs
+ subcs.w \dividend, \dividend, \divisor, lsl #shift
+ .endr
+#else
clz \curbit, \dividend
clz \result, \divisor
sub \curbit, \result, \curbit
@@ -461,6 +482,7 @@ pc .req r15
adc \result, \result, \result
subcs \dividend, \dividend, \divisor, lsl #shift
.endr
+#endif
#else /* __ARM_ARCH__ < 5 || defined (__OPTIMIZE_SIZE__) */
#if __ARM_ARCH__ >= 5
@@ -508,18 +530,23 @@ pc .req r15
@ Division loop
1: cmp \dividend, \divisor
+ do_it hs, t
subhs \dividend, \dividend, \divisor
orrhs \result, \result, \curbit
cmp \dividend, \divisor, lsr #1
+ do_it hs, t
subhs \dividend, \dividend, \divisor, lsr #1
orrhs \result, \result, \curbit, lsr #1
cmp \dividend, \divisor, lsr #2
+ do_it hs, t
subhs \dividend, \dividend, \divisor, lsr #2
orrhs \result, \result, \curbit, lsr #2
cmp \dividend, \divisor, lsr #3
+ do_it hs, t
subhs \dividend, \dividend, \divisor, lsr #3
orrhs \result, \result, \curbit, lsr #3
cmp \dividend, #0 @ Early termination?
+ do_it hs, t
movnes \curbit, \curbit, lsr #4 @ No, any more bits to do?
movne \divisor, \divisor, lsr #4
bne 1b
@@ -808,11 +835,11 @@ LSYM(Lgot_result):
/* ------------------------------------------------------------------------ */
#ifdef L_udivsi3
+#if defined(__ARM_ARCH_6M__)
+
FUNC_START udivsi3
FUNC_ALIAS aeabi_uidiv udivsi3
-#ifdef __thumb__
-
cmp divisor, #0
beq LSYM(Ldiv0)
mov curbit, #1
@@ -828,9 +855,13 @@ LSYM(Lgot_result):
pop { work }
RET
-#else /* ARM version. */
+#else /* ARM version/Thumb-2. */
+
+ ARM_FUNC_START udivsi3
+ ARM_FUNC_ALIAS aeabi_uidiv udivsi3
subs r2, r1, #1
+ do_it eq
RETc(eq)
bcc LSYM(Ldiv0)
cmp r0, r1
@@ -843,7 +874,8 @@ LSYM(Lgot_result):
mov r0, r2
RET
-11: moveq r0, #1
+11: do_it eq, e
+ moveq r0, #1
movne r0, #0
RET
@@ -856,8 +888,8 @@ LSYM(Lgot_result):
DIV_FUNC_END udivsi3
+#if defined(__ARM_ARCH_6M__)
FUNC_START aeabi_uidivmod
-#ifdef __thumb__
push {r0, r1, lr}
bl SYM(__udivsi3)
POP {r1, r2, r3}
@@ -865,6 +897,7 @@ FUNC_START aeabi_uidivmod
sub r1, r1, r2
bx r3
#else
+ARM_FUNC_START aeabi_uidivmod
stmfd sp!, { r0, r1, lr }
bl SYM(__udivsi3)
ldmfd sp!, { r1, r2, lr }
@@ -919,10 +952,11 @@ LSYM(Lover10):
/* ------------------------------------------------------------------------ */
#ifdef L_divsi3
+#if defined(__ARM_ARCH_6M__)
+
FUNC_START divsi3
FUNC_ALIAS aeabi_idiv divsi3
-#ifdef __thumb__
cmp divisor, #0
beq LSYM(Ldiv0)
@@ -954,15 +988,20 @@ LSYM(Lover12):
pop { work }
RET
-#else /* ARM version. */
+#else /* ARM/Thumb-2 version. */
+ ARM_FUNC_START divsi3
+ ARM_FUNC_ALIAS aeabi_idiv divsi3
+
cmp r1, #0
eor ip, r0, r1 @ save the sign of the result.
beq LSYM(Ldiv0)
+ do_it mi
rsbmi r1, r1, #0 @ loops below use unsigned.
subs r2, r1, #1 @ division by 1 or -1 ?
beq 10f
movs r3, r0
+ do_it mi
rsbmi r3, r0, #0 @ positive dividend value
cmp r3, r1
bls 11f
@@ -972,14 +1011,18 @@ LSYM(Lover12):
ARM_DIV_BODY r3, r1, r0, r2
cmp ip, #0
+ do_it mi
rsbmi r0, r0, #0
RET
10: teq ip, r0 @ same sign ?
+ do_it mi
rsbmi r0, r0, #0
RET
-11: movlo r0, #0
+11: do_it lo
+ movlo r0, #0
+ do_it eq,t
moveq r0, ip, asr #31
orreq r0, r0, #1
RET
@@ -988,6 +1031,7 @@ LSYM(Lover12):
cmp ip, #0
mov r0, r3, lsr r2
+ do_it mi
rsbmi r0, r0, #0
RET
@@ -995,8 +1039,8 @@ LSYM(Lover12):
DIV_FUNC_END divsi3
+#if defined(__ARM_ARCH_6M__)
FUNC_START aeabi_idivmod
-#ifdef __thumb__
push {r0, r1, lr}
bl SYM(__divsi3)
POP {r1, r2, r3}
@@ -1004,6 +1048,7 @@ FUNC_START aeabi_idivmod
sub r1, r1, r2
bx r3
#else
+ARM_FUNC_START aeabi_idivmod
stmfd sp!, { r0, r1, lr }
bl SYM(__divsi3)
ldmfd sp!, { r1, r2, lr }
diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf
index 6a90d331148..8be87c8d947 100644
--- a/gcc/config/arm/t-arm-elf
+++ b/gcc/config/arm/t-arm-elf
@@ -46,6 +46,13 @@ MULTILIB_MATCHES =
#MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
#MULTILIB_MATCHES += march?armv7=mcpu?cortex-m3
+# Not quite true. We can support hard-vfp calling in Thumb2, but how do we
+# express that here? Also, we really need architecture v5e or later
+# (mcrr etc).
+MULTILIB_OPTIONS += mfloat-abi=hard
+MULTILIB_DIRNAMES += fpu
+MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
+
# MULTILIB_OPTIONS += mcpu=ep9312
# MULTILIB_DIRNAMES += ep9312
# MULTILIB_EXCEPTIONS += *mthumb/*mcpu=ep9312*
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index e715e39fe38..d08d89fb697 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -213,8 +213,9 @@ avr_override_options (void)
fprintf (stderr," %s\n", t->name);
}
- avr_current_arch = &avr_arch_types[t->arch];
- avr_extra_arch_macro = t->macro;
+ avr_current_device = t;
+ avr_current_arch = &avr_arch_types[avr_current_device->arch];
+ avr_extra_arch_macro = avr_current_device->macro;
tmp_reg_rtx = gen_rtx_REG (QImode, TMP_REGNO);
zero_reg_rtx = gen_rtx_REG (QImode, ZERO_REGNO);
@@ -265,6 +266,12 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
{
cpp_define (pfile, "__AVR_2_BYTE_PC__");
}
+
+ if (avr_current_device->short_sp)
+ cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
+ else
+ cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
+
if (TARGET_NO_INTERRUPTS)
cpp_define (pfile, "__NO_INTERRUPTS__");
}
@@ -672,7 +679,7 @@ expand_prologue (void)
rtx fp_plus_insns;
rtx sp_plus_insns = NULL_RTX;
- if (TARGET_TINY_STACK)
+ if (AVR_HAVE_8BIT_SP)
{
/* The high byte (r29) doesn't change - prefer 'subi' (1 cycle)
over 'sbiw' (2 cycles, same size). */
@@ -698,7 +705,7 @@ expand_prologue (void)
RTX_FRAME_RELATED_P (insn) = 1;
/* Copy to stack pointer. */
- if (TARGET_TINY_STACK)
+ if (AVR_HAVE_8BIT_SP)
{
insn = emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
@@ -852,7 +859,7 @@ expand_epilogue (void)
rtx fp_plus_insns;
rtx sp_plus_insns = NULL_RTX;
- if (TARGET_TINY_STACK)
+ if (AVR_HAVE_8BIT_SP)
{
/* The high byte (r29) doesn't change - prefer 'subi'
(1 cycle) over 'sbiw' (2 cycles, same size). */
@@ -868,12 +875,12 @@ expand_epilogue (void)
start_sequence ();
emit_move_insn (myfp,
- gen_rtx_PLUS (HImode, myfp,
+ gen_rtx_PLUS (GET_MODE (myfp), myfp,
gen_int_mode (size,
GET_MODE(myfp))));
/* Copy to stack pointer. */
- if (TARGET_TINY_STACK)
+ if (AVR_HAVE_8BIT_SP)
{
emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
}
@@ -1686,7 +1693,7 @@ output_movhi (rtx insn, rtx operands[], int *l)
{
if (test_hard_reg_class (STACK_REG, dest))
{
- if (TARGET_TINY_STACK)
+ if (AVR_HAVE_8BIT_SP)
return *l = 1, AS2 (out,__SP_L__,%A1);
/* Use simple load of stack pointer if no interrupts are
used. */
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 73752467e08..7100ad17fe8 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -114,6 +114,7 @@ extern GTY(()) section *progmem_section;
#define AVR_HAVE_LPMX (avr_current_arch->have_movw_lpmx)
#define AVR_HAVE_RAMPZ (avr_current_arch->have_elpm)
#define AVR_HAVE_EIJMP_EICALL (avr_current_arch->have_eijmp_eicall)
+#define AVR_HAVE_8BIT_SP (avr_current_device->short_sp || TARGET_TINY_STACK)
#define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
#define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 4f213062a4f..13887480d1f 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -6296,12 +6296,8 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED,
#undef TARGET_SCHED_ISSUE_RATE
#define TARGET_SCHED_ISSUE_RATE bfin_issue_rate
-#undef TARGET_PROMOTE_PROTOTYPES
-#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES bfin_arg_partial_bytes
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 66fc05d0f6e..6b3fd0fcfca 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -85,6 +85,9 @@ static int in_code = 0;
/* Fix for reg_overlap_mentioned_p. */
static int cris_reg_overlap_mentioned_p (rtx, rtx);
+static enum machine_mode cris_promote_function_mode (const_tree, enum machine_mode,
+ int *, const_tree, int);
+
static void cris_print_base (rtx, FILE *);
static void cris_print_index (rtx, FILE *);
@@ -166,8 +169,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST cris_address_cost
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE cris_promote_function_mode
+
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX cris_struct_value_rtx
#undef TARGET_SETUP_INCOMING_VARARGS
@@ -3753,6 +3757,25 @@ cris_pass_by_reference (CUMULATIVE_ARGS *ca ATTRIBUTE_UNUSED,
|| CRIS_FUNCTION_ARG_SIZE (mode, type) > 8);
}
+/* A combination of defining TARGET_PROMOTE_FUNCTION_MODE, promoting arguments
+ and *not* defining TARGET_PROMOTE_PROTOTYPES or PROMOTE_MODE gives the
+ best code size and speed for gcc, ipps and products in gcc-2.7.2. */
+
+enum machine_mode
+cris_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return)
+{
+ /* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovered bug 981110 (even
+ when modifying FUNCTION_VALUE to return the promoted mode). Maybe
+ pointless as of now, but let's keep the old behavior. */
+ if (for_return == 1)
+ return mode;
+ return CRIS_PROMOTED_MODE (mode, *punsignedp, type);
+}
+
static int
cris_arg_partial_bytes (CUMULATIVE_ARGS *ca, enum machine_mode mode,
diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h
index 920e354417e..39291079662 100644
--- a/gcc/config/cris/cris.h
+++ b/gcc/config/cris/cris.h
@@ -352,24 +352,10 @@ extern int target_flags;
#define UNITS_PER_WORD 4
-/* A combination of defining PROMOTE_FUNCTION_MODE,
- TARGET_PROMOTE_FUNCTION_ARGS that always returns true
- and *not* defining TARGET_PROMOTE_PROTOTYPES or PROMOTE_MODE gives the
- best code size and speed for gcc, ipps and products in gcc-2.7.2. */
#define CRIS_PROMOTED_MODE(MODE, UNSIGNEDP, TYPE) \
(GET_MODE_CLASS (MODE) == MODE_INT && GET_MODE_SIZE (MODE) < 4) \
? SImode : MODE
-#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
- (MODE) = CRIS_PROMOTED_MODE (MODE, UNSIGNEDP, TYPE)
-
-/* Defining PROMOTE_FUNCTION_RETURN in gcc-2.7.2 uncovers bug 981110 (even
- if defining FUNCTION_VALUE with MODE as PROMOTED_MODE ;-)
-
- FIXME: Report this when cris.h is part of GCC, so others can easily
- see the problem. Maybe check other systems that define
- TARGET_PROMOTE_FUNCTION_RETURN that always returns true. */
-
/* We will be using prototype promotion, so they will be 32 bit. */
#define PARM_BOUNDARY 32
diff --git a/gcc/config/elfos.h b/gcc/config/elfos.h
index 2d818d145d5..56d7b408e5d 100644
--- a/gcc/config/elfos.h
+++ b/gcc/config/elfos.h
@@ -289,24 +289,37 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Write the extra assembler code needed to declare an object properly. */
-#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
- do \
- { \
- HOST_WIDE_INT size; \
- \
- ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
- \
- size_directive_output = 0; \
- if (!flag_inhibit_size_directive \
- && (DECL) && DECL_SIZE (DECL)) \
- { \
- size_directive_output = 1; \
- size = int_size_in_bytes (TREE_TYPE (DECL)); \
- ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
- } \
- \
- ASM_OUTPUT_LABEL (FILE, NAME); \
- } \
+#ifdef HAVE_GAS_GNU_UNIQUE_OBJECT
+#define USE_GNU_UNIQUE_OBJECT 1
+#else
+#define USE_GNU_UNIQUE_OBJECT 0
+#endif
+
+#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \
+ do \
+ { \
+ HOST_WIDE_INT size; \
+ \
+ /* For template static data member instantiations or \
+ inline fn local statics, use gnu_unique_object so that \
+ they will be combined even under RTLD_LOCAL. */ \
+ if (USE_GNU_UNIQUE_OBJECT \
+ && !DECL_ARTIFICIAL (DECL) && DECL_ONE_ONLY (DECL)) \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "gnu_unique_object"); \
+ else \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
+ \
+ size_directive_output = 0; \
+ if (!flag_inhibit_size_directive \
+ && (DECL) && DECL_SIZE (DECL)) \
+ { \
+ size_directive_output = 1; \
+ size = int_size_in_bytes (TREE_TYPE (DECL)); \
+ ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \
+ } \
+ \
+ ASM_OUTPUT_LABEL (FILE, NAME); \
+ } \
while (0)
/* Output the size directive for a decl in rest_of_decl_compilation
diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h
index 483ed77e9f7..dfb3fb8eeb1 100644
--- a/gcc/config/frv/frv.h
+++ b/gcc/config/frv/frv.h
@@ -1764,10 +1764,6 @@ typedef struct frv_stack {
(Actually, on most machines, scalar values are returned in the same place
regardless of mode).
- If `TARGET_PROMOTE_FUNCTION_RETURN' is defined to return true, you
- must apply the same promotion rules specified in `PROMOTE_MODE' if
- VALTYPE is a scalar type.
-
If the precise function being called is known, FUNC is a tree node
(`FUNCTION_DECL') for it; otherwise, FUNC is a null pointer. This makes it
possible to use a different value-returning convention for specific
diff --git a/gcc/config/i386/att.h b/gcc/config/i386/att.h
index 6586ddd3d87..30616904fe2 100644
--- a/gcc/config/i386/att.h
+++ b/gcc/config/i386/att.h
@@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Assembler pseudos to introduce constants of various size. */
+#define ASM_BYTE "\t.byte\t"
#define ASM_SHORT "\t.value\t"
#define ASM_LONG "\t.long\t"
#define ASM_QUAD "\t.quad\t" /* Should not be used for 32bit compilation. */
@@ -43,7 +44,7 @@ do \
{ size_t i = 0, limit = (SIZE); \
while (i < limit) \
{ if (i%10 == 0) { if (i!=0) putc ('\n', (FILE)); \
- fputs ("\t.byte\t", (FILE)); } \
+ fputs (ASM_BYTE, (FILE)); } \
else putc (',', (FILE)); \
fprintf ((FILE), "0x%x", ((PTR)[i++] & 0377)) ;} \
putc ('\n', (FILE)); \
diff --git a/gcc/config/i386/bsd.h b/gcc/config/i386/bsd.h
index 229777a4640..e408ccdb032 100644
--- a/gcc/config/i386/bsd.h
+++ b/gcc/config/i386/bsd.h
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
/* Assembler pseudos to introduce constants of various size. */
+#define ASM_BYTE "\t.byte\t"
#define ASM_SHORT "\t.word\t"
#define ASM_LONG "\t.long\t"
#define ASM_QUAD "\t.quad\t" /* Should not be used for 32bit compilation. */
diff --git a/gcc/config/i386/cygwin.h b/gcc/config/i386/cygwin.h
index 02d059f7628..d1d00f7a79b 100644
--- a/gcc/config/i386/cygwin.h
+++ b/gcc/config/i386/cygwin.h
@@ -91,7 +91,7 @@ along with GCC; see the file COPYING3. If not see
%{shared: %{mdll: %eshared and mdll are not compatible}} \
%{shared: --shared} %{mdll:--dll} \
%{static:-Bstatic} %{!static:-Bdynamic} \
- %{shared|mdll: -e \
+ %{shared|mdll: --enable-auto-image-base -e \
%{mno-cygwin:_DllMainCRTStartup@12} \
%{!mno-cygwin:__cygwin_dll_entry@12}}\
%{!mno-cygwin:--dll-search-prefix=cyg}"
diff --git a/gcc/config/i386/darwin.h b/gcc/config/i386/darwin.h
index 039f52f77ba..eb9ee70a04d 100644
--- a/gcc/config/i386/darwin.h
+++ b/gcc/config/i386/darwin.h
@@ -189,7 +189,7 @@ extern void darwin_x86_file_end (void);
/* Assembler pseudos to introduce constants of various size. */
-#define ASM_BYTE_OP "\t.byte\t"
+#define ASM_BYTE "\t.byte\t"
#define ASM_SHORT "\t.word\t"
#define ASM_LONG "\t.long\t"
#define ASM_QUAD "\t.quad\t"
diff --git a/gcc/config/i386/djgpp-stdint.h b/gcc/config/i386/djgpp-stdint.h
new file mode 100644
index 00000000000..8fd3a25653d
--- /dev/null
+++ b/gcc/config/i386/djgpp-stdint.h
@@ -0,0 +1,62 @@
+/* Definitions for <stdint.h> types on systems using DJGPP.
+ Copyright (C) 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/>. */
+
+#define SIG_ATOMIC_TYPE "int"
+
+/* Exact-width integer types */
+
+#define INT8_TYPE "signed char"
+#define INT16_TYPE "signed short int"
+#define INT32_TYPE "signed long int"
+#define INT64_TYPE "signed long long int"
+
+#define UINT8_TYPE "unsigned char"
+#define UINT16_TYPE "short unsigned int"
+#define UINT32_TYPE "long unsigned int"
+#define UINT64_TYPE "long long unsigned int"
+
+/* Minimum-width integer types */
+
+#define INT_LEAST8_TYPE "signed char"
+#define INT_LEAST16_TYPE "signed short int"
+#define INT_LEAST32_TYPE "signed int"
+#define INT_LEAST64_TYPE "signed 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 long unsigned int"
+
+/* Fastest minimum-width integer types */
+
+#define INT_FAST8_TYPE "signed char"
+#define INT_FAST16_TYPE "signed int"
+#define INT_FAST32_TYPE "signed int"
+#define INT_FAST64_TYPE "long long signed int"
+
+#define UINT_FAST8_TYPE "unsigned char"
+#define UINT_FAST16_TYPE "unsigned int"
+#define UINT_FAST32_TYPE "unsigned int"
+#define UINT_FAST64_TYPE "long long unsigned int"
+
+/* Integer types capable of holding object pointers */
+
+#define INTPTR_TYPE "long int"
+#define UINTPTR_TYPE "long unsigned int"
+
diff --git a/gcc/config/i386/i386-interix.h b/gcc/config/i386/i386-interix.h
index 380b46c3d3c..060b82ca245 100644
--- a/gcc/config/i386/i386-interix.h
+++ b/gcc/config/i386/i386-interix.h
@@ -209,7 +209,7 @@ along with GCC; see the file COPYING3. If not see
else \
{ \
if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t.byte\t"); \
+ fputs (ASM_BYTE, (FILE)); \
else \
fputc (',', (FILE)); \
fprintf ((FILE), "0x%02x", *_ascii_bytes); \
@@ -217,7 +217,7 @@ along with GCC; see the file COPYING3. If not see
} \
} \
if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\n"); \
+ fputc ('\n', (FILE)); \
} \
while (0)
@@ -277,11 +277,11 @@ do { \
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
do \
{ \
- fprintf ((FILE), "%s", SET_ASM_OP); \
+ fputs (SET_ASM_OP, (FILE)); \
assemble_name (FILE, LABEL1); \
- fprintf (FILE, ","); \
+ fputc (',', (FILE)); \
assemble_name (FILE, LABEL2); \
- fprintf (FILE, "\n"); \
+ fputc ('\n', (FILE)); \
} \
while (0)
@@ -359,4 +359,4 @@ extern void i386_pe_unique_section (tree, int);
#define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
(TYPE_MODE (TYPE) == BLKmode \
- || (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes (TYPE) > 8 )) \ No newline at end of file
+ || (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes (TYPE) > 8 ))
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 800cb6e3f70..36bd9bee335 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -7357,28 +7357,8 @@ standard_80387_constant_rtx (int idx)
XFmode);
}
-/* Return 1 if mode is a valid mode for sse. */
-static int
-standard_sse_mode_p (enum machine_mode mode)
-{
- switch (mode)
- {
- case V16QImode:
- case V8HImode:
- case V4SImode:
- case V2DImode:
- case V4SFmode:
- case V2DFmode:
- return 1;
-
- default:
- return 0;
- }
-}
-
-/* Return 1 if X is all 0s. For all 1s, return 2 if X is in 128bit
- SSE modes and SSE2 is enabled, return 3 if X is in 256bit AVX
- modes and AVX is enabled. */
+/* Return 1 if X is all 0s and 2 if x is all 1s
+ in supported SSE vector mode. */
int
standard_sse_constant_p (rtx x)
@@ -7388,12 +7368,17 @@ standard_sse_constant_p (rtx x)
if (x == const0_rtx || x == CONST0_RTX (GET_MODE (x)))
return 1;
if (vector_all_ones_operand (x, mode))
- {
- if (standard_sse_mode_p (mode))
- return TARGET_SSE2 ? 2 : -2;
- else if (VALID_AVX256_REG_MODE (mode))
- return TARGET_AVX ? 3 : -3;
- }
+ switch (mode)
+ {
+ case V16QImode:
+ case V8HImode:
+ case V4SImode:
+ case V2DImode:
+ if (TARGET_SSE2)
+ return 2;
+ default:
+ break;
+ }
return 0;
}
@@ -7422,22 +7407,12 @@ standard_sse_constant_opcode (rtx insn, rtx x)
case MODE_OI:
return "vpxor\t%x0, %x0, %x0";
default:
- gcc_unreachable ();
+ break;
}
case 2:
- if (TARGET_AVX)
- switch (get_attr_mode (insn))
- {
- case MODE_V4SF:
- case MODE_V2DF:
- case MODE_TI:
- return "vpcmpeqd\t%0, %0, %0";
- break;
- default:
- gcc_unreachable ();
- }
- else
- return "pcmpeqd\t%0, %0";
+ return TARGET_AVX ? "vpcmpeqd\t%0, %0, %0" : "pcmpeqd\t%0, %0";
+ default:
+ break;
}
gcc_unreachable ();
}
@@ -12910,7 +12885,7 @@ ix86_expand_vector_move (enum machine_mode mode, rtx operands[])
&& (CONSTANT_P (op1)
|| (GET_CODE (op1) == SUBREG
&& CONSTANT_P (SUBREG_REG (op1))))
- && standard_sse_constant_p (op1) <= 0)
+ && !standard_sse_constant_p (op1))
op1 = validize_mem (force_const_mem (mode, op1));
/* We need to check memory alignment for SSE mode since attribute
@@ -14621,7 +14596,7 @@ ix86_fp_comparison_strategy (enum rtx_code code ATTRIBUTE_UNUSED)
if (TARGET_CMOVE)
return IX86_FPCMP_COMI;
- if (TARGET_SAHF && (TARGET_USE_SAHF || optimize_insn_for_size_p ()))
+ if (TARGET_SAHF && (TARGET_USE_SAHF || optimize_function_for_size_p (cfun)))
return IX86_FPCMP_SAHF;
return IX86_FPCMP_ARITH;
@@ -14816,13 +14791,13 @@ ix86_expand_fp_compare (enum rtx_code code, rtx op0, rtx op1, rtx scratch)
if (code == LT && TARGET_IEEE_FP)
{
emit_insn (gen_andqi_ext_0 (scratch, scratch, GEN_INT (0x45)));
- emit_insn (gen_cmpqi_ext_3 (scratch, GEN_INT (0x01)));
+ emit_insn (gen_cmpqi_ext_3 (scratch, const1_rtx));
intcmp_mode = CCmode;
code = EQ;
}
else
{
- emit_insn (gen_testqi_ext_ccno_0 (scratch, GEN_INT (0x01)));
+ emit_insn (gen_testqi_ext_ccno_0 (scratch, const1_rtx));
code = NE;
}
break;
@@ -14836,8 +14811,7 @@ ix86_expand_fp_compare (enum rtx_code code, rtx op0, rtx op1, rtx scratch)
else
{
emit_insn (gen_andqi_ext_0 (scratch, scratch, GEN_INT (0x45)));
- emit_insn (gen_xorqi_cc_ext_1 (scratch, scratch,
- GEN_INT (0x01)));
+ emit_insn (gen_xorqi_cc_ext_1 (scratch, scratch, const1_rtx));
code = NE;
}
break;
@@ -14870,7 +14844,6 @@ ix86_expand_fp_compare (enum rtx_code code, rtx op0, rtx op1, rtx scratch)
{
emit_insn (gen_testqi_ext_ccno_0 (scratch, GEN_INT (0x40)));
code = NE;
- break;
}
break;
case NE:
@@ -16768,10 +16741,20 @@ ix86_split_long_move (rtx operands[])
/* When emitting push, take care for source operands on the stack. */
if (push && MEM_P (operands[1])
&& reg_overlap_mentioned_p (stack_pointer_rtx, operands[1]))
- for (i = 0; i < nparts - 1; i++)
- part[1][i] = change_address (part[1][i],
- GET_MODE (part[1][i]),
- XEXP (part[1][i + 1], 0));
+ {
+ rtx src_base = XEXP (part[1][nparts - 1], 0);
+
+ /* Compensate for the stack decrement by 4. */
+ if (!TARGET_64BIT && nparts == 3
+ && mode == XFmode && TARGET_128BIT_LONG_DOUBLE)
+ src_base = plus_constant (src_base, 4);
+
+ /* src_base refers to the stack pointer and is
+ automatically decreased by emitted push. */
+ for (i = 0; i < nparts; i++)
+ part[1][i] = change_address (part[1][i],
+ GET_MODE (part[1][i]), src_base);
+ }
/* We need to do copy in the right order in case an address register
of the source overlaps the destination. */
@@ -16841,7 +16824,8 @@ ix86_split_long_move (rtx operands[])
if (nparts == 3)
{
if (TARGET_128BIT_LONG_DOUBLE && mode == XFmode)
- emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-4)));
+ emit_insn (gen_addsi3 (stack_pointer_rtx,
+ stack_pointer_rtx, GEN_INT (-4)));
emit_move_insn (part[0][2], part[1][2]);
}
else if (nparts == 4)
@@ -17030,14 +17014,15 @@ ix86_split_ashl (rtx *operands, rtx scratch, enum machine_mode mode)
emit_insn ((mode == DImode
? gen_lshrsi3
- : gen_lshrdi3) (high[0], high[0], GEN_INT (mode == DImode ? 5 : 6)));
+ : gen_lshrdi3) (high[0], high[0],
+ GEN_INT (mode == DImode ? 5 : 6)));
emit_insn ((mode == DImode
? gen_andsi3
- : gen_anddi3) (high[0], high[0], GEN_INT (1)));
+ : gen_anddi3) (high[0], high[0], const1_rtx));
emit_move_insn (low[0], high[0]);
emit_insn ((mode == DImode
? gen_xorsi3
- : gen_xordi3) (low[0], low[0], GEN_INT (1)));
+ : gen_xordi3) (low[0], low[0], const1_rtx));
}
emit_insn ((mode == DImode
@@ -28107,7 +28092,7 @@ ix86_expand_vector_init_one_nonzero (bool mmx_ok, enum machine_mode mode,
if (mode != V4SFmode && TARGET_SSE2)
{
emit_insn (gen_sse2_pshufd_1 (new_target, new_target,
- GEN_INT (1),
+ const1_rtx,
GEN_INT (one_var == 1 ? 0 : 1),
GEN_INT (one_var == 2 ? 0 : 1),
GEN_INT (one_var == 3 ? 0 : 1)));
@@ -28127,7 +28112,7 @@ ix86_expand_vector_init_one_nonzero (bool mmx_ok, enum machine_mode mode,
tmp = new_target;
emit_insn (gen_sse_shufps_v4sf (tmp, tmp, tmp,
- GEN_INT (1),
+ const1_rtx,
GEN_INT (one_var == 1 ? 0 : 1),
GEN_INT (one_var == 2 ? 0+4 : 1+4),
GEN_INT (one_var == 3 ? 0+4 : 1+4)));
@@ -28790,8 +28775,8 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
ix86_expand_vector_set (false, target, val, 0);
/* target = A X C D */
emit_insn (gen_sse_shufps_v4sf (target, target, tmp,
- GEN_INT (1), GEN_INT (0),
- GEN_INT (2+4), GEN_INT (3+4)));
+ const1_rtx, const0_rtx,
+ GEN_INT (2+4), GEN_INT (3+4)));
return;
case 2:
@@ -28801,8 +28786,8 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
ix86_expand_vector_set (false, tmp, val, 0);
/* target = A B X D */
emit_insn (gen_sse_shufps_v4sf (target, target, tmp,
- GEN_INT (0), GEN_INT (1),
- GEN_INT (0+4), GEN_INT (3+4)));
+ const0_rtx, const1_rtx,
+ GEN_INT (0+4), GEN_INT (3+4)));
return;
case 3:
@@ -28812,8 +28797,8 @@ ix86_expand_vector_set (bool mmx_ok, rtx target, rtx val, int elt)
ix86_expand_vector_set (false, tmp, val, 0);
/* target = A B X D */
emit_insn (gen_sse_shufps_v4sf (target, target, tmp,
- GEN_INT (0), GEN_INT (1),
- GEN_INT (2+4), GEN_INT (0+4)));
+ const0_rtx, const1_rtx,
+ GEN_INT (2+4), GEN_INT (0+4)));
return;
default:
@@ -29106,8 +29091,8 @@ ix86_expand_reduc_v4sf (rtx (*fn) (rtx, rtx, rtx), rtx dest, rtx in)
emit_insn (fn (tmp2, tmp1, in));
emit_insn (gen_sse_shufps_v4sf (tmp3, tmp2, tmp2,
- GEN_INT (1), GEN_INT (1),
- GEN_INT (1+4), GEN_INT (1+4)));
+ const1_rtx, const1_rtx,
+ GEN_INT (1+4), GEN_INT (1+4)));
emit_insn (fn (dest, tmp2, tmp3));
}
@@ -30493,6 +30478,9 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree)
#undef TARGET_ASM_CLOSE_PAREN
#define TARGET_ASM_CLOSE_PAREN ""
+#undef TARGET_ASM_BYTE_OP
+#define TARGET_ASM_BYTE_OP ASM_BYTE
+
#undef TARGET_ASM_ALIGNED_HI_OP
#define TARGET_ASM_ALIGNED_HI_OP ASM_SHORT
#undef TARGET_ASM_ALIGNED_SI_OP
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f50bcc19320..3d832f11249 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -1555,7 +1555,7 @@
#ifdef HAVE_AS_IX86_SAHF
return "sahf";
#else
- return ".byte\t0x9e";
+ return ASM_BYTE "0x9e";
#endif
}
[(set_attr "length" "1")
@@ -16473,7 +16473,7 @@
(unspec:DI [(match_operand:DI 1 "tls_symbolic_operand" "")]
UNSPEC_TLS_GD)]
"TARGET_64BIT"
- { return ".byte\t0x66\n\tlea{q}\t{%a1@TLSGD(%%rip), %%rdi|rdi, %a1@TLSGD[rip]}\n" ASM_SHORT "0x6666\n\trex64\n\tcall\t%P2"; }
+ { return ASM_BYTE "0x66\n\tlea{q}\t{%a1@TLSGD(%%rip), %%rdi|rdi, %a1@TLSGD[rip]}\n" ASM_SHORT "0x6666\n\trex64\n\tcall\t%P2"; }
[(set_attr "type" "multi")
(set_attr "length" "16")])
diff --git a/gcc/config/i386/i386elf.h b/gcc/config/i386/i386elf.h
index ba53749acc9..44cf6818f7c 100644
--- a/gcc/config/i386/i386elf.h
+++ b/gcc/config/i386/i386elf.h
@@ -63,7 +63,7 @@ along with GCC; see the file COPYING3. If not see
const unsigned char *limit = _ascii_bytes + (LENGTH); \
unsigned bytes_in_chunk = 0; \
for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
+ { \
const unsigned char *p; \
if (bytes_in_chunk >= 64) \
{ \
@@ -85,7 +85,7 @@ along with GCC; see the file COPYING3. If not see
else \
{ \
if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t.byte\t"); \
+ fputs (ASM_BYTE, (FILE)); \
else \
fputc (',', (FILE)); \
fprintf ((FILE), "0x%02x", *_ascii_bytes); \
@@ -93,7 +93,7 @@ along with GCC; see the file COPYING3. If not see
} \
} \
if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\n"); \
+ fputc ('\n', (FILE)); \
} \
while (0)
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 43ec67a9c10..7c60f015e83 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -64,6 +64,10 @@
(define_mode_iterator SSEMODE4S [V4SF V4SI])
(define_mode_iterator SSEMODE2D [V2DF V2DI])
+;; Modes handled by integer vcond pattern
+(define_mode_iterator SSEMODE124C8 [V16QI V8HI V4SI
+ (V2DI "TARGET_SSE4_2 || TARGET_SSE5")])
+
;; Mapping from float mode to required SSE level
(define_mode_attr sse [(SF "sse") (DF "sse2") (V4SF "sse") (V2DF "sse2")])
@@ -1520,10 +1524,9 @@
(match_operand:SSEMODEF2P 2 "general_operand" "")))]
"SSE_VEC_FLOAT_MODE_P (<MODE>mode)"
{
- if (ix86_expand_fp_vcond (operands))
- DONE;
- else
- FAIL;
+ bool ok = ix86_expand_fp_vcond (operands);
+ gcc_assert (ok);
+ DONE;
})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -6071,35 +6074,33 @@
(set_attr "mode" "TI")])
(define_expand "vcond<mode>"
- [(set (match_operand:SSEMODEI 0 "register_operand" "")
- (if_then_else:SSEMODEI
+ [(set (match_operand:SSEMODE124C8 0 "register_operand" "")
+ (if_then_else:SSEMODE124C8
(match_operator 3 ""
- [(match_operand:SSEMODEI 4 "nonimmediate_operand" "")
- (match_operand:SSEMODEI 5 "nonimmediate_operand" "")])
- (match_operand:SSEMODEI 1 "general_operand" "")
- (match_operand:SSEMODEI 2 "general_operand" "")))]
+ [(match_operand:SSEMODE124C8 4 "nonimmediate_operand" "")
+ (match_operand:SSEMODE124C8 5 "nonimmediate_operand" "")])
+ (match_operand:SSEMODE124C8 1 "general_operand" "")
+ (match_operand:SSEMODE124C8 2 "general_operand" "")))]
"TARGET_SSE2"
{
- if (ix86_expand_int_vcond (operands))
- DONE;
- else
- FAIL;
+ bool ok = ix86_expand_int_vcond (operands);
+ gcc_assert (ok);
+ DONE;
})
(define_expand "vcondu<mode>"
- [(set (match_operand:SSEMODEI 0 "register_operand" "")
- (if_then_else:SSEMODEI
+ [(set (match_operand:SSEMODE124C8 0 "register_operand" "")
+ (if_then_else:SSEMODE124C8
(match_operator 3 ""
- [(match_operand:SSEMODEI 4 "nonimmediate_operand" "")
- (match_operand:SSEMODEI 5 "nonimmediate_operand" "")])
- (match_operand:SSEMODEI 1 "general_operand" "")
- (match_operand:SSEMODEI 2 "general_operand" "")))]
+ [(match_operand:SSEMODE124C8 4 "nonimmediate_operand" "")
+ (match_operand:SSEMODE124C8 5 "nonimmediate_operand" "")])
+ (match_operand:SSEMODE124C8 1 "general_operand" "")
+ (match_operand:SSEMODE124C8 2 "general_operand" "")))]
"TARGET_SSE2"
{
- if (ix86_expand_int_vcond (operands))
- DONE;
- else
- FAIL;
+ bool ok = ix86_expand_int_vcond (operands);
+ gcc_assert (ok);
+ DONE;
})
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/gcc/config/i386/sysv4.h b/gcc/config/i386/sysv4.h
index bedac7a58b6..63c0cbc85a7 100644
--- a/gcc/config/i386/sysv4.h
+++ b/gcc/config/i386/sysv4.h
@@ -55,7 +55,7 @@ along with GCC; see the file COPYING3. If not see
const unsigned char *limit = _ascii_bytes + (LENGTH); \
unsigned bytes_in_chunk = 0; \
for (; _ascii_bytes < limit; _ascii_bytes++) \
- { \
+ { \
const unsigned char *p; \
if (bytes_in_chunk >= 64) \
{ \
@@ -77,7 +77,7 @@ along with GCC; see the file COPYING3. If not see
else \
{ \
if (bytes_in_chunk == 0) \
- fprintf ((FILE), "\t.byte\t"); \
+ fputs (ASM_BYTE, (FILE)); \
else \
fputc (',', (FILE)); \
fprintf ((FILE), "0x%02x", *_ascii_bytes); \
@@ -85,7 +85,7 @@ along with GCC; see the file COPYING3. If not see
} \
} \
if (bytes_in_chunk > 0) \
- fprintf ((FILE), "\n"); \
+ fputc ('\n', (FILE)); \
} \
while (0)
@@ -103,10 +103,10 @@ along with GCC; see the file COPYING3. If not see
do { \
if ((SIZE) == 4 && ((ENCODING) & 0x70) == DW_EH_PE_datarel) \
{ \
- fputs (ASM_LONG, FILE); \
- assemble_name (FILE, XSTR (ADDR, 0)); \
- fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), FILE); \
- goto DONE; \
+ fputs (ASM_LONG, (FILE)); \
+ assemble_name (FILE, XSTR (ADDR, 0)); \
+ fputs (((ENCODING) & DW_EH_PE_indirect ? "@GOT" : "@GOTOFF"), (FILE)); \
+ goto DONE; \
} \
} while (0)
diff --git a/gcc/config/ia64/fde-glibc.c b/gcc/config/ia64/fde-glibc.c
index 540beabe8a6..12760b96eda 100644
--- a/gcc/config/ia64/fde-glibc.c
+++ b/gcc/config/ia64/fde-glibc.c
@@ -145,7 +145,8 @@ _Unwind_IteratePhdrCallback (struct dl_phdr_info *info, size_t size, void *ptr)
struct unw_table_entry *
_Unwind_FindTableEntry (void *pc, unsigned long *segment_base,
- unsigned long *gp)
+ unsigned long *gp,
+ struct unw_table_entry *ent ATTRIBUTE_UNUSED)
{
struct unw_ia64_callback_data data;
diff --git a/gcc/config/ia64/fde-vms.c b/gcc/config/ia64/fde-vms.c
new file mode 100644
index 00000000000..b310f0d11b6
--- /dev/null
+++ b/gcc/config/ia64/fde-vms.c
@@ -0,0 +1,157 @@
+/* Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+ Contributed by Douglas B Rupp <rupp@gnat.com>
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ 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/>. */
+
+/* Locate the FDE entry for a given address, using VMS Starlet routines
+ to avoid register/deregister calls at DSO load/unload. */
+
+#include "tconfig.h"
+#include "tsystem.h"
+#include "coretypes.h"
+#include "tm.h"
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "unwind-ia64.h"
+
+#define __int64 long
+#include <vms/ossddef.h>
+#ifndef SS$_NORMAL
+#define SS$_NORMAL 1
+#endif
+
+typedef struct
+{
+ unsigned long start_offset;
+ unsigned long end_offset;
+ unsigned long info_offset;
+ unsigned long gp_value;
+} vms_unw_table_entry;
+
+typedef unsigned long long uqword;
+
+/* ENTRY is the unwind table entry found for a PC part of call chain we're
+ unwinding through. Return whether we should force the generic unwinder
+ to resort to "fallback" processing. */
+
+static int
+force_fallback_processing_for (void * pc, vms_unw_table_entry * entry)
+{
+ static int eh_debug = -1;
+
+ uqword * unw_info_block = (uqword *)entry->info_offset;
+ uqword header = *unw_info_block;
+
+ /* We need to force fallback processing in two cases:
+
+ 1/ The exception dispatch frame, since only our fallback
+ processing knows how to properly unwind through it, and
+
+ 2/ A bottom of stack frame, since only our fallback processing
+ will ensure we don't try to unwind further past it, which
+ would get us into unknown territory and likely cause a severe
+ crash along the way.
+
+ The two cases are indicated by non-default values for specific
+ bits in the OS Specific Data (OSSD) General Information block
+ associated with such frames. */
+
+ ossddef * ossd;
+
+ if (eh_debug == -1)
+ {
+ char * EH_DEBUG = getenv ("EH_DEBUG");
+ eh_debug = EH_DEBUG ? atoi (EH_DEBUG) : 0;
+ }
+
+ if (eh_debug)
+ {
+ printf ("pc @ 0x%p, block @ 0x%p, header = 0x%016llx\n",
+ pc, unw_info_block, header);
+ printf ("mode = %d, length = %ld, handler = %d\n",
+ (int)UNW_IVMS_MODE (header), UNW_LENGTH (header),
+ UNW_FLAG_EHANDLER (header) || UNW_FLAG_EHANDLER (header));
+ }
+
+ /* An OSSD block is there for IVMS_MODE == 3 only. */
+ if (UNW_IVMS_MODE (header) != 3)
+ return 0;
+
+ /* The OSSD block is found past the header, unwind descriptor area
+ and condition handler pointer, if any. */
+ ossd = (ossddef *)
+ /* Beware: uqword pointer arithmetic below. */
+ (unw_info_block
+ + 1
+ + UNW_LENGTH (header)
+ + (UNW_FLAG_EHANDLER (header) || UNW_FLAG_EHANDLER (header)));
+
+ /* "A General Information segment may be omitted if all of its fields
+ would have their default values. If a General Information segment
+ is present, it must be the first in the OSSD area." So ... */
+
+ if (eh_debug)
+ printf ("ossd @ 0x%p\n", ossd);
+
+ if (eh_debug && ossd->ossd$v_type == OSSD$K_GENERAL_INFO)
+ printf ("exc_frame = %d - bot_frame = %d - base_frame = %d\n",
+ ossd->ossd$v_exception_frame,
+ ossd->ossd$v_bottom_of_stack,
+ ossd->ossd$v_base_frame);
+
+ return
+ ossd->ossd$v_type == OSSD$K_GENERAL_INFO
+ && (ossd->ossd$v_exception_frame
+ || ossd->ossd$v_bottom_of_stack || ossd->ossd$v_base_frame);
+}
+
+/* Return a pointer to the unwind table entry for the function
+ containing PC, 0 if we cannot find an entry or if the one we find
+ calls for fallback processing. */
+
+struct unw_table_entry *
+_Unwind_FindTableEntry (void *pc, unsigned long *segment_base,
+ unsigned long *gp, struct unw_table_entry *ent)
+{
+ vms_unw_table_entry vueblock;
+
+ if (SYS$GET_UNWIND_ENTRY_INFO (pc, &vueblock, 0) != SS$_NORMAL)
+ return 0;
+
+ /* If there is no unwind information, use fallback. */
+ if (vueblock.info_offset == 0)
+ return 0;
+
+ /* If we need to force fallback processing, just pretend there is
+ no entry. */
+ if (force_fallback_processing_for (pc, &vueblock))
+ return 0;
+
+ *segment_base = 0; /* ??? Fixme. ??? */
+ *gp = vueblock.gp_value;
+ ent->start_offset = vueblock.start_offset;
+ ent->end_offset = vueblock.end_offset;
+ ent->info_offset = vueblock.info_offset;
+
+ return ent;
+}
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 2fa9aa38225..1c837b15cb2 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -459,14 +459,8 @@ static const struct attribute_spec ia64_attribute_table[] =
/* ??? ABI doesn't allow us to define this. */
#if 0
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
-#endif
-
-/* ??? ABI doesn't allow us to define this. */
-#if 0
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#endif
/* ??? Investigate. */
diff --git a/gcc/config/ia64/linux-unwind.h b/gcc/config/ia64/linux-unwind.h
index e2bad480b72..93f762de573 100644
--- a/gcc/config/ia64/linux-unwind.h
+++ b/gcc/config/ia64/linux-unwind.h
@@ -23,7 +23,7 @@
<http://www.gnu.org/licenses/>. */
/* Do code reading to identify a signal frame, and set the frame
- state data appropriately. See unwind-dw2.c for the structs. */
+ state data appropriately. See unwind-ia64.c for the structs. */
/* This works only for glibc-2.3 and later, because sigcontext is different
in glibc-2.2.4. */
@@ -66,7 +66,7 @@ ia64_fallback_frame_state (struct _Unwind_Context *context,
}
context->fpsr_loc = &(sc->sc_ar_fpsr);
- context->pfs_loc = &(sc->sc_ar_pfs);
+ context->signal_pfs_loc = &(sc->sc_ar_pfs);
context->lc_loc = &(sc->sc_ar_lc);
context->unat_loc = &(sc->sc_ar_unat);
context->br_loc[0] = &(sc->sc_br[0]);
@@ -105,11 +105,17 @@ ia64_fallback_frame_state (struct _Unwind_Context *context,
ia64_rse_skip_regs ((unsigned long *)(sc->sc_ar_bsp), -sof);
}
+ /* Account for use of br.ret to resume execution of user code. */
fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_SPREL;
fs->curr.reg[UNW_REG_RP].val
= (unsigned long)&(sc->sc_ip) - context->psp;
fs->curr.reg[UNW_REG_RP].when = -1;
+ fs->curr.reg[UNW_REG_PFS].where = UNW_WHERE_SPREL;
+ fs->curr.reg[UNW_REG_PFS].val
+ = (unsigned long)&(sc->sc_cfm) - context->psp;
+ fs ->curr.reg[UNW_REG_PFS].when = -1;
+
return _URC_NO_REASON;
}
return _URC_END_OF_STACK;
@@ -117,11 +123,16 @@ ia64_fallback_frame_state (struct _Unwind_Context *context,
#define MD_HANDLE_UNWABI ia64_handle_unwabi
+#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's')
+#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i')
+#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's')
+#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i')
+
static void
ia64_handle_unwabi (struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
- if (fs->unwabi == ((3 << 8) | 's')
- || fs->unwabi == ((0 << 8) | 's'))
+ if (fs->unwabi == ABI_MARKER_LINUX_SIGTRAMP
+ || fs->unwabi == ABI_MARKER_OLD_LINUX_SIGTRAMP)
{
struct sigframe {
char scratch[16];
@@ -144,7 +155,7 @@ ia64_handle_unwabi (struct _Unwind_Context *context, _Unwind_FrameState *fs)
context->ireg[i - 2].loc = &sc->sc_gr[i];
}
- context->pfs_loc = &(sc->sc_ar_pfs);
+ context->signal_pfs_loc = &(sc->sc_ar_pfs);
context->lc_loc = &(sc->sc_ar_lc);
context->unat_loc = &(sc->sc_ar_unat);
context->br_loc[0] = &(sc->sc_br[0]);
@@ -181,9 +192,8 @@ ia64_handle_unwabi (struct _Unwind_Context *context, _Unwind_FrameState *fs)
ia64_rse_skip_regs ((unsigned long *)(sc->sc_ar_bsp), -sof);
}
- /* pfs_loc already set above. Without this pfs_loc would point
- incorrectly to sc_cfm instead of sc_ar_pfs. */
- fs->curr.reg[UNW_REG_PFS].where = UNW_WHERE_NONE;
+ /* The use of br.ret to resume execution of user code is already
+ accounted for in the unwind ABI. */
}
}
#endif /* glibc-2.3 or better */
diff --git a/gcc/config/ia64/t-vms b/gcc/config/ia64/t-vms
new file mode 100644
index 00000000000..d77a2cf3796
--- /dev/null
+++ b/gcc/config/ia64/t-vms
@@ -0,0 +1,49 @@
+# Copyright (C) 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/>.
+
+# Enable the crtbegin/end rules disabled in t-ia64
+T =
+
+# VMS_EXTRA_PARTS is defined in x-vms and represent object files that
+# are only needed for VMS targets, but can only be compiled on a VMS host
+# (because they need DEC C).
+EXTRA_PARTS = $(VMS_EXTRA_PARTS) crtbegin.o crtbeginS.o crtend.o crtendS.o crtinitS.o
+
+CRTSTUFF_T_CFLAGS = -O0
+CRTSTUFF_T_CFLAGS_S = -O0
+
+$(T)crtinitS.o: $(srcdir)/config/ia64/vms-crtinit.asm $(GCC_PASSES)
+ $(GCC_FOR_TARGET) -I. -c -o $(T)crtinitS.o -x assembler-with-cpp \
+ $(srcdir)/config/ia64/vms-crtinit.asm
+
+LIB2ADDEH += $(srcdir)/config/ia64/fde-vms.c $(srcdir)/gthr-gnat.c
+
+# Shared library macros
+shlib_version:=$(shell echo $(BASEVER_c) | sed -e 's/\./,/' -e 's/\.//g')
+SHLIB_EXT = .exe
+SHLIB_OBJS = @shlib_objs@
+SHLIB_NAME = @shlib_base_name@.exe
+SHLIB_MULTILIB =
+SHLIB_INSTALL = $(INSTALL_DATA) $(SHLIB_NAME) $$(DESTDIR)$$(libsubdir)/$(SHLIB_ NAME)
+SHLIB_LINK = \
+ $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -nodefaultlibs \
+ -shared --for-linker=/noinform -o $(SHLIB_NAME) $(SHLIB_OBJS) \
+ --for-linker=$(srcdir)/config/ia64/VMS_SYMVEC_@shlib_base_name@.opt \
+ --for-linker=gsmatch=equal,$(shlib_version)
+
diff --git a/gcc/config/ia64/unwind-ia64.c b/gcc/config/ia64/unwind-ia64.c
index d69b7fc4d30..34258588292 100644
--- a/gcc/config/ia64/unwind-ia64.c
+++ b/gcc/config/ia64/unwind-ia64.c
@@ -41,12 +41,12 @@
#ifndef __USING_SJLJ_EXCEPTIONS__
-#define UNW_VER(x) ((x) >> 48)
-#define UNW_FLAG_MASK 0x0000ffff00000000
-#define UNW_FLAG_OSMASK 0x0000f00000000000
-#define UNW_FLAG_EHANDLER(x) ((x) & 0x0000000100000000L)
-#define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L)
-#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL)
+
+/* By default, assume personality routine interface compatibility with
+ our expectations. */
+#ifndef MD_UNW_COMPATIBLE_PERSONALITY_P
+#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) 1
+#endif
enum unw_application_register
{
@@ -204,6 +204,9 @@ struct _Unwind_Context
unsigned long *pfs_loc; /* Save location for pfs in current
(corr. to sp) frame. Target
contains cfm for caller. */
+ unsigned long *signal_pfs_loc;/* Save location for pfs in current
+ signal frame. Target contains
+ pfs for caller. */
unsigned long *pri_unat_loc;
unsigned long *unat_loc;
unsigned long *lc_loc;
@@ -439,7 +442,13 @@ decode_abreg (unsigned char abreg, int memory)
{
switch (abreg)
{
+#if TARGET_ABI_OPEN_VMS
+ /* OpenVMS Calling Standard specifies R3 - R31. */
+ case 0x03 ... 0x1f: return UNW_REG_R2 + (abreg - 0x02);
+#else
+ /* Standard Intel ABI specifies GR 4 - 7. */
case 0x04 ... 0x07: return UNW_REG_R4 + (abreg - 0x04);
+#endif
case 0x22 ... 0x25: return UNW_REG_F2 + (abreg - 0x22);
case 0x30 ... 0x3f: return UNW_REG_F16 + (abreg - 0x30);
case 0x41 ... 0x45: return UNW_REG_B1 + (abreg - 0x41);
@@ -1730,14 +1739,14 @@ _Unwind_GetRegionStart (struct _Unwind_Context *context)
void *
_Unwind_FindEnclosingFunction (void *pc)
{
- struct unw_table_entry *ent;
+ struct unw_table_entry *entp, ent;
unsigned long segment_base, gp;
- ent = _Unwind_FindTableEntry (pc, &segment_base, &gp);
- if (ent == NULL)
+ entp = _Unwind_FindTableEntry (pc, &segment_base, &gp, &ent);
+ if (entp == NULL)
return NULL;
else
- return (void *)(segment_base + ent->start_offset);
+ return (void *)(segment_base + entp->start_offset);
}
/* Get the value of the CFA as saved in CONTEXT. In GCC/Dwarf2 parlance,
@@ -1765,7 +1774,7 @@ _Unwind_GetBSP (struct _Unwind_Context *context)
static _Unwind_Reason_Code
uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
- struct unw_table_entry *ent;
+ struct unw_table_entry *entp, ent;
unsigned long *unw, header, length;
unsigned char *insn, *insn_end;
unsigned long segment_base;
@@ -1776,9 +1785,9 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
r->when = UNW_WHEN_NEVER;
context->lsda = 0;
- ent = _Unwind_FindTableEntry ((void *) context->rp,
- &segment_base, &context->gp);
- if (ent == NULL)
+ entp = _Unwind_FindTableEntry ((void *) context->rp,
+ &segment_base, &context->gp, &ent);
+ if (entp == NULL)
{
/* Couldn't find unwind info for this function. Try an
os-specific fallback mechanism. This will necessarily
@@ -1786,6 +1795,7 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
#ifdef MD_FALLBACK_FRAME_STATE_FOR
if (MD_FALLBACK_FRAME_STATE_FOR (context, fs) == _URC_NO_REASON)
return _URC_NO_REASON;
+#endif
/* [SCRA 11.4.1] A leaf function with no memory stack, no exception
handlers, and which keeps the return value in B0 does not need
@@ -1794,29 +1804,42 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
This can only happen in the frame after unwinding through a signal
handler. Avoid infinite looping by requiring that B0 != RP.
RP == 0 terminates the chain. */
- if (context->br_loc[0] && *context->br_loc[0] != context->rp
+ if (context->br_loc[0]
+ && *context->br_loc[0] != context->rp
&& context->rp != 0)
- {
- fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_BR;
- fs->curr.reg[UNW_REG_RP].when = -1;
- fs->curr.reg[UNW_REG_RP].val = 0;
- return _URC_NO_REASON;
- }
-#endif
+ goto skip_unwind_info;
+
return _URC_END_OF_STACK;
}
- context->region_start = ent->start_offset + segment_base;
+ context->region_start = entp->start_offset + segment_base;
fs->when_target = ((context->rp & -16) - context->region_start) / 16 * 3
+ (context->rp & 15);
- unw = (unsigned long *) (ent->info_offset + segment_base);
+ unw = (unsigned long *) (entp->info_offset + segment_base);
header = *unw;
length = UNW_LENGTH (header);
- /* ??? Perhaps check UNW_VER / UNW_FLAG_OSMASK. */
+ /* Some operating systems use the personality routine slot in way not
+ compatible with what we expect. For instance, OpenVMS uses this slot to
+ designate "condition handlers" with very different arguments than what we
+ would be providing. Such cases are typically identified from OS specific
+ bits in the unwind information block header, and checked by the target
+ MD_UNW_COMPATIBLE_PERSONALITY_P macro.
+
+ We just pretend there is no personality from our standpoint in such
+ situations, and expect GCC not to set the identifying bits itself so that
+ compatible personalities for GCC compiled code are called.
+
+ Of course, this raises the question of what combinations of native/GCC
+ calls can be expected to behave properly exception handling-wise. We are
+ not to provide a magic answer here, merely to prevent crashes assuming
+ users know what they are doing.
+
+ ??? Perhaps check UNW_VER / UNW_FLAG_OSMASK as well. */
- if (UNW_FLAG_EHANDLER (header) | UNW_FLAG_UHANDLER (header))
+ if (MD_UNW_COMPATIBLE_PERSONALITY_P (header)
+ && (UNW_FLAG_EHANDLER (header) | UNW_FLAG_UHANDLER (header)))
{
fs->personality =
*(_Unwind_Personality_Fn *) (unw[length + 1] + context->gp);
@@ -1850,7 +1873,8 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
r->where = UNW_WHERE_NONE;
}
- /* If RP did't get saved, generate entry for the return link register. */
+skip_unwind_info:
+ /* If RP didn't get saved, generate entry for the return link register. */
if (fs->curr.reg[UNW_REG_RP].when >= fs->when_target)
{
fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_BR;
@@ -1858,6 +1882,27 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs)
fs->curr.reg[UNW_REG_RP].val = fs->return_link_reg;
}
+ /* There is a subtlety for the frame after unwinding through a signal
+ handler: should we restore the cfm as usual or the pfs? We can't
+ restore both because we use br.ret to resume execution of user code.
+ For other frames the procedure is by definition non-leaf so the pfs
+ is saved and restored and thus effectively dead in the body; only
+ the cfm need therefore be restored.
+
+ Here we have 2 cases:
+ - either the pfs is saved and restored and thus effectively dead
+ like in regular frames; then we do nothing special and restore
+ the cfm.
+ - or the pfs is not saved and thus live; but in that case the
+ procedure is necessarily leaf so the cfm is effectively dead
+ and we restore the pfs. */
+ if (context->signal_pfs_loc)
+ {
+ if (fs->curr.reg[UNW_REG_PFS].when >= fs->when_target)
+ context->pfs_loc = context->signal_pfs_loc;
+ context->signal_pfs_loc = NULL;
+ }
+
return _URC_NO_REASON;
}
diff --git a/gcc/config/ia64/unwind-ia64.h b/gcc/config/ia64/unwind-ia64.h
index f3832148dc0..b98f048fdb5 100644
--- a/gcc/config/ia64/unwind-ia64.h
+++ b/gcc/config/ia64/unwind-ia64.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2001, 2007, 2009 Free Software Foundation, Inc.
Contributed by Andrew MacLeod <amacleod@cygnus.com>
Andrew Haley <aph@cygnus.com>
@@ -25,7 +25,19 @@ struct unw_table_entry
unsigned long info_offset;
};
+/* Accessors to fields of an unwind info block header. In this common file to
+ be visible from all the units involved in a target implementation. */
+
+#ifndef __USING_SJLJ_EXCEPTIONS__
+#define UNW_VER(x) ((x) >> 48)
+#define UNW_FLAG_MASK 0x0000ffff00000000
+#define UNW_FLAG_OSMASK 0x0000f00000000000
+#define UNW_FLAG_EHANDLER(x) ((x) & 0x0000000100000000L)
+#define UNW_FLAG_UHANDLER(x) ((x) & 0x0000000200000000L)
+#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffL)
+#endif
+
extern struct unw_table_entry *
_Unwind_FindTableEntry (void *pc, unsigned long *segment_base,
- unsigned long *gp)
+ unsigned long *gp, struct unw_table_entry *ent)
__attribute__ ((__visibility__ ("hidden")));
diff --git a/gcc/config/ia64/vms-crtinit.asm b/gcc/config/ia64/vms-crtinit.asm
new file mode 100644
index 00000000000..322b2927347
--- /dev/null
+++ b/gcc/config/ia64/vms-crtinit.asm
@@ -0,0 +1,24 @@
+/* Copyright (C) 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/>. */
+
+ .global LIB$INITIALIZE#
diff --git a/gcc/config/ia64/vms-unwind.h b/gcc/config/ia64/vms-unwind.h
new file mode 100644
index 00000000000..41c76ae768c
--- /dev/null
+++ b/gcc/config/ia64/vms-unwind.h
@@ -0,0 +1,307 @@
+/* DWARF2 EH unwinding support for IA64 VMS.
+ Copyright (C) 2005-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/>. */
+
+#include <vms/libicb.h>
+#include <vms/chfdef.h>
+#include <vms/chfctxdef.h>
+
+#define __int64 long long
+#include <vms/intstkdef.h>
+
+#include <stdio.h>
+#include <string.h>
+
+#define DYN$C_SSENTRY 66
+/* ??? would rather get the proper header file. */
+
+#define MD_FALLBACK_FRAME_STATE_FOR ia64_vms_fallback_frame_state
+
+extern INVO_CONTEXT_BLK * LIB$I64_CREATE_INVO_CONTEXT (void);
+
+extern int LIB$I64_IS_EXC_DISPATCH_FRAME (void *);
+extern int LIB$I64_IS_AST_DISPATCH_FRAME (void *);
+
+extern int LIB$I64_INIT_INVO_CONTEXT (INVO_CONTEXT_BLK *, int, int);
+extern int LIB$I64_GET_CURR_INVO_CONTEXT (INVO_CONTEXT_BLK *);
+extern int LIB$I64_GET_PREV_INVO_CONTEXT (INVO_CONTEXT_BLK *);
+
+typedef unsigned long ulong;
+typedef unsigned int uint;
+typedef unsigned long uw_reg;
+typedef uw_reg * uw_loc;
+
+typedef char fp_reg[16];
+
+#define DENOTES_VMS_DISPATCHER_FRAME(icb) \
+(LIB$I64_IS_EXC_DISPATCH_FRAME (&(icb)->libicb$ih_pc))
+
+#define DENOTES_BOTTOM_OF_STACK(icb) ((icb)->libicb$v_bottom_of_stack)
+
+#define FAIL_IF(COND) \
+ do { if (COND) { context->rp = 0; return _URC_END_OF_STACK; } } while (0)
+/* Clearing context->rp is required to prevent the ia64 gcc unwinder from
+ attempting to keep on walking the call chain. */
+
+static int
+ia64_vms_fallback_frame_state (struct _Unwind_Context *context,
+ _Unwind_FrameState *fs)
+{
+ int i, status;
+
+ INVO_CONTEXT_BLK local_icb;
+ INVO_CONTEXT_BLK *icb = &local_icb;
+
+ CHFCTX * chfctx;
+ CHF$MECH_ARRAY * chfmech;
+ CHF64$SIGNAL_ARRAY *chfsig64;
+ INTSTK * intstk;
+
+ static int eh_debug = -1;
+ int try_bs_copy = 0;
+ /* Non zero to attempt copy of alternate backing store contents for
+ dirty partition in interrupted context. ??? Alpha code, only activated
+ on specific request via specific bit in EH_DEBUG. */
+
+ if (eh_debug == -1)
+ {
+ char * EH_DEBUG = getenv ("EH_DEBUG");
+ const uint try_bs_copy_mask = (1 << 16);
+
+ eh_debug = EH_DEBUG ? atoi (EH_DEBUG) : 0;
+
+ /* Fetch and clear the try_bs_copy bit. */
+ try_bs_copy = (uint)eh_debug & try_bs_copy_mask;
+ eh_debug &= ~try_bs_copy_mask;
+ }
+
+ /* We're called to attempt unwinding through a frame for which no unwind
+ info is available, typical of an operating system exception dispatcher
+ frame. The code below knows how to handle this case, and only this one,
+ returning a failure code if it finds it is not in this situation.
+
+ Note that we're called from deep down in the exception propagation call
+ chain, possibly below an exception dispatcher but for a frame above it
+ like some os entry point. */
+
+ if (eh_debug)
+ printf ("FALLBACK - ctxt->rp=0x%lx, sp=0x%lx, psp=0x%lx, bsp=0x%lx\n",
+ context->rp, context->sp, context->psp, context->bsp);
+
+ /* Step 0 :
+ -------------------------------------------------------------------------
+ VMS-unwind up until we reach a VMS dispatcher frame corresponding to the
+ context we are trying to unwind through. Fail if get past this context or
+ if we reach the bottom of stack along the way.
+ -------------------------------------------------------------------------
+ */
+
+ status = LIB$I64_INIT_INVO_CONTEXT (icb, LIBICB$K_INVO_CONTEXT_VERSION, 0);
+ FAIL_IF (status == 0);
+
+ status = LIB$I64_GET_CURR_INVO_CONTEXT (icb);
+
+ /* Beware: we might be unwinding through nested condition handlers, so the
+ dispatcher frame we seek might not be the first one on the way up. Loop
+ thus. */
+ do {
+
+ /* Seek the next dispatcher frame up the "current" point. Stop if we
+ either get past the target context or hit the bottom-of-stack along
+ the way. */
+ status = LIB$I64_GET_PREV_INVO_CONTEXT (icb);
+ FAIL_IF (status == 0);
+ FAIL_IF ((uw_reg)icb->libicb$ih_sp > (uw_reg)context->psp
+ || DENOTES_BOTTOM_OF_STACK (icb));
+
+ if (eh_debug)
+ printf ("frame%s sp @ 0x%llx, pc @ 0x%llx bsp=0x%llx\n",
+ DENOTES_VMS_DISPATCHER_FRAME (icb) ? " (dispatcher)" : "",
+ icb->libicb$ih_sp, icb->libicb$ih_pc, icb->libicb$ih_bsp);
+
+ /* Continue until the target frame is found. */
+ } while ((uw_reg)icb->libicb$ih_bsp != (uw_reg)context->bsp);
+
+ /* If this is not a dispatcher frame, this is certainly a frame for a leaf
+ subprogram. Use default unwind information. */
+ if (! DENOTES_VMS_DISPATCHER_FRAME (icb))
+ return _URC_END_OF_STACK;
+
+ /* At this point, we know we are really trying to unwind past an exception
+ dispatcher frame, and have it described in ICB. Proceed. */
+
+ /* Step 1 :
+ ------------------------------------------------------------------------
+ We have the VMS dispatcher frame ICB handy and know we are trying to
+ unwind past it. Fetch pointers to useful datastructures from there, then
+ unwind one step further up to the interrupted user context from which
+ some required values will be easily accessible.
+ ------------------------------------------------------------------------
+ */
+
+ chfctx = icb->libicb$ph_chfctx_addr;
+ FAIL_IF (chfctx == 0);
+
+ chfmech = (CHF$MECH_ARRAY *)chfctx->chfctx$q_mcharglst;
+ FAIL_IF (chfmech == 0);
+
+ chfsig64 = (CHF64$SIGNAL_ARRAY *)chfmech->chf$ph_mch_sig64_addr;
+ FAIL_IF (chfsig64 == 0);
+
+ intstk = (INTSTK *)chfmech->chf$q_mch_esf_addr;
+ FAIL_IF (intstk == 0 || intstk->intstk$b_subtype == DYN$C_SSENTRY);
+
+ status = LIB$I64_GET_PREV_INVO_CONTEXT (icb);
+ FAIL_IF (status == 0);
+
+ if (eh_debug)
+ printf ("User frame, "
+ "chfmech @ 0x%lx, chfsig64 @ 0x%lx, intstk @ 0x%lx\n",
+ (ulong)chfmech, (ulong)chfsig64, (ulong)intstk);
+
+ /* Step 2 :
+ ------------------------------------------------------------------------
+ Point the GCC context locations/values required for further unwinding at
+ their corresponding locations/values in the datastructures at hand.
+ ------------------------------------------------------------------------
+ */
+
+ /* Static General Register locations, including scratch registers in case
+ the unwinder needs to refer to a value stored in one of them. */
+ {
+ uw_reg * ctxregs = (uw_reg *)&intstk->intstk$q_regbase;
+
+ for (i = 2; i <= 3; i++)
+ context->ireg[i - 2].loc = (uw_loc)&ctxregs[i];
+ for (i = 8; i <= 11; i++)
+ context->ireg[i - 2].loc = (uw_loc)&ctxregs[i];
+ for (i = 14; i <= 31; i++)
+ context->ireg[i - 2].loc = (uw_loc)&ctxregs[i];
+ }
+
+ /* Static Floating Point Register locations, as available from the
+ mechargs array, which happens to include all the to be preserved
+ ones + others. */
+ {
+ fp_reg * ctxregs;
+
+ ctxregs = (fp_reg *)&chfmech->chf$fh_mch_savf2;
+ for (i = 2; i <= 5 ; i++)
+ context->fr_loc[i - 2] = (uw_loc)&ctxregs[i - 2];
+
+ ctxregs = (fp_reg *)&chfmech->chf$fh_mch_savf12;
+ for (i = 12; i <= 31 ; i++)
+ context->fr_loc[i - 2] = (uw_loc)&ctxregs[i - 12];
+ }
+
+ /* Relevant application register locations. */
+
+ context->fpsr_loc = (uw_loc)&intstk->intstk$q_fpsr;
+ context->lc_loc = (uw_loc)&intstk->intstk$q_lc;
+ context->unat_loc = (uw_loc)&intstk->intstk$q_unat;
+
+ /* Branch register locations. */
+
+ {
+ uw_reg * ctxregs = (uw_reg *)&intstk->intstk$q_b0;
+
+ for (i = 0; i < 8; i++)
+ context->br_loc[i] = (uw_loc)&ctxregs[i];
+ }
+
+ /* Necessary register values. */
+
+ /* ??? Still unclear if we need to account for possible flushes to an
+ alternate backing store (maybe the unwinding performed above did the
+ trick already) and how this would be handled. Blind alpha tentative
+ below for experimentation purposes in malfunctioning cases. */
+ {
+ ulong q_bsp = (ulong) intstk->intstk$q_bsp;
+ ulong q_bspstore = (ulong) intstk->intstk$q_bspstore;
+ ulong q_bspbase = (ulong) intstk->intstk$q_bspbase;
+ ulong ih_bspbase = (ulong) icb->libicb$ih_bspbase;
+
+ if (eh_debug)
+ printf ("q_bspstore = 0x%lx, q_bsp = 0x%lx, q_bspbase = 0x%lx\n"
+ "ih_bspbase = 0x%lx\n",
+ q_bspstore, q_bsp, q_bspbase, ih_bspbase);
+
+ /* We witness many situations where q_bspbase is set while ih_bspbase is
+ null, and every attempt made with q_bspbase badly failed while doing
+ nothing resulted in proper behavior. */
+ if (q_bspstore < q_bsp && ih_bspbase && try_bs_copy)
+ {
+ ulong dirty_size = q_bsp - q_bspstore;
+ ulong q_rnat = (ulong) intstk->intstk$q_rnat;
+
+ if (eh_debug)
+ printf ("Attempting an alternate backing store copy ...\n");
+
+ ia64_copy_rbs
+ (context, q_bspstore, ih_bspbase, dirty_size, q_rnat);
+ /* Not clear if these are the proper arguments here. This is what
+ looked the closest to what is performed in the Linux case. */
+ }
+
+ }
+
+ context->bsp = (uw_reg)intstk->intstk$q_bsp;
+ fs->no_reg_stack_frame = 1;
+
+ context->pr = (uw_reg)intstk->intstk$q_preds;
+ context->gp = (uw_reg)intstk->intstk$q_gp;
+
+ /* We're directly setting up the "context" for a VMS exception handler.
+ The "previous SP" for it is the SP upon the handler's entry, that is
+ the SP at the condition/interruption/exception point. */
+ context->psp = (uw_reg)icb->libicb$ih_sp;
+
+ /* Previous Frame State location. What eventually ends up in pfs_loc is
+ installed with ar.pfs = pfs_loc; br.ret; so setup to target intstk->q_ifs
+ to have the interrupted context restored and not that of its caller if
+ we happen to have a handler in the interrupted context itself. */
+ fs->curr.reg[UNW_REG_PFS].where = UNW_WHERE_PSPREL;
+ fs->curr.reg[UNW_REG_PFS].val
+ = (uw_reg)&intstk->intstk$q_ifs - (uw_reg)context->psp;
+ fs->curr.reg[UNW_REG_PFS].when = -1;
+
+ /* If we need to unwind further up, past the interrupted context, we need to
+ hand out the interrupted context's pfs, still. */
+ context->signal_pfs_loc = (uw_loc) &intstk->intstk$q_pfs;
+
+ /* Finally, rules for RP . */
+ {
+ uw_reg * post_sigarray
+ = (uw_reg *)chfsig64 + 1 + chfsig64->chf64$l_sig_args;
+
+ uw_reg * ih_pc_loc = post_sigarray - 2;
+
+ fs->curr.reg[UNW_REG_RP].where = UNW_WHERE_PSPREL;
+ fs->curr.reg[UNW_REG_RP].val
+ = (uw_reg)ih_pc_loc - (uw_reg)context->psp;
+ fs->curr.reg[UNW_REG_RP].when = -1;
+ }
+
+ return _URC_NO_REASON;
+}
+
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
new file mode 100644
index 00000000000..da47320999b
--- /dev/null
+++ b/gcc/config/ia64/vms.h
@@ -0,0 +1,231 @@
+/* Definitions of target machine GNU compiler. IA64-VMS version.
+ Copyright (C) 2003-2009 Free Software Foundation, Inc.
+ Contributed by Douglas B Rupp (rupp@gnat.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#define TARGET_OBJECT_SUFFIX ".obj"
+#define TARGET_EXECUTABLE_SUFFIX ".exe"
+
+#define OBJECT_FORMAT_ELF
+
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define_std ("vms"); \
+ builtin_define_std ("VMS"); \
+ builtin_define ("__IA64"); \
+ builtin_assert ("system=vms"); \
+ builtin_define ("__IEEE_FLOAT"); \
+ } while (0)
+
+/* By default, allow $ to be part of an identifier. */
+#define DOLLARS_IN_IDENTIFIERS 2
+
+#undef TARGET_ABI_OPEN_VMS
+#define TARGET_ABI_OPEN_VMS 1
+
+#undef TARGET_NAME
+#define TARGET_NAME "OpenVMS/IA64"
+#undef TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (%s)", TARGET_NAME);
+
+/* Need .debug_line info generated from gcc and gas. */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS)
+
+#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
+
+/* "long" is 32 bits, but 64 bits for Ada. */
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 32
+#define ADA_LONG_TYPE_SIZE 64
+
+/* Pointer is 32 bits but the hardware has 64-bit addresses, sign extended. */
+#undef POINTER_SIZE
+#define POINTER_SIZE 32
+#define POINTERS_EXTEND_UNSIGNED 0
+
+#undef MAX_OFILE_ALIGNMENT
+#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
+
+/* Widest floating-point type efficiently supported by hardware and OS. */
+#undef WIDEST_HARDWARE_FP_SIZE
+#define WIDEST_HARDWARE_FP_SIZE 64
+
+/* HP OpenVMS Calling Standard dated June, 2004, that describes
+ HP OpenVMS I64 Version 8.2EFT
+ chapter 4 "OpenVMS I64 Conventions"
+ section 4.7 "Procedure Linkage"
+ subsection 4.7.5.2, "Normal Register Parameters"
+
+ "Unsigned integral (except unsigned 32-bit), set, and VAX
+ floating-point values passed in registers are zero-filled;
+ signed integral values as well as unsigned 32-bit integral
+ values are sign-extended to 64 bits. For all other types
+ passed in the general registers, unused bits are undefined." */
+#define PROMOTE_FUNCTION_MODE(MODE,UNSIGNEDP,TYPE) \
+ if (GET_MODE_CLASS (MODE) == MODE_INT \
+ && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
+ { \
+ if ((MODE) == SImode) \
+ (UNSIGNEDP) = 0; \
+ (MODE) = DImode; \
+ }
+
+/* The structure return address arrives as an "argument" on VMS. */
+#undef PCC_STATIC_STRUCT_RETURN
+
+/* Turn on VMS specific Dwarf2 features. */
+#define VMS_DEBUGGING_INFO 1
+
+#define ASM_OUTPUT_DWARF_DELTA_UNITS(FILE,SIZE,LABEL1,LABEL2,UNITS) \
+do { \
+ fprintf (FILE, "\tdata4.ua\t ("); \
+ assemble_name (FILE, LABEL1); \
+ fprintf (FILE, "-"); \
+ assemble_name (FILE, LABEL2); \
+ fprintf (FILE, ")/16*3"); \
+} while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
+ crtbegin.o%s} \
+ %{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}"
+
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC \
+"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
+
+#define LINK_GCC_C_SEQUENCE_SPEC "%G"
+
+#undef LINK_SPEC
+#define LINK_SPEC "%{g*} %{map} %{save-temps} %{shared} %{v}"
+
+#undef LIB_SPEC
+#define LIB_SPEC ""
+
+#undef ASM_SPEC
+#define ASM_SPEC \
+"%{mno-gnu-as:-N so -N vms_upcase -W DVLoc_off} %{mconstant-gp:-M const_gp} \
+ %{mauto-pic:-M no_plabel} %{source-listing:-ahdl=%b.lis}"
+
+#undef ASM_OUTPUT_EXTERNAL_LIBCALL
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
+do { \
+ (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)); \
+ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, XSTR (FUN, 0), "function"); \
+} while (0)
+
+/* Set the function to change the names of the division and modulus
+ functions. */
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs
+
+#define NAME__MAIN "__gccmain"
+#define SYMBOL__MAIN __gccmain
+
+#define CTOR_LIST_BEGIN asm (".global\tLIB$INITIALIZE#\n"); \
+STATIC func_ptr __CTOR_LIST__[1] \
+ __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr)))) \
+ = { (func_ptr) (-1) };
+
+#undef INIT_SECTION_ASM_OP
+#define INIT_SECTION_ASM_OP ".section\tLIB$INITIALIZE#,\"a\",@progbits"
+
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n\tdata4 @fptr(" #FUNC"#)\n"); \
+ FORCE_CODE_SECTION_ALIGN \
+ asm (TEXT_SECTION_ASM_OP);
+
+#undef FINI_SECTION_ASM_OP
+
+/* Maybe same as HPUX? Needs to be checked. */
+#define JMP_BUF_SIZE (8 * 76)
+
+typedef struct crtl_name_spec
+{
+ const char *const name;
+ const char *deccname;
+ int referenced;
+} crtl_name_spec;
+
+#include "config/vms/vms-crtl.h"
+
+/* Alias CRTL names to 32/64bit DECCRTL functions.
+ Fixme: This should do a binary search. */
+#define DO_CRTL_NAMES \
+ do \
+ { \
+ int i; \
+ static crtl_name_spec vms_crtl_names[] = CRTL_NAMES; \
+ static int malloc64_init = 0; \
+ \
+ if ((malloc64_init == 0) && TARGET_MALLOC64) \
+ { \
+ for (i=0; vms_crtl_names [i].name; i++) \
+ { \
+ if (strcmp ("calloc", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_calloc64"; \
+ else \
+ if (strcmp ("malloc", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_malloc64"; \
+ else \
+ if (strcmp ("realloc", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_realloc64"; \
+ else \
+ if (strcmp ("strdup", vms_crtl_names [i].name) == 0) \
+ vms_crtl_names [i].deccname = "decc$_strdup64"; \
+ } \
+ malloc64_init = 1; \
+ } \
+ for (i=0; vms_crtl_names [i].name; i++) \
+ if (!vms_crtl_names [i].referenced && \
+ (strcmp (name, vms_crtl_names [i].name) == 0)) \
+ { \
+ fprintf (file, "\t.alias %s, \"%s\"\n", \
+ name, vms_crtl_names [i].deccname); \
+ vms_crtl_names [i].referenced = 1; \
+ } \
+ } while (0)
+
+#undef OPTIMIZATION_OPTIONS
+#define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \
+ do { \
+ flag_merge_constants = 0; \
+ ia64_optimization_options ((LEVEL), (SIZE)); \
+ } while (0)
+
+/* Define this to be nonzero if static stack checking is supported. */
+#define STACK_CHECK_STATIC_BUILTIN 1
+
+#define MD_UNWIND_SUPPORT "config/ia64/vms-unwind.h"
+
+#define UNW_IVMS_MODE(HEADER) (((HEADER) >> 44) & 0x3L)
+#define MD_UNW_COMPATIBLE_PERSONALITY_P(HEADER) (!UNW_IVMS_MODE (HEADER))
+
+/* Minimum amount of stack required to recover from an anticipated stack
+ overflow detection. The default value conveys an estimate of the amount
+ of stack required to propagate an exception. */
+#define STACK_CHECK_PROTECT (24 * 1024)
+
+#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
+#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
+ ia64_vms_output_aligned_decl_common (FILE, DECL, NAME, SIZE, ALIGN)
+
+#undef TARGET_ASM_NAMED_SECTION
+#define TARGET_ASM_NAMED_SECTION ia64_vms_elf_asm_named_section
diff --git a/gcc/config/ia64/vms64.h b/gcc/config/ia64/vms64.h
new file mode 100644
index 00000000000..ac1d7a50799
--- /dev/null
+++ b/gcc/config/ia64/vms64.h
@@ -0,0 +1,41 @@
+/* Definitions of target machine GNU compiler. 64bit IA64-VMS version.
+ Copyright (C) 2004-2009 Free Software Foundation, Inc.
+ Contributed by Douglas B Rupp (rupp@gnat.com).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS() \
+ do { \
+ builtin_define_std ("vms"); \
+ builtin_define_std ("VMS"); \
+ builtin_define ("__IA64"); \
+ builtin_assert ("system=vms"); \
+ builtin_define ("__IEEE_FLOAT"); \
+ builtin_define ("__LONG_POINTERS=1"); \
+ } while (0)
+
+#undef LONG_TYPE_SIZE
+#define LONG_TYPE_SIZE 64
+
+#undef POINTER_SIZE
+#define POINTER_SIZE 64
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS | MASK_MALLOC64)
+
+#include "config/vms/vms-crtl-64.h"
diff --git a/gcc/config/ia64/vms_symvec_libgcc_s.opt b/gcc/config/ia64/vms_symvec_libgcc_s.opt
new file mode 100644
index 00000000000..88b46dfda6c
--- /dev/null
+++ b/gcc/config/ia64/vms_symvec_libgcc_s.opt
@@ -0,0 +1,89 @@
+! Symbol vector listing all the universal symbols to be exported when
+! building libgcc_s.exe shareable image on IVMS for Gcc 3.4.5.
+! It would be better to auto-generate this file.
+
+case_sensitive=yes
+SYMBOL_VECTOR=(__divdf3=PROCEDURE)
+SYMBOL_VECTOR=(__divdi3=PROCEDURE)
+SYMBOL_VECTOR=(__divsf3=PROCEDURE)
+SYMBOL_VECTOR=(__divsi3=PROCEDURE)
+SYMBOL_VECTOR=(__divxf3=PROCEDURE)
+SYMBOL_VECTOR=(__moddi3=PROCEDURE)
+SYMBOL_VECTOR=(__modsi3=PROCEDURE)
+SYMBOL_VECTOR=(__ia64_nonlocal_goto=PROCEDURE)
+SYMBOL_VECTOR=(__ia64_restore_stack_nonlocal=PROCEDURE)
+SYMBOL_VECTOR=(__ia64_save_stack_nonlocal=PROCEDURE)
+SYMBOL_VECTOR=(__ia64_trampoline=PROCEDURE)
+SYMBOL_VECTOR=(__udivdi3=PROCEDURE)
+SYMBOL_VECTOR=(__udivsi3=PROCEDURE)
+SYMBOL_VECTOR=(__umoddi3=PROCEDURE)
+SYMBOL_VECTOR=(__umodsi3=PROCEDURE)
+SYMBOL_VECTOR=(__absvti2=PROCEDURE)
+SYMBOL_VECTOR=(__absvdi2=PROCEDURE)
+SYMBOL_VECTOR=(__absvsi2=PROCEDURE)
+SYMBOL_VECTOR=(__addvti3=PROCEDURE)
+SYMBOL_VECTOR=(__addvdi3=PROCEDURE)
+SYMBOL_VECTOR=(__addvsi3=PROCEDURE)
+SYMBOL_VECTOR=(__ashlti3=PROCEDURE)
+SYMBOL_VECTOR=(__ashrti3=PROCEDURE)
+SYMBOL_VECTOR=(__clear_cache=PROCEDURE)
+SYMBOL_VECTOR=(__clzti2=PROCEDURE)
+SYMBOL_VECTOR=(__clzdi2=PROCEDURE)
+SYMBOL_VECTOR=(__cmpti2=PROCEDURE)
+SYMBOL_VECTOR=(__ctzti2=PROCEDURE)
+SYMBOL_VECTOR=(__ctzdi2=PROCEDURE)
+SYMBOL_VECTOR=(__divti3=PROCEDURE)
+SYMBOL_VECTOR=(__enable_execute_stack=PROCEDURE)
+SYMBOL_VECTOR=(__ffsti2=PROCEDURE)
+SYMBOL_VECTOR=(__ffsdi2=PROCEDURE)
+SYMBOL_VECTOR=(__fixdfti=PROCEDURE)
+SYMBOL_VECTOR=(__fixsfti=PROCEDURE)
+SYMBOL_VECTOR=(__fixunsdfti=PROCEDURE)
+SYMBOL_VECTOR=(__fixunsdfdi=PROCEDURE)
+SYMBOL_VECTOR=(__fixunssfti=PROCEDURE)
+SYMBOL_VECTOR=(__fixunssfdi=PROCEDURE)
+SYMBOL_VECTOR=(__floattidf=PROCEDURE)
+SYMBOL_VECTOR=(__floattisf=PROCEDURE)
+SYMBOL_VECTOR=(__lshrti3=PROCEDURE)
+SYMBOL_VECTOR=(__modti3=PROCEDURE)
+SYMBOL_VECTOR=(__multi3=PROCEDURE)
+SYMBOL_VECTOR=(__mulvti3=PROCEDURE)
+SYMBOL_VECTOR=(__mulvdi3=PROCEDURE)
+SYMBOL_VECTOR=(__mulvsi3=PROCEDURE)
+SYMBOL_VECTOR=(__negti2=PROCEDURE)
+SYMBOL_VECTOR=(__negvti2=PROCEDURE)
+SYMBOL_VECTOR=(__negvdi2=PROCEDURE)
+SYMBOL_VECTOR=(__negvsi2=PROCEDURE)
+SYMBOL_VECTOR=(__parityti2=PROCEDURE)
+SYMBOL_VECTOR=(__paritydi2=PROCEDURE)
+SYMBOL_VECTOR=(__popcountti2=PROCEDURE)
+SYMBOL_VECTOR=(__popcountdi2=PROCEDURE)
+SYMBOL_VECTOR=(__subvti3=PROCEDURE)
+SYMBOL_VECTOR=(__subvdi3=PROCEDURE)
+SYMBOL_VECTOR=(__subvsi3=PROCEDURE)
+SYMBOL_VECTOR=(__ucmpti2=PROCEDURE)
+SYMBOL_VECTOR=(__udiv_w_sdiv=PROCEDURE)
+SYMBOL_VECTOR=(__udivti3=PROCEDURE)
+SYMBOL_VECTOR=(__udivmodti4=PROCEDURE)
+SYMBOL_VECTOR=(__umodti3=PROCEDURE)
+SYMBOL_VECTOR=(__gthread_active_p=PROCEDURE)
+SYMBOL_VECTOR=(__gthread_mutex_lock=PROCEDURE)
+SYMBOL_VECTOR=(__gthread_mutex_unlock=PROCEDURE)
+SYMBOL_VECTOR=(__gcc_personality_v0=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetGR=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_SetGR=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetIP=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetIPInfo=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_SetIP=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetLanguageSpecificData=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetRegionStart=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_FindEnclosingFunction=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetCFA=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_GetBSP=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_RaiseException=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_ForcedUnwind=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_Resume=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_Resume_or_Rethrow=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_DeleteException=PROCEDURE)
+SYMBOL_VECTOR=(_Unwind_Backtrace=PROCEDURE)
+case_sensitive=NO
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index b99043efa99..ff0c868aaf2 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -189,10 +189,8 @@ static bool iq2000_legitimate_address_p (enum machine_mode, rtx, bool);
#undef TARGET_HAVE_SWITCHABLE_BSS_SECTIONS
#define TARGET_HAVE_SWITCHABLE_BSS_SECTIONS false
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
@@ -2186,15 +2184,14 @@ iq2000_select_section (tree decl, int reloc ATTRIBUTE_UNUSED,
FUNC. */
rtx
-iq2000_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
+iq2000_function_value (const_tree valtype, const_tree func)
{
int reg = GP_RETURN;
enum machine_mode mode = TYPE_MODE (valtype);
int unsignedp = TYPE_UNSIGNED (valtype);
- /* Since we define TARGET_PROMOTE_FUNCTION_RETURN that returns true,
- we must promote the mode just as PROMOTE_MODE does. */
- mode = promote_mode (valtype, mode, &unsignedp, 1);
+ /* Since we promote return types, we must promote the mode here too. */
+ mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
return gen_rtx_REG (mode, reg);
}
diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c
index 46dc4dc6639..ae4c8973dea 100644
--- a/gcc/config/m32c/m32c.c
+++ b/gcc/config/m32c/m32c.c
@@ -60,9 +60,13 @@ typedef enum
PP_justcount
} Push_Pop_Type;
+static bool m32c_function_needs_enter (void);
static tree interrupt_handler (tree *, tree, tree, int, bool *);
static tree function_vector_handler (tree *, tree, tree, int, bool *);
static int interrupt_p (tree node);
+static int bank_switch_p (tree node);
+static int fast_interrupt_p (tree node);
+static int interrupt_p (tree node);
static bool m32c_asm_integer (rtx, unsigned int, int);
static int m32c_comp_type_attributes (const_tree, const_tree);
static bool m32c_fixed_condition_code_regs (unsigned int *, unsigned int *);
@@ -493,7 +497,7 @@ m32c_conditional_register_usage (void)
{
/* The command line option is bytes, but our "registers" are
16-bit words. */
- for (i = target_memregs/2; i < 8; i++)
+ for (i = (target_memregs+1)/2; i < 8; i++)
{
fixed_regs[MEM0_REGNO + i] = 1;
CLEAR_HARD_REG_BIT (reg_class_contents[MEM_REGS], MEM0_REGNO + i);
@@ -1255,7 +1259,10 @@ need_to_save (int regno)
if (regno == FP_REGNO)
return 0;
if (cfun->machine->is_interrupt
- && (!cfun->machine->is_leaf || regno == A0_REGNO))
+ && (!cfun->machine->is_leaf
+ || (regno == A0_REGNO
+ && m32c_function_needs_enter ())
+ ))
return 1;
if (df_regs_ever_live_p (regno)
&& (!call_used_regs[regno] || cfun->machine->is_interrupt))
@@ -2733,6 +2740,34 @@ interrupt_p (tree node ATTRIBUTE_UNUSED)
return 1;
list = TREE_CHAIN (list);
}
+ return fast_interrupt_p (node);
+}
+
+/* Returns TRUE if the given tree has the "bank_switch" attribute. */
+static int
+bank_switch_p (tree node ATTRIBUTE_UNUSED)
+{
+ tree list = M32C_ATTRIBUTES (node);
+ while (list)
+ {
+ if (is_attribute_p ("bank_switch", TREE_PURPOSE (list)))
+ return 1;
+ list = TREE_CHAIN (list);
+ }
+ return 0;
+}
+
+/* Returns TRUE if the given tree has the "fast_interrupt" attribute. */
+static int
+fast_interrupt_p (tree node ATTRIBUTE_UNUSED)
+{
+ tree list = M32C_ATTRIBUTES (node);
+ while (list)
+ {
+ if (is_attribute_p ("fast_interrupt", TREE_PURPOSE (list)))
+ return 1;
+ list = TREE_CHAIN (list);
+ }
return 0;
}
@@ -2846,6 +2881,8 @@ current_function_special_page_vector (rtx x)
#define TARGET_ATTRIBUTE_TABLE m32c_attribute_table
static const struct attribute_spec m32c_attribute_table[] = {
{"interrupt", 0, 0, false, false, false, interrupt_handler},
+ {"bank_switch", 0, 0, false, false, false, interrupt_handler},
+ {"fast_interrupt", 0, 0, false, false, false, interrupt_handler},
{"function_vector", 1, 1, true, false, false, function_vector_handler},
{0, 0, 0, 0, 0, 0, 0}
};
@@ -3928,16 +3965,23 @@ m32c_emit_prologue (void)
cfun->machine->is_interrupt = 1;
complex_prologue = 1;
}
+ else if (bank_switch_p (cfun->decl))
+ warning (OPT_Wattributes,
+ "%<bank_switch%> has no effect on non-interrupt functions");
reg_save_size = m32c_pushm_popm (PP_justcount);
if (interrupt_p (cfun->decl))
- emit_insn (gen_pushm (GEN_INT (cfun->machine->intr_pushm)));
+ {
+ if (bank_switch_p (cfun->decl))
+ emit_insn (gen_fset_b ());
+ else if (cfun->machine->intr_pushm)
+ emit_insn (gen_pushm (GEN_INT (cfun->machine->intr_pushm)));
+ }
frame_size =
m32c_initial_elimination_offset (FB_REGNO, SP_REGNO) - reg_save_size;
if (frame_size == 0
- && !cfun->machine->is_interrupt
&& !m32c_function_needs_enter ())
cfun->machine->use_rts = 1;
@@ -3988,16 +4032,29 @@ m32c_emit_epilogue (void)
{
enum machine_mode spmode = TARGET_A16 ? HImode : PSImode;
- emit_move_insn (gen_rtx_REG (spmode, A0_REGNO),
- gen_rtx_REG (spmode, FP_REGNO));
- emit_move_insn (gen_rtx_REG (spmode, SP_REGNO),
- gen_rtx_REG (spmode, A0_REGNO));
- if (TARGET_A16)
- emit_insn (gen_pophi_16 (gen_rtx_REG (HImode, FP_REGNO)));
- else
- emit_insn (gen_poppsi (gen_rtx_REG (PSImode, FP_REGNO)));
- emit_insn (gen_popm (GEN_INT (cfun->machine->intr_pushm)));
- if (TARGET_A16)
+ /* REIT clears B flag and restores $fp for us, but we still
+ have to fix up the stack. USE_RTS just means we didn't
+ emit ENTER. */
+ if (!cfun->machine->use_rts)
+ {
+ emit_move_insn (gen_rtx_REG (spmode, A0_REGNO),
+ gen_rtx_REG (spmode, FP_REGNO));
+ emit_move_insn (gen_rtx_REG (spmode, SP_REGNO),
+ gen_rtx_REG (spmode, A0_REGNO));
+ /* We can't just add this to the POPM because it would be in
+ the wrong order, and wouldn't fix the stack if we're bank
+ switching. */
+ if (TARGET_A16)
+ emit_insn (gen_pophi_16 (gen_rtx_REG (HImode, FP_REGNO)));
+ else
+ emit_insn (gen_poppsi (gen_rtx_REG (PSImode, FP_REGNO)));
+ }
+ if (!bank_switch_p (cfun->decl) && cfun->machine->intr_pushm)
+ emit_insn (gen_popm (GEN_INT (cfun->machine->intr_pushm)));
+
+ if (fast_interrupt_p (cfun->decl))
+ emit_jump_insn (gen_epilogue_freit ());
+ else if (TARGET_A16)
emit_jump_insn (gen_epilogue_reit_16 ());
else
emit_jump_insn (gen_epilogue_reit_24 ());
diff --git a/gcc/config/m32c/m32c.md b/gcc/config/m32c/m32c.md
index da0f8dd23f9..739f24c177e 100644
--- a/gcc/config/m32c/m32c.md
+++ b/gcc/config/m32c/m32c.md
@@ -47,6 +47,8 @@
(UNS_SSTR 7)
(UNS_SCMPU 8)
(UNS_SMOVU 9)
+ (UNS_FSETB 10)
+ (UNS_FREIT 11)
])
;; n = no change, x = clobbered. The first 16 values are chosen such
diff --git a/gcc/config/m32c/prologue.md b/gcc/config/m32c/prologue.md
index 9db49204aae..175b2b0ab9f 100644
--- a/gcc/config/m32c/prologue.md
+++ b/gcc/config/m32c/prologue.md
@@ -149,6 +149,15 @@
[(set_attr "flags" "x")]
)
+(define_insn "epilogue_freit"
+ [(unspec [(const_int 0)] UNS_FREIT)
+ (return)
+ ]
+ ""
+ "freit"
+ [(set_attr "flags" "x")]
+ )
+
(define_insn "epilogue_rts"
[(return)
]
@@ -180,3 +189,11 @@
"popm\t%p0"
[(set_attr "flags" "n")]
)
+
+(define_insn "fset_b"
+ [(unspec [(const_int 0)] UNS_FSETB)]
+ ""
+ "fset\tB"
+ [(set_attr "flags" "n")]
+ )
+
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 3b0adef1074..170b4b00de6 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -192,10 +192,8 @@ static const struct attribute_spec mcore_attribute_table[] =
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG mcore_reorg
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
@@ -2730,14 +2728,15 @@ handle_structs_in_regs (enum machine_mode mode, const_tree type, int reg)
}
rtx
-mcore_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED)
+mcore_function_value (const_tree valtype, const_tree func)
{
enum machine_mode mode;
int unsigned_p;
mode = TYPE_MODE (valtype);
- mode = promote_mode (valtype, mode, &unsigned_p, 1);
+ /* Since we promote return types, we must promote the mode here too. */
+ mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
return handle_structs_in_regs (mode, valtype, FIRST_RET_REG);
}
diff --git a/gcc/config/mep/mep.c b/gcc/config/mep/mep.c
index dd229ee05d3..cf2e7d53fc0 100644
--- a/gcc/config/mep/mep.c
+++ b/gcc/config/mep/mep.c
@@ -7360,16 +7360,16 @@ mep_asm_init_sections (void)
"\t.section .srodata,\"a\"");
vtext_section
- = get_unnamed_section (0, output_section_asm_op,
- "\t.section .vtext,\"ax\"");
+ = get_unnamed_section (SECTION_CODE | SECTION_MEP_VLIW, output_section_asm_op,
+ "\t.section .vtext,\"axv\"\n\t.vliw");
vftext_section
- = get_unnamed_section (0, output_section_asm_op,
- "\t.section .vftext,\"ax\"");
+ = get_unnamed_section (SECTION_CODE | SECTION_MEP_VLIW, output_section_asm_op,
+ "\t.section .vftext,\"axv\"\n\t.vliw");
ftext_section
- = get_unnamed_section (0, output_section_asm_op,
- "\t.section .ftext,\"ax\"");
+ = get_unnamed_section (SECTION_CODE, output_section_asm_op,
+ "\t.section .ftext,\"ax\"\n\t.core");
}
diff --git a/gcc/config/mips/constraints.md b/gcc/config/mips/constraints.md
index a749855072b..a29d2c97696 100644
--- a/gcc/config/mips/constraints.md
+++ b/gcc/config/mips/constraints.md
@@ -215,3 +215,19 @@
A signed 10-bit constant."
(and (match_code "const_int")
(match_test "IMM10_OPERAND (ival)")))
+
+(define_constraint "Yb"
+ "@internal"
+ (match_operand 0 "qi_mask_operand"))
+
+(define_constraint "Yh"
+ "@internal"
+ (match_operand 0 "hi_mask_operand"))
+
+(define_constraint "Yw"
+ "@internal"
+ (match_operand 0 "si_mask_operand"))
+
+(define_constraint "Yx"
+ "@internal"
+ (match_operand 0 "low_bitmask_operand"))
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index d5d6eeea8d5..d3502594221 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -254,6 +254,8 @@ extern void mips_conditional_register_usage (void);
extern void mips_order_regs_for_local_alloc (void);
extern HOST_WIDE_INT mips_debugger_offset (rtx, HOST_WIDE_INT);
+extern void mips_push_asm_switch (struct mips_asm_switch *);
+extern void mips_pop_asm_switch (struct mips_asm_switch *);
extern void mips_print_operand (FILE *, rtx, int);
extern void mips_print_operand_address (FILE *, rtx);
extern void mips_output_external (FILE *, tree, const char *);
@@ -279,7 +281,7 @@ extern void mips_expand_prologue (void);
extern void mips_expand_before_return (void);
extern void mips_expand_epilogue (bool);
extern bool mips_can_use_return_insn (void);
-extern rtx mips_function_value (const_tree, enum machine_mode);
+extern rtx mips_function_value (const_tree, const_tree, enum machine_mode);
extern bool mips_cannot_change_mode_class (enum machine_mode,
enum machine_mode, enum reg_class);
@@ -298,7 +300,7 @@ extern const char *mips_output_load_label (void);
extern const char *mips_output_conditional_branch (rtx, rtx *, const char *,
const char *);
extern const char *mips_output_order_conditional_branch (rtx, rtx *, bool);
-extern const char *mips_output_sync_loop (const char *);
+extern const char *mips_output_sync_loop (bool, const char *, rtx *);
extern const char *mips_output_division (const char *, rtx *);
extern unsigned int mips_hard_regno_nregs (int, enum machine_mode);
extern bool mips_linked_madd_p (rtx, rtx);
@@ -316,6 +318,7 @@ extern bool mips16e_save_restore_pattern_p (rtx, HOST_WIDE_INT,
extern bool mask_low_and_shift_p (enum machine_mode, rtx, rtx, int);
extern int mask_low_and_shift_len (enum machine_mode, rtx, rtx);
+extern bool and_operands_ok (enum machine_mode, rtx, rtx);
union mips_gen_fn_ptrs
{
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 4a10fb47244..572d6e7d40c 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -440,9 +440,9 @@ int mips_dbx_regno[FIRST_PSEUDO_REGISTER];
int mips_dwarf_regno[FIRST_PSEUDO_REGISTER];
/* The nesting depth of the PRINT_OPERAND '%(', '%<' and '%[' constructs. */
-int set_noreorder;
-int set_nomacro;
-static int set_noat;
+struct mips_asm_switch mips_noreorder = { "reorder", 0 };
+struct mips_asm_switch mips_nomacro = { "macro", 0 };
+struct mips_asm_switch mips_noat = { "at", 0 };
/* True if we're writing out a branch-likely instruction rather than a
normal branch. */
@@ -686,6 +686,11 @@ static const struct mips_cpu_info mips_cpu_info_table[] = {
{ "74kx", PROCESSOR_74KF1_1, 33, 0 },
{ "74kf3_2", PROCESSOR_74KF3_2, 33, 0 },
+ { "1004kc", PROCESSOR_24KC, 33, 0 }, /* 1004K with MT/DSP. */
+ { "1004kf2_1", PROCESSOR_24KF2_1, 33, 0 },
+ { "1004kf", PROCESSOR_24KF2_1, 33, 0 },
+ { "1004kf1_1", PROCESSOR_24KF1_1, 33, 0 },
+
/* MIPS64 processors. */
{ "5kc", PROCESSOR_5KC, 64, 0 },
{ "5kf", PROCESSOR_5KF, 64, 0 },
@@ -4976,7 +4981,7 @@ mips_return_fpr_pair (enum machine_mode mode,
VALTYPE is null and MODE is the mode of the return value. */
rtx
-mips_function_value (const_tree valtype, enum machine_mode mode)
+mips_function_value (const_tree valtype, const_tree func, enum machine_mode mode)
{
if (valtype)
{
@@ -4986,9 +4991,9 @@ mips_function_value (const_tree valtype, enum machine_mode mode)
mode = TYPE_MODE (valtype);
unsigned_p = TYPE_UNSIGNED (valtype);
- /* Since TARGET_PROMOTE_FUNCTION_RETURN unconditionally returns true,
- we must promote the mode just as PROMOTE_MODE does. */
- mode = promote_mode (valtype, mode, &unsigned_p, 1);
+ /* Since TARGET_PROMOTE_FUNCTION_MODE unconditionally promotes,
+ return values, promote the mode here too. */
+ mode = promote_function_mode (valtype, mode, &unsigned_p, func, 1);
/* Handle structures whose fields are returned in $f0/$f2. */
switch (mips_fpr_return_fields (valtype, fields))
@@ -6781,6 +6786,18 @@ mask_low_and_shift_p (enum machine_mode mode, rtx mask, rtx shift, int maxlen)
return IN_RANGE (mask_low_and_shift_len (mode, mask, shift), 1, maxlen);
}
+/* Return true iff OP1 and OP2 are valid operands together for the
+ *and<MODE>3 and *and<MODE>3_mips16 patterns. For the cases to consider,
+ see the table in the comment before the pattern. */
+
+bool
+and_operands_ok (enum machine_mode mode, rtx op1, rtx op2)
+{
+ return (memory_operand (op1, mode)
+ ? and_load_operand (op2, mode)
+ : and_reg_operand (op2, mode));
+}
+
/* The canonical form of a mask-low-and-shift-left operation is
(and (ashift X SHIFT) MASK) where MASK has the lower SHIFT number of bits
cleared. Thus we need to shift MASK to the right before checking if it
@@ -6972,6 +6989,45 @@ mips_print_operand_reloc (FILE *file, rtx op, enum mips_symbol_context context,
fputc (')', file);
}
+/* Start a new block with the given asm switch enabled. If we need
+ to print a directive, emit PREFIX before it and SUFFIX after it. */
+
+static void
+mips_push_asm_switch_1 (struct mips_asm_switch *asm_switch,
+ const char *prefix, const char *suffix)
+{
+ if (asm_switch->nesting_level == 0)
+ fprintf (asm_out_file, "%s.set\tno%s%s", prefix, asm_switch->name, suffix);
+ asm_switch->nesting_level++;
+}
+
+/* Likewise, but end a block. */
+
+static void
+mips_pop_asm_switch_1 (struct mips_asm_switch *asm_switch,
+ const char *prefix, const char *suffix)
+{
+ gcc_assert (asm_switch->nesting_level);
+ asm_switch->nesting_level--;
+ if (asm_switch->nesting_level == 0)
+ fprintf (asm_out_file, "%s.set\t%s%s", prefix, asm_switch->name, suffix);
+}
+
+/* Wrappers around mips_push_asm_switch_1 and mips_pop_asm_switch_1
+ that either print a complete line or print nothing. */
+
+void
+mips_push_asm_switch (struct mips_asm_switch *asm_switch)
+{
+ mips_push_asm_switch_1 (asm_switch, "\t", "\n");
+}
+
+void
+mips_pop_asm_switch (struct mips_asm_switch *asm_switch)
+{
+ mips_pop_asm_switch_1 (asm_switch, "\t", "\n");
+}
+
/* Print the text for PRINT_OPERAND punctation character CH to FILE.
The punctuation characters are:
@@ -7002,36 +7058,27 @@ mips_print_operand_punctuation (FILE *file, int ch)
switch (ch)
{
case '(':
- if (set_noreorder++ == 0)
- fputs (".set\tnoreorder\n\t", file);
+ mips_push_asm_switch_1 (&mips_noreorder, "", "\n\t");
break;
case ')':
- gcc_assert (set_noreorder > 0);
- if (--set_noreorder == 0)
- fputs ("\n\t.set\treorder", file);
+ mips_pop_asm_switch_1 (&mips_noreorder, "\n\t", "");
break;
case '[':
- if (set_noat++ == 0)
- fputs (".set\tnoat\n\t", file);
+ mips_push_asm_switch_1 (&mips_noat, "", "\n\t");
break;
case ']':
- gcc_assert (set_noat > 0);
- if (--set_noat == 0)
- fputs ("\n\t.set\tat", file);
+ mips_pop_asm_switch_1 (&mips_noat, "\n\t", "");
break;
case '<':
- if (set_nomacro++ == 0)
- fputs (".set\tnomacro\n\t", file);
+ mips_push_asm_switch_1 (&mips_nomacro, "", "\n\t");
break;
case '>':
- gcc_assert (set_nomacro > 0);
- if (--set_nomacro == 0)
- fputs ("\n\t.set\tmacro", file);
+ mips_pop_asm_switch_1 (&mips_nomacro, "\n\t", "");
break;
case '*':
@@ -7043,7 +7090,7 @@ mips_print_operand_punctuation (FILE *file, int ch)
break;
case '#':
- if (set_noreorder != 0)
+ if (mips_noreorder.nesting_level > 0)
fputs ("\n\tnop", file);
break;
@@ -7051,7 +7098,7 @@ mips_print_operand_punctuation (FILE *file, int ch)
/* Print an extra newline so that the delayed insn is separated
from the following ones. This looks neater and is consistent
with non-nop delayed sequences. */
- if (set_noreorder != 0 && final_sequence == 0)
+ if (mips_noreorder.nesting_level > 0 && final_sequence == 0)
fputs ("\n\tnop\n", file);
break;
@@ -9250,14 +9297,23 @@ mips_output_function_prologue (FILE *file, HOST_WIDE_INT size ATTRIBUTE_UNUSED)
output_asm_insn ("sll\t$2,16", 0);
output_asm_insn ("addu\t$2,$3", 0);
}
- /* .cpload must be in a .set noreorder but not a .set nomacro block. */
- else if (!cfun->machine->all_noreorder_p)
- output_asm_insn ("%(.cpload\t%^%)", 0);
else
- output_asm_insn ("%(.cpload\t%^\n\t%<", 0);
+ {
+ /* .cpload must be in a .set noreorder but not a
+ .set nomacro block. */
+ mips_push_asm_switch (&mips_noreorder);
+ output_asm_insn (".cpload\t%^", 0);
+ if (!cfun->machine->all_noreorder_p)
+ mips_pop_asm_switch (&mips_noreorder);
+ else
+ mips_push_asm_switch (&mips_nomacro);
+ }
}
else if (cfun->machine->all_noreorder_p)
- output_asm_insn ("%(%<", 0);
+ {
+ mips_push_asm_switch (&mips_noreorder);
+ mips_push_asm_switch (&mips_nomacro);
+ }
/* Tell the assembler which register we're using as the global
pointer. This is needed for thunks, since they can use either
@@ -9279,10 +9335,8 @@ mips_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
if (cfun->machine->all_noreorder_p)
{
- /* Avoid using %>%) since it adds excess whitespace. */
- output_asm_insn (".set\tmacro", 0);
- output_asm_insn (".set\treorder", 0);
- set_noreorder = set_nomacro = 0;
+ mips_pop_asm_switch (&mips_nomacro);
+ mips_pop_asm_switch (&mips_noreorder);
}
/* Get the function name the same way that toplev.c does before calling
@@ -10745,14 +10799,30 @@ mips_output_order_conditional_branch (rtx insn, rtx *operands, bool inverted_p)
return mips_output_conditional_branch (insn, operands, branch[1], branch[0]);
}
-/* Return the assembly code for __sync_*() loop LOOP. The loop should support
- both normal and likely branches, using %? and %~ where appropriate. */
+/* Return or emit the assembly code for __sync_*() loop LOOP. The
+ loop should support both normal and likely branches, using %? and
+ %~ where appropriate. If BARRIER_BEFORE is true a sync sequence is
+ emitted before the loop. A sync is always emitted after the loop.
+ OPERANDS are the insn operands. */
const char *
-mips_output_sync_loop (const char *loop)
+mips_output_sync_loop (bool barrier_before,
+ const char *loop, rtx *operands)
{
+ if (barrier_before)
+ output_asm_insn ("sync", NULL);
/* Use branch-likely instructions to work around the LL/SC R10000 errata. */
mips_branch_likely = TARGET_FIX_R10000;
+
+ /* If the target needs a sync after the loop, emit the loop now and
+ return the sync. */
+
+ if (TARGET_SYNC_AFTER_SC)
+ {
+ output_asm_insn (loop, operands);
+ loop = "sync";
+ }
+
return loop;
}
@@ -14730,36 +14800,38 @@ mips_at_reg_p (rtx *x, void *data ATTRIBUTE_UNUSED)
return REG_P (*x) && REGNO (*x) == AT_REGNUM;
}
+/* Return true if INSN needs to be wrapped in ".set noat".
+ INSN has NOPERANDS operands, stored in OPVEC. */
-/* Implement FINAL_PRESCAN_INSN. */
-
-void
-mips_final_prescan_insn (rtx insn, rtx *opvec, int noperands)
+static bool
+mips_need_noat_wrapper_p (rtx insn, rtx *opvec, int noperands)
{
int i;
- /* We need to emit ".set noat" before an instruction that accesses
- $1 (AT). */
if (recog_memoized (insn) >= 0)
for (i = 0; i < noperands; i++)
if (for_each_rtx (&opvec[i], mips_at_reg_p, NULL))
- if (set_noat++ == 0)
- fprintf (asm_out_file, "\t.set\tnoat\n");
+ return true;
+ return false;
+}
+
+/* Implement FINAL_PRESCAN_INSN. */
+
+void
+mips_final_prescan_insn (rtx insn, rtx *opvec, int noperands)
+{
+ if (mips_need_noat_wrapper_p (insn, opvec, noperands))
+ mips_push_asm_switch (&mips_noat);
}
/* Implement TARGET_ASM_FINAL_POSTSCAN_INSN. */
static void
-mips_final_postscan_insn (FILE *file, rtx insn, rtx *opvec, int noperands)
+mips_final_postscan_insn (FILE *file ATTRIBUTE_UNUSED, rtx insn,
+ rtx *opvec, int noperands)
{
- int i;
-
- /* Close any ".set noat" block opened by mips_final_prescan_insn. */
- if (recog_memoized (insn) >= 0)
- for (i = 0; i < noperands; i++)
- if (for_each_rtx (&opvec[i], mips_at_reg_p, NULL))
- if (--set_noat == 0)
- fprintf (file, "\t.set\tat\n");
+ if (mips_need_noat_wrapper_p (insn, opvec, noperands))
+ mips_pop_asm_switch (&mips_noat);
}
/* Initialize the GCC target structure. */
@@ -14851,10 +14923,8 @@ mips_final_postscan_insn (FILE *file, rtx insn, rtx *opvec, int noperands)
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR mips_gimplify_va_arg_expr
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index a3ab2f8bb8f..76ab40a1e57 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -337,7 +337,15 @@ enum mips_code_readable_setting {
in use. */
#define TARGET_HARD_FLOAT (TARGET_HARD_FLOAT_ABI && !TARGET_MIPS16)
#define TARGET_SOFT_FLOAT (TARGET_SOFT_FLOAT_ABI || TARGET_MIPS16)
-
+
+/* False if SC acts as a memory barrier with respect to itself,
+ otherwise a SYNC will be emitted after SC for atomic operations
+ that require ordering between the SC and following loads and
+ stores. It does not tell anything about ordering of loads and
+ stores prior to and following the SC, only about the SC itself and
+ those loads and stores follow it. */
+#define TARGET_SYNC_AFTER_SC (!TARGET_OCTEON)
+
/* IRIX specific stuff. */
#define TARGET_IRIX 0
#define TARGET_IRIX6 0
@@ -734,7 +742,7 @@ enum mips_code_readable_setting {
|march=r10000|march=r12000|march=r14000|march=r16000:-mips4} \
%{march=mips32|march=4kc|march=4km|march=4kp|march=4ksc:-mips32} \
%{march=mips32r2|march=m4k|march=4ke*|march=4ksd|march=24k* \
- |march=34k*|march=74k*: -mips32r2} \
+ |march=34k*|march=74k*|march=1004k*: -mips32r2} \
%{march=mips64|march=5k*|march=20k*|march=sb1*|march=sr71000 \
|march=xlr: -mips64} \
%{march=mips64r2|march=octeon: -mips64r2} \
@@ -747,7 +755,8 @@ enum mips_code_readable_setting {
#define MIPS_ARCH_FLOAT_SPEC \
"%{mhard-float|msoft-float|march=mips*:; \
march=vr41*|march=m4k|march=4k*|march=24kc|march=24kec \
- |march=34kc|march=74kc|march=5kc|march=octeon|march=xlr: -msoft-float; \
+ |march=34kc|march=74kc|march=1004kc|march=5kc \
+ |march=octeon|march=xlr: -msoft-float; \
march=*: -mhard-float}"
/* A spec condition that matches 32-bit options. It only works if
@@ -793,7 +802,7 @@ enum mips_code_readable_setting {
/* A spec that infers the -mdsp setting from an -march argument. */
#define BASE_DRIVER_SELF_SPECS \
- "%{!mno-dsp:%{march=24ke*|march=34k*|march=74k*: -mdsp}}"
+ "%{!mno-dsp:%{march=24ke*|march=34k*|march=74k*|march=1004k*: -mdsp}}"
#define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS
@@ -2204,10 +2213,10 @@ enum reg_class
#define FP_ARG_LAST (FP_ARG_FIRST + MAX_ARGS_IN_REGISTERS - 1)
#define LIBCALL_VALUE(MODE) \
- mips_function_value (NULL_TREE, MODE)
+ mips_function_value (NULL_TREE, NULL_TREE, MODE)
#define FUNCTION_VALUE(VALTYPE, FUNC) \
- mips_function_value (VALTYPE, VOIDmode)
+ mips_function_value (VALTYPE, FUNC, VOIDmode)
/* 1 if N is a possible register number for a function value.
On the MIPS, R2 R3 and F0 F2 are the only register thus used.
@@ -2355,7 +2364,7 @@ typedef struct mips_args {
else \
fprintf (FILE, "\tla\t%s,_mcount\n", reg_names[GP_REG_FIRST + 3]); \
} \
- fprintf (FILE, "\t.set\tnoat\n"); \
+ mips_push_asm_switch (&mips_noat); \
fprintf (FILE, "\tmove\t%s,%s\t\t# save current return address\n", \
reg_names[GP_REG_FIRST + 1], reg_names[GP_REG_FIRST + 31]); \
/* _mcount treats $2 as the static chain register. */ \
@@ -2375,7 +2384,7 @@ typedef struct mips_args {
fprintf (FILE, "\tjalr\t%s\n", reg_names[GP_REG_FIRST + 3]); \
else \
fprintf (FILE, "\tjal\t_mcount\n"); \
- fprintf (FILE, "\t.set\tat\n"); \
+ mips_pop_asm_switch (&mips_noat); \
/* _mcount treats $2 as the static chain register. */ \
if (cfun->static_chain_decl != NULL) \
fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \
@@ -2769,32 +2778,13 @@ typedef struct mips_args {
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) mips_print_operand_punct[CODE]
#define PRINT_OPERAND_ADDRESS mips_print_operand_address
-/* A C statement, to be executed after all slot-filler instructions
- have been output. If necessary, call `dbr_sequence_length' to
- determine the number of slots filled in a sequence (zero if not
- currently outputting a sequence), to decide how many no-ops to
- output, or whatever.
-
- Don't define this macro if it has nothing to do, but it is
- helpful in reading assembly output if the extent of the delay
- sequence is made explicit (e.g. with white space).
-
- Note that output routines for instructions with delay slots must
- be prepared to deal with not being output as part of a sequence
- (i.e. when the scheduling pass is not run, or when no slot
- fillers could be found.) The variable `final_sequence' is null
- when not processing a sequence, otherwise it contains the
- `sequence' rtx being output. */
-
#define DBR_OUTPUT_SEQEND(STREAM) \
do \
{ \
- if (set_nomacro > 0 && --set_nomacro == 0) \
- fputs ("\t.set\tmacro\n", STREAM); \
- \
- if (set_noreorder > 0 && --set_noreorder == 0) \
- fputs ("\t.set\treorder\n", STREAM); \
- \
+ /* Undo the effect of '%*'. */ \
+ mips_pop_asm_switch (&mips_nomacro); \
+ mips_pop_asm_switch (&mips_noreorder); \
+ /* Emit a blank line after the delay slot for emphasis. */ \
fputs ("\n", STREAM); \
} \
while (0)
@@ -2987,9 +2977,7 @@ while (0)
#define ASM_OUTPUT_REG_POP(STREAM,REGNO) \
do \
{ \
- if (! set_noreorder) \
- fprintf (STREAM, "\t.set\tnoreorder\n"); \
- \
+ mips_push_asm_switch (&mips_noreorder); \
fprintf (STREAM, "\t%s\t%s,0(%s)\n\t%s\t%s,%s,8\n", \
TARGET_64BIT ? "ld" : "lw", \
reg_names[REGNO], \
@@ -2997,9 +2985,7 @@ do \
TARGET_64BIT ? "daddu" : "addu", \
reg_names[STACK_POINTER_REGNUM], \
reg_names[STACK_POINTER_REGNUM]); \
- \
- if (! set_noreorder) \
- fprintf (STREAM, "\t.set\treorder\n"); \
+ mips_pop_asm_switch (&mips_noreorder); \
} \
while (0)
@@ -3143,14 +3129,12 @@ while (0)
and OP is the instruction that should be used to load %3 into a
register. */
#define MIPS_COMPARE_AND_SWAP(SUFFIX, OP) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%0,%1\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%0,%1\n" \
"\tbne\t%0,%z2,2f\n" \
"\t" OP "\t%@,%3\n" \
"\tsc" SUFFIX "\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)\n" \
+ "\tnop%-%]%>%)\n" \
"2:\n"
/* Return an asm string that atomically:
@@ -3166,16 +3150,14 @@ while (0)
OPS are the instructions needed to OR %5 with %@. */
#define MIPS_COMPARE_AND_SWAP_12(OPS) \
- "%(%<%[%|sync\n" \
- "1:\tll\t%0,%1\n" \
+ "%(%<%[%|1:\tll\t%0,%1\n" \
"\tand\t%@,%0,%2\n" \
"\tbne\t%@,%z4,2f\n" \
"\tand\t%@,%0,%3\n" \
OPS \
"\tsc\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)\n" \
+ "\tnop%-%]%>%)\n" \
"2:\n"
#define MIPS_COMPARE_AND_SWAP_12_ZERO_OP ""
@@ -3189,13 +3171,11 @@ while (0)
SUFFIX is the suffix that should be added to "ll" and "sc"
instructions. */
#define MIPS_SYNC_OP(SUFFIX, INSN) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%@,%0\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%@,%0\n" \
"\t" INSN "\t%@,%@,%1\n" \
"\tsc" SUFFIX "\t%@,%0\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
/* Return an asm string that atomically:
@@ -3212,16 +3192,14 @@ while (0)
INSN is already correctly masked -- it instead performs a bitwise
not. */
#define MIPS_SYNC_OP_12(INSN, AND_OP) \
- "%(%<%[%|sync\n" \
- "1:\tll\t%4,%0\n" \
+ "%(%<%[%|1:\tll\t%4,%0\n" \
"\tand\t%@,%4,%2\n" \
"\t" INSN "\t%4,%4,%z3\n" \
AND_OP \
"\tor\t%@,%@,%4\n" \
"\tsc\t%@,%0\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
#define MIPS_SYNC_OP_12_AND "\tand\t%4,%4,%1\n"
#define MIPS_SYNC_OP_12_XOR "\txor\t%4,%4,%1\n"
@@ -3243,16 +3221,14 @@ while (0)
INSN is already correctly masked -- it instead performs a bitwise
not. */
#define MIPS_SYNC_OLD_OP_12(INSN, AND_OP) \
- "%(%<%[%|sync\n" \
- "1:\tll\t%0,%1\n" \
+ "%(%<%[%|1:\tll\t%0,%1\n" \
"\tand\t%@,%0,%3\n" \
"\t" INSN "\t%5,%0,%z4\n" \
AND_OP \
"\tor\t%@,%@,%5\n" \
"\tsc\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
#define MIPS_SYNC_OLD_OP_12_AND "\tand\t%5,%5,%2\n"
#define MIPS_SYNC_OLD_OP_12_XOR "\txor\t%5,%5,%2\n"
@@ -3272,16 +3248,14 @@ while (0)
INSN is already correctly masked -- it instead performs a bitwise
not. */
#define MIPS_SYNC_NEW_OP_12(INSN, AND_OP) \
- "%(%<%[%|sync\n" \
- "1:\tll\t%0,%1\n" \
+ "%(%<%[%|1:\tll\t%0,%1\n" \
"\tand\t%@,%0,%3\n" \
"\t" INSN "\t%0,%0,%z4\n" \
AND_OP \
"\tor\t%@,%@,%0\n" \
"\tsc\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
#define MIPS_SYNC_NEW_OP_12_AND "\tand\t%0,%0,%2\n"
#define MIPS_SYNC_NEW_OP_12_XOR "\txor\t%0,%0,%2\n"
@@ -3295,13 +3269,11 @@ while (0)
SUFFIX is the suffix that should be added to "ll" and "sc"
instructions. */
#define MIPS_SYNC_OLD_OP(SUFFIX, INSN) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%0,%1\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%0,%1\n" \
"\t" INSN "\t%@,%0,%2\n" \
"\tsc" SUFFIX "\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
/* Return an asm string that atomically:
@@ -3312,13 +3284,11 @@ while (0)
SUFFIX is the suffix that should be added to "ll" and "sc"
instructions. */
#define MIPS_SYNC_NEW_OP(SUFFIX, INSN) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%0,%1\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%0,%1\n" \
"\t" INSN "\t%@,%0,%2\n" \
"\tsc" SUFFIX "\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b%~\n" \
- "\t" INSN "\t%0,%0,%2\n" \
- "\tsync%-%]%>%)"
+ "\t" INSN "\t%0,%0,%2%-%]%>%)"
/* Return an asm string that atomically:
@@ -3328,14 +3298,12 @@ while (0)
instructions. INSN is the and instruction needed to and a register
with %2. */
#define MIPS_SYNC_NAND(SUFFIX, INSN) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%@,%0\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%@,%0\n" \
"\t" INSN "\t%@,%@,%1\n" \
"\tnor\t%@,%@,%.\n" \
"\tsc" SUFFIX "\t%@,%0\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
/* Return an asm string that atomically:
@@ -3347,14 +3315,12 @@ while (0)
instructions. INSN is the and instruction needed to and a register
with %2. */
#define MIPS_SYNC_OLD_NAND(SUFFIX, INSN) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%0,%1\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%0,%1\n" \
"\t" INSN "\t%@,%0,%2\n" \
"\tnor\t%@,%@,%.\n" \
"\tsc" SUFFIX "\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
/* Return an asm string that atomically:
@@ -3366,14 +3332,12 @@ while (0)
instructions. INSN is the and instruction needed to and a register
with %2. */
#define MIPS_SYNC_NEW_NAND(SUFFIX, INSN) \
- "%(%<%[%|sync\n" \
- "1:\tll" SUFFIX "\t%0,%1\n" \
+ "%(%<%[%|1:\tll" SUFFIX "\t%0,%1\n" \
"\t" INSN "\t%0,%0,%2\n" \
"\tnor\t%@,%0,%.\n" \
"\tsc" SUFFIX "\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b%~\n" \
- "\tnor\t%0,%0,%.\n" \
- "\tsync%-%]%>%)"
+ "\tnor\t%0,%0,%.%-%]%>%)"
/* Return an asm string that atomically:
@@ -3390,8 +3354,7 @@ while (0)
"\t" OP "\t%@,%2\n" \
"\tsc" SUFFIX "\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
/* Return an asm string that atomically:
@@ -3414,20 +3377,29 @@ while (0)
OPS \
"\tsc\t%@,%1\n" \
"\tbeq%?\t%@,%.,1b\n" \
- "\tnop\n" \
- "\tsync%-%]%>%)"
+ "\tnop%-%]%>%)"
#define MIPS_SYNC_EXCHANGE_12_ZERO_OP ""
#define MIPS_SYNC_EXCHANGE_12_NONZERO_OP "\tor\t%@,%@,%4\n"
#ifndef USED_FOR_TARGET
+/* Information about ".set noFOO; ...; .set FOO" blocks. */
+struct mips_asm_switch {
+ /* The FOO in the description above. */
+ const char *name;
+
+ /* The current block nesting level, or 0 if we aren't in a block. */
+ int nesting_level;
+};
+
extern const enum reg_class mips_regno_to_class[];
extern bool mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
extern bool mips_print_operand_punct[256];
extern const char *current_function_file; /* filename current function is in */
extern int num_source_filenames; /* current .file # */
-extern int set_noreorder; /* # of nested .set noreorder's */
-extern int set_nomacro; /* # of nested .set nomacro's */
+extern struct mips_asm_switch mips_noreorder;
+extern struct mips_asm_switch mips_nomacro;
+extern struct mips_asm_switch mips_noat;
extern int mips_dbx_regno[];
extern int mips_dwarf_regno[];
extern bool mips_split_p[];
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index af429ca90f9..92363b3b59c 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -301,6 +301,7 @@
;; sll0 "sll DEST,SRC,0", which on 64-bit targets is guaranteed
;; to produce a sign-extended DEST, even if SRC is not
;; properly sign-extended
+;; ext_ins EXT, DEXT, INS or DINS instruction
;; andi a single ANDI instruction
;; loadpool move a constant into a MIPS16 register by loading it
;; from the pool
@@ -313,7 +314,8 @@
;; scheduling type to be "multi" instead.
(define_attr "move_type"
"unknown,load,fpload,store,fpstore,mtc,mfc,mthilo,mfhilo,move,fmove,
- const,constN,signext,arith,sll0,andi,loadpool,shift_shift,lui_movf"
+ const,constN,signext,ext_ins,logical,arith,sll0,andi,loadpool,
+ shift_shift,lui_movf"
(const_string "unknown"))
;; Main data type used by the insn
@@ -408,7 +410,9 @@
(eq_attr "move_type" "fmove") (const_string "fmove")
(eq_attr "move_type" "loadpool") (const_string "load")
(eq_attr "move_type" "signext") (const_string "signext")
+ (eq_attr "move_type" "ext_ins") (const_string "arith")
(eq_attr "move_type" "arith") (const_string "arith")
+ (eq_attr "move_type" "logical") (const_string "logical")
(eq_attr "move_type" "sll0") (const_string "shift")
(eq_attr "move_type" "andi") (const_string "logical")
@@ -2561,31 +2565,91 @@
(define_expand "and<mode>3"
[(set (match_operand:GPR 0 "register_operand")
(and:GPR (match_operand:GPR 1 "register_operand")
- (match_operand:GPR 2 "uns_arith_operand")))]
- ""
-{
- if (TARGET_MIPS16)
- operands[2] = force_reg (<MODE>mode, operands[2]);
-})
+ (match_operand:GPR 2 "and_reg_operand")))])
+
+;; The middle-end is not allowed to convert ANDing with 0xffff_ffff into a
+;; zero_extendsidi2 because of TRULY_NOOP_TRUNCATION, so handle these here.
+;; Note that this variant does not trigger for SI mode because we require
+;; a 64-bit HOST_WIDE_INT and 0xffff_ffff wouldn't be a canonical
+;; sign-extended SImode value.
+;;
+;; These are possible combinations for operand 1 and 2. The table
+;; includes both MIPS and MIPS16 cases. (r=register, mem=memory,
+;; 16=MIPS16, x=match, S=split):
+;;
+;; \ op1 r/EXT r/!EXT mem r/16 mem/16
+;; op2
+;;
+;; andi x x
+;; 0xff x x x x
+;; 0xffff x x x x
+;; 0xffff_ffff x S x S x
+;; low-bitmask x
+;; register x x
+;; register =op1 x
(define_insn "*and<mode>3"
- [(set (match_operand:GPR 0 "register_operand" "=d,d")
- (and:GPR (match_operand:GPR 1 "register_operand" "%d,d")
- (match_operand:GPR 2 "uns_arith_operand" "d,K")))]
- "!TARGET_MIPS16"
- "@
- and\t%0,%1,%2
- andi\t%0,%1,%x2"
- [(set_attr "type" "logical")
+ [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d,d,d,d")
+ (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "o,o,W,d,d,d,d")
+ (match_operand:GPR 2 "and_operand" "Yb,Yh,Yw,K,Yx,Yw,d")))]
+ "!TARGET_MIPS16 && and_operands_ok (<MODE>mode, operands[1], operands[2])"
+{
+ int len;
+
+ switch (which_alternative)
+ {
+ case 0:
+ operands[1] = gen_lowpart (QImode, operands[1]);
+ return "lbu\t%0,%1";
+ case 1:
+ operands[1] = gen_lowpart (HImode, operands[1]);
+ return "lhu\t%0,%1";
+ case 2:
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ return "lwu\t%0,%1";
+ case 3:
+ return "andi\t%0,%1,%x2";
+ case 4:
+ len = low_bitmask_len (<MODE>mode, INTVAL (operands[2]));
+ operands[2] = GEN_INT (len);
+ return "<d>ext\t%0,%1,0,%2";
+ case 5:
+ return "#";
+ case 6:
+ return "and\t%0,%1,%2";
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "move_type" "load,load,load,andi,ext_ins,shift_shift,logical")
(set_attr "mode" "<MODE>")])
(define_insn "*and<mode>3_mips16"
- [(set (match_operand:GPR 0 "register_operand" "=d")
- (and:GPR (match_operand:GPR 1 "register_operand" "%0")
- (match_operand:GPR 2 "register_operand" "d")))]
- "TARGET_MIPS16"
- "and\t%0,%2"
- [(set_attr "type" "logical")
+ [(set (match_operand:GPR 0 "register_operand" "=d,d,d,d,d")
+ (and:GPR (match_operand:GPR 1 "nonimmediate_operand" "%o,o,W,d,0")
+ (match_operand:GPR 2 "and_operand" "Yb,Yh,Yw,Yw,d")))]
+ "TARGET_MIPS16 && and_operands_ok (<MODE>mode, operands[1], operands[2])"
+{
+ switch (which_alternative)
+ {
+ case 0:
+ operands[1] = gen_lowpart (QImode, operands[1]);
+ return "lbu\t%0,%1";
+ case 1:
+ operands[1] = gen_lowpart (HImode, operands[1]);
+ return "lhu\t%0,%1";
+ case 2:
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ return "lwu\t%0,%1";
+ case 3:
+ return "#";
+ case 4:
+ return "and\t%0,%2";
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "move_type" "load,load,load,shift_shift,logical")
(set_attr "mode" "<MODE>")])
(define_expand "ior<mode>3"
@@ -2778,29 +2842,18 @@
[(set_attr "move_type" "arith,load")
(set_attr "mode" "DI")])
-;; Combine is not allowed to convert this insn into a zero_extendsidi2
-;; because of TRULY_NOOP_TRUNCATION.
+;; See the comment before the *and<mode>3 pattern why this is generated by
+;; combine.
-(define_insn_and_split "*clear_upper32"
- [(set (match_operand:DI 0 "register_operand" "=d,d")
- (and:DI (match_operand:DI 1 "nonimmediate_operand" "d,W")
+(define_split
+ [(set (match_operand:DI 0 "register_operand")
+ (and:DI (match_operand:DI 1 "register_operand")
(const_int 4294967295)))]
- "TARGET_64BIT"
-{
- if (which_alternative == 0)
- return "#";
-
- operands[1] = gen_lowpart (SImode, operands[1]);
- return "lwu\t%0,%1";
-}
- "&& reload_completed && REG_P (operands[1])"
+ "TARGET_64BIT && !ISA_HAS_EXT_INS && reload_completed"
[(set (match_dup 0)
(ashift:DI (match_dup 1) (const_int 32)))
(set (match_dup 0)
- (lshiftrt:DI (match_dup 0) (const_int 32)))]
- ""
- [(set_attr "move_type" "shift_shift,load")
- (set_attr "mode" "DI")])
+ (lshiftrt:DI (match_dup 0) (const_int 32)))])
(define_expand "zero_extend<SHORT:mode><GPR:mode>2"
[(set (match_operand:GPR 0 "register_operand")
@@ -3151,7 +3204,7 @@
(clobber (match_scratch:DF 2 "=d"))]
"TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && !ISA_HAS_TRUNC_W"
{
- if (set_nomacro)
+ if (mips_nomacro.nesting_level > 0)
return ".set\tmacro\;trunc.w.d %0,%1,%2\;.set\tnomacro";
else
return "trunc.w.d %0,%1,%2";
@@ -3188,7 +3241,7 @@
(clobber (match_scratch:SF 2 "=d"))]
"TARGET_HARD_FLOAT && !ISA_HAS_TRUNC_W"
{
- if (set_nomacro)
+ if (mips_nomacro.nesting_level > 0)
return ".set\tmacro\;trunc.w.s %0,%1,%2\;.set\tnomacro";
else
return "trunc.w.s %0,%1,%2";
@@ -4164,9 +4217,9 @@
(define_insn "*lwxs"
[(set (match_operand:IMOVE32 0 "register_operand" "=d")
(mem:IMOVE32
- (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "d")
- (const_int 4))
- (match_operand:SI 2 "register_operand" "d"))))]
+ (plus:P (mult:P (match_operand:P 1 "register_operand" "d")
+ (const_int 4))
+ (match_operand:P 2 "register_operand" "d"))))]
"ISA_HAS_LWXS"
"lwxs\t%0,%1(%2)"
[(set_attr "type" "load")
@@ -4737,7 +4790,7 @@
UNSPEC_CPRESTORE)]
""
{
- if (set_nomacro && which_alternative == 1)
+ if (mips_nomacro.nesting_level > 0 && which_alternative == 1)
return ".set\tmacro\;.cprestore\t%0\;.set\tnomacro";
else
return ".cprestore\t%0";
@@ -6206,7 +6259,7 @@
[(const_int 1)]
""
{
- if (set_noreorder)
+ if (mips_noreorder.nesting_level > 0)
return "nop";
else
return "#nop";
diff --git a/gcc/config/mips/predicates.md b/gcc/config/mips/predicates.md
index d32eaf13f8e..a9a0177197e 100644
--- a/gcc/config/mips/predicates.md
+++ b/gcc/config/mips/predicates.md
@@ -76,6 +76,39 @@
(ior (match_test "op == CONST0_RTX (GET_MODE (op))")
(match_test "op == CONST1_RTX (GET_MODE (op))"))))
+(define_predicate "qi_mask_operand"
+ (and (match_code "const_int")
+ (match_test "UINTVAL (op) == 0xff")))
+
+(define_predicate "hi_mask_operand"
+ (and (match_code "const_int")
+ (match_test "UINTVAL (op) == 0xffff")))
+
+(define_predicate "si_mask_operand"
+ (and (match_code "const_int")
+ (match_test "UINTVAL (op) == 0xffffffff")))
+
+(define_predicate "and_load_operand"
+ (ior (match_operand 0 "qi_mask_operand")
+ (match_operand 0 "hi_mask_operand")
+ (match_operand 0 "si_mask_operand")))
+
+(define_predicate "low_bitmask_operand"
+ (and (match_test "ISA_HAS_EXT_INS")
+ (match_code "const_int")
+ (match_test "low_bitmask_len (mode, INTVAL (op)) > 16")))
+
+(define_predicate "and_reg_operand"
+ (ior (match_operand 0 "register_operand")
+ (and (match_test "!TARGET_MIPS16")
+ (match_operand 0 "const_uns_arith_operand"))
+ (match_operand 0 "low_bitmask_operand")
+ (match_operand 0 "si_mask_operand")))
+
+(define_predicate "and_operand"
+ (ior (match_operand 0 "and_load_operand")
+ (match_operand 0 "and_reg_operand")))
+
(define_predicate "d_operand"
(and (match_code "reg")
(match_test "TARGET_MIPS16
diff --git a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h
index adaaa25e6cd..27dab06f298 100644
--- a/gcc/config/mips/sdemtk.h
+++ b/gcc/config/mips/sdemtk.h
@@ -93,7 +93,7 @@ extern void mips_sync_icache (void *beg, unsigned long len);
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
- fprintf (FILE, "\t.set\tnoat\n"); \
+ mips_push_asm_switch (&mips_noat); \
/* _mcount treats $2 as the static chain register. */ \
if (cfun->static_chain_decl != NULL) \
fprintf (FILE, "\tmove\t%s,%s\n", reg_names[2], \
@@ -103,7 +103,7 @@ extern void mips_sync_icache (void *beg, unsigned long len);
reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \
reg_names[GP_REG_FIRST + 31]); \
fprintf (FILE, "\tjal\t_mcount\n"); \
- fprintf (FILE, "\t.set\tat\n"); \
+ mips_pop_asm_switch (&mips_noat); \
/* _mcount treats $2 as the static chain register. */ \
if (cfun->static_chain_decl != NULL) \
fprintf (FILE, "\tmove\t%s,%s\n", reg_names[STATIC_CHAIN_REGNUM], \
diff --git a/gcc/config/mips/sync.md b/gcc/config/mips/sync.md
index cd3fdc65ace..affb3faff75 100644
--- a/gcc/config/mips/sync.md
+++ b/gcc/config/mips/sync.md
@@ -51,10 +51,12 @@
UNSPEC_COMPARE_AND_SWAP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_COMPARE_AND_SWAP ("<d>", "li"));
+ loop = MIPS_COMPARE_AND_SWAP ("<d>", "li");
else
- return mips_output_sync_loop (MIPS_COMPARE_AND_SWAP ("<d>", "move"));
+ loop = MIPS_COMPARE_AND_SWAP ("<d>", "move");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "32")])
@@ -84,12 +86,12 @@
UNSPEC_COMPARE_AND_SWAP_12))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return (mips_output_sync_loop
- (MIPS_COMPARE_AND_SWAP_12 (MIPS_COMPARE_AND_SWAP_12_NONZERO_OP)));
+ loop = MIPS_COMPARE_AND_SWAP_12 (MIPS_COMPARE_AND_SWAP_12_NONZERO_OP);
else
- return (mips_output_sync_loop
- (MIPS_COMPARE_AND_SWAP_12 (MIPS_COMPARE_AND_SWAP_12_ZERO_OP)));
+ loop = MIPS_COMPARE_AND_SWAP_12 (MIPS_COMPARE_AND_SWAP_12_ZERO_OP);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40,36")])
@@ -101,10 +103,12 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_OP ("<d>", "<d>addiu"));
+ loop = MIPS_SYNC_OP ("<d>", "<d>addiu");
else
- return mips_output_sync_loop (MIPS_SYNC_OP ("<d>", "<d>addu"));
+ loop = MIPS_SYNC_OP ("<d>", "<d>addu");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -135,8 +139,8 @@
(clobber (match_scratch:SI 4 "=&d"))]
"GENERATE_LL_SC"
{
- return (mips_output_sync_loop
- (MIPS_SYNC_OP_12 ("<insn>", MIPS_SYNC_OP_12_AND)));
+ const char *loop = MIPS_SYNC_OP_12 ("<insn>", MIPS_SYNC_OP_12_AND);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40")])
@@ -172,8 +176,8 @@
(clobber (match_scratch:SI 5 "=&d"))]
"GENERATE_LL_SC"
{
- return (mips_output_sync_loop
- (MIPS_SYNC_OLD_OP_12 ("<insn>", MIPS_SYNC_OLD_OP_12_AND)));
+ const char *loop = MIPS_SYNC_OLD_OP_12 ("<insn>", MIPS_SYNC_OLD_OP_12_AND);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40")])
@@ -214,8 +218,8 @@
(match_dup 4)] UNSPEC_SYNC_NEW_OP_12))]
"GENERATE_LL_SC"
{
- return (mips_output_sync_loop
- (MIPS_SYNC_NEW_OP_12 ("<insn>", MIPS_SYNC_NEW_OP_12_AND)));
+ const char *loop = MIPS_SYNC_NEW_OP_12 ("<insn>", MIPS_SYNC_NEW_OP_12_AND);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40")])
@@ -246,8 +250,8 @@
(clobber (match_scratch:SI 4 "=&d"))]
"GENERATE_LL_SC"
{
- return (mips_output_sync_loop
- (MIPS_SYNC_OP_12 ("and", MIPS_SYNC_OP_12_XOR)));
+ const char *loop = MIPS_SYNC_OP_12 ("and", MIPS_SYNC_OP_12_XOR);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40")])
@@ -281,8 +285,8 @@
(clobber (match_scratch:SI 5 "=&d"))]
"GENERATE_LL_SC"
{
- return (mips_output_sync_loop
- (MIPS_SYNC_OLD_OP_12 ("and", MIPS_SYNC_OLD_OP_12_XOR)));
+ const char *loop = MIPS_SYNC_OLD_OP_12 ("and", MIPS_SYNC_OLD_OP_12_XOR);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40")])
@@ -321,8 +325,8 @@
(match_dup 4)] UNSPEC_SYNC_NEW_OP_12))]
"GENERATE_LL_SC"
{
- return (mips_output_sync_loop
- (MIPS_SYNC_NEW_OP_12 ("and", MIPS_SYNC_NEW_OP_12_XOR)));
+ const char *loop = MIPS_SYNC_NEW_OP_12 ("and", MIPS_SYNC_NEW_OP_12_XOR);
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "40")])
@@ -334,7 +338,8 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
- return mips_output_sync_loop (MIPS_SYNC_OP ("<d>", "<d>subu"));
+ const char *loop = MIPS_SYNC_OP ("<d>", "<d>subu");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -348,10 +353,12 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_OLD_OP ("<d>", "<d>addiu"));
+ loop = MIPS_SYNC_OLD_OP ("<d>", "<d>addiu");
else
- return mips_output_sync_loop (MIPS_SYNC_OLD_OP ("<d>", "<d>addu"));
+ loop = MIPS_SYNC_OLD_OP ("<d>", "<d>addu");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -365,7 +372,8 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
- return mips_output_sync_loop (MIPS_SYNC_OLD_OP ("<d>", "<d>subu"));
+ const char *loop = MIPS_SYNC_OLD_OP ("<d>", "<d>subu");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -379,10 +387,12 @@
UNSPEC_SYNC_NEW_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_NEW_OP ("<d>", "<d>addiu"));
+ loop = MIPS_SYNC_NEW_OP ("<d>", "<d>addiu");
else
- return mips_output_sync_loop (MIPS_SYNC_NEW_OP ("<d>", "<d>addu"));
+ loop = MIPS_SYNC_NEW_OP ("<d>", "<d>addu");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -396,7 +406,8 @@
UNSPEC_SYNC_NEW_OP))]
"GENERATE_LL_SC"
{
- return mips_output_sync_loop (MIPS_SYNC_NEW_OP ("<d>", "<d>subu"));
+ const char *loop = MIPS_SYNC_NEW_OP ("<d>", "<d>subu");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -408,10 +419,12 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_OP ("<d>", "<immediate_insn>"));
+ loop = MIPS_SYNC_OP ("<d>", "<immediate_insn>");
else
- return mips_output_sync_loop (MIPS_SYNC_OP ("<d>", "<insn>"));
+ loop = MIPS_SYNC_OP ("<d>", "<insn>");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -425,11 +438,12 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return (mips_output_sync_loop
- (MIPS_SYNC_OLD_OP ("<d>", "<immediate_insn>")));
+ loop = MIPS_SYNC_OLD_OP ("<d>", "<immediate_insn>");
else
- return mips_output_sync_loop (MIPS_SYNC_OLD_OP ("<d>", "<insn>"));
+ loop = MIPS_SYNC_OLD_OP ("<d>", "<insn>");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -443,11 +457,12 @@
UNSPEC_SYNC_NEW_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return (mips_output_sync_loop
- (MIPS_SYNC_NEW_OP ("<d>", "<immediate_insn>")));
+ loop = MIPS_SYNC_NEW_OP ("<d>", "<immediate_insn>");
else
- return mips_output_sync_loop (MIPS_SYNC_NEW_OP ("<d>", "<insn>"));
+ loop = MIPS_SYNC_NEW_OP ("<d>", "<insn>");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "28")])
@@ -457,10 +472,12 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_NAND ("<d>", "andi"));
+ loop = MIPS_SYNC_NAND ("<d>", "andi");
else
- return mips_output_sync_loop (MIPS_SYNC_NAND ("<d>", "and"));
+ loop = MIPS_SYNC_NAND ("<d>", "and");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "32")])
@@ -472,10 +489,12 @@
UNSPEC_SYNC_OLD_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_OLD_NAND ("<d>", "andi"));
+ loop = MIPS_SYNC_OLD_NAND ("<d>", "andi");
else
- return mips_output_sync_loop (MIPS_SYNC_OLD_NAND ("<d>", "and"));
+ loop = MIPS_SYNC_OLD_NAND ("<d>", "and");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "32")])
@@ -487,10 +506,12 @@
UNSPEC_SYNC_NEW_OP))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_NEW_NAND ("<d>", "andi"));
+ loop = MIPS_SYNC_NEW_NAND ("<d>", "andi");
else
- return mips_output_sync_loop (MIPS_SYNC_NEW_NAND ("<d>", "and"));
+ loop = MIPS_SYNC_NEW_NAND ("<d>", "and");
+ return mips_output_sync_loop (true, loop, operands);
}
[(set_attr "length" "32")])
@@ -502,10 +523,12 @@
UNSPEC_SYNC_EXCHANGE))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return mips_output_sync_loop (MIPS_SYNC_EXCHANGE ("<d>", "li"));
+ loop = MIPS_SYNC_EXCHANGE ("<d>", "li");
else
- return mips_output_sync_loop (MIPS_SYNC_EXCHANGE ("<d>", "move"));
+ loop = MIPS_SYNC_EXCHANGE ("<d>", "move");
+ return mips_output_sync_loop (false, loop, operands);
}
[(set_attr "length" "24")])
@@ -532,11 +555,11 @@
UNSPEC_SYNC_EXCHANGE_12))]
"GENERATE_LL_SC"
{
+ const char *loop;
if (which_alternative == 0)
- return (mips_output_sync_loop
- (MIPS_SYNC_EXCHANGE_12 (MIPS_SYNC_EXCHANGE_12_NONZERO_OP)));
+ loop = MIPS_SYNC_EXCHANGE_12 (MIPS_SYNC_EXCHANGE_12_NONZERO_OP);
else
- return (mips_output_sync_loop
- (MIPS_SYNC_EXCHANGE_12 (MIPS_SYNC_EXCHANGE_12_ZERO_OP)));
+ loop = MIPS_SYNC_EXCHANGE_12 (MIPS_SYNC_EXCHANGE_12_ZERO_OP);
+ return mips_output_sync_loop (false, loop, operands);
}
[(set_attr "length" "28,24")])
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 67b1b2323b5..8521f374f81 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -135,6 +135,9 @@ static void mmix_file_start (void);
static void mmix_file_end (void);
static bool mmix_rtx_costs (rtx, int, int, int *, bool);
static rtx mmix_struct_value_rtx (tree, int);
+static enum machine_mode mmix_promote_function_mode (const_tree,
+ enum machine_mode,
+ int *, const_tree, int);
static bool mmix_pass_by_reference (CUMULATIVE_ARGS *,
enum machine_mode, const_tree, bool);
static bool mmix_frame_pointer_required (void);
@@ -188,14 +191,9 @@ static bool mmix_frame_pointer_required (void);
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG mmix_reorg
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#if 0
-/* Apparently not doing TRT if int < register-size. FIXME: Perhaps
- FUNCTION_VALUE and LIBCALL_VALUE needs tweaking as some ports say. */
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
-#endif
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE mmix_promote_function_mode
+
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX mmix_struct_value_rtx
@@ -2692,6 +2690,28 @@ mmix_intval (rtx x)
fatal_insn ("MMIX Internal: This is not a constant:", x);
}
+/* Worker function for TARGET_PROMOTE_FUNCTION_MODE. */
+
+enum machine_mode
+mmix_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return)
+{
+ /* Apparently not doing TRT if int < register-size. FIXME: Perhaps
+ FUNCTION_VALUE and LIBCALL_VALUE needs tweaking as some ports say. */
+ if (for_return == 1)
+ return mode;
+
+ /* Promotion of modes currently generates slow code, extending before
+ operation, so we do it only for arguments. */
+ if (GET_MODE_CLASS (mode) == MODE_INT
+ && GET_MODE_SIZE (mode) < 8)
+ return DImode;
+ else
+ return mode;
+}
/* Worker function for TARGET_STRUCT_VALUE_RTX. */
static rtx
diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h
index 72e35680ef5..41466545e21 100644
--- a/gcc/config/mmix/mmix.h
+++ b/gcc/config/mmix/mmix.h
@@ -182,23 +182,6 @@ extern int target_flags;
#define FLOAT_WORDS_BIG_ENDIAN 1
#define UNITS_PER_WORD 8
-/* FIXME: Promotion of modes currently generates slow code, extending
- before every operation. */
-/* I'm a little bit undecided about this one. It might be beneficial to
- promote all operations. */
-
-#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
- do { \
- if (GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < 8) \
- { \
- (MODE) = DImode; \
- /* Do the following some time later, \
- scrutinizing differences. */ \
- if (0) (UNSIGNEDP) = 0; \
- } \
- } while (0)
-
/* We need to align everything to 64 bits that can affect the alignment
of other types. Since address N is interpreted in MMIX as (N modulo
access_size), we must align. */
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 897717b40df..39a5c10bb69 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -284,12 +284,12 @@ moxie_expand_prologue (void)
{
insn =
emit_insn (gen_movsi
- (gen_rtx_REG (Pmode, MOXIE_R12),
+ (gen_rtx_REG (Pmode, MOXIE_R5),
GEN_INT (-cfun->machine->size_for_adjusting_sp)));
RTX_FRAME_RELATED_P (insn) = 1;
insn = emit_insn (gen_addsi3 (stack_pointer_rtx,
stack_pointer_rtx,
- gen_rtx_REG (Pmode, MOXIE_R12)));
+ gen_rtx_REG (Pmode, MOXIE_R5)));
RTX_FRAME_RELATED_P (insn) = 1;
}
}
@@ -303,7 +303,7 @@ moxie_expand_epilogue (void)
if (cfun->machine->callee_saved_reg_size != 0)
{
- reg = gen_rtx_REG (Pmode, MOXIE_R12);
+ reg = gen_rtx_REG (Pmode, MOXIE_R5);
if (cfun->machine->callee_saved_reg_size <= 255)
{
emit_move_insn (reg, hard_frame_pointer_rtx);
@@ -359,14 +359,14 @@ moxie_setup_incoming_varargs (CUMULATIVE_ARGS *cum,
int *pretend_size, int no_rtl)
{
int regno;
- int regs = 4 - *cum;
+ int regs = 7 - *cum;
*pretend_size = regs < 0 ? 0 : GET_MODE_SIZE (SImode) * regs;
if (no_rtl)
return;
- for (regno = *cum; regno < 4; regno++)
+ for (regno = *cum; regno < 7; regno++)
{
rtx reg = gen_rtx_REG (SImode, regno);
rtx slot = gen_rtx_PLUS (Pmode,
@@ -395,7 +395,7 @@ rtx
moxie_function_arg (CUMULATIVE_ARGS cum, enum machine_mode mode,
tree type ATTRIBUTE_UNUSED, int named ATTRIBUTE_UNUSED)
{
- if (cum < 4)
+ if (cum < 7)
return gen_rtx_REG (mode, cum);
else
return NULL_RTX;
@@ -420,7 +420,7 @@ moxie_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
else
size = GET_MODE_SIZE (mode);
- return size > 8;
+ return size > 4*5;
}
/* Some function arguments will only partially fit in the registers
@@ -434,7 +434,7 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum,
{
int bytes_left, size;
- if (*cum >= 4)
+ if (*cum >= 7)
return 0;
if (moxie_pass_by_reference (cum, mode, type, named))
@@ -448,7 +448,7 @@ moxie_arg_partial_bytes (CUMULATIVE_ARGS *cum,
else
size = GET_MODE_SIZE (mode);
- bytes_left = 8 - ((*cum - 2) * 4);
+ bytes_left = (4 * 5) - ((*cum - 2) * 4);
if (size > bytes_left)
return bytes_left;
diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h
index bf3d7e3eb6b..f50a6b2a27e 100644
--- a/gcc/config/moxie/moxie.h
+++ b/gcc/config/moxie/moxie.h
@@ -144,7 +144,7 @@ enum reg_class
#define REG_CLASS_CONTENTS \
{ { 0x00000000 }, /* Empty */ \
- { 0x0003FFFF }, /* $fp, $sp, $r0 to $r5, ?fp */ \
+ { 0x0003FFFF }, /* $fp, $sp, $r0 to $r13, ?fp */ \
{ 0x00040000 }, /* $pc */ \
{ 0x00080000 }, /* ?cc */ \
{ 0x000FFFFF } /* All registers */ \
@@ -166,7 +166,7 @@ enum reg_class
1, 1, 1, 1 }
#define CALL_USED_REGISTERS { 1, 1, 1, 1, \
- 0, 0, 0, 0, \
+ 1, 1, 1, 1, \
0, 0, 0, 0, \
0, 0, 1, 1, \
1, 1, 1, 1 }
@@ -263,7 +263,7 @@ enum reg_class
: (unsigned) int_size_in_bytes (TYPE))
#define FUNCTION_ARG_ADVANCE(CUM,MODE,TYPE,NAMED) \
- (CUM = (CUM < MOXIE_R2 ? \
+ (CUM = (CUM < MOXIE_R5 ? \
CUM + ((3 + MOXIE_FUNCTION_ARG_SIZE(MODE,TYPE))/4) : CUM ))
/* How Scalar Function Values Are Returned */
@@ -299,7 +299,7 @@ enum reg_class
/* Define this if it is the responsibility of the caller to allocate
the area reserved for arguments passed in registers. */
-#define REG_PARM_STACK_SPACE(FNDECL) (2 * UNITS_PER_WORD)
+#define REG_PARM_STACK_SPACE(FNDECL) (5 * UNITS_PER_WORD)
/* Offset from the argument pointer register to the first argument's
address. On some machines it may depend on the data type of the
@@ -425,7 +425,7 @@ do \
/* The register number of the stack pointer register, which must also
be a fixed register according to `FIXED_REGISTERS'. */
-#define STACK_POINTER_REGNUM 1
+#define STACK_POINTER_REGNUM MOXIE_SP
/* The register number of the frame pointer register, which is used to
access automatic variables in the stack frame. */
@@ -448,17 +448,9 @@ do \
#define HARD_FRAME_POINTER_REGNUM MOXIE_FP
-#if 0
-#define ELIMINABLE_REGS \
-{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
- { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
- { ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
- { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
-#else
#define ELIMINABLE_REGS \
{{ FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }, \
{ ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
-#endif
/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
specifies the initial difference between the specified pair of
@@ -471,7 +463,7 @@ do \
/* A C expression that is nonzero if REGNO is the number of a hard
register in which function arguments are sometimes passed. */
-#define FUNCTION_ARG_REGNO_P(r) (r == MOXIE_R0 || r == MOXIE_R1)
+#define FUNCTION_ARG_REGNO_P(r) (r >= MOXIE_R0 && r <= MOXIE_R4)
/* A C expression that is nonzero if REGNO is the number of a hard
register in which the values of called function may come back. */
diff --git a/gcc/config/moxie/uclinux.h b/gcc/config/moxie/uclinux.h
new file mode 100644
index 00000000000..0e5ee3d6b6b
--- /dev/null
+++ b/gcc/config/moxie/uclinux.h
@@ -0,0 +1,39 @@
+/* Copyright (C) 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/>. */
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC \
+ "%{!shared: crt1%O%s} crti%O%s crtbegin%O%s"
+
+#undef LINK_SPEC
+#define LINK_SPEC "-elf2flt"
+
+#define TARGET_OS_CPP_BUILTINS() LINUX_TARGET_OS_CPP_BUILTINS()
+
+/* Like the definition in gcc.c, but for purposes of uClinux, every link is
+ static. */
+#define MFWRAP_SPEC " %{fmudflap|fmudflapth: \
+ --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc\
+ --wrap=mmap --wrap=munmap --wrap=alloca\
+ %{fmudflapth: --wrap=pthread_create\
+}} %{fmudflap|fmudflapth: --wrap=main}"
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 8e8db865e2b..c5543ef1195 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -159,6 +159,9 @@ static enum reg_class pa_secondary_reload (bool, rtx, enum reg_class,
enum machine_mode,
secondary_reload_info *);
static void pa_extra_live_on_entry (bitmap);
+static enum machine_mode pa_promote_function_mode (const_tree,
+ enum machine_mode, int *,
+ const_tree, int);
/* The following extra sections are only used for SOM. */
static GTY(()) section *som_readonly_data_section;
@@ -285,8 +288,8 @@ static size_t n_deferred_plabels = 0;
#define TARGET_INIT_LIBFUNCS pa_hpux_init_libfuncs
#endif
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE pa_promote_function_mode
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
@@ -9187,11 +9190,25 @@ insn_refs_are_delayed (rtx insn)
&& get_attr_type (insn) == TYPE_MILLI));
}
+/* Promote the return value, but not the arguments. */
+
+static enum machine_mode
+pa_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return)
+{
+ if (for_return == 0)
+ return mode;
+ return promote_mode (type, mode, punsignedp);
+}
+
/* On the HP-PA the value is found in register(s) 28(-29), unless
the mode is SF or DF. Then the value is returned in fr4 (32).
- This must perform the same promotions as PROMOTE_MODE, else
- TARGET_PROMOTE_FUNCTION_RETURN will not work correctly.
+ This must perform the same promotions as PROMOTE_MODE, else promoting
+ return values in TARGET_PROMOTE_FUNCTION_MODE will not work correctly.
Small structures must be returned in a PARALLEL on PA64 in order
to match the HP Compiler ABI. */
diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c
index 358ef71e36b..ecec1f7121e 100644
--- a/gcc/config/picochip/picochip.c
+++ b/gcc/config/picochip/picochip.c
@@ -254,10 +254,8 @@ static char picochip_get_vliw_alu_id (void);
#undef TARGET_ARG_PARTIAL_BYTES
#define TARGET_ARG_PARTIAL_BYTES picochip_arg_partial_bytes
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
@@ -4144,7 +4142,7 @@ warn_of_byte_access (void)
}
rtx
-picochip_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
+picochip_function_value (const_tree valtype, const_tree func,
bool outgoing ATTRIBUTE_UNUSED)
{
enum machine_mode mode = TYPE_MODE (valtype);
@@ -4152,7 +4150,7 @@ picochip_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED,
/* Since we define PROMOTE_FUNCTION_RETURN, we must promote the mode
just as PROMOTE_MODE does. */
- mode = promote_mode (valtype, mode, &unsignedp, 1);
+ mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
return gen_rtx_REG (mode, 0);
diff --git a/gcc/config/rs6000/altivec.h b/gcc/config/rs6000/altivec.h
index 7b397997dd3..bc4f30f7cb2 100644
--- a/gcc/config/rs6000/altivec.h
+++ b/gcc/config/rs6000/altivec.h
@@ -306,6 +306,17 @@
#define vec_splats __builtin_vec_splats
#define vec_promote __builtin_vec_promote
+#ifdef __VSX__
+/* VSX additions */
+#define vec_div __builtin_vec_div
+#define vec_mul __builtin_vec_mul
+#define vec_msub __builtin_vec_msub
+#define vec_nmadd __builtin_vec_nmadd
+#define vec_nearbyint __builtin_vec_nearbyint
+#define vec_rint __builtin_vec_rint
+#define vec_sqrt __builtin_vec_sqrt
+#endif
+
/* Predicates.
For C++, we use templates in order to allow non-parenthesized arguments.
For C, instead, we use macros since non-parenthesized arguments were
@@ -356,14 +367,14 @@ __altivec_scalar_pred(vec_any_out,
__builtin_altivec_vcmpbfp_p (__CR6_EQ_REV, a1, a2))
__altivec_unary_pred(vec_all_nan,
- __builtin_altivec_vcmpeqfp_p (__CR6_EQ, a1, a1))
+ __builtin_altivec_vcmpeq_p (__CR6_EQ, a1, a1))
__altivec_unary_pred(vec_any_nan,
- __builtin_altivec_vcmpeqfp_p (__CR6_LT_REV, a1, a1))
+ __builtin_altivec_vcmpeq_p (__CR6_LT_REV, a1, a1))
__altivec_unary_pred(vec_all_numeric,
- __builtin_altivec_vcmpeqfp_p (__CR6_LT, a1, a1))
+ __builtin_altivec_vcmpeq_p (__CR6_LT, a1, a1))
__altivec_unary_pred(vec_any_numeric,
- __builtin_altivec_vcmpeqfp_p (__CR6_EQ_REV, a1, a1))
+ __builtin_altivec_vcmpeq_p (__CR6_EQ_REV, a1, a1))
__altivec_scalar_pred(vec_all_eq,
__builtin_vec_vcmpeq_p (__CR6_LT, a1, a2))
@@ -384,13 +395,13 @@ __altivec_scalar_pred(vec_any_lt,
__builtin_vec_vcmpgt_p (__CR6_EQ_REV, a2, a1))
__altivec_scalar_pred(vec_all_ngt,
- __builtin_altivec_vcmpgtfp_p (__CR6_EQ, a1, a2))
+ __builtin_altivec_vcmpgt_p (__CR6_EQ, a1, a2))
__altivec_scalar_pred(vec_all_nlt,
- __builtin_altivec_vcmpgtfp_p (__CR6_EQ, a2, a1))
+ __builtin_altivec_vcmpgt_p (__CR6_EQ, a2, a1))
__altivec_scalar_pred(vec_any_ngt,
- __builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, a1, a2))
+ __builtin_altivec_vcmpgt_p (__CR6_LT_REV, a1, a2))
__altivec_scalar_pred(vec_any_nlt,
- __builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, a2, a1))
+ __builtin_altivec_vcmpgt_p (__CR6_LT_REV, a2, a1))
/* __builtin_vec_vcmpge_p is vcmpgefp for floating-point vector types,
while for integer types it is converted to __builtin_vec_vcmpgt_p,
@@ -405,13 +416,13 @@ __altivec_scalar_pred(vec_any_ge,
__builtin_vec_vcmpge_p (__CR6_EQ_REV, a1, a2))
__altivec_scalar_pred(vec_all_nge,
- __builtin_altivec_vcmpgefp_p (__CR6_EQ, a1, a2))
+ __builtin_altivec_vcmpge_p (__CR6_EQ, a1, a2))
__altivec_scalar_pred(vec_all_nle,
- __builtin_altivec_vcmpgefp_p (__CR6_EQ, a2, a1))
+ __builtin_altivec_vcmpge_p (__CR6_EQ, a2, a1))
__altivec_scalar_pred(vec_any_nge,
- __builtin_altivec_vcmpgefp_p (__CR6_LT_REV, a1, a2))
+ __builtin_altivec_vcmpge_p (__CR6_LT_REV, a1, a2))
__altivec_scalar_pred(vec_any_nle,
- __builtin_altivec_vcmpgefp_p (__CR6_LT_REV, a2, a1))
+ __builtin_altivec_vcmpge_p (__CR6_LT_REV, a2, a1))
#undef __altivec_scalar_pred
#undef __altivec_unary_pred
@@ -423,11 +434,11 @@ __altivec_scalar_pred(vec_any_nle,
#define vec_all_in(a1, a2) __builtin_altivec_vcmpbfp_p (__CR6_EQ, (a1), (a2))
#define vec_any_out(a1, a2) __builtin_altivec_vcmpbfp_p (__CR6_EQ_REV, (a1), (a2))
-#define vec_all_nan(a1) __builtin_altivec_vcmpeqfp_p (__CR6_EQ, (a1), (a1))
-#define vec_any_nan(a1) __builtin_altivec_vcmpeqfp_p (__CR6_LT_REV, (a1), (a1))
+#define vec_all_nan(a1) __builtin_vec_vcmpeq_p (__CR6_EQ, (a1), (a1))
+#define vec_any_nan(a1) __builtin_vec_vcmpeq_p (__CR6_LT_REV, (a1), (a1))
-#define vec_all_numeric(a1) __builtin_altivec_vcmpeqfp_p (__CR6_LT, (a1), (a1))
-#define vec_any_numeric(a1) __builtin_altivec_vcmpeqfp_p (__CR6_EQ_REV, (a1), (a1))
+#define vec_all_numeric(a1) __builtin_vec_vcmpeq_p (__CR6_LT, (a1), (a1))
+#define vec_any_numeric(a1) __builtin_vec_vcmpeq_p (__CR6_EQ_REV, (a1), (a1))
#define vec_all_eq(a1, a2) __builtin_vec_vcmpeq_p (__CR6_LT, (a1), (a2))
#define vec_all_ne(a1, a2) __builtin_vec_vcmpeq_p (__CR6_EQ, (a1), (a2))
@@ -439,10 +450,10 @@ __altivec_scalar_pred(vec_any_nle,
#define vec_any_gt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_EQ_REV, (a1), (a2))
#define vec_any_lt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_EQ_REV, (a2), (a1))
-#define vec_all_ngt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_EQ, (a1), (a2))
-#define vec_all_nlt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_EQ, (a2), (a1))
-#define vec_any_ngt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, (a1), (a2))
-#define vec_any_nlt(a1, a2) __builtin_altivec_vcmpgtfp_p (__CR6_LT_REV, (a2), (a1))
+#define vec_all_ngt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_EQ, (a1), (a2))
+#define vec_all_nlt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_EQ, (a2), (a1))
+#define vec_any_ngt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_LT_REV, (a1), (a2))
+#define vec_any_nlt(a1, a2) __builtin_vec_vcmpgt_p (__CR6_LT_REV, (a2), (a1))
/* __builtin_vec_vcmpge_p is vcmpgefp for floating-point vector types,
while for integer types it is converted to __builtin_vec_vcmpgt_p,
@@ -452,10 +463,10 @@ __altivec_scalar_pred(vec_any_nle,
#define vec_any_le(a1, a2) __builtin_vec_vcmpge_p (__CR6_EQ_REV, (a2), (a1))
#define vec_any_ge(a1, a2) __builtin_vec_vcmpge_p (__CR6_EQ_REV, (a1), (a2))
-#define vec_all_nge(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_EQ, (a1), (a2))
-#define vec_all_nle(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_EQ, (a2), (a1))
-#define vec_any_nge(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_LT_REV, (a1), (a2))
-#define vec_any_nle(a1, a2) __builtin_altivec_vcmpgefp_p (__CR6_LT_REV, (a2), (a1))
+#define vec_all_nge(a1, a2) __builtin_vec_vcmpge_p (__CR6_EQ, (a1), (a2))
+#define vec_all_nle(a1, a2) __builtin_vec_vcmpge_p (__CR6_EQ, (a2), (a1))
+#define vec_any_nge(a1, a2) __builtin_vec_vcmpge_p (__CR6_LT_REV, (a1), (a2))
+#define vec_any_nle(a1, a2) __builtin_vec_vcmpge_p (__CR6_LT_REV, (a2), (a1))
#endif
/* These do not accept vectors, so they do not have a __builtin_vec_*
diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md
index 58af47c15ce..53b1054d200 100644
--- a/gcc/config/rs6000/altivec.md
+++ b/gcc/config/rs6000/altivec.md
@@ -20,8 +20,8 @@
;; <http://www.gnu.org/licenses/>.
(define_constants
- [(UNSPEC_VCMPBFP 50)
;; 51-62 deleted
+ [(UNSPEC_VCMPBFP 64)
(UNSPEC_VMSUMU 65)
(UNSPEC_VMSUMM 66)
(UNSPEC_VMSUMSHM 68)
@@ -66,9 +66,9 @@
(UNSPEC_VSUMSWS 135)
(UNSPEC_VPERM 144)
(UNSPEC_VPERM_UNS 145)
- (UNSPEC_VRFIP 148)
+ ;; 148 deleted
(UNSPEC_VRFIN 149)
- (UNSPEC_VRFIM 150)
+ ;; 150 deleted
(UNSPEC_VCFUX 151)
(UNSPEC_VCFSX 152)
(UNSPEC_VCTUXS 153)
@@ -220,6 +220,35 @@
}
[(set_attr "type" "vecstore,vecload,vecsimple,store,load,*,vecsimple,*")])
+;; Load up a vector with the most significant bit set by loading up -1 and
+;; doing a shift left
+(define_split
+ [(set (match_operand:VM 0 "altivec_register_operand" "")
+ (match_operand:VM 1 "easy_vector_constant_msb" ""))]
+ "VECTOR_UNIT_ALTIVEC_P (<MODE>mode) && reload_completed"
+ [(const_int 0)]
+{
+ rtx dest = operands[0];
+ enum machine_mode mode = GET_MODE (operands[0]);
+ rtvec v;
+ int i, num_elements;
+
+ if (mode == V4SFmode)
+ {
+ mode = V4SImode;
+ dest = gen_lowpart (V4SImode, dest);
+ }
+
+ num_elements = GET_MODE_NUNITS (mode);
+ v = rtvec_alloc (num_elements);
+ for (i = 0; i < num_elements; i++)
+ RTVEC_ELT (v, i) = constm1_rtx;
+
+ emit_insn (gen_vec_initv4si (dest, gen_rtx_PARALLEL (mode, v)));
+ emit_insn (gen_rtx_SET (VOIDmode, dest, gen_rtx_ASHIFT (mode, dest, dest)));
+ DONE;
+})
+
(define_split
[(set (match_operand:VM 0 "altivec_register_operand" "")
(match_operand:VM 1 "easy_vector_constant_add_self" ""))]
@@ -1310,7 +1339,7 @@
"vspltis<VI_char> %0,%1"
[(set_attr "type" "vecperm")])
-(define_insn "*altivec_ftruncv4sf2"
+(define_insn "*altivec_vrfiz"
[(set (match_operand:V4SF 0 "register_operand" "=v")
(fix:V4SF (match_operand:V4SF 1 "register_operand" "v")))]
"VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
@@ -1337,10 +1366,10 @@
"vperm %0,%1,%2,%3"
[(set_attr "type" "vecperm")])
-(define_insn "altivec_vrfip"
+(define_insn "altivec_vrfip" ; ceil
[(set (match_operand:V4SF 0 "register_operand" "=v")
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
- UNSPEC_VRFIP))]
+ UNSPEC_FRIP))]
"TARGET_ALTIVEC"
"vrfip %0,%1"
[(set_attr "type" "vecfloat")])
@@ -1353,10 +1382,10 @@
"vrfin %0,%1"
[(set_attr "type" "vecfloat")])
-(define_insn "altivec_vrfim"
+(define_insn "*altivec_vrfim" ; floor
[(set (match_operand:V4SF 0 "register_operand" "=v")
(unspec:V4SF [(match_operand:V4SF 1 "register_operand" "v")]
- UNSPEC_VRFIM))]
+ UNSPEC_FRIM))]
"TARGET_ALTIVEC"
"vrfim %0,%1"
[(set_attr "type" "vecfloat")])
@@ -1431,6 +1460,28 @@
"vrefp %0,%1"
[(set_attr "type" "vecfloat")])
+(define_expand "altivec_copysign_v4sf3"
+ [(use (match_operand:V4SF 0 "register_operand" ""))
+ (use (match_operand:V4SF 1 "register_operand" ""))
+ (use (match_operand:V4SF 2 "register_operand" ""))]
+ "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
+ "
+{
+ rtx mask = gen_reg_rtx (V4SImode);
+ rtvec v = rtvec_alloc (4);
+ unsigned HOST_WIDE_INT mask_val = ((unsigned HOST_WIDE_INT)1) << 31;
+
+ RTVEC_ELT (v, 0) = GEN_INT (mask_val);
+ RTVEC_ELT (v, 1) = GEN_INT (mask_val);
+ RTVEC_ELT (v, 2) = GEN_INT (mask_val);
+ RTVEC_ELT (v, 3) = GEN_INT (mask_val);
+
+ emit_insn (gen_vec_initv4si (mask, gen_rtx_PARALLEL (V4SImode, v)));
+ emit_insn (gen_vector_select_v4sf (operands[0], operands[1], operands[2],
+ gen_lowpart (V4SFmode, mask)));
+ DONE;
+}")
+
(define_insn "altivec_vsldoi_<mode>"
[(set (match_operand:VM 0 "register_operand" "=v")
(unspec:VM [(match_operand:VM 1 "register_operand" "v")
diff --git a/gcc/config/rs6000/freebsd.h b/gcc/config/rs6000/freebsd.h
index b4dea55417d..bc2a10bb7a3 100644
--- a/gcc/config/rs6000/freebsd.h
+++ b/gcc/config/rs6000/freebsd.h
@@ -1,5 +1,5 @@
/* Definitions for PowerPC running FreeBSD using the ELF format
- Copyright (C) 2001, 2003, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2003, 2007, 2009 Free Software Foundation, Inc.
Contributed by David E. O'Brien <obrien@FreeBSD.org> and BSDi.
This file is part of GCC.
@@ -69,3 +69,6 @@
/* Override rs6000.h definition. */
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
+/* Define SVR4_ASM_SPEC, we use GAS by default. See svr4.h for details. */
+#define SVR4_ASM_SPEC \
+ "%{v:-V} %{Wa,*:%*}"
diff --git a/gcc/config/rs6000/power7.md b/gcc/config/rs6000/power7.md
new file mode 100644
index 00000000000..3b6a95e284e
--- /dev/null
+++ b/gcc/config/rs6000/power7.md
@@ -0,0 +1,318 @@
+;; Scheduling description for IBM POWER7 processor.
+;; Copyright (C) 2009 Free Software Foundation, Inc.
+;;
+;; Contributed by Pat Haugen (pthaugen@us.ibm.com).
+
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 3, or (at your
+;; option) any later version.
+;;
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+(define_automaton "power7iu,power7lsu,power7vsu,power7misc")
+
+(define_cpu_unit "iu1_power7,iu2_power7" "power7iu")
+(define_cpu_unit "lsu1_power7,lsu2_power7" "power7lsu")
+(define_cpu_unit "vsu1_power7,vsu2_power7" "power7vsu")
+(define_cpu_unit "bpu_power7,cru_power7" "power7misc")
+(define_cpu_unit "du1_power7,du2_power7,du3_power7,du4_power7,du5_power7"
+ "power7misc")
+
+
+(define_reservation "DU_power7"
+ "du1_power7|du2_power7|du3_power7|du4_power7")
+
+(define_reservation "DU2F_power7"
+ "du1_power7+du2_power7")
+
+(define_reservation "DU4_power7"
+ "du1_power7+du2_power7+du3_power7+du4_power7")
+
+(define_reservation "FXU_power7"
+ "iu1_power7|iu2_power7")
+
+(define_reservation "VSU_power7"
+ "vsu1_power7|vsu2_power7")
+
+(define_reservation "LSU_power7"
+ "lsu1_power7|lsu2_power7")
+
+
+; Dispatch slots are allocated in order conforming to program order.
+(absence_set "du1_power7" "du2_power7,du3_power7,du4_power7,du5_power7")
+(absence_set "du2_power7" "du3_power7,du4_power7,du5_power7")
+(absence_set "du3_power7" "du4_power7,du5_power7")
+(absence_set "du4_power7" "du5_power7")
+
+
+; LS Unit
+(define_insn_reservation "power7-load" 2
+ (and (eq_attr "type" "load")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7")
+
+(define_insn_reservation "power7-load-ext" 3
+ (and (eq_attr "type" "load_ext")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,LSU_power7,FXU_power7")
+
+(define_insn_reservation "power7-load-update" 2
+ (and (eq_attr "type" "load_u")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,LSU_power7+FXU_power7")
+
+(define_insn_reservation "power7-load-update-indexed" 3
+ (and (eq_attr "type" "load_ux")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,FXU_power7,LSU_power7+FXU_power7")
+
+(define_insn_reservation "power7-load-ext-update" 4
+ (and (eq_attr "type" "load_ext_u")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,LSU_power7+FXU_power7,FXU_power7")
+
+(define_insn_reservation "power7-load-ext-update-indexed" 4
+ (and (eq_attr "type" "load_ext_ux")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,FXU_power7,LSU_power7+FXU_power7,FXU_power7")
+
+(define_insn_reservation "power7-fpload" 3
+ (and (eq_attr "type" "fpload")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7")
+
+(define_insn_reservation "power7-fpload-update" 3
+ (and (eq_attr "type" "fpload_u,fpload_ux")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,LSU_power7+FXU_power7")
+
+(define_insn_reservation "power7-store" 6 ; store-forwarding latency
+ (and (eq_attr "type" "store")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7+FXU_power7")
+
+(define_insn_reservation "power7-store-update" 6
+ (and (eq_attr "type" "store_u")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,LSU_power7+FXU_power7,FXU_power7")
+
+(define_insn_reservation "power7-store-update-indexed" 6
+ (and (eq_attr "type" "store_ux")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,LSU_power7+FXU_power7,FXU_power7")
+
+(define_insn_reservation "power7-fpstore" 6
+ (and (eq_attr "type" "fpstore")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7+VSU_power7")
+
+(define_insn_reservation "power7-fpstore-update" 6
+ (and (eq_attr "type" "fpstore_u,fpstore_ux")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7+VSU_power7+FXU_power7")
+
+(define_insn_reservation "power7-larx" 3
+ (and (eq_attr "type" "load_l")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,LSU_power7")
+
+(define_insn_reservation "power7-stcx" 10
+ (and (eq_attr "type" "store_c")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,LSU_power7")
+
+(define_insn_reservation "power7-vecload" 3
+ (and (eq_attr "type" "vecload")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7")
+
+(define_insn_reservation "power7-vecstore" 6
+ (and (eq_attr "type" "vecstore")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,LSU_power7+VSU_power7")
+
+(define_insn_reservation "power7-sync" 11
+ (and (eq_attr "type" "sync")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,LSU_power7")
+
+
+; FX Unit
+(define_insn_reservation "power7-integer" 1
+ (and (eq_attr "type" "integer,insert_word,insert_dword,shift,trap,\
+ var_shift_rotate,exts")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,FXU_power7")
+
+(define_insn_reservation "power7-cntlz" 2
+ (and (eq_attr "type" "cntlz")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,FXU_power7")
+
+(define_insn_reservation "power7-two" 2
+ (and (eq_attr "type" "two")
+ (eq_attr "cpu" "power7"))
+ "DU_power7+DU_power7,FXU_power7,FXU_power7")
+
+(define_insn_reservation "power7-three" 3
+ (and (eq_attr "type" "three")
+ (eq_attr "cpu" "power7"))
+ "DU_power7+DU_power7+DU_power7,FXU_power7,FXU_power7,FXU_power7")
+
+(define_insn_reservation "power7-cmp" 1
+ (and (eq_attr "type" "cmp,fast_compare")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,FXU_power7")
+
+(define_insn_reservation "power7-compare" 2
+ (and (eq_attr "type" "compare,delayed_compare,var_delayed_compare")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,FXU_power7,FXU_power7")
+
+(define_bypass 3 "power7-cmp,power7-compare" "power7-crlogical,power7-delayedcr")
+
+(define_insn_reservation "power7-mul" 4
+ (and (eq_attr "type" "imul,imul2,imul3,lmul")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,FXU_power7")
+
+(define_insn_reservation "power7-mul-compare" 5
+ (and (eq_attr "type" "imul_compare,lmul_compare")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,FXU_power7,nothing*3,FXU_power7")
+
+(define_insn_reservation "power7-idiv" 36
+ (and (eq_attr "type" "idiv")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,iu1_power7*36|iu2_power7*36")
+
+(define_insn_reservation "power7-ldiv" 68
+ (and (eq_attr "type" "ldiv")
+ (eq_attr "cpu" "power7"))
+ "DU2F_power7,iu1_power7*68|iu2_power7*68")
+
+(define_insn_reservation "power7-isync" 1 ;
+ (and (eq_attr "type" "isync")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,FXU_power7")
+
+
+; CR Unit
+(define_insn_reservation "power7-mtjmpr" 4
+ (and (eq_attr "type" "mtjmpr")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,FXU_power7")
+
+(define_insn_reservation "power7-mfjmpr" 5
+ (and (eq_attr "type" "mfjmpr")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,cru_power7+FXU_power7")
+
+(define_insn_reservation "power7-crlogical" 3
+ (and (eq_attr "type" "cr_logical")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,cru_power7")
+
+(define_insn_reservation "power7-delayedcr" 3
+ (and (eq_attr "type" "delayed_cr")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,cru_power7")
+
+(define_insn_reservation "power7-mfcr" 6
+ (and (eq_attr "type" "mfcr")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,cru_power7")
+
+(define_insn_reservation "power7-mfcrf" 3
+ (and (eq_attr "type" "mfcrf")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,cru_power7")
+
+(define_insn_reservation "power7-mtcr" 3
+ (and (eq_attr "type" "mtcr")
+ (eq_attr "cpu" "power7"))
+ "DU4_power7,cru_power7+FXU_power7")
+
+
+; BR Unit
+; Branches take dispatch Slot 4. The presence_sets prevent other insn from
+; grabbing previous dispatch slots once this is assigned.
+(define_insn_reservation "power7-branch" 3
+ (and (eq_attr "type" "jmpreg,branch")
+ (eq_attr "cpu" "power7"))
+ "(du5_power7\
+ |du4_power7+du5_power7\
+ |du3_power7+du4_power7+du5_power7\
+ |du2_power7+du3_power7+du4_power7+du5_power7\
+ |du1_power7+du2_power7+du3_power7+du4_power7+du5_power7),bpu_power7")
+
+
+; VS Unit (includes FP/VSX/VMX/DFP)
+(define_insn_reservation "power7-fp" 6
+ (and (eq_attr "type" "fp,dmul")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,VSU_power7")
+
+(define_bypass 8 "power7-fp" "power7-branch")
+
+(define_insn_reservation "power7-fpcompare" 4
+ (and (eq_attr "type" "fpcompare")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,VSU_power7")
+
+(define_insn_reservation "power7-sdiv" 26
+ (and (eq_attr "type" "sdiv")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,VSU_power7")
+
+(define_insn_reservation "power7-ddiv" 32
+ (and (eq_attr "type" "ddiv")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,VSU_power7")
+
+(define_insn_reservation "power7-sqrt" 31
+ (and (eq_attr "type" "ssqrt")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,VSU_power7")
+
+(define_insn_reservation "power7-dsqrt" 43
+ (and (eq_attr "type" "dsqrt")
+ (eq_attr "cpu" "power7"))
+ "DU_power7,VSU_power7")
+
+(define_insn_reservation "power7-vecsimple" 2
+ (and (eq_attr "type" "vecsimple")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,VSU_power7")
+
+(define_insn_reservation "power7-veccmp" 7
+ (and (eq_attr "type" "veccmp")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,VSU_power7")
+
+(define_insn_reservation "power7-vecfloat" 7
+ (and (eq_attr "type" "vecfloat")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,VSU_power7")
+
+(define_bypass 6 "power7-vecfloat" "power7-vecfloat")
+
+(define_insn_reservation "power7-veccomplex" 7
+ (and (eq_attr "type" "veccomplex")
+ (eq_attr "cpu" "power7"))
+ "du1_power7,VSU_power7")
+
+(define_insn_reservation "power7-vecperm" 3
+ (and (eq_attr "type" "vecperm")
+ (eq_attr "cpu" "power7"))
+ "du2_power7,VSU_power7")
diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h
index 147f1092753..c963eb98abb 100644
--- a/gcc/config/rs6000/ppc-asm.h
+++ b/gcc/config/rs6000/ppc-asm.h
@@ -87,7 +87,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define f16 16
#define f17 17
#define f18 18
-#define f19 19
+#define f19 19
#define f20 20
#define f21 21
#define f22 22
@@ -101,6 +101,143 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define f30 30
#define f31 31
+#ifdef __VSX__
+#define f32 32
+#define f33 33
+#define f34 34
+#define f35 35
+#define f36 36
+#define f37 37
+#define f38 38
+#define f39 39
+#define f40 40
+#define f41 41
+#define f42 42
+#define f43 43
+#define f44 44
+#define f45 45
+#define f46 46
+#define f47 47
+#define f48 48
+#define f49 49
+#define f50 30
+#define f51 51
+#define f52 52
+#define f53 53
+#define f54 54
+#define f55 55
+#define f56 56
+#define f57 57
+#define f58 58
+#define f59 59
+#define f60 60
+#define f61 61
+#define f62 62
+#define f63 63
+#endif
+
+#ifdef __ALTIVEC__
+#define v0 0
+#define v1 1
+#define v2 2
+#define v3 3
+#define v4 4
+#define v5 5
+#define v6 6
+#define v7 7
+#define v8 8
+#define v9 9
+#define v10 10
+#define v11 11
+#define v12 12
+#define v13 13
+#define v14 14
+#define v15 15
+#define v16 16
+#define v17 17
+#define v18 18
+#define v19 19
+#define v20 20
+#define v21 21
+#define v22 22
+#define v23 23
+#define v24 24
+#define v25 25
+#define v26 26
+#define v27 27
+#define v28 28
+#define v29 29
+#define v30 30
+#define v31 31
+#endif
+
+#ifdef __VSX__
+#define vs0 0
+#define vs1 1
+#define vs2 2
+#define vs3 3
+#define vs4 4
+#define vs5 5
+#define vs6 6
+#define vs7 7
+#define vs8 8
+#define vs9 9
+#define vs10 10
+#define vs11 11
+#define vs12 12
+#define vs13 13
+#define vs14 14
+#define vs15 15
+#define vs16 16
+#define vs17 17
+#define vs18 18
+#define vs19 19
+#define vs20 20
+#define vs21 21
+#define vs22 22
+#define vs23 23
+#define vs24 24
+#define vs25 25
+#define vs26 26
+#define vs27 27
+#define vs28 28
+#define vs29 29
+#define vs30 30
+#define vs31 31
+#define vs32 32
+#define vs33 33
+#define vs34 34
+#define vs35 35
+#define vs36 36
+#define vs37 37
+#define vs38 38
+#define vs39 39
+#define vs40 40
+#define vs41 41
+#define vs42 42
+#define vs43 43
+#define vs44 44
+#define vs45 45
+#define vs46 46
+#define vs47 47
+#define vs48 48
+#define vs49 49
+#define vs50 30
+#define vs51 51
+#define vs52 52
+#define vs53 53
+#define vs54 54
+#define vs55 55
+#define vs56 56
+#define vs57 57
+#define vs58 58
+#define vs59 59
+#define vs60 60
+#define vs61 61
+#define vs62 62
+#define vs63 63
+#endif
+
/*
* Macros to glue together two tokens.
*/
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index 3e5c1a1a8df..cf25cb7bf0f 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -377,6 +377,16 @@
return EASY_VECTOR_15_ADD_SELF (val);
})
+;; Same as easy_vector_constant but only for EASY_VECTOR_MSB.
+(define_predicate "easy_vector_constant_msb"
+ (and (match_code "const_vector")
+ (and (match_test "TARGET_ALTIVEC")
+ (match_test "easy_altivec_constant (op, mode)")))
+{
+ HOST_WIDE_INT val = const_vector_elt_as_int (op, GET_MODE_NUNITS (mode) - 1);
+ return EASY_VECTOR_MSB (val, GET_MODE_INNER (mode));
+})
+
;; Return 1 if operand is constant zero (scalars and vectors).
(define_predicate "zero_constant"
(and (match_code "const_int,const_double,const_vector")
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 3b3ba96b5cd..94354528ebf 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -214,7 +214,8 @@ rs6000_macro_to_expand (cpp_reader *pfile, const cpp_token *tok)
if (rid_code == RID_UNSIGNED || rid_code == RID_LONG
|| rid_code == RID_SHORT || rid_code == RID_SIGNED
|| rid_code == RID_INT || rid_code == RID_CHAR
- || rid_code == RID_FLOAT)
+ || rid_code == RID_FLOAT
+ || (rid_code == RID_DOUBLE && TARGET_VSX))
{
expand_this = C_CPP_HASHNODE (__vector_keyword);
/* If the next keyword is bool or pixel, it
@@ -329,7 +330,42 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile)
if (TARGET_NO_LWSYNC)
builtin_define ("__NO_LWSYNC__");
if (TARGET_VSX)
- builtin_define ("__VSX__");
+ {
+ builtin_define ("__VSX__");
+
+ /* For the VSX builtin functions identical to Altivec functions, just map
+ the altivec builtin into the vsx version (the altivec functions
+ generate VSX code if -mvsx). */
+ builtin_define ("__builtin_vsx_xxland=__builtin_vec_and");
+ builtin_define ("__builtin_vsx_xxlandc=__builtin_vec_andc");
+ builtin_define ("__builtin_vsx_xxlnor=__builtin_vec_nor");
+ builtin_define ("__builtin_vsx_xxlor=__builtin_vec_or");
+ builtin_define ("__builtin_vsx_xxlxor=__builtin_vec_xor");
+ builtin_define ("__builtin_vsx_xxsel=__builtin_vec_sel");
+ builtin_define ("__builtin_vsx_vperm=__builtin_vec_perm");
+
+ /* Also map the a and m versions of the multiply/add instructions to the
+ builtin for people blindly going off the instruction manual. */
+ builtin_define ("__builtin_vsx_xvmaddadp=__builtin_vsx_xvmadddp");
+ builtin_define ("__builtin_vsx_xvmaddmdp=__builtin_vsx_xvmadddp");
+ builtin_define ("__builtin_vsx_xvmaddasp=__builtin_vsx_xvmaddsp");
+ builtin_define ("__builtin_vsx_xvmaddmsp=__builtin_vsx_xvmaddsp");
+ builtin_define ("__builtin_vsx_xvmsubadp=__builtin_vsx_xvmsubdp");
+ builtin_define ("__builtin_vsx_xvmsubmdp=__builtin_vsx_xvmsubdp");
+ builtin_define ("__builtin_vsx_xvmsubasp=__builtin_vsx_xvmsubsp");
+ builtin_define ("__builtin_vsx_xvmsubmsp=__builtin_vsx_xvmsubsp");
+ builtin_define ("__builtin_vsx_xvnmaddadp=__builtin_vsx_xvnmadddp");
+ builtin_define ("__builtin_vsx_xvnmaddmdp=__builtin_vsx_xvnmadddp");
+ builtin_define ("__builtin_vsx_xvnmaddasp=__builtin_vsx_xvnmaddsp");
+ builtin_define ("__builtin_vsx_xvnmaddmsp=__builtin_vsx_xvnmaddsp");
+ builtin_define ("__builtin_vsx_xvnmsubadp=__builtin_vsx_xvnmsubdp");
+ builtin_define ("__builtin_vsx_xvnmsubmdp=__builtin_vsx_xvnmsubdp");
+ builtin_define ("__builtin_vsx_xvnmsubasp=__builtin_vsx_xvnmsubsp");
+ builtin_define ("__builtin_vsx_xvnmsubmsp=__builtin_vsx_xvnmsubsp");
+ }
+
+ /* Tell users they can use __builtin_bswap{16,64}. */
+ builtin_define ("__HAVE_BSWAP__");
/* May be overridden by target configuration. */
RS6000_CPU_CPP_ENDIAN_BUILTINS();
@@ -393,7 +429,7 @@ struct altivec_builtin_types
};
const struct altivec_builtin_types altivec_overloaded_builtins[] = {
- /* Unary AltiVec builtins. */
+ /* Unary AltiVec/VSX builtins. */
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V16QI,
RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V8HI,
@@ -402,6 +438,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SF,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_ABS, VSX_BUILTIN_XVABSDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABSS, ALTIVEC_BUILTIN_ABSS_V16QI,
RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABSS, ALTIVEC_BUILTIN_ABSS_V8HI,
@@ -410,8 +448,12 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_CEIL, ALTIVEC_BUILTIN_VRFIP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_CEIL, VSX_BUILTIN_XVRDPIP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_EXPTE, ALTIVEC_BUILTIN_VEXPTEFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_FLOOR, VSX_BUILTIN_XVRDPIM,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_FLOOR, ALTIVEC_BUILTIN_VRFIM,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_LOGE, ALTIVEC_BUILTIN_VLOGEFP,
@@ -444,6 +486,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_TRUNC, ALTIVEC_BUILTIN_VRFIZ,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_TRUNC, VSX_BUILTIN_XVRDPIZ,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHSB,
RS6000_BTI_V8HI, RS6000_BTI_V16QI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_UNPACKH, ALTIVEC_BUILTIN_VUPKHSB,
@@ -489,7 +533,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_VUPKLSB, ALTIVEC_BUILTIN_VUPKLSB,
RS6000_BTI_bool_V8HI, RS6000_BTI_bool_V16QI, 0, 0 },
- /* Binary AltiVec builtins. */
+ /* Binary AltiVec/VSX builtins. */
{ ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUBM,
RS6000_BTI_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDUBM,
@@ -528,6 +572,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_ADD, ALTIVEC_BUILTIN_VADDFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_ADD, VSX_BUILTIN_XVADDDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VADDFP, ALTIVEC_BUILTIN_VADDFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_VADDUWM, ALTIVEC_BUILTIN_VADDUWM,
@@ -673,9 +719,9 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_AND, ALTIVEC_BUILTIN_VAND,
RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_AND, ALTIVEC_BUILTIN_VAND,
- RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_AND, ALTIVEC_BUILTIN_VAND,
- RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, RS6000_BTI_V2DF, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_AND, ALTIVEC_BUILTIN_VAND,
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_AND, ALTIVEC_BUILTIN_VAND,
@@ -727,9 +773,9 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_ANDC, ALTIVEC_BUILTIN_VANDC,
RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_ANDC, ALTIVEC_BUILTIN_VANDC,
- RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_ANDC, ALTIVEC_BUILTIN_VANDC,
- RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, RS6000_BTI_V2DF, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_ANDC, ALTIVEC_BUILTIN_VANDC,
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_ANDC, ALTIVEC_BUILTIN_VANDC,
@@ -812,6 +858,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_bool_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPEQ, ALTIVEC_BUILTIN_VCMPEQFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_CMPEQ, VSX_BUILTIN_XVCMPEQDP,
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VCMPEQFP, ALTIVEC_BUILTIN_VCMPEQFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
@@ -832,6 +880,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_CMPGE, ALTIVEC_BUILTIN_VCMPGEFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_CMPGE, VSX_BUILTIN_XVCMPGEDP,
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTUB,
RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTSB,
@@ -846,6 +896,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPGT, ALTIVEC_BUILTIN_VCMPGTFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_CMPGT, VSX_BUILTIN_XVCMPGTDP,
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VCMPGTFP, ALTIVEC_BUILTIN_VCMPGTFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_VCMPGTSW, ALTIVEC_BUILTIN_VCMPGTSW,
@@ -874,6 +926,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPLE, ALTIVEC_BUILTIN_VCMPGEFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_CMPLE, VSX_BUILTIN_XVCMPGEDP,
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTUB,
RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTSB,
@@ -888,6 +942,12 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_CMPLT, ALTIVEC_BUILTIN_VCMPGTFP,
RS6000_BTI_bool_V4SI, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_CMPLT, VSX_BUILTIN_XVCMPGTDP,
+ RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
+ { ALTIVEC_BUILTIN_VEC_COPYSIGN, VSX_BUILTIN_CPSGNDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
+ { ALTIVEC_BUILTIN_VEC_COPYSIGN, ALTIVEC_BUILTIN_COPYSIGN_V4SF,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_CTF, ALTIVEC_BUILTIN_VCFUX,
RS6000_BTI_V4SF, RS6000_BTI_unsigned_V4SI, RS6000_BTI_INTSI, 0 },
{ ALTIVEC_BUILTIN_VEC_CTF, ALTIVEC_BUILTIN_VCFSX,
@@ -900,6 +960,10 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V4SF, RS6000_BTI_INTSI, 0 },
{ ALTIVEC_BUILTIN_VEC_CTU, ALTIVEC_BUILTIN_VCTUXS,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_V4SF, RS6000_BTI_INTSI, 0 },
+ { VSX_BUILTIN_VEC_DIV, VSX_BUILTIN_XVDIVSP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { VSX_BUILTIN_VEC_DIV, VSX_BUILTIN_XVDIVDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX,
RS6000_BTI_V4SF, RS6000_BTI_INTSI, ~RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_LD, ALTIVEC_BUILTIN_LVX,
@@ -1234,6 +1298,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_MAX, ALTIVEC_BUILTIN_VMAXFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_MAX, VSX_BUILTIN_XVMAXDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VMAXFP, ALTIVEC_BUILTIN_VMAXFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_VMAXSW, ALTIVEC_BUILTIN_VMAXSW,
@@ -1410,6 +1476,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_MIN, ALTIVEC_BUILTIN_VMINFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_MIN, VSX_BUILTIN_XVMINDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VMINFP, ALTIVEC_BUILTIN_VMINFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_VMINSW, ALTIVEC_BUILTIN_VMINSW,
@@ -1460,6 +1528,10 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_VMINUB, ALTIVEC_BUILTIN_VMINUB,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_bool_V16QI, 0 },
+ { VSX_BUILTIN_VEC_MUL, VSX_BUILTIN_XVMULSP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { VSX_BUILTIN_VEC_MUL, VSX_BUILTIN_XVMULDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_MULE, ALTIVEC_BUILTIN_VMULEUB,
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_MULE, ALTIVEC_BUILTIN_VMULESB,
@@ -1492,6 +1564,10 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V8HI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_VMULOUB, ALTIVEC_BUILTIN_VMULOUB,
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
+ { ALTIVEC_BUILTIN_VEC_NEARBYINT, VSX_BUILTIN_XVRDPI,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_NEARBYINT, VSX_BUILTIN_XVRSPI,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_NOR, ALTIVEC_BUILTIN_VNOR,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_NOR, ALTIVEC_BUILTIN_VNOR,
@@ -1523,9 +1599,9 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_OR, ALTIVEC_BUILTIN_VOR,
RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_OR, ALTIVEC_BUILTIN_VOR,
- RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_OR, ALTIVEC_BUILTIN_VOR,
- RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, RS6000_BTI_V2DF, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_OR, ALTIVEC_BUILTIN_VOR,
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_OR, ALTIVEC_BUILTIN_VOR,
@@ -1622,6 +1698,10 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKSHUS, ALTIVEC_BUILTIN_VPKSHUS,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
+ { ALTIVEC_BUILTIN_VEC_RINT, VSX_BUILTIN_XVRDPIC,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_RINT, VSX_BUILTIN_XVRSPIC,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_RL, ALTIVEC_BUILTIN_VRLB,
RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
{ ALTIVEC_BUILTIN_VEC_RL, ALTIVEC_BUILTIN_VRLB,
@@ -1658,6 +1738,10 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_SL, ALTIVEC_BUILTIN_VSLW,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
+ { ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0, 0 },
+ { ALTIVEC_BUILTIN_VEC_SQRT, VSX_BUILTIN_XVSQRTSP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_VSLW, ALTIVEC_BUILTIN_VSLW,
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_VSLW, ALTIVEC_BUILTIN_VSLW,
@@ -1984,6 +2068,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_SUB, ALTIVEC_BUILTIN_VSUBFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
+ { ALTIVEC_BUILTIN_VEC_SUB, VSX_BUILTIN_XVSUBDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_VSUBFP, ALTIVEC_BUILTIN_VSUBFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0 },
{ ALTIVEC_BUILTIN_VEC_VSUBUWM, ALTIVEC_BUILTIN_VSUBUWM,
@@ -2145,9 +2231,9 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_XOR, ALTIVEC_BUILTIN_VXOR,
RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_XOR, ALTIVEC_BUILTIN_VXOR,
- RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_XOR, ALTIVEC_BUILTIN_VXOR,
- RS6000_BTI_V2DF, RS6000_BTI_bool_V4SI, RS6000_BTI_V2DF, 0 },
+ RS6000_BTI_V2DF, RS6000_BTI_bool_V2DI, RS6000_BTI_V2DF, 0 },
{ ALTIVEC_BUILTIN_VEC_XOR, ALTIVEC_BUILTIN_VXOR,
RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_XOR, ALTIVEC_BUILTIN_VXOR,
@@ -2191,7 +2277,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ ALTIVEC_BUILTIN_VEC_XOR, ALTIVEC_BUILTIN_VXOR,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, 0 },
- /* Ternary AltiVec builtins. */
+ /* Ternary AltiVec/VSX builtins. */
{ ALTIVEC_BUILTIN_VEC_DST, ALTIVEC_BUILTIN_DST,
RS6000_BTI_void, ~RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, RS6000_BTI_INTSI },
{ ALTIVEC_BUILTIN_VEC_DST, ALTIVEC_BUILTIN_DST,
@@ -2354,6 +2440,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_void, ~RS6000_BTI_float, RS6000_BTI_INTSI, RS6000_BTI_INTSI },
{ ALTIVEC_BUILTIN_VEC_MADD, ALTIVEC_BUILTIN_VMADDFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { ALTIVEC_BUILTIN_VEC_MADD, VSX_BUILTIN_XVMADDDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ ALTIVEC_BUILTIN_VEC_MADDS, ALTIVEC_BUILTIN_VMHADDSHS,
RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI },
{ ALTIVEC_BUILTIN_VEC_MLADD, ALTIVEC_BUILTIN_VMLADDUHM,
@@ -2366,6 +2454,10 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI },
{ ALTIVEC_BUILTIN_VEC_MRADDS, ALTIVEC_BUILTIN_VMHRADDSHS,
RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI },
+ { VSX_BUILTIN_VEC_MSUB, VSX_BUILTIN_XVMSUBSP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { VSX_BUILTIN_VEC_MSUB, VSX_BUILTIN_XVMSUBDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ ALTIVEC_BUILTIN_VEC_MSUM, ALTIVEC_BUILTIN_VMSUMUBM,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V4SI },
{ ALTIVEC_BUILTIN_VEC_MSUM, ALTIVEC_BUILTIN_VMSUMMBM,
@@ -2390,8 +2482,14 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_V4SI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V4SI },
{ ALTIVEC_BUILTIN_VEC_VMSUMUHS, ALTIVEC_BUILTIN_VMSUMUHS,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI },
+ { VSX_BUILTIN_VEC_NMADD, VSX_BUILTIN_XVNMADDSP,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { VSX_BUILTIN_VEC_NMADD, VSX_BUILTIN_XVNMADDDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ ALTIVEC_BUILTIN_VEC_NMSUB, ALTIVEC_BUILTIN_VNMSUBFP,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { ALTIVEC_BUILTIN_VEC_NMSUB, VSX_BUILTIN_XVNMSUBDP,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ ALTIVEC_BUILTIN_VEC_PERM, ALTIVEC_BUILTIN_VPERM_2DF,
RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_unsigned_V16QI },
{ ALTIVEC_BUILTIN_VEC_PERM, ALTIVEC_BUILTIN_VPERM_2DI,
@@ -2812,6 +2910,54 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_unsigned_V16QI },
{ ALTIVEC_BUILTIN_VEC_STVRXL, ALTIVEC_BUILTIN_STVRXL,
RS6000_BTI_void, RS6000_BTI_unsigned_V16QI, RS6000_BTI_INTSI, ~RS6000_BTI_UINTQI },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_16QI,
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_8HI,
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_8HI,
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_4SI,
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_4SI,
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_2DI,
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_2DI,
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_4SF,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXSLDWI, VSX_BUILTIN_XXSLDWI_2DF,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_2DF,
+ RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_V2DF, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_2DI,
+ RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_2DI,
+ RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_4SF,
+ RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_V4SF, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_4SI,
+ RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_4SI,
+ RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_8HI,
+ RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_8HI,
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V8HI,
+ RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_16QI,
+ RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_V16QI, RS6000_BTI_NOT_OPAQUE },
+ { VSX_BUILTIN_VEC_XXPERMDI, VSX_BUILTIN_XXPERMDI_16QI,
+ RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
+ RS6000_BTI_NOT_OPAQUE },
/* Predicates. */
{ ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTUB_P,
@@ -2852,6 +2998,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
{ ALTIVEC_BUILTIN_VCMPGT_P, ALTIVEC_BUILTIN_VCMPGTFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { ALTIVEC_BUILTIN_VCMPGT_P, VSX_BUILTIN_XVCMPGTDP_P,
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQUB_P,
@@ -2900,6 +3048,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_bool_V4SI, RS6000_BTI_bool_V4SI },
{ ALTIVEC_BUILTIN_VCMPEQ_P, ALTIVEC_BUILTIN_VCMPEQFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { ALTIVEC_BUILTIN_VCMPEQ_P, VSX_BUILTIN_XVCMPEQDP_P,
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
/* cmpge is the same as cmpgt for all cases except floating point.
@@ -2943,6 +3093,8 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SI, RS6000_BTI_V4SI },
{ ALTIVEC_BUILTIN_VCMPGE_P, ALTIVEC_BUILTIN_VCMPGEFP_P,
RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V4SF, RS6000_BTI_V4SF },
+ { ALTIVEC_BUILTIN_VCMPGE_P, VSX_BUILTIN_XVCMPGEDP_P,
+ RS6000_BTI_INTSI, RS6000_BTI_INTSI, RS6000_BTI_V2DF, RS6000_BTI_V2DF },
{ (enum rs6000_builtins) 0, (enum rs6000_builtins) 0, 0, 0, 0, 0 }
};
@@ -3064,8 +3216,10 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
const struct altivec_builtin_types *desc;
unsigned int n;
- if (fcode < ALTIVEC_BUILTIN_OVERLOADED_FIRST
- || fcode > ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ if ((fcode < ALTIVEC_BUILTIN_OVERLOADED_FIRST
+ || fcode > ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ && (fcode < VSX_BUILTIN_OVERLOADED_FIRST
+ || fcode > VSX_BUILTIN_OVERLOADED_LAST))
return NULL_TREE;
/* For now treat vec_splats and vec_promote as the same. */
@@ -3105,11 +3259,12 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
&& !INTEGRAL_TYPE_P (type))
goto bad;
unsigned_p = TYPE_UNSIGNED (type);
- if (type == long_long_unsigned_type_node
- || type == long_long_integer_type_node)
- goto bad;
switch (TYPE_MODE (type))
{
+ case DImode:
+ type = (unsigned_p ? unsigned_V2DI_type_node : V2DI_type_node);
+ size = 2;
+ break;
case SImode:
type = (unsigned_p ? unsigned_V4SI_type_node : V4SI_type_node);
size = 4;
@@ -3123,6 +3278,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
size = 16;
break;
case SFmode: type = V4SF_type_node; size = 4; break;
+ case DFmode: type = V2DF_type_node; size = 2; break;
default:
goto bad;
}
@@ -3139,7 +3295,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
return build_constructor (type, vec);
}
- /* For now use pointer tricks to do the extaction. */
+ /* For now use pointer tricks to do the extaction, unless we are on VSX
+ extracting a double from a constant offset. */
if (fcode == ALTIVEC_BUILTIN_VEC_EXTRACT)
{
tree arg1;
@@ -3148,6 +3305,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
tree arg1_inner_type;
tree decl, stmt;
tree innerptrtype;
+ enum machine_mode mode;
/* No second argument. */
if (nargs != 2)
@@ -3164,6 +3322,25 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
goto bad;
if (!INTEGRAL_TYPE_P (TREE_TYPE (arg2)))
goto bad;
+
+ /* If we can use the VSX xxpermdi instruction, use that for extract. */
+ mode = TYPE_MODE (arg1_type);
+ if ((mode == V2DFmode || mode == V2DImode) && VECTOR_MEM_VSX_P (mode)
+ && TREE_CODE (arg2) == INTEGER_CST
+ && TREE_INT_CST_HIGH (arg2) == 0
+ && (TREE_INT_CST_LOW (arg2) == 0 || TREE_INT_CST_LOW (arg2) == 1))
+ {
+ tree call = NULL_TREE;
+
+ if (mode == V2DFmode)
+ call = rs6000_builtin_decls[VSX_BUILTIN_VEC_EXT_V2DF];
+ else if (mode == V2DImode)
+ call = rs6000_builtin_decls[VSX_BUILTIN_VEC_EXT_V2DI];
+
+ if (call)
+ return build_call_expr (call, 2, arg1, arg2);
+ }
+
/* Build *(((arg1_inner_type*)&(vector type){arg1})+arg2). */
arg1_inner_type = TREE_TYPE (arg1_type);
arg2 = build_binary_op (loc, BIT_AND_EXPR, arg2,
@@ -3193,7 +3370,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
return stmt;
}
- /* For now use pointer tricks to do the insertation. */
+ /* For now use pointer tricks to do the insertation, unless we are on VSX
+ inserting a double to a constant offset.. */
if (fcode == ALTIVEC_BUILTIN_VEC_INSERT)
{
tree arg0;
@@ -3203,7 +3381,8 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
tree arg1_inner_type;
tree decl, stmt;
tree innerptrtype;
-
+ enum machine_mode mode;
+
/* No second or third arguments. */
if (nargs != 3)
{
@@ -3220,6 +3399,27 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl,
goto bad;
if (!INTEGRAL_TYPE_P (TREE_TYPE (arg2)))
goto bad;
+
+ /* If we can use the VSX xxpermdi instruction, use that for insert. */
+ mode = TYPE_MODE (arg1_type);
+ if ((mode == V2DFmode || mode == V2DImode) && VECTOR_UNIT_VSX_P (mode)
+ && TREE_CODE (arg2) == INTEGER_CST
+ && TREE_INT_CST_HIGH (arg2) == 0
+ && (TREE_INT_CST_LOW (arg2) == 0 || TREE_INT_CST_LOW (arg2) == 1))
+ {
+ tree call = NULL_TREE;
+
+ if (mode == V2DFmode)
+ call = rs6000_builtin_decls[VSX_BUILTIN_VEC_SET_V2DF];
+ else if (mode == V2DImode)
+ call = rs6000_builtin_decls[VSX_BUILTIN_VEC_SET_V2DI];
+
+ /* Note, __builtin_vec_insert_<xxx> has vector and scalar types
+ reversed. */
+ if (call)
+ return build_call_expr (call, 3, arg1, arg0, arg2);
+ }
+
/* Build *(((arg1_inner_type*)&(vector type){arg1})+arg2) = arg0. */
arg1_inner_type = TREE_TYPE (arg1_type);
arg2 = build_binary_op (loc, BIT_AND_EXPR, arg2,
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 085f7f4f3a1..52c53e69507 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -837,6 +837,7 @@ static rtx rs6000_emit_stack_reset (rs6000_stack_t *, rtx, rtx, int, bool);
static rtx rs6000_make_savres_rtx (rs6000_stack_t *, rtx, int,
enum machine_mode, bool, bool, bool);
static bool rs6000_reg_live_or_pic_offset_p (int);
+static tree rs6000_builtin_vectorized_function (unsigned int, tree, tree);
static int rs6000_savres_strategy (rs6000_stack_t *, bool, int, int);
static void rs6000_restore_saved_cr (rtx, int);
static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT);
@@ -1347,10 +1348,8 @@ static const struct attribute_spec rs6000_attribute_table[] =
/* On rs6000, function arguments are promoted, as are function return
values. */
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY rs6000_return_in_memory
@@ -1396,6 +1395,10 @@ static const struct attribute_spec rs6000_attribute_table[] =
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION rs6000_handle_option
+#undef TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION
+#define TARGET_VECTORIZE_BUILTIN_VECTORIZED_FUNCTION \
+ rs6000_builtin_vectorized_function
+
#undef TARGET_DEFAULT_TARGET_FLAGS
#define TARGET_DEFAULT_TARGET_FLAGS \
(TARGET_DEFAULT)
@@ -1875,20 +1878,14 @@ rs6000_init_hard_regno_mode_ok (void)
}
}
- /* V2DImode, prefer vsx over altivec, since the main use will be for
- vectorized floating point conversions. */
+ /* V2DImode, only allow under VSX, which can do V2DI insert/splat/extract.
+ Altivec doesn't have 64-bit support. */
if (TARGET_VSX)
{
rs6000_vector_mem[V2DImode] = VECTOR_VSX;
rs6000_vector_unit[V2DImode] = VECTOR_NONE;
rs6000_vector_align[V2DImode] = align64;
}
- else if (TARGET_ALTIVEC)
- {
- rs6000_vector_mem[V2DImode] = VECTOR_ALTIVEC;
- rs6000_vector_unit[V2DImode] = VECTOR_NONE;
- rs6000_vector_align[V2DImode] = align64;
- }
/* DFmode, see if we want to use the VSX unit. */
if (TARGET_VSX && TARGET_VSX_SCALAR_DOUBLE)
@@ -2173,7 +2170,7 @@ rs6000_override_options (const char *default_cpu)
{"power7", PROCESSOR_POWER7,
POWERPC_7400_MASK | MASK_POWERPC64 | MASK_PPC_GPOPT | MASK_MFCRF
| MASK_POPCNTB | MASK_FPRND | MASK_CMPB | MASK_DFP | MASK_POPCNTD
- /* | MASK_VSX */}, /* Don't add MASK_ISEL by default */
+ | MASK_VSX}, /* Don't add MASK_ISEL by default */
{"powerpc", PROCESSOR_POWERPC, POWERPC_BASE_MASK},
{"powerpc64", PROCESSOR_POWERPC64,
POWERPC_BASE_MASK | MASK_PPC_GFXOPT | MASK_POWERPC64},
@@ -2769,6 +2766,14 @@ rs6000_builtin_conversion (unsigned int tcode, tree type)
case FIX_TRUNC_EXPR:
switch (TYPE_MODE (type))
{
+ case V2DImode:
+ if (!VECTOR_UNIT_VSX_P (V2DFmode))
+ return NULL_TREE;
+
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[VSX_BUILTIN_XVCVDPUXDS_UNS]
+ : rs6000_builtin_decls[VSX_BUILTIN_XVCVDPSXDS];
+
case V4SImode:
if (VECTOR_UNIT_NONE_P (V4SImode) || VECTOR_UNIT_NONE_P (V4SFmode))
return NULL_TREE;
@@ -2784,6 +2789,14 @@ rs6000_builtin_conversion (unsigned int tcode, tree type)
case FLOAT_EXPR:
switch (TYPE_MODE (type))
{
+ case V2DImode:
+ if (!VECTOR_UNIT_VSX_P (V2DFmode))
+ return NULL_TREE;
+
+ return TYPE_UNSIGNED (type)
+ ? rs6000_builtin_decls[VSX_BUILTIN_XVCVUXDDP]
+ : rs6000_builtin_decls[VSX_BUILTIN_XVCVSXDDP];
+
case V4SImode:
if (VECTOR_UNIT_NONE_P (V4SImode) || VECTOR_UNIT_NONE_P (V4SFmode))
return NULL_TREE;
@@ -2912,6 +2925,22 @@ rs6000_builtin_vec_perm (tree type, tree *mask_element_type)
d = rs6000_builtin_decls[ALTIVEC_BUILTIN_VPERM_4SF];
break;
+ case V2DFmode:
+ if (!TARGET_ALLOW_DF_PERMUTE)
+ return NULL_TREE;
+
+ d = rs6000_builtin_decls[ALTIVEC_BUILTIN_VPERM_2DF];
+ break;
+
+ case V2DImode:
+ if (!TARGET_ALLOW_DF_PERMUTE)
+ return NULL_TREE;
+
+ d = (uns_p
+ ? rs6000_builtin_decls[ALTIVEC_BUILTIN_VPERM_2DI_UNS]
+ : rs6000_builtin_decls[ALTIVEC_BUILTIN_VPERM_2DI]);
+ break;
+
default:
return NULL_TREE;
}
@@ -2985,6 +3014,136 @@ rs6000_parse_fpu_option (const char *option)
return FPU_NONE;
}
+/* Returns a function decl for a vectorized version of the builtin function
+ with builtin function code FN and the result vector type TYPE, or NULL_TREE
+ if it is not available. */
+
+static tree
+rs6000_builtin_vectorized_function (unsigned int fn, tree type_out,
+ tree type_in)
+{
+ enum machine_mode in_mode, out_mode;
+ int in_n, out_n;
+
+ if (TREE_CODE (type_out) != VECTOR_TYPE
+ || TREE_CODE (type_in) != VECTOR_TYPE
+ || !TARGET_VECTORIZE_BUILTINS)
+ return NULL_TREE;
+
+ out_mode = TYPE_MODE (TREE_TYPE (type_out));
+ out_n = TYPE_VECTOR_SUBPARTS (type_out);
+ in_mode = TYPE_MODE (TREE_TYPE (type_in));
+ in_n = TYPE_VECTOR_SUBPARTS (type_in);
+
+ switch (fn)
+ {
+ case BUILT_IN_COPYSIGN:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_CPSGNDP];
+ break;
+ case BUILT_IN_COPYSIGNF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_CPSGNSP];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_COPYSIGN_V4SF];
+ break;
+ case BUILT_IN_SQRT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVSQRTDP];
+ break;
+ case BUILT_IN_SQRTF:
+ if (VECTOR_UNIT_VSX_P (V4SFmode)
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVSQRTSP];
+ break;
+ case BUILT_IN_CEIL:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIP];
+ break;
+ case BUILT_IN_CEILF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIP];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIP];
+ break;
+ case BUILT_IN_FLOOR:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIM];
+ break;
+ case BUILT_IN_FLOORF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIM];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIM];
+ break;
+ case BUILT_IN_TRUNC:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIZ];
+ break;
+ case BUILT_IN_TRUNCF:
+ if (out_mode != SFmode || out_n != 4
+ || in_mode != SFmode || in_n != 4)
+ break;
+ if (VECTOR_UNIT_VSX_P (V4SFmode))
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIZ];
+ if (VECTOR_UNIT_ALTIVEC_P (V4SFmode))
+ return rs6000_builtin_decls[ALTIVEC_BUILTIN_VRFIZ];
+ break;
+ case BUILT_IN_NEARBYINT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && flag_unsafe_math_optimizations
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPI];
+ break;
+ case BUILT_IN_NEARBYINTF:
+ if (VECTOR_UNIT_VSX_P (V4SFmode)
+ && flag_unsafe_math_optimizations
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPI];
+ break;
+ case BUILT_IN_RINT:
+ if (VECTOR_UNIT_VSX_P (V2DFmode)
+ && !flag_trapping_math
+ && out_mode == DFmode && out_n == 2
+ && in_mode == DFmode && in_n == 2)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRDPIC];
+ break;
+ case BUILT_IN_RINTF:
+ if (VECTOR_UNIT_VSX_P (V4SFmode)
+ && !flag_trapping_math
+ && out_mode == SFmode && out_n == 4
+ && in_mode == SFmode && in_n == 4)
+ return rs6000_builtin_decls[VSX_BUILTIN_XVRSPIC];
+ break;
+ default:
+ break;
+ }
+ return NULL_TREE;
+}
+
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -3625,6 +3784,11 @@ vspltis_constant (rtx op, unsigned step, unsigned copies)
&& (splat_val >= 0 || (step == 1 && copies == 1)))
;
+ /* Also check if are loading up the most significant bit which can be done by
+ loading up -1 and shifting the value left by -1. */
+ else if (EASY_VECTOR_MSB (splat_val, inner))
+ ;
+
else
return false;
@@ -3975,8 +4139,6 @@ rs6000_expand_vector_init (rtx target, rtx vals)
emit_insn (gen_rtx_SET (VOIDmode, target, const_vec));
return;
}
- else if (all_same && int_vector_p)
- ; /* Splat vector element. */
else
{
/* Load from constant pool. */
@@ -3985,8 +4147,66 @@ rs6000_expand_vector_init (rtx target, rtx vals)
}
}
- /* Store value to stack temp. Load vector element. Splat. */
- if (all_same)
+ /* Double word values on VSX can use xxpermdi or lxvdsx. */
+ if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode))
+ {
+ if (all_same)
+ {
+ rtx element = XVECEXP (vals, 0, 0);
+ if (mode == V2DFmode)
+ emit_insn (gen_vsx_splat_v2df (target, element));
+ else
+ emit_insn (gen_vsx_splat_v2di (target, element));
+ }
+ else
+ {
+ rtx op0 = copy_to_reg (XVECEXP (vals, 0, 0));
+ rtx op1 = copy_to_reg (XVECEXP (vals, 0, 1));
+ if (mode == V2DFmode)
+ emit_insn (gen_vsx_concat_v2df (target, op0, op1));
+ else
+ emit_insn (gen_vsx_concat_v2di (target, op0, op1));
+ }
+ return;
+ }
+
+ /* With single precision floating point on VSX, know that internally single
+ precision is actually represented as a double, and either make 2 V2DF
+ vectors, and convert these vectors to single precision, or do one
+ conversion, and splat the result to the other elements. */
+ if (mode == V4SFmode && VECTOR_MEM_VSX_P (mode))
+ {
+ if (all_same)
+ {
+ rtx freg = gen_reg_rtx (V4SFmode);
+ rtx sreg = copy_to_reg (XVECEXP (vals, 0, 0));
+
+ emit_insn (gen_vsx_xscvdpsp_scalar (freg, sreg));
+ emit_insn (gen_vsx_xxspltw_v4sf (target, freg, const0_rtx));
+ }
+ else
+ {
+ rtx dbl_even = gen_reg_rtx (V2DFmode);
+ rtx dbl_odd = gen_reg_rtx (V2DFmode);
+ rtx flt_even = gen_reg_rtx (V4SFmode);
+ rtx flt_odd = gen_reg_rtx (V4SFmode);
+
+ emit_insn (gen_vsx_concat_v2sf (dbl_even,
+ copy_to_reg (XVECEXP (vals, 0, 0)),
+ copy_to_reg (XVECEXP (vals, 0, 1))));
+ emit_insn (gen_vsx_concat_v2sf (dbl_odd,
+ copy_to_reg (XVECEXP (vals, 0, 2)),
+ copy_to_reg (XVECEXP (vals, 0, 3))));
+ emit_insn (gen_vsx_xvcvdpsp (flt_even, dbl_even));
+ emit_insn (gen_vsx_xvcvdpsp (flt_odd, dbl_odd));
+ emit_insn (gen_vec_extract_evenv4sf (target, flt_even, flt_odd));
+ }
+ return;
+ }
+
+ /* Store value to stack temp. Load vector element. Splat. However, splat
+ of 64-bit items is not supported on Altivec. */
+ if (all_same && GET_MODE_SIZE (mode) <= 4)
{
mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode), 0);
emit_move_insn (adjust_address_nv (mem, inner_mode, 0),
@@ -4044,6 +4264,14 @@ rs6000_expand_vector_set (rtx target, rtx val, int elt)
int width = GET_MODE_SIZE (inner_mode);
int i;
+ if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode))
+ {
+ rtx (*set_func) (rtx, rtx, rtx, rtx)
+ = ((mode == V2DFmode) ? gen_vsx_set_v2df : gen_vsx_set_v2di);
+ emit_insn (set_func (target, target, val, GEN_INT (elt)));
+ return;
+ }
+
/* Load single variable value. */
mem = assign_stack_temp (mode, GET_MODE_SIZE (inner_mode), 0);
emit_move_insn (adjust_address_nv (mem, inner_mode, 0), val);
@@ -4081,6 +4309,14 @@ rs6000_expand_vector_extract (rtx target, rtx vec, int elt)
enum machine_mode inner_mode = GET_MODE_INNER (mode);
rtx mem, x;
+ if (VECTOR_MEM_VSX_P (mode) && (mode == V2DFmode || mode == V2DImode))
+ {
+ rtx (*extract_func) (rtx, rtx, rtx)
+ = ((mode == V2DFmode) ? gen_vsx_extract_v2df : gen_vsx_extract_v2di);
+ emit_insn (extract_func (target, vec, GEN_INT (elt)));
+ return;
+ }
+
/* Allocate mode-sized buffer. */
mem = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
@@ -4625,6 +4861,8 @@ static rtx
rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
enum machine_mode mode)
{
+ unsigned int extra = 0;
+
if (!reg_offset_addressing_ok_p (mode))
{
if (virtual_stack_registers_memory_p (x))
@@ -4649,10 +4887,33 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
if (model != 0)
return rs6000_legitimize_tls_address (x, model);
}
+
+ switch (mode)
+ {
+ case DFmode:
+ case DDmode:
+ extra = 4;
+ break;
+ case DImode:
+ if (!TARGET_POWERPC64)
+ extra = 4;
+ break;
+ case TFmode:
+ case TDmode:
+ extra = 12;
+ break;
+ case TImode:
+ extra = TARGET_POWERPC64 ? 8 : 12;
+ break;
+ default:
+ break;
+ }
+
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 0)) == REG
&& GET_CODE (XEXP (x, 1)) == CONST_INT
- && (unsigned HOST_WIDE_INT) (INTVAL (XEXP (x, 1)) + 0x8000) >= 0x10000
+ && ((unsigned HOST_WIDE_INT) (INTVAL (XEXP (x, 1)) + 0x8000)
+ >= 0x10000 - extra)
&& !((TARGET_POWERPC64
&& (mode == DImode || mode == TImode)
&& (INTVAL (XEXP (x, 1)) & 3) != 0)
@@ -4664,10 +4925,12 @@ rs6000_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
HOST_WIDE_INT high_int, low_int;
rtx sum;
low_int = ((INTVAL (XEXP (x, 1)) & 0xffff) ^ 0x8000) - 0x8000;
+ if (low_int >= 0x8000 - extra)
+ low_int = 0;
high_int = INTVAL (XEXP (x, 1)) - low_int;
sum = force_operand (gen_rtx_PLUS (Pmode, XEXP (x, 0),
GEN_INT (high_int)), 0);
- return gen_rtx_PLUS (Pmode, sum, GEN_INT (low_int));
+ return plus_constant (sum, low_int);
}
else if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 0)) == REG
@@ -5478,6 +5741,10 @@ rs6000_mode_dependent_address (rtx addr)
case PRE_MODIFY:
return TARGET_UPDATE;
+ /* AND is only allowed in Altivec loads. */
+ case AND:
+ return true;
+
default:
break;
}
@@ -6079,6 +6346,8 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
case V2SFmode:
case V2SImode:
case V1DImode:
+ case V2DFmode:
+ case V2DImode:
if (CONSTANT_P (operands[1])
&& !easy_vector_constant (operands[1], mode))
operands[1] = force_const_mem (mode, operands[1]);
@@ -8223,6 +8492,59 @@ static const struct builtin_description bdesc_3arg[] =
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_perm", ALTIVEC_BUILTIN_VEC_PERM },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sel", ALTIVEC_BUILTIN_VEC_SEL },
+ { MASK_VSX, CODE_FOR_vsx_fmaddv2df4, "__builtin_vsx_xvmadddp", VSX_BUILTIN_XVMADDDP },
+ { MASK_VSX, CODE_FOR_vsx_fmsubv2df4, "__builtin_vsx_xvmsubdp", VSX_BUILTIN_XVMSUBDP },
+ { MASK_VSX, CODE_FOR_vsx_fnmaddv2df4, "__builtin_vsx_xvnmadddp", VSX_BUILTIN_XVNMADDDP },
+ { MASK_VSX, CODE_FOR_vsx_fnmsubv2df4, "__builtin_vsx_xvnmsubdp", VSX_BUILTIN_XVNMSUBDP },
+
+ { MASK_VSX, CODE_FOR_vsx_fmaddv4sf4, "__builtin_vsx_xvmaddsp", VSX_BUILTIN_XVMADDSP },
+ { MASK_VSX, CODE_FOR_vsx_fmsubv4sf4, "__builtin_vsx_xvmsubsp", VSX_BUILTIN_XVMSUBSP },
+ { MASK_VSX, CODE_FOR_vsx_fnmaddv4sf4, "__builtin_vsx_xvnmaddsp", VSX_BUILTIN_XVNMADDSP },
+ { MASK_VSX, CODE_FOR_vsx_fnmsubv4sf4, "__builtin_vsx_xvnmsubsp", VSX_BUILTIN_XVNMSUBSP },
+
+ { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_msub", VSX_BUILTIN_VEC_MSUB },
+ { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_nmadd", VSX_BUILTIN_VEC_NMADD },
+
+ { MASK_VSX, CODE_FOR_vector_select_v2di, "__builtin_vsx_xxsel_2di", VSX_BUILTIN_XXSEL_2DI },
+ { MASK_VSX, CODE_FOR_vector_select_v2df, "__builtin_vsx_xxsel_2df", VSX_BUILTIN_XXSEL_2DF },
+ { MASK_VSX, CODE_FOR_vector_select_v4sf, "__builtin_vsx_xxsel_4sf", VSX_BUILTIN_XXSEL_4SF },
+ { MASK_VSX, CODE_FOR_vector_select_v4si, "__builtin_vsx_xxsel_4si", VSX_BUILTIN_XXSEL_4SI },
+ { MASK_VSX, CODE_FOR_vector_select_v8hi, "__builtin_vsx_xxsel_8hi", VSX_BUILTIN_XXSEL_8HI },
+ { MASK_VSX, CODE_FOR_vector_select_v16qi, "__builtin_vsx_xxsel_16qi", VSX_BUILTIN_XXSEL_16QI },
+ { MASK_VSX, CODE_FOR_vector_select_v2di_uns, "__builtin_vsx_xxsel_2di_uns", VSX_BUILTIN_XXSEL_2DI_UNS },
+ { MASK_VSX, CODE_FOR_vector_select_v4si_uns, "__builtin_vsx_xxsel_4si_uns", VSX_BUILTIN_XXSEL_4SI_UNS },
+ { MASK_VSX, CODE_FOR_vector_select_v8hi_uns, "__builtin_vsx_xxsel_8hi_uns", VSX_BUILTIN_XXSEL_8HI_UNS },
+ { MASK_VSX, CODE_FOR_vector_select_v16qi_uns, "__builtin_vsx_xxsel_16qi_uns", VSX_BUILTIN_XXSEL_16QI_UNS },
+
+ { MASK_VSX, CODE_FOR_altivec_vperm_v2di, "__builtin_vsx_vperm_2di", VSX_BUILTIN_VPERM_2DI },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v2df, "__builtin_vsx_vperm_2df", VSX_BUILTIN_VPERM_2DF },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v4sf, "__builtin_vsx_vperm_4sf", VSX_BUILTIN_VPERM_4SF },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v4si, "__builtin_vsx_vperm_4si", VSX_BUILTIN_VPERM_4SI },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v8hi, "__builtin_vsx_vperm_8hi", VSX_BUILTIN_VPERM_8HI },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v16qi, "__builtin_vsx_vperm_16qi", VSX_BUILTIN_VPERM_16QI },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v2di_uns, "__builtin_vsx_vperm_2di_uns", VSX_BUILTIN_VPERM_2DI_UNS },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v4si_uns, "__builtin_vsx_vperm_4si_uns", VSX_BUILTIN_VPERM_4SI_UNS },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v8hi_uns, "__builtin_vsx_vperm_8hi_uns", VSX_BUILTIN_VPERM_8HI_UNS },
+ { MASK_VSX, CODE_FOR_altivec_vperm_v16qi_uns, "__builtin_vsx_vperm_16qi_uns", VSX_BUILTIN_VPERM_16QI_UNS },
+
+ { MASK_VSX, CODE_FOR_vsx_xxpermdi_v2df, "__builtin_vsx_xxpermdi_2df", VSX_BUILTIN_XXPERMDI_2DF },
+ { MASK_VSX, CODE_FOR_vsx_xxpermdi_v2di, "__builtin_vsx_xxpermdi_2di", VSX_BUILTIN_XXPERMDI_2DI },
+ { MASK_VSX, CODE_FOR_vsx_xxpermdi_v4sf, "__builtin_vsx_xxpermdi_4sf", VSX_BUILTIN_XXPERMDI_4SF },
+ { MASK_VSX, CODE_FOR_vsx_xxpermdi_v4si, "__builtin_vsx_xxpermdi_4si", VSX_BUILTIN_XXPERMDI_4SI },
+ { MASK_VSX, CODE_FOR_vsx_xxpermdi_v8hi, "__builtin_vsx_xxpermdi_8hi", VSX_BUILTIN_XXPERMDI_8HI },
+ { MASK_VSX, CODE_FOR_vsx_xxpermdi_v16qi, "__builtin_vsx_xxpermdi_16qi", VSX_BUILTIN_XXPERMDI_16QI },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vsx_xxpermdi", VSX_BUILTIN_VEC_XXPERMDI },
+ { MASK_VSX, CODE_FOR_vsx_set_v2df, "__builtin_vsx_set_2df", VSX_BUILTIN_SET_2DF },
+ { MASK_VSX, CODE_FOR_vsx_set_v2di, "__builtin_vsx_set_2di", VSX_BUILTIN_SET_2DI },
+
+ { MASK_VSX, CODE_FOR_vsx_xxsldwi_v2di, "__builtin_vsx_xxsldwi_2di", VSX_BUILTIN_XXSLDWI_2DI },
+ { MASK_VSX, CODE_FOR_vsx_xxsldwi_v2df, "__builtin_vsx_xxsldwi_2df", VSX_BUILTIN_XXSLDWI_2DF },
+ { MASK_VSX, CODE_FOR_vsx_xxsldwi_v4sf, "__builtin_vsx_xxsldwi_4sf", VSX_BUILTIN_XXSLDWI_4SF },
+ { MASK_VSX, CODE_FOR_vsx_xxsldwi_v4si, "__builtin_vsx_xxsldwi_4si", VSX_BUILTIN_XXSLDWI_4SI },
+ { MASK_VSX, CODE_FOR_vsx_xxsldwi_v8hi, "__builtin_vsx_xxsldwi_8hi", VSX_BUILTIN_XXSLDWI_8HI },
+ { MASK_VSX, CODE_FOR_vsx_xxsldwi_v16qi, "__builtin_vsx_xxsldwi_16qi", VSX_BUILTIN_XXSLDWI_16QI },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vsx_xxsldwi", VSX_BUILTIN_VEC_XXSLDWI },
+
{ 0, CODE_FOR_paired_msub, "__builtin_paired_msub", PAIRED_BUILTIN_MSUB },
{ 0, CODE_FOR_paired_madd, "__builtin_paired_madd", PAIRED_BUILTIN_MADD },
{ 0, CODE_FOR_paired_madds0, "__builtin_paired_madds0", PAIRED_BUILTIN_MADDS0 },
@@ -8368,9 +8690,50 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_ALTIVEC, CODE_FOR_altivec_vsum2sws, "__builtin_altivec_vsum2sws", ALTIVEC_BUILTIN_VSUM2SWS },
{ MASK_ALTIVEC, CODE_FOR_altivec_vsumsws, "__builtin_altivec_vsumsws", ALTIVEC_BUILTIN_VSUMSWS },
{ MASK_ALTIVEC, CODE_FOR_xorv4si3, "__builtin_altivec_vxor", ALTIVEC_BUILTIN_VXOR },
-
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_add", ALTIVEC_BUILTIN_VEC_ADD },
- { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddfp", ALTIVEC_BUILTIN_VEC_VADDFP },
+ { MASK_ALTIVEC, CODE_FOR_vector_copysignv4sf3, "__builtin_altivec_copysignfp", ALTIVEC_BUILTIN_COPYSIGN_V4SF },
+
+ { MASK_VSX, CODE_FOR_addv2df3, "__builtin_vsx_xvadddp", VSX_BUILTIN_XVADDDP },
+ { MASK_VSX, CODE_FOR_subv2df3, "__builtin_vsx_xvsubdp", VSX_BUILTIN_XVSUBDP },
+ { MASK_VSX, CODE_FOR_mulv2df3, "__builtin_vsx_xvmuldp", VSX_BUILTIN_XVMULDP },
+ { MASK_VSX, CODE_FOR_divv2df3, "__builtin_vsx_xvdivdp", VSX_BUILTIN_XVDIVDP },
+ { MASK_VSX, CODE_FOR_sminv2df3, "__builtin_vsx_xvmindp", VSX_BUILTIN_XVMINDP },
+ { MASK_VSX, CODE_FOR_smaxv2df3, "__builtin_vsx_xvmaxdp", VSX_BUILTIN_XVMAXDP },
+ { MASK_VSX, CODE_FOR_vsx_tdivv2df3_fe, "__builtin_vsx_xvtdivdp_fe", VSX_BUILTIN_XVTDIVDP_FE },
+ { MASK_VSX, CODE_FOR_vsx_tdivv2df3_fg, "__builtin_vsx_xvtdivdp_fg", VSX_BUILTIN_XVTDIVDP_FG },
+ { MASK_VSX, CODE_FOR_vector_eqv2df, "__builtin_vsx_xvcmpeqdp", VSX_BUILTIN_XVCMPEQDP },
+ { MASK_VSX, CODE_FOR_vector_gtv2df, "__builtin_vsx_xvcmpgtdp", VSX_BUILTIN_XVCMPGTDP },
+ { MASK_VSX, CODE_FOR_vector_gev2df, "__builtin_vsx_xvcmpgedp", VSX_BUILTIN_XVCMPGEDP },
+
+ { MASK_VSX, CODE_FOR_addv4sf3, "__builtin_vsx_xvaddsp", VSX_BUILTIN_XVADDSP },
+ { MASK_VSX, CODE_FOR_subv4sf3, "__builtin_vsx_xvsubsp", VSX_BUILTIN_XVSUBSP },
+ { MASK_VSX, CODE_FOR_mulv4sf3, "__builtin_vsx_xvmulsp", VSX_BUILTIN_XVMULSP },
+ { MASK_VSX, CODE_FOR_divv4sf3, "__builtin_vsx_xvdivsp", VSX_BUILTIN_XVDIVSP },
+ { MASK_VSX, CODE_FOR_sminv4sf3, "__builtin_vsx_xvminsp", VSX_BUILTIN_XVMINSP },
+ { MASK_VSX, CODE_FOR_smaxv4sf3, "__builtin_vsx_xvmaxsp", VSX_BUILTIN_XVMAXSP },
+ { MASK_VSX, CODE_FOR_vsx_tdivv4sf3_fe, "__builtin_vsx_xvtdivsp_fe", VSX_BUILTIN_XVTDIVSP_FE },
+ { MASK_VSX, CODE_FOR_vsx_tdivv4sf3_fg, "__builtin_vsx_xvtdivsp_fg", VSX_BUILTIN_XVTDIVSP_FG },
+ { MASK_VSX, CODE_FOR_vector_eqv4sf, "__builtin_vsx_xvcmpeqsp", VSX_BUILTIN_XVCMPEQSP },
+ { MASK_VSX, CODE_FOR_vector_gtv4sf, "__builtin_vsx_xvcmpgtsp", VSX_BUILTIN_XVCMPGTSP },
+ { MASK_VSX, CODE_FOR_vector_gev4sf, "__builtin_vsx_xvcmpgesp", VSX_BUILTIN_XVCMPGESP },
+
+ { MASK_VSX, CODE_FOR_smindf3, "__builtin_vsx_xsmindp", VSX_BUILTIN_XSMINDP },
+ { MASK_VSX, CODE_FOR_smaxdf3, "__builtin_vsx_xsmaxdp", VSX_BUILTIN_XSMAXDP },
+ { MASK_VSX, CODE_FOR_vsx_tdivdf3_fe, "__builtin_vsx_xstdivdp_fe", VSX_BUILTIN_XSTDIVDP_FE },
+ { MASK_VSX, CODE_FOR_vsx_tdivdf3_fg, "__builtin_vsx_xstdivdp_fg", VSX_BUILTIN_XSTDIVDP_FG },
+ { MASK_VSX, CODE_FOR_vector_copysignv2df3, "__builtin_vsx_cpsgndp", VSX_BUILTIN_CPSGNDP },
+ { MASK_VSX, CODE_FOR_vector_copysignv4sf3, "__builtin_vsx_cpsgnsp", VSX_BUILTIN_CPSGNSP },
+
+ { MASK_VSX, CODE_FOR_vsx_concat_v2df, "__builtin_vsx_concat_2df", VSX_BUILTIN_CONCAT_2DF },
+ { MASK_VSX, CODE_FOR_vsx_concat_v2di, "__builtin_vsx_concat_2di", VSX_BUILTIN_CONCAT_2DI },
+ { MASK_VSX, CODE_FOR_vsx_splat_v2df, "__builtin_vsx_splat_2df", VSX_BUILTIN_SPLAT_2DF },
+ { MASK_VSX, CODE_FOR_vsx_splat_v2di, "__builtin_vsx_splat_2di", VSX_BUILTIN_SPLAT_2DI },
+ { MASK_VSX, CODE_FOR_vsx_xxmrghw_v4sf, "__builtin_vsx_xxmrghw", VSX_BUILTIN_XXMRGHW_4SF },
+ { MASK_VSX, CODE_FOR_vsx_xxmrghw_v4si, "__builtin_vsx_xxmrghw_4si", VSX_BUILTIN_XXMRGHW_4SI },
+ { MASK_VSX, CODE_FOR_vsx_xxmrglw_v4sf, "__builtin_vsx_xxmrglw", VSX_BUILTIN_XXMRGLW_4SF },
+ { MASK_VSX, CODE_FOR_vsx_xxmrglw_v4si, "__builtin_vsx_xxmrglw_4si", VSX_BUILTIN_XXMRGLW_4SI },
+
+ { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_add", ALTIVEC_BUILTIN_VEC_ADD },
+ { MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vaddfp", ALTIVEC_BUILTIN_VEC_VADDFP },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vadduwm", ALTIVEC_BUILTIN_VEC_VADDUWM },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vadduhm", ALTIVEC_BUILTIN_VEC_VADDUHM },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vaddubm", ALTIVEC_BUILTIN_VEC_VADDUBM },
@@ -8408,6 +8771,7 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vcmpgtub", ALTIVEC_BUILTIN_VEC_VCMPGTUB },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmple", ALTIVEC_BUILTIN_VEC_CMPLE },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_cmplt", ALTIVEC_BUILTIN_VEC_CMPLT },
+ { MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_copysign", ALTIVEC_BUILTIN_VEC_COPYSIGN },
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_max", ALTIVEC_BUILTIN_VEC_MAX },
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vmaxfp", ALTIVEC_BUILTIN_VEC_VMAXFP },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vmaxsw", ALTIVEC_BUILTIN_VEC_VMAXSW },
@@ -8497,6 +8861,9 @@ static struct builtin_description bdesc_2arg[] =
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_sums", ALTIVEC_BUILTIN_VEC_SUMS },
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_xor", ALTIVEC_BUILTIN_VEC_XOR },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_mul", VSX_BUILTIN_VEC_MUL },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_div", VSX_BUILTIN_VEC_DIV },
+
{ 0, CODE_FOR_divv2sf3, "__builtin_paired_divv2sf3", PAIRED_BUILTIN_DIVV2SF3 },
{ 0, CODE_FOR_addv2sf3, "__builtin_paired_addv2sf3", PAIRED_BUILTIN_ADDV2SF3 },
{ 0, CODE_FOR_subv2sf3, "__builtin_paired_subv2sf3", PAIRED_BUILTIN_SUBV2SF3 },
@@ -8692,6 +9059,19 @@ static const struct builtin_description_predicates bdesc_altivec_preds[] =
{ MASK_ALTIVEC, CODE_FOR_vector_gtu_v16qi_p, "__builtin_altivec_vcmpgtub_p",
ALTIVEC_BUILTIN_VCMPGTUB_P },
+ { MASK_VSX, CODE_FOR_vector_eq_v4sf_p, "__builtin_vsx_xvcmpeqsp_p",
+ VSX_BUILTIN_XVCMPEQSP_P },
+ { MASK_VSX, CODE_FOR_vector_ge_v4sf_p, "__builtin_vsx_xvcmpgesp_p",
+ VSX_BUILTIN_XVCMPGESP_P },
+ { MASK_VSX, CODE_FOR_vector_gt_v4sf_p, "__builtin_vsx_xvcmpgtsp_p",
+ VSX_BUILTIN_XVCMPGTSP_P },
+ { MASK_VSX, CODE_FOR_vector_eq_v2df_p, "__builtin_vsx_xvcmpeqdp_p",
+ VSX_BUILTIN_XVCMPEQDP_P },
+ { MASK_VSX, CODE_FOR_vector_ge_v2df_p, "__builtin_vsx_xvcmpgedp_p",
+ VSX_BUILTIN_XVCMPGEDP_P },
+ { MASK_VSX, CODE_FOR_vector_gt_v2df_p, "__builtin_vsx_xvcmpgtdp_p",
+ VSX_BUILTIN_XVCMPGTDP_P },
+
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vcmpeq_p",
ALTIVEC_BUILTIN_VCMPEQ_P },
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_nothing, "__builtin_vec_vcmpgt_p",
@@ -8755,7 +9135,11 @@ static const struct builtin_description bdesc_abs[] =
{ MASK_ALTIVEC, CODE_FOR_absv16qi2, "__builtin_altivec_abs_v16qi", ALTIVEC_BUILTIN_ABS_V16QI },
{ MASK_ALTIVEC, CODE_FOR_altivec_abss_v4si, "__builtin_altivec_abss_v4si", ALTIVEC_BUILTIN_ABSS_V4SI },
{ MASK_ALTIVEC, CODE_FOR_altivec_abss_v8hi, "__builtin_altivec_abss_v8hi", ALTIVEC_BUILTIN_ABSS_V8HI },
- { MASK_ALTIVEC, CODE_FOR_altivec_abss_v16qi, "__builtin_altivec_abss_v16qi", ALTIVEC_BUILTIN_ABSS_V16QI }
+ { MASK_ALTIVEC, CODE_FOR_altivec_abss_v16qi, "__builtin_altivec_abss_v16qi", ALTIVEC_BUILTIN_ABSS_V16QI },
+ { MASK_VSX, CODE_FOR_absv2df2, "__builtin_vsx_xvabsdp", VSX_BUILTIN_XVABSDP },
+ { MASK_VSX, CODE_FOR_vsx_nabsv2df2, "__builtin_vsx_xvnabsdp", VSX_BUILTIN_XVNABSDP },
+ { MASK_VSX, CODE_FOR_absv4sf2, "__builtin_vsx_xvabssp", VSX_BUILTIN_XVABSSP },
+ { MASK_VSX, CODE_FOR_vsx_nabsv4sf2, "__builtin_vsx_xvnabssp", VSX_BUILTIN_XVNABSSP },
};
/* Simple unary operations: VECb = foo (unsigned literal) or VECb =
@@ -8766,10 +9150,10 @@ static struct builtin_description bdesc_1arg[] =
{ MASK_ALTIVEC, CODE_FOR_altivec_vexptefp, "__builtin_altivec_vexptefp", ALTIVEC_BUILTIN_VEXPTEFP },
{ MASK_ALTIVEC, CODE_FOR_altivec_vlogefp, "__builtin_altivec_vlogefp", ALTIVEC_BUILTIN_VLOGEFP },
{ MASK_ALTIVEC, CODE_FOR_altivec_vrefp, "__builtin_altivec_vrefp", ALTIVEC_BUILTIN_VREFP },
- { MASK_ALTIVEC, CODE_FOR_altivec_vrfim, "__builtin_altivec_vrfim", ALTIVEC_BUILTIN_VRFIM },
+ { MASK_ALTIVEC, CODE_FOR_vector_floorv4sf2, "__builtin_altivec_vrfim", ALTIVEC_BUILTIN_VRFIM },
{ MASK_ALTIVEC, CODE_FOR_altivec_vrfin, "__builtin_altivec_vrfin", ALTIVEC_BUILTIN_VRFIN },
- { MASK_ALTIVEC, CODE_FOR_altivec_vrfip, "__builtin_altivec_vrfip", ALTIVEC_BUILTIN_VRFIP },
- { MASK_ALTIVEC, CODE_FOR_ftruncv4sf2, "__builtin_altivec_vrfiz", ALTIVEC_BUILTIN_VRFIZ },
+ { MASK_ALTIVEC, CODE_FOR_vector_ceilv4sf2, "__builtin_altivec_vrfip", ALTIVEC_BUILTIN_VRFIP },
+ { MASK_ALTIVEC, CODE_FOR_vector_btruncv4sf2, "__builtin_altivec_vrfiz", ALTIVEC_BUILTIN_VRFIZ },
{ MASK_ALTIVEC, CODE_FOR_altivec_vrsqrtefp, "__builtin_altivec_vrsqrtefp", ALTIVEC_BUILTIN_VRSQRTEFP },
{ MASK_ALTIVEC, CODE_FOR_altivec_vspltisb, "__builtin_altivec_vspltisb", ALTIVEC_BUILTIN_VSPLTISB },
{ MASK_ALTIVEC, CODE_FOR_altivec_vspltish, "__builtin_altivec_vspltish", ALTIVEC_BUILTIN_VSPLTISH },
@@ -8781,6 +9165,65 @@ static struct builtin_description bdesc_1arg[] =
{ MASK_ALTIVEC, CODE_FOR_altivec_vupklpx, "__builtin_altivec_vupklpx", ALTIVEC_BUILTIN_VUPKLPX },
{ MASK_ALTIVEC, CODE_FOR_altivec_vupklsh, "__builtin_altivec_vupklsh", ALTIVEC_BUILTIN_VUPKLSH },
+ { MASK_VSX, CODE_FOR_negv2df2, "__builtin_vsx_xvnegdp", VSX_BUILTIN_XVNEGDP },
+ { MASK_VSX, CODE_FOR_sqrtv2df2, "__builtin_vsx_xvsqrtdp", VSX_BUILTIN_XVSQRTDP },
+ { MASK_VSX, CODE_FOR_vsx_rsqrtev2df2, "__builtin_vsx_xvrsqrtedp", VSX_BUILTIN_XVRSQRTEDP },
+ { MASK_VSX, CODE_FOR_vsx_tsqrtv2df2_fe, "__builtin_vsx_xvtsqrtdp_fe", VSX_BUILTIN_XVTSQRTDP_FE },
+ { MASK_VSX, CODE_FOR_vsx_tsqrtv2df2_fg, "__builtin_vsx_xvtsqrtdp_fg", VSX_BUILTIN_XVTSQRTDP_FG },
+ { MASK_VSX, CODE_FOR_vsx_frev2df2, "__builtin_vsx_xvredp", VSX_BUILTIN_XVREDP },
+
+ { MASK_VSX, CODE_FOR_negv4sf2, "__builtin_vsx_xvnegsp", VSX_BUILTIN_XVNEGSP },
+ { MASK_VSX, CODE_FOR_sqrtv4sf2, "__builtin_vsx_xvsqrtsp", VSX_BUILTIN_XVSQRTSP },
+ { MASK_VSX, CODE_FOR_vsx_rsqrtev4sf2, "__builtin_vsx_xvrsqrtesp", VSX_BUILTIN_XVRSQRTESP },
+ { MASK_VSX, CODE_FOR_vsx_tsqrtv4sf2_fe, "__builtin_vsx_xvtsqrtsp_fe", VSX_BUILTIN_XVTSQRTSP_FE },
+ { MASK_VSX, CODE_FOR_vsx_tsqrtv4sf2_fg, "__builtin_vsx_xvtsqrtsp_fg", VSX_BUILTIN_XVTSQRTSP_FG },
+ { MASK_VSX, CODE_FOR_vsx_frev4sf2, "__builtin_vsx_xvresp", VSX_BUILTIN_XVRESP },
+
+ { MASK_VSX, CODE_FOR_vsx_xscvdpsp, "__builtin_vsx_xscvdpsp", VSX_BUILTIN_XSCVDPSP },
+ { MASK_VSX, CODE_FOR_vsx_xscvdpsp, "__builtin_vsx_xscvspdp", VSX_BUILTIN_XSCVSPDP },
+ { MASK_VSX, CODE_FOR_vsx_xvcvdpsp, "__builtin_vsx_xvcvdpsp", VSX_BUILTIN_XVCVDPSP },
+ { MASK_VSX, CODE_FOR_vsx_xvcvspdp, "__builtin_vsx_xvcvspdp", VSX_BUILTIN_XVCVSPDP },
+ { MASK_VSX, CODE_FOR_vsx_tsqrtdf2_fe, "__builtin_vsx_xstsqrtdp_fe", VSX_BUILTIN_XSTSQRTDP_FE },
+ { MASK_VSX, CODE_FOR_vsx_tsqrtdf2_fg, "__builtin_vsx_xstsqrtdp_fg", VSX_BUILTIN_XSTSQRTDP_FG },
+
+ { MASK_VSX, CODE_FOR_vsx_fix_truncv2dfv2di2, "__builtin_vsx_xvcvdpsxds", VSX_BUILTIN_XVCVDPSXDS },
+ { MASK_VSX, CODE_FOR_vsx_fixuns_truncv2dfv2di2, "__builtin_vsx_xvcvdpuxds", VSX_BUILTIN_XVCVDPUXDS },
+ { MASK_VSX, CODE_FOR_vsx_fixuns_truncv2dfv2di2, "__builtin_vsx_xvcvdpuxds_uns", VSX_BUILTIN_XVCVDPUXDS_UNS },
+ { MASK_VSX, CODE_FOR_vsx_floatv2div2df2, "__builtin_vsx_xvcvsxddp", VSX_BUILTIN_XVCVSXDDP },
+ { MASK_VSX, CODE_FOR_vsx_floatunsv2div2df2, "__builtin_vsx_xvcvuxddp", VSX_BUILTIN_XVCVUXDDP },
+ { MASK_VSX, CODE_FOR_vsx_floatunsv2div2df2, "__builtin_vsx_xvcvuxddp_uns", VSX_BUILTIN_XVCVUXDDP_UNS },
+
+ { MASK_VSX, CODE_FOR_vsx_fix_truncv4sfv4si2, "__builtin_vsx_xvcvspsxws", VSX_BUILTIN_XVCVSPSXWS },
+ { MASK_VSX, CODE_FOR_vsx_fixuns_truncv4sfv4si2, "__builtin_vsx_xvcvspuxws", VSX_BUILTIN_XVCVSPUXWS },
+ { MASK_VSX, CODE_FOR_vsx_floatv4siv4sf2, "__builtin_vsx_xvcvsxwsp", VSX_BUILTIN_XVCVSXWSP },
+ { MASK_VSX, CODE_FOR_vsx_floatunsv4siv4sf2, "__builtin_vsx_xvcvuxwsp", VSX_BUILTIN_XVCVUXWSP },
+
+ { MASK_VSX, CODE_FOR_vsx_xvcvdpsxws, "__builtin_vsx_xvcvdpsxws", VSX_BUILTIN_XVCVDPSXWS },
+ { MASK_VSX, CODE_FOR_vsx_xvcvdpuxws, "__builtin_vsx_xvcvdpuxws", VSX_BUILTIN_XVCVDPUXWS },
+ { MASK_VSX, CODE_FOR_vsx_xvcvsxwdp, "__builtin_vsx_xvcvsxwdp", VSX_BUILTIN_XVCVSXWDP },
+ { MASK_VSX, CODE_FOR_vsx_xvcvuxwdp, "__builtin_vsx_xvcvuxwdp", VSX_BUILTIN_XVCVUXWDP },
+ { MASK_VSX, CODE_FOR_vsx_xvrdpi, "__builtin_vsx_xvrdpi", VSX_BUILTIN_XVRDPI },
+ { MASK_VSX, CODE_FOR_vsx_xvrdpic, "__builtin_vsx_xvrdpic", VSX_BUILTIN_XVRDPIC },
+ { MASK_VSX, CODE_FOR_vsx_floorv2df2, "__builtin_vsx_xvrdpim", VSX_BUILTIN_XVRDPIM },
+ { MASK_VSX, CODE_FOR_vsx_ceilv2df2, "__builtin_vsx_xvrdpip", VSX_BUILTIN_XVRDPIP },
+ { MASK_VSX, CODE_FOR_vsx_btruncv2df2, "__builtin_vsx_xvrdpiz", VSX_BUILTIN_XVRDPIZ },
+
+ { MASK_VSX, CODE_FOR_vsx_xvcvspsxds, "__builtin_vsx_xvcvspsxds", VSX_BUILTIN_XVCVSPSXDS },
+ { MASK_VSX, CODE_FOR_vsx_xvcvspuxds, "__builtin_vsx_xvcvspuxds", VSX_BUILTIN_XVCVSPUXDS },
+ { MASK_VSX, CODE_FOR_vsx_xvcvsxdsp, "__builtin_vsx_xvcvsxdsp", VSX_BUILTIN_XVCVSXDSP },
+ { MASK_VSX, CODE_FOR_vsx_xvcvuxdsp, "__builtin_vsx_xvcvuxdsp", VSX_BUILTIN_XVCVUXDSP },
+ { MASK_VSX, CODE_FOR_vsx_xvrspi, "__builtin_vsx_xvrspi", VSX_BUILTIN_XVRSPI },
+ { MASK_VSX, CODE_FOR_vsx_xvrspic, "__builtin_vsx_xvrspic", VSX_BUILTIN_XVRSPIC },
+ { MASK_VSX, CODE_FOR_vsx_floorv4sf2, "__builtin_vsx_xvrspim", VSX_BUILTIN_XVRSPIM },
+ { MASK_VSX, CODE_FOR_vsx_ceilv4sf2, "__builtin_vsx_xvrspip", VSX_BUILTIN_XVRSPIP },
+ { MASK_VSX, CODE_FOR_vsx_btruncv4sf2, "__builtin_vsx_xvrspiz", VSX_BUILTIN_XVRSPIZ },
+
+ { MASK_VSX, CODE_FOR_vsx_xsrdpi, "__builtin_vsx_xsrdpi", VSX_BUILTIN_XSRDPI },
+ { MASK_VSX, CODE_FOR_vsx_xsrdpic, "__builtin_vsx_xsrdpic", VSX_BUILTIN_XSRDPIC },
+ { MASK_VSX, CODE_FOR_vsx_floordf2, "__builtin_vsx_xsrdpim", VSX_BUILTIN_XSRDPIM },
+ { MASK_VSX, CODE_FOR_vsx_ceildf2, "__builtin_vsx_xsrdpip", VSX_BUILTIN_XSRDPIP },
+ { MASK_VSX, CODE_FOR_vsx_btruncdf2, "__builtin_vsx_xsrdpiz", VSX_BUILTIN_XSRDPIZ },
+
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_abs", ALTIVEC_BUILTIN_VEC_ABS },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_abss", ALTIVEC_BUILTIN_VEC_ABSS },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_ceil", ALTIVEC_BUILTIN_VEC_CEIL },
@@ -8801,6 +9244,10 @@ static struct builtin_description bdesc_1arg[] =
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupklsh", ALTIVEC_BUILTIN_VEC_VUPKLSH },
{ MASK_ALTIVEC, CODE_FOR_nothing, "__builtin_vec_vupklsb", ALTIVEC_BUILTIN_VEC_VUPKLSB },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_nearbyint", ALTIVEC_BUILTIN_VEC_NEARBYINT },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_rint", ALTIVEC_BUILTIN_VEC_RINT },
+ { MASK_VSX, CODE_FOR_nothing, "__builtin_vec_sqrt", ALTIVEC_BUILTIN_VEC_SQRT },
+
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_floatv4siv4sf2, "__builtin_vec_float_sisf", VECTOR_BUILTIN_FLOAT_V4SI_V4SF },
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_unsigned_floatv4siv4sf2, "__builtin_vec_uns_float_sisf", VECTOR_BUILTIN_UNSFLOAT_V4SI_V4SF },
{ MASK_ALTIVEC|MASK_VSX, CODE_FOR_fix_truncv4sfv4si2, "__builtin_vec_fix_sfsi", VECTOR_BUILTIN_FIX_V4SF_V4SI },
@@ -9324,6 +9771,36 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
}
break;
+ case CODE_FOR_vsx_xxpermdi_v2df:
+ case CODE_FOR_vsx_xxpermdi_v2di:
+ case CODE_FOR_vsx_xxsldwi_v16qi:
+ case CODE_FOR_vsx_xxsldwi_v8hi:
+ case CODE_FOR_vsx_xxsldwi_v4si:
+ case CODE_FOR_vsx_xxsldwi_v4sf:
+ case CODE_FOR_vsx_xxsldwi_v2di:
+ case CODE_FOR_vsx_xxsldwi_v2df:
+ /* Only allow 2-bit unsigned literals. */
+ STRIP_NOPS (arg2);
+ if (TREE_CODE (arg2) != INTEGER_CST
+ || TREE_INT_CST_LOW (arg2) & ~0x3)
+ {
+ error ("argument 3 must be a 2-bit unsigned literal");
+ return const0_rtx;
+ }
+ break;
+
+ case CODE_FOR_vsx_set_v2df:
+ case CODE_FOR_vsx_set_v2di:
+ /* Only allow 1-bit unsigned literals. */
+ STRIP_NOPS (arg2);
+ if (TREE_CODE (arg2) != INTEGER_CST
+ || TREE_INT_CST_LOW (arg2) & ~0x1)
+ {
+ error ("argument 3 must be a 1-bit unsigned literal");
+ return const0_rtx;
+ }
+ break;
+
default:
break;
}
@@ -9633,8 +10110,10 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
enum machine_mode tmode, mode0;
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
- if (fcode >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && fcode <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ if ((fcode >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
+ && fcode <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ || (fcode >= VSX_BUILTIN_OVERLOADED_FIRST
+ && fcode <= VSX_BUILTIN_OVERLOADED_LAST))
{
*expandedp = true;
error ("unresolved overload for Altivec builtin %qF", fndecl);
@@ -9742,18 +10221,24 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp)
case ALTIVEC_BUILTIN_VEC_INIT_V8HI:
case ALTIVEC_BUILTIN_VEC_INIT_V16QI:
case ALTIVEC_BUILTIN_VEC_INIT_V4SF:
+ case VSX_BUILTIN_VEC_INIT_V2DF:
+ case VSX_BUILTIN_VEC_INIT_V2DI:
return altivec_expand_vec_init_builtin (TREE_TYPE (exp), exp, target);
case ALTIVEC_BUILTIN_VEC_SET_V4SI:
case ALTIVEC_BUILTIN_VEC_SET_V8HI:
case ALTIVEC_BUILTIN_VEC_SET_V16QI:
case ALTIVEC_BUILTIN_VEC_SET_V4SF:
+ case VSX_BUILTIN_VEC_SET_V2DF:
+ case VSX_BUILTIN_VEC_SET_V2DI:
return altivec_expand_vec_set_builtin (exp);
case ALTIVEC_BUILTIN_VEC_EXT_V4SI:
case ALTIVEC_BUILTIN_VEC_EXT_V8HI:
case ALTIVEC_BUILTIN_VEC_EXT_V16QI:
case ALTIVEC_BUILTIN_VEC_EXT_V4SF:
+ case VSX_BUILTIN_VEC_EXT_V2DF:
+ case VSX_BUILTIN_VEC_EXT_V2DI:
return altivec_expand_vec_ext_builtin (exp, target);
default:
@@ -10276,6 +10761,11 @@ rs6000_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
if (fcode == RS6000_BUILTIN_BSWAP_HI)
return rs6000_expand_unop_builtin (CODE_FOR_bswaphi2, exp, target);
+ if (fcode == POWER7_BUILTIN_BPERMD)
+ return rs6000_expand_binop_builtin (((TARGET_64BIT)
+ ? CODE_FOR_bpermd_di
+ : CODE_FOR_bpermd_si), exp, target);
+
if (fcode == ALTIVEC_BUILTIN_MASK_FOR_LOAD
|| fcode == ALTIVEC_BUILTIN_MASK_FOR_STORE)
{
@@ -10531,6 +11021,33 @@ rs6000_init_builtins (void)
TYPE_NAME (pixel_V8HI_type_node) = tdecl;
(*lang_hooks.decls.pushdecl) (tdecl);
+ if (TARGET_VSX)
+ {
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector double"),
+ unsigned_V2DI_type_node);
+ TYPE_NAME (V2DF_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
+
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector long"),
+ V2DI_type_node);
+ TYPE_NAME (V2DI_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
+
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector unsigned long"),
+ unsigned_V2DI_type_node);
+ TYPE_NAME (unsigned_V2DI_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
+
+ tdecl = build_decl (BUILTINS_LOCATION,
+ TYPE_DECL, get_identifier ("__vector __bool long"),
+ bool_V2DI_type_node);
+ TYPE_NAME (bool_V2DI_type_node) = tdecl;
+ (*lang_hooks.decls.pushdecl) (tdecl);
+ }
+
if (TARGET_PAIRED_FLOAT)
paired_init_builtins ();
if (TARGET_SPE)
@@ -10562,6 +11079,15 @@ rs6000_init_builtins (void)
RS6000_BUILTIN_RECIP);
}
+ if (TARGET_POPCNTD)
+ {
+ enum machine_mode mode = (TARGET_64BIT) ? DImode : SImode;
+ tree ftype = builtin_function_type (mode, mode, mode, VOIDmode,
+ POWER7_BUILTIN_BPERMD,
+ "__builtin_bpermd");
+ def_builtin (MASK_POPCNTD, "__builtin_bpermd", ftype,
+ POWER7_BUILTIN_BPERMD);
+ }
if (TARGET_POWERPC)
{
/* Don't use builtin_function_type here, as it maps HI/QI to SI. */
@@ -11000,6 +11526,10 @@ altivec_init_builtins (void)
= build_function_type_list (integer_type_node,
integer_type_node, V4SF_type_node,
V4SF_type_node, NULL_TREE);
+ tree int_ftype_int_v2df_v2df
+ = build_function_type_list (integer_type_node,
+ integer_type_node, V2DF_type_node,
+ V2DF_type_node, NULL_TREE);
tree v4si_ftype_v4si
= build_function_type_list (V4SI_type_node, V4SI_type_node, NULL_TREE);
tree v8hi_ftype_v8hi
@@ -11008,6 +11538,8 @@ altivec_init_builtins (void)
= build_function_type_list (V16QI_type_node, V16QI_type_node, NULL_TREE);
tree v4sf_ftype_v4sf
= build_function_type_list (V4SF_type_node, V4SF_type_node, NULL_TREE);
+ tree v2df_ftype_v2df
+ = build_function_type_list (V2DF_type_node, V2DF_type_node, NULL_TREE);
tree void_ftype_pcvoid_int_int
= build_function_type_list (void_type_node,
pcvoid_type_node, integer_type_node,
@@ -11110,8 +11642,10 @@ altivec_init_builtins (void)
{
enum machine_mode mode1;
tree type;
- bool is_overloaded = dp->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && dp->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST;
+ bool is_overloaded = ((dp->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
+ && dp->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ || (dp->code >= VSX_BUILTIN_OVERLOADED_FIRST
+ && dp->code <= VSX_BUILTIN_OVERLOADED_LAST));
if (is_overloaded)
mode1 = VOIDmode;
@@ -11135,6 +11669,9 @@ altivec_init_builtins (void)
case V4SFmode:
type = int_ftype_int_v4sf_v4sf;
break;
+ case V2DFmode:
+ type = int_ftype_int_v2df_v2df;
+ break;
default:
gcc_unreachable ();
}
@@ -11165,6 +11702,9 @@ altivec_init_builtins (void)
case V4SFmode:
type = v4sf_ftype_v4sf;
break;
+ case V2DFmode:
+ type = v2df_ftype_v2df;
+ break;
default:
gcc_unreachable ();
}
@@ -11224,6 +11764,19 @@ altivec_init_builtins (void)
def_builtin (MASK_ALTIVEC, "__builtin_vec_init_v4sf", ftype,
ALTIVEC_BUILTIN_VEC_INIT_V4SF);
+ if (TARGET_VSX)
+ {
+ ftype = build_function_type_list (V2DF_type_node, double_type_node,
+ double_type_node, NULL_TREE);
+ def_builtin (MASK_VSX, "__builtin_vec_init_v2df", ftype,
+ VSX_BUILTIN_VEC_INIT_V2DF);
+
+ ftype = build_function_type_list (V2DI_type_node, intDI_type_node,
+ intDI_type_node, NULL_TREE);
+ def_builtin (MASK_VSX, "__builtin_vec_init_v2di", ftype,
+ VSX_BUILTIN_VEC_INIT_V2DI);
+ }
+
/* Access to the vec_set patterns. */
ftype = build_function_type_list (V4SI_type_node, V4SI_type_node,
intSI_type_node,
@@ -11249,6 +11802,21 @@ altivec_init_builtins (void)
def_builtin (MASK_ALTIVEC|MASK_VSX, "__builtin_vec_set_v4sf", ftype,
ALTIVEC_BUILTIN_VEC_SET_V4SF);
+ if (TARGET_VSX)
+ {
+ ftype = build_function_type_list (V2DF_type_node, V2DF_type_node,
+ double_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin (MASK_VSX, "__builtin_vec_set_v2df", ftype,
+ VSX_BUILTIN_VEC_SET_V2DF);
+
+ ftype = build_function_type_list (V2DI_type_node, V2DI_type_node,
+ intDI_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin (MASK_VSX, "__builtin_vec_set_v2di", ftype,
+ VSX_BUILTIN_VEC_SET_V2DI);
+ }
+
/* Access to the vec_extract patterns. */
ftype = build_function_type_list (intSI_type_node, V4SI_type_node,
integer_type_node, NULL_TREE);
@@ -11269,6 +11837,19 @@ altivec_init_builtins (void)
integer_type_node, NULL_TREE);
def_builtin (MASK_ALTIVEC|MASK_VSX, "__builtin_vec_ext_v4sf", ftype,
ALTIVEC_BUILTIN_VEC_EXT_V4SF);
+
+ if (TARGET_VSX)
+ {
+ ftype = build_function_type_list (double_type_node, V2DF_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin (MASK_VSX, "__builtin_vec_ext_v2df", ftype,
+ VSX_BUILTIN_VEC_EXT_V2DF);
+
+ ftype = build_function_type_list (intDI_type_node, V2DI_type_node,
+ integer_type_node, NULL_TREE);
+ def_builtin (MASK_VSX, "__builtin_vec_ext_v2di", ftype,
+ VSX_BUILTIN_VEC_EXT_V2DI);
+ }
}
/* Hash function for builtin functions with up to 3 arguments and a return
@@ -11364,6 +11945,14 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0,
case ALTIVEC_BUILTIN_VSEL_8HI_UNS:
case ALTIVEC_BUILTIN_VSEL_4SI_UNS:
case ALTIVEC_BUILTIN_VSEL_2DI_UNS:
+ case VSX_BUILTIN_VPERM_16QI_UNS:
+ case VSX_BUILTIN_VPERM_8HI_UNS:
+ case VSX_BUILTIN_VPERM_4SI_UNS:
+ case VSX_BUILTIN_VPERM_2DI_UNS:
+ case VSX_BUILTIN_XXSEL_16QI_UNS:
+ case VSX_BUILTIN_XXSEL_8HI_UNS:
+ case VSX_BUILTIN_XXSEL_4SI_UNS:
+ case VSX_BUILTIN_XXSEL_2DI_UNS:
h.uns_p[0] = 1;
h.uns_p[1] = 1;
h.uns_p[2] = 1;
@@ -11377,6 +11966,12 @@ builtin_function_type (enum machine_mode mode_ret, enum machine_mode mode_arg0,
case ALTIVEC_BUILTIN_VPERM_4SF:
case ALTIVEC_BUILTIN_VPERM_2DI:
case ALTIVEC_BUILTIN_VPERM_2DF:
+ case VSX_BUILTIN_VPERM_16QI:
+ case VSX_BUILTIN_VPERM_8HI:
+ case VSX_BUILTIN_VPERM_4SI:
+ case VSX_BUILTIN_VPERM_4SF:
+ case VSX_BUILTIN_VPERM_2DI:
+ case VSX_BUILTIN_VPERM_2DF:
h.uns_p[3] = 1;
break;
@@ -11473,8 +12068,10 @@ rs6000_common_init_builtins (void)
|| (mask == 0 && !TARGET_PAIRED_FLOAT))
continue;
- if (d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ if ((d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
+ && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ || (d->code >= VSX_BUILTIN_OVERLOADED_FIRST
+ && d->code <= VSX_BUILTIN_OVERLOADED_LAST))
{
if (! (type = opaque_ftype_opaque_opaque_opaque))
type = opaque_ftype_opaque_opaque_opaque
@@ -11512,8 +12109,10 @@ rs6000_common_init_builtins (void)
|| (mask == 0 && !TARGET_PAIRED_FLOAT))
continue;
- if (d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ if ((d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
+ && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ || (d->code >= VSX_BUILTIN_OVERLOADED_FIRST
+ && d->code <= VSX_BUILTIN_OVERLOADED_LAST))
{
if (! (type = opaque_ftype_opaque_opaque))
type = opaque_ftype_opaque_opaque
@@ -11568,14 +12167,15 @@ rs6000_common_init_builtins (void)
enum machine_mode mode0, mode1;
tree type;
int mask = d->mask;
- bool is_overloaded = d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
- && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST;
if ((mask != 0 && (mask & target_flags) == 0)
|| (mask == 0 && !TARGET_PAIRED_FLOAT))
continue;
- if (is_overloaded)
+ if ((d->code >= ALTIVEC_BUILTIN_OVERLOADED_FIRST
+ && d->code <= ALTIVEC_BUILTIN_OVERLOADED_LAST)
+ || (d->code >= VSX_BUILTIN_OVERLOADED_FIRST
+ && d->code <= VSX_BUILTIN_OVERLOADED_LAST))
{
if (! (type = opaque_ftype_opaque))
type = opaque_ftype_opaque
@@ -22259,18 +22859,24 @@ rs6000_handle_altivec_attribute (tree *node,
mode = TYPE_MODE (type);
/* Check for invalid AltiVec type qualifiers. */
- if (type == long_unsigned_type_node || type == long_integer_type_node)
- {
- if (TARGET_64BIT)
- error ("use of %<long%> in AltiVec types is invalid for 64-bit code");
- else if (rs6000_warn_altivec_long)
- warning (0, "use of %<long%> in AltiVec types is deprecated; use %<int%>");
- }
- else if (type == long_long_unsigned_type_node
- || type == long_long_integer_type_node)
- error ("use of %<long long%> in AltiVec types is invalid");
- else if (type == double_type_node)
- error ("use of %<double%> in AltiVec types is invalid");
+ if (!TARGET_VSX)
+ {
+ if (type == long_unsigned_type_node || type == long_integer_type_node)
+ {
+ if (TARGET_64BIT)
+ error ("use of %<long%> in AltiVec types is invalid for "
+ "64-bit code without -mvsx");
+ else if (rs6000_warn_altivec_long)
+ warning (0, "use of %<long%> in AltiVec types is deprecated; "
+ "use %<int%>");
+ }
+ else if (type == long_long_unsigned_type_node
+ || type == long_long_integer_type_node)
+ error ("use of %<long long%> in AltiVec types is invalid without "
+ "-mvsx");
+ else if (type == double_type_node)
+ error ("use of %<double%> in AltiVec types is invalid without -mvsx");
+ }
else if (type == long_double_type_node)
error ("use of %<long double%> in AltiVec types is invalid");
else if (type == boolean_type_node)
@@ -22286,6 +22892,9 @@ rs6000_handle_altivec_attribute (tree *node,
unsigned_p = TYPE_UNSIGNED (type);
switch (mode)
{
+ case DImode:
+ result = (unsigned_p ? unsigned_V2DI_type_node : V2DI_type_node);
+ break;
case SImode:
result = (unsigned_p ? unsigned_V4SI_type_node : V4SI_type_node);
break;
@@ -22296,10 +22905,12 @@ rs6000_handle_altivec_attribute (tree *node,
result = (unsigned_p ? unsigned_V16QI_type_node : V16QI_type_node);
break;
case SFmode: result = V4SF_type_node; break;
+ case DFmode: result = V2DF_type_node; break;
/* If the user says 'vector int bool', we may be handed the 'bool'
attribute _before_ the 'vector' attribute, and so select the
proper type in the 'b' case below. */
case V4SImode: case V8HImode: case V16QImode: case V4SFmode:
+ case V2DImode: case V2DFmode:
result = type;
default: break;
}
@@ -22307,6 +22918,7 @@ rs6000_handle_altivec_attribute (tree *node,
case 'b':
switch (mode)
{
+ case DImode: case V2DImode: result = bool_V2DI_type_node; break;
case SImode: case V4SImode: result = bool_V4SI_type_node; break;
case HImode: case V8HImode: result = bool_V8HI_type_node; break;
case QImode: case V16QImode: result = bool_V16QI_type_node;
@@ -22351,6 +22963,7 @@ rs6000_mangle_type (const_tree type)
if (type == bool_short_type_node) return "U6__bools";
if (type == pixel_type_node) return "u7__pixel";
if (type == bool_int_type_node) return "U6__booli";
+ if (type == bool_long_type_node) return "U6__booll";
/* Mangle IBM extended float long double as `g' (__float128) on
powerpc*-linux where long-double-64 previously was the default. */
@@ -24588,7 +25201,7 @@ rs6000_vector_mode_supported_p (enum machine_mode mode)
if (TARGET_SPE && SPE_VECTOR_MODE (mode))
return true;
- else if (VECTOR_UNIT_ALTIVEC_OR_VSX_P (mode))
+ else if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode))
return true;
else
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 3153243b30d..0c5e59333ab 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1883,6 +1883,10 @@ typedef struct rs6000_args
&& EASY_VECTOR_15((n) >> 1) \
&& ((n) & 1) == 0)
+#define EASY_VECTOR_MSB(n,mode) \
+ (((unsigned HOST_WIDE_INT)n) == \
+ ((((unsigned HOST_WIDE_INT)GET_MODE_MASK (mode)) + 1) >> 1))
+
/* Try a machine-dependent way of reloading an illegitimate address
operand. If we find one, push the reload and jump to WIN. This
@@ -2678,6 +2682,7 @@ enum rs6000_builtins
ALTIVEC_BUILTIN_VEC_EXT_V8HI,
ALTIVEC_BUILTIN_VEC_EXT_V16QI,
ALTIVEC_BUILTIN_VEC_EXT_V4SF,
+ ALTIVEC_BUILTIN_COPYSIGN_V4SF,
/* Altivec overloaded builtins. */
ALTIVEC_BUILTIN_VCMPEQ_P,
@@ -2703,6 +2708,7 @@ enum rs6000_builtins
ALTIVEC_BUILTIN_VEC_CMPGT,
ALTIVEC_BUILTIN_VEC_CMPLE,
ALTIVEC_BUILTIN_VEC_CMPLT,
+ ALTIVEC_BUILTIN_VEC_COPYSIGN,
ALTIVEC_BUILTIN_VEC_CTF,
ALTIVEC_BUILTIN_VEC_CTS,
ALTIVEC_BUILTIN_VEC_CTU,
@@ -2745,6 +2751,7 @@ enum rs6000_builtins
ALTIVEC_BUILTIN_VEC_MTVSCR,
ALTIVEC_BUILTIN_VEC_MULE,
ALTIVEC_BUILTIN_VEC_MULO,
+ ALTIVEC_BUILTIN_VEC_NEARBYINT,
ALTIVEC_BUILTIN_VEC_NMSUB,
ALTIVEC_BUILTIN_VEC_NOR,
ALTIVEC_BUILTIN_VEC_OR,
@@ -2755,6 +2762,7 @@ enum rs6000_builtins
ALTIVEC_BUILTIN_VEC_PERM,
ALTIVEC_BUILTIN_VEC_RE,
ALTIVEC_BUILTIN_VEC_RL,
+ ALTIVEC_BUILTIN_VEC_RINT,
ALTIVEC_BUILTIN_VEC_ROUND,
ALTIVEC_BUILTIN_VEC_RSQRTE,
ALTIVEC_BUILTIN_VEC_SEL,
@@ -2772,6 +2780,7 @@ enum rs6000_builtins
ALTIVEC_BUILTIN_VEC_SPLTB,
ALTIVEC_BUILTIN_VEC_SPLTH,
ALTIVEC_BUILTIN_VEC_SPLTW,
+ ALTIVEC_BUILTIN_VEC_SQRT,
ALTIVEC_BUILTIN_VEC_SR,
ALTIVEC_BUILTIN_VEC_SRA,
ALTIVEC_BUILTIN_VEC_SRL,
@@ -3228,6 +3237,8 @@ enum rs6000_builtins
VSX_BUILTIN_XSRSQRTEDP,
VSX_BUILTIN_XSSQRTDP,
VSX_BUILTIN_XSSUBDP,
+ VSX_BUILTIN_CPSGNDP,
+ VSX_BUILTIN_CPSGNSP,
VSX_BUILTIN_XSTDIVDP_FE,
VSX_BUILTIN_XSTDIVDP_FG,
VSX_BUILTIN_XSTSQRTDP_FE,
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index ae1ea99d0a3..9524fe81f13 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -101,6 +101,7 @@
(UNSPEC_RSQRT 48)
(UNSPEC_TOCREL 49)
(UNSPEC_MACHOPIC_OFFSET 50)
+ (UNSPEC_BPERM 51)
])
;;
@@ -167,6 +168,7 @@
(include "power4.md")
(include "power5.md")
(include "power6.md")
+(include "power7.md")
(include "cell.md")
(include "xfpu.md")
@@ -5900,9 +5902,18 @@
(match_dup 5))
(match_dup 3)
(match_dup 4)))]
- "TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
- && !HONOR_NANS (DFmode) && !HONOR_SIGNED_ZEROS (DFmode)"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && ((TARGET_PPC_GFXOPT
+ && !HONOR_NANS (DFmode)
+ && !HONOR_SIGNED_ZEROS (DFmode))
+ || VECTOR_UNIT_VSX_P (DFmode))"
{
+ if (VECTOR_UNIT_VSX_P (DFmode))
+ {
+ emit_insn (gen_vsx_copysigndf3 (operands[0], operands[1],
+ operands[2], CONST0_RTX (DFmode)));
+ DONE;
+ }
operands[3] = gen_reg_rtx (DFmode);
operands[4] = gen_reg_rtx (DFmode);
operands[5] = CONST0_RTX (DFmode);
@@ -6037,7 +6048,8 @@
(define_insn "*negdf2_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"fneg %0,%1"
[(set_attr "type" "fp")])
@@ -6050,14 +6062,16 @@
(define_insn "*absdf2_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"fabs %0,%1"
[(set_attr "type" "fp")])
(define_insn "*nabsdf2_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"fnabs %0,%1"
[(set_attr "type" "fp")])
@@ -6072,7 +6086,8 @@
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"{fa|fadd} %0,%1,%2"
[(set_attr "type" "fp")
(set_attr "fp_type" "fp_addsub_d")])
@@ -6088,7 +6103,8 @@
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
(match_operand:DF 2 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"{fs|fsub} %0,%1,%2"
[(set_attr "type" "fp")
(set_attr "fp_type" "fp_addsub_d")])
@@ -6104,7 +6120,8 @@
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"{fm|fmul} %0,%1,%2"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_mul_d")])
@@ -6122,7 +6139,8 @@
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
(match_operand:DF 2 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"{fd|fdiv} %0,%1,%2"
[(set_attr "type" "ddiv")])
@@ -6138,73 +6156,81 @@
DONE;
})
-(define_insn "fred"
+(define_expand "fred"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRES))]
- "TARGET_POPCNTB && flag_finite_math_only"
+ "(TARGET_POPCNTB || VECTOR_UNIT_VSX_P (DFmode)) && flag_finite_math_only"
+ "")
+
+(define_insn "*fred_fpr"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
+ "TARGET_POPCNTB && flag_finite_math_only && !VECTOR_UNIT_VSX_P (DFmode)"
"fre %0,%1"
[(set_attr "type" "fp")])
-(define_insn ""
+(define_insn "*fmadddf4_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d"))
(match_operand:DF 3 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
+ && VECTOR_UNIT_NONE_P (DFmode)"
"{fma|fmadd} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
-(define_insn ""
+(define_insn "*fmsubdf4_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d"))
(match_operand:DF 3 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
+ && VECTOR_UNIT_NONE_P (DFmode)"
"{fms|fmsub} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
-(define_insn ""
+(define_insn "*fnmadddf4_fpr_1"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d"))
(match_operand:DF 3 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
- && HONOR_SIGNED_ZEROS (DFmode)"
+ && HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
"{fnma|fnmadd} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
-(define_insn ""
+(define_insn "*fnmadddf4_fpr_2"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
(match_operand:DF 2 "gpc_reg_operand" "d"))
(match_operand:DF 3 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
- && ! HONOR_SIGNED_ZEROS (DFmode)"
+ && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
"{fnma|fnmadd} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
-(define_insn ""
+(define_insn "*fnmsubdf4_fpr_1"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d"))
(match_operand:DF 3 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
- && HONOR_SIGNED_ZEROS (DFmode)"
+ && HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
"{fnms|fnmsub} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
-(define_insn ""
+(define_insn "*fnmsubdf4_fpr_2"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
(mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
(match_operand:DF 2 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
- && ! HONOR_SIGNED_ZEROS (DFmode)"
+ && ! HONOR_SIGNED_ZEROS (DFmode) && VECTOR_UNIT_NONE_P (DFmode)"
"{fnms|fnmsub} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
@@ -6213,7 +6239,8 @@
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
"(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
- && TARGET_DOUBLE_FLOAT"
+ && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"fsqrt %0,%1"
[(set_attr "type" "dsqrt")])
@@ -6308,6 +6335,12 @@
"TARGET_HARD_FLOAT && TARGET_E500_DOUBLE"
"")
+(define_expand "fixuns_truncdfdi2"
+ [(set (match_operand:DI 0 "register_operand" "")
+ (unsigned_fix:DI (match_operand:DF 1 "register_operand" "")))]
+ "TARGET_HARD_FLOAT && TARGET_VSX"
+ "")
+
; For each of these conversions, there is a define_expand, a define_insn
; with a '#' template, and a define_split (with C code). The idea is
; to allow constant folding with the template of the define_insn,
@@ -6549,24 +6582,38 @@
"{fcirz|fctiwz} %0,%1"
[(set_attr "type" "fp")])
-(define_insn "btruncdf2"
+(define_expand "btruncdf2"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
"TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "")
+
+(define_insn "*btruncdf2_fpr"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"friz %0,%1"
[(set_attr "type" "fp")])
(define_insn "btruncsf2"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
(unspec:SF [(match_operand:SF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT "
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
"friz %0,%1"
[(set_attr "type" "fp")])
-(define_insn "ceildf2"
+(define_expand "ceildf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIP))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "")
+
+(define_insn "*ceildf2_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"frip %0,%1"
[(set_attr "type" "fp")])
@@ -6577,10 +6624,17 @@
"frip %0,%1"
[(set_attr "type" "fp")])
-(define_insn "floordf2"
+(define_expand "floordf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "")] UNSPEC_FRIM))]
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "")
+
+(define_insn "*floordf2_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
- "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"frim %0,%1"
[(set_attr "type" "fp")])
@@ -6591,6 +6645,7 @@
"frim %0,%1"
[(set_attr "type" "fp")])
+;; No VSX equivalent to frin
(define_insn "rounddf2"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
@@ -6605,6 +6660,12 @@
"frin %0,%1"
[(set_attr "type" "fp")])
+(define_expand "ftruncdf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "")
+ (fix:DF (match_operand:DF 1 "gpc_reg_operand" "")))]
+ "VECTOR_UNIT_VSX_P (DFmode)"
+ "")
+
; An UNSPEC is used so we don't have to support SImode in FP registers.
(define_insn "stfiwx"
[(set (match_operand:SI 0 "memory_operand" "=Z")
@@ -6620,17 +6681,40 @@
"TARGET_HARD_FLOAT && !TARGET_FPRS"
"")
-(define_insn "floatdidf2"
+(define_expand "floatdidf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "")
+ (float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
+ "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
+ && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
+ "")
+
+(define_insn "*floatdidf2_fpr"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
- "(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
+ "(TARGET_POWERPC64 || TARGET_XILINX_FPU)
+ && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"fcfid %0,%1"
[(set_attr "type" "fp")])
-(define_insn "fix_truncdfdi2"
+(define_expand "floatunsdidf2"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "")
+ (unsigned_float:DF (match_operand:DI 1 "gpc_reg_operand" "")))]
+ "TARGET_VSX"
+ "")
+
+(define_expand "fix_truncdfdi2"
+ [(set (match_operand:DI 0 "gpc_reg_operand" "")
+ (fix:DI (match_operand:DF 1 "gpc_reg_operand" "")))]
+ "(TARGET_POWERPC64 || TARGET_XILINX_FPU || VECTOR_UNIT_VSX_P (DFmode))
+ && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
+ "")
+
+(define_insn "*fix_truncdfdi2_fpr"
[(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
(fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
- "(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
+ "(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT
+ && TARGET_DOUBLE_FLOAT && TARGET_FPRS && !VECTOR_UNIT_VSX_P (DFmode)"
"fctidz %0,%1"
[(set_attr "type" "fp")])
@@ -8956,8 +9040,8 @@
;; The "??" is a kludge until we can figure out a more reasonable way
;; of handling these non-offsettable values.
(define_insn "*movdf_hardfloat32"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,d,d,m,!r,!r,!r")
- (match_operand:DF 1 "input_operand" "r,m,r,d,m,d,G,H,F"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,!r,!r,!r")
+ (match_operand:DF 1 "input_operand" "r,m,r,ws,wa,Z,Z,ws,wa,d,m,d,j,G,H,F"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], DFmode)
|| gpc_reg_operand (operands[1], DFmode))"
@@ -9036,19 +9120,30 @@
return \"\";
}
case 3:
- return \"fmr %0,%1\";
case 4:
- return \"lfd%U1%X1 %0,%1\";
+ return \"xxlor %x0,%x1,%x1\";
case 5:
- return \"stfd%U0%X0 %1,%0\";
case 6:
+ return \"lxsd%U1x %x0,%y1\";
case 7:
case 8:
+ return \"stxsd%U0x %x1,%y0\";
+ case 9:
+ return \"fmr %0,%1\";
+ case 10:
+ return \"lfd%U1%X1 %0,%1\";
+ case 11:
+ return \"stfd%U0%X0 %1,%0\";
+ case 12:
+ return \"xxlxor %x0,%x0,%x0\";
+ case 13:
+ case 14:
+ case 15:
return \"#\";
}
}"
- [(set_attr "type" "two,load,store,fp,fpload,fpstore,*,*,*")
- (set_attr "length" "8,16,16,4,4,4,8,12,16")])
+ [(set_attr "type" "two,load,store,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,*,*,*")
+ (set_attr "length" "8,16,16,4,4,4,4,4,4,4,4,4,4,8,12,16")])
(define_insn "*movdf_softfloat32"
[(set (match_operand:DF 0 "nonimmediate_operand" "=r,r,m,r,r,r")
@@ -9096,19 +9191,26 @@
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*movdf_hardfloat64_mfpgpr"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r,r,d")
- (match_operand:DF 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F,d,r"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r,r,d")
+ (match_operand:DF 1 "input_operand" "r,Y,r,ws,?wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F,d,r"))]
"TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
- && TARGET_DOUBLE_FLOAT
+ && TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], DFmode)
|| gpc_reg_operand (operands[1], DFmode))"
"@
std%U0%X0 %1,%0
ld%U1%X1 %0,%1
mr %0,%1
+ xxlor %x0,%x1,%x1
+ xxlor %x0,%x1,%x1
+ lxsd%U1x %x0,%y1
+ lxsd%U1x %x0,%y1
+ stxsd%U0x %x1,%y0
+ stxsd%U0x %x1,%y0
fmr %0,%1
lfd%U1%X1 %0,%1
stfd%U0%X0 %1,%0
+ xxlxor %x0,%x0,%x0
mt%0 %1
mf%1 %0
{cror 0,0,0|nop}
@@ -9117,33 +9219,40 @@
#
mftgpr %0,%1
mffgpr %0,%1"
- [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
+ [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*,mftgpr,mffgpr")
+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4")])
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*movdf_hardfloat64"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r")
- (match_operand:DF 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,ws,?wa,ws,?wa,Z,?Z,d,d,m,wa,*c*l,!r,*h,!r,!r,!r")
+ (match_operand:DF 1 "input_operand" "r,Y,r,ws,wa,Z,Z,ws,wa,d,m,d,j,r,h,0,G,H,F"))]
"TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
- && TARGET_DOUBLE_FLOAT
+ && TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], DFmode)
|| gpc_reg_operand (operands[1], DFmode))"
"@
std%U0%X0 %1,%0
ld%U1%X1 %0,%1
mr %0,%1
+ xxlor %x0,%x1,%x1
+ xxlor %x0,%x1,%x1
+ lxsd%U1x %x0,%y1
+ lxsd%U1x %x0,%y1
+ stxsd%U0x %x1,%y0
+ stxsd%U0x %x1,%y0
fmr %0,%1
lfd%U1%X1 %0,%1
stfd%U0%X0 %1,%0
+ xxlxor %x0,%x0,%x0
mt%0 %1
mf%1 %0
{cror 0,0,0|nop}
#
#
#"
- [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,mfjmpr,*,*,*,*")
- (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")])
+ [(set_attr "type" "store,load,*,fp,fp,fpload,fpload,fpstore,fpstore,fp,fpload,fpstore,vecsimple,mtjmpr,mfjmpr,*,*,*,*")
+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16")])
(define_insn "*movdf_softfloat64"
[(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h")
@@ -9720,15 +9829,16 @@
(define_insn "*movti_ppc64"
[(set (match_operand:TI 0 "nonimmediate_operand" "=r,o<>,r")
(match_operand:TI 1 "input_operand" "r,r,m"))]
- "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
- || gpc_reg_operand (operands[1], TImode))"
+ "(TARGET_POWERPC64 && (gpc_reg_operand (operands[0], TImode)
+ || gpc_reg_operand (operands[1], TImode)))
+ && VECTOR_MEM_NONE_P (TImode)"
"#"
[(set_attr "type" "*,store,load")])
(define_split
[(set (match_operand:TI 0 "gpc_reg_operand" "")
(match_operand:TI 1 "const_double_operand" ""))]
- "TARGET_POWERPC64"
+ "TARGET_POWERPC64 && VECTOR_MEM_NONE_P (TImode)"
[(set (match_dup 2) (match_dup 4))
(set (match_dup 3) (match_dup 5))]
"
@@ -9754,7 +9864,7 @@
(define_split
[(set (match_operand:TI 0 "nonimmediate_operand" "")
(match_operand:TI 1 "input_operand" ""))]
- "reload_completed
+ "reload_completed && VECTOR_MEM_NONE_P (TImode)
&& gpr_or_gpr_p (operands[0], operands[1])"
[(pc)]
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
@@ -12647,7 +12757,8 @@
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
(compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
(match_operand:DF 2 "gpc_reg_operand" "d")))]
- "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && !VECTOR_UNIT_VSX_P (DFmode)"
"fcmpu %0,%1,%2"
[(set_attr "type" "fpcompare")])
@@ -15320,9 +15431,19 @@
}"
[(set_attr "type" "load")])
+(define_insn "bpermd_<mode>"
+ [(set (match_operand:P 0 "gpc_reg_operand" "=r")
+ (unspec:P [(match_operand:P 1 "gpc_reg_operand" "r")
+ (match_operand:P 2 "gpc_reg_operand" "r")] UNSPEC_BPERM))]
+ "TARGET_POPCNTD"
+ "bpermd %0,%1,%2"
+ [(set_attr "type" "integer")])
+
+
(include "sync.md")
(include "vector.md")
+(include "vsx.md")
(include "altivec.md")
(include "spe.md")
(include "dfp.md")
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index ac61ffc582e..90af9dce47b 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -151,6 +151,10 @@ malign-branch-targets
Target Undocumented Report Var(TARGET_ALIGN_BRANCH_TARGETS) Init(-1)
; Explicitly set/unset whether rs6000_align_branch_targets is set
+mvectorize-builtins
+Target Undocumented Report Var(TARGET_VECTORIZE_BUILTINS) Init(-1)
+; Explicitly control whether we vectorize the builtins or not.
+
mupdate
Target Report Var(TARGET_UPDATE) Init(1)
Generate load/store with update instructions
diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 0b8e311078d..66a367a7b62 100644
--- a/gcc/config/rs6000/t-rs6000
+++ b/gcc/config/rs6000/t-rs6000
@@ -53,6 +53,7 @@ MD_INCLUDES = $(srcdir)/config/rs6000/rios1.md \
$(srcdir)/config/rs6000/power4.md \
$(srcdir)/config/rs6000/power5.md \
$(srcdir)/config/rs6000/power6.md \
+ $(srcdir)/config/rs6000/power7.md \
$(srcdir)/config/rs6000/cell.md \
$(srcdir)/config/rs6000/xfpu.md \
$(srcdir)/config/rs6000/predicates.md \
@@ -60,6 +61,7 @@ MD_INCLUDES = $(srcdir)/config/rs6000/rios1.md \
$(srcdir)/config/rs6000/darwin.md \
$(srcdir)/config/rs6000/sync.md \
$(srcdir)/config/rs6000/vector.md \
+ $(srcdir)/config/rs6000/vsx.md \
$(srcdir)/config/rs6000/altivec.md \
$(srcdir)/config/rs6000/spe.md \
$(srcdir)/config/rs6000/dfp.md \
diff --git a/gcc/config/rs6000/vector.md b/gcc/config/rs6000/vector.md
index 1546db7a74f..6366e4fe0e7 100644
--- a/gcc/config/rs6000/vector.md
+++ b/gcc/config/rs6000/vector.md
@@ -1,6 +1,7 @@
-;; Expander definitions for vector support. No instructions are in this file,
-;; this file provides the generic vector expander, and the actual vector
-;; instructions will be in altivec.md.
+;; Expander definitions for vector support between altivec & vsx. No
+;; instructions are in this file, this file provides the generic vector
+;; expander, and the actual vector instructions will be in altivec.md and
+;; vsx.md
;; Copyright (C) 2009
;; Free Software Foundation, Inc.
@@ -27,10 +28,10 @@
(define_mode_iterator VEC_I [V16QI V8HI V4SI])
;; Vector float modes
-(define_mode_iterator VEC_F [V4SF])
+(define_mode_iterator VEC_F [V4SF V2DF])
;; Vector arithmetic modes
-(define_mode_iterator VEC_A [V16QI V8HI V4SI V4SF])
+(define_mode_iterator VEC_A [V16QI V8HI V4SI V4SF V2DF])
;; Vector modes that need alginment via permutes
(define_mode_iterator VEC_K [V16QI V8HI V4SI V4SF])
@@ -41,6 +42,9 @@
;; Vector modes for moves. Don't do TImode here.
(define_mode_iterator VEC_M [V16QI V8HI V4SI V2DI V4SF V2DF])
+;; Vector modes for types that don't need a realignment under VSX
+(define_mode_iterator VEC_N [V4SI V4SF V2DI V2DF])
+
;; Vector comparison modes
(define_mode_iterator VEC_C [V16QI V8HI V4SI V4SF V2DF])
@@ -75,7 +79,7 @@
(define_expand "mov<mode>"
[(set (match_operand:VEC_M 0 "nonimmediate_operand" "")
(match_operand:VEC_M 1 "any_operand" ""))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
{
if (can_create_pseudo_p ())
{
@@ -89,24 +93,25 @@
}
})
-;; Generic vector floating point load/store instructions.
+;; Generic vector floating point load/store instructions. These will match
+;; insns defined in vsx.md or altivec.md depending on the switches.
(define_expand "vector_load_<mode>"
[(set (match_operand:VEC_M 0 "vfloat_operand" "")
(match_operand:VEC_M 1 "memory_operand" ""))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_store_<mode>"
[(set (match_operand:VEC_M 0 "memory_operand" "")
(match_operand:VEC_M 1 "vfloat_operand" ""))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
;; Splits if a GPR register was chosen for the move
(define_split
[(set (match_operand:VEC_L 0 "nonimmediate_operand" "")
(match_operand:VEC_L 1 "input_operand" ""))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)
&& reload_completed
&& gpr_or_gpr_p (operands[0], operands[1])"
[(pc)]
@@ -149,7 +154,7 @@
(and:P (plus:P (match_operand:P 1 "gpc_reg_operand" "r")
(match_operand:P 2 "reg_or_cint_operand" "rI"))
(const_int -16)))]
- "TARGET_ALTIVEC && (reload_in_progress || reload_completed)"
+ "(TARGET_ALTIVEC || TARGET_VSX) && (reload_in_progress || reload_completed)"
"#"
"&& reload_completed"
[(set (match_dup 0)
@@ -167,7 +172,7 @@
[(set (match_operand:P 0 "gpc_reg_operand" "=b")
(and:P (match_operand:P 1 "gpc_reg_operand" "r")
(const_int -16)))]
- "TARGET_ALTIVEC && (reload_in_progress || reload_completed)"
+ "(TARGET_ALTIVEC || TARGET_VSX) && (reload_in_progress || reload_completed)"
"#"
"&& reload_completed"
[(parallel [(set (match_dup 0)
@@ -180,68 +185,131 @@
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(plus:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")
(match_operand:VEC_F 2 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "sub<mode>3"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(minus:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")
(match_operand:VEC_F 2 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "mul<mode>3"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(mult:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")
(match_operand:VEC_F 2 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode) && TARGET_FUSED_MADD"
+ "(VECTOR_UNIT_VSX_P (<MODE>mode)
+ || (VECTOR_UNIT_ALTIVEC_P (<MODE>mode) && TARGET_FUSED_MADD))"
"
{
- emit_insn (gen_altivec_mulv4sf3 (operands[0], operands[1], operands[2]));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_mulv4sf3 (operands[0], operands[1], operands[2]));
+ DONE;
+ }
}")
+(define_expand "div<mode>3"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (div:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")
+ (match_operand:VEC_F 2 "vfloat_operand" "")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "")
+
(define_expand "neg<mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(neg:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
- emit_insn (gen_altivec_negv4sf2 (operands[0], operands[1]));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_negv4sf2 (operands[0], operands[1]));
+ DONE;
+ }
}")
(define_expand "abs<mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(abs:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
- emit_insn (gen_altivec_absv4sf2 (operands[0], operands[1]));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_absv4sf2 (operands[0], operands[1]));
+ DONE;
+ }
}")
(define_expand "smin<mode>3"
[(set (match_operand:VEC_F 0 "register_operand" "")
(smin:VEC_F (match_operand:VEC_F 1 "register_operand" "")
(match_operand:VEC_F 2 "register_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "smax<mode>3"
[(set (match_operand:VEC_F 0 "register_operand" "")
(smax:VEC_F (match_operand:VEC_F 1 "register_operand" "")
(match_operand:VEC_F 2 "register_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
+(define_expand "sqrt<mode>2"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (sqrt:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "")
+
(define_expand "ftrunc<mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(fix:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "")
+
+(define_expand "vector_ceil<mode>2"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (unspec:VEC_F [(match_operand:VEC_F 1 "vfloat_operand" "")]
+ UNSPEC_FRIP))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "")
+
+(define_expand "vector_floor<mode>2"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (unspec:VEC_F [(match_operand:VEC_F 1 "vfloat_operand" "")]
+ UNSPEC_FRIM))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
+(define_expand "vector_btrunc<mode>2"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (fix:VEC_F (match_operand:VEC_F 1 "vfloat_operand" "")))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "")
+
+(define_expand "vector_copysign<mode>3"
+ [(set (match_operand:VEC_F 0 "vfloat_operand" "")
+ (if_then_else:VEC_F
+ (ge:VEC_F (match_operand:VEC_F 2 "vfloat_operand" "")
+ (match_dup 3))
+ (abs:VEC_F (match_operand:VEC_F 1 "vfloat_operand" ""))
+ (neg:VEC_F (abs:VEC_F (match_dup 1)))))]
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
+ "
+{
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_copysign_v4sf3 (operands[0], operands[1],
+ operands[2]));
+ DONE;
+ }
+
+ operands[3] = CONST0_RTX (<MODE>mode);
+}")
+
;; Vector comparisons
(define_expand "vcond<mode>"
@@ -252,7 +320,7 @@
(match_operand:VEC_F 5 "vfloat_operand" "")])
(match_operand:VEC_F 1 "vfloat_operand" "")
(match_operand:VEC_F 2 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
if (rs6000_emit_vector_cond_expr (operands[0], operands[1], operands[2],
@@ -302,21 +370,21 @@
[(set (match_operand:VEC_C 0 "vlogical_operand" "")
(eq:VEC_C (match_operand:VEC_C 1 "vlogical_operand" "")
(match_operand:VEC_C 2 "vlogical_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_gt<mode>"
[(set (match_operand:VEC_C 0 "vlogical_operand" "")
(gt:VEC_C (match_operand:VEC_C 1 "vlogical_operand" "")
(match_operand:VEC_C 2 "vlogical_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_ge<mode>"
[(set (match_operand:VEC_C 0 "vlogical_operand" "")
(ge:VEC_C (match_operand:VEC_C 1 "vlogical_operand" "")
(match_operand:VEC_C 2 "vlogical_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_gtu<mode>"
@@ -342,7 +410,7 @@
(const_int 0))
(match_operand:VEC_L 2 "vlogical_operand" "")
(match_operand:VEC_L 1 "vlogical_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_select_<mode>_uns"
@@ -352,7 +420,7 @@
(const_int 0))
(match_operand:VEC_L 2 "vlogical_operand" "")
(match_operand:VEC_L 1 "vlogical_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
;; Expansions that compare vectors producing a vector result and a predicate,
@@ -366,7 +434,7 @@
(set (match_operand:VEC_A 0 "vlogical_operand" "")
(eq:VEC_A (match_dup 1)
(match_dup 2)))])]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_gt_<mode>_p"
@@ -378,7 +446,7 @@
(set (match_operand:VEC_A 0 "vlogical_operand" "")
(gt:VEC_A (match_dup 1)
(match_dup 2)))])]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_ge_<mode>_p"
@@ -390,7 +458,7 @@
(set (match_operand:VEC_F 0 "vfloat_operand" "")
(ge:VEC_F (match_dup 1)
(match_dup 2)))])]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "vector_gtu_<mode>_p"
@@ -402,16 +470,16 @@
(set (match_operand:VEC_I 0 "vlogical_operand" "")
(gtu:VEC_I (match_dup 1)
(match_dup 2)))])]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
-;; AltiVec predicates.
+;; AltiVec/VSX predicates.
(define_expand "cr6_test_for_zero"
[(set (match_operand:SI 0 "register_operand" "=r")
(eq:SI (reg:CC 74)
(const_int 0)))]
- "TARGET_ALTIVEC"
+ "TARGET_ALTIVEC || TARGET_VSX"
"")
(define_expand "cr6_test_for_zero_reverse"
@@ -419,14 +487,14 @@
(eq:SI (reg:CC 74)
(const_int 0)))
(set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
- "TARGET_ALTIVEC"
+ "TARGET_ALTIVEC || TARGET_VSX"
"")
(define_expand "cr6_test_for_lt"
[(set (match_operand:SI 0 "register_operand" "=r")
(lt:SI (reg:CC 74)
(const_int 0)))]
- "TARGET_ALTIVEC"
+ "TARGET_ALTIVEC || TARGET_VSX"
"")
(define_expand "cr6_test_for_lt_reverse"
@@ -434,7 +502,7 @@
(lt:SI (reg:CC 74)
(const_int 0)))
(set (match_dup 0) (minus:SI (const_int 1) (match_dup 0)))]
- "TARGET_ALTIVEC"
+ "TARGET_ALTIVEC || TARGET_VSX"
"")
@@ -443,82 +511,94 @@
[(set (match_operand:VEC_L 0 "vlogical_operand" "")
(xor:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
(match_operand:VEC_L 2 "vlogical_operand" "")))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "ior<mode>3"
[(set (match_operand:VEC_L 0 "vlogical_operand" "")
(ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
(match_operand:VEC_L 2 "vlogical_operand" "")))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "and<mode>3"
[(set (match_operand:VEC_L 0 "vlogical_operand" "")
(and:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
(match_operand:VEC_L 2 "vlogical_operand" "")))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "one_cmpl<mode>2"
[(set (match_operand:VEC_L 0 "vlogical_operand" "")
(not:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "nor<mode>3"
[(set (match_operand:VEC_L 0 "vlogical_operand" "")
(not:VEC_L (ior:VEC_L (match_operand:VEC_L 1 "vlogical_operand" "")
(match_operand:VEC_L 2 "vlogical_operand" ""))))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
(define_expand "andc<mode>3"
[(set (match_operand:VEC_L 0 "vlogical_operand" "")
(and:VEC_L (not:VEC_L (match_operand:VEC_L 2 "vlogical_operand" ""))
(match_operand:VEC_L 1 "vlogical_operand" "")))]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
"")
;; Same size conversions
(define_expand "float<VEC_int><mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(float:VEC_F (match_operand:<VEC_INT> 1 "vint_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
- emit_insn (gen_altivec_vcfsx (operands[0], operands[1], const0_rtx));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_vcfsx (operands[0], operands[1], const0_rtx));
+ DONE;
+ }
}")
(define_expand "unsigned_float<VEC_int><mode>2"
[(set (match_operand:VEC_F 0 "vfloat_operand" "")
(unsigned_float:VEC_F (match_operand:<VEC_INT> 1 "vint_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
- emit_insn (gen_altivec_vcfux (operands[0], operands[1], const0_rtx));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_vcfux (operands[0], operands[1], const0_rtx));
+ DONE;
+ }
}")
(define_expand "fix_trunc<mode><VEC_int>2"
[(set (match_operand:<VEC_INT> 0 "vint_operand" "")
(fix:<VEC_INT> (match_operand:VEC_F 1 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
- emit_insn (gen_altivec_vctsxs (operands[0], operands[1], const0_rtx));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_vctsxs (operands[0], operands[1], const0_rtx));
+ DONE;
+ }
}")
(define_expand "fixuns_trunc<mode><VEC_int>2"
[(set (match_operand:<VEC_INT> 0 "vint_operand" "")
(unsigned_fix:<VEC_INT> (match_operand:VEC_F 1 "vfloat_operand" "")))]
- "VECTOR_UNIT_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (<MODE>mode)"
"
{
- emit_insn (gen_altivec_vctuxs (operands[0], operands[1], const0_rtx));
- DONE;
+ if (<MODE>mode == V4SFmode && VECTOR_UNIT_ALTIVEC_P (<MODE>mode))
+ {
+ emit_insn (gen_altivec_vctuxs (operands[0], operands[1], const0_rtx));
+ DONE;
+ }
}")
@@ -526,7 +606,7 @@
(define_expand "vec_init<mode>"
[(match_operand:VEC_E 0 "vlogical_operand" "")
(match_operand:VEC_E 1 "" "")]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
{
rs6000_expand_vector_init (operands[0], operands[1]);
DONE;
@@ -536,7 +616,7 @@
[(match_operand:VEC_E 0 "vlogical_operand" "")
(match_operand:<VEC_base> 1 "register_operand" "")
(match_operand 2 "const_int_operand" "")]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
{
rs6000_expand_vector_set (operands[0], operands[1], INTVAL (operands[2]));
DONE;
@@ -546,7 +626,7 @@
[(match_operand:<VEC_base> 0 "register_operand" "")
(match_operand:VEC_E 1 "vlogical_operand" "")
(match_operand 2 "const_int_operand" "")]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
{
rs6000_expand_vector_extract (operands[0], operands[1],
INTVAL (operands[2]));
@@ -568,7 +648,7 @@
(const_int 3)
(const_int 1)]))
(const_int 5)))]
- "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)"
"")
(define_expand "vec_interleave_lowv4sf"
@@ -585,23 +665,171 @@
(const_int 1)
(const_int 3)]))
(const_int 5)))]
- "VECTOR_UNIT_ALTIVEC_P (V4SFmode)"
+ "VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)"
+ "")
+
+(define_expand "vec_interleave_highv2df"
+ [(set (match_operand:V2DF 0 "vfloat_operand" "")
+ (vec_concat:V2DF
+ (vec_select:DF (match_operand:V2DF 1 "vfloat_operand" "")
+ (parallel [(const_int 0)]))
+ (vec_select:DF (match_operand:V2DF 2 "vfloat_operand" "")
+ (parallel [(const_int 0)]))))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "")
+
+(define_expand "vec_interleave_lowv2df"
+ [(set (match_operand:V2DF 0 "vfloat_operand" "")
+ (vec_concat:V2DF
+ (vec_select:DF (match_operand:V2DF 1 "vfloat_operand" "")
+ (parallel [(const_int 1)]))
+ (vec_select:DF (match_operand:V2DF 2 "vfloat_operand" "")
+ (parallel [(const_int 1)]))))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
"")
+;; Convert double word types to single word types
+(define_expand "vec_pack_trunc_v2df"
+ [(match_operand:V4SF 0 "vfloat_operand" "")
+ (match_operand:V2DF 1 "vfloat_operand" "")
+ (match_operand:V2DF 2 "vfloat_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && TARGET_ALTIVEC"
+{
+ rtx r1 = gen_reg_rtx (V4SFmode);
+ rtx r2 = gen_reg_rtx (V4SFmode);
+
+ emit_insn (gen_vsx_xvcvdpsp (r1, operands[1]));
+ emit_insn (gen_vsx_xvcvdpsp (r2, operands[2]));
+ emit_insn (gen_vec_extract_evenv4sf (operands[0], r1, r2));
+ DONE;
+})
+
+(define_expand "vec_pack_sfix_trunc_v2df"
+ [(match_operand:V4SI 0 "vint_operand" "")
+ (match_operand:V2DF 1 "vfloat_operand" "")
+ (match_operand:V2DF 2 "vfloat_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && TARGET_ALTIVEC"
+{
+ rtx r1 = gen_reg_rtx (V4SImode);
+ rtx r2 = gen_reg_rtx (V4SImode);
+
+ emit_insn (gen_vsx_xvcvdpsxws (r1, operands[1]));
+ emit_insn (gen_vsx_xvcvdpsxws (r2, operands[2]));
+ emit_insn (gen_vec_extract_evenv4si (operands[0], r1, r2));
+ DONE;
+})
+
+(define_expand "vec_pack_ufix_trunc_v2df"
+ [(match_operand:V4SI 0 "vint_operand" "")
+ (match_operand:V2DF 1 "vfloat_operand" "")
+ (match_operand:V2DF 2 "vfloat_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && TARGET_ALTIVEC"
+{
+ rtx r1 = gen_reg_rtx (V4SImode);
+ rtx r2 = gen_reg_rtx (V4SImode);
+
+ emit_insn (gen_vsx_xvcvdpuxws (r1, operands[1]));
+ emit_insn (gen_vsx_xvcvdpuxws (r2, operands[2]));
+ emit_insn (gen_vec_extract_evenv4si (operands[0], r1, r2));
+ DONE;
+})
+
+;; Convert single word types to double word
+(define_expand "vec_unpacks_hi_v4sf"
+ [(match_operand:V2DF 0 "vfloat_operand" "")
+ (match_operand:V4SF 1 "vfloat_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)"
+{
+ rtx reg = gen_reg_rtx (V4SFmode);
+
+ emit_insn (gen_vec_interleave_highv4sf (reg, operands[1], operands[1]));
+ emit_insn (gen_vsx_xvcvspdp (operands[0], reg));
+ DONE;
+})
+
+(define_expand "vec_unpacks_lo_v4sf"
+ [(match_operand:V2DF 0 "vfloat_operand" "")
+ (match_operand:V4SF 1 "vfloat_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SFmode)"
+{
+ rtx reg = gen_reg_rtx (V4SFmode);
+
+ emit_insn (gen_vec_interleave_lowv4sf (reg, operands[1], operands[1]));
+ emit_insn (gen_vsx_xvcvspdp (operands[0], reg));
+ DONE;
+})
+
+(define_expand "vec_unpacks_float_hi_v4si"
+ [(match_operand:V2DF 0 "vfloat_operand" "")
+ (match_operand:V4SI 1 "vint_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SImode)"
+{
+ rtx reg = gen_reg_rtx (V4SImode);
+
+ emit_insn (gen_vec_interleave_highv4si (reg, operands[1], operands[1]));
+ emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg));
+ DONE;
+})
+
+(define_expand "vec_unpacks_float_lo_v4si"
+ [(match_operand:V2DF 0 "vfloat_operand" "")
+ (match_operand:V4SI 1 "vint_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SImode)"
+{
+ rtx reg = gen_reg_rtx (V4SImode);
+
+ emit_insn (gen_vec_interleave_lowv4si (reg, operands[1], operands[1]));
+ emit_insn (gen_vsx_xvcvsxwdp (operands[0], reg));
+ DONE;
+})
+
+(define_expand "vec_unpacku_float_hi_v4si"
+ [(match_operand:V2DF 0 "vfloat_operand" "")
+ (match_operand:V4SI 1 "vint_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SImode)"
+{
+ rtx reg = gen_reg_rtx (V4SImode);
+
+ emit_insn (gen_vec_interleave_highv4si (reg, operands[1], operands[1]));
+ emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg));
+ DONE;
+})
+
+(define_expand "vec_unpacku_float_lo_v4si"
+ [(match_operand:V2DF 0 "vfloat_operand" "")
+ (match_operand:V4SI 1 "vint_operand" "")]
+ "VECTOR_UNIT_VSX_P (V2DFmode) && VECTOR_UNIT_ALTIVEC_OR_VSX_P (V4SImode)"
+{
+ rtx reg = gen_reg_rtx (V4SImode);
+
+ emit_insn (gen_vec_interleave_lowv4si (reg, operands[1], operands[1]));
+ emit_insn (gen_vsx_xvcvuxwdp (operands[0], reg));
+ DONE;
+})
+
+
;; Align vector loads with a permute.
(define_expand "vec_realign_load_<mode>"
[(match_operand:VEC_K 0 "vlogical_operand" "")
(match_operand:VEC_K 1 "vlogical_operand" "")
(match_operand:VEC_K 2 "vlogical_operand" "")
(match_operand:V16QI 3 "vlogical_operand" "")]
- "VECTOR_MEM_ALTIVEC_P (<MODE>mode)"
+ "VECTOR_MEM_ALTIVEC_OR_VSX_P (<MODE>mode)"
{
emit_insn (gen_altivec_vperm_<mode> (operands[0], operands[1], operands[2],
operands[3]));
DONE;
})
+;; Under VSX, vectors of 4/8 byte alignments do not need to be aligned
+;; since the load already handles it.
+(define_expand "movmisalign<mode>"
+ [(set (match_operand:VEC_N 0 "vfloat_operand" "")
+ (match_operand:VEC_N 1 "vfloat_operand" ""))]
+ "VECTOR_MEM_VSX_P (<MODE>mode) && TARGET_ALLOW_MOVMISALIGN"
+ "")
+
;; Vector shift left in bits. Currently supported ony for shift
;; amounts that can be expressed as byte shifts (divisible by 8).
@@ -627,9 +855,18 @@
if (bitshift_val & 0x7)
FAIL;
byteshift_val = bitshift_val >> 3;
- shift = gen_rtx_CONST_INT (QImode, byteshift_val);
- insn = gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
- shift);
+ if (TARGET_VSX && (byteshift_val & 0x3) == 0)
+ {
+ shift = gen_rtx_CONST_INT (QImode, byteshift_val >> 2);
+ insn = gen_vsx_xxsldwi_<mode> (operands[0], operands[1], operands[1],
+ shift);
+ }
+ else
+ {
+ shift = gen_rtx_CONST_INT (QImode, byteshift_val);
+ insn = gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
+ shift);
+ }
emit_insn (insn);
DONE;
@@ -659,9 +896,18 @@
if (bitshift_val & 0x7)
FAIL;
byteshift_val = 16 - (bitshift_val >> 3);
- shift = gen_rtx_CONST_INT (QImode, byteshift_val);
- insn = gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
- shift);
+ if (TARGET_VSX && (byteshift_val & 0x3) == 0)
+ {
+ shift = gen_rtx_CONST_INT (QImode, byteshift_val >> 2);
+ insn = gen_vsx_xxsldwi_<mode> (operands[0], operands[1], operands[1],
+ shift);
+ }
+ else
+ {
+ shift = gen_rtx_CONST_INT (QImode, byteshift_val);
+ insn = gen_altivec_vsldoi_<mode> (operands[0], operands[1], operands[1],
+ shift);
+ }
emit_insn (insn);
DONE;
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
new file mode 100644
index 00000000000..c6aafa6fac0
--- /dev/null
+++ b/gcc/config/rs6000/vsx.md
@@ -0,0 +1,1339 @@
+;; VSX patterns.
+;; Copyright (C) 2009
+;; Free Software Foundation, Inc.
+;; Contributed by Michael Meissner <meissner@linux.vnet.ibm.com>
+
+;; This file is part of GCC.
+
+;; GCC is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 3, or (at your
+;; option) any later version.
+
+;; GCC is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+;; License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; Iterator for both scalar and vector floating point types supported by VSX
+(define_mode_iterator VSX_B [DF V4SF V2DF])
+
+;; Iterator for the 2 64-bit vector types
+(define_mode_iterator VSX_D [V2DF V2DI])
+
+;; Iterator for the 2 32-bit vector types
+(define_mode_iterator VSX_W [V4SF V4SI])
+
+;; Iterator for vector floating point types supported by VSX
+(define_mode_iterator VSX_F [V4SF V2DF])
+
+;; Iterator for logical types supported by VSX
+(define_mode_iterator VSX_L [V16QI V8HI V4SI V2DI V4SF V2DF TI])
+
+;; Iterator for memory move. Handle TImode specially to allow
+;; it to use gprs as well as vsx registers.
+(define_mode_iterator VSX_M [V16QI V8HI V4SI V2DI V4SF V2DF])
+
+;; Iterator for types for load/store with update
+(define_mode_iterator VSX_U [V16QI V8HI V4SI V2DI V4SF V2DF TI DF])
+
+;; Map into the appropriate load/store name based on the type
+(define_mode_attr VSm [(V16QI "vw4")
+ (V8HI "vw4")
+ (V4SI "vw4")
+ (V4SF "vw4")
+ (V2DF "vd2")
+ (V2DI "vd2")
+ (DF "d")
+ (TI "vw4")])
+
+;; Map into the appropriate suffix based on the type
+(define_mode_attr VSs [(V16QI "sp")
+ (V8HI "sp")
+ (V4SI "sp")
+ (V4SF "sp")
+ (V2DF "dp")
+ (V2DI "dp")
+ (DF "dp")
+ (SF "sp")
+ (TI "sp")])
+
+;; Map the register class used
+(define_mode_attr VSr [(V16QI "v")
+ (V8HI "v")
+ (V4SI "v")
+ (V4SF "wf")
+ (V2DI "wd")
+ (V2DF "wd")
+ (DF "ws")
+ (SF "d")
+ (TI "wd")])
+
+;; Map the register class used for float<->int conversions
+(define_mode_attr VSr2 [(V2DF "wd")
+ (V4SF "wf")
+ (DF "!f#r")])
+
+(define_mode_attr VSr3 [(V2DF "wa")
+ (V4SF "wa")
+ (DF "!f#r")])
+
+;; Map the register class for sp<->dp float conversions, destination
+(define_mode_attr VSr4 [(SF "ws")
+ (DF "f")
+ (V2DF "wd")
+ (V4SF "v")])
+
+;; Map the register class for sp<->dp float conversions, destination
+(define_mode_attr VSr5 [(SF "ws")
+ (DF "f")
+ (V2DF "v")
+ (V4SF "wd")])
+
+;; Same size integer type for floating point data
+(define_mode_attr VSi [(V4SF "v4si")
+ (V2DF "v2di")
+ (DF "di")])
+
+(define_mode_attr VSI [(V4SF "V4SI")
+ (V2DF "V2DI")
+ (DF "DI")])
+
+;; Word size for same size conversion
+(define_mode_attr VSc [(V4SF "w")
+ (V2DF "d")
+ (DF "d")])
+
+;; Bitsize for DF load with update
+(define_mode_attr VSbit [(SI "32")
+ (DI "64")])
+
+;; Map into either s or v, depending on whether this is a scalar or vector
+;; operation
+(define_mode_attr VSv [(V16QI "v")
+ (V8HI "v")
+ (V4SI "v")
+ (V4SF "v")
+ (V2DI "v")
+ (V2DF "v")
+ (TI "v")
+ (DF "s")])
+
+;; Appropriate type for add ops (and other simple FP ops)
+(define_mode_attr VStype_simple [(V2DF "vecfloat")
+ (V4SF "vecfloat")
+ (DF "fp")])
+
+(define_mode_attr VSfptype_simple [(V2DF "fp_addsub_d")
+ (V4SF "fp_addsub_s")
+ (DF "fp_addsub_d")])
+
+;; Appropriate type for multiply ops
+(define_mode_attr VStype_mul [(V2DF "vecfloat")
+ (V4SF "vecfloat")
+ (DF "dmul")])
+
+(define_mode_attr VSfptype_mul [(V2DF "fp_mul_d")
+ (V4SF "fp_mul_s")
+ (DF "fp_mul_d")])
+
+;; Appropriate type for divide ops. For now, just lump the vector divide with
+;; the scalar divides
+(define_mode_attr VStype_div [(V2DF "ddiv")
+ (V4SF "sdiv")
+ (DF "ddiv")])
+
+(define_mode_attr VSfptype_div [(V2DF "fp_div_d")
+ (V4SF "fp_div_s")
+ (DF "fp_div_d")])
+
+;; Appropriate type for sqrt ops. For now, just lump the vector sqrt with
+;; the scalar sqrt
+(define_mode_attr VStype_sqrt [(V2DF "dsqrt")
+ (V4SF "sdiv")
+ (DF "ddiv")])
+
+(define_mode_attr VSfptype_sqrt [(V2DF "fp_sqrt_d")
+ (V4SF "fp_sqrt_s")
+ (DF "fp_sqrt_d")])
+
+;; Iterator and modes for sp<->dp conversions
+;; Because scalar SF values are represented internally as double, use the
+;; V4SF type to represent this than SF.
+(define_mode_iterator VSX_SPDP [DF V4SF V2DF])
+
+(define_mode_attr VS_spdp_res [(DF "V4SF")
+ (V4SF "V2DF")
+ (V2DF "V4SF")])
+
+(define_mode_attr VS_spdp_insn [(DF "xscvdpsp")
+ (V4SF "xvcvspdp")
+ (V2DF "xvcvdpsp")])
+
+(define_mode_attr VS_spdp_type [(DF "fp")
+ (V4SF "vecfloat")
+ (V2DF "vecfloat")])
+
+;; Map the scalar mode for a vector type
+(define_mode_attr VS_scalar [(V2DF "DF")
+ (V2DI "DI")
+ (V4SF "SF")
+ (V4SI "SI")
+ (V8HI "HI")
+ (V16QI "QI")])
+
+;; Appropriate type for load + update
+(define_mode_attr VStype_load_update [(V16QI "vecload")
+ (V8HI "vecload")
+ (V4SI "vecload")
+ (V4SF "vecload")
+ (V2DI "vecload")
+ (V2DF "vecload")
+ (TI "vecload")
+ (DF "fpload")])
+
+;; Appropriate type for store + update
+(define_mode_attr VStype_store_update [(V16QI "vecstore")
+ (V8HI "vecstore")
+ (V4SI "vecstore")
+ (V4SF "vecstore")
+ (V2DI "vecstore")
+ (V2DF "vecstore")
+ (TI "vecstore")
+ (DF "fpstore")])
+
+;; Constants for creating unspecs
+(define_constants
+ [(UNSPEC_VSX_CONCAT 500)
+ (UNSPEC_VSX_CVDPSXWS 501)
+ (UNSPEC_VSX_CVDPUXWS 502)
+ (UNSPEC_VSX_CVSPDP 503)
+ (UNSPEC_VSX_CVSXWDP 504)
+ (UNSPEC_VSX_CVUXWDP 505)
+ (UNSPEC_VSX_CVSXDSP 506)
+ (UNSPEC_VSX_CVUXDSP 507)
+ (UNSPEC_VSX_CVSPSXDS 508)
+ (UNSPEC_VSX_CVSPUXDS 509)
+ (UNSPEC_VSX_MADD 510)
+ (UNSPEC_VSX_MSUB 511)
+ (UNSPEC_VSX_NMADD 512)
+ (UNSPEC_VSX_NMSUB 513)
+ (UNSPEC_VSX_RSQRTE 514)
+ (UNSPEC_VSX_TDIV 515)
+ (UNSPEC_VSX_TSQRT 516)
+ (UNSPEC_VSX_XXPERMDI 517)
+ (UNSPEC_VSX_SET 518)
+ (UNSPEC_VSX_ROUND_I 519)
+ (UNSPEC_VSX_ROUND_IC 520)
+ (UNSPEC_VSX_SLDWI 521)])
+
+;; VSX moves
+(define_insn "*vsx_mov<mode>"
+ [(set (match_operand:VSX_M 0 "nonimmediate_operand" "=Z,<VSr>,<VSr>,?Z,?wa,?wa,*o,*r,*r,<VSr>,?wa,v,wZ,v")
+ (match_operand:VSX_M 1 "input_operand" "<VSr>,Z,<VSr>,wa,Z,wa,r,o,r,j,j,W,v,wZ"))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)
+ && (register_operand (operands[0], <MODE>mode)
+ || register_operand (operands[1], <MODE>mode))"
+{
+ switch (which_alternative)
+ {
+ case 0:
+ case 3:
+ return "stx<VSm>%U0x %x1,%y0";
+
+ case 1:
+ case 4:
+ return "lx<VSm>%U0x %x0,%y1";
+
+ case 2:
+ case 5:
+ return "xxlor %x0,%x1,%x1";
+
+ case 6:
+ case 7:
+ case 8:
+ return "#";
+
+ case 9:
+ case 10:
+ return "xxlxor %x0,%x0,%x0";
+
+ case 11:
+ return output_vec_const_move (operands);
+
+ case 12:
+ return "stvx %1,%y0";
+
+ case 13:
+ return "lvx %0,%y1";
+
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "type" "vecstore,vecload,vecsimple,vecstore,vecload,vecsimple,*,*,*,vecsimple,vecsimple,*,vecstore,vecload")])
+
+;; Unlike other VSX moves, allow the GPRs, since a normal use of TImode is for
+;; unions. However for plain data movement, slightly favor the vector loads
+(define_insn "*vsx_movti"
+ [(set (match_operand:TI 0 "nonimmediate_operand" "=Z,wa,wa,?o,?r,?r,wa,v,v,wZ")
+ (match_operand:TI 1 "input_operand" "wa,Z,wa,r,o,r,j,W,wZ,v"))]
+ "VECTOR_MEM_VSX_P (TImode)
+ && (register_operand (operands[0], TImode)
+ || register_operand (operands[1], TImode))"
+{
+ switch (which_alternative)
+ {
+ case 0:
+ return "stxvd2%U0x %x1,%y0";
+
+ case 1:
+ return "lxvd2%U0x %x0,%y1";
+
+ case 2:
+ return "xxlor %x0,%x1,%x1";
+
+ case 3:
+ case 4:
+ case 5:
+ return "#";
+
+ case 6:
+ return "xxlxor %x0,%x0,%x0";
+
+ case 7:
+ return output_vec_const_move (operands);
+
+ case 8:
+ return "stvx %1,%y0";
+
+ case 9:
+ return "lvx %0,%y1";
+
+ default:
+ gcc_unreachable ();
+ }
+}
+ [(set_attr "type" "vecstore,vecload,vecsimple,*,*,*,vecsimple,*,vecstore,vecload")])
+
+;; Load/store with update
+;; Define insns that do load or store with update. Because VSX only has
+;; reg+reg addressing, pre-decrement or pre-increment is unlikely to be
+;; generated.
+;;
+;; In all these cases, we use operands 0 and 1 for the register being
+;; incremented because those are the operands that local-alloc will
+;; tie and these are the pair most likely to be tieable (and the ones
+;; that will benefit the most).
+
+(define_insn "*vsx_load<VSX_U:mode>_update_<P:mptrsize>"
+ [(set (match_operand:VSX_U 3 "vsx_register_operand" "=<VSr>,?wa")
+ (mem:VSX_U (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
+ (match_operand:P 2 "gpc_reg_operand" "r,r"))))
+ (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
+ (plus:P (match_dup 1)
+ (match_dup 2)))]
+ "<P:tptrsize> && TARGET_UPDATE && VECTOR_MEM_VSX_P (<MODE>mode)"
+ "lx<VSm>ux %x3,%0,%2"
+ [(set_attr "type" "<VSX_U:VStype_load_update>")])
+
+(define_insn "*vsx_store<mode>_update_<P:mptrsize>"
+ [(set (mem:VSX_U (plus:P (match_operand:P 1 "gpc_reg_operand" "0,0")
+ (match_operand:P 2 "gpc_reg_operand" "r,r")))
+ (match_operand:VSX_U 3 "gpc_reg_operand" "<VSr>,?wa"))
+ (set (match_operand:P 0 "gpc_reg_operand" "=b,b")
+ (plus:P (match_dup 1)
+ (match_dup 2)))]
+ "<P:tptrsize> && TARGET_UPDATE && VECTOR_MEM_VSX_P (<MODE>mode)"
+ "stx<VSm>ux %x3,%0,%2"
+ [(set_attr "type" "<VSX_U:VStype_store_update>")])
+
+;; We may need to have a varient on the pattern for use in the prologue
+;; that doesn't depend on TARGET_UPDATE.
+
+
+;; VSX scalar and vector floating point arithmetic instructions
+(define_insn "*vsx_add<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (plus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>add<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_sub<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (minus:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>sub<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_mul<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (mult:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>mul<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "*vsx_div<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (div:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>div<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_div>")
+ (set_attr "fp_type" "<VSfptype_div>")])
+
+;; *tdiv* instruction returning the FG flag
+(define_expand "vsx_tdiv<mode>3_fg"
+ [(set (match_dup 3)
+ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" "")
+ (match_operand:VSX_B 2 "vsx_register_operand" "")]
+ UNSPEC_VSX_TDIV))
+ (set (match_operand:SI 0 "gpc_reg_operand" "")
+ (gt:SI (match_dup 3)
+ (const_int 0)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ operands[3] = gen_reg_rtx (CCFPmode);
+})
+
+;; *tdiv* instruction returning the FE flag
+(define_expand "vsx_tdiv<mode>3_fe"
+ [(set (match_dup 3)
+ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" "")
+ (match_operand:VSX_B 2 "vsx_register_operand" "")]
+ UNSPEC_VSX_TDIV))
+ (set (match_operand:SI 0 "gpc_reg_operand" "")
+ (eq:SI (match_dup 3)
+ (const_int 0)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ operands[3] = gen_reg_rtx (CCFPmode);
+})
+
+(define_insn "*vsx_tdiv<mode>3_internal"
+ [(set (match_operand:CCFP 0 "cc_reg_operand" "=x,x")
+ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_VSX_TDIV))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>tdiv<VSs> %0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_fre<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_FRES))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>re<VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_neg<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (neg:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>neg<VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_abs<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>abs<VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_nabs<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (neg:VSX_B
+ (abs:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>nabs<VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_smax<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (smax:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>max<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_smin<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (smin:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>min<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_sqrt<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (sqrt:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>sqrt<VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_sqrt>")
+ (set_attr "fp_type" "<VSfptype_sqrt>")])
+
+(define_insn "vsx_rsqrte<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_VSX_RSQRTE))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>rsqrte<VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+;; *tsqrt* returning the fg flag
+(define_expand "vsx_tsqrt<mode>2_fg"
+ [(set (match_dup 3)
+ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" "")]
+ UNSPEC_VSX_TSQRT))
+ (set (match_operand:SI 0 "gpc_reg_operand" "")
+ (gt:SI (match_dup 3)
+ (const_int 0)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ operands[3] = gen_reg_rtx (CCFPmode);
+})
+
+;; *tsqrt* returning the fe flag
+(define_expand "vsx_tsqrt<mode>2_fe"
+ [(set (match_dup 3)
+ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" "")]
+ UNSPEC_VSX_TSQRT))
+ (set (match_operand:SI 0 "gpc_reg_operand" "")
+ (eq:SI (match_dup 3)
+ (const_int 0)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ operands[3] = gen_reg_rtx (CCFPmode);
+})
+
+(define_insn "*vsx_tsqrt<mode>2_internal"
+ [(set (match_operand:CCFP 0 "cc_reg_operand" "=x,x")
+ (unspec:CCFP [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_VSX_TSQRT))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>tsqrt<VSs> %0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+;; Fused vector multiply/add instructions
+
+;; Note we have a pattern for the multiply/add operations that uses unspec and
+;; does not check -mfused-madd to allow users to use these ops when they know
+;; they want the fused multiply/add.
+
+(define_expand "vsx_fmadd<mode>4"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "")
+ (plus:VSX_B
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "")
+ (match_operand:VSX_B 2 "vsx_register_operand" ""))
+ (match_operand:VSX_B 3 "vsx_register_operand" "")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ if (!TARGET_FUSED_MADD)
+ {
+ emit_insn (gen_vsx_fmadd<mode>4_2 (operands[0], operands[1], operands[2],
+ operands[3]));
+ DONE;
+ }
+})
+
+(define_insn "*vsx_fmadd<mode>4_1"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (plus:VSX_B
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0"))
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode) && TARGET_FUSED_MADD"
+ "@
+ x<VSv>madda<VSs> %x0,%x1,%x2
+ x<VSv>maddm<VSs> %x0,%x1,%x3
+ x<VSv>madda<VSs> %x0,%x1,%x2
+ x<VSv>maddm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "vsx_fmadd<mode>4_2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0")
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")]
+ UNSPEC_VSX_MADD))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "@
+ x<VSv>madda<VSs> %x0,%x1,%x2
+ x<VSv>maddm<VSs> %x0,%x1,%x3
+ x<VSv>madda<VSs> %x0,%x1,%x2
+ x<VSv>maddm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_expand "vsx_fmsub<mode>4"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "")
+ (minus:VSX_B
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "")
+ (match_operand:VSX_B 2 "vsx_register_operand" ""))
+ (match_operand:VSX_B 3 "vsx_register_operand" "")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ if (!TARGET_FUSED_MADD)
+ {
+ emit_insn (gen_vsx_fmsub<mode>4_2 (operands[0], operands[1], operands[2],
+ operands[3]));
+ DONE;
+ }
+})
+
+(define_insn "*vsx_fmsub<mode>4_1"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (minus:VSX_B
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0"))
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode) && TARGET_FUSED_MADD"
+ "@
+ x<VSv>msuba<VSs> %x0,%x1,%x2
+ x<VSv>msubm<VSs> %x0,%x1,%x3
+ x<VSv>msuba<VSs> %x0,%x1,%x2
+ x<VSv>msubm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "vsx_fmsub<mode>4_2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0")
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")]
+ UNSPEC_VSX_MSUB))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "@
+ x<VSv>msuba<VSs> %x0,%x1,%x2
+ x<VSv>msubm<VSs> %x0,%x1,%x3
+ x<VSv>msuba<VSs> %x0,%x1,%x2
+ x<VSv>msubm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_expand "vsx_fnmadd<mode>4"
+ [(match_operand:VSX_B 0 "vsx_register_operand" "")
+ (match_operand:VSX_B 1 "vsx_register_operand" "")
+ (match_operand:VSX_B 2 "vsx_register_operand" "")
+ (match_operand:VSX_B 3 "vsx_register_operand" "")]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ if (TARGET_FUSED_MADD && HONOR_SIGNED_ZEROS (DFmode))
+ {
+ emit_insn (gen_vsx_fnmadd<mode>4_1 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+ else if (TARGET_FUSED_MADD && !HONOR_SIGNED_ZEROS (DFmode))
+ {
+ emit_insn (gen_vsx_fnmadd<mode>4_2 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+ else
+ {
+ emit_insn (gen_vsx_fnmadd<mode>4_3 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+})
+
+(define_insn "vsx_fnmadd<mode>4_1"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (neg:VSX_B
+ (plus:VSX_B
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0"))
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa"))))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode) && TARGET_FUSED_MADD
+ && HONOR_SIGNED_ZEROS (DFmode)"
+ "@
+ x<VSv>nmadda<VSs> %x0,%x1,%x2
+ x<VSv>nmaddm<VSs> %x0,%x1,%x3
+ x<VSv>nmadda<VSs> %x0,%x1,%x2
+ x<VSv>nmaddm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "vsx_fnmadd<mode>4_2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (minus:VSX_B
+ (mult:VSX_B
+ (neg:VSX_B
+ (match_operand:VSX_B 1 "gpc_reg_operand" "<VSr>,<VSr>,wa,wa"))
+ (match_operand:VSX_B 2 "gpc_reg_operand" "<VSr>,0,wa,0"))
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode) && TARGET_FUSED_MADD
+ && !HONOR_SIGNED_ZEROS (DFmode)"
+ "@
+ x<VSv>nmadda<VSs> %x0,%x1,%x2
+ x<VSv>nmaddm<VSs> %x0,%x1,%x3
+ x<VSv>nmadda<VSs> %x0,%x1,%x2
+ x<VSv>nmaddm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "vsx_fnmadd<mode>4_3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0")
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")]
+ UNSPEC_VSX_NMADD))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "@
+ x<VSv>nmadda<VSs> %x0,%x1,%x2
+ x<VSv>nmaddm<VSs> %x0,%x1,%x3
+ x<VSv>nmadda<VSs> %x0,%x1,%x2
+ x<VSv>nmaddm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_expand "vsx_fnmsub<mode>4"
+ [(match_operand:VSX_B 0 "vsx_register_operand" "")
+ (match_operand:VSX_B 1 "vsx_register_operand" "")
+ (match_operand:VSX_B 2 "vsx_register_operand" "")
+ (match_operand:VSX_B 3 "vsx_register_operand" "")]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+{
+ if (TARGET_FUSED_MADD && HONOR_SIGNED_ZEROS (DFmode))
+ {
+ emit_insn (gen_vsx_fnmsub<mode>4_1 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+ else if (TARGET_FUSED_MADD && !HONOR_SIGNED_ZEROS (DFmode))
+ {
+ emit_insn (gen_vsx_fnmsub<mode>4_2 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+ else
+ {
+ emit_insn (gen_vsx_fnmsub<mode>4_3 (operands[0], operands[1],
+ operands[2], operands[3]));
+ DONE;
+ }
+})
+
+(define_insn "vsx_fnmsub<mode>4_1"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (neg:VSX_B
+ (minus:VSX_B
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0"))
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa"))))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode) && TARGET_FUSED_MADD
+ && HONOR_SIGNED_ZEROS (DFmode)"
+ "@
+ x<VSv>nmsuba<VSs> %x0,%x1,%x2
+ x<VSv>nmsubm<VSs> %x0,%x1,%x3
+ x<VSv>nmsuba<VSs> %x0,%x1,%x2
+ x<VSv>nmsubm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "vsx_fnmsub<mode>4_2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (minus:VSX_B
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")
+ (mult:VSX_B
+ (match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0"))))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode) && TARGET_FUSED_MADD
+ && !HONOR_SIGNED_ZEROS (DFmode)"
+ "@
+ x<VSv>nmsuba<VSs> %x0,%x1,%x2
+ x<VSv>nmsubm<VSs> %x0,%x1,%x3
+ x<VSv>nmsuba<VSs> %x0,%x1,%x2
+ x<VSv>nmsubm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+(define_insn "vsx_fnmsub<mode>4_3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,<VSr>,?wa,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "%<VSr>,<VSr>,wa,wa")
+ (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,0,wa,0")
+ (match_operand:VSX_B 3 "vsx_register_operand" "0,<VSr>,0,wa")]
+ UNSPEC_VSX_NMSUB))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "@
+ x<VSv>nmsuba<VSs> %x0,%x1,%x2
+ x<VSv>nmsubm<VSs> %x0,%x1,%x3
+ x<VSv>nmsuba<VSs> %x0,%x1,%x2
+ x<VSv>nmsubm<VSs> %x0,%x1,%x3"
+ [(set_attr "type" "<VStype_mul>")
+ (set_attr "fp_type" "<VSfptype_mul>")])
+
+;; Vector conditional expressions (no scalar version for these instructions)
+(define_insn "vsx_eq<mode>"
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
+ (eq:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "xvcmpeq<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_gt<mode>"
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
+ (gt:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "xvcmpgt<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_ge<mode>"
+ [(set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
+ (ge:VSX_F (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "xvcmpge<VSs> %x0,%x1,%x2"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+;; Floating point scalar compare
+(define_insn "*vsx_cmpdf_internal1"
+ [(set (match_operand:CCFP 0 "cc_reg_operand" "=y,?y")
+ (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "ws,wa")
+ (match_operand:DF 2 "gpc_reg_operand" "ws,wa")))]
+ "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ && VECTOR_UNIT_VSX_P (DFmode)"
+ "xscmpudp %0,%x1,%x2"
+ [(set_attr "type" "fpcompare")])
+
+;; Compare vectors producing a vector result and a predicate, setting CR6 to
+;; indicate a combined status
+(define_insn "*vsx_eq_<mode>_p"
+ [(set (reg:CC 74)
+ (unspec:CC
+ [(eq:CC (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,?wa"))]
+ UNSPEC_PREDICATE))
+ (set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
+ (eq:VSX_F (match_dup 1)
+ (match_dup 2)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "xvcmpeq<VSs>. %x0,%x1,%x2"
+ [(set_attr "type" "veccmp")])
+
+(define_insn "*vsx_gt_<mode>_p"
+ [(set (reg:CC 74)
+ (unspec:CC
+ [(gt:CC (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,?wa"))]
+ UNSPEC_PREDICATE))
+ (set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
+ (gt:VSX_F (match_dup 1)
+ (match_dup 2)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "xvcmpgt<VSs>. %x0,%x1,%x2"
+ [(set_attr "type" "veccmp")])
+
+(define_insn "*vsx_ge_<mode>_p"
+ [(set (reg:CC 74)
+ (unspec:CC
+ [(ge:CC (match_operand:VSX_F 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_F 2 "vsx_register_operand" "<VSr>,?wa"))]
+ UNSPEC_PREDICATE))
+ (set (match_operand:VSX_F 0 "vsx_register_operand" "=<VSr>,?wa")
+ (ge:VSX_F (match_dup 1)
+ (match_dup 2)))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "xvcmpge<VSs>. %x0,%x1,%x2"
+ [(set_attr "type" "veccmp")])
+
+;; Vector select
+(define_insn "*vsx_xxsel<mode>"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (if_then_else:VSX_L
+ (ne:CC (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,wa")
+ (const_int 0))
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_L 3 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxsel %x0,%x3,%x2,%x1"
+ [(set_attr "type" "vecperm")])
+
+(define_insn "*vsx_xxsel<mode>_uns"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (if_then_else:VSX_L
+ (ne:CCUNS (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,wa")
+ (const_int 0))
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_L 3 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxsel %x0,%x3,%x2,%x1"
+ [(set_attr "type" "vecperm")])
+
+;; Copy sign
+(define_insn "vsx_copysign<mode>3"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (if_then_else:VSX_B
+ (ge:VSX_B (match_operand:VSX_B 2 "vsx_register_operand" "<VSr>,wa")
+ (match_operand:VSX_B 3 "zero_constant" "j,j"))
+ (abs:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa"))
+ (neg:VSX_B (abs:VSX_B (match_dup 1)))))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>cpsgn<VSs> %x0,%x2,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+;; For the conversions, limit the register class for the integer value to be
+;; the fprs because we don't want to add the altivec registers to movdi/movsi.
+;; For the unsigned tests, there isn't a generic double -> unsigned conversion
+;; in rs6000.md so don't test VECTOR_UNIT_VSX_P, just test against VSX.
+(define_insn "vsx_float<VSi><mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (float:VSX_B (match_operand:<VSI> 1 "vsx_register_operand" "<VSr2>,<VSr3>")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>cvsx<VSc><VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_floatuns<VSi><mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unsigned_float:VSX_B (match_operand:<VSI> 1 "vsx_register_operand" "<VSr2>,<VSr3>")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>cvux<VSc><VSs> %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_fix_trunc<mode><VSi>2"
+ [(set (match_operand:<VSI> 0 "vsx_register_operand" "=<VSr2>,?<VSr3>")
+ (fix:<VSI> (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>cv<VSs>sx<VSc>s %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_fixuns_trunc<mode><VSi>2"
+ [(set (match_operand:<VSI> 0 "vsx_register_operand" "=<VSr2>,?<VSr3>")
+ (unsigned_fix:<VSI> (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>cv<VSs>ux<VSc>s %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+;; Math rounding functions
+(define_insn "vsx_x<VSv>r<VSs>i"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_VSX_ROUND_I))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>r<VSs>i %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_x<VSv>r<VSs>ic"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_VSX_ROUND_IC))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>r<VSs>ic %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_btrunc<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (fix:VSX_B (match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>r<VSs>iz %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "*vsx_b2trunc<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_FRIZ))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>r<VSs>iz %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_floor<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_FRIM))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>r<VSs>im %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+(define_insn "vsx_ceil<mode>2"
+ [(set (match_operand:VSX_B 0 "vsx_register_operand" "=<VSr>,?wa")
+ (unspec:VSX_B [(match_operand:VSX_B 1 "vsx_register_operand" "<VSr>,wa")]
+ UNSPEC_FRIP))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "x<VSv>r<VSs>ip %x0,%x1"
+ [(set_attr "type" "<VStype_simple>")
+ (set_attr "fp_type" "<VSfptype_simple>")])
+
+
+;; VSX convert to/from double vector
+
+;; Convert between single and double precision
+;; Don't use xscvspdp and xscvdpsp for scalar conversions, since the normal
+;; scalar single precision instructions internally use the double format.
+;; Prefer the altivec registers, since we likely will need to do a vperm
+(define_insn "vsx_<VS_spdp_insn>"
+ [(set (match_operand:<VS_spdp_res> 0 "vsx_register_operand" "=<VSr4>,?wa")
+ (unspec:<VS_spdp_res> [(match_operand:VSX_SPDP 1 "vsx_register_operand" "<VSr5>,wa")]
+ UNSPEC_VSX_CVSPDP))]
+ "VECTOR_UNIT_VSX_P (<MODE>mode)"
+ "<VS_spdp_insn> %x0,%x1"
+ [(set_attr "type" "<VS_spdp_type>")])
+
+;; xscvspdp, represent the scalar SF type as V4SF
+(define_insn "vsx_xscvspdp"
+ [(set (match_operand:DF 0 "vsx_register_operand" "=ws,?wa")
+ (unspec:DF [(match_operand:V4SF 1 "vsx_register_operand" "wa,wa")]
+ UNSPEC_VSX_CVSPDP))]
+ "VECTOR_UNIT_VSX_P (DFmode)"
+ "xscvspdp %x0,%x1"
+ [(set_attr "type" "fp")])
+
+;; xscvdpsp used for splat'ing a scalar to V4SF, knowing that the internal SF
+;; format of scalars is actually DF.
+(define_insn "vsx_xscvdpsp_scalar"
+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wa")
+ (unspec:V4SF [(match_operand:SF 1 "vsx_register_operand" "f")]
+ UNSPEC_VSX_CVSPDP))]
+ "VECTOR_UNIT_VSX_P (DFmode)"
+ "xscvdpsp %x0,%x1"
+ [(set_attr "type" "fp")])
+
+;; Convert from 64-bit to 32-bit types
+;; Note, favor the Altivec registers since the usual use of these instructions
+;; is in vector converts and we need to use the Altivec vperm instruction.
+
+(define_insn "vsx_xvcvdpsxws"
+ [(set (match_operand:V4SI 0 "vsx_register_operand" "=v,?wa")
+ (unspec:V4SI [(match_operand:V2DF 1 "vsx_register_operand" "wd,wa")]
+ UNSPEC_VSX_CVDPSXWS))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvdpsxws %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "vsx_xvcvdpuxws"
+ [(set (match_operand:V4SI 0 "vsx_register_operand" "=v,?wa")
+ (unspec:V4SI [(match_operand:V2DF 1 "vsx_register_operand" "wd,wa")]
+ UNSPEC_VSX_CVDPUXWS))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvdpuxws %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "vsx_xvcvsxdsp"
+ [(set (match_operand:V4SI 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V4SI [(match_operand:V2DF 1 "vsx_register_operand" "wf,wa")]
+ UNSPEC_VSX_CVSXDSP))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvsxdsp %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "vsx_xvcvuxdsp"
+ [(set (match_operand:V4SI 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V4SI [(match_operand:V2DF 1 "vsx_register_operand" "wf,wa")]
+ UNSPEC_VSX_CVUXDSP))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvuxwdp %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+;; Convert from 32-bit to 64-bit types
+(define_insn "vsx_xvcvsxwdp"
+ [(set (match_operand:V2DF 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V2DF [(match_operand:V4SI 1 "vsx_register_operand" "wf,wa")]
+ UNSPEC_VSX_CVSXWDP))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvsxwdp %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "vsx_xvcvuxwdp"
+ [(set (match_operand:V2DF 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V2DF [(match_operand:V4SI 1 "vsx_register_operand" "wf,wa")]
+ UNSPEC_VSX_CVUXWDP))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvuxwdp %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "vsx_xvcvspsxds"
+ [(set (match_operand:V2DI 0 "vsx_register_operand" "=v,?wa")
+ (unspec:V2DI [(match_operand:V4SF 1 "vsx_register_operand" "wd,wa")]
+ UNSPEC_VSX_CVSPSXDS))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvspsxds %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+(define_insn "vsx_xvcvspuxds"
+ [(set (match_operand:V2DI 0 "vsx_register_operand" "=v,?wa")
+ (unspec:V2DI [(match_operand:V4SF 1 "vsx_register_operand" "wd,wa")]
+ UNSPEC_VSX_CVSPUXDS))]
+ "VECTOR_UNIT_VSX_P (V2DFmode)"
+ "xvcvspuxds %x0,%x1"
+ [(set_attr "type" "vecfloat")])
+
+;; Logical and permute operations
+(define_insn "*vsx_and<mode>3"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (and:VSX_L
+ (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxland %x0,%x1,%x2"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "*vsx_ior<mode>3"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (ior:VSX_L (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxlor %x0,%x1,%x2"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "*vsx_xor<mode>3"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (xor:VSX_L
+ (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxlxor %x0,%x1,%x2"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "*vsx_one_cmpl<mode>2"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (not:VSX_L
+ (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxlnor %x0,%x1,%x1"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "*vsx_nor<mode>3"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (not:VSX_L
+ (ior:VSX_L
+ (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxlnor %x0,%x1,%x2"
+ [(set_attr "type" "vecsimple")])
+
+(define_insn "*vsx_andc<mode>3"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=<VSr>,?wa")
+ (and:VSX_L
+ (not:VSX_L
+ (match_operand:VSX_L 2 "vsx_register_operand" "<VSr>,?wa"))
+ (match_operand:VSX_L 1 "vsx_register_operand" "<VSr>,?wa")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxlandc %x0,%x1,%x2"
+ [(set_attr "type" "vecsimple")])
+
+
+;; Permute operations
+
+;; Build a V2DF/V2DI vector from two scalars
+(define_insn "vsx_concat_<mode>"
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:VSX_D
+ [(match_operand:<VS_scalar> 1 "vsx_register_operand" "ws,wa")
+ (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")]
+ UNSPEC_VSX_CONCAT))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxpermdi %x0,%x1,%x2,0"
+ [(set_attr "type" "vecperm")])
+
+;; Special purpose concat using xxpermdi to glue two single precision values
+;; together, relying on the fact that internally scalar floats are represented
+;; as doubles. This is used to initialize a V4SF vector with 4 floats
+(define_insn "vsx_concat_v2sf"
+ [(set (match_operand:V2DF 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V2DF
+ [(match_operand:SF 1 "vsx_register_operand" "f,f")
+ (match_operand:SF 2 "vsx_register_operand" "f,f")]
+ UNSPEC_VSX_CONCAT))]
+ "VECTOR_MEM_VSX_P (V2DFmode)"
+ "xxpermdi %x0,%x1,%x2,0"
+ [(set_attr "type" "vecperm")])
+
+;; Set the element of a V2DI/VD2F mode
+(define_insn "vsx_set_<mode>"
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:VSX_D [(match_operand:VSX_D 1 "vsx_register_operand" "wd,wa")
+ (match_operand:<VS_scalar> 2 "vsx_register_operand" "ws,wa")
+ (match_operand:QI 3 "u5bit_cint_operand" "i,i")]
+ UNSPEC_VSX_SET))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+{
+ if (INTVAL (operands[3]) == 0)
+ return \"xxpermdi %x0,%x1,%x2,1\";
+ else if (INTVAL (operands[3]) == 1)
+ return \"xxpermdi %x0,%x2,%x1,0\";
+ else
+ gcc_unreachable ();
+}
+ [(set_attr "type" "vecperm")])
+
+;; Extract a DF/DI element from V2DF/V2DI
+(define_insn "vsx_extract_<mode>"
+ [(set (match_operand:<VS_scalar> 0 "vsx_register_operand" "=ws,d,?wa")
+ (vec_select:<VS_scalar> (match_operand:VSX_D 1 "vsx_register_operand" "wd,wd,wa")
+ (parallel
+ [(match_operand:QI 2 "u5bit_cint_operand" "i,i,i")])))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+{
+ gcc_assert (UINTVAL (operands[2]) <= 1);
+ operands[3] = GEN_INT (INTVAL (operands[2]) << 1);
+ return \"xxpermdi %x0,%x1,%x1,%3\";
+}
+ [(set_attr "type" "vecperm")])
+
+;; Optimize extracting element 0 from memory
+(define_insn "*vsx_extract_<mode>_zero"
+ [(set (match_operand:<VS_scalar> 0 "vsx_register_operand" "=ws,d,?wa")
+ (vec_select:<VS_scalar>
+ (match_operand:VSX_D 1 "indexed_or_indirect_operand" "Z,Z,Z")
+ (parallel [(const_int 0)])))]
+ "VECTOR_MEM_VSX_P (<MODE>mode) && WORDS_BIG_ENDIAN"
+ "lxsd%U1x %x0,%y1"
+ [(set_attr "type" "fpload")
+ (set_attr "length" "4")])
+
+;; General double word oriented permute, allow the other vector types for
+;; optimizing the permute instruction.
+(define_insn "vsx_xxpermdi_<mode>"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:VSX_L [(match_operand:VSX_L 1 "vsx_register_operand" "wd,wa")
+ (match_operand:VSX_L 2 "vsx_register_operand" "wd,wa")
+ (match_operand:QI 3 "u5bit_cint_operand" "i,i")]
+ UNSPEC_VSX_XXPERMDI))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxpermdi %x0,%x1,%x2,%3"
+ [(set_attr "type" "vecperm")])
+
+;; Varient of xxpermdi that is emitted by the vec_interleave functions
+(define_insn "*vsx_xxpermdi2_<mode>"
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd")
+ (vec_concat:VSX_D
+ (vec_select:<VS_scalar>
+ (match_operand:VSX_D 1 "vsx_register_operand" "wd")
+ (parallel
+ [(match_operand:QI 2 "u5bit_cint_operand" "i")]))
+ (vec_select:<VS_scalar>
+ (match_operand:VSX_D 3 "vsx_register_operand" "wd")
+ (parallel
+ [(match_operand:QI 4 "u5bit_cint_operand" "i")]))))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+{
+ gcc_assert ((UINTVAL (operands[2]) <= 1) && (UINTVAL (operands[4]) <= 1));
+ operands[5] = GEN_INT (((INTVAL (operands[2]) & 1) << 1)
+ | (INTVAL (operands[4]) & 1));
+ return \"xxpermdi %x0,%x1,%x3,%5\";
+}
+ [(set_attr "type" "vecperm")])
+
+;; V2DF/V2DI splat
+(define_insn "vsx_splat_<mode>"
+ [(set (match_operand:VSX_D 0 "vsx_register_operand" "=wd,wd,wd,?wa,?wa,?wa")
+ (vec_duplicate:VSX_D
+ (match_operand:<VS_scalar> 1 "input_operand" "ws,f,Z,wa,wa,Z")))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "@
+ xxpermdi %x0,%x1,%x1,0
+ xxpermdi %x0,%x1,%x1,0
+ lxvdsx %x0,%y1
+ xxpermdi %x0,%x1,%x1,0
+ xxpermdi %x0,%x1,%x1,0
+ lxvdsx %x0,%y1"
+ [(set_attr "type" "vecperm,vecperm,vecload,vecperm,vecperm,vecload")])
+
+;; V4SF/V4SI splat
+(define_insn "vsx_xxspltw_<mode>"
+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa")
+ (vec_duplicate:VSX_W
+ (vec_select:<VS_scalar>
+ (match_operand:VSX_W 1 "vsx_register_operand" "wf,wa")
+ (parallel
+ [(match_operand:QI 2 "u5bit_cint_operand" "i,i")]))))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxspltw %x0,%x1,%2"
+ [(set_attr "type" "vecperm")])
+
+;; V4SF/V4SI interleave
+(define_insn "vsx_xxmrghw_<mode>"
+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa")
+ (vec_merge:VSX_W
+ (vec_select:VSX_W
+ (match_operand:VSX_W 1 "vsx_register_operand" "wf,wa")
+ (parallel [(const_int 0)
+ (const_int 2)
+ (const_int 1)
+ (const_int 3)]))
+ (vec_select:VSX_W
+ (match_operand:VSX_W 2 "vsx_register_operand" "wf,wa")
+ (parallel [(const_int 2)
+ (const_int 0)
+ (const_int 3)
+ (const_int 1)]))
+ (const_int 5)))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxmrghw %x0,%x1,%x2"
+ [(set_attr "type" "vecperm")])
+
+(define_insn "vsx_xxmrglw_<mode>"
+ [(set (match_operand:VSX_W 0 "vsx_register_operand" "=wf,?wa")
+ (vec_merge:VSX_W
+ (vec_select:VSX_W
+ (match_operand:VSX_W 1 "vsx_register_operand" "wf,wa")
+ (parallel [(const_int 2)
+ (const_int 0)
+ (const_int 3)
+ (const_int 1)]))
+ (vec_select:VSX_W
+ (match_operand:VSX_W 2 "vsx_register_operand" "wf,?wa")
+ (parallel [(const_int 0)
+ (const_int 2)
+ (const_int 1)
+ (const_int 3)]))
+ (const_int 5)))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxmrglw %x0,%x1,%x2"
+ [(set_attr "type" "vecperm")])
+
+;; Shift left double by word immediate
+(define_insn "vsx_xxsldwi_<mode>"
+ [(set (match_operand:VSX_L 0 "vsx_register_operand" "=wa")
+ (unspec:VSX_L [(match_operand:VSX_L 1 "vsx_register_operand" "wa")
+ (match_operand:VSX_L 2 "vsx_register_operand" "wa")
+ (match_operand:QI 3 "u5bit_cint_operand" "i")]
+ UNSPEC_VSX_SLDWI))]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+ "xxsldwi %x0,%x1,%x2,%3"
+ [(set_attr "type" "vecperm")])
diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h
index 2329138cf1f..8b9ad5aedb5 100644
--- a/gcc/config/s390/s390-protos.h
+++ b/gcc/config/s390/s390-protos.h
@@ -125,6 +125,6 @@ extern void s390_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode,
tree, int);
#ifdef RTX_CODE
extern rtx s390_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int);
-extern rtx s390_function_value (const_tree, enum machine_mode);
+extern rtx s390_function_value (const_tree, const_tree, enum machine_mode);
#endif /* RTX_CODE */
#endif /* TREE_CODE */
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index f5b2fa73d1f..25203ab52b6 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -8343,17 +8343,36 @@ s390_return_in_memory (const_tree type, const_tree fundecl ATTRIBUTE_UNUSED)
return true;
}
+/* Function arguments and return values are promoted to word size. */
+
+static enum machine_mode
+s390_promote_function_mode (const_tree type, enum machine_mode mode,
+ int *punsignedp,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ if (INTEGRAL_MODE_P (mode)
+ && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
+ {
+ if (POINTER_TYPE_P (type))
+ *punsignedp = POINTERS_EXTEND_UNSIGNED;
+ return Pmode;
+ }
+
+ return mode;
+}
+
/* Define where to return a (scalar) value of type TYPE.
If TYPE is null, define where to return a (scalar)
value of mode MODE from a libcall. */
rtx
-s390_function_value (const_tree type, enum machine_mode mode)
+s390_function_value (const_tree type, const_tree fn, enum machine_mode mode)
{
if (type)
{
int unsignedp = TYPE_UNSIGNED (type);
- mode = promote_mode (type, TYPE_MODE (type), &unsignedp, 1);
+ mode = promote_function_mode (type, TYPE_MODE (type), &unsignedp, fn, 1);
}
gcc_assert (GET_MODE_CLASS (mode) == MODE_INT || SCALAR_FLOAT_MODE_P (mode));
@@ -9998,10 +10017,8 @@ s390_reorg (void)
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR s390_gimplify_va_arg
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE s390_promote_function_mode
#undef TARGET_PASS_BY_REFERENCE
#define TARGET_PASS_BY_REFERENCE s390_pass_by_reference
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index f34b7f22567..4772367eee5 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -216,13 +216,6 @@ extern int s390_arch_flags;
#endif
#define MAX_BITS_PER_WORD 64
-/* Function arguments and return values are promoted to word size. */
-#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
-if (INTEGRAL_MODE_P (MODE) && \
- GET_MODE_SIZE (MODE) < UNITS_PER_WORD) { \
- (MODE) = Pmode; \
- }
-
/* Allocation boundary (in *bits*) for storing arguments in argument list. */
#define PARM_BOUNDARY (TARGET_64BIT ? 64 : 32)
@@ -697,10 +690,10 @@ CUMULATIVE_ARGS;
/* Scalar return values. */
#define FUNCTION_VALUE(VALTYPE, FUNC) \
- s390_function_value ((VALTYPE), VOIDmode)
+ s390_function_value ((VALTYPE), (FUNC), VOIDmode)
#define LIBCALL_VALUE(MODE) \
- s390_function_value (NULL, (MODE))
+ s390_function_value (NULL, NULL, (MODE))
/* Only gpr 2 and fpr 0 are ever used as return registers. */
#define FUNCTION_VALUE_REGNO_P(N) ((N) == 2 || (N) == 16)
diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c
index b75f3cfaebf..0241383fc86 100644
--- a/gcc/config/score/score.c
+++ b/gcc/config/score/score.c
@@ -89,11 +89,8 @@
#undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK score_output_mi_thunk
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_true
-
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_true
diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c
index 4258d29e525..385620d33d6 100644
--- a/gcc/config/score/score3.c
+++ b/gcc/config/score/score3.c
@@ -859,15 +859,14 @@ score3_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
VALTYPE is the return type and MODE is VOIDmode. For libcalls,
VALTYPE is null and MODE is the mode of the return value. */
rtx
-score3_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
- enum machine_mode mode)
+score3_function_value (tree valtype, tree func, enum machine_mode mode)
{
if (valtype)
{
int unsignedp;
mode = TYPE_MODE (valtype);
unsignedp = TYPE_UNSIGNED (valtype);
- mode = promote_mode (valtype, mode, &unsignedp, 1);
+ mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
}
return gen_rtx_REG (mode, RT_REGNUM);
}
diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c
index 9ab6ebd3004..368ac03a3ba 100644
--- a/gcc/config/score/score7.c
+++ b/gcc/config/score/score7.c
@@ -850,15 +850,14 @@ score7_function_arg (const CUMULATIVE_ARGS *cum, enum machine_mode mode,
VALTYPE is the return type and MODE is VOIDmode. For libcalls,
VALTYPE is null and MODE is the mode of the return value. */
rtx
-score7_function_value (tree valtype, tree func ATTRIBUTE_UNUSED,
- enum machine_mode mode)
+score7_function_value (tree valtype, tree func, enum machine_mode mode)
{
if (valtype)
{
int unsignedp;
mode = TYPE_MODE (valtype);
unsignedp = TYPE_UNSIGNED (valtype);
- mode = promote_mode (valtype, mode, &unsignedp, 1);
+ mode = promote_function_mode (valtype, mode, &unsignedp, func, 1);
}
return gen_rtx_REG (mode, RT_REGNUM);
}
diff --git a/gcc/config/sh/linux-atomic.asm b/gcc/config/sh/linux-atomic.asm
index fd3a7720e99..743c61bb76c 100644
--- a/gcc/config/sh/linux-atomic.asm
+++ b/gcc/config/sh/linux-atomic.asm
@@ -54,10 +54,10 @@ ATOMIC_TEST_AND_SET (2,w,extu.w)
ATOMIC_TEST_AND_SET (4,l,mov)
#define ATOMIC_COMPARE_AND_SWAP(N,T,EXTS,EXT) \
- .global __sync_compare_and_swap_##N; \
- HIDDEN_FUNC(__sync_compare_and_swap_##N); \
+ .global __sync_val_compare_and_swap_##N; \
+ HIDDEN_FUNC(__sync_val_compare_and_swap_##N); \
.align 2; \
-__sync_compare_and_swap_##N:; \
+__sync_val_compare_and_swap_##N:; \
mova 1f, r0; \
EXTS r5, r5; \
mov r15, r1; \
@@ -69,12 +69,34 @@ __sync_compare_and_swap_##N:; \
1: mov r1, r15; \
rts; \
EXT r2, r0; \
- ENDFUNC(__sync_compare_and_swap_##N)
+ ENDFUNC(__sync_val_compare_and_swap_##N)
ATOMIC_COMPARE_AND_SWAP (1,b,exts.b,extu.b)
ATOMIC_COMPARE_AND_SWAP (2,w,exts.w,extu.w)
ATOMIC_COMPARE_AND_SWAP (4,l,mov,mov)
+#define ATOMIC_BOOL_COMPARE_AND_SWAP(N,T,EXTS) \
+ .global __sync_bool_compare_and_swap_##N; \
+ HIDDEN_FUNC(__sync_bool_compare_and_swap_##N); \
+ .align 2; \
+__sync_bool_compare_and_swap_##N:; \
+ mova 1f, r0; \
+ EXTS r5, r5; \
+ mov r15, r1; \
+ mov #(0f-1f), r15; \
+0: mov.##T @r4, r2; \
+ cmp/eq r2, r5; \
+ bf 1f; \
+ mov.##T r6, @r4; \
+1: mov r1, r15; \
+ rts; \
+ movt r0; \
+ ENDFUNC(__sync_bool_compare_and_swap_##N)
+
+ATOMIC_BOOL_COMPARE_AND_SWAP (1,b,exts.b)
+ATOMIC_BOOL_COMPARE_AND_SWAP (2,w,exts.w)
+ATOMIC_BOOL_COMPARE_AND_SWAP (4,l,mov)
+
#define ATOMIC_FETCH_AND_OP(OP,N,T,EXT) \
.global __sync_fetch_and_##OP##_##N; \
HIDDEN_FUNC(__sync_fetch_and_##OP##_##N); \
@@ -135,6 +157,66 @@ ATOMIC_FETCH_AND_COMBOP(nand,and,not,1,b,extu.b)
ATOMIC_FETCH_AND_COMBOP(nand,and,not,2,w,extu.w)
ATOMIC_FETCH_AND_COMBOP(nand,and,not,4,l,mov)
+#define ATOMIC_OP_AND_FETCH(OP,N,T,EXT) \
+ .global __sync_##OP##_and_fetch_##N; \
+ HIDDEN_FUNC(__sync_##OP##_and_fetch_##N); \
+ .align 2; \
+__sync_##OP##_and_fetch_##N:; \
+ mova 1f, r0; \
+ nop; \
+ mov r15, r1; \
+ mov #(0f-1f), r15; \
+0: mov.##T @r4, r2; \
+ mov r5, r3; \
+ OP r2, r3; \
+ mov.##T r3, @r4; \
+1: mov r1, r15; \
+ rts; \
+ EXT r3, r0; \
+ ENDFUNC(__sync_##OP##_and_fetch_##N)
+
+ATOMIC_OP_AND_FETCH(add,1,b,extu.b)
+ATOMIC_OP_AND_FETCH(add,2,w,extu.w)
+ATOMIC_OP_AND_FETCH(add,4,l,mov)
+
+ATOMIC_OP_AND_FETCH(or,1,b,extu.b)
+ATOMIC_OP_AND_FETCH(or,2,w,extu.w)
+ATOMIC_OP_AND_FETCH(or,4,l,mov)
+
+ATOMIC_OP_AND_FETCH(and,1,b,extu.b)
+ATOMIC_OP_AND_FETCH(and,2,w,extu.w)
+ATOMIC_OP_AND_FETCH(and,4,l,mov)
+
+ATOMIC_OP_AND_FETCH(xor,1,b,extu.b)
+ATOMIC_OP_AND_FETCH(xor,2,w,extu.w)
+ATOMIC_OP_AND_FETCH(xor,4,l,mov)
+
+#define ATOMIC_COMBOP_AND_FETCH(OP,OP0,OP1,N,T,EXT) \
+ .global __sync_##OP##_and_fetch_##N; \
+ HIDDEN_FUNC(__sync_##OP##_and_fetch_##N); \
+ .align 2; \
+__sync_##OP##_and_fetch_##N:; \
+ mova 1f, r0; \
+ mov r15, r1; \
+ mov #(0f-1f), r15; \
+0: mov.##T @r4, r2; \
+ mov r5, r3; \
+ OP0 r2, r3; \
+ OP1 r3, r3; \
+ mov.##T r3, @r4; \
+1: mov r1, r15; \
+ rts; \
+ EXT r3, r0; \
+ ENDFUNC(__sync_##OP##_and_fetch_##N)
+
+ATOMIC_COMBOP_AND_FETCH(sub,sub,neg,1,b,extu.b)
+ATOMIC_COMBOP_AND_FETCH(sub,sub,neg,2,w,extu.w)
+ATOMIC_COMBOP_AND_FETCH(sub,sub,neg,4,l,mov)
+
+ATOMIC_COMBOP_AND_FETCH(nand,and,not,1,b,extu.b)
+ATOMIC_COMBOP_AND_FETCH(nand,and,not,2,w,extu.w)
+ATOMIC_COMBOP_AND_FETCH(nand,and,not,4,l,mov)
+
.section .note.GNU-stack,"",%progbits
.previous
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 788b0fe1391..a4be11cb979 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -257,6 +257,11 @@ static bool sh_pretend_outgoing_varargs_named (CUMULATIVE_ARGS *);
static tree sh_build_builtin_va_list (void);
static void sh_va_start (tree, rtx);
static tree sh_gimplify_va_arg_expr (tree, tree, gimple_seq *, gimple_seq *);
+static enum machine_mode sh_promote_function_mode (const_tree type,
+ enum machine_mode,
+ int *punsignedp,
+ const_tree funtype,
+ int for_return);
static bool sh_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
const_tree, bool);
static bool sh_callee_copies (CUMULATIVE_ARGS *, enum machine_mode,
@@ -437,10 +442,8 @@ static const struct attribute_spec sh_attribute_table[] =
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES sh_promote_prototypes
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS sh_promote_prototypes
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN sh_promote_prototypes
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE sh_promote_function_mode
#undef TARGET_STRUCT_VALUE_RTX
#define TARGET_STRUCT_VALUE_RTX sh_struct_value_rtx
@@ -871,6 +874,29 @@ sh_override_options (void)
flag_schedule_insns = 0;
}
+ /* Unwinding with -freorder-blocks-and-partition does not work on this
+ architecture, because it requires far jumps to label crossing between
+ hot/cold sections which are rejected on this architecture. */
+ if (flag_reorder_blocks_and_partition)
+ {
+ if (flag_exceptions)
+ {
+ inform (input_location,
+ "-freorder-blocks-and-partition does not work with "
+ "exceptions on this architecture");
+ flag_reorder_blocks_and_partition = 0;
+ flag_reorder_blocks = 1;
+ }
+ else if (flag_unwind_tables)
+ {
+ inform (input_location,
+ "-freorder-blocks-and-partition does not support unwind "
+ "info on this architecture");
+ flag_reorder_blocks_and_partition = 0;
+ flag_reorder_blocks = 1;
+ }
+ }
+
if (align_loops == 0)
align_loops = 1 << (TARGET_SH5 ? 3 : 2);
if (align_jumps == 0)
@@ -6743,13 +6769,19 @@ sh_expand_prologue (void)
/* If we're supposed to switch stacks at function entry, do so now. */
if (sp_switch_attr)
{
+ rtx lab, newsrc;
/* The argument specifies a variable holding the address of the
stack the interrupt function should switch to/from at entry/exit. */
+ tree arg = TREE_VALUE ( TREE_VALUE (sp_switch_attr));
const char *s
- = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (sp_switch_attr)));
+ = ggc_strdup (TREE_STRING_POINTER (arg));
rtx sp_switch = gen_rtx_SYMBOL_REF (Pmode, s);
- emit_insn (gen_sp_switch_1 (sp_switch));
+ lab = add_constant (sp_switch, SImode, 0);
+ newsrc = gen_rtx_LABEL_REF (VOIDmode, lab);
+ newsrc = gen_const_mem (SImode, newsrc);
+
+ emit_insn (gen_sp_switch_1 (newsrc));
}
d = calc_live_regs (&live_regs_mask);
@@ -7890,6 +7922,17 @@ sh_dwarf_register_span (rtx reg)
DBX_REGISTER_NUMBER (regno))));
}
+static enum machine_mode
+sh_promote_function_mode (const_tree type, enum machine_mode mode,
+ int *punsignedp, const_tree funtype,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ if (sh_promote_prototypes (funtype))
+ return promote_mode (type, mode, punsignedp);
+ else
+ return mode;
+}
+
bool
sh_promote_prototypes (const_tree type)
{
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 30084c2d0f8..f06098bfc1b 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -6065,7 +6065,7 @@ label:
/* If we have modified the stack pointer, the value that we have
read with post-increment might be modified by an interrupt,
so write it back. */
- if (REGNO (addr) == STACK_POINTER_REGNUM)
+ if (REGNO (XEXP (addr, 0)) == STACK_POINTER_REGNUM)
emit_insn (gen_push_e (reg0));
else
emit_insn (gen_addsi3 (XEXP (operands[1], 0), XEXP (operands[1], 0), GEN_INT (-4)));
diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h
index 173b66de734..a65276c0599 100644
--- a/gcc/config/sol2.h
+++ b/gcc/config/sol2.h
@@ -72,8 +72,6 @@ along with GCC; see the file COPYING3. If not see
#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
-#define TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME 1
-
/* ??? Note: in order for -compat-bsd to work fully,
we must somehow arrange to fixincludes /usr/ucbinclude
and put the result in $(libsubdir)/ucbinclude. */
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index baba1d98057..033980bd441 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -404,6 +404,8 @@ static int get_some_local_dynamic_name_1 (rtx *, void *);
static bool sparc_rtx_costs (rtx, int, int, int *, bool);
static bool sparc_promote_prototypes (const_tree);
static rtx sparc_struct_value_rtx (tree, int);
+static enum machine_mode sparc_promote_function_mode (const_tree, enum machine_mode,
+ int *, const_tree, int);
static bool sparc_return_in_memory (const_tree, const_tree);
static bool sparc_strict_argument_naming (CUMULATIVE_ARGS *);
static void sparc_va_start (tree, rtx);
@@ -524,17 +526,8 @@ static bool fpu_option_set = false;
#undef TARGET_ADDRESS_COST
#define TARGET_ADDRESS_COST hook_int_rtx_bool_0
-/* This is only needed for TARGET_ARCH64, but since PROMOTE_FUNCTION_MODE is a
- no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime
- test for this value. */
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-
-/* This is only needed for TARGET_ARCH64, but since PROMOTE_FUNCTION_MODE is a
- no-op for TARGET_ARCH32 this is ok. Otherwise we'd need to add a runtime
- test for this value. */
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE sparc_promote_function_mode
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES sparc_promote_prototypes
@@ -4642,6 +4635,36 @@ sparc_promote_prototypes (const_tree fntype ATTRIBUTE_UNUSED)
return TARGET_ARCH32 ? true : false;
}
+/* Handle promotion of pointer and integer arguments. */
+
+static enum machine_mode
+sparc_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree fntype ATTRIBUTE_UNUSED,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ if (POINTER_TYPE_P (type))
+ {
+ *punsignedp = POINTERS_EXTEND_UNSIGNED;
+ return Pmode;
+ }
+
+ /* For TARGET_ARCH64 we need this, as we don't have instructions
+ for arithmetic operations which do zero/sign extension at the same time,
+ so without this we end up with a srl/sra after every assignment to an
+ user variable, which means very very bad code. */
+
+ if (TARGET_ARCH64
+ && GET_MODE_CLASS (mode) == MODE_INT
+ && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
+ return word_mode;
+
+ return mode;
+}
+
+
+
/* Handle the TARGET_STRICT_ARGUMENT_NAMING target hook. */
static bool
@@ -5784,7 +5807,8 @@ function_value (const_tree type, enum machine_mode mode, int incoming_p)
mclass = MODE_INT;
}
- /* This must match PROMOTE_FUNCTION_MODE. */
+ /* This must match sparc_promote_function_mode.
+ ??? Maybe 32-bit pointers should actually remain in Pmode? */
else if (mclass == MODE_INT && GET_MODE_SIZE (mode) < UNITS_PER_WORD)
mode = word_mode;
}
@@ -6231,7 +6255,7 @@ rtx
sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
{
const char *qpfunc;
- rtx slot0, slot1, result, tem, tem2;
+ rtx slot0, slot1, result, tem, tem2, libfunc;
enum machine_mode mode;
enum rtx_code new_comparison;
@@ -6294,7 +6318,8 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
emit_move_insn (slot1, y);
}
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), LCT_NORMAL,
+ libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
+ emit_library_call (libfunc, LCT_NORMAL,
DImode, 2,
XEXP (slot0, 0), Pmode,
XEXP (slot1, 0), Pmode);
@@ -6302,7 +6327,8 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
}
else
{
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, qpfunc), LCT_NORMAL,
+ libfunc = gen_rtx_SYMBOL_REF (Pmode, qpfunc);
+ emit_library_call (libfunc, LCT_NORMAL,
SImode, 2,
x, TFmode, y, TFmode);
mode = SImode;
@@ -6313,7 +6339,7 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code comparison)
register so reload doesn't clobber the value if it needs
the return register for a spill reg. */
result = gen_reg_rtx (mode);
- emit_move_insn (result, hard_libcall_value (mode));
+ emit_move_insn (result, hard_libcall_value (mode, libfunc));
switch (comparison)
{
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index 31c74095f75..3b713611f84 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -636,16 +636,6 @@ extern struct sparc_cpu_select sparc_select[];
if ptr_mode and Pmode are the same. */
#define POINTERS_EXTEND_UNSIGNED 1
-/* For TARGET_ARCH64 we need this, as we don't have instructions
- for arithmetic operations which do zero/sign extension at the same time,
- so without this we end up with a srl/sra after every assignment to an
- user variable, which means very very bad code. */
-#define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \
-if (TARGET_ARCH64 \
- && GET_MODE_CLASS (MODE) == MODE_INT \
- && GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
- (MODE) = word_mode;
-
/* Allocation boundary (in *bits*) for storing arguments in argument list. */
#define PARM_BOUNDARY (TARGET_ARCH64 ? 64 : 32)
diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c
index 2e646f98d4c..06b96c7b8ce 100644
--- a/gcc/config/stormy16/stormy16.c
+++ b/gcc/config/stormy16/stormy16.c
@@ -2640,10 +2640,8 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
#undef TARGET_GIMPLIFY_VA_ARG_EXPR
#define TARGET_GIMPLIFY_VA_ARG_EXPR xstormy16_gimplify_va_arg_expr
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 38f300aeef7..77ba2d9d017 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -185,10 +185,8 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
#undef TARGET_EXPAND_BUILTIN_VA_START
#define TARGET_EXPAND_BUILTIN_VA_START xtensa_va_start
-#undef TARGET_PROMOTE_FUNCTION_ARGS
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_true
-#undef TARGET_PROMOTE_FUNCTION_RETURN
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_true
+#undef TARGET_PROMOTE_FUNCTION_MODE
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode_always_promote
#undef TARGET_PROMOTE_PROTOTYPES
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index a9987c7609f..84d320bc95b 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -582,7 +582,7 @@ extern const enum reg_class xtensa_regno_to_class[FIRST_PSEUDO_REGISTER];
/* Define how to find the value returned by a library function
assuming the value has mode MODE. Because we have defined
- TARGET_PROMOTE_FUNCTION_RETURN that returns true, we have to
+ TARGET_PROMOTE_FUNCTION_MODE to promote everything, we have to
perform the same promotions as PROMOTE_MODE. */
#define XTENSA_LIBCALL_VALUE(MODE, OUTGOINGP) \
gen_rtx_REG ((GET_MODE_CLASS (MODE) == MODE_INT \
diff --git a/gcc/configure b/gcc/configure
index 52c5cc7ae1e..61789a84d22 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -1091,6 +1091,8 @@ Optional Features:
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on
+ glibc systems
--enable-linker-build-id
compiler will always pass --build-id to linker
--enable-maintainer-mode
@@ -14903,13 +14905,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:14906: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:14908: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:14909: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:14911: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:14912: output\"" >&5)
+ (eval echo "\"\$as_me:14914: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -16066,7 +16068,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 16069 "configure"' > conftest.$ac_ext
+ echo '#line 16071 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -17959,11 +17961,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:17962: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:17964: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:17966: \$? = $ac_status" >&5
+ echo "$as_me:17968: \$? = $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.
@@ -18298,11 +18300,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:18301: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18303: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18305: \$? = $ac_status" >&5
+ echo "$as_me:18307: \$? = $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.
@@ -18403,11 +18405,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:18406: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18408: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18410: \$? = $ac_status" >&5
+ echo "$as_me:18412: \$? = $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
@@ -18458,11 +18460,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:18461: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18463: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18465: \$? = $ac_status" >&5
+ echo "$as_me:18467: \$? = $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
@@ -21270,7 +21272,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 21273 "configure"
+#line 21275 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21366,7 +21368,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 21369 "configure"
+#line 21371 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -23382,11 +23384,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:23385: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23387: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23389: \$? = $ac_status" >&5
+ echo "$as_me:23391: \$? = $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.
@@ -23481,11 +23483,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:23484: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23486: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:23488: \$? = $ac_status" >&5
+ echo "$as_me:23490: \$? = $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
@@ -23533,11 +23535,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:23536: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23538: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:23540: \$? = $ac_status" >&5
+ echo "$as_me:23542: \$? = $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
@@ -28096,6 +28098,69 @@ _ACEOF
fi
+# Check whether --enable-gnu-unique-object or --disable-gnu-unique-object was given.
+if test "${enable_gnu_unique_object+set}" = set; then
+ enableval="$enable_gnu_unique_object"
+ case $enable_gnu_unique_object in
+ yes | no) ;;
+ *) { { echo "$as_me:$LINENO: error: '$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
+Valid choices are 'yes' and 'no'." >&5
+echo "$as_me: error: '$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
+Valid choices are 'yes' and 'no'." >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+else
+ echo "$as_me:$LINENO: checking assembler for gnu_unique_object" >&5
+echo $ECHO_N "checking assembler for gnu_unique_object... $ECHO_C" >&6
+if test "${gcc_cv_as_gnu_unique_object+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ gcc_cv_as_gnu_unique_object=no
+ if test $in_tree_gas = yes; then
+ if test $in_tree_gas_is_elf = yes \
+ && test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 19 \) \* 1000 + 52`
+ then gcc_cv_as_gnu_unique_object=yes
+fi
+ elif test x$gcc_cv_as != x; then
+ echo '.type foo, @gnu_unique_object' > conftest.s
+ if { ac_try='$gcc_cv_as -o conftest.o conftest.s >&5'
+ { (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
+ # Also check for ld.so support, i.e. glibc 2.11 or higher.
+ if test x$host = x$build -a x$host = x$target &&
+ glibcver=`ldd --version 2>/dev/null`; then
+ glibcmajor=`expr "$glibcver" : "ldd (GNU libc) \([0-9]*\)"`
+ glibcminor=`expr "$glibcver" : "ldd (GNU libc) [0-9]*\.\([0-9]*\)"`
+ glibcnum=`expr $glibcmajor \* 1000 + $glibcminor`
+ if test "$glibcnum" -ge 2011 ; then
+ gcc_cv_as_gnu_unique_object=yes
+ fi
+ fi
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_gnu_unique_object" >&5
+echo "${ECHO_T}$gcc_cv_as_gnu_unique_object" >&6
+if test $gcc_cv_as_gnu_unique_object = yes; then
+ enable_gnu_unique_object=yes
+fi
+fi;
+if test x$enable_gnu_unique_object = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GAS_GNU_UNIQUE_OBJECT 1
+_ACEOF
+
+fi
+
echo "$as_me:$LINENO: checking assembler for tolerance to line number 0" >&5
echo $ECHO_N "checking assembler for tolerance to line number 0... $ECHO_C" >&6
if test "${gcc_cv_as_line_zero+set}" = set; then
diff --git a/gcc/configure.ac b/gcc/configure.ac
index f73fc16f7cc..c068cf9aeba 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3379,6 +3379,33 @@ gcc_GAS_CHECK_FEATURE([.lcomm with alignment], gcc_cv_as_lcomm_with_alignment,
[AC_DEFINE(HAVE_GAS_LCOMM_WITH_ALIGNMENT, 1,
[Define if your assembler supports .lcomm with an alignment field.])])
+AC_ARG_ENABLE(gnu-unique-object,
+ [ --enable-gnu-unique-object enable the use of the @gnu_unique_object ELF extension on
+ glibc systems],
+ [case $enable_gnu_unique_object in
+ yes | no) ;;
+ *) AC_MSG_ERROR(['$enable_gnu_unique_object' is an invalid value for --enable-gnu-unique-object.
+Valid choices are 'yes' and 'no'.]) ;;
+ esac],
+ [gcc_GAS_CHECK_FEATURE([gnu_unique_object], gcc_cv_as_gnu_unique_object,
+ [elf,2,19,52],,
+ [.type foo, @gnu_unique_object],
+# Also check for ld.so support, i.e. glibc 2.11 or higher.
+ [if test x$host = x$build -a x$host = x$target &&
+ glibcver=`ldd --version 2>/dev/null`; then
+ glibcmajor=`expr "$glibcver" : "ldd (GNU libc) \([[0-9]]*\)"`
+ glibcminor=`expr "$glibcver" : "ldd (GNU libc) [[0-9]]*\.\([[0-9]]*\)"`
+ glibcnum=`expr $glibcmajor \* 1000 + $glibcminor`
+ if test "$glibcnum" -ge 2011 ; then
+ gcc_cv_as_gnu_unique_object=yes
+ fi
+ fi],
+ [enable_gnu_unique_object=yes])])
+if test x$enable_gnu_unique_object = xyes; then
+ AC_DEFINE(HAVE_GAS_GNU_UNIQUE_OBJECT, 1,
+ [Define if your assembler supports @gnu_unique_object.])
+fi
+
AC_CACHE_CHECK([assembler for tolerance to line number 0],
[gcc_cv_as_line_zero],
[gcc_cv_as_line_zero=no
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c52c6da89e1..52625db3836 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,113 @@
+2009-08-17 Richard Guenther <rguenther@suse.de>
+
+ * decl.c (build_ptrmemfunc_type): Keep variant chain intact.
+ Avoid useless copy.
+ (finish_enum): Keep variant chain intact.
+ * tree.c (cp_build_reference_type): Likewise.
+
+2009-08-16 Jason Merrill <jason@redhat.com>
+
+ Make TREE_USED match the [basic.def.odr] concept for FUNCTION_DECL
+ and VAR_DECL, so mark_used only has effect the first time.
+ * decl2.c (mark_used): Just return if TREE_USED is already set.
+ Don't set TREE_USED if cp_unevaluated_operand is set.
+ (tree_used_ok): New fn.
+ * init.c (build_offset_ref): Check it instead of TREE_USED.
+ * call.c (build_call_a): Likewise.
+ * cp-tree.h: Declare it.
+ (DECL_NO_LINKAGE_CHECKED): No longer needed.
+ (struct lang_decl_base): Remove no_linkage_checked bitfield.
+
+ * decl2.c (finish_static_data_member_decl): Don't set TREE_USED.
+
+ * decl2.c (mark_used): It's ok to synthesize for default args now.
+
+2009-08-10 Jason Merrill <jason@redhat.com>
+
+ Implement DR 757: It's OK for a decl to use a type without linkage
+ so long as the decl is defined in the current translation unit.
+ * decl2.c (no_linkage_decls): New vector.
+ (mark_used): Add decls that use types with no linkage.
+ (cp_write_global_declarations): Check that they are defined.
+ (decl_defined_p, no_linkage_error): New fns.
+ * cp-tree.h (DECL_NO_LINKAGE_CHECKED): New macro.
+ (struct lang_decl_base): Add flag.
+ * decl.c (grokfndecl): Don't check type linkage.
+ (grokvardecl): If the type has no linkage, just make sure
+ DECL_LANG_SPECIFIC is set.
+ * pt.c (check_instantiated_arg): Don't check type linkage.
+ * name-lookup.c (is_local_extern): New fn.
+ * name-lookup.h: Declare it.
+
+2009-08-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/40948
+ * init.c (build_vec_init): Evaluate the initializer before
+ starting the initialization try block.
+
+2009-08-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/36069
+ * typeck.c (convert_for_assignment): Do not warn for any boolean
+ variant. Use explicit location.
+
+2009-08-04 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/39987
+ * pt.c (tsubst_default_argument): Let access checks of the
+ default argument happen in the context of the current function.
+
+2009-08-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/16696
+ * call.c (build_new_op): Only try prefix operator if -fpermissive,
+ otherwise just error.
+
+2009-08-04 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/39706
+ * error.c (lang_decl_name): Print qualified names for decls
+ in namespace scope.
+
+2009-08-03 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/40948
+ * init.c (build_vec_init): Look through a TARGET_EXPR around a
+ CONSTRUCTOR.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
+ Douglas Gregor <doug.gregor@gmail.com>
+
+ Remove implicit binding of lvalues to rvalue references (N2831)
+ * call.c (convert_class_to_reference): Binding an lvalue to an
+ rvalue reference is bad. If the user-defined conversion is bad,
+ set bad_p before merging conversions.
+ (maybe_handle_ref_bind): Don't push down bad_p.
+ (reference_binding): Binding an lvalue to an rvalue reference is bad.
+ (convert_like_real): Give a helpful error about binding lvalue
+ to rvalue reference.
+ (reference_related_p): No longer static.
+ * typeck.c (build_typed_address): New.
+ (build_static_cast_1): Add static_cast from lvalue to &&.
+ * cp-tree.h: Adjust.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
+
+ * call.c (reference_binding): Rename lvalue_p to is_lvalue.
+ Do direct binding of "rvalues" in memory to rvalue references.
+ * tree.c (lvalue_p_1): Can't be both non-addressable lvalue and
+ "rvalue" in memory.
+ * typeck.c (build_static_cast_1): Do direct binding of memory
+ "rvalues" to rvalue references.
+ * cvt.c (cp_fold_convert): New.
+ * cp-tree.h: Declare it.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
+
+ * typeck.c (build_address): Do fold away ADDR_EXPR of INDIRECT_REF.
+ * tree.c (rvalue): Use cp_build_qualified_type, not TYPE_MAIN_VARIANT.
+
2009-07-29 Jason Merrill <jason@redhat.com>
PR c++/14912
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0254ecb8af9..30a1b45a1ed 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -190,7 +190,6 @@ static struct z_candidate *add_candidate
conversion **, tree, tree, int);
static tree source_type (conversion *);
static void add_warning (struct z_candidate *, struct z_candidate *);
-static bool reference_related_p (tree, tree);
static bool reference_compatible_p (tree, tree);
static conversion *convert_class_to_reference (tree, tree, tree, int);
static conversion *direct_reference_binding (tree, conversion *);
@@ -319,7 +318,7 @@ build_call_a (tree function, int n, tree *argarray)
&& TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL)
{
decl = TREE_OPERAND (function, 0);
- if (!TREE_USED (decl))
+ if (!tree_used_ok (decl))
{
/* We invoke build_call directly for several library
functions. These may have been declared normally if
@@ -966,7 +965,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
/* Returns nonzero if T1 is reference-related to T2. */
-static bool
+bool
reference_related_p (tree t1, tree t2)
{
t1 = TYPE_MAIN_VARIANT (t1);
@@ -1110,6 +1109,11 @@ convert_class_to_reference (tree reference_type, tree s, tree expr, int flags)
= TYPE_REF_IS_RVALUE (TREE_TYPE (TREE_TYPE (cand->fn)))
== TYPE_REF_IS_RVALUE (reference_type);
cand->second_conv->bad_p |= cand->convs[0]->bad_p;
+
+ /* Don't allow binding of lvalues to rvalue references. */
+ if (TYPE_REF_IS_RVALUE (reference_type)
+ && !TYPE_REF_IS_RVALUE (TREE_TYPE (TREE_TYPE (cand->fn))))
+ cand->second_conv->bad_p = true;
}
}
}
@@ -1137,13 +1141,13 @@ convert_class_to_reference (tree reference_type, tree s, tree expr, int flags)
build_identity_conv (TREE_TYPE (expr), expr));
conv->cand = cand;
+ if (cand->viable == -1)
+ conv->bad_p = true;
+
/* Merge it with the standard conversion sequence from the
conversion function's return type to the desired type. */
cand->second_conv = merge_conversion_sequences (conv, cand->second_conv);
- if (cand->viable == -1)
- conv->bad_p = true;
-
return cand->second_conv;
}
@@ -1205,7 +1209,7 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
tree tfrom;
bool related_p;
bool compatible_p;
- cp_lvalue_kind lvalue_p = clk_none;
+ cp_lvalue_kind is_lvalue = clk_none;
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
{
@@ -1218,7 +1222,7 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
if (TREE_CODE (from) == REFERENCE_TYPE)
{
/* Anything with reference type is an lvalue. */
- lvalue_p = clk_ordinary;
+ is_lvalue = clk_ordinary;
from = TREE_TYPE (from);
}
@@ -1235,11 +1239,11 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
}
}
- if (lvalue_p == clk_none && expr)
- lvalue_p = real_lvalue_p (expr);
+ if (is_lvalue == clk_none && expr)
+ is_lvalue = real_lvalue_p (expr);
tfrom = from;
- if ((lvalue_p & clk_bitfield) != 0)
+ if ((is_lvalue & clk_bitfield) != 0)
tfrom = unlowered_expr_type (expr);
/* Figure out whether or not the types are reference-related and
@@ -1256,12 +1260,15 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
/* Directly bind reference when target expression's type is compatible with
the reference and expression is an lvalue. In DR391, the wording in
[8.5.3/5 dcl.init.ref] is changed to also require direct bindings for
- const and rvalue references to rvalues of compatible class type. */
+ const and rvalue references to rvalues of compatible class type.
+ We should also do direct bindings for non-class "rvalues" derived from
+ rvalue references. */
if (compatible_p
- && (lvalue_p
- || (!(flags & LOOKUP_NO_TEMP_BIND)
- && (CP_TYPE_CONST_NON_VOLATILE_P(to) || TYPE_REF_IS_RVALUE (rto))
- && CLASS_TYPE_P (from))))
+ && (is_lvalue
+ || (((CP_TYPE_CONST_NON_VOLATILE_P (to)
+ && !(flags & LOOKUP_NO_TEMP_BIND))
+ || TYPE_REF_IS_RVALUE (rto))
+ && (CLASS_TYPE_P (from) || (expr && lvalue_p (expr))))))
{
/* [dcl.init.ref]
@@ -1288,10 +1295,10 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto);
else
conv->rvaluedness_matches_p
- = (TYPE_REF_IS_RVALUE (rto) == !lvalue_p);
+ = (TYPE_REF_IS_RVALUE (rto) == !is_lvalue);
- if ((lvalue_p & clk_bitfield) != 0
- || ((lvalue_p & clk_packed) != 0 && !TYPE_PACKED (to)))
+ if ((is_lvalue & clk_bitfield) != 0
+ || ((is_lvalue & clk_packed) != 0 && !TYPE_PACKED (to)))
/* For the purposes of overload resolution, we ignore the fact
this expression is a bitfield or packed field. (In particular,
[over.ics.ref] says specifically that a function with a
@@ -1305,6 +1312,11 @@ reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags)
actually occurs. */
conv->need_temporary_p = true;
+ /* Don't allow binding of lvalues to rvalue references. */
+ if (is_lvalue && TYPE_REF_IS_RVALUE (rto)
+ && !(flags & LOOKUP_PREFER_RVALUE))
+ conv->bad_p = true;
+
return conv;
}
/* [class.conv.fct] A conversion function is never used to convert a
@@ -4243,13 +4255,23 @@ build_new_op (enum tree_code code, int flags, tree arg1, tree arg2, tree arg3,
if (!(complain & tf_error))
return error_mark_node;
- /* Look for an `operator++ (int)'. If they didn't have
- one, then we fall back to the old way of doing things. */
+ /* Look for an `operator++ (int)'. Pre-1985 C++ didn't
+ distinguish between prefix and postfix ++ and
+ operator++() was used for both, so we allow this with
+ -fpermissive. */
if (flags & LOOKUP_COMPLAIN)
- permerror (input_location, "no %<%D(int)%> declared for postfix %qs, "
- "trying prefix operator instead",
- fnname,
- operator_name_info[code].name);
+ {
+ const char *msg = (flag_permissive)
+ ? G_("no %<%D(int)%> declared for postfix %qs,"
+ " trying prefix operator instead")
+ : G_("no %<%D(int)%> declared for postfix %qs");
+ permerror (input_location, msg, fnname,
+ operator_name_info[code].name);
+ }
+
+ if (!flag_permissive)
+ return error_mark_node;
+
if (code == POSTINCREMENT_EXPR)
code = PREINCREMENT_EXPR;
else
@@ -4958,6 +4980,19 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
{
tree ref_type = totype;
+ if (convs->bad_p && TYPE_REF_IS_RVALUE (ref_type)
+ && real_lvalue_p (expr))
+ {
+ if (complain & tf_error)
+ {
+ error ("cannot bind %qT lvalue to %qT",
+ TREE_TYPE (expr), totype);
+ if (fn)
+ error (" initializing argument %P of %q+D", argnum, fn);
+ }
+ return error_mark_node;
+ }
+
/* If necessary, create a temporary.
VA_ARG_EXPR and CONSTRUCTOR expressions are special cases
@@ -6456,7 +6491,6 @@ maybe_handle_ref_bind (conversion **ics)
conversion *old_ics = *ics;
*ics = old_ics->u.next;
(*ics)->user_conv_p = old_ics->user_conv_p;
- (*ics)->bad_p = old_ics->bad_p;
return old_ics;
}
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index b3bcd3103b8..c4cf139dac5 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4269,6 +4269,7 @@ extern tree set_up_extended_ref_temp (tree, tree, tree *, tree *);
extern tree initialize_reference (tree, tree, tree, tree *);
extern tree make_temporary_var_for_ref_to_temp (tree, tree);
extern tree strip_top_quals (tree);
+extern bool reference_related_p (tree, tree);
extern tree perform_implicit_conversion (tree, tree, tsubst_flags_t);
extern tree perform_implicit_conversion_flags (tree, tree, tsubst_flags_t, int);
extern tree perform_direct_initialization_if_possible (tree, tree, bool,
@@ -4342,6 +4343,7 @@ extern tree force_rvalue (tree);
extern tree ocp_convert (tree, tree, int, int);
extern tree cp_convert (tree, tree);
extern tree cp_convert_and_check (tree, tree);
+extern tree cp_fold_convert (tree, tree);
extern tree convert_to_void (tree, const char */*implicit context*/,
tsubst_flags_t);
extern tree convert_force (tree, tree, int);
@@ -4478,6 +4480,7 @@ extern tree build_cleanup (tree);
extern tree build_offset_ref_call_from_tree (tree, VEC(tree,gc) **);
extern void check_default_args (tree);
extern void mark_used (tree);
+extern bool tree_used_ok (tree);
extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
extern tree cp_build_parm_decl (tree, tree);
extern tree get_guard (tree);
@@ -4630,6 +4633,7 @@ extern void mark_decl_instantiated (tree, int);
extern int more_specialized_fn (tree, tree, int);
extern void do_decl_instantiation (tree, tree);
extern void do_type_instantiation (tree, tree, tsubst_flags_t);
+extern bool always_instantiate_p (tree);
extern tree instantiate_decl (tree, int, bool);
extern int comp_template_parms (const_tree, const_tree);
extern bool uses_parameter_packs (tree);
@@ -5064,6 +5068,7 @@ extern tree cp_build_binary_op (location_t,
#define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
extern tree build_ptrmemfunc_access_expr (tree, tree);
extern tree build_address (tree);
+extern tree build_typed_address (tree, tree);
extern tree build_nop (tree, tree);
extern tree non_reference (tree);
extern tree lookup_anon_field (tree, tree);
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index c42d21cb3cd..cdc6a10a825 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -539,7 +539,16 @@ force_rvalue (tree expr)
return expr;
}
+
+/* Fold away simple conversions, but make sure the result is an rvalue. */
+
+tree
+cp_fold_convert (tree type, tree expr)
+{
+ return rvalue (fold_convert (type, expr));
+}
+
/* C++ conversions, preference to static cast conversions. */
tree
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index be1b5b7b5ef..0746b828e7e 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6747,36 +6747,6 @@ grokfndecl (tree ctype,
|| decl_function_context (TYPE_MAIN_DECL (ctype))))
publicp = 0;
- if (publicp)
- {
- /* [basic.link]: A name with no linkage (notably, the name of a class
- or enumeration declared in a local scope) shall not be used to
- declare an entity with linkage.
-
- Only check this for public decls for now. See core 319, 389. */
- t = no_linkage_check (TREE_TYPE (decl),
- /*relaxed_p=*/false);
- if (t)
- {
- if (TYPE_ANONYMOUS_P (t))
- {
- if (DECL_EXTERN_C_P (decl))
- /* Allow this; it's pretty common in C. */;
- else
- {
- permerror (input_location, "non-local function %q#D uses anonymous type",
- decl);
- if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
- permerror (input_location, "%q+#D does not refer to the unqualified "
- "type, so it is not used for linkage",
- TYPE_NAME (t));
- }
- }
- else
- permerror (input_location, "non-local function %q#D uses local type %qT", decl, t);
- }
- }
-
TREE_PUBLIC (decl) = publicp;
if (! publicp)
{
@@ -7021,36 +6991,13 @@ grokvardecl (tree type,
if (TREE_PUBLIC (decl))
{
- /* [basic.link]: A name with no linkage (notably, the name of a class
- or enumeration declared in a local scope) shall not be used to
- declare an entity with linkage.
-
- Only check this for public decls for now. */
- tree t = no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/false);
- if (t)
- {
- if (TYPE_ANONYMOUS_P (t))
- {
- if (DECL_EXTERN_C_P (decl))
- /* Allow this; it's pretty common in C. */
- ;
- else
- {
- /* DRs 132, 319 and 389 seem to indicate types with
- no linkage can only be used to declare extern "C"
- entities. Since it's not always an error in the
- ISO C++ 90 Standard, we only issue a warning. */
- warning (0, "non-local variable %q#D uses anonymous type",
- decl);
- if (DECL_ORIGINAL_TYPE (TYPE_NAME (t)))
- warning (0, "%q+#D does not refer to the unqualified "
- "type, so it is not used for linkage",
- TYPE_NAME (t));
- }
- }
- else
- warning (0, "non-local variable %q#D uses local type %qT", decl, t);
- }
+ /* If the type of the decl has no linkage, make sure that we'll
+ notice that in mark_used. */
+ if (DECL_LANG_SPECIFIC (decl) == NULL
+ && TREE_PUBLIC (decl)
+ && !DECL_EXTERN_C_P (decl)
+ && no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/false))
+ retrofit_lang_decl (decl);
}
else
DECL_INTERFACE_KNOWN (decl) = 1;
@@ -7109,10 +7056,14 @@ build_ptrmemfunc_type (tree type)
/* If this is not the unqualified form of this pointer-to-member
type, set the TYPE_MAIN_VARIANT for this type to be the
unqualified type. Since they are actually RECORD_TYPEs that are
- not variants of each other, we must do this manually. */
+ not variants of each other, we must do this manually.
+ As we just built a new type there is no need to do yet another copy. */
if (cp_type_quals (type) != TYPE_UNQUALIFIED)
{
- t = build_qualified_type (t, cp_type_quals (type));
+ int type_quals = cp_type_quals (type);
+ TYPE_READONLY (t) = (type_quals & TYPE_QUAL_CONST) != 0;
+ TYPE_VOLATILE (t) = (type_quals & TYPE_QUAL_VOLATILE) != 0;
+ TYPE_RESTRICT (t) = (type_quals & TYPE_QUAL_RESTRICT) != 0;
TYPE_MAIN_VARIANT (t) = unqualified_variant;
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant);
TYPE_NEXT_VARIANT (unqualified_variant) = t;
@@ -11217,7 +11168,8 @@ finish_enum (tree enumtype)
/* Set the underlying type of the enumeration type to the
computed enumeration type, restricted to the enumerator
values. */
- ENUM_UNDERLYING_TYPE (enumtype) = copy_node (underlying_type);
+ ENUM_UNDERLYING_TYPE (enumtype)
+ = build_distinct_type_copy (underlying_type);
set_min_and_max_values_for_integral_type
(ENUM_UNDERLYING_TYPE (enumtype), precision, unsignedp);
}
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index df79e9c4e1c..e4ed9632b2d 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -84,6 +84,7 @@ static void write_out_vars (tree);
static void import_export_class (tree);
static tree get_guard_bits (tree);
static void determine_visibility_from_class (tree, tree);
+static bool decl_defined_p (tree);
/* A list of static class variables. This is needed, because a
static class variable can be declared inside the class without
@@ -94,6 +95,10 @@ static GTY(()) VEC(tree,gc) *pending_statics;
may need to emit outline anyway. */
static GTY(()) VEC(tree,gc) *deferred_fns;
+/* A list of decls that use types with no linkage, which we need to make
+ sure are defined. */
+static GTY(()) VEC(tree,gc) *no_linkage_decls;
+
/* Nonzero if we're done parsing and into end-of-file activities. */
int at_eof;
@@ -741,10 +746,7 @@ finish_static_data_member_decl (tree decl,
}
init = NULL_TREE;
}
- /* Force the compiler to know when an uninitialized static const
- member is being used. */
- if (CP_TYPE_CONST_P (TREE_TYPE (decl)) && init == 0)
- TREE_USED (decl) = 1;
+
DECL_INITIAL (decl) = init;
DECL_IN_AGGR_P (decl) = 1;
@@ -3332,6 +3334,40 @@ build_java_method_aliases (void)
}
}
+/* Returns true iff there is a definition available for variable or
+ function DECL. */
+
+static bool
+decl_defined_p (tree decl)
+{
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ return (DECL_INITIAL (decl) != NULL_TREE);
+ else
+ {
+ gcc_assert (TREE_CODE (decl) == VAR_DECL);
+ return !DECL_EXTERNAL (decl);
+ }
+}
+
+/* Complain that DECL uses a type with no linkage but is never defined. */
+
+static void
+no_linkage_error (tree decl)
+{
+ tree t = no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/false);
+ if (TYPE_ANONYMOUS_P (t))
+ {
+ permerror (0, "%q+#D, declared using anonymous type, "
+ "is used but never defined", decl);
+ if (is_typedef_decl (TYPE_NAME (t)))
+ permerror (0, "%q+#D does not refer to the unqualified type, "
+ "so it is not used for linkage", TYPE_NAME (t));
+ }
+ else
+ permerror (0, "%q+#D, declared using local type %qT, "
+ "is used but never defined", decl, t);
+}
+
/* This routine is called at the end of compilation.
Its job is to create all the code needed to initialize and
destroy the global aggregates. We do the destruction
@@ -3613,6 +3649,11 @@ cp_write_global_declarations (void)
}
}
+ /* So must decls that use a type with no linkage. */
+ for (i = 0; VEC_iterate (tree, no_linkage_decls, i, decl); ++i)
+ if (!decl_defined_p (decl))
+ no_linkage_error (decl);
+
/* We give C linkage to static constructors and destructors. */
push_lang_context (lang_name_c);
@@ -3804,20 +3845,24 @@ mark_used (tree decl)
decl = OVL_CURRENT (decl);
}
- TREE_USED (decl) = 1;
- if (DECL_CLONED_FUNCTION_P (decl))
- TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DELETED_FN (decl))
{
error ("deleted function %q+D", decl);
error ("used here");
+ TREE_USED (decl) = 1;
return;
}
/* If we don't need a value, then we don't need to synthesize DECL. */
if (cp_unevaluated_operand != 0)
return;
+ /* We only want to do this processing once. We don't need to keep trying
+ to instantiate inline templates, because unit-at-a-time will make sure
+ we get them compiled before functions that want to inline them. */
+ if (TREE_USED (decl))
+ return;
+
/* If within finish_function, defer the rest until that function
finishes, otherwise it might recurse. */
if (defer_mark_used_calls)
@@ -3851,6 +3896,34 @@ mark_used (tree decl)
if (processing_template_decl)
return;
+ TREE_USED (decl) = 1;
+ if (DECL_CLONED_FUNCTION_P (decl))
+ TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
+
+ /* DR 757: A type without linkage shall not be used as the type of a
+ variable or function with linkage, unless
+ o the variable or function has extern "C" linkage (7.5 [dcl.link]), or
+ o the variable or function is not used (3.2 [basic.def.odr]) or is
+ defined in the same translation unit. */
+ if (TREE_PUBLIC (decl)
+ && (TREE_CODE (decl) == FUNCTION_DECL
+ || TREE_CODE (decl) == VAR_DECL)
+ && DECL_LANG_SPECIFIC (decl))
+ {
+ if (!DECL_EXTERN_C_P (decl)
+ && !DECL_ARTIFICIAL (decl)
+ && !decl_defined_p (decl)
+ && no_linkage_check (TREE_TYPE (decl), /*relaxed_p=*/false))
+ {
+ if (is_local_extern (decl))
+ /* There's no way to define a local extern, and adding it to
+ the vector interferes with GC, so give an error now. */
+ no_linkage_error (decl);
+ else
+ VEC_safe_push (tree, gc, no_linkage_decls, decl);
+ }
+ }
+
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (decl)
&& !TREE_ASM_WRITTEN (decl))
/* Remember it, so we can check it was defined. */
@@ -3873,12 +3946,7 @@ mark_used (tree decl)
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)
&& DECL_DEFAULTED_FN (decl)
&& !DECL_THUNK_P (decl)
- && ! DECL_INITIAL (decl)
- /* Kludge: don't synthesize for default args. Unfortunately this
- rules out initializers of namespace-scoped objects too, but
- it's sort-of ok if the implicit ctor or dtor decl keeps
- pointing to the class location. */
- && current_function_decl)
+ && ! DECL_INITIAL (decl))
{
synthesize_method (decl);
/* If we've already synthesized the method we don't need to
@@ -3887,15 +3955,7 @@ mark_used (tree decl)
else if ((DECL_NON_THUNK_FUNCTION_P (decl) || TREE_CODE (decl) == VAR_DECL)
&& DECL_LANG_SPECIFIC (decl) && DECL_TEMPLATE_INFO (decl)
&& (!DECL_EXPLICIT_INSTANTIATION (decl)
- || (TREE_CODE (decl) == FUNCTION_DECL
- && possibly_inlined_p
- (DECL_TEMPLATE_RESULT (
- template_for_substitution (decl))))
- /* We need to instantiate static data members so that there
- initializers are available in integral constant
- expressions. */
- || (TREE_CODE (decl) == VAR_DECL
- && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl))))
+ || always_instantiate_p (decl)))
/* If this is a function or variable that is an instance of some
template, we now know that we will need to actually do the
instantiation. We check that DECL is not an explicit
@@ -3911,4 +3971,15 @@ mark_used (tree decl)
processing_template_decl = saved_processing_template_decl;
}
+/* Use this function to verify that mark_used has been called
+ previously. That is, either TREE_USED is set, or we're in a
+ context that doesn't set it. */
+
+bool
+tree_used_ok (tree decl)
+{
+ return (TREE_USED (decl) || cp_unevaluated_operand
+ || defer_mark_used_calls || processing_template_decl);
+}
+
#include "gt-cp-decl2.h"
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ab804c4306d..19649292627 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2338,7 +2338,10 @@ lang_decl_name (tree decl, int v, bool translate)
reinit_cxx_pp ();
pp_translate_identifiers (cxx_pp) = translate;
- if (v == 1 && DECL_CLASS_SCOPE_P (decl))
+ if (v == 1
+ && (DECL_CLASS_SCOPE_P (decl)
+ || (DECL_NAMESPACE_SCOPE_P (decl)
+ && CP_DECL_CONTEXT (decl) != global_namespace)))
{
dump_type (CP_DECL_CONTEXT (decl), TFF_PLAIN_IDENTIFIER);
pp_cxx_colon_colon (cxx_pp);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3da8ab8464c..9dac7de400e 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1502,7 +1502,7 @@ build_offset_ref (tree type, tree member, bool address_p)
gcc_assert (DECL_P (member) || BASELINK_P (member));
/* Callers should call mark_used before this point. */
- gcc_assert (!DECL_P (member) || TREE_USED (member));
+ gcc_assert (!DECL_P (member) || tree_used_ok (member));
if (!COMPLETE_TYPE_P (complete_type (type))
&& !TYPE_BEING_DEFINED (type))
@@ -2695,6 +2695,13 @@ build_vec_init (tree base, tree maxindex, tree init,
gcc_assert (!init);
inner_elt_type = strip_array_types (type);
+
+ /* Look through the TARGET_EXPR around a compound literal. */
+ if (init && TREE_CODE (init) == TARGET_EXPR
+ && TREE_CODE (TARGET_EXPR_INITIAL (init)) == CONSTRUCTOR
+ && from_array != 2)
+ init = TARGET_EXPR_INITIAL (init);
+
if (init
&& TREE_CODE (atype) == ARRAY_TYPE
&& (from_array == 2
@@ -2763,6 +2770,17 @@ build_vec_init (tree base, tree maxindex, tree init,
base = get_temp_regvar (ptype, rval);
iterator = get_temp_regvar (ptrdiff_type_node, maxindex);
+ /* If initializing one array from another, initialize element by
+ element. We rely upon the below calls to do the argument
+ checking. Evaluate the initializer before entering the try block. */
+ if (from_array && init && TREE_CODE (init) != CONSTRUCTOR)
+ {
+ base2 = decay_conversion (init);
+ itype = TREE_TYPE (base2);
+ base2 = get_temp_regvar (itype, base2);
+ itype = TREE_TYPE (itype);
+ }
+
/* Protect the entire array initialization so that we can destroy
the partially constructed array if an exception is thrown.
But don't do this if we're assigning. */
@@ -2805,16 +2823,8 @@ build_vec_init (tree base, tree maxindex, tree init,
}
else if (from_array)
{
- /* If initializing one array from another, initialize element by
- element. We rely upon the below calls the do argument
- checking. */
if (init)
- {
- base2 = decay_conversion (init);
- itype = TREE_TYPE (base2);
- base2 = get_temp_regvar (itype, base2);
- itype = TREE_TYPE (itype);
- }
+ /* OK, we set base2 above. */;
else if (TYPE_LANG_SPECIFIC (type)
&& TYPE_NEEDS_CONSTRUCTING (type)
&& ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index c2d877907bc..feb2cf280d1 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4392,6 +4392,34 @@ lookup_name_innermost_nonclass_level (tree name)
POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
}
+/* Returns true iff DECL is a block-scope extern declaration of a function
+ or variable. */
+
+bool
+is_local_extern (tree decl)
+{
+ cxx_binding *binding;
+
+ /* For functions, this is easy. */
+ if (TREE_CODE (decl) == FUNCTION_DECL)
+ return DECL_LOCAL_FUNCTION_P (decl);
+
+ if (TREE_CODE (decl) != VAR_DECL)
+ return false;
+ if (!current_function_decl)
+ return false;
+
+ /* For variables, this is not easy. We need to look at the binding stack
+ for the identifier to see whether the decl we have is a local. */
+ for (binding = IDENTIFIER_BINDING (DECL_NAME (decl));
+ binding && binding->scope->kind != sk_namespace;
+ binding = binding->previous)
+ if (binding->value == decl)
+ return LOCAL_BINDING_P (binding);
+
+ return false;
+}
+
/* Like lookup_name_innermost_nonclass_level, but for types. */
static tree
diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h
index 2203a8400bf..7a3625a2926 100644
--- a/gcc/cp/name-lookup.h
+++ b/gcc/cp/name-lookup.h
@@ -318,6 +318,7 @@ extern tree remove_hidden_names (tree);
extern tree lookup_qualified_name (tree, tree, bool, bool);
extern tree lookup_name_nonclass (tree);
extern tree lookup_name_innermost_nonclass_level (tree);
+extern bool is_local_extern (tree);
extern tree lookup_function_nonclass (tree, VEC(tree,gc) *, bool);
extern void push_local_binding (tree, tree, int);
extern bool pushdecl_class_level (tree);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ed45324b9ab..eb43271e850 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8253,11 +8253,11 @@ tsubst_default_argument (tree fn, tree type, tree arg)
cp_function_chain->x_current_class_ref = saved_class_ref;
}
- pop_access_scope (fn);
-
/* Make sure the default argument is reasonable. */
arg = check_default_argument (type, arg);
+ pop_access_scope (fn);
+
return arg;
}
@@ -12215,7 +12215,7 @@ tsubst_copy_and_build (tree t,
}
/* Verify that the instantiated ARGS are valid. For type arguments,
- make sure that the type's linkage is ok. For non-type arguments,
+ make sure that the type is not variably modified. For non-type arguments,
make sure they are constants if they are integral or enumerations.
Emit an error under control of COMPLAIN, and return TRUE on error. */
@@ -12236,30 +12236,7 @@ check_instantiated_arg (tree tmpl, tree t, tsubst_flags_t complain)
}
else if (TYPE_P (t))
{
- /* [basic.link]: A name with no linkage (notably, the name
- of a class or enumeration declared in a local scope)
- shall not be used to declare an entity with linkage.
- This implies that names with no linkage cannot be used as
- template arguments. */
- tree nt = no_linkage_check (t, /*relaxed_p=*/false);
-
- if (nt)
- {
- /* DR 488 makes use of a type with no linkage cause
- type deduction to fail. */
- if (complain & tf_error)
- {
- if (TYPE_ANONYMOUS_P (nt))
- error ("%qT is/uses anonymous type", t);
- else
- error ("template argument for %qD uses local type %qT",
- tmpl, t);
- }
- return true;
- }
- /* In order to avoid all sorts of complications, we do not
- allow variably-modified types as template arguments. */
- else if (variably_modified_type_p (t, NULL_TREE))
+ if (variably_modified_type_p (t, NULL_TREE))
{
if (complain & tf_error)
error ("%qT is a variably modified type", t);
@@ -15658,6 +15635,27 @@ template_for_substitution (tree decl)
return tmpl;
}
+/* Returns true if we need to instantiate this template instance even if we
+ know we aren't going to emit it.. */
+
+bool
+always_instantiate_p (tree decl)
+{
+ /* We always instantiate inline functions so that we can inline them. An
+ explicit instantiation declaration prohibits implicit instantiation of
+ non-inline functions. With high levels of optimization, we would
+ normally inline non-inline functions -- but we're not allowed to do
+ that for "extern template" functions. Therefore, we check
+ DECL_DECLARED_INLINE_P, rather than possibly_inlined_p. */
+ return ((TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DECLARED_INLINE_P (decl))
+ /* And we need to instantiate static data members so that
+ their initializers are available in integral constant
+ expressions. */
+ || (TREE_CODE (decl) == VAR_DECL
+ && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)));
+}
+
/* Produce the definition of D, a _DECL generated from a template. If
DEFER_OK is nonzero, then we don't have to actually do the
instantiation now; we just have to do it sometime. Normally it is
@@ -15711,6 +15709,15 @@ instantiate_decl (tree d, int defer_ok,
the instantiation. */
return d;
+ /* Check to see whether we know that this template will be
+ instantiated in some other file, as with "extern template"
+ extension. */
+ external_p = (DECL_INTERFACE_KNOWN (d) && DECL_REALLY_EXTERN (d));
+
+ /* In general, we do not instantiate such templates. */
+ if (external_p && !always_instantiate_p (d))
+ return d;
+
gen_tmpl = most_general_template (tmpl);
gen_args = DECL_TI_ARGS (d);
@@ -15804,26 +15811,6 @@ instantiate_decl (tree d, int defer_ok,
pop_access_scope (d);
}
- /* Check to see whether we know that this template will be
- instantiated in some other file, as with "extern template"
- extension. */
- external_p = (DECL_INTERFACE_KNOWN (d) && DECL_REALLY_EXTERN (d));
- /* In general, we do not instantiate such templates... */
- if (external_p
- /* ... but we instantiate inline functions so that we can inline
- them. An explicit instantiation declaration prohibits implicit
- instantiation of non-inline functions. With high levels of
- optimization, we would normally inline non-inline functions
- -- but we're not allowed to do that for "extern template" functions.
- Therefore, we check DECL_DECLARED_INLINE_P, rather than
- possibly_inlined_p. And ... */
- && ! (TREE_CODE (d) == FUNCTION_DECL
- && DECL_DECLARED_INLINE_P (d))
- /* ... we instantiate static data members whose values are
- needed in integral constant expressions. */
- && ! (TREE_CODE (d) == VAR_DECL
- && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (d)))
- goto out;
/* Defer all other templates, unless we have been explicitly
forbidden from doing so. */
if (/* If there is no definition, we cannot instantiate the
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 83869c17a1b..1a406a30690 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -214,10 +214,14 @@ lvalue_p_1 (const_tree ref)
/* Otherwise, it's an lvalue, and it has all the odd properties
contributed by either operand. */
op1_lvalue_kind = op1_lvalue_kind | op2_lvalue_kind;
- /* It's not an ordinary lvalue if it involves either a bit-field or
- a class rvalue. */
+ /* It's not an ordinary lvalue if it involves any other kind. */
if ((op1_lvalue_kind & ~clk_ordinary) != clk_none)
op1_lvalue_kind &= ~clk_ordinary;
+ /* It can't be both a pseudo-lvalue and a non-addressable lvalue.
+ A COND_EXPR of those should be wrapped in a TARGET_EXPR. */
+ if ((op1_lvalue_kind & (clk_rvalueref|clk_class))
+ && (op1_lvalue_kind & (clk_bitfield|clk_packed)))
+ op1_lvalue_kind = clk_none;
return op1_lvalue_kind;
}
@@ -530,7 +534,7 @@ rvalue (tree expr)
Non-class rvalues always have cv-unqualified types. */
type = TREE_TYPE (expr);
if (!CLASS_TYPE_P (type) && cp_type_quals (type))
- type = TYPE_MAIN_VARIANT (type);
+ type = cp_build_qualified_type (type, TYPE_UNQUALIFIED);
/* We need to do this for rvalue refs as well to get the right answer
from decltype; see c++/36628. */
@@ -696,12 +700,11 @@ cp_build_reference_type (tree to_type, bool rval)
if (TYPE_REF_IS_RVALUE (t))
return t;
- t = copy_node (lvalue_ref);
+ t = build_distinct_type_copy (lvalue_ref);
TYPE_REF_IS_RVALUE (t) = true;
TYPE_NEXT_REF_TO (t) = TYPE_NEXT_REF_TO (lvalue_ref);
TYPE_NEXT_REF_TO (lvalue_ref) = t;
- TYPE_MAIN_VARIANT (t) = t;
if (TYPE_STRUCTURAL_EQUALITY_P (to_type))
SET_TYPE_STRUCTURAL_EQUALITY (t);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 8b684dd795e..de42af409da 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4276,21 +4276,31 @@ condition_conversion (tree expr)
return t;
}
-/* Return an ADDR_EXPR giving the address of T. This function
- attempts no optimizations or simplifications; it is a low-level
- primitive. */
+/* Returns the address of T. This function will fold away
+ ADDR_EXPR of INDIRECT_REF. */
tree
build_address (tree t)
{
- tree addr;
-
if (error_operand_p (t) || !cxx_mark_addressable (t))
return error_mark_node;
+ t = build_fold_addr_expr (t);
+ if (TREE_CODE (t) != ADDR_EXPR)
+ t = rvalue (t);
+ return t;
+}
- addr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (t)), t);
+/* Returns the address of T with type TYPE. */
- return addr;
+tree
+build_typed_address (tree t, tree type)
+{
+ if (error_operand_p (t) || !cxx_mark_addressable (t))
+ return error_mark_node;
+ t = build_fold_addr_expr_with_type (t, type);
+ if (TREE_CODE (t) != ADDR_EXPR)
+ t = rvalue (t);
+ return t;
}
/* Return a NOP_EXPR converting EXPR to TYPE. */
@@ -5287,7 +5297,7 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
if (TREE_CODE (type) == REFERENCE_TYPE
&& CLASS_TYPE_P (TREE_TYPE (type))
&& CLASS_TYPE_P (intype)
- && real_lvalue_p (expr)
+ && (TYPE_REF_IS_RVALUE (type) || real_lvalue_p (expr))
&& DERIVED_FROM_P (intype, TREE_TYPE (type))
&& can_convert (build_pointer_type (TYPE_MAIN_VARIANT (intype)),
build_pointer_type (TYPE_MAIN_VARIANT
@@ -5313,7 +5323,19 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p,
base, /*nonnull=*/false);
/* Convert the pointer to a reference -- but then remember that
there are no expressions with reference type in C++. */
- return convert_from_reference (build_nop (type, expr));
+ return convert_from_reference (cp_fold_convert (type, expr));
+ }
+
+ /* "An lvalue of type cv1 T1 can be cast to type rvalue reference to
+ cv2 T2 if cv2 T2 is reference-compatible with cv1 T1 (8.5.3)." */
+ if (TREE_CODE (type) == REFERENCE_TYPE
+ && TYPE_REF_IS_RVALUE (type)
+ && real_lvalue_p (expr)
+ && reference_related_p (TREE_TYPE (type), intype)
+ && (c_cast_p || at_least_as_qualified_p (TREE_TYPE (type), intype)))
+ {
+ expr = build_typed_address (expr, type);
+ return convert_from_reference (expr);
}
orig = expr;
@@ -6768,11 +6790,14 @@ convert_for_assignment (tree type, tree rhs,
&& type == boolean_type_node
&& TREE_CODE (rhs) == MODIFY_EXPR
&& !TREE_NO_WARNING (rhs)
- && TREE_TYPE (rhs) != boolean_type_node
+ && TREE_CODE (TREE_TYPE (rhs)) != BOOLEAN_TYPE
&& (complain & tf_warning))
{
- warning (OPT_Wparentheses,
- "suggest parentheses around assignment used as truth value");
+ location_t loc = EXPR_HAS_LOCATION (rhs)
+ ? EXPR_LOCATION (rhs) : input_location;
+
+ warning_at (loc, OPT_Wparentheses,
+ "suggest parentheses around assignment used as truth value");
TREE_NO_WARNING (rhs) = 1;
}
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 37c50895eab..4e9f18924d1 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2019,6 +2019,12 @@ info format it will either mean marking the function as artificial
or using the caller location for all instructions within the inlined
body.
+@item bank_switch
+@cindex interrupt handler functions
+When added to an interrupt handler with the M32C port, causes the
+prologue and epilogue to use bank switching to preserve the registers
+rather than saving them on the stack.
+
@item flatten
@cindex @code{flatten} function attribute
Generally, inlining into a function is limited. For a function marked with
@@ -2272,6 +2278,13 @@ On MeP targets this causes the compiler to use a calling convention
which assumes the called function is too far away for the built-in
addressing modes.
+@item fast_interrupt
+@cindex interrupt handler functions
+Use this attribute on the M32C port to indicate that the specified
+function is a fast interrupt handler. This is just like the
+@code{interrupt} attribute, except that @code{freit} is used to return
+instead of @code{reit}.
+
@item fastcall
@cindex functions that pop the argument stack on the 386
On the Intel 386, the @code{fastcall} attribute causes the compiler to
@@ -2830,6 +2843,28 @@ compiled with more aggressive optimization options that produce faster
and larger code, while other functions can be called with less
aggressive options.
+@item pcs
+@cindex @code{pcs} function attribute
+
+The @code{pcs} attribute can be used to control the calling convention
+used for a function on ARM. The attribute takes an argument that specifies
+the calling convention to use.
+
+When compiling using the AAPCS ABI (or a variant of that) then valid
+values for the argument are @code{"aapcs"} and @code{"aapcs-vfp"}. In
+order to use a variant other than @code{"aapcs"} then the compiler must
+be permitted to use the appropriate co-processor registers (i.e., the
+VFP registers must be available in order to use @code{"aapcs-vfp"}).
+For example,
+
+@smallexample
+/* Argument passed in r0, and result returned in r0+r1. */
+double f2d (float) __attribute__((pcs("aapcs")));
+@end smallexample
+
+Variadic functions always use the @code{"aapcs"} calling convention and
+the compiler will reject attempts to specify an alternative.
+
@item pure
@cindex @code{pure} function attribute
Many functions have no effects except the return value and their
@@ -5822,10 +5857,27 @@ of the stack has been reached, this function will return @code{0} or a
random value. In addition, @code{__builtin_frame_address} may be used
to determine if the top of the stack has been reached.
+Additional post-processing of the returned value may be needed, see
+@code{__builtin_extract_return_address}.
+
This function should only be used with a nonzero argument for debugging
purposes.
@end deftypefn
+@deftypefn {Built-in Function} {void *} __builtin_extract_return_address (void *@var{addr})
+The address as returned by @code{__builtin_return_address} may have to be fed
+through this function to get the actual encoded address. For example, on the
+31-bit S/390 platform the highest bit has to be masked out, or on SPARC
+platforms an offset has to be added for the true next instruction to be
+executed.
+
+If no fixup is needed, this function simply passes through @var{addr}.
+@end deftypefn
+
+@deftypefn {Built-in Function} {void *} __builtin_frob_return_address (void *@var{addr})
+This function does the reverse of @code{__builtin_extract_return_address}.
+@end deftypefn
+
@deftypefn {Built-in Function} {void *} __builtin_frame_address (unsigned int @var{level})
This function is similar to @code{__builtin_return_address}, but it
returns the address of the function frame rather than the return address
@@ -7298,7 +7350,7 @@ instructions, but allow the compiler to schedule those calls.
* MIPS Loongson Built-in Functions::
* Other MIPS Built-in Functions::
* picoChip Built-in Functions::
-* PowerPC AltiVec Built-in Functions::
+* PowerPC AltiVec/VSX Built-in Functions::
* SPARC VIS Built-in Functions::
* SPU Built-in Functions::
@end menu
@@ -9776,7 +9828,7 @@ GCC defines the preprocessor macro @code{___GCC_HAVE_BUILTIN_MIPS_CACHE}
when this function is available.
@end table
-@node PowerPC AltiVec Built-in Functions
+@node PowerPC AltiVec/VSX Built-in Functions
@subsection PowerPC AltiVec Built-in Functions
GCC provides an interface for the PowerPC family of processors to access
@@ -9802,6 +9854,19 @@ vector bool int
vector float
@end smallexample
+If @option{-mvsx} is used the following additional vector types are
+implemented.
+
+@smallexample
+vector unsigned long
+vector signed long
+vector double
+@end smallexample
+
+The long types are only implemented for 64-bit code generation, and
+the long type is only used in the floating point/integer conversion
+instructions.
+
GCC's implementation of the high-level language interface available from
C and C++ code differs from Motorola's documentation in several ways.
@@ -10067,6 +10132,8 @@ vector signed char vec_vavgsb (vector signed char, vector signed char);
vector unsigned char vec_vavgub (vector unsigned char,
vector unsigned char);
+vector float vec_copysign (vector float);
+
vector float vec_ceil (vector float);
vector signed int vec_cmpb (vector float, vector float);
@@ -11669,6 +11736,92 @@ int vec_any_numeric (vector float);
int vec_any_out (vector float, vector float);
@end smallexample
+If the vector/scalar (VSX) instruction set is available, the following
+additional functions are available:
+
+@smallexample
+vector double vec_abs (vector double);
+vector double vec_add (vector double, vector double);
+vector double vec_and (vector double, vector double);
+vector double vec_and (vector double, vector bool long);
+vector double vec_and (vector bool long, vector double);
+vector double vec_andc (vector double, vector double);
+vector double vec_andc (vector double, vector bool long);
+vector double vec_andc (vector bool long, vector double);
+vector double vec_ceil (vector double);
+vector bool long vec_cmpeq (vector double, vector double);
+vector bool long vec_cmpge (vector double, vector double);
+vector bool long vec_cmpgt (vector double, vector double);
+vector bool long vec_cmple (vector double, vector double);
+vector bool long vec_cmplt (vector double, vector double);
+vector float vec_div (vector float, vector float);
+vector double vec_div (vector double, vector double);
+vector double vec_floor (vector double);
+vector double vec_madd (vector double, vector double, vector double);
+vector double vec_max (vector double, vector double);
+vector double vec_min (vector double, vector double);
+vector float vec_msub (vector float, vector float, vector float);
+vector double vec_msub (vector double, vector double, vector double);
+vector float vec_mul (vector float, vector float);
+vector double vec_mul (vector double, vector double);
+vector float vec_nearbyint (vector float);
+vector double vec_nearbyint (vector double);
+vector float vec_nmadd (vector float, vector float, vector float);
+vector double vec_nmadd (vector double, vector double, vector double);
+vector double vec_nmsub (vector double, vector double, vector double);
+vector double vec_nor (vector double, vector double);
+vector double vec_or (vector double, vector double);
+vector double vec_or (vector double, vector bool long);
+vector double vec_or (vector bool long, vector double);
+vector double vec_perm (vector double,
+ vector double,
+ vector unsigned char);
+vector float vec_rint (vector float);
+vector double vec_rint (vector double);
+vector double vec_sel (vector double, vector double, vector bool long);
+vector double vec_sel (vector double, vector double, vector unsigned long);
+vector double vec_sub (vector double, vector double);
+vector float vec_sqrt (vector float);
+vector double vec_sqrt (vector double);
+vector double vec_trunc (vector double);
+vector double vec_xor (vector double, vector double);
+vector double vec_xor (vector double, vector bool long);
+vector double vec_xor (vector bool long, vector double);
+int vec_all_eq (vector double, vector double);
+int vec_all_ge (vector double, vector double);
+int vec_all_gt (vector double, vector double);
+int vec_all_le (vector double, vector double);
+int vec_all_lt (vector double, vector double);
+int vec_all_nan (vector double);
+int vec_all_ne (vector double, vector double);
+int vec_all_nge (vector double, vector double);
+int vec_all_ngt (vector double, vector double);
+int vec_all_nle (vector double, vector double);
+int vec_all_nlt (vector double, vector double);
+int vec_all_numeric (vector double);
+int vec_any_eq (vector double, vector double);
+int vec_any_ge (vector double, vector double);
+int vec_any_gt (vector double, vector double);
+int vec_any_le (vector double, vector double);
+int vec_any_lt (vector double, vector double);
+int vec_any_nan (vector double);
+int vec_any_ne (vector double, vector double);
+int vec_any_nge (vector double, vector double);
+int vec_any_ngt (vector double, vector double);
+int vec_any_nle (vector double, vector double);
+int vec_any_nlt (vector double, vector double);
+int vec_any_numeric (vector double);
+@end smallexample
+
+GCC provides a few other builtins on Powerpc to access certain instructions:
+@smallexample
+float __builtin_recipdivf (float, float);
+float __builtin_rsqrtf (float);
+double __builtin_recipdiv (double, double);
+long __builtin_bpermd (long, long);
+int __builtin_bswap16 (int);
+@end smallexample
+
@node SPARC VIS Built-in Functions
@subsection SPARC VIS Built-in Functions
@@ -12015,9 +12168,9 @@ adding a call to the @code{.init} section.
For compatibility with the Solaris and Tru64 UNIX system headers, GCC
supports two @code{#pragma} directives which change the name used in
-assembly for a given declaration. These pragmas are only available on
-platforms whose system headers need them. To get this effect on all
-platforms supported by GCC, use the asm labels extension (@pxref{Asm
+assembly for a given declaration. @code{#pragma_extern_prefix} is only
+available on platforms whose system headers need it. To get this effect
+on all platforms supported by GCC, use the asm labels extension (@pxref{Asm
Labels}).
@table @code
@@ -12026,8 +12179,7 @@ Labels}).
This pragma gives the C function @var{oldname} the assembly symbol
@var{newname}. The preprocessor macro @code{__PRAGMA_REDEFINE_EXTNAME}
-will be defined if this pragma is available (currently only on
-Solaris).
+will be defined if this pragma is available (currently on all platforms).
@item extern_prefix @var{string}
@cindex pragma, extern_prefix
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 0edee53f332..86ee460563e 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -1595,6 +1595,13 @@ option), if the linker supports it. If you specify
support @option{--build-id} option, a warning is issued and the
@option{--enable-linker-build-id} option is ignored. The default is off.
+@item --enable-gnu-unique-object
+@itemx --disable-gnu-unique-object
+Tells GCC to use the gnu_unique_object relocation for C++ template
+static data members and inline function local statics. Enabled by
+default for a native toolchain with an assembler that accepts it and
+GLIBC 2.11 or above, otherwise disabled.
+
@end table
@subheading Cross-Compiler-Specific Options
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8dbede77185..bc050428a23 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -347,7 +347,8 @@ Objective-C and Objective-C++ Dialects}.
-fira-region=@var{region} -fira-coalesce -fno-ira-share-save-slots @gol
-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
--floop-block -floop-interchange -floop-strip-mine @gol
+-floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
+-floop-parallelize-all @gol
-fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
-fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
-fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
@@ -536,7 +537,7 @@ Objective-C and Objective-C++ Dialects}.
-mmemory-latency=@var{time}}
@emph{DEC Alpha/VMS Options}
-@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix}}
+@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
@emph{FR30 Options}
@gccoptlist{-msmall-model -mno-lsim}
@@ -625,6 +626,9 @@ Objective-C and Objective-C++ Dialects}.
-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
+@emph{IA-64/VMS Options}
+@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
+
@emph{M32R/D Options}
@gccoptlist{-m32r2 -m32rx -m32r @gol
-mdebug @gol
@@ -740,7 +744,8 @@ See RS/6000 and PowerPC Options.
-maltivec -mno-altivec @gol
-mpowerpc-gpopt -mno-powerpc-gpopt @gol
-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
--mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol
+-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
+-mfprnd -mno-fprnd @gol
-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
-mnew-mnemonics -mold-mnemonics @gol
-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
@@ -754,7 +759,7 @@ See RS/6000 and PowerPC Options.
-mstrict-align -mno-strict-align -mrelocatable @gol
-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
--mdynamic-no-pic -maltivec -mswdiv @gol
+-mdynamic-no-pic -maltivec -mswdiv @gol
-mprioritize-restricted-insns=@var{priority} @gol
-msched-costly-dep=@var{dependence_type} @gol
-minsert-sched-nops=@var{scheme} @gol
@@ -6613,6 +6618,21 @@ code transformation, GCC has to be configured with @option{--with-ppl}
and @option{--with-cloog} to enable the Graphite loop transformation
infrastructure.
+@item -fgraphite-identity
+@opindex fgraphite-identity
+Enable the identity transformation for graphite. For every SCoP we generate
+the polyhedral representation and transform it back to gimple. Using
+@option{-fgraphite-identity} we can check the costs or benefits of the
+GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
+are also performed by the code generator CLooG, like index splitting and
+dead code elimination in loops.
+
+@item -floop-parallelize-all
+Use the Graphite data dependence analysis to identify loops that can
+be parallelized. Parallelize all the loops that can be analyzed to
+not contain loop carried dependences without checking that it is
+profitable to parallelize the loops.
+
@item -fcheck-data-deps
@opindex fcheck-data-deps
Compare the results of several data dependence analyzers. This option
@@ -9185,6 +9205,7 @@ platform.
* i386 and x86-64 Options::
* i386 and x86-64 Windows Options::
* IA-64 Options::
+* IA-64/VMS Options::
* M32C Options::
* M32R/D Options::
* M680x0 Options::
@@ -9347,11 +9368,6 @@ instructions, but still uses the soft-float calling conventions.
@samp{hard} allows generation of floating-point instructions
and uses FPU-specific calling conventions.
-Using @option{-mfloat-abi=hard} with VFP coprocessors is not supported.
-Use @option{-mfloat-abi=softfp} with the appropriate @option{-mfpu} option
-to allow the compiler to generate code that makes use of the hardware
-floating-point capabilities for these CPUs.
-
The default depends on the specific target configuration. Note that
the hard-float and soft-float ABIs are not link-compatible; you must
compile your entire program with the same ABI, and link with a
@@ -10631,6 +10647,10 @@ style condition (e.g.@: error) codes.
@opindex mdebug-main=@var{prefix}
Flag the first routine whose name starts with @var{prefix} as the main
routine for the debugger.
+
+@item -mmalloc64
+@opindex mmalloc64
+Default to 64bit memory allocation routines.
@end table
@node FR30 Options
@@ -12201,6 +12221,27 @@ when limit is reached but may still schedule memory operations.
@end table
+@node IA-64/VMS Options
+@subsection IA-64/VMS Options
+
+These @samp{-m} options are defined for the IA-64/VMS implementations:
+
+@table @gcctabopt
+@item -mvms-return-codes
+@opindex mvms-return-codes
+Return VMS condition codes from main. The default is to return POSIX
+style condition (e.g.@ error) codes.
+
+@item -mdebug-main=@var{prefix}
+@opindex mdebug-main=@var{prefix}
+Flag the first routine whose name starts with @var{prefix} as the main
+routine for the debugger.
+
+@item -mmalloc64
+@opindex mmalloc64
+Default to 64bit memory allocation routines.
+@end table
+
@node M32C Options
@subsection M32C Options
@cindex M32C options
@@ -13075,6 +13116,7 @@ The processor names are:
@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
+@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
@samp{loongson2e}, @samp{loongson2f},
@samp{m4k},
@samp{octeon},
@@ -14158,6 +14200,8 @@ These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
@itemx -mno-mfcrf
@itemx -mpopcntb
@itemx -mno-popcntb
+@itemx -mpopcntd
+@itemx -mno-popcntd
@itemx -mfprnd
@itemx -mno-fprnd
@itemx -mcmpb
@@ -14182,6 +14226,8 @@ These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
@opindex mno-mfcrf
@opindex mpopcntb
@opindex mno-popcntb
+@opindex mpopcntd
+@opindex mno-popcntd
@opindex mfprnd
@opindex mno-fprnd
@opindex mcmpb
@@ -14231,6 +14277,9 @@ The @option{-mpopcntb} option allows GCC to generate the popcount and
double precision FP reciprocal estimate instruction implemented on the
POWER5 processor and other processors that support the PowerPC V2.02
architecture.
+The @option{-mpopcntd} option allows GCC to generate the popcount
+instruction implemented on the POWER7 processor and other processors
+that support the PowerPC V2.06 architecture.
The @option{-mfprnd} option allows GCC to generate the FP round to
integer instructions implemented on the POWER5+ processor and other
processors that support the PowerPC V2.03 architecture.
@@ -14309,9 +14358,9 @@ The @option{-mcpu} options automatically enable or disable the
following options:
@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
--mnew-mnemonics -mpopcntb -mpower -mpower2 -mpowerpc64 @gol
+-mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 @gol
-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
--msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr}
+-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
The particular options set for any particular CPU will vary between
compiler versions, depending on what setting seems to produce optimal
@@ -14412,6 +14461,14 @@ instructions.
This option has been deprecated. Use @option{-mspe} and
@option{-mno-spe} instead.
+@item -mvsx
+@itemx -mno-vsx
+@opindex mvsx
+@opindex mno-vsx
+Generate code that uses (does not use) vector/scalar (VSX)
+instructions, and also enable the use of built-in functions that allow
+more direct access to the VSX instruction set.
+
@item -mfloat-gprs=@var{yes/single/double/no}
@itemx -mfloat-gprs
@opindex mfloat-gprs
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index d9dca7a87ce..0e516b09fc0 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -1916,7 +1916,19 @@ Floating point register (containing 64-bit value)
Floating point register (containing 32-bit value)
@item v
-Vector register
+Altivec vector register
+
+@item wd
+VSX vector register to hold vector double data
+
+@item wf
+VSX vector register to hold vector float data
+
+@item ws
+VSX vector register to hold scalar float data
+
+@item wa
+Any VSX register
@item h
@samp{MQ}, @samp{CTR}, or @samp{LINK} register
@@ -2029,6 +2041,9 @@ AND masks that can be performed by two rldic@{l, r@} instructions
@item W
Vector constant that does not require memory
+@item j
+Vector constant that is all zeros.
+
@end table
@item Intel 386---@file{config/i386/constraints.md}
diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index 53ad66bb7f6..2041de97353 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -84,7 +84,16 @@ configurations and yet the masks always need to be defined.
@node Option properties
@section Option properties
-The second field of an option record can specify the following properties:
+The second field of an option record can specify any of the following
+properties. When an option takes an argument, it is enlosed in parentheses
+following the option property name. The parser that handles option files
+is quite simplistic, and will be tricked by any nested parentheses within
+the argument text itself; in this case, the entire option argument can
+be wrapped in curly braces within the parentheses to demarcate it, e.g.:
+
+@smallexample
+Condition(@{defined (USE_CYGWIN_LIBSTDCXX_WRAPPERS)@})
+@end smallexample
@table @code
@item Common
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 8157714e1f6..df4973d8368 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -1039,27 +1039,24 @@ sign-extend the result to 64 bits. On such machines, set
Do not define this macro if it would never modify @var{m}.
@end defmac
-@defmac PROMOTE_FUNCTION_MODE
-Like @code{PROMOTE_MODE}, but is applied to outgoing function arguments or
-function return values, as specified by @code{TARGET_PROMOTE_FUNCTION_ARGS}
-and @code{TARGET_PROMOTE_FUNCTION_RETURN}, respectively.
-
-The default is @code{PROMOTE_MODE}.
-@end defmac
-
-@deftypefn {Target Hook} bool TARGET_PROMOTE_FUNCTION_ARGS (tree @var{fntype})
-This target hook should return @code{true} if the promotion described by
-@code{PROMOTE_FUNCTION_MODE} should be done for outgoing function
-arguments.
-@end deftypefn
-
-@deftypefn {Target Hook} bool TARGET_PROMOTE_FUNCTION_RETURN (tree @var{fntype})
-This target hook should return @code{true} if the promotion described by
-@code{PROMOTE_FUNCTION_MODE} should be done for the return value of
-functions.
-
-If this target hook returns @code{true}, @code{TARGET_FUNCTION_VALUE}
-must perform the same promotions done by @code{PROMOTE_FUNCTION_MODE}.
+@deftypefn {Target Hook} enum machine_mode TARGET_PROMOTE_FUNCTION_MODE (tree @var{type}, enum machine_mode @var{mode}, int *@var{punsignedp}, tree @var{funtype}, int @var{for_return})
+Like @code{PROMOTE_MODE}, but it is applied to outgoing function arguments or
+function return values. The target hook should return the new mode
+and possibly change @code{*@var{punsignedp}} if the promotion should
+change signedness. This function is called only for scalar @emph{or
+pointer} types.
+
+@var{for_return} allows to distinguish the promotion of arguments and
+return values. If it is @code{1}, a return value is being promoted and
+@code{TARGET_FUNCTION_VALUE} must perform the same promotions done here.
+If it is @code{2}, the returned mode should be that of the register in
+which an incoming parameter is copied, or the outgoing result is computed;
+then the hook should return the same mode as @code{promote_mode}, though
+the signedness may be different.
+
+The default is to not promote arguments and return values. You can
+also define the hook to @code{default_promote_function_mode_always_promote}
+if you would like to apply the same rules given by @code{PROMOTE_MODE}.
@end deftypefn
@defmac PARM_BOUNDARY
@@ -4394,6 +4391,18 @@ specially by the compiler and was not mentioned in the C code being
compiled.
@end defmac
+@deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode
+@var{mode}, rtx @var{fun})
+Define this hook if the back-end needs to know the name of the libcall
+function in order to determine where the result should be returned.
+
+The mode of the result is given by @var{mode} and the name of the called
+library function is given by @var{fun}. The hook should return an RTX
+representing the place where the library function result will be returned.
+
+If this hook is not defined, then LIBCALL_VALUE will be used.
+@end deftypefn
+
@defmac FUNCTION_VALUE_REGNO_P (@var{regno})
A C expression that is nonzero if @var{regno} is the number of a hard
register in which the values of called function may come back.
diff --git a/gcc/dse.c b/gcc/dse.c
index 1b5d8a21339..3e6b57d6ca1 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -1070,6 +1070,8 @@ canon_address (rtx mem,
{
rtx mem_address = XEXP (mem, 0);
rtx expanded_address, address;
+ int expanded;
+
/* Make sure that cselib is has initialized all of the operands of
the address before asking it to do the subst. */
@@ -1114,72 +1116,88 @@ canon_address (rtx mem,
fprintf (dump_file, "\n");
}
- /* Use cselib to replace all of the reg references with the full
- expression. This will take care of the case where we have
+ /* First see if just canon_rtx (mem_address) is const or frame,
+ if not, try cselib_expand_value_rtx and call canon_rtx on that. */
+ address = NULL_RTX;
+ for (expanded = 0; expanded < 2; expanded++)
+ {
+ if (expanded)
+ {
+ /* Use cselib to replace all of the reg references with the full
+ expression. This will take care of the case where we have
- r_x = base + offset;
- val = *r_x;
+ r_x = base + offset;
+ val = *r_x;
- by making it into
-
- val = *(base + offset);
- */
-
- expanded_address = cselib_expand_value_rtx (mem_address, scratch, 5);
+ by making it into
- /* If this fails, just go with the mem_address. */
- if (!expanded_address)
- expanded_address = mem_address;
+ val = *(base + offset); */
- /* Split the address into canonical BASE + OFFSET terms. */
- address = canon_rtx (expanded_address);
+ expanded_address = cselib_expand_value_rtx (mem_address,
+ scratch, 5);
- *offset = 0;
+ /* If this fails, just go with the address from first
+ iteration. */
+ if (!expanded_address)
+ break;
+ }
+ else
+ expanded_address = mem_address;
- if (dump_file)
- {
- fprintf (dump_file, "\n after cselib_expand address: ");
- print_inline_rtx (dump_file, expanded_address, 0);
- fprintf (dump_file, "\n");
+ /* Split the address into canonical BASE + OFFSET terms. */
+ address = canon_rtx (expanded_address);
- fprintf (dump_file, "\n after canon_rtx address: ");
- print_inline_rtx (dump_file, address, 0);
- fprintf (dump_file, "\n");
- }
+ *offset = 0;
- if (GET_CODE (address) == CONST)
- address = XEXP (address, 0);
+ if (dump_file)
+ {
+ if (expanded)
+ {
+ fprintf (dump_file, "\n after cselib_expand address: ");
+ print_inline_rtx (dump_file, expanded_address, 0);
+ fprintf (dump_file, "\n");
+ }
- if (GET_CODE (address) == PLUS && CONST_INT_P (XEXP (address, 1)))
- {
- *offset = INTVAL (XEXP (address, 1));
- address = XEXP (address, 0);
- }
+ fprintf (dump_file, "\n after canon_rtx address: ");
+ print_inline_rtx (dump_file, address, 0);
+ fprintf (dump_file, "\n");
+ }
- if (const_or_frame_p (address))
- {
- group_info_t group = get_group_info (address);
+ if (GET_CODE (address) == CONST)
+ address = XEXP (address, 0);
- if (dump_file)
- fprintf (dump_file, " gid=%d offset=%d \n", group->id, (int)*offset);
- *base = NULL;
- *group_id = group->id;
- }
- else
- {
- *base = cselib_lookup (address, Pmode, true);
- *group_id = -1;
+ if (GET_CODE (address) == PLUS
+ && CONST_INT_P (XEXP (address, 1)))
+ {
+ *offset = INTVAL (XEXP (address, 1));
+ address = XEXP (address, 0);
+ }
- if (*base == NULL)
+ if (const_or_frame_p (address))
{
+ group_info_t group = get_group_info (address);
+
if (dump_file)
- fprintf (dump_file, " no cselib val - should be a wild read.\n");
- return false;
+ fprintf (dump_file, " gid=%d offset=%d \n",
+ group->id, (int)*offset);
+ *base = NULL;
+ *group_id = group->id;
+ return true;
}
+ }
+
+ *base = cselib_lookup (address, Pmode, true);
+ *group_id = -1;
+
+ if (*base == NULL)
+ {
if (dump_file)
- fprintf (dump_file, " varying cselib base=%d offset = %d\n",
- (*base)->value, (int)*offset);
+ fprintf (dump_file, " no cselib val - should be a wild read.\n");
+ return false;
}
+ if (dump_file)
+ fprintf (dump_file, " varying cselib base=%d offset = %d\n",
+ (*base)->value, (int)*offset);
return true;
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 24fca3c1a58..1f7c8c42453 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3433,15 +3433,22 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
begin = fde->dw_fde_begin;
end = fde->dw_fde_end;
}
- else if (second ^ fde->dw_fde_switched_cold_to_hot)
- {
- begin = fde->dw_fde_unlikely_section_label;
- end = fde->dw_fde_unlikely_section_end_label;
- }
else
{
- begin = fde->dw_fde_hot_section_label;
- end = fde->dw_fde_hot_section_end_label;
+ /* For the first section, prefer dw_fde_begin over
+ dw_fde_{hot,cold}_section_label, as the latter
+ might be separated from the real start of the
+ function by alignment padding. */
+ if (!second)
+ begin = fde->dw_fde_begin;
+ else if (fde->dw_fde_switched_cold_to_hot)
+ begin = fde->dw_fde_hot_section_label;
+ else
+ begin = fde->dw_fde_unlikely_section_label;
+ if (second ^ fde->dw_fde_switched_cold_to_hot)
+ end = fde->dw_fde_unlikely_section_end_label;
+ else
+ end = fde->dw_fde_hot_section_end_label;
}
if (for_eh)
@@ -3481,7 +3488,8 @@ output_fde (dw_fde_ref fde, bool for_eh, bool second,
if (fde->uses_eh_lsda)
{
- ASM_GENERATE_INTERNAL_LABEL (l1, "LLSDA", fde->funcdef_number);
+ ASM_GENERATE_INTERNAL_LABEL (l1, second ? "LLSDAC" : "LLSDA",
+ fde->funcdef_number);
dw2_asm_output_encoded_addr_rtx (lsda_encoding,
gen_rtx_SYMBOL_REF (Pmode, l1),
false,
@@ -3785,7 +3793,7 @@ output_call_frame_info (int for_eh)
/* Emit .cfi_startproc and .cfi_personality/.cfi_lsda if needed. */
static void
-dwarf2out_do_cfi_startproc (void)
+dwarf2out_do_cfi_startproc (bool second)
{
int enc;
rtx ref;
@@ -3814,7 +3822,7 @@ dwarf2out_do_cfi_startproc (void)
char lab[20];
enc = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/0);
- ASM_GENERATE_INTERNAL_LABEL (lab, "LLSDA",
+ ASM_GENERATE_INTERNAL_LABEL (lab, second ? "LLSDAC" : "LLSDA",
current_function_funcdef_no);
ref = gen_rtx_SYMBOL_REF (Pmode, lab);
SYMBOL_REF_FLAGS (ref) = SYMBOL_FLAG_LOCAL;
@@ -3933,7 +3941,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
#endif
if (dwarf2out_do_cfi_asm ())
- dwarf2out_do_cfi_startproc ();
+ dwarf2out_do_cfi_startproc (false);
}
/* Output a marker (i.e. a label) for the absolute end of the generated code
@@ -4042,7 +4050,7 @@ dwarf2out_switch_text_section (void)
if (dwarf2out_do_cfi_asm ())
{
- dwarf2out_do_cfi_startproc ();
+ dwarf2out_do_cfi_startproc (true);
/* As this is a different FDE, insert all current CFI instructions
again. */
output_cfis (fde->dw_fde_cfi, true, fde, true);
@@ -15679,7 +15687,13 @@ gen_lexical_block_die (tree stmt, dw_die_ref context_die, int depth)
static void
gen_inlined_subroutine_die (tree stmt, dw_die_ref context_die, int depth)
{
- tree decl = block_ultimate_origin (stmt);
+ tree decl;
+
+ /* The instance of function that is effectively being inlined shall not
+ be abstract. */
+ gcc_assert (! BLOCK_ABSTRACT (stmt));
+
+ decl = block_ultimate_origin (stmt);
/* Emit info for the abstract instance first, if we haven't yet. We
must emit this even if the block is abstract, otherwise when we
@@ -15700,20 +15714,6 @@ gen_inlined_subroutine_die (tree stmt, dw_die_ref context_die, int depth)
decls_for_scope (stmt, subr_die, depth);
current_function_has_inlines = 1;
}
- else
- /* We may get here if we're the outer block of function A that was
- inlined into function B that was inlined into function C. When
- generating debugging info for C, dwarf2out_abstract_function(B)
- would mark all inlined blocks as abstract, including this one.
- So, we wouldn't (and shouldn't) expect labels to be generated
- for this one. Instead, just emit debugging info for
- declarations within the block. This is particularly important
- in the case of initializers of arguments passed from B to us:
- if they're statement expressions containing declarations, we
- wouldn't generate dies for their abstract variables, and then,
- when generating dies for the real variables, we'd die (pun
- intended :-) */
- gen_lexical_block_die (stmt, context_die, depth);
}
/* Generate a DIE for a field in a record, or structure. */
@@ -16342,7 +16342,23 @@ gen_block_die (tree stmt, dw_die_ref context_die, int depth)
if (must_output_die)
{
if (inlined_func)
- gen_inlined_subroutine_die (stmt, context_die, depth);
+ {
+ /* If STMT block is abstract, that means we have been called
+ indirectly from dwarf2out_abstract_function.
+ That function rightfully marks the descendent blocks (of
+ the abstract function it is dealing with) as being abstract,
+ precisely to prevent us from emitting any
+ DW_TAG_inlined_subroutine DIE as a descendent
+ of an abstract function instance. So in that case, we should
+ not call gen_inlined_subroutine_die.
+
+ Later though, when cgraph asks dwarf2out to emit info
+ for the concrete instance of the function decl into which
+ the concrete instance of STMT got inlined, the later will lead
+ to the generation of a DW_TAG_inlined_subroutine DIE. */
+ if (! BLOCK_ABSTRACT (stmt))
+ gen_inlined_subroutine_die (stmt, context_die, depth);
+ }
else
gen_lexical_block_die (stmt, context_die, depth);
}
diff --git a/gcc/except.c b/gcc/except.c
index 06e5529dddc..9fa60ffbe4e 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -169,15 +169,15 @@ static int action_record_eq (const void *, const void *);
static hashval_t action_record_hash (const void *);
static int add_action_record (htab_t, int, int);
static int collect_one_action_chain (htab_t, struct eh_region_d *);
-static int add_call_site (rtx, int);
+static int add_call_site (rtx, int, int);
static void push_uleb128 (varray_type *, unsigned int);
static void push_sleb128 (varray_type *, int);
#ifndef HAVE_AS_LEB128
-static int dw2_size_of_call_site_table (void);
+static int dw2_size_of_call_site_table (int);
static int sjlj_size_of_call_site_table (void);
#endif
-static void dw2_output_call_site_table (void);
+static void dw2_output_call_site_table (int, int);
static void sjlj_output_call_site_table (void);
@@ -2337,7 +2337,8 @@ sjlj_assign_call_site_values (rtx dispatch_label, struct sjlj_lp_info *lp_info)
index = -1;
/* Otherwise, look it up in the table. */
else
- index = add_call_site (GEN_INT (lp_info[i].dispatch_index), action);
+ index = add_call_site (GEN_INT (lp_info[i].dispatch_index),
+ action, 0);
lp_info[i].call_site_index = index;
}
@@ -3784,7 +3785,7 @@ collect_one_action_chain (htab_t ar_hash, struct eh_region_d *region)
}
static int
-add_call_site (rtx landing_pad, int action)
+add_call_site (rtx landing_pad, int action, int section)
{
call_site_record record;
@@ -3792,9 +3793,11 @@ add_call_site (rtx landing_pad, int action)
record->landing_pad = landing_pad;
record->action = action;
- VEC_safe_push (call_site_record, gc, crtl->eh.call_site_record, record);
+ VEC_safe_push (call_site_record, gc,
+ crtl->eh.call_site_record[section], record);
- return call_site_base + VEC_length (call_site_record, crtl->eh.call_site_record) - 1;
+ return call_site_base + VEC_length (call_site_record,
+ crtl->eh.call_site_record[section]) - 1;
}
/* Turn REG_EH_REGION notes back into NOTE_INSN_EH_REGION notes.
@@ -3811,6 +3814,14 @@ convert_to_eh_region_ranges (void)
rtx last_landing_pad = NULL_RTX;
rtx first_no_action_insn = NULL_RTX;
int call_site = 0;
+ int cur_sec = 0;
+ rtx section_switch_note = NULL_RTX;
+ rtx first_no_action_insn_before_switch = NULL_RTX;
+ rtx last_no_action_insn_before_switch = NULL_RTX;
+ rtx *pad_map = NULL;
+ sbitmap pad_loc = NULL;
+ int min_labelno = 0, max_labelno = 0;
+ int saved_call_site_base = call_site_base;
if (USING_SJLJ_EXCEPTIONS || cfun->eh->region_tree == NULL)
return 0;
@@ -3885,9 +3896,27 @@ convert_to_eh_region_ranges (void)
if (last_action >= -1)
{
/* If we delayed the creation of the begin, do it now. */
+ if (first_no_action_insn_before_switch)
+ {
+ call_site = add_call_site (NULL_RTX, 0, 0);
+ note
+ = emit_note_before (NOTE_INSN_EH_REGION_BEG,
+ first_no_action_insn_before_switch);
+ NOTE_EH_HANDLER (note) = call_site;
+ if (first_no_action_insn)
+ {
+ note
+ = emit_note_after (NOTE_INSN_EH_REGION_END,
+ last_no_action_insn_before_switch);
+ NOTE_EH_HANDLER (note) = call_site;
+ }
+ else
+ gcc_assert (last_action_insn
+ == last_no_action_insn_before_switch);
+ }
if (first_no_action_insn)
{
- call_site = add_call_site (NULL_RTX, 0);
+ call_site = add_call_site (NULL_RTX, 0, cur_sec);
note = emit_note_before (NOTE_INSN_EH_REGION_BEG,
first_no_action_insn);
NOTE_EH_HANDLER (note) = call_site;
@@ -3904,7 +3933,8 @@ convert_to_eh_region_ranges (void)
if (this_action >= -1)
{
call_site = add_call_site (this_landing_pad,
- this_action < 0 ? 0 : this_action);
+ this_action < 0 ? 0 : this_action,
+ cur_sec);
note = emit_note_before (NOTE_INSN_EH_REGION_BEG, iter);
NOTE_EH_HANDLER (note) = call_site;
}
@@ -3914,6 +3944,37 @@ convert_to_eh_region_ranges (void)
}
last_action_insn = iter;
}
+ else if (NOTE_P (iter)
+ && NOTE_KIND (iter) == NOTE_INSN_SWITCH_TEXT_SECTIONS)
+ {
+ gcc_assert (section_switch_note == NULL_RTX);
+ gcc_assert (flag_reorder_blocks_and_partition);
+ section_switch_note = iter;
+ if (first_no_action_insn)
+ {
+ first_no_action_insn_before_switch = first_no_action_insn;
+ last_no_action_insn_before_switch = last_action_insn;
+ first_no_action_insn = NULL_RTX;
+ gcc_assert (last_action == -1);
+ last_action = -3;
+ }
+ /* Force closing of current EH region before section switch and
+ opening a new one afterwards. */
+ else if (last_action != -3)
+ last_landing_pad = pc_rtx;
+ call_site_base += VEC_length (call_site_record,
+ crtl->eh.call_site_record[cur_sec]);
+ cur_sec++;
+ gcc_assert (crtl->eh.call_site_record[cur_sec] == NULL);
+ crtl->eh.call_site_record[cur_sec]
+ = VEC_alloc (call_site_record, gc, 10);
+ max_labelno = max_label_num ();
+ min_labelno = get_first_label_num ();
+ pad_map = XCNEWVEC (rtx, max_labelno - min_labelno + 1);
+ pad_loc = sbitmap_alloc (max_labelno - min_labelno + 1);
+ }
+ else if (LABEL_P (iter) && pad_map)
+ SET_BIT (pad_loc, CODE_LABEL_NUMBER (iter) - min_labelno);
if (last_action >= -1 && ! first_no_action_insn)
{
@@ -3921,6 +3982,105 @@ convert_to_eh_region_ranges (void)
NOTE_EH_HANDLER (note) = call_site;
}
+ call_site_base = saved_call_site_base;
+
+ if (pad_map)
+ {
+ /* When doing hot/cold partitioning, ensure landing pads are
+ always in the same section as the EH region, .gcc_except_table
+ can't express it otherwise. */
+ for (cur_sec = 0; cur_sec < 2; cur_sec++)
+ {
+ int i, idx;
+ int n = VEC_length (call_site_record,
+ crtl->eh.call_site_record[cur_sec]);
+ basic_block prev_bb = NULL, padbb;
+
+ for (i = 0; i < n; ++i)
+ {
+ struct call_site_record_d *cs =
+ VEC_index (call_site_record,
+ crtl->eh.call_site_record[cur_sec], i);
+ rtx jump, note;
+
+ if (cs->landing_pad == NULL_RTX)
+ continue;
+ idx = CODE_LABEL_NUMBER (cs->landing_pad) - min_labelno;
+ /* If the landing pad is in the correct section, nothing
+ is needed. */
+ if (TEST_BIT (pad_loc, idx) ^ (cur_sec == 0))
+ continue;
+ /* Otherwise, if we haven't seen this pad yet, we need to
+ add a new label and jump to the correct section. */
+ if (pad_map[idx] == NULL_RTX)
+ {
+ pad_map[idx] = gen_label_rtx ();
+ if (prev_bb == NULL)
+ for (iter = section_switch_note;
+ iter; iter = PREV_INSN (iter))
+ if (NOTE_INSN_BASIC_BLOCK_P (iter))
+ {
+ prev_bb = NOTE_BASIC_BLOCK (iter);
+ break;
+ }
+ if (cur_sec == 0)
+ {
+ note = emit_label_before (pad_map[idx],
+ section_switch_note);
+ jump = emit_jump_insn_before (gen_jump (cs->landing_pad),
+ section_switch_note);
+ }
+ else
+ {
+ jump = emit_jump_insn_after (gen_jump (cs->landing_pad),
+ section_switch_note);
+ note = emit_label_after (pad_map[idx],
+ section_switch_note);
+ }
+ JUMP_LABEL (jump) = cs->landing_pad;
+ add_reg_note (jump, REG_CROSSING_JUMP, NULL_RTX);
+ iter = NEXT_INSN (cs->landing_pad);
+ if (iter && NOTE_INSN_BASIC_BLOCK_P (iter))
+ padbb = NOTE_BASIC_BLOCK (iter);
+ else
+ padbb = NULL;
+ if (padbb && prev_bb
+ && BB_PARTITION (padbb) != BB_UNPARTITIONED)
+ {
+ basic_block bb;
+ int part
+ = BB_PARTITION (padbb) == BB_COLD_PARTITION
+ ? BB_HOT_PARTITION : BB_COLD_PARTITION;
+ edge_iterator ei;
+ edge e;
+
+ bb = create_basic_block (note, jump, prev_bb);
+ make_single_succ_edge (bb, padbb, EDGE_CROSSING);
+ BB_SET_PARTITION (bb, part);
+ for (ei = ei_start (padbb->preds);
+ (e = ei_safe_edge (ei)); )
+ {
+ if ((e->flags & (EDGE_EH|EDGE_CROSSING))
+ == (EDGE_EH|EDGE_CROSSING))
+ {
+ redirect_edge_succ (e, bb);
+ e->flags &= ~EDGE_CROSSING;
+ }
+ else
+ ei_next (&ei);
+ }
+ if (cur_sec == 0)
+ prev_bb = bb;
+ }
+ }
+ cs->landing_pad = pad_map[idx];
+ }
+ }
+
+ sbitmap_free (pad_loc);
+ XDELETEVEC (pad_map);
+ }
+
htab_delete (ar_hash);
return 0;
}
@@ -3981,16 +4141,16 @@ push_sleb128 (varray_type *data_area, int value)
#ifndef HAVE_AS_LEB128
static int
-dw2_size_of_call_site_table (void)
+dw2_size_of_call_site_table (int section)
{
- int n = VEC_length (call_site_record, crtl->eh.call_site_record);
+ int n = VEC_length (call_site_record, crtl->eh.call_site_record[section]);
int size = n * (4 + 4 + 4);
int i;
for (i = 0; i < n; ++i)
{
struct call_site_record_d *cs =
- VEC_index (call_site_record, crtl->eh.call_site_record, i);
+ VEC_index (call_site_record, crtl->eh.call_site_record[section], i);
size += size_of_uleb128 (cs->action);
}
@@ -4000,14 +4160,14 @@ dw2_size_of_call_site_table (void)
static int
sjlj_size_of_call_site_table (void)
{
- int n = VEC_length (call_site_record, crtl->eh.call_site_record);
+ int n = VEC_length (call_site_record, crtl->eh.call_site_record[0]);
int size = 0;
int i;
for (i = 0; i < n; ++i)
{
struct call_site_record_d *cs =
- VEC_index (call_site_record, crtl->eh.call_site_record, i);
+ VEC_index (call_site_record, crtl->eh.call_site_record[0], i);
size += size_of_uleb128 (INTVAL (cs->landing_pad));
size += size_of_uleb128 (cs->action);
}
@@ -4017,15 +4177,23 @@ sjlj_size_of_call_site_table (void)
#endif
static void
-dw2_output_call_site_table (void)
+dw2_output_call_site_table (int cs_format, int section)
{
- int n = VEC_length (call_site_record, crtl->eh.call_site_record);
+ int n = VEC_length (call_site_record, crtl->eh.call_site_record[section]);
int i;
+ const char *begin;
+
+ if (section == 0)
+ begin = current_function_func_begin_label;
+ else if (first_function_block_is_cold)
+ begin = crtl->subsections.hot_section_label;
+ else
+ begin = crtl->subsections.cold_section_label;
for (i = 0; i < n; ++i)
{
struct call_site_record_d *cs =
- VEC_index (call_site_record, crtl->eh.call_site_record, i);
+ VEC_index (call_site_record, crtl->eh.call_site_record[section], i);
char reg_start_lab[32];
char reg_end_lab[32];
char landing_pad_lab[32];
@@ -4041,30 +4209,29 @@ dw2_output_call_site_table (void)
generic arithmetic. */
/* ??? Perhaps use attr_length to choose data1 or data2 instead of
data4 if the function is small enough. */
-#ifdef HAVE_AS_LEB128
- dw2_asm_output_delta_uleb128 (reg_start_lab,
- current_function_func_begin_label,
- "region %d start", i);
- dw2_asm_output_delta_uleb128 (reg_end_lab, reg_start_lab,
- "length");
- if (cs->landing_pad)
- dw2_asm_output_delta_uleb128 (landing_pad_lab,
- current_function_func_begin_label,
- "landing pad");
- else
- dw2_asm_output_data_uleb128 (0, "landing pad");
-#else
- dw2_asm_output_delta (4, reg_start_lab,
- current_function_func_begin_label,
- "region %d start", i);
- dw2_asm_output_delta (4, reg_end_lab, reg_start_lab, "length");
- if (cs->landing_pad)
- dw2_asm_output_delta (4, landing_pad_lab,
- current_function_func_begin_label,
- "landing pad");
+ if (cs_format == DW_EH_PE_uleb128)
+ {
+ dw2_asm_output_delta_uleb128 (reg_start_lab, begin,
+ "region %d start", i);
+ dw2_asm_output_delta_uleb128 (reg_end_lab, reg_start_lab,
+ "length");
+ if (cs->landing_pad)
+ dw2_asm_output_delta_uleb128 (landing_pad_lab, begin,
+ "landing pad");
+ else
+ dw2_asm_output_data_uleb128 (0, "landing pad");
+ }
else
- dw2_asm_output_data (4, 0, "landing pad");
-#endif
+ {
+ dw2_asm_output_delta (4, reg_start_lab, begin,
+ "region %d start", i);
+ dw2_asm_output_delta (4, reg_end_lab, reg_start_lab, "length");
+ if (cs->landing_pad)
+ dw2_asm_output_delta (4, landing_pad_lab, begin,
+ "landing pad");
+ else
+ dw2_asm_output_data (4, 0, "landing pad");
+ }
dw2_asm_output_data_uleb128 (cs->action, "action");
}
@@ -4074,13 +4241,13 @@ dw2_output_call_site_table (void)
static void
sjlj_output_call_site_table (void)
{
- int n = VEC_length (call_site_record, crtl->eh.call_site_record);
+ int n = VEC_length (call_site_record, crtl->eh.call_site_record[0]);
int i;
for (i = 0; i < n; ++i)
{
struct call_site_record_d *cs =
- VEC_index (call_site_record, crtl->eh.call_site_record, i);
+ VEC_index (call_site_record, crtl->eh.call_site_record[0], i);
dw2_asm_output_data_uleb128 (INTVAL (cs->landing_pad),
"region %d landing pad", i);
@@ -4192,8 +4359,9 @@ output_ttype (tree type, int tt_format, int tt_format_size)
dw2_asm_output_encoded_addr_rtx (tt_format, value, is_public, NULL);
}
-void
-output_function_exception_table (const char * ARG_UNUSED (fnname))
+static void
+output_one_function_exception_table (const char * ARG_UNUSED (fnname),
+ int section)
{
int tt_format, cs_format, lp_format, i, n;
#ifdef HAVE_AS_LEB128
@@ -4206,13 +4374,6 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
int have_tt_data;
int tt_format_size = 0;
- /* Not all functions need anything. */
- if (! crtl->uses_eh_lsda)
- return;
-
- if (eh_personality_libfunc)
- assemble_external_libcall (eh_personality_libfunc);
-
#ifdef TARGET_UNWIND_INFO
/* TODO: Move this into target file. */
fputs ("\t.personality\t", asm_out_file);
@@ -4237,7 +4398,8 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
{
tt_format = ASM_PREFERRED_EH_DATA_FORMAT (/*code=*/0, /*global=*/1);
#ifdef HAVE_AS_LEB128
- ASM_GENERATE_INTERNAL_LABEL (ttype_label, "LLSDATT",
+ ASM_GENERATE_INTERNAL_LABEL (ttype_label,
+ section ? "LLSDATTC" : "LLSDATT",
current_function_funcdef_no);
#endif
tt_format_size = size_of_encoded_value (tt_format);
@@ -4245,8 +4407,8 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
assemble_align (tt_format_size * BITS_PER_UNIT);
}
- targetm.asm_out.internal_label (asm_out_file, "LLSDA",
- current_function_funcdef_no);
+ targetm.asm_out.internal_label (asm_out_file, section ? "LLSDAC" : "LLSDA",
+ current_function_funcdef_no);
/* The LSDA header. */
@@ -4269,7 +4431,7 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
if (USING_SJLJ_EXCEPTIONS)
call_site_len = sjlj_size_of_call_site_table ();
else
- call_site_len = dw2_size_of_call_site_table ();
+ call_site_len = dw2_size_of_call_site_table (section);
#endif
/* A pc-relative 4-byte displacement to the @TType data. */
@@ -4277,7 +4439,8 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
{
#ifdef HAVE_AS_LEB128
char ttype_after_disp_label[32];
- ASM_GENERATE_INTERNAL_LABEL (ttype_after_disp_label, "LLSDATTD",
+ ASM_GENERATE_INTERNAL_LABEL (ttype_after_disp_label,
+ section ? "LLSDATTDC" : "LLSDATTD",
current_function_funcdef_no);
dw2_asm_output_delta_uleb128 (ttype_label, ttype_after_disp_label,
"@TType base offset");
@@ -4323,9 +4486,11 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
eh_data_format_name (cs_format));
#ifdef HAVE_AS_LEB128
- ASM_GENERATE_INTERNAL_LABEL (cs_after_size_label, "LLSDACSB",
+ ASM_GENERATE_INTERNAL_LABEL (cs_after_size_label,
+ section ? "LLSDACSBC" : "LLSDACSB",
current_function_funcdef_no);
- ASM_GENERATE_INTERNAL_LABEL (cs_end_label, "LLSDACSE",
+ ASM_GENERATE_INTERNAL_LABEL (cs_end_label,
+ section ? "LLSDACSEC" : "LLSDACSE",
current_function_funcdef_no);
dw2_asm_output_delta_uleb128 (cs_end_label, cs_after_size_label,
"Call-site table length");
@@ -4333,14 +4498,14 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
if (USING_SJLJ_EXCEPTIONS)
sjlj_output_call_site_table ();
else
- dw2_output_call_site_table ();
+ dw2_output_call_site_table (cs_format, section);
ASM_OUTPUT_LABEL (asm_out_file, cs_end_label);
#else
- dw2_asm_output_data_uleb128 (call_site_len,"Call-site table length");
+ dw2_asm_output_data_uleb128 (call_site_len, "Call-site table length");
if (USING_SJLJ_EXCEPTIONS)
sjlj_output_call_site_table ();
else
- dw2_output_call_site_table ();
+ dw2_output_call_site_table (cs_format, section);
#endif
/* ??? Decode and interpret the data for flag_debug_asm. */
@@ -4377,6 +4542,21 @@ output_function_exception_table (const char * ARG_UNUSED (fnname))
dw2_asm_output_data (1, VARRAY_UCHAR (crtl->eh.ehspec_data, i),
(i ? NULL : "Exception specification table"));
}
+}
+
+void
+output_function_exception_table (const char * ARG_UNUSED (fnname))
+{
+ /* Not all functions need anything. */
+ if (! crtl->uses_eh_lsda)
+ return;
+
+ if (eh_personality_libfunc)
+ assemble_external_libcall (eh_personality_libfunc);
+
+ output_one_function_exception_table (fnname, 0);
+ if (crtl->eh.call_site_record[1] != NULL)
+ output_one_function_exception_table (fnname, 1);
switch_to_section (current_function_section ());
}
diff --git a/gcc/explow.c b/gcc/explow.c
index 198df220fbd..933eac81bb1 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -749,63 +749,94 @@ copy_to_suggested_reg (rtx x, rtx target, enum machine_mode mode)
return temp;
}
-/* Return the mode to use to store a scalar of TYPE and MODE.
+/* Return the mode to use to pass or return a scalar of TYPE and MODE.
PUNSIGNEDP points to the signedness of the type and may be adjusted
to show what signedness to use on extension operations.
- FOR_CALL is nonzero if this call is promoting args for a call. */
+ FOR_RETURN is nonzero if the caller is promoting the return value
+ of FNDECL, else it is for promoting args. */
-#if defined(PROMOTE_MODE) && !defined(PROMOTE_FUNCTION_MODE)
-#define PROMOTE_FUNCTION_MODE PROMOTE_MODE
-#endif
+enum machine_mode
+promote_function_mode (const_tree type, enum machine_mode mode, int *punsignedp,
+ const_tree funtype, int for_return)
+{
+ switch (TREE_CODE (type))
+ {
+ case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
+ case REAL_TYPE: case OFFSET_TYPE: case FIXED_POINT_TYPE:
+ case POINTER_TYPE: case REFERENCE_TYPE:
+ return targetm.calls.promote_function_mode (type, mode, punsignedp, funtype,
+ for_return);
+
+ default:
+ return mode;
+ }
+}
+/* Return the mode to use to store a scalar of TYPE and MODE.
+ PUNSIGNEDP points to the signedness of the type and may be adjusted
+ to show what signedness to use on extension operations. */
enum machine_mode
-promote_mode (const_tree type, enum machine_mode mode, int *punsignedp,
- int for_call ATTRIBUTE_UNUSED)
+promote_mode (const_tree type ATTRIBUTE_UNUSED, enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED)
{
+ /* FIXME: this is the same logic that was there until GCC 4.4, but we
+ probably want to test POINTERS_EXTEND_UNSIGNED even if PROMOTE_MODE
+ is not defined. The affected targets are M32C, S390, SPARC. */
+#ifdef PROMOTE_MODE
const enum tree_code code = TREE_CODE (type);
int unsignedp = *punsignedp;
-#ifndef PROMOTE_MODE
- if (! for_call)
- return mode;
-#endif
-
switch (code)
{
-#ifdef PROMOTE_FUNCTION_MODE
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case REAL_TYPE: case OFFSET_TYPE: case FIXED_POINT_TYPE:
-#ifdef PROMOTE_MODE
- if (for_call)
- {
-#endif
- PROMOTE_FUNCTION_MODE (mode, unsignedp, type);
-#ifdef PROMOTE_MODE
- }
- else
- {
- PROMOTE_MODE (mode, unsignedp, type);
- }
-#endif
+ PROMOTE_MODE (mode, unsignedp, type);
+ *punsignedp = unsignedp;
+ return mode;
break;
-#endif
#ifdef POINTERS_EXTEND_UNSIGNED
case REFERENCE_TYPE:
case POINTER_TYPE:
- mode = Pmode;
- unsignedp = POINTERS_EXTEND_UNSIGNED;
+ *punsignedp = POINTERS_EXTEND_UNSIGNED;
+ return Pmode;
break;
#endif
default:
- break;
+ return mode;
}
-
- *punsignedp = unsignedp;
+#else
return mode;
+#endif
}
+
+
+/* Use one of promote_mode or promote_function_mode to find the promoted
+ mode of DECL. If PUNSIGNEDP is not NULL, store there the unsignedness
+ of DECL after promotion. */
+
+enum machine_mode
+promote_decl_mode (const_tree decl, int *punsignedp)
+{
+ tree type = TREE_TYPE (decl);
+ int unsignedp = TYPE_UNSIGNED (type);
+ enum machine_mode mode = DECL_MODE (decl);
+ enum machine_mode pmode;
+
+ if (TREE_CODE (decl) == RESULT_DECL
+ || TREE_CODE (decl) == PARM_DECL)
+ pmode = promote_function_mode (type, mode, &unsignedp,
+ TREE_TYPE (current_function_decl), 2);
+ else
+ pmode = promote_mode (type, mode, &unsignedp);
+
+ if (punsignedp)
+ *punsignedp = unsignedp;
+ return pmode;
+}
+
/* Adjust the stack pointer by ADJUST (an rtx for a number of bytes).
This pops when ADJUST is positive. ADJUST need not be constant. */
@@ -1496,9 +1527,9 @@ hard_function_value (const_tree valtype, const_tree func, const_tree fntype,
in which a scalar value of mode MODE was returned by a library call. */
rtx
-hard_libcall_value (enum machine_mode mode)
+hard_libcall_value (enum machine_mode mode, rtx fun)
{
- return LIBCALL_VALUE (mode);
+ return targetm.calls.libcall_value (mode, fun);
}
/* Look up the tree code for a given rtx code
diff --git a/gcc/expr.c b/gcc/expr.c
index 0336c055d49..07c6683bdca 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5435,13 +5435,11 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
enum machine_mode mode;
HOST_WIDE_INT bitsize;
HOST_WIDE_INT bitpos;
- int unsignedp;
rtx xtarget = target;
if (cleared && initializer_zerop (value))
continue;
- unsignedp = TYPE_UNSIGNED (elttype);
mode = TYPE_MODE (elttype);
if (mode == BLKmode)
bitsize = (host_integerp (TYPE_SIZE (elttype), 1)
@@ -5497,14 +5495,10 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size)
tree exit_cond;
expand_normal (hi_index);
- unsignedp = TYPE_UNSIGNED (domain);
index = build_decl (EXPR_LOCATION (exp),
VAR_DECL, NULL_TREE, domain);
-
- index_r
- = gen_reg_rtx (promote_mode (domain, DECL_MODE (index),
- &unsignedp, 0));
+ index_r = gen_reg_rtx (promote_decl_mode (index, NULL));
SET_DECL_RTL (index, index_r);
store_expr (lo_index, index_r, 0, false);
@@ -7430,9 +7424,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* Get the signedness used for this variable. Ensure we get the
same mode we got when the variable was declared. */
- pmode = promote_mode (type, DECL_MODE (exp), &unsignedp,
- (TREE_CODE (exp) == RESULT_DECL
- || TREE_CODE (exp) == PARM_DECL) ? 1 : 0);
+ pmode = promote_decl_mode (exp, &unsignedp);
gcc_assert (GET_MODE (decl_rtl) == pmode);
temp = gen_lowpart_SUBREG (mode, decl_rtl);
diff --git a/gcc/expr.h b/gcc/expr.h
index caf965e9412..7058354a866 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -719,8 +719,17 @@ extern rtx force_reg (enum machine_mode, rtx);
/* Return given rtx, copied into a new temp reg if it was in memory. */
extern rtx force_not_mem (rtx);
+/* Return mode and signedness to use when an argument or result in the
+ given mode is promoted. */
+extern enum machine_mode promote_function_mode (const_tree, enum machine_mode, int *,
+ const_tree, int);
+
+/* Return mode and signedness to use when an object in the given mode
+ is promoted. */
+extern enum machine_mode promote_mode (const_tree, enum machine_mode, int *);
+
/* Return mode and signedness to use when object is promoted. */
-extern enum machine_mode promote_mode (const_tree, enum machine_mode, int *, int);
+enum machine_mode promote_decl_mode (const_tree, int *);
/* Remove some bytes from the stack. An rtx says how many. */
extern void adjust_stack (rtx);
@@ -753,7 +762,7 @@ extern void probe_stack_range (HOST_WIDE_INT, rtx);
/* Return an rtx that refers to the value returned by a library call
in its original home. This becomes invalid if any more code is emitted. */
-extern rtx hard_libcall_value (enum machine_mode);
+extern rtx hard_libcall_value (enum machine_mode, rtx);
/* Return the mode desired by operand N of a particular bitfield
insert/extract insn, or MAX_MACHINE_MODE if no such insn is
diff --git a/gcc/final.c b/gcc/final.c
index 8a955f77088..76c52ca100e 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1451,10 +1451,10 @@ add_debug_prefix_map (const char *arg)
return;
}
map = XNEW (debug_prefix_map);
- map->old_prefix = ggc_alloc_string (arg, p - arg);
+ map->old_prefix = xstrndup (arg, p - arg);
map->old_len = p - arg;
p++;
- map->new_prefix = ggc_strdup (p);
+ map->new_prefix = xstrdup (p);
map->new_len = strlen (p);
map->next = debug_prefix_maps;
debug_prefix_maps = map;
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 803c7a549af..342e3760bdf 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1972,6 +1972,11 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
break;
case MULT_EXPR:
+#ifdef HAVE_mpc
+ if (COMPLEX_FLOAT_TYPE_P (type))
+ return do_mpc_arg2 (arg1, arg2, type, mpc_mul);
+#endif
+
real = const_binop (MINUS_EXPR,
const_binop (MULT_EXPR, r1, r2, notrunc),
const_binop (MULT_EXPR, i1, i2, notrunc),
@@ -1983,6 +1988,11 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
break;
case RDIV_EXPR:
+#ifdef HAVE_mpc
+ if (COMPLEX_FLOAT_TYPE_P (type))
+ return do_mpc_arg2 (arg1, arg2, type, mpc_div);
+#endif
+
{
tree magsquared
= const_binop (PLUS_EXPR,
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index f89a8af3e38..d7873260933 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,283 @@
+2009-08-18 Janus Weil <janus@gcc.gnu.org>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40870
+ * trans-types.c (gfc_get_ppc_type): Include formal args in backend_decl
+ using the interface symbol. Character types are returned by reference.
+ (gfc_get_derived_type): Prevent infinite recursion loop
+ if a PPC has a derived-type formal arg.
+
+2008-08-17 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/41062
+ * trans-decl.c (gfc_trans_use_stmts): Keep going through use
+ list if symbol is not use associated.
+
+2009-08-17 Daniel Kraft <d@domob.eu>
+
+ PR fortran/37425
+ * resolve.c (get_checked_tb_operator_target): New routine to do checks
+ on type-bound operators in common between intrinsic and user operators.
+ (resolve_typebound_intrinsic_op): Call it.
+ (resolve_typebound_user_op): Ditto.
+
+2009-08-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/41075
+ * scanner.c (gfc_next_char_literal): Add comment to improve
+ readability.
+ * io.c (enum format_token): Add FMT_STAR. (format_lex): Add case
+ for '*'. (check_format): Check for left paren after '*'. Change
+ format checks to use %L to improve format string error locus.
+
+2009-08-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40877
+ * array.c (gfc_resolve_character_array_constructor): Add NULL argument
+ to gfc_new_charlen.
+ * decl.c (add_init_expr_to_sym,variable_decl,match_char_spec,
+ gfc_match_implicit): Ditto.
+ * expr.c (simplify_const_ref): Fix memory leak.
+ (gfc_simplify_expr): Add NULL argument to gfc_new_charlen.
+ * gfortran.h (gfc_new_charlen): Modified prototype.
+ * iresolve.c (check_charlen_present,gfc_resolve_char_achar): Add NULL
+ argument to gfc_new_charlen.
+ * module.c (mio_charlen): Ditto.
+ * resolve.c (gfc_resolve_substring_charlen,
+ gfc_resolve_character_operator,fixup_charlen): Ditto.
+ (resolve_fl_derived,resolve_symbol): Add argument to gfc_charlen.
+ * symbol.c (gfc_new_charlen): Add argument 'old_cl' (to make a copy of
+ an existing charlen).
+ (gfc_set_default_type,generate_isocbinding_symbol): Fix memory leak.
+ (gfc_copy_formal_args_intr): Add NULL argument to gfc_new_charlen.
+ * trans-decl.c (create_function_arglist): Fix memory leak.
+
+2009-08-17 Richard Guenther <rguenther@suse.de>
+
+ * trans-expr.c (gfc_trans_scalar_assign): Replace hack with
+ more proper hack.
+
+2009-08-15 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41080
+ * gfortranspec.c (lookup_option): Remove gfortran-specific
+ version of -dumpversion.
+
+2009-08-14 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41070
+ * resolve.c (resolve_structure_cons): Make sure that ts.u.derived is
+ only used if type is BT_DERIVED.
+
+2009-08-13 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40941
+ * gfortran.h (gfc_typespec): Put 'derived' and 'cl' into union.
+ * decl.c (build_struct): Make sure 'cl' is only used
+ if type is BT_CHARACTER.
+ * symbol.c (gfc_set_default_type): Ditto.
+ * resolve.c (resolve_symbol, resolve_fl_derived): Ditto.
+ (resolve_equivalence,resolve_equivalence_derived): Make sure 'derived'
+ is only used if type is BT_DERIVED.
+ * trans-io.c (transfer_expr): Make sure 'derived' is only used if type
+ is BT_DERIVED or BT_INTEGER (special case: C_PTR/C_FUNPTR).
+ * array.c: Mechanical replacements to accomodate union in gfc_typespec.
+ * check.c: Ditto.
+ * data.c: Ditto.
+ * decl.c: Ditto.
+ * dump-parse-tree.c: Ditto.
+ * expr.c: Ditto.
+ * interface.c: Ditto.
+ * iresolve.c: Ditto.
+ * match.c: Ditto.
+ * misc.c: Ditto.
+ * module.c: Ditto.
+ * openmp.c: Ditto.
+ * parse.c: Ditto.
+ * primary.c: Ditto.
+ * resolve.c: Ditto.
+ * simplify.c: Ditto.
+ * symbol.c: Ditto.
+ * target-memory.c: Ditto.
+ * trans-array.c: Ditto.
+ * trans-common.c: Ditto.
+ * trans-const.c: Ditto.
+ * trans-decl.c: Ditto.
+ * trans-expr.c: Ditto.
+ * trans-intrinsic.c: Ditto.
+ * trans-io.c: Ditto.
+ * trans-stmt.c: Ditto.
+ * trans-types.c: Ditto.
+
+2009-08-13 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40995
+ * resolve.c (resolve_symbol): Move some checking code to
+ resolve_intrinsic, and call this from here.
+ (resolve_intrinsic): Some checking code moved here from resolve_symbol.
+ Make sure each intrinsic is only resolved once.
+
+2009-08-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/41034
+ * symbol.c (gfc_copy_attr): Merge bits instead of replace
+ bits in gfc_copy_attr.
+ * gfc_check_pointer_assign (gfc_check_pointer_assign):
+ Initialize ext_attr bits by zero.
+
+2009-08-11 Richard Guenther <rguenther@suse.de>
+
+ * trans-types.c (gfc_get_derived_type): Do not clear TYPE_CANONICAL.
+
+2009-08-11 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41022
+ * trans-expr.c (gfc_conv_procedure_call): Handle procedure pointer
+ components as actual arguments.
+
+2009-08-10 Daniel Kraft <d@domob.eu>
+
+ PR fortran/37425
+ * gfortran.h (struct gfc_namespace): New fields tb_uop_root and tb_op.
+ (gfc_find_typebound_user_op): New routine.
+ (gfc_find_typebound_intrinsic_op): Ditto.
+ (gfc_check_operator_interface): Now public routine.
+ * decl.c (gfc_match_generic): Match OPERATOR(X) or ASSIGNMENT(=).
+ * interface.c (check_operator_interface): Made public, renamed to
+ `gfc_check_operator_interface' accordingly and hand in the interface
+ as gfc_symbol rather than gfc_interface so it is useful for type-bound
+ operators, too. Return boolean result.
+ (gfc_check_interfaces): Adapt call to `check_operator_interface'.
+ * symbol.c (gfc_get_namespace): Initialize new field `tb_op'.
+ (gfc_free_namespace): Free `tb_uop_root'-based tree.
+ (find_typebound_proc_uop): New helper function.
+ (gfc_find_typebound_proc): Use it.
+ (gfc_find_typebound_user_op): New method.
+ (gfc_find_typebound_intrinsic_op): Ditto.
+ * resolve.c (resolve_tb_generic_targets): New helper function.
+ (resolve_typebound_generic): Use it.
+ (resolve_typebound_intrinsic_op), (resolve_typebound_user_op): New.
+ (resolve_typebound_procedures): Resolve operators, too.
+ (check_uop_procedure): New, code from gfc_resolve_uops.
+ (gfc_resolve_uops): Moved main code to new `check_uop_procedure'.
+
+2009-08-10 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40940
+ * decl.c (gfc_match_type_spec): Match CLASS statement and warn about
+ missing polymorphism.
+ * gfortran.h (gfc_typespec): Add field 'is_class'.
+ * misc.c (gfc_clear_ts): Initialize 'is_class' to zero.
+ * resolve.c (type_is_extensible): New function to check if a derived
+ type is extensible.
+ (resolve_fl_variable_derived): Add error checks for CLASS variables.
+ (resolve_typebound_procedure): Disallow non-polymorphic passed-object
+ dummy arguments, turning warning into error.
+ (resolve_fl_derived): Use 'type_is_extensible'. Disallow non-polymorphic
+ passed-object dummy arguments for procedure pointer components,
+ turning warning into error. Add error check for CLASS components.
+
+2009-08-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40955
+ * gfortran.h (ext_attr_id_t): Add typedef for this enum.
+ (gfc_add_ext_attribute): Use it.
+ * decl.c (gfc_match_gcc_attributes): Ditto.
+ * expr.c (gfc_check_pointer_assign): Ditto.
+ * symbol.c (gfc_add_ext_attribute): Ditto.
+ (gfc_copy_attr): Copy also ext_attr.
+ * resolve.c (resolve_fl_derived,resolve_symbol): Ditto.
+ * module.c (mio_symbol_attribute): Save ext_attr in the mod file.
+
+2009-08-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40969
+ Revert:
+ 2009-08-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40949
+ * trans-types.c (gfc_get_function_type): Fix typelist of
+ functions without argument.
+
+2009-08-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40847
+ * iresolve.c (gfc_resolve_transfer): Correct error in 'mold'
+ character length for case where length expresson is NULL.
+
+2009-08-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40949
+ * trans-types.c (gfc_get_function_type): Fix typelist of
+ functions without argument.
+
+2009-08-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40875
+ * decl.c (add_init_expr_to_sym): Character symbols can only be
+ initialized with character expressions.
+
+2009-08-02 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40881
+ * decl.c (match_char_length): Warn about old-style character length
+ declarations.
+ * match.c (match_arithmetic_if,gfc_match_if): Modify warning message
+ for arithmetic if.
+ (gfc_match_goto): Warn about computed gotos.
+ (gfc_match_return): Warn about alternate return.
+ (gfc_match_st_function): Warn about statement functions.
+ * resolve.c (resolve_fl_procedure): Modify warning message for
+ assumed-length character functions.
+
+2009-08-01 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40011
+ * error.c : Add static flag 'warnings_not_errors'.
+ (gfc_error): If 'warnings_not_errors' is set, branch to code
+ from gfc_warning.
+ (gfc_clear_error): Reset 'warnings_not_errors'.
+ (gfc_errors_to_warnings): New function.
+ * options.c (gfc_post_options): If pedantic and flag_whole_file
+ change the latter to a value of 2.
+ * parse.c (parse_module): Add module namespace to gsymbol.
+ (resolve_all_program_units): New function.
+ (clean_up_modules): New function.
+ (translate_all_program_units): New function.
+ (gfc_parse_file): If whole_file, do not clean up module right
+ away and add derived types to namespace derived types. In
+ addition, call the three new functions above.
+ * resolve.c (not_in_recursive): New function.
+ (not_entry_self_reference): New function.
+ (resolve_global_procedure): Symbol must not be IFSRC_UNKNOWN,
+ procedure must not be in the course of being resolved and
+ must return false for the two new functions. Pack away the
+ current derived type list before calling gfc_resolve for the
+ gsymbol namespace. It is unconditionally an error if the ranks
+ of the reference and ther procedure do not match. Convert
+ errors to warnings during call to gfc_procedure_use if not
+ pedantic or legacy.
+ (gfc_resolve): Set namespace resolved flag to -1 during
+ resolution and store current cs_base.
+ * trans-decl.c (gfc_get_symbol_decl): If whole_file compilation
+ substitute a use associated variable, if it is available in a
+ gsymbolnamespace.
+ (gfc_get_extern_function_decl): If the procedure is use assoc,
+ do not attempt to find it in a gsymbol because it could be an
+ interface. If the symbol exists in a module namespace, return
+ its backend_decl.
+ * trans-expr.c (gfc_trans_scalar_assign): If a derived type
+ assignment, set the rhs TYPE_MAIN_VARIANT to that of the rhs.
+ * trans-types.c (copy_dt_decls_ifequal): Add 'from_gsym' as a
+ boolean argument. Copy component backend_decls directly if the
+ components are derived types and from_gsym is true.
+ (gfc_get_derived_type): If whole_file copy the derived type from
+ the module if it is use associated, otherwise, if can be found
+ in another gsymbol namespace, use the existing derived type as
+ the TYPE_CANONICAL and build normally.
+ * gfortran.h : Add derived_types and resolved fields to
+ gfc_namespace. Include prototype for gfc_errors_to_warnings.
+
2009-07-29 Tobias Burnus <burnus@net-b.de>
PR fortran/40898
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 2fee4658a0d..3ceb0e75181 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -968,8 +968,8 @@ done:
else
expr->ts.type = BT_UNKNOWN;
- if (expr->ts.cl)
- expr->ts.cl->length_from_typespec = seen_ts;
+ if (expr->ts.u.cl)
+ expr->ts.u.cl->length_from_typespec = seen_ts;
expr->where = where;
expr->rank = 1;
@@ -1588,25 +1588,25 @@ gfc_resolve_character_array_constructor (gfc_expr *expr)
gcc_assert (expr->expr_type == EXPR_ARRAY);
gcc_assert (expr->ts.type == BT_CHARACTER);
- if (expr->ts.cl == NULL)
+ if (expr->ts.u.cl == NULL)
{
for (p = expr->value.constructor; p; p = p->next)
- if (p->expr->ts.cl != NULL)
+ if (p->expr->ts.u.cl != NULL)
{
/* Ensure that if there is a char_len around that it is
used; otherwise the middle-end confuses them! */
- expr->ts.cl = p->expr->ts.cl;
+ expr->ts.u.cl = p->expr->ts.u.cl;
goto got_charlen;
}
- expr->ts.cl = gfc_new_charlen (gfc_current_ns);
+ expr->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
}
got_charlen:
found_length = -1;
- if (expr->ts.cl->length == NULL)
+ if (expr->ts.u.cl->length == NULL)
{
/* Check that all constant string elements have the same length until
we reach the end or find a variable-length one. */
@@ -1630,11 +1630,11 @@ got_charlen:
- mpz_get_ui (ref->u.ss.start->value.integer) + 1;
current_length = (int) j;
}
- else if (p->expr->ts.cl && p->expr->ts.cl->length
- && p->expr->ts.cl->length->expr_type == EXPR_CONSTANT)
+ else if (p->expr->ts.u.cl && p->expr->ts.u.cl->length
+ && p->expr->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
long j;
- j = mpz_get_si (p->expr->ts.cl->length->value.integer);
+ j = mpz_get_si (p->expr->ts.u.cl->length->value.integer);
current_length = (int) j;
}
else
@@ -1658,18 +1658,18 @@ got_charlen:
gcc_assert (found_length != -1);
/* Update the character length of the array constructor. */
- expr->ts.cl->length = gfc_int_expr (found_length);
+ expr->ts.u.cl->length = gfc_int_expr (found_length);
}
else
{
/* We've got a character length specified. It should be an integer,
otherwise an error is signalled elsewhere. */
- gcc_assert (expr->ts.cl->length);
+ gcc_assert (expr->ts.u.cl->length);
/* If we've got a constant character length, pad according to this.
gfc_extract_int does check for BT_INTEGER and EXPR_CONSTANT and sets
max_length only if they pass. */
- gfc_extract_int (expr->ts.cl->length, &found_length);
+ gfc_extract_int (expr->ts.u.cl->length, &found_length);
/* Now pad/truncate the elements accordingly to the specified character
length. This is ok inside this conditional, as in the case above
@@ -1683,16 +1683,16 @@ got_charlen:
int current_length = -1;
bool has_ts;
- if (p->expr->ts.cl && p->expr->ts.cl->length)
+ if (p->expr->ts.u.cl && p->expr->ts.u.cl->length)
{
- cl = p->expr->ts.cl->length;
+ cl = p->expr->ts.u.cl->length;
gfc_extract_int (cl, &current_length);
}
/* If gfc_extract_int above set current_length, we implicitly
know the type is BT_INTEGER and it's EXPR_CONSTANT. */
- has_ts = (expr->ts.cl && expr->ts.cl->length_from_typespec);
+ has_ts = (expr->ts.u.cl && expr->ts.u.cl->length_from_typespec);
if (! cl
|| (current_length != -1 && current_length < found_length))
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 779af2038e9..6e2ce410225 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -410,20 +410,20 @@ gfc_check_same_strlen (const gfc_expr *a, const gfc_expr *b, const char *name)
long len_a, len_b;
len_a = len_b = -1;
- if (a->ts.cl && a->ts.cl->length
- && a->ts.cl->length->expr_type == EXPR_CONSTANT)
- len_a = mpz_get_si (a->ts.cl->length->value.integer);
+ if (a->ts.u.cl && a->ts.u.cl->length
+ && a->ts.u.cl->length->expr_type == EXPR_CONSTANT)
+ len_a = mpz_get_si (a->ts.u.cl->length->value.integer);
else if (a->expr_type == EXPR_CONSTANT
- && (a->ts.cl == NULL || a->ts.cl->length == NULL))
+ && (a->ts.u.cl == NULL || a->ts.u.cl->length == NULL))
len_a = a->value.character.length;
else
return SUCCESS;
- if (b->ts.cl && b->ts.cl->length
- && b->ts.cl->length->expr_type == EXPR_CONSTANT)
- len_b = mpz_get_si (b->ts.cl->length->value.integer);
+ if (b->ts.u.cl && b->ts.u.cl->length
+ && b->ts.u.cl->length->expr_type == EXPR_CONSTANT)
+ len_b = mpz_get_si (b->ts.u.cl->length->value.integer);
else if (b->expr_type == EXPR_CONSTANT
- && (b->ts.cl == NULL || b->ts.cl->length == NULL))
+ && (b->ts.u.cl == NULL || b->ts.u.cl->length == NULL))
len_b = b->value.character.length;
else
return SUCCESS;
@@ -1400,12 +1400,12 @@ gfc_check_ichar_iachar (gfc_expr *c, gfc_expr *kind)
{
/* Check that the argument is length one. Non-constant lengths
can't be checked here, so assume they are ok. */
- if (c->ts.cl && c->ts.cl->length)
+ if (c->ts.u.cl && c->ts.u.cl->length)
{
/* If we already have a length for this expression then use it. */
- if (c->ts.cl->length->expr_type != EXPR_CONSTANT)
+ if (c->ts.u.cl->length->expr_type != EXPR_CONSTANT)
return SUCCESS;
- i = mpz_get_si (c->ts.cl->length->value.integer);
+ i = mpz_get_si (c->ts.u.cl->length->value.integer);
}
else
return SUCCESS;
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c
index 5829c7f9c67..6cddb3c7b71 100644
--- a/gcc/fortran/data.c
+++ b/gcc/fortran/data.c
@@ -154,7 +154,7 @@ create_character_intializer (gfc_expr *init, gfc_typespec *ts,
int len, start, end;
gfc_char_t *dest;
- gfc_extract_int (ts->cl->length, &len);
+ gfc_extract_int (ts->u.cl->length, &len);
if (init == NULL)
{
@@ -379,7 +379,7 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
/* Setup the expression to hold the constructor. */
expr->expr_type = EXPR_STRUCTURE;
expr->ts.type = BT_DERIVED;
- expr->ts.derived = ref->u.c.sym;
+ expr->ts.u.derived = ref->u.c.sym;
}
else
gcc_assert (expr->expr_type == EXPR_STRUCTURE);
@@ -417,7 +417,7 @@ gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index)
if (ref || last_ts->type == BT_CHARACTER)
{
- if (lvalue->ts.cl->length == NULL && !(ref && ref->u.ss.length != NULL))
+ if (lvalue->ts.u.cl->length == NULL && !(ref && ref->u.ss.length != NULL))
return FAILURE;
expr = create_character_intializer (init, last_ts, ref, rvalue);
}
@@ -569,7 +569,7 @@ gfc_assign_data_value_range (gfc_expr *lvalue, gfc_expr *rvalue,
/* Setup the expression to hold the constructor. */
expr->expr_type = EXPR_STRUCTURE;
expr->ts.type = BT_DERIVED;
- expr->ts.derived = ref->u.c.sym;
+ expr->ts.u.derived = ref->u.c.sym;
}
else
gcc_assert (expr->expr_type == EXPR_STRUCTURE);
@@ -716,7 +716,7 @@ formalize_structure_cons (gfc_expr *expr)
return;
head = tail = NULL;
- for (order = expr->ts.derived->components; order; order = order->next)
+ for (order = expr->ts.u.derived->components; order; order = order->next)
{
/* Find the next component. */
last = NULL;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 392f2a57e68..e4813b80038 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -622,8 +622,8 @@ char_len_param_value (gfc_expr **expr)
if (e->symtree->n.sym->ts.type == BT_UNKNOWN)
goto syntax;
if (e->symtree->n.sym->ts.type == BT_CHARACTER
- && e->symtree->n.sym->ts.cl
- && e->symtree->n.sym->ts.cl->length->ts.type == BT_UNKNOWN)
+ && e->symtree->n.sym->ts.u.cl
+ && e->symtree->n.sym->ts.u.cl->length->ts.type == BT_UNKNOWN)
goto syntax;
}
}
@@ -655,6 +655,9 @@ match_char_length (gfc_expr **expr)
if (m == MATCH_YES)
{
+ if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
+ "Old-style character length at %C") == FAILURE)
+ return MATCH_ERROR;
*expr = gfc_int_expr (length);
return m;
}
@@ -935,7 +938,7 @@ verify_c_interop_param (gfc_symbol *sym)
"because derived type '%s' is not C interoperable",
sym->name, &(sym->declared_at),
sym->ns->proc_name->name,
- sym->ts.derived->name);
+ sym->ts.u.derived->name);
else
gfc_warning ("Variable '%s' at %L is a parameter to the "
"BIND(C) procedure '%s' but may not be C "
@@ -948,7 +951,7 @@ verify_c_interop_param (gfc_symbol *sym)
length of 1. */
if (sym->ts.type == BT_CHARACTER)
{
- gfc_charlen *cl = sym->ts.cl;
+ gfc_charlen *cl = sym->ts.u.cl;
if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT
|| mpz_cmp_si (cl->length->value.integer, 1) != 0)
{
@@ -1042,7 +1045,7 @@ build_sym (const char *name, gfc_charlen *cl,
return FAILURE;
if (sym->ts.type == BT_CHARACTER)
- sym->ts.cl = cl;
+ sym->ts.u.cl = cl;
/* Add dimension attribute if present. */
if (gfc_set_array_spec (sym, *as, var_locus) == FAILURE)
@@ -1250,38 +1253,42 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
&& gfc_check_assign_symbol (sym, init) == FAILURE)
return FAILURE;
- if (sym->ts.type == BT_CHARACTER && sym->ts.cl)
+ if (sym->ts.type == BT_CHARACTER && sym->ts.u.cl
+ && init->ts.type == BT_CHARACTER)
{
/* Update symbol character length according initializer. */
- if (sym->ts.cl->length == NULL)
+ if (gfc_check_assign_symbol (sym, init) == FAILURE)
+ return FAILURE;
+
+ if (sym->ts.u.cl->length == NULL)
{
int clen;
/* If there are multiple CHARACTER variables declared on the
same line, we don't want them to share the same length. */
- sym->ts.cl = gfc_new_charlen (gfc_current_ns);
+ sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
if (sym->attr.flavor == FL_PARAMETER)
{
if (init->expr_type == EXPR_CONSTANT)
{
clen = init->value.character.length;
- sym->ts.cl->length = gfc_int_expr (clen);
+ sym->ts.u.cl->length = gfc_int_expr (clen);
}
else if (init->expr_type == EXPR_ARRAY)
{
gfc_expr *p = init->value.constructor->expr;
clen = p->value.character.length;
- sym->ts.cl->length = gfc_int_expr (clen);
+ sym->ts.u.cl->length = gfc_int_expr (clen);
}
- else if (init->ts.cl && init->ts.cl->length)
- sym->ts.cl->length =
- gfc_copy_expr (sym->value->ts.cl->length);
+ else if (init->ts.u.cl && init->ts.u.cl->length)
+ sym->ts.u.cl->length =
+ gfc_copy_expr (sym->value->ts.u.cl->length);
}
}
/* Update initializer character length according symbol. */
- else if (sym->ts.cl->length->expr_type == EXPR_CONSTANT)
+ else if (sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
- int len = mpz_get_si (sym->ts.cl->length->value.integer);
+ int len = mpz_get_si (sym->ts.u.cl->length->value.integer);
gfc_constructor * p;
if (init->expr_type == EXPR_CONSTANT)
@@ -1290,8 +1297,8 @@ add_init_expr_to_sym (const char *name, gfc_expr **initp, locus *var_locus)
{
/* Build a new charlen to prevent simplification from
deleting the length before it is resolved. */
- init->ts.cl = gfc_new_charlen (gfc_current_ns);
- init->ts.cl->length = gfc_copy_expr (sym->ts.cl->length);
+ init->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
+ init->ts.u.cl->length = gfc_copy_expr (sym->ts.u.cl->length);
for (p = init->value.constructor; p; p = p->next)
gfc_set_constant_character_len (len, p->expr, -1);
@@ -1382,7 +1389,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
/* If the current symbol is of the same derived type that we're
constructing, it must have the pointer attribute. */
if (current_ts.type == BT_DERIVED
- && current_ts.derived == gfc_current_block ()
+ && current_ts.u.derived == gfc_current_block ()
&& current_attr.pointer == 0)
{
gfc_error ("Component at %C must have the POINTER attribute");
@@ -1403,7 +1410,8 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
return FAILURE;
c->ts = current_ts;
- c->ts.cl = cl;
+ if (c->ts.type == BT_CHARACTER)
+ c->ts.u.cl = cl;
c->attr = current_attr;
c->initializer = *init;
@@ -1416,27 +1424,27 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
/* Should this ever get more complicated, combine with similar section
in add_init_expr_to_sym into a separate function. */
- if (c->ts.type == BT_CHARACTER && !c->attr.pointer && c->initializer && c->ts.cl
- && c->ts.cl->length && c->ts.cl->length->expr_type == EXPR_CONSTANT)
+ if (c->ts.type == BT_CHARACTER && !c->attr.pointer && c->initializer && c->ts.u.cl
+ && c->ts.u.cl->length && c->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
int len;
- gcc_assert (c->ts.cl && c->ts.cl->length);
- gcc_assert (c->ts.cl->length->expr_type == EXPR_CONSTANT);
- gcc_assert (c->ts.cl->length->ts.type == BT_INTEGER);
+ gcc_assert (c->ts.u.cl && c->ts.u.cl->length);
+ gcc_assert (c->ts.u.cl->length->expr_type == EXPR_CONSTANT);
+ gcc_assert (c->ts.u.cl->length->ts.type == BT_INTEGER);
- len = mpz_get_si (c->ts.cl->length->value.integer);
+ len = mpz_get_si (c->ts.u.cl->length->value.integer);
if (c->initializer->expr_type == EXPR_CONSTANT)
gfc_set_constant_character_len (len, c->initializer, -1);
- else if (mpz_cmp (c->ts.cl->length->value.integer,
- c->initializer->ts.cl->length->value.integer))
+ else if (mpz_cmp (c->ts.u.cl->length->value.integer,
+ c->initializer->ts.u.cl->length->value.integer))
{
bool has_ts;
gfc_constructor *ctor = c->initializer->value.constructor;
- has_ts = (c->initializer->ts.cl
- && c->initializer->ts.cl->length_from_typespec);
+ has_ts = (c->initializer->ts.u.cl
+ && c->initializer->ts.u.cl->length_from_typespec);
if (ctor)
{
@@ -1593,7 +1601,7 @@ variable_decl (int elem)
switch (match_char_length (&char_len))
{
case MATCH_YES:
- cl = gfc_new_charlen (gfc_current_ns);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
cl->length = char_len;
break;
@@ -1602,14 +1610,14 @@ variable_decl (int elem)
element. Also copy assumed lengths. */
case MATCH_NO:
if (elem > 1
- && (current_ts.cl->length == NULL
- || current_ts.cl->length->expr_type != EXPR_CONSTANT))
+ && (current_ts.u.cl->length == NULL
+ || current_ts.u.cl->length->expr_type != EXPR_CONSTANT))
{
- cl = gfc_new_charlen (gfc_current_ns);
- cl->length = gfc_copy_expr (current_ts.cl->length);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
+ cl->length = gfc_copy_expr (current_ts.u.cl->length);
}
else
- cl = current_ts.cl;
+ cl = current_ts.u.cl;
break;
@@ -1627,8 +1635,8 @@ variable_decl (int elem)
{
sym->ts.type = current_ts.type;
sym->ts.kind = current_ts.kind;
- sym->ts.cl = cl;
- sym->ts.derived = current_ts.derived;
+ sym->ts.u.cl = cl;
+ sym->ts.u.derived = current_ts.u.derived;
sym->ts.is_c_interop = current_ts.is_c_interop;
sym->ts.is_iso_c = current_ts.is_iso_c;
m = MATCH_YES;
@@ -1700,13 +1708,13 @@ variable_decl (int elem)
if (current_ts.type == BT_DERIVED
&& gfc_current_ns->proc_name
&& gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY
- && current_ts.derived->ns != gfc_current_ns)
+ && current_ts.u.derived->ns != gfc_current_ns)
{
gfc_symtree *st;
- st = gfc_find_symtree (gfc_current_ns->sym_root, current_ts.derived->name);
- if (!(current_ts.derived->attr.imported
+ st = gfc_find_symtree (gfc_current_ns->sym_root, current_ts.u.derived->name);
+ if (!(current_ts.u.derived->attr.imported
&& st != NULL
- && st->n.sym == current_ts.derived)
+ && st->n.sym == current_ts.u.derived)
&& !gfc_current_ns->has_import_set)
{
gfc_error ("the type of '%s' at %C has not been declared within the "
@@ -2227,14 +2235,14 @@ done:
}
/* Do some final massaging of the length values. */
- cl = gfc_new_charlen (gfc_current_ns);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
if (seen_length == 0)
cl->length = gfc_int_expr (1);
else
cl->length = len;
- ts->cl = cl;
+ ts->u.cl = cl;
ts->kind = kind == 0 ? gfc_default_character_kind : kind;
/* We have to know if it was a c interoperable kind so we can
@@ -2289,7 +2297,7 @@ gfc_match_type_spec (gfc_typespec *ts, int implicit_flag)
if (gfc_match (" byte") == MATCH_YES)
{
- if (gfc_notify_std(GFC_STD_GNU, "Extension: BYTE type at %C")
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: BYTE type at %C")
== FAILURE)
return MATCH_ERROR;
@@ -2362,7 +2370,16 @@ gfc_match_type_spec (gfc_typespec *ts, int implicit_flag)
m = gfc_match (" type ( %n )", name);
if (m != MATCH_YES)
- return m;
+ {
+ m = gfc_match (" class ( %n )", name);
+ if (m != MATCH_YES)
+ return m;
+ ts->is_class = 1;
+
+ /* TODO: Implement Polymorphism. */
+ gfc_warning ("Polymorphic entities are not yet implemented. "
+ "CLASS will be treated like TYPE at %C");
+ }
ts->type = BT_DERIVED;
@@ -2371,10 +2388,10 @@ gfc_match_type_spec (gfc_typespec *ts, int implicit_flag)
found, add it to the typespec. */
if (gfc_matching_function)
{
- ts->derived = NULL;
+ ts->u.derived = NULL;
if (gfc_current_state () != COMP_INTERFACE
&& !gfc_find_symbol (name, NULL, 1, &sym) && sym)
- ts->derived = sym;
+ ts->u.derived = sym;
return MATCH_YES;
}
@@ -2407,7 +2424,7 @@ gfc_match_type_spec (gfc_typespec *ts, int implicit_flag)
return MATCH_ERROR;
gfc_set_sym_referenced (sym);
- ts->derived = sym;
+ ts->u.derived = sym;
return MATCH_YES;
@@ -2419,8 +2436,8 @@ get_kind:
if (gfc_current_form == FORM_FREE)
{
- c = gfc_peek_ascii_char();
- if (!gfc_is_whitespace(c) && c != '*' && c != '('
+ c = gfc_peek_ascii_char ();
+ if (!gfc_is_whitespace (c) && c != '*' && c != '('
&& c != ':' && c != ',')
return MATCH_NO;
}
@@ -2598,11 +2615,11 @@ gfc_match_implicit (void)
if ((c == '\n') || (c == ','))
{
/* Check for CHARACTER with no length parameter. */
- if (ts.type == BT_CHARACTER && !ts.cl)
+ if (ts.type == BT_CHARACTER && !ts.u.cl)
{
ts.kind = gfc_default_character_kind;
- ts.cl = gfc_new_charlen (gfc_current_ns);
- ts.cl->length = gfc_int_expr (1);
+ ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
+ ts.u.cl->length = gfc_int_expr (1);
}
/* Record the Successful match. */
@@ -3314,8 +3331,8 @@ set_com_block_bind_c (gfc_common_head *com_block, int is_bind_c)
gfc_try
verify_c_interop (gfc_typespec *ts)
{
- if (ts->type == BT_DERIVED && ts->derived != NULL)
- return (ts->derived->ts.is_c_interop ? SUCCESS : FAILURE);
+ if (ts->type == BT_DERIVED && ts->u.derived != NULL)
+ return (ts->u.derived->ts.is_c_interop ? SUCCESS : FAILURE);
else if (ts->is_c_interop != 1)
return FAILURE;
@@ -3457,9 +3474,9 @@ verify_bind_c_sym (gfc_symbol *tmp_sym, gfc_typespec *ts,
/* BIND(C) functions can not return a character string. */
if (bind_c_function && tmp_sym->ts.type == BT_CHARACTER)
- if (tmp_sym->ts.cl == NULL || tmp_sym->ts.cl->length == NULL
- || tmp_sym->ts.cl->length->expr_type != EXPR_CONSTANT
- || mpz_cmp_si (tmp_sym->ts.cl->length->value.integer, 1) != 0)
+ if (tmp_sym->ts.u.cl == NULL || tmp_sym->ts.u.cl->length == NULL
+ || tmp_sym->ts.u.cl->length->expr_type != EXPR_CONSTANT
+ || mpz_cmp_si (tmp_sym->ts.u.cl->length->value.integer, 1) != 0)
gfc_error ("Return type of BIND(C) function '%s' at %L cannot "
"be a character string", tmp_sym->name,
&(tmp_sym->declared_at));
@@ -3663,7 +3680,7 @@ gfc_match_data_decl (void)
if (current_ts.type == BT_DERIVED && gfc_current_state () != COMP_DERIVED)
{
- sym = gfc_use_derived (current_ts.derived);
+ sym = gfc_use_derived (current_ts.u.derived);
if (sym == NULL)
{
@@ -3671,7 +3688,7 @@ gfc_match_data_decl (void)
goto cleanup;
}
- current_ts.derived = sym;
+ current_ts.u.derived = sym;
}
m = match_attr_spec ();
@@ -3681,21 +3698,21 @@ gfc_match_data_decl (void)
goto cleanup;
}
- if (current_ts.type == BT_DERIVED && current_ts.derived->components == NULL
- && !current_ts.derived->attr.zero_comp)
+ if (current_ts.type == BT_DERIVED && current_ts.u.derived->components == NULL
+ && !current_ts.u.derived->attr.zero_comp)
{
if (current_attr.pointer && gfc_current_state () == COMP_DERIVED)
goto ok;
- gfc_find_symbol (current_ts.derived->name,
- current_ts.derived->ns->parent, 1, &sym);
+ gfc_find_symbol (current_ts.u.derived->name,
+ current_ts.u.derived->ns->parent, 1, &sym);
/* Any symbol that we find had better be a type definition
which has its components defined. */
if (sym != NULL && sym->attr.flavor == FL_DERIVED
- && (current_ts.derived->components != NULL
- || current_ts.derived->attr.zero_comp))
+ && (current_ts.u.derived->components != NULL
+ || current_ts.u.derived->attr.zero_comp))
goto ok;
/* Now we have an error, which we signal, and then fix up
@@ -6186,30 +6203,30 @@ do_parm (void)
}
if (sym->ts.type == BT_CHARACTER
- && sym->ts.cl != NULL
- && sym->ts.cl->length != NULL
- && sym->ts.cl->length->expr_type == EXPR_CONSTANT
+ && sym->ts.u.cl != NULL
+ && sym->ts.u.cl->length != NULL
+ && sym->ts.u.cl->length->expr_type == EXPR_CONSTANT
&& init->expr_type == EXPR_CONSTANT
&& init->ts.type == BT_CHARACTER)
gfc_set_constant_character_len (
- mpz_get_si (sym->ts.cl->length->value.integer), init, -1);
- else if (sym->ts.type == BT_CHARACTER && sym->ts.cl != NULL
- && sym->ts.cl->length == NULL)
+ mpz_get_si (sym->ts.u.cl->length->value.integer), init, -1);
+ else if (sym->ts.type == BT_CHARACTER && sym->ts.u.cl != NULL
+ && sym->ts.u.cl->length == NULL)
{
int clen;
if (init->expr_type == EXPR_CONSTANT)
{
clen = init->value.character.length;
- sym->ts.cl->length = gfc_int_expr (clen);
+ sym->ts.u.cl->length = gfc_int_expr (clen);
}
else if (init->expr_type == EXPR_ARRAY)
{
gfc_expr *p = init->value.constructor->expr;
clen = p->value.character.length;
- sym->ts.cl->length = gfc_int_expr (clen);
+ sym->ts.u.cl->length = gfc_int_expr (clen);
}
- else if (init->ts.cl && init->ts.cl->length)
- sym->ts.cl->length = gfc_copy_expr (sym->value->ts.cl->length);
+ else if (init->ts.u.cl && init->ts.u.cl->length)
+ sym->ts.u.cl->length = gfc_copy_expr (sym->value->ts.u.cl->length);
}
sym->value = init;
@@ -6746,7 +6763,7 @@ gfc_match_derived_decl (void)
gfc_set_sym_referenced (extended);
p->ts.type = BT_DERIVED;
- p->ts.derived = extended;
+ p->ts.u.derived = extended;
p->initializer = gfc_default_initializer (&p->ts);
/* Provide the links between the extended type and its extension. */
@@ -7390,11 +7407,13 @@ match
gfc_match_generic (void)
{
char name[GFC_MAX_SYMBOL_LEN + 1];
+ char bind_name[GFC_MAX_SYMBOL_LEN + 16]; /* Allow space for OPERATOR(...). */
gfc_symbol* block;
gfc_typebound_proc tbattr; /* Used for match_binding_attributes. */
gfc_typebound_proc* tb;
- gfc_symtree* st;
gfc_namespace* ns;
+ interface_type op_type;
+ gfc_intrinsic_op op;
match m;
/* Check current state. */
@@ -7421,49 +7440,126 @@ gfc_match_generic (void)
goto error;
}
- /* The binding name and =>. */
- m = gfc_match (" %n =>", name);
+ /* Match the binding name; depending on type (operator / generic) format
+ it for future error messages into bind_name. */
+
+ m = gfc_match_generic_spec (&op_type, name, &op);
if (m == MATCH_ERROR)
return MATCH_ERROR;
if (m == MATCH_NO)
{
- gfc_error ("Expected generic name at %C");
+ gfc_error ("Expected generic name or operator descriptor at %C");
goto error;
}
- /* If there's already something with this name, check that it is another
- GENERIC and then extend that rather than build a new node. */
- st = gfc_find_symtree (ns->tb_sym_root, name);
- if (st)
+ switch (op_type)
{
- gcc_assert (st->n.tb);
- tb = st->n.tb;
+ case INTERFACE_GENERIC:
+ snprintf (bind_name, sizeof (bind_name), "%s", name);
+ break;
+
+ case INTERFACE_USER_OP:
+ snprintf (bind_name, sizeof (bind_name), "OPERATOR(.%s.)", name);
+ break;
+
+ case INTERFACE_INTRINSIC_OP:
+ snprintf (bind_name, sizeof (bind_name), "OPERATOR(%s)",
+ gfc_op2string (op));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ /* Match the required =>. */
+ if (gfc_match (" =>") != MATCH_YES)
+ {
+ gfc_error ("Expected '=>' at %C");
+ goto error;
+ }
+
+ /* Try to find existing GENERIC binding with this name / for this operator;
+ if there is something, check that it is another GENERIC and then extend
+ it rather than building a new node. Otherwise, create it and put it
+ at the right position. */
+
+ switch (op_type)
+ {
+ case INTERFACE_USER_OP:
+ case INTERFACE_GENERIC:
+ {
+ const bool is_op = (op_type == INTERFACE_USER_OP);
+ gfc_symtree* st;
+
+ st = gfc_find_symtree (is_op ? ns->tb_uop_root : ns->tb_sym_root, name);
+ if (st)
+ {
+ tb = st->n.tb;
+ gcc_assert (tb);
+ }
+ else
+ tb = NULL;
+
+ break;
+ }
+
+ case INTERFACE_INTRINSIC_OP:
+ tb = ns->tb_op[op];
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ if (tb)
+ {
if (!tb->is_generic)
{
+ gcc_assert (op_type == INTERFACE_GENERIC);
gfc_error ("There's already a non-generic procedure with binding name"
" '%s' for the derived type '%s' at %C",
- name, block->name);
+ bind_name, block->name);
goto error;
}
if (tb->access != tbattr.access)
{
gfc_error ("Binding at %C must have the same access as already"
- " defined binding '%s'", name);
+ " defined binding '%s'", bind_name);
goto error;
}
}
else
{
- st = gfc_new_symtree (&ns->tb_sym_root, name);
- gcc_assert (st);
-
- st->n.tb = tb = gfc_get_typebound_proc ();
+ tb = gfc_get_typebound_proc ();
tb->where = gfc_current_locus;
tb->access = tbattr.access;
tb->is_generic = 1;
tb->u.generic = NULL;
+
+ switch (op_type)
+ {
+ case INTERFACE_GENERIC:
+ case INTERFACE_USER_OP:
+ {
+ const bool is_op = (op_type == INTERFACE_USER_OP);
+ gfc_symtree* st;
+
+ st = gfc_new_symtree (is_op ? &ns->tb_uop_root : &ns->tb_sym_root,
+ name);
+ gcc_assert (st);
+ st->n.tb = tb;
+
+ break;
+ }
+
+ case INTERFACE_INTRINSIC_OP:
+ ns->tb_op[op] = tb;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
}
/* Now, match all following names as specific targets. */
@@ -7488,7 +7584,7 @@ gfc_match_generic (void)
if (target_st == target->specific_st)
{
gfc_error ("'%s' already defined as specific binding for the"
- " generic '%s' at %C", name, st->name);
+ " generic '%s' at %C", name, bind_name);
goto error;
}
@@ -7671,7 +7767,7 @@ gfc_match_gcc_attributes (void)
return MATCH_ERROR;
}
- if (gfc_add_ext_attribute (&attr, id, &gfc_current_locus)
+ if (gfc_add_ext_attribute (&attr, (ext_attr_id_t) id, &gfc_current_locus)
== FAILURE)
return MATCH_ERROR;
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c
index 2a411d48ad7..5802cdc8a7c 100644
--- a/gcc/fortran/dump-parse-tree.c
+++ b/gcc/fortran/dump-parse-tree.c
@@ -85,11 +85,11 @@ show_typespec (gfc_typespec *ts)
switch (ts->type)
{
case BT_DERIVED:
- fprintf (dumpfile, "%s", ts->derived->name);
+ fprintf (dumpfile, "%s", ts->u.derived->name);
break;
case BT_CHARACTER:
- show_expr (ts->cl->length);
+ show_expr (ts->u.cl->length);
break;
default:
@@ -354,7 +354,7 @@ show_expr (gfc_expr *p)
break;
case EXPR_STRUCTURE:
- fprintf (dumpfile, "%s(", p->ts.derived->name);
+ fprintf (dumpfile, "%s(", p->ts.u.derived->name);
show_constructor (p->value.constructor);
fputc (')', dumpfile);
break;
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 7cb23dd70e6..9d5453e4ceb 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -32,6 +32,8 @@ along with GCC; see the file COPYING3. If not see
static int suppress_errors = 0;
+static int warnings_not_errors = 0;
+
static int terminal_width, buffer_flag, errors, warnings;
static gfc_error_buf error_buffer, warning_buffer, *cur_error_buffer;
@@ -863,6 +865,9 @@ gfc_error (const char *nocmsgid, ...)
{
va_list argp;
+ if (warnings_not_errors)
+ goto warning;
+
if (suppress_errors)
return;
@@ -878,6 +883,30 @@ gfc_error (const char *nocmsgid, ...)
if (buffer_flag == 0)
gfc_increment_error_count();
+
+ return;
+
+warning:
+
+ if (inhibit_warnings)
+ return;
+
+ warning_buffer.flag = 1;
+ warning_buffer.index = 0;
+ cur_error_buffer = &warning_buffer;
+
+ va_start (argp, nocmsgid);
+ error_print (_("Warning:"), _(nocmsgid), argp);
+ va_end (argp);
+
+ error_char ('\0');
+
+ if (buffer_flag == 0)
+ {
+ warnings++;
+ if (warnings_are_errors)
+ gfc_increment_error_count();
+ }
}
@@ -955,6 +984,7 @@ void
gfc_clear_error (void)
{
error_buffer.flag = 0;
+ warnings_not_errors = 0;
}
@@ -1042,3 +1072,12 @@ gfc_get_errors (int *w, int *e)
if (e != NULL)
*e = errors;
}
+
+
+/* Switch errors into warnings. */
+
+void
+gfc_errors_to_warnings (int f)
+{
+ warnings_not_errors = (f == 1) ? 1 : 0;
+}
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index df399b90e7d..57582a9fc47 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -1504,14 +1504,13 @@ simplify_const_ref (gfc_expr *p)
else
string_len = 0;
- if (!p->ts.cl)
- {
- p->ts.cl = gfc_get_charlen ();
- p->ts.cl->next = NULL;
- p->ts.cl->length = NULL;
- }
- gfc_free_expr (p->ts.cl->length);
- p->ts.cl->length = gfc_int_expr (string_len);
+ if (!p->ts.u.cl)
+ p->ts.u.cl = gfc_new_charlen (p->symtree->n.sym->ns,
+ NULL);
+ else
+ gfc_free_expr (p->ts.u.cl->length);
+
+ p->ts.u.cl->length = gfc_int_expr (string_len);
}
}
gfc_free_ref_list (p->ref);
@@ -1681,8 +1680,8 @@ gfc_simplify_expr (gfc_expr *p, int type)
gfc_free (p->value.character.string);
p->value.character.string = s;
p->value.character.length = end - start;
- p->ts.cl = gfc_new_charlen (gfc_current_ns);
- p->ts.cl->length = gfc_int_expr (p->value.character.length);
+ p->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
+ p->ts.u.cl->length = gfc_int_expr (p->value.character.length);
gfc_free_ref_list (p->ref);
p->ref = NULL;
p->expr_type = EXPR_CONSTANT;
@@ -2102,7 +2101,7 @@ check_inquiry (gfc_expr *e, int not_restricted)
with LEN, as required by the standard. */
if (i == 5 && not_restricted
&& ap->expr->symtree->n.sym->ts.type == BT_CHARACTER
- && ap->expr->symtree->n.sym->ts.cl->length == NULL)
+ && ap->expr->symtree->n.sym->ts.u.cl->length == NULL)
{
gfc_error ("Assumed character length variable '%s' in constant "
"expression at %L", e->symtree->n.sym->name, &e->where);
@@ -3192,16 +3191,15 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
&& lvalue->symtree->n.sym->attr.ext_attr
!= rvalue->symtree->n.sym->attr.ext_attr)
{
- symbol_attribute cdecl, stdcall, fastcall;
- unsigned calls;
+ symbol_attribute calls;
- gfc_add_ext_attribute (&cdecl, (unsigned) EXT_ATTR_CDECL, NULL);
- gfc_add_ext_attribute (&stdcall, (unsigned) EXT_ATTR_STDCALL, NULL);
- gfc_add_ext_attribute (&fastcall, (unsigned) EXT_ATTR_FASTCALL, NULL);
- calls = cdecl.ext_attr | stdcall.ext_attr | fastcall.ext_attr;
+ calls.ext_attr = 0;
+ gfc_add_ext_attribute (&calls, EXT_ATTR_CDECL, NULL);
+ gfc_add_ext_attribute (&calls, EXT_ATTR_STDCALL, NULL);
+ gfc_add_ext_attribute (&calls, EXT_ATTR_FASTCALL, NULL);
- if ((calls & lvalue->symtree->n.sym->attr.ext_attr)
- != (calls & rvalue->symtree->n.sym->attr.ext_attr))
+ if ((calls.ext_attr & lvalue->symtree->n.sym->attr.ext_attr)
+ != (calls.ext_attr & rvalue->symtree->n.sym->attr.ext_attr))
{
gfc_error ("Mismatch in the procedure pointer assignment "
"at %L: mismatch in the calling convention",
@@ -3338,7 +3336,7 @@ gfc_default_initializer (gfc_typespec *ts)
gfc_component *c;
/* See if we have a default initializer. */
- for (c = ts->derived->components; c; c = c->next)
+ for (c = ts->u.derived->components; c; c = c->next)
if (c->initializer || c->attr.allocatable)
break;
@@ -3349,10 +3347,10 @@ gfc_default_initializer (gfc_typespec *ts)
init = gfc_get_expr ();
init->expr_type = EXPR_STRUCTURE;
init->ts = *ts;
- init->where = ts->derived->declared_at;
+ init->where = ts->u.derived->declared_at;
tail = NULL;
- for (c = ts->derived->components; c; c = c->next)
+ for (c = ts->u.derived->components; c; c = c->next)
{
if (tail == NULL)
init->value.constructor = tail = gfc_get_constructor ();
@@ -3422,10 +3420,10 @@ gfc_traverse_expr (gfc_expr *expr, gfc_symbol *sym,
return true;
if (expr->ts.type == BT_CHARACTER
- && expr->ts.cl
- && expr->ts.cl->length
- && expr->ts.cl->length->expr_type != EXPR_CONSTANT
- && gfc_traverse_expr (expr->ts.cl->length, sym, func, f))
+ && expr->ts.u.cl
+ && expr->ts.u.cl->length
+ && expr->ts.u.cl->length->expr_type != EXPR_CONSTANT
+ && gfc_traverse_expr (expr->ts.u.cl->length, sym, func, f))
return true;
switch (expr->expr_type)
@@ -3503,11 +3501,11 @@ gfc_traverse_expr (gfc_expr *expr, gfc_symbol *sym,
case REF_COMPONENT:
if (ref->u.c.component->ts.type == BT_CHARACTER
- && ref->u.c.component->ts.cl
- && ref->u.c.component->ts.cl->length
- && ref->u.c.component->ts.cl->length->expr_type
+ && ref->u.c.component->ts.u.cl
+ && ref->u.c.component->ts.u.cl->length
+ && ref->u.c.component->ts.u.cl->length->expr_type
!= EXPR_CONSTANT
- && gfc_traverse_expr (ref->u.c.component->ts.cl->length,
+ && gfc_traverse_expr (ref->u.c.component->ts.u.cl->length,
sym, func, f))
return true;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 7792cfabab6..a4a3b817cf9 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -621,7 +621,7 @@ extern CInteropKind_t c_interop_kinds_table[];
/* Structure and list of supported extension attributes. */
-enum
+typedef enum
{
EXT_ATTR_DLLIMPORT = 0,
EXT_ATTR_DLLEXPORT,
@@ -629,7 +629,8 @@ enum
EXT_ATTR_CDECL,
EXT_ATTR_FASTCALL,
EXT_ATTR_LAST, EXT_ATTR_NUM = EXT_ATTR_LAST
-};
+}
+ext_attr_id_t;
typedef struct
{
@@ -832,14 +833,21 @@ gfc_charlen;
#define gfc_get_charlen() XCNEW (gfc_charlen)
-/* Type specification structure. FIXME: derived and cl could be union??? */
+/* Type specification structure. */
typedef struct
{
bt type;
int kind;
- struct gfc_symbol *derived;
- gfc_charlen *cl; /* For character types only. */
+
+ union
+ {
+ struct gfc_symbol *derived; /* For derived types only. */
+ gfc_charlen *cl; /* For character types only. */
+ }
+ u;
+
struct gfc_symbol *interface; /* For PROCEDURE declarations. */
+ unsigned int is_class:1;
int is_c_interop;
int is_iso_c;
bt f90_type;
@@ -1285,6 +1293,10 @@ typedef struct gfc_namespace
/* Tree containing type-bound procedures. */
gfc_symtree *tb_sym_root;
+ /* Type-bound user operators. */
+ gfc_symtree *tb_uop_root;
+ /* For derived-types, store type-bound intrinsic operators here. */
+ gfc_typebound_proc *tb_op[GFC_INTRINSIC_OPS];
/* Linked list of finalizer procedures. */
struct gfc_finalizer *finalizers;
@@ -1329,6 +1341,8 @@ typedef struct gfc_namespace
gfc_charlen *cl_list, *old_cl_list;
+ gfc_dt_list *derived_types;
+
int save_all, seen_save, seen_implicit_none;
/* Normally we don't need to refcount namespaces. However when we read
@@ -1350,6 +1364,9 @@ typedef struct gfc_namespace
/* Set to 1 if resolved has been called for this namespace. */
int resolved;
+
+ /* Set to 1 if code has been generated for this namespace. */
+ int translated;
}
gfc_namespace;
@@ -2288,6 +2305,7 @@ void gfc_pop_error (gfc_error_buf *);
void gfc_free_error (gfc_error_buf *);
void gfc_get_errors (int *, int *);
+void gfc_errors_to_warnings (int);
/* arith.c */
void gfc_arith_init_1 (void);
@@ -2328,7 +2346,7 @@ gfc_try gfc_set_default_type (gfc_symbol *, int, gfc_namespace *);
void gfc_set_sym_referenced (gfc_symbol *);
gfc_try gfc_add_attribute (symbol_attribute *, locus *);
-gfc_try gfc_add_ext_attribute (symbol_attribute *, unsigned, locus *);
+gfc_try gfc_add_ext_attribute (symbol_attribute *, ext_attr_id_t, locus *);
gfc_try gfc_add_allocatable (symbol_attribute *, locus *);
gfc_try gfc_add_dimension (symbol_attribute *, const char *, locus *);
gfc_try gfc_add_external (symbol_attribute *, locus *);
@@ -2418,7 +2436,7 @@ int gfc_symbols_could_alias (gfc_symbol *, gfc_symbol *);
void gfc_undo_symbols (void);
void gfc_commit_symbols (void);
void gfc_commit_symbol (gfc_symbol *);
-gfc_charlen *gfc_new_charlen (gfc_namespace *);
+gfc_charlen *gfc_new_charlen (gfc_namespace *, gfc_charlen *);
void gfc_free_charlen (gfc_charlen *, gfc_charlen *);
void gfc_free_namespace (gfc_namespace *);
@@ -2440,6 +2458,10 @@ gfc_gsymbol *gfc_find_gsymbol (gfc_gsymbol *, const char *);
gfc_typebound_proc* gfc_get_typebound_proc (void);
gfc_symbol* gfc_get_derived_super_type (gfc_symbol*);
gfc_symtree* gfc_find_typebound_proc (gfc_symbol*, gfc_try*, const char*, bool);
+gfc_symtree* gfc_find_typebound_user_op (gfc_symbol*, gfc_try*,
+ const char*, bool);
+gfc_typebound_proc* gfc_find_typebound_intrinsic_op (gfc_symbol*, gfc_try*,
+ gfc_intrinsic_op, bool);
gfc_symtree* gfc_get_tbp_symtree (gfc_symtree**, const char*);
void gfc_copy_formal_args (gfc_symbol *, gfc_symbol *);
@@ -2628,6 +2650,7 @@ gfc_interface *gfc_current_interface_head (void);
void gfc_set_current_interface_head (gfc_interface *);
gfc_symtree* gfc_find_sym_in_symtree (gfc_symbol*);
bool gfc_arglist_matches_symbol (gfc_actual_arglist**, gfc_symbol*);
+bool gfc_check_operator_interface (gfc_symbol*, gfc_intrinsic_op, locus);
/* io.c */
extern gfc_st_label format_asterisk;
diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c
index a6f9b42b474..534fe897bfe 100644
--- a/gcc/fortran/gfortranspec.c
+++ b/gcc/fortran/gfortranspec.c
@@ -186,8 +186,6 @@ lookup_option (Option *xopt, int *xskip, const char **xarg, const char *text)
opt = OPTION_syntax_only;
else if (!strcmp (text, "-static-libgfortran"))
opt = OPTION_static_libgfortran;
- else if (!strcmp (text, "-dumpversion"))
- opt = OPTION_version;
else if (!strcmp (text, "-fversion")) /* Really --version!! */
opt = OPTION_version;
else if (!strcmp (text, "-Xlinker") || !strcmp (text, "-specs"))
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 982aa290e22..60096e20828 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -410,17 +410,17 @@ gfc_compare_derived_types (gfc_symbol *derived1, gfc_symbol *derived2)
/* Make sure that link lists do not put this function into an
endless recursive loop! */
- if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived)
- && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived)
+ if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived)
+ && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived)
&& gfc_compare_types (&dt1->ts, &dt2->ts) == 0)
return 0;
- else if ((dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived)
- && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived))
+ else if ((dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived)
+ && !(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived))
return 0;
- else if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived)
- && (dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.derived))
+ else if (!(dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived)
+ && (dt1->ts.type == BT_DERIVED && derived1 == dt1->ts.u.derived))
return 0;
dt1 = dt1->next;
@@ -454,10 +454,10 @@ gfc_compare_types (gfc_typespec *ts1, gfc_typespec *ts2)
return (ts1->kind == ts2->kind);
/* Compare derived types. */
- if (ts1->derived == ts2->derived)
+ if (ts1->u.derived == ts2->u.derived)
return 1;
- return gfc_compare_derived_types (ts1->derived ,ts2->derived);
+ return gfc_compare_derived_types (ts1->u.derived ,ts2->u.derived);
}
@@ -544,17 +544,16 @@ find_keyword_arg (const char *name, gfc_formal_arglist *f)
/* Given an operator interface and the operator, make sure that all
interfaces for that operator are legal. */
-static void
-check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
+bool
+gfc_check_operator_interface (gfc_symbol *sym, gfc_intrinsic_op op,
+ locus opwhere)
{
gfc_formal_arglist *formal;
sym_intent i1, i2;
- gfc_symbol *sym;
bt t1, t2;
int args, r1, r2, k1, k2;
- if (intr == NULL)
- return;
+ gcc_assert (sym);
args = 0;
t1 = t2 = BT_UNKNOWN;
@@ -562,34 +561,32 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
r1 = r2 = -1;
k1 = k2 = -1;
- for (formal = intr->sym->formal; formal; formal = formal->next)
+ for (formal = sym->formal; formal; formal = formal->next)
{
- sym = formal->sym;
- if (sym == NULL)
+ gfc_symbol *fsym = formal->sym;
+ if (fsym == NULL)
{
gfc_error ("Alternate return cannot appear in operator "
- "interface at %L", &intr->sym->declared_at);
- return;
+ "interface at %L", &sym->declared_at);
+ return false;
}
if (args == 0)
{
- t1 = sym->ts.type;
- i1 = sym->attr.intent;
- r1 = (sym->as != NULL) ? sym->as->rank : 0;
- k1 = sym->ts.kind;
+ t1 = fsym->ts.type;
+ i1 = fsym->attr.intent;
+ r1 = (fsym->as != NULL) ? fsym->as->rank : 0;
+ k1 = fsym->ts.kind;
}
if (args == 1)
{
- t2 = sym->ts.type;
- i2 = sym->attr.intent;
- r2 = (sym->as != NULL) ? sym->as->rank : 0;
- k2 = sym->ts.kind;
+ t2 = fsym->ts.type;
+ i2 = fsym->attr.intent;
+ r2 = (fsym->as != NULL) ? fsym->as->rank : 0;
+ k2 = fsym->ts.kind;
}
args++;
}
- sym = intr->sym;
-
/* Only +, - and .not. can be unary operators.
.not. cannot be a binary operator. */
if (args == 0 || args > 2 || (args == 1 && op != INTRINSIC_PLUS
@@ -598,8 +595,8 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
|| (args == 2 && op == INTRINSIC_NOT))
{
gfc_error ("Operator interface at %L has the wrong number of arguments",
- &intr->sym->declared_at);
- return;
+ &sym->declared_at);
+ return false;
}
/* Check that intrinsics are mapped to functions, except
@@ -609,20 +606,20 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
if (!sym->attr.subroutine)
{
gfc_error ("Assignment operator interface at %L must be "
- "a SUBROUTINE", &intr->sym->declared_at);
- return;
+ "a SUBROUTINE", &sym->declared_at);
+ return false;
}
if (args != 2)
{
gfc_error ("Assignment operator interface at %L must have "
- "two arguments", &intr->sym->declared_at);
- return;
+ "two arguments", &sym->declared_at);
+ return false;
}
/* Allowed are (per F2003, 12.3.2.1.2 Defined assignments):
- - First argument an array with different rank than second,
- - Types and kinds do not conform, and
- - First argument is of derived type. */
+ - First argument an array with different rank than second,
+ - Types and kinds do not conform, and
+ - First argument is of derived type. */
if (sym->formal->sym->ts.type != BT_DERIVED
&& (r1 == 0 || r1 == r2)
&& (sym->formal->sym->ts.type == sym->formal->next->sym->ts.type
@@ -630,8 +627,8 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
&& gfc_numeric_ts (&sym->formal->next->sym->ts))))
{
gfc_error ("Assignment operator interface at %L must not redefine "
- "an INTRINSIC type assignment", &intr->sym->declared_at);
- return;
+ "an INTRINSIC type assignment", &sym->declared_at);
+ return false;
}
}
else
@@ -639,8 +636,8 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
if (!sym->attr.function)
{
gfc_error ("Intrinsic operator interface at %L must be a FUNCTION",
- &intr->sym->declared_at);
- return;
+ &sym->declared_at);
+ return false;
}
}
@@ -648,22 +645,34 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
if (op == INTRINSIC_ASSIGN)
{
if (i1 != INTENT_OUT && i1 != INTENT_INOUT)
- gfc_error ("First argument of defined assignment at %L must be "
- "INTENT(OUT) or INTENT(INOUT)", &intr->sym->declared_at);
+ {
+ gfc_error ("First argument of defined assignment at %L must be "
+ "INTENT(OUT) or INTENT(INOUT)", &sym->declared_at);
+ return false;
+ }
if (i2 != INTENT_IN)
- gfc_error ("Second argument of defined assignment at %L must be "
- "INTENT(IN)", &intr->sym->declared_at);
+ {
+ gfc_error ("Second argument of defined assignment at %L must be "
+ "INTENT(IN)", &sym->declared_at);
+ return false;
+ }
}
else
{
if (i1 != INTENT_IN)
- gfc_error ("First argument of operator interface at %L must be "
- "INTENT(IN)", &intr->sym->declared_at);
+ {
+ gfc_error ("First argument of operator interface at %L must be "
+ "INTENT(IN)", &sym->declared_at);
+ return false;
+ }
if (args == 2 && i2 != INTENT_IN)
- gfc_error ("Second argument of operator interface at %L must be "
- "INTENT(IN)", &intr->sym->declared_at);
+ {
+ gfc_error ("Second argument of operator interface at %L must be "
+ "INTENT(IN)", &sym->declared_at);
+ return false;
+ }
}
/* From now on, all we have to do is check that the operator definition
@@ -686,7 +695,7 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
if (t1 == BT_LOGICAL)
goto bad_repl;
else
- return;
+ return true;
}
if (args == 1 && (op == INTRINSIC_PLUS || op == INTRINSIC_MINUS))
@@ -694,20 +703,20 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
if (IS_NUMERIC_TYPE (t1))
goto bad_repl;
else
- return;
+ return true;
}
/* Character intrinsic operators have same character kind, thus
operator definitions with operands of different character kinds
are always safe. */
if (t1 == BT_CHARACTER && t2 == BT_CHARACTER && k1 != k2)
- return;
+ return true;
/* Intrinsic operators always perform on arguments of same rank,
so different ranks is also always safe. (rank == 0) is an exception
to that, because all intrinsic operators are elemental. */
if (r1 != r2 && r1 != 0 && r2 != 0)
- return;
+ return true;
switch (op)
{
@@ -760,14 +769,14 @@ check_operator_interface (gfc_interface *intr, gfc_intrinsic_op op)
break;
}
- return;
+ return true;
#undef IS_NUMERIC_TYPE
bad_repl:
gfc_error ("Operator interface at %L conflicts with intrinsic interface",
- &intr->where);
- return;
+ &opwhere);
+ return false;
}
@@ -1229,7 +1238,9 @@ gfc_check_interfaces (gfc_namespace *ns)
if (check_interface0 (ns->op[i], interface_name))
continue;
- check_operator_interface (ns->op[i], (gfc_intrinsic_op) i);
+ if (ns->op[i])
+ gfc_check_operator_interface (ns->op[i]->sym, (gfc_intrinsic_op) i,
+ ns->op[i]->where);
for (ns2 = ns; ns2; ns2 = ns2->parent)
{
@@ -1375,9 +1386,9 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual,
return 1;
if (formal->ts.type == BT_DERIVED
- && formal->ts.derived && formal->ts.derived->ts.is_iso_c
+ && formal->ts.u.derived && formal->ts.u.derived->ts.is_iso_c
&& actual->ts.type == BT_DERIVED
- && actual->ts.derived && actual->ts.derived->ts.is_iso_c)
+ && actual->ts.u.derived && actual->ts.u.derived->ts.is_iso_c)
return 1;
if (actual->ts.type == BT_PROCEDURE)
@@ -1540,9 +1551,9 @@ get_sym_storage_size (gfc_symbol *sym)
if (sym->ts.type == BT_CHARACTER)
{
- if (sym->ts.cl && sym->ts.cl->length
- && sym->ts.cl->length->expr_type == EXPR_CONSTANT)
- strlen = mpz_get_ui (sym->ts.cl->length->value.integer);
+ if (sym->ts.u.cl && sym->ts.u.cl->length
+ && sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
+ strlen = mpz_get_ui (sym->ts.u.cl->length->value.integer);
else
return 0;
}
@@ -1588,11 +1599,11 @@ get_expr_storage_size (gfc_expr *e)
if (e->ts.type == BT_CHARACTER)
{
- if (e->ts.cl && e->ts.cl->length
- && e->ts.cl->length->expr_type == EXPR_CONSTANT)
- strlen = mpz_get_si (e->ts.cl->length->value.integer);
+ if (e->ts.u.cl && e->ts.u.cl->length
+ && e->ts.u.cl->length->expr_type == EXPR_CONSTANT)
+ strlen = mpz_get_si (e->ts.u.cl->length->value.integer);
else if (e->expr_type == EXPR_CONSTANT
- && (e->ts.cl == NULL || e->ts.cl->length == NULL))
+ && (e->ts.u.cl == NULL || e->ts.u.cl->length == NULL))
strlen = e->value.character.length;
else
return 0;
@@ -1858,28 +1869,28 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
and assumed-shape dummies, the string length needs to match
exactly. */
if (a->expr->ts.type == BT_CHARACTER
- && a->expr->ts.cl && a->expr->ts.cl->length
- && a->expr->ts.cl->length->expr_type == EXPR_CONSTANT
- && f->sym->ts.cl && f->sym->ts.cl && f->sym->ts.cl->length
- && f->sym->ts.cl->length->expr_type == EXPR_CONSTANT
+ && a->expr->ts.u.cl && a->expr->ts.u.cl->length
+ && a->expr->ts.u.cl->length->expr_type == EXPR_CONSTANT
+ && f->sym->ts.u.cl && f->sym->ts.u.cl && f->sym->ts.u.cl->length
+ && f->sym->ts.u.cl->length->expr_type == EXPR_CONSTANT
&& (f->sym->attr.pointer || f->sym->attr.allocatable
|| (f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE))
- && (mpz_cmp (a->expr->ts.cl->length->value.integer,
- f->sym->ts.cl->length->value.integer) != 0))
+ && (mpz_cmp (a->expr->ts.u.cl->length->value.integer,
+ f->sym->ts.u.cl->length->value.integer) != 0))
{
if (where && (f->sym->attr.pointer || f->sym->attr.allocatable))
gfc_warning ("Character length mismatch (%ld/%ld) between actual "
"argument and pointer or allocatable dummy argument "
"'%s' at %L",
- mpz_get_si (a->expr->ts.cl->length->value.integer),
- mpz_get_si (f->sym->ts.cl->length->value.integer),
+ mpz_get_si (a->expr->ts.u.cl->length->value.integer),
+ mpz_get_si (f->sym->ts.u.cl->length->value.integer),
f->sym->name, &a->expr->where);
else if (where)
gfc_warning ("Character length mismatch (%ld/%ld) between actual "
"argument and assumed-shape dummy argument '%s' "
"at %L",
- mpz_get_si (a->expr->ts.cl->length->value.integer),
- mpz_get_si (f->sym->ts.cl->length->value.integer),
+ mpz_get_si (a->expr->ts.u.cl->length->value.integer),
+ mpz_get_si (f->sym->ts.u.cl->length->value.integer),
f->sym->name, &a->expr->where);
return 0;
}
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index 76cf6199abe..f11ea38f729 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -111,7 +111,7 @@ typedef enum
FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_LPAREN,
FMT_RPAREN, FMT_X, FMT_SIGN, FMT_BLANK, FMT_CHAR, FMT_P, FMT_IBOZ, FMT_F,
FMT_E, FMT_EXT, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_ERROR, FMT_DC,
- FMT_DP, FMT_T, FMT_TR, FMT_TL
+ FMT_DP, FMT_T, FMT_TR, FMT_TL, FMT_STAR
}
format_token;
@@ -469,6 +469,10 @@ format_lex (void)
token = FMT_END;
break;
+ case '*':
+ token = FMT_STAR;
+ break;
+
default:
token = FMT_UNKNOWN;
break;
@@ -533,6 +537,19 @@ format_item:
format_item_1:
switch (t)
{
+ case FMT_STAR:
+ repeat = -1;
+ t = format_lex ();
+ if (t == FMT_ERROR)
+ goto fail;
+ if (t == FMT_LPAREN)
+ {
+ level++;
+ goto format_item;
+ }
+ error = _("Left parenthesis required after '*'");
+ goto syntax;
+
case FMT_POSINT:
repeat = value;
t = format_lex ();
@@ -575,7 +592,7 @@ format_item_1:
case FMT_X:
/* X requires a prior number if we're being pedantic. */
if (gfc_notify_std (GFC_STD_GNU, "Extension: X descriptor "
- "requires leading space count at %C")
+ "requires leading space count at %L", &format_locus)
== FAILURE)
return FAILURE;
goto between_desc;
@@ -598,12 +615,13 @@ format_item_1:
if (t == FMT_ERROR)
goto fail;
- if (gfc_notify_std (GFC_STD_GNU, "Extension: $ descriptor at %C")
- == FAILURE)
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: $ descriptor at %L",
+ &format_locus) == FAILURE)
return FAILURE;
if (t != FMT_RPAREN || level > 0)
{
- gfc_warning ("$ should be the last specifier in format at %C");
+ gfc_warning ("$ should be the last specifier in format at %L",
+ &format_locus);
goto optional_comma_1;
}
@@ -682,8 +700,10 @@ data_desc:
switch (gfc_notification_std (GFC_STD_GNU))
{
case WARNING:
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
gfc_warning ("Extension: Missing positive width after L "
- "descriptor at %C");
+ "descriptor at %L", &format_locus);
saved_token = t;
break;
@@ -726,7 +746,7 @@ data_desc:
goto syntax;
}
if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: 'G0' in "
- "format at %C") == FAILURE)
+ "format at %L", &format_locus) == FAILURE)
return FAILURE;
u = format_lex ();
if (u != FMT_PERIOD)
@@ -756,10 +776,14 @@ data_desc:
if (u != FMT_PERIOD)
{
/* Warn if -std=legacy, otherwise error. */
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
if (gfc_option.warn_std != 0)
- gfc_error_now ("Period required in format specifier at %C");
+ gfc_error_now ("Period required in format specifier at %L",
+ &format_locus);
else
- gfc_warning ("Period required in format specifier at %C");
+ gfc_warning ("Period required in format specifier at %L",
+ &format_locus);
saved_token = u;
break;
}
@@ -819,10 +843,15 @@ data_desc:
if (t != FMT_PERIOD)
{
/* Warn if -std=legacy, otherwise error. */
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
if (gfc_option.warn_std != 0)
- gfc_error_now ("Period required in format specifier at %C");
- else
- gfc_warning ("Period required in format specifier at %C");
+ {
+ error = _("Period required in format specifier at %L");
+ goto syntax;
+ }
+ gfc_warning ("Period required in format specifier at %L",
+ &format_locus);
saved_token = t;
break;
}
@@ -840,8 +869,12 @@ data_desc:
case FMT_H:
if (!(gfc_option.allow_std & GFC_STD_GNU) && !inhibit_warnings)
- gfc_warning ("The H format specifier at %C is"
- " a Fortran 95 deleted feature");
+ {
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
+ gfc_warning ("The H format specifier at %L is"
+ " a Fortran 95 deleted feature", &format_locus);
+ }
if (mode == MODE_STRING)
{
@@ -925,8 +958,10 @@ between_desc:
goto syntax;
default:
- if (gfc_notify_std (GFC_STD_GNU, "Extension: Missing comma at %C")
- == FAILURE)
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: Missing comma at %L",
+ &format_locus) == FAILURE)
return FAILURE;
goto format_item_1;
}
@@ -982,15 +1017,17 @@ extension_optional_comma:
goto syntax;
default:
- if (gfc_notify_std (GFC_STD_GNU, "Extension: Missing comma at %C")
- == FAILURE)
+ if (mode != MODE_FORMAT)
+ format_locus.nextc += format_string_pos;
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: Missing comma at %L",
+ &format_locus) == FAILURE)
return FAILURE;
saved_token = t;
break;
}
goto format_item;
-
+
syntax:
if (mode != MODE_FORMAT)
format_locus.nextc += format_string_pos;
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index fdbf40c4408..ee8609e696b 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -62,16 +62,16 @@ gfc_get_string (const char *format, ...)
static void
check_charlen_present (gfc_expr *source)
{
- if (source->ts.cl == NULL)
- source->ts.cl = gfc_new_charlen (gfc_current_ns);
+ if (source->ts.u.cl == NULL)
+ source->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
if (source->expr_type == EXPR_CONSTANT)
{
- source->ts.cl->length = gfc_int_expr (source->value.character.length);
+ source->ts.u.cl->length = gfc_int_expr (source->value.character.length);
source->rank = 0;
}
else if (source->expr_type == EXPR_ARRAY)
- source->ts.cl->length =
+ source->ts.u.cl->length =
gfc_int_expr (source->value.constructor->expr->value.character.length);
}
@@ -161,8 +161,8 @@ gfc_resolve_char_achar (gfc_expr *f, gfc_expr *x, gfc_expr *kind,
f->ts.type = BT_CHARACTER;
f->ts.kind = (kind == NULL)
? gfc_default_character_kind : mpz_get_si (kind->value.integer);
- f->ts.cl = gfc_new_charlen (gfc_current_ns);
- f->ts.cl->length = gfc_int_expr (1);
+ f->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
+ f->ts.u.cl->length = gfc_int_expr (1);
f->value.function.name = gfc_get_string (name, f->ts.kind,
gfc_type_letter (x->ts.type),
@@ -651,8 +651,8 @@ gfc_resolve_ctime (gfc_expr *f, gfc_expr *time)
{
ts.type = BT_INTEGER;
ts.kind = 8;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (time, &ts, 2);
}
@@ -1058,8 +1058,8 @@ gfc_resolve_index_func (gfc_expr *f, gfc_expr *str,
{
ts.type = BT_LOGICAL;
ts.kind = gfc_default_integer_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (back, &ts, 2);
}
@@ -1125,8 +1125,8 @@ gfc_resolve_isatty (gfc_expr *f, gfc_expr *u)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (u, &ts, 2);
}
@@ -2175,8 +2175,8 @@ gfc_resolve_fgetc (gfc_expr *f, gfc_expr *u, gfc_expr *c ATTRIBUTE_UNUSED)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (u, &ts, 2);
}
@@ -2205,8 +2205,8 @@ gfc_resolve_fputc (gfc_expr *f, gfc_expr *u, gfc_expr *c ATTRIBUTE_UNUSED)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (u, &ts, 2);
}
@@ -2235,8 +2235,8 @@ gfc_resolve_ftell (gfc_expr *f, gfc_expr *u)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (u, &ts, 2);
}
@@ -2340,9 +2340,19 @@ gfc_resolve_transfer (gfc_expr *f, gfc_expr *source ATTRIBUTE_UNUSED,
/* TODO: Make this do something meaningful. */
static char transfer0[] = "__transfer0", transfer1[] = "__transfer1";
- if (mold->ts.type == BT_CHARACTER && !mold->ts.cl->length
- && !(mold->expr_type == EXPR_VARIABLE && mold->symtree->n.sym->attr.dummy))
- mold->ts.cl->length = gfc_int_expr (mold->value.character.length);
+ if (mold->ts.type == BT_CHARACTER
+ && !mold->ts.u.cl->length
+ && gfc_is_constant_expr (mold))
+ {
+ int len;
+ if (mold->expr_type == EXPR_CONSTANT)
+ mold->ts.u.cl->length = gfc_int_expr (mold->value.character.length);
+ else
+ {
+ len = mold->value.constructor->expr->value.character.length;
+ mold->ts.u.cl->length = gfc_int_expr (len);
+ }
+ }
f->ts = mold->ts;
@@ -2488,8 +2498,8 @@ gfc_resolve_ttynam (gfc_expr *f, gfc_expr *unit)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (unit, &ts, 2);
}
@@ -3067,8 +3077,8 @@ gfc_resolve_ctime_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = 8;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (c->ext.actual->expr, &ts, 2);
}
@@ -3170,8 +3180,8 @@ gfc_resolve_fgetc_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (u, &ts, 2);
}
@@ -3215,8 +3225,8 @@ gfc_resolve_fputc_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (u, &ts, 2);
}
@@ -3264,8 +3274,8 @@ gfc_resolve_fseek_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (unit, &ts, 2);
}
@@ -3273,8 +3283,8 @@ gfc_resolve_fseek_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_intio_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (offset, &ts, 2);
}
@@ -3282,8 +3292,8 @@ gfc_resolve_fseek_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (whence, &ts, 2);
}
@@ -3306,8 +3316,8 @@ gfc_resolve_ftell_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (unit, &ts, 2);
}
@@ -3326,8 +3336,8 @@ gfc_resolve_ttynam_sub (gfc_code *c)
{
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
- ts.derived = NULL;
- ts.cl = NULL;
+ ts.u.derived = NULL;
+ ts.u.cl = NULL;
gfc_convert_type (c->ext.actual->expr, &ts, 2);
}
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 9de4da25b7b..3c6ef49ed2b 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1383,8 +1383,8 @@ match_arithmetic_if (void)
return MATCH_ERROR;
}
- if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent: arithmetic IF statement "
- "at %C") == FAILURE)
+ if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: Arithmetic IF "
+ "statement at %C") == FAILURE)
return MATCH_ERROR;
new_st.op = EXEC_ARITHMETIC_IF;
@@ -1464,7 +1464,7 @@ gfc_match_if (gfc_statement *if_type)
return MATCH_ERROR;
}
- if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent: arithmetic IF "
+ if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: Arithmetic IF "
"statement at %C") == FAILURE)
return MATCH_ERROR;
@@ -2180,6 +2180,10 @@ gfc_match_goto (void)
if (gfc_match (" %e%t", &expr) != MATCH_YES)
goto syntax;
+ if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: Computed GOTO "
+ "at %C") == FAILURE)
+ return MATCH_ERROR;
+
/* At this point, a computed GOTO has been fully matched and an
equivalent SELECT statement constructed. */
@@ -2260,7 +2264,7 @@ gfc_match_allocate (void)
}
if (tail->expr->ts.type == BT_DERIVED)
- tail->expr->ts.derived = gfc_use_derived (tail->expr->ts.derived);
+ tail->expr->ts.u.derived = gfc_use_derived (tail->expr->ts.u.derived);
/* FIXME: disable the checking on derived types and arrays. */
if (!(tail->expr->ref
@@ -2580,6 +2584,10 @@ gfc_match_return (void)
goto cleanup;
}
+ if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: Alternate RETURN "
+ "at %C") == FAILURE)
+ return MATCH_ERROR;
+
if (gfc_current_form == FORM_FREE)
{
/* The following are valid, so we can't require a blank after the
@@ -3206,7 +3214,7 @@ gfc_match_namelist (void)
gfc_error_check ();
}
- if (sym->ts.type == BT_CHARACTER && sym->ts.cl->length == NULL)
+ if (sym->ts.type == BT_CHARACTER && sym->ts.u.cl->length == NULL)
{
gfc_error ("Assumed character length '%s' in namelist '%s' at "
"%C is not allowed", sym->name, group_name->name);
@@ -3517,6 +3525,10 @@ gfc_match_st_function (void)
sym->value = expr;
+ if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
+ "Statement function at %C") == FAILURE)
+ return MATCH_ERROR;
+
return MATCH_YES;
undo_error:
diff --git a/gcc/fortran/misc.c b/gcc/fortran/misc.c
index 94d61c9ec86..f80c9fa6af7 100644
--- a/gcc/fortran/misc.c
+++ b/gcc/fortran/misc.c
@@ -67,10 +67,11 @@ void
gfc_clear_ts (gfc_typespec *ts)
{
ts->type = BT_UNKNOWN;
- ts->derived = NULL;
+ ts->u.derived = NULL;
ts->kind = 0;
- ts->cl = NULL;
+ ts->u.cl = NULL;
ts->interface = NULL;
+ ts->is_class = 0;
/* flag that says if the type is C interoperable */
ts->is_c_interop = 0;
/* says what f90 type the C kind interops with */
@@ -183,7 +184,7 @@ gfc_typename (gfc_typespec *ts)
sprintf (buffer, "HOLLERITH");
break;
case BT_DERIVED:
- sprintf (buffer, "TYPE(%s)", ts->derived->name);
+ sprintf (buffer, "TYPE(%s)", ts->u.derived->name);
break;
case BT_PROCEDURE:
strcpy (buffer, "PROCEDURE");
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index eff482ca686..c791797d7dd 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -1752,6 +1752,7 @@ static void
mio_symbol_attribute (symbol_attribute *attr)
{
atom_type t;
+ unsigned ext_attr;
mio_lparen ();
@@ -1760,6 +1761,9 @@ mio_symbol_attribute (symbol_attribute *attr)
attr->proc = MIO_NAME (procedure_type) (attr->proc, procedures);
attr->if_source = MIO_NAME (ifsrc) (attr->if_source, ifsrc_types);
attr->save = MIO_NAME (save_state) (attr->save, save_status);
+ ext_attr = attr->ext_attr;
+ mio_integer ((int *) &ext_attr);
+ attr->ext_attr = ext_attr;
if (iomode == IO_OUTPUT)
{
@@ -2005,7 +2009,7 @@ mio_charlen (gfc_charlen **clp)
{
if (peek_atom () != ATOM_RPAREN)
{
- cl = gfc_new_charlen (gfc_current_ns);
+ cl = gfc_new_charlen (gfc_current_ns, NULL);
mio_expr (&cl->length);
*clp = cl;
}
@@ -2034,7 +2038,7 @@ mio_typespec (gfc_typespec *ts)
if (ts->type != BT_DERIVED)
mio_integer (&ts->kind);
else
- mio_symbol_ref (&ts->derived);
+ mio_symbol_ref (&ts->u.derived);
/* Add info for C interop and is_iso_c. */
mio_integer (&ts->is_c_interop);
@@ -2050,12 +2054,12 @@ mio_typespec (gfc_typespec *ts)
if (ts->type != BT_CHARACTER)
{
- /* ts->cl is only valid for BT_CHARACTER. */
+ /* ts->u.cl is only valid for BT_CHARACTER. */
mio_lparen ();
mio_rparen ();
}
else
- mio_charlen (&ts->cl);
+ mio_charlen (&ts->u.cl);
mio_rparen ();
}
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 320fb65c97c..d60121c5929 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -873,7 +873,7 @@ resolve_omp_clauses (gfc_code *code)
if (!n->sym->attr.threadprivate)
gfc_error ("Non-THREADPRIVATE object '%s' in COPYIN clause"
" at %L", n->sym->name, &code->loc);
- if (n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp)
+ if (n->sym->ts.type == BT_DERIVED && n->sym->ts.u.derived->attr.alloc_comp)
gfc_error ("COPYIN clause object '%s' at %L has ALLOCATABLE components",
n->sym->name, &code->loc);
}
@@ -884,7 +884,7 @@ resolve_omp_clauses (gfc_code *code)
if (n->sym->as && n->sym->as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array '%s' in COPYPRIVATE clause "
"at %L", n->sym->name, &code->loc);
- if (n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp)
+ if (n->sym->ts.type == BT_DERIVED && n->sym->ts.u.derived->attr.alloc_comp)
gfc_error ("COPYPRIVATE clause object '%s' at %L has ALLOCATABLE components",
n->sym->name, &code->loc);
}
@@ -916,7 +916,7 @@ resolve_omp_clauses (gfc_code *code)
n->sym->name, name, &code->loc);
/* Variables in REDUCTION-clauses must be of intrinsic type (flagged below). */
if ((list < OMP_LIST_REDUCTION_FIRST || list > OMP_LIST_REDUCTION_LAST) &&
- n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp)
+ n->sym->ts.type == BT_DERIVED && n->sym->ts.u.derived->attr.alloc_comp)
gfc_error ("%s clause object '%s' has ALLOCATABLE components at %L",
name, n->sym->name, &code->loc);
if (n->sym->attr.cray_pointer)
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index ff0a80983da..3e20f8e45d4 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -371,6 +371,9 @@ gfc_post_options (const char **pfilename)
gfc_option.warn_tabs = 0;
}
+ if (pedantic && gfc_option.flag_whole_file)
+ gfc_option.flag_whole_file = 2;
+
gfc_cpp_post_options ();
/* FIXME: return gfc_cpp_preprocess_only ();
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index da16c2b570f..2552fcd6788 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -2049,24 +2049,24 @@ endType:
{
/* Look for allocatable components. */
if (c->attr.allocatable
- || (c->ts.type == BT_DERIVED && c->ts.derived->attr.alloc_comp))
+ || (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.alloc_comp))
sym->attr.alloc_comp = 1;
/* Look for pointer components. */
if (c->attr.pointer
- || (c->ts.type == BT_DERIVED && c->ts.derived->attr.pointer_comp))
+ || (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.pointer_comp))
sym->attr.pointer_comp = 1;
/* Look for procedure pointer components. */
if (c->attr.proc_pointer
|| (c->ts.type == BT_DERIVED
- && c->ts.derived->attr.proc_pointer_comp))
+ && c->ts.u.derived->attr.proc_pointer_comp))
sym->attr.proc_pointer_comp = 1;
/* Look for private components. */
if (sym->component_access == ACCESS_PRIVATE
|| c->attr.access == ACCESS_PRIVATE
- || (c->ts.type == BT_DERIVED && c->ts.derived->attr.private_comp))
+ || (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.private_comp))
sym->attr.private_comp = 1;
}
@@ -2320,7 +2320,7 @@ match_deferred_characteristics (gfc_typespec * ts)
{
ts->kind = 0;
- if (!ts->derived || !ts->derived->components)
+ if (!ts->u.derived || !ts->u.derived->components)
m = MATCH_ERROR;
}
@@ -2360,8 +2360,8 @@ check_function_result_typed (void)
/* Check type-parameters, at the moment only CHARACTER lengths possible. */
/* TODO: Extend when KIND type parameters are implemented. */
- if (ts->type == BT_CHARACTER && ts->cl && ts->cl->length)
- gfc_expr_check_typed (ts->cl->length, gfc_current_ns, true);
+ if (ts->type == BT_CHARACTER && ts->u.cl && ts->u.cl->length)
+ gfc_expr_check_typed (ts->u.cl->length, gfc_current_ns, true);
}
@@ -2540,7 +2540,7 @@ declSt:
gfc_current_block ()->ts.kind = 0;
/* Keep the derived type; if it's bad, it will be discovered later. */
- if (!(ts->type == BT_DERIVED && ts->derived))
+ if (!(ts->type == BT_DERIVED && ts->u.derived))
ts->type = BT_UNKNOWN;
}
@@ -3760,6 +3760,8 @@ loop:
st = next_statement ();
goto loop;
}
+
+ s->ns = gfc_current_ns;
}
@@ -3809,6 +3811,76 @@ add_global_program (void)
}
+/* Resolve all the program units when whole file scope option
+ is active. */
+static void
+resolve_all_program_units (gfc_namespace *gfc_global_ns_list)
+{
+ gfc_free_dt_list ();
+ gfc_current_ns = gfc_global_ns_list;
+ for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling)
+ {
+ gfc_current_locus = gfc_current_ns->proc_name->declared_at;
+ gfc_resolve (gfc_current_ns);
+ gfc_current_ns->derived_types = gfc_derived_types;
+ gfc_derived_types = NULL;
+ }
+}
+
+
+static void
+clean_up_modules (gfc_gsymbol *gsym)
+{
+ if (gsym == NULL)
+ return;
+
+ clean_up_modules (gsym->left);
+ clean_up_modules (gsym->right);
+
+ if (gsym->type != GSYM_MODULE || !gsym->ns)
+ return;
+
+ gfc_current_ns = gsym->ns;
+ gfc_derived_types = gfc_current_ns->derived_types;
+ gfc_done_2 ();
+ gsym->ns = NULL;
+ return;
+}
+
+
+/* Translate all the program units when whole file scope option
+ is active. This could be in a different order to resolution if
+ there are forward references in the file. */
+static void
+translate_all_program_units (gfc_namespace *gfc_global_ns_list)
+{
+ int errors;
+
+ gfc_current_ns = gfc_global_ns_list;
+ gfc_get_errors (NULL, &errors);
+
+ for (; !errors && gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling)
+ {
+ gfc_current_locus = gfc_current_ns->proc_name->declared_at;
+ gfc_derived_types = gfc_current_ns->derived_types;
+ gfc_generate_code (gfc_current_ns);
+ gfc_current_ns->translated = 1;
+ }
+
+ /* Clean up all the namespaces after translation. */
+ gfc_current_ns = gfc_global_ns_list;
+ for (;gfc_current_ns;)
+ {
+ gfc_namespace *ns = gfc_current_ns->sibling;
+ gfc_derived_types = gfc_current_ns->derived_types;
+ gfc_done_2 ();
+ gfc_current_ns = ns;
+ }
+
+ clean_up_modules (gfc_gsym_root);
+}
+
+
/* Top level parser. */
gfc_try
@@ -3933,15 +4005,24 @@ loop:
gfc_dump_module (s.sym->name, errors_before == errors);
if (errors == 0)
gfc_generate_module_code (gfc_current_ns);
+ pop_state ();
+ if (!gfc_option.flag_whole_file)
+ gfc_done_2 ();
+ else
+ {
+ gfc_current_ns->derived_types = gfc_derived_types;
+ gfc_derived_types = NULL;
+ gfc_current_ns = NULL;
+ }
}
else
{
if (errors == 0)
gfc_generate_code (gfc_current_ns);
+ pop_state ();
+ gfc_done_2 ();
}
- pop_state ();
- gfc_done_2 ();
goto loop;
prog_units:
@@ -3964,35 +4045,23 @@ prog_units:
if (!gfc_option.flag_whole_file)
goto termination;
- /* Do the resolution. */
- gfc_current_ns = gfc_global_ns_list;
- for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling)
- {
- gfc_current_locus = gfc_current_ns->proc_name->declared_at;
- gfc_resolve (gfc_current_ns);
- }
+ /* Do the resolution. */
+ resolve_all_program_units (gfc_global_ns_list);
/* Do the parse tree dump. */
- gfc_current_ns = gfc_option.dump_parse_tree ? gfc_global_ns_list : NULL;
+ gfc_current_ns
+ = gfc_option.dump_parse_tree ? gfc_global_ns_list : NULL;
+
for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling)
{
gfc_dump_parse_tree (gfc_current_ns, stdout);
- fputs ("-----------------------------------------\n\n", stdout);
+ fputs ("------------------------------------------\n\n", stdout);
}
- gfc_current_ns = gfc_global_ns_list;
- gfc_get_errors (NULL, &errors);
-
- /* Do the translation. This could be in a different order to
- resolution if there are forward references in the file. */
- for (; !errors && gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling)
- {
- gfc_current_locus = gfc_current_ns->proc_name->declared_at;
- gfc_generate_code (gfc_current_ns);
- }
+ /* Do the translation. */
+ translate_all_program_units (gfc_global_ns_list);
termination:
- gfc_free_dt_list ();
gfc_end_source_files ();
return SUCCESS;
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 0d52c6c0940..e0021c54b18 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1770,7 +1770,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
if (sym->ts.type != BT_DERIVED || gfc_match_char ('%') != MATCH_YES)
goto check_substring;
- sym = sym->ts.derived;
+ sym = sym->ts.u.derived;
for (;;)
{
@@ -1864,7 +1864,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
|| gfc_match_char ('%') != MATCH_YES)
break;
- sym = component->ts.derived;
+ sym = component->ts.u.derived;
}
check_substring:
@@ -1881,7 +1881,7 @@ check_substring:
if (primary->ts.type == BT_CHARACTER)
{
- switch (match_substring (primary->ts.cl, equiv_flag, &substring))
+ switch (match_substring (primary->ts.u.cl, equiv_flag, &substring))
{
case MATCH_YES:
if (tail == NULL)
@@ -1893,7 +1893,7 @@ check_substring:
primary->expr_type = EXPR_SUBSTRING;
if (substring)
- primary->ts.cl = NULL;
+ primary->ts.u.cl = NULL;
break;
@@ -1990,7 +1990,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
follows. */
if (ts->type == BT_CHARACTER
&& ref->next && ref->next->type == REF_SUBSTRING)
- ts->cl = NULL;
+ ts->u.cl = NULL;
}
pointer = ref->u.c.component->attr.pointer;
@@ -2106,7 +2106,7 @@ build_actual_constructor (gfc_structure_ctor_component **comp_head,
value->where = gfc_current_locus;
if (build_actual_constructor (comp_head, &value->value.constructor,
- comp->ts.derived) == FAILURE)
+ comp->ts.u.derived) == FAILURE)
{
gfc_free_expr (value);
return FAILURE;
@@ -2284,13 +2284,13 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result,
&& sym->attr.extension
&& (comp_tail->val->ts.type != BT_DERIVED
||
- comp_tail->val->ts.derived != this_comp->ts.derived))
+ comp_tail->val->ts.u.derived != this_comp->ts.u.derived))
{
gfc_current_locus = where;
gfc_free_expr (comp_tail->val);
comp_tail->val = NULL;
- m = gfc_match_structure_constructor (comp->ts.derived,
+ m = gfc_match_structure_constructor (comp->ts.u.derived,
&comp_tail->val, true);
if (m == MATCH_NO)
goto syntax;
@@ -2335,7 +2335,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result,
e->expr_type = EXPR_STRUCTURE;
e->ts.type = BT_DERIVED;
- e->ts.derived = sym;
+ e->ts.u.derived = sym;
e->where = where;
e->value.constructor = ctor_head;
@@ -2758,7 +2758,7 @@ gfc_match_rvalue (gfc_expr **result)
that we're not sure is a variable yet. */
if ((implicit_char || sym->ts.type == BT_CHARACTER)
- && match_substring (sym->ts.cl, 0, &e->ref) == MATCH_YES)
+ && match_substring (sym->ts.u.cl, 0, &e->ref) == MATCH_YES)
{
e->expr_type = EXPR_VARIABLE;
@@ -2780,7 +2780,7 @@ gfc_match_rvalue (gfc_expr **result)
e->ts = sym->ts;
if (e->ref)
- e->ts.cl = NULL;
+ e->ts.u.cl = NULL;
m = MATCH_YES;
break;
}
@@ -2957,7 +2957,7 @@ match_variable (gfc_expr **result, int equiv_flag, int host_flag)
type may still have to be resolved. */
if (sym->ts.type == BT_DERIVED
- && gfc_use_derived (sym->ts.derived) == NULL)
+ && gfc_use_derived (sym->ts.u.derived) == NULL)
return MATCH_ERROR;
break;
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 053ec839a08..4f99aba0708 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -103,16 +103,16 @@ is_sym_host_assoc (gfc_symbol *sym, gfc_namespace *ns)
static gfc_try
resolve_typespec_used (gfc_typespec* ts, locus* where, const char* name)
{
- if (ts->type == BT_DERIVED && ts->derived->attr.abstract)
+ if (ts->type == BT_DERIVED && ts->u.derived->attr.abstract)
{
if (where)
{
if (name)
gfc_error ("'%s' at %L is of the ABSTRACT type '%s'",
- name, where, ts->derived->name);
+ name, where, ts->u.derived->name);
else
gfc_error ("ABSTRACT type '%s' used at %L",
- ts->derived->name, where);
+ ts->u.derived->name, where);
}
return FAILURE;
@@ -294,7 +294,7 @@ resolve_formal_arglist (gfc_symbol *proc)
if (sym->ts.type == BT_CHARACTER)
{
- gfc_charlen *cl = sym->ts.cl;
+ gfc_charlen *cl = sym->ts.u.cl;
if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
{
gfc_error ("Character-valued argument '%s' of statement "
@@ -372,7 +372,7 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns)
if (sym->result->ts.type == BT_CHARACTER)
{
- gfc_charlen *cl = sym->result->ts.cl;
+ gfc_charlen *cl = sym->result->ts.u.cl;
if (!cl || !cl->length)
gfc_error ("Character-valued internal function '%s' at %L must "
"not be assumed length", sym->name, &sym->declared_at);
@@ -552,16 +552,16 @@ resolve_entries (gfc_namespace *ns)
the same string length, i.e. both len=*, or both len=4.
Having both len=<variable> is also possible, but difficult to
check at compile time. */
- else if (ts->type == BT_CHARACTER && ts->cl && fts->cl
- && (((ts->cl->length && !fts->cl->length)
- ||(!ts->cl->length && fts->cl->length))
- || (ts->cl->length
- && ts->cl->length->expr_type
- != fts->cl->length->expr_type)
- || (ts->cl->length
- && ts->cl->length->expr_type == EXPR_CONSTANT
- && mpz_cmp (ts->cl->length->value.integer,
- fts->cl->length->value.integer) != 0)))
+ else if (ts->type == BT_CHARACTER && ts->u.cl && fts->u.cl
+ && (((ts->u.cl->length && !fts->u.cl->length)
+ ||(!ts->u.cl->length && fts->u.cl->length))
+ || (ts->u.cl->length
+ && ts->u.cl->length->expr_type
+ != fts->u.cl->length->expr_type)
+ || (ts->u.cl->length
+ && ts->u.cl->length->expr_type == EXPR_CONSTANT
+ && mpz_cmp (ts->u.cl->length->value.integer,
+ fts->u.cl->length->value.integer) != 0)))
gfc_notify_std (GFC_STD_GNU, "Extension: Function %s at %L with "
"entries returning variables of different "
"string lengths", ns->entries->sym->name,
@@ -688,7 +688,7 @@ has_default_initializer (gfc_symbol *der)
for (c = der->components; c; c = c->next)
if ((c->ts.type != BT_DERIVED && c->initializer)
|| (c->ts.type == BT_DERIVED
- && (!c->attr.pointer && has_default_initializer (c->ts.derived))))
+ && (!c->attr.pointer && has_default_initializer (c->ts.u.derived))))
break;
return c != NULL;
@@ -718,16 +718,16 @@ resolve_common_vars (gfc_symbol *sym, bool named_common)
if (csym->ts.type != BT_DERIVED)
continue;
- if (!(csym->ts.derived->attr.sequence
- || csym->ts.derived->attr.is_bind_c))
+ if (!(csym->ts.u.derived->attr.sequence
+ || csym->ts.u.derived->attr.is_bind_c))
gfc_error_now ("Derived type variable '%s' in COMMON at %L "
"has neither the SEQUENCE nor the BIND(C) "
"attribute", csym->name, &csym->declared_at);
- if (csym->ts.derived->attr.alloc_comp)
+ if (csym->ts.u.derived->attr.alloc_comp)
gfc_error_now ("Derived type variable '%s' in COMMON at %L "
"has an ultimate component that is "
"allocatable", csym->name, &csym->declared_at);
- if (has_default_initializer (csym->ts.derived))
+ if (has_default_initializer (csym->ts.u.derived))
gfc_error_now ("Derived type variable '%s' in COMMON at %L "
"may not have default initializer", csym->name,
&csym->declared_at);
@@ -826,15 +826,15 @@ resolve_structure_cons (gfc_expr *expr)
if (expr->ref)
comp = expr->ref->u.c.sym->components;
else
- comp = expr->ts.derived->components;
+ comp = expr->ts.u.derived->components;
/* See if the user is trying to invoke a structure constructor for one of
the iso_c_binding derived types. */
- if (expr->ts.derived && expr->ts.derived->ts.is_iso_c && cons
- && cons->expr != NULL)
+ if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
+ && expr->ts.u.derived->ts.is_iso_c && cons && cons->expr != NULL)
{
gfc_error ("Components of structure constructor '%s' at %L are PRIVATE",
- expr->ts.derived->name, &(expr->where));
+ expr->ts.u.derived->name, &(expr->where));
return FAILURE;
}
@@ -1148,24 +1148,64 @@ is_illegal_recursion (gfc_symbol* sym, gfc_namespace* context)
static gfc_try
resolve_intrinsic (gfc_symbol *sym, locus *loc)
{
- gfc_intrinsic_sym *isym = gfc_find_function (sym->name);
- if (isym)
+ gfc_intrinsic_sym* isym;
+ const char* symstd;
+
+ if (sym->formal)
+ return SUCCESS;
+
+ /* We already know this one is an intrinsic, so we don't call
+ gfc_is_intrinsic for full checking but rather use gfc_find_function and
+ gfc_find_subroutine directly to check whether it is a function or
+ subroutine. */
+
+ if ((isym = gfc_find_function (sym->name)))
{
+ if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising
+ && !sym->attr.implicit_type)
+ gfc_warning ("Type specified for intrinsic function '%s' at %L is"
+ " ignored", sym->name, &sym->declared_at);
+
if (!sym->attr.function &&
gfc_add_function (&sym->attr, sym->name, loc) == FAILURE)
return FAILURE;
+
sym->ts = isym->ts;
}
- else
+ else if ((isym = gfc_find_subroutine (sym->name)))
{
- isym = gfc_find_subroutine (sym->name);
- gcc_assert (isym);
+ if (sym->ts.type != BT_UNKNOWN && !sym->attr.implicit_type)
+ {
+ gfc_error ("Intrinsic subroutine '%s' at %L shall not have a type"
+ " specifier", sym->name, &sym->declared_at);
+ return FAILURE;
+ }
+
if (!sym->attr.subroutine &&
gfc_add_subroutine (&sym->attr, sym->name, loc) == FAILURE)
return FAILURE;
}
- if (!sym->formal)
- gfc_copy_formal_args_intr (sym, isym);
+ else
+ {
+ gfc_error ("'%s' declared INTRINSIC at %L does not exist", sym->name,
+ &sym->declared_at);
+ return FAILURE;
+ }
+
+ gfc_copy_formal_args_intr (sym, isym);
+
+ /* Check it is actually available in the standard settings. */
+ if (gfc_check_intrinsic_standard (isym, &symstd, false, sym->declared_at)
+ == FAILURE)
+ {
+ gfc_error ("The intrinsic '%s' declared INTRINSIC at %L is not"
+ " available in the current standard settings but %s. Use"
+ " an appropriate -std=* option or enable -fall-intrinsics"
+ " in order to use it.",
+ sym->name, &sym->declared_at, symstd);
+ return FAILURE;
+ }
+
return SUCCESS;
}
@@ -1652,6 +1692,47 @@ find_noncopying_intrinsics (gfc_symbol *fnsym, gfc_actual_arglist *actual)
The namespace of the gsymbol is resolved and then, once this is
done the interface is checked. */
+
+static bool
+not_in_recursive (gfc_symbol *sym, gfc_namespace *gsym_ns)
+{
+ if (!gsym_ns->proc_name->attr.recursive)
+ return true;
+
+ if (sym->ns == gsym_ns)
+ return false;
+
+ if (sym->ns->parent && sym->ns->parent == gsym_ns)
+ return false;
+
+ return true;
+}
+
+static bool
+not_entry_self_reference (gfc_symbol *sym, gfc_namespace *gsym_ns)
+{
+ if (gsym_ns->entries)
+ {
+ gfc_entry_list *entry = gsym_ns->entries;
+
+ for (; entry; entry = entry->next)
+ {
+ if (strcmp (sym->name, entry->sym->name) == 0)
+ {
+ if (strcmp (gsym_ns->proc_name->name,
+ sym->ns->proc_name->name) == 0)
+ return false;
+
+ if (sym->ns->parent
+ && strcmp (gsym_ns->proc_name->name,
+ sym->ns->parent->proc_name->name) == 0)
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
static void
resolve_global_procedure (gfc_symbol *sym, locus *where,
gfc_actual_arglist **actual, int sub)
@@ -1668,9 +1749,13 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
gfc_global_used (gsym, where);
if (gfc_option.flag_whole_file
+ && sym->attr.if_source == IFSRC_UNKNOWN
&& gsym->type != GSYM_UNKNOWN
&& gsym->ns
- && gsym->ns->proc_name)
+ && gsym->ns->resolved != -1
+ && gsym->ns->proc_name
+ && not_in_recursive (sym, gsym->ns)
+ && not_entry_self_reference (sym, gsym->ns))
{
/* Make sure that translation for the gsymbol occurs before
the procedure currently being resolved. */
@@ -1687,9 +1772,41 @@ resolve_global_procedure (gfc_symbol *sym, locus *where,
}
if (!gsym->ns->resolved)
- gfc_resolve (gsym->ns);
+ {
+ gfc_dt_list *old_dt_list;
+
+ /* Stash away derived types so that the backend_decls do not
+ get mixed up. */
+ old_dt_list = gfc_derived_types;
+ gfc_derived_types = NULL;
+
+ gfc_resolve (gsym->ns);
+
+ /* Store the new derived types with the global namespace. */
+ if (gfc_derived_types)
+ gsym->ns->derived_types = gfc_derived_types;
+
+ /* Restore the derived types of this namespace. */
+ gfc_derived_types = old_dt_list;
+ }
+
+ if (gsym->ns->proc_name->attr.function
+ && gsym->ns->proc_name->as
+ && gsym->ns->proc_name->as->rank
+ && (!sym->as || sym->as->rank != gsym->ns->proc_name->as->rank))
+ gfc_error ("The reference to function '%s' at %L either needs an "
+ "explicit INTERFACE or the rank is incorrect", sym->name,
+ where);
+
+ if (gfc_option.flag_whole_file == 1
+ || ((gfc_option.warn_std & GFC_STD_LEGACY)
+ &&
+ !(gfc_option.warn_std & GFC_STD_GNU)))
+ gfc_errors_to_warnings (1);
gfc_procedure_use (gsym->ns->proc_name, actual, where);
+
+ gfc_errors_to_warnings (0);
}
if (gsym->type == GSYM_UNKNOWN)
@@ -2074,9 +2191,9 @@ is_scalar_expr_ptr (gfc_expr *expr)
its length is one. */
if (expr->ts.type == BT_CHARACTER)
{
- if (expr->ts.cl == NULL
- || expr->ts.cl->length == NULL
- || mpz_cmp_si (expr->ts.cl->length->value.integer, 1)
+ if (expr->ts.u.cl == NULL
+ || expr->ts.u.cl->length == NULL
+ || mpz_cmp_si (expr->ts.u.cl->length->value.integer, 1)
!= 0)
retval = FAILURE;
}
@@ -2107,9 +2224,9 @@ is_scalar_expr_ptr (gfc_expr *expr)
else if (expr->ts.type == BT_CHARACTER && expr->rank == 0)
{
/* Character string. Make sure it's of length 1. */
- if (expr->ts.cl == NULL
- || expr->ts.cl->length == NULL
- || mpz_cmp_si (expr->ts.cl->length->value.integer, 1) != 0)
+ if (expr->ts.u.cl == NULL
+ || expr->ts.u.cl->length == NULL
+ || mpz_cmp_si (expr->ts.u.cl->length->value.integer, 1) != 0)
retval = FAILURE;
}
else if (expr->rank != 0)
@@ -2259,12 +2376,12 @@ gfc_iso_c_func_interface (gfc_symbol *sym, gfc_actual_arglist *args,
any type should be ok if the variable is of a C
interoperable type. */
if (arg_ts->type == BT_CHARACTER)
- if (arg_ts->cl != NULL
- && (arg_ts->cl->length == NULL
- || arg_ts->cl->length->expr_type
+ if (arg_ts->u.cl != NULL
+ && (arg_ts->u.cl->length == NULL
+ || arg_ts->u.cl->length->expr_type
!= EXPR_CONSTANT
|| mpz_cmp_si
- (arg_ts->cl->length->value.integer, 1)
+ (arg_ts->u.cl->length->value.integer, 1)
!= 0)
&& is_scalar_expr_ptr (args->expr) != SUCCESS)
{
@@ -2419,8 +2536,8 @@ resolve_function (gfc_expr *expr)
&expr->value.function.actual, 0);
if (sym && sym->ts.type == BT_CHARACTER
- && sym->ts.cl
- && sym->ts.cl->length == NULL
+ && sym->ts.u.cl
+ && sym->ts.u.cl->length == NULL
&& !sym->attr.dummy
&& expr->value.function.esym == NULL
&& !sym->attr.contained)
@@ -2570,7 +2687,7 @@ resolve_function (gfc_expr *expr)
if (expr->ts.type == BT_CHARACTER && expr->value.function.esym
&& expr->value.function.esym->attr.use_assoc)
{
- gfc_expr_set_symbols_referenced (expr->ts.cl->length);
+ gfc_expr_set_symbols_referenced (expr->ts.u.cl->length);
}
if (t == SUCCESS
@@ -3279,7 +3396,7 @@ resolve_operator (gfc_expr *e)
case INTRINSIC_PARENTHESES:
e->ts = op1->ts;
if (e->ts.type == BT_CHARACTER)
- e->ts.cl = op1->ts.cl;
+ e->ts.u.cl = op1->ts.u.cl;
break;
default:
@@ -3807,7 +3924,7 @@ find_array_spec (gfc_expr *e)
case REF_COMPONENT:
if (derived == NULL)
- derived = e->symtree->n.sym->ts.derived;
+ derived = e->symtree->n.sym->ts.u.derived;
c = derived->components;
@@ -3816,7 +3933,7 @@ find_array_spec (gfc_expr *e)
{
/* Track the sequence of component references. */
if (c->ts.type == BT_DERIVED)
- derived = c->ts.derived;
+ derived = c->ts.u.derived;
break;
}
@@ -3999,10 +4116,10 @@ gfc_resolve_substring_charlen (gfc_expr *e)
gcc_assert (char_ref->next == NULL);
- if (e->ts.cl)
+ if (e->ts.u.cl)
{
- if (e->ts.cl->length)
- gfc_free_expr (e->ts.cl->length);
+ if (e->ts.u.cl->length)
+ gfc_free_expr (e->ts.u.cl->length);
else if (e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.dummy)
return;
@@ -4011,8 +4128,8 @@ gfc_resolve_substring_charlen (gfc_expr *e)
e->ts.type = BT_CHARACTER;
e->ts.kind = gfc_default_character_kind;
- if (!e->ts.cl)
- e->ts.cl = gfc_new_charlen (gfc_current_ns);
+ if (!e->ts.u.cl)
+ e->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
if (char_ref->u.ss.start)
start = gfc_copy_expr (char_ref->u.ss.start);
@@ -4022,7 +4139,7 @@ gfc_resolve_substring_charlen (gfc_expr *e)
if (char_ref->u.ss.end)
end = gfc_copy_expr (char_ref->u.ss.end);
else if (e->expr_type == EXPR_VARIABLE)
- end = gfc_copy_expr (e->symtree->n.sym->ts.cl->length);
+ end = gfc_copy_expr (e->symtree->n.sym->ts.u.cl->length);
else
end = NULL;
@@ -4030,15 +4147,15 @@ gfc_resolve_substring_charlen (gfc_expr *e)
return;
/* Length = (end - start +1). */
- e->ts.cl->length = gfc_subtract (end, start);
- e->ts.cl->length = gfc_add (e->ts.cl->length, gfc_int_expr (1));
+ e->ts.u.cl->length = gfc_subtract (end, start);
+ e->ts.u.cl->length = gfc_add (e->ts.u.cl->length, gfc_int_expr (1));
- e->ts.cl->length->ts.type = BT_INTEGER;
- e->ts.cl->length->ts.kind = gfc_charlen_int_kind;
+ e->ts.u.cl->length->ts.type = BT_INTEGER;
+ e->ts.u.cl->length->ts.kind = gfc_charlen_int_kind;
/* Make sure that the length is simplified. */
- gfc_simplify_expr (e->ts.cl->length, 1);
- gfc_resolve_expr (e->ts.cl->length);
+ gfc_simplify_expr (e->ts.u.cl->length, 1);
+ gfc_resolve_expr (e->ts.u.cl->length);
}
@@ -4330,7 +4447,7 @@ resolve_variable (gfc_expr *e)
/* Now do the same check on the specification expressions. */
specification_expr = 1;
if (sym->ts.type == BT_CHARACTER
- && gfc_resolve_expr (sym->ts.cl->length) == FAILURE)
+ && gfc_resolve_expr (sym->ts.u.cl->length) == FAILURE)
t = FAILURE;
if (sym->as)
@@ -4475,26 +4592,26 @@ gfc_resolve_character_operator (gfc_expr *e)
gcc_assert (e->value.op.op == INTRINSIC_CONCAT);
- if (op1->ts.cl && op1->ts.cl->length)
- e1 = gfc_copy_expr (op1->ts.cl->length);
+ if (op1->ts.u.cl && op1->ts.u.cl->length)
+ e1 = gfc_copy_expr (op1->ts.u.cl->length);
else if (op1->expr_type == EXPR_CONSTANT)
e1 = gfc_int_expr (op1->value.character.length);
- if (op2->ts.cl && op2->ts.cl->length)
- e2 = gfc_copy_expr (op2->ts.cl->length);
+ if (op2->ts.u.cl && op2->ts.u.cl->length)
+ e2 = gfc_copy_expr (op2->ts.u.cl->length);
else if (op2->expr_type == EXPR_CONSTANT)
e2 = gfc_int_expr (op2->value.character.length);
- e->ts.cl = gfc_new_charlen (gfc_current_ns);
+ e->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
if (!e1 || !e2)
return;
- e->ts.cl->length = gfc_add (e1, e2);
- e->ts.cl->length->ts.type = BT_INTEGER;
- e->ts.cl->length->ts.kind = gfc_charlen_int_kind;
- gfc_simplify_expr (e->ts.cl->length, 0);
- gfc_resolve_expr (e->ts.cl->length);
+ e->ts.u.cl->length = gfc_add (e1, e2);
+ e->ts.u.cl->length->ts.type = BT_INTEGER;
+ e->ts.u.cl->length->ts.kind = gfc_charlen_int_kind;
+ gfc_simplify_expr (e->ts.u.cl->length, 0);
+ gfc_resolve_expr (e->ts.u.cl->length);
return;
}
@@ -4519,12 +4636,12 @@ fixup_charlen (gfc_expr *e)
gfc_resolve_character_array_constructor (e);
case EXPR_SUBSTRING:
- if (!e->ts.cl && e->ref)
+ if (!e->ts.u.cl && e->ref)
gfc_resolve_substring_charlen (e);
default:
- if (!e->ts.cl)
- e->ts.cl = gfc_new_charlen (gfc_current_ns);
+ if (!e->ts.u.cl)
+ e->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
break;
}
@@ -4700,10 +4817,10 @@ check_typebound_baseobject (gfc_expr* e)
return FAILURE;
gcc_assert (base->ts.type == BT_DERIVED);
- if (base->ts.derived->attr.abstract)
+ if (base->ts.u.derived->attr.abstract)
{
gfc_error ("Base object for type-bound procedure call at %L is of"
- " ABSTRACT type '%s'", &e->where, base->ts.derived->name);
+ " ABSTRACT type '%s'", &e->where, base->ts.u.derived->name);
return FAILURE;
}
@@ -4994,7 +5111,7 @@ gfc_resolve_expr (gfc_expr *e)
expression_rank (e);
}
- if (e->ts.type == BT_CHARACTER && e->ts.cl == NULL && e->ref
+ if (e->ts.type == BT_CHARACTER && e->ts.u.cl == NULL && e->ref
&& e->ref->type != REF_SUBSTRING)
gfc_resolve_substring_charlen (e);
@@ -5054,7 +5171,7 @@ gfc_resolve_expr (gfc_expr *e)
gfc_internal_error ("gfc_resolve_expr(): Bad expression type");
}
- if (e->ts.type == BT_CHARACTER && t == SUCCESS && !e->ts.cl)
+ if (e->ts.type == BT_CHARACTER && t == SUCCESS && !e->ts.u.cl)
fixup_charlen (e);
return t;
@@ -5297,7 +5414,7 @@ derived_inaccessible (gfc_symbol *sym)
for (c = sym->components; c; c = c->next)
{
- if (c->ts.type == BT_DERIVED && derived_inaccessible (c->ts.derived))
+ if (c->ts.type == BT_DERIVED && derived_inaccessible (c->ts.u.derived))
return 1;
}
@@ -6227,21 +6344,21 @@ resolve_transfer (gfc_code *code)
{
/* Check that transferred derived type doesn't contain POINTER
components. */
- if (ts->derived->attr.pointer_comp)
+ if (ts->u.derived->attr.pointer_comp)
{
gfc_error ("Data transfer element at %L cannot have "
"POINTER components", &code->loc);
return;
}
- if (ts->derived->attr.alloc_comp)
+ if (ts->u.derived->attr.alloc_comp)
{
gfc_error ("Data transfer element at %L cannot have "
"ALLOCATABLE components", &code->loc);
return;
}
- if (derived_inaccessible (ts->derived))
+ if (derived_inaccessible (ts->u.derived))
{
gfc_error ("Data transfer element at %L cannot have "
"PRIVATE components",&code->loc);
@@ -6808,7 +6925,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
and rhs is the same symbol as the lhs. */
if (rhs->expr_type == EXPR_VARIABLE
&& rhs->symtree->n.sym->ts.type == BT_DERIVED
- && has_default_initializer (rhs->symtree->n.sym->ts.derived)
+ && has_default_initializer (rhs->symtree->n.sym->ts.u.derived)
&& (lhs->symtree->n.sym == rhs->symtree->n.sym))
code->ext.actual->next->expr = gfc_get_parentheses (rhs);
@@ -6857,18 +6974,18 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
if (lhs->ts.type == BT_CHARACTER
&& gfc_option.warn_character_truncation)
{
- if (lhs->ts.cl != NULL
- && lhs->ts.cl->length != NULL
- && lhs->ts.cl->length->expr_type == EXPR_CONSTANT)
- llen = mpz_get_si (lhs->ts.cl->length->value.integer);
+ if (lhs->ts.u.cl != NULL
+ && lhs->ts.u.cl->length != NULL
+ && lhs->ts.u.cl->length->expr_type == EXPR_CONSTANT)
+ llen = mpz_get_si (lhs->ts.u.cl->length->value.integer);
if (rhs->expr_type == EXPR_CONSTANT)
rlen = rhs->value.character.length;
- else if (rhs->ts.cl != NULL
- && rhs->ts.cl->length != NULL
- && rhs->ts.cl->length->expr_type == EXPR_CONSTANT)
- rlen = mpz_get_si (rhs->ts.cl->length->value.integer);
+ else if (rhs->ts.u.cl != NULL
+ && rhs->ts.u.cl->length != NULL
+ && rhs->ts.u.cl->length->expr_type == EXPR_CONSTANT)
+ rlen = mpz_get_si (rhs->ts.u.cl->length->value.integer);
if (rlen && llen && rlen > llen)
gfc_warning_now ("CHARACTER expression will be truncated "
@@ -6905,7 +7022,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
if (lhs->ts.type == BT_DERIVED
&& lhs->expr_type == EXPR_VARIABLE
- && lhs->ts.derived->attr.pointer_comp
+ && lhs->ts.u.derived->attr.pointer_comp
&& gfc_impure_variable (rhs->symtree->n.sym))
{
gfc_error ("The impure variable at %L is assigned to "
@@ -7599,7 +7716,7 @@ apply_default_init (gfc_symbol *sym)
if (sym->attr.flavor != FL_VARIABLE && !sym->attr.function)
return;
- if (sym->ts.type == BT_DERIVED && sym->ts.derived)
+ if (sym->ts.type == BT_DERIVED && sym->ts.u.derived)
init = gfc_default_initializer (&sym->ts);
if (init == NULL)
@@ -7744,10 +7861,10 @@ build_default_init_expr (gfc_symbol *sym)
/* For characters, the length must be constant in order to
create a default initializer. */
if (gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON
- && sym->ts.cl->length
- && sym->ts.cl->length->expr_type == EXPR_CONSTANT)
+ && sym->ts.u.cl->length
+ && sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
- char_len = mpz_get_si (sym->ts.cl->length->value.integer);
+ char_len = mpz_get_si (sym->ts.u.cl->length->value.integer);
init_expr->value.character.length = char_len;
init_expr->value.character.string = gfc_get_wide_string (char_len+1);
for (i = 0; i < char_len; i++)
@@ -7839,6 +7956,15 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
}
+/* Check if a derived type is extensible. */
+
+static bool
+type_is_extensible (gfc_symbol *sym)
+{
+ return !(sym->attr.is_bind_c || sym->attr.sequence);
+}
+
+
/* Additional checks for symbols with flavor variable and derived
type. To be called from resolve_fl_variable. */
@@ -7851,17 +7977,17 @@ resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag)
associated by the presence of another class I symbol in the same
namespace. 14.6.1.3 of the standard and the discussion on
comp.lang.fortran. */
- if (sym->ns != sym->ts.derived->ns
+ if (sym->ns != sym->ts.u.derived->ns
&& sym->ns->proc_name->attr.if_source != IFSRC_IFBODY)
{
gfc_symbol *s;
- gfc_find_symbol (sym->ts.derived->name, sym->ns, 0, &s);
+ gfc_find_symbol (sym->ts.u.derived->name, sym->ns, 0, &s);
if (s && s->attr.flavor != FL_DERIVED)
{
gfc_error ("The type '%s' cannot be host associated at %L "
"because it is blocked by an incompatible object "
"of the same name declared at %L",
- sym->ts.derived->name, &sym->declared_at,
+ sym->ts.u.derived->name, &sym->declared_at,
&s->declared_at);
return FAILURE;
}
@@ -7879,7 +8005,7 @@ resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag)
&& sym->ns->proc_name->attr.flavor == FL_MODULE
&& !sym->ns->save_all && !sym->attr.save
&& !sym->attr.pointer && !sym->attr.allocatable
- && has_default_initializer (sym->ts.derived))
+ && has_default_initializer (sym->ts.u.derived))
{
gfc_error("Object '%s' at %L must have the SAVE attribute for "
"default initialization of a component",
@@ -7887,6 +8013,25 @@ resolve_fl_variable_derived (gfc_symbol *sym, int no_init_flag)
return FAILURE;
}
+ if (sym->ts.is_class)
+ {
+ /* C502. */
+ if (!type_is_extensible (sym->ts.u.derived))
+ {
+ gfc_error ("Type '%s' of CLASS variable '%s' at %L is not extensible",
+ sym->ts.u.derived->name, sym->name, &sym->declared_at);
+ return FAILURE;
+ }
+
+ /* C509. */
+ if (!(sym->attr.dummy || sym->attr.allocatable || sym->attr.pointer))
+ {
+ gfc_error ("CLASS variable '%s' at %L must be dummy, allocatable "
+ "or pointer", sym->name, &sym->declared_at);
+ return FAILURE;
+ }
+ }
+
/* Assign default initializer. */
if (!(sym->value || sym->attr.pointer || sym->attr.allocatable)
&& (!no_init_flag || sym->attr.intent == INTENT_OUT))
@@ -7938,7 +8083,7 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
{
/* Make sure that character string variables with assumed length are
dummy arguments. */
- e = sym->ts.cl->length;
+ e = sym->ts.u.cl->length;
if (e == NULL && !sym->attr.dummy && !sym->attr.result)
{
gfc_error ("Entity with assumed character length at %L must be a "
@@ -8044,7 +8189,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
if (sym->ts.type == BT_CHARACTER)
{
- gfc_charlen *cl = sym->ts.cl;
+ gfc_charlen *cl = sym->ts.u.cl;
if (cl && cl->length && gfc_is_constant_expr (cl->length)
&& resolve_charlen (cl) == FAILURE)
@@ -8084,9 +8229,9 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
{
if (arg->sym
&& arg->sym->ts.type == BT_DERIVED
- && !arg->sym->ts.derived->attr.use_assoc
- && !gfc_check_access (arg->sym->ts.derived->attr.access,
- arg->sym->ts.derived->ns->default_access)
+ && !arg->sym->ts.u.derived->attr.use_assoc
+ && !gfc_check_access (arg->sym->ts.u.derived->attr.access,
+ arg->sym->ts.u.derived->ns->default_access)
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: '%s' is of a "
"PRIVATE type and cannot be a dummy argument"
" of '%s', which is PUBLIC at %L",
@@ -8094,7 +8239,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
== FAILURE)
{
/* Stop this message from recurring. */
- arg->sym->ts.derived->attr.access = ACCESS_PUBLIC;
+ arg->sym->ts.u.derived->attr.access = ACCESS_PUBLIC;
return FAILURE;
}
}
@@ -8107,9 +8252,9 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
{
if (arg->sym
&& arg->sym->ts.type == BT_DERIVED
- && !arg->sym->ts.derived->attr.use_assoc
- && !gfc_check_access (arg->sym->ts.derived->attr.access,
- arg->sym->ts.derived->ns->default_access)
+ && !arg->sym->ts.u.derived->attr.use_assoc
+ && !gfc_check_access (arg->sym->ts.u.derived->attr.access,
+ arg->sym->ts.u.derived->ns->default_access)
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Procedure "
"'%s' in PUBLIC interface '%s' at %L "
"takes dummy arguments of '%s' which is "
@@ -8118,7 +8263,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
gfc_typename (&arg->sym->ts)) == FAILURE)
{
/* Stop this message from recurring. */
- arg->sym->ts.derived->attr.access = ACCESS_PUBLIC;
+ arg->sym->ts.u.derived->attr.access = ACCESS_PUBLIC;
return FAILURE;
}
}
@@ -8132,9 +8277,9 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
{
if (arg->sym
&& arg->sym->ts.type == BT_DERIVED
- && !arg->sym->ts.derived->attr.use_assoc
- && !gfc_check_access (arg->sym->ts.derived->attr.access,
- arg->sym->ts.derived->ns->default_access)
+ && !arg->sym->ts.u.derived->attr.use_assoc
+ && !gfc_check_access (arg->sym->ts.u.derived->attr.access,
+ arg->sym->ts.u.derived->ns->default_access)
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Procedure "
"'%s' in PUBLIC interface '%s' at %L "
"takes dummy arguments of '%s' which is "
@@ -8143,7 +8288,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
gfc_typename (&arg->sym->ts)) == FAILURE)
{
/* Stop this message from recurring. */
- arg->sym->ts.derived->attr.access = ACCESS_PUBLIC;
+ arg->sym->ts.u.derived->attr.access = ACCESS_PUBLIC;
return FAILURE;
}
}
@@ -8185,7 +8330,7 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
function - but length must be declared in calling scoping unit. */
if (sym->attr.function
&& sym->ts.type == BT_CHARACTER
- && sym->ts.cl && sym->ts.cl->length == NULL)
+ && sym->ts.u.cl && sym->ts.u.cl->length == NULL)
{
if ((sym->as && sym->as->rank) || (sym->attr.pointer)
|| (sym->attr.recursive) || (sym->attr.pure))
@@ -8212,8 +8357,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag)
/* Appendix B.2 of the standard. Contained functions give an
error anyway. Fixed-form is likely to be F77/legacy. */
if (!sym->attr.contained && gfc_current_form != FORM_FIXED)
- gfc_notify_std (GFC_STD_F95_OBS, "CHARACTER(*) function "
- "'%s' at %L is obsolescent in fortran 95",
+ gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
+ "CHARACTER(*) function '%s' at %L",
sym->name, &sym->declared_at);
}
@@ -8354,7 +8499,7 @@ gfc_resolve_finalizers (gfc_symbol* derived)
arg = list->proc_sym->formal->sym;
/* This argument must be of our type. */
- if (arg->ts.type != BT_DERIVED || arg->ts.derived != derived)
+ if (arg->ts.type != BT_DERIVED || arg->ts.u.derived != derived)
{
gfc_error ("Argument of FINAL procedure at %L must be of type '%s'",
&arg->declared_at, derived->name);
@@ -8688,37 +8833,27 @@ check_generic_tbp_ambiguity (gfc_tbp_generic* t1, gfc_tbp_generic* t2,
}
-/* Resolve a GENERIC procedure binding for a derived type. */
+/* Worker function for resolving a generic procedure binding; this is used to
+ resolve GENERIC as well as user and intrinsic OPERATOR typebound procedures.
+
+ The difference between those cases is finding possible inherited bindings
+ that are overridden, as one has to look for them in tb_sym_root,
+ tb_uop_root or tb_op, respectively. Thus the caller must already find
+ the super-type and set p->overridden correctly. */
static gfc_try
-resolve_typebound_generic (gfc_symbol* derived, gfc_symtree* st)
+resolve_tb_generic_targets (gfc_symbol* super_type,
+ gfc_typebound_proc* p, const char* name)
{
gfc_tbp_generic* target;
gfc_symtree* first_target;
- gfc_symbol* super_type;
gfc_symtree* inherited;
- locus where;
-
- gcc_assert (st->n.tb);
- gcc_assert (st->n.tb->is_generic);
-
- where = st->n.tb->where;
- super_type = gfc_get_derived_super_type (derived);
-
- /* Find the overridden binding if any. */
- st->n.tb->overridden = NULL;
- if (super_type)
- {
- gfc_symtree* overridden;
- overridden = gfc_find_typebound_proc (super_type, NULL, st->name, true);
- if (overridden && overridden->n.tb)
- st->n.tb->overridden = overridden->n.tb;
- }
+ gcc_assert (p && p->is_generic);
/* Try to find the specific bindings for the symtrees in our target-list. */
- gcc_assert (st->n.tb->u.generic);
- for (target = st->n.tb->u.generic; target; target = target->next)
+ gcc_assert (p->u.generic);
+ for (target = p->u.generic; target; target = target->next)
if (!target->specific)
{
gfc_typebound_proc* overridden_tbp;
@@ -8749,7 +8884,7 @@ resolve_typebound_generic (gfc_symbol* derived, gfc_symtree* st)
}
gfc_error ("Undefined specific binding '%s' as target of GENERIC '%s'"
- " at %L", target_name, st->name, &where);
+ " at %L", target_name, name, &p->where);
return FAILURE;
/* Once we've found the specific binding, check it is not ambiguous with
@@ -8761,19 +8896,19 @@ specific_found:
if (target->specific->is_generic)
{
gfc_error ("GENERIC '%s' at %L must target a specific binding,"
- " '%s' is GENERIC, too", st->name, &where, target_name);
+ " '%s' is GENERIC, too", name, &p->where, target_name);
return FAILURE;
}
/* Check those already resolved on this type directly. */
- for (g = st->n.tb->u.generic; g; g = g->next)
+ for (g = p->u.generic; g; g = g->next)
if (g != target && g->specific
- && check_generic_tbp_ambiguity (target, g, st->name, where)
+ && check_generic_tbp_ambiguity (target, g, name, p->where)
== FAILURE)
return FAILURE;
/* Check for ambiguity with inherited specific targets. */
- for (overridden_tbp = st->n.tb->overridden; overridden_tbp;
+ for (overridden_tbp = p->overridden; overridden_tbp;
overridden_tbp = overridden_tbp->overridden)
if (overridden_tbp->is_generic)
{
@@ -8781,36 +8916,190 @@ specific_found:
{
gcc_assert (g->specific);
if (check_generic_tbp_ambiguity (target, g,
- st->name, where) == FAILURE)
+ name, p->where) == FAILURE)
return FAILURE;
}
}
}
/* If we attempt to "overwrite" a specific binding, this is an error. */
- if (st->n.tb->overridden && !st->n.tb->overridden->is_generic)
+ if (p->overridden && !p->overridden->is_generic)
{
gfc_error ("GENERIC '%s' at %L can't overwrite specific binding with"
- " the same name", st->name, &where);
+ " the same name", name, &p->where);
return FAILURE;
}
/* Take the SUBROUTINE/FUNCTION attributes of the first specific target, as
all must have the same attributes here. */
- first_target = st->n.tb->u.generic->specific->u.specific;
+ first_target = p->u.generic->specific->u.specific;
gcc_assert (first_target);
- st->n.tb->subroutine = first_target->n.sym->attr.subroutine;
- st->n.tb->function = first_target->n.sym->attr.function;
+ p->subroutine = first_target->n.sym->attr.subroutine;
+ p->function = first_target->n.sym->attr.function;
return SUCCESS;
}
-/* Resolve the type-bound procedures for a derived type. */
+/* Resolve a GENERIC procedure binding for a derived type. */
+
+static gfc_try
+resolve_typebound_generic (gfc_symbol* derived, gfc_symtree* st)
+{
+ gfc_symbol* super_type;
+
+ /* Find the overridden binding if any. */
+ st->n.tb->overridden = NULL;
+ super_type = gfc_get_derived_super_type (derived);
+ if (super_type)
+ {
+ gfc_symtree* overridden;
+ overridden = gfc_find_typebound_proc (super_type, NULL, st->name, true);
+
+ if (overridden && overridden->n.tb)
+ st->n.tb->overridden = overridden->n.tb;
+ }
+
+ /* Resolve using worker function. */
+ return resolve_tb_generic_targets (super_type, st->n.tb, st->name);
+}
+
+
+/* Retrieve the target-procedure of an operator binding and do some checks in
+ common for intrinsic and user-defined type-bound operators. */
+
+static gfc_symbol*
+get_checked_tb_operator_target (gfc_tbp_generic* target, locus where)
+{
+ gfc_symbol* target_proc;
+
+ gcc_assert (target->specific && !target->specific->is_generic);
+ target_proc = target->specific->u.specific->n.sym;
+ gcc_assert (target_proc);
+
+ /* All operator bindings must have a passed-object dummy argument. */
+ if (target->specific->nopass)
+ {
+ gfc_error ("Type-bound operator at %L can't be NOPASS", &where);
+ return NULL;
+ }
+
+ return target_proc;
+}
+
+
+/* Resolve a type-bound intrinsic operator. */
+
+static gfc_try
+resolve_typebound_intrinsic_op (gfc_symbol* derived, gfc_intrinsic_op op,
+ gfc_typebound_proc* p)
+{
+ gfc_symbol* super_type;
+ gfc_tbp_generic* target;
+
+ /* If there's already an error here, do nothing (but don't fail again). */
+ if (p->error)
+ return SUCCESS;
+
+ /* Operators should always be GENERIC bindings. */
+ gcc_assert (p->is_generic);
+
+ /* Look for an overridden binding. */
+ super_type = gfc_get_derived_super_type (derived);
+ if (super_type && super_type->f2k_derived)
+ p->overridden = gfc_find_typebound_intrinsic_op (super_type, NULL,
+ op, true);
+ else
+ p->overridden = NULL;
+
+ /* Resolve general GENERIC properties using worker function. */
+ if (resolve_tb_generic_targets (super_type, p, gfc_op2string (op)) == FAILURE)
+ goto error;
+
+ /* Check the targets to be procedures of correct interface. */
+ for (target = p->u.generic; target; target = target->next)
+ {
+ gfc_symbol* target_proc;
+
+ target_proc = get_checked_tb_operator_target (target, p->where);
+ if (!target_proc)
+ return FAILURE;
+
+ if (!gfc_check_operator_interface (target_proc, op, p->where))
+ return FAILURE;
+ }
+
+ return SUCCESS;
+
+error:
+ p->error = 1;
+ return FAILURE;
+}
+
+
+/* Resolve a type-bound user operator (tree-walker callback). */
static gfc_symbol* resolve_bindings_derived;
static gfc_try resolve_bindings_result;
+static gfc_try check_uop_procedure (gfc_symbol* sym, locus where);
+
+static void
+resolve_typebound_user_op (gfc_symtree* stree)
+{
+ gfc_symbol* super_type;
+ gfc_tbp_generic* target;
+
+ gcc_assert (stree && stree->n.tb);
+
+ if (stree->n.tb->error)
+ return;
+
+ /* Operators should always be GENERIC bindings. */
+ gcc_assert (stree->n.tb->is_generic);
+
+ /* Find overridden procedure, if any. */
+ super_type = gfc_get_derived_super_type (resolve_bindings_derived);
+ if (super_type && super_type->f2k_derived)
+ {
+ gfc_symtree* overridden;
+ overridden = gfc_find_typebound_user_op (super_type, NULL,
+ stree->name, true);
+
+ if (overridden && overridden->n.tb)
+ stree->n.tb->overridden = overridden->n.tb;
+ }
+ else
+ stree->n.tb->overridden = NULL;
+
+ /* Resolve basically using worker function. */
+ if (resolve_tb_generic_targets (super_type, stree->n.tb, stree->name)
+ == FAILURE)
+ goto error;
+
+ /* Check the targets to be functions of correct interface. */
+ for (target = stree->n.tb->u.generic; target; target = target->next)
+ {
+ gfc_symbol* target_proc;
+
+ target_proc = get_checked_tb_operator_target (target, stree->n.tb->where);
+ if (!target_proc)
+ goto error;
+
+ if (check_uop_procedure (target_proc, stree->n.tb->where) == FAILURE)
+ goto error;
+ }
+
+ return;
+
+error:
+ resolve_bindings_result = FAILURE;
+ stree->n.tb->error = 1;
+}
+
+
+/* Resolve the type-bound procedures for a derived type. */
+
static void
resolve_typebound_procedure (gfc_symtree* stree)
{
@@ -8915,7 +9204,7 @@ resolve_typebound_procedure (gfc_symtree* stree)
/* Now check that the argument-type matches. */
gcc_assert (me_arg);
if (me_arg->ts.type != BT_DERIVED
- || me_arg->ts.derived != resolve_bindings_derived)
+ || me_arg->ts.u.derived != resolve_bindings_derived)
{
gfc_error ("Argument '%s' of '%s' with PASS(%s) at %L must be of"
" the derived-type '%s'", me_arg->name, proc->name,
@@ -8923,9 +9212,12 @@ resolve_typebound_procedure (gfc_symtree* stree)
goto error;
}
- gfc_warning ("Polymorphic entities are not yet implemented,"
- " non-polymorphic passed-object dummy argument of '%s'"
- " at %L accepted", proc->name, &where);
+ if (!me_arg->ts.is_class)
+ {
+ gfc_error ("Non-polymorphic passed-object dummy argument of '%s'"
+ " at %L", proc->name, &where);
+ goto error;
+ }
}
/* If we are extending some type, check that we don't override a procedure
@@ -8974,13 +9266,42 @@ error:
static gfc_try
resolve_typebound_procedures (gfc_symbol* derived)
{
+ int op;
+ bool found_op;
+
if (!derived->f2k_derived || !derived->f2k_derived->tb_sym_root)
return SUCCESS;
resolve_bindings_derived = derived;
resolve_bindings_result = SUCCESS;
- gfc_traverse_symtree (derived->f2k_derived->tb_sym_root,
- &resolve_typebound_procedure);
+
+ if (derived->f2k_derived->tb_sym_root)
+ gfc_traverse_symtree (derived->f2k_derived->tb_sym_root,
+ &resolve_typebound_procedure);
+
+ found_op = (derived->f2k_derived->tb_uop_root != NULL);
+ if (derived->f2k_derived->tb_uop_root)
+ gfc_traverse_symtree (derived->f2k_derived->tb_uop_root,
+ &resolve_typebound_user_op);
+
+ for (op = 0; op != GFC_INTRINSIC_OPS; ++op)
+ {
+ gfc_typebound_proc* p = derived->f2k_derived->tb_op[op];
+ if (p && resolve_typebound_intrinsic_op (derived, (gfc_intrinsic_op) op,
+ p) == FAILURE)
+ resolve_bindings_result = FAILURE;
+ if (p)
+ found_op = true;
+ }
+
+ /* FIXME: Remove this (and found_op) once calls are fully implemented. */
+ if (found_op)
+ {
+ gfc_error ("Derived type '%s' at %L contains type-bound OPERATOR's,"
+ " they are not yet implemented.",
+ derived->name, &derived->declared_at);
+ resolve_bindings_result = FAILURE;
+ }
return resolve_bindings_result;
}
@@ -9087,7 +9408,7 @@ resolve_fl_derived (gfc_symbol *sym)
return FAILURE;
/* An ABSTRACT type must be extensible. */
- if (sym->attr.abstract && (sym->attr.is_bind_c || sym->attr.sequence))
+ if (sym->attr.abstract && !type_is_extensible (sym))
{
gfc_error ("Non-extensible derived-type '%s' at %L must not be ABSTRACT",
sym->name, &sym->declared_at);
@@ -9140,6 +9461,7 @@ resolve_fl_derived (gfc_symbol *sym)
c->attr.elemental = ifc->attr.elemental;
c->attr.recursive = ifc->attr.recursive;
c->attr.always_explicit = ifc->attr.always_explicit;
+ c->attr.ext_attr |= ifc->attr.ext_attr;
/* Replace symbols in array spec. */
if (c->as)
{
@@ -9151,12 +9473,10 @@ resolve_fl_derived (gfc_symbol *sym)
}
}
/* Copy char length. */
- if (ifc->ts.cl)
+ if (ifc->ts.type == BT_CHARACTER && ifc->ts.u.cl)
{
- c->ts.cl = gfc_new_charlen (sym->ns);
- c->ts.cl->resolved = ifc->ts.cl->resolved;
- c->ts.cl->length = gfc_copy_expr (ifc->ts.cl->length);
- /* TODO: gfc_expr_replace_symbols (c->ts.cl->length, c);*/
+ c->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
+ /* TODO: gfc_expr_replace_symbols (c->ts.u.cl->length, c);*/
}
}
else if (c->ts.interface->name[0] != '\0')
@@ -9225,7 +9545,7 @@ resolve_fl_derived (gfc_symbol *sym)
/* Now check that the argument-type matches. */
gcc_assert (me_arg);
if (me_arg->ts.type != BT_DERIVED
- || me_arg->ts.derived != sym)
+ || me_arg->ts.u.derived != sym)
{
gfc_error ("Argument '%s' of '%s' with PASS(%s) at %L must be of"
" the derived type '%s'", me_arg->name, c->name,
@@ -9262,11 +9582,9 @@ resolve_fl_derived (gfc_symbol *sym)
return FAILURE;
}
- /* TODO: Make this an error once CLASS is implemented. */
- if (!sym->attr.sequence)
- gfc_warning ("Polymorphic entities are not yet implemented,"
- " non-polymorphic passed-object dummy argument of '%s'"
- " at %L accepted", c->name, &c->loc);
+ if (type_is_extensible (sym) && !me_arg->ts.is_class)
+ gfc_error ("Non-polymorphic passed-object dummy argument of '%s'"
+ " at %L", c->name, &c->loc);
}
@@ -9288,14 +9606,14 @@ resolve_fl_derived (gfc_symbol *sym)
if (c->ts.type == BT_CHARACTER)
{
- if (c->ts.cl->length == NULL
- || (resolve_charlen (c->ts.cl) == FAILURE)
- || !gfc_is_constant_expr (c->ts.cl->length))
+ if (c->ts.u.cl->length == NULL
+ || (resolve_charlen (c->ts.u.cl) == FAILURE)
+ || !gfc_is_constant_expr (c->ts.u.cl->length))
{
gfc_error ("Character length of component '%s' needs to "
"be a constant specification expression at %L",
c->name,
- c->ts.cl->length ? &c->ts.cl->length->where : &c->loc);
+ c->ts.u.cl->length ? &c->ts.u.cl->length->where : &c->loc);
return FAILURE;
}
}
@@ -9303,10 +9621,10 @@ resolve_fl_derived (gfc_symbol *sym)
if (c->ts.type == BT_DERIVED
&& sym->component_access != ACCESS_PRIVATE
&& gfc_check_access (sym->attr.access, sym->ns->default_access)
- && !is_sym_host_assoc (c->ts.derived, sym->ns)
- && !c->ts.derived->attr.use_assoc
- && !gfc_check_access (c->ts.derived->attr.access,
- c->ts.derived->ns->default_access)
+ && !is_sym_host_assoc (c->ts.u.derived, sym->ns)
+ && !c->ts.u.derived->attr.use_assoc
+ && !gfc_check_access (c->ts.u.derived->attr.access,
+ c->ts.u.derived->ns->default_access)
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: the component '%s' "
"is a PRIVATE type and cannot be a component of "
"'%s', which is PUBLIC at %L", c->name,
@@ -9315,18 +9633,18 @@ resolve_fl_derived (gfc_symbol *sym)
if (sym->attr.sequence)
{
- if (c->ts.type == BT_DERIVED && c->ts.derived->attr.sequence == 0)
+ if (c->ts.type == BT_DERIVED && c->ts.u.derived->attr.sequence == 0)
{
gfc_error ("Component %s of SEQUENCE type declared at %L does "
"not have the SEQUENCE attribute",
- c->ts.derived->name, &sym->declared_at);
+ c->ts.u.derived->name, &sym->declared_at);
return FAILURE;
}
}
if (c->ts.type == BT_DERIVED && c->attr.pointer
- && c->ts.derived->components == NULL
- && !c->ts.derived->attr.zero_comp)
+ && c->ts.u.derived->components == NULL
+ && !c->ts.u.derived->attr.zero_comp)
{
gfc_error ("The pointer component '%s' of '%s' at %L is a type "
"that has not been declared", c->name, sym->name,
@@ -9334,15 +9652,24 @@ resolve_fl_derived (gfc_symbol *sym)
return FAILURE;
}
+ /* C437. */
+ if (c->ts.type == BT_DERIVED && c->ts.is_class
+ && !(c->attr.pointer || c->attr.allocatable))
+ {
+ gfc_error ("Component '%s' with CLASS at %L must be allocatable "
+ "or pointer", c->name, &c->loc);
+ return FAILURE;
+ }
+
/* Ensure that all the derived type components are put on the
derived type list; even in formal namespaces, where derived type
pointer components might not have been declared. */
if (c->ts.type == BT_DERIVED
- && c->ts.derived
- && c->ts.derived->components
+ && c->ts.u.derived
+ && c->ts.u.derived->components
&& c->attr.pointer
- && sym != c->ts.derived)
- add_dt_to_dt_list (c->ts.derived);
+ && sym != c->ts.u.derived)
+ add_dt_to_dt_list (c->ts.u.derived);
if (c->attr.pointer || c->attr.proc_pointer || c->attr.allocatable
|| c->as == NULL)
@@ -9410,7 +9737,7 @@ resolve_fl_namelist (gfc_symbol *sym)
/* Types with private components that came here by USE-association. */
if (nl->sym->ts.type == BT_DERIVED
- && derived_inaccessible (nl->sym->ts.derived))
+ && derived_inaccessible (nl->sym->ts.u.derived))
{
gfc_error ("NAMELIST object '%s' has use-associated PRIVATE "
"components and cannot be member of namelist '%s' at %L",
@@ -9420,8 +9747,8 @@ resolve_fl_namelist (gfc_symbol *sym)
/* Types with private components that are defined in the same module. */
if (nl->sym->ts.type == BT_DERIVED
- && !is_sym_host_assoc (nl->sym->ts.derived, sym->ns)
- && !gfc_check_access (nl->sym->ts.derived->attr.private_comp
+ && !is_sym_host_assoc (nl->sym->ts.u.derived, sym->ns)
+ && !gfc_check_access (nl->sym->ts.u.derived->attr.private_comp
? ACCESS_PRIVATE : ACCESS_UNKNOWN,
nl->sym->ns->default_access))
{
@@ -9456,7 +9783,7 @@ resolve_fl_namelist (gfc_symbol *sym)
if (nl->sym->ts.type != BT_DERIVED)
continue;
- if (nl->sym->ts.derived->attr.alloc_comp)
+ if (nl->sym->ts.u.derived->attr.alloc_comp)
{
gfc_error ("NAMELIST object '%s' in namelist '%s' at %L cannot "
"have ALLOCATABLE components",
@@ -9464,7 +9791,7 @@ resolve_fl_namelist (gfc_symbol *sym)
return FAILURE;
}
- if (nl->sym->ts.derived->attr.pointer_comp)
+ if (nl->sym->ts.u.derived->attr.pointer_comp)
{
gfc_error ("NAMELIST object '%s' in namelist '%s' at %L cannot "
"have POINTER components",
@@ -9635,6 +9962,7 @@ resolve_symbol (gfc_symbol *sym)
sym->attr.dimension = ifc->attr.dimension;
sym->attr.recursive = ifc->attr.recursive;
sym->attr.always_explicit = ifc->attr.always_explicit;
+ sym->attr.ext_attr |= ifc->attr.ext_attr;
/* Copy array spec. */
sym->as = gfc_copy_array_spec (ifc->as);
if (sym->as)
@@ -9647,12 +9975,10 @@ resolve_symbol (gfc_symbol *sym)
}
}
/* Copy char length. */
- if (ifc->ts.cl)
+ if (ifc->ts.type == BT_CHARACTER && ifc->ts.u.cl)
{
- sym->ts.cl = gfc_new_charlen (sym->ns);
- sym->ts.cl->resolved = ifc->ts.cl->resolved;
- sym->ts.cl->length = gfc_copy_expr (ifc->ts.cl->length);
- gfc_expr_replace_symbols (sym->ts.cl->length, sym);
+ sym->ts.u.cl = gfc_new_charlen (sym->ns, ifc->ts.u.cl);
+ gfc_expr_replace_symbols (sym->ts.u.cl->length, sym);
}
}
else if (sym->ts.interface->name[0] != '\0')
@@ -9677,51 +10003,9 @@ resolve_symbol (gfc_symbol *sym)
/* Make sure that the intrinsic is consistent with its internal
representation. This needs to be done before assigning a default
type to avoid spurious warnings. */
- if (sym->attr.flavor != FL_MODULE && sym->attr.intrinsic)
- {
- gfc_intrinsic_sym* isym;
- const char* symstd;
-
- /* We already know this one is an intrinsic, so we don't call
- gfc_is_intrinsic for full checking but rather use gfc_find_function and
- gfc_find_subroutine directly to check whether it is a function or
- subroutine. */
-
- if ((isym = gfc_find_function (sym->name)))
- {
- if (sym->ts.type != BT_UNKNOWN && gfc_option.warn_surprising
- && !sym->attr.implicit_type)
- gfc_warning ("Type specified for intrinsic function '%s' at %L is"
- " ignored", sym->name, &sym->declared_at);
- }
- else if ((isym = gfc_find_subroutine (sym->name)))
- {
- if (sym->ts.type != BT_UNKNOWN && !sym->attr.implicit_type)
- {
- gfc_error ("Intrinsic subroutine '%s' at %L shall not have a type"
- " specifier", sym->name, &sym->declared_at);
- return;
- }
- }
- else
- {
- gfc_error ("'%s' declared INTRINSIC at %L does not exist",
- sym->name, &sym->declared_at);
- return;
- }
-
- /* Check it is actually available in the standard settings. */
- if (gfc_check_intrinsic_standard (isym, &symstd, false, sym->declared_at)
- == FAILURE)
- {
- gfc_error ("The intrinsic '%s' declared INTRINSIC at %L is not"
- " available in the current standard settings but %s. Use"
- " an appropriate -std=* option or enable -fall-intrinsics"
- " in order to use it.",
- sym->name, &sym->declared_at, symstd);
- return;
- }
- }
+ if (sym->attr.flavor != FL_MODULE && sym->attr.intrinsic
+ && resolve_intrinsic (sym, &sym->declared_at) == FAILURE)
+ return;
/* Assign default type to symbols that need one and don't have one. */
if (sym->ts.type == BT_UNKNOWN)
@@ -9794,7 +10078,7 @@ resolve_symbol (gfc_symbol *sym)
if (sym->attr.value && sym->ts.type == BT_CHARACTER)
{
- gfc_charlen *cl = sym->ts.cl;
+ gfc_charlen *cl = sym->ts.u.cl;
if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT)
{
gfc_error ("Character dummy variable '%s' at %L with VALUE "
@@ -9846,14 +10130,14 @@ resolve_symbol (gfc_symbol *sym)
/* If type() declaration, we need to verify that the components
of the given type are all C interoperable, etc. */
if (sym->ts.type == BT_DERIVED &&
- sym->ts.derived->attr.is_c_interop != 1)
+ sym->ts.u.derived->attr.is_c_interop != 1)
{
/* Make sure the user marked the derived type as BIND(C). If
not, call the verify routine. This could print an error
for the derived type more than once if multiple variables
of that type are declared. */
- if (sym->ts.derived->attr.is_bind_c != 1)
- verify_bind_c_derived_type (sym->ts.derived);
+ if (sym->ts.u.derived->attr.is_bind_c != 1)
+ verify_bind_c_derived_type (sym->ts.u.derived);
t = FAILURE;
}
@@ -9882,12 +10166,12 @@ resolve_symbol (gfc_symbol *sym)
the type is not declared in the scope of the implicit
statement. Change the type to BT_UNKNOWN, both because it is so
and to prevent an ICE. */
- if (sym->ts.type == BT_DERIVED && sym->ts.derived->components == NULL
- && !sym->ts.derived->attr.zero_comp)
+ if (sym->ts.type == BT_DERIVED && sym->ts.u.derived->components == NULL
+ && !sym->ts.u.derived->attr.zero_comp)
{
gfc_error ("The derived type '%s' at %L is of type '%s', "
"which has not been defined", sym->name,
- &sym->declared_at, sym->ts.derived->name);
+ &sym->declared_at, sym->ts.u.derived->name);
sym->ts.type = BT_UNKNOWN;
return;
}
@@ -9896,23 +10180,23 @@ resolve_symbol (gfc_symbol *sym)
derived type is visible in the symbol's namespace, if it is a
module function and is not PRIVATE. */
if (sym->ts.type == BT_DERIVED
- && sym->ts.derived->attr.use_assoc
+ && sym->ts.u.derived->attr.use_assoc
&& sym->ns->proc_name
&& sym->ns->proc_name->attr.flavor == FL_MODULE)
{
gfc_symbol *ds;
- if (resolve_fl_derived (sym->ts.derived) == FAILURE)
+ if (resolve_fl_derived (sym->ts.u.derived) == FAILURE)
return;
- gfc_find_symbol (sym->ts.derived->name, sym->ns, 1, &ds);
+ gfc_find_symbol (sym->ts.u.derived->name, sym->ns, 1, &ds);
if (!ds && sym->attr.function
&& gfc_check_access (sym->attr.access, sym->ns->default_access))
{
symtree = gfc_new_symtree (&sym->ns->sym_root,
- sym->ts.derived->name);
- symtree->n.sym = sym->ts.derived;
- sym->ts.derived->refs++;
+ sym->ts.u.derived->name);
+ symtree->n.sym = sym->ts.u.derived;
+ sym->ts.u.derived->refs++;
}
}
@@ -9922,15 +10206,15 @@ resolve_symbol (gfc_symbol *sym)
161 in 95-006r3. */
if (sym->ts.type == BT_DERIVED
&& sym->ns->proc_name && sym->ns->proc_name->attr.flavor == FL_MODULE
- && !sym->ts.derived->attr.use_assoc
+ && !sym->ts.u.derived->attr.use_assoc
&& gfc_check_access (sym->attr.access, sym->ns->default_access)
- && !gfc_check_access (sym->ts.derived->attr.access,
- sym->ts.derived->ns->default_access)
+ && !gfc_check_access (sym->ts.u.derived->attr.access,
+ sym->ts.u.derived->ns->default_access)
&& gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PUBLIC %s '%s' at %L "
"of PRIVATE derived type '%s'",
(sym->attr.flavor == FL_PARAMETER) ? "parameter"
: "variable", sym->name, &sym->declared_at,
- sym->ts.derived->name) == FAILURE)
+ sym->ts.u.derived->name) == FAILURE)
return;
/* An assumed-size array with INTENT(OUT) shall not be of a type for which
@@ -9941,7 +10225,7 @@ resolve_symbol (gfc_symbol *sym)
&& sym->as
&& sym->as->type == AS_ASSUMED_SIZE)
{
- for (c = sym->ts.derived->components; c; c = c->next)
+ for (c = sym->ts.u.derived->components; c; c = c->next)
{
if (c->initializer)
{
@@ -10545,11 +10829,11 @@ sequence_type (gfc_typespec ts)
{
case BT_DERIVED:
- if (ts.derived->components == NULL)
+ if (ts.u.derived->components == NULL)
return SEQ_NONDEFAULT;
- result = sequence_type (ts.derived->components->ts);
- for (c = ts.derived->components->next; c; c = c->next)
+ result = sequence_type (ts.u.derived->components->ts);
+ for (c = ts.u.derived->components->next; c; c = c->next)
if (sequence_type (c->ts) != result)
return SEQ_MIXED;
@@ -10597,7 +10881,6 @@ sequence_type (gfc_typespec ts)
static gfc_try
resolve_equivalence_derived (gfc_symbol *derived, gfc_symbol *sym, gfc_expr *e)
{
- gfc_symbol *d;
gfc_component *c = derived->components;
if (!derived)
@@ -10621,7 +10904,7 @@ resolve_equivalence_derived (gfc_symbol *derived, gfc_symbol *sym, gfc_expr *e)
return FAILURE;
}
- if (sym->attr.in_common && has_default_initializer (sym->ts.derived))
+ if (sym->attr.in_common && has_default_initializer (sym->ts.u.derived))
{
gfc_error ("Derived type variable '%s' at %L with default "
"initialization cannot be in EQUIVALENCE with a variable "
@@ -10631,9 +10914,8 @@ resolve_equivalence_derived (gfc_symbol *derived, gfc_symbol *sym, gfc_expr *e)
for (; c ; c = c->next)
{
- d = c->ts.derived;
- if (d
- && (resolve_equivalence_derived (c->ts.derived, sym, e) == FAILURE))
+ if (c->ts.type == BT_DERIVED
+ && (resolve_equivalence_derived (c->ts.u.derived, sym, e) == FAILURE))
return FAILURE;
/* Shall not be an object of sequence derived type containing a pointer
@@ -10667,7 +10949,6 @@ static void
resolve_equivalence (gfc_equiv *eq)
{
gfc_symbol *sym;
- gfc_symbol *derived;
gfc_symbol *first_sym;
gfc_expr *e;
gfc_ref *r;
@@ -10731,11 +11012,11 @@ resolve_equivalence (gfc_equiv *eq)
if (start == NULL)
start = gfc_int_expr (1);
ref->u.ss.start = start;
- if (end == NULL && e->ts.cl)
- end = gfc_copy_expr (e->ts.cl->length);
+ if (end == NULL && e->ts.u.cl)
+ end = gfc_copy_expr (e->ts.u.cl->length);
ref->u.ss.end = end;
- ref->u.ss.length = e->ts.cl;
- e->ts.cl = NULL;
+ ref->u.ss.length = e->ts.u.cl;
+ e->ts.u.cl = NULL;
}
ref = ref->next;
gfc_free (mem);
@@ -10786,8 +11067,8 @@ resolve_equivalence (gfc_equiv *eq)
continue;
}
- derived = e->ts.derived;
- if (derived && resolve_equivalence_derived (derived, sym, e) == FAILURE)
+ if (e->ts.type == BT_DERIVED
+ && resolve_equivalence_derived (e->ts.u.derived, sym, e) == FAILURE)
continue;
/* Check that the types correspond correctly:
@@ -10920,15 +11201,15 @@ resolve_fntype (gfc_namespace *ns)
sym->attr.untyped = 1;
}
- if (sym->ts.type == BT_DERIVED && !sym->ts.derived->attr.use_assoc
+ if (sym->ts.type == BT_DERIVED && !sym->ts.u.derived->attr.use_assoc
&& !sym->attr.contained
- && !gfc_check_access (sym->ts.derived->attr.access,
- sym->ts.derived->ns->default_access)
+ && !gfc_check_access (sym->ts.u.derived->attr.access,
+ sym->ts.u.derived->ns->default_access)
&& gfc_check_access (sym->attr.access, sym->ns->default_access))
{
gfc_notify_std (GFC_STD_F2003, "Fortran 2003: PUBLIC function '%s' at "
"%L of PRIVATE type '%s'", sym->name,
- &sym->declared_at, sym->ts.derived->name);
+ &sym->declared_at, sym->ts.u.derived->name);
}
if (ns->entries)
@@ -10946,67 +11227,94 @@ resolve_fntype (gfc_namespace *ns)
}
}
+
/* 12.3.2.1.1 Defined operators. */
-static void
-gfc_resolve_uops (gfc_symtree *symtree)
+static gfc_try
+check_uop_procedure (gfc_symbol *sym, locus where)
{
- gfc_interface *itr;
- gfc_symbol *sym;
gfc_formal_arglist *formal;
- if (symtree == NULL)
- return;
+ if (!sym->attr.function)
+ {
+ gfc_error ("User operator procedure '%s' at %L must be a FUNCTION",
+ sym->name, &where);
+ return FAILURE;
+ }
- gfc_resolve_uops (symtree->left);
- gfc_resolve_uops (symtree->right);
+ if (sym->ts.type == BT_CHARACTER
+ && !(sym->ts.u.cl && sym->ts.u.cl->length)
+ && !(sym->result && sym->result->ts.u.cl
+ && sym->result->ts.u.cl->length))
+ {
+ gfc_error ("User operator procedure '%s' at %L cannot be assumed "
+ "character length", sym->name, &where);
+ return FAILURE;
+ }
- for (itr = symtree->n.uop->op; itr; itr = itr->next)
+ formal = sym->formal;
+ if (!formal || !formal->sym)
{
- sym = itr->sym;
- if (!sym->attr.function)
- gfc_error ("User operator procedure '%s' at %L must be a FUNCTION",
- sym->name, &sym->declared_at);
+ gfc_error ("User operator procedure '%s' at %L must have at least "
+ "one argument", sym->name, &where);
+ return FAILURE;
+ }
- if (sym->ts.type == BT_CHARACTER
- && !(sym->ts.cl && sym->ts.cl->length)
- && !(sym->result && sym->result->ts.cl
- && sym->result->ts.cl->length))
- gfc_error ("User operator procedure '%s' at %L cannot be assumed "
- "character length", sym->name, &sym->declared_at);
+ if (formal->sym->attr.intent != INTENT_IN)
+ {
+ gfc_error ("First argument of operator interface at %L must be "
+ "INTENT(IN)", &where);
+ return FAILURE;
+ }
- formal = sym->formal;
- if (!formal || !formal->sym)
- {
- gfc_error ("User operator procedure '%s' at %L must have at least "
- "one argument", sym->name, &sym->declared_at);
- continue;
- }
+ if (formal->sym->attr.optional)
+ {
+ gfc_error ("First argument of operator interface at %L cannot be "
+ "optional", &where);
+ return FAILURE;
+ }
- if (formal->sym->attr.intent != INTENT_IN)
- gfc_error ("First argument of operator interface at %L must be "
- "INTENT(IN)", &sym->declared_at);
+ formal = formal->next;
+ if (!formal || !formal->sym)
+ return SUCCESS;
- if (formal->sym->attr.optional)
- gfc_error ("First argument of operator interface at %L cannot be "
- "optional", &sym->declared_at);
+ if (formal->sym->attr.intent != INTENT_IN)
+ {
+ gfc_error ("Second argument of operator interface at %L must be "
+ "INTENT(IN)", &where);
+ return FAILURE;
+ }
- formal = formal->next;
- if (!formal || !formal->sym)
- continue;
+ if (formal->sym->attr.optional)
+ {
+ gfc_error ("Second argument of operator interface at %L cannot be "
+ "optional", &where);
+ return FAILURE;
+ }
- if (formal->sym->attr.intent != INTENT_IN)
- gfc_error ("Second argument of operator interface at %L must be "
- "INTENT(IN)", &sym->declared_at);
+ if (formal->next)
+ {
+ gfc_error ("Operator interface at %L must have, at most, two "
+ "arguments", &where);
+ return FAILURE;
+ }
- if (formal->sym->attr.optional)
- gfc_error ("Second argument of operator interface at %L cannot be "
- "optional", &sym->declared_at);
+ return SUCCESS;
+}
- if (formal->next)
- gfc_error ("Operator interface at %L must have, at most, two "
- "arguments", &sym->declared_at);
- }
+static void
+gfc_resolve_uops (gfc_symtree *symtree)
+{
+ gfc_interface *itr;
+
+ if (symtree == NULL)
+ return;
+
+ gfc_resolve_uops (symtree->left);
+ gfc_resolve_uops (symtree->right);
+
+ for (itr = symtree->n.uop->op; itr; itr = itr->next)
+ check_uop_procedure (itr->sym, itr->sym->declared_at);
}
@@ -11134,15 +11442,19 @@ void
gfc_resolve (gfc_namespace *ns)
{
gfc_namespace *old_ns;
+ code_stack *old_cs_base;
if (ns->resolved)
return;
+ ns->resolved = -1;
old_ns = gfc_current_ns;
+ old_cs_base = cs_base;
resolve_types (ns);
resolve_codes (ns);
gfc_current_ns = old_ns;
+ cs_base = old_cs_base;
ns->resolved = 1;
}
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 58422907d36..8cbb3c55b5c 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1139,7 +1139,7 @@ restart:
}
}
}
- else
+ else /* Fixed form. */
{
/* Fixed form continuation. */
if (!in_string && c == '!')
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index fa8a32a2431..fbb88a411af 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -3217,12 +3217,12 @@ gfc_simplify_len (gfc_expr *e, gfc_expr *kind)
}
}
- if (e->ts.cl != NULL && e->ts.cl->length != NULL
- && e->ts.cl->length->expr_type == EXPR_CONSTANT
- && e->ts.cl->length->ts.type == BT_INTEGER)
+ if (e->ts.u.cl != NULL && e->ts.u.cl->length != NULL
+ && e->ts.u.cl->length->expr_type == EXPR_CONSTANT
+ && e->ts.u.cl->length->ts.type == BT_INTEGER)
{
result = gfc_constant_result (BT_INTEGER, k, &e->where);
- mpz_set (result->value.integer, e->ts.cl->length->value.integer);
+ mpz_set (result->value.integer, e->ts.u.cl->length->value.integer);
if (gfc_range_check (result) == ARITH_OK)
return result;
else
@@ -4102,7 +4102,7 @@ gfc_simplify_pack (gfc_expr *array, gfc_expr *mask, gfc_expr *vector)
gfc_array_size (result, &result->shape[0]);
if (array->ts.type == BT_CHARACTER)
- result->ts.cl = array->ts.cl;
+ result->ts.u.cl = array->ts.u.cl;
return result;
}
@@ -4300,14 +4300,14 @@ gfc_simplify_repeat (gfc_expr *e, gfc_expr *n)
}
/* If we don't know the character length, we can do no more. */
- if (e->ts.cl && e->ts.cl->length
- && e->ts.cl->length->expr_type == EXPR_CONSTANT)
+ if (e->ts.u.cl && e->ts.u.cl->length
+ && e->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
- len = mpz_get_si (e->ts.cl->length->value.integer);
+ len = mpz_get_si (e->ts.u.cl->length->value.integer);
have_length = true;
}
else if (e->expr_type == EXPR_CONSTANT
- && (e->ts.cl == NULL || e->ts.cl->length == NULL))
+ && (e->ts.u.cl == NULL || e->ts.u.cl->length == NULL))
{
len = e->value.character.length;
}
@@ -4335,7 +4335,7 @@ gfc_simplify_repeat (gfc_expr *e, gfc_expr *n)
if (have_length)
{
mpz_tdiv_q (max, gfc_integer_kinds[i].huge,
- e->ts.cl->length->value.integer);
+ e->ts.u.cl->length->value.integer);
}
else
{
@@ -4364,8 +4364,8 @@ gfc_simplify_repeat (gfc_expr *e, gfc_expr *n)
return NULL;
if (len ||
- (e->ts.cl->length &&
- mpz_sgn (e->ts.cl->length->value.integer)) != 0)
+ (e->ts.u.cl->length &&
+ mpz_sgn (e->ts.u.cl->length->value.integer)) != 0)
{
const char *res = gfc_extract_int (n, &ncop);
gcc_assert (res == NULL);
@@ -5267,7 +5267,7 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp
return NULL;
if (source->ts.type == BT_CHARACTER)
- result->ts.cl = source->ts.cl;
+ result->ts.u.cl = source->ts.u.cl;
return result;
}
@@ -5623,7 +5623,7 @@ gfc_simplify_transpose (gfc_expr *matrix)
mpz_set (result->shape[1], matrix->shape[0]);
if (matrix->ts.type == BT_CHARACTER)
- result->ts.cl = matrix->ts.cl;
+ result->ts.u.cl = matrix->ts.u.cl;
matrix_rows = mpz_get_si (matrix->shape[0]);
matrix_ctor = matrix->value.constructor;
@@ -5706,7 +5706,7 @@ gfc_simplify_unpack (gfc_expr *vector, gfc_expr *mask, gfc_expr *field)
result->shape = gfc_copy_shape (mask->shape, mask->rank);
if (vector->ts.type == BT_CHARACTER)
- result->ts.cl = vector->ts.cl;
+ result->ts.u.cl = vector->ts.u.cl;
vector_ctor = vector->value.constructor;
mask_ctor = mask->value.constructor;
@@ -6087,7 +6087,7 @@ gfc_convert_char_constant (gfc_expr *e, bt type ATTRIBUTE_UNUSED, int kind)
result->shape = gfc_copy_shape (e->shape, e->rank);
result->where = e->where;
result->rank = e->rank;
- result->ts.cl = e->ts.cl;
+ result->ts.u.cl = e->ts.u.cl;
return result;
}
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index ec4afbe0209..8e4f6e9a114 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -269,11 +269,8 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns)
sym->ts = *ts;
sym->attr.implicit_type = 1;
- if (ts->cl)
- {
- sym->ts.cl = gfc_get_charlen ();
- *sym->ts.cl = *ts->cl;
- }
+ if (ts->type == BT_CHARACTER && ts->u.cl)
+ sym->ts.u.cl = gfc_new_charlen (sym->ns, ts->u.cl);
if (sym->attr.is_bind_c == 1)
{
@@ -810,7 +807,7 @@ duplicate_attr (const char *attr, locus *where)
gfc_try
-gfc_add_ext_attribute (symbol_attribute *attr, unsigned ext_attr,
+gfc_add_ext_attribute (symbol_attribute *attr, ext_attr_id_t ext_attr,
locus *where ATTRIBUTE_UNUSED)
{
attr->ext_attr |= 1 << ext_attr;
@@ -1641,6 +1638,10 @@ gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
{
int is_proc_lang_bind_spec;
+ /* In line with the other attributes, we only add bits but do not remove
+ them; cf. also PR 41034. */
+ dest->ext_attr |= src->ext_attr;
+
if (src->allocatable && gfc_add_allocatable (dest, where) == FAILURE)
goto fail;
@@ -1710,7 +1711,7 @@ gfc_copy_attr (symbol_attribute *dest, symbol_attribute *src, locus *where)
if (src->cray_pointer && gfc_add_cray_pointer (dest, where) == FAILURE)
goto fail;
if (src->cray_pointee && gfc_add_cray_pointee (dest, where) == FAILURE)
- goto fail;
+ goto fail;
is_proc_lang_bind_spec = (src->flavor == FL_PROCEDURE ? 1 : 0);
if (src->is_bind_c
@@ -1770,10 +1771,10 @@ gfc_add_component (gfc_symbol *sym, const char *name,
}
if (sym->attr.extension
- && gfc_find_component (sym->components->ts.derived, name, true, true))
+ && gfc_find_component (sym->components->ts.u.derived, name, true, true))
{
gfc_error ("Component '%s' at %C already in the parent type "
- "at %L", name, &sym->components->ts.derived->declared_at);
+ "at %L", name, &sym->components->ts.u.derived->declared_at);
return FAILURE;
}
@@ -1806,8 +1807,8 @@ switch_types (gfc_symtree *st, gfc_symbol *from, gfc_symbol *to)
return;
sym = st->n.sym;
- if (sym->ts.type == BT_DERIVED && sym->ts.derived == from)
- sym->ts.derived = to;
+ if (sym->ts.type == BT_DERIVED && sym->ts.u.derived == from)
+ sym->ts.u.derived = to;
switch_types (st->left, from, to);
switch_types (st->right, from, to);
@@ -1859,8 +1860,8 @@ gfc_use_derived (gfc_symbol *sym)
for (i = 0; i < GFC_LETTERS; i++)
{
t = &sym->ns->default_type[i];
- if (t->derived == sym)
- t->derived = s;
+ if (t->u.derived == sym)
+ t->u.derived = s;
}
st = gfc_find_symtree (sym->ns->sym_root, sym->name);
@@ -1913,7 +1914,7 @@ gfc_find_component (gfc_symbol *sym, const char *name,
&& sym->attr.extension
&& sym->components->ts.type == BT_DERIVED)
{
- p = gfc_find_component (sym->components->ts.derived, name,
+ p = gfc_find_component (sym->components->ts.u.derived, name,
noaccess, silent);
/* Do not overwrite the error. */
if (p == NULL)
@@ -2218,7 +2219,10 @@ gfc_get_namespace (gfc_namespace *parent, int parent_types)
ns->parent = parent;
for (in = GFC_INTRINSIC_BEGIN; in != GFC_INTRINSIC_END; in++)
- ns->operator_access[in] = ACCESS_UNKNOWN;
+ {
+ ns->operator_access[in] = ACCESS_UNKNOWN;
+ ns->tb_op[in] = NULL;
+ }
/* Initialize default implicit types. */
for (i = 'a'; i <= 'z'; i++)
@@ -2946,7 +2950,6 @@ free_common_tree (gfc_symtree * common_tree)
static void
free_uop_tree (gfc_symtree *uop_tree)
{
-
if (uop_tree == NULL)
return;
@@ -2954,7 +2957,6 @@ free_uop_tree (gfc_symtree *uop_tree)
free_uop_tree (uop_tree->right);
gfc_free_interface (uop_tree->n.uop->op);
-
gfc_free (uop_tree->n.uop);
gfc_free (uop_tree);
}
@@ -3071,15 +3073,29 @@ gfc_free_finalizer_list (gfc_finalizer* list)
}
-/* Create a new gfc_charlen structure and add it to a namespace. */
+/* Create a new gfc_charlen structure and add it to a namespace.
+ If 'old_cl' is given, the newly created charlen will be a copy of it. */
gfc_charlen*
-gfc_new_charlen (gfc_namespace *ns)
+gfc_new_charlen (gfc_namespace *ns, gfc_charlen *old_cl)
{
gfc_charlen *cl;
cl = gfc_get_charlen ();
+
+ /* Put into namespace. */
cl->next = ns->cl_list;
ns->cl_list = cl;
+
+ /* Copy old_cl. */
+ if (old_cl)
+ {
+ cl->length = gfc_copy_expr (old_cl->length);
+ cl->length_from_typespec = old_cl->length_from_typespec;
+ cl->backend_decl = old_cl->backend_decl;
+ cl->passed_length = old_cl->passed_length;
+ cl->resolved = old_cl->resolved;
+ }
+
return cl;
}
@@ -3126,6 +3142,7 @@ gfc_free_namespace (gfc_namespace *ns)
free_uop_tree (ns->uop_root);
free_common_tree (ns->common_root);
free_tb_tree (ns->tb_sym_root);
+ free_tb_tree (ns->tb_uop_root);
gfc_free_finalizer_list (ns->finalizers);
gfc_free_charlen (ns->cl_list, NULL);
free_st_labels (ns->st_labels);
@@ -3257,8 +3274,8 @@ gfc_is_var_automatic (gfc_symbol *sym)
return true;
/* Check for non-constant length character variables. */
if (sym->ts.type == BT_CHARACTER
- && sym->ts.cl
- && !gfc_is_constant_expr (sym->ts.cl->length))
+ && sym->ts.u.cl
+ && !gfc_is_constant_expr (sym->ts.u.cl->length))
return true;
return false;
}
@@ -3475,14 +3492,14 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
/* BIND(C) derived types must have interoperable components. */
if (curr_comp->ts.type == BT_DERIVED
- && curr_comp->ts.derived->ts.is_iso_c != 1
- && curr_comp->ts.derived != derived_sym)
+ && curr_comp->ts.u.derived->ts.is_iso_c != 1
+ && curr_comp->ts.u.derived != derived_sym)
{
/* This should be allowed; the draft says a derived-type can not
have type parameters if it is has the BIND attribute. Type
parameters seem to be for making parameterized derived types.
There's no need to verify the type if it is c_ptr/c_funptr. */
- retval = verify_bind_c_derived_type (curr_comp->ts.derived);
+ retval = verify_bind_c_derived_type (curr_comp->ts.u.derived);
}
else
{
@@ -3581,10 +3598,10 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
/* The c_ptr and c_funptr derived types will provide the
definition for c_null_ptr and c_null_funptr, respectively. */
if (ptr_id == ISOCBINDING_NULL_PTR)
- tmp_sym->ts.derived = get_iso_c_binding_dt (ISOCBINDING_PTR);
+ tmp_sym->ts.u.derived = get_iso_c_binding_dt (ISOCBINDING_PTR);
else
- tmp_sym->ts.derived = get_iso_c_binding_dt (ISOCBINDING_FUNPTR);
- if (tmp_sym->ts.derived == NULL)
+ tmp_sym->ts.u.derived = get_iso_c_binding_dt (ISOCBINDING_FUNPTR);
+ if (tmp_sym->ts.u.derived == NULL)
{
/* This can occur if the user forgot to declare c_ptr or
c_funptr and they're trying to use one of the procedures
@@ -3597,7 +3614,7 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
? "_gfortran_iso_c_binding_c_ptr"
: "_gfortran_iso_c_binding_c_funptr"));
- tmp_sym->ts.derived =
+ tmp_sym->ts.u.derived =
get_iso_c_binding_dt (ptr_id == ISOCBINDING_NULL_PTR
? ISOCBINDING_PTR : ISOCBINDING_FUNPTR);
}
@@ -3618,7 +3635,7 @@ gen_special_c_interop_ptr (int ptr_id, const char *ptr_name,
tmp_sym->value = gfc_get_expr ();
tmp_sym->value->expr_type = EXPR_STRUCTURE;
tmp_sym->value->ts.type = BT_DERIVED;
- tmp_sym->value->ts.derived = tmp_sym->ts.derived;
+ tmp_sym->value->ts.u.derived = tmp_sym->ts.u.derived;
/* Create a constructor with no expr, that way we can recognize if the user
tries to call the structure constructor for one of the iso_c_binding
derived types during resolution (resolve_structure_cons). */
@@ -3722,7 +3739,7 @@ gen_cptr_param (gfc_formal_arglist **head,
gfc_get_ha_symbol (c_ptr_type, &(c_ptr_sym));
}
- param_sym->ts.derived = c_ptr_sym;
+ param_sym->ts.u.derived = c_ptr_sym;
param_sym->module = gfc_get_string (module_name);
/* Make new formal arg. */
@@ -3950,7 +3967,7 @@ gfc_copy_formal_args_intr (gfc_symbol *dest, gfc_intrinsic_sym *src)
formal_arg->sym->attr.dummy = 1;
if (formal_arg->sym->ts.type == BT_CHARACTER)
- formal_arg->sym->ts.cl = gfc_new_charlen (gfc_current_ns);
+ formal_arg->sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
/* If this isn't the first arg, set up the next ptr. For the
last arg built, the formal_arg->next will never get set to
@@ -4213,8 +4230,8 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
tmp_sym->value->value.character.string[0]
= (gfc_char_t) c_interop_kinds_table[s].value;
tmp_sym->value->value.character.string[1] = '\0';
- tmp_sym->ts.cl = gfc_get_charlen ();
- tmp_sym->ts.cl->length = gfc_int_expr (1);
+ tmp_sym->ts.u.cl = gfc_new_charlen (gfc_current_ns, NULL);
+ tmp_sym->ts.u.cl->length = gfc_int_expr (1);
/* May not need this in both attr and ts, but do need in
attr for writing module file. */
@@ -4258,7 +4275,7 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
tmp_sym->attr.referenced = 1;
- tmp_sym->ts.derived = tmp_sym;
+ tmp_sym->ts.u.derived = tmp_sym;
/* Add the symbol created for the derived type to the current ns. */
dt_list_ptr = &(gfc_derived_types);
@@ -4343,13 +4360,13 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
C address of. */
tmp_sym->ts.type = BT_DERIVED;
if (s == ISOCBINDING_LOC)
- tmp_sym->ts.derived =
+ tmp_sym->ts.u.derived =
get_iso_c_binding_dt (ISOCBINDING_PTR);
else
- tmp_sym->ts.derived =
+ tmp_sym->ts.u.derived =
get_iso_c_binding_dt (ISOCBINDING_FUNPTR);
- if (tmp_sym->ts.derived == NULL)
+ if (tmp_sym->ts.u.derived == NULL)
{
/* Create the necessary derived type so we can continue
processing the file. */
@@ -4359,7 +4376,7 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
(const char *)(s == ISOCBINDING_FUNLOC
? "_gfortran_iso_c_binding_c_funptr"
: "_gfortran_iso_c_binding_c_ptr"));
- tmp_sym->ts.derived =
+ tmp_sym->ts.u.derived =
get_iso_c_binding_dt (s == ISOCBINDING_FUNLOC
? ISOCBINDING_FUNPTR
: ISOCBINDING_PTR);
@@ -4511,28 +4528,33 @@ gfc_get_derived_super_type (gfc_symbol* derived)
gcc_assert (derived->components);
gcc_assert (derived->components->ts.type == BT_DERIVED);
- gcc_assert (derived->components->ts.derived);
+ gcc_assert (derived->components->ts.u.derived);
- return derived->components->ts.derived;
+ return derived->components->ts.u.derived;
}
-/* Find a type-bound procedure by name for a derived-type (looking recursively
- through the super-types). */
+/* General worker function to find either a type-bound procedure or a
+ type-bound user operator. */
-gfc_symtree*
-gfc_find_typebound_proc (gfc_symbol* derived, gfc_try* t,
- const char* name, bool noaccess)
+static gfc_symtree*
+find_typebound_proc_uop (gfc_symbol* derived, gfc_try* t,
+ const char* name, bool noaccess, bool uop)
{
gfc_symtree* res;
+ gfc_symtree* root;
+
+ /* Set correct symbol-root. */
+ gcc_assert (derived->f2k_derived);
+ root = (uop ? derived->f2k_derived->tb_uop_root
+ : derived->f2k_derived->tb_sym_root);
/* Set default to failure. */
if (t)
*t = FAILURE;
/* Try to find it in the current type's namespace. */
- gcc_assert (derived->f2k_derived);
- res = gfc_find_symtree (derived->f2k_derived->tb_sym_root, name);
+ res = gfc_find_symtree (root, name);
if (res && res->n.tb)
{
/* We found one. */
@@ -4556,7 +4578,79 @@ gfc_find_typebound_proc (gfc_symbol* derived, gfc_try* t,
gfc_symbol* super_type;
super_type = gfc_get_derived_super_type (derived);
gcc_assert (super_type);
- return gfc_find_typebound_proc (super_type, t, name, noaccess);
+
+ return find_typebound_proc_uop (super_type, t, name, noaccess, uop);
+ }
+
+ /* Nothing found. */
+ return NULL;
+}
+
+
+/* Find a type-bound procedure or user operator by name for a derived-type
+ (looking recursively through the super-types). */
+
+gfc_symtree*
+gfc_find_typebound_proc (gfc_symbol* derived, gfc_try* t,
+ const char* name, bool noaccess)
+{
+ return find_typebound_proc_uop (derived, t, name, noaccess, false);
+}
+
+gfc_symtree*
+gfc_find_typebound_user_op (gfc_symbol* derived, gfc_try* t,
+ const char* name, bool noaccess)
+{
+ return find_typebound_proc_uop (derived, t, name, noaccess, true);
+}
+
+
+/* Find a type-bound intrinsic operator looking recursively through the
+ super-type hierarchy. */
+
+gfc_typebound_proc*
+gfc_find_typebound_intrinsic_op (gfc_symbol* derived, gfc_try* t,
+ gfc_intrinsic_op op, bool noaccess)
+{
+ gfc_typebound_proc* res;
+
+ /* Set default to failure. */
+ if (t)
+ *t = FAILURE;
+
+ /* Try to find it in the current type's namespace. */
+ if (derived->f2k_derived)
+ res = derived->f2k_derived->tb_op[op];
+ else
+ res = NULL;
+
+ /* Check access. */
+ if (res)
+ {
+ /* We found one. */
+ if (t)
+ *t = SUCCESS;
+
+ if (!noaccess && derived->attr.use_assoc
+ && res->access == ACCESS_PRIVATE)
+ {
+ gfc_error ("'%s' of '%s' is PRIVATE at %C",
+ gfc_op2string (op), derived->name);
+ if (t)
+ *t = FAILURE;
+ }
+
+ return res;
+ }
+
+ /* Otherwise, recurse on parent type if derived is an extension. */
+ if (derived->attr.extension)
+ {
+ gfc_symbol* super_type;
+ super_type = gfc_get_derived_super_type (derived);
+ gcc_assert (super_type);
+
+ return gfc_find_typebound_intrinsic_op (super_type, t, op, noaccess);
}
/* Nothing found. */
diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c
index 4fe41d58ffb..e19a7d34e0a 100644
--- a/gcc/fortran/target-memory.c
+++ b/gcc/fortran/target-memory.c
@@ -229,7 +229,7 @@ encode_derived (gfc_expr *source, unsigned char *buffer, size_t buffer_size)
type = gfc_typenode_for_spec (&source->ts);
ctr = source->value.constructor;
- cmp = source->ts.derived->components;
+ cmp = source->ts.u.derived->components;
for (;ctr; ctr = ctr->next, cmp = cmp->next)
{
gcc_assert (cmp);
@@ -435,9 +435,9 @@ gfc_interpret_character (unsigned char *buffer, size_t buffer_size,
{
int i;
- if (result->ts.cl && result->ts.cl->length)
+ if (result->ts.u.cl && result->ts.u.cl->length)
result->value.character.length =
- (int) mpz_get_ui (result->ts.cl->length->value.integer);
+ (int) mpz_get_ui (result->ts.u.cl->length->value.integer);
gcc_assert (buffer_size >= size_character (result->value.character.length,
result->ts.kind));
@@ -484,7 +484,7 @@ gfc_interpret_derived (unsigned char *buffer, size_t buffer_size, gfc_expr *resu
result->expr_type = EXPR_STRUCTURE;
type = gfc_typenode_for_spec (&result->ts);
- cmp = result->ts.derived->components;
+ cmp = result->ts.u.derived->components;
/* Run through the derived type components. */
for (;cmp; cmp = cmp->next)
@@ -633,7 +633,7 @@ expr_to_char (gfc_expr *e, unsigned char *data, unsigned char *chk, size_t len)
if (e->ts.type == BT_DERIVED)
{
ctr = e->value.constructor;
- cmp = e->ts.derived->components;
+ cmp = e->ts.u.derived->components;
for (;ctr; ctr = ctr->next, cmp = cmp->next)
{
gcc_assert (cmp && cmp->backend_decl);
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index c625bc4bf60..529a6b10495 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -1533,7 +1533,7 @@ get_array_ctor_var_strlen (gfc_expr * expr, tree * len)
}
}
- *len = ts->cl->backend_decl;
+ *len = ts->u.cl->backend_decl;
}
@@ -1549,12 +1549,12 @@ get_array_ctor_all_strlen (stmtblock_t *block, gfc_expr *e, tree *len)
if (*len && INTEGER_CST_P (*len))
return;
- if (!e->ref && e->ts.cl && e->ts.cl->length
- && e->ts.cl->length->expr_type == EXPR_CONSTANT)
+ if (!e->ref && e->ts.u.cl && e->ts.u.cl->length
+ && e->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
/* This is easy. */
- gfc_conv_const_charlen (e->ts.cl);
- *len = e->ts.cl->backend_decl;
+ gfc_conv_const_charlen (e->ts.u.cl);
+ *len = e->ts.u.cl->backend_decl;
}
else
{
@@ -1575,7 +1575,7 @@ get_array_ctor_all_strlen (stmtblock_t *block, gfc_expr *e, tree *len)
gfc_add_block_to_block (block, &se.pre);
gfc_add_block_to_block (block, &se.post);
- e->ts.cl->backend_decl = *len;
+ e->ts.u.cl->backend_decl = *len;
}
}
@@ -1825,8 +1825,8 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
/* Do bounds-checking here and in gfc_trans_array_ctor_element only if no
typespec was given for the array constructor. */
- typespec_chararray_ctor = (ss->expr->ts.cl
- && ss->expr->ts.cl->length_from_typespec);
+ typespec_chararray_ctor = (ss->expr->ts.u.cl
+ && ss->expr->ts.u.cl->length_from_typespec);
if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
&& ss->expr->ts.type == BT_CHARACTER && !typespec_chararray_ctor)
@@ -1845,14 +1845,14 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
/* get_array_ctor_strlen walks the elements of the constructor, if a
typespec was given, we already know the string length and want the one
specified there. */
- if (typespec_chararray_ctor && ss->expr->ts.cl->length
- && ss->expr->ts.cl->length->expr_type != EXPR_CONSTANT)
+ if (typespec_chararray_ctor && ss->expr->ts.u.cl->length
+ && ss->expr->ts.u.cl->length->expr_type != EXPR_CONSTANT)
{
gfc_se length_se;
const_string = false;
gfc_init_se (&length_se, NULL);
- gfc_conv_expr_type (&length_se, ss->expr->ts.cl->length,
+ gfc_conv_expr_type (&length_se, ss->expr->ts.u.cl->length,
gfc_charlen_type_node);
ss->string_length = length_se.expr;
gfc_add_block_to_block (&loop->pre, &length_se.pre);
@@ -1866,7 +1866,7 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss, locus * where)
and not end up here. */
gcc_assert (ss->string_length);
- ss->expr->ts.cl->backend_decl = ss->string_length;
+ ss->expr->ts.u.cl->backend_decl = ss->string_length;
type = gfc_get_character_type_len (ss->expr->ts.kind, ss->string_length);
if (const_string)
@@ -2096,11 +2096,11 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
case GFC_SS_CONSTRUCTOR:
if (ss->expr->ts.type == BT_CHARACTER
&& ss->string_length == NULL
- && ss->expr->ts.cl
- && ss->expr->ts.cl->length)
+ && ss->expr->ts.u.cl
+ && ss->expr->ts.u.cl->length)
{
gfc_init_se (&se, NULL);
- gfc_conv_expr_type (&se, ss->expr->ts.cl->length,
+ gfc_conv_expr_type (&se, ss->expr->ts.u.cl->length,
gfc_charlen_type_node);
ss->string_length = se.expr;
gfc_add_block_to_block (&loop->pre, &se.pre);
@@ -4002,9 +4002,9 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat)
gfc_conv_descriptor_offset_set (&se->pre, se->expr, offset);
if (expr->ts.type == BT_DERIVED
- && expr->ts.derived->attr.alloc_comp)
+ && expr->ts.u.derived->attr.alloc_comp)
{
- tmp = gfc_nullify_alloc_comp (expr->ts.derived, se->expr,
+ tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, se->expr,
ref->u.ar.as->rank);
gfc_add_expr_to_block (&se->pre, tmp);
}
@@ -4290,9 +4290,9 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
/* Evaluate character string length. */
if (sym->ts.type == BT_CHARACTER
- && onstack && !INTEGER_CST_P (sym->ts.cl->backend_decl))
+ && onstack && !INTEGER_CST_P (sym->ts.u.cl->backend_decl))
{
- gfc_conv_string_length (sym->ts.cl, NULL, &block);
+ gfc_conv_string_length (sym->ts.u.cl, NULL, &block);
gfc_trans_vla_type_sizes (sym, &block);
@@ -4315,8 +4315,8 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody)
gcc_assert (!sym->module);
if (sym->ts.type == BT_CHARACTER
- && !INTEGER_CST_P (sym->ts.cl->backend_decl))
- gfc_conv_string_length (sym->ts.cl, NULL, &block);
+ && !INTEGER_CST_P (sym->ts.u.cl->backend_decl))
+ gfc_conv_string_length (sym->ts.u.cl, NULL, &block);
size = gfc_trans_array_bounds (type, sym, &offset, &block);
@@ -4381,8 +4381,8 @@ gfc_trans_g77_array (gfc_symbol * sym, tree body)
gfc_start_block (&block);
if (sym->ts.type == BT_CHARACTER
- && TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL)
- gfc_conv_string_length (sym->ts.cl, NULL, &block);
+ && TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL)
+ gfc_conv_string_length (sym->ts.u.cl, NULL, &block);
/* Evaluate the bounds of the array. */
gfc_trans_array_bounds (type, sym, &offset, &block);
@@ -4474,8 +4474,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body)
gfc_start_block (&block);
if (sym->ts.type == BT_CHARACTER
- && TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL)
- gfc_conv_string_length (sym->ts.cl, NULL, &block);
+ && TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL)
+ gfc_conv_string_length (sym->ts.u.cl, NULL, &block);
checkparm = (sym->as->type == AS_EXPLICIT
&& (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS));
@@ -4867,11 +4867,11 @@ get_array_charlen (gfc_expr *expr, gfc_se *se)
gfc_actual_arglist *arg;
gfc_se tse;
- if (expr->ts.cl->length
- && gfc_is_constant_expr (expr->ts.cl->length))
+ if (expr->ts.u.cl->length
+ && gfc_is_constant_expr (expr->ts.u.cl->length))
{
- if (!expr->ts.cl->backend_decl)
- gfc_conv_string_length (expr->ts.cl, expr, &se->pre);
+ if (!expr->ts.u.cl->backend_decl)
+ gfc_conv_string_length (expr->ts.u.cl, expr, &se->pre);
return;
}
@@ -4880,11 +4880,11 @@ get_array_charlen (gfc_expr *expr, gfc_se *se)
case EXPR_OP:
get_array_charlen (expr->value.op.op1, se);
- /* For parentheses the expression ts.cl is identical. */
+ /* For parentheses the expression ts.u.cl is identical. */
if (expr->value.op.op == INTRINSIC_PARENTHESES)
return;
- expr->ts.cl->backend_decl =
+ expr->ts.u.cl->backend_decl =
gfc_create_var (gfc_charlen_type_node, "sln");
if (expr->value.op.op2)
@@ -4895,21 +4895,21 @@ get_array_charlen (gfc_expr *expr, gfc_se *se)
/* Add the string lengths and assign them to the expression
string length backend declaration. */
- gfc_add_modify (&se->pre, expr->ts.cl->backend_decl,
+ gfc_add_modify (&se->pre, expr->ts.u.cl->backend_decl,
fold_build2 (PLUS_EXPR, gfc_charlen_type_node,
- expr->value.op.op1->ts.cl->backend_decl,
- expr->value.op.op2->ts.cl->backend_decl));
+ expr->value.op.op1->ts.u.cl->backend_decl,
+ expr->value.op.op2->ts.u.cl->backend_decl));
}
else
- gfc_add_modify (&se->pre, expr->ts.cl->backend_decl,
- expr->value.op.op1->ts.cl->backend_decl);
+ gfc_add_modify (&se->pre, expr->ts.u.cl->backend_decl,
+ expr->value.op.op1->ts.u.cl->backend_decl);
break;
case EXPR_FUNCTION:
if (expr->value.function.esym == NULL
- || expr->ts.cl->length->expr_type == EXPR_CONSTANT)
+ || expr->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
- gfc_conv_string_length (expr->ts.cl, expr, &se->pre);
+ gfc_conv_string_length (expr->ts.u.cl, expr, &se->pre);
break;
}
@@ -4932,19 +4932,19 @@ get_array_charlen (gfc_expr *expr, gfc_se *se)
gfc_init_se (&tse, NULL);
/* Build the expression for the character length and convert it. */
- gfc_apply_interface_mapping (&mapping, &tse, expr->ts.cl->length);
+ gfc_apply_interface_mapping (&mapping, &tse, expr->ts.u.cl->length);
gfc_add_block_to_block (&se->pre, &tse.pre);
gfc_add_block_to_block (&se->post, &tse.post);
tse.expr = fold_convert (gfc_charlen_type_node, tse.expr);
tse.expr = fold_build2 (MAX_EXPR, gfc_charlen_type_node, tse.expr,
build_int_cst (gfc_charlen_type_node, 0));
- expr->ts.cl->backend_decl = tse.expr;
+ expr->ts.u.cl->backend_decl = tse.expr;
gfc_free_interface_mapping (&mapping);
break;
default:
- gfc_conv_string_length (expr->ts.cl, expr, &se->pre);
+ gfc_conv_string_length (expr->ts.u.cl, expr, &se->pre);
break;
}
}
@@ -5085,7 +5085,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
/* Elemental function. */
need_tmp = 1;
if (expr->ts.type == BT_CHARACTER
- && expr->ts.cl->length->expr_type != EXPR_CONSTANT)
+ && expr->ts.u.cl->length->expr_type != EXPR_CONSTANT)
get_array_charlen (expr, se);
info = NULL;
@@ -5147,13 +5147,13 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss)
loop.temp_ss->next = gfc_ss_terminator;
if (expr->ts.type == BT_CHARACTER
- && !expr->ts.cl->backend_decl)
+ && !expr->ts.u.cl->backend_decl)
get_array_charlen (expr, se);
loop.temp_ss->data.temp.type = gfc_typenode_for_spec (&expr->ts);
if (expr->ts.type == BT_CHARACTER)
- loop.temp_ss->string_length = expr->ts.cl->backend_decl;
+ loop.temp_ss->string_length = expr->ts.u.cl->backend_decl;
else
loop.temp_ss->string_length = NULL;
@@ -5469,7 +5469,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
if (expr->expr_type == EXPR_ARRAY && expr->ts.type == BT_CHARACTER)
{
get_array_ctor_strlen (&se->pre, expr->value.constructor, &tmp);
- expr->ts.cl->backend_decl = tmp;
+ expr->ts.u.cl->backend_decl = tmp;
se->string_length = tmp;
}
@@ -5486,7 +5486,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
tmp = gfc_get_symbol_decl (sym);
if (sym->ts.type == BT_CHARACTER)
- se->string_length = sym->ts.cl->backend_decl;
+ se->string_length = sym->ts.u.cl->backend_decl;
if (!sym->attr.pointer && sym->as->type != AS_ASSUMED_SHAPE
&& !sym->attr.allocatable)
{
@@ -5543,12 +5543,12 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77,
/* Deallocate the allocatable components of structures that are
not variable. */
if (expr->ts.type == BT_DERIVED
- && expr->ts.derived->attr.alloc_comp
+ && expr->ts.u.derived->attr.alloc_comp
&& expr->expr_type != EXPR_VARIABLE)
{
tmp = build_fold_indirect_ref_loc (input_location,
se->expr);
- tmp = gfc_deallocate_alloc_comp (expr->ts.derived, tmp, expr->rank);
+ tmp = gfc_deallocate_alloc_comp (expr->ts.u.derived, tmp, expr->rank);
gfc_add_expr_to_block (&se->post, tmp);
}
@@ -5854,7 +5854,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
for (c = der_type->components; c; c = c->next)
{
bool cmp_has_alloc_comps = (c->ts.type == BT_DERIVED)
- && c->ts.derived->attr.alloc_comp;
+ && c->ts.u.derived->attr.alloc_comp;
cdecl = c->backend_decl;
ctype = TREE_TYPE (cdecl);
@@ -5868,7 +5868,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
comp = fold_build3 (COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
rank = c->as ? c->as->rank : 0;
- tmp = structure_alloc_comps (c->ts.derived, comp, NULL_TREE,
+ tmp = structure_alloc_comps (c->ts.u.derived, comp, NULL_TREE,
rank, purpose);
gfc_add_expr_to_block (&fnblock, tmp);
}
@@ -5896,7 +5896,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
comp = fold_build3 (COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
rank = c->as ? c->as->rank : 0;
- tmp = structure_alloc_comps (c->ts.derived, comp, NULL_TREE,
+ tmp = structure_alloc_comps (c->ts.u.derived, comp, NULL_TREE,
rank, purpose);
gfc_add_expr_to_block (&fnblock, tmp);
}
@@ -5922,7 +5922,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
rank = c->as ? c->as->rank : 0;
tmp = fold_convert (TREE_TYPE (dcmp), comp);
gfc_add_modify (&fnblock, dcmp, tmp);
- tmp = structure_alloc_comps (c->ts.derived, comp, dcmp,
+ tmp = structure_alloc_comps (c->ts.u.derived, comp, dcmp,
rank, purpose);
gfc_add_expr_to_block (&fnblock, tmp);
}
@@ -5985,7 +5985,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
bool sym_has_alloc_comp;
sym_has_alloc_comp = (sym->ts.type == BT_DERIVED)
- && sym->ts.derived->attr.alloc_comp;
+ && sym->ts.u.derived->attr.alloc_comp;
/* Make sure the frontend gets these right. */
if (!(sym->attr.pointer || sym->attr.allocatable || sym_has_alloc_comp))
@@ -5999,9 +5999,9 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
|| TREE_CODE (sym->backend_decl) == PARM_DECL);
if (sym->ts.type == BT_CHARACTER
- && !INTEGER_CST_P (sym->ts.cl->backend_decl))
+ && !INTEGER_CST_P (sym->ts.u.cl->backend_decl))
{
- gfc_conv_string_length (sym->ts.cl, NULL, &fnblock);
+ gfc_conv_string_length (sym->ts.u.cl, NULL, &fnblock);
gfc_trans_vla_type_sizes (sym, &fnblock);
}
@@ -6035,7 +6035,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
if (!sym->attr.save)
{
rank = sym->as ? sym->as->rank : 0;
- tmp = gfc_nullify_alloc_comp (sym->ts.derived, descriptor, rank);
+ tmp = gfc_nullify_alloc_comp (sym->ts.u.derived, descriptor, rank);
gfc_add_expr_to_block (&fnblock, tmp);
if (sym->value)
{
@@ -6068,7 +6068,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, tree body)
{
int rank;
rank = sym->as ? sym->as->rank : 0;
- tmp = gfc_deallocate_alloc_comp (sym->ts.derived, descriptor, rank);
+ tmp = gfc_deallocate_alloc_comp (sym->ts.u.derived, descriptor, rank);
gfc_add_expr_to_block (&fnblock, tmp);
}
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index ca94567d633..5b1952aee4a 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -132,7 +132,7 @@ get_segment_info (gfc_symbol * sym, HOST_WIDE_INT offset)
/* Make sure we've got the character length. */
if (sym->ts.type == BT_CHARACTER)
- gfc_conv_const_charlen (sym->ts.cl);
+ gfc_conv_const_charlen (sym->ts.u.cl);
/* Create the segment_info and fill it in. */
s = (segment_info *) gfc_getmem (sizeof (segment_info));
@@ -830,7 +830,7 @@ calculate_offset (gfc_expr *e)
case AR_ELEMENT:
n = element_number (&reference->u.ar);
if (element_type->type == BT_CHARACTER)
- gfc_conv_const_charlen (element_type->cl);
+ gfc_conv_const_charlen (element_type->u.cl);
element_size =
int_size_in_bytes (gfc_typenode_for_spec (element_type));
offset += n * element_size;
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 4b7b2c027ee..035f40b125c 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -342,8 +342,8 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr)
/* We may be receiving an expression for C_NULL_PTR or C_NULL_FUNPTR. If
so, they expr_type will not yet be an EXPR_CONSTANT. We need to make
it so here. */
- if (expr->ts.type == BT_DERIVED && expr->ts.derived
- && expr->ts.derived->attr.is_iso_c)
+ if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
+ && expr->ts.u.derived->attr.is_iso_c)
{
if (expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_PTR
|| expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_FUNPTR)
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 783c8f8308e..7fb571f5e57 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -796,7 +796,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
/* Do we know the element size? */
known_size = sym->ts.type != BT_CHARACTER
- || INTEGER_CST_P (sym->ts.cl->backend_decl);
+ || INTEGER_CST_P (sym->ts.u.cl->backend_decl);
if (known_size && !GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (type)))
{
@@ -928,10 +928,10 @@ gfc_nonlocal_dummy_array_decl (gfc_symbol *sym)
static tree
gfc_create_string_length (gfc_symbol * sym)
{
- gcc_assert (sym->ts.cl);
- gfc_conv_const_charlen (sym->ts.cl);
+ gcc_assert (sym->ts.u.cl);
+ gfc_conv_const_charlen (sym->ts.u.cl);
- if (sym->ts.cl->backend_decl == NULL_TREE)
+ if (sym->ts.u.cl->backend_decl == NULL_TREE)
{
tree length;
char name[GFC_MAX_MANGLED_SYMBOL_LEN + 2];
@@ -947,11 +947,11 @@ gfc_create_string_length (gfc_symbol * sym)
if (sym->ns->proc_name->tlink != NULL)
gfc_defer_symbol_init (sym);
- sym->ts.cl->backend_decl = length;
+ sym->ts.u.cl->backend_decl = length;
}
- gcc_assert (sym->ts.cl->backend_decl != NULL_TREE);
- return sym->ts.cl->backend_decl;
+ gcc_assert (sym->ts.u.cl->backend_decl != NULL_TREE);
+ return sym->ts.u.cl->backend_decl;
}
/* If a variable is assigned a label, we add another two auxiliary
@@ -1050,10 +1050,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
/* Create a character length variable. */
if (sym->ts.type == BT_CHARACTER)
{
- if (sym->ts.cl->backend_decl == NULL_TREE)
+ if (sym->ts.u.cl->backend_decl == NULL_TREE)
length = gfc_create_string_length (sym);
else
- length = sym->ts.cl->backend_decl;
+ length = sym->ts.u.cl->backend_decl;
if (TREE_CODE (length) == VAR_DECL
&& DECL_CONTEXT (length) == NULL_TREE)
{
@@ -1098,6 +1098,32 @@ gfc_get_symbol_decl (gfc_symbol * sym)
if (sym->backend_decl)
return sym->backend_decl;
+ /* If use associated and whole file compilation, use the module
+ declaration. This is only needed for intrinsic types because
+ they are substituted for one another during optimization. */
+ if (gfc_option.flag_whole_file
+ && sym->attr.flavor == FL_VARIABLE
+ && sym->ts.type != BT_DERIVED
+ && sym->attr.use_assoc
+ && sym->module)
+ {
+ gfc_gsymbol *gsym;
+
+ gsym = gfc_find_gsymbol (gfc_gsym_root, sym->module);
+ if (gsym && gsym->ns && gsym->type == GSYM_MODULE)
+ {
+ gfc_symbol *s;
+ s = NULL;
+ gfc_find_symbol (sym->name, gsym->ns, 0, &s);
+ if (s && s->backend_decl)
+ {
+ if (sym->ts.type == BT_CHARACTER)
+ sym->ts.u.cl->backend_decl = s->ts.u.cl->backend_decl;
+ return s->backend_decl;
+ }
+ }
+ }
+
/* Catch function declarations. Only used for actual parameters and
procedure pointers. */
if (sym->attr.flavor == FL_PROCEDURE)
@@ -1145,7 +1171,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
GFC_DECL_PACKED_ARRAY (decl) = 1;
}
- if (sym->ts.type == BT_DERIVED && sym->ts.derived->attr.alloc_comp)
+ if (sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.alloc_comp)
gfc_defer_symbol_init (sym);
/* This applies a derived type default initializer. */
else if (sym->ts.type == BT_DERIVED
@@ -1341,6 +1367,7 @@ gfc_get_extern_function_decl (gfc_symbol * sym)
gsym = gfc_find_gsymbol (gfc_gsym_root, sym->name);
if (gfc_option.flag_whole_file
+ && !sym->attr.use_assoc
&& !sym->backend_decl
&& gsym && gsym->ns
&& ((gsym->type == GSYM_SUBROUTINE) || (gsym->type == GSYM_FUNCTION))
@@ -1371,6 +1398,26 @@ gfc_get_extern_function_decl (gfc_symbol * sym)
return sym->backend_decl;
}
+ /* See if this is a module procedure from the same file. If so,
+ return the backend_decl. */
+ if (sym->module)
+ gsym = gfc_find_gsymbol (gfc_gsym_root, sym->module);
+
+ if (gfc_option.flag_whole_file
+ && gsym && gsym->ns
+ && gsym->type == GSYM_MODULE)
+ {
+ gfc_symbol *s;
+
+ s = NULL;
+ gfc_find_symbol (sym->name, gsym->ns, 0, &s);
+ if (s && s->backend_decl)
+ {
+ sym->backend_decl = s->backend_decl;
+ return sym->backend_decl;
+ }
+ }
+
if (sym->attr.intrinsic)
{
/* Call the resolution function to get the actual name. This is
@@ -1649,9 +1696,9 @@ create_function_arglist (gfc_symbol * sym)
PARM_DECL,
get_identifier (".__result"),
len_type);
- if (!sym->ts.cl->length)
+ if (!sym->ts.u.cl->length)
{
- sym->ts.cl->backend_decl = length;
+ sym->ts.u.cl->backend_decl = length;
TREE_USED (length) = 1;
}
gcc_assert (TREE_CODE (length) == PARM_DECL);
@@ -1660,13 +1707,13 @@ create_function_arglist (gfc_symbol * sym)
TREE_READONLY (length) = 1;
DECL_ARTIFICIAL (length) = 1;
gfc_finish_decl (length);
- if (sym->ts.cl->backend_decl == NULL
- || sym->ts.cl->backend_decl == length)
+ if (sym->ts.u.cl->backend_decl == NULL
+ || sym->ts.u.cl->backend_decl == length)
{
gfc_symbol *arg;
tree backend_decl;
- if (sym->ts.cl->backend_decl == NULL)
+ if (sym->ts.u.cl->backend_decl == NULL)
{
tree len = build_decl (input_location,
VAR_DECL,
@@ -1674,7 +1721,7 @@ create_function_arglist (gfc_symbol * sym)
gfc_charlen_type_node);
DECL_ARTIFICIAL (len) = 1;
TREE_USED (len) = 1;
- sym->ts.cl->backend_decl = len;
+ sym->ts.u.cl->backend_decl = len;
}
/* Make sure PARM_DECL type doesn't point to incomplete type. */
@@ -1744,38 +1791,29 @@ create_function_arglist (gfc_symbol * sym)
gfc_finish_decl (length);
/* Remember the passed value. */
- if (f->sym->ts.cl->passed_length != NULL)
+ if (f->sym->ts.u.cl->passed_length != NULL)
{
/* This can happen if the same type is used for multiple
arguments. We need to copy cl as otherwise
cl->passed_length gets overwritten. */
- gfc_charlen *cl, *cl2;
- cl = f->sym->ts.cl;
- f->sym->ts.cl = gfc_get_charlen();
- f->sym->ts.cl->length = cl->length;
- f->sym->ts.cl->backend_decl = cl->backend_decl;
- f->sym->ts.cl->length_from_typespec = cl->length_from_typespec;
- f->sym->ts.cl->resolved = cl->resolved;
- cl2 = f->sym->ts.cl->next;
- f->sym->ts.cl->next = cl;
- cl->next = cl2;
+ f->sym->ts.u.cl = gfc_new_charlen (f->sym->ns, f->sym->ts.u.cl);
}
- f->sym->ts.cl->passed_length = length;
+ f->sym->ts.u.cl->passed_length = length;
/* Use the passed value for assumed length variables. */
- if (!f->sym->ts.cl->length)
+ if (!f->sym->ts.u.cl->length)
{
TREE_USED (length) = 1;
- gcc_assert (!f->sym->ts.cl->backend_decl);
- f->sym->ts.cl->backend_decl = length;
+ gcc_assert (!f->sym->ts.u.cl->backend_decl);
+ f->sym->ts.u.cl->backend_decl = length;
}
hidden_typelist = TREE_CHAIN (hidden_typelist);
- if (f->sym->ts.cl->backend_decl == NULL
- || f->sym->ts.cl->backend_decl == length)
+ if (f->sym->ts.u.cl->backend_decl == NULL
+ || f->sym->ts.u.cl->backend_decl == length)
{
- if (f->sym->ts.cl->backend_decl == NULL)
+ if (f->sym->ts.u.cl->backend_decl == NULL)
gfc_create_string_length (f->sym);
/* Make sure PARM_DECL type doesn't point to incomplete type. */
@@ -1946,7 +1984,7 @@ build_entry_thunks (gfc_namespace * ns)
args);
if (formal->sym->ts.type == BT_CHARACTER)
{
- tmp = thunk_formal->sym->ts.cl->backend_decl;
+ tmp = thunk_formal->sym->ts.u.cl->backend_decl;
string_args = tree_cons (NULL_TREE, tmp, string_args);
}
}
@@ -2043,15 +2081,15 @@ build_entry_thunks (gfc_namespace * ns)
{
formal->sym->backend_decl = NULL_TREE;
if (formal->sym->ts.type == BT_CHARACTER)
- formal->sym->ts.cl->backend_decl = NULL_TREE;
+ formal->sym->ts.u.cl->backend_decl = NULL_TREE;
}
if (thunk_sym->attr.function)
{
if (thunk_sym->ts.type == BT_CHARACTER)
- thunk_sym->ts.cl->backend_decl = NULL_TREE;
+ thunk_sym->ts.u.cl->backend_decl = NULL_TREE;
if (thunk_sym->result->ts.type == BT_CHARACTER)
- thunk_sym->result->ts.cl->backend_decl = NULL_TREE;
+ thunk_sym->result->ts.u.cl->backend_decl = NULL_TREE;
}
}
@@ -2160,10 +2198,10 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int parent_flag)
if (sym->ts.type == BT_CHARACTER)
{
- if (sym->ts.cl->backend_decl == NULL_TREE)
+ if (sym->ts.u.cl->backend_decl == NULL_TREE)
length = gfc_create_string_length (sym);
else
- length = sym->ts.cl->backend_decl;
+ length = sym->ts.u.cl->backend_decl;
if (TREE_CODE (length) == VAR_DECL
&& DECL_CONTEXT (length) == NULL_TREE)
gfc_add_decl_to_function (length);
@@ -2769,12 +2807,12 @@ gfc_trans_auto_character_variable (gfc_symbol * sym, tree fnbody)
tree tmp;
gcc_assert (sym->backend_decl);
- gcc_assert (sym->ts.cl && sym->ts.cl->length);
+ gcc_assert (sym->ts.u.cl && sym->ts.u.cl->length);
gfc_start_block (&body);
/* Evaluate the string length expression. */
- gfc_conv_string_length (sym->ts.cl, NULL, &body);
+ gfc_conv_string_length (sym->ts.u.cl, NULL, &body);
gfc_trans_vla_type_sizes (sym, &body);
@@ -2962,9 +3000,9 @@ init_intent_out_dt (gfc_symbol * proc_sym, tree body)
&& !f->sym->attr.pointer
&& f->sym->ts.type == BT_DERIVED)
{
- if (f->sym->ts.derived->attr.alloc_comp)
+ if (f->sym->ts.u.derived->attr.alloc_comp)
{
- tmp = gfc_deallocate_alloc_comp (f->sym->ts.derived,
+ tmp = gfc_deallocate_alloc_comp (f->sym->ts.u.derived,
f->sym->backend_decl,
f->sym->as ? f->sym->as->rank : 0);
@@ -2975,7 +3013,7 @@ init_intent_out_dt (gfc_symbol * proc_sym, tree body)
gfc_add_expr_to_block (&fnblock, tmp);
}
- if (!f->sym->ts.derived->attr.alloc_comp
+ if (!f->sym->ts.u.derived->attr.alloc_comp
&& f->sym->value)
body = gfc_init_default_dt (f->sym, body);
}
@@ -3026,14 +3064,14 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
/* An automatic character length, pointer array result. */
if (proc_sym->ts.type == BT_CHARACTER
- && TREE_CODE (proc_sym->ts.cl->backend_decl) == VAR_DECL)
- fnbody = gfc_trans_dummy_character (proc_sym, proc_sym->ts.cl,
+ && TREE_CODE (proc_sym->ts.u.cl->backend_decl) == VAR_DECL)
+ fnbody = gfc_trans_dummy_character (proc_sym, proc_sym->ts.u.cl,
fnbody);
}
else if (proc_sym->ts.type == BT_CHARACTER)
{
- if (TREE_CODE (proc_sym->ts.cl->backend_decl) == VAR_DECL)
- fnbody = gfc_trans_dummy_character (proc_sym, proc_sym->ts.cl,
+ if (TREE_CODE (proc_sym->ts.u.cl->backend_decl) == VAR_DECL)
+ fnbody = gfc_trans_dummy_character (proc_sym, proc_sym->ts.u.cl,
fnbody);
}
else
@@ -3049,7 +3087,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
for (sym = proc_sym->tlink; sym != proc_sym; sym = sym->tlink)
{
bool sym_has_alloc_comp = (sym->ts.type == BT_DERIVED)
- && sym->ts.derived->attr.alloc_comp;
+ && sym->ts.u.derived->attr.alloc_comp;
if (sym->attr.dimension)
{
switch (sym->as->type)
@@ -3123,7 +3161,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
gfc_get_backend_locus (&loc);
gfc_set_backend_locus (&sym->declared_at);
if (sym->attr.dummy || sym->attr.result)
- fnbody = gfc_trans_dummy_character (sym, sym->ts.cl, fnbody);
+ fnbody = gfc_trans_dummy_character (sym, sym->ts.u.cl, fnbody);
else
fnbody = gfc_trans_auto_character_variable (sym, fnbody);
gfc_set_backend_locus (&loc);
@@ -3150,8 +3188,8 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
{
if (f->sym && f->sym->tlink == NULL && f->sym->ts.type == BT_CHARACTER)
{
- gcc_assert (f->sym->ts.cl->backend_decl != NULL);
- if (TREE_CODE (f->sym->ts.cl->backend_decl) == PARM_DECL)
+ gcc_assert (f->sym->ts.u.cl->backend_decl != NULL);
+ if (TREE_CODE (f->sym->ts.u.cl->backend_decl) == PARM_DECL)
gfc_trans_vla_type_sizes (f->sym, &body);
}
}
@@ -3159,8 +3197,8 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tree fnbody)
if (gfc_return_by_reference (proc_sym) && proc_sym->ts.type == BT_CHARACTER
&& current_fake_result_decl != NULL)
{
- gcc_assert (proc_sym->ts.cl->backend_decl != NULL);
- if (TREE_CODE (proc_sym->ts.cl->backend_decl) == PARM_DECL)
+ gcc_assert (proc_sym->ts.u.cl->backend_decl != NULL);
+ if (TREE_CODE (proc_sym->ts.u.cl->backend_decl) == PARM_DECL)
gfc_trans_vla_type_sizes (proc_sym, &body);
}
@@ -3334,7 +3372,7 @@ gfc_create_module_variable (gfc_symbol * sym)
{
tree length;
- length = sym->ts.cl->backend_decl;
+ length = sym->ts.u.cl->backend_decl;
if (!INTEGER_CST_P (length))
{
pushdecl (length);
@@ -3388,7 +3426,13 @@ gfc_trans_use_stmts (gfc_namespace * ns)
st = gfc_find_symtree (ns->sym_root,
rent->local_name[0]
? rent->local_name : rent->use_name);
- gcc_assert (st && st->n.sym->attr.use_assoc);
+ gcc_assert (st);
+
+ /* Sometimes, generic interfaces wind up being over-ruled by a
+ local symbol (see PR41062). */
+ if (!st->n.sym->attr.use_assoc)
+ continue;
+
if (st->n.sym->backend_decl
&& DECL_P (st->n.sym->backend_decl)
&& st->n.sym->module
@@ -3464,7 +3508,7 @@ check_constant_initializer (gfc_expr *expr, gfc_typespec *ts, bool array,
case BT_DERIVED:
if (expr->expr_type != EXPR_STRUCTURE)
return false;
- cm = expr->ts.derived->components;
+ cm = expr->ts.u.derived->components;
for (c = expr->value.constructor; c; c = c->next, cm = cm->next)
{
if (!c->expr || cm->attr.allocatable)
@@ -3510,12 +3554,12 @@ gfc_emit_parameter_debug_info (gfc_symbol *sym)
if (sym->ts.type == BT_CHARACTER)
{
- gfc_conv_const_charlen (sym->ts.cl);
- if (sym->ts.cl->backend_decl == NULL
- || TREE_CODE (sym->ts.cl->backend_decl) != INTEGER_CST)
+ gfc_conv_const_charlen (sym->ts.u.cl);
+ if (sym->ts.u.cl->backend_decl == NULL
+ || TREE_CODE (sym->ts.u.cl->backend_decl) != INTEGER_CST)
return;
}
- else if (sym->ts.type == BT_DERIVED && sym->ts.derived->attr.alloc_comp)
+ else if (sym->ts.type == BT_DERIVED && sym->ts.u.derived->attr.alloc_comp)
return;
if (sym->as)
@@ -3643,10 +3687,10 @@ generate_dependency_declarations (gfc_symbol *sym)
int i;
if (sym->ts.type == BT_CHARACTER
- && sym->ts.cl
- && sym->ts.cl->length
- && sym->ts.cl->length->expr_type != EXPR_CONSTANT)
- generate_expr_decls (sym, sym->ts.cl->length);
+ && sym->ts.u.cl
+ && sym->ts.u.cl->length
+ && sym->ts.u.cl->length->expr_type != EXPR_CONSTANT)
+ generate_expr_decls (sym, sym->ts.u.cl->length);
if (sym->as && sym->as->rank)
{
@@ -3697,8 +3741,8 @@ generate_local_decl (gfc_symbol * sym)
warning if requested. */
if (sym->attr.dummy && !sym->attr.referenced
&& sym->ts.type == BT_CHARACTER
- && sym->ts.cl->backend_decl != NULL
- && TREE_CODE (sym->ts.cl->backend_decl) == VAR_DECL)
+ && sym->ts.u.cl->backend_decl != NULL
+ && TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL)
{
sym->attr.referenced = 1;
gfc_get_symbol_decl (sym);
@@ -3709,7 +3753,7 @@ generate_local_decl (gfc_symbol * sym)
generate the code for nullification and automatic lengths. */
if (!sym->attr.referenced
&& sym->ts.type == BT_DERIVED
- && sym->ts.derived->attr.alloc_comp
+ && sym->ts.u.derived->attr.alloc_comp
&& !sym->attr.pointer
&& ((sym->attr.dummy && sym->attr.intent == INTENT_OUT)
||
@@ -3840,7 +3884,7 @@ add_argument_checking (stmtblock_t *block, gfc_symbol *sym)
const char *message;
fsym = formal->sym;
- cl = fsym->ts.cl;
+ cl = fsym->ts.u.cl;
gcc_assert (cl);
gcc_assert (cl->passed_length != NULL_TREE);
@@ -4177,10 +4221,10 @@ gfc_generate_function_code (gfc_namespace * ns)
gfc_entry_list *el;
tree backend_decl;
- gfc_conv_const_charlen (ns->proc_name->ts.cl);
- backend_decl = ns->proc_name->result->ts.cl->backend_decl;
+ gfc_conv_const_charlen (ns->proc_name->ts.u.cl);
+ backend_decl = ns->proc_name->result->ts.u.cl->backend_decl;
for (el = ns->entries; el; el = el->next)
- el->sym->result->ts.cl->backend_decl = backend_decl;
+ el->sym->result->ts.u.cl->backend_decl = backend_decl;
}
/* Translate COMMON blocks. */
@@ -4281,11 +4325,11 @@ gfc_generate_function_code (gfc_namespace * ns)
if (result != NULL_TREE && sym->attr.function
&& sym->ts.type == BT_DERIVED
- && sym->ts.derived->attr.alloc_comp
+ && sym->ts.u.derived->attr.alloc_comp
&& !sym->attr.pointer)
{
rank = sym->as ? sym->as->rank : 0;
- tmp2 = gfc_nullify_alloc_comp (sym->ts.derived, result, rank);
+ tmp2 = gfc_nullify_alloc_comp (sym->ts.u.derived, result, rank);
gfc_add_expr_to_block (&block, tmp2);
}
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 9bec2e10513..144c20441e9 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -201,12 +201,12 @@ gfc_get_expr_charlen (gfc_expr *e)
length = NULL; /* To silence compiler warning. */
- if (is_subref_array (e) && e->ts.cl->length)
+ if (is_subref_array (e) && e->ts.u.cl->length)
{
gfc_se tmpse;
gfc_init_se (&tmpse, NULL);
- gfc_conv_expr_type (&tmpse, e->ts.cl->length, gfc_charlen_type_node);
- e->ts.cl->backend_decl = tmpse.expr;
+ gfc_conv_expr_type (&tmpse, e->ts.u.cl->length, gfc_charlen_type_node);
+ e->ts.u.cl->backend_decl = tmpse.expr;
return tmpse.expr;
}
@@ -214,7 +214,7 @@ gfc_get_expr_charlen (gfc_expr *e)
expression's length could be the length of the character
variable. */
if (e->symtree->n.sym->ts.type == BT_CHARACTER)
- length = e->symtree->n.sym->ts.cl->backend_decl;
+ length = e->symtree->n.sym->ts.u.cl->backend_decl;
/* Look through the reference chain for component references. */
for (r = e->ref; r; r = r->next)
@@ -223,7 +223,7 @@ gfc_get_expr_charlen (gfc_expr *e)
{
case REF_COMPONENT:
if (r->u.c.component->ts.type == BT_CHARACTER)
- length = r->u.c.component->ts.cl->backend_decl;
+ length = r->u.c.component->ts.u.cl->backend_decl;
break;
case REF_ARRAY:
@@ -243,7 +243,7 @@ gfc_get_expr_charlen (gfc_expr *e)
}
-/* For each character array constructor subexpression without a ts.cl->length,
+/* For each character array constructor subexpression without a ts.u.cl->length,
replace it by its first element (if there aren't any elements, the length
should already be set to zero). */
@@ -276,7 +276,7 @@ flatten_array_ctors_without_strlen (gfc_expr* e)
case EXPR_ARRAY:
/* We've found what we're looking for. */
- if (e->ts.type == BT_CHARACTER && !e->ts.cl->length)
+ if (e->ts.type == BT_CHARACTER && !e->ts.u.cl->length)
{
gfc_expr* new_expr;
gcc_assert (e->value.constructor);
@@ -472,7 +472,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref)
if (c->ts.type == BT_CHARACTER)
{
- tmp = c->ts.cl->backend_decl;
+ tmp = c->ts.u.cl->backend_decl;
/* Components must always be constant length. */
gcc_assert (tmp && INTEGER_CST_P (tmp));
se->string_length = tmp;
@@ -513,7 +513,7 @@ conv_parent_component_references (gfc_se * se, gfc_ref * ref)
/* Otherwise build the reference and call self. */
gfc_conv_component_ref (se, &parent);
- parent.u.c.sym = dt->components->ts.derived;
+ parent.u.c.sym = dt->components->ts.u.derived;
parent.u.c.component = c;
conv_parent_component_references (se, &parent);
}
@@ -662,10 +662,10 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
{
/* If the character length of an entry isn't set, get the length from
the master function instead. */
- if (sym->attr.entry && !sym->ts.cl->backend_decl)
- se->string_length = sym->ns->proc_name->ts.cl->backend_decl;
+ if (sym->attr.entry && !sym->ts.u.cl->backend_decl)
+ se->string_length = sym->ns->proc_name->ts.u.cl->backend_decl;
else
- se->string_length = sym->ts.cl->backend_decl;
+ se->string_length = sym->ts.u.cl->backend_decl;
gcc_assert (se->string_length);
}
@@ -1159,7 +1159,7 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr)
gfc_add_block_to_block (&se->pre, &lse.pre);
gfc_add_block_to_block (&se->pre, &rse.pre);
- type = gfc_get_character_type (expr->ts.kind, expr->ts.cl);
+ type = gfc_get_character_type (expr->ts.kind, expr->ts.u.cl);
len = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
if (len == NULL_TREE)
{
@@ -1723,16 +1723,16 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
if (sym->ts.type == BT_CHARACTER)
{
/* Create a copy of the dummy argument's length. */
- new_sym->ts.cl = gfc_get_interface_mapping_charlen (mapping, sym->ts.cl);
- sm->expr->ts.cl = new_sym->ts.cl;
+ new_sym->ts.u.cl = gfc_get_interface_mapping_charlen (mapping, sym->ts.u.cl);
+ sm->expr->ts.u.cl = new_sym->ts.u.cl;
/* If the length is specified as "*", record the length that
the caller is passing. We should use the callee's length
in all other cases. */
- if (!new_sym->ts.cl->length && se)
+ if (!new_sym->ts.u.cl->length && se)
{
se->string_length = gfc_evaluate_now (se->string_length, &se->pre);
- new_sym->ts.cl->backend_decl = se->string_length;
+ new_sym->ts.u.cl->backend_decl = se->string_length;
}
}
@@ -1764,7 +1764,7 @@ gfc_add_interface_mapping (gfc_interface_mapping * mapping,
se->expr);
/* For character(*), use the actual argument's descriptor. */
- else if (sym->ts.type == BT_CHARACTER && !new_sym->ts.cl->length)
+ else if (sym->ts.type == BT_CHARACTER && !new_sym->ts.u.cl->length)
value = build_fold_indirect_ref_loc (input_location,
se->expr);
@@ -1809,9 +1809,9 @@ gfc_finish_interface_mapping (gfc_interface_mapping * mapping,
for (sym = mapping->syms; sym; sym = sym->next)
if (sym->new_sym->n.sym->ts.type == BT_CHARACTER
- && !sym->new_sym->n.sym->ts.cl->backend_decl)
+ && !sym->new_sym->n.sym->ts.u.cl->backend_decl)
{
- expr = sym->new_sym->n.sym->ts.cl->length;
+ expr = sym->new_sym->n.sym->ts.u.cl->length;
gfc_apply_interface_mapping_to_expr (mapping, expr);
gfc_init_se (&se, NULL);
gfc_conv_expr (&se, expr);
@@ -1820,7 +1820,7 @@ gfc_finish_interface_mapping (gfc_interface_mapping * mapping,
gfc_add_block_to_block (pre, &se.pre);
gfc_add_block_to_block (post, &se.post);
- sym->new_sym->n.sym->ts.cl->backend_decl = se.expr;
+ sym->new_sym->n.sym->ts.u.cl->backend_decl = se.expr;
}
}
@@ -1907,12 +1907,12 @@ gfc_map_intrinsic_function (gfc_expr *expr, gfc_interface_mapping *mapping)
case GFC_ISYM_LEN:
/* TODO figure out why this condition is necessary. */
if (sym->attr.function
- && (arg1->ts.cl->length == NULL
- || (arg1->ts.cl->length->expr_type != EXPR_CONSTANT
- && arg1->ts.cl->length->expr_type != EXPR_VARIABLE)))
+ && (arg1->ts.u.cl->length == NULL
+ || (arg1->ts.u.cl->length->expr_type != EXPR_CONSTANT
+ && arg1->ts.u.cl->length->expr_type != EXPR_VARIABLE)))
return false;
- new_expr = gfc_copy_expr (arg1->ts.cl->length);
+ new_expr = gfc_copy_expr (arg1->ts.u.cl->length);
break;
case GFC_ISYM_SIZE:
@@ -2025,11 +2025,11 @@ gfc_map_fcn_formal_to_actual (gfc_expr *expr, gfc_expr *map_expr,
if (map_expr->symtree->n.sym->ts.type == BT_CHARACTER)
{
- expr->value.function.esym->ts.cl->length
- = gfc_copy_expr (map_expr->symtree->n.sym->ts.cl->length);
+ expr->value.function.esym->ts.u.cl->length
+ = gfc_copy_expr (map_expr->symtree->n.sym->ts.u.cl->length);
gfc_apply_interface_mapping_to_expr (mapping,
- expr->value.function.esym->ts.cl->length);
+ expr->value.function.esym->ts.u.cl->length);
}
}
@@ -2050,10 +2050,10 @@ gfc_apply_interface_mapping_to_expr (gfc_interface_mapping * mapping,
return;
/* Copying an expression does not copy its length, so do that here. */
- if (expr->ts.type == BT_CHARACTER && expr->ts.cl)
+ if (expr->ts.type == BT_CHARACTER && expr->ts.u.cl)
{
- expr->ts.cl = gfc_get_interface_mapping_charlen (mapping, expr->ts.cl);
- gfc_apply_interface_mapping_to_expr (mapping, expr->ts.cl->length);
+ expr->ts.u.cl = gfc_get_interface_mapping_charlen (mapping, expr->ts.u.cl);
+ gfc_apply_interface_mapping_to_expr (mapping, expr->ts.u.cl->length);
}
/* Apply the mapping to any references. */
@@ -2173,8 +2173,8 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
gfc_conv_ss_startstride (&loop);
/* Build an ss for the temporary. */
- if (expr->ts.type == BT_CHARACTER && !expr->ts.cl->backend_decl)
- gfc_conv_string_length (expr->ts.cl, expr, &parmse->pre);
+ if (expr->ts.type == BT_CHARACTER && !expr->ts.u.cl->backend_decl)
+ gfc_conv_string_length (expr->ts.u.cl, expr, &parmse->pre);
base_type = gfc_typenode_for_spec (&expr->ts);
if (GFC_ARRAY_TYPE_P (base_type)
@@ -2186,7 +2186,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
loop.temp_ss->data.temp.type = base_type;
if (expr->ts.type == BT_CHARACTER)
- loop.temp_ss->string_length = expr->ts.cl->backend_decl;
+ loop.temp_ss->string_length = expr->ts.u.cl->backend_decl;
else
loop.temp_ss->string_length = NULL;
@@ -2315,7 +2315,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
rse.expr = gfc_build_array_ref (tmp, tmp_index, NULL);
if (expr->ts.type == BT_CHARACTER)
- rse.string_length = expr->ts.cl->backend_decl;
+ rse.string_length = expr->ts.u.cl->backend_decl;
gfc_conv_expr (&lse, expr);
@@ -2343,7 +2343,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr,
/* Pass the string length to the argument expression. */
if (expr->ts.type == BT_CHARACTER)
- parmse->string_length = expr->ts.cl->backend_decl;
+ parmse->string_length = expr->ts.u.cl->backend_decl;
/* We want either the address for the data or the address of the descriptor,
depending on the mode of passing array arguments. */
@@ -2457,9 +2457,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
}
else if (sym->intmod_sym_id == ISOCBINDING_FUNLOC)
{
- arg->expr->ts.type = sym->ts.derived->ts.type;
- arg->expr->ts.f90_type = sym->ts.derived->ts.f90_type;
- arg->expr->ts.kind = sym->ts.derived->ts.kind;
+ arg->expr->ts.type = sym->ts.u.derived->ts.type;
+ arg->expr->ts.f90_type = sym->ts.u.derived->ts.f90_type;
+ arg->expr->ts.kind = sym->ts.u.derived->ts.kind;
gfc_conv_expr_reference (se, arg->expr);
return 0;
@@ -2572,8 +2572,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
gfc_init_block (&post);
gfc_init_interface_mapping (&mapping);
need_interface_mapping = ((sym->ts.type == BT_CHARACTER
- && sym->ts.cl->length
- && sym->ts.cl->length->expr_type
+ && sym->ts.u.cl->length
+ && sym->ts.u.cl->length->expr_type
!= EXPR_CONSTANT)
|| (comp && comp->attr.dimension)
|| (!comp && sym->attr.dimension));
@@ -2679,7 +2679,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
&& fsym->attr.flavor != FL_PROCEDURE)
|| (fsym->attr.proc_pointer
&& !(e->expr_type == EXPR_VARIABLE
- && e->symtree->n.sym->attr.dummy))))
+ && e->symtree->n.sym->attr.dummy))
+ || gfc_is_proc_ptr_comp (e, NULL)))
{
/* Scalar pointer dummy args require an extra level of
indirection. The null pointer already contains
@@ -2752,11 +2753,11 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
&& parmse.string_length == NULL_TREE
&& e->ts.type == BT_PROCEDURE
&& e->symtree->n.sym->ts.type == BT_CHARACTER
- && e->symtree->n.sym->ts.cl->length != NULL
- && e->symtree->n.sym->ts.cl->length->expr_type == EXPR_CONSTANT)
+ && e->symtree->n.sym->ts.u.cl->length != NULL
+ && e->symtree->n.sym->ts.u.cl->length->expr_type == EXPR_CONSTANT)
{
- gfc_conv_const_charlen (e->symtree->n.sym->ts.cl);
- parmse.string_length = e->symtree->n.sym->ts.cl->backend_decl;
+ gfc_conv_const_charlen (e->symtree->n.sym->ts.u.cl);
+ parmse.string_length = e->symtree->n.sym->ts.u.cl->backend_decl;
}
}
@@ -2770,7 +2771,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
deallocated for non-variable scalars. Non-variable arrays are
dealt with in trans-array.c(gfc_conv_array_parameter). */
if (e && e->ts.type == BT_DERIVED
- && e->ts.derived->attr.alloc_comp
+ && e->ts.u.derived->attr.alloc_comp
&& !(e->symtree && e->symtree->n.sym->attr.pointer)
&& (e->expr_type != EXPR_VARIABLE && !e->rank))
{
@@ -2797,11 +2798,11 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
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);
+ local_tmp = gfc_copy_alloc_comp (e->ts.u.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);
+ tmp = gfc_deallocate_alloc_comp (e->ts.u.derived, tmp, parm_rank);
gfc_add_expr_to_block (&se->post, tmp);
}
@@ -2911,7 +2912,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
se->string_length = build_int_cst (gfc_charlen_type_node, 1);
else if (ts.type == BT_CHARACTER)
{
- if (sym->ts.cl->length == NULL)
+ if (sym->ts.u.cl->length == NULL)
{
/* Assumed character length results are not allowed by 5.1.1.5 of the
standard and are trapped in resolve.c; except in the case of SPREAD
@@ -2926,7 +2927,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
formal = sym->ns->proc_name->formal;
for (; formal; formal = formal->next)
if (strcmp (formal->sym->name, sym->name) == 0)
- cl.backend_decl = formal->sym->ts.cl->backend_decl;
+ cl.backend_decl = formal->sym->ts.u.cl->backend_decl;
}
}
else
@@ -2936,9 +2937,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
/* Calculate the length of the returned string. */
gfc_init_se (&parmse, NULL);
if (need_interface_mapping)
- gfc_apply_interface_mapping (&mapping, &parmse, sym->ts.cl->length);
+ gfc_apply_interface_mapping (&mapping, &parmse, sym->ts.u.cl->length);
else
- gfc_conv_expr (&parmse, sym->ts.cl->length);
+ gfc_conv_expr (&parmse, sym->ts.u.cl->length);
gfc_add_block_to_block (&se->pre, &parmse.pre);
gfc_add_block_to_block (&se->post, &parmse.post);
@@ -2951,7 +2952,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
/* Set up a charlen structure for it. */
cl.next = NULL;
cl.length = NULL;
- ts.cl = &cl;
+ ts.u.cl = &cl;
len = cl.backend_decl;
}
@@ -3024,7 +3025,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else if (ts.type == BT_CHARACTER)
{
/* Pass the string length. */
- type = gfc_get_character_type (ts.kind, ts.cl);
+ type = gfc_get_character_type (ts.kind, ts.u.cl);
type = build_pointer_type (type);
/* Return an address to a char[0:len-1]* temporary for
@@ -3418,8 +3419,8 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr)
/* Copy string arguments. */
tree arglen;
- gcc_assert (fsym->ts.cl && fsym->ts.cl->length
- && fsym->ts.cl->length->expr_type == EXPR_CONSTANT);
+ gcc_assert (fsym->ts.u.cl && fsym->ts.u.cl->length
+ && fsym->ts.u.cl->length->expr_type == EXPR_CONSTANT);
arglen = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
tmp = gfc_build_addr_expr (build_pointer_type (type),
@@ -3456,22 +3457,22 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr)
if (sym->ts.type == BT_CHARACTER)
{
- gfc_conv_const_charlen (sym->ts.cl);
+ gfc_conv_const_charlen (sym->ts.u.cl);
/* Force the expression to the correct length. */
if (!INTEGER_CST_P (se->string_length)
|| tree_int_cst_lt (se->string_length,
- sym->ts.cl->backend_decl))
+ sym->ts.u.cl->backend_decl))
{
- type = gfc_get_character_type (sym->ts.kind, sym->ts.cl);
+ type = gfc_get_character_type (sym->ts.kind, sym->ts.u.cl);
tmp = gfc_create_var (type, sym->name);
tmp = gfc_build_addr_expr (build_pointer_type (type), tmp);
- gfc_trans_string_copy (&se->pre, sym->ts.cl->backend_decl, tmp,
+ gfc_trans_string_copy (&se->pre, sym->ts.u.cl->backend_decl, tmp,
sym->ts.kind, se->string_length, se->expr,
sym->ts.kind);
se->expr = tmp;
}
- se->string_length = sym->ts.cl->backend_decl;
+ se->string_length = sym->ts.u.cl->backend_decl;
}
/* Restore the original variables. */
@@ -3558,9 +3559,9 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec * ts, tree type,
used as initialization expressions). If so, we need to modify
the 'expr' to be that for a (void *). */
if (expr != NULL && expr->ts.type == BT_DERIVED
- && expr->ts.is_iso_c && expr->ts.derived)
+ && expr->ts.is_iso_c && expr->ts.u.derived)
{
- gfc_symbol *derived = expr->ts.derived;
+ gfc_symbol *derived = expr->ts.u.derived;
expr = gfc_int_expr (0);
@@ -3590,7 +3591,7 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec * ts, tree type,
return se.expr;
case BT_CHARACTER:
- return gfc_conv_string_init (ts->cl->backend_decl,expr);
+ return gfc_conv_string_init (ts->u.cl->backend_decl,expr);
default:
gfc_init_se (&se, NULL);
@@ -3678,7 +3679,7 @@ gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_conv_tmp_array_ref (&lse);
if (cm->ts.type == BT_CHARACTER)
- lse.string_length = cm->ts.cl->backend_decl;
+ lse.string_length = cm->ts.u.cl->backend_decl;
gfc_conv_expr (&rse, expr);
@@ -3765,8 +3766,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_add_block_to_block (&block, &se.pre);
gfc_add_modify (&block, dest, se.expr);
- if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp)
- tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest,
+ if (cm->ts.type == BT_DERIVED && cm->ts.u.derived->attr.alloc_comp)
+ tmp = gfc_copy_alloc_comp (cm->ts.u.derived, se.expr, dest,
cm->as->rank);
else
tmp = gfc_duplicate_allocatable (dest, se.expr,
@@ -3871,7 +3872,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_conv_expr (&se, expr);
if (cm->ts.type == BT_CHARACTER)
- lse.string_length = cm->ts.cl->backend_decl;
+ lse.string_length = cm->ts.u.cl->backend_decl;
lse.expr = dest;
tmp = gfc_trans_scalar_assign (&lse, &se, cm->ts, true, false);
gfc_add_expr_to_block (&block, tmp);
@@ -3891,7 +3892,7 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr)
tree tmp;
gfc_start_block (&block);
- cm = expr->ts.derived->components;
+ cm = expr->ts.u.derived->components;
for (c = expr->value.constructor; c; c = c->next, cm = cm->next)
{
/* Skip absent members in default initializers. */
@@ -3927,13 +3928,13 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init)
if (!init)
{
/* Create a temporary variable and fill it in. */
- se->expr = gfc_create_var (type, expr->ts.derived->name);
+ se->expr = gfc_create_var (type, expr->ts.u.derived->name);
tmp = gfc_trans_structure_assign (se->expr, expr);
gfc_add_expr_to_block (&se->pre, tmp);
return;
}
- cm = expr->ts.derived->components;
+ cm = expr->ts.u.derived->components;
for (c = expr->value.constructor; c; c = c->next, cm = cm->next)
{
@@ -4003,8 +4004,8 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr)
null_pointer_node. C_PTR and C_FUNPTR are converted to match the
typespec for the C_PTR and C_FUNPTR symbols, which has already been
updated to be an integer with a kind equal to the size of a (void *). */
- if (expr->ts.type == BT_DERIVED && expr->ts.derived
- && expr->ts.derived->attr.is_iso_c)
+ if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
+ && expr->ts.u.derived->attr.is_iso_c)
{
if (expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_PTR
|| expr->symtree->n.sym->intmod_sym_id == ISOCBINDING_NULL_FUNPTR)
@@ -4017,9 +4018,9 @@ gfc_conv_expr (gfc_se * se, gfc_expr * expr)
{
/* Update the type/kind of the expression to be what the new
type/kind are for the updated symbols of C_PTR/C_FUNPTR. */
- expr->ts.type = expr->ts.derived->ts.type;
- expr->ts.f90_type = expr->ts.derived->ts.f90_type;
- expr->ts.kind = expr->ts.derived->ts.kind;
+ expr->ts.type = expr->ts.u.derived->ts.type;
+ expr->ts.f90_type = expr->ts.u.derived->ts.f90_type;
+ expr->ts.kind = expr->ts.u.derived->ts.kind;
}
}
@@ -4388,7 +4389,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
gfc_trans_string_copy (&block, llen, lse->expr, ts.kind, rlen,
rse->expr, ts.kind);
}
- else if (ts.type == BT_DERIVED && ts.derived->attr.alloc_comp)
+ else if (ts.type == BT_DERIVED && ts.u.derived->attr.alloc_comp)
{
cond = NULL_TREE;
@@ -4408,7 +4409,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
if (!l_is_temp)
{
tmp = gfc_evaluate_now (lse->expr, &lse->pre);
- tmp = gfc_deallocate_alloc_comp (ts.derived, tmp, 0);
+ tmp = gfc_deallocate_alloc_comp (ts.u.derived, tmp, 0);
if (r_is_var)
tmp = build3_v (COND_EXPR, cond, build_empty_stmt (input_location),
tmp);
@@ -4425,19 +4426,27 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
same as the lhs. */
if (r_is_var)
{
- tmp = gfc_copy_alloc_comp (ts.derived, rse->expr, lse->expr, 0);
+ tmp = gfc_copy_alloc_comp (ts.u.derived, rse->expr, lse->expr, 0);
tmp = build3_v (COND_EXPR, cond, build_empty_stmt (input_location),
tmp);
gfc_add_expr_to_block (&block, tmp);
}
}
+ else if (ts.type == BT_DERIVED)
+ {
+ gfc_add_block_to_block (&block, &lse->pre);
+ gfc_add_block_to_block (&block, &rse->pre);
+ tmp = gfc_evaluate_now (rse->expr, &block);
+ tmp = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (lse->expr), rse->expr);
+ gfc_add_modify (&block, lse->expr, tmp);
+ }
else
{
gfc_add_block_to_block (&block, &lse->pre);
gfc_add_block_to_block (&block, &rse->pre);
gfc_add_modify (&block, lse->expr,
- fold_convert (TREE_TYPE (lse->expr), rse->expr));
+ fold_convert (TREE_TYPE (lse->expr), rse->expr));
}
gfc_add_block_to_block (&block, &lse->post);
@@ -4487,16 +4496,16 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
character lengths are the same. */
if (expr2->ts.type == BT_CHARACTER && expr2->rank > 0)
{
- if (expr1->ts.cl->length == NULL
- || expr1->ts.cl->length->expr_type != EXPR_CONSTANT)
+ if (expr1->ts.u.cl->length == NULL
+ || expr1->ts.u.cl->length->expr_type != EXPR_CONSTANT)
return NULL;
- if (expr2->ts.cl->length == NULL
- || expr2->ts.cl->length->expr_type != EXPR_CONSTANT)
+ if (expr2->ts.u.cl->length == NULL
+ || expr2->ts.u.cl->length->expr_type != EXPR_CONSTANT)
return NULL;
- if (mpz_cmp (expr1->ts.cl->length->value.integer,
- expr2->ts.cl->length->value.integer) != 0)
+ if (mpz_cmp (expr1->ts.u.cl->length->value.integer,
+ expr2->ts.u.cl->length->value.integer) != 0)
return NULL;
}
@@ -4870,13 +4879,13 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag)
to arrays must be done with a deep copy and the rhs temporary
must have its components deallocated afterwards. */
scalar_to_array = (expr2->ts.type == BT_DERIVED
- && expr2->ts.derived->attr.alloc_comp
+ && expr2->ts.u.derived->attr.alloc_comp
&& expr2->expr_type != EXPR_VARIABLE
&& !gfc_is_constant_expr (expr2)
&& expr1->rank && !expr2->rank);
if (scalar_to_array)
{
- tmp = gfc_deallocate_alloc_comp (expr2->ts.derived, rse.expr, 0);
+ tmp = gfc_deallocate_alloc_comp (expr2->ts.u.derived, rse.expr, 0);
gfc_add_expr_to_block (&loop.post, tmp);
}
@@ -4966,7 +4975,7 @@ copyable_array_p (gfc_expr * expr)
return false;
case BT_DERIVED:
- return !expr->ts.derived->attr.alloc_comp;
+ return !expr->ts.u.derived->attr.alloc_comp;
default:
break;
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 779343224fd..3b2cbd11428 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -3479,7 +3479,7 @@ gfc_conv_intrinsic_len (gfc_se * se, gfc_expr * expr)
&& (sym->result == sym))
decl = gfc_get_fake_result_decl (sym, 0);
- len = sym->ts.cl->backend_decl;
+ len = sym->ts.u.cl->backend_decl;
gcc_assert (len);
break;
}
@@ -4629,7 +4629,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
nonzero_charlen = NULL_TREE;
if (arg1->expr->ts.type == BT_CHARACTER)
nonzero_charlen = fold_build2 (NE_EXPR, boolean_type_node,
- arg1->expr->ts.cl->backend_decl,
+ arg1->expr->ts.u.cl->backend_decl,
integer_zero_node);
if (ss1 == gfc_ss_terminator)
@@ -4883,7 +4883,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr)
dlen = fold_build2 (MULT_EXPR, gfc_charlen_type_node,
fold_convert (gfc_charlen_type_node, slen),
fold_convert (gfc_charlen_type_node, ncopies));
- type = gfc_get_character_type (expr->ts.kind, expr->ts.cl);
+ type = gfc_get_character_type (expr->ts.kind, expr->ts.u.cl);
dest = gfc_conv_string_tmp (se, build_pointer_type (type), dlen);
/* Generate the code to do the repeat operation:
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 35f87bc3e56..0f6e0a5a40a 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -1591,7 +1591,7 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
dt_parm_addr = gfc_build_addr_expr (NULL_TREE, dt_parm);
if (ts->type == BT_CHARACTER)
- tmp = ts->cl->backend_decl;
+ tmp = ts->u.cl->backend_decl;
else
tmp = build_int_cst (gfc_charlen_type_node, 0);
tmp = build_call_expr_loc (input_location,
@@ -1624,7 +1624,7 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name,
tree expr = build_fold_indirect_ref_loc (input_location,
addr_expr);
- for (cmp = ts->derived->components; cmp; cmp = cmp->next)
+ for (cmp = ts->u.derived->components; cmp; cmp = cmp->next)
{
char *full_name = nml_full_name (var_name, cmp->name);
transfer_namelist_element (block,
@@ -2005,8 +2005,9 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
C_NULL_PTR or C_NULL_FUNPTR. We could also get a user variable of
type C_PTR or C_FUNPTR, in which case the ts->type may no longer be
BT_DERIVED (could have been changed by gfc_conv_expr). */
- if ((ts->type == BT_DERIVED && ts->is_iso_c == 1 && ts->derived != NULL)
- || (ts->derived != NULL && ts->derived->ts.is_iso_c == 1))
+ if ((ts->type == BT_DERIVED || ts->type == BT_INTEGER)
+ && ts->u.derived != NULL
+ && (ts->is_iso_c == 1 || ts->u.derived->ts.is_iso_c == 1))
{
/* C_PTR and C_FUNPTR have private components which means they can not
be printed. However, if -std=gnu and not -pedantic, allow
@@ -2014,14 +2015,14 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
if (gfc_notification_std (GFC_STD_GNU) != SILENT)
{
gfc_error_now ("Derived type '%s' at %L has PRIVATE components",
- ts->derived->name, code != NULL ? &(code->loc) :
+ ts->u.derived->name, code != NULL ? &(code->loc) :
&gfc_current_locus);
return;
}
- ts->type = ts->derived->ts.type;
- ts->kind = ts->derived->ts.kind;
- ts->f90_type = ts->derived->ts.f90_type;
+ ts->type = ts->u.derived->ts.type;
+ ts->kind = ts->u.derived->ts.kind;
+ ts->f90_type = ts->u.derived->ts.f90_type;
}
kind = ts->kind;
@@ -2093,7 +2094,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
expr = build_fold_indirect_ref_loc (input_location,
expr);
- for (c = ts->derived->components; c; c = c->next)
+ for (c = ts->u.derived->components; c; c = c->next)
{
field = c->backend_decl;
gcc_assert (field && TREE_CODE (field) == FIELD_DECL);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 6a1fb01cc60..935943727ab 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1830,7 +1830,7 @@ check_forall_dependencies (gfc_code *c, stmtblock_t *pre, stmtblock_t *post)
pointer components. We therefore leave these to their
own devices. */
if (lsym->ts.type == BT_DERIVED
- && lsym->ts.derived->attr.pointer_comp)
+ && lsym->ts.u.derived->attr.pointer_comp)
return need_temp;
new_symtree = NULL;
@@ -2539,17 +2539,17 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2,
&lss, &rss);
/* The type of LHS. Used in function allocate_temp_for_forall_nest */
- if (expr1->ts.type == BT_CHARACTER && expr1->ts.cl->length)
+ if (expr1->ts.type == BT_CHARACTER && expr1->ts.u.cl->length)
{
- if (!expr1->ts.cl->backend_decl)
+ if (!expr1->ts.u.cl->backend_decl)
{
gfc_se tse;
gfc_init_se (&tse, NULL);
- gfc_conv_expr (&tse, expr1->ts.cl->length);
- expr1->ts.cl->backend_decl = tse.expr;
+ gfc_conv_expr (&tse, expr1->ts.u.cl->length);
+ expr1->ts.u.cl->backend_decl = tse.expr;
}
type = gfc_get_character_type_len (gfc_default_character_kind,
- expr1->ts.cl->backend_decl);
+ expr1->ts.u.cl->backend_decl);
}
else
type = gfc_typenode_for_spec (&expr1->ts);
@@ -4024,10 +4024,10 @@ gfc_trans_allocate (gfc_code * code)
gfc_add_expr_to_block (&se.pre, tmp);
}
- if (expr->ts.type == BT_DERIVED && expr->ts.derived->attr.alloc_comp)
+ if (expr->ts.type == BT_DERIVED && expr->ts.u.derived->attr.alloc_comp)
{
tmp = build_fold_indirect_ref_loc (input_location, se.expr);
- tmp = gfc_nullify_alloc_comp (expr->ts.derived, tmp, 0);
+ tmp = gfc_nullify_alloc_comp (expr->ts.u.derived, tmp, 0);
gfc_add_expr_to_block (&se.pre, tmp);
}
@@ -4130,7 +4130,7 @@ gfc_trans_deallocate (gfc_code *code)
se.descriptor_only = 1;
gfc_conv_expr (&se, expr);
- if (expr->ts.type == BT_DERIVED && expr->ts.derived->attr.alloc_comp)
+ if (expr->ts.type == BT_DERIVED && expr->ts.u.derived->attr.alloc_comp)
{
gfc_ref *ref;
gfc_ref *last = NULL;
@@ -4143,7 +4143,7 @@ gfc_trans_deallocate (gfc_code *code)
if (!(last && last->u.c.component->attr.pointer)
&& !(!last && expr->symtree->n.sym->attr.pointer))
{
- tmp = gfc_deallocate_alloc_comp (expr->ts.derived, se.expr,
+ tmp = gfc_deallocate_alloc_comp (expr->ts.u.derived, se.expr,
expr->rank);
gfc_add_expr_to_block (&se.pre, tmp);
}
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 7b842360280..90e82d488d7 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1000,8 +1000,8 @@ gfc_typenode_for_spec (gfc_typespec * spec)
C_FUNPTR to simple variables that get translated to (void *). */
if (spec->f90_type == BT_VOID)
{
- if (spec->derived
- && spec->derived->intmod_sym_id == ISOCBINDING_PTR)
+ if (spec->u.derived
+ && spec->u.derived->intmod_sym_id == ISOCBINDING_PTR)
basetype = ptr_type_node;
else
basetype = pfunc_type_node;
@@ -1023,21 +1023,21 @@ gfc_typenode_for_spec (gfc_typespec * spec)
break;
case BT_CHARACTER:
- basetype = gfc_get_character_type (spec->kind, spec->cl);
+ basetype = gfc_get_character_type (spec->kind, spec->u.cl);
break;
case BT_DERIVED:
- basetype = gfc_get_derived_type (spec->derived);
+ basetype = gfc_get_derived_type (spec->u.derived);
/* If we're dealing with either C_PTR or C_FUNPTR, we modified the
type and kind to fit a (void *) and the basetype returned was a
ptr_type_node. We need to pass up this new information to the
symbol that was declared of type C_PTR or C_FUNPTR. */
- if (spec->derived->attr.is_iso_c)
+ if (spec->u.derived->attr.is_iso_c)
{
- spec->type = spec->derived->ts.type;
- spec->kind = spec->derived->ts.kind;
- spec->f90_type = spec->derived->ts.f90_type;
+ spec->type = spec->u.derived->ts.type;
+ spec->kind = spec->u.derived->ts.kind;
+ spec->f90_type = spec->u.derived->ts.f90_type;
}
break;
case BT_VOID:
@@ -1046,8 +1046,8 @@ gfc_typenode_for_spec (gfc_typespec * spec)
basetype = ptr_type_node;
if (spec->f90_type == BT_VOID)
{
- if (spec->derived
- && spec->derived->intmod_sym_id == ISOCBINDING_PTR)
+ if (spec->u.derived
+ && spec->u.derived->intmod_sym_id == ISOCBINDING_PTR)
basetype = ptr_type_node;
else
basetype = pfunc_type_node;
@@ -1765,7 +1765,7 @@ gfc_sym_type (gfc_symbol * sym)
base type. */
if (sym->ts.type != BT_CHARACTER
|| !(sym->attr.dummy || sym->attr.function)
- || sym->ts.cl->backend_decl)
+ || sym->ts.u.cl->backend_decl)
{
type = gfc_get_nodesc_array_type (type, sym->as,
byref ? PACKED_FULL
@@ -1853,7 +1853,8 @@ gfc_add_field_to_struct (tree *fieldlist, tree context,
in 4.4.2 and resolved by gfc_compare_derived_types. */
static int
-copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to)
+copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to,
+ bool from_gsym)
{
gfc_component *to_cm;
gfc_component *from_cm;
@@ -1876,11 +1877,12 @@ copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to)
for (; to_cm; to_cm = to_cm->next, from_cm = from_cm->next)
{
to_cm->backend_decl = from_cm->backend_decl;
- if (!from_cm->attr.pointer && from_cm->ts.type == BT_DERIVED)
- gfc_get_derived_type (to_cm->ts.derived);
+ if ((!from_cm->attr.pointer || from_gsym)
+ && from_cm->ts.type == BT_DERIVED)
+ gfc_get_derived_type (to_cm->ts.u.derived);
else if (from_cm->ts.type == BT_CHARACTER)
- to_cm->ts.cl->backend_decl = from_cm->ts.cl->backend_decl;
+ to_cm->ts.u.cl->backend_decl = from_cm->ts.u.cl->backend_decl;
}
return 1;
@@ -1893,16 +1895,17 @@ tree
gfc_get_ppc_type (gfc_component* c)
{
tree t;
- if (c->attr.function && !c->attr.dimension)
- {
- if (c->ts.type == BT_DERIVED)
- t = c->ts.derived->backend_decl;
- else
- t = gfc_typenode_for_spec (&c->ts);
- }
+
+ /* Explicit interface. */
+ if (c->attr.if_source != IFSRC_UNKNOWN && c->ts.interface)
+ return build_pointer_type (gfc_get_function_type (c->ts.interface));
+
+ /* Implicit interface (only return value may be known). */
+ if (c->attr.function && !c->attr.dimension && c->ts.type != BT_CHARACTER)
+ t = gfc_typenode_for_spec (&c->ts);
else
t = void_type_node;
- /* TODO: Build argument list. */
+
return build_pointer_type (build_function_type (t, NULL_TREE));
}
@@ -1916,8 +1919,12 @@ static tree
gfc_get_derived_type (gfc_symbol * derived)
{
tree typenode = NULL, field = NULL, field_type = NULL, fieldlist = NULL;
+ tree canonical = NULL_TREE;
+ bool got_canonical = false;
gfc_component *c;
gfc_dt_list *dt;
+ gfc_namespace *ns;
+ gfc_gsymbol *gsym;
gcc_assert (derived && derived->attr.flavor == FL_DERIVED);
@@ -1949,13 +1956,68 @@ gfc_get_derived_type (gfc_symbol * derived)
return derived->backend_decl;
}
-
+
+/* If use associated, use the module type for this one. */
+ if (gfc_option.flag_whole_file
+ && derived->backend_decl == NULL
+ && derived->attr.use_assoc
+ && derived->module)
+ {
+ gsym = gfc_find_gsymbol (gfc_gsym_root, derived->module);
+ if (gsym && gsym->ns && gsym->type == GSYM_MODULE)
+ {
+ gfc_symbol *s;
+ s = NULL;
+ gfc_find_symbol (derived->name, gsym->ns, 0, &s);
+ if (s && s->backend_decl)
+ {
+ copy_dt_decls_ifequal (s, derived, true);
+ goto copy_derived_types;
+ }
+ }
+ }
+
+ /* If a whole file compilation, the derived types from an earlier
+ namespace can be used as the the canonical type. */
+ if (gfc_option.flag_whole_file
+ && derived->backend_decl == NULL
+ && !derived->attr.use_assoc
+ && gfc_global_ns_list)
+ {
+ for (ns = gfc_global_ns_list;
+ ns->translated && !got_canonical;
+ ns = ns->sibling)
+ {
+ dt = ns->derived_types;
+ for (; dt && !canonical; dt = dt->next)
+ {
+ copy_dt_decls_ifequal (dt->derived, derived, true);
+ if (derived->backend_decl)
+ got_canonical = true;
+ }
+ }
+ }
+
+ /* Store up the canonical type to be added to this one. */
+ if (got_canonical)
+ {
+ if (TYPE_CANONICAL (derived->backend_decl))
+ canonical = TYPE_CANONICAL (derived->backend_decl);
+ else
+ canonical = derived->backend_decl;
+
+ derived->backend_decl = NULL_TREE;
+ }
+
/* derived->backend_decl != 0 means we saw it before, but its
components' backend_decl may have not been built. */
if (derived->backend_decl)
{
- /* Its components' backend_decl have been built. */
- if (TYPE_FIELDS (derived->backend_decl))
+ /* Its components' backend_decl have been built or we are
+ seeing recursion through the formal arglist of a procedure
+ pointer component. */
+ if (TYPE_FIELDS (derived->backend_decl)
+ || derived->attr.proc_pointer_comp)
return derived->backend_decl;
else
typenode = derived->backend_decl;
@@ -1980,17 +2042,17 @@ gfc_get_derived_type (gfc_symbol * derived)
continue;
if ((!c->attr.pointer && !c->attr.proc_pointer)
- || c->ts.derived->backend_decl == NULL)
- c->ts.derived->backend_decl = gfc_get_derived_type (c->ts.derived);
+ || c->ts.u.derived->backend_decl == NULL)
+ c->ts.u.derived->backend_decl = gfc_get_derived_type (c->ts.u.derived);
- if (c->ts.derived && c->ts.derived->attr.is_iso_c)
+ if (c->ts.u.derived && c->ts.u.derived->attr.is_iso_c)
{
/* Need to copy the modified ts from the derived type. The
typespec was modified because C_PTR/C_FUNPTR are translated
into (void *) from derived types. */
- c->ts.type = c->ts.derived->ts.type;
- c->ts.kind = c->ts.derived->ts.kind;
- c->ts.f90_type = c->ts.derived->ts.f90_type;
+ c->ts.type = c->ts.u.derived->ts.type;
+ c->ts.kind = c->ts.u.derived->ts.kind;
+ c->ts.f90_type = c->ts.u.derived->ts.f90_type;
if (c->initializer)
{
c->initializer->ts.type = c->ts.type;
@@ -2012,14 +2074,14 @@ gfc_get_derived_type (gfc_symbol * derived)
if (c->attr.proc_pointer)
field_type = gfc_get_ppc_type (c);
else if (c->ts.type == BT_DERIVED)
- field_type = c->ts.derived->backend_decl;
+ field_type = c->ts.u.derived->backend_decl;
else
{
if (c->ts.type == BT_CHARACTER)
{
/* Evaluate the string length. */
- gfc_conv_const_charlen (c->ts.cl);
- gcc_assert (c->ts.cl->backend_decl);
+ gfc_conv_const_charlen (c->ts.u.cl);
+ gcc_assert (c->ts.u.cl->backend_decl);
}
field_type = gfc_typenode_for_spec (&c->ts);
@@ -2065,6 +2127,8 @@ gfc_get_derived_type (gfc_symbol * derived)
/* Now we have the final fieldlist. Record it, then lay out the
derived type, including the fields. */
TYPE_FIELDS (typenode) = fieldlist;
+ if (canonical)
+ TYPE_CANONICAL (typenode) = canonical;
gfc_finish_type (typenode);
gfc_set_decl_location (TYPE_STUB_DECL (typenode), &derived->declared_at);
@@ -2083,9 +2147,10 @@ gfc_get_derived_type (gfc_symbol * derived)
derived->backend_decl = typenode;
- /* Add this backend_decl to all the other, equal derived types. */
+copy_derived_types:
+
for (dt = gfc_derived_types; dt; dt = dt->next)
- copy_dt_decls_ifequal (derived, dt->derived);
+ copy_dt_decls_ifequal (derived, dt->derived, false);
return derived->backend_decl;
}
@@ -2200,7 +2265,7 @@ gfc_get_function_type (gfc_symbol * sym)
arg = sym;
if (arg->ts.type == BT_CHARACTER)
- gfc_conv_const_charlen (arg->ts.cl);
+ gfc_conv_const_charlen (arg->ts.u.cl);
/* Some functions we use an extra parameter for the return value. */
if (gfc_return_by_reference (sym))
@@ -2225,7 +2290,7 @@ gfc_get_function_type (gfc_symbol * sym)
/* Evaluate constant character lengths here so that they can be
included in the type. */
if (arg->ts.type == BT_CHARACTER)
- gfc_conv_const_charlen (arg->ts.cl);
+ gfc_conv_const_charlen (arg->ts.u.cl);
if (arg->attr.flavor == FL_PROCEDURE)
{
diff --git a/gcc/function.c b/gcc/function.c
index 138045c7d6a..32572544298 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -922,7 +922,7 @@ assign_temp (tree type_or_decl, int keep, int memory_required,
#ifdef PROMOTE_MODE
if (! dont_promote)
- mode = promote_mode (type, mode, &unsignedp, 0);
+ mode = promote_mode (type, mode, &unsignedp);
#endif
return gen_reg_rtx (mode);
@@ -2170,6 +2170,7 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm,
{
tree nominal_type, passed_type;
enum machine_mode nominal_mode, passed_mode, promoted_mode;
+ int unsignedp;
memset (data, 0, sizeof (*data));
@@ -2222,13 +2223,9 @@ assign_parm_find_data_types (struct assign_parm_data_all *all, tree parm,
}
/* Find mode as it is passed by the ABI. */
- promoted_mode = passed_mode;
- if (targetm.calls.promote_function_args (TREE_TYPE (current_function_decl)))
- {
- int unsignedp = TYPE_UNSIGNED (passed_type);
- promoted_mode = promote_mode (passed_type, promoted_mode,
- &unsignedp, 1);
- }
+ unsignedp = TYPE_UNSIGNED (passed_type);
+ promoted_mode = promote_function_mode (passed_type, passed_mode, &unsignedp,
+ TREE_TYPE (current_function_decl), 0);
egress:
data->nominal_type = nominal_type;
@@ -2776,12 +2773,11 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
bool did_conversion = false;
/* Store the parm in a pseudoregister during the function, but we may
- need to do it in a wider mode. */
-
- /* This is not really promoting for a call. However we need to be
- consistent with assign_parm_find_data_types and expand_expr_real_1. */
+ need to do it in a wider mode. Using 2 here makes the result
+ consistent with promote_decl_mode and thus expand_expr_real_1. */
promoted_nominal_mode
- = promote_mode (data->nominal_type, data->nominal_mode, &unsignedp, 1);
+ = promote_function_mode (data->nominal_type, data->nominal_mode, &unsignedp,
+ TREE_TYPE (current_function_decl), 2);
parmreg = gen_reg_rtx (promoted_nominal_mode);
@@ -2801,7 +2797,8 @@ assign_parm_setup_reg (struct assign_parm_data_all *all, tree parm,
assign_parm_remove_parallels (data);
- /* Copy the value into the register. */
+ /* Copy the value into the register, thus bridging between
+ assign_parm_find_data_types and expand_expr_real_1. */
if (data->nominal_mode != data->passed_mode
|| promoted_nominal_mode != data->promoted_mode)
{
@@ -4725,10 +4722,9 @@ expand_function_end (void)
else if (GET_MODE (real_decl_rtl) != GET_MODE (decl_rtl))
{
int unsignedp = TYPE_UNSIGNED (TREE_TYPE (decl_result));
-
- if (targetm.calls.promote_function_return (TREE_TYPE (current_function_decl)))
- promote_mode (TREE_TYPE (decl_result), GET_MODE (decl_rtl),
- &unsignedp, 1);
+ promote_function_mode (TREE_TYPE (decl_result),
+ GET_MODE (decl_rtl), &unsignedp,
+ TREE_TYPE (current_function_decl), 1);
convert_move (real_decl_rtl, decl_rtl, unsignedp);
}
diff --git a/gcc/function.h b/gcc/function.h
index 0ddab1104c5..446bc9d82e1 100644
--- a/gcc/function.h
+++ b/gcc/function.h
@@ -160,7 +160,7 @@ struct GTY(()) rtl_eh {
varray_type ehspec_data;
varray_type action_record_data;
- VEC(call_site_record,gc) *call_site_record;
+ VEC(call_site_record,gc) *call_site_record[2];
};
#define pending_stack_adjust (crtl->expr.x_pending_stack_adjust)
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 8d7ead680ce..eba86727a05 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -221,17 +221,14 @@ struct gimple_opt_pass pass_lower_cf =
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
- mark the call expression so it doesn't get inlined later. */
+ return false. */
-static void
-check_call_args (gimple stmt)
+bool
+gimple_check_call_args (gimple stmt)
{
tree fndecl, parms, p;
unsigned int i, nargs;
- if (gimple_call_cannot_inline_p (stmt))
- return;
-
nargs = gimple_call_num_args (stmt);
/* Get argument types for verification. */
@@ -244,7 +241,7 @@ check_call_args (gimple stmt)
/* Verify if the type of the argument matches that of the function
declaration. If we cannot verify this or there is a mismatch,
- mark the call expression so it doesn't get inlined later. */
+ return false. */
if (fndecl && DECL_ARGUMENTS (fndecl))
{
for (i = 0, p = DECL_ARGUMENTS (fndecl);
@@ -260,10 +257,7 @@ check_call_args (gimple stmt)
|| gimple_call_arg (stmt, i) == error_mark_node
|| !fold_convertible_p (DECL_ARG_TYPE (p),
gimple_call_arg (stmt, i)))
- {
- gimple_call_set_cannot_inline (stmt, true);
- break;
- }
+ return false;
}
}
else if (parms)
@@ -279,17 +273,15 @@ check_call_args (gimple stmt)
|| TREE_CODE (TREE_VALUE (p)) == VOID_TYPE
|| !fold_convertible_p (TREE_VALUE (p),
gimple_call_arg (stmt, i)))
- {
- gimple_call_set_cannot_inline (stmt, true);
- break;
- }
+ return false;
}
}
else
{
if (nargs != 0)
- gimple_call_set_cannot_inline (stmt, true);
+ return false;
}
+ return true;
}
@@ -394,7 +386,6 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
lower_builtin_setjmp (gsi);
return;
}
- check_call_args (stmt);
}
break;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index f9677acdb75..50180203e2d 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1175,6 +1175,22 @@ dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
}
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
+ if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
+ {
+ expanded_location xloc;
+
+ xloc = expand_location (gimple_phi_arg_location (phi, i));
+ pp_character (buffer, '[');
+ if (xloc.file)
+ {
+ pp_string (buffer, xloc.file);
+ pp_string (buffer, " : ");
+ }
+ pp_decimal_int (buffer, xloc.line);
+ pp_string (buffer, ":");
+ pp_decimal_int (buffer, xloc.column);
+ pp_string (buffer, "] ");
+ }
dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
false);
pp_character (buffer, '(');
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index dc8d0c089a4..7de2a7e183f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1763,7 +1763,8 @@ canonicalize_addr_expr (tree *expr_p)
the expression pointer type. */
ddatype = TREE_TYPE (datype);
pddatype = build_pointer_type (ddatype);
- if (!useless_type_conversion_p (pddatype, ddatype))
+ if (!useless_type_conversion_p (TYPE_MAIN_VARIANT (TREE_TYPE (expr)),
+ pddatype))
return;
/* The lower bound and element sizes must be constant. */
@@ -1778,6 +1779,10 @@ canonicalize_addr_expr (tree *expr_p)
TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
NULL_TREE, NULL_TREE);
*expr_p = build1 (ADDR_EXPR, pddatype, *expr_p);
+
+ /* We can have stripped a required restrict qualifier above. */
+ if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p)))
+ *expr_p = fold_convert (TREE_TYPE (expr), *expr_p);
}
/* *EXPR_P is a NOP_EXPR or CONVERT_EXPR. Remove it and/or other conversions
@@ -4322,8 +4327,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* Insert pointer conversions required by the middle-end that are not
required by the frontend. This fixes middle-end type checking for
for example gcc.dg/redecl-6.c. */
- if (POINTER_TYPE_P (TREE_TYPE (*to_p))
- && lang_hooks.types_compatible_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p)))
+ if (POINTER_TYPE_P (TREE_TYPE (*to_p)))
{
STRIP_USELESS_TYPE_CONVERSION (*from_p);
if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p)))
diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c
new file mode 100644
index 00000000000..45f3bc6c629
--- /dev/null
+++ b/gcc/graphite-blocking.c
@@ -0,0 +1,221 @@
+/* Heuristics and transform for loop blocking and strip mining on
+ polyhedral representation.
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Pranav Garg <pranav.garg2107@gmail.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "output.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "params.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "sese.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+
+
+/* Strip mines with a factor STRIDE the loop around PBB at depth
+ LOOP_DEPTH. The following example comes from the wiki page:
+ http://gcc.gnu.org/wiki/Graphite/Strip_mine
+
+ The strip mine of a loop with a tile of 64 can be obtained with a
+ scattering function as follows:
+
+ $ cat ./albert_strip_mine.cloog
+ # language: C
+ c
+
+ # parameter {n | n >= 0}
+ 1 3
+ # n 1
+ 1 1 0
+ 1
+ n
+
+ 1 # Number of statements:
+
+ 1
+ # {i | 0 <= i <= n}
+ 2 4
+ # i n 1
+ 1 1 0 0
+ 1 -1 1 0
+
+ 0 0 0
+ 1
+ i
+
+ 1 # Scattering functions
+
+ 3 6
+ # NEW OLD i n 1
+ 1 -64 0 1 0 0
+ 1 64 0 -1 0 63
+ 0 0 1 -1 0 0
+
+ 1
+ NEW OLD
+
+ #the output of CLooG is like this:
+ #$ cloog ./albert_strip_mine.cloog
+ # for (NEW=0;NEW<=floord(n,64);NEW++) {
+ # for (OLD=max(64*NEW,0);OLD<=min(64*NEW+63,n);OLD++) {
+ # S1(i = OLD) ;
+ # }
+ # }
+*/
+
+static bool
+pbb_strip_mine_loop_depth (poly_bb_p pbb, int loop_depth, int stride)
+{
+ ppl_dimension_type iter, dim;
+ ppl_Polyhedron_t res = PBB_TRANSFORMED_SCATTERING (pbb);
+ ppl_dimension_type strip = psct_scattering_dim_for_loop_depth (pbb,
+ loop_depth);
+
+ psct_add_scattering_dimension (pbb, strip);
+
+ iter = psct_iterator_dim (pbb, loop_depth);
+ ppl_Polyhedron_space_dimension (res, &dim);
+
+ /* Lower bound of the striped loop. */
+ {
+ ppl_Constraint_t new_cstr;
+ ppl_Linear_Expression_t expr;
+
+ ppl_new_Linear_Expression_with_dimension (&expr, dim);
+ ppl_set_coef (expr, strip, -1 * stride);
+ ppl_set_coef (expr, iter, 1);
+
+ ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_delete_Linear_Expression (expr);
+ ppl_Polyhedron_add_constraint (res, new_cstr);
+ ppl_delete_Constraint (new_cstr);
+ }
+
+ /* Upper bound of the striped loop. */
+ {
+ ppl_Constraint_t new_cstr;
+ ppl_Linear_Expression_t expr;
+
+ ppl_new_Linear_Expression_with_dimension (&expr, dim);
+ ppl_set_coef (expr, strip, stride);
+ ppl_set_coef (expr, iter, -1);
+ ppl_set_inhomogeneous (expr, stride - 1);
+
+ ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_delete_Linear_Expression (expr);
+ ppl_Polyhedron_add_constraint (res, new_cstr);
+ ppl_delete_Constraint (new_cstr);
+ }
+
+ return true;
+}
+
+/* Returns true when strip mining with STRIDE of the loop around PBB
+ at depth LOOP_DEPTH is profitable. */
+
+static bool
+pbb_strip_mine_profitable_p (poly_bb_p pbb,
+ graphite_dim_t loop_depth,
+ int stride)
+{
+ Value niter, strip_stride;
+ bool res;
+
+ value_init (strip_stride);
+ value_init (niter);
+ value_set_si (strip_stride, stride);
+ pbb_number_of_iterations (pbb, loop_depth, niter);
+ res = value_gt (niter, strip_stride);
+ value_clear (strip_stride);
+ value_clear (niter);
+
+ return res;
+}
+
+/* Strip mines all the loops around PBB. Nothing profitable in all this:
+ this is just a driver function. */
+
+static bool
+pbb_do_strip_mine (poly_bb_p pbb)
+{
+ graphite_dim_t loop_depth;
+ int stride = 64;
+ bool transform_done = false;
+
+ for (loop_depth = 0; loop_depth < pbb_dim_iter_domain (pbb); loop_depth++)
+ if (pbb_strip_mine_profitable_p (pbb, loop_depth, stride))
+ transform_done |= pbb_strip_mine_loop_depth (pbb, loop_depth, stride);
+
+ return transform_done;
+}
+
+/* Strip mines all the loops in SCOP. Nothing profitable in all this:
+ this is just a driver function. */
+
+bool
+scop_do_strip_mine (scop_p scop)
+{
+ poly_bb_p pbb;
+ int i;
+ bool transform_done = false;
+
+ store_scattering (scop);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ transform_done |= pbb_do_strip_mine (pbb);
+
+ if (!transform_done)
+ return false;
+
+ if (!graphite_legal_transform (scop))
+ {
+ restore_scattering (scop);
+ return false;
+ }
+
+ return true;
+}
+
+#endif
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
new file mode 100644
index 00000000000..5da15e06659
--- /dev/null
+++ b/gcc/graphite-clast-to-gimple.c
@@ -0,0 +1,1323 @@
+/* Translation of CLAST (CLooG AST) to Gimple.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "sese.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+#include "graphite-scop-detection.h"
+#include "graphite-clast-to-gimple.h"
+#include "graphite-dependences.h"
+
+/* Verifies properties that GRAPHITE should maintain during translation. */
+
+static inline void
+graphite_verify (void)
+{
+#ifdef ENABLE_CHECKING
+ verify_loop_structure ();
+ verify_dominators (CDI_DOMINATORS);
+ verify_dominators (CDI_POST_DOMINATORS);
+ verify_ssa (false);
+ verify_loop_closed_ssa ();
+#endif
+}
+
+/* For a given loop DEPTH in the loop nest of the original black box
+ PBB, return the old induction variable associated to that loop. */
+
+static inline tree
+pbb_to_depth_to_oldiv (poly_bb_p pbb, int depth)
+{
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+ sese region = SCOP_REGION (PBB_SCOP (pbb));
+ loop_p loop = gbb_loop_at_index (gbb, region, depth);
+
+ return (tree) loop->aux;
+}
+
+/* For a given scattering dimension, return the new induction variable
+ associated to it. */
+
+static inline tree
+newivs_to_depth_to_newiv (VEC (tree, heap) *newivs, int depth)
+{
+ return VEC_index (tree, newivs, depth);
+}
+
+
+
+/* Returns the tree variable from the name NAME that was given in
+ Cloog representation. */
+
+static tree
+clast_name_to_gcc (const char *name, sese region, VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ int index;
+ VEC (tree, heap) *params = SESE_PARAMS (region);
+ htab_t params_index = SESE_PARAMS_INDEX (region);
+
+ if (params && params_index)
+ {
+ index = clast_name_to_index (name, params_index);
+
+ if (index >= 0)
+ return VEC_index (tree, params, index);
+ }
+
+ gcc_assert (newivs && newivs_index);
+ index = clast_name_to_index (name, newivs_index);
+ gcc_assert (index >= 0);
+
+ return newivs_to_depth_to_newiv (newivs, index);
+}
+
+/* Returns the maximal precision type for expressions E1 and E2. */
+
+static inline tree
+max_precision_type (tree e1, tree e2)
+{
+ tree type1 = TREE_TYPE (e1);
+ tree type2 = TREE_TYPE (e2);
+ return TYPE_PRECISION (type1) > TYPE_PRECISION (type2) ? type1 : type2;
+}
+
+static tree
+clast_to_gcc_expression (tree, struct clast_expr *, sese, VEC (tree, heap) *,
+ htab_t);
+
+/* Converts a Cloog reduction expression R with reduction operation OP
+ to a GCC expression tree of type TYPE. */
+
+static tree
+clast_to_gcc_expression_red (tree type, enum tree_code op,
+ struct clast_reduction *r,
+ sese region, VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ int i;
+ tree res = clast_to_gcc_expression (type, r->elts[0], region, newivs,
+ newivs_index);
+ tree operand_type = (op == POINTER_PLUS_EXPR) ? sizetype : type;
+
+ for (i = 1; i < r->n; i++)
+ {
+ tree t = clast_to_gcc_expression (operand_type, r->elts[i], region,
+ newivs, newivs_index);
+ res = fold_build2 (op, type, res, t);
+ }
+
+ return res;
+}
+
+/* Converts a Cloog AST expression E back to a GCC expression tree of
+ type TYPE. */
+
+static tree
+clast_to_gcc_expression (tree type, struct clast_expr *e,
+ sese region, VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ switch (e->type)
+ {
+ case expr_term:
+ {
+ struct clast_term *t = (struct clast_term *) e;
+
+ if (t->var)
+ {
+ if (value_one_p (t->val))
+ {
+ tree name = clast_name_to_gcc (t->var, region, newivs,
+ newivs_index);
+ return fold_convert (type, name);
+ }
+
+ else if (value_mone_p (t->val))
+ {
+ tree name = clast_name_to_gcc (t->var, region, newivs,
+ newivs_index);
+ name = fold_convert (type, name);
+ return fold_build1 (NEGATE_EXPR, type, name);
+ }
+ else
+ {
+ tree name = clast_name_to_gcc (t->var, region, newivs,
+ newivs_index);
+ tree cst = gmp_cst_to_tree (type, t->val);
+ name = fold_convert (type, name);
+ return fold_build2 (MULT_EXPR, type, cst, name);
+ }
+ }
+ else
+ return gmp_cst_to_tree (type, t->val);
+ }
+
+ case expr_red:
+ {
+ struct clast_reduction *r = (struct clast_reduction *) e;
+
+ switch (r->type)
+ {
+ case clast_red_sum:
+ return clast_to_gcc_expression_red
+ (type, POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR : PLUS_EXPR,
+ r, region, newivs, newivs_index);
+
+ case clast_red_min:
+ return clast_to_gcc_expression_red (type, MIN_EXPR, r, region,
+ newivs, newivs_index);
+
+ case clast_red_max:
+ return clast_to_gcc_expression_red (type, MAX_EXPR, r, region,
+ newivs, newivs_index);
+
+ default:
+ gcc_unreachable ();
+ }
+ break;
+ }
+
+ case expr_bin:
+ {
+ struct clast_binary *b = (struct clast_binary *) e;
+ struct clast_expr *lhs = (struct clast_expr *) b->LHS;
+ tree tl = clast_to_gcc_expression (type, lhs, region, newivs,
+ newivs_index);
+ tree tr = gmp_cst_to_tree (type, b->RHS);
+
+ switch (b->type)
+ {
+ case clast_bin_fdiv:
+ return fold_build2 (FLOOR_DIV_EXPR, type, tl, tr);
+
+ case clast_bin_cdiv:
+ return fold_build2 (CEIL_DIV_EXPR, type, tl, tr);
+
+ case clast_bin_div:
+ return fold_build2 (EXACT_DIV_EXPR, type, tl, tr);
+
+ case clast_bin_mod:
+ return fold_build2 (TRUNC_MOD_EXPR, type, tl, tr);
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+
+ return NULL_TREE;
+}
+
+/* Returns the type for the expression E. */
+
+static tree
+gcc_type_for_clast_expr (struct clast_expr *e,
+ sese region, VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ switch (e->type)
+ {
+ case expr_term:
+ {
+ struct clast_term *t = (struct clast_term *) e;
+
+ if (t->var)
+ return TREE_TYPE (clast_name_to_gcc (t->var, region, newivs,
+ newivs_index));
+ else
+ return NULL_TREE;
+ }
+
+ case expr_red:
+ {
+ struct clast_reduction *r = (struct clast_reduction *) e;
+
+ if (r->n == 1)
+ return gcc_type_for_clast_expr (r->elts[0], region, newivs,
+ newivs_index);
+ else
+ {
+ int i;
+ for (i = 0; i < r->n; i++)
+ {
+ tree type = gcc_type_for_clast_expr (r->elts[i], region,
+ newivs, newivs_index);
+ if (type)
+ return type;
+ }
+ return NULL_TREE;
+ }
+ }
+
+ case expr_bin:
+ {
+ struct clast_binary *b = (struct clast_binary *) e;
+ struct clast_expr *lhs = (struct clast_expr *) b->LHS;
+ return gcc_type_for_clast_expr (lhs, region, newivs,
+ newivs_index);
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+
+ return NULL_TREE;
+}
+
+/* Returns the type for the equation CLEQ. */
+
+static tree
+gcc_type_for_clast_eq (struct clast_equation *cleq,
+ sese region, VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ tree type = gcc_type_for_clast_expr (cleq->LHS, region, newivs,
+ newivs_index);
+ if (type)
+ return type;
+
+ return gcc_type_for_clast_expr (cleq->RHS, region, newivs, newivs_index);
+}
+
+/* Translates a clast equation CLEQ to a tree. */
+
+static tree
+graphite_translate_clast_equation (sese region,
+ struct clast_equation *cleq,
+ VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ enum tree_code comp;
+ tree type = gcc_type_for_clast_eq (cleq, region, newivs, newivs_index);
+ tree lhs = clast_to_gcc_expression (type, cleq->LHS, region, newivs,
+ newivs_index);
+ tree rhs = clast_to_gcc_expression (type, cleq->RHS, region, newivs,
+ newivs_index);
+
+ if (cleq->sign == 0)
+ comp = EQ_EXPR;
+
+ else if (cleq->sign > 0)
+ comp = GE_EXPR;
+
+ else
+ comp = LE_EXPR;
+
+ return fold_build2 (comp, boolean_type_node, lhs, rhs);
+}
+
+/* Creates the test for the condition in STMT. */
+
+static tree
+graphite_create_guard_cond_expr (sese region, struct clast_guard *stmt,
+ VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ tree cond = NULL;
+ int i;
+
+ for (i = 0; i < stmt->n; i++)
+ {
+ tree eq = graphite_translate_clast_equation (region, &stmt->eq[i],
+ newivs, newivs_index);
+
+ if (cond)
+ cond = fold_build2 (TRUTH_AND_EXPR, TREE_TYPE (eq), cond, eq);
+ else
+ cond = eq;
+ }
+
+ return cond;
+}
+
+/* Creates a new if region corresponding to Cloog's guard. */
+
+static edge
+graphite_create_new_guard (sese region, edge entry_edge,
+ struct clast_guard *stmt,
+ VEC (tree, heap) *newivs,
+ htab_t newivs_index)
+{
+ tree cond_expr = graphite_create_guard_cond_expr (region, stmt, newivs,
+ newivs_index);
+ edge exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
+ return exit_edge;
+}
+
+/* Walks a CLAST and returns the first statement in the body of a
+ loop. */
+
+static struct clast_user_stmt *
+clast_get_body_of_loop (struct clast_stmt *stmt)
+{
+ if (!stmt
+ || CLAST_STMT_IS_A (stmt, stmt_user))
+ return (struct clast_user_stmt *) stmt;
+
+ if (CLAST_STMT_IS_A (stmt, stmt_for))
+ return clast_get_body_of_loop (((struct clast_for *) stmt)->body);
+
+ if (CLAST_STMT_IS_A (stmt, stmt_guard))
+ return clast_get_body_of_loop (((struct clast_guard *) stmt)->then);
+
+ if (CLAST_STMT_IS_A (stmt, stmt_block))
+ return clast_get_body_of_loop (((struct clast_block *) stmt)->body);
+
+ gcc_unreachable ();
+}
+
+/* Given a CLOOG_IV, returns the type that it should have in GCC land.
+ If the information is not available, i.e. in the case one of the
+ transforms created the loop, just return integer_type_node. */
+
+static tree
+gcc_type_for_cloog_iv (const char *cloog_iv, gimple_bb_p gbb)
+{
+ struct ivtype_map_elt_s tmp;
+ PTR *slot;
+
+ tmp.cloog_iv = cloog_iv;
+ slot = htab_find_slot (GBB_CLOOG_IV_TYPES (gbb), &tmp, NO_INSERT);
+
+ if (slot && *slot)
+ return ((ivtype_map_elt) *slot)->type;
+
+ return integer_type_node;
+}
+
+/* Returns the induction variable for the loop that gets translated to
+ STMT. */
+
+static tree
+gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for)
+{
+ struct clast_stmt *stmt = (struct clast_stmt *) stmt_for;
+ struct clast_user_stmt *body = clast_get_body_of_loop (stmt);
+ const char *cloog_iv = stmt_for->iterator;
+ CloogStatement *cs = body->statement;
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+
+ return gcc_type_for_cloog_iv (cloog_iv, PBB_BLACK_BOX (pbb));
+}
+
+/* Creates a new LOOP corresponding to Cloog's STMT. Inserts an
+ induction variable for the new LOOP. New LOOP is attached to CFG
+ starting at ENTRY_EDGE. LOOP is inserted into the loop tree and
+ becomes the child loop of the OUTER_LOOP. NEWIVS_INDEX binds
+ CLooG's scattering name to the induction variable created for the
+ loop of STMT. The new induction variable is inserted in the NEWIVS
+ vector. */
+
+static struct loop *
+graphite_create_new_loop (sese region, edge entry_edge,
+ struct clast_for *stmt,
+ loop_p outer, VEC (tree, heap) **newivs,
+ htab_t newivs_index)
+{
+ tree type = gcc_type_for_iv_of_clast_loop (stmt);
+ tree lb = clast_to_gcc_expression (type, stmt->LB, region, *newivs,
+ newivs_index);
+ tree ub = clast_to_gcc_expression (type, stmt->UB, region, *newivs,
+ newivs_index);
+ tree stride = gmp_cst_to_tree (type, stmt->stride);
+ tree ivvar = create_tmp_var (type, "graphite_IV");
+ tree iv, iv_after_increment;
+ loop_p loop = create_empty_loop_on_edge
+ (entry_edge, lb, stride, ub, ivvar, &iv, &iv_after_increment,
+ outer ? outer : entry_edge->src->loop_father);
+
+ add_referenced_var (ivvar);
+
+ save_clast_name_index (newivs_index, stmt->iterator,
+ VEC_length (tree, *newivs));
+ VEC_safe_push (tree, heap, *newivs, iv);
+ return loop;
+}
+
+/* Inserts in MAP a tuple (OLD_NAME, NEW_NAME) for the induction
+ variables of the loops around GBB in SESE. */
+
+static void
+build_iv_mapping (htab_t map, sese region,
+ VEC (tree, heap) *newivs, htab_t newivs_index,
+ struct clast_user_stmt *user_stmt)
+{
+ struct clast_stmt *t;
+ int index = 0;
+ CloogStatement *cs = user_stmt->statement;
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+
+ for (t = user_stmt->substitutions; t; t = t->next, index++)
+ {
+ struct clast_expr *expr = (struct clast_expr *)
+ ((struct clast_assignment *)t)->RHS;
+ tree type = gcc_type_for_clast_expr (expr, region, newivs,
+ newivs_index);
+ tree old_name = pbb_to_depth_to_oldiv (pbb, index);
+ tree e = clast_to_gcc_expression (type, expr, region, newivs,
+ newivs_index);
+ set_rename (map, old_name, e);
+ }
+}
+
+/* Helper function for htab_traverse. */
+
+static int
+copy_renames (void **slot, void *s)
+{
+ struct rename_map_elt_s *entry = (struct rename_map_elt_s *) *slot;
+ htab_t res = (htab_t) s;
+ tree old_name = entry->old_name;
+ tree expr = entry->expr;
+ struct rename_map_elt_s tmp;
+ PTR *x;
+
+ tmp.old_name = old_name;
+ x = htab_find_slot (res, &tmp, INSERT);
+
+ if (!*x)
+ *x = new_rename_map_elt (old_name, expr);
+
+ return 1;
+}
+
+/* Construct bb_pbb_def with BB and PBB. */
+
+static bb_pbb_def *
+new_bb_pbb_def (basic_block bb, poly_bb_p pbb)
+{
+ bb_pbb_def *bb_pbb_p;
+
+ bb_pbb_p = XNEW (bb_pbb_def);
+ bb_pbb_p->bb = bb;
+ bb_pbb_p->pbb = pbb;
+
+ return bb_pbb_p;
+}
+
+/* Mark BB with it's relevant PBB via hashing table BB_PBB_MAPPING. */
+
+static void
+mark_bb_with_pbb (poly_bb_p pbb, basic_block bb, htab_t bb_pbb_mapping)
+{
+ bb_pbb_def tmp;
+ PTR *x;
+
+ tmp.bb = bb;
+ x = htab_find_slot (bb_pbb_mapping, &tmp, INSERT);
+
+ if (!*x)
+ *x = new_bb_pbb_def (bb, pbb);
+}
+
+/* Returns the scattering dimension for STMTFOR.
+
+ FIXME: This is a hackish solution to locate the scattering
+ dimension in newly created loops. Here the hackish solush
+ assume that the stmt_for->iterator is always something like:
+ scat_1 , scat_3 etc., where after "scat_" is loop level in
+ scattering dimension.
+*/
+
+static int get_stmtfor_depth (struct clast_for *stmtfor)
+{
+ const char * iterator = stmtfor->iterator;
+ const char * depth;
+
+ depth = strchr (iterator, '_');
+ if (!strncmp (iterator, "scat_", 5))
+ return atoi (depth+1);
+
+ gcc_unreachable();
+}
+
+/* Translates a CLAST statement STMT to GCC representation in the
+ context of a SESE.
+
+ - NEXT_E is the edge where new generated code should be attached.
+ - CONTEXT_LOOP is the loop in which the generated code will be placed
+ - RENAME_MAP contains a set of tuples of new names associated to
+ the original variables names.
+ - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
+*/
+
+static edge
+translate_clast (sese region, struct loop *context_loop,
+ struct clast_stmt *stmt, edge next_e,
+ htab_t rename_map, VEC (tree, heap) **newivs,
+ htab_t newivs_index, htab_t bb_pbb_mapping)
+{
+ if (!stmt)
+ return next_e;
+
+ if (CLAST_STMT_IS_A (stmt, stmt_root))
+ return translate_clast (region, context_loop, stmt->next, next_e,
+ rename_map, newivs, newivs_index, bb_pbb_mapping);
+
+ if (CLAST_STMT_IS_A (stmt, stmt_user))
+ {
+ gimple_bb_p gbb;
+ basic_block new_bb;
+ CloogStatement *cs = ((struct clast_user_stmt *) stmt)->statement;
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+ gbb = PBB_BLACK_BOX (pbb);
+
+ if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
+ return next_e;
+
+ build_iv_mapping (rename_map, region, *newivs, newivs_index,
+ (struct clast_user_stmt *) stmt);
+ next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), region,
+ next_e, rename_map);
+ new_bb = next_e->src;
+ mark_bb_with_pbb (pbb, new_bb, bb_pbb_mapping);
+ recompute_all_dominators ();
+ update_ssa (TODO_update_ssa);
+ graphite_verify ();
+ return translate_clast (region, context_loop, stmt->next, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping);
+ }
+
+ if (CLAST_STMT_IS_A (stmt, stmt_for))
+ {
+ struct clast_for *stmtfor = (struct clast_for *)stmt;
+ struct loop *loop
+ = graphite_create_new_loop (region, next_e, stmtfor,
+ context_loop, newivs, newivs_index);
+ edge last_e = single_exit (loop);
+ edge to_body = single_succ_edge (loop->header);
+ basic_block after = to_body->dest;
+
+ loop->aux = XNEW (int);
+ /* Pass scattering level information of the new loop by LOOP->AUX. */
+ *((int *)(loop->aux)) = get_stmtfor_depth (stmtfor);
+
+ /* Create a basic block for loop close phi nodes. */
+ last_e = single_succ_edge (split_edge (last_e));
+
+ /* Translate the body of the loop. */
+ next_e = translate_clast
+ (region, loop, ((struct clast_for *) stmt)->body,
+ single_succ_edge (loop->header), rename_map, newivs,
+ newivs_index, bb_pbb_mapping);
+ redirect_edge_succ_nodup (next_e, after);
+ set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
+
+ /* Remove from rename_map all the tuples containing variables
+ defined in loop's body. */
+ insert_loop_close_phis (rename_map, loop);
+
+ recompute_all_dominators ();
+ graphite_verify ();
+ return translate_clast (region, context_loop, stmt->next, last_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping);
+ }
+
+ if (CLAST_STMT_IS_A (stmt, stmt_guard))
+ {
+ edge last_e = graphite_create_new_guard (region, next_e,
+ ((struct clast_guard *) stmt),
+ *newivs, newivs_index);
+ edge true_e = get_true_edge_from_guard_bb (next_e->dest);
+ edge false_e = get_false_edge_from_guard_bb (next_e->dest);
+ edge exit_true_e = single_succ_edge (true_e->dest);
+ edge exit_false_e = single_succ_edge (false_e->dest);
+ htab_t before_guard = htab_create (10, rename_map_elt_info,
+ eq_rename_map_elts, free);
+
+ htab_traverse (rename_map, copy_renames, before_guard);
+ next_e = translate_clast (region, context_loop,
+ ((struct clast_guard *) stmt)->then,
+ true_e, rename_map, newivs, newivs_index,
+ bb_pbb_mapping);
+ insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
+ before_guard, rename_map);
+
+ htab_delete (before_guard);
+ recompute_all_dominators ();
+ graphite_verify ();
+
+ return translate_clast (region, context_loop, stmt->next, last_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping);
+ }
+
+ if (CLAST_STMT_IS_A (stmt, stmt_block))
+ {
+ next_e = translate_clast (region, context_loop,
+ ((struct clast_block *) stmt)->body,
+ next_e, rename_map, newivs, newivs_index,
+ bb_pbb_mapping);
+ recompute_all_dominators ();
+ graphite_verify ();
+ return translate_clast (region, context_loop, stmt->next, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping);
+ }
+
+ gcc_unreachable ();
+}
+
+/* Returns the first cloog name used in EXPR. */
+
+static const char *
+find_cloog_iv_in_expr (struct clast_expr *expr)
+{
+ struct clast_term *term = (struct clast_term *) expr;
+
+ if (expr->type == expr_term
+ && !term->var)
+ return NULL;
+
+ if (expr->type == expr_term)
+ return term->var;
+
+ if (expr->type == expr_red)
+ {
+ int i;
+ struct clast_reduction *red = (struct clast_reduction *) expr;
+
+ for (i = 0; i < red->n; i++)
+ {
+ const char *res = find_cloog_iv_in_expr ((red)->elts[i]);
+
+ if (res)
+ return res;
+ }
+ }
+
+ return NULL;
+}
+
+/* Build for a clast_user_stmt USER_STMT a map between the CLAST
+ induction variables and the corresponding GCC old induction
+ variables. This information is stored on each GRAPHITE_BB. */
+
+static void
+compute_cloog_iv_types_1 (poly_bb_p pbb, struct clast_user_stmt *user_stmt)
+{
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+ struct clast_stmt *t;
+ int index = 0;
+
+ for (t = user_stmt->substitutions; t; t = t->next, index++)
+ {
+ PTR *slot;
+ struct ivtype_map_elt_s tmp;
+ struct clast_expr *expr = (struct clast_expr *)
+ ((struct clast_assignment *)t)->RHS;
+
+ /* Create an entry (clast_var, type). */
+ tmp.cloog_iv = find_cloog_iv_in_expr (expr);
+ if (!tmp.cloog_iv)
+ continue;
+
+ slot = htab_find_slot (GBB_CLOOG_IV_TYPES (gbb), &tmp, INSERT);
+
+ if (!*slot)
+ {
+ tree oldiv = pbb_to_depth_to_oldiv (pbb, index);
+ tree type = oldiv ? TREE_TYPE (oldiv) : integer_type_node;
+ *slot = new_ivtype_map_elt (tmp.cloog_iv, type);
+ }
+ }
+}
+
+/* Walk the CLAST tree starting from STMT and build for each
+ clast_user_stmt a map between the CLAST induction variables and the
+ corresponding GCC old induction variables. This information is
+ stored on each GRAPHITE_BB. */
+
+static void
+compute_cloog_iv_types (struct clast_stmt *stmt)
+{
+ if (!stmt)
+ return;
+
+ if (CLAST_STMT_IS_A (stmt, stmt_root))
+ goto next;
+
+ if (CLAST_STMT_IS_A (stmt, stmt_user))
+ {
+ CloogStatement *cs = ((struct clast_user_stmt *) stmt)->statement;
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+
+ if (!GBB_CLOOG_IV_TYPES (gbb))
+ GBB_CLOOG_IV_TYPES (gbb) = htab_create (10, ivtype_map_elt_info,
+ eq_ivtype_map_elts, free);
+
+ compute_cloog_iv_types_1 (pbb, (struct clast_user_stmt *) stmt);
+ goto next;
+ }
+
+ if (CLAST_STMT_IS_A (stmt, stmt_for))
+ {
+ struct clast_stmt *s = ((struct clast_for *) stmt)->body;
+ compute_cloog_iv_types (s);
+ goto next;
+ }
+
+ if (CLAST_STMT_IS_A (stmt, stmt_guard))
+ {
+ struct clast_stmt *s = ((struct clast_guard *) stmt)->then;
+ compute_cloog_iv_types (s);
+ goto next;
+ }
+
+ if (CLAST_STMT_IS_A (stmt, stmt_block))
+ {
+ struct clast_stmt *s = ((struct clast_block *) stmt)->body;
+ compute_cloog_iv_types (s);
+ goto next;
+ }
+
+ gcc_unreachable ();
+
+ next:
+ compute_cloog_iv_types (stmt->next);
+}
+
+/* Free the SCATTERING domain list. */
+
+static void
+free_scattering (CloogDomainList *scattering)
+{
+ while (scattering)
+ {
+ CloogDomain *dom = cloog_domain (scattering);
+ CloogDomainList *next = cloog_next_domain (scattering);
+
+ cloog_domain_free (dom);
+ free (scattering);
+ scattering = next;
+ }
+}
+
+/* Initialize Cloog's parameter names from the names used in GIMPLE.
+ Initialize Cloog's iterator names, using 'graphite_iterator_%d'
+ from 0 to scop_nb_loops (scop). */
+
+static void
+initialize_cloog_names (scop_p scop, CloogProgram *prog)
+{
+ sese region = SCOP_REGION (scop);
+ int i;
+ int nb_iterators = scop_max_loop_depth (scop);
+ int nb_scattering = cloog_program_nb_scattdims (prog);
+ char **iterators = XNEWVEC (char *, nb_iterators * 2);
+ char **scattering = XNEWVEC (char *, nb_scattering);
+
+ cloog_program_set_names (prog, cloog_names_malloc ());
+ cloog_names_set_nb_parameters (cloog_program_names (prog),
+ VEC_length (tree, SESE_PARAMS (region)));
+ cloog_names_set_parameters (cloog_program_names (prog),
+ SESE_PARAMS_NAMES (region));
+
+ for (i = 0; i < nb_iterators; i++)
+ {
+ int len = 4 + 16;
+ iterators[i] = XNEWVEC (char, len);
+ snprintf (iterators[i], len, "git_%d", i);
+ }
+
+ cloog_names_set_nb_iterators (cloog_program_names (prog),
+ nb_iterators);
+ cloog_names_set_iterators (cloog_program_names (prog),
+ iterators);
+
+ for (i = 0; i < nb_scattering; i++)
+ {
+ int len = 5 + 16;
+ scattering[i] = XNEWVEC (char, len);
+ snprintf (scattering[i], len, "scat_%d", i);
+ }
+
+ cloog_names_set_nb_scattering (cloog_program_names (prog),
+ nb_scattering);
+ cloog_names_set_scattering (cloog_program_names (prog),
+ scattering);
+}
+
+/* Build cloog program for SCoP. */
+
+static void
+build_cloog_prog (scop_p scop, CloogProgram *prog)
+{
+ int i;
+ int max_nb_loops = scop_max_loop_depth (scop);
+ poly_bb_p pbb;
+ CloogLoop *loop_list = NULL;
+ CloogBlockList *block_list = NULL;
+ CloogDomainList *scattering = NULL;
+ int nbs = 2 * max_nb_loops + 1;
+ int *scaldims;
+
+ cloog_program_set_context
+ (prog, new_Cloog_Domain_from_ppl_Pointset_Powerset (SCOP_CONTEXT (scop)));
+ nbs = unify_scattering_dimensions (scop);
+ scaldims = (int *) xmalloc (nbs * (sizeof (int)));
+ cloog_program_set_nb_scattdims (prog, nbs);
+ initialize_cloog_names (scop, prog);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ {
+ CloogStatement *stmt;
+ CloogBlock *block;
+
+ /* Dead code elimination: when the domain of a PBB is empty,
+ don't generate code for the PBB. */
+ if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (PBB_DOMAIN (pbb)))
+ continue;
+
+ /* Build the new statement and its block. */
+ stmt = cloog_statement_alloc (GBB_BB (PBB_BLACK_BOX (pbb))->index);
+ block = cloog_block_alloc (stmt, 0, NULL, pbb_dim_iter_domain (pbb));
+ cloog_statement_set_usr (stmt, pbb);
+
+ /* Build loop list. */
+ {
+ CloogLoop *new_loop_list = cloog_loop_malloc ();
+ cloog_loop_set_next (new_loop_list, loop_list);
+ cloog_loop_set_domain
+ (new_loop_list,
+ new_Cloog_Domain_from_ppl_Pointset_Powerset (PBB_DOMAIN (pbb)));
+ cloog_loop_set_block (new_loop_list, block);
+ loop_list = new_loop_list;
+ }
+
+ /* Build block list. */
+ {
+ CloogBlockList *new_block_list = cloog_block_list_malloc ();
+
+ cloog_block_list_set_next (new_block_list, block_list);
+ cloog_block_list_set_block (new_block_list, block);
+ block_list = new_block_list;
+ }
+
+ /* Build scattering list. */
+ {
+ /* XXX: Replace with cloog_domain_list_alloc(), when available. */
+ CloogDomainList *new_scattering
+ = (CloogDomainList *) xmalloc (sizeof (CloogDomainList));
+ ppl_Polyhedron_t scat;
+ CloogDomain *dom;
+
+ scat = PBB_TRANSFORMED_SCATTERING (pbb);
+ dom = new_Cloog_Domain_from_ppl_Polyhedron (scat);
+
+ cloog_set_next_domain (new_scattering, scattering);
+ cloog_set_domain (new_scattering, dom);
+ scattering = new_scattering;
+ }
+ }
+
+ cloog_program_set_loop (prog, loop_list);
+ cloog_program_set_blocklist (prog, block_list);
+
+ for (i = 0; i < nbs; i++)
+ scaldims[i] = 0 ;
+
+ cloog_program_set_scaldims (prog, scaldims);
+
+ /* Extract scalar dimensions to simplify the code generation problem. */
+ cloog_program_extract_scalars (prog, scattering);
+
+ /* Apply scattering. */
+ cloog_program_scatter (prog, scattering);
+ free_scattering (scattering);
+
+ /* Iterators corresponding to scalar dimensions have to be extracted. */
+ cloog_names_scalarize (cloog_program_names (prog), nbs,
+ cloog_program_scaldims (prog));
+
+ /* Free blocklist. */
+ {
+ CloogBlockList *next = cloog_program_blocklist (prog);
+
+ while (next)
+ {
+ CloogBlockList *toDelete = next;
+ next = cloog_block_list_next (next);
+ cloog_block_list_set_next (toDelete, NULL);
+ cloog_block_list_set_block (toDelete, NULL);
+ cloog_block_list_free (toDelete);
+ }
+ cloog_program_set_blocklist (prog, NULL);
+ }
+}
+
+/* Return the options that will be used in GLOOG. */
+
+static CloogOptions *
+set_cloog_options (void)
+{
+ CloogOptions *options = cloog_options_malloc ();
+
+ /* Change cloog output language to C. If we do use FORTRAN instead, cloog
+ will stop e.g. with "ERROR: unbounded loops not allowed in FORTRAN.", if
+ we pass an incomplete program to cloog. */
+ options->language = LANGUAGE_C;
+
+ /* Enable complex equality spreading: removes dummy statements
+ (assignments) in the generated code which repeats the
+ substitution equations for statements. This is useless for
+ GLooG. */
+ options->esp = 1;
+
+ /* Enable C pretty-printing mode: normalizes the substitution
+ equations for statements. */
+ options->cpp = 1;
+
+ /* Allow cloog to build strides with a stride width different to one.
+ This example has stride = 4:
+
+ for (i = 0; i < 20; i += 4)
+ A */
+ options->strides = 1;
+
+ /* Disable optimizations and make cloog generate source code closer to the
+ input. This is useful for debugging, but later we want the optimized
+ code.
+
+ XXX: We can not disable optimizations, as loop blocking is not working
+ without them. */
+ if (0)
+ {
+ options->f = -1;
+ options->l = INT_MAX;
+ }
+
+ return options;
+}
+
+/* Prints STMT to STDERR. */
+
+void
+print_clast_stmt (FILE *file, struct clast_stmt *stmt)
+{
+ CloogOptions *options = set_cloog_options ();
+
+ pprint (file, stmt, 0, options);
+ cloog_options_free (options);
+}
+
+/* Prints STMT to STDERR. */
+
+void
+debug_clast_stmt (struct clast_stmt *stmt)
+{
+ print_clast_stmt (stderr, stmt);
+}
+
+/* Translate SCOP to a CLooG program and clast. These two
+ representations should be freed together: a clast cannot be used
+ without a program. */
+
+cloog_prog_clast
+scop_to_clast (scop_p scop)
+{
+ CloogOptions *options = set_cloog_options ();
+ cloog_prog_clast pc;
+
+ /* Connect new cloog prog generation to graphite. */
+ pc.prog = cloog_program_malloc ();
+ build_cloog_prog (scop, pc.prog);
+ pc.prog = cloog_program_generate (pc.prog, options);
+ pc.stmt = cloog_clast_create (pc.prog, options);
+
+ cloog_options_free (options);
+ return pc;
+}
+
+/* Prints to FILE the code generated by CLooG for SCOP. */
+
+void
+print_generated_program (FILE *file, scop_p scop)
+{
+ CloogOptions *options = set_cloog_options ();
+ cloog_prog_clast pc = scop_to_clast (scop);
+
+ fprintf (file, " (prog: \n");
+ cloog_program_print (file, pc.prog);
+ fprintf (file, " )\n");
+
+ fprintf (file, " (clast: \n");
+ pprint (file, pc.stmt, 0, options);
+ fprintf (file, " )\n");
+
+ cloog_options_free (options);
+ cloog_clast_free (pc.stmt);
+ cloog_program_free (pc.prog);
+}
+
+/* Prints to STDERR the code generated by CLooG for SCOP. */
+
+void
+debug_generated_program (scop_p scop)
+{
+ print_generated_program (stderr, scop);
+}
+
+/* A LOOP is in normal form for Graphite when it contains only one
+ scalar phi node that defines the main induction variable of the
+ loop, only one increment of the IV, and only one exit condition. */
+
+static void
+graphite_loop_normal_form (loop_p loop)
+{
+ struct tree_niter_desc niter;
+ tree nit;
+ gimple_seq stmts;
+ edge exit = single_dom_exit (loop);
+
+ bool known_niter = number_of_iterations_exit (loop, exit, &niter, false);
+
+ /* At this point we should know the number of iterations, */
+ gcc_assert (known_niter);
+
+ nit = force_gimple_operand (unshare_expr (niter.niter), &stmts, true,
+ NULL_TREE);
+ if (stmts)
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
+
+ loop->aux = canonicalize_loop_ivs (loop, &nit);
+}
+
+/* Converts REGION to loop normal form: one induction variable per loop. */
+
+static void
+build_graphite_loop_normal_form (sese region)
+{
+ int i;
+ loop_p loop;
+
+ for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ graphite_loop_normal_form (loop);
+}
+
+/* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for
+ the given SCOP. Return true if code generation succeeded.
+ BB_PBB_MAPPING is a basic_block and it's related poly_bb_p mapping.
+*/
+
+bool
+gloog (scop_p scop, htab_t bb_pbb_mapping)
+{
+ edge new_scop_exit_edge = NULL;
+ VEC (tree, heap) *newivs = VEC_alloc (tree, heap, 10);
+ loop_p context_loop;
+ sese region = SCOP_REGION (scop);
+ ifsese if_region = NULL;
+ htab_t rename_map, newivs_index;
+ cloog_prog_clast pc;
+
+ timevar_push (TV_GRAPHITE_CODE_GEN);
+
+ pc = scop_to_clast (scop);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\nCLAST generated by CLooG: \n");
+ print_clast_stmt (dump_file, pc.stmt);
+ fprintf (dump_file, "\n");
+ }
+
+ build_graphite_loop_normal_form (region);
+ recompute_all_dominators ();
+ graphite_verify ();
+
+ if_region = move_sese_in_condition (region);
+ sese_insert_phis_for_liveouts (region,
+ if_region->region->exit->src,
+ if_region->false_region->exit,
+ if_region->true_region->exit);
+
+ recompute_all_dominators ();
+ graphite_verify ();
+ context_loop = SESE_ENTRY (region)->src->loop_father;
+ compute_cloog_iv_types (pc.stmt);
+
+ rename_map = htab_create (10, rename_map_elt_info, eq_rename_map_elts, free);
+ newivs_index = htab_create (10, clast_name_index_elt_info,
+ eq_clast_name_indexes, free);
+
+ new_scop_exit_edge = translate_clast (region, context_loop, pc.stmt,
+ if_region->true_region->entry,
+ rename_map, &newivs, newivs_index,
+ bb_pbb_mapping);
+ sese_reset_aux_in_loops (region);
+ graphite_verify ();
+ sese_adjust_liveout_phis (region, rename_map,
+ if_region->region->exit->src,
+ if_region->false_region->exit,
+ if_region->true_region->exit);
+ recompute_all_dominators ();
+ graphite_verify ();
+
+ htab_delete (rename_map);
+ htab_delete (newivs_index);
+ VEC_free (tree, heap, newivs);
+ cloog_clast_free (pc.stmt);
+ cloog_program_free (pc.prog);
+ timevar_pop (TV_GRAPHITE_CODE_GEN);
+
+ return true;
+}
+
+
+
+/* Find BB's related poly_bb_p in hash table BB_PBB_MAPPING. */
+
+static poly_bb_p
+find_pbb_via_hash (htab_t bb_pbb_mapping, basic_block bb)
+{
+ bb_pbb_def tmp;
+ PTR *slot;
+
+ tmp.bb = bb;
+ slot = htab_find_slot (bb_pbb_mapping, &tmp, NO_INSERT);
+
+ if (slot && *slot)
+ return ((bb_pbb_def *) *slot)->pbb;
+
+ return NULL;
+}
+
+/* Free loop->aux in newly created loops by translate_clast. */
+
+void
+free_aux_in_new_loops (void)
+{
+ loop_p loop;
+ loop_iterator li;
+
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ if (!loop->aux)
+ continue;
+ free(loop->aux);
+ loop->aux = NULL;
+ }
+}
+
+/* Check data dependency in LOOP. BB_PBB_MAPPING is a basic_block and
+ it's related poly_bb_p mapping.
+*/
+
+static bool
+dependency_in_loop_p (loop_p loop, htab_t bb_pbb_mapping)
+{
+ unsigned i,j;
+ int level = 0;
+ basic_block *bbs = get_loop_body_in_dom_order (loop);
+
+ level = *((int *)(loop->aux));
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ poly_bb_p pbb1 = find_pbb_via_hash (bb_pbb_mapping, bbs[i]);
+
+ if (pbb1 == NULL)
+ continue;
+
+ for (j = 0; j < loop->num_nodes; j++)
+ {
+ poly_bb_p pbb2 = find_pbb_via_hash (bb_pbb_mapping, bbs[j]);
+
+ if (pbb2 == NULL)
+ continue;
+
+ if (dependency_between_pbbs_p (pbb1, pbb2, level))
+ {
+ free (bbs);
+ return true;
+ }
+ }
+ }
+
+ free (bbs);
+
+ return false;
+}
+
+/* Mark loop as parallel if data dependency does not exist.
+ BB_PBB_MAPPING is a basic_block and it's related poly_bb_p mapping.
+*/
+
+void mark_loops_parallel (htab_t bb_pbb_mapping)
+{
+ loop_p loop;
+ loop_iterator li;
+ int num_no_dependency = 0;
+
+ FOR_EACH_LOOP (li, loop, 0)
+ {
+ if (!loop->aux)
+ continue;
+
+ if (!dependency_in_loop_p (loop, bb_pbb_mapping))
+ {
+ loop->can_be_parallel = true;
+ num_no_dependency++;
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "\n%d loops carried no dependency.\n",
+ num_no_dependency);
+ }
+}
+
+#endif
diff --git a/gcc/graphite-clast-to-gimple.h b/gcc/graphite-clast-to-gimple.h
new file mode 100644
index 00000000000..e0ae6eedb3d
--- /dev/null
+++ b/gcc/graphite-clast-to-gimple.h
@@ -0,0 +1,66 @@
+/* Translation of CLAST (CLooG AST) to Gimple.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_GRAPHITE_CLAST_TO_GIMPLE_H
+#define GCC_GRAPHITE_CLAST_TO_GIMPLE_H
+
+/* Data structure for CLooG program representation. */
+
+typedef struct cloog_prog_clast {
+ CloogProgram *prog;
+ struct clast_stmt *stmt;
+} cloog_prog_clast;
+
+/* Stores BB's related PBB. */
+
+typedef struct bb_pbb_def
+{
+ basic_block bb;
+ poly_bb_p pbb;
+}bb_pbb_def;
+
+extern bool gloog (scop_p, htab_t);
+extern cloog_prog_clast scop_to_clast (scop_p);
+extern void debug_clast_stmt (struct clast_stmt *);
+extern void print_clast_stmt (FILE *, struct clast_stmt *);
+extern void debug_clast_name_indexes (htab_t);
+extern void mark_loops_parallel (htab_t);
+extern void free_aux_in_new_loops (void);
+
+/* Hash function for data base element BB_PBB. */
+
+static inline hashval_t
+bb_pbb_map_hash (const void *bb_pbb)
+{
+ return (hashval_t)(((const bb_pbb_def *)bb_pbb)->bb->index);
+}
+
+/* Compare data base element BB_PBB1 and BB_PBB2. */
+
+static inline int
+eq_bb_pbb_map (const void *bb_pbb1, const void *bb_pbb2)
+{
+ const bb_pbb_def *bp1 = (const bb_pbb_def *) bb_pbb1;
+ const bb_pbb_def *bp2 = (const bb_pbb_def *) bb_pbb2;
+ return (bp1->bb->index == bp2->bb->index);
+}
+
+
+#endif
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
new file mode 100644
index 00000000000..59e2a0d4da2
--- /dev/null
+++ b/gcc/graphite-dependences.c
@@ -0,0 +1,718 @@
+/* Data dependence analysis for Graphite.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Konrad Trifunovic <konrad.trifunovic@inria.fr>.
+
+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 "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "pointer-set.h"
+#include "gimple.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "sese.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+#include "graphite-dependences.h"
+
+/* Creates a new polyhedral data reference pair and
+ returns it. Parameter SOURCE denotes a source data reference
+ while parameter SINK denotes a sink data reference. Both
+ SOURCE and SINK define a pair of references, thus they
+ define an edge in DDG (Data Dependence Graph). */
+
+static poly_dr_pair_p
+new_poly_dr_pair (poly_dr_p source,
+ poly_dr_p sink,
+ ppl_Pointset_Powerset_C_Polyhedron_t ddp)
+{
+ poly_dr_pair_p pdrpp;
+
+ pdrpp = XNEW (struct poly_dr_pair);
+ pdrpp->source = source;
+ pdrpp->sink = sink;
+ pdrpp->ddp = ddp;
+
+ return pdrpp;
+}
+
+/* Comparison function for poly_dr_pair hash table. */
+
+int
+eq_poly_dr_pair_p (const void *pdrpp1, const void *pdrpp2)
+{
+ const struct poly_dr_pair *p1 = (const struct poly_dr_pair *) pdrpp1;
+ const struct poly_dr_pair *p2 = (const struct poly_dr_pair *) pdrpp2;
+
+ return (p1->source == p2->source
+ && p1->sink == p2->sink);
+}
+
+/* Hash function for poly_dr_pair hashtable. */
+
+hashval_t
+hash_poly_dr_pair_p (const void *pdrpp)
+{
+ const struct poly_dr_pair *p = (const struct poly_dr_pair *) pdrpp;
+
+ return (hashval_t) ((long) p->source + (long) p->sink);
+}
+
+/* Returns a polyhedron of dimension DIM.
+
+ Maps the dimensions [0, ..., cut - 1] of polyhedron P to OFFSET0
+ and the dimensions [cut, ..., nb_dim] to DIM - GDIM. */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+map_into_dep_poly (graphite_dim_t dim, graphite_dim_t gdim,
+ ppl_Pointset_Powerset_C_Polyhedron_t p,
+ graphite_dim_t cut,
+ graphite_dim_t offset)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&res, p);
+ ppl_insert_dimensions_pointset (res, 0, offset);
+ ppl_insert_dimensions_pointset (res, offset + cut,
+ dim - offset - cut - gdim);
+
+ return res;
+}
+
+/* Swap [cut0, ..., cut1] to the end of DR: "a CUT0 b CUT1 c" is
+ transformed into "a CUT0 c CUT1' b"
+
+ Add NB0 zeros before "a": "00...0 a CUT0 c CUT1' b"
+ Add NB1 zeros between "a" and "c": "00...0 a 00...0 c CUT1' b"
+ Add DIM - NB0 - NB1 - PDIM zeros between "c" and "b":
+ "00...0 a 00...0 c 00...0 b". */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+map_dr_into_dep_poly (graphite_dim_t dim,
+ ppl_Pointset_Powerset_C_Polyhedron_t dr,
+ graphite_dim_t cut0, graphite_dim_t cut1,
+ graphite_dim_t nb0, graphite_dim_t nb1)
+{
+ ppl_dimension_type pdim;
+ ppl_dimension_type *map;
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+ ppl_dimension_type i;
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&res, dr);
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (res, &pdim);
+
+ map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, pdim);
+
+ /* First mapping: move 'g' vector to right position. */
+ for (i = 0; i < cut0; i++)
+ map[i] = i;
+
+ for (i = cut0; i < cut1; i++)
+ map[i] = pdim - cut1 + i;
+
+ for (i = cut1; i < pdim; i++)
+ map[i] = cut0 + i - cut1;
+
+ ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (res, map, pdim);
+ free (map);
+
+ /* After swapping 's' and 'g' vectors, we have to update a new cut. */
+ cut1 = pdim - cut1 + cut0;
+
+ ppl_insert_dimensions_pointset (res, 0, nb0);
+ ppl_insert_dimensions_pointset (res, nb0 + cut0, nb1);
+ ppl_insert_dimensions_pointset (res, nb0 + nb1 + cut1,
+ dim - nb0 - nb1 - pdim);
+
+ return res;
+}
+
+/* Builds a constraints of the form "POS1 - POS2 CSTR_TYPE C" */
+
+static ppl_Constraint_t
+build_pairwise_constraint (graphite_dim_t dim,
+ graphite_dim_t pos1, graphite_dim_t pos2,
+ int c, enum ppl_enum_Constraint_Type cstr_type)
+{
+ ppl_Linear_Expression_t expr;
+ ppl_Constraint_t cstr;
+ ppl_Coefficient_t coef;
+ Value v, v_op, v_c;
+
+ value_init (v);
+ value_init (v_op);
+ value_init (v_c);
+
+ value_set_si (v, 1);
+ value_set_si (v_op, -1);
+ value_set_si (v_c, c);
+
+ ppl_new_Coefficient (&coef);
+ ppl_new_Linear_Expression_with_dimension (&expr, dim);
+
+ ppl_assign_Coefficient_from_mpz_t (coef, v);
+ ppl_Linear_Expression_add_to_coefficient (expr, pos1, coef);
+ ppl_assign_Coefficient_from_mpz_t (coef, v_op);
+ ppl_Linear_Expression_add_to_coefficient (expr, pos2, coef);
+ ppl_assign_Coefficient_from_mpz_t (coef, v_c);
+ ppl_Linear_Expression_add_to_inhomogeneous (expr, coef);
+
+ ppl_new_Constraint (&cstr, expr, cstr_type);
+
+ ppl_delete_Linear_Expression (expr);
+ ppl_delete_Coefficient (coef);
+ value_clear (v);
+ value_clear (v_op);
+ value_clear (v_c);
+
+ return cstr;
+}
+
+/* Builds subscript equality constraints. */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+dr_equality_constraints (graphite_dim_t dim,
+ graphite_dim_t pos, graphite_dim_t nb_subscripts)
+{
+ ppl_Polyhedron_t subscript_equalities;
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+ Value v, v_op;
+ graphite_dim_t i;
+
+ value_init (v);
+ value_init (v_op);
+ value_set_si (v, 1);
+ value_set_si (v_op, -1);
+
+ ppl_new_C_Polyhedron_from_space_dimension (&subscript_equalities, dim, 0);
+ for (i = 0; i < nb_subscripts; i++)
+ {
+ ppl_Linear_Expression_t expr;
+ ppl_Constraint_t cstr;
+ ppl_Coefficient_t coef;
+
+ ppl_new_Coefficient (&coef);
+ ppl_new_Linear_Expression_with_dimension (&expr, dim);
+
+ ppl_assign_Coefficient_from_mpz_t (coef, v);
+ ppl_Linear_Expression_add_to_coefficient (expr, pos + i, coef);
+ ppl_assign_Coefficient_from_mpz_t (coef, v_op);
+ ppl_Linear_Expression_add_to_coefficient (expr, pos + i + nb_subscripts,
+ coef);
+
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Polyhedron_add_constraint (subscript_equalities, cstr);
+
+ ppl_delete_Linear_Expression (expr);
+ ppl_delete_Constraint (cstr);
+ ppl_delete_Coefficient (coef);
+ }
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron
+ (&res, subscript_equalities);
+ value_clear (v);
+ value_clear (v_op);
+ ppl_delete_Polyhedron (subscript_equalities);
+
+ return res;
+}
+
+/* Builds scheduling equality constraints. */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+build_pairwise_scheduling_equality (graphite_dim_t dim,
+ graphite_dim_t pos, graphite_dim_t offset)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+ ppl_Polyhedron_t equalities;
+ ppl_Constraint_t cstr;
+
+ ppl_new_C_Polyhedron_from_space_dimension (&equalities, dim, 0);
+
+ cstr = build_pairwise_constraint (dim, pos, pos + offset, 0,
+ PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Polyhedron_add_constraint (equalities, cstr);
+ ppl_delete_Constraint (cstr);
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&res, equalities);
+ ppl_delete_Polyhedron (equalities);
+ return res;
+}
+
+/* Builds scheduling inequality constraints. */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+build_pairwise_scheduling_inequality (graphite_dim_t dim,
+ graphite_dim_t pos,
+ graphite_dim_t offset,
+ bool direction)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+ ppl_Polyhedron_t equalities;
+ ppl_Constraint_t cstr;
+
+ ppl_new_C_Polyhedron_from_space_dimension (&equalities, dim, 0);
+
+ if (direction)
+ cstr = build_pairwise_constraint (dim, pos, pos + offset, -1,
+ PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ else
+ cstr = build_pairwise_constraint (dim, pos, pos + offset, 1,
+ PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL);
+
+ ppl_Polyhedron_add_constraint (equalities, cstr);
+ ppl_delete_Constraint (cstr);
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&res, equalities);
+ ppl_delete_Polyhedron (equalities);
+ return res;
+}
+
+/* Returns true when adding the lexicographical constraints at level I
+ to the RES dependence polyhedron returns an empty polyhedron. */
+
+static bool
+lexicographically_gt_p (ppl_Pointset_Powerset_C_Polyhedron_t res,
+ graphite_dim_t dim,
+ graphite_dim_t offset,
+ bool direction, graphite_dim_t i)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_t ineq;
+ bool empty_p;
+
+ ineq = build_pairwise_scheduling_inequality (dim, i, offset,
+ direction);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (ineq, res);
+ empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (ineq);
+ if (!empty_p)
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, ineq);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (ineq);
+
+ return !empty_p;
+}
+
+/* Build the precedence constraints for the lexicographical comparison
+ of time vectors RES following the lexicographical order. */
+
+static void
+build_lexicographically_gt_constraint (ppl_Pointset_Powerset_C_Polyhedron_t *res,
+ graphite_dim_t dim,
+ graphite_dim_t tdim1,
+ graphite_dim_t offset,
+ bool direction)
+{
+ graphite_dim_t i;
+
+ if (lexicographically_gt_p (*res, dim, offset, direction, 0))
+ return;
+
+ for (i = 0; i < tdim1 - 1; i++)
+ {
+ ppl_Pointset_Powerset_C_Polyhedron_t sceq;
+
+ sceq = build_pairwise_scheduling_equality (dim, i, offset);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (*res, sceq);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (sceq);
+
+ if (lexicographically_gt_p (*res, dim, offset, direction, i + 1))
+ return;
+ }
+
+ if (i == tdim1 - 1)
+ {
+ ppl_delete_Pointset_Powerset_C_Polyhedron (*res);
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (res, dim, 1);
+ }
+}
+
+/* Build the dependence polyhedron for data references PDR1 and PDR2. */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+dependence_polyhedron_1 (poly_bb_p pbb1, poly_bb_p pbb2,
+ ppl_Pointset_Powerset_C_Polyhedron_t d1,
+ ppl_Pointset_Powerset_C_Polyhedron_t d2,
+ poly_dr_p pdr1, poly_dr_p pdr2,
+ ppl_Polyhedron_t s1, ppl_Polyhedron_t s2,
+ bool direction,
+ bool original_scattering_p)
+{
+ scop_p scop = PBB_SCOP (pbb1);
+ graphite_dim_t tdim1 = original_scattering_p ?
+ pbb_nb_scattering_orig (pbb1) : pbb_nb_scattering_transform (pbb1);
+ graphite_dim_t tdim2 = original_scattering_p ?
+ pbb_nb_scattering_orig (pbb2) : pbb_nb_scattering_transform (pbb2);
+ graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1);
+ graphite_dim_t ddim2 = pbb_dim_iter_domain (pbb2);
+ graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1;
+ graphite_dim_t gdim = scop_nb_params (scop);
+ graphite_dim_t dim1 = pdr_dim (pdr1);
+ graphite_dim_t dim2 = pdr_dim (pdr2);
+ graphite_dim_t dim = tdim1 + tdim2 + dim1 + dim2;
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+ ppl_Pointset_Powerset_C_Polyhedron_t id1, id2, isc1, isc2, idr1, idr2;
+ ppl_Pointset_Powerset_C_Polyhedron_t sc1, sc2, dreq;
+
+ gcc_assert (PBB_SCOP (pbb1) == PBB_SCOP (pbb2));
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sc1, s1);
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&sc2, s2);
+
+ id1 = map_into_dep_poly (dim, gdim, d1, ddim1, tdim1);
+ id2 = map_into_dep_poly (dim, gdim, d2, ddim2, tdim1 + ddim1 + tdim2);
+ isc1 = map_into_dep_poly (dim, gdim, sc1, ddim1 + tdim1, 0);
+ isc2 = map_into_dep_poly (dim, gdim, sc2, ddim2 + tdim2, tdim1 + ddim1);
+
+ idr1 = map_dr_into_dep_poly (dim, PDR_ACCESSES (pdr1), ddim1, ddim1 + gdim,
+ tdim1, tdim2 + ddim2);
+ idr2 = map_dr_into_dep_poly (dim, PDR_ACCESSES (pdr2), ddim2, ddim2 + gdim,
+ tdim1 + ddim1 + tdim2, sdim1);
+
+ /* Now add the subscript equalities. */
+ dreq = dr_equality_constraints (dim, tdim1 + ddim1 + tdim2 + ddim2, sdim1);
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&res, dim, 0);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, id1);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, id2);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, isc1);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, isc2);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, idr1);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, idr2);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (res, dreq);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (id1);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (id2);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (sc1);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (sc2);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (isc1);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (isc2);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (idr1);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (idr2);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (dreq);
+
+ if (!ppl_Pointset_Powerset_C_Polyhedron_is_empty (res))
+ build_lexicographically_gt_constraint (&res, dim, MIN (tdim1, tdim2),
+ tdim1 + ddim1, direction);
+ return res;
+}
+
+/* Build the dependence polyhedron for data references PDR1 and PDR2.
+ If possible use already cached information. */
+
+static ppl_Pointset_Powerset_C_Polyhedron_t
+dependence_polyhedron (poly_bb_p pbb1, poly_bb_p pbb2,
+ ppl_Pointset_Powerset_C_Polyhedron_t d1,
+ ppl_Pointset_Powerset_C_Polyhedron_t d2,
+ poly_dr_p pdr1, poly_dr_p pdr2,
+ ppl_Polyhedron_t s1, ppl_Polyhedron_t s2,
+ bool direction,
+ bool original_scattering_p)
+{
+ poly_dr_pair tmp;
+ PTR *x = NULL;
+ ppl_Pointset_Powerset_C_Polyhedron_t res;
+
+ if (original_scattering_p)
+ {
+ tmp.source = pdr1;
+ tmp.sink = pdr2;
+ x = htab_find_slot (SCOP_ORIGINAL_PDR_PAIRS (PBB_SCOP (pbb1)),
+ &tmp, INSERT);
+
+ if (x && *x)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nddp cache: hit.\n");
+ return ((poly_dr_pair *)*x)->ddp;
+ }
+ else if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nddp cache: miss.\n");
+ }
+
+ res = dependence_polyhedron_1 (pbb1, pbb2, d1, d2, pdr1, pdr2,
+ s1, s2, direction, original_scattering_p);
+
+ if (original_scattering_p)
+ {
+ gcc_assert (x && *x == NULL);
+ *x = new_poly_dr_pair (pdr1, pdr2, res);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nddp cache: add element.\n");
+ }
+
+ return res;
+}
+
+/* Returns true when the PBB_TRANSFORMED_SCATTERING functions of PBB1
+ and PBB2 respect the data dependences of PBB_ORIGINAL_SCATTERING
+ functions. */
+
+static bool
+graphite_legal_transform_dr (poly_bb_p pbb1, poly_bb_p pbb2,
+ poly_dr_p pdr1, poly_dr_p pdr2)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1);
+ ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2);
+ ppl_Polyhedron_t so1 = PBB_ORIGINAL_SCATTERING (pbb1);
+ ppl_Polyhedron_t so2 = PBB_ORIGINAL_SCATTERING (pbb2);
+ ppl_Pointset_Powerset_C_Polyhedron_t po;
+
+ graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1;
+ graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1;
+
+ if (sdim1 != sdim2)
+ return true;
+
+ po = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2,
+ true, true);
+
+ if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (po))
+ return true;
+ else
+ {
+ ppl_Polyhedron_t st1 = PBB_TRANSFORMED_SCATTERING (pbb1);
+ ppl_Polyhedron_t st2 = PBB_TRANSFORMED_SCATTERING (pbb2);
+ ppl_Pointset_Powerset_C_Polyhedron_t pt;
+ graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1);
+ graphite_dim_t otdim1 = pbb_nb_scattering_orig (pbb1);
+ graphite_dim_t otdim2 = pbb_nb_scattering_orig (pbb2);
+ graphite_dim_t ttdim1 = pbb_nb_scattering_transform (pbb1);
+ graphite_dim_t ttdim2 = pbb_nb_scattering_transform (pbb2);
+ ppl_Pointset_Powerset_C_Polyhedron_t temp;
+ ppl_dimension_type pdim;
+ bool is_empty_p;
+
+ /* Copy the PO polyhedron into the TEMP, so it is not destroyed.
+ Keep in mind, that PO polyhedron might be restored from the cache
+ and should not be modified! */
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &pdim);
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_space_dimension (&temp,
+ pdim, 0);
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (temp, po);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nloop carries dependency.\n");
+ pt = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, st1, st2,
+ false, false);
+
+ /* Extend PO and PT to have the same dimensions. */
+ ppl_insert_dimensions_pointset (temp, otdim1, ttdim1);
+ ppl_insert_dimensions_pointset (temp, otdim1 + ttdim1 + ddim1 + otdim2,
+ ttdim2);
+ ppl_insert_dimensions_pointset (pt, 0, otdim1);
+ ppl_insert_dimensions_pointset (pt, otdim1 + ttdim1 + ddim1, otdim2);
+
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (temp, pt);
+ is_empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (temp);
+
+ ppl_delete_Pointset_Powerset_C_Polyhedron (temp);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (pt);
+ return is_empty_p;
+ }
+}
+
+/* Iterates over the data references of PBB1 and PBB2 and detect
+ whether the transformed schedule is correct. */
+
+static bool
+graphite_legal_transform_bb (poly_bb_p pbb1, poly_bb_p pbb2)
+{
+ int i, j;
+ poly_dr_p pdr1, pdr2;
+
+ for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), i, pdr1); i++)
+ for (j = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), j, pdr2); j++)
+ if (!graphite_legal_transform_dr (pbb1, pbb2, pdr1, pdr2))
+ return false;
+ return true;
+}
+
+/* Iterates over the SCOP and detect whether the transformed schedule
+ is correct. */
+
+bool
+graphite_legal_transform (scop_p scop)
+{
+ int i, j;
+ poly_bb_p pbb1, pbb2;
+
+ timevar_push (TV_GRAPHITE_DATA_DEPS);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb1); i++)
+ for (j = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), j, pbb2); j++)
+ if (!graphite_legal_transform_bb (pbb1, pbb2))
+ {
+ timevar_pop (TV_GRAPHITE_DATA_DEPS);
+ return false;
+ }
+
+ timevar_pop (TV_GRAPHITE_DATA_DEPS);
+ return true;
+}
+
+/* Remove all the dimensions except alias information at dimension
+ ALIAS_DIM. */
+
+static void
+build_alias_set_powerset (ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset,
+ ppl_dimension_type alias_dim)
+{
+ ppl_dimension_type *ds;
+ ppl_dimension_type access_dim;
+ unsigned i, pos = 0;
+
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (alias_powerset,
+ &access_dim);
+ ds = XNEWVEC (ppl_dimension_type, access_dim-1);
+ for (i = 0; i < access_dim; i++)
+ {
+ if (i == alias_dim)
+ continue;
+
+ ds[pos] = i;
+ pos++;
+ }
+
+ ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (alias_powerset,
+ ds,
+ access_dim - 1);
+ free (ds);
+}
+
+/* Return true when PDR1 and PDR2 may alias. */
+
+static bool
+poly_drs_may_alias_p (poly_dr_p pdr1, poly_dr_p pdr2)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset1, alias_powerset2;
+ ppl_Pointset_Powerset_C_Polyhedron_t accesses1 = PDR_ACCESSES (pdr1);
+ ppl_Pointset_Powerset_C_Polyhedron_t accesses2 = PDR_ACCESSES (pdr2);
+ ppl_dimension_type alias_dim1 = pdr_alias_set_dim (pdr1);
+ ppl_dimension_type alias_dim2 = pdr_alias_set_dim (pdr2);
+ int empty_p;
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&alias_powerset1, accesses1);
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&alias_powerset2, accesses2);
+
+ build_alias_set_powerset (alias_powerset1, alias_dim1);
+ build_alias_set_powerset (alias_powerset2, alias_dim2);
+
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign
+ (alias_powerset1, alias_powerset2);
+
+ empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (alias_powerset1);
+
+ ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset1);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (alias_powerset2);
+
+ return !empty_p;
+}
+
+/* Returns TRUE when the dependence polyhedron between PDR1 and
+ PDR2 represents a loop carried dependence at level LEVEL. Otherwise
+ return FALSE. */
+
+static bool
+graphite_carried_dependence_level_k (poly_dr_p pdr1, poly_dr_p pdr2,
+ int level)
+{
+ poly_bb_p pbb1 = PDR_PBB (pdr1);
+ poly_bb_p pbb2 = PDR_PBB (pdr2);
+ ppl_Pointset_Powerset_C_Polyhedron_t d1 = PBB_DOMAIN (pbb1);
+ ppl_Pointset_Powerset_C_Polyhedron_t d2 = PBB_DOMAIN (pbb2);
+ ppl_Polyhedron_t so1 = PBB_TRANSFORMED_SCATTERING (pbb1);
+ ppl_Polyhedron_t so2 = PBB_TRANSFORMED_SCATTERING (pbb2);
+ ppl_Pointset_Powerset_C_Polyhedron_t po;
+ ppl_Pointset_Powerset_C_Polyhedron_t eqpp;
+ graphite_dim_t sdim1 = PDR_NB_SUBSCRIPTS (pdr1) + 1;
+ graphite_dim_t sdim2 = PDR_NB_SUBSCRIPTS (pdr2) + 1;
+ graphite_dim_t tdim1 = pbb_nb_scattering_transform (pbb1);
+ graphite_dim_t ddim1 = pbb_dim_iter_domain (pbb1);
+ ppl_dimension_type dim;
+ bool empty_p;
+
+ if ((PDR_TYPE (pdr1) == PDR_READ && PDR_TYPE (pdr2) == PDR_READ)
+ || !poly_drs_may_alias_p (pdr1, pdr2))
+ return false;
+
+ if (sdim1 != sdim2)
+ return true;
+
+ po = dependence_polyhedron (pbb1, pbb2, d1, d2, pdr1, pdr2, so1, so2,
+ true, false);
+ if (ppl_Pointset_Powerset_C_Polyhedron_is_empty (po))
+ {
+ ppl_delete_Pointset_Powerset_C_Polyhedron (po);
+ return false;
+ }
+
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (po, &dim);
+ eqpp = build_pairwise_scheduling_inequality (dim, level, tdim1 + ddim1, 1);
+
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (eqpp, po);
+ empty_p = ppl_Pointset_Powerset_C_Polyhedron_is_empty (eqpp);
+
+ ppl_delete_Pointset_Powerset_C_Polyhedron (eqpp);
+ return !empty_p;
+}
+
+/* Check data dependency between PBB1 and PBB2 at level LEVEL. */
+
+bool
+dependency_between_pbbs_p (poly_bb_p pbb1, poly_bb_p pbb2, int level)
+{
+ int i, j;
+ poly_dr_p pdr1, pdr2;
+
+ timevar_push (TV_GRAPHITE_DATA_DEPS);
+
+ for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb1), i, pdr1); i++)
+ for (j = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb2), j, pdr2); j++)
+ if (graphite_carried_dependence_level_k (pdr1, pdr2, level))
+ {
+ timevar_pop (TV_GRAPHITE_DATA_DEPS);
+ return true;
+ }
+
+ timevar_pop (TV_GRAPHITE_DATA_DEPS);
+ return false;
+}
+
+#endif
diff --git a/gcc/graphite-dependences.h b/gcc/graphite-dependences.h
new file mode 100644
index 00000000000..ccf0b971b23
--- /dev/null
+++ b/gcc/graphite-dependences.h
@@ -0,0 +1,50 @@
+/* Graphite polyhedral representation.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Konrad Trifunovic <konrad.trifunovic@gmail.com>
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_GRAPHITE_DEPENDENCES_H
+#define GCC_GRAPHITE_DEPENDENCES_H
+
+extern bool graphite_legal_transform (scop_p);
+extern bool dependency_between_pbbs_p (poly_bb_p, poly_bb_p, int);
+
+typedef struct poly_dr_pair *poly_dr_pair_p;
+
+typedef struct poly_dr_pair
+{
+ /* Source polyhedral data reference of the dependence. */
+ poly_dr_p source;
+
+ /* Sink data reference of the dependence. */
+ poly_dr_p sink;
+
+ /* Data dependence polyhedron descibing dependence
+ between SOURCE and SINK data references. */
+ ppl_Pointset_Powerset_C_Polyhedron_t ddp;
+}poly_dr_pair;
+
+
+#define PDRP_SOURCE(PDRP) (PDR->source)
+#define PDRP_SINK(PDRP) (PDR->sink)
+#define PDRP_DDP(PDRP) (PDR->ddp)
+
+extern int eq_poly_dr_pair_p (const void *, const void *);
+extern hashval_t hash_poly_dr_pair_p (const void *);
+
+#endif
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
new file mode 100644
index 00000000000..314f17ca0c4
--- /dev/null
+++ b/gcc/graphite-interchange.c
@@ -0,0 +1,360 @@
+/* Interchange heuristics and transform for loop interchange on
+ polyhedral representation.
+
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Harsha Jagasia <harsha.jagasia@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "output.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "params.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "sese.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+
+/* Builds a linear expression, of dimension DIM, representing PDR's
+ memory access:
+
+ L = r_{n}*r_{n-1}*...*r_{1}*s_{0} + ... + r_{n}*s_{n-1} + s_{n}.
+
+ For an array A[10][20] with two subscript locations s0 and s1, the
+ linear memory access is 20 * s0 + s1: a stride of 1 in subscript s0
+ corresponds to a memory stride of 20. */
+
+static ppl_Linear_Expression_t
+build_linearized_memory_access (poly_dr_p pdr)
+{
+ ppl_Linear_Expression_t res;
+ ppl_Linear_Expression_t le;
+ ppl_dimension_type i;
+ ppl_dimension_type first = pdr_subscript_dim (pdr, 0);
+ ppl_dimension_type last = pdr_subscript_dim (pdr, PDR_NB_SUBSCRIPTS (pdr));
+ Value size, sub_size;
+ graphite_dim_t dim = pdr_dim (pdr);
+
+ ppl_new_Linear_Expression_with_dimension (&res, dim);
+
+ value_init (size);
+ value_set_si (size, 1);
+ value_init (sub_size);
+ value_set_si (sub_size, 1);
+
+ for (i = last - 1; i >= first; i--)
+ {
+ ppl_set_coef_gmp (res, i, size);
+
+ ppl_new_Linear_Expression_with_dimension (&le, dim);
+ ppl_set_coef (le, i, 1);
+ ppl_max_for_le (PDR_ACCESSES (pdr), le, sub_size);
+ value_multiply (size, size, sub_size);
+ ppl_delete_Linear_Expression (le);
+ }
+
+ value_clear (sub_size);
+ value_clear (size);
+ return res;
+}
+
+/* Set STRIDE to the stride of PDR in memory by advancing by one in
+ loop DEPTH. */
+
+static void
+memory_stride_in_loop (Value stride, graphite_dim_t depth, poly_dr_p pdr)
+{
+ ppl_Linear_Expression_t le, lma;
+ ppl_Constraint_t new_cstr;
+ ppl_Pointset_Powerset_C_Polyhedron_t p1, p2;
+ graphite_dim_t nb_subscripts = PDR_NB_SUBSCRIPTS (pdr);
+ ppl_dimension_type i, *map;
+ ppl_dimension_type dim = pdr_dim (pdr);
+ ppl_dimension_type dim_i = pdr_iterator_dim (pdr, depth);
+ ppl_dimension_type dim_k = dim;
+ ppl_dimension_type dim_L1 = dim + nb_subscripts + 1;
+ ppl_dimension_type dim_L2 = dim + nb_subscripts + 2;
+ ppl_dimension_type new_dim = dim + nb_subscripts + 3;
+
+ /* Add new dimensions to the polyhedron corresponding to
+ k, s0', s1',..., L1, and L2. These new variables are at
+ dimensions dim, dim + 1,... of the polyhedron P1 respectively. */
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&p1, PDR_ACCESSES (pdr));
+ ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed
+ (p1, nb_subscripts + 3);
+
+ lma = build_linearized_memory_access (pdr);
+ ppl_set_coef (lma, dim_L1, -1);
+ ppl_new_Constraint (&new_cstr, lma, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Pointset_Powerset_C_Polyhedron_add_constraint (p1, new_cstr);
+
+ /* Build P2. */
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&p2, p1);
+ map = ppl_new_id_map (new_dim);
+ ppl_interchange (map, dim_L1, dim_L2);
+ ppl_interchange (map, dim_i, dim_k);
+ for (i = 0; i < PDR_NB_SUBSCRIPTS (pdr); i++)
+ ppl_interchange (map, pdr_subscript_dim (pdr, i), dim + i + 1);
+ ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (p2, map, new_dim);
+ free (map);
+
+ /* Add constraint k = i + 1. */
+ ppl_new_Linear_Expression_with_dimension (&le, new_dim);
+ ppl_set_coef (le, dim_i, 1);
+ ppl_set_coef (le, dim_k, -1);
+ ppl_set_inhomogeneous (le, 1);
+ ppl_new_Constraint (&new_cstr, le, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Pointset_Powerset_C_Polyhedron_add_constraint (p2, new_cstr);
+ ppl_delete_Linear_Expression (le);
+ ppl_delete_Constraint (new_cstr);
+
+ /* P1 = P1 inter P2. */
+ ppl_Pointset_Powerset_C_Polyhedron_intersection_assign (p1, p2);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (p2);
+
+ /* Maximise the expression L2 - L1. */
+ ppl_new_Linear_Expression_with_dimension (&le, new_dim);
+ ppl_set_coef (le, dim_L2, 1);
+ ppl_set_coef (le, dim_L1, -1);
+ ppl_max_for_le (p1, le, stride);
+ ppl_delete_Linear_Expression (le);
+}
+
+
+/* Returns true when it is profitable to interchange loop at DEPTH1
+ and loop at DEPTH2 with DEPTH1 < DEPTH2 for PBB.
+
+ Example:
+
+ | int a[100][100];
+ |
+ | int
+ | foo (int N)
+ | {
+ | int j;
+ | int i;
+ |
+ | for (i = 0; i < N; i++)
+ | for (j = 0; j < N; j++)
+ | a[j][2 * i] += 1;
+ |
+ | return a[N][12];
+ | }
+
+ The data access A[j][i] is described like this:
+
+ | i j N a s0 s1 1
+ | 0 0 0 1 0 0 -5 = 0
+ | 0 -1 0 0 1 0 0 = 0
+ |-2 0 0 0 0 1 0 = 0
+ | 0 0 0 0 1 0 0 >= 0
+ | 0 0 0 0 0 1 0 >= 0
+ | 0 0 0 0 -1 0 100 >= 0
+ | 0 0 0 0 0 -1 100 >= 0
+
+ The linearized memory access L to A[100][100] is:
+
+ | i j N a s0 s1 1
+ | 0 0 0 0 100 1 0
+
+ Next, to measure the impact of iterating once in loop "i", we build
+ a maximization problem: first, we add to DR accesses the dimensions
+ k, s2, s3, L1 = 100 * s0 + s1, L2, and D1: polyhedron P1.
+
+ | i j N a s0 s1 k s2 s3 L1 L2 D1 1
+ | 0 0 0 1 0 0 0 0 0 0 0 0 -5 = 0 alias = 5
+ | 0 -1 0 0 1 0 0 0 0 0 0 0 0 = 0 s0 = j
+ |-2 0 0 0 0 1 0 0 0 0 0 0 0 = 0 s1 = 2 * i
+ | 0 0 0 0 1 0 0 0 0 0 0 0 0 >= 0
+ | 0 0 0 0 0 1 0 0 0 0 0 0 0 >= 0
+ | 0 0 0 0 -1 0 0 0 0 0 0 0 100 >= 0
+ | 0 0 0 0 0 -1 0 0 0 0 0 0 100 >= 0
+ | 0 0 0 0 100 1 0 0 0 -1 0 0 0 = 0 L1 = 100 * s0 + s1
+
+ Then, we generate the polyhedron P2 by interchanging the dimensions
+ (s0, s2), (s1, s3), (L1, L2), (i0, i)
+
+ | i j N a s0 s1 k s2 s3 L1 L2 D1 1
+ | 0 0 0 1 0 0 0 0 0 0 0 0 -5 = 0 alias = 5
+ | 0 -1 0 0 0 0 0 1 0 0 0 0 0 = 0 s2 = j
+ | 0 0 0 0 0 0 -2 0 1 0 0 0 0 = 0 s3 = 2 * k
+ | 0 0 0 0 0 0 0 1 0 0 0 0 0 >= 0
+ | 0 0 0 0 0 0 0 0 1 0 0 0 0 >= 0
+ | 0 0 0 0 0 0 0 -1 0 0 0 0 100 >= 0
+ | 0 0 0 0 0 0 0 0 -1 0 0 0 100 >= 0
+ | 0 0 0 0 0 0 0 100 1 0 -1 0 0 = 0 L2 = 100 * s2 + s3
+
+ then we add to P2 the equality k = i + 1:
+
+ |-1 0 0 0 0 0 1 0 0 0 0 0 -1 = 0 k = i + 1
+
+ and finally we maximize the expression "D1 = max (P1 inter P2, L2 - L1)".
+
+ For determining the impact of one iteration on loop "j", we
+ interchange (k, j), we add "k = j + 1", and we compute D2 the
+ maximal value of the difference.
+
+ Finally, the profitability test is D1 < D2: if in the outer loop
+ the strides are smaller than in the inner loop, then it is
+ profitable to interchange the loops at DEPTH1 and DEPTH2. */
+
+static bool
+pbb_interchange_profitable_p (graphite_dim_t depth1, graphite_dim_t depth2,
+ poly_bb_p pbb)
+{
+ int i;
+ poly_dr_p pdr;
+ Value d1, d2, s;
+ bool res;
+
+ gcc_assert (depth1 < depth2);
+
+ value_init (d1);
+ value_set_si (d1, 0);
+ value_init (d2);
+ value_set_si (d2, 0);
+ value_init (s);
+
+ for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ {
+ memory_stride_in_loop (s, depth1, pdr);
+ value_addto (d1, d1, s);
+
+ memory_stride_in_loop (s, depth2, pdr);
+ value_addto (d2, d2, s);
+ }
+
+ res = value_lt (d1, d2);
+
+ value_clear (d1);
+ value_clear (d2);
+ value_clear (s);
+
+ return res;
+}
+
+/* Interchanges the loops at DEPTH1 and DEPTH2 of the original
+ scattering and assigns the resulting polyhedron to the transformed
+ scattering. */
+
+static void
+pbb_interchange_loop_depths (graphite_dim_t depth1, graphite_dim_t depth2, poly_bb_p pbb)
+{
+ ppl_dimension_type i, dim;
+ ppl_dimension_type *map;
+ ppl_Polyhedron_t poly = PBB_TRANSFORMED_SCATTERING (pbb);
+ ppl_dimension_type dim1 = psct_iterator_dim (pbb, depth1);
+ ppl_dimension_type dim2 = psct_iterator_dim (pbb, depth2);
+
+ ppl_Polyhedron_space_dimension (poly, &dim);
+ map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim);
+
+ for (i = 0; i < dim; i++)
+ map[i] = i;
+
+ map[dim1] = dim2;
+ map[dim2] = dim1;
+
+ ppl_Polyhedron_map_space_dimensions (poly, map, dim);
+ free (map);
+}
+
+/* Interchanges all the loop depths that are considered profitable for PBB. */
+
+static bool
+pbb_do_interchange (poly_bb_p pbb, scop_p scop)
+{
+ graphite_dim_t i, j;
+ bool transform_done = false;
+
+ for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
+ for (j = i + 1; j < pbb_dim_iter_domain (pbb); j++)
+ if (pbb_interchange_profitable_p (i, j, pbb))
+ {
+ pbb_interchange_loop_depths (i, j, pbb);
+
+ if (graphite_legal_transform (scop))
+ {
+ transform_done = true;
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "PBB %d: loops at depths %d and %d will be interchanged.\n",
+ GBB_BB (PBB_BLACK_BOX (pbb))->index, (int) i, (int) j);
+ }
+ else
+ /* Undo the transform. */
+ pbb_interchange_loop_depths (j, i, pbb);
+ }
+
+ return transform_done;
+}
+
+/* Interchanges all the loop depths that are considered profitable for SCOP. */
+
+bool
+scop_do_interchange (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+ bool transform_done = false;
+
+ store_scattering (scop);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ transform_done |= pbb_do_interchange (pbb, scop);
+
+ if (!transform_done)
+ return false;
+
+ if (!graphite_legal_transform (scop))
+ {
+ restore_scattering (scop);
+ return false;
+ }
+
+ return transform_done;
+}
+
+#endif
+
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
new file mode 100644
index 00000000000..a5da8421eac
--- /dev/null
+++ b/gcc/graphite-poly.c
@@ -0,0 +1,726 @@
+/* Graphite polyhedral representation.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Tobias Grosser <grosser@fim.uni-passau.de>.
+
+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 "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "output.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "params.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "sese.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+#include "graphite-dependences.h"
+
+/* Return the maximal loop depth in SCOP. */
+
+int
+scop_max_loop_depth (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+ int max_nb_loops = 0;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ {
+ int nb_loops = pbb_dim_iter_domain (pbb);
+ if (max_nb_loops < nb_loops)
+ max_nb_loops = nb_loops;
+ }
+
+ return max_nb_loops;
+}
+
+/* Extend the scattering matrix of PBB to MAX_SCATTERING scattering
+ dimensions. */
+
+static void
+extend_scattering (poly_bb_p pbb, int max_scattering)
+{
+ ppl_dimension_type nb_old_dims, nb_new_dims;
+ int nb_added_dims, i;
+ ppl_Coefficient_t coef;
+ Value one;
+
+ nb_added_dims = max_scattering - pbb_nb_scattering_transform (pbb);
+ value_init (one);
+ value_set_si (one, 1);
+ ppl_new_Coefficient (&coef);
+ ppl_assign_Coefficient_from_mpz_t (coef, one);
+
+ gcc_assert (nb_added_dims >= 0);
+
+ nb_old_dims = pbb_nb_scattering_transform (pbb) + pbb_dim_iter_domain (pbb)
+ + scop_nb_params (PBB_SCOP (pbb));
+ nb_new_dims = nb_old_dims + nb_added_dims;
+
+ ppl_insert_dimensions (PBB_TRANSFORMED_SCATTERING (pbb),
+ pbb_nb_scattering_transform (pbb), nb_added_dims);
+ PBB_NB_SCATTERING_TRANSFORM (pbb) += nb_added_dims;
+
+ /* Add identity matrix for the added dimensions. */
+ for (i = max_scattering - nb_added_dims; i < max_scattering; i++)
+ {
+ ppl_Constraint_t cstr;
+ ppl_Linear_Expression_t expr;
+
+ ppl_new_Linear_Expression_with_dimension (&expr, nb_new_dims);
+ ppl_Linear_Expression_add_to_coefficient (expr, i, coef);
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Polyhedron_add_constraint (PBB_TRANSFORMED_SCATTERING (pbb), cstr);
+ ppl_delete_Constraint (cstr);
+ ppl_delete_Linear_Expression (expr);
+ }
+
+ ppl_delete_Coefficient (coef);
+ value_clear (one);
+}
+
+/* All scattering matrices in SCOP will have the same number of scattering
+ dimensions. */
+
+int
+unify_scattering_dimensions (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+ graphite_dim_t max_scattering = 0;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ max_scattering = MAX (pbb_nb_scattering_transform (pbb), max_scattering);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ extend_scattering (pbb, max_scattering);
+
+ return max_scattering;
+}
+
+/* Prints to FILE the scattering function of PBB. */
+
+void
+print_scattering_function (FILE *file, poly_bb_p pbb)
+{
+ graphite_dim_t i;
+
+ if (!PBB_TRANSFORMED (pbb))
+ return;
+
+ fprintf (file, "scattering bb_%d (\n", GBB_BB (PBB_BLACK_BOX (pbb))->index);
+ fprintf (file, "# eq");
+
+ for (i = 0; i < pbb_nb_scattering_transform (pbb); i++)
+ fprintf (file, " s%d", (int) i);
+
+ for (i = 0; i < pbb_nb_local_vars (pbb); i++)
+ fprintf (file, " lv%d", (int) i);
+
+ for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
+ fprintf (file, " i%d", (int) i);
+
+ for (i = 0; i < pbb_nb_params (pbb); i++)
+ fprintf (file, " p%d", (int) i);
+
+ fprintf (file, " cst\n");
+
+ ppl_print_polyhedron_matrix (file, PBB_TRANSFORMED_SCATTERING (pbb));
+
+ fprintf (file, ")\n");
+}
+
+/* Prints to FILE the iteration domain of PBB. */
+
+void
+print_iteration_domain (FILE *file, poly_bb_p pbb)
+{
+ print_pbb_domain (file, pbb);
+}
+
+/* Prints to FILE the scattering functions of every PBB of SCOP. */
+
+void
+print_scattering_functions (FILE *file, scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ print_scattering_function (file, pbb);
+}
+
+/* Prints to FILE the iteration domains of every PBB of SCOP. */
+
+void
+print_iteration_domains (FILE *file, scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ print_iteration_domain (file, pbb);
+}
+
+/* Prints to STDERR the scattering function of PBB. */
+
+void
+debug_scattering_function (poly_bb_p pbb)
+{
+ print_scattering_function (stderr, pbb);
+}
+
+/* Prints to STDERR the iteration domain of PBB. */
+
+void
+debug_iteration_domain (poly_bb_p pbb)
+{
+ print_iteration_domain (stderr, pbb);
+}
+
+/* Prints to STDERR the scattering functions of every PBB of SCOP. */
+
+void
+debug_scattering_functions (scop_p scop)
+{
+ print_scattering_functions (stderr, scop);
+}
+
+/* Prints to STDERR the iteration domains of every PBB of SCOP. */
+
+void
+debug_iteration_domains (scop_p scop)
+{
+ print_iteration_domains (stderr, scop);
+}
+
+/* Apply graphite transformations to all the basic blocks of SCOP. */
+
+bool
+apply_poly_transforms (scop_p scop)
+{
+ bool transform_done = false;
+
+ gcc_assert (graphite_legal_transform (scop));
+
+ /* Generate code even if we did not apply any real transformation.
+ This also allows to check the performance for the identity
+ transformation: GIMPLE -> GRAPHITE -> GIMPLE
+ Keep in mind that CLooG optimizes in control, so the loop structure
+ may change, even if we only use -fgraphite-identity. */
+ if (flag_graphite_identity)
+ transform_done = true;
+
+ if (flag_loop_parallelize_all)
+ transform_done = true;
+
+ if (flag_loop_block)
+ gcc_unreachable (); /* Not yet supported. */
+
+ if (flag_loop_strip_mine)
+ transform_done |= scop_do_strip_mine (scop);
+
+ if (flag_loop_interchange)
+ transform_done |= scop_do_interchange (scop);
+
+ return transform_done;
+}
+
+/* Create a new polyhedral data reference and add it to PBB. It is
+ defined by its ACCESSES, its TYPE, and the number of subscripts
+ NB_SUBSCRIPTS. */
+
+void
+new_poly_dr (poly_bb_p pbb,
+ ppl_Pointset_Powerset_C_Polyhedron_t accesses,
+ enum POLY_DR_TYPE type, void *cdr, int nb_subscripts)
+{
+ poly_dr_p pdr = XNEW (struct poly_dr);
+
+ PDR_PBB (pdr) = pbb;
+ PDR_ACCESSES (pdr) = accesses;
+ PDR_TYPE (pdr) = type;
+ PDR_CDR (pdr) = cdr;
+ PDR_NB_SUBSCRIPTS (pdr) = nb_subscripts;
+ VEC_safe_push (poly_dr_p, heap, PBB_DRS (pbb), pdr);
+}
+
+/* Free polyhedral data reference PDR. */
+
+void
+free_poly_dr (poly_dr_p pdr)
+{
+ ppl_delete_Pointset_Powerset_C_Polyhedron (PDR_ACCESSES (pdr));
+ XDELETE (pdr);
+}
+
+/* Create a new polyhedral black box. */
+
+void
+new_poly_bb (scop_p scop, void *black_box)
+{
+ poly_bb_p pbb = XNEW (struct poly_bb);
+
+ PBB_DOMAIN (pbb) = NULL;
+ PBB_SCOP (pbb) = scop;
+ pbb_set_black_box (pbb, black_box);
+ PBB_TRANSFORMED (pbb) = NULL;
+ PBB_SAVED (pbb) = NULL;
+ PBB_ORIGINAL (pbb) = NULL;
+ PBB_DRS (pbb) = VEC_alloc (poly_dr_p, heap, 3);
+ VEC_safe_push (poly_bb_p, heap, SCOP_BBS (scop), pbb);
+}
+
+/* Free polyhedral black box. */
+
+void
+free_poly_bb (poly_bb_p pbb)
+{
+ int i;
+ poly_dr_p pdr;
+
+ ppl_delete_Pointset_Powerset_C_Polyhedron (PBB_DOMAIN (pbb));
+
+ if (PBB_TRANSFORMED (pbb))
+ poly_scattering_free (PBB_TRANSFORMED (pbb));
+
+ if (PBB_SAVED (pbb))
+ poly_scattering_free (PBB_SAVED (pbb));
+
+ if (PBB_ORIGINAL (pbb))
+ poly_scattering_free (PBB_ORIGINAL (pbb));
+
+ if (PBB_DRS (pbb))
+ for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ free_poly_dr (pdr);
+
+ VEC_free (poly_dr_p, heap, PBB_DRS (pbb));
+ XDELETE (pbb);
+}
+
+static void
+print_pdr_access_layout (FILE *file, poly_dr_p pdr)
+{
+ graphite_dim_t i;
+
+ fprintf (file, "# eq");
+
+ for (i = 0; i < pdr_dim_iter_domain (pdr); i++)
+ fprintf (file, " i%d", (int) i);
+
+ for (i = 0; i < pdr_nb_params (pdr); i++)
+ fprintf (file, " p%d", (int) i);
+
+ fprintf (file, " alias");
+
+ for (i = 0; i < PDR_NB_SUBSCRIPTS (pdr); i++)
+ fprintf (file, " sub%d", (int) i);
+
+ fprintf (file, " cst\n");
+}
+
+/* Prints to FILE the polyhedral data reference PDR. */
+
+void
+print_pdr (FILE *file, poly_dr_p pdr)
+{
+ fprintf (file, "pdr (");
+
+ switch (PDR_TYPE (pdr))
+ {
+ case PDR_READ:
+ fprintf (file, "read \n");
+ break;
+
+ case PDR_WRITE:
+ fprintf (file, "write \n");
+ break;
+
+ case PDR_MAY_WRITE:
+ fprintf (file, "may_write \n");
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ dump_data_reference (file, (data_reference_p) PDR_CDR (pdr));
+
+ fprintf (file, "data accesses (\n");
+ print_pdr_access_layout (file, pdr);
+ ppl_print_powerset_matrix (file, PDR_ACCESSES (pdr));
+ fprintf (file, ")\n");
+
+ fprintf (file, ")\n");
+}
+
+/* Prints to STDERR the polyhedral data reference PDR. */
+
+void
+debug_pdr (poly_dr_p pdr)
+{
+ print_pdr (stderr, pdr);
+}
+
+/* Creates a new SCOP containing REGION. */
+
+scop_p
+new_scop (void *region)
+{
+ scop_p scop = XNEW (struct scop);
+
+ SCOP_DEP_GRAPH (scop) = NULL;
+ SCOP_CONTEXT (scop) = NULL;
+ scop_set_region (scop, region);
+ SCOP_BBS (scop) = VEC_alloc (poly_bb_p, heap, 3);
+ SCOP_ORIGINAL_PDR_PAIRS (scop) = htab_create (10, hash_poly_dr_pair_p,
+ eq_poly_dr_pair_p, free);
+ return scop;
+}
+
+/* Deletes SCOP. */
+
+void
+free_scop (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ free_poly_bb (pbb);
+
+ VEC_free (poly_bb_p, heap, SCOP_BBS (scop));
+
+ if (SCOP_CONTEXT (scop))
+ ppl_delete_Pointset_Powerset_C_Polyhedron (SCOP_CONTEXT (scop));
+
+ htab_delete (SCOP_ORIGINAL_PDR_PAIRS (scop));
+ XDELETE (scop);
+}
+
+/* Print to FILE the domain of PBB. */
+
+void
+print_pbb_domain (FILE *file, poly_bb_p pbb)
+{
+ graphite_dim_t i;
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+
+ if (!PBB_DOMAIN (pbb))
+ return;
+
+ fprintf (file, "domains bb_%d (\n", GBB_BB (gbb)->index);
+ fprintf (file, "# eq");
+
+ for (i = 0; i < pbb_dim_iter_domain (pbb); i++)
+ fprintf (file, " i%d", (int) i);
+
+ for (i = 0; i < pbb_nb_params (pbb); i++)
+ fprintf (file, " p%d", (int) i);
+
+ fprintf (file, " cst\n");
+
+ if (PBB_DOMAIN (pbb))
+ ppl_print_powerset_matrix (file, PBB_DOMAIN (pbb));
+
+ fprintf (file, ")\n");
+}
+
+/* Dump the cases of a graphite basic block GBB on FILE. */
+
+static void
+dump_gbb_cases (FILE *file, gimple_bb_p gbb)
+{
+ int i;
+ gimple stmt;
+ VEC (gimple, heap) *cases;
+
+ if (!gbb)
+ return;
+
+ cases = GBB_CONDITION_CASES (gbb);
+ if (VEC_empty (gimple, cases))
+ return;
+
+ fprintf (file, "cases bb_%d (", GBB_BB (gbb)->index);
+
+ for (i = 0; VEC_iterate (gimple, cases, i, stmt); i++)
+ print_gimple_stmt (file, stmt, 0, 0);
+
+ fprintf (file, ")\n");
+}
+
+/* Dump conditions of a graphite basic block GBB on FILE. */
+
+static void
+dump_gbb_conditions (FILE *file, gimple_bb_p gbb)
+{
+ int i;
+ gimple stmt;
+ VEC (gimple, heap) *conditions;
+
+ if (!gbb)
+ return;
+
+ conditions = GBB_CONDITIONS (gbb);
+ if (VEC_empty (gimple, conditions))
+ return;
+
+ fprintf (file, "conditions bb_%d (", GBB_BB (gbb)->index);
+
+ for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
+ print_gimple_stmt (file, stmt, 0, 0);
+
+ fprintf (file, ")\n");
+}
+
+/* Print to FILE all the data references of PBB. */
+
+void
+print_pdrs (FILE *file, poly_bb_p pbb)
+{
+ int i;
+ poly_dr_p pdr;
+
+ for (i = 0; VEC_iterate (poly_dr_p, PBB_DRS (pbb), i, pdr); i++)
+ print_pdr (file, pdr);
+}
+
+/* Print to STDERR all the data references of PBB. */
+
+void
+debug_pdrs (poly_bb_p pbb)
+{
+ print_pdrs (stderr, pbb);
+}
+
+/* Print to FILE the domain and scattering function of PBB. */
+
+void
+print_pbb (FILE *file, poly_bb_p pbb)
+{
+ fprintf (file, "pbb_%d (\n", GBB_BB (PBB_BLACK_BOX (pbb))->index);
+ dump_gbb_conditions (file, PBB_BLACK_BOX (pbb));
+ dump_gbb_cases (file, PBB_BLACK_BOX (pbb));
+ print_pdrs (file, pbb);
+ print_pbb_domain (file, pbb);
+ print_scattering_function (file, pbb);
+ fprintf (file, ")\n");
+}
+
+/* Print to FILE the parameters of SCOP. */
+
+void
+print_scop_params (FILE *file, scop_p scop)
+{
+ int i;
+ tree t;
+
+ fprintf (file, "parameters (\n");
+ for (i = 0; VEC_iterate (tree, SESE_PARAMS (SCOP_REGION (scop)), i, t); i++)
+ {
+ fprintf (file, "p_%d -> ", i);
+ print_generic_expr (file, t, 0);
+ fprintf (file, "\n");
+ }
+ fprintf (file, ")\n");
+}
+
+/* Print to FILE the context of SCoP. */
+void
+print_scop_context (FILE *file, scop_p scop)
+{
+ graphite_dim_t i;
+
+ fprintf (file, "context (\n");
+ fprintf (file, "# eq");
+
+ for (i = 0; i < scop_nb_params (scop); i++)
+ fprintf (file, " p%d", (int) i);
+
+ fprintf (file, " cst\n");
+
+ if (SCOP_CONTEXT (scop))
+ ppl_print_powerset_matrix (file, SCOP_CONTEXT (scop));
+
+ fprintf (file, ")\n");
+}
+
+/* Print to FILE the SCOP. */
+
+void
+print_scop (FILE *file, scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ fprintf (file, "scop (\n");
+ print_scop_params (file, scop);
+ print_scop_context (file, scop);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ print_pbb (file, pbb);
+
+ fprintf (file, ")\n");
+}
+
+/* Print to STDERR the domain of PBB. */
+
+void
+debug_pbb_domain (poly_bb_p pbb)
+{
+ print_pbb_domain (stderr, pbb);
+}
+
+/* Print to FILE the domain and scattering function of PBB. */
+
+void
+debug_pbb (poly_bb_p pbb)
+{
+ print_pbb (stderr, pbb);
+}
+
+/* Print to STDERR the context of SCOP. */
+
+void
+debug_scop_context (scop_p scop)
+{
+ print_scop_context (stderr, scop);
+}
+
+/* Print to STDERR the SCOP. */
+
+void
+debug_scop (scop_p scop)
+{
+ print_scop (stderr, scop);
+}
+
+/* Print to STDERR the parameters of SCOP. */
+
+void
+debug_scop_params (scop_p scop)
+{
+ print_scop_params (stderr, scop);
+}
+
+
+/* The dimension in the transformed scattering polyhedron of PBB
+ containing the scattering iterator for the loop at depth LOOP_DEPTH. */
+
+ppl_dimension_type
+psct_scattering_dim_for_loop_depth (poly_bb_p pbb, graphite_dim_t loop_depth)
+{
+ ppl_const_Constraint_System_t pcs;
+ ppl_Constraint_System_const_iterator_t cit, cend;
+ ppl_const_Constraint_t cstr;
+ ppl_Polyhedron_t ph = PBB_TRANSFORMED_SCATTERING (pbb);
+ ppl_dimension_type iter = psct_iterator_dim (pbb, loop_depth);
+ ppl_Linear_Expression_t expr;
+ ppl_Coefficient_t coef;
+ Value val;
+ graphite_dim_t i;
+
+ value_init (val);
+ ppl_new_Coefficient (&coef);
+ ppl_Polyhedron_get_constraints (ph, &pcs);
+ ppl_new_Constraint_System_const_iterator (&cit);
+ ppl_new_Constraint_System_const_iterator (&cend);
+
+ for (ppl_Constraint_System_begin (pcs, cit),
+ ppl_Constraint_System_end (pcs, cend);
+ !ppl_Constraint_System_const_iterator_equal_test (cit, cend);
+ ppl_Constraint_System_const_iterator_increment (cit))
+ {
+ ppl_Constraint_System_const_iterator_dereference (cit, &cstr);
+ ppl_new_Linear_Expression_from_Constraint (&expr, cstr);
+ ppl_Linear_Expression_coefficient (expr, iter, coef);
+ ppl_Coefficient_to_mpz_t (coef, val);
+
+ if (value_zero_p (val))
+ {
+ ppl_delete_Linear_Expression (expr);
+ continue;
+ }
+
+ for (i = 0; i < pbb_nb_scattering_transform (pbb); i++)
+ {
+ ppl_dimension_type scatter = psct_scattering_dim (pbb, i);
+
+ ppl_Linear_Expression_coefficient (expr, scatter, coef);
+ ppl_Coefficient_to_mpz_t (coef, val);
+
+ if (value_notzero_p (val))
+ {
+ value_clear (val);
+ ppl_delete_Linear_Expression (expr);
+ ppl_delete_Coefficient (coef);
+ ppl_delete_Constraint_System_const_iterator (cit);
+ ppl_delete_Constraint_System_const_iterator (cend);
+
+ return scatter;
+ }
+ }
+ }
+
+ gcc_unreachable ();
+}
+
+/* Returns the number of iterations NITER of the loop around PBB at
+ depth LOOP_DEPTH. */
+
+void
+pbb_number_of_iterations (poly_bb_p pbb,
+ graphite_dim_t loop_depth,
+ Value niter)
+{
+ ppl_Linear_Expression_t le;
+ ppl_dimension_type dim;
+
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim);
+ ppl_new_Linear_Expression_with_dimension (&le, dim);
+ ppl_set_coef (le, pbb_iterator_dim (pbb, loop_depth), 1);
+ value_set_si (niter, -1);
+ ppl_max_for_le (PBB_DOMAIN (pbb), le, niter);
+ ppl_delete_Linear_Expression (le);
+}
+
+#endif
+
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
new file mode 100644
index 00000000000..4459315b8a2
--- /dev/null
+++ b/gcc/graphite-poly.h
@@ -0,0 +1,661 @@
+/* Graphite polyhedral representation.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Tobias Grosser <grosser@fim.uni-passau.de>.
+
+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/>. */
+
+#ifndef GCC_GRAPHITE_POLY_H
+#define GCC_GRAPHITE_POLY_H
+
+typedef struct poly_dr *poly_dr_p;
+DEF_VEC_P(poly_dr_p);
+DEF_VEC_ALLOC_P (poly_dr_p, heap);
+
+typedef struct poly_bb *poly_bb_p;
+DEF_VEC_P(poly_bb_p);
+DEF_VEC_ALLOC_P (poly_bb_p, heap);
+
+typedef struct scop *scop_p;
+DEF_VEC_P(scop_p);
+DEF_VEC_ALLOC_P (scop_p, heap);
+
+typedef ppl_dimension_type graphite_dim_t;
+
+static inline graphite_dim_t pbb_dim_iter_domain (const struct poly_bb *);
+static inline graphite_dim_t pbb_nb_params (const struct poly_bb *);
+static inline graphite_dim_t scop_nb_params (scop_p);
+
+/* A data reference can write or read some memory or we
+ just know it may write some memory. */
+enum POLY_DR_TYPE
+{
+ PDR_READ,
+ /* PDR_MAY_READs are represented using PDR_READS. This does not limit the
+ expressiveness. */
+ PDR_WRITE,
+ PDR_MAY_WRITE
+};
+
+struct poly_dr
+{
+ /* A pointer to compiler's data reference description. */
+ void *compiler_dr;
+
+ /* A pointer to the PBB that contains this data reference. */
+ poly_bb_p pbb;
+
+ enum POLY_DR_TYPE type;
+
+ /* The access polyhedron contains the polyhedral space this data
+ reference will access.
+
+ The polyhedron contains these dimensions:
+
+ - The alias set (a):
+ Every memory access is classified in at least one alias set.
+
+ - The subscripts (s_0, ..., s_n):
+ The memory is accessed using zero or more subscript dimensions.
+
+ - The iteration domain (variables and parameters)
+
+ Do not hardcode the dimensions. Use the following accessor functions:
+ - pdr_alias_set_dim
+ - pdr_subscript_dim
+ - pdr_iterator_dim
+ - pdr_parameter_dim
+
+ Example:
+
+ | int A[1335][123];
+ | int *p = malloc ();
+ |
+ | k = ...
+ | for i
+ | {
+ | if (unknown_function ())
+ | p = A;
+ | ... = p[?][?];
+ | for j
+ | A[i][j+k] = m;
+ | }
+
+ The data access A[i][j+k] in alias set "5" is described like this:
+
+ | i j k a s0 s1 1
+ | 0 0 0 1 0 0 -5 = 0
+ |-1 0 0 0 1 0 0 = 0
+ | 0 -1 -1 0 0 1 0 = 0
+ | 0 0 0 0 1 0 0 >= 0 # The last four lines describe the
+ | 0 0 0 0 0 1 0 >= 0 # array size.
+ | 0 0 0 0 -1 0 1335 >= 0
+ | 0 0 0 0 0 -1 123 >= 0
+
+ The pointer "*p" in alias set "5" and "7" is described as a union of
+ polyhedron:
+
+
+ | i k a s0 1
+ | 0 0 1 0 -5 = 0
+ | 0 0 0 1 0 >= 0
+
+ "or"
+
+ | i k a s0 1
+ | 0 0 1 0 -7 = 0
+ | 0 0 0 1 0 >= 0
+
+ "*p" accesses all of the object allocated with 'malloc'.
+
+ The scalar data access "m" is represented as an array with zero subscript
+ dimensions.
+
+ | i j k a 1
+ | 0 0 0 -1 15 = 0 */
+ ppl_Pointset_Powerset_C_Polyhedron_t accesses;
+
+ /* The number of subscripts. */
+ graphite_dim_t nb_subscripts;
+};
+
+#define PDR_CDR(PDR) (PDR->compiler_dr)
+#define PDR_PBB(PDR) (PDR->pbb)
+#define PDR_TYPE(PDR) (PDR->type)
+#define PDR_ACCESSES(PDR) (PDR->accesses)
+#define PDR_NB_SUBSCRIPTS(PDR) (PDR->nb_subscripts)
+
+void new_poly_dr (poly_bb_p, ppl_Pointset_Powerset_C_Polyhedron_t,
+ enum POLY_DR_TYPE, void *, int);
+void free_poly_dr (poly_dr_p);
+void debug_pdr (poly_dr_p);
+void print_pdr (FILE *, poly_dr_p);
+static inline scop_p pdr_scop (poly_dr_p pdr);
+
+/* The dimension of the PDR_ACCESSES polyhedron of PDR. */
+
+static inline ppl_dimension_type
+pdr_dim (poly_dr_p pdr)
+{
+ ppl_dimension_type dim;
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PDR_ACCESSES (pdr),
+ &dim);
+ return dim;
+}
+
+/* The dimension of the iteration domain of the scop of PDR. */
+
+static inline ppl_dimension_type
+pdr_dim_iter_domain (poly_dr_p pdr)
+{
+ return pbb_dim_iter_domain (PDR_PBB (pdr));
+}
+
+/* The number of parameters of the scop of PDR. */
+
+static inline ppl_dimension_type
+pdr_nb_params (poly_dr_p pdr)
+{
+ return scop_nb_params (pdr_scop (pdr));
+}
+
+/* The dimension of the alias set in PDR. */
+
+static inline ppl_dimension_type
+pdr_alias_set_dim (poly_dr_p pdr)
+{
+ poly_bb_p pbb = PDR_PBB (pdr);
+
+ return pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb);
+}
+
+/* The dimension in PDR containing subscript S. */
+
+static inline ppl_dimension_type
+pdr_subscript_dim (poly_dr_p pdr, graphite_dim_t s)
+{
+ poly_bb_p pbb = PDR_PBB (pdr);
+
+ return pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb) + 1 + s;
+}
+
+/* The dimension in PDR containing the loop iterator ITER. */
+
+static inline ppl_dimension_type
+pdr_iterator_dim (poly_dr_p pdr ATTRIBUTE_UNUSED, graphite_dim_t iter)
+{
+ return iter;
+}
+
+/* The dimension in PDR containing parameter PARAM. */
+
+static inline ppl_dimension_type
+pdr_parameter_dim (poly_dr_p pdr, graphite_dim_t param)
+{
+ poly_bb_p pbb = PDR_PBB (pdr);
+
+ return pbb_dim_iter_domain (pbb) + param;
+}
+
+typedef struct poly_scattering *poly_scattering_p;
+
+struct poly_scattering
+{
+ /* The scattering function containing the transformations. */
+ ppl_Polyhedron_t scattering;
+
+ /* The number of local variables. */
+ int nb_local_variables;
+
+ /* The number of scattering dimensions. */
+ int nb_scattering;
+};
+
+/* POLY_BB represents a blackbox in the polyhedral model. */
+
+struct poly_bb
+{
+ void *black_box;
+
+ scop_p scop;
+
+ /* The iteration domain of this bb.
+ Example:
+
+ for (i = a - 7*b + 8; i <= 3*a + 13*b + 20; i++)
+ for (j = 2; j <= 2*i + 5; j++)
+ for (k = 0; k <= 5; k++)
+ S (i,j,k)
+
+ Loop iterators: i, j, k
+ Parameters: a, b
+
+ | i >= a - 7b + 8
+ | i <= 3a + 13b + 20
+ | j >= 2
+ | j <= 2i + 5
+ | k >= 0
+ | k <= 5
+
+ The number of variables in the DOMAIN may change and is not
+ related to the number of loops in the original code. */
+ ppl_Pointset_Powerset_C_Polyhedron_t domain;
+
+ /* The data references we access. */
+ VEC (poly_dr_p, heap) *drs;
+
+ /* The original scattering. */
+ poly_scattering_p original;
+
+ /* The transformed scattering. */
+ poly_scattering_p transformed;
+
+ /* A copy of the transformed scattering. */
+ poly_scattering_p saved;
+};
+
+#define PBB_BLACK_BOX(PBB) ((gimple_bb_p) PBB->black_box)
+#define PBB_SCOP(PBB) (PBB->scop)
+#define PBB_DOMAIN(PBB) (PBB->domain)
+#define PBB_DRS(PBB) (PBB->drs)
+#define PBB_ORIGINAL(PBB) (PBB->original)
+#define PBB_ORIGINAL_SCATTERING(PBB) (PBB->original->scattering)
+#define PBB_TRANSFORMED(PBB) (PBB->transformed)
+#define PBB_TRANSFORMED_SCATTERING(PBB) (PBB->transformed->scattering)
+#define PBB_SAVED(PBB) (PBB->saved)
+#define PBB_NB_LOCAL_VARIABLES(PBB) (PBB->transformed->nb_local_variables)
+#define PBB_NB_SCATTERING_TRANSFORM(PBB) (PBB->transformed->nb_scattering)
+
+extern void new_poly_bb (scop_p, void *);
+extern void free_poly_bb (poly_bb_p);
+extern void debug_loop_vec (poly_bb_p);
+extern void schedule_to_scattering (poly_bb_p, int);
+extern void print_pbb_domain (FILE *, poly_bb_p);
+extern void print_pbb (FILE *, poly_bb_p);
+extern void print_scop_context (FILE *, scop_p);
+extern void print_scop (FILE *, scop_p);
+extern void debug_pbb_domain (poly_bb_p);
+extern void debug_pbb (poly_bb_p);
+extern void print_pdrs (FILE *, poly_bb_p);
+extern void debug_pdrs (poly_bb_p);
+extern void debug_scop_context (scop_p);
+extern void debug_scop (scop_p);
+extern void print_scop_params (FILE *, scop_p);
+extern void debug_scop_params (scop_p);
+extern void print_iteration_domain (FILE *, poly_bb_p);
+extern void print_iteration_domains (FILE *, scop_p);
+extern void debug_iteration_domain (poly_bb_p);
+extern void debug_iteration_domains (scop_p);
+extern bool scop_do_interchange (scop_p);
+extern bool scop_do_strip_mine (scop_p);
+extern void pbb_number_of_iterations (poly_bb_p, graphite_dim_t, Value);
+
+/* The scop that contains the PDR. */
+
+static inline scop_p pdr_scop (poly_dr_p pdr)
+{
+ return PBB_SCOP (PDR_PBB (pdr));
+}
+
+/* Set black box of PBB to BLACKBOX. */
+
+static inline void
+pbb_set_black_box (poly_bb_p pbb, void *black_box)
+{
+ pbb->black_box = black_box;
+}
+
+/* The number of loops around PBB: the dimension of the iteration
+ domain. */
+
+static inline graphite_dim_t
+pbb_dim_iter_domain (const struct poly_bb *pbb)
+{
+ scop_p scop = PBB_SCOP (pbb);
+ ppl_dimension_type dim;
+
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb), &dim);
+ return dim - scop_nb_params (scop);
+}
+
+/* The number of params defined in PBB. */
+
+static inline graphite_dim_t
+pbb_nb_params (const struct poly_bb *pbb)
+{
+ scop_p scop = PBB_SCOP (pbb);
+
+ return scop_nb_params (scop);
+}
+
+/* The number of scattering dimensions in the SCATTERING polyhedron
+ of a PBB for a given SCOP. */
+
+static inline graphite_dim_t
+pbb_nb_scattering_orig (const struct poly_bb *pbb)
+{
+ return 2 * pbb_dim_iter_domain (pbb) + 1;
+}
+
+/* The number of scattering dimensions in PBB. */
+
+static inline graphite_dim_t
+pbb_nb_scattering_transform (const struct poly_bb *pbb)
+{
+ return PBB_NB_SCATTERING_TRANSFORM (pbb);
+}
+
+/* Returns the number of local variables used in the transformed
+ scattering polyhedron of PBB. */
+
+static inline graphite_dim_t
+pbb_nb_local_vars (const struct poly_bb *pbb)
+{
+ /* For now we do not have any local variables, as we do not do strip
+ mining for example. */
+ return PBB_NB_LOCAL_VARIABLES (pbb);
+}
+
+/* The dimension in the domain of PBB containing the iterator ITER. */
+
+static inline ppl_dimension_type
+pbb_iterator_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t iter)
+{
+ return iter;
+}
+
+/* The dimension in the domain of PBB containing the iterator ITER. */
+
+static inline ppl_dimension_type
+pbb_parameter_dim (poly_bb_p pbb, graphite_dim_t param)
+{
+ return param
+ + pbb_dim_iter_domain (pbb);
+}
+
+/* The dimension in the original scattering polyhedron of PBB
+ containing the scattering iterator SCATTER. */
+
+static inline ppl_dimension_type
+psco_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter)
+{
+ gcc_assert (scatter < pbb_nb_scattering_orig (pbb));
+ return scatter;
+}
+
+/* The dimension in the transformed scattering polyhedron of PBB
+ containing the scattering iterator SCATTER. */
+
+static inline ppl_dimension_type
+psct_scattering_dim (poly_bb_p pbb ATTRIBUTE_UNUSED, graphite_dim_t scatter)
+{
+ gcc_assert (scatter <= pbb_nb_scattering_transform (pbb));
+ return scatter;
+}
+
+ppl_dimension_type psct_scattering_dim_for_loop_depth (poly_bb_p,
+ graphite_dim_t);
+
+/* The dimension in the transformed scattering polyhedron of PBB of
+ the local variable LV. */
+
+static inline ppl_dimension_type
+psct_local_var_dim (poly_bb_p pbb, graphite_dim_t lv)
+{
+ gcc_assert (lv <= pbb_nb_local_vars (pbb));
+ return lv + pbb_nb_scattering_transform (pbb);
+}
+
+/* The dimension in the original scattering polyhedron of PBB
+ containing the loop iterator ITER. */
+
+static inline ppl_dimension_type
+psco_iterator_dim (poly_bb_p pbb, graphite_dim_t iter)
+{
+ gcc_assert (iter < pbb_dim_iter_domain (pbb));
+ return iter + pbb_nb_scattering_orig (pbb);
+}
+
+/* The dimension in the transformed scattering polyhedron of PBB
+ containing the loop iterator ITER. */
+
+static inline ppl_dimension_type
+psct_iterator_dim (poly_bb_p pbb, graphite_dim_t iter)
+{
+ gcc_assert (iter < pbb_dim_iter_domain (pbb));
+ return iter
+ + pbb_nb_scattering_transform (pbb)
+ + pbb_nb_local_vars (pbb);
+}
+
+/* The dimension in the original scattering polyhedron of PBB
+ containing parameter PARAM. */
+
+static inline ppl_dimension_type
+psco_parameter_dim (poly_bb_p pbb, graphite_dim_t param)
+{
+ gcc_assert (param < pbb_nb_params (pbb));
+ return param
+ + pbb_nb_scattering_orig (pbb)
+ + pbb_dim_iter_domain (pbb);
+}
+
+/* The dimension in the transformed scattering polyhedron of PBB
+ containing parameter PARAM. */
+
+static inline ppl_dimension_type
+psct_parameter_dim (poly_bb_p pbb, graphite_dim_t param)
+{
+ gcc_assert (param < pbb_nb_params (pbb));
+ return param
+ + pbb_nb_scattering_transform (pbb)
+ + pbb_nb_local_vars (pbb)
+ + pbb_dim_iter_domain (pbb);
+}
+
+/* Adds to the transformed scattering polyhedron of PBB a new local
+ variable and returns its index. */
+
+static inline graphite_dim_t
+psct_add_local_variable (poly_bb_p pbb)
+{
+ graphite_dim_t nlv = pbb_nb_local_vars (pbb);
+ ppl_dimension_type lv_column = psct_local_var_dim (pbb, nlv);
+ ppl_insert_dimensions (PBB_TRANSFORMED_SCATTERING (pbb), lv_column, 1);
+ PBB_NB_LOCAL_VARIABLES (pbb) += 1;
+ return nlv;
+}
+
+/* Adds a dimension to the transformed scattering polyhedron of PBB at
+ INDEX. */
+
+static inline void
+psct_add_scattering_dimension (poly_bb_p pbb, ppl_dimension_type index)
+{
+ gcc_assert (index < pbb_nb_scattering_transform (pbb));
+
+ ppl_insert_dimensions (PBB_TRANSFORMED_SCATTERING (pbb), index, 1);
+ PBB_NB_SCATTERING_TRANSFORM (pbb) += 1;
+}
+
+/* A SCOP is a Static Control Part of the program, simple enough to be
+ represented in polyhedral form. */
+struct scop
+{
+ /* A SCOP is defined as a SESE region. */
+ void *region;
+
+ /* Number of parameters in SCoP. */
+ graphite_dim_t nb_params;
+
+ /* All the basic blocks in this scop that contain memory references
+ and that will be represented as statements in the polyhedral
+ representation. */
+ VEC (poly_bb_p, heap) *bbs;
+
+ /* Data dependence graph for this SCoP. */
+ struct graph *dep_graph;
+
+ /* The context describes known restrictions concerning the parameters
+ and relations in between the parameters.
+
+ void f (int8_t a, uint_16_t b) {
+ c = 2 a + b;
+ ...
+ }
+
+ Here we can add these restrictions to the context:
+
+ -128 >= a >= 127
+ 0 >= b >= 65,535
+ c = 2a + b */
+ ppl_Pointset_Powerset_C_Polyhedron_t context;
+
+ /* A hashtable of the original pairs of dependent data references.
+ For each pair of dependent data references, the dependence
+ polyhedron is stored also. */
+ htab_t original_pdr_pairs;
+};
+
+#define SCOP_BBS(S) (S->bbs)
+#define SCOP_REGION(S) ((sese) S->region)
+#define SCOP_DEP_GRAPH(S) (S->dep_graph)
+#define SCOP_CONTEXT(S) (S->context)
+#define SCOP_ORIGINAL_PDR_PAIRS(S) (S->original_pdr_pairs)
+
+extern scop_p new_scop (void *);
+extern void free_scop (scop_p);
+extern void free_scops (VEC (scop_p, heap) *);
+extern void print_generated_program (FILE *, scop_p);
+extern void debug_generated_program (scop_p);
+extern void print_scattering_function (FILE *, poly_bb_p);
+extern void print_scattering_functions (FILE *, scop_p);
+extern void debug_scattering_function (poly_bb_p);
+extern void debug_scattering_functions (scop_p);
+extern int scop_max_loop_depth (scop_p);
+extern int unify_scattering_dimensions (scop_p);
+extern bool apply_poly_transforms (scop_p);
+extern bool graphite_legal_transform (scop_p);
+
+/* Set the region of SCOP to REGION. */
+
+static inline void
+scop_set_region (scop_p scop, void *region)
+{
+ scop->region = region;
+}
+
+/* Returns the number of parameters for SCOP. */
+
+static inline graphite_dim_t
+scop_nb_params (scop_p scop)
+{
+ return scop->nb_params;
+}
+
+/* Set the number of params of SCOP to NB_PARAMS. */
+
+static inline void
+scop_set_nb_params (scop_p scop, graphite_dim_t nb_params)
+{
+ scop->nb_params = nb_params;
+}
+
+/* Allocates a new empty poly_scattering structure. */
+
+static inline poly_scattering_p
+poly_scattering_new (void)
+{
+ poly_scattering_p res = XNEW (struct poly_scattering);
+
+ res->scattering = NULL;
+ res->nb_local_variables = 0;
+ res->nb_scattering = 0;
+ return res;
+}
+
+/* Free a poly_scattering structure. */
+
+static inline void
+poly_scattering_free (poly_scattering_p s)
+{
+ ppl_delete_Polyhedron (s->scattering);
+ free (s);
+}
+
+/* Copies S and return a new scattering. */
+
+static inline poly_scattering_p
+poly_scattering_copy (poly_scattering_p s)
+{
+ poly_scattering_p res = poly_scattering_new ();
+
+ ppl_new_C_Polyhedron_from_C_Polyhedron (&(res->scattering), s->scattering);
+ res->nb_local_variables = s->nb_local_variables;
+ res->nb_scattering = s->nb_scattering;
+ return res;
+}
+
+/* Saves the transformed scattering of PBB. */
+
+static inline void
+store_scattering_pbb (poly_bb_p pbb)
+{
+ gcc_assert (PBB_TRANSFORMED (pbb));
+
+ if (PBB_SAVED (pbb))
+ poly_scattering_free (PBB_SAVED (pbb));
+
+ PBB_SAVED (pbb) = poly_scattering_copy (PBB_TRANSFORMED (pbb));
+}
+
+/* Saves the scattering for all the pbbs in the SCOP. */
+
+static inline void
+store_scattering (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ store_scattering_pbb (pbb);
+}
+
+/* Restores the scattering of PBB. */
+
+static inline void
+restore_scattering_pbb (poly_bb_p pbb)
+{
+ gcc_assert (PBB_SAVED (pbb));
+
+ poly_scattering_free (PBB_TRANSFORMED (pbb));
+ PBB_TRANSFORMED (pbb) = poly_scattering_copy (PBB_SAVED (pbb));
+}
+
+/* Restores the scattering for all the pbbs in the SCOP. */
+
+static inline void
+restore_scattering (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ restore_scattering_pbb (pbb);
+}
+
+#endif
diff --git a/gcc/graphite-ppl.c b/gcc/graphite-ppl.c
new file mode 100644
index 00000000000..ca65c8534b8
--- /dev/null
+++ b/gcc/graphite-ppl.c
@@ -0,0 +1,647 @@
+/* Gimple Represented as Polyhedra.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com>
+ and Tobias Grosser <grosser@fim.uni-passau.de>
+
+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 "ggc.h"
+
+#ifdef HAVE_cloog
+#include "ppl_c.h"
+#include "cloog/cloog.h"
+#include "graphite-ppl.h"
+
+/* Translates row ROW of the CloogMatrix MATRIX to a PPL Constraint. */
+
+static ppl_Constraint_t
+cloog_matrix_to_ppl_constraint (CloogMatrix *matrix, int row)
+{
+ int j;
+ ppl_Constraint_t cstr;
+ ppl_Coefficient_t coef;
+ ppl_Linear_Expression_t expr;
+ ppl_dimension_type dim = matrix->NbColumns - 2;
+
+ ppl_new_Coefficient (&coef);
+ ppl_new_Linear_Expression_with_dimension (&expr, dim);
+
+ for (j = 1; j < matrix->NbColumns - 1; j++)
+ {
+ ppl_assign_Coefficient_from_mpz_t (coef, matrix->p[row][j]);
+ ppl_Linear_Expression_add_to_coefficient (expr, j - 1, coef);
+ }
+
+ ppl_assign_Coefficient_from_mpz_t (coef,
+ matrix->p[row][matrix->NbColumns - 1]);
+ ppl_Linear_Expression_add_to_inhomogeneous (expr, coef);
+ ppl_delete_Coefficient (coef);
+
+ if (value_zero_p (matrix->p[row][0]))
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL);
+ else
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+
+ ppl_delete_Linear_Expression (expr);
+ return cstr;
+}
+
+/* Creates a PPL constraint system from MATRIX. */
+
+static void
+new_Constraint_System_from_Cloog_Matrix (ppl_Constraint_System_t *pcs,
+ CloogMatrix *matrix)
+{
+ int i;
+
+ ppl_new_Constraint_System (pcs);
+
+ for (i = 0; i < matrix->NbRows; i++)
+ {
+ ppl_Constraint_t c = cloog_matrix_to_ppl_constraint (matrix, i);
+ ppl_Constraint_System_insert_Constraint (*pcs, c);
+ ppl_delete_Constraint (c);
+ }
+}
+
+/* Creates a PPL Polyhedron from MATRIX. */
+
+void
+new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *ph,
+ CloogMatrix *matrix)
+{
+ ppl_Constraint_System_t cs;
+ new_Constraint_System_from_Cloog_Matrix (&cs, matrix);
+ ppl_new_C_Polyhedron_recycle_Constraint_System (ph, cs);
+}
+
+/* Counts the number of constraints in PCS. */
+
+static int
+ppl_Constrain_System_number_of_constraints (ppl_const_Constraint_System_t pcs)
+{
+ ppl_Constraint_System_const_iterator_t cit, end;
+ int num = 0;
+
+ ppl_new_Constraint_System_const_iterator (&cit);
+ ppl_new_Constraint_System_const_iterator (&end);
+
+ for (ppl_Constraint_System_begin (pcs, cit),
+ ppl_Constraint_System_end (pcs, end);
+ !ppl_Constraint_System_const_iterator_equal_test (cit, end);
+ ppl_Constraint_System_const_iterator_increment (cit))
+ num++;
+
+ ppl_delete_Constraint_System_const_iterator (cit);
+ ppl_delete_Constraint_System_const_iterator (end);
+ return num;
+}
+
+static void
+oppose_constraint (CloogMatrix *m, int row)
+{
+ int k;
+
+ /* Do not oppose the first column: it is the eq/ineq one. */
+ for (k = 1; k < m->NbColumns; k++)
+ value_oppose (m->p[row][k], m->p[row][k]);
+}
+
+/* Inserts constraint CSTR at row ROW of matrix M. */
+
+void
+insert_constraint_into_matrix (CloogMatrix *m, int row,
+ ppl_const_Constraint_t cstr)
+{
+ ppl_Coefficient_t c;
+ ppl_dimension_type i, dim, nb_cols = m->NbColumns;
+
+ ppl_Constraint_space_dimension (cstr, &dim);
+ ppl_new_Coefficient (&c);
+
+ for (i = 0; i < dim; i++)
+ {
+ ppl_Constraint_coefficient (cstr, i, c);
+ ppl_Coefficient_to_mpz_t (c, m->p[row][i + 1]);
+ }
+
+ for (i = dim; i < nb_cols - 1; i++)
+ value_set_si (m->p[row][i + 1], 0);
+
+ ppl_Constraint_inhomogeneous_term (cstr, c);
+ ppl_Coefficient_to_mpz_t (c, m->p[row][nb_cols - 1]);
+ value_set_si (m->p[row][0], 1);
+
+ switch (ppl_Constraint_type (cstr))
+ {
+ case PPL_CONSTRAINT_TYPE_LESS_THAN:
+ oppose_constraint (m, row);
+ case PPL_CONSTRAINT_TYPE_GREATER_THAN:
+ value_sub_int (m->p[row][nb_cols - 1],
+ m->p[row][nb_cols - 1], 1);
+ break;
+
+ case PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL:
+ oppose_constraint (m, row);
+ case PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL:
+ break;
+
+ case PPL_CONSTRAINT_TYPE_EQUAL:
+ value_set_si (m->p[row][0], 0);
+ break;
+
+ default:
+ /* Not yet implemented. */
+ gcc_unreachable();
+ }
+
+ ppl_delete_Coefficient (c);
+}
+
+/* Creates a CloogMatrix from constraint system PCS. */
+
+static CloogMatrix *
+new_Cloog_Matrix_from_ppl_Constraint_System (ppl_const_Constraint_System_t pcs)
+{
+ CloogMatrix *matrix;
+ ppl_Constraint_System_const_iterator_t cit, end;
+ ppl_dimension_type dim;
+ int rows;
+ int row = 0;
+
+ rows = ppl_Constrain_System_number_of_constraints (pcs);
+ ppl_Constraint_System_space_dimension (pcs, &dim);
+ matrix = cloog_matrix_alloc (rows, dim + 2);
+ ppl_new_Constraint_System_const_iterator (&cit);
+ ppl_new_Constraint_System_const_iterator (&end);
+
+ for (ppl_Constraint_System_begin (pcs, cit),
+ ppl_Constraint_System_end (pcs, end);
+ !ppl_Constraint_System_const_iterator_equal_test (cit, end);
+ ppl_Constraint_System_const_iterator_increment (cit))
+ {
+ ppl_const_Constraint_t c;
+ ppl_Constraint_System_const_iterator_dereference (cit, &c);
+ insert_constraint_into_matrix (matrix, row, c);
+ row++;
+ }
+
+ ppl_delete_Constraint_System_const_iterator (cit);
+ ppl_delete_Constraint_System_const_iterator (end);
+
+ return matrix;
+}
+
+/* Creates a CloogMatrix from polyhedron PH. */
+
+CloogMatrix *
+new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph)
+{
+ ppl_const_Constraint_System_t pcs;
+ CloogMatrix *res;
+
+ ppl_Polyhedron_get_constraints (ph, &pcs);
+ res = new_Cloog_Matrix_from_ppl_Constraint_System (pcs);
+
+ return res;
+}
+
+/* Creates a CloogDomain from polyhedron PH. */
+
+CloogDomain *
+new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t ph)
+{
+ CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph);
+ CloogDomain *res = cloog_domain_matrix2domain (mat);
+ cloog_matrix_free (mat);
+ return res;
+}
+
+/* Creates a CloogDomain from a pointset powerset PS. */
+
+CloogDomain *
+new_Cloog_Domain_from_ppl_Pointset_Powerset (
+ ppl_Pointset_Powerset_C_Polyhedron_t ps)
+{
+ CloogDomain *res = NULL;
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end;
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it);
+ ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end);
+
+ for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it),
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end);
+ !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end);
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it))
+ {
+ ppl_const_Polyhedron_t ph;
+ CloogDomain *tmp;
+
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph);
+ tmp = new_Cloog_Domain_from_ppl_Polyhedron (ph);
+
+ if (res == NULL)
+ res = tmp;
+ else
+ res = cloog_domain_union (res, tmp);
+ }
+
+ ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it);
+ ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
+
+ gcc_assert (res != NULL);
+
+ return res;
+}
+
+/* Set the inhomogeneous term of E to X. */
+
+void
+ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t e, Value x)
+{
+ Value v0, v1;
+ ppl_Coefficient_t c;
+
+ value_init (v0);
+ value_init (v1);
+ ppl_new_Coefficient (&c);
+
+ ppl_Linear_Expression_inhomogeneous_term (e, c);
+ ppl_Coefficient_to_mpz_t (c, v1);
+ value_oppose (v1, v1);
+ value_assign (v0, x);
+ value_addto (v0, v0, v1);
+ ppl_assign_Coefficient_from_mpz_t (c, v0);
+ ppl_Linear_Expression_add_to_inhomogeneous (e, c);
+
+ value_clear (v0);
+ value_clear (v1);
+ ppl_delete_Coefficient (c);
+}
+
+/* Set E[I] to X. */
+
+void
+ppl_set_coef_gmp (ppl_Linear_Expression_t e, ppl_dimension_type i, Value x)
+{
+ Value v0, v1;
+ ppl_Coefficient_t c;
+
+ value_init (v0);
+ value_init (v1);
+ ppl_new_Coefficient (&c);
+
+ ppl_Linear_Expression_coefficient (e, i, c);
+ ppl_Coefficient_to_mpz_t (c, v1);
+ value_oppose (v1, v1);
+ value_assign (v0, x);
+ value_addto (v0, v0, v1);
+ ppl_assign_Coefficient_from_mpz_t (c, v0);
+ ppl_Linear_Expression_add_to_coefficient (e, i, c);
+
+ value_clear (v0);
+ value_clear (v1);
+ ppl_delete_Coefficient (c);
+}
+
+/* Insert after X NB_NEW_DIMS empty dimensions into PH.
+
+ With x = 3 and nb_new_dims = 4
+
+ | d0 d1 d2 d3 d4
+
+ is transformed to
+
+ | d0 d1 d2 x0 x1 x2 x3 d3 d4
+
+ | map = {0, 1, 2, 7, 8, 3, 4, 5, 6}
+*/
+
+void
+ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t ph, int x,
+ int nb_new_dims)
+{
+ ppl_dimension_type i, dim;
+ ppl_dimension_type *map;
+ ppl_dimension_type x_ppl, nb_new_dims_ppl;
+
+ x_ppl = (ppl_dimension_type) x;
+ nb_new_dims_ppl = (ppl_dimension_type) nb_new_dims;
+
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (ph, &dim);
+ ppl_Pointset_Powerset_C_Polyhedron_add_space_dimensions_and_embed (ph, nb_new_dims);
+
+ map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim + nb_new_dims);
+
+ for (i = 0; i < x_ppl; i++)
+ map[i] = i;
+
+ for (i = x_ppl; i < x_ppl + nb_new_dims_ppl; i++)
+ map[dim + i - x_ppl] = i;
+
+ for (i = x_ppl + nb_new_dims_ppl; i < dim + nb_new_dims_ppl; i++)
+ map[i - nb_new_dims_ppl] = i;
+
+ ppl_Pointset_Powerset_C_Polyhedron_map_space_dimensions (ph, map, dim + nb_new_dims);
+ free (map);
+}
+
+/* Insert after X NB_NEW_DIMS empty dimensions into PH.
+
+ With x = 3 and nb_new_dims = 4
+
+ | d0 d1 d2 d3 d4
+
+ is transformed to
+
+ | d0 d1 d2 x0 x1 x2 x3 d3 d4
+
+ | map = {0, 1, 2, 7, 8, 3, 4, 5, 6}
+*/
+
+void
+ppl_insert_dimensions (ppl_Polyhedron_t ph, int x,
+ int nb_new_dims)
+{
+ ppl_dimension_type i, dim;
+ ppl_dimension_type *map;
+ ppl_dimension_type x_ppl, nb_new_dims_ppl;
+
+ x_ppl = (ppl_dimension_type) x;
+ nb_new_dims_ppl = (ppl_dimension_type) nb_new_dims;
+
+ ppl_Polyhedron_space_dimension (ph, &dim);
+ ppl_Polyhedron_add_space_dimensions_and_embed (ph, nb_new_dims);
+
+ map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim + nb_new_dims);
+
+ for (i = 0; i < x_ppl; i++)
+ map[i] = i;
+
+ for (i = x_ppl; i < x_ppl + nb_new_dims_ppl; i++)
+ map[dim + i - x_ppl] = i;
+
+ for (i = x_ppl + nb_new_dims_ppl; i < dim + nb_new_dims_ppl; i++)
+ map[i - nb_new_dims_ppl] = i;
+
+ ppl_Polyhedron_map_space_dimensions (ph, map, dim + nb_new_dims);
+ free (map);
+}
+
+/* Based on the original polyhedron PH, returns a new polyhedron with
+ an extra dimension placed at position LOOP + 1 that slices the
+ dimension LOOP into strips of size STRIDE. */
+
+ppl_Polyhedron_t
+ppl_strip_loop (ppl_Polyhedron_t ph, ppl_dimension_type loop, int stride)
+{
+ ppl_const_Constraint_System_t pcs;
+ ppl_Constraint_System_const_iterator_t cit, end;
+ ppl_const_Constraint_t cstr;
+ ppl_Linear_Expression_t expr;
+ int v;
+ ppl_dimension_type dim;
+ ppl_Polyhedron_t res;
+ ppl_Coefficient_t c;
+ Value val;
+
+ value_init (val);
+ ppl_new_Coefficient (&c);
+
+ ppl_Polyhedron_space_dimension (ph, &dim);
+ ppl_Polyhedron_get_constraints (ph, &pcs);
+
+ /* Start from a copy of the constraints. */
+ ppl_new_C_Polyhedron_from_space_dimension (&res, dim + 1, 0);
+ ppl_Polyhedron_add_constraints (res, pcs);
+
+ /* Add an empty dimension for the strip loop. */
+ ppl_insert_dimensions (res, loop, 1);
+
+ /* Identify the constraints that define the lower and upper bounds
+ of the strip-mined loop, and add them to the strip loop. */
+ {
+ ppl_Polyhedron_t tmp;
+
+ ppl_new_C_Polyhedron_from_space_dimension (&tmp, dim + 1, 0);
+ ppl_new_Constraint_System_const_iterator (&cit);
+ ppl_new_Constraint_System_const_iterator (&end);
+
+ for (ppl_Constraint_System_begin (pcs, cit),
+ ppl_Constraint_System_end (pcs, end);
+ !ppl_Constraint_System_const_iterator_equal_test (cit, end);
+ ppl_Constraint_System_const_iterator_increment (cit))
+ {
+ ppl_Constraint_System_const_iterator_dereference (cit, &cstr);
+ ppl_new_Linear_Expression_from_Constraint (&expr, cstr);
+ ppl_Linear_Expression_coefficient (expr, loop, c);
+ ppl_delete_Linear_Expression (expr);
+ ppl_Coefficient_to_mpz_t (c, val);
+ v = value_get_si (val);
+
+ if (0 < v || v < 0)
+ ppl_Polyhedron_add_constraint (tmp, cstr);
+ }
+ ppl_delete_Constraint_System_const_iterator (cit);
+ ppl_delete_Constraint_System_const_iterator (end);
+
+ ppl_insert_dimensions (tmp, loop + 1, 1);
+ ppl_Polyhedron_get_constraints (tmp, &pcs);
+ ppl_Polyhedron_add_constraints (res, pcs);
+ ppl_delete_Polyhedron (tmp);
+ }
+
+ /* Lower bound of a tile starts at "stride * outer_iv". */
+ {
+ ppl_Constraint_t new_cstr;
+ ppl_new_Linear_Expression_with_dimension (&expr, dim + 1);
+
+ ppl_set_coef (expr, loop + 1, 1);
+ ppl_set_coef (expr, loop, -1 * stride);
+
+ ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_delete_Linear_Expression (expr);
+ ppl_Polyhedron_add_constraint (res, new_cstr);
+ ppl_delete_Constraint (new_cstr);
+ }
+
+ /* Upper bound of a tile stops at "stride * outer_iv + stride - 1",
+ or at the old upper bound that is not modified. */
+ {
+ ppl_Constraint_t new_cstr;
+ ppl_new_Linear_Expression_with_dimension (&expr, dim + 1);
+
+ ppl_set_coef (expr, loop + 1, -1);
+ ppl_set_coef (expr, loop, stride);
+ ppl_set_inhomogeneous (expr, stride - 1);
+
+ ppl_new_Constraint (&new_cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_delete_Linear_Expression (expr);
+ ppl_Polyhedron_add_constraint (res, new_cstr);
+ ppl_delete_Constraint (new_cstr);
+ }
+
+ value_clear (val);
+ ppl_delete_Coefficient (c);
+ return res;
+}
+
+/* Lexicographically compares two linear expressions A and B and
+ returns negative when A < B, 0 when A == B and positive when A > B. */
+
+int
+ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t a,
+ ppl_Linear_Expression_t b)
+{
+ ppl_dimension_type min_length, length1, length2;
+ ppl_dimension_type i;
+ ppl_Coefficient_t c;
+ int res;
+ Value va, vb;
+
+ ppl_Linear_Expression_space_dimension (a, &length1);
+ ppl_Linear_Expression_space_dimension (b, &length2);
+ ppl_new_Coefficient (&c);
+ value_init (va);
+ value_init (vb);
+
+ if (length1 < length2)
+ min_length = length1;
+ else
+ min_length = length2;
+
+ for (i = 0; i < min_length; i++)
+ {
+ ppl_Linear_Expression_coefficient (a, i, c);
+ ppl_Coefficient_to_mpz_t (c, va);
+ ppl_Linear_Expression_coefficient (b, i, c);
+ ppl_Coefficient_to_mpz_t (c, vb);
+ res = value_compare (va, vb);
+
+ if (res == 0)
+ continue;
+
+ value_clear (va);
+ value_clear (vb);
+ ppl_delete_Coefficient (c);
+ return res;
+ }
+
+ value_clear (va);
+ value_clear (vb);
+ ppl_delete_Coefficient (c);
+ return length1 - length2;
+}
+
+/* Print to FILE the polyhedron PH under its PolyLib matrix form. */
+
+void
+ppl_print_polyhedron_matrix (FILE *file, ppl_const_Polyhedron_t ph)
+{
+ CloogMatrix *mat = new_Cloog_Matrix_from_ppl_Polyhedron (ph);
+ cloog_matrix_print (file, mat);
+ cloog_matrix_free (mat);
+}
+
+/* Print to FILE the powerset PS in its PolyLib matrix form. */
+
+void
+ppl_print_powerset_matrix (FILE *file,
+ ppl_Pointset_Powerset_C_Polyhedron_t ps)
+{
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_t it, end;
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&it);
+ ppl_new_Pointset_Powerset_C_Polyhedron_iterator (&end);
+
+ for (ppl_Pointset_Powerset_C_Polyhedron_iterator_begin (ps, it),
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_end (ps, end);
+ !ppl_Pointset_Powerset_C_Polyhedron_iterator_equal_test (it, end);
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_increment (it))
+ {
+ ppl_const_Polyhedron_t ph;
+
+ ppl_Pointset_Powerset_C_Polyhedron_iterator_dereference (it, &ph);
+ ppl_print_polyhedron_matrix (file, ph);
+ }
+
+ ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (it);
+ ppl_delete_Pointset_Powerset_C_Polyhedron_iterator (end);
+}
+
+/* Print to STDERR the polyhedron PH under its PolyLib matrix form. */
+
+void
+debug_ppl_polyhedron_matrix (ppl_Polyhedron_t ph)
+{
+ ppl_print_polyhedron_matrix (stderr, ph);
+}
+
+/* Print to STDERR the powerset PS in its PolyLib matrix form. */
+
+void
+debug_ppl_powerset_matrix (ppl_Pointset_Powerset_C_Polyhedron_t ps)
+{
+ ppl_print_powerset_matrix (stderr, ps);
+}
+
+/* Read from FILE a polyhedron under PolyLib matrix form and return a
+ PPL polyhedron object. */
+
+void
+ppl_read_polyhedron_matrix (ppl_Polyhedron_t *ph, FILE *file)
+{
+ CloogMatrix *mat = cloog_matrix_read (file);
+ new_C_Polyhedron_from_Cloog_Matrix (ph, mat);
+ cloog_matrix_free (mat);
+}
+
+/* Return in RES the maximum of the linear expression LE on polyhedron PS. */
+
+void
+ppl_max_for_le (ppl_Pointset_Powerset_C_Polyhedron_t ps,
+ ppl_Linear_Expression_t le, Value res)
+{
+ ppl_Coefficient_t num, denom;
+ Value dv, nv;
+ int maximum, err;
+
+ value_init (nv);
+ value_init (dv);
+ ppl_new_Coefficient (&num);
+ ppl_new_Coefficient (&denom);
+ err = ppl_Pointset_Powerset_C_Polyhedron_maximize (ps, le, num, denom, &maximum);
+
+ if (err > 0)
+ {
+ ppl_Coefficient_to_mpz_t (num, nv);
+ ppl_Coefficient_to_mpz_t (denom, dv);
+ gcc_assert (value_notzero_p (dv));
+ value_division (res, nv, dv);
+ }
+
+ value_clear (nv);
+ value_clear (dv);
+ ppl_delete_Coefficient (num);
+ ppl_delete_Coefficient (denom);
+}
+
+#endif
diff --git a/gcc/graphite-ppl.h b/gcc/graphite-ppl.h
new file mode 100644
index 00000000000..0ed6b34126d
--- /dev/null
+++ b/gcc/graphite-ppl.h
@@ -0,0 +1,162 @@
+/* Gimple Represented as Polyhedra.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@inria.fr>
+ and Tobias Grosser <grosser@fim.uni-passau.de>.
+
+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/>. */
+#ifndef GCC_GRAPHITE_PPL_H
+#define GCC_GRAPHITE_PPL_H
+
+#include "double-int.h"
+#include "tree.h"
+
+CloogMatrix *new_Cloog_Matrix_from_ppl_Polyhedron (ppl_const_Polyhedron_t);
+CloogDomain *new_Cloog_Domain_from_ppl_Polyhedron (ppl_const_Polyhedron_t);
+CloogDomain * new_Cloog_Domain_from_ppl_Pointset_Powerset (
+ ppl_Pointset_Powerset_C_Polyhedron_t);
+void new_C_Polyhedron_from_Cloog_Matrix (ppl_Polyhedron_t *, CloogMatrix *);
+void insert_constraint_into_matrix (CloogMatrix *, int, ppl_const_Constraint_t);
+ppl_Polyhedron_t ppl_strip_loop (ppl_Polyhedron_t, ppl_dimension_type, int);
+int ppl_lexico_compare_linear_expressions (ppl_Linear_Expression_t,
+ ppl_Linear_Expression_t);
+
+void ppl_print_polyhedron_matrix (FILE *, ppl_const_Polyhedron_t);
+void ppl_print_powerset_matrix (FILE *, ppl_Pointset_Powerset_C_Polyhedron_t);
+void debug_ppl_polyhedron_matrix (ppl_Polyhedron_t);
+void debug_ppl_powerset_matrix (ppl_Pointset_Powerset_C_Polyhedron_t);
+void ppl_read_polyhedron_matrix (ppl_Polyhedron_t *, FILE *);
+void ppl_insert_dimensions (ppl_Polyhedron_t, int, int);
+void ppl_insert_dimensions_pointset (ppl_Pointset_Powerset_C_Polyhedron_t, int,
+ int);
+void ppl_set_inhomogeneous_gmp (ppl_Linear_Expression_t, Value);
+void ppl_set_coef_gmp (ppl_Linear_Expression_t, ppl_dimension_type, Value);
+void ppl_max_for_le (ppl_Pointset_Powerset_C_Polyhedron_t,
+ ppl_Linear_Expression_t, Value);
+
+
+/* Assigns to RES the value of the INTEGER_CST T. */
+
+static inline void
+tree_int_to_gmp (tree t, Value res)
+{
+ double_int di = tree_to_double_int (t);
+ mpz_set_double_int (res, di, TYPE_UNSIGNED (TREE_TYPE (t)));
+}
+
+/* Converts a GMP constant VAL to a tree and returns it. */
+
+static inline tree
+gmp_cst_to_tree (tree type, Value val)
+{
+ tree t = type ? type : integer_type_node;
+ Value tmp;
+ double_int di;
+
+ value_init (tmp);
+ value_assign (tmp, val);
+ di = mpz_get_double_int (t, tmp, true);
+ value_clear (tmp);
+
+ return double_int_to_tree (t, di);
+}
+
+/* Set the inhomogeneous term of E to the integer X. */
+
+static inline void
+ppl_set_inhomogeneous (ppl_Linear_Expression_t e, int x)
+{
+ Value v;
+ value_init (v);
+ value_set_si (v, x);
+ ppl_set_inhomogeneous_gmp (e, v);
+ value_clear (v);
+}
+
+/* Set the inhomogeneous term of E to the tree X. */
+
+static inline void
+ppl_set_inhomogeneous_tree (ppl_Linear_Expression_t e, tree x)
+{
+ Value v;
+ value_init (v);
+ tree_int_to_gmp (x, v);
+ ppl_set_inhomogeneous_gmp (e, v);
+ value_clear (v);
+}
+
+/* Set E[I] to integer X. */
+
+static inline void
+ppl_set_coef (ppl_Linear_Expression_t e, ppl_dimension_type i, int x)
+{
+ Value v;
+ value_init (v);
+ value_set_si (v, x);
+ ppl_set_coef_gmp (e, i, v);
+ value_clear (v);
+}
+
+/* Set E[I] to tree X. */
+
+static inline void
+ppl_set_coef_tree (ppl_Linear_Expression_t e, ppl_dimension_type i, tree x)
+{
+ Value v;
+ value_init (v);
+ tree_int_to_gmp (x, v);
+ ppl_set_coef_gmp (e, i, v);
+ value_clear (v);
+}
+
+/* Sets RES to the max of V1 and V2. */
+
+static inline void
+value_max (Value res, Value v1, Value v2)
+{
+ if (value_compare (v1, v2) < 0)
+ value_assign (res, v2);
+ value_assign (res, v1);
+}
+
+/* Builds a new identity map for dimension DIM. */
+
+static inline ppl_dimension_type *
+ppl_new_id_map (ppl_dimension_type dim)
+{
+ ppl_dimension_type *map, i;
+
+ map = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim);
+
+ for (i = 0; i < dim; i++)
+ map[i] = i;
+
+ return map;
+}
+
+/* Builds an interchange of dimensions A and B in MAP. */
+
+static inline void
+ppl_interchange (ppl_dimension_type *map,
+ ppl_dimension_type a,
+ ppl_dimension_type b)
+{
+ map[a] = b;
+ map[b] = a;
+}
+
+#endif
+
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
new file mode 100644
index 00000000000..60cb95ba724
--- /dev/null
+++ b/gcc/graphite-scop-detection.c
@@ -0,0 +1,1640 @@
+/* Detection of Static Control Parts (SCoP) for Graphite.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Tobias Grosser <grosser@fim.uni-passau.de>.
+
+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 "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "sese.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+#include "graphite-scop-detection.h"
+
+/* The type of the analyzed basic block. */
+
+typedef enum gbb_type {
+ GBB_UNKNOWN,
+ GBB_LOOP_SING_EXIT_HEADER,
+ GBB_LOOP_MULT_EXIT_HEADER,
+ GBB_LOOP_EXIT,
+ GBB_COND_HEADER,
+ GBB_SIMPLE,
+ GBB_LAST
+} gbb_type;
+
+/* Detect the type of BB. Loop headers are only marked, if they are
+ new. This means their loop_father is different to LAST_LOOP.
+ Otherwise they are treated like any other bb and their type can be
+ any other type. */
+
+static gbb_type
+get_bb_type (basic_block bb, struct loop *last_loop)
+{
+ VEC (basic_block, heap) *dom;
+ int nb_dom, nb_suc;
+ struct loop *loop = bb->loop_father;
+
+ /* Check, if we entry into a new loop. */
+ if (loop != last_loop)
+ {
+ if (single_exit (loop) != NULL)
+ return GBB_LOOP_SING_EXIT_HEADER;
+ else if (loop->num != 0)
+ return GBB_LOOP_MULT_EXIT_HEADER;
+ else
+ return GBB_COND_HEADER;
+ }
+
+ dom = get_dominated_by (CDI_DOMINATORS, bb);
+ nb_dom = VEC_length (basic_block, dom);
+ VEC_free (basic_block, heap, dom);
+
+ if (nb_dom == 0)
+ return GBB_LAST;
+
+ nb_suc = VEC_length (edge, bb->succs);
+
+ if (nb_dom == 1 && nb_suc == 1)
+ return GBB_SIMPLE;
+
+ return GBB_COND_HEADER;
+}
+
+/* A SCoP detection region, defined using bbs as borders.
+
+ All control flow touching this region, comes in passing basic_block
+ ENTRY and leaves passing basic_block EXIT. By using bbs instead of
+ edges for the borders we are able to represent also regions that do
+ not have a single entry or exit edge.
+
+ But as they have a single entry basic_block and a single exit
+ basic_block, we are able to generate for every sd_region a single
+ entry and exit edge.
+
+ 1 2
+ \ /
+ 3 <- entry
+ |
+ 4
+ / \ This region contains: {3, 4, 5, 6, 7, 8}
+ 5 6
+ | |
+ 7 8
+ \ /
+ 9 <- exit */
+
+
+typedef struct sd_region_p
+{
+ /* The entry bb dominates all bbs in the sd_region. It is part of
+ the region. */
+ basic_block entry;
+
+ /* The exit bb postdominates all bbs in the sd_region, but is not
+ part of the region. */
+ basic_block exit;
+} sd_region;
+
+DEF_VEC_O(sd_region);
+DEF_VEC_ALLOC_O(sd_region, heap);
+
+
+/* Moves the scops from SOURCE to TARGET and clean up SOURCE. */
+
+static void
+move_sd_regions (VEC (sd_region, heap) **source,
+ VEC (sd_region, heap) **target)
+{
+ sd_region *s;
+ int i;
+
+ for (i = 0; VEC_iterate (sd_region, *source, i, s); i++)
+ VEC_safe_push (sd_region, heap, *target, s);
+
+ VEC_free (sd_region, heap, *source);
+}
+
+/* Something like "n * m" is not allowed. */
+
+static bool
+graphite_can_represent_init (tree e)
+{
+ switch (TREE_CODE (e))
+ {
+ case POLYNOMIAL_CHREC:
+ return graphite_can_represent_init (CHREC_LEFT (e))
+ && graphite_can_represent_init (CHREC_RIGHT (e));
+
+ case MULT_EXPR:
+ if (chrec_contains_symbols (TREE_OPERAND (e, 0)))
+ return host_integerp (TREE_OPERAND (e, 1), 0);
+ else
+ return host_integerp (TREE_OPERAND (e, 0), 0);
+
+ case PLUS_EXPR:
+ case POINTER_PLUS_EXPR:
+ case MINUS_EXPR:
+ return graphite_can_represent_init (TREE_OPERAND (e, 0))
+ && graphite_can_represent_init (TREE_OPERAND (e, 1));
+
+ case NEGATE_EXPR:
+ case BIT_NOT_EXPR:
+ CASE_CONVERT:
+ case NON_LVALUE_EXPR:
+ return graphite_can_represent_init (TREE_OPERAND (e, 0));
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+/* Return true when SCEV can be represented in the polyhedral model.
+
+ An expression can be represented, if it can be expressed as an
+ affine expression. For loops (i, j) and parameters (m, n) all
+ affine expressions are of the form:
+
+ x1 * i + x2 * j + x3 * m + x4 * n + x5 * 1 where x1..x5 element of Z
+
+ 1 i + 20 j + (-2) m + 25
+
+ Something like "i * n" or "n * m" is not allowed.
+
+ OUTERMOST_LOOP defines the outermost loop that can variate. */
+
+static bool
+graphite_can_represent_scev (tree scev, int outermost_loop)
+{
+ if (chrec_contains_undetermined (scev))
+ return false;
+
+ if (TREE_CODE (scev) == POLYNOMIAL_CHREC
+
+ /* Check for constant strides. With a non constant stride of
+ 'n' we would have a value of 'iv * n'. */
+ && (!evolution_function_right_is_integer_cst (scev)
+
+ /* Check the initial value: 'n * m' cannot be represented. */
+ || !graphite_can_represent_init (scev)))
+ return false;
+
+ /* Only affine functions can be represented. */
+ if (!scev_is_linear_expression (scev))
+ return false;
+
+ return evolution_function_is_invariant_p (scev, outermost_loop)
+ || evolution_function_is_affine_multivariate_p (scev, outermost_loop);
+}
+
+
+/* Return true when EXPR can be represented in the polyhedral model.
+
+ This means an expression can be represented, if it is linear with
+ respect to the loops and the strides are non parametric.
+ LOOP is the place where the expr will be evaluated and OUTERMOST_LOOP
+ defindes the outermost loop that can variate. SCOP_ENTRY defines the
+ entry of the region we analyse. */
+
+static bool
+graphite_can_represent_expr (basic_block scop_entry, loop_p loop,
+ loop_p outermost_loop, tree expr)
+{
+ tree scev = analyze_scalar_evolution (loop, expr);
+
+ scev = instantiate_scev (scop_entry, loop, scev);
+
+ return graphite_can_represent_scev (scev, outermost_loop->num);
+}
+
+/* Return false if the tree_code of the operand OP or any of its operands
+ is component_ref. */
+
+static bool
+exclude_component_ref (tree op)
+{
+ int i;
+ int len;
+
+ if (!op)
+ return true;
+
+ if (TREE_CODE (op) == COMPONENT_REF)
+ return false;
+
+ len = TREE_OPERAND_LENGTH (op);
+ for (i = 0; i < len; ++i)
+ if (!exclude_component_ref (TREE_OPERAND (op, i)))
+ return false;
+
+ return true;
+}
+
+/* Return true if the data references of STMT can be represented by
+ Graphite. */
+
+static bool
+stmt_has_simple_data_refs_p (loop_p outermost_loop, gimple stmt)
+{
+ data_reference_p dr;
+ unsigned i;
+ int j;
+ bool res = true;
+ int loop = outermost_loop->num;
+ VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5);
+
+ graphite_find_data_references_in_stmt (outermost_loop, stmt, &drs);
+
+ for (j = 0; VEC_iterate (data_reference_p, drs, j, dr); j++)
+ for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
+ if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i), loop))
+ {
+ res = false;
+ goto done;
+ }
+
+ done:
+ free_data_refs (drs);
+ return res;
+}
+
+/* Return true if we can create an affine data-ref for OP in STMT
+ in regards to OUTERMOST_LOOP. */
+
+static bool
+stmt_simple_memref_p (loop_p outermost_loop, gimple stmt, tree op)
+{
+ data_reference_p dr;
+ unsigned int i;
+ VEC(tree,heap) *fns;
+ tree t;
+ bool res = true;
+
+ dr = create_data_ref (outermost_loop, op, stmt, true);
+ fns = DR_ACCESS_FNS (dr);
+
+ for (i = 0; VEC_iterate (tree, fns, i, t); i++)
+ if (!graphite_can_represent_scev (t, outermost_loop->num))
+ {
+ res = false;
+ break;
+ }
+
+ free_data_ref (dr);
+ return res;
+}
+
+/* Return true if the operand OP used in STMT is simple in regards to
+ OUTERMOST_LOOP. */
+
+static bool
+is_simple_operand (loop_p outermost_loop, gimple stmt, tree op)
+{
+ /* It is not a simple operand when it is a declaration, */
+ if (DECL_P (op))
+ return false;
+
+ /* or a structure, */
+ if (AGGREGATE_TYPE_P (TREE_TYPE (op)))
+ return false;
+
+ /* or a memory access that cannot be analyzed by the data reference
+ analysis. */
+ if (handled_component_p (op) || INDIRECT_REF_P (op))
+ if (!stmt_simple_memref_p (outermost_loop, stmt, op))
+ return false;
+
+ return exclude_component_ref (op);
+}
+
+/* Return true only when STMT is simple enough for being handled by
+ Graphite. This depends on SCOP_ENTRY, as the parameters are
+ initialized relatively to this basic block, the linear functions
+ are initialized to OUTERMOST_LOOP and BB is the place where we try
+ to evaluate the STMT. */
+
+static bool
+stmt_simple_for_scop_p (basic_block scop_entry, loop_p outermost_loop,
+ gimple stmt, basic_block bb)
+{
+ loop_p loop = bb->loop_father;
+
+ gcc_assert (scop_entry);
+
+ /* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
+ Calls have side-effects, except those to const or pure
+ functions. */
+ if (gimple_has_volatile_ops (stmt)
+ || (gimple_code (stmt) == GIMPLE_CALL
+ && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
+ || (gimple_code (stmt) == GIMPLE_ASM))
+ return false;
+
+ if (!stmt_has_simple_data_refs_p (outermost_loop, stmt))
+ return false;
+
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_RETURN:
+ case GIMPLE_LABEL:
+ return true;
+
+ case GIMPLE_COND:
+ {
+ tree op;
+ ssa_op_iter op_iter;
+ enum tree_code code = gimple_cond_code (stmt);
+
+ /* We can handle all binary comparisons. Inequalities are
+ also supported as they can be represented with union of
+ polyhedra. */
+ if (!(code == LT_EXPR
+ || code == GT_EXPR
+ || code == LE_EXPR
+ || code == GE_EXPR
+ || code == EQ_EXPR
+ || code == NE_EXPR))
+ return false;
+
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, op_iter, SSA_OP_ALL_USES)
+ if (!graphite_can_represent_expr (scop_entry, loop, outermost_loop,
+ op)
+ /* We can not handle REAL_TYPE. Failed for pr39260. */
+ || TREE_CODE (TREE_TYPE (op)) == REAL_TYPE)
+ return false;
+
+ return true;
+ }
+
+ case GIMPLE_ASSIGN:
+ {
+ enum tree_code code = gimple_assign_rhs_code (stmt);
+
+ switch (get_gimple_rhs_class (code))
+ {
+ case GIMPLE_UNARY_RHS:
+ case GIMPLE_SINGLE_RHS:
+ return (is_simple_operand (outermost_loop, stmt,
+ gimple_assign_lhs (stmt))
+ && is_simple_operand (outermost_loop, stmt,
+ gimple_assign_rhs1 (stmt)));
+
+ case GIMPLE_BINARY_RHS:
+ return (is_simple_operand (outermost_loop, stmt,
+ gimple_assign_lhs (stmt))
+ && is_simple_operand (outermost_loop, stmt,
+ gimple_assign_rhs1 (stmt))
+ && is_simple_operand (outermost_loop, stmt,
+ gimple_assign_rhs2 (stmt)));
+
+ case GIMPLE_INVALID_RHS:
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ case GIMPLE_CALL:
+ {
+ size_t i;
+ size_t n = gimple_call_num_args (stmt);
+ tree lhs = gimple_call_lhs (stmt);
+
+ if (lhs && !is_simple_operand (outermost_loop, stmt, lhs))
+ return false;
+
+ for (i = 0; i < n; i++)
+ if (!is_simple_operand (outermost_loop, stmt,
+ gimple_call_arg (stmt, i)))
+ return false;
+
+ return true;
+ }
+
+ default:
+ /* These nodes cut a new scope. */
+ return false;
+ }
+
+ return false;
+}
+
+/* Returns the statement of BB that contains a harmful operation: that
+ can be a function call with side effects, the induction variables
+ are not linear with respect to SCOP_ENTRY, etc. The current open
+ scop should end before this statement. The evaluation is limited using
+ OUTERMOST_LOOP as outermost loop that may change. */
+
+static gimple
+harmful_stmt_in_bb (basic_block scop_entry, loop_p outer_loop, basic_block bb)
+{
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (!stmt_simple_for_scop_p (scop_entry, outer_loop, gsi_stmt (gsi), bb))
+ return gsi_stmt (gsi);
+
+ return NULL;
+}
+
+/* Return true when it is not possible to represent LOOP in the
+ polyhedral representation. This is evaluated taking SCOP_ENTRY and
+ OUTERMOST_LOOP in mind. */
+
+static bool
+graphite_can_represent_loop (basic_block scop_entry, loop_p outermost_loop,
+ loop_p loop)
+{
+ tree niter = number_of_latch_executions (loop);
+
+ /* Number of iterations unknown. */
+ if (chrec_contains_undetermined (niter))
+ return false;
+
+ /* Number of iterations not affine. */
+ if (!graphite_can_represent_expr (scop_entry, loop, outermost_loop, niter))
+ return false;
+
+ return true;
+}
+
+/* Store information needed by scopdet_* functions. */
+
+struct scopdet_info
+{
+ /* Exit of the open scop would stop if the current BB is harmful. */
+ basic_block exit;
+
+ /* Where the next scop would start if the current BB is harmful. */
+ basic_block next;
+
+ /* The bb or one of its children contains open loop exits. That means
+ loop exit nodes that are not surrounded by a loop dominated by bb. */
+ bool exits;
+
+ /* The bb or one of its children contains only structures we can handle. */
+ bool difficult;
+};
+
+static struct scopdet_info build_scops_1 (basic_block, loop_p,
+ VEC (sd_region, heap) **, loop_p);
+
+/* Calculates BB infos. If bb is difficult we add valid SCoPs dominated by BB
+ to SCOPS. TYPE is the gbb_type of BB. */
+
+static struct scopdet_info
+scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
+ VEC (sd_region, heap) **scops, gbb_type type)
+{
+ loop_p loop = bb->loop_father;
+ struct scopdet_info result;
+ gimple stmt;
+
+ /* XXX: ENTRY_BLOCK_PTR could be optimized in later steps. */
+ basic_block entry_block = ENTRY_BLOCK_PTR;
+ stmt = harmful_stmt_in_bb (entry_block, outermost_loop, bb);
+ result.difficult = (stmt != NULL);
+ result.exit = NULL;
+
+ switch (type)
+ {
+ case GBB_LAST:
+ result.next = NULL;
+ result.exits = false;
+
+ /* Mark bbs terminating a SESE region difficult, if they start
+ a condition. */
+ if (!single_succ_p (bb))
+ result.difficult = true;
+ else
+ result.exit = single_succ (bb);
+
+ break;
+
+ case GBB_SIMPLE:
+ result.next = single_succ (bb);
+ result.exits = false;
+ result.exit = single_succ (bb);
+ break;
+
+ case GBB_LOOP_SING_EXIT_HEADER:
+ {
+ VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
+ struct scopdet_info sinfo;
+ edge exit_e = single_exit (loop);
+
+ sinfo = build_scops_1 (bb, outermost_loop, &regions, loop);
+
+ if (!graphite_can_represent_loop (entry_block, outermost_loop, loop))
+ result.difficult = true;
+
+ result.difficult |= sinfo.difficult;
+
+ /* Try again with another loop level. */
+ if (result.difficult
+ && loop_depth (outermost_loop) + 1 == loop_depth (loop))
+ {
+ outermost_loop = loop;
+
+ VEC_free (sd_region, heap, regions);
+ regions = VEC_alloc (sd_region, heap, 3);
+
+ sinfo = scopdet_basic_block_info (bb, outermost_loop, scops, type);
+
+ result = sinfo;
+ result.difficult = true;
+
+ if (sinfo.difficult)
+ move_sd_regions (&regions, scops);
+ else
+ {
+ sd_region open_scop;
+ open_scop.entry = bb;
+ open_scop.exit = exit_e->dest;
+ VEC_safe_push (sd_region, heap, *scops, &open_scop);
+ VEC_free (sd_region, heap, regions);
+ }
+ }
+ else
+ {
+ result.exit = exit_e->dest;
+ result.next = exit_e->dest;
+
+ /* If we do not dominate result.next, remove it. It's either
+ the EXIT_BLOCK_PTR, or another bb dominates it and will
+ call the scop detection for this bb. */
+ if (!dominated_by_p (CDI_DOMINATORS, result.next, bb))
+ result.next = NULL;
+
+ if (exit_e->src->loop_father != loop)
+ result.next = NULL;
+
+ result.exits = false;
+
+ if (result.difficult)
+ move_sd_regions (&regions, scops);
+ else
+ VEC_free (sd_region, heap, regions);
+ }
+
+ break;
+ }
+
+ case GBB_LOOP_MULT_EXIT_HEADER:
+ {
+ /* XXX: For now we just do not join loops with multiple exits. If the
+ exits lead to the same bb it may be possible to join the loop. */
+ VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
+ VEC (edge, heap) *exits = get_loop_exit_edges (loop);
+ edge e;
+ int i;
+ build_scops_1 (bb, loop, &regions, loop);
+
+ /* Scan the code dominated by this loop. This means all bbs, that are
+ are dominated by a bb in this loop, but are not part of this loop.
+
+ The easiest case:
+ - The loop exit destination is dominated by the exit sources.
+
+ TODO: We miss here the more complex cases:
+ - The exit destinations are dominated by another bb inside
+ the loop.
+ - The loop dominates bbs, that are not exit destinations. */
+ for (i = 0; VEC_iterate (edge, exits, i, e); i++)
+ if (e->src->loop_father == loop
+ && dominated_by_p (CDI_DOMINATORS, e->dest, e->src))
+ {
+ if (loop_outer (outermost_loop))
+ outermost_loop = loop_outer (outermost_loop);
+
+ /* Pass loop_outer to recognize e->dest as loop header in
+ build_scops_1. */
+ if (e->dest->loop_father->header == e->dest)
+ build_scops_1 (e->dest, outermost_loop, &regions,
+ loop_outer (e->dest->loop_father));
+ else
+ build_scops_1 (e->dest, outermost_loop, &regions,
+ e->dest->loop_father);
+ }
+
+ result.next = NULL;
+ result.exit = NULL;
+ result.difficult = true;
+ result.exits = false;
+ move_sd_regions (&regions, scops);
+ VEC_free (edge, heap, exits);
+ break;
+ }
+ case GBB_COND_HEADER:
+ {
+ VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
+ struct scopdet_info sinfo;
+ VEC (basic_block, heap) *dominated;
+ int i;
+ basic_block dom_bb;
+ basic_block last_exit = NULL;
+ edge e;
+ result.exits = false;
+
+ /* First check the successors of BB, and check if it is
+ possible to join the different branches. */
+ for (i = 0; VEC_iterate (edge, bb->succs, i, e); i++)
+ {
+ /* Ignore loop exits. They will be handled after the loop
+ body. */
+ if (is_loop_exit (loop, e->dest))
+ {
+ result.exits = true;
+ continue;
+ }
+
+ /* Do not follow edges that lead to the end of the
+ conditions block. For example, in
+
+ | 0
+ | /|\
+ | 1 2 |
+ | | | |
+ | 3 4 |
+ | \|/
+ | 6
+
+ the edge from 0 => 6. Only check if all paths lead to
+ the same node 6. */
+
+ if (!single_pred_p (e->dest))
+ {
+ /* Check, if edge leads directly to the end of this
+ condition. */
+ if (!last_exit)
+ last_exit = e->dest;
+
+ if (e->dest != last_exit)
+ result.difficult = true;
+
+ continue;
+ }
+
+ if (!dominated_by_p (CDI_DOMINATORS, e->dest, bb))
+ {
+ result.difficult = true;
+ continue;
+ }
+
+ sinfo = build_scops_1 (e->dest, outermost_loop, &regions, loop);
+
+ result.exits |= sinfo.exits;
+ result.difficult |= sinfo.difficult;
+
+ /* Checks, if all branches end at the same point.
+ If that is true, the condition stays joinable.
+ Have a look at the example above. */
+ if (sinfo.exit)
+ {
+ if (!last_exit)
+ last_exit = sinfo.exit;
+
+ if (sinfo.exit != last_exit)
+ result.difficult = true;
+ }
+ else
+ result.difficult = true;
+ }
+
+ if (!last_exit)
+ result.difficult = true;
+
+ /* Join the branches of the condition if possible. */
+ if (!result.exits && !result.difficult)
+ {
+ /* Only return a next pointer if we dominate this pointer.
+ Otherwise it will be handled by the bb dominating it. */
+ if (dominated_by_p (CDI_DOMINATORS, last_exit, bb)
+ && last_exit != bb)
+ result.next = last_exit;
+ else
+ result.next = NULL;
+
+ result.exit = last_exit;
+
+ VEC_free (sd_region, heap, regions);
+ break;
+ }
+
+ /* Scan remaining bbs dominated by BB. */
+ dominated = get_dominated_by (CDI_DOMINATORS, bb);
+
+ for (i = 0; VEC_iterate (basic_block, dominated, i, dom_bb); i++)
+ {
+ /* Ignore loop exits: they will be handled after the loop body. */
+ if (loop_depth (find_common_loop (loop, dom_bb->loop_father))
+ < loop_depth (loop))
+ {
+ result.exits = true;
+ continue;
+ }
+
+ /* Ignore the bbs processed above. */
+ if (single_pred_p (dom_bb) && single_pred (dom_bb) == bb)
+ continue;
+
+ if (loop_depth (loop) > loop_depth (dom_bb->loop_father))
+ sinfo = build_scops_1 (dom_bb, outermost_loop, &regions,
+ loop_outer (loop));
+ else
+ sinfo = build_scops_1 (dom_bb, outermost_loop, &regions, loop);
+
+ result.exits |= sinfo.exits;
+ result.difficult = true;
+ result.exit = NULL;
+ }
+
+ VEC_free (basic_block, heap, dominated);
+
+ result.next = NULL;
+ move_sd_regions (&regions, scops);
+
+ break;
+ }
+
+ default:
+ gcc_unreachable ();
+ }
+
+ return result;
+}
+
+/* Starting from CURRENT we walk the dominance tree and add new sd_regions to
+ SCOPS. The analyse if a sd_region can be handled is based on the value
+ of OUTERMOST_LOOP. Only loops inside OUTERMOST loops may change. LOOP
+ is the loop in which CURRENT is handled.
+
+ TODO: These functions got a little bit big. They definitely should be cleaned
+ up. */
+
+static struct scopdet_info
+build_scops_1 (basic_block current, loop_p outermost_loop,
+ VEC (sd_region, heap) **scops, loop_p loop)
+{
+ bool in_scop = false;
+ sd_region open_scop;
+ struct scopdet_info sinfo;
+
+ /* Initialize result. */
+ struct scopdet_info result;
+ result.exits = false;
+ result.difficult = false;
+ result.next = NULL;
+ result.exit = NULL;
+ open_scop.entry = NULL;
+ open_scop.exit = NULL;
+ sinfo.exit = NULL;
+
+ /* Loop over the dominance tree. If we meet a difficult bb, close
+ the current SCoP. Loop and condition header start a new layer,
+ and can only be added if all bbs in deeper layers are simple. */
+ while (current != NULL)
+ {
+ sinfo = scopdet_basic_block_info (current, outermost_loop, scops,
+ get_bb_type (current, loop));
+
+ if (!in_scop && !(sinfo.exits || sinfo.difficult))
+ {
+ open_scop.entry = current;
+ open_scop.exit = NULL;
+ in_scop = true;
+ }
+ else if (in_scop && (sinfo.exits || sinfo.difficult))
+ {
+ open_scop.exit = current;
+ VEC_safe_push (sd_region, heap, *scops, &open_scop);
+ in_scop = false;
+ }
+
+ result.difficult |= sinfo.difficult;
+ result.exits |= sinfo.exits;
+
+ current = sinfo.next;
+ }
+
+ /* Try to close open_scop, if we are still in an open SCoP. */
+ if (in_scop)
+ {
+ open_scop.exit = sinfo.exit;
+ gcc_assert (open_scop.exit);
+ VEC_safe_push (sd_region, heap, *scops, &open_scop);
+ }
+
+ result.exit = sinfo.exit;
+ return result;
+}
+
+/* Checks if a bb is contained in REGION. */
+
+static bool
+bb_in_sd_region (basic_block bb, sd_region *region)
+{
+ return bb_in_region (bb, region->entry, region->exit);
+}
+
+/* Returns the single entry edge of REGION, if it does not exits NULL. */
+
+static edge
+find_single_entry_edge (sd_region *region)
+{
+ edge e;
+ edge_iterator ei;
+ edge entry = NULL;
+
+ FOR_EACH_EDGE (e, ei, region->entry->preds)
+ if (!bb_in_sd_region (e->src, region))
+ {
+ if (entry)
+ {
+ entry = NULL;
+ break;
+ }
+
+ else
+ entry = e;
+ }
+
+ return entry;
+}
+
+/* Returns the single exit edge of REGION, if it does not exits NULL. */
+
+static edge
+find_single_exit_edge (sd_region *region)
+{
+ edge e;
+ edge_iterator ei;
+ edge exit = NULL;
+
+ FOR_EACH_EDGE (e, ei, region->exit->preds)
+ if (bb_in_sd_region (e->src, region))
+ {
+ if (exit)
+ {
+ exit = NULL;
+ break;
+ }
+
+ else
+ exit = e;
+ }
+
+ return exit;
+}
+
+/* Create a single entry edge for REGION. */
+
+static void
+create_single_entry_edge (sd_region *region)
+{
+ if (find_single_entry_edge (region))
+ return;
+
+ /* There are multiple predecessors for bb_3
+
+ | 1 2
+ | | /
+ | |/
+ | 3 <- entry
+ | |\
+ | | |
+ | 4 ^
+ | | |
+ | |/
+ | 5
+
+ There are two edges (1->3, 2->3), that point from outside into the region,
+ and another one (5->3), a loop latch, lead to bb_3.
+
+ We split bb_3.
+
+ | 1 2
+ | | /
+ | |/
+ |3.0
+ | |\ (3.0 -> 3.1) = single entry edge
+ |3.1 | <- entry
+ | | |
+ | | |
+ | 4 ^
+ | | |
+ | |/
+ | 5
+
+ If the loop is part of the SCoP, we have to redirect the loop latches.
+
+ | 1 2
+ | | /
+ | |/
+ |3.0
+ | | (3.0 -> 3.1) = entry edge
+ |3.1 <- entry
+ | |\
+ | | |
+ | 4 ^
+ | | |
+ | |/
+ | 5 */
+
+ if (region->entry->loop_father->header != region->entry
+ || dominated_by_p (CDI_DOMINATORS,
+ loop_latch_edge (region->entry->loop_father)->src,
+ region->exit))
+ {
+ edge forwarder = split_block_after_labels (region->entry);
+ region->entry = forwarder->dest;
+ }
+ else
+ /* This case is never executed, as the loop headers seem always to have a
+ single edge pointing from outside into the loop. */
+ gcc_unreachable ();
+
+#ifdef ENABLE_CHECKING
+ gcc_assert (find_single_entry_edge (region));
+#endif
+}
+
+/* Check if the sd_region, mentioned in EDGE, has no exit bb. */
+
+static bool
+sd_region_without_exit (edge e)
+{
+ sd_region *r = (sd_region *) e->aux;
+
+ if (r)
+ return r->exit == NULL;
+ else
+ return false;
+}
+
+/* Create a single exit edge for REGION. */
+
+static void
+create_single_exit_edge (sd_region *region)
+{
+ edge e;
+ edge_iterator ei;
+ edge forwarder = NULL;
+ basic_block exit;
+
+ if (find_single_exit_edge (region))
+ return;
+
+ /* We create a forwarder bb (5) for all edges leaving this region
+ (3->5, 4->5). All other edges leading to the same bb, are moved
+ to a new bb (6). If these edges where part of another region (2->5)
+ we update the region->exit pointer, of this region.
+
+ To identify which edge belongs to which region we depend on the e->aux
+ pointer in every edge. It points to the region of the edge or to NULL,
+ if the edge is not part of any region.
+
+ 1 2 3 4 1->5 no region, 2->5 region->exit = 5,
+ \| |/ 3->5 region->exit = NULL, 4->5 region->exit = NULL
+ 5 <- exit
+
+ changes to
+
+ 1 2 3 4 1->6 no region, 2->6 region->exit = 6,
+ | | \/ 3->5 no region, 4->5 no region,
+ | | 5
+ \| / 5->6 region->exit = 6
+ 6
+
+ Now there is only a single exit edge (5->6). */
+ exit = region->exit;
+ region->exit = NULL;
+ forwarder = make_forwarder_block (exit, &sd_region_without_exit, NULL);
+
+ /* Unmark the edges, that are no longer exit edges. */
+ FOR_EACH_EDGE (e, ei, forwarder->src->preds)
+ if (e->aux)
+ e->aux = NULL;
+
+ /* Mark the new exit edge. */
+ single_succ_edge (forwarder->src)->aux = region;
+
+ /* Update the exit bb of all regions, where exit edges lead to
+ forwarder->dest. */
+ FOR_EACH_EDGE (e, ei, forwarder->dest->preds)
+ if (e->aux)
+ ((sd_region *) e->aux)->exit = forwarder->dest;
+
+#ifdef ENABLE_CHECKING
+ gcc_assert (find_single_exit_edge (region));
+#endif
+}
+
+/* Unmark the exit edges of all REGIONS.
+ See comment in "create_single_exit_edge". */
+
+static void
+unmark_exit_edges (VEC (sd_region, heap) *regions)
+{
+ int i;
+ sd_region *s;
+ edge e;
+ edge_iterator ei;
+
+ for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_EDGE (e, ei, s->exit->preds)
+ e->aux = NULL;
+}
+
+
+/* Mark the exit edges of all REGIONS.
+ See comment in "create_single_exit_edge". */
+
+static void
+mark_exit_edges (VEC (sd_region, heap) *regions)
+{
+ int i;
+ sd_region *s;
+ edge e;
+ edge_iterator ei;
+
+ for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ FOR_EACH_EDGE (e, ei, s->exit->preds)
+ if (bb_in_sd_region (e->src, s))
+ e->aux = s;
+}
+
+/* Create for all scop regions a single entry and a single exit edge. */
+
+static void
+create_sese_edges (VEC (sd_region, heap) *regions)
+{
+ int i;
+ sd_region *s;
+
+ for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ create_single_entry_edge (s);
+
+ mark_exit_edges (regions);
+
+ for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ create_single_exit_edge (s);
+
+ unmark_exit_edges (regions);
+
+ fix_loop_structure (NULL);
+
+#ifdef ENABLE_CHECKING
+ verify_loop_structure ();
+ verify_dominators (CDI_DOMINATORS);
+ verify_ssa (false);
+#endif
+}
+
+/* Create graphite SCoPs from an array of scop detection REGIONS. */
+
+static void
+build_graphite_scops (VEC (sd_region, heap) *regions,
+ VEC (scop_p, heap) **scops)
+{
+ int i;
+ sd_region *s;
+
+ for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
+ {
+ edge entry = find_single_entry_edge (s);
+ edge exit = find_single_exit_edge (s);
+ scop_p scop = new_scop (new_sese (entry, exit));
+ VEC_safe_push (scop_p, heap, *scops, scop);
+
+ /* Are there overlapping SCoPs? */
+#ifdef ENABLE_CHECKING
+ {
+ int j;
+ sd_region *s2;
+
+ for (j = 0; VEC_iterate (sd_region, regions, j, s2); j++)
+ if (s != s2)
+ gcc_assert (!bb_in_sd_region (s->entry, s2));
+ }
+#endif
+ }
+}
+
+/* Returns true when BB contains only close phi nodes. */
+
+static bool
+contains_only_close_phi_nodes (basic_block bb)
+{
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL)
+ return false;
+
+ return true;
+}
+
+/* Print statistics for SCOP to FILE. */
+
+static void
+print_graphite_scop_statistics (FILE* file, scop_p scop)
+{
+ long n_bbs = 0;
+ long n_loops = 0;
+ long n_stmts = 0;
+ long n_conditions = 0;
+ long n_p_bbs = 0;
+ long n_p_loops = 0;
+ long n_p_stmts = 0;
+ long n_p_conditions = 0;
+
+ basic_block bb;
+
+ FOR_ALL_BB (bb)
+ {
+ gimple_stmt_iterator psi;
+ loop_p loop = bb->loop_father;
+
+ if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
+ continue;
+
+ n_bbs++;
+ n_p_bbs += bb->count;
+
+ if (VEC_length (edge, bb->succs) > 1)
+ {
+ n_conditions++;
+ n_p_conditions += bb->count;
+ }
+
+ for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
+ {
+ n_stmts++;
+ n_p_stmts += bb->count;
+ }
+
+ if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop)))
+ {
+ n_loops++;
+ n_p_loops += bb->count;
+ }
+
+ }
+
+ fprintf (file, "\nBefore limit_scops SCoP statistics (");
+ fprintf (file, "BBS:%ld, ", n_bbs);
+ fprintf (file, "LOOPS:%ld, ", n_loops);
+ fprintf (file, "CONDITIONS:%ld, ", n_conditions);
+ fprintf (file, "STMTS:%ld)\n", n_stmts);
+ fprintf (file, "\nBefore limit_scops SCoP profiling statistics (");
+ fprintf (file, "BBS:%ld, ", n_p_bbs);
+ fprintf (file, "LOOPS:%ld, ", n_p_loops);
+ fprintf (file, "CONDITIONS:%ld, ", n_p_conditions);
+ fprintf (file, "STMTS:%ld)\n", n_p_stmts);
+}
+
+/* Print statistics for SCOPS to FILE. */
+
+static void
+print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
+{
+ int i;
+ scop_p scop;
+
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ print_graphite_scop_statistics (file, scop);
+}
+
+/* Version of free_scops special cased for limit_scops. */
+
+static void
+free_scops_1 (VEC (scop_p, heap) **scops)
+{
+ int i;
+ scop_p scop;
+
+ for (i = 0; VEC_iterate (scop_p, *scops, i, scop); i++)
+ {
+ sese region = SCOP_REGION (scop);
+ free (SESE_PARAMS_NAMES (region));
+ SESE_PARAMS_NAMES (region) = 0;
+ }
+
+ free_scops (*scops);
+}
+
+/* We limit all SCoPs to SCoPs, that are completely surrounded by a loop.
+
+ Example:
+
+ for (i |
+ { |
+ for (j | SCoP 1
+ for (k |
+ } |
+
+ * SCoP frontier, as this line is not surrounded by any loop. *
+
+ for (l | SCoP 2
+
+ This is necessary as scalar evolution and parameter detection need a
+ outermost loop to initialize parameters correctly.
+
+ TODO: FIX scalar evolution and parameter detection to allow more flexible
+ SCoP frontiers. */
+
+static void
+limit_scops (VEC (scop_p, heap) **scops)
+{
+ VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
+
+ int i;
+ scop_p scop;
+
+ for (i = 0; VEC_iterate (scop_p, *scops, i, scop); i++)
+ {
+ int j;
+ loop_p loop;
+ sese region = SCOP_REGION (scop);
+ build_scop_bbs (scop);
+ build_sese_loop_nests (region);
+
+ for (j = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), j, loop); j++)
+ if (!loop_in_sese_p (loop_outer (loop), region)
+ && single_exit (loop))
+ {
+ sd_region open_scop;
+ open_scop.entry = loop->header;
+ open_scop.exit = single_exit (loop)->dest;
+
+ /* This is a hack on top of the limit_scops hack. The
+ limit_scops hack should disappear all together. */
+ if (single_succ_p (open_scop.exit)
+ && contains_only_close_phi_nodes (open_scop.exit))
+ open_scop.exit = single_succ_edge (open_scop.exit)->dest;
+
+ VEC_safe_push (sd_region, heap, regions, &open_scop);
+ }
+ }
+
+ free_scops_1 (scops);
+ *scops = VEC_alloc (scop_p, heap, 3);
+
+ create_sese_edges (regions);
+ build_graphite_scops (regions, scops);
+ VEC_free (sd_region, heap, regions);
+}
+
+/* Transforms LOOP to the canonical loop closed SSA form. */
+
+static void
+canonicalize_loop_closed_ssa (loop_p loop)
+{
+ edge e = single_exit (loop);
+ basic_block bb;
+
+ if (!e || e->flags & EDGE_ABNORMAL)
+ return;
+
+ bb = e->dest;
+
+ if (VEC_length (edge, bb->preds) == 1)
+ split_block_after_labels (bb);
+ else
+ {
+ gimple_stmt_iterator psi;
+ basic_block close = split_edge (e);
+
+ e = single_succ_edge (close);
+
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
+ {
+ gimple phi = gsi_stmt (psi);
+ unsigned i;
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (gimple_phi_arg_edge (phi, i) == e)
+ {
+ tree res, arg = gimple_phi_arg_def (phi, i);
+ use_operand_p use_p;
+ gimple close_phi;
+
+ if (TREE_CODE (arg) != SSA_NAME)
+ continue;
+
+ close_phi = create_phi_node (arg, close);
+ res = create_new_def_for (gimple_phi_result (close_phi),
+ close_phi,
+ gimple_phi_result_ptr (close_phi));
+ add_phi_arg (close_phi, arg,
+ gimple_phi_arg_edge (close_phi, 0),
+ UNKNOWN_LOCATION);
+ use_p = gimple_phi_arg_imm_use_ptr (phi, i);
+ replace_exp (use_p, res);
+ update_stmt (phi);
+ }
+ }
+ }
+}
+
+/* Converts the current loop closed SSA form to a canonical form
+ expected by the Graphite code generation.
+
+ The loop closed SSA form has the following invariant: a variable
+ defined in a loop that is used outside the loop appears only in the
+ phi nodes in the destination of the loop exit. These phi nodes are
+ called close phi nodes.
+
+ The canonical loop closed SSA form contains the extra invariants:
+
+ - when the loop contains only one exit, the close phi nodes contain
+ only one argument. That implies that the basic block that contains
+ the close phi nodes has only one predecessor, that is a basic block
+ in the loop.
+
+ - the basic block containing the close phi nodes does not contain
+ other statements.
+*/
+
+static void
+canonicalize_loop_closed_ssa_form (void)
+{
+ loop_iterator li;
+ loop_p loop;
+
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+
+ FOR_EACH_LOOP (li, loop, 0)
+ canonicalize_loop_closed_ssa (loop);
+
+ rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
+ update_ssa (TODO_update_ssa);
+
+#ifdef ENABLE_CHECKING
+ verify_loop_closed_ssa ();
+#endif
+}
+
+/* Find Static Control Parts (SCoP) in the current function and pushes
+ them to SCOPS. */
+
+void
+build_scops (VEC (scop_p, heap) **scops)
+{
+ struct loop *loop = current_loops->tree_root;
+ VEC (sd_region, heap) *regions = VEC_alloc (sd_region, heap, 3);
+
+ canonicalize_loop_closed_ssa_form ();
+ build_scops_1 (single_succ (ENTRY_BLOCK_PTR), ENTRY_BLOCK_PTR->loop_father,
+ &regions, loop);
+ create_sese_edges (regions);
+ build_graphite_scops (regions, scops);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ print_graphite_statistics (dump_file, *scops);
+
+ limit_scops (scops);
+ VEC_free (sd_region, heap, regions);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "\nnumber of SCoPs: %d\n",
+ VEC_length (scop_p, *scops));
+}
+
+/* Pretty print all SCoPs in DOT format and mark them with different colors.
+ If there are not enough colors, paint later SCoPs gray.
+ Special nodes:
+ - "*" after the node number: entry of a SCoP,
+ - "#" after the node number: exit of a SCoP,
+ - "()" entry or exit not part of SCoP. */
+
+static void
+dot_all_scops_1 (FILE *file, VEC (scop_p, heap) *scops)
+{
+ basic_block bb;
+ edge e;
+ edge_iterator ei;
+ scop_p scop;
+ const char* color;
+ int i;
+
+ /* Disable debugging while printing graph. */
+ int tmp_dump_flags = dump_flags;
+ dump_flags = 0;
+
+ fprintf (file, "digraph all {\n");
+
+ FOR_ALL_BB (bb)
+ {
+ int part_of_scop = false;
+
+ /* Use HTML for every bb label. So we are able to print bbs
+ which are part of two different SCoPs, with two different
+ background colors. */
+ fprintf (file, "%d [label=<\n <TABLE BORDER=\"0\" CELLBORDER=\"1\" ",
+ bb->index);
+ fprintf (file, "CELLSPACING=\"0\">\n");
+
+ /* Select color for SCoP. */
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ {
+ sese region = SCOP_REGION (scop);
+ if (bb_in_sese_p (bb, region)
+ || (SESE_EXIT_BB (region) == bb)
+ || (SESE_ENTRY_BB (region) == bb))
+ {
+ switch (i % 17)
+ {
+ case 0: /* red */
+ color = "#e41a1c";
+ break;
+ case 1: /* blue */
+ color = "#377eb8";
+ break;
+ case 2: /* green */
+ color = "#4daf4a";
+ break;
+ case 3: /* purple */
+ color = "#984ea3";
+ break;
+ case 4: /* orange */
+ color = "#ff7f00";
+ break;
+ case 5: /* yellow */
+ color = "#ffff33";
+ break;
+ case 6: /* brown */
+ color = "#a65628";
+ break;
+ case 7: /* rose */
+ color = "#f781bf";
+ break;
+ case 8:
+ color = "#8dd3c7";
+ break;
+ case 9:
+ color = "#ffffb3";
+ break;
+ case 10:
+ color = "#bebada";
+ break;
+ case 11:
+ color = "#fb8072";
+ break;
+ case 12:
+ color = "#80b1d3";
+ break;
+ case 13:
+ color = "#fdb462";
+ break;
+ case 14:
+ color = "#b3de69";
+ break;
+ case 15:
+ color = "#fccde5";
+ break;
+ case 16:
+ color = "#bc80bd";
+ break;
+ default: /* gray */
+ color = "#999999";
+ }
+
+ fprintf (file, " <TR><TD WIDTH=\"50\" BGCOLOR=\"%s\">", color);
+
+ if (!bb_in_sese_p (bb, region))
+ fprintf (file, " (");
+
+ if (bb == SESE_ENTRY_BB (region)
+ && bb == SESE_EXIT_BB (region))
+ fprintf (file, " %d*# ", bb->index);
+ else if (bb == SESE_ENTRY_BB (region))
+ fprintf (file, " %d* ", bb->index);
+ else if (bb == SESE_EXIT_BB (region))
+ fprintf (file, " %d# ", bb->index);
+ else
+ fprintf (file, " %d ", bb->index);
+
+ if (!bb_in_sese_p (bb,region))
+ fprintf (file, ")");
+
+ fprintf (file, "</TD></TR>\n");
+ part_of_scop = true;
+ }
+ }
+
+ if (!part_of_scop)
+ {
+ fprintf (file, " <TR><TD WIDTH=\"50\" BGCOLOR=\"#ffffff\">");
+ fprintf (file, " %d </TD></TR>\n", bb->index);
+ }
+ fprintf (file, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
+ }
+
+ FOR_ALL_BB (bb)
+ {
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
+ }
+
+ fputs ("}\n\n", file);
+
+ /* Enable debugging again. */
+ dump_flags = tmp_dump_flags;
+}
+
+/* Display all SCoPs using dotty. */
+
+void
+dot_all_scops (VEC (scop_p, heap) *scops)
+{
+ /* When debugging, enable the following code. This cannot be used
+ in production compilers because it calls "system". */
+#if 0
+ int x;
+ FILE *stream = fopen ("/tmp/allscops.dot", "w");
+ gcc_assert (stream);
+
+ dot_all_scops_1 (stream, scops);
+ fclose (stream);
+
+ x = system ("dotty /tmp/allscops.dot");
+#else
+ dot_all_scops_1 (stderr, scops);
+#endif
+}
+
+/* Display all SCoPs using dotty. */
+
+void
+dot_scop (scop_p scop)
+{
+ VEC (scop_p, heap) *scops = NULL;
+
+ if (scop)
+ VEC_safe_push (scop_p, heap, scops, scop);
+
+ /* When debugging, enable the following code. This cannot be used
+ in production compilers because it calls "system". */
+#if 0
+ {
+ int x;
+ FILE *stream = fopen ("/tmp/allscops.dot", "w");
+ gcc_assert (stream);
+
+ dot_all_scops_1 (stream, scops);
+ fclose (stream);
+ x = system ("dotty /tmp/allscops.dot");
+ }
+#else
+ dot_all_scops_1 (stderr, scops);
+#endif
+
+ VEC_free (scop_p, heap, scops);
+}
+
+#endif
diff --git a/gcc/graphite-scop-detection.h b/gcc/graphite-scop-detection.h
new file mode 100644
index 00000000000..740816d5ac4
--- /dev/null
+++ b/gcc/graphite-scop-detection.h
@@ -0,0 +1,27 @@
+/* Detection of Static Control Parts (SCoP) for Graphite.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com> and
+ Tobias Grosser <grosser@fim.uni-passau.de>.
+
+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/>. */
+
+
+extern void build_scops (VEC (scop_p, heap) **);
+extern void build_scop_bbs (scop_p);
+extern int nb_reductions_in_loop (loop_p);
+extern void dot_all_scops (VEC (scop_p, heap) *);
+extern void dot_scop (scop_p);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
new file mode 100644
index 00000000000..ad64b8c3499
--- /dev/null
+++ b/gcc/graphite-sese-to-poly.c
@@ -0,0 +1,2098 @@
+/* Conversion of SESE regions to Polyhedra.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "sese.h"
+
+#ifdef HAVE_cloog
+#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "graphite-ppl.h"
+#include "graphite.h"
+#include "graphite-poly.h"
+#include "graphite-scop-detection.h"
+#include "graphite-clast-to-gimple.h"
+#include "graphite-sese-to-poly.h"
+
+/* Check if VAR is used in a phi node, that is no loop header. */
+
+static bool
+var_used_in_not_loop_header_phi_node (tree var)
+{
+
+ imm_use_iterator imm_iter;
+ gimple stmt;
+ bool result = false;
+
+ FOR_EACH_IMM_USE_STMT (stmt, imm_iter, var)
+ {
+ basic_block bb = gimple_bb (stmt);
+
+ if (gimple_code (stmt) == GIMPLE_PHI
+ && bb->loop_father->header != bb)
+ result = true;
+ }
+
+ return result;
+}
+
+/* Returns the index of the phi argument corresponding to the initial
+ value in the loop. */
+
+static size_t
+loop_entry_phi_arg (gimple phi)
+{
+ loop_p loop = gimple_bb (phi)->loop_father;
+ size_t i;
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (!flow_bb_inside_loop_p (loop, gimple_phi_arg_edge (phi, i)->src))
+ return i;
+
+ gcc_unreachable ();
+ return 0;
+}
+
+/* Removes a simple copy phi node "RES = phi (INIT, RES)" at position
+ PSI by inserting on the loop ENTRY edge assignment "RES = INIT". */
+
+static void
+remove_simple_copy_phi (gimple_stmt_iterator *psi)
+{
+ gimple phi = gsi_stmt (*psi);
+ tree res = gimple_phi_result (phi);
+ size_t entry = loop_entry_phi_arg (phi);
+ tree init = gimple_phi_arg_def (phi, entry);
+ gimple stmt = gimple_build_assign (res, init);
+ edge e = gimple_phi_arg_edge (phi, entry);
+
+ remove_phi_node (psi, false);
+ gsi_insert_on_edge_immediate (e, stmt);
+ SSA_NAME_DEF_STMT (res) = stmt;
+}
+
+/* Removes an invariant phi node at position PSI by inserting on the
+ loop ENTRY edge the assignment RES = INIT. */
+
+static void
+remove_invariant_phi (sese region, gimple_stmt_iterator *psi)
+{
+ gimple phi = gsi_stmt (*psi);
+ loop_p loop = loop_containing_stmt (phi);
+ tree res = gimple_phi_result (phi);
+ tree scev = scalar_evolution_in_region (region, loop, res);
+ size_t entry = loop_entry_phi_arg (phi);
+ edge e = gimple_phi_arg_edge (phi, entry);
+ tree var;
+ gimple stmt;
+ gimple_seq stmts;
+ gimple_stmt_iterator gsi;
+
+ if (tree_contains_chrecs (scev, NULL))
+ scev = gimple_phi_arg_def (phi, entry);
+
+ var = force_gimple_operand (scev, &stmts, true, NULL_TREE);
+ stmt = gimple_build_assign (res, var);
+ remove_phi_node (psi, false);
+
+ if (!stmts)
+ stmts = gimple_seq_alloc ();
+
+ gsi = gsi_last (stmts);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ gsi_insert_seq_on_edge (e, stmts);
+ gsi_commit_edge_inserts ();
+ SSA_NAME_DEF_STMT (res) = stmt;
+}
+
+/* Returns true when the phi node at PSI is of the form "a = phi (a, x)". */
+
+static inline bool
+simple_copy_phi_p (gimple phi)
+{
+ tree res;
+
+ if (gimple_phi_num_args (phi) != 2)
+ return false;
+
+ res = gimple_phi_result (phi);
+ return (res == gimple_phi_arg_def (phi, 0)
+ || res == gimple_phi_arg_def (phi, 1));
+}
+
+/* Returns true when the phi node at position PSI is a reduction phi
+ node in REGION. Otherwise moves the pointer PSI to the next phi to
+ be considered. */
+
+static bool
+reduction_phi_p (sese region, gimple_stmt_iterator *psi)
+{
+ loop_p loop;
+ tree scev;
+ affine_iv iv;
+ gimple phi = gsi_stmt (*psi);
+ tree res = gimple_phi_result (phi);
+
+ if (!is_gimple_reg (res))
+ {
+ gsi_next (psi);
+ return false;
+ }
+
+ loop = loop_containing_stmt (phi);
+
+ if (simple_copy_phi_p (phi))
+ {
+ /* FIXME: PRE introduces phi nodes like these, for an example,
+ see id-5.f in the fortran graphite testsuite:
+
+ # prephitmp.85_265 = PHI <prephitmp.85_258(33), prephitmp.85_265(18)>
+ */
+ remove_simple_copy_phi (psi);
+ return false;
+ }
+
+ /* Main induction variables with constant strides in LOOP are not
+ reductions. */
+ if (simple_iv (loop, loop, res, &iv, true))
+ {
+ gsi_next (psi);
+ return false;
+ }
+
+ scev = scalar_evolution_in_region (region, loop, res);
+ if (chrec_contains_undetermined (scev))
+ return true;
+
+ if (evolution_function_is_invariant_p (scev, loop->num))
+ {
+ remove_invariant_phi (region, psi);
+ return false;
+ }
+
+ /* All the other cases are considered reductions. */
+ return true;
+}
+
+/* Returns true when BB will be represented in graphite. Return false
+ for the basic blocks that contain code eliminated in the code
+ generation pass: i.e. induction variables and exit conditions. */
+
+static bool
+graphite_stmt_p (sese region, basic_block bb,
+ VEC (data_reference_p, heap) *drs)
+{
+ gimple_stmt_iterator gsi;
+ loop_p loop = bb->loop_father;
+
+ if (VEC_length (data_reference_p, drs) > 0)
+ return true;
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+
+ switch (gimple_code (stmt))
+ {
+ /* Control flow expressions can be ignored, as they are
+ represented in the iteration domains and will be
+ regenerated by graphite. */
+ case GIMPLE_COND:
+ case GIMPLE_GOTO:
+ case GIMPLE_SWITCH:
+ break;
+
+ case GIMPLE_ASSIGN:
+ {
+ tree var = gimple_assign_lhs (stmt);
+
+ /* We need these bbs to be able to construct the phi nodes. */
+ if (var_used_in_not_loop_header_phi_node (var))
+ return true;
+
+ var = scalar_evolution_in_region (region, loop, var);
+ if (chrec_contains_undetermined (var))
+ return true;
+
+ break;
+ }
+
+ default:
+ return true;
+ }
+ }
+
+ return false;
+}
+
+/* Store the GRAPHITE representation of BB. */
+
+static gimple_bb_p
+new_gimple_bb (basic_block bb, VEC (data_reference_p, heap) *drs)
+{
+ struct gimple_bb *gbb;
+
+ gbb = XNEW (struct gimple_bb);
+ bb->aux = gbb;
+ GBB_BB (gbb) = bb;
+ GBB_DATA_REFS (gbb) = drs;
+ GBB_CONDITIONS (gbb) = NULL;
+ GBB_CONDITION_CASES (gbb) = NULL;
+ GBB_CLOOG_IV_TYPES (gbb) = NULL;
+
+ return gbb;
+}
+
+/* Frees GBB. */
+
+static void
+free_gimple_bb (struct gimple_bb *gbb)
+{
+ if (GBB_CLOOG_IV_TYPES (gbb))
+ htab_delete (GBB_CLOOG_IV_TYPES (gbb));
+
+ free_data_refs (GBB_DATA_REFS (gbb));
+
+ VEC_free (gimple, heap, GBB_CONDITIONS (gbb));
+ VEC_free (gimple, heap, GBB_CONDITION_CASES (gbb));
+ GBB_BB (gbb)->aux = 0;
+ XDELETE (gbb);
+}
+
+/* Deletes all gimple bbs in SCOP. */
+
+static void
+remove_gbbs_in_scop (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ free_gimple_bb (PBB_BLACK_BOX (pbb));
+}
+
+/* Deletes all scops in SCOPS. */
+
+void
+free_scops (VEC (scop_p, heap) *scops)
+{
+ int i;
+ scop_p scop;
+
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ {
+ remove_gbbs_in_scop (scop);
+ free_sese (SCOP_REGION (scop));
+ free_scop (scop);
+ }
+
+ VEC_free (scop_p, heap, scops);
+}
+
+/* Generates a polyhedral black box only if the bb contains interesting
+ information. */
+
+static void
+try_generate_gimple_bb (scop_p scop, basic_block bb)
+{
+ VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5);
+ loop_p nest = outermost_loop_in_sese (SCOP_REGION (scop), bb);
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ graphite_find_data_references_in_stmt (nest, gsi_stmt (gsi), &drs);
+
+ if (!graphite_stmt_p (SCOP_REGION (scop), bb, drs))
+ free_data_refs (drs);
+ else
+ new_poly_bb (scop, new_gimple_bb (bb, drs));
+}
+
+/* Returns true if all predecessors of BB, that are not dominated by BB, are
+ marked in MAP. The predecessors dominated by BB are loop latches and will
+ be handled after BB. */
+
+static bool
+all_non_dominated_preds_marked_p (basic_block bb, sbitmap map)
+{
+ edge e;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ if (!TEST_BIT (map, e->src->index)
+ && !dominated_by_p (CDI_DOMINATORS, e->src, bb))
+ return false;
+
+ return true;
+}
+
+/* Compare the depth of two basic_block's P1 and P2. */
+
+static int
+compare_bb_depths (const void *p1, const void *p2)
+{
+ const_basic_block const bb1 = *(const_basic_block const*)p1;
+ const_basic_block const bb2 = *(const_basic_block const*)p2;
+ int d1 = loop_depth (bb1->loop_father);
+ int d2 = loop_depth (bb2->loop_father);
+
+ if (d1 < d2)
+ return 1;
+
+ if (d1 > d2)
+ return -1;
+
+ return 0;
+}
+
+/* Sort the basic blocks from DOM such that the first are the ones at
+ a deepest loop level. */
+
+static void
+graphite_sort_dominated_info (VEC (basic_block, heap) *dom)
+{
+ size_t len = VEC_length (basic_block, dom);
+
+ qsort (VEC_address (basic_block, dom), len, sizeof (basic_block),
+ compare_bb_depths);
+}
+
+/* Recursive helper function for build_scops_bbs. */
+
+static void
+build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb)
+{
+ sese region = SCOP_REGION (scop);
+ VEC (basic_block, heap) *dom;
+
+ if (TEST_BIT (visited, bb->index)
+ || !bb_in_sese_p (bb, region))
+ return;
+
+ try_generate_gimple_bb (scop, bb);
+ SET_BIT (visited, bb->index);
+
+ dom = get_dominated_by (CDI_DOMINATORS, bb);
+
+ if (dom == NULL)
+ return;
+
+ graphite_sort_dominated_info (dom);
+
+ while (!VEC_empty (basic_block, dom))
+ {
+ int i;
+ basic_block dom_bb;
+
+ for (i = 0; VEC_iterate (basic_block, dom, i, dom_bb); i++)
+ if (all_non_dominated_preds_marked_p (dom_bb, visited))
+ {
+ build_scop_bbs_1 (scop, visited, dom_bb);
+ VEC_unordered_remove (basic_block, dom, i);
+ break;
+ }
+ }
+
+ VEC_free (basic_block, heap, dom);
+}
+
+/* Gather the basic blocks belonging to the SCOP. */
+
+void
+build_scop_bbs (scop_p scop)
+{
+ sbitmap visited = sbitmap_alloc (last_basic_block);
+ sese region = SCOP_REGION (scop);
+
+ sbitmap_zero (visited);
+ build_scop_bbs_1 (scop, visited, SESE_ENTRY_BB (region));
+
+ sbitmap_free (visited);
+}
+
+/* Converts the STATIC_SCHEDULE of PBB into a scattering polyhedron.
+ We generate SCATTERING_DIMENSIONS scattering dimensions.
+
+ CLooG 0.15.0 and previous versions require, that all
+ scattering functions of one CloogProgram have the same number of
+ scattering dimensions, therefore we allow to specify it. This
+ should be removed in future versions of CLooG.
+
+ The scattering polyhedron consists of these dimensions: scattering,
+ loop_iterators, parameters.
+
+ Example:
+
+ | scattering_dimensions = 5
+ | used_scattering_dimensions = 3
+ | nb_iterators = 1
+ | scop_nb_params = 2
+ |
+ | Schedule:
+ | i
+ | 4 5
+ |
+ | Scattering polyhedron:
+ |
+ | scattering: {s1, s2, s3, s4, s5}
+ | loop_iterators: {i}
+ | parameters: {p1, p2}
+ |
+ | s1 s2 s3 s4 s5 i p1 p2 1
+ | 1 0 0 0 0 0 0 0 -4 = 0
+ | 0 1 0 0 0 -1 0 0 0 = 0
+ | 0 0 1 0 0 0 0 0 -5 = 0 */
+
+static void
+build_pbb_scattering_polyhedrons (ppl_Linear_Expression_t static_schedule,
+ poly_bb_p pbb, int scattering_dimensions)
+{
+ int i;
+ scop_p scop = PBB_SCOP (pbb);
+ int nb_iterators = pbb_dim_iter_domain (pbb);
+ int used_scattering_dimensions = nb_iterators * 2 + 1;
+ int nb_params = scop_nb_params (scop);
+ ppl_Coefficient_t c;
+ ppl_dimension_type dim = scattering_dimensions + nb_iterators + nb_params;
+ Value v;
+
+ gcc_assert (scattering_dimensions >= used_scattering_dimensions);
+
+ value_init (v);
+ ppl_new_Coefficient (&c);
+ PBB_TRANSFORMED (pbb) = poly_scattering_new ();
+ ppl_new_C_Polyhedron_from_space_dimension
+ (&PBB_TRANSFORMED_SCATTERING (pbb), dim, 0);
+
+ PBB_NB_SCATTERING_TRANSFORM (pbb) = scattering_dimensions;
+
+ for (i = 0; i < scattering_dimensions; i++)
+ {
+ ppl_Constraint_t cstr;
+ ppl_Linear_Expression_t expr;
+
+ ppl_new_Linear_Expression_with_dimension (&expr, dim);
+ value_set_si (v, 1);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_coefficient (expr, i, c);
+
+ /* Textual order inside this loop. */
+ if ((i % 2) == 0)
+ {
+ ppl_Linear_Expression_coefficient (static_schedule, i / 2, c);
+ ppl_Coefficient_to_mpz_t (c, v);
+ value_oppose (v, v);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_inhomogeneous (expr, c);
+ }
+
+ /* Iterations of this loop. */
+ else /* if ((i % 2) == 1) */
+ {
+ int loop = (i - 1) / 2;
+
+ value_set_si (v, -1);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_coefficient
+ (expr, scattering_dimensions + loop, c);
+ }
+
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Polyhedron_add_constraint (PBB_TRANSFORMED_SCATTERING (pbb), cstr);
+ ppl_delete_Linear_Expression (expr);
+ ppl_delete_Constraint (cstr);
+ }
+
+ value_clear (v);
+ ppl_delete_Coefficient (c);
+
+ PBB_ORIGINAL (pbb) = poly_scattering_copy (PBB_TRANSFORMED (pbb));
+}
+
+/* Build for BB the static schedule.
+
+ The static schedule is a Dewey numbering of the abstract syntax
+ tree: http://en.wikipedia.org/wiki/Dewey_Decimal_Classification
+
+ The following example informally defines the static schedule:
+
+ A
+ for (i: ...)
+ {
+ for (j: ...)
+ {
+ B
+ C
+ }
+
+ for (k: ...)
+ {
+ D
+ E
+ }
+ }
+ F
+
+ Static schedules for A to F:
+
+ DEPTH
+ 0 1 2
+ A 0
+ B 1 0 0
+ C 1 0 1
+ D 1 1 0
+ E 1 1 1
+ F 2
+*/
+
+static void
+build_scop_scattering (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+ gimple_bb_p previous_gbb = NULL;
+ ppl_Linear_Expression_t static_schedule;
+ ppl_Coefficient_t c;
+ Value v;
+
+ value_init (v);
+ ppl_new_Coefficient (&c);
+ ppl_new_Linear_Expression (&static_schedule);
+
+ /* We have to start schedules at 0 on the first component and
+ because we cannot compare_prefix_loops against a previous loop,
+ prefix will be equal to zero, and that index will be
+ incremented before copying. */
+ value_set_si (v, -1);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_coefficient (static_schedule, 0, c);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ {
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+ ppl_Linear_Expression_t common;
+ int prefix;
+ int nb_scat_dims = pbb_dim_iter_domain (pbb) * 2 + 1;
+
+ if (previous_gbb)
+ prefix = nb_common_loops (SCOP_REGION (scop), previous_gbb, gbb);
+ else
+ prefix = 0;
+
+ previous_gbb = gbb;
+ ppl_new_Linear_Expression_with_dimension (&common, prefix + 1);
+ ppl_assign_Linear_Expression_from_Linear_Expression (common,
+ static_schedule);
+
+ value_set_si (v, 1);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_coefficient (common, prefix, c);
+ ppl_assign_Linear_Expression_from_Linear_Expression (static_schedule,
+ common);
+
+ build_pbb_scattering_polyhedrons (common, pbb, nb_scat_dims);
+
+ ppl_delete_Linear_Expression (common);
+ }
+
+ value_clear (v);
+ ppl_delete_Coefficient (c);
+ ppl_delete_Linear_Expression (static_schedule);
+}
+
+/* Add the value K to the dimension D of the linear expression EXPR. */
+
+static void
+add_value_to_dim (ppl_dimension_type d, ppl_Linear_Expression_t expr,
+ Value k)
+{
+ Value val;
+ ppl_Coefficient_t coef;
+
+ ppl_new_Coefficient (&coef);
+ ppl_Linear_Expression_coefficient (expr, d, coef);
+ value_init (val);
+ ppl_Coefficient_to_mpz_t (coef, val);
+
+ value_addto (val, val, k);
+
+ ppl_assign_Coefficient_from_mpz_t (coef, val);
+ ppl_Linear_Expression_add_to_coefficient (expr, d, coef);
+ value_clear (val);
+ ppl_delete_Coefficient (coef);
+}
+
+/* In the context of scop S, scan E, the right hand side of a scalar
+ evolution function in loop VAR, and translate it to a linear
+ expression EXPR. */
+
+static void
+scan_tree_for_params_right_scev (sese s, tree e, int var,
+ ppl_Linear_Expression_t expr)
+{
+ if (expr)
+ {
+ loop_p loop = get_loop (var);
+ ppl_dimension_type l = sese_loop_depth (s, loop) - 1;
+ Value val;
+
+ /* Scalar evolutions should happen in the sese region. */
+ gcc_assert (sese_loop_depth (s, loop) > 0);
+
+ /* We can not deal with parametric strides like:
+
+ | p = parameter;
+ |
+ | for i:
+ | a [i * p] = ... */
+ gcc_assert (TREE_CODE (e) == INTEGER_CST);
+
+ value_init (val);
+ value_set_si (val, int_cst_value (e));
+ add_value_to_dim (l, expr, val);
+ value_clear (val);
+ }
+}
+
+/* Scan the integer constant CST, and add it to the inhomogeneous part of the
+ linear expression EXPR. K is the multiplier of the constant. */
+
+static void
+scan_tree_for_params_int (tree cst, ppl_Linear_Expression_t expr, Value k)
+{
+ Value val;
+ ppl_Coefficient_t coef;
+ int v = int_cst_value (cst);
+
+ value_init (val);
+ value_set_si (val, 0);
+
+ /* Necessary to not get "-1 = 2^n - 1". */
+ if (v < 0)
+ value_sub_int (val, val, -v);
+ else
+ value_add_int (val, val, v);
+
+ value_multiply (val, val, k);
+ ppl_new_Coefficient (&coef);
+ ppl_assign_Coefficient_from_mpz_t (coef, val);
+ ppl_Linear_Expression_add_to_inhomogeneous (expr, coef);
+ value_clear (val);
+ ppl_delete_Coefficient (coef);
+}
+
+/* Saves in NV at index I a new name for variable P. */
+
+static void
+save_var_name (char **nv, int i, tree p)
+{
+ const char *name = get_name (SSA_NAME_VAR (p));
+
+ if (name)
+ {
+ int len = strlen (name) + 16;
+ nv[i] = XNEWVEC (char, len);
+ snprintf (nv[i], len, "%s_%d", name, SSA_NAME_VERSION (p));
+ }
+ else
+ {
+ nv[i] = XNEWVEC (char, 16);
+ snprintf (nv[i], 2 + 16, "T_%d", SSA_NAME_VERSION (p));
+ }
+}
+
+/* When parameter NAME is in REGION, returns its index in SESE_PARAMS.
+ Otherwise returns -1. */
+
+static inline int
+parameter_index_in_region_1 (tree name, sese region)
+{
+ int i;
+ tree p;
+
+ gcc_assert (TREE_CODE (name) == SSA_NAME);
+
+ for (i = 0; VEC_iterate (tree, SESE_PARAMS (region), i, p); i++)
+ if (p == name)
+ return i;
+
+ return -1;
+}
+
+/* When the parameter NAME is in REGION, returns its index in
+ SESE_PARAMS. Otherwise this function inserts NAME in SESE_PARAMS
+ and returns the index of NAME. */
+
+static int
+parameter_index_in_region (tree name, sese region)
+{
+ int i;
+
+ gcc_assert (TREE_CODE (name) == SSA_NAME);
+
+ i = parameter_index_in_region_1 (name, region);
+ if (i != -1)
+ return i;
+
+ gcc_assert (SESE_ADD_PARAMS (region));
+
+ i = VEC_length (tree, SESE_PARAMS (region));
+ save_var_name (SESE_PARAMS_NAMES (region), i, name);
+ save_clast_name_index (SESE_PARAMS_INDEX (region),
+ SESE_PARAMS_NAMES (region)[i], i);
+ VEC_safe_push (tree, heap, SESE_PARAMS (region), name);
+ return i;
+}
+
+/* In the context of sese S, scan the expression E and translate it to
+ a linear expression C. When parsing a symbolic multiplication, K
+ represents the constant multiplier of an expression containing
+ parameters. */
+
+static void
+scan_tree_for_params (sese s, tree e, ppl_Linear_Expression_t c,
+ Value k)
+{
+ if (e == chrec_dont_know)
+ return;
+
+ switch (TREE_CODE (e))
+ {
+ case POLYNOMIAL_CHREC:
+ scan_tree_for_params_right_scev (s, CHREC_RIGHT (e),
+ CHREC_VARIABLE (e), c);
+ scan_tree_for_params (s, CHREC_LEFT (e), c, k);
+ break;
+
+ case MULT_EXPR:
+ if (chrec_contains_symbols (TREE_OPERAND (e, 0)))
+ {
+ if (c)
+ {
+ Value val;
+ gcc_assert (host_integerp (TREE_OPERAND (e, 1), 0));
+ value_init (val);
+ value_set_si (val, int_cst_value (TREE_OPERAND (e, 1)));
+ value_multiply (val, val, k);
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), c, val);
+ value_clear (val);
+ }
+ else
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k);
+ }
+ else
+ {
+ if (c)
+ {
+ Value val;
+ gcc_assert (host_integerp (TREE_OPERAND (e, 0), 0));
+ value_init (val);
+ value_set_si (val, int_cst_value (TREE_OPERAND (e, 0)));
+ value_multiply (val, val, k);
+ scan_tree_for_params (s, TREE_OPERAND (e, 1), c, val);
+ value_clear (val);
+ }
+ else
+ scan_tree_for_params (s, TREE_OPERAND (e, 1), c, k);
+ }
+ break;
+
+ case PLUS_EXPR:
+ case POINTER_PLUS_EXPR:
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k);
+ scan_tree_for_params (s, TREE_OPERAND (e, 1), c, k);
+ break;
+
+ case MINUS_EXPR:
+ {
+ ppl_Linear_Expression_t tmp_expr = NULL;
+
+ if (c)
+ {
+ ppl_dimension_type dim;
+ ppl_Linear_Expression_space_dimension (c, &dim);
+ ppl_new_Linear_Expression_with_dimension (&tmp_expr, dim);
+ }
+
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k);
+ scan_tree_for_params (s, TREE_OPERAND (e, 1), tmp_expr, k);
+
+ if (c)
+ {
+ ppl_subtract_Linear_Expression_from_Linear_Expression (c,
+ tmp_expr);
+ ppl_delete_Linear_Expression (tmp_expr);
+ }
+
+ break;
+ }
+
+ case NEGATE_EXPR:
+ {
+ ppl_Linear_Expression_t tmp_expr = NULL;
+
+ if (c)
+ {
+ ppl_dimension_type dim;
+ ppl_Linear_Expression_space_dimension (c, &dim);
+ ppl_new_Linear_Expression_with_dimension (&tmp_expr, dim);
+ }
+
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), tmp_expr, k);
+
+ if (c)
+ {
+ ppl_subtract_Linear_Expression_from_Linear_Expression (c,
+ tmp_expr);
+ ppl_delete_Linear_Expression (tmp_expr);
+ }
+
+ break;
+ }
+
+ case BIT_NOT_EXPR:
+ {
+ ppl_Linear_Expression_t tmp_expr = NULL;
+
+ if (c)
+ {
+ ppl_dimension_type dim;
+ ppl_Linear_Expression_space_dimension (c, &dim);
+ ppl_new_Linear_Expression_with_dimension (&tmp_expr, dim);
+ }
+
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), tmp_expr, k);
+
+ if (c)
+ {
+ ppl_Coefficient_t coef;
+ Value minus_one;
+
+ ppl_subtract_Linear_Expression_from_Linear_Expression (c,
+ tmp_expr);
+ ppl_delete_Linear_Expression (tmp_expr);
+ value_init (minus_one);
+ value_set_si (minus_one, -1);
+ ppl_new_Coefficient_from_mpz_t (&coef, minus_one);
+ ppl_Linear_Expression_add_to_inhomogeneous (c, coef);
+ value_clear (minus_one);
+ ppl_delete_Coefficient (coef);
+ }
+
+ break;
+ }
+
+ case SSA_NAME:
+ {
+ ppl_dimension_type p = parameter_index_in_region (e, s);
+
+ if (c)
+ {
+ ppl_dimension_type dim;
+ ppl_Linear_Expression_space_dimension (c, &dim);
+ p += dim - sese_nb_params (s);
+ add_value_to_dim (p, c, k);
+ }
+ break;
+ }
+
+ case INTEGER_CST:
+ if (c)
+ scan_tree_for_params_int (e, c, k);
+ break;
+
+ CASE_CONVERT:
+ case NON_LVALUE_EXPR:
+ scan_tree_for_params (s, TREE_OPERAND (e, 0), c, k);
+ break;
+
+ default:
+ gcc_unreachable ();
+ break;
+ }
+}
+
+/* Data structure for idx_record_params. */
+
+struct irp_data
+{
+ struct loop *loop;
+ sese region;
+};
+
+/* For a data reference with an ARRAY_REF as its BASE, record the
+ parameters occurring in IDX. DTA is passed in as complementary
+ information, and is used by the automatic walker function. This
+ function is a callback for for_each_index. */
+
+static bool
+idx_record_params (tree base, tree *idx, void *dta)
+{
+ struct irp_data *data = (struct irp_data *) dta;
+
+ if (TREE_CODE (base) != ARRAY_REF)
+ return true;
+
+ if (TREE_CODE (*idx) == SSA_NAME)
+ {
+ tree scev;
+ sese region = data->region;
+ struct loop *loop = data->loop;
+ Value one;
+
+ scev = scalar_evolution_in_region (region, loop, *idx);
+
+ value_init (one);
+ value_set_si (one, 1);
+ scan_tree_for_params (region, scev, NULL, one);
+ value_clear (one);
+ }
+
+ return true;
+}
+
+/* Find parameters with respect to REGION in BB. We are looking in memory
+ access functions, conditions and loop bounds. */
+
+static void
+find_params_in_bb (sese region, gimple_bb_p gbb)
+{
+ int i;
+ data_reference_p dr;
+ gimple stmt;
+ loop_p loop = GBB_BB (gbb)->loop_father;
+
+ for (i = 0; VEC_iterate (data_reference_p, GBB_DATA_REFS (gbb), i, dr); i++)
+ {
+ struct irp_data irp;
+
+ irp.loop = loop;
+ irp.region = region;
+ for_each_index (&dr->ref, idx_record_params, &irp);
+ }
+
+ /* Find parameters in conditional statements. */
+ for (i = 0; VEC_iterate (gimple, GBB_CONDITIONS (gbb), i, stmt); i++)
+ {
+ Value one;
+ tree lhs = scalar_evolution_in_region (region, loop,
+ gimple_cond_lhs (stmt));
+ tree rhs = scalar_evolution_in_region (region, loop,
+ gimple_cond_rhs (stmt));
+
+ value_init (one);
+ value_set_si (one, 1);
+ scan_tree_for_params (region, lhs, NULL, one);
+ scan_tree_for_params (region, rhs, NULL, one);
+ value_clear (one);
+ }
+}
+
+/* Record the parameters used in the SCOP. A variable is a parameter
+ in a scop if it does not vary during the execution of that scop. */
+
+static void
+find_scop_parameters (scop_p scop)
+{
+ poly_bb_p pbb;
+ unsigned i;
+ sese region = SCOP_REGION (scop);
+ struct loop *loop;
+ Value one;
+
+ value_init (one);
+ value_set_si (one, 1);
+
+ /* Find the parameters used in the loop bounds. */
+ for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ {
+ tree nb_iters = number_of_latch_executions (loop);
+
+ if (!chrec_contains_symbols (nb_iters))
+ continue;
+
+ nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
+ scan_tree_for_params (region, nb_iters, NULL, one);
+ }
+
+ value_clear (one);
+
+ /* Find the parameters used in data accesses. */
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ find_params_in_bb (region, PBB_BLACK_BOX (pbb));
+
+ scop_set_nb_params (scop, sese_nb_params (region));
+ SESE_ADD_PARAMS (region) = false;
+}
+
+/* Returns a gimple_bb from BB. */
+
+static inline gimple_bb_p
+gbb_from_bb (basic_block bb)
+{
+ return (gimple_bb_p) bb->aux;
+}
+
+/* Builds the constraint polyhedra for LOOP in SCOP. OUTER_PH gives
+ the constraints for the surrounding loops. */
+
+static void
+build_loop_iteration_domains (scop_p scop, struct loop *loop,
+ ppl_Polyhedron_t outer_ph, int nb)
+
+{
+ int i;
+ ppl_Polyhedron_t ph;
+ tree nb_iters = number_of_latch_executions (loop);
+ ppl_dimension_type dim = nb + 1 + scop_nb_params (scop);
+ sese region = SCOP_REGION (scop);
+
+ {
+ ppl_const_Constraint_System_t pcs;
+ ppl_dimension_type *map
+ = (ppl_dimension_type *) XNEWVEC (ppl_dimension_type, dim);
+
+ ppl_new_C_Polyhedron_from_space_dimension (&ph, dim, 0);
+ ppl_Polyhedron_get_constraints (outer_ph, &pcs);
+ ppl_Polyhedron_add_constraints (ph, pcs);
+
+ for (i = 0; i < (int) nb; i++)
+ map[i] = i;
+ for (i = (int) nb; i < (int) dim - 1; i++)
+ map[i] = i + 1;
+ map[dim - 1] = nb;
+
+ ppl_Polyhedron_map_space_dimensions (ph, map, dim);
+ free (map);
+ }
+
+ /* 0 <= loop_i */
+ {
+ ppl_Constraint_t lb;
+ ppl_Linear_Expression_t lb_expr;
+
+ ppl_new_Linear_Expression_with_dimension (&lb_expr, dim);
+ ppl_set_coef (lb_expr, nb, 1);
+ ppl_new_Constraint (&lb, lb_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_delete_Linear_Expression (lb_expr);
+ ppl_Polyhedron_add_constraint (ph, lb);
+ ppl_delete_Constraint (lb);
+ }
+
+ if (TREE_CODE (nb_iters) == INTEGER_CST)
+ {
+ ppl_Constraint_t ub;
+ ppl_Linear_Expression_t ub_expr;
+
+ ppl_new_Linear_Expression_with_dimension (&ub_expr, dim);
+
+ /* loop_i <= cst_nb_iters */
+ ppl_set_coef (ub_expr, nb, -1);
+ ppl_set_inhomogeneous_tree (ub_expr, nb_iters);
+ ppl_new_Constraint (&ub, ub_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (ph, ub);
+ ppl_delete_Linear_Expression (ub_expr);
+ ppl_delete_Constraint (ub);
+ }
+ else if (!chrec_contains_undetermined (nb_iters))
+ {
+ Value one;
+ ppl_Constraint_t ub;
+ ppl_Linear_Expression_t ub_expr;
+
+ value_init (one);
+ value_set_si (one, 1);
+ ppl_new_Linear_Expression_with_dimension (&ub_expr, dim);
+ nb_iters = scalar_evolution_in_region (region, loop, nb_iters);
+ scan_tree_for_params (SCOP_REGION (scop), nb_iters, ub_expr, one);
+ value_clear (one);
+
+ /* loop_i <= expr_nb_iters */
+ ppl_set_coef (ub_expr, nb, -1);
+ ppl_new_Constraint (&ub, ub_expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (ph, ub);
+ ppl_delete_Linear_Expression (ub_expr);
+ ppl_delete_Constraint (ub);
+ }
+ else
+ gcc_unreachable ();
+
+ if (loop->inner && loop_in_sese_p (loop->inner, region))
+ build_loop_iteration_domains (scop, loop->inner, ph, nb + 1);
+
+ if (nb != 0
+ && loop->next
+ && loop_in_sese_p (loop->next, region))
+ build_loop_iteration_domains (scop, loop->next, outer_ph, nb);
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron
+ ((ppl_Pointset_Powerset_C_Polyhedron_t *) &loop->aux, ph);
+
+ ppl_delete_Polyhedron (ph);
+}
+
+/* Returns a linear expression for tree T evaluated in PBB. */
+
+static ppl_Linear_Expression_t
+create_linear_expr_from_tree (poly_bb_p pbb, tree t)
+{
+ Value one;
+ ppl_Linear_Expression_t res;
+ ppl_dimension_type dim;
+ sese region = SCOP_REGION (PBB_SCOP (pbb));
+ loop_p loop = GBB_BB (PBB_BLACK_BOX (pbb))->loop_father;
+
+ dim = pbb_dim_iter_domain (pbb) + pbb_nb_params (pbb);
+ ppl_new_Linear_Expression_with_dimension (&res, dim);
+
+ t = scalar_evolution_in_region (region, loop, t);
+ gcc_assert (!automatically_generated_chrec_p (t));
+
+ value_init (one);
+ value_set_si (one, 1);
+ scan_tree_for_params (region, t, res, one);
+ value_clear (one);
+
+ return res;
+}
+
+/* Returns the ppl constraint type from the gimple tree code CODE. */
+
+static enum ppl_enum_Constraint_Type
+ppl_constraint_type_from_tree_code (enum tree_code code)
+{
+ switch (code)
+ {
+ /* We do not support LT and GT to be able to work with C_Polyhedron.
+ As we work on integer polyhedron "a < b" can be expressed by
+ "a + 1 <= b". */
+ case LT_EXPR:
+ case GT_EXPR:
+ gcc_unreachable ();
+
+ case LE_EXPR:
+ return PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL;
+
+ case GE_EXPR:
+ return PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL;
+
+ case EQ_EXPR:
+ return PPL_CONSTRAINT_TYPE_EQUAL;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
+/* Add conditional statement STMT to PS. It is evaluated in PBB and
+ CODE is used as the comparison operator. This allows us to invert the
+ condition or to handle inequalities. */
+
+static void
+add_condition_to_domain (ppl_Pointset_Powerset_C_Polyhedron_t ps, gimple stmt,
+ poly_bb_p pbb, enum tree_code code)
+{
+ Value v;
+ ppl_Coefficient_t c;
+ ppl_Linear_Expression_t left, right;
+ ppl_Constraint_t cstr;
+ enum ppl_enum_Constraint_Type type;
+
+ left = create_linear_expr_from_tree (pbb, gimple_cond_lhs (stmt));
+ right = create_linear_expr_from_tree (pbb, gimple_cond_rhs (stmt));
+
+ /* If we have < or > expressions convert them to <= or >= by adding 1 to
+ the left or the right side of the expression. */
+ if (code == LT_EXPR)
+ {
+ value_init (v);
+ value_set_si (v, 1);
+ ppl_new_Coefficient (&c);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_inhomogeneous (left, c);
+ ppl_delete_Coefficient (c);
+ value_clear (v);
+
+ code = LE_EXPR;
+ }
+ else if (code == GT_EXPR)
+ {
+ value_init (v);
+ value_set_si (v, 1);
+ ppl_new_Coefficient (&c);
+ ppl_assign_Coefficient_from_mpz_t (c, v);
+ ppl_Linear_Expression_add_to_inhomogeneous (right, c);
+ ppl_delete_Coefficient (c);
+ value_clear (v);
+
+ code = GE_EXPR;
+ }
+
+ type = ppl_constraint_type_from_tree_code (code);
+
+ ppl_subtract_Linear_Expression_from_Linear_Expression (left, right);
+
+ ppl_new_Constraint (&cstr, left, type);
+ ppl_Pointset_Powerset_C_Polyhedron_add_constraint (ps, cstr);
+
+ ppl_delete_Constraint (cstr);
+ ppl_delete_Linear_Expression (left);
+ ppl_delete_Linear_Expression (right);
+}
+
+/* Add conditional statement STMT to pbb. CODE is used as the comparision
+ operator. This allows us to invert the condition or to handle
+ inequalities. */
+
+static void
+add_condition_to_pbb (poly_bb_p pbb, gimple stmt, enum tree_code code)
+{
+ if (code == NE_EXPR)
+ {
+ ppl_Pointset_Powerset_C_Polyhedron_t left = PBB_DOMAIN (pbb);
+ ppl_Pointset_Powerset_C_Polyhedron_t right;
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&right, left);
+ add_condition_to_domain (left, stmt, pbb, LT_EXPR);
+ add_condition_to_domain (right, stmt, pbb, GT_EXPR);
+ ppl_Pointset_Powerset_C_Polyhedron_upper_bound_assign (left,
+ right);
+ ppl_delete_Pointset_Powerset_C_Polyhedron (right);
+ }
+ else
+ add_condition_to_domain (PBB_DOMAIN (pbb), stmt, pbb, code);
+}
+
+/* Add conditions to the domain of PBB. */
+
+static void
+add_conditions_to_domain (poly_bb_p pbb)
+{
+ unsigned int i;
+ gimple stmt;
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
+ VEC (gimple, heap) *conditions = GBB_CONDITIONS (gbb);
+
+ if (VEC_empty (gimple, conditions))
+ return;
+
+ for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
+ switch (gimple_code (stmt))
+ {
+ case GIMPLE_COND:
+ {
+ enum tree_code code = gimple_cond_code (stmt);
+
+ /* The conditions for ELSE-branches are inverted. */
+ if (VEC_index (gimple, gbb->condition_cases, i) == NULL)
+ code = invert_tree_comparison (code, false);
+
+ add_condition_to_pbb (pbb, stmt, code);
+ break;
+ }
+
+ case GIMPLE_SWITCH:
+ /* Switch statements are not supported right now - fall throught. */
+
+ default:
+ gcc_unreachable ();
+ break;
+ }
+}
+
+/* Structure used to pass data to dom_walk. */
+
+struct bsc
+{
+ VEC (gimple, heap) **conditions, **cases;
+ sese region;
+};
+
+/* Returns non NULL when BB has a single predecessor and the last
+ statement of that predecessor is a COND_EXPR. */
+
+static gimple
+single_pred_cond (basic_block bb)
+{
+ if (single_pred_p (bb))
+ {
+ edge e = single_pred_edge (bb);
+ basic_block pred = e->src;
+ gimple stmt = last_stmt (pred);
+
+ if (stmt && gimple_code (stmt) == GIMPLE_COND)
+ return stmt;
+ }
+ return NULL;
+}
+
+/* Call-back for dom_walk executed before visiting the dominated
+ blocks. */
+
+static void
+build_sese_conditions_before (struct dom_walk_data *dw_data,
+ basic_block bb)
+{
+ struct bsc *data = (struct bsc *) dw_data->global_data;
+ VEC (gimple, heap) **conditions = data->conditions;
+ VEC (gimple, heap) **cases = data->cases;
+ gimple_bb_p gbb = gbb_from_bb (bb);
+ gimple stmt = single_pred_cond (bb);
+
+ if (!bb_in_sese_p (bb, data->region))
+ return;
+
+ if (stmt)
+ {
+ edge e = single_pred_edge (bb);
+
+ VEC_safe_push (gimple, heap, *conditions, stmt);
+
+ if (e->flags & EDGE_TRUE_VALUE)
+ VEC_safe_push (gimple, heap, *cases, stmt);
+ else
+ VEC_safe_push (gimple, heap, *cases, NULL);
+ }
+
+ if (gbb)
+ {
+ GBB_CONDITIONS (gbb) = VEC_copy (gimple, heap, *conditions);
+ GBB_CONDITION_CASES (gbb) = VEC_copy (gimple, heap, *cases);
+ }
+}
+
+/* Call-back for dom_walk executed after visiting the dominated
+ blocks. */
+
+static void
+build_sese_conditions_after (struct dom_walk_data *dw_data,
+ basic_block bb)
+{
+ struct bsc *data = (struct bsc *) dw_data->global_data;
+ VEC (gimple, heap) **conditions = data->conditions;
+ VEC (gimple, heap) **cases = data->cases;
+
+ if (!bb_in_sese_p (bb, data->region))
+ return;
+
+ if (single_pred_cond (bb))
+ {
+ VEC_pop (gimple, *conditions);
+ VEC_pop (gimple, *cases);
+ }
+}
+
+/* Record all conditions in REGION. */
+
+static void
+build_sese_conditions (sese region)
+{
+ struct dom_walk_data walk_data;
+ VEC (gimple, heap) *conditions = VEC_alloc (gimple, heap, 3);
+ VEC (gimple, heap) *cases = VEC_alloc (gimple, heap, 3);
+ struct bsc data;
+
+ data.conditions = &conditions;
+ data.cases = &cases;
+ data.region = region;
+
+ walk_data.dom_direction = CDI_DOMINATORS;
+ walk_data.initialize_block_local_data = NULL;
+ walk_data.before_dom_children = build_sese_conditions_before;
+ walk_data.after_dom_children = build_sese_conditions_after;
+ walk_data.global_data = &data;
+ walk_data.block_local_data_size = 0;
+
+ init_walk_dominator_tree (&walk_data);
+ walk_dominator_tree (&walk_data, SESE_ENTRY_BB (region));
+ fini_walk_dominator_tree (&walk_data);
+
+ VEC_free (gimple, heap, conditions);
+ VEC_free (gimple, heap, cases);
+}
+
+/* Traverses all the GBBs of the SCOP and add their constraints to the
+ iteration domains. */
+
+static void
+add_conditions_to_constraints (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ add_conditions_to_domain (pbb);
+}
+
+/* Add constraints on the possible values of parameter P from the type
+ of P. */
+
+static void
+add_param_constraints (scop_p scop, ppl_Polyhedron_t context, graphite_dim_t p)
+{
+ ppl_Constraint_t cstr;
+ ppl_Linear_Expression_t le;
+ tree parameter = VEC_index (tree, SESE_PARAMS (SCOP_REGION (scop)), p);
+ tree type = TREE_TYPE (parameter);
+ tree lb, ub;
+
+ /* Disabled until we fix CPU2006. */
+ return;
+
+ if (!INTEGRAL_TYPE_P (type))
+ return;
+
+ lb = TYPE_MIN_VALUE (type);
+ ub = TYPE_MAX_VALUE (type);
+
+ if (lb)
+ {
+ ppl_new_Linear_Expression_with_dimension (&le, scop_nb_params (scop));
+ ppl_set_coef (le, p, -1);
+ ppl_set_inhomogeneous_tree (le, lb);
+ ppl_new_Constraint (&cstr, le, PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (context, cstr);
+ ppl_delete_Linear_Expression (le);
+ ppl_delete_Constraint (cstr);
+ }
+
+ if (ub)
+ {
+ ppl_new_Linear_Expression_with_dimension (&le, scop_nb_params (scop));
+ ppl_set_coef (le, p, -1);
+ ppl_set_inhomogeneous_tree (le, ub);
+ ppl_new_Constraint (&cstr, le, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (context, cstr);
+ ppl_delete_Linear_Expression (le);
+ ppl_delete_Constraint (cstr);
+ }
+}
+
+/* Build the context of the SCOP. The context usually contains extra
+ constraints that are added to the iteration domains that constrain
+ some parameters. */
+
+static void
+build_scop_context (scop_p scop)
+{
+ ppl_Polyhedron_t context;
+ graphite_dim_t p, n = scop_nb_params (scop);
+
+ ppl_new_C_Polyhedron_from_space_dimension (&context, n, 0);
+
+ for (p = 0; p < n; p++)
+ add_param_constraints (scop, context, p);
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron
+ (&SCOP_CONTEXT (scop), context);
+
+ ppl_delete_Polyhedron (context);
+}
+
+/* Build the iteration domains: the loops belonging to the current
+ SCOP, and that vary for the execution of the current basic block.
+ Returns false if there is no loop in SCOP. */
+
+static void
+build_scop_iteration_domain (scop_p scop)
+{
+ struct loop *loop;
+ sese region = SCOP_REGION (scop);
+ int i;
+ ppl_Polyhedron_t ph;
+ poly_bb_p pbb;
+
+ ppl_new_C_Polyhedron_from_space_dimension (&ph, scop_nb_params (scop), 0);
+
+ for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ if (!loop_in_sese_p (loop_outer (loop), region))
+ build_loop_iteration_domains (scop, loop, ph, 0);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ if (gbb_loop (PBB_BLACK_BOX (pbb))->aux)
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_Pointset_Powerset_C_Polyhedron
+ (&PBB_DOMAIN (pbb), (ppl_const_Pointset_Powerset_C_Polyhedron_t)
+ gbb_loop (PBB_BLACK_BOX (pbb))->aux);
+ else
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron
+ (&PBB_DOMAIN (pbb), ph);
+
+ for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ if (loop->aux)
+ {
+ ppl_delete_Pointset_Powerset_C_Polyhedron
+ ((ppl_Pointset_Powerset_C_Polyhedron_t) loop->aux);
+ loop->aux = NULL;
+ }
+
+ ppl_delete_Polyhedron (ph);
+}
+
+/* Add a constrain to the ACCESSES polyhedron for the alias set of
+ data reference DR. ACCESSP_NB_DIMS is the dimension of the
+ ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration
+ domain. */
+
+static void
+pdr_add_alias_set (ppl_Polyhedron_t accesses, data_reference_p dr,
+ ppl_dimension_type accessp_nb_dims,
+ ppl_dimension_type dom_nb_dims)
+{
+ ppl_Linear_Expression_t alias;
+ ppl_Constraint_t cstr;
+ int alias_set_num = 0;
+
+ if (dr->aux != NULL)
+ {
+ alias_set_num = *((int *)(dr->aux));
+ free (dr->aux);
+ dr->aux = NULL;
+ }
+
+ ppl_new_Linear_Expression_with_dimension (&alias, accessp_nb_dims);
+
+ ppl_set_coef (alias, dom_nb_dims, 1);
+ ppl_set_inhomogeneous (alias, -alias_set_num);
+ ppl_new_Constraint (&cstr, alias, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Polyhedron_add_constraint (accesses, cstr);
+
+ ppl_delete_Linear_Expression (alias);
+ ppl_delete_Constraint (cstr);
+}
+
+/* Add to ACCESSES polyhedron equalities defining the access functions
+ to the memory. ACCESSP_NB_DIMS is the dimension of the ACCESSES
+ polyhedron, DOM_NB_DIMS is the dimension of the iteration domain.
+ PBB is the poly_bb_p that contains the data reference DR. */
+
+static void
+pdr_add_memory_accesses (ppl_Polyhedron_t accesses, data_reference_p dr,
+ ppl_dimension_type accessp_nb_dims,
+ ppl_dimension_type dom_nb_dims,
+ poly_bb_p pbb)
+{
+ int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
+ Value v;
+ scop_p scop = PBB_SCOP (pbb);
+ sese region = SCOP_REGION (scop);
+
+ value_init (v);
+
+ for (i = 0; i < nb_subscripts; i++)
+ {
+ ppl_Linear_Expression_t fn, access;
+ ppl_Constraint_t cstr;
+ ppl_dimension_type subscript = dom_nb_dims + 1 + i;
+ tree afn = DR_ACCESS_FN (dr, nb_subscripts - 1 - i);
+
+ ppl_new_Linear_Expression_with_dimension (&fn, dom_nb_dims);
+ ppl_new_Linear_Expression_with_dimension (&access, accessp_nb_dims);
+
+ value_set_si (v, 1);
+ scan_tree_for_params (region, afn, fn, v);
+ ppl_assign_Linear_Expression_from_Linear_Expression (access, fn);
+
+ ppl_set_coef (access, subscript, -1);
+ ppl_new_Constraint (&cstr, access, PPL_CONSTRAINT_TYPE_EQUAL);
+ ppl_Polyhedron_add_constraint (accesses, cstr);
+
+ ppl_delete_Linear_Expression (fn);
+ ppl_delete_Linear_Expression (access);
+ ppl_delete_Constraint (cstr);
+ }
+
+ value_clear (v);
+}
+
+/* Add constrains representing the size of the accessed data to the
+ ACCESSES polyhedron. ACCESSP_NB_DIMS is the dimension of the
+ ACCESSES polyhedron, DOM_NB_DIMS is the dimension of the iteration
+ domain. */
+
+static void
+pdr_add_data_dimensions (ppl_Polyhedron_t accesses, data_reference_p dr,
+ ppl_dimension_type accessp_nb_dims,
+ ppl_dimension_type dom_nb_dims)
+{
+ tree ref = DR_REF (dr);
+ int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
+ tree array_size;
+ HOST_WIDE_INT elt_size;
+
+ array_size = TYPE_SIZE (TREE_TYPE (ref));
+ if (array_size == NULL_TREE
+ || TREE_CODE (array_size) != INTEGER_CST)
+ return;
+
+ elt_size = int_cst_value (array_size);
+
+ for (i = nb_subscripts - 1; i >= 0; i--)
+ {
+ ppl_Linear_Expression_t expr;
+ ppl_Constraint_t cstr;
+ ppl_dimension_type subscript = dom_nb_dims + 1 + i;
+ int size;
+
+ /* 0 <= subscript */
+ ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims);
+ ppl_set_coef (expr, subscript, 1);
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (accesses, cstr);
+ ppl_delete_Linear_Expression (expr);
+ ppl_delete_Constraint (cstr);
+
+ ref = TREE_OPERAND (ref, 0);
+ array_size = TYPE_SIZE (TREE_TYPE (ref));
+ if (array_size == NULL_TREE
+ || TREE_CODE (array_size) != INTEGER_CST)
+ break;
+
+ /* subscript <= array_size */
+ size = elt_size ? int_cst_value (array_size) / elt_size : 0;
+ if (size)
+ {
+ ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims);
+ ppl_set_coef (expr, subscript, -1);
+
+ ppl_set_inhomogeneous (expr, size);
+
+ ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
+ ppl_Polyhedron_add_constraint (accesses, cstr);
+ ppl_delete_Linear_Expression (expr);
+ ppl_delete_Constraint (cstr);
+ }
+
+ elt_size = int_cst_value (array_size);
+ }
+}
+
+/* Build data accesses for DR in PBB. */
+
+static void
+build_poly_dr (data_reference_p dr, poly_bb_p pbb)
+{
+ ppl_Polyhedron_t accesses;
+ ppl_Pointset_Powerset_C_Polyhedron_t accesses_ps;
+ ppl_dimension_type dom_nb_dims;
+ ppl_dimension_type accessp_nb_dims;
+
+ ppl_Pointset_Powerset_C_Polyhedron_space_dimension (PBB_DOMAIN (pbb),
+ &dom_nb_dims);
+ accessp_nb_dims = dom_nb_dims + 1 + DR_NUM_DIMENSIONS (dr);
+
+ ppl_new_C_Polyhedron_from_space_dimension (&accesses, accessp_nb_dims, 0);
+
+ pdr_add_alias_set (accesses, dr, accessp_nb_dims, dom_nb_dims);
+ pdr_add_memory_accesses (accesses, dr, accessp_nb_dims, dom_nb_dims, pbb);
+ pdr_add_data_dimensions (accesses, dr, accessp_nb_dims, dom_nb_dims);
+
+ ppl_new_Pointset_Powerset_C_Polyhedron_from_C_Polyhedron (&accesses_ps,
+ accesses);
+ ppl_delete_Polyhedron (accesses);
+ new_poly_dr (pbb, accesses_ps, DR_IS_READ (dr) ? PDR_READ : PDR_WRITE, dr,
+ DR_NUM_DIMENSIONS (dr));
+}
+
+/* Group each data reference in DRS with it's alias set num. */
+
+static void
+build_alias_set_for_drs (VEC (data_reference_p, heap) **drs)
+{
+ int num_vertex = VEC_length (data_reference_p, *drs);
+ struct graph *g = new_graph (num_vertex);
+ data_reference_p dr1, dr2;
+ int i, j;
+ int num_component;
+ int *queue;
+
+ for (i = 0; VEC_iterate (data_reference_p, *drs, i, dr1); i++)
+ for (j = i+1; VEC_iterate (data_reference_p, *drs, j, dr2); j++)
+ if (dr_may_alias_p (dr1, dr2))
+ {
+ add_edge (g, i, j);
+ add_edge (g, j, i);
+ }
+
+ queue = XNEWVEC (int, num_vertex);
+ for (i = 0; i < num_vertex; i++)
+ queue[i] = i;
+
+ num_component = graphds_dfs (g, queue, num_vertex, NULL, true, NULL);
+
+ for (i = 0; i < g->n_vertices; i++)
+ {
+ data_reference_p dr = VEC_index (data_reference_p, *drs, i);
+ dr->aux = XNEW (int);
+ *((int *)(dr->aux)) = g->vertices[i].component + 1;
+ }
+
+ free (queue);
+ free_graph (g);
+}
+
+/* Build the data references for PBB. */
+
+static void
+build_pbb_drs (poly_bb_p pbb)
+{
+ int j;
+ data_reference_p dr;
+ VEC (data_reference_p, heap) *gbb_drs = GBB_DATA_REFS (PBB_BLACK_BOX (pbb));
+
+ for (j = 0; VEC_iterate (data_reference_p, gbb_drs, j, dr); j++)
+ build_poly_dr (dr, pbb);
+}
+
+/* Build data references in SCOP. */
+
+static void
+build_scop_drs (scop_p scop)
+{
+ int i, j;
+ poly_bb_p pbb;
+ data_reference_p dr;
+ VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 3);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ {
+ VEC (data_reference_p, heap) *gbb_drs = GBB_DATA_REFS (PBB_BLACK_BOX (pbb));
+ for (j = 0; VEC_iterate (data_reference_p, gbb_drs, j, dr); j++)
+ VEC_safe_push (data_reference_p, heap, drs, dr);
+ }
+
+ build_alias_set_for_drs (&drs);
+ VEC_free (data_reference_p, heap, drs);
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ build_pbb_drs (pbb);
+}
+
+/* Return a gsi at the position of the VAR definition. */
+
+static gimple_stmt_iterator
+gsi_for_ssa_name_def (tree var)
+{
+ gimple stmt;
+ basic_block bb;
+ gimple_stmt_iterator gsi;
+ gimple_stmt_iterator psi;
+
+ gcc_assert (TREE_CODE (var) == SSA_NAME);
+
+ stmt = SSA_NAME_DEF_STMT (var);
+ bb = gimple_bb (stmt);
+
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
+ if (stmt == gsi_stmt (psi))
+ return gsi_after_labels (bb);
+
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ if (stmt == gsi_stmt (gsi))
+ {
+ gsi_next (&gsi);
+ return gsi;
+ }
+
+ gcc_unreachable ();
+ return gsi;
+}
+
+/* Insert the assignment "RES := VAR" just after the definition of VAR. */
+
+static void
+insert_out_of_ssa_copy (tree res, tree var)
+{
+ gimple_stmt_iterator gsi = gsi_for_ssa_name_def (var);
+ gimple stmt;
+ gimple_seq stmts;
+ gimple_stmt_iterator si;
+
+ var = force_gimple_operand (var, &stmts, true, NULL_TREE);
+ stmt = gimple_build_assign (res, var);
+ if (!stmts)
+ stmts = gimple_seq_alloc ();
+ si = gsi_last (stmts);
+ gsi_insert_after (&si, stmt, GSI_NEW_STMT);
+ gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
+}
+
+/* Insert on edge E the assignment "RES := EXPR". */
+
+static void
+insert_out_of_ssa_copy_on_edge (edge e, tree res, tree expr)
+{
+ gimple_stmt_iterator gsi;
+ gimple_seq stmts;
+ tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
+ gimple stmt = gimple_build_assign (res, var);
+
+ if (!stmts)
+ stmts = gimple_seq_alloc ();
+
+ gsi = gsi_last (stmts);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+ gsi_insert_seq_on_edge (e, stmts);
+ gsi_commit_edge_inserts ();
+}
+
+/* Creates a zero dimension array of the same type as VAR. */
+
+static tree
+create_zero_dim_array (tree var)
+{
+ tree index_type = build_index_type (integer_zero_node);
+ tree elt_type = TREE_TYPE (var);
+ tree array_type = build_array_type (elt_type, index_type);
+ tree base = create_tmp_var (array_type, "Red");
+
+ add_referenced_var (base);
+
+ return build4 (ARRAY_REF, elt_type, base, integer_zero_node, NULL_TREE,
+ NULL_TREE);
+}
+
+/* Returns true when PHI is a loop close phi node. */
+
+static bool
+scalar_close_phi_node_p (gimple phi)
+{
+ gcc_assert (gimple_code (phi) == GIMPLE_PHI);
+
+ if (!is_gimple_reg (gimple_phi_result (phi)))
+ return false;
+
+ return (gimple_phi_num_args (phi) == 1);
+}
+
+/* Rewrite out of SSA the reduction phi node at PSI by creating a zero
+ dimension array for it. */
+
+static void
+rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi)
+{
+ gimple phi = gsi_stmt (*psi);
+ tree res = gimple_phi_result (phi);
+ tree var = SSA_NAME_VAR (res);
+ tree zero_dim_array = create_zero_dim_array (var);
+ gimple_stmt_iterator gsi = gsi_after_labels (gimple_bb (phi));
+ gimple stmt = gimple_build_assign (res, zero_dim_array);
+ tree arg = gimple_phi_arg_def (phi, 0);
+
+ insert_out_of_ssa_copy (zero_dim_array, arg);
+
+ remove_phi_node (psi, false);
+ gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
+ SSA_NAME_DEF_STMT (res) = stmt;
+}
+
+/* Rewrite out of SSA the reduction phi node at PSI by creating a zero
+ dimension array for it. */
+
+static void
+rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi)
+{
+ size_t i;
+ gimple phi = gsi_stmt (*psi);
+ basic_block bb = gimple_bb (phi);
+ tree res = gimple_phi_result (phi);
+ tree var = SSA_NAME_VAR (res);
+ tree zero_dim_array = create_zero_dim_array (var);
+ gimple_stmt_iterator gsi;
+ gimple stmt;
+ gimple_seq stmts;
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ {
+ tree arg = gimple_phi_arg_def (phi, i);
+
+ /* Try to avoid the insertion on edges as much as possible: this
+ would avoid the insertion of code on loop latch edges, making
+ the pattern matching of the vectorizer happy, or it would
+ avoid the insertion of useless basic blocks. Note that it is
+ incorrect to insert out of SSA copies close by their
+ definition when they are more than two loop levels apart:
+ for example, starting from a double nested loop
+
+ | a = ...
+ | loop_1
+ | loop_2
+ | b = phi (a, c)
+ | c = ...
+ | end_2
+ | end_1
+
+ the following transform is incorrect
+
+ | a = ...
+ | Red[0] = a
+ | loop_1
+ | loop_2
+ | b = Red[0]
+ | c = ...
+ | Red[0] = c
+ | end_2
+ | end_1
+
+ whereas inserting the copy on the incomming edge is correct
+
+ | a = ...
+ | loop_1
+ | Red[0] = a
+ | loop_2
+ | b = Red[0]
+ | c = ...
+ | Red[0] = c
+ | end_2
+ | end_1
+ */
+ if (TREE_CODE (arg) == SSA_NAME
+ && is_gimple_reg (arg)
+ && gimple_bb (SSA_NAME_DEF_STMT (arg))
+ && (flow_bb_inside_loop_p (bb->loop_father,
+ gimple_bb (SSA_NAME_DEF_STMT (arg)))
+ || flow_bb_inside_loop_p (loop_outer (bb->loop_father),
+ gimple_bb (SSA_NAME_DEF_STMT (arg)))))
+ insert_out_of_ssa_copy (zero_dim_array, arg);
+ else
+ insert_out_of_ssa_copy_on_edge (gimple_phi_arg_edge (phi, i),
+ zero_dim_array, arg);
+ }
+
+ var = force_gimple_operand (zero_dim_array, &stmts, true, NULL_TREE);
+
+ if (!stmts)
+ stmts = gimple_seq_alloc ();
+
+ stmt = gimple_build_assign (res, var);
+ remove_phi_node (psi, false);
+ SSA_NAME_DEF_STMT (res) = stmt;
+
+ gsi = gsi_last (stmts);
+ gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
+
+ gsi = gsi_after_labels (bb);
+ gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
+}
+
+/* Rewrite out of SSA all the reduction phi nodes of SCOP. */
+
+static void
+rewrite_reductions_out_of_ssa (scop_p scop)
+{
+ basic_block bb;
+ gimple_stmt_iterator psi;
+ sese region = SCOP_REGION (scop);
+
+ FOR_EACH_BB (bb)
+ if (bb_in_region (bb, SESE_ENTRY_BB (region), SESE_EXIT_BB (region)))
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi);)
+ {
+ if (scalar_close_phi_node_p (gsi_stmt (psi)))
+ rewrite_close_phi_out_of_ssa (&psi);
+ else if (reduction_phi_p (region, &psi))
+ rewrite_phi_out_of_ssa (&psi);
+ }
+
+ update_ssa (TODO_update_ssa);
+#ifdef ENABLE_CHECKING
+ verify_ssa (false);
+ verify_loop_closed_ssa ();
+#endif
+}
+
+/* Returns the number of pbbs that are in loops contained in SCOP. */
+
+static int
+nb_pbbs_in_loops (scop_p scop)
+{
+ int i;
+ poly_bb_p pbb;
+ int res = 0;
+
+ for (i = 0; VEC_iterate (poly_bb_p, SCOP_BBS (scop), i, pbb); i++)
+ if (loop_in_sese_p (gbb_loop (PBB_BLACK_BOX (pbb)), SCOP_REGION (scop)))
+ res++;
+
+ return res;
+}
+
+/* Builds the polyhedral representation for a SESE region. */
+
+bool
+build_poly_scop (scop_p scop)
+{
+ sese region = SCOP_REGION (scop);
+ rewrite_reductions_out_of_ssa (scop);
+ build_scop_bbs (scop);
+
+ /* FIXME: This restriction is needed to avoid a problem in CLooG.
+ Once CLooG is fixed, remove this guard. Anyways, it makes no
+ sense to optimize a scop containing only PBBs that do not belong
+ to any loops. */
+ if (nb_pbbs_in_loops (scop) == 0)
+ return false;
+
+ build_sese_loop_nests (region);
+ build_sese_conditions (region);
+ find_scop_parameters (scop);
+
+ build_scop_iteration_domain (scop);
+ build_scop_context (scop);
+
+ add_conditions_to_constraints (scop);
+ build_scop_scattering (scop);
+ build_scop_drs (scop);
+
+ return true;
+}
+
+/* Always return false. Exercise the scop_to_clast function. */
+
+void
+check_poly_representation (scop_p scop)
+{
+#ifdef ENABLE_CHECKING
+ cloog_prog_clast pc = scop_to_clast (scop);
+ cloog_clast_free (pc.stmt);
+ cloog_program_free (pc.prog);
+#endif
+}
+#endif
diff --git a/gcc/graphite-sese-to-poly.h b/gcc/graphite-sese-to-poly.h
new file mode 100644
index 00000000000..d6df07f6ef5
--- /dev/null
+++ b/gcc/graphite-sese-to-poly.h
@@ -0,0 +1,27 @@
+/* Conversion of SESE regions to Polyhedra.
+ Copyright (C) 2009 Free Software Foundation, Inc.
+ Contributed by Sebastian Pop <sebastian.pop@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_GRAPHITE_SESE_TO_POLY_H
+#define GCC_GRAPHITE_SESE_TO_POLY_H
+
+bool build_poly_scop (scop_p);
+void check_poly_representation (scop_p);
+
+#endif
diff --git a/gcc/graphite.c b/gcc/graphite.c
index a87bca867c9..5e892635268 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -20,12 +20,12 @@ along with GCC; see the file COPYING3. If not see
/* This pass converts GIMPLE to GRAPHITE, performs some loop
transformations and then converts the resulting representation back
- to GIMPLE.
+ to GIMPLE.
An early description of this pass can be found in the GCC Summit'06
paper "GRAPHITE: Polyhedral Analyses and Optimizations for GCC".
The wiki page http://gcc.gnu.org/wiki/Graphite contains pointers to
- the related work.
+ the related work.
One important document to read is CLooG's internal manual:
http://repo.or.cz/w/cloog-ppl.git?a=blob_plain;f=doc/cloog.texi;hb=HEAD
@@ -53,6052 +53,190 @@ along with GCC; see the file COPYING3. If not see
#include "value-prof.h"
#include "pointer-set.h"
#include "gimple.h"
+#include "sese.h"
+#include "predict.h"
#ifdef HAVE_cloog
-/* The CLooG header file is not -Wc++-compat ready as of 2009-05-11.
- This #pragma should be removed when it is ready. */
-#if GCC_VERSION >= 4003
-#pragma GCC diagnostic warning "-Wc++-compat"
-#endif
-
#include "cloog/cloog.h"
+#include "ppl_c.h"
+#include "graphite-ppl.h"
#include "graphite.h"
+#include "graphite-poly.h"
+#include "graphite-scop-detection.h"
+#include "graphite-clast-to-gimple.h"
+#include "graphite-sese-to-poly.h"
-static VEC (scop_p, heap) *current_scops;
-
-/* Converts a GMP constant V to a tree and returns it. */
-
-static tree
-gmp_cst_to_tree (tree type, Value v)
-{
- return build_int_cst (type, value_get_si (v));
-}
-
-/* Returns true when BB is in REGION. */
-
-static bool
-bb_in_sese_p (basic_block bb, sese region)
-{
- return pointer_set_contains (SESE_REGION_BBS (region), bb);
-}
-
-/* Returns true when LOOP is in the SESE region R. */
-
-static inline bool
-loop_in_sese_p (struct loop *loop, sese r)
-{
- return (bb_in_sese_p (loop->header, r)
- && bb_in_sese_p (loop->latch, r));
-}
-
-/* For a USE in BB, if BB is outside REGION, mark the USE in the
- SESE_LIVEIN and SESE_LIVEOUT sets. */
+/* Print global statistics to FILE. */
static void
-sese_build_livein_liveouts_use (sese region, basic_block bb, tree use)
+print_global_statistics (FILE* file)
{
- unsigned ver;
- basic_block def_bb;
-
- if (TREE_CODE (use) != SSA_NAME)
- return;
-
- ver = SSA_NAME_VERSION (use);
- def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
- if (!def_bb
- || !bb_in_sese_p (def_bb, region)
- || bb_in_sese_p (bb, region))
- return;
-
- if (!SESE_LIVEIN_VER (region, ver))
- SESE_LIVEIN_VER (region, ver) = BITMAP_ALLOC (NULL);
-
- bitmap_set_bit (SESE_LIVEIN_VER (region, ver), bb->index);
- bitmap_set_bit (SESE_LIVEOUT (region), ver);
-}
-
-/* Marks for rewrite all the SSA_NAMES defined in REGION and that are
- used in BB that is outside of the REGION. */
-
-static void
-sese_build_livein_liveouts_bb (sese region, basic_block bb)
-{
- gimple_stmt_iterator bsi;
- edge e;
- edge_iterator ei;
- ssa_op_iter iter;
- tree var;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
- sese_build_livein_liveouts_use (region, bb,
- PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e));
-
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- FOR_EACH_SSA_TREE_OPERAND (var, gsi_stmt (bsi), iter, SSA_OP_ALL_USES)
- sese_build_livein_liveouts_use (region, bb, var);
-}
-
-/* Build the SESE_LIVEIN and SESE_LIVEOUT for REGION. */
+ long n_bbs = 0;
+ long n_loops = 0;
+ long n_stmts = 0;
+ long n_conditions = 0;
+ long n_p_bbs = 0;
+ long n_p_loops = 0;
+ long n_p_stmts = 0;
+ long n_p_conditions = 0;
-void
-sese_build_livein_liveouts (sese region)
-{
basic_block bb;
- SESE_LIVEOUT (region) = BITMAP_ALLOC (NULL);
- SESE_NUM_VER (region) = num_ssa_names;
- SESE_LIVEIN (region) = XCNEWVEC (bitmap, SESE_NUM_VER (region));
-
- FOR_EACH_BB (bb)
- sese_build_livein_liveouts_bb (region, bb);
-}
-
-/* Register basic blocks belonging to a region in a pointer set. */
-
-static void
-register_bb_in_sese (basic_block entry_bb, basic_block exit_bb, sese region)
-{
- edge_iterator ei;
- edge e;
- basic_block bb = entry_bb;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- {
- if (!pointer_set_contains (SESE_REGION_BBS (region), e->dest) &&
- e->dest->index != exit_bb->index)
- {
- pointer_set_insert (SESE_REGION_BBS (region), e->dest);
- register_bb_in_sese (e->dest, exit_bb, region);
- }
- }
-}
-
-/* Builds a new SESE region from edges ENTRY and EXIT. */
-
-sese
-new_sese (edge entry, edge exit)
-{
- sese res = XNEW (struct sese_d);
-
- SESE_ENTRY (res) = entry;
- SESE_EXIT (res) = exit;
- SESE_REGION_BBS (res) = pointer_set_create ();
- register_bb_in_sese (entry->dest, exit->dest, res);
-
- SESE_LIVEOUT (res) = NULL;
- SESE_NUM_VER (res) = 0;
- SESE_LIVEIN (res) = NULL;
-
- return res;
-}
-
-/* Deletes REGION. */
-
-void
-free_sese (sese region)
-{
- int i;
-
- for (i = 0; i < SESE_NUM_VER (region); i++)
- BITMAP_FREE (SESE_LIVEIN_VER (region, i));
-
- if (SESE_LIVEIN (region))
- free (SESE_LIVEIN (region));
-
- if (SESE_LIVEOUT (region))
- BITMAP_FREE (SESE_LIVEOUT (region));
-
- pointer_set_destroy (SESE_REGION_BBS (region));
- XDELETE (region);
-}
-
-
-
-/* Debug the list of old induction variables for this SCOP. */
-
-void
-debug_oldivs (scop_p scop)
-{
- int i;
- name_tree oldiv;
-
- fprintf (stderr, "Old IVs:");
-
- for (i = 0; VEC_iterate (name_tree, SCOP_OLDIVS (scop), i, oldiv); i++)
- {
- fprintf (stderr, "(");
- print_generic_expr (stderr, oldiv->t, 0);
- fprintf (stderr, ", %s, %d)\n", oldiv->name, oldiv->loop->num);
- }
- fprintf (stderr, "\n");
-}
-
-/* Debug the loops around basic block GB. */
-
-void
-debug_loop_vec (graphite_bb_p gb)
-{
- int i;
- loop_p loop;
-
- fprintf (stderr, "Loop Vec:");
-
- for (i = 0; VEC_iterate (loop_p, GBB_LOOPS (gb), i, loop); i++)
- fprintf (stderr, "%d: %d, ", i, loop ? loop->num : -1);
-
- fprintf (stderr, "\n");
-}
-
-/* Returns true if stack ENTRY is a constant. */
-
-static bool
-iv_stack_entry_is_constant (iv_stack_entry *entry)
-{
- return entry->kind == iv_stack_entry_const;
-}
-
-/* Returns true if stack ENTRY is an induction variable. */
-
-static bool
-iv_stack_entry_is_iv (iv_stack_entry *entry)
-{
- return entry->kind == iv_stack_entry_iv;
-}
-
-/* Push (IV, NAME) on STACK. */
-
-static void
-loop_iv_stack_push_iv (loop_iv_stack stack, tree iv, const char *name)
-{
- iv_stack_entry *entry = XNEW (iv_stack_entry);
- name_tree named_iv = XNEW (struct name_tree_d);
-
- named_iv->t = iv;
- named_iv->name = name;
-
- entry->kind = iv_stack_entry_iv;
- entry->data.iv = named_iv;
-
- VEC_safe_push (iv_stack_entry_p, heap, *stack, entry);
-}
-
-/* Inserts a CONSTANT in STACK at INDEX. */
-
-static void
-loop_iv_stack_insert_constant (loop_iv_stack stack, int index,
- tree constant)
-{
- iv_stack_entry *entry = XNEW (iv_stack_entry);
-
- entry->kind = iv_stack_entry_const;
- entry->data.constant = constant;
-
- VEC_safe_insert (iv_stack_entry_p, heap, *stack, index, entry);
-}
-
-/* Pops and frees an element out of STACK. */
-
-static void
-loop_iv_stack_pop (loop_iv_stack stack)
-{
- iv_stack_entry_p entry = VEC_pop (iv_stack_entry_p, *stack);
-
- free (entry->data.iv);
- free (entry);
-}
-
-/* Get the IV at INDEX in STACK. */
-
-static tree
-loop_iv_stack_get_iv (loop_iv_stack stack, int index)
-{
- iv_stack_entry_p entry = VEC_index (iv_stack_entry_p, *stack, index);
- iv_stack_entry_data data = entry->data;
-
- return iv_stack_entry_is_iv (entry) ? data.iv->t : data.constant;
-}
-
-/* Get the IV from its NAME in STACK. */
-
-static tree
-loop_iv_stack_get_iv_from_name (loop_iv_stack stack, const char* name)
-{
- int i;
- iv_stack_entry_p entry;
-
- for (i = 0; VEC_iterate (iv_stack_entry_p, *stack, i, entry); i++)
+ FOR_ALL_BB (bb)
{
- name_tree iv = entry->data.iv;
- if (!strcmp (name, iv->name))
- return iv->t;
- }
+ gimple_stmt_iterator psi;
- return NULL;
-}
-
-/* Prints on stderr the contents of STACK. */
-
-void
-debug_loop_iv_stack (loop_iv_stack stack)
-{
- int i;
- iv_stack_entry_p entry;
- bool first = true;
-
- fprintf (stderr, "(");
-
- for (i = 0; VEC_iterate (iv_stack_entry_p, *stack, i, entry); i++)
- {
- if (first)
- first = false;
- else
- fprintf (stderr, " ");
+ n_bbs++;
+ n_p_bbs += bb->count;
- if (iv_stack_entry_is_iv (entry))
- {
- name_tree iv = entry->data.iv;
- fprintf (stderr, "%s:", iv->name);
- print_generic_expr (stderr, iv->t, 0);
- }
- else
+ /* Ignore artificial surrounding loop. */
+ if (bb == bb->loop_father->header
+ && bb->index != 0)
{
- tree constant = entry->data.constant;
- print_generic_expr (stderr, constant, 0);
- fprintf (stderr, ":");
- print_generic_expr (stderr, constant, 0);
+ n_loops++;
+ n_p_loops += bb->count;
}
- }
-
- fprintf (stderr, ")\n");
-}
-
-/* Frees STACK. */
-
-static void
-free_loop_iv_stack (loop_iv_stack stack)
-{
- int i;
- iv_stack_entry_p entry;
-
- for (i = 0; VEC_iterate (iv_stack_entry_p, *stack, i, entry); i++)
- {
- free (entry->data.iv);
- free (entry);
- }
-
- VEC_free (iv_stack_entry_p, heap, *stack);
-}
-
-
-
-/* Structure containing the mapping between the CLooG's induction
- variable and the type of the old induction variable. */
-typedef struct ivtype_map_elt_d
-{
- tree type;
- const char *cloog_iv;
-} *ivtype_map_elt;
-
-/* Print to stderr the element ELT. */
-
-static void
-debug_ivtype_elt (ivtype_map_elt elt)
-{
- fprintf (stderr, "(%s, ", elt->cloog_iv);
- print_generic_expr (stderr, elt->type, 0);
- fprintf (stderr, ")\n");
-}
-
-/* Helper function for debug_ivtype_map. */
-
-static int
-debug_ivtype_map_1 (void **slot, void *s ATTRIBUTE_UNUSED)
-{
- struct ivtype_map_elt_d *entry = (struct ivtype_map_elt_d *) *slot;
- debug_ivtype_elt (entry);
- return 1;
-}
-
-/* Print to stderr all the elements of MAP. */
-
-void
-debug_ivtype_map (htab_t map)
-{
- htab_traverse (map, debug_ivtype_map_1, NULL);
-}
-
-/* Constructs a new SCEV_INFO_STR structure for VAR and INSTANTIATED_BELOW. */
-
-static inline ivtype_map_elt
-new_ivtype_map_elt (const char *cloog_iv, tree type)
-{
- ivtype_map_elt res;
-
- res = XNEW (struct ivtype_map_elt_d);
- res->cloog_iv = cloog_iv;
- res->type = type;
-
- return res;
-}
-
-/* Computes a hash function for database element ELT. */
-
-static hashval_t
-ivtype_map_elt_info (const void *elt)
-{
- return htab_hash_pointer (((const struct ivtype_map_elt_d *) elt)->cloog_iv);
-}
-
-/* Compares database elements E1 and E2. */
-
-static int
-eq_ivtype_map_elts (const void *e1, const void *e2)
-{
- const struct ivtype_map_elt_d *elt1 = (const struct ivtype_map_elt_d *) e1;
- const struct ivtype_map_elt_d *elt2 = (const struct ivtype_map_elt_d *) e2;
-
- return (elt1->cloog_iv == elt2->cloog_iv);
-}
-
-
-
-/* Given a CLOOG_IV, returns the type that it should have in GCC land.
- If the information is not available, i.e. in the case one of the
- transforms created the loop, just return integer_type_node. */
-
-static tree
-gcc_type_for_cloog_iv (const char *cloog_iv, graphite_bb_p gbb)
-{
- struct ivtype_map_elt_d tmp;
- PTR *slot;
-
- tmp.cloog_iv = cloog_iv;
- slot = htab_find_slot (GBB_CLOOG_IV_TYPES (gbb), &tmp, NO_INSERT);
- if (slot && *slot)
- return ((ivtype_map_elt) *slot)->type;
-
- return integer_type_node;
-}
-
-/* Inserts constants derived from the USER_STMT argument list into the
- STACK. This is needed to map old ivs to constants when loops have
- been eliminated. */
-
-static void
-loop_iv_stack_patch_for_consts (loop_iv_stack stack,
- struct clast_user_stmt *user_stmt)
-{
- struct clast_stmt *t;
- int index = 0;
- CloogStatement *cs = user_stmt->statement;
- graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
-
- for (t = user_stmt->substitutions; t; t = t->next)
- {
- struct clast_expr *expr = (struct clast_expr *)
- ((struct clast_assignment *)t)->RHS;
- struct clast_term *term = (struct clast_term *) expr;
-
- /* FIXME: What should be done with expr_bin, expr_red? */
- if (expr->type == expr_term
- && !term->var)
+ if (VEC_length (edge, bb->succs) > 1)
{
- loop_p loop = gbb_loop_at_index (gbb, index);
- tree oldiv = oldiv_for_loop (GBB_SCOP (gbb), loop);
- tree type = oldiv ? TREE_TYPE (oldiv) : integer_type_node;
- tree value = gmp_cst_to_tree (type, term->val);
- loop_iv_stack_insert_constant (stack, index, value);
+ n_conditions++;
+ n_p_conditions += bb->count;
}
- index = index + 1;
- }
-}
-
-/* Removes all constants in the iv STACK. */
-static void
-loop_iv_stack_remove_constants (loop_iv_stack stack)
-{
- int i;
- iv_stack_entry *entry;
-
- for (i = 0; VEC_iterate (iv_stack_entry_p, *stack, i, entry);)
- {
- if (iv_stack_entry_is_constant (entry))
+ for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- free (VEC_index (iv_stack_entry_p, *stack, i));
- VEC_ordered_remove (iv_stack_entry_p, *stack, i);
+ n_stmts++;
+ n_p_stmts += bb->count;
}
- else
- i++;
}
-}
-
-/* Returns a new loop_to_cloog_loop_str structure. */
-
-static inline struct loop_to_cloog_loop_str *
-new_loop_to_cloog_loop_str (int loop_num,
- int loop_position,
- CloogLoop *cloog_loop)
-{
- struct loop_to_cloog_loop_str *result;
-
- result = XNEW (struct loop_to_cloog_loop_str);
- result->loop_num = loop_num;
- result->cloog_loop = cloog_loop;
- result->loop_position = loop_position;
-
- return result;
-}
-
-/* Hash function for SCOP_LOOP2CLOOG_LOOP hash table. */
-
-static hashval_t
-hash_loop_to_cloog_loop (const void *elt)
-{
- return ((const struct loop_to_cloog_loop_str *) elt)->loop_num;
-}
-
-/* Equality function for SCOP_LOOP2CLOOG_LOOP hash table. */
-
-static int
-eq_loop_to_cloog_loop (const void *el1, const void *el2)
-{
- const struct loop_to_cloog_loop_str *elt1, *elt2;
- elt1 = (const struct loop_to_cloog_loop_str *) el1;
- elt2 = (const struct loop_to_cloog_loop_str *) el2;
- return elt1->loop_num == elt2->loop_num;
+ fprintf (file, "\nGlobal statistics (");
+ fprintf (file, "BBS:%ld, ", n_bbs);
+ fprintf (file, "LOOPS:%ld, ", n_loops);
+ fprintf (file, "CONDITIONS:%ld, ", n_conditions);
+ fprintf (file, "STMTS:%ld)\n", n_stmts);
+ fprintf (file, "\nGlobal profiling statistics (");
+ fprintf (file, "BBS:%ld, ", n_p_bbs);
+ fprintf (file, "LOOPS:%ld, ", n_p_loops);
+ fprintf (file, "CONDITIONS:%ld, ", n_p_conditions);
+ fprintf (file, "STMTS:%ld)\n", n_p_stmts);
}
-/* Compares two graphite bbs and returns an integer less than, equal to, or
- greater than zero if the first argument is considered to be respectively
- less than, equal to, or greater than the second.
- We compare using the lexicographic order of the static schedules. */
-
-static int
-gbb_compare (const void *p_1, const void *p_2)
-{
- const struct graphite_bb *const gbb_1
- = *(const struct graphite_bb *const*) p_1;
- const struct graphite_bb *const gbb_2
- = *(const struct graphite_bb *const*) p_2;
-
- return lambda_vector_compare (GBB_STATIC_SCHEDULE (gbb_1),
- gbb_nb_loops (gbb_1) + 1,
- GBB_STATIC_SCHEDULE (gbb_2),
- gbb_nb_loops (gbb_2) + 1);
-}
-
-/* Sort graphite bbs in SCOP. */
+/* Print statistics for SCOP to FILE. */
static void
-graphite_sort_gbbs (scop_p scop)
-{
- VEC (graphite_bb_p, heap) *bbs = SCOP_BBS (scop);
-
- qsort (VEC_address (graphite_bb_p, bbs),
- VEC_length (graphite_bb_p, bbs),
- sizeof (graphite_bb_p), gbb_compare);
-}
-
-/* Dump conditions of a graphite basic block GBB on FILE. */
-
-static void
-dump_gbb_conditions (FILE *file, graphite_bb_p gbb)
-{
- int i;
- gimple stmt;
- VEC (gimple, heap) *conditions = GBB_CONDITIONS (gbb);
-
- if (VEC_empty (gimple, conditions))
- return;
-
- fprintf (file, "\tbb %d\t: cond = {", GBB_BB (gbb)->index);
-
- for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
- print_gimple_stmt (file, stmt, 0, 0);
-
- fprintf (file, "}\n");
-}
-
-/* Converts the graphite scheduling function into a cloog scattering
- matrix. This scattering matrix is used to limit the possible cloog
- output to valid programs in respect to the scheduling function.
-
- SCATTERING_DIMENSIONS specifies the dimensionality of the scattering
- matrix. CLooG 0.14.0 and previous versions require, that all scattering
- functions of one CloogProgram have the same dimensionality, therefore we
- allow to specify it. (Should be removed in future versions) */
-
-static CloogMatrix *
-schedule_to_scattering (graphite_bb_p gb, int scattering_dimensions)
+print_graphite_scop_statistics (FILE* file, scop_p scop)
{
- int i;
- scop_p scop = GBB_SCOP (gb);
-
- int nb_iterators = gbb_nb_loops (gb);
-
- /* The cloog scattering matrix consists of these colums:
- 1 col = Eq/Inq,
- scattering_dimensions cols = Scattering dimensions,
- nb_iterators cols = bb's iterators,
- scop_nb_params cols = Parameters,
- 1 col = Constant 1.
-
- Example:
-
- scattering_dimensions = 5
- max_nb_iterators = 2
- nb_iterators = 1
- scop_nb_params = 2
-
- Schedule:
- ? i
- 4 5
-
- Scattering Matrix:
- s1 s2 s3 s4 s5 i p1 p2 1
- 1 0 0 0 0 0 0 0 -4 = 0
- 0 1 0 0 0 -1 0 0 0 = 0
- 0 0 1 0 0 0 0 0 -5 = 0 */
- int nb_params = scop_nb_params (scop);
- int nb_cols = 1 + scattering_dimensions + nb_iterators + nb_params + 1;
- int col_const = nb_cols - 1;
- int col_iter_offset = 1 + scattering_dimensions;
-
- CloogMatrix *scat = cloog_matrix_alloc (scattering_dimensions, nb_cols);
-
- gcc_assert (scattering_dimensions >= nb_iterators * 2 + 1);
+ long n_bbs = 0;
+ long n_loops = 0;
+ long n_stmts = 0;
+ long n_conditions = 0;
+ long n_p_bbs = 0;
+ long n_p_loops = 0;
+ long n_p_stmts = 0;
+ long n_p_conditions = 0;
- /* Initialize the identity matrix. */
- for (i = 0; i < scattering_dimensions; i++)
- value_set_si (scat->p[i][i + 1], 1);
-
- /* Textual order outside the first loop */
- value_set_si (scat->p[0][col_const], -GBB_STATIC_SCHEDULE (gb)[0]);
-
- /* For all surrounding loops. */
- for (i = 0; i < nb_iterators; i++)
- {
- int schedule = GBB_STATIC_SCHEDULE (gb)[i + 1];
-
- /* Iterations of this loop. */
- value_set_si (scat->p[2 * i + 1][col_iter_offset + i], -1);
-
- /* Textual order inside this loop. */
- value_set_si (scat->p[2 * i + 2][col_const], -schedule);
- }
-
- return scat;
-}
-
-/* Print the schedules of GB to FILE with INDENT white spaces before.
- VERBOSITY determines how verbose the code pretty printers are. */
-
-void
-print_graphite_bb (FILE *file, graphite_bb_p gb, int indent, int verbosity)
-{
- CloogMatrix *scattering;
- int i;
- loop_p loop;
- fprintf (file, "\nGBB (\n");
-
- print_loops_bb (file, GBB_BB (gb), indent+2, verbosity);
-
- if (GBB_DOMAIN (gb))
- {
- fprintf (file, " (domain: \n");
- cloog_matrix_print (file, GBB_DOMAIN (gb));
- fprintf (file, " )\n");
- }
-
- if (GBB_STATIC_SCHEDULE (gb))
- {
- fprintf (file, " (static schedule: ");
- print_lambda_vector (file, GBB_STATIC_SCHEDULE (gb),
- gbb_nb_loops (gb) + 1);
- fprintf (file, " )\n");
- }
-
- if (GBB_LOOPS (gb))
- {
- fprintf (file, " (contained loops: \n");
- for (i = 0; VEC_iterate (loop_p, GBB_LOOPS (gb), i, loop); i++)
- if (loop == NULL)
- fprintf (file, " iterator %d => NULL \n", i);
- else
- fprintf (file, " iterator %d => loop %d \n", i,
- loop->num);
- fprintf (file, " )\n");
- }
-
- if (GBB_DATA_REFS (gb))
- dump_data_references (file, GBB_DATA_REFS (gb));
-
- if (GBB_CONDITIONS (gb))
- {
- fprintf (file, " (conditions: \n");
- dump_gbb_conditions (file, gb);
- fprintf (file, " )\n");
- }
-
- if (GBB_SCOP (gb)
- && GBB_STATIC_SCHEDULE (gb))
- {
- fprintf (file, " (scattering: \n");
- scattering = schedule_to_scattering (gb, 2 * gbb_nb_loops (gb) + 1);
- cloog_matrix_print (file, scattering);
- cloog_matrix_free (scattering);
- fprintf (file, " )\n");
- }
-
- fprintf (file, ")\n");
-}
-
-/* Print to STDERR the schedules of GB with VERBOSITY level. */
-
-void
-debug_gbb (graphite_bb_p gb, int verbosity)
-{
- print_graphite_bb (stderr, gb, 0, verbosity);
-}
-
-
-/* Print SCOP to FILE. VERBOSITY determines how verbose the pretty
- printers are. */
-
-static void
-print_scop (FILE *file, scop_p scop, int verbosity)
-{
- if (scop == NULL)
- return;
-
- fprintf (file, "\nSCoP_%d_%d (\n",
- SCOP_ENTRY (scop)->index, SCOP_EXIT (scop)->index);
-
- fprintf (file, " (cloog: \n");
- cloog_program_print (file, SCOP_PROG (scop));
- fprintf (file, " )\n");
-
- if (SCOP_BBS (scop))
- {
- graphite_bb_p gb;
- int i;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- print_graphite_bb (file, gb, 0, verbosity);
- }
-
- fprintf (file, ")\n");
-}
-
-/* Print all the SCOPs to FILE. VERBOSITY determines how verbose the
- code pretty printers are. */
-
-static void
-print_scops (FILE *file, int verbosity)
-{
- int i;
- scop_p scop;
-
- for (i = 0; VEC_iterate (scop_p, current_scops, i, scop); i++)
- print_scop (file, scop, verbosity);
-}
-
-/* Debug SCOP. VERBOSITY determines how verbose the code pretty
- printers are. */
-
-void
-debug_scop (scop_p scop, int verbosity)
-{
- print_scop (stderr, scop, verbosity);
-}
-
-/* Debug all SCOPs from CURRENT_SCOPS. VERBOSITY determines how
- verbose the code pretty printers are. */
-
-void
-debug_scops (int verbosity)
-{
- print_scops (stderr, verbosity);
-}
-
-/* Pretty print to FILE the SCOP in DOT format. */
-
-static void
-dot_scop_1 (FILE *file, scop_p scop)
-{
- edge e;
- edge_iterator ei;
basic_block bb;
- basic_block entry = SCOP_ENTRY (scop);
- basic_block exit = SCOP_EXIT (scop);
-
- fprintf (file, "digraph SCoP_%d_%d {\n", entry->index,
- exit->index);
FOR_ALL_BB (bb)
{
- if (bb == entry)
- fprintf (file, "%d [shape=triangle];\n", bb->index);
-
- if (bb == exit)
- fprintf (file, "%d [shape=box];\n", bb->index);
-
- if (bb_in_sese_p (bb, SCOP_REGION (scop)))
- fprintf (file, "%d [color=red];\n", bb->index);
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
- }
-
- fputs ("}\n\n", file);
-}
-
-/* Display SCOP using dotty. */
-
-void
-dot_scop (scop_p scop)
-{
- dot_scop_1 (stderr, scop);
-}
-
-/* Pretty print all SCoPs in DOT format and mark them with different colors.
- If there are not enough colors, paint later SCoPs gray.
- Special nodes:
- - "*" after the node number: entry of a SCoP,
- - "#" after the node number: exit of a SCoP,
- - "()" entry or exit not part of SCoP. */
-
-static void
-dot_all_scops_1 (FILE *file)
-{
- basic_block bb;
- edge e;
- edge_iterator ei;
- scop_p scop;
- const char* color;
- int i;
-
- /* Disable debugging while printing graph. */
- int tmp_dump_flags = dump_flags;
- dump_flags = 0;
-
- fprintf (file, "digraph all {\n");
-
- FOR_ALL_BB (bb)
- {
- int part_of_scop = false;
-
- /* Use HTML for every bb label. So we are able to print bbs
- which are part of two different SCoPs, with two different
- background colors. */
- fprintf (file, "%d [label=<\n <TABLE BORDER=\"0\" CELLBORDER=\"1\" ",
- bb->index);
- fprintf (file, "CELLSPACING=\"0\">\n");
-
- /* Select color for SCoP. */
- for (i = 0; VEC_iterate (scop_p, current_scops, i, scop); i++)
- if (bb_in_sese_p (bb, SCOP_REGION (scop))
- || (SCOP_EXIT (scop) == bb)
- || (SCOP_ENTRY (scop) == bb))
- {
- switch (i % 17)
- {
- case 0: /* red */
- color = "#e41a1c";
- break;
- case 1: /* blue */
- color = "#377eb8";
- break;
- case 2: /* green */
- color = "#4daf4a";
- break;
- case 3: /* purple */
- color = "#984ea3";
- break;
- case 4: /* orange */
- color = "#ff7f00";
- break;
- case 5: /* yellow */
- color = "#ffff33";
- break;
- case 6: /* brown */
- color = "#a65628";
- break;
- case 7: /* rose */
- color = "#f781bf";
- break;
- case 8:
- color = "#8dd3c7";
- break;
- case 9:
- color = "#ffffb3";
- break;
- case 10:
- color = "#bebada";
- break;
- case 11:
- color = "#fb8072";
- break;
- case 12:
- color = "#80b1d3";
- break;
- case 13:
- color = "#fdb462";
- break;
- case 14:
- color = "#b3de69";
- break;
- case 15:
- color = "#fccde5";
- break;
- case 16:
- color = "#bc80bd";
- break;
- default: /* gray */
- color = "#999999";
- }
-
- fprintf (file, " <TR><TD WIDTH=\"50\" BGCOLOR=\"%s\">", color);
-
- if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
- fprintf (file, " (");
-
- if (bb == SCOP_ENTRY (scop)
- && bb == SCOP_EXIT (scop))
- fprintf (file, " %d*# ", bb->index);
- else if (bb == SCOP_ENTRY (scop))
- fprintf (file, " %d* ", bb->index);
- else if (bb == SCOP_EXIT (scop))
- fprintf (file, " %d# ", bb->index);
- else
- fprintf (file, " %d ", bb->index);
-
- if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
- fprintf (file, ")");
-
- fprintf (file, "</TD></TR>\n");
- part_of_scop = true;
- }
-
- if (!part_of_scop)
- {
- fprintf (file, " <TR><TD WIDTH=\"50\" BGCOLOR=\"#ffffff\">");
- fprintf (file, " %d </TD></TR>\n", bb->index);
- }
-
- fprintf (file, " </TABLE>>, shape=box, style=\"setlinewidth(0)\"]\n");
- }
-
- FOR_ALL_BB (bb)
- {
- FOR_EACH_EDGE (e, ei, bb->succs)
- fprintf (file, "%d -> %d;\n", bb->index, e->dest->index);
- }
-
- fputs ("}\n\n", file);
-
- /* Enable debugging again. */
- dump_flags = tmp_dump_flags;
-}
-
-/* Display all SCoPs using dotty. */
-
-void
-dot_all_scops (void)
-{
- /* When debugging, enable the following code. This cannot be used
- in production compilers because it calls "system". */
-#if 0
- FILE *stream = fopen ("/tmp/allscops.dot", "w");
- gcc_assert (stream);
-
- dot_all_scops_1 (stream);
- fclose (stream);
-
- system ("dotty /tmp/allscops.dot");
-#else
- dot_all_scops_1 (stderr);
-#endif
-}
-
-/* Returns the outermost loop in SCOP that contains BB. */
-
-static struct loop *
-outermost_loop_in_scop (scop_p scop, basic_block bb)
-{
- struct loop *nest;
-
- nest = bb->loop_father;
- while (loop_outer (nest)
- && loop_in_sese_p (loop_outer (nest), SCOP_REGION (scop)))
- nest = loop_outer (nest);
-
- return nest;
-}
-
-/* Returns the block preceding the entry of SCOP. */
-
-static basic_block
-block_before_scop (scop_p scop)
-{
- return SESE_ENTRY (SCOP_REGION (scop))->src;
-}
-
-/* Return true when EXPR is an affine function in LOOP with parameters
- instantiated relative to SCOP_ENTRY. */
-
-static bool
-loop_affine_expr (basic_block scop_entry, struct loop *loop, tree expr)
-{
- int n = loop->num;
- tree scev = analyze_scalar_evolution (loop, expr);
-
- scev = instantiate_scev (scop_entry, loop, scev);
-
- return (evolution_function_is_invariant_p (scev, n)
- || evolution_function_is_affine_multivariate_p (scev, n));
-}
-
-/* Return true if REF or any of its subtrees contains a
- component_ref. */
-
-static bool
-contains_component_ref_p (tree ref)
-{
- if (!ref)
- return false;
-
- while (handled_component_p (ref))
- {
- if (TREE_CODE (ref) == COMPONENT_REF)
- return true;
-
- ref = TREE_OPERAND (ref, 0);
- }
-
- return false;
-}
-
-/* Return true if the operand OP is simple. */
-
-static bool
-is_simple_operand (loop_p loop, gimple stmt, tree op)
-{
- /* It is not a simple operand when it is a declaration, */
- if (DECL_P (op)
- /* or a structure, */
- || AGGREGATE_TYPE_P (TREE_TYPE (op))
- /* or a COMPONENT_REF, */
- || contains_component_ref_p (op)
- /* or a memory access that cannot be analyzed by the data
- reference analysis. */
- || ((handled_component_p (op) || INDIRECT_REF_P (op))
- && !stmt_simple_memref_p (loop, stmt, op)))
- return false;
-
- return true;
-}
-
-/* Return true only when STMT is simple enough for being handled by
- Graphite. This depends on SCOP_ENTRY, as the parametetrs are
- initialized relatively to this basic block. */
-
-static bool
-stmt_simple_for_scop_p (basic_block scop_entry, gimple stmt)
-{
- basic_block bb = gimple_bb (stmt);
- struct loop *loop = bb->loop_father;
-
- /* GIMPLE_ASM and GIMPLE_CALL may embed arbitrary side effects.
- Calls have side-effects, except those to const or pure
- functions. */
- if (gimple_has_volatile_ops (stmt)
- || (gimple_code (stmt) == GIMPLE_CALL
- && !(gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE)))
- || (gimple_code (stmt) == GIMPLE_ASM))
- return false;
-
- switch (gimple_code (stmt))
- {
- case GIMPLE_RETURN:
- case GIMPLE_LABEL:
- return true;
-
- case GIMPLE_COND:
- {
- tree op;
- ssa_op_iter op_iter;
- enum tree_code code = gimple_cond_code (stmt);
-
- /* We can only handle this kind of conditional expressions.
- For inequalities like "if (i != 3 * k)" we need unions of
- polyhedrons. Expressions like "if (a)" or "if (a == 15)" need
- them for the else branch. */
- if (!(code == LT_EXPR
- || code == GT_EXPR
- || code == LE_EXPR
- || code == GE_EXPR))
- return false;
-
- if (!scop_entry)
- return false;
-
- FOR_EACH_SSA_TREE_OPERAND (op, stmt, op_iter, SSA_OP_ALL_USES)
- if (!loop_affine_expr (scop_entry, loop, op))
- return false;
-
- return true;
- }
-
- case GIMPLE_ASSIGN:
- {
- enum tree_code code = gimple_assign_rhs_code (stmt);
-
- switch (get_gimple_rhs_class (code))
- {
- case GIMPLE_UNARY_RHS:
- case GIMPLE_SINGLE_RHS:
- return (is_simple_operand (loop, stmt, gimple_assign_lhs (stmt))
- && is_simple_operand (loop, stmt, gimple_assign_rhs1 (stmt)));
-
- case GIMPLE_BINARY_RHS:
- return (is_simple_operand (loop, stmt, gimple_assign_lhs (stmt))
- && is_simple_operand (loop, stmt, gimple_assign_rhs1 (stmt))
- && is_simple_operand (loop, stmt, gimple_assign_rhs2 (stmt)));
-
- case GIMPLE_INVALID_RHS:
- default:
- gcc_unreachable ();
- }
- }
-
- case GIMPLE_CALL:
- {
- size_t i;
- size_t n = gimple_call_num_args (stmt);
- tree lhs = gimple_call_lhs (stmt);
-
- if (lhs && !is_simple_operand (loop, stmt, lhs))
- return false;
-
- for (i = 0; i < n; i++)
- if (!is_simple_operand (loop, stmt, gimple_call_arg (stmt, i)))
- return false;
-
- return true;
- }
-
- default:
- /* These nodes cut a new scope. */
- return false;
- }
-
- return false;
-}
-
-/* Returns the statement of BB that contains a harmful operation: that
- can be a function call with side effects, the induction variables
- are not linear with respect to SCOP_ENTRY, etc. The current open
- scop should end before this statement. */
-
-static gimple
-harmful_stmt_in_bb (basic_block scop_entry, basic_block bb)
-{
- gimple_stmt_iterator gsi;
- gimple stmt;
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- if (!stmt_simple_for_scop_p (scop_entry, gsi_stmt (gsi)))
- return gsi_stmt (gsi);
-
- stmt = last_stmt (bb);
- if (stmt && gimple_code (stmt) == GIMPLE_COND)
- {
- tree lhs = gimple_cond_lhs (stmt);
- tree rhs = gimple_cond_rhs (stmt);
-
- if (TREE_CODE (TREE_TYPE (lhs)) == REAL_TYPE
- || TREE_CODE (TREE_TYPE (rhs)) == REAL_TYPE)
- return stmt;
- }
-
- return NULL;
-}
-
-/* Returns true when BB will be represented in graphite. Return false
- for the basic blocks that contain code eliminated in the code
- generation pass: i.e. induction variables and exit conditions. */
-
-static bool
-graphite_stmt_p (scop_p scop, basic_block bb,
- VEC (data_reference_p, heap) *drs)
-{
- gimple_stmt_iterator gsi;
- loop_p loop = bb->loop_father;
-
- if (VEC_length (data_reference_p, drs) > 0)
- return true;
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple stmt = gsi_stmt (gsi);
-
- switch (gimple_code (stmt))
- {
- /* Control flow expressions can be ignored, as they are
- represented in the iteration domains and will be
- regenerated by graphite. */
- case GIMPLE_COND:
- case GIMPLE_GOTO:
- case GIMPLE_SWITCH:
- break;
-
- case GIMPLE_ASSIGN:
- {
- tree var = gimple_assign_lhs (stmt);
- var = analyze_scalar_evolution (loop, var);
- var = instantiate_scev (block_before_scop (scop), loop, var);
-
- if (chrec_contains_undetermined (var))
- return true;
-
- break;
- }
-
- default:
- return true;
- }
- }
-
- return false;
-}
-
-/* Store the GRAPHITE representation of BB. */
-
-static void
-new_graphite_bb (scop_p scop, basic_block bb)
-{
- struct graphite_bb *gbb;
- VEC (data_reference_p, heap) *drs = VEC_alloc (data_reference_p, heap, 5);
- struct loop *nest = outermost_loop_in_scop (scop, bb);
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- find_data_references_in_stmt (nest, gsi_stmt (gsi), &drs);
-
- if (!graphite_stmt_p (scop, bb, drs))
- {
- free_data_refs (drs);
- return;
- }
-
- gbb = XNEW (struct graphite_bb);
- bb->aux = gbb;
- GBB_BB (gbb) = bb;
- GBB_SCOP (gbb) = scop;
- GBB_DATA_REFS (gbb) = drs;
- GBB_DOMAIN (gbb) = NULL;
- GBB_CONDITIONS (gbb) = NULL;
- GBB_CONDITION_CASES (gbb) = NULL;
- GBB_LOOPS (gbb) = NULL;
- GBB_STATIC_SCHEDULE (gbb) = NULL;
- GBB_CLOOG_IV_TYPES (gbb) = NULL;
- VEC_safe_push (graphite_bb_p, heap, SCOP_BBS (scop), gbb);
-}
-
-/* Frees GBB. */
-
-static void
-free_graphite_bb (struct graphite_bb *gbb)
-{
- if (GBB_DOMAIN (gbb))
- cloog_matrix_free (GBB_DOMAIN (gbb));
-
- if (GBB_CLOOG_IV_TYPES (gbb))
- htab_delete (GBB_CLOOG_IV_TYPES (gbb));
-
- /* FIXME: free_data_refs is disabled for the moment, but should be
- enabled.
-
- free_data_refs (GBB_DATA_REFS (gbb)); */
-
- VEC_free (gimple, heap, GBB_CONDITIONS (gbb));
- VEC_free (gimple, heap, GBB_CONDITION_CASES (gbb));
- VEC_free (loop_p, heap, GBB_LOOPS (gbb));
- GBB_BB (gbb)->aux = 0;
- XDELETE (gbb);
-}
-
-
-
-/* Structure containing the mapping between the old names and the new
- names used after block copy in the new loop context. */
-typedef struct rename_map_elt_d
-{
- tree old_name, new_name;
-} *rename_map_elt;
-
-
-/* Print to stderr the element ELT. */
-
-static void
-debug_rename_elt (rename_map_elt elt)
-{
- fprintf (stderr, "(");
- print_generic_expr (stderr, elt->old_name, 0);
- fprintf (stderr, ", ");
- print_generic_expr (stderr, elt->new_name, 0);
- fprintf (stderr, ")\n");
-}
-
-/* Helper function for debug_rename_map. */
-
-static int
-debug_rename_map_1 (void **slot, void *s ATTRIBUTE_UNUSED)
-{
- struct rename_map_elt_d *entry = (struct rename_map_elt_d *) *slot;
- debug_rename_elt (entry);
- return 1;
-}
-
-/* Print to stderr all the elements of MAP. */
-
-void
-debug_rename_map (htab_t map)
-{
- htab_traverse (map, debug_rename_map_1, NULL);
-}
-
-/* Constructs a new SCEV_INFO_STR structure for VAR and INSTANTIATED_BELOW. */
-
-static inline rename_map_elt
-new_rename_map_elt (tree old_name, tree new_name)
-{
- rename_map_elt res;
-
- res = XNEW (struct rename_map_elt_d);
- res->old_name = old_name;
- res->new_name = new_name;
-
- return res;
-}
-
-/* Computes a hash function for database element ELT. */
-
-static hashval_t
-rename_map_elt_info (const void *elt)
-{
- return htab_hash_pointer (((const struct rename_map_elt_d *) elt)->old_name);
-}
-
-/* Compares database elements E1 and E2. */
-
-static int
-eq_rename_map_elts (const void *e1, const void *e2)
-{
- const struct rename_map_elt_d *elt1 = (const struct rename_map_elt_d *) e1;
- const struct rename_map_elt_d *elt2 = (const struct rename_map_elt_d *) e2;
-
- return (elt1->old_name == elt2->old_name);
-}
-
-/* Returns the new name associated to OLD_NAME in MAP. */
-
-static tree
-get_new_name_from_old_name (htab_t map, tree old_name)
-{
- struct rename_map_elt_d tmp;
- PTR *slot;
-
- tmp.old_name = old_name;
- slot = htab_find_slot (map, &tmp, NO_INSERT);
-
- if (slot && *slot)
- return ((rename_map_elt) *slot)->new_name;
-
- return old_name;
-}
-
-
-
-/* Creates a new scop starting with ENTRY. */
-
-static scop_p
-new_scop (edge entry, edge exit)
-{
- scop_p scop = XNEW (struct scop);
-
- gcc_assert (entry && exit);
-
- SCOP_REGION (scop) = new_sese (entry, exit);
- SCOP_BBS (scop) = VEC_alloc (graphite_bb_p, heap, 3);
- SCOP_OLDIVS (scop) = VEC_alloc (name_tree, heap, 3);
- SCOP_LOOPS (scop) = BITMAP_ALLOC (NULL);
- SCOP_LOOP_NEST (scop) = VEC_alloc (loop_p, heap, 3);
- SCOP_ADD_PARAMS (scop) = true;
- SCOP_PARAMS (scop) = VEC_alloc (name_tree, heap, 3);
- SCOP_PROG (scop) = cloog_program_malloc ();
- cloog_program_set_names (SCOP_PROG (scop), cloog_names_malloc ());
- SCOP_LOOP2CLOOG_LOOP (scop) = htab_create (10, hash_loop_to_cloog_loop,
- eq_loop_to_cloog_loop,
- free);
- SCOP_LIVEOUT_RENAMES (scop) = htab_create (10, rename_map_elt_info,
- eq_rename_map_elts, free);
- return scop;
-}
-
-/* Deletes SCOP. */
-
-static void
-free_scop (scop_p scop)
-{
- int i;
- name_tree p;
- struct graphite_bb *gb;
- name_tree iv;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- free_graphite_bb (gb);
-
- VEC_free (graphite_bb_p, heap, SCOP_BBS (scop));
- BITMAP_FREE (SCOP_LOOPS (scop));
- VEC_free (loop_p, heap, SCOP_LOOP_NEST (scop));
-
- for (i = 0; VEC_iterate (name_tree, SCOP_OLDIVS (scop), i, iv); i++)
- free (iv);
- VEC_free (name_tree, heap, SCOP_OLDIVS (scop));
-
- for (i = 0; VEC_iterate (name_tree, SCOP_PARAMS (scop), i, p); i++)
- free (p);
-
- VEC_free (name_tree, heap, SCOP_PARAMS (scop));
- cloog_program_free (SCOP_PROG (scop));
- htab_delete (SCOP_LOOP2CLOOG_LOOP (scop));
- htab_delete (SCOP_LIVEOUT_RENAMES (scop));
- free_sese (SCOP_REGION (scop));
- XDELETE (scop);
-}
-
-/* Deletes all scops in SCOPS. */
-
-static void
-free_scops (VEC (scop_p, heap) *scops)
-{
- int i;
- scop_p scop;
-
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
- free_scop (scop);
-
- VEC_free (scop_p, heap, scops);
-}
-
-typedef enum gbb_type {
- GBB_UNKNOWN,
- GBB_LOOP_SING_EXIT_HEADER,
- GBB_LOOP_MULT_EXIT_HEADER,
- GBB_LOOP_EXIT,
- GBB_COND_HEADER,
- GBB_SIMPLE,
- GBB_LAST
-} gbb_type;
-
-/* Detect the type of BB. Loop headers are only marked, if they are
- new. This means their loop_father is different to LAST_LOOP.
- Otherwise they are treated like any other bb and their type can be
- any other type. */
-
-static gbb_type
-get_bb_type (basic_block bb, struct loop *last_loop)
-{
- VEC (basic_block, heap) *dom;
- int nb_dom, nb_suc;
- struct loop *loop = bb->loop_father;
-
- /* Check, if we entry into a new loop. */
- if (loop != last_loop)
- {
- if (single_exit (loop) != NULL)
- return GBB_LOOP_SING_EXIT_HEADER;
- else if (loop->num != 0)
- return GBB_LOOP_MULT_EXIT_HEADER;
- else
- return GBB_COND_HEADER;
- }
-
- dom = get_dominated_by (CDI_DOMINATORS, bb);
- nb_dom = VEC_length (basic_block, dom);
- VEC_free (basic_block, heap, dom);
-
- if (nb_dom == 0)
- return GBB_LAST;
-
- nb_suc = VEC_length (edge, bb->succs);
-
- if (nb_dom == 1 && nb_suc == 1)
- return GBB_SIMPLE;
-
- return GBB_COND_HEADER;
-}
-
-/* A SCoP detection region, defined using bbs as borders.
- All control flow touching this region, comes in passing basic_block ENTRY and
- leaves passing basic_block EXIT. By using bbs instead of edges for the
- borders we are able to represent also regions that do not have a single
- entry or exit edge.
- But as they have a single entry basic_block and a single exit basic_block, we
- are able to generate for every sd_region a single entry and exit edge.
-
- 1 2
- \ /
- 3 <- entry
- |
- 4
- / \ This region contains: {3, 4, 5, 6, 7, 8}
- 5 6
- | |
- 7 8
- \ /
- 9 <- exit */
-
-
-typedef struct sd_region_p
-{
- /* The entry bb dominates all bbs in the sd_region. It is part of the
- region. */
- basic_block entry;
-
- /* The exit bb postdominates all bbs in the sd_region, but is not
- part of the region. */
- basic_block exit;
-} sd_region;
-
-DEF_VEC_O(sd_region);
-DEF_VEC_ALLOC_O(sd_region, heap);
-
-
-/* Moves the scops from SOURCE to TARGET and clean up SOURCE. */
-
-static void
-move_sd_regions (VEC (sd_region, heap) **source, VEC (sd_region, heap) **target)
-{
- sd_region *s;
- int i;
-
- for (i = 0; VEC_iterate (sd_region, *source, i, s); i++)
- VEC_safe_push (sd_region, heap, *target, s);
-
- VEC_free (sd_region, heap, *source);
-}
-
-/* Return true when it is not possible to represent the upper bound of
- LOOP in the polyhedral representation. */
-
-static bool
-graphite_cannot_represent_loop_niter (loop_p loop)
-{
- tree niter = number_of_latch_executions (loop);
-
- return chrec_contains_undetermined (niter)
- || !scev_is_linear_expression (niter);
-}
-/* Store information needed by scopdet_* functions. */
-
-struct scopdet_info
-{
- /* Where the last open scop would stop if the current BB is harmful. */
- basic_block last;
-
- /* Where the next scop would start if the current BB is harmful. */
- basic_block next;
-
- /* The bb or one of its children contains open loop exits. That means
- loop exit nodes that are not surrounded by a loop dominated by bb. */
- bool exits;
-
- /* The bb or one of its children contains only structures we can handle. */
- bool difficult;
-};
-
-
-static struct scopdet_info build_scops_1 (basic_block, VEC (sd_region, heap) **,
- loop_p);
-
-/* Calculates BB infos. If bb is difficult we add valid SCoPs dominated by BB
- to SCOPS. TYPE is the gbb_type of BB. */
-
-static struct scopdet_info
-scopdet_basic_block_info (basic_block bb, VEC (sd_region, heap) **scops,
- gbb_type type)
-{
- struct loop *loop = bb->loop_father;
- struct scopdet_info result;
- gimple stmt;
-
- /* XXX: ENTRY_BLOCK_PTR could be optimized in later steps. */
- stmt = harmful_stmt_in_bb (ENTRY_BLOCK_PTR, bb);
- result.difficult = (stmt != NULL);
- result.last = NULL;
-
- switch (type)
- {
- case GBB_LAST:
- result.next = NULL;
- result.exits = false;
- result.last = bb;
-
- /* Mark bbs terminating a SESE region difficult, if they start
- a condition. */
- if (VEC_length (edge, bb->succs) > 1)
- result.difficult = true;
-
- break;
-
- case GBB_SIMPLE:
- result.next = single_succ (bb);
- result.exits = false;
- result.last = bb;
- break;
-
- case GBB_LOOP_SING_EXIT_HEADER:
- {
- VEC (sd_region, heap) *tmp_scops = VEC_alloc (sd_region, heap,3);
- struct scopdet_info sinfo;
-
- sinfo = build_scops_1 (bb, &tmp_scops, loop);
-
- result.last = single_exit (bb->loop_father)->src;
- result.next = single_exit (bb->loop_father)->dest;
-
- /* If we do not dominate result.next, remove it. It's either
- the EXIT_BLOCK_PTR, or another bb dominates it and will
- call the scop detection for this bb. */
- if (!dominated_by_p (CDI_DOMINATORS, result.next, bb))
- result.next = NULL;
-
- if (result.last->loop_father != loop)
- result.next = NULL;
-
- if (graphite_cannot_represent_loop_niter (loop))
- result.difficult = true;
-
- if (sinfo.difficult)
- move_sd_regions (&tmp_scops, scops);
- else
- VEC_free (sd_region, heap, tmp_scops);
-
- result.exits = false;
- result.difficult |= sinfo.difficult;
- break;
- }
-
- case GBB_LOOP_MULT_EXIT_HEADER:
- {
- /* XXX: For now we just do not join loops with multiple exits. If the
- exits lead to the same bb it may be possible to join the loop. */
- VEC (sd_region, heap) *tmp_scops = VEC_alloc (sd_region, heap, 3);
- VEC (edge, heap) *exits = get_loop_exit_edges (loop);
- edge e;
- int i;
- build_scops_1 (bb, &tmp_scops, loop);
-
- /* Scan the code dominated by this loop. This means all bbs, that are
- are dominated by a bb in this loop, but are not part of this loop.
-
- The easiest case:
- - The loop exit destination is dominated by the exit sources.
-
- TODO: We miss here the more complex cases:
- - The exit destinations are dominated by another bb inside the
- loop.
- - The loop dominates bbs, that are not exit destinations. */
- for (i = 0; VEC_iterate (edge, exits, i, e); i++)
- if (e->src->loop_father == loop
- && dominated_by_p (CDI_DOMINATORS, e->dest, e->src))
- {
- /* Pass loop_outer to recognize e->dest as loop header in
- build_scops_1. */
- if (e->dest->loop_father->header == e->dest)
- build_scops_1 (e->dest, &tmp_scops,
- loop_outer (e->dest->loop_father));
- else
- build_scops_1 (e->dest, &tmp_scops, e->dest->loop_father);
- }
-
- result.next = NULL;
- result.last = NULL;
- result.difficult = true;
- result.exits = false;
- move_sd_regions (&tmp_scops, scops);
- VEC_free (edge, heap, exits);
- break;
- }
- case GBB_COND_HEADER:
- {
- VEC (sd_region, heap) *tmp_scops = VEC_alloc (sd_region, heap, 3);
- struct scopdet_info sinfo;
- VEC (basic_block, heap) *dominated;
- int i;
- basic_block dom_bb;
- basic_block last_bb = NULL;
- edge e;
- result.exits = false;
-
- /* First check the successors of BB, and check if it is possible to join
- the different branches. */
- for (i = 0; VEC_iterate (edge, bb->succs, i, e); i++)
- {
- /* Ignore loop exits. They will be handled after the loop body. */
- if (is_loop_exit (loop, e->dest))
- {
- result.exits = true;
- continue;
- }
-
- /* Do not follow edges that lead to the end of the
- conditions block. For example, in
-
- | 0
- | /|\
- | 1 2 |
- | | | |
- | 3 4 |
- | \|/
- | 6
-
- the edge from 0 => 6. Only check if all paths lead to
- the same node 6. */
-
- if (!single_pred_p (e->dest))
- {
- /* Check, if edge leads directly to the end of this
- condition. */
- if (!last_bb)
- {
- last_bb = e->dest;
- }
-
- if (e->dest != last_bb)
- result.difficult = true;
-
- continue;
- }
-
- if (!dominated_by_p (CDI_DOMINATORS, e->dest, bb))
- {
- result.difficult = true;
- continue;
- }
-
- sinfo = build_scops_1 (e->dest, &tmp_scops, loop);
-
- result.exits |= sinfo.exits;
- result.last = sinfo.last;
- result.difficult |= sinfo.difficult;
-
- /* Checks, if all branches end at the same point.
- If that is true, the condition stays joinable.
- Have a look at the example above. */
- if (sinfo.last && single_succ_p (sinfo.last))
- {
- basic_block next_tmp = single_succ (sinfo.last);
-
- if (!last_bb)
- last_bb = next_tmp;
-
- if (next_tmp != last_bb)
- result.difficult = true;
- }
- else
- result.difficult = true;
- }
-
- /* If the condition is joinable. */
- if (!result.exits && !result.difficult)
- {
- /* Only return a next pointer if we dominate this pointer.
- Otherwise it will be handled by the bb dominating it. */
- if (dominated_by_p (CDI_DOMINATORS, last_bb, bb) && last_bb != bb)
- result.next = last_bb;
- else
- result.next = NULL;
-
- VEC_free (sd_region, heap, tmp_scops);
- break;
- }
-
- /* Scan remaining bbs dominated by BB. */
- dominated = get_dominated_by (CDI_DOMINATORS, bb);
-
- for (i = 0; VEC_iterate (basic_block, dominated, i, dom_bb); i++)
- {
- /* Ignore loop exits: they will be handled after the loop body. */
- if (loop_depth (find_common_loop (loop, dom_bb->loop_father))
- < loop_depth (loop))
- {
- result.exits = true;
- continue;
- }
-
- /* Ignore the bbs processed above. */
- if (single_pred_p (dom_bb) && single_pred (dom_bb) == bb)
- continue;
-
- if (loop_depth (loop) > loop_depth (dom_bb->loop_father))
- sinfo = build_scops_1 (dom_bb, &tmp_scops, loop_outer (loop));
- else
- sinfo = build_scops_1 (dom_bb, &tmp_scops, loop);
-
-
- result.exits |= sinfo.exits;
- result.difficult = true;
- result.last = NULL;
- }
-
- VEC_free (basic_block, heap, dominated);
-
- result.next = NULL;
- move_sd_regions (&tmp_scops, scops);
-
- break;
- }
-
- default:
- gcc_unreachable ();
- }
-
- return result;
-}
-
-/* Creates the SCoPs and writes entry and exit points for every SCoP. */
-
-static struct scopdet_info
-build_scops_1 (basic_block current, VEC (sd_region, heap) **scops, loop_p loop)
-{
- bool in_scop = false;
- sd_region open_scop;
- struct scopdet_info sinfo;
-
- /* Initialize result. */
- struct scopdet_info result;
- result.exits = false;
- result.difficult = false;
- result.next = NULL;
- result.last = NULL;
- open_scop.entry = NULL;
- open_scop.exit = NULL;
- sinfo.last = NULL;
-
- /* Loop over the dominance tree. If we meet a difficult bb, close
- the current SCoP. Loop and condition header start a new layer,
- and can only be added if all bbs in deeper layers are simple. */
- while (current != NULL)
- {
- sinfo = scopdet_basic_block_info (current, scops, get_bb_type (current,
- loop));
-
- if (!in_scop && !(sinfo.exits || sinfo.difficult))
- {
- open_scop.entry = current;
- open_scop.exit = NULL;
- in_scop = true;
- }
- else if (in_scop && (sinfo.exits || sinfo.difficult))
- {
- open_scop.exit = current;
- VEC_safe_push (sd_region, heap, *scops, &open_scop);
- in_scop = false;
- }
-
- result.difficult |= sinfo.difficult;
- result.exits |= sinfo.exits;
-
- current = sinfo.next;
- }
-
- /* Try to close open_scop, if we are still in an open SCoP. */
- if (in_scop)
- {
- int i;
- edge e;
-
- for (i = 0; VEC_iterate (edge, sinfo.last->succs, i, e); i++)
- if (dominated_by_p (CDI_POST_DOMINATORS, sinfo.last, e->dest))
- open_scop.exit = e->dest;
-
- if (!open_scop.exit && open_scop.entry != sinfo.last)
- open_scop.exit = sinfo.last;
-
- if (open_scop.exit)
- VEC_safe_push (sd_region, heap, *scops, &open_scop);
-
- }
-
- result.last = sinfo.last;
- return result;
-}
-
-/* Checks if a bb is contained in REGION. */
-
-static bool
-bb_in_sd_region (basic_block bb, sd_region *region)
-{
- return dominated_by_p (CDI_DOMINATORS, bb, region->entry)
- && !(dominated_by_p (CDI_DOMINATORS, bb, region->exit)
- && !dominated_by_p (CDI_DOMINATORS, region->entry,
- region->exit));
-}
-
-/* Returns the single entry edge of REGION, if it does not exits NULL. */
-
-static edge
-find_single_entry_edge (sd_region *region)
-{
- edge e;
- edge_iterator ei;
- edge entry = NULL;
-
- FOR_EACH_EDGE (e, ei, region->entry->preds)
- if (!bb_in_sd_region (e->src, region))
- {
- if (entry)
- {
- entry = NULL;
- break;
- }
-
- else
- entry = e;
- }
-
- return entry;
-}
-
-/* Returns the single exit edge of REGION, if it does not exits NULL. */
-
-static edge
-find_single_exit_edge (sd_region *region)
-{
- edge e;
- edge_iterator ei;
- edge exit = NULL;
-
- FOR_EACH_EDGE (e, ei, region->exit->preds)
- if (bb_in_sd_region (e->src, region))
- {
- if (exit)
- {
- exit = NULL;
- break;
- }
-
- else
- exit = e;
- }
-
- return exit;
-}
-
-/* Create a single entry edge for REGION. */
-
-static void
-create_single_entry_edge (sd_region *region)
-{
- if (find_single_entry_edge (region))
- return;
-
- /* There are multiple predecessors for bb_3
-
- | 1 2
- | | /
- | |/
- | 3 <- entry
- | |\
- | | |
- | 4 ^
- | | |
- | |/
- | 5
-
- There are two edges (1->3, 2->3), that point from outside into the region,
- and another one (5->3), a loop latch, lead to bb_3.
-
- We split bb_3.
-
- | 1 2
- | | /
- | |/
- |3.0
- | |\ (3.0 -> 3.1) = single entry edge
- |3.1 | <- entry
- | | |
- | | |
- | 4 ^
- | | |
- | |/
- | 5
-
- If the loop is part of the SCoP, we have to redirect the loop latches.
-
- | 1 2
- | | /
- | |/
- |3.0
- | | (3.0 -> 3.1) = entry edge
- |3.1 <- entry
- | |\
- | | |
- | 4 ^
- | | |
- | |/
- | 5 */
-
- if (region->entry->loop_father->header != region->entry
- || dominated_by_p (CDI_DOMINATORS,
- loop_latch_edge (region->entry->loop_father)->src,
- region->exit))
- {
- edge forwarder = split_block_after_labels (region->entry);
- region->entry = forwarder->dest;
- }
- else
- /* This case is never executed, as the loop headers seem always to have a
- single edge pointing from outside into the loop. */
- gcc_unreachable ();
-
-#ifdef ENABLE_CHECKING
- gcc_assert (find_single_entry_edge (region));
-#endif
-}
+ gimple_stmt_iterator psi;
+ loop_p loop = bb->loop_father;
-/* Check if the sd_region, mentioned in EDGE, has no exit bb. */
-
-static bool
-sd_region_without_exit (edge e)
-{
- sd_region *r = (sd_region *) e->aux;
-
- if (r)
- return r->exit == NULL;
- else
- return false;
-}
-
-/* Create a single exit edge for REGION. */
-
-static void
-create_single_exit_edge (sd_region *region)
-{
- edge e;
- edge_iterator ei;
- edge forwarder = NULL;
- basic_block exit;
-
- if (find_single_exit_edge (region))
- return;
-
- /* We create a forwarder bb (5) for all edges leaving this region
- (3->5, 4->5). All other edges leading to the same bb, are moved
- to a new bb (6). If these edges where part of another region (2->5)
- we update the region->exit pointer, of this region.
-
- To identify which edge belongs to which region we depend on the e->aux
- pointer in every edge. It points to the region of the edge or to NULL,
- if the edge is not part of any region.
-
- 1 2 3 4 1->5 no region, 2->5 region->exit = 5,
- \| |/ 3->5 region->exit = NULL, 4->5 region->exit = NULL
- 5 <- exit
-
- changes to
-
- 1 2 3 4 1->6 no region, 2->6 region->exit = 6,
- | | \/ 3->5 no region, 4->5 no region,
- | | 5
- \| / 5->6 region->exit = 6
- 6
-
- Now there is only a single exit edge (5->6). */
- exit = region->exit;
- region->exit = NULL;
- forwarder = make_forwarder_block (exit, &sd_region_without_exit, NULL);
-
- /* Unmark the edges, that are no longer exit edges. */
- FOR_EACH_EDGE (e, ei, forwarder->src->preds)
- if (e->aux)
- e->aux = NULL;
-
- /* Mark the new exit edge. */
- single_succ_edge (forwarder->src)->aux = region;
-
- /* Update the exit bb of all regions, where exit edges lead to
- forwarder->dest. */
- FOR_EACH_EDGE (e, ei, forwarder->dest->preds)
- if (e->aux)
- ((sd_region *) e->aux)->exit = forwarder->dest;
-
-#ifdef ENABLE_CHECKING
- gcc_assert (find_single_exit_edge (region));
-#endif
-}
-
-/* Unmark the exit edges of all REGIONS.
- See comment in "create_single_exit_edge". */
-
-static void
-unmark_exit_edges (VEC (sd_region, heap) *regions)
-{
- int i;
- sd_region *s;
- edge e;
- edge_iterator ei;
-
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
- FOR_EACH_EDGE (e, ei, s->exit->preds)
- e->aux = NULL;
-}
-
-
-/* Mark the exit edges of all REGIONS.
- See comment in "create_single_exit_edge". */
-
-static void
-mark_exit_edges (VEC (sd_region, heap) *regions)
-{
- int i;
- sd_region *s;
- edge e;
- edge_iterator ei;
-
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
- FOR_EACH_EDGE (e, ei, s->exit->preds)
- if (bb_in_sd_region (e->src, s))
- e->aux = s;
-}
-
-/* Free and compute again all the dominators information. */
-
-static inline void
-recompute_all_dominators (void)
-{
- mark_irreducible_loops ();
- free_dominance_info (CDI_DOMINATORS);
- free_dominance_info (CDI_POST_DOMINATORS);
- calculate_dominance_info (CDI_DOMINATORS);
- calculate_dominance_info (CDI_POST_DOMINATORS);
-}
-
-/* Verifies properties that GRAPHITE should maintain during translation. */
-
-static inline void
-graphite_verify (void)
-{
-#ifdef ENABLE_CHECKING
- verify_loop_structure ();
- verify_dominators (CDI_DOMINATORS);
- verify_dominators (CDI_POST_DOMINATORS);
- verify_ssa (false);
- verify_loop_closed_ssa ();
-#endif
-}
-
-/* Create for all scop regions a single entry and a single exit edge. */
-
-static void
-create_sese_edges (VEC (sd_region, heap) *regions)
-{
- int i;
- sd_region *s;
-
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
- create_single_entry_edge (s);
-
- mark_exit_edges (regions);
-
- for (i = 0; VEC_iterate (sd_region, regions, i, s); i++)
- create_single_exit_edge (s);
-
- unmark_exit_edges (regions);
-
- fix_loop_structure (NULL);
-
-#ifdef ENABLE_CHECKING
- verify_loop_structure ();
- verify_dominators (CDI_DOMINATORS);
- verify_ssa (false);
-#endif
-}
-
-/* Create graphite SCoPs from an array of scop detection regions. */
-
-static void
-build_graphite_scops (VEC (sd_region, heap) *scop_regions)
-{
- int i;
- sd_region *s;
-
- for (i = 0; VEC_iterate (sd_region, scop_regions, i, s); i++)
- {
- edge entry = find_single_entry_edge (s);
- edge exit = find_single_exit_edge (s);
- scop_p scop = new_scop (entry, exit);
- VEC_safe_push (scop_p, heap, current_scops, scop);
-
- /* Are there overlapping SCoPs? */
-#ifdef ENABLE_CHECKING
- {
- int j;
- sd_region *s2;
-
- for (j = 0; VEC_iterate (sd_region, scop_regions, j, s2); j++)
- if (s != s2)
- gcc_assert (!bb_in_sd_region (s->entry, s2));
- }
-#endif
- }
-}
-
-/* Find static control parts. */
-
-static void
-build_scops (void)
-{
- struct loop *loop = current_loops->tree_root;
- VEC (sd_region, heap) *tmp_scops = VEC_alloc (sd_region, heap, 3);
-
- build_scops_1 (single_succ (ENTRY_BLOCK_PTR), &tmp_scops, loop);
- create_sese_edges (tmp_scops);
- build_graphite_scops (tmp_scops);
- VEC_free (sd_region, heap, tmp_scops);
-}
-
-/* Gather the basic blocks belonging to the SCOP. */
-
-static void
-build_scop_bbs (scop_p scop)
-{
- basic_block *stack = XNEWVEC (basic_block, n_basic_blocks + 1);
- sbitmap visited = sbitmap_alloc (last_basic_block);
- int sp = 0;
-
- sbitmap_zero (visited);
- stack[sp++] = SCOP_ENTRY (scop);
-
- while (sp)
- {
- basic_block bb = stack[--sp];
- int depth = loop_depth (bb->loop_father);
- int num = bb->loop_father->num;
- edge_iterator ei;
- edge e;
-
- /* Scop's exit is not in the scop. Exclude also bbs, which are
- dominated by the SCoP exit. These are e.g. loop latches. */
- if (TEST_BIT (visited, bb->index)
- || dominated_by_p (CDI_DOMINATORS, bb, SCOP_EXIT (scop))
- /* Every block in the scop is dominated by scop's entry. */
- || !dominated_by_p (CDI_DOMINATORS, bb, SCOP_ENTRY (scop)))
+ if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
continue;
- new_graphite_bb (scop, bb);
- SET_BIT (visited, bb->index);
-
- /* First push the blocks that have to be processed last. Note
- that this means that the order in which the code is organized
- below is important: do not reorder the following code. */
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (! TEST_BIT (visited, e->dest->index)
- && (int) loop_depth (e->dest->loop_father) < depth)
- stack[sp++] = e->dest;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (! TEST_BIT (visited, e->dest->index)
- && (int) loop_depth (e->dest->loop_father) == depth
- && e->dest->loop_father->num != num)
- stack[sp++] = e->dest;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (! TEST_BIT (visited, e->dest->index)
- && (int) loop_depth (e->dest->loop_father) == depth
- && e->dest->loop_father->num == num
- && EDGE_COUNT (e->dest->preds) > 1)
- stack[sp++] = e->dest;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (! TEST_BIT (visited, e->dest->index)
- && (int) loop_depth (e->dest->loop_father) == depth
- && e->dest->loop_father->num == num
- && EDGE_COUNT (e->dest->preds) == 1)
- stack[sp++] = e->dest;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (! TEST_BIT (visited, e->dest->index)
- && (int) loop_depth (e->dest->loop_father) > depth)
- stack[sp++] = e->dest;
- }
-
- free (stack);
- sbitmap_free (visited);
-}
-
-/* Returns the number of reduction phi nodes in LOOP. */
-
-static int
-nb_reductions_in_loop (loop_p loop)
-{
- int res = 0;
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple phi = gsi_stmt (gsi);
- tree scev;
- affine_iv iv;
-
- if (!is_gimple_reg (PHI_RESULT (phi)))
- continue;
-
- scev = analyze_scalar_evolution (loop, PHI_RESULT (phi));
- scev = instantiate_parameters (loop, scev);
- if (!simple_iv (loop, loop, PHI_RESULT (phi), &iv, true))
- res++;
- }
-
- return res;
-}
-
-/* A LOOP is in normal form when it contains only one scalar phi node
- that defines the main induction variable of the loop, only one
- increment of the IV, and only one exit condition. */
-
-static tree
-graphite_loop_normal_form (loop_p loop)
-{
- struct tree_niter_desc niter;
- tree nit;
- gimple_seq stmts;
- edge exit = single_dom_exit (loop);
- bool known_niter = number_of_iterations_exit (loop, exit, &niter, false);
-
- gcc_assert (known_niter);
-
- nit = force_gimple_operand (unshare_expr (niter.niter), &stmts, true,
- NULL_TREE);
- if (stmts)
- gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
-
- /* One IV per loop. */
- if (nb_reductions_in_loop (loop) > 0)
- return NULL_TREE;
-
- return canonicalize_loop_ivs (loop, NULL, &nit);
-}
-
-/* Record LOOP as occuring in SCOP. Returns true when the operation
- was successful. */
-
-static bool
-scop_record_loop (scop_p scop, loop_p loop)
-{
- tree induction_var;
- name_tree oldiv;
-
- if (bitmap_bit_p (SCOP_LOOPS (scop), loop->num))
- return true;
-
- bitmap_set_bit (SCOP_LOOPS (scop), loop->num);
- VEC_safe_push (loop_p, heap, SCOP_LOOP_NEST (scop), loop);
-
- induction_var = graphite_loop_normal_form (loop);
- if (!induction_var)
- return false;
-
- oldiv = XNEW (struct name_tree_d);
- oldiv->t = induction_var;
- oldiv->name = get_name (SSA_NAME_VAR (oldiv->t));
- oldiv->loop = loop;
- VEC_safe_push (name_tree, heap, SCOP_OLDIVS (scop), oldiv);
- return true;
-}
-
-/* Build the loop nests contained in SCOP. Returns true when the
- operation was successful. */
-
-static bool
-build_scop_loop_nests (scop_p scop)
-{
- unsigned i;
- basic_block bb;
- struct loop *loop0, *loop1;
-
- FOR_EACH_BB (bb)
- if (bb_in_sese_p (bb, SCOP_REGION (scop)))
- {
- struct loop *loop = bb->loop_father;
-
- /* Only add loops if they are completely contained in the SCoP. */
- if (loop->header == bb
- && bb_in_sese_p (loop->latch, SCOP_REGION (scop)))
- {
- if (!scop_record_loop (scop, loop))
- return false;
- }
- }
+ n_bbs++;
+ n_p_bbs += bb->count;
- /* Make sure that the loops in the SCOP_LOOP_NEST are ordered. It
- can be the case that an inner loop is inserted before an outer
- loop. To avoid this, semi-sort once. */
- for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, loop0); i++)
- {
- if (VEC_length (loop_p, SCOP_LOOP_NEST (scop)) == i + 1)
- break;
-
- loop1 = VEC_index (loop_p, SCOP_LOOP_NEST (scop), i + 1);
- if (loop0->num > loop1->num)
- {
- VEC_replace (loop_p, SCOP_LOOP_NEST (scop), i, loop1);
- VEC_replace (loop_p, SCOP_LOOP_NEST (scop), i + 1, loop0);
- }
- }
-
- return true;
-}
-
-/* Calculate the number of loops around LOOP in the SCOP. */
-
-static inline int
-nb_loops_around_loop_in_scop (struct loop *l, scop_p scop)
-{
- int d = 0;
-
- for (; loop_in_sese_p (l, SCOP_REGION (scop)); d++, l = loop_outer (l));
-
- return d;
-}
-
-/* Calculate the number of loops around GB in the current SCOP. */
-
-int
-nb_loops_around_gb (graphite_bb_p gb)
-{
- return nb_loops_around_loop_in_scop (gbb_loop (gb), GBB_SCOP (gb));
-}
-
-/* Returns the dimensionality of an enclosing loop iteration domain
- with respect to enclosing SCoP for a given data reference REF. The
- returned dimensionality is homogeneous (depth of loop nest + number
- of SCoP parameters + const). */
-
-int
-ref_nb_loops (data_reference_p ref)
-{
- loop_p loop = loop_containing_stmt (DR_STMT (ref));
- scop_p scop = DR_SCOP (ref);
-
- return nb_loops_around_loop_in_scop (loop, scop) + scop_nb_params (scop) + 2;
-}
-
-/* Build dynamic schedules for all the BBs. */
-
-static void
-build_scop_dynamic_schedules (scop_p scop)
-{
- int i, dim, loop_num, row, col;
- graphite_bb_p gb;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- {
- loop_num = GBB_BB (gb)->loop_father->num;
-
- if (loop_num != 0)
- {
- dim = nb_loops_around_gb (gb);
- GBB_DYNAMIC_SCHEDULE (gb) = cloog_matrix_alloc (dim, dim);
-
- for (row = 0; row < GBB_DYNAMIC_SCHEDULE (gb)->NbRows; row++)
- for (col = 0; col < GBB_DYNAMIC_SCHEDULE (gb)->NbColumns; col++)
- if (row == col)
- value_set_si (GBB_DYNAMIC_SCHEDULE (gb)->p[row][col], 1);
- else
- value_set_si (GBB_DYNAMIC_SCHEDULE (gb)->p[row][col], 0);
- }
- else
- GBB_DYNAMIC_SCHEDULE (gb) = NULL;
- }
-}
-
-/* Returns the number of loops that are identical at the beginning of
- the vectors A and B. */
-
-static int
-compare_prefix_loops (VEC (loop_p, heap) *a, VEC (loop_p, heap) *b)
-{
- int i;
- loop_p ea;
- int lb;
-
- if (!a || !b)
- return 0;
-
- lb = VEC_length (loop_p, b);
-
- for (i = 0; VEC_iterate (loop_p, a, i, ea); i++)
- if (i >= lb
- || ea != VEC_index (loop_p, b, i))
- return i;
-
- return 0;
-}
-
-/* Build for BB the static schedule.
-
- The STATIC_SCHEDULE is defined like this:
-
- A
- for (i: ...)
- {
- for (j: ...)
- {
- B
- C
- }
-
- for (k: ...)
- {
- D
- E
- }
- }
- F
-
- Static schedules for A to F:
-
- DEPTH
- 0 1 2
- A 0
- B 1 0 0
- C 1 0 1
- D 1 1 0
- E 1 1 1
- F 2
-*/
-
-static void
-build_scop_canonical_schedules (scop_p scop)
-{
- int i;
- graphite_bb_p gb;
- int nb_loops = scop_nb_loops (scop);
- lambda_vector static_schedule = lambda_vector_new (nb_loops + 1);
- VEC (loop_p, heap) *loops_previous = NULL;
-
- /* We have to start schedules at 0 on the first component and
- because we cannot compare_prefix_loops against a previous loop,
- prefix will be equal to zero, and that index will be
- incremented before copying. */
- static_schedule[0] = -1;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- {
- int prefix = compare_prefix_loops (loops_previous, GBB_LOOPS (gb));
- int nb = gbb_nb_loops (gb);
-
- loops_previous = GBB_LOOPS (gb);
- memset (&(static_schedule[prefix + 1]), 0, sizeof (int) * (nb_loops - prefix));
- ++static_schedule[prefix];
- GBB_STATIC_SCHEDULE (gb) = lambda_vector_new (nb + 1);
- lambda_vector_copy (static_schedule,
- GBB_STATIC_SCHEDULE (gb), nb + 1);
- }
-}
-
-/* Build the LOOPS vector for all bbs in SCOP. */
-
-static void
-build_bb_loops (scop_p scop)
-{
- graphite_bb_p gb;
- int i;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- {
- loop_p loop;
- int depth;
-
- depth = nb_loops_around_gb (gb) - 1;
-
- GBB_LOOPS (gb) = VEC_alloc (loop_p, heap, 3);
- VEC_safe_grow_cleared (loop_p, heap, GBB_LOOPS (gb), depth + 1);
-
- loop = GBB_BB (gb)->loop_father;
-
- while (scop_contains_loop (scop, loop))
- {
- VEC_replace (loop_p, GBB_LOOPS (gb), depth, loop);
- loop = loop_outer (loop);
- depth--;
- }
- }
-}
-
-/* Get the index for parameter VAR in SCOP. */
-
-static int
-param_index (tree var, scop_p scop)
-{
- int i;
- name_tree p;
- name_tree nvar;
-
- gcc_assert (TREE_CODE (var) == SSA_NAME);
-
- for (i = 0; VEC_iterate (name_tree, SCOP_PARAMS (scop), i, p); i++)
- if (p->t == var)
- return i;
-
- gcc_assert (SCOP_ADD_PARAMS (scop));
-
- nvar = XNEW (struct name_tree_d);
- nvar->t = var;
- nvar->name = NULL;
- VEC_safe_push (name_tree, heap, SCOP_PARAMS (scop), nvar);
- return VEC_length (name_tree, SCOP_PARAMS (scop)) - 1;
-}
-
-/* Scan EXPR and translate it to an inequality vector INEQ that will
- be added, or subtracted, in the constraint domain matrix C at row
- R. K is the number of columns for loop iterators in C. */
-
-static void
-scan_tree_for_params (scop_p s, tree e, CloogMatrix *c, int r, Value k,
- bool subtract)
-{
- int cst_col, param_col;
-
- if (e == chrec_dont_know)
- return;
-
- switch (TREE_CODE (e))
- {
- case POLYNOMIAL_CHREC:
- {
- tree left = CHREC_LEFT (e);
- tree right = CHREC_RIGHT (e);
- int var = CHREC_VARIABLE (e);
-
- if (TREE_CODE (right) != INTEGER_CST)
- return;
-
- if (c)
- {
- int loop_col = scop_gimple_loop_depth (s, get_loop (var)) + 1;
-
- if (subtract)
- value_sub_int (c->p[r][loop_col], c->p[r][loop_col],
- int_cst_value (right));
- else
- value_add_int (c->p[r][loop_col], c->p[r][loop_col],
- int_cst_value (right));
- }
-
- switch (TREE_CODE (left))
- {
- case POLYNOMIAL_CHREC:
- scan_tree_for_params (s, left, c, r, k, subtract);
- return;
-
- case INTEGER_CST:
- /* Constant part. */
- if (c)
- {
- int v = int_cst_value (left);
- cst_col = c->NbColumns - 1;
-
- if (v < 0)
- {
- v = -v;
- subtract = subtract ? false : true;
- }
-
- if (subtract)
- value_sub_int (c->p[r][cst_col], c->p[r][cst_col], v);
- else
- value_add_int (c->p[r][cst_col], c->p[r][cst_col], v);
- }
- return;
-
- default:
- scan_tree_for_params (s, left, c, r, k, subtract);
- return;
- }
- }
- break;
-
- case MULT_EXPR:
- if (chrec_contains_symbols (TREE_OPERAND (e, 0)))
- {
- if (c)
- {
- Value val;
- gcc_assert (host_integerp (TREE_OPERAND (e, 1), 0));
- value_init (val);
- value_set_si (val, int_cst_value (TREE_OPERAND (e, 1)));
- value_multiply (k, k, val);
- value_clear (val);
- }
- scan_tree_for_params (s, TREE_OPERAND (e, 0), c, r, k, subtract);
- }
- else
+ if (VEC_length (edge, bb->succs) > 1)
{
- if (c)
- {
- Value val;
- gcc_assert (host_integerp (TREE_OPERAND (e, 0), 0));
- value_init (val);
- value_set_si (val, int_cst_value (TREE_OPERAND (e, 0)));
- value_multiply (k, k, val);
- value_clear (val);
- }
- scan_tree_for_params (s, TREE_OPERAND (e, 1), c, r, k, subtract);
+ n_conditions++;
+ n_p_conditions += bb->count;
}
- break;
-
- case PLUS_EXPR:
- case POINTER_PLUS_EXPR:
- scan_tree_for_params (s, TREE_OPERAND (e, 0), c, r, k, subtract);
- scan_tree_for_params (s, TREE_OPERAND (e, 1), c, r, k, subtract);
- break;
- case MINUS_EXPR:
- scan_tree_for_params (s, TREE_OPERAND (e, 0), c, r, k, subtract);
- scan_tree_for_params (s, TREE_OPERAND (e, 1), c, r, k, !subtract);
- break;
-
- case NEGATE_EXPR:
- scan_tree_for_params (s, TREE_OPERAND (e, 0), c, r, k, !subtract);
- break;
-
- case SSA_NAME:
- param_col = param_index (e, s);
-
- if (c)
+ for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
{
- param_col += c->NbColumns - scop_nb_params (s) - 1;
-
- if (subtract)
- value_subtract (c->p[r][param_col], c->p[r][param_col], k);
- else
- value_addto (c->p[r][param_col], c->p[r][param_col], k);
+ n_stmts++;
+ n_p_stmts += bb->count;
}
- break;
- case INTEGER_CST:
- if (c)
+ if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop)))
{
- int v = int_cst_value (e);
- cst_col = c->NbColumns - 1;
-
- if (v < 0)
- {
- v = -v;
- subtract = subtract ? false : true;
- }
-
- if (subtract)
- value_sub_int (c->p[r][cst_col], c->p[r][cst_col], v);
- else
- value_add_int (c->p[r][cst_col], c->p[r][cst_col], v);
+ n_loops++;
+ n_p_loops += bb->count;
}
- break;
-
- CASE_CONVERT:
- case NON_LVALUE_EXPR:
- scan_tree_for_params (s, TREE_OPERAND (e, 0), c, r, k, subtract);
- break;
-
- default:
- gcc_unreachable ();
- break;
}
-}
-/* Data structure for idx_record_params. */
-
-struct irp_data
-{
- struct loop *loop;
- scop_p scop;
-};
-
-/* For a data reference with an ARRAY_REF as its BASE, record the
- parameters occurring in IDX. DTA is passed in as complementary
- information, and is used by the automatic walker function. This
- function is a callback for for_each_index. */
-
-static bool
-idx_record_params (tree base, tree *idx, void *dta)
-{
- struct irp_data *data = (struct irp_data *) dta;
-
- if (TREE_CODE (base) != ARRAY_REF)
- return true;
-
- if (TREE_CODE (*idx) == SSA_NAME)
- {
- tree scev;
- scop_p scop = data->scop;
- struct loop *loop = data->loop;
- Value one;
-
- scev = analyze_scalar_evolution (loop, *idx);
- scev = instantiate_scev (block_before_scop (scop), loop, scev);
-
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, scev, NULL, 0, one, false);
- value_clear (one);
- }
-
- return true;
-}
-
-/* Find parameters with respect to SCOP in BB. We are looking in memory
- access functions, conditions and loop bounds. */
-
-static void
-find_params_in_bb (scop_p scop, graphite_bb_p gb)
-{
- int i;
- data_reference_p dr;
- gimple stmt;
- loop_p father = GBB_BB (gb)->loop_father;
-
- for (i = 0; VEC_iterate (data_reference_p, GBB_DATA_REFS (gb), i, dr); i++)
- {
- struct irp_data irp;
-
- irp.loop = father;
- irp.scop = scop;
- for_each_index (&dr->ref, idx_record_params, &irp);
- }
-
- /* Find parameters in conditional statements. */
- for (i = 0; VEC_iterate (gimple, GBB_CONDITIONS (gb), i, stmt); i++)
- {
- Value one;
- loop_p loop = father;
-
- tree lhs, rhs;
-
- lhs = gimple_cond_lhs (stmt);
- lhs = analyze_scalar_evolution (loop, lhs);
- lhs = instantiate_scev (block_before_scop (scop), loop, lhs);
-
- rhs = gimple_cond_rhs (stmt);
- rhs = analyze_scalar_evolution (loop, rhs);
- rhs = instantiate_scev (block_before_scop (scop), loop, rhs);
-
- value_init (one);
- scan_tree_for_params (scop, lhs, NULL, 0, one, false);
- value_set_si (one, 1);
- scan_tree_for_params (scop, rhs, NULL, 0, one, false);
- value_clear (one);
- }
+ fprintf (file, "\nSCoP statistics (");
+ fprintf (file, "BBS:%ld, ", n_bbs);
+ fprintf (file, "LOOPS:%ld, ", n_loops);
+ fprintf (file, "CONDITIONS:%ld, ", n_conditions);
+ fprintf (file, "STMTS:%ld)\n", n_stmts);
+ fprintf (file, "\nSCoP profiling statistics (");
+ fprintf (file, "BBS:%ld, ", n_p_bbs);
+ fprintf (file, "LOOPS:%ld, ", n_p_loops);
+ fprintf (file, "CONDITIONS:%ld, ", n_p_conditions);
+ fprintf (file, "STMTS:%ld)\n", n_p_stmts);
}
-/* Saves in NV the name of variable P->T. */
+/* Print statistics for SCOPS to FILE. */
static void
-save_var_name (char **nv, int i, name_tree p)
-{
- const char *name = get_name (SSA_NAME_VAR (p->t));
-
- if (name)
- {
- int len = strlen (name) + 16;
- nv[i] = XNEWVEC (char, len);
- snprintf (nv[i], len, "%s_%d", name, SSA_NAME_VERSION (p->t));
- }
- else
- {
- nv[i] = XNEWVEC (char, 16);
- snprintf (nv[i], 2 + 16, "T_%d", SSA_NAME_VERSION (p->t));
- }
-
- p->name = nv[i];
-}
-
-/* Return the maximal loop depth in SCOP. */
-
-static int
-scop_max_loop_depth (scop_p scop)
+print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
{
int i;
- graphite_bb_p gbb;
- int max_nb_loops = 0;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gbb); i++)
- {
- int nb_loops = gbb_nb_loops (gbb);
- if (max_nb_loops < nb_loops)
- max_nb_loops = nb_loops;
- }
-
- return max_nb_loops;
-}
-
-/* Initialize Cloog's parameter names from the names used in GIMPLE.
- Initialize Cloog's iterator names, using 'graphite_iterator_%d'
- from 0 to scop_nb_loops (scop). */
-
-static void
-initialize_cloog_names (scop_p scop)
-{
- int i, nb_params = VEC_length (name_tree, SCOP_PARAMS (scop));
- char **params = XNEWVEC (char *, nb_params);
- int nb_iterators = scop_max_loop_depth (scop);
- int nb_scattering= cloog_program_nb_scattdims (SCOP_PROG (scop));
- char **iterators = XNEWVEC (char *, nb_iterators * 2);
- char **scattering = XNEWVEC (char *, nb_scattering);
- name_tree p;
-
- for (i = 0; VEC_iterate (name_tree, SCOP_PARAMS (scop), i, p); i++)
- save_var_name (params, i, p);
-
- cloog_names_set_nb_parameters (cloog_program_names (SCOP_PROG (scop)),
- nb_params);
- cloog_names_set_parameters (cloog_program_names (SCOP_PROG (scop)),
- params);
-
- for (i = 0; i < nb_iterators; i++)
- {
- int len = 18 + 16;
- iterators[i] = XNEWVEC (char, len);
- snprintf (iterators[i], len, "graphite_iterator_%d", i);
- }
- cloog_names_set_nb_iterators (cloog_program_names (SCOP_PROG (scop)),
- nb_iterators);
- cloog_names_set_iterators (cloog_program_names (SCOP_PROG (scop)),
- iterators);
-
- for (i = 0; i < nb_scattering; i++)
- {
- int len = 2 + 16;
- scattering[i] = XNEWVEC (char, len);
- snprintf (scattering[i], len, "s_%d", i);
- }
-
- cloog_names_set_nb_scattering (cloog_program_names (SCOP_PROG (scop)),
- nb_scattering);
- cloog_names_set_scattering (cloog_program_names (SCOP_PROG (scop)),
- scattering);
-}
-
-/* Record the parameters used in the SCOP. A variable is a parameter
- in a scop if it does not vary during the execution of that scop. */
-
-static void
-find_scop_parameters (scop_p scop)
-{
- graphite_bb_p gb;
- unsigned i;
- struct loop *loop;
- Value one;
-
- value_init (one);
- value_set_si (one, 1);
-
- /* Find the parameters used in the loop bounds. */
- for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, loop); i++)
- {
- tree nb_iters = number_of_latch_executions (loop);
-
- if (!chrec_contains_symbols (nb_iters))
- continue;
-
- nb_iters = analyze_scalar_evolution (loop, nb_iters);
- nb_iters = instantiate_scev (block_before_scop (scop), loop, nb_iters);
- scan_tree_for_params (scop, nb_iters, NULL, 0, one, false);
- }
-
- value_clear (one);
-
- /* Find the parameters used in data accesses. */
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- find_params_in_bb (scop, gb);
-
- SCOP_ADD_PARAMS (scop) = false;
-}
-
-/* Build the context constraints for SCOP: constraints and relations
- on parameters. */
-
-static void
-build_scop_context (scop_p scop)
-{
- int nb_params = scop_nb_params (scop);
- CloogMatrix *matrix = cloog_matrix_alloc (1, nb_params + 2);
-
- /* Insert '0 >= 0' in the context matrix, as it is not allowed to be
- empty. */
-
- value_set_si (matrix->p[0][0], 1);
-
- value_set_si (matrix->p[0][nb_params + 1], 0);
-
- cloog_program_set_context (SCOP_PROG (scop),
- cloog_domain_matrix2domain (matrix));
- cloog_matrix_free (matrix);
-}
-
-/* Returns a graphite_bb from BB. */
-
-static inline graphite_bb_p
-gbb_from_bb (basic_block bb)
-{
- return (graphite_bb_p) bb->aux;
-}
-
-/* Builds the constraint matrix for LOOP in SCOP. NB_OUTER_LOOPS is the
- number of loops surrounding LOOP in SCOP. OUTER_CSTR gives the
- constraints matrix for the surrounding loops. */
-
-static void
-build_loop_iteration_domains (scop_p scop, struct loop *loop,
- CloogMatrix *outer_cstr, int nb_outer_loops)
-{
- int i, j, row;
- CloogMatrix *cstr;
- graphite_bb_p gb;
-
- int nb_rows = outer_cstr->NbRows + 1;
- int nb_cols = outer_cstr->NbColumns + 1;
-
- /* Last column of CSTR is the column of constants. */
- int cst_col = nb_cols - 1;
-
- /* The column for the current loop is just after the columns of
- other outer loops. */
- int loop_col = nb_outer_loops + 1;
-
- tree nb_iters = number_of_latch_executions (loop);
-
- /* When the number of iterations is a constant or a parameter, we
- add a constraint for the upper bound of the loop. So add a row
- to the constraint matrix before allocating it. */
- if (TREE_CODE (nb_iters) == INTEGER_CST
- || !chrec_contains_undetermined (nb_iters))
- nb_rows++;
-
- cstr = cloog_matrix_alloc (nb_rows, nb_cols);
-
- /* Copy the outer constraints. */
- for (i = 0; i < outer_cstr->NbRows; i++)
- {
- /* Copy the eq/ineq and loops columns. */
- for (j = 0; j < loop_col; j++)
- value_assign (cstr->p[i][j], outer_cstr->p[i][j]);
-
- /* Leave an empty column in CSTR for the current loop, and then
- copy the parameter columns. */
- for (j = loop_col; j < outer_cstr->NbColumns; j++)
- value_assign (cstr->p[i][j + 1], outer_cstr->p[i][j]);
- }
-
- /* 0 <= loop_i */
- row = outer_cstr->NbRows;
- value_set_si (cstr->p[row][0], 1);
- value_set_si (cstr->p[row][loop_col], 1);
-
- /* loop_i <= nb_iters */
- if (TREE_CODE (nb_iters) == INTEGER_CST)
- {
- row++;
- value_set_si (cstr->p[row][0], 1);
- value_set_si (cstr->p[row][loop_col], -1);
-
- value_set_si (cstr->p[row][cst_col],
- int_cst_value (nb_iters));
- }
- else if (!chrec_contains_undetermined (nb_iters))
- {
- /* Otherwise nb_iters contains parameters: scan the nb_iters
- expression and build its matrix representation. */
- Value one;
-
- row++;
- value_set_si (cstr->p[row][0], 1);
- value_set_si (cstr->p[row][loop_col], -1);
-
- nb_iters = analyze_scalar_evolution (loop, nb_iters);
- nb_iters = instantiate_scev (block_before_scop (scop), loop, nb_iters);
-
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, nb_iters, cstr, row, one, false);
- value_clear (one);
- }
- else
- gcc_unreachable ();
-
- if (loop->inner && loop_in_sese_p (loop->inner, SCOP_REGION (scop)))
- build_loop_iteration_domains (scop, loop->inner, cstr, nb_outer_loops + 1);
-
- /* Only go to the next loops, if we are not at the outermost layer. These
- have to be handled seperately, as we can be sure, that the chain at this
- layer will be connected. */
- if (nb_outer_loops != 0 && loop->next && loop_in_sese_p (loop->next,
- SCOP_REGION (scop)))
- build_loop_iteration_domains (scop, loop->next, outer_cstr, nb_outer_loops);
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- if (gbb_loop (gb) == loop)
- GBB_DOMAIN (gb) = cloog_matrix_copy (cstr);
-
- cloog_matrix_free (cstr);
-}
-
-/* Add conditions to the domain of GB. */
-
-static void
-add_conditions_to_domain (graphite_bb_p gb)
-{
- unsigned int i,j;
- gimple stmt;
- VEC (gimple, heap) *conditions = GBB_CONDITIONS (gb);
- CloogMatrix *domain = GBB_DOMAIN (gb);
- scop_p scop = GBB_SCOP (gb);
-
- unsigned nb_rows;
- unsigned nb_cols;
- unsigned nb_new_rows = 0;
- unsigned row;
-
- if (VEC_empty (gimple, conditions))
- return;
-
- if (domain)
- {
- nb_rows = domain->NbRows;
- nb_cols = domain->NbColumns;
- }
- else
- {
- nb_rows = 0;
- nb_cols = nb_loops_around_gb (gb) + scop_nb_params (scop) + 2;
- }
-
- /* Count number of necessary new rows to add the conditions to the
- domain. */
- for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
- {
- switch (gimple_code (stmt))
- {
- case GIMPLE_COND:
- {
- enum tree_code code = gimple_cond_code (stmt);
-
- switch (code)
- {
- case NE_EXPR:
- case EQ_EXPR:
- /* NE and EQ statements are not supported right know. */
- gcc_unreachable ();
- break;
- case LT_EXPR:
- case GT_EXPR:
- case LE_EXPR:
- case GE_EXPR:
- nb_new_rows++;
- break;
- default:
- gcc_unreachable ();
- break;
- }
- break;
- }
- case GIMPLE_SWITCH:
- /* Switch statements are not supported right know. */
- gcc_unreachable ();
- break;
-
- default:
- gcc_unreachable ();
- break;
- }
- }
-
-
- /* Enlarge the matrix. */
- {
- CloogMatrix *new_domain;
- new_domain = cloog_matrix_alloc (nb_rows + nb_new_rows, nb_cols);
-
- if (domain)
- {
- for (i = 0; i < nb_rows; i++)
- for (j = 0; j < nb_cols; j++)
- value_assign (new_domain->p[i][j], domain->p[i][j]);
-
- cloog_matrix_free (domain);
- }
-
- domain = new_domain;
- GBB_DOMAIN (gb) = new_domain;
- }
-
- /* Add the conditions to the new enlarged domain matrix. */
- row = nb_rows;
- for (i = 0; VEC_iterate (gimple, conditions, i, stmt); i++)
- {
- switch (gimple_code (stmt))
- {
- case GIMPLE_COND:
- {
- Value one;
- enum tree_code code;
- tree left;
- tree right;
- loop_p loop = GBB_BB (gb)->loop_father;
-
- left = gimple_cond_lhs (stmt);
- right = gimple_cond_rhs (stmt);
-
- left = analyze_scalar_evolution (loop, left);
- right = analyze_scalar_evolution (loop, right);
-
- left = instantiate_scev (block_before_scop (scop), loop, left);
- right = instantiate_scev (block_before_scop (scop), loop, right);
-
- code = gimple_cond_code (stmt);
-
- /* The conditions for ELSE-branches are inverted. */
- if (VEC_index (gimple, gb->condition_cases, i) == NULL)
- code = invert_tree_comparison (code, false);
-
- switch (code)
- {
- case NE_EXPR:
- /* NE statements are not supported right know. */
- gcc_unreachable ();
- break;
- case EQ_EXPR:
- value_set_si (domain->p[row][0], 1);
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, left, domain, row, one, true);
- value_set_si (one, 1);
- scan_tree_for_params (scop, right, domain, row, one, false);
- row++;
- value_set_si (domain->p[row][0], 1);
- value_set_si (one, 1);
- scan_tree_for_params (scop, left, domain, row, one, false);
- value_set_si (one, 1);
- scan_tree_for_params (scop, right, domain, row, one, true);
- value_clear (one);
- row++;
- break;
- case LT_EXPR:
- value_set_si (domain->p[row][0], 1);
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, left, domain, row, one, true);
- value_set_si (one, 1);
- scan_tree_for_params (scop, right, domain, row, one, false);
- value_sub_int (domain->p[row][nb_cols - 1],
- domain->p[row][nb_cols - 1], 1);
- value_clear (one);
- row++;
- break;
- case GT_EXPR:
- value_set_si (domain->p[row][0], 1);
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, left, domain, row, one, false);
- value_set_si (one, 1);
- scan_tree_for_params (scop, right, domain, row, one, true);
- value_sub_int (domain->p[row][nb_cols - 1],
- domain->p[row][nb_cols - 1], 1);
- value_clear (one);
- row++;
- break;
- case LE_EXPR:
- value_set_si (domain->p[row][0], 1);
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, left, domain, row, one, true);
- value_set_si (one, 1);
- scan_tree_for_params (scop, right, domain, row, one, false);
- value_clear (one);
- row++;
- break;
- case GE_EXPR:
- value_set_si (domain->p[row][0], 1);
- value_init (one);
- value_set_si (one, 1);
- scan_tree_for_params (scop, left, domain, row, one, false);
- value_set_si (one, 1);
- scan_tree_for_params (scop, right, domain, row, one, true);
- value_clear (one);
- row++;
- break;
- default:
- gcc_unreachable ();
- break;
- }
- break;
- }
- case GIMPLE_SWITCH:
- /* Switch statements are not supported right know. */
- gcc_unreachable ();
- break;
-
- default:
- gcc_unreachable ();
- break;
- }
- }
-}
-
-/* Returns true when PHI defines an induction variable in the loop
- containing the PHI node. */
-
-static bool
-phi_node_is_iv (gimple phi)
-{
- loop_p loop = gimple_bb (phi)->loop_father;
- tree scev = analyze_scalar_evolution (loop, gimple_phi_result (phi));
-
- return tree_contains_chrecs (scev, NULL);
-}
-
-/* Returns true when BB contains scalar phi nodes that are not an
- induction variable of a loop. */
-
-static bool
-bb_contains_non_iv_scalar_phi_nodes (basic_block bb)
-{
- gimple phi = NULL;
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
- if (is_gimple_reg (gimple_phi_result (gsi_stmt (si))))
- {
- /* Store the unique scalar PHI node: at this point, loops
- should be in cannonical form, so we expect to see at most
- one scalar phi node in the loop header. */
- if (phi
- || bb != bb->loop_father->header)
- return true;
-
- phi = gsi_stmt (si);
- }
-
- if (!phi
- || phi_node_is_iv (phi))
- return false;
-
- return true;
-}
-
-/* Helper recursive function. Record in CONDITIONS and CASES all
- conditions from 'if's and 'switch'es occurring in BB from SCOP.
-
- Returns false when the conditions contain scalar computations that
- depend on the condition, i.e. when there are scalar phi nodes on
- the junction after the condition. Only the computations occurring
- on memory can be handled in the polyhedral model: operations that
- define scalar evolutions in conditions, that can potentially be
- used to index memory, can't be handled by the polyhedral model. */
-
-static bool
-build_scop_conditions_1 (VEC (gimple, heap) **conditions,
- VEC (gimple, heap) **cases, basic_block bb,
- scop_p scop)
-{
- bool res = true;
- int i, j;
- graphite_bb_p gbb;
- basic_block bb_child, bb_iter;
- VEC (basic_block, heap) *dom;
- gimple stmt;
-
- /* Make sure we are in the SCoP. */
- if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
- return true;
-
- if (bb_contains_non_iv_scalar_phi_nodes (bb))
- return false;
-
- gbb = gbb_from_bb (bb);
- if (gbb)
- {
- GBB_CONDITIONS (gbb) = VEC_copy (gimple, heap, *conditions);
- GBB_CONDITION_CASES (gbb) = VEC_copy (gimple, heap, *cases);
- }
-
- dom = get_dominated_by (CDI_DOMINATORS, bb);
-
- stmt = last_stmt (bb);
- if (stmt)
- {
- VEC (edge, gc) *edges;
- edge e;
-
- switch (gimple_code (stmt))
- {
- case GIMPLE_COND:
- edges = bb->succs;
- for (i = 0; VEC_iterate (edge, edges, i, e); i++)
- if ((dominated_by_p (CDI_DOMINATORS, e->dest, bb))
- && VEC_length (edge, e->dest->preds) == 1)
- {
- /* Remove the scanned block from the dominator successors. */
- for (j = 0; VEC_iterate (basic_block, dom, j, bb_iter); j++)
- if (bb_iter == e->dest)
- {
- VEC_unordered_remove (basic_block, dom, j);
- break;
- }
-
- /* Recursively scan the then or else part. */
- if (e->flags & EDGE_TRUE_VALUE)
- VEC_safe_push (gimple, heap, *cases, stmt);
- else
- {
- gcc_assert (e->flags & EDGE_FALSE_VALUE);
- VEC_safe_push (gimple, heap, *cases, NULL);
- }
-
- VEC_safe_push (gimple, heap, *conditions, stmt);
- if (!build_scop_conditions_1 (conditions, cases, e->dest, scop))
- {
- res = false;
- goto done;
- }
- VEC_pop (gimple, *conditions);
- VEC_pop (gimple, *cases);
- }
- break;
-
- case GIMPLE_SWITCH:
- {
- unsigned i;
- gimple_stmt_iterator gsi_search_gimple_label;
-
- for (i = 0; i < gimple_switch_num_labels (stmt); ++i)
- {
- basic_block bb_iter;
- size_t k;
- size_t n_cases = VEC_length (gimple, *conditions);
- unsigned n = gimple_switch_num_labels (stmt);
-
- bb_child = label_to_block
- (CASE_LABEL (gimple_switch_label (stmt, i)));
-
- for (k = 0; k < n; k++)
- if (i != k
- && label_to_block
- (CASE_LABEL (gimple_switch_label (stmt, k))) == bb_child)
- break;
-
- /* Switches with multiple case values for the same
- block are not handled. */
- if (k != n
- /* Switch cases with more than one predecessor are
- not handled. */
- || VEC_length (edge, bb_child->preds) != 1)
- {
- res = false;
- goto done;
- }
-
- /* Recursively scan the corresponding 'case' block. */
- for (gsi_search_gimple_label = gsi_start_bb (bb_child);
- !gsi_end_p (gsi_search_gimple_label);
- gsi_next (&gsi_search_gimple_label))
- {
- gimple label = gsi_stmt (gsi_search_gimple_label);
-
- if (gimple_code (label) == GIMPLE_LABEL)
- {
- tree t = gimple_label_label (label);
-
- gcc_assert (t == gimple_switch_label (stmt, i));
- VEC_replace (gimple, *cases, n_cases, label);
- break;
- }
- }
-
- if (!build_scop_conditions_1 (conditions, cases, bb_child, scop))
- {
- res = false;
- goto done;
- }
-
- /* Remove the scanned block from the dominator successors. */
- for (j = 0; VEC_iterate (basic_block, dom, j, bb_iter); j++)
- if (bb_iter == bb_child)
- {
- VEC_unordered_remove (basic_block, dom, j);
- break;
- }
- }
-
- VEC_pop (gimple, *conditions);
- VEC_pop (gimple, *cases);
- break;
- }
-
- default:
- break;
- }
- }
-
- /* Scan all immediate dominated successors. */
- for (i = 0; VEC_iterate (basic_block, dom, i, bb_child); i++)
- if (!build_scop_conditions_1 (conditions, cases, bb_child, scop))
- {
- res = false;
- goto done;
- }
-
- done:
- VEC_free (basic_block, heap, dom);
- return res;
-}
-
-/* Record all conditions from SCOP.
-
- Returns false when the conditions contain scalar computations that
- depend on the condition, i.e. when there are scalar phi nodes on
- the junction after the condition. Only the computations occurring
- on memory can be handled in the polyhedral model: operations that
- define scalar evolutions in conditions, that can potentially be
- used to index memory, can't be handled by the polyhedral model. */
-
-static bool
-build_scop_conditions (scop_p scop)
-{
- bool res;
- VEC (gimple, heap) *conditions = NULL;
- VEC (gimple, heap) *cases = NULL;
-
- res = build_scop_conditions_1 (&conditions, &cases, SCOP_ENTRY (scop), scop);
-
- VEC_free (gimple, heap, conditions);
- VEC_free (gimple, heap, cases);
- return res;
-}
-
-/* Traverses all the GBBs of the SCOP and add their constraints to the
- iteration domains. */
-
-static void
-add_conditions_to_constraints (scop_p scop)
-{
- int i;
- graphite_bb_p gbb;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gbb); i++)
- add_conditions_to_domain (gbb);
-}
-
-/* Build the current domain matrix: the loops belonging to the current
- SCOP, and that vary for the execution of the current basic block.
- Returns false if there is no loop in SCOP. */
-
-static bool
-build_scop_iteration_domain (scop_p scop)
-{
- struct loop *loop;
- CloogMatrix *outer_cstr;
- int i;
-
- /* Build cloog loop for all loops, that are in the uppermost loop layer of
- this SCoP. */
- for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, loop); i++)
- if (!loop_in_sese_p (loop_outer (loop), SCOP_REGION (scop)))
- {
- /* The outermost constraints is a matrix that has:
- -first column: eq/ineq boolean
- -last column: a constant
- -scop_nb_params columns for the parameters used in the scop. */
- outer_cstr = cloog_matrix_alloc (0, scop_nb_params (scop) + 2);
- build_loop_iteration_domains (scop, loop, outer_cstr, 0);
- cloog_matrix_free (outer_cstr);
- }
+ scop_p scop;
- return (i != 0);
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ print_graphite_scop_statistics (file, scop);
}
-/* Initializes an equation CY of the access matrix using the
- information for a subscript from AF, relatively to the loop
- indexes from LOOP_NEST and parameter indexes from PARAMS. NDIM is
- the dimension of the array access, i.e. the number of
- subscripts. Returns true when the operation succeeds. */
+/* Initialize graphite: when there are no loops returns false. */
static bool
-build_access_matrix_with_af (tree af, lambda_vector cy,
- scop_p scop, int ndim)
+graphite_initialize (void)
{
- int param_col;
-
- switch (TREE_CODE (af))
+ if (number_of_loops () <= 1)
{
- case POLYNOMIAL_CHREC:
- {
- struct loop *outer_loop;
- tree left = CHREC_LEFT (af);
- tree right = CHREC_RIGHT (af);
- int var;
-
- if (TREE_CODE (right) != INTEGER_CST)
- return false;
-
- outer_loop = get_loop (CHREC_VARIABLE (af));
- var = nb_loops_around_loop_in_scop (outer_loop, scop);
- cy[var] = int_cst_value (right);
-
- switch (TREE_CODE (left))
- {
- case POLYNOMIAL_CHREC:
- return build_access_matrix_with_af (left, cy, scop, ndim);
-
- case INTEGER_CST:
- cy[ndim - 1] = int_cst_value (left);
- return true;
-
- default:
- return build_access_matrix_with_af (left, cy, scop, ndim);
- }
- }
-
- case PLUS_EXPR:
- build_access_matrix_with_af (TREE_OPERAND (af, 0), cy, scop, ndim);
- build_access_matrix_with_af (TREE_OPERAND (af, 1), cy, scop, ndim);
- return true;
-
- case MINUS_EXPR:
- build_access_matrix_with_af (TREE_OPERAND (af, 0), cy, scop, ndim);
- build_access_matrix_with_af (TREE_OPERAND (af, 1), cy, scop, ndim);
- return true;
-
- case INTEGER_CST:
- cy[ndim - 1] = int_cst_value (af);
- return true;
-
- case SSA_NAME:
- param_col = param_index (af, scop);
- cy [ndim - scop_nb_params (scop) + param_col - 1] = 1;
- return true;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ print_global_statistics (dump_file);
- default:
- /* FIXME: access_fn can have parameters. */
return false;
}
-}
-
-/* Initialize the access matrix in the data reference REF with respect
- to the loop nesting LOOP_NEST. Return true when the operation
- succeeded. */
-
-static bool
-build_access_matrix (data_reference_p ref, graphite_bb_p gb)
-{
- int i, ndim = DR_NUM_DIMENSIONS (ref);
- struct access_matrix *am = GGC_NEW (struct access_matrix);
-
- AM_MATRIX (am) = VEC_alloc (lambda_vector, gc, ndim);
- DR_SCOP (ref) = GBB_SCOP (gb);
-
- for (i = 0; i < ndim; i++)
- {
- lambda_vector v = lambda_vector_new (ref_nb_loops (ref));
- scop_p scop = GBB_SCOP (gb);
- tree af = DR_ACCESS_FN (ref, i);
-
- if (!build_access_matrix_with_af (af, v, scop, ref_nb_loops (ref)))
- return false;
-
- VEC_quick_push (lambda_vector, AM_MATRIX (am), v);
- }
-
- DR_ACCESS_MATRIX (ref) = am;
- return true;
-}
-
-/* Build the access matrices for the data references in the SCOP. */
-
-static void
-build_scop_data_accesses (scop_p scop)
-{
- int i;
- graphite_bb_p gb;
-
- /* FIXME: Construction of access matrix is disabled until some
- pass, like the data dependence analysis, is using it. */
- return;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- {
- int j;
- data_reference_p dr;
-
- /* Construct the access matrix for each data ref, with respect to
- the loop nest of the current BB in the considered SCOP. */
- for (j = 0;
- VEC_iterate (data_reference_p, GBB_DATA_REFS (gb), j, dr);
- j++)
- {
- bool res = build_access_matrix (dr, gb);
-
- /* FIXME: At this point the DRs should always have an affine
- form. For the moment this fails as build_access_matrix
- does not build matrices with parameters. */
- gcc_assert (res);
- }
- }
-}
-
-/* Returns the tree variable from the name NAME that was given in
- Cloog representation. All the parameters are stored in PARAMS, and
- all the loop induction variables are stored in IVSTACK.
-
- FIXME: This is a hack, and Cloog should be fixed to not work with
- variable names represented as "char *string", but with void
- pointers that could be casted back to a tree. The only problem in
- doing that is that Cloog's pretty printer still assumes that
- variable names are char *strings. The solution would be to have a
- function pointer for pretty-printing that can be redirected to be
- print_generic_stmt in our case, or fprintf by default.
- ??? Too ugly to live. */
-
-static tree
-clast_name_to_gcc (const char *name, VEC (name_tree, heap) *params,
- loop_iv_stack ivstack)
-{
- int i;
- name_tree t;
- tree iv;
-
- if (params)
- for (i = 0; VEC_iterate (name_tree, params, i, t); i++)
- if (!strcmp (name, t->name))
- return t->t;
-
- iv = loop_iv_stack_get_iv_from_name (ivstack, name);
- if (iv)
- return iv;
-
- gcc_unreachable ();
-}
-
-/* Returns the maximal precision type for expressions E1 and E2. */
-
-static inline tree
-max_precision_type (tree e1, tree e2)
-{
- tree type1 = TREE_TYPE (e1);
- tree type2 = TREE_TYPE (e2);
- return TYPE_PRECISION (type1) > TYPE_PRECISION (type2) ? type1 : type2;
-}
-
-static tree
-clast_to_gcc_expression (tree, struct clast_expr *, VEC (name_tree, heap) *,
- loop_iv_stack);
-
-/* Converts a Cloog reduction expression R with reduction operation OP
- to a GCC expression tree of type TYPE. PARAMS is a vector of
- parameters of the scop, and IVSTACK contains the stack of induction
- variables. */
-
-static tree
-clast_to_gcc_expression_red (tree type, enum tree_code op,
- struct clast_reduction *r,
- VEC (name_tree, heap) *params,
- loop_iv_stack ivstack)
-{
- int i;
- tree res = clast_to_gcc_expression (type, r->elts[0], params, ivstack);
-
- for (i = 1; i < r->n; i++)
- {
- tree t = clast_to_gcc_expression (type, r->elts[i], params, ivstack);
- res = fold_build2 (op, type, res, t);
- }
- return res;
-}
-
-/* Converts a Cloog AST expression E back to a GCC expression tree of
- type TYPE. PARAMS is a vector of parameters of the scop, and
- IVSTACK contains the stack of induction variables. */
-
-static tree
-clast_to_gcc_expression (tree type, struct clast_expr *e,
- VEC (name_tree, heap) *params,
- loop_iv_stack ivstack)
-{
- switch (e->type)
- {
- case expr_term:
- {
- struct clast_term *t = (struct clast_term *) e;
-
- if (t->var)
- {
- if (value_one_p (t->val))
- {
- tree name = clast_name_to_gcc (t->var, params, ivstack);
- return fold_convert (type, name);
- }
-
- else if (value_mone_p (t->val))
- {
- tree name = clast_name_to_gcc (t->var, params, ivstack);
- name = fold_convert (type, name);
- return fold_build1 (NEGATE_EXPR, type, name);
- }
- else
- {
- tree name = clast_name_to_gcc (t->var, params, ivstack);
- tree cst = gmp_cst_to_tree (type, t->val);
- name = fold_convert (type, name);
- return fold_build2 (MULT_EXPR, type, cst, name);
- }
- }
- else
- return gmp_cst_to_tree (type, t->val);
- }
-
- case expr_red:
- {
- struct clast_reduction *r = (struct clast_reduction *) e;
-
- switch (r->type)
- {
- case clast_red_sum:
- return clast_to_gcc_expression_red (type, PLUS_EXPR, r, params, ivstack);
-
- case clast_red_min:
- return clast_to_gcc_expression_red (type, MIN_EXPR, r, params, ivstack);
-
- case clast_red_max:
- return clast_to_gcc_expression_red (type, MAX_EXPR, r, params, ivstack);
-
- default:
- gcc_unreachable ();
- }
- break;
- }
-
- case expr_bin:
- {
- struct clast_binary *b = (struct clast_binary *) e;
- struct clast_expr *lhs = (struct clast_expr *) b->LHS;
- tree tl = clast_to_gcc_expression (type, lhs, params, ivstack);
- tree tr = gmp_cst_to_tree (type, b->RHS);
-
- switch (b->type)
- {
- case clast_bin_fdiv:
- return fold_build2 (FLOOR_DIV_EXPR, type, tl, tr);
-
- case clast_bin_cdiv:
- return fold_build2 (CEIL_DIV_EXPR, type, tl, tr);
-
- case clast_bin_div:
- return fold_build2 (EXACT_DIV_EXPR, type, tl, tr);
-
- case clast_bin_mod:
- return fold_build2 (TRUNC_MOD_EXPR, type, tl, tr);
-
- default:
- gcc_unreachable ();
- }
- }
-
- default:
- gcc_unreachable ();
- }
-
- return NULL_TREE;
-}
-
-/* Returns the type for the expression E. */
-
-static tree
-gcc_type_for_clast_expr (struct clast_expr *e,
- VEC (name_tree, heap) *params,
- loop_iv_stack ivstack)
-{
- switch (e->type)
- {
- case expr_term:
- {
- struct clast_term *t = (struct clast_term *) e;
-
- if (t->var)
- return TREE_TYPE (clast_name_to_gcc (t->var, params, ivstack));
- else
- return NULL_TREE;
- }
-
- case expr_red:
- {
- struct clast_reduction *r = (struct clast_reduction *) e;
-
- if (r->n == 1)
- return gcc_type_for_clast_expr (r->elts[0], params, ivstack);
- else
- {
- int i;
- for (i = 0; i < r->n; i++)
- {
- tree type = gcc_type_for_clast_expr (r->elts[i], params, ivstack);
- if (type)
- return type;
- }
- return NULL_TREE;
- }
- }
- case expr_bin:
- {
- struct clast_binary *b = (struct clast_binary *) e;
- struct clast_expr *lhs = (struct clast_expr *) b->LHS;
- return gcc_type_for_clast_expr (lhs, params, ivstack);
- }
-
- default:
- gcc_unreachable ();
- }
-
- return NULL_TREE;
-}
-
-/* Returns the type for the equation CLEQ. */
-
-static tree
-gcc_type_for_clast_eq (struct clast_equation *cleq,
- VEC (name_tree, heap) *params,
- loop_iv_stack ivstack)
-{
- tree type = gcc_type_for_clast_expr (cleq->LHS, params, ivstack);
- if (type)
- return type;
-
- return gcc_type_for_clast_expr (cleq->RHS, params, ivstack);
-}
-
-/* Translates a clast equation CLEQ to a tree. */
-
-static tree
-graphite_translate_clast_equation (scop_p scop,
- struct clast_equation *cleq,
- loop_iv_stack ivstack)
-{
- enum tree_code comp;
- tree type = gcc_type_for_clast_eq (cleq, SCOP_PARAMS (scop), ivstack);
- tree lhs = clast_to_gcc_expression (type, cleq->LHS, SCOP_PARAMS (scop), ivstack);
- tree rhs = clast_to_gcc_expression (type, cleq->RHS, SCOP_PARAMS (scop), ivstack);
-
- if (cleq->sign == 0)
- comp = EQ_EXPR;
-
- else if (cleq->sign > 0)
- comp = GE_EXPR;
-
- else
- comp = LE_EXPR;
-
- return fold_build2 (comp, type, lhs, rhs);
-}
-
-/* Creates the test for the condition in STMT. */
-
-static tree
-graphite_create_guard_cond_expr (scop_p scop, struct clast_guard *stmt,
- loop_iv_stack ivstack)
-{
- tree cond = NULL;
- int i;
-
- for (i = 0; i < stmt->n; i++)
- {
- tree eq = graphite_translate_clast_equation (scop, &stmt->eq[i], ivstack);
-
- if (cond)
- cond = fold_build2 (TRUTH_AND_EXPR, TREE_TYPE (eq), cond, eq);
- else
- cond = eq;
- }
-
- return cond;
-}
-
-/* Creates a new if region corresponding to Cloog's guard. */
-
-static edge
-graphite_create_new_guard (scop_p scop, edge entry_edge,
- struct clast_guard *stmt,
- loop_iv_stack ivstack)
-{
- tree cond_expr = graphite_create_guard_cond_expr (scop, stmt, ivstack);
- edge exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
- return exit_edge;
-}
-
-/* Walks a CLAST and returns the first statement in the body of a
- loop. */
-
-static struct clast_user_stmt *
-clast_get_body_of_loop (struct clast_stmt *stmt)
-{
- if (!stmt
- || CLAST_STMT_IS_A (stmt, stmt_user))
- return (struct clast_user_stmt *) stmt;
-
- if (CLAST_STMT_IS_A (stmt, stmt_for))
- return clast_get_body_of_loop (((struct clast_for *) stmt)->body);
-
- if (CLAST_STMT_IS_A (stmt, stmt_guard))
- return clast_get_body_of_loop (((struct clast_guard *) stmt)->then);
-
- if (CLAST_STMT_IS_A (stmt, stmt_block))
- return clast_get_body_of_loop (((struct clast_block *) stmt)->body);
-
- gcc_unreachable ();
-}
-
-/* Returns the induction variable for the loop that gets translated to
- STMT. */
-
-static tree
-gcc_type_for_iv_of_clast_loop (struct clast_for *stmt_for)
-{
- struct clast_user_stmt *stmt = clast_get_body_of_loop ((struct clast_stmt *) stmt_for);
- const char *cloog_iv = stmt_for->iterator;
- CloogStatement *cs = stmt->statement;
- graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
-
- return gcc_type_for_cloog_iv (cloog_iv, gbb);
-}
-
-/* Creates a new LOOP corresponding to Cloog's STMT. Inserts an induction
- variable for the new LOOP. New LOOP is attached to CFG starting at
- ENTRY_EDGE. LOOP is inserted into the loop tree and becomes the child
- loop of the OUTER_LOOP. */
-
-static struct loop *
-graphite_create_new_loop (scop_p scop, edge entry_edge,
- struct clast_for *stmt, loop_iv_stack ivstack,
- loop_p outer)
-{
- tree type = gcc_type_for_iv_of_clast_loop (stmt);
- VEC (name_tree, heap) *params = SCOP_PARAMS (scop);
- tree lb = clast_to_gcc_expression (type, stmt->LB, params, ivstack);
- tree ub = clast_to_gcc_expression (type, stmt->UB, params, ivstack);
- tree stride = gmp_cst_to_tree (type, stmt->stride);
- tree ivvar = create_tmp_var (type, "graphiteIV");
- tree iv_before;
- loop_p loop = create_empty_loop_on_edge
- (entry_edge, lb, stride, ub, ivvar, &iv_before,
- outer ? outer : entry_edge->src->loop_father);
-
- add_referenced_var (ivvar);
- loop_iv_stack_push_iv (ivstack, iv_before, stmt->iterator);
- return loop;
-}
-
-/* Rename the SSA_NAMEs used in STMT and that appear in IVSTACK. */
-
-static void
-rename_variables_in_stmt (gimple stmt, htab_t map)
-{
- ssa_op_iter iter;
- use_operand_p use_p;
-
- FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
- {
- tree use = USE_FROM_PTR (use_p);
- tree new_name = get_new_name_from_old_name (map, use);
-
- replace_exp (use_p, new_name);
- }
-
- update_stmt (stmt);
-}
-
-/* Returns true if SSA_NAME is a parameter of SCOP. */
-
-static bool
-is_parameter (scop_p scop, tree ssa_name)
-{
- int i;
- VEC (name_tree, heap) *params = SCOP_PARAMS (scop);
- name_tree param;
-
- for (i = 0; VEC_iterate (name_tree, params, i, param); i++)
- if (param->t == ssa_name)
- return true;
-
- return false;
-}
-
-/* Returns true if NAME is an induction variable. */
-
-static bool
-is_iv (tree name)
-{
- return gimple_code (SSA_NAME_DEF_STMT (name)) == GIMPLE_PHI;
-}
-
-static void expand_scalar_variables_stmt (gimple, basic_block, scop_p,
- htab_t);
-static tree
-expand_scalar_variables_expr (tree, tree, enum tree_code, tree, basic_block,
- scop_p, htab_t, gimple_stmt_iterator *);
-
-/* Copies at GSI all the scalar computations on which the ssa_name OP0
- depends on in the SCOP: these are all the scalar variables used in
- the definition of OP0, that are defined outside BB and still in the
- SCOP, i.e. not a parameter of the SCOP. The expression that is
- returned contains only induction variables from the generated code:
- MAP contains the induction variables renaming mapping, and is used
- to translate the names of induction variables. */
-
-static tree
-expand_scalar_variables_ssa_name (tree op0, basic_block bb,
- scop_p scop, htab_t map,
- gimple_stmt_iterator *gsi)
-{
- tree var0, var1, type;
- gimple def_stmt;
- enum tree_code subcode;
-
- if (is_parameter (scop, op0)
- || is_iv (op0))
- return get_new_name_from_old_name (map, op0);
-
- def_stmt = SSA_NAME_DEF_STMT (op0);
-
- if (gimple_bb (def_stmt) == bb)
- {
- /* If the defining statement is in the basic block already
- we do not need to create a new expression for it, we
- only need to ensure its operands are expanded. */
- expand_scalar_variables_stmt (def_stmt, bb, scop, map);
- return get_new_name_from_old_name (map, op0);
- }
- else
- {
- if (gimple_code (def_stmt) != GIMPLE_ASSIGN
- || !bb_in_sese_p (gimple_bb (def_stmt), SCOP_REGION (scop)))
- return get_new_name_from_old_name (map, op0);
-
- var0 = gimple_assign_rhs1 (def_stmt);
- subcode = gimple_assign_rhs_code (def_stmt);
- var1 = gimple_assign_rhs2 (def_stmt);
- type = gimple_expr_type (def_stmt);
-
- return expand_scalar_variables_expr (type, var0, subcode, var1, bb, scop,
- map, gsi);
- }
-}
-
-/* Copies at GSI all the scalar computations on which the expression
- OP0 CODE OP1 depends on in the SCOP: these are all the scalar
- variables used in OP0 and OP1, defined outside BB and still defined
- in the SCOP, i.e. not a parameter of the SCOP. The expression that
- is returned contains only induction variables from the generated
- code: MAP contains the induction variables renaming mapping, and is
- used to translate the names of induction variables. */
-
-static tree
-expand_scalar_variables_expr (tree type, tree op0, enum tree_code code,
- tree op1, basic_block bb, scop_p scop,
- htab_t map, gimple_stmt_iterator *gsi)
-{
- if (TREE_CODE_CLASS (code) == tcc_constant
- || TREE_CODE_CLASS (code) == tcc_declaration)
- return op0;
-
- /* For data references we have to duplicate also its memory
- indexing. */
- if (TREE_CODE_CLASS (code) == tcc_reference)
- {
- switch (code)
- {
- case INDIRECT_REF:
- {
- tree old_name = TREE_OPERAND (op0, 0);
- tree expr = expand_scalar_variables_ssa_name
- (old_name, bb, scop, map, gsi);
- tree new_name = force_gimple_operand_gsi (gsi, expr, true, NULL,
- true, GSI_SAME_STMT);
-
- return fold_build1 (code, type, new_name);
- }
-
- case ARRAY_REF:
- {
- tree op00 = TREE_OPERAND (op0, 0);
- tree op01 = TREE_OPERAND (op0, 1);
- tree op02 = TREE_OPERAND (op0, 2);
- tree op03 = TREE_OPERAND (op0, 3);
- tree base = expand_scalar_variables_expr
- (TREE_TYPE (op00), op00, TREE_CODE (op00), NULL, bb, scop,
- map, gsi);
- tree subscript = expand_scalar_variables_expr
- (TREE_TYPE (op01), op01, TREE_CODE (op01), NULL, bb, scop,
- map, gsi);
-
- return build4 (ARRAY_REF, type, base, subscript, op02, op03);
- }
-
- default:
- /* The above cases should catch everything. */
- gcc_unreachable ();
- }
- }
-
- if (TREE_CODE_CLASS (code) == tcc_unary)
- {
- tree op0_type = TREE_TYPE (op0);
- enum tree_code op0_code = TREE_CODE (op0);
- tree op0_expr = expand_scalar_variables_expr (op0_type, op0, op0_code,
- NULL, bb, scop, map, gsi);
-
- return fold_build1 (code, type, op0_expr);
- }
-
- if (TREE_CODE_CLASS (code) == tcc_binary)
- {
- tree op0_type = TREE_TYPE (op0);
- enum tree_code op0_code = TREE_CODE (op0);
- tree op0_expr = expand_scalar_variables_expr (op0_type, op0, op0_code,
- NULL, bb, scop, map, gsi);
- tree op1_type = TREE_TYPE (op1);
- enum tree_code op1_code = TREE_CODE (op1);
- tree op1_expr = expand_scalar_variables_expr (op1_type, op1, op1_code,
- NULL, bb, scop, map, gsi);
-
- return fold_build2 (code, type, op0_expr, op1_expr);
- }
-
- if (code == SSA_NAME)
- return expand_scalar_variables_ssa_name (op0, bb, scop, map, gsi);
-
- gcc_unreachable ();
- return NULL;
-}
-
-/* Copies at the beginning of BB all the scalar computations on which
- STMT depends on in the SCOP: these are all the scalar variables used
- in STMT, defined outside BB and still defined in the SCOP, i.e. not a
- parameter of the SCOP. The expression that is returned contains
- only induction variables from the generated code: MAP contains the
- induction variables renaming mapping, and is used to translate the
- names of induction variables. */
-
-static void
-expand_scalar_variables_stmt (gimple stmt, basic_block bb, scop_p scop,
- htab_t map)
-{
- ssa_op_iter iter;
- use_operand_p use_p;
- gimple_stmt_iterator gsi = gsi_after_labels (bb);
-
- FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
- {
- tree use = USE_FROM_PTR (use_p);
- tree type = TREE_TYPE (use);
- enum tree_code code = TREE_CODE (use);
- tree use_expr = expand_scalar_variables_expr (type, use, code, NULL, bb,
- scop, map, &gsi);
- if (use_expr != use)
- {
- tree new_use =
- force_gimple_operand_gsi (&gsi, use_expr, true, NULL,
- true, GSI_NEW_STMT);
- replace_exp (use_p, new_use);
- }
- }
-
- update_stmt (stmt);
-}
-
-/* Copies at the beginning of BB all the scalar computations on which
- BB depends on in the SCOP: these are all the scalar variables used
- in BB, defined outside BB and still defined in the SCOP, i.e. not a
- parameter of the SCOP. The expression that is returned contains
- only induction variables from the generated code: MAP contains the
- induction variables renaming mapping, and is used to translate the
- names of induction variables. */
-
-static void
-expand_scalar_variables (basic_block bb, scop_p scop, htab_t map)
-{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi);)
- {
- gimple stmt = gsi_stmt (gsi);
- expand_scalar_variables_stmt (stmt, bb, scop, map);
- gsi_next (&gsi);
- }
-}
-
-/* Rename all the SSA_NAMEs from block BB according to the MAP. */
-
-static void
-rename_variables (basic_block bb, htab_t map)
-{
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- rename_variables_in_stmt (gsi_stmt (gsi), map);
-}
-
-/* Remove condition from BB. */
-
-static void
-remove_condition (basic_block bb)
-{
- gimple last = last_stmt (bb);
-
- if (last && gimple_code (last) == GIMPLE_COND)
- {
- gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gsi_remove (&gsi, true);
- }
-}
-
-/* Returns the first successor edge of BB with EDGE_TRUE_VALUE flag set. */
-
-static edge
-get_true_edge_from_guard_bb (basic_block bb)
-{
- edge e;
- edge_iterator ei;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (e->flags & EDGE_TRUE_VALUE)
- return e;
-
- gcc_unreachable ();
- return NULL;
-}
-
-/* Returns the first successor edge of BB with EDGE_TRUE_VALUE flag cleared. */
-
-static edge
-get_false_edge_from_guard_bb (basic_block bb)
-{
- edge e;
- edge_iterator ei;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (!(e->flags & EDGE_TRUE_VALUE))
- return e;
-
- gcc_unreachable ();
- return NULL;
-}
-
-/* Inserts in MAP a tuple (OLD_NAME, NEW_NAME) for the induction
- variables of the loops around GBB in SCOP, i.e. GBB_LOOPS.
- NEW_NAME is obtained from IVSTACK. IVSTACK has the same stack
- ordering as GBB_LOOPS. */
-
-static void
-build_iv_mapping (loop_iv_stack ivstack, htab_t map, gbb_p gbb, scop_p scop)
-{
- int i;
- name_tree iv;
- PTR *slot;
-
- for (i = 0; VEC_iterate (name_tree, SCOP_OLDIVS (scop), i, iv); i++)
- {
- struct rename_map_elt_d tmp;
-
- if (!flow_bb_inside_loop_p (iv->loop, GBB_BB (gbb)))
- continue;
-
- tmp.old_name = iv->t;
- slot = htab_find_slot (map, &tmp, INSERT);
-
- if (!*slot)
- {
- tree new_name = loop_iv_stack_get_iv (ivstack,
- gbb_loop_index (gbb, iv->loop));
- *slot = new_rename_map_elt (iv->t, new_name);
- }
- }
-}
-
-/* Register in MAP the tuple (old_name, new_name). */
-
-static void
-register_old_and_new_names (htab_t map, tree old_name, tree new_name)
-{
- struct rename_map_elt_d tmp;
- PTR *slot;
-
- tmp.old_name = old_name;
- slot = htab_find_slot (map, &tmp, INSERT);
-
- if (!*slot)
- *slot = new_rename_map_elt (old_name, new_name);
-}
-
-/* Create a duplicate of the basic block BB. NOTE: This does not
- preserve SSA form. */
-
-static void
-graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, htab_t map)
-{
- gimple_stmt_iterator gsi, gsi_tgt;
-
- gsi_tgt = gsi_start_bb (new_bb);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- def_operand_p def_p;
- ssa_op_iter op_iter;
- int region;
- gimple stmt = gsi_stmt (gsi);
- gimple copy;
-
- if (gimple_code (stmt) == GIMPLE_LABEL)
- continue;
-
- /* Create a new copy of STMT and duplicate STMT's virtual
- operands. */
- copy = gimple_copy (stmt);
- gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT);
- mark_sym_for_renaming (gimple_vop (cfun));
-
- region = lookup_stmt_eh_region (stmt);
- if (region >= 0)
- add_stmt_to_eh_region (copy, region);
- gimple_duplicate_stmt_histograms (cfun, copy, cfun, stmt);
-
- /* Create new names for all the definitions created by COPY and
- add replacement mappings for each new name. */
- FOR_EACH_SSA_DEF_OPERAND (def_p, copy, op_iter, SSA_OP_ALL_DEFS)
- {
- tree old_name = DEF_FROM_PTR (def_p);
- tree new_name = create_new_def_for (old_name, copy, def_p);
- register_old_and_new_names (map, old_name, new_name);
- }
- }
-}
-
-/* Records in SCOP_LIVEOUT_RENAMES the names that are live out of
- the SCOP and that appear in the RENAME_MAP. */
-
-static void
-register_scop_liveout_renames (scop_p scop, htab_t rename_map)
-{
- int i;
- sese region = SCOP_REGION (scop);
-
- for (i = 0; i < SESE_NUM_VER (region); i++)
- if (bitmap_bit_p (SESE_LIVEOUT (region), i)
- && is_gimple_reg (ssa_name (i)))
- {
- tree old_name = ssa_name (i);
- tree new_name = get_new_name_from_old_name (rename_map, old_name);
-
- register_old_and_new_names (SCOP_LIVEOUT_RENAMES (scop),
- old_name, new_name);
- }
-}
-
-/* Copies BB and includes in the copied BB all the statements that can
- be reached following the use-def chains from the memory accesses,
- and returns the next edge following this new block. */
-
-static edge
-copy_bb_and_scalar_dependences (basic_block bb, scop_p scop,
- edge next_e, htab_t map)
-{
- basic_block new_bb = split_edge (next_e);
-
- next_e = single_succ_edge (new_bb);
- graphite_copy_stmts_from_block (bb, new_bb, map);
- remove_condition (new_bb);
- rename_variables (new_bb, map);
- remove_phi_nodes (new_bb);
- expand_scalar_variables (new_bb, scop, map);
- register_scop_liveout_renames (scop, map);
-
- return next_e;
-}
-
-/* Helper function for htab_traverse in insert_loop_close_phis. */
-
-static int
-add_loop_exit_phis (void **slot, void *s)
-{
- struct rename_map_elt_d *entry = (struct rename_map_elt_d *) *slot;
- tree new_name = entry->new_name;
- basic_block bb = (basic_block) s;
- gimple phi = create_phi_node (new_name, bb);
- tree res = create_new_def_for (gimple_phi_result (phi), phi,
- gimple_phi_result_ptr (phi));
-
- add_phi_arg (phi, new_name, single_pred_edge (bb));
-
- entry->new_name = res;
- *slot = entry;
- return 1;
-}
-
-/* Iterate over the SCOP_LIVEOUT_RENAMES (SCOP) and get tuples of the
- form (OLD_NAME, NEW_NAME). Insert in BB "RES = phi (NEW_NAME)",
- and finally register in SCOP_LIVEOUT_RENAMES (scop) the tuple
- (OLD_NAME, RES). */
-
-static void
-insert_loop_close_phis (scop_p scop, basic_block bb)
-{
- update_ssa (TODO_update_ssa);
- htab_traverse (SCOP_LIVEOUT_RENAMES (scop), add_loop_exit_phis, bb);
- update_ssa (TODO_update_ssa);
-}
-
-/* Helper structure for htab_traverse in insert_guard_phis. */
-
-struct igp {
- basic_block bb;
- edge true_edge, false_edge;
- htab_t liveout_before_guard;
-};
-
-/* Return the default name that is before the guard. */
-
-static tree
-default_liveout_before_guard (htab_t liveout_before_guard, tree old_name)
-{
- tree res = get_new_name_from_old_name (liveout_before_guard, old_name);
-
- if (res == old_name)
- {
- if (is_gimple_reg (res))
- return fold_convert (TREE_TYPE (res), integer_zero_node);
- return gimple_default_def (cfun, res);
- }
-
- return res;
-}
-
-/* Helper function for htab_traverse in insert_guard_phis. */
-
-static int
-add_guard_exit_phis (void **slot, void *s)
-{
- struct rename_map_elt_d *entry = (struct rename_map_elt_d *) *slot;
- struct igp *i = (struct igp *) s;
- basic_block bb = i->bb;
- edge true_edge = i->true_edge;
- edge false_edge = i->false_edge;
- tree name1 = entry->new_name;
- tree name2 = default_liveout_before_guard (i->liveout_before_guard,
- entry->old_name);
- gimple phi = create_phi_node (name1, bb);
- tree res = create_new_def_for (gimple_phi_result (phi), phi,
- gimple_phi_result_ptr (phi));
-
- add_phi_arg (phi, name1, true_edge);
- add_phi_arg (phi, name2, false_edge);
-
- entry->new_name = res;
- *slot = entry;
- return 1;
-}
-
-/* Iterate over the SCOP_LIVEOUT_RENAMES (SCOP) and get tuples of the
- form (OLD_NAME, NAME1). If there is a correspondent tuple of
- OLD_NAME in LIVEOUT_BEFORE_GUARD, i.e. (OLD_NAME, NAME2) then
- insert in BB
-
- | RES = phi (NAME1 (on TRUE_EDGE), NAME2 (on FALSE_EDGE))"
-
- if there is no tuple for OLD_NAME in LIVEOUT_BEFORE_GUARD, insert
-
- | RES = phi (NAME1 (on TRUE_EDGE),
- | DEFAULT_DEFINITION of NAME1 (on FALSE_EDGE))".
-
- Finally register in SCOP_LIVEOUT_RENAMES (scop) the tuple
- (OLD_NAME, RES). */
-
-static void
-insert_guard_phis (scop_p scop, basic_block bb, edge true_edge,
- edge false_edge, htab_t liveout_before_guard)
-{
- struct igp i;
- i.bb = bb;
- i.true_edge = true_edge;
- i.false_edge = false_edge;
- i.liveout_before_guard = liveout_before_guard;
-
- update_ssa (TODO_update_ssa);
- htab_traverse (SCOP_LIVEOUT_RENAMES (scop), add_guard_exit_phis, &i);
- update_ssa (TODO_update_ssa);
-}
-
-/* Helper function for htab_traverse. */
-
-static int
-copy_renames (void **slot, void *s)
-{
- struct rename_map_elt_d *entry = (struct rename_map_elt_d *) *slot;
- htab_t res = (htab_t) s;
- tree old_name = entry->old_name;
- tree new_name = entry->new_name;
- struct rename_map_elt_d tmp;
- PTR *x;
-
- tmp.old_name = old_name;
- x = htab_find_slot (res, &tmp, INSERT);
-
- if (!*x)
- *x = new_rename_map_elt (old_name, new_name);
-
- return 1;
-}
-
-/* Translates a CLAST statement STMT to GCC representation in the
- context of a SCOP.
-
- - NEXT_E is the edge where new generated code should be attached.
- - CONTEXT_LOOP is the loop in which the generated code will be placed
- (might be NULL).
- - IVSTACK contains the surrounding loops around the statement to be
- translated.
-*/
-
-static edge
-translate_clast (scop_p scop, struct loop *context_loop,
- struct clast_stmt *stmt, edge next_e, loop_iv_stack ivstack)
-{
- if (!stmt)
- return next_e;
-
- if (CLAST_STMT_IS_A (stmt, stmt_root))
- return translate_clast (scop, context_loop, stmt->next, next_e, ivstack);
-
- if (CLAST_STMT_IS_A (stmt, stmt_user))
- {
- htab_t map;
- CloogStatement *cs = ((struct clast_user_stmt *) stmt)->statement;
- graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
-
- if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
- return next_e;
-
- map = htab_create (10, rename_map_elt_info, eq_rename_map_elts, free);
- loop_iv_stack_patch_for_consts (ivstack, (struct clast_user_stmt *) stmt);
- build_iv_mapping (ivstack, map, gbb, scop);
- next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), scop,
- next_e, map);
- htab_delete (map);
- loop_iv_stack_remove_constants (ivstack);
- recompute_all_dominators ();
- update_ssa (TODO_update_ssa);
- graphite_verify ();
- return translate_clast (scop, context_loop, stmt->next, next_e, ivstack);
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_for))
- {
- struct loop *loop
- = graphite_create_new_loop (scop, next_e, (struct clast_for *) stmt,
- ivstack, context_loop ? context_loop
- : get_loop (0));
- edge last_e = single_exit (loop);
-
- next_e = translate_clast (scop, loop, ((struct clast_for *) stmt)->body,
- single_pred_edge (loop->latch), ivstack);
- redirect_edge_succ_nodup (next_e, loop->latch);
-
- set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
- loop_iv_stack_pop (ivstack);
- last_e = single_succ_edge (split_edge (last_e));
- insert_loop_close_phis (scop, last_e->src);
-
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (scop, context_loop, stmt->next, last_e, ivstack);
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_guard))
- {
- htab_t liveout_before_guard = htab_create (10, rename_map_elt_info,
- eq_rename_map_elts, free);
- edge last_e = graphite_create_new_guard (scop, next_e,
- ((struct clast_guard *) stmt),
- ivstack);
- edge true_e = get_true_edge_from_guard_bb (next_e->dest);
- edge false_e = get_false_edge_from_guard_bb (next_e->dest);
- edge exit_true_e = single_succ_edge (true_e->dest);
- edge exit_false_e = single_succ_edge (false_e->dest);
-
- htab_traverse (SCOP_LIVEOUT_RENAMES (scop), copy_renames,
- liveout_before_guard);
-
- next_e = translate_clast (scop, context_loop,
- ((struct clast_guard *) stmt)->then,
- true_e, ivstack);
- insert_guard_phis (scop, last_e->src, exit_true_e, exit_false_e,
- liveout_before_guard);
- htab_delete (liveout_before_guard);
- recompute_all_dominators ();
- graphite_verify ();
-
- return translate_clast (scop, context_loop, stmt->next, last_e, ivstack);
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_block))
- {
- next_e = translate_clast (scop, context_loop,
- ((struct clast_block *) stmt)->body,
- next_e, ivstack);
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (scop, context_loop, stmt->next, next_e, ivstack);
- }
-
- gcc_unreachable ();
-}
-
-/* Free the SCATTERING domain list. */
-
-static void
-free_scattering (CloogDomainList *scattering)
-{
- while (scattering)
- {
- CloogDomain *dom = cloog_domain (scattering);
- CloogDomainList *next = cloog_next_domain (scattering);
-
- cloog_domain_free (dom);
- free (scattering);
- scattering = next;
- }
-}
-
-/* Build cloog program for SCoP. */
-
-static void
-build_cloog_prog (scop_p scop)
-{
- int i;
- int max_nb_loops = scop_max_loop_depth (scop);
- graphite_bb_p gbb;
- CloogLoop *loop_list = NULL;
- CloogBlockList *block_list = NULL;
- CloogDomainList *scattering = NULL;
- CloogProgram *prog = SCOP_PROG (scop);
- int nbs = 2 * max_nb_loops + 1;
- int *scaldims = (int *) xmalloc (nbs * (sizeof (int)));
-
- cloog_program_set_nb_scattdims (prog, nbs);
- initialize_cloog_names (scop);
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gbb); i++)
- {
- /* Build new block. */
- CloogMatrix *domain = GBB_DOMAIN (gbb);
- CloogStatement *stmt = cloog_statement_alloc (GBB_BB (gbb)->index);
- CloogBlock *block = cloog_block_alloc (stmt, 0, NULL,
- nb_loops_around_gb (gbb));
- cloog_statement_set_usr (stmt, gbb);
-
- /* Add empty domain to all bbs, which do not yet have a domain, as they
- are not part of any loop. */
- if (domain == NULL)
- {
- domain = cloog_matrix_alloc (0, scop_nb_params (scop) + 2);
- GBB_DOMAIN (gbb) = domain;
- }
-
- /* Build loop list. */
- {
- CloogLoop *new_loop_list = cloog_loop_malloc ();
- cloog_loop_set_next (new_loop_list, loop_list);
- cloog_loop_set_domain (new_loop_list,
- cloog_domain_matrix2domain (domain));
- cloog_loop_set_block (new_loop_list, block);
- loop_list = new_loop_list;
- }
-
- /* Build block list. */
- {
- CloogBlockList *new_block_list = cloog_block_list_malloc ();
-
- cloog_block_list_set_next (new_block_list, block_list);
- cloog_block_list_set_block (new_block_list, block);
- block_list = new_block_list;
- }
-
- /* Build scattering list. */
- {
- /* XXX: Replace with cloog_domain_list_alloc(), when available. */
- CloogDomainList *new_scattering
- = (CloogDomainList *) xmalloc (sizeof (CloogDomainList));
- CloogMatrix *scat_mat = schedule_to_scattering (gbb, nbs);
-
- cloog_set_next_domain (new_scattering, scattering);
- cloog_set_domain (new_scattering,
- cloog_domain_matrix2domain (scat_mat));
- scattering = new_scattering;
- cloog_matrix_free (scat_mat);
- }
- }
-
- cloog_program_set_loop (prog, loop_list);
- cloog_program_set_blocklist (prog, block_list);
-
- for (i = 0; i < nbs; i++)
- scaldims[i] = 0 ;
-
- cloog_program_set_scaldims (prog, scaldims);
-
- /* Extract scalar dimensions to simplify the code generation problem. */
- cloog_program_extract_scalars (prog, scattering);
-
- /* Apply scattering. */
- cloog_program_scatter (prog, scattering);
- free_scattering (scattering);
-
- /* Iterators corresponding to scalar dimensions have to be extracted. */
- cloog_names_scalarize (cloog_program_names (prog), nbs,
- cloog_program_scaldims (prog));
-
- /* Free blocklist. */
- {
- CloogBlockList *next = cloog_program_blocklist (prog);
-
- while (next)
- {
- CloogBlockList *toDelete = next;
- next = cloog_block_list_next (next);
- cloog_block_list_set_next (toDelete, NULL);
- cloog_block_list_set_block (toDelete, NULL);
- cloog_block_list_free (toDelete);
- }
- cloog_program_set_blocklist (prog, NULL);
- }
-}
-
-/* Return the options that will be used in GLOOG. */
-
-static CloogOptions *
-set_cloog_options (void)
-{
- CloogOptions *options = cloog_options_malloc ();
-
- /* Change cloog output language to C. If we do use FORTRAN instead, cloog
- will stop e.g. with "ERROR: unbounded loops not allowed in FORTRAN.", if
- we pass an incomplete program to cloog. */
- options->language = LANGUAGE_C;
-
- /* Enable complex equality spreading: removes dummy statements
- (assignments) in the generated code which repeats the
- substitution equations for statements. This is useless for
- GLooG. */
- options->esp = 1;
-
- /* Enable C pretty-printing mode: normalizes the substitution
- equations for statements. */
- options->cpp = 1;
-
- /* Allow cloog to build strides with a stride width different to one.
- This example has stride = 4:
-
- for (i = 0; i < 20; i += 4)
- A */
- options->strides = 1;
-
- /* Disable optimizations and make cloog generate source code closer to the
- input. This is useful for debugging, but later we want the optimized
- code.
-
- XXX: We can not disable optimizations, as loop blocking is not working
- without them. */
- if (0)
- {
- options->f = -1;
- options->l = INT_MAX;
- }
-
- return options;
-}
-
-/* Prints STMT to STDERR. */
-
-void
-debug_clast_stmt (struct clast_stmt *stmt)
-{
- CloogOptions *options = set_cloog_options ();
-
- pprint (stderr, stmt, 0, options);
-}
-
-/* Find the right transform for the SCOP, and return a Cloog AST
- representing the new form of the program. */
-
-static struct clast_stmt *
-find_transform (scop_p scop)
-{
- struct clast_stmt *stmt;
- CloogOptions *options = set_cloog_options ();
-
- /* Connect new cloog prog generation to graphite. */
- build_cloog_prog (scop);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Cloog Input [\n");
- cloog_program_print (dump_file, SCOP_PROG(scop));
- fprintf (dump_file, "]\n");
- }
-
- SCOP_PROG (scop) = cloog_program_generate (SCOP_PROG (scop), options);
- stmt = cloog_clast_create (SCOP_PROG (scop), options);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "Cloog Output[\n");
- pprint (dump_file, stmt, 0, options);
- cloog_program_dump_cloog (dump_file, SCOP_PROG (scop));
- fprintf (dump_file, "]\n");
- }
-
- cloog_options_free (options);
- return stmt;
-}
-
-/* Remove from the CFG the REGION. */
-
-static inline void
-remove_sese_region (sese region)
-{
- VEC (basic_block, heap) *bbs = NULL;
- basic_block entry_bb = SESE_ENTRY (region)->dest;
- basic_block exit_bb = SESE_EXIT (region)->dest;
- basic_block bb;
- int i;
-
- VEC_safe_push (basic_block, heap, bbs, entry_bb);
- gather_blocks_in_sese_region (entry_bb, exit_bb, &bbs);
-
- for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
- delete_basic_block (bb);
-
- VEC_free (basic_block, heap, bbs);
-}
-
-typedef struct ifsese_d
-{
- sese region;
- sese true_region;
- sese false_region;
-} *ifsese;
-
-static inline edge
-if_region_entry (ifsese if_region)
-{
- return SESE_ENTRY (if_region->region);
-}
-
-static inline edge
-if_region_exit (ifsese if_region)
-{
- return SESE_EXIT (if_region->region);
-}
-
-static inline basic_block
-if_region_get_condition_block (ifsese if_region)
-{
- return if_region_entry (if_region)->dest;
-}
-
-static inline void
-if_region_set_false_region (ifsese if_region, sese region)
-{
- basic_block condition = if_region_get_condition_block (if_region);
- edge false_edge = get_false_edge_from_guard_bb (condition);
- basic_block dummy = false_edge->dest;
- edge entry_region = SESE_ENTRY (region);
- edge exit_region = SESE_EXIT (region);
- basic_block before_region = entry_region->src;
- basic_block last_in_region = exit_region->src;
- void **slot = htab_find_slot_with_hash (current_loops->exits, exit_region,
- htab_hash_pointer (exit_region),
- NO_INSERT);
-
- entry_region->flags = false_edge->flags;
- false_edge->flags = exit_region->flags;
-
- redirect_edge_pred (entry_region, condition);
- redirect_edge_pred (exit_region, before_region);
- redirect_edge_pred (false_edge, last_in_region);
- redirect_edge_succ (false_edge, single_succ (dummy));
- delete_basic_block (dummy);
-
- exit_region->flags = EDGE_FALLTHRU;
- recompute_all_dominators ();
-
- SESE_EXIT (region) = false_edge;
- if_region->false_region = region;
-
- if (slot)
- {
- struct loop_exit *loop_exit = GGC_CNEW (struct loop_exit);
-
- memcpy (loop_exit, *((struct loop_exit **) slot), sizeof (struct loop_exit));
- htab_clear_slot (current_loops->exits, slot);
-
- slot = htab_find_slot_with_hash (current_loops->exits, false_edge,
- htab_hash_pointer (false_edge),
- INSERT);
- loop_exit->e = false_edge;
- *slot = loop_exit;
- false_edge->src->loop_father->exits->next = loop_exit;
- }
-}
-
-static ifsese
-create_if_region_on_edge (edge entry, tree condition)
-{
- edge e;
- edge_iterator ei;
- sese sese_region = GGC_NEW (struct sese_d);
- sese true_region = GGC_NEW (struct sese_d);
- sese false_region = GGC_NEW (struct sese_d);
- ifsese if_region = GGC_NEW (struct ifsese_d);
- edge exit = create_empty_if_region_on_edge (entry, condition);
-
- if_region->region = sese_region;
- if_region->region->entry = entry;
- if_region->region->exit = exit;
-
- FOR_EACH_EDGE (e, ei, entry->dest->succs)
- {
- if (e->flags & EDGE_TRUE_VALUE)
- {
- true_region->entry = e;
- true_region->exit = single_succ_edge (e->dest);
- if_region->true_region = true_region;
- }
- else if (e->flags & EDGE_FALSE_VALUE)
- {
- false_region->entry = e;
- false_region->exit = single_succ_edge (e->dest);
- if_region->false_region = false_region;
- }
- }
-
- return if_region;
-}
-
-/* Moves REGION in a condition expression:
- | if (1)
- | ;
- | else
- | REGION;
-*/
-
-static ifsese
-move_sese_in_condition (sese region)
-{
- basic_block pred_block = split_edge (SESE_ENTRY (region));
- ifsese if_region = NULL;
-
- SESE_ENTRY (region) = single_succ_edge (pred_block);
- if_region = create_if_region_on_edge (single_pred_edge (pred_block), integer_one_node);
- if_region_set_false_region (if_region, region);
-
- return if_region;
-}
-
-/* Add exit phis for USE on EXIT. */
-
-static void
-scop_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e)
-{
- gimple phi = create_phi_node (use, exit);
-
- create_new_def_for (gimple_phi_result (phi), phi,
- gimple_phi_result_ptr (phi));
- add_phi_arg (phi, use, false_e);
- add_phi_arg (phi, use, true_e);
-}
-
-/* Add phi nodes for VAR that is used in LIVEIN. Phi nodes are
- inserted in block BB. */
-
-static void
-scop_add_exit_phis_var (basic_block bb, tree var, bitmap livein,
- edge false_e, edge true_e)
-{
- bitmap def;
- basic_block def_bb = gimple_bb (SSA_NAME_DEF_STMT (var));
-
- if (is_gimple_reg (var))
- bitmap_clear_bit (livein, def_bb->index);
- else
- bitmap_set_bit (livein, def_bb->index);
-
- def = BITMAP_ALLOC (NULL);
- bitmap_set_bit (def, def_bb->index);
- compute_global_livein (livein, def);
- BITMAP_FREE (def);
-
- scop_add_exit_phis_edge (bb, var, false_e, true_e);
-}
-
-/* Insert in the block BB phi nodes for variables defined in REGION
- and used outside the REGION. The code generation moves REGION in
- the else clause of an "if (1)" and generates code in the then
- clause that is at this point empty:
-
- | if (1)
- | empty;
- | else
- | REGION;
-*/
-
-static void
-scop_insert_phis_for_liveouts (sese region, basic_block bb,
- edge false_e, edge true_e)
-{
- unsigned i;
- bitmap_iterator bi;
-
- update_ssa (TODO_update_ssa);
-
- EXECUTE_IF_SET_IN_BITMAP (SESE_LIVEOUT (region), 0, i, bi)
- scop_add_exit_phis_var (bb, ssa_name (i), SESE_LIVEIN_VER (region, i),
- false_e, true_e);
-
- update_ssa (TODO_update_ssa);
-}
-
-/* Get the definition of NAME before the SCOP. Keep track of the
- basic blocks that have been VISITED in a bitmap. */
-
-static tree
-get_vdef_before_scop (scop_p scop, tree name, sbitmap visited)
-{
- unsigned i;
- gimple def_stmt = SSA_NAME_DEF_STMT (name);
- basic_block def_bb = gimple_bb (def_stmt);
-
- if (!def_bb
- || !bb_in_sese_p (def_bb, SCOP_REGION (scop)))
- return name;
-
- if (TEST_BIT (visited, def_bb->index))
- return NULL_TREE;
-
- SET_BIT (visited, def_bb->index);
-
- switch (gimple_code (def_stmt))
- {
- case GIMPLE_PHI:
- for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
- {
- tree arg = gimple_phi_arg_def (def_stmt, i);
- tree res = get_vdef_before_scop (scop, arg, visited);
- if (res)
- return res;
- }
- return NULL_TREE;
-
- default:
- return NULL_TREE;
- }
-}
-
-/* Adjust a virtual phi node PHI that is placed at the end of the
- generated code for SCOP:
-
- | if (1)
- | generated code from REGION;
- | else
- | REGION;
-
- The FALSE_E edge comes from the original code, TRUE_E edge comes
- from the code generated for the SCOP. */
-
-static void
-scop_adjust_vphi (scop_p scop, gimple phi, edge true_e)
-{
- unsigned i;
-
- gcc_assert (gimple_phi_num_args (phi) == 2);
-
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- if (gimple_phi_arg_edge (phi, i) == true_e)
- {
- tree true_arg, false_arg, before_scop_arg;
- sbitmap visited;
-
- true_arg = gimple_phi_arg_def (phi, i);
- if (!SSA_NAME_IS_DEFAULT_DEF (true_arg))
- return;
-
- false_arg = gimple_phi_arg_def (phi, i == 0 ? 1 : 0);
- if (SSA_NAME_IS_DEFAULT_DEF (false_arg))
- return;
-
- visited = sbitmap_alloc (last_basic_block);
- sbitmap_zero (visited);
- before_scop_arg = get_vdef_before_scop (scop, false_arg, visited);
- gcc_assert (before_scop_arg != NULL_TREE);
- SET_PHI_ARG_DEF (phi, i, before_scop_arg);
- sbitmap_free (visited);
- }
-}
-
-/* Adjusts the phi nodes in the block BB for variables defined in
- SCOP_REGION and used outside the SCOP_REGION. The code generation
- moves SCOP_REGION in the else clause of an "if (1)" and generates
- code in the then clause:
-
- | if (1)
- | generated code from REGION;
- | else
- | REGION;
-
- To adjust the phi nodes after the condition, SCOP_LIVEOUT_RENAMES
- hash table is used: this stores for a name that is part of the
- LIVEOUT of SCOP_REGION its new name in the generated code. */
-
-static void
-scop_adjust_phis_for_liveouts (scop_p scop, basic_block bb, edge false_e,
- edge true_e)
-{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
- {
- unsigned i;
- unsigned false_i = 0;
- gimple phi = gsi_stmt (si);
-
- if (!is_gimple_reg (PHI_RESULT (phi)))
- {
- scop_adjust_vphi (scop, phi, true_e);
- continue;
- }
-
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- if (gimple_phi_arg_edge (phi, i) == false_e)
- {
- false_i = i;
- break;
- }
-
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- if (gimple_phi_arg_edge (phi, i) == true_e)
- {
- tree old_name = gimple_phi_arg_def (phi, false_i);
- tree new_name = get_new_name_from_old_name
- (SCOP_LIVEOUT_RENAMES (scop), old_name);
-
- gcc_assert (old_name != new_name);
- SET_PHI_ARG_DEF (phi, i, new_name);
- }
- }
-}
-
-/* Returns the first cloog name used in EXPR. */
-
-static const char *
-find_cloog_iv_in_expr (struct clast_expr *expr)
-{
- struct clast_term *term = (struct clast_term *) expr;
-
- if (expr->type == expr_term
- && !term->var)
- return NULL;
-
- if (expr->type == expr_term)
- return term->var;
-
- if (expr->type == expr_red)
- {
- int i;
- struct clast_reduction *red = (struct clast_reduction *) expr;
-
- for (i = 0; i < red->n; i++)
- {
- const char *res = find_cloog_iv_in_expr ((red)->elts[i]);
-
- if (res)
- return res;
- }
- }
-
- return NULL;
-}
-
-/* Build for a clast_user_stmt USER_STMT a map between the CLAST
- induction variables and the corresponding GCC old induction
- variables. This information is stored on each GRAPHITE_BB. */
-
-static void
-compute_cloog_iv_types_1 (graphite_bb_p gbb,
- struct clast_user_stmt *user_stmt)
-{
- struct clast_stmt *t;
- int index = 0;
-
- for (t = user_stmt->substitutions; t; t = t->next, index++)
- {
- PTR *slot;
- struct ivtype_map_elt_d tmp;
- struct clast_expr *expr = (struct clast_expr *)
- ((struct clast_assignment *)t)->RHS;
-
- /* Create an entry (clast_var, type). */
- tmp.cloog_iv = find_cloog_iv_in_expr (expr);
- if (!tmp.cloog_iv)
- continue;
-
- slot = htab_find_slot (GBB_CLOOG_IV_TYPES (gbb), &tmp, INSERT);
-
- if (!*slot)
- {
- loop_p loop = gbb_loop_at_index (gbb, index);
- tree oldiv = oldiv_for_loop (GBB_SCOP (gbb), loop);
- tree type = oldiv ? TREE_TYPE (oldiv) : integer_type_node;
- *slot = new_ivtype_map_elt (tmp.cloog_iv, type);
- }
- }
-}
-
-/* Walk the CLAST tree starting from STMT and build for each
- clast_user_stmt a map between the CLAST induction variables and the
- corresponding GCC old induction variables. This information is
- stored on each GRAPHITE_BB. */
-
-static void
-compute_cloog_iv_types (struct clast_stmt *stmt)
-{
- if (!stmt)
- return;
-
- if (CLAST_STMT_IS_A (stmt, stmt_root))
- goto next;
-
- if (CLAST_STMT_IS_A (stmt, stmt_user))
- {
- CloogStatement *cs = ((struct clast_user_stmt *) stmt)->statement;
- graphite_bb_p gbb = (graphite_bb_p) cloog_statement_usr (cs);
- GBB_CLOOG_IV_TYPES (gbb) = htab_create (10, ivtype_map_elt_info,
- eq_ivtype_map_elts, free);
- compute_cloog_iv_types_1 (gbb, (struct clast_user_stmt *) stmt);
- goto next;
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_for))
- {
- struct clast_stmt *s = ((struct clast_for *) stmt)->body;
- compute_cloog_iv_types (s);
- goto next;
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_guard))
- {
- struct clast_stmt *s = ((struct clast_guard *) stmt)->then;
- compute_cloog_iv_types (s);
- goto next;
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_block))
- {
- struct clast_stmt *s = ((struct clast_block *) stmt)->body;
- compute_cloog_iv_types (s);
- goto next;
- }
-
- gcc_unreachable ();
-
- next:
- compute_cloog_iv_types (stmt->next);
-}
-
-/* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for
- the given SCOP. Return true if code generation succeeded. */
-
-static bool
-gloog (scop_p scop, struct clast_stmt *stmt)
-{
- edge new_scop_exit_edge = NULL;
- VEC (iv_stack_entry_p, heap) *ivstack = VEC_alloc (iv_stack_entry_p, heap,
- 10);
- loop_p context_loop;
- ifsese if_region = NULL;
-
- recompute_all_dominators ();
- graphite_verify ();
- if_region = move_sese_in_condition (SCOP_REGION (scop));
- sese_build_livein_liveouts (SCOP_REGION (scop));
- scop_insert_phis_for_liveouts (SCOP_REGION (scop),
- if_region->region->exit->src,
- if_region->false_region->exit,
- if_region->true_region->exit);
recompute_all_dominators ();
- graphite_verify ();
- context_loop = SESE_ENTRY (SCOP_REGION (scop))->src->loop_father;
- compute_cloog_iv_types (stmt);
-
- new_scop_exit_edge = translate_clast (scop, context_loop, stmt,
- if_region->true_region->entry,
- &ivstack);
- free_loop_iv_stack (&ivstack);
- cloog_clast_free (stmt);
-
- graphite_verify ();
- scop_adjust_phis_for_liveouts (scop,
- if_region->region->exit->src,
- if_region->false_region->exit,
- if_region->true_region->exit);
-
- recompute_all_dominators ();
- graphite_verify ();
- return true;
-}
-
-/* Returns the number of data references in SCOP. */
-
-static int
-nb_data_refs_in_scop (scop_p scop)
-{
- int i;
- graphite_bb_p gbb;
- int res = 0;
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gbb); i++)
- res += VEC_length (data_reference_p, GBB_DATA_REFS (gbb));
-
- return res;
-}
-
-/* Move the loop at index LOOP and insert it before index NEW_LOOP_POS.
- This transformartion is only valid, if the loop nest between i and k is
- perfectly nested. Therefore we do not need to change the static schedule.
-
- Example:
-
- for (i = 0; i < 50; i++)
- for (j ...)
- for (k = 5; k < 100; k++)
- A
-
- To move k before i use:
-
- graphite_trans_bb_move_loop (A, 2, 0)
-
- for (k = 5; k < 100; k++)
- for (i = 0; i < 50; i++)
- for (j ...)
- A
-
- And to move k back:
-
- graphite_trans_bb_move_loop (A, 0, 2)
-
- This function does not check the validity of interchanging loops.
- This should be checked before calling this function. */
-
-static void
-graphite_trans_bb_move_loop (graphite_bb_p gb, int loop,
- int new_loop_pos)
-{
- CloogMatrix *domain = GBB_DOMAIN (gb);
- int row, j;
- loop_p tmp_loop_p;
-
- gcc_assert (loop < gbb_nb_loops (gb)
- && new_loop_pos < gbb_nb_loops (gb));
-
- /* Update LOOPS vector. */
- tmp_loop_p = VEC_index (loop_p, GBB_LOOPS (gb), loop);
- VEC_ordered_remove (loop_p, GBB_LOOPS (gb), loop);
- VEC_safe_insert (loop_p, heap, GBB_LOOPS (gb), new_loop_pos, tmp_loop_p);
-
- /* Move the domain columns. */
- if (loop < new_loop_pos)
- for (row = 0; row < domain->NbRows; row++)
- {
- Value tmp;
- value_init (tmp);
- value_assign (tmp, domain->p[row][loop + 1]);
-
- for (j = loop ; j < new_loop_pos - 1; j++)
- value_assign (domain->p[row][j + 1], domain->p[row][j + 2]);
-
- value_assign (domain->p[row][new_loop_pos], tmp);
- value_clear (tmp);
- }
- else
- for (row = 0; row < domain->NbRows; row++)
- {
- Value tmp;
- value_init (tmp);
- value_assign (tmp, domain->p[row][loop + 1]);
-
- for (j = loop ; j > new_loop_pos; j--)
- value_assign (domain->p[row][j + 1], domain->p[row][j]);
-
- value_assign (domain->p[row][new_loop_pos + 1], tmp);
- value_clear (tmp);
- }
-}
-
-/* Get the index of the column representing constants in the DOMAIN
- matrix. */
-
-static int
-const_column_index (CloogMatrix *domain)
-{
- return domain->NbColumns - 1;
-}
-
-
-/* Get the first index that is positive or negative, determined
- following the value of POSITIVE, in matrix DOMAIN in COLUMN. */
-
-static int
-get_first_matching_sign_row_index (CloogMatrix *domain, int column,
- bool positive)
-{
- int row;
-
- for (row = 0; row < domain->NbRows; row++)
- {
- int val = value_get_si (domain->p[row][column]);
-
- if (val > 0 && positive)
- return row;
-
- else if (val < 0 && !positive)
- return row;
- }
-
- gcc_unreachable ();
-}
-
-/* Get the lower bound of COLUMN in matrix DOMAIN. */
-
-static int
-get_lower_bound_row (CloogMatrix *domain, int column)
-{
- return get_first_matching_sign_row_index (domain, column, true);
-}
-
-/* Get the upper bound of COLUMN in matrix DOMAIN. */
-
-static int
-get_upper_bound_row (CloogMatrix *domain, int column)
-{
- return get_first_matching_sign_row_index (domain, column, false);
-}
-
-/* Copies the OLD_ROW constraint from OLD_DOMAIN to the NEW_DOMAIN at
- row NEW_ROW. */
-
-static void
-copy_constraint (CloogMatrix *old_domain, CloogMatrix *new_domain,
- int old_row, int new_row)
-{
- int i;
-
- gcc_assert (old_domain->NbColumns == new_domain->NbColumns
- && old_row < old_domain->NbRows
- && new_row < new_domain->NbRows);
-
- for (i = 0; i < old_domain->NbColumns; i++)
- value_assign (new_domain->p[new_row][i], old_domain->p[old_row][i]);
-}
-
-/* Swap coefficients of variables X and Y on row R. */
-
-static void
-swap_constraint_variables (CloogMatrix *domain,
- int r, int x, int y)
-{
- value_swap (domain->p[r][x], domain->p[r][y]);
-}
-
-/* Scale by X the coefficient C of constraint at row R in DOMAIN. */
-
-static void
-scale_constraint_variable (CloogMatrix *domain,
- int r, int c, int x)
-{
- Value strip_size_value;
- value_init (strip_size_value);
- value_set_si (strip_size_value, x);
- value_multiply (domain->p[r][c], domain->p[r][c], strip_size_value);
- value_clear (strip_size_value);
-}
-
-/* Strip mines the loop of BB at the position LOOP_DEPTH with STRIDE.
- Always valid, but not always a performance improvement. */
-
-static void
-graphite_trans_bb_strip_mine (graphite_bb_p gb, int loop_depth, int stride)
-{
- int row, col;
-
- CloogMatrix *domain = GBB_DOMAIN (gb);
- CloogMatrix *new_domain = cloog_matrix_alloc (domain->NbRows + 3,
- domain->NbColumns + 1);
-
- int col_loop_old = loop_depth + 2;
- int col_loop_strip = col_loop_old - 1;
-
- gcc_assert (loop_depth <= gbb_nb_loops (gb) - 1);
-
- VEC_safe_insert (loop_p, heap, GBB_LOOPS (gb), loop_depth, NULL);
-
- GBB_DOMAIN (gb) = new_domain;
-
- for (row = 0; row < domain->NbRows; row++)
- for (col = 0; col < domain->NbColumns; col++)
- if (col <= loop_depth)
- value_assign (new_domain->p[row][col], domain->p[row][col]);
- else
- value_assign (new_domain->p[row][col + 1], domain->p[row][col]);
-
- row = domain->NbRows;
-
- /* Lower bound of the outer stripped loop. */
- copy_constraint (new_domain, new_domain,
- get_lower_bound_row (new_domain, col_loop_old), row);
- swap_constraint_variables (new_domain, row, col_loop_old, col_loop_strip);
- row++;
-
- /* Upper bound of the outer stripped loop. */
- copy_constraint (new_domain, new_domain,
- get_upper_bound_row (new_domain, col_loop_old), row);
- swap_constraint_variables (new_domain, row, col_loop_old, col_loop_strip);
- scale_constraint_variable (new_domain, row, col_loop_strip, stride);
- row++;
-
- /* Lower bound of a tile starts at "stride * outer_iv". */
- row = get_lower_bound_row (new_domain, col_loop_old);
- value_set_si (new_domain->p[row][0], 1);
- value_set_si (new_domain->p[row][const_column_index (new_domain)], 0);
- value_set_si (new_domain->p[row][col_loop_old], 1);
- value_set_si (new_domain->p[row][col_loop_strip], -1 * stride);
-
- /* Upper bound of a tile stops at "stride * outer_iv + stride - 1",
- or at the old upper bound that is not modified. */
- row = new_domain->NbRows - 1;
- value_set_si (new_domain->p[row][0], 1);
- value_set_si (new_domain->p[row][col_loop_old], -1);
- value_set_si (new_domain->p[row][col_loop_strip], stride);
- value_set_si (new_domain->p[row][const_column_index (new_domain)],
- stride - 1);
-
- cloog_matrix_free (domain);
-
- /* Update static schedule. */
- {
- int i;
- int nb_loops = gbb_nb_loops (gb);
- lambda_vector new_schedule = lambda_vector_new (nb_loops + 1);
-
- for (i = 0; i <= loop_depth; i++)
- new_schedule[i] = GBB_STATIC_SCHEDULE (gb)[i];
-
- for (i = loop_depth + 1; i <= nb_loops - 2; i++)
- new_schedule[i + 2] = GBB_STATIC_SCHEDULE (gb)[i];
-
- GBB_STATIC_SCHEDULE (gb) = new_schedule;
- }
-}
-
-/* Returns true when the strip mining of LOOP_INDEX by STRIDE is
- profitable or undecidable. GB is the statement around which the
- loops will be strip mined. */
-
-static bool
-strip_mine_profitable_p (graphite_bb_p gb, int stride,
- int loop_index)
-{
- bool res = true;
- edge exit = NULL;
- tree niter;
- loop_p loop;
- long niter_val;
-
- loop = VEC_index (loop_p, GBB_LOOPS (gb), loop_index);
- exit = single_exit (loop);
-
- niter = find_loop_niter (loop, &exit);
- if (niter == chrec_dont_know
- || TREE_CODE (niter) != INTEGER_CST)
- return true;
-
- niter_val = int_cst_value (niter);
-
- if (niter_val < stride)
- {
- res = false;
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "\nStrip Mining is not profitable for loop %d:",
- loop->num);
- fprintf (dump_file, "number of iterations is too low.\n");
- }
- }
-
- return res;
-}
-
-/* Determines when the interchange of LOOP_A and LOOP_B belonging to
- SCOP is legal. DEPTH is the number of loops around. */
-
-static bool
-is_interchange_valid (scop_p scop, int loop_a, int loop_b, int depth)
-{
- bool res;
- VEC (ddr_p, heap) *dependence_relations;
- VEC (data_reference_p, heap) *datarefs;
-
- struct loop *nest = VEC_index (loop_p, SCOP_LOOP_NEST (scop), loop_a);
- lambda_trans_matrix trans;
-
- gcc_assert (loop_a < loop_b);
-
- dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10);
- datarefs = VEC_alloc (data_reference_p, heap, 10);
-
- if (!compute_data_dependences_for_loop (nest, true, &datarefs,
- &dependence_relations))
- return false;
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- dump_ddrs (dump_file, dependence_relations);
-
- trans = lambda_trans_matrix_new (depth, depth);
- lambda_matrix_id (LTM_MATRIX (trans), depth);
-
- lambda_matrix_row_exchange (LTM_MATRIX (trans), 0, loop_b - loop_a);
-
- if (!lambda_transform_legal_p (trans, depth, dependence_relations))
- {
- lambda_matrix_row_exchange (LTM_MATRIX (trans), 0, loop_b - loop_a);
- res = false;
- }
- else
- res = true;
-
- free_dependence_relations (dependence_relations);
- free_data_refs (datarefs);
- return res;
-}
-
-/* Loop block the LOOPS innermost loops of GB with stride size STRIDE.
-
- Example
-
- for (i = 0; i <= 50; i++=4)
- for (k = 0; k <= 100; k++=4)
- for (l = 0; l <= 200; l++=4)
- A
-
- To strip mine the two inner most loops with stride = 4 call:
-
- graphite_trans_bb_block (A, 4, 2)
-
- for (i = 0; i <= 50; i++)
- for (kk = 0; kk <= 100; kk+=4)
- for (ll = 0; ll <= 200; ll+=4)
- for (k = kk; k <= min (100, kk + 3); k++)
- for (l = ll; l <= min (200, ll + 3); l++)
- A
-*/
-
-static bool
-graphite_trans_bb_block (graphite_bb_p gb, int stride, int loops)
-{
- int i, j;
- int nb_loops = gbb_nb_loops (gb);
- int start = nb_loops - loops;
- scop_p scop = GBB_SCOP (gb);
-
- gcc_assert (scop_contains_loop (scop, gbb_loop (gb)));
-
- for (i = start ; i < nb_loops; i++)
- for (j = i + 1; j < nb_loops; j++)
- if (!is_interchange_valid (scop, i, j, nb_loops))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- "\nInterchange not valid for loops %d and %d:\n", i, j);
- return false;
- }
- else if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- "\nInterchange valid for loops %d and %d:\n", i, j);
-
- /* Check if strip mining is profitable for every loop. */
- for (i = 0; i < nb_loops - start; i++)
- if (!strip_mine_profitable_p (gb, stride, start + i))
- return false;
-
- /* Strip mine loops. */
- for (i = 0; i < nb_loops - start; i++)
- graphite_trans_bb_strip_mine (gb, start + 2 * i, stride);
-
- /* Interchange loops. */
- for (i = 1; i < nb_loops - start; i++)
- graphite_trans_bb_move_loop (gb, start + 2 * i, start + i);
+ initialize_original_copy_tables ();
+ cloog_initialize ();
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\nLoops containing BB %d will be loop blocked.\n",
- GBB_BB (gb)->index);
+ if (dump_file && dump_flags)
+ dump_function_to_file (current_function_decl, dump_file, dump_flags);
return true;
}
-/* Loop block LOOPS innermost loops of a loop nest. BBS represent the
- basic blocks that belong to the loop nest to be blocked. */
-
-static bool
-graphite_trans_loop_block (VEC (graphite_bb_p, heap) *bbs, int loops)
-{
- graphite_bb_p gb;
- int i;
- bool transform_done = false;
-
- /* TODO: - Calculate the stride size automatically. */
- int stride_size = 51;
-
- for (i = 0; VEC_iterate (graphite_bb_p, bbs, i, gb); i++)
- transform_done |= graphite_trans_bb_block (gb, stride_size, loops);
-
- return transform_done;
-}
-
-/* Loop block all basic blocks of SCOP. Return false when the
- transform is not performed. */
-
-static bool
-graphite_trans_scop_block (scop_p scop)
-{
- graphite_bb_p gb;
- int i, j;
- int last_nb_loops;
- int nb_loops;
- bool perfect = true;
- bool transform_done = false;
-
- VEC (graphite_bb_p, heap) *bbs = VEC_alloc (graphite_bb_p, heap, 3);
- int max_schedule = scop_max_loop_depth (scop) + 1;
- lambda_vector last_schedule = lambda_vector_new (max_schedule);
-
- if (VEC_length (graphite_bb_p, SCOP_BBS (scop)) == 0)
- return false;
-
- /* Get the data of the first bb. */
- gb = VEC_index (graphite_bb_p, SCOP_BBS (scop), 0);
- last_nb_loops = gbb_nb_loops (gb);
- lambda_vector_copy (GBB_STATIC_SCHEDULE (gb), last_schedule,
- last_nb_loops + 1);
- VEC_safe_push (graphite_bb_p, heap, bbs, gb);
-
- for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gb); i++)
- {
- /* We did the first bb before. */
- if (i == 0)
- continue;
-
- nb_loops = gbb_nb_loops (gb);
-
- /* If the number of loops is unchanged and only the last element of the
- schedule changes, we stay in the loop nest. */
- if (nb_loops == last_nb_loops
- && (last_schedule [nb_loops + 1]
- != GBB_STATIC_SCHEDULE (gb)[nb_loops + 1]))
- {
- VEC_safe_push (graphite_bb_p, heap, bbs, gb);
- continue;
- }
-
- /* Otherwise, we left the innermost loop. So check, if the last bb was in
- a perfect loop nest and how many loops are contained in this perfect
- loop nest.
-
- Count the number of zeros from the end of the schedule. They are the
- number of surrounding loops.
-
- Example:
- last_bb 2 3 2 0 0 0 0 3
- bb 2 4 0
- <------ j = 4
-
- last_bb 2 3 2 0 0 0 0 3
- bb 2 3 2 0 1
- <-- j = 2
-
- If there is no zero, there were other bbs in outer loops and the loop
- nest is not perfect. */
- for (j = last_nb_loops - 1; j >= 0; j--)
- {
- if (last_schedule [j] != 0
- || (j <= nb_loops && GBB_STATIC_SCHEDULE (gb)[j] == 1))
- {
- j--;
- break;
- }
- }
-
- j++;
-
- /* Found perfect loop nest. */
- if (perfect && last_nb_loops - j >= 2)
- transform_done |= graphite_trans_loop_block (bbs, last_nb_loops - j);
-
- /* Check if we start with a new loop.
-
- Example:
-
- last_bb 2 3 2 0 0 0 0 3
- bb 2 3 2 0 0 1 0
-
- Here we start with the loop "2 3 2 0 0 1"
-
- last_bb 2 3 2 0 0 0 0 3
- bb 2 3 2 0 0 1
-
- But here not, so the loop nest can never be perfect. */
-
- perfect = (GBB_STATIC_SCHEDULE (gb)[nb_loops] == 0);
-
- /* Update the last_bb infos. We do not do that for the bbs in the same
- loop, as the data we use is not changed. */
- last_nb_loops = nb_loops;
- lambda_vector_copy (GBB_STATIC_SCHEDULE (gb), last_schedule,
- nb_loops + 1);
- VEC_truncate (graphite_bb_p, bbs, 0);
- VEC_safe_push (graphite_bb_p, heap, bbs, gb);
- }
-
- /* Check if the last loop nest was perfect. It is the same check as above,
- but the comparison with the next bb is missing. */
- for (j = last_nb_loops - 1; j >= 0; j--)
- if (last_schedule [j] != 0)
- {
- j--;
- break;
- }
-
- j++;
-
- /* Found perfect loop nest. */
- if (last_nb_loops - j >= 2)
- transform_done |= graphite_trans_loop_block (bbs, last_nb_loops - j);
- VEC_free (graphite_bb_p, heap, bbs);
-
- return transform_done;
-}
-
-/* Apply graphite transformations to all the basic blocks of SCOP. */
-
-static bool
-graphite_apply_transformations (scop_p scop)
-{
- bool transform_done = false;
-
- /* Sort the list of bbs. Keep them always sorted. */
- graphite_sort_gbbs (scop);
-
- if (flag_loop_block)
- transform_done = graphite_trans_scop_block (scop);
-
- /* Generate code even if we did not apply any real transformation.
- This also allows to check the performance for the identity
- transformation: GIMPLE -> GRAPHITE -> GIMPLE
- Keep in mind that CLooG optimizes in control, so the loop structure
- may change, even if we only use -fgraphite-identity. */
- if (flag_graphite_identity)
- transform_done = true;
-
- return transform_done;
-}
-
-/* We limit all SCoPs to SCoPs, that are completely surrounded by a loop.
-
- Example:
-
- for (i |
- { |
- for (j | SCoP 1
- for (k |
- } |
-
- * SCoP frontier, as this line is not surrounded by any loop. *
-
- for (l | SCoP 2
-
- This is necessary as scalar evolution and parameter detection need a
- outermost loop to initialize parameters correctly.
-
- TODO: FIX scalar evolution and parameter detection to allow more flexible
- SCoP frontiers. */
+/* Finalize graphite: perform CFG cleanup when NEED_CFG_CLEANUP_P is
+ true. */
static void
-limit_scops (void)
+graphite_finalize (bool need_cfg_cleanup_p)
{
- VEC (sd_region, heap) *tmp_scops = VEC_alloc (sd_region, heap, 3);
-
- int i;
- scop_p scop;
-
- for (i = 0; VEC_iterate (scop_p, current_scops, i, scop); i++)
+ if (need_cfg_cleanup_p)
{
- int j;
- loop_p loop;
- build_scop_bbs (scop);
-
- if (!build_scop_loop_nests (scop))
- continue;
-
- for (j = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), j, loop); j++)
- if (!loop_in_sese_p (loop_outer (loop), SCOP_REGION (scop)))
- {
- sd_region open_scop;
- open_scop.entry = loop->header;
- open_scop.exit = single_exit (loop)->dest;
- VEC_safe_push (sd_region, heap, tmp_scops, &open_scop);
- }
+ cleanup_tree_cfg ();
+ profile_status = PROFILE_ABSENT;
+ release_recorded_exits ();
+ tree_estimate_probability ();
}
- free_scops (current_scops);
- current_scops = VEC_alloc (scop_p, heap, 3);
+ cloog_finalize ();
+ free_original_copy_tables ();
+ free_aux_in_new_loops ();
- create_sese_edges (tmp_scops);
- build_graphite_scops (tmp_scops);
- VEC_free (sd_region, heap, tmp_scops);
+ if (dump_file && dump_flags)
+ print_loops (dump_file, 3);
}
/* Perform a set of linear transforms on the loops of the current
@@ -6109,82 +247,48 @@ graphite_transform_loops (void)
{
int i;
scop_p scop;
- bool transform_done = false;
+ bool need_cfg_cleanup_p = false;
+ VEC (scop_p, heap) *scops = NULL;
+ htab_t bb_pbb_mapping;
- if (number_of_loops () <= 1)
+ if (!graphite_initialize ())
return;
- current_scops = VEC_alloc (scop_p, heap, 3);
- recompute_all_dominators ();
+ build_scops (&scops);
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "Graphite loop transformations \n");
-
- initialize_original_copy_tables ();
- cloog_initialize ();
- build_scops ();
- limit_scops ();
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "\nnumber of SCoPs: %d\n",
- VEC_length (scop_p, current_scops));
-
- for (i = 0; VEC_iterate (scop_p, current_scops, i, scop); i++)
{
- build_scop_bbs (scop);
- if (!build_scop_loop_nests (scop))
- continue;
-
- build_bb_loops (scop);
-
- if (!build_scop_conditions (scop))
- continue;
+ print_graphite_statistics (dump_file, scops);
+ print_global_statistics (dump_file);
+ }
- find_scop_parameters (scop);
- build_scop_context (scop);
+ bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "\n(In SCoP %d:\n", i);
- fprintf (dump_file, "\nnumber of bbs: %d\n",
- VEC_length (graphite_bb_p, SCOP_BBS (scop)));
- fprintf (dump_file, "\nnumber of loops: %d)\n",
- VEC_length (loop_p, SCOP_LOOP_NEST (scop)));
- }
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ {
+ bool transform_done = false;
- if (!build_scop_iteration_domain (scop))
+ if (!build_poly_scop (scop))
continue;
- add_conditions_to_constraints (scop);
- build_scop_canonical_schedules (scop);
-
- build_scop_data_accesses (scop);
- build_scop_dynamic_schedules (scop);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- int nbrefs = nb_data_refs_in_scop (scop);
- fprintf (dump_file, "\nnumber of data refs: %d\n", nbrefs);
- }
-
- if (graphite_apply_transformations (scop))
- transform_done = gloog (scop, find_transform (scop));
-#ifdef ENABLE_CHECKING
+ if (apply_poly_transforms (scop))
+ transform_done = gloog (scop, bb_pbb_mapping);
else
+ check_poly_representation (scop);
+
+ if (transform_done)
{
- struct clast_stmt *stmt = find_transform (scop);
- cloog_clast_free (stmt);
+ scev_reset ();
+ need_cfg_cleanup_p = true;
}
-#endif
}
- /* Cleanup. */
- if (transform_done)
- cleanup_tree_cfg ();
+ if (flag_loop_parallelize_all)
+ mark_loops_parallel (bb_pbb_mapping);
- free_scops (current_scops);
- cloog_finalize ();
- free_original_copy_tables ();
+ htab_delete (bb_pbb_mapping);
+ free_scops (scops);
+ graphite_finalize (need_cfg_cleanup_p);
}
#else /* If Cloog is not available: #ifndef HAVE_cloog. */
diff --git a/gcc/graphite.h b/gcc/graphite.h
index e663c2d0fe5..1007e9af410 100644
--- a/gcc/graphite.h
+++ b/gcc/graphite.h
@@ -21,556 +21,4 @@ along with GCC; see the file COPYING3. If not see
#ifndef GCC_GRAPHITE_H
#define GCC_GRAPHITE_H
-#include "tree-data-ref.h"
-
-int ref_nb_loops (data_reference_p);
-
-typedef struct graphite_bb *graphite_bb_p;
-DEF_VEC_P(graphite_bb_p);
-DEF_VEC_ALLOC_P (graphite_bb_p, heap);
-
-DEF_VEC_P(scop_p);
-DEF_VEC_ALLOC_P (scop_p, heap);
-
-static inline int scop_nb_loops (scop_p scop);
-static inline unsigned scop_nb_params (scop_p scop);
-static inline bool scop_contains_loop (scop_p scop, struct loop *loop);
-
-typedef struct graphite_bb
-{
- basic_block bb;
- scop_p scop;
-
- /* The static schedule contains the textual order for every loop layer.
-
- Example:
-
- S0
- for (i ...)
- {
- S1
- for (j ...)
- {
- S2
- S3
- }
- S4
- }
- S5
- for (k ...)
- {
- S6
- S7
- for (l ...)
- {
- S8
- }
- S9
- }
- S10
-
- Schedules:
-
- | Depth
- BB | 0 1 2
- ------------
- S0 | 0
- S1 | 1, 0
- S2 | 1, 1, 0
- S3 | 1, 1, 1
- S4 | 1, 2
- S5 | 2
- S6 | 3, 0
- S7 | 3, 1
- S8 | 3, 2, 0
- S9 | 3, 3
- S10| 4
-
- Normalization rules:
- - One SCoP can never contain two bbs with the same schedule timestamp.
- - All bbs at the same loop depth have a consecutive ordering (no gaps). */
- lambda_vector static_schedule;
-
- /* The iteration domain of this bb. It contains this columns:
- - In/Eq: If this line is a equation or inequation.
- - For every loop iterator one column.
- - One column for every parameter in this SCoP.
- - The constant column to add integers to the (in)equations.
-
- Example:
-
- for (i = a - 7*b + 8; i <= 3*a + 13*b + 20; i++)
- for (j = 2; j <= 2*i + 5; j++)
- for (k = 0; k <= 5; k++)
- S (i,j,k)
-
- Loop iterators: i, j, k
- Parameters: a, b
-
- (I)eq i j k a b 1
-
- 1 1 0 0 -1 7 -8 # i >= a - 7b + 8
- 1 -1 0 0 3 13 20 # i <= 3a + 13b + 20
- 1 0 1 0 0 0 -2 # j >= 2
- 1 2 -1 0 0 0 5 # j <= 2i + 5
- 1 0 0 1 0 0 0 # k >= 0
- 1 0 0 -1 0 0 5 # k <= 5
-
- The number of loop iterators may change and is not connected to the
- number of loops, that surrounded this bb in the gimple code. */
- CloogMatrix *domain;
-
- /* Lists containing the restrictions of the conditional statements
- dominating this bb. This bb can only be executed, if all conditions
- are true.
-
- Example:
-
- for (i = 0; i <= 20; i++)
- {
- A
-
- if (2i <= 8)
- B
- }
-
- So for B there is an additional condition (2i <= 8).
-
- TODO: Add these restrictions to the domain matrix.
-
- List of COND_EXPR and SWITCH_EXPR. A COND_EXPR is true only if the
- corresponding element in CONDITION_CASES is not NULL_TREE. For a
- SWITCH_EXPR the corresponding element in CONDITION_CASES is a
- CASE_LABEL_EXPR. */
- VEC (gimple, heap) *conditions;
- VEC (gimple, heap) *condition_cases;
-
- /* LOOPS contains for every column in the graphite domain the corresponding
- gimple loop. If there exists no corresponding gimple loop LOOPS contains
- NULL.
-
- Example:
-
- Original code:
-
- for (i = 0; i <= 20; i++)
- for (j = 5; j <= 10; j++)
- A
-
- Original domain:
-
- (I)eq i j 1
- 1 1 0 0 # i >= 0
- 1 -1 0 20 # i <= 20
- 1 0 1 0 # j >= 0
- 1 0 -1 10 # j <= 10
-
- Original loops vector:
- 0 1
- Loop i Loop j
-
- After some changes (Exchange i and j, strip-mine i):
-
- Domain:
-
- (I)eq j ii i k 1
- 1 0 0 1 0 0 # i >= 0
- 1 0 0 -1 0 20 # i <= 20
- 1 1 0 0 0 0 # j >= 0
- 1 -1 0 0 0 10 # j <= 10
- 1 0 -1 1 0 0 # ii <= i
- 1 0 1 -1 0 1 # ii + 1 >= i
- 1 0 -1 0 2 0 # ii <= 2k
- 1 0 1 0 -2 0 # ii >= 2k
-
- Iterator vector:
- 0 1 2 3
- Loop j NULL Loop i NULL
-
- Means the original loop i is now at column two of the domain and
- loop j in the original loop nest is now at column 0. Column 1 and
- 3 are emtpy. */
- VEC (loop_p, heap) *loops;
-
- lambda_vector compressed_alpha_matrix;
- CloogMatrix *dynamic_schedule;
- VEC (data_reference_p, heap) *data_refs;
- htab_t cloog_iv_types;
-} *gbb_p;
-
-#define GBB_BB(GBB) GBB->bb
-#define GBB_SCOP(GBB) GBB->scop
-#define GBB_STATIC_SCHEDULE(GBB) GBB->static_schedule
-#define GBB_DATA_REFS(GBB) GBB->data_refs
-#define GBB_ALPHA(GBB) GBB->compressed_alpha_matrix
-#define GBB_DYNAMIC_SCHEDULE(GBB) GBB->dynamic_schedule
-#define GBB_DOMAIN(GBB) GBB->domain
-#define GBB_CONDITIONS(GBB) GBB->conditions
-#define GBB_CONDITION_CASES(GBB) GBB->condition_cases
-#define GBB_LOOPS(GBB) GBB->loops
-#define GBB_CLOOG_IV_TYPES(GBB) GBB->cloog_iv_types
-
-/* Return the loop that contains the basic block GBB. */
-
-static inline struct loop *
-gbb_loop (struct graphite_bb *gbb)
-{
- return GBB_BB (gbb)->loop_father;
-}
-
-int nb_loops_around_gb (graphite_bb_p);
-
-/* Calculate the number of loops around GB in the current SCOP. Only
- works if GBB_DOMAIN is built. */
-
-static inline int
-gbb_nb_loops (const struct graphite_bb *gb)
-{
- scop_p scop = GBB_SCOP (gb);
-
- if (GBB_DOMAIN (gb) == NULL)
- return 0;
-
- return GBB_DOMAIN (gb)->NbColumns - scop_nb_params (scop) - 2;
-}
-
-/* Returns the gimple loop, that corresponds to the loop_iterator_INDEX.
- If there is no corresponding gimple loop, we return NULL. */
-
-static inline loop_p
-gbb_loop_at_index (graphite_bb_p gb, int index)
-{
- return VEC_index (loop_p, GBB_LOOPS (gb), index);
-}
-
-/* Returns the index of LOOP in the loop nest around GB. */
-
-static inline int
-gbb_loop_index (graphite_bb_p gb, loop_p loop)
-{
- int i;
- loop_p l;
-
- for (i = 0; VEC_iterate (loop_p, GBB_LOOPS (gb), i, l); i++)
- if (loop == l)
- return i;
-
- gcc_unreachable();
-}
-
-struct loop_to_cloog_loop_str
-{
- unsigned int loop_num;
- unsigned int loop_position; /* The column that represents this loop. */
- CloogLoop *cloog_loop;
-};
-
-typedef struct name_tree_d
-{
- tree t;
- const char *name;
- struct loop *loop;
-} *name_tree;
-
-DEF_VEC_P(name_tree);
-DEF_VEC_ALLOC_P (name_tree, heap);
-
-/* A Single Entry, Single Exit region is a part of the CFG delimited
- by two edges. */
-typedef struct sese_d
-{
- /* Single ENTRY and single EXIT from the SESE region. */
- edge entry, exit;
-
- /* REGION_BASIC_BLOCKS contains the set of all the basic blocks
- belonging to the SESE region. */
- struct pointer_set_t *region_basic_blocks;
-
- /* An SSA_NAME version is flagged in the LIVEOUT bitmap if the
- SSA_NAME is defined inside and used outside the SESE region. */
- bitmap liveout;
-
- /* The overall number of SSA_NAME versions used to index LIVEIN. */
- int num_ver;
-
- /* For each SSA_NAME version VER in LIVEOUT, LIVEIN[VER] contains
- the set of basic blocks indices that contain a use of VER. */
- bitmap *livein;
-} *sese;
-
-#define SESE_ENTRY(S) (S->entry)
-#define SESE_EXIT(S) (S->exit)
-#define SESE_REGION_BBS(S) (S->region_basic_blocks)
-#define SESE_LIVEOUT(S) (S->liveout)
-#define SESE_LIVEIN(S) (S->livein)
-#define SESE_LIVEIN_VER(S, I) (S->livein[I])
-#define SESE_NUM_VER(S) (S->num_ver)
-
-extern sese new_sese (edge, edge);
-extern void free_sese (sese);
-extern void sese_build_livein_liveouts (sese);
-
-/* A SCOP is a Static Control Part of the program, simple enough to be
- represented in polyhedral form. */
-struct scop
-{
- /* A SCOP is defined as a SESE region. */
- sese region;
-
- /* All the basic blocks in this scop that contain memory references
- and that will be represented as statements in the polyhedral
- representation. */
- VEC (graphite_bb_p, heap) *bbs;
-
- lambda_vector static_schedule;
-
- /* Parameters used within the SCOP. */
- VEC (name_tree, heap) *params;
-
- /* A collection of old induction variables*/
- VEC (name_tree, heap) *old_ivs;
-
- /* Loops completely contained in the SCOP. */
- bitmap loops;
- VEC (loop_p, heap) *loop_nest;
-
- /* ??? It looks like a global mapping loop_id -> cloog_loop would work. */
- htab_t loop2cloog_loop;
-
- /* Cloog representation of this scop. */
- CloogProgram *program;
-
- /* Are we allowed to add more params? This is for debugging purpose. We
- can only add new params before generating the bb domains, otherwise they
- become invalid. */
- bool add_params;
-
- /* LIVEOUT_RENAMES registers the rename mapping that has to be
- applied after code generation. */
- htab_t liveout_renames;
-};
-
-#define SCOP_BBS(S) S->bbs
-#define SCOP_REGION(S) S->region
-/* SCOP_ENTRY bb dominates all the bbs of the scop. SCOP_EXIT bb
- post-dominates all the bbs of the scop. SCOP_EXIT potentially
- contains non affine data accesses, side effect statements or
- difficult constructs, and thus is not considered part of the scop,
- but just a boundary. SCOP_ENTRY is considered part of the scop. */
-#define SCOP_ENTRY(S) (SESE_ENTRY (SCOP_REGION (S))->dest)
-#define SCOP_EXIT(S) (SESE_EXIT (SCOP_REGION (S))->dest)
-#define SCOP_REGION_BBS(S) (SESE_REGION_BBS (SCOP_REGION (S)))
-#define SCOP_STATIC_SCHEDULE(S) S->static_schedule
-#define SCOP_LOOPS(S) S->loops
-#define SCOP_LOOP_NEST(S) S->loop_nest
-#define SCOP_ADD_PARAMS(S) S->add_params
-#define SCOP_PARAMS(S) S->params
-#define SCOP_OLDIVS(S) S->old_ivs
-#define SCOP_PROG(S) S->program
-#define SCOP_LOOP2CLOOG_LOOP(S) S->loop2cloog_loop
-#define SCOP_LOOPS_MAPPING(S) S->loops_mapping
-#define SCOP_LIVEOUT_RENAMES(S) S->liveout_renames
-
-extern void debug_scop (scop_p, int);
-extern void debug_scops (int);
-extern void print_graphite_bb (FILE *, graphite_bb_p, int, int);
-extern void debug_gbb (graphite_bb_p, int);
-extern void dot_scop (scop_p);
-extern void dot_all_scops (void);
-extern void debug_clast_stmt (struct clast_stmt *);
-extern void debug_rename_map (htab_t);
-extern void debug_ivtype_map (htab_t);
-extern void debug_loop_vec (graphite_bb_p);
-extern void debug_oldivs (scop_p);
-
-/* Describes the type of an iv stack entry. */
-typedef enum {
- iv_stack_entry_unknown = 0,
- iv_stack_entry_iv,
- iv_stack_entry_const
-} iv_stack_entry_kind;
-
-/* Data contained in an iv stack entry. */
-typedef union iv_stack_entry_data_union
-{
- name_tree iv;
- tree constant;
-} iv_stack_entry_data;
-
-/* Datatype for loop iv stack entry. */
-typedef struct iv_stack_entry_struct
-{
- iv_stack_entry_kind kind;
- iv_stack_entry_data data;
-} iv_stack_entry;
-
-typedef iv_stack_entry *iv_stack_entry_p;
-
-DEF_VEC_P(iv_stack_entry_p);
-DEF_VEC_ALLOC_P(iv_stack_entry_p,heap);
-
-typedef VEC(iv_stack_entry_p, heap) **loop_iv_stack;
-extern void debug_loop_iv_stack (loop_iv_stack);
-
-/* Return the old induction variable of the LOOP that is in normal
- form in SCOP. */
-
-static inline tree
-oldiv_for_loop (scop_p scop, loop_p loop)
-{
- int i;
- name_tree iv;
-
- if (!loop)
- return NULL_TREE;
-
- for (i = 0; VEC_iterate (name_tree, SCOP_OLDIVS (scop), i, iv); i++)
- if (iv->loop == loop)
- return iv->t;
-
- return NULL_TREE;
-}
-
-/* Return the number of gimple loops contained in SCOP. */
-
-static inline int
-scop_nb_loops (scop_p scop)
-{
- return VEC_length (loop_p, SCOP_LOOP_NEST (scop));
-}
-
-/* Returns the number of parameters for SCOP. */
-
-static inline unsigned
-scop_nb_params (scop_p scop)
-{
- return VEC_length (name_tree, SCOP_PARAMS (scop));
-}
-
-/* Return the dimension of the domains for SCOP. */
-
-static inline int
-scop_dim_domain (scop_p scop)
-{
- return scop_nb_loops (scop) + scop_nb_params (scop) + 1;
-}
-
-/* Return the dimension of the domains for GB. */
-
-static inline int
-gbb_dim_domain (graphite_bb_p gb)
-{
- return scop_dim_domain (GBB_SCOP (gb));
-}
-
-/* Returns the dimensionality of a loop iteration domain for a given
- loop, identified by LOOP_NUM, with respect to SCOP. */
-
-static inline int
-loop_domain_dim (unsigned int loop_num, scop_p scop)
-{
- struct loop_to_cloog_loop_str tmp, *slot;
- htab_t tab = SCOP_LOOP2CLOOG_LOOP (scop);
-
- tmp.loop_num = loop_num;
- slot = (struct loop_to_cloog_loop_str *) htab_find (tab, &tmp);
-
- /* The loop containing the entry of the scop is not always part of
- the SCoP, and it is not registered in SCOP_LOOP2CLOOG_LOOP. */
- if (!slot)
- return scop_nb_params (scop) + 2;
-
- return cloog_domain_dim (cloog_loop_domain (slot->cloog_loop)) + 2;
-}
-
-/* Returns the dimensionality of a loop iteration vector in a loop
- iteration domain for a given loop (identified by LOOP_NUM) with
- respect to SCOP. */
-
-static inline int
-loop_iteration_vector_dim (unsigned int loop_num, scop_p scop)
-{
- return loop_domain_dim (loop_num, scop) - 2 - scop_nb_params (scop);
-}
-
-/* Checks, if SCOP contains LOOP. */
-
-static inline bool
-scop_contains_loop (scop_p scop, struct loop *loop)
-{
- return bitmap_bit_p (SCOP_LOOPS (scop), loop->num);
-}
-
-/* Returns the index of LOOP in the domain matrix for the SCOP. */
-
-static inline int
-scop_loop_index (scop_p scop, struct loop *loop)
-{
- unsigned i;
- struct loop *l;
-
- gcc_assert (scop_contains_loop (scop, loop));
-
- for (i = 0; VEC_iterate (loop_p, SCOP_LOOP_NEST (scop), i, l); i++)
- if (l == loop)
- return i;
-
- gcc_unreachable();
-}
-
-/* Return the index of innermost loop that contains the basic block
- GBB. */
-
-static inline int
-gbb_inner_most_loop_index (scop_p scop, graphite_bb_p gb)
-{
- return scop_loop_index(scop, gbb_loop (gb));
-}
-
-/* Return the outermost loop that contains the loop LOOP. The outer
- loops are searched until a sibling for the outer loop is found. */
-
-static struct loop *
-outer_most_loop_1 (scop_p scop, struct loop* loop, struct loop* current_outer)
-{
- return (!scop_contains_loop (scop, loop)) ? current_outer :
- (loop->next != NULL) ? loop :
- outer_most_loop_1 (scop, loop_outer (loop), loop);
-}
-
-/* Return the outermost loop that contains the loop LOOP. */
-
-static struct loop *
-outer_most_loop (scop_p scop, struct loop *loop)
-{
- return outer_most_loop_1 (scop, loop, NULL);
-}
-
-/* Return the index of the outermost loop that contains the basic
- block BB. */
-
-static inline int
-gbb_outer_most_loop_index (scop_p scop, graphite_bb_p gb)
-{
- return scop_loop_index (scop, outer_most_loop (scop, gbb_loop (gb)));
-}
-
-/* Return the loop depth of LOOP in SCOP. */
-
-static inline unsigned int
-scop_gimple_loop_depth (scop_p scop, loop_p loop)
-{
- unsigned int depth = 0;
-
- loop = loop_outer (loop);
-
- while (scop_contains_loop (scop, loop))
- {
- depth++;
- loop = loop_outer (loop);
- }
-
- return depth;
-}
-
#endif /* GCC_GRAPHITE_H */
diff --git a/gcc/gthr-dce.h b/gcc/gthr-dce.h
index be92813dc23..4226359f0a0 100644
--- a/gcc/gthr-dce.h
+++ b/gcc/gthr-dce.h
@@ -37,6 +37,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
DCE threads are based on POSIX threads draft 4, and many things
have changed since then. */
+/* Make sure CONST_CAST2 (original in system.h) is defined. */
+#ifndef CONST_CAST2
+#ifdef __cplusplus
+#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
+#else
+#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
+#endif
+#endif
+
#define __GTHREADS 1
#include <pthread.h>
@@ -462,7 +471,8 @@ __gthread_getspecific (__gthread_key_t __key)
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
- return __gthrw_(pthread_setspecific) (__key, (void *) __ptr);
+ return __gthrw_(pthread_setspecific)
+ (__key, CONST_CAST2(void *, const void *, __ptr));
}
static inline void
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index fe335c4f0fa..f7782cbbf83 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -290,10 +290,49 @@ ipcp_lattice_from_jfunc (struct ipa_node_params *info, struct ipcp_lattice *lat,
else if (jfunc->type == IPA_JF_PASS_THROUGH)
{
struct ipcp_lattice *caller_lat;
+ tree cst;
- caller_lat = ipcp_get_lattice (info, jfunc->value.formal_id);
+ caller_lat = ipcp_get_lattice (info, jfunc->value.pass_through.formal_id);
lat->type = caller_lat->type;
- lat->constant = caller_lat->constant;
+ if (caller_lat->type != IPA_CONST_VALUE)
+ return;
+ cst = caller_lat->constant;
+
+ if (jfunc->value.pass_through.operation != NOP_EXPR)
+ cst = fold_binary (jfunc->value.pass_through.operation,
+ TREE_TYPE (cst), cst,
+ jfunc->value.pass_through.operand);
+ if (!cst || !is_gimple_ip_invariant (cst))
+ lat->type = IPA_BOTTOM;
+ lat->constant = cst;
+ }
+ else if (jfunc->type == IPA_JF_ANCESTOR)
+ {
+ struct ipcp_lattice *caller_lat;
+ tree t;
+ bool ok;
+
+ caller_lat = ipcp_get_lattice (info, jfunc->value.ancestor.formal_id);
+ lat->type = caller_lat->type;
+ if (caller_lat->type != IPA_CONST_VALUE)
+ return;
+ if (TREE_CODE (caller_lat->constant) != ADDR_EXPR)
+ {
+ /* This can happen when the constant is a NULL pointer. */
+ lat->type = IPA_BOTTOM;
+ return;
+ }
+ t = TREE_OPERAND (caller_lat->constant, 0);
+ ok = build_ref_for_offset (&t, TREE_TYPE (t),
+ jfunc->value.ancestor.offset,
+ jfunc->value.ancestor.type, false);
+ if (!ok)
+ {
+ lat->type = IPA_BOTTOM;
+ lat->constant = NULL_TREE;
+ }
+ else
+ lat->constant = build_fold_addr_expr (t);
}
else
lat->type = IPA_BOTTOM;
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 040096fa0d1..79de3634d86 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1006,10 +1006,8 @@ cgraph_decide_inlining_of_small_functions (void)
}
continue;
}
- if (!tree_can_inline_p (edge->caller->decl, edge->callee->decl))
+ if (!tree_can_inline_p (edge))
{
- gimple_call_set_cannot_inline (edge->call_stmt, true);
- edge->inline_failed = CIF_TARGET_OPTION_MISMATCH;
if (dump_file)
fprintf (dump_file, " inline_failed:%s.\n",
cgraph_inline_failed_string (edge->inline_failed));
@@ -1184,11 +1182,8 @@ cgraph_decide_inlining (void)
if (cgraph_recursive_inlining_p (e->caller, e->callee,
&e->inline_failed))
continue;
- if (!tree_can_inline_p (e->caller->decl, e->callee->decl))
- {
- gimple_call_set_cannot_inline (e->call_stmt, true);
- continue;
- }
+ if (!tree_can_inline_p (e))
+ continue;
if (cgraph_mark_inline_edge (e, true, NULL))
redo_always_inline = true;
if (dump_file)
@@ -1227,6 +1222,8 @@ cgraph_decide_inlining (void)
&& !node->needed
&& node->local.inlinable
&& node->callers->inline_failed
+ && node->callers->caller != node
+ && node->callers->caller->global.inlined_to != node
&& !gimple_call_cannot_inline_p (node->callers->call_stmt)
&& !DECL_EXTERNAL (node->decl)
&& !DECL_COMDAT (node->decl))
@@ -1438,14 +1435,14 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
continue;
}
- if (!tree_can_inline_p (node->decl, e->callee->decl))
+ if (!tree_can_inline_p (e))
{
- gimple_call_set_cannot_inline (e->call_stmt, true);
if (dump_file)
{
indent_to (dump_file, depth);
fprintf (dump_file,
- "Not inlining: Target specific option mismatch.\n");
+ "Not inlining: %s",
+ cgraph_inline_failed_string (e->inline_failed));
}
continue;
}
@@ -1551,14 +1548,14 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
}
continue;
}
- if (!tree_can_inline_p (node->decl, e->callee->decl))
+ if (!tree_can_inline_p (e))
{
- gimple_call_set_cannot_inline (e->call_stmt, true);
if (dump_file)
{
indent_to (dump_file, depth);
fprintf (dump_file,
- "Not inlining: Target specific option mismatch.\n");
+ "Not inlining: %s.",
+ cgraph_inline_failed_string (e->inline_failed));
}
continue;
}
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 1a7003295a2..23710067ee7 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -142,6 +142,20 @@ ipa_populate_param_decls (struct cgraph_node *node,
}
}
+/* Return how many formal parameters FNDECL has. */
+
+static inline int
+count_formal_params_1 (tree fndecl)
+{
+ tree parm;
+ int count = 0;
+
+ for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm))
+ count++;
+
+ return count;
+}
+
/* Count number of formal parameters in NOTE. Store the result to the
appropriate field of INFO. */
@@ -149,16 +163,9 @@ static void
ipa_count_formal_params (struct cgraph_node *node,
struct ipa_node_params *info)
{
- tree fndecl;
- tree fnargs;
- tree parm;
int param_num;
- fndecl = node->decl;
- fnargs = DECL_ARGUMENTS (fndecl);
- param_num = 0;
- for (parm = fnargs; parm; parm = TREE_CHAIN (parm))
- param_num++;
+ param_num = count_formal_params_1 (node->decl);
ipa_set_param_count (info, param_num);
}
@@ -293,8 +300,22 @@ ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node)
else if (type == IPA_JF_PASS_THROUGH)
{
fprintf (f, "PASS THROUGH: ");
- fprintf (f, "%d\n", jump_func->value.formal_id);
+ fprintf (f, "%d, op %s ",
+ jump_func->value.pass_through.formal_id,
+ tree_code_name[(int)
+ jump_func->value.pass_through.operation]);
+ if (jump_func->value.pass_through.operation != NOP_EXPR)
+ print_generic_expr (dump_file,
+ jump_func->value.pass_through.operand, 0);
+ fprintf (dump_file, "\n");
}
+ else if (type == IPA_JF_ANCESTOR)
+ {
+ fprintf (f, "ANCESTOR: ");
+ fprintf (f, "%d, offset "HOST_WIDE_INT_PRINT_DEC"\n",
+ jump_func->value.ancestor.formal_id,
+ jump_func->value.ancestor.offset);
+ }
}
}
}
@@ -313,6 +334,70 @@ ipa_print_all_jump_functions (FILE *f)
}
}
+/* Determine whether passing ssa name NAME constitutes a polynomial
+ pass-through function or getting an address of an acestor and if so, write
+ such a jump function to JFUNC. INFO describes the caller. */
+
+static void
+compute_complex_pass_through (struct ipa_node_params *info,
+ struct ipa_jump_func *jfunc,
+ tree name)
+{
+ HOST_WIDE_INT offset, size, max_size;
+ tree op1, op2, type;
+ int index;
+ gimple stmt = SSA_NAME_DEF_STMT (name);
+
+ if (!is_gimple_assign (stmt))
+ return;
+ op1 = gimple_assign_rhs1 (stmt);
+ op2 = gimple_assign_rhs2 (stmt);
+
+ if (op2)
+ {
+ if (TREE_CODE (op1) != SSA_NAME
+ || !SSA_NAME_IS_DEFAULT_DEF (op1)
+ || !is_gimple_ip_invariant (op2))
+ return;
+
+ index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
+ if (index >= 0)
+ {
+ jfunc->type = IPA_JF_PASS_THROUGH;
+ jfunc->value.pass_through.formal_id = index;
+ jfunc->value.pass_through.operation = gimple_assign_rhs_code (stmt);
+ jfunc->value.pass_through.operand = op2;
+ }
+ return;
+ }
+
+ if (TREE_CODE (op1) != ADDR_EXPR)
+ return;
+ op1 = TREE_OPERAND (op1, 0);
+ type = TREE_TYPE (op1);
+
+ op1 = get_ref_base_and_extent (op1, &offset, &size, &max_size);
+ if (TREE_CODE (op1) != INDIRECT_REF
+ /* If this is a varying address, punt. */
+ || max_size == -1
+ || max_size != size)
+ return;
+ op1 = TREE_OPERAND (op1, 0);
+ if (TREE_CODE (op1) != SSA_NAME
+ || !SSA_NAME_IS_DEFAULT_DEF (op1))
+ return;
+
+ index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1));
+ if (index >= 0)
+ {
+ jfunc->type = IPA_JF_ANCESTOR;
+ jfunc->value.ancestor.formal_id = index;
+ jfunc->value.ancestor.offset = offset;
+ jfunc->value.ancestor.type = type;
+ }
+}
+
+
/* Determine the jump functions of scalar arguments. Scalar means SSA names
and constants of a number of selected types. INFO is the ipa_node_params
structure associated with the caller, FUNCTIONS is a pointer to an array of
@@ -336,15 +421,21 @@ compute_scalar_jump_functions (struct ipa_node_params *info,
functions[num].type = IPA_JF_CONST;
functions[num].value.constant = arg;
}
- else if ((TREE_CODE (arg) == SSA_NAME) && SSA_NAME_IS_DEFAULT_DEF (arg))
+ else if (TREE_CODE (arg) == SSA_NAME)
{
- int index = ipa_get_param_decl_index (info, SSA_NAME_VAR (arg));
-
- if (index >= 0)
+ if (SSA_NAME_IS_DEFAULT_DEF (arg))
{
- functions[num].type = IPA_JF_PASS_THROUGH;
- functions[num].value.formal_id = index;
+ int index = ipa_get_param_decl_index (info, SSA_NAME_VAR (arg));
+
+ if (index >= 0)
+ {
+ functions[num].type = IPA_JF_PASS_THROUGH;
+ functions[num].value.pass_through.formal_id = index;
+ functions[num].value.pass_through.operation = NOP_EXPR;
+ }
}
+ else
+ compute_complex_pass_through (info, &functions[num], arg);
}
}
}
@@ -411,7 +502,8 @@ compute_pass_through_member_ptrs (struct ipa_node_params *info,
if (!ipa_is_param_modified (info, index))
{
functions[num].type = IPA_JF_PASS_THROUGH;
- functions[num].value.formal_id = index;
+ functions[num].value.pass_through.formal_id = index;
+ functions[num].value.pass_through.operation = NOP_EXPR;
}
else
undecided_members = true;
@@ -585,25 +677,28 @@ ipa_compute_jump_functions (struct cgraph_edge *cs)
compute_cst_member_ptr_arguments (arguments->jump_functions, call);
}
-/* If RHS looks like a rhs of a statement loading pfn from a member pointer
- formal parameter, return the parameter, otherwise return NULL. */
+/* If RHS looks like a rhs of a statement loading pfn from a member
+ pointer formal parameter, return the parameter, otherwise return
+ NULL. If USE_DELTA, then we look for a use of the delta field
+ rather than the pfn. */
static tree
-ipa_get_member_ptr_load_param (tree rhs)
+ipa_get_member_ptr_load_param (tree rhs, bool use_delta)
{
tree rec, fld;
tree ptr_field;
+ tree delta_field;
if (TREE_CODE (rhs) != COMPONENT_REF)
return NULL_TREE;
rec = TREE_OPERAND (rhs, 0);
if (TREE_CODE (rec) != PARM_DECL
- || !type_like_member_ptr_p (TREE_TYPE (rec), &ptr_field, NULL))
+ || !type_like_member_ptr_p (TREE_TYPE (rec), &ptr_field, &delta_field))
return NULL_TREE;
fld = TREE_OPERAND (rhs, 1);
- if (fld == ptr_field)
+ if (use_delta ? (fld == delta_field) : (fld == ptr_field))
return rec;
else
return NULL_TREE;
@@ -613,7 +708,7 @@ ipa_get_member_ptr_load_param (tree rhs)
parameter, this function returns that parameter. */
static tree
-ipa_get_stmt_member_ptr_load_param (gimple stmt)
+ipa_get_stmt_member_ptr_load_param (gimple stmt, bool use_delta)
{
tree rhs;
@@ -621,7 +716,7 @@ ipa_get_stmt_member_ptr_load_param (gimple stmt)
return NULL_TREE;
rhs = gimple_assign_rhs1 (stmt);
- return ipa_get_member_ptr_load_param (rhs);
+ return ipa_get_member_ptr_load_param (rhs, use_delta);
}
/* Returns true iff T is an SSA_NAME defined by a statement. */
@@ -756,15 +851,15 @@ ipa_analyze_call_uses (struct ipa_node_params *info, gimple call)
d1 = SSA_NAME_DEF_STMT (n1);
d2 = SSA_NAME_DEF_STMT (n2);
- if ((rec = ipa_get_stmt_member_ptr_load_param (d1)))
+ if ((rec = ipa_get_stmt_member_ptr_load_param (d1, false)))
{
- if (ipa_get_stmt_member_ptr_load_param (d2))
+ if (ipa_get_stmt_member_ptr_load_param (d2, false))
return;
bb = gimple_bb (d1);
virt_bb = gimple_bb (d2);
}
- else if ((rec = ipa_get_stmt_member_ptr_load_param (d2)))
+ else if ((rec = ipa_get_stmt_member_ptr_load_param (d2, false)))
{
bb = gimple_bb (d2);
virt_bb = gimple_bb (d1);
@@ -817,7 +912,10 @@ ipa_analyze_call_uses (struct ipa_node_params *info, gimple call)
def = SSA_NAME_DEF_STMT (cond);
}
- rec2 = ipa_get_stmt_member_ptr_load_param (def);
+ rec2 = ipa_get_stmt_member_ptr_load_param (def,
+ (TARGET_PTRMEMFUNC_VBIT_LOCATION
+ == ptrmemfunc_vbit_in_delta));
+
if (rec != rec2)
return;
@@ -870,7 +968,10 @@ ipa_analyze_params_uses (struct cgraph_node *node)
/* Update the jump functions associated with call graph edge E when the call
graph edge CS is being inlined, assuming that E->caller is already (possibly
- indirectly) inlined into CS->callee and that E has not been inlined. */
+ indirectly) inlined into CS->callee and that E has not been inlined.
+
+ We keep pass through functions only if they do not contain any operation.
+ This is sufficient for inlining and greately simplifies things. */
static void
update_jump_functions_after_inlining (struct cgraph_edge *cs,
@@ -885,17 +986,26 @@ update_jump_functions_after_inlining (struct cgraph_edge *cs,
{
struct ipa_jump_func *src, *dst = ipa_get_ith_jump_func (args, i);
+ if (dst->type == IPA_JF_ANCESTOR)
+ {
+ dst->type = IPA_JF_UNKNOWN;
+ continue;
+ }
+
if (dst->type != IPA_JF_PASS_THROUGH)
continue;
- /* We must check range due to calls with variable number of arguments: */
- if (dst->value.formal_id >= (unsigned) ipa_get_cs_argument_count (top))
+ /* We must check range due to calls with variable number of arguments and
+ we cannot combine jump functions with operations. */
+ if (dst->value.pass_through.operation != NOP_EXPR
+ || (dst->value.pass_through.formal_id
+ >= ipa_get_cs_argument_count (top)))
{
dst->type = IPA_JF_UNKNOWN;
continue;
}
- src = ipa_get_ith_jump_func (top, dst->value.formal_id);
+ src = ipa_get_ith_jump_func (top, dst->value.pass_through.formal_id);
*dst = *src;
}
}
@@ -946,15 +1056,16 @@ update_call_notes_after_inlining (struct cgraph_edge *cs,
continue;
/* We must check range due to calls with variable number of arguments: */
- if (nt->formal_id >= (unsigned) ipa_get_cs_argument_count (top))
+ if (nt->formal_id >= ipa_get_cs_argument_count (top))
{
nt->processed = true;
continue;
}
jfunc = ipa_get_ith_jump_func (top, nt->formal_id);
- if (jfunc->type == IPA_JF_PASS_THROUGH)
- nt->formal_id = jfunc->value.formal_id;
+ if (jfunc->type == IPA_JF_PASS_THROUGH
+ && jfunc->value.pass_through.operation == NOP_EXPR)
+ nt->formal_id = jfunc->value.pass_through.formal_id;
else if (jfunc->type == IPA_JF_CONST
|| jfunc->type == IPA_JF_CONST_MEMBER_PTR)
{
@@ -991,6 +1102,13 @@ update_call_notes_after_inlining (struct cgraph_edge *cs,
VEC_safe_push (cgraph_edge_p, heap, *new_edges, new_indirect_edge);
top = IPA_EDGE_REF (cs);
}
+ else
+ {
+ /* Ancestor jum functions and pass theoughs with operations should
+ not be used on parameters that then get called. */
+ gcc_assert (jfunc->type == IPA_JF_UNKNOWN);
+ nt->processed = true;
+ }
}
return res;
}
@@ -1297,3 +1415,454 @@ ipa_print_all_params (FILE * f)
for (node = cgraph_nodes; node; node = node->next)
ipa_print_node_params (f, node);
}
+
+/* Return a heap allocated vector containing formal parameters of FNDECL. */
+
+VEC(tree, heap) *
+ipa_get_vector_of_formal_parms (tree fndecl)
+{
+ VEC(tree, heap) *args;
+ int count;
+ tree parm;
+
+ count = count_formal_params_1 (fndecl);
+ args = VEC_alloc (tree, heap, count);
+ for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm))
+ VEC_quick_push (tree, args, parm);
+
+ return args;
+}
+
+/* Return a heap allocated vector containing types of formal parameters of
+ function type FNTYPE. */
+
+static inline VEC(tree, heap) *
+get_vector_of_formal_parm_types (tree fntype)
+{
+ VEC(tree, heap) *types;
+ int count = 0;
+ tree t;
+
+ for (t = TYPE_ARG_TYPES (fntype); t; t = TREE_CHAIN (t))
+ count++;
+
+ types = VEC_alloc (tree, heap, count);
+ for (t = TYPE_ARG_TYPES (fntype); t; t = TREE_CHAIN (t))
+ VEC_quick_push (tree, types, TREE_VALUE (t));
+
+ return types;
+}
+
+/* Modify the function declaration FNDECL and its type according to the plan in
+ ADJUSTMENTS. It also sets base fields of individual adjustments structures
+ to reflect the actual parameters being modified which are determined by the
+ base_index field. */
+
+void
+ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
+ const char *synth_parm_prefix)
+{
+ VEC(tree, heap) *oparms, *otypes;
+ tree orig_type, new_type = NULL;
+ tree old_arg_types, t, new_arg_types = NULL;
+ tree parm, *link = &DECL_ARGUMENTS (fndecl);
+ int i, len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ tree new_reversed = NULL;
+ bool care_for_types, last_parm_void;
+
+ if (!synth_parm_prefix)
+ synth_parm_prefix = "SYNTH";
+
+ oparms = ipa_get_vector_of_formal_parms (fndecl);
+ orig_type = TREE_TYPE (fndecl);
+ old_arg_types = TYPE_ARG_TYPES (orig_type);
+
+ /* The following test is an ugly hack, some functions simply don't have any
+ arguments in their type. This is probably a bug but well... */
+ care_for_types = (old_arg_types != NULL_TREE);
+ if (care_for_types)
+ {
+ last_parm_void = (TREE_VALUE (tree_last (old_arg_types))
+ == void_type_node);
+ otypes = get_vector_of_formal_parm_types (orig_type);
+ if (last_parm_void)
+ gcc_assert (VEC_length (tree, oparms) + 1 == VEC_length (tree, otypes));
+ else
+ gcc_assert (VEC_length (tree, oparms) == VEC_length (tree, otypes));
+ }
+ else
+ {
+ last_parm_void = false;
+ otypes = NULL;
+ }
+
+ for (i = 0; i < len; i++)
+ {
+ struct ipa_parm_adjustment *adj;
+ gcc_assert (link);
+
+ adj = VEC_index (ipa_parm_adjustment_t, adjustments, i);
+ parm = VEC_index (tree, oparms, adj->base_index);
+ adj->base = parm;
+
+ if (adj->copy_param)
+ {
+ if (care_for_types)
+ new_arg_types = tree_cons (NULL_TREE, VEC_index (tree, otypes,
+ adj->base_index),
+ new_arg_types);
+ *link = parm;
+ link = &TREE_CHAIN (parm);
+ }
+ else if (!adj->remove_param)
+ {
+ tree new_parm;
+ tree ptype;
+
+ if (adj->by_ref)
+ ptype = build_pointer_type (adj->type);
+ else
+ ptype = adj->type;
+
+ if (care_for_types)
+ new_arg_types = tree_cons (NULL_TREE, ptype, new_arg_types);
+
+ new_parm = build_decl (UNKNOWN_LOCATION, PARM_DECL, NULL_TREE,
+ ptype);
+ DECL_NAME (new_parm) = create_tmp_var_name (synth_parm_prefix);
+
+ DECL_ARTIFICIAL (new_parm) = 1;
+ DECL_ARG_TYPE (new_parm) = ptype;
+ DECL_CONTEXT (new_parm) = fndecl;
+ TREE_USED (new_parm) = 1;
+ DECL_IGNORED_P (new_parm) = 1;
+ layout_decl (new_parm, 0);
+
+ add_referenced_var (new_parm);
+ mark_sym_for_renaming (new_parm);
+ adj->base = parm;
+ adj->reduction = new_parm;
+
+ *link = new_parm;
+
+ link = &TREE_CHAIN (new_parm);
+ }
+ }
+
+ *link = NULL_TREE;
+
+ if (care_for_types)
+ {
+ new_reversed = nreverse (new_arg_types);
+ if (last_parm_void)
+ {
+ if (new_reversed)
+ TREE_CHAIN (new_arg_types) = void_list_node;
+ else
+ new_reversed = void_list_node;
+ }
+ }
+
+ /* Use copy_node to preserve as much as possible from original type
+ (debug info, attribute lists etc.)
+ Exception is METHOD_TYPEs must have THIS argument.
+ When we are asked to remove it, we need to build new FUNCTION_TYPE
+ instead. */
+ if (TREE_CODE (orig_type) != METHOD_TYPE
+ || (VEC_index (ipa_parm_adjustment_t, adjustments, 0)->copy_param
+ && VEC_index (ipa_parm_adjustment_t, adjustments, 0)->base_index == 0))
+ {
+ new_type = copy_node (orig_type);
+ TYPE_ARG_TYPES (new_type) = new_reversed;
+ }
+ else
+ {
+ new_type
+ = build_distinct_type_copy (build_function_type (TREE_TYPE (orig_type),
+ new_reversed));
+ TYPE_CONTEXT (new_type) = TYPE_CONTEXT (orig_type);
+ DECL_VINDEX (fndecl) = NULL_TREE;
+ }
+
+ /* This is a new type, not a copy of an old type. Need to reassociate
+ variants. We can handle everything except the main variant lazily. */
+ t = TYPE_MAIN_VARIANT (orig_type);
+ if (orig_type != t)
+ {
+ TYPE_MAIN_VARIANT (new_type) = t;
+ TYPE_NEXT_VARIANT (new_type) = TYPE_NEXT_VARIANT (t);
+ TYPE_NEXT_VARIANT (t) = new_type;
+ }
+ else
+ {
+ TYPE_MAIN_VARIANT (new_type) = new_type;
+ TYPE_NEXT_VARIANT (new_type) = NULL;
+ }
+
+ TREE_TYPE (fndecl) = new_type;
+ if (otypes)
+ VEC_free (tree, heap, otypes);
+ VEC_free (tree, heap, oparms);
+}
+
+/* Modify actual arguments of a function call CS as indicated in ADJUSTMENTS.
+ If this is a directly recursive call, CS must be NULL. Otherwise it must
+ contain the corresponding call graph edge. */
+
+void
+ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt,
+ ipa_parm_adjustment_vec adjustments)
+{
+ VEC(tree, heap) *vargs;
+ gimple new_stmt;
+ gimple_stmt_iterator gsi;
+ tree callee_decl;
+ int i, len;
+
+ len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ vargs = VEC_alloc (tree, heap, len);
+
+ gsi = gsi_for_stmt (stmt);
+ for (i = 0; i < len; i++)
+ {
+ struct ipa_parm_adjustment *adj;
+
+ adj = VEC_index (ipa_parm_adjustment_t, adjustments, i);
+
+ if (adj->copy_param)
+ {
+ tree arg = gimple_call_arg (stmt, adj->base_index);
+
+ VEC_quick_push (tree, vargs, arg);
+ }
+ else if (!adj->remove_param)
+ {
+ tree expr, orig_expr;
+ bool allow_ptr, repl_found;
+
+ orig_expr = expr = gimple_call_arg (stmt, adj->base_index);
+ if (TREE_CODE (expr) == ADDR_EXPR)
+ {
+ allow_ptr = false;
+ expr = TREE_OPERAND (expr, 0);
+ }
+ else
+ allow_ptr = true;
+
+ repl_found = build_ref_for_offset (&expr, TREE_TYPE (expr),
+ adj->offset, adj->type,
+ allow_ptr);
+ if (repl_found)
+ {
+ if (adj->by_ref)
+ expr = build_fold_addr_expr (expr);
+ }
+ else
+ {
+ tree ptrtype = build_pointer_type (adj->type);
+ expr = orig_expr;
+ if (!POINTER_TYPE_P (TREE_TYPE (expr)))
+ expr = build_fold_addr_expr (expr);
+ if (!useless_type_conversion_p (ptrtype, TREE_TYPE (expr)))
+ expr = fold_convert (ptrtype, expr);
+ expr = fold_build2 (POINTER_PLUS_EXPR, ptrtype, expr,
+ build_int_cst (size_type_node,
+ adj->offset / BITS_PER_UNIT));
+ if (!adj->by_ref)
+ expr = fold_build1 (INDIRECT_REF, adj->type, expr);
+ }
+ expr = force_gimple_operand_gsi (&gsi, expr,
+ adj->by_ref
+ || is_gimple_reg_type (adj->type),
+ NULL, true, GSI_SAME_STMT);
+ VEC_quick_push (tree, vargs, expr);
+ }
+ }
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "replacing stmt:");
+ print_gimple_stmt (dump_file, gsi_stmt (gsi), 0, 0);
+ }
+
+ callee_decl = !cs ? gimple_call_fndecl (stmt) : cs->callee->decl;
+ new_stmt = gimple_build_call_vec (callee_decl, vargs);
+ VEC_free (tree, heap, vargs);
+ if (gimple_call_lhs (stmt))
+ gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
+
+ gimple_set_block (new_stmt, gimple_block (stmt));
+ if (gimple_has_location (stmt))
+ gimple_set_location (new_stmt, gimple_location (stmt));
+ gimple_call_copy_flags (new_stmt, stmt);
+ gimple_call_set_chain (new_stmt, gimple_call_chain (stmt));
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "with stmt:");
+ print_gimple_stmt (dump_file, new_stmt, 0, 0);
+ fprintf (dump_file, "\n");
+ }
+ gsi_replace (&gsi, new_stmt, true);
+ if (cs)
+ cgraph_set_call_stmt (cs, new_stmt);
+ update_ssa (TODO_update_ssa);
+ free_dominance_info (CDI_DOMINATORS);
+}
+
+/* Return true iff BASE_INDEX is in ADJUSTMENTS more than once. */
+
+static bool
+index_in_adjustments_multiple_times_p (int base_index,
+ ipa_parm_adjustment_vec adjustments)
+{
+ int i, len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ bool one = false;
+
+ for (i = 0; i < len; i++)
+ {
+ struct ipa_parm_adjustment *adj;
+ adj = VEC_index (ipa_parm_adjustment_t, adjustments, i);
+
+ if (adj->base_index == base_index)
+ {
+ if (one)
+ return true;
+ else
+ one = true;
+ }
+ }
+ return false;
+}
+
+
+/* Return adjustments that should have the same effect on function parameters
+ and call arguments as if they were first changed according to adjustments in
+ INNER and then by adjustments in OUTER. */
+
+ipa_parm_adjustment_vec
+ipa_combine_adjustments (ipa_parm_adjustment_vec inner,
+ ipa_parm_adjustment_vec outer)
+{
+ int i, outlen = VEC_length (ipa_parm_adjustment_t, outer);
+ int inlen = VEC_length (ipa_parm_adjustment_t, inner);
+ int removals = 0;
+ ipa_parm_adjustment_vec adjustments, tmp;
+
+ tmp = VEC_alloc (ipa_parm_adjustment_t, heap, inlen);
+ for (i = 0; i < inlen; i++)
+ {
+ struct ipa_parm_adjustment *n;
+ n = VEC_index (ipa_parm_adjustment_t, inner, i);
+
+ if (n->remove_param)
+ removals++;
+ else
+ VEC_quick_push (ipa_parm_adjustment_t, tmp, n);
+ }
+
+ adjustments = VEC_alloc (ipa_parm_adjustment_t, heap, outlen + removals);
+ for (i = 0; i < outlen; i++)
+ {
+ struct ipa_parm_adjustment *r;
+ struct ipa_parm_adjustment *out = VEC_index (ipa_parm_adjustment_t,
+ outer, i);
+ struct ipa_parm_adjustment *in = VEC_index (ipa_parm_adjustment_t, tmp,
+ out->base_index);
+
+ gcc_assert (!in->remove_param);
+ if (out->remove_param)
+ {
+ if (!index_in_adjustments_multiple_times_p (in->base_index, tmp))
+ {
+ r = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL);
+ memset (r, 0, sizeof (*r));
+ r->remove_param = true;
+ }
+ continue;
+ }
+
+ r = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL);
+ memset (r, 0, sizeof (*r));
+ r->base_index = in->base_index;
+ r->type = out->type;
+
+ /* FIXME: Create nonlocal value too. */
+
+ if (in->copy_param && out->copy_param)
+ r->copy_param = true;
+ else if (in->copy_param)
+ r->offset = out->offset;
+ else if (out->copy_param)
+ r->offset = in->offset;
+ else
+ r->offset = in->offset + out->offset;
+ }
+
+ for (i = 0; i < inlen; i++)
+ {
+ struct ipa_parm_adjustment *n = VEC_index (ipa_parm_adjustment_t,
+ inner, i);
+
+ if (n->remove_param)
+ VEC_quick_push (ipa_parm_adjustment_t, adjustments, n);
+ }
+
+ VEC_free (ipa_parm_adjustment_t, heap, tmp);
+ return adjustments;
+}
+
+/* Dump the adjustments in the vector ADJUSTMENTS to dump_file in a human
+ friendly way, assuming they are meant to be applied to FNDECL. */
+
+void
+ipa_dump_param_adjustments (FILE *file, ipa_parm_adjustment_vec adjustments,
+ tree fndecl)
+{
+ int i, len = VEC_length (ipa_parm_adjustment_t, adjustments);
+ bool first = true;
+ VEC(tree, heap) *parms = ipa_get_vector_of_formal_parms (fndecl);
+
+ fprintf (file, "IPA param adjustments: ");
+ for (i = 0; i < len; i++)
+ {
+ struct ipa_parm_adjustment *adj;
+ adj = VEC_index (ipa_parm_adjustment_t, adjustments, i);
+
+ if (!first)
+ fprintf (file, " ");
+ else
+ first = false;
+
+ fprintf (file, "%i. base_index: %i - ", i, adj->base_index);
+ print_generic_expr (file, VEC_index (tree, parms, adj->base_index), 0);
+ if (adj->base)
+ {
+ fprintf (file, ", base: ");
+ print_generic_expr (file, adj->base, 0);
+ }
+ if (adj->reduction)
+ {
+ fprintf (file, ", reduction: ");
+ print_generic_expr (file, adj->reduction, 0);
+ }
+ if (adj->new_ssa_base)
+ {
+ fprintf (file, ", new_ssa_base: ");
+ print_generic_expr (file, adj->new_ssa_base, 0);
+ }
+
+ if (adj->copy_param)
+ fprintf (file, ", copy_param");
+ else if (adj->remove_param)
+ fprintf (file, ", remove_param");
+ else
+ fprintf (file, ", offset %li", (long) adj->offset);
+ if (adj->by_ref)
+ fprintf (file, ", by_ref");
+ print_node_brief (file, ", type: ", adj->type, 0);
+ fprintf (file, "\n");
+ }
+ VEC_free (tree, heap, parms);
+}
+
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index fafadaca247..9b5f74f87ad 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -31,18 +31,26 @@ along with GCC; see the file COPYING3. If not see
/* A jump function for a callsite represents the values passed as actual
arguments of the callsite. There are three main types of values :
- Formal - the caller's formal parameter is passed as an actual argument.
- Constant - a constant is passed as an actual argument.
- Unknown - neither of the above.
- Integer and real constants are represented as IPA_JF_CONST.
- Finally, IPA_JF_CONST_MEMBER_PTR stands for C++ member pointers
- constants. */
+
+ Pass-through - the caller's formal parameter is passed as an actual
+ argument, possibly one simple operation performed on it.
+ Constant - a constant (is_gimple_ip_invariant)is passed as an actual
+ argument.
+ Unknown - neither of the above.
+
+ IPA_JF_CONST_MEMBER_PTR stands for C++ member pointers, other constants are
+ represented with IPA_JF_CONST.
+
+ In addition to "ordinary" pass through functions represented by
+ IPA_JF_PASS_THROUGH, IPA_JF_ANCESTOR represents getting addresses of of
+ ancestor fields in C++ (e.g. &this_1(D)->D.1766.D.1756). */
enum jump_func_type
{
IPA_JF_UNKNOWN = 0, /* newly allocated and zeroed jump functions default */
IPA_JF_CONST,
IPA_JF_CONST_MEMBER_PTR,
- IPA_JF_PASS_THROUGH
+ IPA_JF_PASS_THROUGH,
+ IPA_JF_ANCESTOR
};
/* All formal parameters in the program have a lattice associated with it
@@ -61,6 +69,36 @@ enum ipa_lattice_type
IPA_TOP
};
+
+/* Structure holding data required to describe a pass-through jump function. */
+
+struct ipa_pass_through_data
+{
+ /* If an operation is to be performed on the original parameter, this is the
+ second (constant) operand. */
+ tree operand;
+ /* Number of the caller's formal parameter being passed. */
+ int formal_id;
+ /* Operation that is performed on the argument before it is passed on.
+ NOP_EXPR means no operation. Otherwise oper must be a simple binary
+ arithmetic operation where the caller's parameter is the first operand and
+ operand field from this structure is the second one. */
+ enum tree_code operation;
+};
+
+/* Structure holding data required to describe and ancestor pass throu
+ funkci. */
+
+struct ipa_ancestor_jf_data
+{
+ /* Offset of the field representing the ancestor. */
+ HOST_WIDE_INT offset;
+ /* TYpe of the result. */
+ tree type;
+ /* Number of the caller's formal parameter being passed. */
+ int formal_id;
+};
+
/* Structure holding a C++ member pointer constant. Holds a pointer to the
method and delta offset. */
struct ipa_member_ptr_cst
@@ -69,15 +107,14 @@ struct ipa_member_ptr_cst
tree delta;
};
-/* Represents a value of a jump function. formal_id is used only in jump
- function context and represents pass-through parameter (the formal parameter
- of the caller is passed as argument). constant represents the actual
- constant in constant jump functions and member_cst holds constant c++ member
- functions. */
+/* Represents a value of a jump function. pass_through is used only in jump
+ function context. constant represents the actual constant in constant jump
+ functions and member_cst holds constant c++ member functions. */
union jump_func_value
{
- unsigned int formal_id;
tree constant;
+ struct ipa_pass_through_data pass_through;
+ struct ipa_ancestor_jf_data ancestor;
struct ipa_member_ptr_cst member_cst;
};
@@ -109,7 +146,7 @@ struct ipa_param_call_note
/* Statement that contains the call to the parameter above. */
gimple stmt;
/* Index of the parameter that is called. */
- unsigned int formal_id;
+ int formal_id;
/* Expected number of executions: calculated in profile.c. */
gcov_type count;
/* Expected frequency of executions within the function. see cgraph_edge in
@@ -403,4 +440,75 @@ void ipa_print_all_params (FILE *);
void ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node);
void ipa_print_all_jump_functions (FILE * f);
+/* Structure to describe transformations of formal parameters and actual
+ arguments. Each instance describes one new parameter and they are meant to
+ be stored in a vector. Additionally, most users will probably want to store
+ adjustments about parameters that are being removed altogether so that SSA
+ names belonging to them can be replaced by SSA names of an artificial
+ variable. */
+struct ipa_parm_adjustment
+{
+ /* The original PARM_DECL itself, helpful for processing of the body of the
+ function itself. Intended for traversing function bodies.
+ ipa_modify_formal_parameters, ipa_modify_call_arguments and
+ ipa_combine_adjustments ignore this and use base_index.
+ ipa_modify_formal_parameters actually sets this. */
+ tree base;
+
+ /* Type of the new parameter. However, if by_ref is true, the real type will
+ be a pointer to this type. */
+ tree type;
+
+ /* The new declaration when creating/replacing a parameter. Created by
+ ipa_modify_formal_parameters, useful for functions modifying the body
+ accordingly. */
+ tree reduction;
+
+ /* New declaration of a substitute variable that we may use to replace all
+ non-default-def ssa names when a parm decl is going away. */
+ tree new_ssa_base;
+
+ /* If non-NULL and the original parameter is to be removed (copy_param below
+ is NULL), this is going to be its nonlocalized vars value. */
+ tree nonlocal_value;
+
+ /* Offset into the original parameter (for the cases when the new parameter
+ is a component of an original one). */
+ HOST_WIDE_INT offset;
+
+ /* Zero based index of the original parameter this one is based on. (ATM
+ there is no way to insert a new parameter out of the blue because there is
+ no need but if it arises the code can be easily exteded to do so.) */
+ int base_index;
+
+ /* This new parameter is an unmodified parameter at index base_index. */
+ unsigned copy_param : 1;
+
+ /* This adjustment describes a parameter that is about to be removed
+ completely. Most users will probably need to book keep those so that they
+ don't leave behinfd any non default def ssa names belonging to them. */
+ unsigned remove_param : 1;
+
+ /* The parameter is to be passed by reference. */
+ unsigned by_ref : 1;
+};
+
+typedef struct ipa_parm_adjustment ipa_parm_adjustment_t;
+DEF_VEC_O (ipa_parm_adjustment_t);
+DEF_VEC_ALLOC_O (ipa_parm_adjustment_t, heap);
+
+typedef VEC (ipa_parm_adjustment_t, heap) *ipa_parm_adjustment_vec;
+
+VEC(tree, heap) *ipa_get_vector_of_formal_parms (tree fndecl);
+void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec,
+ const char *);
+void ipa_modify_call_arguments (struct cgraph_edge *, gimple,
+ ipa_parm_adjustment_vec);
+ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec,
+ ipa_parm_adjustment_vec);
+void ipa_dump_param_adjustments (FILE *, ipa_parm_adjustment_vec, tree);
+
+/* From tree-sra.c: */
+bool build_ref_for_offset (tree *, tree, HOST_WIDE_INT, tree, bool);
+
#endif /* IPA_PROP_H */
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index 199c5855e2e..bc84eee372b 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -658,7 +658,7 @@ make_edge_and_fix_phis_of_dest (basic_block bb, edge e)
{
gimple phi = gsi_stmt (si);
arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
- add_phi_arg (phi, arg, new_e);
+ add_phi_arg (phi, arg, new_e, gimple_phi_arg_location_from_edge (phi, e));
}
return new_e;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index d6c87f45a10..7c1ac22f9e6 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,38 @@
+2009-08-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Make-lang.in (java.install-pdf): Install gcj.pdf in
+ $(pdfdir)/gcc, alongside the other manuals.
+
+2009-08-12 Andrew Haley <aph@redhat.com>
+
+ * builtins.c (compareAndSwapInt_builtin): Use
+ flag_use_atomic_builtins.
+ (compareAndSwapLong_builtin): Likewise.
+ (compareAndSwapObject_builtin): Likewise.
+ * jvspec.c: Add flag_use_atomic_builtins.
+ * gcj.texi: Likewise.
+ * java-tree.h: Likewise.
+ * lang.opt: Likewise.
+
+2009-08-11 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/40990
+ * lang.c (put_decl_node): Outputs different level of information
+ depending on the verbosity level.
+
+2009-07-31 Andrew Haley <aph@redhat.com>
+
+ PR java/40867
+ * decl.c (java_replace_references): Set EXPR_LOCATION on all
+ generated expressions.
+ (binding_level.loc): new field.
+ (clear_binding_level): Initialize loc.
+ (set_input_location): New function.
+ (pushlevel): Set new binding_level.loc.
+ (poplevel): Set EXPR_LOCATION on the new BIND_EXPR_BODY.
+ (start_java_method): Set DECL_SOURCE_LOCATION of this new method.
+ (java_add_stmt): Set the EXPR_LOCATION on all subtrees of new_stmt.
+
2009-07-17 Richard Guenther <rguenther@suse.de>
PR c/40401
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 094e5e1bcfb..ff330fda4e5 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -197,12 +197,12 @@ java.install-info: $(DESTDIR)$(infodir)/gcj.info
java.install-pdf: $(JAVA_PDFFILES)
@$(NORMAL_INSTALL)
- test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)"
+ test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
@list='$(JAVA_PDFFILES)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(pdf__strip_dir) \
- echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
- $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
+ echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
+ $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
done
#
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 0f7b197f78c..6e4815beeab 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -318,7 +318,8 @@ compareAndSwapInt_builtin (tree method_return_type ATTRIBUTE_UNUSED,
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (int_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ || flag_use_atomic_builtins)
{
tree addr, stmt;
UNMARSHAL5 (orig_call);
@@ -337,7 +338,12 @@ compareAndSwapLong_builtin (tree method_return_type ATTRIBUTE_UNUSED,
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (long_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ || (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (word_mode)
+ && flag_use_atomic_builtins))
+ /* We don't trust flag_use_atomic_builtins for multi-word
+ compareAndSwap. Some machines such as ARM have atomic libfuncs
+ but not the multi-word versions. */
{
tree addr, stmt;
UNMARSHAL5 (orig_call);
@@ -355,7 +361,8 @@ compareAndSwapObject_builtin (tree method_return_type ATTRIBUTE_UNUSED,
tree orig_call)
{
enum machine_mode mode = TYPE_MODE (ptr_type_node);
- if (sync_compare_and_swap[mode] != CODE_FOR_nothing)
+ if (sync_compare_and_swap[mode] != CODE_FOR_nothing
+ || flag_use_atomic_builtins)
{
tree addr, stmt;
int builtin;
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 8c327fa97d3..4ab67d6cf51 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -349,6 +349,7 @@ java_replace_references (tree *tp, int *walk_subtrees,
{
if (TREE_CODE (*tp) == MODIFY_EXPR)
{
+ source_location loc = EXPR_LOCATION (*tp);
tree lhs = TREE_OPERAND (*tp, 0);
/* This is specific to the bytecode compiler. If a variable has
LOCAL_SLOT_P set, replace an assignment to it with an assignment
@@ -361,9 +362,12 @@ java_replace_references (tree *tp, int *walk_subtrees,
tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs),
TREE_OPERAND (*tp, 1));
- *tp = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
- new_lhs, new_rhs);
- *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), *tp);
+ tree tem = build2 (MODIFY_EXPR, TREE_TYPE (new_lhs),
+ new_lhs, new_rhs);
+ *tp = build1 (NOP_EXPR, TREE_TYPE (lhs), tem);
+ SET_EXPR_LOCATION (tem, loc);
+ SET_EXPR_LOCATION (new_rhs, loc);
+ SET_EXPR_LOCATION (*tp, loc);
}
}
if (TREE_CODE (*tp) == VAR_DECL)
@@ -418,6 +422,9 @@ struct GTY(())
/* Binding depth at which this level began. Used only for debugging. */
unsigned binding_depth;
+
+ /* The location at which this level began. */
+ source_location loc;
};
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
@@ -458,10 +465,11 @@ static const struct binding_level clear_binding_level
NULL, /* stmts */
NULL, /* exception_range */
0, /* binding_depth */
+ 0, /* loc */
};
tree java_global_trees[JTI_MAX];
-
+
/* Build (and pushdecl) a "promoted type" for all standard
types shorter than int. */
@@ -1394,7 +1402,8 @@ pushlevel (int unused ATTRIBUTE_UNUSED)
*newlevel = clear_binding_level;
newlevel->level_chain = current_binding_level;
- current_binding_level = newlevel;
+ newlevel->loc = input_location;
+ current_binding_level = newlevel;
#if defined(DEBUG_JAVA_BINDING_LEVELS)
newlevel->binding_depth = binding_depth;
indent ();
@@ -1509,6 +1518,8 @@ poplevel (int keep, int reverse, int functionbody)
if (BIND_EXPR_BODY (bind) == NULL)
BIND_EXPR_BODY (bind) = build_java_empty_stmt ();
+ SET_EXPR_LOCATION (bind, current_binding_level->loc);
+
current_binding_level->stmts = NULL;
}
else
@@ -1876,6 +1887,7 @@ start_java_method (tree fndecl)
type_map[i++] = NULL_TREE;
build_result_decl (fndecl);
+ DECL_SOURCE_LOCATION (fndecl) = input_location;
/* Push local variables. */
pushlevel (2);
@@ -2037,6 +2049,26 @@ add_stmt_to_compound (tree existing, tree type, tree stmt)
return stmt;
}
+/* If this node is an expr, mark its input location. Called from
+ walk_tree(). */
+
+static tree
+set_input_location (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ tree t = *tp;
+
+ if (CAN_HAVE_LOCATION_P (t))
+ {
+ if (EXPR_HAS_LOCATION(t))
+ return t; /* Don't walk any further into this expr. */
+ else
+ SET_EXPR_LOCATION (t, input_location);
+ }
+
+ return NULL_TREE; /* Continue walking this expr. */
+}
+
/* Add a statement to the statement_list currently being constructed.
If the statement_list is null, we don't create a singleton list.
This is necessary because poplevel() assumes that adding a
@@ -2049,8 +2081,8 @@ java_add_stmt (tree new_stmt)
tree_stmt_iterator i;
if (input_filename)
- SET_EXPR_LOCATION (new_stmt, input_location);
-
+ walk_tree (&new_stmt, set_input_location, NULL, NULL);
+
if (stmts == NULL)
return current_binding_level->stmts = new_stmt;
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 00ac9f7dee0..46b0899e800 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -607,6 +607,13 @@ On some systems it's necessary to insert inline checks whenever
accessing an object via a reference. On other systems you won't need
this because null pointer accesses are caught automatically by the
processor.
+
+@item -fuse-atomic-builtins
+On some systems, gcc can generate code for built-in atomic operations.
+Use this option to force gcj to use these builtins when compiling Java
+code. Where this capability is present it should be automatically
+detected, so you won't usually need to use this option.
+
@end table
@c man end
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index e68b136db71..3bdd75a2ed8 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -145,6 +145,9 @@ extern int flag_newer;
/* When nonzero, call a library routine to do integer divisions. */
extern int flag_use_divide_subroutine;
+/* When nonzero, use atomic builtins. */
+extern int flag_use_atomic_builtins;
+
/* When nonzero, generate code for the Boehm GC. */
extern int flag_use_boehm_gc;
diff --git a/gcc/java/jvspec.c b/gcc/java/jvspec.c
index 24f2e166a64..9e57dab651c 100644
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
@@ -73,6 +73,7 @@ static const char jvgenmain_spec[] =
%<fclasspath* %<fCLASSPATH* %<fbootclasspath*\
%<fextdirs*\
%<fuse-divide-subroutine %<fno-use-divide-subroutine\
+ %<fuse-atomic-builtins %<fno-use-atomic-builtins\
%<fcheck-references %<fno-check-references\
%<ffilelist-file %<fsaw-java-file %<fsource* %<ftarget*\
%{f*} -fdollars-in-identifiers\
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 61337ccf2a9..4b462705e2b 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -53,7 +53,7 @@ static bool java_post_options (const char **);
static int java_handle_option (size_t scode, const char *arg, int value);
static void put_decl_string (const char *, int);
-static void put_decl_node (tree);
+static void put_decl_node (tree, int);
static void java_print_error_function (diagnostic_context *, const char *,
diagnostic_info *);
static int merge_init_test_initialization (void * *, void *);
@@ -354,10 +354,13 @@ put_decl_string (const char *str, int len)
decl_bufpos += len;
}
-/* Append to decl_buf a printable name for NODE. */
+/* Append to decl_buf a printable name for NODE.
+ Depending on VERBOSITY, more information about NODE
+ is printed. Read the comments of decl_printable_name in
+ langhooks.h for more. */
static void
-put_decl_node (tree node)
+put_decl_node (tree node, int verbosity)
{
int was_pointer = 0;
if (TREE_CODE (node) == POINTER_TYPE)
@@ -369,17 +372,32 @@ put_decl_node (tree node)
{
if (TREE_CODE (node) == FUNCTION_DECL)
{
+ if (verbosity == 0 && DECL_NAME (node))
+ /* We have been instructed to just print the bare name
+ of the function. */
+ {
+ put_decl_node (DECL_NAME (node), 0);
+ return;
+ }
+
/* We want to print the type the DECL belongs to. We don't do
that when we handle constructors. */
if (! DECL_CONSTRUCTOR_P (node)
- && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node))
+ && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node)
+ /* We want to print qualified DECL names only
+ if verbosity is higher than 1. */
+ && verbosity >= 1)
{
- put_decl_node (TYPE_NAME (DECL_CONTEXT (node)));
+ put_decl_node (TYPE_NAME (DECL_CONTEXT (node)),
+ verbosity);
put_decl_string (".", 1);
}
if (! DECL_CONSTRUCTOR_P (node))
- put_decl_node (DECL_NAME (node));
- if (TREE_TYPE (node) != NULL_TREE)
+ put_decl_node (DECL_NAME (node), verbosity);
+ if (TREE_TYPE (node) != NULL_TREE
+ /* We want to print function parameters only if verbosity
+ is higher than 2. */
+ && verbosity >= 2)
{
int i = 0;
tree args = TYPE_ARG_TYPES (TREE_TYPE (node));
@@ -390,19 +408,22 @@ put_decl_node (tree node)
{
if (i > 0)
put_decl_string (",", 1);
- put_decl_node (TREE_VALUE (args));
+ put_decl_node (TREE_VALUE (args), verbosity);
}
put_decl_string (")", 1);
}
}
else
- put_decl_node (DECL_NAME (node));
+ put_decl_node (DECL_NAME (node), verbosity);
}
else if (TYPE_P (node) && TYPE_NAME (node) != NULL_TREE)
{
- if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node))
+ if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node)
+ /* Print detailed array information only if verbosity is higher
+ than 2. */
+ && verbosity >= 2)
{
- put_decl_node (TYPE_ARRAY_ELEMENT (node));
+ put_decl_node (TYPE_ARRAY_ELEMENT (node), verbosity);
put_decl_string("[]", 2);
}
else if (node == promoted_byte_type_node)
@@ -416,7 +437,7 @@ put_decl_node (tree node)
else if (node == void_type_node && was_pointer)
put_decl_string ("null", 4);
else
- put_decl_node (TYPE_NAME (node));
+ put_decl_node (TYPE_NAME (node), verbosity);
}
else if (TREE_CODE (node) == IDENTIFIER_NODE)
put_decl_string (IDENTIFIER_POINTER (node), IDENTIFIER_LENGTH (node));
@@ -433,10 +454,7 @@ const char *
lang_printable_name (tree decl, int v)
{
decl_bufpos = 0;
- if (v == 0 && TREE_CODE (decl) == FUNCTION_DECL)
- put_decl_node (DECL_NAME (decl));
- else
- put_decl_node (decl);
+ put_decl_node (decl, v);
put_decl_string ("", 1);
return decl_buf;
}
diff --git a/gcc/java/lang.opt b/gcc/java/lang.opt
index 8af1bd59e46..9e9a8cb5210 100644
--- a/gcc/java/lang.opt
+++ b/gcc/java/lang.opt
@@ -192,6 +192,10 @@ fuse-divide-subroutine
Java Var(flag_use_divide_subroutine) Init(1)
Call a library routine to do integer divisions
+fuse-atomic-builtins
+Java Var(flag_use_atomic_builtins) Init(0)
+Generate code for built-in atomic operations
+
fbootstrap-classes
Java Var(flag_bootstrap_classes)
Generated should be loaded by bootstrap loader
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 852be11153c..e7a49951a67 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -2343,6 +2343,10 @@ can_convert_to_perfect_nest (struct loop *loop)
return false;
}
+
+DEF_VEC_I(source_location);
+DEF_VEC_ALLOC_I(source_location,heap);
+
/* Transform the loop nest into a perfect nest, if possible.
LOOP is the loop nest to transform into a perfect nest
LBOUNDS are the lower bounds for the loops to transform
@@ -2400,6 +2404,7 @@ perfect_nestify (struct loop *loop,
gimple stmt;
tree oldivvar, ivvar, ivvarinced;
VEC(tree,heap) *phis = NULL;
+ VEC(source_location,heap) *locations = NULL;
htab_t replacements = NULL;
/* Create the new loop. */
@@ -2412,8 +2417,11 @@ perfect_nestify (struct loop *loop,
{
phi = gsi_stmt (bsi);
VEC_reserve (tree, heap, phis, 2);
+ VEC_reserve (source_location, heap, locations, 1);
VEC_quick_push (tree, phis, PHI_RESULT (phi));
VEC_quick_push (tree, phis, PHI_ARG_DEF (phi, 0));
+ VEC_quick_push (source_location, locations,
+ gimple_phi_arg_location (phi, 0));
}
e = redirect_edge_and_branch (single_succ_edge (preheaderbb), headerbb);
@@ -2426,10 +2434,12 @@ perfect_nestify (struct loop *loop,
{
tree def;
tree phiname;
+ source_location locus;
def = VEC_pop (tree, phis);
phiname = VEC_pop (tree, phis);
+ locus = VEC_pop (source_location, locations);
phi = create_phi_node (phiname, preheaderbb);
- add_phi_arg (phi, def, single_pred_edge (preheaderbb));
+ add_phi_arg (phi, def, single_pred_edge (preheaderbb), locus);
}
flush_pending_stmts (e);
VEC_free (tree, heap, phis);
diff --git a/gcc/longlong.h b/gcc/longlong.h
index 57308bd9b79..11e70139957 100644
--- a/gcc/longlong.h
+++ b/gcc/longlong.h
@@ -982,7 +982,7 @@ UDItype __umulsidi3 (USItype, USItype);
" or r1,%0" \
: "=r" (q), "=&z" (r) \
: "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \
- : "r1", "r2", "r4", "r5", "r6", "pr"); \
+ : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \
} while (0)
#define UDIV_TIME 80
@@ -990,7 +990,7 @@ UDItype __umulsidi3 (USItype, USItype);
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("clrt;subc %5,%1; subc %4,%0" \
: "=r" (sh), "=r" (sl) \
- : "0" (ah), "1" (al), "r" (bh), "r" (bl))
+ : "0" (ah), "1" (al), "r" (bh), "r" (bl) : "t")
#endif /* __sh__ */
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 82827bf762a..087f6fc42f4 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -3013,8 +3013,8 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
{
gimple phi = create_phi_node (tmp_join, bb);
SSA_NAME_DEF_STMT (tmp_join) = phi;
- add_phi_arg (phi, tmp_then, e_then);
- add_phi_arg (phi, tmp_else, e_else);
+ add_phi_arg (phi, tmp_then, e_then, UNKNOWN_LOCATION);
+ add_phi_arg (phi, tmp_else, e_else, UNKNOWN_LOCATION);
}
val = tmp_join;
@@ -4508,6 +4508,7 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
gsi_next (&psi), ++i)
{
gimple nphi;
+ source_location locus;
phi = gsi_stmt (psi);
t = gimple_phi_result (phi);
@@ -4516,12 +4517,15 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
SSA_NAME_DEF_STMT (t) = nphi;
t = PHI_ARG_DEF_FROM_EDGE (phi, se);
+ locus = gimple_phi_arg_location_from_edge (phi, se);
+
/* A special case -- fd->loop.v is not yet computed in
iter_part_bb, we need to use v_extra instead. */
if (t == fd->loop.v)
t = v_extra;
- add_phi_arg (nphi, t, ene);
- add_phi_arg (nphi, redirect_edge_var_map_def (vm), re);
+ add_phi_arg (nphi, t, ene, locus);
+ locus = redirect_edge_var_map_location (vm);
+ add_phi_arg (nphi, redirect_edge_var_map_def (vm), re, locus);
}
gcc_assert (!gsi_end_p (psi) && i == VEC_length (edge_var_map, head));
redirect_edge_var_map_clear (re);
@@ -4536,8 +4540,10 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
/* Make phi node for trip. */
phi = create_phi_node (trip_main, iter_part_bb);
SSA_NAME_DEF_STMT (trip_main) = phi;
- add_phi_arg (phi, trip_back, single_succ_edge (trip_update_bb));
- add_phi_arg (phi, trip_init, single_succ_edge (entry_bb));
+ add_phi_arg (phi, trip_back, single_succ_edge (trip_update_bb),
+ UNKNOWN_LOCATION);
+ add_phi_arg (phi, trip_init, single_succ_edge (entry_bb),
+ UNKNOWN_LOCATION);
}
set_immediate_dominator (CDI_DOMINATORS, trip_update_bb, cont_bb);
@@ -6925,7 +6931,7 @@ struct gimple_opt_pass pass_diagnose_omp_blocks =
{
{
GIMPLE_PASS,
- "diagnose_omp_blocks", /* name */
+ "*diagnose_omp_blocks", /* name */
gate_diagnose_omp_blocks, /* gate */
diagnose_omp_structured_block_errors, /* execute */
NULL, /* sub */
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index ae1e1cb38c6..98414dae9a9 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -41,7 +41,13 @@ function opt_args(name, flags)
if (flags !~ " " name "\\(")
return ""
sub(".* " name "\\(", "", flags)
- sub("\\).*", "", flags)
+ if (flags ~ "^{")
+ {
+ sub ("^{", "", flags)
+ sub("}\\).*", "", flags)
+ }
+ else
+ sub("\\).*", "", flags)
return flags
}
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 16eb4dd3dbb..fcc1649caf3 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3278,7 +3278,8 @@ expand_unop (enum machine_mode mode, optab unoptab, rtx op0, rtx target,
if (unoptab == ffs_optab || unoptab == clz_optab || unoptab == ctz_optab
|| unoptab == popcount_optab || unoptab == parity_optab)
outmode
- = GET_MODE (hard_libcall_value (TYPE_MODE (integer_type_node)));
+ = GET_MODE (hard_libcall_value (TYPE_MODE (integer_type_node),
+ optab_libfunc (unoptab, mode)));
start_sequence ();
diff --git a/gcc/opts.c b/gcc/opts.c
index 33635dd979d..59c24b67db1 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "debug.h"
#include "plugin.h"
+#include "except.h"
/* Value of the -G xx switch, and whether it was passed or not. */
unsigned HOST_WIDE_INT g_switch_value;
@@ -1036,10 +1037,15 @@ decode_options (unsigned int argc, const char **argv)
generating unwind info. If flag_exceptions is turned on we need to
turn off the partitioning optimization. */
- if (flag_exceptions && flag_reorder_blocks_and_partition)
+ if (flag_exceptions && flag_reorder_blocks_and_partition
+ && (USING_SJLJ_EXCEPTIONS
+#ifdef TARGET_UNWIND_INFO
+ || 1
+#endif
+ ))
{
inform (input_location,
- "-freorder-blocks-and-partition does not work with exceptions");
+ "-freorder-blocks-and-partition does not work with exceptions on this architecture");
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
@@ -1048,9 +1054,15 @@ decode_options (unsigned int argc, const char **argv)
optimization. */
if (flag_unwind_tables && ! targetm.unwind_tables_default
- && flag_reorder_blocks_and_partition)
+ && flag_reorder_blocks_and_partition
+ && (USING_SJLJ_EXCEPTIONS
+#ifdef TARGET_UNWIND_INFO
+ || 1
+#endif
+ ))
{
- inform (input_location, "-freorder-blocks-and-partition does not support unwind info");
+ inform (input_location,
+ "-freorder-blocks-and-partition does not support unwind info on this architecture");
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
@@ -1061,7 +1073,12 @@ decode_options (unsigned int argc, const char **argv)
if (flag_reorder_blocks_and_partition
&& (!targetm.have_named_sections
- || (flag_unwind_tables && targetm.unwind_tables_default)))
+ || (flag_unwind_tables && targetm.unwind_tables_default
+ && (USING_SJLJ_EXCEPTIONS
+#ifdef TARGET_UNWIND_INFO
+ || 1
+#endif
+ ))))
{
inform (input_location,
"-freorder-blocks-and-partition does not work on this architecture");
diff --git a/gcc/passes.c b/gcc/passes.c
index 9ad672c477a..8d5ec3eeb7c 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -658,6 +658,11 @@ init_optimization_passes (void)
NEXT_PASS (pass_loop_distribution);
NEXT_PASS (pass_linear_transform);
NEXT_PASS (pass_graphite_transforms);
+ {
+ struct opt_pass **p = &pass_graphite_transforms.pass.sub;
+ NEXT_PASS (pass_dce_loop);
+ NEXT_PASS (pass_lim);
+ }
NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_if_conversion);
NEXT_PASS (pass_vectorize);
diff --git a/gcc/po/ChangeLog b/gcc/po/ChangeLog
index 0b8cf4f41e4..2833ec2c515 100644
--- a/gcc/po/ChangeLog
+++ b/gcc/po/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-06 Joseph Myers <joseph@codesourcery.com>
+
+ * es.po: Update.
+
2009-07-29 Joseph Myers <joseph@codesourcery.com>
* sv.po: Update.
diff --git a/gcc/po/es.po b/gcc/po/es.po
index 24b2b3dc47f..8fec564ebca 100644
--- a/gcc/po/es.po
+++ b/gcc/po/es.po
@@ -1,4 +1,4 @@
-# Mensajes en español para gcc-4.4-b20081121
+# Mensajes en español para gcc-4.4.1
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
# Cristian Othón Martínez Vera <cfuga@itam.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
@@ -7,10 +7,10 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: gcc 4.4-b20081121\n"
+"Project-Id-Version: gcc 4.4.1\n"
"Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n"
"POT-Creation-Date: 2009-07-15 13:37+0200\n"
-"PO-Revision-Date: 2009-03-03 14:52-0600\n"
+"PO-Revision-Date: 2009-08-02 22:42-0500\n"
"Last-Translator: Cristian Othón Martínez Vera <cfuga@itam.mx>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
@@ -873,9 +873,8 @@ msgid " --target-help Display target specific command line options\n
msgstr " --target-help Muestra opciones de línea de comando específicas del objetivo\n"
#: gcc.c:3231
-#, fuzzy
msgid " --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]\n"
-msgstr " --help={target|optimizers|warnings|undocumented|params}[,{[^]joined|[^]separate}]\n"
+msgstr " --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,...]\n"
#: gcc.c:3232
msgid " Display specific types of command line options\n"
@@ -886,9 +885,8 @@ msgid " (Use '-v --help' to display command line options of sub-processes)\n"
msgstr " (Use '-v --help' para mostrar las opciones de línea de comando de los subprocesos)\n"
#: gcc.c:3235
-#, fuzzy
msgid " --version Display compiler version information\n"
-msgstr " --help Muestra esta información\n"
+msgstr " --version Muestra la información de versión del compilador\n"
#: gcc.c:3236
msgid " -dumpspecs Display all of the built in spec strings\n"
@@ -1070,9 +1068,9 @@ msgid "couldn't run '%s': %s"
msgstr "no se puede ejecutar '%s': %s"
#: gcc.c:3439
-#, fuzzy, c-format
+#, c-format
msgid "couldn't run '%s': %s: %s"
-msgstr "no se puede ejecutar '%s': %s"
+msgstr "no se puede ejecutar '%s': %s: %s"
#. translate_options () has turned --version into -fversion.
#: gcc.c:3643
@@ -1890,14 +1888,12 @@ msgid "The following options are not documented"
msgstr "Las siguientes opciones no están documentadas"
#: opts.c:1385
-#, fuzzy
msgid "The following options take separate arguments"
-msgstr "Las siguientes opciones no están documentadas"
+msgstr "Las siguientes opciones toman argumentos separados"
#: opts.c:1387
-#, fuzzy
msgid "The following options take joined arguments"
-msgstr "Las siguientes opciones no están documentadas"
+msgstr "Las siguientes opciones toman argumentos conjuntos"
#: opts.c:1398
msgid "The following options are language-related"
@@ -2853,7 +2849,7 @@ msgstr "número de ciclos máximo para el RA regional"
#: params.def:755
msgid "max size of conflict table in MB"
-msgstr ""
+msgstr "tamaño máximo de la tabla de conflictos en MB"
#: params.def:763
msgid "The maximum ratio between array size and switch branches for a switch conversion to take place"
@@ -2861,7 +2857,7 @@ msgstr "La tasa máxima entre el tamaño de la matriz y las ramificaciones switch
#: params.def:771
msgid "max basic blocks number in loop for loop invariant motion"
-msgstr ""
+msgstr "número máximo de bloques básicos en el ciclo para el movimiento invariante de ciclo"
#: config/alpha/alpha.c:5039
#, c-format
@@ -3309,19 +3305,19 @@ msgid "invalid UNSPEC as operand"
msgstr "UNSPEC inválido como operando"
#: config/i386/i386.c:11065 config/i386/i386.c:11104 config/i386/i386.c:11278
-#, fuzzy, c-format
+#, c-format
msgid "operand is not a condition code, invalid operand code 'D'"
-msgstr "el operando no es una constante ni un código de condición, código de operando 'c' inválido"
+msgstr "el operando no es un código de condición, código de operando 'D' inválido"
#: config/i386/i386.c:11129
-#, fuzzy, c-format
+#, c-format
msgid "operand is neither a constant nor a condition code, invalid operand code 'C'"
-msgstr "el operando no es una constante ni un código de condición, código de operando 'c' inválido"
+msgstr "el operando no es una constante ni un código de condición, código de operando 'C' inválido"
#: config/i386/i386.c:11139
-#, fuzzy, c-format
+#, c-format
msgid "operand is neither a constant nor a condition code, invalid operand code 'F'"
-msgstr "el operando no es una constante ni un código de condición, código de operando 'c' inválido"
+msgstr "el operando no es una constante ni un código de condición, código de operando 'F' inválido"
#: config/i386/i386.c:11157
#, c-format
@@ -3329,9 +3325,9 @@ msgid "operand is neither a constant nor a condition code, invalid operand code
msgstr "el operando no es una constante ni un código de condición, código de operando 'c' inválido"
#: config/i386/i386.c:11167
-#, fuzzy, c-format
+#, c-format
msgid "operand is neither a constant nor a condition code, invalid operand code 'f'"
-msgstr "el operando no es una constante ni un código de condición, código de operando 'c' inválido"
+msgstr "el operando no es una constante ni un código de condición, código de operando 'f' inválido"
#: config/i386/i386.c:11292
#, c-format
@@ -4091,9 +4087,9 @@ msgid "'dim' argument of '%s' intrinsic at %L is not a valid dimension index"
msgstr "el argumento 'dim' del intrínseco '%s' en %L no es un índice de dimensión válido"
#: fortran/check.c:431
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Unequal character lengths (%ld/%ld) in %s at %L"
-msgstr "Longitudes de caracteres desiguales (%ld y %ld) en el intrínseco %s en %L"
+msgstr "Longitudes de caracteres desiguales (%ld/%ld) en %s en %L"
#: fortran/check.c:537 fortran/check.c:2039 fortran/check.c:2054
#, no-c-format
@@ -4219,9 +4215,9 @@ msgid "'a1' argument of '%s' intrinsic at %L must be INTEGER, REAL or CHARACTER"
msgstr "El argumento 'a1' del intrínseco '%s' en %L debe ser INTEGER, REAL o CHARACTER"
#: fortran/check.c:1821
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Argument types of '%s' intrinsic at %L must match (%s/%s)"
-msgstr "El argumento 'a%d' del intrínseco '%s' en %L debe ser %s(%d)"
+msgstr "Los tipos de argumento del intrínseco '%s' en %L deben coincidir (%s/%s)"
#: fortran/check.c:1835
#, no-c-format
@@ -4314,9 +4310,9 @@ msgid "Different shape in dimension %d for MASK and FIELD arguments of UNPACK at
msgstr "Formas diferentes en la dimensión %d para los argumentos MASK y FIELD de UNPACK en %L"
#: fortran/check.c:3190 fortran/check.c:3222
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Size of '%s' argument of '%s' intrinsic at %L too small (%i/%i)"
-msgstr "El argumento '%s' del intrínseco '%s' en %L debe ser %s"
+msgstr "El tamaño del argumento '%s' del intrínseco '%s' en %L es demasiado pequeño (%i/%i)"
#: fortran/check.c:3230
#, no-c-format
@@ -4649,9 +4645,9 @@ msgid "Kind %d not supported for type %s at %C"
msgstr "No se admite el género %d para el tipo %s en %C"
#: fortran/decl.c:1992
-#, fuzzy, no-c-format
+#, no-c-format
msgid "C kind type parameter is for type %s but type at %L is %s"
-msgstr "El parámetro de género C es para el tipo %s, pero el símbolo '%s' en %L es de tipo %s"
+msgstr "El parámetro de tipo de género C es para el tipo %s, pero el tipo en %L es %s"
#: fortran/decl.c:2001
#, no-c-format
@@ -5823,14 +5819,14 @@ msgid "Bad pointer object in PURE procedure at %L"
msgstr "Objeto puntero erróneo en el procedimiento PURE en %L"
#: fortran/expr.c:3134
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Invalid procedure pointer assignment at %L"
-msgstr "Rangos diferentes en la asignación de puntero en %L"
+msgstr "Asignación de puntero de procedimiento inválida en %L"
#: fortran/expr.c:3140
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Abstract interface '%s' is invalid in procedure pointer assignment at %L"
-msgstr "Parámetros de tipo de género diferentes en la asignación de puntero en %L"
+msgstr "La interfaz abstracta '%s' es inválida en la asignación de puntero de procedimiento en %L"
#: fortran/expr.c:3159
#, no-c-format
@@ -6385,9 +6381,8 @@ msgid "Fortran 2008: 'G0' in format at %C"
msgstr "Fortran 2008: 'G0' en un formato en %C"
#: fortran/io.c:745
-#, fuzzy
msgid "E specifier not allowed with g0 descriptor"
-msgstr "Se esperaba un descriptor de edición P"
+msgstr "No se permite el especificador E con el descriptor g0"
#: fortran/io.c:759 fortran/io.c:761 fortran/io.c:822 fortran/io.c:824
#, no-c-format
@@ -7317,19 +7312,19 @@ msgid "Error writing module file '%s' for writing: %s"
msgstr "Error al escribir al fichero de módulo '%s' para escritura: %s"
#: fortran/module.c:4876
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Can't delete module file '%s': %s"
-msgstr "%s: no se puede borrar el fichero '%s': %s\n"
+msgstr "No se puede borrar el fichero de módulo '%s': %s"
#: fortran/module.c:4879
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Can't rename module file '%s' to '%s': %s"
-msgstr "%s: aviso: no se puede renombrar el fichero '%s' a '%s': %s\n"
+msgstr "No se puede renombrar el fichero de módulo '%s' a '%s': %s"
#: fortran/module.c:4885
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Can't delete temporary module file '%s': %s"
-msgstr "%s: no se puede borrar el fichero de información auxiliar '%s': %s\n"
+msgstr "No se puede borrar el fichero de módulo temporal '%s': %s"
#: fortran/module.c:4905 fortran/module.c:4987
#, no-c-format
@@ -7408,12 +7403,12 @@ msgstr "El fichero '%s' abierto en %C no es un fichero de módulo GFORTRAN"
#: fortran/module.c:5252
#, no-c-format
msgid "Parse error when checking module version for file '%s' opened at %C"
-msgstr ""
+msgstr "Error de decodificación al revisar la versión de módulo para el fichero '%s' abierto en %C"
#: fortran/module.c:5257
#, no-c-format
msgid "Wrong module version '%s' (expected '"
-msgstr ""
+msgstr "Versión de módulo '%s' errónea (se esperaba '"
# No se puede hacer el mismo juego de palabras que en inglés. cfuga
#: fortran/module.c:5270
@@ -8604,7 +8599,7 @@ msgstr "El procedimiento GENERIC '%s' no se permite como un argumento actual en
#: fortran/resolve.c:1163
#, no-c-format
msgid "Non-RECURSIVE procedure '%s' at %L is possibly calling itself recursively. Declare it RECURSIVE or use -frecursive"
-msgstr ""
+msgstr "El procedimiento que no es RECURSIVE '%s' en %L posiblemente se está llamando a sí mismo recursivamente. Declárelo RECURSIVE o utilice -frecursive"
#: fortran/resolve.c:1196 fortran/resolve.c:6023 fortran/resolve.c:6778
#, no-c-format
@@ -8791,14 +8786,14 @@ msgid "Function reference to '%s' at %L is to a non-PURE procedure within a PURE
msgstr "La referencia de función a '%s' en %L apunta a un procedimiento que no es PURE dentro de un procedimiento PURE"
#: fortran/resolve.c:2493
-#, fuzzy, no-c-format
+#, no-c-format
msgid "ENTRY '%s' at %L cannot be called recursively, as function '%s' is not RECURSIVE"
-msgstr "La llamada a la ENTRY '%s' en %L es recursiva, pero la función '%s' no se declaró como RECURSIVE"
+msgstr "ENTRY '%s' en %L no se puede llamar recursivamente, porque la función '%s' no es RECURSIVE"
#: fortran/resolve.c:2497
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Function '%s' at %L cannot be called recursively, as it is not RECURSIVE"
-msgstr "La función '%s' en %L no se puede llamar a sí misma, porque no es RECURSIVE"
+msgstr "La función '%s' en %L no se puede llamar recursivamente, porque no es RECURSIVE"
#: fortran/resolve.c:2544
#, no-c-format
@@ -8846,14 +8841,14 @@ msgid "'%s' at %L has a type, which is not consistent with the CALL at %L"
msgstr "'%s' en %L tiene un tipo, el cual no es consistente con CALL en %L"
#: fortran/resolve.c:2957
-#, fuzzy, no-c-format
+#, no-c-format
msgid "ENTRY '%s' at %L cannot be called recursively, as subroutine '%s' is not RECURSIVE"
-msgstr "La llamada a ENTRY '%s' en %L es recursiva, pero la subrutina '%s' no se declaró como RECURSIVE"
+msgstr "ENTRY '%s' en %L no se puede llamar recursivamente, porque la subrutina '%s' no es RECURSIVE"
#: fortran/resolve.c:2961
-#, fuzzy, no-c-format
+#, no-c-format
msgid "SUBROUTINE '%s' at %L cannot be called recursively, as it is not RECURSIVE"
-msgstr "La SUBROUTINE '%s' en %L no se puede llamar a sí misma, porque no es RECURSIVE"
+msgstr "SUBROUTINE '%s' en %L no se puede llamar recursivamente, porque no es RECURSIVE"
#: fortran/resolve.c:3035
#, no-c-format
@@ -9784,9 +9779,9 @@ msgid "Character length of component '%s' needs to be a constant specification e
msgstr "La longitud de carácter del componente '%s' necesita ser una expresión de especificación constante en %L"
#: fortran/resolve.c:8735
-#, fuzzy, no-c-format
+#, no-c-format
msgid "Fortran 2003: the component '%s' is a PRIVATE type and cannot be a component of '%s', which is PUBLIC at %L"
-msgstr "El componente '%s' es un tipo PRIVATE y no puede ser un componente de '%s' el cual es PUBLIC en %L"
+msgstr "Fortran 2003: el componente '%s' es un tipo PRIVATE y no puede ser un componente de '%s' el cual es PUBLIC en %L"
#: fortran/resolve.c:8746
#, no-c-format
@@ -9944,9 +9939,9 @@ msgid "Threadprivate at %L isn't SAVEd"
msgstr "No se guarda (SAVE) el threadprivate en %L"
#: fortran/resolve.c:9448
-#, fuzzy, no-c-format
+#, no-c-format
msgid "non-constant DATA value at %L"
-msgstr "matriz no constante en la declaración DATA %L"
+msgstr "valor DATA que no es constante en %L"
#: fortran/resolve.c:9488
#, no-c-format
@@ -11613,7 +11608,7 @@ msgstr "Genera código little-endian"
#: config/mcore/mcore.opt:56 config/fr30/fr30.opt:27
msgid "Assume that run-time support has been provided, so omit -lsim from the linker command line"
-msgstr ""
+msgstr "Asume que se provee el soporte para tiempo de ejecución, así que omite -lsim en la línea de órdenes del enlazador"
#: config/mcore/mcore.opt:60
msgid "Use arbitrary sized immediates in bit operations"
@@ -12177,9 +12172,8 @@ msgid "Allow branches to be packed with other instructions"
msgstr "Permite que las ramificaciones se empaquen con otras instrucciones"
#: config/picochip/picochip.opt:23
-#, fuzzy
msgid "Specify which type of AE to target. This option sets the mul-type and byte-access."
-msgstr "Especifica a qué tipo de AE se apunta. Esta opción establece el tipo mul"
+msgstr "Especifica a qué tipo de AE se apunta. Esta opción establece el tipo muly el acceso a byte."
#: config/picochip/picochip.opt:27
msgid "Specify which type of multiplication to use. Can be mem, mac or none."
@@ -12194,9 +12188,8 @@ msgid "Enable debug output to be generated."
msgstr "Activa que la salida de depuración se genere."
#: config/picochip/picochip.opt:39
-#, fuzzy
msgid "Allow a symbol value to be used as an immediate value in an instruction."
-msgstr "Permite que un valor de símbolo se use como un valor inmediato en an"
+msgstr "Permite que un valor de símbolo se use como un valor inmediato en una instrucción."
#: config/picochip/picochip.opt:43
msgid "Generate warnings when inefficient code is known to be generated."
@@ -12970,9 +12963,8 @@ msgid "Generate load/store with update instructions"
msgstr "Genera load/store con instrucciones de actualización"
#: config/rs6000/rs6000.opt:124
-#, fuzzy
msgid "Avoid generation of indexed load/store instructions when possible"
-msgstr "No genera múltiples instrucciones load/store"
+msgstr "Evita la generación de instrucciones indizadas load/store cuando sea posible"
#: config/rs6000/rs6000.opt:128
msgid "Do not generate fused multiply/add instructions"
@@ -14631,7 +14623,7 @@ msgstr "Construye para SDRAM"
#: config/bfin/bfin.opt:101
msgid "Assume ICPLBs are enabled at runtime."
-msgstr ""
+msgstr "Asume que los ICPLBs están activos en tiempo de ejecución."
#: java/lang.opt:69
msgid "Warn if deprecated empty statements are found"
@@ -15279,13 +15271,12 @@ msgid "Perform structure layout optimizations based"
msgstr "Realiza la ubicación de estructuras basada en optimizaciones"
#: common.opt:680
-#, fuzzy
msgid "-fira-algorithm=[CB|priority] Set the used IRA algorithm"
-msgstr "-fira-algorithm=[regional|CB|mixed] Establece el algoritmo IRA a usar"
+msgstr "-fira-algorithm=[CB|priority] Establece el algoritmo IRA a usar"
#: common.opt:684
msgid "-fira-region=[one|all|mixed] Set regions for IRA"
-msgstr ""
+msgstr "-fira-region=[one|all|mixed] Establece las regiones para IRA"
#: common.opt:688
msgid "Do optimistic coalescing."
@@ -16278,7 +16269,7 @@ msgstr "Avisa sobre sobreescritura de inicializadores sin efectos secundarios"
#: c.opt:373
msgid "Warn about packed bit-fields whose offset changed in GCC 4.4"
-msgstr ""
+msgstr "Avisa sobre campos de bits packed cuyo desplazamiento cambió en GCC 4.4"
#: c.opt:377
msgid "Warn about possibly missing parentheses"
@@ -16545,9 +16536,8 @@ msgid "Enable Objective-C setjmp exception handling runtime"
msgstr "Activa el manejo de excepciones setjmp en tiempo de ejecución de Objective-C"
#: c.opt:694
-#, fuzzy
msgid "Enable OpenMP (implies -frecursive in Fortran)"
-msgstr "Activa OpenMP (también establece frecursive)"
+msgstr "Activa OpenMP (implica -frecursive en Fortran)"
#: c.opt:698
msgid "Recognize C++ keywords like \"compl\" and \"xor\""
@@ -18582,9 +18572,9 @@ msgstr "ISO C90 no admite miembros de matriz flexibles"
#. C99 6.7.5.2p4
#: c-decl.c:4431
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%<[*]%> not in a declaration"
-msgstr "no se permite %<[*]%> fuera de una declaración"
+msgstr "%<[*]%> fuera de una declaración"
#: c-decl.c:4444
#, gcc-internal-format
@@ -22968,9 +22958,9 @@ msgid "-freorder-blocks-and-partition does not work on this architecture"
msgstr "-freorder-blocks-and-partition no funciona en esta arquitectura"
#: opts.c:1081
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "-fira-algorithm=CB does not work on this architecture"
-msgstr "-fira no funciona en esta arquitectura"
+msgstr "-fira-algorithm=CB no funciona en esta arquitectura"
#: opts.c:1390
#, gcc-internal-format
@@ -23008,9 +22998,9 @@ msgid "unknown ira algorithm \"%s\""
msgstr "algoritmo ira \"%s\" desconocido"
#: opts.c:1980
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "unknown ira region \"%s\""
-msgstr "algoritmo ira \"%s\" desconocido"
+msgstr "región ira \"%s\" desconocido"
#: opts.c:2083
#, gcc-internal-format
@@ -23430,7 +23420,7 @@ msgstr "estructura de relleno para alinear %q+D"
#: stor-layout.c:969
#, gcc-internal-format
msgid "Offset of packed bit-field %qD has changed in GCC 4.4"
-msgstr ""
+msgstr "El desplazamiento del campo de bits packed %qD cambió en GCC 4.4"
#: stor-layout.c:1273
#, gcc-internal-format
@@ -23663,9 +23653,9 @@ msgid "SSA name in freelist but still referenced"
msgstr "hay un nombre SSA en la lista libre, pero aún está referenciado"
#: tree-cfg.c:2829
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "Indirect reference's operand is not a register or a constant."
-msgstr "%s: El tercer operando fuente no es una constante"
+msgstr "La referencia indirecta del operando no es un registro o una constante."
#: tree-cfg.c:2838
#, gcc-internal-format
@@ -23675,7 +23665,7 @@ msgstr "ASSERT_EXPR con una condición que es siempre falsa"
#: tree-cfg.c:2844
#, gcc-internal-format
msgid "MODIFY_EXPR not expected while having tuples."
-msgstr ""
+msgstr "no se espera MODIFY_EXPR mientras se tienen tuplas."
#: tree-cfg.c:2865
#, gcc-internal-format
@@ -24275,21 +24265,19 @@ msgid "unimplemented functionality"
msgstr "funcionalidad sin implementar"
#: tree-ssa-structalias.c:4791
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "initialized from %qE"
-msgstr "const %qD sin inicializar"
+msgstr "inicializado desde %qE"
#: tree-ssa-structalias.c:4795
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "initialized from here"
-msgstr "llamado desde aquí"
+msgstr "inicializado desde aquí"
-# No existe una traducción para type-punning. Gracias a Jose María Pérez
-# por el comentario. cfuga
#: tree-ssa-structalias.c:4844
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "dereferencing pointer %qD does break strict-aliasing rules"
-msgstr "la dereferencia del puntero %D \"type-punned\" romperá las reglas de alias estricto"
+msgstr "la dereferencia del puntero %qD rompe las reglas de alias estricto"
#: tree-ssa.c:252
#, gcc-internal-format
@@ -25257,7 +25245,7 @@ msgstr "no se pueden codificar las Rutinas de Servicios de Interrupción en el mo
#: config/arm/arm.c:19618
#, gcc-internal-format
msgid "the mangling of %<va_list%> has changed in GCC 4.4"
-msgstr ""
+msgstr "la decodificación de %<va_list%> cambió en GCC 4.4"
#: config/arm/pe.c:158 config/mcore/mcore.c:2900
#, gcc-internal-format
@@ -25272,17 +25260,17 @@ msgstr "la variable estática %q+D se marcó como dllimport"
#: config/avr/avr.c:399
#, gcc-internal-format
msgid "the -mno-tablejump switch is deprecated"
-msgstr ""
+msgstr "la opción -mno-tablejump es obsoleta"
#: config/avr/avr.c:400
#, gcc-internal-format
msgid "GCC 4.4 is the last release with this switch"
-msgstr ""
+msgstr "GCC 4.4 es la última versión con esta opción"
#: config/avr/avr.c:401
#, gcc-internal-format
msgid "use the -fno-jump-tables switch instead"
-msgstr ""
+msgstr "use la opción -fno-jump-tables en su lugar"
#: config/avr/avr.c:4626
#, gcc-internal-format
@@ -25689,9 +25677,9 @@ msgid "%sregparm=%d%s is not between 0 and %d"
msgstr "%sregparm=%d%s no está entre 0 y %d"
#: config/i386/i386.c:2918
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%salign-loops%s is obsolete, use -falign-loops%s"
-msgstr "%salign-loops%s es obsoleto, use %salign-loops%s"
+msgstr "%salign-loops%s es obsoleto, use -falign-loops%s"
#: config/i386/i386.c:2924 config/i386/i386.c:2939 config/i386/i386.c:2954
#, gcc-internal-format
@@ -25699,14 +25687,14 @@ msgid "%salign-loops=%d%s is not between 0 and %d"
msgstr "%salign-loops=%d%s no está entre 0 y %d"
#: config/i386/i386.c:2933
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%salign-jumps%s is obsolete, use -falign-jumps%s"
-msgstr "%salign-jumps%s es obsoleto, use %salign-jumps%s"
+msgstr "%salign-jumps%s es obsoleto, use -falign-jumps%s"
#: config/i386/i386.c:2948
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%salign-functions%s is obsolete, use -falign-functions%s"
-msgstr "%salign-functions%s es obsoleto, use %salign-functions%s"
+msgstr "%salign-functions%s es obsoleto, use -falign-functions%s"
#: config/i386/i386.c:2983
#, gcc-internal-format
@@ -25841,7 +25829,7 @@ msgstr "Se llama a %qT con el atributo sseregparm sin activar SSE/SSE2"
#: config/i386/i386.c:4722
#, gcc-internal-format
msgid "ms_abi attribute requires -maccumulate-outgoing-args or subtarget optimization implying it"
-msgstr ""
+msgstr "el atributo ms_abi requiere -maccumulate-outgoing-args o que la optimización de subobjetivo lo implique"
#: config/i386/i386.c:4840
#, gcc-internal-format
@@ -25851,17 +25839,17 @@ msgstr "el argumento de vector AVX sin AVX activado cambia la ABI"
#: config/i386/i386.c:5020
#, gcc-internal-format
msgid "The ABI of passing struct with a flexible array member has changed in GCC 4.4"
-msgstr ""
+msgstr "La ABI para pasar un struct con un miembro de matriz flexible cambió en GCC 4.4"
#: config/i386/i386.c:5139
#, gcc-internal-format
msgid "The ABI of passing union with long double has changed in GCC 4.4"
-msgstr ""
+msgstr "La ABI para pasar un union con long double cambió en GCC 4.4"
#: config/i386/i386.c:5254
#, gcc-internal-format
msgid "The ABI of passing structure with complex float member has changed in GCC 4.4"
-msgstr ""
+msgstr "La ABI para pasar una estructura con un miembro de coma flotante compleja cambió en GCC 4.4"
#: config/i386/i386.c:5399
#, gcc-internal-format
@@ -26071,14 +26059,14 @@ msgid "bad value %<%s%> for -mtls-size= switch"
msgstr "valor erróneo %<%s%> para el interruptor -mtls-size="
#: config/ia64/ia64.c:5254
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "value %<%s%> for -mtune= switch is deprecated"
-msgstr "valor erróneo %<%s%> para el interruptor -mtune="
+msgstr "el valor %<%s%> para el interruptor -mtune= es obsoleto"
#: config/ia64/ia64.c:5256
#, gcc-internal-format
msgid "GCC 4.4 is the last release with Itanium1 tuning support"
-msgstr ""
+msgstr "GCC 4.4 es la última versión que admite ajustes para Itanium1"
#: config/ia64/ia64.c:5263
#, gcc-internal-format
@@ -27611,9 +27599,9 @@ msgid "converting %<false%> to pointer type for argument %P of %qD"
msgstr "se convierte %<false%> a tipo puntero para el argumento %P de %qD"
#: cp/call.c:4573
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "too many braces around initializer for %qT"
-msgstr "faltan llaves alrededor del inicializador para %qT"
+msgstr "demasiadas llaves alrededor del inicializador para %qT"
#: cp/call.c:4595 cp/cvt.c:217
#, gcc-internal-format
@@ -27638,7 +27626,7 @@ msgstr "no se puede unir el campo de bits %qE a %qT"
#: cp/call.c:4798 cp/call.c:4816
#, gcc-internal-format
msgid "cannot bind packed field %qE to %qT"
-msgstr "no se unir el campo empacado %qE a %qT"
+msgstr "no se unir el campo packed %qE a %qT"
#: cp/call.c:4801
#, gcc-internal-format
@@ -27732,19 +27720,19 @@ msgid " because conversion sequence for the argument is better"
msgstr " porque la secuencia de conversión para el argumento es mejor"
#: cp/call.c:6899
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "default argument mismatch in overload resolution"
-msgstr "se especificó un argumento por defecto en la especialización explícita"
+msgstr "no coincide el argumento por defecto en la resolución de sobrecarga"
#: cp/call.c:6902
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid " candidate 1: %q+#F"
-msgstr "el candidato es: %+#D"
+msgstr " candidato 1: %q+#F"
#: cp/call.c:6904
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid " candidate 2: %q+#F"
-msgstr "el candidato es: %+#D"
+msgstr " candidato 2: %q+#F"
#: cp/call.c:6942
#, gcc-internal-format
@@ -28742,9 +28730,9 @@ msgid "cannot initialize %qT from %qT"
msgstr "no se pueden inicializar %qT desde %qT"
#: cp/decl.c:4437
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "name used in a GNU-style designated initializer for an array"
-msgstr "el nombre %qD se utiliza en un inicializador designado en estilo GNU para una matriz"
+msgstr "se usó un nombre en un inicializador designado de estilo GNU para una matriz"
#: cp/decl.c:4442
#, gcc-internal-format
@@ -29414,9 +29402,9 @@ msgid "cannot declare pointer to %q#T member"
msgstr "no se puede declarar el puntero al miembro %q#T"
#: cp/decl.c:8500
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "cannot declare %s to qualified function type %qT"
-msgstr "no se puede declarar el campo de bits %qD con un tipo de función"
+msgstr "no se puede declarar %s para el tipo de función calificado %qT"
#: cp/decl.c:8537
#, gcc-internal-format
@@ -29664,9 +29652,9 @@ msgid "%<inline%> specifier invalid for function %qs declared out of global scop
msgstr "el especificador %<inline%> es inválido para la función %qs declarada fuera del ámbito global"
#: cp/decl.c:9365
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%q#T is not a class or a namespace"
-msgstr "%qT no es una clase o un espacio de nombres"
+msgstr "%q#T no es una clase o un espacio de nombres"
#: cp/decl.c:9373
#, gcc-internal-format
@@ -29674,9 +29662,9 @@ msgid "virtual non-class function %qs"
msgstr "función virtual %qs que no es clase"
#: cp/decl.c:9380
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%qs defined in a non-class scope"
-msgstr "No se definió la variable %qs en la clase %qs"
+msgstr "se definió %qs en un ámbito que no es una clase"
#: cp/decl.c:9413
#, gcc-internal-format
@@ -30016,9 +30004,9 @@ msgid "%<operator=%> should return a reference to %<*this%>"
msgstr "%<operator=%> debe devolver una referencia a %<*this%>"
#: cp/decl.c:11874
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "invalid function declaration"
-msgstr "declaración de la función miembro inválida"
+msgstr "declaración de función inválida"
#: cp/decl.c:11958
#, gcc-internal-format
@@ -30091,9 +30079,9 @@ msgid "Java method %qD has non-Java parameter type %qT"
msgstr "el método Java %qD tiene un tipo de parámetro %qT que no es de Java"
#: cp/decl2.c:579
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "template parameter lists provided don't match the template parameters of %qD"
-msgstr "los parámetros de la plantilla no coinciden con la plantilla"
+msgstr "las listas de parámetro de plantilla proporcionados no coinciden con los parámetros de plantilla de %qD"
#: cp/decl2.c:647
#, gcc-internal-format
@@ -30409,9 +30397,9 @@ msgid "%J%qD should be initialized in the member initialization list"
msgstr "%J%qD se debe inicializar en la lista de inicialización de miembros"
#: cp/init.c:454
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%Jvalue-initialization of %q#D, which has reference type"
-msgstr "%Jla inicialización por defecto de %q#D, el cual tiene el tipo de referencia"
+msgstr "%Jvalor-inicialización de %q#D, el cual tiene el tipo de referencia"
#. TYPE_NEEDS_CONSTRUCTING can be set just because we have a
#. vtable; still give this diagnostic.
@@ -30571,9 +30559,9 @@ msgid "request for member %qD is ambiguous"
msgstr "la petición para el miembro %qD es ambigua"
#: cp/init.c:2136
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "non-constant array size in new, unable to verify length of initializer-list"
-msgstr "índice de matriz no constante en el inicializador"
+msgstr "tamaño de matriz no constante en new, no se puede verificar la longitud de la lista del inicializador"
#: cp/init.c:2145
#, gcc-internal-format
@@ -30698,17 +30686,17 @@ msgstr "se decodifica typeof, utilice decltype en su lugar"
#: cp/mangle.c:1903
#, gcc-internal-format
msgid "mangling unknown fixed point type"
-msgstr ""
+msgstr "se decodifica el tipo de coma fija desconocido"
#: cp/mangle.c:2332
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "mangling %C"
-msgstr "aviso: "
+msgstr "decodificando %C"
#: cp/mangle.c:2387
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "mangling new-expression"
-msgstr "falta la expresión de incremento"
+msgstr "decodificando la expresión new"
#: cp/mangle.c:2407
#, gcc-internal-format
@@ -31145,9 +31133,9 @@ msgid "%Hunsupported non-standard concatenation of string literals"
msgstr "%Hno se admite la concatenació no estándar de literales de cadena"
#: cp/parser.c:3154
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%Hfixed-point types not supported in C++"
-msgstr "no se admiten tipos de coma fija para este objetivo"
+msgstr "%Hno se admiten tipos de coma fija en C++"
#: cp/parser.c:3235
#, gcc-internal-format
@@ -31395,9 +31383,9 @@ msgid "use %<%T::template %D%> to indicate that it is a template"
msgstr "utilice %<%T::template %D%> para indicar que es una plantilla"
#: cp/parser.c:10483
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%Hexpected parameter pack before %<...%>"
-msgstr "se esperaban especificadores de declaración o %<...%>"
+msgstr "%Hse esperaba el parámetro pack antes de %<...%>"
#: cp/parser.c:10893
#, gcc-internal-format
@@ -32168,9 +32156,9 @@ msgid "%qE is not a valid template argument for type %qT because object %qD has
msgstr "%qE no es un argumento válido de plantilla para el tipo %qT porque el objeto %qD no tiene enlazado externo"
#: cp/pt.c:4578
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "%qE is not a valid template argument for type %qT"
-msgstr "%qE no es un argumento de plantilla válido para el tipo %qT porque es un puntero"
+msgstr "%qE no es un argumento de plantilla válido para el tipo %qT"
#: cp/pt.c:4579
#, gcc-internal-format
@@ -32240,9 +32228,9 @@ msgstr " se esperaba una plantilla de tipo %qD, se obtuvo %qD"
#. Not sure if this is reachable, but it doesn't hurt
#. to be robust.
#: cp/pt.c:5091
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "type mismatch in nontype parameter pack"
-msgstr "los tipos de datos no coinciden en la referencia a componente"
+msgstr "los tipos no coinciden en el parámetro pack que no es de tipo"
#: cp/pt.c:5113
#, gcc-internal-format
@@ -33149,9 +33137,9 @@ msgid "invalid use of %qD"
msgstr "uso inválido de %qD"
#: cp/typeck.c:2150
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "object type %qT does not match destructor name ~%qT"
-msgstr "el tipo calificado %qT no coincide con el nombre del destructor ~%qT"
+msgstr "el tipo de objeto %qT no coincide con el nombre del destructor ~%qT"
#: cp/typeck.c:2158
#, gcc-internal-format
@@ -33837,9 +33825,9 @@ msgid "pointer to member type %qT incompatible with object type %qT"
msgstr "el tipo de puntero a miembro %qT es incompatible con el tipo objeto %qT"
#: cp/typeck2.c:1450
-#, fuzzy, gcc-internal-format
+#, gcc-internal-format
msgid "invalid value-initialization of reference types"
-msgstr "inicialización por valor de la referencia"
+msgstr "inicialización por valor inválida de los tipos de referencia"
#: cp/typeck2.c:1637
#, gcc-internal-format
diff --git a/gcc/predict.c b/gcc/predict.c
index e3b4b83b863..6353fb96a56 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -916,8 +916,6 @@ predict_loops (void)
loop_iterator li;
struct loop *loop;
- scev_initialize ();
-
/* Try to predict out blocks in a loop that are not part of a
natural loop. */
FOR_EACH_LOOP (li, loop, 0)
@@ -1040,8 +1038,6 @@ predict_loops (void)
/* Free basic blocks from get_loop_body. */
free (bbs);
}
-
- scev_finalize ();
}
/* Attempt to predict probabilities of BB outgoing edges using local
@@ -1608,16 +1604,96 @@ assert_is_empty (const void *key ATTRIBUTE_UNUSED, void **value,
}
#endif
-/* Predict branch probabilities and estimate profile of the tree CFG. */
-static unsigned int
+/* Predict branch probabilities and estimate profile for basic block BB. */
+
+static void
+tree_estimate_probability_bb (basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+ gimple last;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ {
+ /* Predict early returns to be probable, as we've already taken
+ care for error returns and other cases are often used for
+ fast paths through function.
+
+ Since we've already removed the return statements, we are
+ looking for CFG like:
+
+ if (conditional)
+ {
+ ..
+ goto return_block
+ }
+ some other blocks
+ return_block:
+ return_stmt. */
+ if (e->dest != bb->next_bb
+ && e->dest != EXIT_BLOCK_PTR
+ && single_succ_p (e->dest)
+ && single_succ_edge (e->dest)->dest == EXIT_BLOCK_PTR
+ && (last = last_stmt (e->dest)) != NULL
+ && gimple_code (last) == GIMPLE_RETURN)
+ {
+ edge e1;
+ edge_iterator ei1;
+
+ if (single_succ_p (bb))
+ {
+ FOR_EACH_EDGE (e1, ei1, bb->preds)
+ if (!predicted_by_p (e1->src, PRED_NULL_RETURN)
+ && !predicted_by_p (e1->src, PRED_CONST_RETURN)
+ && !predicted_by_p (e1->src, PRED_NEGATIVE_RETURN))
+ predict_edge_def (e1, PRED_TREE_EARLY_RETURN, NOT_TAKEN);
+ }
+ else
+ if (!predicted_by_p (e->src, PRED_NULL_RETURN)
+ && !predicted_by_p (e->src, PRED_CONST_RETURN)
+ && !predicted_by_p (e->src, PRED_NEGATIVE_RETURN))
+ predict_edge_def (e, PRED_TREE_EARLY_RETURN, NOT_TAKEN);
+ }
+
+ /* Look for block we are guarding (ie we dominate it,
+ but it doesn't postdominate us). */
+ if (e->dest != EXIT_BLOCK_PTR && e->dest != bb
+ && dominated_by_p (CDI_DOMINATORS, e->dest, e->src)
+ && !dominated_by_p (CDI_POST_DOMINATORS, e->src, e->dest))
+ {
+ gimple_stmt_iterator bi;
+
+ /* The call heuristic claims that a guarded function call
+ is improbable. This is because such calls are often used
+ to signal exceptional situations such as printing error
+ messages. */
+ for (bi = gsi_start_bb (e->dest); !gsi_end_p (bi);
+ gsi_next (&bi))
+ {
+ gimple stmt = gsi_stmt (bi);
+ if (is_gimple_call (stmt)
+ /* Constant and pure calls are hardly used to signalize
+ something exceptional. */
+ && gimple_has_side_effects (stmt))
+ {
+ predict_edge_def (e, PRED_CALL, NOT_TAKEN);
+ break;
+ }
+ }
+ }
+ }
+ tree_predict_by_opcode (bb);
+}
+
+/* Predict branch probabilities and estimate profile of the tree CFG.
+ This function can be called from the loop optimizers to recompute
+ the profile information. */
+
+void
tree_estimate_probability (void)
{
basic_block bb;
- loop_optimizer_init (0);
- if (dump_file && (dump_flags & TDF_DETAILS))
- flow_loops_dump (dump_file, NULL, 0);
-
add_noreturn_fake_exit_edges ();
connect_infinite_loops_to_exit ();
/* We use loop_niter_by_eval, which requires that the loops have
@@ -1627,89 +1703,14 @@ tree_estimate_probability (void)
bb_predictions = pointer_map_create ();
tree_bb_level_predictions ();
-
- mark_irreducible_loops ();
record_loop_exits ();
+
if (number_of_loops () > 1)
predict_loops ();
FOR_EACH_BB (bb)
- {
- edge e;
- edge_iterator ei;
- gimple last;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- {
- /* Predict early returns to be probable, as we've already taken
- care for error returns and other cases are often used for
- fast paths through function.
-
- Since we've already removed the return statements, we are
- looking for CFG like:
-
- if (conditional)
- {
- ..
- goto return_block
- }
- some other blocks
- return_block:
- return_stmt. */
- if (e->dest != bb->next_bb
- && e->dest != EXIT_BLOCK_PTR
- && single_succ_p (e->dest)
- && single_succ_edge (e->dest)->dest == EXIT_BLOCK_PTR
- && (last = last_stmt (e->dest)) != NULL
- && gimple_code (last) == GIMPLE_RETURN)
- {
- edge e1;
- edge_iterator ei1;
-
- if (single_succ_p (bb))
- {
- FOR_EACH_EDGE (e1, ei1, bb->preds)
- if (!predicted_by_p (e1->src, PRED_NULL_RETURN)
- && !predicted_by_p (e1->src, PRED_CONST_RETURN)
- && !predicted_by_p (e1->src, PRED_NEGATIVE_RETURN))
- predict_edge_def (e1, PRED_TREE_EARLY_RETURN, NOT_TAKEN);
- }
- else
- if (!predicted_by_p (e->src, PRED_NULL_RETURN)
- && !predicted_by_p (e->src, PRED_CONST_RETURN)
- && !predicted_by_p (e->src, PRED_NEGATIVE_RETURN))
- predict_edge_def (e, PRED_TREE_EARLY_RETURN, NOT_TAKEN);
- }
+ tree_estimate_probability_bb (bb);
- /* Look for block we are guarding (ie we dominate it,
- but it doesn't postdominate us). */
- if (e->dest != EXIT_BLOCK_PTR && e->dest != bb
- && dominated_by_p (CDI_DOMINATORS, e->dest, e->src)
- && !dominated_by_p (CDI_POST_DOMINATORS, e->src, e->dest))
- {
- gimple_stmt_iterator bi;
-
- /* The call heuristic claims that a guarded function call
- is improbable. This is because such calls are often used
- to signal exceptional situations such as printing error
- messages. */
- for (bi = gsi_start_bb (e->dest); !gsi_end_p (bi);
- gsi_next (&bi))
- {
- gimple stmt = gsi_stmt (bi);
- if (is_gimple_call (stmt)
- /* Constant and pure calls are hardly used to signalize
- something exceptional. */
- && gimple_has_side_effects (stmt))
- {
- predict_edge_def (e, PRED_CALL, NOT_TAKEN);
- break;
- }
- }
- }
- }
- tree_predict_by_opcode (bb);
- }
FOR_EACH_BB (bb)
combine_predictions_for_bb (bb);
@@ -1722,6 +1723,31 @@ tree_estimate_probability (void)
estimate_bb_frequencies ();
free_dominance_info (CDI_POST_DOMINATORS);
remove_fake_exit_edges ();
+}
+
+/* Predict branch probabilities and estimate profile of the tree CFG.
+ This is the driver function for PASS_PROFILE. */
+
+static unsigned int
+tree_estimate_probability_driver (void)
+{
+ unsigned nb_loops;
+
+ loop_optimizer_init (0);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ flow_loops_dump (dump_file, NULL, 0);
+
+ mark_irreducible_loops ();
+
+ nb_loops = number_of_loops ();
+ if (nb_loops > 1)
+ scev_initialize ();
+
+ tree_estimate_probability ();
+
+ if (nb_loops > 1)
+ scev_finalize ();
+
loop_optimizer_finalize ();
if (dump_file && (dump_flags & TDF_DETAILS))
gimple_dump_cfg (dump_file, dump_flags);
@@ -2203,7 +2229,7 @@ struct gimple_opt_pass pass_profile =
GIMPLE_PASS,
"profile", /* name */
gate_estimate_probability, /* gate */
- tree_estimate_probability, /* execute */
+ tree_estimate_probability_driver, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
diff --git a/gcc/predict.h b/gcc/predict.h
index e115bb511f8..0e040410768 100644
--- a/gcc/predict.h
+++ b/gcc/predict.h
@@ -40,5 +40,6 @@ extern int counts_to_freqs (void);
extern void estimate_bb_frequencies (void);
extern const char *predictor_name (enum br_predictor);
extern tree build_predict_expr (enum br_predictor, enum prediction);
+extern void tree_estimate_probability (void);
#endif /* GCC_PREDICT_H */
diff --git a/gcc/real.h b/gcc/real.h
index 884a663c83f..c93435b2524 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -26,6 +26,9 @@
#include <mpfr.h>
#ifdef HAVE_mpc
#include <mpc.h>
+# ifdef HAVE_mpc
+extern tree do_mpc_arg2 (tree, tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_srcptr, mpc_rnd_t));
+# endif
# if MPC_VERSION >= MPC_VERSION_NUM(0,6,1)
# define HAVE_mpc_pow
# endif
diff --git a/gcc/reload.c b/gcc/reload.c
index 4939b26a2ad..87bdfde32ba 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -6133,18 +6133,26 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
/* For some processors an address may be valid in the
original mode but not in a smaller mode. For
example, ARM accepts a scaled index register in
- SImode but not in HImode. Similarly, the address may
- have been valid before the subreg offset was added,
- but not afterwards. find_reloads_address
- assumes that we pass it a valid address, and doesn't
- force a reload. This will probably be fine if
- find_reloads_address finds some reloads. But if it
- doesn't find any, then we may have just converted a
- valid address into an invalid one. Check for that
- here. */
+ SImode but not in HImode. Note that this is only
+ a problem if the address in reg_equiv_mem is already
+ invalid in the new mode; other cases would be fixed
+ by find_reloads_address as usual.
+
+ ??? We attempt to handle such cases here by doing an
+ additional reload of the full address after the
+ usual processing by find_reloads_address. Note that
+ this may not work in the general case, but it seems
+ to cover the cases where this situation currently
+ occurs. A more general fix might be to reload the
+ *value* instead of the address, but this would not
+ be expected by the callers of this routine as-is.
+
+ If find_reloads_address already completed replaced
+ the address, there is nothing further to do. */
if (reloaded == 0
- && !strict_memory_address_p (GET_MODE (tem),
- XEXP (tem, 0)))
+ && reg_equiv_mem[regno] != 0
+ && !strict_memory_address_p (GET_MODE (x),
+ XEXP (reg_equiv_mem[regno], 0)))
push_reload (XEXP (tem, 0), NULL_RTX, &XEXP (tem, 0), (rtx*) 0,
base_reg_class (GET_MODE (tem), MEM, SCRATCH),
GET_MODE (XEXP (tem, 0)), VOIDmode, 0, 0,
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 50d1f20e7b9..59e227f1652 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -4335,31 +4335,30 @@ reload_as_needed (int live_known)
continue;
if (n == 1)
{
- n = validate_replace_rtx (reload_reg,
- gen_rtx_fmt_e (code,
- mode,
- reload_reg),
- p);
+ rtx replace_reg
+ = gen_rtx_fmt_e (code, mode, reload_reg);
+
+ validate_replace_rtx_group (reload_reg,
+ replace_reg, p);
+ n = verify_changes (0);
/* We must also verify that the constraints
- are met after the replacement. */
- extract_insn (p);
+ are met after the replacement. Make sure
+ extract_insn is only called for an insn
+ where the replacements were found to be
+ valid so far. */
if (n)
- n = constrain_operands (1);
- else
- break;
-
- /* If the constraints were not met, then
- undo the replacement. */
- if (!n)
{
- validate_replace_rtx (gen_rtx_fmt_e (code,
- mode,
- reload_reg),
- reload_reg, p);
- break;
+ extract_insn (p);
+ n = constrain_operands (1);
}
+ /* If the constraints were not met, then
+ undo the replacement, else confirm it. */
+ if (!n)
+ cancel_changes (0);
+ else
+ confirm_change_group ();
}
break;
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index bfd48e71373..64dba7aff08 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1135,6 +1135,7 @@ extern unsigned HOST_WIDE_INT nonzero_bits (const_rtx, enum machine_mode);
extern unsigned int num_sign_bit_copies (const_rtx, enum machine_mode);
extern bool constant_pool_constant_p (rtx);
extern bool truncated_to_mode (enum machine_mode, const_rtx);
+extern int low_bitmask_len (enum machine_mode, unsigned HOST_WIDE_INT);
/* 1 if RTX is a subreg containing a reg that is already known to be
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index b50a300294f..4a11fdff713 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5037,3 +5037,20 @@ constant_pool_constant_p (rtx x)
x = avoid_constant_pool_reference (x);
return GET_CODE (x) == CONST_DOUBLE;
}
+
+/* If M is a bitmask that selects a field of low-order bits within an item but
+ not the entire word, return the length of the field. Return -1 otherwise.
+ M is used in machine mode MODE. */
+
+int
+low_bitmask_len (enum machine_mode mode, unsigned HOST_WIDE_INT m)
+{
+ if (mode != VOIDmode)
+ {
+ if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT)
+ return -1;
+ m &= GET_MODE_MASK (mode);
+ }
+
+ return exact_log2 (m + 1);
+}
diff --git a/gcc/sese.c b/gcc/sese.c
new file mode 100644
index 00000000000..394d465f098
--- /dev/null
+++ b/gcc/sese.c
@@ -0,0 +1,1398 @@
+/* Single entry single exit control flow regions.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+ Contributed by Jan Sjodin <jan.sjodin@amd.com> and
+ Sebastian Pop <sebastian.pop@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "ggc.h"
+#include "tree.h"
+#include "rtl.h"
+#include "basic-block.h"
+#include "diagnostic.h"
+#include "tree-flow.h"
+#include "toplev.h"
+#include "tree-dump.h"
+#include "timevar.h"
+#include "cfgloop.h"
+#include "tree-chrec.h"
+#include "tree-data-ref.h"
+#include "tree-scalar-evolution.h"
+#include "tree-pass.h"
+#include "domwalk.h"
+#include "value-prof.h"
+#include "pointer-set.h"
+#include "gimple.h"
+#include "sese.h"
+
+/* Print to stderr the element ELT. */
+
+static void
+debug_rename_elt (rename_map_elt elt)
+{
+ fprintf (stderr, "(");
+ print_generic_expr (stderr, elt->old_name, 0);
+ fprintf (stderr, ", ");
+ print_generic_expr (stderr, elt->expr, 0);
+ fprintf (stderr, ")\n");
+}
+
+/* Helper function for debug_rename_map. */
+
+static int
+debug_rename_map_1 (void **slot, void *s ATTRIBUTE_UNUSED)
+{
+ struct rename_map_elt_s *entry = (struct rename_map_elt_s *) *slot;
+ debug_rename_elt (entry);
+ return 1;
+}
+
+/* Print to stderr all the elements of MAP. */
+
+void
+debug_rename_map (htab_t map)
+{
+ htab_traverse (map, debug_rename_map_1, NULL);
+}
+
+/* Computes a hash function for database element ELT. */
+
+hashval_t
+rename_map_elt_info (const void *elt)
+{
+ return htab_hash_pointer (((const struct rename_map_elt_s *) elt)->old_name);
+}
+
+/* Compares database elements E1 and E2. */
+
+int
+eq_rename_map_elts (const void *e1, const void *e2)
+{
+ const struct rename_map_elt_s *elt1 = (const struct rename_map_elt_s *) e1;
+ const struct rename_map_elt_s *elt2 = (const struct rename_map_elt_s *) e2;
+
+ return (elt1->old_name == elt2->old_name);
+}
+
+
+
+/* Print to stderr the element ELT. */
+
+static void
+debug_ivtype_elt (ivtype_map_elt elt)
+{
+ fprintf (stderr, "(%s, ", elt->cloog_iv);
+ print_generic_expr (stderr, elt->type, 0);
+ fprintf (stderr, ")\n");
+}
+
+/* Helper function for debug_ivtype_map. */
+
+static int
+debug_ivtype_map_1 (void **slot, void *s ATTRIBUTE_UNUSED)
+{
+ struct ivtype_map_elt_s *entry = (struct ivtype_map_elt_s *) *slot;
+ debug_ivtype_elt (entry);
+ return 1;
+}
+
+/* Print to stderr all the elements of MAP. */
+
+void
+debug_ivtype_map (htab_t map)
+{
+ htab_traverse (map, debug_ivtype_map_1, NULL);
+}
+
+/* Computes a hash function for database element ELT. */
+
+hashval_t
+ivtype_map_elt_info (const void *elt)
+{
+ return htab_hash_pointer (((const struct ivtype_map_elt_s *) elt)->cloog_iv);
+}
+
+/* Compares database elements E1 and E2. */
+
+int
+eq_ivtype_map_elts (const void *e1, const void *e2)
+{
+ const struct ivtype_map_elt_s *elt1 = (const struct ivtype_map_elt_s *) e1;
+ const struct ivtype_map_elt_s *elt2 = (const struct ivtype_map_elt_s *) e2;
+
+ return (elt1->cloog_iv == elt2->cloog_iv);
+}
+
+
+
+/* Record LOOP as occuring in REGION. */
+
+static void
+sese_record_loop (sese region, loop_p loop)
+{
+ if (sese_contains_loop (region, loop))
+ return;
+
+ bitmap_set_bit (SESE_LOOPS (region), loop->num);
+ VEC_safe_push (loop_p, heap, SESE_LOOP_NEST (region), loop);
+}
+
+/* Build the loop nests contained in REGION. Returns true when the
+ operation was successful. */
+
+void
+build_sese_loop_nests (sese region)
+{
+ unsigned i;
+ basic_block bb;
+ struct loop *loop0, *loop1;
+
+ FOR_EACH_BB (bb)
+ if (bb_in_sese_p (bb, region))
+ {
+ struct loop *loop = bb->loop_father;
+
+ /* Only add loops if they are completely contained in the SCoP. */
+ if (loop->header == bb
+ && bb_in_sese_p (loop->latch, region))
+ sese_record_loop (region, loop);
+ }
+
+ /* Make sure that the loops in the SESE_LOOP_NEST are ordered. It
+ can be the case that an inner loop is inserted before an outer
+ loop. To avoid this, semi-sort once. */
+ for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop0); i++)
+ {
+ if (VEC_length (loop_p, SESE_LOOP_NEST (region)) == i + 1)
+ break;
+
+ loop1 = VEC_index (loop_p, SESE_LOOP_NEST (region), i + 1);
+ if (loop0->num > loop1->num)
+ {
+ VEC_replace (loop_p, SESE_LOOP_NEST (region), i, loop1);
+ VEC_replace (loop_p, SESE_LOOP_NEST (region), i + 1, loop0);
+ }
+ }
+}
+
+/* For a USE in BB, if BB is outside REGION, mark the USE in the
+ LIVEOUTS set. */
+
+static void
+sese_build_liveouts_use (sese region, bitmap liveouts, basic_block bb,
+ tree use)
+{
+ unsigned ver;
+ basic_block def_bb;
+
+ if (TREE_CODE (use) != SSA_NAME)
+ return;
+
+ ver = SSA_NAME_VERSION (use);
+ def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
+
+ if (!def_bb
+ || !bb_in_sese_p (def_bb, region)
+ || bb_in_sese_p (bb, region))
+ return;
+
+ bitmap_set_bit (liveouts, ver);
+}
+
+/* Marks for rewrite all the SSA_NAMES defined in REGION and that are
+ used in BB that is outside of the REGION. */
+
+static void
+sese_build_liveouts_bb (sese region, bitmap liveouts, basic_block bb)
+{
+ gimple_stmt_iterator bsi;
+ edge e;
+ edge_iterator ei;
+ ssa_op_iter iter;
+ use_operand_p use_p;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
+ sese_build_liveouts_use (region, liveouts, bb,
+ PHI_ARG_DEF_FROM_EDGE (gsi_stmt (bsi), e));
+
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ FOR_EACH_SSA_USE_OPERAND (use_p, gsi_stmt (bsi), iter, SSA_OP_ALL_USES)
+ sese_build_liveouts_use (region, liveouts, bb, USE_FROM_PTR (use_p));
+}
+
+/* Build the LIVEOUTS of REGION: the set of variables defined inside
+ and used outside the REGION. */
+
+static void
+sese_build_liveouts (sese region, bitmap liveouts)
+{
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ sese_build_liveouts_bb (region, liveouts, bb);
+}
+
+/* Builds a new SESE region from edges ENTRY and EXIT. */
+
+sese
+new_sese (edge entry, edge exit)
+{
+ sese region = XNEW (struct sese_s);
+
+ SESE_ENTRY (region) = entry;
+ SESE_EXIT (region) = exit;
+ SESE_LOOPS (region) = BITMAP_ALLOC (NULL);
+ SESE_LOOP_NEST (region) = VEC_alloc (loop_p, heap, 3);
+ SESE_ADD_PARAMS (region) = true;
+ SESE_PARAMS (region) = VEC_alloc (tree, heap, 3);
+ SESE_PARAMS_INDEX (region) = htab_create (10, clast_name_index_elt_info,
+ eq_clast_name_indexes, free);
+ SESE_PARAMS_NAMES (region) = XNEWVEC (char *, num_ssa_names);
+
+ return region;
+}
+
+/* Deletes REGION. */
+
+void
+free_sese (sese region)
+{
+ if (SESE_LOOPS (region))
+ SESE_LOOPS (region) = BITMAP_ALLOC (NULL);
+
+ VEC_free (tree, heap, SESE_PARAMS (region));
+ VEC_free (loop_p, heap, SESE_LOOP_NEST (region));
+
+ if (SESE_PARAMS_INDEX (region))
+ htab_delete (SESE_PARAMS_INDEX (region));
+
+ /* Do not free SESE_PARAMS_NAMES: CLooG does that. */
+
+ XDELETE (region);
+}
+
+/* Add exit phis for USE on EXIT. */
+
+static void
+sese_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e)
+{
+ gimple phi = create_phi_node (use, exit);
+
+ create_new_def_for (gimple_phi_result (phi), phi,
+ gimple_phi_result_ptr (phi));
+ add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION);
+ add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION);
+}
+
+/* Insert in the block BB phi nodes for variables defined in REGION
+ and used outside the REGION. The code generation moves REGION in
+ the else clause of an "if (1)" and generates code in the then
+ clause that is at this point empty:
+
+ | if (1)
+ | empty;
+ | else
+ | REGION;
+*/
+
+void
+sese_insert_phis_for_liveouts (sese region, basic_block bb,
+ edge false_e, edge true_e)
+{
+ unsigned i;
+ bitmap_iterator bi;
+ bitmap liveouts = BITMAP_ALLOC (NULL);
+
+ update_ssa (TODO_update_ssa);
+
+ sese_build_liveouts (region, liveouts);
+ EXECUTE_IF_SET_IN_BITMAP (liveouts, 0, i, bi)
+ sese_add_exit_phis_edge (bb, ssa_name (i), false_e, true_e);
+ BITMAP_FREE (liveouts);
+
+ update_ssa (TODO_update_ssa);
+}
+
+/* Get the definition of NAME before the SESE. Keep track of the
+ basic blocks that have been VISITED in a bitmap. */
+
+static tree
+get_vdef_before_sese (sese region, tree name, sbitmap visited)
+{
+ unsigned i;
+ gimple def_stmt = SSA_NAME_DEF_STMT (name);
+ basic_block def_bb = gimple_bb (def_stmt);
+
+ if (!def_bb || !bb_in_sese_p (def_bb, region))
+ return name;
+
+ if (TEST_BIT (visited, def_bb->index))
+ return NULL_TREE;
+
+ SET_BIT (visited, def_bb->index);
+
+ switch (gimple_code (def_stmt))
+ {
+ case GIMPLE_PHI:
+ for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
+ {
+ tree arg = gimple_phi_arg_def (def_stmt, i);
+ tree res = get_vdef_before_sese (region, arg, visited);
+ if (res)
+ return res;
+ }
+ return NULL_TREE;
+
+ default:
+ return NULL_TREE;
+ }
+}
+
+/* Adjust a virtual phi node PHI that is placed at the end of the
+ generated code for SCOP:
+
+ | if (1)
+ | generated code from REGION;
+ | else
+ | REGION;
+
+ The FALSE_E edge comes from the original code, TRUE_E edge comes
+ from the code generated for the SCOP. */
+
+static void
+sese_adjust_vphi (sese region, gimple phi, edge true_e)
+{
+ unsigned i;
+
+ gcc_assert (gimple_phi_num_args (phi) == 2);
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (gimple_phi_arg_edge (phi, i) == true_e)
+ {
+ tree true_arg, false_arg, before_scop_arg;
+ sbitmap visited;
+
+ true_arg = gimple_phi_arg_def (phi, i);
+ if (!SSA_NAME_IS_DEFAULT_DEF (true_arg))
+ return;
+
+ false_arg = gimple_phi_arg_def (phi, i == 0 ? 1 : 0);
+ if (SSA_NAME_IS_DEFAULT_DEF (false_arg))
+ return;
+
+ visited = sbitmap_alloc (last_basic_block);
+ sbitmap_zero (visited);
+ before_scop_arg = get_vdef_before_sese (region, false_arg, visited);
+ gcc_assert (before_scop_arg != NULL_TREE);
+ SET_PHI_ARG_DEF (phi, i, before_scop_arg);
+ sbitmap_free (visited);
+ }
+}
+
+/* Returns the name associated to OLD_NAME in MAP. */
+
+static tree
+get_rename (htab_t map, tree old_name)
+{
+ struct rename_map_elt_s tmp;
+ PTR *slot;
+
+ tmp.old_name = old_name;
+ slot = htab_find_slot (map, &tmp, NO_INSERT);
+
+ if (slot && *slot)
+ return ((rename_map_elt) *slot)->expr;
+
+ return old_name;
+}
+
+/* Register in MAP the rename tuple (old_name, expr). */
+
+void
+set_rename (htab_t map, tree old_name, tree expr)
+{
+ struct rename_map_elt_s tmp;
+ PTR *slot;
+
+ if (old_name == expr)
+ return;
+
+ tmp.old_name = old_name;
+ slot = htab_find_slot (map, &tmp, INSERT);
+
+ if (!slot)
+ return;
+
+ if (*slot)
+ free (*slot);
+
+ *slot = new_rename_map_elt (old_name, expr);
+}
+
+/* Adjusts the phi nodes in the block BB for variables defined in
+ SCOP_REGION and used outside the SCOP_REGION. The code generation
+ moves SCOP_REGION in the else clause of an "if (1)" and generates
+ code in the then clause:
+
+ | if (1)
+ | generated code from REGION;
+ | else
+ | REGION;
+
+ To adjust the phi nodes after the condition, the RENAME_MAP is
+ used. */
+
+void
+sese_adjust_liveout_phis (sese region, htab_t rename_map, basic_block bb,
+ edge false_e, edge true_e)
+{
+ gimple_stmt_iterator si;
+
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ {
+ unsigned i;
+ unsigned false_i = 0;
+ gimple phi = gsi_stmt (si);
+
+ if (!is_gimple_reg (PHI_RESULT (phi)))
+ {
+ sese_adjust_vphi (region, phi, true_e);
+ continue;
+ }
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (gimple_phi_arg_edge (phi, i) == false_e)
+ {
+ false_i = i;
+ break;
+ }
+
+ for (i = 0; i < gimple_phi_num_args (phi); i++)
+ if (gimple_phi_arg_edge (phi, i) == true_e)
+ {
+ tree old_name = gimple_phi_arg_def (phi, false_i);
+ tree expr = get_rename (rename_map, old_name);
+ gimple_seq stmts;
+
+ gcc_assert (old_name != expr);
+
+ if (TREE_CODE (expr) != SSA_NAME
+ && is_gimple_reg (old_name))
+ {
+ tree type = TREE_TYPE (old_name);
+ tree var = create_tmp_var (type, "var");
+
+ expr = build2 (MODIFY_EXPR, type, var, expr);
+ expr = force_gimple_operand (expr, &stmts, true, NULL);
+ gsi_insert_seq_on_edge_immediate (true_e, stmts);
+ }
+
+ SET_PHI_ARG_DEF (phi, i, expr);
+ }
+ }
+}
+
+/* Rename the SSA_NAMEs used in STMT and that appear in MAP. */
+
+static void
+rename_variables_in_stmt (gimple stmt, htab_t map, gimple_stmt_iterator *insert_gsi)
+{
+ ssa_op_iter iter;
+ use_operand_p use_p;
+
+ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
+ {
+ tree use = USE_FROM_PTR (use_p);
+ tree expr = get_rename (map, use);
+ tree type_use = TREE_TYPE (use);
+ tree type_expr = TREE_TYPE (expr);
+ gimple_seq stmts;
+
+ if (use == expr)
+ continue;
+
+ if (type_use != type_expr
+ || (TREE_CODE (expr) != SSA_NAME
+ && is_gimple_reg (use)))
+ {
+ tree var = create_tmp_var (type_use, "var");
+
+ if (type_use != type_expr)
+ expr = fold_convert (type_use, expr);
+
+ expr = build2 (MODIFY_EXPR, type_use, var, expr);
+ expr = force_gimple_operand (expr, &stmts, true, NULL);
+ gsi_insert_seq_before (insert_gsi, stmts, GSI_SAME_STMT);
+ }
+
+ replace_exp (use_p, expr);
+ }
+
+ update_stmt (stmt);
+}
+
+/* Returns true if NAME is a parameter of SESE. */
+
+static bool
+is_parameter (sese region, tree name)
+{
+ int i;
+ tree p;
+
+ for (i = 0; VEC_iterate (tree, SESE_PARAMS (region), i, p); i++)
+ if (p == name)
+ return true;
+
+ return false;
+}
+
+/* Returns true if NAME is an induction variable. */
+
+static bool
+is_iv (tree name)
+{
+ return gimple_code (SSA_NAME_DEF_STMT (name)) == GIMPLE_PHI;
+}
+
+static void expand_scalar_variables_stmt (gimple, basic_block, sese,
+ htab_t, gimple_stmt_iterator *);
+static tree
+expand_scalar_variables_expr (tree, tree, enum tree_code, tree, basic_block,
+ sese, htab_t, gimple_stmt_iterator *);
+
+static tree
+expand_scalar_variables_call (gimple stmt, basic_block bb, sese region,
+ htab_t map, gimple_stmt_iterator *gsi)
+{
+ int i, nargs = gimple_call_num_args (stmt);
+ VEC (tree, gc) *args = VEC_alloc (tree, gc, nargs);
+ tree fn_type = TREE_TYPE (gimple_call_fn (stmt));
+ tree fn = gimple_call_fndecl (stmt);
+ tree call_expr, var, lhs;
+ gimple call;
+
+ for (i = 0; i < nargs; i++)
+ {
+ tree arg = gimple_call_arg (stmt, i);
+ tree t = TREE_TYPE (arg);
+
+ var = create_tmp_var (t, "var");
+ arg = expand_scalar_variables_expr (t, arg, TREE_CODE (arg), NULL,
+ bb, region, map, gsi);
+ arg = build2 (MODIFY_EXPR, t, var, arg);
+ arg = force_gimple_operand_gsi (gsi, arg, true, NULL,
+ true, GSI_SAME_STMT);
+ VEC_quick_push (tree, args, arg);
+ }
+
+ lhs = gimple_call_lhs (stmt);
+ var = create_tmp_var (TREE_TYPE (lhs), "var");
+ call_expr = build_call_vec (fn_type, fn, args);
+ call = gimple_build_call_from_tree (call_expr);
+ var = make_ssa_name (var, call);
+ gimple_call_set_lhs (call, var);
+ gsi_insert_before (gsi, call, GSI_SAME_STMT);
+
+ return var;
+}
+
+/* Copies at GSI all the scalar computations on which the ssa_name OP0
+ depends on in the SESE: these are all the scalar variables used in
+ the definition of OP0, that are defined outside BB and still in the
+ SESE, i.e. not a parameter of the SESE. The expression that is
+ returned contains only induction variables from the generated code:
+ MAP contains the induction variables renaming mapping, and is used
+ to translate the names of induction variables. */
+
+static tree
+expand_scalar_variables_ssa_name (tree op0, basic_block bb,
+ sese region, htab_t map,
+ gimple_stmt_iterator *gsi)
+{
+ gimple def_stmt;
+ tree new_op;
+
+ if (is_parameter (region, op0)
+ || is_iv (op0))
+ return get_rename (map, op0);
+
+ def_stmt = SSA_NAME_DEF_STMT (op0);
+
+ /* Check whether we already have a rename for OP0. */
+ new_op = get_rename (map, op0);
+
+ if (new_op != op0
+ && gimple_bb (SSA_NAME_DEF_STMT (new_op)) == bb)
+ return new_op;
+
+ if (gimple_bb (def_stmt) == bb)
+ {
+ /* If the defining statement is in the basic block already
+ we do not need to create a new expression for it, we
+ only need to ensure its operands are expanded. */
+ expand_scalar_variables_stmt (def_stmt, bb, region, map, gsi);
+ return new_op;
+ }
+ else
+ {
+ if (!gimple_bb (def_stmt)
+ || !bb_in_sese_p (gimple_bb (def_stmt), region))
+ return new_op;
+
+ switch (gimple_code (def_stmt))
+ {
+ case GIMPLE_ASSIGN:
+ {
+ tree var0 = gimple_assign_rhs1 (def_stmt);
+ enum tree_code subcode = gimple_assign_rhs_code (def_stmt);
+ tree var1 = gimple_assign_rhs2 (def_stmt);
+ tree type = gimple_expr_type (def_stmt);
+
+ return expand_scalar_variables_expr (type, var0, subcode, var1, bb,
+ region, map, gsi);
+ }
+
+ case GIMPLE_CALL:
+ return expand_scalar_variables_call (def_stmt, bb, region, map, gsi);
+
+ default:
+ gcc_unreachable ();
+ return new_op;
+ }
+ }
+}
+
+/* Copies at GSI all the scalar computations on which the expression
+ OP0 CODE OP1 depends on in the SESE: these are all the scalar
+ variables used in OP0 and OP1, defined outside BB and still defined
+ in the SESE, i.e. not a parameter of the SESE. The expression that
+ is returned contains only induction variables from the generated
+ code: MAP contains the induction variables renaming mapping, and is
+ used to translate the names of induction variables. */
+
+static tree
+expand_scalar_variables_expr (tree type, tree op0, enum tree_code code,
+ tree op1, basic_block bb, sese region,
+ htab_t map, gimple_stmt_iterator *gsi)
+{
+ if (TREE_CODE_CLASS (code) == tcc_constant
+ || TREE_CODE_CLASS (code) == tcc_declaration)
+ return op0;
+
+ /* For data references we have to duplicate also its memory
+ indexing. */
+ if (TREE_CODE_CLASS (code) == tcc_reference)
+ {
+ switch (code)
+ {
+ case REALPART_EXPR:
+ case IMAGPART_EXPR:
+ {
+ tree op = TREE_OPERAND (op0, 0);
+ tree res = expand_scalar_variables_expr
+ (type, op, TREE_CODE (op), NULL, bb, region, map, gsi);
+ return build1 (code, type, res);
+ }
+
+ case INDIRECT_REF:
+ {
+ tree old_name = TREE_OPERAND (op0, 0);
+ tree expr = expand_scalar_variables_ssa_name
+ (old_name, bb, region, map, gsi);
+
+ if (TREE_CODE (expr) != SSA_NAME
+ && is_gimple_reg (old_name))
+ {
+ tree type = TREE_TYPE (old_name);
+ tree var = create_tmp_var (type, "var");
+
+ expr = build2 (MODIFY_EXPR, type, var, expr);
+ expr = force_gimple_operand_gsi (gsi, expr, true, NULL,
+ true, GSI_SAME_STMT);
+ }
+
+ return fold_build1 (code, type, expr);
+ }
+
+ case ARRAY_REF:
+ {
+ tree op00 = TREE_OPERAND (op0, 0);
+ tree op01 = TREE_OPERAND (op0, 1);
+ tree op02 = TREE_OPERAND (op0, 2);
+ tree op03 = TREE_OPERAND (op0, 3);
+ tree base = expand_scalar_variables_expr
+ (TREE_TYPE (op00), op00, TREE_CODE (op00), NULL, bb, region,
+ map, gsi);
+ tree subscript = expand_scalar_variables_expr
+ (TREE_TYPE (op01), op01, TREE_CODE (op01), NULL, bb, region,
+ map, gsi);
+
+ return build4 (ARRAY_REF, type, base, subscript, op02, op03);
+ }
+
+ default:
+ /* The above cases should catch everything. */
+ gcc_unreachable ();
+ }
+ }
+
+ if (TREE_CODE_CLASS (code) == tcc_unary)
+ {
+ tree op0_type = TREE_TYPE (op0);
+ enum tree_code op0_code = TREE_CODE (op0);
+ tree op0_expr = expand_scalar_variables_expr (op0_type, op0, op0_code,
+ NULL, bb, region, map, gsi);
+
+ return fold_build1 (code, type, op0_expr);
+ }
+
+ if (TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_comparison)
+ {
+ tree op0_type = TREE_TYPE (op0);
+ enum tree_code op0_code = TREE_CODE (op0);
+ tree op0_expr = expand_scalar_variables_expr (op0_type, op0, op0_code,
+ NULL, bb, region, map, gsi);
+ tree op1_type = TREE_TYPE (op1);
+ enum tree_code op1_code = TREE_CODE (op1);
+ tree op1_expr = expand_scalar_variables_expr (op1_type, op1, op1_code,
+ NULL, bb, region, map, gsi);
+
+ return fold_build2 (code, type, op0_expr, op1_expr);
+ }
+
+ if (code == SSA_NAME)
+ return expand_scalar_variables_ssa_name (op0, bb, region, map, gsi);
+
+ if (code == ADDR_EXPR)
+ return op0;
+
+ gcc_unreachable ();
+ return NULL;
+}
+
+/* Copies at the beginning of BB all the scalar computations on which
+ STMT depends on in the SESE: these are all the scalar variables used
+ in STMT, defined outside BB and still defined in the SESE, i.e. not a
+ parameter of the SESE. The expression that is returned contains
+ only induction variables from the generated code: MAP contains the
+ induction variables renaming mapping, and is used to translate the
+ names of induction variables. */
+
+static void
+expand_scalar_variables_stmt (gimple stmt, basic_block bb, sese region,
+ htab_t map, gimple_stmt_iterator *gsi)
+{
+ ssa_op_iter iter;
+ use_operand_p use_p;
+
+ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES)
+ {
+ tree use = USE_FROM_PTR (use_p);
+ tree type = TREE_TYPE (use);
+ enum tree_code code = TREE_CODE (use);
+ tree use_expr;
+
+ if (!is_gimple_reg (use))
+ continue;
+
+ /* Don't expand USE if we already have a rename for it. */
+ use_expr = get_rename (map, use);
+ if (use_expr != use)
+ continue;
+
+ use_expr = expand_scalar_variables_expr (type, use, code, NULL, bb,
+ region, map, gsi);
+ use_expr = fold_convert (type, use_expr);
+
+ if (use_expr == use)
+ continue;
+
+ if (TREE_CODE (use_expr) != SSA_NAME)
+ {
+ tree var = create_tmp_var (type, "var");
+
+ use_expr = build2 (MODIFY_EXPR, type, var, use_expr);
+ use_expr = force_gimple_operand_gsi (gsi, use_expr, true, NULL,
+ true, GSI_SAME_STMT);
+ }
+
+ replace_exp (use_p, use_expr);
+ }
+
+ update_stmt (stmt);
+}
+
+/* Copies at the beginning of BB all the scalar computations on which
+ BB depends on in the SESE: these are all the scalar variables used
+ in BB, defined outside BB and still defined in the SESE, i.e. not a
+ parameter of the SESE. The expression that is returned contains
+ only induction variables from the generated code: MAP contains the
+ induction variables renaming mapping, and is used to translate the
+ names of induction variables. */
+
+static void
+expand_scalar_variables (basic_block bb, sese region, htab_t map)
+{
+ gimple_stmt_iterator gsi;
+
+ for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi);)
+ {
+ gimple stmt = gsi_stmt (gsi);
+ expand_scalar_variables_stmt (stmt, bb, region, map, &gsi);
+ gsi_next (&gsi);
+ }
+}
+
+/* Rename all the SSA_NAMEs from block BB according to the MAP. */
+
+static void
+rename_variables (basic_block bb, htab_t map)
+{
+ gimple_stmt_iterator gsi;
+ gimple_stmt_iterator insert_gsi = gsi_start_bb (bb);
+
+ for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ rename_variables_in_stmt (gsi_stmt (gsi), map, &insert_gsi);
+}
+
+/* Remove condition from BB. */
+
+static void
+remove_condition (basic_block bb)
+{
+ gimple last = last_stmt (bb);
+
+ if (last && gimple_code (last) == GIMPLE_COND)
+ {
+ gimple_stmt_iterator gsi = gsi_last_bb (bb);
+ gsi_remove (&gsi, true);
+ }
+}
+
+/* Returns the first successor edge of BB with EDGE_TRUE_VALUE flag set. */
+
+edge
+get_true_edge_from_guard_bb (basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (e->flags & EDGE_TRUE_VALUE)
+ return e;
+
+ gcc_unreachable ();
+ return NULL;
+}
+
+/* Returns the first successor edge of BB with EDGE_TRUE_VALUE flag cleared. */
+
+edge
+get_false_edge_from_guard_bb (basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!(e->flags & EDGE_TRUE_VALUE))
+ return e;
+
+ gcc_unreachable ();
+ return NULL;
+}
+
+/* Returns true when NAME is defined in LOOP. */
+
+static bool
+defined_in_loop_p (tree name, loop_p loop)
+{
+ gimple stmt = SSA_NAME_DEF_STMT (name);
+
+ return (gimple_bb (stmt)->loop_father == loop);
+}
+
+/* Returns the gimple statement that uses NAME outside the loop it is
+ defined in, returns NULL if there is no such loop close phi node.
+ An invariant of the loop closed SSA form is that the only use of a
+ variable, outside the loop it is defined in, is in the loop close
+ phi node that just follows the loop. */
+
+static gimple
+alive_after_loop (tree name)
+{
+ use_operand_p use_p;
+ imm_use_iterator imm_iter;
+ loop_p loop = gimple_bb (SSA_NAME_DEF_STMT (name))->loop_father;
+
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name)
+ {
+ gimple stmt = USE_STMT (use_p);
+
+ if (gimple_code (stmt) == GIMPLE_PHI
+ && gimple_bb (stmt)->loop_father != loop)
+ return stmt;
+ }
+
+ return NULL;
+}
+
+/* Return true if a close phi has not yet been inserted for the use of
+ variable NAME on the single exit of LOOP. */
+
+static bool
+close_phi_not_yet_inserted_p (loop_p loop, tree name)
+{
+ gimple_stmt_iterator psi;
+ basic_block bb = single_exit (loop)->dest;
+
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
+ if (gimple_phi_arg_def (gsi_stmt (psi), 0) == name)
+ return false;
+
+ return true;
+}
+
+/* A structure for passing parameters to add_loop_exit_phis. */
+
+typedef struct alep {
+ loop_p loop;
+ VEC (rename_map_elt, heap) *new_renames;
+} *alep_p;
+
+/* Helper function for htab_traverse in insert_loop_close_phis. */
+
+static int
+add_loop_exit_phis (void **slot, void *data)
+{
+ struct rename_map_elt_s *entry;
+ alep_p a;
+ loop_p loop;
+ tree expr, new_name;
+ bool def_in_loop_p, used_outside_p, need_close_phi_p;
+ gimple old_close_phi;
+
+ if (!slot || !data)
+ return 1;
+
+ entry = (struct rename_map_elt_s *) *slot;
+ a = (alep_p) data;
+ loop = a->loop;
+ expr = entry->expr;
+
+ if (TREE_CODE (expr) != SSA_NAME)
+ return 1;
+
+ new_name = expr;
+ def_in_loop_p = defined_in_loop_p (new_name, loop);
+ old_close_phi = alive_after_loop (entry->old_name);
+ used_outside_p = (old_close_phi != NULL);
+ need_close_phi_p = (def_in_loop_p && used_outside_p
+ && close_phi_not_yet_inserted_p (loop, new_name));
+
+ /* Insert a loop close phi node. */
+ if (need_close_phi_p)
+ {
+ basic_block bb = single_exit (loop)->dest;
+ gimple phi = create_phi_node (new_name, bb);
+ tree new_res = create_new_def_for (gimple_phi_result (phi), phi,
+ gimple_phi_result_ptr (phi));
+
+ add_phi_arg (phi, new_name, single_pred_edge (bb), UNKNOWN_LOCATION);
+ VEC_safe_push (rename_map_elt, heap, a->new_renames,
+ new_rename_map_elt (gimple_phi_result (old_close_phi),
+ new_res));
+ }
+
+ /* Remove the old rename from the map. */
+ if (def_in_loop_p && *slot)
+ {
+ free (*slot);
+ *slot = NULL;
+ }
+
+ return 1;
+}
+
+/* Traverses MAP and removes from it all the tuples (OLD, NEW) where
+ NEW is defined in LOOP. Inserts on the exit of LOOP the close phi
+ node "RES = phi (NEW)" corresponding to "OLD_RES = phi (OLD)" in
+ the original code. Inserts in MAP the tuple (OLD_RES, RES). */
+
+void
+insert_loop_close_phis (htab_t map, loop_p loop)
+{
+ int i;
+ struct alep a;
+ rename_map_elt elt;
+
+ a.loop = loop;
+ a.new_renames = VEC_alloc (rename_map_elt, heap, 3);
+ update_ssa (TODO_update_ssa);
+ htab_traverse (map, add_loop_exit_phis, &a);
+ update_ssa (TODO_update_ssa);
+
+ for (i = 0; VEC_iterate (rename_map_elt, a.new_renames, i, elt); i++)
+ {
+ set_rename (map, elt->old_name, elt->expr);
+ free (elt);
+ }
+
+ VEC_free (rename_map_elt, heap, a.new_renames);
+}
+
+/* Helper structure for htab_traverse in insert_guard_phis. */
+
+struct igp {
+ basic_block bb;
+ edge true_edge, false_edge;
+ htab_t before_guard;
+};
+
+/* Return the default name that is before the guard. */
+
+static tree
+default_before_guard (htab_t before_guard, tree old_name)
+{
+ tree res = get_rename (before_guard, old_name);
+
+ if (res == old_name)
+ {
+ if (is_gimple_reg (res))
+ return fold_convert (TREE_TYPE (res), integer_zero_node);
+ return gimple_default_def (cfun, SSA_NAME_VAR (res));
+ }
+
+ return res;
+}
+
+/* Prepares EXPR to be a good phi argument when the phi result is
+ RES. Insert needed statements on edge E. */
+
+static tree
+convert_for_phi_arg (tree expr, tree res, edge e)
+{
+ tree type = TREE_TYPE (res);
+
+ if (TREE_TYPE (expr) != type)
+ expr = fold_convert (type, expr);
+
+ if (TREE_CODE (expr) != SSA_NAME
+ && !is_gimple_min_invariant (expr))
+ {
+ tree var = create_tmp_var (type, "var");
+ gimple_seq stmts;
+
+ expr = build2 (MODIFY_EXPR, type, var, expr);
+ expr = force_gimple_operand (expr, &stmts, true, NULL);
+ gsi_insert_seq_on_edge_immediate (e, stmts);
+ }
+
+ return expr;
+}
+
+/* Helper function for htab_traverse in insert_guard_phis. */
+
+static int
+add_guard_exit_phis (void **slot, void *s)
+{
+ struct rename_map_elt_s *entry = (struct rename_map_elt_s *) *slot;
+ struct igp *i = (struct igp *) s;
+ basic_block bb = i->bb;
+ edge true_edge = i->true_edge;
+ edge false_edge = i->false_edge;
+ tree res = entry->old_name;
+ tree name1 = entry->expr;
+ tree name2 = default_before_guard (i->before_guard, res);
+ gimple phi;
+
+ /* Nothing to be merged if the name before the guard is the same as
+ the one after. */
+ if (name1 == name2)
+ return 1;
+
+ name1 = convert_for_phi_arg (name1, res, true_edge);
+ name2 = convert_for_phi_arg (name2, res, false_edge);
+
+ phi = create_phi_node (res, bb);
+ res = create_new_def_for (gimple_phi_result (phi), phi,
+ gimple_phi_result_ptr (phi));
+
+ add_phi_arg (phi, name1, true_edge, UNKNOWN_LOCATION);
+ add_phi_arg (phi, name2, false_edge, UNKNOWN_LOCATION);
+
+ entry->expr = res;
+ *slot = entry;
+ return 1;
+}
+
+/* Iterate over RENAME_MAP and get tuples of the form (OLD, NAME1).
+ If there is a correspondent tuple (OLD, NAME2) in BEFORE_GUARD,
+ with NAME1 different than NAME2, then insert in BB the phi node:
+
+ | RES = phi (NAME1 (on TRUE_EDGE), NAME2 (on FALSE_EDGE))"
+
+ if there is no tuple for OLD in BEFORE_GUARD, insert
+
+ | RES = phi (NAME1 (on TRUE_EDGE),
+ | DEFAULT_DEFINITION of NAME1 (on FALSE_EDGE))".
+
+ Finally register in RENAME_MAP the tuple (OLD, RES). */
+
+void
+insert_guard_phis (basic_block bb, edge true_edge, edge false_edge,
+ htab_t before_guard, htab_t rename_map)
+{
+ struct igp i;
+ i.bb = bb;
+ i.true_edge = true_edge;
+ i.false_edge = false_edge;
+ i.before_guard = before_guard;
+
+ update_ssa (TODO_update_ssa);
+ htab_traverse (rename_map, add_guard_exit_phis, &i);
+ update_ssa (TODO_update_ssa);
+}
+
+/* Create a duplicate of the basic block BB. NOTE: This does not
+ preserve SSA form. */
+
+static void
+graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, htab_t map)
+{
+ gimple_stmt_iterator gsi, gsi_tgt;
+
+ gsi_tgt = gsi_start_bb (new_bb);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ def_operand_p def_p;
+ ssa_op_iter op_iter;
+ int region;
+ gimple stmt = gsi_stmt (gsi);
+ gimple copy;
+
+ if (gimple_code (stmt) == GIMPLE_LABEL)
+ continue;
+
+ /* Create a new copy of STMT and duplicate STMT's virtual
+ operands. */
+ copy = gimple_copy (stmt);
+ gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT);
+ mark_sym_for_renaming (gimple_vop (cfun));
+
+ region = lookup_stmt_eh_region (stmt);
+ if (region >= 0)
+ add_stmt_to_eh_region (copy, region);
+ gimple_duplicate_stmt_histograms (cfun, copy, cfun, stmt);
+
+ /* Create new names for all the definitions created by COPY and
+ add replacement mappings for each new name. */
+ FOR_EACH_SSA_DEF_OPERAND (def_p, copy, op_iter, SSA_OP_ALL_DEFS)
+ {
+ tree old_name = DEF_FROM_PTR (def_p);
+ tree new_name = create_new_def_for (old_name, copy, def_p);
+ set_rename (map, old_name, new_name);
+ }
+ }
+}
+
+/* Copies BB and includes in the copied BB all the statements that can
+ be reached following the use-def chains from the memory accesses,
+ and returns the next edge following this new block. */
+
+edge
+copy_bb_and_scalar_dependences (basic_block bb, sese region,
+ edge next_e, htab_t map)
+{
+ basic_block new_bb = split_edge (next_e);
+
+ next_e = single_succ_edge (new_bb);
+ graphite_copy_stmts_from_block (bb, new_bb, map);
+ remove_condition (new_bb);
+ remove_phi_nodes (new_bb);
+ expand_scalar_variables (new_bb, region, map);
+ rename_variables (new_bb, map);
+
+ return next_e;
+}
+
+/* Returns the outermost loop in SCOP that contains BB. */
+
+struct loop *
+outermost_loop_in_sese (sese region, basic_block bb)
+{
+ struct loop *nest;
+
+ nest = bb->loop_father;
+ while (loop_outer (nest)
+ && loop_in_sese_p (loop_outer (nest), region))
+ nest = loop_outer (nest);
+
+ return nest;
+}
+
+/* Sets the false region of an IF_REGION to REGION. */
+
+void
+if_region_set_false_region (ifsese if_region, sese region)
+{
+ basic_block condition = if_region_get_condition_block (if_region);
+ edge false_edge = get_false_edge_from_guard_bb (condition);
+ basic_block dummy = false_edge->dest;
+ edge entry_region = SESE_ENTRY (region);
+ edge exit_region = SESE_EXIT (region);
+ basic_block before_region = entry_region->src;
+ basic_block last_in_region = exit_region->src;
+ void **slot = htab_find_slot_with_hash (current_loops->exits, exit_region,
+ htab_hash_pointer (exit_region),
+ NO_INSERT);
+
+ entry_region->flags = false_edge->flags;
+ false_edge->flags = exit_region->flags;
+
+ redirect_edge_pred (entry_region, condition);
+ redirect_edge_pred (exit_region, before_region);
+ redirect_edge_pred (false_edge, last_in_region);
+ redirect_edge_succ (false_edge, single_succ (dummy));
+ delete_basic_block (dummy);
+
+ exit_region->flags = EDGE_FALLTHRU;
+ recompute_all_dominators ();
+
+ SESE_EXIT (region) = false_edge;
+ if_region->false_region = region;
+
+ if (slot)
+ {
+ struct loop_exit *loop_exit = GGC_CNEW (struct loop_exit);
+
+ memcpy (loop_exit, *((struct loop_exit **) slot), sizeof (struct loop_exit));
+ htab_clear_slot (current_loops->exits, slot);
+
+ slot = htab_find_slot_with_hash (current_loops->exits, false_edge,
+ htab_hash_pointer (false_edge),
+ INSERT);
+ loop_exit->e = false_edge;
+ *slot = loop_exit;
+ false_edge->src->loop_father->exits->next = loop_exit;
+ }
+}
+
+/* Creates an IFSESE with CONDITION on edge ENTRY. */
+
+ifsese
+create_if_region_on_edge (edge entry, tree condition)
+{
+ edge e;
+ edge_iterator ei;
+ sese sese_region = GGC_NEW (struct sese_s);
+ sese true_region = GGC_NEW (struct sese_s);
+ sese false_region = GGC_NEW (struct sese_s);
+ ifsese if_region = GGC_NEW (struct ifsese_s);
+ edge exit = create_empty_if_region_on_edge (entry, condition);
+
+ if_region->region = sese_region;
+ if_region->region->entry = entry;
+ if_region->region->exit = exit;
+
+ FOR_EACH_EDGE (e, ei, entry->dest->succs)
+ {
+ if (e->flags & EDGE_TRUE_VALUE)
+ {
+ true_region->entry = e;
+ true_region->exit = single_succ_edge (e->dest);
+ if_region->true_region = true_region;
+ }
+ else if (e->flags & EDGE_FALSE_VALUE)
+ {
+ false_region->entry = e;
+ false_region->exit = single_succ_edge (e->dest);
+ if_region->false_region = false_region;
+ }
+ }
+
+ return if_region;
+}
+
+/* Moves REGION in a condition expression:
+ | if (1)
+ | ;
+ | else
+ | REGION;
+*/
+
+ifsese
+move_sese_in_condition (sese region)
+{
+ basic_block pred_block = split_edge (SESE_ENTRY (region));
+ ifsese if_region = NULL;
+
+ SESE_ENTRY (region) = single_succ_edge (pred_block);
+ if_region = create_if_region_on_edge (single_pred_edge (pred_block), integer_one_node);
+ if_region_set_false_region (if_region, region);
+
+ return if_region;
+}
+
+/* Reset the loop->aux pointer for all loops in REGION. */
+
+void
+sese_reset_aux_in_loops (sese region)
+{
+ int i;
+ loop_p loop;
+
+ for (i = 0; VEC_iterate (loop_p, SESE_LOOP_NEST (region), i, loop); i++)
+ loop->aux = NULL;
+}
+
+/* Returns the scalar evolution of T in REGION. Every variable that
+ is not defined in the REGION is considered a parameter. */
+
+tree
+scalar_evolution_in_region (sese region, loop_p loop, tree t)
+{
+ gimple def;
+ struct loop *def_loop;
+ basic_block before = block_before_sese (region);
+
+ if (TREE_CODE (t) != SSA_NAME
+ || loop_in_sese_p (loop, region))
+ return instantiate_scev (before, loop,
+ analyze_scalar_evolution (loop, t));
+
+ if (!defined_in_sese_p (t, region))
+ return t;
+
+ def = SSA_NAME_DEF_STMT (t);
+ def_loop = loop_containing_stmt (def);
+
+ if (loop_in_sese_p (def_loop, region))
+ {
+ t = analyze_scalar_evolution (def_loop, t);
+ def_loop = superloop_at_depth (def_loop, loop_depth (loop) + 1);
+ t = compute_overall_effect_of_inner_loop (def_loop, t);
+ return t;
+ }
+ else
+ return instantiate_scev (before, loop, t);
+}
diff --git a/gcc/sese.h b/gcc/sese.h
new file mode 100644
index 00000000000..ace63ba6719
--- /dev/null
+++ b/gcc/sese.h
@@ -0,0 +1,475 @@
+/* Single entry single exit control flow regions.
+ Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+ Contributed by Jan Sjodin <jan.sjodin@amd.com> and
+ Sebastian Pop <sebastian.pop@amd.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_SESE_H
+#define GCC_SESE_H
+
+/* A Single Entry, Single Exit region is a part of the CFG delimited
+ by two edges. */
+typedef struct sese_s
+{
+ /* Single ENTRY and single EXIT from the SESE region. */
+ edge entry, exit;
+
+ /* Parameters used within the SCOP. */
+ VEC (tree, heap) *params;
+
+ /* Used to quickly retrieve the index of a parameter in PARAMS. */
+ htab_t params_index;
+
+ /* Store the names of the parameters that are passed to CLooG. */
+ char **params_names;
+
+ /* Loops completely contained in the SCOP. */
+ bitmap loops;
+ VEC (loop_p, heap) *loop_nest;
+
+ /* Are we allowed to add more params? This is for debugging purpose. We
+ can only add new params before generating the bb domains, otherwise they
+ become invalid. */
+ bool add_params;
+} *sese;
+
+#define SESE_ENTRY(S) (S->entry)
+#define SESE_ENTRY_BB(S) (S->entry->dest)
+#define SESE_EXIT(S) (S->exit)
+#define SESE_EXIT_BB(S) (S->exit->dest)
+#define SESE_PARAMS(S) (S->params)
+#define SESE_PARAMS_INDEX(S) (S->params_index)
+#define SESE_PARAMS_NAMES(S) (S->params_names)
+#define SESE_LOOPS(S) (S->loops)
+#define SESE_LOOP_NEST(S) (S->loop_nest)
+#define SESE_ADD_PARAMS(S) (S->add_params)
+
+extern sese new_sese (edge, edge);
+extern void free_sese (sese);
+extern void sese_insert_phis_for_liveouts (sese, basic_block, edge, edge);
+extern void sese_adjust_liveout_phis (sese, htab_t, basic_block, edge, edge);
+extern void build_sese_loop_nests (sese);
+extern edge copy_bb_and_scalar_dependences (basic_block, sese, edge, htab_t);
+extern struct loop *outermost_loop_in_sese (sese, basic_block);
+extern void insert_loop_close_phis (htab_t, loop_p);
+extern void insert_guard_phis (basic_block, edge, edge, htab_t, htab_t);
+extern void sese_reset_aux_in_loops (sese);
+extern tree scalar_evolution_in_region (sese, loop_p, tree);
+
+/* Check that SESE contains LOOP. */
+
+static inline bool
+sese_contains_loop (sese sese, struct loop *loop)
+{
+ return bitmap_bit_p (SESE_LOOPS (sese), loop->num);
+}
+
+/* The number of parameters in REGION. */
+
+static inline unsigned
+sese_nb_params (sese region)
+{
+ return VEC_length (tree, SESE_PARAMS (region));
+}
+
+/* Checks whether BB is contained in the region delimited by ENTRY and
+ EXIT blocks. */
+
+static inline bool
+bb_in_region (basic_block bb, basic_block entry, basic_block exit)
+{
+#ifdef ENABLE_CHECKING
+ {
+ edge e;
+ edge_iterator ei;
+
+ /* Check that there are no edges coming in the region: all the
+ predecessors of EXIT are dominated by ENTRY. */
+ FOR_EACH_EDGE (e, ei, exit->preds)
+ dominated_by_p (CDI_DOMINATORS, e->src, entry);
+
+ /* Check that there are no edges going out of the region: the
+ entry is post-dominated by the exit. FIXME: This cannot be
+ checked right now as the CDI_POST_DOMINATORS are needed. */
+ }
+#endif
+
+ return dominated_by_p (CDI_DOMINATORS, bb, entry)
+ && !(dominated_by_p (CDI_DOMINATORS, bb, exit)
+ && !dominated_by_p (CDI_DOMINATORS, entry, exit));
+}
+
+/* Checks whether BB is contained in the region delimited by ENTRY and
+ EXIT blocks. */
+
+static inline bool
+bb_in_sese_p (basic_block bb, sese region)
+{
+ basic_block entry = SESE_ENTRY_BB (region);
+ basic_block exit = SESE_EXIT_BB (region);
+
+ return bb_in_region (bb, entry, exit);
+}
+
+/* Returns true when NAME is defined in REGION. */
+
+static inline bool
+defined_in_sese_p (tree name, sese region)
+{
+ gimple stmt = SSA_NAME_DEF_STMT (name);
+ basic_block bb = gimple_bb (stmt);
+
+ return bb && bb_in_sese_p (bb, region);
+}
+
+/* Returns true when LOOP is in REGION. */
+
+static inline bool
+loop_in_sese_p (struct loop *loop, sese region)
+{
+ return (bb_in_sese_p (loop->header, region)
+ && bb_in_sese_p (loop->latch, region));
+}
+
+/* Returns the loop depth of LOOP in REGION. The loop depth
+ is the same as the normal loop depth, but limited by a region.
+
+ Example:
+
+ loop_0
+ loop_1
+ {
+ S0
+ <- region start
+ S1
+
+ loop_2
+ S2
+
+ S3
+ <- region end
+ }
+
+ loop_0 does not exist in the region -> invalid
+ loop_1 exists, but is not completely contained in the region -> depth 0
+ loop_2 is completely contained -> depth 1 */
+
+static inline unsigned int
+sese_loop_depth (sese region, loop_p loop)
+{
+ unsigned int depth = 0;
+
+ gcc_assert ((!loop_in_sese_p (loop, region)
+ && (SESE_ENTRY_BB (region)->loop_father == loop
+ || SESE_EXIT (region)->src->loop_father == loop))
+ || loop_in_sese_p (loop, region));
+
+ while (loop_in_sese_p (loop, region))
+ {
+ depth++;
+ loop = loop_outer (loop);
+ }
+
+ return depth;
+}
+
+/* Returns the block preceding the entry of a SESE. */
+
+static inline basic_block
+block_before_sese (sese sese)
+{
+ return SESE_ENTRY (sese)->src;
+}
+
+/* Stores the INDEX in a vector for a given clast NAME. */
+
+typedef struct clast_name_index {
+ int index;
+ const char *name;
+} *clast_name_index_p;
+
+/* Returns a pointer to a new element of type clast_name_index_p built
+ from NAME and INDEX. */
+
+static inline clast_name_index_p
+new_clast_name_index (const char *name, int index)
+{
+ clast_name_index_p res = XNEW (struct clast_name_index);
+
+ res->name = name;
+ res->index = index;
+ return res;
+}
+
+/* For a given clast NAME, returns -1 if it does not correspond to any
+ parameter, or otherwise, returns the index in the PARAMS or
+ SCATTERING_DIMENSIONS vector. */
+
+static inline int
+clast_name_to_index (const char *name, htab_t index_table)
+{
+ struct clast_name_index tmp;
+ PTR *slot;
+
+ tmp.name = name;
+ slot = htab_find_slot (index_table, &tmp, NO_INSERT);
+
+ if (slot && *slot)
+ return ((struct clast_name_index *) *slot)->index;
+
+ return -1;
+}
+
+/* Records in INDEX_TABLE the INDEX for NAME. */
+
+static inline void
+save_clast_name_index (htab_t index_table, const char *name, int index)
+{
+ struct clast_name_index tmp;
+ PTR *slot;
+
+ tmp.name = name;
+ slot = htab_find_slot (index_table, &tmp, INSERT);
+
+ if (slot)
+ *slot = new_clast_name_index (name, index);
+}
+
+/* Print to stderr the element ELT. */
+
+static inline void
+debug_clast_name_index (clast_name_index_p elt)
+{
+ fprintf (stderr, "(index = %d, name = %s)\n", elt->index, elt->name);
+}
+
+/* Helper function for debug_rename_map. */
+
+static inline int
+debug_clast_name_indexes_1 (void **slot, void *s ATTRIBUTE_UNUSED)
+{
+ struct clast_name_index *entry = (struct clast_name_index *) *slot;
+ debug_clast_name_index (entry);
+ return 1;
+}
+
+/* Print to stderr all the elements of MAP. */
+
+static inline void
+debug_clast_name_indexes (htab_t map)
+{
+ htab_traverse (map, debug_clast_name_indexes_1, NULL);
+}
+
+/* Computes a hash function for database element ELT. */
+
+static inline hashval_t
+clast_name_index_elt_info (const void *elt)
+{
+ return htab_hash_pointer (((const struct clast_name_index *) elt)->name);
+}
+
+/* Compares database elements E1 and E2. */
+
+static inline int
+eq_clast_name_indexes (const void *e1, const void *e2)
+{
+ const struct clast_name_index *elt1 = (const struct clast_name_index *) e1;
+ const struct clast_name_index *elt2 = (const struct clast_name_index *) e2;
+
+ return (elt1->name == elt2->name);
+}
+
+
+
+/* A single entry single exit specialized for conditions. */
+
+typedef struct ifsese_s {
+ sese region;
+ sese true_region;
+ sese false_region;
+} *ifsese;
+
+extern void if_region_set_false_region (ifsese, sese);
+extern ifsese create_if_region_on_edge (edge, tree);
+extern ifsese move_sese_in_condition (sese);
+extern edge get_true_edge_from_guard_bb (basic_block);
+extern edge get_false_edge_from_guard_bb (basic_block);
+
+static inline edge
+if_region_entry (ifsese if_region)
+{
+ return SESE_ENTRY (if_region->region);
+}
+
+static inline edge
+if_region_exit (ifsese if_region)
+{
+ return SESE_EXIT (if_region->region);
+}
+
+static inline basic_block
+if_region_get_condition_block (ifsese if_region)
+{
+ return if_region_entry (if_region)->dest;
+}
+
+/* Structure containing the mapping between the old names and the new
+ names used after block copy in the new loop context. */
+typedef struct rename_map_elt_s
+{
+ tree old_name, expr;
+} *rename_map_elt;
+
+DEF_VEC_P(rename_map_elt);
+DEF_VEC_ALLOC_P (rename_map_elt, heap);
+
+extern void debug_rename_map (htab_t);
+extern hashval_t rename_map_elt_info (const void *);
+extern int eq_rename_map_elts (const void *, const void *);
+extern void set_rename (htab_t, tree, tree);
+
+/* Constructs a new SCEV_INFO_STR structure for VAR and INSTANTIATED_BELOW. */
+
+static inline rename_map_elt
+new_rename_map_elt (tree old_name, tree expr)
+{
+ rename_map_elt res;
+
+ res = XNEW (struct rename_map_elt_s);
+ res->old_name = old_name;
+ res->expr = expr;
+
+ return res;
+}
+
+/* Structure containing the mapping between the CLooG's induction
+ variable and the type of the old induction variable. */
+typedef struct ivtype_map_elt_s
+{
+ tree type;
+ const char *cloog_iv;
+} *ivtype_map_elt;
+
+extern void debug_ivtype_map (htab_t);
+extern hashval_t ivtype_map_elt_info (const void *);
+extern int eq_ivtype_map_elts (const void *, const void *);
+
+/* Constructs a new SCEV_INFO_STR structure for VAR and INSTANTIATED_BELOW. */
+
+static inline ivtype_map_elt
+new_ivtype_map_elt (const char *cloog_iv, tree type)
+{
+ ivtype_map_elt res;
+
+ res = XNEW (struct ivtype_map_elt_s);
+ res->cloog_iv = cloog_iv;
+ res->type = type;
+
+ return res;
+}
+
+/* Free and compute again all the dominators information. */
+
+static inline void
+recompute_all_dominators (void)
+{
+ mark_irreducible_loops ();
+ free_dominance_info (CDI_DOMINATORS);
+ free_dominance_info (CDI_POST_DOMINATORS);
+ calculate_dominance_info (CDI_DOMINATORS);
+ calculate_dominance_info (CDI_POST_DOMINATORS);
+}
+
+typedef struct gimple_bb
+{
+ basic_block bb;
+
+ /* Lists containing the restrictions of the conditional statements
+ dominating this bb. This bb can only be executed, if all conditions
+ are true.
+
+ Example:
+
+ for (i = 0; i <= 20; i++)
+ {
+ A
+
+ if (2i <= 8)
+ B
+ }
+
+ So for B there is an additional condition (2i <= 8).
+
+ List of COND_EXPR and SWITCH_EXPR. A COND_EXPR is true only if the
+ corresponding element in CONDITION_CASES is not NULL_TREE. For a
+ SWITCH_EXPR the corresponding element in CONDITION_CASES is a
+ CASE_LABEL_EXPR. */
+ VEC (gimple, heap) *conditions;
+ VEC (gimple, heap) *condition_cases;
+ VEC (data_reference_p, heap) *data_refs;
+ htab_t cloog_iv_types;
+} *gimple_bb_p;
+
+#define GBB_BB(GBB) GBB->bb
+#define GBB_DATA_REFS(GBB) GBB->data_refs
+#define GBB_CONDITIONS(GBB) GBB->conditions
+#define GBB_CONDITION_CASES(GBB) GBB->condition_cases
+#define GBB_CLOOG_IV_TYPES(GBB) GBB->cloog_iv_types
+
+/* Return the innermost loop that contains the basic block GBB. */
+
+static inline struct loop *
+gbb_loop (struct gimple_bb *gbb)
+{
+ return GBB_BB (gbb)->loop_father;
+}
+
+/* Returns the gimple loop, that corresponds to the loop_iterator_INDEX.
+ If there is no corresponding gimple loop, we return NULL. */
+
+static inline loop_p
+gbb_loop_at_index (gimple_bb_p gbb, sese region, int index)
+{
+ loop_p loop = gbb_loop (gbb);
+ int depth = sese_loop_depth (region, loop);
+
+ while (--depth > index)
+ loop = loop_outer (loop);
+
+ gcc_assert (sese_contains_loop (region, loop));
+
+ return loop;
+}
+
+/* The number of common loops in REGION for GBB1 and GBB2. */
+
+static inline int
+nb_common_loops (sese region, gimple_bb_p gbb1, gimple_bb_p gbb2)
+{
+ loop_p l1 = gbb_loop (gbb1);
+ loop_p l2 = gbb_loop (gbb2);
+ loop_p common = find_common_loop (l1, l2);
+
+ return sese_loop_depth (region, common);
+}
+
+extern void print_gimple_bb (FILE *, gimple_bb_p, int, int);
+extern void debug_gbb (gimple_bb_p, int);
+
+#endif
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 91f03a311c6..7f40aae212b 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2097,6 +2097,7 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
/* x*2 is x+x and x*(-1) is -x */
if (GET_CODE (trueop1) == CONST_DOUBLE
&& SCALAR_FLOAT_MODE_P (GET_MODE (trueop1))
+ && !DECIMAL_FLOAT_MODE_P (GET_MODE (trueop1))
&& GET_MODE (op0) == mode)
{
REAL_VALUE_TYPE d;
diff --git a/gcc/stmt.c b/gcc/stmt.c
index d544080a3c1..fe60ba67150 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1511,24 +1511,22 @@ expand_naked_return (void)
static void
expand_value_return (rtx val)
{
- /* Copy the value to the return location
- unless it's already there. */
+ /* Copy the value to the return location unless it's already there. */
- rtx return_reg = DECL_RTL (DECL_RESULT (current_function_decl));
+ tree decl = DECL_RESULT (current_function_decl);
+ rtx return_reg = DECL_RTL (decl);
if (return_reg != val)
{
- tree type = TREE_TYPE (DECL_RESULT (current_function_decl));
- if (targetm.calls.promote_function_return (TREE_TYPE (current_function_decl)))
- {
- int unsignedp = TYPE_UNSIGNED (type);
- enum machine_mode old_mode
- = DECL_MODE (DECL_RESULT (current_function_decl));
- enum machine_mode mode
- = promote_mode (type, old_mode, &unsignedp, 1);
-
- if (mode != old_mode)
- val = convert_modes (mode, old_mode, val, unsignedp);
- }
+ tree funtype = TREE_TYPE (current_function_decl);
+ tree type = TREE_TYPE (decl);
+ int unsignedp = TYPE_UNSIGNED (type);
+ enum machine_mode old_mode = DECL_MODE (decl);
+ enum machine_mode mode = promote_function_mode (type, old_mode,
+ &unsignedp, funtype, 1);
+
+ if (mode != old_mode)
+ val = convert_modes (mode, old_mode, val, unsignedp);
+
if (GET_CODE (return_reg) == PARALLEL)
emit_group_load (return_reg, val, type, int_size_in_bytes (type));
else
@@ -1848,9 +1846,7 @@ expand_decl (tree decl)
else if (use_register_for_decl (decl))
{
/* Automatic variable that can go in a register. */
- int unsignedp = TYPE_UNSIGNED (type);
- enum machine_mode reg_mode
- = promote_mode (type, DECL_MODE (decl), &unsignedp, 0);
+ enum machine_mode reg_mode = promote_decl_mode (decl, NULL);
SET_DECL_RTL (decl, gen_reg_rtx (reg_mode));
diff --git a/gcc/system.h b/gcc/system.h
index 7a9ca816693..5d47f2e1839 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -684,7 +684,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
DIVDI3_LIBCALL UDIVSI3_LIBCALL UDIVDI3_LIBCALL MODSI3_LIBCALL \
MODDI3_LIBCALL UMODSI3_LIBCALL UMODDI3_LIBCALL BUILD_VA_LIST_TYPE \
PRETEND_OUTGOING_VARARGS_NAMED STRUCT_VALUE_INCOMING_REGNUM \
- ASM_OUTPUT_SECTION_NAME PROMOTE_FUNCTION_ARGS \
+ ASM_OUTPUT_SECTION_NAME PROMOTE_FUNCTION_ARGS PROMOTE_FUNCTION_MODE \
STRUCT_VALUE_INCOMING STRICT_ARGUMENT_NAMING \
PROMOTE_FUNCTION_RETURN PROMOTE_PROTOTYPES STRUCT_VALUE_REGNUM \
SETUP_INCOMING_VARARGS EXPAND_BUILTIN_SAVEREGS \
@@ -754,7 +754,8 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
LANG_HOOKS_PUSHLEVEL LANG_HOOKS_SET_BLOCK \
LANG_HOOKS_MAYBE_BUILD_CLEANUP LANG_HOOKS_UPDATE_DECL_AFTER_SAVING \
- LANG_HOOKS_POPLEVEL LANG_HOOKS_TRUTHVALUE_CONVERSION
+ LANG_HOOKS_POPLEVEL LANG_HOOKS_TRUTHVALUE_CONVERSION \
+ TARGET_PROMOTE_FUNCTION_ARGS TARGET_PROMOTE_FUNCTION_RETURN
/* Miscellaneous macros that are no longer used. */
#pragma GCC poison USE_MAPPED_LOCATION
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 96e5ba6b330..7f740097374 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -574,8 +574,7 @@
#define TARGET_ARM_EABI_UNWINDER false
-#define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_const_tree_false
-#define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_const_tree_false
+#define TARGET_PROMOTE_FUNCTION_MODE default_promote_function_mode
#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_false
#define TARGET_STRUCT_VALUE_RTX hook_rtx_tree_int_null
@@ -599,14 +598,14 @@
#define TARGET_ARG_PARTIAL_BYTES hook_int_CUMULATIVE_ARGS_mode_tree_bool_0
#define TARGET_FUNCTION_VALUE default_function_value
+#define TARGET_LIBCALL_VALUE default_libcall_value
#define TARGET_INTERNAL_ARG_POINTER default_internal_arg_pointer
#define TARGET_UPDATE_STACK_BOUNDARY NULL
#define TARGET_GET_DRAP_RTX NULL
#define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS hook_bool_void_true
#define TARGET_CALLS { \
- TARGET_PROMOTE_FUNCTION_ARGS, \
- TARGET_PROMOTE_FUNCTION_RETURN, \
+ TARGET_PROMOTE_FUNCTION_MODE, \
TARGET_PROMOTE_PROTOTYPES, \
TARGET_STRUCT_VALUE_RTX, \
TARGET_RETURN_IN_MEMORY, \
@@ -622,6 +621,7 @@
TARGET_ARG_PARTIAL_BYTES, \
TARGET_INVALID_ARG_FOR_UNPROTOTYPED_FN, \
TARGET_FUNCTION_VALUE, \
+ TARGET_LIBCALL_VALUE, \
TARGET_INTERNAL_ARG_POINTER, \
TARGET_UPDATE_STACK_BOUNDARY, \
TARGET_GET_DRAP_RTX, \
@@ -632,10 +632,6 @@
#define TARGET_UNWIND_TABLES_DEFAULT false
#endif
-#ifndef TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME
-#define TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME 0
-#endif
-
#ifndef TARGET_HANDLE_PRAGMA_EXTERN_PREFIX
#define TARGET_HANDLE_PRAGMA_EXTERN_PREFIX 0
#endif
@@ -957,7 +953,6 @@
TARGET_TERMINATE_DW2_EH_FRAME_INFO, \
TARGET_ASM_FILE_START_APP_OFF, \
TARGET_ASM_FILE_START_FILE_DIRECTIVE, \
- TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME, \
TARGET_HANDLE_PRAGMA_EXTERN_PREFIX, \
TARGET_RELAXED_ORDERING, \
TARGET_ARM_EABI_UNWINDER \
diff --git a/gcc/target.h b/gcc/target.h
index bd107179498..786f98793ac 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -832,8 +832,11 @@ struct gcc_target
/* Functions relating to calls - argument passing, returns, etc. */
struct calls {
- bool (*promote_function_args) (const_tree fntype);
- bool (*promote_function_return) (const_tree fntype);
+ enum machine_mode (*promote_function_mode) (const_tree type,
+ enum machine_mode mode,
+ int *punsignedp,
+ const_tree fntype,
+ int for_return);
bool (*promote_prototypes) (const_tree fntype);
rtx (*struct_value_rtx) (tree fndecl, int incoming);
bool (*return_in_memory) (const_tree type, const_tree fndecl);
@@ -889,6 +892,10 @@ struct gcc_target
rtx (*function_value) (const_tree ret_type, const_tree fn_decl_or_type,
bool outgoing);
+ /* Return the rtx for the result of a libcall of mode MODE,
+ calling the function FN_NAME. */
+ rtx (*libcall_value) (enum machine_mode, rtx);
+
/* Return an rtx for the argument pointer incoming to the
current function. */
rtx (*internal_arg_pointer) (void);
@@ -1117,9 +1124,6 @@ struct gcc_target
at the beginning of assembly output. */
bool file_start_file_directive;
- /* True if #pragma redefine_extname is to be supported. */
- bool handle_pragma_redefine_extname;
-
/* True if #pragma extern_prefix is to be supported. */
bool handle_pragma_extern_prefix;
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 7d5a09233c7..7535bc10ab7 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -113,6 +113,29 @@ default_unspec_may_trap_p (const_rtx x, unsigned flags)
}
enum machine_mode
+default_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ int *punsignedp ATTRIBUTE_UNUSED,
+ const_tree funtype ATTRIBUTE_UNUSED,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ if (for_return == 2)
+ return promote_mode (type, mode, punsignedp);
+ return mode;
+}
+
+enum machine_mode
+default_promote_function_mode_always_promote (const_tree type,
+ enum machine_mode mode,
+ int *punsignedp,
+ const_tree funtype ATTRIBUTE_UNUSED,
+ int for_return ATTRIBUTE_UNUSED)
+{
+ return promote_mode (type, mode, punsignedp);
+}
+
+
+enum machine_mode
default_cc_modes_compatible (enum machine_mode m1, enum machine_mode m2)
{
if (m1 == m2)
@@ -585,6 +608,12 @@ default_function_value (const_tree ret_type ATTRIBUTE_UNUSED,
}
rtx
+default_libcall_value (enum machine_mode mode, rtx fun ATTRIBUTE_UNUSED)
+{
+ return LIBCALL_VALUE (mode);
+}
+
+rtx
default_internal_arg_pointer (void)
{
/* If the reg that the virtual arg pointer will be translated into is
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 839f1c32360..4e5f631e76c 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -24,6 +24,10 @@ extern void default_external_libcall (rtx);
extern rtx default_legitimize_address (rtx, rtx, enum machine_mode);
extern int default_unspec_may_trap_p (const_rtx, unsigned);
+extern enum machine_mode default_promote_function_mode (const_tree, enum machine_mode,
+ int *, const_tree, int);
+extern enum machine_mode default_promote_function_mode_always_promote
+ (const_tree, enum machine_mode, int *, const_tree, int);
extern enum machine_mode default_cc_modes_compatible (enum machine_mode,
enum machine_mode);
@@ -90,6 +94,7 @@ extern const char *hook_invalid_arg_for_unprototyped_fn
(const_tree, const_tree, const_tree);
extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
extern rtx default_function_value (const_tree, const_tree, bool);
+extern rtx default_libcall_value (enum machine_mode, rtx);
extern rtx default_internal_arg_pointer (void);
extern enum reg_class default_branch_target_register_class (void);
#ifdef IRA_COVER_CLASSES
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e3b61034dc9..385c982c88d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,849 @@
+2009-08-18 DJ Delorie <dj@redhat.com>
+
+ * lib/wrapper.exp (${tool}_maybe_build_wrapper): Set up
+ GCC_EXEC_PREFIX before building the wrapper.
+
+2009-08-18 Nathan Froyd <froydnj@codesourcery.com>
+
+ * gcc.dg/vect/vect.exp: Add new stanza for aligned-section-anchors-*
+ tests.
+ * gcc.dg/vect/section-anchors-nest-1.c: Rename to...
+ * gcc.dg/vect/aligned-section-anchors-nest-1.c: ...this. Remove
+ dg-options. Fix dg-final clause.
+
+2009-08-18 Uros Bizjak <ubizjak@gmail.com>
+
+ * g++.dg/cdce3.C: Add -mieee for alpha*-*-* targets.
+
+2009-08-18 Janus Weil <janus@gcc.gnu.org>
+ Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40870
+ * gfortran.dg/proc_ptr_comp_13.f90: Extended.
+
+2009-08-18 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41094
+ * gcc.dg/torture/pr41094.c: New testcase.
+ * gcc.dg/torture/builtin-power-1.c: Adjust.
+ * gcc.dg/builtins-10.c: Likewise.
+
+2009-08-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/40971
+ * gcc.dg/pr40971.c: New test.
+
+2008-08-17 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/41062
+ * gfortran.dg/use_only_4.f90: New test.
+
+2009-08-17 Daniel Kraft <d@domob.eu>
+
+ PR fortran/37425
+ * gfortran.dg/typebound_operator_2.f03: Test for error with illegal
+ NOPASS bindings as operators.
+
+2009-08-17 Uros Bizjak <ubizjak@gmail.com>
+
+ * lib/target-supports.exp
+ (check_effective_target_vect_cmdline_needed): Add alpha to the list
+ of targets that do not need command line argument to enable SIMD.
+
+2009-08-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * lib/target-supports.exp (check_effective_target_mpc_pow): Fix
+ typo in cache name.
+
+2009-08-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/41075
+ * gfortran.dg/unlimited_fmt_1.f90: New test.
+
+2009-08-17 Dodji Seketeli <dodji@redhat.com>
+
+ * gcc.dg.debug/dwarf2/inline2.c: Add -dA to compile options.
+
+2009-08-17 Arnaud Charlet <charlet@adacore.com>
+
+ * gnat.dg/itype.ad[sb]: New test.
+
+2009-08-16 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/mips.exp: Add terminology section to comment
+ at the top of the file. Fix typos.
+
+2009-08-16 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/debug/dwarf2/inline1.C: New.
+
+2009-08-16 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR target/38599
+ * gcc.target/mips/smartmips-lwxs.c: Remove -mlong32.
+
+2009-08-16 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/37801
+ * gcc/testsuite/gcc.dg/debug/20020224-1.c: Adjust the comment.
+ Make sure to trigger inlining optimizations.
+ * gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c: New test.
+
+2009-08-14 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41070
+ * gfortran.dg/structure_constructor_10.f90: New.
+
+2009-08-14 Olatunji Ruwase <tjruwase@google.com>
+
+ * gcc.dg/pragma-re-1.c: Supported on all platforms.
+ * gcc.dg/pragma-re-2.c: Likewise.
+ * gcc.dg/pragma-re-3.c: Likewise.
+ * gcc.dg/pragma-re-4.c: Likewise.
+ * g++.dg/other/pragma-re-1.C: Likewise.
+ * g++.dg/other/pragma-re-2.C: Likewise.
+
+2009-08-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gcc.dg/torture/builtin-math-7.c: New.
+
+2009-08-14 Richard Guenther <rguenther@suse.de>
+
+ * gcc.c-torture/execute/20090814-1.c: New testcase.
+
+2009-08-14 David Edelsohn <edelsohn@gnu.org>
+
+ * gcc.dg/graphite/graphite_autopar: Move to libgomp testsuite.
+
+2009-08-14 Paolo Bonzini <bonzini@gnu.org>
+
+ PR target/40934
+ * gcc.target/i386/pr40934.c: New.
+
+2009-08-14 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/41019
+ * gcc.target/i386/pr41019.c: New test.
+
+2009-08-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/40955
+ * gfortran.dg/winapi.f90: New test.
+
+2009-08-13 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40995
+ * gfortran.dg/intrinsic_4.f90: New.
+ * gfortran.dg/intrinsic_subroutine.f90: An error message moved to a
+ different line.
+
+2009-08-13 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41047
+ * gcc.dg/tree-ssa/ssa-ccp-27.c: New testcase.
+
+2009-08-12 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/41011
+ * gfortran.dg/pr41011.f: New testcase.
+
+2009-08-11 Andrew Haley <aph@redhat.com>
+
+ * gcc.target/arm/synchronize.c: New file.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/40980
+ * testsuite/gfortran.dg/graphite/id-17.f: New.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * testsuite/gcc.dg/graphite/interchange-6.c: Un-XFAIL.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+ Pranav Garg <pranav.garg2107@gmail.com>
+
+ * testsuite/gcc.dg/graphite/interchange-6.c: XFAILed.
+
+2009-08-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/interchange-9.c: New.
+
+2009-08-12 Richard Guenther <rguenther@suse.de>
+
+ PR rtl-optimization/41033
+ * gcc.dg/pr41033.c: New test.
+
+2009-08-11 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41022
+ * gfortran.dg/proc_ptr_comp_14.f90: New.
+
+2009-08-11 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/ext-5.c: New test.
+ * gcc.target/mips/ext-6.c: New test.
+ * gcc.target/mips/ext-7.c: New test.
+ * gcc.target/mips/ext-8.c: New test.
+ * gcc.target/mips/extend-2.c: New test.
+
+2009-08-10 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/other/linkage2.C: New test for types-without-linkage
+ handling.
+ * g++.dg/ext/anon-struct4.C: No error about anonymous type.
+ * g++.dg/lookup/anon2.C: Likewise.
+ * g++.dg/other/anon3.C: Likewise.
+ * g++.dg/template/arg2.C: Likewise.
+ * g++.dg/template/local4.C: Likewise.
+ * g++.old-deja/g++.law/operators32.C: Likewise.
+ * g++.old-deja/g++.other/linkage2.C: Likewise.
+ * g++.old-deja/g++.pt/enum6.C: Likewise.
+ * g++.old-deja/g++.other/anon9.C: Use the undefined decls.
+ * g++.old-deja/g++.other/linkage1.C: Likewise.
+
+2009-08-10 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ * gcc.dg/dg.exp: Test also c-c++-common dir.
+ * g++.dg/dg.exp: Likewise.
+ * g++.dg/warn/Wconversion-real.C: Delete.
+ * gcc.dg/Wconversion-real.c: Move to ...
+ * c-c++-common/Wconversion-real.c: ... here.
+ * lib/target-supports.exp
+ (check_effective_target_c,check_effective_target_c++): New.
+
+2009-08-10 Daniel Kraft <d@domob.eu>
+
+ PR fortran/37425
+ * gfortran.dg/typebound_operator_1.f03: New test.
+ * gfortran.dg/typebound_operator_2.f03: New test.
+
+2009-08-10 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/41006
+ * gcc.c-torture/compile/pr41006-1.c: New testcase.
+ * gcc.c-torture/compile/pr41006-2.c: Likewise.
+
+2009-08-10 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40940
+ * gfortran.dg/class_1.f03: New.
+ * gfortran.dg/class_2.f03: New.
+ * gfortran.dg/proc_ptr_comp_pass_1.f90: Use CLASS instead of TYPE.
+ * gfortran.dg/proc_ptr_comp_pass_2.f90: Ditto.
+ * gfortran.dg/proc_ptr_comp_pass_3.f90: Ditto.
+ * gfortran.dg/typebound_call_10.f03: Ditto.
+ * gfortran.dg/typebound_call_2.f03: Ditto.
+ * gfortran.dg/typebound_call_3.f03: Ditto.
+ * gfortran.dg/typebound_call_4.f03: Ditto.
+ * gfortran.dg/typebound_generic_3.f03: Ditto.
+ * gfortran.dg/typebound_generic_4.f03: Ditto.
+ * gfortran.dg/typebound_proc_1.f08: Ditto.
+ * gfortran.dg/typebound_proc_5.f03: Ditto.
+ * gfortran.dg/typebound_proc_6.f03: Ditto.
+
+2009-08-10 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/40866
+ * g++.dg/expr/stmt-expr-1.C: New test.
+
+2009-08-09 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/41016
+ * gcc.c-torture/compile/pr41016.c: New testcase.
+
+2009-08-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * gcc.dg/overflow-warn-8.c: New test.
+
+2009-08-09 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/41008
+ * gcc.dg/vect/O1-pr41008.c: New test.
+
+2009-08-05 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40955
+ * gfortran.dg/module_md5_1.f90: Update MD5 check sum.
+
+2009-08-09 Bernd Schmidt <bernd.schmidt@analog.com>
+
+ * gcc.target/bfin/loop-autoinc.c: New file.
+
+2009-08-08 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40991
+ * g++.dg/torture/pr40991.C: New testcase.
+
+2009-08-08 Laurent GUERBY <laurent@guerby.net>
+
+ * ada/acats/support/impdef.a: Tweak timing constants. Add
+ Long_Minimum_Task_Switch and Long_Switch_To_New_Task.
+ * ada/acats/tests/c9/c940005.a: Use new timing constants.
+ * ada/acats/tests/c9/c940007.a: Likewise.
+ * ada/acats/tests/c9/c94001c.ada: Likewise.
+ * ada/acats/tests/c9/c94006a.ada: Likewise.
+ * ada/acats/tests/c9/c94008c.ada: Likewise.
+ * ada/acats/tests/c9/c951002.a: Likewise.
+ * ada/acats/tests/c9/c954a01.a: Likewise.
+ * ada/acats/tests/c9/c96001a.ada: Likewise.
+ * ada/acats/tests/c9/c97307a.ada: Likewise.
+
+2009-08-07 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40999
+ * gfortran.dg/pr40999.f: New testcase.
+
+2009-08-07 Jakub Jelinek <jakub@redhat.com>
+
+ * g++.dg/tree-prof/partition1.C: New test.
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ * gcc.target/arm/abitest.h: Allow the test function to have a PCS
+ attribute.
+ * gcc.target/arm/vfp1[567].c: New tests.
+
+2009-08-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/40948
+ * g++.dg/ext/complit12.C: Expand.
+
+2009-08-06 Richard Earnshaw <rearnsha@arm.com>
+
+ Merge ARM/hard_vfp_branch to trunk.
+
+ 2009-08-04 Richard Earnshaw <rearnsha@arm.com>
+
+ * gcc.target/arm/mmx-1.c: Skip if using -mfloat-abi=hard.
+ * gcc.dg/builtin-apply2.c: Skip for ARM if using -mfloat-abi=hard.
+
+ 2009-05-12 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.target/arm/eabi1.c: Do not skip for non-base ABI variants.
+ (PCS): Define macro to use base AAPCS.
+ (decl_float, __aeabi_d2f, __aeabi_f2d): Use PCS macro.
+
+ 2009-05-11 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target_arm_neon_ok):
+ Correct arm_neon.h typo.
+
+ 2009-03-06 Richard Earnshaw <rearnsha@arm.com>
+
+ * lib/target-supports.exp (check_effective_target_hard_vfp_ok): Make
+ this a linkage test.
+ * gcc.target/arm/aapcs/aapcs.exp: New framework for testing AAPCS
+ argument marshalling.
+ * abitest.h: New file.
+ * vfp1.c, vfp2.c, vfp3.c, vfp4.c, vfp5.c, vfp6.c, vfp7.c: New tests.
+ * vfp8.c, vfp9.c, vfp10.c, vfp11.c, vfp12.c, vfp13.c, vfp14.c: New.
+
+2009-08-06 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/32964
+ * gcc.dg/tree-ssa/pr32964.c: New test.
+
+2009-08-06 Uros Bizjak <ubizjak@gmail.com>
+ H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/40957
+ * gcc.target/i386/pr40957.c: New test.
+
+2009-08-06 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40964
+ * gcc.c-torture/compile/pr40964.c: New testcase.
+
+2009-08-05 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40847
+ * gfortran.dg/transfer_resolve_1.f90 : New test.
+
+2009-08-05 Uros Bizjak <ubizjak@gmail.com>
+ Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
+
+ PR target/40906
+ * gcc.target/i386/pr40906-1.c: New test.
+ * gcc.target/i386/pr40906-2.c: Ditto.
+ * gcc.target/i386/pr40906-3.c: Ditto.
+
+2009-08-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/40924
+ * g++.dg/torture/pr40924.C: New test.
+
+2009-08-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/36069
+ * g++.dg/warn/pr36069.C: New.
+
+2009-08-04 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/39987
+ * g++.dg/overload/defarg4.C: New test.
+
+2009-08-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/16696
+ * g++.dg/parse/pr16696.C: New.
+ * g++.dg/parse/pr16696-permissive.C: New.
+
+2009-08-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40875
+ * gfortran.dg/initialization_23.f90 : New test.
+
+2009-08-04 Dodji Seketeli <dodji@redhat.com>
+
+ PR debug/39706
+ * g++.dg/debug/dwarf2/pubnames-1.C: New test.
+
+2009-08-03 Jason Merrill <jason@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/40948
+ * g++.dg/ext/complit12.C: New.
+
+2009-08-03 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/39902
+ * gcc.target/powerpc/pr39902-2.c: New test.
+
+2009-08-03 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/40943
+ * gcc.dg/uninit-6.c: Re-add XFAIL.
+ * gcc.dg/uninit-6-O0.c: Likewise.
+ * gcc.dg/uninit-pr40943.c: New test.
+
+2009-08-03 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR testsuite/40858
+ * g++.dg/debug/dwarf2/typedef1.C: Also match assembler string used with
+ .ascii.
+
+2009-08-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/40853
+ * gfortran.dg/namelist_40.f90: Update error output.
+ * gfortran.dg/namelist_47.f90: Update error output.
+ * gfortran.dg/namelist_58.f90: New test.
+
+2009-08-02 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40881
+ * gfortran.dg/aliasing_dummy_1.f90: Add -std=legacy.
+ * gfortran.dg/altreturn_3.f90: Ditto.
+ * gfortran.dg/altreturn_5.f90: Ditto.
+ * gfortran.dg/altreturn_6.f90: Ditto.
+ * gfortran.dg/altreturn_7.f90: Ditto.
+ * gfortran.dg/array_constructor_13.f90: Ditto.
+ * gfortran.dg/arrayio_7.f90: Ditto.
+ * gfortran.dg/arrayio_8.f90: Ditto.
+ * gfortran.dg/assumed_charlen_function_3.f90: Modified warning message.
+ * gfortran.dg/assumed_charlen_function_4.f90: Add -std=legacy.
+ * gfortran.dg/assumed_charlen_function_5.f90: Modified warning message.
+ * gfortran.dg/backspace_8.f: Add -std=legacy.
+ * gfortran.dg/backspace_9.f: Ditto.
+ * gfortran.dg/char_comparison_1.f: Ditto.
+ * gfortran.dg/char_decl_1.f90: Ditto.
+ * gfortran.dg/char_initialiser_actual.f90: Ditto.
+ * gfortran.dg/char_pointer_assign.f90: Ditto.
+ * gfortran.dg/char_pointer_dependency.f90: Ditto.
+ * gfortran.dg/char_pointer_dummy.f90: Ditto.
+ * gfortran.dg/char_pointer_func.f90: Ditto.
+ * gfortran.dg/common_8.f90: Ditto.
+ * gfortran.dg/constant_substring.f: Ditto.
+ * gfortran.dg/data_char_2.f90: Ditto.
+ * gfortran.dg/der_array_io_1.f90: Ditto.
+ * gfortran.dg/der_array_io_2.f90: Ditto.
+ * gfortran.dg/der_array_io_3.f90: Ditto.
+ * gfortran.dg/der_io_3.f90: Ditto.
+ * gfortran.dg/dev_null.F90: Ditto.
+ * gfortran.dg/direct_io_2.f90: Ditto.
+ * gfortran.dg/do_iterator_2.f90: Ditto.
+ * gfortran.dg/e_d_fmt.f90: Ditto.
+ * gfortran.dg/empty_format_1.f90: Ditto.
+ * gfortran.dg/entry_17.f90: Modified warning message.
+ * gfortran.dg/entry_7.f90: Add -std=legacy.
+ * gfortran.dg/eor_1.f90: Ditto.
+ * gfortran.dg/equiv_2.f90: Ditto.
+ * gfortran.dg/equiv_constraint_2.f90: Use new-style character length.
+ * gfortran.dg/equiv_substr.f90: Add -std=legacy.
+ * gfortran.dg/extended_char_comparison_1.f: Ditto.
+ * gfortran.dg/fmt_bz_bn_err.f: Ditto.
+ * gfortran.dg/fmt_error_2.f90: Ditto.
+ * gfortran.dg/fmt_read_bz_bn.f90: Ditto.
+ * gfortran.dg/fmt_tl.f: Ditto.
+ * gfortran.dg/fmt_white.f: Ditto.
+ * gfortran.dg/func_derived_1.f90: Ditto.
+ * gfortran.dg/g77_intrinsics_funcs.f: Ditto.
+ * gfortran.dg/g77_intrinsics_sub.f: Ditto.
+ * gfortran.dg/global_references_2.f90: Ditto.
+ * gfortran.dg/hollerith_1.f90: Ditto.
+ * gfortran.dg/hollerith.f90: Use new-style character length.
+ * gfortran.dg/hollerith_f95.f90: Ditto.
+ * gfortran.dg/ichar_1.f90: Add -std=legacy.
+ * gfortran.dg/implicit_6.f90: Ditto.
+ * gfortran.dg/implicit_9.f90: Ditto.
+ * gfortran.dg/inquire_13.f90: Ditto.
+ * gfortran.dg/inquire_5.f90: Ditto.
+ * gfortran.dg/inquire_6.f90: Ditto.
+ * gfortran.dg/inquire.f90: Ditto.
+ * gfortran.dg/io_constraints_1.f90: Use new-style character length.
+ * gfortran.dg/io_constraints_2.f90: Ditto.
+ * gfortran.dg/list_read_2.f90: Add -std=legacy.
+ * gfortran.dg/loc_2.f90: Ditto.
+ * gfortran.dg/logical_1.f90: Ditto.
+ * gfortran.dg/longline.f: Ditto.
+ * gfortran.dg/merge_char_1.f90: Ditto.
+ * gfortran.dg/namelist_12.f: Ditto.
+ * gfortran.dg/namelist_14.f90: Ditto.
+ * gfortran.dg/namelist_18.f90: Ditto.
+ * gfortran.dg/namelist_19.f90: Ditto.
+ * gfortran.dg/namelist_21.f90: Ditto.
+ * gfortran.dg/namelist_22.f90: Ditto.
+ * gfortran.dg/namelist_37.f90: Ditto.
+ * gfortran.dg/namelist_54.f90: Ditto.
+ * gfortran.dg/namelist_55.f90: Ditto.
+ * gfortran.dg/namelist_empty.f90: Ditto.
+ * gfortran.dg/namelist_use.f90: Use new-style character length.
+ * gfortran.dg/namelist_use_only.f90: Add -std=legacy.
+ * gfortran.dg/nested_modules_4.f90: Ditto.
+ * gfortran.dg/nested_modules_5.f90: Ditto.
+ * gfortran.dg/open-options-blanks.f: Ditto.
+ * gfortran.dg/output_exponents_1.f90: Ditto.
+ * gfortran.dg/parens_5.f90: Ditto.
+ * gfortran.dg/parens_6.f90: Ditto.
+ * gfortran.dg/parent_result_ref_2.f90: Modified warning message.
+ * gfortran.dg/pointer_function_actual_1.f90: Add -std=legacy.
+ * gfortran.dg/pr15129.f90: Ditto.
+ * gfortran.dg/pr15332.f: Ditto.
+ * gfortran.dg/pr16597.f90: Ditto.
+ * gfortran.dg/pr17143.f90: Ditto.
+ * gfortran.dg/pr17164.f90: Ditto.
+ * gfortran.dg/pr17229.f: Modified warning message.
+ * gfortran.dg/pr18210.f90: Add -std=legacy.
+ * gfortran.dg/pr19155.f: Ditto.
+ * gfortran.dg/pr20086.f90: Ditto.
+ * gfortran.dg/pr20124.f90: Ditto.
+ * gfortran.dg/pr20755.f: Ditto.
+ * gfortran.dg/pr20865.f90: Ditto.
+ * gfortran.dg/pr20950.f: Ditto.
+ * gfortran.dg/pr21730.f: Ditto.
+ * gfortran.dg/pr22491.f: Ditto.
+ * gfortran.dg/pr29713.f90: Ditto.
+ * gfortran.dg/print_parentheses_1.f: Ditto.
+ * gfortran.dg/print_parentheses_2.f90: Ditto.
+ * gfortran.dg/proc_assign_1.f90: Ditto.
+ * gfortran.dg/proc_decl_1.f90: Ditto.
+ * gfortran.dg/proc_ptr_17.f90: Add dg-warning.
+ * gfortran.dg/read_eor.f90: : Add -std=legacy.
+ * gfortran.dg/read_float_1.f90: Ditto.
+ * gfortran.dg/read_logical.f90: Ditto.
+ * gfortran.dg/recursive_statement_functions.f90: Ditto.
+ * gfortran.dg/return_1.f90: Ditto.
+ * gfortran.dg/rewind_1.f90: Ditto.
+ * gfortran.dg/runtime_warning_1.f90: Use new-style character length.
+ * gfortran.dg/scalar_return_1.f90: Add -std=legacy.
+ * gfortran.dg/stfunc_1.f90: Ditto.
+ * gfortran.dg/stfunc_3.f90: Ditto.
+ * gfortran.dg/stfunc_4.f90: Ditto.
+ * gfortran.dg/stfunc_6.f90: Ditto.
+ * gfortran.dg/streamio_2.f90: Ditto.
+ * gfortran.dg/string_ctor_1.f90: Ditto.
+ * gfortran.dg/string_null_compare_1.f: Ditto.
+ * gfortran.dg/substr_6.f90: Ditto.
+ * gfortran.dg/tl_editing.f90: Ditto.
+ * gfortran.dg/unf_io_convert_1.f90: Use new-style character length.
+ * gfortran.dg/warnings_are_errors_1.f90: Modified warning message.
+ * gfortran.dg/x_slash_1.f: Add -std=legacy.
+ * gfortran.dg/g77/1832.f: Ditto.
+ * gfortran.dg/g77/19981216-0.f Ditto.
+ * gfortran.dg/g77/19990525-0.f: Ditto.
+ * gfortran.dg/g77/19990826-2.f: Ditto.
+ * gfortran.dg/g77/20000630-2.f: Ditto.
+ * gfortran.dg/g77/20010116.f: Ditto.
+ * gfortran.dg/g77/20010519-1.f: Use new-style character length.
+ * gfortran.dg/g77/980419-2.f: Add -std=legacy.
+ * gfortran.dg/g77/980520-1.f: Ditto.
+ * gfortran.dg/g77/check0.f: Ditto.
+ * gfortran.dg/g77/cpp3.F: Ditto.
+ * gfortran.dg/g77/cpp4.F: Use new-style character length.
+ * gfortran.dg/g77/f77-edit-i-in.f: Add -std=legacy.
+ * gfortran.dg/g77/f77-edit-t-in.f: Ditto.
+ * gfortran.dg/g77/short.f: Ditto.
+
+2009-08-01 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/ext-3.c: Add NOMIPS16.
+ * gcc.target/mips/ext-4.c: Likewise.
+ * gcc.target/mips/interrupt_handler.c: Likewise.
+ * gcc.target/mips/truncate-4.c: Likewise.
+ * gcc.target/mips/truncate-5.c: Likewise.
+
+2009-08-01 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: Rename
+ -fgraphite-force-parallel to -floop-parallelize-all.
+
+2009-08-01 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/40011
+ * gfortran.dg/whole_file_7.f90: New test.
+ * gfortran.dg/whole_file_8.f90: New test.
+ * gfortran.dg/whole_file_9.f90: New test.
+ * gfortran.dg/whole_file_10.f90: New test.
+ * gfortran.dg/whole_file_11.f90: New test.
+ * gfortran.dg/whole_file_12.f90: New test.
+ * gfortran.dg/whole_file_13.f90: New test.
+ * gfortran.dg/whole_file_14.f90: New test.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/initlist22.C: Adjust for new rvalue reference
+ binding semantics.
+ * g++.dg/cpp0x/named.C: Likewise.
+ * g++.dg/cpp0x/overload.C: Likewise.
+ * g++.dg/cpp0x/rv1n.C: Likewise.
+ * g++.dg/cpp0x/rv1p.C: Likewise.
+ * g++.dg/cpp0x/rv2n.C: Likewise.
+ * g++.dg/cpp0x/rv2p.C: Likewise.
+ * g++.dg/cpp0x/rv3n.C: Likewise.
+ * g++.dg/cpp0x/rv3p.C: Likewise.
+ * g++.dg/cpp0x/rv4n.C: Likewise.
+ * g++.dg/cpp0x/rv4p.C: Likewise.
+ * g++.dg/cpp0x/rv5n.C: Likewise.
+ * g++.dg/cpp0x/rv5p.C: Likewise.
+ * g++.dg/cpp0x/rv6n.C: Likewise.
+ * g++.dg/cpp0x/rv6p.C: Likewise.
+ * g++.dg/cpp0x/rv7n.C: Likewise.
+ * g++.dg/cpp0x/rv7p.C: Likewise.
+ * g++.dg/cpp0x/template_deduction.C: Likewise.
+ * g++.dg/cpp0x/unnamed_refs.C: Likewise.
+ * g++.dg/cpp0x/overloadn.C: New.
+ * g++.dg/cpp0x/rv-cast.C: New.
+
+2009-07-31 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.target/mips/ext-4.c: New test.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * g++.dg/tree-ssa/pr33615.C: Fix pattern for lim.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/tree-ssa/20050314-1.c: Fix patterns for lim and dceloop.
+ * gcc.dg/tree-ssa/loop-32.c: Same.
+ * gcc.dg/tree-ssa/loop-33.c: Same.
+ * gcc.dg/tree-ssa/loop-34.c: Same.
+ * gcc.dg/tree-ssa/loop-35.c: Same.
+ * gcc.dg/tree-ssa/loop-7.c: Same.
+ * gcc.dg/tree-ssa/pr23109.c: Same.
+ * gcc.dg/tree-ssa/restrict-2.c: Same.
+ * gcc.dg/tree-ssa/restrict-3.c: Same.
+ * gcc.dg/tree-ssa/ssa-lim-1.c: Same.
+ * gcc.dg/tree-ssa/ssa-lim-2.c: Same.
+ * gcc.dg/tree-ssa/ssa-lim-3.c: Same.
+ * gcc.dg/tree-ssa/ssa-lim-6.c: Same.
+ * gcc.dg/tree-ssa/structopt-1.c: Same.
+ * gcc.dg/vect/dump-tree-dceloop-pr26359.c: Same.
+ * gfortran.dg/pr32921.f: Same.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/graphite_autopar/force-parallel-1.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-2.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-3.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-4.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-5.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-6.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-7.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-8.c: New.
+ * gcc.dg/graphite/graphite_autopar/force-parallel-9.c: New.
+ * gcc.dg/graphite/graphite_autopar/graphite_autopar.exp: New.
+ * gcc.dg/graphite/id-1.c: New.
+ * gcc.dg/graphite/id-10.c: New.
+ * gcc.dg/graphite/id-11.c: New.
+ * gcc.dg/graphite/id-12.c: New.
+ * gcc.dg/graphite/id-13.c: New.
+ * gcc.dg/graphite/id-14.c: New.
+ * gcc.dg/graphite/id-15.c: New.
+ * gcc.dg/graphite/id-2.c: New.
+ * gcc.dg/graphite/id-3.c: New.
+ * gcc.dg/graphite/id-4.c: New.
+ * gcc.dg/graphite/id-5.c: New.
+ * gcc.dg/graphite/id-6.c: New.
+ * gcc.dg/graphite/id-7.c: New.
+ * gcc.dg/graphite/id-8.c: New.
+ * gcc.dg/graphite/id-9.c: New.
+ * gcc.dg/graphite/interchange-0.c: New.
+ * gcc.dg/graphite/interchange-1.c: New.
+ * gcc.dg/graphite/interchange-2.c: New.
+ * gcc.dg/graphite/interchange-3.c: New.
+ * gcc.dg/graphite/interchange-4.c: New.
+ * gcc.dg/graphite/interchange-5.c: New.
+ * gcc.dg/graphite/interchange-6.c: New.
+ * gcc.dg/graphite/interchange-7.c: New.
+ * gcc.dg/graphite/interchange-8.c: New.
+ * gcc.dg/graphite/pr35356-1.c: New.
+ * gcc.dg/graphite/pr35356-2.c: New.
+ * gcc.dg/graphite/pr35356-3.c: New.
+ * gcc.dg/graphite/pr40157.c: New.
+ * gcc.dg/graphite/run-id-1.c: New.
+ * gcc.dg/graphite/scop-20.c: New.
+ * gcc.dg/graphite/scop-21.c: New.
+ * gfortran.dg/graphite/id-1.f90: New.
+ * gfortran.dg/graphite/id-10.f90: New.
+ * gfortran.dg/graphite/id-11.f: New.
+ * gfortran.dg/graphite/id-12.f: New.
+ * gfortran.dg/graphite/id-13.f: New.
+ * gfortran.dg/graphite/id-14.f: New.
+ * gfortran.dg/graphite/id-15.f: New.
+ * gfortran.dg/graphite/id-16.f: New.
+ * gfortran.dg/graphite/id-5.f: New.
+ * gfortran.dg/graphite/id-6.f: New.
+ * gfortran.dg/graphite/id-7.f: New.
+ * gfortran.dg/graphite/id-8.f: New.
+ * gfortran.dg/graphite/id-9.f: New.
+ * gfortran.dg/graphite/interchange-1.f: New.
+ * gfortran.dg/graphite/interchange-2.f: New.
+
+2009-07-30 Sebastian Pop <sebastian.pop@amd.com>
+
+ * gcc.dg/graphite/graphite.exp: Implement an automatic selection of
+ flags based on the name of the testcase.
+ * gfortran.dg/graphite/graphite.exp: Same.
+
+ * gcc.dg/graphite/block-0.c: Adjusted.
+ * gcc.dg/graphite/block-1.c: Adjusted.
+ * gcc.dg/graphite/block-2.c: Adjusted.
+ * gcc.dg/graphite/block-3.c: Adjusted.
+ * gcc.dg/graphite/block-4.c: Adjusted.
+ * gcc.dg/graphite/block-5.c: Adjusted.
+ * gcc.dg/graphite/block-6.c: Adjusted.
+ * gcc.dg/graphite/pr37485.c: Adjusted.
+ * gcc.dg/graphite/pr37684.c: Adjusted.
+ * gcc.dg/graphite/pr37828.c: Adjusted.
+ * gcc.dg/graphite/pr37883.c: Adjusted.
+ * gcc.dg/graphite/pr37928.c: Adjusted.
+ * gcc.dg/graphite/pr37943.c: Adjusted.
+ * gcc.dg/graphite/pr38409.c: Adjusted.
+ * gcc.dg/graphite/pr38498.c: Adjusted.
+ * gcc.dg/graphite/pr38559.c: Adjusted.
+ * gcc.dg/graphite/pr39335.c: Adjusted.
+ * gcc.dg/graphite/pr39335_1.c: Adjusted.
+ * gcc.dg/graphite/scop-0.c: Adjusted.
+ * gcc.dg/graphite/scop-1.c: Adjusted.
+ * gcc.dg/graphite/scop-10.c: Adjusted.
+ * gcc.dg/graphite/scop-11.c: Adjusted.
+ * gcc.dg/graphite/scop-12.c: Adjusted.
+ * gcc.dg/graphite/scop-13.c: Adjusted.
+ * gcc.dg/graphite/scop-14.c: Adjusted.
+ * gcc.dg/graphite/scop-15.c: Adjusted.
+ * gcc.dg/graphite/scop-16.c: Adjusted.
+ * gcc.dg/graphite/scop-17.c: Adjusted.
+ * gcc.dg/graphite/scop-18.c: Adjusted.
+ * gcc.dg/graphite/scop-19.c: Adjusted.
+ * gcc.dg/graphite/scop-2.c: Adjusted.
+ * gcc.dg/graphite/scop-3.c: Adjusted.-
+ * gcc.dg/graphite/scop-4.c: Adjusted.
+ * gcc.dg/graphite/scop-5.c: Adjusted.
+ * gcc.dg/graphite/scop-6.c: Adjusted.
+ * gcc.dg/graphite/scop-7.c: Adjusted.
+ * gcc.dg/graphite/scop-8.c: Adjusted.
+ * gcc.dg/graphite/scop-9.c: Adjusted.
+ * gcc.dg/graphite/scop-matmult.c: Adjusted.
+ * gfortran.dg/graphite/block-1.f90: Adjusted.
+ * gfortran.dg/graphite/block-2.f: Adjusted.
+ * gfortran.dg/graphite/block-3.f90: Adjusted.
+ * gfortran.dg/graphite/block-4.f90: Adjusted.
+ * gfortran.dg/graphite/id-2.f90: Adjusted.
+ * gfortran.dg/graphite/id-3.f90: Adjusted.
+ * gfortran.dg/graphite/id-4.f90: Adjusted.
+ * gfortran.dg/graphite/pr37852.f90: Adjusted.
+ * gfortran.dg/graphite/pr37857.f90: Adjusted.
+ * gfortran.dg/graphite/pr37980.f90: Adjusted.
+ * gfortran.dg/graphite/pr38083.f90: Adjusted.
+ * gfortran.dg/graphite/pr38953.f90: Adjusted.
+ * gfortran.dg/graphite/scop-1.f: Adjusted.
+
+2009-07-30 Doug Kwan <dougkwan@google.com>
+
+ * gcc.target/arm/neon/polytypes.c: Adjust test for new notes
+ in warnings added in rev 141298.
+
+2009-07-30 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ * lib/options.exp: Use "!=" instead of "ne".
+
+ * gcc.dg/vector-4.c: Add -fno-common option on hppa*-*-hpux* (32-bit).
+
+ * gcc.dg/ucnid-11.c: Skip on hppa*-*-hpux* (32-bit).
+ * gcc.dg/ucnid-12.c: Likewise.
+
+2009-07-30 Michael Meissner <meissner@linux.vnet.ibm.com>
+ Pat Haugen <pthaugen@us.ibm.com>
+ Revital Eres <ERES@il.ibm.com>
+
+ * testsuite/gcc.target/powerpc/altivec-32.c: New file to test
+ Altivec simple math function vectorization.
+
+ * testsuite/gcc.target/powerpc/bswap-run.c: New file to test swap
+ builtins.
+ * testsuite/gcc.target/powerpc/bswap16.c: Ditto.
+ * testsuite/gcc.target/powerpc/bswap32.c: Ditto.
+ * testsuite/gcc.target/powerpc/bswap64-1.c: Ditto.
+ * testsuite/gcc.target/powerpc/bswap64-2.c: Ditto.
+ * testsuite/gcc.target/powerpc/bswap64-3.c: Ditto.
+ * testsuite/gcc.target/powerpc/optimize-bswapdi-2.c: Ditto.
+ * testsuite/gcc.target/powerpc/optimize-bswapdi-3.c: Ditto.
+ * testsuite/gcc.target/powerpc/optimize-bswapsi-2.c: Ditto.
+
+ * testsuite/gcc.target/powerpc/popcount-2.c: New file to test
+ power7 popcntd instructions.
+ * testsuite/gcc.target/powerpc/popcount-3.c: Ditto.
+
+ * testsuite/gcc.target/powerpc/pr39457.c: New VSX test.
+ * testsuite/gcc.target/powerpc/vsx-builtin-1.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-builtin-2.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-builtin-3.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-builtin-4.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-builtin-5.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-builtin-6.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-vector-1.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-vector-2.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-vector-3.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-vector-4.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-vector-5.c: Ditto.
+ * testsuite/gcc.target/powerpc/vsx-vector-6.c: Ditto.
+
+ * testsuite/gcc.target/powerpc/altivec-6.c: Store the result of
+ vec_add, so the optimizer doesn't remove it.
+
+ * testsuite/gcc.dg/optimize-bswapdi-1.c: Add powerpc 64-bit to
+ systems that support bswap64.
+
+ * testsuite/gcc.dg/vmx/vmx.exp: Explicitly add -mno-vsx to
+ prevent VSX code generation.
+
+ * testsuite/lib/target-supports.exp (check_vsx_hw_available): New
+ function to test if VSX available.
+ (check_effective_target_powerpc_vsx_ok): Ditto.
+ (check_vmx_hw_available): Add explicit -mno-vsx.
+
+2009-07-30 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/39902
+ * gcc.dg/dfp/pr39902.c: Fix typos in constant suffixes.
+
+2009-07-30 Martin Jambor <mjambor@suse.cz>
+
+ PR tree-optimization/40570
+ * gcc.c-torture/compile/pr40570.c: New test.
+
2009-07-29 Jason Merrill <jason@redhat.com>
PR c++/14912
@@ -261,8 +1107,8 @@
2009-07-20 Jakub Jelinek <jakub@redhat.com>
- * gcc.dg/builtin-object-size-6.c: Adjust expected values.
- * gcc.dg/builtin-object-size-8.c: New test.
+ * gcc.dg/builtin-object-size-6.c: Adjust expected values.
+ * gcc.dg/builtin-object-size-8.c: New test.
* g++.dg/ext/builtin-object-size1.C: Adjust expected values.
* g++.dg/ext/builtin-object-size2.C: Likewise.
@@ -276,9 +1122,9 @@
gcc.dg/vect/vect-cond-5.c, gcc.dg/vect/vect-cond-6.c: New tests.
2009-07-20 Christian Bruel <christian.bruel@st.com>
-
+
* gcc.target/sh/mfmovd.c: New test.
-
+
2009-07-19 Janne Blomqvist <jb@gcc.gnu.org>
Jerry DeLisle <jvdelisle@gcc.gnu.org>
@@ -368,7 +1214,7 @@
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
- PR 40435
+ PR 40435
* gcc.dg/pr36902.c: Add column info.
* g++.dg/gcov/gcov-2.C: Change count for definition.
@@ -723,7 +1569,7 @@
* gcc.dg/plugin/selfassign.c: Replace %H by an explicit
location. Update all calls.
* g++.dg/plugin/selfassign.c: Likewise.
-
+
2009-07-06 Jason Merrill <jason@redhat.com>
* g++.dg/rtti/dyncast[34].C: New.
@@ -767,7 +1613,7 @@
PR target/40587
* gfortran.dg/pr40587.f: New test.
-
+
2009-07-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/40638
@@ -1190,7 +2036,7 @@
PR target/40482
* gcc.target/arm/pr40482.c: New test.
-
+
2009-06-19 Ian Lance Taylor <iant@google.com>
* gcc.dg/Wcxx-compat-18.c: New testcase.
@@ -1246,7 +2092,7 @@
2009-06-18 Manuel López-Ibáñez <manu@gcc.gnu.org>
* gcc.dg/cpp/arith-3.c: Add column info.
-
+
2009-06-18 Sandra Loosemore <sandra@codesourcery.com>
* gcc.target/arm/fp16-compile-none-2.c: New.
@@ -1518,7 +2364,7 @@
* gcc.dg/pr20368-1.c: Same.
* gcc.dg/dremf-type-compat-3.c: Same.
* gcc.dg/builtins-30.c: Same. Test for columns.
-
+
2009-06-12 Janus Weil <janus@gcc.gnu.org>
PR fortran/40176
@@ -2151,15 +2997,15 @@
2009-05-24 Ira Rosen <irar@il.ibm.com>
* gcc.dg/vect/bb-slp-1.c: New test.
- * gcc.dg/vect/bb-slp-2.c, gcc.dg/vect/bb-slp-3.c,
- gcc.dg/vect/bb-slp-4.c, gcc.dg/vect/bb-slp-5.c,
+ * gcc.dg/vect/bb-slp-2.c, gcc.dg/vect/bb-slp-3.c,
+ gcc.dg/vect/bb-slp-4.c, gcc.dg/vect/bb-slp-5.c,
gcc.dg/vect/bb-slp-6.c, gcc.dg/vect/bb-slp-7.c,
- gcc.dg/vect/bb-slp-8.c, gcc.dg/vect/bb-slp-9.c,
- gcc.dg/vect/bb-slp-10.c, gcc.dg/vect/bb-slp-11.c,
- gcc.dg/vect/no-tree-reassoc-bb-slp-12.c, gcc.dg/vect/bb-slp-13.c,
- gcc.dg/vect/bb-slp-14.c, gcc.dg/vect/bb-slp-15.c,
- gcc.dg/vect/bb-slp-16.c, gcc.dg/vect/bb-slp-17.c,
- gcc.dg/vect/bb-slp-18.c, gcc.dg/vect/bb-slp-19.c,
+ gcc.dg/vect/bb-slp-8.c, gcc.dg/vect/bb-slp-9.c,
+ gcc.dg/vect/bb-slp-10.c, gcc.dg/vect/bb-slp-11.c,
+ gcc.dg/vect/no-tree-reassoc-bb-slp-12.c, gcc.dg/vect/bb-slp-13.c,
+ gcc.dg/vect/bb-slp-14.c, gcc.dg/vect/bb-slp-15.c,
+ gcc.dg/vect/bb-slp-16.c, gcc.dg/vect/bb-slp-17.c,
+ gcc.dg/vect/bb-slp-18.c, gcc.dg/vect/bb-slp-19.c,
gcc.dg/vect/bb-slp-20.c, gcc.dg/vect/bb-slp-21.c,
gcc.dg/vect/bb-slp-22.c: Likewise.
* gcc.dg/vect/vect.exp: Run basic block SLP tests.
@@ -2269,7 +3115,7 @@
PR c/40172
* gcc.dg/pr40172.c: Add -Wlogical-op to dg-options.
-
+
2009-05-19 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/loop_optimization6.ad[sb]: New test.
@@ -2440,10 +3286,10 @@
* gfortran.dg/duplicate_type_3.f90: New.
2009-05-14 Laurent GUERBY <laurent@guerby.net>
-
+
* ada/acats/tests/c3/c38202a.ada: Use Impdef.
* ada/acats/tests/c5/c59002c.ada: Likewise.
-
+
2009-05-13 Taras Glek <tglek@mozilla.com>
* g++.dg/plugin/attribute_plugin-test-1.C: Testcase input for custom
@@ -2469,7 +3315,7 @@
* gcc.dg/cpp/pr36674.i: New.
2009-05-14 Ben Elliston <bje@au.ibm.com>
-
+
PR middle-end/40035
* gcc.c-torture/compile/pr40035.c: New test.
@@ -2494,7 +3340,7 @@
2009-05-12 David Billinghurst <billingd@gcc.gnu.org>
- * gfortran.dg/default_format_1.f90: XFAIL on cygwin.
+ * gfortran.dg/default_format_1.f90: XFAIL on cygwin.
2009-05-12 David Billinghurst <billingd@gcc.gnu.org>
@@ -3060,7 +3906,7 @@
* 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
@@ -3125,7 +3971,7 @@
* g++.dg/template/repo7.C: Likewise.
* g++.dg/template/repo8.C: Likewise.
* g++.dg/template/repo9.C: Likewise.
- * g++.dg/rtti/repo1.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.
@@ -3490,7 +4336,7 @@
PR testsuite/39623
* gcc.dg/vect/no-vfa-vect-57.c: XFAIL when vect_no_align.
* gcc.dg/vect/no-vfa-vect-61.c: Ditto.
-
+
2009-04-23 Rafael Avila de Espindola <espindola@google.com>
* gcc.dg/format/gcc_diag-1.c (foo): Don't check that %E produces a
@@ -3529,7 +4375,7 @@
PR testsuite/39623
* gcc.dg/vect/no-vfa-vect-43.c Fix vect_no_align check.
-
+
2009-04-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/39824
@@ -4171,7 +5017,7 @@
2009-04-06 Laurent GUERBY <laurent@guerby.net>
* lib/gnat.exp: Handle multilib.
-
+
2009-04-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38863
@@ -4706,7 +5552,7 @@
PR objc/27377
* objc.dg/conditional-1.m: New tests.
-
+
2009-03-28 Adam Nemet <anemet@caviumnetworks.com>
* gcc.dg/winline-10.c: New test.
@@ -4967,7 +5813,7 @@
2009-03-23 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/auto12.C: Add variadic test.
-
+
PR c++/39526
* g++.dg/warn/Wshadow-4.C: New test.
@@ -5302,8 +6148,8 @@
* gcc.dg/vect/vect-complex-1.c: Add attribute aligned to the arrays.
* gcc.dg/vect/vect-iv-6.c: Don't expect to fail to vectorize
on targets without vector misalignment support.
- * lib/target-supports.exp
- (check_effective_target_vect_short_mult): Add
+ * lib/target-supports.exp
+ (check_effective_target_vect_short_mult): Add
check_effective_target_arm32.
2009-03-02 Sebastian Pop <sebastian.pop@amd.com>
@@ -5649,7 +6495,7 @@
2009-02-15 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/struct/w_prof_single_str_global.c: Mask return value.
-
+
2009-02-13 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* gcc.target/spu/intrinsics-sr.c: New test.
@@ -5989,7 +6835,7 @@
PR middle-end/35854
* gcc.dg/lower-subreg-1.c: Renamed dump pass from "subreg"
to "subreg1".
-
+
2009-01-29 Steve Ellcey <sje@cup.hp.com>
PR middle-end/38857
@@ -6463,7 +7309,7 @@
* g++.dg/eh/check-vect.h (sig_ill_handler): Remove AltiVec runtime
check.
* g++.dg/ext/altivec_check.h: Delete.
-
+
2009-01-13 Nathan Froyd <froydnj@codesourcery.com>
* gcc.target/powerpc/altivec-macros.c: Require a powerpc_altivec_ok
@@ -6858,7 +7704,7 @@
dg-timeout-factor.
* gcc.dg/20020425-1.c: Likewise.
* gcc.dg/pch/pch.exp: Likewise.
-
+
2009-01-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/38657
@@ -6873,7 +7719,7 @@
PR fortran/38669
PR fortran/38726
- * gfortran.dg/elemental_subroutine_7.f90:
+ * gfortran.dg/elemental_subroutine_7.f90:
Fix p values so that it can be used as vector subscript.
2009-01-05 Jason Merrill <jason@redhat.com>
diff --git a/gcc/testsuite/ada/acats/support/impdef.a b/gcc/testsuite/ada/acats/support/impdef.a
index 815594b9f86..9c23d0b7f76 100644
--- a/gcc/testsuite/ada/acats/support/impdef.a
+++ b/gcc/testsuite/ada/acats/support/impdef.a
@@ -105,6 +105,8 @@ package ImpDef is
Minimum_Task_Switch : constant Duration := 0.001;
-- ^^^ --- MODIFY HERE AS NEEDED
+ Long_Minimum_Task_Switch : constant Duration := 0.1;
+
--=====-=====-=====-=====-=====-=====-=====-=====-=====-=====-=====-=====--
-- This is the time required to activate another task and allow it
@@ -117,13 +119,15 @@ package ImpDef is
Switch_To_New_Task : constant Duration := 0.001;
-- ^^^ -- MODIFY HERE AS NEEDED
+ Long_Switch_To_New_Task : constant Duration := 0.1;
+
--=====-=====-=====-=====-=====-=====-=====-=====-=====-=====-=====-=====--
-- This is the time which will clear the queues of other tasks
-- waiting to run. It is expected that this will be about five
-- times greater than Switch_To_New_Task.
- Clear_Ready_Queue : constant Duration := 1.1;
+ Clear_Ready_Queue : constant Duration := 0.1;
-- ^^^ --- MODIFY HERE AS NEEDED
--=====-=====-=====-=====-=====-=====-=====-=====-=====-=====-=====-=====--
diff --git a/gcc/testsuite/ada/acats/tests/c9/c940005.a b/gcc/testsuite/ada/acats/tests/c9/c940005.a
index adb58b18ca4..47a97bf2de6 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c940005.a
+++ b/gcc/testsuite/ada/acats/tests/c9/c940005.a
@@ -85,7 +85,7 @@ begin
-- In reality one would expect a time of 5 to 10 seconds. In
-- the interests of speeding up the test suite a shorter time
-- is used
- Pulse_Time_Delta : constant duration := ImpDef.Switch_To_New_Task;
+ Pulse_Time_Delta : constant duration := ImpDef.Long_Switch_To_New_Task;
-- control over stopping tasks
protected Control is
diff --git a/gcc/testsuite/ada/acats/tests/c9/c940007.a b/gcc/testsuite/ada/acats/tests/c9/c940007.a
index c678463633a..41e80f4e25e 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c940007.a
+++ b/gcc/testsuite/ada/acats/tests/c9/c940007.a
@@ -90,7 +90,7 @@ begin
-- In reality one would expect a time of 5 to 10 seconds. In
-- the interests of speeding up the test suite a shorter time
-- is used
- Pulse_Time_Delta : constant duration := ImpDef.Switch_To_New_Task;
+ Pulse_Time_Delta : constant duration := ImpDef.Long_Switch_To_New_Task;
-- control over stopping tasks
diff --git a/gcc/testsuite/ada/acats/tests/c9/c94001c.ada b/gcc/testsuite/ada/acats/tests/c9/c94001c.ada
index e53789f8f42..1d0625559de 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c94001c.ada
+++ b/gcc/testsuite/ada/acats/tests/c9/c94001c.ada
@@ -209,7 +209,7 @@ BEGIN
BEGIN -- (E)
WHILE NOT(OUT_TSK'TERMINATED) AND DELAY_COUNT < 60 LOOP
- DELAY 1.0 * Impdef.One_Second;
+ DELAY 1.0 * Impdef.One_Long_Second;
DELAY_COUNT := DELAY_COUNT + 1;
END LOOP;
IF DELAY_COUNT = 60 THEN
@@ -252,7 +252,7 @@ BEGIN
BEGIN
WHILE NOT(OUT_TSK'TERMINATED) AND DELAY_COUNT < 60 LOOP
- DELAY 1.0 * Impdef.One_Second;
+ DELAY 1.0 * Impdef.One_Long_Second;
DELAY_COUNT := DELAY_COUNT + 1;
END LOOP;
IF DELAY_COUNT = 60 THEN
diff --git a/gcc/testsuite/ada/acats/tests/c9/c94006a.ada b/gcc/testsuite/ada/acats/tests/c9/c94006a.ada
index c088f8bb577..cac5fc6e09c 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c94006a.ada
+++ b/gcc/testsuite/ada/acats/tests/c9/c94006a.ada
@@ -42,7 +42,7 @@ PROCEDURE C94006A IS
SELECT
ACCEPT E;
OR
- DELAY 30.0 * Impdef.One_Second;
+ DELAY 30.0 * Impdef.One_Long_Second;
END SELECT;
END TT;
diff --git a/gcc/testsuite/ada/acats/tests/c9/c94008c.ada b/gcc/testsuite/ada/acats/tests/c9/c94008c.ada
index 53ec450dec3..fb2eee97f69 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c94008c.ada
+++ b/gcc/testsuite/ada/acats/tests/c9/c94008c.ada
@@ -202,7 +202,7 @@ BEGIN -- C94008C
DELAY 10.0 * Impdef.One_Second;
IF TERMINATE_COUNT.GET /= 1 THEN
- DELAY 20.0 * Impdef.One_Second;
+ DELAY 20.0 * Impdef.One_Long_Second;
END IF;
IF TERMINATE_COUNT.GET /= 1 THEN
@@ -243,7 +243,7 @@ BEGIN -- C94008C
DELAY 10.0 * Impdef.One_Second; -- WAIT FOR T1, T2, AND T3 TO GET TO SELECT STMTS.
IF TERMINATE_COUNT.GET /= 3 THEN
- DELAY 20.0 * Impdef.One_Second;
+ DELAY 20.0 * Impdef.One_Long_Second;
END IF;
IF TERMINATE_COUNT.GET /= 3 THEN
diff --git a/gcc/testsuite/ada/acats/tests/c9/c951002.a b/gcc/testsuite/ada/acats/tests/c9/c951002.a
index 8ccb2d012fe..65b696c4af9 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c951002.a
+++ b/gcc/testsuite/ada/acats/tests/c9/c951002.a
@@ -278,14 +278,14 @@ begin
-- Wait until the message is queued on the entry before starting
-- the Credit_Task
while not Hold.TC_Message_is_Queued loop
- delay ImpDef.Minimum_Task_Switch;
+ delay ImpDef.Long_Minimum_Task_Switch;
end loop;
--
Credit_Task.TC_Start;
-- Ensure the first part of the test is complete before continuing
while not (Credit_Message'terminated and Credit_Task'terminated) loop
- delay ImpDef.Minimum_Task_Switch;
+ delay ImpDef.Long_Minimum_Task_Switch;
end loop;
--======================================================
@@ -298,12 +298,12 @@ begin
-- for it to reach the accept statement and call Hold.Set_DB_Overload
-- before starting Debit_Message
--
- delay ImpDef.Switch_To_New_Task;
+ delay ImpDef.Long_Switch_To_New_Task;
Debit_Message.TC_Start;
while not Debit_Task'terminated loop
- delay ImpDef.Minimum_Task_Switch;
+ delay ImpDef.Long_Minimum_Task_Switch;
end loop;
Hold.Clear_DB_Overload; -- Allow completion
diff --git a/gcc/testsuite/ada/acats/tests/c9/c954a01.a b/gcc/testsuite/ada/acats/tests/c9/c954a01.a
index 34f48b29171..3ea545a8f0e 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c954a01.a
+++ b/gcc/testsuite/ada/acats/tests/c9/c954a01.a
@@ -148,7 +148,7 @@ package body C954A01_0 is -- Printer server abstraction.
end select;
-- Allow other tasks to get control
- delay ImpDef.Minimum_Task_Switch;
+ delay ImpDef.Long_Minimum_Task_Switch;
end loop;
@@ -175,7 +175,7 @@ use F954A00;
procedure C954A01 is
- Long_Enough : constant Duration := ImpDef.Switch_To_New_Task;
+ Long_Enough : constant Duration := ImpDef.Long_Switch_To_New_Task;
--==============================================--
diff --git a/gcc/testsuite/ada/acats/tests/c9/c96001a.ada b/gcc/testsuite/ada/acats/tests/c9/c96001a.ada
index a4e1c4a9c4b..f958ea107fe 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c96001a.ada
+++ b/gcc/testsuite/ada/acats/tests/c9/c96001a.ada
@@ -51,7 +51,7 @@ BEGIN
---------------------------------------------
DECLARE -- (A)
- X : DURATION := 5.0;
+ X : DURATION := 5.0 * Impdef.One_Second;
OLD_TIME : TIME;
LAPSE : DURATION;
BEGIN -- (A)
diff --git a/gcc/testsuite/ada/acats/tests/c9/c97307a.ada b/gcc/testsuite/ada/acats/tests/c9/c97307a.ada
index 6d7be50562b..32d26e6b333 100644
--- a/gcc/testsuite/ada/acats/tests/c9/c97307a.ada
+++ b/gcc/testsuite/ada/acats/tests/c9/c97307a.ada
@@ -160,7 +160,7 @@ BEGIN
EXPIRED.READ (EXPIRED_CALLS);
EXIT WHEN E'COUNT >= DESIRED_QUEUE_LENGTH -
EXPIRED_CALLS;
- DELAY 2.0 * Impdef.One_Second;
+ DELAY 2.0 * Impdef.One_Long_Second;
END LOOP;
EXIT WHEN DESIRED_QUEUE_LENGTH = 5;
DISPATCH.READY;
@@ -171,7 +171,7 @@ BEGIN
-- LET THE TIMED ENTRY CALLS ISSUED BY CALLER1,
-- CALLER3, AND CALLER5 EXPIRE:
- DELAY DELAY_TIME + 10.0 * Impdef.One_Second;
+ DELAY DELAY_TIME + 10.0 * Impdef.One_Long_Second;
-- AT THIS POINT, ALL THE TIMED ENTRY CALLS MUST HAVE
-- EXPIRED AND BEEN REMOVED FROM THE ENTRY QUEUE FOR E,
diff --git a/gcc/testsuite/gcc.dg/Wconversion-real.c b/gcc/testsuite/c-c++-common/Wconversion-real.c
index ed7371b5123..464aab05579 100644
--- a/gcc/testsuite/gcc.dg/Wconversion-real.c
+++ b/gcc/testsuite/c-c++-common/Wconversion-real.c
@@ -2,7 +2,8 @@
/* { dg-do compile } */
/* { dg-skip-if "doubles are floats" { "avr-*-*" } { "*" } { "" } } */
-/* { dg-options "-std=c99 -Wconversion" } */
+/* { dg-options "-std=c99 -Wconversion" { target c } } */
+/* { dg-options "-Wconversion" { target c++ } } */
/* { dg-require-effective-target large_double } */
float vfloat;
diff --git a/gcc/testsuite/g++.dg/cdce3.C b/gcc/testsuite/g++.dg/cdce3.C
index b73ebf81220..6756a700812 100644
--- a/gcc/testsuite/g++.dg/cdce3.C
+++ b/gcc/testsuite/g++.dg/cdce3.C
@@ -2,14 +2,14 @@
/* { dg-require-effective-target c99_runtime } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
-/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target {pow10 && {! large_long_double } } } } */
+/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { pow10 && {! large_long_double } } } } */
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
-/* { dg-final { scan-tree-dump "cdce3.C:91: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
-/* { dg-final { scan-tree-dump "cdce3.C:92: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
-/* { dg-final { scan-tree-dump "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
-/* { dg-final { scan-tree-dump "cdce3.C:95: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
-/* { dg-final { scan-tree-dump "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
-/* { dg-final { scan-tree-dump "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { alpha*-*-* && { pow10 && large_long_double } } } } */
+/* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { alpha*-*-* && { {! pow10 } && large_long_double } } } } */
+/* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { alpha*-*-* && { pow10 && {! large_long_double } } } } } */
+/* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { alpha*-*-* && { {! pow10 } && {! large_long_double } } } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:95: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
+/* { dg-final { scan-tree-dump "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
/* { dg-final { scan-tree-dump "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:99: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:100: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
@@ -20,6 +20,10 @@
/* { dg-final { scan-tree-dump "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { scan-tree-dump "cdce3.C:107: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "cdce3.C:108: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "cdce3.C:109: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "cdce3.C:110: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
+/* { dg-final { scan-tree-dump "cdce3.C:111: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
/* { dg-final { cleanup-tree-dump "cdce" } } */
#include <stdlib.h>
#include <math.h>
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist22.C b/gcc/testsuite/g++.dg/cpp0x/initlist22.C
index bf1c554f5fc..0855b59d5d5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/initlist22.C
+++ b/gcc/testsuite/g++.dg/cpp0x/initlist22.C
@@ -4,7 +4,7 @@
int i;
int& r1{ i }; // OK, direct binding
-int&& r2{ i }; // OK, direct binding
+int&& r2{ i }; // { dg-error "" } binding && to lvalue
int& r3{ }; // { dg-error "" } reference to temporary
int&& r4{ }; // OK, reference to temporary
diff --git a/gcc/testsuite/g++.dg/cpp0x/named.C b/gcc/testsuite/g++.dg/cpp0x/named.C
index b91e6989425..ef1a2fb6f7d 100644
--- a/gcc/testsuite/g++.dg/cpp0x/named.C
+++ b/gcc/testsuite/g++.dg/cpp0x/named.C
@@ -1,12 +1,17 @@
// { dg-options "--std=c++0x" }
// { dg-do link }
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
struct S {};
struct T
{
- T(S && s_) : s(s_) {}
- S && get() { return s; }
- operator S&&() { return s; }
+ T(S && s_) : s(movel(s_)) {}
+ S && get() { return movel(s); }
+ operator S&&() { return movel(s); }
S && s;
};
@@ -18,8 +23,8 @@ void unnamed(S&&) {}
void f(S && p)
{
- S && s(p);
- T t(s);
+ S && s(movel(p));
+ T t(movel(s));
named(s); // variable reference
named(p); // parameter reference
diff --git a/gcc/testsuite/g++.dg/cpp0x/overload.C b/gcc/testsuite/g++.dg/cpp0x/overload.C
index 945860cddb1..3782d4a208e 100644
--- a/gcc/testsuite/g++.dg/cpp0x/overload.C
+++ b/gcc/testsuite/g++.dg/cpp0x/overload.C
@@ -2,6 +2,11 @@
// { dg-do link }
// Generated by overload.py
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
struct S{};
S l; // lvalue (l)
@@ -10,12 +15,12 @@ S r() { return l; } // rvalue (r)
S const cr() { return l; } // const rvalue (cr)
S & nl = l; // named lvalue reference (nl)
S const & ncl = l; // named const lvalue reference (ncl)
-S && nr = l; // named rvalue reference (nr)
-S const && ncr = l; // named const rvalue reference (ncr)
+S && nr = movel(l); // named rvalue reference (nr)
+S const && ncr = movel(l); // named const rvalue reference (ncr)
S & ul() { return l; } // unnamed lvalue reference (ul)
S const & ucl() { return l; } // unnamed const lvalue reference (ucl)
-S && ur() { return l; } // unnamed rvalue reference (ur)
-S const && ucr() { return l; } // unnamed const rvalue reference (ucr)
+S && ur() { return movel(l); } // unnamed rvalue reference (ur)
+S const && ucr() { return movel(l); } // unnamed const rvalue reference (ucr)
void l0001(const S&&) {}
@@ -538,9 +543,9 @@ void ucr1111(const S&&) {}
int main()
{
- l0001(l);
- l0010(l);
- l0011(l);
+ //l0001(l);
+ //l0010(l);
+ //l0011(l);
l0100(l);
l0101(l);
l0110(l);
@@ -553,14 +558,14 @@ int main()
l1101(l);
l1110(l);
l1111(l);
- cl0001(cl);
- cl0011(cl);
+ //cl0001(cl);
+ //cl0011(cl);
cl0100(cl);
cl0101(cl);
cl0110(cl);
cl0111(cl);
- cl1001(cl);
- cl1011(cl);
+ //cl1001(cl);
+ //cl1011(cl);
cl1100(cl);
cl1101(cl);
cl1110(cl);
@@ -591,9 +596,9 @@ int main()
cr1101(cr());
cr1110(cr());
cr1111(cr());
- nl0001(nl);
- nl0010(nl);
- nl0011(nl);
+ //nl0001(nl);
+ //nl0010(nl);
+ //nl0011(nl);
nl0100(nl);
nl0101(nl);
nl0110(nl);
@@ -606,21 +611,21 @@ int main()
nl1101(nl);
nl1110(nl);
nl1111(nl);
- ncl0001(ncl);
- ncl0011(ncl);
+ //ncl0001(ncl);
+ //ncl0011(ncl);
ncl0100(ncl);
ncl0101(ncl);
ncl0110(ncl);
ncl0111(ncl);
- ncl1001(ncl);
- ncl1011(ncl);
+ //ncl1001(ncl);
+ //ncl1011(ncl);
ncl1100(ncl);
ncl1101(ncl);
ncl1110(ncl);
ncl1111(ncl);
- nr0001(nr);
- nr0010(nr);
- nr0011(nr);
+ //nr0001(nr);
+ //nr0010(nr);
+ //nr0011(nr);
nr0100(nr);
nr0101(nr);
nr0110(nr);
@@ -633,21 +638,21 @@ int main()
nr1101(nr);
nr1110(nr);
nr1111(nr);
- ncr0001(ncr);
- ncr0011(ncr);
+ //ncr0001(ncr);
+ //ncr0011(ncr);
ncr0100(ncr);
ncr0101(ncr);
ncr0110(ncr);
ncr0111(ncr);
- ncr1001(ncr);
- ncr1011(ncr);
+ //ncr1001(ncr);
+ //ncr1011(ncr);
ncr1100(ncr);
ncr1101(ncr);
ncr1110(ncr);
ncr1111(ncr);
- ul0001(ul());
- ul0010(ul());
- ul0011(ul());
+ //ul0001(ul());
+ //ul0010(ul());
+ //ul0011(ul());
ul0100(ul());
ul0101(ul());
ul0110(ul());
@@ -660,14 +665,14 @@ int main()
ul1101(ul());
ul1110(ul());
ul1111(ul());
- ucl0001(ucl());
- ucl0011(ucl());
+ //ucl0001(ucl());
+ //ucl0011(ucl());
ucl0100(ucl());
ucl0101(ucl());
ucl0110(ucl());
ucl0111(ucl());
- ucl1001(ucl());
- ucl1011(ucl());
+ //ucl1001(ucl());
+ //ucl1011(ucl());
ucl1100(ucl());
ucl1101(ucl());
ucl1110(ucl());
diff --git a/gcc/testsuite/g++.dg/cpp0x/overloadn.C b/gcc/testsuite/g++.dg/cpp0x/overloadn.C
new file mode 100644
index 00000000000..a42707fe4f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/overloadn.C
@@ -0,0 +1,708 @@
+// { dg-options "--std=c++0x" }
+// { dg-do link }
+// Generated by overload.py
+
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
+struct S{};
+
+S l; // lvalue (l)
+S const cl = l; // const lvalue (cl)
+S r() { return l; } // rvalue (r)
+S const cr() { return l; } // const rvalue (cr)
+S & nl = l; // named lvalue reference (nl)
+S const & ncl = l; // named const lvalue reference (ncl)
+S && nr = movel(l); // named rvalue reference (nr)
+S const && ncr = movel(l); // named const rvalue reference (ncr)
+S & ul() { return l; } // unnamed lvalue reference (ul)
+S const & ucl() { return l; } // unnamed const lvalue reference (ucl)
+S && ur() { return movel(l); } // unnamed rvalue reference (ur)
+S const && ucr() { return movel(l); } // unnamed const rvalue reference (ucr)
+
+void l0001(const S&&) {} // { dg-message "" }
+
+void l0010(S&&) {} // { dg-message "" }
+
+void l0011(S&&) {} // { dg-message "" }
+void l0011(const S&&);
+
+void l0100(const S&) {}
+
+void l0101(const S&) {}
+void l0101(const S&&);
+
+void l0110(const S&) {}
+void l0110(S&&);
+
+void l0111(const S&) {}
+void l0111(S&&);
+void l0111(const S&&);
+
+void l1000(S&) {}
+
+void l1001(S&) {}
+void l1001(const S&&);
+
+void l1010(S&) {}
+void l1010(S&&);
+
+void l1011(S&) {}
+void l1011(S&&);
+void l1011(const S&&);
+
+void l1100(S&) {}
+void l1100(const S&);
+
+void l1101(S&) {}
+void l1101(const S&);
+void l1101(const S&&);
+
+void l1110(S&) {}
+void l1110(const S&);
+void l1110(S&&);
+
+void l1111(S&) {}
+void l1111(const S&);
+void l1111(S&&);
+void l1111(const S&&);
+
+void cl0001(const S&&) {} // { dg-message "" }
+
+void cl0011(S&&);
+void cl0011(const S&&) {} // { dg-message "" }
+
+void cl0100(const S&) {}
+
+void cl0101(const S&) {}
+void cl0101(const S&&);
+
+void cl0110(const S&) {}
+void cl0110(S&&);
+
+void cl0111(const S&) {}
+void cl0111(S&&);
+void cl0111(const S&&);
+
+void cl1001(S&);
+void cl1001(const S&&) {} // { dg-message "" }
+
+void cl1011(S&);
+void cl1011(S&&);
+void cl1011(const S&&) {} // { dg-message "" }
+
+void cl1100(S&);
+void cl1100(const S&) {}
+
+void cl1101(S&);
+void cl1101(const S&) {}
+void cl1101(const S&&);
+
+void cl1110(S&);
+void cl1110(const S&) {}
+void cl1110(S&&);
+
+void cl1111(S&);
+void cl1111(const S&) {}
+void cl1111(S&&);
+void cl1111(const S&&);
+
+void r0001(const S&&) {}
+
+void r0010(S&&) {}
+
+void r0011(S&&) {}
+void r0011(const S&&);
+
+void r0100(const S&) {}
+
+void r0101(const S&);
+void r0101(const S&&) {}
+
+void r0110(const S&);
+void r0110(S&&) {}
+
+void r0111(const S&);
+void r0111(S&&) {}
+void r0111(const S&&);
+
+void r1001(S&);
+void r1001(const S&&) {}
+
+void r1010(S&);
+void r1010(S&&) {}
+
+void r1011(S&);
+void r1011(S&&) {}
+void r1011(const S&&);
+
+void r1100(S&);
+void r1100(const S&) {}
+
+void r1101(S&);
+void r1101(const S&);
+void r1101(const S&&) {}
+
+void r1110(S&);
+void r1110(const S&);
+void r1110(S&&) {}
+
+void r1111(S&);
+void r1111(const S&);
+void r1111(S&&) {}
+void r1111(const S&&);
+
+void cr0001(const S&&) {}
+
+void cr0011(S&&);
+void cr0011(const S&&) {}
+
+void cr0100(const S&) {}
+
+void cr0101(const S&);
+void cr0101(const S&&) {}
+
+void cr0110(const S&) {}
+void cr0110(S&&);
+
+void cr0111(const S&);
+void cr0111(S&&);
+void cr0111(const S&&) {}
+
+void cr1001(S&);
+void cr1001(const S&&) {}
+
+void cr1011(S&);
+void cr1011(S&&);
+void cr1011(const S&&) {}
+
+void cr1100(S&);
+void cr1100(const S&) {}
+
+void cr1101(S&);
+void cr1101(const S&);
+void cr1101(const S&&) {}
+
+void cr1110(S&);
+void cr1110(const S&) {}
+void cr1110(S&&);
+
+void cr1111(S&);
+void cr1111(const S&);
+void cr1111(S&&);
+void cr1111(const S&&) {}
+
+void nl0001(const S&&) {} // { dg-message "" }
+
+void nl0010(S&&) {} // { dg-message "" }
+
+void nl0011(S&&) {} // { dg-message "" }
+void nl0011(const S&&);
+
+void nl0100(const S&) {}
+
+void nl0101(const S&) {}
+void nl0101(const S&&);
+
+void nl0110(const S&) {}
+void nl0110(S&&);
+
+void nl0111(const S&) {}
+void nl0111(S&&);
+void nl0111(const S&&);
+
+void nl1000(S&) {}
+
+void nl1001(S&) {}
+void nl1001(const S&&);
+
+void nl1010(S&) {}
+void nl1010(S&&);
+
+void nl1011(S&) {}
+void nl1011(S&&);
+void nl1011(const S&&);
+
+void nl1100(S&) {}
+void nl1100(const S&);
+
+void nl1101(S&) {}
+void nl1101(const S&);
+void nl1101(const S&&);
+
+void nl1110(S&) {}
+void nl1110(const S&);
+void nl1110(S&&);
+
+void nl1111(S&) {}
+void nl1111(const S&);
+void nl1111(S&&);
+void nl1111(const S&&);
+
+void ncl0001(const S&&) {} // { dg-message "" }
+
+void ncl0011(S&&);
+void ncl0011(const S&&) {} // { dg-message "" }
+
+void ncl0100(const S&) {}
+
+void ncl0101(const S&) {}
+void ncl0101(const S&&);
+
+void ncl0110(const S&) {}
+void ncl0110(S&&);
+
+void ncl0111(const S&) {}
+void ncl0111(S&&);
+void ncl0111(const S&&);
+
+void ncl1001(S&);
+void ncl1001(const S&&) {} // { dg-message "" }
+
+void ncl1011(S&);
+void ncl1011(S&&);
+void ncl1011(const S&&) {} // { dg-message "" }
+
+void ncl1100(S&);
+void ncl1100(const S&) {}
+
+void ncl1101(S&);
+void ncl1101(const S&) {}
+void ncl1101(const S&&);
+
+void ncl1110(S&);
+void ncl1110(const S&) {}
+void ncl1110(S&&);
+
+void ncl1111(S&);
+void ncl1111(const S&) {}
+void ncl1111(S&&);
+void ncl1111(const S&&);
+
+void nr0001(const S&&) {} // { dg-message "" }
+
+void nr0010(S&&) {} // { dg-message "" }
+
+void nr0011(S&&) {} // { dg-message "" }
+void nr0011(const S&&);
+
+void nr0100(const S&) {}
+
+void nr0101(const S&) {}
+void nr0101(const S&&);
+
+void nr0110(const S&) {}
+void nr0110(S&&);
+
+void nr0111(const S&) {}
+void nr0111(S&&);
+void nr0111(const S&&);
+
+void nr1000(S&) {}
+
+void nr1001(S&) {}
+void nr1001(const S&&);
+
+void nr1010(S&) {}
+void nr1010(S&&);
+
+void nr1011(S&) {}
+void nr1011(S&&);
+void nr1011(const S&&);
+
+void nr1100(S&) {}
+void nr1100(const S&);
+
+void nr1101(S&) {}
+void nr1101(const S&);
+void nr1101(const S&&);
+
+void nr1110(S&) {}
+void nr1110(const S&);
+void nr1110(S&&);
+
+void nr1111(S&) {}
+void nr1111(const S&);
+void nr1111(S&&);
+void nr1111(const S&&);
+
+void ncr0001(const S&&) {} // { dg-message "" }
+
+void ncr0011(S&&);
+void ncr0011(const S&&) {} // { dg-message "" }
+
+void ncr0100(const S&) {}
+
+void ncr0101(const S&) {}
+void ncr0101(const S&&);
+
+void ncr0110(const S&) {}
+void ncr0110(S&&);
+
+void ncr0111(const S&) {}
+void ncr0111(S&&);
+void ncr0111(const S&&);
+
+void ncr1001(S&);
+void ncr1001(const S&&) {} // { dg-message "" }
+
+void ncr1011(S&);
+void ncr1011(S&&);
+void ncr1011(const S&&) {} // { dg-message "" }
+
+void ncr1100(S&);
+void ncr1100(const S&) {}
+
+void ncr1101(S&);
+void ncr1101(const S&) {}
+void ncr1101(const S&&);
+
+void ncr1110(S&);
+void ncr1110(const S&) {}
+void ncr1110(S&&);
+
+void ncr1111(S&);
+void ncr1111(const S&) {}
+void ncr1111(S&&);
+void ncr1111(const S&&);
+
+void ul0001(const S&&) {} // { dg-message "" }
+
+void ul0010(S&&) {} // { dg-message "" }
+
+void ul0011(S&&) {} // { dg-message "" }
+void ul0011(const S&&);
+
+void ul0100(const S&) {}
+
+void ul0101(const S&) {}
+void ul0101(const S&&);
+
+void ul0110(const S&) {}
+void ul0110(S&&);
+
+void ul0111(const S&) {}
+void ul0111(S&&);
+void ul0111(const S&&);
+
+void ul1000(S&) {}
+
+void ul1001(S&) {}
+void ul1001(const S&&);
+
+void ul1010(S&) {}
+void ul1010(S&&);
+
+void ul1011(S&) {}
+void ul1011(S&&);
+void ul1011(const S&&);
+
+void ul1100(S&) {}
+void ul1100(const S&);
+
+void ul1101(S&) {}
+void ul1101(const S&);
+void ul1101(const S&&);
+
+void ul1110(S&) {}
+void ul1110(const S&);
+void ul1110(S&&);
+
+void ul1111(S&) {}
+void ul1111(const S&);
+void ul1111(S&&);
+void ul1111(const S&&);
+
+void ucl0001(const S&&) {} // { dg-message "" }
+
+void ucl0011(S&&);
+void ucl0011(const S&&) {} // { dg-message "" }
+
+void ucl0100(const S&) {}
+
+void ucl0101(const S&) {}
+void ucl0101(const S&&);
+
+void ucl0110(const S&) {}
+void ucl0110(S&&);
+
+void ucl0111(const S&) {}
+void ucl0111(S&&);
+void ucl0111(const S&&);
+
+void ucl1001(S&);
+void ucl1001(const S&&) {} // { dg-message "" }
+
+void ucl1011(S&);
+void ucl1011(S&&);
+void ucl1011(const S&&) {} // { dg-message "" }
+
+void ucl1100(S&);
+void ucl1100(const S&) {}
+
+void ucl1101(S&);
+void ucl1101(const S&) {}
+void ucl1101(const S&&);
+
+void ucl1110(S&);
+void ucl1110(const S&) {}
+void ucl1110(S&&);
+
+void ucl1111(S&);
+void ucl1111(const S&) {}
+void ucl1111(S&&);
+void ucl1111(const S&&);
+
+void ur0001(const S&&) {}
+
+void ur0010(S&&) {}
+
+void ur0011(S&&) {}
+void ur0011(const S&&);
+
+void ur0100(const S&) {}
+
+void ur0101(const S&);
+void ur0101(const S&&) {}
+
+void ur0110(const S&);
+void ur0110(S&&) {}
+
+void ur0111(const S&);
+void ur0111(S&&) {}
+void ur0111(const S&&);
+
+void ur1001(S&);
+void ur1001(const S&&) {}
+
+void ur1010(S&);
+void ur1010(S&&) {}
+
+void ur1011(S&);
+void ur1011(S&&) {}
+void ur1011(const S&&);
+
+void ur1100(S&);
+void ur1100(const S&) {}
+
+void ur1101(S&);
+void ur1101(const S&);
+void ur1101(const S&&) {}
+
+void ur1110(S&);
+void ur1110(const S&);
+void ur1110(S&&) {}
+
+void ur1111(S&);
+void ur1111(const S&);
+void ur1111(S&&) {}
+void ur1111(const S&&);
+
+void ucr0001(const S&&) {}
+
+void ucr0011(S&&);
+void ucr0011(const S&&) {}
+
+void ucr0100(const S&) {}
+
+void ucr0101(const S&);
+void ucr0101(const S&&) {}
+
+void ucr0110(const S&) {}
+void ucr0110(S&&);
+
+void ucr0111(const S&);
+void ucr0111(S&&);
+void ucr0111(const S&&) {}
+
+void ucr1001(S&);
+void ucr1001(const S&&) {}
+
+void ucr1011(S&);
+void ucr1011(S&&);
+void ucr1011(const S&&) {}
+
+void ucr1100(S&);
+void ucr1100(const S&) {}
+
+void ucr1101(S&);
+void ucr1101(const S&);
+void ucr1101(const S&&) {}
+
+void ucr1110(S&);
+void ucr1110(const S&) {}
+void ucr1110(S&&);
+
+void ucr1111(S&);
+void ucr1111(const S&);
+void ucr1111(S&&);
+void ucr1111(const S&&) {}
+
+
+int main()
+{
+ l0001(l); // { dg-error "lvalue" }
+ l0010(l); // { dg-error "lvalue" }
+ l0011(l); // { dg-error "lvalue" }
+ l0100(l);
+ l0101(l);
+ l0110(l);
+ l0111(l);
+ l1000(l);
+ l1001(l);
+ l1010(l);
+ l1011(l);
+ l1100(l);
+ l1101(l);
+ l1110(l);
+ l1111(l);
+ cl0001(cl); // { dg-error "lvalue" }
+ cl0011(cl); // { dg-error "lvalue" }
+ cl0100(cl);
+ cl0101(cl);
+ cl0110(cl);
+ cl0111(cl);
+ cl1001(cl); // { dg-error "lvalue" }
+ cl1011(cl); // { dg-error "lvalue" }
+ cl1100(cl);
+ cl1101(cl);
+ cl1110(cl);
+ cl1111(cl);
+ r0001(r());
+ r0010(r());
+ r0011(r());
+ r0100(r());
+ r0101(r());
+ r0110(r());
+ r0111(r());
+ r1001(r());
+ r1010(r());
+ r1011(r());
+ r1100(r());
+ r1101(r());
+ r1110(r());
+ r1111(r());
+ cr0001(cr());
+ cr0011(cr());
+ cr0100(cr());
+ cr0101(cr());
+ cr0110(cr());
+ cr0111(cr());
+ cr1001(cr());
+ cr1011(cr());
+ cr1100(cr());
+ cr1101(cr());
+ cr1110(cr());
+ cr1111(cr());
+ nl0001(nl); // { dg-error "lvalue" }
+ nl0010(nl); // { dg-error "lvalue" }
+ nl0011(nl); // { dg-error "lvalue" }
+ nl0100(nl);
+ nl0101(nl);
+ nl0110(nl);
+ nl0111(nl);
+ nl1000(nl);
+ nl1001(nl);
+ nl1010(nl);
+ nl1011(nl);
+ nl1100(nl);
+ nl1101(nl);
+ nl1110(nl);
+ nl1111(nl);
+ ncl0001(ncl); // { dg-error "lvalue" }
+ ncl0011(ncl); // { dg-error "lvalue" }
+ ncl0100(ncl);
+ ncl0101(ncl);
+ ncl0110(ncl);
+ ncl0111(ncl);
+ ncl1001(ncl); // { dg-error "lvalue" }
+ ncl1011(ncl); // { dg-error "lvalue" }
+ ncl1100(ncl);
+ ncl1101(ncl);
+ ncl1110(ncl);
+ ncl1111(ncl);
+ nr0001(nr); // { dg-error "lvalue" }
+ nr0010(nr); // { dg-error "lvalue" }
+ nr0011(nr); // { dg-error "lvalue" }
+ nr0100(nr);
+ nr0101(nr);
+ nr0110(nr);
+ nr0111(nr);
+ nr1000(nr);
+ nr1001(nr);
+ nr1010(nr);
+ nr1011(nr);
+ nr1100(nr);
+ nr1101(nr);
+ nr1110(nr);
+ nr1111(nr);
+ ncr0001(ncr); // { dg-error "lvalue" }
+ ncr0011(ncr); // { dg-error "lvalue" }
+ ncr0100(ncr);
+ ncr0101(ncr);
+ ncr0110(ncr);
+ ncr0111(ncr);
+ ncr1001(ncr); // { dg-error "lvalue" }
+ ncr1011(ncr); // { dg-error "lvalue" }
+ ncr1100(ncr);
+ ncr1101(ncr);
+ ncr1110(ncr);
+ ncr1111(ncr);
+ ul0001(ul()); // { dg-error "lvalue" }
+ ul0010(ul()); // { dg-error "lvalue" }
+ ul0011(ul()); // { dg-error "lvalue" }
+ ul0100(ul());
+ ul0101(ul());
+ ul0110(ul());
+ ul0111(ul());
+ ul1000(ul());
+ ul1001(ul());
+ ul1010(ul());
+ ul1011(ul());
+ ul1100(ul());
+ ul1101(ul());
+ ul1110(ul());
+ ul1111(ul());
+ ucl0001(ucl()); // { dg-error "lvalue" }
+ ucl0011(ucl()); // { dg-error "lvalue" }
+ ucl0100(ucl());
+ ucl0101(ucl());
+ ucl0110(ucl());
+ ucl0111(ucl());
+ ucl1001(ucl()); // { dg-error "lvalue" }
+ ucl1011(ucl()); // { dg-error "lvalue" }
+ ucl1100(ucl());
+ ucl1101(ucl());
+ ucl1110(ucl());
+ ucl1111(ucl());
+ ur0001(ur());
+ ur0010(ur());
+ ur0011(ur());
+ ur0100(ur());
+ ur0101(ur());
+ ur0110(ur());
+ ur0111(ur());
+ ur1001(ur());
+ ur1010(ur());
+ ur1011(ur());
+ ur1100(ur());
+ ur1101(ur());
+ ur1110(ur());
+ ur1111(ur());
+ ucr0001(ucr());
+ ucr0011(ucr());
+ ucr0100(ucr());
+ ucr0101(ucr());
+ ucr0110(ucr());
+ ucr0111(ucr());
+ ucr1001(ucr());
+ ucr1011(ucr());
+ ucr1100(ucr());
+ ucr1101(ucr());
+ ucr1110(ucr());
+ ucr1111(ucr());
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-cast.C b/gcc/testsuite/g++.dg/cpp0x/rv-cast.C
new file mode 100644
index 00000000000..48b7c13ba59
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/rv-cast.C
@@ -0,0 +1,6 @@
+// { dg-options "-std=c++0x" }
+
+void f(int i)
+{
+ int&& r = static_cast<int&&>(i);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1n.C b/gcc/testsuite/g++.dg/cpp0x/rv1n.C
index 10b5dc256b4..b7b9b6e25ce 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv1n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv1n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -103,6 +103,7 @@ int test1_5()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_1_5(a); // { dg-error "lvalue" }
sink_1_5(ca); // { dg-error "invalid initialization" }
sink_1_5(va); // { dg-error "invalid initialization" }
sink_1_5(cva); // { dg-error "invalid initialization" }
@@ -120,6 +121,8 @@ int test1_6()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_1_6(a); // { dg-error "lvalue" }
+ sink_1_6(ca); // { dg-error "lvalue" }
sink_1_6(va); // { dg-error "invalid initialization" }
sink_1_6(cva); // { dg-error "invalid initialization" }
sink_1_6(v_source()); // { dg-error "invalid initialization" }
@@ -135,13 +138,30 @@ int test1_7()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_1_7(a); // { dg-error "lvalue" }
sink_1_7(ca); // { dg-error "invalid initialization" }
+ sink_1_7(va); // { dg-error "lvalue" }
sink_1_7(cva); // { dg-error "invalid initialization" }
sink_1_7(c_source()); // { dg-error "invalid initialization" }
sink_1_7(cv_source()); // { dg-error "invalid initialization" }
return 0;
}
+eight sink_1_8(const volatile A&&); // { dg-error "" }
+
+int test1_8()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_1_8(a); // { dg-error "lvalue" }
+ sink_1_8(ca); // { dg-error "lvalue" }
+ sink_1_8(va); // { dg-error "lvalue" }
+ sink_1_8(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test1_1() + test1_2() + test1_3() + test1_5() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv1p.C b/gcc/testsuite/g++.dg/cpp0x/rv1p.C
index 6241885654e..b2770ef33d5 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv1p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv1p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -93,7 +93,6 @@ int test1_5()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_5(a)) == 5> t1;
sa<sizeof(sink_1_5(source())) == 5> t5;
return 0;
}
@@ -106,8 +105,6 @@ int test1_6()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_6(a)) == 6> t1;
- sa<sizeof(sink_1_6(ca)) == 6> t2;
sa<sizeof(sink_1_6(source())) == 6> t5;
sa<sizeof(sink_1_6(c_source())) == 6> t6;
return 0;
@@ -121,8 +118,6 @@ int test1_7()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_7(a)) == 7> t1;
- sa<sizeof(sink_1_7(va)) == 7> t3;
sa<sizeof(sink_1_7(source())) == 7> t5;
sa<sizeof(sink_1_7(v_source())) == 7> t7;
return 0;
@@ -136,10 +131,6 @@ int test1_8()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_1_8(a)) == 8> t1;
- sa<sizeof(sink_1_8(ca)) == 8> t2;
- sa<sizeof(sink_1_8(va)) == 8> t3;
- sa<sizeof(sink_1_8(cva)) == 8> t4;
sa<sizeof(sink_1_8(source())) == 8> t5;
sa<sizeof(sink_1_8(c_source())) == 8> t6;
sa<sizeof(sink_1_8(v_source())) == 8> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2n.C b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
index a4c11c60e2d..5eee82c4bcf 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -30,8 +30,8 @@ const volatile A cv_source();
// 2 at a time
-one sink_2_12( A&); // { dg-message "candidates" }
-two sink_2_12(const A&); // { dg-message "note" }
+one sink_2_12( A&); // { dg-message "candidates|argument" }
+two sink_2_12(const A&); // { dg-message "note|argument" }
int test2_12()
{
@@ -46,8 +46,8 @@ int test2_12()
return 0;
}
-one sink_2_13( A&); // { dg-message "candidates" }
-three sink_2_13(volatile A&); // { dg-message "note" }
+one sink_2_13( A&); // { dg-message "candidates|argument" }
+three sink_2_13(volatile A&); // { dg-message "note|argument" }
int test2_13()
{
@@ -64,8 +64,8 @@ int test2_13()
return 0;
}
-one sink_2_14( A&); // { dg-message "candidates" }
-four sink_2_14(const volatile A&); // { dg-message "note" }
+one sink_2_14( A&); // { dg-message "candidates|argument" }
+four sink_2_14(const volatile A&); // { dg-message "note|argument" }
int test2_14()
{
@@ -80,8 +80,8 @@ int test2_14()
return 0;
}
-one sink_2_15( A&); // { dg-message "candidates" }
-five sink_2_15( A&&); // { dg-message "note" }
+one sink_2_15( A&); // { dg-message "candidates|argument" }
+five sink_2_15( A&&); // { dg-message "note|argument" }
int test2_15()
{
@@ -98,8 +98,8 @@ int test2_15()
return 0;
}
-one sink_2_16( A&); // { dg-message "candidates" }
-six sink_2_16(const A&&); // { dg-message "note" }
+one sink_2_16( A&); // { dg-message "candidates|argument" }
+six sink_2_16(const A&&); // { dg-message "note|argument" }
int test2_16()
{
@@ -107,6 +107,7 @@ int test2_16()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_16(ca); // { dg-error "lvalue" }
sink_2_16(va); // { dg-error "no match" }
sink_2_16(cva); // { dg-error "no match" }
sink_2_16(v_source()); // { dg-error "no match" }
@@ -114,8 +115,8 @@ int test2_16()
return 0;
}
-one sink_2_17( A&); // { dg-message "candidates" }
-seven sink_2_17(volatile A&&); // { dg-message "note" }
+one sink_2_17( A&); // { dg-message "candidates|argument" }
+seven sink_2_17(volatile A&&); // { dg-message "note|argument" }
int test2_17()
{
@@ -124,14 +125,29 @@ int test2_17()
volatile A va;
const volatile A cva = a;
sink_2_17(ca); // { dg-error "no match" }
+ sink_2_17(va); // { dg-error "lvalue" }
sink_2_17(cva); // { dg-error "no match" }
sink_2_17(c_source()); // { dg-error "no match" }
sink_2_17(cv_source()); // { dg-error "no match" }
return 0;
}
-two sink_2_23(const A&); // { dg-message "candidates" }
-three sink_2_23(volatile A&); // { dg-message "note" }
+one sink_2_18( A&);
+eight sink_2_18(const volatile A&&); // { dg-error "argument" }
+
+int test2_18()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_18(ca); // { dg-error "lvalue" }
+ sink_2_18(va); // { dg-error "lvalue" }
+ sink_2_18(cva); // { dg-error "lvalue" }
+}
+
+two sink_2_23(const A&); // { dg-message "candidates|argument" }
+three sink_2_23(volatile A&); // { dg-message "note|argument" }
int test2_23()
{
@@ -146,8 +162,8 @@ int test2_23()
return 0;
}
-two sink_2_24(const A&); // { dg-message "candidates" }
-four sink_2_24(const volatile A&); // { dg-message "note" }
+two sink_2_24(const A&); // { dg-message "candidates|argument" }
+four sink_2_24(const volatile A&); // { dg-message "note|argument" }
int test2_24()
{
@@ -161,7 +177,7 @@ int test2_24()
}
three sink_2_34(volatile A&); // { dg-message "candidate" }
-four sink_2_34(const volatile A&); // { dg-message "note" }
+four sink_2_34(const volatile A&); // { dg-message "note|argument" }
int test2_34()
{
@@ -177,7 +193,7 @@ int test2_34()
}
two sink_2_25(const A&); // { dg-message "candidate" }
-five sink_2_25( A&&); // { dg-message "note" }
+five sink_2_25( A&&); // { dg-message "note|argument" }
int test2_25()
{
@@ -193,7 +209,7 @@ int test2_25()
}
two sink_2_26(const A&); // { dg-message "candidate" }
-six sink_2_26(const A&&); // { dg-message "note" }
+six sink_2_26(const A&&); // { dg-message "note|argument" }
int test2_26()
{
@@ -209,7 +225,7 @@ int test2_26()
}
two sink_2_27(const A&); // { dg-message "candidate" }
-seven sink_2_27(volatile A&&); // { dg-message "note" }
+seven sink_2_27(volatile A&&); // { dg-message "note|argument" }
int test2_27()
{
@@ -217,13 +233,27 @@ int test2_27()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_27(va); // { dg-error "lvalue" }
sink_2_27(cva); // { dg-error "no match" }
sink_2_27(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_2_28(const A&);
+eight sink_2_28(const volatile A&&); // { dg-error "argument" }
+
+int test2_28()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_28(va); // { dg-error "lvalue" }
+ sink_2_28(cva); // { dg-error "lvalue" }
+}
+
three sink_2_35(volatile A&); // { dg-message "candidate" }
-five sink_2_35( A&&); // { dg-message "note" }
+five sink_2_35( A&&); // { dg-message "note|argument" }
int test2_35()
{
@@ -240,7 +270,7 @@ int test2_35()
}
three sink_2_36(volatile A&); // { dg-message "candidate" }
-six sink_2_36(const A&&); // { dg-message "note" }
+six sink_2_36(const A&&); // { dg-message "note|argument" }
int test2_36()
{
@@ -248,6 +278,7 @@ int test2_36()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_36(ca); // { dg-error "lvalue" }
sink_2_36(cva); // { dg-error "no match" }
sink_2_36(v_source()); // { dg-error "no match" }
sink_2_36(cv_source()); // { dg-error "no match" }
@@ -255,7 +286,7 @@ int test2_36()
}
three sink_2_37(volatile A&); // { dg-message "candidate" }
-seven sink_2_37(volatile A&&); // { dg-message "note" }
+seven sink_2_37(volatile A&&); // { dg-message "note|argument" }
int test2_37()
{
@@ -270,8 +301,21 @@ int test2_37()
return 0;
}
+three sink_2_38(volatile A&);
+eight sink_2_38(const volatile A&&); // { dg-error "argument" }
+
+int test2_38()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_38(ca); // { dg-error "lvalue" }
+ sink_2_38(cva); // { dg-error "lvalue" }
+}
+
four sink_2_45(const volatile A&); // { dg-message "candidate" }
-five sink_2_45( A&&); // { dg-message "note" }
+five sink_2_45( A&&); // { dg-message "note|argument" }
int test2_45()
{
@@ -286,7 +330,7 @@ int test2_45()
}
four sink_2_46(const volatile A&); // { dg-message "candidate" }
-six sink_2_46(const A&&); // { dg-message "note" }
+six sink_2_46(const A&&); // { dg-message "note|argument" }
int test2_46()
{
@@ -300,7 +344,7 @@ int test2_46()
}
four sink_2_47(const volatile A&); // { dg-message "candidate" }
-seven sink_2_47(volatile A&&); // { dg-message "note" }
+seven sink_2_47(volatile A&&); // { dg-message "note|argument" }
int test2_47()
{
@@ -313,8 +357,8 @@ int test2_47()
return 0;
}
-five sink_2_56( A&&); // { dg-message "candidate" }
-six sink_2_56(const A&&); // { dg-message "note" }
+five sink_2_56( A&&); // { dg-message "candidate|argument" }
+six sink_2_56(const A&&); // { dg-message "note|argument" }
int test2_56()
{
@@ -322,6 +366,8 @@ int test2_56()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_56(a); // { dg-error "lvalue" }
+ sink_2_56(ca); // { dg-error "lvalue" }
sink_2_56(va); // { dg-error "no match" }
sink_2_56(cva); // { dg-error "no match" }
sink_2_56(v_source()); // { dg-error "no match" }
@@ -329,8 +375,8 @@ int test2_56()
return 0;
}
-five sink_2_57( A&&); // { dg-message "candidate" }
-seven sink_2_57(volatile A&&); // { dg-message "note" }
+five sink_2_57( A&&); // { dg-message "candidate|argument" }
+seven sink_2_57(volatile A&&); // { dg-message "note|argument" }
int test2_57()
{
@@ -338,6 +384,8 @@ int test2_57()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_2_57(a); // { dg-error "lvalue" }
+ sink_2_57(va); // { dg-error "lvalue" }
sink_2_57(ca); // { dg-error "no match" }
sink_2_57(cva); // { dg-error "no match" }
sink_2_57(c_source()); // { dg-error "no match" }
@@ -345,8 +393,23 @@ int test2_57()
return 0;
}
-six sink_2_67(const A&&); // { dg-message "candidate" }
-seven sink_2_67(volatile A&&); // { dg-message "note" }
+five sink_2_58( A&&); // { dg-error "argument" }
+eight sink_2_58(const volatile A&&); // { dg-error "argument" }
+
+int test2_58()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_58(a); // { dg-error "lvalue" }
+ sink_2_58(ca); // { dg-error "lvalue" }
+ sink_2_58(va); // { dg-error "lvalue" }
+ sink_2_58(cva); // { dg-error "lvalue" }
+}
+
+six sink_2_67(const A&&); // { dg-message "candidate|argument" }
+seven sink_2_67(volatile A&&); // { dg-message "note|argument" }
int test2_67()
{
@@ -355,12 +418,44 @@ int test2_67()
volatile A va;
const volatile A cva = a;
sink_2_67(a); // { dg-error "ambiguous" }
+ sink_2_67(ca); // { dg-error "lvalue" }
+ sink_2_67(va); // { dg-error "lvalue" }
sink_2_67(cva); // { dg-error "no match" }
sink_2_67(source()); // { dg-error "ambiguous" }
sink_2_67(cv_source()); // { dg-error "no match" }
return 0;
}
+six sink_2_68(const A&&); // { dg-error "argument" }
+eight sink_2_68(const volatile A&&); // { dg-error "argument" }
+
+int test2_68()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_68(a); // { dg-error "lvalue" }
+ sink_2_68(ca); // { dg-error "lvalue" }
+ sink_2_68(va); // { dg-error "lvalue" }
+ sink_2_68(cva); // { dg-error "lvalue" }
+}
+
+seven sink_2_78(volatile A&&); // { dg-error "argument" }
+eight sink_2_78(const volatile A&&); // { dg-error "argument" }
+
+int test2_78()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_2_78(a); // { dg-error "lvalue" }
+ sink_2_78(ca); // { dg-error "lvalue" }
+ sink_2_78(va); // { dg-error "lvalue" }
+ sink_2_78(cva); // { dg-error "lvalue" }
+}
+
int main()
{
return test2_12() + test2_13() + test2_15() + test2_16() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv2p.C b/gcc/testsuite/g++.dg/cpp0x/rv2p.C
index 0d12aac75e1..61c4fb046b6 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv2p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv2p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -100,7 +100,6 @@ int test2_16()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_16(a)) == 1> t1;
- sa<sizeof(sink_2_16(ca)) == 6> t2;
sa<sizeof(sink_2_16(source())) == 6> t5;
sa<sizeof(sink_2_16(c_source())) == 6> t6;
return 0;
@@ -116,7 +115,6 @@ int test2_17()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_17(a)) == 1> t1;
- sa<sizeof(sink_2_17(va)) == 7> t3;
sa<sizeof(sink_2_17(source())) == 7> t5;
sa<sizeof(sink_2_17(v_source())) == 7> t7;
return 0;
@@ -132,9 +130,6 @@ int test2_18()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_18(a)) == 1> t1;
- sa<sizeof(sink_2_18(ca)) == 8> t2;
- sa<sizeof(sink_2_18(va)) == 8> t3;
- sa<sizeof(sink_2_18(cva)) == 8> t4;
sa<sizeof(sink_2_18(source())) == 8> t5;
sa<sizeof(sink_2_18(c_source())) == 8> t6;
sa<sizeof(sink_2_18(v_source())) == 8> t7;
@@ -221,7 +216,6 @@ int test2_27()
const volatile A cva = a;
sa<sizeof(sink_2_27(a)) == 2> t1;
sa<sizeof(sink_2_27(ca)) == 2> t2;
- sa<sizeof(sink_2_27(va)) == 7> t3;
sa<sizeof(sink_2_27(source())) == 7> t5;
sa<sizeof(sink_2_27(c_source())) == 2> t6;
sa<sizeof(sink_2_27(v_source())) == 7> t7;
@@ -239,8 +233,6 @@ int test2_28()
const volatile A cva = a;
sa<sizeof(sink_2_28(a)) == 2> t1;
sa<sizeof(sink_2_28(ca)) == 2> t2;
- sa<sizeof(sink_2_28(va)) == 8> t3;
- sa<sizeof(sink_2_28(cva)) == 8> t4;
sa<sizeof(sink_2_28(source())) == 8> t5;
sa<sizeof(sink_2_28(c_source())) == 8> t6;
sa<sizeof(sink_2_28(v_source())) == 8> t7;
@@ -293,7 +285,6 @@ int test2_36()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_36(a)) == 3> t1;
- sa<sizeof(sink_2_36(ca)) == 6> t2;
sa<sizeof(sink_2_36(va)) == 3> t3;
sa<sizeof(sink_2_36(source())) == 6> t5;
sa<sizeof(sink_2_36(c_source())) == 6> t6;
@@ -326,9 +317,7 @@ int test2_38()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_2_38(a)) == 3> t1;
- sa<sizeof(sink_2_38(ca)) == 8> t2;
sa<sizeof(sink_2_38(va)) == 3> t3;
- sa<sizeof(sink_2_38(cva)) == 8> t4;
sa<sizeof(sink_2_38(source())) == 8> t5;
sa<sizeof(sink_2_38(c_source())) == 8> t6;
sa<sizeof(sink_2_38(v_source())) == 8> t7;
@@ -425,8 +414,6 @@ int test2_56()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_56(a)) == 5> t1;
- sa<sizeof(sink_2_56(ca)) == 6> t2;
sa<sizeof(sink_2_56(source())) == 5> t5;
sa<sizeof(sink_2_56(c_source())) == 6> t6;
return 0;
@@ -441,8 +428,6 @@ int test2_57()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_57(a)) == 5> t1;
- sa<sizeof(sink_2_57(va)) == 7> t3;
sa<sizeof(sink_2_57(source())) == 5> t5;
sa<sizeof(sink_2_57(v_source())) == 7> t7;
return 0;
@@ -457,10 +442,6 @@ int test2_58()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_58(a)) == 5> t1;
- sa<sizeof(sink_2_58(ca)) == 8> t2;
- sa<sizeof(sink_2_58(va)) == 8> t3;
- sa<sizeof(sink_2_58(cva)) == 8> t4;
sa<sizeof(sink_2_58(source())) == 5> t5;
sa<sizeof(sink_2_58(c_source())) == 8> t6;
sa<sizeof(sink_2_58(v_source())) == 8> t7;
@@ -477,8 +458,6 @@ int test2_67()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_67(ca)) == 6> t2;
- sa<sizeof(sink_2_67(va)) == 7> t3;
sa<sizeof(sink_2_67(c_source())) == 6> t6;
sa<sizeof(sink_2_67(v_source())) == 7> t7;
return 0;
@@ -493,10 +472,6 @@ int test2_68()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_68(a)) == 6> t1;
- sa<sizeof(sink_2_68(ca)) == 6> t2;
- sa<sizeof(sink_2_68(va)) == 8> t3;
- sa<sizeof(sink_2_68(cva)) == 8> t4;
sa<sizeof(sink_2_68(source())) == 6> t5;
sa<sizeof(sink_2_68(c_source())) == 6> t6;
sa<sizeof(sink_2_68(v_source())) == 8> t7;
@@ -513,10 +488,6 @@ int test2_78()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_2_78(a)) == 7> t1;
- sa<sizeof(sink_2_78(ca)) == 8> t2;
- sa<sizeof(sink_2_78(va)) == 7> t3;
- sa<sizeof(sink_2_78(cva)) == 8> t4;
sa<sizeof(sink_2_78(source())) == 7> t5;
sa<sizeof(sink_2_78(c_source())) == 8> t6;
sa<sizeof(sink_2_78(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3n.C b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
index 84675b37fee..0c208ab6ed0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -97,7 +97,7 @@ int test3_126()
one sink_3_127( A&); // { dg-message "candidates" }
two sink_3_127(const A&); // { dg-message "note" }
-seven sink_3_127(volatile A&&); // { dg-message "note" }
+seven sink_3_127(volatile A&&); // { dg-message "" }
int test3_127()
{
@@ -105,11 +105,27 @@ int test3_127()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_127(va); // { dg-error "lvalue" }
sink_3_127(cva); // { dg-error "no match" }
sink_3_127(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_3_128( A&);
+two sink_3_128(const A&);
+eight sink_3_128(const volatile A&&); // { dg-message "" }
+
+int test3_128()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+
+ sink_3_128(va); // { dg-error "lvalue" }
+ sink_3_128(cva); // { dg-error "lvalue" }
+}
+
one sink_3_134( A&); // { dg-message "candidates" }
three sink_3_134(volatile A&); // { dg-message "note" }
four sink_3_134(const volatile A&); // { dg-message "note" }
@@ -147,7 +163,7 @@ int test3_135()
one sink_3_136( A&); // { dg-message "candidates" }
three sink_3_136(volatile A&); // { dg-message "note" }
-six sink_3_136(const A&&); // { dg-message "note" }
+six sink_3_136(const A&&); // { dg-message "" }
int test3_136()
{
@@ -155,6 +171,7 @@ int test3_136()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_136(ca); // { dg-error "lvalue" }
sink_3_136(cva); // { dg-error "no match" }
sink_3_136(v_source()); // { dg-error "no match" }
sink_3_136(cv_source()); // { dg-error "no match" }
@@ -178,6 +195,21 @@ int test3_137()
return 0;
}
+one sink_3_138( A&);
+three sink_3_138(volatile A&);
+eight sink_3_138(const volatile A&&); // { dg-message "" }
+
+int test3_138()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_138(ca); // { dg-error "lvalue" }
+ sink_3_138(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_3_145( A&); // { dg-message "candidates" }
four sink_3_145(const volatile A&); // { dg-message "note" }
five sink_3_145( A&&); // { dg-message "note" }
@@ -226,7 +258,7 @@ int test3_147()
one sink_3_156( A&); // { dg-message "candidates" }
five sink_3_156( A&&); // { dg-message "note" }
-six sink_3_156(const A&&); // { dg-message "note" }
+six sink_3_156(const A&&); // { dg-message "" }
int test3_156()
{
@@ -234,6 +266,7 @@ int test3_156()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_156(ca); // { dg-error "lvalue" }
sink_3_156(va); // { dg-error "no match" }
sink_3_156(cva); // { dg-error "no match" }
sink_3_156(v_source()); // { dg-error "no match" }
@@ -243,7 +276,7 @@ int test3_156()
one sink_3_157( A&); // { dg-message "candidates" }
five sink_3_157( A&&); // { dg-message "note" }
-seven sink_3_157(volatile A&&); // { dg-message "note" }
+seven sink_3_157(volatile A&&); // { dg-message "" }
int test3_157()
{
@@ -252,15 +285,32 @@ int test3_157()
volatile A va;
const volatile A cva = a;
sink_3_157(ca); // { dg-error "no match" }
+ sink_3_157(va); // { dg-error "lvalue" }
sink_3_157(cva); // { dg-error "no match" }
sink_3_157(c_source()); // { dg-error "no match" }
sink_3_157(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_3_158( A&);
+five sink_3_158( A&&);
+eight sink_3_158(const volatile A&&); // { dg-message "" }
+
+int test3_158()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_158(ca); // { dg-error "lvalue" }
+ sink_3_158(va); // { dg-error "lvalue" }
+ sink_3_158(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_3_167( A&); // { dg-message "candidates" }
-six sink_3_167(const A&&); // { dg-message "note" }
-seven sink_3_167(volatile A&&); // { dg-message "note" }
+six sink_3_167(const A&&); // { dg-message "" }
+seven sink_3_167(volatile A&&); // { dg-message "" }
int test3_167()
{
@@ -268,12 +318,46 @@ int test3_167()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_167(ca); // { dg-error "lvalue" }
+ sink_3_167(va); // { dg-error "lvalue" }
sink_3_167(cva); // { dg-error "no match" }
sink_3_167(source()); // { dg-error "ambiguous" }
sink_3_167(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_3_168( A&);
+six sink_3_168(const A&&); // { dg-message "" }
+eight sink_3_168(const volatile A&&); // { dg-message "" }
+
+int test3_168()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_168(ca); // { dg-error "lvalue" }
+ sink_3_168(va); // { dg-error "lvalue" }
+ sink_3_168(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_3_178( A&);
+seven sink_3_178(volatile A&&); // { dg-message "" }
+eight sink_3_178(const volatile A&&); // { dg-message "" }
+
+int test3_178()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_178(ca); // { dg-error "lvalue" }
+ sink_3_178(va); // { dg-error "lvalue" }
+ sink_3_178(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_3_234(const A&); // { dg-message "candidates" }
three sink_3_234(volatile A&); // { dg-message "note" }
four sink_3_234(const volatile A&); // { dg-message "note" }
@@ -342,7 +426,7 @@ int test3_237()
two sink_3_238(const A&); // { dg-message "candidates" }
three sink_3_238(volatile A&); // { dg-message "note" }
-eight sink_3_238(const volatile A&&); // { dg-message "note" }
+eight sink_3_238(const volatile A&&); // { dg-message "" }
int test3_238()
{
@@ -351,6 +435,7 @@ int test3_238()
volatile A va;
const volatile A cva = a;
sink_3_238(a); // { dg-error "ambiguous" }
+ sink_3_238(cva); // { dg-error "lvalue" }
return 0;
}
@@ -417,7 +502,7 @@ int test3_256()
two sink_3_257(const A&); // { dg-message "candidates" }
five sink_3_257( A&&); // { dg-message "note" }
-seven sink_3_257(volatile A&&); // { dg-message "note" }
+seven sink_3_257(volatile A&&); // { dg-message "" }
int test3_257()
{
@@ -425,14 +510,30 @@ int test3_257()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_257(va); // { dg-error "lvalue" }
sink_3_257(cva); // { dg-error "no match" }
sink_3_257(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_3_258(const A&);
+five sink_3_258( A&&);
+eight sink_3_258(const volatile A&&); // { dg-message "" }
+
+int test3_258()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_258(va); // { dg-error "lvalue" }
+ sink_3_258(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_3_267(const A&); // { dg-message "candidates" }
six sink_3_267(const A&&); // { dg-message "note" }
-seven sink_3_267(volatile A&&); // { dg-message "note" }
+seven sink_3_267(volatile A&&); // { dg-message "" }
int test3_267()
{
@@ -440,12 +541,43 @@ int test3_267()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_267(va); // { dg-error "lvalue" }
sink_3_267(cva); // { dg-error "no match" }
sink_3_267(source()); // { dg-error "ambiguous" }
sink_3_267(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_3_268(const A&);
+six sink_3_268(const A&&);
+eight sink_3_268(const volatile A&&); // { dg-message "" }
+
+int test3_268()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_268(va); // { dg-error "lvalue" }
+ sink_3_268(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+two sink_3_278(const A&);
+seven sink_3_278(volatile A&&); // { dg-message "" }
+eight sink_3_278(const volatile A&&); // { dg-message "" }
+
+int test3_278()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_278(va); // { dg-error "lvalue" }
+ sink_3_278(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_3_345(volatile A&); // { dg-message "candidates" }
four sink_3_345(const volatile A&); // { dg-message "note" }
five sink_3_345( A&&); // { dg-message "note" }
@@ -494,7 +626,7 @@ int test3_347()
three sink_3_356(volatile A&); // { dg-message "candidates" }
five sink_3_356( A&&); // { dg-message "note" }
-six sink_3_356(const A&&); // { dg-message "note" }
+six sink_3_356(const A&&); // { dg-message "" }
int test3_356()
{
@@ -502,6 +634,7 @@ int test3_356()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_356(ca); // { dg-error "lvalue" }
sink_3_356(cva); // { dg-error "no match" }
sink_3_356(v_source()); // { dg-error "no match" }
sink_3_356(cv_source()); // { dg-error "no match" }
@@ -525,8 +658,23 @@ int test3_357()
return 0;
}
+three sink_3_358(volatile A&);
+five sink_3_358( A&&);
+eight sink_3_358(const volatile A&&); // { dg-message "" }
+
+int test3_358()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_358(ca); // { dg-error "lvalue" }
+ sink_3_358(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_3_367(volatile A&); // { dg-message "candidates" }
-six sink_3_367(const A&&); // { dg-message "note" }
+six sink_3_367(const A&&); // { dg-message "" }
seven sink_3_367(volatile A&&); // { dg-message "note" }
int test3_367()
@@ -535,12 +683,43 @@ int test3_367()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_367(ca); // { dg-error "lvalue" }
sink_3_367(cva); // { dg-error "no match" }
sink_3_367(source()); // { dg-error "ambiguous" }
sink_3_367(cv_source()); // { dg-error "no match" }
return 0;
}
+three sink_3_368(volatile A&);
+six sink_3_368(const A&&); // { dg-message "" }
+eight sink_3_368(const volatile A&&); // { dg-message "" }
+
+int test3_368()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_368(ca); // { dg-error "lvalue" }
+ sink_3_368(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+three sink_3_378(volatile A&);
+seven sink_3_378(volatile A&&);
+eight sink_3_378(const volatile A&&); // { dg-message "" }
+
+int test3_378()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_378(ca); // { dg-error "lvalue" }
+ sink_3_378(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
four sink_3_456(const volatile A&); // { dg-message "candidates" }
five sink_3_456( A&&); // { dg-message "note" }
six sink_3_456(const A&&); // { dg-message "note" }
@@ -586,9 +765,9 @@ int test3_467()
return 0;
}
-five sink_3_567( A&&); // { dg-message "candidates" }
-six sink_3_567(const A&&); // { dg-message "note" }
-seven sink_3_567(volatile A&&); // { dg-message "note" }
+five sink_3_567( A&&); // { dg-message "" }
+six sink_3_567(const A&&); // { dg-message "" }
+seven sink_3_567(volatile A&&); // { dg-message "" }
int test3_567()
{
@@ -596,14 +775,51 @@ int test3_567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_3_567(a); // { dg-error "lvalue" }
+ sink_3_567(ca); // { dg-error "lvalue" }
+ sink_3_567(va); // { dg-error "lvalue" }
sink_3_567(cva); // { dg-error "no match" }
sink_3_567(cv_source()); // { dg-error "no match" }
return 0;
}
-six sink_3_678(const A&&); // { dg-message "candidates" }
-seven sink_3_678(volatile A&&); // { dg-message "note" }
-eight sink_3_678(const volatile A&&); // { dg-message "note" }
+five sink_3_568( A&&); // { dg-message "" }
+six sink_3_568(const A&&); // { dg-message "" }
+eight sink_3_568(const volatile A&&); // { dg-message "" }
+
+int test3_568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_568(a); // { dg-error "lvalue" }
+ sink_3_568(ca); // { dg-error "lvalue" }
+ sink_3_568(va); // { dg-error "lvalue" }
+ sink_3_568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+five sink_3_578( A&&); // { dg-message "" }
+seven sink_3_578(volatile A&&); // { dg-message "" }
+eight sink_3_578(const volatile A&&); // { dg-message "" }
+
+int test3_578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_3_578(a); // { dg-error "lvalue" }
+ sink_3_578(ca); // { dg-error "lvalue" }
+ sink_3_578(va); // { dg-error "lvalue" }
+ sink_3_578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+six sink_3_678(const A&&); // { dg-message "" }
+seven sink_3_678(volatile A&&); // { dg-message "" }
+eight sink_3_678(const volatile A&&); // { dg-message "" }
int test3_678()
{
@@ -612,6 +828,9 @@ int test3_678()
volatile A va;
const volatile A cva = a;
sink_3_678(a); // { dg-error "ambiguous" }
+ sink_3_678(ca); // { dg-error "lvalue" }
+ sink_3_678(va); // { dg-error "lvalue" }
+ sink_3_678(cva); // { dg-error "lvalue" }
sink_3_678(source()); // { dg-error "ambiguous" }
return 0;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv3p.C b/gcc/testsuite/g++.dg/cpp0x/rv3p.C
index c688b11e236..5ab171f2655 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv3p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv3p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -113,7 +113,6 @@ int test3_127()
const volatile A cva = a;
sa<sizeof(sink_3_127(a)) == 1> t1;
sa<sizeof(sink_3_127(ca)) == 2> t2;
- sa<sizeof(sink_3_127(va)) == 7> t3;
sa<sizeof(sink_3_127(source())) == 7> t5;
sa<sizeof(sink_3_127(c_source())) == 2> t6;
sa<sizeof(sink_3_127(v_source())) == 7> t7;
@@ -132,8 +131,6 @@ int test3_128()
const volatile A cva = a;
sa<sizeof(sink_3_128(a)) == 1> t1;
sa<sizeof(sink_3_128(ca)) == 2> t2;
- sa<sizeof(sink_3_128(va)) == 8> t3;
- sa<sizeof(sink_3_128(cva)) == 8> t4;
sa<sizeof(sink_3_128(source())) == 8> t5;
sa<sizeof(sink_3_128(c_source())) == 8> t6;
sa<sizeof(sink_3_128(v_source())) == 8> t7;
@@ -185,7 +182,6 @@ int test3_136()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_136(a)) == 1> t1;
- sa<sizeof(sink_3_136(ca)) == 6> t2;
sa<sizeof(sink_3_136(va)) == 3> t3;
sa<sizeof(sink_3_136(source())) == 6> t5;
sa<sizeof(sink_3_136(c_source())) == 6> t6;
@@ -220,9 +216,7 @@ int test3_138()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_138(a)) == 1> t1;
- sa<sizeof(sink_3_138(ca)) == 8> t2;
sa<sizeof(sink_3_138(va)) == 3> t3;
- sa<sizeof(sink_3_138(cva)) == 8> t4;
sa<sizeof(sink_3_138(source())) == 8> t5;
sa<sizeof(sink_3_138(c_source())) == 8> t6;
sa<sizeof(sink_3_138(v_source())) == 8> t7;
@@ -318,7 +312,6 @@ int test3_156()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_156(a)) == 1> t1;
- sa<sizeof(sink_3_156(ca)) == 6> t2;
sa<sizeof(sink_3_156(source())) == 5> t5;
sa<sizeof(sink_3_156(c_source())) == 6> t6;
return 0;
@@ -335,7 +328,6 @@ int test3_157()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_157(a)) == 1> t1;
- sa<sizeof(sink_3_157(va)) == 7> t3;
sa<sizeof(sink_3_157(source())) == 5> t5;
sa<sizeof(sink_3_157(v_source())) == 7> t7;
return 0;
@@ -352,9 +344,6 @@ int test3_158()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_158(a)) == 1> t1;
- sa<sizeof(sink_3_158(ca)) == 8> t2;
- sa<sizeof(sink_3_158(va)) == 8> t3;
- sa<sizeof(sink_3_158(cva)) == 8> t4;
sa<sizeof(sink_3_158(source())) == 5> t5;
sa<sizeof(sink_3_158(c_source())) == 8> t6;
sa<sizeof(sink_3_158(v_source())) == 8> t7;
@@ -373,8 +362,6 @@ int test3_167()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_167(a)) == 1> t1;
- sa<sizeof(sink_3_167(ca)) == 6> t2;
- sa<sizeof(sink_3_167(va)) == 7> t3;
sa<sizeof(sink_3_167(c_source())) == 6> t6;
sa<sizeof(sink_3_167(v_source())) == 7> t7;
return 0;
@@ -391,9 +378,6 @@ int test3_168()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_168(a)) == 1> t1;
- sa<sizeof(sink_3_168(ca)) == 6> t2;
- sa<sizeof(sink_3_168(va)) == 8> t3;
- sa<sizeof(sink_3_168(cva)) == 8> t4;
sa<sizeof(sink_3_168(source())) == 6> t5;
sa<sizeof(sink_3_168(c_source())) == 6> t6;
sa<sizeof(sink_3_168(v_source())) == 8> t7;
@@ -412,9 +396,6 @@ int test3_178()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_178(a)) == 1> t1;
- sa<sizeof(sink_3_178(ca)) == 8> t2;
- sa<sizeof(sink_3_178(va)) == 7> t3;
- sa<sizeof(sink_3_178(cva)) == 8> t4;
sa<sizeof(sink_3_178(source())) == 7> t5;
sa<sizeof(sink_3_178(c_source())) == 8> t6;
sa<sizeof(sink_3_178(v_source())) == 7> t7;
@@ -504,7 +485,6 @@ int test3_238()
const volatile A cva = a;
sa<sizeof(sink_3_238(ca)) == 2> t2;
sa<sizeof(sink_3_238(va)) == 3> t3;
- sa<sizeof(sink_3_238(cva)) == 8> t4;
sa<sizeof(sink_3_238(source())) == 8> t5;
sa<sizeof(sink_3_238(c_source())) == 8> t6;
sa<sizeof(sink_3_238(v_source())) == 8> t7;
@@ -620,7 +600,6 @@ int test3_257()
const volatile A cva = a;
sa<sizeof(sink_3_257(a)) == 2> t1;
sa<sizeof(sink_3_257(ca)) == 2> t2;
- sa<sizeof(sink_3_257(va)) == 7> t3;
sa<sizeof(sink_3_257(source())) == 5> t5;
sa<sizeof(sink_3_257(c_source())) == 2> t6;
sa<sizeof(sink_3_257(v_source())) == 7> t7;
@@ -639,8 +618,6 @@ int test3_258()
const volatile A cva = a;
sa<sizeof(sink_3_258(a)) == 2> t1;
sa<sizeof(sink_3_258(ca)) == 2> t2;
- sa<sizeof(sink_3_258(va)) == 8> t3;
- sa<sizeof(sink_3_258(cva)) == 8> t4;
sa<sizeof(sink_3_258(source())) == 5> t5;
sa<sizeof(sink_3_258(c_source())) == 8> t6;
sa<sizeof(sink_3_258(v_source())) == 8> t7;
@@ -660,7 +637,6 @@ int test3_267()
const volatile A cva = a;
sa<sizeof(sink_3_267(a)) == 2> t1;
sa<sizeof(sink_3_267(ca)) == 2> t2;
- sa<sizeof(sink_3_267(va)) == 7> t3;
sa<sizeof(sink_3_267(c_source())) == 6> t6;
sa<sizeof(sink_3_267(v_source())) == 7> t7;
return 0;
@@ -678,8 +654,6 @@ int test3_268()
const volatile A cva = a;
sa<sizeof(sink_3_268(a)) == 2> t1;
sa<sizeof(sink_3_268(ca)) == 2> t2;
- sa<sizeof(sink_3_268(va)) == 8> t3;
- sa<sizeof(sink_3_268(cva)) == 8> t4;
sa<sizeof(sink_3_268(source())) == 6> t5;
sa<sizeof(sink_3_268(c_source())) == 6> t6;
sa<sizeof(sink_3_268(v_source())) == 8> t7;
@@ -699,8 +673,6 @@ int test3_278()
const volatile A cva = a;
sa<sizeof(sink_3_278(a)) == 2> t1;
sa<sizeof(sink_3_278(ca)) == 2> t2;
- sa<sizeof(sink_3_278(va)) == 7> t3;
- sa<sizeof(sink_3_278(cva)) == 8> t4;
sa<sizeof(sink_3_278(source())) == 7> t5;
sa<sizeof(sink_3_278(c_source())) == 8> t6;
sa<sizeof(sink_3_278(v_source())) == 7> t7;
@@ -796,7 +768,6 @@ int test3_356()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_356(a)) == 3> t1;
- sa<sizeof(sink_3_356(ca)) == 6> t2;
sa<sizeof(sink_3_356(va)) == 3> t3;
sa<sizeof(sink_3_356(source())) == 5> t5;
sa<sizeof(sink_3_356(c_source())) == 6> t6;
@@ -831,9 +802,7 @@ int test3_358()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_358(a)) == 3> t1;
- sa<sizeof(sink_3_358(ca)) == 8> t2;
sa<sizeof(sink_3_358(va)) == 3> t3;
- sa<sizeof(sink_3_358(cva)) == 8> t4;
sa<sizeof(sink_3_358(source())) == 5> t5;
sa<sizeof(sink_3_358(c_source())) == 8> t6;
sa<sizeof(sink_3_358(v_source())) == 8> t7;
@@ -852,7 +821,6 @@ int test3_367()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_367(a)) == 3> t1;
- sa<sizeof(sink_3_367(ca)) == 6> t2;
sa<sizeof(sink_3_367(va)) == 3> t3;
sa<sizeof(sink_3_367(c_source())) == 6> t6;
sa<sizeof(sink_3_367(v_source())) == 7> t7;
@@ -870,9 +838,7 @@ int test3_368()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_368(a)) == 3> t1;
- sa<sizeof(sink_3_368(ca)) == 6> t2;
sa<sizeof(sink_3_368(va)) == 3> t3;
- sa<sizeof(sink_3_368(cva)) == 8> t4;
sa<sizeof(sink_3_368(source())) == 6> t5;
sa<sizeof(sink_3_368(c_source())) == 6> t6;
sa<sizeof(sink_3_368(v_source())) == 8> t7;
@@ -891,9 +857,7 @@ int test3_378()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_3_378(a)) == 3> t1;
- sa<sizeof(sink_3_378(ca)) == 8> t2;
sa<sizeof(sink_3_378(va)) == 3> t3;
- sa<sizeof(sink_3_378(cva)) == 8> t4;
sa<sizeof(sink_3_378(source())) == 7> t5;
sa<sizeof(sink_3_378(c_source())) == 8> t6;
sa<sizeof(sink_3_378(v_source())) == 7> t7;
@@ -1031,9 +995,6 @@ int test3_567()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_567(a)) == 5> t1;
- sa<sizeof(sink_3_567(ca)) == 6> t2;
- sa<sizeof(sink_3_567(va)) == 7> t3;
sa<sizeof(sink_3_567(source())) == 5> t5;
sa<sizeof(sink_3_567(c_source())) == 6> t6;
sa<sizeof(sink_3_567(v_source())) == 7> t7;
@@ -1050,10 +1011,6 @@ int test3_568()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_568(a)) == 5> t1;
- sa<sizeof(sink_3_568(ca)) == 6> t2;
- sa<sizeof(sink_3_568(va)) == 8> t3;
- sa<sizeof(sink_3_568(cva)) == 8> t4;
sa<sizeof(sink_3_568(source())) == 5> t5;
sa<sizeof(sink_3_568(c_source())) == 6> t6;
sa<sizeof(sink_3_568(v_source())) == 8> t7;
@@ -1071,10 +1028,6 @@ int test3_578()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_578(a)) == 5> t1;
- sa<sizeof(sink_3_578(ca)) == 8> t2;
- sa<sizeof(sink_3_578(va)) == 7> t3;
- sa<sizeof(sink_3_578(cva)) == 8> t4;
sa<sizeof(sink_3_578(source())) == 5> t5;
sa<sizeof(sink_3_578(c_source())) == 8> t6;
sa<sizeof(sink_3_578(v_source())) == 7> t7;
@@ -1092,9 +1045,6 @@ int test3_678()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_3_678(ca)) == 6> t2;
- sa<sizeof(sink_3_678(va)) == 7> t3;
- sa<sizeof(sink_3_678(cva)) == 8> t4;
sa<sizeof(sink_3_678(c_source())) == 6> t6;
sa<sizeof(sink_3_678(v_source())) == 7> t7;
sa<sizeof(sink_3_678(cv_source())) == 8> t8;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv4n.C b/gcc/testsuite/g++.dg/cpp0x/rv4n.C
index b88e3f77061..cf627aed3f0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv4n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv4n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -96,6 +96,21 @@ int test4_1237()
return 0;
}
+one sink_4_1238( A&);
+two sink_4_1238(const A&);
+three sink_4_1238(volatile A&);
+eight sink_4_1238(const volatile A&&); // { dg-message "" }
+
+int test4_1238()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1238(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1245( A&); // { dg-message "candidates" }
two sink_4_1245(const A&); // { dg-message "note" }
four sink_4_1245(const volatile A&); // { dg-message "note" }
@@ -164,7 +179,7 @@ int test4_1256()
one sink_4_1257( A&); // { dg-message "candidates" }
two sink_4_1257(const A&); // { dg-message "note" }
five sink_4_1257( A&&); // { dg-message "note" }
-seven sink_4_1257(volatile A&&); // { dg-message "note" }
+seven sink_4_1257(volatile A&&); // { dg-message "" }
int test4_1257()
{
@@ -172,15 +187,32 @@ int test4_1257()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1257(va); // { dg-error "lvalue" }
sink_4_1257(cva); // { dg-error "no match" }
sink_4_1257(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1258( A&);
+two sink_4_1258(const A&);
+five sink_4_1258( A&&);
+eight sink_4_1258(const volatile A&&); // { dg-message "" }
+
+int test4_1258()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1258(va); // { dg-error "lvalue" }
+ sink_4_1258(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1267( A&); // { dg-message "candidates" }
two sink_4_1267(const A&); // { dg-message "note" }
six sink_4_1267(const A&&); // { dg-message "note" }
-seven sink_4_1267(volatile A&&); // { dg-message "note" }
+seven sink_4_1267(volatile A&&); // { dg-message "" }
int test4_1267()
{
@@ -188,12 +220,45 @@ int test4_1267()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1267(va); // { dg-error "lvalue" }
sink_4_1267(cva); // { dg-error "no match" }
sink_4_1267(source()); // { dg-error "ambiguous" }
sink_4_1267(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1268( A&);
+two sink_4_1268(const A&);
+six sink_4_1268(const A&&);
+eight sink_4_1268(const volatile A&&); // { dg-message "" }
+
+int test4_1268()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1268(va); // { dg-error "lvalue" }
+ sink_4_1268(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_4_1278( A&);
+two sink_4_1278(const A&);
+seven sink_4_1278(volatile A&&); // { dg-message "" }
+eight sink_4_1278(const volatile A&&); // { dg-message "" }
+
+int test4_1278()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1278(va); // { dg-error "lvalue" }
+ sink_4_1278(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1345( A&); // { dg-message "candidates" }
three sink_4_1345(volatile A&); // { dg-message "note" }
four sink_4_1345(const volatile A&); // { dg-message "note" }
@@ -246,7 +311,7 @@ int test4_1347()
one sink_4_1356( A&); // { dg-message "candidates" }
three sink_4_1356(volatile A&); // { dg-message "note" }
five sink_4_1356( A&&); // { dg-message "note" }
-six sink_4_1356(const A&&); // { dg-message "note" }
+six sink_4_1356(const A&&); // { dg-message "" }
int test4_1356()
{
@@ -254,6 +319,7 @@ int test4_1356()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1356(ca); // { dg-error "lvalue" }
sink_4_1356(cva); // { dg-error "no match" }
sink_4_1356(v_source()); // { dg-error "no match" }
sink_4_1356(cv_source()); // { dg-error "no match" }
@@ -278,9 +344,25 @@ int test4_1357()
return 0;
}
+one sink_4_1358( A&);
+three sink_4_1358(volatile A&);
+five sink_4_1358( A&&);
+eight sink_4_1358(const volatile A&&); // { dg-message "" }
+
+int test4_1358()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1358(ca); // { dg-error "lvalue" }
+ sink_4_1358(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1367( A&); // { dg-message "candidates" }
three sink_4_1367(volatile A&); // { dg-message "note" }
-six sink_4_1367(const A&&); // { dg-message "note" }
+six sink_4_1367(const A&&); // { dg-message "" }
seven sink_4_1367(volatile A&&); // { dg-message "note" }
int test4_1367()
@@ -289,12 +371,45 @@ int test4_1367()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1367(ca); // { dg-error "lvalue" }
sink_4_1367(cva); // { dg-error "no match" }
sink_4_1367(source()); // { dg-error "ambiguous" }
sink_4_1367(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1368( A&);
+three sink_4_1368(volatile A&);
+six sink_4_1368(const A&&); // { dg-message "" }
+eight sink_4_1368(const volatile A&&); // { dg-message "" }
+
+int test4_1368()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1368(ca); // { dg-error "lvalue" }
+ sink_4_1368(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_4_1378( A&);
+three sink_4_1378(volatile A&);
+seven sink_4_1378(volatile A&&);
+eight sink_4_1378(const volatile A&&); // { dg-message "" }
+
+int test4_1378()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1378(ca); // { dg-error "lvalue" }
+ sink_4_1378(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1456( A&); // { dg-message "candidates" }
four sink_4_1456(const volatile A&); // { dg-message "note" }
five sink_4_1456( A&&); // { dg-message "note" }
@@ -345,8 +460,8 @@ int test4_1467()
one sink_4_1567( A&); // { dg-message "candidates" }
five sink_4_1567( A&&); // { dg-message "note" }
-six sink_4_1567(const A&&); // { dg-message "note" }
-seven sink_4_1567(volatile A&&); // { dg-message "note" }
+six sink_4_1567(const A&&); // { dg-message "" }
+seven sink_4_1567(volatile A&&); // { dg-message "" }
int test4_1567()
{
@@ -354,15 +469,51 @@ int test4_1567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1567(ca); // { dg-error "lvalue" }
+ sink_4_1567(va); // { dg-error "lvalue" }
sink_4_1567(cva); // { dg-error "no match" }
sink_4_1567(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_4_1568( A&);
+five sink_4_1568( A&&);
+six sink_4_1568(const A&&); // { dg-message "" }
+eight sink_4_1568(const volatile A&&); // { dg-message "" }
+
+int test4_1568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1568(ca); // { dg-error "lvalue" }
+ sink_4_1568(va); // { dg-error "lvalue" }
+ sink_4_1568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_4_1578( A&);
+five sink_4_1578( A&&);
+seven sink_4_1578(volatile A&&); // { dg-message "" }
+eight sink_4_1578(const volatile A&&); // { dg-message "" }
+
+int test4_1578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_1578(ca); // { dg-error "lvalue" }
+ sink_4_1578(va); // { dg-error "lvalue" }
+ sink_4_1578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_4_1678( A&);
-six sink_4_1678(const A&&); // { dg-message "candidates" }
-seven sink_4_1678(volatile A&&); // { dg-message "note" }
-eight sink_4_1678(const volatile A&&); // { dg-message "note" }
+six sink_4_1678(const A&&); // { dg-message "" }
+seven sink_4_1678(volatile A&&); // { dg-message "" }
+eight sink_4_1678(const volatile A&&); // { dg-message "" }
int test4_1678()
{
@@ -370,6 +521,9 @@ int test4_1678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_1678(ca); // { dg-error "lvalue" }
+ sink_4_1678(va); // { dg-error "lvalue" }
+ sink_4_1678(cva); // { dg-error "lvalue" }
sink_4_1678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -477,7 +631,7 @@ int test4_2357()
two sink_4_2358(const A&); // { dg-message "candidates" }
three sink_4_2358(volatile A&); // { dg-message "note" }
five sink_4_2358( A&&); // { dg-message "note" }
-eight sink_4_2358(const volatile A&&); // { dg-message "note" }
+eight sink_4_2358(const volatile A&&); // { dg-message "" }
int test4_2358()
{
@@ -486,6 +640,7 @@ int test4_2358()
volatile A va;
const volatile A cva = a;
sink_4_2358(a); // { dg-error "ambiguous" }
+ sink_4_2358(cva); // { dg-error "lvalue" }
return 0;
}
@@ -510,7 +665,7 @@ int test4_2367()
two sink_4_2368(const A&); // { dg-message "candidates" }
three sink_4_2368(volatile A&); // { dg-message "note" }
six sink_4_2368(const A&&); // { dg-message "note" }
-eight sink_4_2368(const volatile A&&); // { dg-message "note" }
+eight sink_4_2368(const volatile A&&); // { dg-message "" }
int test4_2368()
{
@@ -519,13 +674,14 @@ int test4_2368()
volatile A va;
const volatile A cva = a;
sink_4_2368(a); // { dg-error "ambiguous" }
+ sink_4_2368(cva); // { dg-error "lvalue" }
return 0;
}
two sink_4_2378(const A&); // { dg-message "candidates" }
three sink_4_2378(volatile A&); // { dg-message "note" }
seven sink_4_2378(volatile A&&); // { dg-message "note" }
-eight sink_4_2378(const volatile A&&); // { dg-message "note" }
+eight sink_4_2378(const volatile A&&); // { dg-message "" }
int test4_2378()
{
@@ -534,6 +690,7 @@ int test4_2378()
volatile A va;
const volatile A cva = a;
sink_4_2378(a); // { dg-error "ambiguous" }
+ sink_4_2378(cva); // { dg-error "lvalue" }
return 0;
}
@@ -587,7 +744,7 @@ int test4_2467()
two sink_4_2567(const A&); // { dg-message "candidates" }
five sink_4_2567( A&&); // { dg-message "note" }
six sink_4_2567(const A&&); // { dg-message "note" }
-seven sink_4_2567(volatile A&&); // { dg-message "note" }
+seven sink_4_2567(volatile A&&); // { dg-message "" }
int test4_2567()
{
@@ -595,15 +752,48 @@ int test4_2567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_2567(va); // { dg-error "lvalue" }
sink_4_2567(cva); // { dg-error "no match" }
sink_4_2567(cv_source()); // { dg-error "no match" }
return 0;
}
+two sink_4_2568(const A&);
+five sink_4_2568( A&&);
+six sink_4_2568(const A&&);
+eight sink_4_2568(const volatile A&&); // { dg-message "" }
+
+int test4_2568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_2568(va); // { dg-error "lvalue" }
+ sink_4_2568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+two sink_4_2578(const A&);
+five sink_4_2578( A&&);
+seven sink_4_2578(volatile A&&); // { dg-message "" }
+eight sink_4_2578(const volatile A&&); // { dg-message "" }
+
+int test4_2578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_2578(va); // { dg-error "lvalue" }
+ sink_4_2578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_4_2678(const A&); // { dg-message "candidates" }
six sink_4_2678(const A&&); // { dg-message "note" }
-seven sink_4_2678(volatile A&&); // { dg-message "note" }
-eight sink_4_2678(const volatile A&&); // { dg-message "note" }
+seven sink_4_2678(volatile A&&); // { dg-message "" }
+eight sink_4_2678(const volatile A&&); // { dg-message "" }
int test4_2678()
{
@@ -611,6 +801,8 @@ int test4_2678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_2678(va); // { dg-error "lvalue" }
+ sink_4_2678(cva); // { dg-error "lvalue" }
sink_4_2678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -665,7 +857,7 @@ int test4_3467()
three sink_4_3567(volatile A&); // { dg-message "candidates" }
five sink_4_3567( A&&); // { dg-message "note" }
-six sink_4_3567(const A&&); // { dg-message "note" }
+six sink_4_3567(const A&&); // { dg-message "" }
seven sink_4_3567(volatile A&&); // { dg-message "note" }
int test4_3567()
@@ -674,15 +866,48 @@ int test4_3567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_3567(ca); // { dg-error "lvalue" }
sink_4_3567(cva); // { dg-error "no match" }
sink_4_3567(cv_source()); // { dg-error "no match" }
return 0;
}
+three sink_4_3568(volatile A&);
+five sink_4_3568( A&&);
+six sink_4_3568(const A&&); // { dg-message "" }
+eight sink_4_3568(const volatile A&&); // { dg-message "" }
+
+int test4_3568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_3568(ca); // { dg-error "lvalue" }
+ sink_4_3568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+three sink_4_3578(volatile A&);
+five sink_4_3578( A&&);
+seven sink_4_3578(volatile A&&);
+eight sink_4_3578(const volatile A&&); // { dg-message "" }
+
+int test4_3578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_3578(ca); // { dg-error "lvalue" }
+ sink_4_3578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_4_3678(volatile A&);
-six sink_4_3678(const A&&); // { dg-message "candidates" }
+six sink_4_3678(const A&&); // { dg-message "" }
seven sink_4_3678(volatile A&&); // { dg-message "note" }
-eight sink_4_3678(const volatile A&&); // { dg-message "note" }
+eight sink_4_3678(const volatile A&&); // { dg-message "" }
int test4_3678()
{
@@ -690,6 +915,8 @@ int test4_3678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_4_3678(ca); // { dg-error "lvalue" }
+ sink_4_3678(cva); // { dg-error "lvalue" }
sink_4_3678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -724,6 +951,24 @@ int test4_4678()
return 0;
}
+five sink_4_5678( A&&); // { dg-message "" }
+six sink_4_5678(const A&&); // { dg-message "" }
+seven sink_4_5678(volatile A&&); // { dg-message "" }
+eight sink_4_5678(const volatile A&&); // { dg-message "" }
+
+int test4_5678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_4_5678(a); // { dg-error "lvalue" }
+ sink_4_5678(ca); // { dg-error "lvalue" }
+ sink_4_5678(va); // { dg-error "lvalue" }
+ sink_4_5678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test4_1235() + test4_1236() + test4_1237() + test4_1256() + test4_1257() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv4p.C b/gcc/testsuite/g++.dg/cpp0x/rv4p.C
index a486e75e2e3..03ad9734614 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv4p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv4p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -122,7 +122,6 @@ int test4_1238()
sa<sizeof(sink_4_1238(a)) == 1> t1;
sa<sizeof(sink_4_1238(ca)) == 2> t2;
sa<sizeof(sink_4_1238(va)) == 3> t3;
- sa<sizeof(sink_4_1238(cva)) == 8> t4;
sa<sizeof(sink_4_1238(source())) == 8> t5;
sa<sizeof(sink_4_1238(c_source())) == 8> t6;
sa<sizeof(sink_4_1238(v_source())) == 8> t7;
@@ -244,7 +243,6 @@ int test4_1257()
const volatile A cva = a;
sa<sizeof(sink_4_1257(a)) == 1> t1;
sa<sizeof(sink_4_1257(ca)) == 2> t2;
- sa<sizeof(sink_4_1257(va)) == 7> t3;
sa<sizeof(sink_4_1257(source())) == 5> t5;
sa<sizeof(sink_4_1257(c_source())) == 2> t6;
sa<sizeof(sink_4_1257(v_source())) == 7> t7;
@@ -264,8 +262,6 @@ int test4_1258()
const volatile A cva = a;
sa<sizeof(sink_4_1258(a)) == 1> t1;
sa<sizeof(sink_4_1258(ca)) == 2> t2;
- sa<sizeof(sink_4_1258(va)) == 8> t3;
- sa<sizeof(sink_4_1258(cva)) == 8> t4;
sa<sizeof(sink_4_1258(source())) == 5> t5;
sa<sizeof(sink_4_1258(c_source())) == 8> t6;
sa<sizeof(sink_4_1258(v_source())) == 8> t7;
@@ -286,7 +282,6 @@ int test4_1267()
const volatile A cva = a;
sa<sizeof(sink_4_1267(a)) == 1> t1;
sa<sizeof(sink_4_1267(ca)) == 2> t2;
- sa<sizeof(sink_4_1267(va)) == 7> t3;
sa<sizeof(sink_4_1267(c_source())) == 6> t6;
sa<sizeof(sink_4_1267(v_source())) == 7> t7;
return 0;
@@ -305,8 +300,6 @@ int test4_1268()
const volatile A cva = a;
sa<sizeof(sink_4_1268(a)) == 1> t1;
sa<sizeof(sink_4_1268(ca)) == 2> t2;
- sa<sizeof(sink_4_1268(va)) == 8> t3;
- sa<sizeof(sink_4_1268(cva)) == 8> t4;
sa<sizeof(sink_4_1268(source())) == 6> t5;
sa<sizeof(sink_4_1268(c_source())) == 6> t6;
sa<sizeof(sink_4_1268(v_source())) == 8> t7;
@@ -327,8 +320,6 @@ int test4_1278()
const volatile A cva = a;
sa<sizeof(sink_4_1278(a)) == 1> t1;
sa<sizeof(sink_4_1278(ca)) == 2> t2;
- sa<sizeof(sink_4_1278(va)) == 7> t3;
- sa<sizeof(sink_4_1278(cva)) == 8> t4;
sa<sizeof(sink_4_1278(source())) == 7> t5;
sa<sizeof(sink_4_1278(c_source())) == 8> t6;
sa<sizeof(sink_4_1278(v_source())) == 7> t7;
@@ -429,7 +420,6 @@ int test4_1356()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1356(a)) == 1> t1;
- sa<sizeof(sink_4_1356(ca)) == 6> t2;
sa<sizeof(sink_4_1356(va)) == 3> t3;
sa<sizeof(sink_4_1356(source())) == 5> t5;
sa<sizeof(sink_4_1356(c_source())) == 6> t6;
@@ -466,9 +456,7 @@ int test4_1358()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1358(a)) == 1> t1;
- sa<sizeof(sink_4_1358(ca)) == 8> t2;
sa<sizeof(sink_4_1358(va)) == 3> t3;
- sa<sizeof(sink_4_1358(cva)) == 8> t4;
sa<sizeof(sink_4_1358(source())) == 5> t5;
sa<sizeof(sink_4_1358(c_source())) == 8> t6;
sa<sizeof(sink_4_1358(v_source())) == 8> t7;
@@ -488,7 +476,6 @@ int test4_1367()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1367(a)) == 1> t1;
- sa<sizeof(sink_4_1367(ca)) == 6> t2;
sa<sizeof(sink_4_1367(va)) == 3> t3;
sa<sizeof(sink_4_1367(c_source())) == 6> t6;
sa<sizeof(sink_4_1367(v_source())) == 7> t7;
@@ -507,9 +494,7 @@ int test4_1368()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1368(a)) == 1> t1;
- sa<sizeof(sink_4_1368(ca)) == 6> t2;
sa<sizeof(sink_4_1368(va)) == 3> t3;
- sa<sizeof(sink_4_1368(cva)) == 8> t4;
sa<sizeof(sink_4_1368(source())) == 6> t5;
sa<sizeof(sink_4_1368(c_source())) == 6> t6;
sa<sizeof(sink_4_1368(v_source())) == 8> t7;
@@ -529,9 +514,7 @@ int test4_1378()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1378(a)) == 1> t1;
- sa<sizeof(sink_4_1378(ca)) == 8> t2;
sa<sizeof(sink_4_1378(va)) == 3> t3;
- sa<sizeof(sink_4_1378(cva)) == 8> t4;
sa<sizeof(sink_4_1378(source())) == 7> t5;
sa<sizeof(sink_4_1378(c_source())) == 8> t6;
sa<sizeof(sink_4_1378(v_source())) == 7> t7;
@@ -677,8 +660,6 @@ int test4_1567()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1567(a)) == 1> t1;
- sa<sizeof(sink_4_1567(ca)) == 6> t2;
- sa<sizeof(sink_4_1567(va)) == 7> t3;
sa<sizeof(sink_4_1567(source())) == 5> t5;
sa<sizeof(sink_4_1567(c_source())) == 6> t6;
sa<sizeof(sink_4_1567(v_source())) == 7> t7;
@@ -697,9 +678,6 @@ int test4_1568()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1568(a)) == 1> t1;
- sa<sizeof(sink_4_1568(ca)) == 6> t2;
- sa<sizeof(sink_4_1568(va)) == 8> t3;
- sa<sizeof(sink_4_1568(cva)) == 8> t4;
sa<sizeof(sink_4_1568(source())) == 5> t5;
sa<sizeof(sink_4_1568(c_source())) == 6> t6;
sa<sizeof(sink_4_1568(v_source())) == 8> t7;
@@ -719,9 +697,6 @@ int test4_1578()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1578(a)) == 1> t1;
- sa<sizeof(sink_4_1578(ca)) == 8> t2;
- sa<sizeof(sink_4_1578(va)) == 7> t3;
- sa<sizeof(sink_4_1578(cva)) == 8> t4;
sa<sizeof(sink_4_1578(source())) == 5> t5;
sa<sizeof(sink_4_1578(c_source())) == 8> t6;
sa<sizeof(sink_4_1578(v_source())) == 7> t7;
@@ -741,9 +716,6 @@ int test4_1678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_1678(a)) == 1> t1;
- sa<sizeof(sink_4_1678(ca)) == 6> t2;
- sa<sizeof(sink_4_1678(va)) == 7> t3;
- sa<sizeof(sink_4_1678(cva)) == 8> t4;
sa<sizeof(sink_4_1678(c_source())) == 6> t6;
sa<sizeof(sink_4_1678(v_source())) == 7> t7;
sa<sizeof(sink_4_1678(cv_source())) == 8> t8;
@@ -879,7 +851,6 @@ int test4_2358()
const volatile A cva = a;
sa<sizeof(sink_4_2358(ca)) == 2> t2;
sa<sizeof(sink_4_2358(va)) == 3> t3;
- sa<sizeof(sink_4_2358(cva)) == 8> t4;
sa<sizeof(sink_4_2358(source())) == 5> t5;
sa<sizeof(sink_4_2358(c_source())) == 8> t6;
sa<sizeof(sink_4_2358(v_source())) == 8> t7;
@@ -918,7 +889,6 @@ int test4_2368()
const volatile A cva = a;
sa<sizeof(sink_4_2368(ca)) == 2> t2;
sa<sizeof(sink_4_2368(va)) == 3> t3;
- sa<sizeof(sink_4_2368(cva)) == 8> t4;
sa<sizeof(sink_4_2368(source())) == 6> t5;
sa<sizeof(sink_4_2368(c_source())) == 6> t6;
sa<sizeof(sink_4_2368(v_source())) == 8> t7;
@@ -939,7 +909,6 @@ int test4_2378()
const volatile A cva = a;
sa<sizeof(sink_4_2378(ca)) == 2> t2;
sa<sizeof(sink_4_2378(va)) == 3> t3;
- sa<sizeof(sink_4_2378(cva)) == 8> t4;
sa<sizeof(sink_4_2378(source())) == 7> t5;
sa<sizeof(sink_4_2378(c_source())) == 8> t6;
sa<sizeof(sink_4_2378(v_source())) == 7> t7;
@@ -1087,7 +1056,6 @@ int test4_2567()
const volatile A cva = a;
sa<sizeof(sink_4_2567(a)) == 2> t1;
sa<sizeof(sink_4_2567(ca)) == 2> t2;
- sa<sizeof(sink_4_2567(va)) == 7> t3;
sa<sizeof(sink_4_2567(source())) == 5> t5;
sa<sizeof(sink_4_2567(c_source())) == 6> t6;
sa<sizeof(sink_4_2567(v_source())) == 7> t7;
@@ -1107,8 +1075,6 @@ int test4_2568()
const volatile A cva = a;
sa<sizeof(sink_4_2568(a)) == 2> t1;
sa<sizeof(sink_4_2568(ca)) == 2> t2;
- sa<sizeof(sink_4_2568(va)) == 8> t3;
- sa<sizeof(sink_4_2568(cva)) == 8> t4;
sa<sizeof(sink_4_2568(source())) == 5> t5;
sa<sizeof(sink_4_2568(c_source())) == 6> t6;
sa<sizeof(sink_4_2568(v_source())) == 8> t7;
@@ -1129,8 +1095,6 @@ int test4_2578()
const volatile A cva = a;
sa<sizeof(sink_4_2578(a)) == 2> t1;
sa<sizeof(sink_4_2578(ca)) == 2> t2;
- sa<sizeof(sink_4_2578(va)) == 7> t3;
- sa<sizeof(sink_4_2578(cva)) == 8> t4;
sa<sizeof(sink_4_2578(source())) == 5> t5;
sa<sizeof(sink_4_2578(c_source())) == 8> t6;
sa<sizeof(sink_4_2578(v_source())) == 7> t7;
@@ -1151,8 +1115,6 @@ int test4_2678()
const volatile A cva = a;
sa<sizeof(sink_4_2678(a)) == 2> t1;
sa<sizeof(sink_4_2678(ca)) == 2> t2;
- sa<sizeof(sink_4_2678(va)) == 7> t3;
- sa<sizeof(sink_4_2678(cva)) == 8> t4;
sa<sizeof(sink_4_2678(c_source())) == 6> t6;
sa<sizeof(sink_4_2678(v_source())) == 7> t7;
sa<sizeof(sink_4_2678(cv_source())) == 8> t8;
@@ -1297,7 +1259,6 @@ int test4_3567()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3567(a)) == 3> t1;
- sa<sizeof(sink_4_3567(ca)) == 6> t2;
sa<sizeof(sink_4_3567(va)) == 3> t3;
sa<sizeof(sink_4_3567(source())) == 5> t5;
sa<sizeof(sink_4_3567(c_source())) == 6> t6;
@@ -1317,9 +1278,7 @@ int test4_3568()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3568(a)) == 3> t1;
- sa<sizeof(sink_4_3568(ca)) == 6> t2;
sa<sizeof(sink_4_3568(va)) == 3> t3;
- sa<sizeof(sink_4_3568(cva)) == 8> t4;
sa<sizeof(sink_4_3568(source())) == 5> t5;
sa<sizeof(sink_4_3568(c_source())) == 6> t6;
sa<sizeof(sink_4_3568(v_source())) == 8> t7;
@@ -1339,9 +1298,7 @@ int test4_3578()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3578(a)) == 3> t1;
- sa<sizeof(sink_4_3578(ca)) == 8> t2;
sa<sizeof(sink_4_3578(va)) == 3> t3;
- sa<sizeof(sink_4_3578(cva)) == 8> t4;
sa<sizeof(sink_4_3578(source())) == 5> t5;
sa<sizeof(sink_4_3578(c_source())) == 8> t6;
sa<sizeof(sink_4_3578(v_source())) == 7> t7;
@@ -1361,9 +1318,7 @@ int test4_3678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_4_3678(a)) == 3> t1;
- sa<sizeof(sink_4_3678(ca)) == 6> t2;
sa<sizeof(sink_4_3678(va)) == 3> t3;
- sa<sizeof(sink_4_3678(cva)) == 8> t4;
sa<sizeof(sink_4_3678(c_source())) == 6> t6;
sa<sizeof(sink_4_3678(v_source())) == 7> t7;
sa<sizeof(sink_4_3678(cv_source())) == 8> t8;
@@ -1467,10 +1422,6 @@ int test4_5678()
const A ca = a;
volatile A va;
const volatile A cva = a;
- sa<sizeof(sink_4_5678(a)) == 5> t1;
- sa<sizeof(sink_4_5678(ca)) == 6> t2;
- sa<sizeof(sink_4_5678(va)) == 7> t3;
- sa<sizeof(sink_4_5678(cva)) == 8> t4;
sa<sizeof(sink_4_5678(source())) == 5> t5;
sa<sizeof(sink_4_5678(c_source())) == 6> t6;
sa<sizeof(sink_4_5678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv5n.C b/gcc/testsuite/g++.dg/cpp0x/rv5n.C
index 14128b2aa36..c31a30b2d6f 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv5n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv5n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -115,6 +115,22 @@ int test5_12357()
return 0;
}
+one sink_5_12358( A&);
+two sink_5_12358(const A&);
+three sink_5_12358(volatile A&);
+five sink_5_12358( A&&);
+eight sink_5_12358(const volatile A&&); // { dg-message "" }
+
+int test5_12358()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12358(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_12367( A&); // { dg-message "candidates" }
two sink_5_12367(const A&); // { dg-message "note" }
three sink_5_12367(volatile A&); // { dg-message "note" }
@@ -133,6 +149,38 @@ int test5_12367()
return 0;
}
+one sink_5_12368( A&);
+two sink_5_12368(const A&);
+three sink_5_12368(volatile A&);
+six sink_5_12368(const A&&);
+eight sink_5_12368(const volatile A&&); // { dg-message "" }
+
+int test5_12368()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12368(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_5_12378( A&);
+two sink_5_12378(const A&);
+three sink_5_12378(volatile A&);
+seven sink_5_12378(volatile A&&);
+eight sink_5_12378(const volatile A&&); // { dg-message "" }
+
+int test5_12378()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12378(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_12456( A&); // { dg-message "candidates" }
two sink_5_12456(const A&); // { dg-message "note" }
four sink_5_12456(const volatile A&); // { dg-message "note" }
@@ -187,7 +235,7 @@ one sink_5_12567( A&); // { dg-message "candidates" }
two sink_5_12567(const A&); // { dg-message "note" }
five sink_5_12567( A&&); // { dg-message "note" }
six sink_5_12567(const A&&); // { dg-message "note" }
-seven sink_5_12567(volatile A&&); // { dg-message "note" }
+seven sink_5_12567(volatile A&&); // { dg-message "" }
int test5_12567()
{
@@ -195,16 +243,51 @@ int test5_12567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_12567(va); // { dg-error "lvalue" }
sink_5_12567(cva); // { dg-error "no match" }
sink_5_12567(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_5_12568( A&);
+two sink_5_12568(const A&);
+five sink_5_12568( A&&);
+six sink_5_12568(const A&&);
+eight sink_5_12568(const volatile A&&); // { dg-message "" }
+
+int test5_12568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12568(va); // { dg-error "lvalue" }
+ sink_5_12568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_5_12578( A&);
+two sink_5_12578(const A&);
+five sink_5_12578( A&&);
+seven sink_5_12578(volatile A&&); // { dg-message "" }
+eight sink_5_12578(const volatile A&&); // { dg-message "" }
+
+int test5_12578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_12578(va); // { dg-error "lvalue" }
+ sink_5_12578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_12678( A&);
two sink_5_12678(const A&); // { dg-message "candidates" }
six sink_5_12678(const A&&); // { dg-message "note" }
-seven sink_5_12678(volatile A&&); // { dg-message "note" }
-eight sink_5_12678(const volatile A&&); // { dg-message "note" }
+seven sink_5_12678(volatile A&&); // { dg-message "" }
+eight sink_5_12678(const volatile A&&); // { dg-message "" }
int test5_12678()
{
@@ -212,6 +295,8 @@ int test5_12678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_12678(va); // { dg-error "lvalue" }
+ sink_5_12678(cva); // { dg-error "lvalue" }
sink_5_12678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -270,7 +355,7 @@ int test5_13467()
one sink_5_13567( A&); // { dg-message "candidates" }
three sink_5_13567(volatile A&); // { dg-message "note" }
five sink_5_13567( A&&); // { dg-message "note" }
-six sink_5_13567(const A&&); // { dg-message "note" }
+six sink_5_13567(const A&&); // { dg-message "" }
seven sink_5_13567(volatile A&&); // { dg-message "note" }
int test5_13567()
@@ -279,16 +364,51 @@ int test5_13567()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_13567(ca); // { dg-error "lvalue" }
sink_5_13567(cva); // { dg-error "no match" }
sink_5_13567(cv_source()); // { dg-error "no match" }
return 0;
}
+one sink_5_13568( A&);
+three sink_5_13568(volatile A&);
+five sink_5_13568( A&&);
+six sink_5_13568(const A&&); // { dg-message "" }
+eight sink_5_13568(const volatile A&&); // { dg-message "" }
+
+int test5_13568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_13568(ca); // { dg-error "lvalue" }
+ sink_5_13568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_5_13578( A&);
+three sink_5_13578(volatile A&);
+five sink_5_13578( A&&);
+seven sink_5_13578(volatile A&&);
+eight sink_5_13578(const volatile A&&); // { dg-message "" }
+
+int test5_13578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_13578(ca); // { dg-error "lvalue" }
+ sink_5_13578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_5_13678( A&);
three sink_5_13678(volatile A&);
-six sink_5_13678(const A&&); // { dg-message "candidates" }
+six sink_5_13678(const A&&); // { dg-message "" }
seven sink_5_13678(volatile A&&); // { dg-message "note" }
-eight sink_5_13678(const volatile A&&); // { dg-message "note" }
+eight sink_5_13678(const volatile A&&); // { dg-message "" }
int test5_13678()
{
@@ -296,6 +416,8 @@ int test5_13678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_13678(ca); // { dg-error "lvalue" }
+ sink_5_13678(cva); // { dg-error "lvalue" }
sink_5_13678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -332,6 +454,24 @@ int test5_14678()
return 0;
}
+one sink_5_15678( A&);
+five sink_5_15678( A&&);
+six sink_5_15678(const A&&); // { dg-message "" }
+seven sink_5_15678(volatile A&&); // { dg-message "" }
+eight sink_5_15678(const volatile A&&); // { dg-message "" }
+
+int test5_15678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_15678(ca); // { dg-error "lvalue" }
+ sink_5_15678(va); // { dg-error "lvalue" }
+ sink_5_15678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_5_23456(const A&); // { dg-message "candidates" }
three sink_5_23456(volatile A&); // { dg-message "note" }
four sink_5_23456(const volatile A&); // { dg-message "note" }
@@ -455,7 +595,7 @@ two sink_5_23568(const A&); // { dg-message "candidates" }
three sink_5_23568(volatile A&); // { dg-message "note" }
five sink_5_23568( A&&); // { dg-message "note" }
six sink_5_23568(const A&&); // { dg-message "note" }
-eight sink_5_23568(const volatile A&&); // { dg-message "note" }
+eight sink_5_23568(const volatile A&&); // { dg-message "" }
int test5_23568()
{
@@ -463,6 +603,7 @@ int test5_23568()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_23568(cva); // { dg-error "lvalue" }
sink_5_23568(a); // { dg-error "ambiguous" }
return 0;
}
@@ -471,7 +612,7 @@ two sink_5_23578(const A&); // { dg-message "candidates" }
three sink_5_23578(volatile A&); // { dg-message "note" }
five sink_5_23578( A&&); // { dg-message "note" }
seven sink_5_23578(volatile A&&); // { dg-message "note" }
-eight sink_5_23578(const volatile A&&); // { dg-message "note" }
+eight sink_5_23578(const volatile A&&); // { dg-message "" }
int test5_23578()
{
@@ -479,6 +620,7 @@ int test5_23578()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_5_23578(cva); // { dg-error "lvalue" }
sink_5_23578(a); // { dg-error "ambiguous" }
return 0;
}
@@ -487,7 +629,7 @@ two sink_5_23678(const A&); // { dg-message "candidates" }
three sink_5_23678(volatile A&); // { dg-message "note" }
six sink_5_23678(const A&&); // { dg-message "note" }
seven sink_5_23678(volatile A&&); // { dg-message "note" }
-eight sink_5_23678(const volatile A&&); // { dg-message "note" }
+eight sink_5_23678(const volatile A&&); // { dg-message "" }
int test5_23678()
{
@@ -496,6 +638,7 @@ int test5_23678()
volatile A va;
const volatile A cva = a;
sink_5_23678(a); // { dg-error "ambiguous" }
+ sink_5_23678(cva); // { dg-error "lvalue" }
sink_5_23678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -532,6 +675,23 @@ int test5_24678()
return 0;
}
+two sink_5_25678(const A&);
+five sink_5_25678( A&&);
+six sink_5_25678(const A&&);
+seven sink_5_25678(volatile A&&); // { dg-message "" }
+eight sink_5_25678(const volatile A&&); // { dg-message "" }
+
+int test5_25678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_25678(va); // { dg-error "lvalue" }
+ sink_5_25678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
three sink_5_34567(volatile A&); // { dg-message "candidates" }
four sink_5_34567(const volatile A&); // { dg-message "note" }
five sink_5_34567( A&&); // { dg-message "note" }
@@ -564,6 +724,23 @@ int test5_34678()
return 0;
}
+three sink_5_35678(volatile A&);
+five sink_5_35678( A&&);
+six sink_5_35678(const A&&); // { dg-message "" }
+seven sink_5_35678(volatile A&&);
+eight sink_5_35678(const volatile A&&); // { dg-message "" }
+
+int test5_35678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_5_35678(ca); // { dg-error "lvalue" }
+ sink_5_35678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test5_12356() + test5_12357() + test5_12367() + test5_12467() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv5p.C b/gcc/testsuite/g++.dg/cpp0x/rv5p.C
index a4d916714c3..7555867f709 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv5p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv5p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -173,7 +173,6 @@ int test5_12358()
sa<sizeof(sink_5_12358(a)) == 1> t1;
sa<sizeof(sink_5_12358(ca)) == 2> t2;
sa<sizeof(sink_5_12358(va)) == 3> t3;
- sa<sizeof(sink_5_12358(cva)) == 8> t4;
sa<sizeof(sink_5_12358(source())) == 5> t5;
sa<sizeof(sink_5_12358(c_source())) == 8> t6;
sa<sizeof(sink_5_12358(v_source())) == 8> t7;
@@ -216,7 +215,6 @@ int test5_12368()
sa<sizeof(sink_5_12368(a)) == 1> t1;
sa<sizeof(sink_5_12368(ca)) == 2> t2;
sa<sizeof(sink_5_12368(va)) == 3> t3;
- sa<sizeof(sink_5_12368(cva)) == 8> t4;
sa<sizeof(sink_5_12368(source())) == 6> t5;
sa<sizeof(sink_5_12368(c_source())) == 6> t6;
sa<sizeof(sink_5_12368(v_source())) == 8> t7;
@@ -239,7 +237,6 @@ int test5_12378()
sa<sizeof(sink_5_12378(a)) == 1> t1;
sa<sizeof(sink_5_12378(ca)) == 2> t2;
sa<sizeof(sink_5_12378(va)) == 3> t3;
- sa<sizeof(sink_5_12378(cva)) == 8> t4;
sa<sizeof(sink_5_12378(source())) == 7> t5;
sa<sizeof(sink_5_12378(c_source())) == 8> t6;
sa<sizeof(sink_5_12378(v_source())) == 7> t7;
@@ -394,7 +391,6 @@ int test5_12567()
const volatile A cva = a;
sa<sizeof(sink_5_12567(a)) == 1> t1;
sa<sizeof(sink_5_12567(ca)) == 2> t2;
- sa<sizeof(sink_5_12567(va)) == 7> t3;
sa<sizeof(sink_5_12567(source())) == 5> t5;
sa<sizeof(sink_5_12567(c_source())) == 6> t6;
sa<sizeof(sink_5_12567(v_source())) == 7> t7;
@@ -415,8 +411,6 @@ int test5_12568()
const volatile A cva = a;
sa<sizeof(sink_5_12568(a)) == 1> t1;
sa<sizeof(sink_5_12568(ca)) == 2> t2;
- sa<sizeof(sink_5_12568(va)) == 8> t3;
- sa<sizeof(sink_5_12568(cva)) == 8> t4;
sa<sizeof(sink_5_12568(source())) == 5> t5;
sa<sizeof(sink_5_12568(c_source())) == 6> t6;
sa<sizeof(sink_5_12568(v_source())) == 8> t7;
@@ -438,8 +432,6 @@ int test5_12578()
const volatile A cva = a;
sa<sizeof(sink_5_12578(a)) == 1> t1;
sa<sizeof(sink_5_12578(ca)) == 2> t2;
- sa<sizeof(sink_5_12578(va)) == 7> t3;
- sa<sizeof(sink_5_12578(cva)) == 8> t4;
sa<sizeof(sink_5_12578(source())) == 5> t5;
sa<sizeof(sink_5_12578(c_source())) == 8> t6;
sa<sizeof(sink_5_12578(v_source())) == 7> t7;
@@ -461,8 +453,6 @@ int test5_12678()
const volatile A cva = a;
sa<sizeof(sink_5_12678(a)) == 1> t1;
sa<sizeof(sink_5_12678(ca)) == 2> t2;
- sa<sizeof(sink_5_12678(va)) == 7> t3;
- sa<sizeof(sink_5_12678(cva)) == 8> t4;
sa<sizeof(sink_5_12678(c_source())) == 6> t6;
sa<sizeof(sink_5_12678(v_source())) == 7> t7;
sa<sizeof(sink_5_12678(cv_source())) == 8> t8;
@@ -614,7 +604,6 @@ int test5_13567()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13567(a)) == 1> t1;
- sa<sizeof(sink_5_13567(ca)) == 6> t2;
sa<sizeof(sink_5_13567(va)) == 3> t3;
sa<sizeof(sink_5_13567(source())) == 5> t5;
sa<sizeof(sink_5_13567(c_source())) == 6> t6;
@@ -635,9 +624,7 @@ int test5_13568()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13568(a)) == 1> t1;
- sa<sizeof(sink_5_13568(ca)) == 6> t2;
sa<sizeof(sink_5_13568(va)) == 3> t3;
- sa<sizeof(sink_5_13568(cva)) == 8> t4;
sa<sizeof(sink_5_13568(source())) == 5> t5;
sa<sizeof(sink_5_13568(c_source())) == 6> t6;
sa<sizeof(sink_5_13568(v_source())) == 8> t7;
@@ -658,9 +645,7 @@ int test5_13578()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13578(a)) == 1> t1;
- sa<sizeof(sink_5_13578(ca)) == 8> t2;
sa<sizeof(sink_5_13578(va)) == 3> t3;
- sa<sizeof(sink_5_13578(cva)) == 8> t4;
sa<sizeof(sink_5_13578(source())) == 5> t5;
sa<sizeof(sink_5_13578(c_source())) == 8> t6;
sa<sizeof(sink_5_13578(v_source())) == 7> t7;
@@ -681,9 +666,7 @@ int test5_13678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_13678(a)) == 1> t1;
- sa<sizeof(sink_5_13678(ca)) == 6> t2;
sa<sizeof(sink_5_13678(va)) == 3> t3;
- sa<sizeof(sink_5_13678(cva)) == 8> t4;
sa<sizeof(sink_5_13678(c_source())) == 6> t6;
sa<sizeof(sink_5_13678(v_source())) == 7> t7;
sa<sizeof(sink_5_13678(cv_source())) == 8> t8;
@@ -793,9 +776,6 @@ int test5_15678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_15678(a)) == 1> t1;
- sa<sizeof(sink_5_15678(ca)) == 6> t2;
- sa<sizeof(sink_5_15678(va)) == 7> t3;
- sa<sizeof(sink_5_15678(cva)) == 8> t4;
sa<sizeof(sink_5_15678(source())) == 5> t5;
sa<sizeof(sink_5_15678(c_source())) == 6> t6;
sa<sizeof(sink_5_15678(v_source())) == 7> t7;
@@ -964,7 +944,6 @@ int test5_23568()
const volatile A cva = a;
sa<sizeof(sink_5_23568(ca)) == 2> t2;
sa<sizeof(sink_5_23568(va)) == 3> t3;
- sa<sizeof(sink_5_23568(cva)) == 8> t4;
sa<sizeof(sink_5_23568(source())) == 5> t5;
sa<sizeof(sink_5_23568(c_source())) == 6> t6;
sa<sizeof(sink_5_23568(v_source())) == 8> t7;
@@ -986,7 +965,6 @@ int test5_23578()
const volatile A cva = a;
sa<sizeof(sink_5_23578(ca)) == 2> t2;
sa<sizeof(sink_5_23578(va)) == 3> t3;
- sa<sizeof(sink_5_23578(cva)) == 8> t4;
sa<sizeof(sink_5_23578(source())) == 5> t5;
sa<sizeof(sink_5_23578(c_source())) == 8> t6;
sa<sizeof(sink_5_23578(v_source())) == 7> t7;
@@ -1008,7 +986,6 @@ int test5_23678()
const volatile A cva = a;
sa<sizeof(sink_5_23678(ca)) == 2> t2;
sa<sizeof(sink_5_23678(va)) == 3> t3;
- sa<sizeof(sink_5_23678(cva)) == 8> t4;
sa<sizeof(sink_5_23678(c_source())) == 6> t6;
sa<sizeof(sink_5_23678(v_source())) == 7> t7;
sa<sizeof(sink_5_23678(cv_source())) == 8> t8;
@@ -1119,8 +1096,6 @@ int test5_25678()
const volatile A cva = a;
sa<sizeof(sink_5_25678(a)) == 2> t1;
sa<sizeof(sink_5_25678(ca)) == 2> t2;
- sa<sizeof(sink_5_25678(va)) == 7> t3;
- sa<sizeof(sink_5_25678(cva)) == 8> t4;
sa<sizeof(sink_5_25678(source())) == 5> t5;
sa<sizeof(sink_5_25678(c_source())) == 6> t6;
sa<sizeof(sink_5_25678(v_source())) == 7> t7;
@@ -1231,9 +1206,7 @@ int test5_35678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_5_35678(a)) == 3> t1;
- sa<sizeof(sink_5_35678(ca)) == 6> t2;
sa<sizeof(sink_5_35678(va)) == 3> t3;
- sa<sizeof(sink_5_35678(cva)) == 8> t4;
sa<sizeof(sink_5_35678(source())) == 5> t5;
sa<sizeof(sink_5_35678(c_source())) == 6> t6;
sa<sizeof(sink_5_35678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv6n.C b/gcc/testsuite/g++.dg/cpp0x/rv6n.C
index 040c0f6c3e8..2a2520c7599 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv6n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv6n.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -70,7 +70,7 @@ three sink_6_235678(volatile A&); // { dg-message "note" }
five sink_6_235678( A&&); // { dg-message "note" }
six sink_6_235678(const A&&); // { dg-message "note" }
seven sink_6_235678(volatile A&&); // { dg-message "note" }
-eight sink_6_235678(const volatile A&&); // { dg-message "note" }
+eight sink_6_235678(const volatile A&&); // { dg-message "" }
int test6_235678()
{
@@ -79,6 +79,7 @@ int test6_235678()
volatile A va;
const volatile A cva = a;
sink_6_235678(a); // { dg-error "ambiguous" }
+ sink_6_235678(cva); // { dg-error "lvalue" }
return 0;
}
@@ -191,7 +192,7 @@ two sink_6_123678(const A&); // { dg-message "candidates" }
three sink_6_123678(volatile A&);
six sink_6_123678(const A&&); // { dg-message "note" }
seven sink_6_123678(volatile A&&); // { dg-message "note" }
-eight sink_6_123678(const volatile A&&); // { dg-message "note" }
+eight sink_6_123678(const volatile A&&); // { dg-message "" }
int test6_123678()
{
@@ -199,6 +200,7 @@ int test6_123678()
const A ca = a;
volatile A va;
const volatile A cva = a;
+ sink_6_123678(cva); // { dg-error "lvalue" }
sink_6_123678(source()); // { dg-error "ambiguous" }
return 0;
}
@@ -221,6 +223,40 @@ int test6_123567()
return 0;
}
+one sink_6_123568( A&);
+two sink_6_123568(const A&);
+three sink_6_123568(volatile A&);
+five sink_6_123568( A&&);
+six sink_6_123568(const A&&);
+eight sink_6_123568(const volatile A&&); // { dg-message "" }
+
+int test6_123568()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_123568(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
+one sink_6_123578( A&);
+two sink_6_123578(const A&);
+three sink_6_123578(volatile A&);
+five sink_6_123578( A&&);
+seven sink_6_123578(volatile A&&);
+eight sink_6_123578(const volatile A&&); // { dg-message "" }
+
+int test6_123578()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_123578(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_6_123467( A&); // { dg-message "candidates" }
two sink_6_123467(const A&); // { dg-message "note" }
three sink_6_123467(volatile A&); // { dg-message "note" }
@@ -256,6 +292,24 @@ int test6_124567()
return 0;
}
+one sink_6_125678( A&);
+two sink_6_125678(const A&);
+five sink_6_125678( A&&);
+six sink_6_125678(const A&&);
+seven sink_6_125678(volatile A&&); // { dg-message "" }
+eight sink_6_125678(const volatile A&&); // { dg-message "" }
+
+int test6_125678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_125678(va); // { dg-error "lvalue" }
+ sink_6_125678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
one sink_6_134567( A&); // { dg-message "candidates" }
three sink_6_134567(volatile A&); // { dg-message "note" }
four sink_6_134567(const volatile A&); // { dg-message "note" }
@@ -273,6 +327,24 @@ int test6_134567()
return 0;
}
+one sink_6_135678( A&);
+three sink_6_135678(volatile A&);
+five sink_6_135678( A&&);
+six sink_6_135678(const A&&); // { dg-message "" }
+seven sink_6_135678(volatile A&&);
+eight sink_6_135678(const volatile A&&); // { dg-message "" }
+
+int test6_135678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_6_135678(ca); // { dg-error "lvalue" }
+ sink_6_135678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
int main()
{
return test6_235678() + test6_234678() + test6_234578() + test6_234568() +
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv6p.C b/gcc/testsuite/g++.dg/cpp0x/rv6p.C
index a59958e37ef..0e5352bf8b1 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv6p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv6p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -207,7 +207,6 @@ int test6_123568()
sa<sizeof(sink_6_123568(a)) == 1> t1;
sa<sizeof(sink_6_123568(ca)) == 2> t2;
sa<sizeof(sink_6_123568(va)) == 3> t3;
- sa<sizeof(sink_6_123568(cva)) == 8> t4;
sa<sizeof(sink_6_123568(source())) == 5> t5;
sa<sizeof(sink_6_123568(c_source())) == 6> t6;
sa<sizeof(sink_6_123568(v_source())) == 8> t7;
@@ -231,7 +230,6 @@ int test6_123578()
sa<sizeof(sink_6_123578(a)) == 1> t1;
sa<sizeof(sink_6_123578(ca)) == 2> t2;
sa<sizeof(sink_6_123578(va)) == 3> t3;
- sa<sizeof(sink_6_123578(cva)) == 8> t4;
sa<sizeof(sink_6_123578(source())) == 5> t5;
sa<sizeof(sink_6_123578(c_source())) == 8> t6;
sa<sizeof(sink_6_123578(v_source())) == 7> t7;
@@ -255,7 +253,6 @@ int test6_123678()
sa<sizeof(sink_6_123678(a)) == 1> t1;
sa<sizeof(sink_6_123678(ca)) == 2> t2;
sa<sizeof(sink_6_123678(va)) == 3> t3;
- sa<sizeof(sink_6_123678(cva)) == 8> t4;
sa<sizeof(sink_6_123678(c_source())) == 6> t6;
sa<sizeof(sink_6_123678(v_source())) == 7> t7;
sa<sizeof(sink_6_123678(cv_source())) == 8> t8;
@@ -371,8 +368,6 @@ int test6_125678()
const volatile A cva = a;
sa<sizeof(sink_6_125678(a)) == 1> t1;
sa<sizeof(sink_6_125678(ca)) == 2> t2;
- sa<sizeof(sink_6_125678(va)) == 7> t3;
- sa<sizeof(sink_6_125678(cva)) == 8> t4;
sa<sizeof(sink_6_125678(source())) == 5> t5;
sa<sizeof(sink_6_125678(c_source())) == 6> t6;
sa<sizeof(sink_6_125678(v_source())) == 7> t7;
@@ -488,9 +483,7 @@ int test6_135678()
volatile A va;
const volatile A cva = a;
sa<sizeof(sink_6_135678(a)) == 1> t1;
- sa<sizeof(sink_6_135678(ca)) == 6> t2;
sa<sizeof(sink_6_135678(va)) == 3> t3;
- sa<sizeof(sink_6_135678(cva)) == 8> t4;
sa<sizeof(sink_6_135678(source())) == 5> t5;
sa<sizeof(sink_6_135678(c_source())) == 6> t6;
sa<sizeof(sink_6_135678(v_source())) == 7> t7;
@@ -627,7 +620,6 @@ int test6_235678()
const volatile A cva = a;
sa<sizeof(sink_6_235678(ca)) == 2> t2;
sa<sizeof(sink_6_235678(va)) == 3> t3;
- sa<sizeof(sink_6_235678(cva)) == 8> t4;
sa<sizeof(sink_6_235678(source())) == 5> t5;
sa<sizeof(sink_6_235678(c_source())) == 6> t6;
sa<sizeof(sink_6_235678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7n.C b/gcc/testsuite/g++.dg/cpp0x/rv7n.C
index 9d81bd5d722..102730bc7f0 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv7n.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv7n.C
@@ -48,6 +48,24 @@ int test7_1234567()
return 0;
}
+one sink_7_1235678( A&);
+two sink_7_1235678(const A&);
+three sink_7_1235678(volatile A&);
+five sink_7_1235678( A&&);
+six sink_7_1235678(const A&&);
+seven sink_7_1235678(volatile A&&);
+eight sink_7_1235678(const volatile A&&); // { dg-message "" }
+
+int test7_1235678()
+{
+ A a;
+ const A ca = a;
+ volatile A va;
+ const volatile A cva = a;
+ sink_7_1235678(cva); // { dg-error "lvalue" }
+ return 0;
+}
+
two sink_7_2345678(const A&); // { dg-message "candidates" }
three sink_7_2345678(volatile A&); // { dg-message "note" }
four sink_7_2345678(const volatile A&); // { dg-message "note" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv7p.C b/gcc/testsuite/g++.dg/cpp0x/rv7p.C
index d3e1474ff10..d25488f94f1 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv7p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv7p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
@@ -145,7 +145,6 @@ int test7_1235678()
sa<sizeof(sink_7_1235678(a)) == 1> t1;
sa<sizeof(sink_7_1235678(ca)) == 2> t2;
sa<sizeof(sink_7_1235678(va)) == 3> t3;
- sa<sizeof(sink_7_1235678(cva)) == 8> t4;
sa<sizeof(sink_7_1235678(source())) == 5> t5;
sa<sizeof(sink_7_1235678(c_source())) == 6> t6;
sa<sizeof(sink_7_1235678(v_source())) == 7> t7;
diff --git a/gcc/testsuite/g++.dg/cpp0x/rv8p.C b/gcc/testsuite/g++.dg/cpp0x/rv8p.C
index 95a72d5105b..cc7ff8a6ef3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/rv8p.C
+++ b/gcc/testsuite/g++.dg/cpp0x/rv8p.C
@@ -1,6 +1,6 @@
// I, Howard Hinnant, hereby place this code in the public domain.
-// Test overlaod resolution among referece types
+// Test overload resolution among reference types
// { dg-do compile }
// { dg-options "-std=c++0x" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/template_deduction.C b/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
index ee48fb305d0..c1eace6fa0b 100644
--- a/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
+++ b/gcc/testsuite/g++.dg/cpp0x/template_deduction.C
@@ -35,7 +35,7 @@ test1(T&&)
template <bool is_lvalue_ref, bool is_rvalue_ref, class T>
void
-test2(const T&&)
+test2(const T&&) // { dg-error "argument" }
{
sa<is_lvalue_reference<const T&&>::value == is_lvalue_ref> t1;
sa<is_rvalue_reference<const T&&>::value == is_rvalue_ref> t2;
@@ -60,7 +60,7 @@ int main()
{
test1<true, false>(a);
test1<false, true>(source());
- test2<false, true>(a);
+ test2<false, true>(a); // { dg-error "lvalue" }
test2<false, true>(source());
test3<false, true>(&a);
test3<false, true>(sourcep());
diff --git a/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C b/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
index 06311856d69..57d635961ba 100644
--- a/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
+++ b/gcc/testsuite/g++.dg/cpp0x/unnamed_refs.C
@@ -16,7 +16,12 @@ struct A {};
one foo(const A&) {return one();}
two foo(A&&) {return two();}
-A&& source() {static A a; return a;}
+template<typename _Tp>
+inline _Tp&&
+movel(_Tp& __t)
+{ return static_cast<_Tp&&>(__t); }
+
+A&& source() {static A a; return movel(a);}
int test1()
{
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline1.C
new file mode 100644
index 00000000000..ea405f85339
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline1.C
@@ -0,0 +1,18 @@
+// This isn't really testing dwarf output, but rather that we can inline f
+// even though the call precedes the definition.
+
+// { dg-options "-gdwarf-2 -dA -O" }
+// { dg-final { scan-assembler "DW_TAG_inlined_subroutine" } }
+
+template <class T>
+inline T f(T);
+
+int main()
+{
+ f(1);
+}
+
+int i;
+
+template <class T>
+inline T f(T t) { ++i; return t; }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C
new file mode 100644
index 00000000000..b2f67036e24
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C
@@ -0,0 +1,13 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR debug/39706
+// { dg-options "-g -dA" }
+// { dg-do compile }
+// { dg-final { scan-assembler-times ".debug_pubnames" 1 } }
+// { dg-final { scan-assembler-times "\"main\".*external name" 1 } }
+// { dg-final { scan-assembler-times "\"ns::ns_x.*external name" 1 } }
+// { dg-final { scan-assembler-times "\"y::y_x.*external name" 1 } }
+
+namespace ns { int ns_x; }
+class y { public: static int y_x; };
+int y::y_x;
+int main() { return ns::ns_x; }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C b/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C
index f325ac54ad2..b3a0f937338 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/typedef1.C
@@ -3,9 +3,9 @@
// { dg-options "-g -dA" }
// { dg-do compile }
// { dg-final { scan-assembler-times "DW_TAG_structure_type" 2 } }
-// { dg-final { scan-assembler-times "DW_AT_name: \"foo<1u>\"" 1 } }
+// { dg-final { scan-assembler-times "DW_AT_name: \"foo<1u>\"|\"foo<1u>..\".*DW_AT_name" 1 } }
// { dg-final { scan-assembler-times "DW_TAG_enumeration_type" 2 } }
-// { dg-final { scan-assembler-times "DW_AT_name: \"typedef foo<1u>::type type\"" 1 } }
+// { dg-final { scan-assembler-times "DW_AT_name: \"typedef foo<1u>::type type\"|\"typedef foo<1u>::type type..\".*DW_AT_name" 1 } }
// { dg-final { scan-assembler-times "DIE (.*) DW_TAG_enumeration_type" 2 } }
// { dg-final { scan-assembler-times "\"e0..\".*DW_AT_name" 1 } }
// { dg-final { scan-assembler-times "\"e1..\".*DW_AT_name" 1 } }
diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp
index a19bc2c2b60..54fc225f4f8 100644
--- a/gcc/testsuite/g++.dg/dg.exp
+++ b/gcc/testsuite/g++.dg/dg.exp
@@ -49,5 +49,9 @@ set tests [prune $tests $srcdir/$subdir/graphite/*]
# Main loop.
dg-runtest $tests "" $DEFAULT_CXXFLAGS
+# C/C++ common tests.
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \
+ "" ""
+
# All done.
dg-finish
diff --git a/gcc/testsuite/g++.dg/expr/stmt-expr-1.C b/gcc/testsuite/g++.dg/expr/stmt-expr-1.C
new file mode 100644
index 00000000000..2c50e35dca8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/expr/stmt-expr-1.C
@@ -0,0 +1,36 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR c++/40866
+// { dg-options "-std=gnu++98" }
+// { dg-do "compile" }
+
+template <typename T> class QForeachContainer {
+public:
+ QForeachContainer();
+ int brk;
+ typename T::const_iterator i;
+};
+
+template <typename T> class QList {
+public:
+ class const_iterator {
+ public:
+ const_iterator(const const_iterator &o);
+ const_iterator &operator++();
+ };
+};
+
+class QAction;
+class QWidget {
+public:
+ QList<QAction*> actions() const;
+};
+class myDialog : public QWidget {
+ myDialog();
+};
+
+myDialog::myDialog()
+{
+ QForeachContainer<__typeof__(actions())> _container_;
+ ({++_container_.brk; ++_container_.i;});
+}
+
diff --git a/gcc/testsuite/g++.dg/ext/anon-struct4.C b/gcc/testsuite/g++.dg/ext/anon-struct4.C
index 4f0fcd12b77..53302d84b79 100644
--- a/gcc/testsuite/g++.dg/ext/anon-struct4.C
+++ b/gcc/testsuite/g++.dg/ext/anon-struct4.C
@@ -1,4 +1,3 @@
// PR c++/14401
struct { struct { int& i ; } bar ; } foo ; // { dg-error "uninitialized" "uninit" }
-// { dg-warning "anonymous" "anon" { target *-*-* } 3 }
diff --git a/gcc/testsuite/g++.dg/ext/complit12.C b/gcc/testsuite/g++.dg/ext/complit12.C
new file mode 100644
index 00000000000..29c9af1864f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/complit12.C
@@ -0,0 +1,65 @@
+// PR c++/40948
+// { dg-do run }
+// { dg-options "" }
+
+int c;
+struct M
+{
+ M () { ++c; }
+ M (const M&) { ++c; }
+ ~M () { --c; }
+};
+
+struct S
+{
+ S ();
+ M m[1];
+};
+
+S::S () : m ((M[1]) { M () })
+{
+}
+
+struct T
+{
+ T ();
+ M m[4];
+};
+
+T::T () : m ((M[4]) { M (), M (), M (), M () })
+{
+}
+
+typedef M MA[1];
+MA &bar (MA, MA& r) { return r; }
+
+M f(M m) { return m; }
+
+int main ()
+{
+ {
+ M m[1] = (M[1]) { M () };
+ if (c != 1)
+ return 1;
+ M n = (M) { M () };
+ if (c != 2)
+ return 2;
+ M o[4] = (M[4]) { M (), M (), M (), M () };
+ if (c != 6)
+ return 3;
+ S s;
+ if (c != 7)
+ return 4;
+ T t;
+ if (c != 11)
+ return 5;
+ MA ma = bar ((M[2]) { M(), M() }, m);
+ if (c != 12)
+ return 7;
+ M mm[2] = ((M[2]) { f(M()), f(M()) });
+ if (c != 14)
+ return 8;
+ }
+ if (c != 0)
+ return 6;
+}
diff --git a/gcc/testsuite/g++.dg/lookup/anon2.C b/gcc/testsuite/g++.dg/lookup/anon2.C
index d556ba0034a..3143b62fd33 100644
--- a/gcc/testsuite/g++.dg/lookup/anon2.C
+++ b/gcc/testsuite/g++.dg/lookup/anon2.C
@@ -1,9 +1,9 @@
// { dg-do compile }
// { dg-options "" }
-// Make sure we issue a diagnostic if a type with no linkage is used
-// to declare a a variable that has linkage.
+// Make sure we don't issue a diagnostic if a type with no linkage is used
+// to declare a a variable that has linkage if that variable is defined.
-struct { int i; } a; // { dg-warning "anonymous type" }
+struct { int i; } a;
void foo() { a.i; }
diff --git a/gcc/testsuite/g++.dg/other/anon3.C b/gcc/testsuite/g++.dg/other/anon3.C
index 87116eb8901..87cbfb544cd 100644
--- a/gcc/testsuite/g++.dg/other/anon3.C
+++ b/gcc/testsuite/g++.dg/other/anon3.C
@@ -4,4 +4,4 @@
// { dg-do compile }
-enum { a = 3 } x; // { dg-warning "anonymous type" }
+enum { a = 3 } x;
diff --git a/gcc/testsuite/g++.dg/other/linkage2.C b/gcc/testsuite/g++.dg/other/linkage2.C
new file mode 100644
index 00000000000..4e3e6f1eab3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/linkage2.C
@@ -0,0 +1,31 @@
+// DR 743: A type without linkage shall not be used as the type of a
+// variable or function with linkage, unless
+// o the variable or function has extern "C" linkage (7.5 [dcl.link]), or
+// o the variable or function is not used (3.2 [basic.def.odr]) or is
+// defined in the same translation unit.
+
+template <typename T> struct B {
+ void g(T){}
+ void h(T); // { dg-error "never defined" }
+ friend void i(B, T){}
+ static T t1; // { dg-error "never defined" }
+ static T t2;
+};
+
+template <typename T> T B<T>::t2 = { };
+
+enum {} e1; // OK, defined
+extern enum {} e2; // { dg-error "never defined" }
+extern "C" enum {} e3; // OK, extern "C"
+
+void f() {
+ struct A { int x; }; // no linkage
+ A a = {1};
+ B<A> ba; // declares B<A>::g(A) and B<A>::h(A)
+ ba.t1 = a; // error, B<T>::t never defined
+ ba.t2 = a; // OK
+ ba.g(a); // OK
+ ba.h(a); // error, B<T>::h never defined
+ i(ba, a); // OK
+ e1+e2+e3;
+}
diff --git a/gcc/testsuite/g++.dg/other/pragma-re-1.C b/gcc/testsuite/g++.dg/other/pragma-re-1.C
index fce1dc193e7..35ffab1a82c 100644
--- a/gcc/testsuite/g++.dg/other/pragma-re-1.C
+++ b/gcc/testsuite/g++.dg/other/pragma-re-1.C
@@ -1,4 +1,3 @@
-/* { dg-do compile { target *-*-solaris* } } */
/* { dg-final { scan-assembler "bar" } } */
/* { dg-final { scan-assembler-not "foo" } } */
/* { dg-final { scan-assembler "_Z3bazv" } } */
diff --git a/gcc/testsuite/g++.dg/other/pragma-re-2.C b/gcc/testsuite/g++.dg/other/pragma-re-2.C
index 44d1b50f699..ca71a01a2b5 100644
--- a/gcc/testsuite/g++.dg/other/pragma-re-2.C
+++ b/gcc/testsuite/g++.dg/other/pragma-re-2.C
@@ -1,7 +1,6 @@
/* PR c++/14962 */
/* Originator: <phil@fsel.com> */
-/* { dg-do compile { target *-*-solaris* } } */
/* { dg-final { scan-assembler "new_name" } } */
/* { dg-final { scan-assembler-not "old_name" } } */
diff --git a/gcc/testsuite/g++.dg/overload/defarg4.C b/gcc/testsuite/g++.dg/overload/defarg4.C
new file mode 100644
index 00000000000..198f9b28f32
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/defarg4.C
@@ -0,0 +1,26 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin PR c++/39987
+// { dg-do "compile" }
+
+class foo
+{
+ template<typename U>
+ static bool func(const U& x)
+ {}
+public:
+ template<typename U>
+ unsigned int Find(const U& x, bool (*pFunc) (const U&) = func) const
+ {}
+};
+
+class bar {
+ bool Initialize();
+protected:
+ foo b;
+};
+
+bool bar::Initialize()
+{
+ b.Find(b);
+}
+
diff --git a/gcc/testsuite/g++.dg/parse/pr16696-permissive.C b/gcc/testsuite/g++.dg/parse/pr16696-permissive.C
new file mode 100644
index 00000000000..1d8a920ad25
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr16696-permissive.C
@@ -0,0 +1,17 @@
+// PR 16696 Strange message when operator++ not found
+// { dg-do compile }
+// { dg-options "-fdiagnostics-show-option -fpermissive" }
+
+
+struct X { void operator++(); };
+struct Y { };
+
+int main () {
+ X x;
+ Y y;
+ x++; // { dg-warning "trying prefix operator" }
+
+ y++; // { dg-warning "trying prefix operator" }
+ // { dg-error "no match" "" { target *-*-* } 14 }
+}
+
diff --git a/gcc/testsuite/g++.dg/parse/pr16696.C b/gcc/testsuite/g++.dg/parse/pr16696.C
new file mode 100644
index 00000000000..902e2a1a90b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/pr16696.C
@@ -0,0 +1,17 @@
+// PR 16696 Strange message when operator++ not found
+// { dg-do compile }
+// { dg-options "-fdiagnostics-show-option" }
+
+
+struct X { void operator++(); };
+struct Y { };
+
+int main () {
+ X x;
+ Y y;
+ x++; // { dg-bogus "trying prefix operator" }
+ // { dg-error "fpermissive" "" { target *-*-* } 12 }
+ y++; // { dg-bogus "trying prefix operator" }
+ // { dg-error "fpermissive" "" { target *-*-* } 14 }
+}
+
diff --git a/gcc/testsuite/g++.dg/template/arg2.C b/gcc/testsuite/g++.dg/template/arg2.C
index 9fb7a68cc78..1314b258fef 100644
--- a/gcc/testsuite/g++.dg/template/arg2.C
+++ b/gcc/testsuite/g++.dg/template/arg2.C
@@ -10,5 +10,5 @@ template <typename T> class X {};
void fn ()
{
class L {};
- X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" }
+ X<L> f;
}
diff --git a/gcc/testsuite/g++.dg/template/local4.C b/gcc/testsuite/g++.dg/template/local4.C
index cfa37364975..41e2370c395 100644
--- a/gcc/testsuite/g++.dg/template/local4.C
+++ b/gcc/testsuite/g++.dg/template/local4.C
@@ -4,5 +4,5 @@ template <typename T> void foo() {}
int main () {
struct S {};
- foo<S> (); // { dg-error "match" }
+ foo<S> ();
}
diff --git a/gcc/testsuite/g++.dg/torture/pr40924.C b/gcc/testsuite/g++.dg/torture/pr40924.C
new file mode 100644
index 00000000000..9140da3ba3b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40924.C
@@ -0,0 +1,111 @@
+// PR rtl-optimization/40924
+// { dg-do run }
+
+extern "C" void abort (void);
+
+#define MAY_ALIAS __attribute__((__may_alias__))
+
+typedef struct { float v[2]; } floata;
+typedef struct { int v[2]; } inta;
+
+typedef unsigned int uint MAY_ALIAS;
+typedef signed int sint MAY_ALIAS;
+typedef float flt MAY_ALIAS;
+
+static inline unsigned short
+less_than (inta a, inta b)
+{
+ unsigned short r = 0;
+ const uint *p1 = (const uint *) &a;
+ const uint *p2 = (const uint *) &b;
+ for (int i=0; i < 2; i++)
+ if (p1[i] < p2[i]) r |= (1 << i);
+ return r;
+}
+
+static inline inta
+multiply (inta b, inta c)
+{
+ inta r;
+ sint *p3 = (sint *) &c;
+ for (int i=0; i < 2; i++)
+ r.v[i] = (int) (b.v[i] * p3[i] & 0xFFFFFFFF);
+ return r;
+}
+
+static inline floata
+gather (inta indexes, const void *baseAddr)
+{
+ floata r;
+
+ sint *idx = (sint *) &indexes;
+ flt *src = (flt *) baseAddr;
+ for (int i=0; i < 2; i++)
+ r.v[i] = *(src + idx[i]);
+ return r;
+}
+
+static inline inta
+add (const inta &b, const inta &c)
+{
+ inta result;
+ sint *r = (sint *) &result;
+
+ for (int i=0; i < 2; i++)
+ r[i] = b.v[i] + c.v[i];
+ return result;
+}
+
+struct uintv
+{
+ inta data;
+ inline uintv () { data.v[0] = 0; data.v[1] = 1; }
+ inline uintv (unsigned int a)
+ {
+ for (int i=0; i < 2; i++)
+ *(uint *) &data.v[i] = a;
+ }
+ inline uintv (inta x) : data (x) {}
+ inline uintv operator* (const uintv &x) const
+ { return multiply (data, x.data); }
+ inline uintv operator+ (const uintv &x) const
+ { return uintv (add (data, x.data)); }
+ inline unsigned short operator< (const uintv &x) const
+ { return less_than (data, x.data); }
+};
+
+struct floatv
+{
+ floata data;
+ explicit inline floatv (const uintv &x)
+ {
+ uint *p2 = (uint *) &x.data;
+ for (int i=0; i < 2; i++)
+ data.v[i] = p2[i];
+ }
+ inline floatv (const float *array, const uintv &indexes)
+ {
+ const uintv &offsets = indexes * uintv (1);
+ data = gather (offsets.data, array);
+ }
+ unsigned short operator== (const floatv &x) const
+ {
+ unsigned short r = 0;
+ for (int i=0; i < 2; i++)
+ if (data.v[i] == x.data.v[i]) r |= (1 << i);
+ return r;
+ }
+};
+
+int
+main ()
+{
+ const float array[2] = { 2, 3 };
+ for (uintv i; (i < 2) == 3; i = i + 2)
+ {
+ const floatv ii (i + 2);
+ floatv a (array, i);
+ if ((a == ii) != 3)
+ abort ();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40991.C b/gcc/testsuite/g++.dg/torture/pr40991.C
new file mode 100644
index 00000000000..c08124024a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40991.C
@@ -0,0 +1,113 @@
+/* { dg-options "-std=gnu++0x" } */
+
+typedef __SIZE_TYPE__ size_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ using ::size_t;
+ void __throw_bad_function_call() __attribute__((__noreturn__));
+}
+inline void* operator new(std::size_t, void* __p) throw() {
+ return __p;
+}
+namespace std {
+ class type_info {
+ public:
+ bool operator==(const type_info& __arg) const { }
+ };
+ namespace tr1 {
+ template<typename _Tp, _Tp __v> struct integral_constant { };
+ typedef integral_constant<bool, true> true_type;
+ template<typename _Res, typename... _ArgTypes>
+ struct _Maybe_unary_or_binary_function { };
+ class _Undefined_class;
+ union _Nocopy_types {
+ void (_Undefined_class::*_M_member_pointer)();
+ };
+ union _Any_data {
+ void* _M_access() {
+ return &_M_pod_data[0];
+ }
+ char _M_pod_data[sizeof(_Nocopy_types)];
+ };
+ enum _Manager_operation { __get_type_info, __get_functor_ptr, __clone_functor, __destroy_functor };
+ template<typename _Tp> struct _Simple_type_wrapper {
+ _Simple_type_wrapper(_Tp __value) : __value(__value) { }
+ _Tp __value;
+ };
+ template<typename _Signature> class function;
+ class _Function_base {
+ public:
+ static const std::size_t _M_max_size = sizeof(_Nocopy_types);
+ static const std::size_t _M_max_align = __alignof__(_Nocopy_types);
+ template<typename _Functor> class _Base_manager {
+ static const bool __stored_locally = (sizeof(_Functor) <= _M_max_size && __alignof__(_Functor) <= _M_max_align && (_M_max_align % __alignof__(_Functor) == 0));
+ typedef integral_constant<bool, __stored_locally> _Local_storage;
+ public:
+ static bool _M_manager(_Any_data& __dest, const _Any_data& __source, _Manager_operation __op) { }
+ static void _M_init_functor(_Any_data& __functor, const _Functor& __f) {
+ _M_init_functor(__functor, __f, _Local_storage());
+ }
+ template<typename _Class, typename _Tp> static bool _M_not_empty_function(_Tp _Class::* const& __mp) {
+ return __mp;
+ }
+ static void _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type) {
+ new (__functor._M_access()) _Functor(__f);
+ }
+ };
+ ~_Function_base() {
+ if (_M_manager) _M_manager(_M_functor, _M_functor, __destroy_functor);
+ }
+ bool _M_empty() const {
+ return !_M_manager;
+ }
+ typedef bool (*_Manager_type)(_Any_data&, const _Any_data&, _Manager_operation);
+ _Any_data _M_functor;
+ _Manager_type _M_manager;
+ };
+ template<typename _Signature, typename _Functor> class _Function_handler;
+ template<typename _Class, typename _Member, typename _Res, typename... _ArgTypes> class _Function_handler<_Res(_ArgTypes...), _Member _Class::*> : public _Function_handler<void(_ArgTypes...), _Member _Class::*> {
+ public:
+ static _Res _M_invoke(const _Any_data& __functor, _ArgTypes... __args) { }
+ };
+ template<typename _Class, typename _Member, typename... _ArgTypes> class _Function_handler<void(_ArgTypes...), _Member _Class::*> : public _Function_base::_Base_manager< _Simple_type_wrapper< _Member _Class::* > > { };
+ template<typename _Res, typename... _ArgTypes> class function<_Res(_ArgTypes...)> : public _Maybe_unary_or_binary_function<_Res, _ArgTypes...>, private _Function_base {
+ typedef _Res _Signature_type(_ArgTypes...);
+ struct _Useless { };
+ public:
+ template<typename _Functor> function(_Functor __f, _Useless = _Useless());
+ _Res operator()(_ArgTypes... __args) const;
+ const type_info& target_type() const;
+ typedef _Res (*_Invoker_type)(const _Any_data&, _ArgTypes...);
+ _Invoker_type _M_invoker;
+ };
+ template<typename _Res, typename... _ArgTypes> template<typename _Functor> function<_Res(_ArgTypes...)>:: function(_Functor __f, _Useless) : _Function_base() {
+ typedef _Function_handler<_Signature_type, _Functor> _My_handler;
+ if (_My_handler::_M_not_empty_function(__f)) {
+ _M_invoker = &_My_handler::_M_invoke;
+ _M_manager = &_My_handler::_M_manager;
+ _My_handler::_M_init_functor(_M_functor, __f);
+ }
+ }
+ template<typename _Res, typename... _ArgTypes> _Res function<_Res(_ArgTypes...)>:: operator()(_ArgTypes... __args) const {
+ if (_M_empty()) {
+ __throw_bad_function_call();
+ }
+ return _M_invoker(_M_functor, __args...);
+ }
+ template<typename _Res, typename... _ArgTypes> const type_info& function<_Res(_ArgTypes...)>:: target_type() const {
+ if (_M_manager) {
+ _Any_data __typeinfo_result;
+ _M_manager(__typeinfo_result, _M_functor, __get_type_info);
+ }
+ }
+ }
+}
+struct X {
+ int bar;
+};
+void test05() {
+ using std::tr1::function;
+ X x;
+ function<int(X&)> frm(&X::bar);
+ frm(x) == 17;
+ typeid(int X::*) == frm.target_type();
+}
diff --git a/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C b/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C
new file mode 100644
index 00000000000..a0d488284b9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-prof/inline_mismatch_args.C
@@ -0,0 +1,36 @@
+/* { dg-options "-O2 -fdump-tree-einline2" } */
+class DocId {
+ public:
+ DocId() { }
+ DocId(const DocId &other) { }
+};
+
+int g;
+class Base {
+ public:
+ virtual void Foo(DocId id) { g++; }
+};
+
+class Super: public Base {
+ public:
+ void Foo(DocId id) { }
+ void Bar(Base *base, DocId id) __attribute__((noinline));
+};
+
+void Super::Bar(Base *base, DocId id) {
+ Super::Foo(id); // direct call is inlined
+ base->Foo(id); // indirect call is marked do not inline
+}
+
+int main(void)
+{
+ Base bah;
+ Super baz;
+ DocId gid;
+
+ baz.Bar(&baz, gid);
+ return 0;
+}
+/* { dg-final-use { scan-tree-dump "Inlining virtual void Super::Foo" "einline2"} } */
+/* { dg-final-use { scan-tree-dump-not "mismatched arguments" "einline2"} } */
+/* { dg-final-use { cleanup-tree-dump "einline2" } } */
diff --git a/gcc/testsuite/g++.dg/tree-prof/partition1.C b/gcc/testsuite/g++.dg/tree-prof/partition1.C
new file mode 100644
index 00000000000..d0dcbc4524b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-prof/partition1.C
@@ -0,0 +1,53 @@
+/* { dg-require-effective-target freorder } */
+/* { dg-options "-O2 -freorder-blocks-and-partition" } */
+
+struct A { A () __attribute__((noinline)); ~A () __attribute__((noinline)); };
+A::A () { asm volatile ("" : : : "memory"); }
+A::~A () { asm volatile ("" : : : "memory"); }
+
+int bar () __attribute__((noinline));
+void foo () __attribute__((noinline));
+
+volatile int k, l;
+
+int bar (int i)
+{
+ void *p = __builtin_alloca (i);
+ asm volatile ("" : : "r" (i), "r" (p) : "memory");
+ if (k) throw 6;
+ return ++l;
+}
+
+void foo ()
+{
+ A a;
+ try {
+ A b;
+ int i = bar (5);
+ try { throw 6; } catch (int) {}
+ if (__builtin_expect (i < 4500, 0)) {
+ bar (7);
+ try { bar (8); } catch (long) {}
+ bar (10);
+ if (__builtin_expect (i < 0, 0)) {
+ try { bar (12); } catch (...) {}
+ bar (16);
+ bar (122);
+ } else {
+ try { bar (bar (7)); } catch (int) {}
+ }
+ } else {
+ try { bar (bar (bar (9))); } catch (...) {}
+ bar (5);
+ }
+ } catch (...) {
+ }
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 10000; i++)
+ foo ();
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr33615.C b/gcc/testsuite/g++.dg/tree-ssa/pr33615.C
index e8a536935b7..4b075428290 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/pr33615.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr33615.C
@@ -16,5 +16,5 @@ foo (double a, int x)
// The expression 1.0 / 0.0 should not be treated as a loop invariant
// if it may throw an exception.
-// { dg-final { scan-tree-dump-times "invariant up to" 0 "lim" } }
-// { dg-final { cleanup-tree-dump "lim" } }
+// { dg-final { scan-tree-dump-times "invariant up to" 0 "lim1" } }
+// { dg-final { cleanup-tree-dump "lim\[1-2\]" } }
diff --git a/gcc/testsuite/g++.dg/warn/Wconversion-real.C b/gcc/testsuite/g++.dg/warn/Wconversion-real.C
index f769bacdd4c..e69de29bb2d 100644
--- a/gcc/testsuite/g++.dg/warn/Wconversion-real.C
+++ b/gcc/testsuite/g++.dg/warn/Wconversion-real.C
@@ -1,85 +0,0 @@
-/* Test for diagnostics for Wconversion for floating-point.
- C++ equivalent of gcc/testsuite/gcc.dg/Wconversion-real.c */
-
-/* { dg-do compile }
-/* { dg-options "-Wconversion" } */
-
-float vfloat;
-double vdouble;
-long double vlongdouble;
-
-void ffloat (float f);
-void fdouble (double d);
-void flongdouble (long double ld);
-
-void h (void)
-{
- float f = 0;
- double d = 0;
- long double ld = 0;
-
- ffloat (3.1); /* { dg-warning "conversion" } */
- vfloat = 3.1; /* { dg-warning "conversion" } */
- ffloat (3.1L); /* { dg-warning "conversion" } */
- vfloat = 3.1L; /* { dg-warning "conversion" } */
- fdouble (3.1L); /* { dg-warning "conversion" "" { target large_long_double } } */
- vdouble = 3.1L; /* { dg-warning "conversion" "" { target large_long_double } } */
- ffloat (vdouble); /* { dg-warning "conversion" } */
- vfloat = vdouble; /* { dg-warning "conversion" } */
- ffloat (vlongdouble); /* { dg-warning "conversion" } */
- vfloat = vlongdouble; /* { dg-warning "conversion" } */
- fdouble (vlongdouble); /* { dg-warning "conversion" "" { target large_long_double } } */
- vdouble = vlongdouble; /* { dg-warning "conversion" "" { target large_long_double } } */
-
-
- ffloat ((float) 3.1);
- vfloat = (float) 3.1;
- ffloat ((float) 3.1L);
- vfloat = (float) 3.1L;
- fdouble ((double) 3.1L);
- vdouble = (double) 3.1L;
- ffloat ((float) vdouble);
- vfloat = (float) vdouble;
- ffloat ((float) vlongdouble);
- vfloat = (float) vlongdouble;
- fdouble ((double) vlongdouble);
- vdouble = (double) vlongdouble;
-
-
- ffloat (3.0);
- vfloat = 3.0;
- ffloat (3.1f);
- vfloat = 3.1f;
- ffloat (0.25L);
- vfloat = 0.25L;
-
-
- fdouble (3.0);
- vdouble = 3.0;
- fdouble (3.1f);
- vdouble = 3.1f;
- fdouble (0.25L);
- vdouble = 0.25L;
-
- flongdouble (3.0);
- vlongdouble = 3.0;
- flongdouble (3.1f);
- vlongdouble = 3.1f;
- flongdouble (0.25L);
- vlongdouble = 0.25L;
-
- ffloat (f);
- vfloat = f;
- fdouble (f);
- vdouble = f;
- fdouble (d);
- vdouble = d;
- flongdouble (f);
- vlongdouble = f;
- flongdouble (d);
- vlongdouble = d;
- flongdouble (ld);
- vlongdouble = ld;
-}
-
-
diff --git a/gcc/testsuite/g++.dg/warn/pr36069.C b/gcc/testsuite/g++.dg/warn/pr36069.C
new file mode 100644
index 00000000000..efb35c25716
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr36069.C
@@ -0,0 +1,16 @@
+// PR c++/36069 Strange "warning: suggest parentheses around
+// assignment used as truth value" with volatile/non volatile bools
+// { dg-do compile }
+// { dg-options "-Wparentheses" }
+struct foo {
+ bool a;
+ volatile bool b,c;
+ foo() { a = b = c = false; } // { dg-bogus "parentheses" }
+};
+
+int main() {
+ bool a;
+ volatile bool b,c;
+ a = b = c = false; // { dg-bogus "parentheses" }
+ foo A;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.law/operators32.C b/gcc/testsuite/g++.old-deja/g++.law/operators32.C
index 91de03ee8fc..89f0b6601aa 100644
--- a/gcc/testsuite/g++.old-deja/g++.law/operators32.C
+++ b/gcc/testsuite/g++.old-deja/g++.law/operators32.C
@@ -49,7 +49,7 @@ foo() {std::cout << "foo created" << std::endl; }
};
foo **f2;
-allocate2d(d1, d2, f2);// { dg-error "" } type.*// ERROR - trying to.*
-ffree(d1, f2);// { dg-error "" } type.*// ERROR - trying to.*
+allocate2d(d1, d2, f2);
+ffree(d1, f2);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/anon9.C b/gcc/testsuite/g++.old-deja/g++.other/anon9.C
index a364db8e962..f4b192337c1 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/anon9.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/anon9.C
@@ -4,3 +4,8 @@
typedef const struct { int i; } T; // { dg-error "" } referenced below
void f (T* t); // { dg-error "" } uses unnamed type
+
+int main()
+{
+ f(0);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/linkage1.C b/gcc/testsuite/g++.old-deja/g++.other/linkage1.C
index e9b5a9d2aa3..de9a6accf18 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/linkage1.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/linkage1.C
@@ -3,13 +3,16 @@ typedef struct {
int i;
} *p;
-void f (p) { } // { dg-error "uses anonymous type" }
-p q; // { dg-warning "uses anonymous type" }
+void f (p) { }
+p q;
int main()
{
- extern p j; // { dg-warning "uses anonymous type" }
+ extern p j; // { dg-error "anonymous type" }
+ j+1;
struct A { int j; };
- extern A a; // { dg-warning "uses local type" }
- extern void f (A); // { dg-error "uses local type" }
+ extern A a; // { dg-error "local type" }
+ a.j+1;
+ extern void f (A); // { dg-error "local type" }
+ f(a);
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/linkage2.C b/gcc/testsuite/g++.old-deja/g++.other/linkage2.C
index 2385b2216fe..64f74f7292c 100644
--- a/gcc/testsuite/g++.old-deja/g++.other/linkage2.C
+++ b/gcc/testsuite/g++.old-deja/g++.other/linkage2.C
@@ -7,7 +7,7 @@ extern GDBM_FILE gdbm_open();
}
typedef struct { int dummy[10]; } *FAIL_FILE;
-extern FAIL_FILE fail_open(); // { dg-error "" } non-local function
+extern FAIL_FILE fail_open(); // OK because it's never used
typedef struct { int dummy[10]; } *SUCCESS_FILE, S;
extern SUCCESS_FILE success_open();
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/enum6.C b/gcc/testsuite/g++.old-deja/g++.pt/enum6.C
index 254b48bc7fc..561254d0d68 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/enum6.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/enum6.C
@@ -8,7 +8,7 @@ void fn(T)
{
enum tern { H, L, X, U };
- vector<tern> ternvec; // { dg-error "" } composed from a local type
+ vector<tern> ternvec;
}
template void fn(int);
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40570.c b/gcc/testsuite/gcc.c-torture/compile/pr40570.c
new file mode 100644
index 00000000000..7c3f4d83b2e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr40570.c
@@ -0,0 +1,22 @@
+extern void anything(int);
+
+static int foo(int i);
+
+static int bar(int i) { foo(i); }
+
+extern int j;
+
+static int foo(int i)
+{
+ if (j)
+ anything(j);
+ return bar(i);
+}
+
+int baz()
+{
+ foo(0);
+ if (baz())
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40964.c b/gcc/testsuite/gcc.c-torture/compile/pr40964.c
new file mode 100644
index 00000000000..51639940ea8
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr40964.c
@@ -0,0 +1,10 @@
+struct alloc2 {
+ int bla;
+ char * __restrict data;
+ char * __restrict data2;
+};
+struct alloc2 b;
+void * f (void)
+{
+ return b.data;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c b/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c
new file mode 100644
index 00000000000..8aef66dbdfe
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr41006-1.c
@@ -0,0 +1,17 @@
+typedef int (*FARPROC)();
+
+typedef int (*LPFN_ACCEPTEX)(void*);
+static LPFN_ACCEPTEX acceptex_fn;
+
+int xWSAIoctl(void*);
+static void get_fn(FARPROC* fn)
+{
+ FARPROC func;
+ if (!xWSAIoctl( &func))
+ *fn = func;
+}
+
+void get_fn_pointers()
+{
+ get_fn((FARPROC*)&acceptex_fn);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c b/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c
new file mode 100644
index 00000000000..766778d410f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr41006-2.c
@@ -0,0 +1,15 @@
+typedef int *FARPROC;
+static int * __restrict__ acceptex_fn;
+
+int xWSAIoctl(void*);
+static void get_fn(FARPROC* fn)
+{
+ FARPROC func;
+ if (!xWSAIoctl( &func))
+ *fn = func;
+}
+
+void get_fn_pointers()
+{
+ get_fn((FARPROC*)&acceptex_fn);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41016.c b/gcc/testsuite/gcc.c-torture/compile/pr41016.c
new file mode 100644
index 00000000000..57bddb49dea
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr41016.c
@@ -0,0 +1,17 @@
+typedef struct _IO_FILE FILE;
+void
+CompareRNAStructures (FILE * ofp, int start, int L, char *ss_true, char *ss)
+{
+ int i;
+ float agree = 0.;
+ float pairs = 0.;
+ float pairs_true = 0.;
+ for (i = 0; i < L; i++)
+ {
+ pairs_true += 1.;
+ agree += 1.;
+ }
+ if (((int) pairs % 2 != 0) || ((int) pairs_true % 2 != 0)
+ || ((int) agree % 2 != 0))
+ Die ("Error in CompareRNAStrutures(); odd number of paired nucleotides\n");
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20090814-1.c b/gcc/testsuite/gcc.c-torture/execute/20090814-1.c
new file mode 100644
index 00000000000..857393b5760
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20090814-1.c
@@ -0,0 +1,23 @@
+int __attribute__((noinline))
+bar (int *a)
+{
+ return *a;
+}
+int i;
+int __attribute__((noinline))
+foo (int (*a)[2])
+{
+ return bar (&(*a)[i]);
+}
+
+extern void abort (void);
+int a[2];
+int main()
+{
+ a[0] = -1;
+ a[1] = 42;
+ i = 1;
+ if (foo (&a) != 42)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/builtin-apply2.c b/gcc/testsuite/gcc.dg/builtin-apply2.c
index bc49a645809..a303e3ddb79 100644
--- a/gcc/testsuite/gcc.dg/builtin-apply2.c
+++ b/gcc/testsuite/gcc.dg/builtin-apply2.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { "arm*-*-*" } { "-mfloat-abi=hard" } { "" } } */
/* PR target/12503 */
/* Origin: <pierre.nguyen-tuong@asim.lip6.fr> */
diff --git a/gcc/testsuite/gcc.dg/builtins-10.c b/gcc/testsuite/gcc.dg/builtins-10.c
index d90e61ab326..1b141fda252 100644
--- a/gcc/testsuite/gcc.dg/builtins-10.c
+++ b/gcc/testsuite/gcc.dg/builtins-10.c
@@ -25,7 +25,7 @@ void test(double x)
link_error ();
if (pow(pow(x,4.0),0.25) != x)
- link_error ();
+ /* XFAIL. PR41098. */;
}
void test2(double x, double y, double z)
@@ -42,7 +42,7 @@ void test2(double x, double y, double z)
if (pow(sqrt(x),y) != pow(x,y*0.5))
link_error ();
- if (pow(pow(x,y),z) != pow(x,y*z))
+ if (pow(pow(fabs(x),y),z) != pow(fabs(x),y*z))
link_error ();
}
diff --git a/gcc/testsuite/gcc.dg/debug/20020224-1.c b/gcc/testsuite/gcc.dg/debug/20020224-1.c
index c61a17aed10..968b5655b39 100644
--- a/gcc/testsuite/gcc.dg/debug/20020224-1.c
+++ b/gcc/testsuite/gcc.dg/debug/20020224-1.c
@@ -1,9 +1,13 @@
+/* { dg-options "-g3 -O" } */
/* { dg-do compile } */
-/* Here's the deal: f3 is not inlined because it's too big, but f2 and
- f1 are inlined into it. We used to fail to emit debugging info for
- t1, because it was moved inside the (inlined) block of f1, marked
- as abstract, then we'd crash. */
+/* Here's the deal: f4 is inlined into main, f3 is inlined into f4, f2 is
+ inlined into f1. The DIE of main should contain DW_TAG_inlined_subroutines
+ children for f4, f3, f2 and f1. Also, there should be a DIE representing
+ and out of line instance of f4, aside the DIE representing its abstract
+ instance.
+ We used to fail to emit debugging info for t1, because it was moved
+ inside the (inlined) block of f1, marked as abstract, then we'd crash. */
#define UNUSED __attribute__((unused))
#define EXT __extension__
@@ -58,3 +62,10 @@ f4 (void)
return;
}
+
+int
+main ()
+{
+ int foo = 1;
+ f4 ();
+}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
new file mode 100644
index 00000000000..3a6318ea586
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
@@ -0,0 +1,70 @@
+/* Contributed by Dodji Seketeli <dodji@redhat.com>
+ Origin: PR debug/37801
+
+ Abstract instances (DW_TAG_subroutines having the DW_AT_inline attribute)
+ of second and first were having a DW_TAG_lexical_block DIE wrongly
+ representing the inlined calls to third (in second) and to
+ second (in first). At the same time, main didn't have children
+ DW_TAG_inlined_subroutine DIEs representing the inlined calls to
+ first, second and third.
+
+ The ideal goal here is to test that we have no superfluous
+ DW_TAG_lexical_block DIE anymore, that abstract instances DIEs have
+ no descendant DIE with a DW_AT_abstract_origin attribute, and that main has
+ properly nested DW_TAG_inlined_subroutine DIEs for third, second and first.
+*/
+
+/* { dg-options "-O -g3 -dA" } */
+/* { dg-do compile } */
+
+/* There are 6 inlined subroutines:
+ - One for each subroutine inlined into main, that's 3.
+ - One for earch subroutine inline into the out of line instances
+ of third, second and first. */
+/* { dg-final { scan-assembler-times "\\(DIE \\(.*?\\) DW_TAG_inlined_subroutine" 6 } } */
+
+/* Likewise we should have 6 DW_TAG_lexical_block DIEs:
+ - One for each subroutine inlined into main, so that's 3.
+ - One for each subroutine inlined in the out of line instances
+ of third, second and first, that's 3.
+*/
+/* { dg-final { scan-assembler-times "\\(DIE \\(.*?\\) DW_TAG_lexical_block" 6 } } */
+
+
+/* There are 3 DW_AT_inline attributes: one per abstract inline instance.
+ The value of the attribute must be 0x3, meaning the function was
+ actually inlined. */
+/* { dg-final { scan-assembler-times "byte.*?0x3.*? DW_AT_inline" 3 } } */
+
+
+inline void
+third (int arg3)
+{
+ int var3 = arg3;
+ int* a = 0;
+ a[0] = var3;
+}
+
+inline void
+second (int arg2)
+{
+ int var2 = arg2;
+ third (var2+1);
+}
+
+inline void
+first (int arg1)
+{
+ int var1 = arg1;
+ second (var1+1);
+}
+
+int
+main ()
+{
+ int some_int = 1;
+ first (some_int);
+ return 0;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/dfp/pr39902.c b/gcc/testsuite/gcc.dg/dfp/pr39902.c
index 8c4e7b24380..120610c3779 100644
--- a/gcc/testsuite/gcc.dg/dfp/pr39902.c
+++ b/gcc/testsuite/gcc.dg/dfp/pr39902.c
@@ -189,7 +189,7 @@ doit128 (void)
if (COMPARE128 (a128, p128_2_0))
FAILURE
- a128.d = p128_2_0.d * 1.0DD;
+ a128.d = p128_2_0.d * 1.0DL;
if (COMPARE128 (a128, p128_2_0))
FAILURE
@@ -197,7 +197,7 @@ doit128 (void)
if (COMPARE128 (a128, m128_2_0))
FAILURE
- a128.d = p128_2_0.d * -1.0DD;
+ a128.d = p128_2_0.d * -1.0DL;
if (COMPARE128 (a128, m128_2_0))
FAILURE
@@ -208,7 +208,7 @@ doit128 (void)
if (! (COMPARE128 (a128, p128_2_0)))
FAILURE
- a128.d = p128_2_0.d * 1.DD;
+ a128.d = p128_2_0.d * 1.DL;
if (! (COMPARE128 (a128, p128_2_0)))
FAILURE
@@ -216,7 +216,7 @@ doit128 (void)
if (! (COMPARE128 (a128, m128_2_0)))
FAILURE
- a128.d = p128_2_0.d * -1.DD;
+ a128.d = p128_2_0.d * -1.DL;
if (! (COMPARE128 (a128, m128_2_0)))
FAILURE
}
diff --git a/gcc/testsuite/gcc.dg/dg.exp b/gcc/testsuite/gcc.dg/dg.exp
index 8526c5866fb..3f71178f98e 100644
--- a/gcc/testsuite/gcc.dg/dg.exp
+++ b/gcc/testsuite/gcc.dg/dg.exp
@@ -32,5 +32,9 @@ dg-init
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cSi\]]] \
"" $DEFAULT_CFLAGS
+# C/C++ common tests.
+dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \
+ " -Wc++-compat " ""
+
# All done.
dg-finish
diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c
index 627f044fc14..55b903650e2 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-0.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O -floop-block -fdump-tree-graphite-all" } */
-
#define N 1000
int toto()
@@ -21,5 +19,5 @@ main()
return toto();
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite"} } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c
index 0a70e9e10a4..ba772b3f952 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-1.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
-
#define MAX 8192
void bar (void);
@@ -36,5 +34,5 @@ int main()
return sum;
}
-/* { dg-final { scan-tree-dump-times "will be loop blocked" 2 "graphite"} } */
+/* { dg-final { scan-tree-dump-times "will be loop blocked" 2 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-2.c b/gcc/testsuite/gcc.dg/graphite/block-2.c
index fc4e889e791..210ea342776 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-2.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
-
typedef unsigned char UChar;
typedef int Int32;
typedef unsigned int UInt32;
diff --git a/gcc/testsuite/gcc.dg/graphite/block-3.c b/gcc/testsuite/gcc.dg/graphite/block-3.c
index 1d2ca40dbac..6358bce1e24 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-3.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
-
#define N 24
#define M 100
diff --git a/gcc/testsuite/gcc.dg/graphite/block-4.c b/gcc/testsuite/gcc.dg/graphite/block-4.c
index e3649f01d2d..773dfef5df6 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-4.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
-
#define N 24
#define M 1000
diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c
index e0bd4688d39..7864f32e1fc 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-5.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
-
#define N 10000
void foo (int);
int test ()
@@ -22,5 +20,5 @@ int test ()
}
/* Interchange is legal for loops 0 and 1 of the first two SCoPs */
-/* { dg-final { scan-tree-dump-times "Interchange valid for loops 0 and 1:" 2 "graphite"} } */
+/* { dg-final { scan-tree-dump-times "Interchange valid for loops 0 and 1:" 2 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c
index 77429f1cb83..5545ec9fc91 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-6.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
-
#define N 10000
void foo (int);
int test ()
@@ -21,5 +19,5 @@ int test ()
}
/* Interchange is not legal for loops 0 and 1 of SCoP 2. */
-/* { dg-final { scan-tree-dump-times "Interchange not valid for loops 0 and 1:" 1 "graphite"} } */
+/* { dg-final { scan-tree-dump-times "Interchange not valid for loops 0 and 1:" 1 "graphite" { xfail *-*-* } } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp
index a1257177f55..57fb74c8d90 100644
--- a/gcc/testsuite/gcc.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp
@@ -23,23 +23,66 @@ if ![check_effective_target_fgraphite] {
return
}
+# Remove VALUE from LIST_VARIABLE.
+proc lremove {list_variable value} {
+ upvar 1 $list_variable var
+ set idx [lsearch -exact $var $value]
+ set var [lreplace $var $idx $idx]
+}
+
# The default action for a test is 'compile'. Save current default.
global dg-do-what-default
set save-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default compile
-# If a testcase doesn't have special options, use these.
-global DEFAULT_CFLAGS
-if ![info exists DEFAULT_CFLAGS] then {
- set DEFAULT_CFLAGS " -ansi -pedantic-errors"
-}
-
# Initialize `dg'.
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
- "" $DEFAULT_CFLAGS
+
+set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.c ] ]
+
+# Flags using for block-* files.
+set DEFAULT_CFLAGS_GRAPHITE_BLOCK "-O2 -fdump-tree-graphite-all"
+set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ]
+dg-runtest $block_files "" $DEFAULT_CFLAGS_GRAPHITE_BLOCK
+foreach block_file $block_files {lremove wait_to_run_files $block_file}
+
+# Flags using for id-* files.
+set DEFAULT_CFLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity"
+set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ]
+dg-runtest $id_files "" $DEFAULT_CFLAGS_GRAPHITE_IDENTITY
+foreach id_file $id_files {lremove wait_to_run_files $id_file}
+
+# Flags using for interchange-* files.
+set DEFAULT_CFLAGS_GRAPHITE_BLOCK "-O2 -fdump-tree-graphite-all -floop-interchange"
+set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c ] ]
+dg-runtest $interchange_files "" $DEFAULT_CFLAGS_GRAPHITE_BLOCK
+foreach interchange_file $interchange_files {lremove wait_to_run_files $interchange_file}
+
+# Flags using for scop-* files.
+set DEFAULT_CFLAGS_GRAPHITE_SCOP "-O2 -fgraphite -fdump-tree-graphite-all"
+set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.c ] ]
+dg-runtest $scop_files "" $DEFAULT_CFLAGS_GRAPHITE_SCOP
+foreach scop_file $scop_files {lremove wait_to_run_files $scop_file}
+
+
+# Schedule now the tests to be run.
+set dg-do-what-default run
+
+# Flags using for run-id-* files.
+set DEFAULT_CFLAGS_RUN_ID "-O2 -fgraphite-identity"
+set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ]
+dg-runtest $run_id_files "" $DEFAULT_CFLAGS_RUN_ID
+foreach run_id_file $run_id_files {lremove wait_to_run_files $run_id_file}
+
+
+# The default action for the rest of the files is 'compile'.
+set dg-do-what-default compile
+
+# Flags using for other files.
+set DEFAULT_CFLAGS_GRAPHITE "-ansi -pedantic-errors"
+dg-runtest $wait_to_run_files "" $DEFAULT_CFLAGS_GRAPHITE
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-1.c b/gcc/testsuite/gcc.dg/graphite/id-1.c
new file mode 100644
index 00000000000..70b477a07b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-1.c
@@ -0,0 +1,18 @@
+typedef int *lambda_vector;
+typedef lambda_vector *lambda_matrix;
+lambda_vector_add_mc (lambda_vector vec1, int const1,
+ lambda_vector vec2, int const2,
+ lambda_vector vec3, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ vec3[i] = const1 * vec1[i] + const2 * vec2[i];
+}
+lambda_matrix_add_mc (lambda_matrix mat1, int const1,
+ lambda_matrix mat2, int const2,
+ lambda_matrix mat3, int m, int n)
+{
+ int i;
+ for (i = 0; i < m; i++)
+ lambda_vector_add_mc (mat1[i], const1, mat2[i], const2, mat3[i], n);
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-10.c b/gcc/testsuite/gcc.dg/graphite/id-10.c
new file mode 100644
index 00000000000..8c2b88982b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-10.c
@@ -0,0 +1,15 @@
+int bar[100][100];
+
+int
+foo (int N, unsigned int J)
+{
+ int i, k;
+
+ for (k = 0; k < N; k++)
+ if (k != J)
+ for (i = 0; i < N; i++)
+ if (i != J)
+ bar[k][i] = 20;
+
+ return bar[N][J];
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-11.c b/gcc/testsuite/gcc.dg/graphite/id-11.c
new file mode 100644
index 00000000000..387512c3c4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-11.c
@@ -0,0 +1,14 @@
+double
+foo (double x, double *cof)
+{
+ int i;
+ double tmp, value;
+
+ for (i = 10; i >= 0; i--)
+ {
+ value += cof[i] / tmp;
+ tmp -= 1.0;
+ }
+
+ return value;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-12.c b/gcc/testsuite/gcc.dg/graphite/id-12.c
new file mode 100644
index 00000000000..57857d1d20c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-12.c
@@ -0,0 +1,10 @@
+void
+foo (unsigned short x[])
+{
+ int i;
+ unsigned short *p = &x[2];
+ if (*p)
+ x += 2;
+ for (i = 2; i < 9; i++, ++x)
+ *x >>= 8;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-13.c b/gcc/testsuite/gcc.dg/graphite/id-13.c
new file mode 100644
index 00000000000..e921cd4e9d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-13.c
@@ -0,0 +1,11 @@
+void
+foo (int N, int k, int *fb)
+{
+ int i, j;
+ for (i = 1; i <= N; i++)
+ {
+ for (j = 1; j < i; j++)
+ k %= N;
+ bar (k);
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-14.c b/gcc/testsuite/gcc.dg/graphite/id-14.c
new file mode 100644
index 00000000000..51ac4c1bbe5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-14.c
@@ -0,0 +1,19 @@
+typedef struct {
+ int n;
+ float *a;
+} bar;
+
+float
+foo (bar *b)
+{
+ float c, d;
+ int j;
+
+ for (j = 0; (j < b->n); j++)
+ d += b->a[j];
+
+ for (j = 0; (j < b->n); j++)
+ c += b->a[j];
+
+ return d;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-15.c b/gcc/testsuite/gcc.dg/graphite/id-15.c
new file mode 100644
index 00000000000..109d5bbdb01
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-15.c
@@ -0,0 +1,118 @@
+typedef long unsigned int size_t;
+extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
+
+static void
+encode (words, low, hi)
+ long *words;
+ unsigned long low;
+ long hi;
+{
+ words[0] = ((low) & (((unsigned long) 1 << ((8 * 8) / 2)) - 1));
+ words[1] = ((unsigned long) (low) >> (8 * 8) / 2);
+ words[2] = ((hi) & (((unsigned long) 1 << ((8 * 8) / 2)) - 1));
+ words[3] = ((unsigned long) (hi) >> (8 * 8) / 2);
+}
+
+static void
+decode (words, low, hi)
+ long *words;
+ unsigned long *low;
+ long *hi;
+{
+ *low = words[0] + words[1] * ((unsigned long) 1 << (8 * 8) / 2);
+ *hi = words[2] + words[3] * ((unsigned long) 1 << (8 * 8) / 2);
+}
+
+int
+neg_double (l1, h1, lv, hv)
+ unsigned long l1;
+ long h1;
+ unsigned long *lv;
+ long *hv;
+{
+ if (l1 == 0)
+ {
+ *lv = 0;
+ *hv = - h1;
+ return (*hv & h1) < 0;
+ }
+ else
+ {
+ *lv = -l1;
+ *hv = ~h1;
+ return 0;
+ }
+}
+
+int
+add_double (l1, h1, l2, h2, lv, hv)
+ unsigned long l1, l2;
+ long h1, h2;
+ unsigned long *lv;
+ long *hv;
+{
+ unsigned long l;
+ long h;
+
+ l = l1 + l2;
+ h = h1 + h2 + (l < l1);
+
+ *lv = l;
+ *hv = h;
+ return ((~((h1) ^ (h2)) & ((h1) ^ (h))) < 0);
+}
+
+int
+mul_double (l1, h1, l2, h2, lv, hv)
+ unsigned long l1, l2;
+ long h1, h2;
+ unsigned long *lv;
+ long *hv;
+{
+ long arg1[4];
+ long arg2[4];
+ long prod[4 * 2];
+ unsigned long carry;
+ int i, j, k;
+ unsigned long toplow, neglow;
+ long tophigh, neghigh;
+
+ encode (arg1, l1, h1);
+ encode (arg2, l2, h2);
+
+ memset ((char *) prod, 0, sizeof prod);
+
+ for (i = 0; i < 4; i++)
+ {
+ carry = 0;
+ for (j = 0; j < 4; j++)
+ {
+ k = i + j;
+
+ carry += arg1[i] * arg2[j];
+
+ carry += prod[k];
+ prod[k] = ((carry) & (((unsigned long) 1 << ((8 * 8) / 2)) - 1));
+ carry = ((unsigned long) (carry) >> (8 * 8) / 2);
+ }
+ prod[i + 4] = carry;
+ }
+
+ decode (prod, lv, hv);
+
+
+
+ decode (prod + 4, &toplow, &tophigh);
+ if (h1 < 0)
+ {
+ neg_double (l2, h2, &neglow, &neghigh);
+ add_double (neglow, neghigh, toplow, tophigh, &toplow, &tophigh);
+ }
+ if (h2 < 0)
+ {
+ neg_double (l1, h1, &neglow, &neghigh);
+ add_double (neglow, neghigh, toplow, tophigh, &toplow, &tophigh);
+ }
+ return (*hv < 0 ? ~(toplow & tophigh) : toplow | tophigh) != 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/graphite/id-2.c b/gcc/testsuite/gcc.dg/graphite/id-2.c
new file mode 100644
index 00000000000..c11f6a283a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-2.c
@@ -0,0 +1,16 @@
+typedef _Complex float GFC_COMPLEX_4;
+matmul_c4 ()
+{
+ int x, n, count;
+ GFC_COMPLEX_4 * bbase_y;
+ GFC_COMPLEX_4 * dest_y;
+ GFC_COMPLEX_4 * abase_n;
+ GFC_COMPLEX_4 bbase_yn;
+
+ for (n = 0; n < count; n++)
+ {
+ bbase_yn = bbase_y[n];
+ for (x = 0; x < count; x++)
+ dest_y[x] += abase_n[x] * bbase_yn;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-3.c b/gcc/testsuite/gcc.dg/graphite/id-3.c
new file mode 100644
index 00000000000..608c1c37cea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-3.c
@@ -0,0 +1,11 @@
+struct {
+}
+mmaxloc0_4_i1 ()
+{
+ int dstride;
+ int *dest;
+ int rank;
+ int n;
+ for (n = 0; n < rank; n++)
+ dest[n * dstride] = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-4.c b/gcc/testsuite/gcc.dg/graphite/id-4.c
new file mode 100644
index 00000000000..38f6738d706
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-4.c
@@ -0,0 +1,7 @@
+extern a[];
+g ()
+{
+ int i, b;
+ for (i = 0; i < 10; i++)
+ a[i] = (b == 0);
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-5.c b/gcc/testsuite/gcc.dg/graphite/id-5.c
new file mode 100644
index 00000000000..93972d79ed7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-5.c
@@ -0,0 +1,15 @@
+void matmul_i1 ()
+{
+ int *abase;
+ int aystride;
+ int x, n, count, xcount;
+ int *dest_y;
+ int *abase_n;
+ for (n = 0; n < count; n++)
+ {
+ abase_n = abase + n * aystride;
+ for (x = 0; x < xcount; x++)
+ dest_y[x] += abase_n[x];
+ }
+}
+
diff --git a/gcc/testsuite/gcc.dg/graphite/id-6.c b/gcc/testsuite/gcc.dg/graphite/id-6.c
new file mode 100644
index 00000000000..c3aab432a59
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-6.c
@@ -0,0 +1,29 @@
+#define N 10000
+void foo (int);
+int test ()
+{
+ int a[N];
+ unsigned i;
+
+ for (i = 0; i < N; i++)
+ {
+ a[i] = i + 12;
+
+ if (i == 40)
+ a[i] = i;
+ else
+ a[i] = i+1;
+
+
+ a[i] = i + 12;
+ a[i] = a[i+1];
+ a[i] += a[i+2];
+ a[i] += a[i+3];
+ a[i] += a[i+4];
+ a[i] += a[i+5];
+ a[i] += a[i+6];
+
+ }
+
+ return a[20];
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-7.c b/gcc/testsuite/gcc.dg/graphite/id-7.c
new file mode 100644
index 00000000000..9fa811d6ece
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-7.c
@@ -0,0 +1,16 @@
+void foo (int *BM_tab)
+{
+ int *BM_tab_base;
+
+ BM_tab_base = BM_tab;
+ BM_tab += 0400;
+ while (BM_tab_base != BM_tab)
+ *--BM_tab = 6;
+}
+
+int main ()
+{
+ int BM_tab[0400];
+ foo (BM_tab);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-8.c b/gcc/testsuite/gcc.dg/graphite/id-8.c
new file mode 100644
index 00000000000..1a278c16426
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-8.c
@@ -0,0 +1,14 @@
+int blah;
+foo()
+{
+ int i;
+
+ for (i=0 ; i< 7 ; i++)
+ {
+ if (i == 7 - 1)
+ blah = 0xfcc;
+ else
+ blah = 0xfee;
+ }
+ return blah;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/id-9.c b/gcc/testsuite/gcc.dg/graphite/id-9.c
new file mode 100644
index 00000000000..2199538697b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-9.c
@@ -0,0 +1,26 @@
+typedef enum
+{
+ no_op,
+ jump
+}
+re_opcode_t;
+struct
+{
+}
+byte_register_info_type ()
+{
+ char *p;
+ for (;;)
+ switch ((re_opcode_t) p++)
+ {
+ case no_op:
+ {
+ for (; (p);)
+ ;
+ for (;;)
+ ;
+ }
+ case jump:
+ (p) += 2;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
new file mode 100644
index 00000000000..bfbbb20800a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
@@ -0,0 +1,17 @@
+int a[1000][1000];
+
+int
+foo (int N)
+{
+ int j;
+ int i;
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ a[j][i] = a[j][i] + 1;
+
+ return a[N][123];
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-1.c b/gcc/testsuite/gcc.dg/graphite/interchange-1.c
new file mode 100644
index 00000000000..3d3da117d17
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-1.c
@@ -0,0 +1,20 @@
+/* Formerly known as ltrans-1.c */
+
+double u[1782225];
+int foo(int N, int *res)
+{
+ int i, j;
+ double sum = 0.0;
+
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ sum = sum + u[i + 1335 * j];
+
+ u[1336 * i] *= 2;
+ }
+ *res = sum + N;
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-2.c b/gcc/testsuite/gcc.dg/graphite/interchange-2.c
new file mode 100644
index 00000000000..4c9ed5ba800
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-2.c
@@ -0,0 +1,24 @@
+/* Formerly known as ltrans-2.c */
+
+double u[1782225];
+int foo(int N, int *res)
+{
+ unsigned int i, j;
+ double sum = 0;
+
+ /* This loop should be converted to a perfect nest and
+ interchanged. */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ sum = sum + u[i + 1335 * j];
+ if (j == N - 1)
+ u[1336 * i] *= 2;
+ }
+ }
+ *res = sum + N;
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-3.c b/gcc/testsuite/gcc.dg/graphite/interchange-3.c
new file mode 100644
index 00000000000..bd3dde671a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-3.c
@@ -0,0 +1,19 @@
+/* Formerly known as ltrans-3.c */
+
+double u[1782225];
+int foo(int N, int *res)
+{
+ unsigned int i, j;
+ double sum = 0;
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ sum = sum + u[i + 1335 * j];
+ }
+ }
+ *res = sum + N;
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-4.c b/gcc/testsuite/gcc.dg/graphite/interchange-4.c
new file mode 100644
index 00000000000..d7af311ff9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-4.c
@@ -0,0 +1,18 @@
+/* Formerly known as ltrans-4.c */
+
+double u[1782225];
+int foo(int N, int *res)
+{
+ int i, j;
+ double sum = 0;
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ sum = sum + u[i + 1335 * j];
+
+ for (i = 0; i < N; i++)
+ u[1336 * i] *= 2;
+ *res = sum + N;
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
new file mode 100644
index 00000000000..2aec56758cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
@@ -0,0 +1,16 @@
+/* Formerly known as ltrans-5.c */
+
+int foo ()
+{
+ int A[100][1111];
+ int i, j;
+
+ for( i = 0; i < 1111; i++)
+ for( j = 0; j < 100; j++)
+ A[j][i] = 5 * A[j][i];
+
+ return A[10][10];
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
new file mode 100644
index 00000000000..a10dc0c5c7c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
@@ -0,0 +1,17 @@
+/* Formerly known as ltrans-6.c */
+
+int medium_loop_interchange(int A[100][200])
+{
+ int i,j;
+
+ /* This loop should be interchanged. */
+
+ for(j = 0; j < 200; j++)
+ for(i = 0; i < 100; i++)
+ A[i][j] = A[i][j] + A[i][j];
+
+ return A[1][1];
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-7.c b/gcc/testsuite/gcc.dg/graphite/interchange-7.c
new file mode 100644
index 00000000000..7128fa32073
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-7.c
@@ -0,0 +1,14 @@
+/* Formerly known as ltrans-8.c */
+
+double foo(double *a)
+{
+ int i,j;
+ double r = 0.0;
+ for (i=0; i<100; ++i)
+ for (j=0; j<1000; ++j)
+ r += a[j*100+i];
+ return r;
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
new file mode 100644
index 00000000000..6a1e201087d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c
@@ -0,0 +1,45 @@
+int
+foo (void)
+{
+ int i, j, k, l;
+ int B[4];
+ int A[4][4][4][4];
+
+ for (l = 0; l < 4; l++)
+ {
+ for (k = 0; k < 4; k++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ for (i = 0; i < 2; i++)
+ {
+ B[i] = A[i][k][j][l] + A[3 - i][k][j][l];
+ B[3 - i] = A[i][k][j][l] - A[3 - i][k][j][l];
+ }
+ A[0][k][j][l] = B[0] + B[1];
+ A[2][k][j][l] = B[0] - B[1];
+ A[1][k][j][l] = B[3] + B[2];
+ A[3][k][j][l] = B[3] - B[2];
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ B[j] = A[i][k][j][l] + A[i][k][3 - j][l];
+ B[3 - j] = A[i][k][j][l] - A[i][k][3 - j][l];
+ }
+ A[i][k][0][l] = B[0] + B[1];
+ A[i][k][2][l] = B[0] - B[1];
+ A[i][k][1][l] = B[3] + B[2];
+ A[i][k][3][l] = B[3] - B[2];
+ }
+ }
+ }
+
+ return A[0][1][0][2];
+}
+
+/* This should not be interchanged. */
+/* { dg-final { scan-tree-dump-times "will be interchanged" 0 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-9.c b/gcc/testsuite/gcc.dg/graphite/interchange-9.c
new file mode 100644
index 00000000000..f728d6c5cdc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-9.c
@@ -0,0 +1,14 @@
+int
+foo (int *x)
+{
+ int i, j;
+ int sum = 0;
+
+ for (j = 0; j < 10000; ++j)
+ for (i = 0; i < 10000; ++i)
+ sum += x[10000 * i + j];
+ return sum;
+}
+
+/* { dg-final { scan-tree-dump-times "will be interchanged" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c
new file mode 100644
index 00000000000..2ba0c1b0f5e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */
+
+int a[100];
+
+int
+foo (int bar, int n, int k)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ if (i == k)
+ a[i] = bar;
+
+ return a[bar];
+}
+
+/* There should be no loops generated for this testcase, instead we
+ should generate the following:
+
+ | if (k >= 0 && k < n)
+ | a[k] = bar;
+
+*/
+
+/* { dg-final { scan-tree-dump-times "loop_1" 0 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
new file mode 100644
index 00000000000..5432deec61d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
@@ -0,0 +1,32 @@
+/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */
+
+int a[100];
+
+int
+foo (int bar, int n, int k)
+{
+ int i;
+
+ for (i = 0; i < n; i++)
+ if (i == k)
+ a[i] = 1;
+ else
+ a[i] = i;
+
+ return a[bar];
+}
+
+/* We should generate the following:
+
+ | for (i = 0; i < min (n, k); i++)
+ | a[i] = i;
+ | if (k >= 0 && k < n)
+ | a[k] = 1;
+ | for (i = max(k+1,0); i < n; i++)
+ | a[i] = i;
+
+*/
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-3.c b/gcc/testsuite/gcc.dg/graphite/pr35356-3.c
new file mode 100644
index 00000000000..55a771aff94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr35356-3.c
@@ -0,0 +1,40 @@
+/* { dg-options "-O2 -fgraphite-identity -fdump-tree-graphite-all" } */
+
+
+int winner, numf2s;
+double **tds;
+double d, tsum;
+
+typedef struct {
+ double y;
+} xyz;
+
+xyz *Y;
+int ti;
+
+double
+match (void)
+{
+ int tj, tresult;
+
+ for (tj = 0; tj < numf2s; tj++)
+ if (tj == winner
+ && Y[tj].y > 0)
+ tsum += tds[ti][tj] * d;
+
+ return tsum;
+}
+
+/* There should be no loops generated for this testcase, instead we
+ should generate the following:
+
+ | if (winner >= 0 && winner < numf2s && Y[winner].y > 0)
+ | tsum += tds[ti][winner] * d;
+
+ For the moment this is XFAILed as this loop is not detected as a
+ SCoP by graphite: we depend on data in one of the conditions,
+ "Y[winner].y > 0". This could be fixed when we will use predicates
+ for such cases. */
+
+/* { dg-final { scan-tree-dump-times "loop_1" 0 "graphite" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37485.c b/gcc/testsuite/gcc.dg/graphite/pr37485.c
index cf0969bac1d..ce2507b3d6c 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr37485.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr37485.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -fdump-tree-graphite-all" } */
typedef unsigned char UChar;
typedef int Int32;
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37684.c b/gcc/testsuite/gcc.dg/graphite/pr37684.c
index a9e6f5a4a59..ab5a6853316 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr37684.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr37684.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block -fdump-tree-graphite-all" } */
+/* { dg-options "-O2 -fdump-tree-graphite-all" } */
typedef struct _IO_FILE FILE;
struct _IO_marker {
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37828.c b/gcc/testsuite/gcc.dg/graphite/pr37828.c
index 0a0412d8045..df0ef7c0aa7 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr37828.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr37828.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block" } */
+/* { dg-options "-O2" } */
typedef struct foo
{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37883.c b/gcc/testsuite/gcc.dg/graphite/pr37883.c
index 2ab043adce1..9b386561c33 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr37883.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr37883.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O3 -floop-block" } */
+/* { dg-options "-O3" } */
void test_sort()
{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37928.c b/gcc/testsuite/gcc.dg/graphite/pr37928.c
index 47ad5bce0bd..3c33f3a4637 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr37928.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr37928.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O3 -floop-block" } */
+/* { dg-options "-O3" } */
int get_state(int size, int *node, int *hash)
{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37943.c b/gcc/testsuite/gcc.dg/graphite/pr37943.c
index a4b4fe5658f..4513d12c0b7 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr37943.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr37943.c
@@ -31,4 +31,3 @@ unsigned char compress(test *in)
}
/* { dg-final { cleanup-tree-dump "graphite" } } */
-
diff --git a/gcc/testsuite/gcc.dg/graphite/pr38409.c b/gcc/testsuite/gcc.dg/graphite/pr38409.c
index 41c67753426..5cdb4725dbf 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr38409.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr38409.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block" } */
+/* { dg-options "-O2" } */
typedef struct test input ;
struct test
diff --git a/gcc/testsuite/gcc.dg/graphite/pr38498.c b/gcc/testsuite/gcc.dg/graphite/pr38498.c
index c79bbad554d..d20b4ae165a 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr38498.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr38498.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block" } */
+/* { dg-options "-O2" } */
double test_vector (float **data, int rows, int cols, int vqrows,double epsilon, int maxiter,int **mean, int *map)
{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr38559.c b/gcc/testsuite/gcc.dg/graphite/pr38559.c
index 1e2ef0a4ff3..7f90a50acd0 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr38559.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr38559.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-block" } */
+/* { dg-options "-O2" } */
int test()
{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr39335.c b/gcc/testsuite/gcc.dg/graphite/pr39335.c
index c86e03ab73a..5b8fb543855 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr39335.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr39335.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-interchange" } */
+/* { dg-options "-O2" } */
typedef unsigned char byte;
typedef struct gx_device_s gx_device;
diff --git a/gcc/testsuite/gcc.dg/graphite/pr39335_1.c b/gcc/testsuite/gcc.dg/graphite/pr39335_1.c
index 257c2c99436..dfa2465e34d 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr39335_1.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr39335_1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O2 -floop-interchange" } */
+/* { dg-options "-O2" } */
void crash_me(int num1, int num2, char * in, char * out)
{
diff --git a/gcc/testsuite/gcc.dg/graphite/pr40157.c b/gcc/testsuite/gcc.dg/graphite/pr40157.c
new file mode 100644
index 00000000000..8b3d7298613
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr40157.c
@@ -0,0 +1,12 @@
+/* { dg-options "-O2 -fgraphite-identity" } */
+
+int buffer[256*256];
+int main(void)
+{
+ int *dest = buffer;
+ int x, y;
+ for(x = 0; x < 256; x++)
+ for(y = 0; y < 256; y++)
+ *dest++ = 0;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-1.c b/gcc/testsuite/gcc.dg/graphite/run-id-1.c
new file mode 100644
index 00000000000..0a0ff6ab801
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/run-id-1.c
@@ -0,0 +1,24 @@
+void abort (void);
+
+void foo (int N)
+{
+ int i, j;
+ int x[10000][10000];
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ x[i][j] = i + j + 3;
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ if (x[i][j] != i + j + 3)
+ abort ();
+}
+
+int main(void)
+{
+ foo (10000);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-0.c b/gcc/testsuite/gcc.dg/graphite/scop-0.c
index ea3ae065a0b..067e7bcffe0 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-0.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
int foo (void);
void bar (void);
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-1.c b/gcc/testsuite/gcc.dg/graphite/scop-1.c
index ed6159fb365..ba2590c1102 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-1.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-10.c b/gcc/testsuite/gcc.dg/graphite/scop-10.c
index 8aff2c74302..139f4c11494 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-10.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-10.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-11.c b/gcc/testsuite/gcc.dg/graphite/scop-11.c
index e5a0fdb3904..544b36bd744 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-11.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-11.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar ();
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-12.c b/gcc/testsuite/gcc.dg/graphite/scop-12.c
index 0c130330ccd..71d34b1db07 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-12.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-12.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar ();
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-13.c b/gcc/testsuite/gcc.dg/graphite/scop-13.c
index aa55e10f3f4..b2ca5b4008f 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-13.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-13.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar ();
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-14.c b/gcc/testsuite/gcc.dg/graphite/scop-14.c
index a707b01d450..867e293d649 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-14.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-14.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar ();
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-15.c b/gcc/testsuite/gcc.dg/graphite/scop-15.c
index 9324631e2fd..6b2c2bdc88f 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-15.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
# define EXTERN(type, array) extern type array[]
typedef unsigned char uch;
typedef unsigned short ush;
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-16.c b/gcc/testsuite/gcc.dg/graphite/scop-16.c
index d0b32f63973..d465d953b26 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-16.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-16.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-17.c b/gcc/testsuite/gcc.dg/graphite/scop-17.c
index c2fec3fccaf..dd7bdadc4e8 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-17.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-17.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-18.c b/gcc/testsuite/gcc.dg/graphite/scop-18.c
index 6264116e114..7d56cb74279 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-18.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-18.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
#define N 24
#define M 1000
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-19.c b/gcc/testsuite/gcc.dg/graphite/scop-19.c
index 3ad49971bc0..cfbf401642e 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-19.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-19.c
@@ -1,4 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
typedef unsigned int __uint32_t;
typedef __uint32_t __size_t;
typedef __size_t size_t;
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-2.c b/gcc/testsuite/gcc.dg/graphite/scop-2.c
index cf25dcdaf09..9e494f4d006 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-2.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-20.c b/gcc/testsuite/gcc.dg/graphite/scop-20.c
new file mode 100644
index 00000000000..6e71df3f0db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/scop-20.c
@@ -0,0 +1,27 @@
+void bar (void);
+
+int toto()
+{
+ int i, j, k;
+ int a[100][100];
+ int b[100];
+
+ for (i = 1; i < 100; i++)
+ {
+ for (j = 1; j < 100; j += i)
+ for (k = 1; k < 100; k++)
+ a[j][k] = a[j+1][i-1] + 2;
+
+ b[i] = b[i-1] + 2;
+
+ for (j = 1; j < 100; j++)
+ a[j][i] = a[j+1][i-1] + 2;
+
+ b[i] = b[i-1] + 2;
+ }
+
+ return a[3][5] + b[1];
+}
+
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-21.c b/gcc/testsuite/gcc.dg/graphite/scop-21.c
new file mode 100644
index 00000000000..5e3bce2da32
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/scop-21.c
@@ -0,0 +1,31 @@
+#define N 10000
+void foo (int);
+int test ()
+{
+ int a[N];
+ unsigned i;
+
+ for (i = 0; i < N; i++)
+ {
+ a[i] = i + 12;
+
+ if (i == 40)
+ a[i] = i;
+ else
+ a[i] = i+1;
+
+
+ a[i] = i + 12;
+ a[i] = a[i+1];
+ a[i] += a[i+2];
+ a[i] += a[i+3];
+ a[i] += a[i+4];
+ a[i] += a[i+5];
+ a[i] += a[i+6];
+
+ }
+
+ return a[20];
+}
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-3.c b/gcc/testsuite/gcc.dg/graphite/scop-3.c
index 1789e6b6c5a..e20bfdcb34b 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-3.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
int toto()
{
int i, j, k;
@@ -26,5 +24,5 @@ int toto()
return a[3][5] + b[1];
}
-/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-4.c b/gcc/testsuite/gcc.dg/graphite/scop-4.c
index 515c53ad592..4ab2d07f48d 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-4.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar ();
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-5.c b/gcc/testsuite/gcc.dg/graphite/scop-5.c
index 697a28ea168..4f4b45b4914 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-5.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar ();
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-6.c b/gcc/testsuite/gcc.dg/graphite/scop-6.c
index d2623204735..df208acb201 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-6.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-7.c b/gcc/testsuite/gcc.dg/graphite/scop-7.c
index 1187ce104ec..c02748fa71a 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-7.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-7.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-8.c b/gcc/testsuite/gcc.dg/graphite/scop-8.c
index 491ad372feb..3f14e347a51 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-8.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-8.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
int bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-9.c b/gcc/testsuite/gcc.dg/graphite/scop-9.c
index 871b86b8bd4..a803d921790 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-9.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-9.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
void bar (void);
int toto()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-matmult.c b/gcc/testsuite/gcc.dg/graphite/scop-matmult.c
index 61a5be1fd21..2d2dce3c160 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-matmult.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-matmult.c
@@ -1,5 +1,3 @@
-/* { dg-options "-O2 -fgraphite -fdump-tree-graphite-all" } */
-
float A[1000][1000], B[1000][1000], C[1000][1000];
/* Multiply two n x n matrices A and B and store the result in C. */
@@ -16,5 +14,5 @@ void matmult (int n)
/* This one fails because the number of iterations cannot be
determined anymore for the outermost loop. */
-/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
diff --git a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c
index 449dc19f765..a6aea4a7846 100644
--- a/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c
+++ b/gcc/testsuite/gcc.dg/optimize-bswapdi-1.c
@@ -1,4 +1,4 @@
-/* { dg-do compile { target alpha*-*-* ia64*-*-* x86_64-*-* s390x-*-* } } */
+/* { dg-do compile { target alpha*-*-* ia64*-*-* x86_64-*-* s390x-*-* powerpc*-*-* rs6000-*-* } } */
/* { dg-require-effective-target stdint_types } */
/* { dg-require-effective-target lp64 } */
/* { dg-options "-O2 -fdump-tree-bswap" } */
diff --git a/gcc/testsuite/gcc.dg/overflow-warn-8.c b/gcc/testsuite/gcc.dg/overflow-warn-8.c
new file mode 100644
index 00000000000..43ecda0a56e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/overflow-warn-8.c
@@ -0,0 +1,23 @@
+#include <limits.h>
+
+void foo (int j)
+{
+ int i1 = (int)(double)1.0 + INT_MAX; /* { dg-warning "integer overflow" } */
+ int i2 = (int)(double)1 + INT_MAX; /* { dg-warning "integer overflow" } */
+ int i3 = 1 + INT_MAX; /* { dg-warning "integer overflow" } */
+ int i4 = +1 + INT_MAX; /* { dg-warning "integer overflow" } */
+ int i5 = (int)((double)1.0 + INT_MAX);
+ int i6 = (double)1.0 + INT_MAX; /* { dg-warning "overflow in implicit constant" } */
+ int i7 = 0 ? (int)(double)1.0 + INT_MAX : 1;
+ int i8 = 1 ? 1 : (int)(double)1.0 + INT_MAX;
+ int i9 = j ? (int)(double)1.0 + INT_MAX : 1; /* { dg-warning "integer overflow" } */
+ unsigned int i10 = 0 ? (int)(double)1.0 + INT_MAX : 9U;
+ unsigned int i11 = 1 ? 9U : (int)(double)1.0 + INT_MAX;
+ unsigned int i12 = j ? (int)(double)1.0 + INT_MAX : 9U; /* { dg-warning "integer overflow" } */
+ int i13 = 1 || (int)(double)1.0 + INT_MAX < 0;
+ int i14 = 0 && (int)(double)1.0 + INT_MAX < 0;
+ int i15 = 0 || (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
+ int i16 = 1 && (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
+ int i17 = j || (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
+ int i18 = j && (int)(double)1.0 + INT_MAX < 0; /* { dg-warning "integer overflow" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr40971.c b/gcc/testsuite/gcc.dg/pr40971.c
new file mode 100644
index 00000000000..31dfd5e1398
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr40971.c
@@ -0,0 +1,23 @@
+/* PR target/40971 */
+/* { dg-do compile } */
+/* { dg-options "-O -fstack-protector -fno-strict-aliasing" } */
+/* { dg-require-effective-target fstack_protector } */
+
+extern void bar (char *);
+
+void
+foo (int f, long a)
+{
+ {
+ char d[32768];
+ bar (d);
+ }
+ double b = f;
+ while (a)
+ {
+ char c[sizeof (double)];
+ __builtin_memcpy (c, &b, sizeof (c));
+ if (*(double *) c != 2.0)
+ break;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr41033.c b/gcc/testsuite/gcc.dg/pr41033.c
new file mode 100644
index 00000000000..5043be2d119
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr41033.c
@@ -0,0 +1,24 @@
+/* { dg-options "-O1 -fno-strict-aliasing" } */
+/* PR rtl-optimization/41033 */
+
+struct X {
+ int i;
+ int j;
+};
+
+int foo(struct X *p, struct X *q)
+{
+ p->j = 1;
+ q->i = 0;
+ return p->j;
+}
+
+extern void abort (void);
+
+int main()
+{
+ struct X x;
+ if (foo (&x, (struct X *)&x.j) != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pragma-re-1.c b/gcc/testsuite/gcc.dg/pragma-re-1.c
index 9b9edadc9fe..78312e57054 100644
--- a/gcc/testsuite/gcc.dg/pragma-re-1.c
+++ b/gcc/testsuite/gcc.dg/pragma-re-1.c
@@ -1,4 +1,3 @@
-/* { dg-do compile { target *-*-solaris* } } */
/* { dg-final { scan-assembler "bar" } } */
/* { dg-final { scan-assembler-not "foo" } } */
diff --git a/gcc/testsuite/gcc.dg/pragma-re-2.c b/gcc/testsuite/gcc.dg/pragma-re-2.c
index e86bb87c818..ee7140133e0 100644
--- a/gcc/testsuite/gcc.dg/pragma-re-2.c
+++ b/gcc/testsuite/gcc.dg/pragma-re-2.c
@@ -1,4 +1,3 @@
-/* { dg-do compile { target *-*-solaris* } } */
#pragma redefine_extname /* { dg-warning "malformed" } */
#pragma redefine_extname foo /* { dg-warning "malformed" } */
diff --git a/gcc/testsuite/gcc.dg/pragma-re-3.c b/gcc/testsuite/gcc.dg/pragma-re-3.c
index 4a73c414b92..3885fe8f04b 100644
--- a/gcc/testsuite/gcc.dg/pragma-re-3.c
+++ b/gcc/testsuite/gcc.dg/pragma-re-3.c
@@ -1,4 +1,3 @@
-/* { dg-do link { target *-*-solaris* } } */
#pragma redefine_extname f1 f
#pragma redefine_extname g1 g
diff --git a/gcc/testsuite/gcc.dg/pragma-re-4.c b/gcc/testsuite/gcc.dg/pragma-re-4.c
index 9b5a26d2062..627e0b6e0c3 100644
--- a/gcc/testsuite/gcc.dg/pragma-re-4.c
+++ b/gcc/testsuite/gcc.dg/pragma-re-4.c
@@ -2,7 +2,6 @@
/* Contributed by Carlos O'Donell on 2006-01-27 */
/* Origin: Carlos O'Donell <carlos@codesourcery.com> */
-/* { dg-do compile { target *-*-solaris* } } */
/* { dg-final { scan-assembler "_foo" } } */
/* { dg-final { scan-assembler-not "_foo64" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-math-7.c b/gcc/testsuite/gcc.dg/torture/builtin-math-7.c
new file mode 100644
index 00000000000..37be4838005
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/builtin-math-7.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2009 Free Software Foundation.
+
+ Verify that folding of complex mul and div work correctly.
+
+ Origin: Kaveh R. Ghazi, August 13, 2009. */
+
+/* { dg-do run } */
+/* { dg-require-effective-target mpc } */
+
+extern void link_error(int);
+
+/* Evaluate this expression at compile-time. */
+#define COMPILETIME_TESTIT(TYPE,X,OP,Y,RES) do { \
+ if ((_Complex TYPE)(X) OP (_Complex TYPE)(Y) != (_Complex TYPE)(RES)) \
+ link_error(__LINE__); \
+} while (0)
+
+/* Evaluate this expression at runtime. */
+#define RUNTIME_TESTIT(TYPE,X,OP,Y,RES) do { \
+ volatile _Complex TYPE foo = (_Complex TYPE)(X); \
+ foo OP##= (_Complex TYPE)(Y); \
+ if (foo != (_Complex TYPE)(RES)) __builtin_abort(); \
+} while (0)
+
+/* Evaluate this expression at compile-time and runtime. */
+#define TESTIT(TYPE,X,OP,Y,RES) do { \
+ COMPILETIME_TESTIT(TYPE,X,OP,Y,RES); \
+ RUNTIME_TESTIT(TYPE,X,OP,Y,RES); \
+} while (0)
+
+/* Either the real or imaginary parts should be infinity. */
+#define TEST_ONE_PART_INF(VAL) do { \
+ if (! __builtin_isinf(__real (VAL)) \
+ && ! __builtin_isinf(__imag (VAL))) \
+ __builtin_abort(); \
+} while (0)
+
+int main()
+{
+ /* Test some regular finite values. */
+ TESTIT (double, 3.+4.i, *, 2, 6+8i);
+ TESTIT (double, 3.+4.i, /, 2, 1.5+2i);
+ TESTIT (int, 3+4i, *, 2, 6+8i);
+ RUNTIME_TESTIT (int, 3+4i, /, 2, 1+2i);
+
+ TESTIT (double, 3.+4.i, *, 2+5i, -14+23i);
+ TESTIT (double, 3.+4.i, /, 5i, .8-.6i);
+ TESTIT (int, 3+4i, *, 2+5i, -14+23i);
+ RUNTIME_TESTIT (int, 30+40i, /, 5i, 8-6i);
+
+ /* Test that we don't overflow. */
+ TESTIT (double,
+ (__DBL_MAX__ * 0.5 + __DBL_MAX__ * 0.5i),
+ /,
+ (__DBL_MAX__ * 0.25 + __DBL_MAX__ * 0.25i),
+ 2);
+
+ /* Test for accuracy. */
+ COMPILETIME_TESTIT (double,
+ (1 + __DBL_EPSILON__ + 1i),
+ *,
+ (1 - __DBL_EPSILON__ + 1i),
+ -4.93038065763132378382330353301741393545754021943139377981e-32+2i);
+
+ /* This becomes (NaN + iInf). */
+#define VAL1 ((_Complex double)__builtin_inf() * 1i)
+
+ /* Test some C99 Annex G special cases. */
+ TEST_ONE_PART_INF ((VAL1) * (VAL1));
+ TEST_ONE_PART_INF ((_Complex double)1 / (_Complex double)0);
+ TEST_ONE_PART_INF ((VAL1) / (_Complex double)1);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-power-1.c b/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
index a63ebf55423..d1403c46c94 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-power-1.c
@@ -77,9 +77,9 @@ void test(double d1, double d2, double d3,
/* Test pow(pow(x,y),z) -> pow(x,y*z). */
#define POW_POW \
extern void link_failure_pow_pow(void); \
- if (pow(pow(d1, d2), d3) != pow(d1,d2*d3) \
- || powf(powf(f1,f2),f3) != powf(f1,f2*f3) \
- || powl(powl(ld1,ld2),ld3) != powl(ld1,ld2*ld3)) \
+ if (pow(pow(fabs(d1), d2), d3) != pow(fabs(d1),d2*d3) \
+ || powf(powf(fabs(f1),f2),f3) != powf(fabs(f1),f2*f3) \
+ || powl(powl(fabs(ld1),ld2),ld3) != powl(fabs(ld1),ld2*ld3)) \
link_failure_pow_pow()
POW_POW;
diff --git a/gcc/testsuite/gcc.dg/torture/pr41094.c b/gcc/testsuite/gcc.dg/torture/pr41094.c
new file mode 100644
index 00000000000..2a4e9616cbf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr41094.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-ffast-math" } */
+
+#include <math.h>
+
+extern void abort (void);
+
+double foo(void)
+{
+ double x = -4.0;
+ return pow (x * x, 0.25);
+}
+
+int main()
+{
+ if (foo() != 2.0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20050314-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20050314-1.c
index 04f202835df..2ba1ee047f1 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20050314-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20050314-1.c
@@ -17,5 +17,5 @@ void xxx (void)
/* Store motion may be applied to the assignment to a[k], since sinf
cannot read nor write the memory. */
-/* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Moving statement" 1 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-32.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-32.c
index 945ee2fcb8e..3a92a08f8da 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-32.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-32.c
@@ -42,5 +42,5 @@ void test3(struct a *A)
}
}
-/* { dg-final { scan-tree-dump-times "Executing store motion of" 3 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 3 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-33.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-33.c
index 6b9b67f3e33..3ee4e3ce04d 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-33.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-33.c
@@ -36,5 +36,5 @@ void test5(struct a *A, unsigned b)
}
}
-/* { dg-final { scan-tree-dump-times "Executing store motion of" 4 "lim" { xfail lp64 } } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 4 "lim1" { xfail lp64 } } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-34.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-34.c
index 4a0d1eaad56..5da804f8b89 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-34.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-34.c
@@ -17,5 +17,5 @@ void f (int n)
}
-/* { dg-final { scan-tree-dump-times "Executing store motion of r" 6 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of r" 6 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-35.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-35.c
index e1bdde24049..4716e962586 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-35.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-35.c
@@ -60,6 +60,6 @@ void test4(struct a *A, unsigned long b)
}
}
/* long index not hoisted for avr target PR 36561 */
-/* { dg-final { scan-tree-dump-times "Executing store motion of" 8 "lim" { xfail { "avr-*-*" } } } } */
-/* { dg-final { scan-tree-dump-times "Executing store motion of" 6 "lim" { target { "avr-*-*" } } } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 8 "lim1" { xfail { "avr-*-*" } } } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of" 6 "lim1" { target { "avr-*-*" } } } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c
index a4597b196d7..e9e8d7d23ac 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-7.c
@@ -31,5 +31,5 @@ int xxx (void)
Calls to cst_fun2 and pure_fun2 should not be, since calling
with k = 0 may be invalid. */
-/* { dg-final { scan-tree-dump-times "Moving statement" 3 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Moving statement" 3 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr23109.c b/gcc/testsuite/gcc.dg/tree-ssa/pr23109.c
index e60b2f09f10..39add724e89 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr23109.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr23109.c
@@ -29,8 +29,8 @@ int main()
/* LIM only performs the transformation in the no-trapping-math case. In
the future we will do it for trapping-math as well in recip, check that
this is not wrongly optimized. */
-/* { dg-final { scan-tree-dump-not "reciptmp" "lim" } } */
+/* { dg-final { scan-tree-dump-not "reciptmp" "lim1" } } */
/* { dg-final { scan-tree-dump-not "reciptmp" "recip" } } */
/* { dg-final { cleanup-tree-dump "recip" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr32964.c b/gcc/testsuite/gcc.dg/tree-ssa/pr32964.c
new file mode 100644
index 00000000000..18e73f939cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr32964.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
+
+union A
+{
+ float a;
+};
+
+float t(float a)
+{
+ union A a1, a2, a3;
+ int i;
+
+ a1.a = a;
+ for(i = 0; i<100; i++)
+ {
+ a2 = a1;
+ a2.a += a;
+ a1 = a2;
+ }
+ a3 = a1;
+ return a3.a;
+}
+
+/* { dg-final { scan-tree-dump-times "union" 0 "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-2.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-2.c
index b76ad98fa88..ec824653d5f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/restrict-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-2.c
@@ -10,5 +10,5 @@ void foo (float * __restrict__ a, float * __restrict__ b, int n, int j)
/* We should move the RHS of the store out of the loop. */
-/* { dg-final { scan-tree-dump-times "Moving statement" 11 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "Moving statement" 11 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-3.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-3.c
index 08faafada25..90f62aa4dfc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/restrict-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-3.c
@@ -14,5 +14,5 @@ void f(int * __restrict__ r,
/* We should apply store motion to the store to *r. */
-/* { dg-final { scan-tree-dump "Executing store motion of \\\*r" "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump "Executing store motion of \\\*r" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-27.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-27.c
new file mode 100644
index 00000000000..c2796345471
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-27.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-ccp1" } */
+
+#include <string.h>
+
+char c[10];
+
+void
+f1 ()
+{
+ const char *p = "123456";
+ memcpy (c, p, 6);
+}
+
+void
+f2 ()
+{
+ const char *p = "12345678";
+ p += 2;
+ memcpy (c, p, 6);
+}
+
+/* { dg-final { scan-tree-dump-times "memcpy\[^\n\]*123456" 2 "ccp1" } } */
+/* { dg-final { cleanup-tree-dump "ccp1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c
index db36ff02cb2..aa40d443bc7 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-1.c
@@ -18,5 +18,5 @@ quantum_toffoli (int control1, int control2, int target,
}
}
-/* { dg-final { scan-tree-dump-times "1 <<" 3 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "1 <<" 3 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c
index 7b18b1c0550..9274261cb21 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-2.c
@@ -18,5 +18,5 @@ int size)
}
}
-/* { dg-final { scan-tree-dump-times "1 <<" 3 "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump-times "1 <<" 3 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c
index 91956017898..85800588dc2 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-3.c
@@ -9,6 +9,6 @@ void foo(int n)
global.y += global.x*global.x;
}
-/* { dg-final { scan-tree-dump "Executing store motion of global.y" "lim" } } */
-/* { dg-final { scan-tree-dump "Moving statement.*global.x.*out of loop 1" "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump "Executing store motion of global.y" "lim1" } } */
+/* { dg-final { scan-tree-dump "Moving statement.*global.x.*out of loop 1" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-6.c
index 0da57aa087d..e29f50c7117 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-6.c
@@ -10,5 +10,5 @@ void foo(void)
y[j] = y[j] + a[i][j] * x[i];
}
-/* { dg-final { scan-tree-dump "Executing store motion of y" "lim" } } */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { scan-tree-dump "Executing store motion of y" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/structopt-1.c b/gcc/testsuite/gcc.dg/tree-ssa/structopt-1.c
index bc69c4fe0d7..75183052e4b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/structopt-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/structopt-1.c
@@ -10,6 +10,6 @@ int foo() {
global.y += global.x*global.x;
}
-/* { dg-final { scan-tree-dump-times "Executing store motion of global.y" 1 "lim" } } */
+/* { dg-final { scan-tree-dump-times "Executing store motion of global.y" 1 "lim1" } } */
/* XXX: We should also check for the load motion of global.x, but there is no easy way to do this. */
-/* { dg-final { cleanup-tree-dump "lim" } } */
+/* { dg-final { cleanup-tree-dump "lim\[1-2\]" } } */
diff --git a/gcc/testsuite/gcc.dg/ucnid-11.c b/gcc/testsuite/gcc.dg/ucnid-11.c
index b4063306857..056017ee988 100644
--- a/gcc/testsuite/gcc.dg/ucnid-11.c
+++ b/gcc/testsuite/gcc.dg/ucnid-11.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-xfail-if "" { powerpc-ibm-aix* *-*-solaris2.* } { "*" } { "" } } */
+/* { dg-skip-if "-fdata-sections not supported" { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */
/* { dg-options "-std=c99 -fextended-identifiers -fdata-sections" } */
#include "ucnid-3.c"
diff --git a/gcc/testsuite/gcc.dg/ucnid-12.c b/gcc/testsuite/gcc.dg/ucnid-12.c
index 6c8789236b0..3d84ad0d3e0 100644
--- a/gcc/testsuite/gcc.dg/ucnid-12.c
+++ b/gcc/testsuite/gcc.dg/ucnid-12.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-xfail-if "" { powerpc-ibm-aix* *-*-solaris2.* } { "*" } { "" } } */
+/* { dg-skip-if "-ffunction-sections not supported" { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } { "*" } { "" } } */
/* { dg-options "-std=c99 -fextended-identifiers -ffunction-sections" } */
#include "ucnid-4.c"
diff --git a/gcc/testsuite/gcc.dg/uninit-6-O0.c b/gcc/testsuite/gcc.dg/uninit-6-O0.c
index f4588305ffa..e3fefe5e1c5 100644
--- a/gcc/testsuite/gcc.dg/uninit-6-O0.c
+++ b/gcc/testsuite/gcc.dg/uninit-6-O0.c
@@ -39,7 +39,7 @@ make_something(int a, int b, int c)
rv = malloc (sizeof (struct tree));
rv->car = 0;
- APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" } */
+ APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */
APPEND(rv, field, PTR_T, b);
APPEND(rv, field, INTEGER_T, c);
diff --git a/gcc/testsuite/gcc.dg/uninit-6.c b/gcc/testsuite/gcc.dg/uninit-6.c
index 009e124fccf..b0f2083ab4b 100644
--- a/gcc/testsuite/gcc.dg/uninit-6.c
+++ b/gcc/testsuite/gcc.dg/uninit-6.c
@@ -39,7 +39,7 @@ make_something(int a, int b, int c)
rv = malloc (sizeof (struct tree));
rv->car = 0;
- APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" } */
+ APPEND(rv, field, INTEGER_T, a); /* { dg-bogus "field" "uninitialized variable warning" { xfail *-*-* } } */
APPEND(rv, field, PTR_T, b);
APPEND(rv, field, INTEGER_T, c);
diff --git a/gcc/testsuite/gcc.dg/uninit-pr40943.c b/gcc/testsuite/gcc.dg/uninit-pr40943.c
new file mode 100644
index 00000000000..2b6e9131cb1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr40943.c
@@ -0,0 +1,10 @@
+/* PR middle-end/40943 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wuninitialized" } */
+
+void
+foo (void)
+{
+ int *p;
+ *p = 3; /* { dg-warning "is used uninitialized" } */
+}
diff --git a/gcc/testsuite/gcc.dg/vect/O1-pr41008.c b/gcc/testsuite/gcc.dg/vect/O1-pr41008.c
new file mode 100644
index 00000000000..bbdea127ce8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/O1-pr41008.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+double heating[2][2];
+
+void foo (int, int);
+
+void map_do()
+{
+ int jsav, ksav, k, j;
+
+ for(k = 0; k < 2; k++)
+ for(j = 0; j < 2; j++)
+ if (heating[k][j] > 0.)
+ {
+ jsav = j;
+ ksav = k;
+ }
+
+ foo (jsav, ksav);
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/section-anchors-nest-1.c b/gcc/testsuite/gcc.dg/vect/aligned-section-anchors-nest-1.c
index 39a24ccaf22..670e45491c3 100644
--- a/gcc/testsuite/gcc.dg/vect/section-anchors-nest-1.c
+++ b/gcc/testsuite/gcc.dg/vect/aligned-section-anchors-nest-1.c
@@ -1,7 +1,6 @@
/* { dg-do compile } */
/* { dg-require-effective-target section_anchors } */
/* { dg-require-effective-target vect_int } */
-/* { dg-options "-O2 -ftree-vectorize -fsection-anchors -fno-vect-cost-model -fdump-ipa-increase_alignment" } */
#include <stdarg.h>
#include "tree-vect.h"
@@ -32,4 +31,4 @@ int *foo(void)
}
/* { dg-final { scan-ipa-dump-times "Increasing alignment of decl" 3 "increase_alignment" } } */
-/* { dg -finalfoo { cleanup-ipa-dump "increase_alignment" } } */
+/* { dg-final { cleanup-ipa-dump "increase_alignment" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c b/gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c
index ea9b3837c90..ae7aea25ebd 100644
--- a/gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c
+++ b/gcc/testsuite/gcc.dg/vect/dump-tree-dceloop-pr26359.c
@@ -11,6 +11,6 @@ foo () {
}
}
-/* { dg-final { scan-tree-dump-times "Deleting : vect_" 0 "dceloop2" } } */
-/* { dg-final { cleanup-tree-dump "dceloop\[1-2\]" } } */
+/* { dg-final { scan-tree-dump-times "Deleting : vect_" 0 "dceloop3" } } */
+/* { dg-final { cleanup-tree-dump "dceloop\[1-3\]" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp
index 149bf0f5a31..54e7cb27968 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -190,6 +190,12 @@ lappend DEFAULT_VECTCFLAGS "-fsection-anchors"
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/section-anchors-*.\[cS\]]] \
"" $DEFAULT_VECTCFLAGS
+# alignment-sensitive -fsection-anchors tests
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fsection-anchors -fdump-ipa-increase_alignment"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/aligned-section-anchors-*.\[cS\]]] \
+ "" $DEFAULT_VECTCFLAGS
+
# -fno-section-anchors tests
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
lappend DEFAULT_VECTCFLAGS "-fno-section-anchors"
diff --git a/gcc/testsuite/gcc.dg/vector-4.c b/gcc/testsuite/gcc.dg/vector-4.c
index 7964a881f4a..9fa60ded8d1 100644
--- a/gcc/testsuite/gcc.dg/vector-4.c
+++ b/gcc/testsuite/gcc.dg/vector-4.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-options "-fno-common" { target { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } } } */
#define vector __attribute__((vector_size(4*sizeof(int)) ))
vector int a, b, c;
diff --git a/gcc/testsuite/gcc.dg/vmx/vmx.exp b/gcc/testsuite/gcc.dg/vmx/vmx.exp
index 8a842e12f5d..85c88d8a392 100644
--- a/gcc/testsuite/gcc.dg/vmx/vmx.exp
+++ b/gcc/testsuite/gcc.dg/vmx/vmx.exp
@@ -31,7 +31,7 @@ if {![istarget powerpc*-*-*]
# nothing but extensions.
global DEFAULT_VMXCFLAGS
if ![info exists DEFAULT_VMXCFLAGS] then {
- set DEFAULT_VMXCFLAGS "-maltivec -mabi=altivec -std=gnu99"
+ set DEFAULT_VMXCFLAGS "-maltivec -mabi=altivec -std=gnu99 -mno-vsx"
}
# If the target system supports AltiVec instructions, the default action
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp b/gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp
new file mode 100644
index 00000000000..fcc4333464c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/aapcs.exp
@@ -0,0 +1,35 @@
+# Copyright (C) 1997, 2004, 2006, 2007 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Exit immediately if this isn't an ARM target.
+if ![istarget arm*-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
+ "" ""
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/abitest.h b/gcc/testsuite/gcc.target/arm/aapcs/abitest.h
new file mode 100644
index 00000000000..7b7d0e24fac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/abitest.h
@@ -0,0 +1,122 @@
+#define IN_FRAMEWORK
+
+#ifdef VFP
+#define D0 0
+#define D1 8
+#define D2 16
+#define D3 24
+#define D4 32
+#define D5 40
+#define D6 48
+#define D7 56
+
+#define S0 64
+#define S1 68
+#define S2 72
+#define S3 76
+#define S4 80
+#define S5 84
+#define S6 88
+#define S7 92
+#define S8 86
+#define S9 100
+#define S10 104
+#define S11 108
+#define S12 112
+#define S13 116
+#define S14 120
+#define S15 124
+
+#define R0 128
+#define R1 132
+#define R2 136
+#define R3 140
+
+#define STACK 144
+
+#else
+
+#define R0 0
+#define R1 4
+#define R2 8
+#define R3 12
+
+#define STACK 16
+
+#endif
+
+extern void abort (void);
+
+__attribute__((naked)) void dumpregs () __asm("myfunc");
+__attribute__((naked)) void dumpregs ()
+{
+ asm(
+ "mov ip, sp\n\t"
+ "stmfd sp!, {r0-r3}\n\t"
+#ifdef VFP
+ "fstmdbs sp!, {s0-s15}\n\t"
+ "fstmdbd sp!, {d0-d7}\n\t"
+#endif
+ "mov r0, sp\n\t"
+ "stmfd sp!, {ip, r14}\n\t"
+ "bl testfunc\n\t"
+ "ldmfd sp!, {r0, r14}\n\t"
+ "mov sp, r0\n\t"
+ "bx lr");
+}
+
+
+#define LAST_ARG(type,val,offset) { type __x = val; if (memcmp(&__x, stack+offset, sizeof(type)) != 0) abort(); }
+#define ARG(type,val,offset) LAST_ARG(type, val, offset)
+#define ANON(type,val,offset) LAST_ARG(type, val, offset)
+#define LAST_ANON(type,val,offset) LAST_ARG(type, val, offset)
+#define DOTS
+
+void testfunc(char* stack)
+{
+#include TESTFILE
+ return;
+}
+
+#undef LAST_ARG
+#undef ARG
+#undef DOTS
+#undef ANON
+#undef LAST_ANON
+#define LAST_ARG(type,val,offset) type
+#define ARG(type,val,offset) LAST_ARG(type, val, offset),
+#define DOTS ...
+#define ANON(type,val, offset)
+#define LAST_ANON(type,val, offset)
+
+#ifndef MYFUNCTYPE
+#define MYFUNCTYPE void
+#endif
+
+#ifndef PCSATTR
+#define PCSATTR
+#endif
+
+MYFUNCTYPE myfunc(
+#include TESTFILE
+) PCSATTR;
+
+#undef LAST_ARG
+#undef ARG
+#undef DOTS
+#undef ANON
+#undef LAST_ANON
+#define LAST_ARG(type,val,offset) val
+#define ARG(type,val,offset) LAST_ARG(type, val, offset),
+#define DOTS
+#define LAST_ANON(type,val,offset) LAST_ARG(type, val, offset)
+#define ANON(type,val,offset) LAST_ARG(type, val, offset),
+
+
+int main()
+{
+ myfunc(
+#include TESTFILE
+);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp1.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp1.c
new file mode 100644
index 00000000000..380a3244dd4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp1.c
@@ -0,0 +1,17 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp1.c"
+#include "abitest.h"
+
+#else
+ ARG(int, 4, R0)
+ ARG(double, 4.0, D0)
+ LAST_ARG(int, 3, R1)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp10.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp10.c
new file mode 100644
index 00000000000..58561aac9fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp10.c
@@ -0,0 +1,38 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp10.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#include "abitest.h"
+#else
+ /* A variadic function passes using the base ABI */
+ ARG(double, 11.0, R0)
+ DOTS
+ ANON(struct z, a, R2)
+ ANON(struct z, b, STACK+24)
+ LAST_ANON(double, 0.5, STACK+56)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp11.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp11.c
new file mode 100644
index 00000000000..2c143bafb06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp11.c
@@ -0,0 +1,39 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp11.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#define MYFUNCTYPE struct y
+
+#include "abitest.h"
+#else
+ ARG(int, 7, R1)
+ ARG(struct y, v, R2)
+ ARG(struct z, a, D0)
+ ARG(struct z, b, D4)
+ LAST_ARG(double, 0.5, STACK+8)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp12.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp12.c
new file mode 100644
index 00000000000..7b6b4cd54aa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp12.c
@@ -0,0 +1,38 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp12.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#include "abitest.h"
+#else
+ ARG(int, 7, R0)
+ ARG(struct y, v, R1)
+ ARG(struct z, a, D0)
+ ARG(double, 1.0, D4)
+ ARG(struct z, b, STACK+8)
+ LAST_ARG(double, 0.5, STACK+40)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp13.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp13.c
new file mode 100644
index 00000000000..ca0c5be7c3a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp13.c
@@ -0,0 +1,39 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp13.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#include "abitest.h"
+#else
+ ARG(int, 7, R0)
+ ARG(int, 9, R1)
+ ARG(struct z, a, D0)
+ ARG(double, 1.0, D4)
+ ARG(struct z, b, STACK)
+ ARG(int, 4, R2)
+ LAST_ARG(double, 0.5, STACK+32)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp14.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp14.c
new file mode 100644
index 00000000000..b5131d7fcff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp14.c
@@ -0,0 +1,24 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp14.c"
+
+#include "abitest.h"
+#else
+ ARG(double, 1.0, D0)
+ ARG(double, 2.0, D1)
+ ARG(double, 3.0, D2)
+ ARG(double, 4.0, D3)
+ ARG(double, 5.0, D4)
+ ARG(double, 6.0, D5)
+ ARG(double, 7.0, D6)
+ ARG(double, 8.0, D7)
+ ARG(double, 9.0, STACK)
+ LAST_ARG(double, 10.0, STACK+8)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp15.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp15.c
new file mode 100644
index 00000000000..d5a75b5b8ff
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp15.c
@@ -0,0 +1,20 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp15.c"
+
+#define PCSATTR __attribute__((pcs("aapcs")))
+
+#include "abitest.h"
+#else
+ ARG(double, 1.0, R0)
+ ARG(double, 2.0, R2)
+ ARG(double, 3.0, STACK)
+ LAST_ARG(double, 4.0, STACK+8)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp16.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp16.c
new file mode 100644
index 00000000000..9815994ef8b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp16.c
@@ -0,0 +1,22 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp16.c"
+
+#define PCSATTR __attribute__((pcs("aapcs")))
+
+#include "abitest.h"
+#else
+ ARG(float, 1.0f, R0)
+ ARG(float, 2.0f, R1)
+ ARG(float, 3.0f, R2)
+ ARG(float, 4.0f, R3)
+ ARG(float, 5.0f, STACK)
+ LAST_ARG(float, 5.0f, STACK+4)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp17.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp17.c
new file mode 100644
index 00000000000..d02160c860b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp17.c
@@ -0,0 +1,20 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp17.c"
+
+#define PCSATTR __attribute__((pcs("aapcs")))
+
+#include "abitest.h"
+#else
+ ARG(float, 1.0f, R0)
+ ARG(double, 2.0, R2)
+ ARG(float, 3.0f, STACK)
+ LAST_ARG(double, 4.0, STACK+8)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp2.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp2.c
new file mode 100644
index 00000000000..a2db349e4a2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp2.c
@@ -0,0 +1,19 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp2.c"
+#include "abitest.h"
+
+#else
+ ARG(float, 1.0f, S0)
+ ARG(double, 4.0, D1)
+ ARG(float, 2.0f, S1)
+ ARG(double, 5.0, D2)
+ LAST_ARG(int, 3, R0)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp3.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp3.c
new file mode 100644
index 00000000000..807292b5721
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp3.c
@@ -0,0 +1,21 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp3.c"
+
+__complex__ x = 1.0+2.0i;
+
+#include "abitest.h"
+#else
+ ARG(float, 1.0f, S0)
+ ARG(__complex__ double, x, D1)
+ ARG(float, 2.0f, S1)
+ ARG(double, 5.0, D3)
+ LAST_ARG(int, 3, R0)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp4.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp4.c
new file mode 100644
index 00000000000..8bb2a5678b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp4.c
@@ -0,0 +1,20 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp4.c"
+
+__complex__ float x = 1.0f + 2.0fi;
+#include "abitest.h"
+#else
+ ARG(float, 1.0f, S0)
+ ARG(__complex__ float, x, S1)
+ ARG(float, 2.0f, S3)
+ ARG(double, 5.0, D2)
+ LAST_ARG(int, 3, R0)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp5.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp5.c
new file mode 100644
index 00000000000..0adc17fde11
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp5.c
@@ -0,0 +1,30 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp5.c"
+
+__complex__ float x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+#include "abitest.h"
+#else
+ ARG(float, 1.0f, S0)
+ ARG(__complex__ float, x, S1)
+ ARG(float, 2.0f, S3)
+ ARG(double, 5.0, D2)
+ ARG(struct y, v, R0)
+ LAST_ARG(int, 3, STACK)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp6.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp6.c
new file mode 100644
index 00000000000..6d8df0d62ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp6.c
@@ -0,0 +1,30 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp6.c"
+
+__complex__ float x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+#include "abitest.h"
+#else
+ ARG(struct y, v, R0)
+ ARG(float, 1.0f, S0)
+ ARG(__complex__ float, x, S1)
+ ARG(float, 2.0f, S3)
+ ARG(double, 5.0, D2)
+ LAST_ARG(int, 3, STACK)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp7.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp7.c
new file mode 100644
index 00000000000..de4bdb4c421
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp7.c
@@ -0,0 +1,37 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp7.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#include "abitest.h"
+#else
+ ARG(struct z, a, D0)
+ ARG(struct z, b, D4)
+ ARG(double, 0.5, STACK)
+ ARG(int, 7, R0)
+ LAST_ARG(struct y, v, STACK+8)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp8.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp8.c
new file mode 100644
index 00000000000..7865844ebbc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp8.c
@@ -0,0 +1,37 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp8.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#include "abitest.h"
+#else
+ ARG(int, 7, R0)
+ ARG(struct y, v, R1)
+ ARG(struct z, a, D0)
+ ARG(struct z, b, D4)
+ LAST_ARG(double, 0.5, STACK+8)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/aapcs/vfp9.c b/gcc/testsuite/gcc.target/arm/aapcs/vfp9.c
new file mode 100644
index 00000000000..f9aa2960ca8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/aapcs/vfp9.c
@@ -0,0 +1,38 @@
+/* Test AAPCS layout (VFP variant) */
+
+/* { dg-do run { target arm*-*-eabi* } } */
+/* { dg-require-effective-target arm_hard_vfp_ok } */
+/* { dg-require-effective-target arm32 } */
+/* { dg-options "-O -mfpu=vfp -mfloat-abi=hard" } */
+
+#ifndef IN_FRAMEWORK
+#define VFP
+#define TESTFILE "vfp9.c"
+
+__complex__ x = 1.0+2.0i;
+
+struct y
+{
+ int p;
+ int q;
+ int r;
+ int s;
+} v = { 1, 2, 3, 4 };
+
+struct z
+{
+ double x[4];
+};
+
+struct z a = { 5.0, 6.0, 7.0, 8.0 };
+struct z b = { 9.0, 10.0, 11.0, 12.0 };
+
+#include "abitest.h"
+#else
+ /* A variadic function passes using the base ABI */
+ ARG(int, 7, R0)
+ DOTS
+ ANON(struct z, a, R2)
+ ANON(struct z, b, STACK+24)
+ LAST_ANON(double, 0.5, STACK+56)
+#endif
diff --git a/gcc/testsuite/gcc.target/arm/eabi1.c b/gcc/testsuite/gcc.target/arm/eabi1.c
index e88ba021fdc..c90f5ff0856 100644
--- a/gcc/testsuite/gcc.target/arm/eabi1.c
+++ b/gcc/testsuite/gcc.target/arm/eabi1.c
@@ -30,43 +30,48 @@
#include <stdlib.h>
#include <math.h>
-#define decl_float(code, type) \
- extern type __aeabi_ ## code ## add (type, type); \
- extern type __aeabi_ ## code ## div (type, type); \
- extern type __aeabi_ ## code ## mul (type, type); \
- extern type __aeabi_ ## code ## neg (type); \
- extern type __aeabi_ ## code ## rsub (type, type); \
- extern type __aeabi_ ## code ## sub (type, type); \
- extern int __aeabi_ ## code ## cmpeq (type, type); \
- extern int __aeabi_ ## code ## cmplt (type, type); \
- extern int __aeabi_ ## code ## cmple (type, type); \
- extern int __aeabi_ ## code ## cmpge (type, type); \
- extern int __aeabi_ ## code ## cmpgt (type, type); \
- extern int __aeabi_ ## code ## cmpun (type, type); \
- extern int __aeabi_ ## code ## 2iz (type); \
- extern unsigned int __aeabi_ ## code ## 2uiz (type); \
- extern long long __aeabi_ ## code ## 2lz (type); \
- extern unsigned long long __aeabi_ ## code ## 2ulz (type); \
- extern type __aeabi_i2 ## code (int); \
- extern type __aeabi_ui2 ## code (int); \
- extern type __aeabi_l2 ## code (long long); \
- extern type __aeabi_ul2 ## code (unsigned long long); \
- \
- type code ## zero = 0.0; \
- type code ## one = 1.0; \
- type code ## two = 2.0; \
- type code ## four = 4.0; \
- type code ## minus_one = -1.0; \
- type code ## minus_two = -2.0; \
- type code ## minus_four = -4.0; \
- type code ## epsilon = 1E-32; \
- type code ## NaN = 0.0 / 0.0;
+/* All these functions are defined to use the base ABI, so use the
+ attribute to ensure the tests use the base ABI to call them even
+ when the VFP ABI is otherwise in effect. */
+#define PCS __attribute__((pcs("aapcs")))
+
+#define decl_float(code, type) \
+ extern type __aeabi_ ## code ## add (type, type) PCS; \
+ extern type __aeabi_ ## code ## div (type, type) PCS; \
+ extern type __aeabi_ ## code ## mul (type, type) PCS; \
+ extern type __aeabi_ ## code ## neg (type) PCS; \
+ extern type __aeabi_ ## code ## rsub (type, type) PCS; \
+ extern type __aeabi_ ## code ## sub (type, type) PCS; \
+ extern int __aeabi_ ## code ## cmpeq (type, type) PCS; \
+ extern int __aeabi_ ## code ## cmplt (type, type) PCS; \
+ extern int __aeabi_ ## code ## cmple (type, type) PCS; \
+ extern int __aeabi_ ## code ## cmpge (type, type) PCS; \
+ extern int __aeabi_ ## code ## cmpgt (type, type) PCS; \
+ extern int __aeabi_ ## code ## cmpun (type, type) PCS; \
+ extern int __aeabi_ ## code ## 2iz (type) PCS; \
+ extern unsigned int __aeabi_ ## code ## 2uiz (type) PCS; \
+ extern long long __aeabi_ ## code ## 2lz (type) PCS; \
+ extern unsigned long long __aeabi_ ## code ## 2ulz (type) PCS; \
+ extern type __aeabi_i2 ## code (int) PCS; \
+ extern type __aeabi_ui2 ## code (int) PCS; \
+ extern type __aeabi_l2 ## code (long long) PCS; \
+ extern type __aeabi_ul2 ## code (unsigned long long) PCS; \
+ \
+ type code ## zero = 0.0; \
+ type code ## one = 1.0; \
+ type code ## two = 2.0; \
+ type code ## four = 4.0; \
+ type code ## minus_one = -1.0; \
+ type code ## minus_two = -2.0; \
+ type code ## minus_four = -4.0; \
+ type code ## epsilon = 1E-32; \
+ type code ## NaN = 0.0 / 0.0;
decl_float (d, double)
decl_float (f, float)
-extern float __aeabi_d2f (double);
-extern double __aeabi_f2d (float);
+extern float __aeabi_d2f (double) PCS;
+extern double __aeabi_f2d (float) PCS;
extern long long __aeabi_lmul (long long, long long);
extern long long __aeabi_llsl (long long, int);
extern long long __aeabi_llsr (long long, int);
diff --git a/gcc/testsuite/gcc.target/arm/mmx-1.c b/gcc/testsuite/gcc.target/arm/mmx-1.c
index 21cc47912c0..5d51bd7b31d 100644
--- a/gcc/testsuite/gcc.target/arm/mmx-1.c
+++ b/gcc/testsuite/gcc.target/arm/mmx-1.c
@@ -4,6 +4,7 @@
/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mcpu=*" } { "-mcpu=iwmmxt" } } */
/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mabi=*" } { "-mabi=iwmmxt" } } */
/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mfloat-abi=softfp" } { "" } } */
+/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-mfloat-abi=hard" } { "" } } */
/* { dg-skip-if "Test is specific to the iWMMXt" { arm*-*-* } { "-march=*" } { "-march=iwmmxt" } } */
/* { dg-options "-O -mno-apcs-frame -mcpu=iwmmxt -mabi=iwmmxt" } */
/* { dg-require-effective-target arm32 } */
diff --git a/gcc/testsuite/gcc.target/arm/neon/polytypes.c b/gcc/testsuite/gcc.target/arm/neon/polytypes.c
index 12e9b0a7f6a..4fa3eac086c 100644
--- a/gcc/testsuite/gcc.target/arm/neon/polytypes.c
+++ b/gcc/testsuite/gcc.target/arm/neon/polytypes.c
@@ -45,4 +45,4 @@ void foo ()
u128_16 (v128_16); /* { dg-error "incompatible type for argument 1 of 'u128_16'" } */
p128_16 (v128_16);
}
-
+/* { dg-message "note: expected '\[^'\n\]*' but argument is of type '\[^'\n\]*'" "note: expected" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/arm/synchronize.c b/gcc/testsuite/gcc.target/arm/synchronize.c
new file mode 100644
index 00000000000..81ed8481188
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/synchronize.c
@@ -0,0 +1,6 @@
+/* { dg-final { scan-assembler "__sync_synchronize" { target arm*-*-linux-*eabi } } } */
+
+void *foo (void)
+{
+ __sync_synchronize();
+}
diff --git a/gcc/testsuite/gcc.target/bfin/loop-autoinc.c b/gcc/testsuite/gcc.target/bfin/loop-autoinc.c
new file mode 100644
index 00000000000..3dc7182982c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/bfin/loop-autoinc.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler " = \\\[\[PI\].\\+\\+\\\];" } } */
+extern int x[];
+extern void bar();
+int foo ()
+{
+ int i;
+ int sum = 0;
+ for (i = 0; i < 100; i++) {
+ sum += x[i];
+ if (sum & 1)
+ sum *= sum;
+ }
+ return sum;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr40906-1.c b/gcc/testsuite/gcc.target/i386/pr40906-1.c
new file mode 100644
index 00000000000..c14bbfa3a4f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr40906-1.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -fomit-frame-pointer -mpush-args -mno-accumulate-outgoing-args" } */
+
+void abort (void);
+
+void __attribute__((noinline))
+f (long double a)
+{
+ if (a != 1.23L)
+ abort ();
+}
+
+int __attribute__((noinline))
+g (long double b)
+{
+ f (b);
+ return 0;
+}
+
+int
+main (void)
+{
+ g (1.23L);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr40906-2.c b/gcc/testsuite/gcc.target/i386/pr40906-2.c
new file mode 100644
index 00000000000..66e146b0ca0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr40906-2.c
@@ -0,0 +1,26 @@
+/* { dg-do run } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -fomit-frame-pointer -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */
+
+void abort (void);
+
+void __attribute__((noinline))
+f (long double a)
+{
+ if (a != 1.23L)
+ abort ();
+}
+
+int __attribute__((noinline))
+g (long double b)
+{
+ f (b);
+ return 0;
+}
+
+int
+main (void)
+{
+ g (1.23L);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr40906-3.c b/gcc/testsuite/gcc.target/i386/pr40906-3.c
new file mode 100644
index 00000000000..b639b62996c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr40906-3.c
@@ -0,0 +1,25 @@
+/* { dg-do run { target *-*-linux* } } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -fomit-frame-pointer -msse2 -mpush-args -mno-accumulate-outgoing-args" } */
+
+#include "sse2-check.h"
+
+void __attribute__((noinline))
+f (__float128 a)
+{
+ if (a != 1.23Q)
+ abort ();
+}
+
+int __attribute__((noinline))
+g (__float128 b)
+{
+ f (b);
+ return 0;
+}
+
+static void
+sse2_test (void)
+{
+ g (1.23Q);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr40934.c b/gcc/testsuite/gcc.target/i386/pr40934.c
new file mode 100644
index 00000000000..41f46f88114
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr40934.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -march=i586 -ffast-math" } */
+
+extern double host_frametime;
+extern float pitchvel;
+V_DriftPitch (float delta, float move)
+{
+ if (!delta)
+ move = host_frametime;
+ if (delta > 0)
+ ;
+ else if (delta < 0 && move > -delta)
+ pitchvel = 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr40957.c b/gcc/testsuite/gcc.target/i386/pr40957.c
new file mode 100644
index 00000000000..56762d7e810
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr40957.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target avx } */
+/* { dg-options "-O2 -mavx" } */
+
+typedef int __v8si __attribute__((__vector_size__(32)));
+typedef long long __m256i __attribute__((__vector_size__(32), __may_alias__));
+
+static __m256i
+_mm256_set1_epi32 (int __A)
+{
+ return __extension__ (__m256i)(__v8si){ __A, __A, __A, __A,
+ __A, __A, __A, __A };
+}
+__m256i
+foo ()
+{
+ return _mm256_set1_epi32 (-1);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr41019.c b/gcc/testsuite/gcc.target/i386/pr41019.c
new file mode 100644
index 00000000000..c0021c6a450
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr41019.c
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -msse2 -ftree-vectorize" } */
+
+#include "sse2-check.h"
+
+long long int a[64];
+
+void
+sse2_test (void)
+{
+ int k;
+
+ for (k = 0; k < 64; k++)
+ a[k] = a[k] != 5 ? 12 : 10;
+
+ for (k = 0; k < 64; k++)
+ if (a[k] != 12)
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.target/mips/ext-3.c b/gcc/testsuite/gcc.target/mips/ext-3.c
index 557a8bc574e..acdbbc9a413 100644
--- a/gcc/testsuite/gcc.target/mips/ext-3.c
+++ b/gcc/testsuite/gcc.target/mips/ext-3.c
@@ -4,7 +4,7 @@
/* { dg-final { scan-assembler "\tdext\t" } } */
/* { dg-final { scan-assembler-not "sll" } } */
-unsigned long long
+NOMIPS16 unsigned long long
f (unsigned *i)
{
unsigned j = *i;
diff --git a/gcc/testsuite/gcc.target/mips/ext-4.c b/gcc/testsuite/gcc.target/mips/ext-4.c
new file mode 100644
index 00000000000..f3d2ad92aa3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/ext-4.c
@@ -0,0 +1,11 @@
+/* For MIPS64r2 use DEXT rather than DSLL/DSRL for clear_upper32. */
+/* { dg-do compile } */
+/* { dg-options "-O isa_rev>=2 -mgp64" } */
+/* { dg-final { scan-assembler "\tdext\t" } } */
+/* { dg-final { scan-assembler-not "sll" } } */
+
+NOMIPS16 unsigned long long
+f (unsigned long long i)
+{
+ return i & 0xffffffffull;
+}
diff --git a/gcc/testsuite/gcc.target/mips/ext-5.c b/gcc/testsuite/gcc.target/mips/ext-5.c
new file mode 100644
index 00000000000..64186383cb2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/ext-5.c
@@ -0,0 +1,11 @@
+/* For MIPS32r2 use EXT when ANDing with low-order bitmasks. */
+/* { dg-do compile } */
+/* { dg-options "-O isa_rev>=2" } */
+/* { dg-final { scan-assembler "\text\t" } } */
+/* { dg-final { scan-assembler-not "\tandi?\t" } } */
+
+NOMIPS16 unsigned
+f (unsigned i)
+{
+ return i & 0x7ffffff;
+}
diff --git a/gcc/testsuite/gcc.target/mips/ext-6.c b/gcc/testsuite/gcc.target/mips/ext-6.c
new file mode 100644
index 00000000000..b4a7dd2515c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/ext-6.c
@@ -0,0 +1,11 @@
+/* For MIPS64r2 use DEXT when ANDing with low-order bitmasks. */
+/* { dg-do compile } */
+/* { dg-options "-O isa_rev>=2 -mgp64" } */
+/* { dg-final { scan-assembler "\tdext\t" } } */
+/* { dg-final { scan-assembler-not "\tandi?\t" } } */
+
+NOMIPS16 unsigned long long
+f (unsigned long long i)
+{
+ return i & 0x7ffffffffff;
+}
diff --git a/gcc/testsuite/gcc.target/mips/ext-7.c b/gcc/testsuite/gcc.target/mips/ext-7.c
new file mode 100644
index 00000000000..394d41f06c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/ext-7.c
@@ -0,0 +1,11 @@
+/* No need to use ext if we can use andi. */
+/* { dg-do compile } */
+/* { dg-options "-O isa_rev>=2" } */
+/* { dg-final { scan-assembler "\tandi\t" } } */
+/* { dg-final { scan-assembler-not "\td?ext\t" } } */
+
+NOMIPS16 unsigned
+f (unsigned i)
+{
+ return i & 0x7fff;
+}
diff --git a/gcc/testsuite/gcc.target/mips/ext-8.c b/gcc/testsuite/gcc.target/mips/ext-8.c
new file mode 100644
index 00000000000..90241dd2f19
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/ext-8.c
@@ -0,0 +1,11 @@
+/* Also make sure we don't use ext for MIPS*r1. */
+/* { dg-do compile } */
+/* { dg-options "-O isa_rev<=1" } */
+/* { dg-final { scan-assembler "\tand\t" } } */
+/* { dg-final { scan-assembler-not "\td?ext\t" } } */
+
+unsigned
+f (unsigned i)
+{
+ return i & 0x7fffff;
+}
diff --git a/gcc/testsuite/gcc.target/mips/extend-2.c b/gcc/testsuite/gcc.target/mips/extend-2.c
new file mode 100644
index 00000000000..b91ae209c0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/extend-2.c
@@ -0,0 +1,12 @@
+/* Check the shift_shift alternative of the AND patterns. */
+/* { dg-do compile } */
+/* { dg-options "-O isa_rev<=1 -mgp64" } */
+/* { dg-final { scan-assembler "\tdsrl\t" } } */
+/* { dg-final { scan-assembler "\tdsll\t" } } */
+/* { dg-final { scan-assembler-not "\td?ext\t" } } */
+
+unsigned long long
+f (unsigned long long i)
+{
+ return i & 0xffffffff;
+}
diff --git a/gcc/testsuite/gcc.target/mips/interrupt_handler.c b/gcc/testsuite/gcc.target/mips/interrupt_handler.c
index 35ee1d20614..073c772ae40 100644
--- a/gcc/testsuite/gcc.target/mips/interrupt_handler.c
+++ b/gcc/testsuite/gcc.target/mips/interrupt_handler.c
@@ -4,20 +4,20 @@
void f () { }
-void __attribute__ ((interrupt)) v0 () { }
-void __attribute__ ((interrupt, use_shadow_register_set)) v1 () { }
-void __attribute__ ((interrupt, keep_interrupts_masked)) v2 () { }
-void __attribute__ ((interrupt, use_debug_exception_return)) v3 () { }
-void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked)) v4 () { }
-void __attribute__ ((interrupt, use_shadow_register_set, use_debug_exception_return)) v5 () { }
-void __attribute__ ((interrupt, keep_interrupts_masked, use_debug_exception_return)) v6 () { }
-void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked, use_debug_exception_return)) v7 () { }
+NOMIPS16 void __attribute__ ((interrupt)) v0 () { }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set)) v1 () { }
+NOMIPS16 void __attribute__ ((interrupt, keep_interrupts_masked)) v2 () { }
+NOMIPS16 void __attribute__ ((interrupt, use_debug_exception_return)) v3 () { }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked)) v4 () { }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set, use_debug_exception_return)) v5 () { }
+NOMIPS16 void __attribute__ ((interrupt, keep_interrupts_masked, use_debug_exception_return)) v6 () { }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked, use_debug_exception_return)) v7 () { }
-void __attribute__ ((interrupt)) w0 () { t(); }
-void __attribute__ ((interrupt, use_shadow_register_set)) w1 () { t(); }
-void __attribute__ ((interrupt, keep_interrupts_masked)) w2 () { t(); }
-void __attribute__ ((interrupt, use_debug_exception_return)) w3 () { t(); }
-void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked)) w4 () { t(); }
-void __attribute__ ((interrupt, use_shadow_register_set, use_debug_exception_return)) w5 () { t(); }
-void __attribute__ ((interrupt, keep_interrupts_masked, use_debug_exception_return)) w6 () { t(); }
-void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked, use_debug_exception_return)) w7 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt)) w0 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set)) w1 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, keep_interrupts_masked)) w2 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, use_debug_exception_return)) w3 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked)) w4 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set, use_debug_exception_return)) w5 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, keep_interrupts_masked, use_debug_exception_return)) w6 () { t(); }
+NOMIPS16 void __attribute__ ((interrupt, use_shadow_register_set, keep_interrupts_masked, use_debug_exception_return)) w7 () { t(); }
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index 5ec21422242..30f9a2c9c3d 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -184,6 +184,35 @@
#
# (6) If you need to disable processor-specific extensions use
# isa=!CPU instead of forcing a generic ISA.
+#
+#
+# Terminology
+#
+# Option group or just group:
+# See comment before mips_option_groups.
+#
+# Test options:
+# The options specified in dg-options.
+#
+# Explicit options:
+# The options that were either passed to runtest as "multilib" options
+# (e.g. -mips4 in --target_board=mips-sim-idt/-mips4) or specified as
+# test options. Note that options in parenthesis (i.e. (-mips16)) are
+# not explicit and can be omitted depending on the base options.
+#
+# Base options:
+# Options that are on by default without being specified in dg-options,
+# e.g. -march=mips64r2 for mipsisa64r2-elf or because they've been
+# passed to runtest as "multilib" options.
+#
+# Option array:
+# Many functions in this file work with option arrays. These are
+# two-dimensional Tcl arrays where the first dimension can have three
+# values: option, explicit_p or test_option_p. The second dimension is
+# the name of the option group. "option" contains the name of the
+# option that is in effect from this group. If no option is active it
+# contains the empty string. The flags "explicit_p" and "test_option_p"
+# are set for explicit and test options.
# Exit immediately if this isn't a MIPS target.
if ![istarget mips*-*-*] {
@@ -194,8 +223,8 @@ if ![istarget mips*-*-*] {
load_lib gcc-dg.exp
# A list of GROUP REGEXP pairs. Each GROUP represents a logical group of
-# options from which only option should be chosen. REGEXP matches all the
-# options in that group; it is implicitly wrapped in "^(...)$".
+# options from which only one option should be chosen. REGEXP matches all
+# the options in that group; it is implicitly wrapped in "^(...)$".
set mips_option_groups {
abi "-mabi=.*"
addressing "addressing=.*"
@@ -443,7 +472,7 @@ proc mips_option { upstatus group } {
return $status(option,$group)
}
-# If the default options for this test run include an option in group GROUP,
+# If the base options for this test run include an option in group GROUP,
# return that option, otherwise return "".
proc mips_original_option { group } {
global mips_base_options
@@ -451,8 +480,8 @@ proc mips_original_option { group } {
return [mips_option mips_base_options $group]
}
-# Return true if the test described up UPSTATUS requires a specific
-# option in group GROUP.
+# Return true if the test described by UPSTATUS requires a specific
+# option in group GROUP. UPSTATUS describes the option status.
proc mips_test_option_p { upstatus group } {
upvar $upstatus status
diff --git a/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c b/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c
index c6bc495c8de..92f46250eb6 100644
--- a/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c
+++ b/gcc/testsuite/gcc.target/mips/smartmips-lwxs.c
@@ -1,6 +1,5 @@
/* { dg-do compile } */
-/* -mlong32 added because of PR target/38599. */
-/* { dg-options "-O -msmartmips -mlong32" } */
+/* { dg-options "-O -msmartmips" } */
NOMIPS16 int scaled_indexed_word_load (int a[], int b)
{
diff --git a/gcc/testsuite/gcc.target/mips/truncate-4.c b/gcc/testsuite/gcc.target/mips/truncate-4.c
index 2958be8de1e..4c783681ab2 100644
--- a/gcc/testsuite/gcc.target/mips/truncate-4.c
+++ b/gcc/testsuite/gcc.target/mips/truncate-4.c
@@ -2,7 +2,7 @@
/* { dg-options "-O -mgp64" } */
/* { dg-final { scan-assembler-not "\tsll\t" } } */
-unsigned long long
+NOMIPS16 unsigned long long
f (unsigned long long s)
{
unsigned u = s & 0xfff;
diff --git a/gcc/testsuite/gcc.target/mips/truncate-5.c b/gcc/testsuite/gcc.target/mips/truncate-5.c
index 046ef80c453..6cdb7f71e7f 100644
--- a/gcc/testsuite/gcc.target/mips/truncate-5.c
+++ b/gcc/testsuite/gcc.target/mips/truncate-5.c
@@ -8,6 +8,7 @@ struct s
unsigned a:5;
};
+NOMIPS16 void
f (struct s *s, unsigned long long a)
{
s->a = a & 0x3;
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-32.c b/gcc/testsuite/gcc.target/powerpc/altivec-32.c
new file mode 100644
index 00000000000..83105f89a50
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-32.c
@@ -0,0 +1,59 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O2 -ftree-vectorize -mcpu=power6 -m64 -maltivec" } */
+/* { dg-final { scan-assembler "vsel" } } */
+/* { dg-final { scan-assembler "vrfim" } } */
+/* { dg-final { scan-assembler "vrfip" } } */
+/* { dg-final { scan-assembler "vrfiz" } } */
+
+#ifndef SIZE
+#define SIZE 1024
+#endif
+
+float a[SIZE] __attribute__((__aligned__(32)));
+float b[SIZE] __attribute__((__aligned__(32)));
+float c[SIZE] __attribute__((__aligned__(32)));
+float d[SIZE] __attribute__((__aligned__(32)));
+float e[SIZE] __attribute__((__aligned__(32)));
+
+extern float floorf (float);
+extern float ceilf (float);
+extern float truncf (float);
+extern float copysignf (float, float);
+
+void
+vector_floor (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = floorf (b[i]);
+}
+
+void
+vector_ceil (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = ceilf (b[i]);
+}
+
+void
+vector_trunc (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = truncf (b[i]);
+}
+
+void
+vector_copysign (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = copysignf (b[i], c[i]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-6.c b/gcc/testsuite/gcc.target/powerpc/altivec-6.c
index dc115f9422d..51d411688fb 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-6.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-6.c
@@ -5,7 +5,7 @@
#include <altivec.h>
/* These denote "generic" GCC vectors. */
-static int __attribute__((vector_size(16))) x, y;
+static int __attribute__((vector_size(16))) x, y, z;
static vector signed int i,j;
static vector signed short s,t;
@@ -21,7 +21,7 @@ static int int1, int2;
void
b()
{
- vec_add (x, y);
+ z = vec_add (x, y);
/* Make sure the predicates accept correct argument types. */
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap-run.c b/gcc/testsuite/gcc.target/powerpc/bswap-run.c
new file mode 100644
index 00000000000..484908a8167
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bswap-run.c
@@ -0,0 +1,102 @@
+/* { dg-do run { target powerpc*-*-* } } */
+/* { dg-options "-O2 -std=gnu99" } */
+
+extern void abort (void);
+
+static unsigned char bytes[] = { 0, 1, 2, 0x80, 0xff };
+
+unsigned short b16a (unsigned short *p) { return __builtin_bswap16 (*p); }
+void b16b (unsigned short *p, unsigned short a) { *p = __builtin_bswap16 (a); }
+int b16c (unsigned short a) { return __builtin_bswap16 (a); }
+
+unsigned int b32a (unsigned int *p) { return __builtin_bswap32 (*p); }
+void b32b (unsigned int *p, unsigned int a) { *p = __builtin_bswap32 (a); }
+static unsigned int b32c (unsigned int a) { return __builtin_bswap32 (a); }
+
+unsigned long long b64a (unsigned long long *p) { return __builtin_bswap64 (*p); }
+void b64b (unsigned long long *p, unsigned long long a) { *p = __builtin_bswap64 (a); }
+unsigned long long b64c (unsigned long long a) { return __builtin_bswap64 (a); }
+
+int
+main (void)
+{
+ unsigned i1, i2, i3, i4, i5;
+ unsigned b1, b2, b3, b4, b5;
+ unsigned short b16_inp, b16_exp, b16_var;
+ unsigned int b32_inp, b32_exp, b32_var;
+ unsigned long long b64_inp, b64_exp, b64_var;
+
+ for (i1 = 0; i1 < sizeof (bytes); i1++)
+ {
+ b1 = bytes[i1];
+ for (i2 = 0; i2 < sizeof (bytes); i2++)
+ {
+ b2 = bytes[i2];
+ b16_inp = (b1 << 8) | b2;
+ b16_exp = (b2 << 8) | b1;
+
+ if (b16a (&b16_inp) != b16_exp)
+ abort ();
+
+ b16b (&b16_var, b16_inp);
+ if (b16_var != b16_exp)
+ abort ();
+
+ if (b16c (b16_inp) != b16_exp)
+ abort ();
+
+ for (i3 = 0; i3 < sizeof (bytes); i3++)
+ {
+ b3 = bytes[i3];
+ for (i4 = 0; i4 < sizeof (bytes); i4++)
+ {
+ b4 = bytes[i4];
+ b32_inp = (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+ b32_exp = (b4 << 24) | (b3 << 16) | (b2 << 8) | b1;
+
+ if (b32a (&b32_inp) != b32_exp)
+ abort ();
+
+ b32b (&b32_var, b32_inp);
+ if (b32_var != b32_exp)
+ abort ();
+
+ if (b32c (b32_inp) != b32_exp)
+ abort ();
+
+ for (i5 = 0; i5 < sizeof (bytes); i5++)
+ {
+ b5 = bytes[i5];
+ b64_inp = (((unsigned long long)b32_inp) << 32) | b5;
+ b64_exp = (((unsigned long long)b5) << 56) | b32_exp;
+
+ if (b64a (&b64_inp) != b64_exp)
+ abort ();
+
+ b64b (&b64_var, b64_inp);
+ if (b64_var != b64_exp)
+ abort ();
+
+ if (b64c (b64_inp) != b64_exp)
+ abort ();
+
+ b64_inp = (((unsigned long long)b5) << 56) | b32_inp;
+ b64_exp = (((unsigned long long)b32_exp) << 32) | b5;
+
+ if (b64a (&b64_inp) != b64_exp)
+ abort ();
+
+ b64b (&b64_var, b64_inp);
+ if (b64_var != b64_exp)
+ abort ();
+
+ if (b64c (b64_inp) != b64_exp)
+ abort ();
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap16.c b/gcc/testsuite/gcc.target/powerpc/bswap16.c
new file mode 100644
index 00000000000..5eea4f77491
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bswap16.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "lhbrx" } } */
+/* { dg-final { scan-assembler "sthbrx" } } */
+
+unsigned short us;
+unsigned int load_bswap16 (unsigned short *p) { return __builtin_bswap16 (*p); }
+void store_bswap16 (unsigned int a) { us = __builtin_bswap16 (a); }
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap32.c b/gcc/testsuite/gcc.target/powerpc/bswap32.c
new file mode 100644
index 00000000000..1b1e189aafa
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bswap32.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler "lwbrx" } } */
+/* { dg-final { scan-assembler "stwbrx" } } */
+
+unsigned int ui;
+unsigned int load_bswap32 (unsigned int *p) { return __builtin_bswap32 (*p); }
+void store_bswap32 (unsigned int a) { ui = __builtin_bswap32 (a); }
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap64-1.c b/gcc/testsuite/gcc.target/powerpc/bswap64-1.c
new file mode 100644
index 00000000000..480e1cd7cfc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bswap64-1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -mno-popcntd -mcpu=power5" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-final { scan-assembler "lwbrx" } } */
+/* { dg-final { scan-assembler "stwbrx" } } */
+
+unsigned long ul;
+unsigned long load_bswap64 (unsigned long *p) { return __builtin_bswap64 (*p); }
+void store_bswap64 (unsigned long a) { ul = __builtin_bswap64 (a); }
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap64-2.c b/gcc/testsuite/gcc.target/powerpc/bswap64-2.c
new file mode 100644
index 00000000000..6c3d8ca0528
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bswap64-2.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -mpopcntd" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-final { scan-assembler "ldbrx" } } */
+/* { dg-final { scan-assembler "stdbrx" } } */
+
+unsigned long ul;
+unsigned long load_bswap64 (unsigned long *p) { return __builtin_bswap64 (*p); }
+void store_bswap64 (unsigned long a) { ul = __builtin_bswap64 (a); }
diff --git a/gcc/testsuite/gcc.target/powerpc/bswap64-3.c b/gcc/testsuite/gcc.target/powerpc/bswap64-3.c
new file mode 100644
index 00000000000..7f1138cf94f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/bswap64-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-options "-O2 -mcpu=cell" } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target powerpc_ppu_ok } */
+/* { dg-final { scan-assembler "ldbrx" } } */
+/* { dg-final { scan-assembler "stdbrx" } } */
+
+unsigned long ul;
+unsigned long load_bswap64 (unsigned long *p) { return __builtin_bswap64 (*p); }
+void store_bswap64 (unsigned long a) { ul = __builtin_bswap64 (a); }
diff --git a/gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-2.c b/gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-2.c
new file mode 100644
index 00000000000..7337e99b1b3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-2.c
@@ -0,0 +1,36 @@
+/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -mcpu=power5" } */
+
+/* This is a clone of gcc-dg/optimize-bswapdi-1.c, redone to use load and stores
+ to test whether lwbrx/stwbrx is generated for normal power systems. */
+
+#include <stdint.h>
+#define __const_swab64(x) ((uint64_t)( \
+ (((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
+ (((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
+ (((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
+ (((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
+ (((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
+ (((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
+ (((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
+ (((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56)))
+
+
+/* This byte swap implementation is used by the Linux kernel and the
+ GNU C library. */
+
+uint64_t
+swap64_load (uint64_t *in)
+{
+ return __const_swab64 (*in);
+}
+
+void
+swap64_store (uint64_t *out, uint64_t in)
+{
+ *out = __const_swab64 (in);
+}
+
+/* { dg-final { scan-assembler-times "lwbrx" 2 } } */
+/* { dg-final { scan-assembler-times "stwbrx" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-3.c b/gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-3.c
new file mode 100644
index 00000000000..9dcd824c6ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/optimize-bswapdi-3.c
@@ -0,0 +1,36 @@
+/* { dg-require-effective-target stdint_types } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O2 -mcpu=power7" } */
+
+/* This is a clone of gcc-dg/optimize-bswapdi-1.c, redone to use load and stores
+ to test whether ldbrx/stdbrx is generated for power7. */
+
+#include <stdint.h>
+#define __const_swab64(x) ((uint64_t)( \
+ (((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
+ (((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
+ (((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
+ (((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) << 8) | \
+ (((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \
+ (((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
+ (((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
+ (((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56)))
+
+
+/* This byte swap implementation is used by the Linux kernel and the
+ GNU C library. */
+
+uint64_t
+swap64_load (uint64_t *in)
+{
+ return __const_swab64 (*in);
+}
+
+void
+swap64_store (uint64_t *out, uint64_t in)
+{
+ *out = __const_swab64 (in);
+}
+
+/* { dg-final { scan-assembler "ldbrx" } } */
+/* { dg-final { scan-assembler "stdbrx" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/optimize-bswapsi-2.c b/gcc/testsuite/gcc.target/powerpc/optimize-bswapsi-2.c
new file mode 100644
index 00000000000..34cc8236fbc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/optimize-bswapsi-2.c
@@ -0,0 +1,55 @@
+/* { dg-require-effective-target stdint_types } */
+/* { dg-options "-O2 -mcpu=power5" } */
+
+#include <stdint.h>
+
+/* This is a clone of gcc-dg/optimize-bswapsi-1.c, redone to use load and stores
+ to test whether lwbrx/stwbrx is generated for normal power systems. */
+
+#define __const_swab32(x) ((uint32_t)( \
+ (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
+ (((uint32_t)(x) & (uint32_t)0x0000ff00UL) << 8) | \
+ (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >> 8) | \
+ (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24)))
+
+/* This byte swap implementation is used by the Linux kernel and the
+ GNU C library. */
+
+uint32_t
+swap32_a_load (uint32_t *in)
+{
+ return __const_swab32 (*in);
+}
+
+/* The OpenSSH byte swap implementation. */
+uint32_t
+swap32_b_load (uint32_t *in)
+{
+ uint32_t a;
+
+ a = (*in << 16) | (*in >> 16);
+ a = ((a & 0x00ff00ff) << 8) | ((a & 0xff00ff00) >> 8);
+
+ return a;
+}
+
+void
+swap32_a_store (uint32_t *out, uint32_t in)
+{
+ *out = __const_swab32 (in);
+}
+
+/* The OpenSSH byte swap implementation. */
+void
+swap32_b_store (uint32_t *out, uint32_t in)
+{
+ uint32_t a;
+
+ a = (in << 16) | (in >> 16);
+ a = ((a & 0x00ff00ff) << 8) | ((a & 0xff00ff00) >> 8);
+
+ *out = a;
+}
+
+/* { dg-final { scan-assembler-times "lwbrx" 2 } } */
+/* { dg-final { scan-assembler-times "stwbrx" 2 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/popcount-2.c b/gcc/testsuite/gcc.target/powerpc/popcount-2.c
new file mode 100644
index 00000000000..7546a3bdf1e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/popcount-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { ilp32 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-options "-O2 -mcpu=power7 -m32" } */
+/* { dg-final { scan-assembler "popcntw" } } */
+
+int foo(int x)
+{
+ return __builtin_popcount(x);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/popcount-3.c b/gcc/testsuite/gcc.target/powerpc/popcount-3.c
new file mode 100644
index 00000000000..c803532e6db
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/popcount-3.c
@@ -0,0 +1,9 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-options "-O2 -mcpu=power7 -m64" } */
+/* { dg-final { scan-assembler "popcntd" } } */
+
+long foo(int x)
+{
+ return __builtin_popcountl(x);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr39457.c b/gcc/testsuite/gcc.target/powerpc/pr39457.c
new file mode 100644
index 00000000000..22057e51f59
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr39457.c
@@ -0,0 +1,56 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-options "-m64 -O2 -mminimal-toc" } */
+
+/* PR 39457 -- fix breakage because the compiler ran out of registers and
+ wanted to stash a floating point value to the LR/CTR register. */
+
+/* -O2 -m64 -mminimal-toc */
+typedef struct { void *s; } S;
+typedef void (*T1) (void);
+typedef void (*T2) (void *, void *, int, void *);
+char *fn1 (const char *, ...);
+void *fn2 (void);
+int fn3 (char *, int);
+int fn4 (const void *);
+int fn5 (const void *);
+long fn6 (void) __attribute__ ((__const__));
+int fn7 (void *, void *, void *);
+void *fn8 (void *, long);
+void *fn9 (void *, long, const char *, ...);
+void *fn10 (void *);
+long fn11 (void) __attribute__ ((__const__));
+long fn12 (void *, const char *, T1, T2, void *);
+void *fn13 (void *);
+long fn14 (void) __attribute__ ((__const__));
+extern void *v1;
+extern char *v2;
+extern int v3;
+
+void
+foo (void *x, char *z)
+{
+ void *i1, *i2;
+ int y;
+ if (v1)
+ return;
+ v1 = fn9 (fn10 (fn2 ()), fn6 (), "x", 0., "y", 0., 0);
+ y = 520 - (520 - fn4 (x)) / 2;
+ fn9 (fn8 (v1, fn6 ()), fn6 (), "wig", fn8 (v1, fn14 ()), "x", 18.0,
+ "y", 16.0, "wid", 80.0, "hi", 500.0, 0);
+ fn9 (fn10 (v1), fn6 (), "x1", 0., "y1", 0., "x2", 80.0, "y2",
+ 500.0, "f", fn3 ("fff", 0x0D0DFA00), 0);
+ fn13 (((S *) fn8 (v1, fn6 ()))->s);
+ fn12 (fn8 (v1, fn11 ()), "ev", (T1) fn7, 0, fn8 (v1, fn6 ()));
+ fn9 (fn8 (v1, fn6 ()), fn6 (), "wig",
+ fn8 (v1, fn14 ()), "x", 111.0, "y", 14.0, "wid", 774.0, "hi",
+ 500.0, 0);
+ v1 = fn9 (fn10 (v1), fn6 (), "x1", 0., "y1", 0., "x2", 774.0, "y2",
+ 500.0, "f", fn3 ("gc", 0x0D0DFA00), 0);
+ fn1 (z, 0);
+ i1 = fn9 (fn8 (v1, fn6 ()), fn6 (), "pixbuf", x, "x",
+ 800 - fn5 (x) / 2, "y", y - fn4 (x), 0);
+ fn12 (fn8 (i1, fn11 ()), "ev", (T1) fn7, 0, "/ok/");
+ fn12 (fn8 (i1, fn11 ()), "ev", (T1) fn7, 0, 0);
+ i2 = fn9 (fn8 (v1, fn6 ()), fn6 (), "txt", "OK", "fnt", v2, "x",
+ 800, "y", y - fn4 (x) + 15, "ar", 0, "f", v3, 0);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/pr39902-2.c b/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
new file mode 100644
index 00000000000..463a36c1bee
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr39902-2.c
@@ -0,0 +1,28 @@
+/* Check that simplification "x*(-1)" -> "-x" is not performed for decimal
+ float types. */
+
+/* { dg-do compile { target { powerpc*-*-linux* && powerpc_fprs } } } */
+/* { dg-options "-std=gnu99 -O -mcpu=power6" } */
+/* { dg-final { scan-assembler-not "fneg" } } */
+
+extern _Decimal32 a32, b32;
+extern _Decimal64 a64, b64;
+extern _Decimal128 a128, b128;
+
+void
+foo32 (void)
+{
+ b32 = a32 * -1.0DF;
+}
+
+void
+foo64 (void)
+{
+ b64 = a64 * -1.0DD;
+}
+
+void
+foo128 (void)
+{
+ b128 = a128 * -1.0DL;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-1.c
new file mode 100644
index 00000000000..42d5b605641
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-1.c
@@ -0,0 +1,38 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+/* { dg-final { scan-assembler "xvadddp" } } */
+/* { dg-final { scan-assembler "xvsubdp" } } */
+/* { dg-final { scan-assembler "xvmuldp" } } */
+/* { dg-final { scan-assembler "xvmadd" } } */
+/* { dg-final { scan-assembler "xvmsub" } } */
+/* { dg-final { scan-assembler "xvnmadd" } } */
+/* { dg-final { scan-assembler "xvnmsub" } } */
+/* { dg-final { scan-assembler "xvdivdp" } } */
+/* { dg-final { scan-assembler "xvmaxdp" } } */
+/* { dg-final { scan-assembler "xvmindp" } } */
+/* { dg-final { scan-assembler "xvsqrtdp" } } */
+/* { dg-final { scan-assembler "xvrsqrtedp" } } */
+/* { dg-final { scan-assembler "xvabsdp" } } */
+/* { dg-final { scan-assembler "xvnabsdp" } } */
+/* { dg-final { scan-assembler "xvredp" } } */
+
+void use_builtins (__vector double *p, __vector double *q, __vector double *r, __vector double *s)
+{
+ p[0] = __builtin_vsx_xvadddp (q[0], r[0]);
+ p[1] = __builtin_vsx_xvsubdp (q[1], r[1]);
+ p[2] = __builtin_vsx_xvmuldp (q[2], r[2]);
+ p[3] = __builtin_vsx_xvdivdp (q[3], r[3]);
+ p[4] = __builtin_vsx_xvmaxdp (q[4], r[4]);
+ p[5] = __builtin_vsx_xvmindp (q[5], r[5]);
+ p[6] = __builtin_vsx_xvabsdp (q[6]);
+ p[7] = __builtin_vsx_xvnabsdp (q[7]);
+ p[8] = __builtin_vsx_xvsqrtdp (q[8]);
+ p[9] = __builtin_vsx_xvmadddp (q[9], r[9], s[9]);
+ p[10] = __builtin_vsx_xvmsubdp (q[10], r[10], s[10]);
+ p[11] = __builtin_vsx_xvnmadddp (q[11], r[11], s[11]);
+ p[12] = __builtin_vsx_xvnmsubdp (q[12], r[12], s[12]);
+ p[13] = __builtin_vsx_xvredp (q[13]);
+ p[14] = __builtin_vsx_xvrsqrtedp (q[14]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-2.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-2.c
new file mode 100644
index 00000000000..6d883dc90f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-2.c
@@ -0,0 +1,38 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+/* { dg-final { scan-assembler "xvaddsp" } } */
+/* { dg-final { scan-assembler "xvsubsp" } } */
+/* { dg-final { scan-assembler "xvmulsp" } } */
+/* { dg-final { scan-assembler "xvmadd" } } */
+/* { dg-final { scan-assembler "xvmsub" } } */
+/* { dg-final { scan-assembler "xvnmadd" } } */
+/* { dg-final { scan-assembler "xvnmsub" } } */
+/* { dg-final { scan-assembler "xvdivsp" } } */
+/* { dg-final { scan-assembler "xvmaxsp" } } */
+/* { dg-final { scan-assembler "xvminsp" } } */
+/* { dg-final { scan-assembler "xvsqrtsp" } } */
+/* { dg-final { scan-assembler "xvabssp" } } */
+/* { dg-final { scan-assembler "xvnabssp" } } */
+/* { dg-final { scan-assembler "xvresp" } } */
+/* { dg-final { scan-assembler "xvrsqrtesp" } } */
+
+void use_builtins (__vector float *p, __vector float *q, __vector float *r, __vector float *s)
+{
+ p[0] = __builtin_vsx_xvaddsp (q[0], r[0]);
+ p[1] = __builtin_vsx_xvsubsp (q[1], r[1]);
+ p[2] = __builtin_vsx_xvmulsp (q[2], r[2]);
+ p[3] = __builtin_vsx_xvdivsp (q[3], r[3]);
+ p[4] = __builtin_vsx_xvmaxsp (q[4], r[4]);
+ p[5] = __builtin_vsx_xvminsp (q[5], r[5]);
+ p[6] = __builtin_vsx_xvabssp (q[6]);
+ p[7] = __builtin_vsx_xvnabssp (q[7]);
+ p[8] = __builtin_vsx_xvsqrtsp (q[8]);
+ p[9] = __builtin_vsx_xvmaddsp (q[9], r[9], s[9]);
+ p[10] = __builtin_vsx_xvmsubsp (q[10], r[10], s[10]);
+ p[11] = __builtin_vsx_xvnmaddsp (q[11], r[11], s[11]);
+ p[12] = __builtin_vsx_xvnmsubsp (q[12], r[12], s[12]);
+ p[13] = __builtin_vsx_xvresp (q[13]);
+ p[14] = __builtin_vsx_xvrsqrtesp (q[14]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
new file mode 100644
index 00000000000..8450920ec0c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
@@ -0,0 +1,212 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+/* { dg-final { scan-assembler "xxsel" } } */
+/* { dg-final { scan-assembler "vperm" } } */
+/* { dg-final { scan-assembler "xvrdpi" } } */
+/* { dg-final { scan-assembler "xvrdpic" } } */
+/* { dg-final { scan-assembler "xvrdpim" } } */
+/* { dg-final { scan-assembler "xvrdpip" } } */
+/* { dg-final { scan-assembler "xvrdpiz" } } */
+/* { dg-final { scan-assembler "xvrspi" } } */
+/* { dg-final { scan-assembler "xvrspic" } } */
+/* { dg-final { scan-assembler "xvrspim" } } */
+/* { dg-final { scan-assembler "xvrspip" } } */
+/* { dg-final { scan-assembler "xvrspiz" } } */
+/* { dg-final { scan-assembler "xsrdpi" } } */
+/* { dg-final { scan-assembler "xsrdpic" } } */
+/* { dg-final { scan-assembler "xsrdpim" } } */
+/* { dg-final { scan-assembler "xsrdpip" } } */
+/* { dg-final { scan-assembler "xsrdpiz" } } */
+/* { dg-final { scan-assembler "xsmaxdp" } } */
+/* { dg-final { scan-assembler "xsmindp" } } */
+/* { dg-final { scan-assembler "xxland" } } */
+/* { dg-final { scan-assembler "xxlandc" } } */
+/* { dg-final { scan-assembler "xxlnor" } } */
+/* { dg-final { scan-assembler "xxlor" } } */
+/* { dg-final { scan-assembler "xxlxor" } } */
+/* { dg-final { scan-assembler "xvcmpeqdp" } } */
+/* { dg-final { scan-assembler "xvcmpgtdp" } } */
+/* { dg-final { scan-assembler "xvcmpgedp" } } */
+/* { dg-final { scan-assembler "xvcmpeqsp" } } */
+/* { dg-final { scan-assembler "xvcmpgtsp" } } */
+/* { dg-final { scan-assembler "xvcmpgesp" } } */
+/* { dg-final { scan-assembler "xxsldwi" } } */
+/* { dg-final { scan-assembler-not "call" } } */
+
+extern __vector int si[][4];
+extern __vector short ss[][4];
+extern __vector signed char sc[][4];
+extern __vector float f[][4];
+extern __vector unsigned int ui[][4];
+extern __vector unsigned short us[][4];
+extern __vector unsigned char uc[][4];
+extern __vector __bool int bi[][4];
+extern __vector __bool short bs[][4];
+extern __vector __bool char bc[][4];
+extern __vector __pixel p[][4];
+#ifdef __VSX__
+extern __vector double d[][4];
+extern __vector long sl[][4];
+extern __vector unsigned long ul[][4];
+extern __vector __bool long bl[][4];
+#endif
+
+int do_sel(void)
+{
+ int i = 0;
+
+ si[i][0] = __builtin_vsx_xxsel_4si (si[i][1], si[i][2], si[i][3]); i++;
+ ss[i][0] = __builtin_vsx_xxsel_8hi (ss[i][1], ss[i][2], ss[i][3]); i++;
+ sc[i][0] = __builtin_vsx_xxsel_16qi (sc[i][1], sc[i][2], sc[i][3]); i++;
+ f[i][0] = __builtin_vsx_xxsel_4sf (f[i][1], f[i][2], f[i][3]); i++;
+ d[i][0] = __builtin_vsx_xxsel_2df (d[i][1], d[i][2], d[i][3]); i++;
+
+ si[i][0] = __builtin_vsx_xxsel (si[i][1], si[i][2], bi[i][3]); i++;
+ ss[i][0] = __builtin_vsx_xxsel (ss[i][1], ss[i][2], bs[i][3]); i++;
+ sc[i][0] = __builtin_vsx_xxsel (sc[i][1], sc[i][2], bc[i][3]); i++;
+ f[i][0] = __builtin_vsx_xxsel (f[i][1], f[i][2], bi[i][3]); i++;
+ d[i][0] = __builtin_vsx_xxsel (d[i][1], d[i][2], bl[i][3]); i++;
+
+ si[i][0] = __builtin_vsx_xxsel (si[i][1], si[i][2], ui[i][3]); i++;
+ ss[i][0] = __builtin_vsx_xxsel (ss[i][1], ss[i][2], us[i][3]); i++;
+ sc[i][0] = __builtin_vsx_xxsel (sc[i][1], sc[i][2], uc[i][3]); i++;
+ f[i][0] = __builtin_vsx_xxsel (f[i][1], f[i][2], ui[i][3]); i++;
+ d[i][0] = __builtin_vsx_xxsel (d[i][1], d[i][2], ul[i][3]); i++;
+
+ return i;
+}
+
+int do_perm(void)
+{
+ int i = 0;
+
+ si[i][0] = __builtin_vsx_vperm_4si (si[i][1], si[i][2], uc[i][3]); i++;
+ ss[i][0] = __builtin_vsx_vperm_8hi (ss[i][1], ss[i][2], uc[i][3]); i++;
+ sc[i][0] = __builtin_vsx_vperm_16qi (sc[i][1], sc[i][2], uc[i][3]); i++;
+ f[i][0] = __builtin_vsx_vperm_4sf (f[i][1], f[i][2], uc[i][3]); i++;
+ d[i][0] = __builtin_vsx_vperm_2df (d[i][1], d[i][2], uc[i][3]); i++;
+
+ si[i][0] = __builtin_vsx_vperm (si[i][1], si[i][2], uc[i][3]); i++;
+ ss[i][0] = __builtin_vsx_vperm (ss[i][1], ss[i][2], uc[i][3]); i++;
+ sc[i][0] = __builtin_vsx_vperm (sc[i][1], sc[i][2], uc[i][3]); i++;
+ f[i][0] = __builtin_vsx_vperm (f[i][1], f[i][2], uc[i][3]); i++;
+ d[i][0] = __builtin_vsx_vperm (d[i][1], d[i][2], uc[i][3]); i++;
+
+ return i;
+}
+
+int do_xxperm (void)
+{
+ int i = 0;
+
+ d[i][0] = __builtin_vsx_xxpermdi_2df (d[i][1], d[i][2], 0); i++;
+ d[i][0] = __builtin_vsx_xxpermdi (d[i][1], d[i][2], 1); i++;
+ return i;
+}
+
+double x, y;
+void do_concat (void)
+{
+ d[0][0] = __builtin_vsx_concat_2df (x, y);
+}
+
+void do_set (void)
+{
+ d[0][0] = __builtin_vsx_set_2df (d[0][1], x, 0);
+ d[1][0] = __builtin_vsx_set_2df (d[1][1], y, 1);
+}
+
+extern double z[][4];
+
+int do_math (void)
+{
+ int i = 0;
+
+ d[i][0] = __builtin_vsx_xvrdpi (d[i][1]); i++;
+ d[i][0] = __builtin_vsx_xvrdpic (d[i][1]); i++;
+ d[i][0] = __builtin_vsx_xvrdpim (d[i][1]); i++;
+ d[i][0] = __builtin_vsx_xvrdpip (d[i][1]); i++;
+ d[i][0] = __builtin_vsx_xvrdpiz (d[i][1]); i++;
+
+ f[i][0] = __builtin_vsx_xvrspi (f[i][1]); i++;
+ f[i][0] = __builtin_vsx_xvrspic (f[i][1]); i++;
+ f[i][0] = __builtin_vsx_xvrspim (f[i][1]); i++;
+ f[i][0] = __builtin_vsx_xvrspip (f[i][1]); i++;
+ f[i][0] = __builtin_vsx_xvrspiz (f[i][1]); i++;
+
+ z[i][0] = __builtin_vsx_xsrdpi (z[i][1]); i++;
+ z[i][0] = __builtin_vsx_xsrdpic (z[i][1]); i++;
+ z[i][0] = __builtin_vsx_xsrdpim (z[i][1]); i++;
+ z[i][0] = __builtin_vsx_xsrdpip (z[i][1]); i++;
+ z[i][0] = __builtin_vsx_xsrdpiz (z[i][1]); i++;
+ z[i][0] = __builtin_vsx_xsmaxdp (z[i][1], z[i][0]); i++;
+ z[i][0] = __builtin_vsx_xsmindp (z[i][1], z[i][0]); i++;
+ return i;
+}
+
+int do_cmp (void)
+{
+ int i = 0;
+
+ d[i][0] = __builtin_vsx_xvcmpeqdp (d[i][1], d[i][2]); i++;
+ d[i][0] = __builtin_vsx_xvcmpgtdp (d[i][1], d[i][2]); i++;
+ d[i][0] = __builtin_vsx_xvcmpgedp (d[i][1], d[i][2]); i++;
+
+ f[i][0] = __builtin_vsx_xvcmpeqsp (f[i][1], f[i][2]); i++;
+ f[i][0] = __builtin_vsx_xvcmpgtsp (f[i][1], f[i][2]); i++;
+ f[i][0] = __builtin_vsx_xvcmpgesp (f[i][1], f[i][2]); i++;
+ return i;
+}
+
+int do_logical (void)
+{
+ int i = 0;
+
+ si[i][0] = __builtin_vsx_xxland (si[i][1], si[i][2]); i++;
+ si[i][0] = __builtin_vsx_xxlandc (si[i][1], si[i][2]); i++;
+ si[i][0] = __builtin_vsx_xxlnor (si[i][1], si[i][2]); i++;
+ si[i][0] = __builtin_vsx_xxlor (si[i][1], si[i][2]); i++;
+ si[i][0] = __builtin_vsx_xxlxor (si[i][1], si[i][2]); i++;
+
+ ss[i][0] = __builtin_vsx_xxland (ss[i][1], ss[i][2]); i++;
+ ss[i][0] = __builtin_vsx_xxlandc (ss[i][1], ss[i][2]); i++;
+ ss[i][0] = __builtin_vsx_xxlnor (ss[i][1], ss[i][2]); i++;
+ ss[i][0] = __builtin_vsx_xxlor (ss[i][1], ss[i][2]); i++;
+ ss[i][0] = __builtin_vsx_xxlxor (ss[i][1], ss[i][2]); i++;
+
+ sc[i][0] = __builtin_vsx_xxland (sc[i][1], sc[i][2]); i++;
+ sc[i][0] = __builtin_vsx_xxlandc (sc[i][1], sc[i][2]); i++;
+ sc[i][0] = __builtin_vsx_xxlnor (sc[i][1], sc[i][2]); i++;
+ sc[i][0] = __builtin_vsx_xxlor (sc[i][1], sc[i][2]); i++;
+ sc[i][0] = __builtin_vsx_xxlxor (sc[i][1], sc[i][2]); i++;
+
+ d[i][0] = __builtin_vsx_xxland (d[i][1], d[i][2]); i++;
+ d[i][0] = __builtin_vsx_xxlandc (d[i][1], d[i][2]); i++;
+ d[i][0] = __builtin_vsx_xxlnor (d[i][1], d[i][2]); i++;
+ d[i][0] = __builtin_vsx_xxlor (d[i][1], d[i][2]); i++;
+ d[i][0] = __builtin_vsx_xxlxor (d[i][1], d[i][2]); i++;
+
+ f[i][0] = __builtin_vsx_xxland (f[i][1], f[i][2]); i++;
+ f[i][0] = __builtin_vsx_xxlandc (f[i][1], f[i][2]); i++;
+ f[i][0] = __builtin_vsx_xxlnor (f[i][1], f[i][2]); i++;
+ f[i][0] = __builtin_vsx_xxlor (f[i][1], f[i][2]); i++;
+ f[i][0] = __builtin_vsx_xxlxor (f[i][1], f[i][2]); i++;
+ return i;
+}
+
+int do_xxsldwi (void)
+{
+ int i = 0;
+
+ si[i][0] = __builtin_vsx_xxsldwi (si[i][1], si[i][2], 0); i++;
+ ss[i][0] = __builtin_vsx_xxsldwi (ss[i][1], ss[i][2], 1); i++;
+ sc[i][0] = __builtin_vsx_xxsldwi (sc[i][1], sc[i][2], 2); i++;
+ ui[i][0] = __builtin_vsx_xxsldwi (ui[i][1], ui[i][2], 3); i++;
+ us[i][0] = __builtin_vsx_xxsldwi (us[i][1], us[i][2], 0); i++;
+ uc[i][0] = __builtin_vsx_xxsldwi (uc[i][1], uc[i][2], 1); i++;
+ f[i][0] = __builtin_vsx_xxsldwi (f[i][1], f[i][2], 2); i++;
+ d[i][0] = __builtin_vsx_xxsldwi (d[i][1], d[i][2], 3); i++;
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-4.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-4.c
new file mode 100644
index 00000000000..bcf486377e8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-4.c
@@ -0,0 +1,142 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+/* { dg-final { scan-assembler "xvcmpeqdp." } } */
+/* { dg-final { scan-assembler "xvcmpgtdp." } } */
+/* { dg-final { scan-assembler "xvcmpgedp." } } */
+/* { dg-final { scan-assembler "xvcmpeqsp." } } */
+/* { dg-final { scan-assembler "xvcmpgtsp." } } */
+/* { dg-final { scan-assembler "xvcmpgesp." } } */
+/* { dg-final { scan-assembler "vcmpbfp." } } */
+/* { dg-final { scan-assembler "vcmpequb." } } */
+/* { dg-final { scan-assembler "vcmpequh." } } */
+/* { dg-final { scan-assembler "vcmpequw." } } */
+/* { dg-final { scan-assembler "vcmpgtub." } } */
+/* { dg-final { scan-assembler "vcmpgtuh." } } */
+/* { dg-final { scan-assembler "vcmpgtuw." } } */
+/* { dg-final { scan-assembler "vcmpgtsb." } } */
+/* { dg-final { scan-assembler "vcmpgtsh." } } */
+/* { dg-final { scan-assembler "vcmpgtsw." } } */
+/* { dg-final { scan-assembler-not "vcmpeqfp" } } */
+/* { dg-final { scan-assembler-not "vcmpgtfp" } } */
+/* { dg-final { scan-assembler-not "vcmpgefp" } } */
+
+/* check that Altivec builtins generate VSX if -mvsx. */
+
+#include <altivec.h>
+
+int *v16qi_s (vector signed char *a, vector signed char *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 2;
+
+ return p;
+}
+
+int *v16qi_u (vector unsigned char *a, vector unsigned char *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 2;
+
+ return p;
+}
+
+int *v8hi_s (vector short *a, vector short *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 2;
+
+ return p;
+}
+
+int *v8hi_u (vector unsigned short *a, vector unsigned short *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 2;
+
+ return p;
+}
+
+int *v4si_s (vector int *a, vector int *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 2;
+
+ return p;
+}
+
+int *v4si_u (vector unsigned int *a, vector unsigned int *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 2;
+
+ return p;
+}
+
+int *v4sf (vector float *a, vector float *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 3;
+
+ if (vec_all_in (*a, *b)) /* veccmpbfp. */
+ *p++ = 4;
+
+ return p;
+}
+
+int *v2df (vector double *a, vector double *b, int *p)
+{
+ if (vec_all_eq (*a, *b))
+ *p++ = 1;
+
+ if (vec_all_gt (*a, *b))
+ *p++ = 2;
+
+ if (vec_all_ge (*a, *b))
+ *p++ = 3;
+
+ return p;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-5.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-5.c
new file mode 100644
index 00000000000..5c24dc618ce
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-5.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+/* { dg-final { scan-assembler "xxpermdi" } } */
+/* { dg-final { scan-assembler-not "stxvd2x" } } */
+
+/* Make sure double extract doesn't use a store instruction. */
+
+double d0(__vector double v){ return __builtin_vec_extract (v, 0); }
+double d1(__vector double v){ return __builtin_vec_extract (v, 1); }
+
+double e0(vector double v){ return __builtin_vec_ext_v2df (v, 0); }
+double e1(vector double v){ return __builtin_vec_ext_v2df (v, 1); }
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-6.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-6.c
new file mode 100644
index 00000000000..a722b83b976
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-6.c
@@ -0,0 +1,146 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+
+/* Check whether tdiv and tsqrt instructions generate the correct code. */
+/* Each of the *tdiv* and *tsqrt* instructions should be generated exactly 3
+ times (the two calls in the _1 function should be combined). */
+/* { dg-final { scan-assembler-times "xstdivdp" 3 } } */
+/* { dg-final { scan-assembler-times "xvtdivdp" 3 } } */
+/* { dg-final { scan-assembler-times "xvtdivsp" 3 } } */
+/* { dg-final { scan-assembler-times "xstsqrtdp" 3 } } */
+/* { dg-final { scan-assembler-times "xvtsqrtdp" 3 } } */
+/* { dg-final { scan-assembler-times "xvtsqrtsp" 3 } } */
+
+void test_div_df_1 (double a, double b, int *p)
+{
+ p[0] = __builtin_vsx_xstdivdp_fe (a, b);
+ p[1] = __builtin_vsx_xstdivdp_fg (a, b);
+}
+
+int *test_div_df_2 (double a, double b, int *p)
+{
+ if (__builtin_vsx_xstdivdp_fe (a, b))
+ *p++ = 1;
+
+ return p;
+}
+
+int *test_div_df_3 (double a, double b, int *p)
+{
+ if (__builtin_vsx_xstdivdp_fg (a, b))
+ *p++ = 1;
+
+ return p;
+}
+
+void test_sqrt_df_1 (double a, int *p)
+{
+ p[0] = __builtin_vsx_xstsqrtdp_fe (a);
+ p[1] = __builtin_vsx_xstsqrtdp_fg (a);
+}
+
+int *test_sqrt_df_2 (double a, int *p)
+{
+ if (__builtin_vsx_xstsqrtdp_fe (a))
+ *p++ = 1;
+
+ return p;
+}
+
+int *test_sqrt_df_3 (double a, int *p)
+{
+ if (__builtin_vsx_xstsqrtdp_fg (a))
+ *p++ = 1;
+
+ return p;
+}
+
+void test_div_v2df_1 (__vector double *a, __vector double *b, int *p)
+{
+ p[0] = __builtin_vsx_xvtdivdp_fe (*a, *b);
+ p[1] = __builtin_vsx_xvtdivdp_fg (*a, *b);
+}
+
+int *test_div_v2df_2 (__vector double *a, __vector double *b, int *p)
+{
+ if (__builtin_vsx_xvtdivdp_fe (*a, *b))
+ *p++ = 1;
+
+ return p;
+}
+
+int *test_div_v2df_3 (__vector double *a, __vector double *b, int *p)
+{
+ if (__builtin_vsx_xvtdivdp_fg (*a, *b))
+ *p++ = 1;
+
+ return p;
+}
+
+void test_sqrt_v2df_1 (__vector double *a, int *p)
+{
+ p[0] = __builtin_vsx_xvtsqrtdp_fe (*a);
+ p[1] = __builtin_vsx_xvtsqrtdp_fg (*a);
+}
+
+int *test_sqrt_v2df_2 (__vector double *a, int *p)
+{
+ if (__builtin_vsx_xvtsqrtdp_fe (*a))
+ *p++ = 1;
+
+ return p;
+}
+
+int *test_sqrt_v2df_3 (__vector double *a, int *p)
+{
+ if (__builtin_vsx_xvtsqrtdp_fg (*a))
+ *p++ = 1;
+
+ return p;
+}
+
+void test_div_v4sf_1 (__vector float *a, __vector float *b, int *p)
+{
+ p[0] = __builtin_vsx_xvtdivsp_fe (*a, *b);
+ p[1] = __builtin_vsx_xvtdivsp_fg (*a, *b);
+}
+
+int *test_div_v4sf_2 (__vector float *a, __vector float *b, int *p)
+{
+ if (__builtin_vsx_xvtdivsp_fe (*a, *b))
+ *p++ = 1;
+
+ return p;
+}
+
+int *test_div_v4sf_3 (__vector float *a, __vector float *b, int *p)
+{
+ if (__builtin_vsx_xvtdivsp_fg (*a, *b))
+ *p++ = 1;
+
+ return p;
+}
+
+void test_sqrt_v4sf_1 (__vector float *a, int *p)
+{
+ p[0] = __builtin_vsx_xvtsqrtsp_fe (*a);
+ p[1] = __builtin_vsx_xvtsqrtsp_fg (*a);
+}
+
+int *test_sqrt_v4sf_2 (__vector float *a, int *p)
+{
+ if (__builtin_vsx_xvtsqrtsp_fe (*a))
+ *p++ = 1;
+
+ return p;
+}
+
+int *test_sqrt_v4sf_3 (__vector float *a, int *p)
+{
+ if (__builtin_vsx_xvtsqrtsp_fg (*a))
+ *p++ = 1;
+
+ return p;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
new file mode 100644
index 00000000000..55e999d3851
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-7.c
@@ -0,0 +1,150 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -mcpu=power7" } */
+
+/* Test simple extract/insert/slat operations. Make sure all types are
+ supported with various options. */
+
+#include <altivec.h>
+
+double extract_df_0_reg (vector double p) { return vec_extract (p, 0); }
+double extract_df_1_reg (vector double p) { return vec_extract (p, 1); }
+double extract_df_n_reg (vector double p, int n) { return vec_extract (p, n); }
+
+double extract_df_0_mem (vector double *p) { return vec_extract (*p, 0); }
+double extract_df_1_mem (vector double *p) { return vec_extract (*p, 1); }
+double extract_df_n_mem (vector double *p, int n) { return vec_extract (*p, n); }
+
+vector double insert_df_0 (vector double p, double x) { return vec_insert (x, p, 0); }
+vector double insert_df_1 (vector double p, double x) { return vec_insert (x, p, 1); }
+vector double insert_df_n (vector double p, double x, int n) { return vec_insert (x, p, n); }
+
+vector double splat_df_reg (double x) { return vec_splats (x); }
+vector double splat_df_mem (double *x) { return vec_splats (*x); }
+
+#ifdef _ARCH_PPC64
+#define ll long
+#else
+#define ll long long
+#endif
+
+ll extract_di_0_reg (vector ll p) { return vec_extract (p, 0); }
+ll extract_di_1_reg (vector ll p) { return vec_extract (p, 1); }
+ll extract_di_n_reg (vector ll p, int n) { return vec_extract (p, n); }
+
+ll extract_di_0_mem (vector ll *p) { return vec_extract (*p, 0); }
+ll extract_di_1_mem (vector ll *p) { return vec_extract (*p, 1); }
+ll extract_di_n_mem (vector ll *p, int n) { return vec_extract (*p, n); }
+
+vector ll insert_di_0 (vector ll p, ll x) { return vec_insert (x, p, 0); }
+vector ll insert_di_1 (vector ll p, ll x) { return vec_insert (x, p, 1); }
+vector ll insert_di_n (vector ll p, ll x, int n) { return vec_insert (x, p, n); }
+
+vector ll splat_di_reg (ll x) { return vec_splats (x); }
+vector ll splat_di_mem (ll *x) { return vec_splats (*x); }
+
+float extract_sf_0_reg (vector float p) { return vec_extract (p, 0); }
+float extract_sf_3_reg (vector float p) { return vec_extract (p, 3); }
+float extract_sf_n_reg (vector float p, int n) { return vec_extract (p, n); }
+
+float extract_sf_0_mem (vector float *p) { return vec_extract (*p, 0); }
+float extract_sf_3_mem (vector float *p) { return vec_extract (*p, 3); }
+float extract_sf_n_mem (vector float *p, int n) { return vec_extract (*p, n); }
+
+vector float insert_sf_0 (vector float p, float x) { return vec_insert (x, p, 0); }
+vector float insert_sf_3 (vector float p, float x) { return vec_insert (x, p, 3); }
+vector float insert_sf_n (vector float p, float x, int n) { return vec_insert (x, p, n); }
+
+vector float splat_sf_reg (float x) { return vec_splats (x); }
+vector float splat_sf_mem (float *x) { return vec_splats (*x); }
+
+int extract_si_0_reg (vector int p) { return vec_extract (p, 0); }
+int extract_si_3_reg (vector int p) { return vec_extract (p, 3); }
+int extract_si_n_reg (vector int p, int n) { return vec_extract (p, n); }
+
+int extract_si_0_mem (vector int *p) { return vec_extract (*p, 0); }
+int extract_si_3_mem (vector int *p) { return vec_extract (*p, 3); }
+int extract_si_n_mem (vector int *p, int n) { return vec_extract (*p, n); }
+
+vector int insert_si_0 (vector int p, int x) { return vec_insert (x, p, 0); }
+vector int insert_si_3 (vector int p, int x) { return vec_insert (x, p, 3); }
+vector int insert_si_n (vector int p, int x, int n) { return vec_insert (x, p, n); }
+
+vector int splat_si_reg (int x) { return vec_splats (x); }
+vector int splat_si_mem (int *x) { return vec_splats (*x); }
+
+unsigned int extract_usi_0_reg (vector unsigned int p) { return vec_extract (p, 0); }
+unsigned int extract_usi_3_reg (vector unsigned int p) { return vec_extract (p, 3); }
+unsigned int extract_usi_n_reg (vector unsigned int p, int n) { return vec_extract (p, n); }
+
+unsigned int extract_usi_0_mem (vector unsigned int *p) { return vec_extract (*p, 0); }
+unsigned int extract_usi_3_mem (vector unsigned int *p) { return vec_extract (*p, 3); }
+unsigned int extract_usi_n_mem (vector unsigned int *p, int n) { return vec_extract (*p, n); }
+
+vector unsigned int insert_usi_0 (vector unsigned int p, unsigned int x) { return vec_insert (x, p, 0); }
+vector unsigned int insert_usi_3 (vector unsigned int p, unsigned int x) { return vec_insert (x, p, 3); }
+vector unsigned int insert_usi_n (vector unsigned int p, unsigned int x, int n) { return vec_insert (x, p, n); }
+
+vector unsigned int splat_usi_reg (unsigned int x) { return vec_splats (x); }
+vector unsigned int splat_usi_mem (unsigned int *x) { return vec_splats (*x); }
+
+short extract_hi_0_reg (vector short p) { return vec_extract (p, 0); }
+short extract_hi_7_reg (vector short p) { return vec_extract (p, 7); }
+short extract_hi_n_reg (vector short p, int n) { return vec_extract (p, n); }
+
+short extract_hi_0_mem (vector short *p) { return vec_extract (*p, 0); }
+short extract_hi_7_mem (vector short *p) { return vec_extract (*p, 7); }
+short extract_hi_n_mem (vector short *p, int n) { return vec_extract (*p, n); }
+
+vector short insert_hi_0 (vector short p, short x) { return vec_insert (x, p, 0); }
+vector short insert_hi_7 (vector short p, short x) { return vec_insert (x, p, 7); }
+vector short insert_hi_n (vector short p, short x, int n) { return vec_insert (x, p, n); }
+
+vector short splat_hi_reg (short x) { return vec_splats (x); }
+vector short splat_hi_mem (short *x) { return vec_splats (*x); }
+
+unsigned short extract_uhi_0_reg (vector unsigned short p) { return vec_extract (p, 0); }
+unsigned short extract_uhi_7_reg (vector unsigned short p) { return vec_extract (p, 7); }
+unsigned short extract_uhi_n_reg (vector unsigned short p, int n) { return vec_extract (p, n); }
+
+unsigned short extract_uhi_0_mem (vector unsigned short *p) { return vec_extract (*p, 0); }
+unsigned short extract_uhi_7_mem (vector unsigned short *p) { return vec_extract (*p, 7); }
+unsigned short extract_uhi_n_mem (vector unsigned short *p, int n) { return vec_extract (*p, n); }
+
+vector unsigned short insert_uhi_0 (vector unsigned short p, unsigned short x) { return vec_insert (x, p, 0); }
+vector unsigned short insert_uhi_7 (vector unsigned short p, unsigned short x) { return vec_insert (x, p, 7); }
+vector unsigned short insert_uhi_n (vector unsigned short p, unsigned short x, int n) { return vec_insert (x, p, n); }
+
+vector unsigned short splat_uhi_reg (unsigned short x) { return vec_splats (x); }
+vector unsigned short splat_uhi_mem (unsigned short *x) { return vec_splats (*x); }
+
+signed char extract_qi_0_reg (vector signed char p) { return vec_extract (p, 0); }
+signed char extract_qi_1_reg5 (vector signed char p) { return vec_extract (p, 15); }
+signed char extract_qi_n_reg (vector signed char p, int n) { return vec_extract (p, n); }
+
+signed char extract_qi_0_mem (vector signed char *p) { return vec_extract (*p, 0); }
+signed char extract_qi_1_mem5 (vector signed char *p) { return vec_extract (*p, 15); }
+signed char extract_qi_n_mem (vector signed char *p, int n) { return vec_extract (*p, n); }
+
+vector signed char insert_qi_0 (vector signed char p, signed char x) { return vec_insert (x, p, 0); }
+vector signed char insert_qi_15 (vector signed char p, signed char x) { return vec_insert (x, p, 15); }
+vector signed char insert_qi_n (vector signed char p, signed char x, int n) { return vec_insert (x, p, n); }
+
+vector signed char splat_qi_reg (signed char x) { return vec_splats (x); }
+vector signed char splat_qi_mem (signed char *x) { return vec_splats (*x); }
+
+unsigned char extract_uqi_0_reg (vector unsigned char p) { return vec_extract (p, 0); }
+unsigned char extract_uqi_1_reg5 (vector unsigned char p) { return vec_extract (p, 15); }
+unsigned char extract_uqi_n_reg (vector unsigned char p, int n) { return vec_extract (p, n); }
+
+unsigned char extract_uqi_0_mem (vector unsigned char *p) { return vec_extract (*p, 0); }
+unsigned char extract_uqi_1_mem5 (vector unsigned char *p) { return vec_extract (*p, 15); }
+unsigned char extract_uqi_n_mem (vector unsigned char *p, int n) { return vec_extract (*p, n); }
+
+vector unsigned char insert_uqi_0 (vector unsigned char p, unsigned char x) { return vec_insert (x, p, 0); }
+vector unsigned char insert_uqi_15 (vector unsigned char p, unsigned char x) { return vec_insert (x, p, 15); }
+vector unsigned char insert_uqi_n (vector unsigned char p, unsigned char x, int n) { return vec_insert (x, p, n); }
+
+vector unsigned char splat_uqi_reg (unsigned char x) { return vec_splats (x); }
+vector unsigned char splat_uqi_mem (unsigned char *x) { return vec_splats (*x); }
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-1.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-1.c
new file mode 100644
index 00000000000..0bf3a7f53a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-1.c
@@ -0,0 +1,152 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -ftree-vectorize -mcpu=power7 -m64 -ffast-math" } */
+/* { dg-final { scan-assembler "xvadddp" } } */
+/* { dg-final { scan-assembler "xvsubdp" } } */
+/* { dg-final { scan-assembler "xvmuldp" } } */
+/* { dg-final { scan-assembler "xvdivdp" } } */
+/* { dg-final { scan-assembler "xvmadd" } } */
+/* { dg-final { scan-assembler "xvmsub" } } */
+/* { dg-final { scan-assembler "xvsqrtdp" } } */
+/* { dg-final { scan-assembler "xvcpsgndp" } } */
+/* { dg-final { scan-assembler "xvrdpim" } } */
+/* { dg-final { scan-assembler "xvrdpip" } } */
+/* { dg-final { scan-assembler "xvrdpiz" } } */
+/* { dg-final { scan-assembler "xvrdpic" } } */
+/* { dg-final { scan-assembler "xvrdpi " } } */
+
+#ifndef SIZE
+#define SIZE 1024
+#endif
+
+double a[SIZE] __attribute__((__aligned__(32)));
+double b[SIZE] __attribute__((__aligned__(32)));
+double c[SIZE] __attribute__((__aligned__(32)));
+double d[SIZE] __attribute__((__aligned__(32)));
+double e[SIZE] __attribute__((__aligned__(32)));
+
+void
+vector_add (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] + c[i];
+}
+
+void
+vector_subtract (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] - c[i];
+}
+
+void
+vector_multiply (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] * c[i];
+}
+
+void
+vector_multiply_add (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = (b[i] * c[i]) + d[i];
+}
+
+void
+vector_multiply_subtract (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = (b[i] * c[i]) - d[i];
+}
+
+void
+vector_divide (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] / c[i];
+}
+
+extern double sqrt (double);
+extern double floor (double);
+extern double ceil (double);
+extern double trunc (double);
+extern double nearbyint (double);
+extern double rint (double);
+extern double copysign (double, double);
+
+void
+vector_sqrt (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = sqrt (b[i]);
+}
+
+void
+vector_floor (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = floor (b[i]);
+}
+
+void
+vector_ceil (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = ceil (b[i]);
+}
+
+void
+vector_trunc (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = trunc (b[i]);
+}
+
+void
+vector_nearbyint (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = nearbyint (b[i]);
+}
+
+void
+vector_rint (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = rint (b[i]);
+}
+
+void
+vector_copysign (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = copysign (b[i], c[i]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-2.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-2.c
new file mode 100644
index 00000000000..ba27b46fb27
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-2.c
@@ -0,0 +1,152 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -ftree-vectorize -mcpu=power7 -m64 -ffast-math" } */
+/* { dg-final { scan-assembler "xvaddsp" } } */
+/* { dg-final { scan-assembler "xvsubsp" } } */
+/* { dg-final { scan-assembler "xvmulsp" } } */
+/* { dg-final { scan-assembler "xvdivsp" } } */
+/* { dg-final { scan-assembler "xvmadd" } } */
+/* { dg-final { scan-assembler "xvmsub" } } */
+/* { dg-final { scan-assembler "xvsqrtsp" } } */
+/* { dg-final { scan-assembler "xvcpsgnsp" } } */
+/* { dg-final { scan-assembler "xvrspim" } } */
+/* { dg-final { scan-assembler "xvrspip" } } */
+/* { dg-final { scan-assembler "xvrspiz" } } */
+/* { dg-final { scan-assembler "xvrspic" } } */
+/* { dg-final { scan-assembler "xvrspi " } } */
+
+#ifndef SIZE
+#define SIZE 1024
+#endif
+
+float a[SIZE] __attribute__((__aligned__(32)));
+float b[SIZE] __attribute__((__aligned__(32)));
+float c[SIZE] __attribute__((__aligned__(32)));
+float d[SIZE] __attribute__((__aligned__(32)));
+float e[SIZE] __attribute__((__aligned__(32)));
+
+void
+vector_add (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] + c[i];
+}
+
+void
+vector_subtract (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] - c[i];
+}
+
+void
+vector_multiply (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] * c[i];
+}
+
+void
+vector_multiply_add (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = (b[i] * c[i]) + d[i];
+}
+
+void
+vector_multiply_subtract (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = (b[i] * c[i]) - d[i];
+}
+
+void
+vector_divide (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] / c[i];
+}
+
+extern float sqrtf (float);
+extern float floorf (float);
+extern float ceilf (float);
+extern float truncf (float);
+extern float nearbyintf (float);
+extern float rintf (float);
+extern float copysignf (float, float);
+
+void
+vector_sqrt (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = sqrtf (b[i]);
+}
+
+void
+vector_floor (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = floorf (b[i]);
+}
+
+void
+vector_ceil (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = ceilf (b[i]);
+}
+
+void
+vector_trunc (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = truncf (b[i]);
+}
+
+void
+vector_nearbyint (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = nearbyintf (b[i]);
+}
+
+void
+vector_rint (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = rintf (b[i]);
+}
+
+void
+vector_copysign (void)
+{
+ int i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = copysignf (b[i], c[i]);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-3.c
new file mode 100644
index 00000000000..5f3bf5b4b2c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-3.c
@@ -0,0 +1,48 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -ftree-vectorize -mcpu=power7 -m64" } */
+/* { dg-final { scan-assembler "xvadddp" } } */
+/* { dg-final { scan-assembler "xvsubdp" } } */
+/* { dg-final { scan-assembler "xvmuldp" } } */
+/* { dg-final { scan-assembler "xvdivdp" } } */
+/* { dg-final { scan-assembler "xvmadd" } } */
+/* { dg-final { scan-assembler "xvmsub" } } */
+
+__vector double a, b, c, d;
+
+void
+vector_add (void)
+{
+ a = b + c;
+}
+
+void
+vector_subtract (void)
+{
+ a = b - c;
+}
+
+void
+vector_multiply (void)
+{
+ a = b * c;
+}
+
+void
+vector_multiply_add (void)
+{
+ a = (b * c) + d;
+}
+
+void
+vector_multiply_subtract (void)
+{
+ a = (b * c) - d;
+}
+
+void
+vector_divide (void)
+{
+ a = b / c;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-4.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-4.c
new file mode 100644
index 00000000000..a34ba8f7de3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-4.c
@@ -0,0 +1,48 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -ftree-vectorize -mcpu=power7 -m64" } */
+/* { dg-final { scan-assembler "xvaddsp" } } */
+/* { dg-final { scan-assembler "xvsubsp" } } */
+/* { dg-final { scan-assembler "xvmulsp" } } */
+/* { dg-final { scan-assembler "xvdivsp" } } */
+/* { dg-final { scan-assembler "xvmadd" } } */
+/* { dg-final { scan-assembler "xvmsub" } } */
+
+__vector float a, b, c, d;
+
+void
+vector_add (void)
+{
+ a = b + c;
+}
+
+void
+vector_subtract (void)
+{
+ a = b - c;
+}
+
+void
+vector_multiply (void)
+{
+ a = b * c;
+}
+
+void
+vector_multiply_add (void)
+{
+ a = (b * c) + d;
+}
+
+void
+vector_multiply_subtract (void)
+{
+ a = (b * c) - d;
+}
+
+void
+vector_divide (void)
+{
+ a = b / c;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-5.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-5.c
new file mode 100644
index 00000000000..65843e93fbd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-5.c
@@ -0,0 +1,392 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O2" } */
+
+/* This will run, and someday we should add the support to test whether we are
+ running on VSX hardware. */
+
+#include <altivec.h>
+#include <stdlib.h>
+
+#ifdef DEBUG
+#include <stdio.h>
+
+static int errors = 0;
+#endif
+
+union args {
+ double scalar[2];
+ vector double vect;
+};
+
+union largs {
+ unsigned long scalar[2];
+ vector bool long vect;
+};
+
+static void
+do_test (union args *expected, union args *got, const char *name)
+{
+ if (expected->scalar[0] != got->scalar[0]
+ || expected->scalar[1] != got->scalar[1])
+ {
+#ifdef DEBUG
+ printf ("%s failed!\n", name);
+ errors++;
+#else
+ abort ();
+#endif
+ }
+}
+
+static void
+do_ltest (union largs *expected, union largs *got, const char *name)
+{
+ if (expected->scalar[0] != got->scalar[0]
+ || expected->scalar[1] != got->scalar[1])
+ {
+#ifdef DEBUG
+ printf ("%s failed!\n", name);
+ errors++;
+#else
+ abort ();
+#endif
+ }
+}
+
+
+/* Vec functions taking a single argument. */
+static vector double
+vabs (vector double arg)
+{
+ return vec_abs (arg);
+}
+
+static vector double
+vceil (vector double arg)
+{
+ return vec_ceil (arg);
+}
+
+static vector double
+vfloor (vector double arg)
+{
+ return vec_floor (arg);
+}
+
+static vector double
+vnearbyint (vector double arg)
+{
+ return vec_nearbyint (arg);
+}
+
+static vector double
+vrint (vector double arg)
+{
+ return vec_rint (arg);
+}
+
+static vector double
+vsqrt (vector double arg)
+{
+ return vec_sqrt (arg);
+}
+
+/* Single argument tests. */
+static struct
+{
+ union args result;
+ union args input;
+ vector double (*func) (vector double);
+ const char *name;
+} arg1_tests[] = {
+ /* result input function name */
+ { { 1.0, 2.0 }, { -1.0, 2.0 }, vabs, "vabs" },
+ { { 1.0, 2.0 }, { 1.0, -2.0 }, vabs, "vabs" },
+ { { 2.0, 2.0 }, { 1.1, 1.7 }, vceil, "vceil" },
+ { { -1.0, -1.0 }, { -1.1, -1.7 }, vceil, "vceil" },
+ { { -1.0, 2.0 }, { -1.5, 1.5 }, vceil, "vceil" },
+ { { 1.0, 1.0 }, { 1.1, 1.7 }, vfloor, "vfloor" },
+ { { -2.0, -2.0 }, { -1.1, -1.7 }, vfloor, "vfloor" },
+ { { -2.0, 1.0 }, { -1.5, 1.5 }, vfloor, "vfloor" },
+ { { 1.0, 2.0 }, { 1.1, 1.7 }, vnearbyint, "vnearbyint" },
+ { { -1.0, -2.0 }, { -1.1, -1.7 }, vnearbyint, "vnearbyint" },
+ { { -2.0, 2.0 }, { -1.5, 1.5 }, vnearbyint, "vnearbyint" },
+ { { 1.0, 2.0 }, { 1.1, 1.7 }, vrint, "vrint" },
+ { { -1.0, -2.0 }, { -1.1, -1.7 }, vrint, "vrint" },
+ { { -2.0, 2.0 }, { -1.5, 1.5 }, vrint, "vrint" },
+ { { 2.0, 4.0 }, { 4.0, 16.0 }, vsqrt, "vsqrt" },
+};
+
+static void
+test_arg1 (void)
+{
+ unsigned i;
+
+#ifdef DEBUG
+ printf ("Single argument tests:\n");
+#endif
+
+ for (i = 0; i < sizeof (arg1_tests) / sizeof (arg1_tests[0]); i++)
+ {
+ union args u;
+ u.vect = arg1_tests[i].func (arg1_tests[i].input.vect);
+
+#ifdef DEBUG
+ printf ("test %-16s: expected { %4g, %4g }, got { %4g, %4g }, input { %4g, %4g }\n",
+ arg1_tests[i].name,
+ arg1_tests[i].result.scalar[0],
+ arg1_tests[i].result.scalar[1],
+ u.scalar[0],
+ u.scalar[1],
+ arg1_tests[i].input.scalar[0],
+ arg1_tests[i].input.scalar[1]);
+#endif
+
+ do_test (&arg1_tests[i].result, &u, arg1_tests[i].name);
+ }
+
+ return;
+}
+
+
+/* Vect functions taking 2 arguments. */
+static vector double
+vadd (vector double arg1, vector double arg2)
+{
+ return vec_add (arg1, arg2);
+}
+
+static vector double
+vadd2 (vector double arg1, vector double arg2)
+{
+ return arg1 + arg2;
+}
+
+static vector double
+vsub (vector double arg1, vector double arg2)
+{
+ return vec_sub (arg1, arg2);
+}
+
+static vector double
+vsub2 (vector double arg1, vector double arg2)
+{
+ return arg1 - arg2;
+}
+
+static vector double
+vmul (vector double arg1, vector double arg2)
+{
+ return vec_mul (arg1, arg2);
+}
+
+static vector double
+vmul2 (vector double arg1, vector double arg2)
+{
+ return arg1 * arg2;
+}
+
+static vector double
+vdiv (vector double arg1, vector double arg2)
+{
+ return vec_div (arg1, arg2);
+}
+
+static vector double
+vdiv2 (vector double arg1, vector double arg2)
+{
+ return arg1 / arg2;
+}
+
+static vector double
+vmax (vector double arg1, vector double arg2)
+{
+ return vec_max (arg1, arg2);
+}
+
+static vector double
+vmin (vector double arg1, vector double arg2)
+{
+ return vec_min (arg1, arg2);
+}
+
+/* 2 argument tests. */
+static struct
+{
+ union args result;
+ union args input[2];
+ vector double (*func) (vector double, vector double);
+ const char *name;
+} arg2_tests[] = {
+ /* result */
+ { { 4.0, 6.0 }, { { 1.0, 2.0 }, { 3.0, 4.0 } }, vadd, "vadd" },
+ { { 4.0, -6.0 }, { { 1.0, -2.0 }, { 3.0, -4.0 } }, vadd, "vadd" },
+ { { 4.0, 6.0 }, { { 1.0, 2.0 }, { 3.0, 4.0 } }, vadd2, "vadd2" },
+ { { 4.0, -6.0 }, { { 1.0, -2.0 }, { 3.0, -4.0 } }, vadd2, "vadd2" },
+ { { -2.0, -2.0 }, { { 1.0, 2.0 }, { 3.0, 4.0 } }, vsub, "vsub" },
+ { { -2.0, 2.0 }, { { 1.0, -2.0 }, { 3.0, -4.0 } }, vsub, "vsub" },
+ { { -2.0, -2.0 }, { { 1.0, 2.0 }, { 3.0, 4.0 } }, vsub2, "vsub2" },
+ { { -2.0, 2.0 }, { { 1.0, -2.0 }, { 3.0, -4.0 } }, vsub2, "vsub2" },
+ { { 6.0, 4.0 }, { { 2.0, 8.0 }, { 3.0, 0.5 } }, vmul, "vmul" },
+ { { 6.0, 4.0 }, { { 2.0, 8.0 }, { 3.0, 0.5 } }, vmul2, "vmul2" },
+ { { 2.0, 0.5 }, { { 6.0, 4.0 }, { 3.0, 8.0 } }, vdiv, "vdiv" },
+ { { 2.0, 0.5 }, { { 6.0, 4.0 }, { 3.0, 8.0 } }, vdiv2, "vdiv2" },
+ { { 3.0, 4.0 }, { { 1.0, 2.0 }, { 3.0, 4.0 } }, vmax, "vmax" },
+ { { 1.0, 4.0 }, { { 1.0, -2.0 }, { -3.0, 4.0 } }, vmax, "vmax" },
+ { { 1.0, 2.0 }, { { 1.0, 2.0 }, { 3.0, 4.0 } }, vmin, "vmin" },
+ { { -3.0, -2.0 }, { { 1.0, -2.0 }, { -3.0, 4.0 } }, vmin, "vmin" },
+};
+
+static void
+test_arg2 (void)
+{
+ unsigned i;
+
+#ifdef DEBUG
+ printf ("\nTwo argument tests:\n");
+#endif
+
+ for (i = 0; i < sizeof (arg2_tests) / sizeof (arg2_tests[0]); i++)
+ {
+ union args u;
+ u.vect = arg2_tests[i].func (arg2_tests[i].input[0].vect,
+ arg2_tests[i].input[1].vect);
+
+#ifdef DEBUG
+ printf ("test %-16s: expected { %4g, %4g }, got { %4g, %4g }, input { %4g, %4g }, { %4g, %4g }\n",
+ arg2_tests[i].name,
+ arg2_tests[i].result.scalar[0],
+ arg2_tests[i].result.scalar[1],
+ u.scalar[0],
+ u.scalar[1],
+ arg2_tests[i].input[0].scalar[0],
+ arg2_tests[i].input[0].scalar[1],
+ arg2_tests[i].input[1].scalar[0],
+ arg2_tests[i].input[1].scalar[1]);
+#endif
+
+ do_test (&arg2_tests[i].result, &u, arg2_tests[i].name);
+ }
+
+ return;
+}
+
+
+/* Comparisons, returnning a boolean vector. */
+static vector bool long
+vcmpeq (vector double arg1, vector double arg2)
+{
+ return vec_cmpeq (arg1, arg2);
+}
+
+static vector bool long
+vcmplt (vector double arg1, vector double arg2)
+{
+ return vec_cmplt (arg1, arg2);
+}
+
+static vector bool long
+vcmple (vector double arg1, vector double arg2)
+{
+ return vec_cmple (arg1, arg2);
+}
+
+static vector bool long
+vcmpgt (vector double arg1, vector double arg2)
+{
+ return vec_cmpgt (arg1, arg2);
+}
+
+static vector bool long
+vcmpge (vector double arg1, vector double arg2)
+{
+ return vec_cmpge (arg1, arg2);
+}
+
+#define ONE 0xffffffffffffffffUL
+#define ZERO 0x0000000000000000UL
+
+/* comparison tests. */
+static struct
+{
+ union largs result;
+ union args input[2];
+ vector bool long (*func) (vector double, vector double);
+ const char *name;
+} argcmp_tests[] = {
+ { { ONE, ZERO }, { { 1.0, 2.0 }, { 1.0, -2.0 } }, vcmpeq, "vcmpeq" },
+ { { ZERO, ONE }, { { -1.0, 2.0 }, { 1.0, 2.0 } }, vcmpeq, "vcmpeq" },
+
+ { { ONE, ONE }, { { 1.0, -2.0 }, { 1.0, -2.0 } }, vcmple, "vcmple" },
+ { { ONE, ONE }, { { 1.0, -2.0 }, { 2.0, -1.0 } }, vcmple, "vcmple" },
+ { { ZERO, ZERO }, { { 2.0, -1.0 }, { 1.0, -2.0 } }, vcmple, "vcmple" },
+
+ { { ZERO, ZERO }, { { 1.0, -2.0 }, { 1.0, -2.0 } }, vcmplt, "vcmplt" },
+ { { ONE, ONE }, { { 1.0, -2.0 }, { 2.0, -1.0 } }, vcmplt, "vcmplt" },
+ { { ZERO, ZERO }, { { 2.0, -1.0 }, { 1.0, -2.0 } }, vcmplt, "vcmplt" },
+
+ { { ZERO, ZERO }, { { 1.0, -2.0 }, { 1.0, -2.0 } }, vcmpgt, "vcmpgt" },
+ { { ZERO, ZERO }, { { 1.0, -2.0 }, { 2.0, -1.0 } }, vcmpgt, "vcmpgt" },
+ { { ONE, ONE }, { { 2.0, -1.0 }, { 1.0, -2.0 } }, vcmpgt, "vcmpgt" },
+
+ { { ONE, ONE }, { { 1.0, -2.0 }, { 1.0, -2.0 } }, vcmpge, "vcmpge" },
+ { { ZERO, ZERO }, { { 1.0, -2.0 }, { 2.0, -1.0 } }, vcmpge, "vcmpge" },
+ { { ONE, ONE }, { { 2.0, -1.0 }, { 1.0, -2.0 } }, vcmpge, "vcmpge" },
+};
+
+static void
+test_argcmp (void)
+{
+ unsigned i;
+
+#ifdef DEBUG
+ printf ("\nComparison tests:\n");
+#endif
+
+ for (i = 0; i < sizeof (argcmp_tests) / sizeof (argcmp_tests[0]); i++)
+ {
+ union largs u;
+ u.vect = argcmp_tests[i].func (argcmp_tests[i].input[0].vect,
+ argcmp_tests[i].input[1].vect);
+
+#ifdef DEBUG
+ printf ("test %-16s: expected { 0x%016lx, 0x%016lx }, got { 0x%016lx, 0x%016lx }, input { %4g, %4g }, { %4g, %4g }\n",
+ argcmp_tests[i].name,
+ argcmp_tests[i].result.scalar[0],
+ argcmp_tests[i].result.scalar[1],
+ u.scalar[0],
+ u.scalar[1],
+ argcmp_tests[i].input[0].scalar[0],
+ argcmp_tests[i].input[0].scalar[1],
+ argcmp_tests[i].input[1].scalar[0],
+ argcmp_tests[i].input[1].scalar[1]);
+#endif
+
+ do_ltest (&argcmp_tests[i].result, &u, argcmp_tests[i].name);
+ }
+
+ return;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ test_arg1 ();
+ test_arg2 ();
+ test_argcmp ();
+
+#ifdef DEBUG
+ if (errors)
+ {
+ printf ("There were %d error(s)\n", errors);
+ return errors;
+ }
+ else
+ printf ("There were no errors\n");
+#endif
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.c b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.c
new file mode 100644
index 00000000000..f8e644bb532
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-vector-6.c
@@ -0,0 +1,81 @@
+/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-mvsx -O2" } */
+
+#include <altivec.h>
+
+void foo (vector double *out, vector double *in, vector long *p_l, vector bool long *p_b, vector unsigned char *p_uc, int *i)
+{
+ vector double in0 = in[0];
+ vector double in1 = in[1];
+ vector double in2 = in[2];
+ vector long inl = *p_l;
+ vector bool long inb = *p_b;
+ vector unsigned char uc = *p_uc;
+
+ *out++ = vec_abs (in0);
+ *out++ = vec_add (in0, in1);
+ *out++ = vec_and (in0, in1);
+ *out++ = vec_and (in0, inb);
+ *out++ = vec_and (inb, in0);
+ *out++ = vec_andc (in0, in1);
+ *out++ = vec_andc (in0, inb);
+ *out++ = vec_andc (inb, in0);
+ *out++ = vec_ceil (in0);
+ *p_b++ = vec_cmpeq (in0, in1);
+ *p_b++ = vec_cmpgt (in0, in1);
+ *p_b++ = vec_cmpge (in0, in1);
+ *p_b++ = vec_cmplt (in0, in1);
+ *p_b++ = vec_cmple (in0, in1);
+ *out++ = vec_div (in0, in1);
+ *out++ = vec_floor (in0);
+ *out++ = vec_madd (in0, in1, in2);
+ *out++ = vec_msub (in0, in1, in2);
+ *out++ = vec_max (in0, in1);
+ *out++ = vec_min (in0, in1);
+ *out++ = vec_msub (in0, in1, in2);
+ *out++ = vec_mul (in0, in1);
+ *out++ = vec_nearbyint (in0);
+ *out++ = vec_nmadd (in0, in1, in2);
+ *out++ = vec_nmsub (in0, in1, in2);
+ *out++ = vec_nor (in0, in1);
+ *out++ = vec_or (in0, in1);
+ *out++ = vec_or (in0, inb);
+ *out++ = vec_or (inb, in0);
+ *out++ = vec_perm (in0, in1, uc);
+ *out++ = vec_rint (in0);
+ *out++ = vec_sel (in0, in1, inl);
+ *out++ = vec_sel (in0, in1, inb);
+ *out++ = vec_sub (in0, in1);
+ *out++ = vec_sqrt (in0);
+ *out++ = vec_trunc (in0);
+ *out++ = vec_xor (in0, in1);
+ *out++ = vec_xor (in0, inb);
+ *out++ = vec_xor (inb, in0);
+
+ *i++ = vec_all_eq (in0, in1);
+ *i++ = vec_all_ge (in0, in1);
+ *i++ = vec_all_gt (in0, in1);
+ *i++ = vec_all_le (in0, in1);
+ *i++ = vec_all_lt (in0, in1);
+ *i++ = vec_all_nan (in0);
+ *i++ = vec_all_ne (in0, in1);
+ *i++ = vec_all_nge (in0, in1);
+ *i++ = vec_all_ngt (in0, in1);
+ *i++ = vec_all_nle (in0, in1);
+ *i++ = vec_all_nlt (in0, in1);
+ *i++ = vec_all_numeric (in0);
+ *i++ = vec_any_eq (in0, in1);
+ *i++ = vec_any_ge (in0, in1);
+ *i++ = vec_any_gt (in0, in1);
+ *i++ = vec_any_le (in0, in1);
+ *i++ = vec_any_lt (in0, in1);
+ *i++ = vec_any_nan (in0);
+ *i++ = vec_any_ne (in0, in1);
+ *i++ = vec_any_nge (in0, in1);
+ *i++ = vec_any_ngt (in0, in1);
+ *i++ = vec_any_nle (in0, in1);
+ *i++ = vec_any_nlt (in0, in1);
+ *i++ = vec_any_numeric (in0);
+}
diff --git a/gcc/testsuite/gfortran.dg/aliasing_dummy_1.f90 b/gcc/testsuite/gfortran.dg/aliasing_dummy_1.f90
index 0d0b588fc10..686853a1c08 100644
--- a/gcc/testsuite/gfortran.dg/aliasing_dummy_1.f90
+++ b/gcc/testsuite/gfortran.dg/aliasing_dummy_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! This tests the fix for PR24276, which originated from the Loren P. Meissner example,
! Array_List. The PR concerns dummy argument aliassing of components of arrays of derived
! types as arrays of the type of the component. gfortran would compile and run this
@@ -61,4 +63,5 @@ contains
write (slist(1,1), '(2hi=,i3)') i
end subroutine foo3
-end program test_lex \ No newline at end of file
+end program test_lex
+
diff --git a/gcc/testsuite/gfortran.dg/altreturn_3.f90 b/gcc/testsuite/gfortran.dg/altreturn_3.f90
index 999ada87a07..daa09017859 100644
--- a/gcc/testsuite/gfortran.dg/altreturn_3.f90
+++ b/gcc/testsuite/gfortran.dg/altreturn_3.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for PR30236, which was due to alternate returns
! in generic interfaces causing a segfault. They now work
! correctly.
diff --git a/gcc/testsuite/gfortran.dg/altreturn_5.f90 b/gcc/testsuite/gfortran.dg/altreturn_5.f90
index ff1b82289f6..a8b6ff83cd1 100644
--- a/gcc/testsuite/gfortran.dg/altreturn_5.f90
+++ b/gcc/testsuite/gfortran.dg/altreturn_5.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for PR31483, in which dummy argument procedures
! produced an ICE if they had an alternate return.
!
diff --git a/gcc/testsuite/gfortran.dg/altreturn_6.f90 b/gcc/testsuite/gfortran.dg/altreturn_6.f90
index 61f5f605990..19c851e5092 100644
--- a/gcc/testsuite/gfortran.dg/altreturn_6.f90
+++ b/gcc/testsuite/gfortran.dg/altreturn_6.f90
@@ -1,3 +1,6 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR 32938
subroutine r (*)
integer(kind=8) :: i
diff --git a/gcc/testsuite/gfortran.dg/altreturn_7.f90 b/gcc/testsuite/gfortran.dg/altreturn_7.f90
index 6eb0c78bde7..d1786d038c8 100644
--- a/gcc/testsuite/gfortran.dg/altreturn_7.f90
+++ b/gcc/testsuite/gfortran.dg/altreturn_7.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
!
! PR 40848: [4.5 Regression] ICE with alternate returns
!
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_13.f90 b/gcc/testsuite/gfortran.dg/array_constructor_13.f90
index bacc6fffc38..74f3d497a75 100644
--- a/gcc/testsuite/gfortran.dg/array_constructor_13.f90
+++ b/gcc/testsuite/gfortran.dg/array_constructor_13.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Tests patch for PR29431, which arose from PR29373.
!
! Contributed by Tobias Schlueter <tobi@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/arrayio_7.f90 b/gcc/testsuite/gfortran.dg/arrayio_7.f90
index 69581763a64..68d1fbf97e6 100644
--- a/gcc/testsuite/gfortran.dg/arrayio_7.f90
+++ b/gcc/testsuite/gfortran.dg/arrayio_7.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR24224 Test formatted input/output to/from character arrays with strides
! other than 1. Test that reading stops at the end of the current record.
! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
diff --git a/gcc/testsuite/gfortran.dg/arrayio_8.f90 b/gcc/testsuite/gfortran.dg/arrayio_8.f90
index 9dc81f82da1..7b609bd061c 100644
--- a/gcc/testsuite/gfortran.dg/arrayio_8.f90
+++ b/gcc/testsuite/gfortran.dg/arrayio_8.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR28339, This test checks that internal unit array I/O handles a full record
! and advances to the next record properly. Test case derived from PR
! Submitted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_3.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_3.f90
index 09c9be97c03..912126fe72a 100644
--- a/gcc/testsuite/gfortran.dg/assumed_charlen_function_3.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_3.f90
@@ -5,13 +5,13 @@
!
! Contributed by Paul Thomas <pault@gcc.gnu.org>
!
-function is_OK (ch) ! { dg-warning "is obsolescent in fortran 95" }
+function is_OK (ch) ! { dg-warning "Obsolescent feature" }
character(*) is_OK, ch ! OK in an external function
is_OK = ch
end function is_OK
! The warning occurs twice for the next line; for 'more_OK' and for 'fcn';
-function more_OK (ch, fcn) ! { dg-warning "is obsolescent in fortran 95" }
+function more_OK (ch, fcn) ! { dg-warning "Obsolescent feature" }
character(*) more_OK, ch
character (*), external :: fcn ! OK as a dummy argument
more_OK = fcn (ch)
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_4.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_4.f90
index 9c96ba4d69f..c8f804465b7 100644
--- a/gcc/testsuite/gfortran.dg/assumed_charlen_function_4.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_4.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for PR28600 in which the declaration for the
! character length n, would be given the DECL_CONTEXT of 'gee'
! thus causing an ICE.
diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_5.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_5.f90
index cc7e0108db9..8a0788978af 100644
--- a/gcc/testsuite/gfortran.dg/assumed_charlen_function_5.f90
+++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_5.f90
@@ -5,14 +5,14 @@
!
! Contributed by Paul Thomas <pault@gcc.gnu.org>
!
-character(*) function charrext (n) ! { dg-warning "is obsolescent in fortran 95" }
+character(*) function charrext (n) ! { dg-warning "Obsolescent feature" }
character(26) :: alpha ="abcdefghijklmnopqrstuvwxyz"
charrext = alpha (1:n)
end function charrext
character(26), external :: charrext
interface
- integer(4) function test(charr, i) ! { dg-warning "is obsolescent in fortran 95" }
+ integer(4) function test(charr, i) ! { dg-warning "Obsolescent feature" }
character(*), external :: charr
integer :: i
end function test
@@ -23,7 +23,7 @@ end function charrext
m = ctest (charrext, 27 - j)
end do
contains
- integer(4) function ctest(charr, i) ! { dg-warning "is obsolescent in fortran 95" }
+ integer(4) function ctest(charr, i) ! { dg-warning "Obsolescent feature" }
character(*) :: charr
integer :: i
print *, charr(i)
@@ -31,7 +31,7 @@ contains
end function ctest
end
-integer(4) function test(charr, i) ! { dg-warning "is obsolescent in fortran 95" }
+integer(4) function test(charr, i) ! { dg-warning "Obsolescent feature" }
character(*) :: charr
integer :: i
print *, charr(i)
diff --git a/gcc/testsuite/gfortran.dg/backspace_8.f b/gcc/testsuite/gfortran.dg/backspace_8.f
index 8c8c96aacec..2dd6b72e9d9 100644
--- a/gcc/testsuite/gfortran.dg/backspace_8.f
+++ b/gcc/testsuite/gfortran.dg/backspace_8.f
@@ -1,4 +1,6 @@
C { dg-do run }
+C { dg-options "-std=legacy" }
+C
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 fe62ea5a6e0..851f518a2a9 100644
--- a/gcc/testsuite/gfortran.dg/backspace_9.f
+++ b/gcc/testsuite/gfortran.dg/backspace_9.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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/char_comparison_1.f b/gcc/testsuite/gfortran.dg/char_comparison_1.f
index 9a316b74f7d..02f69e07661 100644
--- a/gcc/testsuite/gfortran.dg/char_comparison_1.f
+++ b/gcc/testsuite/gfortran.dg/char_comparison_1.f
@@ -1,4 +1,6 @@
C { dg-do run }
+C { dg-options "-std=legacy" }
+C
C PR 30525 - comparisons with padded spaces were done
C signed.
program main
diff --git a/gcc/testsuite/gfortran.dg/char_decl_1.f90 b/gcc/testsuite/gfortran.dg/char_decl_1.f90
index 7ce6974f688..3bef08342ee 100644
--- a/gcc/testsuite/gfortran.dg/char_decl_1.f90
+++ b/gcc/testsuite/gfortran.dg/char_decl_1.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR32644 "CHARACTER*1, c" produces "Unclassifiable statement"
program f
character*1, c
diff --git a/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90 b/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90
index 920e1066014..d123aca136d 100644
--- a/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90
+++ b/gcc/testsuite/gfortran.dg/char_initialiser_actual.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Tests passing of character array initialiser as actual argument.
! Fixes PR18109.
! Contributed by Paul Thomas pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/char_pointer_assign.f90 b/gcc/testsuite/gfortran.dg/char_pointer_assign.f90
index ee3da524528..62fcf0360a3 100644
--- a/gcc/testsuite/gfortran.dg/char_pointer_assign.f90
+++ b/gcc/testsuite/gfortran.dg/char_pointer_assign.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
program char_pointer_assign
! Test character pointer assignments, required
! to fix PR18890 and PR21297
@@ -38,4 +40,5 @@ program char_pointer_assign
if (any (t2 /= "lnmo")) call abort ()
if (any (c2 /= "onml")) call abort ()
deallocate (c3, c4)
-end program char_pointer_assign \ No newline at end of file
+end program char_pointer_assign
+
diff --git a/gcc/testsuite/gfortran.dg/char_pointer_dependency.f90 b/gcc/testsuite/gfortran.dg/char_pointer_dependency.f90
index 94976cbb33c..ef2d783e1ff 100644
--- a/gcc/testsuite/gfortran.dg/char_pointer_dependency.f90
+++ b/gcc/testsuite/gfortran.dg/char_pointer_dependency.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Test assignments from character pointer functions with dependencies
! are correctly resolved.
! Provided by Paul Thomas pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/char_pointer_dummy.f90 b/gcc/testsuite/gfortran.dg/char_pointer_dummy.f90
index 1935de51113..b533a1cb98c 100644
--- a/gcc/testsuite/gfortran.dg/char_pointer_dummy.f90
+++ b/gcc/testsuite/gfortran.dg/char_pointer_dummy.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
program char_pointer_dummy
! Test character pointer dummy arguments, required
! to fix PR16939 and PR18689
@@ -30,4 +32,5 @@ contains
character*4, pointer :: ac1(:)
if (ac1(1) /= "wxyz") call abort ()
end subroutine afoo
-end program char_pointer_dummy \ No newline at end of file
+end program char_pointer_dummy
+
diff --git a/gcc/testsuite/gfortran.dg/char_pointer_func.f90 b/gcc/testsuite/gfortran.dg/char_pointer_func.f90
index ddca76f40b2..23f867eeb45 100644
--- a/gcc/testsuite/gfortran.dg/char_pointer_func.f90
+++ b/gcc/testsuite/gfortran.dg/char_pointer_func.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
program char_pointer_func
! Test assignments from character pointer functions, required
! to fix PR17192 and PR17202
diff --git a/gcc/testsuite/gfortran.dg/class_1.f03 b/gcc/testsuite/gfortran.dg/class_1.f03
new file mode 100644
index 00000000000..bdd742b0105
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_1.f03
@@ -0,0 +1,40 @@
+! { dg-do run }
+!
+! FIXME: Remove -w after polymorphic entities are supported.
+! { dg-options "-w" }
+!
+! PR 40940: CLASS statement
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+implicit none
+
+type t
+ integer :: comp
+ class(t),pointer :: c2
+end type
+
+class(t),pointer :: c1
+
+allocate(c1)
+
+c1%comp = 5
+c1%c2 => c1
+
+print *,c1%comp
+
+call sub(c1)
+
+if (c1%comp/=5) call abort()
+
+deallocate(c1)
+
+contains
+
+ subroutine sub (c3)
+ class(t) :: c3
+ print *,c3%comp
+ end subroutine
+
+end
+
diff --git a/gcc/testsuite/gfortran.dg/class_2.f03 b/gcc/testsuite/gfortran.dg/class_2.f03
new file mode 100644
index 00000000000..b4020450126
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_2.f03
@@ -0,0 +1,47 @@
+! { dg-do compile }
+!
+! FIXME: Remove -w after polymorphic entities are supported.
+! { dg-options "-w" }
+!
+! PR 40940: CLASS statement
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+use,intrinsic :: iso_c_binding
+
+type t1
+ integer :: comp
+end type
+
+type t2
+ sequence
+ real :: r
+end type
+
+type,bind(c) :: t3
+ integer(c_int) :: i
+end type
+
+type :: t4
+ procedure(absint), pointer :: p ! { dg-error "Non-polymorphic passed-object dummy argument" }
+end type
+
+type :: t5
+ class(t1) :: c ! { dg-error "must be allocatable or pointer" }
+end type
+
+abstract interface
+ subroutine absint(arg)
+ import :: t4
+ type(t4) :: arg
+ end subroutine
+end interface
+
+
+class(t1) :: o1 ! { dg-error "must be dummy, allocatable or pointer" }
+
+class(t2), pointer :: o2 ! { dg-error "is not extensible" }
+class(t3), pointer :: o3 ! { dg-error "is not extensible" }
+
+end
+
diff --git a/gcc/testsuite/gfortran.dg/common_8.f90 b/gcc/testsuite/gfortran.dg/common_8.f90
index 5d08fcdee22..ada4408f5d6 100644
--- a/gcc/testsuite/gfortran.dg/common_8.f90
+++ b/gcc/testsuite/gfortran.dg/common_8.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
!
! PR fortran/25062
!
diff --git a/gcc/testsuite/gfortran.dg/constant_substring.f b/gcc/testsuite/gfortran.dg/constant_substring.f
index c3aff4848e1..4ca11bc160a 100644
--- a/gcc/testsuite/gfortran.dg/constant_substring.f
+++ b/gcc/testsuite/gfortran.dg/constant_substring.f
@@ -1,5 +1,7 @@
! Simplify constant substring
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*2 a
character*4 b
character*6 c
diff --git a/gcc/testsuite/gfortran.dg/data_char_2.f90 b/gcc/testsuite/gfortran.dg/data_char_2.f90
index 3e021b165f7..26e31a14f08 100644
--- a/gcc/testsuite/gfortran.dg/data_char_2.f90
+++ b/gcc/testsuite/gfortran.dg/data_char_2.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Test that getting a character from a
! string data works.
diff --git a/gcc/testsuite/gfortran.dg/der_array_io_1.f90 b/gcc/testsuite/gfortran.dg/der_array_io_1.f90
index b43864d6e14..244b600746c 100644
--- a/gcc/testsuite/gfortran.dg/der_array_io_1.f90
+++ b/gcc/testsuite/gfortran.dg/der_array_io_1.f90
@@ -1,5 +1,7 @@
! Test IO of arrays of integers in derived types
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
program main
character* 10000 :: buf1, buf2
diff --git a/gcc/testsuite/gfortran.dg/der_array_io_2.f90 b/gcc/testsuite/gfortran.dg/der_array_io_2.f90
index c62fd1eb1a0..21e10d21306 100644
--- a/gcc/testsuite/gfortran.dg/der_array_io_2.f90
+++ b/gcc/testsuite/gfortran.dg/der_array_io_2.f90
@@ -1,5 +1,7 @@
! Test IO of arrays in derived type arrays
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
program main
character *1000 buf1, buf2
diff --git a/gcc/testsuite/gfortran.dg/der_array_io_3.f90 b/gcc/testsuite/gfortran.dg/der_array_io_3.f90
index ae89b3dce78..de562152c49 100644
--- a/gcc/testsuite/gfortran.dg/der_array_io_3.f90
+++ b/gcc/testsuite/gfortran.dg/der_array_io_3.f90
@@ -1,5 +1,7 @@
! Test IO of character arrays in derived types.
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
program main
character*1000 buf1, buf2
type :: foo_type
diff --git a/gcc/testsuite/gfortran.dg/der_io_3.f90 b/gcc/testsuite/gfortran.dg/der_io_3.f90
index 01066cf56e4..1cb370ce17c 100644
--- a/gcc/testsuite/gfortran.dg/der_io_3.f90
+++ b/gcc/testsuite/gfortran.dg/der_io_3.f90
@@ -1,3 +1,6 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR23843
! Make sure derived type I/O with PRIVATE components works where it's allowed
module m1
diff --git a/gcc/testsuite/gfortran.dg/dev_null.F90 b/gcc/testsuite/gfortran.dg/dev_null.F90
index 2385e19ee6c..b8ba5748593 100644
--- a/gcc/testsuite/gfortran.dg/dev_null.F90
+++ b/gcc/testsuite/gfortran.dg/dev_null.F90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! pr19478 read from /dev/null
! Thomas.Koenig@online.de
#if defined _WIN32
diff --git a/gcc/testsuite/gfortran.dg/direct_io_2.f90 b/gcc/testsuite/gfortran.dg/direct_io_2.f90
index cc20f96eedd..8e18052ff01 100644
--- a/gcc/testsuite/gfortran.dg/direct_io_2.f90
+++ b/gcc/testsuite/gfortran.dg/direct_io_2.f90
@@ -1,4 +1,5 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
!
! this testcase derived from NIST test FM413.FOR
! tests writing direct access files in ascending and descending
diff --git a/gcc/testsuite/gfortran.dg/do_iterator_2.f90 b/gcc/testsuite/gfortran.dg/do_iterator_2.f90
index 38f59b5e034..7422b9eb575 100644
--- a/gcc/testsuite/gfortran.dg/do_iterator_2.f90
+++ b/gcc/testsuite/gfortran.dg/do_iterator_2.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for pr32613 - see:
! http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/495c154ee188d7f1/ea292134fe68b1d0#ea292134fe68b1d0
!
diff --git a/gcc/testsuite/gfortran.dg/e_d_fmt.f90 b/gcc/testsuite/gfortran.dg/e_d_fmt.f90
index d463d89d6f1..f2a3a5fc553 100644
--- a/gcc/testsuite/gfortran.dg/e_d_fmt.f90
+++ b/gcc/testsuite/gfortran.dg/e_d_fmt.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Verify that the D format uses 'D' as the exponent character.
! " " " E " " 'E' " " " "
CHARACTER*10 c1, c2
diff --git a/gcc/testsuite/gfortran.dg/empty_format_1.f90 b/gcc/testsuite/gfortran.dg/empty_format_1.f90
index 79a2d0c17d7..ad60afa3f47 100644
--- a/gcc/testsuite/gfortran.dg/empty_format_1.f90
+++ b/gcc/testsuite/gfortran.dg/empty_format_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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/entry_17.f90 b/gcc/testsuite/gfortran.dg/entry_17.f90
index d466266cec3..22aabb3a88f 100644
--- a/gcc/testsuite/gfortran.dg/entry_17.f90
+++ b/gcc/testsuite/gfortran.dg/entry_17.f90
@@ -17,19 +17,19 @@ entry bar2()
bar2 = ""
end function test2
-function test3() ! { dg-warning "is obsolescent" }
+function test3() ! { dg-warning "Obsolescent feature" }
character(*) :: test3
- character(*) :: bar3 ! { dg-warning "is obsolescent" }
+ character(*) :: bar3 ! { dg-warning "Obsolescent feature" }
test3 = ""
return
entry bar3()
bar3 = ""
-end function test3 ! { dg-warning "is obsolescent" }
+end function test3 ! { dg-warning "Obsolescent feature" }
function test4(n) ! { dg-error "returning variables of different string lengths" }
integer :: n
character(n) :: test4
- character(*) :: bar4 ! { dg-warning "is obsolescent" }
+ character(*) :: bar4 ! { dg-warning "Obsolescent feature" }
test4 = ""
return
entry bar4()
@@ -45,11 +45,11 @@ entry bar5()
bar5 = ""
end function test5
-function test6() ! { dg-warning "is obsolescent|returning variables of different string lengths" }
+function test6() ! { dg-warning "Obsolescent feature|returning variables of different string lengths" }
character(*) :: test6
character(2) :: bar6
test6 = ""
return
entry bar6()
bar6 = ""
-end function test6 ! { dg-warning "is obsolescent" }
+end function test6 ! { dg-warning "Obsolescent feature" }
diff --git a/gcc/testsuite/gfortran.dg/entry_7.f90 b/gcc/testsuite/gfortran.dg/entry_7.f90
index 52940984551..b011fe63bfd 100644
--- a/gcc/testsuite/gfortran.dg/entry_7.f90
+++ b/gcc/testsuite/gfortran.dg/entry_7.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Check that PR20877 and PR25047 are fixed by the patch for
! PR24558. Both modules would emit the error:
! insert_bbt(): Duplicate key found!
diff --git a/gcc/testsuite/gfortran.dg/eor_1.f90 b/gcc/testsuite/gfortran.dg/eor_1.f90
index dd3b5e98f70..cd0004bb2a7 100644
--- a/gcc/testsuite/gfortran.dg/eor_1.f90
+++ b/gcc/testsuite/gfortran.dg/eor_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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/equiv_2.f90 b/gcc/testsuite/gfortran.dg/equiv_2.f90
index 8bc7fb14ac7..ee671f964fd 100644
--- a/gcc/testsuite/gfortran.dg/equiv_2.f90
+++ b/gcc/testsuite/gfortran.dg/equiv_2.f90
@@ -1,3 +1,6 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
subroutine broken_equiv1
character*4 h
character*3 i
diff --git a/gcc/testsuite/gfortran.dg/equiv_constraint_2.f90 b/gcc/testsuite/gfortran.dg/equiv_constraint_2.f90
index d721f967137..8a4e0b5ff85 100644
--- a/gcc/testsuite/gfortran.dg/equiv_constraint_2.f90
+++ b/gcc/testsuite/gfortran.dg/equiv_constraint_2.f90
@@ -30,8 +30,8 @@
type :: char_type
sequence
- character*4 :: ch
- character*4 :: cha (6)
+ character(4) :: ch
+ character(4) :: cha (6)
end type char_type
type (char_type) :: my_char
@@ -39,7 +39,7 @@
type :: mixed_type
sequence
integer :: i(4)
- character*4 :: cha (6)
+ character(4) :: cha (6)
end type mixed_type
type (mixed_type) :: my_mixed, thy_mixed
diff --git a/gcc/testsuite/gfortran.dg/equiv_substr.f90 b/gcc/testsuite/gfortran.dg/equiv_substr.f90
index cd186cf0015..bad3a3a20e8 100644
--- a/gcc/testsuite/gfortran.dg/equiv_substr.f90
+++ b/gcc/testsuite/gfortran.dg/equiv_substr.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
!
! PR fortran/34557
!
diff --git a/gcc/testsuite/gfortran.dg/extended_char_comparison_1.f b/gcc/testsuite/gfortran.dg/extended_char_comparison_1.f
index 311567dceb0..b3d7c045620 100644
--- a/gcc/testsuite/gfortran.dg/extended_char_comparison_1.f
+++ b/gcc/testsuite/gfortran.dg/extended_char_comparison_1.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 27715 - the front end and the library used to have different ideas
! about ordering for characters whose encoding is above 127.
diff --git a/gcc/testsuite/gfortran.dg/fmt_bz_bn_err.f b/gcc/testsuite/gfortran.dg/fmt_bz_bn_err.f
index 36881f85dc7..579ab26f4d9 100644
--- a/gcc/testsuite/gfortran.dg/fmt_bz_bn_err.f
+++ b/gcc/testsuite/gfortran.dg/fmt_bz_bn_err.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR38772 r143102 reveals missed error checking on floating point reads.
! Test case contributed by Jack Howarth.
program badread
diff --git a/gcc/testsuite/gfortran.dg/fmt_error_2.f90 b/gcc/testsuite/gfortran.dg/fmt_error_2.f90
index 8fdaf9e3f21..ae818da7f04 100644
--- a/gcc/testsuite/gfortran.dg/fmt_error_2.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_error_2.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR 33269: we used to not simplify format strings before checking if
! they were valid, leading to a missed error.
diff --git a/gcc/testsuite/gfortran.dg/fmt_read_bz_bn.f90 b/gcc/testsuite/gfortran.dg/fmt_read_bz_bn.f90
index d0d01937ea2..5eea29a6c14 100644
--- a/gcc/testsuite/gfortran.dg/fmt_read_bz_bn.f90
+++ b/gcc/testsuite/gfortran.dg/fmt_read_bz_bn.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Test various uses of BZ and BN format specifiers.
! Portions inspired by NIST F77 testsuite FM711.f
! Contributed by jvdelisle@verizon.net
diff --git a/gcc/testsuite/gfortran.dg/fmt_tl.f b/gcc/testsuite/gfortran.dg/fmt_tl.f
index d79146ff02f..656499ed05e 100644
--- a/gcc/testsuite/gfortran.dg/fmt_tl.f
+++ b/gcc/testsuite/gfortran.dg/fmt_tl.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR25631 Check that TL editing works for special case of no bytes written yet.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
real x
diff --git a/gcc/testsuite/gfortran.dg/fmt_white.f b/gcc/testsuite/gfortran.dg/fmt_white.f
index bcd056f7fb9..6921a722f6a 100644
--- a/gcc/testsuite/gfortran.dg/fmt_white.f
+++ b/gcc/testsuite/gfortran.dg/fmt_white.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR24268 Test case derived from example given by Iwan Kawrakow
! Embedded spaces in format strings should be ignored.
! Prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
diff --git a/gcc/testsuite/gfortran.dg/func_derived_1.f90 b/gcc/testsuite/gfortran.dg/func_derived_1.f90
index 496d2905c39..2cf8e449c7e 100644
--- a/gcc/testsuite/gfortran.dg/func_derived_1.f90
+++ b/gcc/testsuite/gfortran.dg/func_derived_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 17244
! verifies that functions returning derived type work
module m
diff --git a/gcc/testsuite/gfortran.dg/g77/1832.f b/gcc/testsuite/gfortran.dg/g77/1832.f
index 1d2ad92add4..6b7617d62e0 100644
--- a/gcc/testsuite/gfortran.dg/g77/1832.f
+++ b/gcc/testsuite/gfortran.dg/g77/1832.f
@@ -1,4 +1,6 @@
c { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*5 string
write(string, *) "a "
if (string .ne. ' a') call abort
diff --git a/gcc/testsuite/gfortran.dg/g77/19981216-0.f b/gcc/testsuite/gfortran.dg/g77/19981216-0.f
index 1e5db3c3b5c..82d259d3cb5 100644
--- a/gcc/testsuite/gfortran.dg/g77/19981216-0.f
+++ b/gcc/testsuite/gfortran.dg/g77/19981216-0.f
@@ -1,4 +1,6 @@
c { dg-do compile }
+c { dg-options "-std=legacy" }
+c
* Resent-From: Craig Burley <burley@gnu.org>
* Resent-To: craig@jcb-sc.com
* X-Delivered: at request of burley on mescaline.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/g77/19990525-0.f b/gcc/testsuite/gfortran.dg/g77/19990525-0.f
index 589fb8ebfd1..4eb104cdbe2 100644
--- a/gcc/testsuite/gfortran.dg/g77/19990525-0.f
+++ b/gcc/testsuite/gfortran.dg/g77/19990525-0.f
@@ -1,4 +1,6 @@
c { dg-do compile }
+c { dg-options "-std=legacy" }
+c
* Mailing-List: contact egcs-bugs-help@egcs.cygnus.com; run by ezmlm
* Precedence: bulk
* Sender: owner-egcs-bugs@egcs.cygnus.com
diff --git a/gcc/testsuite/gfortran.dg/g77/19990826-2.f b/gcc/testsuite/gfortran.dg/g77/19990826-2.f
index b8384f8d25a..8870c2588d4 100644
--- a/gcc/testsuite/gfortran.dg/g77/19990826-2.f
+++ b/gcc/testsuite/gfortran.dg/g77/19990826-2.f
@@ -1,4 +1,6 @@
c { dg-do run }
+c { dg-options "-std=legacy" }
+c
* From: "Billinghurst, David (RTD)" <David.Billinghurst@riotinto.com.au>
* Subject: RE: single precision complex bug in g77 - was Testing g77 with LA
* PACK 3.0
diff --git a/gcc/testsuite/gfortran.dg/g77/20000630-2.f b/gcc/testsuite/gfortran.dg/g77/20000630-2.f
index b2776bf6bed..4948c49e494 100644
--- a/gcc/testsuite/gfortran.dg/g77/20000630-2.f
+++ b/gcc/testsuite/gfortran.dg/g77/20000630-2.f
@@ -1,4 +1,6 @@
c { dg-do compile }
+c { dg-options "-std=legacy" }
+c
SUBROUTINE CHOUT(CHR,ICNT)
C ICE: failed assertion `expr != NULL'
C Reduced version of GNATS PR fortran/329 from trond.bo@dnmi.no
diff --git a/gcc/testsuite/gfortran.dg/g77/20010116.f b/gcc/testsuite/gfortran.dg/g77/20010116.f
index dd8ee931297..ca7375d0f68 100644
--- a/gcc/testsuite/gfortran.dg/g77/20010116.f
+++ b/gcc/testsuite/gfortran.dg/g77/20010116.f
@@ -1,4 +1,6 @@
c { dg-do run }
+c { dg-options "-std=legacy" }
+c
*
* Derived from LAPACK 3.0 routine CHGEQZ
* Fails on i686-pc-cygwin with gcc-2.97 snapshots at -O2 and higher
diff --git a/gcc/testsuite/gfortran.dg/g77/20010519-1.f b/gcc/testsuite/gfortran.dg/g77/20010519-1.f
index beead98c7b9..c268bf03eb5 100644
--- a/gcc/testsuite/gfortran.dg/g77/20010519-1.f
+++ b/gcc/testsuite/gfortran.dg/g77/20010519-1.f
@@ -340,10 +340,10 @@ C..##IF ACE
C..##ENDIF
C..##IF ADUMB
C..##ENDIF
- CHARACTER*4 GTRMA, NEXTA4, CURRA4
- CHARACTER*6 NEXTA6
- CHARACTER*8 NEXTA8
- CHARACTER*20 NEXT20
+ CHARACTER(4) GTRMA, NEXTA4, CURRA4
+ CHARACTER(6) NEXTA6
+ CHARACTER(8) NEXTA8
+ CHARACTER(20) NEXT20
INTEGER ALLCHR, ALLSTK, ALLHP, DECODI, FIND52,
* GETATN, GETRES, GETRSN, GETSEG, GTRMI, I4VAL,
* ICHAR4, ICMP16, ILOGI4, INDX, INDXA, INDXAF,
@@ -390,11 +390,11 @@ C..##ENDIF
C..##IF MMFF
INTEGER LEN_TRIM
EXTERNAL LEN_TRIM
- CHARACTER*4 AtName
+ CHARACTER(4) AtName
external AtName
- CHARACTER*8 ElementName
+ CHARACTER(8) ElementName
external ElementName
- CHARACTER*10 QNAME
+ CHARACTER(10) QNAME
external QNAME
integer IATTCH, IBORDR, CONN12, CONN13, CONN14
integer LEQUIV, LPATH
@@ -576,7 +576,7 @@ C..##ENDIF
& PIXX = 28, PIXY = 29, PIXZ = 30, PIYX = 31,
& PIYY = 32, PIYZ = 33, PIZX = 34, PIZY = 35,
& PIZZ = 36)
- CHARACTER*4 CEPROP, CETERM, CEPRSS
+ CHARACTER(4) CEPROP, CETERM, CEPRSS
COMMON /ANER/ CEPROP(LENENP), CETERM(LENENT), CEPRSS(LENENV)
LOGICAL QEPROP, QETERM, QEPRSS
COMMON /QENER/ QEPROP(LENENP), QETERM(LENENT), QEPRSS(LENENV)
@@ -653,7 +653,7 @@ C:::##INCLUDE '~/charmm_fcm/ctitla.fcm'
INTEGER MAXTIT
PARAMETER (MAXTIT=32)
INTEGER NTITLA,NTITLB
- CHARACTER*80 TITLEA,TITLEB
+ CHARACTER(80) TITLEA,TITLEB
COMMON /NTITLA/ NTITLA,NTITLB
COMMON /CTITLA/ TITLEA(MAXTIT),TITLEB(MAXTIT)
C..##IF SAVEFCM
diff --git a/gcc/testsuite/gfortran.dg/g77/980419-2.f b/gcc/testsuite/gfortran.dg/g77/980419-2.f
index defda413eb7..bb02862e30c 100644
--- a/gcc/testsuite/gfortran.dg/g77/980419-2.f
+++ b/gcc/testsuite/gfortran.dg/g77/980419-2.f
@@ -1,4 +1,6 @@
c { dg-do compile }
+c { dg-options "-std=legacy" }
+c
c SEGVs in loop.c with -O2.
character*80 function nxtlin(lun,ierr,itok)
diff --git a/gcc/testsuite/gfortran.dg/g77/980520-1.f b/gcc/testsuite/gfortran.dg/g77/980520-1.f
index edf7241b997..855b9a442d7 100644
--- a/gcc/testsuite/gfortran.dg/g77/980520-1.f
+++ b/gcc/testsuite/gfortran.dg/g77/980520-1.f
@@ -1,4 +1,6 @@
c { dg-do run }
+c { dg-options "-std=legacy" }
+c
c Produced a link error through not eliminating the unused statement
c function after 1998-05-15 change to gcc/toplev.c. It's in
c `execute' since it needs to link.
diff --git a/gcc/testsuite/gfortran.dg/g77/check0.f b/gcc/testsuite/gfortran.dg/g77/check0.f
index 3febba9d02a..f0a14f826cf 100644
--- a/gcc/testsuite/gfortran.dg/g77/check0.f
+++ b/gcc/testsuite/gfortran.dg/g77/check0.f
@@ -1,4 +1,6 @@
c { dg-do compile }
+c { dg-options "-std=legacy" }
+c
CCC Abort fixed by:
CCC1998-04-21 Jim Wilson <wilson@cygnus.com>
CCC
diff --git a/gcc/testsuite/gfortran.dg/g77/cpp3.F b/gcc/testsuite/gfortran.dg/g77/cpp3.F
index 38387737092..ab25b532945 100644
--- a/gcc/testsuite/gfortran.dg/g77/cpp3.F
+++ b/gcc/testsuite/gfortran.dg/g77/cpp3.F
@@ -1,4 +1,6 @@
c { dg-do run }
+c { dg-options "-std=legacy" }
+c
! Some versions of cpp will delete "//'World' as a C++ comment.
character*40 title
title = 'Hello '//'World'
diff --git a/gcc/testsuite/gfortran.dg/g77/cpp4.F b/gcc/testsuite/gfortran.dg/g77/cpp4.F
index 0dd5c99edc2..bc14e0469ea 100644
--- a/gcc/testsuite/gfortran.dg/g77/cpp4.F
+++ b/gcc/testsuite/gfortran.dg/g77/cpp4.F
@@ -1,8 +1,8 @@
- ! { dg-do run }
+c { dg-do run }
C The preprocessor must not mangle Hollerith constants
C which contain apostrophes.
integer i
- character*4 j
+ character(4) j
data i /4hbla'/
write (j, '(4a)') i
if (j .ne. "bla'") call abort
diff --git a/gcc/testsuite/gfortran.dg/g77/f77-edit-i-in.f b/gcc/testsuite/gfortran.dg/g77/f77-edit-i-in.f
index 49eb41608bb..0369b79db33 100644
--- a/gcc/testsuite/gfortran.dg/g77/f77-edit-i-in.f
+++ b/gcc/testsuite/gfortran.dg/g77/f77-edit-i-in.f
@@ -4,6 +4,8 @@ C
C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
C
C { dg-do run }
+C { dg-options "-std=legacy" }
+C
integer i,j
character*10 buf
diff --git a/gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f b/gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f
index 2314080d708..524b18e3179 100644
--- a/gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f
+++ b/gcc/testsuite/gfortran.dg/g77/f77-edit-t-in.f
@@ -4,6 +4,8 @@ C
C Origin: David Billinghurst <David.Billinghurst@riotinto.com>
C
C { dg-do run }
+C { dg-options "-std=legacy" }
+C
integer i,j
real a,b,c,d,e
character*32 in
diff --git a/gcc/testsuite/gfortran.dg/g77/short.f b/gcc/testsuite/gfortran.dg/g77/short.f
index e9a18a1315b..330f0ac52b1 100644
--- a/gcc/testsuite/gfortran.dg/g77/short.f
+++ b/gcc/testsuite/gfortran.dg/g77/short.f
@@ -1,4 +1,6 @@
c { dg-do run }
+c { dg-options "-std=legacy" }
+c
program short
parameter ( N=2 )
diff --git a/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f b/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f
index 551bd61cd65..f9e0195bcdb 100644
--- a/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f
+++ b/gcc/testsuite/gfortran.dg/g77_intrinsics_funcs.f
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Testing g77 intrinsics as subroutines
integer(kind=8) i8
integer i4
diff --git a/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f b/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f
index d1591e04bef..6ee5f837cc4 100644
--- a/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f
+++ b/gcc/testsuite/gfortran.dg/g77_intrinsics_sub.f
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Testing g77 intrinsics as subroutines
integer(kind=8) i8, j8
integer i4, j4
diff --git a/gcc/testsuite/gfortran.dg/global_references_2.f90 b/gcc/testsuite/gfortran.dg/global_references_2.f90
index 95666981ac0..bf2528006a0 100644
--- a/gcc/testsuite/gfortran.dg/global_references_2.f90
+++ b/gcc/testsuite/gfortran.dg/global_references_2.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! This program tests the patch for PR25964. This is a
! regression that would not allow a common block and a statement
! to share the same name.
@@ -7,4 +9,5 @@
common /foo/ a, b, c
foo (x) = x + 1.0
print *, foo (0.0)
- end \ No newline at end of file
+ end
+
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-1.f90 b/gcc/testsuite/gfortran.dg/graphite/block-1.f90
index 124f06d16eb..8125853b937 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-1.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/block-1.f90
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
-
subroutine matrix_multiply(a,b,c,n)
real(8), dimension(n,n) :: a,b,c
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-2.f b/gcc/testsuite/gfortran.dg/graphite/block-2.f
index af966ec5f97..6c7ee6fe951 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-2.f
+++ b/gcc/testsuite/gfortran.dg/graphite/block-2.f
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
-
SUBROUTINE MATRIX_MUL_UNROLLED (A, B, C, L, M, N)
DIMENSION A(L,M), B(M,N), C(L,N)
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-3.f90 b/gcc/testsuite/gfortran.dg/graphite/block-3.f90
index c7809d3431b..1579e66e411 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/block-3.f90
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
-
subroutine matrix_multiply(a,b,c,n)
real(8), dimension(n,n) :: a,b,c
diff --git a/gcc/testsuite/gfortran.dg/graphite/block-4.f90 b/gcc/testsuite/gfortran.dg/graphite/block-4.f90
index 586a7772512..f37d70aec3f 100644
--- a/gcc/testsuite/gfortran.dg/graphite/block-4.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/block-4.f90
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -floop-block -fdump-tree-graphite-all" }
-
subroutine matrix_multiply(a,b,c,n)
real(8), dimension(n,n) :: a,b,c
diff --git a/gcc/testsuite/gfortran.dg/graphite/graphite.exp b/gcc/testsuite/gfortran.dg/graphite/graphite.exp
index a9fdb2c508f..717413e63ce 100644
--- a/gcc/testsuite/gfortran.dg/graphite/graphite.exp
+++ b/gcc/testsuite/gfortran.dg/graphite/graphite.exp
@@ -23,23 +23,64 @@ if ![check_effective_target_fgraphite] {
return
}
+# Remove VALUE from LIST_VARIABLE.
+proc lremove {list_variable value} {
+ upvar 1 $list_variable var
+ set idx [lsearch -exact $var $value]
+ set var [lreplace $var $idx $idx]
+}
+
# The default action for a test is 'compile'. Save current default.
global dg-do-what-default
set save-dg-do-what-default ${dg-do-what-default}
set dg-do-what-default compile
-# If a testcase doesn't have special options, use these.
-set DEFAULT_GRAPHITE_FLAGS ""
-
# Initialize `dg'.
dg-init
# Main loop.
-gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] $DEFAULT_GRAPHITE_FLAGS
+set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ]
+
+# Flags using for block-* files.
+set DEFAULT_FLAGS_GRAPHITE_BLOCK "-O2 -fdump-tree-graphite-all"
+set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.\[fF\]{,90,95,03,08} ] ]
+gfortran-dg-runtest $block_files $DEFAULT_FLAGS_GRAPHITE_BLOCK
+foreach block_file $block_files {lremove wait_to_run_files $block_file}
+
+# Flags using for id-* files.
+set DEFAULT_FLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity -fdump-tree-graphite-all"
+set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.\[fF\]{,90,95,03,08} ] ]
+gfortran-dg-runtest $id_files $DEFAULT_FLAGS_GRAPHITE_IDENTITY
+foreach id_file $id_files {lremove wait_to_run_files $id_file}
+
+# Flags using for interchange-* files.
+set DEFAULT_FLAGS_GRAPHITE_BLOCK "-O2 -fdump-tree-graphite-all -floop-interchange"
+set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.\[fF\]{,90,95,03,08} ] ]
+gfortran-dg-runtest $interchange_files $DEFAULT_FLAGS_GRAPHITE_BLOCK
+foreach interchange_file $interchange_files {lremove wait_to_run_files $interchange_file}
-gfortran-dg-runtest [lsort \
- [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] $DEFAULT_GRAPHITE_FLAGS
+# Flags using for scop-* files.
+set DEFAULT_FLAGS_GRAPHITE_SCOP "-O2 -fgraphite -fdump-tree-graphite-all"
+set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.\[fF\]{,90,95,03,08} ] ]
+gfortran-dg-runtest $scop_files $DEFAULT_FLAGS_GRAPHITE_SCOP
+foreach scop_file $scop_files {lremove wait_to_run_files $scop_file}
+
+# Schedule now the tests to be run.
+set dg-do-what-default run
+
+# Flags using for run-id-* files.
+set DEFAULT_FLAGS_RUN_ID "-O2 -fgraphite-identity"
+set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.\[fF\]{,90,95,03,08} ] ]
+gfortran-dg-runtest $run_id_files $DEFAULT_FLAGS_RUN_ID
+foreach run_id_file $run_id_files {lremove wait_to_run_files $run_id_file}
+
+
+# The default action for the rest of the files is 'compile'.
+set dg-do-what-default compile
+
+# Flags using for other files.
+set DEFAULT_GRAPHITE_FLAGS ""
+gfortran-dg-runtest $wait_to_run_files $DEFAULT_GRAPHITE_FLAGS
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-1.f90 b/gcc/testsuite/gfortran.dg/graphite/id-1.f90
new file mode 100644
index 00000000000..5fe709bfb07
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-1.f90
@@ -0,0 +1,11 @@
+program NF
+end program NF
+subroutine mattest(nx,ny,nz,band1,band2,band3,stiffness,maxiter,targrms,method)
+ integer,parameter :: dpkind=kind(1.0D0)
+ character(*) :: method
+ real(dpkind),allocatable,dimension(:) :: ad,au1,au2,au3,x,b
+ allocate(ad(nxyz),au1(nxyz),au2(nxyz),au3(nxyz),x(nxyz),b(nxyz))
+ au1(nx:nxyz:nx) = 0.0
+ if ( method=='NFCG' ) then
+ endif
+end subroutine mattest
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-10.f90 b/gcc/testsuite/gfortran.dg/graphite/id-10.f90
new file mode 100644
index 00000000000..0e016f25319
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-10.f90
@@ -0,0 +1,11 @@
+subroutine foo ( uplo, ap, y )
+ character*1 uplo
+ complex(kind((1.0d0,1.0d0))) ap( * ), y( * )
+ if ( .not. scan( uplo, 'uu' )>0.and. &
+ .not. scan( uplo, 'll' )>0 )then
+ do 60, j = 1, n
+ y( j ) = y( j ) + dble( ap( kk ) )
+ kk = kk + j
+ 60 continue
+ end if
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-11.f b/gcc/testsuite/gfortran.dg/graphite/id-11.f
new file mode 100644
index 00000000000..872e12f359e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-11.f
@@ -0,0 +1,14 @@
+ subroutine foo(bar)
+ dimension bar(100)
+ common l_
+ 50 continue
+ do i=1,20
+ bar(i)=0
+ enddo
+ do 100 j=1,l_
+ if(sum.gt.r) then
+ bar(n2)=j
+ end if
+ 100 continue
+ if(bar(4).ne.0) go to 50
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-12.f b/gcc/testsuite/gfortran.dg/graphite/id-12.f
new file mode 100644
index 00000000000..5b7415ca0ec
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-12.f
@@ -0,0 +1,19 @@
+ subroutine foo(a)
+ logical bar
+ dimension a(12,2)
+ dimension b(12,8)
+ if(cd .eq. 1) then
+ if (bar) write(iw,*) norb
+ if(ef.ne.1) then
+ do i=1,norb
+ end do
+ end if
+ end if
+ do 400 j = 1,8
+ b(i,j) = 0
+ 400 continue
+ do 410 j=1,norb
+ a(i,j) = 0
+ 410 continue
+ call rdrsym(b)
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-13.f b/gcc/testsuite/gfortran.dg/graphite/id-13.f
new file mode 100644
index 00000000000..9aec1fa6ba9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-13.f
@@ -0,0 +1,12 @@
+ DIMENSION FF(19)
+ COMMON UF(9)
+ CALL RYSNOD(K)
+ DO 150 K=2,N
+ JMAX=K-1
+ DUM = ONE/FF(1)
+ DO 110 J=1,JMAX
+ DUM=DUM+POLY*POLY
+ 110 CONTINUE
+ 150 CONTINUE
+ UF(K)=DUM/(ONE-DUM)
+ END
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-14.f b/gcc/testsuite/gfortran.dg/graphite/id-14.f
new file mode 100644
index 00000000000..cdc3d101c95
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-14.f
@@ -0,0 +1,20 @@
+ SUBROUTINE ORDORB(IORBTP,IORBCD)
+ LOGICAL MASWRK
+ DIMENSION IORBTP(12,12)
+ DIMENSION IORBCD(12)
+ DIMENSION NSYMTP(12,8)
+ IF (MASWRK) WRITE(IW) K,NORB
+ DO 280 I=1,NFZV
+ IORBCD(K+I) = 3
+ 280 CONTINUE
+ DO 420 I = 1,NTPS
+ DO 400 J = 1,8
+ NSYMTP(I,J) = 0
+ 400 CONTINUE
+ DO 410 J=1,NORB
+ IORBTP(I,J) = 0
+ 410 CONTINUE
+ 420 CONTINUE
+ CALL RDRSYM(ICODE,NSYMTP,NSYM)
+ 9055 FORMAT(I5)
+ END
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-15.f b/gcc/testsuite/gfortran.dg/graphite/id-15.f
new file mode 100644
index 00000000000..bf60d856913
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-15.f
@@ -0,0 +1,16 @@
+ SUBROUTINE ORDORB(IORBTP)
+ LOGICAL MASWRK
+ DIMENSION IORBTP(12,12)
+ DIMENSION NSYMTP(12,8)
+ IF (MASWRK) WRITE(IW) K,NORB
+ DO 420 I = 1,NTPS
+ DO 400 J = 1,8
+ NSYMTP(I,J) = 0
+ 400 CONTINUE
+ DO 410 J=1,NORB
+ IORBTP(I,J) = 0
+ 410 CONTINUE
+ 420 CONTINUE
+ CALL RDRSYM(ICODE,NSYMTP,NSYM)
+ 9055 FORMAT(I5)
+ END
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-16.f b/gcc/testsuite/gfortran.dg/graphite/id-16.f
new file mode 100644
index 00000000000..323d6c958f0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-16.f
@@ -0,0 +1,10 @@
+ SUBROUTINE BFN(X,BF)
+ DIMENSION BF(13)
+ DIMENSION FACT(17)
+ DO 70 M=0,LAST
+ XF = 1
+ IF(M.NE.0) XF = FACT(M)
+ Y = Y + XF
+ 70 CONTINUE
+ BF(1)=Y
+ END
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-17.f b/gcc/testsuite/gfortran.dg/graphite/id-17.f
new file mode 100644
index 00000000000..4bebed01678
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-17.f
@@ -0,0 +1,16 @@
+ SUBROUTINE SPECTOP(Dr,N)
+ DIMENSION d1(0:32,0:32) , Dr(0:32,0:32) , x(0:32)
+ DO k = 0 , N
+ fctr2 = o
+ DO j = 0 , N
+ fctr = fctr1*fctr2
+ IF ( j.NE.k ) THEN
+ d1(k,j) = ck*fctr/(cj*(x(k)-x(j)))
+ ENDIF
+ fctr2 = -o*fctr2
+ ENDDO
+ DO j = 0 , N
+ Dr(k,j) = d1(N-k,N-j)
+ ENDDO
+ ENDDO
+ END
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-2.f90 b/gcc/testsuite/gfortran.dg/graphite/id-2.f90
index 0c9f54bb979..720fff8dd02 100644
--- a/gcc/testsuite/gfortran.dg/graphite/id-2.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/id-2.f90
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -fgraphite-identity" }
-
module solv_cap
integer, parameter, public :: dp = selected_real_kind(5)
contains
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-3.f90 b/gcc/testsuite/gfortran.dg/graphite/id-3.f90
index 394bdf7ac16..7f0efc7bc8e 100644
--- a/gcc/testsuite/gfortran.dg/graphite/id-3.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/id-3.f90
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -fgraphite-identity" }
-
subroutine gentrs (ptrst, ncls, xmin, dcls, xdont, ndon)
do icls1 = 1, ncls
prec: do
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-4.f90 b/gcc/testsuite/gfortran.dg/graphite/id-4.f90
index 896d608777e..b2c6cb04edc 100644
--- a/gcc/testsuite/gfortran.dg/graphite/id-4.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/id-4.f90
@@ -1,5 +1,3 @@
-! { dg-options "-O2 -fgraphite-identity" }
-
MODULE Vcimage
CHARACTER (LEN=80), SAVE :: CARD, FIELD
END MODULE Vcimage
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-5.f b/gcc/testsuite/gfortran.dg/graphite/id-5.f
new file mode 100644
index 00000000000..b9e93e39c1c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-5.f
@@ -0,0 +1,19 @@
+ subroutine shell(Re,Pr,nx,ny,nz,
+ $nuim,nuex2,nuex4,cfl,scheme,conf,ni,maxit)
+ real*8 q(5,nx,ny,nz),dq(5,nx,ny,nz),rhs(5,nx,ny,nz),e(5,nx,ny,nz),
+ 1 f(5,nx,ny,nz),g(5,nx,ny,nz),ev(5,nx,ny,nz),fv(5,nx,ny,nz),
+ 2 gv(5,nx,ny,nz),diss(5,nx,ny,nz)
+ do k=1,nz
+ do j=1,ny
+ do i=1,nx
+ do l=1,5
+ t1= -0.5d0*dt*(
+ 3 (g(l,i,j,kp1)-g(l,i,j,km1))/dz) +
+ 4 dt/Re*((ev(l,i,j,k)-ev(l,im1,j,k))/dx +
+ 6 (gv(l,i,j,k)-gv(l,i,j,km1))/dz)
+ rhs(l,i,j,k)=t1+t2
+ enddo
+ enddo
+ enddo
+ enddo
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-6.f b/gcc/testsuite/gfortran.dg/graphite/id-6.f
new file mode 100644
index 00000000000..2ccb4632afe
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-6.f
@@ -0,0 +1,22 @@
+ SUBROUTINE EIJDEN(EPS,V,E,IA,WRK,L1,L2,L3,L0,ECI)
+ DIMENSION V(L1,L0),EPS(L2),E(*),IA(L1),WRK(L1),ECI(L0,L0)
+ IF(SCFTYP.EQ.RHF .AND. MPLEVL.EQ.0 .AND.
+ * CITYP.NE.GUGA .AND. CITYP.NE.CIS) THEN
+ CALL DCOPY(NORB,E(IADDE),1,E(IADD),1)
+ END IF
+ IF (CITYP.NE.GUGA) THEN
+ DO 500 I = 1,L1
+ DO 430 L = 1,NORB
+ DO 420 K = 1,NORB
+ IF(K.LE.L) THEN
+ WRK(L) = WRK(L) - V(I,K)*ECI(K,L)
+ ELSE
+ WRK(L) = WRK(L) - V(I,K)*ECI(L,K)
+ END IF
+ 420 CONTINUE
+ 430 CONTINUE
+ DO 440 L = 1,NORB
+ 440 CONTINUE
+ 500 CONTINUE
+ END IF
+ END
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-7.f b/gcc/testsuite/gfortran.dg/graphite/id-7.f
new file mode 100644
index 00000000000..dbbbe37a484
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-7.f
@@ -0,0 +1,14 @@
+ subroutine dasol(al,au,ad,b,jp,neq,energy)
+ real*8 al(*),au(*),ad(*),b(*),zero,energy,bd,dot
+ do 100 is=1,neq
+ if(b(is).ne.zero) go to 200
+ 100 continue
+ return
+ 200 if(is.lt.neq) then
+ endif
+ do 400 j = is,neq
+ energy=energy+bd*b(j)
+ 400 continue
+ if(neq.gt.1)then
+ endif
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-8.f b/gcc/testsuite/gfortran.dg/graphite/id-8.f
new file mode 100644
index 00000000000..6594dda24a9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-8.f
@@ -0,0 +1,17 @@
+ subroutine foo(mxgtot,mxsh)
+ logical b
+ dimension ex(mxgtot),cs(mxgtot)
+ do 500 jg = k1,ig
+ u = ex(ig)+ex(jg)
+ z = u*sqrt(u)
+ x = cs(ig)*cs(jg)/z
+ if (ig .eq. jg) go to 480
+ x = x+x
+ 480 continue
+ y = y+x
+ 500 continue
+ if(y.gt.t) z=1/sqrt(y)
+ if (b) then
+ write(9) z
+ endif
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/id-9.f b/gcc/testsuite/gfortran.dg/graphite/id-9.f
new file mode 100644
index 00000000000..c9393708897
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/id-9.f
@@ -0,0 +1,20 @@
+ subroutine foo(bar)
+ real*8 bar(3,3),coefm
+ do ii=istart,iend
+ do i=1,21
+ bar(k,l)=4
+ enddo
+ do m=1,ne
+ do l=1,3
+ do k=1,l
+ enddo
+ bar(k,l)=bar(k,l)+(v3b-1.d0)
+ enddo
+ enddo
+ do m=1,ne
+ do k=1,l
+ l = l*(v3b**(-coefm))
+ enddo
+ enddo
+ enddo
+ end
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-1.f b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f
new file mode 100644
index 00000000000..a73bb131ff4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-1.f
@@ -0,0 +1,38 @@
+ subroutine foo(f1,f2,f3,f4,f5,f6,f7,f8,f9,f0,g1,g2,g3)
+ implicit none
+ integer f4,f3,f2,f1
+ integer g4,g5,g6,g7,g8,g9
+ integer i1,i2,i3,i4,i5
+
+ real*8 g1(5,f3,f2,f1),g2(5,5,f3,f2,f1),g3(5,f3,f2,f1)
+ real*8 f0(5,5,f3,f2,f1),f9(5,5,f3,f2,f1),f8(5,5,f3,f2,f1)
+ real*8 f7(5,5,f3,f2,f1),f6(5,5,f3,f2,f1),f5(5,5,f3,f2,f1)
+
+ do i3=1,f1
+ g8=mod(i3+f1-2,f1)+1
+ g9=mod(i3,f1)+1
+ do i4=1,f2
+ g6=mod(i4+f2-2,f2)+1
+ g7=mod(i4,f2)+1
+ do i5=1,f3
+ g4=mod(i5+f3-2,f3)+1
+ g5=mod(i5,f3)+1
+ do i1=1,5
+ g3(i1,i5,i4,i3)=0.0d0
+ do i2=1,5
+ g3(i1,i5,i4,i3)=g3(i1,i5,i4,i3)+
+ 1 g2(i1,i2,i5,i4,i3)*g1(i2,i5,i4,i3)+
+ 2 f0(i1,i2,i5,i4,i3)*g1(i2,g5,i4,i3)+
+ 3 f9(i1,i2,i5,i4,i3)*g1(i2,i5,g7,i3)+
+ 4 f8(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g9)+
+ 5 f7(i1,i2,i5,i4,i3)*g1(i2,g4,i4,i3)+
+ 6 f6(i1,i2,i5,i4,i3)*g1(i2,i5,g6,i3)+
+ 7 f5(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g8)
+ enddo
+ enddo
+ enddo
+ enddo
+ enddo
+ return
+ end
+
diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-2.f b/gcc/testsuite/gfortran.dg/graphite/interchange-2.f
new file mode 100644
index 00000000000..6418c0c89e6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/graphite/interchange-2.f
@@ -0,0 +1,38 @@
+ subroutine foo(f1,f2,f3,f4,f5,f6,f7,f8,f9,f0,g1,g2,g3)
+ implicit none
+ integer f4,f3,f2,f1
+ integer g4,g5,g6,g7,g8,g9
+ integer i1,i2,i3,i4,i5
+
+ real*8 g1(f4,f3,f2,f1),g2(f4,f4,f3,f2,f1),g3(f4,f3,f2,f1)
+ real*8 f0(f4,f4,f3,f2,f1),f9(f4,f4,f3,f2,f1),f8(f4,f4,f3,f2,f1)
+ real*8 f7(f4,f4,f3,f2,f1),f6(f4,f4,f3,f2,f1),f5(f4,f4,f3,f2,f1)
+
+ do i3=1,f1
+ g8=mod(i3+f1-2,f1)+1
+ g9=mod(i3,f1)+1
+ do i4=1,f2
+ g6=mod(i4+f2-2,f2)+1
+ g7=mod(i4,f2)+1
+ do i5=1,f3
+ g4=mod(i5+f3-2,f3)+1
+ g5=mod(i5,f3)+1
+ do i1=1,f4
+ g3(i1,i5,i4,i3)=0.0d0
+ do i2=1,f4
+ g3(i1,i5,i4,i3)=g3(i1,i5,i4,i3)+
+ 1 g2(i1,i2,i5,i4,i3)*g1(i2,i5,i4,i3)+
+ 2 f0(i1,i2,i5,i4,i3)*g1(i2,g5,i4,i3)+
+ 3 f9(i1,i2,i5,i4,i3)*g1(i2,i5,g7,i3)+
+ 4 f8(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g9)+
+ 5 f7(i1,i2,i5,i4,i3)*g1(i2,g4,i4,i3)+
+ 6 f6(i1,i2,i5,i4,i3)*g1(i2,i5,g6,i3)+
+ 7 f5(i1,i2,i5,i4,i3)*g1(i2,i5,i4,g8)
+ enddo
+ enddo
+ enddo
+ enddo
+ enddo
+ return
+ end
+
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr37852.f90 b/gcc/testsuite/gfortran.dg/graphite/pr37852.f90
index 50e23428f82..a5d48b7124a 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr37852.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr37852.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block" }
+! { dg-options "-O2 " }
PROGRAM TEST_FPU
CHARACTER (LEN=36) :: invert_id(1) = &
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr37857.f90 b/gcc/testsuite/gfortran.dg/graphite/pr37857.f90
index de2d3a124ee..c2cccb775da 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr37857.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr37857.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block" }
+! { dg-options "-O2 " }
program superficie_proteina
integer, parameter :: LONGreal = selected_real_kind(12,90)
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr37980.f90 b/gcc/testsuite/gfortran.dg/graphite/pr37980.f90
index 5306aa84c92..62eccf35ff1 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr37980.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr37980.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O2 -floop-block" }
+! { dg-options "-O2 " }
module INT_MODULE
contains
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr38083.f90 b/gcc/testsuite/gfortran.dg/graphite/pr38083.f90
index 834d33ab833..da8c3cc7914 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr38083.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr38083.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O3 -floop-block" }
+! { dg-options "-O3 " }
SUBROUTINE IVSORT (IL,IH,NSEGS,IOUNIT)
INTEGER IOUNIT
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr38953.f90 b/gcc/testsuite/gfortran.dg/graphite/pr38953.f90
index 245db0dfe28..73224764f16 100644
--- a/gcc/testsuite/gfortran.dg/graphite/pr38953.f90
+++ b/gcc/testsuite/gfortran.dg/graphite/pr38953.f90
@@ -1,4 +1,4 @@
-! { dg-options "-O3 -floop-block -fgraphite-identity" }
+! { dg-options "-O3 -fgraphite-identity" }
MODULE MAIN1
INTEGER , PARAMETER :: IFMAX = 40 , IKN = 85 , ISTRG = 132 , &
diff --git a/gcc/testsuite/gfortran.dg/graphite/scop-1.f b/gcc/testsuite/gfortran.dg/graphite/scop-1.f
index a279abaf9c2..5bd463c4e9c 100644
--- a/gcc/testsuite/gfortran.dg/graphite/scop-1.f
+++ b/gcc/testsuite/gfortran.dg/graphite/scop-1.f
@@ -1,5 +1,3 @@
-C { dg-options "-O2 -fgraphite" }
-
dimension p1(2),t(6,4),b1(2),b2(2),al1(2),al2(2),g1(2),g2(2)
save
if(nlin.eq.0) then
@@ -11,3 +9,5 @@ C { dg-options "-O2 -fgraphite" }
endif
end
+! { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" { xfail *-*-* } } }
+! { dg-final { cleanup-tree-dump "graphite" } }
diff --git a/gcc/testsuite/gfortran.dg/hollerith.f90 b/gcc/testsuite/gfortran.dg/hollerith.f90
index 21cbf66bdf6..697ed22d892 100644
--- a/gcc/testsuite/gfortran.dg/hollerith.f90
+++ b/gcc/testsuite/gfortran.dg/hollerith.f90
@@ -3,14 +3,14 @@
implicit none
complex(kind=8) x(2)
complex a(2,2)
-character*4 z
+character(4) z
character z1(4)
-character*4 z2(2,2)
-character*80 line
+character(4) z2(2,2)
+character(80) line
integer i
integer j
real r
-character*8 c
+character(8) c
data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
data a /8H(i3),abc, 0, 4H(i4), 8H (i9)/
@@ -53,7 +53,7 @@ end
subroutine test (h)
integer(kind=8) h
-character*80 line
+character(80) line
write (line, '(8a)') h
if (line .ne. ' hello') call abort
diff --git a/gcc/testsuite/gfortran.dg/hollerith_1.f90 b/gcc/testsuite/gfortran.dg/hollerith_1.f90
index d6732d40b69..829ca7f99c2 100644
--- a/gcc/testsuite/gfortran.dg/hollerith_1.f90
+++ b/gcc/testsuite/gfortran.dg/hollerith_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 21260
! We wrongly interpreted the '!' as the beginning of a comment.
! Also verifies the functioning of hollerith formatting.
diff --git a/gcc/testsuite/gfortran.dg/hollerith_f95.f90 b/gcc/testsuite/gfortran.dg/hollerith_f95.f90
index 4d7fda8c72e..dc52187adb9 100644
--- a/gcc/testsuite/gfortran.dg/hollerith_f95.f90
+++ b/gcc/testsuite/gfortran.dg/hollerith_f95.f90
@@ -4,14 +4,14 @@
implicit none
complex(kind=8) x(2)
complex a(2,2)
-character*4 z
+character(4) z
character z1(4)
-character*4 z2(2,2)
-character*80 line
+character(4) z2(2,2)
+character(80) line
integer i
logical l
real r
-character*8 c
+character(8) c
data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
data a /8H(i3),abc, 0, 4H(i4), 8H (i9)/
@@ -54,7 +54,7 @@ end
subroutine test (h)
integer(kind=8) h
-character*80 line
+character(80) line
write (line, '(8a)') h
if (line .ne. ' hello') call abort
diff --git a/gcc/testsuite/gfortran.dg/ichar_1.f90 b/gcc/testsuite/gfortran.dg/ichar_1.f90
index 104c5d166af..362cd2f453b 100644
--- a/gcc/testsuite/gfortran.dg/ichar_1.f90
+++ b/gcc/testsuite/gfortran.dg/ichar_1.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR20879
! Check that we reject expressions longer than one character for the
! ICHAR and IACHAR intrinsics.
diff --git a/gcc/testsuite/gfortran.dg/implicit_6.f90 b/gcc/testsuite/gfortran.dg/implicit_6.f90
index bb7fe3221ab..a74ecc29ba5 100644
--- a/gcc/testsuite/gfortran.dg/implicit_6.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_6.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR 24643
! substring references on implicitly typed CHARACTER variables didn't work
PROGRAM P
diff --git a/gcc/testsuite/gfortran.dg/implicit_9.f90 b/gcc/testsuite/gfortran.dg/implicit_9.f90
index 335c85bffb1..04b7afa4ed8 100644
--- a/gcc/testsuite/gfortran.dg/implicit_9.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_9.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Tests patch for PR29373, in which the implicit character
! statement messes up the function declaration because the
! requisite functions in decl.c were told nothing about
diff --git a/gcc/testsuite/gfortran.dg/initialization_23.f90 b/gcc/testsuite/gfortran.dg/initialization_23.f90
new file mode 100644
index 00000000000..cc2aca4e223
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/initialization_23.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR 40875: The error was missed and an ICE ensued.
+!
+! Contributed by Michael Richmond <michael.a.richmond@nasa.gov>
+!
+ MODULE cdf_aux_mod
+ PUBLIC
+ TYPE :: one_parameter
+ CHARACTER :: name
+ END TYPE one_parameter
+ CHARACTER, PARAMETER :: the_alpha = one_parameter('c') ! { dg-error "Can't convert TYPE" }
+ CHARACTER, PARAMETER :: the_beta = (/one_parameter('c')/) ! { dg-error "Incompatible ranks" }
+ END MODULE cdf_aux_mod
+
+! { dg-final { cleanup-modules "cdf_aux_mod" } }
+
diff --git a/gcc/testsuite/gfortran.dg/inquire.f90 b/gcc/testsuite/gfortran.dg/inquire.f90
index 9f3b72532af..7115913c6c6 100644
--- a/gcc/testsuite/gfortran.dg/inquire.f90
+++ b/gcc/testsuite/gfortran.dg/inquire.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! check to see that you cannot open a direct access file
! for sequential i/o.
! derived from NIST test fm910.for
diff --git a/gcc/testsuite/gfortran.dg/inquire_13.f90 b/gcc/testsuite/gfortran.dg/inquire_13.f90
index 366e383327f..d074861a97b 100644
--- a/gcc/testsuite/gfortran.dg/inquire_13.f90
+++ b/gcc/testsuite/gfortran.dg/inquire_13.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR34795 inquire statement , direct= specifier incorrectly returns YES
! Test case from PR, modified by Jerry DeLisle <jvdelisle@gcc.gnu.org
program testinquire
diff --git a/gcc/testsuite/gfortran.dg/inquire_5.f90 b/gcc/testsuite/gfortran.dg/inquire_5.f90
index b2e07be9319..fe107a19863 100644
--- a/gcc/testsuite/gfortran.dg/inquire_5.f90
+++ b/gcc/testsuite/gfortran.dg/inquire_5.f90
@@ -1,4 +1,6 @@
! { dg-do run { target fd_truncate } }
+! { dg-options "-std=legacy" }
+!
! pr19314 inquire(..position=..) segfaults
! test by Thomas.Koenig@online.de
! bdavis9659@comcast.net
diff --git a/gcc/testsuite/gfortran.dg/inquire_6.f90 b/gcc/testsuite/gfortran.dg/inquire_6.f90
index 7575b6e67b3..b657df831d9 100644
--- a/gcc/testsuite/gfortran.dg/inquire_6.f90
+++ b/gcc/testsuite/gfortran.dg/inquire_6.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
!pr19313 - inquire(..pad=..)
implicit none
! logical debug
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_4.f90 b/gcc/testsuite/gfortran.dg/intrinsic_4.f90
new file mode 100644
index 00000000000..300dfde1fde
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/intrinsic_4.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-Wsurprising" }
+!
+! PR 40995: [4.5 Regression] Spurious "Type specified for intrinsic function...ignored" message
+!
+! Contributed by Mat Cross <mathewc@nag.co.uk>
+
+subroutine sub(n,x)
+ intrinsic abs
+ integer n, x(abs(n))
+end
+
diff --git a/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90 b/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90
index 87853dbe71e..d3f84cdf17f 100644
--- a/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90
+++ b/gcc/testsuite/gfortran.dg/intrinsic_subroutine.f90
@@ -1,7 +1,7 @@
! { dg-do compile }
! PR 33229
implicit none
-intrinsic cpu_time
+intrinsic cpu_time ! { dg-error "attribute conflicts with" }
real :: time
-print *, CPU_TIME(TIME) ! { dg-error "attribute conflicts with" }
+print *, CPU_TIME(TIME) ! { dg-error "is not a function" }
end
diff --git a/gcc/testsuite/gfortran.dg/io_constraints_1.f90 b/gcc/testsuite/gfortran.dg/io_constraints_1.f90
index 5f2c776b128..db1e949e7a5 100644
--- a/gcc/testsuite/gfortran.dg/io_constraints_1.f90
+++ b/gcc/testsuite/gfortran.dg/io_constraints_1.f90
@@ -29,7 +29,7 @@ end module global
use global
integer :: a,b, c(20)
integer(8) :: ierr
- character*80 :: buffer(3)
+ character(80) :: buffer(3)
! Appending to a USE associated namelist is an extension.
diff --git a/gcc/testsuite/gfortran.dg/io_constraints_2.f90 b/gcc/testsuite/gfortran.dg/io_constraints_2.f90
index 8bf48d72ff2..8d3ae6b45f4 100644
--- a/gcc/testsuite/gfortran.dg/io_constraints_2.f90
+++ b/gcc/testsuite/gfortran.dg/io_constraints_2.f90
@@ -25,7 +25,7 @@ end module global
use global
integer :: a,b, c(20)
integer(8) :: ierr
- character*80 :: buffer(3)
+ character(80) :: buffer(3)
! Appending to a USE associated namelist is an extension.
diff --git a/gcc/testsuite/gfortran.dg/list_read_2.f90 b/gcc/testsuite/gfortran.dg/list_read_2.f90
index e757f613e44..3e6c233c09a 100644
--- a/gcc/testsuite/gfortran.dg/list_read_2.f90
+++ b/gcc/testsuite/gfortran.dg/list_read_2.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR16805
! Test list directed reads from character substrings
! The IO library was reporting an error rather the end-of-record when it
diff --git a/gcc/testsuite/gfortran.dg/loc_2.f90 b/gcc/testsuite/gfortran.dg/loc_2.f90
index 196dcc6db74..d905fc0f74b 100644
--- a/gcc/testsuite/gfortran.dg/loc_2.f90
+++ b/gcc/testsuite/gfortran.dg/loc_2.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Series of routines for testing a loc() implementation
program test
common /errors/errors(12)
diff --git a/gcc/testsuite/gfortran.dg/logical_1.f90 b/gcc/testsuite/gfortran.dg/logical_1.f90
index 3edc74441b2..69d9e6a437e 100644
--- a/gcc/testsuite/gfortran.dg/logical_1.f90
+++ b/gcc/testsuite/gfortran.dg/logical_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR middle-end/19543
program logical_1
implicit none
diff --git a/gcc/testsuite/gfortran.dg/longline.f b/gcc/testsuite/gfortran.dg/longline.f
index ffd5a4bb2af..c2a5f5afd70 100644
--- a/gcc/testsuite/gfortran.dg/longline.f
+++ b/gcc/testsuite/gfortran.dg/longline.f
@@ -1,5 +1,6 @@
# 1 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.f"
! { dg-do compile }
+! { dg-options "-std=legacy" }
subroutine foo
character*10 cpnam
diff --git a/gcc/testsuite/gfortran.dg/merge_char_1.f90 b/gcc/testsuite/gfortran.dg/merge_char_1.f90
index 0a8036d62df..5974e8c06c3 100644
--- a/gcc/testsuite/gfortran.dg/merge_char_1.f90
+++ b/gcc/testsuite/gfortran.dg/merge_char_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 15327
! The merge intrinsic didn't work for strings
character*2 :: c(2)
diff --git a/gcc/testsuite/gfortran.dg/module_md5_1.f90 b/gcc/testsuite/gfortran.dg/module_md5_1.f90
index f52426fbd00..7aeeb800f10 100644
--- a/gcc/testsuite/gfortran.dg/module_md5_1.f90
+++ b/gcc/testsuite/gfortran.dg/module_md5_1.f90
@@ -10,5 +10,5 @@ program test
use foo
print *, pi
end program test
-! { dg-final { scan-module "foo" "MD5:596df8f39d3ddc0b847771cadcb26274" } }
+! { dg-final { scan-module "foo" "MD5:dc2fd1358dcaddc25e3c89dae859ef32" } }
! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_12.f b/gcc/testsuite/gfortran.dg/namelist_12.f
index dca96452e21..1752bfa07df 100644
--- a/gcc/testsuite/gfortran.dg/namelist_12.f
+++ b/gcc/testsuite/gfortran.dg/namelist_12.f
@@ -1,4 +1,6 @@
c{ dg-do run { target fd_truncate } }
+c{ dg-options "-std=legacy" }
+c
c This program repeats many of the same tests as test_nml_1 but for integer
c instead of real. It also tests repeat nulls, comma delimited character read,
c a triplet qualifier, a range with an assumed start, a quote delimited string,
diff --git a/gcc/testsuite/gfortran.dg/namelist_14.f90 b/gcc/testsuite/gfortran.dg/namelist_14.f90
index 729f1b2d5c4..478e07fe67f 100644
--- a/gcc/testsuite/gfortran.dg/namelist_14.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_14.f90
@@ -1,4 +1,6 @@
!{ dg-do run }
+!{ dg-options "-std=legacy" }
+!
! 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_18.f90 b/gcc/testsuite/gfortran.dg/namelist_18.f90
index d54d91f9a05..87b66012d4c 100644
--- a/gcc/testsuite/gfortran.dg/namelist_18.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_18.f90
@@ -1,4 +1,6 @@
!{ dg-do run }
+!{ dg-options "-std=legacy" }
+!
! 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 c06abf5295b..4821033ecd7 100644
--- a/gcc/testsuite/gfortran.dg/namelist_19.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_19.f90
@@ -1,4 +1,6 @@
!{ dg-do run }
+!{ dg-options "-std=legacy" }
+!
! Test namelist error trapping.
! provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gfortran.dg/namelist_21.f90 b/gcc/testsuite/gfortran.dg/namelist_21.f90
index 8d2852d2cca..de88200c167 100644
--- a/gcc/testsuite/gfortran.dg/namelist_21.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_21.f90
@@ -1,4 +1,6 @@
!{ dg-do run { target fd_truncate } }
+!{ dg-options "-std=legacy" }
+!
! Tests filling arrays from a namelist read when object list is not complete.
! Developed from a test case provided by Christoph Jacob.
! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>.
diff --git a/gcc/testsuite/gfortran.dg/namelist_22.f90 b/gcc/testsuite/gfortran.dg/namelist_22.f90
index 3119e808640..e877b5beeae 100644
--- a/gcc/testsuite/gfortran.dg/namelist_22.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_22.f90
@@ -1,4 +1,6 @@
!{ dg-do run { target fd_truncate } }
+!{ dg-options "-std=legacy" }
+!
! Tests filling arrays from a namelist read when object list is not complete.
! This is the same as namelist_21.f90 except using spaces as seperators instead
! of commas. Developed from a test case provided by Christoph Jacob.
diff --git a/gcc/testsuite/gfortran.dg/namelist_37.f90 b/gcc/testsuite/gfortran.dg/namelist_37.f90
index 9ff62977710..4a46b534f67 100644
--- a/gcc/testsuite/gfortran.dg/namelist_37.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_37.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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_40.f90 b/gcc/testsuite/gfortran.dg/namelist_40.f90
index 3c9d813343a..d6f896a3956 100644
--- a/gcc/testsuite/gfortran.dg/namelist_40.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_40.f90
@@ -47,7 +47,7 @@ subroutine writenml (astring)
end subroutine writenml
end program namelist_40
-! { dg-output "Multiple sub-objects with non-zero rank in namelist object x(\n|\r\n|\r)" }
+! { dg-output "Multiple sub-objects with non-zero rank in namelist object x%m%ch(\n|\r\n|\r)" }
! { dg-output "Missing colon in substring qualifier for namelist variable x%m%ch(\n|\r\n|\r)" }
! { dg-output "Substring out of range for namelist variable x%m%ch(\n|\r\n|\r)" }
! { dg-output "Bad character in substring qualifier for namelist variable x%m%ch(\n|\r\n|\r)" }
diff --git a/gcc/testsuite/gfortran.dg/namelist_47.f90 b/gcc/testsuite/gfortran.dg/namelist_47.f90
index bc9110fa3cd..581924720bd 100644
--- a/gcc/testsuite/gfortran.dg/namelist_47.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_47.f90
@@ -45,7 +45,7 @@ subroutine writenml (astring)
end subroutine writenml
end program namelist_47
-! { dg-output "Multiple sub-objects with non-zero rank in namelist object x(\n|\r\n|\r)" }
+! { dg-output "Multiple sub-objects with non-zero rank in namelist object x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" }
! { dg-output "Missing colon in substring qualifier for namelist variable x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" }
! { dg-output "Substring out of range for namelist variable x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" }
! { dg-output "Bad character in substring qualifier for namelist variable x%m%c012345678901234567890123456789012345678901234567890123456789h(\n|\r\n|\r)" }
diff --git a/gcc/testsuite/gfortran.dg/namelist_54.f90 b/gcc/testsuite/gfortran.dg/namelist_54.f90
index 25061c48fc5..01332689340 100644
--- a/gcc/testsuite/gfortran.dg/namelist_54.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_54.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR37707 Namelist read of array of derived type incorrect.
type s
integer m
diff --git a/gcc/testsuite/gfortran.dg/namelist_55.f90 b/gcc/testsuite/gfortran.dg/namelist_55.f90
index 20c7a219cd6..9690d858d07 100644
--- a/gcc/testsuite/gfortran.dg/namelist_55.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_55.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR37707 Namelist read of array of derived type incorrect
! Test case from PR, prepared by Jerry DeLisle <jvdelisle@gcc.gnu.org>
TYPE geometry
diff --git a/gcc/testsuite/gfortran.dg/namelist_58.f90 b/gcc/testsuite/gfortran.dg/namelist_58.f90
new file mode 100644
index 00000000000..fcce01653a4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/namelist_58.f90
@@ -0,0 +1,25 @@
+! { dg-do run }
+! PR40853 Error in namelist IO.
+! Test case derived from example given in PR. < jvdelisle@gcc.gnu.org >
+program test
+ implicit none
+ type tao_title_struct
+ character(2) justify
+ end type
+ type tao_plot_page_struct
+ real shape_height_max
+ type (tao_title_struct) title ! Comment this line out and the bug goes away.
+ real size(2)
+ end type
+ type (tao_plot_page_struct) plot_page
+ namelist / params / plot_page
+ open (10, status="scratch")
+ write(10,'(a)')" &params"
+ write(10,'(a)')" plot_page%size=5 , 2,"
+ write(10,'(a)')"/"
+ rewind(10)
+ read (10, nml = params)
+ if (any(plot_page%size .ne. (/ 5, 2 /))) call abort
+ close (10)
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/namelist_empty.f90 b/gcc/testsuite/gfortran.dg/namelist_empty.f90
index 12e72ae7e4d..89493a84b34 100644
--- a/gcc/testsuite/gfortran.dg/namelist_empty.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_empty.f90
@@ -1,3 +1,6 @@
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! pr24584, segfault on namelist reading an empty string
! Contributed by Jerry DeLisle <jvdelisle@verizon.net>
implicit none
diff --git a/gcc/testsuite/gfortran.dg/namelist_use.f90 b/gcc/testsuite/gfortran.dg/namelist_use.f90
index 0460630dd33..d550e00aa6d 100644
--- a/gcc/testsuite/gfortran.dg/namelist_use.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_use.f90
@@ -6,7 +6,7 @@
! Contributed by Paul Thomas pault@gcc.gnu.org
!
module global
- character*4 :: aa
+ character(4) :: aa
integer :: ii
real :: rr
namelist /nml1/ aa, ii, rr
diff --git a/gcc/testsuite/gfortran.dg/namelist_use_only.f90 b/gcc/testsuite/gfortran.dg/namelist_use_only.f90
index a9adf015ded..d9a28a8567b 100644
--- a/gcc/testsuite/gfortran.dg/namelist_use_only.f90
+++ b/gcc/testsuite/gfortran.dg/namelist_use_only.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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/nested_modules_4.f90 b/gcc/testsuite/gfortran.dg/nested_modules_4.f90
index dde171c7ed9..6be77b36760 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_4.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_4.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
!
! Test for the fix to PR24409 - the name clash between the module
! name and the interface formal argument would cause an ICE.
diff --git a/gcc/testsuite/gfortran.dg/nested_modules_5.f90 b/gcc/testsuite/gfortran.dg/nested_modules_5.f90
index 86b43fd7b36..2ed68244ede 100644
--- a/gcc/testsuite/gfortran.dg/nested_modules_5.f90
+++ b/gcc/testsuite/gfortran.dg/nested_modules_5.f90
@@ -1,4 +1,5 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
!
! Test for supplementary fix to PR24409 - the name clash between the module
! variable and the interface formal argument would cause an ICE.
diff --git a/gcc/testsuite/gfortran.dg/open-options-blanks.f b/gcc/testsuite/gfortran.dg/open-options-blanks.f
index 8f5faa41629..4db31b9e31a 100644
--- a/gcc/testsuite/gfortran.dg/open-options-blanks.f
+++ b/gcc/testsuite/gfortran.dg/open-options-blanks.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 20163, first half: Trailing blanks on an option to
! open used to cause an error
CHARACTER*8 ST
diff --git a/gcc/testsuite/gfortran.dg/output_exponents_1.f90 b/gcc/testsuite/gfortran.dg/output_exponents_1.f90
index b645e6231a3..db47b0bfc62 100644
--- a/gcc/testsuite/gfortran.dg/output_exponents_1.f90
+++ b/gcc/testsuite/gfortran.dg/output_exponents_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 21376
! we used to take the logarithm of zero in this special case
character*10 c
diff --git a/gcc/testsuite/gfortran.dg/parens_5.f90 b/gcc/testsuite/gfortran.dg/parens_5.f90
index a6e64b4112a..ac631ef08af 100644
--- a/gcc/testsuite/gfortran.dg/parens_5.f90
+++ b/gcc/testsuite/gfortran.dg/parens_5.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Another case of fallout from the original patch for PR14771
! Testcase by Erik Zeek
module para
diff --git a/gcc/testsuite/gfortran.dg/parens_6.f90 b/gcc/testsuite/gfortran.dg/parens_6.f90
index 5a888a60056..6d5ee3b520f 100644
--- a/gcc/testsuite/gfortran.dg/parens_6.f90
+++ b/gcc/testsuite/gfortran.dg/parens_6.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR fortran/33626
! Types were not always propagated correctly
logical(kind=1) :: i, j
diff --git a/gcc/testsuite/gfortran.dg/parent_result_ref_2.f90 b/gcc/testsuite/gfortran.dg/parent_result_ref_2.f90
index 2409cb4685f..38a5fdc7b2c 100644
--- a/gcc/testsuite/gfortran.dg/parent_result_ref_2.f90
+++ b/gcc/testsuite/gfortran.dg/parent_result_ref_2.f90
@@ -16,7 +16,7 @@ contains
end subroutine sub
end function f
-function g() ! { dg-warning "is obsolescent in fortran 95" }
+function g() ! { dg-warning "Obsolescent feature" }
character(*) :: g
g = "efgh"
call sub ()
diff --git a/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90 b/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90
index b3cb2727007..0924117080c 100644
--- a/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90
+++ b/gcc/testsuite/gfortran.dg/pointer_function_actual_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for PR31209, in which an ICE would result because
! the reference to the pointer function f would be indirected, as
! if it were the result that is being passed.
diff --git a/gcc/testsuite/gfortran.dg/pr15129.f90 b/gcc/testsuite/gfortran.dg/pr15129.f90
index f9a277cb7e8..df3854d7a5f 100644
--- a/gcc/testsuite/gfortran.dg/pr15129.f90
+++ b/gcc/testsuite/gfortran.dg/pr15129.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 15129: we used to share the character length between A and B in the
! subroutine.
CHARACTER*10 A
diff --git a/gcc/testsuite/gfortran.dg/pr15332.f b/gcc/testsuite/gfortran.dg/pr15332.f
index 309b59eabf0..813e3018839 100644
--- a/gcc/testsuite/gfortran.dg/pr15332.f
+++ b/gcc/testsuite/gfortran.dg/pr15332.f
@@ -1,5 +1,7 @@
! PR libfortran/15332
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*12 c
write (c,100) 0, 1
diff --git a/gcc/testsuite/gfortran.dg/pr16597.f90 b/gcc/testsuite/gfortran.dg/pr16597.f90
index 071bf86d613..c29147411a8 100644
--- a/gcc/testsuite/gfortran.dg/pr16597.f90
+++ b/gcc/testsuite/gfortran.dg/pr16597.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! pr 16597
! libgfortran
! reading a direct access record after it was written did
diff --git a/gcc/testsuite/gfortran.dg/pr17143.f90 b/gcc/testsuite/gfortran.dg/pr17143.f90
index 1c171a3c902..4423eab7354 100644
--- a/gcc/testsuite/gfortran.dg/pr17143.f90
+++ b/gcc/testsuite/gfortran.dg/pr17143.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! pr17143
! does not print 2*63 correctly
character*25 l
diff --git a/gcc/testsuite/gfortran.dg/pr17164.f90 b/gcc/testsuite/gfortran.dg/pr17164.f90
index a0dfff9aa00..c9b4d4537d7 100644
--- a/gcc/testsuite/gfortran.dg/pr17164.f90
+++ b/gcc/testsuite/gfortran.dg/pr17164.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! pr17164
! index aborts when substring is longer than string
implicit none
diff --git a/gcc/testsuite/gfortran.dg/pr17229.f b/gcc/testsuite/gfortran.dg/pr17229.f
index da780d7feef..65f72b04d10 100644
--- a/gcc/testsuite/gfortran.dg/pr17229.f
+++ b/gcc/testsuite/gfortran.dg/pr17229.f
@@ -1,22 +1,23 @@
! PR fortran/17229
! { dg-do run }
+
integer i
logical l
l = .false.
i = -1
- if (l) if (i) 999,999,999 ! { dg-warning "Obsolescent: arithmetic IF statement" }
+ if (l) if (i) 999,999,999 ! { dg-warning "Obsolescent feature" }
l = .true.
- if (l) if (i) 10,999,999 ! { dg-warning "Obsolescent: arithmetic IF statement" }
+ if (l) if (i) 10,999,999 ! { dg-warning "Obsolescent feature" }
go to 999
10 i = 0
- if (l) if (i) 999,20,999 ! { dg-warning "Obsolescent: arithmetic IF statement" }
+ if (l) if (i) 999,20,999 ! { dg-warning "Obsolescent feature" }
go to 999
20 i = 1
- if (l) if (i) 999,999,30 ! { dg-warning "Obsolescent: arithmetic IF statement" }
+ if (l) if (i) 999,999,30 ! { dg-warning "Obsolescent feature" }
go to 999
999 call abort
diff --git a/gcc/testsuite/gfortran.dg/pr18210.f90 b/gcc/testsuite/gfortran.dg/pr18210.f90
index 60959841378..85c5afa3e95 100644
--- a/gcc/testsuite/gfortran.dg/pr18210.f90
+++ b/gcc/testsuite/gfortran.dg/pr18210.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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/pr19155.f b/gcc/testsuite/gfortran.dg/pr19155.f
index 6387c3f9ce3..770b008f9d9 100644
--- a/gcc/testsuite/gfortran.dg/pr19155.f
+++ b/gcc/testsuite/gfortran.dg/pr19155.f
@@ -1,4 +1,5 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
!
! 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/pr20086.f90 b/gcc/testsuite/gfortran.dg/pr20086.f90
index e5759da3dc1..26b53276dc3 100644
--- a/gcc/testsuite/gfortran.dg/pr20086.f90
+++ b/gcc/testsuite/gfortran.dg/pr20086.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 20086 - Missing characters in output with hollerith strings
implicit none
character*80 line
diff --git a/gcc/testsuite/gfortran.dg/pr20124.f90 b/gcc/testsuite/gfortran.dg/pr20124.f90
index 69f4f18b29c..5d05abf6eb1 100644
--- a/gcc/testsuite/gfortran.dg/pr20124.f90
+++ b/gcc/testsuite/gfortran.dg/pr20124.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! pr 20124
character*80 line
x = -.01
diff --git a/gcc/testsuite/gfortran.dg/pr20755.f b/gcc/testsuite/gfortran.dg/pr20755.f
index e2bac5a7dcc..4a9b69cad57 100644
--- a/gcc/testsuite/gfortran.dg/pr20755.f
+++ b/gcc/testsuite/gfortran.dg/pr20755.f
@@ -1,5 +1,7 @@
! PR libfortran/20755
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*30 s
write (s,2000) 0.0, 0.02
diff --git a/gcc/testsuite/gfortran.dg/pr20865.f90 b/gcc/testsuite/gfortran.dg/pr20865.f90
index 96d0d791cb0..5c26965ccc5 100644
--- a/gcc/testsuite/gfortran.dg/pr20865.f90
+++ b/gcc/testsuite/gfortran.dg/pr20865.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR fortran/20865
subroutine tt(j)
integer :: j
diff --git a/gcc/testsuite/gfortran.dg/pr20950.f b/gcc/testsuite/gfortran.dg/pr20950.f
index c132548c829..942696c618f 100644
--- a/gcc/testsuite/gfortran.dg/pr20950.f
+++ b/gcc/testsuite/gfortran.dg/pr20950.f
@@ -1,6 +1,8 @@
! PR libfortran/20950
! Original bug-report by Walt Brainerd, The Fortran Company
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*20 c
inquire (33, sequential = c)
if (c .ne. "UNKNOWN") call abort
diff --git a/gcc/testsuite/gfortran.dg/pr21730.f b/gcc/testsuite/gfortran.dg/pr21730.f
index 9542c023420..1fe19edfae4 100644
--- a/gcc/testsuite/gfortran.dg/pr21730.f
+++ b/gcc/testsuite/gfortran.dg/pr21730.f
@@ -1,5 +1,7 @@
! PR fortran/21730
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*2 a
character*4 b
character*6 c
diff --git a/gcc/testsuite/gfortran.dg/pr22491.f b/gcc/testsuite/gfortran.dg/pr22491.f
index 1cd35577022..70210f6b095 100644
--- a/gcc/testsuite/gfortran.dg/pr22491.f
+++ b/gcc/testsuite/gfortran.dg/pr22491.f
@@ -1,5 +1,7 @@
! PR fortran/21730
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
character*2 a (1)
character*4 b (1)
character*6 c
diff --git a/gcc/testsuite/gfortran.dg/pr29713.f90 b/gcc/testsuite/gfortran.dg/pr29713.f90
index be4accd6edd..e60904395ae 100644
--- a/gcc/testsuite/gfortran.dg/pr29713.f90
+++ b/gcc/testsuite/gfortran.dg/pr29713.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
character*2 a
character*4 b
parameter (a="12")
diff --git a/gcc/testsuite/gfortran.dg/pr32921.f b/gcc/testsuite/gfortran.dg/pr32921.f
index 42bb986ada0..544665051ac 100644
--- a/gcc/testsuite/gfortran.dg/pr32921.f
+++ b/gcc/testsuite/gfortran.dg/pr32921.f
@@ -45,6 +45,6 @@
RETURN
END
-! { dg-final { scan-tree-dump-times "stride" 4 "lim" } }
-! { dg-final { cleanup-tree-dump "lim" } }
+! { dg-final { scan-tree-dump-times "stride" 4 "lim1" } }
+! { dg-final { cleanup-tree-dump "lim\[1-2\]" } }
! { dg-final { cleanup-modules "LES3D_DATA" } }
diff --git a/gcc/testsuite/gfortran.dg/pr40999.f b/gcc/testsuite/gfortran.dg/pr40999.f
new file mode 100644
index 00000000000..0d93069c592
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr40999.f
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-options "-O3 -fwhole-file" }
+
+ SUBROUTINE ZLARFG( ALPHA )
+ ALPHA = ZLADIV( DCMPLX( 1.0D+0 ) )
+ END
+ COMPLEX*16 FUNCTION ZLADIV( X )
+ COMPLEX*16 X
+ CALL DLADIV( DBLE( X ), DIMAG( X ) )
+ END
+
diff --git a/gcc/testsuite/gfortran.dg/pr41011.f b/gcc/testsuite/gfortran.dg/pr41011.f
new file mode 100644
index 00000000000..4ad4a8fc582
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr41011.f
@@ -0,0 +1,23 @@
+! { dg-do compile }
+! { dg-options "-O3 -fwhole-file" }
+ CALL UVSET(NX,NY,NZ,HVAR,ZET,NP,DZ,DKM,UM,VM,UG,VG,TM,DCDX, ! { dg-warning "Rank mismatch" }
+ *ITY,ISH,NSMT,F)
+ CALL DCTDX(NX,NY,NX1,NFILT,C(MLAG),DCDX(MLAG),HELP,HELPA,
+ * HELP,HELPA,FY,FYC,SAVEY)
+ END
+ SUBROUTINE PADEC(DKS,DKDS,HVAR,WM,WG,FN,NS,AN,BN,CN,IT)
+ COMPLEX*16 WM(*),WG(*),FN(*),AN(*),BN(*),CN(*)
+ BN(J)=F4+AS+GAMMA*F2
+ CN(J)=F4-AS+GAMMA*F2
+ FN(J)=(AS+F4-GAMMA*F2)*H2+(F4-AS-GAMMA*F2)*H0+
+ * H1*(F3-GAMMA/3.D0)+GAMMA*WG(J)-CONST
+ END
+ SUBROUTINE UVSET(NX,NY,NZ,HVAR,ZET,NP,DZ,DKM,UM,VM,UG,VG,TM,
+ *WORK,ITY,IH,NSMT,F)
+ DIMENSION HVAR(*),ZET(*),TM(*),DKM(*),UM(*),VM(*),UG(*),VG(*),
+ *WORK(*)
+ IF(IH.EQ.0) THEN
+ CALL PADEC(DKM,VM,HVAR,WORK(LWM),WORK(LWG), ! { dg-warning "Rank mismatch" }
+ * WORK(LF),NZ,WORK(LA),WORK(LB),WORK(LC),ITY)
+ ENDIF
+ END
diff --git a/gcc/testsuite/gfortran.dg/print_parentheses_1.f b/gcc/testsuite/gfortran.dg/print_parentheses_1.f
index 26041c7f1d6..d644483232a 100644
--- a/gcc/testsuite/gfortran.dg/print_parentheses_1.f
+++ b/gcc/testsuite/gfortran.dg/print_parentheses_1.f
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
program main
character*80 line
print (line,'(A)'), 'hello' ! { dg-error "Syntax error" }
diff --git a/gcc/testsuite/gfortran.dg/print_parentheses_2.f90 b/gcc/testsuite/gfortran.dg/print_parentheses_2.f90
index 699f507dafb..520973ed160 100644
--- a/gcc/testsuite/gfortran.dg/print_parentheses_2.f90
+++ b/gcc/testsuite/gfortran.dg/print_parentheses_2.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
program main
character*80 line
print (line,'(A)'), 'hello' ! { dg-error "Syntax error" }
diff --git a/gcc/testsuite/gfortran.dg/proc_assign_1.f90 b/gcc/testsuite/gfortran.dg/proc_assign_1.f90
index 919089acb42..e85df7635de 100644
--- a/gcc/testsuite/gfortran.dg/proc_assign_1.f90
+++ b/gcc/testsuite/gfortran.dg/proc_assign_1.f90
@@ -1,4 +1,6 @@
-! { dg-do compile }
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! This tests the patch for PR26787 in which it was found that setting
! the result of one module procedure from within another produced an
! ICE rather than an error.
diff --git a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 b/gcc/testsuite/gfortran.dg/proc_decl_1.f90
index c7ec4f2f3fc..de7cb4159c1 100644
--- a/gcc/testsuite/gfortran.dg/proc_decl_1.f90
+++ b/gcc/testsuite/gfortran.dg/proc_decl_1.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! This tests various error messages for PROCEDURE declarations.
! Contributed by Janus Weil <jaydub66@gmail.com>
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_17.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_17.f90
index 20e059fca3a..55b8bce24d9 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_17.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_17.f90
@@ -6,7 +6,7 @@
! Contributed by Tobias Burnus <burnus@net-b.de>
procedure(), pointer :: p
- f(x) = x**2
+ f(x) = x**2 ! { dg-warning "Obsolescent feature" }
p => f ! { dg-error "invalid in procedure pointer assignment" }
p => sub ! { dg-error "invalid in procedure pointer assignment" }
contains
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_13.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_13.f90
index 45ffa1e1274..afc8f55b5d3 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_comp_13.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_13.f90
@@ -1,6 +1,7 @@
! { dg-do run }
!
-! PR 40882: [F03] infinite recursion in gfc_get_derived_type with PPC returning derived type
+! PR 40882: [F03] infinite recursion in gfc_get_derived_type with PPC returning derived type.
+! At the same time, check that a formal argument does not cause infinite recursion (PR 40870).
!
! Contributed by Janus Weil <janus@gcc.gnu.org>
@@ -9,6 +10,7 @@ implicit none
type :: t
integer :: data
procedure(foo), pointer, nopass :: ppc
+ procedure(type(t)), pointer, nopass :: ppc2
end type
type(t) :: o,o2
@@ -16,7 +18,7 @@ type(t) :: o,o2
o%data = 1
o%ppc => foo
-o2 = o%ppc()
+o2 = o%ppc(o)
if (o%data /= 1) call abort()
if (o2%data /= 5) call abort()
@@ -25,9 +27,9 @@ if (associated(o2%ppc)) call abort()
contains
- function foo()
- type(t) :: foo
- foo%data = 5
+ function foo(arg)
+ type(t) :: foo, arg
+ foo%data = arg%data * 5
foo%ppc => NULL()
end function
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_14.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_14.f90
new file mode 100644
index 00000000000..811223ee2d1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_14.f90
@@ -0,0 +1,40 @@
+! { dg-do run }
+!
+! PR 41022: [F03] procedure pointer components as actual arguments
+!
+! Contributed by Juergen Reuter <reuter@physik.uni-freiburg.de>
+
+program foo
+
+ type :: container_t
+ procedure(proc), nopass, pointer :: proc => null ()
+ end type container_t
+
+ type(container_t), target :: obj1
+ type(container_t) :: obj2
+
+ obj1%proc => proc
+ call transfer_proc_ptr (obj2, obj1)
+
+ if (obj2%proc()/=7) call abort()
+
+contains
+
+ subroutine transfer_proc_ptr (obj2, obj1)
+ type(container_t), intent(out) :: obj2
+ type(container_t), intent(in), target :: obj1
+ call assign_proc_ptr (obj2%proc, obj1)
+ end subroutine transfer_proc_ptr
+
+ subroutine assign_proc_ptr (ptr, obj1)
+ procedure(proc), pointer :: ptr
+ type(container_t), intent(in), target :: obj1
+ ptr => obj1%proc
+ end subroutine assign_proc_ptr
+
+ integer function proc ()
+ proc = 7
+ end function
+
+end program foo
+
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_1.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_1.f90
index 14a21ec8f53..2a73bdad35b 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_1.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_1.f90
@@ -17,7 +17,7 @@ module mymod
abstract interface
subroutine set_int_value(this,i)
import
- type(mytype), intent(inout) :: this
+ class(mytype), intent(inout) :: this
integer, intent(in) :: i
end subroutine set_int_value
end interface
@@ -25,7 +25,7 @@ module mymod
contains
subroutine seti_proc(this,i)
- type(mytype), intent(inout) :: this
+ class(mytype), intent(inout) :: this
integer, intent(in) :: i
this%i=i
end subroutine seti_proc
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_2.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_2.f90
index c6671a639c9..9e3cd5835e6 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_2.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_2.f90
@@ -17,14 +17,14 @@ module passed_object_example
contains
subroutine print_me (arg, lun)
- type(t), intent(in) :: arg
+ class(t), intent(in) :: arg
integer, intent(in) :: lun
if (abs(arg%a-2.718)>1E-6) call abort()
write (lun,*) arg%a
end subroutine print_me
subroutine print_my_square (arg, lun)
- type(t), intent(in) :: arg
+ class(t), intent(in) :: arg
integer, intent(in) :: lun
if (abs(arg%a-2.718)>1E-6) call abort()
write (lun,*) arg%a**2
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_3.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_3.f90
index 15a090425eb..3c56794166a 100644
--- a/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_3.f90
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_pass_3.f90
@@ -16,7 +16,7 @@ abstract interface
subroutine obp(w,x)
import :: t
integer :: w
- type(t) :: x
+ class(t) :: x
end subroutine
end interface
@@ -30,7 +30,7 @@ contains
subroutine my_obp_sub(w,x)
integer :: w
- type(t) :: x
+ class(t) :: x
if (x%name/="doodoo") call abort()
if (w/=32) call abort()
end subroutine
diff --git a/gcc/testsuite/gfortran.dg/read_eor.f90 b/gcc/testsuite/gfortran.dg/read_eor.f90
index f3327550297..e6c849eab76 100644
--- a/gcc/testsuite/gfortran.dg/read_eor.f90
+++ b/gcc/testsuite/gfortran.dg/read_eor.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR24489 Assure that read does not go past the end of record. The width of
! the format specifier is 8, but the internal unit record length is 4 so only
! the first 4 characters should be read.
diff --git a/gcc/testsuite/gfortran.dg/read_float_1.f90 b/gcc/testsuite/gfortran.dg/read_float_1.f90
index 86589c053b6..0848ee67590 100644
--- a/gcc/testsuite/gfortran.dg/read_float_1.f90
+++ b/gcc/testsuite/gfortran.dg/read_float_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR18218
! The IO library has an algorithm that involved repeated multiplication by 10,
! resulting in introducing large cumulative floating point errors.
diff --git a/gcc/testsuite/gfortran.dg/read_logical.f90 b/gcc/testsuite/gfortran.dg/read_logical.f90
index 1e74c8e1a1b..7b7ba8c3a25 100644
--- a/gcc/testsuite/gfortran.dg/read_logical.f90
+++ b/gcc/testsuite/gfortran.dg/read_logical.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 26554 : Test logical read from string. Test case derived from PR.
! Submitted by Jerry DeLisle <jvdelisle@verizon.net>.
program bug
@@ -13,4 +15,4 @@ program bug
read (strg,*) l
if (.not.l) call abort()
end
- \ No newline at end of file
+
diff --git a/gcc/testsuite/gfortran.dg/recursive_statement_functions.f90 b/gcc/testsuite/gfortran.dg/recursive_statement_functions.f90
index 8f9b0918370..bcf51f8d5e9 100644
--- a/gcc/testsuite/gfortran.dg/recursive_statement_functions.f90
+++ b/gcc/testsuite/gfortran.dg/recursive_statement_functions.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! PR20866 - A statement function cannot be recursive.
! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
!
diff --git a/gcc/testsuite/gfortran.dg/return_1.f90 b/gcc/testsuite/gfortran.dg/return_1.f90
index a66b4c199ed..a8067b03c08 100644
--- a/gcc/testsuite/gfortran.dg/return_1.f90
+++ b/gcc/testsuite/gfortran.dg/return_1.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Test cases where no blank is required after RETURN
subroutine sub(*)
return(1)
diff --git a/gcc/testsuite/gfortran.dg/rewind_1.f90 b/gcc/testsuite/gfortran.dg/rewind_1.f90
index cbd2ef17b8f..92edf6dfed9 100644
--- a/gcc/testsuite/gfortran.dg/rewind_1.f90
+++ b/gcc/testsuite/gfortran.dg/rewind_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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 6af85c344ef..cff9eae7ae7 100644
--- a/gcc/testsuite/gfortran.dg/runtime_warning_1.f90
+++ b/gcc/testsuite/gfortran.dg/runtime_warning_1.f90
@@ -5,7 +5,7 @@
! { dg-options "-pedantic" }
! { dg-do run }
!
- character*5 c
+ character(5) c
open (42,status='scratch')
write (42,'(A,$)') 'abc' ! { dg-warning ".*descriptor" "" }
write (42,'(A)') 'de'
diff --git a/gcc/testsuite/gfortran.dg/scalar_return_1.f90 b/gcc/testsuite/gfortran.dg/scalar_return_1.f90
index d7583bc10b4..df206458e3a 100644
--- a/gcc/testsuite/gfortran.dg/scalar_return_1.f90
+++ b/gcc/testsuite/gfortran.dg/scalar_return_1.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! tests the fix for pr25082 in which the return of an array by a
! subroutine went undremarked.
!
diff --git a/gcc/testsuite/gfortran.dg/stfunc_1.f90 b/gcc/testsuite/gfortran.dg/stfunc_1.f90
index e21f34e063b..46dde6286b6 100644
--- a/gcc/testsuite/gfortran.dg/stfunc_1.f90
+++ b/gcc/testsuite/gfortran.dg/stfunc_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! this is a problem which disappeared between 2005-01-02 and 2005-03-13
! PR 18600
logical a, b
diff --git a/gcc/testsuite/gfortran.dg/stfunc_3.f90 b/gcc/testsuite/gfortran.dg/stfunc_3.f90
index 42eedf8c830..90980a92448 100644
--- a/gcc/testsuite/gfortran.dg/stfunc_3.f90
+++ b/gcc/testsuite/gfortran.dg/stfunc_3.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for PR20867 in which implicit typing was not done within
! statement functions and so was not confirmed or not by subsequent
! type delarations.
diff --git a/gcc/testsuite/gfortran.dg/stfunc_4.f90 b/gcc/testsuite/gfortran.dg/stfunc_4.f90
index e995fb86bec..2f0efccf326 100644
--- a/gcc/testsuite/gfortran.dg/stfunc_4.f90
+++ b/gcc/testsuite/gfortran.dg/stfunc_4.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for PR29389, in which the statement function would not be
! recognised as PURE within a PURE procedure.
diff --git a/gcc/testsuite/gfortran.dg/stfunc_6.f90 b/gcc/testsuite/gfortran.dg/stfunc_6.f90
index c5657833c0f..482d12592f3 100644
--- a/gcc/testsuite/gfortran.dg/stfunc_6.f90
+++ b/gcc/testsuite/gfortran.dg/stfunc_6.f90
@@ -1,4 +1,6 @@
! { dg-do compile }
+! { dg-options "-std=legacy" }
+!
! Tests the fix for the second bit of PR29389, in which the
! statement function would not be recognised as not PURE
! when it referenced a procedure that is not PURE.
diff --git a/gcc/testsuite/gfortran.dg/streamio_2.f90 b/gcc/testsuite/gfortran.dg/streamio_2.f90
index a7d5d3ccfaa..8260a7481c9 100644
--- a/gcc/testsuite/gfortran.dg/streamio_2.f90
+++ b/gcc/testsuite/gfortran.dg/streamio_2.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR25828 Stream IO test 2
! Contributed by Jerry DeLisle <jvdelisle@verizon.net>.
PROGRAM readUstream
@@ -16,4 +18,5 @@ PROGRAM readUstream
if (string.ne."rst") call abort()
if (n.ne.7) call abort()
close(unit=11, status="delete")
-END PROGRAM readUstream \ No newline at end of file
+END PROGRAM readUstream
+
diff --git a/gcc/testsuite/gfortran.dg/string_ctor_1.f90 b/gcc/testsuite/gfortran.dg/string_ctor_1.f90
index 3242ea8f9e3..7e5c2f9f030 100644
--- a/gcc/testsuite/gfortran.dg/string_ctor_1.f90
+++ b/gcc/testsuite/gfortran.dg/string_ctor_1.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Program to test character array constructors.
! PR17144
subroutine test1 (n, t, u)
diff --git a/gcc/testsuite/gfortran.dg/string_null_compare_1.f b/gcc/testsuite/gfortran.dg/string_null_compare_1.f
index 2e6eb1b2b88..659b3eb3709 100644
--- a/gcc/testsuite/gfortran.dg/string_null_compare_1.f
+++ b/gcc/testsuite/gfortran.dg/string_null_compare_1.f
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! PR 27784 - Different strings should compare unequal even if they
! have CHAR(0) in them.
diff --git a/gcc/testsuite/gfortran.dg/structure_constructor_10.f90 b/gcc/testsuite/gfortran.dg/structure_constructor_10.f90
new file mode 100644
index 00000000000..eed7fa3a9d2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/structure_constructor_10.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+!
+! PR 41070: [4.5 Regression] Error: Components of structure constructor '' at (1) are PRIVATE
+!
+! Contributed by Michael Richmond <michael.a.richmond@nasa.gov>
+
+MODULE cdf_aux_mod
+IMPLICIT NONE
+
+TYPE :: one_parameter
+ CHARACTER (8) :: name
+END TYPE one_parameter
+
+TYPE :: the_distribution
+ CHARACTER (8) :: name
+END TYPE the_distribution
+
+TYPE (the_distribution), PARAMETER :: the_beta = the_distribution('cdf_beta')
+END MODULE cdf_aux_mod
+
+SUBROUTINE cdf_beta()
+ USE cdf_aux_mod
+ IMPLICIT NONE
+ CALL check_complements(the_beta%name)
+END SUBROUTINE cdf_beta
+
+! { dg-final { cleanup-modules "cdf_aux_mod" } }
+
diff --git a/gcc/testsuite/gfortran.dg/substr_6.f90 b/gcc/testsuite/gfortran.dg/substr_6.f90
index ee0eae49e0e..813a02521a3 100644
--- a/gcc/testsuite/gfortran.dg/substr_6.f90
+++ b/gcc/testsuite/gfortran.dg/substr_6.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! Check that NULs don't mess up constant substring simplification
CHARACTER(5), parameter :: c0(1) = (/ "123" // ACHAR(0) // "5" /)
CHARACTER*5 c(1)
diff --git a/gcc/testsuite/gfortran.dg/tl_editing.f90 b/gcc/testsuite/gfortran.dg/tl_editing.f90
index d2a7ede436f..830c7eb71bd 100644
--- a/gcc/testsuite/gfortran.dg/tl_editing.f90
+++ b/gcc/testsuite/gfortran.dg/tl_editing.f90
@@ -1,4 +1,6 @@
! { dg-do run }
+! { dg-options "-std=legacy" }
+!
! 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/transfer_resolve_1.f90 b/gcc/testsuite/gfortran.dg/transfer_resolve_1.f90
new file mode 100644
index 00000000000..8d326a186a4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/transfer_resolve_1.f90
@@ -0,0 +1,21 @@
+! { dg-do run }
+! PR40847 - an error in gfc_resolve_transfer caused the character length
+! of 'mold' to be set incorrectly.
+!
+! Contributed by Joost VandeVondele <jv244@cam.ac.uk>
+!
+program test_elemental
+
+if (any (transfer_size((/0.,0./),(/'a','b'/)) .ne. [4 ,4])) call abort
+
+contains
+
+ elemental function transfer_size (source, mold)
+ real, intent(in) :: source
+ character(*), intent(in) :: mold
+ integer :: transfer_size
+ transfer_size = SIZE(TRANSFER(source, (/mold/)))
+ return
+ end function transfer_size
+
+end program test_elemental
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_10.f03 b/gcc/testsuite/gfortran.dg/typebound_call_10.f03
index 29b6401f56b..77667fba733 100644
--- a/gcc/testsuite/gfortran.dg/typebound_call_10.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_call_10.f03
@@ -19,7 +19,7 @@ contains
subroutine foo(x,y)
type(t),optional :: x
- type(t) :: y
+ class(t) :: y
if(present(x)) then
print *, 'foo', x%i, y%i
else
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_2.f03 b/gcc/testsuite/gfortran.dg/typebound_call_2.f03
index d3149d56d39..f6e623c498a 100644
--- a/gcc/testsuite/gfortran.dg/typebound_call_2.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_call_2.f03
@@ -27,7 +27,7 @@ CONTAINS
INTEGER FUNCTION func_add (me, x)
IMPLICIT NONE
- TYPE(add) :: me
+ CLASS(add) :: me
INTEGER :: x
func_add = me%val + x
END FUNCTION func_add
@@ -35,14 +35,14 @@ CONTAINS
SUBROUTINE sub_add (res, me, x)
IMPLICIT NONE
INTEGER, INTENT(OUT) :: res
- TYPE(add), INTENT(IN) :: me
+ CLASS(add), INTENT(IN) :: me
INTEGER, INTENT(IN) :: x
res = me%val + x
END SUBROUTINE sub_add
SUBROUTINE swap (me1, me2)
IMPLICIT NONE
- TYPE(trueOrFalse), INTENT(INOUT) :: me1, me2
+ CLASS(trueOrFalse), INTENT(INOUT) :: me1, me2
IF (.NOT. me1%val .OR. me2%val) THEN
CALL abort ()
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_3.f03 b/gcc/testsuite/gfortran.dg/typebound_call_3.f03
index f06e1cb70f4..028c5b124b0 100644
--- a/gcc/testsuite/gfortran.dg/typebound_call_3.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_call_3.f03
@@ -19,7 +19,7 @@ CONTAINS
SUBROUTINE swap (me1, me2)
IMPLICIT NONE
- TYPE(trueOrFalse), INTENT(INOUT) :: me1, me2
+ CLASS(trueOrFalse), INTENT(INOUT) :: me1, me2
IF (.NOT. me1%val .OR. me2%val) THEN
CALL abort ()
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_4.f03 b/gcc/testsuite/gfortran.dg/typebound_call_4.f03
index d05838bfb27..25745fda488 100644
--- a/gcc/testsuite/gfortran.dg/typebound_call_4.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_call_4.f03
@@ -24,7 +24,7 @@ CONTAINS
SUBROUTINE proc (me)
IMPLICIT NONE
- TYPE(t), INTENT(INOUT) :: me
+ CLASS(t), INTENT(INOUT) :: me
END SUBROUTINE proc
INTEGER FUNCTION func ()
diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_3.f03 b/gcc/testsuite/gfortran.dg/typebound_generic_3.f03
index fc565740976..d70828265ca 100644
--- a/gcc/testsuite/gfortran.dg/typebound_generic_3.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_generic_3.f03
@@ -35,7 +35,7 @@ CONTAINS
SUBROUTINE passed_intint (me, x, y)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
INTEGER :: x, y
WRITE (*,*) "Passed Integer"
END SUBROUTINE passed_intint
@@ -43,7 +43,7 @@ CONTAINS
SUBROUTINE passed_realreal (x, me, y)
IMPLICIT NONE
REAL :: x, y
- TYPE(t) :: me
+ CLASS(t) :: me
WRITE (*,*) "Passed Real"
END SUBROUTINE passed_realreal
diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_4.f03 b/gcc/testsuite/gfortran.dg/typebound_generic_4.f03
index edd62be0ccf..28af021f85d 100644
--- a/gcc/testsuite/gfortran.dg/typebound_generic_4.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_generic_4.f03
@@ -25,7 +25,7 @@ contains
subroutine foo_v_inner(x,a)
real :: x(:)
- type(foo) :: a
+ class(foo) :: a
a%i = int(x(1))
WRITE (*,*) "Vector"
@@ -33,7 +33,7 @@ contains
subroutine foo_m_inner(x,a)
real :: x(:,:)
- type(foo) :: a
+ class(foo) :: a
a%i = int(x(1,1))
WRITE (*,*) "Matrix"
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_1.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_1.f03
new file mode 100644
index 00000000000..fd74d9b06d5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_operator_1.f03
@@ -0,0 +1,50 @@
+! { dg-do compile }
+! { dg-options "-w" }
+! FIXME: Remove -w once CLASS is fully supported.
+
+! Type-bound procedures
+! Check correct type-bound operator definitions.
+
+MODULE m
+ IMPLICIT NONE
+
+ TYPE t ! { dg-error "not yet implemented" }
+ CONTAINS
+ PROCEDURE, PASS :: onearg
+ PROCEDURE, PASS :: twoarg1
+ PROCEDURE, PASS :: twoarg2
+ PROCEDURE, PASS(me) :: assign_proc
+
+ GENERIC :: OPERATOR(.BINARY.) => twoarg1, twoarg2
+ GENERIC :: OPERATOR(.UNARY.) => onearg
+ GENERIC :: ASSIGNMENT(=) => assign_proc
+ END TYPE t
+
+CONTAINS
+
+ INTEGER FUNCTION onearg (me)
+ CLASS(t), INTENT(IN) :: me
+ onearg = 5
+ END FUNCTION onearg
+
+ INTEGER FUNCTION twoarg1 (me, a)
+ CLASS(t), INTENT(IN) :: me
+ INTEGER, INTENT(IN) :: a
+ twoarg1 = 42
+ END FUNCTION twoarg1
+
+ INTEGER FUNCTION twoarg2 (me, a)
+ CLASS(t), INTENT(IN) :: me
+ REAL, INTENT(IN) :: a
+ twoarg2 = 123
+ END FUNCTION twoarg2
+
+ SUBROUTINE assign_proc (me, b)
+ CLASS(t), INTENT(OUT) :: me
+ CLASS(t), INTENT(IN) :: b
+ me = t ()
+ END SUBROUTINE assign_proc
+
+END MODULE m
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_2.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_2.f03
new file mode 100644
index 00000000000..67f467cf9b8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_operator_2.f03
@@ -0,0 +1,70 @@
+! { dg-do compile }
+! { dg-options "-w" }
+! FIXME: Remove -w once CLASS is fully supported.
+
+! Type-bound procedures
+! Checks for correct errors with invalid OPERATOR/ASSIGNMENT usage.
+
+MODULE m
+ IMPLICIT NONE
+
+ TYPE t ! { dg-error "not yet implemented" }
+ CONTAINS
+ PROCEDURE, PASS :: onearg
+ PROCEDURE, PASS :: onearg_alt => onearg
+ PROCEDURE, PASS :: onearg_alt2 => onearg
+ PROCEDURE, NOPASS :: nopassed => onearg
+ PROCEDURE, PASS :: threearg
+ PROCEDURE, PASS :: sub
+ PROCEDURE, PASS :: sub2 ! { dg-error "must be a FUNCTION" }
+ PROCEDURE, PASS :: func
+
+ ! These give errors at the targets' definitions.
+ GENERIC :: OPERATOR(.AND.) => sub2
+ GENERIC :: OPERATOR(*) => onearg
+ GENERIC :: ASSIGNMENT(=) => func
+
+ GENERIC :: OPERATOR(.UOPA.) => sub ! { dg-error "must be a FUNCTION" }
+ GENERIC :: OPERATOR(.UOPB.) => threearg ! { dg-error "at most, two arguments" }
+ ! We can't check for the 'at least one argument' error, because in this case
+ ! the procedure must be NOPASS and that other error is issued. But of
+ ! course this should be alright.
+
+ GENERIC :: OPERATOR(.UNARY.) => onearg_alt
+ GENERIC, PRIVATE :: OPERATOR(.UNARY.) => onearg_alt2 ! { dg-error "must have the same access" }
+
+ GENERIC :: OPERATOR(.UNARYPRIME.) => nopassed ! { dg-error "can't be NOPASS" }
+ GENERIC :: OPERATOR(-) => nopassed ! { dg-error "can't be NOPASS" }
+ END TYPE t
+
+CONTAINS
+
+ INTEGER FUNCTION onearg (me) ! { dg-error "wrong number of arguments" }
+ CLASS(t), INTENT(IN) :: me
+ onearg = 5
+ END FUNCTION onearg
+
+ INTEGER FUNCTION threearg (a, b, c)
+ CLASS(t), INTENT(IN) :: a, b, c
+ threearg = 42
+ END FUNCTION threearg
+
+ LOGICAL FUNCTION func (me, b) ! { dg-error "must be a SUBROUTINE" }
+ CLASS(t), INTENT(OUT) :: me
+ CLASS(t), INTENT(IN) :: b
+ me = t ()
+ func = .TRUE.
+ END FUNCTION func
+
+ SUBROUTINE sub (a)
+ CLASS(t), INTENT(IN) :: a
+ END SUBROUTINE sub
+
+ SUBROUTINE sub2 (a, x)
+ CLASS(t), INTENT(IN) :: a
+ INTEGER, INTENT(IN) :: x
+ END SUBROUTINE sub2
+
+END MODULE m
+
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_1.f08 b/gcc/testsuite/gfortran.dg/typebound_proc_1.f08
index dafd684718b..3437baaa63c 100644
--- a/gcc/testsuite/gfortran.dg/typebound_proc_1.f08
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_1.f08
@@ -51,19 +51,19 @@ CONTAINS
SUBROUTINE proc1 (me)
IMPLICIT NONE
- TYPE(t1) :: me
+ CLASS(t1) :: me
END SUBROUTINE proc1
REAL FUNCTION proc2 (x, me)
IMPLICIT NONE
REAL :: x
- TYPE(t1) :: me
+ CLASS(t1) :: me
proc2 = x / 2
END FUNCTION proc2
INTEGER FUNCTION proc3 (me)
IMPLICIT NONE
- TYPE(t2) :: me
+ CLASS(t2) :: me
proc3 = 42
END FUNCTION proc3
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_5.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_5.f03
index edc55a17d30..1251e3f97f9 100644
--- a/gcc/testsuite/gfortran.dg/typebound_proc_5.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_5.f03
@@ -71,19 +71,19 @@ CONTAINS
SUBROUTINE proc_arg_first (me, x)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
REAL :: x
END SUBROUTINE proc_arg_first
INTEGER FUNCTION proc_arg_middle (x, me, y)
IMPLICIT NONE
REAL :: x, y
- TYPE(t) :: me
+ CLASS(t) :: me
END FUNCTION proc_arg_middle
SUBROUTINE proc_arg_last (x, me)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
REAL :: x
END SUBROUTINE proc_arg_last
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_6.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_6.f03
index e7d09a055f4..eba48366098 100644
--- a/gcc/testsuite/gfortran.dg/typebound_proc_6.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_proc_6.f03
@@ -134,47 +134,47 @@ CONTAINS
SUBROUTINE proc_stme1 (me, a)
IMPLICIT NONE
- TYPE(supert) :: me
+ CLASS(supert) :: me
INTEGER :: a
END SUBROUTINE proc_stme1
SUBROUTINE proc_tme1 (me, a)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
INTEGER :: a
END SUBROUTINE proc_tme1
SUBROUTINE proc_stmeme (me1, me2)
IMPLICIT NONE
- TYPE(supert) :: me1, me2
+ CLASS(supert) :: me1, me2
END SUBROUTINE proc_stmeme
SUBROUTINE proc_tmeme (me1, me2)
IMPLICIT NONE
- TYPE(t) :: me1, me2
+ CLASS(t) :: me1, me2
END SUBROUTINE proc_tmeme
SUBROUTINE proc_stmeint (me, a)
IMPLICIT NONE
- TYPE(supert) :: me
+ CLASS(supert) :: me
INTEGER :: a
END SUBROUTINE proc_stmeint
SUBROUTINE proc_tmeint (me, a)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
INTEGER :: a
END SUBROUTINE proc_tmeint
SUBROUTINE proc_tmeintx (me, x)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
INTEGER :: x
END SUBROUTINE proc_tmeintx
SUBROUTINE proc_tmereal (me, a)
IMPLICIT NONE
- TYPE(t) :: me
+ CLASS(t) :: me
REAL :: a
END SUBROUTINE proc_tmereal
diff --git a/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 b/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
index 3d35312c92c..31765699750 100644
--- a/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
+++ b/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90
@@ -16,7 +16,7 @@ program main
integer n
real r(size)
integer i
- character*4 str
+ character(4) str
m(1) = Z'11223344' ! { dg-warning "BOZ literal at .1. outside a DATA statement" }
m(2) = Z'55667788' ! { dg-warning "BOZ literal at .1. outside a DATA statement" }
diff --git a/gcc/testsuite/gfortran.dg/unlimited_fmt_1.f08 b/gcc/testsuite/gfortran.dg/unlimited_fmt_1.f08
new file mode 100644
index 00000000000..5089d32ff4d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/unlimited_fmt_1.f08
@@ -0,0 +1,17 @@
+! { dg-do run }
+! PR41075 Implement unlimited format item '*'.
+! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program unlimited
+ implicit none
+ integer i
+ character(len=60) :: string
+ integer, parameter :: n = 10
+ integer, dimension(n) :: iarray
+ iarray = (/ (i,i=1,n) /)
+ do i=1,10
+ write( string, '( "iarray =", *(g0, :, ","))') &
+ & "abcdefg",iarray, i,"jklmnop"
+ end do
+ if (string.ne."iarray =abcdefg,1,2,3,4,5,6,7,8,9,10,10,jklmnop") &
+ & call abort
+end program unlimited
diff --git a/gcc/testsuite/gfortran.dg/use_only_4.f90 b/gcc/testsuite/gfortran.dg/use_only_4.f90
new file mode 100644
index 00000000000..a37db45ef77
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/use_only_4.f90
@@ -0,0 +1,34 @@
+! { dg-do compile }
+! Test the fix for PR41062, in which an ICE would ensue because
+! of confusion between the two 'one's in the creation of module
+! debug info.
+!
+! Reported by Norman S. Clerman <clerman@fuse.net>
+! Reduced testcase by Tobias Burnus <burnus@gcc.gnu.org>
+!
+module m1
+ interface one ! GENERIC "one"
+ module procedure one1
+ end interface
+contains
+ subroutine one1()
+ call abort
+ end subroutine one1
+end module m1
+
+module m2
+use m1, only : one ! USE generic "one"
+contains
+ subroutine two()
+ call one() ! Call internal "one"
+ contains
+ subroutine one() ! Internal "one"
+ print *, "m2"
+ end subroutine one
+ end subroutine two
+end module m2
+
+ use m2
+ call two
+end
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90 b/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90
index fcbeba5aa51..0a0883c67c3 100644
--- a/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90
+++ b/gcc/testsuite/gfortran.dg/warnings_are_errors_1.f90
@@ -5,7 +5,7 @@
! free-form tests
! gfc_notify_std:
- function char_ (ch) ! { dg-warning "is obsolescent in fortran 95" }
+ function char_ (ch) ! { dg-warning "Obsolescent feature" }
character(*) :: char_, ch
char_ = ch
end function char_
diff --git a/gcc/testsuite/gfortran.dg/whole_file_10.f90 b/gcc/testsuite/gfortran.dg/whole_file_10.f90
new file mode 100644
index 00000000000..fb100bb0ed5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_10.f90
@@ -0,0 +1,32 @@
+! { dg-do compile }
+! { dg-options "-fwhole-file" }
+! Test the fix for the fifth problem in PR40011, where the
+! entries were not resolved, resulting in a segfault.
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+!
+recursive function fac(i) result (res)
+ integer :: i, j, k, res
+ k = 1
+ goto 100
+entry bifac(i,j) result (res)
+ k = j
+100 continue
+ if (i < k) then
+ res = 1
+ else
+ res = i * bifac(i-k,k)
+ end if
+end function
+
+program test
+ external fac
+ external bifac
+ integer :: fac, bifac
+ print *, fac(5)
+ print *, bifac(5,2)
+ print*, fac(6)
+ print *, bifac(6,2)
+ print*, fac(0)
+ print *, bifac(1,2)
+end program test
diff --git a/gcc/testsuite/gfortran.dg/whole_file_11.f90 b/gcc/testsuite/gfortran.dg/whole_file_11.f90
new file mode 100644
index 00000000000..d01b2100c4b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_11.f90
@@ -0,0 +1,37 @@
+! { dg-do compile }
+! { dg-options "-fwhole-file" }
+!
+! Tests the fix PR40011 comment 16 in which the derived type lists in
+! different program units were getting mixed up.
+!
+! Contributed by Daniel Franck <dfranke@gcc.gnu.org>
+!
+MODULE module_foo
+ TYPE :: foo_node
+ TYPE(foo_node_private), POINTER :: p
+ END TYPE
+
+ TYPE :: foo_node_private
+ TYPE(foo_node), DIMENSION(-1:1) :: link
+ END TYPE
+
+ TYPE :: foo
+ TYPE(foo_node) :: root
+ END TYPE
+END MODULE
+
+FUNCTION foo_insert()
+ USE module_foo, ONLY: foo, foo_node
+
+ INTEGER :: foo_insert
+ TYPE(foo_node) :: parent, current
+ INTEGER :: cmp
+
+ parent = current
+ current = current%p%link(cmp)
+END FUNCTION
+
+FUNCTION foo_count()
+ USE module_foo, ONLY: foo
+ INTEGER :: foo_count
+END FUNCTION
diff --git a/gcc/testsuite/gfortran.dg/whole_file_12.f90 b/gcc/testsuite/gfortran.dg/whole_file_12.f90
new file mode 100644
index 00000000000..150ac5f9d5d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_12.f90
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! { dg-options "-fwhole-file" }
+!
+! Tests the fix PR40011 comment 17 in which the explicit interface was
+! being ignored and the missing argument was not correctly handled, which
+! led to an ICE.
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr
+!
+ Implicit None
+ call sub(1,2)
+ call sub(1,2,3)
+
+ contains
+
+ subroutine sub(i,j,k)
+ Implicit None
+ Integer, Intent( In ) :: i
+ Integer, Intent( In ) :: j
+ Integer, Intent( In ), Optional :: k
+ intrinsic present
+ write(*,*)' 3 presence flag ',present(k)
+ write(*,*)' 1st arg ',i
+ write(*,*)' 2nd arg ',j
+ if (present(k)) then
+ write(*,*)' 3rd arg ',k
+ else
+ write(*,*)' 3rd arg is absent'
+ endif
+ return
+ end subroutine
+
+ end
diff --git a/gcc/testsuite/gfortran.dg/whole_file_13.f90 b/gcc/testsuite/gfortran.dg/whole_file_13.f90
new file mode 100644
index 00000000000..99e3ceecb7d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_13.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+! { dg-options "-fwhole-file -O3" }
+! Check that the TYPE_CANONICAL is being correctly set
+! for the derived types, when whole file compiling.
+! (based on import.f90)
+!
+subroutine test(x)
+ type myType3
+ sequence
+ integer :: i
+ end type myType3
+ type(myType3) :: x
+ if(x%i /= 7) call abort()
+ x%i = 1
+end subroutine test
+
+
+program foo
+ type myType3
+ sequence
+ integer :: i
+ end type myType3
+
+ type(myType3) :: z
+ z%i = 7
+ call test(z)
+ if(z%i /= 1) call abort
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/whole_file_14.f90 b/gcc/testsuite/gfortran.dg/whole_file_14.f90
new file mode 100644
index 00000000000..65058960b95
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_14.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+! { dg-options "-fwhole-file -O3" }
+! Check that the derived types are correctly substituted when
+! whole file compiling.
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr
+!
+module global
+ type :: mytype
+ type(mytype),pointer :: this
+ end type mytype
+ type(mytype),target :: base
+end module global
+
+program test_equi
+ use global
+ call check()
+ print *, "base%this%this=>base?" , associated(base%this%this,base)
+ print *, "base%this%this=>?" , associated(base%this%this)
+ print *, "base%this=>?" , associated(base%this)
+contains
+ subroutine check()
+ type(mytype),target :: j
+ base%this => j !have the variables point
+ j%this => base !to one another
+ end subroutine check !take j out of scope
+end program test_equi
+! { dg-final { cleanup-modules "global" } }
diff --git a/gcc/testsuite/gfortran.dg/whole_file_7.f90 b/gcc/testsuite/gfortran.dg/whole_file_7.f90
new file mode 100644
index 00000000000..53fed228ae2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_7.f90
@@ -0,0 +1,34 @@
+! { dg-do compile }
+! { dg-options "-fwhole-file" }
+! Test the fixes for the first two problems in PR40011
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+!
+! This function would not compile because -fwhole-file would
+! try repeatedly to resolve the function because of the self
+! reference.
+RECURSIVE FUNCTION eval_args(q) result (r)
+ INTEGER NNODE
+ PARAMETER (NNODE = 10)
+ TYPE NODE
+ SEQUENCE
+ INTEGER car
+ INTEGER cdr
+ END TYPE NODE
+ TYPE(NODE) heap(NNODE)
+ INTEGER r, q
+ r = eval_args(heap(q)%cdr)
+END FUNCTION eval_args
+
+function test(n)
+ real, dimension(2) :: test
+ integer :: n
+ test = n
+ return
+end function test
+
+program arr ! The error was not picked up causing an ICE
+ real, dimension(2) :: res
+ res = test(2) ! { dg-error "needs an explicit INTERFACE" }
+ print *, res
+end program
diff --git a/gcc/testsuite/gfortran.dg/whole_file_8.f90 b/gcc/testsuite/gfortran.dg/whole_file_8.f90
new file mode 100644
index 00000000000..6ea319a9d12
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_8.f90
@@ -0,0 +1,36 @@
+! { dg-do compile }
+! { dg-options "-fwhole-file" }
+! Test the fix for the third problem in PR40011, where false
+! type/rank mismatches were found in the main program calls.
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+!
+subroutine test_d(fn, val, res)
+ double precision fn
+ double precision val, res
+
+ print *, fn(val), res
+end subroutine
+
+subroutine test_c(fn, val, res)
+ complex fn
+ complex val, res
+
+ print *, fn(val), res
+end subroutine
+
+program specifics
+
+ intrinsic dcos
+ intrinsic dcosh
+ intrinsic dexp
+
+ intrinsic conjg
+
+ call test_d (dcos, 1d0, dcos(1d0))
+ call test_d (dcosh, 1d0, dcosh(1d0))
+ call test_d (dexp, 1d0, dexp(1d0))
+
+ call test_c (conjg, (1.0,1.0) , conjg((1.0,1.0)))
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/whole_file_9.f90 b/gcc/testsuite/gfortran.dg/whole_file_9.f90
new file mode 100644
index 00000000000..64dce42ee21
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/whole_file_9.f90
@@ -0,0 +1,46 @@
+! { dg-do compile }
+! { dg-options "-fwhole-file" }
+! Test the fix for the fourth problem in PR40011, where the
+! entries were not resolved, resulting in a segfault.
+!
+! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
+!
+program test
+interface
+ function bad_stuff(n)
+ integer :: bad_stuff (2)
+ integer :: n(2)
+ end function bad_stuff
+ recursive function rec_stuff(n) result (tmp)
+ integer :: n(2), tmp(2)
+ end function rec_stuff
+end interface
+ integer :: res(2)
+ res = bad_stuff((/-19,-30/))
+
+end program test
+
+ recursive function bad_stuff(n)
+ integer :: bad_stuff (2)
+ integer :: n(2), tmp(2), ent = 0, sent = 0
+ save ent, sent
+ ent = -1
+ entry rec_stuff(n) result (tmp)
+ if (ent == -1) then
+ sent = ent
+ ent = 0
+ end if
+ ent = ent + 1
+ tmp = 1
+ if(maxval (n) < 5) then
+ tmp = tmp + rec_stuff (n+1)
+ ent = ent - 1
+ endif
+ if (ent == 1) then
+ if (sent == -1) then
+ bad_stuff = tmp + bad_stuff (1)
+ end if
+ ent = 0
+ sent = 0
+ end if
+ end function bad_stuff
diff --git a/gcc/testsuite/gfortran.dg/winapi.f90 b/gcc/testsuite/gfortran.dg/winapi.f90
new file mode 100644
index 00000000000..0ee3920ff94
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/winapi.f90
@@ -0,0 +1,23 @@
+! { dg-do run { target *-*-cygwin* *-*-mingw* } }
+! { dg-options "-lkernel32" }
+! Test case provided by Dennis Wassel.
+
+PROGRAM winapi
+
+ USE, INTRINSIC :: iso_c_binding
+ IMPLICIT NONE
+
+ INTERFACE
+ ! Specifically select the lstrlenA version for ASCII.
+ FUNCTION lstrlen(string) BIND(C, name = "lstrlenA")
+ USE, INTRINSIC :: iso_c_binding
+ IMPLICIT NONE
+ !GCC$ ATTRIBUTES STDCALL :: lstrlen
+ INTEGER (C_INT) :: lstrlen
+ CHARACTER(KIND=C_CHAR), INTENT(in) :: string(*)
+ END FUNCTION lstrlen
+ END INTERFACE
+
+ IF (lstrlen(C_CHAR_"winapi"//C_NULL_CHAR) /= 6) CALL abort()
+
+END PROGRAM winapi
diff --git a/gcc/testsuite/gfortran.dg/x_slash_1.f b/gcc/testsuite/gfortran.dg/x_slash_1.f
index de576e2e401..435e4612227 100644
--- a/gcc/testsuite/gfortran.dg/x_slash_1.f
+++ b/gcc/testsuite/gfortran.dg/x_slash_1.f
@@ -1,4 +1,6 @@
c { dg-do run { target fd_truncate } }
+c { dg-options "-std=legacy" }
+c
c This program tests the fixes to PR22570.
c
c Provided by Paul Thomas - pault@gcc.gnu.org
diff --git a/gcc/testsuite/gnat.dg/itype.adb b/gcc/testsuite/gnat.dg/itype.adb
new file mode 100644
index 00000000000..848bda4b644
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/itype.adb
@@ -0,0 +1,8 @@
+package body itype is
+ function G return not null access constant T is
+ X : aliased T;
+
+ begin
+ return X'Unchecked_Access;
+ end G;
+end itype;
diff --git a/gcc/testsuite/gnat.dg/itype.ads b/gcc/testsuite/gnat.dg/itype.ads
new file mode 100644
index 00000000000..3ffb7c695dc
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/itype.ads
@@ -0,0 +1,5 @@
+package itype is
+ generic
+ type T is private;
+ function G return not null access constant T;
+end itype;
diff --git a/gcc/testsuite/lib/options.exp b/gcc/testsuite/lib/options.exp
index c63fd66cc02..18359023228 100644
--- a/gcc/testsuite/lib/options.exp
+++ b/gcc/testsuite/lib/options.exp
@@ -41,11 +41,11 @@ proc check_for_options {language gcc_options compiler_patterns compiler_non_patt
remote_file build delete $filename.c $filename.x $filename.gcno
foreach pattern [split $compiler_patterns "\n"] {
- if {$pattern ne ""} {
+ if {$pattern != ""} {
if {[regexp -- "$pattern" $gcc_output]} {
pass "$test $pattern"
} else {
- if {$expected_failure ne ""} {
+ if {$expected_failure != ""} {
xfail "$test $pattern"
} else {
fail "$test $pattern"
@@ -54,11 +54,11 @@ proc check_for_options {language gcc_options compiler_patterns compiler_non_patt
}
}
foreach pattern [split $compiler_non_patterns "\n"] {
- if {$pattern ne ""} {
+ if {$pattern != ""} {
if {![regexp -- "$pattern" $gcc_output]} {
pass "$test $pattern"
} else {
- if {$expected_failure ne ""} {
+ if {$expected_failure != ""} {
xfail "$test $pattern"
} else {
fail "$test $pattern"
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c847de090e7..f361acca8ca 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -902,6 +902,32 @@ proc check_sse2_hw_available { } {
}]
}
+# Return 1 if the target supports executing VSX instructions, 0
+# otherwise. Cache the result.
+
+proc check_vsx_hw_available { } {
+ return [check_cached_effective_target vsx_hw_available {
+ # Some simulators are known to not support VSX instructions.
+ # For now, disable on Darwin
+ if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
+ expr 0
+ } else {
+ set options "-mvsx"
+ check_runtime_nocache vsx_hw_available {
+ int main()
+ {
+ #ifdef __MACH__
+ asm volatile ("xxlor vs0,vs0,vs0");
+ #else
+ asm volatile ("xxlor 0,0,0");
+ #endif
+ return 0;
+ }
+ } $options
+ }
+ }]
+}
+
# Return 1 if the target supports executing AltiVec instructions, 0
# otherwise. Cache the result.
@@ -912,12 +938,13 @@ proc check_vmx_hw_available { } {
expr 0
} else {
# Most targets don't require special flags for this test case, but
- # Darwin does.
+ # Darwin does. Just to be sure, make sure VSX is not enabled for
+ # the altivec tests.
if { [istarget *-*-darwin*]
|| [istarget *-*-aix*] } {
- set options "-maltivec"
+ set options "-maltivec -mno-vsx"
} else {
- set options ""
+ set options "-mno-vsx"
}
check_runtime_nocache vmx_hw_available {
int main()
@@ -1329,7 +1356,8 @@ proc check_effective_target_vect_cmdline_needed { } {
verbose "check_effective_target_vect_cmdline_needed: using cached result" 2
} else {
set et_vect_cmdline_needed_saved 1
- if { [istarget ia64-*-*]
+ if { [istarget alpha*-*-*]
+ || [istarget ia64-*-*]
|| (([istarget x86_64-*-*] || [istarget i?86-*-*])
&& [check_effective_target_lp64])
|| ([istarget powerpc*-*-*]
@@ -1484,6 +1512,20 @@ proc check_effective_target_arm_vfp_ok { } {
}
}
+# Return 1 if this is an ARM target supporting -mfpu=vfp
+# -mfloat-abi=hard. Some multilibs may be incompatible with these
+# options.
+
+proc check_effective_target_arm_hard_vfp_ok { } {
+ if { [check_effective_target_arm32] } {
+ return [check_no_compiler_messages arm_hard_vfp_ok executable {
+ int main() { return 0;}
+ } "-mfpu=vfp -mfloat-abi=hard"]
+ } else {
+ return 0
+ }
+}
+
# Return 1 if this is an ARM target supporting -mfpu=neon
# -mfloat-abi=softfp. Some multilibs may be incompatible with these
# options.
@@ -1491,6 +1533,7 @@ proc check_effective_target_arm_vfp_ok { } {
proc check_effective_target_arm_neon_ok { } {
if { [check_effective_target_arm32] } {
return [check_no_compiler_messages arm_neon_ok object {
+ #include "arm_neon.h"
int dummy;
} "-mfpu=neon -mfloat-abi=softfp"]
} else {
@@ -1632,6 +1675,33 @@ proc check_effective_target_powerpc_altivec_ok { } {
}
}
+# Return 1 if this is a PowerPC target supporting -mvsx
+
+proc check_effective_target_powerpc_vsx_ok { } {
+ if { ([istarget powerpc*-*-*]
+ && ![istarget powerpc-*-linux*paired*])
+ || [istarget rs6000-*-*] } {
+ # AltiVec is not supported on AIX before 5.3.
+ if { [istarget powerpc*-*-aix4*]
+ || [istarget powerpc*-*-aix5.1*]
+ || [istarget powerpc*-*-aix5.2*] } {
+ return 0
+ }
+ return [check_no_compiler_messages powerpc_vsx_ok object {
+ int main (void) {
+#ifdef __MACH__
+ asm volatile ("xxlor vs0,vs0,vs0");
+#else
+ asm volatile ("xxlor 0,0,0");
+#endif
+ return 0;
+ }
+ } "-mvsx"]
+ } else {
+ return 0
+ }
+}
+
# Return 1 if this is a PowerPC target supporting -mcpu=cell.
proc check_effective_target_powerpc_ppu_ok { } {
@@ -3012,7 +3082,7 @@ proc check_effective_target_mpc { } {
# Return 1 if the MPC library with mpc_pow is integrated with GCC, 0 otherwise.
proc check_effective_target_mpc_pow { } {
- return [check_no_compiler_messages mpc executable {
+ return [check_no_compiler_messages mpc_pow executable {
extern void link_error(void);
int main ()
{
@@ -3021,3 +3091,23 @@ proc check_effective_target_mpc_pow { } {
}
}]
}
+
+# Return 1 if the language for the compiler under test is C.
+
+proc check_effective_target_c { } {
+ global tool
+ if [string match $tool "gcc"] {
+ return 1
+ }
+ return 0
+}
+
+# Return 1 if the language for the compiler under test is C++.
+
+proc check_effective_target_c++ { } {
+ global tool
+ if [string match $tool "g++"] {
+ return 1
+ }
+ return 0
+}
diff --git a/gcc/testsuite/lib/wrapper.exp b/gcc/testsuite/lib/wrapper.exp
index 4e5ae435a13..fba7324ece4 100644
--- a/gcc/testsuite/lib/wrapper.exp
+++ b/gcc/testsuite/lib/wrapper.exp
@@ -16,6 +16,8 @@
# This file contains GCC-specifics for status wrappers for test programs.
+load_lib target-libpath.exp
+
# ${tool}_maybe_build_wrapper -- Build wrapper object if the target
# needs it. FILENAME is the path to the wrapper file. If there are
# additional arguments, they are command-line options to provide to
@@ -27,6 +29,7 @@ proc ${tool}_maybe_build_wrapper { filename args } {
if { [target_info needs_status_wrapper] != "" \
&& [target_info needs_status_wrapper] != "0" \
&& ![info exists gluefile] } {
+ set_ld_library_path_env_vars
set saved_wrap_compile_flags [target_info wrap_compile_flags]
set flags [join $args " "]
# The wrapper code may contain code that gcc objects on. This
diff --git a/gcc/timevar.def b/gcc/timevar.def
index 938447f03b1..0e704cb27b8 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -122,7 +122,9 @@ DEFTIMEVAR (TV_COMPLETE_UNROLL , "complete unrolling")
DEFTIMEVAR (TV_TREE_PARALLELIZE_LOOPS, "tree parallelize loops")
DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree vectorization")
DEFTIMEVAR (TV_TREE_SLP_VECTORIZATION, "tree slp vectorization")
-DEFTIMEVAR (TV_GRAPHITE_TRANSFORMS , "GRAPHITE loop transforms")
+DEFTIMEVAR (TV_GRAPHITE_TRANSFORMS , "Graphite loop transforms")
+DEFTIMEVAR (TV_GRAPHITE_DATA_DEPS , "Graphite data dep analysis")
+DEFTIMEVAR (TV_GRAPHITE_CODE_GEN , "Graphite code generation")
DEFTIMEVAR (TV_TREE_LINEAR_TRANSFORM , "tree loop linear")
DEFTIMEVAR (TV_TREE_LOOP_DISTRIBUTION, "tree loop distribution")
DEFTIMEVAR (TV_CHECK_DATA_DEPS , "tree check data dependences")
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 518cce7009d..c708bcd93f5 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1046,8 +1046,7 @@ compile_file (void)
ggc_protect_identifiers = false;
- /* This must also call cgraph_finalize_compilation_unit and
- cgraph_optimize. */
+ /* This must also call cgraph_finalize_compilation_unit. */
lang_hooks.decls.final_write_globals ();
if (errorcount || sorrycount)
@@ -1813,7 +1812,8 @@ process_options (void)
|| flag_loop_block
|| flag_loop_interchange
|| flag_loop_strip_mine
- || flag_graphite_identity)
+ || flag_graphite_identity
+ || flag_loop_parallelize_all)
sorry ("Graphite loop optimizations cannot be used");
#endif
@@ -2067,7 +2067,7 @@ process_options (void)
if (flag_signaling_nans)
flag_trapping_math = 1;
- /* We cannot reassociate if we want traps or signed zeros.  */
+ /* We cannot reassociate if we want traps or signed zeros. */
if (flag_associative_math && (flag_trapping_math || flag_signed_zeros))
{
warning (0, "-fassociative-math disabled; other options take precedence");
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 588e33f6d07..81cbb905d71 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2908,7 +2908,7 @@ reinstall_phi_args (edge new_edge, edge old_edge)
gcc_assert (result == gimple_phi_result (phi));
- add_phi_arg (phi, arg, new_edge);
+ add_phi_arg (phi, arg, new_edge, redirect_edge_var_map_location (vm));
}
redirect_edge_var_map_clear (old_edge);
@@ -4879,7 +4879,8 @@ gimple_make_forwarder_block (edge fallthru)
new_phi = create_phi_node (var, bb);
SSA_NAME_DEF_STMT (var) = new_phi;
gimple_phi_set_result (phi, make_ssa_name (SSA_NAME_VAR (var), phi));
- add_phi_arg (new_phi, gimple_phi_result (phi), fallthru);
+ add_phi_arg (new_phi, gimple_phi_result (phi), fallthru,
+ UNKNOWN_LOCATION);
}
/* Add the arguments we have stored on edges. */
@@ -5278,7 +5279,8 @@ add_phi_args_after_copy_edge (edge e_copy)
phi = gsi_stmt (psi);
phi_copy = gsi_stmt (psi_copy);
def = PHI_ARG_DEF_FROM_EDGE (phi, e);
- add_phi_arg (phi_copy, def, e_copy);
+ add_phi_arg (phi_copy, def, e_copy,
+ gimple_phi_arg_location_from_edge (phi, e));
}
}
@@ -7101,7 +7103,7 @@ gimple_lv_adjust_loop_header_phi (basic_block first, basic_block second,
phi1 = gsi_stmt (psi1);
phi2 = gsi_stmt (psi2);
def = PHI_ARG_DEF (phi2, e2->dest_idx);
- add_phi_arg (phi1, def, e);
+ add_phi_arg (phi1, def, e, gimple_phi_arg_location_from_edge (phi2, e2));
}
}
@@ -7497,7 +7499,7 @@ struct gimple_opt_pass pass_warn_unused_result =
{
{
GIMPLE_PASS,
- "warn_unused_result", /* name */
+ "*warn_unused_result", /* name */
gate_warn_unused_result, /* gate */
run_warn_unused_result, /* execute */
NULL, /* sub */
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 25902d957cf..5cce1b6eec7 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -406,7 +406,8 @@ remove_forwarder_block (basic_block bb)
gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
- add_phi_arg (phi, gimple_phi_arg_def (phi, succ->dest_idx), s);
+ source_location l = gimple_phi_arg_location_from_edge (phi, succ);
+ add_phi_arg (phi, gimple_phi_arg_def (phi, succ->dest_idx), s, l);
}
}
}
@@ -750,6 +751,7 @@ remove_forwarder_block_with_phi (basic_block bb)
{
gimple phi = gsi_stmt (gsi);
tree def = gimple_phi_arg_def (phi, succ->dest_idx);
+ source_location locus = gimple_phi_arg_location_from_edge (phi, succ);
if (TREE_CODE (def) == SSA_NAME)
{
@@ -769,12 +771,13 @@ remove_forwarder_block_with_phi (basic_block bb)
if (def == old_arg)
{
def = new_arg;
+ locus = redirect_edge_var_map_location (vm);
break;
}
}
}
- add_phi_arg (phi, def, s);
+ add_phi_arg (phi, def, s, locus);
}
redirect_edge_var_map_clear (e);
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 74935043918..33d9f18c099 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -1411,7 +1411,7 @@ for_each_scev_op (tree *scev, bool (*cbck) (tree *, void *), void *data)
case 2:
for_each_scev_op (&TREE_OPERAND (*scev, 1), cbck, data);
-
+
case 1:
for_each_scev_op (&TREE_OPERAND (*scev, 0), cbck, data);
@@ -1438,6 +1438,7 @@ operator_is_linear (tree scev)
case NEGATE_EXPR:
case SSA_NAME:
case NON_LVALUE_EXPR:
+ case BIT_NOT_EXPR:
CASE_CONVERT:
return true;
@@ -1461,6 +1462,10 @@ scev_is_linear_expression (tree scev)
return !(tree_contains_chrecs (TREE_OPERAND (scev, 0), NULL)
&& tree_contains_chrecs (TREE_OPERAND (scev, 1), NULL));
+ if (TREE_CODE (scev) == POLYNOMIAL_CHREC
+ && !evolution_function_is_affine_multivariate_p (scev, CHREC_VARIABLE (scev)))
+ return false;
+
switch (TREE_CODE_LENGTH (TREE_CODE (scev)))
{
case 3:
@@ -1471,7 +1476,7 @@ scev_is_linear_expression (tree scev)
case 2:
return scev_is_linear_expression (TREE_OPERAND (scev, 0))
&& scev_is_linear_expression (TREE_OPERAND (scev, 1));
-
+
case 1:
return scev_is_linear_expression (TREE_OPERAND (scev, 0));
@@ -1482,3 +1487,33 @@ scev_is_linear_expression (tree scev)
return false;
}
}
+
+/* Determines whether the expression CHREC contains only interger consts
+ in the right parts. */
+
+bool
+evolution_function_right_is_integer_cst (const_tree chrec)
+{
+ if (chrec == NULL_TREE)
+ return false;
+
+ switch (TREE_CODE (chrec))
+ {
+ case INTEGER_CST:
+ return true;
+
+ case POLYNOMIAL_CHREC:
+ if (!evolution_function_right_is_integer_cst (CHREC_RIGHT (chrec)))
+ return false;
+
+ if (TREE_CODE (CHREC_LEFT (chrec)) == POLYNOMIAL_CHREC
+ && !evolution_function_right_is_integer_cst (CHREC_LEFT (chrec)))
+ return false;
+
+ return true;
+
+ default:
+ return false;
+ }
+}
+
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index db45eedc595..f21aa74d795 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -86,6 +86,7 @@ extern bool evolution_function_is_univariate_p (const_tree);
extern unsigned nb_vars_in_chrec (tree);
extern bool evolution_function_is_invariant_p (tree, int);
extern bool scev_is_linear_expression (tree);
+extern bool evolution_function_right_is_integer_cst (const_tree);
/* Determines whether CHREC is equal to zero. */
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 2181f469ca0..ae0a0681479 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -157,6 +157,14 @@ dump_data_references (FILE *file, VEC (data_reference_p, heap) *datarefs)
dump_data_reference (file, dr);
}
+/* Dump into STDERR all the data references from DATAREFS. */
+
+void
+debug_data_references (VEC (data_reference_p, heap) *datarefs)
+{
+ dump_data_references (stderr, datarefs);
+}
+
/* Dump to STDERR all the dependence relations from DDRS. */
void
@@ -178,6 +186,14 @@ dump_data_dependence_relations (FILE *file,
dump_data_dependence_relation (file, ddr);
}
+/* Print to STDERR the data_reference DR. */
+
+void
+debug_data_reference (struct data_reference *dr)
+{
+ dump_data_reference (stderr, dr);
+}
+
/* Dump function for a DATA_REFERENCE structure. */
void
@@ -3334,22 +3350,6 @@ access_functions_are_affine_or_constant_p (const struct data_reference *a,
return true;
}
-/* Return true if we can create an affine data-ref for OP in STMT. */
-
-bool
-stmt_simple_memref_p (struct loop *loop, gimple stmt, tree op)
-{
- data_reference_p dr;
- bool res = true;
-
- dr = create_data_ref (loop, op, stmt, true);
- if (!access_functions_are_affine_or_constant_p (dr, loop))
- res = false;
-
- free_data_ref (dr);
- return res;
-}
-
/* Initializes an equation for an OMEGA problem using the information
contained in the ACCESS_FUN. Returns true when the operation
succeeded.
@@ -4158,6 +4158,37 @@ find_data_references_in_stmt (struct loop *nest, gimple stmt,
return ret;
}
+/* Stores the data references in STMT to DATAREFS. If there is an unanalyzable
+ reference, returns false, otherwise returns true. NEST is the outermost
+ loop of the loop nest in which the references should be analyzed. */
+
+bool
+graphite_find_data_references_in_stmt (struct loop *nest, gimple stmt,
+ VEC (data_reference_p, heap) **datarefs)
+{
+ unsigned i;
+ VEC (data_ref_loc, heap) *references;
+ data_ref_loc *ref;
+ bool ret = true;
+ data_reference_p dr;
+
+ if (get_references_in_stmt (stmt, &references))
+ {
+ VEC_free (data_ref_loc, heap, references);
+ return false;
+ }
+
+ for (i = 0; VEC_iterate (data_ref_loc, references, i, ref); i++)
+ {
+ dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
+ gcc_assert (dr != NULL);
+ VEC_safe_push (data_reference_p, heap, *datarefs, dr);
+ }
+
+ VEC_free (data_ref_loc, heap, references);
+ return ret;
+}
+
/* Search the data references in LOOP, and record the information into
DATAREFS. Returns chrec_dont_know when failing to analyze a
difficult case, returns NULL_TREE otherwise. */
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index dfce23309f5..fe79faea40f 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -96,8 +96,6 @@ struct dr_alias
bitmap vops;
};
-typedef struct scop *scop_p;
-
/* Each vector of the access matrix represents a linear access
function for a subscript. First elements correspond to the
leftmost indices, ie. for a[i][j] the first vector corresponds to
@@ -184,14 +182,10 @@ struct data_reference
/* Alias information for the data reference. */
struct dr_alias alias;
- /* The SCoP in which the data reference was analyzed. */
- scop_p scop;
-
/* Matrix representation for the data access functions. */
struct access_matrix *access_matrix;
};
-#define DR_SCOP(DR) (DR)->scop
#define DR_STMT(DR) (DR)->stmt
#define DR_REF(DR) (DR)->ref
#define DR_BASE_OBJECT(DR) (DR)->indices.base_object
@@ -395,7 +389,9 @@ extern void dump_subscript (FILE *, struct subscript *);
extern void dump_ddrs (FILE *, VEC (ddr_p, heap) *);
extern void dump_dist_dir_vectors (FILE *, VEC (ddr_p, heap) *);
extern void dump_data_reference (FILE *, struct data_reference *);
+extern void debug_data_reference (struct data_reference *);
extern void dump_data_references (FILE *, VEC (data_reference_p, heap) *);
+extern void debug_data_references (VEC (data_reference_p, heap) *);
extern void debug_data_dependence_relation (struct data_dependence_relation *);
extern void dump_data_dependence_relation (FILE *,
struct data_dependence_relation *);
@@ -409,6 +405,8 @@ extern void free_data_ref (data_reference_p);
extern void free_data_refs (VEC (data_reference_p, heap) *);
extern bool find_data_references_in_stmt (struct loop *, gimple,
VEC (data_reference_p, heap) **);
+extern bool graphite_find_data_references_in_stmt (struct loop *, gimple,
+ VEC (data_reference_p, heap) **);
struct data_reference *create_data_ref (struct loop *, tree, gimple, bool);
extern bool find_loop_nest (struct loop *, VEC (loop_p, heap) **);
extern void compute_all_dependences (VEC (data_reference_p, heap) *,
@@ -418,7 +416,6 @@ extern void compute_all_dependences (VEC (data_reference_p, heap) *,
extern void create_rdg_vertices (struct graph *, VEC (gimple, heap) *);
extern bool dr_may_alias_p (const struct data_reference *,
const struct data_reference *);
-extern bool stmt_simple_memref_p (struct loop *, gimple, tree);
/* Return true when the DDR contains two data references that have the
same access functions. */
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index f37402025e1..b6eff5ea8f1 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -162,6 +162,32 @@ renumber_gimple_stmt_uids (void)
}
}
+/* Like renumber_gimple_stmt_uids, but only do work on the basic blocks
+ in BLOCKS, of which there are N_BLOCKS. Also renumbers PHIs. */
+
+void
+renumber_gimple_stmt_uids_in_blocks (basic_block *blocks, int n_blocks)
+{
+ int i;
+
+ set_gimple_stmt_max_uid (cfun, 0);
+ for (i = 0; i < n_blocks; i++)
+ {
+ basic_block bb = blocks[i];
+ gimple_stmt_iterator bsi;
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
+ }
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ gimple stmt = gsi_stmt (bsi);
+ gimple_set_uid (stmt, inc_gimple_stmt_max_uid (cfun));
+ }
+ }
+}
+
/* Create a new annotation for a tree T. */
tree_ann_common_t
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index f95052bf12e..191fcf559d5 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -517,6 +517,39 @@ gimple_phi_arg_edge (gimple gs, size_t i)
return EDGE_PRED (gimple_bb (gs), i);
}
+/* Return the source location of gimple argument I of phi node GS. */
+
+static inline source_location
+gimple_phi_arg_location (gimple gs, size_t i)
+{
+ return gimple_phi_arg (gs, i)->locus;
+}
+
+/* Return the source location of the argument on edge E of phi node GS. */
+
+static inline source_location
+gimple_phi_arg_location_from_edge (gimple gs, edge e)
+{
+ return gimple_phi_arg (gs, e->dest_idx)->locus;
+}
+
+/* Set the source location of gimple argument I of phi node GS to LOC. */
+
+static inline void
+gimple_phi_arg_set_location (gimple gs, size_t i, source_location loc)
+{
+ gimple_phi_arg (gs, i)->locus = loc;
+}
+
+/* Return TRUE if argument I of phi node GS has a location record. */
+
+static inline bool
+gimple_phi_arg_has_location (gimple gs, size_t i)
+{
+ return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
+}
+
+
/* Return the PHI nodes for basic block BB, or NULL if there are no
PHI nodes. */
static inline gimple_seq
@@ -1258,6 +1291,14 @@ redirect_edge_var_map_result (edge_var_map *v)
return v->result;
}
+/* Given an edge_var_map V, return the PHI arg location. */
+
+static inline source_location
+redirect_edge_var_map_location (edge_var_map *v)
+{
+ return v->locus;
+}
+
/* Return an SSA_NAME node for variable VAR defined in statement STMT
in function cfun. */
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 0730a090f6f..b9e5bead609 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -554,6 +554,7 @@ extern const char *op_symbol_code (enum tree_code);
/* In tree-dfa.c */
extern var_ann_t create_var_ann (tree);
extern void renumber_gimple_stmt_uids (void);
+extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
extern tree_ann_common_t create_tree_common_ann (tree);
extern void dump_dfa_stats (FILE *);
extern void debug_dfa_stats (void);
@@ -579,7 +580,7 @@ extern void reserve_phi_args_for_new_edge (basic_block);
extern void add_phi_node_to_bb (gimple phi, basic_block bb);
extern gimple make_phi_node (tree var, int len);
extern gimple create_phi_node (tree, basic_block);
-extern void add_phi_arg (gimple, tree, edge);
+extern void add_phi_arg (gimple, tree, edge, source_location);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
@@ -596,6 +597,7 @@ extern void record_vars (tree);
extern bool block_may_fallthru (const_tree);
extern bool gimple_seq_may_fallthru (gimple_seq);
extern bool gimple_stmt_may_fallthru (gimple);
+extern bool gimple_check_call_args (gimple);
/* In tree-ssa.c */
@@ -604,6 +606,7 @@ extern bool gimple_stmt_may_fallthru (gimple);
struct GTY(()) _edge_var_map {
tree result; /* PHI result. */
tree def; /* PHI arg definition. */
+ source_location locus; /* PHI arg location. */
};
typedef struct _edge_var_map edge_var_map;
@@ -614,7 +617,7 @@ DEF_VEC_ALLOC_O(edge_var_map, heap);
typedef VEC(edge_var_map, heap) *edge_var_map_vector;
extern void init_tree_ssa (struct function *);
-extern void redirect_edge_var_map_add (edge, tree, tree);
+extern void redirect_edge_var_map_add (edge, tree, tree, source_location);
extern void redirect_edge_var_map_clear (edge);
extern void redirect_edge_var_map_dup (edge, edge);
extern edge_var_map_vector redirect_edge_var_map_vector (edge);
@@ -750,7 +753,7 @@ unsigned int tree_unroll_loops_completely (bool, bool);
unsigned int tree_ssa_prefetch_arrays (void);
void tree_ssa_iv_optimize (void);
unsigned tree_predictive_commoning (void);
-tree canonicalize_loop_ivs (struct loop *, htab_t, tree *);
+tree canonicalize_loop_ivs (struct loop *, tree *);
bool parallelize_loops (void);
bool loop_only_exit_p (const struct loop *, const_edge);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0c29251b8f3..7055c3a290f 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -636,6 +636,7 @@ copy_statement_list (tree *tp)
new_tree = alloc_stmt_list ();
ni = tsi_start (new_tree);
oi = tsi_start (*tp);
+ TREE_TYPE (new_tree) = TREE_TYPE (*tp);
*tp = new_tree;
for (; !tsi_end_p (oi); tsi_next (&oi))
@@ -1881,7 +1882,8 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
new_arg = force_gimple_operand (new_arg, &stmts, true, NULL);
gsi_insert_seq_on_edge_immediate (new_edge, stmts);
}
- add_phi_arg (new_phi, new_arg, new_edge);
+ add_phi_arg (new_phi, new_arg, new_edge,
+ gimple_phi_arg_location_from_edge (phi, old_edge));
}
}
}
@@ -4962,9 +4964,10 @@ build_duplicate_type (tree type)
}
/* Return whether it is safe to inline a function because it used different
- target specific options or different optimization options. */
+ target specific options or call site actual types mismatch parameter types.
+ E is the call edge to be checked. */
bool
-tree_can_inline_p (tree caller, tree callee)
+tree_can_inline_p (struct cgraph_edge *e)
{
#if 0
/* This causes a regression in SPEC in that it prevents a cold function from
@@ -4993,7 +4996,25 @@ tree_can_inline_p (tree caller, tree callee)
return false;
}
#endif
+ tree caller, callee;
+
+ caller = e->caller->decl;
+ callee = e->callee->decl;
/* Allow the backend to decide if inlining is ok. */
- return targetm.target_option.can_inline_p (caller, callee);
+ if (!targetm.target_option.can_inline_p (caller, callee))
+ {
+ e->inline_failed = CIF_TARGET_OPTION_MISMATCH;
+ gimple_call_set_cannot_inline (e->call_stmt, true);
+ return false;
+ }
+
+ if (!gimple_check_call_args (e->call_stmt))
+ {
+ e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
+ gimple_call_set_cannot_inline (e->call_stmt, true);
+ return false;
+ }
+
+ return true;
}
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 4da90258d3b..d42b7fe8ec5 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -25,6 +25,8 @@ along with GCC; see the file COPYING3. If not see
#include "varray.h"
#include "pointer-set.h"
+struct cgraph_edge;
+
/* Indicate the desired behavior wrt call graph edges. We can either
duplicate the edge (inlining, cloning), move the edge (versioning,
parallelization), or move the edges of the clones (saving). */
@@ -179,7 +181,7 @@ int estimate_num_insns (gimple, eni_weights *);
int estimate_num_insns_fn (tree, eni_weights *);
int count_insns_seq (gimple_seq, eni_weights *);
bool tree_versionable_function_p (tree);
-bool tree_can_inline_p (tree, tree);
+bool tree_can_inline_p (struct cgraph_edge *e);
extern gimple_seq remap_gimple_seq (gimple_seq, copy_body_data *);
extern tree remap_decl (tree decl, copy_body_data *id);
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 57de827e418..9f06e8c5d04 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -1116,7 +1116,7 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
renamer will use the symbol on the LHS to get its
reaching definition. */
FOR_EACH_EDGE (e, ei, bb->preds)
- add_phi_arg (phi, var, e);
+ add_phi_arg (phi, var, e, UNKNOWN_LOCATION);
}
else
{
@@ -1341,9 +1341,12 @@ rewrite_add_phi_arguments (basic_block bb)
gsi_next (&gsi))
{
tree currdef;
+ gimple stmt;
+
phi = gsi_stmt (gsi);
currdef = get_reaching_def (SSA_NAME_VAR (gimple_phi_result (phi)));
- add_phi_arg (phi, currdef, e);
+ stmt = SSA_NAME_DEF_STMT (currdef);
+ add_phi_arg (phi, currdef, e, gimple_location (stmt));
}
}
}
@@ -1944,7 +1947,7 @@ rewrite_update_phi_arguments (basic_block bb)
phis = VEC_index (gimple_vec, phis_to_rewrite, e->dest->index);
for (i = 0; VEC_iterate (gimple, phis, i, phi); i++)
{
- tree arg, lhs_sym;
+ tree arg, lhs_sym, reaching_def = NULL;
use_operand_p arg_p;
gcc_assert (rewrite_uses_p (phi));
@@ -1962,18 +1965,41 @@ rewrite_update_phi_arguments (basic_block bb)
/* When updating a PHI node for a recently introduced
symbol we may find NULL arguments. That's why we
take the symbol from the LHS of the PHI node. */
- SET_USE (arg_p, get_reaching_def (lhs_sym));
+ reaching_def = get_reaching_def (lhs_sym);
+
}
else
{
tree sym = DECL_P (arg) ? arg : SSA_NAME_VAR (arg);
if (symbol_marked_for_renaming (sym))
- SET_USE (arg_p, get_reaching_def (sym));
+ reaching_def = get_reaching_def (sym);
else if (is_old_name (arg))
- SET_USE (arg_p, get_reaching_def (arg));
+ reaching_def = get_reaching_def (arg);
+ }
+
+ /* Update the argument if there is a reaching def. */
+ if (reaching_def)
+ {
+ gimple stmt;
+ source_location locus;
+ int arg_i = PHI_ARG_INDEX_FROM_USE (arg_p);
+
+ SET_USE (arg_p, reaching_def);
+ stmt = SSA_NAME_DEF_STMT (reaching_def);
+
+ /* Single element PHI nodes behave like copies, so get the
+ location from the phi argument. */
+ if (gimple_code (stmt) == GIMPLE_PHI &&
+ gimple_phi_num_args (stmt) == 1)
+ locus = gimple_phi_arg_location (stmt, 0);
+ else
+ locus = gimple_location (stmt);
+
+ gimple_phi_arg_set_location (phi, arg_i, locus);
}
+
if (e->flags & EDGE_ABNORMAL)
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (USE_FROM_PTR (arg_p)) = 1;
}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 575025473cb..b9b6ea3cd43 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -97,17 +97,20 @@ update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
gsi_next (&si_new), gsi_next (&si_orig))
{
tree def;
+ source_location locus;
gimple phi_new = gsi_stmt (si_new);
gimple phi_orig = gsi_stmt (si_orig);
/* Add the first phi argument for the phi in NEW_LOOP (the one
associated with the entry of NEW_LOOP) */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_entry_e);
- add_phi_arg (phi_new, def, new_loop_entry_e);
+ locus = gimple_phi_arg_location_from_edge (phi_orig, orig_entry_e);
+ add_phi_arg (phi_new, def, new_loop_entry_e, locus);
/* Add the second phi argument for the phi in NEW_LOOP (the one
associated with the latch of NEW_LOOP) */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_loop_latch);
+ locus = gimple_phi_arg_location_from_edge (phi_orig, orig_loop_latch);
if (TREE_CODE (def) == SSA_NAME)
{
@@ -122,7 +125,7 @@ update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
/* Could be an integer. */
new_ssa_name = def;
- add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop));
+ add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus);
}
}
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 9291f0826d8..d3901c34f0e 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -37,6 +37,9 @@ along with GCC; see the file COPYING3. If not see
#include "ssaexpand.h"
+DEF_VEC_I(source_location);
+DEF_VEC_ALLOC_I(source_location,heap);
+
/* Used to hold all the components required to do SSA PHI elimination.
The node and pred/succ list is a simple linear list of nodes and
edges represented as pairs of nodes.
@@ -68,6 +71,9 @@ typedef struct _elim_graph {
/* The predecessor and successor edge list. */
VEC(int,heap) *edge_list;
+ /* Source locus on each edge */
+ VEC(source_location,heap) *edge_locus;
+
/* Visited vector. */
sbitmap visited;
@@ -83,6 +89,9 @@ typedef struct _elim_graph {
/* List of constant copies to emit. These are pushed on in pairs. */
VEC(int,heap) *const_dests;
VEC(tree,heap) *const_copies;
+
+ /* Source locations for any constant copies. */
+ VEC(source_location,heap) *copy_locus;
} *elim_graph;
@@ -153,7 +162,7 @@ emit_partition_copy (rtx dest, rtx src, int unsignedsrcp)
/* Insert a copy instruction from partition SRC to DEST onto edge E. */
static void
-insert_partition_copy_on_edge (edge e, int dest, int src)
+insert_partition_copy_on_edge (edge e, int dest, int src, source_location locus)
{
rtx seq;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -170,6 +179,9 @@ insert_partition_copy_on_edge (edge e, int dest, int src)
gcc_assert (SA.partition_to_pseudo[src]);
set_location_for_edge (e);
+ /* If a locus is provided, override the default. */
+ if (locus)
+ set_curr_insn_source_location (locus);
seq = emit_partition_copy (SA.partition_to_pseudo[dest],
SA.partition_to_pseudo[src],
@@ -183,10 +195,13 @@ insert_partition_copy_on_edge (edge e, int dest, int src)
onto edge E. */
static void
-insert_value_copy_on_edge (edge e, int dest, tree src)
+insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
{
rtx seq, x;
- enum machine_mode mode;
+ enum machine_mode dest_mode, src_mode;
+ int unsignedp;
+ tree var;
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file,
@@ -200,16 +215,27 @@ insert_value_copy_on_edge (edge e, int dest, tree src)
gcc_assert (SA.partition_to_pseudo[dest]);
set_location_for_edge (e);
+ /* If a locus is provided, override the default. */
+ if (locus)
+ set_curr_insn_source_location (locus);
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) != 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)));
+
+ var = SSA_NAME_VAR (partition_to_var (SA.map, dest));
+ src_mode = TYPE_MODE (TREE_TYPE (src));
+ dest_mode = promote_decl_mode (var, &unsignedp);
+ gcc_assert (src_mode == TYPE_MODE (TREE_TYPE (var)));
+ gcc_assert (dest_mode == GET_MODE (SA.partition_to_pseudo[dest]));
+
+ if (src_mode != dest_mode)
+ {
+ x = expand_expr (src, NULL, src_mode, EXPAND_NORMAL);
+ x = convert_modes (dest_mode, src_mode, x, unsignedp);
+ }
+ else
+ x = expand_expr (src, SA.partition_to_pseudo[dest],
+ dest_mode, EXPAND_NORMAL);
+
if (x != SA.partition_to_pseudo[dest])
emit_move_insn (SA.partition_to_pseudo[dest], x);
seq = get_insns ();
@@ -222,7 +248,8 @@ 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, int unsignedsrcp)
+insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp,
+ source_location locus)
{
rtx seq;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -236,7 +263,11 @@ insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp)
}
gcc_assert (SA.partition_to_pseudo[dest]);
+
set_location_for_edge (e);
+ /* If a locus is provided, override the default. */
+ if (locus)
+ set_curr_insn_source_location (locus);
seq = emit_partition_copy (SA.partition_to_pseudo[dest],
src,
@@ -249,7 +280,7 @@ insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp)
onto edge E. */
static void
-insert_part_to_rtx_on_edge (edge e, rtx dest, int src)
+insert_part_to_rtx_on_edge (edge e, rtx dest, int src, source_location locus)
{
rtx seq;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -263,7 +294,11 @@ insert_part_to_rtx_on_edge (edge e, rtx dest, int src)
}
gcc_assert (SA.partition_to_pseudo[src]);
+
set_location_for_edge (e);
+ /* If a locus is provided, override the default. */
+ if (locus)
+ set_curr_insn_source_location (locus);
seq = emit_partition_copy (dest,
SA.partition_to_pseudo[src],
@@ -285,7 +320,9 @@ new_elim_graph (int size)
g->nodes = VEC_alloc (int, heap, 30);
g->const_dests = VEC_alloc (int, heap, 20);
g->const_copies = VEC_alloc (tree, heap, 20);
+ g->copy_locus = VEC_alloc (source_location, heap, 10);
g->edge_list = VEC_alloc (int, heap, 20);
+ g->edge_locus = VEC_alloc (source_location, heap, 10);
g->stack = VEC_alloc (int, heap, 30);
g->visited = sbitmap_alloc (size);
@@ -301,6 +338,7 @@ clear_elim_graph (elim_graph g)
{
VEC_truncate (int, g->nodes, 0);
VEC_truncate (int, g->edge_list, 0);
+ VEC_truncate (source_location, g->edge_locus, 0);
}
@@ -315,6 +353,9 @@ delete_elim_graph (elim_graph g)
VEC_free (tree, heap, g->const_copies);
VEC_free (int, heap, g->const_dests);
VEC_free (int, heap, g->nodes);
+ VEC_free (source_location, heap, g->copy_locus);
+ VEC_free (source_location, heap, g->edge_locus);
+
free (g);
}
@@ -346,10 +387,11 @@ elim_graph_add_node (elim_graph g, int node)
/* Add the edge PRED->SUCC to graph G. */
static inline void
-elim_graph_add_edge (elim_graph g, int pred, int succ)
+elim_graph_add_edge (elim_graph g, int pred, int succ, source_location locus)
{
VEC_safe_push (int, heap, g->edge_list, pred);
VEC_safe_push (int, heap, g->edge_list, succ);
+ VEC_safe_push (source_location, heap, g->edge_locus, locus);
}
@@ -357,7 +399,7 @@ elim_graph_add_edge (elim_graph g, int pred, int succ)
return the successor node. -1 is returned if there is no such edge. */
static inline int
-elim_graph_remove_succ_edge (elim_graph g, int node)
+elim_graph_remove_succ_edge (elim_graph g, int node, source_location *locus)
{
int y;
unsigned x;
@@ -367,8 +409,11 @@ elim_graph_remove_succ_edge (elim_graph g, int node)
VEC_replace (int, g->edge_list, x, -1);
y = VEC_index (int, g->edge_list, x + 1);
VEC_replace (int, g->edge_list, x + 1, -1);
+ *locus = VEC_index (source_location, g->edge_locus, x / 2);
+ VEC_replace (source_location, g->edge_locus, x / 2, UNKNOWN_LOCATION);
return y;
}
+ *locus = UNKNOWN_LOCATION;
return -1;
}
@@ -377,7 +422,7 @@ elim_graph_remove_succ_edge (elim_graph g, int node)
edge list. VAR will hold the partition number found. CODE is the
code fragment executed for every node found. */
-#define FOR_EACH_ELIM_GRAPH_SUCC(GRAPH, NODE, VAR, CODE) \
+#define FOR_EACH_ELIM_GRAPH_SUCC(GRAPH, NODE, VAR, LOCUS, CODE) \
do { \
unsigned x_; \
int y_; \
@@ -387,6 +432,7 @@ do { \
if (y_ != (NODE)) \
continue; \
(VAR) = VEC_index (int, (GRAPH)->edge_list, x_ + 1); \
+ (LOCUS) = VEC_index (source_location, (GRAPH)->edge_locus, x_ / 2); \
CODE; \
} \
} while (0)
@@ -396,7 +442,7 @@ do { \
GRAPH. VAR will hold the partition number found. CODE is the
code fragment executed for every node found. */
-#define FOR_EACH_ELIM_GRAPH_PRED(GRAPH, NODE, VAR, CODE) \
+#define FOR_EACH_ELIM_GRAPH_PRED(GRAPH, NODE, VAR, LOCUS, CODE) \
do { \
unsigned x_; \
int y_; \
@@ -406,6 +452,7 @@ do { \
if (y_ != (NODE)) \
continue; \
(VAR) = VEC_index (int, (GRAPH)->edge_list, x_); \
+ (LOCUS) = VEC_index (source_location, (GRAPH)->edge_locus, x_ / 2); \
CODE; \
} \
} while (0)
@@ -435,6 +482,7 @@ eliminate_build (elim_graph g)
for (gsi = gsi_start_phis (g->e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
+ source_location locus;
p0 = var_to_partition (g->map, gimple_phi_result (phi));
/* Ignore results which are not in partitions. */
@@ -442,6 +490,7 @@ eliminate_build (elim_graph g)
continue;
Ti = PHI_ARG_DEF (phi, g->e->dest_idx);
+ locus = gimple_phi_arg_location_from_edge (phi, g->e);
/* If this argument is a constant, or a SSA_NAME which is being
left in SSA form, just queue a copy to be emitted on this
@@ -454,6 +503,7 @@ eliminate_build (elim_graph g)
on this edge. */
VEC_safe_push (int, heap, g->const_dests, p0);
VEC_safe_push (tree, heap, g->const_copies, Ti);
+ VEC_safe_push (source_location, heap, g->copy_locus, locus);
}
else
{
@@ -462,7 +512,7 @@ eliminate_build (elim_graph g)
{
eliminate_name (g, p0);
eliminate_name (g, pi);
- elim_graph_add_edge (g, p0, pi);
+ elim_graph_add_edge (g, p0, pi, locus);
}
}
}
@@ -475,8 +525,10 @@ static void
elim_forward (elim_graph g, int T)
{
int S;
+ source_location locus;
+
SET_BIT (g->visited, T);
- FOR_EACH_ELIM_GRAPH_SUCC (g, T, S,
+ FOR_EACH_ELIM_GRAPH_SUCC (g, T, S, locus,
{
if (!TEST_BIT (g->visited, S))
elim_forward (g, S);
@@ -491,7 +543,9 @@ static int
elim_unvisited_predecessor (elim_graph g, int T)
{
int P;
- FOR_EACH_ELIM_GRAPH_PRED (g, T, P,
+ source_location locus;
+
+ FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
{
if (!TEST_BIT (g->visited, P))
return 1;
@@ -505,13 +559,15 @@ static void
elim_backward (elim_graph g, int T)
{
int P;
+ source_location locus;
+
SET_BIT (g->visited, T);
- FOR_EACH_ELIM_GRAPH_PRED (g, T, P,
+ FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
{
if (!TEST_BIT (g->visited, P))
{
elim_backward (g, P);
- insert_partition_copy_on_edge (g->e, P, T);
+ insert_partition_copy_on_edge (g->e, P, T, locus);
}
});
}
@@ -524,9 +580,8 @@ get_temp_reg (tree name)
{
tree var = TREE_CODE (name) == SSA_NAME ? SSA_NAME_VAR (name) : name;
tree type = TREE_TYPE (var);
- int unsignedp = TYPE_UNSIGNED (type);
- enum machine_mode reg_mode
- = promote_mode (type, DECL_MODE (var), &unsignedp, 0);
+ int unsignedp;
+ enum machine_mode reg_mode = promote_decl_mode (var, &unsignedp);
rtx x = gen_reg_rtx (reg_mode);
if (POINTER_TYPE_P (type))
mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (TREE_TYPE (var))));
@@ -540,6 +595,7 @@ static void
elim_create (elim_graph g, int T)
{
int P, S;
+ source_location locus;
if (elim_unvisited_predecessor (g, T))
{
@@ -547,23 +603,23 @@ elim_create (elim_graph g, int 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,
+ insert_part_to_rtx_on_edge (g->e, U, T, UNKNOWN_LOCATION);
+ FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
{
if (!TEST_BIT (g->visited, P))
{
elim_backward (g, P);
- insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp);
+ insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp, locus);
}
});
}
else
{
- S = elim_graph_remove_succ_edge (g, T);
+ S = elim_graph_remove_succ_edge (g, T, &locus);
if (S != -1)
{
SET_BIT (g->visited, T);
- insert_partition_copy_on_edge (g->e, T, S);
+ insert_partition_copy_on_edge (g->e, T, S, locus);
}
}
}
@@ -577,6 +633,7 @@ eliminate_phi (edge e, elim_graph g)
int x;
gcc_assert (VEC_length (tree, g->const_copies) == 0);
+ gcc_assert (VEC_length (source_location, g->copy_locus) == 0);
/* Abnormal edges already have everything coalesced. */
if (e->flags & EDGE_ABNORMAL)
@@ -613,9 +670,12 @@ eliminate_phi (edge e, elim_graph g)
{
int dest;
tree src;
+ source_location locus;
+
src = VEC_pop (tree, g->const_copies);
dest = VEC_pop (int, g->const_dests);
- insert_value_copy_on_edge (e, dest, src);
+ locus = VEC_pop (source_location, g->copy_locus);
+ insert_value_copy_on_edge (e, dest, src, locus);
}
}
@@ -994,6 +1054,11 @@ insert_backedge_copies (void)
name = make_ssa_name (result_var, stmt);
gimple_assign_set_lhs (stmt, name);
+ /* copy location if present. */
+ if (gimple_phi_arg_has_location (phi, i))
+ gimple_set_location (stmt,
+ gimple_phi_arg_location (phi, i));
+
/* Insert the new statement into the block and update
the PHI node. */
if (last && stmt_ends_bb_p (last))
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 454c4548e4f..a6d8f215914 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -241,175 +241,22 @@ name_to_copy_elt_hash (const void *aa)
return (hashval_t) a->version;
}
-/* Returns true if the iterations of LOOP are independent on each other (that
- is, if we can execute them in parallel), and if LOOP satisfies other
- conditions that we need to be able to parallelize it. Description of number
- of iterations is stored to NITER. Reduction analysis is done, if
- reductions are found, they are inserted to the REDUCTION_LIST. */
+
+/* Data dependency analysis. Returns true if the iterations of LOOP
+ are independent on each other (that is, if we can execute them
+ in parallel). */
static bool
-loop_parallel_p (struct loop *loop, htab_t reduction_list,
- struct tree_niter_desc *niter)
+loop_parallel_p (struct loop *loop)
{
- edge exit = single_dom_exit (loop);
VEC (ddr_p, heap) * dependence_relations;
VEC (data_reference_p, heap) *datarefs;
lambda_trans_matrix trans;
bool ret = false;
- gimple_stmt_iterator gsi;
- loop_vec_info simple_loop_info;
-
- /* Only consider innermost loops with just one exit. The innermost-loop
- restriction is not necessary, but it makes things simpler. */
- if (loop->inner || !exit)
- return false;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\nConsidering loop %d\n", loop->num);
- /* We need to know # of iterations, and there should be no uses of values
- defined inside loop outside of it, unless the values are invariants of
- the loop. */
- if (!number_of_iterations_exit (loop, exit, niter, false))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " FAILED: number of iterations not known\n");
- return false;
- }
-
- vect_dump = NULL;
- simple_loop_info = vect_analyze_loop_form (loop);
-
- for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple phi = gsi_stmt (gsi);
- gimple reduc_stmt = NULL;
- bool dummy;
-
- /* ??? TODO: Change this into a generic function that
- recognizes reductions. */
- if (!is_gimple_reg (PHI_RESULT (phi)))
- continue;
- if (simple_loop_info)
- reduc_stmt = vect_is_simple_reduction (simple_loop_info, phi, true,
- &dummy);
-
- /* Create a reduction_info struct, initialize it and insert it to
- the reduction list. */
-
- if (reduc_stmt)
- {
- PTR *slot;
- struct reduction_info *new_reduction;
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file,
- "Detected reduction. reduction stmt is: \n");
- print_gimple_stmt (dump_file, reduc_stmt, 0, 0);
- fprintf (dump_file, "\n");
- }
-
- new_reduction = XCNEW (struct reduction_info);
-
- new_reduction->reduc_stmt = reduc_stmt;
- new_reduction->reduc_phi = phi;
- new_reduction->reduction_code = gimple_assign_rhs_code (reduc_stmt);
- slot = htab_find_slot (reduction_list, new_reduction, INSERT);
- *slot = new_reduction;
- }
- }
-
- /* Get rid of the information created by the vectorizer functions. */
- destroy_loop_vec_info (simple_loop_info, true);
-
- for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple phi = gsi_stmt (gsi);
- struct reduction_info *red;
- imm_use_iterator imm_iter;
- use_operand_p use_p;
- gimple reduc_phi;
- tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit);
-
- if (is_gimple_reg (val))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "phi is ");
- print_gimple_stmt (dump_file, phi, 0, 0);
- fprintf (dump_file, "arg of phi to exit: value ");
- print_generic_expr (dump_file, val, 0);
- fprintf (dump_file, " used outside loop\n");
- fprintf (dump_file,
- " checking if it a part of reduction pattern: \n");
- }
- if (htab_elements (reduction_list) == 0)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- " FAILED: it is not a part of reduction.\n");
- return false;
- }
- reduc_phi = NULL;
- FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
- {
- if (flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
- {
- reduc_phi = USE_STMT (use_p);
- break;
- }
- }
- red = reduction_phi (reduction_list, reduc_phi);
- if (red == NULL)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- " FAILED: it is not a part of reduction.\n");
- return false;
- }
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "reduction phi is ");
- print_gimple_stmt (dump_file, red->reduc_phi, 0, 0);
- fprintf (dump_file, "reduction stmt is ");
- print_gimple_stmt (dump_file, red->reduc_stmt, 0, 0);
- }
-
- }
- }
-
- /* The iterations of the loop may communicate only through bivs whose
- iteration space can be distributed efficiently. */
- for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple phi = gsi_stmt (gsi);
- tree def = PHI_RESULT (phi);
- affine_iv iv;
-
- if (is_gimple_reg (def) && !simple_iv (loop, loop, def, &iv, true))
- {
- struct reduction_info *red;
-
- red = reduction_phi (reduction_list, phi);
- if (red == NULL)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- " FAILED: scalar dependency between iterations\n");
- return false;
- }
- }
- }
-
- /* We need to version the loop to verify assumptions in runtime. */
- if (!can_duplicate_loop_p (loop))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, " FAILED: cannot be duplicated\n");
- return false;
- }
-
/* Check for problems with dependences. If the loop can be reversed,
the iterations are independent. */
datarefs = VEC_alloc (data_reference_p, heap, 10);
@@ -951,6 +798,7 @@ create_phi_for_local_result (void **slot, void *data)
gimple new_phi;
basic_block store_bb;
tree local_res;
+ source_location locus;
/* STORE_BB is the block where the phi
should be stored. It is the destination of the loop exit.
@@ -969,11 +817,12 @@ create_phi_for_local_result (void **slot, void *data)
local_res
= make_ssa_name (SSA_NAME_VAR (gimple_assign_lhs (reduc->reduc_stmt)),
NULL);
+ locus = gimple_location (reduc->reduc_stmt);
new_phi = create_phi_node (local_res, store_bb);
SSA_NAME_DEF_STMT (local_res) = new_phi;
- add_phi_arg (new_phi, reduc->init, e);
+ add_phi_arg (new_phi, reduc->init, e, locus);
add_phi_arg (new_phi, gimple_assign_lhs (reduc->reduc_stmt),
- FALLTHRU_EDGE (loop->latch));
+ FALLTHRU_EDGE (loop->latch), locus);
reduc->new_phi = new_phi;
return 1;
@@ -1418,114 +1267,6 @@ create_loop_fn (void)
return decl;
}
-/* Bases all the induction variables in LOOP on a single induction
- variable (unsigned with base 0 and step 1), whose final value is
- compared with *NIT. When the IV type precision has to be larger
- than *NIT type precision, *NIT is converted to the larger type, the
- conversion code is inserted before the loop, and *NIT is updated to
- the new definition. The induction variable is incremented in the
- loop latch. REDUCTION_LIST describes the reductions in LOOP.
- Return the induction variable that was created. */
-
-tree
-canonicalize_loop_ivs (struct loop *loop, htab_t reduction_list, tree *nit)
-{
- unsigned precision = TYPE_PRECISION (TREE_TYPE (*nit));
- unsigned original_precision = precision;
- tree res, type, var_before, val, atype, mtype;
- gimple_stmt_iterator gsi, psi;
- gimple phi, stmt;
- bool ok;
- affine_iv iv;
- edge exit = single_dom_exit (loop);
- struct reduction_info *red;
- gimple_seq stmts;
-
- for (psi = gsi_start_phis (loop->header);
- !gsi_end_p (psi); gsi_next (&psi))
- {
- phi = gsi_stmt (psi);
- res = PHI_RESULT (phi);
-
- if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
- precision = TYPE_PRECISION (TREE_TYPE (res));
- }
-
- type = lang_hooks.types.type_for_size (precision, 1);
-
- if (original_precision != precision)
- {
- *nit = fold_convert (type, *nit);
- *nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE);
- if (stmts)
- gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
- }
-
- gsi = gsi_last_bb (loop->latch);
- create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE,
- loop, &gsi, true, &var_before, NULL);
-
- gsi = gsi_after_labels (loop->header);
- for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); )
- {
- phi = gsi_stmt (psi);
- res = PHI_RESULT (phi);
-
- if (!is_gimple_reg (res) || res == var_before)
- {
- gsi_next (&psi);
- continue;
- }
-
- ok = simple_iv (loop, loop, res, &iv, true);
-
- if (reduction_list)
- red = reduction_phi (reduction_list, phi);
- else
- red = NULL;
-
- /* We preserve the reduction phi nodes. */
- if (!ok && red)
- {
- gsi_next (&psi);
- continue;
- }
- else
- gcc_assert (ok);
- remove_phi_node (&psi, false);
-
- atype = TREE_TYPE (res);
- mtype = POINTER_TYPE_P (atype) ? sizetype : atype;
- val = fold_build2 (MULT_EXPR, mtype, unshare_expr (iv.step),
- fold_convert (mtype, var_before));
- val = fold_build2 (POINTER_TYPE_P (atype)
- ? POINTER_PLUS_EXPR : PLUS_EXPR,
- atype, unshare_expr (iv.base), val);
- val = force_gimple_operand_gsi (&gsi, val, false, NULL_TREE, true,
- GSI_SAME_STMT);
- stmt = gimple_build_assign (res, val);
- gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
- SSA_NAME_DEF_STMT (res) = stmt;
- }
-
- stmt = last_stmt (exit->src);
- /* Make the loop exit if the control condition is not satisfied. */
- if (exit->flags & EDGE_TRUE_VALUE)
- {
- edge te, fe;
-
- extract_true_false_edges_from_block (exit->src, &te, &fe);
- te->flags = EDGE_FALSE_VALUE;
- fe->flags = EDGE_TRUE_VALUE;
- }
- gimple_cond_set_code (stmt, LT_EXPR);
- gimple_cond_set_lhs (stmt, var_before);
- gimple_cond_set_rhs (stmt, *nit);
- update_stmt (stmt);
-
- return var_before;
-}
-
/* Moves the exit condition of LOOP to the beginning of its header, and
duplicates the part of the last iteration that gets disabled to the
exit of the loop. NIT is the number of iterations of the loop
@@ -1568,7 +1309,7 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
nphi = create_phi_node (res, orig_header);
SSA_NAME_DEF_STMT (res) = nphi;
- add_phi_arg (nphi, t, hpred);
+ add_phi_arg (nphi, t, hpred, UNKNOWN_LOCATION);
if (res == control)
{
@@ -1719,14 +1460,20 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
end = make_edge (loop->latch, ex_bb, EDGE_FALLTHRU);
for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ source_location locus;
+ tree def;
phi = gsi_stmt (gsi);
res = PHI_RESULT (phi);
stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
- add_phi_arg (phi,
- PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop)),
- guard);
- add_phi_arg (phi, PHI_ARG_DEF_FROM_EDGE (stmt, loop_latch_edge (loop)),
- end);
+
+ def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop));
+ locus = gimple_phi_arg_location_from_edge (stmt,
+ loop_preheader_edge (loop));
+ add_phi_arg (phi, def, guard, locus);
+
+ def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_latch_edge (loop));
+ locus = gimple_phi_arg_location_from_edge (stmt, loop_latch_edge (loop));
+ add_phi_arg (phi, def, end, locus);
}
e = redirect_edge_and_branch (exit, nexit->dest);
PENDING_STMT (e) = NULL;
@@ -1763,12 +1510,14 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
return paral_bb;
}
-/* Generates code to execute the iterations of LOOP in N_THREADS threads in
- parallel. NITER describes number of iterations of LOOP.
+/* Generates code to execute the iterations of LOOP in N_THREADS
+ threads in parallel.
+
+ NITER describes number of iterations of LOOP.
REDUCTION_LIST describes the reductions existent in the LOOP. */
static void
-gen_parallel_loop (struct loop *loop, htab_t reduction_list,
+gen_parallel_loop (struct loop *loop, htab_t reduction_list,
unsigned n_threads, struct tree_niter_desc *niter)
{
struct loop *nloop;
@@ -1870,7 +1619,7 @@ gen_parallel_loop (struct loop *loop, htab_t reduction_list,
free_original_copy_tables ();
/* Base all the induction variables in LOOP on a single control one. */
- canonicalize_loop_ivs (loop, reduction_list, &nit);
+ canonicalize_loop_ivs (loop, &nit);
/* Ensure that the exit condition is the first statement in the loop. */
transform_to_exit_first_loop (loop, reduction_list, nit);
@@ -1936,6 +1685,184 @@ loop_has_vector_phi_nodes (struct loop *loop ATTRIBUTE_UNUSED)
return res;
}
+/* Create a reduction_info struct, initialize it with REDUC_STMT
+ and PHI, insert it to the REDUCTION_LIST. */
+
+static void
+build_new_reduction (htab_t reduction_list, gimple reduc_stmt, gimple phi)
+{
+ PTR *slot;
+ struct reduction_info *new_reduction;
+
+ gcc_assert (reduc_stmt);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file,
+ "Detected reduction. reduction stmt is: \n");
+ print_gimple_stmt (dump_file, reduc_stmt, 0, 0);
+ fprintf (dump_file, "\n");
+ }
+
+ new_reduction = XCNEW (struct reduction_info);
+
+ new_reduction->reduc_stmt = reduc_stmt;
+ new_reduction->reduc_phi = phi;
+ new_reduction->reduction_code = gimple_assign_rhs_code (reduc_stmt);
+ slot = htab_find_slot (reduction_list, new_reduction, INSERT);
+ *slot = new_reduction;
+}
+
+/* Detect all reductions in the LOOP, insert them into REDUCTION_LIST. */
+
+static void
+gather_scalar_reductions (loop_p loop, htab_t reduction_list)
+{
+ gimple_stmt_iterator gsi;
+ loop_vec_info simple_loop_info;
+
+ vect_dump = NULL;
+ simple_loop_info = vect_analyze_loop_form (loop);
+
+ for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ affine_iv iv;
+ tree res = PHI_RESULT (phi);
+ bool double_reduc;
+
+ if (!is_gimple_reg (res))
+ continue;
+
+ if (!simple_iv (loop, loop, res, &iv, true)
+ && simple_loop_info)
+ {
+ gimple reduc_stmt = vect_is_simple_reduction (simple_loop_info, phi, true, &double_reduc);
+ if (reduc_stmt)
+ build_new_reduction (reduction_list, reduc_stmt, phi);
+ }
+ }
+ destroy_loop_vec_info (simple_loop_info, true);
+}
+
+/* Try to initialize NITER for code generation part. */
+
+static bool
+try_get_loop_niter (loop_p loop, struct tree_niter_desc *niter)
+{
+ edge exit = single_dom_exit (loop);
+
+ gcc_assert (exit);
+
+ /* We need to know # of iterations, and there should be no uses of values
+ defined inside loop outside of it, unless the values are invariants of
+ the loop. */
+ if (!number_of_iterations_exit (loop, exit, niter, false))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " FAILED: number of iterations not known\n");
+ return false;
+ }
+
+ return true;
+}
+
+/* Try to initialize REDUCTION_LIST for code generation part.
+ REDUCTION_LIST describes the reductions. */
+
+static bool
+try_create_reduction_list (loop_p loop, htab_t reduction_list)
+{
+ edge exit = single_dom_exit (loop);
+ gimple_stmt_iterator gsi;
+
+ gcc_assert (exit);
+
+ gather_scalar_reductions (loop, reduction_list);
+
+
+ for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ struct reduction_info *red;
+ imm_use_iterator imm_iter;
+ use_operand_p use_p;
+ gimple reduc_phi;
+ tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit);
+
+ if (is_gimple_reg (val))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "phi is ");
+ print_gimple_stmt (dump_file, phi, 0, 0);
+ fprintf (dump_file, "arg of phi to exit: value ");
+ print_generic_expr (dump_file, val, 0);
+ fprintf (dump_file, " used outside loop\n");
+ fprintf (dump_file,
+ " checking if it a part of reduction pattern: \n");
+ }
+ if (htab_elements (reduction_list) == 0)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " FAILED: it is not a part of reduction.\n");
+ return false;
+ }
+ reduc_phi = NULL;
+ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
+ {
+ if (flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
+ {
+ reduc_phi = USE_STMT (use_p);
+ break;
+ }
+ }
+ red = reduction_phi (reduction_list, reduc_phi);
+ if (red == NULL)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " FAILED: it is not a part of reduction.\n");
+ return false;
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "reduction phi is ");
+ print_gimple_stmt (dump_file, red->reduc_phi, 0, 0);
+ fprintf (dump_file, "reduction stmt is ");
+ print_gimple_stmt (dump_file, red->reduc_stmt, 0, 0);
+ }
+ }
+ }
+
+ /* The iterations of the loop may communicate only through bivs whose
+ iteration space can be distributed efficiently. */
+ for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ tree def = PHI_RESULT (phi);
+ affine_iv iv;
+
+ if (is_gimple_reg (def) && !simple_iv (loop, loop, def, &iv, true))
+ {
+ struct reduction_info *red;
+
+ red = reduction_phi (reduction_list, phi);
+ if (red == NULL)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " FAILED: scalar dependency between iterations\n");
+ return false;
+ }
+ }
+ }
+
+
+ return true;
+}
+
/* Detect parallel loops and generate parallel code using libgomp
primitives. Returns true if some loop was parallelized, false
otherwise. */
@@ -1955,26 +1882,49 @@ parallelize_loops (void)
return false;
reduction_list = htab_create (10, reduction_info_hash,
- reduction_info_eq, free);
+ reduction_info_eq, free);
init_stmt_vec_info_vec ();
FOR_EACH_LOOP (li, loop, 0)
{
htab_empty (reduction_list);
- if (/* Do not bother with loops in cold areas. */
- optimize_loop_nest_for_size_p (loop)
- /* Or loops that roll too little. */
- || expected_loop_iterations (loop) <= n_threads
- /* And of course, the loop must be parallelizable. */
- || !can_duplicate_loop_p (loop)
+
+ /* If we use autopar in graphite pass, we use it's marked dependency
+ checking results. */
+ if (flag_loop_parallelize_all && !loop->can_be_parallel)
+ continue;
+
+ /* FIXME: Only consider innermost loops with just one exit. */
+ if (loop->inner || !single_dom_exit (loop))
+ continue;
+
+ if (/* And of course, the loop must be parallelizable. */
+ !can_duplicate_loop_p (loop)
|| loop_has_blocks_with_irreducible_flag (loop)
/* FIXME: the check for vector phi nodes could be removed. */
- || loop_has_vector_phi_nodes (loop)
- || !loop_parallel_p (loop, reduction_list, &niter_desc))
+ || loop_has_vector_phi_nodes (loop))
+ continue;
+
+ /* FIXME: Bypass this check as graphite doesn't update the
+ count and frequency correctly now. */
+ if (!flag_loop_parallelize_all
+ && (expected_loop_iterations (loop) <= n_threads
+ /* Do not bother with loops in cold areas. */
+ || optimize_loop_nest_for_size_p (loop)))
+ continue;
+
+ if (!try_get_loop_niter (loop, &niter_desc))
+ continue;
+
+ if (!try_create_reduction_list (loop, reduction_list))
+ continue;
+
+ if (!flag_loop_parallelize_all && !loop_parallel_p (loop))
continue;
changed = true;
- gen_parallel_loop (loop, reduction_list, n_threads, &niter_desc);
+ gen_parallel_loop (loop, reduction_list,
+ n_threads, &niter_desc);
verify_flow_info ();
verify_dominators (CDI_DOMINATORS);
verify_loop_structure ();
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 2907807690a..a48ae01fe8d 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -231,6 +231,8 @@ make_phi_node (tree var, int len)
for (i = 0; i < capacity; i++)
{
use_operand_p imm;
+
+ gimple_phi_arg_set_location (phi, i, UNKNOWN_LOCATION);
imm = gimple_phi_arg_imm_use_ptr (phi, i);
imm->use = gimple_phi_arg_def_ptr (phi, i);
imm->prev = NULL;
@@ -299,6 +301,8 @@ resize_phi_node (gimple *phi, size_t len)
for (i = gimple_phi_num_args (new_phi); i < len; i++)
{
use_operand_p imm;
+
+ gimple_phi_arg_set_location (new_phi, i, UNKNOWN_LOCATION);
imm = gimple_phi_arg_imm_use_ptr (new_phi, i);
imm->use = gimple_phi_arg_def_ptr (new_phi, i);
imm->prev = NULL;
@@ -384,7 +388,7 @@ create_phi_node (tree var, basic_block bb)
PHI points to the reallocated phi node when we return. */
void
-add_phi_arg (gimple phi, tree def, edge e)
+add_phi_arg (gimple phi, tree def, edge e, source_location locus)
{
basic_block bb = e->dest;
@@ -407,6 +411,7 @@ add_phi_arg (gimple phi, tree def, edge e)
}
SET_PHI_ARG_DEF (phi, e->dest_idx, def);
+ gimple_phi_arg_set_location (phi, e->dest_idx, locus);
}
@@ -435,6 +440,9 @@ remove_phi_arg_num (gimple phi, int i)
/* Set use on new node, and link into last element's place. */
*(new_p->use) = *(old_p->use);
relink_imm_use (new_p, old_p);
+ /* Move the location as well. */
+ gimple_phi_arg_set_location (phi, i,
+ gimple_phi_arg_location (phi, num_elem - 1));
}
/* Shrink the vector and return. Note that we do not have to clear
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 5d8bf4d2704..0ce35f5de86 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1512,8 +1512,8 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
phi = create_phi_node (var, loop->header);
SSA_NAME_DEF_STMT (var) = phi;
- add_phi_arg (phi, init, entry);
- add_phi_arg (phi, next, latch);
+ add_phi_arg (phi, init, entry, UNKNOWN_LOCATION);
+ add_phi_arg (phi, next, latch, UNKNOWN_LOCATION);
}
}
@@ -1576,8 +1576,8 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
next = VEC_index (tree, *vars, 1);
phi = create_phi_node (var, loop->header);
SSA_NAME_DEF_STMT (var) = phi;
- add_phi_arg (phi, init, entry);
- add_phi_arg (phi, next, latch);
+ add_phi_arg (phi, init, entry, UNKNOWN_LOCATION);
+ add_phi_arg (phi, next, latch, UNKNOWN_LOCATION);
}
else
{
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index bac6e594d8f..02a4eed646e 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -466,7 +466,7 @@ loop_phi_node_p (gimple phi)
EVOLUTION_FN = {i_0, +, 2}_1.
*/
-static tree
+tree
compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
{
bool val = false;
@@ -492,7 +492,10 @@ compute_overall_effect_of_inner_loop (struct loop *loop, tree evolution_fn)
/* evolution_fn is the evolution function in LOOP. Get
its value in the nb_iter-th iteration. */
res = chrec_apply (inner_loop->num, evolution_fn, nb_iter);
-
+
+ if (chrec_contains_symbols_defined_in_loop (res, loop->num))
+ res = instantiate_parameters (loop, res);
+
/* Continue the computation until ending on a parent of LOOP. */
return compute_overall_effect_of_inner_loop (loop, res);
}
@@ -1890,18 +1893,16 @@ analyze_scalar_evolution_1 (struct loop *loop, tree var, tree res)
return res;
}
-/* Entry point for the scalar evolution analyzer.
- Analyzes and returns the scalar evolution of the ssa_name VAR.
- LOOP_NB is the identifier number of the loop in which the variable
- is used.
+/* Analyzes and returns the scalar evolution of the ssa_name VAR in
+ LOOP. LOOP is the loop in which the variable is used.
Example of use: having a pointer VAR to a SSA_NAME node, STMT a
pointer to the statement that uses this variable, in order to
determine the evolution function of the variable, use the following
calls:
- unsigned loop_nb = loop_containing_stmt (stmt)->num;
- tree chrec_with_symbols = analyze_scalar_evolution (loop_nb, var);
+ loop_p loop = loop_containing_stmt (stmt);
+ tree chrec_with_symbols = analyze_scalar_evolution (loop, var);
tree chrec_instantiated = instantiate_parameters (loop, chrec_with_symbols);
*/
@@ -2174,7 +2175,9 @@ instantiate_scev_1 (basic_block instantiate_below,
else
res = chrec;
- if (res == NULL_TREE)
+ if (res == NULL_TREE
+ || !dominated_by_p (CDI_DOMINATORS, instantiate_below,
+ gimple_bb (SSA_NAME_DEF_STMT (res))))
res = chrec_dont_know;
}
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
index 06324972ca5..5caadc57031 100644
--- a/gcc/tree-scalar-evolution.h
+++ b/gcc/tree-scalar-evolution.h
@@ -1,5 +1,5 @@
/* Scalar evolution detector.
- 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 Sebastian Pop <s.pop@laposte.net>
This file is part of GCC.
@@ -33,10 +33,10 @@ extern tree instantiate_scev (basic_block, struct loop *, tree);
extern tree resolve_mixers (struct loop *, tree);
extern void gather_stats_on_scev_database (void);
extern void scev_analysis (void);
-unsigned int scev_const_prop (void);
-
-bool expression_expensive_p (tree);
+extern unsigned int scev_const_prop (void);
+extern bool expression_expensive_p (tree);
extern bool simple_iv (struct loop *, struct loop *, tree, affine_iv *, bool);
+extern tree compute_overall_effect_of_inner_loop (struct loop *, tree);
/* Returns the basic block preceding LOOP or ENTRY_BLOCK_PTR when the
loop is function's body. */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index a7bb017b476..33be0f6aaca 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -79,6 +79,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple.h"
#include "tree-flow.h"
+#include "ipa-prop.h"
#include "diagnostic.h"
#include "statistics.h"
#include "tree-dump.h"
@@ -1119,7 +1120,7 @@ build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset,
minor rewrite of fold_stmt.
*/
-static bool
+bool
build_ref_for_offset (tree *expr, tree type, HOST_WIDE_INT offset,
tree exp_type, bool allow_ptr)
{
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 92297fc6cf2..acfdcae0c0c 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -578,8 +578,8 @@ nonaliasing_component_refs_p (tree ref1, tree type1,
}
/* Return true if two memory references based on the variables BASE1
- and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1[ and
- [OFFSET2, OFFSET2 + MAX_SIZE2[ may alias. */
+ and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and
+ [OFFSET2, OFFSET2 + MAX_SIZE2) may alias. */
static bool
decl_refs_may_alias_p (tree base1,
@@ -599,8 +599,8 @@ decl_refs_may_alias_p (tree base1,
}
/* Return true if an indirect reference based on *PTR1 constrained
- to [OFFSET1, OFFSET1 + MAX_SIZE1[ may alias a variable based on BASE2
- constrained to [OFFSET2, OFFSET2 + MAX_SIZE2[. *PTR1 and BASE2 have
+ to [OFFSET1, OFFSET1 + MAX_SIZE1) may alias a variable based on BASE2
+ constrained to [OFFSET2, OFFSET2 + MAX_SIZE2). *PTR1 and BASE2 have
the alias sets BASE1_ALIAS_SET and BASE2_ALIAS_SET which can be -1
in which case they are computed on-demand. REF1 and REF2
if non-NULL are the complete memory reference trees. */
@@ -662,8 +662,8 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1,
}
/* Return true if two indirect references based on *PTR1
- and *PTR2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1[ and
- [OFFSET2, OFFSET2 + MAX_SIZE2[ may alias. *PTR1 and *PTR2 have
+ and *PTR2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and
+ [OFFSET2, OFFSET2 + MAX_SIZE2) may alias. *PTR1 and *PTR2 have
the alias sets BASE1_ALIAS_SET and BASE2_ALIAS_SET which can be -1
in which case they are computed on-demand. REF1 and REF2
if non-NULL are the complete memory reference trees. */
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index c507f4572e6..b359d4c8d76 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -276,7 +276,8 @@ tree
get_symbol_constant_value (tree sym)
{
if (TREE_STATIC (sym)
- && TREE_READONLY (sym))
+ && (TREE_READONLY (sym)
+ || TREE_CODE (sym) == CONST_DECL))
{
tree val = DECL_INITIAL (sym);
if (val)
@@ -288,7 +289,11 @@ get_symbol_constant_value (tree sym)
{
tree base = get_base_address (TREE_OPERAND (val, 0));
if (base && TREE_CODE (base) == VAR_DECL)
- add_referenced_var (base);
+ {
+ TREE_ADDRESSABLE (base) = 1;
+ if (gimple_referenced_vars (cfun))
+ add_referenced_var (base);
+ }
}
return val;
}
@@ -1088,9 +1093,8 @@ ccp_fold (gimple stmt)
&& TREE_CODE (op0) == ADDR_EXPR
&& TREE_CODE (op1) == INTEGER_CST)
{
- tree lhs = gimple_assign_lhs (stmt);
tree tem = maybe_fold_offset_to_address
- (loc, op0, op1, TREE_TYPE (lhs));
+ (loc, op0, op1, TREE_TYPE (op0));
if (tem != NULL_TREE)
return tem;
}
@@ -2337,6 +2341,19 @@ maybe_fold_reference (tree expr, bool is_lhs)
return expr;
}
}
+ else if (!is_lhs
+ && DECL_P (*t))
+ {
+ tree tem = get_symbol_constant_value (*t);
+ if (tem)
+ {
+ *t = tem;
+ tem = maybe_fold_reference (expr, is_lhs);
+ if (tem)
+ return tem;
+ return expr;
+ }
+ }
return NULL_TREE;
}
@@ -2739,6 +2756,9 @@ fold_gimple_assign (gimple_stmt_iterator *si)
CONSTRUCTOR_ELTS (rhs));
}
+ else if (DECL_P (rhs))
+ return get_symbol_constant_value (rhs);
+
/* If we couldn't fold the RHS, hand over to the generic
fold routines. */
if (result == NULL_TREE)
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 8f4a768121d..99a039fffee 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -955,6 +955,7 @@ forward_edge_to_pdom (edge e, basic_block post_dom_bb)
{
gimple phi = gsi_stmt (gsi);
tree op;
+ source_location locus;
/* Dead PHI do not imply control dependency. */
if (!gimple_plf (phi, STMT_NECESSARY)
@@ -979,10 +980,16 @@ forward_edge_to_pdom (edge e, basic_block post_dom_bb)
continue;
}
if (!e2)
- op = gimple_phi_arg_def (phi, e->dest_idx == 0 ? 1 : 0);
+ {
+ op = gimple_phi_arg_def (phi, e->dest_idx == 0 ? 1 : 0);
+ locus = gimple_phi_arg_location (phi, e->dest_idx == 0 ? 1 : 0);
+ }
else
- op = gimple_phi_arg_def (phi, e2->dest_idx);
- add_phi_arg (phi, op, e);
+ {
+ op = gimple_phi_arg_def (phi, e2->dest_idx);
+ locus = gimple_phi_arg_location (phi, e2->dest_idx);
+ }
+ add_phi_arg (phi, op, e, locus);
gcc_assert (e2 || degenerate_phi_p (phi));
gsi_next (&gsi);
}
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 8cb9c1e4944..1d2d85b7a8f 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -151,7 +151,7 @@ get_name_for_bit_test (tree candidate)
{
gimple def_stmt = SSA_NAME_DEF_STMT (candidate);
if (is_gimple_assign (def_stmt)
- && gimple_assign_cast_p (def_stmt))
+ && CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))
{
if (TYPE_PRECISION (TREE_TYPE (candidate))
<= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (def_stmt))))
@@ -162,21 +162,6 @@ get_name_for_bit_test (tree candidate)
return candidate;
}
-/* Helpers for recognize_single_bit_test defined mainly for source code
- formating. */
-
-static int
-operand_precision (tree t)
-{
- return TYPE_PRECISION (TREE_TYPE (t));
-}
-
-static bool
-integral_operand_p (tree t)
-{
- return INTEGRAL_TYPE_P (TREE_TYPE (t));
-}
-
/* Recognize a single bit test pattern in GIMPLE_COND and its defining
statements. Store the name being tested in *NAME and the bit
in *BIT. The GIMPLE_COND computes *NAME & (1 << *BIT).
@@ -212,15 +197,11 @@ recognize_single_bit_test (gimple cond, tree *name, tree *bit)
stmt = SSA_NAME_DEF_STMT (orig_name);
while (is_gimple_assign (stmt)
- && (gimple_assign_ssa_name_copy_p (stmt)
- || (gimple_assign_cast_p (stmt)
- && integral_operand_p (gimple_assign_lhs (stmt))
- && integral_operand_p (gimple_assign_rhs1 (stmt))
- && (operand_precision (gimple_assign_lhs (stmt))
- <= operand_precision (gimple_assign_rhs1 (stmt))))))
- {
- stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
- }
+ && ((CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (stmt))
+ && (TYPE_PRECISION (TREE_TYPE (gimple_assign_lhs (stmt)))
+ <= TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs1 (stmt)))))
+ || gimple_assign_ssa_name_copy_p (stmt)))
+ stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (stmt));
/* If we found such, decompose it. */
if (is_gimple_assign (stmt)
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 94e926b0a25..e85a0dd22c5 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -135,7 +135,7 @@ enum use_type
/* Cost of a computation. */
typedef struct
{
- unsigned cost; /* The runtime cost. */
+ int cost; /* The runtime cost. */
unsigned complexity; /* The estimate of the complexity of the code for
the computation (in no concrete units --
complexity field should be larger for more
@@ -181,6 +181,8 @@ enum iv_position
{
IP_NORMAL, /* At the end, just before the exit condition. */
IP_END, /* At the end of the latch block. */
+ IP_BEFORE_USE, /* Immediately before a specific use. */
+ IP_AFTER_USE, /* Immediately after a specific use. */
IP_ORIGINAL /* The original biv. */
};
@@ -200,6 +202,9 @@ struct iv_cand
to replace the final value of an iv by direct
computation of the value. */
unsigned cost; /* Cost of the candidate. */
+ unsigned cost_step; /* Cost of the candidate's increment operation. */
+ struct iv_use *ainc_use; /* For IP_{BEFORE,AFTER}_USE candidates, the place
+ where it is incremented. */
bitmap depends_on; /* The list of invariants that are used in step of the
biv. */
};
@@ -515,6 +520,14 @@ dump_cand (FILE *file, struct iv_cand *cand)
fprintf (file, " incremented before exit test\n");
break;
+ case IP_BEFORE_USE:
+ fprintf (file, " incremented before use %d\n", cand->ainc_use->id);
+ break;
+
+ case IP_AFTER_USE:
+ fprintf (file, " incremented after use %d\n", cand->ainc_use->id);
+ break;
+
case IP_END:
fprintf (file, " incremented at end\n");
break;
@@ -563,14 +576,14 @@ stmt_after_ip_normal_pos (struct loop *loop, gimple stmt)
}
/* Returns true if STMT if after the place where the original induction
- variable CAND is incremented. */
+ variable CAND is incremented. If TRUE_IF_EQUAL is set, we return true
+ if the positions are identical. */
static bool
-stmt_after_ip_original_pos (struct iv_cand *cand, gimple stmt)
+stmt_after_inc_pos (struct iv_cand *cand, gimple stmt, bool true_if_equal)
{
basic_block cand_bb = gimple_bb (cand->incremented_at);
basic_block stmt_bb = gimple_bb (stmt);
- gimple_stmt_iterator bsi;
if (!dominated_by_p (CDI_DOMINATORS, stmt_bb, cand_bb))
return false;
@@ -578,15 +591,10 @@ stmt_after_ip_original_pos (struct iv_cand *cand, gimple stmt)
if (stmt_bb != cand_bb)
return true;
- /* Scan the block from the end, since the original ivs are usually
- incremented at the end of the loop body. */
- for (bsi = gsi_last_bb (stmt_bb); ; gsi_prev (&bsi))
- {
- if (gsi_stmt (bsi) == cand->incremented_at)
- return false;
- if (gsi_stmt (bsi) == stmt)
- return true;
- }
+ if (true_if_equal
+ && gimple_uid (stmt) == gimple_uid (cand->incremented_at))
+ return true;
+ return gimple_uid (stmt) > gimple_uid (cand->incremented_at);
}
/* Returns true if STMT if after the place where the induction variable
@@ -604,7 +612,11 @@ stmt_after_increment (struct loop *loop, struct iv_cand *cand, gimple stmt)
return stmt_after_ip_normal_pos (loop, stmt);
case IP_ORIGINAL:
- return stmt_after_ip_original_pos (cand, stmt);
+ case IP_AFTER_USE:
+ return stmt_after_inc_pos (cand, stmt, false);
+
+ case IP_BEFORE_USE:
+ return stmt_after_inc_pos (cand, stmt, true);
default:
gcc_unreachable ();
@@ -2104,7 +2116,9 @@ add_candidate_1 (struct ivopts_data *data,
if (cand->pos != pos)
continue;
- if (cand->incremented_at != incremented_at)
+ if (cand->incremented_at != incremented_at
+ || ((pos == IP_AFTER_USE || pos == IP_BEFORE_USE)
+ && cand->ainc_use != use))
continue;
if (!cand->iv)
@@ -2150,6 +2164,11 @@ add_candidate_1 (struct ivopts_data *data,
walk_tree (&step, find_depends, &cand->depends_on, NULL);
}
+ if (pos == IP_AFTER_USE || pos == IP_BEFORE_USE)
+ cand->ainc_use = use;
+ else
+ cand->ainc_use = NULL;
+
if (dump_file && (dump_flags & TDF_DETAILS))
dump_cand (dump_file, cand);
}
@@ -2193,6 +2212,56 @@ allow_ip_end_pos_p (struct loop *loop)
return false;
}
+/* If possible, adds autoincrement candidates BASE + STEP * i based on use USE.
+ Important field is set to IMPORTANT. */
+
+static void
+add_autoinc_candidates (struct ivopts_data *data, tree base, tree step,
+ bool important, struct iv_use *use)
+{
+ basic_block use_bb = gimple_bb (use->stmt);
+ enum machine_mode mem_mode;
+ unsigned HOST_WIDE_INT cstepi;
+
+ /* If we insert the increment in any position other than the standard
+ ones, we must ensure that it is incremented once per iteration.
+ It must not be in an inner nested loop, or one side of an if
+ statement. */
+ if (use_bb->loop_father != data->current_loop
+ || !dominated_by_p (CDI_DOMINATORS, data->current_loop->latch, use_bb)
+ || stmt_could_throw_p (use->stmt)
+ || !cst_and_fits_in_hwi (step))
+ return;
+
+ cstepi = int_cst_value (step);
+
+ mem_mode = TYPE_MODE (TREE_TYPE (*use->op_p));
+ if ((HAVE_PRE_INCREMENT && GET_MODE_SIZE (mem_mode) == cstepi)
+ || (HAVE_PRE_DECREMENT && GET_MODE_SIZE (mem_mode) == -cstepi))
+ {
+ enum tree_code code = MINUS_EXPR;
+ tree new_base;
+ tree new_step = step;
+
+ if (POINTER_TYPE_P (TREE_TYPE (base)))
+ {
+ new_step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step);
+ code = POINTER_PLUS_EXPR;
+ }
+ else
+ new_step = fold_convert (TREE_TYPE (base), new_step);
+ new_base = fold_build2 (code, TREE_TYPE (base), base, new_step);
+ add_candidate_1 (data, new_base, step, important, IP_BEFORE_USE, use,
+ use->stmt);
+ }
+ if ((HAVE_POST_INCREMENT && GET_MODE_SIZE (mem_mode) == cstepi)
+ || (HAVE_POST_DECREMENT && GET_MODE_SIZE (mem_mode) == -cstepi))
+ {
+ add_candidate_1 (data, base, step, important, IP_AFTER_USE, use,
+ use->stmt);
+ }
+}
+
/* Adds a candidate BASE + STEP * i. Important field is set to IMPORTANT and
position to POS. If USE is not NULL, the candidate is set as related to
it. The candidate computation is scheduled on all available positions. */
@@ -2206,6 +2275,9 @@ add_candidate (struct ivopts_data *data,
if (ip_end_pos (data->current_loop)
&& allow_ip_end_pos_p (data->current_loop))
add_candidate_1 (data, base, step, important, IP_END, use, NULL);
+
+ if (use != NULL && use->type == USE_ADDRESS)
+ add_autoinc_candidates (data, base, step, important, use);
}
/* Add a standard "0 + 1 * iteration" iv candidate for a
@@ -2379,24 +2451,6 @@ record_important_candidates (struct ivopts_data *data)
}
}
-/* Finds the candidates for the induction variables. */
-
-static void
-find_iv_candidates (struct ivopts_data *data)
-{
- /* Add commonly used ivs. */
- add_standard_iv_candidates (data);
-
- /* Add old induction variables. */
- add_old_ivs_candidates (data);
-
- /* Add induction variables derived from uses. */
- add_derived_ivs_candidates (data);
-
- /* Record the important candidates. */
- record_important_candidates (data);
-}
-
/* Allocates the data structure mapping the (use, candidate) pairs to costs.
If consider_all_candidates is true, we use a two-dimensional array, otherwise
we allocate a simple list to every use. */
@@ -2488,7 +2542,7 @@ infinite_cost_p (comp_cost cost)
/* Sets cost of (USE, CANDIDATE) pair to COST and record that it depends
on invariants DEPENDS_ON and that the value used in expressing it
- is VALUE.*/
+ is VALUE. */
static void
set_use_iv_cost (struct ivopts_data *data,
@@ -3012,21 +3066,30 @@ multiplier_allowed_in_address_p (HOST_WIDE_INT ratio, enum machine_mode mode)
variable is omitted. Compute the cost for a memory reference that accesses
a memory location of mode MEM_MODE.
+ MAY_AUTOINC is set to true if the autoincrement (increasing index by
+ size of MEM_MODE / RATIO) is available. To make this determination, we
+ look at the size of the increment to be made, which is given in CSTEP.
+ CSTEP may be zero if the step is unknown.
+ STMT_AFTER_INC is true iff the statement we're looking at is after the
+ increment of the original biv.
+
TODO -- there must be some better way. This all is quite crude. */
static comp_cost
get_address_cost (bool symbol_present, bool var_present,
unsigned HOST_WIDE_INT offset, HOST_WIDE_INT ratio,
- enum machine_mode mem_mode,
- bool speed)
+ HOST_WIDE_INT cstep, enum machine_mode mem_mode, bool speed,
+ bool stmt_after_inc, bool *may_autoinc)
{
static bool initialized[MAX_MACHINE_MODE];
static HOST_WIDE_INT rat[MAX_MACHINE_MODE], off[MAX_MACHINE_MODE];
static HOST_WIDE_INT min_offset[MAX_MACHINE_MODE], max_offset[MAX_MACHINE_MODE];
static unsigned costs[MAX_MACHINE_MODE][2][2][2][2];
+ static bool has_preinc[MAX_MACHINE_MODE], has_postinc[MAX_MACHINE_MODE];
+ static bool has_predec[MAX_MACHINE_MODE], has_postdec[MAX_MACHINE_MODE];
unsigned cost, acost, complexity;
- bool offset_p, ratio_p;
- HOST_WIDE_INT s_offset;
+ bool offset_p, ratio_p, autoinc;
+ HOST_WIDE_INT s_offset, autoinc_offset, msize;
unsigned HOST_WIDE_INT mask;
unsigned bits;
@@ -3085,6 +3148,26 @@ get_address_cost (bool symbol_present, bool var_present,
reg0 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 2);
+ if (HAVE_PRE_DECREMENT)
+ {
+ addr = gen_rtx_PRE_DEC (Pmode, reg0);
+ has_predec[mem_mode] = memory_address_p (mem_mode, addr);
+ }
+ if (HAVE_POST_DECREMENT)
+ {
+ addr = gen_rtx_POST_DEC (Pmode, reg0);
+ has_postdec[mem_mode] = memory_address_p (mem_mode, addr);
+ }
+ if (HAVE_PRE_INCREMENT)
+ {
+ addr = gen_rtx_PRE_INC (Pmode, reg0);
+ has_preinc[mem_mode] = memory_address_p (mem_mode, addr);
+ }
+ if (HAVE_POST_INCREMENT)
+ {
+ addr = gen_rtx_POST_INC (Pmode, reg0);
+ has_postinc[mem_mode] = memory_address_p (mem_mode, addr);
+ }
for (i = 0; i < 16; i++)
{
sym_p = i & 1;
@@ -3123,7 +3206,7 @@ get_address_cost (bool symbol_present, bool var_present,
if (base)
addr = gen_rtx_fmt_ee (PLUS, Pmode, addr, base);
-
+
start_sequence ();
/* To avoid splitting addressing modes, pretend that no cse will
follow. */
@@ -3168,7 +3251,7 @@ get_address_cost (bool symbol_present, bool var_present,
if (acost < costs[mem_mode][1][var_p][off_p][rat_p])
costs[mem_mode][1][var_p][off_p][rat_p] = acost;
}
-
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Address costs:\n");
@@ -3193,6 +3276,9 @@ get_address_cost (bool symbol_present, bool var_present,
acost = costs[mem_mode][sym_p][var_p][off_p][rat_p];
fprintf (dump_file, "index costs %d\n", acost);
}
+ if (has_predec[mem_mode] || has_postdec[mem_mode]
+ || has_preinc[mem_mode] || has_postinc[mem_mode])
+ fprintf (dump_file, " May include autoinc/dec\n");
fprintf (dump_file, "\n");
}
}
@@ -3204,6 +3290,23 @@ get_address_cost (bool symbol_present, bool var_present,
offset |= ~mask;
s_offset = offset;
+ autoinc = false;
+ msize = GET_MODE_SIZE (mem_mode);
+ autoinc_offset = offset;
+ if (stmt_after_inc)
+ autoinc_offset += ratio * cstep;
+ if (symbol_present || var_present || ratio != 1)
+ autoinc = false;
+ else if ((has_postinc[mem_mode] && autoinc_offset == 0
+ && msize == cstep)
+ || (has_postdec[mem_mode] && autoinc_offset == 0
+ && msize == -cstep)
+ || (has_preinc[mem_mode] && autoinc_offset == msize
+ && msize == cstep)
+ || (has_predec[mem_mode] && autoinc_offset == -msize
+ && msize == -cstep))
+ autoinc = true;
+
cost = 0;
offset_p = (s_offset != 0
&& min_offset[mem_mode] <= s_offset
@@ -3217,6 +3320,8 @@ get_address_cost (bool symbol_present, bool var_present,
if (s_offset && !offset_p && !symbol_present)
cost += add_cost (Pmode, speed);
+ if (may_autoinc)
+ *may_autoinc = autoinc;
acost = costs[mem_mode][symbol_present][var_present][offset_p][ratio_p];
complexity = (symbol_present != 0) + (var_present != 0) + offset_p + ratio_p;
return new_cost (cost + acost, complexity);
@@ -3369,7 +3474,7 @@ force_expr_to_var_cost (tree expr, bool speed)
computations often are either loop invariant or at least can
be shared between several iv uses, so letting this grow without
limits would not give reasonable results. */
- if (cost.cost > target_spill_cost [speed])
+ if (cost.cost > (int) target_spill_cost [speed])
cost.cost = target_spill_cost [speed];
return cost;
@@ -3536,19 +3641,22 @@ difference_cost (struct ivopts_data *data,
from induction variable CAND. If ADDRESS_P is true, we just need
to create an address from it, otherwise we want to get it into
register. A set of invariants we depend on is stored in
- DEPENDS_ON. AT is the statement at that the value is computed. */
+ DEPENDS_ON. AT is the statement at that the value is computed.
+ If CAN_AUTOINC is nonnull, use it to record whether autoinc
+ addressing is likely. */
static comp_cost
get_computation_cost_at (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand,
- bool address_p, bitmap *depends_on, gimple at)
+ bool address_p, bitmap *depends_on, gimple at,
+ bool *can_autoinc)
{
tree ubase = use->iv->base, ustep = use->iv->step;
tree cbase, cstep;
tree utype = TREE_TYPE (ubase), ctype;
unsigned HOST_WIDE_INT cstepi, offset = 0;
HOST_WIDE_INT ratio, aratio;
- bool var_present, symbol_present;
+ bool var_present, symbol_present, stmt_is_after_inc;
comp_cost cost;
double_int rat;
bool speed = optimize_bb_for_speed_p (gimple_bb (at));
@@ -3657,7 +3765,8 @@ get_computation_cost_at (struct ivopts_data *data,
/* If we are after the increment, the value of the candidate is higher by
one iteration. */
- if (stmt_after_increment (data->current_loop, cand, at))
+ stmt_is_after_inc = stmt_after_increment (data->current_loop, cand, at);
+ if (stmt_is_after_inc)
offset -= ratio * cstepi;
/* Now the computation is in shape symbol + var1 + const + ratio * var2.
@@ -3666,8 +3775,10 @@ get_computation_cost_at (struct ivopts_data *data,
if (address_p)
return add_costs (cost,
get_address_cost (symbol_present, var_present,
- offset, ratio,
- TYPE_MODE (TREE_TYPE (utype)), speed));
+ offset, ratio, cstepi,
+ TYPE_MODE (TREE_TYPE (utype)),
+ speed, stmt_is_after_inc,
+ can_autoinc));
/* Otherwise estimate the costs for computing the expression. */
if (!symbol_present && !var_present && !offset)
@@ -3695,6 +3806,9 @@ get_computation_cost_at (struct ivopts_data *data,
cost.cost += multiply_by_cost (aratio, TYPE_MODE (ctype), speed);
fallback:
+ if (can_autoinc)
+ *can_autoinc = false;
+
{
/* Just get the expression, expand it and measure the cost. */
tree comp = get_computation_at (data->current_loop, use, cand, at);
@@ -3713,15 +3827,17 @@ fallback:
from induction variable CAND. If ADDRESS_P is true, we just need
to create an address from it, otherwise we want to get it into
register. A set of invariants we depend on is stored in
- DEPENDS_ON. */
+ DEPENDS_ON. If CAN_AUTOINC is nonnull, use it to record whether
+ autoinc addressing is likely. */
static comp_cost
get_computation_cost (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand,
- bool address_p, bitmap *depends_on)
+ bool address_p, bitmap *depends_on, bool *can_autoinc)
{
return get_computation_cost_at (data,
- use, cand, address_p, depends_on, use->stmt);
+ use, cand, address_p, depends_on, use->stmt,
+ can_autoinc);
}
/* Determines cost of basing replacement of USE on CAND in a generic
@@ -3745,7 +3861,7 @@ determine_use_iv_cost_generic (struct ivopts_data *data,
return true;
}
- cost = get_computation_cost (data, use, cand, false, &depends_on);
+ cost = get_computation_cost (data, use, cand, false, &depends_on, NULL);
set_use_iv_cost (data, use, cand, cost, depends_on, NULL_TREE);
return !infinite_cost_p (cost);
@@ -3758,8 +3874,20 @@ determine_use_iv_cost_address (struct ivopts_data *data,
struct iv_use *use, struct iv_cand *cand)
{
bitmap depends_on;
- comp_cost cost = get_computation_cost (data, use, cand, true, &depends_on);
+ bool can_autoinc;
+ comp_cost cost = get_computation_cost (data, use, cand, true, &depends_on,
+ &can_autoinc);
+ if (cand->ainc_use == use)
+ {
+ if (can_autoinc)
+ cost.cost -= cand->cost_step;
+ /* If we generated the candidate solely for exploiting autoincrement
+ opportunities, and it turns out it can't be used, set the cost to
+ infinity to make sure we ignore it. */
+ else if (cand->pos == IP_AFTER_USE || cand->pos == IP_BEFORE_USE)
+ cost = infinite_cost;
+ }
set_use_iv_cost (data, use, cand, cost, depends_on, NULL_TREE);
return !infinite_cost_p (cost);
@@ -3939,7 +4067,7 @@ determine_use_iv_cost_condition (struct ivopts_data *data,
gcc_assert (ok);
express_cost = get_computation_cost (data, use, cand, false,
- &depends_on_express);
+ &depends_on_express, NULL);
fd_ivopts_data = data;
walk_tree (&cmp_iv->base, find_depends, &depends_on_express, NULL);
@@ -3991,6 +4119,78 @@ determine_use_iv_cost (struct ivopts_data *data,
}
}
+/* Return true if get_computation_cost indicates that autoincrement is
+ a possibility for the pair of USE and CAND, false otherwise. */
+
+static bool
+autoinc_possible_for_pair (struct ivopts_data *data, struct iv_use *use,
+ struct iv_cand *cand)
+{
+ bitmap depends_on;
+ bool can_autoinc;
+ comp_cost cost;
+
+ if (use->type != USE_ADDRESS)
+ return false;
+
+ cost = get_computation_cost (data, use, cand, true, &depends_on,
+ &can_autoinc);
+
+ BITMAP_FREE (depends_on);
+
+ return !infinite_cost_p (cost) && can_autoinc;
+}
+
+/* Examine IP_ORIGINAL candidates to see if they are incremented next to a
+ use that allows autoincrement, and set their AINC_USE if possible. */
+
+static void
+set_autoinc_for_original_candidates (struct ivopts_data *data)
+{
+ unsigned i, j;
+
+ for (i = 0; i < n_iv_cands (data); i++)
+ {
+ struct iv_cand *cand = iv_cand (data, i);
+ struct iv_use *closest = NULL;
+ if (cand->pos != IP_ORIGINAL)
+ continue;
+ for (j = 0; j < n_iv_uses (data); j++)
+ {
+ struct iv_use *use = iv_use (data, j);
+ unsigned uid = gimple_uid (use->stmt);
+ if (gimple_bb (use->stmt) != gimple_bb (cand->incremented_at)
+ || uid > gimple_uid (cand->incremented_at))
+ continue;
+ if (closest == NULL || uid > gimple_uid (closest->stmt))
+ closest = use;
+ }
+ if (closest == NULL || !autoinc_possible_for_pair (data, closest, cand))
+ continue;
+ cand->ainc_use = closest;
+ }
+}
+
+/* Finds the candidates for the induction variables. */
+
+static void
+find_iv_candidates (struct ivopts_data *data)
+{
+ /* Add commonly used ivs. */
+ add_standard_iv_candidates (data);
+
+ /* Add old induction variables. */
+ add_old_ivs_candidates (data);
+
+ /* Add induction variables derived from uses. */
+ add_derived_ivs_candidates (data);
+
+ set_autoinc_for_original_candidates (data);
+
+ /* Record the important candidates. */
+ record_important_candidates (data);
+}
+
/* Determines costs of basing the use of the iv on an iv candidate. */
static void
@@ -4106,6 +4306,7 @@ determine_iv_cost (struct ivopts_data *data, struct iv_cand *cand)
cost++;
cand->cost = cost;
+ cand->cost_step = cost_step;
}
/* Determines costs of computation of the candidates. */
@@ -4130,7 +4331,7 @@ determine_iv_costs (struct ivopts_data *data)
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " %d\t%d\n", i, cand->cost);
}
-
+
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n");
}
@@ -5052,6 +5253,13 @@ create_new_iv (struct ivopts_data *data, struct iv_cand *cand)
after = true;
break;
+ case IP_AFTER_USE:
+ after = true;
+ /* fall through */
+ case IP_BEFORE_USE:
+ incr_pos = gsi_for_stmt (cand->incremented_at);
+ break;
+
case IP_ORIGINAL:
/* Mark that the iv is preserved. */
name_info (data, cand->var_before)->preserve_biv = true;
@@ -5530,6 +5738,7 @@ tree_ssa_iv_optimize_loop (struct ivopts_data *data, struct loop *loop)
bool changed = false;
struct iv_ca *iv_ca;
edge exit;
+ basic_block *body;
gcc_assert (!data->niters);
data->current_loop = loop;
@@ -5551,6 +5760,10 @@ tree_ssa_iv_optimize_loop (struct ivopts_data *data, struct loop *loop)
fprintf (dump_file, "\n");
}
+ body = get_loop_body (loop);
+ renumber_gimple_stmt_uids_in_blocks (body, loop->num_nodes);
+ free (body);
+
/* For each ssa name determines whether it behaves as an induction variable
in some loop. */
if (!find_induction_variables (data))
@@ -5565,8 +5778,8 @@ tree_ssa_iv_optimize_loop (struct ivopts_data *data, struct loop *loop)
find_iv_candidates (data);
/* Calculates the costs (item 3, part 1). */
- determine_use_iv_costs (data);
determine_iv_costs (data);
+ determine_use_iv_costs (data);
determine_set_costs (data);
/* Find the optimal set of induction variables (item 3, part 2). */
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 2312211d9b3..bc5c3392a0f 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-scalar-evolution.h"
#include "params.h"
#include "tree-inline.h"
+#include "langhooks.h"
/* Creates an induction variable with value BASE + STEP * iteration in LOOP.
It is expected that neither BASE nor STEP are shared with other expressions
@@ -124,8 +125,8 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
stmt = create_phi_node (vb, loop->header);
SSA_NAME_DEF_STMT (vb) = stmt;
- add_phi_arg (stmt, initial, loop_preheader_edge (loop));
- add_phi_arg (stmt, va, loop_latch_edge (loop));
+ add_phi_arg (stmt, initial, loop_preheader_edge (loop), UNKNOWN_LOCATION);
+ add_phi_arg (stmt, va, loop_latch_edge (loop), UNKNOWN_LOCATION);
}
/* Add exit phis for the USE on EXIT. */
@@ -155,7 +156,7 @@ add_exit_phis_edge (basic_block exit, tree use)
create_new_def_for (gimple_phi_result (phi), phi,
gimple_phi_result_ptr (phi));
FOR_EACH_EDGE (e, ei, exit->preds)
- add_phi_arg (phi, use, e);
+ add_phi_arg (phi, use, e, UNKNOWN_LOCATION);
}
/* Add exit phis for VAR that is used in LIVEIN.
@@ -481,11 +482,13 @@ split_loop_exit_edge (edge exit)
tree new_name, name;
use_operand_p op_p;
gimple_stmt_iterator psi;
+ source_location locus;
for (psi = gsi_start_phis (dest); !gsi_end_p (psi); gsi_next (&psi))
{
phi = gsi_stmt (psi);
op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, single_succ_edge (bb));
+ locus = gimple_phi_arg_location_from_edge (phi, single_succ_edge (bb));
name = USE_FROM_PTR (op_p);
@@ -499,7 +502,7 @@ split_loop_exit_edge (edge exit)
new_name = duplicate_ssa_name (name, NULL);
new_phi = create_phi_node (new_name, bb);
SSA_NAME_DEF_STMT (new_name) = new_phi;
- add_phi_arg (new_phi, name, exit);
+ add_phi_arg (new_phi, name, exit, locus);
SET_USE (op_p, new_name);
}
@@ -1019,8 +1022,8 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
phi_rest = create_phi_node (new_init, rest);
SSA_NAME_DEF_STMT (new_init) = phi_rest;
- add_phi_arg (phi_rest, init, precond_edge);
- add_phi_arg (phi_rest, next, new_exit);
+ add_phi_arg (phi_rest, init, precond_edge, UNKNOWN_LOCATION);
+ add_phi_arg (phi_rest, next, new_exit, UNKNOWN_LOCATION);
SET_USE (op, new_init);
}
@@ -1106,3 +1109,132 @@ tree_unroll_loop (struct loop *loop, unsigned factor,
tree_transform_and_unroll_loop (loop, factor, exit, desc,
NULL, NULL);
}
+
+/* Rewrite the phi node at position PSI in function of the main
+ induction variable MAIN_IV and insert the generated code at GSI. */
+
+static void
+rewrite_phi_with_iv (loop_p loop,
+ gimple_stmt_iterator *psi,
+ gimple_stmt_iterator *gsi,
+ tree main_iv)
+{
+ affine_iv iv;
+ gimple stmt, phi = gsi_stmt (*psi);
+ tree atype, mtype, val, res = PHI_RESULT (phi);
+
+ if (!is_gimple_reg (res) || res == main_iv)
+ {
+ gsi_next (psi);
+ return;
+ }
+
+ if (!simple_iv (loop, loop, res, &iv, true))
+ {
+ gsi_next (psi);
+ return;
+ }
+
+ remove_phi_node (psi, false);
+
+ atype = TREE_TYPE (res);
+ mtype = POINTER_TYPE_P (atype) ? sizetype : atype;
+ val = fold_build2 (MULT_EXPR, mtype, unshare_expr (iv.step),
+ fold_convert (mtype, main_iv));
+ val = fold_build2 (POINTER_TYPE_P (atype)
+ ? POINTER_PLUS_EXPR : PLUS_EXPR,
+ atype, unshare_expr (iv.base), val);
+ val = force_gimple_operand_gsi (gsi, val, false, NULL_TREE, true,
+ GSI_SAME_STMT);
+ stmt = gimple_build_assign (res, val);
+ gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
+ SSA_NAME_DEF_STMT (res) = stmt;
+}
+
+/* Rewrite all the phi nodes of LOOP in function of the main induction
+ variable MAIN_IV. */
+
+static void
+rewrite_all_phi_nodes_with_iv (loop_p loop, tree main_iv)
+{
+ unsigned i;
+ basic_block *bbs = get_loop_body_in_dom_order (loop);
+ gimple_stmt_iterator psi;
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ basic_block bb = bbs[i];
+ gimple_stmt_iterator gsi = gsi_after_labels (bb);
+
+ if (bb->loop_father != loop)
+ continue;
+
+ for (psi = gsi_start_phis (bb); !gsi_end_p (psi); )
+ rewrite_phi_with_iv (loop, &psi, &gsi, main_iv);
+ }
+
+ free (bbs);
+}
+
+/* Bases all the induction variables in LOOP on a single induction
+ variable (unsigned with base 0 and step 1), whose final value is
+ compared with *NIT. When the IV type precision has to be larger
+ than *NIT type precision, *NIT is converted to the larger type, the
+ conversion code is inserted before the loop, and *NIT is updated to
+ the new definition. The induction variable is incremented in the
+ loop latch. Return the induction variable that was created. */
+
+tree
+canonicalize_loop_ivs (struct loop *loop, tree *nit)
+{
+ unsigned precision = TYPE_PRECISION (TREE_TYPE (*nit));
+ unsigned original_precision = precision;
+ tree type, var_before;
+ gimple_stmt_iterator gsi, psi;
+ gimple stmt;
+ edge exit = single_dom_exit (loop);
+ gimple_seq stmts;
+
+ for (psi = gsi_start_phis (loop->header);
+ !gsi_end_p (psi); gsi_next (&psi))
+ {
+ gimple phi = gsi_stmt (psi);
+ tree res = PHI_RESULT (phi);
+
+ if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
+ precision = TYPE_PRECISION (TREE_TYPE (res));
+ }
+
+ type = lang_hooks.types.type_for_size (precision, 1);
+
+ if (original_precision != precision)
+ {
+ *nit = fold_convert (type, *nit);
+ *nit = force_gimple_operand (*nit, &stmts, true, NULL_TREE);
+ if (stmts)
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ }
+
+ gsi = gsi_last_bb (loop->latch);
+ create_iv (build_int_cst_type (type, 0), build_int_cst (type, 1), NULL_TREE,
+ loop, &gsi, true, &var_before, NULL);
+
+ rewrite_all_phi_nodes_with_iv (loop, var_before);
+
+ stmt = last_stmt (exit->src);
+ /* Make the loop exit if the control condition is not satisfied. */
+ if (exit->flags & EDGE_TRUE_VALUE)
+ {
+ edge te, fe;
+
+ extract_true_false_edges_from_block (exit->src, &te, &fe);
+ te->flags = EDGE_FALSE_VALUE;
+ fe->flags = EDGE_TRUE_VALUE;
+ }
+ gimple_cond_set_code (stmt, LT_EXPR);
+ gimple_cond_set_lhs (stmt, var_before);
+ gimple_cond_set_rhs (stmt, *nit);
+ update_stmt (stmt);
+
+ return var_before;
+}
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index b4797076768..60f5a2f9b0d 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -593,6 +593,45 @@ ddown (HOST_WIDE_INT x, unsigned HOST_WIDE_INT by)
return (x + by - 1) / by;
}
+/* Given a CACHE_LINE_SIZE and two inductive memory references
+ with a common STEP greater than CACHE_LINE_SIZE and an address
+ difference DELTA, compute the probability that they will fall
+ in different cache lines. DISTINCT_ITERS is the number of
+ distinct iterations after which the pattern repeats itself.
+ ALIGN_UNIT is the unit of alignment in bytes. */
+
+static int
+compute_miss_rate (unsigned HOST_WIDE_INT cache_line_size,
+ HOST_WIDE_INT step, HOST_WIDE_INT delta,
+ unsigned HOST_WIDE_INT distinct_iters,
+ int align_unit)
+{
+ unsigned align, iter;
+ int total_positions, miss_positions, miss_rate;
+ int address1, address2, cache_line1, cache_line2;
+
+ total_positions = 0;
+ miss_positions = 0;
+
+ /* Iterate through all possible alignments of the first
+ memory reference within its cache line. */
+ for (align = 0; align < cache_line_size; align += align_unit)
+
+ /* Iterate through all distinct iterations. */
+ for (iter = 0; iter < distinct_iters; iter++)
+ {
+ address1 = align + step * iter;
+ address2 = address1 + delta;
+ cache_line1 = address1 / cache_line_size;
+ cache_line2 = address2 / cache_line_size;
+ total_positions += 1;
+ if (cache_line1 != cache_line2)
+ miss_positions += 1;
+ }
+ miss_rate = 1000 * miss_positions / total_positions;
+ return miss_rate;
+}
+
/* Prune the prefetch candidate REF using the reuse with BY.
If BY_IS_BEFORE is true, BY is before REF in the loop. */
@@ -606,6 +645,11 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by,
HOST_WIDE_INT delta = delta_b - delta_r;
HOST_WIDE_INT hit_from;
unsigned HOST_WIDE_INT prefetch_before, prefetch_block;
+ int miss_rate;
+ HOST_WIDE_INT reduced_step;
+ unsigned HOST_WIDE_INT reduced_prefetch_block;
+ tree ref_type;
+ int align_unit;
if (delta == 0)
{
@@ -667,25 +711,29 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by,
return;
}
- /* A more complicated case. First let us ensure that size of cache line
- and step are coprime (here we assume that PREFETCH_BLOCK is a power
- of two. */
+ /* A more complicated case with step > prefetch_block. First reduce
+ the ratio between the step and the cache line size to its simplest
+ terms. The resulting denominator will then represent the number of
+ distinct iterations after which each address will go back to its
+ initial location within the cache line. This computation assumes
+ that PREFETCH_BLOCK is a power of two. */
prefetch_block = PREFETCH_BLOCK;
- while ((step & 1) == 0
- && prefetch_block > 1)
+ reduced_prefetch_block = prefetch_block;
+ reduced_step = step;
+ while ((reduced_step & 1) == 0
+ && reduced_prefetch_block > 1)
{
- step >>= 1;
- prefetch_block >>= 1;
- delta >>= 1;
+ reduced_step >>= 1;
+ reduced_prefetch_block >>= 1;
}
- /* Now step > prefetch_block, and step and prefetch_block are coprime.
- Determine the probability that the accesses hit the same cache line. */
-
prefetch_before = delta / step;
delta %= step;
- if ((unsigned HOST_WIDE_INT) delta
- <= (prefetch_block * ACCEPTABLE_MISS_RATE / 1000))
+ ref_type = TREE_TYPE (ref->mem);
+ align_unit = TYPE_ALIGN (ref_type) / 8;
+ miss_rate = compute_miss_rate(prefetch_block, step, delta,
+ reduced_prefetch_block, align_unit);
+ if (miss_rate <= ACCEPTABLE_MISS_RATE)
{
if (prefetch_before < ref->prefetch_before)
ref->prefetch_before = prefetch_before;
@@ -696,8 +744,9 @@ prune_ref_by_group_reuse (struct mem_ref *ref, struct mem_ref *by,
/* Try also the following iteration. */
prefetch_before++;
delta = step - delta;
- if ((unsigned HOST_WIDE_INT) delta
- <= (prefetch_block * ACCEPTABLE_MISS_RATE / 1000))
+ miss_rate = compute_miss_rate(prefetch_block, step, delta,
+ reduced_prefetch_block, align_unit);
+ if (miss_rate <= ACCEPTABLE_MISS_RATE)
{
if (prefetch_before < ref->prefetch_before)
ref->prefetch_before = prefetch_before;
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 0aab6d3a2d3..8f7047f8309 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "tree-inline.h"
#include "tree-scalar-evolution.h"
+#include "toplev.h"
#include "tree-vectorizer.h"
/* The loop superpass. */
@@ -307,9 +308,12 @@ gate_graphite_transforms (void)
/* Enable -fgraphite pass if any one of the graphite optimization flags
is turned on. */
if (flag_loop_block || flag_loop_interchange || flag_loop_strip_mine
- || flag_graphite_identity)
+ || flag_graphite_identity || flag_loop_parallelize_all)
flag_graphite = 1;
+ if (flag_loop_block)
+ sorry ("loop blocking not implemented");
+
return flag_graphite != 0;
}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 888b06d32f6..b809ab30f8d 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -518,6 +518,8 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
if (!useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (new_var)))
{
+ source_location locus_0, locus_1;
+
new_var2 = create_tmp_var (TREE_TYPE (result), NULL);
add_referenced_var (new_var2);
new_stmt = gimple_build_assign_with_ops (CONVERT_EXPR, new_var2,
@@ -526,6 +528,13 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
gimple_assign_set_lhs (new_stmt, new_var2);
gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
new_var = new_var2;
+
+ /* Set the locus to the first argument, unless is doesn't have one. */
+ locus_0 = gimple_phi_arg_location (phi, 0);
+ locus_1 = gimple_phi_arg_location (phi, 1);
+ if (locus_0 == UNKNOWN_LOCATION)
+ locus_0 = locus_1;
+ gimple_set_location (new_stmt, locus_0);
}
replace_phi_edge_with_variable (cond_bb, e1, phi, new_var);
@@ -1182,6 +1191,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
tree lhs, rhs, name;
gimple newphi, new_stmt;
gimple_stmt_iterator gsi;
+ source_location locus;
enum tree_code code;
/* Check if middle_bb contains of only one store. */
@@ -1189,6 +1199,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
|| gimple_code (assign) != GIMPLE_ASSIGN)
return false;
+ locus = gimple_location (assign);
lhs = gimple_assign_lhs (assign);
rhs = gimple_assign_rhs1 (assign);
if (!INDIRECT_REF_P (lhs))
@@ -1229,6 +1240,7 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
new_stmt = gimple_build_assign (condstoretemp, lhs);
name = make_ssa_name (condstoretemp, new_stmt);
gimple_assign_set_lhs (new_stmt, name);
+ gimple_set_location (new_stmt, locus);
mark_symbols_for_renaming (new_stmt);
gsi_insert_on_edge (e1, new_stmt);
@@ -1236,8 +1248,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
holding the old RHS, and the other holding the temporary
where we stored the old memory contents. */
newphi = create_phi_node (condstoretemp, join_bb);
- add_phi_arg (newphi, rhs, e0);
- add_phi_arg (newphi, name, e1);
+ add_phi_arg (newphi, rhs, e0, locus);
+ add_phi_arg (newphi, name, e1, locus);
lhs = unshare_expr (lhs);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 022e4af9a48..bac2303899f 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -159,14 +159,17 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
{
tree old_arg, new_var;
gimple tmp;
+ source_location locus;
old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
+ locus = gimple_phi_arg_location_from_edge (phi, e);
while (TREE_CODE (old_arg) == SSA_NAME
&& (SSA_NAME_VERSION (old_arg) >= n
|| phivn[SSA_NAME_VERSION (old_arg)].value == NULL_TREE))
{
gimple def_stmt = SSA_NAME_DEF_STMT (old_arg);
old_arg = gimple_assign_rhs1 (def_stmt);
+ locus = gimple_location (def_stmt);
}
if (TREE_CODE (old_arg) == SSA_NAME)
@@ -196,6 +199,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
add_referenced_var (new_var);
new_var = make_ssa_name (new_var, tmp);
gimple_assign_set_lhs (tmp, new_var);
+ gimple_set_location (tmp, locus);
gsi_insert_on_edge (e, tmp);
update_stmt (tmp);
@@ -209,7 +213,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
}
}
- add_phi_arg (new_phi, new_var, e);
+ add_phi_arg (new_phi, new_var, e, locus);
}
update_stmt (new_phi);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 9e3754b37fc..7a0533e4301 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1600,6 +1600,9 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
else if (!opresult)
break;
}
+ /* We can't possibly insert these. */
+ else if (op1 && !is_gimple_min_invariant (op1))
+ break;
changed |= op1 != oldop1;
if (op2 && TREE_CODE (op2) == SSA_NAME)
{
@@ -1617,6 +1620,9 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
else if (!opresult)
break;
}
+ /* We can't possibly insert these. */
+ else if (op2 && !is_gimple_min_invariant (op2))
+ break;
changed |= op2 != oldop2;
if (!newoperands)
@@ -2742,7 +2748,8 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
pre_expr op1expr;
tree genop2 = currop->op1;
pre_expr op2expr;
- tree genop3;
+ tree genop3 = currop->op2;
+ pre_expr op3expr;
genop0 = create_component_ref_by_pieces_1 (block, ref, operand,
stmts, domstmt);
if (!genop0)
@@ -2759,8 +2766,17 @@ create_component_ref_by_pieces_1 (basic_block block, vn_reference_t ref,
if (!genop2)
return NULL_TREE;
}
-
- genop3 = currop->op2;
+ if (genop3)
+ {
+ tree elmt_type = TREE_TYPE (TREE_TYPE (genop0));
+ genop3 = size_binop (EXACT_DIV_EXPR, genop3,
+ size_int (TYPE_ALIGN_UNIT (elmt_type)));
+ op3expr = get_or_alloc_expr_for (genop3);
+ genop3 = find_or_generate_expression (block, op3expr, stmts,
+ domstmt);
+ if (!genop3)
+ return NULL_TREE;
+ }
return build4 (currop->opcode, currop->type, genop0, genop1,
genop2, genop3);
}
@@ -3328,9 +3344,10 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
gcc_assert (get_expr_type (ae) == type
|| useless_type_conversion_p (type, get_expr_type (ae)));
if (ae->kind == CONSTANT)
- add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred);
+ add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred, UNKNOWN_LOCATION);
else
- add_phi_arg (phi, PRE_EXPR_NAME (avail[pred->src->index]), pred);
+ add_phi_arg (phi, PRE_EXPR_NAME (avail[pred->src->index]), pred,
+ UNKNOWN_LOCATION);
}
newphi = get_or_alloc_expr_for_name (gimple_phi_result (phi));
@@ -4216,7 +4233,12 @@ eliminate (void)
gimple_call_set_fn (stmt, fn);
update_stmt (stmt);
if (maybe_clean_or_replace_eh_stmt (stmt, stmt))
- gimple_purge_dead_eh_edges (b);
+ {
+ bitmap_set_bit (need_eh_cleanup,
+ gimple_bb (stmt)->index);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, " Removed EH side effects.\n");
+ }
/* Changing an indirect call to a direct call may
have exposed different semantics. This may
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 8557b0b07c9..3d814fc2e0b 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -561,18 +561,9 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
case ARRAY_REF:
/* Record index as operand. */
temp.op0 = TREE_OPERAND (ref, 1);
- /* Record even constant lower bounds. */
- if (TREE_OPERAND (ref, 2))
- temp.op1 = TREE_OPERAND (ref, 2);
- else
- {
- tree domain = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (ref, 0)));
- if (domain
- && TYPE_MIN_VALUE (domain)
- && !integer_zerop (TYPE_MIN_VALUE (domain)))
- temp.op1 = TYPE_MIN_VALUE (domain);
- }
- temp.op2 = TREE_OPERAND (ref, 3);
+ /* Always record lower bounds and element size. */
+ temp.op1 = array_ref_low_bound (ref);
+ temp.op2 = array_ref_element_size (ref);
break;
case STRING_CST:
case INTEGER_CST:
@@ -731,19 +722,17 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
case ARRAY_RANGE_REF:
case ARRAY_REF:
- /* Same for ARRAY_REFs. We do not have access to the array
- type here, but we recorded the lower bound in op1. */
- if (op->op2
- || !host_integerp (op->op0, 0)
- || (op->op1 && !host_integerp (op->op1, 0))
- || !host_integerp (TYPE_SIZE (op->type), 1))
+ /* We recorded the lower bound and the element size. */
+ if (!host_integerp (op->op0, 0)
+ || !host_integerp (op->op1, 0)
+ || !host_integerp (op->op2, 0))
max_size = -1;
else
{
HOST_WIDE_INT hindex = TREE_INT_CST_LOW (op->op0);
- if (op->op1)
- hindex -= TREE_INT_CST_LOW (op->op1);
- hindex *= TREE_INT_CST_LOW (TYPE_SIZE (op->type));
+ hindex -= TREE_INT_CST_LOW (op->op1);
+ hindex *= TREE_INT_CST_LOW (op->op2);
+ hindex *= BITS_PER_UNIT;
offset += hindex;
}
break;
@@ -863,8 +852,8 @@ vn_reference_fold_indirect (VEC (vn_reference_op_s, heap) **ops,
if ((dom = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (op->op0, 0))))
&& TYPE_MIN_VALUE (dom))
aref.op0 = TYPE_MIN_VALUE (dom);
- aref.op1 = NULL_TREE;
- aref.op2 = NULL_TREE;
+ aref.op1 = aref.op0;
+ aref.op2 = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (op->op0)));
VEC_safe_push (vn_reference_op_s, heap, mem, &aref);
}
copy_reference_ops_from_ref (TREE_OPERAND (op->op0, 0), &mem);
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index a9eef0bc1ec..50ef0b660f9 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -290,18 +290,39 @@ enum { nothing_id = 0, anything_id = 1, readonly_id = 2,
escaped_id = 3, nonlocal_id = 4, callused_id = 5,
storedanything_id = 6, integer_id = 7 };
+struct GTY(()) heapvar_map {
+ struct tree_map map;
+ unsigned HOST_WIDE_INT offset;
+};
+
+static int
+heapvar_map_eq (const void *p1, const void *p2)
+{
+ const struct heapvar_map *h1 = (const struct heapvar_map *)p1;
+ const struct heapvar_map *h2 = (const struct heapvar_map *)p2;
+ return (h1->map.base.from == h2->map.base.from
+ && h1->offset == h2->offset);
+}
+
+static unsigned int
+heapvar_map_hash (struct heapvar_map *h)
+{
+ return iterative_hash_host_wide_int (h->offset,
+ htab_hash_pointer (h->map.base.from));
+}
+
/* Lookup a heap var for FROM, and return it if we find one. */
static tree
-heapvar_lookup (tree from)
+heapvar_lookup (tree from, unsigned HOST_WIDE_INT offset)
{
- struct tree_map *h, in;
- in.base.from = from;
-
- h = (struct tree_map *) htab_find_with_hash (heapvar_for_stmt, &in,
- htab_hash_pointer (from));
+ struct heapvar_map *h, in;
+ in.map.base.from = from;
+ in.offset = offset;
+ h = (struct heapvar_map *) htab_find_with_hash (heapvar_for_stmt, &in,
+ heapvar_map_hash (&in));
if (h)
- return h->to;
+ return h->map.to;
return NULL_TREE;
}
@@ -309,17 +330,19 @@ heapvar_lookup (tree from)
hashtable. */
static void
-heapvar_insert (tree from, tree to)
+heapvar_insert (tree from, unsigned HOST_WIDE_INT offset, tree to)
{
- struct tree_map *h;
+ struct heapvar_map *h;
void **loc;
- h = GGC_NEW (struct tree_map);
- h->hash = htab_hash_pointer (from);
- h->base.from = from;
- h->to = to;
- loc = htab_find_slot_with_hash (heapvar_for_stmt, h, h->hash, INSERT);
- *(struct tree_map **) loc = h;
+ h = GGC_NEW (struct heapvar_map);
+ h->map.base.from = from;
+ h->offset = offset;
+ h->map.hash = heapvar_map_hash (h);
+ h->map.to = to;
+ loc = htab_find_slot_with_hash (heapvar_for_stmt, h, h->map.hash, INSERT);
+ gcc_assert (*loc == NULL);
+ *(struct heapvar_map **) loc = h;
}
/* Return a new variable info structure consisting for a variable
@@ -3365,7 +3388,7 @@ static varinfo_t
make_constraint_from_heapvar (varinfo_t lhs, const char *name)
{
varinfo_t vi;
- tree heapvar = heapvar_lookup (lhs->decl);
+ tree heapvar = heapvar_lookup (lhs->decl, lhs->offset);
if (heapvar == NULL_TREE)
{
@@ -3373,7 +3396,7 @@ make_constraint_from_heapvar (varinfo_t lhs, const char *name)
heapvar = create_tmp_var_raw (ptr_type_node, name);
DECL_EXTERNAL (heapvar) = 1;
- heapvar_insert (lhs->decl, heapvar);
+ heapvar_insert (lhs->decl, lhs->offset, heapvar);
ann = get_var_ann (heapvar);
ann->is_heapvar = 1;
@@ -5363,7 +5386,7 @@ static void
init_alias_heapvars (void)
{
if (!heapvar_for_stmt)
- heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, tree_map_eq,
+ heapvar_for_stmt = htab_create_ggc (11, tree_map_hash, heapvar_map_eq,
NULL);
}
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 04df5378f5a..62524bb1460 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -325,9 +325,11 @@ create_edge_and_update_destination_phis (struct redirection_data *rd)
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
-
+ source_location locus;
int indx = rd->outgoing_edge->dest_idx;
- add_phi_arg (phi, gimple_phi_arg_def (phi, indx), e);
+
+ locus = gimple_phi_arg_location (phi, indx);
+ add_phi_arg (phi, gimple_phi_arg_def (phi, indx), e, locus);
}
}
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 67db22f987f..0ff5e0e6800 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "rtl.h"
#include "tm_p.h"
+#include "target.h"
#include "ggc.h"
#include "langhooks.h"
#include "hard-reg-set.h"
@@ -53,7 +54,7 @@ static struct pointer_map_t *edge_var_maps;
/* Add a mapping with PHI RESULT and PHI DEF associated with edge E. */
void
-redirect_edge_var_map_add (edge e, tree result, tree def)
+redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus)
{
void **slot;
edge_var_map_vector old_head, head;
@@ -71,6 +72,7 @@ redirect_edge_var_map_add (edge e, tree result, tree def)
}
new_node.def = def;
new_node.result = result;
+ new_node.locus = locus;
VEC_safe_push (edge_var_map, heap, head, &new_node);
if (old_head != head)
@@ -193,14 +195,16 @@ ssa_redirect_edge (edge e, basic_block dest)
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree def;
+ source_location locus ;
phi = gsi_stmt (gsi);
def = gimple_phi_arg_def (phi, e->dest_idx);
+ locus = gimple_phi_arg_location (phi, e->dest_idx);
if (def == NULL_TREE)
continue;
- redirect_edge_var_map_add (e, gimple_phi_result (phi), def);
+ redirect_edge_var_map_add (e, gimple_phi_result (phi), def, locus);
}
e = redirect_edge_succ_nodup (e, dest);
@@ -233,7 +237,7 @@ flush_pending_stmts (edge e)
phi = gsi_stmt (gsi);
def = redirect_edge_var_map_def (vm);
- add_phi_arg (phi, def, e);
+ add_phi_arg (phi, def, e, redirect_edge_var_map_location (vm));
}
redirect_edge_var_map_clear (e);
@@ -1050,15 +1054,46 @@ delete_tree_ssa (void)
redirect_edge_var_map_destroy ();
}
-/* Helper function for useless_type_conversion_p. */
+/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
+ useless type conversion, otherwise return false.
-static bool
-useless_type_conversion_p_1 (tree outer_type, tree inner_type)
+ This function implicitly defines the middle-end type system. With
+ the notion of 'a < b' meaning that useless_type_conversion_p (a, b)
+ holds and 'a > b' meaning that useless_type_conversion_p (b, a) holds,
+ the following invariants shall be fulfilled:
+
+ 1) useless_type_conversion_p is transitive.
+ If a < b and b < c then a < c.
+
+ 2) useless_type_conversion_p is not symmetric.
+ From a < b does not follow a > b.
+
+ 3) Types define the available set of operations applicable to values.
+ A type conversion is useless if the operations for the target type
+ is a subset of the operations for the source type. For example
+ casts to void* are useless, casts from void* are not (void* can't
+ be dereferenced or offsetted, but copied, hence its set of operations
+ is a strict subset of that of all other data pointer types). Casts
+ to const T* are useless (can't be written to), casts from const T*
+ to T* are not. */
+
+bool
+useless_type_conversion_p (tree outer_type, tree inner_type)
{
/* Do the following before stripping toplevel qualifiers. */
if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
{
+ /* If the outer type is (void *) or a pointer to an incomplete
+ record type, then the conversion is not necessary. */
+ if (VOID_TYPE_P (TREE_TYPE (outer_type))
+ || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type))
+ && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE
+ && (TREE_CODE (TREE_TYPE (outer_type))
+ == TREE_CODE (TREE_TYPE (inner_type)))
+ && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))))
+ return true;
+
/* Do not lose casts to restrict qualified pointers. */
if ((TYPE_RESTRICT (outer_type)
!= TYPE_RESTRICT (inner_type))
@@ -1078,8 +1113,10 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
&& TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type))
return true;
- /* Changes in machine mode are never useless conversions. */
- if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type))
+ /* Changes in machine mode are never useless conversions unless we
+ deal with aggregate types in which case we defer to later checks. */
+ if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type)
+ && !AGGREGATE_TYPE_P (inner_type))
return false;
/* If both the inner and outer types are integral types, then the
@@ -1104,6 +1141,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
&& SCALAR_FLOAT_TYPE_P (outer_type))
return true;
+ /* Fixed point types with the same mode are compatible. */
+ else if (FIXED_POINT_TYPE_P (inner_type)
+ && FIXED_POINT_TYPE_P (outer_type))
+ return true;
+
/* We need to take special care recursing to pointed-to types. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
@@ -1121,6 +1163,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
&& TYPE_VOLATILE (TREE_TYPE (outer_type)))
return false;
+ /* We require explicit conversions from incomplete target types. */
+ if (!COMPLETE_TYPE_P (TREE_TYPE (inner_type))
+ && COMPLETE_TYPE_P (TREE_TYPE (outer_type)))
+ return false;
+
/* 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))
@@ -1132,9 +1179,12 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
/* Otherwise pointers/references are equivalent if their pointed
to types are effectively the same. We can strip qualifiers
on pointed-to types for further comparison, which is done in
- the callee. */
- return useless_type_conversion_p_1 (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
+ the callee. Note we have to use true compatibility here
+ because addresses are subject to propagation into dereferences
+ and thus might get the original type exposed which is equivalent
+ to a reverse conversion. */
+ return types_compatible_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
}
/* Recurse for complex types. */
@@ -1150,72 +1200,126 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
return useless_type_conversion_p (TREE_TYPE (outer_type),
TREE_TYPE (inner_type));
- /* For aggregates we may need to fall back to structural equality
- checks. */
- else if (AGGREGATE_TYPE_P (inner_type)
- && AGGREGATE_TYPE_P (outer_type))
+ else if (TREE_CODE (inner_type) == ARRAY_TYPE
+ && TREE_CODE (outer_type) == ARRAY_TYPE)
{
- /* Different types of aggregates are incompatible. */
- if (TREE_CODE (inner_type) != TREE_CODE (outer_type))
+ /* Preserve string attributes. */
+ if (TYPE_STRING_FLAG (inner_type) != TYPE_STRING_FLAG (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)
+ if (!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. */
+ /* Nor are conversions from array types with non-constant size to
+ array types with constant size or to different size. */
+ if (TYPE_SIZE (outer_type)
+ && TREE_CODE (TYPE_SIZE (outer_type)) == INTEGER_CST
+ && (!TYPE_SIZE (inner_type)
+ || TREE_CODE (TYPE_SIZE (inner_type)) != INTEGER_CST
+ || !tree_int_cst_equal (TYPE_SIZE (outer_type),
+ TYPE_SIZE (inner_type))))
+ return false;
- /* ??? This should eventually just return false. */
- return lang_hooks.types_compatible_p (inner_type, outer_type);
+ /* Check conversions between arrays with partially known extents.
+ If the array min/max values are constant they have to match.
+ Otherwise allow conversions to unknown and variable extents.
+ In particular this declares conversions that may change the
+ mode to BLKmode as useless. */
+ if (TYPE_DOMAIN (inner_type)
+ && TYPE_DOMAIN (outer_type)
+ && TYPE_DOMAIN (inner_type) != TYPE_DOMAIN (outer_type))
+ {
+ tree inner_min = TYPE_MIN_VALUE (TYPE_DOMAIN (inner_type));
+ tree outer_min = TYPE_MIN_VALUE (TYPE_DOMAIN (outer_type));
+ tree inner_max = TYPE_MAX_VALUE (TYPE_DOMAIN (inner_type));
+ tree outer_max = TYPE_MAX_VALUE (TYPE_DOMAIN (outer_type));
+
+ /* After gimplification a variable min/max value carries no
+ additional information compared to a NULL value. All that
+ matters has been lowered to be part of the IL. */
+ if (inner_min && TREE_CODE (inner_min) != INTEGER_CST)
+ inner_min = NULL_TREE;
+ if (outer_min && TREE_CODE (outer_min) != INTEGER_CST)
+ outer_min = NULL_TREE;
+ if (inner_max && TREE_CODE (inner_max) != INTEGER_CST)
+ inner_max = NULL_TREE;
+ if (outer_max && TREE_CODE (outer_max) != INTEGER_CST)
+ outer_max = NULL_TREE;
+
+ /* Conversions NULL / variable <- cst are useless, but not
+ the other way around. */
+ if (outer_min
+ && (!inner_min
+ || !tree_int_cst_equal (inner_min, outer_min)))
+ return false;
+ if (outer_max
+ && (!inner_max
+ || !tree_int_cst_equal (inner_max, outer_max)))
+ return false;
+ }
+
+ /* Recurse on the element check. */
+ return useless_type_conversion_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
}
- /* Also for functions and possibly other types with
- TYPE_STRUCTURAL_EQUALITY_P set. */
- else if (TYPE_STRUCTURAL_EQUALITY_P (inner_type)
- && TYPE_STRUCTURAL_EQUALITY_P (outer_type))
- return lang_hooks.types_compatible_p (inner_type, outer_type);
-
- return false;
-}
-/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
- useless type conversion, otherwise return false.
+ else if ((TREE_CODE (inner_type) == FUNCTION_TYPE
+ || TREE_CODE (inner_type) == METHOD_TYPE)
+ && TREE_CODE (inner_type) == TREE_CODE (outer_type))
+ {
+ tree outer_parm, inner_parm;
- This function implicitly defines the middle-end type system. With
- the notion of 'a < b' meaning that useless_type_conversion_p (a, b)
- holds and 'a > b' meaning that useless_type_conversion_p (b, a) holds,
- the following invariants shall be fulfilled:
+ /* If the return types are not compatible bail out. */
+ if (!useless_type_conversion_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type)))
+ return false;
- 1) useless_type_conversion_p is transitive.
- If a < b and b < c then a < c.
+ /* Method types should belong to a compatible base class. */
+ if (TREE_CODE (inner_type) == METHOD_TYPE
+ && !useless_type_conversion_p (TYPE_METHOD_BASETYPE (outer_type),
+ TYPE_METHOD_BASETYPE (inner_type)))
+ return false;
- 2) useless_type_conversion_p is not symmetric.
- From a < b does not follow a > b.
+ /* A conversion to an unprototyped argument list is ok. */
+ if (!TYPE_ARG_TYPES (outer_type))
+ return true;
+
+ /* If the argument types are compatible the conversion is useless. */
+ if (TYPE_ARG_TYPES (outer_type) == TYPE_ARG_TYPES (inner_type))
+ return true;
+
+ for (outer_parm = TYPE_ARG_TYPES (outer_type),
+ inner_parm = TYPE_ARG_TYPES (inner_type);
+ outer_parm && inner_parm;
+ outer_parm = TREE_CHAIN (outer_parm),
+ inner_parm = TREE_CHAIN (inner_parm))
+ if (!useless_type_conversion_p (TREE_VALUE (outer_parm),
+ TREE_VALUE (inner_parm)))
+ return false;
+
+ /* If there is a mismatch in the number of arguments the functions
+ are not compatible. */
+ if (outer_parm || inner_parm)
+ return false;
- 3) Types define the available set of operations applicable to values.
- A type conversion is useless if the operations for the target type
- is a subset of the operations for the source type. For example
- casts to void* are useless, casts from void* are not (void* can't
- be dereferenced or offsetted, but copied, hence its set of operations
- is a strict subset of that of all other data pointer types). Casts
- to const T* are useless (can't be written to), casts from const T*
- to T* are not. */
+ /* Defer to the target if necessary. */
+ if (TYPE_ATTRIBUTES (inner_type) || TYPE_ATTRIBUTES (outer_type))
+ return targetm.comp_type_attributes (outer_type, inner_type) != 0;
-bool
-useless_type_conversion_p (tree outer_type, tree inner_type)
-{
- /* If the outer type is (void *), then the conversion is not
- necessary. We have to make sure to not apply this while
- recursing though. */
- if (POINTER_TYPE_P (inner_type)
- && POINTER_TYPE_P (outer_type)
- && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
- return true;
+ return true;
+ }
- return useless_type_conversion_p_1 (outer_type, inner_type);
+ /* For aggregates we rely on TYPE_CANONICAL exclusively and require
+ explicit conversions for types involving to be structurally
+ compared types. */
+ else if (AGGREGATE_TYPE_P (inner_type)
+ && TREE_CODE (inner_type) == TREE_CODE (outer_type))
+ return false;
+
+ return false;
}
/* Return true if a conversion from either type of TYPE1 and TYPE2
@@ -1462,7 +1566,12 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_)
/* We do not care about LHS. */
if (wi->is_lhs)
- return NULL_TREE;
+ {
+ /* Except for operands of INDIRECT_REF. */
+ if (!INDIRECT_REF_P (t))
+ return NULL_TREE;
+ t = TREE_OPERAND (t, 0);
+ }
switch (TREE_CODE (t))
{
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index a5494827b37..1309e822fe2 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -638,8 +638,8 @@ fix_phi_nodes (edge e1f, edge e2f, basic_block bbf)
!gsi_end_p (gsi); gsi_next (&gsi), i++)
{
gimple phi = gsi_stmt (gsi);
- add_phi_arg (phi, info.target_inbound_names[i], e1f);
- add_phi_arg (phi, info.target_outbound_names[i], e2f);
+ add_phi_arg (phi, info.target_inbound_names[i], e1f, UNKNOWN_LOCATION);
+ add_phi_arg (phi, info.target_outbound_names[i], e2f, UNKNOWN_LOCATION);
}
}
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index f261b71ce9c..d1f6dc1488a 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -551,7 +551,7 @@ add_successor_phi_arg (edge e, tree var, tree phi_arg)
break;
gcc_assert (!gsi_end_p (gsi));
- add_phi_arg (gsi_stmt (gsi), phi_arg, e);
+ add_phi_arg (gsi_stmt (gsi), phi_arg, e, UNKNOWN_LOCATION);
}
/* Creates a GIMPLE statement which computes the operation specified by
@@ -776,7 +776,7 @@ eliminate_tail_call (struct tailcall *t)
phi = gsi_stmt (gsi);
gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi)));
- add_phi_arg (phi, arg, e);
+ add_phi_arg (phi, arg, e, gimple_location (stmt));
gsi_next (&gsi);
}
@@ -873,7 +873,8 @@ create_tailcall_accumulator (const char *label, basic_block bb, tree init)
add_referenced_var (tmp);
phi = create_phi_node (tmp, bb);
/* RET_TYPE can be a float when -ffast-maths is enabled. */
- add_phi_arg (phi, fold_convert (ret_type, init), single_pred_edge (bb));
+ add_phi_arg (phi, fold_convert (ret_type, init), single_pred_edge (bb),
+ UNKNOWN_LOCATION);
return PHI_RESULT (phi);
}
@@ -936,7 +937,8 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
set_default_def (param, new_name);
phi = create_phi_node (name, first);
SSA_NAME_DEF_STMT (name) = phi;
- add_phi_arg (phi, new_name, single_pred_edge (first));
+ add_phi_arg (phi, new_name, single_pred_edge (first),
+ EXPR_LOCATION (param));
}
phis_constructed = true;
}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 7646cc1ad0f..facde06969e 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -3049,7 +3049,7 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
msq = make_ssa_name (vec_dest, NULL);
phi_stmt = create_phi_node (msq, containing_loop->header);
SSA_NAME_DEF_STMT (msq) = phi_stmt;
- add_phi_arg (phi_stmt, msq_init, pe);
+ add_phi_arg (phi_stmt, msq_init, pe, UNKNOWN_LOCATION);
return msq;
}
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index eaf263c4270..c0b15cd98a5 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -169,15 +169,18 @@ slpeel_update_phis_for_duplicate_loop (struct loop *orig_loop,
!gsi_end_p (gsi_new) && !gsi_end_p (gsi_orig);
gsi_next (&gsi_new), gsi_next (&gsi_orig))
{
+ source_location locus;
phi_new = gsi_stmt (gsi_new);
phi_orig = gsi_stmt (gsi_orig);
/* step 1. */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, entry_arg_e);
- add_phi_arg (phi_new, def, new_loop_entry_e);
+ locus = gimple_phi_arg_location_from_edge (phi_orig, entry_arg_e);
+ add_phi_arg (phi_new, def, new_loop_entry_e, locus);
/* step 2. */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_loop_latch);
+ locus = gimple_phi_arg_location_from_edge (phi_orig, orig_loop_latch);
if (TREE_CODE (def) != SSA_NAME)
continue;
@@ -190,7 +193,7 @@ slpeel_update_phis_for_duplicate_loop (struct loop *orig_loop,
}
/* An ordinary ssa name defined in the loop. */
- add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop));
+ add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus);
/* step 3 (case 1). */
if (!after)
@@ -383,6 +386,7 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
!gsi_end_p (gsi_orig) && !gsi_end_p (gsi_update);
gsi_next (&gsi_orig), gsi_next (&gsi_update))
{
+ source_location loop_locus, guard_locus;;
orig_phi = gsi_stmt (gsi_orig);
update_phi = gsi_stmt (gsi_update);
@@ -395,10 +399,16 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
/* 1.2. NEW_MERGE_BB has two incoming edges: GUARD_EDGE and the exit-edge
of LOOP. Set the two phi args in NEW_PHI for these edges: */
loop_arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, EDGE_SUCC (loop->latch, 0));
+ loop_locus = gimple_phi_arg_location_from_edge (orig_phi,
+ EDGE_SUCC (loop->latch,
+ 0));
guard_arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, loop_preheader_edge (loop));
+ guard_locus
+ = gimple_phi_arg_location_from_edge (orig_phi,
+ loop_preheader_edge (loop));
- add_phi_arg (new_phi, loop_arg, new_exit_e);
- add_phi_arg (new_phi, guard_arg, guard_edge);
+ add_phi_arg (new_phi, loop_arg, new_exit_e, loop_locus);
+ add_phi_arg (new_phi, guard_arg, guard_edge, guard_locus);
/* 1.3. Update phi in successor block. */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi, e) == loop_arg
@@ -417,7 +427,7 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
*new_exit_bb);
/* 2.2. NEW_EXIT_BB has one incoming edge: the exit-edge of the loop. */
- add_phi_arg (new_phi, loop_arg, single_exit (loop));
+ add_phi_arg (new_phi, loop_arg, single_exit (loop), loop_locus);
/* 2.3. Update phi in successor of NEW_EXIT_BB: */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi2, new_exit_e) == loop_arg);
@@ -545,8 +555,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
if (new_name2)
guard_arg = new_name2;
- add_phi_arg (new_phi, loop_arg, new_exit_e);
- add_phi_arg (new_phi, guard_arg, guard_edge);
+ add_phi_arg (new_phi, loop_arg, new_exit_e, UNKNOWN_LOCATION);
+ add_phi_arg (new_phi, guard_arg, guard_edge, UNKNOWN_LOCATION);
/* 1.3. Update phi in successor block. */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi, e) == orig_def);
@@ -561,7 +571,7 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
*new_exit_bb);
/* 2.2. NEW_EXIT_BB has one incoming edge: the exit-edge of the loop. */
- add_phi_arg (new_phi, loop_arg, single_exit (loop));
+ add_phi_arg (new_phi, loop_arg, single_exit (loop), UNKNOWN_LOCATION);
/* 2.3. Update phi in successor of NEW_EXIT_BB: */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi2, new_exit_e) == loop_arg);
@@ -596,7 +606,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
/* 3.3. GUARD_BB has one incoming edge: */
gcc_assert (EDGE_COUNT (guard_edge->src->preds) == 1);
- add_phi_arg (new_phi, arg, EDGE_PRED (guard_edge->src, 0));
+ add_phi_arg (new_phi, arg, EDGE_PRED (guard_edge->src, 0),
+ UNKNOWN_LOCATION);
/* 3.4. Update phi in successor of GUARD_BB: */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi2, guard_edge)
@@ -720,13 +731,15 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e)
if (phi_arg)
{
edge new_loop_exit_edge;
+ source_location locus;
+ locus = gimple_phi_arg_location_from_edge (phi, single_exit (loop));
if (EDGE_SUCC (new_loop->header, 0)->dest == new_loop->latch)
new_loop_exit_edge = EDGE_SUCC (new_loop->header, 1);
else
new_loop_exit_edge = EDGE_SUCC (new_loop->header, 0);
- add_phi_arg (phi, phi_arg, new_loop_exit_edge);
+ add_phi_arg (phi, phi_arg, new_loop_exit_edge, locus);
}
}
@@ -764,7 +777,8 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e)
phi = gsi_stmt (gsi);
phi_arg = PHI_ARG_DEF_FROM_EDGE (phi, entry_e);
if (phi_arg)
- add_phi_arg (phi, phi_arg, new_exit_e);
+ add_phi_arg (phi, phi_arg, new_exit_e,
+ gimple_phi_arg_location_from_edge (phi, entry_e));
}
redirect_edge_and_branch_force (entry_e, new_loop->header);
@@ -954,8 +968,9 @@ set_prologue_iterations (basic_block bb_before_first_loop,
gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
newphi = create_phi_node (var, bb_before_first_loop);
- add_phi_arg (newphi, prologue_after_cost_adjust_name, e_fallthru);
- add_phi_arg (newphi, first_niters, e_false);
+ add_phi_arg (newphi, prologue_after_cost_adjust_name, e_fallthru,
+ UNKNOWN_LOCATION);
+ add_phi_arg (newphi, first_niters, e_false, UNKNOWN_LOCATION);
first_niters = PHI_RESULT (newphi);
}
@@ -2383,7 +2398,8 @@ vect_loop_versioning (loop_vec_info loop_vinfo, bool do_versioning,
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)),
new_exit_bb);
arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
- add_phi_arg (new_phi, arg, new_exit_e);
+ add_phi_arg (new_phi, arg, new_exit_e,
+ gimple_phi_arg_location_from_edge (orig_phi, e));
SET_PHI_ARG_DEF (orig_phi, e->dest_idx, PHI_RESULT (new_phi));
}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index cc8698dcbb6..4b75e00f8a5 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1709,8 +1709,13 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi,
return NULL;
}
- op3 = TREE_OPERAND (TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0), 0);
- op4 = TREE_OPERAND (TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0), 1);
+ op3 = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0);
+ if (COMPARISON_CLASS_P (op3))
+ {
+ op4 = TREE_OPERAND (op3, 1);
+ op3 = TREE_OPERAND (op3, 0);
+ }
+
op1 = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 1);
op2 = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 2);
@@ -1754,10 +1759,14 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple phi,
print_generic_expr (vect_dump, TREE_TYPE (op1), TDF_SLIM);
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op2), TDF_SLIM);
- if (op3 && op4)
+ if (op3)
{
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op3), TDF_SLIM);
+ }
+
+ if (op4)
+ {
fprintf (vect_dump, ",");
print_generic_expr (vect_dump, TREE_TYPE (op4), TDF_SLIM);
}
@@ -2528,8 +2537,9 @@ get_initial_def_for_induction (gimple iv_phi)
NULL));
/* Set the arguments of the phi node: */
- add_phi_arg (induction_phi, vec_init, pe);
- add_phi_arg (induction_phi, vec_def, loop_latch_edge (iv_loop));
+ add_phi_arg (induction_phi, vec_init, pe, UNKNOWN_LOCATION);
+ add_phi_arg (induction_phi, vec_def, loop_latch_edge (iv_loop),
+ UNKNOWN_LOCATION);
/* In case that vectorization factor (VF) is bigger than the number
@@ -2938,12 +2948,13 @@ vect_create_epilog_for_reduction (tree vect_def, gimple stmt,
for (j = 0; j < ncopies; j++)
{
/* 1.1 set the loop-entry arg of the reduction-phi: */
- add_phi_arg (phi, vec_initial_def, loop_preheader_edge (loop));
+ add_phi_arg (phi, vec_initial_def, loop_preheader_edge (loop),
+ UNKNOWN_LOCATION);
/* 1.2 set the loop-latch arg for the reduction-phi: */
if (j > 0)
def = vect_get_vec_def_for_stmt_copy (dt, def);
- add_phi_arg (phi, def, loop_latch_edge (loop));
+ add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION);
if (vect_print_dump_info (REPORT_DETAILS))
{
@@ -3354,9 +3365,9 @@ vect_finalize_reduction:
/* Update phi node arguments with vs0 and vs2. */
add_phi_arg (vect_phi, vect_phi_init,
- loop_preheader_edge (outer_loop));
+ loop_preheader_edge (outer_loop), UNKNOWN_LOCATION);
add_phi_arg (vect_phi, PHI_RESULT (epilog_stmt),
- loop_latch_edge (outer_loop));
+ loop_latch_edge (outer_loop), UNKNOWN_LOCATION);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "created double reduction phi node: ");
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 50900775a04..aacf768a4cf 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3639,7 +3639,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
gcc_assert (phi);
if (i == vec_num - 1 && j == ncopies - 1)
- add_phi_arg (phi, lsq, loop_latch_edge (containing_loop));
+ add_phi_arg (phi, lsq, loop_latch_edge (containing_loop),
+ UNKNOWN_LOCATION);
msq = lsq;
}
}
diff --git a/gcc/tree.c b/gcc/tree.c
index 44178aff65c..60416d342c7 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3988,7 +3988,7 @@ iterative_hash_hashval_t (hashval_t val, hashval_t val2)
}
/* Produce good hash value combining VAL and VAL2. */
-static inline hashval_t
+hashval_t
iterative_hash_host_wide_int (HOST_WIDE_INT val, hashval_t val2)
{
if (sizeof (HOST_WIDE_INT) == sizeof (hashval_t))
@@ -7686,21 +7686,10 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
tree t;
hashval_t hashcode = 0;
- /* Build a main variant, based on the main variant of the inner type, then
- use it to build the variant we return. */
- if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype))
- && TYPE_MAIN_VARIANT (innertype) != innertype)
- return build_type_attribute_qual_variant (
- make_vector_type (TYPE_MAIN_VARIANT (innertype), nunits, mode),
- TYPE_ATTRIBUTES (innertype),
- TYPE_QUALS (innertype));
-
t = make_node (VECTOR_TYPE);
TREE_TYPE (t) = TYPE_MAIN_VARIANT (innertype);
SET_TYPE_VECTOR_SUBPARTS (t, nunits);
SET_TYPE_MODE (t, mode);
- TYPE_READONLY (t) = TYPE_READONLY (innertype);
- TYPE_VOLATILE (t) = TYPE_VOLATILE (innertype);
if (TYPE_STRUCTURAL_EQUALITY_P (innertype))
SET_TYPE_STRUCTURAL_EQUALITY (t);
@@ -7730,9 +7719,20 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
}
hashcode = iterative_hash_host_wide_int (VECTOR_TYPE, hashcode);
+ hashcode = iterative_hash_host_wide_int (nunits, hashcode);
hashcode = iterative_hash_host_wide_int (mode, hashcode);
- hashcode = iterative_hash_object (TYPE_HASH (innertype), hashcode);
- return type_hash_canon (hashcode, t);
+ hashcode = iterative_hash_object (TYPE_HASH (TREE_TYPE (t)), hashcode);
+ t = type_hash_canon (hashcode, t);
+
+ /* We have built a main variant, based on the main variant of the
+ inner type. Use it to build the variant we return. */
+ if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype))
+ && TREE_TYPE (t) != innertype)
+ return build_type_attribute_qual_variant (t,
+ TYPE_ATTRIBUTES (innertype),
+ TYPE_QUALS (innertype));
+
+ return t;
}
static tree
diff --git a/gcc/tree.h b/gcc/tree.h
index b828b419a82..36b5f0e4405 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1891,6 +1891,7 @@ struct GTY(()) phi_arg_d {
pointer arithmetic with it. See phi_arg_index_from_use. */
struct ssa_use_operand_d imm_use;
tree def;
+ location_t locus;
};
@@ -4885,6 +4886,7 @@ extern int simple_cst_equal (const_tree, const_tree);
extern hashval_t iterative_hash_expr (const_tree, hashval_t);
extern hashval_t iterative_hash_exprs_commutative (const_tree,
const_tree, hashval_t);
+extern hashval_t iterative_hash_host_wide_int (HOST_WIDE_INT, hashval_t);
extern hashval_t iterative_hash_hashval_t (hashval_t, hashval_t);
extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
extern int type_list_equal (const_tree, const_tree);
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index e7a8e0f0747..9774ca224f5 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1,5 +1,5 @@
/* Transformations based on profile information for values.
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
Foundation, Inc.
This file is part of GCC.
@@ -1059,8 +1059,7 @@ init_pid_map (void)
if (pid_map != NULL)
return;
- pid_map
- = (struct cgraph_node**) xmalloc (sizeof (struct cgraph_node*) * cgraph_max_pid);
+ pid_map = XCNEWVEC (struct cgraph_node*, cgraph_max_pid);
for (n = cgraph_nodes; n; n = n->next)
{
diff --git a/gnattools/ChangeLog b/gnattools/ChangeLog
index d8cbe086f4a..ff395ea7783 100644
--- a/gnattools/ChangeLog
+++ b/gnattools/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, configure_deps): New variables.
+ ($(srcdir)/configure): Use them.
+
2009-05-18 Bechir Zalila <bechir.zalila@gmail.com>
PR ada/40166
diff --git a/gnattools/Makefile.in b/gnattools/Makefile.in
index 92f4773b3d8..93198967857 100644
--- a/gnattools/Makefile.in
+++ b/gnattools/Makefile.in
@@ -305,9 +305,14 @@ Makefile: $(srcdir)/Makefile.in config.status
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
-$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac \
- $(srcdir)/../config/acx.m4 $(srcdir)/../config/override.m4
- cd $(srcdir) && autoconf
+AUTOCONF = autoconf
+configure_deps = \
+ $(srcdir)/configure.ac \
+ $(srcdir)/../config/acx.m4 \
+ $(srcdir)/../config/override.m4
+
+$(srcdir)/configure: @MAINT@ $(configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
# Don't export variables to the environment, in order to not confuse
# configure.
diff --git a/intl/ChangeLog b/intl/ChangeLog
index 74018fb44c0..fda6cc38cd4 100644
--- a/intl/ChangeLog
+++ b/intl/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (aclocal_deps): New variable.
+ ($(srcdir)/aclocal.m4): Use it, for portable makefile syntax.
+
2008-06-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/intl/Makefile.in b/intl/Makefile.in
index 96211ffd147..3dd0b7fe8fd 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -211,16 +211,28 @@ config.status: $(srcdir)/configure
$(srcdir)/configure: @MAINT@ $(srcdir)/aclocal.m4 $(srcdir)/configure.ac
cd $(srcdir) && $(AUTOCONF)
-$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/configure.ac \
- $(srcdir)/../config/codeset.m4 $(srcdir)/../config/gettext.m4 \
- $(srcdir)/../config/glibc21.m4 $(srcdir)/../config/iconv.m4 \
- $(srcdir)/../config/intdiv0.m4 $(srcdir)/../config/inttypes-pri.m4 \
- $(srcdir)/../config/inttypes.m4 $(srcdir)/../config/inttypes_h.m4 \
- $(srcdir)/../config/lcmessage.m4 $(srcdir)/../config/lib-ld.m4 \
- $(srcdir)/../config/lib-link.m4 $(srcdir)/../config/lib-prefix.m4 \
- $(srcdir)/../config/nls.m4 $(srcdir)/../config/po.m4 \
- $(srcdir)/../config/progtest.m4 $(srcdir)/../config/stdint_h.m4 \
- $(srcdir)/../config/uintmax_t.m4 $(srcdir)/../config/ulonglong.m4
+aclocal_deps = \
+ $(srcdir)/configure.ac \
+ $(srcdir)/../config/codeset.m4 \
+ $(srcdir)/../config/gettext.m4 \
+ $(srcdir)/../config/glibc21.m4 \
+ $(srcdir)/../config/iconv.m4 \
+ $(srcdir)/../config/intdiv0.m4 \
+ $(srcdir)/../config/inttypes-pri.m4 \
+ $(srcdir)/../config/inttypes.m4 \
+ $(srcdir)/../config/inttypes_h.m4 \
+ $(srcdir)/../config/lcmessage.m4 \
+ $(srcdir)/../config/lib-ld.m4 \
+ $(srcdir)/../config/lib-link.m4 \
+ $(srcdir)/../config/lib-prefix.m4 \
+ $(srcdir)/../config/nls.m4 \
+ $(srcdir)/../config/po.m4 \
+ $(srcdir)/../config/progtest.m4 \
+ $(srcdir)/../config/stdint_h.m4 \
+ $(srcdir)/../config/uintmax_t.m4 \
+ $(srcdir)/../config/ulonglong.m4
+
+$(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
cd $(srcdir) && $(ACLOCAL) -I ../config
config.h: stamp-h1
diff --git a/libada/ChangeLog b/libada/ChangeLog
index fc48aa148dd..0eddf991d72 100644
--- a/libada/ChangeLog
+++ b/libada/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, configure_deps): New variables.
+ ($(srcdir)/configure)): Use them. Also depend on multi.m4.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-13 Eric Botcazou <ebotcazou@adacore.com>
* configure.ac: Include multi.m4 and do not call AC_CANONICAL_SYSTEM.
diff --git a/libada/Makefile.in b/libada/Makefile.in
index f5057a006e7..db483b50033 100644
--- a/libada/Makefile.in
+++ b/libada/Makefile.in
@@ -171,9 +171,15 @@ Makefile: $(srcdir)/Makefile.in config.status
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
-$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac \
- $(srcdir)/../config/acx.m4 $(srcdir)/../config/override.m4
- cd $(srcdir) && autoconf
+AUTOCONF = autoconf
+configure_deps = \
+ $(srcdir)/configure.ac \
+ $(srcdir)/../config/acx.m4 \
+ $(srcdir)/../config/override.m4 \
+ $(srcdir)/../config/multi.m4
+
+$(srcdir)/configure: @MAINT@ $(configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
# Don't export variables to the environment, in order to not confuse
# configure.
diff --git a/libada/configure.ac b/libada/configure.ac
index 12de5479e00..ef9e6132c43 100644
--- a/libada/configure.ac
+++ b/libada/configure.ac
@@ -92,7 +92,7 @@ AC_SUBST(toolexeclibdir)
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 9da83176bd4..c8bc7a898fd 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-17 Tom Tromey <tromey@redhat.com>
+
+ PR preprocessor/41067:
+ * charset.c (convert_escape): Add missing ":" to error text.
+
2009-07-27 Douglas B Rupp <rupp@gnat.com>
* include/cpplib.h (INO_T_CPP): New macro.
diff --git a/libcpp/charset.c b/libcpp/charset.c
index f1da4265ddd..b96c646f58e 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -1301,7 +1301,7 @@ convert_escape (cpp_reader *pfile, const uchar *from, const uchar *limit,
unknown:
if (ISGRAPH (c))
cpp_error (pfile, CPP_DL_PEDWARN,
- "unknown escape sequence '\\%c'", (int) c);
+ "unknown escape sequence: '\\%c'", (int) c);
else
{
/* diagnostic.c does not support "%03o". When it does, this
diff --git a/libcpp/po/ChangeLog b/libcpp/po/ChangeLog
index 94503a7c4eb..ba4d1e6a1cb 100644
--- a/libcpp/po/ChangeLog
+++ b/libcpp/po/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-04 Joseph Myers <joseph@codesourcery.com>
+
+ * es.po: Update.
+
2009-07-25 Joseph Myers <joseph@codesourcery.com>
* nl.po: Update.
diff --git a/libcpp/po/es.po b/libcpp/po/es.po
index a43c1d3cc47..1ae12e2f7f3 100644
--- a/libcpp/po/es.po
+++ b/libcpp/po/es.po
@@ -1,14 +1,14 @@
-# Mensajes en español para cpplib-4.4-b20081121
+# Mensajes en español para cpplib-4.4.1
# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is distributed under the same license as the gcc package.
# Cristian Othón Martínez Vera <cfuga@itam.mx>, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009.
#
msgid ""
msgstr ""
-"Project-Id-Version: cpplib 4.4-b20081121\n"
+"Project-Id-Version: cpplib 4.4.1\n"
"Report-Msgid-Bugs-To: http://gcc.gnu.org/bugs.html\n"
"POT-Creation-Date: 2009-04-22 16:32+0000\n"
-"PO-Revision-Date: 2009-03-03 23:45-0600\n"
+"PO-Revision-Date: 2009-08-02 21:44-0500\n"
"Last-Translator: Cristian Othón Martínez Vera <cfuga@itam.mx>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
@@ -900,9 +900,9 @@ msgid "while writing precompiled header"
msgstr "al escribir el encabezado precompilado"
#: pch.c:484
-#, fuzzy, c-format
+#, c-format
msgid "%s: not used because `%.*s' is poisoned"
-msgstr "%s: no se usa porque `%s' está definido"
+msgstr "%s: no se usa porque `%.*s' está envenenado"
#: pch.c:506
#, c-format
diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
index 74fba5990d6..4daf9ec1b2b 100644
--- a/libdecnumber/ChangeLog
+++ b/libdecnumber/ChangeLog
@@ -1,3 +1,15 @@
+2009-08-13 Janis Johnson <janis187@us.ibm.com>
+
+ PR c/41046
+ * decContext.c (decContextTestEndian): Call printf only if DECCHECK.
+ * decCommon.c ( decFloatShow): Define function only for DECCHECK
+ or DECTRACE.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (aclocal_deps): New variable.
+ ($(srcdir)/aclocal.m4): Use it, for portable makefile syntax.
+
2009-05-31 Ian Lance Taylor <iant@google.com>
* decContext.h: Add extern "C" if compiling with C++.
diff --git a/libdecnumber/Makefile.in b/libdecnumber/Makefile.in
index 41607959c91..de91f6f614b 100644
--- a/libdecnumber/Makefile.in
+++ b/libdecnumber/Makefile.in
@@ -94,9 +94,13 @@ config.status: $(srcdir)/configure
$(srcdir)/configure: @MAINT@ $(srcdir)/aclocal.m4
cd $(srcdir) && $(AUTOCONF)
-$(srcdir)/aclocal.m4: @MAINT@ $(srcdir)/../config/stdint.m4 \
- $(srcdir)/../config/warnings.m4 $(srcdir)/../config/override.m4 \
+aclocal_deps = \
+ $(srcdir)/../config/stdint.m4 \
+ $(srcdir)/../config/warnings.m4 \
+ $(srcdir)/../config/override.m4 \
$(srcdir)/configure.ac
+
+$(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
cd $(srcdir) && $(ACLOCAL) -I ../config
config.h: stamp-h1
diff --git a/libdecnumber/decCommon.c b/libdecnumber/decCommon.c
index 192b5cf02f9..add1f2ed716 100644
--- a/libdecnumber/decCommon.c
+++ b/libdecnumber/decCommon.c
@@ -1157,6 +1157,7 @@ uInt decFloatRadix(const decFloat *df) {
return 10;
} /* decFloatRadix */
+#if (DECCHECK || DECTRACE)
/* ------------------------------------------------------------------ */
/* decFloatShow -- printf a decFloat in hexadecimal and decimal */
/* df is the decFloat to show */
@@ -1183,6 +1184,7 @@ void decFloatShow(const decFloat *df, const char *tag) {
printf(">%s> %s [big-endian] %s\n", tag, hexbuf, buff);
return;
} /* decFloatShow */
+#endif
/* ------------------------------------------------------------------ */
/* decFloatToBCD -- get sign, exponent, and BCD8 from a decFloat */
diff --git a/libdecnumber/decContext.c b/libdecnumber/decContext.c
index 28bbdbb4929..1756dcb2522 100644
--- a/libdecnumber/decContext.c
+++ b/libdecnumber/decContext.c
@@ -31,7 +31,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* ------------------------------------------------------------------ */
#include <string.h> /* for strcmp */
+#ifdef DECCHECK
#include <stdio.h> /* for printf if DECCHECK */
+#endif
#include "dconfig.h" /* for GCC definitions */
#include "decContext.h" /* context and base types */
#include "decNumberLocal.h" /* decNumber local types, etc. */
@@ -395,8 +397,10 @@ Int decContextTestEndian(Flag quiet) {
if (!quiet) {
if (LITEND) adj="little";
else adj="big";
+#if DECCHECK
printf("Warning: DECLITEND is set to %d, but this computer appears to be %s-endian\n",
DECLITEND, adj);
+#endif
}
res=(Int)LITEND-dle;
}
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 9af1e445e72..2fc3b1a7487 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-24 Dave Korn <dave.korn.cygwin@gmail.com>
PR libffi/40807
diff --git a/libffi/configure.ac b/libffi/configure.ac
index 2ab5902746e..ab693bb5c36 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -22,7 +22,7 @@ AM_INIT_AUTOMAKE
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 01c35fc5366..1216f8b839a 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,17 @@
+2009-08-09 Douglas B Rupp <rupp@gnat.com>
+
+ * config.host (ia64-hp-*vms*): New target.
+ (alpha64-dec-*vms*,alpha*-dec-*vms*): Fix for config/vms and unify
+ with ia64-hp-*vms*.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac: Add snippet for maintainer-mode.
+ * configure: Regenerate.
+ * Makefile.in (AUTOCONF, configure_deps): New variables.
+ ($(srcdir)/configure)): New rule, active only with maintainer
+ mode turned on.
+
2009-06-23 DJ Delorie <dj@redhat.com>
Add MeP port.
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index 53dde12b47d..9484e7e6c0e 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -140,6 +140,17 @@ stamp-h: $(srcdir)/config.in config.status Makefile
config.status: $(srcdir)/configure $(srcdir)/config.host
$(SHELL) ./config.status --recheck
+AUTOCONF = autoconf
+configure_deps = \
+ $(srcdir)/../config/enable.m4 \
+ $(srcdir)/../config/tls.m4 \
+ $(srcdir)/../config/acx.m4 \
+ $(srcdir)/../config/no-executables.m4 \
+ $(srcdir)/../config/override.m4 \
+
+$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+
include $(gcc_objdir)/libgcc.mvars
# Flags to pass to recursive makes.
diff --git a/libgcc/config.host b/libgcc/config.host
index 7d70f772aea..da4600489ba 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -189,8 +189,10 @@ alpha*-*-openbsd*)
alpha*-dec-osf[45]*)
;;
alpha64-dec-*vms*)
+ tmake_file="vms/t-vms vms/t-vms64 alpha/t-vms"
;;
alpha*-dec-*vms*)
+ tmake_file="vms/t-vms alpha/t-vms"
;;
arc-*-elf*)
;;
@@ -347,6 +349,9 @@ ia64*-*-linux*)
;;
ia64*-*-hpux*)
;;
+ia64-hp-*vms*)
+ tmake_file="vms/t-vms vms/t-vms64 ia64/t-vms"
+ ;;
iq2000*-*-elf*)
;;
m32r-*-elf*|m32r-*-rtems*)
diff --git a/libgcc/configure b/libgcc/configure
index 6315ecd5cbc..0230e799fce 100644
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -272,7 +272,7 @@ PACKAGE_STRING='GNU C Runtime Library 1.0'
PACKAGE_BUGREPORT=''
ac_unique_file="static-object.mk"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcc_topdir enable_shared slibdir INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK build build_cpu build_vendor build_os host host_cpu host_vendor host_os host_noncanonical build_libsubdir build_subdir host_subdir target_subdir AR ac_ct_AR LIPO ac_ct_LIPO NM ac_ct_NM RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP decimal_float enable_decimal_float fixed_point vis_hide set_have_cc_tls tmake_file extra_parts asm_hidden_op LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libgcc_topdir enable_shared slibdir MAINT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AWK build build_cpu build_vendor build_os host host_cpu host_vendor host_os host_noncanonical build_libsubdir build_subdir host_subdir target_subdir AR ac_ct_AR LIPO ac_ct_LIPO NM ac_ct_NM RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP decimal_float enable_decimal_float fixed_point vis_hide set_have_cc_tls tmake_file extra_parts asm_hidden_op LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -812,6 +812,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-shared don't provide a shared libgcc
--enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory
+ --enable-maintainer-mode
+ enable make rules and dependencies not useful (and
+ sometimes confusing) to the casual installer
--enable-decimal-float={no,yes,bid,dpd}
enable decimal float extension to C. Selecting 'bid'
or 'dpd' choses which decimal floating point format
@@ -1419,6 +1422,23 @@ fi
fi;
+# Command-line options.
+# Very limited version of AC_MAINTAINER_MODE.
+# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ case ${enable_maintainer_mode} in
+ yes) MAINT='' ;;
+ no) MAINT='#' ;;
+ *) { { echo "$as_me:$LINENO: error: --enable-maintainer-mode must be yes or no" >&5
+echo "$as_me: error: --enable-maintainer-mode must be yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ maintainer_mode=${enableval}
+else
+ MAINT='#'
+fi;
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -4226,6 +4246,7 @@ s,@LIBS@,$LIBS,;t t
s,@libgcc_topdir@,$libgcc_topdir,;t t
s,@enable_shared@,$enable_shared,;t t
s,@slibdir@,$slibdir,;t t
+s,@MAINT@,$MAINT,;t t
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
s,@INSTALL_DATA@,$INSTALL_DATA,;t t
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index d48bccce065..b055dbaca13 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -78,6 +78,21 @@ else
fi)
AC_SUBST(slibdir)
+# Command-line options.
+# Very limited version of AC_MAINTAINER_MODE.
+AC_ARG_ENABLE([maintainer-mode],
+ [AC_HELP_STRING([--enable-maintainer-mode],
+ [enable make rules and dependencies not useful (and
+ sometimes confusing) to the casual installer])],
+ [case ${enable_maintainer_mode} in
+ yes) MAINT='' ;;
+ no) MAINT='#' ;;
+ *) AC_MSG_ERROR([--enable-maintainer-mode must be yes or no]) ;;
+ esac
+ maintainer_mode=${enableval}],
+ [MAINT='#'])
+AC_SUBST([MAINT])dnl
+
AC_PROG_INSTALL
AC_PROG_AWK
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index aec14276fbe..abeac8a9525 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,59 @@
+2009-08-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/41075
+ * io/io.h (enum format_token): Add FMT_STAR.
+ * io/format.c (format_lex): Add case for FMT_STAR.
+ (parse_format_list): Parse FMT_STAR and check for left paren
+ after. (next_format0): Modify helper function to check for
+ unimited format and return the repeated format node. Update
+ comments to clarify.
+
+2009-08-15 Kai Tietz <kai.tietz@onevision.com>
+
+ * intrinsics/string_intrinsics_inc.c (string_len_trim): Use
+ __INTPTR_TYPE__ to cast from pointer to scalar integer, if
+ __INTPTR_TYPE is defined.
+
+2009-08-14 Janne Blomqvist <jb@gcc.gnu.org>
+
+ * fmain.c: Add comment saying file is deprecated.
+
+2009-08-14 Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR libfortran/40863
+ * gfortran.map: Move new symbols to GFORTRAN_C99_1.1 version node.
+
+2009-08-09 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR libfortran/40549
+ * Makefile.in (LTLDFLAGS): Add -no-undefined.
+ * Makefile.am: Regenerate.
+ * libgfortran.h: Remove unused block of code.
+
+2009-08-02 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/40853
+ * io/list_read.c (nml_get_obj_data): Do not set nl
+ pointer to first_nl if nl->next is NULL.
+
+2009-07-31 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * Makefile.am: Don't set SECTION_FLAGS with @SECTION_FLAGS@.
+ Don't set IEEE_FLAGS with @IEEE_FLAGS@.
+ * Makefile.in: Regenerate.
+
+2009-07-30 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * configure.host: Define ieee_flags and set it to -mieee for sh.
+ * configure.ac: Set IEEE_FLAGS with ieee_flags.
+ * Makefile.am: Add IEEE_FLAGS to AM_CFLAGS.
+ * configure: Regenerate.
+ * Makefile.in: Regenerate.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-27 Tobias Burnus <burnus@net-b.de>
PR fortran/40863
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 4a974ba0066..26565a2daea 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -13,7 +13,8 @@ else
version_arg =
endif
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
+ -no-undefined
toolexeclib_LTLIBRARIES = libgfortran.la
libgfortran_la_LINK = $(LINK)
@@ -34,9 +35,11 @@ AM_CPPFLAGS = -iquote$(srcdir)/io -I$(srcdir)/$(MULTISRCTOP)../gcc \
AM_CFLAGS += -fcx-fortran-rules
# Use -ffunction-sections -fdata-sections if supported by the compiler
-SECTION_FLAGS = @SECTION_FLAGS@
AM_CFLAGS += $(SECTION_FLAGS)
+# Some targets require additional compiler options for IEEE compatibility.
+AM_CFLAGS += $(IEEE_FLAGS)
+
gfor_io_src= \
io/close.c \
io/file_pos.c \
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 7741c324aaf..b724ee3b478 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -815,7 +815,12 @@ AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
# Fortran rules for complex multiplication and division
-AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS)
+
+# Use -ffunction-sections -fdata-sections if supported by the compiler
+
+# Some targets require additional compiler options for IEEE compatibility.
+AM_CFLAGS = @AM_CFLAGS@ -fcx-fortran-rules $(SECTION_FLAGS) \
+ $(IEEE_FLAGS)
AM_FCFLAGS = @AM_FCFLAGS@
AR = @AR@
AS = @AS@
@@ -843,6 +848,7 @@ FCFLAGS = @FCFLAGS@
FGREP = @FGREP@
FPU_HOST_HEADER = @FPU_HOST_HEADER@
GREP = @GREP@
+IEEE_FLAGS = @IEEE_FLAGS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@@ -875,8 +881,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
-
-# Use -ffunction-sections -fdata-sections if supported by the compiler
SECTION_FLAGS = @SECTION_FLAGS@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -953,7 +957,9 @@ ACLOCAL_AMFLAGS = -I .. -I ../config
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
@LIBGFOR_USE_SYMVER_FALSE@version_arg =
@LIBGFOR_USE_SYMVER_TRUE@version_arg = -Wl,--version-script=$(srcdir)/gfortran.map
-LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) \
+ -no-undefined
+
toolexeclib_LTLIBRARIES = libgfortran.la
libgfortran_la_LINK = $(LINK)
libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) -lm $(extra_ldflags_libgfortran) $(version_arg)
diff --git a/libgfortran/configure b/libgfortran/configure
index 043884bad5a..9091071e011 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -457,7 +457,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_libsubdir build_subdir host_subdir target_subdir onestep_TRUE onestep_FALSE onestep host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT multi_basedir toolexecdir toolexeclibdir CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AM_FCFLAGS AM_CFLAGS CFLAGS LIBGFOR_USE_SYMVER_TRUE LIBGFOR_USE_SYMVER_FALSE SECTION_FLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S OBJDUMP ac_ct_OBJDUMP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 CPP CPPFLAGS enable_shared enable_static FC FCFLAGS LDFLAGS ac_ct_FC extra_ldflags_libgfortran FPU_HOST_HEADER LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_libsubdir build_subdir host_subdir target_subdir onestep_TRUE onestep_FALSE onestep host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT multi_basedir toolexecdir toolexeclibdir CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AM_FCFLAGS AM_CFLAGS CFLAGS LIBGFOR_USE_SYMVER_TRUE LIBGFOR_USE_SYMVER_FALSE SECTION_FLAGS AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S OBJDUMP ac_ct_OBJDUMP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 CPP CPPFLAGS enable_shared enable_static FC FCFLAGS LDFLAGS ac_ct_FC extra_ldflags_libgfortran FPU_HOST_HEADER IEEE_FLAGS LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -33816,6 +33816,10 @@ echo "$as_me: FPU dependent file will be ${fpu_host}.h" >&6;}
FPU_HOST_HEADER=config/${fpu_host}.h
+# Some targets require additional compiler options for IEEE compatibility.
+IEEE_FLAGS="${ieee_flags}"
+
+
# Check out attribute support.
echo "$as_me:$LINENO: checking whether the target supports hidden visibility" >&5
@@ -35568,6 +35572,7 @@ s,@LDFLAGS@,$LDFLAGS,;t t
s,@ac_ct_FC@,$ac_ct_FC,;t t
s,@extra_ldflags_libgfortran@,$extra_ldflags_libgfortran,;t t
s,@FPU_HOST_HEADER@,$FPU_HOST_HEADER,;t t
+s,@IEEE_FLAGS@,$IEEE_FLAGS,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index b1e5d1e2c35..2d0dff0c68c 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -119,7 +119,7 @@ AC_SUBST(toolexeclibdir)
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
if test "x$GCC" = "xyes"; then
@@ -448,6 +448,10 @@ AC_MSG_NOTICE([FPU dependent file will be ${fpu_host}.h])
FPU_HOST_HEADER=config/${fpu_host}.h
AC_SUBST(FPU_HOST_HEADER)
+# Some targets require additional compiler options for IEEE compatibility.
+IEEE_FLAGS="${ieee_flags}"
+AC_SUBST(IEEE_FLAGS)
+
# Check out attribute support.
LIBGFOR_CHECK_ATTRIBUTE_VISIBILITY
LIBGFOR_CHECK_ATTRIBUTE_DLLEXPORT
diff --git a/libgfortran/configure.host b/libgfortran/configure.host
index 73da57172d6..eb68c934c39 100644
--- a/libgfortran/configure.host
+++ b/libgfortran/configure.host
@@ -38,3 +38,10 @@ fi
if test "x${have_fp_enable}" = "xyes" && test "x${have_fp_trap}" = "xyes"; then
fpu_host='fpu-aix'
fi
+
+# Some targets require additional compiler options for NaN/Inf.
+ieee_flags=
+case "${host_cpu}" in
+ sh*)
+ ieee_flags="-mieee" ;;
+esac
diff --git a/libgfortran/fmain.c b/libgfortran/fmain.c
index c59f319f7d8..a99263cc510 100644
--- a/libgfortran/fmain.c
+++ b/libgfortran/fmain.c
@@ -1,3 +1,6 @@
+/* Note that this file is not used as of GFortran 4.5, and exists here
+ only for backwards compatibility. */
+
#include "libgfortran.h"
/* The main Fortran program actually is a function, called MAIN__.
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 4b7a1ed7c47..a149332d071 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1206,20 +1206,13 @@ GFORTRAN_C99_1.0 {
jnf;
lgamma;
lgammaf;
- llround;
- llroundf;
- llroundl;
log10f;
log10l;
logf;
- lround;
- lroundf;
- lroundl;
nextafterf;
powf;
round;
roundf;
- roundl;
scalbn;
scalbnf;
sinf;
@@ -1256,4 +1249,11 @@ GFORTRAN_C99_1.1 {
catanhf;
catanhl;
catanl;
+ llround;
+ llroundf;
+ llroundl;
+ lround;
+ lroundf;
+ lroundl;
+ roundl;
} GFORTRAN_C99_1.0;
diff --git a/libgfortran/intrinsics/string_intrinsics_inc.c b/libgfortran/intrinsics/string_intrinsics_inc.c
index f9fb1a29d89..64f5cd75a85 100644
--- a/libgfortran/intrinsics/string_intrinsics_inc.c
+++ b/libgfortran/intrinsics/string_intrinsics_inc.c
@@ -196,7 +196,11 @@ string_len_trim (gfc_charlen_type len, const CHARTYPE *s)
/* Handle the first characters until we're aligned on a long word
boundary. Actually, s + i + 1 must be properly aligned, because
s + i will be the last byte of a long word read. */
- starting = ((unsigned long) (s + i + 1)) % long_len;
+ starting = ((unsigned long)
+#ifdef __INTPTR_TYPE__
+ (__INTPTR_TYPE__)
+#endif
+ (s + i + 1)) % long_len;
i -= starting;
for (; starting > 0; --starting)
if (s[i + starting] != ' ')
diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index e40adb9b2a1..e888a2eba3f 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -313,6 +313,10 @@ format_lex (format_data *fmt)
switch (c)
{
+ case '*':
+ token = FMT_STAR;
+ break;
+
case '(':
token = FMT_LPAREN;
break;
@@ -595,6 +599,21 @@ parse_format_list (st_parameter_dt *dtp, bool *save_ok)
format_item_1:
switch (t)
{
+ case FMT_STAR:
+ t = format_lex (fmt);
+ if (t != FMT_LPAREN)
+ {
+ fmt->error = "Left parenthesis required after '*'";
+ goto finished;
+ }
+ get_fnode (fmt, &head, &tail, FMT_LPAREN);
+ tail->repeat = -2; /* Signifies unlimited format. */
+ tail->u.child = parse_format_list (dtp, &saveit);
+ if (fmt->error != NULL)
+ goto finished;
+
+ goto between_desc;
+
case FMT_POSINT:
repeat = fmt->value;
@@ -1252,8 +1271,23 @@ next_format0 (fnode * f)
return NULL;
}
- /* Deal with a parenthesis node */
+ /* Deal with a parenthesis node with unlimited format. */
+
+ if (f->repeat == -2) /* -2 signifies unlimited. */
+ for (;;)
+ {
+ if (f->current == NULL)
+ f->current = f->u.child;
+
+ for (; f->current != NULL; f->current = f->current->next)
+ {
+ r = next_format0 (f->current);
+ if (r != NULL)
+ return r;
+ }
+ }
+ /* Deal with a parenthesis node with specific repeat count. */
for (; f->count < f->repeat; f->count++)
{
if (f->current == NULL)
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 2a077629a6d..9ca6d387480 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -654,7 +654,7 @@ typedef enum
FMT_LPAREN, FMT_RPAREN, FMT_X, FMT_S, FMT_SS, FMT_SP, FMT_STRING,
FMT_BADSTRING, FMT_P, FMT_I, FMT_B, FMT_BN, FMT_BZ, FMT_O, FMT_Z, FMT_F,
FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_DC,
- FMT_DP
+ FMT_DP, FMT_STAR
}
format_token;
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index c39a51d34e2..bcc00e17c26 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -2773,7 +2773,7 @@ get_name:
if (nl->type == GFC_DTYPE_DERIVED)
nml_touch_nodes (nl);
- if (component_flag && nl->var_rank > 0)
+ if (component_flag && nl->var_rank > 0 && nl->next)
nl = first_nl;
/* Make sure no extraneous qualifiers are there. */
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index 8c7bf86c2bd..4ecba3a8f69 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -917,6 +917,27 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
}
#endif
+
+#ifdef __MINGW32__
+ if (opp->file_len == 7)
+ {
+ if (strncmp (path, "CONOUT$", 7) == 0
+ || strncmp (path, "CONERR$", 7) == 0)
+ {
+ fd = open ("CONOUT$", O_WRONLY);
+ flags->action = ACTION_WRITE;
+ return fd;
+ }
+ }
+
+ if (opp->file_len == 6 && strncmp (path, "CONIN$", 6) == 0)
+ {
+ fd = open ("CONIN$", O_RDONLY);
+ flags->action = ACTION_READ;
+ return fd;
+ }
+#endif
+
rwflag = 0;
switch (flags->action)
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index a2e200274f5..439c791fca2 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -177,13 +177,6 @@ extern int __mingw_snprintf (char *, size_t, const char *, ...)
# define iexport1(x,y) iexport2(x,y)
# define iexport2(x,y) \
extern __typeof(x) PREFIX(x) __attribute__((__alias__(#y)))
-/* ??? We're not currently building a dll, and it's wrong to add dllexport
- to objects going into a static library archive. */
-#elif 0 && defined(HAVE_ATTRIBUTE_DLLEXPORT)
-# define export_proto_np(x) extern __typeof(x) x __attribute__((dllexport))
-# define export_proto(x) sym_rename(x, PREFIX(x)) __attribute__((dllexport))
-# define iexport_proto(x) export_proto(x)
-# define iexport(x) extern char swallow_semicolon
#else
# define export_proto(x) sym_rename(x, PREFIX(x))
# define export_proto_np(x) extern char swallow_semicolon
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 5ef1785e213..1b0c12d1461 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,24 @@
+2009-08-14 David Edelsohn <edelsohn@gnu.org>
+
+ * testsuite/libgomp.graphite: Move from gcc.dg/graphite.
+ * testsuite/libgomp.graphite/graphite_autopar.exp: Delete.
+ * testsuite/libgomp.graphite/graphite.exp: New.
+
+2009-08-05 Andreas Tobler <a.tobler@schweiz.org>
+
+ * testsuite/libgomp.fortran/fortran.exp: Add flags in case of shared
+ only build.
+
+2009-08-04 David Daney <ddaney@caviumnetworks.com>
+
+ * config/linux/mutex.h (gomp_mutex_unlock): Add comment about
+ needed memory barrier semantics.
+ * config/linux/mips/mutex.h: New file.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-16 Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
diff --git a/libgomp/config/linux/mips/mutex.h b/libgomp/config/linux/mips/mutex.h
new file mode 100644
index 00000000000..668cc11b29a
--- /dev/null
+++ b/libgomp/config/linux/mips/mutex.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file is part of the GNU OpenMP Library (libgomp).
+
+ Libgomp is free software; you can 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.
+
+ Libgomp is distributed in the hope that it will be useful, but WITHOUT 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/>. */
+
+/* MIPS needs the same correct usage of __sync_synchronize and
+ __sync_lock_test_and_set as ia64. So we just use its mutex.h. */
+
+#include "config/linux/ia64/mutex.h"
diff --git a/libgomp/config/linux/mutex.h b/libgomp/config/linux/mutex.h
index 07a2156a462..1905ce012fd 100644
--- a/libgomp/config/linux/mutex.h
+++ b/libgomp/config/linux/mutex.h
@@ -48,6 +48,16 @@ static inline void gomp_mutex_lock (gomp_mutex_t *mutex)
extern void gomp_mutex_unlock_slow (gomp_mutex_t *mutex);
static inline void gomp_mutex_unlock (gomp_mutex_t *mutex)
{
+ /* Warning: By definition __sync_lock_test_and_set() does not have
+ proper memory barrier semantics for a mutex unlock operation.
+ However, this default implementation is written assuming that it
+ does, which is true for some targets.
+
+ Targets that require additional memory barriers before
+ __sync_lock_test_and_set to achieve the release semantics of
+ mutex unlock, are encouraged to include
+ "config/linux/ia64/mutex.h" in a target specific mutex.h instead
+ of using this file. */
int val = __sync_lock_test_and_set (mutex, 0);
if (__builtin_expect (val > 1, 0))
gomp_mutex_unlock_slow (mutex);
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index db8e2811a30..9a026a20f87 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -103,7 +103,7 @@ AC_SUBST(toolexeclibdir)
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
diff --git a/libgomp/testsuite/libgomp.fortran/fortran.exp b/libgomp/testsuite/libgomp.fortran/fortran.exp
index 3d6615ffee7..acbfe49e5e3 100644
--- a/libgomp/testsuite/libgomp.fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.fortran/fortran.exp
@@ -1,16 +1,25 @@
+load_lib libgomp-dg.exp
+
+global shlib_ext
+
+set shlib_ext [get_shlib_extension]
set lang_library_path "../libgfortran/.libs"
set lang_link_flags "-lgfortran"
set lang_test_file_found 0
-load_lib libgomp-dg.exp
# Initialize dg.
dg-init
if { $blddir != "" } {
+ # Look for a static libgfortran first.
if [file exists "${blddir}/${lang_library_path}/libgfortran.a"] {
set lang_test_file "${lang_library_path}/libgfortran.a"
set lang_test_file_found 1
+ # We may have a shared only build, so look for a shared libgfortran.
+ } elseif [file exists "${blddir}/${lang_library_path}/libgfortran.${shlib_ext}"] {
+ set lang_test_file "${lang_library_path}/libgfortran.${shlib_ext}"
+ set lang_test_file_found 1
} else {
puts "No libgfortran library found, will not execute fortran tests"
}
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
new file mode 100644
index 00000000000..7f043d83d8b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
@@ -0,0 +1,30 @@
+void abort (void);
+
+void parloop (int N)
+{
+ int i;
+ int x[10000000];
+
+ for (i = 0; i < N; i++)
+ x[i] = i + 3;
+
+ for (i = 0; i < N; i++)
+ {
+ if (x[i] != i + 3)
+ abort ();
+ }
+}
+
+int main(void)
+{
+ parloop(10000000);
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
new file mode 100644
index 00000000000..a198fed658a
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
@@ -0,0 +1,30 @@
+void abort (void);
+
+void parloop (int N)
+{
+ int i, j;
+ int x[10000][10000];
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ x[i][j] = i + j + 3;
+
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ if (x[i][j] != i + j + 3)
+ abort ();
+}
+
+int main(void)
+{
+ parloop(10000);
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-3.c b/libgomp/testsuite/libgomp.graphite/force-parallel-3.c
new file mode 100644
index 00000000000..81b356d5c24
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-3.c
@@ -0,0 +1,38 @@
+void abort (void);
+
+#define N 500
+
+void foo(void)
+{
+ int i,j;
+
+ int Z[2*N+2][2*N+2], B[2*N+2][2*N+2];
+
+ for (i = 0; i < 2*N+2; i++)
+ for (j = 0; j < 2*N+2; j++)
+ B[i][j] = Z[i][j] = i + j;
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <= N; j++)
+ Z[i][j] = Z[j+N][i+N+1];
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <=N; j++)
+ if (Z[i][j] != B[j+N][i+N+1])
+ abort();
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "4 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c
new file mode 100644
index 00000000000..c0c6b1c6e55
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c
@@ -0,0 +1,55 @@
+/* Autopar with IF conditions. */
+
+void abort();
+
+#define N 10000
+#define T 1000
+
+void foo(void)
+{
+ int i;
+ int A[2*N], B[2*N];
+
+ /* Initialize array: carried no dependency. */
+ for (i = 0; i < 2*N; i++)
+ B[i] = A[i] = i;
+
+ for (i = 0; i < N; i++)
+ {
+ if (i < T)
+ /* loop i1: carried no dependency. */
+ A[i] = A[i+T];
+ else
+ /* loop i2: carried dependency. */
+ A[i] = A[i+T+1];
+ }
+
+ /* If it runs a wrong answer, abort. */
+ for (i = 0; i < N; i++)
+ {
+ if (i < T)
+ {
+ if (A[i] != B[i+T])
+ abort();
+ }
+ else
+ {
+ if (A[i] != B[i+T+1])
+ abort();
+ }
+ }
+}
+
+int main(void)
+{
+ foo();
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c
new file mode 100644
index 00000000000..e5392b1b8ff
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c
@@ -0,0 +1,39 @@
+/* Triangle loops. */
+void abort (void);
+
+#define N 500
+
+void foo(void)
+{
+ int i,j;
+ int A[3*N], B[3*N];
+
+ for (i = 0; i < 3*N; i++)
+ B[i] = A[i] = i;
+
+ for (i = 1; i < N; i++)
+ for (j = 1; j < i; j++)
+ /* This loop carried no dependency, it fails
+ at code generation part.*/
+ A[j+N] = A[j] + j;
+
+ for (i = 1; i < N; i++)
+ for (j = 1; j < i; j++)
+ if (A[j+N] != B[j] + j)
+ abort();
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-6.c b/libgomp/testsuite/libgomp.graphite/force-parallel-6.c
new file mode 100644
index 00000000000..e961fc0baa5
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-6.c
@@ -0,0 +1,38 @@
+#define N 500
+
+int foo(void)
+{
+ int i, j, k;
+ int X[2*N], Y[2*N], B[2*N];
+ int A[2*N][2*N], C[2*N][2*N];
+
+ for (i = 1; i <= N; i++)
+ {
+ X[i] = Y[i] + 10;
+ for (j = 1; j <= N; j++)
+ {
+ B[j] = A[j][N];
+ for (k = 1; k <= N; k++)
+ {
+ A[j+1][k] = B[j] + C[j][k];
+ }
+ Y[i+j] = A[j+1][N];
+ }
+ }
+
+ return A[1][5]*B[6];
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c
new file mode 100644
index 00000000000..9ba9007fe31
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c
@@ -0,0 +1,36 @@
+#define N 500
+
+int foo(void)
+{
+ int i, j, k;
+ int A[N+5][N+5][N+5];
+
+ /* Loop i: carried no dependency. */
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ for (k = 0; k < N; k++)
+ A[k+1][j+2][i+1] = A[k][j][i+1];
+
+ for (i = 0; i < N; i++)
+ /* Loop j: carried no dependency. */
+ for (j = 0; j < N; j++)
+ /* Loop k: carreid no dependency. */
+ for (k = 0; k < N; k++)
+ A[i+1][j][k] = A[i][j][k+1];
+
+ return A[1][5][2];
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
new file mode 100644
index 00000000000..28b9a2a06b9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c
@@ -0,0 +1,40 @@
+#define N 1500
+
+int foo(void)
+{
+ int i, j;
+ int x[N][N], y[N];
+
+ for (i = 0; i < N; i++)
+ {
+ y[i] = i;
+
+ for (j = 0; j < N; j++)
+ {
+ if (j > 500)
+ {
+ x[i][j] = i + j + 3;
+ y[j] = i*j + 10;
+ }
+ else
+ x[i][j] = x[i][j]*3;
+ }
+ }
+
+ return x[2][5]*y[8];
+}
+
+int main(void)
+{
+ foo();
+
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-9.c b/libgomp/testsuite/libgomp.graphite/force-parallel-9.c
new file mode 100644
index 00000000000..36551905f0c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-9.c
@@ -0,0 +1,37 @@
+void abort (void);
+
+#define N 500
+
+void foo(void)
+{
+ int i,j;
+
+ int Z[2*N+2][2*N+2], B[2*N+2][2*N+2];
+
+ for (i = 0; i < 2*N+2; i++)
+ for (j = 0; j < 2*N+2; j++)
+ B[i][j] = Z[i][j] = i + j;
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <= N; j++)
+ Z[i][j] = Z[j+N][i+N+1];
+
+ for (i = 0; i <= N; i++)
+ for (j = 0; j <=N; j++)
+ if (Z[i][j] != B[j+N][i+N+1])
+ abort();
+}
+
+int main(void)
+{
+ foo();
+ return 0;
+}
+
+/* Check that parallel code generation part make the right answer. */
+/* { dg-final { scan-tree-dump-times "4 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { cleanup-tree-dump "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.0" 5 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "loopfn.1" 5 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "parloops" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/graphite.exp b/libgomp/testsuite/libgomp.graphite/graphite.exp
new file mode 100644
index 00000000000..466e447bde8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.graphite/graphite.exp
@@ -0,0 +1,55 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+if [info exists lang_library_path] then {
+ unset lang_library_path
+ unset lang_link_flags
+}
+if [info exists lang_test_file] then {
+ unset lang_test_file
+}
+
+load_lib libgomp-dg.exp
+
+if ![check_effective_target_pthread] {
+ return
+}
+
+if ![check_effective_target_fgraphite] {
+ return
+}
+
+# Flags for force-parallel-*.c testcases.
+set PARALLEL_CFLAGS "-ansi -pedantic-errors -O2 \
+-ftree-parallelize-loops=4 -floop-parallelize-all \
+-fdump-tree-parloops-details -fdump-tree-optimized \
+-fno-loop-strip-mine -fdump-tree-graphite-all"
+
+# Initialize `dg'.
+dg-init
+
+# Gather a list of all tests.
+set tests [lsort [find $srcdir/$subdir *.c]]
+
+set ld_library_path $always_ld_library_path
+append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
+set_ld_library_path_env_vars
+
+# Run the tests
+dg-runtest $tests "" $PARALLEL_CFLAGS
+
+# All done.
+dg-finish
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 16f541ed275..b2f41208bf8 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, configure_deps): New variables.
+ ($(srcdir)/configure): New rule, active only in maintainer mode.
+
2009-07-29 Douglas B Rupp <rupp@gnat.com>
* make-temp-file.c (choose_tmpdir): Try standard temp logical on VMS.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 20a7210a1a1..e8f4f4d679a 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -459,6 +459,16 @@ stamp-h: $(srcdir)/config.in config.status Makefile
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
+AUTOCONF = autoconf
+configure_deps = $(srcdir)/aclocal.m4 \
+ $(srcdir)/../config/acx.m4 \
+ $(srcdir)/../config/no-executables.m4 \
+ $(srcdir)/../config/override.m4 \
+ $(srcdir)/../config/warnings.m4 \
+
+$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+
# Depending on config.h makes sure that config.status has been re-run
# if needed. This prevents problems with parallel builds, in case
# subdirectories need to run config.status also.
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 02fc607e328..7f7aeac7667 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,37 @@
+2009-08-17 Andrew Haley <aph@redhat.com>
+
+ * Makefile.am (libgcj_bc_la_LIBADD): Delete.
+ * libgcj.spec.in: (LIBGCJ_BC_SPEC): New spec.
+ * configure.ac (LIBGCJ_BC_SPEC): New spec.
+
+2009-08-17 Andrew Haley <aph@redhat.com>
+
+ * Makefile.in,
+ include/Makefile.in,
+ testsuite/Makefile.in,
+ gcj/Makefile.in: Regenerate.
+
+2009-08-14 Kai Tietz <kai.tietz@onevision.com>
+
+ * gnu/java/security/jce/prng/natVMSecureRandomWin32.cc: Add include of
+ java/lang/UnsupportedOperationException.h file.
+
+2009-08-12 Andrew Haley <aph@redhat.com>
+
+ * sysdep/arm/locks.h: Use atomic builtins For Linux EABI.
+ * configure.ac: Add ATOMICSPEC.
+ * libgcj.spec.in: Likewise.
+ * configure.host (arm*-linux*): Add -Wno-abi to cxxflags.
+ (testsuite/libjava.jvmti/jvmti-interp.exp): Likewise.
+ (testsuite/libjava.jvmti/jvmti.exp): Likewise.
+ (testsuite/libjava.jni/jni.exp): Likewise.
+ Set ATOMICSPEC.
+ Set LDFLAGS to work around libtool feature.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-28 David Daney <ddaney@caviumnetworks.com>
* gnu/gcj/util/natGCInfo.cc (nomem_handler): Use oomDumpName as
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 839d2963c52..938f423ba81 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -358,10 +358,10 @@ lib_gnu_awt_xlib_la_LINK = $(LIBLINK)
## Support for libgcj_bc: dummy shared library.
##
## This lets us have one soname in BC objects and another in C++ ABI objects.
+## This library is not linked against libgcj.
libgcj_bc_la_SOURCES = libgcj_bc.c
libgcj_bc_la_LDFLAGS = -rpath $(toolexeclibdir) -no-static -version-info 1:0:0 \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
-libgcj_bc_la_LIBADD = libgcj.la
libgcj_bc_la_DEPENDENCIES = libgcj.la
libgcj_bc_la_LINK = $(LIBLINK)
## This is specific to Linux/{Free,Net,Open}BSD/Hurd and perhaps few others.
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index 4e2c89f0393..cc0dd011366 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -450,6 +450,7 @@ am_libgcj_la_OBJECTS = prims.lo jni.lo exception.lo stacktrace.lo \
$(am__objects_8) $(am__objects_9) $(am__objects_10) \
$(am__objects_11) $(am__objects_12) $(am__objects_13)
libgcj_la_OBJECTS = $(am_libgcj_la_OBJECTS)
+libgcj_bc_la_LIBADD =
am_libgcj_bc_la_OBJECTS = libgcj_bc.lo
libgcj_bc_la_OBJECTS = $(am_libgcj_bc_la_OBJECTS)
@USE_LIBGCJ_BC_TRUE@am_libgcj_bc_la_rpath = -rpath $(toolexeclibdir)
@@ -597,6 +598,7 @@ ANONVERSCRIPT_TRUE = @ANONVERSCRIPT_TRUE@
ANTLR_JAR = @ANTLR_JAR@
AR = @AR@
AS = @AS@
+ATOMICSPEC = @ATOMICSPEC@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -701,6 +703,7 @@ LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
+LIBGCJ_BC_SPEC = @LIBGCJ_BC_SPEC@
LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@
LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@
LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@
@@ -1073,7 +1076,6 @@ libgcj_bc_la_SOURCES = libgcj_bc.c
libgcj_bc_la_LDFLAGS = -rpath $(toolexeclibdir) -no-static -version-info 1:0:0 \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS)
-libgcj_bc_la_LIBADD = libgcj.la
libgcj_bc_la_DEPENDENCIES = libgcj.la
libgcj_bc_la_LINK = $(LIBLINK)
libgcj_bc_dummy_LINK = $(CC) -L$(here)/.libs $(CFLAGS) $(LDFLAGS) -shared \
diff --git a/libjava/configure b/libjava/configure
index 9206e9153ca..35165629864 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -459,7 +459,7 @@ ac_includes_default="\
#endif"
ac_subdirs_all="$ac_subdirs_all classpath libltdl"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_libsubdir build_subdir host_subdir target_subdir multi_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs ANTLR_JAR CREATE_GJDOC_TRUE CREATE_GJDOC_FALSE JAVA_MAINTAINER_MODE_TRUE JAVA_MAINTAINER_MODE_FALSE CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB JAR ZIP UNZIP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJ_LD_SYMBOLIC_FUNCTIONS LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE X_AWT_TRUE X_AWT_FALSE GCJ_FOR_ECJX GCJH host_exeext INCLTDL LIBLTDL DIRLTDL LIBTOOL SED EGREP FGREP GREP DUMPBIN ac_ct_DUMPBIN NM OBJDUMP ac_ct_OBJDUMP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 CPP CPPFLAGS CXXCPP GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE ECJ_BUILD_JAR ECJ_JAR BUILD_ECJ1_TRUE BUILD_ECJ1_FALSE INSTALL_ECJ_JAR_TRUE INSTALL_ECJ_JAR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME SUPPRESS_LIBGCJ_BC_TRUE SUPPRESS_LIBGCJ_BC_FALSE BUILD_LIBGCJ_REDUCED_REFLECTION_TRUE BUILD_LIBGCJ_REDUCED_REFLECTION_FALSE INTERPRETER INTERPRETER_TRUE INTERPRETER_FALSE LIBFFI LIBFFIINCS PLATFORM USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS extra_ldflags_libjava extra_gij_ldflags extra_ldflags LIBSTDCXXSPEC LIBGCJTESTSPEC GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADSTARTFILESPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE USE_LIBGCJ_BC_TRUE USE_LIBGCJ_BC_FALSE LIBGCJ_SPEC HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV PKG_CONFIG GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE ENABLE_SHARED_TRUE ENABLE_SHARED_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE INSTALL_BINARIES_TRUE INSTALL_BINARIES_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir GCJVERSION dbexecdir gcjsubdir gxx_include_dir libstdcxx_incdir PERL SYSDEP_SOURCES ANONVERSCRIPT_TRUE ANONVERSCRIPT_FALSE LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here python_mod_dir python_mod_dir_expanded MAKE INSTALL_AOT_RPM_TRUE INSTALL_AOT_RPM_FALSE CREATE_JAVA_HOME_TRUE CREATE_JAVA_HOME_FALSE gcc_suffix JAVA_VERSION BUILD_VERSION JVM_ROOT_DIR JVM_JAR_ROOT_DIR JVM_JAR_DIR JRE_DIR JRE_LNK SDK_LNK SDK_BIN_DIR SDK_LIB_DIR SDK_INCLUDE_DIR JRE_BIN_DIR JRE_LIB_DIR GCJ_BIN_DIR CPU OS LIBDIR LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_libsubdir build_subdir host_subdir target_subdir multi_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs ANTLR_JAR CREATE_GJDOC_TRUE CREATE_GJDOC_FALSE JAVA_MAINTAINER_MODE_TRUE JAVA_MAINTAINER_MODE_FALSE CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB JAR ZIP UNZIP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJ_LD_SYMBOLIC_FUNCTIONS LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE X_AWT_TRUE X_AWT_FALSE GCJ_FOR_ECJX GCJH host_exeext INCLTDL LIBLTDL DIRLTDL LIBTOOL SED EGREP FGREP GREP DUMPBIN ac_ct_DUMPBIN NM OBJDUMP ac_ct_OBJDUMP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 CPP CPPFLAGS CXXCPP GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE ECJ_BUILD_JAR ECJ_JAR BUILD_ECJ1_TRUE BUILD_ECJ1_FALSE INSTALL_ECJ_JAR_TRUE INSTALL_ECJ_JAR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME SUPPRESS_LIBGCJ_BC_TRUE SUPPRESS_LIBGCJ_BC_FALSE BUILD_LIBGCJ_REDUCED_REFLECTION_TRUE BUILD_LIBGCJ_REDUCED_REFLECTION_FALSE INTERPRETER INTERPRETER_TRUE INTERPRETER_FALSE LIBFFI LIBFFIINCS PLATFORM USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS extra_ldflags_libjava extra_gij_ldflags extra_ldflags LIBSTDCXXSPEC LIBGCJTESTSPEC GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADSTARTFILESPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE USE_LIBGCJ_BC_TRUE USE_LIBGCJ_BC_FALSE LIBGCJ_SPEC LIBGCJ_BC_SPEC HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV PKG_CONFIG GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC ATOMICSPEC NATIVE_TRUE NATIVE_FALSE ENABLE_SHARED_TRUE ENABLE_SHARED_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE INSTALL_BINARIES_TRUE INSTALL_BINARIES_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir GCJVERSION dbexecdir gcjsubdir gxx_include_dir libstdcxx_incdir PERL SYSDEP_SOURCES ANONVERSCRIPT_TRUE ANONVERSCRIPT_FALSE LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here python_mod_dir python_mod_dir_expanded MAKE INSTALL_AOT_RPM_TRUE INSTALL_AOT_RPM_FALSE CREATE_JAVA_HOME_TRUE CREATE_JAVA_HOME_FALSE gcc_suffix JAVA_VERSION BUILD_VERSION JVM_ROOT_DIR JVM_JAR_ROOT_DIR JVM_JAR_DIR JRE_DIR JRE_LNK SDK_LNK SDK_BIN_DIR SDK_LIB_DIR SDK_INCLUDE_DIR JRE_BIN_DIR JRE_LIB_DIR GCJ_BIN_DIR CPU OS LIBDIR LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -20948,9 +20948,9 @@ if test -d sysdep; then true; else mkdir sysdep; fi
LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
if test "$use_libgcj_bc" = yes; then
LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:-lgcj;:-lgcj_bc}"
+ LIBGCJ_BC_SPEC="%{findirect-dispatch:-fPIC}"
fi
-
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
if test "$enable_hash_synchronization" = yes && test "$THREADS" != "none"; then
@@ -26421,6 +26421,7 @@ fi
+
if test "$NATIVE" = yes; then
NATIVE_TRUE=
NATIVE_FALSE='#'
@@ -29968,6 +29969,7 @@ s,@USING_NO_THREADS_FALSE@,$USING_NO_THREADS_FALSE,;t t
s,@USE_LIBGCJ_BC_TRUE@,$USE_LIBGCJ_BC_TRUE,;t t
s,@USE_LIBGCJ_BC_FALSE@,$USE_LIBGCJ_BC_FALSE,;t t
s,@LIBGCJ_SPEC@,$LIBGCJ_SPEC,;t t
+s,@LIBGCJ_BC_SPEC@,$LIBGCJ_BC_SPEC,;t t
s,@HASH_SYNC_SPEC@,$HASH_SYNC_SPEC,;t t
s,@USING_GCC_TRUE@,$USING_GCC_TRUE,;t t
s,@USING_GCC_FALSE@,$USING_GCC_FALSE,;t t
@@ -29989,6 +29991,7 @@ s,@CHECKREFSPEC@,$CHECKREFSPEC,;t t
s,@EXCEPTIONSPEC@,$EXCEPTIONSPEC,;t t
s,@BACKTRACESPEC@,$BACKTRACESPEC,;t t
s,@IEEESPEC@,$IEEESPEC,;t t
+s,@ATOMICSPEC@,$ATOMICSPEC,;t t
s,@NATIVE_TRUE@,$NATIVE_TRUE,;t t
s,@NATIVE_FALSE@,$NATIVE_FALSE,;t t
s,@ENABLE_SHARED_TRUE@,$ENABLE_SHARED_TRUE,;t t
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 3074a0c0fd4..2057bf3d6d6 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -159,7 +159,7 @@ CXXFLAGS="$CXXFLAGS -fno-builtin"
AC_PROG_CC
AC_PROG_CXX
CXXFLAGS="$save_CXXFLAGS"
-m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(LDFLAGS)
@@ -1078,8 +1078,10 @@ AC_CONFIG_LINKS(sysdep/descriptor.h:$descriptor_h)
LIBGCJ_SPEC="%{s-bc-abi:} -lgcj"
if test "$use_libgcj_bc" = yes; then
LIBGCJ_SPEC="%{static|static-libgcj|!s-bc-abi:-lgcj;:-lgcj_bc}"
+ LIBGCJ_BC_SPEC="%{findirect-dispatch:-fPIC}"
fi
AC_SUBST(LIBGCJ_SPEC)
+AC_SUBST(LIBGCJ_BC_SPEC)
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
@@ -1447,6 +1449,7 @@ AC_SUBST(CHECKREFSPEC)
AC_SUBST(EXCEPTIONSPEC)
AC_SUBST(BACKTRACESPEC)
AC_SUBST(IEEESPEC)
+AC_SUBST(ATOMICSPEC)
AM_CONDITIONAL(NATIVE, test "$NATIVE" = yes)
AM_CONDITIONAL(ENABLE_SHARED, test "$enable_shared" = yes)
diff --git a/libjava/configure.host b/libjava/configure.host
index 79ce4d68d95..1d1b7085e11 100644
--- a/libjava/configure.host
+++ b/libjava/configure.host
@@ -69,6 +69,7 @@ DIVIDESPEC=-fuse-divide-subroutine
EXCEPTIONSPEC=-fnon-call-exceptions
CHECKREFSPEC=
BACKTRACESPEC=
+ATOMICSPEC=
# This case statement supports per-CPU defaults.
case "${host}" in
@@ -87,6 +88,11 @@ case "${host}" in
libgcj_interpreter=yes
sysdeps_dir=arm
fallback_backtrace_h=sysdep/arm/backtrace.h
+ libgcj_cxxflags=-Wno-abi
+ ATOMICSPEC=-fuse-atomic-builtins
+ # Work around a strange libtool feature that causes libraries
+ # to be linked with libgcc_s but not libgcc.
+ LDFLAGS="${LDFLAGS} -Wl,-lgcc"
;;
mips-tx39-*|mipstx39-unknown-*)
libgcj_flags="${libgcj_flags} -G 0"
diff --git a/libjava/gcj/Makefile.in b/libjava/gcj/Makefile.in
index 220f9b056c9..86a19fd2f17 100644
--- a/libjava/gcj/Makefile.in
+++ b/libjava/gcj/Makefile.in
@@ -93,6 +93,7 @@ ANONVERSCRIPT_TRUE = @ANONVERSCRIPT_TRUE@
ANTLR_JAR = @ANTLR_JAR@
AR = @AR@
AS = @AS@
+ATOMICSPEC = @ATOMICSPEC@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -197,6 +198,7 @@ LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
+LIBGCJ_BC_SPEC = @LIBGCJ_BC_SPEC@
LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@
LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@
LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@
diff --git a/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc b/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc
index 913572dad74..66eaf82215f 100755
--- a/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc
+++ b/libjava/gnu/java/security/jce/prng/natVMSecureRandomWin32.cc
@@ -19,6 +19,7 @@ details. */
#include <gcj/cni.h>
#include <java/lang/InternalError.h>
+#include <java/lang/UnsupportedOperationException.h>
#include <gnu/java/security/jce/prng/VMSecureRandom.h>
jint
diff --git a/libjava/include/Makefile.in b/libjava/include/Makefile.in
index e262cdab997..f7e58eb26fc 100644
--- a/libjava/include/Makefile.in
+++ b/libjava/include/Makefile.in
@@ -92,6 +92,7 @@ ANONVERSCRIPT_TRUE = @ANONVERSCRIPT_TRUE@
ANTLR_JAR = @ANTLR_JAR@
AR = @AR@
AS = @AS@
+ATOMICSPEC = @ATOMICSPEC@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -196,6 +197,7 @@ LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
+LIBGCJ_BC_SPEC = @LIBGCJ_BC_SPEC@
LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@
LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@
LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@
diff --git a/libjava/libgcj.spec.in b/libjava/libgcj.spec.in
index 72d715f5acd..55eb0c2e658 100644
--- a/libjava/libgcj.spec.in
+++ b/libjava/libgcj.spec.in
@@ -9,4 +9,4 @@
%rename lib liborig
*lib: @LD_START_STATIC_SPEC@ @LIBGCJ_SPEC@ @LD_FINISH_STATIC_SPEC@ -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) @LIBSTDCXXSPEC@ %(liborig)
-*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ -fkeep-inline-functions
+*jc1: @HASH_SYNC_SPEC@ @DIVIDESPEC@ @CHECKREFSPEC@ @JC1GCSPEC@ @EXCEPTIONSPEC@ @BACKTRACESPEC@ @IEEESPEC@ @ATOMICSPEC@ @LIBGCJ_BC_SPEC@ -fkeep-inline-functions
diff --git a/libjava/sysdep/arm/locks.h b/libjava/sysdep/arm/locks.h
index 1f7763de3f0..2a81e1111bc 100644
--- a/libjava/sysdep/arm/locks.h
+++ b/libjava/sysdep/arm/locks.h
@@ -13,6 +13,59 @@ details. */
typedef size_t obj_addr_t; /* Integer type big enough for object */
/* address. */
+#if (__ARM_EABI__ && __linux)
+
+// Atomically replace *addr by new_val if it was initially equal to old.
+// Return true if the comparison succeeded.
+// Assumed to have acquire semantics, i.e. later memory operations
+// cannot execute before the compare_and_swap finishes.
+inline static bool
+compare_and_swap(volatile obj_addr_t *addr,
+ obj_addr_t old,
+ obj_addr_t new_val)
+{
+ return __sync_bool_compare_and_swap(addr, old, new_val);
+}
+
+// Set *addr to new_val with release semantics, i.e. making sure
+// that prior loads and stores complete before this
+// assignment.
+inline static void
+release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
+{
+ __sync_synchronize();
+ *(addr) = new_val;
+}
+
+// Compare_and_swap with release semantics instead of acquire semantics.
+// On many architecture, the operation makes both guarantees, so the
+// implementation can be the same.
+inline static bool
+compare_and_swap_release(volatile obj_addr_t *addr,
+ obj_addr_t old,
+ obj_addr_t new_val)
+{
+ return __sync_bool_compare_and_swap(addr, old, new_val);
+}
+
+// Ensure that subsequent instructions do not execute on stale
+// data that was loaded from memory before the barrier.
+// On X86, the hardware ensures that reads are properly ordered.
+inline static void
+read_barrier()
+{
+ __sync_synchronize();
+}
+
+// Ensure that prior stores to memory are completed with respect to other
+// processors.
+inline static void
+write_barrier()
+{
+ __sync_synchronize();
+}
+
+#else
/* Atomic compare and exchange. These sequences are not actually
atomic; there is a race if *ADDR != OLD_VAL and we are preempted
@@ -54,8 +107,8 @@ release_set(volatile obj_addr_t *addr, obj_addr_t new_val)
inline static bool
compare_and_swap_release(volatile obj_addr_t *addr,
- obj_addr_t old,
- obj_addr_t new_val)
+ obj_addr_t old,
+ obj_addr_t new_val)
{
return compare_and_swap(addr, old, new_val);
}
@@ -77,3 +130,4 @@ write_barrier()
}
#endif
+#endif
diff --git a/libjava/testsuite/Makefile.in b/libjava/testsuite/Makefile.in
index 22a726e5de7..9510616af71 100644
--- a/libjava/testsuite/Makefile.in
+++ b/libjava/testsuite/Makefile.in
@@ -81,6 +81,7 @@ ANONVERSCRIPT_TRUE = @ANONVERSCRIPT_TRUE@
ANTLR_JAR = @ANTLR_JAR@
AR = @AR@
AS = @AS@
+ATOMICSPEC = @ATOMICSPEC@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
@@ -185,6 +186,7 @@ LIBFFI = @LIBFFI@
LIBFFIINCS = @LIBFFIINCS@
LIBGCJDEBUG = @LIBGCJDEBUG@
LIBGCJTESTSPEC = @LIBGCJTESTSPEC@
+LIBGCJ_BC_SPEC = @LIBGCJ_BC_SPEC@
LIBGCJ_CFLAGS = @LIBGCJ_CFLAGS@
LIBGCJ_CXXFLAGS = @LIBGCJ_CXXFLAGS@
LIBGCJ_JAVAFLAGS = @LIBGCJ_JAVAFLAGS@
diff --git a/libjava/testsuite/libjava.jni/jni.exp b/libjava/testsuite/libjava.jni/jni.exp
index 65051287b5a..68dbd279033 100644
--- a/libjava/testsuite/libjava.jni/jni.exp
+++ b/libjava/testsuite/libjava.jni/jni.exp
@@ -165,6 +165,11 @@ proc gcj_jni_test_one {file} {
lappend cxxflaglist "-lstdc++"
}
+ # ARM C++ emits an ABI warning for varargs.
+ if { [istarget "arm*"] } {
+ lappend cxxflaglist "-Wno-abi"
+ }
+
set cxxflags [join $cxxflaglist]
}
diff --git a/libjava/testsuite/libjava.jvmti/jvmti-interp.exp b/libjava/testsuite/libjava.jvmti/jvmti-interp.exp
index e81eda52025..62c82e92afc 100644
--- a/libjava/testsuite/libjava.jvmti/jvmti-interp.exp
+++ b/libjava/testsuite/libjava.jvmti/jvmti-interp.exp
@@ -32,7 +32,12 @@ proc gcj_jni_compile_c_to_so {file {options {}}} {
set so_extension "so"
set so_flag "-shared"
}
-
+
+ # ARM C++ emits an ABI warning for varargs.
+ if { [istarget "arm*"] } {
+ lappend options "additional_flags=-Wno-abi"
+ }
+
set filename [file tail $file]
set name [file rootname $filename]
set soname lib${name}.${so_extension}
diff --git a/libjava/testsuite/libjava.jvmti/jvmti.exp b/libjava/testsuite/libjava.jvmti/jvmti.exp
index 578eeb1ef3f..571952e807c 100644
--- a/libjava/testsuite/libjava.jvmti/jvmti.exp
+++ b/libjava/testsuite/libjava.jvmti/jvmti.exp
@@ -16,6 +16,10 @@ proc gcj_jvmti_compile_cxx_to_o {file {options {}}} {
lappend options "additional_flags=-I$srcdir/.."
# Find jvmti.h, jvmti_md.h, jvmti-int.h, jvm.h requirements
lappend options "additional_flags=-I$srcdir/../include -I$srcdir/../classpath/include -I$objdir/../include -I$objdir/../../boehm-gc/include "
+ # ARM C++ emits an ABI warning for varargs.
+ if { [istarget "arm*"] } {
+ lappend options "additional_flags=-Wno-abi"
+ }
set x [libjava_prune_warnings \
[target_compile $file $oname object $options]]
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index edb0958cd40..2312b20fc42 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-07-16 Joseph Myers <joseph@codesourcery.com>
* configure: Regenerate.
diff --git a/libmudflap/configure.ac b/libmudflap/configure.ac
index 8ce99a10270..c7d69d549c3 100644
--- a/libmudflap/configure.ac
+++ b/libmudflap/configure.ac
@@ -39,7 +39,7 @@ AC_LANG_C
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index 88f8b8d64af..a4c963a6e5c 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,13 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * Makefile.in (AUTOCONF, ACLOCAL, ACLOCAL_AMFLAGS, aclocal_deps):
+ New variables.
+ ($(srcdir)/configure, $(srcdir)/aclocal.m4): New rules.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-04-09 Nick Clifton <nickc@redhat.com>
* sendmsg.c: Change copyright header to refer to version 3 of
diff --git a/libobjc/Makefile.in b/libobjc/Makefile.in
index 85550035521..98539cfda41 100644
--- a/libobjc/Makefile.in
+++ b/libobjc/Makefile.in
@@ -333,9 +333,25 @@ config.status: configure
CONFIG_SITE=no-such-file CC='$(CC)' AR='$(AR)' CFLAGS='$(CFLAGS)' \
CPPFLAGS='$(CPPFLAGS)' $(SHELL) config.status --recheck
-${srcdir}/configure: @MAINT@ configure.ac
+AUTOCONF = autoconf
+ACLOCAL = aclocal
+ACLOCAL_AMFLAGS = -I ../config -I ..
+aclocal_deps = \
+ $(srcdir)/../config/multi.m4 \
+ $(srcdir)/../config/override.m4 \
+ $(srcdir)/../config/proginstall.m4 \
+ $(srcdir)/../ltoptions.m4 \
+ $(srcdir)/../ltsugar.m4 \
+ $(srcdir)/../ltversion.m4 \
+ $(srcdir)/../lt~obsolete.m4 \
+ $(srcdir)/acinclude.m4
+
+$(srcdir)/configure: @MAINT@ configure.ac $(srcdir)/aclocal.m4
rm -f config.cache
- cd ${srcdir} && autoconf
+ cd $(srcdir) && $(AUTOCONF)
+
+$(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
install: install-libs install-headers
diff --git a/libobjc/aclocal.m4 b/libobjc/aclocal.m4
index 0b3d8b741f7..69611d54e76 100644
--- a/libobjc/aclocal.m4
+++ b/libobjc/aclocal.m4
@@ -154,11 +154,11 @@ if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
fi
])
-m4_include([../config/multi.m4])
-m4_include([../config/override.m4])
-m4_include([../config/proginstall.m4])
m4_include([../ltoptions.m4])
m4_include([../ltsugar.m4])
m4_include([../ltversion.m4])
m4_include([../lt~obsolete.m4])
+m4_include([../config/multi.m4])
+m4_include([../config/override.m4])
+m4_include([../config/proginstall.m4])
m4_include([acinclude.m4])
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index dd7751eb3cc..036e34c9607 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -153,7 +153,7 @@ GCC_NO_EXECUTABLES
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# extra LD Flags which are required for targets
case "${host}" in
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index d8d3c7410c0..89d23ae6bf3 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-04-13 Ozkan Sezer <sezeroz@gmail.com>
PR target/39062
diff --git a/libssp/configure.ac b/libssp/configure.ac
index f3a66ec975a..ff6f2de9799 100644
--- a/libssp/configure.ac
+++ b/libssp/configure.ac
@@ -41,7 +41,7 @@ AC_LANG_C
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 6e7b73d90b3..2ab32e3e839 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,554 @@
+2009-08-17 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/30_threads/packaged_task/requirements/typedefs.cc: New.
+
+2009-08-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac: Move guarded checks for CC and CXX ...
+ * acinclude.m4 (GLIBCXX_CONFIGURE): ... from here.
+ * configure: Regenerate.
+
+2009-08-14 Edward Smith-Rowland <3dw4rd@verizon.net>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/41061
+ * include/bits/random.h (operator<<(std::basic_ostream<>&,
+ const std::lognormal_distribution<>&),
+ operator>>(std::basic_istream<>&, std::lognormal_distribution<>&),
+ operator<<(std::basic_ostream<>&, const std::gamma_distribution<>&),
+ operator>>(std::basic_istream<>&, std::gamma_distribution<>&),
+ operator<<(std::basic_ostream<>&,
+ const std::chi_squared_distribution<>&),
+ operator>>(std::basic_istream<>&, std::chi_squared_distribution<>&),
+ operator<<(std::basic_ostream<>&,
+ const std::fisher_f_distribution<>&),
+ operator>>(std::basic_istream<>&, std::fisher_f_distribution<>&),
+ operator<<(std::basic_ostream<>&,
+ const std::student_t_distribution<>&),
+ operator>>(std::basic_istream<>&, std::student_t_distribution<>&),
+ operator<<(std::basic_ostream<>&,
+ const std::negative_binomial_distribution<>&)): Declare friend.
+ * testsuite/26_numerics/random/uniform_real_distribution/operators/
+ serialize.cc: New.
+ * testsuite/26_numerics/random/piecewise_constant_distribution/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/chi_squared_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/normal_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_int_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/poisson_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/bernoulli_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/discrete_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/weibull_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/negative_binomial_distribution/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/cauchy_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/gamma_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/fisher_f_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/exponential_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/lognormal_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/binomial_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/extreme_value_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_linear_distribution/
+ operators/serialize.cc
+ * testsuite/26_numerics/random/student_t_distribution/operators/
+ serialize.cc: Likewise.
+ * testsuite/26_numerics/random/geometric_distribution/operators/
+ serialize.cc: Likewise.
+
+2009-08-14 Edward Smith-Rowland <3dw4rd@verizon.net>
+
+ * include/bits/stl_tree.h: In C++0x mode make erase return
+ an iterator as per DR 130.
+ * include/bits/stl_set.h: Same.
+ * include/bits/stl_multiset.h: Same.
+ * include/bits/stl_map.h: Same.
+ * include/bits/stl_multimap.h: Same.
+ * doc/xml/manual/intro.xml: Document.
+ * testsuite/23_containers/set/dr130.cc: New.
+ * testsuite/23_containers/multiset/dr130.cc: New.
+ * testsuite/23_containers/map/dr130.cc: New.
+ * testsuite/23_containers/multimap/dr130.cc: New.
+
+2009-08-14 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/ext/pointer.h: Add pragma system_header, use
+ _GLIBCXX_USE_LONG_LONG, macro cleanup.
+
+2009-08-14 Uros Bizjak <ubizjak@gmail.com>
+
+ * src/compatibility-ldbl.cc: Include cmath.
+
+2009-08-13 Benjamin Kosnik <bkoz@redhat.com>
+
+ * src/compatibility-ldbl.cc: Include tr1/functional.
+
+2009-08-12 Benjamin Kosnik <bkoz@redhat.com>
+
+ * src/compatibility-ldbl.cc: Add explicit namespace scope.
+
+2009-08-11 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/precompiled/extc++.h: Don't include TR1 if C++0x.
+ * include/precompiled/stdc++.h: Don't include cassert if
+ _GLIBCXX_NO_ASSERT defined.
+ * include/ext/cast.h (_GLIBCXX_BEGIN_NAMESPACE): Remove extra
+ semi-colon.
+ * include/ext/pointer.h (_GCC_CXX_POINTER_COMPARISON_OPERATION_SET):
+ Same.
+
+ * testsuite/17_intro/headers/all.cc: Move into dialect-specific
+ directory.
+ * testsuite/17_intro/headers/all_pedantic_errors.cc: Same.
+ * testsuite/17_intro/headers/all_assert_neg.cc: Same.
+ * testsuite/17_intro/headers/all_c++200x_compatibility.cc: Same.
+
+ * testsuite/17_intro/headers/c++1998/all.cc: Use extc++.h include.
+ * testsuite/17_intro/headers/c++1998/stdc++.cc: Converted all.cc,
+ use stdc++.h include.
+ * testsuite/17_intro/headers/c++1998/all_pedantic_errors.cc: Same.
+ * testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc: Same.
+ * testsuite/17_intro/headers/c++1998/all_c++200x_compatibility.cc: Same.
+ * testsuite/17_intro/headers/c++1998/all_no_exceptions.cc: New.
+ * testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc: To...
+ * testsuite/17_intro/headers/c++1998/stdc++_multiple_inclusion.cc
+ ...this.
+ * testsuite/17_intro/headers/c++200x/all.cc: To...
+ * testsuite/17_intro/headers/c++200x/stdc++.cc: ..this.
+ * testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc: To...
+ * testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc:
+ ...this.
+ * testsuite/17_intro/headers/c++200x/all_no_exceptions.cc: New.
+ * testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc: New.
+
+2009-08-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/future: Move error handling bits outside macro guard.
+ * src/future.cc: Adjust.
+
+ * include/precompiled/stdc++.h: Add future.
+ * doc/xml/manual/using.xml: Same.
+
+2009-08-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ * src/hashtable.cc: Just definitions.
+ * src/hashtable_c++0x.cc: Compile C++0x versions.
+ * src/hash.cc: Same.
+ * src/hash_c++0x.cc: Same.
+ src/hash_tr1.cc: Compile TR1 versions.
+ src/hashtable_tr1.cc: Same.
+
+ * src/limits_c++0x.cc: Sync build error handling.
+
+ * src/Makefile.am (sources): Change hash.cc to hash_tr1.cc,
+ hashtable.cc to hashtable_tr1.cc.
+ * src/Makefile.in: Regenerate.
+
+2009-08-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/tr1_impl/functional: Doxygen markup.
+
+ * doc/html/*: Regenerate.
+
+2009-08-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ * include/std/future: Fixes for -fno-exceptions.
+ * include/bits/functexcept.h: Same.
+ * libsupc++/exception_ptr.h: Same.
+ * src/pool_allocator.cc: Same.
+ * src/future.cc: Same.
+ * src/functexcept.cc: Same.
+ * config/abi/pre/gnu.ver: New exports.
+ * testsuite/30_threads/packaged_task/cons/assign_neg.cc: Adjust.
+ * testsuite/30_threads/packaged_task/cons/copy_neg.cc: Same.
+ * testsuite/30_threads/unique_future/cons/assign_neg.cc: Same.
+ * testsuite/30_threads/unique_future/cons/copy_neg.cc: Same.
+ * testsuite/30_threads/shared_future/cons/assign_neg.cc: Same.
+ * testsuite/30_threads/promise/cons/assign_neg.cc: Same.
+ * testsuite/30_threads/promise/cons/copy_neg.cc: Same.
+
+ * testsuite/23_containers/deque/operators/1.cc: Separate in two...
+ * testsuite/23_containers/deque/operators/2.cc: New.
+
+2009-08-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * src/hash.cc (hash<string>::operator()(string),
+ hash<wstring>::operator()(wstring)): Do not decorate as throwing
+ nothing.
+ * include/bits/functional_hash.h (hash<error_code>::
+ operator()(error_code)): Likewise.
+
+2009-08-06 Benjamin Kosnik <bkoz@redhat.com>
+
+ * src/compatibility.cc: Make C++0x safe, add in explicit casts to
+ bool for stream sentry objects.
+ * include/bits/istream.tcc: Same.
+ * include/bits/ostream.tcc: Same.
+ * include/bits/basic_string.tcc: Same.
+ * include/bits/ostream_insert.h: Same.
+ * src/istream.cc: Same.
+
+2009-08-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/15523
+ * include/debug/safe_iterator.h (_Safe_iterator<>::
+ _Safe_iterator(const _Safe_iterator&), _Safe_iterator<>::
+ operator=(const _Safe_iterator&)): Implement resolution of DR 408,
+ do not error out when the source is a value-initialized iterator.
+ * testsuite/23_containers/vector/15523.cc: New.
+ * doc/xml/manual/intro.xml: Add an entry for DR 408.
+
+2009-08-03 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/istream (operator>>(basic_istream<>&&, _Tp&)): Minor
+ cosmetic changes, inline.
+ * include/std/ostream (operator<<(basic_ostream<>&&, const _Tp&)):
+ Likewise.
+ * include/bits/move.h: Minor cosmetic changes.
+
+2009-08-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/40912 (final)
+ * testsuite/26_numerics/random/mt19937.cc: dg-require-cstdint.
+ * testsuite/26_numerics/random/uniform_real_distribution/cons/
+ parms_neg.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_real_distribution/cons/
+ parms.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_real_distribution/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_real_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_constant_distribution/
+ cons/range.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_constant_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_constant_distribution/
+ cons/num_xbound_fun.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_constant_distribution/
+ cons/initlist_fun.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_constant_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/minstd_rand.cc: Likewise.
+ * testsuite/26_numerics/random/chi_squared_distribution/cons/
+ parms.cc: Likewise.
+ * testsuite/26_numerics/random/chi_squared_distribution/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/chi_squared_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/normal_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/normal_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/normal_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/seed_seq/cons/
+ range.cc: Likewise.
+ * testsuite/26_numerics/random/seed_seq/cons/
+ initlist.cc: Likewise.
+ * testsuite/26_numerics/random/seed_seq/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/seed_seq/requirements/
+ typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_int_distribution/
+ cons/parms_neg.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_int_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_int_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/uniform_int_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/poisson_distribution/cons/
+ parms.cc: Likewise.
+ * testsuite/26_numerics/random/poisson_distribution/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/poisson_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/bernoulli_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/bernoulli_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/bernoulli_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/ranlux24_base.cc: Likewise.
+ * testsuite/26_numerics/random/
+ default_random_engine.cc: Likewise.
+ * testsuite/26_numerics/random/discrete_distribution/
+ cons/range.cc: Likewise.
+ * testsuite/26_numerics/random/discrete_distribution/
+ cons/initlist.cc: Likewise.
+ * testsuite/26_numerics/random/discrete_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/discrete_distribution/
+ cons/num_xbound_fun.cc: Likewise.
+ * testsuite/26_numerics/random/discrete_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/weibull_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/weibull_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/weibull_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ cons/base_move.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ cons/seed1.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ cons/seed2.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ cons/base_copy.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ cons/seed_seq.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ operators/equal.cc: Likewise.
+ * testsuite/26_numerics/random/independent_bits_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/ranlux48_base.cc: Likewise.
+ * testsuite/26_numerics/random/minstd_rand0.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ cons/seed1.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ cons/seed2.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ operators/equal.cc: Likewise.
+ * testsuite/26_numerics/random/subtract_with_carry_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/cons/
+ base_move.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/cons/
+ seed1.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/cons/
+ seed2.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/cons/
+ base_copy.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/cons/
+ seed_seq.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/
+ operators/equal.cc: Likewise.
+ * testsuite/26_numerics/random/discard_block_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/cauchy_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/cauchy_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/cauchy_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/negative_binomial_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/negative_binomial_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/negative_binomial_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/gamma_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/gamma_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/gamma_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ cons/seed1.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ cons/seed2.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ operators/equal.cc: Likewise.
+ * testsuite/26_numerics/random/mersenne_twister_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/fisher_f_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/fisher_f_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/fisher_f_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/exponential_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/exponential_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/exponential_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/binomial_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/binomial_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/binomial_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/lognormal_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/lognormal_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/lognormal_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/mt19937_64.cc: Likewise.
+ * testsuite/26_numerics/random/random_device/cons/
+ token.cc: Likewise.
+ * testsuite/26_numerics/random/random_device/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/random_device/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/ranlux24.cc: Likewise.
+ * testsuite/26_numerics/random/extreme_value_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/extreme_value_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/extreme_value_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_linear_distribution/
+ cons/range.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_linear_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_linear_distribution/
+ cons/num_xbound_fun.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_linear_distribution/
+ cons/initlist_fun.cc: Likewise.
+ * testsuite/26_numerics/random/piecewise_linear_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/student_t_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/student_t_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/student_t_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ cons/seed1.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ cons/seed2.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ requirements/non_uint_neg.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ operators/equal.cc: Likewise.
+ * testsuite/26_numerics/random/linear_congruential_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/ranlux48.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/cons/
+ base_move.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/cons/
+ seed1.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/cons/
+ seed2.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/cons/
+ base_copy.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/cons/
+ default.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/cons/
+ seed_seq.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ operators/equal.cc: Likewise.
+ * testsuite/26_numerics/random/shuffle_order_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/26_numerics/random/geometric_distribution/
+ cons/parms.cc: Likewise.
+ * testsuite/26_numerics/random/geometric_distribution/
+ cons/default.cc: Likewise.
+ * testsuite/26_numerics/random/geometric_distribution/
+ requirements/typedefs.cc: Likewise.
+ * testsuite/26_numerics/random/knuth_b.cc: Likewise.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
+ Douglas Gregor <doug.gregor@gmail.com>
+
+ * include/bits/move.h (forward): Implement as in N2835.
+ (move): Implement as in N2831.
+ * include/std/istream (rvalue stream operator>>): New.
+ * include/std/ostream (rvalue stream operator<<): New.
+ * testsuite/27_io/rvalue_streams.cc: New.
+
+2009-07-31 Jason Merrill <jason@redhat.com>
+
+ * include/bits/forward_list.h (splice_after): Use forward.
+ (merge): Likewise.
+ * include/bits/stl_iterator.h (move_iterator::operator*): Use move.
+ (move_iterator::operator[]): Use move.
+ * include/bits/stl_list.h (insert): Use move.
+ * include/std/thread (_Callable constructor): Use forward.
+ * include/std/tuple: Don't specify explicit template args to move.
+
+ * testsuite/20_util/forward/requirements/explicit_instantiation.cc:
+ Adjust signature.
+ * testsuite/20_util/tuple/swap.cc: Swap takes lvalue reference.
+ * testsuite/30_threads/shared_future/cons/copy.cc: Return rvalue
+ reference.
+ * testsuite/20_util/shared_ptr/assign/auto_ptr.cc,
+ testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc,
+ testsuite/20_util/shared_ptr/cons/auto_ptr.cc,
+ testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc,
+ testsuite/23_containers/forward_list/ext_pointer/operations/1.cc,
+ testsuite/23_containers/forward_list/ext_pointer/operations/5.cc,
+ testsuite/23_containers/forward_list/operations/1.cc,
+ testsuite/23_containers/forward_list/operations/5.cc: Use move.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc,
+ testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc,
+ testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc,
+ testsuite/23_containers/list/requirements/dr438/insert_neg.cc,
+ testsuite/30_threads/thread/cons/assign_neg.cc: Adjust line numbers.
+
+2009-07-31 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/40912 (partial)
+ * include/std/random: Disable the facility if <stdint.h> is not
+ available.
+
+2009-07-30 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
+
+ PR libstdc++/40919
+ * testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc:
+ xfail on darwin[3-9]*.
+
+2009-07-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/40917
+ * testsuite/util/replacement_memory_operators.h: Add missing includes,
+ tweak qualifications.
+
+2009-07-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/40916
+ * testsuite/23_containers/list/modifiers/swap/1.cc: Fix include order.
+ * testsuite/23_containers/list/modifiers/swap/2.cc: Likewise.
+ * testsuite/23_containers/list/modifiers/swap/2.cc: Likewise.
+
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * acinclude.m4 (GLIBCXX_CONFIGURE): Use m4_rename_force.
+
+2009-07-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/40915
+ * testsuite/18_support/headers/exception/synopsis.cc: Fix
+ std::terminate declaration.
+
2009-07-29 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/40908
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index d7895f5ec7f..45e0229e4be 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -79,35 +79,6 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
AC_HELP_STRING([--with-newlib],
[assume newlib as a system C library]))
- # We're almost certainly being configured before anything else which uses
- # C++, so all of our AC_PROG_* discoveries will be cached. It's vital that
- # we not cache the value of CXX that we "discover" here, because it's set
- # to something unique for us and libjava. Other target libraries need to
- # find CXX for themselves. We yank the rug out from under the normal AC_*
- # process by sneakily renaming the cache variable. This also lets us debug
- # the value of "our" CXX in postmortems.
- #
- # We must also force CXX to /not/ be a precious variable, otherwise the
- # wrong (non-multilib-adjusted) value will be used in multilibs. This
- # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side
- # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
- # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
- #
- # -fno-builtin must be present here so that a non-conflicting form of
- # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
-
- m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
- m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
- m4_define([_AC_ARG_VAR_PRECIOUS],[])
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -fno-builtin"
- AC_PROG_CC
- AC_PROG_CXX
- CXXFLAGS="$save_CXXFLAGS"
- m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
- AC_SUBST(CFLAGS)
- AC_SUBST(CXXFLAGS)
-
# Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
# available). Uncomment the next line to force a particular method.
AC_PROG_LN_S
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 9fcf6ce7a10..c4967db5513 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -517,7 +517,7 @@ GLIBCXX_3.4 {
_ZTVSt13bad_exception;
_ZTVSt[0-9][0-9]basic*;
_ZTVSt[0-9][0-9][c-d]*;
- _ZTVSt[0-9][0-9][f-k]*;
+ _ZTVSt[0-9][0-9][g-k]*;
_ZTVSt11logic_error;
_ZTVSt12length_error;
_ZTVSt[0-9][0-9][m-r]*;
@@ -545,7 +545,7 @@ GLIBCXX_3.4 {
_ZTISt13bad_exception;
_ZTISt[0-9][0-9]basic*;
_ZTISt[0-9][0-9][c-d]*;
- _ZTISt[0-9][0-9][f-k]*;
+ _ZTISt[0-9][0-9][g-k]*;
_ZTISt11logic_error;
_ZTISt12length_error;
_ZTISt[0-9][0-9][m-r]*;
@@ -577,7 +577,7 @@ GLIBCXX_3.4 {
_ZTSSt13bad_exception;
_ZTSSt[0-9][0-9]basic*;
_ZTSSt[0-9][0-9][c-d]*;
- _ZTSSt[0-9][0-9][f-k]*;
+ _ZTSSt[0-9][0-9][g-k]*;
_ZTSSt11logic_error;
_ZTSSt12length_error;
_ZTSSt[0-9][0-9][m-r]*;
@@ -973,6 +973,12 @@ GLIBCXX_3.4.13 {
# future
_ZSt15future_category;
+ _ZNSt12future_errorD*;
+ _ZNKSt12future_error4whatEv;
+ _ZTSSt12future_error;
+ _ZTVSt12future_error;
+ _ZTISt12future_error;
+ _ZSt20__throw_future_errori;
} GLIBCXX_3.4.12;
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 8d09b543257..60b5ac5920e 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -458,7 +458,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar glibcxx_builddir glibcxx_srcdir toplevel_srcdir CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM OBJDUMP ac_ct_OBJDUMP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS glibcxx_thread_h WERROR SECTION_FLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS GLIBCXX_LIBS SECTION_LDFLAGS OPT_LDFLAGS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS libtool_VERSION multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS glibcxx_builddir glibcxx_srcdir toplevel_srcdir LN_S AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP LIBTOOL SED FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM OBJDUMP ac_ct_OBJDUMP lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 LDFLAGS CXXCPP enable_shared enable_static GLIBCXX_HOSTED_TRUE GLIBCXX_HOSTED_FALSE GLIBCXX_BUILD_PCH_TRUE GLIBCXX_BUILD_PCH_FALSE glibcxx_PCHFLAGS glibcxx_thread_h WERROR SECTION_FLAGS CSTDIO_H BASIC_FILE_H BASIC_FILE_CC check_msgfmt glibcxx_MOFILES glibcxx_POFILES glibcxx_localedir USE_NLS CLOCALE_H CMESSAGES_H CCODECVT_CC CCOLLATE_CC CCTYPE_CC CMESSAGES_CC CMONEY_CC CNUMERIC_CC CTIME_H CTIME_CC CLOCALE_CC CLOCALE_INTERNAL_H ALLOCATOR_H ALLOCATOR_NAME C_INCLUDE_DIR GLIBCXX_C_HEADERS_C_TRUE GLIBCXX_C_HEADERS_C_FALSE GLIBCXX_C_HEADERS_C_STD_TRUE GLIBCXX_C_HEADERS_C_STD_FALSE GLIBCXX_C_HEADERS_C_GLOBAL_TRUE GLIBCXX_C_HEADERS_C_GLOBAL_FALSE GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE GLIBCXX_C_HEADERS_EXTRA_TRUE GLIBCXX_C_HEADERS_EXTRA_FALSE DEBUG_FLAGS GLIBCXX_BUILD_DEBUG_TRUE GLIBCXX_BUILD_DEBUG_FALSE ENABLE_PARALLEL_TRUE ENABLE_PARALLEL_FALSE EXTRA_CXX_FLAGS GLIBCXX_LIBS SECTION_LDFLAGS OPT_LDFLAGS LIBICONV LTLIBICONV SYMVER_FILE port_specific_symbol_files ENABLE_SYMVERS_TRUE ENABLE_SYMVERS_FALSE ENABLE_SYMVERS_GNU_TRUE ENABLE_SYMVERS_GNU_FALSE ENABLE_SYMVERS_GNU_NAMESPACE_TRUE ENABLE_SYMVERS_GNU_NAMESPACE_FALSE ENABLE_SYMVERS_DARWIN_TRUE ENABLE_SYMVERS_DARWIN_FALSE ENABLE_VISIBILITY_TRUE ENABLE_VISIBILITY_FALSE GLIBCXX_LDBL_COMPAT_TRUE GLIBCXX_LDBL_COMPAT_FALSE baseline_dir ATOMICITY_SRCDIR ATOMIC_WORD_SRCDIR ATOMIC_FLAGS CPU_DEFINES_SRCDIR ABI_TWEAKS_SRCDIR OS_INC_SRCDIR ERROR_CONSTANTS_SRCDIR glibcxx_prefixdir gxx_include_dir glibcxx_toolexecdir glibcxx_toolexeclibdir GLIBCXX_INCLUDES TOPLEVEL_INCLUDES OPTIMIZE_CXXFLAGS WARN_FLAGS LIBSUPCXX_PICFLAGS LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -2193,331 +2193,33 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-# Runs configure.host, finds CC, CXX, and assorted other critical bits. Sets
-# up critical shell variables.
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# We're almost certainly being configured before anything else which uses
+# C++, so all of our AC_PROG_* discoveries will be cached. It's vital that
+# we not cache the value of CXX that we "discover" here, because it's set
+# to something unique for us and libjava. Other target libraries need to
+# find CXX for themselves. We yank the rug out from under the normal AC_*
+# process by sneakily renaming the cache variable. This also lets us debug
+# the value of "our" CXX in postmortems.
+#
+# We must also force CXX to /not/ be a precious variable, otherwise the
+# wrong (non-multilib-adjusted) value will be used in multilibs. This
+# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side
+# effect, CXXFLAGS is no longer automagically subst'd, so we have to do
+# that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
+#
+# -fno-builtin must be present here so that a non-conflicting form of
+# std::exit can be guessed by AC_PROG_CXX, and used in later tests.
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether non-existent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- # Broken: success on invalid input.
-continue
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
+save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS -fno-builtin"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
-
-
-
- # Keep these sync'd with the list in Makefile.am. The first provides an
- # expandable list at autoconf time; the second provides an expandable list
- # (i.e., shell variable) at configure time.
-
- SUBDIRS='include libsupc++ python src doc po testsuite'
-
- # These need to be absolute paths, yet at the same time need to
- # canonicalize only relative paths, because then amd will not unmount
- # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
- glibcxx_builddir=`${PWDCMD-pwd}`
- case $srcdir in
- \\/$* | ?:\\/*) glibcxx_srcdir=${srcdir} ;;
- *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
- esac
- toplevel_srcdir=${glibcxx_srcdir}/..
-
-
-
-
- # We use these options to decide which functions to include. They are
- # set from the top level.
-
-# Check whether --with-target-subdir or --without-target-subdir was given.
-if test "${with_target_subdir+set}" = set; then
- withval="$with_target_subdir"
-
-fi;
-
-
-# Check whether --with-cross-host or --without-cross-host was given.
-if test "${with_cross_host+set}" = set; then
- withval="$with_cross_host"
-
-fi;
-
-
-# Check whether --with-newlib or --without-newlib was given.
-if test "${with_newlib+set}" = set; then
- withval="$with_newlib"
-
-fi;
-
- # We're almost certainly being configured before anything else which uses
- # C++, so all of our AC_PROG_* discoveries will be cached. It's vital that
- # we not cache the value of CXX that we "discover" here, because it's set
- # to something unique for us and libjava. Other target libraries need to
- # find CXX for themselves. We yank the rug out from under the normal AC_*
- # process by sneakily renaming the cache variable. This also lets us debug
- # the value of "our" CXX in postmortems.
- #
- # We must also force CXX to /not/ be a precious variable, otherwise the
- # wrong (non-multilib-adjusted) value will be used in multilibs. This
- # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side
- # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
- # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
- #
- # -fno-builtin must be present here so that a non-conflicting form of
- # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
-
-
-
-
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -fno-builtin"
- ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
@@ -3487,7 +3189,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
- ac_ext=cc
+ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
@@ -3842,11 +3544,309 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
- CXXFLAGS="$save_CXXFLAGS"
+CXXFLAGS="$save_CXXFLAGS"
+# Runs configure.host, and assorted other critical bits. Sets
+# up critical shell variables.
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+
+ # Keep these sync'd with the list in Makefile.am. The first provides an
+ # expandable list at autoconf time; the second provides an expandable list
+ # (i.e., shell variable) at configure time.
+
+ SUBDIRS='include libsupc++ python src doc po testsuite'
+
+ # These need to be absolute paths, yet at the same time need to
+ # canonicalize only relative paths, because then amd will not unmount
+ # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
+ glibcxx_builddir=`${PWDCMD-pwd}`
+ case $srcdir in
+ \\/$* | ?:\\/*) glibcxx_srcdir=${srcdir} ;;
+ *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
+ esac
+ toplevel_srcdir=${glibcxx_srcdir}/..
+
+
+
+
+ # We use these options to decide which functions to include. They are
+ # set from the top level.
+
+# Check whether --with-target-subdir or --without-target-subdir was given.
+if test "${with_target_subdir+set}" = set; then
+ withval="$with_target_subdir"
+
+fi;
+
+
+# Check whether --with-cross-host or --without-cross-host was given.
+if test "${with_cross_host+set}" = set; then
+ withval="$with_cross_host"
+
+fi;
+
+
+# Check whether --with-newlib or --without-newlib was given.
+if test "${with_newlib+set}" = set; then
+ withval="$with_newlib"
+
+fi;
+
# Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
# available). Uncomment the next line to force a particular method.
echo "$as_me:$LINENO: checking whether ln -s works" >&5
@@ -137261,9 +137261,6 @@ s,@am__leading_dot@,$am__leading_dot,;t t
s,@AMTAR@,$AMTAR,;t t
s,@am__tar@,$am__tar,;t t
s,@am__untar@,$am__untar,;t t
-s,@glibcxx_builddir@,$glibcxx_builddir,;t t
-s,@glibcxx_srcdir@,$glibcxx_srcdir,;t t
-s,@toplevel_srcdir@,$toplevel_srcdir,;t t
s,@CC@,$CC,;t t
s,@ac_ct_CC@,$ac_ct_CC,;t t
s,@EXEEXT@,$EXEEXT,;t t
@@ -137272,6 +137269,9 @@ s,@CXX@,$CXX,;t t
s,@ac_ct_CXX@,$ac_ct_CXX,;t t
s,@CFLAGS@,$CFLAGS,;t t
s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@glibcxx_builddir@,$glibcxx_builddir,;t t
+s,@glibcxx_srcdir@,$glibcxx_srcdir,;t t
+s,@toplevel_srcdir@,$toplevel_srcdir,;t t
s,@LN_S@,$LN_S,;t t
s,@AS@,$AS,;t t
s,@ac_ct_AS@,$ac_ct_AS,;t t
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 977e12cf91d..0b1edfd7c75 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -78,7 +78,36 @@ AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dependencies -Wall -Wno-portability
AH_TEMPLATE(PACKAGE, [Name of package])
AH_TEMPLATE(VERSION, [Version number of package])
-# Runs configure.host, finds CC, CXX, and assorted other critical bits. Sets
+# We're almost certainly being configured before anything else which uses
+# C++, so all of our AC_PROG_* discoveries will be cached. It's vital that
+# we not cache the value of CXX that we "discover" here, because it's set
+# to something unique for us and libjava. Other target libraries need to
+# find CXX for themselves. We yank the rug out from under the normal AC_*
+# process by sneakily renaming the cache variable. This also lets us debug
+# the value of "our" CXX in postmortems.
+#
+# We must also force CXX to /not/ be a precious variable, otherwise the
+# wrong (non-multilib-adjusted) value will be used in multilibs. This
+# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side
+# effect, CXXFLAGS is no longer automagically subst'd, so we have to do
+# that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
+#
+# -fno-builtin must be present here so that a non-conflicting form of
+# std::exit can be guessed by AC_PROG_CXX, and used in later tests.
+
+m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
+m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS -fno-builtin"
+AC_PROG_CC
+AC_PROG_CXX
+CXXFLAGS="$save_CXXFLAGS"
+m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+AC_SUBST(CFLAGS)
+AC_SUBST(CXXFLAGS)
+
+# Runs configure.host, and assorted other critical bits. Sets
# up critical shell variables.
GLIBCXX_CONFIGURE
diff --git a/libstdc++-v3/doc/html/api.html b/libstdc++-v3/doc/html/api.html
index 80a18e35d26..cb2d72d61e6 100644
--- a/libstdc++-v3/doc/html/api.html
+++ b/libstdc++-v3/doc/html/api.html
@@ -5,7 +5,7 @@
<a class="ulink" href="http://www.fsf.org/" target="_top">FSF
</a>
- </p></div><div><div class="legalnotice"><a id="id448105"></a><p>
+ </p></div><div><div class="legalnotice"><a id="id391427"></a><p>
<a class="link" href="manual/license.html" title="License">License
</a>
</p></div></div></div><hr /></div><p>
diff --git a/libstdc++-v3/doc/html/manual/abi.html b/libstdc++-v3/doc/html/manual/abi.html
index 807d3054cc7..b0d2c7c905d 100644
--- a/libstdc++-v3/doc/html/manual/abi.html
+++ b/libstdc++-v3/doc/html/manual/abi.html
@@ -464,56 +464,56 @@ gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.
<a class="ulink" href="http://gcc.gnu.org/PR24660" target="_top">24660: versioning weak symbols in libstdc++</a>
</p><p>
<a class="ulink" href="http://gcc.gnu.org/PR19664" target="_top">19664: libstdc++ headers should have pop/push of the visibility around the declarations</a>
-</p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="abi.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id449703"></a><p><span class="title"><i>
+</p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="abi.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id548079"></a><p><span class="title"><i>
ABIcheck, a vague idea of checking ABI compatibility
</i>. </span><span class="biblioid">
<a class="ulink" href="http://abicheck.sourceforge.net/" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449721"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id548097"></a><p><span class="title"><i>
C++ ABI Reference
</i>. </span><span class="biblioid">
<a class="ulink" href="http://www.codesourcery.com/public/cxx-abi/" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449738"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id548114"></a><p><span class="title"><i>
Intel® Compilers for Linux* -Compatibility with the GNU Compilers
</i>. </span><span class="biblioid">
<a class="ulink" href="http://www.intel.com/cd/software/products/asmo-na/eng/284736.htm" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449755"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id548131"></a><p><span class="title"><i>
Sun Solaris 2.9 : Linker and Libraries Guide (document 816-1386)
</i>. </span><span class="biblioid">
<a class="ulink" href="http://docs.sun.com/app/docs/doc/817-1984" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449772"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id548148"></a><p><span class="title"><i>
Sun Solaris 2.9 : C++ Migration Guide (document 816-2459)
</i>. </span><span class="biblioid">
<a class="ulink" href="http://docs.sun.com/app/docs/doc/819-5266" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449789"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id526655"></a><p><span class="title"><i>
How to Write Shared Libraries
</i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="biblioid">
<a class="ulink" href="http://people.redhat.com/drepper/dsohowto.pdf" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449817"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id526683"></a><p><span class="title"><i>
C++ ABI for the ARM Architecture
</i>. </span><span class="biblioid">
<a class="ulink" href="http://www.arm.com/miscPDFs/8033.pdf" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449834"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id526700"></a><p><span class="title"><i>
Dynamic Shared Objects: Survey and Issues
</i>. </span><span class="subtitle">
ISO C++ J16/06-0046
. </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1976.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449866"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id526733"></a><p><span class="title"><i>
Versioning With Namespaces
</i>. </span><span class="subtitle">
ISO C++ J16/06-0083
. </span><span class="author"><span class="firstname">Benjamin</span> <span class="surname">Kosnik</span>. </span><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2013.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id449899"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id526765"></a><p><span class="title"><i>
Binary Compatibility of Shared Libraries Implemented in C++ on GNU/Linux Systems
</i>. </span><span class="subtitle">
SYRCoSE 2009
diff --git a/libstdc++-v3/doc/html/manual/algorithms.html b/libstdc++-v3/doc/html/manual/algorithms.html
index 6a20e62a96b..92e33d33d7b 100644
--- a/libstdc++-v3/doc/html/manual/algorithms.html
+++ b/libstdc++-v3/doc/html/manual/algorithms.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt08ch19s02.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt09pr02.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.algorithms"></a>Part IX. 
Algorithms
- <a id="id584483" class="indexterm"></a>
+ <a id="id445064" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="bk01pt09pr02.html"></a></span></dt><dt><span class="chapter"><a href="bk01pt09ch20.html">20. Mutating</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt09ch20.html#algorithms.mutating.swap">swap</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt09ch20.html#algorithms.swap.specializations">Specializations</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt08ch19s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt09pr02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">One Past the End </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html
index be79816fa64..6af29925e46 100644
--- a/libstdc++-v3/doc/html/manual/api.html
+++ b/libstdc++-v3/doc/html/manual/api.html
@@ -75,11 +75,11 @@ _Alloc_traits</code> have been removed.
<span class="type">__alloc</span> to select an underlying allocator that
satisfied memory allocation requests. The selection of this
underlying allocator was not user-configurable.
- </p><div class="table"><a id="id521791"></a><p class="title"><b>Table B.1. Extension Allocators</b></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template&lt;int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template&lt;bool,int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection
+ </p><div class="table"><a id="id539341"></a><p class="title"><b>Table B.1. Extension Allocators</b></p><div class="table-contents"><table summary="Extension Allocators" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator (3.4)</th><th align="left">Header (3.4)</th><th align="left">Allocator (3.[0-3])</th><th align="left">Header (3.[0-3])</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::new_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="classname">std::__new_alloc</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::malloc_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="classname">std::__malloc_alloc_template&lt;int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::debug_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="classname">std::debug_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__pool_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="classname">std::__default_alloc_template&lt;bool,int&gt;</code></td><td align="left"><code class="filename">memory</code></td></tr><tr><td align="left"><code class="classname">__gnu_cxx::__mt_alloc&lt;T&gt;</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left"><code class="classname">__gnu_cxx::bitmap_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"> </td><td align="left"> </td></tr></tbody></table></div></div><br class="table-break" /><p> Releases after gcc-3.4 have continued to add to the collection
of available allocators. All of these new allocators are
standard-style. The following table includes details, along with
the first released version of GCC that included the extension allocator.
- </p><div class="table"><a id="id605274"></a><p class="title"><b>Table B.2. Extension Allocators Continued</b></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p>
+ </p><div class="table"><a id="id545205"></a><p class="title"><b>Table B.2. Extension Allocators Continued</b></p><div class="table-contents"><table summary="Extension Allocators Continued" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Allocator</th><th align="left">Include</th><th align="left">Version</th></tr></thead><tbody><tr><td align="left"><code class="classname">__gnu_cxx::array_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left">4.0.0</td></tr><tr><td align="left"><code class="classname">__gnu_cxx::throw_allocator&lt;T&gt;</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left">4.2.0</td></tr></tbody></table></div></div><br class="table-break" /><p>
Debug mode first appears.
</p><p>
Precompiled header support <acronym class="acronym">PCH</acronym> support.
diff --git a/libstdc++-v3/doc/html/manual/appendix_contributing.html b/libstdc++-v3/doc/html/manual/appendix_contributing.html
index 0704a6b6f2f..5fea7a933b8 100644
--- a/libstdc++-v3/doc/html/manual/appendix_contributing.html
+++ b/libstdc++-v3/doc/html/manual/appendix_contributing.html
@@ -5,7 +5,7 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt12ch40s03.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="source_organization.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.contrib"></a>Appendix A. 
Contributing
- <a id="id518821" class="indexterm"></a>
+ <a id="id419637" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="appendix_contributing.html#contrib.list">Contributor Checklist</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_contributing.html#list.reading">Reading</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.copyright">Assignment</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.getting">Getting Sources</a></span></dt><dt><span class="sect2"><a href="appendix_contributing.html#list.patches">Submitting Patches</a></span></dt></dl></dd><dt><span class="sect1"><a href="source_organization.html">Directory Layout and Source Conventions</a></span></dt><dt><span class="sect1"><a href="source_code_style.html">Coding Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="source_code_style.html#coding_style.bad_identifiers">Bad Identifiers</a></span></dt><dt><span class="sect2"><a href="source_code_style.html#coding_style.example">By Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="documentation_style.html">Documentation Style</a></span></dt><dd><dl><dt><span class="sect2"><a href="documentation_style.html#doc_style.doxygen">Doxygen</a></span></dt><dt><span class="sect2"><a href="documentation_style.html#doc_style.docbook">Docbook</a></span></dt></dl></dd><dt><span class="sect1"><a href="source_design_notes.html">Design Notes</a></span></dt></dl></div><p>
The GNU C++ Library follows an open development model. Active
contributors are assigned maintainer-ship responsibility, and given
diff --git a/libstdc++-v3/doc/html/manual/appendix_free.html b/libstdc++-v3/doc/html/manual/appendix_free.html
index cbb522069be..a27d6e59e31 100644
--- a/libstdc++-v3/doc/html/manual/appendix_free.html
+++ b/libstdc++-v3/doc/html/manual/appendix_free.html
@@ -5,7 +5,7 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="backwards.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="appendix_gpl.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.free"></a>Appendix C. 
Free Software Needs Free Documentation
- <a id="id517384" class="indexterm"></a>
+ <a id="id469283" class="indexterm"></a>
</h2></div></div></div><p>
The biggest deficiency in free operating systems is not in the
software--it is the lack of good free manuals that we can include in
diff --git a/libstdc++-v3/doc/html/manual/appendix_gpl.html b/libstdc++-v3/doc/html/manual/appendix_gpl.html
index d087283907b..281aeec7fef 100644
--- a/libstdc++-v3/doc/html/manual/appendix_gpl.html
+++ b/libstdc++-v3/doc/html/manual/appendix_gpl.html
@@ -76,7 +76,7 @@
</p><p>
The precise terms and conditions for copying, distribution and modification
follow.
- </p><h2><a id="id587672"></a>
+ </p><h2><a id="id460710"></a>
TERMS AND CONDITIONS
</h2><h2><a id="gpl-3-definitions"></a>
0. Definitions.
@@ -617,7 +617,7 @@
waiver of all civil liability in connection with the Program, unless a
warranty or assumption of liability accompanies a copy of the Program in
return for a fee.
- </p><h2><a id="id522436"></a>
+ </p><h2><a id="id468427"></a>
END OF TERMS AND CONDITIONS
</h2><h2><a id="HowToApply"></a>
How to Apply These Terms to Your New Programs
diff --git a/libstdc++-v3/doc/html/manual/appendix_porting.html b/libstdc++-v3/doc/html/manual/appendix_porting.html
index b49a2928abb..f45d19b3e06 100644
--- a/libstdc++-v3/doc/html/manual/appendix_porting.html
+++ b/libstdc++-v3/doc/html/manual/appendix_porting.html
@@ -5,7 +5,7 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="source_design_notes.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="internals.html">Next</a></td></tr></table><hr /></div><div class="appendix" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="appendix.porting"></a>Appendix B. 
Porting and Maintenance
- <a id="id477004" class="indexterm"></a>
+ <a id="id492719" class="indexterm"></a>
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="appendix_porting.html#appendix.porting.build_hacking">Configure and Build Hacking</a></span></dt><dd><dl><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.map">Overview: What Comes from Where</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.scripts">Storing Information in non-AC files (like configure.host)</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.conventions">Coding and Commenting Conventions</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.acinclude">The acinclude.m4 layout</a></span></dt><dt><span class="sect2"><a href="appendix_porting.html#build_hacking.enable">GLIBCXX_ENABLE, the --enable maker</a></span></dt></dl></dd><dt><span class="sect1"><a href="internals.html">Porting to New Hardware or Operating Systems</a></span></dt><dd><dl><dt><span class="sect2"><a href="internals.html#internals.os">Operating System</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.cpu">CPU</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.char_types">Character Types</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.numeric_limits">Numeric Limits</a></span></dt><dt><span class="sect2"><a href="internals.html#internals.libtool">Libtool</a></span></dt></dl></dd><dt><span class="sect1"><a href="abi.html">ABI Policy and Guidelines</a></span></dt><dd><dl><dt><span class="sect2"><a href="abi.html#abi.cxx_interface">The C++ Interface</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.versioning">Versioning</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_allowed">Allowed Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.changes_no">Prohibited Changes</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.testing">Testing</a></span></dt><dt><span class="sect2"><a href="abi.html#abi.issues">Outstanding Issues</a></span></dt></dl></dd><dt><span class="sect1"><a href="api.html">API Evolution and Deprecation History</a></span></dt><dd><dl><dt><span class="sect2"><a href="api.html#api.rel_300">3.0</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_310">3.1</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_320">3.2</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_330">3.3</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_340">3.4</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_400">4.0</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_410">4.1</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_420">4.2</a></span></dt><dt><span class="sect2"><a href="api.html#api.rel_430">4.3</a></span></dt></dl></dd><dt><span class="sect1"><a href="backwards.html">Backwards Compatibility</a></span></dt><dd><dl><dt><span class="sect2"><a href="backwards.html#backwards.first">First</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.second">Second</a></span></dt><dt><span class="sect2"><a href="backwards.html#backwards.third">Third</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="appendix.porting.build_hacking"></a>Configure and Build Hacking</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="build_hacking.prereq"></a>Prerequisites</h3></div></div></div><p>
As noted <a class="ulink" href="http://gcc.gnu.org/install/prerequisites.html" target="_top">previously</a>,
certain other tools are necessary for hacking on files that
diff --git a/libstdc++-v3/doc/html/manual/backwards.html b/libstdc++-v3/doc/html/manual/backwards.html
index 2ae9d5f0537..854ed1d1a8c 100644
--- a/libstdc++-v3/doc/html/manual/backwards.html
+++ b/libstdc++-v3/doc/html/manual/backwards.html
@@ -17,8 +17,8 @@ ISO Standard (e.g., statistical analysis). While there are a lot of
really useful things that are used by a lot of people, the Standards
Committee couldn't include everything, and so a lot of those
“<span class="quote">obvious</span>†classes didn't get included.
-</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id586062"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id586094"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p>
+</p><p>Known Issues include many of the limitations of its immediate ancestor.</p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id467544"></a>No <code class="code">ios_base</code></h4></div></div></div><p> At least some older implementations don't have <code class="code">std::ios_base</code>, so you should use <code class="code">std::ios::badbit</code>, <code class="code">std::ios::failbit</code> and <code class="code">std::ios::eofbit</code> and <code class="code">std::ios::goodbit</code>.
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id467576"></a>No <code class="code">cout</code> in <code class="code">ostream.h</code>, no <code class="code">cin</code> in <code class="code">istream.h</code></h4></div></div></div><p>
In earlier versions of the standard,
<code class="filename">fstream.h</code>,
<code class="filename">ostream.h</code>
@@ -44,7 +44,7 @@ considered replaced and rewritten.
archived. The code is considered replaced and rewritten.
</p><p>
Portability notes and known implementation limitations are as follows.
-</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id586192"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p>
+</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id467674"></a>Namespace <code class="code">std::</code> not supported</h4></div></div></div><p>
Some care is required to support C++ compiler and or library
implementation that do not have the standard library in
<code class="code">namespace std</code>.
@@ -108,7 +108,7 @@ AC_DEFUN([AC_CXX_NAMESPACE_STD], [
AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
fi
])
-</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537437"></a>Illegal iterator usage</h4></div></div></div><p>
+</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id524920"></a>Illegal iterator usage</h4></div></div></div><p>
The following illustrate implementation-allowed illegal iterator
use, and then correct use.
</p><div class="itemizedlist"><ul type="disc"><li><p>
@@ -121,7 +121,7 @@ AC_DEFUN([AC_CXX_NAMESPACE_STD], [
</p></li><li><p>
<code class="code">if (iterator)</code> won't work any more =&gt; use
<code class="code">if (iterator != iterator_type())</code>
- </p></li></ul></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537498"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro
+ </p></li></ul></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id524981"></a><code class="code">isspace</code> from <code class="filename">cctype</code> is a macro
</h4></div></div></div><p>
Glibc 2.0.x and 2.1.x define <code class="filename">ctype.h</code> functionality as macros
(isspace, isalpha etc.).
@@ -154,7 +154,7 @@ std:: (__ctype_b[(int) ( ( 'X' ) )] &amp; (unsigned short int) _ISspace ) ;
(<code class="filename">ctype.h</code>) and the
definitions in namespace <code class="code">std::</code>
(<code class="code">&lt;cctype&gt;</code>).
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537592"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id525075"></a>No <code class="code">vector::at</code>, <code class="code">deque::at</code>, <code class="code">string::at</code></h4></div></div></div><p>
One solution is to add an autoconf-test for this:
</p><pre class="programlisting">
AC_MSG_CHECKING(for container::at)
@@ -180,7 +180,7 @@ AC_DEFINE(HAVE_CONTAINER_AT)],
</pre><p>
If you are using other (non-GNU) compilers it might be a good idea
to check for <code class="code">string::at</code> separately.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537630"></a>No <code class="code">std::char_traits&lt;char&gt;::eof</code></h4></div></div></div><p>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id525113"></a>No <code class="code">std::char_traits&lt;char&gt;::eof</code></h4></div></div></div><p>
Use some kind of autoconf test, plus this:
</p><pre class="programlisting">
#ifdef HAVE_CHAR_TRAITS
@@ -188,7 +188,7 @@ AC_DEFINE(HAVE_CONTAINER_AT)],
#else
#define CPP_EOF EOF
#endif
-</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537648"></a>No <code class="code">string::clear</code></h4></div></div></div><p>
+</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id525131"></a>No <code class="code">string::clear</code></h4></div></div></div><p>
There are two functions for deleting the contents of a string:
<code class="code">clear</code> and <code class="code">erase</code> (the latter returns the
string).
@@ -206,12 +206,12 @@ erase(size_type __pos = 0, size_type __n = npos)
Unfortunately, <code class="code">clear</code> is not implemented in this
version, so you should use <code class="code">erase</code> (which is probably
faster than <code class="code">operator=(charT*)</code>).
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537694"></a>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id525176"></a>
Removal of <code class="code">ostream::form</code> and <code class="code">istream::scan</code>
extensions
</h4></div></div></div><p>
These are no longer supported. Please use stringstreams instead.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id537713"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id525195"></a>No <code class="code">basic_stringbuf</code>, <code class="code">basic_stringstream</code></h4></div></div></div><p>
Although the ISO standard <code class="code">i/ostringstream</code>-classes are
provided, (<code class="filename">sstream</code>), for
compatibility with older implementations the pre-ISO
@@ -299,14 +299,14 @@ any = temp;
Another example of using stringstreams is in <a class="link" href="bk01pt05ch13s05.html" title="Shrink to Fit">this howto</a>.
</p><p> There is additional information in the libstdc++-v2 info files, in
particular “<span class="quote">info iostream</span>â€.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id478036"></a>Little or no wide character support</h4></div></div></div><p>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id545596"></a>Little or no wide character support</h4></div></div></div><p>
Classes <code class="classname">wstring</code> and
<code class="classname">char_traits&lt;wchar_t&gt;</code> are
not supported.
- </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id478054"></a>No templatized iostreams</h4></div></div></div><p>
+ </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id545615"></a>No templatized iostreams</h4></div></div></div><p>
Classes <code class="classname">wfilebuf</code> and
<code class="classname">wstringstream</code> are not supported.
- </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id478073"></a>Thread safety issues</h4></div></div></div><p>
+ </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id545634"></a>Thread safety issues</h4></div></div></div><p>
Earlier GCC releases had a somewhat different approach to
threading configuration and proper compilation. Before GCC 3.0,
configuration of the threading model was dictated by compiler
@@ -364,7 +364,7 @@ libstdc++-v3.
of the SGI STL (version 3.3), with extensive changes.
</p><p>A more formal description of the V3 goals can be found in the
official <a class="link" href="source_design_notes.html" title="Design Notes">design document</a>.
- </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id478190"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers
+ </p><p>Portability notes and known implementation limitations are as follows.</p><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id545751"></a>Pre-ISO headers moved to backwards or removed</h4></div></div></div><p> The pre-ISO C++ headers
(<code class="code">iostream.h</code>, <code class="code">defalloc.h</code> etc.) are
available, unlike previous libstdc++ versions, but inclusion
generates a warning that you are using deprecated headers.
@@ -436,7 +436,7 @@ like <code class="filename">vector.h</code> can be replaced with <code class="fi
directive <code class="code">using namespace std;</code> can be put at the global
scope. This should be enough to get this code compiling, assuming the
other usage is correct.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id478273"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id545834"></a>Extension headers hash_map, hash_set moved to ext or backwards</h4></div></div></div><p>At this time most of the features of the SGI STL extension have been
replaced by standardized libraries.
In particular, the unordered_map and unordered_set containers of TR1
are suitable replacement for the non-standard hash_map and hash_set
@@ -508,7 +508,7 @@ AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
fi
])
-</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id495884"></a>No <code class="code">ios::nocreate/ios::noreplace</code>.
+</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id476825"></a>No <code class="code">ios::nocreate/ios::noreplace</code>.
</h4></div></div></div><p> The existence of <code class="code">ios::nocreate</code> being used for
input-streams has been confirmed, most probably because the author
thought it would be more correct to specify nocreate explicitly. So
@@ -519,7 +519,7 @@ open the file for reading, check if it has been opened, and then
decide whether you want to create/replace or not. To my knowledge,
even older implementations support <code class="code">app</code>, <code class="code">ate</code>
and <code class="code">trunc</code> (except for <code class="code">app</code> ?).
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id495931"></a>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id476873"></a>
No <code class="code">stream::attach(int fd)</code>
</h4></div></div></div><p>
Phil Edwards writes: It was considered and rejected for the ISO
@@ -542,7 +542,7 @@ No <code class="code">stream::attach(int fd)</code>
For another example of this, refer to
<a class="ulink" href="http://www.josuttis.com/cppcode/fdstream.html" target="_top">fdstream example</a>
by Nicolai Josuttis.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id495995"></a>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id476937"></a>
Support for C++98 dialect.
</h4></div></div></div><p>Check for complete library coverage of the C++1998/2003 standard.
</p><pre class="programlisting">
@@ -610,7 +610,7 @@ AC_DEFUN([AC_HEADER_STDCXX_98], [
AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
fi
])
-</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id496023"></a>
+</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id476964"></a>
Support for C++TR1 dialect.
</h4></div></div></div><p>Check for library coverage of the TR1 standard.
</p><pre class="programlisting">
@@ -687,7 +687,7 @@ AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
fi
])
-</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id496066"></a>
+</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id477008"></a>
Support for C++0x dialect.
</h4></div></div></div><p>Check for baseline language coverage in the compiler for the C++0xstandard.
</p><pre class="programlisting">
@@ -899,27 +899,27 @@ AC_DEFUN([AC_HEADER_UNORDERED_SET], [
AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
fi
])
-</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id496144"></a>
+</pre></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id477085"></a>
Container::iterator_type is not necessarily Container::value_type*
</h4></div></div></div><p>
This is a change in behavior from the previous version. Now, most
<span class="type">iterator_type</span> typedefs in container classes are POD
objects, not <span class="type">value_type</span> pointers.
-</p></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id496173"></a><p>[<abbr class="abbrev">
+</p></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="backwards.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id477115"></a><p>[<abbr class="abbrev">
kegel41
</abbr>] <span class="title"><i>
Migrating to GCC 4.1
</i>. </span><span class="author"><span class="firstname">Dan</span> <span class="surname">Kegel</span>. </span><span class="biblioid">
<a class="ulink" href="http://www.kegel.com/gcc/gcc4.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id517292"></a><p>[<abbr class="abbrev">
+ . </span></p></div><div class="biblioentry"><a id="id469192"></a><p>[<abbr class="abbrev">
kegel41
</abbr>] <span class="title"><i>
Building the Whole Debian Archive with GCC 4.1: A Summary
</i>. </span><span class="author"><span class="firstname">Martin</span> <span class="surname">Michlmayr</span>. </span><span class="biblioid">
<a class="ulink" href="http://lists.debian.org/debian-gcc/2006/03/msg00405.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id517325"></a><p>[<abbr class="abbrev">
+ . </span></p></div><div class="biblioentry"><a id="id469224"></a><p>[<abbr class="abbrev">
lbl32
</abbr>] <span class="title"><i>
Migration guide for GCC-3.2
diff --git a/libstdc++-v3/doc/html/manual/bitmap_allocator.html b/libstdc++-v3/doc/html/manual/bitmap_allocator.html
index 029753fda8e..72eec938105 100644
--- a/libstdc++-v3/doc/html/manual/bitmap_allocator.html
+++ b/libstdc++-v3/doc/html/manual/bitmap_allocator.html
@@ -103,7 +103,7 @@ else return false.</p></li></ol></div><p>
</p><p>
Consider a block of size 64 ints. In memory, it would look like this:
(assume a 32-bit system where, size_t is a 32-bit entity).
- </p><div class="table"><a id="id504618"></a><p class="title"><b>Table 32.1. Bitmap Allocator Memory Map</b></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -&gt; Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p>
+ </p><div class="table"><a id="id508940"></a><p class="title"><b>Table 32.1. Bitmap Allocator Memory Map</b></p><div class="table-contents"><table summary="Bitmap Allocator Memory Map" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left">268</td><td align="left">0</td><td align="left">4294967295</td><td align="left">4294967295</td><td align="left">Data -&gt; Space for 64 ints</td></tr></tbody></table></div></div><br class="table-break" /><p>
The first Column(268) represents the size of the Block in bytes as
seen by the Bitmap Allocator. Internally, a global free list is
used to keep track of the free blocks used and given back by the
diff --git a/libstdc++-v3/doc/html/manual/bk01ix01.html b/libstdc++-v3/doc/html/manual/bk01ix01.html
index 87410e4932a..e46ca2ea195 100644
--- a/libstdc++-v3/doc/html/manual/bk01ix01.html
+++ b/libstdc++-v3/doc/html/manual/bk01ix01.html
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Index</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="appendix_gfdl.html" title="Appendix E. GNU Free Documentation License" /><link rel="next" href="../bk02.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Index</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_gfdl.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="../bk02.html">Next</a></td></tr></table><hr /></div><div class="index"><div class="titlepage"><div><div><h2 class="title"><a id="id587558"></a>Index</h2></div></div></div><div class="index"><div class="indexdiv"><h3>A</h3><dl><dt>Algorithms, <a class="indexterm" href="algorithms.html">
+<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Index</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="spine.html" title="The GNU C++ Library" /><link rel="prev" href="appendix_gfdl.html" title="Appendix E. GNU Free Documentation License" /><link rel="next" href="../bk02.html" title="" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Index</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="appendix_gfdl.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="../bk02.html">Next</a></td></tr></table><hr /></div><div class="index"><div class="titlepage"><div><div><h2 class="title"><a id="id546577"></a>Index</h2></div></div></div><div class="index"><div class="indexdiv"><h3>A</h3><dl><dt>Algorithms, <a class="indexterm" href="algorithms.html">
Algorithms
</a></dt><dt>Appendix</dt><dd><dl><dt>Contributing, <a class="indexterm" href="appendix_contributing.html">
diff --git a/libstdc++-v3/doc/html/manual/bk01pt02pr01.html b/libstdc++-v3/doc/html/manual/bk01pt02pr01.html
index 784412f23ef..724322683bf 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt02pr01.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt02pr01.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="support.html" title="Part II.  Support" /><link rel="prev" href="support.html" title="Part II.  Support" /><link rel="next" href="fundamental_types.html" title="Chapter 4. Types" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="support.html">Prev</a> </td><th width="60%" align="center">Part II. 
Support
-</th><td width="20%" align="right"> <a accesskey="n" href="fundamental_types.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id482788"></a></h2></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="fundamental_types.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id455418"></a></h2></div></div></div><p>
This part deals with the functions called and objects created
automatically during the course of a program's existence.
</p><p>
diff --git a/libstdc++-v3/doc/html/manual/bk01pt09pr02.html b/libstdc++-v3/doc/html/manual/bk01pt09pr02.html
index d5e4fdf4f43..35101a56e1e 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt09pr02.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt09pr02.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; , &#10; algorithm&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="algorithms.html" title="Part IX.  Algorithms" /><link rel="prev" href="algorithms.html" title="Part IX.  Algorithms" /><link rel="next" href="bk01pt09ch20.html" title="Chapter 20. Mutating" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="algorithms.html">Prev</a> </td><th width="60%" align="center">Part IX. 
Algorithms
-</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt09ch20.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id584491"></a></h2></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt09ch20.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id445072"></a></h2></div></div></div><p>
The neatest accomplishment of the algorithms chapter is that all the
work is done via iterators, not containers directly. This means two
important things:
diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html b/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html
index 62f46e7303b..9bbbdc2fc11 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt12ch30s03.html
@@ -19,6 +19,6 @@
mode or with debug mode. The
following table provides the names and headers of the debugging
containers:
-</p><div class="table"><a id="id498152"></a><p class="title"><b>Table 30.1. Debugging Containers</b></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename">bitset</code></td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename">deque</code></td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename">map</code></td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename">map</code></td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename">set</code></td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename">set</code></td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename">vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++0x mode, these additional
+</p><div class="table"><a id="id452232"></a><p class="title"><b>Table 30.1. Debugging Containers</b></p><div class="table-contents"><table summary="Debugging Containers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::bitset</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="classname">__gnu_debug::bitset</code></td><td align="left"><code class="filename">bitset</code></td></tr><tr><td align="left"><code class="classname">std::deque</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="classname">__gnu_debug::deque</code></td><td align="left"><code class="filename">deque</code></td></tr><tr><td align="left"><code class="classname">std::list</code></td><td align="left"><code class="filename">list</code></td><td align="left"><code class="classname">__gnu_debug::list</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="classname">std::map</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::map</code></td><td align="left"><code class="filename">map</code></td></tr><tr><td align="left"><code class="classname">std::multimap</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="classname">__gnu_debug::multimap</code></td><td align="left"><code class="filename">map</code></td></tr><tr><td align="left"><code class="classname">std::multiset</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::multiset</code></td><td align="left"><code class="filename">set</code></td></tr><tr><td align="left"><code class="classname">std::set</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="classname">__gnu_debug::set</code></td><td align="left"><code class="filename">set</code></td></tr><tr><td align="left"><code class="classname">std::string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::string</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="classname">std::wstring</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::wstring</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="classname">std::basic_string</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="classname">__gnu_debug::basic_string</code></td><td align="left"><code class="filename">string</code></td></tr><tr><td align="left"><code class="classname">std::vector</code></td><td align="left"><code class="filename">vector</code></td><td align="left"><code class="classname">__gnu_debug::vector</code></td><td align="left"><code class="filename">vector</code></td></tr></tbody></table></div></div><br class="table-break" /><p>In addition, when compiling in C++0x mode, these additional
containers have additional debug capability.
-</p><div class="table"><a id="id520410"></a><p class="title"><b>Table 30.2. Debugging Containers C++0x</b></p><div class="table-contents"><table summary="Debugging Containers C++0x" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch30s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch30s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
+</p><div class="table"><a id="id387544"></a><p class="title"><b>Table 30.2. Debugging Containers C++0x</b></p><div class="table-contents"><table summary="Debugging Containers C++0x" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Container</th><th align="left">Header</th><th align="left">Debug container</th><th align="left">Debug header</th></tr></thead><tbody><tr><td align="left"><code class="classname">std::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_map</code></td><td align="left"><code class="filename">unordered_map</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multimap</code></td><td align="left"><code class="filename">unordered_map</code></td></tr><tr><td align="left"><code class="classname">std::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_set</code></td><td align="left"><code class="filename">unordered_set</code></td></tr><tr><td align="left"><code class="classname">std::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="classname">__gnu_debug::unordered_multiset</code></td><td align="left"><code class="filename">unordered_set</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch30s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="debug_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch30s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html b/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html
index 26b2e0bd84d..b3441ea5e17 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt12ch31s03.html
@@ -63,4 +63,4 @@ Then compile this code with the prerequisite compiler flags
flags for atomic operations.)
</p><p> The following table provides the names and headers of all the
parallel algorithms that can be used in a similar manner:
-</p><div class="table"><a id="id593819"></a><p class="title"><b>Table 31.1. Parallel Algorithms</b></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch31s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch31s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
+</p><div class="table"><a id="id468908"></a><p class="title"><b>Table 31.1. Parallel Algorithms</b></p><div class="table-contents"><table summary="Parallel Algorithms" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Algorithm</th><th align="left">Header</th><th align="left">Parallel algorithm</th><th align="left">Parallel header</th></tr></thead><tbody><tr><td align="left"><code class="function">std::accumulate</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::accumulate</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_difference</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_difference</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::inner_product</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::inner_product</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::partial_sum</code></td><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="function">__gnu_parallel::partial_sum</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr><tr><td align="left"><code class="function">std::adjacent_find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::adjacent_find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::count_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::count_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::equal</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::equal</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::find_first_of</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::find_first_of</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::for_each</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::for_each</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::generate_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::generate_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::lexicographical_compare</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::lexicographical_compare</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::mismatch</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::mismatch</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::search_n</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::search_n</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::transform</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::transform</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::replace_if</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::replace_if</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::max_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::max_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::merge</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::merge</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::min_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::min_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::nth_element</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::nth_element</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partial_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partial_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::partition</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::partition</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::random_shuffle</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::random_shuffle</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_union</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_union</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_intersection</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_intersection</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_symmetric_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_symmetric_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::set_difference</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::set_difference</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::stable_sort</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::stable_sort</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr><tr><td align="left"><code class="function">std::unique_copy</code></td><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="function">__gnu_parallel::unique_copy</code></td><td align="left"><code class="filename">parallel/algorithm</code></td></tr></tbody></table></div></div><br class="table-break" /></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt12ch31s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="parallel_mode.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12ch31s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Semantics </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Design</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/bk01pt12pr03.html b/libstdc++-v3/doc/html/manual/bk01pt12pr03.html
index 8d187bf61ee..f76bab1e466 100644
--- a/libstdc++-v3/doc/html/manual/bk01pt12pr03.html
+++ b/libstdc++-v3/doc/html/manual/bk01pt12pr03.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title></title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="extensions.html" title="Part XII.  Extensions" /><link rel="prev" href="extensions.html" title="Part XII.  Extensions" /><link rel="next" href="ext_compile_checks.html" title="Chapter 29. Compile Time Checks" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part XII. 
Extensions
-</th><td width="20%" align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id511787"></a></h2></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr /></div><div class="preface" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="id450786"></a></h2></div></div></div><p>
Here we will make an attempt at describing the non-Standard extensions to
the library. Some of these are from SGI's STL, some of these are GNU's,
and some just seemed to appear on the doorstep.
diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html
index 8e2dfad32b1..01c623516dc 100644
--- a/libstdc++-v3/doc/html/manual/bugs.html
+++ b/libstdc++-v3/doc/html/manual/bugs.html
@@ -49,7 +49,7 @@
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#22" target="_top">22</a>:
<span class="emphasis"><em>Member open vs flags</em></span>
</span></dt><dd><p>Re-opening a file stream does <span class="emphasis"><em>not</em></span> clear the state flags.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#23" target="_top">23</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#23" target="_top">23</a>:
<span class="emphasis"><em>Num_get overflow result</em></span>
</span></dt><dd><p>Implement the proposed resolution.
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#25" target="_top">25</a>:
@@ -157,7 +157,7 @@
<span class="emphasis"><em>Precision in iostream?</em></span>
</span></dt><dd><p>For conversion from a floating-point type, <code class="code">str.precision()</code>
is specified in the conversion specification.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#233" target="_top">233</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#233" target="_top">233</a>:
<span class="emphasis"><em>Insertion hints in associative containers</em></span>
</span></dt><dd><p>Implement N1780, first check before then check after, insert as close
to hint as possible.
@@ -221,7 +221,7 @@
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#365" target="_top">365</a>:
<span class="emphasis"><em>Lack of const-qualification in clause 27</em></span>
</span></dt><dd><p>Add const overloads of <code class="code">is_open</code>.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#387" target="_top">387</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#387" target="_top">387</a>:
<span class="emphasis"><em>std::complex over-encapsulated</em></span>
</span></dt><dd><p>Add the <code class="code">real(T)</code> and <code class="code">imag(T)</code>
members; in C++0x mode, also adjust the existing
@@ -231,12 +231,17 @@
<span class="emphasis"><em>Const overload of valarray::operator[] returns
by value</em></span>
</span></dt><dd><p>Change it to return a <code class="code">const T&amp;</code>.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#396" target="_top">396</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#396" target="_top">396</a>:
<span class="emphasis"><em>what are characters zero and one</em></span>
</span></dt><dd><p>Implement the proposed resolution.
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#402" target="_top">402</a>:
<span class="emphasis"><em>Wrong new expression in [some_]allocator::construct</em></span>
</span></dt><dd><p>Replace "new" with "::new".
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#408" target="_top">408</a>:
+ <span class="emphasis"><em>
+ Is vector&lt;reverse_iterator&lt;char*&gt; &gt; forbidden?
+ </em></span>
+ </span></dt><dd><p>Tweak the debug-mode checks in _Safe_iterator.
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#409" target="_top">409</a>:
<span class="emphasis"><em>Closing an fstream should clear the error state</em></span>
</span></dt><dd><p>Have <code class="code">open</code> clear the error flags.
@@ -293,10 +298,13 @@
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#596" target="_top">596</a>:
<span class="emphasis"><em>27.8.1.3 Table 112 omits "a+" and "a+b" modes</em></span>
</span></dt><dd><p>Add the missing modes to fopen_mode.
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#630" target="_top">630</a>:
+ <span class="emphasis"><em>arrays of valarray</em></span>
+ </span></dt><dd><p>Implement the simple resolution.
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#660" target="_top">660</a>:
<span class="emphasis"><em>Missing bitwise operations</em></span>
</span></dt><dd><p>Add the missing operations.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#691" target="_top">691</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#691" target="_top">691</a>:
<span class="emphasis"><em>const_local_iterator cbegin, cend missing from TR1</em></span>
</span></dt><dd><p>In C++0x mode add cbegin(size_type) and cend(size_type)
to the unordered containers.
@@ -315,16 +323,16 @@
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#775" target="_top">775</a>:
<span class="emphasis"><em>Tuple indexing should be unsigned?</em></span>
</span></dt><dd><p>Implement the int -&gt; size_t replacements.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#776" target="_top">776</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#776" target="_top">776</a>:
<span class="emphasis"><em>Undescribed assign function of std::array</em></span>
</span></dt><dd><p>In C++0x mode, remove assign, add fill.
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#781" target="_top">781</a>:
<span class="emphasis"><em>std::complex should add missing C99 functions</em></span>
</span></dt><dd><p>In C++0x mode, add std::proj.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#809" target="_top">809</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#809" target="_top">809</a>:
<span class="emphasis"><em>std::swap should be overloaded for array types</em></span>
</span></dt><dd><p>Add the overload.
- </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#844" target="_top">844</a>:
+ </p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-defects.html#844" target="_top">844</a>:
<span class="emphasis"><em>complex pow return type is ambiguous</em></span>
</span></dt><dd><p>In C++0x mode, remove the pow(complex&lt;T&gt;, int) signature.
</p></dd><dt><span class="term"><a class="ulink" href="../ext/lwg-active.html#853" target="_top">853</a>:
diff --git a/libstdc++-v3/doc/html/manual/codecvt.html b/libstdc++-v3/doc/html/manual/codecvt.html
index 0e8610ec55d..2b06179cdf2 100644
--- a/libstdc++-v3/doc/html/manual/codecvt.html
+++ b/libstdc++-v3/doc/html/manual/codecvt.html
@@ -337,41 +337,41 @@ codecvt usage.
</p></li><li><p>
wchar_t/char internal buffers and conversions between
internal/external buffers?
- </p></li></ul></div></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id535164"></a><p><span class="title"><i>
+ </p></li></ul></div></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.codecvt.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id514958"></a><p><span class="title"><i>
The GNU C Library
- </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id540007"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id455172"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id540036"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id448478"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id498179"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id448497"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id498198"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id431624"></a><p><span class="title"><i>
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
</i>. </span><span class="copyright">Copyright © 1999
The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid">
<a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id576064"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id431651"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry"><a id="id570004"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id437273"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername">
Addison Wesley Longman
- . </span></span></p></div><div class="biblioentry"><a id="id492545"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id322717"></a><p><span class="title"><i>
A brief description of Normative Addendum 1
</i>. </span><span class="author"><span class="firstname">Clive</span> <span class="surname">Feather</span>. </span><span class="pagenums">Extended Character Sets. </span><span class="biblioid">
<a class="ulink" href="http://www.lysator.liu.se/c/na1.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id501955"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id322748"></a><p><span class="title"><i>
The Unicode HOWTO
</i>. </span><span class="author"><span class="firstname">Bruno</span> <span class="surname">Haible</span>. </span><span class="biblioid">
<a class="ulink" href="ftp://ftp.ilog.fr/pub/Users/haible/utf8/Unicode-HOWTO.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id501984"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id448720"></a><p><span class="title"><i>
UTF-8 and Unicode FAQ for Unix/Linux
</i>. </span><span class="author"><span class="firstname">Markus</span> <span class="surname">Khun</span>. </span><span class="biblioid">
<a class="ulink" href="http://www.cl.cam.ac.uk/~mgk25/unicode.html" target="_top">
diff --git a/libstdc++-v3/doc/html/manual/configure.html b/libstdc++-v3/doc/html/manual/configure.html
index 3f722a77ea5..dce1c94e1eb 100644
--- a/libstdc++-v3/doc/html/manual/configure.html
+++ b/libstdc++-v3/doc/html/manual/configure.html
@@ -10,7 +10,7 @@
Here are all of the configure options specific to libstdc++. Keep
in mind that
- <a class="ulink" href="http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_node/autoconf_131.html#SEC131" target="_top">they
+ <a class="ulink" href="http://sourceware.org/autobook/autobook/autobook_14.html" target="_top">they
all have opposite forms as well</a> (enable/disable and
with/without). The defaults are for the <span class="emphasis"><em>current
development sources</em></span>, which may be different than those
@@ -39,16 +39,16 @@
<code class="literal">--with-gxx-include-dir=<code class="filename">dirname</code></code> during configuration.
</p></dd><dt><span class="term"><code class="code">--with-gxx-include-dir=&lt;include-files dir&gt;</code></span></dt><dd><p>Adds support for named libstdc++ include directory. For instance,
the following puts all the libstdc++ headers into a directory
- called "2.97-20001008" instead of the usual
+ called "4.4-20090404" instead of the usual
"c++/(version)".
</p><pre class="programlisting">
- --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/2.97-20001008</pre></dd><dt><span class="term"><code class="code">--enable-cstdio</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-cstdio=stdio'</code>
- (described next). This option can change the library ABI.
+ --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/4.4-20090404</pre></dd><dt><span class="term"><code class="code">--enable-cstdio</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-cstdio=stdio'</code>
+ (described next).
</p></dd><dt><span class="term"><code class="code">--enable-cstdio=OPTION</code></span></dt><dd><p>Select a target-specific I/O package. At the moment, the only
choice is to use 'stdio', a generic "C" abstraction.
- The default is 'stdio'.
+ The default is 'stdio'. This option can change the library ABI.
</p></dd><dt><span class="term"><code class="code">--enable-clocale</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-clocale=generic'</code>
- (described next). This option can change the library ABI.
+ (described next).
</p></dd><dt><span class="term"><code class="code">--enable-clocale=OPTION</code></span></dt><dd><p>Select a target-specific underlying locale package. The
choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix
(IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets,
@@ -56,31 +56,34 @@
library (langinfo/iconv/gettext) (from <a class="ulink" href="http://sources.redhat.com/glibc/" target="_top">glibc</a>, the GNU C
library), or 'generic' to use a generic "C"
abstraction which consists of "C" locale info.
- </p><p>As part of the configuration process, the "C" library is
- probed both for sufficient vintage, and installed locale
- data. If either of these elements are not present, the C++
- locale model default to 'generic.' On glibc-based systems of
- version 2.2.5 and above with installed locale files, 'gnu' is
- automatically selected.
+ </p><p>If not explicitly specified, the configure proccess tries
+ to guess the most suitable package from the choices above. The
+ default is 'generic'. On glibc-based systems of sufficient
+ vintage (2.2.5 and newer) and capability (with installed DE and
+ FR locale data), 'gnu' is automatically selected. This option
+ can change the library ABI.
</p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-allocator</code></span></dt><dd><p>This is an abbreviated form of
<code class="code">'--enable-libstdcxx-allocator=auto'</code> (described
- next). This option can change the library ABI.
+ next).
</p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-allocator=OPTION </code></span></dt><dd><p>Select a target-specific underlying std::allocator. The
choices are 'new' to specify a wrapper for new, 'malloc' to
specify a wrapper for malloc, 'mt' for a fixed power of two allocator,
'pool' for the SGI pooled allocator or 'bitmap' for a bitmap allocator.
- This option can change the library ABI. See this page for more information on allocator
- <a class="link" href="memory.html#allocator.ext" title="Extension Allocators">extensions</a>
+ See this page for more information on allocator
+ <a class="link" href="memory.html#allocator.ext" title="Extension Allocators">extensions</a>. This option
+ can change the library ABI.
</p></dd><dt><span class="term"><code class="code">--enable-cheaders=OPTION</code></span></dt><dd><p>This allows the user to define the approach taken for C header
compatibility with C++. Options are c, c_std, and c_global.
These correspond to the source directory's include/c,
include/c_std, and include/c_global, and may also include
- include/c_compatibility. The default is c_global.
+ include/c_compatibility. The default is 'c_global'.
</p></dd><dt><span class="term"><code class="code">--enable-threads</code></span></dt><dd><p>This is an abbreviated form of <code class="code">'--enable-threads=yes'</code>
- (described next). This option can change the library ABI.
- </p></dd><dt><span class="term"><code class="code">--enable-threads=OPTION</code></span></dt><dd><p>Select a threading library. A full description is given in the
+ (described next).
+ </p></dd><dt><span class="term"><code class="code">--enable-threads=OPTION</code></span></dt><dd><p>Select a threading library. A full description is
+ given in the
general <a class="ulink" href="http://gcc.gnu.org/install/configure.html" target="_top">compiler
- configuration instructions</a>.
+ configuration instructions</a>. This option can change the
+ library ABI.
</p></dd><dt><span class="term"><code class="code">--enable-libstdcxx-debug</code></span></dt><dd><p>Build separate debug libraries in addition to what is normally built.
By default, the debug libraries are compiled with
<code class="code"> CXXFLAGS='-g3 -O0 -fno-inline'</code>
diff --git a/libstdc++-v3/doc/html/manual/containers.html b/libstdc++-v3/doc/html/manual/containers.html
index e9382311964..ff0146ddcef 100644
--- a/libstdc++-v3/doc/html/manual/containers.html
+++ b/libstdc++-v3/doc/html/manual/containers.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="messages.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="sequences.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.containers"></a>Part VII. 
Containers
- <a id="id482440" class="indexterm"></a>
+ <a id="id430539" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="sequences.html">16. Sequences</a></span></dt><dd><dl><dt><span class="sect1"><a href="sequences.html#containers.sequences.list">list</a></span></dt><dd><dl><dt><span class="sect2"><a href="sequences.html#sequences.list.size">list::size() is O(n)</a></span></dt></dl></dd><dt><span class="sect1"><a href="vector.html">vector</a></span></dt><dd><dl><dt><span class="sect2"><a href="vector.html#sequences.vector.management">Space Overhead Management</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="associative.html">17. Associative</a></span></dt><dd><dl><dt><span class="sect1"><a href="associative.html#containers.associative.insert_hints">Insertion Hints</a></span></dt><dt><span class="sect1"><a href="bitset.html">bitset</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitset.html#associative.bitset.size_variable">Size Variable</a></span></dt><dt><span class="sect2"><a href="bitset.html#associative.bitset.type_string">Type String</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="containers_and_c.html">18. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="containers_and_c.html#containers.c.vs_array">Containers vs. Arrays</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="messages.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sequences.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">messages </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 16. Sequences</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/diagnostics.html b/libstdc++-v3/doc/html/manual/diagnostics.html
index 0de3c941e50..3624e126e13 100644
--- a/libstdc++-v3/doc/html/manual/diagnostics.html
+++ b/libstdc++-v3/doc/html/manual/diagnostics.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="verbose_termination.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="exceptions.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.diagnostics"></a>Part III. 
Diagnostics
- <a id="id509451" class="indexterm"></a>
+ <a id="id427594" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="exceptions.html">7. Exceptions</a></span></dt><dd><dl><dt><span class="sect1"><a href="exceptions.html#manual.diagnostics.exceptions.hierarchy">Exception Classes</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch07s02.html">Adding Data to Exceptions</a></span></dt><dt><span class="sect1"><a href="bk01pt03ch07s03.html">Cancellation</a></span></dt></dl></dd><dt><span class="chapter"><a href="bk01pt03ch08.html">8. Concept Checking</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="verbose_termination.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="exceptions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Verbose Terminate Handler </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Exceptions</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/documentation_style.html b/libstdc++-v3/doc/html/manual/documentation_style.html
index 7dae04eb9f3..9490bb6e19a 100644
--- a/libstdc++-v3/doc/html/manual/documentation_style.html
+++ b/libstdc++-v3/doc/html/manual/documentation_style.html
@@ -211,11 +211,11 @@ Complete details on Docbook markup can be found in the DocBook Element
Reference, <a class="ulink" href="http://www.docbook.org/tdg/en/html/part2.html" target="_top">online</a>. An
incomplete reference for HTML to Docbook conversion is detailed in the
table below.
-</p><div class="table"><a id="id449698"></a><p class="title"><b>Table A.1. HTML to Docbook XML markup comparison</b></p><div class="table-contents"><table summary="HTML to Docbook XML markup comparison" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">XML</th></tr></thead><tbody><tr><td align="left">&lt;p&gt;</td><td align="left">&lt;para&gt;</td></tr><tr><td align="left">&lt;pre&gt;</td><td align="left">&lt;computeroutput&gt;, &lt;programlisting&gt;,
+</p><div class="table"><a id="id447935"></a><p class="title"><b>Table A.1. HTML to Docbook XML markup comparison</b></p><div class="table-contents"><table summary="HTML to Docbook XML markup comparison" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">HTML</th><th align="left">XML</th></tr></thead><tbody><tr><td align="left">&lt;p&gt;</td><td align="left">&lt;para&gt;</td></tr><tr><td align="left">&lt;pre&gt;</td><td align="left">&lt;computeroutput&gt;, &lt;programlisting&gt;,
&lt;literallayout&gt;</td></tr><tr><td align="left">&lt;ul&gt;</td><td align="left">&lt;itemizedlist&gt;</td></tr><tr><td align="left">&lt;ol&gt;</td><td align="left">&lt;orderedlist&gt;</td></tr><tr><td align="left">&lt;il&gt;</td><td align="left">&lt;listitem&gt;</td></tr><tr><td align="left">&lt;dl&gt;</td><td align="left">&lt;variablelist&gt;</td></tr><tr><td align="left">&lt;dt&gt;</td><td align="left">&lt;term&gt;</td></tr><tr><td align="left">&lt;dd&gt;</td><td align="left">&lt;listitem&gt;</td></tr><tr><td align="left">&lt;a href=""&gt;</td><td align="left">&lt;ulink url=""&gt;</td></tr><tr><td align="left">&lt;code&gt;</td><td align="left">&lt;literal&gt;, &lt;programlisting&gt;</td></tr><tr><td align="left">&lt;strong&gt;</td><td align="left">&lt;emphasis&gt;</td></tr><tr><td align="left">&lt;em&gt;</td><td align="left">&lt;emphasis&gt;</td></tr><tr><td align="left">"</td><td align="left">&lt;quote&gt;</td></tr></tbody></table></div></div><br class="table-break" /><p>
And examples of detailed markup for which there are no real HTML
equivalents are listed in the table below.
-</p><div class="table"><a id="id475153"></a><p class="title"><b>Table A.2. Docbook XML Element Use</b></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Element</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left">&lt;structname&gt;</td><td align="left">&lt;structname&gt;char_traits&lt;/structname&gt;</td></tr><tr><td align="left">&lt;classname&gt;</td><td align="left">&lt;classname&gt;string&lt;/classname&gt;</td></tr><tr><td align="left">&lt;function&gt;</td><td align="left">
+</p><div class="table"><a id="id458695"></a><p class="title"><b>Table A.2. Docbook XML Element Use</b></p><div class="table-contents"><table summary="Docbook XML Element Use" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Element</th><th align="left">Use</th></tr></thead><tbody><tr><td align="left">&lt;structname&gt;</td><td align="left">&lt;structname&gt;char_traits&lt;/structname&gt;</td></tr><tr><td align="left">&lt;classname&gt;</td><td align="left">&lt;classname&gt;string&lt;/classname&gt;</td></tr><tr><td align="left">&lt;function&gt;</td><td align="left">
<p>&lt;function&gt;clear()&lt;/function&gt;</p>
<p>&lt;function&gt;fs.clear()&lt;/function&gt;</p>
</td></tr><tr><td align="left">&lt;type&gt;</td><td align="left">&lt;type&gt;long long&lt;/type&gt;</td></tr><tr><td align="left">&lt;varname&gt;</td><td align="left">&lt;varname&gt;fs&lt;/varname&gt;</td></tr><tr><td align="left">&lt;literal&gt;</td><td align="left">
diff --git a/libstdc++-v3/doc/html/manual/extensions.html b/libstdc++-v3/doc/html/manual/extensions.html
index c47409d7a70..a757f077356 100644
--- a/libstdc++-v3/doc/html/manual/extensions.html
+++ b/libstdc++-v3/doc/html/manual/extensions.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt11ch28s02.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt12pr03.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.ext"></a>Part XII. 
Extensions
- <a id="id511778" class="indexterm"></a>
+ <a id="id450777" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="bk01pt12pr03.html"></a></span></dt><dt><span class="chapter"><a href="ext_compile_checks.html">29. Compile Time Checks</a></span></dt><dt><span class="chapter"><a href="debug_mode.html">30. Debug Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="debug_mode.html#manual.ext.debug_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch30s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.mode">Using the Debug Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s03.html#debug_mode.using.specific">Using a Specific Debug Container</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch30s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch30s04.html#debug_mode.design.goals">Goals</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#debug_mode.design.methods">Methods</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch30s04.html#debug_mode.design.other">Other Implementations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="parallel_mode.html">31. Parallel Mode</a></span></dt><dd><dl><dt><span class="sect1"><a href="parallel_mode.html#manual.ext.parallel_mode.intro">Intro</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s02.html">Semantics</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch31s03.html">Using</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.prereq_flags">Prerequisite Compiler Flags</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.parallel_mode">Using Parallel Mode</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s03.html#parallel_mode.using.specific">Using Specific Parallel Components</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s04.html">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch31s04.html#parallel_mode.design.intro">Interface Basics</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#parallel_mode.design.tuning">Configuration and Tuning</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch31s04.html#parallel_mode.design.impl">Implementation Namespaces</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch31s05.html">Testing</a></span></dt><dt><span class="bibliography"><a href="parallel_mode.html#parallel_mode.biblio">Bibliography</a></span></dt></dl></dd><dt><span class="chapter"><a href="ext_allocators.html">32. Allocators</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_allocators.html#manual.ext.allocator.mt">mt_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.intro">Intro</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.example_single">Single Thread Example</a></span></dt><dt><span class="sect2"><a href="ext_allocators.html#allocator.mt.example_multi">Multiple Thread Example</a></span></dt></dl></dd><dt><span class="sect1"><a href="bitmap_allocator.html">bitmap_allocator</a></span></dt><dd><dl><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.design">Design</a></span></dt><dt><span class="sect2"><a href="bitmap_allocator.html#allocator.bitmap.impl">Implementation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="ext_containers.html">33. Containers</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_containers.html#manual.ext.containers.pbds">Policy Based Data Structures</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s02.html">HP/SGI</a></span></dt><dt><span class="sect1"><a href="bk01pt12ch33s03.html">Deprecated HP/SGI</a></span></dt></dl></dd><dt><span class="chapter"><a href="ext_utilities.html">34. Utilities</a></span></dt><dt><span class="chapter"><a href="ext_algorithms.html">35. Algorithms</a></span></dt><dt><span class="chapter"><a href="ext_numerics.html">36. Numerics</a></span></dt><dt><span class="chapter"><a href="ext_iterators.html">37. Iterators</a></span></dt><dt><span class="chapter"><a href="ext_io.html">38. Input and Output</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_io.html#manual.ext.io.filebuf_derived">Derived filebufs</a></span></dt></dl></dd><dt><span class="chapter"><a href="ext_demangling.html">39. Demangling</a></span></dt><dt><span class="chapter"><a href="ext_concurrency.html">40. Concurrency</a></span></dt><dd><dl><dt><span class="sect1"><a href="ext_concurrency.html#manual.ext.concurrency.design">Design</a></span></dt><dd><dl><dt><span class="sect2"><a href="ext_concurrency.html#manual.ext.concurrency.design.threads">Interface to Locks and Mutexes</a></span></dt><dt><span class="sect2"><a href="ext_concurrency.html#manual.ext.concurrency.design.atomics">Interface to Atomic Functions</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s02.html">Implementation</a></span></dt><dd><dl><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.atomic_fallbacks">Using Builtin Atomic Functions</a></span></dt><dt><span class="sect2"><a href="bk01pt12ch40s02.html#manual.ext.concurrency.impl.thread">Thread Abstraction</a></span></dt></dl></dd><dt><span class="sect1"><a href="bk01pt12ch40s03.html">Use</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt11ch28s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt12pr03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Performance </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/facets.html b/libstdc++-v3/doc/html/manual/facets.html
index c034c52d29f..48a6a384825 100644
--- a/libstdc++-v3/doc/html/manual/facets.html
+++ b/libstdc++-v3/doc/html/manual/facets.html
@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 15. Facets aka Categories</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><meta name="keywords" content="&#10; ISO C++&#10; , &#10; library&#10; " /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="localization.html" title="Part VI.  Localization" /><link rel="prev" href="locales.html" title="Chapter 14. Locales" /><link rel="next" href="codecvt.html" title="codecvt" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 15. Facets aka Categories</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="locales.html">Prev</a> </td><th width="60%" align="center">Part VI. 
Localization
-</th><td width="20%" align="right"> <a accesskey="n" href="codecvt.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.localization.facet"></a>Chapter 15. Facets aka Categories</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="facets.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.localization.facet.ctype"></a>ctype</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id570195"></a>Specializations</h4></div></div></div><p>
+</th><td width="20%" align="right"> <a accesskey="n" href="codecvt.html">Next</a></td></tr></table><hr /></div><div class="chapter" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="manual.localization.facet"></a>Chapter 15. Facets aka Categories</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="facets.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.localization.facet.ctype"></a>ctype</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id435289"></a>Specializations</h4></div></div></div><p>
For the required specialization codecvt&lt;wchar_t, char, mbstate_t&gt; ,
conversions are made between the internal character set (always UCS4
on GNU/Linux) and whatever the currently selected locale for the
@@ -50,25 +50,25 @@ characters.
</p></li><li><p>
Rename abstract base class. See if just smash-overriding is a
better approach. Clarify, add sanity to naming.
- </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id502358"></a><p><span class="title"><i>
+ </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.ctype.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id444358"></a><p><span class="title"><i>
The GNU C Library
- </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id514505"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id455494"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id575760"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id440437"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id549682"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id440455"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id549700"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id440473"></a><p><span class="title"><i>
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
</i>. </span><span class="copyright">Copyright © 1999
The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid">
<a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id563987"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id517128"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry"><a id="id485424"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id438741"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
diff --git a/libstdc++-v3/doc/html/manual/intro.html b/libstdc++-v3/doc/html/manual/intro.html
index ab564b9794a..ed795fc6e81 100644
--- a/libstdc++-v3/doc/html/manual/intro.html
+++ b/libstdc++-v3/doc/html/manual/intro.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="spine.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.intro"></a>Part I. 
Introduction
- <a id="id515589" class="indexterm"></a>
+ <a id="id387018" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="status.html">1. Status</a></span></dt><dd><dl><dt><span class="sect1"><a href="status.html#manual.intro.status.iso">Implementation Status</a></span></dt><dd><dl><dt><span class="sect2"><a href="status.html#status.iso.1998">C++ 1998/2003</a></span></dt><dt><span class="sect2"><a href="status.html#status.iso.tr1">C++ TR1</a></span></dt><dt><span class="sect2"><a href="status.html#status.iso.200x">C++ 200x</a></span></dt></dl></dd><dt><span class="sect1"><a href="license.html">License</a></span></dt><dd><dl><dt><span class="sect2"><a href="license.html#manual.intro.status.license.gpl">The Code: GPL</a></span></dt><dt><span class="sect2"><a href="license.html#manual.intro.status.license.fdl">The Documentation: GPL, FDL</a></span></dt></dl></dd><dt><span class="sect1"><a href="bugs.html">Bugs</a></span></dt><dd><dl><dt><span class="sect2"><a href="bugs.html#manual.intro.status.bugs.impl">Implementation Bugs</a></span></dt><dt><span class="sect2"><a href="bugs.html#manual.intro.status.bugs.iso">Standard Bugs</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="setup.html">2. Setup</a></span></dt><dd><dl><dt><span class="sect1"><a href="setup.html#manual.intro.setup.prereq">Prerequisites</a></span></dt><dt><span class="sect1"><a href="configure.html">Configure</a></span></dt><dt><span class="sect1"><a href="make.html">Make</a></span></dt><dt><span class="sect1"><a href="test.html">Test</a></span></dt><dd><dl><dt><span class="sect2"><a href="test.html#test.organization">Organization</a></span></dt><dt><span class="sect2"><a href="test.html#test.run">Running the Testsuite</a></span></dt><dt><span class="sect2"><a href="test.html#test.new_tests">Writing a new test case</a></span></dt><dt><span class="sect2"><a href="test.html#test.harness">Test Harness and Utilities</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="using.html">3. Using</a></span></dt><dd><dl><dt><span class="sect1"><a href="using.html#manual.intro.using.lib">Linking Library Binary Files</a></span></dt><dt><span class="sect1"><a href="using_headers.html">Headers</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.all">Header Files</a></span></dt><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.mixing">Mixing Headers</a></span></dt><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.cheaders">The C Headers and namespace std</a></span></dt><dt><span class="sect2"><a href="using_headers.html#manual.intro.using.headers.pre">Precompiled Headers</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_namespaces.html">Namespaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_namespaces.html#manual.intro.using.namespaces.all">Available Namespaces</a></span></dt><dt><span class="sect2"><a href="using_namespaces.html#manual.intro.using.namespaces.std">namespace std</a></span></dt><dt><span class="sect2"><a href="using_namespaces.html#manual.intro.using.namespaces.comp">Using Namespace Composition</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_macros.html">Macros</a></span></dt><dt><span class="sect1"><a href="using_concurrency.html">Concurrency</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.prereq">Prerequisites</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.thread_safety">Thread Safety</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.atomics">Atomics</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.io">IO</a></span></dt><dt><span class="sect2"><a href="using_concurrency.html#manual.intro.using.concurrency.containers">Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="using_exceptions.html">Exceptions</a></span></dt><dd><dl><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.propagating">Propagating Exceptions aka Exception Neutrality</a></span></dt><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.safety">Exception Safety</a></span></dt><dt><span class="sect2"><a href="using_exceptions.html#intro.using.exception.no">Support for -fno-exceptions</a></span></dt></dl></dd><dt><span class="sect1"><a href="debug.html">Debugging Support</a></span></dt><dd><dl><dt><span class="sect2"><a href="debug.html#debug.compiler">Using g++</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.req">Debug Versions of Library Binary Files</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.memory">Memory Leak Hunting</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.gdb">Using gdb</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.exceptions">Tracking uncaught exceptions</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.debug_mode">Debug Mode</a></span></dt><dt><span class="sect2"><a href="debug.html#debug.compile_time_checks">Compile Time Checking</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="spine.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="status.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 1. Status</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/io.html b/libstdc++-v3/doc/html/manual/io.html
index 7095c81a791..b5a30497632 100644
--- a/libstdc++-v3/doc/html/manual/io.html
+++ b/libstdc++-v3/doc/html/manual/io.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt10ch23s02.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="iostream_objects.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.io"></a>Part XI. 
Input and Output
- <a id="id567421" class="indexterm"></a>
+ <a id="id460605" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="iostream_objects.html">24. Iostream Objects</a></span></dt><dt><span class="chapter"><a href="streambufs.html">25. Stream Buffers</a></span></dt><dd><dl><dt><span class="sect1"><a href="streambufs.html#io.streambuf.derived">Derived streambuf Classes</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch25s02.html">Buffering</a></span></dt></dl></dd><dt><span class="chapter"><a href="stringstreams.html">26. Memory Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="stringstreams.html#manual.io.memstreams.compat">Compatibility With strstream</a></span></dt></dl></dd><dt><span class="chapter"><a href="fstreams.html">27. File Based Streams</a></span></dt><dd><dl><dt><span class="sect1"><a href="fstreams.html#manual.io.filestreams.copying_a_file">Copying a File</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch27s02.html">Binary Input and Output</a></span></dt></dl></dd><dt><span class="chapter"><a href="io_and_c.html">28. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="io_and_c.html#manual.io.c.FILE">Using FILE* and file descriptors</a></span></dt><dt><span class="sect1"><a href="bk01pt11ch28s02.html">Performance</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt10ch23s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="iostream_objects.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">C99 </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 24. Iostream Objects</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/iterators.html b/libstdc++-v3/doc/html/manual/iterators.html
index f0d1db046f7..046bf075b9b 100644
--- a/libstdc++-v3/doc/html/manual/iterators.html
+++ b/libstdc++-v3/doc/html/manual/iterators.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bitset.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt08ch19.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.iterators"></a>Part VIII. 
Iterators
- <a id="id599146" class="indexterm"></a>
+ <a id="id388807" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="bk01pt08ch19.html">19. Predefined</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt08ch19.html#iterators.predefined.vs_pointers">Iterators vs. Pointers</a></span></dt><dt><span class="sect1"><a href="bk01pt08ch19s02.html">One Past the End</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bitset.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt08ch19.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">bitset </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 19. Predefined</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/locales.html b/libstdc++-v3/doc/html/manual/locales.html
index ea30f5f4916..49634676312 100644
--- a/libstdc++-v3/doc/html/manual/locales.html
+++ b/libstdc++-v3/doc/html/manual/locales.html
@@ -398,25 +398,25 @@ global locale" (emphasis Paolo), that is:
What should non-required facet instantiations do? If the
generic implementation is provided, then how to end-users
provide specializations?
- </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="locales.locale.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id507203"></a><p><span class="title"><i>
+ </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="locales.locale.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id419927"></a><p><span class="title"><i>
The GNU C Library
- </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id487435"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling and 7 Locales and Internationalization. </span></p></div><div class="biblioentry"><a id="id426714"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id497192"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id426743"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id497210"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id438110"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id485536"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id438128"></a><p><span class="title"><i>
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
</i>. </span><span class="copyright">Copyright © 1999
The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid">
<a class="ulink" href="http://www.opennc.org/austin/docreg.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id516170"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id516788"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry"><a id="id548118"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id532385"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
diff --git a/libstdc++-v3/doc/html/manual/localization.html b/libstdc++-v3/doc/html/manual/localization.html
index 487475ad02f..5f30a5fb542 100644
--- a/libstdc++-v3/doc/html/manual/localization.html
+++ b/libstdc++-v3/doc/html/manual/localization.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt05ch13s06.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="locales.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.localization"></a>Part VI. 
Localization
- <a id="id599008" class="indexterm"></a>
+ <a id="id453876" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="locales.html">14. Locales</a></span></dt><dd><dl><dt><span class="sect1"><a href="locales.html#manual.localization.locales.locale">locale</a></span></dt><dd><dl><dt><span class="sect2"><a href="locales.html#locales.locale.req">Requirements</a></span></dt><dt><span class="sect2"><a href="locales.html#locales.locale.design">Design</a></span></dt><dt><span class="sect2"><a href="locales.html#locales.locale.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="locales.html#locales.locale.future">Future</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="facets.html">15. Facets aka Categories</a></span></dt><dd><dl><dt><span class="sect1"><a href="facets.html#manual.localization.facet.ctype">ctype</a></span></dt><dd><dl><dt><span class="sect2"><a href="facets.html#facet.ctype.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="facets.html#facet.ctype.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="codecvt.html">codecvt</a></span></dt><dd><dl><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.req">Requirements</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.design">Design</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.use">Use</a></span></dt><dt><span class="sect2"><a href="codecvt.html#facet.codecvt.future">Future</a></span></dt></dl></dd><dt><span class="sect1"><a href="messages.html">messages</a></span></dt><dd><dl><dt><span class="sect2"><a href="messages.html#facet.messages.req">Requirements</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.design">Design</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.use">Use</a></span></dt><dt><span class="sect2"><a href="messages.html#facet.messages.future">Future</a></span></dt></dl></dd></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt05ch13s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="locales.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">CString (MFC) </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 14. Locales</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/memory.html b/libstdc++-v3/doc/html/manual/memory.html
index 188e34e215d..25e863d9e89 100644
--- a/libstdc++-v3/doc/html/manual/memory.html
+++ b/libstdc++-v3/doc/html/manual/memory.html
@@ -93,7 +93,7 @@
or loading and unloading shared objects in memory. As such, using
caching allocators on systems that do not support
<code class="function">abi::__cxa_atexit</code> is not recommended.
- </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id499506"></a>Interface Design</h4></div></div></div><p>
+ </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id387134"></a>Interface Design</h4></div></div></div><p>
The only allocator interface that
is support is the standard C++ interface. As such, all STL
containers have been adjusted, and all external allocators have
@@ -106,7 +106,7 @@
</p><p>
The base class that <code class="classname">allocator</code> is derived from
may not be user-configurable.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id514211"></a>Selecting Default Allocation Policy</h4></div></div></div><p>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id511422"></a>Selecting Default Allocation Policy</h4></div></div></div><p>
It's difficult to pick an allocation strategy that will provide
maximum utility, without excessively penalizing some behavior. In
fact, it's difficult just deciding which typical actions to measure
@@ -143,7 +143,7 @@
The current default choice for
<code class="classname">allocator</code> is
<code class="classname">__gnu_cxx::new_allocator</code>.
- </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id553469"></a>Disabling Memory Caching</h4></div></div></div><p>
+ </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id532133"></a>Disabling Memory Caching</h4></div></div></div><p>
In use, <code class="classname">allocator</code> may allocate and
deallocate using implementation-specified strategies and
heuristics. Because of this, every call to an allocator object's
@@ -308,11 +308,11 @@
A high-performance allocator that uses a bit-map to keep track
of the used and unused memory locations. It has its own
documentation, found <a class="link" href="bitmap_allocator.html" title="bitmap_allocator">here</a>.
- </p></li></ol></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id501572"></a><p><span class="title"><i>
+ </p></li></ol></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="allocator.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id426851"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
</i>. </span>
isoc++_1998
- <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="id501586"></a><p><span class="title"><i>The Standard Librarian: What Are Allocators Good
+ <span class="pagenums">20.4 Memory. </span></p></div><div class="biblioentry"><a id="id426866"></a><p><span class="title"><i>The Standard Librarian: What Are Allocators Good
</i>. </span>
austernm
<span class="author"><span class="firstname">Matt</span> <span class="surname">Austern</span>. </span><span class="publisher"><span class="publishername">
@@ -320,28 +320,28 @@
. </span></span><span class="biblioid">
<a class="ulink" href="http://www.cuj.com/documents/s=8000/cujcexp1812austern/" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id493166"></a><p><span class="title"><i>The Hoard Memory Allocator</i>. </span>
+ . </span></p></div><div class="biblioentry"><a id="id495648"></a><p><span class="title"><i>The Hoard Memory Allocator</i>. </span>
emeryb
<span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="biblioid">
<a class="ulink" href="http://www.cs.umass.edu/~emery/hoard/" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id498062"></a><p><span class="title"><i>Reconsidering Custom Memory Allocation</i>. </span>
+ . </span></p></div><div class="biblioentry"><a id="id459688"></a><p><span class="title"><i>Reconsidering Custom Memory Allocation</i>. </span>
bergerzorn
<span class="author"><span class="firstname">Emery</span> <span class="surname">Berger</span>. </span><span class="author"><span class="firstname">Ben</span> <span class="surname">Zorn</span>. </span><span class="author"><span class="firstname">Kathryn</span> <span class="surname">McKinley</span>. </span><span class="copyright">Copyright © 2002 OOPSLA. </span><span class="biblioid">
<a class="ulink" href="http://www.cs.umass.edu/~emery/pubs/berger-oopsla2002.pdf" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id556957"></a><p><span class="title"><i>Allocator Types</i>. </span>
+ . </span></p></div><div class="biblioentry"><a id="id516756"></a><p><span class="title"><i>Allocator Types</i>. </span>
kreftlanger
<span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="publisher"><span class="publishername">
C/C++ Users Journal
. </span></span><span class="biblioid">
<a class="ulink" href="http://www.langer.camelot.de/Articles/C++Report/Allocators/Allocators.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id549424"></a><p><span class="title"><i>The C++ Programming Language</i>. </span>
+ . </span></p></div><div class="biblioentry"><a id="id459976"></a><p><span class="title"><i>The C++ Programming Language</i>. </span>
tcpl
<span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 . </span><span class="pagenums">19.4 Allocators. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry"><a id="id508384"></a><p><span class="title"><i>Yalloc: A Recycling C++ Allocator</i>. </span>
+ . </span></span></p></div><div class="biblioentry"><a id="id451788"></a><p><span class="title"><i>Yalloc: A Recycling C++ Allocator</i>. </span>
yenf
<span class="author"><span class="firstname">Felix</span> <span class="surname">Yen</span>. </span><span class="copyright">Copyright © . </span><span class="biblioid">
<a class="ulink" href="http://home.earthlink.net/~brimar/yalloc/" target="_top">
diff --git a/libstdc++-v3/doc/html/manual/messages.html b/libstdc++-v3/doc/html/manual/messages.html
index d6e5422caa9..eb5b9f04c9a 100644
--- a/libstdc++-v3/doc/html/manual/messages.html
+++ b/libstdc++-v3/doc/html/manual/messages.html
@@ -241,38 +241,38 @@ void test01()
model. As of this writing, it is unknown how to query to see
if a specified message catalog exists using the gettext
package.
- </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.messages.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id576567"></a><p><span class="title"><i>
+ </p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="facet.messages.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id442887"></a><p><span class="title"><i>
The GNU C Library
</i>. </span><span class="author"><span class="firstname">Roland</span> <span class="surname">McGrath</span>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2007 FSF. </span><span class="pagenums">Chapters 6 Character Set Handling, and 7 Locales and Internationalization
- . </span></p></div><div class="biblioentry"><a id="id569242"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id417173"></a><p><span class="title"><i>
Correspondence
- </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id569270"></a><p><span class="title"><i>
+ </i>. </span><span class="author"><span class="firstname">Ulrich</span> <span class="surname">Drepper</span>. </span><span class="copyright">Copyright © 2002 . </span></p></div><div class="biblioentry"><a id="id417202"></a><p><span class="title"><i>
ISO/IEC 14882:1998 Programming languages - C++
- </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id491814"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1998 ISO. </span></p></div><div class="biblioentry"><a id="id468091"></a><p><span class="title"><i>
ISO/IEC 9899:1999 Programming languages - C
- </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id491832"></a><p><span class="title"><i>
+ </i>. </span><span class="copyright">Copyright © 1999 ISO. </span></p></div><div class="biblioentry"><a id="id468109"></a><p><span class="title"><i>
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
</i>. </span><span class="copyright">Copyright © 1999
The Open Group/The Institute of Electrical and Electronics Engineers, Inc.. </span><span class="biblioid">
<a class="ulink" href="http://www.opengroup.org/austin/" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id499313"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id524743"></a><p><span class="title"><i>
The C++ Programming Language, Special Edition
</i>. </span><span class="author"><span class="firstname">Bjarne</span> <span class="surname">Stroustrup</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley, Inc.. </span><span class="pagenums">Appendix D. </span><span class="publisher"><span class="publishername">
Addison Wesley
- . </span></span></p></div><div class="biblioentry"><a id="id568542"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id450555"></a><p><span class="title"><i>
Standard C++ IOStreams and Locales
</i>. </span><span class="subtitle">
Advanced Programmer's Guide and Reference
. </span><span class="author"><span class="firstname">Angelika</span> <span class="surname">Langer</span>. </span><span class="author"><span class="firstname">Klaus</span> <span class="surname">Kreft</span>. </span><span class="copyright">Copyright © 2000 Addison Wesley Longman, Inc.. </span><span class="publisher"><span class="publishername">
Addison Wesley Longman
- . </span></span></p></div><div class="biblioentry"><a id="id512340"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id486251"></a><p><span class="title"><i>
Java 2 Platform, Standard Edition, v 1.3.1 API Specification
</i>. </span><span class="pagenums">java.util.Properties, java.text.MessageFormat,
java.util.Locale, java.util.ResourceBundle. </span><span class="biblioid">
<a class="ulink" href="http://java.sun.com/reference/api/index.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id512361"></a><p><span class="title"><i>
+ . </span></p></div><div class="biblioentry"><a id="id486272"></a><p><span class="title"><i>
GNU gettext tools, version 0.10.38, Native Language Support
Library and Tools.
</i>. </span><span class="biblioid">
diff --git a/libstdc++-v3/doc/html/manual/numerics.html b/libstdc++-v3/doc/html/manual/numerics.html
index b01d58cc19d..e4339376002 100644
--- a/libstdc++-v3/doc/html/manual/numerics.html
+++ b/libstdc++-v3/doc/html/manual/numerics.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt09ch20.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="complex.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.numerics"></a>Part X. 
Numerics
- <a id="id509254" class="indexterm"></a>
+ <a id="id443615" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="complex.html">21. Complex</a></span></dt><dd><dl><dt><span class="sect1"><a href="complex.html#numerics.complex.processing">complex Processing</a></span></dt></dl></dd><dt><span class="chapter"><a href="generalized_numeric_operations.html">22. Generalized Operations</a></span></dt><dt><span class="chapter"><a href="numerics_and_c.html">23. Interacting with C</a></span></dt><dd><dl><dt><span class="sect1"><a href="numerics_and_c.html#numerics.c.array">Numerics vs. Arrays</a></span></dt><dt><span class="sect1"><a href="bk01pt10ch23s02.html">C99</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt09ch20.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="complex.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 20. Mutating </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 21. Complex</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/parallel_mode.html b/libstdc++-v3/doc/html/manual/parallel_mode.html
index e6d4e54b85b..cbcdebaf9b9 100644
--- a/libstdc++-v3/doc/html/manual/parallel_mode.html
+++ b/libstdc++-v3/doc/html/manual/parallel_mode.html
@@ -13,11 +13,11 @@ explicit source declaration or by compiling existing sources with a
specific compiler flag.
</p><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="manual.ext.parallel_mode.intro"></a>Intro</h2></div></div></div><p>The following library components in the include
<code class="filename">numeric</code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="function">std::accumulate</code></p></li><li><p><code class="function">std::adjacent_difference</code></p></li><li><p><code class="function">std::inner_product</code></p></li><li><p><code class="function">std::partial_sum</code></p></li></ul></div><p>The following library components in the include
-<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="function">std::adjacent_find</code></p></li><li><p><code class="function">std::count</code></p></li><li><p><code class="function">std::count_if</code></p></li><li><p><code class="function">std::equal</code></p></li><li><p><code class="function">std::find</code></p></li><li><p><code class="function">std::find_if</code></p></li><li><p><code class="function">std::find_first_of</code></p></li><li><p><code class="function">std::for_each</code></p></li><li><p><code class="function">std::generate</code></p></li><li><p><code class="function">std::generate_n</code></p></li><li><p><code class="function">std::lexicographical_compare</code></p></li><li><p><code class="function">std::mismatch</code></p></li><li><p><code class="function">std::search</code></p></li><li><p><code class="function">std::search_n</code></p></li><li><p><code class="function">std::transform</code></p></li><li><p><code class="function">std::replace</code></p></li><li><p><code class="function">std::replace_if</code></p></li><li><p><code class="function">std::max_element</code></p></li><li><p><code class="function">std::merge</code></p></li><li><p><code class="function">std::min_element</code></p></li><li><p><code class="function">std::nth_element</code></p></li><li><p><code class="function">std::partial_sort</code></p></li><li><p><code class="function">std::partition</code></p></li><li><p><code class="function">std::random_shuffle</code></p></li><li><p><code class="function">std::set_union</code></p></li><li><p><code class="function">std::set_intersection</code></p></li><li><p><code class="function">std::set_symmetric_difference</code></p></li><li><p><code class="function">std::set_difference</code></p></li><li><p><code class="function">std::sort</code></p></li><li><p><code class="function">std::stable_sort</code></p></li><li><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="id486451"></a><p><span class="title"><i>
+<code class="filename">algorithm</code> are included in the parallel mode:</p><div class="itemizedlist"><ul type="disc"><li><p><code class="function">std::adjacent_find</code></p></li><li><p><code class="function">std::count</code></p></li><li><p><code class="function">std::count_if</code></p></li><li><p><code class="function">std::equal</code></p></li><li><p><code class="function">std::find</code></p></li><li><p><code class="function">std::find_if</code></p></li><li><p><code class="function">std::find_first_of</code></p></li><li><p><code class="function">std::for_each</code></p></li><li><p><code class="function">std::generate</code></p></li><li><p><code class="function">std::generate_n</code></p></li><li><p><code class="function">std::lexicographical_compare</code></p></li><li><p><code class="function">std::mismatch</code></p></li><li><p><code class="function">std::search</code></p></li><li><p><code class="function">std::search_n</code></p></li><li><p><code class="function">std::transform</code></p></li><li><p><code class="function">std::replace</code></p></li><li><p><code class="function">std::replace_if</code></p></li><li><p><code class="function">std::max_element</code></p></li><li><p><code class="function">std::merge</code></p></li><li><p><code class="function">std::min_element</code></p></li><li><p><code class="function">std::nth_element</code></p></li><li><p><code class="function">std::partial_sort</code></p></li><li><p><code class="function">std::partition</code></p></li><li><p><code class="function">std::random_shuffle</code></p></li><li><p><code class="function">std::set_union</code></p></li><li><p><code class="function">std::set_intersection</code></p></li><li><p><code class="function">std::set_symmetric_difference</code></p></li><li><p><code class="function">std::set_difference</code></p></li><li><p><code class="function">std::sort</code></p></li><li><p><code class="function">std::stable_sort</code></p></li><li><p><code class="function">std::unique_copy</code></p></li></ul></div></div><div class="bibliography"><div class="titlepage"><div><div><h2 class="title"><a id="parallel_mode.biblio"></a>Bibliography</h2></div></div></div><div class="biblioentry"><a id="id426541"></a><p><span class="title"><i>
Parallelization of Bulk Operations for STL Dictionaries
</i>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Leonor</span> <span class="surname">Frias</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername">
Workshop on Highly Parallel Processing on a Chip (HPPC) 2007. (LNCS)
- . </span></span></p></div><div class="biblioentry"><a id="id486497"></a><p><span class="title"><i>
+ . </span></span></p></div><div class="biblioentry"><a id="id426587"></a><p><span class="title"><i>
The Multi-Core Standard Template Library
</i>. </span><span class="author"><span class="firstname">Johannes</span> <span class="surname">Singler</span>. </span><span class="author"><span class="firstname">Peter</span> <span class="surname">Sanders</span>. </span><span class="author"><span class="firstname">Felix</span> <span class="surname">Putze</span>. </span><span class="copyright">Copyright © 2007 . </span><span class="publisher"><span class="publishername">
Euro-Par 2007: Parallel Processing. (LNCS 4641)
diff --git a/libstdc++-v3/doc/html/manual/shared_ptr.html b/libstdc++-v3/doc/html/manual/shared_ptr.html
index 20ffa4ab8f7..2561558047b 100644
--- a/libstdc++-v3/doc/html/manual/shared_ptr.html
+++ b/libstdc++-v3/doc/html/manual/shared_ptr.html
@@ -29,7 +29,7 @@ drops to zero.
Derived classes override those functions to destroy resources in a context
where the correct dynamic type is known. This is an application of the
technique known as type erasure.
- </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id502847"></a>Class Hierarchy</h4></div></div></div><p>
+ </p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.impl"></a>Implementation</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id436681"></a>Class Hierarchy</h4></div></div></div><p>
A <code class="classname">shared_ptr&lt;T&gt;</code> contains a pointer of
type <span class="type">T*</span> and an object of type
<code class="classname">__shared_count</code>. The shared_count contains a
@@ -71,7 +71,7 @@ be forwarded to <span class="type">Tp</span>'s constructor.
Unlike the other <code class="classname">_Sp_counted_*</code> classes, this one is parameterized on the
type of object, not the type of pointer; this is purely a convenience
that simplifies the implementation slightly.
- </p></dd></dl></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id576483"></a>Thread Safety</h4></div></div></div><p>
+ </p></dd></dl></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id451950"></a>Thread Safety</h4></div></div></div><p>
The interface of <code class="classname">tr1::shared_ptr</code> was extended for C++0x
with support for rvalue-references and the other features from
N2351. As with other libstdc++ headers shared by TR1 and C++0x,
@@ -129,7 +129,7 @@ compiler, standard library, platform etc. For the version of
shared_ptr in libstdc++ the compiler and library are fixed, which
makes things much simpler: we have an atomic CAS or we don't, see Lock
Policy below for details.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id514053"></a>Selecting Lock Policy</h4></div></div></div><p>
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id420332"></a>Selecting Lock Policy</h4></div></div></div><p>
</p><p>
There is a single <code class="classname">_Sp_counted_base</code> class,
which is a template parameterized on the enum
@@ -170,7 +170,7 @@ used when libstdc++ is built without <code class="literal">--enable-threads</cod
<code class="filename">ext/atomicity.h</code>, which detect if the program
is multi-threaded. If only one thread of execution exists in
the program then less expensive non-atomic operations are used.
- </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id510775"></a>Dual C++0x and TR1 Implementation</h4></div></div></div><p>
+ </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id515700"></a>Dual C++0x and TR1 Implementation</h4></div></div></div><p>
The classes derived from <code class="classname">_Sp_counted_base</code> (see Class Hierarchy
below) and <code class="classname">__shared_count</code> are implemented separately for C++0x
and TR1, in <code class="filename">bits/boost_sp_shared_count.h</code> and
@@ -181,7 +181,7 @@ The TR1 implementation is considered relatively stable, so is unlikely to
change unless bug fixes require it. If the code that is common to both
C++0x and TR1 modes needs to diverge further then it might be necessary to
duplicate additional classes and only make changes to the C++0x versions.
-</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id495126"></a>Related functions and classes</h4></div></div></div><div class="variablelist"><dl><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>,
+</p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id486010"></a>Related functions and classes</h4></div></div></div><div class="variablelist"><dl><dt><span class="term"><code class="code">dynamic_pointer_cast</code>, <code class="code">static_pointer_cast</code>,
<code class="code">const_pointer_cast</code></span></dt><dd><p>
As noted in N2351, these functions can be implemented non-intrusively using
the alias constructor. However the aliasing constructor is only available
@@ -214,10 +214,10 @@ is called. Users should not try to use this.
As well as the extra constructors, this implementation also needs some
members of _Sp_counted_deleter to be protected where they could otherwise
be private.
- </p></dd></dl></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.using"></a>Use</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id383889"></a>Examples</h4></div></div></div><p>
+ </p></dd></dl></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.using"></a>Use</h3></div></div></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id478324"></a>Examples</h4></div></div></div><p>
Examples of use can be found in the testsuite, under
<code class="filename">testsuite/tr1/2_general_utilities/shared_ptr</code>.
- </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id544850"></a>Unresolved Issues</h4></div></div></div><p>
+ </p></div><div class="sect3" lang="en" xml:lang="en"><div class="titlepage"><div><div><h4 class="title"><a id="id505148"></a>Unresolved Issues</h4></div></div></div><p>
The resolution to C++ Standard Library issue <a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#674" target="_top">674</a>,
"shared_ptr interface changes for consistency with N1856" will
need to be implemented after it is accepted into the working
@@ -265,7 +265,7 @@ be private.
code to work with, Peter Dimov in particular for his help and
invaluable advice on thread safety. Phillip Jordan and Paolo
Carlini for the lock policy implementation.
- </p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id503810"></a><p>[<abbr class="abbrev">
+ </p></div><div class="bibliography"><div class="titlepage"><div><div><h3 class="title"><a id="shared_ptr.biblio"></a>Bibliography</h3></div></div></div><div class="biblioentry"><a id="id450490"></a><p>[<abbr class="abbrev">
n2351
</abbr>] <span class="title"><i>
Improving shared_ptr for C++0x, Revision 2
@@ -274,7 +274,7 @@ be private.
. </span><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2351.htm" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id499970"></a><p>[<abbr class="abbrev">
+ . </span></p></div><div class="biblioentry"><a id="id450514"></a><p>[<abbr class="abbrev">
n2456
</abbr>] <span class="title"><i>
C++ Standard Library Active Issues List (Revision R52)
@@ -283,7 +283,7 @@ be private.
. </span><span class="biblioid">
<a class="ulink" href="http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2456.html" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id520341"></a><p>[<abbr class="abbrev">
+ . </span></p></div><div class="biblioentry"><a id="id419756"></a><p>[<abbr class="abbrev">
n2461
</abbr>] <span class="title"><i>
Working Draft, Standard for Programming Language C++
@@ -292,7 +292,7 @@ be private.
. </span><span class="biblioid">
<a class="ulink" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2461.pdf" target="_top">
</a>
- . </span></p></div><div class="biblioentry"><a id="id520365"></a><p>[<abbr class="abbrev">
+ . </span></p></div><div class="biblioentry"><a id="id509508"></a><p>[<abbr class="abbrev">
boostshared_ptr
</abbr>] <span class="title"><i>
Boost C++ Libraries documentation - shared_ptr class template
diff --git a/libstdc++-v3/doc/html/manual/spine.html b/libstdc++-v3/doc/html/manual/spine.html
index 02bfcf3c500..2b326459013 100644
--- a/libstdc++-v3/doc/html/manual/spine.html
+++ b/libstdc++-v3/doc/html/manual/spine.html
@@ -2,7 +2,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The GNU C++ Library</title><meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /><link rel="home" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="up" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="prev" href="../spine.html" title="The GNU C++ Library Documentation" /><link rel="next" href="intro.html" title="Part I.  Introduction" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The GNU C++ Library</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr></table><hr /></div><div class="book" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual-index"></a>The GNU C++ Library</h1></div><div><p class="copyright">Copyright © 2009
<a class="ulink" href="http://www.fsf.org" target="_top">FSF</a>
- </p></div><div><div class="legalnotice"><a id="id544709"></a><p>
+ </p></div><div><div class="legalnotice"><a id="id426452"></a><p>
<a class="link" href="license.html" title="License">License</a>
</p></div></div></div><hr /></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="part"><a href="intro.html">I.
Introduction
@@ -51,7 +51,7 @@
</a></span></dt><dt><span class="appendix"><a href="appendix_gpl.html">D.
GNU General Public License version 3
- </a></span></dt><dt><span class="appendix"><a href="appendix_gfdl.html">E. GNU Free Documentation License</a></span></dt><dt><span class="index"><a href="bk01ix01.html">Index</a></span></dt></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>1.1. <a href="status.html#id579103">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#id544659">C++ TR1 Implementation Status</a></dt><dt>1.3. <a href="status.html#id505564">C++ 200x Implementation Status</a></dt><dt>3.1. <a href="using_headers.html#id572765">C++ 1998 Library Headers</a></dt><dt>3.2. <a href="using_headers.html#id542995">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.3. <a href="using_headers.html#id499932">C++ 200x Library Headers</a></dt><dt>3.4. <a href="using_headers.html#id515992">C++ 200x Library Headers for C Library Facilities</a></dt><dt>3.5. <a href="using_headers.html#id486926">C++ TR1 Library Headers</a></dt><dt>3.6. <a href="using_headers.html#id516879">C++ TR1 Library Headers for C Library Facilities</a></dt><dt>3.7. <a href="using_headers.html#id515909">C++ ABI Headers</a></dt><dt>3.8. <a href="using_headers.html#id504444">Extension Headers</a></dt><dt>3.9. <a href="using_headers.html#id547772">Extension Debug Headers</a></dt><dt>3.10. <a href="using_headers.html#id492029">Extension Parallel Headers</a></dt><dt>30.1. <a href="bk01pt12ch30s03.html#id498152">Debugging Containers</a></dt><dt>30.2. <a href="bk01pt12ch30s03.html#id520410">Debugging Containers C++0x</a></dt><dt>31.1. <a href="bk01pt12ch31s03.html#id593819">Parallel Algorithms</a></dt><dt>32.1. <a href="bitmap_allocator.html#id504618">Bitmap Allocator Memory Map</a></dt><dt>A.1. <a href="documentation_style.html#id449698">HTML to Docbook XML markup comparison</a></dt><dt>A.2. <a href="documentation_style.html#id475153">Docbook XML Element Use</a></dt><dt>B.1. <a href="api.html#id521791">Extension Allocators</a></dt><dt>B.2. <a href="api.html#id605274">Extension Allocators Continued</a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Documentation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. 
+ </a></span></dt><dt><span class="appendix"><a href="appendix_gfdl.html">E. GNU Free Documentation License</a></span></dt><dt><span class="index"><a href="bk01ix01.html">Index</a></span></dt></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>1.1. <a href="status.html#id446021">C++ 1998/2003 Implementation Status</a></dt><dt>1.2. <a href="status.html#id433682">C++ TR1 Implementation Status</a></dt><dt>1.3. <a href="status.html#id483878">C++ 200x Implementation Status</a></dt><dt>3.1. <a href="using_headers.html#id450185">C++ 1998 Library Headers</a></dt><dt>3.2. <a href="using_headers.html#id455065">C++ 1998 Library Headers for C Library Facilities</a></dt><dt>3.3. <a href="using_headers.html#id440168">C++ 200x Library Headers</a></dt><dt>3.4. <a href="using_headers.html#id485458">C++ 200x Library Headers for C Library Facilities</a></dt><dt>3.5. <a href="using_headers.html#id437190">C++ TR1 Library Headers</a></dt><dt>3.6. <a href="using_headers.html#id387281">C++ TR1 Library Headers for C Library Facilities</a></dt><dt>3.7. <a href="using_headers.html#id517054">C++ ABI Headers</a></dt><dt>3.8. <a href="using_headers.html#id439669">Extension Headers</a></dt><dt>3.9. <a href="using_headers.html#id422368">Extension Debug Headers</a></dt><dt>3.10. <a href="using_headers.html#id436860">Extension Parallel Headers</a></dt><dt>30.1. <a href="bk01pt12ch30s03.html#id452232">Debugging Containers</a></dt><dt>30.2. <a href="bk01pt12ch30s03.html#id387544">Debugging Containers C++0x</a></dt><dt>31.1. <a href="bk01pt12ch31s03.html#id468908">Parallel Algorithms</a></dt><dt>32.1. <a href="bitmap_allocator.html#id508940">Bitmap Allocator Memory Map</a></dt><dt>A.1. <a href="documentation_style.html#id447935">HTML to Docbook XML markup comparison</a></dt><dt>A.2. <a href="documentation_style.html#id458695">Docbook XML Element Use</a></dt><dt>B.1. <a href="api.html#id539341">Extension Allocators</a></dt><dt>B.2. <a href="api.html#id545205">Extension Allocators Continued</a></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="../spine.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="intro.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The GNU C++ Library Documentation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Part I. 
Introduction
</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html
index a8e94b95c68..07c9a1d415e 100644
--- a/libstdc++-v3/doc/html/manual/status.html
+++ b/libstdc++-v3/doc/html/manual/status.html
@@ -8,7 +8,7 @@ This status table is based on the table of contents of ISO/IEC 14882:2003.
</p><p>
This page describes the C++0x support in mainline GCC SVN, not in any
particular release.
-</p><div class="table"><a id="id579103"></a><p class="title"><b>Table 1.1. C++ 1998/2003 Implementation Status</b></p><div class="table-contents"><table summary="C++ 1998/2003 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
+</p><div class="table"><a id="id446021"></a><p class="title"><b>Table 1.1. C++ 1998/2003 Implementation Status</b></p><div class="table-contents"><table summary="C++ 1998/2003 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
<span class="emphasis"><em>18</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Language support</em></span>
@@ -153,7 +153,7 @@ In this implementation the header names are prefixed by
</p><p>
This page describes the TR1 support in mainline GCC SVN, not in any particular
release.
-</p><div class="table"><a id="id544659"></a><p class="title"><b>Table 1.2. C++ TR1 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="3" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code">&lt;functional&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code">&lt;memory&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left"> </td><td align="left">
+</p><div class="table"><a id="id433682"></a><p class="title"><b>Table 1.2. C++ TR1 Implementation Status</b></p><div class="table-contents"><table summary="C++ TR1 Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left"><span class="emphasis"><em>2</em></span></td><td colspan="3" align="left"><span class="emphasis"><em>General Utilities</em></span></td></tr><tr><td align="left">2.1</td><td align="left">Reference wrappers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.1</td><td align="left">Additions to header <code class="code">&lt;functional&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2</td><td align="left">Class template <code class="code">reference_wrapper</code></td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.1.2.1</td><td align="left"><code class="code">reference_wrapper</code> construct/copy/destroy</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.2</td><td align="left"><code class="code">reference_wrapper</code> assignment</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.3</td><td align="left"><code class="code">reference_wrapper</code> access</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.4</td><td align="left"><code class="code">reference_wrapper</code> invocation</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.1.2.5</td><td align="left"><code class="code">reference_wrapper</code> helper functions</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2</td><td align="left">Smart pointers</td><td align="left"> </td><td align="left"> </td></tr><tr><td align="left">2.2.1</td><td align="left">Additions to header <code class="code">&lt;memory&gt;</code> synopsis</td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.2</td><td align="left">Class <code class="code">bad_weak_ptr</code></td><td align="left">Y</td><td align="left"> </td></tr><tr><td align="left">2.2.3</td><td align="left">Class template <code class="code">shared_ptr</code></td><td align="left"> </td><td align="left">
<p>
Uses code from
<a class="ulink" href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm" target="_top">boost::shared_ptr</a>.
@@ -171,7 +171,7 @@ presence of the required flag.
</p><p>
This page describes the C++0x support in mainline GCC SVN, not in any
particular release.
-</p><div class="table"><a id="id505564"></a><p class="title"><b>Table 1.3. C++ 200x Implementation Status</b></p><div class="table-contents"><table summary="C++ 200x Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
+</p><div class="table"><a id="id483878"></a><p class="title"><b>Table 1.3. C++ 200x Implementation Status</b></p><div class="table-contents"><table summary="C++ 200x Implementation Status" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><thead><tr><th align="left">Section</th><th align="left">Description</th><th align="left">Status</th><th align="left">Comments</th></tr></thead><tbody><tr><td align="left">
<span class="emphasis"><em>18</em></span>
</td><td colspan="3" align="left">
<span class="emphasis"><em>Language support</em></span>
diff --git a/libstdc++-v3/doc/html/manual/strings.html b/libstdc++-v3/doc/html/manual/strings.html
index 31995cfd99c..c2e94a8bfd3 100644
--- a/libstdc++-v3/doc/html/manual/strings.html
+++ b/libstdc++-v3/doc/html/manual/strings.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="shared_ptr.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt05ch13.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.strings"></a>Part V. 
Strings
- <a id="id519217" class="indexterm"></a>
+ <a id="id442055" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="bk01pt05ch13.html">13. String Classes</a></span></dt><dd><dl><dt><span class="sect1"><a href="bk01pt05ch13.html#strings.string.simple">Simple Transformations</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s02.html">Case Sensitivity</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s03.html">Arbitrary Character Types</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s04.html">Tokenizing</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s05.html">Shrink to Fit</a></span></dt><dt><span class="sect1"><a href="bk01pt05ch13s06.html">CString (MFC)</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="shared_ptr.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt05ch13.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">shared_ptr </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 13. String Classes</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/support.html b/libstdc++-v3/doc/html/manual/support.html
index 2516efbaae7..a539e63b3bf 100644
--- a/libstdc++-v3/doc/html/manual/support.html
+++ b/libstdc++-v3/doc/html/manual/support.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="debug.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="bk01pt02pr01.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.support"></a>Part II. 
Support
- <a id="id482780" class="indexterm"></a>
+ <a id="id455542" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="bk01pt02pr01.html"></a></span></dt><dt><span class="chapter"><a href="fundamental_types.html">4. Types</a></span></dt><dd><dl><dt><span class="sect1"><a href="fundamental_types.html#manual.support.types.fundamental">Fundamental Types</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch04s02.html">Numeric Properties</a></span></dt><dt><span class="sect1"><a href="bk01pt02ch04s03.html">NULL</a></span></dt></dl></dd><dt><span class="chapter"><a href="dynamic_memory.html">5. Dynamic Memory</a></span></dt><dt><span class="chapter"><a href="termination.html">6. Termination</a></span></dt><dd><dl><dt><span class="sect1"><a href="termination.html#support.termination.handlers">Termination Handlers</a></span></dt><dt><span class="sect1"><a href="verbose_termination.html">Verbose Terminate Handler</a></span></dt></dl></dd></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="debug.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk01pt02pr01.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Debugging Support </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/html/manual/using_headers.html b/libstdc++-v3/doc/html/manual/using_headers.html
index 1e669224e10..a7b21388bd2 100644
--- a/libstdc++-v3/doc/html/manual/using_headers.html
+++ b/libstdc++-v3/doc/html/manual/using_headers.html
@@ -20,16 +20,16 @@
upcoming 200x standard.
</p><p>
C++98/03 include files. These are available in the default compilation mode, i.e. <code class="code">-std=c++98</code> or <code class="code">-std=gnu++98</code>.
- </p><div class="table"><a id="id572765"></a><p class="title"><b>Table 3.1. C++ 1998 Library Headers</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id542995"></a><p class="title"><b>Table 3.2. C++ 1998 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
+ </p><div class="table"><a id="id450185"></a><p class="title"><b>Table 3.1. C++ 1998 Library Headers</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">complex</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td></tr><tr><td align="left"><code class="filename">fstream</code></td><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">new</code></td><td align="left"><code class="filename">numeric</code></td></tr><tr><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td></tr><tr><td align="left"><code class="filename">stdexcept</code></td><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">utility</code></td><td align="left"><code class="filename">typeinfo</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id455065"></a><p class="title"><b>Table 3.2. C++ 1998 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 1998 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">ciso646</code></td></tr><tr><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td></tr><tr><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdio</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstring</code></td></tr><tr><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cwchar</code></td><td align="left"><code class="filename">cwctype</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
C++0x include files. These are only available in C++0x compilation
mode, i.e. <code class="literal">-std=c++0x</code> or <code class="literal">-std=gnu++0x</code>.
-</p><p></p><div class="table"><a id="id499932"></a><p class="title"><b>Table 3.3. C++ 200x Library Headers</b></p><div class="table-contents"><table summary="C++ 200x Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td><td align="left"><code class="filename">new</code></td></tr><tr><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td><td align="left"><code class="filename">ratio</code></td></tr><tr><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td><td align="left"><code class="filename">stdexcept</code></td></tr><tr><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td><td align="left"><code class="filename">tuple</code></td></tr><tr><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="filename">utility</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id515992"></a><p class="title"><b>Table 3.4. C++ 200x Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 200x Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdatomic</code></td></tr><tr><td align="left"><code class="filename">cstdbool</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td></tr><tr><td align="left"><code class="filename">cstring</code></td><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td></tr><tr><td align="left"><code class="filename">cwctype</code></td><td align="left"><code class="filename">stdatomic.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
+</p><p></p><div class="table"><a id="id440168"></a><p class="title"><b>Table 3.3. C++ 200x Library Headers</b></p><div class="table-contents"><table summary="C++ 200x Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col /></colgroup><tbody><tr><td align="left"><code class="filename">algorithm</code></td><td align="left"><code class="filename">array</code></td><td align="left"><code class="filename">bitset</code></td><td align="left"><code class="filename">chrono</code></td><td align="left"><code class="filename">complex</code></td></tr><tr><td align="left"><code class="filename">condition_variable</code></td><td align="left"><code class="filename">deque</code></td><td align="left"><code class="filename">exception</code></td><td align="left"><code class="filename">forward_list</code></td><td align="left"><code class="filename">fstream</code></td></tr><tr><td align="left"><code class="filename">functional</code></td><td align="left"><code class="filename">initalizer_list</code></td><td align="left"><code class="filename">iomanip</code></td><td align="left"><code class="filename">ios</code></td><td align="left"><code class="filename">iosfwd</code></td></tr><tr><td align="left"><code class="filename">iostream</code></td><td align="left"><code class="filename">istream</code></td><td align="left"><code class="filename">iterator</code></td><td align="left"><code class="filename">limits</code></td><td align="left"><code class="filename">list</code></td></tr><tr><td align="left"><code class="filename">locale</code></td><td align="left"><code class="filename">map</code></td><td align="left"><code class="filename">memory</code></td><td align="left"><code class="filename">mutex</code></td><td align="left"><code class="filename">new</code></td></tr><tr><td align="left"><code class="filename">numeric</code></td><td align="left"><code class="filename">ostream</code></td><td align="left"><code class="filename">queue</code></td><td align="left"><code class="filename">random</code></td><td align="left"><code class="filename">ratio</code></td></tr><tr><td align="left"><code class="filename">regex</code></td><td align="left"><code class="filename">set</code></td><td align="left"><code class="filename">sstream</code></td><td align="left"><code class="filename">stack</code></td><td align="left"><code class="filename">stdexcept</code></td></tr><tr><td align="left"><code class="filename">streambuf</code></td><td align="left"><code class="filename">string</code></td><td align="left"><code class="filename">system_error</code></td><td align="left"><code class="filename">thread</code></td><td align="left"><code class="filename">tuple</code></td></tr><tr><td align="left"><code class="filename">type_traits</code></td><td align="left"><code class="filename">typeinfo</code></td><td align="left"><code class="filename">unordered_map</code></td><td align="left"><code class="filename">unordered_set</code></td><td align="left"><code class="filename">utility</code></td></tr><tr><td align="left"><code class="filename">valarray</code></td><td align="left"><code class="filename">vector</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id485458"></a><p class="title"><b>Table 3.4. C++ 200x Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ 200x Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cassert</code></td><td align="left"><code class="filename">ccomplex</code></td><td align="left"><code class="filename">cctype</code></td><td align="left"><code class="filename">cerrno</code></td><td align="left"><code class="filename">cfenv</code></td></tr><tr><td align="left"><code class="filename">cfloat</code></td><td align="left"><code class="filename">cinttypes</code></td><td align="left"><code class="filename">ciso646</code></td><td align="left"><code class="filename">climits</code></td><td align="left"><code class="filename">clocale</code></td></tr><tr><td align="left"><code class="filename">cmath</code></td><td align="left"><code class="filename">csetjmp</code></td><td align="left"><code class="filename">csignal</code></td><td align="left"><code class="filename">cstdarg</code></td><td align="left"><code class="filename">cstdatomic</code></td></tr><tr><td align="left"><code class="filename">cstdbool</code></td><td align="left"><code class="filename">cstddef</code></td><td align="left"><code class="filename">cstdint</code></td><td align="left"><code class="filename">cstdlib</code></td><td align="left"><code class="filename">cstdio</code></td></tr><tr><td align="left"><code class="filename">cstring</code></td><td align="left"><code class="filename">ctgmath</code></td><td align="left"><code class="filename">ctime</code></td><td align="left"><code class="filename">cuchar</code></td><td align="left"><code class="filename">cwchar</code></td></tr><tr><td align="left"><code class="filename">cwctype</code></td><td align="left"><code class="filename">stdatomic.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p>
In addition, TR1 includes as:
-</p><div class="table"><a id="id486926"></a><p class="title"><b>Table 3.5. C++ TR1 Library Headers</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id516879"></a><p class="title"><b>Table 3.6. C++ TR1 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
+</p><div class="table"><a id="id437190"></a><p class="title"><b>Table 3.5. C++ TR1 Library Headers</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/array</code></td><td align="left"><code class="filename">tr1/complex</code></td><td align="left"><code class="filename">tr1/memory</code></td><td align="left"><code class="filename">tr1/functional</code></td><td align="left"><code class="filename">tr1/random</code></td></tr><tr><td align="left"><code class="filename">tr1/regex</code></td><td align="left"><code class="filename">tr1/tuple</code></td><td align="left"><code class="filename">tr1/type_traits</code></td><td align="left"><code class="filename">tr1/unordered_map</code></td><td align="left"><code class="filename">tr1/unordered_set</code></td></tr><tr><td align="left"><code class="filename">tr1/utility</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id387281"></a><p class="title"><b>Table 3.6. C++ TR1 Library Headers for C Library Facilities</b></p><div class="table-contents"><table summary="C++ TR1 Library Headers for C Library Facilities" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">tr1/ccomplex</code></td><td align="left"><code class="filename">tr1/cfenv</code></td><td align="left"><code class="filename">tr1/cfloat</code></td><td align="left"><code class="filename">tr1/cmath</code></td><td align="left"><code class="filename">tr1/cinttypes</code></td></tr><tr><td align="left"><code class="filename">tr1/climits</code></td><td align="left"><code class="filename">tr1/cstdarg</code></td><td align="left"><code class="filename">tr1/cstdbool</code></td><td align="left"><code class="filename">tr1/cstdint</code></td><td align="left"><code class="filename">tr1/cstdio</code></td></tr><tr><td align="left"><code class="filename">tr1/cstdlib</code></td><td align="left"><code class="filename">tr1/ctgmath</code></td><td align="left"><code class="filename">tr1/ctime</code></td><td align="left"><code class="filename">tr1/cwchar</code></td><td align="left"><code class="filename">tr1/cwctype</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
Also included are files for the C++ ABI interface:
-</p><div class="table"><a id="id515909"></a><p class="title"><b>Table 3.7. C++ ABI Headers</b></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
+</p><div class="table"><a id="id517054"></a><p class="title"><b>Table 3.7. C++ ABI Headers</b></p><div class="table-contents"><table summary="C++ ABI Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">cxxabi.h</code></td><td align="left"><code class="filename">cxxabi_forced.h</code></td></tr></tbody></table></div></div><br class="table-break" /><p>
And a large variety of extensions.
-</p><div class="table"><a id="id504444"></a><p class="title"><b>Table 3.8. Extension Headers</b></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id547772"></a><p class="title"><b>Table 3.9. Extension Debug Headers</b></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id492029"></a><p class="title"><b>Table 3.10. Extension Parallel Headers</b></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules.
+</p><div class="table"><a id="id439669"></a><p class="title"><b>Table 3.8. Extension Headers</b></p><div class="table-contents"><table summary="Extension Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">ext/algorithm</code></td><td align="left"><code class="filename">ext/atomicity.h</code></td><td align="left"><code class="filename">ext/array_allocator.h</code></td><td align="left"><code class="filename">ext/bitmap_allocator.h</code></td><td align="left"><code class="filename">ext/cast.h</code></td></tr><tr><td align="left"><code class="filename">ext/codecvt_specializations.h</code></td><td align="left"><code class="filename">ext/concurrence.h</code></td><td align="left"><code class="filename">ext/debug_allocator.h</code></td><td align="left"><code class="filename">ext/enc_filebuf.h</code></td><td align="left"><code class="filename">ext/extptr_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/functional</code></td><td align="left"><code class="filename">ext/iterator</code></td><td align="left"><code class="filename">ext/malloc_allocator.h</code></td><td align="left"><code class="filename">ext/memory</code></td><td align="left"><code class="filename">ext/mt_allocator.h</code></td></tr><tr><td align="left"><code class="filename">ext/new_allocator.h</code></td><td align="left"><code class="filename">ext/numeric</code></td><td align="left"><code class="filename">ext/numeric_traits.h</code></td><td align="left"><code class="filename">ext/pb_ds/assoc_container.h</code></td><td align="left"><code class="filename">ext/pb_ds/priority_queue.h</code></td></tr><tr><td align="left"><code class="filename">ext/pod_char_traits.h</code></td><td align="left"><code class="filename">ext/pool_allocator.h</code></td><td align="left"><code class="filename">ext/rb_tree</code></td><td align="left"><code class="filename">ext/rope</code></td><td align="left"><code class="filename">ext/slist</code></td></tr><tr><td align="left"><code class="filename">ext/stdio_filebuf.h</code></td><td align="left"><code class="filename">ext/stdio_sync_filebuf.h</code></td><td align="left"><code class="filename">ext/throw_allocator.h</code></td><td align="left"><code class="filename">ext/typelist.h</code></td><td align="left"><code class="filename">ext/type_traits.h</code></td></tr><tr><td align="left"><code class="filename">ext/vstring.h</code></td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id422368"></a><p class="title"><b>Table 3.9. Extension Debug Headers</b></p><div class="table-contents"><table summary="Extension Debug Headers" border="1"><colgroup><col align="left" /><col align="left" /><col align="left" /><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">debug/bitset</code></td><td align="left"><code class="filename">debug/deque</code></td><td align="left"><code class="filename">debug/list</code></td><td align="left"><code class="filename">debug/map</code></td><td align="left"><code class="filename">debug/set</code></td></tr><tr><td align="left"><code class="filename">debug/string</code></td><td align="left"><code class="filename">debug/unordered_map</code></td><td align="left"><code class="filename">debug/unordered_set</code></td><td align="left"><code class="filename">debug/vector</code></td><td class="auto-generated"> </td></tr></tbody></table></div></div><br class="table-break" /><p></p><div class="table"><a id="id436860"></a><p class="title"><b>Table 3.10. Extension Parallel Headers</b></p><div class="table-contents"><table summary="Extension Parallel Headers" border="1"><colgroup><col align="left" /><col align="left" /></colgroup><tbody><tr><td align="left"><code class="filename">parallel/algorithm</code></td><td align="left"><code class="filename">parallel/numeric</code></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.mixing"></a>Mixing Headers</h3></div></div></div><p> A few simple rules.
</p><p>First, mixing different dialects of the standard headers is not
possible. It's an all-or-nothing affair. Thus, code like
</p><pre class="programlisting">
diff --git a/libstdc++-v3/doc/html/manual/utilities.html b/libstdc++-v3/doc/html/manual/utilities.html
index eff9c25ae00..ca5573140d2 100644
--- a/libstdc++-v3/doc/html/manual/utilities.html
+++ b/libstdc++-v3/doc/html/manual/utilities.html
@@ -5,5 +5,5 @@
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk01pt03ch07s03.html">Prev</a> </td><th width="60%" align="center">The GNU C++ Library</th><td width="20%" align="right"> <a accesskey="n" href="functors.html">Next</a></td></tr></table><hr /></div><div class="part" lang="en" xml:lang="en"><div class="titlepage"><div><div><h1 class="title"><a id="manual.util"></a>Part IV. 
Utilities
- <a id="id569972" class="indexterm"></a>
+ <a id="id440726" class="indexterm"></a>
</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="functors.html">9. Functors</a></span></dt><dt><span class="chapter"><a href="pairs.html">10. Pairs</a></span></dt><dt><span class="chapter"><a href="memory.html">11. Memory</a></span></dt><dd><dl><dt><span class="sect1"><a href="memory.html#manual.util.memory.allocator">Allocators</a></span></dt><dd><dl><dt><span class="sect2"><a href="memory.html#allocator.req">Requirements</a></span></dt><dt><span class="sect2"><a href="memory.html#allocator.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="memory.html#allocator.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="memory.html#allocator.using">Using a Specific Allocator</a></span></dt><dt><span class="sect2"><a href="memory.html#allocator.custom">Custom Allocators</a></span></dt><dt><span class="sect2"><a href="memory.html#allocator.ext">Extension Allocators</a></span></dt></dl></dd><dt><span class="sect1"><a href="auto_ptr.html">auto_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="auto_ptr.html#auto_ptr.limitations">Limitations</a></span></dt><dt><span class="sect2"><a href="auto_ptr.html#auto_ptr.using">Use in Containers</a></span></dt></dl></dd><dt><span class="sect1"><a href="shared_ptr.html">shared_ptr</a></span></dt><dd><dl><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.req">Requirements</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.design_issues">Design Issues</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.impl">Implementation</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.using">Use</a></span></dt><dt><span class="sect2"><a href="shared_ptr.html#shared_ptr.ack">Acknowledgments</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="traits.html">12. Traits</a></span></dt></dl></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk01pt03ch07s03.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spine.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="functors.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Cancellation </td><td width="20%" align="center"><a accesskey="h" href="../spine.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 9. Functors</td></tr></table></div></body></html>
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 560a0b54e9c..28b80c90af0 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -393,6 +393,12 @@ requirements of the license of GCC.
<listitem><para>These functions set <code>failbit</code> on error now.
</para></listitem></varlistentry>
+ <varlistentry><term><ulink url="../ext/lwg-defects.html#130">130</ulink>:
+ <emphasis>Return type of container::erase(iterator) differs for associative containers</emphasis>
+ </term>
+ <listitem><para>Make member <code>erase</code> return iterator for <code>set</code>, <code>multiset</code>, <code>map</code>, <code>multimap</code>.
+ </para></listitem></varlistentry>
+
<varlistentry><term><ulink url="../ext/lwg-defects.html#136">136</ulink>:
<emphasis>seekp, seekg setting wrong streams?</emphasis>
</term>
@@ -604,6 +610,14 @@ requirements of the license of GCC.
<listitem><para>Replace &quot;new&quot; with &quot;::new&quot;.
</para></listitem></varlistentry>
+ <varlistentry><term><ulink url="../ext/lwg-active.html#408">408</ulink>:
+ <emphasis>
+ Is vector&lt;reverse_iterator&lt;char*&gt; &gt; forbidden?
+ </emphasis>
+ </term>
+ <listitem><para>Tweak the debug-mode checks in _Safe_iterator.
+ </para></listitem></varlistentry>
+
<varlistentry><term><ulink url="../ext/lwg-defects.html#409">409</ulink>:
<emphasis>Closing an fstream should clear the error state</emphasis>
</term>
diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml
index 1dfeb83cd7c..a32cdb1cd93 100644
--- a/libstdc++-v3/doc/xml/manual/using.xml
+++ b/libstdc++-v3/doc/xml/manual/using.xml
@@ -242,54 +242,55 @@ mode, i.e. <literal>-std=c++0x</literal> or <literal>-std=gnu++0x</literal>.
</row>
<row>
<entry><filename class="headerfile">functional</filename></entry>
+<entry><filename class="headerfile">future</filename></entry>
<entry><filename class="headerfile">initalizer_list</filename></entry>
<entry><filename class="headerfile">iomanip</filename></entry>
<entry><filename class="headerfile">ios</filename></entry>
-<entry><filename class="headerfile">iosfwd</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">iosfwd</filename></entry>
<entry><filename class="headerfile">iostream</filename></entry>
<entry><filename class="headerfile">istream</filename></entry>
<entry><filename class="headerfile">iterator</filename></entry>
<entry><filename class="headerfile">limits</filename></entry>
-<entry><filename class="headerfile">list</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">list</filename></entry>
<entry><filename class="headerfile">locale</filename></entry>
<entry><filename class="headerfile">map</filename></entry>
<entry><filename class="headerfile">memory</filename></entry>
<entry><filename class="headerfile">mutex</filename></entry>
-<entry><filename class="headerfile">new</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">new</filename></entry>
<entry><filename class="headerfile">numeric</filename></entry>
<entry><filename class="headerfile">ostream</filename></entry>
<entry><filename class="headerfile">queue</filename></entry>
<entry><filename class="headerfile">random</filename></entry>
-<entry><filename class="headerfile">ratio</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">ratio</filename></entry>
<entry><filename class="headerfile">regex</filename></entry>
<entry><filename class="headerfile">set</filename></entry>
<entry><filename class="headerfile">sstream</filename></entry>
<entry><filename class="headerfile">stack</filename></entry>
-<entry><filename class="headerfile">stdexcept</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">stdexcept</filename></entry>
<entry><filename class="headerfile">streambuf</filename></entry>
<entry><filename class="headerfile">string</filename></entry>
<entry><filename class="headerfile">system_error</filename></entry>
<entry><filename class="headerfile">thread</filename></entry>
-<entry><filename class="headerfile">tuple</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">tuple</filename></entry>
<entry><filename class="headerfile">type_traits</filename></entry>
<entry><filename class="headerfile">typeinfo</filename></entry>
<entry><filename class="headerfile">unordered_map</filename></entry>
<entry><filename class="headerfile">unordered_set</filename></entry>
-<entry><filename class="headerfile">utility</filename></entry>
</row>
<row>
+<entry><filename class="headerfile">utility</filename></entry>
<entry><filename class="headerfile">valarray</filename></entry>
<entry><filename class="headerfile">vector</filename></entry>
</row>
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index d450a4717de..10dea7563d8 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1007,7 +1007,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__size_type __extracted = 0;
typename __ios_base::iostate __err = __ios_base::goodbit;
typename __istream_type::sentry __cerb(__in, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -1078,7 +1078,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const __size_type __n = __str.max_size();
typename __ios_base::iostate __err = __ios_base::goodbit;
typename __istream_type::sentry __cerb(__in, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index 724d87b01b1..5158f2dac64 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -1057,7 +1057,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
splice_after(const_iterator __pos, forward_list&& __list,
const_iterator __it)
- { this->splice_after(__pos, __list, __it, __it._M_next()); }
+ {
+ this->splice_after(__pos, std::forward<forward_list>(__list),
+ __it, __it._M_next());
+ }
/**
* @brief Insert range from another %forward_list.
@@ -1146,7 +1149,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
*/
void
merge(forward_list&& __list)
- { this->merge(__list, std::less<_Tp>()); }
+ { this->merge(std::forward<forward_list>(__list), std::less<_Tp>()); }
/**
* @brief Merge sorted lists according to comparison function.
diff --git a/libstdc++-v3/include/bits/functexcept.h b/libstdc++-v3/include/bits/functexcept.h
index 9315d3409dc..62174819118 100644
--- a/libstdc++-v3/include/bits/functexcept.h
+++ b/libstdc++-v3/include/bits/functexcept.h
@@ -88,6 +88,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
__throw_system_error(int) __attribute__((__noreturn__));
+ void
+ __throw_future_error(int) __attribute__((__noreturn__));
+
_GLIBCXX_END_NAMESPACE
#endif
diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h
index c21abfe08b2..78b0aa3cf66 100644
--- a/libstdc++-v3/include/bits/functional_hash.h
+++ b/libstdc++-v3/include/bits/functional_hash.h
@@ -1,6 +1,6 @@
// functional_hash.h header -*- C++ -*-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -61,7 +61,7 @@ namespace std
template<>
_GLIBCXX_PURE size_t
- hash<error_code>::operator()(error_code) const throw ();
+ hash<error_code>::operator()(error_code) const;
}
#endif // _FUNCTIONAL_HASH_H
diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc
index d005f736f03..6d1679d152f 100644
--- a/libstdc++-v3/include/bits/istream.tcc
+++ b/libstdc++-v3/include/bits/istream.tcc
@@ -87,7 +87,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_extract(_ValueT& __v)
{
sentry __cerb(*this, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -116,7 +116,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
sentry __cerb(*this, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -161,7 +161,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 118. basic_istream uses nonexistent num_get member functions.
sentry __cerb(*this, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -205,7 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, false);
- if (__cerb && __sbout)
+ if (__sbout && static_cast<bool>(__cerb))
{
__try
{
@@ -240,7 +240,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -274,7 +274,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -311,7 +311,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -358,7 +358,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -402,7 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -461,7 +461,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -494,7 +494,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb && __n > 0)
+ if (__n > 0 && static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -556,7 +556,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb && __n > 0)
+ if (__n > 0 && static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -622,7 +622,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
int_type __c = traits_type::eof();
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -651,7 +651,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -680,7 +680,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -714,7 +714,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// 60. What is a formatted input function?
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -747,7 +747,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// 60. What is a formatted input function?
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -780,7 +780,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// DR60. Do not change _M_gcount.
int __ret = -1;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -906,7 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename __istream_type::int_type __int_type;
typename __istream_type::sentry __cerb(__in, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -943,7 +943,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
streamsize __extracted = 0;
ios_base::iostate __err = ios_base::goodbit;
typename __istream_type::sentry __cerb(__in, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 25773e13c48..e52dec81bc7 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -46,12 +46,30 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef _Tp type;
};
- /// forward
+ /// forward (as per N2835)
+ /// Forward lvalues as rvalues.
template<typename _Tp>
- inline _Tp&&
+ inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
+ forward(typename std::identity<_Tp>::type& __t)
+ { return static_cast<_Tp&&>(__t); }
+
+ /// Forward rvalues as rvalues.
+ template<typename _Tp>
+ inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
forward(typename std::identity<_Tp>::type&& __t)
+ { return static_cast<_Tp&&>(__t); }
+
+ // Forward lvalues as lvalues.
+ template<typename _Tp>
+ inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
+ forward(typename std::identity<_Tp>::type __t)
{ return __t; }
+ // Prevent forwarding rvalues as const lvalues.
+ template<typename _Tp>
+ inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
+ forward(typename std::remove_reference<_Tp>::type&& __t) = delete;
+
/**
* @brief Move a value.
* @ingroup mutating_algorithms
@@ -61,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp>
inline typename std::remove_reference<_Tp>::type&&
move(_Tp&& __t)
- { return __t; }
+ { return static_cast<typename std::remove_reference<_Tp>::type&&>(__t); }
_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc
index 1147212aa14..df68a57fa61 100644
--- a/libstdc++-v3/include/bits/ostream.tcc
+++ b/libstdc++-v3/include/bits/ostream.tcc
@@ -64,7 +64,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_insert(_ValueT __v)
{
sentry __cerb(*this);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -121,7 +121,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this);
- if (__cerb && __sbin)
+ if (__sbin && static_cast<bool>(__cerb))
{
__try
{
@@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Unformatted output functions should catch exceptions thrown
// from streambuf members.
sentry __cerb(*this);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -190,7 +190,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// Unformatted output functions should catch exceptions thrown
// from streambuf members.
sentry __cerb(*this);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{ _M_write(__s, __n); }
diff --git a/libstdc++-v3/include/bits/ostream_insert.h b/libstdc++-v3/include/bits/ostream_insert.h
index e0017ee7cfd..4fc52c86aff 100644
--- a/libstdc++-v3/include/bits/ostream_insert.h
+++ b/libstdc++-v3/include/bits/ostream_insert.h
@@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
typedef typename __ostream_type::ios_base __ios_base;
typename __ostream_type::sentry __cerb(__out);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h
index aa34fccf248..06aa6f87b91 100644
--- a/libstdc++-v3/include/bits/random.h
+++ b/libstdc++-v3/include/bits/random.h
@@ -2039,42 +2039,42 @@ namespace std
const param_type& __p)
{ return std::exp(__p.s() * _M_nd(__urng) + __p.m()); }
+ /**
+ * @brief Inserts a %lognormal_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %lognormal_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&,
+ const std::lognormal_distribution<_RealType1>&);
+
+ /**
+ * @brief Extracts a %lognormal_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %lognormal_distribution random number
+ * generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&,
+ std::lognormal_distribution<_RealType1>&);
+
private:
param_type _M_param;
std::normal_distribution<result_type> _M_nd;
};
- /**
- * @brief Inserts a %lognormal_distribution random number distribution
- * @p __x into the output stream @p __os.
- *
- * @param __os An output stream.
- * @param __x A %lognormal_distribution random number distribution.
- *
- * @returns The output stream with the state of @p __x inserted or in
- * an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_ostream<_CharT, _Traits>&
- operator<<(std::basic_ostream<_CharT, _Traits>&,
- const std::lognormal_distribution<_RealType>&);
-
- /**
- * @brief Extracts a %lognormal_distribution random number distribution
- * @p __x from the input stream @p __is.
- *
- * @param __is An input stream.
- * @param __x A %lognormal_distribution random number
- * generator engine.
- *
- * @returns The input stream with @p __x extracted or in an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>&,
- std::lognormal_distribution<_RealType>&);
-
/**
* @brief A gamma continuous distribution for random numbers.
@@ -2198,41 +2198,41 @@ namespace std
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
+ /**
+ * @brief Inserts a %gamma_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %gamma_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&,
+ const std::gamma_distribution<_RealType1>&);
+
+ /**
+ * @brief Extracts a %gamma_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %gamma_distribution random number generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&,
+ std::gamma_distribution<_RealType1>&);
+
private:
param_type _M_param;
std::normal_distribution<result_type> _M_nd;
};
- /**
- * @brief Inserts a %gamma_distribution random number distribution
- * @p __x into the output stream @p __os.
- *
- * @param __os An output stream.
- * @param __x A %gamma_distribution random number distribution.
- *
- * @returns The output stream with the state of @p __x inserted or in
- * an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_ostream<_CharT, _Traits>&
- operator<<(std::basic_ostream<_CharT, _Traits>&,
- const std::gamma_distribution<_RealType>&);
-
- /**
- * @brief Extracts a %gamma_distribution random number distribution
- * @p __x from the input stream @p __is.
- *
- * @param __is An input stream.
- * @param __x A %gamma_distribution random number generator engine.
- *
- * @returns The input stream with @p __x extracted or in an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>&,
- std::gamma_distribution<_RealType>&);
-
/**
* @brief A chi_squared_distribution random number distribution.
@@ -2332,42 +2332,42 @@ namespace std
return 2 * _M_gd(__urng, param_type(__p.n() / 2));
}
+ /**
+ * @brief Inserts a %chi_squared_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %chi_squared_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&,
+ const std::chi_squared_distribution<_RealType1>&);
+
+ /**
+ * @brief Extracts a %chi_squared_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %chi_squared_distribution random number
+ * generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&,
+ std::chi_squared_distribution<_RealType1>&);
+
private:
param_type _M_param;
std::gamma_distribution<result_type> _M_gd;
};
- /**
- * @brief Inserts a %chi_squared_distribution random number distribution
- * @p __x into the output stream @p __os.
- *
- * @param __os An output stream.
- * @param __x A %chi_squared_distribution random number distribution.
- *
- * @returns The output stream with the state of @p __x inserted or in
- * an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_ostream<_CharT, _Traits>&
- operator<<(std::basic_ostream<_CharT, _Traits>&,
- const std::chi_squared_distribution<_RealType>&);
-
- /**
- * @brief Extracts a %chi_squared_distribution random number distribution
- * @p __x from the input stream @p __is.
- *
- * @param __is An input stream.
- * @param __x A %chi_squared_distribution random number
- * generator engine.
- *
- * @returns The input stream with @p __x extracted or in an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>&,
- std::chi_squared_distribution<_RealType>&);
-
/**
* @brief A cauchy_distribution random number distribution.
@@ -2623,42 +2623,42 @@ namespace std
/ (_M_gd_y(__urng, param_type(__p.n() / 2)) * m()));
}
+ /**
+ * @brief Inserts a %fisher_f_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %fisher_f_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&,
+ const std::fisher_f_distribution<_RealType1>&);
+
+ /**
+ * @brief Extracts a %fisher_f_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %fisher_f_distribution random number
+ * generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&,
+ std::fisher_f_distribution<_RealType1>&);
+
private:
param_type _M_param;
std::gamma_distribution<result_type> _M_gd_x, _M_gd_y;
};
- /**
- * @brief Inserts a %fisher_f_distribution random number distribution
- * @p __x into the output stream @p __os.
- *
- * @param __os An output stream.
- * @param __x A %fisher_f_distribution random number distribution.
- *
- * @returns The output stream with the state of @p __x inserted or in
- * an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_ostream<_CharT, _Traits>&
- operator<<(std::basic_ostream<_CharT, _Traits>&,
- const std::fisher_f_distribution<_RealType>&);
-
- /**
- * @brief Extracts a %fisher_f_distribution random number distribution
- * @p __x from the input stream @p __is.
- *
- * @param __is An input stream.
- * @param __x A %fisher_f_distribution random number
- * generator engine.
- *
- * @returns The input stream with @p __x extracted or in an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>&,
- std::fisher_f_distribution<_RealType>&);
-
/**
* @brief A student_t_distribution random number distribution.
@@ -2764,6 +2764,36 @@ namespace std
return _M_nd(__urng) * std::sqrt(__p.n() / __g);
}
+ /**
+ * @brief Inserts a %student_t_distribution random number distribution
+ * @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %student_t_distribution random number distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&,
+ const std::student_t_distribution<_RealType1>&);
+
+ /**
+ * @brief Extracts a %student_t_distribution random number distribution
+ * @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %student_t_distribution random number
+ * generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _RealType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&,
+ std::student_t_distribution<_RealType1>&);
+
private:
param_type _M_param;
@@ -2771,36 +2801,6 @@ namespace std
std::gamma_distribution<result_type> _M_gd;
};
- /**
- * @brief Inserts a %student_t_distribution random number distribution
- * @p __x into the output stream @p __os.
- *
- * @param __os An output stream.
- * @param __x A %student_t_distribution random number distribution.
- *
- * @returns The output stream with the state of @p __x inserted or in
- * an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_ostream<_CharT, _Traits>&
- operator<<(std::basic_ostream<_CharT, _Traits>&,
- const std::student_t_distribution<_RealType>&);
-
- /**
- * @brief Extracts a %student_t_distribution random number distribution
- * @p __x from the input stream @p __is.
- *
- * @param __is An input stream.
- * @param __x A %student_t_distribution random number
- * generator engine.
- *
- * @returns The input stream with @p __x extracted or in an error state.
- */
- template<typename _RealType, typename _CharT, typename _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>&,
- std::student_t_distribution<_RealType>&);
-
/* @} */ // group std_random_distributions_normal
/**
@@ -3384,43 +3384,43 @@ namespace std
operator()(_UniformRandomNumberGenerator& __urng,
const param_type& __p);
+ /**
+ * @brief Inserts a %negative_binomial_distribution random
+ * number distribution @p __x into the output stream @p __os.
+ *
+ * @param __os An output stream.
+ * @param __x A %negative_binomial_distribution random number
+ * distribution.
+ *
+ * @returns The output stream with the state of @p __x inserted or in
+ * an error state.
+ */
+ template<typename _IntType1, typename _CharT, typename _Traits>
+ friend std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>&,
+ const std::negative_binomial_distribution<_IntType1>&);
+
+ /**
+ * @brief Extracts a %negative_binomial_distribution random number
+ * distribution @p __x from the input stream @p __is.
+ *
+ * @param __is An input stream.
+ * @param __x A %negative_binomial_distribution random number
+ * generator engine.
+ *
+ * @returns The input stream with @p __x extracted or in an error state.
+ */
+ template<typename _IntType1, typename _CharT, typename _Traits>
+ friend std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>&,
+ std::negative_binomial_distribution<_IntType1>&);
+
private:
param_type _M_param;
std::gamma_distribution<double> _M_gd;
};
- /**
- * @brief Inserts a %negative_binomial_distribution random
- * number distribution @p __x into the output stream @p __os.
- *
- * @param __os An output stream.
- * @param __x A %negative_binomial_distribution random number
- * distribution.
- *
- * @returns The output stream with the state of @p __x inserted or in
- * an error state.
- */
- template<typename _IntType, typename _CharT, typename _Traits>
- std::basic_ostream<_CharT, _Traits>&
- operator<<(std::basic_ostream<_CharT, _Traits>&,
- const std::negative_binomial_distribution<_IntType>&);
-
- /**
- * @brief Extracts a %negative_binomial_distribution random number
- * distribution @p __x from the input stream @p __is.
- *
- * @param __is An input stream.
- * @param __x A %negative_binomial_distribution random number
- * generator engine.
- *
- * @returns The input stream with @p __x extracted or in an error state.
- */
- template<typename _IntType, typename _CharT, typename _Traits>
- std::basic_istream<_CharT, _Traits>&
- operator>>(std::basic_istream<_CharT, _Traits>&,
- std::negative_binomial_distribution<_IntType>&);
-
/* @} */ // group std_random_distributions_bernoulli
/**
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 129552f3705..eb7290053ed 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -913,7 +913,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
reference
operator*() const
- { return *_M_current; }
+ { return std::move(*_M_current); }
pointer
operator->() const
@@ -973,7 +973,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
reference
operator[](difference_type __n) const
- { return _M_current[__n]; }
+ { return std::move(_M_current[__n]); }
};
template<typename _IteratorL, typename _IteratorR>
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index f758baed5c9..2a6e58f798f 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -1027,7 +1027,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
insert(iterator __position, size_type __n, const value_type& __x)
{
list __tmp(__n, __x, _M_get_Node_allocator());
- splice(__position, __tmp);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(__position, std::move(__tmp));
+#else
+ splice(__position, __tmp);
+#endif
}
/**
@@ -1049,7 +1053,11 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
_InputIterator __last)
{
list __tmp(__first, __last, _M_get_Node_allocator());
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ splice(__position, std::move(__tmp));
+#else
splice(__position, __tmp);
+#endif
}
/**
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 5416d827567..a26e68a01c0 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -552,6 +552,26 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
insert(_InputIterator __first, _InputIterator __last)
{ _M_t._M_insert_unique(__first, __last); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases an element from a %map.
+ * @param position An iterator pointing to the element to be erased.
+ * @return An iterator pointing to the element immediately following
+ * @a position prior to the element being erased. If no such
+ * element exists, end() is returned.
+ *
+ * This function erases an element, pointed to by the given
+ * iterator, from a %map. Note that this function only erases
+ * the element, and that if the element is itself a pointer,
+ * the pointed-to memory is not touched in any way. Managing
+ * the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __position)
+ { return _M_t.erase(__position); }
+#else
/**
* @brief Erases an element from a %map.
* @param position An iterator pointing to the element to be erased.
@@ -565,6 +585,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __position)
{ _M_t.erase(__position); }
+#endif
/**
* @brief Erases elements according to the provided key.
@@ -581,6 +602,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
erase(const key_type& __x)
{ return _M_t.erase(__x); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases a [first,last) range of elements from a %map.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ * @return The iterator @a last.
+ *
+ * This function erases a sequence of elements from a %map.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ { return _M_t.erase(__first, __last); }
+#else
/**
* @brief Erases a [first,last) range of elements from a %map.
* @param first Iterator pointing to the start of the range to be
@@ -595,6 +635,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __first, iterator __last)
{ _M_t.erase(__first, __last); }
+#endif
/**
* @brief Swaps data with another %map.
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 91dcfa675f4..fa3f2539018 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -488,6 +488,26 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ this->insert(__l.begin(), __l.end()); }
#endif
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases an element from a %multimap.
+ * @param position An iterator pointing to the element to be erased.
+ * @return An iterator pointing to the element immediately following
+ * @a position prior to the element being erased. If no such
+ * element exists, end() is returned.
+ *
+ * This function erases an element, pointed to by the given iterator,
+ * from a %multimap. Note that this function only erases the element,
+ * and that if the element is itself a pointer, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ iterator
+ erase(iterator __position)
+ { return _M_t.erase(__position); }
+#else
/**
* @brief Erases an element from a %multimap.
* @param position An iterator pointing to the element to be erased.
@@ -501,6 +521,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __position)
{ _M_t.erase(__position); }
+#endif
/**
* @brief Erases elements according to the provided key.
@@ -517,6 +538,27 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
erase(const key_type& __x)
{ return _M_t.erase(__x); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases a [first,last) range of elements from a %multimap.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ * @return The iterator @a last.
+ *
+ * This function erases a sequence of elements from a %multimap.
+ * Note that this function only erases the elements, and that if
+ * the elements themselves are pointers, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ { return _M_t.erase(__first, __last); }
+#else
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
/**
* @brief Erases a [first,last) range of elements from a %multimap.
* @param first Iterator pointing to the start of the range to be
@@ -531,6 +573,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __first, iterator __last)
{ _M_t.erase(__first, __last); }
+#endif
/**
* @brief Swaps data with another %multimap.
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index be9e2489ce9..431cbae4302 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -445,6 +445,26 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ this->insert(__l.begin(), __l.end()); }
#endif
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases an element from a %multiset.
+ * @param position An iterator pointing to the element to be erased.
+ * @return An iterator pointing to the element immediately following
+ * @a position prior to the element being erased. If no such
+ * element exists, end() is returned.
+ *
+ * This function erases an element, pointed to by the given iterator,
+ * from a %multiset. Note that this function only erases the element,
+ * and that if the element is itself a pointer, the pointed-to memory is
+ * not touched in any way. Managing the pointer is the user's
+ * responsibility.
+ */
+ iterator
+ erase(iterator __position)
+ { return _M_t.erase(__position); }
+#else
/**
* @brief Erases an element from a %multiset.
* @param position An iterator pointing to the element to be erased.
@@ -458,6 +478,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __position)
{ _M_t.erase(__position); }
+#endif
/**
* @brief Erases elements according to the provided key.
@@ -474,6 +495,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
erase(const key_type& __x)
{ return _M_t.erase(__x); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases a [first,last) range of elements from a %multiset.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ * @return The iterator @a last.
+ *
+ * This function erases a sequence of elements from a %multiset.
+ * Note that this function only erases the elements, and that if
+ * the elements themselves are pointers, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ { return _M_t.erase(__first, __last); }
+#else
/**
* @brief Erases a [first,last) range of elements from a %multiset.
* @param first Iterator pointing to the start of the range to be
@@ -488,6 +528,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __first, iterator __last)
{ _M_t.erase(__first, __last); }
+#endif
/**
* Erases all elements in a %multiset. Note that this function only
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index ccd0bc7b2ff..e87cccbab77 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -458,6 +458,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
{ this->insert(__l.begin(), __l.end()); }
#endif
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases an element from a %set.
+ * @param position An iterator pointing to the element to be erased.
+ * @return An iterator pointing to the element immediately following
+ * @a position prior to the element being erased. If no such
+ * element exists, end() is returned.
+ *
+ * This function erases an element, pointed to by the given iterator,
+ * from a %set. Note that this function only erases the element, and
+ * that if the element is itself a pointer, the pointed-to memory is not
+ * touched in any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __position)
+ { return _M_t.erase(__position); }
+#else
/**
* @brief Erases an element from a %set.
* @param position An iterator pointing to the element to be erased.
@@ -470,6 +489,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __position)
{ _M_t.erase(__position); }
+#endif
/**
* @brief Erases elements according to the provided key.
@@ -486,6 +506,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
erase(const key_type& __x)
{ return _M_t.erase(__x); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ /**
+ * @brief Erases a [first,last) range of elements from a %set.
+ * @param first Iterator pointing to the start of the range to be
+ * erased.
+ * @param last Iterator pointing to the end of the range to be erased.
+ * @return The iterator @a last.
+ *
+ * This function erases a sequence of elements from a %set.
+ * Note that this function only erases the element, and that if
+ * the element is itself a pointer, the pointed-to memory is not touched
+ * in any way. Managing the pointer is the user's responsibility.
+ */
+ iterator
+ erase(iterator __first, iterator __last)
+ { return _M_t.erase(__first, __last); }
+#else
/**
* @brief Erases a [first,last) range of elements from a %set.
* @param first Iterator pointing to the start of the range to be
@@ -500,6 +539,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
void
erase(iterator __first, iterator __last)
{ _M_t.erase(__first, __last); }
+#endif
/**
* Erases all elements in a %set. Note that this function only erases
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 1a67b563f62..d37dc57246e 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -698,21 +698,43 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
_M_insert_equal(_InputIterator __first, _InputIterator __last);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ iterator
+ erase(iterator __position);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ const_iterator
+ erase(const_iterator __position);
+#else
void
erase(iterator __position);
void
erase(const_iterator __position);
-
+#endif
size_type
erase(const key_type& __x);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ iterator
+ erase(iterator __first, iterator __last);
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ const_iterator
+ erase(const_iterator __first, const_iterator __last);
+#else
void
erase(iterator __first, iterator __last);
void
erase(const_iterator __first, const_iterator __last);
-
+#endif
void
erase(const key_type* __first, const key_type* __last);
@@ -1327,6 +1349,45 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_insert_equal_(end(), *__first);
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(iterator __position)
+ {
+ iterator __result = __position;
+ ++__result;
+ _Link_type __y =
+ static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
+ (__position._M_node,
+ this->_M_impl._M_header));
+ _M_destroy_node(__y);
+ --_M_impl._M_node_count;
+ return __result;
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ inline typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const_iterator __position)
+ {
+ const_iterator __result = __position;
+ ++__result;
+ _Link_type __y =
+ static_cast<_Link_type>(_Rb_tree_rebalance_for_erase
+ (const_cast<_Base_ptr>(__position._M_node),
+ this->_M_impl._M_header));
+ _M_destroy_node(__y);
+ --_M_impl._M_node_count;
+ return __result;
+ }
+#else
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
inline void
@@ -1354,6 +1415,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_destroy_node(__y);
--_M_impl._M_node_count;
}
+#endif
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
@@ -1367,6 +1429,49 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
return __old_size - size();
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(iterator __first, iterator __last)
+ {
+ if (__first == begin() && __last == end())
+ {
+ clear();
+ return end();
+ }
+ else
+ {
+ while (__first != __last)
+ erase(__first++);
+ return __last;
+ }
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 130. Associative erase should return an iterator.
+ template<typename _Key, typename _Val, typename _KeyOfValue,
+ typename _Compare, typename _Alloc>
+ typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator
+ _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::
+ erase(const_iterator __first, const_iterator __last)
+ {
+ if (__first == begin() && __last == end())
+ {
+ clear();
+ return end();
+ }
+ else
+ {
+ while (__first != __last)
+ erase(__first++);
+ return __last;
+ }
+ }
+#else
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
void
@@ -1392,6 +1497,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
while (__first != __last)
erase(__first++);
}
+#endif
template<typename _Key, typename _Val, typename _KeyOfValue,
typename _Compare, typename _Alloc>
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index dbdb32e2299..eb0a3e4ae15 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -115,12 +115,14 @@ namespace __gnu_debug
/**
* @brief Copy construction.
- * @pre @p x is not singular
*/
_Safe_iterator(const _Safe_iterator& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
{
- _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x._M_current == _Iterator(),
_M_message(__msg_init_copy_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
@@ -129,8 +131,6 @@ namespace __gnu_debug
/**
* @brief Converting constructor from a mutable iterator to a
* constant iterator.
- *
- * @pre @p x is not singular
*/
template<typename _MutableIterator>
_Safe_iterator(
@@ -140,7 +140,10 @@ namespace __gnu_debug
_Sequence>::__type>& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
{
- _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x.base() == _Iterator(),
_M_message(__msg_init_const_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
@@ -148,12 +151,14 @@ namespace __gnu_debug
/**
* @brief Copy assignment.
- * @pre @p x is not singular
*/
_Safe_iterator&
operator=(const _Safe_iterator& __x)
{
- _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 408. Is vector<reverse_iterator<char*> > forbidden?
+ _GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
+ || __x._M_current == _Iterator(),
_M_message(__msg_copy_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
@@ -169,7 +174,6 @@ namespace __gnu_debug
reference
operator*() const
{
-
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
_M_message(__msg_bad_deref)
._M_iterator(*this, "this"));
diff --git a/libstdc++-v3/include/ext/cast.h b/libstdc++-v3/include/ext/cast.h
index 3ffad7c2775..8fd8cc9c47e 100644
--- a/libstdc++-v3/include/ext/cast.h
+++ b/libstdc++-v3/include/ext/cast.h
@@ -25,7 +25,7 @@
#ifndef _CAST_H
#define _CAST_H 1
-_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx);
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
/**
* These functions are here to allow containers to support non standard
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index 5aac7f178fa..ddb5f3c84a8 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -34,6 +34,8 @@
#ifndef _POINTER_H
#define _POINTER_H 1
+#pragma GCC system_header
+
#include <iosfwd>
#include <bits/stl_iterator_base_types.h>
#include <ext/cast.h>
@@ -87,12 +89,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
* the pointer's address as an offset value which is relative to
* its own address.
*
- * This is intended for pointers
- * within shared memory regions which might be mapped at different
- * addresses by different processes. For null pointers, a value of 1 is
- * used. (0 is legitimate sometimes for nodes in circularly linked lists)
- * This value was chosen as the least likely to generate an incorrect null,
- * As there is no reason why any normal pointer would point 1 byte into
+ * This is intended for pointers within shared memory regions which
+ * might be mapped at different addresses by different processes.
+ * For null pointers, a value of 1 is used. (0 is legitimate
+ * sometimes for nodes in circularly linked lists) This value was
+ * chosen as the least likely to generate an incorrect null, As
+ * there is no reason why any normal pointer would point 1 byte into
* its own pointer address.
*/
template<typename _Tp>
@@ -133,9 +135,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
== reinterpret_cast<_UIntPtrType>(__rarg.get())); }
private:
+#ifdef _GLIBCXX_USE_LONG_LONG
typedef __gnu_cxx::__conditional_type<
(sizeof(unsigned long) >= sizeof(void*)),
unsigned long, unsigned long long>::__type _UIntPtrType;
+#else
+ typedef unsigned long _UIntPtrType;
+#endif
_UIntPtrType _M_diff;
};
@@ -181,16 +187,20 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
== reinterpret_cast<_UIntPtrType>(__rarg.get())); }
private:
- typedef __gnu_cxx::__conditional_type
- <(sizeof(unsigned long) >= sizeof(void*)),
+#ifdef _GLIBCXX_USE_LONG_LONG
+ typedef __gnu_cxx::__conditional_type<
+ (sizeof(unsigned long) >= sizeof(void*)),
unsigned long, unsigned long long>::__type _UIntPtrType;
- _UIntPtrType _M_diff;
+#else
+ typedef unsigned long _UIntPtrType;
+#endif
+ _UIntPtrType _M_diff;
};
/**
* The specialization on this type helps resolve the problem of
- * reference to void, and eliminates the need to specialize _Pointer_adapter
- * for cases of void*, const void*, and so on.
+ * reference to void, and eliminates the need to specialize
+ * _Pointer_adapter for cases of void*, const void*, and so on.
*/
struct _Invalid_type { };
@@ -215,8 +225,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ typedef const volatile _Invalid_type& reference; };
/**
- * This structure accomodates the way in which std::iterator_traits<>
- * is normally specialized for const T*, so that value_type is still T.
+ * This structure accomodates the way in which
+ * std::iterator_traits<> is normally specialized for const T*, so
+ * that value_type is still T.
*/
template<typename _Tp>
struct _Unqualified_type
@@ -235,28 +246,31 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{ typedef volatile _Tp type; };
/**
- * The following provides an 'alternative pointer' that works with the
- * containers when specified as the pointer typedef of the allocator.
+ * The following provides an 'alternative pointer' that works with
+ * the containers when specified as the pointer typedef of the
+ * allocator.
*
- * The pointer type used with the containers doesn't have to be this class,
- * but it must support the implicit conversions, pointer arithmetic,
- * comparison operators, etc. that are supported by this class, and avoid
- * raising compile-time ambiguities. Because creating a working pointer can
- * be challenging, this pointer template was designed to wrapper an
- * easier storage policy type, so that it becomes reusable for creating
- * other pointer types.
+ * The pointer type used with the containers doesn't have to be this
+ * class, but it must support the implicit conversions, pointer
+ * arithmetic, comparison operators, etc. that are supported by this
+ * class, and avoid raising compile-time ambiguities. Because
+ * creating a working pointer can be challenging, this pointer
+ * template was designed to wrapper an easier storage policy type,
+ * so that it becomes reusable for creating other pointer types.
*
- * A key point of this class is also that it allows container writers to
- * 'assume' Alocator::pointer is a typedef for a normal pointer. This class
- * supports most of the conventions of a true pointer, and can, for instance
- * handle implicit conversion to const and base class pointer types. The
- * only impositions on container writers to support extended pointers are:
- * 1) use the Allocator::pointer typedef appropriately for pointer types.
- * 2) if you need pointer casting, use the __pointer_cast<> functions
- * from ext/cast.h. This allows pointer cast operations to be overloaded
- * is necessary by custom pointers.
+ * A key point of this class is also that it allows container
+ * writers to 'assume' Alocator::pointer is a typedef for a normal
+ * pointer. This class supports most of the conventions of a true
+ * pointer, and can, for instance handle implicit conversion to
+ * const and base class pointer types. The only impositions on
+ * container writers to support extended pointers are: 1) use the
+ * Allocator::pointer typedef appropriately for pointer types. 2)
+ * if you need pointer casting, use the __pointer_cast<> functions
+ * from ext/cast.h. This allows pointer cast operations to be
+ * overloaded is necessary by custom pointers.
*
- * Note: The const qualifier works with this pointer adapter as follows:
+ * Note: The const qualifier works with this pointer adapter as
+ * follows:
*
* _Tp* == _Pointer_adapter<_Std_pointer_impl<_Tp> >;
* const _Tp* == _Pointer_adapter<_Std_pointer_impl<const _Tp> >;
@@ -458,32 +472,32 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}; // class _Pointer_adapter
-#define _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(OPERATOR,BLANK) \
+#define _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(OPERATOR) \
template<typename _Tp1, typename _Tp2> \
inline bool \
- operator OPERATOR##BLANK (const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \
- { return __lhs.get() OPERATOR##BLANK __rhs; } \
+ operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, _Tp2 __rhs) \
+ { return __lhs.get() OPERATOR __rhs; } \
\
template<typename _Tp1, typename _Tp2> \
inline bool \
- operator OPERATOR##BLANK (_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \
- { return __lhs OPERATOR##BLANK __rhs.get(); } \
+ operator OPERATOR(_Tp1 __lhs, const _Pointer_adapter<_Tp2>& __rhs) \
+ { return __lhs OPERATOR __rhs.get(); } \
\
template<typename _Tp1, typename _Tp2> \
inline bool \
- operator OPERATOR##BLANK (const _Pointer_adapter<_Tp1>& __lhs, \
+ operator OPERATOR(const _Pointer_adapter<_Tp1>& __lhs, \
const _Pointer_adapter<_Tp2>& __rhs) \
- { return __lhs.get() OPERATOR##BLANK __rhs.get(); } \
+ { return __lhs.get() OPERATOR __rhs.get(); } \
\
// End GCC_CXX_POINTER_COMPARISON_OPERATION_SET Macro
// Expand into the various comparison operators needed.
- _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(==,);
- _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(!=,);
- _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<,);
- _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<=,);
- _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>,);
- _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>=,);
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(==)
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(!=)
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<)
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(<=)
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>)
+ _GCC_CXX_POINTER_COMPARISON_OPERATION_SET(>=)
// These are here for expressions like "ptr == 0", "ptr != 0"
template<typename _Tp>
diff --git a/libstdc++-v3/include/precompiled/extc++.h b/libstdc++-v3/include/precompiled/extc++.h
index f0ccc42f0ca..03e53390cd1 100644
--- a/libstdc++-v3/include/precompiled/extc++.h
+++ b/libstdc++-v3/include/precompiled/extc++.h
@@ -26,7 +26,9 @@
* This is an implementation file for a precompiled header.
*/
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
#include <bits/stdtr1c++.h>
+#endif
#include <ext/algorithm>
#include <ext/array_allocator.h>
diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
index 5782fa3b89a..1c615091bdc 100644
--- a/libstdc++-v3/include/precompiled/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
@@ -30,7 +30,9 @@
// 17.4.1.2 Headers
// C
+#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
+#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
@@ -98,6 +100,7 @@
#include <chrono>
#include <condition_variable>
#include <forward_list>
+#include <future>
#include <mutex>
#include <random>
#include <ratio>
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index c5ece926463..badb6e07e5a 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -43,9 +43,6 @@
#include <exception>
#include <cstdatomic>
-#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
- && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
-
namespace std
{
/**
@@ -76,20 +73,26 @@ namespace std
inline error_condition make_error_condition(future_errc __errc)
{ return error_condition(static_cast<int>(__errc), *future_category); }
- /// Exception type thrown by futures.
+ /**
+ * @brief Exception type thrown by futures.
+ * @ingroup exceptions
+ */
class future_error : public logic_error
{
+ error_code _M_code;
+
public:
explicit future_error(future_errc __ec)
: logic_error("std::future_error"), _M_code(make_error_code(__ec))
{ }
- const error_code& code() const throw() { return _M_code; }
+ virtual ~future_error() throw();
- const char* what() const throw() { return _M_code.message().c_str(); }
+ virtual const char*
+ what() const throw();
- private:
- error_code _M_code;
+ const error_code&
+ code() const throw() { return _M_code; }
};
// Forward declarations.
@@ -105,6 +108,9 @@ namespace std
template<typename _Result>
class promise;
+#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
+ && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
+
// Holds the result of a future
struct _Future_result_base
{
@@ -200,7 +206,7 @@ namespace std
{
lock_guard<mutex> __lock(_M_mutex);
if (_M_ready())
- throw future_error(future_errc::promise_already_satisfied);
+ __throw_future_error(int(future_errc::promise_already_satisfied));
_M_result.swap(__res);
}
_M_cond.notify_all();
@@ -226,7 +232,7 @@ namespace std
_M_set_retrieved_flag()
{
if (_M_retrieved.test_and_set())
- throw future_error(future_errc::future_already_retrieved);
+ __throw_future_error(int(future_errc::future_already_retrieved));
}
private:
@@ -366,7 +372,7 @@ namespace std
if (static_cast<bool>(this->_M_state))
this->_M_state->_M_set_retrieved_flag();
else
- throw future_error(future_errc::future_already_retrieved);
+ __throw_future_error(int(future_errc::future_already_retrieved));
}
// copy construction from a shared_future
@@ -878,15 +884,17 @@ namespace std
unique_future<_Result>
get_future()
{
- try
+ __try
{
return _M_promise.get_future();
}
- catch (const future_error& __e)
+ __catch (const future_error& __e)
{
+#ifdef __EXCEPTIONS
if (__e.code() == future_errc::future_already_retrieved)
- throw std::bad_function_call();
- throw;
+ throw std::bad_function_call();
+ throw;
+#endif
}
}
@@ -895,13 +903,20 @@ namespace std
operator()(_ArgTypes... __args)
{
if (!static_cast<bool>(_M_task) || _M_promise._M_satisfied())
- throw std::bad_function_call();
- try
+ {
+#ifdef __EXCEPTIONS
+ throw std::bad_function_call();
+#else
+ __builtin_abort();
+#endif
+ }
+
+ __try
{
_Run_task<_Result, _ArgTypes...>::_S_run(_M_promise, _M_task,
std::forward<_ArgTypes>(__args)...);
}
- catch (...)
+ __catch (...)
{
_M_promise.set_exception(current_exception());
}
@@ -914,12 +929,12 @@ namespace std
promise<_Result> _M_promise;
};
- // @} group futures
-}
-
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
// && _GLIBCXX_ATOMIC_BUILTINS_4
+ // @} group futures
+}
+
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_FUTURE
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index 1979a51327f..2d47b0fd842 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -827,6 +827,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
basic_istream<_CharT, _Traits>&
ws(basic_istream<_CharT, _Traits>& __is);
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // [27.7.1.6] Rvalue stream extraction
+ /**
+ * @brief Generic extractor for rvalue stream
+ * @param is An input stream.
+ * @param x A reference to the extraction target.
+ * @return is
+ *
+ * This is just a forwarding function to allow extraction from
+ * rvalue streams since they won't bind to the extractor functions
+ * that take an lvalue reference.
+ */
+ template<typename _CharT, typename _Traits, typename _Tp>
+ inline basic_istream<_CharT, _Traits>&
+ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
+ { return (__is >> __x); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
_GLIBCXX_END_NAMESPACE
#ifndef _GLIBCXX_EXPORT_TEMPLATE
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index b9ea4a8ce19..9fc693cb3c3 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -562,6 +562,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
flush(basic_ostream<_CharT, _Traits>& __os)
{ return __os.flush(); }
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ // [27.7.2.9] Rvalue stream insertion
+ /**
+ * @brief Generic inserter for rvalue stream
+ * @param os An input stream.
+ * @param x A reference to the object being inserted.
+ * @return os
+ *
+ * This is just a forwarding function to allow insertion to
+ * rvalue streams since they won't bind to the inserter functions
+ * that take an lvalue reference.
+ */
+ template<typename _CharT, typename _Traits, typename _Tp>
+ inline basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
+ { return (__os << __x); }
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
_GLIBCXX_END_NAMESPACE
#ifndef _GLIBCXX_EXPORT_TEMPLATE
diff --git a/libstdc++-v3/include/std/random b/libstdc++-v3/include/std/random
index 12668583498..b57ef4925d6 100644
--- a/libstdc++-v3/include/std/random
+++ b/libstdc++-v3/include/std/random
@@ -47,12 +47,18 @@
#include <debug/debug.h>
#include <type_traits>
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
+#include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t
+
#include <bits/random.h>
#ifndef _GLIBCXX_EXPORT_TEMPLATE
# include <bits/random.tcc>
#endif
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
+
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_RANDOM
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index bf282cc0365..83b259d7949 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -126,7 +126,10 @@ namespace std
template<typename _Callable>
explicit thread(_Callable __f)
- { _M_start_thread(_M_make_routine<_Callable>(__f)); }
+ {
+ _M_start_thread(_M_make_routine<_Callable>
+ (std::forward<_Callable>(__f)));
+ }
template<typename _Callable, typename... _Args>
thread(_Callable&& __f, _Args&&... __args)
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 8dc8dcfc064..18cd89bca3b 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -164,7 +164,7 @@ namespace std
: _Inherited(__in._M_tail()), _Base(__in._M_head()) { }
_Tuple_impl(_Tuple_impl&& __in)
- : _Inherited(std::move<_Inherited&&>(__in._M_tail())),
+ : _Inherited(std::move(__in._M_tail())),
_Base(std::forward<_Head>(__in._M_head())) { }
template<typename... _UElements>
@@ -173,8 +173,7 @@ namespace std
template<typename... _UElements>
_Tuple_impl(_Tuple_impl<_Idx, _UElements...>&& __in)
- : _Inherited(std::move<typename _Tuple_impl<_Idx, _UElements...>::
- _Inherited&&>(__in._M_tail())),
+ : _Inherited(std::move(__in._M_tail())),
_Base(std::forward<typename _Tuple_impl<_Idx, _UElements...>::
_Base>(__in._M_head())) { }
@@ -244,7 +243,7 @@ namespace std
: _Inherited(static_cast<const _Inherited&>(__in)) { }
tuple(tuple&& __in)
- : _Inherited(std::move<_Inherited>(__in)) { }
+ : _Inherited(static_cast<_Inherited&&>(__in)) { }
template<typename... _UElements>
tuple(const tuple<_UElements...>& __in)
@@ -253,7 +252,7 @@ namespace std
template<typename... _UElements>
tuple(tuple<_UElements...>&& __in)
- : _Inherited(std::move<_Tuple_impl<0, _UElements...> >(__in)) { }
+ : _Inherited(static_cast<_Tuple_impl<0, _UElements...>&&>(__in)) { }
// XXX http://gcc.gnu.org/ml/libstdc++/2008-02/msg00047.html
template<typename... _UElements>
@@ -327,7 +326,7 @@ namespace std
: _Inherited(static_cast<const _Inherited&>(__in)) { }
tuple(tuple&& __in)
- : _Inherited(std::move<_Inherited>(__in)) { }
+ : _Inherited(static_cast<_Inherited&&>(__in)) { }
template<typename _U1, typename _U2>
tuple(const tuple<_U1, _U2>& __in)
@@ -335,7 +334,7 @@ namespace std
template<typename _U1, typename _U2>
tuple(tuple<_U1, _U2>&& __in)
- : _Inherited(std::move<_Tuple_impl<0, _U1, _U2> >(__in)) { }
+ : _Inherited(static_cast<_Tuple_impl<0, _U1, _U2>&&>(__in)) { }
template<typename _U1, typename _U2>
tuple(const pair<_U1, _U2>& __in)
diff --git a/libstdc++-v3/include/tr1_impl/functional b/libstdc++-v3/include/tr1_impl/functional
index 584a403de48..9911d46d678 100644
--- a/libstdc++-v3/include/tr1_impl/functional
+++ b/libstdc++-v3/include/tr1_impl/functional
@@ -1365,7 +1365,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
/**
* @brief Exception class thrown when class template function's
* operator() is called with an empty target.
- *
+ * @ingroup exceptions
*/
class bad_function_call : public std::exception { };
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 23477c9c3a6..9192a2244e7 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -156,11 +156,13 @@ namespace std
{
__try
{
+#ifdef __EXCEPTIONS
throw __ex;
+#endif
}
__catch(...)
{
- return current_exception ();
+ return current_exception();
}
}
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 4295d4dda66..608ef93d280 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -144,10 +144,10 @@ sources = \
ctype.cc \
debug.cc \
functexcept.cc \
- hash.cc \
+ hash_tr1.cc \
hash_c++0x.cc \
globals_io.cc \
- hashtable.cc \
+ hashtable_tr1.cc \
hashtable_c++0x.cc \
ios.cc \
ios_failure.cc \
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index 9134f0472d2..eb436c86075 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -75,17 +75,17 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
am__DEPENDENCIES_1 =
am__libstdc___la_SOURCES_DIST = atomic.cc bitmap_allocator.cc \
pool_allocator.cc mt_allocator.cc codecvt.cc compatibility.cc \
- complex_io.cc ctype.cc debug.cc functexcept.cc hash.cc \
- hash_c++0x.cc globals_io.cc hashtable.cc hashtable_c++0x.cc \
- ios.cc ios_failure.cc ios_init.cc ios_locale.cc limits.cc \
- limits_c++0x.cc list.cc debug_list.cc locale.cc locale_init.cc \
- locale_facets.cc localename.cc math_stubs_float.cc \
- math_stubs_long_double.cc stdexcept.cc strstream.cc \
- system_error.cc tree.cc allocator-inst.cc concept-inst.cc \
- fstream-inst.cc ext-inst.cc ios-inst.cc iostream-inst.cc \
- istream-inst.cc istream.cc locale-inst.cc misc-inst.cc \
- ostream-inst.cc sstream-inst.cc streambuf-inst.cc streambuf.cc \
- string-inst.cc valarray-inst.cc wlocale-inst.cc \
+ complex_io.cc ctype.cc debug.cc functexcept.cc hash_tr1.cc \
+ hash_c++0x.cc globals_io.cc hashtable_tr1.cc \
+ hashtable_c++0x.cc ios.cc ios_failure.cc ios_init.cc \
+ ios_locale.cc limits.cc limits_c++0x.cc list.cc debug_list.cc \
+ locale.cc locale_init.cc locale_facets.cc localename.cc \
+ math_stubs_float.cc math_stubs_long_double.cc stdexcept.cc \
+ strstream.cc system_error.cc tree.cc allocator-inst.cc \
+ concept-inst.cc fstream-inst.cc ext-inst.cc ios-inst.cc \
+ iostream-inst.cc istream-inst.cc istream.cc locale-inst.cc \
+ misc-inst.cc ostream-inst.cc sstream-inst.cc streambuf-inst.cc \
+ streambuf.cc string-inst.cc valarray-inst.cc wlocale-inst.cc \
wstring-inst.cc mutex.cc condition_variable.cc chrono.cc \
thread.cc future.cc atomicity.cc codecvt_members.cc \
collate_members.cc ctype_members.cc messages_members.cc \
@@ -102,8 +102,8 @@ am__objects_4 = basic_file.lo c++locale.lo $(am__objects_2) \
$(am__objects_3)
am__objects_5 = atomic.lo bitmap_allocator.lo pool_allocator.lo \
mt_allocator.lo codecvt.lo compatibility.lo complex_io.lo \
- ctype.lo debug.lo functexcept.lo hash.lo hash_c++0x.lo \
- globals_io.lo hashtable.lo hashtable_c++0x.lo ios.lo \
+ ctype.lo debug.lo functexcept.lo hash_tr1.lo hash_c++0x.lo \
+ globals_io.lo hashtable_tr1.lo hashtable_c++0x.lo ios.lo \
ios_failure.lo ios_init.lo ios_locale.lo limits.lo \
limits_c++0x.lo list.lo debug_list.lo locale.lo locale_init.lo \
locale_facets.lo localename.lo math_stubs_float.lo \
@@ -397,10 +397,10 @@ sources = \
ctype.cc \
debug.cc \
functexcept.cc \
- hash.cc \
+ hash_tr1.cc \
hash_c++0x.cc \
globals_io.cc \
- hashtable.cc \
+ hashtable_tr1.cc \
hashtable_c++0x.cc \
ios.cc \
ios_failure.cc \
diff --git a/libstdc++-v3/src/compatibility-ldbl.cc b/libstdc++-v3/src/compatibility-ldbl.cc
index dd9afe0fa0d..9658751bcbc 100644
--- a/libstdc++-v3/src/compatibility-ldbl.cc
+++ b/libstdc++-v3/src/compatibility-ldbl.cc
@@ -24,6 +24,8 @@
// <http://www.gnu.org/licenses/>.
#include <locale>
+#include <cmath>
+#include <tr1/functional>
#ifdef _GLIBCXX_LONG_DOUBLE_COMPAT
@@ -31,8 +33,6 @@
#error "compatibility-ldbl.cc must be compiled with -mlong-double-64"
#endif
-#define _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
-
namespace std
{
#define C char
@@ -67,11 +67,19 @@ namespace std
#endif
}
-// For std::tr1::hash<long double>::operator ()
+// For std::tr1::hash<long double>::operator()
+#define _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
+
+namespace std
+{
+ namespace tr1
+ {
#include "hash.cc"
+ }
+}
-// std::tr1::hash<long double>::operator ()
-// and std::hash<long double>::operator ()
+// std::tr1::hash<long double>::operator()
+// and std::hash<long double>::operator()
// are the same, no need to duplicate them.
extern "C" void _ZNKSt4hashIeEclEe (void)
__attribute__((alias ("_ZNKSt3tr14hashIeEclEe")));
diff --git a/libstdc++-v3/src/compatibility.cc b/libstdc++-v3/src/compatibility.cc
index 73432681ecf..53d8e84e4f2 100644
--- a/libstdc++-v3/src/compatibility.cc
+++ b/libstdc++-v3/src/compatibility.cc
@@ -62,7 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb && __n > 0)
+ if (__n > 0 && static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -134,7 +134,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb && __n > 0)
+ if (__n > 0 && static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
diff --git a/libstdc++-v3/src/functexcept.cc b/libstdc++-v3/src/functexcept.cc
index 057c037e953..352a6b70aef 100644
--- a/libstdc++-v3/src/functexcept.cc
+++ b/libstdc++-v3/src/functexcept.cc
@@ -24,10 +24,11 @@
#include <cstdlib>
#include <exception>
#include <stdexcept>
-#include <system_error>
#include <new>
#include <typeinfo>
#include <ios>
+#include <system_error>
+#include <future>
#ifdef _GLIBCXX_USE_NLS
# include <libintl.h>
@@ -98,6 +99,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
void
__throw_system_error(int __i)
{ throw system_error(error_code(__i, generic_category())); }
+
+ void
+ __throw_future_error(int __i)
+ { throw future_error(future_errc(__i)); }
+
#else
void
__throw_bad_exception(void)
@@ -156,8 +162,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ std::abort(); }
void
- __throw_system_error(int __i)
+ __throw_system_error(int)
{ std::abort(); }
+
+ void
+ __throw_future_error(int)
+ { std::abort(); }
+
#endif //__EXCEPTIONS
_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++-v3/src/future.cc b/libstdc++-v3/src/future.cc
index ab9d5dbcc69..967012a8ca6 100644
--- a/libstdc++-v3/src/future.cc
+++ b/libstdc++-v3/src/future.cc
@@ -24,8 +24,6 @@
#include <future>
-#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
- && defined(_GLIBCXX_ATOMIC_BUILTINS_4)
namespace
{
struct future_error_category : public std::error_category
@@ -67,7 +65,9 @@ namespace
namespace std
{
const error_category* const future_category = &__future_category_instance();
-}
-#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
- // && _GLIBCXX_ATOMIC_BUILTINS_4
+ future_error::~future_error() throw() { }
+
+ const char*
+ future_error::what() const throw() { return _M_code.message().c_str(); }
+}
diff --git a/libstdc++-v3/src/hash.cc b/libstdc++-v3/src/hash.cc
index 790cfee3e22..c776ed57e1e 100644
--- a/libstdc++-v3/src/hash.cc
+++ b/libstdc++-v3/src/hash.cc
@@ -22,24 +22,6 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-#include <cstddef>
-#include <string>
-#include <cmath>
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-#include <functional>
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-#else
-#include <tr1/functional>
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-#endif
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
// For long double, careful with random padding bits (e.g., on x86,
// 10 bytes -> 12 bytes) and resort to frexp.
template<>
@@ -72,7 +54,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#ifndef _GLIBCXX_LONG_DOUBLE_COMPAT_IMPL
template<>
size_t
- hash<string>::operator()(string __s) const throw ()
+ hash<string>::operator()(string __s) const
{ return _Fnv_hash<>::hash(__s.data(), __s.length()); }
template<>
@@ -83,7 +65,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
size_t
- hash<wstring>::operator()(wstring __s) const throw ()
+ hash<wstring>::operator()(wstring __s) const
{
const char* __p = reinterpret_cast<const char*>(__s.data());
return _Fnv_hash<>::hash(__p, __s.length() * sizeof(wchar_t));
@@ -98,6 +80,3 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
}
#endif
#endif
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/src/hash_c++0x.cc b/libstdc++-v3/src/hash_c++0x.cc
index 27a5765c67b..5bdbf0c31ee 100644
--- a/libstdc++-v3/src/hash_c++0x.cc
+++ b/libstdc++-v3/src/hash_c++0x.cc
@@ -22,11 +22,20 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-#include "hash.cc"
+#include <cstddef>
+#include <string>
+#include <cmath>
+#include <functional>
#include <system_error>
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# error "hash_c++0x.cc must be compiled with -std=gnu++0x"
+#endif
+
namespace std
{
+#include "hash.cc"
+
template<>
size_t
hash<error_code>::operator()(error_code __e) const
diff --git a/libstdc++-v3/src/hash_tr1.cc b/libstdc++-v3/src/hash_tr1.cc
new file mode 100644
index 00000000000..54f2b6e608e
--- /dev/null
+++ b/libstdc++-v3/src/hash_tr1.cc
@@ -0,0 +1,36 @@
+// std::hash definitions -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <cstddef>
+#include <string>
+#include <cmath>
+#include <tr1/functional>
+
+namespace std
+{
+ namespace tr1
+ {
+#include "hash.cc"
+ }
+}
diff --git a/libstdc++-v3/src/hashtable.cc b/libstdc++-v3/src/hashtable.cc
index d490d2e6fd5..8bd3afb0903 100644
--- a/libstdc++-v3/src/hashtable.cc
+++ b/libstdc++-v3/src/hashtable.cc
@@ -22,18 +22,6 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1
-# define _GLIBCXX_END_NAMESPACE_TR1
-#else
-# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace tr1 {
-# define _GLIBCXX_END_NAMESPACE_TR1 }
-#endif
-
-namespace std
-{
-_GLIBCXX_BEGIN_NAMESPACE_TR1
-
namespace __detail
{
extern const unsigned long __prime_list[] = // 256 + 1 or 256 + 48 + 1
@@ -101,6 +89,3 @@ namespace __detail
#endif
};
} // namespace __detail
-
-_GLIBCXX_END_NAMESPACE_TR1
-}
diff --git a/libstdc++-v3/src/hashtable_c++0x.cc b/libstdc++-v3/src/hashtable_c++0x.cc
index d6b5960fbd5..5a91fdef11e 100644
--- a/libstdc++-v3/src/hashtable_c++0x.cc
+++ b/libstdc++-v3/src/hashtable_c++0x.cc
@@ -22,4 +22,11 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# error "hashtable_c++0x.cc must be compiled with -std=gnu++0x"
+#endif
+
+namespace std
+{
#include "hashtable.cc"
+}
diff --git a/libstdc++-v3/src/hashtable_tr1.cc b/libstdc++-v3/src/hashtable_tr1.cc
new file mode 100644
index 00000000000..160fd8e9337
--- /dev/null
+++ b/libstdc++-v3/src/hashtable_tr1.cc
@@ -0,0 +1,31 @@
+// std::__detail definitions -*- C++ -*-
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+namespace std
+{
+ namespace tr1
+ {
+#include "hashtable.cc"
+ }
+}
diff --git a/libstdc++-v3/src/istream.cc b/libstdc++-v3/src/istream.cc
index 7b7f0bf9278..0e7cbfb9084 100644
--- a/libstdc++-v3/src/istream.cc
+++ b/libstdc++-v3/src/istream.cc
@@ -39,7 +39,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -116,12 +116,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb && __n > 0)
+ if (__n > 0 && static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
{
- const char_type __cdelim = traits_type::to_char_type(__delim);
+ const char_type __cdelim = traits_type::to_char_type(__delim);
const int_type __eof = traits_type::eof();
__streambuf_type* __sb = this->rdbuf();
int_type __c = __sb->sgetc();
@@ -205,7 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
streamsize __extracted = 0;
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -288,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
__size_type __extracted = 0;
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, false);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -370,7 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const __size_type __n = __str.max_size();
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -446,7 +446,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
ios_base::iostate __err = ios_base::goodbit;
sentry __cerb(*this, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
@@ -523,7 +523,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
_M_gcount = 0;
sentry __cerb(*this, true);
- if (__cerb && __n > 0)
+ if (__n > 0 && static_cast<bool>(__cerb))
{
ios_base::iostate __err = ios_base::goodbit;
__try
@@ -616,7 +616,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
const __size_type __n = __str.max_size();
ios_base::iostate __err = ios_base::goodbit;
__istream_type::sentry __cerb(__in, true);
- if (__cerb)
+ if (static_cast<bool>(__cerb))
{
__try
{
diff --git a/libstdc++-v3/src/limits_c++0x.cc b/libstdc++-v3/src/limits_c++0x.cc
index adb6e2dbf01..b911bd4c78e 100644
--- a/libstdc++-v3/src/limits_c++0x.cc
+++ b/libstdc++-v3/src/limits_c++0x.cc
@@ -24,6 +24,10 @@
#include <limits>
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+# error "limits_c++0x.cc must be compiled with -std=gnu++0x"
+#endif
+
namespace std
{
// char16_t
diff --git a/libstdc++-v3/src/pool_allocator.cc b/libstdc++-v3/src/pool_allocator.cc
index e0da5e73884..ebaa394900b 100644
--- a/libstdc++-v3/src/pool_allocator.cc
+++ b/libstdc++-v3/src/pool_allocator.cc
@@ -90,11 +90,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
size_t __bytes_to_get = (2 * __total_bytes
+ _M_round_up(_S_heap_size >> 4));
- try
+ __try
{
_S_start_free = static_cast<char*>(::operator new(__bytes_to_get));
}
- catch (...)
+ __catch (...)
{
// Try to make do with what we have. That can't hurt. We
// do not try smaller requests, since that tends to result
diff --git a/libstdc++-v3/testsuite/17_intro/headers/all.cc b/libstdc++-v3/testsuite/17_intro/headers/all.cc
deleted file mode 100644
index d6898235c4a..00000000000
--- a/libstdc++-v3/testsuite/17_intro/headers/all.cc
+++ /dev/null
@@ -1,138 +0,0 @@
-// { dg-do compile }
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-
-// Make sure all the includes can be compiled with -Wc++0x-compat
-// libstdc++/30571
-
-// C
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
-// C++
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-
-// TR1
-#include <tr1/array>
-#include <tr1/cctype>
-#include <tr1/cfenv>
-#include <tr1/cfloat>
-#include <tr1/cinttypes>
-#include <tr1/climits>
-#include <tr1/cmath>
-#include <tr1/complex>
-#include <tr1/cstdarg>
-#include <tr1/cstdbool>
-#include <tr1/cstdint>
-#include <tr1/cstdio>
-#include <tr1/cstdlib>
-#include <tr1/ctgmath>
-#include <tr1/ctime>
-#include <tr1/cwchar>
-#include <tr1/cwctype>
-#include <tr1/functional>
-#include <tr1/random>
-#include <tr1/tuple>
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
-#include <tr1/utility>
-
-// Extensions
-#include <ext/algorithm>
-#include <ext/array_allocator.h>
-#include <ext/atomicity.h>
-#include <ext/bitmap_allocator.h>
-#if _GLIBCXX_HAVE_ICONV
-#include <ext/codecvt_specializations.h>
-#endif
-#include <ext/concurrence.h>
-#include <ext/debug_allocator.h>
-#if _GLIBCXX_HAVE_ICONV
-#include <ext/enc_filebuf.h>
-#endif
-#include <ext/functional>
-#include <ext/iterator>
-#include <ext/malloc_allocator.h>
-#include <ext/memory>
-#include <ext/mt_allocator.h>
-#include <ext/new_allocator.h>
-#include <ext/numeric>
-#include <ext/pod_char_traits.h>
-#include <ext/pool_allocator.h>
-#include <ext/rb_tree>
-#include <ext/rope>
-#include <ext/slist>
-#include <ext/stdio_filebuf.h>
-#include <ext/stdio_sync_filebuf.h>
-#include <ext/throw_allocator.h>
-#include <ext/typelist.h>
-#include <ext/type_traits.h>
-#include <ext/vstring.h>
-#include <ext/pb_ds/assoc_container.hpp>
-#include <ext/pb_ds/priority_queue.hpp>
-#include <ext/pb_ds/exception.hpp>
-#include <ext/pb_ds/hash_policy.hpp>
-#include <ext/pb_ds/list_update_policy.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/trie_policy.hpp>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/all_assert_neg.cc b/libstdc++-v3/testsuite/17_intro/headers/all_assert_neg.cc
deleted file mode 100644
index 9680ce03c4b..00000000000
--- a/libstdc++-v3/testsuite/17_intro/headers/all_assert_neg.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// { dg-do compile }
-// { dg-options "-D__GLIBCXX__=99999999" }
-// NB: This is done to force any generated and possibly included PCH
-// to be invalid.
-
-// 2005-05-24 bkoz
-
-// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 17.4.1.2 Headers
-
-// This file tests that assert is not included in any of the standard
-// includes by accident.
-
-// C++ headers
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-
-// C headers
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
-void foo()
-{
- assert(true);
-}
-
-// { dg-error "not declared" "" { target *-*-* } 83 }
-
-
diff --git a/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc b/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc
deleted file mode 100644
index 843f9f7671d..00000000000
--- a/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// { dg-do compile }
-// { dg-options "-Wc++0x-compat -Werror" }
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-
-// Make sure all the includes can be compiled with -Wc++0x-compat
-// libstdc++/30571
-
-// C
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
-// C++
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-
-// TR1
-#include <tr1/array>
-#include <tr1/cctype>
-#include <tr1/cfenv>
-#include <tr1/cfloat>
-#include <tr1/cinttypes>
-#include <tr1/climits>
-#include <tr1/cmath>
-#include <tr1/complex>
-#include <tr1/cstdarg>
-#include <tr1/cstdbool>
-#include <tr1/cstdint>
-#include <tr1/cstdio>
-#include <tr1/cstdlib>
-#include <tr1/ctgmath>
-#include <tr1/ctime>
-#include <tr1/cwchar>
-#include <tr1/cwctype>
-#include <tr1/functional>
-#include <tr1/random>
-#include <tr1/tuple>
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
-#include <tr1/utility>
-
-// Extensions
-#include <ext/algorithm>
-#include <ext/array_allocator.h>
-#include <ext/atomicity.h>
-#include <ext/bitmap_allocator.h>
-#if _GLIBCXX_HAVE_ICONV
-#include <ext/codecvt_specializations.h>
-#endif
-#include <ext/concurrence.h>
-#include <ext/debug_allocator.h>
-#if _GLIBCXX_HAVE_ICONV
-#include <ext/enc_filebuf.h>
-#endif
-#include <ext/functional>
-#include <ext/iterator>
-#include <ext/malloc_allocator.h>
-#include <ext/memory>
-#include <ext/mt_allocator.h>
-#include <ext/new_allocator.h>
-#include <ext/numeric>
-#include <ext/pod_char_traits.h>
-#include <ext/pool_allocator.h>
-#include <ext/rb_tree>
-#include <ext/rope>
-#include <ext/slist>
-#include <ext/stdio_filebuf.h>
-#include <ext/stdio_sync_filebuf.h>
-#include <ext/throw_allocator.h>
-#include <ext/typelist.h>
-#include <ext/type_traits.h>
-#include <ext/vstring.h>
-#include <ext/pb_ds/assoc_container.hpp>
-#include <ext/pb_ds/priority_queue.hpp>
-#include <ext/pb_ds/exception.hpp>
-#include <ext/pb_ds/hash_policy.hpp>
-#include <ext/pb_ds/list_update_policy.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/trie_policy.hpp>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc b/libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc
deleted file mode 100644
index 6e94152cd52..00000000000
--- a/libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc
+++ /dev/null
@@ -1,139 +0,0 @@
-// { dg-do compile }
-// { dg-options "-pedantic-errors" }
-
-// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-
-// Make sure all the includes can be compiled with -Wc++0x-compat
-// libstdc++/30571
-
-// C
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
-// C++
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-
-// TR1
-#include <tr1/array>
-#include <tr1/cctype>
-#include <tr1/cfenv>
-#include <tr1/cfloat>
-#include <tr1/cinttypes>
-#include <tr1/climits>
-#include <tr1/cmath>
-#include <tr1/complex>
-#include <tr1/cstdarg>
-#include <tr1/cstdbool>
-#include <tr1/cstdint>
-#include <tr1/cstdio>
-#include <tr1/cstdlib>
-#include <tr1/ctgmath>
-#include <tr1/ctime>
-#include <tr1/cwchar>
-#include <tr1/cwctype>
-#include <tr1/functional>
-#include <tr1/random>
-#include <tr1/tuple>
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
-#include <tr1/utility>
-
-// Extensions
-#include <ext/algorithm>
-#include <ext/array_allocator.h>
-#include <ext/atomicity.h>
-#include <ext/bitmap_allocator.h>
-#if _GLIBCXX_HAVE_ICONV
-#include <ext/codecvt_specializations.h>
-#endif
-#include <ext/concurrence.h>
-#include <ext/debug_allocator.h>
-#if _GLIBCXX_HAVE_ICONV
-#include <ext/enc_filebuf.h>
-#endif
-#include <ext/functional>
-#include <ext/iterator>
-#include <ext/malloc_allocator.h>
-#include <ext/memory>
-#include <ext/mt_allocator.h>
-#include <ext/new_allocator.h>
-#include <ext/numeric>
-#include <ext/pod_char_traits.h>
-#include <ext/pool_allocator.h>
-#include <ext/rb_tree>
-#include <ext/rope>
-#include <ext/slist>
-#include <ext/stdio_filebuf.h>
-#include <ext/stdio_sync_filebuf.h>
-#include <ext/throw_allocator.h>
-#include <ext/typelist.h>
-#include <ext/type_traits.h>
-#include <ext/vstring.h>
-#include <ext/pb_ds/assoc_container.hpp>
-#include <ext/pb_ds/priority_queue.hpp>
-#include <ext/pb_ds/exception.hpp>
-#include <ext/pb_ds/hash_policy.hpp>
-#include <ext/pb_ds/list_update_policy.hpp>
-#include <ext/pb_ds/tree_policy.hpp>
-#include <ext/pb_ds/trie_policy.hpp>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc
index ce7c50e1c61..70661e91376 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc
@@ -1,7 +1,6 @@
// { dg-do compile }
-// 1999-05-12 bkoz
-// Copyright (C) 1999, 2007, 2009 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@@ -18,86 +17,4 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// FreeBSD wants warning clean system headers:
-// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* } }
-
-// 17.4.1.2 Headers
-
-// "C" headers
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <cwchar>
-#include <cwctype>
-
-// "C" compatibility headers
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <float.h>
-#include <iso646.h>
-#include <limits.h>
-#include <locale.h>
-#include <math.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#ifdef _GLIBCXX_HAVE_WCHAR_H
-#include <wchar.h>
-#endif
-#ifdef _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
-#endif
-
-// "C++" headers
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-
+#include <bits/extc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_c++200x_compatibility.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_c++200x_compatibility.cc
new file mode 100644
index 00000000000..40889d932ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_c++200x_compatibility.cc
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-Wc++0x-compat -Werror" }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// Make sure all the includes can be compiled with -Wc++0x-compat
+// libstdc++/30571
+
+#include <bits/extc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc
deleted file mode 100644
index f7904aea8e9..00000000000
--- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc
+++ /dev/null
@@ -1,181 +0,0 @@
-// { dg-do compile }
-// 1999-05-12 bkoz
-
-// Copyright (C) 1999, 2007, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// FreeBSD wants warning clean system headers:
-// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* } }
-
-// 17.4.1.2 Headers
-
-// "C" headers
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <cwchar>
-#include <cwctype>
-
-// "C" compatibility headers
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <float.h>
-#include <iso646.h>
-#include <limits.h>
-#include <locale.h>
-#include <math.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#ifdef _GLIBCXX_HAVE_WCHAR_H
-#include <wchar.h>
-#endif
-#ifdef _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
-#endif
-
-// "C++" headers
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
-
-
-// "C" headers
-#include <cassert>
-#include <cctype>
-#include <cerrno>
-#include <cfloat>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-#include <cwchar>
-#include <cwctype>
-
-// "C" compatibility headers
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <float.h>
-#include <iso646.h>
-#include <limits.h>
-#include <locale.h>
-#include <math.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#ifdef _GLIBCXX_HAVE_WCHAR_H
-#include <wchar.h>
-#endif
-#ifdef _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
-#endif
-
-// "C++" headers
-#include <algorithm>
-#include <bitset>
-#include <complex>
-#include <deque>
-#include <exception>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <typeinfo>
-#include <utility>
-#include <valarray>
-#include <vector>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_no_exceptions.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_no_exceptions.cc
new file mode 100644
index 00000000000..c645d3f7dbc
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_no_exceptions.cc
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-fno-exceptions" }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/extc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_pedantic_errors.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_pedantic_errors.cc
new file mode 100644
index 00000000000..4faa5af3ddf
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_pedantic_errors.cc
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-pedantic-errors" }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/extc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++.cc
new file mode 100644
index 00000000000..3d5db7a3227
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++.cc
@@ -0,0 +1,49 @@
+// FreeBSD wants warning clean system headers:
+// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* } }
+// { dg-do compile }
+// 1999-05-12 bkoz
+
+// Copyright (C) 1999, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 17.4.1.2 Headers
+
+#include <bits/stdc++.h>
+
+// "C" compatibility headers
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <float.h>
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#ifdef _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc
new file mode 100644
index 00000000000..829dee1a22b
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_assert_neg.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-D_GLIBCXX_NO_ASSERT" }
+// NB: This is done to force any generated and possibly included PCH
+// to be invalid, and also to remove cassert from the include set.
+
+// 2005-05-24 bkoz
+
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 17.4.1.2 Headers
+
+// This file tests that assert is not included in any of the standard
+// includes by accident.
+
+#include <bits/stdc++.h>
+
+void foo()
+{
+ assert(true); // { dg-error "not declared" "" { target *-*-* } }
+}
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_multiple_inclusion.cc
new file mode 100644
index 00000000000..e900fa75ef3
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/stdc++_multiple_inclusion.cc
@@ -0,0 +1,75 @@
+// FreeBSD wants warning clean system headers:
+// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* } }
+// { dg-do compile }
+// 1999-05-12 bkoz
+
+// Copyright (C) 1999, 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 17.4.1.2 Headers
+
+#include <bits/stdc++.h>
+
+// "C" compatibility headers
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <float.h>
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#ifdef _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
+
+#include <bits/stdc++.h>
+
+// "C" compatibility headers
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <float.h>
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#ifdef _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc
deleted file mode 100644
index 424bb58a882..00000000000
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc
+++ /dev/null
@@ -1,252 +0,0 @@
-// { dg-options "-std=gnu++0x" }
-// { dg-do compile }
-
-// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 17.4.1.2 Headers
-
-// "C" headers
-#include <cassert>
-#include <ccomplex>
-#include <cctype>
-#include <cerrno>
-#include <cfenv>
-#include <cfloat>
-#include <cinttypes>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstdbool>
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctgmath>
-#include <ctime>
-#include <cwchar>
-#include <cwctype>
-
-// "C" compatibility headers
-#include <assert.h>
-#ifdef _GLIBCXX_HAVE_COMPLEX_H
-#include <complex.h>
-#endif
-#include <ctype.h>
-#include <errno.h>
-#ifdef _GLIBCXX_HAVE_FENV_H
-#include <fenv.h>
-#endif
-#include <float.h>
-#ifdef _GLIBCXX_HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#include <iso646.h>
-#include <limits.h>
-#include <locale.h>
-#include <math.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdarg.h>
-#ifdef _GLIBCXX_HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-#include <stddef.h>
-#ifdef _GLIBCXX_HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef _GLIBCXX_HAVE_TGMATH_H
-#include <tgmath.h>
-#endif
-#include <time.h>
-#ifdef _GLIBCXX_HAVE_WCHAR_H
-#include <wchar.h>
-#endif
-#ifdef _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
-#endif
-
-// "C++" headers
-#include <algorithm>
-#include <array>
-#include <bitset>
-#include <chrono>
-#include <complex>
-#include <condition_variable>
-#include <deque>
-#include <exception>
-#include <forward_list>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <random>
-#include <ratio>
-#include <regex>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <thread>
-#include <tuple>
-#include <typeinfo>
-#include <type_traits>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <valarray>
-#include <vector>
-
-
-// "C" headers
-#include <cassert>
-#include <ccomplex>
-#include <cctype>
-#include <cerrno>
-#include <cfenv>
-#include <cfloat>
-#include <cinttypes>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstdbool>
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctgmath>
-#include <ctime>
-#include <cwchar>
-#include <cwctype>
-
-// "C" compatibility headers
-#include <assert.h>
-#ifdef _GLIBCXX_HAVE_COMPLEX_H
-#include <complex.h>
-#endif
-#include <ctype.h>
-#include <errno.h>
-#ifdef _GLIBCXX_HAVE_FENV_H
-#include <fenv.h>
-#endif
-#include <float.h>
-#ifdef _GLIBCXX_HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-#include <iso646.h>
-#include <limits.h>
-#include <locale.h>
-#include <math.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdarg.h>
-#ifdef _GLIBCXX_HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
-#include <stddef.h>
-#ifdef _GLIBCXX_HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef _GLIBCXX_HAVE_TGMATH_H
-#include <tgmath.h>
-#endif
-#include <time.h>
-#ifdef _GLIBCXX_HAVE_WCHAR_H
-#include <wchar.h>
-#endif
-#ifdef _GLIBCXX_HAVE_WCTYPE_H
-#include <wctype.h>
-#endif
-
-// "C++" headers
-#include <algorithm>
-#include <array>
-#include <bitset>
-#include <chrono>
-#include <complex>
-#include <condition_variable>
-#include <deque>
-#include <exception>
-#include <forward_list>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <random>
-#include <ratio>
-#include <regex>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <thread>
-#include <tuple>
-#include <typeinfo>
-#include <type_traits>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <valarray>
-#include <vector>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_exceptions.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_exceptions.cc
new file mode 100644
index 00000000000..5650e3a51ad
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_exceptions.cc
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x -fno-exceptions" }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/extc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc
new file mode 100644
index 00000000000..08f8fd80767
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x -pedantic-errors" }
+
+// Copyright (C) 2007, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/extc++.h>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
index 5a9f8045ca4..f3e19f5003b 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
@@ -1,3 +1,5 @@
+// FreeBSD wants warning clean system headers:
+// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* } }
// { dg-options "-std=gnu++0x" }
// { dg-do compile }
@@ -20,32 +22,7 @@
// 17.4.1.2 Headers
-// "C" headers
-#include <cassert>
-#include <ccomplex>
-#include <cctype>
-#include <cerrno>
-#include <cfenv>
-#include <cfloat>
-#include <cinttypes>
-#include <ciso646>
-#include <climits>
-#include <clocale>
-#include <cmath>
-#include <csetjmp>
-#include <csignal>
-#include <cstdarg>
-#include <cstdatomic>
-#include <cstdbool>
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctgmath>
-#include <ctime>
-#include <cwchar>
-#include <cwctype>
+#include <bits/stdc++.h>
// "C" compatibility headers
#include <assert.h>
@@ -89,51 +66,3 @@
#ifdef _GLIBCXX_HAVE_WCTYPE_H
#include <wctype.h>
#endif
-
-// "C++" headers
-#include <algorithm>
-#include <array>
-#include <bitset>
-#include <chrono>
-#include <complex>
-#include <condition_variable>
-#include <deque>
-#include <exception>
-#include <forward_list>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <ios>
-#include <iosfwd>
-#include <iostream>
-#include <istream>
-#include <iterator>
-#include <limits>
-#include <list>
-#include <locale>
-#include <map>
-#include <memory>
-#include <mutex>
-#include <new>
-#include <numeric>
-#include <ostream>
-#include <queue>
-#include <random>
-#include <ratio>
-#include <regex>
-#include <set>
-#include <sstream>
-#include <stack>
-#include <stdexcept>
-#include <streambuf>
-#include <string>
-#include <system_error>
-#include <thread>
-#include <tuple>
-#include <typeinfo>
-#include <type_traits>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <valarray>
-#include <vector>
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
new file mode 100644
index 00000000000..89c6cdd43a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
@@ -0,0 +1,111 @@
+// FreeBSD wants warning clean system headers:
+// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* } }
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 17.4.1.2 Headers
+
+#include <bits/stdc++.h>
+
+// "C" compatibility headers
+#include <assert.h>
+#ifdef _GLIBCXX_HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+#include <ctype.h>
+#include <errno.h>
+#ifdef _GLIBCXX_HAVE_FENV_H
+#include <fenv.h>
+#endif
+#include <float.h>
+#ifdef _GLIBCXX_HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#ifdef _GLIBCXX_HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#ifdef _GLIBCXX_HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _GLIBCXX_HAVE_TGMATH_H
+#include <tgmath.h>
+#endif
+#include <time.h>
+#ifdef _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#ifdef _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
+
+#include <bits/stdc++.h>
+
+// "C" compatibility headers
+#include <assert.h>
+#ifdef _GLIBCXX_HAVE_COMPLEX_H
+#include <complex.h>
+#endif
+#include <ctype.h>
+#include <errno.h>
+#ifdef _GLIBCXX_HAVE_FENV_H
+#include <fenv.h>
+#endif
+#include <float.h>
+#ifdef _GLIBCXX_HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#include <iso646.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdarg.h>
+#ifdef _GLIBCXX_HAVE_STDBOOL_H
+#include <stdbool.h>
+#endif
+#include <stddef.h>
+#ifdef _GLIBCXX_HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _GLIBCXX_HAVE_TGMATH_H
+#include <tgmath.h>
+#endif
+#include <time.h>
+#ifdef _GLIBCXX_HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#ifdef _GLIBCXX_HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
diff --git a/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc b/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc
index a66c0156291..6c64eb29d9f 100644
--- a/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc
+++ b/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc
@@ -29,7 +29,7 @@ namespace std {
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f ) throw();
- void terminate();
+ void terminate() throw();
bool uncaught_exception() throw();
}
diff --git a/libstdc++-v3/testsuite/20_util/forward/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/forward/requirements/explicit_instantiation.cc
index 8b14da23a95..88ba9e548af 100644
--- a/libstdc++-v3/testsuite/20_util/forward/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/forward/requirements/explicit_instantiation.cc
@@ -28,5 +28,5 @@
namespace std
{
typedef short test_type;
- template test_type&& forward(std::identity<test_type>::type&&);
+ template test_type&& forward<test_type>(test_type&&);
}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc
index e8c751bba5c..e2ec0786055 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc
@@ -66,7 +66,7 @@ test01()
std::shared_ptr<A> a(new A);
std::auto_ptr<B> b(new B);
- a = b;
+ a = std::move(b);
VERIFY( a.get() != 0 );
VERIFY( b.get() == 0 );
VERIFY( A::ctor_count == 2 );
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
index 155449438cf..b79a25b131c 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc
@@ -36,7 +36,7 @@ test01()
std::shared_ptr<A> a;
std::auto_ptr<B> b;
- a = b; // { dg-error "here" }
+ a = std::move(b); // { dg-error "here" }
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc
index 9087e518ad9..eb5bb9590df 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc
@@ -33,7 +33,7 @@ test01()
bool test __attribute__((unused)) = true;
std::auto_ptr<A> a(new A);
- std::shared_ptr<A> a2(a);
+ std::shared_ptr<A> a2(std::move(a));
VERIFY( a.get() == 0 );
VERIFY( a2.get() != 0 );
VERIFY( a2.use_count() == 1 );
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
index 3a946b5872b..e2ef60e3fbb 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc
@@ -34,7 +34,7 @@ test01()
bool test __attribute__((unused)) = true;
const std::auto_ptr<A> a;
- std::shared_ptr<A> p(a); // { dg-error "no match" }
+ std::shared_ptr<A> p(std::move(a)); // { dg-error "no match" }
return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/tuple/swap.cc b/libstdc++-v3/testsuite/20_util/tuple/swap.cc
index 6dab446bfe9..613e9c2ff1c 100644
--- a/libstdc++-v3/testsuite/20_util/tuple/swap.cc
+++ b/libstdc++-v3/testsuite/20_util/tuple/swap.cc
@@ -41,7 +41,7 @@ struct MoveOnly
bool operator==(MoveOnly const& m)
{ return i == m.i; }
- void swap(MoveOnly&& m)
+ void swap(MoveOnly& m)
{ std::swap(m.i, i); }
int i;
diff --git a/libstdc++-v3/testsuite/23_containers/deque/operators/1.cc b/libstdc++-v3/testsuite/23_containers/deque/operators/1.cc
index ccc95f3c766..5db862186ce 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/operators/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/operators/1.cc
@@ -55,30 +55,8 @@ void test01()
VERIFY( constend <= end );
}
-// libstdc++/7186
-void test02()
-{
- bool test __attribute__((unused)) = true;
-
- std::deque<int> d(2);
- typedef std::deque<int>::iterator iter;
- typedef std::deque<int>::const_iterator constiter;
-
- iter beg = d.begin();
- iter end = d.end();
- constiter constbeg = d.begin();
- constiter constend = d.end();
-
- VERIFY( beg - constbeg == 0 );
- VERIFY( constend - end == 0 );
-
- VERIFY( end - constbeg > 0 );
- VERIFY( constend - beg > 0 );
-}
-
int main()
{
test01();
- test02();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/operators/2.cc b/libstdc++-v3/testsuite/23_containers/deque/operators/2.cc
new file mode 100644
index 00000000000..4db5e0ee209
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/deque/operators/2.cc
@@ -0,0 +1,50 @@
+// 2002-05-18 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2002, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.1 deque operators
+
+#include <deque>
+#include <testsuite_hooks.h>
+
+// libstdc++/7186
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::deque<int> d(2);
+ typedef std::deque<int>::iterator iter;
+ typedef std::deque<int>::const_iterator constiter;
+
+ iter beg = d.begin();
+ iter end = d.end();
+ constiter constbeg = d.begin();
+ constiter constend = d.end();
+
+ VERIFY( beg - constbeg == 0 );
+ VERIFY( constend - end == 0 );
+
+ VERIFY( end - constbeg > 0 );
+ VERIFY( constend - beg > 0 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/1.cc
index 0d9361a37d0..8b5afdd980b 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/1.cc
@@ -39,7 +39,7 @@ test01()
fwd_list_type x = {666.0, 777.0, 888.0};
- a.splice_after(posa, x);
+ a.splice_after(posa, std::move(x));
++posa;
VERIFY(*posa == 666.0);
@@ -70,7 +70,7 @@ test02()
++endy;
VERIFY(*endy == 14.0);
- a.splice_after(posa, y, befy, endy);
+ a.splice_after(posa, std::move(y), befy, endy);
VERIFY(*posa == 0.0);
VERIFY(*befy == 10.0);
@@ -95,7 +95,7 @@ test03()
fwd_list_type::const_iterator posz = z.begin();
VERIFY(*posz == 42.0);
- a.splice_after(posa, z, posz);
+ a.splice_after(posa, std::move(z), posz);
VERIFY(*posa == 1.0);
++posa;
VERIFY(*posa == 43.0);
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/5.cc
index 434a9aaac95..13d15b39d12 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/5.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/ext_pointer/operations/5.cc
@@ -37,7 +37,7 @@ test01()
fwd_list_type a = {0.0, 1.0, 2.0, 3.0, 4.0};
fwd_list_type b = {1.0, 2.0, 3.0, 4.0, 4.0, 5.0};
- a.merge(b);
+ a.merge(std::move(b));
fwd_list_type r = {0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0, 4.0, 4.0, 4.0, 5.0};
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc
index 1f86db9743f..5a996f3411e 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/1.cc
@@ -34,7 +34,7 @@ test01()
std::forward_list<double> x = {666.0, 777.0, 888.0};
- a.splice_after(posa, x);
+ a.splice_after(posa, std::move(x));
++posa;
VERIFY(*posa == 666.0);
@@ -63,7 +63,7 @@ test02()
++endy;
VERIFY(*endy == 14.0);
- a.splice_after(posa, y, befy, endy);
+ a.splice_after(posa, std::move(y), befy, endy);
VERIFY(*posa == 0.0);
VERIFY(*befy == 10.0);
@@ -86,7 +86,7 @@ test03()
std::forward_list<double>::const_iterator posz = z.begin();
VERIFY(*posz == 42.0);
- a.splice_after(posa, z, posz);
+ a.splice_after(posa, std::move(z), posz);
VERIFY(*posa == 1.0);
++posa;
VERIFY(*posa == 43.0);
diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc b/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc
index 05e3f844410..1291a269044 100644
--- a/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc
+++ b/libstdc++-v3/testsuite/23_containers/forward_list/operations/5.cc
@@ -32,7 +32,7 @@ test01()
std::forward_list<double> a = {0.0, 1.0, 2.0, 3.0, 4.0};
std::forward_list<double> b = {1.0, 2.0, 3.0, 4.0, 4.0, 5.0};
- a.merge(b);
+ a.merge(std::move(b));
std::forward_list<double> r = {0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0,
4.0, 4.0, 4.0, 5.0};
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
index d9bd9a2194e..767640ea996 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
@@ -15,8 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include "1.h"
#include <list>
+#include "1.h"
namespace std
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
index 7bd75a39e3c..d1faf025f2f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
@@ -17,8 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include "2.h"
#include <list>
+#include "2.h"
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
index f994e9b4ae1..676466d537a 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
@@ -17,8 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include "3.h"
#include <list>
+#include "3.h"
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index cd2b2994807..c0b6ea46be9 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1379 }
+// { dg-error "no matching" "" { target *-*-* } 1387 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index cc2b419bd4e..0d27211a5f7 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1348 }
+// { dg-error "no matching" "" { target *-*-* } 1356 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index d650a9ec102..bbf78080365 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1348 }
+// { dg-error "no matching" "" { target *-*-* } 1356 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index ae9e63f704e..1e84b97d301 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1348 }
+// { dg-error "no matching" "" { target *-*-* } 1356 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/map/dr130.cc b/libstdc++-v3/testsuite/23_containers/map/dr130.cc
new file mode 100644
index 00000000000..d7f3c2b0856
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/map/dr130.cc
@@ -0,0 +1,77 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <map>
+#include <testsuite_hooks.h>
+
+// DR 130. Associative erase should return an iterator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ map<int, int> m0;
+ typedef map<int, int>::iterator iterator;
+ typedef map<int, int>::const_iterator const_iterator;
+ typedef map<int, int>::value_type value_type;
+ typedef pair<iterator, bool> insert_return_type;
+
+ insert_return_type irt0 = m0.insert(value_type(1, 1));
+ insert_return_type irt1 = m0.insert(value_type(2, 2));
+ insert_return_type irt2 = m0.insert(value_type(3, 3));
+
+ iterator pos1 = m0.erase(irt1.first);
+ VERIFY( pos1 == irt2.first );
+
+ iterator pos2 = m0.erase(irt2.first);
+ VERIFY( pos2 == m0.end() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ map<int, int> m0;
+ typedef map<int, int>::iterator iterator;
+ typedef map<int, int>::const_iterator const_iterator;
+ typedef map<int, int>::value_type value_type;
+ typedef pair<iterator, bool> insert_return_type;
+
+ insert_return_type irt0 = m0.insert(value_type(1, 1));
+ insert_return_type irt1 = m0.insert(value_type(2, 2));
+ insert_return_type irt2 = m0.insert(value_type(3, 3));
+ insert_return_type irt3 = m0.insert(value_type(4, 4));
+
+ iterator pos1 = m0.erase(irt0.first, irt2.first);
+ VERIFY( pos1 == irt2.first );
+
+ iterator pos2 = m0.erase(irt2.first, ++irt3.first);
+ VERIFY( pos2 == m0.end() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/dr130.cc b/libstdc++-v3/testsuite/23_containers/multimap/dr130.cc
new file mode 100644
index 00000000000..08684870642
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multimap/dr130.cc
@@ -0,0 +1,87 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on multiset (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <map>
+#include <vector>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ multimap<int, int> mm0;
+ typedef multimap<int, int>::iterator iterator;
+ typedef multimap<int, int>::const_iterator const_iterator;
+ typedef multimap<int, int>::value_type value_type;
+ typedef iterator insert_return_type;
+
+ vector<insert_return_type> irt;
+ for (int i = 1; i <= 4; ++i)
+ for (int j = 1; j <= i; ++j)
+ irt.push_back( mm0.insert( value_type( i, i ) ) );
+
+ iterator pos1 = mm0.erase(irt[1]);
+ VERIFY( pos1 == irt[2] );
+
+ iterator pos2 = mm0.erase(irt[2]);
+ VERIFY( pos2 == irt[3] );
+
+ iterator pos3 = mm0.erase(irt[9]);
+ VERIFY( pos3 == mm0.end() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ multimap<int, int> mm0;
+ typedef multimap<int, int>::iterator iterator;
+ typedef multimap<int, int>::const_iterator const_iterator;
+ typedef multimap<int, int>::value_type value_type;
+ typedef iterator insert_return_type;
+
+ vector<insert_return_type> irt;
+ for (int i = 1; i <= 4; ++i)
+ for (int j = 1; j <= i; ++j)
+ irt.push_back( mm0.insert( value_type( i, i ) ) );
+
+ iterator pos1 = mm0.erase(irt[3], irt[6]);
+ VERIFY( pos1 == irt[6] );
+
+ iterator pos2 = mm0.erase(irt[6], ++irt[9]);
+ VERIFY( pos2 == mm0.end() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/dr130.cc b/libstdc++-v3/testsuite/23_containers/multiset/dr130.cc
new file mode 100644
index 00000000000..52392fcc153
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/multiset/dr130.cc
@@ -0,0 +1,85 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on multiset (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <set>
+#include <vector>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ multiset<int> ms0;
+ typedef multiset<int>::iterator iterator;
+ typedef multiset<int>::const_iterator const_iterator;
+ typedef iterator insert_return_type;
+
+ vector<insert_return_type> irt;
+ for ( int i = 1; i <= 4; ++i )
+ for (int j = 1; j <= i; ++j)
+ irt.push_back( ms0.insert( i ) );
+
+ iterator pos1 = ms0.erase(irt[1]);
+ VERIFY( pos1 == irt[2] );
+
+ iterator pos2 = ms0.erase(irt[2]);
+ VERIFY( pos2 == irt[3] );
+
+ iterator pos3 = ms0.erase(irt[9]);
+ VERIFY( pos3 == ms0.end() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ multiset<int> ms0;
+ typedef multiset<int>::iterator iterator;
+ typedef multiset<int>::const_iterator const_iterator;
+ typedef iterator insert_return_type;
+
+ vector<insert_return_type> irt;
+ for ( int i = 1; i <= 4; ++i )
+ for (int j = 1; j <= i; ++j)
+ irt.push_back( ms0.insert( i ) );
+
+ iterator pos1 = ms0.erase(irt[3], irt[6]);
+ VERIFY( pos1 == irt[6] );
+
+ iterator pos2 = ms0.erase(irt[6], ++irt[9]);
+ VERIFY( pos2 == ms0.end() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/set/dr130.cc b/libstdc++-v3/testsuite/23_containers/set/dr130.cc
new file mode 100644
index 00000000000..1904dcdc0bd
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/set/dr130.cc
@@ -0,0 +1,75 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <set>
+#include <testsuite_hooks.h>
+
+// DR 130. Associative erase should return an iterator.
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0;
+ typedef set<int>::iterator iterator;
+ typedef set<int>::const_iterator const_iterator;
+ typedef pair<iterator, bool> insert_return_type;
+
+ insert_return_type irt0 = s0.insert(1);
+ insert_return_type irt1 = s0.insert(2);
+ insert_return_type irt2 = s0.insert(3);
+
+ iterator pos1 = s0.erase(irt1.first);
+ VERIFY( pos1 == irt2.first );
+
+ iterator pos2 = s0.erase(irt2.first);
+ VERIFY( pos2 == s0.end() );
+}
+
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ set<int> s0;
+ typedef set<int>::iterator iterator;
+ typedef set<int>::const_iterator const_iterator;
+ typedef pair<iterator, bool> insert_return_type;
+
+ insert_return_type irt0 = s0.insert(1);
+ insert_return_type irt1 = s0.insert(2);
+ insert_return_type irt2 = s0.insert(3);
+ insert_return_type irt3 = s0.insert(4);
+
+ iterator pos1 = s0.erase(irt0.first, irt2.first);
+ VERIFY( pos1 == irt2.first );
+
+ iterator pos2 = s0.erase(irt2.first, ++irt3.first);
+ VERIFY( pos2 == s0.end() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/15523.cc b/libstdc++-v3/testsuite/23_containers/vector/15523.cc
new file mode 100644
index 00000000000..3b8230cd560
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/15523.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-D_GLIBCXX_DEBUG" }
+
+#include <vector>
+
+// libstdc++/15523
+void test01()
+{
+ using namespace std;
+
+ vector<vector<int>::const_iterator> x(2);
+
+ vector<int>::iterator i2, i3;
+ vector<int>::const_iterator ci1(i2);
+
+ i2 = i3;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
index 26c3501f04d..771a5550d43 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
+++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc
@@ -19,8 +19,8 @@
// { dg-do compile }
-// { dg-xfail-if "" { { *-*-linux* *-*-darwin[3-7]* } || { uclibc || newlib } } { "*" } { "" } }
-// { dg-excess-errors "" { target { { *-*-linux* *-*-darwin[3-7]* } || { uclibc || newlib } } } }
+// { dg-xfail-if "" { { *-*-linux* *-*-darwin[3-9]* } || { uclibc || newlib } } { "*" } { "" } }
+// { dg-excess-errors "" { target { { *-*-linux* *-*-darwin[3-9]* } || { uclibc || newlib } } } }
#include <math.h>
diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc
index a9dcd0626be..16e56f80569 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc
index d4c29e26784..9742e273a9e 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..3677ba7dd61
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.2.1 Class template bernoulli_distribution [rand.dist.bern.bernoulli]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::bernoulli_distribution u(0.75), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc
index 20a69ad803e..adea635e962 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/bernoulli_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc
index 22b854d8a5d..25fe4fbc5e6 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc
index 077d6a3032c..4381c6ea415 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..fb65018b93f
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/operators/serialize.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.2.2 Class template binomial_distribution [rand.dist.bern.bin]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::binomial_distribution<int> u(3, 0.75), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc
index cd6eb7d9e7c..e60fac13c75 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/binomial_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc
index a61fcaad3df..85a5c278c39 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc
index ce936bca62c..54f6f81b3c5 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..fd0d5f9db56
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.4.1 class template discard_block_engine [rand.adapt.disc]
+// 26.4.2.3 concept RandomNumberEngineAdaptor [rand.concept.adapt]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::cauchy_distribution<double> u(5.0, 2.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc
index 173404138a5..3d80d2ddf0f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/cauchy_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc
index 0135bad215e..88e5ebb4c82 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc
index 4461b410a56..a720aab5f00 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..146eeae5157
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.4.3 Class template chi_squared_distribution [rand.dist.norm.chisq]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::chi_squared_distribution<double> u(1.5), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc
index 5fa807432bc..271e0fe451a 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/chi_squared_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc b/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc
index c766482414d..3fef87d0c8e 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/default_random_engine.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc
index c69467eb691..328dd71d0bb 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_copy.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc
index 86cc46be50b..990dc9b3fe9 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/base_move.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc
index a82623ea564..17fea5bdb47 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc
index b464e71d5a3..efe194c99f0 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc
index d670c608fee..82f6fdb1c74 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc
index 098f2bbe04f..58f0f1c392a 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/cons/seed_seq.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc
index 39560537d5d..db2497540a3 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/equal.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc
index d2f66125e18..1d39a213f47 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/operators/serialize.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc
index 0c2c42a1b72..379b3aeb978 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discard_block_engine/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc
index f5292a638c8..9d05b19823f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc
index c83da0778a4..3bcb7448e96 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/initlist.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc
index 13974837255..12282f0f468 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/num_xbound_fun.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc
index b7eb7fcfa77..aa8d9567f45 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/cons/range.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..c2ba51a1282
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/operators/serialize.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.5.1 Class template discrete_distribution [rand.dist.samp.discrete]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::vector<double> wt = {0.5, 1.0, 2.5, 1.5, 0.5};
+ std::discrete_distribution<int> u(wt.begin(), wt.end()), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc
index 7d25cad8c95..7c5977b3808 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/discrete_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc
index ba4dc9cfee4..97168ff029f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc
index 753f5c93175..6c2535fa0ac 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..d1dca74c624
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.2 Class template exponential_distribution [rand.dist.pois.exp]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::exponential_distribution<double> u(0.5), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc
index 83eb297fa0b..7c696e25244 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/exponential_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc
index ce9756b3f7b..542909588ee 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc
index 99315f4fa07..d0374cd5c22 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..2f68409b995
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.5 Class template extreme_value_distribution [rand.dist.pois.extreme]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::extreme_value_distribution<double> u, v(5.0, 2.0);
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc
index f271d663d12..8f5d99da494 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/extreme_value_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc
index 6fc78d2e066..d3e8ae968fa 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc
index 576f88b7b0d..15133aba161 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..52640f3fc3a
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.4.5 Class template fisher_f_distribution [rand.dist.norm.f]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::fisher_f_distribution<double> u(2.0, 3.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc
index 62b3f3a2a95..a92727d706b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/fisher_f_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc
index 0c4745b9172..378eca23b9f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc
index 2d31e9a4ee8..c400c98df62 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..0c24b7a5b00
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.3 Class template gamma_distribution [rand.dist.pois.gamma]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::gamma_distribution<double> u(1.5, 3.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc
index f4b2775a5c0..a1d15575e91 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/gamma_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc
index 4cc05596913..353193bbd9c 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc
index b0d6e109a43..ddc66767546 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..75de1b88cae
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.2.3 Class template geometric_distribution [rand.dist.bern.geom]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::geometric_distribution<int> u(0.75), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc
index 6955c516107..cc03ebf0ddb 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/geometric_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc
index 0c7e7615b2f..2c8d88e4f26 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_copy.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc
index 8243d7cbe41..1d2ede72c9b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/base_move.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc
index 1da18ffca52..7db0cf30ffc 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc
index fcc274ef908..9ad6164d963 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc
index a2f3869a5a0..3e878773044 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc
index 42138ab7550..724a324310f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/cons/seed_seq.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc
index 15294fbf09f..18d05140db2 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/equal.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc
index 759e64817c3..332931addfa 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/operators/serialize.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc
index 367fc94ad72..0402a0966bc 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/independent_bits_engine/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc b/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc
index e1dde6b5241..ba4016eabd2 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/knuth_b.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc
index d3f40a057cb..42ca73c73f3 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc
index 700dc7dde54..75a2e42c56d 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc
index 3da26ccc104..a8819598670 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/cons/seed2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc
index 62a266e23e0..5f555db48d6 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/equal.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc
index 38c19624c48..8b67e5f3a33 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/operators/serialize.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc
index 390334487a2..f54d76ada07 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc
@@ -20,8 +20,9 @@
// { dg-do compile }
// { dg-options "-std=c++0x -D_GLIBCXX_CONCEPT_CHECKS" }
-// { dg-error "not a valid type" "" { target *-*-* } 31 }
-// { dg-error "invalid type" "" { target *-*-* } 31 }
+// { dg-require-cstdint "" }
+// { dg-error "not a valid type" "" { target *-*-* } 32 }
+// { dg-error "invalid type" "" { target *-*-* } 32 }
// 26.4.3.1 class template linear_congruential_engine [rand.eng.lcong]
// 26.4.2.2 Concept RandomNumberEngine [rand.concept.eng]
diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc
index a17c5526a92..993f7935498 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc
index 62893c0dab8..9607fd3e830 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc
index ea5b7363977..a18f935087c 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..877b6aab548
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.4.2 Class template lognormal_distribution [rand.dist.norm.lognormal]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::lognormal_distribution<double> u(5.0, 2.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc
index 035c8c6ce3d..2e3ade699c4 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/lognormal_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc
index 838d778bd0f..30634e1da30 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc
index e711a4a1045..b37f9782496 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc
index 9a63769ada6..d840772cd76 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/cons/seed2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc
index c96c54f567f..7e482a8cd09 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/equal.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc
index 6cfd8951bc9..03fb8b04fa1 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/operators/serialize.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc
index d533aca5cb5..7ea898a1e84 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mersenne_twister_engine/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc
index cef616f2312..33f5c0355da 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc
index c101ee912aa..51716b3c92d 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/minstd_rand0.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc b/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc
index a906c1c1e6e..2703ae3e84e 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mt19937.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc b/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc
index cda4546116d..47ef8cfcff3 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/mt19937_64.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc
index db9522712eb..02a7836ef47 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc
index 5e7d928c5bc..3db9c0bd152 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..7320f52240e
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/serialize.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.2.4 Class template negative_binomial_distribution
+// [rand.dist.bern.negbin]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::negative_binomial_distribution<int> u(3, 0.75), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc
index 0fa32bf56a8..5b30fda671c 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc
index b5c047d93f8..fca0cc18818 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc
index 551be3423e2..ea3113dd089 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..c88e0a19b30
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.4.1 Class template normal_distribution [rand.dist.norm.normal]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::normal_distribution<double> u(5.0, 2.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc
index d27c6ede9c7..471379d5527 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/normal_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc
index 0b0ff19e2f0..cdfa3d061e7 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc
index aded49d13da..7ae5d89bed9 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/initlist_fun.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc
index bc0f1923711..a7c7589fe68 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/num_xbound_fun.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc
index 9d5e75c7eec..d0f7dbf53b0 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/cons/range.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..e1136796d6e
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/operators/serialize.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.5.2 Class template piecewise_constant_distribution
+// [rand.dist.samp.pconst]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::vector<double> x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
+ std::vector<double> wt = {0.5, 1.0, 2.5, 1.5, 0.5};
+ std::piecewise_constant_distribution<double>
+ u(x.begin(), x.end(), wt.begin()), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc
index 150e7fe20f2..c0d458ef6a1 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_constant_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc
index 8de114fab29..d2db1765a3c 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc
index a00e41e4f27..564aeeea249 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/initlist_fun.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc
index f9025183b44..e4eb0e8fe2d 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/num_xbound_fun.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc
index 8038c33a9eb..56be0ad9bcd 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/cons/range.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..75ea5a7005f
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/operators/serialize.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.5.3 Class template piecewise_linear_distribution
+// [rand.dist.samp.plinear]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::vector<double> x = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0};
+ std::vector<double> wt = {0.0, 1.0, 2.5, 1.5, 0.5, 0.0};
+ std::piecewise_linear_distribution<double>
+ u(x.begin(), x.end(), wt.begin()), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc
index c71144341e7..cb1d016dce2 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/piecewise_linear_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-03 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc
index f8eb958aced..df396c4c04b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc
index 2aecbff80ce..728587bd2dc 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..315e309dbe7
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.1 Class template poisson_distribution [rand.dist.pois.poisson]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::poisson_distribution<int> u(5.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc
index 40506888d9a..d6a600293da 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc
index 3b502b8800a..2e21ab6a9cb 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc
index db64e85d2c4..638134cf440 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/cons/token.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc
index 3fb4ae7156e..47a76b613cd 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/random_device/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc
index ab37bc51f85..f7352146d97 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux24.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc
index a6bb790d144..65cf97560ff 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux24_base.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc
index a0856b19ecb..095242c1c48 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux48.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc b/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc
index 21522041d91..42c423c7363 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/ranlux48_base.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-18 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc
index 43bfd919281..c68c1b446a3 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc
index 904c075c4d9..d98b6b2c45b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/initlist.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2009-02-13 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc
index 9fc46e18184..69740c8882e 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/range.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc
index 694048cbf3b..6c92fa8094f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-05 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc
index 5fb58ae463a..c0087721079 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_copy.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc
index a04e119e8fa..caac982e53f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/base_move.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc
index 021e8eaaec5..5d96933ef9f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc
index 0fb92c54279..f6827009c7d 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc
index 69adcb06f53..44ba08896c0 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc
index 1f1b1e4e23d..b88d7ebb6b7 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/cons/seed_seq.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-12-07 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc
index 21a36f1a359..57763e851a3 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/equal.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc
index 5fc25797d7a..578e4959371 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/operators/serialize.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc
index 010f7ca069c..e2ec4ce1401 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/shuffle_order_engine/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc
index bf62bc7afcb..a875523d98f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc
index b57b58d0ed0..19ea7bacdf8 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..d4144702a02
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.4.6 Class template student_t_distribution [rand.dist.norm.t]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::student_t_distribution<double> u(1.5), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc
index bdb211e1c1c..e090b354200 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/student_t_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc
index 44dbdc1ab71..4311439b6e6 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc
index 1528166c2ba..078392ccbd0 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed1.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc
index be251baa7f7..d8618706092 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/cons/seed2.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc
index bd6f7c8d2cb..53fdbbefd8a 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/equal.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc
index c701bd7b74d..e4129fc8df5 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/operators/serialize.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc
index 24dff43bbf5..5e56a6e25a4 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/subtract_with_carry_engine/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc
index 0e83565e0de..dae94ccea0f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc
index 47c6fdb07fd..70b40b0ade6 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms_neg.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms_neg.cc
index c566c03b181..e462d686298 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/cons/parms_neg.cc
@@ -20,6 +20,7 @@
// { dg-do run { xfail *-*-* } }
// { dg-options "-std=c++0x -D_GLIBCXX_DEBUG" }
+// { dg-require-cstdint "" }
// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..6ae080957f3
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.1.1 Class template uniform_int_distribution [rand.dist_uni]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::uniform_int_distribution<int> u(1, 20), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc
index c403ff6f131..3d584b525c5 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_int_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc
index 57fedeb666a..8240736c753 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc
index d52c664c339..ff1494b7318 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms_neg.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms_neg.cc
index bd2b88df63e..a5c76d6ec7a 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms_neg.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/cons/parms_neg.cc
@@ -20,6 +20,7 @@
// { dg-do run { xfail *-*-* } }
// { dg-options "-std=c++0x -D_GLIBCXX_DEBUG" }
+// { dg-require-cstdint "" }
// 26.4.8.1.1 Class template uniform_real_distribution [rand.dist_uni]
// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..a6ef0f49040
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.1.2 Class template uniform_real_distribution [rand.dist.uni.real]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::uniform_real_distribution<double> u(-5.0, 5.0), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc
index 5e4d5d3a43c..c14182f7230 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/uniform_real_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc
index 49442fe3376..1377c20e37f 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/default.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc
index 480a311f14c..91eca51e53d 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/cons/parms.cc
@@ -1,4 +1,5 @@
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc
new file mode 100644
index 00000000000..7867023641d
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/operators/serialize.cc
@@ -0,0 +1,46 @@
+// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
+//
+// 2009-08-14 Edward M. Smith-Rowland <3dw4rd@verizon.net>
+//
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 26.4.8.3.4 Class template weibull_distribution [rand.dist.pois.weibull]
+// 26.4.2.4 Concept RandomNumberDistribution [rand.concept.dist]
+
+#include <random>
+#include <sstream>
+
+void
+test01()
+{
+ std::stringstream str;
+ std::weibull_distribution<double> u(2.0, 3.5), v;
+ std::minstd_rand0 rng;
+
+ u(rng); // advance
+ str << u;
+
+ str >> v;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc
index 1920ad324a1..5c8d8e0769b 100644
--- a/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/26_numerics/random/weibull_distribution/requirements/typedefs.cc
@@ -1,5 +1,6 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
+// { dg-require-cstdint "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
//
diff --git a/libstdc++-v3/testsuite/27_io/rvalue_streams.cc b/libstdc++-v3/testsuite/27_io/rvalue_streams.cc
new file mode 100644
index 00000000000..245633a8fca
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/rvalue_streams.cc
@@ -0,0 +1,42 @@
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-do run }
+
+#include <sstream>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ int i = 1742;
+ // This usage isn't supported by the current draft.
+ // std::string result = (std::ostringstream() << i).str();
+ std::ostringstream() << i;
+ std::string result ("1742");
+ int i2;
+ std::istringstream(result) >> i2;
+ VERIFY (i == i2);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc
index 5f02dea0156..0bad6ba2f32 100644
--- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/assign_neg.cc
@@ -33,4 +33,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 856 }
+// { dg-error "deleted function" "" { target *-*-* } 862 }
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc
index 6a50d7802aa..655ca8c2f95 100644
--- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/copy_neg.cc
@@ -32,4 +32,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 855 }
+// { dg-error "deleted function" "" { target *-*-* } 861 }
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/typedefs.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/typedefs.cc
new file mode 100644
index 00000000000..fc8b7a021f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/requirements/typedefs.cc
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <future>
+
+void test01()
+{
+ // Check for required typedefs
+ typedef std::packaged_task<int()> test_type;
+ typedef test_type::result_type result_type;
+}
diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc
index cebe5f981d8..f2fbf178c36 100644
--- a/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/promise/cons/assign_neg.cc
@@ -33,4 +33,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 32 }
-// { dg-error "deleted function" "" { target *-*-* } 582 }
+// { dg-error "deleted function" "" { target *-*-* } 588 }
diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc
index cbcdcfb6d25..17757aed0ad 100644
--- a/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/promise/cons/copy_neg.cc
@@ -32,4 +32,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 566 }
+// { dg-error "deleted function" "" { target *-*-* } 572 }
diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/shared_future/cons/assign_neg.cc
index 3b446d06de5..868e0b8a4b8 100644
--- a/libstdc++-v3/testsuite/30_threads/shared_future/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/shared_future/cons/assign_neg.cc
@@ -35,4 +35,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 34 }
-// { dg-error "deleted function" "" { target *-*-* } 475 }
+// { dg-error "deleted function" "" { target *-*-* } 481 }
diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/cons/copy.cc b/libstdc++-v3/testsuite/30_threads/shared_future/cons/copy.cc
index 16954a1d4c1..b1940fae3c7 100644
--- a/libstdc++-v3/testsuite/30_threads/shared_future/cons/copy.cc
+++ b/libstdc++-v3/testsuite/30_threads/shared_future/cons/copy.cc
@@ -25,7 +25,7 @@
#include <future>
#include <testsuite_hooks.h>
-extern std::unique_future<int>& get();
+extern std::unique_future<int>&& get();
void test01()
{
diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
index 7857e53bac7..1ea66ec9c81 100644
--- a/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/thread/cons/assign_neg.cc
@@ -32,4 +32,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 31 }
-// { dg-error "deleted function" "" { target *-*-* } 141 }
+// { dg-error "deleted function" "" { target *-*-* } 144 }
diff --git a/libstdc++-v3/testsuite/30_threads/unique_future/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/unique_future/cons/assign_neg.cc
index 928ee0a48e9..f8f5a690cf4 100644
--- a/libstdc++-v3/testsuite/30_threads/unique_future/cons/assign_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/unique_future/cons/assign_neg.cc
@@ -35,4 +35,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 34 }
-// { dg-error "deleted function" "" { target *-*-* } 395 }
+// { dg-error "deleted function" "" { target *-*-* } 401 }
diff --git a/libstdc++-v3/testsuite/30_threads/unique_future/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/unique_future/cons/copy_neg.cc
index 5153636e9ba..95b5a1d7d9a 100644
--- a/libstdc++-v3/testsuite/30_threads/unique_future/cons/copy_neg.cc
+++ b/libstdc++-v3/testsuite/30_threads/unique_future/cons/copy_neg.cc
@@ -34,4 +34,4 @@ void test01()
}
// { dg-error "used here" "" { target *-*-* } 33 }
-// { dg-error "deleted function" "" { target *-*-* } 394 }
+// { dg-error "deleted function" "" { target *-*-* } 400 }
diff --git a/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc b/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc
index e39c32129a4..bab32fa0049 100644
--- a/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc
+++ b/libstdc++-v3/testsuite/ext/ext_pointer/1_neg.cc
@@ -91,13 +91,13 @@ void test01(void) {
aptr5 = __const_pointer_cast<B_pointer>(cbptr); // ok
}
-// { dg-error "invalid conversion " "" { target *-*-* } 294 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 294 }
-// { dg-error "invalid conversion " "" { target *-*-* } 300 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 300 }
-// { dg-error "invalid conversion " "" { target *-*-* } 317 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 317 }
-// { dg-error "invalid conversion " "" { target *-*-* } 325 }
-// { dg-error "initializing argument 1 of" "" { target *-*-* } 325 }
+// { dg-error "invalid conversion " "" { target *-*-* } 314 }
+// { dg-error "initializing argument 1 of" "" { target *-*-* } 314 }
+// { dg-error "invalid conversion " "" { target *-*-* } 308 }
+// { dg-error "initializing argument 1 of" "" { target *-*-* } 308 }
+// { dg-error "invalid conversion " "" { target *-*-* } 331 }
+// { dg-error "initializing argument 1 of" "" { target *-*-* } 331 }
+// { dg-error "invalid conversion " "" { target *-*-* } 339 }
+// { dg-error "initializing argument 1 of" "" { target *-*-* } 339 }
// { dg-excess-errors "In constructor" }
diff --git a/libstdc++-v3/testsuite/util/replacement_memory_operators.h b/libstdc++-v3/testsuite/util/replacement_memory_operators.h
index 91c8fa3d38a..c7b19edc457 100644
--- a/libstdc++-v3/testsuite/util/replacement_memory_operators.h
+++ b/libstdc++-v3/testsuite/util/replacement_memory_operators.h
@@ -17,6 +17,9 @@
// <http://www.gnu.org/licenses/>.
#include <exception>
+#include <stdexcept>
+#include <cstdlib>
+#include <cstdio>
namespace __gnu_test
{
@@ -24,7 +27,7 @@ namespace __gnu_test
struct counter
{
- size_t _M_count;
+ std::size_t _M_count;
bool _M_throw;
counter() : _M_count(0), _M_throw(true) { }
@@ -48,7 +51,7 @@ namespace __gnu_test
return g;
}
- static size_t
+ static std::size_t
count() { return get()._M_count; }
static void
@@ -85,7 +88,7 @@ namespace __gnu_test
void* operator new(std::size_t size) throw(std::bad_alloc)
{
- printf("operator new is called \n");
+ std::printf("operator new is called \n");
void* p = std::malloc(size);
if (p == NULL)
throw std::bad_alloc();
@@ -95,7 +98,7 @@ void* operator new(std::size_t size) throw(std::bad_alloc)
void operator delete(void* p) throw()
{
- printf("operator delete is called \n");
+ std::printf("operator delete is called \n");
if (p != NULL)
{
std::free(p);
@@ -103,8 +106,8 @@ void operator delete(void* p) throw()
std::size_t count = __gnu_test::counter::count();
if (count == 0)
- printf("All memory released \n");
+ std::printf("All memory released \n");
else
- printf("%lu allocations to be released \n", count);
+ std::printf("%lu allocations to be released \n", count);
}
}
diff --git a/zlib/ChangeLog.gcj b/zlib/ChangeLog.gcj
index eee68cdf60b..2570352b14b 100644
--- a/zlib/ChangeLog.gcj
+++ b/zlib/ChangeLog.gcj
@@ -1,3 +1,7 @@
+2009-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force.
+
2009-03-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* configure: Regenerate.
diff --git a/zlib/configure.ac b/zlib/configure.ac
index c85f4d50c81..febe9e39b76 100644
--- a/zlib/configure.ac
+++ b/zlib/configure.ac
@@ -54,7 +54,7 @@ GCC_NO_EXECUTABLES
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
m4_define([_AC_ARG_VAR_PRECIOUS],[])
AC_PROG_CC
-m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
AC_SUBST(CFLAGS)