aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-15 19:29:41 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-15 19:29:41 +0000
commit25a25b1169542b69e47e1913936dce4c03489348 (patch)
treead8a3bfd99b87a0414e6dc750a3ec43f8f62b650
parent9e98f740742868f972ace11b5478fa21d70129eb (diff)
Merged revisions 202423,202428-202429,202431,202434,202441-202442,202444-202448,202451-202468,202470-202473,202475,202480-202482,202486-202487,202489-202494,202496,202506,202510-202511,202514-202540,202542-202545,202549,202553-202558,202560-202564,202566-202567,202570-202574,202576,202578-202579,202582,202586-202594,202599-202601,202603-202605,202608-202615,202619,202621,202623-202628,202630-202631,202633-202638,202641-202652,202654-202655,202657-202664,202666-202667,202669-202670,202675-202676,202678-202679,202681-202684,202688,202690,202693-202694,202696,202699-202704,202706,202711,202713-202717,202719,202721-202723,202725-202726,202731-202732,202737-202738,202740-202742,202747-202748,202751,202763-202764,202766,202773-202776,202778,202780-202784,202788-202791,202796-202798,202801,202803,202807,202811,202813-202814,202817-202819,202822-202826,202831-202833,202836-202837,202839,202843,202847-202851,202854,202858-202861,202863,202865-202866,202869,202872-202873,202875-202876,202879,202881,202883,202886-202889,202892-202915,202918,202921-202924,202931,202933,202938,202940-202949,202951,202954,202958,202964,202966-202967,202969-202970,202972,202974-202977,202980-202982,202984,202986,202991-202993,202995,203002-203006,203008,203011-203020,203023-203028,203031,203035,203038,203040-203042,203044,203046-203047,203051-203052 via svnmerge from google/integration
svn+ssh://gcc.gnu.org/svn/gcc/trunk git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/google/integration@203631 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog15
-rw-r--r--MAINTAINERS9
-rw-r--r--boehm-gc/ChangeLog6
-rwxr-xr-xboehm-gc/configure16
-rw-r--r--config/ChangeLog6
-rw-r--r--config/mh-darwin17
-rw-r--r--contrib/ChangeLog8
-rw-r--r--contrib/config-list.mk1
-rw-r--r--contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail5
-rw-r--r--contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail17
-rw-r--r--fixincludes/ChangeLog4
-rw-r--r--gcc/ChangeLog2464
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in1713
-rw-r--r--gcc/aclocal.m412
-rw-r--r--gcc/ada/ChangeLog390
-rw-r--r--gcc/ada/adaint.c7
-rw-r--r--gcc/ada/aspects.adb75
-rw-r--r--gcc/ada/aspects.ads243
-rw-r--r--gcc/ada/atree.ads9
-rw-r--r--gcc/ada/einfo.adb65
-rw-r--r--gcc/ada/einfo.ads32
-rw-r--r--gcc/ada/err_vars.ads1
-rw-r--r--gcc/ada/errout.adb30
-rw-r--r--gcc/ada/errout.ads23
-rw-r--r--gcc/ada/exp_ch4.adb129
-rw-r--r--gcc/ada/exp_ch9.adb175
-rw-r--r--gcc/ada/exp_prag.adb9
-rw-r--r--gcc/ada/freeze.adb26
-rw-r--r--gcc/ada/g-table.adb107
-rw-r--r--gcc/ada/g-table.ads23
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in275
-rw-r--r--gcc/ada/gcc-interface/Makefile.in156
-rw-r--r--gcc/ada/gcc-interface/decl.c6
-rw-r--r--gcc/ada/gcc-interface/trans.c154
-rw-r--r--gcc/ada/gnat1drv.adb21
-rw-r--r--gcc/ada/gnat_ugn.texi26
-rw-r--r--gcc/ada/gnatbind.adb2
-rw-r--r--gcc/ada/gnatdll.adb18
-rw-r--r--gcc/ada/gnatkr.adb28
-rw-r--r--gcc/ada/gnatlink.adb2
-rw-r--r--gcc/ada/gnatls.adb2
-rw-r--r--gcc/ada/inline.ads15
-rw-r--r--gcc/ada/make.adb2
-rw-r--r--gcc/ada/opt.adb5
-rw-r--r--gcc/ada/opt.ads10
-rw-r--r--gcc/ada/par-ch11.adb6
-rw-r--r--gcc/ada/par-ch12.adb24
-rw-r--r--gcc/ada/par-ch13.adb26
-rw-r--r--gcc/ada/par-ch3.adb30
-rw-r--r--gcc/ada/par-ch4.adb38
-rw-r--r--gcc/ada/par-ch5.adb5
-rw-r--r--gcc/ada/par-ch6.adb38
-rw-r--r--gcc/ada/par-ch7.adb42
-rw-r--r--gcc/ada/par-ch8.adb9
-rw-r--r--gcc/ada/par-ch9.adb72
-rw-r--r--gcc/ada/par-prag.adb4
-rw-r--r--gcc/ada/prj.adb1
-rw-r--r--gcc/ada/rtsfind.ads31
-rw-r--r--gcc/ada/sem_attr.adb9
-rw-r--r--gcc/ada/sem_ch10.adb13
-rw-r--r--gcc/ada/sem_ch12.adb73
-rw-r--r--gcc/ada/sem_ch13.adb373
-rw-r--r--gcc/ada/sem_ch13.ads8
-rw-r--r--gcc/ada/sem_ch3.adb95
-rw-r--r--gcc/ada/sem_ch4.adb24
-rw-r--r--gcc/ada/sem_ch6.adb18
-rw-r--r--gcc/ada/sem_ch6.ads7
-rw-r--r--gcc/ada/sem_ch7.adb8
-rw-r--r--gcc/ada/sem_ch8.adb3
-rw-r--r--gcc/ada/sem_ch9.adb36
-rw-r--r--gcc/ada/sem_prag.adb311
-rw-r--r--gcc/ada/sem_prag.ads26
-rw-r--r--gcc/ada/sem_res.adb23
-rw-r--r--gcc/ada/sinfo.adb18
-rw-r--r--gcc/ada/sinfo.ads127
-rw-r--r--gcc/ada/sinput.adb14
-rw-r--r--gcc/ada/sprint.adb31
-rw-r--r--gcc/ada/switch-c.adb46
-rw-r--r--gcc/ada/tree_io.ads4
-rw-r--r--gcc/ada/usage.adb5
-rw-r--r--gcc/ada/vms_data.ads15
-rw-r--r--gcc/ada/warnsw.adb204
-rw-r--r--gcc/ada/warnsw.ads62
-rw-r--r--gcc/alias.c224
-rw-r--r--gcc/alias.h4
-rw-r--r--gcc/alloc-pool.c2
-rw-r--r--gcc/asan.c15
-rw-r--r--gcc/auto-inc-dec.c10
-rw-r--r--gcc/basic-block.h14
-rw-r--r--gcc/bb-reorder.c12
-rw-r--r--gcc/bitmap.c4
-rw-r--r--gcc/bitmap.h2
-rw-r--r--gcc/bt-load.c26
-rw-r--r--gcc/builtins.c53
-rw-r--r--gcc/c-family/ChangeLog26
-rw-r--r--gcc/c-family/c-common.c21
-rw-r--r--gcc/c-family/c-target.def10
-rw-r--r--gcc/c-family/c-ubsan.c18
-rw-r--r--gcc/c-family/c.opt10
-rw-r--r--gcc/c/ChangeLog31
-rw-r--r--gcc/c/Make-lang.in61
-rw-r--r--gcc/c/c-decl.c3
-rw-r--r--gcc/c/c-typeck.c10
-rw-r--r--gcc/calls.c7
-rw-r--r--gcc/cfganal.c18
-rw-r--r--gcc/cfgbuild.c2
-rw-r--r--gcc/cfgcleanup.c26
-rw-r--r--gcc/cfgexpand.c23
-rw-r--r--gcc/cfghooks.c4
-rw-r--r--gcc/cfgloop.c6
-rw-r--r--gcc/cfgloop.h2
-rw-r--r--gcc/cfgloopmanip.c4
-rw-r--r--gcc/cfgrtl.c34
-rw-r--r--gcc/cgraph.c32
-rw-r--r--gcc/cgraph.h8
-rw-r--r--gcc/cgraphbuild.c18
-rw-r--r--gcc/cgraphclones.c6
-rw-r--r--gcc/cgraphunit.c75
-rw-r--r--gcc/cif-code.def3
-rw-r--r--gcc/collect2.c34
-rw-r--r--gcc/combine-stack-adj.c4
-rw-r--r--gcc/combine.c28
-rw-r--r--gcc/common.opt36
-rw-r--r--gcc/common/config/i386/i386-common.c1
-rw-r--r--gcc/compare-elim.c31
-rw-r--r--gcc/config.gcc16
-rw-r--r--gcc/config.in6
-rw-r--r--gcc/config/aarch64/aarch64-builtins.c2
-rw-r--r--gcc/config/aarch64/aarch64-generic.md6
-rw-r--r--gcc/config/aarch64/aarch64-simd-builtins.def3
-rw-r--r--gcc/config/aarch64/aarch64-simd.md248
-rw-r--r--gcc/config/aarch64/aarch64.c22
-rw-r--r--gcc/config/aarch64/aarch64.h18
-rw-r--r--gcc/config/aarch64/aarch64.md8
-rw-r--r--gcc/config/aarch64/aarch64.opt4
-rw-r--r--gcc/config/aarch64/arm_neon.h1504
-rw-r--r--gcc/config/aarch64/iterators.md27
-rw-r--r--gcc/config/alpha/alpha.c5
-rw-r--r--gcc/config/arm/arm.c54
-rw-r--r--gcc/config/arm/arm.md26
-rw-r--r--gcc/config/arm/vfp.md29
-rw-r--r--gcc/config/bfin/bfin.c2
-rw-r--r--gcc/config/darwin-protos.h1
-rw-r--r--gcc/config/darwin.c71
-rw-r--r--gcc/config/frv/frv.c10
-rw-r--r--gcc/config/i386/athlon.md186
-rw-r--r--gcc/config/i386/constraints.md8
-rw-r--r--gcc/config/i386/driver-i386.c10
-rw-r--r--gcc/config/i386/i386-c.c6
-rw-r--r--gcc/config/i386/i386.c314
-rw-r--r--gcc/config/i386/i386.h45
-rw-r--r--gcc/config/i386/i386.md289
-rw-r--r--gcc/config/i386/predicates.md9
-rw-r--r--gcc/config/i386/sse.md283
-rw-r--r--gcc/config/i386/t-i38619
-rw-r--r--gcc/config/i386/winnt-cxx.c7
-rw-r--r--gcc/config/i386/winnt.c9
-rw-r--r--gcc/config/i386/x-darwin7
-rw-r--r--gcc/config/i386/x86-tune.def252
-rw-r--r--gcc/config/ia64/ia64.c23
-rw-r--r--gcc/config/ia64/predicates.md10
-rw-r--r--gcc/config/mcore/t-mcore3
-rw-r--r--gcc/config/mmix/mmix.c2
-rw-r--r--gcc/config/msp430/README.txt7
-rw-r--r--gcc/config/msp430/constraints.md72
-rw-r--r--gcc/config/msp430/msp430-c.c36
-rw-r--r--gcc/config/msp430/msp430-modes.def3
-rw-r--r--gcc/config/msp430/msp430-protos.h46
-rw-r--r--gcc/config/msp430/msp430.c2134
-rw-r--r--gcc/config/msp430/msp430.h406
-rw-r--r--gcc/config/msp430/msp430.md1311
-rw-r--r--gcc/config/msp430/msp430.opt26
-rw-r--r--gcc/config/msp430/predicates.md80
-rw-r--r--gcc/config/msp430/t-msp430264
-rw-r--r--gcc/config/pa/pa-linux.h3
-rw-r--r--gcc/config/pa/pa.c12
-rw-r--r--gcc/config/pa/pa.md12
-rw-r--r--gcc/config/rl78/constraints.md131
-rw-r--r--gcc/config/rl78/predicates.md11
-rw-r--r--gcc/config/rl78/rl78-expand.md76
-rw-r--r--gcc/config/rl78/rl78-protos.h4
-rw-r--r--gcc/config/rl78/rl78-real.md226
-rw-r--r--gcc/config/rl78/rl78-virt.md164
-rw-r--r--gcc/config/rl78/rl78.c1563
-rw-r--r--gcc/config/rl78/rl78.h18
-rw-r--r--gcc/config/rl78/rl78.md108
-rw-r--r--gcc/config/rl78/rl78.opt14
-rw-r--r--gcc/config/rl78/t-rl785
-rw-r--r--gcc/config/rs6000/constraints.md52
-rw-r--r--gcc/config/rs6000/darwin.md112
-rw-r--r--gcc/config/rs6000/driver-rs6000.c2
-rw-r--r--gcc/config/rs6000/paired.md4
-rw-r--r--gcc/config/rs6000/rs6000.c329
-rw-r--r--gcc/config/rs6000/rs6000.h7
-rw-r--r--gcc/config/rs6000/rs6000.md74
-rw-r--r--gcc/config/rs6000/rs6000.opt19
-rw-r--r--gcc/config/rs6000/t-rs600018
-rw-r--r--gcc/config/rs6000/x-darwin8
-rw-r--r--gcc/config/rs6000/x-darwin648
-rw-r--r--gcc/config/s390/s390.c6
-rw-r--r--gcc/config/sh/predicates.md2
-rw-r--r--gcc/config/sh/sh.c7
-rw-r--r--gcc/config/sh/sh.md40
-rw-r--r--gcc/config/sparc/sparc.c4
-rw-r--r--gcc/config/sparc/sync.md12
-rw-r--r--gcc/config/sparc/t-rtems4
-rw-r--r--gcc/config/spu/spu.c4
-rw-r--r--gcc/config/t-darwin32
-rw-r--r--gcc/config/t-glibc7
-rw-r--r--gcc/config/t-winnt22
-rw-r--r--gcc/config/tilegx/tilegx.c4
-rw-r--r--gcc/config/tilepro/tilepro.c4
-rw-r--r--gcc/config/vax/constraints.md5
-rw-r--r--gcc/config/vax/vax.c4
-rw-r--r--gcc/config/vax/vax.md4
-rw-r--r--gcc/config/winnt-c.c39
-rw-r--r--gcc/config/x-darwin6
-rwxr-xr-xgcc/configure300
-rw-r--r--gcc/configure.ac26
-rw-r--r--gcc/context.c4
-rw-r--r--gcc/context.h6
-rw-r--r--gcc/coverage.c20
-rw-r--r--gcc/cp/ChangeLog212
-rw-r--r--gcc/cp/Make-lang.in125
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h12
-rw-r--r--gcc/cp/cxx-pretty-print.c2
-rw-r--r--gcc/cp/decl.c34
-rw-r--r--gcc/cp/decl2.c10
-rw-r--r--gcc/cp/error.c6
-rw-r--r--gcc/cp/lambda.c248
-rw-r--r--gcc/cp/parser.c299
-rw-r--r--gcc/cp/parser.h6
-rw-r--r--gcc/cp/pt.c387
-rw-r--r--gcc/cp/semantics.c22
-rw-r--r--gcc/cp/type-utils.h55
-rw-r--r--gcc/cp/typeck.c10
-rw-r--r--gcc/cprop.c15
-rw-r--r--gcc/cse.c27
-rw-r--r--gcc/cselib.c4
-rw-r--r--gcc/dbxout.c16
-rw-r--r--gcc/dce.c8
-rw-r--r--gcc/defaults.h8
-rw-r--r--gcc/df-core.c16
-rw-r--r--gcc/df-problems.c6
-rw-r--r--gcc/df-scan.c14
-rw-r--r--gcc/df.h59
-rw-r--r--gcc/diagnostic.c6
-rw-r--r--gcc/doc/contrib.texi4
-rw-r--r--gcc/doc/extend.texi170
-rw-r--r--gcc/doc/implement-cxx.texi4
-rw-r--r--gcc/doc/install.texi7
-rw-r--r--gcc/doc/invoke.texi122
-rw-r--r--gcc/doc/md.texi65
-rw-r--r--gcc/doc/rtl.texi22
-rw-r--r--gcc/doc/tm.texi14
-rw-r--r--gcc/doc/tm.texi.in12
-rw-r--r--gcc/doc/tree-ssa.texi27
-rw-r--r--gcc/domwalk.c87
-rw-r--r--gcc/domwalk.h68
-rw-r--r--gcc/double-int.c4
-rw-r--r--gcc/dse.c14
-rw-r--r--gcc/dumpfile.c30
-rw-r--r--gcc/dwarf2asm.c2
-rw-r--r--gcc/dwarf2cfi.c10
-rw-r--r--gcc/dwarf2out.c28
-rw-r--r--gcc/emit-rtl.c56
-rw-r--r--gcc/errors.c6
-rw-r--r--gcc/except.c12
-rw-r--r--gcc/expmed.c75
-rw-r--r--gcc/expr.c108
-rw-r--r--gcc/expr.h2
-rw-r--r--gcc/file-find.c2
-rw-r--r--gcc/final.c42
-rw-r--r--gcc/fixed-value.c2
-rw-r--r--gcc/flag-types.h9
-rw-r--r--gcc/fold-const.c100
-rw-r--r--gcc/fortran/ChangeLog84
-rw-r--r--gcc/fortran/Make-lang.in74
-rw-r--r--gcc/fortran/class.c8
-rw-r--r--gcc/fortran/decl.c8
-rw-r--r--gcc/fortran/expr.c9
-rw-r--r--gcc/fortran/interface.c3
-rw-r--r--gcc/fortran/intrinsic.texi2
-rw-r--r--gcc/fortran/primary.c7
-rw-r--r--gcc/fortran/resolve.c115
-rw-r--r--gcc/function.c18
-rw-r--r--gcc/fwprop.c38
-rw-r--r--gcc/gcc-ar.c12
-rw-r--r--gcc/gcc.c30
-rw-r--r--gcc/gcov-io.c17
-rw-r--r--gcc/gcov-io.h2
-rw-r--r--gcc/gcov.c12
-rw-r--r--gcc/gcse.c8
-rw-r--r--gcc/genattr-common.c2
-rw-r--r--gcc/genattr.c6
-rw-r--r--gcc/genattrtab.c12
-rw-r--r--gcc/genautomata.c8
-rw-r--r--gcc/genconfig.c2
-rw-r--r--gcc/genemit.c2
-rw-r--r--gcc/genextract.c8
-rw-r--r--gcc/genflags.c4
-rw-r--r--gcc/gengenrtl.c2
-rw-r--r--gcc/gengtype-state.c46
-rw-r--r--gcc/gengtype.c41
-rw-r--r--gcc/genmodes.c17
-rw-r--r--gcc/genopinit.c4
-rw-r--r--gcc/genoutput.c10
-rw-r--r--gcc/genpeep.c2
-rw-r--r--gcc/genpreds.c10
-rw-r--r--gcc/genrecog.c23
-rw-r--r--gcc/gensupport.c6
-rw-r--r--gcc/ggc-common.c8
-rw-r--r--gcc/ggc-page.c16
-rw-r--r--gcc/gimple-builder.c118
-rw-r--r--gcc/gimple-builder.h34
-rw-r--r--gcc/gimple-fold.c48
-rw-r--r--gcc/gimple-iterator.c2
-rw-r--r--gcc/gimple-low.c11
-rw-r--r--gcc/gimple-pretty-print.c88
-rw-r--r--gcc/gimple-ssa-strength-reduction.c102
-rw-r--r--gcc/gimple-streamer-in.c2
-rw-r--r--gcc/gimple-streamer-out.c2
-rw-r--r--gcc/gimple.c433
-rw-r--r--gcc/gimple.h36
-rw-r--r--gcc/gimplify.c20
-rw-r--r--gcc/go/ChangeLog28
-rw-r--r--gcc/go/Make-lang.in100
-rw-r--r--gcc/go/go-gcc.cc34
-rw-r--r--gcc/go/gofrontend/backend.h16
-rw-r--r--gcc/go/gofrontend/expressions.cc15
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc32
-rw-r--r--gcc/go/gofrontend/gogo.cc23
-rw-r--r--gcc/go/gofrontend/gogo.h10
-rw-r--r--gcc/go/gofrontend/parse.cc15
-rw-r--r--gcc/go/gofrontend/statements.cc14
-rw-r--r--gcc/go/gofrontend/types.cc34
-rw-r--r--gcc/go/gofrontend/types.h20
-rw-r--r--gcc/godump.c2
-rw-r--r--gcc/graphite-blocking.c2
-rw-r--r--gcc/graphite-clast-to-gimple.c15
-rw-r--r--gcc/graphite-dependences.c2
-rw-r--r--gcc/graphite-interchange.c2
-rw-r--r--gcc/graphite-optimize-isl.c219
-rw-r--r--gcc/graphite-poly.c2
-rw-r--r--gcc/graphite-poly.h2
-rw-r--r--gcc/graphite-scop-detection.c2
-rw-r--r--gcc/graphite-sese-to-poly.c114
-rw-r--r--gcc/graphite.c4
-rw-r--r--gcc/haifa-sched.c4
-rw-r--r--gcc/hash-table.c2
-rw-r--r--gcc/hash-table.h30
-rw-r--r--gcc/hwint.c2
-rw-r--r--gcc/hwint.h14
-rw-r--r--gcc/ifcvt.c53
-rw-r--r--gcc/incpath.c6
-rw-r--r--gcc/init-regs.c4
-rw-r--r--gcc/input.h7
-rw-r--r--gcc/intl.c2
-rw-r--r--gcc/intl.h8
-rw-r--r--gcc/ipa-cp.c85
-rw-r--r--gcc/ipa-devirt.c68
-rw-r--r--gcc/ipa-inline-analysis.c37
-rw-r--r--gcc/ipa-inline-transform.c2
-rw-r--r--gcc/ipa-inline.c67
-rw-r--r--gcc/ipa-profile.c34
-rw-r--r--gcc/ipa-prop.c32
-rw-r--r--gcc/ipa-pure-const.c32
-rw-r--r--gcc/ipa-reference.c35
-rw-r--r--gcc/ipa-split.c10
-rw-r--r--gcc/ipa-utils.c6
-rw-r--r--gcc/ipa-utils.h13
-rw-r--r--gcc/ipa.c61
-rw-r--r--gcc/ira-build.c4
-rw-r--r--gcc/ira.c14
-rw-r--r--gcc/java/ChangeLog18
-rw-r--r--gcc/java/Make-lang.in76
-rw-r--r--gcc/jump.c8
-rw-r--r--gcc/loop-doloop.c9
-rw-r--r--gcc/loop-init.c30
-rw-r--r--gcc/loop-invariant.c10
-rw-r--r--gcc/loop-iv.c6
-rw-r--r--gcc/loop-unswitch.c2
-rw-r--r--gcc/lower-subreg.c8
-rw-r--r--gcc/lra-constraints.c79
-rw-r--r--gcc/lra-eliminations.c107
-rw-r--r--gcc/lra-lives.c6
-rw-r--r--gcc/lra.c8
-rw-r--r--gcc/lto-cgraph.c42
-rw-r--r--gcc/lto-section-in.c2
-rw-r--r--gcc/lto-section-out.c2
-rw-r--r--gcc/lto-streamer-in.c4
-rw-r--r--gcc/lto-streamer-out.c50
-rw-r--r--gcc/lto-streamer.c2
-rw-r--r--gcc/lto-wrapper.c6
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/Make-lang.in30
-rw-r--r--gcc/machmode.h16
-rw-r--r--gcc/mcf.c2
-rw-r--r--gcc/mode-switching.c6
-rw-r--r--gcc/modulo-sched.c4
-rw-r--r--gcc/objc/ChangeLog16
-rw-r--r--gcc/objc/Make-lang.in79
-rw-r--r--gcc/objc/objc-next-runtime-abi-01.c33
-rw-r--r--gcc/objc/objc-next-runtime-abi-02.c28
-rw-r--r--gcc/objcp/ChangeLog10
-rw-r--r--gcc/objcp/Make-lang.in128
-rw-r--r--gcc/omp-low.c35
-rw-r--r--gcc/optabs.c32
-rw-r--r--gcc/opts.c40
-rw-r--r--gcc/params.def5
-rw-r--r--gcc/pass_manager.h4
-rw-r--r--gcc/passes.c56
-rw-r--r--gcc/passes.def21
-rw-r--r--gcc/plugin.c19
-rw-r--r--gcc/postreload-gcse.c6
-rw-r--r--gcc/postreload.c4
-rw-r--r--gcc/predict.c20
-rw-r--r--gcc/prefix.c2
-rw-r--r--gcc/pretty-print.c2
-rw-r--r--gcc/print-rtl.c6
-rw-r--r--gcc/print-tree.c4
-rw-r--r--gcc/profile.c15
-rw-r--r--gcc/read-md.c2
-rw-r--r--gcc/real.c2
-rw-r--r--gcc/real.h2
-rw-r--r--gcc/recog.c28
-rw-r--r--gcc/ree.c8
-rw-r--r--gcc/reg-notes.def12
-rw-r--r--gcc/reg-stack.c12
-rw-r--r--gcc/regcprop.c4
-rw-r--r--gcc/reginfo.c9
-rw-r--r--gcc/regmove.c6
-rw-r--r--gcc/regrename.c4
-rw-r--r--gcc/regs.h2
-rw-r--r--gcc/regstat.c2
-rw-r--r--gcc/reload1.c3
-rw-r--r--gcc/reorg.c16
-rw-r--r--gcc/rtl.c2
-rw-r--r--gcc/rtl.def7
-rw-r--r--gcc/rtl.h148
-rw-r--r--gcc/rtlanal.c151
-rw-r--r--gcc/sbitmap.c6
-rw-r--r--gcc/sched-rgn.c8
-rw-r--r--gcc/sched-vis.c5
-rw-r--r--gcc/sdbout.c17
-rw-r--r--gcc/sel-sched-ir.c2
-rw-r--r--gcc/sel-sched.c6
-rw-r--r--gcc/sese.c2
-rw-r--r--gcc/simplify-rtx.c6
-rw-r--r--gcc/sparseset.c2
-rw-r--r--gcc/stack-ptr-mod.c4
-rw-r--r--gcc/statistics.c2
-rw-r--r--gcc/stmt.c21
-rw-r--r--gcc/stor-layout.c46
-rw-r--r--gcc/store-motion.c6
-rw-r--r--gcc/streamer-hooks.h10
-rw-r--r--gcc/symtab.c4
-rw-r--r--gcc/system.h30
-rw-r--r--gcc/target-hooks-macros.h2
-rw-r--r--gcc/targhooks.c29
-rw-r--r--gcc/targhooks.h2
-rw-r--r--gcc/testsuite/ChangeLog440
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr58551.c33
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/attrib-1.c33
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c8
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr58443-1.c11
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr58443-2.c11
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr58443-3.c18
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/shift-4.c14
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/shift-5.c33
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/shift-6.c30
-rw-r--r--gcc/testsuite/g++.dg/abi/main.C24
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-38.C41
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto9.C4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic2.C57
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/pr58500.C8
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C36
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr58371.C204
-rw-r--r--gcc/testsuite/g++.dg/parse/using4.C20
-rw-r--r--gcc/testsuite/g++.dg/pr58389.C54
-rw-r--r--gcc/testsuite/g++.dg/pr58438.C45
-rw-r--r--gcc/testsuite/g++.dg/template/cond2.C2
-rw-r--r--gcc/testsuite/g++.dg/template/inherit9.C15
-rw-r--r--gcc/testsuite/g++.dg/template/pseudodtor2.C2
-rw-r--r--gcc/testsuite/g++.dg/template/pseudodtor3.C10
-rw-r--r--gcc/testsuite/g++.dg/tm/pr58516.C7
-rw-r--r--gcc/testsuite/g++.dg/torture/pr58380.C173
-rw-r--r--gcc/testsuite/g++.dg/torture/pr58464.C268
-rw-r--r--gcc/testsuite/g++.dg/torture/pr58552.C29
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr58404.C20
-rw-r--r--gcc/testsuite/g++.dg/ubsan/div-by-zero-1.C2
-rw-r--r--gcc/testsuite/g++.dg/uninit-pred-4.C16
-rw-r--r--gcc/testsuite/g++.dg/vect/pr58513.cc13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr58088.c5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr58332.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr58343.c15
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr58365.c35
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr58385.c21
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr58387.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr58419.c36
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr58431.c33
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr58564.c14
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c36
-rw-r--r--gcc/testsuite/gcc.dg/pr58432.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr58463.c15
-rw-r--r--gcc/testsuite/gcc.dg/torture/memcpy-1.c22
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57748-1.c49
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr57748-2.c43
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr58417.c25
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr58539.c20
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr58554.c20
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/coalesce-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-22.c32
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c34
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-31.c47
-rw-r--r--gcc/testsuite/gcc.dg/ubsan/c-shift-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c73
-rw-r--r--gcc/testsuite/gcc.misc-tests/help.exp4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/fmla_intrinsic_1.c116
-rw-r--r--gcc/testsuite/gcc.target/aarch64/fmls_intrinsic_1.c117
-rw-r--r--gcc/testsuite/gcc.target/aarch64/fmul_intrinsic_1.c116
-rw-r--r--gcc/testsuite/gcc.target/aarch64/mla_intrinsic_1.c84
-rw-r--r--gcc/testsuite/gcc.target/aarch64/mls_intrinsic_1.c89
-rw-r--r--gcc/testsuite/gcc.target/aarch64/mul_intrinsic_1.c83
-rw-r--r--gcc/testsuite/gcc.target/arc/barrel-shifter-1.c10
-rw-r--r--gcc/testsuite/gcc.target/arc/barrel-shifter-2.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/long-calls.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mA6.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mA7.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mARC600.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mARC601.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mARC700.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mcpu-arc600.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mcpu-arc601.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mcpu-arc700.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mcrc.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mdpfp.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mdsp-packa.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mdvbf.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mlock.c12
-rw-r--r--gcc/testsuite/gcc.target/arc/mmac-24.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mmac-d16.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-crc.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-dsp-packa.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-dvbf.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-lock.c14
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-mac-24.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-mac-d16.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-rtsc.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-swape.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mno-xy.c10
-rw-r--r--gcc/testsuite/gcc.target/arc/mrtsc.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mspfp.c11
-rw-r--r--gcc/testsuite/gcc.target/arc/mswape.c9
-rw-r--r--gcc/testsuite/gcc.target/arc/mtune-ARC600.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mtune-ARC601.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mtune-ARC700-xmac4
-rw-r--r--gcc/testsuite/gcc.target/arc/mtune-ARC700.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mtune-ARC725D.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mtune-ARC750D.c4
-rw-r--r--gcc/testsuite/gcc.target/arc/mul64.c13
-rw-r--r--gcc/testsuite/gcc.target/arc/mxy.c8
-rw-r--r--gcc/testsuite/gcc.target/arc/no-dpfp-lrsr.c11
-rw-r--r--gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire.c2
-rw-r--r--gcc/testsuite/gcc.target/arm/minmax_minus.c1
-rw-r--r--gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr57848.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr58418.c32
-rw-r--r--gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c42
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr58330.c11
-rw-r--r--gcc/testsuite/gcc.target/sh/torture/pr58314.c102
-rw-r--r--gcc/testsuite/gcc.target/sh/torture/pr58475.c15
-rw-r--r--gcc/testsuite/gcc.target/vax/pr56875.c13
-rw-r--r--gcc/testsuite/gcc.target/vax/vax.exp41
-rw-r--r--gcc/testsuite/gfortran.dg/class_39.f032
-rw-r--r--gcc/testsuite/gfortran.dg/class_5.f033
-rw-r--r--gcc/testsuite/gfortran.dg/class_53.f902
-rw-r--r--gcc/testsuite/gfortran.dg/defined_assignment_10.f9035
-rw-r--r--gcc/testsuite/gfortran.dg/defined_assignment_11.f9043
-rw-r--r--gcc/testsuite/gfortran.dg/defined_assignment_8.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/defined_assignment_9.f9045
-rw-r--r--gcc/testsuite/gfortran.dg/extends_15.f9016
-rw-r--r--gcc/testsuite/gfortran.dg/finalize_19.f9021
-rw-r--r--gcc/testsuite/gfortran.dg/finalize_21.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/pr58484.f15
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_43.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_20.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_21.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_22.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/round_4.f9063
-rw-r--r--gcc/testsuite/gnat.dg/array_bounds_test2.adb25
-rw-r--r--gcc/testsuite/gnat.dg/in_out_parameter4.adb30
-rw-r--r--gcc/testsuite/gnat.dg/opt27.adb29
-rw-r--r--gcc/testsuite/gnat.dg/opt27_pkg.adb32
-rw-r--r--gcc/testsuite/gnat.dg/opt27_pkg.ads33
-rw-r--r--gcc/testsuite/gnat.dg/opt28.adb31
-rw-r--r--gcc/testsuite/gnat.dg/opt28.ads8
-rw-r--r--gcc/testsuite/gnat.dg/opt28_pkg.ads11
-rw-r--r--gcc/testsuite/lib/target-supports.exp31
-rw-r--r--gcc/toplev.c18
-rw-r--r--gcc/tracer.c6
-rw-r--r--gcc/trans-mem.c52
-rw-r--r--gcc/tree-browser.c2
-rw-r--r--gcc/tree-call-cdce.c6
-rw-r--r--gcc/tree-cfg.c83
-rw-r--r--gcc/tree-cfgcleanup.c8
-rw-r--r--gcc/tree-chrec.c18
-rw-r--r--gcc/tree-chrec.h17
-rw-r--r--gcc/tree-complex.c12
-rw-r--r--gcc/tree-core.h30
-rw-r--r--gcc/tree-data-ref.c453
-rw-r--r--gcc/tree-data-ref.h109
-rw-r--r--gcc/tree-dfa.c2
-rw-r--r--gcc/tree-eh.c26
-rw-r--r--gcc/tree-emutls.c8
-rw-r--r--gcc/tree-flow-inline.h64
-rw-r--r--gcc/tree-flow.h117
-rw-r--r--gcc/tree-if-conv.c10
-rw-r--r--gcc/tree-inline.c136
-rw-r--r--gcc/tree-inline.h4
-rw-r--r--gcc/tree-into-ssa.c171
-rw-r--r--gcc/tree-iterator.c2
-rw-r--r--gcc/tree-loop-distribution.c1229
-rw-r--r--gcc/tree-mudflap.c10
-rw-r--r--gcc/tree-nested.c4
-rw-r--r--gcc/tree-nomudflap.c8
-rw-r--r--gcc/tree-nrv.c10
-rw-r--r--gcc/tree-object-size.c11
-rw-r--r--gcc/tree-optimize.c12
-rw-r--r--gcc/tree-outof-ssa.c59
-rw-r--r--gcc/tree-outof-ssa.h (renamed from gcc/ssaexpand.h)9
-rw-r--r--gcc/tree-parloops.c2
-rw-r--r--gcc/tree-pass.h57
-rw-r--r--gcc/tree-phinodes.c2
-rw-r--r--gcc/tree-predcom.c2
-rw-r--r--gcc/tree-pretty-print.c56
-rw-r--r--gcc/tree-pretty-print.h2
-rw-r--r--gcc/tree-profile.c8
-rw-r--r--gcc/tree-scalar-evolution.c253
-rw-r--r--gcc/tree-sra.c20
-rw-r--r--gcc/tree-ssa-address.c2
-rw-r--r--gcc/tree-ssa-alias.c3
-rw-r--r--gcc/tree-ssa-alias.h1
-rw-r--r--gcc/tree-ssa-ccp.c17
-rw-r--r--gcc/tree-ssa-coalesce.c15
-rw-r--r--gcc/tree-ssa-copy.c26
-rw-r--r--gcc/tree-ssa-copyrename.c8
-rw-r--r--gcc/tree-ssa-dce.c20
-rw-r--r--gcc/tree-ssa-dom.c206
-rw-r--r--gcc/tree-ssa-dse.c41
-rw-r--r--gcc/tree-ssa-forwprop.c92
-rw-r--r--gcc/tree-ssa-ifcombine.c6
-rw-r--r--gcc/tree-ssa-live.c11
-rw-r--r--gcc/tree-ssa-live.h6
-rw-r--r--gcc/tree-ssa-loop-ch.c6
-rw-r--r--gcc/tree-ssa-loop-im.c86
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c2
-rw-r--r--gcc/tree-ssa-loop-ivopts.c4
-rw-r--r--gcc/tree-ssa-loop-manip.c2
-rw-r--r--gcc/tree-ssa-loop-niter.c2
-rw-r--r--gcc/tree-ssa-loop-prefetch.c6
-rw-r--r--gcc/tree-ssa-loop-unswitch.c2
-rw-r--r--gcc/tree-ssa-loop.c86
-rw-r--r--gcc/tree-ssa-math-opts.c20
-rw-r--r--gcc/tree-ssa-operands.c8
-rw-r--r--gcc/tree-ssa-phiopt.c60
-rw-r--r--gcc/tree-ssa-phiprop.c6
-rw-r--r--gcc/tree-ssa-pre.c164
-rw-r--r--gcc/tree-ssa-propagate.c2
-rw-r--r--gcc/tree-ssa-reassoc.c10
-rw-r--r--gcc/tree-ssa-sccvn.c2
-rw-r--r--gcc/tree-ssa-sink.c6
-rw-r--r--gcc/tree-ssa-strlen.c43
-rw-r--r--gcc/tree-ssa-structalias.c22
-rw-r--r--gcc/tree-ssa-tail-merge.c2
-rw-r--r--gcc/tree-ssa-ter.c171
-rw-r--r--gcc/tree-ssa-ter.h52
-rw-r--r--gcc/tree-ssa-threadedge.c114
-rw-r--r--gcc/tree-ssa-threadupdate.c233
-rw-r--r--gcc/tree-ssa-threadupdate.h45
-rw-r--r--gcc/tree-ssa-uncprop.c80
-rw-r--r--gcc/tree-ssa-uninit.c247
-rw-r--r--gcc/tree-ssa.c733
-rw-r--r--gcc/tree-ssa.h87
-rw-r--r--gcc/tree-ssanames.c107
-rw-r--r--gcc/tree-ssanames.h138
-rw-r--r--gcc/tree-stdarg.c6
-rw-r--r--gcc/tree-streamer-in.c2
-rw-r--r--gcc/tree-switch-conversion.c8
-rw-r--r--gcc/tree-tailcall.c12
-rw-r--r--gcc/tree-vect-data-refs.c320
-rw-r--r--gcc/tree-vect-generic.c12
-rw-r--r--gcc/tree-vect-loop-manip.c31
-rw-r--r--gcc/tree-vect-loop.c310
-rw-r--r--gcc/tree-vect-patterns.c29
-rw-r--r--gcc/tree-vect-slp.c74
-rw-r--r--gcc/tree-vect-stmts.c242
-rw-r--r--gcc/tree-vectorizer.c21
-rw-r--r--gcc/tree-vectorizer.h12
-rw-r--r--gcc/tree-vrp.c59
-rw-r--r--gcc/tree.c92
-rw-r--r--gcc/tree.h98
-rw-r--r--gcc/tsan.c12
-rw-r--r--gcc/tsystem.h2
-rw-r--r--gcc/ubsan.c18
-rw-r--r--gcc/value-prof.c10
-rw-r--r--gcc/var-tracking.c8
-rw-r--r--gcc/varasm.c8
-rw-r--r--gcc/varpool.c2
-rw-r--r--gcc/vec.c4
-rw-r--r--gcc/vec.h214
-rw-r--r--gcc/vmsdbgout.c8
-rw-r--r--gcc/vtable-verify.c18
-rw-r--r--gcc/web.c6
-rw-r--r--libatomic/ChangeLog4
-rwxr-xr-xlibatomic/configure16
-rw-r--r--libbacktrace/ChangeLog4
-rwxr-xr-xlibbacktrace/configure16
-rw-r--r--libffi/ChangeLog4
-rwxr-xr-xlibffi/configure16
-rw-r--r--libgcc/ChangeLog33
-rw-r--r--libgcc/config.host3
-rw-r--r--libgcc/config/i386/gthr-win32.c4
-rw-r--r--libgcc/config/i386/gthr-win32.h4
-rw-r--r--libgcc/config/msp430/cmpd.c19
-rw-r--r--libgcc/config/msp430/cmpsi2.S98
-rw-r--r--libgcc/config/msp430/epilogue.S51
-rw-r--r--libgcc/config/msp430/floathidf.c8
-rw-r--r--libgcc/config/msp430/floathisf.c11
-rw-r--r--libgcc/config/msp430/floatunhidf.c12
-rw-r--r--libgcc/config/msp430/floatunhisf.c12
-rw-r--r--libgcc/config/msp430/lib2bitcountHI.c50
-rw-r--r--libgcc/config/msp430/lib2divHI.c43
-rw-r--r--libgcc/config/msp430/lib2divQI.c44
-rw-r--r--libgcc/config/msp430/lib2divSI.c43
-rw-r--r--libgcc/config/msp430/lib2mul.c59
-rw-r--r--libgcc/config/msp430/lib2shift.c113
-rw-r--r--libgcc/config/msp430/mpy.c15
-rw-r--r--libgcc/config/msp430/msp430-divmod.h118
-rw-r--r--libgcc/config/msp430/msp430-mul.h43
-rw-r--r--libgcc/config/msp430/slli.S108
-rw-r--r--libgcc/config/msp430/srai.S106
-rw-r--r--libgcc/config/msp430/srli.S110
-rw-r--r--libgcc/config/msp430/t-msp43048
-rw-r--r--libgcc/config/rl78/cmpsi2.S3
-rw-r--r--libgcc/config/rl78/divmodhi.S337
-rw-r--r--libgcc/config/rl78/divmodqi.S310
-rw-r--r--libgcc/config/rl78/divmodsi.S521
-rw-r--r--libgcc/config/rl78/lib2div.c4
-rw-r--r--libgcc/config/rl78/lib2mul.c15
-rw-r--r--libgcc/config/rl78/lshrsi3.S17
-rw-r--r--libgcc/config/rl78/mulsi3.S77
-rw-r--r--libgcc/config/rl78/signbit.S67
-rw-r--r--libgcc/config/rl78/t-rl784
-rw-r--r--libgcc/config/rl78/trampoline.S4
-rw-r--r--libgcc/config/rl78/vregs.h56
-rw-r--r--libgfortran/ChangeLog4
-rwxr-xr-xlibgfortran/configure12
-rw-r--r--libgo/Makefile.am23
-rw-r--r--libgo/Makefile.in43
-rw-r--r--libgo/go/reflect/all_test.go21
-rw-r--r--libgo/go/reflect/makefunc.go24
-rw-r--r--libgo/go/reflect/makefunc_386.S111
-rw-r--r--libgo/go/reflect/makefunc_amd64.S107
-rw-r--r--libgo/go/reflect/makefunc_dummy.c12
-rw-r--r--libgo/go/reflect/makefuncgo_386.go135
-rw-r--r--libgo/go/reflect/makefuncgo_amd64.go493
-rw-r--r--libgo/go/reflect/value.go83
-rw-r--r--libgomp/ChangeLog14
-rwxr-xr-xlibgomp/configure12
-rw-r--r--libgomp/testsuite/lib/libgomp.exp3
-rw-r--r--libgomp/testsuite/libgomp.c/sections-2.c29
-rw-r--r--libiberty/ChangeLog45
-rw-r--r--libitm/ChangeLog4
-rw-r--r--libitm/configure16
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/classpath/ChangeLog4
-rwxr-xr-xlibjava/classpath/configure24
-rwxr-xr-xlibjava/configure18
-rw-r--r--libjava/libltdl/ChangeLog6
-rw-r--r--libjava/libltdl/acinclude.m412
-rwxr-xr-xlibjava/libltdl/configure32
-rw-r--r--libmudflap/ChangeLog10
-rwxr-xr-xlibmudflap/configure16
-rw-r--r--libmudflap/testsuite/lib/libmudflap.exp2
-rw-r--r--libobjc/ChangeLog4
-rwxr-xr-xlibobjc/configure18
-rw-r--r--libquadmath/ChangeLog4
-rwxr-xr-xlibquadmath/configure16
-rw-r--r--libsanitizer/ChangeLog4
-rwxr-xr-xlibsanitizer/configure16
-rw-r--r--libssp/ChangeLog4
-rwxr-xr-xlibssp/configure19
-rw-r--r--libstdc++-v3/ChangeLog618
-rw-r--r--libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver1
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver3
-rwxr-xr-xlibstdc++-v3/configure32
-rw-r--r--libstdc++-v3/include/Makefile.am2
-rw-r--r--libstdc++-v3/include/Makefile.in2
-rw-r--r--libstdc++-v3/include/bits/allocator.h8
-rw-r--r--libstdc++-v3/include/bits/basic_string.h90
-rw-r--r--libstdc++-v3/include/bits/forward_list.h44
-rw-r--r--libstdc++-v3/include/bits/functexcept.h4
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h42
-rw-r--r--libstdc++-v3/include/bits/list.tcc4
-rw-r--r--libstdc++-v3/include/bits/predefined_ops.h304
-rw-r--r--libstdc++-v3/include/bits/regex.h675
-rw-r--r--libstdc++-v3/include/bits/regex.tcc677
-rw-r--r--libstdc++-v3/include/bits/regex_automaton.h116
-rw-r--r--libstdc++-v3/include/bits/regex_automaton.tcc39
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.h5
-rw-r--r--libstdc++-v3/include/bits/regex_compiler.tcc142
-rw-r--r--libstdc++-v3/include/bits/regex_constants.h450
-rw-r--r--libstdc++-v3/include/bits/regex_error.h1
-rw-r--r--libstdc++-v3/include/bits/regex_executor.h320
-rw-r--r--libstdc++-v3/include/bits/regex_executor.tcc277
-rw-r--r--libstdc++-v3/include/bits/regex_scanner.h9
-rw-r--r--libstdc++-v3/include/bits/regex_scanner.tcc36
-rw-r--r--libstdc++-v3/include/bits/stl_algo.h3198
-rw-r--r--libstdc++-v3/include/bits/stl_algobase.h184
-rw-r--r--libstdc++-v3/include/bits/stl_bvector.h5
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h120
-rw-r--r--libstdc++-v3/include/bits/stl_heap.h232
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h50
-rw-r--r--libstdc++-v3/include/bits/stl_list.h105
-rw-r--r--libstdc++-v3/include/bits/stl_tree.h96
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h43
-rw-r--r--libstdc++-v3/include/debug/array19
-rw-r--r--libstdc++-v3/include/debug/deque22
-rw-r--r--libstdc++-v3/include/debug/list32
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h55
-rw-r--r--libstdc++-v3/include/debug/string21
-rw-r--r--libstdc++-v3/include/debug/vector22
-rw-r--r--libstdc++-v3/include/ext/sso_string_base.h4
-rw-r--r--libstdc++-v3/include/ext/vstring.h50
-rw-r--r--libstdc++-v3/include/parallel/algo.h4
-rw-r--r--libstdc++-v3/include/parallel/algobase.h35
-rw-r--r--libstdc++-v3/include/profile/array19
-rw-r--r--libstdc++-v3/include/profile/deque20
-rw-r--r--libstdc++-v3/include/profile/iterator_tracker.h52
-rw-r--r--libstdc++-v3/include/profile/list28
-rw-r--r--libstdc++-v3/include/profile/vector16
-rw-r--r--libstdc++-v3/include/std/array18
-rw-r--r--libstdc++-v3/include/std/bitset44
-rw-r--r--libstdc++-v3/include/std/functional2
-rw-r--r--libstdc++-v3/src/c++11/Makefile.am1
-rw-r--r--libstdc++-v3/src/c++11/Makefile.in4
-rw-r--r--libstdc++-v3/src/c++11/functexcept.cc23
-rw-r--r--libstdc++-v3/src/c++11/snprintf_lite.cc159
-rw-r--r--libstdc++-v3/testsuite/20_util/exchange/1.cc6
-rw-r--r--libstdc++-v3/testsuite/20_util/function/cons/57465.cc31
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/5.h134
-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/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/24_iterators/normal_iterator/58403.cc (renamed from libstdc++-v3/testsuite/23_containers/list/operations/5.cc)23
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/adjacent_find/vectorbool.cc44
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/find/vectorbool.cc39
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/find_end/vectorbool.cc50
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/find_first_of/vectorbool.cc50
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/find_if/vectorbool.cc39
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/find_if_not/vectorbool.cc40
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/heap/vectorbool.cc146
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/is_permutation/vectorbool.cc50
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc41
-rw-r--r--libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc8
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/53622.cc)5
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc (renamed from libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/57173.cc)7
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc3
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/basic_replace.cc51
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc94
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/flags.cc71
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc71
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc2
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/ctors/basic/raw_string.cc3
-rw-r--r--libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc1
-rw-r--r--libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc21
-rw-r--r--libstdc++-v3/testsuite/28_regex/match_results/format.cc51
-rw-r--r--libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc9
-rw-r--r--libstdc++-v3/testsuite/28_regex/traits/wchar_t/lookup_collatename.cc10
-rw-r--r--libstdc++-v3/testsuite/28_regex/traits/wchar_t/value.cc22
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc41
-rw-r--r--libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc38
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp2
-rw-r--r--libstdc++-v3/testsuite/performance/25_algorithms/search_n.cc2
-rw-r--r--libstdc++-v3/testsuite/performance/25_algorithms/sort.cc65
-rw-r--r--libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc73
-rw-r--r--libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc65
-rw-r--r--libstdc++-v3/testsuite/util/exception/safety.h22
-rw-r--r--libtool.m412
-rw-r--r--libvtv/ChangeLog31
-rw-r--r--libvtv/Makefile.am17
-rw-r--r--libvtv/Makefile.in23
-rwxr-xr-xlibvtv/configure97
-rw-r--r--libvtv/configure.ac35
-rw-r--r--libvtv/configure.tgt2
-rw-r--r--lto-plugin/ChangeLog4
-rwxr-xr-xlto-plugin/configure16
-rw-r--r--zlib/ChangeLog.gcj4
-rwxr-xr-xzlib/configure16
919 files changed, 37718 insertions, 16582 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c74171eb2e..24cc78cc661 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
+ ppc host match. Support little-endian powerpc linux hosts.
+
+2013-09-19 Dodji Seketeli <dodji@redhat.com>
+
+ * MAINTAINERS (diagnostic messages): Add myself as diagnostics
+ maintainer.
+
+2013-09-12 DJ Delorie <dj@redhat.com>
+
+ * MAINTAINERS: Add Nick Clifton and DJ Delorie as msp430
+ maintainers.
+
2013-09-03 Richard Biener <rguenther@suse.de>
* configure.ac: Also allow ISL 0.12.
diff --git a/MAINTAINERS b/MAINTAINERS
index cc89c2ce01d..15b6cc7f674 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -87,6 +87,8 @@ mmix port Hans-Peter Nilsson hp@bitrange.com
mn10300 port Jeff Law law@redhat.com
mn10300 port Alexandre Oliva aoliva@redhat.com
moxie port Anthony Green green@moxielogic.com
+msp430 port DJ Delorie dj@redhat.com
+msp430 port Nick Clifton nickc@redhat.com
nds32 port Chung-Ju Wu jasonwucj@gmail.com
nds32 port Shiva Chen shiva0217@gmail.com
pdp11 port Paul Koning ni1d@arrl.net
@@ -178,7 +180,7 @@ libobjc Nicola Pero nicola.pero@meta-innovation.com
libobjc Andrew Pinski pinskia@gmail.com
libquadmath Tobias Burnus burnus@net-b.de
libquadmath Jakub Jelinek jakub@redhat.com
-libvtv Caroline Tice cmtice@google.com
+libvtv Caroline Tice cmtice@google.com
loop discovery Michael Hayes m.hayes@elec.canterbury.ac.nz
soft-fp Joseph Myers joseph@codesourcery.com
scheduler (+ haifa) Jim Wilson wilson@tuliptree.org
@@ -193,7 +195,6 @@ debugging code Jim Wilson wilson@tuliptree.org
dwarf debugging code Jason Merrill jason@redhat.com
dwarf debugging code Cary Coutant ccoutant@google.com
c++ runtime libs Paolo Carlini paolo.carlini@oracle.com
-c++ runtime libs Gabriel Dos Reis gdr@integrable-solutions.net
c++ runtime libs Ulrich Drepper drepper@gmail.com
c++ runtime libs Benjamin De Kosnik bkoz@gnu.org
c++ runtime libs Loren J. Rittle ljrittle@acm.org
@@ -212,7 +213,7 @@ config.sub/config.guess Ben Elliston config-patches@gnu.org
basic block reordering Jason Eckhardt jle@rice.edu
i18n Philipp Thomas pth@suse.de
i18n Joseph Myers joseph@codesourcery.com
-diagnostic messages Gabriel Dos Reis gdr@integrable-solutions.net
+diagnostic messages Dodji Seketeli dodji@redhat.com
build machinery (*.in) Paolo Bonzini bonzini@gnu.org
build machinery (*.in) DJ Delorie dj@redhat.com
build machinery (*.in) Nathanael Nerode neroden@gcc.gnu.org
@@ -525,7 +526,7 @@ Johannes Singler singler@kit.edu
Franz Sirl franz.sirl-kernel@lauterbach.com
Jan Sjodin jan.sjodin@amd.com
Edward Smith-Rowland 3dw4rd@verizon.net
-Jayant Sonar jayant.sonar@kpitcummins.com
+Jayant Sonar rsonar.jayant@gmail.com
Michael Sokolov msokolov@ivan.Harhan.ORG
Richard Stallman rms@gnu.org
Basile Starynkevitch basile@starynkevitch.net
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index 0cd4dbec4d5..cb097bcce68 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,4 +1,8 @@
-2013-09-04 Matthias Klose <doko@ubuntu.com>
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
+2013-09-04 Matthias Klose <doko@ubuntu.com>
* Makefile.am (libgcjgc_la_LIBADD): Add EXTRA_TEST_LIBS.
* Makefile.in: Regenerate.
diff --git a/boehm-gc/configure b/boehm-gc/configure
index 5ddc20e302f..1518c031d44 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -6770,7 +6770,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6795,7 +6795,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6814,7 +6817,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11327,7 +11333,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11330 "configure"
+#line 11336 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11433,7 +11439,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11436 "configure"
+#line 11442 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/config/ChangeLog b/config/ChangeLog
index ab34cbcc224..e3f6f456695 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-29 Iain Sandoe <iain@codesourcery.com>
+
+ * mh-darwin (BOOT_CFLAGS): Only add -mdynamic-no-pic for m32 hosts.
+ (STAGE1_CFLAGS, STAGE1_LDFLAGS): New.
+ Fix over-length lines and amend comments.
+
2013-08-30 Marek Polacek <polacek@redhat.com>
* bootstrap-ubsan.mk: New.
diff --git a/config/mh-darwin b/config/mh-darwin
index 19bf26568b5..a039f201410 100644
--- a/config/mh-darwin
+++ b/config/mh-darwin
@@ -1,7 +1,18 @@
# The -mdynamic-no-pic ensures that the compiler executable is built without
# position-independent-code -- the usual default on Darwin. This fix speeds
# compiles by 3-5%.
-BOOT_CFLAGS += -mdynamic-no-pic
+BOOT_CFLAGS += \
+`case ${host} in i?86-*-darwin* | powerpc-*-darwin*) \
+ echo -mdynamic-no-pic ;; esac;`
-# Ensure we don't try and use -pie, as it is incompatible with pch.
-BOOT_LDFLAGS += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
+# ld on Darwin versions >= 10.7 defaults to PIE executables. Disable this for
+# gcc components, since it is incompatible with our pch implementation.
+BOOT_LDFLAGS += \
+`case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
+
+# Similarly, for cross-compilation.
+STAGE1_CFLAGS += \
+`case ${host} in i?86-*-darwin* | powerpc-*-darwin*)\
+ echo -mdynamic-no-pic ;; esac;`
+STAGE1_LDFLAGS += \
+`case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index d99dc3417bb..3b2781978ee 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,11 @@
+2013-09-27 Diego Novillo <dnovillo@google.com>
+
+ * testsuite-management/x86_64-unknown-linux-gnu.xfail: Update.
+
+2013-09-12 DJ Delorie <dj@redhat.com>
+
+ * config-list.mk: Add msp430-elf.
+
2013-08-31 Diego Novillo <dnovillo@google.com>
* testsuite-management/x86_64-unknown-linux-gnu.xfail: Update.
diff --git a/contrib/config-list.mk b/contrib/config-list.mk
index 9a141c26be5..85ca6ad13e0 100644
--- a/contrib/config-list.mk
+++ b/contrib/config-list.mk
@@ -44,6 +44,7 @@ LIST = aarch64-elf aarch64-linux-gnu \
mipsel-elf mips64-elf mips64vr-elf mips64orion-elf mips-rtems \
mips-wrs-vxworks mipstx39-elf mmix-knuth-mmixware mn10300-elf moxie-elf \
moxie-uclinux moxie-rtems pdp11-aout picochip-elfOPT-enable-obsolete \
+ msp430-elf \
powerpc-darwin8 \
powerpc-darwin7 powerpc64-darwin powerpc-freebsd6 powerpc-netbsd \
powerpc-eabispe powerpc-eabisimaltivec powerpc-eabisim ppc-elf \
diff --git a/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail b/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail
index 567b5e5cedd..ed5985d535a 100644
--- a/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail
+++ b/contrib/testsuite-management/x86_64-grtev3-linux-gnu.xfail
@@ -56,6 +56,11 @@ FAIL: gcc.dg/tree-ssa/attr-alias.c scan-tree-dump-times optimized " test4 " 1
FAIL: g++.dg/template/cond2.C -std=gnu++98 (test for warnings, line 9)
FAIL: g++.dg/template/cond2.C -std=gnu++11 (test for warnings, line 9)
FAIL: gcc.dg/attr-ifunc-4.c execution test
+FAIL: gcc.dg/tree-ssa/slsr-39.c scan-tree-dump-times slsr "MEM" 4
+FAIL: gcc.dg/tree-ssa/gen-vect-26.c scan-tree-dump-times vect "vectorized 1 loops" 1
+FAIL: gcc.dg/tree-ssa/gen-vect-26.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
+FAIL: gcc.dg/tree-ssa/gen-vect-28.c scan-tree-dump-times vect "vectorized 1 loops" 1
+FAIL: gcc.dg/tree-ssa/gen-vect-28.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
# These failures only occur when testing is distributed. These tests
# have dependencies that are not explicitly handled by the driver script.
diff --git a/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail b/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail
index 32f2b0d04ce..fdb8268550f 100644
--- a/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail
+++ b/contrib/testsuite-management/x86_64-unknown-linux-gnu.xfail
@@ -1,7 +1,6 @@
FAIL: g++.dg/guality/pr55665.C -O2 line 23 p == 40
FAIL: g++.dg/guality/pr55665.C -O3 -fomit-frame-pointer line 23 p == 40
FAIL: g++.dg/guality/pr55665.C -O3 -g line 23 p == 40
-FAIL: gcc.dg/attr-ifunc-4.c execution test
XPASS: gcc.dg/guality/example.c -O0 execution test
XPASS: gcc.dg/guality/example.c -O2 execution test
XPASS: gcc.dg/guality/example.c -O2 -flto -fno-use-linker-plugin -flto-partition=none execution test
@@ -100,23 +99,11 @@ FAIL: gcc.dg/guality/vla-2.c -O2 -flto -fno-use-linker-plugin -flto-partition=no
FAIL: gcc.dg/guality/vla-2.c -O2 -flto -fno-use-linker-plugin -flto-partition=none line 25 sizeof (a) == 6 * sizeof (int)
FAIL: gcc.dg/guality/vla-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 16 sizeof (a) == 5 * sizeof (int)
FAIL: gcc.dg/guality/vla-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects line 25 sizeof (a) == 6 * sizeof (int)
-FAIL: gcc.dg/lto/20090218-1 c_lto_20090218-1_0.o-c_lto_20090218-1_1.o link, -O0 -flto -flto-partition=none -fuse-linker-plugin
-UNRESOLVED: gcc.dg/lto/20090218-1 c_lto_20090218-1_0.o-c_lto_20090218-1_1.o execute -O0 -flto -flto-partition=none -fuse-linker-plugin
-FAIL: gcc.dg/lto/20090218-1 c_lto_20090218-1_0.o-c_lto_20090218-1_1.o link, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin
-UNRESOLVED: gcc.dg/lto/20090218-1 c_lto_20090218-1_0.o-c_lto_20090218-1_1.o execute -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin
-FAIL: gcc.dg/lto/20090218-1 c_lto_20090218-1_0.o-c_lto_20090218-1_1.o link, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects
-UNRESOLVED: gcc.dg/lto/20090218-1 c_lto_20090218-1_0.o-c_lto_20090218-1_1.o execute -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects
-FAIL: gfortran.dg/round_4.f90 -O0 execution test
-FAIL: gfortran.dg/round_4.f90 -O1 execution test
-FAIL: gfortran.dg/round_4.f90 -O2 execution test
-FAIL: gfortran.dg/round_4.f90 -O3 -fomit-frame-pointer execution test
-FAIL: gfortran.dg/round_4.f90 -O3 -fomit-frame-pointer -funroll-loops execution test
-FAIL: gfortran.dg/round_4.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test
-FAIL: gfortran.dg/round_4.f90 -O3 -g execution test
-FAIL: gfortran.dg/round_4.f90 -Os execution test
+FAIL: gcc.dg/tree-ssa/slsr-39.c scan-tree-dump-times slsr "MEM" 4
FAIL: libmudflap.c++/pass41-frag.cxx ( -O) execution test
FAIL: libmudflap.c++/pass41-frag.cxx (-O2) execution test
FAIL: libmudflap.c++/pass41-frag.cxx (-O3) execution test
+FAIL: libmudflap.c++/pass55-frag.cxx (-O3) execution test
FAIL: sourcelocation output - source compiled test
FAIL: sourcelocation -findirect-dispatch output - source compiled test
FAIL: sourcelocation -O3 output - source compiled test
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 4a9d22997ff..d6424db2364 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-09-02 David Edelsohn <dje.gcc@gmail.com>
* inclhack.def (aix_assert): New fix.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 56de596feaa..7c9a6c513ae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,2453 @@
+2013-09-30 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * vec.h (vec_prefix, vec): Prefix member names with "m_".
+ * vec.c (vec_prefix::calculate_allocation): Update accordingly.
+
+2013-09-30 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * basic-block.h (edge_list): Prefix member names with "m_".
+ * context.h (context): Likewise.
+ * domwalk.h (dom_walker): Likewise.
+ * gengtype-state.c (s_expr_writer, state_writer): Likewise.
+ * graphite-sese-to-poly.c (sese_dom_walker): Likewise.
+ * hash-table.h (hash_table): Likewise.
+ * machmode.h (bit_field_mode_iterator): Likewise.
+ * pass_manager.h (pass_list): Likewise.
+ * tree-into-ssa.c (mark_def_dom_walker): Likewise.
+ * tree-pass.h (pass_data): Likewise.
+ * tree-ssa-dom.c (dom_opt_dom_walker): Likewise.
+ * tree-ssa-phiopt.c (nontrapping_dom_walker): Likewise,
+ * tree-ssa-uncprop.c (uncprop_dom_walker): Likewise.
+ * asan.c (pass_data_asan): Update accordingly.
+ * cfganal.c (control_dependences::find_control_dependence): Likewise.
+ (control_dependences::control_dependences): Likewise.
+ (control_dependences::~control_dependences): Likewise.
+ (control_dependences::~control_dependences): Likewise.
+ (control_dependences::get_edges_dependent_on): Likewise.
+ * cgraphbuild.c (pass_data_rebuild_cgraph_edges::clone): Likewise.
+ (pass_data_remove_cgraph_callee_edges::clone): Likewise.
+ * context.c (gcc::context::context): Likewise.
+ * cprop.c (pass_rtl_cprop::clone): Likewise.
+ * domwalk.c (dom_walker::walk): Likewise.
+ * ipa-inline-analysis.c (pass_inline_parameters::clone): Likewise.
+ * ipa-pure-const.c (pass_local_pure_const::clone): Likewise.
+ * mode-switching.c (pass_mode_switching::clone): Likewise.
+ * passes.c (opt_pass::opt_pass): Likewise.
+ (pass_manager::pass_manager): Likewise.
+ * predict.c (pass_strip_predict_hints::clone): Likewise.
+ * recog.c (pass_data pass_data_peephole2::clone): Likewise.
+ (pass_split_all_insns::clone): Likewise.
+ * stor-layout.c (bit_field_mode_iterator::bit_field_mode_iterator):
+ Likewise.
+ (bit_field_mode_iterator::next_mode): Likewise.
+ (bit_field_mode_iterator::prefer_smaller_modes): Likewise.
+ * tree-cfg.c (pass_split_crit_edges::clone): Likewise.
+ * tree-cfgcleanup.c (pass_merge_phi::clone): Likewise.
+ * tree-complex.c (pass_lower_complex::clone): Likewise.
+ * tree-eh.c (pass_cleanup_eh::clone): Likewise.
+ * tree-object-size.c (pass_object_sizes::clone): Likewise.
+ * tree-optimize.c (pass_fixup_cfg::clone): Likewise.
+ * tree-ssa-ccp.c (pass_data_ccp::clone): Likewise.
+ (pass_fold_builtins::clone): Likewise.
+ * tree-ssa-copy.c (pass_data_copy_prop::clone): Likewise.
+ * tree-ssa-copyrename.c (pass_rename_ssa_copies::clone): Likewise.
+ * tree-ssa-dce.c (pass_dce::clone, pass_dce_loop::clone): Likewise.
+ (pass_cd_dce::clone): Likewise.
+ * tree-ssa-dom.c (pass_dominator::clone): Likewise.
+ (pass_phi_only_cprop::clone): Likewise.
+ * tree-ssa-dse.c (pass_dse::clone): Likewise.
+ * tree-ssa-forwprop.c (pass_forwprop::clone): Likewise.
+ * tree-ssa-loop.c (pass_lim::clone): Likewise.
+ * tree-ssa-phiopt.c (pass_phiopt::clone): Likewise.
+ * tree-ssa-pre.c (pass_fre::clone): Likewise.
+ * tree-ssa-reassoc.c (pass_reassoc::clone): Likewise.
+ * tree-ssa-uninit.c (pass_late_warn_uninitialized::clone): Likewise.
+ * tree-tailcall.c (pass_tail_recursion::clone): Likewise.
+ * tree-vect-generic.c (pass_lower_vector_ssa::clone): Likewise.
+ * tree-vrp.c (pass_vrp::clone): Likewise.
+ * tsan.c (pass_tsan::clone): Likewise.
+
+2013-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/58564
+ * fold-const.c (tree_unary_nonnegative_warnv_p): Use
+ INTEGRAL_TYPE_P (t) instead of TREE_CODE (t) == INTEGER_TYPE.
+
+ PR middle-end/58564
+ * fold-const.c (fold_ternary_loc): For A < 0 : <sign bit of A> : 0
+ optimization, punt if sign_bit_p looked through any zero extension.
+
+2013-09-30 Teresa Johnson <tejohnson@google.com>
+
+ * tree-ssa-threadupdate.c (ssa_fix_duplicate_block_edges):
+ Update redirected out edge count in joiner case.
+ (ssa_redirect_edges): Common the joiner and non-joiner cases
+ so that joiner case gets profile updates.
+
+2013-09-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58554
+ * tree-loop-distribution.c (classify_partition): Require unconditionally
+ executed stores for memcpy and memset recognition.
+ (tree_loop_distribution): Calculate dominance info.
+
+2013-09-30 Venkataramanan Kumar <venkataramanan.kumar@linaro.org>
+
+ * config/aarch64/aarch64.h (MCOUNT_NAME): Define.
+ (NO_PROFILE_COUNTERS): Likewise.
+ (PROFILE_HOOK): Likewise.
+ (FUNCTION_PROFILER): Likewise.
+ * config/aarch64/aarch64.c (aarch64_function_profiler): Remove.
+
+2013-09-30 Iain Sandoe <iain@codesourcery.com>
+
+ * config/rs6000/darwin.md (load_macho_picbase_si): Wrap machopic
+ calls and defines in TARGET_MACHO conditional.
+ (load_macho_picbase_di): Likewise.
+ (reload_macho_picbase): Likewise.
+ (reload_macho_picbase_si): Likewise.
+ (reload_macho_picbase_di): Likewise.
+ (nonlocal_goto_receiver): Likewise.
+
+2013-09-30 Nick Clifton <nickc@redhat.com>
+
+ * config/msp430/msp430.c (msp430x_names): New array. Lists MCUs
+ that use the MSP430X ISA.
+ (msp430_option_override): Scan -mmcu command line option for any
+ MCU name that supports the MSP430X ISA.
+ * config/msp430/t-msp430 (MULTILIB_MATCHES): Add matches for known
+ -mmcu options which enable the MSP430X ISA.
+
+2013-09-30 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58532
+ * tree-cfg.c (make_abnormal_goto_edges): Skip debug statements
+ before looking for setjmp-like calls.
+
+2013-09-29 Iain Sandoe <iain@codesourcery.com>
+
+ PR target/10901
+ * config/darwin-protos.h (machopic_get_function_picbase): New.
+ * config/darwin.c (machopic_get_function_picbase): New.
+ * config/rs6000/darwin.md (load_macho_picbase_si): Update picbase
+ label for a new func. (load_macho_picbase_di): Likewise.
+ (reload_macho_picbase): New expand.
+ (reload_macho_picbase_si): New insn.
+ (reload_macho_picbase_di): New insn.
+ (nonlocal_goto_receiver): New define and split.
+ * config/rs6000/rs6000.md (unspec enum): Add UNSPEC_RELD_MPIC.
+ (unspecv enum): Add UNSPECV_NLGR.
+
+2013-09-29 Iain Sandoe <iain@codesourcery.com>
+
+ * config/rs6000/rs6000.c (rs6000_init_dwarf_reg_sizes_extra): Ensure
+ that altivec registers are correctly sized on Darwin.
+
+2013-09-29 Iain Sandoe <iain@codesourcery.com>
+
+ * config/t-darwin (darwin.o, darwin-c.o, darwin-f.o,
+ darwin-driver.o): Use COMPILE and POSTCOMPILE.
+ * config/x-darwin (host-darwin.o): Likewise.
+ * config/i386/x-darwin (host-i386-darwin.o): Likewise.
+ * config/rs6000/x-darwin (host-ppc-darwin.o): Likewise.
+ * config/rs6000/x-darwin64 (host-ppc64-darwin.o): Likewise.
+
+2013-09-29 Uros Bizjak <ubizjak@gmail.com>
+
+ * doc/invoke.texi: Fix usage of @tie{} command.
+
+2013-09-29 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/sparc/sync.md: Add peephole for consecutive memory barriers.
+
+2013-09-28 Jan Hubicka <jh@suse.cz>
+
+ * config/i386/x86-tune.def: Add documentation for each of the options;
+ add whitespace.
+
+2013-09-28 Jan Hubicka <jh@suse.cz>
+
+ * x86-tune.def (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL): Enable for
+ generic.
+ (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL): Likewise.
+ (X86_TUNE_FOUR_JUMP_LIMIT): Drop for generic and buldozer.
+ (X86_TUNE_PAD_RETURNS): Drop for buldozer chips.
+ (X86_TUNE_AVOID_VECTOR_DECODE): Drop for generic.
+ (X86_TUNE_REASSOC_FP_TO_PARALLEL): Enable for generic.
+
+2013-09-28 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c,
+ bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c,
+ cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c,
+ cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c,
+ combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h,
+ cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c,
+ df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c,
+ dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c,
+ errors.c, except.c, expmed.c, expr.c, file-find.c, final.c,
+ fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c,
+ gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c,
+ genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c,
+ genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c,
+ genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c,
+ gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c,
+ gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c,
+ gimple.h, godump.c, graphite-clast-to-gimple.c,
+ graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c,
+ graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c,
+ hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h,
+ ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c,
+ ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c,
+ ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c,
+ loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c,
+ lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c,
+ mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c,
+ pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c,
+ predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c,
+ profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c,
+ regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c,
+ reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c,
+ sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c,
+ statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h,
+ system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c,
+ tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c,
+ tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h,
+ tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c,
+ tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c,
+ tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c,
+ tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c,
+ tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c,
+ tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c,
+ tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c,
+ tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c,
+ tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c,
+ tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c,
+ tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c,
+ tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c,
+ tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
+ tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c,
+ tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c,
+ tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
+ tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c,
+ tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c,
+ varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing
+ whitespace before "(".
+
+2013-09-28 Sandra Loosemore <sandra@codesourcery.com>
+
+ * expr.h (extract_bit_field): Remove packedp parameter.
+ * expmed.c (extract_fixed_bit_field): Remove packedp parameter
+ from forward declaration.
+ (store_split_bit_field): Remove packedp arg from calls to
+ extract_fixed_bit_field.
+ (extract_bit_field_1): Remove packedp parameter and packedp
+ argument from recursive calls and calls to extract_fixed_bit_field.
+ (extract_bit_field): Remove packedp parameter and corresponding
+ arg to extract_bit_field_1.
+ (extract_fixed_bit_field): Remove packedp parameter. Remove code
+ to issue warnings.
+ (extract_split_bit_field): Remove packedp arg from call to
+ extract_fixed_bit_field.
+ * expr.c (emit_group_load_1): Adjust calls to extract_bit_field.
+ (copy_blkmode_from_reg): Likewise.
+ (copy_blkmode_to_reg): Likewise.
+ (read_complex_part): Likewise.
+ (store_field): Likewise.
+ (expand_expr_real_1): Likewise.
+ * calls.c (store_unaligned_arguments_into_pseudos): Adjust call
+ to extract_bit_field.
+ * config/tilegx/tilegx.c (tilegx_expand_unaligned_load): Adjust
+ call to extract_bit_field.
+ * config/tilepro/tilepro.c (tilepro_expand_unaligned_load): Adjust
+ call to extract_bit_field.
+ * doc/invoke.texi (Code Gen Options): Remove mention of warnings
+ and special packedp behavior from -fstrict-volatile-bitfields
+ documentation.
+
+2013-09-27 Jan-Benedict Glaw <jbglaw@lug-owl.de>
+
+ * lra-eliminations.c (init_elim_table): Guard value_p.
+
+2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok): Allow
+ DFmode, DImode, and SFmode in the upper VSX registers based on the
+ -mupper-regs-{df,sf} flags. Fix wu constraint to be ALTIVEC_REGS
+ if -mpower8-vector. Combine -mvsx-timode handling with the rest
+ of the VSX register handling.
+
+ * config/rs6000/rs6000.md (f32_lv): Use %x0 for VSX regsters.
+ (f32_sv): Likewise.
+ (zero_extendsidi2_lfiwzx): Add support for loading into the
+ Altivec registers with -mpower8-vector. Use wu/wv constraints to
+ only do VSX memory options on Altivec registers.
+ (extendsidi2_lfiwax): Likewise.
+ (extendsfdf2_fpr): Likewise.
+ (mov<mode>_hardfloat, SF/SD modes): Likewise.
+ (mov<mode>_hardfloat32, DF/DD modes): Likewise.
+ (mov<mode>_hardfloat64, DF/DD modes): Likewise.
+ (movdi_internal64): Likewise.
+
+2013-09-27 Xinliang David Li <davidxl@google.com>
+
+ * opts.c (finish_options): Adjust parameters
+ according to vect cost model.
+ (common_handle_option): Set dynamic vect cost
+ model for FDO.
+ targhooks.c (default_add_stmt_cost): Compute stmt cost
+ unconditionally.
+ * tree-vect-loop.c (vect_estimate_min_profitable_iters):
+ Use helper function.
+ * tree-vectorizer.h (unlimited_cost_model): New function.
+ * tree-vect-slp.c (vect_slp_analyze_bb_1): Use helper function.
+ * tree-vect-data-refs.c (vect_peeling_hash_insert): Use helper
+ function.
+ (vect_enhance_data_refs_alignment): Ditto.
+ * flag-types.h: New enum.
+ * common/config/i386/i386-common.c (ix86_option_init_struct):
+ No need to initialize vect_cost_model flag.
+ * config/i386/i386.c (ix86_add_stmt_cost): Compute stmt cost
+ unconditionally.
+
+2013-09-27 Diego Novillo <dnovillo@google.com>
+
+ * gimple.h (enum ssa_mode): Remove.
+
+2013-09-27 Paulo Matos <pmatos@broadcom.com>
+
+ PR middle-end/58463
+ * gcc.dg/pr58463.c: New test.
+
+2013-09-27 Paulo Matos <pmatos@broadcom.com>
+
+ * cfgloop.h (number_of_loops): Fix typo in check for null.
+
+2013-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/58551
+ * tree-cfg.c (move_sese_region_to_fn): Also move loops that
+ are children of outermost saved_cfun's loop, and set it up to
+ be moved to dest_cfun's outermost loop. Fix up num_nodes adjustments
+ if loop != loop0 and SESE region contains bbs that belong to loop0.
+
+2013-09-27 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * rtlanal.c (must_be_base_p, must_be_index_p): Delete.
+ (binary_scale_code_p, get_base_term, get_index_term): New functions.
+ (set_address_segment, set_address_base, set_address_index)
+ (set_address_disp): Accept the argument unconditionally.
+ (baseness): Remove must_be_base_p and must_be_index_p checks.
+ (decompose_normal_address): Classify as much as possible in the
+ main loop.
+
+2013-09-27 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * cse.c (count_reg_usage): Handle INT_LIST.
+ * lra-eliminations.c (lra_eliminate_regs_1): Likewise.
+ * reginfo.c (reg_scan_mark_refs): Likewise.
+ * reload1.c (eliminate_regs_1): Likewise.
+
+2013-09-27 Iain Sandoe <iain@codesourcery.com>
+
+ PR middle-end/58547
+ * rtlanal.c (lsb_bitfield_op_p): Make both parts of the comparison
+ signed.
+
+2013-09-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58459
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr): Remove
+ restriction not propagating into loops.
+
+2013-09-26 Florian Weimer <fw@deneb.enyo.de>
+
+ * tree-ssa.h (walk_use_def_chains_fn, walk_use_def_chains): Delete.
+ * tree-ssa.c (walk_use_def_chains_1, walk_use_def_chains): Delete.
+ * doc/tree-ssa.texi (Walking use-def chains): Delete.
+
+2013-09-26 Richard Biener <rguenther@suse.de>
+
+ * tree-into-ssa.c (rewrite_into_ssa): Make more SSA names to anonymous.
+
+2013-09-26 Richard Biener <rguenther@suse.de>
+
+ * alias.h (component_uses_parent_alias_set): Rename to ...
+ (component_uses_parent_alias_set_from): ... this.
+ * alias.c (component_uses_parent_alias_set): Rename to ...
+ (component_uses_parent_alias_set_from): ... this and return
+ the desired parent.
+ (reference_alias_ptr_type_1): Use the result from
+ component_uses_parent_alias_set_from instead of stripping
+ components one at a time.
+ * emit-rtl.c (set_mem_attributes_minus_bitpos): Adjust.
+
+2013-09-26 Andrew MacLeod <amacleod@redhat.com>
+
+ * tree-ssa-live.h (find_replaceable_exprs, dump_replaceable_exprs):
+ Move prototypes to...
+ * tree-ssa-ter.h: New File. Move prototypes here.
+ * tree-flow.h (stmt_is_replaceable_p): Remove prototype.
+ * tree-outof-ssa.h: New. Rename ssaexpand.h, include tree-ssa-ter.h.
+ * tree-outof-ssa.c (ssa_is_replaceable_p): New. Refactor common bits
+ from is_replaceable_p.
+ * tree-ssa-ter.c (is_replaceable_p, stmt_is_replaceable_p): Delete.
+ (ter_is_replaceable_p): New. Use new refactored ssa_is_replaceable_p.
+ (process_replaceable): Use ter_is_replaceable_p.
+ (find_replaceable_in_bb): Use ter_is_replaceable_p.
+ * expr.c (stmt_is_replaceable_p): Relocate from tree-ssa-ter.c. Use
+ newly refactored ssa_is_replaceable_p.
+ * cfgexpand.c: Include tree-outof-ssa.h.
+ * ssaexpand.h: Delete.
+
+2013-09-26 Andrew MacLeod <amacleod@redhat.com>
+
+ * gimple.c (gimple_replace_lhs): Move to tree-ssa.c and rename.
+ (struct count_ptr_d, count_ptr_derefs, count_uses_and_derefs): Move to
+ tree-ssa.c
+ (create_gimple_tmp): Delete.
+ (get_expr_type, build_assign, build_type_cast): Move to...
+ * gimple-builder.c: New File.
+ (get_expr_type): Relocate from gimple.c.
+ (build_assign, build_type_cast): Change to only create ssanames.
+ * gimple.h: Move prototypes to...
+ * gimple-builder.h: New File. Here.
+ * tree-ssa.h: And here.
+ * tree-ssa.c (struct count_ptr_d, count_ptr_derefs,
+ count_uses_and_derefs): Relocate from gimple.c.
+ (gimple_replace_ssa_lhs): Renamed gimple_replace_ssa from gimple.c
+ * tree-ssa-reassoc.c (repropagate_negates): Use gimple_replace_ssa_lhs.
+ * tree-ssa-math-opts (execute_cse_reciprocals): Use
+ gimple_replace_ssa_lhs.
+ * asan.c: Include gimple-builder.h.
+ * Makefile.in: Add gimple-builder.o.
+
+2013-09-26 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-live.c (var_map_base_init): Handle SSA names with
+ DECL_IGNORED_P base VAR_DECLs like anonymous SSA names.
+ (loe_visit_block): Use gcc_checking_assert.
+ * tree-ssa-coalesce.c (create_outofssa_var_map): Use
+ gimple_assign_ssa_name_copy_p.
+ (gimple_can_coalesce_p): Adjust according to the var_map_base_init
+ change.
+
+2013-09-26 David Edelsohn <dje.gcc@gmail.com>
+
+ * config/rs6000/t-rs6000 (rs6000.o): Remove.
+ (rs6000-c.o): Use COMPILE and POSTCOMPILE.
+
+2013-09-26 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58539
+ * tree-vect-loop.c (vect_create_epilog_for_reduction): Honor
+ the fact that debug statements are not taking part in loop-closed
+ SSA construction.
+
+2013-09-26 Nick Clifton <nickc@redhat.com>
+
+ * config/msp430/msp430.c (msp430_expand_epilogue): Fix compile
+ time warning message.
+ (msp430_print_operand_raw): Delete unused letter parameter.
+ (TARGET_PRINT_OPERAND_ADDRESS): Define.
+ (msp430_print_operand_address): New function.
+ (msp430_print_operand): Move address printing code from here to
+ new function.
+ * config/msp430/msp430.md (movsipsi2): Add comment in generated
+ assembler.
+ (zero_extendpsisi2): Likewise.
+ (extendpsisi2): New pattern.
+ (andneghi3): New pattern.
+
+2013-09-26 Yvan Roux <yvan.roux@linaro.org>
+
+ * config/aarch64/aarch64.opt (mlra): New option.
+ * config/aarch64/aarch64.c (aarch64_lra_p): New function.
+ (TARGET_LRA_P): Define.
+
+2013-09-26 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expr.c (expand_assignment): Remove obsolete comment.
+
+2013-09-25 Jeff Law <law@redhat.com>
+
+ * tree-flow.h (thread_through_all_blocks): Prototype moved into
+ tree-ssa-threadupdate.h.
+ (register_jump_thread): Similarly.
+ * tree-ssa-threadupdate.h: New header file.
+ * tree-ssa-dom.c: Include tree-ssa-threadupdate.h.
+ * tree-vrp.c: Likewise.
+ * tree-ssa-threadedge.c: Include tree-ssa-threadupdate.h.
+ (thread_around_empty_blocks): Change type of path vector argument to
+ an edge,type pair from just an edge. Initialize both elements when
+ appending to a jump threading path. Tweak references to elements
+ appropriately.
+ (thread_across_edge): Similarly. Release memory for the elements
+ as needed.
+ * tree-ssa-threadupdate.c: Include tree-ssa-threadupdate.h.
+ (dump_jump_thread_path): New function broken out from
+ register_jump_thread.
+ (register_jump_thread): Use dump_jump_thread_path. Change type of
+ path vector entries. Search the path for NULL edges and dump
+ the path if one is found. Tweak the conversion of path to 3-edge
+ form to use the block copy type information embedded in the path.
+
+2013-09-25 Yvan Roux <yvan.roux@linaro.org>
+
+ * lra.c (update_inc_notes): Remove all REG_DEAD and REG_UNUSED notes.
+
+2013-09-25 Yvan Roux <yvan.roux@linaro.org>
+ Vladimir Makarov <vmakarov@redhat.com>
+
+ * rtlanal.c (lsb_bitfield_op_p): New predicate for bitfield operations
+ from the least significant bit.
+ (strip_address_mutations): Add bitfield operations handling.
+ (must_be_index_p): Add shifting and rotate operations handling.
+ (set_address_base): Use must_be_base_p predicate.
+ (set_address_index): Use must_be_index_p predicate.
+
+2013-09-25 Alexander Ivchenko <alexander.ivchenko@intel.com>
+ Maxim Kuznetsov <maxim.kuznetsov@intel.com>
+ Sergey Lega <sergey.s.lega@intel.com>
+ Anna Tikhonova <anna.tikhonova@intel.com>
+ Ilya Tocar <ilya.tocar@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Kirill Yukhin <kirill.yukhin@intel.com>
+ Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * config/i386/i386.c (ix86_avx256_split_vector_move_misalign):
+ Use new names.
+ (ix86_expand_vector_move_misalign): Support new unaligned load and
+ stores and use new names.
+ (CODE_FOR_sse2_storedqu): Rename to ...
+ (CODE_FOR_sse2_storedquv16qi): ... this.
+ (CODE_FOR_sse2_loaddqu): Rename to ...
+ (CODE_FOR_sse2_loaddquv16qi): ... this.
+ (CODE_FOR_avx_loaddqu256): Rename to ...
+ (CODE_FOR_avx_loaddquv32qi): ... this.
+ (CODE_FOR_avx_storedqu256): Rename to ...
+ (CODE_FOR_avx_storedquv32qi): ... this.
+ * config/i386/i386.md (fpint_logic): New.
+ * config/i386/sse.md (VMOVE): Extend for AVX512.
+ (VF): Ditto.
+ (VF_128_256): New.
+ (VF_512): Ditto.
+ (VI_UNALIGNED_LOADSTORE): Ditto.
+ (sse2_avx_avx512f): Ditto.
+ (sse2_avx2): Extend for AVX512.
+ (sse4_1_avx2): Ditto.
+ (avx2_avx512f): New.
+ (sse): Extend for AVX512.
+ (sse2): Ditto.
+ (sse4_1): Ditto.
+ (avxsizesuffix): Ditto.
+ (sseintvecmode): Ditto.
+ (ssePSmode): Ditto.
+ (<sse>_loadu<ssemodesuffix><avxsizesuffix>): Ditto.
+ (<sse>_storeu<ssemodesuffix><avxsizesuffix>): Ditto.
+ (<sse2>_loaddqu<avxsizesuffix>): Extend for AVX512 and rename to ...
+ (<sse2_avx_avx512f>_loaddqu<mode>): ... this.
+ (<sse2>_storedqu<avxsizesuffix>): Extend for AVX512 and rename to ...
+ (<sse2_avx_avx512f>_storedqu<mode): ... this.
+ (<sse>_movnt<mode>): Replace constraint "x" with "v".
+ (STORENT_MODE): Extend for AVX512.
+ (*absneg<mode>2): Replace constraint "x" with "v".
+ (*mul<mode>3): Ditto.
+ (*ieee_smin<mode>3): Ditto.
+ (*ieee_smax<mode>3): Ditto.
+ (avx_cmp<mode>3): Replace VF with VF_128_256.
+ (*<sse>_maskcmp<mode>3_comm): Ditto.
+ (<sse>_maskcmp<mode>3): Ditto.
+ (<sse>_andnot<mode>3): Extend for AVX512.
+ (<code><mode>3, anylogic): Replace VF with VF_128_256.
+ (<code><mode>3, fpint_logic): New.
+ (*<code><mode>3): Extend for AVX512.
+ (avx512flogicsuff): New.
+ (avx512f_<logic><mode>): Ditto.
+ (<sse>_movmsk<ssemodesuffix><avxsizesuffix>): Replace VF with
+ VF_128_256.
+ (<sse4_1>_blend<ssemodesuffix><avxsizesuffix>): Ditto.
+ (<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>): Ditto.
+ (<sse4_1>_dp<ssemodesuffix><avxsizesuffix>): Ditto.
+ (avx_vtest<ssemodesuffix><avxsizesuffix>): Ditto.
+ (<sse4_1>_round<ssemodesuffix><avxsizesuffix>): Ditto.
+ (xop_vpermil2<mode>3): Ditto.
+ (*avx_vpermilp<mode>): Extend for AVX512 and rename to ...
+ (*<sse2_avx_avx512f>_vpermilp<mode>): ... this.
+ (avx_vpermilvar<mode>3): Extend for AVX512 and rename to ...
+ (<sse2_avx_avx512f>_vpermilvar<mode>3): ... this.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (PARTITION_H, LTO_SYMTAB_H, COMMON_TARGET_DEF_H)
+ (RTL_ERROR_H, TRANS_MEM_H, COVERAGE_H, DEMANGLE_H, ALIAS_H)
+ (SCHED_INT_H, SEL_SCHED_IR_H, SEL_SCHED_DUMP_H, VALTRACK_H, DDG_H)
+ (GGC_INTERNAL_H, DECNUM_H, BACKTRACE_H, MKDEPS_H, TREE_HASHER_H)
+ (TREE_SSA_LIVE_H, SSAEXPAND_H, DWARF2OUT_H, SCEV_H, OMEGA_H)
+ (TREE_DATA_REF_H, IRA_INT_H, LRA_INT_H, DBGCNT_H, DATA_STREAMER_H)
+ (GIMPLE_STREAMER_H, TREE_STREAMER_H, STREAMER_HOOKS_H)
+ (TREE_VECTORIZER_H, IPA_INLINE_H, GSTAB_H, LIBFUNCS_H)
+ (GRAPHITE_HTAB_H): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * config/mcore/t-mcore (CROSS_FLOAT_H): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * config/t-glibc (glibc-c.o): Use COMPILE and POSTCOMPILE.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * config/i386/t-i386 (i386.o): Remove.
+ (i386-c.o): Use COMPILE and POSTCOMPILE.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in ($(out_object_file)): Use COMPILE and POSTCOMPILE.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (graph.o, sbitmap.o, sparseset.o, gcc-ar.o)
+ (gcc-ranlib.o, gcc-nm.o, collect2.o, collect2-aix.o, tlink.o)
+ (lto-wrapper.o, default-c.o, attribs.o, incpath.o, prefix.o)
+ (gcc.o, options.o, options-save.o, version.o, gtype-desc.o)
+ (trans-mem.o, ggc-common.o, ggc-page.o, ggc-none.o, stringpool.o)
+ (convert.o, double-int.o, lto-compress.o, data-streamer-in.o)
+ (data-streamer-out.o, data-streamer.o, gimple-streamer-in.o)
+ (gimple-streamer-out.o, tree-streamer.o, tree-streamer-in.o)
+ (tree-streamer-out.o, streamer-hooks.o, lto-cgraph.o)
+ (lto-streamer-in.o, lto-streamer-out.o, lto-section-in.o)
+ (lto-section-out.o, lto-opts.o, lto-streamer.o, langhooks.o)
+ (test-dump.o, tree.o, tree-dump.o, tree-inline.o, print-tree.o)
+ (stor-layout.o, asan.o, tsan.o, ubsan.o, tree-ssa-tail-merge.o)
+ (tree-ssa-structalias.o, tree-ssa-uninit.o, tree-ssa.o)
+ (tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o)
+ (tree-outof-ssa.o, tree-ssa-dse.o, tree-ssa-forwprop.o)
+ (tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-ssa-phiopt.o)
+ (tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o)
+ (tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-threadedge.o)
+ (tree-ssa-threadupdate.o, tree-ssanames.o, tree-phinodes.o)
+ (domwalk.o, tree-ssa-live.o, tree-ssa-copyrename.o)
+ (tree-ssa-pre.o, tree-ssa-sccvn.o)
+ (gimple-ssa-strength-reduction.o, tree-vrp.o, tree-cfg.o)
+ (tree-cfgcleanup.o, tree-tailcall.o, tree-ssa-sink.o)
+ (tree-nested.o, tree-if-conv.o, tree-iterator.o, tree-dfa.o)
+ (tree-ssa-operands.o, tree-eh.o, tree-ssa-loop.o)
+ (tree-ssa-loop-unswitch.o, tree-ssa-address.o)
+ (tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o)
+ (tree-ssa-loop-ch.o, tree-ssa-loop-prefetch.o, tree-predcom.o)
+ (tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-manip.o)
+ (tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o)
+ (tree-ssa-reassoc.o, tree-optimize.o, gimplify.o)
+ (gimple-iterator.o, gimple-fold.o, gimple-low.o, omp-low.o)
+ (tree-browser.o, omega.o, tree-chrec.o, tree-scalar-evolution.o)
+ (tree-data-ref.o, sese.o, graphite.o, graphite-blocking.o)
+ (graphite-clast-to-gimple.o, graphite-dependences.o)
+ (graphite-interchange.o, graphite-poly.o)
+ (graphite-scop-detection.o, graphite-sese-to-poly.o)
+ (graphite-optimize-isl.o, tree-vect-loop.o)
+ (tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o)
+ (tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o)
+ (vtable-verify.o, tree-loop-distribution.o, tree-parloops.o)
+ (tree-stdarg.o, tree-object-size.o, internal-fn.o, gimple.o)
+ (gimple-pretty-print.o, tree-mudflap.o, tree-nomudflap.o)
+ (tree-pretty-print.o, tree-diagnostic.o, fold-const.o)
+ (diagnostic.o, diagnostic-color.o, opts.o, opts-global.o)
+ (opts-common.o, targhooks.o, common/common-targhooks.o, input.o)
+ (toplev.o, hwint.o, passes.o, plugin.o, main.o, host-default.o)
+ (rtl-error.o, rtl.o, print-rtl.o, rtlanal.o, varasm.o, function.o)
+ (statistics.o, stmt.o, except.o, expr.o, dojump.o, builtins.o)
+ (calls.o, expmed.o, explow.o, optabs.o, dbxout.o, debug.o)
+ (sdbout.o, dwarf2out.o, dwarf2cfi.o, dwarf2asm.o, vmsdbgout.o)
+ (xcoffout.o, godump.o, emit-rtl.o, real.o, realmpfr.o, dfp.o)
+ (fixed-value.o, jump.o, simplify-rtx.o, symtab.o, cgraph.o)
+ (cgraphunit.o, cgraphclones.o, cgraphbuild.o, varpool.o, ipa.o)
+ (ipa-profile.o, ipa-devirt.o, ipa-prop.o, ipa-ref.o, ipa-cp.o)
+ (ipa-split.o, ipa-inline.o, ipa-inline-analysis.o)
+ (ipa-inline-transform.o, ipa-utils.o, ipa-reference.o)
+ (ipa-pure-const.o, coverage.o, cselib.o, cse.o, dce.o, dumpfile.o)
+ (dse.o, fwprop.o, web.o, ree.o, cprop.o, gcse.o, store-motion.o)
+ (resource.o, lcm.o, mode-switching.o, tree-ssa-dce.o)
+ (tree-call-cdce.o, tree-ssa-ccp.o, tree-ssa-strlen.o, tree-sra.o)
+ (tree-switch-conversion.o, tree-complex.o, tree-emutls.o)
+ (tree-vect-generic.o, df-core.o, df-problems.o, df-scan.o)
+ (regstat.o, valtrack.o, var-tracking.o, profile.o, mcf.o)
+ (tree-profile.o, value-prof.o, loop-doloop.o, alloc-pool.o)
+ (auto-inc-dec.o, cfg.o, cfghooks.o, cfgexpand.o, cfgrtl.o)
+ (cfganal.o, cfgbuild.o, cfgcleanup.o, cfgloop.o, cfgloopanal.o)
+ (graphds.o, loop-iv.o, loop-invariant.o, cfgloopmanip.o)
+ (loop-init.o, loop-unswitch.o, loop-unroll.o, dominance.o)
+ (et-forest.o, combine.o, reginfo.o, bitmap.o, vec.o, hash-table.o)
+ (reload.o, reload1.o, rtlhooks.o, postreload.o, postreload-gcse.o)
+ (caller-save.o, bt-load.o, reorg.o, alias.o, stack-ptr-mod.o)
+ (init-regs.o, ira-build.o, ira-costs.o, ira-conflicts.o)
+ (ira-color.o, ira-emit.o, ira-lives.o, ira.o, lra.o)
+ (lra-assigns.o, lra-coalesce.o, lra-constraints.o)
+ (lra-eliminations.o, lra-lives.o, lra-spills.o, regmove.o)
+ (combine-stack-adj.o, compare-elim.o, ddg.o, modulo-sched.o)
+ (haifa-sched.o, sched-deps.o, sched-rgn.o, sched-ebb.o)
+ (sched-vis.o, sel-sched.o, sel-sched-dump.o, sel-sched-ir.o)
+ (final.o, recog.o, reg-stack.o, sreal.o, predict.o, lists.o)
+ (bb-reorder.o, tracer.o, timevar.o, regcprop.o, regrename.o)
+ (ifcvt.o, params.o, pointer-set.o, hooks.o, pretty-print.o)
+ (errors.o, dbgcnt.o, lower-subreg.o, target-globals.o)
+ (hw-doloop.o, file-find.o, context.o, $(common_out_object_file))
+ (insn-attrtab.o, insn-automata.o, insn-dfatab.o, insn-emit.o)
+ (insn-enums.o, insn-extract.o, insn-latencytab.o, insn-modes.o)
+ (insn-opinit.o, insn-output.o, insn-peep.o, insn-preds.o)
+ (insn-recog.o, intl.o, cppbuiltin.o, cppdefault.o, gcov.o)
+ (gcov-dump.o): Remove.
+ (default-c.o): Use COMPILE and POSTCOMPILE.
+ (CFLAGS-gcc.o): New variable.
+ ($(common_out_object_file)): Use COMPILE and POSTCOMPILE.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (c-family/cppspec.o, c-family/c-common.o)
+ (c-family/c-cppbuiltin.o, c-family/c-dump.o, c-family/c-format.o)
+ (c-family/c-gimplify.o, c-family/c-lex.o, c-family/c-omp.o)
+ (c-family/c-opts.o, c-family/c-pch.o, c-family/c-ppoutput.o)
+ (c-family/c-pragma.o, c-family/c-pretty-print.o)
+ (c-family/c-semantics.o, c-family/c-ada-spec.o)
+ (c-family/array-notation-common.o, c-family/stub-objc.o)
+ (c-family/c-ubsan.o): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (C_TREE_H): Reference c/c-tree.h.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (DRIVER_DEFINES): Use $(and), not shell code,
+ to add -DENABLE_SHARED_LIBGCC.
+ (gcc.o): Don't use subshell.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (OUTPUT_OPTION): Define as "-o $@".
+ * configure.ac: Don't invoke AM_PROG_CC_C_O.
+ (NO_MINUS_C_MINUS_O, OUTPUT_OPTION): Don't subst.
+ * configure, config.in: Rebuild.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (CCDEPMODE, DEPDIR, depcomp, COMPILE.base)
+ (COMPILE, POSTCOMPILE): New variables.
+ (.cc.o .c.o): Use COMPILE, POSTCOMPILE.
+ (DEPFILES): New variable.
+ Include ".Po" files.
+ * configure.ac: Add checks for dependency checking.
+ * configure, aclocal.m4: Regenerate.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (ALL_HOST_BACKEND_OBJS): Add lto-wrapper.o.
+ ($(ALL_HOST_OBJS)): Move order-only dependency to end of file.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Makefile.in (generated_files): Add options.h,
+ target-hooks-def.h, insn-opinit.h,
+ common/common-target-hooks-def.h, pass-instances.def,
+ c-family/c-target-hooks-def.h.
+
+2013-09-25 Jeff Law <law@redhat.com>
+
+ * tree-ssa-threadedge.c (thread_across_edge): Use foo.last () rather
+ than foo[foo.length () - 1] to access last member in a vec.
+ * tree-ssa-threadupdate.c (register_jump_thread): Similarly.
+
+2013-09-25 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58521
+ * tree.c (iterative_hash_expr): Remove MEM_REF special handling.
+
+2013-09-25 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_resolve_speculation): Use semantical equivalency
+ test.
+
+2013-09-25 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58420
+ * ubsan.c (ubsan_type_descriptor): Handle IDENTIFIER_NODEs
+ when determining the type name.
+
+2013-09-24 Oleg Endo <olegendo@gcc.gnu.org>
+
+ * config/sh/sh.md: Fix formatting.
+
+2013-09-24 Xinliang David Li <davidxl@google.com>
+
+ * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Check
+ max peel iterations parameter.
+ * param.def: New parameter.
+ * doc/invoke.texi: Document New parameter.
+
+2013-09-24 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * gimple-pretty-print.c: Various whitespace tweaks.
+ * tree-core.h: Likewise.
+ * tree-pretty-print.c: Likewise.
+ * tree-ssa-alias.c: Likewise.
+ * tree-ssa-copy.c: Likewise.
+ * tree-ssanames.c: Likewise.
+ * tree-ssanames.h: Likewise.
+ * tree-vrp.c: Likewise.
+
+2013-09-24 Alan Modra <amodra@gmail.com>
+
+ PR middle-end/57134
+ PR middle-end/57586
+ * stmt.c (expand_asm_operands): Call expand_expr with EXPAND_MEMORY
+ for output operands that disallow regs. Don't use EXPAND_WRITE on
+ inout operands.
+
+2013-09-24 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58513
+ * tree.c (reference_alias_ptr_type): Move ...
+ * alias.c (reference_alias_ptr_type): ... here and implement
+ in terms of the new reference_alias_ptr_type_1.
+ (ref_all_alias_ptr_type_p): New helper.
+ (get_deref_alias_set_1): Drop flag_strict_aliasing here,
+ use ref_all_alias_ptr_type_p.
+ (get_deref_alias_set): Add flag_strict_aliasing check here.
+ (reference_alias_ptr_type_1): New function, split out from ...
+ (get_alias_set): ... here.
+ (alias_ptr_types_compatible_p): New function.
+ * alias.h (reference_alias_ptr_type): Declare.
+ (alias_ptr_types_compatible_p): Likewise.
+ * tree.h (reference_alias_ptr_type): Remove.
+ * fold-const.c (operand_equal_p): Use alias_ptr_types_compatible_p
+ to compare MEM_REF alias types.
+
+2013-09-24 Richard Biener <rguenther@suse.de>
+
+ * tree-vrp.c (vrp_finalize): Check for SSA name presence.
+
+2013-09-23 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_vector_reload): Delete, combine
+ reload helper function arrays into a single array reg_addr.
+ (reload_fpr_gpr): Likewise.
+ (reload_gpr_vsx): Likewise.
+ (reload_vsx_gpr): Likewise.
+ (struct rs6000_reg_addr): Likewise.
+ (reg_addr): Likewise.
+ (rs6000_debug_reg_global): Change rs6000_vector_reload,
+ reload_fpr_gpr, reload_gpr_vsx, reload_vsx_gpr uses to reg_addr.
+ (rs6000_init_hard_regno_mode_ok): Likewise.
+ (rs6000_secondary_reload_direct_move): Likewise.
+ (rs6000_secondary_reload): Likewise.
+
+ * config/rs6000/rs6000.h (enum r6000_reg_class_enum): Add new
+ constraints: wu, ww, and wy. Repurpose wv constraint added during
+ power8 changes. Put wg constraint in alphabetical order.
+
+ * config/rs6000/rs6000.opt (-mvsx-scalar-float): New debug switch
+ for future work to add ISA 2.07 VSX single precision support.
+ (-mvsx-scalar-double): Change default from -1 to 1, update
+ documentation comment.
+ (-mvsx-scalar-memory): Rename debug switch to -mupper-regs-df.
+ (-mupper-regs-df): New debug switch to control whether DF values
+ can go in the traditional Altivec registers.
+ (-mupper-regs-sf): New debug switch to control whether SF values
+ can go in the traditional Altivec registers.
+
+ * config/rs6000/rs6000.c (rs6000_debug_reg_global): Print wu, ww,
+ and wy constraints.
+ (rs6000_init_hard_regno_mode_ok): Use ssize_t instead of int for
+ loop variables. Rename -mvsx-scalar-memory to -mupper-regs-df.
+ Add new constraints, wu/ww/wy. Repurpose wv constraint.
+ (rs6000_debug_legitimate_address_p): Print if we are running
+ before, during, or after reload.
+ (rs6000_secondary_reload): Add a comment.
+ (rs6000_opt_masks): Add -mupper-regs-df, -mupper-regs-sf.
+
+ * config/rs6000/constraints.md (wa constraint): Sort w<x>
+ constraints. Update documentation string.
+ (wd constraint): Likewise.
+ (wf constraint): Likewise.
+ (wg constraint): Likewise.
+ (wn constraint): Likewise.
+ (ws constraint): Likewise.
+ (wt constraint): Likewise.
+ (wx constraint): Likewise.
+ (wz constraint): Likewise.
+ (wu constraint): New constraint for ISA 2.07 SFmode scalar
+ instructions.
+ (ww constraint): Likewise.
+ (wy constraint): Likewise.
+ (wv constraint): Repurpose ISA 2.07 constraint that we not used in
+ the previous submissions.
+ * doc/md.texi (PowerPC and IBM RS6000): Likewise.
+
+2013-09-23 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * doc/rtl.texi (REG_NOTES): Say that int_list can also be used.
+ (REG_BR_PROB): Say that the probability is stored in an int_list.
+ * reg-notes.def: Update commentary to mention INT_LIST.
+ * rtl.def (EXPR_LIST, INSN_LIST): Capitalize comments.
+ (INT_LIST): New rtx.
+ * rtl.h (add_int_reg_note, add_shallow_copy_of_reg_note): Declare.
+ * rtlanal.c (int_reg_note_p): New function.
+ (alloc_reg_note): Assert that the note does not have an int argument.
+ (add_int_reg_note, add_shallow_copy_of_reg_note): New functions.
+ * combine.c (distribute_notes): Use add_shallow_copy_of_rtx.
+ * cse.c (cse_process_notes_1): Expect REG_EQUAL to be an EXPR_LIST
+ rather than an INSN_LIST. Handle INT_LIST.
+ * ifcvt.c (cond_exec_process_insns): Take the probability as an int
+ rather than an rtx. Use gen_rtx_INT_LIST to create a REG_BR_PROB note.
+ (cond_exec_process_if_block): Use XINT to extract REG_BR_PROB values.
+ Manipulate them as ints rather than rtxes.
+ * reg-stack.c (subst_asm_stack_regs): Only handle EXPR_LIST notes.
+ * regmove.c (copy_src_to_dest): Likewise.
+ * sched-vis.c (print_insn_with_notes): Handle INT_LIST.
+
+ * config/i386/winnt.c (i386_pe_seh_unwind_emit): Sink pat assignment
+ into the cases that need it.
+ * config/arm/arm.c (arm_unwind_emit): Likewise.
+
+ * asan.c (asan_clear_shadow): Use add_int_reg_note for REG_BR_PROB.
+ * emit-rtl.c (try_split, emit_copy_of_insn_after): Likewise.
+ * loop-doloop.c (add_test, doloop_modify): Likewise.
+ * loop-unswitch.c (compare_and_jump_seq): Likewise.
+ * optabs.c (emit_cmp_and_jump_insn_1): Likewise.
+ * predict.c (combine_predictions_for_insn): Likewise.
+ * print-rtl.c (print_rtx): Handle INT_LIST.
+ * config/aarch64/aarch64.c (aarch64_emit_unlikely_jump): Likewise.
+ * config/alpha/alpha.c (emit_unlikely_jump): Likewise.
+ * config/arm/arm.c (emit_unlikely_jump): Likewise.
+ * config/i386/i386.c (ix86_expand_split_stack_prologue): Likewise.
+ (ix86_split_fp_branch, predict_jump): Likewise.
+ * config/rs6000/rs6000.c (emit_unlikely_jump): Likewise.
+ * config/sh/sh.c (expand_cbranchsi4): Likewise.
+ * config/spu/spu.c (ea_load_store_inline): Likewise.
+
+ * cfgbuild.c (compute_outgoing_frequencies): Use XINT to access the
+ value of a REG_BR_PROB note.
+ * cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
+ (update_br_prob_note, rtl_verify_edges, purge_dead_edges): Likewise.
+ * emit-rtl.c (try_split): Likewise.
+ * predict.c (br_prob_note_reliable_p): Likewise.
+ (invert_br_probabilities, combine_predictions_for_insn): Likewise.
+ * reorg.c (mostly_true_jump): Likewise.
+ * config/bfin/bfin.c (cbranch_predicted_taken_p): Likewise.
+ * config/frv/frv.c (frv_print_operand_jump_hint): Likewise.
+ * config/i386/i386.c (ix86_print_operand): Likewise.
+ * config/ia64/ia64.c (ia64_print_operand): Likewise.
+ * config/mmix/mmix.c (mmix_print_operand): Likewise.
+ * config/rs6000/rs6000.c (output_cbranch): Likewise.
+ * config/s390/s390.c (s390_expand_tbegin): Likewise.
+ * config/sh/sh.c (sh_print_operand, sh_adjust_cost): Likewise.
+ * config/sparc/sparc.c (output_cbranch): Likewise.
+ * config/spu/spu.c (get_branch_target): Likewise.
+ * config/tilegx/tilegx.c (cbranch_predicted_p): Likewise.
+ * config/tilepro/tilepro.c (cbranch_predicted_p): Likewise.
+
+2013-09-23 Jan Hubicka <jh@suse.cz>
+
+ * ipa-cp.c (ipa_get_indirect_edge_target_1): Add sanity check
+ for ipa-devirt.
+ * ipa-utils.h (possible_polymorphic_call_target_p): New function.
+ * ipa-devirt.c (possible_polymorphic_call_target_p): Be tolerant
+ of external calls
+ * gimple-fold.c: Include ipa-utils.h and gimple-pretty-print.h
+ (gimple_fold_call): Dump inconsistent devirtualizations; add
+ sanity check for type based devirtualizations.
+ * ipa-prop.c: Include ipa-utils.h
+ (ipa_intraprocedural_devirtualization): Add sanity check.
+ (try_make_edge_direct_virtual_call): Likewise.
+
+2013-09-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-ssa-ccp.c (insert_clobber_before_stack_restore): Recurse on copy
+ assignment statements.
+
+2013-09-23 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ * gimple-pretty-print.c (dump_ssaname_info): New function.
+ (dump_gimple_phi): Call it.
+ (pp_gimple_stmt_1): Likewise.
+ * tree-core.h (tree_ssa_name): New union ssa_name_info_type field.
+ (range_info_def): Declare.
+ * tree-pretty-print.c (pp_double_int): New function.
+ (dump_generic_node): Call it.
+ * tree-pretty-print.h (pp_double_int): Declare.
+ * tree-ssa-alias.c (dump_alias_info): Check pointer type.
+ * tree-ssanames.h (range_info_def): New structure.
+ (value_range_type): Move definition here.
+ (set_range_info, value_range_type, duplicate_ssa_name_range_info):
+ Declare.
+ * tree-ssanames.c (make_ssa_name_fn): Check pointer type at
+ initialization.
+ (set_range_info): New function.
+ (get_range_info): Likewise.
+ (duplicate_ssa_name_range_info): Likewise.
+ (duplicate_ssa_name_fn): Check pointer type and call
+ duplicate_ssa_name_range_info.
+ * tree-ssa-copy.c (fini_copy_prop): Likewise.
+ * tree-vrp.c (value_range_type): Remove definition, now in
+ tree-ssanames.h.
+ (vrp_finalize): Call set_range_info to update value range of SSA_NAMEs.
+ * tree.h (SSA_NAME_PTR_INFO): Macro changed to access via union.
+ (SSA_NAME_RANGE_INFO): New macro.
+
+2013-09-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58464
+ * tree-ssa-pre.c (phi_trans_lookup): Remove.
+ (phi_trans_add): Change to add conditionally on being not present.
+ (phi_translate_1): Remove recursion detection here.
+ (phi_translate): Pre-seed the cache with NULL to catch
+ recursion here in a more generic way.
+ (bitmap_find_leader): Adjust comment.
+ (get_representative_for): Dump value-numbers.
+ (create_expression_by_pieces): Likewise.
+ (insert_into_preds_of_block): Likewise.
+
+2013-09-23 Christian Bruel <christian.bruel@st.com>
+
+ PR target/58475
+ * config/sh/sh.md (movsf_ie): Allow fpul_operand.
+ * config/sh/predicate.md (arith_reg_operand): Disallow FPUL_REG.
+
+2013-09-23 James Greenhalgh <james.greenhalgh@arm.com>
+
+ Revert r202780:
+ 2013-09-20 Renlin Li <renlin.li@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_expand_prologue): Use
+ plus_constant.
+ (aarch64_expand_epilogue): Likewise.
+ (aarch64_legitimize_reload_address): Likewise.
+
+2013-09-22 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimplify.c (gimplify_asm_expr): Reset the TREE_CHAIN of clobbers to
+ NULL_TREE before pushing them onto the vector. Likewise for labels.
+
+2013-09-21 Eric Botcazou <ebotcazou@adacore.com>
+
+ * config/ia64/predicates.md (ia64_cbranch_operator): Accept unordered
+ comparison operators when -fno-trapping-math is in effect.
+ * config/ia64/ia64.c (ia64_expand_compare): Add support for unordered
+ comparison operators in TFmode and assert that unsupported operators
+ cannot reach here.
+ (ia64_print_operand): Likewise.
+
+2013-09-21 Jan Hubicka <jh@suse.cz>
+
+ * x86-tune.def (partial_reg_stall): Disable for CoreI7 and newer.
+ (sse_typeless_stores): Enable for core
+ (sse_load0_by_pxor): Likewise.
+ (four_jump_limit): Disable for core.
+ (pad_returns): Likewise.
+ (avoid_vector_decode): Likewise.
+ (fuse_cmp_and_branch): Enable for cores.
+ * i386.c (x86_accumulate_outgoing_args): Disable for cores.
+
+2013-09-20 John David Anglin <danglin@gcc.gnu.org>
+
+ PR middle-end/56791
+ * config/pa/pa.c (pa_option_override): Disable auto increment and
+ decrement instructions until reload is completed.
+
+ * config/pa/pa-linux.h (TARGET_OS_CPP_BUILTINS): Define
+ __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2,
+ and __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4.
+
+2013-09-20 DJ Delorie <dj@redhat.com>
+ Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/rl78.c: Various whitespace and comment tweaks.
+ (need_to_save): Save bank 0 on interrupts.
+ (characterize_address): Strip far address wrappers.
+ (rl78_as_legitimate_address): Likewise.
+ (transcode_memory_rtx): Likewise.
+ (rl78_peep_movhi_p): Disable this peephole after devirt.
+ (rl78_propogate_register_origins): Forget all origins when a
+ CLOBBER is seen.
+ * config/rl78/rl78-virt.md: Various whitespace tweaks.
+ * config/rl78/rl78-real.md: Various whitespace tweaks. Additional
+ peephole2's.
+ * config/rl78/rl78.md (sel_rb): Disable for G10 just in case.
+ * config/rl78/rl78-expand.md (movqi): Check for subregs of consts.
+ * config/rl78/rl78.h (LINK_SPEC): Pass -gc-sections unless
+ relocating.
+ * config/rl78/constraints.md: Various whitespace and paren tweaks.
+
+2013-09-20 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.md: In "scc" insn patterns, change output template to
+ handle const0_rtx in reg_or_0_operand operands.
+
+2013-09-20 Martin Husemann <martin@NetBSD.org>
+
+ PR target/56875
+ * config/vax/vax.c (vax_output_int_move): Use D format specifier.
+ * config/vax/vax.md (ashldi3, <unnamed>): Ditto.
+
+2013-09-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58484
+ * tree-scalar-evolution.c (struct scev_info_str): Shrink by
+ remembering SSA name version and block index.
+ (new_scev_info_str): Adjust.
+ (hash_scev_info): Likewise. Also hash the block index.
+ (eq_scev_info): Adjust.
+ (find_var_scev_info): Likewise.
+ (struct instantiate_cache_entry): Remove.
+ (struct instantiate_cache_type): Use a htab to map name, block
+ to chrec.
+ (instantiate_cache_type::~instantiate_cache_type): Adjust.
+ (get_instantiated_value_entry): Likewise.
+ (hash_idx_scev_info, eq_idx_scev_info): New functions.
+ (instantiate_scev_name): Adjust.
+
+2013-09-20 Jeff Law <law@redhat.com>
+
+ * tree-ssa-dom.c (record_temporary_equivalences): Add comment.
+
+2013-09-20 Yufeng Zhang <yufeng.zhang@arm.com>
+
+ * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args):
+ Call aarch64_simd_expand_args to update op[argc].
+
+2013-09-20 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * plugin.c (parse_plugin_arg_opt): Accept equal sign inside
+ plugin argument.
+
+2013-09-20 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * gengtype.c (file_rules): Added rule for *.cc files.
+ (get_output_file_with_visibility): Give fatal message when no
+ rules found.
+
+2013-09-20 Renlin Li <renlin.li@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_expand_prologue): Use plus_constant.
+ (aarch64_expand_epilogue): Likewise.
+ (aarch64_legitimize_reload_address): Likewise.
+
+2013-09-20 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR middle-end/57748
+ * expr.c (expand_assignment): Remove misalignp code path.
+
+2013-09-20 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58413
+ * ubsan.c (get_ubsan_type_info_for_type): Use TYPE_SIZE instead of
+ TYPE_PRECISION. Add asserts.
+
+2013-09-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58453
+ * tree-loop-distribution.c (distribute_loop): Apply the cost
+ model for -ftree-loop-distribute-patterns, too.
+
+2013-09-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58473
+ * tree-chrec.h (build_polynomial_chrec): Use gcc_checking_assert,
+ make type comparison less strict.
+
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+ * aclocal.m4: Regenerate.
+
+2013-09-20 Marek Polacek <polacek@redhat.com>
+
+ PR other/58467
+ * doc/extend.texi: Document that attribute used is meant to be used
+ on variables with static storage duration.
+
+2013-09-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/58472
+ * tree-vect-stmts.c (vectorizable_store, vectorizable_load): For
+ simd_lane_access set inv_p = false.
+ * omp-low.c (lower_rec_input_clauses): Set TREE_NO_WARNING on
+ the simduid magic VAR_DECL.
+
+2013-09-19 Jan Hubicka <jh@suse.cz>
+
+ * i386.c (generic_memcpy, generic_memset): Fix 32bit template.
+
+2013-09-17 Jeff Law <law@redhat.com>
+
+ * tree-ssa-dom.c (record_temporary_equivalences): New function
+ split out of dom_opt_dom_walker::after_dom_children.
+ (dom_opt_dom_walker::thread_across_edge): Move common code
+ in here from dom_opt_dom_walker::after_dom_children.
+ (dom_opt_dom_walker::after_dom_children): Corresponding simplifictions.
+
+2013-09-19 Jan Hubicka <jh@suse.cz>
+
+ * i386.h (TARGET_GENERIC32, TARGET_GENERIC64): Remove.
+ (TARGET_GENERIC): Use PROCESOR_GENERIC
+ (enum processor_type): Unify generic32 and 64.
+ * i386.md (cpu): Likewise.
+ * x86-tune.def (use_leave): Enable for generic32.
+ (avoid_vector_decode, slow_imul_imm32_mem, slow_imul_imm8): Likewise.
+ * athlon.md: Change generic64 to generic in all occurences.
+ * i386-c.c (ix86_target_macros_internal): Unify generic64 and 32.
+ (ix86_target_macros_internal): Likewise.
+ * driver-i386.c (host_detect_local_cpu): Likewise.
+ * i386.c (generic64_memcpy, generic64_memset, generic64_cost): Rename
+ to ..
+ (generic_memcpy, generic_memset, generic_cost): This one.
+ (generic32_memcpy, generic32_memset, generic32_cost): Remove.
+ (m_GENERIC32, m_GENERIC64): Remove.
+ (m_GENERIC): Turn into one flag.
+ (processor_target): Unify generic tunnings.
+ (ix86_option_override_internal): Replace generic32/64 by generic.
+ (ix86_issue_rate): Likewise.
+ (ix86_adjust_cost): Likewise.
+
+2013-09-19 Jan Hubicka <jh@suse.cz>
+
+ * cgraph.c (cgraph_create_edge_1): Avoid uninitialized read
+ of speculative flag.
+
+2013-09-19 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (expand_omp_sections): Always pass len - 1 to
+ GOMP_sections_start, even if !exit_reachable.
+
+2013-09-18 Vladimir Makarov <vmakarov@redhat.com>
+
+ * lra-constraints.c (need_for_all_save_p): Use macro
+ HARD_REGNO_CALL_PART_CLOBBERED.
+ * lra-lives.c (check_pseudos_live_through_calls): Use the macro to
+ set up pseudo conflict hard regs.
+
+2013-09-18 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/58452
+ * config/rs6000/paired.md (movmisalignv2sf): Fix to allow memory
+ operands.
+
+2013-09-18 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/58438
+ * lra.c (lra): Clear lra_optional_reload_pseudos in upper loop.
+ * lra-constraints.c (undo_optional_reloads): Keep optional reloads
+ from previous subpasses.
+
+2013-09-18 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm.c (arm_get_frame_offsets): Validate architecture supports
+ LDRD/STRD before accepting the tuning preference.
+ (arm_expand_prologue): Likewise.
+ (arm_expand_epilogue): Likewise.
+
+2013-09-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58417
+ * tree-chrec.c (chrec_fold_plus_1): Assert that we do not
+ have chrecs with symbols defined in the loop as operands.
+ (chrec_fold_multiply): Likewise.
+ * tree-scalar-evolution.c (interpret_rhs_expr): Instantiate
+ parameters before folding binary operations.
+ (struct instantiate_cache_entry_hasher): Remove.
+ (struct instantiate_cache_type): Use a pointer-map.
+ (instantiate_cache_type::instantiate_cache_type): New function.
+ (instantiate_cache_type::get): Likewise.
+ (instantiate_cache_type::set): Likewise.
+ (instantiate_cache_type::~instantiate_cache_type): Adjust.
+ (get_instantiated_value_entry): Likewise.
+ (global_cache): New global.
+ (instantiate_scev_r, instantiate_scev_poly, instantiate_scev_binary,
+ instantiate_array_ref, instantiate_scev_convert, instantiate_scev_3,
+ instantiate_scev_2, instantiate_scev_1): Do not pass along cache.
+ (instantiate_scev_name): Adjust.
+ (instantiate_scev): Construct global instead of local cache.
+ (resolve_mixers): Likewise.
+
+2013-09-18 Daniel Morris <danielm@ecoscentric.com>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58458
+ * doc/implement-cxx.texi: Fix references to the C++ standards.
+
+2013-09-18 Jakub Jelinek <jakub@redhat.com>
+
+ * omp-low.c (copy_var_decl): Copy DECL_ATTRIBUTES.
+ * tree-vect-data-refs.c (vect_analyze_data_refs): For
+ simd_lane_access drs, update also DR_ALIGNED_TO.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58411
+ * doc/extend.texi: Document no_sanitize_undefined attribute.
+ * builtins.c (fold_builtin_0): Don't sanitize function if it has the
+ no_sanitize_undefined attribute.
+
+2013-09-18 Nick Clifton <nickc@redhat.com>
+
+ * config/msp430/msp430.h (ASM_SPEC): Pass -md on to the assembler.
+ (ASM_DECLARE_FUNCTION_NAME): Define.
+
+2013-09-17 Trevor Saunders <tsaunders@mozilla.com>
+
+ * compare-elim.c (find_comparison_dom_walker): New class
+ (find_comparisons_in_bb): Rename to
+ find_comparison_dom_walker::before_dom_children
+ (find_comparisons): Adjust
+ * domwalk.c (walk_dominator_tree): Rename to dom_walker::walk, and
+ adjust.
+ (init_walk_dominator_tree, fini_walk_dominator_tree): Remove
+ * domwalk.h (dom_walk_data): Convert it To a class dom_walker.
+ (init_walk_dominator_tree): Remove declaration.
+ (fini_walk_dominator_tree): Remove declaration.
+ * fwprop.c (single_def_use_dom_walker): New class
+ (single_def_use_enter_block): Convert to
+ single_def_use_dom_walker::before_dom_children.
+ (single_def_use_leave_block): Convert to
+ single_def_use_dom_walker::after_dom_children.
+ (build_single_def_use_links): Adjust.
+ * gimple-ssa-strength-reduction.c (find_candidates_dom_walker): New
+ class.
+ (find_candidates_in_block): Convert to
+ find_candidates_dom_walker::before_dom_children.
+ (execute_strength_reduction): Adjust.
+ * graphite-sese-to-poly.c (struct bsc, build_sese_conditions): Remove.
+ (sese_dom_walker): New class.
+ (sese_dom_walker::sese_dom_walker): New constructor.
+ (sese_dom_walker::~sese_dom_walker): New destructor.
+ (build_sese_conditions_before): Convert to
+ sese_dom_walker::before_dom_children.
+ (build_sese_conditions_after): Convert to
+ sese_dom_walker::after_dom_children.
+ (build_poly_scop): Adjust
+ * tree-into-ssa.c (rewrite_dom_walker): New class
+ (rewrite_enter_block): Convert to
+ rewrite_dom_walker::before_dom_children.
+ (rewrite_leave_block): Convert to
+ rewrite_dom_walker::after_dom_children.
+ (rewrite_update_dom_walker): New class.
+ (rewrite_update_enter_block): Convert to
+ rewrite_update_dom_walker::before_dom_children.
+ (rewrite_update_leave_block): Convert to
+ rewrite_update_dom_walker::after_dom_children.
+ (rewrite_blocks, rewrite_into_ssa): Adjust.
+ (mark_def_dom_walker): New class.
+ (mark_def_dom_walker::mark_def_dom_walker): New constructor.
+ (mark_def_dom_walker::~mark_def_dom_walker): New destructor.
+ (mark_def_sites_blocks): Convert to
+ mark_def_dom_walker::before_dom_children.
+ (mark_def_site_blocks): Remove.
+ * tree-ssa-dom.c (dom_opt_dom_walker): New class.
+ (tree_ssa_dominator_optimize): Adjust.
+ (dom_thread_across_edge): Convert to method
+ dom_opt_dom_walker::thread_across_edge.
+ (dom_opt_enter_block): Convert to member function
+ dom_opt_dom_walker::before_dom_children.
+ (dom_opt_leave_block): Convert to member function
+ dom_opt_dom_walker::after_dom_children.
+ * tree-ssa-dse.c (dse_dom_walker): New class.
+ (dse_enter_block): Convert to member function
+ dse_dom_walker::before_dom_children.
+ (tree_ssa_dse): Adjust.
+ * tree-ssa-loop-im.c (invariantness_dom_walker): New class.
+ (determine_invariantness_stmt): Convert to method
+ invariantness_dom_walker::before_dom_children.
+ (determine_invariantness): Remove
+ (move_computations_dom_walker): New class.
+ (move_computations_stmt): Convert to method
+ move_computations_dom_walker::before_dom_children.
+ (move_computations, tree_ssa_lim): Adjust.
+ * tree-ssa-phiopt.c (nontrapping_dom_walker): new class
+ (nt_init_block): Make method
+ notrappping_dom_walker::before_dom_children.
+ (nt_fini_block): Make
+ method nontrapping_dom_walker::after_dom_children.
+ (get_non_trapping): Adjust.
+ * tree-ssa-pre.c (eliminate_dom_walker): New class.
+ (eliminate_bb): Make method eliminate_dom_walker::before_dom_children.
+ (eliminate_leave_block): Make method.
+ eliminate_dom_walker::after_dom_children.
+ (eliminate): Adjust
+ * tree-ssa-strlen.c (strlen_dom_walker): New class.
+ (strlen_enter_block): Make method
+ strlen_dom_walker::before_dom_children.
+ (strlen_leave_block): Make
+ method strlen_dom_walker::after_dom_children.
+ (tree_ssa_strlen): Adjust.
+ * tree-ssa-uncprop.c (uncprop_dom_walker): New class.
+ (tree_ssa_uncprop): Adjust.
+ (uncprop_leave_block): Make method
+ uncprop_dom_walker::after_dom_children.
+ (uncprop_leave_block): Make method
+ uncprop_dom_walker::before_dom_children.
+
+2013-09-18 Bin Cheng <bin.cheng@arm.com>
+
+ * config/arm/arm.c (thumb1_reorg): Search for flag setting insn before
+ branch in same basic block. Check both src and dest of the move insn.
+
+2013-09-17 Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/rl78-real.md (bf): New pattern.
+ (bt): New pattern.
+ * config/rl78/rl78.c (rl78_print_operand_1): Handle %B.
+ (rl78_print_operand): Do not put a # before a %B.
+ * config/rl78/rl78.opt: Tweak doc strings.
+
+2013-09-17 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/constraints.md (Wcv): Allow up to $r31.
+ * config/rl78/rl78.c (rl78_asm_file_start: Likewise.
+ (rl78_option_override): Likewise, if -mallregs.
+ (is_virtual_register): Likewise.
+ * config/rl78/rl78.h (reg_class): Extend VREGS to $r31.
+ (REGNO_OK_FOR_BASE_P): Likewise.
+ * config/rl78/rl78.opt (-mallregs): New.
+
+2013-09-17 Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/rl78.c (need_to_save): Change return type to bool.
+ For interrupt functions: save all call clobbered registers if the
+ interrupt handler is not a leaf function.
+ (rl78_expand_prologue): Always recompute the frame information.
+ For interrupt functions: only select bank 0 if one of the bank 0
+ registers is going to be psuhed.
+
+2013-09-17 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/constraints.md: For each W* constraint, rename to C*
+ and create a W* constraint that checks for an optional ES: prefix
+ pattern also.
+ * config/rl78/rl78.md (UNS_ES_ADDR): New.
+ (es_addr): New. Used to wrap far addresses.
+ * config/rl78/rl78-protos.h (rl78_es_addr): New.
+ (rl78_es_base): New.
+ * config/rl78/rl78.c (rl78_as_legitimate_address): Accept "unspec"
+ wrapped far addresses.
+ (rl78_print_operand_1): Unwrap far addresses before processing.
+ (rl78_lo16): Wrap far addresses in unspecs.
+ (rl78_es_addr): New.
+ (rl78_es_base): New.
+ (insn_ok_now): Check for not-yet-wrapped far addresses.
+ (transcode_memory_rtx): Properly re-wrap far addresses.
+
+2013-09-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/sparc/t-rtems: Add leon3 multilibs.
+
+2013-09-17 Cong Hou <congh@google.com>
+
+ * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Fix a bug
+ when checking the dot production pattern. The type of rhs operand
+ of multiply is now checked correctly.
+
+2013-09-17 Jeff Law <law@redhat.com>
+
+ * tree-ssa-dom.c (cprop_into_successor_phis): Also propagate
+ edge implied equivalences into successor phis.
+ * tree-ssa-threadupdate.c (phi_args_equal_on_edges): Moved into
+ here from tree-ssa-threadedge.c.
+ (mark_threaded_blocks): When threading through a joiner, if both
+ successors of the joiner's clone reach the same block, verify the
+ PHI arguments are equal. If not, cancel the jump threading request.
+ * tree-ssa-threadedge.c (phi_args_equal_on_edges): Moved into
+ tree-ssa-threadupdate.c
+ (thread_across_edge): Don't check PHI argument equality when
+ threading through joiner block here.
+
+2013-09-17 Andrew MacLeod <amacleod@redhat.com>
+
+ * tree-flow.h (ssa_undefined_value_p): Remove prototype.
+ * tree-ssa.c (ssa_undefined_value_p): Move pass independent parts here.
+ (warn_uninit, warn_uninitialized_vars,
+ execute_early_warn_uninitialized, make_pass_early_warn_uninitialized):
+ Move to tree-ssa-uninit.c.
+ * tree-ssa-uninit.c (ssa_undefined_value_p): Move to tree-ssa.c
+ (has_undefined_value_p): New. Pass dependant parts of
+ ssa_undefined_value_p.
+ (uninit_undefined_value_p): Use has_undefined_value_p.
+ (warn_uninit, warn_uninitialized_vars,
+ execute_early_warn_uninitialized, make_pass_early_warn_uninitialized):
+ Move from tree-ssa.c.
+ * tree-ssa.h: Adjust prototypes.
+
+2013-09-17 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/58332
+ * cif-code.def (FUNCTION_NOT_OPTIMIZED): New CIF code.
+ * ipa-inline.c (can_inline_edge_p): Do not downgrade
+ FUNCTION_NOT_OPTIMIZED.
+ * ipa-inline-analysis.c (compute_inline_parameters): Function
+ not optimized is not inlinable unless it is alwaysinline.
+ (inline_analyze_function): Force calls in not optimized
+ function not inlinable.
+
+2013-09-17 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/58329
+ * ipa-devirt.c (ipa_devirt): Be ready for symtab_nonoverwritable_alias
+ to return NULL.
+ * ipa.c (function_and_variable_visibility): Likewise.
+ * ipa-profile.c (ipa_profile): Likewise.
+
+2013-09-17 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR ipa/58398
+ * cgraph.c (cgraph_function_body_availability): Check for ifunc
+ attribute, and don't inline the resolver in this case.
+
+2013-09-17 Teresa Johnson <tejohnson@google.com>
+
+ * coverage.c (get_coverage_counts): Add missing newline.
+
+2013-09-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR tree-optimization/58088
+ * fold-const.c (mask_with_trailing_zeros): New function.
+ (fold_binary_loc): Make sure we don't recurse infinitely
+ when the X in (X & C1) | C2 is a tree of the form (Y * K1) & K2.
+ Use mask_with_trailing_zeros where appropriate.
+
+2013-09-17 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ * config/i386/i386.c (distance_agu_use_in_bb) : Proper initialization
+ of 'prev' var to get better distance estimation.
+
+2013-09-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-inline.h (struct copy_body_data): Add transform_parameter.
+ * tree-inline.c (is_parameter_of): New predicate.
+ (remap_gimple_op_r): Do not propagate TREE_THIS_NOTRAP on MEM_REF if
+ a parameter has been remapped.
+ (copy_tree_body_r): Likewise on INDIRECT_REF and MEM_REF.
+ (optimize_inline_calls): Initialize transform_parameter.
+ (copy_gimple_seq_and_replace_locals): Likewise.
+ (tree_function_versioning): Likewise.
+ (maybe_inline_call_in_expr): Likewise.
+
+2013-09-17 Nick Clifton <nickc@redhat.com>
+
+ * config/msp430/msp430-protos.h: Add prototypes for new functions.
+ * config/msp430/msp430.c (msp430_preserve_reg_p): Add support for
+ interrupt handlers.
+ (is_attr_func): New function.
+ (msp430_is_interrupt_func): New function.
+ (is_naked_func): New function.
+ (is_reentrant_func): New function.
+ (is_critical_func): New function.
+ (msp430_start_function): Add annotations for function attributes.
+ (msp430_attr): New function.
+ (msp430_attribute_table): New.
+ (msp430_function_section): New function.
+ (TARGET_ASM_FUNCTION_SECTION): Define.
+ (msp430_builtin): New enum.
+ (msp430_init_builtins): New function.
+ (msp430_builtin_devl): New function.
+ (msp430_expand_builtin): New function.
+ (TARGET_INIT_BUILTINS): Define.
+ (TARGET_EXPAND_BUILTINS): Define.
+ (TARGET_BUILTIN_DECL): Define.
+ (msp430_expand_prologue): Add support for naked, interrupt,
+ critical and reentrant functions.
+ (msp430_expand_epilogue): Likewise.
+ (msp430_print_operand): Handle 'O' character.
+ * config/msp430/msp430.h (TARGET_CPU_CPP_BUILTINS): Define
+ NO_TRAMPOLINES.
+ * config/msp430/msp430.md (unspec): Add UNS_DINT, UNS_EINT,
+ UNS_PUSH_INTR, UNS_POP_INTR, UNS_BIC_SR, UNS_BIS_SR.
+ (pushm): Use a 'n' rather than an 'i' constraint.
+ (msp_return): Add generation of the interrupt return instruction.
+ (disable_interrupts): New pattern.
+ (enable_interrupts): New pattern.
+ (push_intr_state): New pattern.
+ (pop_intr_state): New pattern.
+ (bic_SR): New pattern.
+ (bis_SR): New pattern.
+ * doc/extend.texi: Document MSP430 function attributes and builtin
+ functions.
+
+2013-09-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58432
+ * tree-loop-distribution.c (tree_loop_distribution): Also
+ scan PHIs for outside loop uses and seed a partition from them.
+
+2013-09-17 Bin Cheng <bin.cheng@arm.com>
+
+ * gimple-ssa-strength-reduction.c (backtrace_base_for_ref): New.
+ (restructure_reference): Call backtrace_base_for_ref.
+
+2013-09-17 Alan Modra <amodra@gmail.com>
+
+ PR target/57589
+ * config/rs6000/driver-rs6000.c (elf_platform): Revert 2013-06-11
+ patch.
+
+2013-09-16 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/rl78.c (rl78_asm_file_start): Specify alternate
+ vregs location for RL78/G10.
+ (rl78_expand_prologue): Avoid SEL on G10.
+ (rl78_expand_epilogue): Likewise.
+ (rl78_peep_movhi_p): Can't move a constant to memory in HImode.
+ * config/rl78/rl78.h (TARGET_CPU_CPP_BUILTINS): Define
+ __RL78_G10__ when appropriate.
+ (ASM_SPEC): Pass -mg10 along to the assembler.
+ * config/rl78/rl78.md (sel_rb): Disable for G10.
+ * config/rl78/rl78.opt: Add -mg10 option.
+ * config/rl78/t-rl78: Add -mg10 multilib.
+
+2013-09-16 Xinliang David Li <davidxl@google.com>
+
+ * tree-if-conv.c (main_tree_if_conversion): Check new flag.
+ * omp-low.c (omp_max_vf): Ditto.
+ (expand_omp_simd): Ditto.
+ * tree-vectorizer.c (vectorize_loops): Ditto.
+ (gate_vect_slp): Ditto.
+ (gate_increase_alignment): Ditto.
+ * tree-ssa-pre.c (inhibit_phi_insertion): Ditto.
+ * tree-ssa-loop.c (gate_tree_vectorize): Ditto.
+ (gate_tree_vectorize): Name change.
+ (tree_vectorize): Ditto.
+ (pass_vectorize::gate): Call new function.
+ (pass_vectorize::execute): Ditto.
+ * opts.c: O3 default setting change.
+ (finish_options): Check new flag.
+ * doc/invoke.texi: Document new flags.
+ * common.opt: New flags.
+
+2013-09-16 Andreas Schwab <schwab@linux-m68k.org>
+
+ * doc/tm.texi.in (Cond Exec Macros): Remove node.
+ (Condition Code): Don't reference it.
+ * doc/tm.texi: Regenerate.
+
+2013-09-16 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR middle-end/58418
+ * lra-constraints.c (undo_optional_reloads): Consider all optional
+ reload even if it did not get a hard reg.
+
+2013-09-16 Teresa Johnson <tejohnson@google.com>
+
+ * dumpfile.c (dump_loc): Remove newline emission.
+ * tree-vect-data-refs.c (vect_lanes_optab_supported_p): Add newline
+ emission to dump_printf_loc calls where missing.
+ (vect_mark_for_runtime_alias_test): Ditto.
+ (vect_analyze_data_ref_dependence): Ditto.
+ (vect_analyze_data_ref_dependences): Ditto.
+ (vect_slp_analyze_data_ref_dependence): Ditto.
+ (vect_slp_analyze_data_ref_dependences): Ditto.
+ (vect_compute_data_ref_alignment): Ditto.
+ (vect_update_misalignment_for_peel): Ditto.
+ (vect_verify_datarefs_alignment): Ditto.
+ (vector_alignment_reachable_p): Ditto.
+ (vect_get_data_access_cost): Ditto.
+ (vect_enhance_data_refs_alignment): Ditto.
+ (vect_find_same_alignment_drs): Ditto.
+ (vect_analyze_data_refs_alignment): Ditto.
+ (vect_analyze_group_access): Ditto.
+ (vect_analyze_data_ref_access): Ditto.
+ (vect_analyze_data_ref_accesses): Ditto.
+ (vect_prune_runtime_alias_test_list): Ditto.
+ (vect_analyze_data_refs): Ditto.
+ (vect_create_addr_base_for_vector_ref): Ditto.
+ (vect_create_data_ref_ptr): Ditto.
+ (vect_grouped_store_supported): Ditto.
+ (vect_grouped_load_supported): Ditto.
+ * value-prof.c (check_counter): Ditto.
+ (check_ic_target): Ditto.
+ * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Ditto.
+ (vect_recog_widen_mult_pattern): Ditto.
+ (vect_recog_widen_sum_pattern): Ditto.
+ (vect_recog_over_widening_pattern): Ditto.
+ (vect_recog_widen_shift_pattern): Ditto.
+ (vect_recog_rotate_pattern): Ditto.
+ (vect_recog_vector_vector_shift_pattern): Ditto.
+ (vect_recog_divmod_pattern): Ditto.
+ (vect_recog_mixed_size_cond_pattern): Ditto.
+ (vect_recog_bool_pattern): Ditto.
+ (vect_pattern_recog_1): Ditto.
+ (vect_pattern_recog): Ditto.
+ * tree-vect-loop.c (vect_determine_vectorization_factor): Ditto.
+ (vect_is_simple_iv_evolution): Ditto.
+ (vect_analyze_scalar_cycles_1): Ditto.
+ (vect_get_loop_niters): Ditto.
+ (vect_analyze_loop_1): Ditto.
+ (vect_analyze_loop_form): Ditto.
+ (vect_analyze_loop_operations): Ditto.
+ (vect_analyze_loop_2): Ditto.
+ (vect_analyze_loop): Ditto.
+ (report_vect_op): Ditto.
+ (vect_is_slp_reduction): Ditto.
+ (vect_is_simple_reduction_1): Ditto.
+ (vect_get_known_peeling_cost): Ditto.
+ (vect_estimate_min_profitable_iters): Ditto.
+ (vect_model_reduction_cost): Ditto.
+ (vect_model_induction_cost): Ditto.
+ (get_initial_def_for_induction): Ditto.
+ (vect_create_epilog_for_reduction): Ditto.
+ (vectorizable_reduction): Ditto.
+ (vectorizable_induction): Ditto.
+ (vectorizable_live_operation): Ditto.
+ (vect_loop_kill_debug_uses): Ditto.
+ (vect_transform_loop): Ditto.
+ * tree-vect-stmts.c (vect_mark_relevant): Ditto.
+ (vect_stmt_relevant_p): Ditto.
+ (process_use): Ditto.
+ (vect_mark_stmts_to_be_vectorized): Ditto.
+ (vect_model_simple_cost): Ditto.
+ (vect_model_promotion_demotion_cost): Ditto.
+ (vect_model_store_cost): Ditto.
+ (vect_get_store_cost): Ditto.
+ (vect_model_load_cost): Ditto.
+ (vect_get_load_cost): Ditto.
+ (vect_init_vector_1): Ditto.
+ (vect_get_vec_def_for_operand): Ditto.
+ (vect_finish_stmt_generation): Ditto.
+ (vectorizable_call): Ditto.
+ (vectorizable_conversion): Ditto.
+ (vectorizable_assignment): Ditto.
+ (vectorizable_shift): Ditto.
+ (vectorizable_operation): Ditto.
+ (vectorizable_store): Ditto.
+ (vectorizable_load): Ditto.
+ (vectorizable_condition): Ditto.
+ (vect_analyze_stmt): Ditto.
+ (vect_transform_stmt): Ditto.
+ (vect_is_simple_use): Ditto.
+ * tree-vect-loop-manip.c (slpeel_make_loop_iterate_ntimes): Ditto.
+ (vect_can_advance_ivs_p): Ditto.
+ (vect_update_ivs_after_vectorizer): Ditto.
+ (vect_do_peeling_for_loop_bound): Ditto.
+ (vect_gen_niters_for_prolog_loop): Ditto.
+ (vect_update_inits_of_drs): Ditto.
+ (vect_create_cond_for_alias_checks): Ditto.
+ * tree-vect-slp.c (vect_get_and_check_slp_defs): Ditto.
+ (vect_build_slp_tree_1): Ditto.
+ (vect_supported_load_permutation_p): Ditto.
+ (vect_analyze_slp_instance): Ditto.
+ (vect_analyze_slp): Ditto.
+ (vect_make_slp_decision): Ditto.
+ (vect_detect_hybrid_slp): Ditto.
+ (vect_bb_vectorization_profitable_p): Ditto.
+ (vect_slp_analyze_bb_1): Ditto.
+ (vect_update_slp_costs_according_to_vf): Ditto.
+ (vect_get_mask_element): Ditto.
+ (vect_transform_slp_perm_load): Ditto.
+ (vect_schedule_slp_instance): Ditto.
+ (vect_schedule_slp): Ditto.
+ (vect_slp_transform_bb): Ditto.
+ * profile.c (read_profile_edge_counts): Ditto.
+ (compute_branch_probabilities): Ditto.
+ * coverage.c (get_coverage_counts): Ditto.
+
+2013-09-16 Diego Novillo <dnovillo@google.com>
+
+ * tree-core.h: Add missing comment lines from refactoring of tree.h.
+
+2013-09-16 Jan Hubicka <jh@suse.cz>
+
+ * gimple-fold.c (can_refer_decl_in_current_unit_p): Do not accept
+ abstract functions; for static functions check the presence of body.
+
+2013-09-16 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/aarch64/aarch64-simd-builtins.def (fma): New.
+ * config/aarch64/aarch64-simd.md
+ (aarch64_mla_elt<mode>): New.
+ (aarch64_mla_elt_<vswap_width_name><mode>): Likewise.
+ (aarch64_mls_elt<mode>): Likewise.
+ (aarch64_mls_elt_<vswap_width_name><mode>): Likewise.
+ (aarch64_fma4_elt<mode>): Likewise.
+ (aarch64_fma4_elt_<vswap_width_name><mode>): Likewise.
+ (aarch64_fma4_elt_to_128v2df): Likewise.
+ (aarch64_fma4_elt_to_64df): Likewise.
+ (fnma<mode>4): Likewise.
+ (aarch64_fnma4_elt<mode>): Likewise.
+ (aarch64_fnma4_elt_<vswap_width_name><mode>): Likewise.
+ (aarch64_fnma4_elt_to_128v2df): Likewise.
+ (aarch64_fnma4_elt_to_64df): Likewise.
+ * config/aarch64/iterators.md (VDQSF): New.
+ * config/aarch64/arm_neon.h
+ (vfm<as><sdq>_lane<q>_f<32, 64>): Convert to C implementation.
+ (vml<sa><q>_lane<q>_<fsu><16, 32, 64>): Likewise.
+
+2013-09-16 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/aarch64/aarch64-simd.md (aarch64_mul3_elt<mode>): New.
+ (aarch64_mul3_elt_<vswap_width_name><mode>): Likewise.
+ (aarch64_mul3_elt_to_128df): Likewise.
+ (aarch64_mul3_elt_to_64v2df): Likewise.
+ * config/aarch64/iterators.md (VEL): Also handle DFmode.
+ (VMUL): New.
+ (VMUL_CHANGE_NLANES) Likewise.
+ (h_con): Likewise.
+ (f): Likewise.
+ * config/aarch64/arm_neon.h
+ (vmul<q>_lane<q>_<suf><16,32,64>): Convert to C implementation.
+
+2013-09-16 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/aarch64/arm_neon.h
+ (vcvtx_high_f32_f64): Fix parameters.
+
+2013-09-16 Jan-Benedict Glaw <jbglaw@lug-owl.de>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha.c: Include tree-ssanames.h.
+
+2013-09-16 Richard Biener <rguenther@suse.de>
+
+ * tree-loop-distribution.c (enum rdg_dep_type): Add control_dd.
+ (dot_rdg_1): Handle control_dd.
+ (create_edge_for_control_dependence): New function.
+ (create_rdg_edges): Add control dependences if asked for.
+ (build_rdg): Likewise.
+ (generate_loops_for_partition): If there are not necessary
+ control stmts remove all their dependencies.
+ (collect_condition_stmts, rdg_flag_loop_exits): Remove.
+ (distribute_loop): Pass on control dependences.
+ (tree_loop_distribution): Compute control dependences and remove
+ restriction on number of loop nodes.
+
+2013-09-16 Jakub Jelinek <jakub@redhat.com>
+
+ * ipa-prop.c (ipa_compute_jump_functions_for_edge): Return early
+ for internal calls.
+
+2013-09-16 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * cse.c (try_const_anchors): Punt on CC modes.
+
+2013-09-15 Jan-Benedict Glaw <jbglaw@lug-owl.de>
+
+ * config/vax/constraints.md (T): Add missing CONSTANT_P check.
+
+2013-09-14 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/58382
+ * config/pa/pa.c (pa_expand_prologue): Change mode in gen_rtx_POST_INC
+ calls to word_mode.
+
+2013-09-14 Iain Sandoe <iain@codesourcery.com>
+
+ PR target/48094
+ * config/darwin.c (darwin_objc2_section): Note if ObjC Metadata is
+ seen.
+ (darwin_objc1_section): Likewise.
+ (darwin_file_end): Emit Image Info section when required.
+
+2013-09-14 Jan Hubicka <jh@suse.cz>
+
+ * tree-into-ssa.c (gate_into_ssa): New.
+ (pass_data_build_ssa): Use it.
+ * cgraph.h (expand_thunk): Update prototype.
+ * cgraphunit.c (analyze_function): Expand thunks early.
+ (expand_thunk): Fix DECL_CONTEXT of reust_decl;
+ build proper cgraph; set in_ssa_p; clear bogus TREE_ASM_WRITTEN;
+ set lowered flag; do not add new function.
+ (assemble_thunks_and_aliases): Update.
+ * tree-ssa.c (gate_init_datastructures): New gate.
+ (pass_data_init_datastructures): Use it.
+
+2013-09-14 Iain Sandoe <iain@codesourcery.com>
+
+ PR target/58269
+ * config/i386/i386.c (ix86_function_arg_regno_p): Make Darwin use the
+ xmm register set described in the psABI.
+
+2013-09-13 Evgeny Gavrin <e.gavrin@samsung.com>
+
+ * dwarf2out.c (should_emit_struct_debug): Add check
+ for type_decl variable is not NULL.
+
+2013-09-13 Jacek Caban <jacek@codeweavers.com>
+
+ * config.gcc: Use new winnt-c.c target hooks
+ * config/t-winnt: New file
+ * config/winnt-c.c: New file
+ * doc/tm.texi.in: Document new hook
+ * doc/tm.texi: Regenerated
+
+2013-09-13 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/58094
+ * ipa-inline.c (check_callers): New function.
+ (check_caller_edge): Remove.
+ (want_inline_function_to_all_callers_p): Also permit alises that are
+ called dirrectly.
+ (inline_to_all_callers): Terminate the walk when devirtualization
+ introduce new calls.
+
+2013-09-13 Jan Hubicka <jh@suse.cz>
+
+ * ipa-inline-analysis.c (struct growth_data): Add node.
+ (do_estimate_growth_1): Fix detection of recursion.
+
+2013-09-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/58392
+ * tree-cfg.c (move_sese_region_to_fn): Rename loop variable
+ to avoid shadowing of outer loop variable. If
+ saved_cfun->has_simduid_loops or saved_cfun->has_force_vect_loops,
+ replace_by_duplicate_decl simduid of loops that have it set and
+ set dest_cfun->has_simduid_loops and/or
+ dest_cfun->has_force_vect_loops.
+ * omp-low.c (build_outer_var_ref): Call maybe_lookup_decl_in_outer_ctx
+ instead of maybe_lookup_decl.
+ * tree-inline.c (copy_loops): Change blocks_to_copy argument to id.
+ Use id->blocks_to_copy instead of blocks_to_copy. Adjust recursive
+ call. Copy over force_vect and copy and remap simduid. Set
+ cfun->has_simduid_loops and/or cfun->has_force_vect_loops.
+ (copy_cfg_body): Remove blocks_to_copy argument. Use
+ id->blocks_to_copy instead of blocks_to_copy. Adjust copy_loops
+ caller. Don't set cfun->has_simduid_loops and/or
+ cfun->has_force_vect_loops here.
+ (copy_body): Remove blocks_to_copy argument. Adjust copy_cfg_body
+ caller.
+ (expand_call_inline, tree_function_versioning): Adjust copy_body
+ callers.
+
+2013-09-13 Martin Jambor <mjambor@suse.cz>
+
+ PR bootstrap/58388
+ * ipa-prop.c (try_make_edge_direct_simple_call): Be less strict in
+ the assert if the edge was a speculative one.
+
+2013-09-13 Richard Biener <rguenther@suse.de>
+
+ * tree-data-ref.h (known_dependences_p): Move here ...
+ * tree-loop-distribution.c (known_dependences_p): ... from here.
+ (dump_rdg_component, debug_rdg_component): Remove.
+ (dump_rdg): Adjust.
+ (generate_loops_for_partition): Use gimple_uid instead of
+ relying on matching stmt visit order.
+ (rdg_build_partitions): Take starting stmt vector.
+ (ldist_gen): Merge into ...
+ (distribute_loop): ... this function. Do not compute starting
+ vertices vector.
+ * tree-cfg.c (gimple_duplicate_bb): Copy UID for PHIs.
+
+2013-09-13 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/arm/arm.md (arm_cmpsi_insn): Split rI alternative.
+ Set type attribute correctly. Set predicable_short_it attribute.
+ (cmpsi_shiftsi): Remove %? from output template.
+
+2013-09-13 Richard Biener <rguenther@suse.de>
+
+ * tree-loop-distribution.c (struct rdg_component,
+ rdg_defs_used_in_other_loops_p, free_rdg_components,
+ rdg_build_components): Remove.
+ (stmts_from_loop): Do not record virtual PHIs.
+ (generate_loops_for_partition): Skip virtual PHIs.
+ (build_rdg_partition_for_component): Rename to ...
+ (build_rdg_partition_for_vertex): ... this and adjust.
+ (rdg_build_partitions): Take a vector of starting vertices
+ instead of components. Remove unnecessary leftover handling.
+ (ldist_gen): Do not build components or record other stores.
+ (distribute_loop): Do not distribute loops containing stmts
+ with side-effects.
+
+2013-09-13 Christian Bruel <christian.bruel@st.com>
+
+ PR target/58314
+ * config/sh/sh.md (mov<mode>_reg_reg): Allow memory reloads.
+
+2013-09-13 Kai Tietz <ktietz@redhat.com>
+
+ * config.gcc: Separate cases for mingw and cygwin targets,
+ and add 64-bit cygwin target case.
+
+ * config/i386/winnt-cxx.c (i386_pe_type_dllexport_p): Don't
+ dll-export inline-functions.
+ * config/i386/winnt.c (i386_pe_determine_dllexport_p): Likewise.
+
+
+2013-09-13 Jeff Law <law@redhat.com>
+
+ PR middle-end/58387
+ Revert:
+ 2013-09-06 Jeff Law <law@redhat.com>
+
+ * tree-ssa-dom.c (cprop_into_successor_phis): Also propagate
+ edge implied equivalences into successor phis.
+
+2013-09-12 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/rl78-virt.md: Change from | to \; for asm line
+ separators.
+
+2013-09-12 Brooks Moses <bmoses@google.com>
+
+ PR driver/42955
+ * Makefile.in: Do not install driver binaries in $(target)/bin.
+
+2013-09-12 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/rl78.opt (mrelax): New.
+ * config/rl78/rl78.h (ASM_SPEC): New, pass on -mrelax to gas.
+ * config/rl78/rl78.h (LINK_SPEC): New, pass on -mrelax to ld.
+
+ * config/rl78/rl78.c (rl78_expand_prologue): Use AX to copy
+ between SP and FP.
+ (rl78_expand_epilogue): Likewise.
+
+2013-09-12 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR middle-end/58335
+ * lra-eliminations.c (remove_reg_equal_offset_note): New.
+ (eliminate_regs_in_insn): Rewrite frame pointer to hard frame
+ pointer elimination with using remove_reg_equal_offset_note.
+
+2013-09-12 DJ Delorie <dj@redhat.com>
+
+ * config/msp430/: New port.
+ * config.gcc (msp430): Added.
+ * doc/invoke.texi: Document MSP430 options.
+ * doc/install.texi: Document msp430-elf
+ * doc/md.texi: Document msp430-elf
+ * doc/contrib.texi: Document msp430-elf
+
+ * cfgexpand.c (expand_debug_expr): Avoid sign-extending SImode to
+ PSImode.
+
+2013-09-12 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/58389
+ * ipa-prop.c (remove_described_reference): Give up if the edge in the
+ reference descriptor is NULL.
+ (ipa_edge_removal_hook): If owning a reference descriptor, set its
+ edge to NULL.
+
+2013-09-12 Andrew MacLeod <amacleod@redhat.com>
+
+ * tree-flow.h (FREE_SSANAMES): Move to tree-ssanames.c
+ (SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS, ptr_info_def,
+ num_ssa_names, ssa_name): Move to tree-ssanames.h + prototypes.
+ * tree-flow-inline.h (make_ssa_name, copy_ssa_name, duplicate_ssa_name,
+ make_temp_ssa_name): move to tree-ssanames.h
+ * tree-ssa-alias.h: Move prototype.
+ * tree-ssa.h: Include tree-ssanames.h.
+ * tree-ssanames.c (FREE_SSANAMES): Move to here.
+ * tree-ssanames.h: New. Move items from tree-flow*.h
+ * Makefile.in (tree-ssanames.h): Add to tree-ssanames.o and GTFILES.
+
+2013-09-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58404
+ * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also
+ propagate non-invariant addresses into dereferences wrapped
+ in component references.
+
+2013-09-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58402
+ * passes.def: Move pass_late_warn_uninitialized later.
+
+2013-09-12 Andrew MacLeod <amacleod@redhat.com>
+
+ * tree-ssa.h: New. Move content from tree-flow.h and
+ tree-flow-inline.h.
+ * tree-flow.h (_edge_var_map, edge_var_map_vector): Move to tree-ssa.h.
+ Move prototypes belonging to tree-ssa.c.
+ * tree-flow-inline.h (redirect_edge_var_map_def,
+ redirect_edge_var_map_result, redirect_edge_var_map_location): Move to
+ tree-ssa.h.
+ * gimple.h: Adjust prototypes.
+ * tree-ssa.c (useless_type_conversion_p, types_compatible_p): Move
+ to...
+ * gimple.c (useless_type_conversion_p, types_compatible_p): Here.
+ * tree.h: Move prototype to tree-ssa.h.
+ * gengtype.c (open_base_files): Replace tree-flow.h with tree-ssa.h.
+ * Makefile.in: (TREE_SSA_H, TREE_FLOW_H): Adjust dependencies.
+ * alias.c, asan.c, builtins.c, calls.c, cfgexpand.c, cfghooks.c,
+ cfgloop.c, cfgloopmanip.c, cgraph.c, cgraphbuild.c, cgraphclones.c,
+ cgraphunit.c, dse.c, except.c, expr.c, final.c, fold-const.c,
+ ggc-page.c, gimple-fold.c, gimple-iterator.c, gimple-low.c,
+ gimple-pretty-print.c, gimple-ssa-strength-reduction.c,
+ gimple-streamer-in.c, gimple-streamer-out.c, gimple.c, gimplify.c,
+ graphite-blocking.c, graphite-clast-to-gimple.c,
+ graphite-dependences.c, graphite-interchange.c,
+ graphite-optimize-isl.c, graphite-poly.c, graphite-scop-detection.c,
+ graphite-sese-to-poly.c, graphite.c, ipa-cp.c, ipa-inline-analysis.c,
+ ipa-inline-transform.c, ipa-inline.c, ipa-prop.c, ipa-pure-const.c,
+ ipa-reference.c, ipa-split.c, ipa-utils.c,
+ loop-init.c, lto-cgraph.c, lto-section-in.c, lto-section-out.c,
+ lto-streamer-in.c, lto-streamer-out.c, lto-streamer.c, omp-low.c,
+ passes.c, predict.c, print-tree.c, profile.c, sese.c, targhooks.c,
+ tracer.c, trans-mem.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c,
+ tree-chrec.c, tree-complex.c, tree-data-ref.c, tree-dfa.c, tree-eh.c,
+ tree-emutls.c, tree-if-conv.c, tree-inline.c, tree-into-ssa.c,
+ tree-loop-distribution.c, tree-mudflap.c, tree-nested.c, tree-nrv.c,
+ tree-object-size.c, tree-optimize.c, tree-outof-ssa.c, tree-parloops.c,
+ tree-phinodes.c, tree-predcom.c, tree-pretty-print.c, tree-profile.c,
+ tree-scalar-evolution.c, tree-sra.c, tree-ssa*.c, tree-stdarg.c,
+ tree-streamer-in.c, tree-switch-conversion.c, tree-tailcall.c,
+ tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c,
+ tree-vect-loop.c, tree-vect-patterns.c, tree-vect-slp.c,
+ tree-vect-stmts.c, tree-vectorizer.c, tree-vrp.c, tsan.c,
+ value-prof.c, var-tracking.c,
+ varpool.c, vtable-verify.c: Replace tree-flow.h with tree-ssa.h
+
+2013-09-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58396
+ * tree-loop-distribution.c (create_rdg_edges): Free unused DDRs.
+ (build_rdg): Take a loop-nest parameter, fix memleaks.
+ (distribute_loop): Compute loop-nest here and pass it to build_rdg.
+
+2013-09-12 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ * config/i386/x86-tune.def: Turn on X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE
+ for SLM.
+
+2013-09-12 Cameron McInally <cameron.mcinally@nyu.edu>
+
+ * doc/extend.texi: Fix errors in x86 FMA builtin naming.
+ The FMA instruction names should have a 'v' prefix.
+
+2013-09-12 Richard Biener <rguenther@suse.de>
+
+ * tree-loop-distribution.c (dot_rdg_1): Make graph prettier.
+ (dot_rdg): Use popen instead of system in optional code.
+ (remaining_stmts, upstream_mem_writes): Remove global bitmaps.
+ (already_processed_vertex_p): Adjust.
+ (has_anti_or_output_dependence, predecessor_has_mem_write,
+ mark_nodes_having_upstream_mem_writes, has_upstream_mem_writes,
+ rdg_flag_uses): Remove.
+ (rdg_flag_vertex): Simplify.
+ (rdg_flag_vertex_and_dependent): Rely on a correct RDG and
+ remove recursion.
+ (build_rdg_partition_for_component): Process the first vertex
+ of a component only.
+ (ldist_gen): Do not compute remaining_stmts or upstream_mem_writes.
+
+2013-09-12 Alan Modra <amodra@gmail.com>
+
+ * config/rs6000/rs6000.c (toc_relative_expr_p): Use add_cint_operand.
+
+2013-09-11 DJ Delorie <dj@redhat.com>
+ Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/predicates.md (rl78_cmp_operator_signed): New.
+ (rl78_stack_based_mem): New.
+ * config/rl78/constraints.md (Iv08): New.
+ (Iv16): New.
+ (Iv24): New.
+ (Is09): New.
+ (Is17): New.
+ (Is25): New.
+ (ISsi): New.
+ (IShi): New.
+ (ISqi): New.
+ * config/rl78/rl78-expand.md (movqi): Reject more SUBREG operands.
+ (movhi): Likewise.
+ (movsi): Change from expand to insn-and-split.
+ (ashrsi3): Clobber AX.
+ (lshrsi3): New.
+ (ashlsi3): New.
+ (cbranchsi4): New.
+ * config/rl78/rl78.md (CC_REG): Fix.
+ (addsi3): Allow memory and immediate operands.
+ (addsi3_internal): Split into...
+ (addsi3_internal_virt): ...new, and ...
+ (addsi3_internal_real): ...new.
+ (subsi): New.
+ (subsi3_internal_virt): New.
+ (subsi3_internal_real): New.
+ (mulsi3): Add memory operand.
+ (mulsi3_rl78): Likewise.
+ (mulsi3_g13): Likewise.
+ * config/rl78/rl78-real.md (cbranchqi4_real_signed): New.
+ (cbranchqi4_real): Add more constraint options.
+ (cbranchhi4_real): Expand pattern.
+ (cbranchhi4_real_signed): New.
+ (cbranchhi4_real_inverted): New.
+ (cbranchsi4_real_lt): New.
+ (cbranchsi4_real_ge): New.
+ (cbranchsi4_real_signed): New.
+ (cbranchsi4_real): New.
+ (peephole2): New.
+ * config/rl78/rl78-virt.md (ashrsi3_virt): Add custom cases for
+ constant shifts.
+ (lshrsi3_virt): Likewise.
+ (ashlsi3_virt): Likewise.
+ (cbranchqi4_virt_signed): New.
+ (cbranchhi4_virt_signed): New.
+ (cbranchsi4_virt): New.
+ * config/rl78/rl78.c: Whitespace fixes throughout.
+ (move_elim_pass): New.
+ (pass_data_rl78_move_elim): New.
+ (pass_rl78_move_elim): New.
+ (make_pass_rl78_move_elim): New.
+ (rl78_devirt_info): Run devirt earlier.
+ (rl78_move_elim_info): New.
+ (rl78_asm_file_start): Register it.
+ (rl78_split_movsi): New.
+ (rl78_as_legitimate_address): Allow virtual base registers when
+ appropriate.
+ (rl78_addr_space_convert): Remove spurious debug stuff.
+ (rl78_print_operand_1): Add z,s,S,r,E modifiers.
+ (rl78_print_operand): More cases for not printing '#'.
+ (rl78_expand_compare): Remove most of the logic.
+ (content_memory): New.
+ (clear_content_memory): New.
+ (get_content_index): New.
+ (get_content_name): New.
+ (display_content_memory): New.
+ (update_content): New.
+ (record_content): New.
+ (already_contains): New.
+ (insn_ok_now): Re-recog insns with virtual registers.
+ (add_postponed_content_update): New.
+ (process_postponed_content_update): New.
+ (gen_and_emit_move): New.
+ (transcode_memory_rtx): Record new location content.
+ Use gen_and_emit_move.
+ (force_into_acc): New.
+ (move_to_acc): Use gen_and_emit_move.
+ (move_from_acc): Likewise.
+ (move_acc_to_reg): Likewise.
+ (move_to_x): Likewise.
+ (move_to_hl): Likewise.
+ (move_to_de): Likewise.
+ (rl78_alloc_physical_registers_op1): Record location content.
+ (has_constraint): New.
+ (rl78_alloc_physical_registers_op2): Record location content.
+ Optimize use of HL.
+ (rl78_alloc_physical_registers_ro1): Likewise.
+ (rl78_alloc_physical_registers_cmp): Likewise.
+ (rl78_alloc_physical_registers_umul): Likewise.
+ (rl78_alloc_address_registers_macax): New.
+ (rl78_alloc_physical_registers): Initialize and set location
+ content memory as needed.
+ (rl78_reorg): Make sure split2 is called.
+ (rl78_rtx_costs): New.
+
+2013-09-11 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * simplify-rtx.c (simplify_unary_operation_1): Use simplify_gen_binary
+ for (not (neg ...)) and (neg (not ...)) cases.
+
+2013-09-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58377
+ * passes.def: Split critical edges before late uninit warning passes.
+ * tree-cfg.c (pass_split_crit_edges): Implement clone method.
+
+2013-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/58385
+ * fold-const.c (build_range_check): If both low and high are NULL,
+ use omit_one_operand_loc to preserve exp side-effects.
+
+2013-09-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/arm/arm.md (arm_shiftsi3): New alternative l/l/M.
+
+2013-09-11 Richard Biener <rguenther@suse.de>
+
+ * tree-data-ref.c (dump_rdg_vertex, debug_rdg_vertex,
+ dump_rdg_component, debug_rdg_component, dump_rdg, debug_rdg,
+ dot_rdg_1, dot_rdg, rdg_vertex_for_stmt, create_rdg_edge_for_ddr,
+ create_rdg_edges_for_scalar, create_rdg_edges, create_rdg_vertices,
+ stmts_from_loop, known_dependences_p, build_empty_rdg,
+ build_rdg, free_rdg, rdg_defs_used_in_other_loops_p): Move ...
+ * tree-loop-distribution.c: ... here.
+ * tree-data-ref.h (struct rdg_vertex, RDGV_STMT, RDGV_DATAREFS,
+ RDGV_HAS_MEM_WRITE, RDGV_HAS_MEM_READS, RDG_STMT, RDG_DATAREFS,
+ RDG_MEM_WRITE_STMT, RDG_MEM_READS_STMT, enum rdg_dep_type,
+ struct rdg_edge, RDGE_TYPE, RDGE_LEVEL, RDGE_RELATION): Move ...
+ * tree-loop-distribution.c: ... here.
+ * tree-loop-distribution.c: Include gimple-pretty-print.h.
+ (struct partition_s): Add loops member.
+ (partition_alloc, partition_free, rdg_flag_uses, rdg_flag_vertex,
+ rdg_flag_vertex_and_dependent, rdg_flag_loop_exits,
+ build_rdg_partition_for_component, rdg_build_partitions): Adjust.
+
+2013-09-11 Alexander Ivchenko <alexander.ivchenko@intel.com>
+ Maxim Kuznetsov <maxim.kuznetsov@intel.com>
+ Sergey Lega <sergey.s.lega@intel.com>
+ Anna Tikhonova <anna.tikhonova@intel.com>
+ Ilya Tocar <ilya.tocar@intel.com>
+ Andrey Turetskiy <andrey.turetskiy@intel.com>
+ Ilya Verbin <ilya.verbin@intel.com>
+ Kirill Yukhin <kirill.yukhin@intel.com>
+ Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * config/i386/constraints.md (k): New.
+ (Yk): Ditto.
+ * config/i386/i386.c (const regclass_map): Add new mask registers.
+ (dbx_register_map): Ditto.
+ (dbx64_register_map): Ditto.
+ (svr4_dbx_register_map): Ditto.
+ (ix86_conditional_register_usage): Squash mask registers if AVX512F is
+ disabled.
+ (ix86_preferred_reload_class): Disable constants for mask registers.
+ (ix86_secondary_reload): Do spill of mask register using 32-bit insn.
+ (ix86_hard_regno_mode_ok): Support new mask registers.
+ (x86_order_regs_for_local_alloc): Ditto.
+ * config/i386/i386.h (FIRST_PSEUDO_REGISTER): Update.
+ (FIXED_REGISTERS): Add new mask registers.
+ (CALL_USED_REGISTERS): Ditto.
+ (REG_ALLOC_ORDER): Ditto.
+ (VALID_MASK_REG_MODE): New.
+ (FIRST_MASK_REG): Ditto.
+ (LAST_MASK_REG): Ditto.
+ (reg_class): Add MASK_EVEX_REGS, MASK_REGS.
+ (MAYBE_MASK_CLASS_P): New.
+ (REG_CLASS_NAMES): Add MASK_EVEX_REGS, MASK_REGS.
+ (REG_CLASS_CONTENTS): Ditto.
+ (MASK_REGNO_P): New.
+ (ANY_MASK_REG_P): Ditto.
+ (HI_REGISTER_NAMES): Add new mask registers.
+ * config/i386/i386.md (MASK0_REG, MASK1_REG, MASK2_REG, MASK3_REG,
+ MASK4_REG, MASK5_REG, MASK6_REG, MASK7_REG): Constants for new
+ mask registers.
+ (attribute "type"): Add mskmov, msklog.
+ (attribute "length_immediate"): Support them.
+ (attribute "memory"): Ditto.
+ (attribute "prefix_0f"): Ditto.
+ (*movhi_internal): Support new mask registers.
+ (*movqi_internal): Ditto.
+ (define_split): Split out clobber pattern is a logic
+ insn on mask registers.
+ (*k<logic><mode>): New.
+ (*andhi_1): Extend to support mask regs.
+ (*andqi_1): Extend to support mask regs.
+ (kandn<mode>): New.
+ (define_split): Split and-not to and and not if operands
+ are not mask regs.
+ (*<code><mode>_1): Separate HI mode to new pattern...
+ (*<code>hi_1): This.
+ (*<code>qi_1): Extend to support mask regs.
+ (kxnor<mode>): New.
+ (kortestzhi): Ditto.
+ (kortestchi): Ditto.
+ (kunpckhi): Ditto.
+ (*one_cmpl<mode>2_1): Remove HImode and handle it...
+ (*one_cmplhi2_1): ...Here, now with mask registers support.
+ (*one_cmplqi2_1): Support new mask registers.
+ (HI/QImode arithmetics splitter): Don't split if mask registers
+ are used.
+ (HI/QImode not splitter): Ditto.
+ * config/i386/predicated.md (mask_reg_operand): New.
+ (general_reg_operand): Ditto.
+
+2013-09-11 Alexander Ivchenko <alexander.ivchenko@intel.com>
+
+ * doc/invoke.texi: Document fxsr, xsave and xsaveopt options.
+ * doc/extend.texi: Document fxsr, xsave and xsaveopt builtins.
+
+2013-09-10 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/58380
+ * tree-ssa-threadupdate.c (thread_block): Recognize another case
+ of threading through a buried loop header.
+
+ * tree-ssa-threadedge.c (thread_around_empty_blocks): Correct
+ return value for single successor case.
+
+2013-09-10 Jan Hubicka <jh@suse.cz>
+
+ * ipa-devirt.c (ipa_devirt): Enable with LTO.
+
+2013-09-10 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/58361
+ * arm/vfp.md (combine_vcvt_f32_<FCVTI32typename>): Fix pattern to
+ support conditional execution.
+ (combine_vcvt_f64_<FCVTI32typename>): Likewise.
+
+2013-09-10 Vladimir Makarov <vmakarov@redhat.com>
+
+ * lra.c (lra): Clear lra_optional_reload_pseudos before every
+ constraint pass.
+ * lra-constraints.c (curr_insn_transform): Switch on optional reloads.
+ Check destination too to check move insn.
+ (undo_optional_reloads): Add check that the original peudo did not
+ changed its allocation and the optional reload was inherited on last
+ inheritance pass. Break loop after deciding to keep optional reload.
+ (lra_undo_inheritance): Add check that inherited pseudo still in
+ memory.
+
+2013-09-10 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/aarch64/aarch64.md (generic_sched): New.
+ * config/aarch64/aarch64-generic.md (load): Make conditional
+ on generic_sched attribute.
+ (nonload): Likewise.
+
+2013-09-10 Jan Hubicka <jh@suse.cz>
+
+ * lto-cgraph.c: Include ipa-utils.h.
+ (compute_ltrans_boundary): Also add possible targets into the boundary.
+
+2013-09-10 Jan Hubicka <jh@suse.cz>
+
+ * gimple-fold.c (gimple_get_virt_method_for_binfo): Pass real
+ VAR_DECL of vtable rather than full expression.
+
+2013-09-10 Jan Hubicka <jh@suse.cz>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ * cgraphunit.c (analyze_functions): Save input_location, set it
+ to UNKNOWN_LOCATION and restore it at the end.
+
+2013-09-10 Martin Jambor <mjambor@suse.cz>
+
+ * ipa-cp.c (propagate_constants_topo): Do not ignore SCC
+ represented by a thunk.
+
+2013-09-10 Jeff Law <law@redhat.com>
+
+ PR tree-optimization/58343
+ * tree-ssa-threadupdate.c (thread_block): Identify and disable
+ jump threading requests through loop headers buried in the middle
+ of a jump threading path.
+
+ * tree-ssa-threadedge.c (thread_around_empty_blocks): Fix thinko
+ in return value/type.
+
+2013-09-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/58365
+ * cfgcleanup.c (merge_memattrs): Also clear MEM_READONLY_P
+ resp. MEM_NOTRAP_P if they differ, or set MEM_VOLATILE_P if
+ it differs.
+
+2013-09-10 Richard Biener <rguenther@suse.de>
+
+ * tree-data-ref.h (build_rdg): Drop all parameters but loop.
+ * tree-data-ref.c (create_rdg_vertices): Collect all data
+ references, signal failure to the caller, use data-ref API.
+ (build_rdg): Compute data references only once. Maintain lifetime
+ of data references and data dependences from within RDG.
+ (free_rdg): Free dependence relations.
+ * tree-loop-distribution.c (rdg_flag_uses): Drop weird code
+ inventing extra dependences.
+ (distribute_loop): Update for RDG API changes.
+
+2013-09-10 Kai Tietz <ktietz@redhat.com>
+
+ * doc/invoke.texi (fms-extensions): Document changed
+ behavior for ms-abi targets.
+ * config/i386/i386.c (ix86_option_override_internal):
+ Set default value of option -fms-extension for ms-abi targets.
+
+2013-09-10 Michael Zolotukhin <michael.v.zolotukhin@gmail.com>
+
+ * config/i386/i386.c (ix86_expand_movmem): Fix epilogue generation.
+
2013-09-10 Alan Modra <amodra@gmail.com>
PR target/58330
@@ -1512,7 +3962,7 @@
2013-09-04 Dodji Seketeli <dodji@redhat.com>
* tree.h (DECL_BUILT_IN, DECL_IS_BUILTIN): Add more comments
- explaining their differences.
+ explaining their differences.
2013-09-04 Sandeep Kumar Singh<Sandeep.Singh2@kpitcummins.com>
@@ -2758,12 +5208,12 @@
2013-08-21 Kirill Yukhin <kirill.yukhin@intel.com>
- * config/i386/sse.md (V16): Rename to...
- (VMOVE): this.
- (mov<mode>): Update iterator name.
- (*mov<mode>_internal): Ditto.
- (push<mode>1): Ditto.
- (movmisalign<mode>): Ditto.
+ * config/i386/sse.md (V16): Rename to...
+ (VMOVE): this.
+ (mov<mode>): Update iterator name.
+ (*mov<mode>_internal): Ditto.
+ (push<mode>1): Ditto.
+ (movmisalign<mode>): Ditto.
2013-08-20 Jan Hubicka <jh@suse.cz>
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 48a3cc43241..3eae4dd9329 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20130910
+20131001
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 09dc63d8a0d..c13086d8974 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -308,9 +308,15 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
# UNSORTED
# --------
-# Some compilers can't handle cc -c blah.c -o foo/blah.o.
-# In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
-OUTPUT_OPTION = @OUTPUT_OPTION@
+# Dependency tracking stuff.
+CCDEPMODE = @CCDEPMODE@
+DEPDIR = @DEPDIR@
+depcomp = $(SHELL) $(srcdir)/../depcomp
+
+# In the past we used AC_PROG_CC_C_O and set this properly, but
+# it was discovered that this hadn't worked in a long time, so now
+# we just hard-code.
+OUTPUT_OPTION = -o $@
# This is where we get zlib from. zlibdir is -L../zlib and zlibinc is
# -I../zlib, unless we were configured with --with-system-zlib, in which
@@ -440,16 +446,12 @@ STRIP_FOR_TARGET := $(shell \
HASHTAB_H = $(srcdir)/../include/hashtab.h
OBSTACK_H = $(srcdir)/../include/obstack.h
SPLAY_TREE_H= $(srcdir)/../include/splay-tree.h
-FIBHEAP_H = $(srcdir)/../include/fibheap.h
-PARTITION_H = $(srcdir)/../include/partition.h
MD5_H = $(srcdir)/../include/md5.h
-DWARF2_H = $(srcdir)/../include/dwarf2.h $(srcdir)/../include/dwarf2.def
XREGEX_H = $(srcdir)/../include/xregex.h
FNMATCH_H = $(srcdir)/../include/fnmatch.h
# Linker plugin API headers
LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
-LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
@@ -858,14 +860,11 @@ LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
C_TARGET_DEF_H = c-family/c-target-def.h c-family/c-target-hooks-def.h \
$(TREE_H) $(C_COMMON_H) $(HOOKS_H) common/common-targhooks.h
-COMMON_TARGET_DEF_H = common/common-target-def.h \
- common/common-target-hooks-def.h $(HOOKS_H)
RTL_BASE_H = coretypes.h rtl.h rtl.def $(MACHMODE_H) reg-notes.def \
insn-notes.def $(INPUT_H) $(REAL_H) statistics.h $(VEC_H) \
$(FIXED_VALUE_H) alias.h $(HASHTAB_H)
FIXED_VALUE_H = fixed-value.h $(MACHMODE_H) double-int.h
RTL_H = $(RTL_BASE_H) $(FLAGS_H) genrtl.h
-RTL_ERROR_H = rtl-error.h $(RTL_H) $(DIAGNOSTIC_CORE_H)
READ_MD_H = $(OBSTACK_H) $(HASHTAB_H) read-md.h
PARAMS_H = params.h params.def
BUILTINS_DEF = builtins.def sync-builtins.def omp-builtins.def \
@@ -885,12 +884,8 @@ BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) \
GIMPLE_H = gimple.h gimple.def gsstruct.def pointer-set.h $(VEC_H) \
$(GGC_H) $(BASIC_BLOCK_H) $(TREE_H) tree-ssa-operands.h \
tree-ssa-alias.h $(INTERNAL_FN_H) $(HASH_TABLE_H)
-TRANS_MEM_H = trans-mem.h
GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h
-COVERAGE_H = coverage.h $(GCOV_IO_H)
-DEMANGLE_H = $(srcdir)/../include/demangle.h
RECOG_H = recog.h
-ALIAS_H = alias.h
EMIT_RTL_H = emit-rtl.h
FLAGS_H = flags.h flag-types.h $(OPTIONS_H)
OPTIONS_H = options.h flag-types.h $(OPTIONS_H_EXTRA)
@@ -899,11 +894,6 @@ FUNCTION_H = function.h $(HASHTAB_H) $(TM_H) hard-reg-set.h \
EXPR_H = expr.h insn-config.h $(FUNCTION_H) $(RTL_H) $(FLAGS_H) $(TREE_H) $(MACHMODE_H) $(EMIT_RTL_H)
OPTABS_H = optabs.h insn-codes.h insn-opinit.h
REGS_H = regs.h $(MACHMODE_H) hard-reg-set.h
-SCHED_INT_H = sched-int.h $(INSN_ATTR_H) $(BASIC_BLOCK_H) $(RTL_H) $(DF_H) \
- $(REGSET_H)
-SEL_SCHED_IR_H = sel-sched-ir.h $(INSN_ATTR_H) $(BASIC_BLOCK_H) $(RTL_H) \
- $(GGC_H) $(BITMAP_H) $(SCHED_INT_H) $(CFGLOOP_H) $(REGSET_H)
-SEL_SCHED_DUMP_H = sel-sched-dump.h $(SEL_SCHED_IR_H)
CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) double-int.h \
$(BITMAP_H) sbitmap.h
IPA_UTILS_H = ipa-utils.h $(TREE_H) $(CGRAPH_H)
@@ -912,20 +902,16 @@ CGRAPH_H = cgraph.h $(VEC_H) $(TREE_H) $(BASIC_BLOCK_H) $(FUNCTION_H) \
cif-code.def ipa-ref.h ipa-ref-inline.h $(LINKER_PLUGIN_API_H) is-a.h
DF_H = df.h $(BITMAP_H) $(REGSET_H) sbitmap.h $(BASIC_BLOCK_H) \
alloc-pool.h $(TIMEVAR_H)
-VALTRACK_H = valtrack.h $(BITMAP_H) $(DF_H) $(RTL_H) $(BASIC_BLOCK_H) \
- $(HASH_TABLE_H)
RESOURCE_H = resource.h hard-reg-set.h $(DF_H)
-DDG_H = ddg.h sbitmap.h $(DF_H)
GCC_H = gcc.h version.h $(DIAGNOSTIC_CORE_H)
GGC_H = ggc.h gtype-desc.h statistics.h
-GGC_INTERNAL_H = ggc-internal.h $(GGC_H)
TIMEVAR_H = timevar.h timevar.def
INSN_ATTR_H = insn-attr.h insn-attr-common.h $(INSN_ADDR_H)
INSN_ADDR_H = $(srcdir)/insn-addr.h
C_COMMON_H = c-family/c-common.h c-family/c-common.def $(TREE_H) \
$(SPLAY_TREE_H) $(CPPLIB_H) $(GGC_H) $(DIAGNOSTIC_CORE_H)
C_PRAGMA_H = c-family/c-pragma.h $(CPPLIB_H)
-C_TREE_H = c-tree.h $(C_COMMON_H) $(DIAGNOSTIC_H)
+C_TREE_H = c/c-tree.h $(C_COMMON_H) $(DIAGNOSTIC_H)
SYSTEM_H = system.h hwint.h $(srcdir)/../include/libiberty.h \
$(srcdir)/../include/safe-ctype.h $(srcdir)/../include/filenames.h
PREDICT_H = predict.h predict.def
@@ -933,11 +919,6 @@ CPPLIB_H = $(srcdir)/../libcpp/include/line-map.h \
$(srcdir)/../libcpp/include/cpplib.h
INPUT_H = $(srcdir)/../libcpp/include/line-map.h input.h
OPTS_H = $(INPUT_H) $(VEC_H) opts.h $(OBSTACK_H)
-DECNUM_H = $(DECNUM)/decContext.h $(DECNUM)/decDPD.h $(DECNUM)/decNumber.h \
- $(DECNUMFMT)/decimal32.h $(DECNUMFMT)/decimal64.h \
- $(DECNUMFMT)/decimal128.h $(DECNUMFMT)/decimal128Local.h
-BACKTRACE_H = $(BACKTRACE)/backtrace.h
-MKDEPS_H = $(srcdir)/../libcpp/include/mkdeps.h
SYMTAB_H = $(srcdir)/../libcpp/include/symtab.h $(OBSTACK_H)
CPP_ID_DATA_H = $(CPPLIB_H) $(srcdir)/../libcpp/include/cpp-id-data.h
CPP_INTERNAL_H = $(srcdir)/../libcpp/internal.h $(CPP_ID_DATA_H)
@@ -947,49 +928,26 @@ TREE_FLOW_H = tree-flow.h tree-flow-inline.h tree-ssa-operands.h \
$(BITMAP_H) sbitmap.h $(BASIC_BLOCK_H) $(GIMPLE_H) \
$(HASHTAB_H) $(CGRAPH_H) $(IPA_REFERENCE_H) \
tree-ssa-alias.h
-TREE_HASHER_H = tree-hasher.h $(HASH_TABLE_H) $(TREE_FLOW_H)
-TREE_SSA_LIVE_H = tree-ssa-live.h $(PARTITION_H)
-SSAEXPAND_H = ssaexpand.h $(TREE_SSA_LIVE_H)
+TREE_SSA_H = tree-ssa.h $(TREE_FLOW_H)
PRETTY_PRINT_H = pretty-print.h $(INPUT_H) $(OBSTACK_H)
TREE_PRETTY_PRINT_H = tree-pretty-print.h $(PRETTY_PRINT_H)
GIMPLE_PRETTY_PRINT_H = gimple-pretty-print.h $(TREE_PRETTY_PRINT_H)
DIAGNOSTIC_CORE_H = diagnostic-core.h $(INPUT_H) bversion.h diagnostic.def
DIAGNOSTIC_H = diagnostic.h $(DIAGNOSTIC_CORE_H) $(PRETTY_PRINT_H)
-DWARF2OUT_H = dwarf2out.h $(DWARF2_H)
C_PRETTY_PRINT_H = c-family/c-pretty-print.h $(PRETTY_PRINT_H) \
$(C_COMMON_H) $(TREE_H)
-SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h $(PARAMS_H)
-OMEGA_H = omega.h $(PARAMS_H)
-TREE_DATA_REF_H = tree-data-ref.h $(OMEGA_H) graphds.h $(SCEV_H)
TREE_INLINE_H = tree-inline.h
REAL_H = real.h $(MACHMODE_H)
-IRA_INT_H = ira.h ira-int.h $(CFGLOOP_H) alloc-pool.h
-LRA_INT_H = lra.h $(BITMAP_H) $(RECOG_H) $(INSN_ATTR_H) insn-codes.h \
- insn-config.h $(REGS_H) lra-int.h
-DBGCNT_H = dbgcnt.h dbgcnt.def
LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \
$(CGRAPH_H) $(VEC_H) $(HASH_TABLE_H) $(TREE_H) $(GIMPLE_H) \
$(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h pointer-set.h
-DATA_STREAMER_H = data-streamer.h $(VEC_H) $(LTO_STREAMER_H)
-GIMPLE_STREAMER_H = gimple-streamer.h $(LTO_STREAMER_H) $(BASIC_BLOCK_H) \
- $(FUNCTION_H)
-TREE_STREAMER_H = tree-streamer.h $(TREE_H) $(LTO_STREAMER_H) \
- $(STREAMER_HOOKS_H)
-STREAMER_HOOKS_H = streamer-hooks.h $(TREE_H)
-TREE_VECTORIZER_H = tree-vectorizer.h $(TREE_DATA_REF_H) $(TARGET_H) \
- $(HASH_TABLE_H)
IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h
-IPA_INLINE_H = ipa-inline.h $(IPA_PROP_H)
-GSTAB_H = gstab.h stab.def
BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
GCC_PLUGIN_H = gcc-plugin.h highlev-plugin-common.h plugin.def \
$(CONFIG_H) $(SYSTEM_H) $(HASHTAB_H)
PLUGIN_H = plugin.h $(GCC_PLUGIN_H)
PLUGIN_VERSION_H = plugin-version.h configargs.h
-LIBFUNCS_H = libfuncs.h $(HASHTAB_H)
-GRAPHITE_HTAB_H = graphite-htab.h graphite-clast-to-gimple.h $(HASH_TABLE_H)
CONTEXT_H = context.h
-PASS_MANAGER_H = pass_manager.h pass-instances.def
#
# Now figure out from those variables how to compile and link.
@@ -1070,8 +1028,23 @@ INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
$(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \
$(CLOOGINC) $(ISLINC)
+COMPILE.base = $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) -o $@
+ifeq ($(CCDEPMODE),depmode=gcc3)
+# Note a subtlety here: we use $(@D) for the directory part, to make
+# things like the go/%.o rule work properly; but we use $(*F) for the
+# file part, as we just want the file part of the stem, not the entire
+# file name.
+COMPILE = $(COMPILE.base) -MT $@ -MMD -MP -MF $(@D)/$(DEPDIR)/$(*F).TPo
+POSTCOMPILE = @mv $(@D)/$(DEPDIR)/$(*F).TPo $(@D)/$(DEPDIR)/$(*F).Po
+else
+COMPILE = source='$<' object='$@' libtool=no \
+ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) $(COMPILE.base)
+POSTCOMPILE =
+endif
+
.cc.o .c.o:
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $< $(OUTPUT_OPTION)
+ $(COMPILE) $<
+ $(POSTCOMPILE)
#
# Support for additional languages (other than C).
@@ -1247,6 +1220,7 @@ OBJS = \
gcse.o \
ggc-common.o \
gimple.o \
+ gimple-builder.o \
gimple-iterator.o \
gimple-fold.o \
gimple-low.o \
@@ -1499,7 +1473,8 @@ ALL_HOST_FRONTEND_OBJS = $(foreach v,$(CONFIG_LANGUAGES),$($(v)_OBJS))
ALL_HOST_BACKEND_OBJS = $(GCC_OBJS) $(OBJS) $(OBJS-libcommon) \
$(OBJS-libcommon-target) @TREEBROWSER@ main.o c-family/cppspec.o \
- $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS)
+ $(COLLECT2_OBJS) $(EXTRA_GCC_OBJS) $(GCOV_OBJS) $(GCOV_DUMP_OBJS) \
+ lto-wrapper.o
# This lists all host object files, whether they are included in this
# compilation or not.
@@ -1872,13 +1847,6 @@ srcextra: gcc.srcextra lang.srcextra
gcc.srcextra: gengtype-lex.c
-cp -p $^ $(srcdir)
-graph.o: graph.c graph.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DIAGNOSTIC_CORE_H) sbitmap.h $(BASIC_BLOCK_H) $(CFGLOOP_H) \
- $(PRETTY_PRINT_H) $(DUMPFILE_H)
-
-sbitmap.o: sbitmap.c sbitmap.h $(CONFIG_H) $(SYSTEM_H) coretypes.h
-sparseset.o: sparseset.c $(SYSTEM_H) sparseset.h $(CONFIG_H)
-
AR_OBJS = file-find.o
AR_LIBS = @COLLECT2_LIBS@
@@ -1898,20 +1866,14 @@ CFLAGS-gcc-ar.o += $(DRIVER_DEFINES) \
-DTARGET_MACHINE=\"$(target_noncanonical)\" \
@TARGET_SYSTEM_ROOT_DEFINE@ -DPERSONALITY=\"ar\"
-gcc-ar.o: gcc-ar.c $(CONFIG_H) $(SYSTEM_H) $(LIBIBERTY_H)
-
CFLAGS-gcc-ranlib.o += $(DRIVER_DEFINES) \
-DTARGET_MACHINE=\"$(target_noncanonical)\" \
@TARGET_SYSTEM_ROOT_DEFINE@ -DPERSONALITY=\"ranlib\"
-gcc-ranlib.o: gcc-ranlib.c $(CONFIG_H) $(SYSTEM_H) $(LIBIBERTY_H)
-
CFLAGS-gcc-nm.o += $(DRIVER_DEFINES) \
-DTARGET_MACHINE=\"$(target_noncanonical)\" \
@TARGET_SYSTEM_ROOT_DEFINE@ -DPERSONALITY=\"nm\"
-gcc-nm.o: gcc-nm.c $(CONFIG_H) $(SYSTEM_H) $(LIBIBERTY_H)
-
# ??? the implicit rules dont trigger if the source file has a different name
# so copy instead
gcc-ranlib.c: gcc-ar.c
@@ -1930,129 +1892,26 @@ collect2$(exeext): $(COLLECT2_OBJS) $(LIBDEPS)
CFLAGS-collect2.o += -DTARGET_MACHINE=\"$(target_noncanonical)\" \
@TARGET_SYSTEM_ROOT_DEFINE@
-collect2.o : collect2.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h \
- $(OBSTACK_H) $(DEMANGLE_H) collect2.h collect2-aix.h version.h \
- $(DIAGNOSTIC_H) file-find.h
-
-collect2-aix.o : collect2-aix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- collect2-aix.h
-
-tlink.o: tlink.c $(DEMANGLE_H) $(HASHTAB_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(OBSTACK_H) collect2.h intl.h $(DIAGNOSTIC_CORE_H) $(VEC_H)
lto-wrapper$(exeext): lto-wrapper.o ggc-none.o libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_COMPILERFLAGS) $(LDFLAGS) -o T$@ \
lto-wrapper.o ggc-none.o libcommon-target.a $(LIBS)
mv -f T$@ $@
-lto-wrapper.o: lto-wrapper.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h \
- $(OBSTACK_H) $(DIAGNOSTIC_H) $(OPTS_H) $(OPTIONS_H)
-
# Files used by all variants of C or by the stand-alone pre-processor.
-c-family/cppspec.o: c-family/cppspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(GCC_H) $(OPTS_H)
-
-c-family/c-common.o : c-family/c-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) \
- $(OBSTACK_H) $(C_COMMON_H) $(FLAGS_H) toplev.h output.h $(C_PRAGMA_H) \
- $(GGC_H) builtin-types.def builtin-attrs.def \
- $(DIAGNOSTIC_H) langhooks.h c-family/c-objc.h \
- $(TARGET_H) tree-iterator.h langhooks.h tree-mudflap.h \
- intl.h $(OPTS_H) $(CPPLIB_H) $(TREE_INLINE_H) $(HASHTAB_H) \
- $(BUILTINS_DEF) $(CGRAPH_H) $(TARGET_DEF_H) \
- gt-c-family-c-common.h $(COMMON_TARGET_H)
-
-c-family/c-cppbuiltin.o : c-family/c-cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) version.h $(C_COMMON_H) $(C_PRAGMA_H) \
- $(FLAGS_H) output.h $(TREE_H) $(TARGET_H) $(COMMON_TARGET_H) \
- $(TM_P_H) debug.h $(CPP_ID_DATA_H) cppbuiltin.h
-
-c-family/c-dump.o : c-family/c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(TREE_DUMP_H)
-
-c-family/c-format.o : c-family/c-format.c c-family/c-format.h \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
- $(C_COMMON_H) $(FLAGS_H) intl.h $(C_TARGET_H) \
- $(DIAGNOSTIC_CORE_H) alloc-pool.h c-family/c-objc.h
-
-c-family/c-gimplify.o : c-family/c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(C_COMMON_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) \
- $(FLAGS_H) langhooks.h $(LANGHOOKS_DEF_H) \
- $(TM_H) coretypes.h $(C_PRETTY_PRINT_H) $(CGRAPH_H) \
- $(DUMPFILE_H) $(TREE_INLINE_H)
-
-c-family/c-lex.o : c-family/c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(FIXED_VALUE_H) debug.h $(C_COMMON_H) $(SPLAY_TREE_H) \
- $(C_PRAGMA_H) $(INPUT_H) intl.h $(FLAGS_H) \
- $(CPPLIB_H) $(TARGET_H) $(TIMEVAR_H)
-
-c-family/c-omp.o : c-family/c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(C_COMMON_H) $(GIMPLE_H) langhooks.h
CFLAGS-c-family/c-opts.o += @TARGET_SYSTEM_ROOT_DEFINE@
-c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h langhooks.h \
- $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) $(C_TARGET_H) \
- $(OPTS_H) $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h
CFLAGS-c-family/c-pch.o += -DHOST_MACHINE=\"$(host)\" \
-DTARGET_MACHINE=\"$(target)\"
-c-family/c-pch.o : c-family/c-pch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(CPPLIB_H) $(TREE_H) $(C_COMMON_H) output.h $(C_PRAGMA_H) \
- $(GGC_H) debug.h langhooks.h $(FLAGS_H) hosthooks.h version.h \
- $(TARGET_H) $(OPTS_H) $(TIMEVAR_H)
-
-c-family/c-ppoutput.o : c-family/c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(CPP_INTERNAL_H) \
- $(C_PRAGMA_H)
-
-c-family/c-pragma.o: c-family/c-pragma.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(FUNCTION_H) $(C_PRAGMA_H) output.h \
- $(TM_P_H) $(C_COMMON_H) $(TARGET_H) $(CPPLIB_H) $(FLAGS_H) \
- $(DIAGNOSTIC_H) $(OPTS_H) $(PLUGINS_H) \
- gt-c-family-c-pragma.h
-
-c-family/c-pretty-print.o : c-family/c-pretty-print.c $(C_PRETTY_PRINT_H) \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(DIAGNOSTIC_H) tree-iterator.h intl.h $(TREE_PRETTY_PRINT_H)
-
-c-family/c-semantics.o : c-family/c-semantics.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(FLAGS_H) \
- $(C_COMMON_H) $(FUNCTION_H) langhooks.h $(SPLAY_TREE_H) $(TIMEVAR_H) \
- tree-iterator.h
-
-c-family/c-ada-spec.o : c-family/c-ada-spec.c c-family/c-ada-spec.h \
- $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPP_ID_DATA_H) $(TM_H) \
- coretypes.h tree-iterator.h $(DUMPFILE_H)
-
-c-family/array-notation-common.o : c-family/array-notation-common.c $(TREE_H) \
- $(SYSTEM_H) $(TREE_H) coretypes.h tree-iterator.h $(DIAGNOSTIC_CORE_H)
-
-c-family/stub-objc.o : c-family/stub-objc.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-objc.h
-
-c-family/c-ubsan.o : c-family/c-ubsan.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-ubsan.h \
- alloc-pool.h $(CGRAPH_H) $(GIMPLE_H) $(HASH_TABLE_H) output.h \
- toplev.h ubsan.h
-default-c.o: config/default-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(C_TARGET_H) $(C_TARGET_DEF_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $< $(OUTPUT_OPTION)
-# Files used by all variants of C and some other languages.
-
-attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(HASH_TABLE_H) $(FLAGS_H) $(DIAGNOSTIC_CORE_H) $(GGC_H) $(TM_P_H) \
- $(TARGET_H) langhooks.h $(CPPLIB_H) $(PLUGIN_H)
+default-c.o: config/default-c.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
-incpath.o: incpath.c incpath.h $(CONFIG_H) $(SYSTEM_H) $(CPPLIB_H) \
- intl.h prefix.h coretypes.h $(TM_H) cppdefault.h $(TARGET_H) \
- $(MACHMODE_H)
+# Files used by all variants of C and some other languages.
CFLAGS-prefix.o += -DPREFIX=\"$(prefix)\" -DBASEVER=$(BASEVER_s)
-prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_H) coretypes.h prefix.h \
- $(COMMON_TARGET_H) Makefile $(BASEVER)
# Language-independent files.
@@ -2067,16 +1926,10 @@ DRIVER_DEFINES = \
@RUNTIME_ROOT_PREFIX_DEFINE@ \
@TARGET_SYSTEM_ROOT_DEFINE@ \
$(VALGRIND_DRIVER_DEFINES) \
- `test "X$${SHLIB}" = "X" || test "@enable_shared@" != "yes" || echo "-DENABLE_SHARED_LIBGCC"` \
+ $(and $(SHLIB),$(filter yes,@enable_shared@),-DENABLE_SHARED_LIBGCC) \
-DCONFIGURE_SPECS="\"@CONFIGURE_SPECS@\""
-gcc.o: gcc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) intl.h multilib.h \
- Makefile $(lang_specs_files) specs.h prefix.h $(GCC_H) $(FLAGS_H) \
- configargs.h $(OBSTACK_H) $(OPTS_H) $(DIAGNOSTIC_H) $(VEC_H) $(PARAMS_H)
- (SHLIB='$(SHLIB)'; \
- $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $(DRIVER_DEFINES) \
- -c $(srcdir)/gcc.c $(OUTPUT_OPTION))
+CFLAGS-gcc.o += $(DRIVER_DEFINES)
specs.h : s-specs ; @true
s-specs : Makefile
@@ -2113,619 +1966,15 @@ s-options-h: optionlist $(srcdir)/opt-functions.awk $(srcdir)/opt-read.awk \
$(SHELL) $(srcdir)/../move-if-change tmp-options.h options.h
$(STAMP) $@
-options.o: options.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(OPTS_H) intl.h $(OPTIONS_C_EXTRA) insn-attr-common.h
-
-options-save.o: options-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) $(FLAGS_H) \
- $(TM_H) $(OPTS_H) intl.h $(OPTIONS_C_EXTRA)
-
dumpvers: dumpvers.c
CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
-DREVISION=$(REVISION_s) \
-DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \
-DBUGURL=$(BUGURL_s)
-version.o: version.c version.h $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
-
-gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(HASHTAB_H) $(SPLAY_TREE_H) $(OBSTACK_H) $(BITMAP_H) \
- $(INPUT_H) $(TREE_H) $(RTL_H) $(FUNCTION_H) insn-config.h $(EXPR_H) \
- hard-reg-set.h $(BASIC_BLOCK_H) cselib.h $(INSN_ADDR_H) $(OPTABS_H) \
- $(LIBFUNCS_H) debug.h $(GGC_H) $(CGRAPH_H) $(TREE_FLOW_H) reload.h \
- $(CPP_ID_DATA_H) tree-chrec.h $(EXCEPT_H) output.h \
- $(CFGLOOP_H) $(TARGET_H) $(IPA_PROP_H) $(LTO_STREAMER_H) \
- target-globals.h
-
-trans-mem.o : trans-mem.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(HASH_TABLE_H) \
- $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) $(TREE_PASS_H) $(TREE_INLINE_H) \
- $(DIAGNOSTIC_CORE_H) $(DEMANGLE_H) output.h $(TRANS_MEM_H) \
- $(PARAMS_H) $(TARGET_H) langhooks.h \
- $(GIMPLE_PRETTY_PRINT_H) $(CFGLOOP_H) \
- gt-trans-mem.h
-
-ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(GGC_H) $(HASH_TABLE_H) $(DIAGNOSTIC_CORE_H) $(PARAMS_H) hosthooks.h \
- $(HOSTHOOKS_DEF_H) $(VEC_H) $(PLUGIN_H) $(GGC_INTERNAL_H) $(TIMEVAR_H)
-
-ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
- $(FLAGS_H) $(DIAGNOSTIC_CORE_H) $(GGC_H) $(TIMEVAR_H) $(TM_P_H) $(PARAMS_H) \
- $(TREE_FLOW_H) $(PLUGIN_H) $(GGC_INTERNAL_H)
-
-ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
- $(BCONFIG_H)
-
-stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(GGC_H) $(GGC_INTERNAL_H) gt-stringpool.h $(CPPLIB_H) $(SYMTAB_H)
-
-convert.o: convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(FLAGS_H) convert.h $(DIAGNOSTIC_CORE_H) langhooks.h
-
-double-int.o: double-int.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
# lto-compress.o needs $(ZLIBINC) added to the include flags.
CFLAGS-lto-compress.o += $(ZLIBINC)
-lto-compress.o: lto-compress.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) langhooks.h $(LTO_STREAMER_H) $(LTO_SECTION_H) \
- lto-compress.h $(DIAGNOSTIC_CORE_H) $(DIAGNOSTIC_CORE_H)
-data-streamer-in.o: data-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DATA_STREAMER_H) $(DIAGNOSTIC_H) value-prof.h
-data-streamer-out.o: data-streamer-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DATA_STREAMER_H) value-prof.h
-data-streamer.o: data-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DATA_STREAMER_H)
-gimple-streamer-in.o: gimple-streamer-in.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GIMPLE_STREAMER_H) $(TREE_FLOW_H) $(DATA_STREAMER_H) \
- $(TREE_STREAMER_H) $(DIAGNOSTIC_H)
-gimple-streamer-out.o: gimple-streamer-out.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(GIMPLE_STREAMER_H) $(DATA_STREAMER_H) $(TREE_FLOW_H) \
- $(LTO_STREAMER_H) $(TREE_STREAMER_H)
-tree-streamer.o: tree-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_STREAMER_H) $(STREAMER_HOOKS_H)
-tree-streamer-in.o: tree-streamer-in.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DIAGNOSTIC_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_STREAMER_H) \
- $(DATA_STREAMER_H) $(STREAMER_HOOKS_H) $(LTO_STREAMER_H)
-tree-streamer-out.o: tree-streamer-out.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DIAGNOSTIC_H) $(TREE_STREAMER_H) $(DATA_STREAMER_H) \
- $(STREAMER_HOOKS_H) $(TM_H)
-streamer-hooks.o: streamer-hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(STREAMER_HOOKS_H)
-lto-cgraph.o: lto-cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(DIAGNOSTIC_CORE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
- $(HASHTAB_H) langhooks.h $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_CORE_H) \
- $(EXCEPT_H) $(TIMEVAR_H) pointer-set.h $(LTO_STREAMER_H) \
- $(GCOV_IO_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H) $(TREE_PASS_H) \
- profile.h $(CONTEXT_H) $(PASS_MANAGER_H)
-lto-streamer-in.o: lto-streamer-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) \
- input.h $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
- $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(DIAGNOSTIC_H) $(EXCEPT_H) debug.h \
- $(IPA_UTILS_H) $(LTO_STREAMER_H) toplev.h $(CFGLOOP_H) \
- $(DATA_STREAMER_H) $(GIMPLE_STREAMER_H) $(TREE_STREAMER_H)
-lto-streamer-out.o : lto-streamer-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(DIAGNOSTIC_CORE_H) $(TREE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
- $(HASHTAB_H) $(BASIC_BLOCK_H) tree-iterator.h $(CFGLOOP_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) \
- $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(LTO_STREAMER_H) $(DIAGNOSTIC_CORE_H) \
- $(DATA_STREAMER_H) $(STREAMER_HOOKS_H) $(GIMPLE_STREAMER_H) \
- $(TREE_STREAMER_H)
-lto-section-in.o: lto-section-in.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(DIAGNOSTIC_CORE_H) $(EXPR_H) $(FLAGS_H) $(PARAMS_H) input.h \
- $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(CGRAPH_H) $(FUNCTION_H) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(TIMEVAR_H) \
- $(LTO_STREAMER_H) lto-compress.h
-lto-section-out.o : lto-section-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(DIAGNOSTIC_CORE_H) $(TREE_H) $(EXPR_H) $(PARAMS_H) input.h \
- $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
- $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(EXCEPT_H) pointer-set.h \
- $(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h \
- $(DATA_STREAMER_H)
-lto-opts.o: lto-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(HASHTAB_H) $(GGC_H) $(BITMAP_H) $(FLAGS_H) $(OPTS_H) $(OPTIONS_H) \
- $(COMMON_TARGET_H) $(DIAGNOSTIC_H) $(LTO_STREAMER_H)
-lto-streamer.o: lto-streamer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(GIMPLE_H) $(BITMAP_H) $(LTO_STREAMER_H) $(FLAGS_H) \
- $(TREE_FLOW_H) $(DIAGNOSTIC_CORE_H) $(LTO_SYMTAB_H) toplev.h \
- $(DIAGNOSTIC_CORE_H) $(STREAMER_HOOKS_H)
-langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TIMEVAR_H) \
- $(TREE_H) toplev.h $(DIAGNOSTIC_CORE_H) $(TREE_INLINE_H) $(RTL_H) insn-config.h \
- langhooks.h $(TARGET_H) $(LANGHOOKS_DEF_H) $(FLAGS_H) $(GGC_H) $(DIAGNOSTIC_H) \
- intl.h $(GIMPLE_H) $(CGRAPH_H) output.h tree-diagnostic.h
-test-dump.o : test-dump.c $(CONFIG_H) $(SYSTEM_H) $(CORETYPES_H) \
- $(BITMAP_H) sbitmap.h sreal.h $(TREE_H) $(CXX_PARSER_H) $(DWARF2OUT_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(BASIC_BLOCK_H) insn-config.h $(LRA_INT.H) \
- $(SEL_SCHED_DUMP_H) $(IRA_INT_H) $(TREE_DATA_REF_H) $(TREE_FLOW_H) \
- $(TREE_SSA_LIVE_H) tree-ssa-alias.h $(OMEGA_H) $(RTL_H)
-tree.o: tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- all-tree.def $(FLAGS_H) $(FUNCTION_H) $(PARAMS_H) \
- toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) \
- langhooks.h gt-tree.h $(TREE_INLINE_H) tree-iterator.h \
- $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(OBSTACK_H) pointer-set.h \
- $(TREE_PASS_H) $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) $(CGRAPH_H) \
- $(EXCEPT_H) debug.h intl.h tree-diagnostic.h $(TREE_PRETTY_PRINT_H) \
- $(COMMON_TARGET_H)
-tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TREE_H) \
- langhooks.h $(TREE_DUMP_H) tree-iterator.h $(TREE_PRETTY_PRINT_H)
-tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(RTL_H) $(FLAGS_H) $(PARAMS_H) $(INPUT_H) insn-config.h \
- $(HASHTAB_H) langhooks.h $(TREE_INLINE_H) $(CGRAPH_H) \
- intl.h $(FUNCTION_H) $(GIMPLE_H) $(CFGLOOP_H) \
- debug.h $(DIAGNOSTIC_H) $(EXCEPT_H) $(TREE_FLOW_H) tree-iterator.h tree-mudflap.h \
- $(IPA_PROP_H) value-prof.h $(TREE_PASS_H) $(TARGET_H) \
- $(TREE_PRETTY_PRINT_H)
-print-tree.o : print-tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(TREE_H) $(GGC_H) langhooks.h tree-iterator.h \
- $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(GIMPLE_PRETTY_PRINT_H) $(TREE_DUMP_H)
-stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(PARAMS_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(RTL_H) \
- $(GGC_H) $(TM_P_H) $(TARGET_H) langhooks.h $(REGS_H) gt-stor-layout.h \
- $(DIAGNOSTIC_CORE_H) $(CGRAPH_H) $(TREE_INLINE_H) $(TREE_DUMP_H) $(GIMPLE_H)
-asan.o : asan.c asan.h $(CONFIG_H) $(SYSTEM_H) $(GIMPLE_H) \
- output.h coretypes.h $(GIMPLE_PRETTY_PRINT_H) $(CFGLOOP_H) \
- tree-iterator.h $(TREE_FLOW_H) $(TREE_PASS_H) \
- $(TARGET_H) $(EXPR_H) $(OPTABS_H) $(TM_P_H) langhooks.h \
- $(HASH_TABLE_H) alloc-pool.h
-tsan.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \
- $(GIMPLE_H) $(DIAGNOSTIC_H) langhooks.h \
- $(TM_H) coretypes.h $(TREE_DUMP_H) $(TREE_PASS_H) $(CGRAPH_H) $(GGC_H) \
- $(BASIC_BLOCK_H) $(FLAGS_H) $(FUNCTION_H) \
- $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) tree-iterator.h \
- intl.h cfghooks.h output.h options.h $(C_COMMON_H) tsan.h asan.h \
- tree-ssa-propagate.h
-ubsan.o : ubsan.c ubsan.h $(CONFIG_H) $(SYSTEM_H) $(GIMPLE_H) \
- output.h coretypes.h $(TREE_H) $(CGRAPH_H) $(HASHTAB_H) gt-ubsan.h \
- toplev.h $(C_COMMON_H) $(TM_P_H)
-tree-ssa-tail-merge.o: tree-ssa-tail-merge.c \
- $(SYSTEM_H) $(CONFIG_H) coretypes.h $(TM_H) $(BITMAP_H) \
- $(FLAGS_H) $(TM_P_H) $(BASIC_BLOCK_H) $(CFGLOOP_H) \
- $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) $(TREE_DUMP_H) $(HASH_TABLE_H) \
- $(GIMPLE_H) $(FUNCTION_H) tree-ssa-sccvn.h \
- $(CGRAPH_H) $(GIMPLE_PRETTY_PRINT_H) $(PARAMS_H)
-tree-ssa-structalias.o: tree-ssa-structalias.c $(SYSTEM_H) $(CONFIG_H) \
- coretypes.h $(HASH_TABLE_H) $(TM_H) $(GGC_H) $(OBSTACK_H) $(BITMAP_H) \
- $(FLAGS_H) $(TM_P_H) $(BASIC_BLOCK_H) \
- $(DIAGNOSTIC_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) \
- $(GIMPLE_H) $(HASH_TABLE_H) $(FUNCTION_H) $(CGRAPH_H) \
- $(TREE_PASS_H) alloc-pool.h $(SPLAY_TREE_H) $(PARAMS_H) \
- $(CGRAPH_H) $(ALIAS_H) pointer-set.h
-tree-ssa-uninit.o : tree-ssa-uninit.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(DIAGNOSTIC_H) \
- $(FUNCTION_H) $(TM_H) coretypes.h \
- $(TREE_PASS_H) $(BASIC_BLOCK_H) $(BITMAP_H) \
- $(FLAGS_H) $(HASHTAB_H) pointer-set.h \
- $(GIMPLE_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(HASH_TABLE_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(DIAGNOSTIC_H) \
- toplev.h $(FUNCTION_H) $(TM_H) coretypes.h \
- langhooks.h $(TREE_PASS_H) $(BASIC_BLOCK_H) $(BITMAP_H) \
- $(FLAGS_H) $(GGC_H) $(HASHTAB_H) pointer-set.h \
- $(GIMPLE_H) $(TREE_INLINE_H) $(TARGET_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(CFGLOOP_H)
-tree-into-ssa.o : tree-into-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(DIAGNOSTIC_CORE_H) \
- $(FUNCTION_H) $(TM_H) coretypes.h \
- langhooks.h domwalk.h $(TREE_PASS_H) $(PARAMS_H) $(BASIC_BLOCK_H) \
- $(BITMAP_H) $(CFGLOOP_H) $(FLAGS_H) $(HASH_TABLE_H) \
- $(GIMPLE_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-ter.o : tree-ssa-ter.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(TREE_SSA_LIVE_H) $(BITMAP_H) $(FLAGS_H) \
- $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-coalesce.o : tree-ssa-coalesce.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(TREE_SSA_LIVE_H) $(BITMAP_H) $(FLAGS_H) $(HASH_TABLE_H) \
- $(TREE_PRETTY_PRINT_H)
-tree-outof-ssa.o : tree-outof-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(TREE_SSA_LIVE_H) $(BASIC_BLOCK_H) $(BITMAP_H) $(GGC_H) \
- $(EXPR_H) $(SSAEXPAND_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-dse.o : tree-ssa-dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(GGC_H) $(TREE_H) $(TM_P_H) $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) domwalk.h $(FLAGS_H) \
- $(GIMPLE_PRETTY_PRINT_H) langhooks.h
-tree-ssa-forwprop.o : tree-ssa-forwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(TM_P_H) $(BASIC_BLOCK_H) $(CFGLOOP_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(DIAGNOSTIC_H) \
- langhooks.h $(FLAGS_H) $(GIMPLE_H) $(GIMPLE_PRETTY_PRINT_H) $(EXPR_H) \
- $(OPTABS_H) tree-ssa-propagate.h
-tree-ssa-phiprop.o : tree-ssa-phiprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(TM_P_H) $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(DIAGNOSTIC_H) \
- langhooks.h $(FLAGS_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-ifcombine.o : tree-ssa-ifcombine.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(DIAGNOSTIC_H) \
- $(TREE_PRETTY_PRINT_H)
-tree-ssa-phiopt.o : tree-ssa-phiopt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(HASH_TABLE_H) $(TM_H) $(GGC_H) $(TREE_H) $(TM_P_H) $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) langhooks.h $(FLAGS_H) \
- $(DIAGNOSTIC_H) pointer-set.h domwalk.h $(CFGLOOP_H) \
- $(TREE_DATA_REF_H) $(TREE_PRETTY_PRINT_H) $(GIMPLE_PRETTY_PRINT_H) \
- insn-config.h $(EXPR_H) $(OPTABS_H) $(SCEV_H)
-tree-nrv.o : tree-nrv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(FUNCTION_H) $(BASIC_BLOCK_H) $(FLAGS_H) \
- $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
- langhooks.h $(TREE_PRETTY_PRINT_H)
-tree-ssa-copy.o : tree-ssa-copy.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(GGC_H) $(DIAGNOSTIC_H) \
- $(FUNCTION_H) $(TM_H) coretypes.h $(SCEV_H) \
- $(BASIC_BLOCK_H) $(TREE_PASS_H) langhooks.h tree-ssa-propagate.h \
- $(FLAGS_H) $(CFGLOOP_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-propagate.o : tree-ssa-propagate.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) \
- $(DIAGNOSTIC_H) $(FUNCTION_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(BASIC_BLOCK_H) langhooks.h \
- tree-ssa-propagate.h $(VEC_H) value-prof.h gt-tree-ssa-propagate.h $(FLAGS_H) \
- $(GIMPLE_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-dom.o : tree-ssa-dom.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(HASH_TABLE_H) $(TREE_H) $(TM_P_H) $(DIAGNOSTIC_H) \
- $(FUNCTION_H) $(TM_H) coretypes.h \
- $(BASIC_BLOCK_H) domwalk.h $(TREE_PASS_H) $(FLAGS_H) langhooks.h \
- tree-ssa-propagate.h $(CFGLOOP_H) $(PARAMS_H) \
- $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-uncprop.o : tree-ssa-uncprop.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(HASH_TABLE_H) $(TREE_H) $(TM_P_H) \
- $(DIAGNOSTIC_H) $(FUNCTION_H) $(TM_H) coretypes.h \
- $(BASIC_BLOCK_H) domwalk.h $(TREE_PASS_H) $(FLAGS_H) \
- tree-ssa-propagate.h
-tree-ssa-threadedge.o : tree-ssa-threadedge.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(DUMPFILE_H) $(TM_H) $(TREE_H) $(FLAGS_H) \
- $(TM_P_H) $(BASIC_BLOCK_H) $(CFGLOOP_H) \
- $(FUNCTION_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) $(TREE_FLOW_H) \
- tree-ssa-propagate.h langhooks.h \
- $(PARAMS_H)
-tree-ssa-threadupdate.o : tree-ssa-threadupdate.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(HASH_TABLE_H) \
- $(DIAGNOSTIC_H) $(FUNCTION_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(BASIC_BLOCK_H) $(FLAGS_H) $(CFGLOOP_H)
-tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_PASS_H)
-tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
- gt-tree-phinodes.h $(DIAGNOSTIC_CORE_H) $(GIMPLE_H)
-domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(BASIC_BLOCK_H) domwalk.h sbitmap.h
-tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(DUMPFILE_H) $(TIMEVAR_H) \
- $(TREE_SSA_LIVE_H) $(BITMAP_H) debug.h $(FLAGS_H) $(HASH_TABLE_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(GIMPLE_H)
-tree-ssa-copyrename.o : tree-ssa-copyrename.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) $(FUNCTION_H) \
- $(TREE_PASS_H) $(TM_H) coretypes.h $(TREE_SSA_LIVE_H) \
- $(BASIC_BLOCK_H) $(BITMAP_H) $(FLAGS_H) $(HASHTAB_H) langhooks.h \
- $(GIMPLE_H) $(TREE_INLINE_H) $(GIMPLE_H)
-tree-ssa-pre.o : tree-ssa-pre.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) \
- $(TM_H) coretypes.h $(TREE_PASS_H) $(FLAGS_H) langhooks.h \
- $(CFGLOOP_H) alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) $(HASH_TABLE_H) \
- $(GIMPLE_H) $(TREE_INLINE_H) tree-iterator.h tree-ssa-sccvn.h $(PARAMS_H) \
- $(DBGCNT_H) tree-scalar-evolution.h $(GIMPLE_PRETTY_PRINT_H) domwalk.h \
- $(IPA_PROP_H)
-tree-ssa-sccvn.o : tree-ssa-sccvn.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) \
- $(TM_H) coretypes.h $(DUMPFILE_H) $(FLAGS_H) $(CFGLOOP_H) \
- alloc-pool.h $(BASIC_BLOCK_H) $(BITMAP_H) $(HASH_TABLE_H) $(GIMPLE_H) \
- $(TREE_INLINE_H) tree-ssa-propagate.h tree-ssa-sccvn.h \
- $(PARAMS_H) $(GIMPLE_PRETTY_PRINT_H) gimple-fold.h
-gimple-ssa-strength-reduction.o : gimple-ssa-strength-reduction.c $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(TREE_H) $(GIMPLE_H) $(BASIC_BLOCK_H) \
- $(HASH_TABLE_H) $(TREE_PASS_H) $(CFGLOOP_H) $(TREE_PRETTY_PRINT_H) \
- $(GIMPLE_PRETTY_PRINT_H) alloc-pool.h $(TREE_FLOW_H) domwalk.h \
- pointer-set.h expmed.h
-tree-vrp.o : tree-vrp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(DIAGNOSTIC_CORE_H) $(GGC_H) \
- $(BASIC_BLOCK_H) tree-ssa-propagate.h $(FLAGS_H) $(TREE_DUMP_H) \
- $(CFGLOOP_H) $(SCEV_H) intl.h \
- $(GIMPLE_PRETTY_PRINT_H) gimple-fold.h $(OPTABS_H) $(EXPR_H)
-tree-cfg.o : tree-cfg.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) $(HASH_TABLE_H) \
- $(TREE_H) $(TM_P_H) $(GGC_H) $(FLAGS_H) $(TARGET_H) \
- $(DIAGNOSTIC_CORE_H) $(FUNCTION_H) $(TM_H) coretypes.h \
- $(TREE_DUMP_H) $(EXCEPT_H) $(CFGLOOP_H) $(TREE_PASS_H) \
- $(BASIC_BLOCK_H) \
- value-prof.h tree-ssa-propagate.h $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-cfgcleanup.o : tree-cfgcleanup.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(GGC_H) $(FLAGS_H) \
- $(DIAGNOSTIC_CORE_H) $(FUNCTION_H) $(TM_H) coretypes.h \
- $(EXCEPT_H) langhooks.h $(CFGLOOP_H) $(TREE_PASS_H) \
- $(BASIC_BLOCK_H) $(HASHTAB_H) \
- tree-ssa-propagate.h $(SCEV_H)
-tree-tailcall.o : tree-tailcall.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(FUNCTION_H) $(TM_H) coretypes.h \
- $(EXCEPT_H) $(TREE_PASS_H) $(FLAGS_H) langhooks.h \
- $(BASIC_BLOCK_H) $(DBGCNT_H) $(GIMPLE_PRETTY_PRINT_H) $(TARGET_H) \
- $(COMMON_TARGET_H) $(CFGLOOP_H) ipa-utils.h
-tree-ssa-sink.o : tree-ssa-sink.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) \
- $(TM_H) coretypes.h $(TREE_PASS_H) $(FLAGS_H) alloc-pool.h \
- $(BASIC_BLOCK_H) $(BITMAP_H) $(CFGLOOP_H) $(HASHTAB_H) \
- $(GIMPLE_H) $(TREE_INLINE_H) tree-iterator.h \
- $(GIMPLE_PRETTY_PRINT_H)
-tree-nested.o: tree-nested.c $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TREE_H) \
- $(TM_P_H) $(FUNCTION_H) $(TREE_DUMP_H) $(TREE_INLINE_H) \
- tree-iterator.h $(GIMPLE_H) $(CGRAPH_H) $(EXPR_H) langhooks.h \
- gt-tree-nested.h coretypes.h $(TREE_FLOW_H) pointer-set.h
-tree-if-conv.o: tree-if-conv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
- $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) $(DIAGNOSTIC_H) \
- $(DBGCNT_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-iterator.o : tree-iterator.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- coretypes.h $(GGC_H) tree-iterator.h $(GIMPLE_H) gt-tree-iterator.h
-tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(GGC_H) $(DIAGNOSTIC_H) \
- $(TREE_INLINE_H) $(HASHTAB_H) pointer-set.h $(FLAGS_H) $(FUNCTION_H) \
- convert.h $(TM_H) coretypes.h langhooks.h \
- $(TREE_PASS_H) $(PARAMS_H) $(CGRAPH_H) $(BASIC_BLOCK_H) $(GIMPLE_H) \
- $(TREE_PRETTY_PRINT_H)
-tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TREE_INLINE_H) \
- $(FLAGS_H) $(FUNCTION_H) $(TM_H) $(TIMEVAR_H) coretypes.h $(DUMPFILE_H) \
- langhooks.h $(IPA_REFERENCE_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_H) $(FLAGS_H) $(FUNCTION_H) $(EXCEPT_H) langhooks.h \
- $(HASH_TABLE_H) $(GGC_H) $(TREE_PASS_H) coretypes.h pointer-set.h \
- $(TREE_INLINE_H) tree-iterator.h toplev.h \
- $(DIAGNOSTIC_CORE_H) $(TARGET_H) $(CFGLOOP_H)
-tree-ssa-loop.o : tree-ssa-loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(TM_P_H) $(BASIC_BLOCK_H) \
- $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
- $(CFGLOOP_H) $(FLAGS_H) $(TREE_INLINE_H) $(SCEV_H) $(DIAGNOSTIC_CORE_H) $(TREE_VECTORIZER_H)
-tree-ssa-loop-unswitch.o : tree-ssa-loop-unswitch.c $(TREE_FLOW_H) \
- $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) \
- $(PARAMS_H) $(DIAGNOSTIC_H) $(TM_H) \
- coretypes.h $(TREE_PASS_H) $(BASIC_BLOCK_H) \
- $(TREE_INLINE_H)
-tree-ssa-address.o : tree-ssa-address.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) \
- $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(FLAGS_H) $(TREE_INLINE_H) $(RECOG_H) insn-config.h \
- $(EXPR_H) gt-tree-ssa-address.h $(GGC_H) tree-affine.h $(TARGET_H) \
- $(TREE_PRETTY_PRINT_H) expmed.h
-tree-ssa-loop-niter.o : tree-ssa-loop-niter.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(PARAMS_H) \
- $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h $(DUMPFILE_H) \
- $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(TREE_DATA_REF_H) \
- $(BASIC_BLOCK_H) $(GGC_H) intl.h $(GIMPLE_PRETTY_PRINT_H) $(TREE_PASS_H)
-tree-ssa-loop-ivcanon.o : tree-ssa-loop-ivcanon.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(PARAMS_H) \
- $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h \
- $(FLAGS_H) $(TREE_PASS_H) $(SCEV_H) $(BASIC_BLOCK_H) $(TARGET_H) \
- $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-loop-ch.o : tree-ssa-loop-ch.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(TREE_INLINE_H) \
- $(DIAGNOSTIC_H) $(TM_H) coretypes.h \
- $(TREE_PASS_H) $(FLAGS_H) $(BASIC_BLOCK_H)
-tree-ssa-loop-prefetch.o: tree-ssa-loop-prefetch.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(EXPR_H) \
- $(DIAGNOSTIC_H) $(TM_H) coretypes.h \
- $(TREE_PASS_H) $(RECOG_H) insn-config.h $(HASHTAB_H) \
- $(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) \
- $(DIAGNOSTIC_CORE_H) langhooks.h $(TREE_INLINE_H) $(TREE_DATA_REF_H) \
- $(OPTABS_H) $(TREE_PRETTY_PRINT_H)
-tree-predcom.o: tree-predcom.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) \
- $(CFGLOOP_H) $(TREE_FLOW_H) $(GGC_H) $(TREE_DATA_REF_H) \
- $(PARAMS_H) $(DIAGNOSTIC_H) $(TREE_PASS_H) $(TM_H) coretypes.h \
- tree-affine.h $(TREE_INLINE_H) $(TREE_PRETTY_PRINT_H)
-tree-ssa-loop-ivopts.o : tree-ssa-loop-ivopts.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) $(EXPR_H) \
- $(DIAGNOSTIC_H) $(TM_H) coretypes.h \
- $(TREE_PASS_H) $(GGC_H) $(RECOG_H) insn-config.h $(HASH_TABLE_H) $(SCEV_H) \
- $(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) \
- tree-affine.h pointer-set.h $(TARGET_H) \
- $(GIMPLE_PRETTY_PRINT_H) tree-ssa-propagate.h
-tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) pointer-set.h \
- $(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
- coretypes.h $(DUMPFILE_H) $(FLAGS_H) \
- $(TREE_PRETTY_PRINT_H)
-tree-ssa-loop-manip.o : tree-ssa-loop-manip.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(DUMPFILE_H) $(TM_H) $(TREE_H) \
- $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) \
- $(CFGLOOP_H) $(TREE_PASS_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) $(HASH_TABLE_H) $(TREE_H) $(TM_P_H) $(CFGLOOP_H) domwalk.h \
- $(PARAMS_H) $(DIAGNOSTIC_H) $(TM_H) coretypes.h \
- $(TREE_PASS_H) $(FLAGS_H) $(BASIC_BLOCK_H) \
- pointer-set.h tree-affine.h tree-ssa-propagate.h $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-math-opts.o : tree-ssa-math-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(FLAGS_H) $(TREE_H) $(TREE_FLOW_H) \
- $(TREE_PASS_H) alloc-pool.h $(BASIC_BLOCK_H) $(TARGET_H) \
- $(DIAGNOSTIC_H) $(RTL_H) $(EXPR_H) $(OPTABS_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-alias.o : tree-ssa-alias.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(GGC_H) $(TREE_INLINE_H) $(FLAGS_H) \
- $(FUNCTION_H) $(TIMEVAR_H) convert.h $(TM_H) coretypes.h $(DUMPFILE_H) \
- langhooks.h \
- $(PARAMS_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
- $(GIMPLE_H) $(VEC_H) $(TARGET_H) \
- pointer-set.h alloc-pool.h \
- $(TREE_PRETTY_PRINT_H)
-tree-ssa-reassoc.o : tree-ssa-reassoc.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(HASH_TABLE_H) $(TREE_H) $(DIAGNOSTIC_H) \
- $(TM_H) coretypes.h $(TREE_PASS_H) $(FLAGS_H) \
- tree-iterator.h $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_INLINE_H) \
- $(VEC_H) langhooks.h alloc-pool.h pointer-set.h $(CFGLOOP_H) \
- $(TARGET_H) $(GIMPLE_PRETTY_PRINT_H) $(DIAGNOSTIC_CORE_H) $(PARAMS_H)
-tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(TM_P_H) $(GGC_H) \
- $(DIAGNOSTIC_H) $(BASIC_BLOCK_H) $(FLAGS_H) $(TM_H) \
- coretypes.h toplev.h $(DIAGNOSTIC_CORE_H) $(FUNCTION_H) langhooks.h \
- $(FLAGS_H) $(CGRAPH_H) $(PLUGIN_H) \
- $(TREE_INLINE_H) $(GGC_H) $(CGRAPH_H) \
- $(TREE_PASS_H) $(CFGLOOP_H) $(EXCEPT_H)
-
-gimplify.o : gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
- $(DIAGNOSTIC_H) $(TREE_INLINE_H) langhooks.h \
- $(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(CGRAPH_H) $(TIMEVAR_H) $(TM_H) \
- coretypes.h $(EXCEPT_H) $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(EXPR_H) \
- $(GGC_H) gt-gimplify.h $(HASHTAB_H) $(TARGET_H) $(DIAGNOSTIC_CORE_H) $(OPTABS_H) \
- $(SPLAY_TREE_H) $(VEC_H) tree-iterator.h $(TREE_PASS_H) $(TREE_PRETTY_PRINT_H)
-gimple-iterator.o : gimple-iterator.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(GIMPLE_H) $(TREE_FLOW_H) value-prof.h
-gimple-fold.o : gimple-fold.c $(TREE_FLOW_H) $(CONFIG_H) coretypes.h \
- $(DUMPFILE_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(GGC_H) \
- $(FUNCTION_H) $(TM_H) $(BASIC_BLOCK_H) langhooks.h \
- tree-ssa-propagate.h $(FLAGS_H) $(TARGET_H) gimple-fold.h
-gimple-low.o : gimple-low.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) $(TREE_INLINE_H) langhooks.h \
- $(LANGHOOKS_DEF_H) $(TREE_FLOW_H) $(TM_H) coretypes.h \
- $(EXCEPT_H) $(FLAGS_H) $(RTL_H) $(FUNCTION_H) $(TREE_PASS_H) \
- $(HASHTAB_H) $(DIAGNOSTIC_CORE_H) tree-iterator.h langhooks.h
-omp-low.o : omp-low.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(GIMPLE_H) $(TREE_INLINE_H) langhooks.h $(DIAGNOSTIC_CORE_H) \
- $(TREE_FLOW_H) $(FLAGS_H) $(EXPR_H) $(DIAGNOSTIC_CORE_H) \
- $(TREE_PASS_H) $(GGC_H) $(EXCEPT_H) $(SPLAY_TREE_H) $(OPTABS_H) \
- $(CFGLOOP_H) tree-iterator.h $(TARGET_H) gt-omp-low.h
-tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(HASH_TABLE_H) $(TREE_H) $(TREE_PRETTY_PRINT_H)
-omega.o : omega.c $(OMEGA_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TREE_H) $(DIAGNOSTIC_CORE_H)
-tree-chrec.o : tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TREE_PRETTY_PRINT_H) $(CFGLOOP_H) $(TREE_FLOW_H) $(SCEV_H) \
- $(PARAMS_H)
-tree-scalar-evolution.o : tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(HASH_TABLE_H) $(GIMPLE_PRETTY_PRINT_H) \
- $(TREE_FLOW_H) $(CFGLOOP_H) $(SCEV_H) $(PARAMS_H) gt-tree-scalar-evolution.h
-tree-data-ref.o : tree-data-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- langhooks.h tree-affine.h $(PARAMS_H)
-sese.o : sese.c sese.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_PRETTY_PRINT_H) \
- $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) value-prof.h
-graphite.o : graphite.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) \
- $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h \
- $(DBGCNT_H) $(GRAPHITE_HTAB_H) graphite-poly.h graphite-scop-detection.h \
- graphite-clast-to-gimple.h graphite-sese-to-poly.h
-graphite-blocking.o : graphite-blocking.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- sese.h graphite-poly.h
-graphite-clast-to-gimple.o : graphite-clast-to-gimple.c $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
- $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h $(GRAPHITE_HTAB_H) \
- graphite-poly.h graphite-clast-to-gimple.h
-graphite-dependences.o : graphite-dependences.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_FLOW_H) $(TREE_PASS_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- sese.h $(GRAPHITE_HTAB_H) graphite-poly.h
-graphite-interchange.o : graphite-interchange.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- sese.h graphite-poly.h
-graphite-poly.o : graphite-poly.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(GIMPLE_PRETTY_PRINT_H) \
- $(CFGLOOP_H) $(TREE_DATA_REF_H) sese.h graphite-poly.h
-graphite-scop-detection.o : graphite-scop-detection.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H) \
- sese.h graphite-poly.h graphite-scop-detection.h
-graphite-sese-to-poly.o : graphite-sese-to-poly.c $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(TREE_FLOW_H) $(TREE_PASS_H) $(CFGLOOP_H) \
- $(TREE_DATA_REF_H) domwalk.h sese.h graphite-poly.h \
- graphite-sese-to-poly.h
-graphite-optimize-isl.o : graphite-optimize-isl.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- $(SCEV_H) sese.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) $(TREE_FLOW_H) $(DUMPFILE_H) \
- $(CFGLOOP_H) $(EXPR_H) $(RECOG_H) $(OPTABS_H) \
- $(DIAGNOSTIC_CORE_H) $(SCEV_H) $(TREE_VECTORIZER_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(TARGET_H) $(TREE_DATA_REF_H)
-tree-vect-loop-manip.o: tree-vect-loop-manip.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TM_H) $(GGC_H) $(TREE_H) $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(CFGLOOP_H) $(DIAGNOSTIC_CORE_H) \
- $(SCEV_H) $(TREE_VECTORIZER_H) langhooks.h $(GIMPLE_PRETTY_PRINT_H)
-tree-vect-patterns.o: tree-vect-patterns.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) \
- $(TREE_FLOW_H) $(CFGLOOP_H) $(EXPR_H) $(OPTABS_H) $(PARAMS_H) \
- $(TREE_DATA_REF_H) $(TREE_VECTORIZER_H) $(RECOG_H) $(DIAGNOSTIC_CORE_H) \
- $(GIMPLE_PRETTY_PRINT_H)
-tree-vect-slp.o: tree-vect-slp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) \
- $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(CFGLOOP_H) \
- $(EXPR_H) $(RECOG_H) $(OPTABS_H) $(TREE_VECTORIZER_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(TREE_DATA_REF_H) langhooks.h
-tree-vect-stmts.o: tree-vect-stmts.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) \
- $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(CFGLOOP_H) \
- $(EXPR_H) $(RECOG_H) $(OPTABS_H) $(TREE_VECTORIZER_H) \
- langhooks.h $(GIMPLE_PRETTY_PRINT_H)
-tree-vect-data-refs.o: tree-vect-data-refs.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) \
- $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(CFGLOOP_H) \
- $(EXPR_H) $(OPTABS_H) $(SCEV_H) $(TREE_VECTORIZER_H) \
- $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-vectorizer.o: tree-vectorizer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \
- $(CFGLOOP_H) $(TREE_PASS_H) $(TREE_VECTORIZER_H) \
- $(TREE_PRETTY_PRINT_H) $(DBGCNT_H)
-vtable-verify.o: vtable-verify.c vtable-verify.h $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) cp/cp-tree.h $(TM_P_H) \
- $(BASIC_BLOCK_H) output.h $(TREE_FLOW_H) $(TREE_DUMP_H) $(TREE_PASS_H) \
- $(TIMEVAR_H) $(CFGLOOP_H) $(FLAGS_H) $(TREE_INLINE_H) $(SCEV_H) \
- $(DIAGNOSTIC_CORE_H) $(GIMPLE_PRETTY_PRINT_H) toplev.h langhooks.h \
- gt-vtable-verify.h
-tree-loop-distribution.o: tree-loop-distribution.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_FLOW_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(TREE_PASS_H)
-tree-parloops.o: tree-parloops.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_FLOW_H) $(TREE_HASHER_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(HASH_TABLE_H) \
- $(TREE_PASS_H) langhooks.h gt-tree-parloops.h $(TREE_VECTORIZER_H)
-tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FUNCTION_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
- tree-stdarg.h $(TARGET_H) langhooks.h $(GIMPLE_PRETTY_PRINT_H)
-tree-object-size.o: tree-object-size.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(DIAGNOSTIC_CORE_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) \
- $(TREE_PASS_H) tree-ssa-propagate.h $(GIMPLE_PRETTY_PRINT_H)
-internal-fn.o : internal-fn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(INTERNAL_FN_H) $(TREE_H) $(EXPR_H) $(OPTABS_H) $(GIMPLE_H)
-gimple.o : gimple.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(GGC_H) $(GIMPLE_H) $(DIAGNOSTIC_CORE_H) $(DIAGNOSTIC_H) gt-gimple.h \
- $(TREE_FLOW_H) value-prof.h $(FLAGS_H) $(DEMANGLE_H) \
- $(TARGET_H) $(ALIAS_H)
-gimple-pretty-print.o : gimple-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) \
- $(TREE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) $(TREE_FLOW_H) \
- $(TM_H) $(GIMPLE_H) value-prof.h \
- $(TRANS_MEM_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-mudflap.o : tree-mudflap.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(TREE_INLINE_H) $(GIMPLE_H) $(DIAGNOSTIC_H) \
- $(DEMANGLE_H) $(HASHTAB_H) langhooks.h tree-mudflap.h \
- $(TM_H) coretypes.h $(TREE_PASS_H) $(CGRAPH_H) $(GGC_H) \
- gt-tree-mudflap.h $(BASIC_BLOCK_H) $(FLAGS_H) $(FUNCTION_H) \
- $(TM_P_H) $(TREE_FLOW_H) $(DIAGNOSTIC_CORE_H) $(GIMPLE_H) tree-iterator.h
-tree-nomudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \
- $(C_TREE_H) $(C_COMMON_H) $(GIMPLE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
- output.h langhooks.h tree-mudflap.h $(TM_H) coretypes.h \
- $(GGC_H) gt-tree-mudflap.h $(TREE_PASS_H) $(DIAGNOSTIC_CORE_H)
-tree-pretty-print.o : tree-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
- $(TREE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) $(TREE_FLOW_H) \
- $(TM_H) coretypes.h $(DUMPFILE_H) tree-iterator.h $(SCEV_H) langhooks.h \
- value-prof.h output.h $(TREE_PRETTY_PRINT_H)
-tree-diagnostic.o : tree-diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) \
- $(TREE_H) $(DIAGNOSTIC_H) tree-diagnostic.h langhooks.h $(LANGHOOKS_DEF_H) \
- $(VEC_H) $(TREE_PRETTY_PRINT_H)
-fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(FLAGS_H) $(DIAGNOSTIC_CORE_H) $(HASH_TABLE_H) $(EXPR_H) \
- $(RTL_H) $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h $(TARGET_H) \
- $(GIMPLE_H) realmpfr.h $(TREE_FLOW_H)
-diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- version.h $(DEMANGLE_H) $(INPUT_H) intl.h $(BACKTRACE_H) $(DIAGNOSTIC_H) \
- diagnostic.def diagnostic-color.h
-diagnostic-color.o : diagnostic-color.c $(CONFIG_H) $(SYSTEM_H) diagnostic-color.h
-opts.o : opts.c $(OPTS_H) $(OPTIONS_H) $(DIAGNOSTIC_CORE_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TM_H) \
- $(DIAGNOSTIC_H) insn-attr-common.h intl.h $(COMMON_TARGET_H) \
- $(FLAGS_H) $(PARAMS_H) opts-diagnostic.h diagnostic-color.h
-opts-global.o : opts-global.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DIAGNOSTIC_H) $(OPTS_H) $(FLAGS_H) $(GGC_H) $(TREE_H) langhooks.h \
- $(TM_H) $(RTL_H) $(DBGCNT_H) debug.h $(LTO_STREAMER_H) output.h \
- $(PLUGIN_H) toplev.h $(TREE_PASS_H)
-opts-common.o : opts-common.c $(OPTS_H) $(FLAGS_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h intl.h $(DIAGNOSTIC_H) $(TM_H)
-targhooks.o : targhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(EXPR_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FUNCTION_H) output.h $(DIAGNOSTIC_CORE_H) \
- $(MACHMODE_H) $(TARGET_DEF_H) $(TARGET_H) $(GGC_H) gt-targhooks.h \
- $(OPTABS_H) $(RECOG_H) $(REGS_H) reload.h hard-reg-set.h intl.h $(OPTS_H) \
- tree-ssa-alias.h $(TREE_FLOW_H)
-common/common-targhooks.o : common/common-targhooks.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(INPUT_H) $(TM_H) $(COMMON_TARGET_H) common/common-targhooks.h
bversion.h: s-bversion; @true
s-bversion: BASE-VER
@@ -2735,802 +1984,19 @@ s-bversion: BASE-VER
echo "#define BUILDING_GCC_VERSION (BUILDING_GCC_MAJOR * 1000 + BUILDING_GCC_MINOR)" >> bversion.h
$(STAMP) s-bversion
-input.o : input.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(INPUT_H)
-
CFLAGS-toplev.o += -DTARGET_NAME=\"$(target_noncanonical)\"
-toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- version.h $(RTL_H) $(FUNCTION_H) $(FLAGS_H) xcoffout.h $(INPUT_H) \
- $(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
- $(RECOG_H) Makefile toplev.h sdbout.h dbxout.h $(EXPR_H) \
- hard-reg-set.h $(BASIC_BLOCK_H) $(EXCEPT_H) $(REGS_H) $(TIMEVAR_H) \
- value-prof.h $(PARAMS_H) $(TM_P_H) reload.h ira.h dwarf2asm.h $(TARGET_H) \
- langhooks.h insn-flags.h $(CFGLOOP_H) hosthooks.h \
- $(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) \
- $(OPTS_H) params.def tree-mudflap.h $(TREE_PASS_H) $(GIMPLE_H) \
- tree-ssa-alias.h $(PLUGIN_H) realmpfr.h tree-diagnostic.h \
- $(TREE_PRETTY_PRINT_H) opts-diagnostic.h $(COMMON_TARGET_H) \
- tsan.h diagnostic-color.h $(CONTEXT_H) $(PASS_MANAGER_H)
-
-hwint.o : hwint.c $(CONFIG_H) $(SYSTEM_H) $(DIAGNOSTIC_CORE_H)
pass-instances.def: $(srcdir)/passes.def $(srcdir)/gen-pass-instances.awk
$(AWK) -f $(srcdir)/gen-pass-instances.awk \
$(srcdir)/passes.def > pass-instances.def
-passes.o : passes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(FUNCTION_H) $(FLAGS_H) $(INPUT_H) $(INSN_ATTR_H) output.h \
- $(DIAGNOSTIC_CORE_H) debug.h insn-config.h intl.h $(RECOG_H) toplev.h \
- $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
- graph.h $(EXCEPT_H) $(REGS_H) value-prof.h \
- $(PARAMS_H) $(TM_P_H) reload.h $(TARGET_H) \
- langhooks.h insn-flags.h $(CFGLOOP_H) \
- hosthooks.h $(CGRAPH_H) $(COVERAGE_H) $(TREE_PASS_H) $(TREE_DUMP_H) \
- $(GGC_H) $(OPTS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) \
- gt-passes.h $(DF_H) $(PREDICT_H) $(LTO_STREAMER_H) \
- $(PLUGIN_H) $(IPA_UTILS_H) pass-instances.def \
- $(CONTEXT_H) $(PASS_MANAGER_H)
-
-plugin.o : plugin.c $(PLUGIN_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(HASH_TABLE_H) $(DIAGNOSTIC_CORE_H) $(TREE_H) $(TREE_PASS_H) \
- intl.h $(PLUGIN_VERSION_H) $(GGC_H)
-
-main.o : main.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H)
-
-host-default.o : host-default.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- hosthooks.h $(HOSTHOOKS_DEF_H)
-
-rtl-error.o: rtl-error.c $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
- $(INSN_ATTR_H) insn-config.h $(INPUT_H) intl.h $(DIAGNOSTIC_H) \
- $(CONFIG_H)
-
-rtl.o : rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(GGC_H) $(BCONFIG_H) insn-notes.def reg-notes.def $(DIAGNOSTIC_CORE_H)
-
-print-rtl.o : print-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(RTL_H) $(TREE_H) hard-reg-set.h $(BASIC_BLOCK_H) $(FLAGS_H) \
- $(BCONFIG_H) $(DIAGNOSTIC_H) cselib.h $(TREE_PRETTY_PRINT_H) \
- $(DWARF2OUT_H)
-rtlanal.o : rtlanal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_CORE_H) \
- $(RTL_H) hard-reg-set.h $(TM_P_H) insn-config.h $(RECOG_H) \
- $(FLAGS_H) $(REGS_H) output.h $(TARGET_H) $(FUNCTION_H) $(TREE_H) \
- $(DF_H) $(EMIT_RTL_H) addresses.h
-
-varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) hard-reg-set.h $(REGS_H) \
- output.h $(DIAGNOSTIC_CORE_H) xcoffout.h debug.h $(GGC_H) $(TM_P_H) \
- $(HASHTAB_H) $(TARGET_H) langhooks.h gt-varasm.h $(BASIC_BLOCK_H) \
- $(CGRAPH_H) $(TARGET_DEF_H) tree-mudflap.h \
- pointer-set.h $(COMMON_TARGET_H) asan.h
-function.o : function.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
- $(TREE_H) $(GIMPLE_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) \
- $(OPTABS_H) $(LIBFUNCS_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) \
- output.h $(EXCEPT_H) $(HASHTAB_H) $(GGC_H) $(TM_P_H) langhooks.h \
- gt-function.h $(TARGET_H) $(BASIC_BLOCK_H) $(PREDICT_H) \
- $(TREE_PASS_H) $(DF_H) $(PARAMS_H) bb-reorder.h \
- $(COMMON_TARGET_H)
-statistics.o : statistics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_PASS_H) $(TREE_DUMP_H) $(HASH_TABLE_H) statistics.h \
- $(FUNCTION_H) $(CONTEXT_H) $(PASS_MANAGER_H)
-stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) $(TM_H) \
- $(RTL_H) \
- $(TREE_H) $(FLAGS_H) $(FUNCTION_H) insn-config.h hard-reg-set.h $(EXPR_H) \
- $(LIBFUNCS_H) $(EXCEPT_H) $(RECOG_H) $(DIAGNOSTIC_CORE_H) \
- output.h $(GGC_H) $(TM_P_H) langhooks.h $(PREDICT_H) $(OPTABS_H) \
- $(TARGET_H) $(GIMPLE_H) $(MACHMODE_H) $(REGS_H) alloc-pool.h \
- $(PRETTY_PRINT_H) $(BITMAP_H) $(PARAMS_H)
-except.o : except.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) $(EXCEPT_H) $(FUNCTION_H) $(EXPR_H) $(LIBFUNCS_H) \
- langhooks.h insn-config.h hard-reg-set.h $(BASIC_BLOCK_H) output.h \
- dwarf2asm.h $(DWARF2OUT_H) toplev.h $(DIAGNOSTIC_CORE_H) $(HASH_TABLE_H) \
- intl.h $(GGC_H) \
- gt-except.h $(CGRAPH_H) $(DIAGNOSTIC_H) $(DWARF2_H) \
- $(TARGET_H) $(TM_P_H) $(TREE_PASS_H) $(TREE_FLOW_H) \
- $(TREE_PRETTY_PRINT_H) sbitmap.h $(COMMON_TARGET_H) $(CFGLOOP_H)
-expr.o : expr.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) $(FUNCTION_H) $(REGS_H) $(EXPR_H) $(OPTABS_H) \
- $(LIBFUNCS_H) $(INSN_ATTR_H) insn-config.h $(RECOG_H) output.h \
- typeclass.h hard-reg-set.h toplev.h $(DIAGNOSTIC_CORE_H) hard-reg-set.h $(EXCEPT_H) \
- reload.h langhooks.h intl.h $(TM_P_H) $(TARGET_H) \
- tree-iterator.h gt-expr.h $(MACHMODE_H) $(TIMEVAR_H) $(TREE_FLOW_H) \
- $(TREE_PASS_H) $(DF_H) $(DIAGNOSTIC_H) $(SSAEXPAND_H) \
- $(PARAMS_H) $(COMMON_TARGET_H) target-globals.h
-dojump.o : dojump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TM_P_H) \
- $(RTL_H) $(TREE_H) \
- $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(OPTABS_H) $(INSN_ATTR_H) insn-config.h \
- langhooks.h $(GGC_H) gt-dojump.h $(BASIC_BLOCK_H)
-builtins.o : builtins.c builtins.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(TREE_H) $(GIMPLE_H) $(FLAGS_H) $(TARGET_H) $(FUNCTION_H) $(REGS_H) \
- $(EXPR_H) $(OPTABS_H) insn-config.h $(RECOG_H) output.h typeclass.h \
- hard-reg-set.h $(DIAGNOSTIC_CORE_H) hard-reg-set.h $(EXCEPT_H) \
- $(TM_P_H) $(PREDICT_H) $(LIBFUNCS_H) langhooks.h $(BASIC_BLOCK_H) \
- tree-mudflap.h realmpfr.h $(BUILTINS_DEF) $(MACHMODE_H) \
- $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) value-prof.h ubsan.h
-calls.o : calls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) langhooks.h $(TARGET_H) \
- $(LIBFUNCS_H) $(REGS_H) $(DIAGNOSTIC_CORE_H) output.h \
- $(FUNCTION_H) $(TIMEVAR_H) $(TM_P_H) $(CGRAPH_H) $(EXCEPT_H) sbitmap.h \
- $(DBGCNT_H) $(TREE_FLOW_H)
-expmed.o : expmed.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
- $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
- $(DIAGNOSTIC_CORE_H) $(TM_P_H) langhooks.h $(DF_H) $(TARGET_H) \
- expmed.h
-explow.o : explow.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TREE_H) \
- $(FLAGS_H) hard-reg-set.h insn-config.h $(EXPR_H) $(OPTABS_H) $(RECOG_H) \
- $(DIAGNOSTIC_CORE_H) $(EXCEPT_H) $(FUNCTION_H) $(GGC_H) $(TM_P_H) langhooks.h gt-explow.h \
- $(TARGET_H) $(COMMON_TARGET_H) output.h $(LIBFUNCS_H)
-optabs.o : optabs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) insn-config.h $(EXPR_H) $(OPTABS_H) $(LIBFUNCS_H) \
- $(RECOG_H) reload.h $(DIAGNOSTIC_CORE_H) $(GGC_H) $(TM_P_H) \
- $(EXCEPT_H) gt-optabs.h $(BASIC_BLOCK_H) $(TARGET_H) $(FUNCTION_H)
-dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) $(FUNCTION_H) \
- langhooks.h insn-config.h reload.h $(GSTAB_H) xcoffout.h output.h dbxout.h \
- toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) $(OBSTACK_H) $(EXPR_H) $(CGRAPH_H) \
- gt-dbxout.h $(COMMON_TARGET_H)
-debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H)
-sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
- $(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
- output.h $(DIAGNOSTIC_CORE_H) $(TM_P_H) gsyms.h langhooks.h $(TARGET_H) sdbout.h \
- gt-sdbout.h reload.h
-dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(TREE_H) version.h $(RTL_H) $(DWARF2_H) debug.h $(FLAGS_H) \
- insn-config.h output.h $(DIAGNOSTIC_H) hard-reg-set.h $(REGS_H) $(EXPR_H) \
- toplev.h $(DIAGNOSTIC_CORE_H) $(DWARF2OUT_H) reload.h \
- $(GGC_H) $(EXCEPT_H) dwarf2asm.h $(TM_P_H) langhooks.h $(HASH_TABLE_H) \
- gt-dwarf2out.h $(TARGET_H) $(CGRAPH_H) $(MD5_H) $(INPUT_H) $(FUNCTION_H) \
- $(GIMPLE_H) ira.h lra.h $(TREE_FLOW_H) \
- $(TREE_PRETTY_PRINT_H) $(COMMON_TARGET_H) $(OPTS_H)
-dwarf2cfi.o : dwarf2cfi.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(HASH_TABLE_H) \
- $(TM_H) version.h $(RTL_H) $(EXPR_H) $(REGS_H) $(FUNCTION_H) output.h \
- gt-dwarf2cfi.h debug.h $(DWARF2_H) dwarf2asm.h $(DWARF2OUT_H) $(COMMON_TARGET_H) \
- $(GGC_H) $(TM_P_H) $(TARGET_H) $(TREE_PASS_H) $(BASIC_BLOCK_H) $(EXCEPT_H)
-dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(FLAGS_H) $(RTL_H) $(TREE_H) output.h dwarf2asm.h $(TM_P_H) $(GGC_H) \
- gt-dwarf2asm.h $(DWARF2_H) $(SPLAY_TREE_H) $(TARGET_H)
-vmsdbgout.o : vmsdbgout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) version.h \
- $(FLAGS_H) $(RTL_H) output.h vmsdbg.h debug.h langhooks.h $(FUNCTION_H) $(TARGET_H)
-xcoffout.o : xcoffout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(RTL_H) xcoffout.h $(FLAGS_H) $(DIAGNOSTIC_CORE_H) output.h dbxout.h \
- $(GGC_H) $(TARGET_H) debug.h $(GSTAB_H) xcoff.h
-godump.o : godump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DIAGNOSTIC_CORE_H) \
- $(TREE_H) $(GGC_H) pointer-set.h $(OBSTACK_H) debug.h gt-godump.h
-emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) $(FUNCTION_H) $(REGS_H) insn-config.h $(RECOG_H) \
- $(GGC_H) $(EXPR_H) hard-reg-set.h $(BITMAP_H) $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) \
- $(HASHTAB_H) $(TM_P_H) debug.h langhooks.h $(TREE_PASS_H) gt-emit-rtl.h \
- $(DF_H) $(PARAMS_H) $(TARGET_H)
-real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(REAL_H) dfp.h realmpfr.h
-realmpfr.o : realmpfr.c realmpfr.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(REAL_H) $(TREE_H)
-dfp.o : dfp.c dfp.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(TM_P_H) $(REAL_H) $(DECNUM_H)
-fixed-value.o: fixed-value.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(REAL_H) $(DIAGNOSTIC_CORE_H)
-jump.o : jump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(FLAGS_H) hard-reg-set.h $(REGS_H) insn-config.h $(RECOG_H) $(EXPR_H) \
- $(EXCEPT_H) $(FUNCTION_H) $(BASIC_BLOCK_H) $(TREE_PASS_H) \
- $(DIAGNOSTIC_CORE_H) $(DIAGNOSTIC_CORE_H) $(INSN_ATTR_H) $(TM_P_H) reload.h \
- $(PREDICT_H) $(TARGET_H)
-simplify-rtx.o : simplify-rtx.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(RECOG_H) $(EXPR_H) $(DIAGNOSTIC_CORE_H) $(FUNCTION_H) $(GGC_H) $(TM_P_H) \
- $(TREE_H) $(TARGET_H)
-symtab.o : symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- langhooks.h $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \
- $(TIMEVAR_H) $(HASHTAB_H) gt-symtab.h
-cgraph.o : cgraph.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(TREE_H) $(TIMEVAR_H) \
- langhooks.h toplev.h $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(GGC_H) $(TARGET_H) $(CGRAPH_H) \
- gt-cgraph.h intl.h $(BASIC_BLOCK_H) debug.h $(HASHTAB_H) \
- $(TREE_INLINE_H) $(TREE_FLOW_H) cif-code.def \
- value-prof.h $(EXCEPT_H) $(IPA_UTILS_H) $(DIAGNOSTIC_CORE_H) \
- $(IPA_INLINE_H) $(LTO_STREAMER_H) $(CFGLOOP_H) $(GIMPLE_PRETTY_PRINT_H)
-cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(GGC_H) \
- $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) debug.h $(DIAGNOSTIC_H) \
- $(FIBHEAP_H) output.h $(PARAMS_H) $(RTL_H) $(IPA_PROP_H) \
- gt-cgraphunit.h tree-iterator.h $(COVERAGE_H) $(TREE_DUMP_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(IPA_INLINE_H) $(IPA_UTILS_H) $(CFGLOOP_H) \
- $(LTO_STREAMER_H) output.h $(REGSET_H) $(EXCEPT_H) $(GCC_PLUGIN_H) \
- plugin.h $(CONTEXT_H) $(PASS_MANAGER_H)
-cgraphclones.o : cgraphclones.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(TREE_INLINE_H) toplev.h $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(GGC_H) \
- $(TARGET_H) $(CGRAPH_H) intl.h pointer-set.h $(FUNCTION_H) $(GIMPLE_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) debug.h $(DIAGNOSTIC_H) $(TREE_DUMP_H) \
- $(PARAMS_H) $(RTL_H) $(IPA_PROP_H) \
- tree-iterator.h $(COVERAGE_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(IPA_INLINE_H) $(IPA_UTILS_H) \
- $(LTO_STREAMER_H) $(EXCEPT_H) $(GCC_PLUGIN_H) gt-cgraphclones.h
-cgraphbuild.o : cgraphbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(CGRAPH_H) intl.h pointer-set.h $(GIMPLE_H) \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(IPA_UTILS_H) $(EXCEPT_H) \
- $(IPA_INLINE_H)
-varpool.o : varpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(CGRAPH_H) langhooks.h $(DIAGNOSTIC_CORE_H) $(HASHTAB_H) \
- $(GGC_H) $(TIMEVAR_H) debug.h $(TARGET_H) output.h $(GIMPLE_H) \
- $(TREE_FLOW_H)
-ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
- $(TREE_PASS_H) $(GIMPLE_H) $(TARGET_H) $(GGC_H) pointer-set.h \
- $(IPA_UTILS_H) tree-inline.h profile.h $(PARAMS_H)
-ipa-profile.o : ipa-profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
- $(TREE_PASS_H) $(GIMPLE_H) $(TARGET_H) $(GGC_H) \
- $(IPA_UTILS_H) $(HASH_TABLE_H) profile.h $(PARAMS_H) \
- value-prof.h alloc-pool.h tree-inline.h $(LTO_STREAMER_H) $(DATA_STREAMER_H) \
- ipa-inline.h
-ipa-devirt.o : ipa-devirt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H) \
- $(GIMPLE_H) $(TARGET_H) $(GGC_H) pointer-set.h \
- $(IPA_UTILS_H) $(HASH_TABLE_H) ipa-inline.h ipa-utils.h $(TREE_PRETTY_PRINT_H) \
- $(DIAGNOSTIC_H)
-ipa-prop.o : ipa-prop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(DIAGNOSTIC_H) \
- $(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) \
- $(TREE_INLINE_H) $(GIMPLE_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(LTO_STREAMER_H) \
- $(DATA_STREAMER_H) $(TREE_STREAMER_H) $(PARAMS_H)
-ipa-ref.o : ipa-ref.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- langhooks.h $(GGC_H) $(TARGET_H) $(CGRAPH_H) $(TREE_H) $(TARGET_H) \
- $(TREE_FLOW_H) $(TM_H) $(TREE_PASS_H) $(FLAGS_H) $(TREE_H) $(GGC_H) \
- $(IPA_UTILS_H)
-ipa-cp.o : ipa-cp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(TARGET_H) $(GIMPLE_H) $(CGRAPH_H) $(IPA_PROP_H) $(TREE_FLOW_H) \
- $(TREE_PASS_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
- $(TREE_INLINE_H) $(PARAMS_H) $(TREE_PRETTY_PRINT_H) $(IPA_INLINE_H)
-ipa-split.o : ipa-split.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(TARGET_H) $(CGRAPH_H) $(IPA_PROP_H) $(TREE_FLOW_H) \
- $(TREE_PASS_H) $(FLAGS_H) $(DIAGNOSTIC_H) $(TREE_DUMP_H) $(CFGLOOP_H) \
- $(TREE_INLINE_H) $(PARAMS_H) $(GIMPLE_PRETTY_PRINT_H) $(IPA_INLINE_H)
-ipa-inline.o : ipa-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \
- $(DIAGNOSTIC_H) $(FIBHEAP_H) $(PARAMS_H) $(TREE_PASS_H) \
- $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(RTL_H) $(IPA_PROP_H) \
- $(EXCEPT_H) $(GIMPLE_PRETTY_PRINT_H) $(IPA_INLINE_H) $(TARGET_H) \
- $(IPA_UTILS_H) sreal.h
-ipa-inline-analysis.o : ipa-inline-analysis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \
- $(DIAGNOSTIC_H) $(PARAMS_H) $(TREE_PASS_H) $(CFGLOOP_H) \
- $(HASHTAB_H) $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(IPA_PROP_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(IPA_INLINE_H) $(LTO_STREAMER_H) $(DATA_STREAMER_H) \
- $(TREE_STREAMER_H) ipa-utils.h tree-scalar-evolution.h $(CFGLOOP_H) \
- alloc-pool.h
-ipa-inline-transform.o : ipa-inline-transform.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) langhooks.h $(TREE_INLINE_H) $(FLAGS_H) $(CGRAPH_H) intl.h \
- $(TREE_PASS_H) \
- $(HASHTAB_H) $(COVERAGE_H) $(GGC_H) $(TREE_FLOW_H) $(IPA_PROP_H) \
- $(TREE_PASS_H)
-ipa-utils.o : ipa-utils.c $(IPA_UTILS_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(DUMPFILE_H) $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) \
- langhooks.h pointer-set.h $(GGC_H) $(GIMPLE_H) $(SPLAY_TREE_H) \
- $(CGRAPH_H) $(FLAGS_H) $(DIAGNOSTIC_H)
-ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
- pointer-set.h $(GGC_H) $(IPA_REFERENCE_H) $(IPA_UTILS_H) $(SPLAY_TREE_H) \
- $(GIMPLE_H) $(CGRAPH_H) $(FLAGS_H) $(TREE_PASS_H) \
- $(DIAGNOSTIC_H) $(FUNCTION_H) $(LTO_STREAMER_H) \
- $(DIAGNOSTIC_CORE_H) $(DATA_STREAMER_H)
-ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
- pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(TARGET_H) \
- $(GIMPLE_H) $(CGRAPH_H) $(FLAGS_H) $(TREE_PASS_H) \
- $(DIAGNOSTIC_H) $(CFGLOOP_H) $(SCEV_H) $(LTO_STREAMER_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(DATA_STREAMER_H) $(TREE_STREAMER_H)
-coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) \
- $(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
- $(FUNCTION_H) $(BASIC_BLOCK_H) toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) langhooks.h $(COVERAGE_H) \
- tree-iterator.h $(CGRAPH_H) gcov-io.c $(TM_P_H) \
- $(DIAGNOSTIC_CORE_H) intl.h gt-coverage.h $(TARGET_H) $(HASH_TABLE_H)
-cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(HASH_TABLE_H) $(TM_H) $(RTL_H) \
- $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(RECOG_H) \
- $(EMIT_RTL_H) $(DIAGNOSTIC_CORE_H) $(FUNCTION_H) \
- cselib.h gt-cselib.h $(GGC_H) $(TM_P_H) $(PARAMS_H) alloc-pool.h \
- $(HASHTAB_H) $(TARGET_H) $(BITMAP_H) $(TREE_H)
-cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \
- hard-reg-set.h $(FLAGS_H) insn-config.h $(RECOG_H) $(EXPR_H) toplev.h $(DIAGNOSTIC_CORE_H) \
- $(FUNCTION_H) $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) \
- $(EXCEPT_H) $(TARGET_H) $(PARAMS_H) rtlhooks-def.h $(TREE_PASS_H) \
- $(DF_H) $(DBGCNT_H)
-dce.o : dce.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(EXCEPT_H) $(DF_H) cselib.h \
- $(DBGCNT_H) dce.h $(VALTRACK_H) $(TREE_PASS_H) $(DBGCNT_H) $(TM_P_H) \
- $(EMIT_RTL_H)
-dumpfile.o: dumpfile.c $(DUMPFILE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DIAGNOSTIC_CORE_H) $(GIMPLE_PRETTY_PRINT_H) $(TREE_H)
-dse.o : dse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) \
- $(TREE_PASS_H) alloc-pool.h $(ALIAS_H) $(OPTABS_H) $(TARGET_H) \
- $(BITMAP_H) $(PARAMS_H) $(TREE_FLOW_H) $(HASH_TABLE_H)
-fwprop.o : fwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H) $(FLAGS_H) $(OBSTACK_H) $(BASIC_BLOCK_H) \
- $(DF_H) alloc-pool.h $(TREE_PASS_H) $(TARGET_H) \
- $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) domwalk.h sparseset.h
-web.o : web.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) $(DIAGNOSTIC_CORE_H) \
- insn-config.h $(RECOG_H) $(DF_H) $(OBSTACK_H) $(TREE_PASS_H)
-ree.o : ree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) $(FUNCTION_H) \
- $(DF_H) $(TREE_PASS_H) $(RECOG_H) $(EXPR_H) \
- $(REGS_H) $(TREE_H) $(TM_P_H) insn-config.h $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) \
- $(TARGET_H) $(OPTABS_H) insn-codes.h rtlhooks-def.h $(PARAMS_H) $(CGRAPH_H)
-cprop.o : cprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) toplev.h $(DIAGNOSTIC_CORE_H) \
- $(TM_P_H) $(PARAMS_H) cselib.h $(EXCEPT_H) $(TREE_H) \
- intl.h $(OBSTACK_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H) $(TARGET_H) \
- $(DF_H) $(CFGLOOP_H)
-gcse.o : gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(HASH_TABLE_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(GGC_H) \
- $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) toplev.h $(DIAGNOSTIC_CORE_H) \
- $(TM_P_H) $(PARAMS_H) cselib.h $(EXCEPT_H) gt-gcse.h $(TREE_H) \
- intl.h $(OBSTACK_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H) $(TARGET_H) \
- $(DF_H) gcse.h
-store-motion.o : store-motion.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(HASH_TABLE_H) $(TM_H) $(RTL_H) \
- $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(GGC_H) \
- $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) toplev.h $(DIAGNOSTIC_CORE_H) \
- $(TM_P_H) $(EXCEPT_H) $(TREE_H) \
- intl.h $(OBSTACK_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H)
-resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h $(SYSTEM_H) \
- coretypes.h $(TM_H) $(REGS_H) $(FLAGS_H) output.h $(RESOURCE_H) $(DF_H) \
- $(FUNCTION_H) $(DIAGNOSTIC_CORE_H) $(INSN_ATTR_H) $(EXCEPT_H) $(PARAMS_H) $(TM_P_H)
-lcm.o : lcm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) $(TM_H) \
- $(RTL_H) $(REGS_H) \
- hard-reg-set.h $(FLAGS_H) insn-config.h $(INSN_ATTR_H) $(RECOG_H) \
- $(BASIC_BLOCK_H) $(TM_P_H) $(FUNCTION_H) sbitmap.h
-mode-switching.o : mode-switching.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(INSN_ATTR_H) $(RECOG_H) $(BASIC_BLOCK_H) $(TM_P_H) $(FUNCTION_H) \
- $(TREE_PASS_H) $(DF_H) $(TARGET_H) $(EMIT_RTL_H)
-tree-ssa-dce.o : tree-ssa-dce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(TREE_FLOW_H) $(DIAGNOSTIC_H) $(TM_H) \
- coretypes.h $(TREE_PASS_H) $(FLAGS_H) $(BASIC_BLOCK_H) \
- $(GGC_H) $(GIMPLE_H) $(CFGLOOP_H) $(SCEV_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-call-cdce.o : tree-call-cdce.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(TREE_FLOW_H) $(TM_H) \
- coretypes.h $(TREE_PASS_H) $(FLAGS_H) $(BASIC_BLOCK_H) \
- $(GIMPLE_H) $(GIMPLE_PRETTY_PRINT_H)
-tree-ssa-ccp.o : tree-ssa-ccp.c $(TREE_FLOW_H) $(CONFIG_H) \
- $(SYSTEM_H) $(TREE_H) $(TM_P_H) \
- $(DIAGNOSTIC_H) $(FUNCTION_H) $(TM_H) coretypes.h \
- $(BASIC_BLOCK_H) $(TREE_PASS_H) langhooks.h $(PARAMS_H) \
- tree-ssa-propagate.h value-prof.h $(FLAGS_H) $(TARGET_H) \
- $(DIAGNOSTIC_CORE_H) $(HASH_TABLE_H) \
- $(DBGCNT_H) $(GIMPLE_PRETTY_PRINT_H) gimple-fold.h
-tree-ssa-strlen.o : tree-ssa-strlen.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_FLOW_H) $(TREE_PASS_H) domwalk.h alloc-pool.h tree-ssa-propagate.h \
- $(GIMPLE_PRETTY_PRINT_H) $(PARAMS_H) $(EXPR_H) $(HASH_TABLE_H)
-tree-sra.o : tree-sra.c $(CONFIG_H) $(SYSTEM_H) coretypes.h alloc-pool.h \
- $(HASH_TABLE_H) $(TM_H) $(TREE_H) $(GIMPLE_H) $(CGRAPH_H) $(TREE_FLOW_H) \
- $(IPA_PROP_H) $(DIAGNOSTIC_H) statistics.h \
- $(PARAMS_H) $(TARGET_H) $(FLAGS_H) \
- $(DBGCNT_H) $(TREE_INLINE_H) $(GIMPLE_PRETTY_PRINT_H) ipa-utils.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) \
- $(TM_H) coretypes.h $(GIMPLE_H) $(CFGLOOP_H) \
- $(TREE_PASS_H) $(FLAGS_H) $(EXPR_H) $(BASIC_BLOCK_H) \
- $(GGC_H) $(OBSTACK_H) $(PARAMS_H) $(CPPLIB_H) $(PARAMS_H) \
- $(GIMPLE_PRETTY_PRINT_H) langhooks.h $(OPTABS_H)
-tree-complex.o : tree-complex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(TM_H) $(FLAGS_H) $(TREE_FLOW_H) $(TREE_HASHER_H) $(GIMPLE_H) \
- $(CFGLOOP_H) tree-iterator.h $(TREE_PASS_H) tree-ssa-propagate.h
-tree-emutls.o : tree-emutls.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
- $(GIMPLE_H) $(TREE_PASS_H) $(TREE_FLOW_H) $(CGRAPH_H) langhooks.h \
- $(TARGET_H) $(TARGET_DEF_H) tree-iterator.h
-tree-vect-generic.o : tree-vect-generic.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
- $(TM_H) $(TREE_FLOW_H) $(GIMPLE_H) tree-iterator.h $(TREE_PASS_H) \
- $(FLAGS_H) $(OPTABS_H) $(MACHMODE_H) $(EXPR_H) \
- langhooks.h $(FLAGS_H) $(DIAGNOSTIC_H) gt-tree-vect-generic.h $(GGC_H) \
- coretypes.h insn-codes.h $(DIAGNOSTIC_H) $(TARGET_H)
-df-core.o : df-core.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- insn-config.h $(RECOG_H) $(FUNCTION_H) $(REGS_H) alloc-pool.h \
- hard-reg-set.h $(BASIC_BLOCK_H) $(DF_H) $(BITMAP_H) sbitmap.h \
- $(TM_P_H) $(FLAGS_H) output.h $(TREE_PASS_H) $(PARAMS_H)
-df-problems.o : df-problems.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) \
- $(RTL_H) insn-config.h $(RECOG_H) $(FUNCTION_H) $(REGS_H) alloc-pool.h \
- hard-reg-set.h $(BASIC_BLOCK_H) $(DF_H) $(BITMAP_H) sbitmap.h $(TIMEVAR_H) \
- $(TM_P_H) $(TARGET_H) $(FLAGS_H) $(EXCEPT_H) dce.h $(VALTRACK_H)
-df-scan.o : df-scan.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(RTL_H) \
- insn-config.h $(RECOG_H) $(FUNCTION_H) $(REGS_H) alloc-pool.h \
- hard-reg-set.h $(BASIC_BLOCK_H) $(DF_H) $(BITMAP_H) sbitmap.h \
- $(TM_P_H) $(FLAGS_H) $(TARGET_H) $(TARGET_DEF_H) $(TREE_H) \
- $(EMIT_RTL_H)
-regstat.o : regstat.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TM_P_H) $(FLAGS_H) $(REGS_H) $(EXCEPT_H) hard-reg-set.h \
- $(BASIC_BLOCK_H) $(TIMEVAR_H) $(DF_H)
-valtrack.o : valtrack.c $(VALTRACK_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(FUNCTION_H) $(REGS_H) $(EMIT_RTL_H)
-var-tracking.o : var-tracking.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(TREE_H) hard-reg-set.h insn-config.h reload.h $(FLAGS_H) \
- $(BASIC_BLOCK_H) bitmap.h alloc-pool.h $(FIBHEAP_H) $(HASH_TABLE_H) \
- $(REGS_H) $(EXPR_H) $(TREE_PASS_H) $(TREE_FLOW_H) \
- cselib.h $(TARGET_H) $(DIAGNOSTIC_CORE_H) $(PARAMS_H) $(DIAGNOSTIC_H) \
- pointer-set.h $(RECOG_H) $(TM_P_H) $(TREE_PRETTY_PRINT_H) $(ALIAS_H)
-profile.o : profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) $(REGS_H) $(EXPR_H) $(FUNCTION_H) $(BASIC_BLOCK_H) \
- $(DIAGNOSTIC_CORE_H) $(COVERAGE_H) $(TREE_FLOW_H) value-prof.h \
- $(CFGLOOP_H) profile.h
-mcf.o : mcf.c profile.h $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h \
- $(DUMPFILE_H) $(BASIC_BLOCK_H) langhooks.h $(GCOV_IO_H) $(TREE_H)
-tree-profile.o : tree-profile.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TARGET_H) $(TREE_H) $(FLAGS_H) $(FUNCTION_H) \
- $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(COVERAGE_H) $(TREE_H) value-prof.h \
- $(TREE_PASS_H) $(TREE_FLOW_H) gt-tree-profile.h $(CGRAPH_H)
-value-prof.o : value-prof.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) \
- $(BASIC_BLOCK_H) hard-reg-set.h profile.h value-prof.h $(EXPR_H) $(FLAGS_H) \
- $(RECOG_H) insn-config.h $(OPTABS_H) $(REGS_H) $(GGC_H) $(DIAGNOSTIC_H) \
- $(TREE_H) $(COVERAGE_H) $(RTL_H) $(GCOV_IO_H) $(TREE_FLOW_H) \
- tree-flow-inline.h $(TIMEVAR_H) $(DIAGNOSTIC_CORE_H) pointer-set.h \
- $(GIMPLE_PRETTY_PRINT_H) $(DATA_STREAMER_H)
-loop-doloop.o : loop-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) \
- $(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \
- $(DIAGNOSTIC_CORE_H) $(CFGLOOP_H) $(PARAMS_H) $(TARGET_H)
-alloc-pool.o : alloc-pool.c $(CONFIG_H) $(SYSTEM_H) alloc-pool.h $(HASH_TABLE_H)
-auto-inc-dec.o : auto-inc-dec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) insn-config.h \
- $(REGS_H) $(FLAGS_H) $(FUNCTION_H) $(EXCEPT_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) \
- $(EXPR_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H) $(TARGET_H)
-cfg.o : cfg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(DIAGNOSTIC_CORE_H) \
- $(GGC_H) $(OBSTACK_H) alloc-pool.h $(HASH_TABLE_H) $(CFGLOOP_H) $(TREE_H) \
- $(BASIC_BLOCK_H)
-cfghooks.o: cfghooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TIMEVAR_H) toplev.h $(DIAGNOSTIC_CORE_H) $(CFGLOOP_H) $(PRETTY_PRINT_H)
-cfgexpand.o : cfgexpand.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
- $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(FUNCTION_H) $(TM_H) \
- coretypes.h $(EXCEPT_H) langhooks.h $(TREE_PASS_H) $(RTL_H) \
- $(DIAGNOSTIC_H) toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(FLAGS_H) debug.h $(PARAMS_H) \
- value-prof.h $(TREE_INLINE_H) $(TARGET_H) $(SSAEXPAND_H) $(REGS_H) \
- $(GIMPLE_PRETTY_PRINT_H) $(BITMAP_H) sbitmap.h \
- $(INSN_ATTR_H) $(CFGLOOP_H) asan.h
-cfgrtl.o : cfgrtl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
- $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
- $(FUNCTION_H) $(EXCEPT_H) $(TM_P_H) $(INSN_ATTR_H) \
- insn-config.h $(EXPR_H) \
- $(CFGLOOP_H) $(OBSTACK_H) $(TARGET_H) $(TREE_H) \
- $(TREE_PASS_H) $(DF_H) $(GGC_H) $(COMMON_TARGET_H) gt-cfgrtl.h bb-reorder.h
-cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(BASIC_BLOCK_H) \
- $(TIMEVAR_H) sbitmap.h $(BITMAP_H)
-cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(FLAGS_H) $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h $(DIAGNOSTIC_CORE_H) \
- $(FUNCTION_H) $(EXCEPT_H) $(TIMEVAR_H) $(TREE_H) $(EXPR_H) sbitmap.h
-cfgcleanup.o : cfgcleanup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) hard-reg-set.h $(FLAGS_H) $(RECOG_H) \
- $(DIAGNOSTIC_CORE_H) insn-config.h cselib.h $(TARGET_H) $(TM_P_H) $(PARAMS_H) \
- $(REGS_H) $(EMIT_RTL_H) $(FUNCTION_H) $(TREE_PASS_H) $(CFGLOOP_H) $(EXPR_H) \
- $(DF_H) $(DBGCNT_H) dce.h
-cfgloop.o : cfgloop.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) \
- $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(FLAGS_H) $(FUNCTION_H) \
- $(OBSTACK_H) toplev.h $(DIAGNOSTIC_CORE_H) $(TREE_FLOW_H) $(TREE_H) pointer-set.h \
- $(GGC_H)
-cfgloopanal.o : cfgloopanal.c coretypes.h $(DUMPFILE_H) $(CONFIG_H) \
- $(SYSTEM_H) $(RTL_H) \
- $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) $(TM_H) \
- $(OBSTACK_H) graphds.h $(PARAMS_H)
-graphds.o : graphds.c graphds.h $(CONFIG_H) $(SYSTEM_H) $(BITMAP_H) $(OBSTACK_H) \
- coretypes.h $(VEC_H)
-loop-iv.o : loop-iv.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(RTL_H) $(BASIC_BLOCK_H) \
- hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) $(TM_H) $(OBSTACK_H) \
- intl.h $(DIAGNOSTIC_CORE_H) $(DF_H) $(HASH_TABLE_H)
-loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) \
- $(RTL_H) $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) $(RECOG_H) \
- $(TM_H) $(TM_P_H) $(FUNCTION_H) $(FLAGS_H) $(DF_H) $(TARGET_H) \
- $(OBSTACK_H) $(HASH_TABLE_H) $(EXCEPT_H) $(PARAMS_H) $(REGS_H) ira.h
-cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
- $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) \
- coretypes.h $(TM_H) $(OBSTACK_H) $(TREE_FLOW_H)
-loop-init.o : loop-init.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(GGC_H) \
- $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) \
- coretypes.h $(TM_H) $(OBSTACK_H) $(TREE_PASS_H) $(FLAGS_H) \
- $(REGS_H) $(DF_H) $(TREE_FLOW_H)
-loop-unswitch.o : loop-unswitch.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) \
- $(RTL_H) $(TM_H) $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(PARAMS_H) \
- $(EXPR_H) $(TM_H) $(OBSTACK_H)
-loop-unroll.o: loop-unroll.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(RTL_H) $(TM_H) $(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(PARAMS_H) \
- $(EXPR_H) $(TM_H) $(HASH_TABLE_H) $(RECOG_H) $(OBSTACK_H)
-dominance.o : dominance.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- hard-reg-set.h $(BASIC_BLOCK_H) et-forest.h $(OBSTACK_H) $(DIAGNOSTIC_CORE_H) \
- $(TIMEVAR_H) graphds.h pointer-set.h $(BITMAP_H)
-et-forest.o : et-forest.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- et-forest.h alloc-pool.h $(BASIC_BLOCK_H)
-combine.o : combine.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(FLAGS_H) $(FUNCTION_H) insn-config.h $(INSN_ATTR_H) $(REGS_H) $(EXPR_H) \
- rtlhooks-def.h $(BASIC_BLOCK_H) $(RECOG_H) hard-reg-set.h \
- $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(TREE_H) $(TARGET_H) \
- output.h $(PARAMS_H) $(OPTABS_H) \
- insn-codes.h $(TREE_PASS_H) $(DF_H) $(VALTRACK_H) \
- $(CGRAPH_H) $(OBSTACK_H)
-reginfo.o : reginfo.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- hard-reg-set.h $(FLAGS_H) $(BASIC_BLOCK_H) addresses.h $(REGS_H) \
- insn-config.h $(RECOG_H) reload.h $(DIAGNOSTIC_CORE_H) \
- $(FUNCTION_H) output.h $(TM_P_H) $(EXPR_H) $(HASHTAB_H) \
- $(TARGET_H) $(TREE_PASS_H) $(DF_H) ira.h
-bitmap.o : bitmap.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) \
- $(GGC_H) gt-bitmap.h $(BITMAP_H) $(OBSTACK_H) $(HASH_TABLE_H)
-vec.o : vec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(VEC_H) $(GGC_H) \
- $(DIAGNOSTIC_CORE_H) $(HASHTAB_H)
-hash-table.o : hash-table.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(HASHTAB_H)
-reload.o : reload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
- $(FLAGS_H) $(EXPR_H) $(OPTABS_H) reload.h $(RECOG_H) \
- hard-reg-set.h insn-config.h $(REGS_H) $(FUNCTION_H) real.h \
- addresses.h $(TM_P_H) $(PARAMS_H) $(TARGET_H) $(DF_H) ira.h $(DIAGNOSTIC_CORE_H)
-reload1.o : reload1.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(RTL_ERROR_H) \
- $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) hard-reg-set.h insn-config.h \
- $(BASIC_BLOCK_H) $(RECOG_H) $(FUNCTION_H) $(TM_P_H) \
- addresses.h $(EXCEPT_H) $(TREE_H) $(FLAGS_H) $(MACHMODE_H) \
- $(OBSTACK_H) $(DF_H) $(TARGET_H) $(EMIT_RTL_H) ira.h
-rtlhooks.o : rtlhooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- rtlhooks-def.h $(EXPR_H) $(RECOG_H)
-postreload.o : postreload.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(FLAGS_H) $(EXPR_H) $(OPTABS_H) reload.h $(REGS_H) \
- hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) \
- $(FUNCTION_H) $(DIAGNOSTIC_CORE_H) cselib.h $(TM_P_H) $(EXCEPT_H) $(TREE_H) $(MACHMODE_H) \
- $(OBSTACK_H) $(TARGET_H) $(TREE_PASS_H) $(DF_H) $(DBGCNT_H)
-postreload-gcse.o : postreload-gcse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) $(DIAGNOSTIC_CORE_H) \
- $(TM_P_H) $(EXCEPT_H) $(TREE_H) $(TARGET_H) $(HASH_TABLE_H) intl.h \
- $(OBSTACK_H) $(PARAMS_H) $(TREE_PASS_H) $(DBGCNT_H)
-caller-save.o : caller-save.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) $(RTL_H) \
- $(FLAGS_H) $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) $(FUNCTION_H) \
- addresses.h $(RECOG_H) reload.h $(EXPR_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(DF_H) \
- gt-caller-save.h $(GGC_H)
-bt-load.o : bt-load.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(EXCEPT_H) \
- $(RTL_H) hard-reg-set.h $(REGS_H) $(TM_P_H) $(FIBHEAP_H) $(EXPR_H) \
- $(TARGET_H) $(FLAGS_H) $(INSN_ATTR_H) $(FUNCTION_H) $(TREE_PASS_H) \
- $(DIAGNOSTIC_CORE_H) $(DF_H) $(RECOG_H) $(CFGLOOP_H)
-reorg.o : reorg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- conditions.h hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) insn-config.h \
- $(INSN_ATTR_H) $(EXCEPT_H) $(RECOG_H) $(FUNCTION_H) $(FLAGS_H) output.h \
- $(EXPR_H) $(DIAGNOSTIC_CORE_H) $(PARAMS_H) $(TM_P_H) $(OBSTACK_H) $(RESOURCE_H) \
- $(TARGET_H) $(TREE_PASS_H)
-alias.o : alias.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(RTL_H) \
- $(FLAGS_H) hard-reg-set.h $(BASIC_BLOCK_H) $(REGS_H) $(DIAGNOSTIC_CORE_H) \
- $(ALIAS_H) $(EMIT_RTL_H) $(GGC_H) $(FUNCTION_H) cselib.h $(TREE_H) $(TM_P_H) \
- langhooks.h $(TARGET_H) gt-alias.h $(TIMEVAR_H) $(CGRAPH_H) \
- $(SPLAY_TREE_H) $(DF_H) \
- tree-ssa-alias.h pointer-set.h $(TREE_FLOW_H)
-stack-ptr-mod.o : stack-ptr-mod.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(RTL_H) $(REGS_H) $(EXPR_H) $(TREE_PASS_H) \
- $(BASIC_BLOCK_H) $(FLAGS_H) output.h $(DF_H)
-init-regs.o : init-regs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(RTL_H) $(REGS_H) $(EXPR_H) $(TREE_PASS_H) \
- $(BASIC_BLOCK_H) $(FLAGS_H) $(DF_H)
-ira-build.o: ira-build.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TARGET_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
- insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) \
- $(PARAMS_H) $(DF_H) sparseset.h $(IRA_INT_H) reload.h
-ira-costs.o: ira-costs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- hard-reg-set.h $(RTL_H) $(EXPR_H) $(TM_P_H) $(FLAGS_H) $(BASIC_BLOCK_H) \
- $(REGS_H) addresses.h insn-config.h $(RECOG_H) $(DIAGNOSTIC_CORE_H) \
- $(HASH_TABLE_H) $(TARGET_H) $(PARAMS_H) $(IRA_INT_H) reload.h
-ira-conflicts.o: ira-conflicts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TARGET_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(TREE_H) $(FLAGS_H) \
- insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(PARAMS_H) \
- $(DF_H) sparseset.h addresses.h $(IRA_INT_H)
-ira-color.o: ira-color.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(HASH_TABLE_H) $(TARGET_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) reload.h $(PARAMS_H) \
- $(DF_H) $(IRA_INT_H)
-ira-emit.o: ira-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(REGS_H) $(RTL_H) $(TM_P_H) $(TARGET_H) $(FLAGS_H) hard-reg-set.h \
- $(BASIC_BLOCK_H) $(EXPR_H) $(RECOG_H) $(PARAMS_H) \
- $(TREE_PASS_H) reload.h $(DF_H) $(IRA_INT_H)
-ira-lives.o: ira-lives.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TARGET_H) $(RTL_H) $(REGS_H) $(EXCEPT_H) hard-reg-set.h $(FLAGS_H) \
- insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) $(PARAMS_H) \
- $(DF_H) sparseset.h $(IRA_INT_H)
-ira.o: ira.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(REGS_H) $(RTL_H) $(TM_P_H) $(TARGET_H) $(FLAGS_H) $(OBSTACK_H) \
- $(BITMAP_H) hard-reg-set.h $(BASIC_BLOCK_H) $(DBGCNT_H) $(FUNCTION_H) \
- $(EXPR_H) $(RECOG_H) $(PARAMS_H) $(TREE_PASS_H) output.h \
- $(EXCEPT_H) reload.h toplev.h $(DIAGNOSTIC_CORE_H) \
- $(DF_H) $(GGC_H) $(IRA_INT_H) lra.h
-lra.o : lra.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) insn-config.h insn-codes.h $(TIMEVAR_H) $(TREE_PASS_H) \
- $(DF_H) $(RECOG_H) output.h addresses.h $(REGS_H) hard-reg-set.h \
- $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) \
- $(EXCEPT_H) ira.h $(LRA_INT_H)
-lra-assigns.o : lra-assigns.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(RTL_ERROR_H) $(REGS_H) insn-config.h $(DF_H) \
- $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) ira.h \
- rtl-error.h sparseset.h $(LRA_INT_H)
-lra-coalesce.o : lra-coalesce.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \
- $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) ira.h \
- rtl-error.h ira.h $(LRA_INT_H)
-lra-constraints.o : lra-constraints.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) insn-config.h insn-codes.h $(DF_H) \
- $(RECOG_H) output.h addresses.h $(REGS_H) hard-reg-set.h $(FLAGS_H) \
- $(FUNCTION_H) $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) \
- ira.h rtl-error.h $(LRA_INT_H) $(OPTABS_H)
-lra-eliminations.o : lra-eliminations.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \
- $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) ira.h \
- rtl-error.h $(LRA_INT_H) $(OPTABS_H)
-lra-lives.o : lra-lives.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \
- $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) \
- $(LRA_INT_H)
-lra-spills.o : lra-spills.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) insn-config.h $(DF_H) \
- $(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(EXCEPT_H) \
- ira.h $(LRA_INT_H)
-regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- insn-config.h $(TREE_PASS_H) $(DF_H) \
- $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_CORE_H) $(TM_P_H) \
- $(EXCEPT_H) ira.h reload.h $(TARGET_H)
-combine-stack-adj.o : combine-stack-adj.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) insn-config.h $(TREE_PASS_H) \
- $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
- $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) $(DF_H) $(EXCEPT_H) reload.h
-compare-elim.o : compare-elim.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(TM_P_H) insn-config.h $(RECOG_H) $(FLAGS_H) \
- $(BASIC_BLOCK_H) $(TREE_PASS_H) $(TARGET_H) $(DF_H) domwalk.h
-ddg.o : ddg.c $(DDG_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TARGET_H) \
- $(DIAGNOSTIC_CORE_H) $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) \
- $(FLAGS_H) insn-config.h $(INSN_ATTR_H) $(EXCEPT_H) $(RECOG_H) \
- $(SCHED_INT_H) $(CFGLOOP_H) $(EXPR_H) $(BITMAP_H) \
- hard-reg-set.h sbitmap.h $(TM_H)
-modulo-sched.o : modulo-sched.c $(DDG_H) $(CONFIG_H) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TARGET_H) $(DIAGNOSTIC_CORE_H) $(RTL_H) $(TM_P_H) $(REGS_H) $(FUNCTION_H) \
- $(FLAGS_H) insn-config.h $(INSN_ATTR_H) $(EXCEPT_H) $(RECOG_H) \
- $(SCHED_INT_H) $(CFGLOOP_H) $(EXPR_H) $(PARAMS_H) \
- $(GCOV_IO_H) hard-reg-set.h $(TM_H) $(TREE_PASS_H) \
- $(DF_H) $(DBGCNT_H)
-haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DUMPFILE_H) $(TM_H) $(RTL_H) \
- $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h $(FUNCTION_H) \
- $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) $(TM_P_H) $(TARGET_H) \
- $(PARAMS_H) $(DBGCNT_H) $(CFGLOOP_H) ira.h $(EMIT_RTL_H) $(COMMON_TARGET_H) \
- $(HASH_TABLE_H)
-sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) cselib.h \
- ira.h $(PARAMS_H) $(TM_P_H) ira.h $(TARGET_H) $(TREE_H) $(EMIT_RTL_H)
-sched-rgn.o : sched-rgn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
- $(TM_P_H) sel-sched.h $(TARGET_H) $(TREE_PASS_H) \
- $(DBGCNT_H)
-sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) $(TM_P_H) \
- $(PARAMS_H) $(TARGET_H)
-sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) $(INSN_ATTR_H) $(RTL_H) $(TREE_H) $(BASIC_BLOCK_H) $(PRETTY_PRINT_H)
-sel-sched.o : sel-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_ERROR_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
- $(TM_P_H) output.h $(TARGET_H) $(TREE_PASS_H) \
- $(SCHED_INT_H) $(GGC_H) $(TREE_H) langhooks.h rtlhooks-def.h \
- $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) sel-sched.h $(DBGCNT_H) $(EMIT_RTL_H) ira.h
-sel-sched-dump.o : sel-sched-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
- $(TM_P_H) $(TARGET_H) $(TREE_PASS_H) \
- $(SEL_SCHED_DUMP_H) $(GGC_H) $(TREE_H) $(LANGHOOKS_DEF_H) $(SEL_SCHED_IR_H) \
- $(BASIC_BLOCK_H) cselib.h
-sel-sched-ir.o : sel-sched-ir.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \
- $(FUNCTION_H) $(INSN_ATTR_H) $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(EXCEPT_H) $(PARAMS_H) \
- $(TM_P_H) $(TARGET_H) $(TREE_PASS_H) $(SCHED_INT_H) $(GGC_H) \
- $(TREE_H) langhooks.h rtlhooks-def.h $(SEL_SCHED_IR_H) $(SEL_SCHED_DUMP_H) \
- $(EMIT_RTL_H)
-final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
- $(TREE_H) $(FLAGS_H) intl.h $(REGS_H) $(RECOG_H) conditions.h \
- insn-config.h $(INSN_ATTR_H) $(FUNCTION_H) output.h hard-reg-set.h \
- $(EXCEPT_H) debug.h xcoffout.h toplev.h $(DIAGNOSTIC_CORE_H) reload.h $(DWARF2OUT_H) \
- $(TREE_PASS_H) $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) $(EXPR_H) \
- dbxout.h $(CGRAPH_H) $(COVERAGE_H) \
- $(DF_H) $(GGC_H) $(CFGLOOP_H) $(PARAMS_H) $(TREE_FLOW_H) \
- $(TARGET_DEF_H) $(TREE_PRETTY_PRINT_H)
-recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_ERROR_H) \
- $(FUNCTION_H) $(BASIC_BLOCK_H) $(REGS_H) $(RECOG_H) $(EXPR_H) \
- $(FLAGS_H) insn-config.h $(INSN_ATTR_H) reload.h \
- addresses.h $(TM_P_H) $(TREE_PASS_H) hard-reg-set.h \
- $(DF_H) $(DBGCNT_H) $(TARGET_H) $(DIAGNOSTIC_CORE_H) insn-codes.h
-reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_ERROR_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
- insn-config.h reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
- $(BASIC_BLOCK_H) \
- $(TREE_PASS_H) $(TARGET_H) $(DF_H) $(EMIT_RTL_H)
-sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h sreal.h
-predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(FLAGS_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) \
- hard-reg-set.h $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(FUNCTION_H) $(EXCEPT_H) \
- $(TM_P_H) $(PREDICT_H) sreal.h $(PARAMS_H) $(TARGET_H) $(CFGLOOP_H) \
- $(COVERAGE_H) $(SCEV_H) $(GGC_H) predict.def \
- $(TREE_FLOW_H) $(TREE_PASS_H) $(EXPR_H) pointer-set.h
-lists.o: lists.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_CORE_H) \
- $(RTL_H) $(GGC_H) gt-lists.h
-bb-reorder.o : bb-reorder.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(FLAGS_H) output.h $(FIBHEAP_H) \
- $(TARGET_H) $(FUNCTION_H) $(TM_P_H) $(OBSTACK_H) $(EXPR_H) $(REGS_H) \
- $(PARAMS_H) toplev.h $(DIAGNOSTIC_CORE_H) $(TREE_PASS_H) $(DF_H) \
- $(EXCEPT_H) bb-reorder.h
-tracer.o : tracer.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(TREE_H) $(BASIC_BLOCK_H) hard-reg-set.h \
- $(FLAGS_H) $(PARAMS_H) $(COVERAGE_H) $(FIBHEAP_H) \
- $(TREE_PASS_H) $(TREE_FLOW_H) $(TREE_INLINE_H) $(CFGLOOP_H)
-timevar.o : timevar.c $(CONFIG_H) $(SYSTEM_H) $(TIMEVAR_H)
-regcprop.o : regcprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
- $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
- addresses.h reload.h $(DIAGNOSTIC_CORE_H) $(TREE_PASS_H) $(DF_H)
-regrename.o : regrename.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_ERROR_H) insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h \
- output.h $(RECOG_H) $(FUNCTION_H) $(OBSTACK_H) $(FLAGS_H) $(TM_P_H) \
- addresses.h reload.h $(TREE_PASS_H) $(DF_H) $(TARGET_H) \
- regrename.h $(EMIT_RTL_H)
-ifcvt.o : ifcvt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(REGS_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) insn-config.h $(FUNCTION_H) $(RECOG_H) \
- $(TARGET_H) $(BASIC_BLOCK_H) $(EXPR_H) output.h $(EXCEPT_H) $(TM_P_H) \
- $(OPTABS_H) $(CFGLOOP_H) hard-reg-set.h pointer-set.h \
- $(TREE_PASS_H) $(DF_H) $(DBGCNT_H)
-params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(COMMON_TARGET_H) \
- $(PARAMS_H) $(DIAGNOSTIC_CORE_H)
-pointer-set.o: pointer-set.c pointer-set.h $(CONFIG_H) $(SYSTEM_H)
-hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
-pretty-print.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h $(PRETTY_PRINT_H) \
- diagnostic-color.h
-errors.o : errors.c $(CONFIG_H) $(SYSTEM_H) errors.h
-dbgcnt.o: dbgcnt.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(DIAGNOSTIC_CORE_H) $(DBGCNT_H)
-lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(MACHMODE_H) $(TM_H) $(RTL_H) $(TM_P_H) $(FLAGS_H) \
- insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) $(OBSTACK_H) $(BITMAP_H) \
- $(EXPR_H) $(EXCEPT_H) $(REGS_H) $(TREE_PASS_H) $(DF_H) dce.h \
- lower-subreg.h
-target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) toplev.h target-globals.h \
- $(FLAGS_H) $(REGS_H) $(RTL_H) reload.h expmed.h $(EXPR_H) $(OPTABS_H) \
- $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h gcse.h bb-reorder.h \
- lower-subreg.h
-hw-doloop.o : hw-doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(DUMPFILE_H) \
- $(TM_H) \
- $(RTL_H) $(FLAGS_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) \
- $(DF_H) $(CFGLOOP_H) $(RECOG_H) $(TARGET_H) \
- $(REGS_H) hw-doloop.h
-file-find.o: file-find.c $(CONFIG_H) $(SYSTEM_H) file-find.h
-$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
- $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \
- output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(DIAGNOSTIC_CORE_H) \
- $(TARGET_H) $(LIBFUNCS_H) $(TARGET_DEF_H) $(FUNCTION_H) $(SCHED_INT_H) \
- $(TM_P_H) $(EXPR_H) langhooks.h $(GGC_H) $(OPTABS_H) $(REAL_H) \
- tm-constrs.h $(GIMPLE_H) $(DF_H) cselib.h $(COMMON_TARGET_H) hw-doloop.h \
- regrename.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $(out_file) $(OUTPUT_OPTION)
-context.o: context.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H) \
- $(CONTEXT_H) $(PASS_MANAGER_H)
-
-$(common_out_object_file): $(common_out_file) $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(COMMON_TARGET_H) $(COMMON_TARGET_DEF_H) $(PARAMS_H) \
- $(DIAGNOSTIC_CORE_H) $(FLAGS_H) $(OPTS_H) $(TM_H) $(TM_P_H) $(MACHMODE_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $< $(OUTPUT_OPTION)
+$(out_object_file): $(out_file)
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+$(common_out_object_file): $(common_out_file)
+ $(COMPILE) $<
+ $(POSTCOMPILE)
#
# Generate header and source files from the machine description,
# and compile them.
@@ -3551,50 +2017,6 @@ s-mddeps: $(md_file) $(MD_INCLUDES) build/genmddeps$(build_exeext)
$(SHELL) $(srcdir)/../move-if-change tmp-mddeps mddeps.mk
$(STAMP) s-mddeps
-# Header dependencies for generated source files.
-insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) output.h $(INSN_ATTR_H) \
- insn-config.h $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
-insn-automata.o : insn-automata.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) output.h $(INSN_ATTR_H) \
- insn-config.h toplev.h $(DIAGNOSTIC_CORE_H) $(RECOG_H) \
- $(TM_P_H) $(FLAGS_H) $(EMIT_RTL_H)
-insn-dfatab.o : insn-dfatab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) output.h $(INSN_ATTR_H) \
- insn-config.h $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
-insn-emit.o : insn-emit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(TM_P_H) $(FUNCTION_H) $(EXPR_H) $(OPTABS_H) \
- dfp.h $(FLAGS_H) output.h insn-config.h hard-reg-set.h $(RECOG_H) \
- $(RESOURCE_H) reload.h $(DIAGNOSTIC_CORE_H) $(REGS_H) tm-constrs.h \
- $(GGC_H) $(BASIC_BLOCK_H) $(TARGET_H)
-insn-enums.o : insn-enums.c $(CONFIG_H) $(SYSTEM_H) insn-constants.h
-insn-extract.o : insn-extract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H)
-insn-latencytab.o : insn-latencytab.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(RTL_H) $(REGS_H) output.h $(INSN_ATTR_H) \
- insn-config.h $(DIAGNOSTIC_CORE_H) $(RECOG_H) $(TM_P_H) $(FLAGS_H)
-insn-modes.o : insn-modes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(MACHMODE_H)
-insn-opinit.o : insn-opinit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(TM_P_H) insn-config.h $(FLAGS_H) $(RECOG_H) \
- $(EXPR_H) $(OPTABS_H)
-insn-output.o : insn-output.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(GGC_H) $(REGS_H) conditions.h \
- hard-reg-set.h insn-config.h $(INSN_ATTR_H) $(EXPR_H) output.h \
- $(RECOG_H) $(FUNCTION_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) insn-codes.h $(TM_P_H)\
- $(TARGET_H) tm-constrs.h
-insn-peep.o : insn-peep.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- insn-config.h $(RTL_H) $(TM_P_H) $(REGS_H) output.h \
- $(RECOG_H) $(EXCEPT_H) $(FUNCTION_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) tm-constrs.h
-insn-preds.o : insn-preds.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(TREE_H) insn-config.h $(RECOG_H) output.h \
- $(FLAGS_H) $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) \
- $(DIAGNOSTIC_CORE_H) reload.h $(REGS_H) tm-constrs.h
-insn-recog.o : insn-recog.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) insn-config.h $(RECOG_H) output.h $(FLAGS_H) \
- $(FUNCTION_H) hard-reg-set.h $(RESOURCE_H) $(TM_P_H) $(DIAGNOSTIC_CORE_H) \
- reload.h $(REGS_H) tm-constrs.h
-
# For each of the files generated by running a generator program over
# the machine description, the following static pattern rules run the
# generator program only if the machine description has changed,
@@ -3837,6 +2259,7 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \
$(srcdir)/tree-ssa-propagate.c \
$(srcdir)/tree-phinodes.c \
$(srcdir)/tree-ssa-alias.h \
+ $(srcdir)/tree-ssanames.h \
$(srcdir)/ipa-prop.h \
$(srcdir)/trans-mem.c \
$(srcdir)/lto-streamer.h \
@@ -3893,12 +2316,10 @@ s-gtype: build/gengtype$(build_exeext) $(filter-out [%], $(GTFILES)) \
generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \
$(simple_generated_h) specs.h \
tree-check.h genrtl.h insn-modes.h tm-preds.h tm-constrs.h \
- $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h
-
-# In order for parallel make to really start compiling the expensive
-# objects from $(OBJS) as early as possible, build all their
-# prerequisites strictly before all objects.
-$(ALL_HOST_OBJS) : | $(generated_files)
+ $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \
+ options.h target-hooks-def.h insn-opinit.h \
+ common/common-target-hooks-def.h pass-instances.def \
+ c-family/c-target-hooks-def.h
#
# How to compile object files to run on the build machine.
@@ -4086,7 +2507,6 @@ gengtype-lex.c : gengtype-lex.l
#
# Remake internationalization support.
CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
-intl.o: intl.c $(CONFIG_H) $(SYSTEM_H) coretypes.h intl.h Makefile
#
# Remake cpp.
@@ -4107,13 +2527,8 @@ PREPROCESSOR_DEFINES = \
@TARGET_SYSTEM_ROOT_DEFINE@
CFLAGS-cppbuiltin.o += $(PREPROCESSOR_DEFINES) -DBASEVER=$(BASEVER_s)
-cppbuiltin.o: cppbuiltin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TARGET_H) $(TARGET_DEF) $(TREE_H) $(CPP_ID_DATA_H) \
- cppbuiltin.h version.h Makefile
CFLAGS-cppdefault.o += $(PREPROCESSOR_DEFINES)
-cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- cppdefault.h Makefile
# Note for the stamp targets, we run the program `true' instead of
# having an empty command (nothing following the semicolon).
@@ -4133,11 +2548,6 @@ s-iov: build/gcov-iov$(build_exeext) $(BASEVER) $(DEVPHASE)
$(SHELL) $(srcdir)/../move-if-change tmp-gcov-iov.h gcov-iov.h
$(STAMP) s-iov
-gcov.o: gcov.c gcov-io.c $(GCOV_IO_H) intl.h $(SYSTEM_H) coretypes.h $(TM_H) \
- $(CONFIG_H) version.h $(DIAGNOSTIC_H)
-gcov-dump.o: gcov-dump.c gcov-io.c $(GCOV_IO_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(CONFIG_H) version.h intl.h $(DIAGNOSTIC_H)
-
GCOV_OBJS = gcov.o
gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@
@@ -4688,7 +3098,7 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(host_xm_file_list) $(host_xm_include_list) $(xm_include_list) \
intl.h $(PLUGIN_VERSION_H) $(DIAGNOSTIC_H) ${C_TREE_H} \
$(C_COMMON_H) c-family/c-objc.h $(C_PRETTY_PRINT_H) \
- tree-iterator.h $(PLUGIN_H) $(TREE_FLOW_H) langhooks.h incpath.h debug.h \
+ tree-iterator.h $(PLUGIN_H) $(TREE_SSA_H) langhooks.h incpath.h debug.h \
$(EXCEPT_H) tree-ssa-sccvn.h real.h output.h $(IPA_UTILS_H) \
$(C_PRAGMA_H) $(CPPLIB_H) $(FUNCTION_H) \
cppdefault.h flags.h $(MD5_H) params.def params.h prefix.h tree-inline.h \
@@ -4770,20 +3180,14 @@ install-common: native lang.install-common installdirs
fi
# Install the driver program as $(target_noncanonical)-gcc,
-# $(target_noncanonical)-gcc-$(version)
-# and also as either gcc (if native) or $(gcc_tooldir)/bin/gcc.
+# $(target_noncanonical)-gcc-$(version), and also as gcc if native.
install-driver: installdirs xgcc$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-$(INSTALL_PROGRAM) xgcc$(exeext) $(DESTDIR)$(bindir)/$(GCC_INSTALL_NAME)$(exeext)
-rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-$(version)$(exeext)
-( cd $(DESTDIR)$(bindir) && \
$(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-$(version)$(exeext) )
- -if [ -f gcc-cross$(exeext) ] ; then \
- if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
- rm -f $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \
- $(INSTALL_PROGRAM) gcc-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gcc$(exeext); \
- else true; fi; \
- else \
+ -if [ ! -f gcc-cross$(exeext) ] ; then \
rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GCC_INSTALL_NAME)$(exeext) $(target_noncanonical)-gcc-tmp$(exeext) && \
@@ -5392,3 +3796,18 @@ po/gcc.pot: force
$(MAKE) srcextra
AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
$(XGETTEXT) gcc $(srcdir)
+
+#
+
+# Dependency information.
+
+# In order for parallel make to really start compiling the expensive
+# objects from $(OBJS) as early as possible, build all their
+# prerequisites strictly before all objects.
+$(ALL_HOST_OBJS) : | $(generated_files)
+
+# Include the auto-generated dependencies for all host objects.
+DEPFILES = \
+ $(foreach obj,$(ALL_HOST_OBJS),\
+ $(dir $(obj))$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $(obj))))
+-include $(DEPFILES)
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 1f3ce9d6935..1bcf9056584 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -99,12 +99,19 @@ m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
+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/depstand.m4])
m4_include([../config/dfp.m4])
m4_include([../config/gettext-sister.m4])
m4_include([../config/iconv.m4])
m4_include([../config/lcmessage.m4])
+m4_include([../config/lead-dot.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
@@ -114,9 +121,4 @@ m4_include([../config/picflag.m4])
m4_include([../config/progtest.m4])
m4_include([../config/stdint.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 61fd991bef2..61d8a4cfa36 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,391 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * gcc-interface/Makefile.in (OUTPUT_OPTION): Define as "-o $@".
+
+2013-09-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/58264
+ * gcc-interface/trans.c (Attribute_to_gnu): Define GNAT_PREFIX local
+ variable and use it throughout.
+ <Attr_Length>: Note whether the prefix is the dereference of a pointer
+ to unconstrained array and, in this case, capture the result for both
+ Attr_First and Attr_Last.
+
+2013-09-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Abstract_State>: New.
+
+2013-09-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (gigi): Remove dead code.
+
+2013-09-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (Subprogram_Body_to_gnu): Pop the stack of
+ return variables for subprograms using the CICO mechanism.
+
+2013-09-13 Dominique Dhumieres <dominiq@lps.ens.fr>
+
+ * gcc-interface/Makefile.in: Fix darwin Filter to match on $target_os,
+ not $target_cpu.
+
+2013-09-11 Thomas Schwinge <thomas@codesourcery.com>
+ Olivier Hainque <hainque@adacore.com>
+
+ * gcc-interface/Makefile.in: Import target_cpu, target_vendor,
+ target_os and their host_ counterparts. Remove host_canonical and
+ target_cpu_default, unused. Remove local ad-hoc computations of
+ "host", "targ", "arch", "osys" and "manu". Replace uses of these by
+ uses of the now imported family, hence back to filters against
+ canonical values. Remove filters on e500 for target_cpu, expected to
+ be canonicalized into powerpc. Invert the logic filtering on 64bit
+ sparc for VxWorks. Simplify the filtering logic for bareboard tools
+ target pairs, now using straight elf/eabi filters on the target_os
+ part only.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Replace_Anonymoous_Access_To_Protected_Subprogram): If
+ the return type is itself an access to function, recurse to emit
+ another anonymous type.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * err_vars.ads (Warning_Doc_Switch): Ignored in VMS mode.
+ * errout.adb (Warning_Doc_Switch): Ignored in VMS mode.
+ * errout.ads (Warning_Doc_Switch): Ignored in VMS mode.
+ * inline.ads (Warnings): New component in Pending_Body_Info.
+ * sem_ch12.adb (Pending_Body_Info): Save and restore warnings
+ at instantiation point.
+ * warnsw.adb (Save_Warnings): New function (Restore_Warnings):
+ New procedure Remove special handling of Warning_Doc_Switch,
+ cleaner to handle the VMS case in errout, than to introduce
+ undocumented oddities here.
+ * warnsw.ads (Warning_Record) : New type.
+ (Save_Warnings): New function.
+ (Restore_Warnings): New procedure.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * sinput.adb (Check_For_BOM): Avoid reading past end of file.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb (Error_Msg_Ada_2012_Feature): New procedure.
+ * errout.ads (Error_Msg_Ada_2012_Feature): New procedure.
+ * inline.ads: Save/Restore Ada_Version_Pragma.
+ * opt.adb: Save/Restore Ada_Version_Pragma.
+ * opt.ads (Ada_Version_Pragma): New variable.
+ * par-ch11.adb, par-ch12.adb, par-ch13.adb, par-ch4.adb, par-ch5.adb,
+ par-ch6.adb, par-ch8.adb, par-prag.adb: Use Error_Msg_Ada_2012_Feature.
+ * prj.adb: Initialize Ada_Version_Pragma.
+ * sem_attr.adb: Use Error_Msg_Ada_2012_Feature.
+ * sem_ch12.adb, sem_ch8.adb: Save/restore Ada_Version_Pragma.
+ * sem_prag.adb (Analyze_Pragma, cases Ada_xx): Set Ada_Version_Pragma.
+ * switch-c.adb: Initialize Ada_Version_Pragma.
+ * sem_ch12.adb: Minor reformatting.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Process_Subtype): Discard constraint on access
+ to class-wide type. Such constraints are not supported and are
+ considered a language pathology.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * gnatbind.adb: Correct starting date in --version string.
+ * gnatdll.adb: Use Check_Version_And_Help_G to implement --help
+ and --version.
+ * gnatkr.adb: Use Check_Version_And_Help_G to implement --help
+ and --version.
+ * gnatlink.adb: Correct starting date in --version string.
+ * gnatls.adb: Correct starting date in --version string.
+ * make.adb: Correct starting date in --version string.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * switch-c.adb: Minor reformatting.
+ * atree.ads (Original_Nodes): Add documentation on ASIS usage.
+ * sinfo.ads: Add section on ASIS mode (documentation only).
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma, case Warnings): Don't allow
+ REASON parameter in compiler units (bootstrap issues).
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * gnat1drv.adb (Adjust_Global_Switches): Output warning if
+ -gnateE specified for a target that does not support it.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma, case SPARK_Mode): Handle properly
+ a subprogram body without previous spec.
+
+2013-09-10 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_ch4.adb: Minor typo fixes.
+
+2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * aspects.adb (Aspects_On_Body_OK): New routine.
+ * aspects.ads: Modify type Aspect_Expression to include
+ the Optional_XXX variants. Update the contents of
+ table Aspect_Argument. Add table Aspect_On_Body_OK.
+ (Aspects_On_Body_OK): New routine.
+ * par-ch13.adb (Get_Aspect_Specifications): Account for optional
+ names and expressions when parsing an aspect.
+ * sem_ch6.adb: Add with and use clause for Aspects.
+ (Analyze_Subprogram_Body_Helper): Do not emit an error when
+ analyzing a body with aspects that can be applied simultaneously
+ to both spec and body.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Insert the
+ corresponding pragma of an aspect that applies to a subprogram
+ body in the declarative part.
+ (Make_Aitem_Pragma): Do not generate a pragma with an empty argument
+ list.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * switch-c.adb: Diagnose -gnatc given after -gnatRm.
+ * gnat_ugn.texi: Add documentation for -gnatRm.
+ * usage.adb: Minor reorganization (put style entries in proper
+ order) Document -gnatRm switch.
+ * sinfo.ads: Minor comment fix.
+
+2013-09-10 Sergey Rybin <rybin@adacore.com frybin>
+
+ * tree_io.ads: Update ASIS_Version_Number.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Access_Subprogram_Declaration): Check whether the
+ designated type can appear in a parameterless call.
+ * sem_ch4.adb (Analyze_Call): Do not insert an explicit dereference
+ in the case of an indirect call through an access function that
+ returns an array type.
+ (Analyze_One_Call): Handle properly legal parameterless calls
+ whose result is indexed, in constructs of the for F.all (I)
+ * sem_ch6.ads (May_Need_Actuals): Make public, for use on access
+ to subprogram types.
+ * sem_res.adb (Resolve_Call): If the call is indirect, there is
+ no entity to set on the name in the call.
+
+2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * aspects.adb: Add entries in the Has_Aspect_Specifications_Flag
+ table for package body and body stubs.
+ (Move_Or_Merge_Aspects): New routine.
+ (Remove_Aspects): New routine.
+ * aspects.ads (Move_Aspects): Update comment on usage.
+ (Move_Or_Merge_Aspects): New routine.
+ (Remove_Aspects): New routine.
+ * par-ch3.adb: Update the grammar of private_type_declaration,
+ private_extension_declaration, object_renaming_declaration,
+ and exception_renaming_declaration.
+ (P_Subprogram): Parse the
+ aspect specifications that apply to a body stub.
+ * par-ch6.adb: Update the grammar of subprogram_body_stub and
+ generic_instantiation.
+ * par-ch7.adb: Update the grammar of package_declaration,
+ package_specification, package_body, package_renaming_declaration,
+ package_body_stub.
+ (P_Package): Parse the aspect specifications
+ that apply to a body, a body stub and package renaming.
+ * par-ch9.adb: Update the grammar of entry_declaration,
+ protected_body, protected_body_stub, task_body,
+ and task_body_stub.
+ (P_Protected): Add local variable
+ Aspect_Sloc. Add local constant Dummy_Node. Parse the aspect
+ specifications that apply to a protected body and a protected
+ body stub.
+ (P_Task): Add local variable Aspect_Sloc. Add local
+ constant Dummy_Node. Parse the aspect specifications that apply
+ to a task body and a task body stub.
+ * par-ch12.adb: Update the grammar of
+ generic_renaming_declaration.
+ (P_Generic): Parse the aspect
+ specifications that apply to a generic renaming.
+ * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not emit
+ an error when analyzing aspects that apply to a body stub. Such
+ aspects are relocated to the proper body.
+ * sem_ch7.adb (Analyze_Package_Body_Helper): Analyze the aspect
+ specifications that apply to a body.
+ * sem_ch9.adb (Analyze_Protected_Body): Warn about user-defined
+ aspects not being supported on protected bodies. Remove the
+ aspect specifications. (Analyze_Single_Protected_Declaration):
+ Analyze the aspects that apply to a single protected declaration.
+ (Analyze_Task_Body): Warn about user-defined aspects not being
+ supported on task bodies. Remove the aspect specifications.
+ * sem_ch10.adb: Add with and use clause for Aspects.
+ (Analyze_Package_Body_Stub): Propagate the aspect specifications
+ from the stub to the proper body.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Insert the
+ corresponding pragma of an aspect that applies to a body in the
+ declarations of the body.
+ * sinfo.ads: Update the gramma of expression_function,
+ private_type_declaration, private_extension_declaration,
+ object_renaming_declaration, exception_renaming_declaration,
+ package_renaming_declaration, subprogram_renaming_declaration,
+ generic_renaming_declaration, entry_declaration,
+ subprogram_body_stub, package_body_stub, task_body_stub,
+ generic_subprogram_declaration.
+
+2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma): Add processing
+ for aspect/pragma SPARK_Mode when it applies to a [library-level]
+ subprogram or package [body].
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Document that -gnatc and -gnatR cannot be
+ given together.
+ * switch-c.adb (Scan_Front_End_Switches): Give error if both
+ -gnatR and -gnatc given.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * g-table.ads, g-table.adb (For_Each): New generic procedure
+ (Sort_Table): New generic procedure.
+
+2013-09-10 Thomas Quinot <quinot@adacore.com>
+
+ * adaint.c (__gnat_is_executable_file_attr): Should be true
+ for an executable regular file only only (not for a directory
+ that has the executable permission).
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb: Further work on operator calls in ASIS.
+
+2013-09-10 Yannick Moy <moy@adacore.com>
+
+ * sinfo.ads, sem_prag.ads, sem_ch13.adb: Minor correction and comment
+ update.
+
+2013-09-10 Thomas Quinot <quinot@adacore.com>
+
+ * aspects.ads, sem_ch13.adb: Minor reformatting.
+ * adaint.c (__gnat_set_close_on_exec): Add comment documenting
+ that this routine is shared between OS_Lib and Sockets.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * exp_prag.adb (Expand_Pragma_Check): Ignore pragma if Is_Ignored set.
+ * sem_ch13.adb (Make_Aitem_Pragma): Set Is_Checked if needed.
+ * sem_prag.adb (Check_Kind): Moved from spec (Analyze_Pragma):
+ Make sure Is_Ignored/Is_Checked are set right (Analyze_Pragma,
+ case Check): Ditto (Check_Applicable_Policy): Handle
+ Statement_Assertion case Throughout, set and check the Is_Checked
+ flag as appropriate.
+ * sem_prag.ads (Check_Kind): Moved to body.
+ * sinfo.ads, sinfo.adb (Is_Checked): New flag.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * aspects.ads (Delay_Type): New type (Aspect_Delay): New table.
+ * einfo.adb (Has_Delayed_Rep_Aspects): New flag
+ (May_Inherit_Delayed_Rep_Aspects): New flag (Rep_Clause): Removed
+ (use Get_Attribute_Representation_Clause).
+ * einfo.ads (Has_Delayed_Rep_Aspects): New flag
+ (May_Inherit_Delayed_Rep_Aspects): New flag
+ * freeze.adb: Minor reformatting
+ * sem_ch13.adb (Analyze_Aspect_Speficifications): Redo
+ handling of delayed evaluation, including optimizing some cases
+ and avoiding delays.
+ (Analyze_Aspects_At_Freeze_Point): Now
+ handled inheriting delayed rep aspects for type derivation case.
+ (Inherit_Delayed_Rep_Aspects): New procedure
+ * sem_ch13.ads (Analyze_Aspects_At_Freeze_Point): Now handled
+ inheriting delayed rep aspects for type derivation case.
+ * sem_ch3.adb (Build_Derived_Type): Set
+ May_Inherit_Derived_Rep_Aspects if parent type flag
+ Has_Delayed_Rep_Aspects is set
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * errout.adb (Finalize): Don't delete real errors with specific
+ warning control.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch9.adb (Expand_N_Timed_Entry_Call,
+ Expand_N_Conditional_Entry_Call, Expand_N_Asynchronous_Select):
+ Handle properly a trigger that is a call to a primitive operation
+ of a type that implements a limited interface, if the type itself
+ is not limited.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb, sinfo.ads, exp_ch9.adb, sem_prag.adb, sem_ch12.adb,
+ exp_ch4.adb, sprint.adb: Minor reformatting.
+
+2013-09-10 Yannick Moy <moy@adacore.com>
+
+ * sinfo.ads: Document splitting of pre/post in N_Contract description.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Op_Multiply): If the operation is of the
+ form X * 2 ** N and it has been marked Is_Power_Of_2_For_Shift,
+ add a mod operation if the result type is a binary modular type.
+
+2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_prag.adb (Check_Mode_Restriction_In_Enclosing_Context): Add local
+ variable Context. Remove local variable Subp_Id. Start the
+ context traversal from the current subprogram rather than the
+ current scope. Update the scope traversal and error reporting.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch9.adb (Expand_N_Timed_Entry_Call): New procedure
+ Rewrite_Triggering_Statements, to encapsulate the statements that
+ follow the trigger of the entry call. This procedure is needed
+ when the trigger is a dispatching call, because the expansion
+ requires several copies of those statements. The procedure is
+ more efficient, and preserves non-local references when the
+ construct is within an instance.
+
+2013-09-10 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch12.adb (Analyze_Package_Instantiation): If the
+ instantiation is a compilation unit, analyze aspects before
+ analyzing the package declaration for the instance.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): If the
+ corresponding node is a package instantiation, insert generated
+ pragmas at the head of visible declarations.
+ * sem_prag.adb (Analyze_Pragma, case Preelaborate): In an instance
+ do not ignore the pragma if it comes from an aspect specification
+ in the instance, and not from the generic unit.
+ * sprint.adb (Sprint_Node_Actual): For a package declaration that
+ is an instantiation, print aspects after declaration.
+
+2013-09-10 Robert Dewar <dewar@adacore.com>
+
+ * einfo.adb, sem_prag.adb, rtsfind.ads: Minor reformatting.
+
+2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_prag.adb (Get_SPARK_Mode_Id): Handle the
+ case where the pragma may appear without an argument.
+ (Analyze_Global_List): Add expanded_name to the list of constructs
+ that denote a single item.
+ (Collect_Global_List): Add expanded_name to the list of constructs
+ that denote a single item.
+
+2013-09-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * exp_ch4.adb (Apply_Accessibility_Check): Add local constant
+ Pool_Id and local variables Fin_Call and Free_Stmt. Finalize
+ and deallocate a heap-allocated class-wide object after it
+ has been determined that it violates the accessibility rules.
+ * rtsfind.ads: Add new RTU_Id for System.Memory. Add new RE_Id
+ and entry in RE_Unit_Table for RE_Free.
+
2013-09-01 Eric Botcazou <ebotcazou@adacore.com>
Iain Sandoe <iain@codesourcery.com>
@@ -297,7 +685,7 @@
node for subsequent checks, because the rewriting of the node
does not take place during pre-analysis.
- 2013-07-08 Robert Dewar <dewar@adacore.com>
+2013-07-08 Robert Dewar <dewar@adacore.com>
* sem_ch8.adb, exp_ch3.adb: Minor reformatting.
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index c4bb7540c52..f76edb73995 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -2264,7 +2264,7 @@ __gnat_is_executable_file_attr (char* name, struct file_attributes* attr)
#endif
}
- return attr->executable;
+ return attr->regular && attr->executable;
}
int
@@ -3748,6 +3748,11 @@ get_gcc_version (void)
#endif
}
+/*
+ * Set Close_On_Exec as indicated.
+ * Note: this is used for both GNAT.OS_Lib and GNAT.Sockets.
+ */
+
int
__gnat_set_close_on_exec (int fd ATTRIBUTE_UNUSED,
int close_on_exec_p ATTRIBUTE_UNUSED)
diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb
index d02edb25702..1d736467b46 100644
--- a/gcc/ada/aspects.adb
+++ b/gcc/ada/aspects.adb
@@ -140,6 +140,40 @@ package body Aspects is
end if;
end Aspect_Specifications;
+ ------------------------
+ -- Aspects_On_Body_OK --
+ ------------------------
+
+ function Aspects_On_Body_OK (N : Node_Id) return Boolean is
+ Aspect : Node_Id;
+ Aspects : List_Id;
+
+ begin
+ -- The routine should be invoked on a body [stub] with aspects
+
+ pragma Assert (Has_Aspects (N));
+ pragma Assert (Nkind (N) in N_Body_Stub
+ or else Nkind_In (N, N_Package_Body,
+ N_Protected_Body,
+ N_Subprogram_Body,
+ N_Task_Body));
+
+ -- Look through all aspects and see whether they can be applied to a
+ -- body.
+
+ Aspects := Aspect_Specifications (N);
+ Aspect := First (Aspects);
+ while Present (Aspect) loop
+ if not Aspect_On_Body_OK (Get_Aspect_Id (Aspect)) then
+ return False;
+ end if;
+
+ Next (Aspect);
+ end loop;
+
+ return True;
+ end Aspects_On_Body_OK;
+
-----------------
-- Find_Aspect --
-----------------
@@ -271,6 +305,31 @@ package body Aspects is
end if;
end Move_Aspects;
+ ---------------------------
+ -- Move_Or_Merge_Aspects --
+ ---------------------------
+
+ procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id) is
+ begin
+ if Has_Aspects (From) then
+
+ -- Merge the aspects of From into To. Make sure that From has no
+ -- aspects after the merge takes place.
+
+ if Has_Aspects (To) then
+ Append_List
+ (List => Aspect_Specifications (From),
+ To => Aspect_Specifications (To));
+ Remove_Aspects (From);
+
+ -- Otherwise simply move the aspects
+
+ else
+ Move_Aspects (From => From, To => To);
+ end if;
+ end if;
+ end Move_Or_Merge_Aspects;
+
-----------------------------------
-- Permits_Aspect_Specifications --
-----------------------------------
@@ -294,6 +353,8 @@ package body Aspects is
N_Generic_Subprogram_Declaration => True,
N_Object_Declaration => True,
N_Object_Renaming_Declaration => True,
+ N_Package_Body => True,
+ N_Package_Body_Stub => True,
N_Package_Declaration => True,
N_Package_Instantiation => True,
N_Package_Specification => True,
@@ -302,6 +363,7 @@ package body Aspects is
N_Private_Type_Declaration => True,
N_Procedure_Instantiation => True,
N_Protected_Body => True,
+ N_Protected_Body_Stub => True,
N_Protected_Type_Declaration => True,
N_Single_Protected_Declaration => True,
N_Single_Task_Declaration => True,
@@ -311,6 +373,7 @@ package body Aspects is
N_Subprogram_Body_Stub => True,
N_Subtype_Declaration => True,
N_Task_Body => True,
+ N_Task_Body_Stub => True,
N_Task_Type_Declaration => True,
others => False);
@@ -319,6 +382,18 @@ package body Aspects is
return Has_Aspect_Specifications_Flag (Nkind (N));
end Permits_Aspect_Specifications;
+ --------------------
+ -- Remove_Aspects --
+ --------------------
+
+ procedure Remove_Aspects (N : Node_Id) is
+ begin
+ if Has_Aspects (N) then
+ Aspect_Specifications_Hash_Table.Remove (N);
+ Set_Has_Aspects (N, False);
+ end if;
+ end Remove_Aspects;
+
-----------------
-- Same_Aspect --
-----------------
diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads
index 5a093af21cf..5e8046d1ad0 100644
--- a/gcc/ada/aspects.ads
+++ b/gcc/ada/aspects.ads
@@ -273,14 +273,15 @@ package Aspects is
-- The following type is used for indicating allowed expression forms
type Aspect_Expression is
- (Optional, -- Optional boolean expression
- Expression, -- Required expression
- Name); -- Required name
+ (Expression, -- Required expression
+ Name, -- Required name
+ Optional_Expression, -- Optional boolean expression
+ Optional_Name); -- Optional name
-- The following array indicates what argument type is required
Aspect_Argument : constant array (Aspect_Id) of Aspect_Expression :=
- (No_Aspect => Optional,
+ (No_Aspect => Optional_Expression,
Aspect_Abstract_State => Expression,
Aspect_Address => Expression,
Aspect_Alignment => Expression,
@@ -323,7 +324,7 @@ package Aspects is
Aspect_Simple_Storage_Pool => Name,
Aspect_Size => Expression,
Aspect_Small => Expression,
- Aspect_SPARK_Mode => Name,
+ Aspect_SPARK_Mode => Optional_Name,
Aspect_Static_Predicate => Expression,
Aspect_Storage_Pool => Name,
Aspect_Storage_Size => Expression,
@@ -338,8 +339,8 @@ package Aspects is
Aspect_Warnings => Name,
Aspect_Write => Name,
- Boolean_Aspects => Optional,
- Library_Unit_Aspects => Optional);
+ Boolean_Aspects => Optional_Expression,
+ Library_Unit_Aspects => Optional_Expression);
-----------------------------------------
-- Table Linking Names and Aspect_Id's --
@@ -459,6 +460,214 @@ package Aspects is
-- Given an aspect specification, return the corresponding aspect_id value.
-- If the name does not match any aspect, return No_Aspect.
+ ------------------------------------
+ -- Delaying Evaluation of Aspects --
+ ------------------------------------
+
+ -- The RM requires that all language defined aspects taking an expression
+ -- delay evaluation of the expression till the freeze point of the entity
+ -- to which the aspect applies. This allows forward references, and is of
+ -- use for example in connection with preconditions and postconditions
+ -- where the requirement of making all references in contracts to local
+ -- functions be backwards references would be onerous.
+
+ -- For consistency, even attributes like Size are delayed, so we can do:
+
+ -- type A is range 1 .. 10
+ -- with Size => Not_Defined_Yet;
+ -- ..
+ -- Not_Defined_Yet : constant := 64;
+
+ -- Resulting in A having a size of 64, which gets set when A is frozen.
+ -- Furthermore, we can have a situation like
+
+ -- type A is range 1 .. 10
+ -- with Size => Not_Defined_Yet;
+ -- ..
+ -- type B is new A;
+ -- ..
+ -- Not_Defined_Yet : constant := 64;
+
+ -- where the Size of A is considered to have been previously specified at
+ -- the point of derivation, even though the actual value of the size is
+ -- not known yet, and in this example B inherits the size value of 64.
+
+ -- Our normal implementation model (prior to Ada 2012) was simply to copy
+ -- inheritable attributes at the point of derivation. Then any subsequent
+ -- representation items apply either to the parent type, not affecting the
+ -- derived type, or to the derived type, not affecting the parent type.
+
+ -- To deal with the delayed aspect case, we use two flags. The first is
+ -- set on the parent type if it has delayed representation aspects. This
+ -- flag Has_Delayed_Rep_Aspects indicates that if we derive from this type
+ -- we have to worry about making sure we inherit any delayed aspects. The
+ -- second flag is set on a derived type: May_Have_Inherited_Rep_Aspects
+ -- is set if the parent type has Has_Delayed_Rep_Aspects set.
+
+ -- When we freeze a derived type, if the May_Have_Inherited_Rep_Aspects
+ -- flag is set, then we call Freeze.Inherit_Delayed_Rep_Aspects when
+ -- the derived type is frozen, which deals with the necessary copying of
+ -- information from the parent type, which must be frozen at that point
+ -- (since freezing the derived type first freezes the parent type).
+
+ -- The following shows which aspects are delayed. There are three cases:
+
+ type Delay_Type is
+ (Always_Delay,
+ -- This aspect is not a representation aspect that can be inherited and
+ -- is always delayed, as required by the language definition.
+
+ Never_Delay,
+ -- There are two cases. There are language defined aspects like
+ -- Convention where the "expression" is simply an uninterpreted
+ -- identifier, and there is no issue of evaluating it and thus no
+ -- issue of delaying the evaluation. The second case is implementation
+ -- defined aspects where we have decided that we don't want to allow
+ -- delays (and for our own aspects we can do what we like!).
+
+ Rep_Aspect);
+ -- These are the cases of representation aspects that are in general
+ -- delayed, and where there is a potential issue of derived types that
+ -- inherit delayed representation values.
+
+ -- Note: even if this table indicates that an aspect is delayed, we never
+ -- delay Boolean aspects that have a missing expression (taken as True),
+ -- or expressions for delayed rep items that consist of an integer literal
+ -- (most cases of Size etc. in practice), since in these cases we know we
+ -- can get the value of the expression without delay. Note that we still
+ -- need to delay Boolean aspects that are specifically set to True:
+
+ -- type R is array (0 .. 31) of Boolean
+ -- with Pack => True;
+ -- True : constant Boolean := False;
+
+ -- This is nonsense, but we need to make it work and result in R not
+ -- being packed, and if we have something like:
+
+ -- type R is array (0 .. 31) of Boolean
+ -- with Pack => True;
+ -- RR : R;
+ -- True : constant Boolean := False;
+
+ -- This is illegal because the visibility of True changes after the freeze
+ -- point, which is not allowed, and we need the delay mechanism to properly
+ -- diagnose this error.
+
+ Aspect_Delay : constant array (Aspect_Id) of Delay_Type :=
+ (No_Aspect => Always_Delay,
+ Aspect_Address => Always_Delay,
+ Aspect_All_Calls_Remote => Always_Delay,
+ Aspect_Asynchronous => Always_Delay,
+ Aspect_Attach_Handler => Always_Delay,
+ Aspect_Compiler_Unit => Always_Delay,
+ Aspect_Constant_Indexing => Always_Delay,
+ Aspect_Contract_Cases => Always_Delay,
+ Aspect_CPU => Always_Delay,
+ Aspect_Default_Iterator => Always_Delay,
+ Aspect_Default_Value => Always_Delay,
+ Aspect_Default_Component_Value => Always_Delay,
+ Aspect_Depends => Always_Delay,
+ Aspect_Discard_Names => Always_Delay,
+ Aspect_Dispatching_Domain => Always_Delay,
+ Aspect_Dynamic_Predicate => Always_Delay,
+ Aspect_Elaborate_Body => Always_Delay,
+ Aspect_External_Name => Always_Delay,
+ Aspect_External_Tag => Always_Delay,
+ Aspect_Export => Always_Delay,
+ Aspect_Favor_Top_Level => Always_Delay,
+ Aspect_Global => Always_Delay,
+ Aspect_Implicit_Dereference => Always_Delay,
+ Aspect_Import => Always_Delay,
+ Aspect_Independent => Always_Delay,
+ Aspect_Independent_Components => Always_Delay,
+ Aspect_Inline => Always_Delay,
+ Aspect_Inline_Always => Always_Delay,
+ Aspect_Input => Always_Delay,
+ Aspect_Interrupt_Handler => Always_Delay,
+ Aspect_Interrupt_Priority => Always_Delay,
+ Aspect_Invariant => Always_Delay,
+ Aspect_Iterator_Element => Always_Delay,
+ Aspect_Link_Name => Always_Delay,
+ Aspect_Lock_Free => Always_Delay,
+ Aspect_No_Return => Always_Delay,
+ Aspect_Output => Always_Delay,
+ Aspect_Persistent_BSS => Always_Delay,
+ Aspect_Post => Always_Delay,
+ Aspect_Postcondition => Always_Delay,
+ Aspect_Pre => Always_Delay,
+ Aspect_Precondition => Always_Delay,
+ Aspect_Predicate => Always_Delay,
+ Aspect_Preelaborable_Initialization => Always_Delay,
+ Aspect_Preelaborate => Always_Delay,
+ Aspect_Preelaborate_05 => Always_Delay,
+ Aspect_Priority => Always_Delay,
+ Aspect_Pure => Always_Delay,
+ Aspect_Pure_05 => Always_Delay,
+ Aspect_Pure_12 => Always_Delay,
+ Aspect_Pure_Function => Always_Delay,
+ Aspect_Read => Always_Delay,
+ Aspect_Relative_Deadline => Always_Delay,
+ Aspect_Remote_Access_Type => Always_Delay,
+ Aspect_Remote_Call_Interface => Always_Delay,
+ Aspect_Remote_Types => Always_Delay,
+ Aspect_Shared => Always_Delay,
+ Aspect_Shared_Passive => Always_Delay,
+ Aspect_Simple_Storage_Pool => Always_Delay,
+ Aspect_Simple_Storage_Pool_Type => Always_Delay,
+ Aspect_Static_Predicate => Always_Delay,
+ Aspect_Storage_Pool => Always_Delay,
+ Aspect_Stream_Size => Always_Delay,
+ Aspect_Suppress => Always_Delay,
+ Aspect_Suppress_Debug_Info => Always_Delay,
+ Aspect_Type_Invariant => Always_Delay,
+ Aspect_Unchecked_Union => Always_Delay,
+ Aspect_Universal_Aliasing => Always_Delay,
+ Aspect_Universal_Data => Always_Delay,
+ Aspect_Unmodified => Always_Delay,
+ Aspect_Unreferenced => Always_Delay,
+ Aspect_Unreferenced_Objects => Always_Delay,
+ Aspect_Unsuppress => Always_Delay,
+ Aspect_Variable_Indexing => Always_Delay,
+ Aspect_Write => Always_Delay,
+
+ Aspect_Abstract_State => Never_Delay,
+ Aspect_Ada_2005 => Never_Delay,
+ Aspect_Ada_2012 => Never_Delay,
+ Aspect_Convention => Never_Delay,
+ Aspect_Dimension => Never_Delay,
+ Aspect_Dimension_System => Never_Delay,
+ Aspect_SPARK_Mode => Never_Delay,
+ Aspect_Synchronization => Never_Delay,
+ Aspect_Test_Case => Never_Delay,
+ Aspect_Warnings => Never_Delay,
+
+ Aspect_Alignment => Rep_Aspect,
+ Aspect_Atomic => Rep_Aspect,
+ Aspect_Atomic_Components => Rep_Aspect,
+ Aspect_Bit_Order => Rep_Aspect,
+ Aspect_Component_Size => Rep_Aspect,
+ Aspect_Machine_Radix => Rep_Aspect,
+ Aspect_Object_Size => Rep_Aspect,
+ Aspect_Pack => Rep_Aspect,
+ Aspect_Scalar_Storage_Order => Rep_Aspect,
+ Aspect_Size => Rep_Aspect,
+ Aspect_Small => Rep_Aspect,
+ Aspect_Storage_Size => Rep_Aspect,
+ Aspect_Value_Size => Rep_Aspect,
+ Aspect_Volatile => Rep_Aspect,
+ Aspect_Volatile_Components => Rep_Aspect);
+
+ -- The following table indicates which aspects can apply simultaneously to
+ -- both subprogram/package specs and bodies. For instance, the following is
+ -- legal:
+
+ -- package P with SPARK_Mode ...;
+ -- package body P with SPARK_Mode is ...;
+
+ Aspect_On_Body_OK : constant array (Aspect_Id) of Boolean :=
+ (Aspect_SPARK_Mode => True,
+ others => False);
+
---------------------------------------------------
-- Handling of Aspect Specifications in the Tree --
---------------------------------------------------
@@ -487,6 +696,10 @@ package Aspects is
-- Replace calls, and this function may be used to retrieve the aspect
-- specifications for the original rewritten node in such cases.
+ function Aspects_On_Body_OK (N : Node_Id) return Boolean;
+ -- N denotes a body [stub] with aspects. Determine whether all aspects of N
+ -- can appear simultaneously in bodies and specs.
+
function Find_Aspect (Id : Entity_Id; A : Aspect_Id) return Node_Id;
-- Find the aspect specification of aspect A associated with entity I.
-- Return Empty if Id does not have the requested aspect.
@@ -501,16 +714,24 @@ package Aspects is
-- Determine whether entity Id has aspect A
procedure Move_Aspects (From : Node_Id; To : Node_Id);
- -- Moves aspects from 'From' node to 'To' node. Has_Aspects (To) must be
- -- False on entry. If Has_Aspects (From) is False, the call has no effect.
- -- Otherwise the aspects are moved and on return Has_Aspects (To) is True,
- -- and Has_Aspects (From) is False.
+ -- Relocate the aspect specifications of node From to node To. On entry it
+ -- is assumed that To does not have aspect specifications. If From has no
+ -- aspects, the routine has no effect.
+
+ procedure Move_Or_Merge_Aspects (From : Node_Id; To : Node_Id);
+ -- Relocate the aspect specifications of node From to node To. If To has
+ -- aspects, the aspects of From are added to the aspects of To. If From has
+ -- no aspects, the routine has no effect.
function Permits_Aspect_Specifications (N : Node_Id) return Boolean;
-- Returns True if the node N is a declaration node that permits aspect
-- specifications in the grammar. It is possible for other nodes to have
-- aspect specifications as a result of Rewrite or Replace calls.
+ procedure Remove_Aspects (N : Node_Id);
+ -- Delete the aspect specifications associated with node N. If the node has
+ -- no aspects, the routine has no effect.
+
function Same_Aspect (A1 : Aspect_Id; A2 : Aspect_Id) return Boolean;
-- Returns True if A1 and A2 are (essentially) the same aspect. This is not
-- a simple equality test because e.g. Post and Postcondition are the same.
diff --git a/gcc/ada/atree.ads b/gcc/ada/atree.ads
index d1056b07a32..123beb3907e 100644
--- a/gcc/ada/atree.ads
+++ b/gcc/ada/atree.ads
@@ -939,12 +939,15 @@ package Atree is
function Original_Node (Node : Node_Id) return Node_Id;
pragma Inline (Original_Node);
-- If Node has not been rewritten, then returns its input argument
- -- unchanged, else returns the Node for the original subtree.
+ -- unchanged, else returns the Node for the original subtree. Note that
+ -- this is used extensively by ASIS on the trees constructed in ASIS mode
+ -- to reconstruct the original semantic tree. See section in sinfo.ads
+ -- for requirements on original nodes returned by this function.
--
-- Note: Parents are not preserved in original tree nodes that are
-- retrieved in this way (i.e. their children may have children whose
- -- pointers which reference some other node).
-
+ -- pointers which reference some other node). This needs more details???
+ --
-- Note: there is no direct mechanism for deleting an original node (in
-- a manner that can be reversed later). One possible approach is to use
-- Rewrite to substitute a null statement for the node to be deleted.
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index 0ed05608afb..1da975d0a9e 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -548,8 +548,9 @@ package body Einfo is
-- Has_Static_Predicate_Aspect Flag259
-- Has_Loop_Entry_Attributes Flag260
- -- (unused) Flag261
- -- (unused) Flag262
+ -- Has_Delayed_Rep_Aspects Flag261
+ -- May_Inherit_Delayed_Rep_Aspects Flag262
+
-- (unused) Flag263
-- (unused) Flag264
-- (unused) Flag265
@@ -589,10 +590,6 @@ package body Einfo is
-- Determine whether abstract state State has a particular property denoted
-- by the name Prop_Nam.
- function Rep_Clause (Id : E; Rep_Name : Name_Id) return N;
- -- Returns the attribute definition clause for Id whose name is Rep_Name.
- -- Returns Empty if no matching attribute definition clause found for Id.
-
---------------
-- Float_Rep --
---------------
@@ -638,28 +635,6 @@ package body Einfo is
return False;
end Has_Property;
- ----------------
- -- Rep_Clause --
- ----------------
-
- function Rep_Clause (Id : E; Rep_Name : Name_Id) return N is
- Ritem : Node_Id;
-
- begin
- Ritem := First_Rep_Item (Id);
- while Present (Ritem) loop
- if Nkind (Ritem) = N_Attribute_Definition_Clause
- and then Chars (Ritem) = Rep_Name
- then
- return Ritem;
- else
- Next_Rep_Item (Ritem);
- end if;
- end loop;
-
- return Empty;
- end Rep_Clause;
-
--------------------------------
-- Attribute Access Functions --
--------------------------------
@@ -1380,6 +1355,12 @@ package body Einfo is
return Flag18 (Id);
end Has_Delayed_Freeze;
+ function Has_Delayed_Rep_Aspects (Id : E) return B is
+ begin
+ pragma Assert (Nkind (Id) in N_Entity);
+ return Flag261 (Id);
+ end Has_Delayed_Rep_Aspects;
+
function Has_Discriminants (Id : E) return B is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -2421,6 +2402,11 @@ package body Einfo is
return Flag168 (Id);
end Materialize_Entity;
+ function May_Inherit_Delayed_Rep_Aspects (Id : E) return B is
+ begin
+ return Flag262 (Id);
+ end May_Inherit_Delayed_Rep_Aspects;
+
function Mechanism (Id : E) return M is
begin
pragma Assert (Ekind (Id) = E_Function or else Is_Formal (Id));
@@ -3978,6 +3964,12 @@ package body Einfo is
Set_Flag18 (Id, V);
end Set_Has_Delayed_Freeze;
+ procedure Set_Has_Delayed_Rep_Aspects (Id : E; V : B := True) is
+ begin
+ pragma Assert (Nkind (Id) in N_Entity);
+ Set_Flag261 (Id, V);
+ end Set_Has_Delayed_Rep_Aspects;
+
procedure Set_Has_Discriminants (Id : E; V : B := True) is
begin
pragma Assert (Nkind (Id) in N_Entity);
@@ -5063,6 +5055,11 @@ package body Einfo is
Set_Flag168 (Id, V);
end Set_Materialize_Entity;
+ procedure Set_May_Inherit_Delayed_Rep_Aspects (Id : E; V : B := True) is
+ begin
+ Set_Flag262 (Id, V);
+ end Set_May_Inherit_Delayed_Rep_Aspects;
+
procedure Set_Mechanism (Id : E; V : M) is
begin
pragma Assert (Ekind (Id) = E_Function or else Is_Formal (Id));
@@ -5969,7 +5966,7 @@ package body Einfo is
function Address_Clause (Id : E) return N is
begin
- return Rep_Clause (Id, Name_Address);
+ return Get_Attribute_Definition_Clause (Id, Attribute_Address);
end Address_Clause;
---------------
@@ -5994,7 +5991,7 @@ package body Einfo is
function Alignment_Clause (Id : E) return N is
begin
- return Rep_Clause (Id, Name_Alignment);
+ return Get_Attribute_Definition_Clause (Id, Attribute_Alignment);
end Alignment_Clause;
-------------------
@@ -6287,7 +6284,7 @@ package body Einfo is
Id = Pragma_Contract_Cases or else Id = Pragma_Test_Case;
Is_PPC : constant Boolean :=
Id = Pragma_Precondition or else Id = Pragma_Postcondition;
- Delayed : constant Boolean := Is_CDG or else Is_CTC or else Is_PPC;
+ Delayed : constant Boolean := Is_CDG or Is_CTC or Is_PPC;
Item : Node_Id;
Items : Node_Id;
@@ -7627,7 +7624,7 @@ package body Einfo is
function Size_Clause (Id : E) return N is
begin
- return Rep_Clause (Id, Name_Size);
+ return Get_Attribute_Definition_Clause (Id, Attribute_Size);
end Size_Clause;
------------------------
@@ -7636,7 +7633,7 @@ package body Einfo is
function Stream_Size_Clause (Id : E) return N is
begin
- return Rep_Clause (Id, Name_Stream_Size);
+ return Get_Attribute_Definition_Clause (Id, Attribute_Stream_Size);
end Stream_Size_Clause;
------------------
@@ -7895,6 +7892,7 @@ package body Einfo is
W ("Has_Default_Aspect", Flag39 (Id));
W ("Has_Delayed_Aspects", Flag200 (Id));
W ("Has_Delayed_Freeze", Flag18 (Id));
+ W ("Has_Delayed_Rep_Aspects", Flag261 (Id));
W ("Has_Discriminants", Flag5 (Id));
W ("Has_Dispatch_Table", Flag220 (Id));
W ("Has_Dynamic_Predicate_Aspect", Flag258 (Id));
@@ -8070,6 +8068,7 @@ package body Einfo is
W ("Low_Bound_Tested", Flag205 (Id));
W ("Machine_Radix_10", Flag84 (Id));
W ("Materialize_Entity", Flag168 (Id));
+ W ("May_Inherit_Delayed_Rep_Aspects", Flag262 (Id));
W ("Must_Be_On_Byte_Boundary", Flag183 (Id));
W ("Must_Have_Preelab_Init", Flag208 (Id));
W ("Needs_Debug_Info", Flag147 (Id));
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 24bb12cf797..0449674d861 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -1,6 +1,7 @@
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
+-- --
-- E I N F O --
-- --
-- S p e c --
@@ -1472,6 +1473,15 @@ package Einfo is
-- apsect. If this flag is set, then a corresponding aspect specification
-- node will be present on the rep item chain for the entity.
+-- Has_Delayed_Rep_Aspects (Flag261)
+-- Defined in all type and subtypes. This flag is set if there is at
+-- least one aspect for a representation characteristic that has to be
+-- delayed and is one of the characteristics that may be inherited by
+-- types derived from this type if not overridden. If this flag is set,
+-- then types derived from this type have May_Inherit_Delayed_Rep_Aspects
+-- set, signalling that Freeze.Inhert_Delayed_Rep_Aspects must be called
+-- at the freeze point of the derived type.
+
-- Has_Discriminants (Flag5)
-- Defined in all types and subtypes. For types that are allowed to have
-- discriminants (record types and subtypes, task types and subtypes,
@@ -1795,7 +1805,7 @@ package Einfo is
-- Has_Size_Clause (Flag29)
-- Defined in entities for types and objects. Set if a size clause is
--- Defined for the entity. Used to prevent multiple Size clauses for a
+-- defined for the entity. Used to prevent multiple Size clauses for a
-- given entity. Note that it is always initially cleared for a derived
-- type, even though the Size for such a type is inherited from a Size
-- clause given for the parent type.
@@ -1879,7 +1889,7 @@ package Einfo is
-- Types can have unknown discriminants either from their declaration or
-- through type derivation. The use of this flag exactly meets the spec
-- in RM 3.7(26). Note that all class-wide types are considered to have
--- unknown discriminants. Note that both Has_Discriminants and
+-- unknown discriminants. Note that both flags Has_Discriminants and
-- Has_Unknown_Discriminants may be true for a type. Class-wide types and
-- their subtypes have unknown discriminants and can have declared ones
-- as well. Private types declared with unknown discriminants may have a
@@ -3072,6 +3082,14 @@ package Einfo is
-- containing the renamed address should be allocated. This is needed so
-- that the debugger can find the entity.
+-- May_Inherit_Delayed_Rep_Aspects (Flag262)
+-- Defined in all entities for types and subtypes. Set if the type is
+-- derived from a type which has delayed rep aspects (marked by the flag
+-- Has_Delayed_Rep_Aspects being set). In this case, at the freeze point
+-- for the derived type we know that the parent type is frozen, and if
+-- a given attribute has not been set for the derived type, we copy the
+-- value from the parent type. See Freeze.Inherit_Delayed_Rep_Aspects.
+
-- Mechanism (Uint8) (returned as Mechanism_Type)
-- Defined in functions and non-generic formal parameters. Indicates
-- the mechanism to be used for the function return or for the formal
@@ -5008,6 +5026,7 @@ package Einfo is
-- Has_Constrained_Partial_View (Flag187)
-- Has_Controlled_Component (Flag43) (base type only)
-- Has_Default_Aspect (Flag39) (base type only)
+ -- Has_Delayed_Rep_Aspects (Flag261)
-- Has_Discriminants (Flag5)
-- Has_Dynamic_Predicate_Aspect (Flag258)
-- Has_Independent_Components (Flag34) (base type only)
@@ -5047,6 +5066,7 @@ package Einfo is
-- Is_Volatile (Flag16)
-- Itype_Printed (Flag202) (itypes only)
-- Known_To_Have_Preelab_Init (Flag207)
+ -- May_Inherit_Delayed_Rep_Aspects (Flag262)
-- Must_Be_On_Byte_Boundary (Flag183)
-- Must_Have_Preelab_Init (Flag208)
-- Optimize_Alignment_Space (Flag241)
@@ -6285,6 +6305,7 @@ package Einfo is
function Has_Default_Aspect (Id : E) return B;
function Has_Delayed_Aspects (Id : E) return B;
function Has_Delayed_Freeze (Id : E) return B;
+ function Has_Delayed_Rep_Aspects (Id : E) return B;
function Has_Discriminants (Id : E) return B;
function Has_Dispatch_Table (Id : E) return B;
function Has_Dynamic_Predicate_Aspect (Id : E) return B;
@@ -6470,6 +6491,7 @@ package Einfo is
function Machine_Radix_10 (Id : E) return B;
function Master_Id (Id : E) return E;
function Materialize_Entity (Id : E) return B;
+ function May_Inherit_Delayed_Rep_Aspects (Id : E) return B;
function Mechanism (Id : E) return M;
function Modulus (Id : E) return U;
function Must_Be_On_Byte_Boundary (Id : E) return B;
@@ -6895,6 +6917,7 @@ package Einfo is
procedure Set_Has_Default_Aspect (Id : E; V : B := True);
procedure Set_Has_Delayed_Aspects (Id : E; V : B := True);
procedure Set_Has_Delayed_Freeze (Id : E; V : B := True);
+ procedure Set_Has_Delayed_Rep_Aspects (Id : E; V : B := True);
procedure Set_Has_Discriminants (Id : E; V : B := True);
procedure Set_Has_Dispatch_Table (Id : E; V : B := True);
procedure Set_Has_Dynamic_Predicate_Aspect (Id : E; V : B := True);
@@ -7085,6 +7108,7 @@ package Einfo is
procedure Set_Machine_Radix_10 (Id : E; V : B := True);
procedure Set_Master_Id (Id : E; V : E);
procedure Set_Materialize_Entity (Id : E; V : B := True);
+ procedure Set_May_Inherit_Delayed_Rep_Aspects (Id : E; V : B := True);
procedure Set_Mechanism (Id : E; V : M);
procedure Set_Modulus (Id : E; V : U);
procedure Set_Must_Be_On_Byte_Boundary (Id : E; V : B := True);
@@ -7602,6 +7626,7 @@ package Einfo is
pragma Inline (Has_Default_Aspect);
pragma Inline (Has_Delayed_Aspects);
pragma Inline (Has_Delayed_Freeze);
+ pragma Inline (Has_Delayed_Rep_Aspects);
pragma Inline (Has_Discriminants);
pragma Inline (Has_Dispatch_Table);
pragma Inline (Has_Dynamic_Predicate_Aspect);
@@ -7831,6 +7856,7 @@ package Einfo is
pragma Inline (Machine_Radix_10);
pragma Inline (Master_Id);
pragma Inline (Materialize_Entity);
+ pragma Inline (May_Inherit_Delayed_Rep_Aspects);
pragma Inline (Mechanism);
pragma Inline (Modulus);
pragma Inline (Must_Be_On_Byte_Boundary);
@@ -8060,6 +8086,7 @@ package Einfo is
pragma Inline (Set_Has_Default_Aspect);
pragma Inline (Set_Has_Delayed_Aspects);
pragma Inline (Set_Has_Delayed_Freeze);
+ pragma Inline (Set_Has_Delayed_Rep_Aspects);
pragma Inline (Set_Has_Discriminants);
pragma Inline (Set_Has_Dispatch_Table);
pragma Inline (Set_Has_Dynamic_Predicate_Aspect);
@@ -8249,6 +8276,7 @@ package Einfo is
pragma Inline (Set_Machine_Radix_10);
pragma Inline (Set_Master_Id);
pragma Inline (Set_Materialize_Entity);
+ pragma Inline (Set_May_Inherit_Delayed_Rep_Aspects);
pragma Inline (Set_Mechanism);
pragma Inline (Set_Modulus);
pragma Inline (Set_Must_Be_On_Byte_Boundary);
diff --git a/gcc/ada/err_vars.ads b/gcc/ada/err_vars.ads
index bc43cb15230..6009379c0a2 100644
--- a/gcc/ada/err_vars.ads
+++ b/gcc/ada/err_vars.ads
@@ -93,6 +93,7 @@ package Err_Vars is
-- are active (see errout.ads for details). If this switch is False, then
-- these sequences are ignored (i.e. simply equivalent to a single ?). The
-- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
+ -- Note: always ignored on VMS, where we do not provide this capability.
----------------------------------------
-- Error Message Insertion Parameters --
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 5e3e72381fd..12cf828a2f2 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -49,6 +49,7 @@ with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Stylesw; use Stylesw;
+with Targparm; use Targparm;
with Uname; use Uname;
package body Errout is
@@ -476,6 +477,24 @@ package body Errout is
end;
end Error_Msg;
+ --------------------------------
+ -- Error_Msg_Ada_2012_Feature --
+ --------------------------------
+
+ procedure Error_Msg_Ada_2012_Feature (Feature : String; Loc : Source_Ptr) is
+ begin
+ if Ada_Version < Ada_2012 then
+ Error_Msg (Feature & " is an Ada 2012 feature", Loc);
+
+ if No (Ada_Version_Pragma) then
+ Error_Msg ("\unit must be compiled with -gnat2012 switch", Loc);
+ else
+ Error_Msg_Sloc := Sloc (Ada_Version_Pragma);
+ Error_Msg ("\incompatible with Ada version set#", Loc);
+ end if;
+ end if;
+ end Error_Msg_Ada_2012_Feature;
+
------------------
-- Error_Msg_AP --
------------------
@@ -1302,7 +1321,7 @@ package body Errout is
CE : Error_Msg_Object renames Errors.Table (Cur);
begin
- if not CE.Deleted
+ if (CE.Warn and not CE.Deleted)
and then
(Warning_Specifically_Suppressed (CE.Sptr, CE.Text)
or else
@@ -2686,7 +2705,7 @@ package body Errout is
Warning_Msg_Char := ' ';
if P <= Text'Last and then Text (P) = '?' then
- if Warning_Doc_Switch then
+ if Warning_Doc_Switch and not OpenVMS_On_Target then
Warning_Msg_Char := '?';
end if;
@@ -2698,7 +2717,7 @@ package body Errout is
Text (P) in 'A' .. 'Z')
and then Text (P + 1) = '?'
then
- if Warning_Doc_Switch then
+ if Warning_Doc_Switch and not OpenVMS_On_Target then
Warning_Msg_Char := Text (P);
end if;
@@ -2784,7 +2803,10 @@ package body Errout is
-- If tagging of messages is enabled, and this is a warning,
-- then it is treated as being [enabled by default].
- if Error_Msg_Warn and Warning_Doc_Switch then
+ if Error_Msg_Warn
+ and Warning_Doc_Switch
+ and not OpenVMS_On_Target
+ then
Warning_Msg_Char := '?';
end if;
diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads
index 9afc4dfd34a..0c363222c37 100644
--- a/gcc/ada/errout.ads
+++ b/gcc/ada/errout.ads
@@ -64,6 +64,7 @@ package Errout is
-- are active (see errout.ads for details). If this switch is False, then
-- these sequences are ignored (i.e. simply equivalent to a single ?). The
-- -gnatw.d switch sets this flag True, -gnatw.D sets this flag False.
+ -- Note: always ignored in VMS mode where we do not provide this feature.
-----------------------------------
-- Suppression of Error Messages --
@@ -343,7 +344,8 @@ package Errout is
-- generation of code in the presence of the -gnatQ switch. If the
-- insertion character | appears, the message is considered to be
-- non-serious, and does not cause Serious_Errors_Detected to be
- -- incremented (so expansion is not prevented by such a msg).
+ -- incremented (so expansion is not prevented by such a msg). This
+ -- insertion character is ignored in continuation messages.
-- Insertion character ~ (Tilde: insert string)
-- Indicates that Error_Msg_String (1 .. Error_Msg_Strlen) is to be
@@ -694,7 +696,9 @@ package Errout is
procedure Error_Msg_F (Msg : String; N : Node_Id);
-- Similar to Error_Msg_N except that the message is placed on the first
- -- node of the construct N (First_Node (N)).
+ -- node of the construct N (First_Node (N)). Note that this procedure uses
+ -- Original_Node to look at the original source tree, since that's what we
+ -- want for placing an error message flag in the right place.
procedure Error_Msg_NE
(Msg : String;
@@ -738,8 +742,11 @@ package Errout is
-- usual manner, and need not be the same length as the original text.
function First_Node (C : Node_Id) return Node_Id;
- -- Given a construct C, finds the first node in the construct, i.e. the
- -- one with the lowest Sloc value. This is useful in placing error msgs.
+ -- Given a construct C, finds the first node in the construct, i.e. the one
+ -- with the lowest Sloc value. This is useful in placing error msgs. Note
+ -- that this procedure uses Original_Node to look at the original source
+ -- tree, since that's what we want for placing an error message flag in
+ -- the right place.
function First_Sloc (N : Node_Id) return Source_Ptr;
-- Given the node for an expression, return a source pointer value that
@@ -820,6 +827,14 @@ package Errout is
-- Posts an error on the protected type declaration Typ indicating wrong
-- mode of the first formal of protected type primitive Subp.
+ procedure Error_Msg_Ada_2012_Feature (Feature : String; Loc : Source_Ptr);
+ -- If not operating in Ada 2012 mode, posts errors complaining that Feature
+ -- is only supported in Ada 2012, with appropriate suggestions to fix this.
+ -- Loc is the location at which the flag is to be posted. Feature, which
+ -- appears at the start of the first generated message, may contain error
+ -- message insertion characters in the normal manner, and in particular
+ -- may start with | to flag a non-serious error.
+
procedure dmsg (Id : Error_Msg_Id) renames Erroutc.dmsg;
-- Debugging routine to dump an error message
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 6fec955113c..0802f2dfa51 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -725,20 +725,23 @@ package body Exp_Ch4 is
(Ref : Node_Id;
Built_In_Place : Boolean := False)
is
- Cond : Node_Id;
- Obj_Ref : Node_Id;
- Stmts : List_Id;
+ Pool_Id : constant Entity_Id := Associated_Storage_Pool (PtrT);
+ Cond : Node_Id;
+ Fin_Call : Node_Id;
+ Free_Stmt : Node_Id;
+ Obj_Ref : Node_Id;
+ Stmts : List_Id;
begin
if Ada_Version >= Ada_2005
and then Is_Class_Wide_Type (DesigT)
+ and then (Tagged_Type_Expansion or else VM_Target /= No_VM)
and then not Scope_Suppress.Suppress (Accessibility_Check)
and then
(Type_Access_Level (Etype (Exp)) > Type_Access_Level (PtrT)
or else
(Is_Class_Wide_Type (Etype (Exp))
and then Scope (PtrT) /= Current_Scope))
- and then (Tagged_Type_Expansion or else VM_Target /= No_VM)
then
-- If the allocator was built in place, Ref is already a reference
-- to the access object initialized to the result of the allocator
@@ -750,7 +753,7 @@ package body Exp_Ch4 is
if Built_In_Place then
Remove_Side_Effects (Ref);
- Obj_Ref := New_Copy (Ref);
+ Obj_Ref := New_Copy_Tree (Ref);
else
Obj_Ref := New_Reference_To (Ref, Loc);
end if;
@@ -759,27 +762,68 @@ package body Exp_Ch4 is
Stmts := New_List;
- -- Why don't we free the object ??? discussion and explanation
- -- needed of why old approach did not work ???
+ -- Deallocate the object if the accessibility check fails. This
+ -- is done only on targets or profiles that support deallocation.
+
+ -- Free (Obj_Ref);
+
+ if RTE_Available (RE_Free) then
+ Free_Stmt := Make_Free_Statement (Loc, New_Copy_Tree (Obj_Ref));
+ Set_Storage_Pool (Free_Stmt, Pool_Id);
+
+ Append_To (Stmts, Free_Stmt);
+
+ -- The target or profile cannot deallocate objects
+
+ else
+ Free_Stmt := Empty;
+ end if;
+
+ -- Finalize the object if applicable. Generate:
- -- Generate:
-- [Deep_]Finalize (Obj_Ref.all);
if Needs_Finalization (DesigT) then
- Append_To (Stmts,
+ Fin_Call :=
Make_Final_Call (
Obj_Ref =>
Make_Explicit_Dereference (Loc, New_Copy (Obj_Ref)),
- Typ => DesigT));
+ Typ => DesigT);
+
+ -- When the target or profile supports deallocation, wrap the
+ -- finalization call in a block to ensure proper deallocation
+ -- even if finalization fails. Generate:
+
+ -- begin
+ -- <Fin_Call>
+ -- exception
+ -- when others =>
+ -- <Free_Stmt>
+ -- raise;
+ -- end;
+
+ if Present (Free_Stmt) then
+ Fin_Call :=
+ Make_Block_Statement (Loc,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc,
+ Statements => New_List (Fin_Call),
+
+ Exception_Handlers => New_List (
+ Make_Exception_Handler (Loc,
+ Exception_Choices => New_List (
+ Make_Others_Choice (Loc)),
+
+ Statements => New_List (
+ New_Copy_Tree (Free_Stmt),
+ Make_Raise_Statement (Loc))))));
+ end if;
+
+ Prepend_To (Stmts, Fin_Call);
end if;
-- Signal the accessibility failure through a Program_Error
- -- Since we may have a storage leak, I would be inclined to
- -- define a new PE_ code that warns of this possibility where
- -- the message would be Accessibility_Check_Failed (causing
- -- storage leak) ???
-
Append_To (Stmts,
Make_Raise_Program_Error (Loc,
Condition => New_Reference_To (Standard_True, Loc),
@@ -8074,11 +8118,30 @@ package body Exp_Ch4 is
return;
else
- Rewrite (N,
- Make_Op_Shift_Left (Loc,
- Left_Opnd => Lop,
- Right_Opnd =>
- Convert_To (Standard_Natural, Right_Opnd (Rop))));
+ -- If the result is modular, perform the reduction of the result
+ -- appropriately.
+
+ if Is_Modular_Integer_Type (Typ)
+ and then not Non_Binary_Modulus (Typ)
+ then
+ Rewrite (N,
+ Make_Op_And (Loc,
+ Left_Opnd =>
+ Make_Op_Shift_Left (Loc,
+ Left_Opnd => Lop,
+ Right_Opnd =>
+ Convert_To (Standard_Natural, Right_Opnd (Rop))),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc, Modulus (Typ) - 1)));
+
+ else
+ Rewrite (N,
+ Make_Op_Shift_Left (Loc,
+ Left_Opnd => Lop,
+ Right_Opnd =>
+ Convert_To (Standard_Natural, Right_Opnd (Rop))));
+ end if;
+
Analyze_And_Resolve (N, Typ);
return;
end if;
@@ -8086,11 +8149,27 @@ package body Exp_Ch4 is
-- Same processing for the operands the other way round
elsif Lp2 then
- Rewrite (N,
- Make_Op_Shift_Left (Loc,
- Left_Opnd => Rop,
- Right_Opnd =>
- Convert_To (Standard_Natural, Right_Opnd (Lop))));
+ if Is_Modular_Integer_Type (Typ)
+ and then not Non_Binary_Modulus (Typ)
+ then
+ Rewrite (N,
+ Make_Op_And (Loc,
+ Left_Opnd =>
+ Make_Op_Shift_Left (Loc,
+ Left_Opnd => Rop,
+ Right_Opnd =>
+ Convert_To (Standard_Natural, Right_Opnd (Lop))),
+ Right_Opnd =>
+ Make_Integer_Literal (Loc, Modulus (Typ) - 1)));
+
+ else
+ Rewrite (N,
+ Make_Op_Shift_Left (Loc,
+ Left_Opnd => Rop,
+ Right_Opnd =>
+ Convert_To (Standard_Natural, Right_Opnd (Lop))));
+ end if;
+
Analyze_And_Resolve (N, Typ);
return;
end if;
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index fdafd22a6d2..16e83091529 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -136,6 +136,15 @@ package body Exp_Ch9 is
-- build record declaration. N is the type declaration, Ctyp is the
-- concurrent entity (task type or protected type).
+ function Build_Dispatching_Tag_Check
+ (K : Entity_Id;
+ N : Node_Id) return Node_Id;
+ -- Utility to create the tree to check whether the dispatching call in
+ -- a timed entry call, a conditional entry call, or an asynchronous
+ -- transfer of control is a call to a primitive of a non-synchronized type.
+ -- K is the temporary that holds the tagged kind of the target object, and
+ -- N is the enclosing construct.
+
function Build_Entry_Count_Expression
(Concurrent_Type : Node_Id;
Component_List : List_Id;
@@ -1298,6 +1307,26 @@ package body Exp_Ch9 is
Limited_Present => True));
end Build_Corresponding_Record;
+ ---------------------------------
+ -- Build_Dispatching_Tag_Check --
+ ---------------------------------
+
+ function Build_Dispatching_Tag_Check
+ (K : Entity_Id;
+ N : Node_Id) return Node_Id
+ is
+ Loc : constant Source_Ptr := Sloc (N);
+ begin
+ return
+ Make_Op_Or (Loc,
+ Make_Op_Eq (Loc,
+ Left_Opnd => New_Reference_To (K, Loc),
+ Right_Opnd => New_Reference_To (RTE (RE_TK_Limited_Tagged), Loc)),
+ Make_Op_Eq (Loc,
+ Left_Opnd => New_Reference_To (K, Loc),
+ Right_Opnd => New_Reference_To (RTE (RE_TK_Tagged), Loc)));
+ end Build_Dispatching_Tag_Check;
+
----------------------------------
-- Build_Entry_Count_Expression --
----------------------------------
@@ -6607,7 +6636,9 @@ package body Exp_Ch9 is
-- U : Boolean;
-- begin
- -- if K = Ada.Tags.TK_Limited_Tagged then
+ -- if K = Ada.Tags.TK_Limited_Tagged
+ -- or else K = Ada.Tags.TK_Tagged
+ -- then
-- <dispatching-call>;
-- <triggering-statements>;
@@ -7206,7 +7237,9 @@ package body Exp_Ch9 is
Prepend_To (Lim_Typ_Stmts, New_Copy_Tree (Ecall));
-- Generate:
- -- if K = Ada.Tags.TK_Limited_Tagged then
+ -- if K = Ada.Tags.TK_Limited_Tagged
+ -- or else K = Ada.Tags.TK_Tagged
+ -- then
-- Lim_Typ_Stmts
-- else
-- Conc_Typ_Stmts
@@ -7214,18 +7247,9 @@ package body Exp_Ch9 is
Append_To (Stmts,
Make_Implicit_If_Statement (N,
- Condition =>
- Make_Op_Eq (Loc,
- Left_Opnd =>
- New_Reference_To (K, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_TK_Limited_Tagged), Loc)),
-
- Then_Statements =>
- Lim_Typ_Stmts,
-
- Else_Statements =>
- Conc_Typ_Stmts));
+ Condition => Build_Dispatching_Tag_Check (K, N),
+ Then_Statements => Lim_Typ_Stmts,
+ Else_Statements => Conc_Typ_Stmts));
Rewrite (N,
Make_Block_Statement (Loc,
@@ -7665,7 +7689,9 @@ package body Exp_Ch9 is
-- S : Integer;
-- begin
- -- if K = Ada.Tags.TK_Limited_Tagged then
+ -- if K = Ada.Tags.TK_Limited_Tagged
+ -- or else K = Ada.Tags.TK_Tagged
+ -- then
-- <dispatching-call>;
-- <triggering-statements>
@@ -7891,7 +7917,9 @@ package body Exp_Ch9 is
Prepend_To (Lim_Typ_Stmts, New_Copy_Tree (Blk));
-- Generate:
- -- if K = Ada.Tags.TK_Limited_Tagged then
+ -- if K = Ada.Tags.TK_Limited_Tagged
+ -- or else K = Ada.Tags.TK_Tagged
+ -- then
-- Lim_Typ_Stmts
-- else
-- Conc_Typ_Stmts
@@ -7899,18 +7927,9 @@ package body Exp_Ch9 is
Append_To (Stmts,
Make_Implicit_If_Statement (N,
- Condition =>
- Make_Op_Eq (Loc,
- Left_Opnd =>
- New_Reference_To (K, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_TK_Limited_Tagged), Loc)),
-
- Then_Statements =>
- Lim_Typ_Stmts,
-
- Else_Statements =>
- Conc_Typ_Stmts));
+ Condition => Build_Dispatching_Tag_Check (K, N),
+ Then_Statements => Lim_Typ_Stmts,
+ Else_Statements => Conc_Typ_Stmts));
Rewrite (N,
Make_Block_Statement (Loc,
@@ -11951,7 +11970,9 @@ package body Exp_Ch9 is
-- S : Integer;
-- begin
- -- if K = Ada.Tags.TK_Limited_Tagged then
+ -- if K = Ada.Tags.TK_Limited_Tagged
+ -- or else K = Ada.Tags.TK_Tagged
+ -- then
-- <dispatching-call>;
-- <triggering-statements>
@@ -11986,9 +12007,11 @@ package body Exp_Ch9 is
-- end;
-- The triggering statement and the sequence of timed statements have not
- -- been analyzed yet (see Analyzed_Timed_Entry_Call). They may contain
- -- local declarations, and therefore the copies that are made during
- -- expansion must be disjoint, as for any other inlining.
+ -- been analyzed yet (see Analyzed_Timed_Entry_Call), but they may contain
+ -- global references if within an instantiation. To prevent duplication
+ -- between various uses of those statements, they are encapsulated into a
+ -- local procedure which is invoked multiple time when the trigger is a
+ -- dispatching call.
procedure Expand_N_Timed_Entry_Call (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
@@ -12002,13 +12025,13 @@ package body Exp_Ch9 is
D_Alt : constant Node_Id := Delay_Alternative (N);
D_Conv : Node_Id;
D_Disc : Node_Id;
- D_Stat : Node_Id := Delay_Statement (D_Alt);
+ D_Stat : Node_Id := Delay_Statement (D_Alt);
D_Stats : List_Id;
D_Type : Entity_Id;
Decls : List_Id;
Dummy : Node_Id;
E_Alt : constant Node_Id := Entry_Call_Alternative (N);
- E_Call : Node_Id := Entry_Call_Statement (E_Alt);
+ E_Call : Node_Id := Entry_Call_Statement (E_Alt);
E_Stats : List_Id;
Ename : Node_Id;
Formals : List_Id;
@@ -12031,6 +12054,65 @@ package body Exp_Ch9 is
P : Entity_Id; -- Parameter block
S : Entity_Id; -- Primitive operation slot
+ procedure Rewrite_Triggering_Statements;
+ -- If the trigger is a dispatching call, the expansion inserts multiple
+ -- copies of the abortable part. This is both inefficient, and may lead
+ -- to duplicate definitions that the back-end will reject, when the
+ -- abortable part includes loops. This procedure rewrites the abortable
+ -- part into a call to a generated procedure.
+
+ -----------------------------------
+ -- Rewrite_Triggering_Statements --
+ -----------------------------------
+
+ procedure Rewrite_Triggering_Statements is
+ Proc : constant Entity_Id := Make_Defining_Identifier (Loc, Name_uA);
+ Decl : Node_Id;
+ Stat : Node_Id;
+
+ begin
+ Decl :=
+ Make_Subprogram_Body (Loc,
+ Specification =>
+ Make_Procedure_Specification (Loc, Defining_Unit_Name => Proc),
+ Declarations => New_List,
+ Handled_Statement_Sequence =>
+ Make_Handled_Sequence_Of_Statements (Loc, E_Stats));
+
+ Append_To (Decls, Decl);
+
+ -- Adjust the scope of blocks in the procedure. Needed because blocks
+ -- generate declarations that are processed before other analysis
+ -- takes place, and their scope is already set. The backend depends
+ -- on the scope chain to determine the legality of some anonymous
+ -- types, and thus we must indicate that the block is within the new
+ -- procedure.
+
+ Stat := First (E_Stats);
+ while Present (Stat) loop
+ if Nkind (Stat) = N_Block_Statement then
+ Insert_Before (Stat,
+ Make_Implicit_Label_Declaration (Sloc (Stat),
+ Defining_Identifier =>
+ Make_Defining_Identifier (
+ Sloc (Stat), Chars (Identifier (Stat)))));
+ end if;
+
+ Next (Stat);
+ end loop;
+
+ -- Analyze (Decl);
+
+ -- Rewrite abortable part into a call to this procedure.
+
+ E_Stats :=
+ New_List
+ (Make_Procedure_Call_Statement (Loc,
+ Name => New_Occurrence_Of (Proc, Loc)));
+ end Rewrite_Triggering_Statements;
+
+ -- Start of processing for Expand_N_Timed_Entry_Call
+
begin
-- Under the Ravenscar profile, timed entry calls are excluded. An error
-- was already reported on spec, so do not attempt to expand the call.
@@ -12070,8 +12152,9 @@ package body Exp_Ch9 is
if Is_Disp_Select then
Extract_Dispatching_Call (E_Call, Call_Ent, Obj, Actuals, Formals);
-
Decls := New_List;
+ Rewrite_Triggering_Statements;
+
Stmts := New_List;
-- Generate:
@@ -12280,7 +12363,11 @@ package body Exp_Ch9 is
-- <timed-statements>
-- end if;
- N_Stats := Copy_Separate_List (E_Stats);
+ -- Note: we used to do Copy_Separate_List here, but this was changed
+ -- to New_Copy_List_Tree with no explanation or RH note??? We should
+ -- explain the need for the change ???
+
+ N_Stats := New_Copy_List_Tree (E_Stats);
Prepend_To (N_Stats,
Make_Implicit_If_Statement (N,
@@ -12320,11 +12407,17 @@ package body Exp_Ch9 is
-- <dispatching-call>;
-- <triggering-statements>
- Lim_Typ_Stmts := Copy_Separate_List (E_Stats);
+ -- Note: the following was Copy_Separate_List but it was changed to
+ -- New_Copy_List_Tree without comments or RH documentation ??? We
+ -- should explain the need for the change ???
+
+ Lim_Typ_Stmts := New_Copy_List_Tree (E_Stats);
Prepend_To (Lim_Typ_Stmts, New_Copy_Tree (E_Call));
-- Generate:
- -- if K = Ada.Tags.TK_Limited_Tagged then
+ -- if K = Ada.Tags.TK_Limited_Tagged
+ -- or else K = Ada.Tags.TK_Tagged
+ -- then
-- Lim_Typ_Stmts
-- else
-- Conc_Typ_Stmts
@@ -12332,11 +12425,7 @@ package body Exp_Ch9 is
Append_To (Stmts,
Make_Implicit_If_Statement (N,
- Condition =>
- Make_Op_Eq (Loc,
- Left_Opnd => New_Reference_To (K, Loc),
- Right_Opnd =>
- New_Reference_To (RTE (RE_TK_Limited_Tagged), Loc)),
+ Condition => Build_Dispatching_Tag_Check (K, N),
Then_Statements => Lim_Typ_Stmts,
Else_Statements => Conc_Typ_Stmts));
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index fba371e2b95..eeafa72d356 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -287,10 +287,13 @@ package body Exp_Prag is
Msg : Node_Id;
begin
- -- We already know that this check is enabled, because otherwise the
- -- semantic pass dealt with rewriting the assertion (see Sem_Prag)
+ -- Nothing to do if pragma is ignored
- -- Since this check is enabled, we rewrite the pragma into a
+ if Is_Ignored (N) then
+ return;
+ end if;
+
+ -- Since this check is active, we rewrite the pragma into a
-- corresponding if statement, and then analyze the statement
-- The normal case expansion transforms:
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 8a5b927c570..58098be741d 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -2463,12 +2463,14 @@ package body Freeze is
or else (Chars (Comp) /= Name_uParent
and then Is_Controlled (Etype (Comp)))
or else (Is_Protected_Type (Etype (Comp))
- and then Present
- (Corresponding_Record_Type
- (Etype (Comp)))
- and then Has_Controlled_Component
- (Corresponding_Record_Type
- (Etype (Comp)))))
+ and then
+ Present
+ (Corresponding_Record_Type
+ (Etype (Comp)))
+ and then
+ Has_Controlled_Component
+ (Corresponding_Record_Type
+ (Etype (Comp)))))
then
Set_Has_Controlled_Component (Rec);
end if;
@@ -2731,9 +2733,7 @@ package body Freeze is
-- Add checks to detect proper initialization of scalars that may appear
-- as subprogram parameters.
- if Is_Subprogram (E)
- and then Check_Validity_Of_Parameters
- then
+ if Is_Subprogram (E) and then Check_Validity_Of_Parameters then
Apply_Parameter_Validity_Checks (E);
end if;
@@ -3263,9 +3263,7 @@ package body Freeze is
-- then the only purpose of the Import pragma is to suppress
-- implicit initialization.
- if Is_Imported (E)
- and then No (Address_Clause (E))
- then
+ if Is_Imported (E) and then No (Address_Clause (E)) then
Set_Is_Public (E);
end if;
@@ -3275,7 +3273,7 @@ package body Freeze is
-- expects 8-bit sizes for these cases.
if (Convention (E) = Convention_C
- or else
+ or else
Convention (E) = Convention_CPP)
and then Is_Enumeration_Type (Etype (E))
and then not Is_Character_Type (Etype (E))
@@ -3349,7 +3347,7 @@ package body Freeze is
-- enclosing statement sequence.
if Ekind_In (E, E_Constant, E_Variable)
- and then not Has_Delayed_Freeze (E)
+ and then not Has_Delayed_Freeze (E)
then
declare
Init_Stmts : constant Node_Id :=
diff --git a/gcc/ada/g-table.adb b/gcc/ada/g-table.adb
index eeaa59bb6f7..9b3692bbe06 100644
--- a/gcc/ada/g-table.adb
+++ b/gcc/ada/g-table.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2010, AdaCore --
+-- Copyright (C) 1998-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -29,6 +29,8 @@
-- --
------------------------------------------------------------------------------
+with GNAT.Heap_Sort_G;
+
with System; use System;
with System.Memory; use System.Memory;
@@ -114,6 +116,19 @@ package body GNAT.Table is
Last_Val := Last_Val - 1;
end Decrement_Last;
+ --------------
+ -- For_Each --
+ --------------
+
+ procedure For_Each is
+ Quit : Boolean := False;
+ begin
+ for Index in Table_Low_Bound .. Table_Index_Type (Last_Val) loop
+ Action (Index, Table (Index), Quit);
+ exit when Quit;
+ end loop;
+ end For_Each;
+
----------
-- Free --
----------
@@ -259,17 +274,17 @@ package body GNAT.Table is
pragma Import (Ada, Allocated_Table);
pragma Suppress (Range_Check, On => Allocated_Table);
for Allocated_Table'Address use Allocated_Table_Address;
- -- Allocated_Table represents the currently allocated array, plus
- -- one element (the supplementary element is used to have a
- -- convenient way of computing the address just past the end of the
- -- current allocation). Range checks are suppressed because this unit
- -- uses direct calls to System.Memory for allocation, and this can
- -- yield misaligned storage (and we cannot rely on the bootstrap
- -- compiler supporting specifically disabling alignment checks, so we
- -- need to suppress all range checks). It is safe to suppress this check
- -- here because we know that a (possibly misaligned) object of that type
- -- does actually exist at that address.
- -- ??? We should really improve the allocation circuitry here to
+ -- Allocated_Table represents the currently allocated array, plus one
+ -- element (the supplementary element is used to have a convenient
+ -- way of computing the address just past the end of the current
+ -- allocation). Range checks are suppressed because this unit uses
+ -- direct calls to System.Memory for allocation, and this can yield
+ -- misaligned storage (and we cannot rely on the bootstrap compiler
+ -- supporting specifically disabling alignment checks, so we need to
+ -- suppress all range checks). It is safe to suppress this check here
+ -- because we know that a (possibly misaligned) object of that type
+ -- does actually exist at that address. ??? We should really improve
+ -- the allocation circuitry here to
-- guarantee proper alignment.
Need_Realloc : constant Boolean := Integer (Index) > Max;
@@ -324,6 +339,74 @@ package body GNAT.Table is
end if;
end Set_Last;
+ ----------------
+ -- Sort_Table --
+ ----------------
+
+ procedure Sort_Table is
+
+ Temp : Table_Component_Type;
+ -- A temporary position to simulate index 0
+
+ -- Local subprograms
+
+ function Index_Of (Idx : Natural) return Table_Index_Type;
+ -- Return index of Idx'th element of table
+
+ function Lower_Than (Op1, Op2 : Natural) return Boolean;
+ -- Compare two components
+
+ procedure Move (From : Natural; To : Natural);
+ -- Move one component
+
+ package Heap_Sort is new GNAT.Heap_Sort_G (Move, Lower_Than);
+
+ --------------
+ -- Index_Of --
+ --------------
+
+ function Index_Of (Idx : Natural) return Table_Index_Type is
+ J : constant Integer'Base := Table_Index_Type'Pos (First) + Idx - 1;
+ begin
+ return Table_Index_Type'Val (J);
+ end Index_Of;
+
+ ----------
+ -- Move --
+ ----------
+
+ procedure Move (From : Natural; To : Natural) is
+ begin
+ if From = 0 then
+ Table (Index_Of (To)) := Temp;
+ elsif To = 0 then
+ Temp := Table (Index_Of (From));
+ else
+ Table (Index_Of (To)) := Table (Index_Of (From));
+ end if;
+ end Move;
+
+ ----------------
+ -- Lower_Than --
+ ----------------
+
+ function Lower_Than (Op1, Op2 : Natural) return Boolean is
+ begin
+ if Op1 = 0 then
+ return Lt (Temp, Table (Index_Of (Op2)));
+ elsif Op2 = 0 then
+ return Lt (Table (Index_Of (Op1)), Temp);
+ else
+ return Lt (Table (Index_Of (Op1)), Table (Index_Of (Op2)));
+ end if;
+ end Lower_Than;
+
+ -- Start of processing for Sort_Table
+
+ begin
+ Heap_Sort.Sort (Natural (Last - First) + 1);
+ end Sort_Table;
+
begin
Init;
end GNAT.Table;
diff --git a/gcc/ada/g-table.ads b/gcc/ada/g-table.ads
index 5a879752e45..c9b75f61648 100644
--- a/gcc/ada/g-table.ads
+++ b/gcc/ada/g-table.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1998-2010, AdaCore --
+-- Copyright (C) 1998-2013, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -201,4 +201,25 @@ package GNAT.Table is
-- This means that a reference X.Table (X.Allocate) is incorrect, since
-- the call to X.Allocate may modify the results of calling X.Table.
+ generic
+ with procedure Action
+ (Index : Table_Index_Type;
+ Item : Table_Component_Type;
+ Quit : in out Boolean) is <>;
+ procedure For_Each;
+ -- Calls procedure Action for each component of the table, or until
+ -- one of these calls set Quit to True.
+
+ generic
+ with function Lt (Comp1, Comp2 : Table_Component_Type) return Boolean;
+ procedure Sort_Table;
+ -- This procedure sorts the components of the table into ascending
+ -- order making calls to Lt to do required comparisons, and using
+ -- assignments to move components around. The Lt function returns True
+ -- if Comp1 is less than Comp2 (in the sense of the desired sort), and
+ -- False if Comp1 is greater than Comp2. For equal objects it does not
+ -- matter if True or False is returned (it is slightly more efficient
+ -- to return False). The sort is not stable (the order of equal items
+ -- in the table is not preserved).
+
end GNAT.Table;
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 93250da561c..fbbb417f649 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -1280,17 +1280,17 @@ ada/checks.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sem_warn.ads ada/set_targ.ads ada/sinfo.ads ada/sinfo.adb \
ada/sinput.ads ada/snames.ads ada/sprint.ads ada/stand.ads \
- ada/stringt.ads ada/style.ads ada/styleg.ads ada/styleg.adb \
- ada/stylesw.ads ada/system.ads ada/s-assert.ads ada/s-exctab.ads \
- ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads \
- ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/targparm.ads ada/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/validsw.ads \
- ada/widechar.ads
+ ada/stringt.ads ada/stringt.adb ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-assert.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
+ ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/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/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/comperr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1471,7 +1471,7 @@ ada/exp_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/validsw.ads ada/widechar.ads
+ ada/urealp.ads ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/exp_atag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1530,7 +1530,7 @@ ada/exp_attr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/exp_cg.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1575,7 +1575,7 @@ ada/exp_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
ada/tbuild.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
ada/uintp.adb ada/uname.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/widechar.ads
+ ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/exp_ch12.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1663,7 +1663,8 @@ ada/exp_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/validsw.ads ada/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/warnsw.ads \
+ ada/widechar.ads
ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1699,7 +1700,7 @@ ada/exp_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
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/validsw.ads ada/widechar.ads
+ ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/exp_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1731,7 +1732,7 @@ ada/exp_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/validsw.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/warnsw.ads
ada/exp_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1761,17 +1762,17 @@ ada/exp_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/sem_res.ads ada/sem_scil.ads ada/sem_type.ads ada/sem_util.ads \
ada/sem_util.adb ada/sem_warn.ads ada/set_targ.ads ada/sinfo.ads \
ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/sprint.ads \
- ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
- ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-assert.ads \
- ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
- ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
- ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/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/stand.ads ada/stringt.ads ada/stringt.adb ada/style.ads \
+ ada/styleg.ads ada/styleg.adb ada/stylesw.ads ada/system.ads \
+ ada/s-assert.ads ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
+ ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads \
+ ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads \
+ ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
+ ada/targparm.ads ada/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/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/exp_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1805,7 +1806,8 @@ ada/exp_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/validsw.ads ada/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/warnsw.ads \
+ ada/widechar.ads
ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1828,7 +1830,7 @@ ada/exp_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads ada/validsw.ads
+ ada/urealp.ads ada/validsw.ads ada/warnsw.ads
ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1862,7 +1864,7 @@ ada/exp_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/targparm.ads ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads \
ada/ttypes.ads ada/types.ads ada/uintp.ads ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/exp_code.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1942,7 +1944,7 @@ ada/exp_disp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -1967,7 +1969,7 @@ ada/exp_dist.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb 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/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/exp_fixd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2044,7 +2046,7 @@ ada/exp_intr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2071,7 +2073,7 @@ ada/exp_pakd.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/validsw.ads
+ ada/validsw.ads ada/warnsw.ads
ada/exp_prag.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2131,17 +2133,16 @@ ada/exp_spark.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/atree.adb ada/casing.ads ada/debug.ads ada/einfo.ads ada/einfo.adb \
ada/exp_attr.ads ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_dbug.ads \
ada/exp_spark.ads ada/exp_spark.adb ada/exp_tss.ads ada/exp_util.ads \
- ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/nlists.adb \
- ada/opt.ads ada/output.ads ada/rtsfind.ads ada/sem_aux.ads \
- ada/sem_aux.adb ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads \
- ada/sinfo.adb ada/sinput.ads ada/snames.ads ada/stand.ads \
- ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-imenne.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.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/tbuild.ads ada/tree_io.ads \
- ada/types.ads ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads \
- ada/urealp.ads
+ ada/hostparm.ads ada/namet.ads ada/nlists.ads ada/opt.ads \
+ ada/output.ads ada/rtsfind.ads ada/sem_aux.ads ada/sem_aux.adb \
+ ada/sem_res.ads ada/sem_util.ads ada/sinfo.ads ada/sinfo.adb \
+ ada/sinput.ads ada/snames.ads ada/stand.ads ada/system.ads \
+ ada/s-assert.ads ada/s-exctab.ads ada/s-imenne.ads ada/s-memory.ads \
+ ada/s-os_lib.ads ada/s-parame.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/tbuild.ads ada/tree_io.ads ada/types.ads \
+ ada/uintp.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
ada/exp_strm.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2212,7 +2213,7 @@ ada/exp_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads ada/types.ads \
ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/validsw.ads ada/widechar.ads
+ ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/exp_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2251,7 +2252,7 @@ ada/expander.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads
ada/fmap.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/fmap.ads ada/fmap.adb \
@@ -2321,7 +2322,7 @@ ada/freeze.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/table.adb ada/targparm.ads ada/tbuild.ads 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/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/frontend.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -2349,7 +2350,8 @@ ada/frontend.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-unstyp.ads ada/s-utf_32.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/types.ads ada/uintp.ads ada/uname.ads \
- ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads \
+ ada/widechar.ads
ada/g-byorma.o : ada/gnat.ads ada/g-byorma.ads ada/g-byorma.adb \
ada/system.ads
@@ -2372,9 +2374,10 @@ ada/g-u3spch.o : ada/gnat.ads ada/g-spchge.ads ada/g-spchge.adb \
ada/get_spark_xrefs.o : ada/ada.ads ada/a-ioexce.ads ada/a-unccon.ads \
ada/get_spark_xrefs.ads ada/get_spark_xrefs.adb ada/gnat.ads \
- ada/g-table.ads ada/g-table.adb ada/spark_xrefs.ads ada/system.ads \
- ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \
- ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/g-hesorg.ads ada/g-table.ads ada/g-table.adb ada/spark_xrefs.ads \
+ ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads \
+ ada/s-stalib.ads ada/s-unstyp.ads ada/types.ads ada/unchconv.ads \
+ ada/unchdeal.ads
ada/get_targ.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/einfo.ads \
@@ -2415,7 +2418,7 @@ ada/gnat1drv.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/tree_gen.ads ada/tree_io.ads ada/treepr.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/usage.ads ada/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/gnatbind.o : ada/ada.ads ada/a-comlin.ads ada/a-clrefi.ads \
ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads ada/ali.ads \
@@ -2476,7 +2479,7 @@ ada/inline.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/interfac.o : ada/interfac.ads ada/system.ads
@@ -2840,19 +2843,20 @@ ada/prepcomp.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/put_scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \
- ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/namet.ads \
- ada/opt.ads ada/output.ads ada/put_scos.ads ada/put_scos.adb \
- ada/scos.ads ada/system.ads ada/s-assert.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \
- ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
- ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
- ada/unchconv.ads ada/unchdeal.ads
+ ada/g-hesorg.ads ada/g-table.ads ada/g-table.adb ada/hostparm.ads \
+ ada/namet.ads ada/opt.ads ada/output.ads ada/put_scos.ads \
+ ada/put_scos.adb ada/scos.ads ada/system.ads ada/s-assert.ads \
+ ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
+ ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
+ ada/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/put_spark_xrefs.o : ada/ada.ads ada/a-unccon.ads ada/gnat.ads \
- ada/g-table.ads ada/g-table.adb ada/put_spark_xrefs.ads \
- ada/put_spark_xrefs.adb ada/spark_xrefs.ads ada/system.ads \
- ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads ada/s-stalib.ads \
- ada/s-unstyp.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/g-hesorg.ads ada/g-table.ads ada/g-table.adb \
+ ada/put_spark_xrefs.ads ada/put_spark_xrefs.adb ada/spark_xrefs.ads \
+ ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads \
+ ada/s-stalib.ads ada/s-unstyp.ads ada/types.ads ada/unchconv.ads \
+ ada/unchdeal.ads
ada/repinfo.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3128,12 +3132,13 @@ ada/scng.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/scos.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/gnat.ads \
- ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/namet.ads \
- ada/opt.ads ada/output.ads ada/scos.ads ada/scos.adb ada/system.ads \
- ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads \
- ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads \
- ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
- ada/tree_io.ads ada/types.ads ada/unchconv.ads ada/unchdeal.ads
+ ada/g-hesorg.ads ada/g-hesorg.adb ada/g-table.ads ada/g-table.adb \
+ ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads ada/scos.ads \
+ ada/scos.adb ada/system.ads ada/s-assert.ads ada/s-exctab.ads \
+ ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads \
+ ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads \
+ ada/table.ads ada/table.adb ada/tree_io.ads ada/types.ads \
+ ada/unchconv.ads ada/unchdeal.ads
ada/sem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/alloc.ads ada/aspects.ads ada/atree.ads ada/atree.adb \
@@ -3156,7 +3161,7 @@ ada/sem.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/tree_io.ads \
ada/types.ads ada/uintp.ads ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3189,7 +3194,8 @@ ada/sem_aggr.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/validsw.ads ada/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/warnsw.ads \
+ ada/widechar.ads
ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/a-except.ads ada/a-unccon.ads ada/a-uncdea.ads ada/alloc.ads \
@@ -3202,13 +3208,14 @@ ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/exp_dist.ads ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads \
ada/exp_util.adb ada/expander.ads ada/fname.ads ada/fname-uf.ads \
ada/freeze.ads ada/get_targ.ads ada/gnat.ads ada/g-byorma.ads \
- ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads ada/inline.ads \
- ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib-load.ads \
- ada/lib-util.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/namet-sp.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/output.ads ada/put_spark_xrefs.ads \
- ada/restrict.ads ada/restrict.adb ada/rident.ads ada/rtsfind.ads \
- ada/scans.ads ada/sdefault.ads ada/sem.ads ada/sem.adb ada/sem_aggr.ads \
+ ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads ada/hostparm.ads \
+ ada/inline.ads ada/interfac.ads ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/namet-sp.ads \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/put_spark_xrefs.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/sdefault.ads ada/sem.ads ada/sem.adb ada/sem_aggr.ads \
ada/sem_attr.ads ada/sem_attr.adb ada/sem_aux.ads ada/sem_aux.adb \
ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch11.ads ada/sem_ch12.ads \
ada/sem_ch13.ads ada/sem_ch2.ads ada/sem_ch3.ads ada/sem_ch4.ads \
@@ -3230,7 +3237,7 @@ ada/sem_attr.o : ada/ada.ads ada/a-charac.ads ada/a-chlat1.ads \
ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/types.adb ada/uintp.ads ada/uintp.adb ada/uname.ads \
ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/urealp.adb \
- ada/validsw.ads ada/widechar.ads
+ ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/sem_aux.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3322,7 +3329,7 @@ ada/sem_ch10.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads ada/table.adb \
ada/targparm.ads ada/tbuild.ads ada/tree_io.ads ada/ttypes.ads \
ada/types.ads ada/uintp.ads ada/uname.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/sem_ch11.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3353,12 +3360,11 @@ ada/sem_ch12.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/erroutc.ads ada/exp_ch11.ads ada/exp_ch7.ads ada/exp_disp.ads \
ada/exp_dist.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/gnatvsn.ads \
- ada/hostparm.ads ada/inline.ads ada/inline.adb ada/itypes.ads \
- ada/lib.ads ada/lib.adb ada/lib-list.adb ada/lib-load.ads \
- ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads ada/namet.ads \
- ada/namet-sp.ads ada/nlists.ads ada/nlists.adb ada/nmake.ads \
- ada/nmake.adb ada/opt.ads ada/opt.adb ada/output.ads \
+ ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
+ ada/inline.ads ada/inline.adb ada/itypes.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads \
+ ada/lib-xref.ads ada/namet.ads ada/namet-sp.ads ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
ada/put_spark_xrefs.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
ada/rtsfind.adb ada/scans.ads ada/sem.ads ada/sem.adb ada/sem_attr.ads \
ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch10.ads ada/sem_ch11.ads \
@@ -3380,7 +3386,7 @@ ada/sem_ch12.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
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/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/sem_ch13.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \
@@ -3469,7 +3475,7 @@ ada/sem_ch3.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/validsw.ads ada/widechar.ads
+ ada/validsw.ads ada/warnsw.ads ada/widechar.ads
ada/sem_ch4.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3541,7 +3547,7 @@ ada/sem_ch5.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads 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/validsw.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/warnsw.ads
ada/sem_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3579,7 +3585,7 @@ ada/sem_ch6.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
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/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3609,7 +3615,8 @@ ada/sem_ch7.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/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/widechar.ads
+ ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads ada/warnsw.ads \
+ ada/widechar.ads
ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3646,7 +3653,7 @@ ada/sem_ch8.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/table.ads ada/table.adb ada/targparm.ads ada/tbuild.ads \
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/widechar.ads
+ ada/urealp.ads ada/warnsw.ads ada/widechar.ads
ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/aspects.adb \
@@ -3683,7 +3690,7 @@ ada/sem_ch9.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
ada/tbuild.ads 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/validsw.ads
+ ada/unchdeal.ads ada/urealp.ads ada/validsw.ads ada/warnsw.ads
ada/sem_dim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3770,28 +3777,28 @@ ada/sem_elab.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/err_vars.ads ada/errout.ads ada/erroutc.ads ada/exp_ch11.ads \
ada/exp_disp.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
ada/fname.ads ada/fname-uf.ads ada/freeze.ads ada/get_targ.ads \
- ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads \
- ada/interfac.ads ada/lib.ads ada/lib.adb ada/lib-list.adb \
- ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads ada/lib-xref.ads \
- ada/namet.ads ada/namet.adb ada/namet-sp.ads ada/nlists.ads \
- ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
- ada/put_spark_xrefs.ads ada/restrict.ads ada/restrict.adb \
- ada/rident.ads ada/rtsfind.ads ada/scans.ads ada/sem.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads ada/sem_ch7.ads \
- ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads ada/sem_elab.adb \
- ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads ada/sem_util.ads \
- ada/sem_util.adb ada/set_targ.ads ada/sinfo.ads ada/sinfo.adb \
- ada/sinput.ads ada/snames.ads ada/stand.ads ada/stringt.ads \
- ada/style.ads ada/styleg.ads ada/styleg.adb ada/stylesw.ads \
- ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-htable.ads \
- ada/s-imenne.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads \
- ada/s-rident.ads ada/s-secsta.ads ada/s-soflin.ads ada/s-stache.ads \
- ada/s-stalib.ads ada/s-stoele.ads ada/s-stoele.adb ada/s-string.ads \
- ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
- ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tbuild.adb \
- ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/uintp.ads \
- ada/uname.ads ada/unchconv.ads ada/unchdeal.ads ada/urealp.ads \
- ada/widechar.ads
+ ada/gnat.ads ada/g-byorma.ads ada/g-hesorg.ads ada/g-htable.ads \
+ ada/hostparm.ads ada/interfac.ads ada/lib.ads ada/lib.adb \
+ ada/lib-list.adb ada/lib-load.ads ada/lib-sort.adb ada/lib-util.ads \
+ ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/namet-sp.ads \
+ ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
+ ada/output.ads ada/put_spark_xrefs.ads ada/restrict.ads \
+ ada/restrict.adb ada/rident.ads ada/rtsfind.ads ada/scans.ads \
+ ada/sem.ads ada/sem_attr.ads ada/sem_aux.ads ada/sem_cat.ads \
+ ada/sem_ch7.ads ada/sem_ch8.ads ada/sem_disp.ads ada/sem_elab.ads \
+ ada/sem_elab.adb ada/sem_eval.ads ada/sem_res.ads ada/sem_type.ads \
+ ada/sem_util.ads ada/sem_util.adb ada/set_targ.ads ada/sinfo.ads \
+ ada/sinfo.adb ada/sinput.ads ada/sinput.adb ada/snames.ads \
+ ada/stand.ads ada/stringt.ads ada/style.ads ada/styleg.ads \
+ ada/styleg.adb ada/stylesw.ads ada/system.ads ada/s-assert.ads \
+ ada/s-exctab.ads ada/s-htable.ads ada/s-imenne.ads ada/s-memory.ads \
+ ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads ada/s-secsta.ads \
+ ada/s-soflin.ads ada/s-stache.ads ada/s-stalib.ads ada/s-stoele.ads \
+ ada/s-stoele.adb ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
+ ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
+ ada/tbuild.ads ada/tbuild.adb ada/tree_io.ads ada/ttypes.ads \
+ ada/types.ads ada/uintp.ads ada/uname.ads ada/unchconv.ads \
+ ada/unchdeal.ads ada/urealp.ads ada/widechar.ads
ada/sem_elim.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -3965,7 +3972,7 @@ ada/sem_res.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/tree_io.ads ada/ttypes.ads ada/types.ads ada/types.adb \
ada/uintp.ads ada/uintp.adb ada/uname.ads ada/unchconv.ads \
ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/validsw.ads \
- ada/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/sem_scil.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4020,7 +4027,7 @@ ada/sem_type.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/table.adb ada/targparm.ads ada/tbuild.ads ada/tree_io.ads \
ada/treepr.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/widechar.ads
+ ada/warnsw.ads ada/widechar.ads
ada/sem_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4055,7 +4062,8 @@ ada/sem_util.o : ada/ada.ads ada/a-except.ads ada/a-unccon.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/widechar.ads
+ ada/unchdeal.ads ada/urealp.ads ada/urealp.adb ada/warnsw.ads \
+ ada/widechar.ads
ada/sem_vfpt.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/atree.ads ada/cstand.ads \
@@ -4204,14 +4212,14 @@ ada/snames.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/unchconv.ads ada/unchdeal.ads ada/widechar.ads
ada/spark_xrefs.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
- ada/a-uncdea.ads ada/gnat.ads ada/g-table.ads ada/g-table.adb \
- ada/hostparm.ads ada/output.ads ada/output.adb ada/put_spark_xrefs.ads \
- ada/put_spark_xrefs.adb ada/spark_xrefs.ads ada/spark_xrefs.adb \
- ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads \
- ada/s-os_lib.ads ada/s-parame.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/types.ads ada/unchconv.ads \
- ada/unchdeal.ads
+ ada/a-uncdea.ads ada/gnat.ads ada/g-hesorg.ads ada/g-hesorg.adb \
+ ada/g-table.ads ada/g-table.adb ada/hostparm.ads ada/output.ads \
+ ada/output.adb ada/put_spark_xrefs.ads ada/put_spark_xrefs.adb \
+ ada/spark_xrefs.ads ada/spark_xrefs.adb ada/system.ads ada/s-assert.ads \
+ ada/s-exctab.ads ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.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/types.ads ada/unchconv.ads ada/unchdeal.ads
ada/sprint.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/aspects.ads ada/atree.ads \
@@ -4490,12 +4498,11 @@ ada/validsw.o : ada/ada.ads ada/a-unccon.ads ada/a-uncdea.ads \
ada/warnsw.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/alloc.ads ada/debug.ads ada/err_vars.ads \
ada/hostparm.ads ada/namet.ads ada/opt.ads ada/output.ads \
- ada/rident.ads ada/system.ads ada/s-assert.ads ada/s-exctab.ads \
- ada/s-memory.ads ada/s-os_lib.ads ada/s-parame.ads ada/s-rident.ads \
- ada/s-stalib.ads ada/s-string.ads ada/s-traent.ads ada/s-unstyp.ads \
- ada/s-wchcon.ads ada/table.ads ada/table.adb ada/targparm.ads \
- ada/tree_io.ads ada/types.ads ada/uintp.ads ada/unchconv.ads \
- ada/unchdeal.ads ada/warnsw.ads ada/warnsw.adb
+ ada/system.ads ada/s-assert.ads ada/s-exctab.ads ada/s-memory.ads \
+ ada/s-os_lib.ads ada/s-parame.ads ada/s-stalib.ads ada/s-string.ads \
+ ada/s-traent.ads ada/s-unstyp.ads ada/s-wchcon.ads ada/table.ads \
+ ada/table.adb ada/tree_io.ads ada/types.ads ada/uintp.ads \
+ ada/unchconv.ads ada/unchdeal.ads ada/warnsw.ads ada/warnsw.adb
ada/widechar.o : ada/ada.ads ada/a-except.ads ada/a-unccon.ads \
ada/a-uncdea.ads ada/hostparm.ads ada/interfac.ads ada/opt.ads \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 0c4057c1019..2c51a0026a8 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -1,5 +1,5 @@
# Makefile for GNU Ada Compiler (GNAT).
-# Copyright (C) 1994-2012 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
#This file is part of GCC.
@@ -122,7 +122,7 @@ THREAD_KIND = native
THREADSLIB =
GMEM_LIB =
MISCLIB =
-OUTPUT_OPTION = @OUTPUT_OPTION@
+OUTPUT_OPTION = -o $@
objext = .o
exeext =
@@ -153,10 +153,14 @@ objdir = .
target_alias=@target_alias@
target=@target@
+target_cpu=@target_cpu@
+target_vendor=@target_vendor@
+target_os=@target_os@
+host_cpu=@host_cpu@
+host_vendor=@host_vendor@
+host_os=@host_os@
xmake_file = @xmake_file@
tmake_file = @tmake_file@
-host_canonical=@host@
-target_cpu_default=@target_cpu_default@
#version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
#mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
@@ -254,20 +258,6 @@ TOOLS_LIBS = ../link.o ../targext.o ../../ggc-none.o ../../libcommon-target.a \
../../libcommon.a ../../../libcpp/libcpp.a $(LIBGNAT) $(LIBINTL) $(LIBICONV) \
../$(LIBBACKTRACE) ../$(LIBIBERTY) $(SYSLIBS) $(TGT_LIB)
-# Convert the target variable into a space separated list of architecture,
-# manufacturer, and operating system and assign each of those to its own
-# variable.
-host:=$(subst -, ,$(host_canonical))
-targ:=$(subst -, ,$(subst -gnu, ,$(target_alias)))
-arch:=$(word 1,$(targ))
-ifeq ($(words $(targ)),2)
- manu:=
- osys:=$(word 2,$(targ))
-else
- manu:=$(word 2,$(targ))
- osys:=$(word 3,$(targ))
-endif
-
# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
@@ -279,7 +269,7 @@ ADA_INCLUDES = -I- -I. -I$(srcdir)/ada
# Likewise, but valid for subdirectories of the current dir.
# FIXME: for VxWorks, we cannot add $(fsrcdir) because the regs.h file in
# that directory conflicts with a system header file.
-ifneq ($(findstring vxworks,$(osys)),)
+ifneq ($(findstring vxworks,$(target_os)),)
INCLUDES_FOR_SUBDIR = -iquote . -iquote .. -iquote ../.. \
-iquote $(fsrcdir)/ada \
-I$(fsrcdir)/../include $(GMPINC)
@@ -351,12 +341,12 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
# picks up the right files. For a given target this must be coherent
# with MULTILIB_DIRNAMES defined in gcc/config/target/t-*.
-ifeq ($(strip $(filter-out %x86_64, $(arch))),)
+ifeq ($(strip $(filter-out %x86_64, $(target_cpu))),)
ifeq ($(strip $(MULTISUBDIR)),/32)
- arch:=i686
+ target_cpu:=i686
else
ifeq ($(strip $(MULTISUBDIR)),/x32)
- arch:=x32
+ target_cpu:=x32
endif
endif
endif
@@ -459,7 +449,7 @@ EXTRA_LIBGNAT_SRCS=
# If what's left is null then it's a match.
# m68k VxWorks
-ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out m68k% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
@@ -502,7 +492,7 @@ ifeq ($(strip $(filter-out m68k% wrs vx%,$(targ))),)
endif
# PowerPC and e500v2 VxWorks
-ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
+ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
@@ -608,7 +598,7 @@ ifeq ($(strip $(filter-out e500% powerpc% wrs vxworks,$(targ))),)
endif
# PowerPC and e500v2 VxWorks 653
-ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
+ifeq ($(strip $(filter-out powerpc% wrs vxworksae,$(target_cpu) $(target_vendor) $(target_os))),)
# target pairs for vthreads runtime
LIBGNAT_TARGET_PAIRS = \
a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
@@ -670,7 +660,7 @@ ifeq ($(strip $(filter-out powerpc% e500v2 wrs vxworksae,$(targ))),)
endif
# PowerPC and e500v2 VxWorks MILS
-ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
+ifeq ($(strip $(filter-out powerpc% wrs vxworksmils,$(target_cpu) $(target_vendor) $(target_os))),)
# target pairs for vthreads runtime
LIBGNAT_TARGET_PAIRS = \
a-elchha.adb<a-elchha-vx6-raven-cert.adb \
@@ -720,7 +710,7 @@ ifeq ($(strip $(filter-out e500% powerpc% wrs vxworksmils,$(targ))),)
endif
# VxWorksae / VxWorks 653 for x86 (vxsim) - ?? VxWorks mils not implemented
-ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
+ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(target_cpu) $(target_vendor) $(target_os))),)
# target pairs for kernel + vthreads runtime
LIBGNAT_TARGET_PAIRS = \
a-elchha.adb<a-elchha-vxworks-ppc-full.adb \
@@ -780,7 +770,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworksae vxworksmils,$(targ))),)
endif
# Sparc VxWorks
-ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out sparc% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
@@ -807,16 +797,16 @@ ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
mlib-tgt-specific.adb<mlib-tgt-specific-vxworks.adb \
indepsw.adb<indepsw-gnu.adb
- ifeq ($(strip $(filter-out sparc erc32 leon leon3, $(arch))),)
- # 32-bits
- LIBGNAT_TARGET_PAIRS += \
- s-vxwork.ads<s-vxwork-sparc.ads \
- system.ads<system-vxworks-sparc-kernel.ads
- else
+ ifeq ($(strip $(filter-out sparc64 sparcv9, $(target_cpu))),)
# 64-bits
LIBGNAT_TARGET_PAIRS += \
s-vxwork.ads<s-vxwork-sparcv9.ads \
system.ads<system-vxworks-sparcv9.ads
+ else
+ # 32-bits
+ LIBGNAT_TARGET_PAIRS += \
+ s-vxwork.ads<s-vxwork-sparc.ads \
+ system.ads<system-vxworks-sparc-kernel.ads
endif
ifeq ($(strip $(filter-out kernel,$(THREAD_KIND))),)
@@ -832,7 +822,7 @@ ifeq ($(strip $(filter-out sparc% leon% wrs vx%,$(targ))),)
endif
# x86 VxWorks
-ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
+ifeq ($(strip $(filter-out %86 wrs vxworks,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
i-vxwork.ads<i-vxwork-x86.ads \
@@ -923,7 +913,7 @@ ifeq ($(strip $(filter-out %86 wrs vxworks,$(targ))),)
endif
# ARM VxWorks
-ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out arm% coff wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
@@ -959,7 +949,7 @@ ifeq ($(strip $(filter-out arm% coff wrs vx%,$(targ))),)
endif
# MIPS VxWorks
-ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
+ifeq ($(strip $(filter-out mips% wrs vx%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-vxworks.ads \
a-numaux.ads<a-numaux-vxworks.ads \
@@ -994,7 +984,8 @@ ifeq ($(strip $(filter-out mips% wrs vx%,$(targ))),)
EXTRA_LIBGNAT_OBJS+=vx_stack_info.o
endif
-ifeq ($(strip $(filter-out arm% androideabi,$(arch) $(osys))),)
+# ARM linux, Android eabi
+ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1022,7 +1013,7 @@ ifeq ($(strip $(filter-out arm% androideabi,$(arch) $(osys))),)
endif
# Sparc Solaris
-ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
+ifeq ($(strip $(filter-out sparc% sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-solaris.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1046,7 +1037,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
$(ATOMICS_TARGET_PAIRS) \
$(ATOMICS_BUILTINS_TARGET_PAIRS)
- ifeq ($(strip $(filter-out sparc sun solaris%,$(targ))),)
+ ifeq ($(strip $(filter-out sparc sun solaris%,$(target_cpu) $(target_vendor) $(target_os))),)
ifeq ($(strip $(MULTISUBDIR)),/sparcv9)
LIBGNAT_TARGET_PAIRS = \
$(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
@@ -1097,7 +1088,7 @@ ifeq ($(strip $(filter-out sparc% sun solaris%,$(targ))),)
endif
# x86 and x86-64 solaris
-ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 %x86_64 solaris2%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-solaris.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1122,7 +1113,7 @@ ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
$(X86_64_TARGET_PAIRS) \
system.ads<system-solaris-x86_64.ads
- ifeq ($(strip $(filter-out %86 solaris2%,$(arch) $(osys))),)
+ ifeq ($(strip $(filter-out %86 solaris2%,$(target_cpu) $(target_os))),)
ifeq ($(strip $(MULTISUBDIR)),/amd64)
LIBGNAT_TARGET_PAIRS = \
$(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_64)
@@ -1154,7 +1145,7 @@ ifeq ($(strip $(filter-out %86 %x86_64 %amd64 solaris2%,$(arch) $(osys))),)
endif
# x86 Linux
-ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
a-synbar.adb<a-synbar-posix.adb \
@@ -1215,7 +1206,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
endif
# x86 kfreebsd
-ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 kfreebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-freebsd.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1246,7 +1237,7 @@ ifeq ($(strip $(filter-out %86 kfreebsd%,$(arch) $(osys))),)
MISCLIB = -lutil
endif
-ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-freebsd.ads \
a-numaux.adb<a-numaux-x86.adb \
@@ -1275,7 +1266,7 @@ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
endif
# x86 FreeBSD
-ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86 freebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-freebsd.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1304,7 +1295,7 @@ ifeq ($(strip $(filter-out %86 freebsd%,$(arch) $(osys))),)
endif
# x86-64 FreeBSD
-ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %86_64 freebsd%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-freebsd.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1333,7 +1324,7 @@ ifeq ($(strip $(filter-out %86_64 freebsd%,$(arch) $(osys))),)
endif
# S390 Linux
-ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out s390% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1354,7 +1345,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
LIBGNAT_TARGET_PAIRS_64 = \
system.ads<system-linux-s390x.ads
- ifeq ($(strip $(filter-out s390x,$(arch))),)
+ ifeq ($(strip $(filter-out s390x,$(target_cpu))),)
ifeq ($(strip $(MULTISUBDIR)),/32)
LIBGNAT_TARGET_PAIRS = \
$(LIBGNAT_TARGET_PAIRS_COMMON) $(LIBGNAT_TARGET_PAIRS_32)
@@ -1379,7 +1370,7 @@ ifeq ($(strip $(filter-out s390% linux%,$(arch) $(osys))),)
endif
# HP/PA HP-UX 10
-ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
+ifeq ($(strip $(filter-out hppa% hp hpux10%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-excpol.adb<a-excpol-abort.adb \
a-intnam.ads<a-intnam-hpux.ads \
@@ -1399,7 +1390,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux10%,$(targ))),)
endif
# HP/PA HP-UX 11
-ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
+ifeq ($(strip $(filter-out hppa% hp hpux11%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-hpux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1426,7 +1417,7 @@ ifeq ($(strip $(filter-out hppa% hp hpux11%,$(targ))),)
endif
# IBM AIX
-ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
+ifeq ($(strip $(filter-out ibm aix%,$(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-aix.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1470,7 +1461,7 @@ ifeq ($(strip $(filter-out ibm aix%,$(manu) $(osys))),)
endif
# RTEMS
-ifeq ($(strip $(filter-out rtems%,$(osys))),)
+ifeq ($(strip $(filter-out rtems%,$(target_os))),)
LIBGNAT_TARGET_PAIRS = \
system.ads<system-rtems.ads \
a-intnam.ads<a-intnam-rtems.ads \
@@ -1488,7 +1479,7 @@ ifeq ($(strip $(filter-out rtems%,$(osys))),)
endif
# OpenVMS (host)
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(host_cpu) $(host_vendor) $(host_os))),)
soext = .exe
hyphen = _
@@ -1498,7 +1489,7 @@ LN_S = cp -p
endif
# OpenVMS (target)
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-caldel.adb<a-caldel-vms.adb \
a-calend.adb<a-calend-vms.adb \
@@ -1532,7 +1523,7 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
s-tpopde.adb<s-tpopde-vms.adb \
s-tpopde.ads<s-tpopde-vms.ads
- ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(targ))),)
+ ifeq ($(strip $(filter-out ia64 hp vms% openvms%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS += \
g-enblsp.adb<g-enblsp-vms-ia64.adb \
g-trasym.adb<g-trasym-vms-ia64.adb \
@@ -1552,7 +1543,7 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
symbols.adb<symbols-vms.adb \
symbols-processing.adb<symbols-processing-vms-ia64.adb
else
- ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(targ))),)
+ ifeq ($(strip $(filter-out alpha64 dec vms% openvms% alphavms%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS += \
g-enblsp.adb<g-enblsp-vms-alpha.adb \
g-trasym.adb<g-trasym-vms-alpha.adb \
@@ -1590,22 +1581,22 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(targ)))
LIBRARY_VERSION := $(subst .,_,$(LIB_VERSION))
endif
-# *-elf
-ifeq ($(strip $(filter-out lmp avr none powerpc% eabispe leon% erc32% unknown elf,$(targ))),)
+# *-elf, *-eabi or *-eabispe
+ifeq ($(strip $(filter-out elf eabi eabispe,$(target_os))),)
TOOLS_TARGET_PAIRS=\
mlib-tgt-specific.adb<mlib-tgt-specific-xi.adb \
indepsw.adb<indepsw-gnu.adb
endif
# Cygwin/Mingw32
-ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
+ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(target_os))),)
# Cygwin provides a full Posix environment, and so we use the default
# versions of s-memory and g-socthi rather than the Windows-specific
# MinGW versions. Ideally we would use all the default versions for
# Cygwin and none of the MinGW versions, but for historical reasons
# the Cygwin port has always been a CygMing frankenhybrid and it is
# a long-term project to disentangle them.
- ifeq ($(strip $(filter-out cygwin%,$(osys))),)
+ ifeq ($(strip $(filter-out cygwin%,$(target_os))),)
LIBGNAT_TARGET_PAIRS = \
s-memory.adb<s-memory.adb \
g-socthi.ads<g-socthi.ads \
@@ -1663,7 +1654,7 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
s-osprim.adb<s-osprim-mingw.adb \
s-taprop.adb<s-taprop-mingw.adb
- ifeq ($(strip $(filter-out x86_64%,$(arch))),)
+ ifeq ($(strip $(filter-out x86_64%,$(target_cpu))),)
ifeq ($(strip $(MULTISUBDIR)),/32)
LIBGNAT_TARGET_PAIRS += \
$(X86_TARGET_PAIRS) \
@@ -1714,7 +1705,7 @@ ifeq ($(strip $(filter-out cygwin% mingw32% pe,$(osys))),)
endif
# Mips Linux
-ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out mips linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1738,7 +1729,7 @@ ifeq ($(strip $(filter-out mips linux%,$(arch) $(osys))),)
endif
# Mips/el Linux
-ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out mipsel linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1781,7 +1772,7 @@ ifeq ($(strip $(filter-out mipsel linux%,$(arch) $(osys))),)
endif
# Mips64/el Linux
-ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out mips64el linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1824,7 +1815,7 @@ ifeq ($(strip $(filter-out mips64el linux%,$(arch) $(osys))),)
endif
# PowerPC and e500v2 Linux
-ifeq ($(strip $(filter-out powerpc% e500% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out powerpc% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-exetim.adb<a-exetim-posix.adb \
a-exetim.ads<a-exetim-default.ads \
@@ -1887,7 +1878,8 @@ ifeq ($(strip $(filter-out powerpc% e500% linux%,$(arch) $(osys))),)
LIBRARY_VERSION := $(LIB_VERSION)
endif
-ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)
+# ARM linux, GNU eabi
+ifeq ($(strip $(filter-out arm% linux-gnueabi,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1902,7 +1894,7 @@ ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(
s-taspri.ads<s-taspri-posix-noaltstack.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb
- ifeq ($(strip $(filter-out arm%b,$(arch))),)
+ ifeq ($(strip $(filter-out arm%b,$(target_cpu))),)
LIBGNAT_TARGET_PAIRS += \
system.ads<system-linux-armeb.ads
else
@@ -1923,7 +1915,7 @@ ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(
endif
# Sparc Linux
-ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out sparc% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS_COMMON = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1965,7 +1957,7 @@ ifeq ($(strip $(filter-out sparc% linux%,$(arch) $(osys))),)
endif
# HP/PA Linux
-ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out hppa% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -1994,7 +1986,7 @@ ifeq ($(strip $(filter-out hppa% linux%,$(arch) $(osys))),)
endif
# SH4 Linux
-ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out sh4% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -2024,7 +2016,7 @@ ifeq ($(strip $(filter-out sh4% linux%,$(arch) $(osys))),)
endif
# IA64 Linux
-ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %ia64 linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<a-exetim-posix.adb \
a-exetim.ads<a-exetim-default.ads \
@@ -2063,7 +2055,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,$(arch) $(osys))),)
endif
# IA64 HP-UX
-ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
+ifeq ($(strip $(filter-out ia64% hp hpux%,$(target_cpu) $(target_vendor) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-hpux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -2092,7 +2084,7 @@ ifeq ($(strip $(filter-out ia64% hp hpux%,$(targ))),)
endif
# Alpha Linux
-ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out alpha% linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-linux.ads \
s-inmaop.adb<s-inmaop-posix.adb \
@@ -2123,7 +2115,7 @@ ifeq ($(strip $(filter-out alpha% linux%,$(arch) $(osys))),)
endif
# x86-64 Linux
-ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %x86_64 linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<a-exetim-posix.adb \
a-exetim.ads<a-exetim-default.ads \
@@ -2160,7 +2152,7 @@ ifeq ($(strip $(filter-out %x86_64 linux%,$(arch) $(osys))),)
LIBRARY_VERSION := $(LIB_VERSION)
endif
-ifeq ($(strip $(filter-out %x32 linux%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
a-exetim.adb<a-exetim-posix.adb \
a-exetim.ads<a-exetim-default.ads \
@@ -2198,7 +2190,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(arch) $(osys))),)
endif
# Darwin (Mac OS X)
-ifeq ($(strip $(filter-out darwin%,$(osys))),)
+ifeq ($(strip $(filter-out darwin%,$(target_os))),)
SO_OPTS = -shared-libgcc
LIBGNAT_TARGET_PAIRS = \
a-intnam.ads<a-intnam-darwin.ads \
@@ -2209,7 +2201,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
s-taspri.ads<s-taspri-posix.ads \
s-tpopsp.adb<s-tpopsp-posix-foreign.adb
- ifeq ($(strip $(filter-out %86,$(arch))),)
+ ifeq ($(strip $(filter-out %86,$(target_cpu))),)
LIBGNAT_TARGET_PAIRS += \
s-intman.adb<s-intman-susv3.adb \
s-osprim.adb<s-osprim-darwin.adb \
@@ -2229,7 +2221,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
endif
- ifeq ($(strip $(filter-out %x86_64,$(arch))),)
+ ifeq ($(strip $(filter-out %x86_64,$(target_cpu))),)
LIBGNAT_TARGET_PAIRS += \
s-intman.adb<s-intman-susv3.adb \
s-osprim.adb<s-osprim-darwin.adb \
@@ -2249,7 +2241,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o
endif
- ifeq ($(strip $(filter-out powerpc%,$(arch))),)
+ ifeq ($(strip $(filter-out powerpc%,$(target_cpu))),)
LIBGNAT_TARGET_PAIRS += \
s-intman.adb<s-intman-posix.adb \
s-osprim.adb<s-osprim-posix.adb \
@@ -2279,7 +2271,7 @@ ifeq ($(strip $(filter-out darwin%,$(osys))),)
endif
# ARM Nucleus
-ifeq ($(strip $(filter-out arm nucleus%,$(arch) $(osys))),)
+ifeq ($(strip $(filter-out arm nucleus%,$(target_cpu) $(target_os))),)
LIBGNAT_TARGET_PAIRS = \
system.ads<system-nucleus-arm.ads \
a-numaux.ads<a-numaux-vxworks.ads \
@@ -2621,7 +2613,7 @@ install-gnatlib: ../stamp-gnatlib-$(RTSDIR)
$(RM) ../stamp-gnatlib-$(RTSDIR)
touch ../stamp-gnatlib1-$(RTSDIR)
-ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
+ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%, $(host_cpu) $(host_os))),)
OSCONS_CPP=../../$(DECC) -E /comment=as_is -DNATIVE \
-DTARGET='""$(target)""' $(fsrcpfx)ada/s-oscons-tmplt.c
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 26342e2a012..456d7ab7ad9 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -4812,6 +4812,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
saved = true;
break;
+ case E_Abstract_State:
+ /* This is a SPARK annotation that only reaches here when compiling in
+ ASIS mode and has no characteristics to annotate. */
+ gcc_assert (type_annotate_only);
+ return error_mark_node;
+
default:
gcc_unreachable ();
}
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 4048e0aefe9..7e56f22c3f0 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -290,9 +290,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
tree int64_type = gnat_type_for_size (64, 0);
struct elab_info *info;
int i;
-#ifdef ORDINARY_MAP_INSTANCE
- struct line_map *map;
-#endif
max_gnat_nodes = max_gnat_node;
@@ -307,10 +304,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
type_annotate_only = (gigi_operating_mode == 1);
- /* ??? Disable the generation of the SCO instance table until after the
- back-end supports instance based debug info discriminators. */
- Generate_SCO_Instance_Table = False;
-
for (i = 0; i < number_file; i++)
{
/* Use the identifier table to make a permanent copy of the filename as
@@ -330,11 +323,6 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name ATTRIBUTE_UNUSED,
/* We create the line map for a source file at once, with a fixed number
of columns chosen to avoid jumping over the next power of 2. */
linemap_add (line_table, LC_ENTER, 0, filename, 1);
-#ifdef ORDINARY_MAP_INSTANCE
- map = LINEMAPS_ORDINARY_MAP_AT (line_table, i);
- if (flag_debug_instances)
- ORDINARY_MAP_INSTANCE (map) = file_info_ptr[i].Instance;
-#endif
linemap_line_start (line_table, file_info_ptr[i].Num_Source_Lines, 252);
linemap_position_for_column (line_table, 252 - 1);
linemap_add (line_table, LC_LEAVE, 0, NULL, 0);
@@ -1403,6 +1391,7 @@ Pragma_to_gnu (Node_Id gnat_node)
static tree
Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
{
+ const Node_Id gnat_prefix = Prefix (gnat_node);
tree gnu_prefix, gnu_type, gnu_expr;
tree gnu_result_type, gnu_result = error_mark_node;
bool prefix_unused = false;
@@ -1412,13 +1401,13 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
parameter types might be incomplete types coming from a limited with. */
if (Ekind (Etype (gnat_node)) == E_Access_Subprogram_Type
&& Is_Dispatch_Table_Entity (Etype (gnat_node))
- && Nkind (Prefix (gnat_node)) == N_Identifier
- && Is_Subprogram (Entity (Prefix (gnat_node)))
- && Is_Public (Entity (Prefix (gnat_node)))
- && !present_gnu_tree (Entity (Prefix (gnat_node))))
- gnu_prefix = get_minimal_subprog_decl (Entity (Prefix (gnat_node)));
+ && Nkind (gnat_prefix) == N_Identifier
+ && Is_Subprogram (Entity (gnat_prefix))
+ && Is_Public (Entity (gnat_prefix))
+ && !present_gnu_tree (Entity (gnat_prefix)))
+ gnu_prefix = get_minimal_subprog_decl (Entity (gnat_prefix));
else
- gnu_prefix = gnat_to_gnu (Prefix (gnat_node));
+ gnu_prefix = gnat_to_gnu (gnat_prefix);
gnu_type = TREE_TYPE (gnu_prefix);
/* If the input is a NULL_EXPR, make a new one. */
@@ -1561,8 +1550,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
since it can use a special calling convention on some platforms,
which cannot be propagated to the access type. */
else if (attribute == Attr_Access
- && Nkind (Prefix (gnat_node)) == N_Identifier
- && is_cplusplus_method (Entity (Prefix (gnat_node))))
+ && Nkind (gnat_prefix) == N_Identifier
+ && is_cplusplus_method (Entity (gnat_prefix)))
post_error ("access to C++ constructor or member function not allowed",
gnat_node);
@@ -1673,13 +1662,12 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
/* If this is a dereference and we have a special dynamic constrained
subtype on the prefix, use it to compute the size; otherwise, use
the designated subtype. */
- if (Nkind (Prefix (gnat_node)) == N_Explicit_Dereference)
+ if (Nkind (gnat_prefix) == N_Explicit_Dereference)
{
- Node_Id gnat_deref = Prefix (gnat_node);
Node_Id gnat_actual_subtype
- = Actual_Designated_Subtype (gnat_deref);
+ = Actual_Designated_Subtype (gnat_prefix);
tree gnu_ptr_type
- = TREE_TYPE (gnat_to_gnu (Prefix (gnat_deref)));
+ = TREE_TYPE (gnat_to_gnu (Prefix (gnat_prefix)));
if (TYPE_IS_FAT_OR_THIN_POINTER_P (gnu_ptr_type)
&& Present (gnat_actual_subtype))
@@ -1740,7 +1728,6 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
align = DECL_ALIGN (TREE_OPERAND (gnu_prefix, 1)) / BITS_PER_UNIT;
else
{
- Node_Id gnat_prefix = Prefix (gnat_node);
Entity_Id gnat_type = Etype (gnat_prefix);
unsigned int double_align;
bool is_capped_double, align_clause;
@@ -1812,28 +1799,38 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
: 1), i;
struct parm_attr_d *pa = NULL;
Entity_Id gnat_param = Empty;
+ bool unconstrained_ptr_deref = false;
/* Make sure any implicit dereference gets done. */
gnu_prefix = maybe_implicit_deref (gnu_prefix);
gnu_prefix = maybe_unconstrained_array (gnu_prefix);
- /* We treat unconstrained array In parameters specially. */
- if (!Is_Constrained (Etype (Prefix (gnat_node))))
- {
- Node_Id gnat_prefix = Prefix (gnat_node);
-
- /* This is the direct case. */
- if (Nkind (gnat_prefix) == N_Identifier
- && Ekind (Entity (gnat_prefix)) == E_In_Parameter)
- gnat_param = Entity (gnat_prefix);
-
- /* This is the indirect case. Note that we need to be sure that
- the access value cannot be null as we'll hoist the load. */
- if (Nkind (gnat_prefix) == N_Explicit_Dereference
- && Nkind (Prefix (gnat_prefix)) == N_Identifier
- && Ekind (Entity (Prefix (gnat_prefix))) == E_In_Parameter
- && Can_Never_Be_Null (Entity (Prefix (gnat_prefix))))
- gnat_param = Entity (Prefix (gnat_prefix));
+ /* We treat unconstrained array In parameters specially. We also note
+ whether we are dereferencing a pointer to unconstrained array. */
+ if (!Is_Constrained (Etype (gnat_prefix)))
+ switch (Nkind (gnat_prefix))
+ {
+ case N_Identifier:
+ /* This is the direct case. */
+ if (Ekind (Entity (gnat_prefix)) == E_In_Parameter)
+ gnat_param = Entity (gnat_prefix);
+ break;
+
+ case N_Explicit_Dereference:
+ /* This is the indirect case. Note that we need to be sure that
+ the access value cannot be null as we'll hoist the load. */
+ if (Nkind (Prefix (gnat_prefix)) == N_Identifier
+ && Ekind (Entity (Prefix (gnat_prefix))) == E_In_Parameter)
+ {
+ if (Can_Never_Be_Null (Entity (Prefix (gnat_prefix))))
+ gnat_param = Entity (Prefix (gnat_prefix));
+ }
+ else
+ unconstrained_ptr_deref = true;
+ break;
+
+ default:
+ break;
}
/* If the prefix is the view conversion of a constrained array to an
@@ -1968,22 +1965,54 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
{
gnu_result
= build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result);
- if (attribute == Attr_First)
- pa->first = gnu_result;
- else if (attribute == Attr_Last)
- pa->last = gnu_result;
- else
- pa->length = gnu_result;
+ switch (attribute)
+ {
+ case Attr_First:
+ pa->first = gnu_result;
+ break;
+
+ case Attr_Last:
+ pa->last = gnu_result;
+ break;
+
+ case Attr_Length:
+ case Attr_Range_Length:
+ pa->length = gnu_result;
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
}
- /* Set the source location onto the predicate of the condition in the
- 'Length case but do not do it if the expression is cached to avoid
- messing up the debug info. */
- else if ((attribute == Attr_Range_Length || attribute == Attr_Length)
- && TREE_CODE (gnu_result) == COND_EXPR
- && EXPR_P (TREE_OPERAND (gnu_result, 0)))
- set_expr_location_from_node (TREE_OPERAND (gnu_result, 0),
- gnat_node);
+ /* Otherwise, evaluate it each time it is referenced. */
+ else
+ switch (attribute)
+ {
+ case Attr_First:
+ case Attr_Last:
+ /* If we are dereferencing a pointer to unconstrained array, we
+ need to capture the value because the pointed-to bounds may
+ subsequently be released. */
+ if (unconstrained_ptr_deref)
+ gnu_result
+ = build1 (SAVE_EXPR, TREE_TYPE (gnu_result), gnu_result);
+ break;
+
+ case Attr_Length:
+ case Attr_Range_Length:
+ /* Set the source location onto the predicate of the condition
+ but not if the expression is cached to avoid messing up the
+ debug info. */
+ if (TREE_CODE (gnu_result) == COND_EXPR
+ && EXPR_P (TREE_OPERAND (gnu_result, 0)))
+ set_expr_location_from_node (TREE_OPERAND (gnu_result, 0),
+ gnat_node);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
break;
}
@@ -2156,8 +2185,8 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
case Attr_Mechanism_Code:
{
+ Entity_Id gnat_obj = Entity (gnat_prefix);
int code;
- Entity_Id gnat_obj = Entity (Prefix (gnat_node));
prefix_unused = true;
gnu_result_type = get_unpadded_type (Etype (gnat_node));
@@ -2192,10 +2221,11 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
it has a side-effect. But don't do it if the prefix is just an entity
name. However, if an access check is needed, we must do it. See second
example in AARM 11.6(5.e). */
- if (prefix_unused && TREE_SIDE_EFFECTS (gnu_prefix)
- && !Is_Entity_Name (Prefix (gnat_node)))
- gnu_result = build_compound_expr (TREE_TYPE (gnu_result), gnu_prefix,
- gnu_result);
+ if (prefix_unused
+ && TREE_SIDE_EFFECTS (gnu_prefix)
+ && !Is_Entity_Name (gnat_prefix))
+ gnu_result
+ = build_compound_expr (TREE_TYPE (gnu_result), gnu_prefix, gnu_result);
*gnu_result_type_p = gnu_result_type;
return gnu_result;
@@ -3605,6 +3635,8 @@ Subprogram_Body_to_gnu (Node_Id gnat_node)
{
tree gnu_retval;
+ gnu_return_var_stack->pop ();
+
add_stmt (gnu_result);
add_stmt (build1 (LABEL_EXPR, void_type_node,
gnu_return_label_stack->last ()));
diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb
index fa959df7407..b0e3087508f 100644
--- a/gcc/ada/gnat1drv.adb
+++ b/gcc/ada/gnat1drv.adb
@@ -242,7 +242,7 @@ procedure Gnat1drv is
-- Enable assertions, since they give CodePeer valuable extra info
- Assertions_Enabled := True;
+ Assertions_Enabled := True;
-- Disable all simple value propagation. This is an optimization
-- which is valuable for code optimization, and also for generation
@@ -413,10 +413,10 @@ procedure Gnat1drv is
-- which is more complex to formally verify than the original source.
Tagged_Type_Expansion := False;
-
end if;
- -- Set Configurable_Run_Time mode if system.ads flag set
+ -- Set Configurable_Run_Time mode if system.ads flag set or if the
+ -- special debug flag -gnatdY is set.
if Targparm.Configurable_Run_Time_On_Target or Debug_Flag_YY then
Configurable_Run_Time_Mode := True;
@@ -571,6 +571,21 @@ procedure Gnat1drv is
end if;
end if;
+ -- Output warning if -gnateE specified and cannot be supported
+
+ if Exception_Extra_Info
+ and then Restrict.No_Exception_Handlers_Set
+ then
+ Set_Standard_Error;
+ Write_Str
+ ("warning: extra exception information (-gnateE) was specified");
+ Write_Eol;
+ Write_Str
+ ("warning: this capability is not available in this configuration");
+ Write_Eol;
+ Set_Standard_Output;
+ end if;
+
-- Finally capture adjusted value of Suppress_Options as the initial
-- value for Scope_Suppress, which will be modified as we move from
-- scope to scope (by Suppress/Unsuppress/Overflow_Checks pragmas).
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 0a5f07db04a..40ffc35dacd 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -3697,7 +3697,9 @@ object file after compilation. If @command{gnatmake} is called with
@option{-gnatc} as a builder switch (before @option{-cargs} or in package
Builder of the project file) then @command{gnatmake} will not fail because
it will not look for the object files after compilation, and it will not try
-to build and link.
+to build and link. This switch may not be given if a previous @code{-gnatR}
+switch has been given, since @code{-gnatR} requires that the code generator
+be called to complete determination of representation information.
@item -gnatC
@cindex @option{-gnatC} (@command{gcc})
@@ -4006,8 +4008,14 @@ Treat pragma Restrictions as Restriction_Warnings.
@item ^-gnatR@r{[}0@r{/}1@r{/}2@r{/}3@r{[}s@r{]]}^/REPRESENTATION_INFO^
@cindex @option{-gnatR} (@command{gcc})
Output representation information for declared types and objects.
-Note that this switch is not allowed if a previous
--gnatD switch has been given, since these two switches are not compatible.
+Note that this switch is not allowed if a previous @code{-gnatD} switch has
+been given, since these two switches are not compatible. It is also not allowed
+if a previous @code{-gnatc} switch has been given, since we must be generating
+code to be able to determine representation information.
+
+@item ^-gnatRm[s]^/REPRESENTATION_INFO^
+Output convention and parameter passing mechanisms for all subprograms.
+This form is also incompatible with the use of @code{-gnatc}.
@item -gnats
@cindex @option{-gnats} (@command{gcc})
@@ -7273,6 +7281,11 @@ discriminant. See source files @file{repinfo.ads/adb} in the
output. If the switch is followed by an s (e.g.@: @option{-gnatR2s}), then
the output is to a file with the name @file{^file.rep^file_REP^} where
file is the name of the corresponding source file.
+
+@item -gnatRm[s]
+This form of the switch controls output of subprogram conventions
+and parameter passing mechanisms for all subprograms. A following
+@code{s} means output to a file as described above.
@end ifclear
@ifset vms
@item /REPRESENTATION_INFO
@@ -7296,7 +7309,14 @@ If _FILE is added at the end of an option
(e.g.@: @option{/REPRESENTATION_INFO=ARRAYS_FILE}),
then the output is to a file with the name @file{file_REP} where
file is the name of the corresponding source file.
+
+@item /REPRESENTATION_INFO=MECHANISMS
+This qualifier form controls output of subprogram conventions
+and parameter passing mechanisms for all subprograms. It is
+possible to append _FILE as described above to cause information
+to be written to a file.
@end ifset
+
Note that it is possible for record components to have zero size. In
this case, the component clause uses an obvious extension of permitted
Ada syntax, for example @code{at 0 range 0 .. -1}.
diff --git a/gcc/ada/gnatbind.adb b/gcc/ada/gnatbind.adb
index 52591c46b07..14afac55386 100644
--- a/gcc/ada/gnatbind.adb
+++ b/gcc/ada/gnatbind.adb
@@ -572,7 +572,7 @@ begin
-- First, scan to detect --version and/or --help
- Check_Version_And_Help ("GNATBIND", "1995");
+ Check_Version_And_Help ("GNATBIND", "1992");
-- We need to Scan_Bind_Args first, to set Verbose_Mode, so we know whether
-- to Put_Bind_Args.
diff --git a/gcc/ada/gnatdll.adb b/gcc/ada/gnatdll.adb
index 6917e631d08..426c00f58bd 100644
--- a/gcc/ada/gnatdll.adb
+++ b/gcc/ada/gnatdll.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -26,16 +26,18 @@
-- GNATDLL is a Windows specific tool for building a DLL.
-- Both relocatable and non-relocatable DLL's are supported
+with Gnatvsn;
+with MDLL.Fil; use MDLL.Fil;
+with MDLL.Utl; use MDLL.Utl;
+with Switch; use Switch;
+
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Command_Line; use Ada.Command_Line;
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-with GNAT.Command_Line; use GNAT.Command_Line;
-with Gnatvsn;
-with MDLL.Fil; use MDLL.Fil;
-with MDLL.Utl; use MDLL.Utl;
+with GNAT.OS_Lib; use GNAT.OS_Lib;
+with GNAT.Command_Line; use GNAT.Command_Line;
procedure Gnatdll is
@@ -502,9 +504,13 @@ procedure Gnatdll is
end loop;
end Check_Context;
+ procedure Check_Version_And_Help is new Check_Version_And_Help_G (Syntax);
+
-- Start of processing for Gnatdll
begin
+ Check_Version_And_Help ("GNATDLL", "1997");
+
if Ada.Command_Line.Argument_Count = 0 then
Help := True;
else
diff --git a/gcc/ada/gnatkr.adb b/gcc/ada/gnatkr.adb
index 1df692e7b4d..908f08ef667 100644
--- a/gcc/ada/gnatkr.adb
+++ b/gcc/ada/gnatkr.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -23,10 +23,13 @@
-- --
------------------------------------------------------------------------------
-with Ada.Characters.Handling; use Ada.Characters.Handling;
-with Ada.Command_Line; use Ada.Command_Line;
with Gnatvsn;
with Krunch;
+with Switch; use Switch;
+
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+with Ada.Command_Line; use Ada.Command_Line;
+
with System.IO; use System.IO;
procedure Gnatkr is
@@ -38,13 +41,28 @@ procedure Gnatkr is
function Get_Maximum_File_Name_Length return Integer;
pragma Import (C, Get_Maximum_File_Name_Length,
- "__gnat_get_maximum_file_name_length");
+ "__gnat_get_maximum_file_name_length");
+
+ procedure Usage;
+ -- Output usage information
+
+ -----------
+ -- Usage --
+ -----------
+
+ procedure Usage is
+ begin
+ Put_Line ("Usage: gnatkr filename[.extension] [krunch-count]");
+ end Usage;
+
+ procedure Check_Version_And_Help is new Check_Version_And_Help_G (Usage);
begin
+ Check_Version_And_Help ("GNATKR", "1992");
Count := Argument_Count;
if Count < 1 or else Count > 2 then
- Put_Line ("Usage: gnatkr filename[.extension] [krunch-count]");
+ Usage;
raise Exit_Program;
else
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index 503c2f7b152..793feb95690 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -355,7 +355,7 @@ procedure Gnatlink is
begin
-- First, check for --version and --help
- Check_Version_And_Help ("GNATLINK", "1995");
+ Check_Version_And_Help ("GNATLINK", "1996");
-- Loop through arguments of gnatlink command
diff --git a/gcc/ada/gnatls.adb b/gcc/ada/gnatls.adb
index ae623897d6c..4a97edde9a5 100644
--- a/gcc/ada/gnatls.adb
+++ b/gcc/ada/gnatls.adb
@@ -1556,7 +1556,7 @@ begin
-- First check for --version or --help
- Check_Version_And_Help ("GNATLS", "1997");
+ Check_Version_And_Help ("GNATLS", "1992");
-- Loop to scan out arguments
diff --git a/gcc/ada/inline.ads b/gcc/ada/inline.ads
index f3750a83aa2..825b958f1ef 100644
--- a/gcc/ada/inline.ads
+++ b/gcc/ada/inline.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -36,10 +36,11 @@
-- Frontend, and thus are not mutually recursive.
with Alloc;
-with Opt; use Opt;
-with Sem; use Sem;
+with Opt; use Opt;
+with Sem; use Sem;
with Table;
-with Types; use Types;
+with Types; use Types;
+with Warnsw; use Warnsw;
package Inline is
@@ -89,6 +90,12 @@ package Inline is
-- The body must be compiled with the same language version as the
-- spec. The version may be set by a configuration pragma in a separate
-- file or in the current file, and may differ from body to body.
+
+ Version_Pragma : Node_Id;
+ -- This is linked with the Version value
+
+ Warnings : Warning_Record;
+ -- Capture values of warning flags
end record;
package Pending_Instantiations is new Table.Table (
diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb
index d9973b52a0b..84b7a3b64e0 100644
--- a/gcc/ada/make.adb
+++ b/gcc/ada/make.adb
@@ -5803,7 +5803,7 @@ package body Make is
if Verbose_Mode then
Write_Eol;
- Display_Version ("GNATMAKE", "1995");
+ Display_Version ("GNATMAKE", "1992");
end if;
if Osint.Number_Of_Files = 0 then
diff --git a/gcc/ada/opt.adb b/gcc/ada/opt.adb
index 1fc43cc203e..9f1f2d84a80 100644
--- a/gcc/ada/opt.adb
+++ b/gcc/ada/opt.adb
@@ -54,6 +54,7 @@ package body Opt is
procedure Register_Opt_Config_Switches is
begin
Ada_Version_Config := Ada_Version;
+ Ada_Version_Pragma_Config := Ada_Version_Pragma;
Ada_Version_Explicit_Config := Ada_Version_Explicit;
Assertions_Enabled_Config := Assertions_Enabled;
Assume_No_Invalid_Values_Config := Assume_No_Invalid_Values;
@@ -87,6 +88,7 @@ package body Opt is
procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type) is
begin
Ada_Version := Save.Ada_Version;
+ Ada_Version_Pragma := Save.Ada_Version_Pragma;
Ada_Version_Explicit := Save.Ada_Version_Explicit;
Assertions_Enabled := Save.Assertions_Enabled;
Assume_No_Invalid_Values := Save.Assume_No_Invalid_Values;
@@ -122,6 +124,7 @@ package body Opt is
procedure Save_Opt_Config_Switches (Save : out Config_Switches_Type) is
begin
Save.Ada_Version := Ada_Version;
+ Save.Ada_Version_Pragma := Ada_Version_Pragma;
Save.Ada_Version_Explicit := Ada_Version_Explicit;
Save.Assertions_Enabled := Assertions_Enabled;
Save.Assume_No_Invalid_Values := Assume_No_Invalid_Values;
@@ -161,6 +164,7 @@ package body Opt is
-- the configuration setting even in a run time unit.
Ada_Version := Ada_Version_Runtime;
+ Ada_Version_Pragma := Empty;
Dynamic_Elaboration_Checks := False;
Extensions_Allowed := True;
External_Name_Exp_Casing := As_Is;
@@ -188,6 +192,7 @@ package body Opt is
else
Ada_Version := Ada_Version_Config;
+ Ada_Version_Pragma := Ada_Version_Pragma_Config;
Ada_Version_Explicit := Ada_Version_Explicit_Config;
Assertions_Enabled := Assertions_Enabled_Config;
Assume_No_Invalid_Values := Assume_No_Invalid_Values_Config;
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index a4cbafd3888..605dc89e839 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -131,6 +131,10 @@ package Opt is
-- compiler switches, or implicitly (to Ada_Version_Runtime) when a
-- predefined or internal file is compiled.
+ Ada_Version_Pragma : Node_Id := Empty;
+ -- Reflects the Ada_xxx pragma that resulted in setting Ada_Version. Used
+ -- to specialize error messages complaining about the Ada version in use.
+
Ada_Version_Explicit : Ada_Version_Type := Ada_Version_Default;
-- GNAT
-- Like Ada_Version, but does not get set implicitly for predefined
@@ -861,7 +865,7 @@ package Opt is
List_Representation_Info_To_File : Boolean := False;
-- GNAT
- -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3 to be
+ -- Set true by -gnatRs switch. Causes information from -gnatR/1/2/3/m to be
-- written to file.rep (where file is the name of the source file) instead
-- of stdout. For example, if file x.adb is compiled using -gnatR2s then
-- representation info is written to x.adb.ref.
@@ -1737,6 +1741,9 @@ package Opt is
-- predefined units (which are always compiled in the most up to date
-- version of Ada).
+ Ada_Version_Pragma_Config : Node_Id;
+ -- This will be set non empty if it is set by a configuration pragma
+
Ada_Version_Explicit_Config : Ada_Version_Type;
-- GNAT
-- This is set in the same manner as Ada_Version_Config. The difference is
@@ -2019,6 +2026,7 @@ private
type Config_Switches_Type is record
Ada_Version : Ada_Version_Type;
Ada_Version_Explicit : Ada_Version_Type;
+ Ada_Version_Pragma : Node_Id;
Assertions_Enabled : Boolean;
Assume_No_Invalid_Values : Boolean;
Check_Float_Overflow : Boolean;
diff --git a/gcc/ada/par-ch11.adb b/gcc/ada/par-ch11.adb
index f0537f27cd1..61df3ee2512 100644
--- a/gcc/ada/par-ch11.adb
+++ b/gcc/ada/par-ch11.adb
@@ -213,11 +213,7 @@ package body Ch11 is
Raise_Node : Node_Id;
begin
- if Ada_Version < Ada_2012 then
- Error_Msg_SC ("raise expression is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("raise expression", Token_Ptr);
Raise_Node := New_Node (N_Raise_Expression, Token_Ptr);
Scan; -- past RAISE
diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb
index 3c192f2877b..cf75f04fa15 100644
--- a/gcc/ada/par-ch12.adb
+++ b/gcc/ada/par-ch12.adb
@@ -74,10 +74,13 @@ package body Ch12 is
-- GENERIC_RENAMING_DECLARATION ::=
-- generic package DEFINING_PROGRAM_UNIT_NAME
-- renames generic_package_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | generic procedure DEFINING_PROGRAM_UNIT_NAME
-- renames generic_procedure_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | generic function DEFINING_PROGRAM_UNIT_NAME
-- renames generic_function_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- GENERIC_FORMAL_PARAMETER_DECLARATION ::=
-- FORMAL_OBJECT_DECLARATION
@@ -140,6 +143,8 @@ package body Ch12 is
Scan; -- past RENAMES
Set_Defining_Unit_Name (Decl_Node, Def_Unit);
Set_Name (Decl_Node, P_Name);
+
+ P_Aspect_Specifications (Decl_Node, Semicolon => False);
TF_Semicolon;
return Decl_Node;
end if;
@@ -211,7 +216,6 @@ package body Ch12 is
else
Gen_Decl := New_Node (N_Generic_Subprogram_Declaration, Gen_Sloc);
-
Set_Specification (Gen_Decl, P_Subprogram_Specification);
if Nkind (Defining_Unit_Name (Specification (Gen_Decl))) =
@@ -542,12 +546,8 @@ package body Ch12 is
Scan; -- past semicolon
- if Ada_Version < Ada_2012 then
- Error_Msg_N
- ("`formal incomplete type` is an Ada 2012 feature", Decl_Node);
- Error_Msg_N
- ("\unit must be compiled with -gnat2012 switch", Decl_Node);
- end if;
+ Error_Msg_Ada_2012_Feature
+ ("formal incomplete type", Sloc (Decl_Node));
Set_Formal_Type_Definition
(Decl_Node,
@@ -560,13 +560,9 @@ package body Ch12 is
Def_Node := P_Formal_Type_Definition;
- if Nkind (Def_Node) = N_Formal_Incomplete_Type_Definition
- and then Ada_Version < Ada_2012
- then
- Error_Msg_N
- ("`formal incomplete type` is an Ada 2012 feature", Decl_Node);
- Error_Msg_N
- ("\unit must be compiled with -gnat2012 switch", Decl_Node);
+ if Nkind (Def_Node) = N_Formal_Incomplete_Type_Definition then
+ Error_Msg_Ada_2012_Feature
+ ("formal incomplete type", Sloc (Decl_Node));
end if;
if Def_Node /= Error then
diff --git a/gcc/ada/par-ch13.adb b/gcc/ada/par-ch13.adb
index 4d63d0e64a4..26b8056f80f 100644
--- a/gcc/ada/par-ch13.adb
+++ b/gcc/ada/par-ch13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -128,8 +128,7 @@ package body Ch13 is
if Result then
Restore_Scan_State (Scan_State);
- Error_Msg_SC ("|aspect specification is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
+ Error_Msg_Ada_2012_Feature ("|aspect specification", Token_Ptr);
return True;
end if;
end if;
@@ -266,15 +265,20 @@ package body Ch13 is
if Token = Tok_Comma
or else Token = Tok_Semicolon
then
- if Aspect_Argument (A_Id) /= Optional then
+ if Aspect_Argument (A_Id) /= Optional_Expression
+ and then
+ Aspect_Argument (A_Id) /= Optional_Name
+ then
Error_Msg_Node_1 := Identifier (Aspect);
Error_Msg_AP ("aspect& requires an aspect definition");
OK := False;
end if;
elsif not Semicolon and then Token /= Tok_Arrow then
- if Aspect_Argument (A_Id) /= Optional then
-
+ if Aspect_Argument (A_Id) /= Optional_Expression
+ and then
+ Aspect_Argument (A_Id) /= Optional_Name
+ then
-- The name or expression may be there, but the arrow is
-- missing. Skip to the end of the declaration.
@@ -292,9 +296,17 @@ package body Ch13 is
OK := False;
end if;
- if Aspect_Argument (A_Id) = Name then
+ if Aspect_Argument (A_Id) = Name
+ or else
+ Aspect_Argument (A_Id) = Optional_Name
+ then
Set_Expression (Aspect, P_Name);
+
else
+ pragma Assert
+ (Aspect_Argument (A_Id) = Expression
+ or else
+ Aspect_Argument (A_Id) = Optional_Expression);
Set_Expression (Aspect, P_Expression);
end if;
end if;
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index eae388ba7ae..29126152d43 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -275,13 +275,14 @@ package body Ch3 is
-- PRIVATE_TYPE_DECLARATION ::=
-- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]
- -- is [abstract] [tagged] [limited] private;
+ -- is [abstract] [tagged] [limited] private
+ -- [ASPECT_SPECIFICATIONS];
-- PRIVATE_EXTENSION_DECLARATION ::=
-- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is
-- [abstract] [limited | synchronized]
-- new ancestor_SUBTYPE_INDICATION [and INTERFACE_LIST]
- -- with private;
+ -- with private [ASPECT_SPECIFICATIONS];
-- TYPE_DEFINITION ::=
-- ENUMERATION_TYPE_DEFINITION | INTEGER_TYPE_DEFINITION
@@ -1277,12 +1278,15 @@ package body Ch3 is
-- OBJECT_RENAMING_DECLARATION ::=
-- DEFINING_IDENTIFIER :
- -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME;
+ -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | DEFINING_IDENTIFIER :
- -- ACCESS_DEFINITION renames object_NAME;
+ -- ACCESS_DEFINITION renames object_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- EXCEPTION_RENAMING_DECLARATION ::=
- -- DEFINING_IDENTIFIER : exception renames exception_NAME;
+ -- DEFINING_IDENTIFIER : exception renames exception_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- EXCEPTION_DECLARATION ::=
-- DEFINING_IDENTIFIER_LIST : exception
@@ -1669,15 +1673,19 @@ package body Ch3 is
-- OBJECT_DECLARATION ::=
-- DEFINING_IDENTIFIER_LIST : [aliased] [constant]
- -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION];
+ -- [NULL_EXCLUSION] SUBTYPE_INDICATION [:= EXPRESSION]
+ -- [ASPECT_SPECIFICATIONS];
-- | DEFINING_IDENTIFIER_LIST : [aliased] [constant]
- -- ACCESS_DEFINITION [:= EXPRESSION];
+ -- ACCESS_DEFINITION [:= EXPRESSION]
+ -- [ASPECT_SPECIFICATIONS];
-- OBJECT_RENAMING_DECLARATION ::=
-- DEFINING_IDENTIFIER :
- -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME;
+ -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | DEFINING_IDENTIFIER :
- -- ACCESS_DEFINITION renames object_NAME;
+ -- ACCESS_DEFINITION renames object_NAME
+ -- [ASPECT_SPECIFICATIONS];
Not_Null_Present := P_Null_Exclusion; -- Ada 2005 (AI-231/423)
@@ -1893,7 +1901,7 @@ package body Ch3 is
-- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is
-- [abstract] [limited | synchronized]
-- new ancestor_SUBTYPE_INDICATION [and INTERFACE_LIST]
- -- with private;
+ -- with private [ASPECT_SPECIFICATIONS];
-- RECORD_EXTENSION_PART ::= with RECORD_DEFINITION
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 38fd00e1fbb..5766639816a 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -2672,18 +2672,12 @@ package body Ch4 is
Node1 : Node_Id;
begin
- if Ada_Version < Ada_2012 then
- Error_Msg_SC ("quantified expression is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("quantified expression", Token_Ptr);
Scan; -- past FOR
-
Node1 := New_Node (N_Quantified_Expression, Prev_Token_Ptr);
if Token = Tok_All then
Set_All_Present (Node1);
-
elsif Token /= Tok_Some then
Error_Msg_AP ("missing quantifier");
raise Error_Resync;
@@ -2960,14 +2954,9 @@ package body Ch4 is
Set_Subpool_Handle_Name (Alloc_Node, P_Name);
T_Right_Paren;
- if Ada_Version < Ada_2012 then
- Error_Msg_N
- ("|subpool specification is an Ada 2012 feature",
- Subpool_Handle_Name (Alloc_Node));
- Error_Msg_N
- ("\|unit must be compiled with -gnat2012 switch",
- Subpool_Handle_Name (Alloc_Node));
- end if;
+ Error_Msg_Ada_2012_Feature
+ ("|subpool specification",
+ Sloc (Subpool_Handle_Name (Alloc_Node)));
end if;
Null_Exclusion_Present := P_Null_Exclusion;
@@ -3006,11 +2995,7 @@ package body Ch4 is
Save_State : Saved_Scan_State;
begin
- if Ada_Version < Ada_2012 then
- Error_Msg_SC ("|case expression is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("|case expression", Token_Ptr);
Scan; -- past CASE
Case_Node :=
Make_Case_Expression (Loc,
@@ -3096,12 +3081,7 @@ package body Ch4 is
begin
Inside_If_Expression := Inside_If_Expression + 1;
-
- if Token = Tok_If and then Ada_Version < Ada_2012 then
- Error_Msg_SC ("|if expression is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("|if expression", Token_Ptr);
Scan; -- past IF or ELSIF
Append_To (Exprs, P_Condition);
TF_Then;
@@ -3182,11 +3162,7 @@ package body Ch4 is
-- Set case
if Token = Tok_Vertical_Bar then
- if Ada_Version < Ada_2012 then
- Error_Msg_SC ("set notation is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("set notation", Token_Ptr);
Set_Alternatives (N, New_List (Alt));
Set_Right_Opnd (N, Empty);
diff --git a/gcc/ada/par-ch5.adb b/gcc/ada/par-ch5.adb
index e9b0a2c8e95..94c5bd4d073 100644
--- a/gcc/ada/par-ch5.adb
+++ b/gcc/ada/par-ch5.adb
@@ -1656,10 +1656,7 @@ package body Ch5 is
-- during analysis of the loop parameter specification.
if Token = Tok_Of or else Token = Tok_Colon then
- if Ada_Version < Ada_2012 then
- Error_Msg_SC ("iterator is an Ada 2012 feature");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("iterator", Token_Ptr);
return P_Iterator_Specification (ID_Node);
end if;
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 7531f405fe1..f060b3f2822 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -161,13 +161,16 @@ package body Ch6 is
-- [ASPECT_SPECIFICATIONS];
-- SUBPROGRAM_BODY_STUB ::=
- -- SUBPROGRAM_SPECIFICATION is separate;
+ -- SUBPROGRAM_SPECIFICATION is separate
+ -- [ASPECT_SPECIFICATIONS];
-- GENERIC_INSTANTIATION ::=
-- procedure DEFINING_PROGRAM_UNIT_NAME is
- -- new generic_procedure_NAME [GENERIC_ACTUAL_PART];
+ -- new generic_procedure_NAME [GENERIC_ACTUAL_PART]
+ -- [ASPECT_SPECIFICATIONS];
-- | function DEFINING_DESIGNATOR is
- -- new generic_function_NAME [GENERIC_ACTUAL_PART];
+ -- new generic_function_NAME [GENERIC_ACTUAL_PART]
+ -- [ASPECT_SPECIFICATIONS];
-- NULL_PROCEDURE_DECLARATION ::=
-- SUBPROGRAM_SPECIFICATION is null;
@@ -394,8 +397,8 @@ package body Ch6 is
if Token = Tok_Identifier
and then not Token_Is_At_Start_Of_Line
then
- T_Left_Paren; -- to generate message
- Fpart_List := P_Formal_Part;
+ T_Left_Paren; -- to generate message
+ Fpart_List := P_Formal_Part;
-- Otherwise scan out an optional formal part in the usual manner
@@ -681,21 +684,21 @@ package body Ch6 is
Sloc (Name_Node));
end if;
+ Scan; -- past SEPARATE
+
Stub_Node :=
New_Node (N_Subprogram_Body_Stub, Sloc (Specification_Node));
Set_Specification (Stub_Node, Specification_Node);
- -- The specification has been parsed as part of a subprogram
- -- declaration, and aspects have already been collected.
-
if Is_Non_Empty_List (Aspects) then
- Set_Parent (Aspects, Stub_Node);
- Set_Aspect_Specifications (Stub_Node, Aspects);
+ Error_Msg
+ ("aspect specifications must come after SEPARATE",
+ Sloc (First (Aspects)));
end if;
- Scan; -- past SEPARATE
- Pop_Scope_Stack;
+ P_Aspect_Specifications (Stub_Node, Semicolon => False);
TF_Semicolon;
+ Pop_Scope_Stack;
return Stub_Node;
-- Subprogram body or expression function case
@@ -831,12 +834,8 @@ package body Ch6 is
-- Check we are in Ada 2012 mode
- if Ada_Version < Ada_2012 then
- Error_Msg_SC
- ("expression function is an Ada 2012 feature!");
- Error_Msg_SC
- ("\unit must be compiled with -gnat2012 switch!");
- end if;
+ Error_Msg_Ada_2012_Feature
+ ("!expression function", Token_Ptr);
-- Catch an illegal placement of the aspect specification
-- list:
@@ -1464,7 +1463,8 @@ package body Ch6 is
if Token = Tok_Aliased then
if Ada_Version < Ada_2012 then
- Error_Msg_SC ("ALIASED parameter is an Ada 2012 feature");
+ Error_Msg_Ada_2012_Feature
+ ("ALIASED parameter", Token_Ptr);
else
Set_Aliased_Present (Specification_Node);
end if;
diff --git a/gcc/ada/par-ch7.adb b/gcc/ada/par-ch7.adb
index d52a13d6c5b..0a658c963e1 100644
--- a/gcc/ada/par-ch7.adb
+++ b/gcc/ada/par-ch7.adb
@@ -38,28 +38,33 @@ package body Ch7 is
-- renaming declaration or generic instantiation starting with PACKAGE
-- PACKAGE_DECLARATION ::=
- -- PACKAGE_SPECIFICATION
- -- [ASPECT_SPECIFICATIONS];
+ -- PACKAGE_SPECIFICATION;
-- PACKAGE_SPECIFICATION ::=
- -- package DEFINING_PROGRAM_UNIT_NAME is
+ -- package DEFINING_PROGRAM_UNIT_NAME
+ -- [ASPECT_SPECIFICATIONS]
+ -- is
-- {BASIC_DECLARATIVE_ITEM}
-- [private
-- {BASIC_DECLARATIVE_ITEM}]
-- end [[PARENT_UNIT_NAME .] IDENTIFIER]
-- PACKAGE_BODY ::=
- -- package body DEFINING_PROGRAM_UNIT_NAME is
+ -- package body DEFINING_PROGRAM_UNIT_NAME
+ -- [ASPECT_SPECIFICATIONS]
+ -- is
-- DECLARATIVE_PART
-- [begin
-- HANDLED_SEQUENCE_OF_STATEMENTS]
-- end [[PARENT_UNIT_NAME .] IDENTIFIER]
-- PACKAGE_RENAMING_DECLARATION ::=
- -- package DEFINING_IDENTIFIER renames package_NAME;
+ -- package DEFINING_IDENTIFIER renames package_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- PACKAGE_BODY_STUB ::=
- -- package body DEFINING_IDENTIFIER is separate;
+ -- package body DEFINING_IDENTIFIER is separate
+ -- [ASPECT_SPECIFICATIONS];
-- PACKAGE_INSTANTIATION ::=
-- package DEFINING_PROGRAM_UNIT_NAME is
@@ -141,6 +146,12 @@ package body Ch7 is
Scope.Table (Scope.Last).Sloc := Token_Ptr;
Name_Node := P_Defining_Program_Unit_Name;
Scope.Table (Scope.Last).Labl := Name_Node;
+
+ if Aspect_Specifications_Present then
+ Aspect_Sloc := Token_Ptr;
+ P_Aspect_Specifications (Dummy_Node, Semicolon => False);
+ end if;
+
TF_Is;
if Separate_Present then
@@ -149,16 +160,30 @@ package body Ch7 is
end if;
Scan; -- past SEPARATE
- TF_Semicolon;
- Pop_Scope_Stack;
Package_Node := New_Node (N_Package_Body_Stub, Package_Sloc);
Set_Defining_Identifier (Package_Node, Name_Node);
+ if Has_Aspects (Dummy_Node) then
+ Error_Msg
+ ("aspect specifications must come after SEPARATE",
+ Aspect_Sloc);
+ end if;
+
+ P_Aspect_Specifications (Package_Node, Semicolon => False);
+ TF_Semicolon;
+ Pop_Scope_Stack;
+
else
Package_Node := New_Node (N_Package_Body, Package_Sloc);
Set_Defining_Unit_Name (Package_Node, Name_Node);
+ -- Move the aspect specifications to the body node
+
+ if Has_Aspects (Dummy_Node) then
+ Move_Aspects (From => Dummy_Node, To => Package_Node);
+ end if;
+
-- In SPARK, a HIDE directive can be placed at the beginning of a
-- package implementation, thus hiding the package body from SPARK
-- tool-set. No violation of the SPARK restriction should be
@@ -204,6 +229,7 @@ package body Ch7 is
Set_Name (Package_Node, P_Qualified_Simple_Name);
No_Constraint;
+ P_Aspect_Specifications (Package_Node, Semicolon => False);
TF_Semicolon;
Pop_Scope_Stack;
diff --git a/gcc/ada/par-ch8.adb b/gcc/ada/par-ch8.adb
index fb2bf17c44d..89a2bb4a22b 100644
--- a/gcc/ada/par-ch8.adb
+++ b/gcc/ada/par-ch8.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -110,14 +110,9 @@ package body Ch8 is
begin
if Token = Tok_All then
- if Ada_Version < Ada_2012 then
- Error_Msg_SC ("|`USE ALL TYPE` is an Ada 2012 feature");
- Error_Msg_SC ("\|unit must be compiled with -gnat2012 switch");
- end if;
-
+ Error_Msg_Ada_2012_Feature ("|`USE ALL TYPE`", Token_Ptr);
All_Present := True;
Scan; -- past ALL
-
else
All_Present := False;
end if;
diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb
index 2de05880b59..e1692c4a11b 100644
--- a/gcc/ada/par-ch9.adb
+++ b/gcc/ada/par-ch9.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -61,14 +61,15 @@ package body Ch9 is
-- [is [new INTERFACE_LIST with] TASK_DEFINITION];
-- TASK_BODY ::=
- -- task body DEFINING_IDENTIFIER is
+ -- task body DEFINING_IDENTIFIER [ASPECT_SPECIFICATIONS] is
-- DECLARATIVE_PART
-- begin
-- HANDLED_SEQUENCE_OF_STATEMENTS
-- end [task_IDENTIFIER]
-- TASK_BODY_STUB ::=
- -- task body DEFINING_IDENTIFIER is separate;
+ -- task body DEFINING_IDENTIFIER is separate
+ -- [ASPECT_SPECIFICATIONS];
-- This routine scans out a task declaration, task body, or task stub
@@ -78,9 +79,15 @@ package body Ch9 is
-- Error recovery: cannot raise Error_Resync
function P_Task return Node_Id is
- Name_Node : Node_Id;
- Task_Node : Node_Id;
- Task_Sloc : Source_Ptr;
+ Aspect_Sloc : Source_Ptr;
+ Name_Node : Node_Id;
+ Task_Node : Node_Id;
+ Task_Sloc : Source_Ptr;
+
+ Dummy_Node : constant Node_Id := New_Node (N_Task_Body, Token_Ptr);
+ -- Placeholder node used to hold legal or prematurely declared aspect
+ -- specifications. Depending on the context, the aspect specifications
+ -- may be moved to a new node.
begin
Push_Scope_Stack;
@@ -100,6 +107,11 @@ package body Ch9 is
Discard_Junk_List (P_Known_Discriminant_Part_Opt);
end if;
+ if Aspect_Specifications_Present then
+ Aspect_Sloc := Token_Ptr;
+ P_Aspect_Specifications (Dummy_Node, Semicolon => False);
+ end if;
+
TF_Is;
-- Task stub
@@ -108,6 +120,14 @@ package body Ch9 is
Scan; -- past SEPARATE
Task_Node := New_Node (N_Task_Body_Stub, Task_Sloc);
Set_Defining_Identifier (Task_Node, Name_Node);
+
+ if Has_Aspects (Dummy_Node) then
+ Error_Msg
+ ("aspect specifications must come after SEPARATE",
+ Aspect_Sloc);
+ end if;
+
+ P_Aspect_Specifications (Task_Node, Semicolon => False);
TF_Semicolon;
Pop_Scope_Stack; -- remove unused entry
@@ -116,6 +136,13 @@ package body Ch9 is
else
Task_Node := New_Node (N_Task_Body, Task_Sloc);
Set_Defining_Identifier (Task_Node, Name_Node);
+
+ -- Move the aspect specifications to the body node
+
+ if Has_Aspects (Dummy_Node) then
+ Move_Aspects (From => Dummy_Node, To => Task_Node);
+ end if;
+
Parse_Decls_Begin_End (Task_Node);
end if;
@@ -367,12 +394,15 @@ package body Ch9 is
-- is [new INTERFACE_LIST with] PROTECTED_DEFINITION;
-- PROTECTED_BODY ::=
- -- protected body DEFINING_IDENTIFIER is
+ -- protected body DEFINING_IDENTIFIER
+ -- [ASPECT_SPECIFICATIONS]
+ -- is
-- {PROTECTED_OPERATION_ITEM}
-- end [protected_IDENTIFIER];
-- PROTECTED_BODY_STUB ::=
- -- protected body DEFINING_IDENTIFIER is separate;
+ -- protected body DEFINING_IDENTIFIER is separate
+ -- [ASPECT_SPECIFICATIONS];
-- This routine scans out a protected declaration, protected body
-- or a protected stub.
@@ -383,11 +413,17 @@ package body Ch9 is
-- Error recovery: cannot raise Error_Resync
function P_Protected return Node_Id is
+ Aspect_Sloc : Source_Ptr;
Name_Node : Node_Id;
Protected_Node : Node_Id;
Protected_Sloc : Source_Ptr;
Scan_State : Saved_Scan_State;
+ Dummy_Node : constant Node_Id := New_Node (N_Protected_Body, Token_Ptr);
+ -- Placeholder node used to hold legal or prematurely declared aspect
+ -- specifications. Depending on the context, the aspect specifications
+ -- may be moved to a new node.
+
begin
Push_Scope_Stack;
Scope.Table (Scope.Last).Etyp := E_Name;
@@ -405,14 +441,28 @@ package body Ch9 is
Discard_Junk_List (P_Known_Discriminant_Part_Opt);
end if;
+ if Aspect_Specifications_Present then
+ Aspect_Sloc := Token_Ptr;
+ P_Aspect_Specifications (Dummy_Node, Semicolon => False);
+ end if;
+
TF_Is;
-- Protected stub
if Token = Tok_Separate then
Scan; -- past SEPARATE
+
Protected_Node := New_Node (N_Protected_Body_Stub, Protected_Sloc);
Set_Defining_Identifier (Protected_Node, Name_Node);
+
+ if Has_Aspects (Dummy_Node) then
+ Error_Msg
+ ("aspect specifications must come after SEPARATE",
+ Aspect_Sloc);
+ end if;
+
+ P_Aspect_Specifications (Protected_Node, Semicolon => False);
TF_Semicolon;
Pop_Scope_Stack; -- remove unused entry
@@ -421,6 +471,8 @@ package body Ch9 is
else
Protected_Node := New_Node (N_Protected_Body, Protected_Sloc);
Set_Defining_Identifier (Protected_Node, Name_Node);
+
+ Move_Aspects (From => Dummy_Node, To => Protected_Node);
Set_Declarations (Protected_Node, P_Protected_Operation_Items);
End_Statements (Protected_Node);
end if;
@@ -800,8 +852,8 @@ package body Ch9 is
-- ENTRY_DECLARATION ::=
-- [OVERRIDING_INDICATOR]
- -- entry DEFINING_IDENTIFIER [(DISCRETE_SUBTYPE_DEFINITION)]
- -- PARAMETER_PROFILE;
+ -- entry DEFINING_IDENTIFIER
+ -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE
-- [ASPECT_SPECIFICATIONS];
-- The caller has checked that the initial token is ENTRY, NOT or
diff --git a/gcc/ada/par-prag.adb b/gcc/ada/par-prag.adb
index 4d01db09d12..5de6ecc0081 100644
--- a/gcc/ada/par-prag.adb
+++ b/gcc/ada/par-prag.adb
@@ -307,6 +307,7 @@ begin
when Pragma_Ada_83 =>
Ada_Version := Ada_83;
Ada_Version_Explicit := Ada_83;
+ Ada_Version_Pragma := Pragma_Node;
------------
-- Ada_95 --
@@ -319,6 +320,7 @@ begin
when Pragma_Ada_95 =>
Ada_Version := Ada_95;
Ada_Version_Explicit := Ada_95;
+ Ada_Version_Pragma := Pragma_Node;
---------------------
-- Ada_05/Ada_2005 --
@@ -333,6 +335,7 @@ begin
if Arg_Count = 0 then
Ada_Version := Ada_2005;
Ada_Version_Explicit := Ada_2005;
+ Ada_Version_Pragma := Pragma_Node;
end if;
---------------------
@@ -348,6 +351,7 @@ begin
if Arg_Count = 0 then
Ada_Version := Ada_2012;
Ada_Version_Explicit := Ada_2012;
+ Ada_Version_Pragma := Pragma_Node;
end if;
-----------
diff --git a/gcc/ada/prj.adb b/gcc/ada/prj.adb
index 9e0e0aa38d1..b98f711c5e7 100644
--- a/gcc/ada/prj.adb
+++ b/gcc/ada/prj.adb
@@ -959,6 +959,7 @@ package body Prj is
-- identifiers.
Opt.Ada_Version := Opt.Ada_95;
+ Opt.Ada_Version_Pragma := Empty;
Set_Name_Table_Byte (Name_Project, Token_Type'Pos (Tok_Project));
Set_Name_Table_Byte (Name_Extends, Token_Type'Pos (Tok_Extends));
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index f218cdc7a2b..88cd740b00a 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -278,6 +278,7 @@ package Rtsfind is
System_Machine_Code,
System_Mantissa,
System_Memcop,
+ System_Memory,
System_Multiprocessors,
System_Pack_03,
System_Pack_05,
@@ -585,8 +586,8 @@ package Rtsfind is
RO_RT_Delay_Until, -- Ada.Real_Time.Delays
RO_RT_To_Duration, -- Ada.Real_Time.Delays
- RE_Set_Handler, -- Ada_Real_Time.Timing_Events
- RE_Timing_Event, -- Ada_Real_Time.Timing_Events
+ RE_Set_Handler, -- Ada.Real_Time.Timing_Events
+ RE_Timing_Event, -- Ada.Real_Time.Timing_Events
RE_Root_Stream_Type, -- Ada.Streams
RE_Stream_Element, -- Ada.Streams
@@ -788,13 +789,13 @@ package Rtsfind is
RE_Bit_Or, -- System.Bit_Ops
RE_Bit_Xor, -- System.Bit_Ops
- RE_Vector_Not, -- System_Boolean_Array_Operations,
- RE_Vector_And, -- System_Boolean_Array_Operations,
- RE_Vector_Or, -- System_Boolean_Array_Operations,
- RE_Vector_Nand, -- System_Boolean_Array_Operations,
- RE_Vector_Nor, -- System_Boolean_Array_Operations,
- RE_Vector_Nxor, -- System_Boolean_Array_Operations,
- RE_Vector_Xor, -- System_Boolean_Array_Operations,
+ RE_Vector_Not, -- System.Boolean_Array_Operations,
+ RE_Vector_And, -- System.Boolean_Array_Operations,
+ RE_Vector_Or, -- System.Boolean_Array_Operations,
+ RE_Vector_Nand, -- System.Boolean_Array_Operations,
+ RE_Vector_Nor, -- System.Boolean_Array_Operations,
+ RE_Vector_Nxor, -- System.Boolean_Array_Operations,
+ RE_Vector_Xor, -- System.Boolean_Array_Operations,
RE_Bswap_16, -- System.Byte_Swapping
RE_Bswap_32, -- System.Byte_Swapping
@@ -940,7 +941,9 @@ package Rtsfind is
RE_Asm_Input_Operand, -- System.Machine_Code
RE_Asm_Output_Operand, -- System.Machine_Code
- RE_Mantissa_Value, -- System_Mantissa
+ RE_Mantissa_Value, -- System.Mantissa
+
+ RE_Free, -- System.Memory
RE_CPU_Range, -- System.Multiprocessors
@@ -1224,7 +1227,7 @@ package Rtsfind is
RE_Get_63, -- System.Pack_63
RE_Set_63, -- System.Pack_63
- RE_Adjust_Storage_Size, -- System_Parameters
+ RE_Adjust_Storage_Size, -- System.Parameters
RE_Default_Stack_Size, -- System.Parameters
RE_Garbage_Collected, -- System.Parameters
RE_Size_Type, -- System.Parameters
@@ -1689,7 +1692,7 @@ package Rtsfind is
RE_Width_Wide_Character, -- System.Wid_WChar
RE_Width_Wide_Wide_Character, -- System.Wid_WChar
- RE_Dispatching_Domain, -- Dispatching_Domains
+ RE_Dispatching_Domain, -- Multiprocessors.Dispatching_Domains
RE_Protected_Entry_Body_Array, -- Tasking.Protected_Objects.Entries
RE_Protected_Entry_Names_Array, -- Tasking.Protected_Objects.Entries
@@ -1777,7 +1780,7 @@ package Rtsfind is
RE_Complete_Task, -- System.Tasking.Stages
RE_Free_Task, -- System.Tasking.Stages
RE_Expunge_Unactivated_Tasks, -- System.Tasking.Stages
- RE_Move_Activation_Chain, -- System_Tasking_Stages
+ RE_Move_Activation_Chain, -- System.Tasking_Stages
RE_Terminated); -- System.Tasking.Stages
-- The following declarations build a table that is indexed by the RTE
@@ -2197,6 +2200,8 @@ package Rtsfind is
RE_Mantissa_Value => System_Mantissa,
+ RE_Free => System_Memory,
+
RE_CPU_Range => System_Multiprocessors,
RE_Bits_03 => System_Pack_03,
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index f5d12ed1c7b..ae58c9d2504 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -890,13 +890,8 @@ package body Sem_Attr is
procedure Check_Ada_2012_Attribute is
begin
- if Ada_Version < Ada_2012 then
- Error_Msg_Name_1 := Aname;
- Error_Msg_N
- ("attribute % is an Ada 2012 feature", N);
- Error_Msg_N
- ("\unit must be compiled with -gnat2012 switch", N);
- end if;
+ Error_Msg_Name_1 := Aname;
+ Error_Msg_Ada_2012_Feature ("attribute %", Sloc (N));
end Check_Ada_2012_Attribute;
--------------------------------
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 87d2ab3c259..6c36bf2cdb7 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -23,6 +23,7 @@
-- --
------------------------------------------------------------------------------
+with Aspects; use Aspects;
with Atree; use Atree;
with Debug; use Debug;
with Einfo; use Einfo;
@@ -1555,8 +1556,8 @@ package body Sem_Ch10 is
-------------------------------
procedure Analyze_Package_Body_Stub (N : Node_Id) is
- Id : constant Entity_Id := Defining_Identifier (N);
- Nam : Entity_Id;
+ Id : constant Entity_Id := Defining_Identifier (N);
+ Nam : Entity_Id;
begin
-- The package declaration must be in the current declarative part
@@ -1844,6 +1845,12 @@ package body Sem_Ch10 is
SCO_Record (Unum);
end if;
+ -- Propagate any aspect specifications associated with
+ -- with the stub to the proper body.
+
+ Move_Or_Merge_Aspects
+ (From => N, To => Proper_Body (Unit (Comp_Unit)));
+
-- Analyze the unit if semantics active
if not Fatal_Error (Unum) or else Try_Semantics then
@@ -2327,8 +2334,8 @@ package body Sem_Ch10 is
----------------------------
procedure Analyze_Task_Body_Stub (N : Node_Id) is
- Nam : Entity_Id := Current_Entity_In_Scope (Defining_Identifier (N));
Loc : constant Source_Ptr := Sloc (N);
+ Nam : Entity_Id := Current_Entity_In_Scope (Defining_Identifier (N));
begin
Check_Stub_Level (N);
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index b93d3858335..035d0b0bfda 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -76,6 +76,7 @@ with Table;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Urealp; use Urealp;
+with Warnsw; use Warnsw;
with GNAT.HTable;
@@ -3592,8 +3593,8 @@ package body Sem_Ch12 is
Append (Unit_Renaming, Renaming_List);
- -- The renaming declarations are the first local declarations of
- -- the new unit.
+ -- The renaming declarations are the first local declarations of the
+ -- new unit.
if Is_Non_Empty_List (Visible_Declarations (Act_Spec)) then
Insert_List_Before
@@ -3894,7 +3895,9 @@ package body Sem_Ch12 is
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
- Version => Ada_Version));
+ Version => Ada_Version,
+ Version_Pragma => Ada_Version_Pragma,
+ Warnings => Save_Warnings));
end if;
end if;
@@ -3940,6 +3943,15 @@ package body Sem_Ch12 is
Set_Unit (Parent (N), Act_Decl);
Set_Parent_Spec (Act_Decl, Parent_Spec (N));
Set_Package_Instantiation (Act_Decl_Id, N);
+
+ -- Process aspect specifications of the instance node, if any, to
+ -- take into account categorization pragmas before analyzing the
+ -- instance.
+
+ if Has_Aspects (N) then
+ Analyze_Aspect_Specifications (N, Act_Decl_Id);
+ end if;
+
Analyze (Act_Decl);
Set_Unit (Parent (N), N);
Set_Body_Required (Parent (N), False);
@@ -4043,7 +4055,7 @@ package body Sem_Ch12 is
end if;
<<Leave>>
- if Has_Aspects (N) then
+ if Has_Aspects (N) and then Nkind (Parent (N)) /= N_Compilation_Unit then
Analyze_Aspect_Specifications (N, Act_Decl_Id);
end if;
@@ -4229,7 +4241,9 @@ package body Sem_Ch12 is
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
- Version => Ada_Version)),
+ Version => Ada_Version,
+ Version_Pragma => Ada_Version_Pragma,
+ Warnings => Save_Warnings)),
Inlined_Body => True);
Pop_Scope;
@@ -4309,8 +4323,8 @@ package body Sem_Ch12 is
end loop;
end if;
- -- Restore status of instances. If one of them is a body, make
- -- its local entities visible again.
+ -- Restore status of instances. If one of them is a body, make its
+ -- local entities visible again.
declare
E : Entity_Id;
@@ -4345,7 +4359,9 @@ package body Sem_Ch12 is
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
- Version => Ada_Version)),
+ Version => Ada_Version,
+ Version_Pragma => Ada_Version_Pragma,
+ Warnings => Save_Warnings)),
Inlined_Body => True);
end if;
end Inline_Instance_Body;
@@ -4401,7 +4417,9 @@ package body Sem_Ch12 is
Current_Sem_Unit => Current_Sem_Unit,
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
- Version => Ada_Version));
+ Version => Ada_Version,
+ Version_Pragma => Ada_Version_Pragma,
+ Warnings => Save_Warnings));
return True;
-- Here if not inlined, or we ignore the inlining
@@ -4855,7 +4873,6 @@ package body Sem_Ch12 is
-- subsequent construction of the body.
if Need_Subprogram_Instance_Body (N, Act_Decl_Id) then
-
Check_Forward_Instantiation (Gen_Decl);
-- The wrapper package is always delayed, because it does not
@@ -9901,6 +9918,8 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top;
Scope_Suppress := Body_Info.Scope_Suppress;
Opt.Ada_Version := Body_Info.Version;
+ Opt.Ada_Version_Pragma := Body_Info.Version_Pragma;
+ Restore_Warnings (Body_Info.Warnings);
if No (Gen_Body_Id) then
Load_Parent_Of_Generic
@@ -10161,7 +10180,9 @@ package body Sem_Ch12 is
Unit_Renaming : Node_Id;
Parent_Installed : Boolean := False;
- Save_Style_Check : constant Boolean := Style_Check;
+
+ Saved_Style_Check : constant Boolean := Style_Check;
+ Saved_Warnings : constant Warning_Record := Save_Warnings;
Par_Ent : Entity_Id := Empty;
Par_Vis : Boolean := False;
@@ -10187,6 +10208,8 @@ package body Sem_Ch12 is
Local_Suppress_Stack_Top := Body_Info.Local_Suppress_Stack_Top;
Scope_Suppress := Body_Info.Scope_Suppress;
Opt.Ada_Version := Body_Info.Version;
+ Opt.Ada_Version_Pragma := Body_Info.Version_Pragma;
+ Restore_Warnings (Body_Info.Warnings);
if No (Gen_Body_Id) then
@@ -10366,7 +10389,8 @@ package body Sem_Ch12 is
end if;
Restore_Env;
- Style_Check := Save_Style_Check;
+ Style_Check := Saved_Style_Check;
+ Restore_Warnings (Saved_Warnings);
-- Body not found. Error was emitted already. If there were no previous
-- errors, this may be an instance whose scope is a premature instance.
@@ -10917,9 +10941,7 @@ package body Sem_Ch12 is
-- Ada 2005 (AI-251)
- if Ada_Version >= Ada_2005
- and then Is_Interface (Ancestor)
- then
+ if Ada_Version >= Ada_2005 and then Is_Interface (Ancestor) then
if not Interface_Present_In_Ancestor (Act_T, Ancestor) then
Error_Msg_NE
("(Ada 2005) expected type implementing & in instantiation",
@@ -11849,7 +11871,8 @@ package body Sem_Ch12 is
Body_Optional : Boolean := False)
is
Comp_Unit : constant Node_Id := Cunit (Get_Source_Unit (Spec));
- Save_Style_Check : constant Boolean := Style_Check;
+ Saved_Style_Check : constant Boolean := Style_Check;
+ Saved_Warnings : constant Warning_Record := Save_Warnings;
True_Parent : Node_Id;
Inst_Node : Node_Id;
OK : Boolean;
@@ -12083,7 +12106,9 @@ package body Sem_Ch12 is
Scope_Suppress => Scope_Suppress,
Local_Suppress_Stack_Top =>
Local_Suppress_Stack_Top,
- Version => Ada_Version);
+ Version => Ada_Version,
+ Version_Pragma => Ada_Version_Pragma,
+ Warnings => Save_Warnings);
-- Package instance
@@ -12119,12 +12144,13 @@ package body Sem_Ch12 is
((Inst_Node => Inst_Node,
Act_Decl => True_Parent,
Expander_Status => Exp_Status,
- Current_Sem_Unit =>
- Get_Code_Unit (Sloc (Inst_Node)),
+ Current_Sem_Unit => Get_Code_Unit
+ (Sloc (Inst_Node)),
Scope_Suppress => Scope_Suppress,
- Local_Suppress_Stack_Top =>
- Local_Suppress_Stack_Top,
- Version => Ada_Version)),
+ Local_Suppress_Stack_Top => Local_Suppress_Stack_Top,
+ Version => Ada_Version,
+ Version_Pragma => Ada_Version_Pragma,
+ Warnings => Save_Warnings)),
Body_Optional => Body_Optional);
end;
end if;
@@ -12135,7 +12161,8 @@ package body Sem_Ch12 is
Opt.Style_Check := False;
Expander_Mode_Save_And_Set (True);
Load_Needed_Body (Comp_Unit, OK);
- Opt.Style_Check := Save_Style_Check;
+ Opt.Style_Check := Saved_Style_Check;
+ Restore_Warnings (Saved_Warnings);
Expander_Mode_Restore;
if not OK
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 37fd72253d6..37b9e9a82b9 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -694,6 +694,29 @@ package body Sem_Ch13 is
-- This routine analyzes an Aspect_Default_[Component_]Value denoted by
-- the aspect specification node ASN.
+ procedure Inherit_Delayed_Rep_Aspects (ASN : Node_Id);
+ -- As discussed in the spec of Aspects (see Aspect_Delay declaration),
+ -- a derived type can inherit aspects from its parent which have been
+ -- specified at the time of the derivation using an aspect, as in:
+ --
+ -- type A is range 1 .. 10
+ -- with Size => Not_Defined_Yet;
+ -- ..
+ -- type B is new A;
+ -- ..
+ -- Not_Defined_Yet : constant := 64;
+ --
+ -- In this example, the Size of A is considered to be specified prior
+ -- to the derivation, and thus inherited, even though the value is not
+ -- known at the time of derivation. To deal with this, we use two entity
+ -- flags. The flag Has_Derived_Rep_Aspects is set in the parent type (A
+ -- here), and then the flag May_Inherit_Delayed_Rep_Aspects is set in
+ -- the derived type (B here). If this flag is set when the derived type
+ -- is frozen, then this procedure is called to ensure proper inheritance
+ -- of all delayed aspects from the parent type. The derived type is E,
+ -- the argument to Analyze_Aspects_At_Freeze_Point. ASN is the first
+ -- aspect specification node in the Rep_Item chain for the parent type.
+
procedure Make_Pragma_From_Boolean_Aspect (ASN : Node_Id);
-- Given an aspect specification node ASN whose expression is an
-- optional Boolean, this routines creates the corresponding pragma
@@ -753,6 +776,181 @@ package body Sem_Ch13 is
end if;
end Analyze_Aspect_Default_Value;
+ ---------------------------------
+ -- Inherit_Delayed_Rep_Aspects --
+ ---------------------------------
+
+ procedure Inherit_Delayed_Rep_Aspects (ASN : Node_Id) is
+ P : constant Entity_Id := Entity (ASN);
+ -- Entithy for parent type
+
+ N : Node_Id;
+ -- Item from Rep_Item chain
+
+ A : Aspect_Id;
+
+ begin
+ -- Loop through delayed aspects for the parent type
+
+ N := ASN;
+ while Present (N) loop
+ if Nkind (N) = N_Aspect_Specification then
+ exit when Entity (N) /= P;
+
+ if Is_Delayed_Aspect (N) then
+ A := Get_Aspect_Id (Chars (Identifier (N)));
+
+ -- Process delayed rep aspect. For Boolean attributes it is
+ -- not possible to cancel an attribute once set (the attempt
+ -- to use an aspect with xxx => False is an error) for a
+ -- derived type. So for those cases, we do not have to check
+ -- if a clause has been given for the derived type, since it
+ -- is harmless to set it again if it is already set.
+
+ case A is
+
+ -- Alignment
+
+ when Aspect_Alignment =>
+ if not Has_Alignment_Clause (E) then
+ Set_Alignment (E, Alignment (P));
+ end if;
+
+ -- Atomic
+
+ when Aspect_Atomic =>
+ if Is_Atomic (P) then
+ Set_Is_Atomic (E);
+ end if;
+
+ -- Atomic_Components
+
+ when Aspect_Atomic_Components =>
+ if Has_Atomic_Components (P) then
+ Set_Has_Atomic_Components (Base_Type (E));
+ end if;
+
+ -- Bit_Order
+
+ when Aspect_Bit_Order =>
+ if Is_Record_Type (E)
+ and then No (Get_Attribute_Definition_Clause
+ (E, Attribute_Bit_Order))
+ and then Reverse_Bit_Order (P)
+ then
+ Set_Reverse_Bit_Order (Base_Type (E));
+ end if;
+
+ -- Component_Size
+
+ when Aspect_Component_Size =>
+ if Is_Array_Type (E)
+ and then not Has_Component_Size_Clause (E)
+ then
+ Set_Component_Size
+ (Base_Type (E), Component_Size (P));
+ end if;
+
+ -- Machine_Radix
+
+ when Aspect_Machine_Radix =>
+ if Is_Decimal_Fixed_Point_Type (E)
+ and then not Has_Machine_Radix_Clause (E)
+ then
+ Set_Machine_Radix_10 (E, Machine_Radix_10 (P));
+ end if;
+
+ -- Object_Size (also Size which also sets Object_Size)
+
+ when Aspect_Object_Size | Aspect_Size =>
+ if not Has_Size_Clause (E)
+ and then
+ No (Get_Attribute_Definition_Clause
+ (E, Attribute_Object_Size))
+ then
+ Set_Esize (E, Esize (P));
+ end if;
+
+ -- Pack
+
+ when Aspect_Pack =>
+ if not Is_Packed (E) then
+ Set_Is_Packed (Base_Type (E));
+
+ if Is_Bit_Packed_Array (P) then
+ Set_Is_Bit_Packed_Array (Base_Type (E));
+ Set_Packed_Array_Type (E, Packed_Array_Type (P));
+ end if;
+ end if;
+
+ -- Scalar_Storage_Order
+
+ when Aspect_Scalar_Storage_Order =>
+ if (Is_Record_Type (E) or else Is_Array_Type (E))
+ and then No (Get_Attribute_Definition_Clause
+ (E, Attribute_Scalar_Storage_Order))
+ and then Reverse_Storage_Order (P)
+ then
+ Set_Reverse_Storage_Order (Base_Type (E));
+ end if;
+
+ -- Small
+
+ when Aspect_Small =>
+ if Is_Fixed_Point_Type (E)
+ and then not Has_Small_Clause (E)
+ then
+ Set_Small_Value (E, Small_Value (P));
+ end if;
+
+ -- Storage_Size
+
+ when Aspect_Storage_Size =>
+ if (Is_Access_Type (E) or else Is_Task_Type (E))
+ and then not Has_Storage_Size_Clause (E)
+ then
+ Set_Storage_Size_Variable
+ (Base_Type (E), Storage_Size_Variable (P));
+ end if;
+
+ -- Value_Size
+
+ when Aspect_Value_Size =>
+
+ -- Value_Size is never inherited, it is either set by
+ -- default, or it is explicitly set for the derived
+ -- type. So nothing to do here.
+
+ null;
+
+ -- Volatile
+
+ when Aspect_Volatile =>
+ if Is_Volatile (P) then
+ Set_Is_Volatile (E);
+ end if;
+
+ -- Volatile_Components
+
+ when Aspect_Volatile_Components =>
+ if Has_Volatile_Components (P) then
+ Set_Has_Volatile_Components (Base_Type (E));
+ end if;
+
+ -- That should be all the Rep Aspects
+
+ when others =>
+ pragma Assert (Aspect_Delay (A_Id) /= Rep_Aspect);
+ null;
+
+ end case;
+ end if;
+ end if;
+
+ N := Next_Rep_Item (N);
+ end loop;
+ end Inherit_Delayed_Rep_Aspects;
+
-------------------------------------
-- Make_Pragma_From_Boolean_Aspect --
-------------------------------------
@@ -831,15 +1029,18 @@ package body Sem_Ch13 is
-- Fall through means we are canceling an inherited aspect
Error_Msg_Name_1 := A_Name;
- Error_Msg_NE ("derived type& inherits aspect%, cannot cancel",
- Expr,
- E);
+ Error_Msg_NE
+ ("derived type& inherits aspect%, cannot cancel", Expr, E);
end Check_False_Aspect_For_Derived_Type;
-- Start of processing for Make_Pragma_From_Boolean_Aspect
begin
+ -- Note that we know Expr is present, because for a missing Expr
+ -- argument, we knew it was True and did not need to delay the
+ -- evaluation to the freeze point.
+
if Is_False (Static_Boolean (Expr)) then
Check_False_Aspect_For_Derived_Type;
@@ -874,30 +1075,30 @@ package body Sem_Ch13 is
ASN := First_Rep_Item (E);
while Present (ASN) loop
- if Nkind (ASN) = N_Aspect_Specification
- and then Entity (ASN) = E
- and then Is_Delayed_Aspect (ASN)
- then
- A_Id := Get_Aspect_Id (ASN);
+ if Nkind (ASN) = N_Aspect_Specification then
+ exit when Entity (ASN) /= E;
- case A_Id is
+ if Is_Delayed_Aspect (ASN) then
+ A_Id := Get_Aspect_Id (ASN);
- -- For aspects whose expression is an optional Boolean, make
- -- the corresponding pragma at the freezing point.
+ case A_Id is
+
+ -- For aspects whose expression is an optional Boolean, make
+ -- the corresponding pragma at the freezing point.
when Boolean_Aspects |
Library_Unit_Aspects =>
Make_Pragma_From_Boolean_Aspect (ASN);
- -- Special handling for aspects that don't correspond to
- -- pragmas/attributes.
+ -- Special handling for aspects that don't correspond to
+ -- pragmas/attributes.
when Aspect_Default_Value |
Aspect_Default_Component_Value =>
Analyze_Aspect_Default_Value (ASN);
- -- Ditto for iterator aspects, because the corresponding
- -- attributes may not have been analyzed yet.
+ -- Ditto for iterator aspects, because the corresponding
+ -- attributes may not have been analyzed yet.
when Aspect_Constant_Indexing |
Aspect_Variable_Indexing |
@@ -907,17 +1108,27 @@ package body Sem_Ch13 is
when others =>
null;
- end case;
+ end case;
- Ritem := Aspect_Rep_Item (ASN);
+ Ritem := Aspect_Rep_Item (ASN);
- if Present (Ritem) then
- Analyze (Ritem);
+ if Present (Ritem) then
+ Analyze (Ritem);
+ end if;
end if;
end if;
Next_Rep_Item (ASN);
end loop;
+
+ -- This is where we inherit delayed rep aspects from our parent. Note
+ -- that if we fell out of the above loop with ASN non-empty, it means
+ -- we hit an aspect for an entity other than E, and it must be the
+ -- type from which we were derived.
+
+ if May_Inherit_Delayed_Rep_Aspects (E) then
+ Inherit_Delayed_Rep_Aspects (ASN);
+ end if;
end Analyze_Aspects_At_Freeze_Point;
-----------------------------------
@@ -1046,7 +1257,7 @@ package body Sem_Ch13 is
A_Id : constant Aspect_Id := Get_Aspect_Id (Nam);
Anod : Node_Id;
- Delay_Required : Boolean := True;
+ Delay_Required : Boolean;
-- Set False if delay is not required
Eloc : Source_Ptr := No_Location;
@@ -1146,17 +1357,26 @@ package body Sem_Ch13 is
(Pragma_Argument_Associations : List_Id;
Pragma_Name : Name_Id)
is
+ Args : List_Id := Pragma_Argument_Associations;
+
begin
-- We should never get here if aspect was disabled
pragma Assert (not Is_Disabled (Aspect));
+ -- Certan aspects allow for an optional name or expression. Do
+ -- not generate a pragma with an empty argument association
+ -- list.
+
+ if No (Args) or else No (Expression (First (Args))) then
+ Args := No_List;
+ end if;
+
-- Build the pragma
Aitem :=
Make_Pragma (Loc,
- Pragma_Argument_Associations =>
- Pragma_Argument_Associations,
+ Pragma_Argument_Associations => Args,
Pragma_Identifier =>
Make_Identifier (Sloc (Id), Pragma_Name),
Class_Present => Class_Present (Aspect),
@@ -1166,6 +1386,8 @@ package body Sem_Ch13 is
if Is_Ignored (Aspect) then
Set_Is_Ignored (Aitem);
+ elsif Is_Checked (Aspect) then
+ Set_Is_Checked (Aitem);
end if;
Set_Corresponding_Aspect (Aitem, Aspect);
@@ -1183,7 +1405,7 @@ package body Sem_Ch13 is
-- Skip looking at aspect if it is totally disabled. Just mark
-- it as such for later reference in the tree. This also sets
- -- the Is_Ignored flag appropriately.
+ -- the Is_Ignored and Is_Checked flags appropriately.
Check_Applicable_Policy (Aspect);
@@ -1279,6 +1501,31 @@ package body Sem_Ch13 is
Set_Entity (Id, New_Copy_Tree (Expr));
+ -- Set Delay_Required as appropriate to aspect
+
+ case Aspect_Delay (A_Id) is
+ when Always_Delay =>
+ Delay_Required := True;
+
+ when Never_Delay =>
+ Delay_Required := False;
+
+ when Rep_Aspect =>
+
+ -- If expression has the form of an integer literal, then
+ -- do not delay, since we know the value cannot change.
+ -- This optimization catches most rep clause cases.
+
+ if (Present (Expr) and then Nkind (Expr) = N_Integer_Literal)
+ or else (A_Id in Boolean_Aspects and then No (Expr))
+ then
+ Delay_Required := False;
+ else
+ Delay_Required := True;
+ Set_Has_Delayed_Rep_Aspects (E);
+ end if;
+ end case;
+
-- Processing based on specific aspect
case A_Id is
@@ -1318,7 +1565,8 @@ package body Sem_Ch13 is
-- Indexing aspects apply only to tagged type
if (A_Id = Aspect_Constant_Indexing
- or else A_Id = Aspect_Variable_Indexing)
+ or else
+ A_Id = Aspect_Variable_Indexing)
and then not (Is_Type (E)
and then Is_Tagged_Type (E))
then
@@ -1378,12 +1626,6 @@ package body Sem_Ch13 is
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Implemented);
- -- No delay is required since the only values are: By_Entry
- -- | By_Protected_Procedure | By_Any | Optional which don't
- -- get analyzed anyway.
-
- Delay_Required := False;
-
-- Attach Handler
when Aspect_Attach_Handler =>
@@ -1518,11 +1760,6 @@ package body Sem_Ch13 is
Make_Aitem_Pragma
(Pragma_Argument_Associations => Arg_List,
Pragma_Name => P_Name);
-
- -- Convention is a static name, and must be associated
- -- with the entity at once.
-
- Delay_Required := False;
end;
-- CPU, Interrupt_Priority, Priority
@@ -1553,7 +1790,6 @@ package body Sem_Ch13 is
-- Warnings
when Aspect_Warnings =>
-
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Expr),
@@ -1562,11 +1798,6 @@ package body Sem_Ch13 is
Expression => New_Occurrence_Of (E, Loc))),
Pragma_Name => Chars (Id));
- -- We don't have to play the delay game here, since the only
- -- values are ON/OFF which don't get analyzed anyway.
-
- Delay_Required := False;
-
-- Case 2c: Aspects corresponding to pragmas with three
-- arguments.
@@ -1620,7 +1851,6 @@ package body Sem_Ch13 is
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_Abstract_State);
- Delay_Required := False;
-- Depends
@@ -1666,7 +1896,6 @@ package body Sem_Ch13 is
Make_Pragma_Argument_Association (Loc,
Expression => Relocate_Node (Expr))),
Pragma_Name => Name_SPARK_Mode);
- Delay_Required := False;
-- Relative_Deadline
@@ -1910,8 +2139,6 @@ package body Sem_Ch13 is
Make_Aitem_Pragma
(Pragma_Argument_Associations => Args,
Pragma_Name => Nam);
-
- Delay_Required := False;
end Test_Case;
-- Contract_Cases
@@ -1950,9 +2177,9 @@ package body Sem_Ch13 is
else
-- Set the Uses_Lock_Free flag to True if there is no
- -- expression or if the expression is True. ??? The
+ -- expression or if the expression is True. The
-- evaluation of this aspect should be delayed to the
- -- freeze point.
+ -- freeze point (why???)
if No (Expr)
or else Is_True (Static_Boolean (Expr))
@@ -1984,17 +2211,17 @@ package body Sem_Ch13 is
if No (A) then
Error_Msg_N
("missing Convention aspect for Export/Import",
- Aspect);
+ Aspect);
end if;
end;
goto Continue;
end if;
- -- This requires special handling in the case of a package
- -- declaration, the pragma needs to be inserted in the list
- -- of declarations for the associated package. There is no
- -- issue of visibility delay for these aspects.
+ -- Library unit aspects require special handling in the case
+ -- of a package declaration, the pragma needs to be inserted
+ -- in the list of declarations for the associated package.
+ -- There is no issue of visibility delay for these aspects.
if A_Id in Library_Unit_Aspects
and then
@@ -2007,22 +2234,20 @@ package body Sem_Ch13 is
goto Continue;
end if;
- -- Special handling when the aspect has no expression. In
- -- this case the value is considered to be True. Thus, we
- -- simply insert the pragma, no delay is required.
+ -- Cases where we do not delay, includes all cases where
+ -- the expression is missing other than the above cases.
- if No (Expr) then
+ if not Delay_Required or else No (Expr) then
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
Expression => Ent)),
Pragma_Name => Chars (Id));
-
Delay_Required := False;
-- In general cases, the corresponding pragma/attribute
-- definition clause will be inserted later at the freezing
- -- point.
+ -- point, and we do not need to build it now
else
Aitem := Empty;
@@ -2112,7 +2337,8 @@ package body Sem_Ch13 is
-- node (no delay is required here) except for aspects on a
-- subprogram body (see below) and a generic package, for which
-- we need to introduce the pragma before building the generic
- -- copy (see sem_ch12).
+ -- copy (see sem_ch12), and for package instantiations, where
+ -- the library unit pragmas are better handled early.
elsif Nkind (Parent (N)) = N_Compilation_Unit
and then (Present (Aitem) or else Is_Boolean_Aspect (Aspect))
@@ -2161,6 +2387,18 @@ package body Sem_Ch13 is
Prepend (Aitem,
Visible_Declarations (Specification (N)));
+ elsif Nkind (N) = N_Package_Instantiation then
+ declare
+ Spec : constant Node_Id :=
+ Specification (Instance_Spec (N));
+ begin
+ if No (Visible_Declarations (Spec)) then
+ Set_Visible_Declarations (Spec, New_List);
+ end if;
+
+ Prepend (Aitem, Visible_Declarations (Spec));
+ end;
+
else
if No (Pragmas_After (Aux)) then
Set_Pragmas_After (Aux, New_List);
@@ -2175,8 +2413,7 @@ package body Sem_Ch13 is
-- The evaluation of the aspect is delayed to the freezing point.
-- The pragma or attribute clause if there is one is then attached
- -- to the aspect specification which is placed in the rep item
- -- list.
+ -- to the aspect specification which is put in the rep item list.
if Delay_Required then
if Present (Aitem) then
@@ -2205,6 +2442,18 @@ package body Sem_Ch13 is
Set_Has_Delayed_Aspects (E);
Record_Rep_Item (E, Aspect);
+ -- When delay is not required and the context is a package or a
+ -- subprogram body, insert the pragma in the body declarations.
+
+ elsif Nkind_In (N, N_Package_Body, N_Subprogram_Body) then
+ if No (Declarations (N)) then
+ Set_Declarations (N, New_List);
+ end if;
+
+ -- The pragma is added before source declarations
+
+ Prepend_To (Declarations (N), Aitem);
+
-- When delay is not required and the context is not a compilation
-- unit, we simply insert the pragma/attribute definition clause
-- in sequence.
@@ -7327,6 +7576,7 @@ package body Sem_Ch13 is
when Boolean_Aspects |
Library_Unit_Aspects =>
+
T := Standard_Boolean;
-- Aspects corresponding to attribute definition clauses
@@ -8712,6 +8962,7 @@ package body Sem_Ch13 is
-------------------------------------
procedure Inherit_Aspects_At_Freeze_Point (Typ : Entity_Id) is
+
function Is_Pragma_Or_Corr_Pragma_Present_In_Rep_Item
(Rep_Item : Node_Id) return Boolean;
-- This routine checks if Rep_Item is either a pragma or an aspect
diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads
index 611f3f1c617..0d95174c14a 100644
--- a/gcc/ada/sem_ch13.ads
+++ b/gcc/ada/sem_ch13.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -305,10 +305,12 @@ package Sem_Ch13 is
-- in these two expressions are the same, by seeing if the two expressions
-- are fully conformant, and if not, issue appropriate error messages.
- -- Quite an awkward procedure, but this is an awkard requirement!
+ -- Quite an awkward approach, but this is an awkard requirement!
procedure Analyze_Aspects_At_Freeze_Point (E : Entity_Id);
- -- Analyze all the delayed aspects for entity E at freezing point
+ -- Analyze all the delayed aspects for entity E at freezing point. This
+ -- includes dealing with inheriting delayed aspects from the parent type
+ -- in the case where a derived type is frozen.
procedure Check_Aspect_At_Freeze_Point (ASN : Node_Id);
-- Performs the processing described above at the freeze point, ASN is the
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index f07f083463a..ea41423b46f 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -169,15 +169,15 @@ package body Sem_Ch3 is
Parent_Type : Entity_Id;
Derived_Type : Entity_Id;
Derive_Subps : Boolean := True);
- -- Subsidiary procedure for Build_Derived_Type and
- -- Analyze_Private_Extension_Declaration used for tagged and untagged
- -- record types. All parameters are as in Build_Derived_Type except that
- -- N, in addition to being an N_Full_Type_Declaration node, can also be an
+ -- Subsidiary procedure used for tagged and untagged record types
+ -- by Build_Derived_Type and Analyze_Private_Extension_Declaration.
+ -- All parameters are as in Build_Derived_Type except that N, in
+ -- addition to being an N_Full_Type_Declaration node, can also be an
-- N_Private_Extension_Declaration node. See the definition of this routine
- -- for much more info. Derive_Subps indicates whether subprograms should
- -- be derived from the parent type. The only case where Derive_Subps is
- -- False is for an implicit derived full type for a type derived from a
- -- private type (see Build_Derived_Type).
+ -- for much more info. Derive_Subps indicates whether subprograms should be
+ -- derived from the parent type. The only case where Derive_Subps is False
+ -- is for an implicit derived full type for a type derived from a private
+ -- type (see Build_Derived_Type).
procedure Build_Discriminal (Discrim : Entity_Id);
-- Create the discriminal corresponding to discriminant Discrim, that is
@@ -1256,6 +1256,11 @@ package body Sem_Ch3 is
end loop;
end if;
+ -- Check whether an indirect call without actuals may be possible. This
+ -- is used when resolving calls whose result is then indexed.
+
+ May_Need_Actuals (Desig_Type);
+
-- If the return type is incomplete, this is legal as long as the type
-- is declared in the current scope and will be completed in it (rather
-- than being part of limited view).
@@ -5087,11 +5092,25 @@ package body Sem_Ch3 is
Process_Formals (Parameter_Specifications (Spec), Spec);
if Nkind (Spec) = N_Access_Function_Definition then
- if Nkind (Result_Definition (Spec)) = N_Access_Definition then
- Find_Type (Subtype_Mark (Result_Definition (Spec)));
- else
- Find_Type (Result_Definition (Spec));
- end if;
+ declare
+ Def : constant Node_Id := Result_Definition (Spec);
+
+ begin
+ -- The result might itself be an anonymous access type, so
+ -- have to recurse.
+
+ if Nkind (Def) = N_Access_Definition then
+ if Present (Access_To_Subprogram_Definition (Def)) then
+ Set_Etype (Def,
+ Replace_Anonymous_Access_To_Protected_Subprogram
+ (Spec));
+ else
+ Find_Type (Subtype_Mark (Def));
+ end if;
+ else
+ Find_Type (Def);
+ end if;
+ end;
end if;
End_Scope;
@@ -6102,13 +6121,18 @@ package body Sem_Ch3 is
-- affect anything, but it is still baffling that we cannot use the
-- same mechanism for all derived numeric types.
- -- There is a further complication: actually *some* representation
- -- clauses can affect the implicit base type. Namely, attribute
+ -- There is a further complication: actually some representation
+ -- clauses can affect the implicit base type. For example, attribute
-- definition clauses for stream-oriented attributes need to set the
- -- corresponding TSS entries on the base type, and this normally cannot
- -- be done after the base type is frozen, so the circuitry in
- -- Sem_Ch13.New_Stream_Subprogram must account for this possibility and
- -- not use Set_TSS in this case.
+ -- corresponding TSS entries on the base type, and this normally
+ -- cannot be done after the base type is frozen, so the circuitry in
+ -- Sem_Ch13.New_Stream_Subprogram must account for this possibility
+ -- and not use Set_TSS in this case.
+
+ -- There are also consequences for the case of delayed representation
+ -- aspects for some cases. For example, a Size aspect is delayed and
+ -- should not be evaluated to the freeze point. This early freezing
+ -- means that the size attribute evaluation happens too early???
if Is_Fixed_Point_Type (Parent_Type) then
Conditional_Delay (Implicit_Base, Parent_Type);
@@ -8179,6 +8203,15 @@ package body Sem_Ch3 is
Set_First_Rep_Item (Derived_Type, First_Rep_Item (Parent_Type));
end if;
+ -- If the parent type has delayed rep aspects, then mark the derived
+ -- type as possibly inheriting a delayed rep aspect.
+
+ if Has_Delayed_Rep_Aspects (Parent_Type) then
+ Set_May_Inherit_Delayed_Rep_Aspects (Derived_Type);
+ end if;
+
+ -- Type dependent processing
+
case Ekind (Parent_Type) is
when Numeric_Kind =>
Build_Derived_Numeric_Type (N, Parent_Type, Derived_Type);
@@ -8221,6 +8254,8 @@ package body Sem_Ch3 is
raise Program_Error;
end case;
+ -- Nothing more to do if some error occurred
+
if Etype (Derived_Type) = Any_Type then
return;
end if;
@@ -8230,6 +8265,7 @@ package body Sem_Ch3 is
-- if necessary.
Set_Has_Delayed_Freeze (Derived_Type);
+
if Derive_Subps then
Derive_Subprograms (Parent_Type, Derived_Type);
end if;
@@ -19021,6 +19057,27 @@ package body Sem_Ch3 is
case Ekind (Base_Type (Subtype_Mark_Id)) is
when Access_Kind =>
+
+ -- If this is a constraint on a class-wide type, discard it.
+ -- There is currently no way to express a partial discriminant
+ -- constraint on a type with unknown discriminants. This is
+ -- a pathology that the ACATS wisely decides not to test.
+
+ if Is_Class_Wide_Type (Designated_Type (Subtype_Mark_Id)) then
+ if Comes_From_Source (S) then
+ Error_Msg_N
+ ("constraint on class-wide type ignored?",
+ Constraint (S));
+ end if;
+
+ if Nkind (P) = N_Subtype_Declaration then
+ Set_Subtype_Indication (P,
+ New_Occurrence_Of (Subtype_Mark_Id, Sloc (S)));
+ end if;
+
+ return Subtype_Mark_Id;
+ end if;
+
Constrain_Access (Def_Id, S, Related_Nod);
if Expander_Active
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index a03c46552be..c4247cd403d 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -1037,6 +1037,9 @@ package body Sem_Ch4 is
-- function that returns a pointer_to_procedure which is the entity
-- being called. Finally, F (X) may be a call to a parameterless
-- function that returns a pointer to a function with parameters.
+ -- Note that if F returns an access-to-subprogram whose designated
+ -- type is an array, F (X) cannot be interpreted as an indirect call
+ -- through the result of the call to F.
elsif Is_Access_Type (Etype (Nam))
and then Ekind (Designated_Type (Etype (Nam))) = E_Subprogram_Type
@@ -1047,6 +1050,8 @@ package body Sem_Ch4 is
(Nkind (Parent (N)) /= N_Explicit_Dereference
and then Is_Entity_Name (Nam)
and then No (First_Formal (Entity (Nam)))
+ and then not
+ Is_Array_Type (Etype (Designated_Type (Etype (Nam))))
and then Present (Actuals)))
then
Nam_Ent := Designated_Type (Etype (Nam));
@@ -2998,7 +3003,9 @@ package body Sem_Ch4 is
return;
end if;
- -- An indexing requires at least one actual
+ -- An indexing requires at least one actual. The name of the call cannot
+ -- be an implicit indirect call, so it cannot be a generated explicit
+ -- dereference.
if not Is_Empty_List (Actuals)
and then
@@ -3007,7 +3014,11 @@ package body Sem_Ch4 is
(Needs_One_Actual (Nam)
and then Present (Next_Actual (First (Actuals)))))
then
- if Is_Array_Type (Subp_Type) then
+ if Is_Array_Type (Subp_Type)
+ and then
+ (Nkind (Name (N)) /= N_Explicit_Dereference
+ or else Comes_From_Source (Name (N)))
+ then
Is_Indexed := Try_Indexed_Call (N, Nam, Subp_Type, Must_Skip);
elsif Is_Access_Type (Subp_Type)
@@ -3046,9 +3057,14 @@ package body Sem_Ch4 is
if not Norm_OK then
-- If an indirect call is a possible interpretation, indicate
- -- success to the caller.
+ -- success to the caller. This may be an indexing of an explicit
+ -- dereference of a call that returns an access type (see above).
- if Is_Indirect then
+ if Is_Indirect
+ or else (Is_Indexed
+ and then Nkind (Name (N)) = N_Explicit_Dereference
+ and then Comes_From_Source (Name (N)))
+ then
Success := True;
return;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 57712d83d9c..7913d362f1e 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -23,6 +23,7 @@
-- --
------------------------------------------------------------------------------
+with Aspects; use Aspects;
with Atree; use Atree;
with Checks; use Checks;
with Debug; use Debug;
@@ -211,10 +212,6 @@ package body Sem_Ch6 is
-- Create the declaration for an inequality operator that is implicitly
-- created by a user-defined equality operator that yields a boolean.
- procedure May_Need_Actuals (Fun : Entity_Id);
- -- Flag functions that can be called without parameters, i.e. those that
- -- have no parameters, or those for which defaults exist for all parameters
-
procedure Process_PPCs
(N : Node_Id;
Spec_Id : Entity_Id;
@@ -2675,12 +2672,17 @@ package body Sem_Ch6 is
end if;
end if;
- -- Ada 2012 aspects may appear in a subprogram body, but only if there
- -- is no previous spec. Ditto for a subprogram stub that does not have
- -- a corresponding spec, but for which there may also be a spec_id.
+ -- Language-defined aspects cannot appear in a subprogram body if the
+ -- corresponding spec already has aspects. Exception to this rule are
+ -- certain user-defined aspects. Aspects that apply to a body stub are
+ -- moved to the proper body. Do not emit an error in this case.
if Has_Aspects (N) then
- if Present (Spec_Id) then
+ if Present (Spec_Id)
+ and then Nkind (N) not in N_Body_Stub
+ and then Nkind (Parent (N)) /= N_Subunit
+ and then not Aspects_On_Body_OK (N)
+ then
Error_Msg_N
("aspect specifications must appear in subprogram declaration",
N);
diff --git a/gcc/ada/sem_ch6.ads b/gcc/ada/sem_ch6.ads
index 0799adc1849..d967c017ae0 100644
--- a/gcc/ada/sem_ch6.ads
+++ b/gcc/ada/sem_ch6.ads
@@ -234,6 +234,13 @@ package Sem_Ch6 is
-- E is the entity for a subprogram or generic subprogram spec. This call
-- lists all inherited Pre/Post aspects if List_Inherited_Pre_Post is True.
+ procedure May_Need_Actuals (Fun : Entity_Id);
+ -- Flag functions that can be called without parameters, i.e. those that
+ -- have no parameters, or those for which defaults exist for all parameters
+ -- Used for subprogram declarations and for access subprogram declarations,
+ -- where they apply to the anonymous designated type. On return the flag
+ -- Set_Needs_No_Actuals is set appropriately in Fun.
+
function Mode_Conformant (New_Id, Old_Id : Entity_Id) return Boolean;
-- Determine whether two callable entities (subprograms, entries,
-- literals) are mode conformant (RM 6.3.1(15))
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 505fe9d9916..e06b6b997cf 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -219,11 +219,15 @@ package body Sem_Ch7 is
-- the later is never used for name resolution. In this fashion there
-- is only one visible entity that denotes the package.
- -- Set Body_Id. Note that this Will be reset to point to the generic
+ -- Set Body_Id. Note that this will be reset to point to the generic
-- copy later on in the generic case.
Body_Id := Defining_Entity (N);
+ if Has_Aspects (N) then
+ Analyze_Aspect_Specifications (N, Body_Id);
+ end if;
+
if Present (Corresponding_Spec (N)) then
-- Body is body of package instantiation. Corresponding spec has
@@ -766,7 +770,7 @@ package body Sem_Ch7 is
-- True when this package declaration is not a nested declaration
begin
- -- Analye aspect specifications immediately, since we need to recognize
+ -- Analyze aspect specifications immediately, since we need to recognize
-- things like Pure early enough to diagnose violations during analysis.
if Has_Aspects (N) then
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 27ccc2d3d1e..1e6470bf223 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -1773,6 +1773,7 @@ package body Sem_Ch8 is
Old_S : Entity_Id := Empty;
Rename_Spec : Entity_Id;
Save_AV : constant Ada_Version_Type := Ada_Version;
+ Save_AVP : constant Node_Id := Ada_Version_Pragma;
Save_AV_Exp : constant Ada_Version_Type := Ada_Version_Explicit;
Spec : constant Node_Id := Specification (N);
@@ -2582,6 +2583,7 @@ package body Sem_Ch8 is
-- ???
Ada_Version := Ada_Version_Type'Max (Ada_Version, Ada_95);
+ Ada_Version_Pragma := Empty;
Ada_Version_Explicit := Ada_Version;
if No (Old_S) then
@@ -3039,6 +3041,7 @@ package body Sem_Ch8 is
end if;
Ada_Version := Save_AV;
+ Ada_Version_Pragma := Save_AVP;
Ada_Version_Explicit := Save_AV_Exp;
end Analyze_Subprogram_Renaming;
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index 41b4d9ccb2a..52dcb90d184 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -1734,6 +1734,22 @@ package body Sem_Ch9 is
Set_Ekind (Body_Id, E_Protected_Body);
Spec_Id := Find_Concurrent_Spec (Body_Id);
+ -- Protected bodies are currently removed by the expander. Since there
+ -- are no language-defined aspects that apply to a protected body, it is
+ -- not worth changing the whole expansion to accomodate user-defined
+ -- aspects. Plus we cannot possibly known the semantics of user-defined
+ -- aspects in order to plan ahead.
+
+ if Has_Aspects (N) then
+ Error_Msg_N
+ ("?user-defined aspects on protected bodies are not supported", N);
+
+ -- The aspects are removed for now to prevent cascading errors down
+ -- stream.
+
+ Remove_Aspects (N);
+ end if;
+
if Present (Spec_Id)
and then Ekind (Spec_Id) = E_Protected_Type
then
@@ -2606,6 +2622,10 @@ package body Sem_Ch9 is
-- disastrous result.
Analyze_Protected_Type_Declaration (N);
+
+ if Has_Aspects (N) then
+ Analyze_Aspect_Specifications (N, Id);
+ end if;
end Analyze_Single_Protected_Declaration;
-------------------------------------
@@ -2703,6 +2723,22 @@ package body Sem_Ch9 is
Set_Scope (Body_Id, Current_Scope);
Spec_Id := Find_Concurrent_Spec (Body_Id);
+ -- Task bodies are transformed into a subprogram spec and body pair by
+ -- the expander. Since there are no language-defined aspects that apply
+ -- to a task body, it is not worth changing the whole expansion to
+ -- accomodate user-defined aspects. Plus we cannot possibly known the
+ -- semantics of user-defined aspects in order to plan ahead.
+
+ if Has_Aspects (N) then
+ Error_Msg_N
+ ("?user-defined aspects on task bodies are not supported", N);
+
+ -- The aspects are removed for now to prevent cascading errors down
+ -- stream.
+
+ Remove_Aspects (N);
+ end if;
+
-- The spec is either a task type declaration, or a single task
-- declaration for which we have created an anonymous type.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 4fe6c57a5bd..8d716aa8454 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -186,6 +186,25 @@ package body Sem_Prag is
-- whether a particular item appears in a mixed list of nodes and entities.
-- It is assumed that all nodes in the list have entities.
+ function Check_Kind (Nam : Name_Id) return Name_Id;
+ -- This function is used in connection with pragmas Assert, Check,
+ -- and assertion aspects and pragmas, to determine if Check pragmas
+ -- (or corresponding assertion aspects or pragmas) are currently active
+ -- as determined by the presence of -gnata on the command line (which
+ -- sets the default), and the appearance of pragmas Check_Policy and
+ -- Assertion_Policy as configuration pragmas either in a configuration
+ -- pragma file, or at the start of the current unit, or locally given
+ -- Check_Policy and Assertion_Policy pragmas that are currently active.
+ --
+ -- The value returned is one of the names Check, Ignore, Disable (On
+ -- returns Check, and Off returns Ignore).
+ --
+ -- Note: for assertion kinds Pre'Class, Post'Class, Invariant'Class,
+ -- and Type_Invariant'Class, the name passed is Name_uPre, Name_uPost,
+ -- Name_uInvariant, or Name_uType_Invariant, which corresponds to _Pre,
+ -- _Post, _Invariant, or _Type_Invariant, which are special names used
+ -- in identifiers to represent these attribute references.
+
procedure Collect_Subprogram_Inputs_Outputs
(Subp_Id : Entity_Id;
Subp_Inputs : in out Elist_Id;
@@ -1514,22 +1533,22 @@ package body Sem_Prag is
(Item : Node_Id;
Item_Id : Entity_Id)
is
+ Context : Entity_Id;
Dummy : Boolean;
Inputs : Elist_Id := No_Elist;
Outputs : Elist_Id := No_Elist;
- Subp_Id : Entity_Id;
begin
-- Traverse the scope stack looking for enclosing subprograms
-- subject to aspect/pragma Global.
- Subp_Id := Scope (Current_Scope);
- while Present (Subp_Id) and then Subp_Id /= Standard_Standard loop
- if Is_Subprogram (Subp_Id)
- and then Has_Aspect (Subp_Id, Aspect_Global)
+ Context := Scope (Subp_Id);
+ while Present (Context) and then Context /= Standard_Standard loop
+ if Is_Subprogram (Context)
+ and then Has_Aspect (Context, Aspect_Global)
then
Collect_Subprogram_Inputs_Outputs
- (Subp_Id => Subp_Id,
+ (Subp_Id => Context,
Subp_Inputs => Inputs,
Subp_Outputs => Outputs,
Global_Seen => Dummy);
@@ -1545,11 +1564,15 @@ package body Sem_Prag is
Item, Item_Id);
Error_Msg_NE
("\item already appears as input of subprogram &",
- Item, Subp_Id);
+ Item, Context);
+
+ -- Stop the traversal once an error has been detected
+
+ exit;
end if;
end if;
- Subp_Id := Scope (Subp_Id);
+ Context := Scope (Context);
end loop;
end Check_Mode_Restriction_In_Enclosing_Context;
@@ -1576,7 +1599,10 @@ package body Sem_Prag is
begin
-- Single global item declaration
- if Nkind_In (List, N_Identifier, N_Selected_Component) then
+ if Nkind_In (List, N_Expanded_Name,
+ N_Identifier,
+ N_Selected_Component)
+ then
Analyze_Global_Item (List, Global_Mode);
-- Simple global list or moded global list declaration
@@ -3495,7 +3521,7 @@ package body Sem_Prag is
-- For a pragma PPC in the extended main source unit, record enabled
-- status in SCO.
- if not Is_Ignored (N) and then not Split_PPC (N) then
+ if Is_Checked (N) and then not Split_PPC (N) then
Set_SCO_Pragma_Enabled (Loc);
end if;
@@ -3592,7 +3618,7 @@ package body Sem_Prag is
-- N_Contract node.
if Acts_As_Spec (PO)
- and then (SPARK_Mode or else Formal_Extensions)
+ and then (SPARK_Mode or Formal_Extensions)
then
declare
Prag : constant Node_Id := New_Copy_Tree (N);
@@ -8164,11 +8190,27 @@ package body Sem_Prag is
Prag_Id := Get_Pragma_Id (Pname);
Pname := Original_Name (N);
- -- Check applicable policy. We skip this for a pragma that came from
- -- an aspect, since we already dealt with the Disable case, and we set
- -- the Is_Ignored flag at the time the aspect was analyzed.
+ -- Check applicable policy. We skip this if Is_Checked or Is_Ignored
+ -- is already set, indicating that we have already checked the policy
+ -- at the right point. This happens for example in the case of a pragma
+ -- that is derived from an Aspect.
+
+ if Is_Ignored (N) or else Is_Checked (N) then
+ null;
+
+ -- For a pragma that is a rewriting of another pragma, copy the
+ -- Is_Checked/Is_Ignored status from the rewritten pragma.
+
+ elsif Is_Rewrite_Substitution (N)
+ and then Nkind (Original_Node (N)) = N_Pragma
+ and then Original_Node (N) /= N
+ then
+ Set_Is_Ignored (N, Is_Ignored (Original_Node (N)));
+ Set_Is_Checked (N, Is_Checked (Original_Node (N)));
+
+ -- Otherwise query the applicable policy at this point
- if not From_Aspect_Specification (N) then
+ else
Check_Applicable_Policy (N);
-- If pragma is disabled, rewrite as NULL and skip analysis
@@ -8558,8 +8600,9 @@ package body Sem_Prag is
-- Now set Ada 83 mode
- Ada_Version := Ada_83;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_83;
+ Ada_Version_Explicit := Ada_83;
+ Ada_Version_Pragma := N;
------------
-- Ada_95 --
@@ -8589,8 +8632,9 @@ package body Sem_Prag is
-- Now set Ada 95 mode
- Ada_Version := Ada_95;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_95;
+ Ada_Version_Explicit := Ada_95;
+ Ada_Version_Pragma := N;
---------------------
-- Ada_05/Ada_2005 --
@@ -8637,6 +8681,7 @@ package body Sem_Prag is
Ada_Version := Ada_2005;
Ada_Version_Explicit := Ada_2005;
+ Ada_Version_Pragma := N;
end if;
end;
@@ -8686,6 +8731,7 @@ package body Sem_Prag is
Ada_Version := Ada_2012;
Ada_Version_Explicit := Ada_2012;
+ Ada_Version_Pragma := N;
end if;
end;
@@ -8879,6 +8925,8 @@ package body Sem_Prag is
Append_To (Newa, New_Copy_Tree (Arg2));
end if;
+ -- Rewrite as Check pragma
+
Rewrite (N,
Make_Pragma (Loc,
Chars => Name_Check,
@@ -9490,9 +9538,6 @@ package body Sem_Prag is
Cname : Name_Id;
Str : Node_Id;
- Check_On : Boolean;
- -- Set True if category of assertions referenced by Name enabled
-
begin
GNAT_Pragma;
Check_At_Least_N_Arguments (2);
@@ -9526,24 +9571,33 @@ package body Sem_Prag is
null;
end case;
- -- Set Check_On to indicate check status
+ -- Check applicable policy. We skip this if Checked/Ignored status
+ -- is already set (e.g. in the casse of a pragma from an aspect).
- -- If this comes from an aspect, we have already taken care of
- -- the policy active when the aspect was analyzed, and Is_Ignored
- -- is set appropriately already.
+ if Is_Checked (N) or else Is_Ignored (N) then
+ null;
- if From_Aspect_Specification (N) then
- Check_On := not Is_Ignored (N);
+ -- For a non-source pragma that is a rewriting of another pragma,
+ -- copy the Is_Checked/Ignored status from the rewritten pragma.
+
+ elsif Is_Rewrite_Substitution (N)
+ and then Nkind (Original_Node (N)) = N_Pragma
+ and then Original_Node (N) /= N
+ then
+ Set_Is_Ignored (N, Is_Ignored (Original_Node (N)));
+ Set_Is_Checked (N, Is_Checked (Original_Node (N)));
- -- Otherwise check the status right now
+ -- Otherwise query the applicable policy at this point
else
case Check_Kind (Cname) is
when Name_Ignore =>
- Check_On := False;
+ Set_Is_Ignored (N, True);
+ Set_Is_Checked (N, False);
when Name_Check =>
- Check_On := True;
+ Set_Is_Ignored (N, False);
+ Set_Is_Checked (N, True);
-- For disable, rewrite pragma as null statement and skip
-- rest of the analysis of the pragma.
@@ -9578,7 +9632,7 @@ package body Sem_Prag is
when others =>
- if Check_On and then not Split_PPC (N) then
+ if Is_Checked (N) and then not Split_PPC (N) then
-- Mark pragma/aspect SCO as enabled
@@ -9595,7 +9649,7 @@ package body Sem_Prag is
-- we do want to analyze (to get proper references).
-- The Preanalyze_And_Resolve routine does just what we want
- if not Check_On then
+ if Is_Ignored (N) then
Preanalyze_And_Resolve (Str, Standard_String);
-- Otherwise we need a proper analysis and expansion
@@ -9618,11 +9672,11 @@ package body Sem_Prag is
-- null;
-- end if;
- -- The reason we do this rewriting during semantic analysis
- -- rather than as part of normal expansion is that we cannot
- -- analyze and expand the code for the boolean expression
- -- directly, or it may cause insertion of actions that would
- -- escape the attempt to suppress the check code.
+ -- The reason we do this rewriting during semantic analysis rather
+ -- than as part of normal expansion is that we cannot analyze and
+ -- expand the code for the boolean expression directly, or it may
+ -- cause insertion of actions that would escape the attempt to
+ -- suppress the check code.
-- Note that the Sloc for the if statement corresponds to the
-- argument condition, not the pragma itself. The reason for
@@ -9630,7 +9684,7 @@ package body Sem_Prag is
-- False at compile time, and we do not want to delete this
-- warning when we delete the if statement.
- if Expander_Active and not Check_On then
+ if Expander_Active and Is_Ignored (N) then
Eloc := Sloc (Expr);
Rewrite (N,
@@ -11552,6 +11606,7 @@ package body Sem_Prag is
else
Extensions_Allowed := False;
Ada_Version := Ada_Version_Explicit;
+ Ada_Version_Pragma := Empty;
end if;
--------------
@@ -15040,11 +15095,9 @@ package body Sem_Prag is
Check_Optional_Identifier (Arg1, Name_Check);
Check_Precondition_Postcondition (In_Body);
- -- If in spec, nothing more to do. If in body, then we convert the
- -- pragma to an equivalent pragam Check. Note we do this whether
- -- or not precondition checks are enabled. That works fine since
- -- pragma Check will do this check, and will also analyze the
- -- condition itself in the proper context.
+ -- If in spec, nothing more to do. If in body, then we convert
+ -- the pragma to an equivalent pragma Check. That works fine since
+ -- pragma Check will analyze the condition in the proper context.
-- The form of the pragma Check is either:
@@ -15057,20 +15110,25 @@ package body Sem_Prag is
-- pragmas are checked.
if In_Body then
+
+ -- Rewrite as Check pragma
+
Rewrite (N,
Make_Pragma (Loc,
Chars => Name_Check,
Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Loc,
- Expression => Make_Identifier (Loc, Pname)),
+ Expression => Make_Identifier (Loc, Pname)),
Make_Pragma_Argument_Association (Sloc (Arg1),
- Expression => Relocate_Node (Get_Pragma_Arg (Arg1))))));
+ Expression =>
+ Relocate_Node (Get_Pragma_Arg (Arg1))))));
if Arg_Count = 2 then
Append_To (Pragma_Argument_Associations (N),
Make_Pragma_Argument_Association (Sloc (Arg2),
- Expression => Relocate_Node (Get_Pragma_Arg (Arg2))));
+ Expression =>
+ Relocate_Node (Get_Pragma_Arg (Arg2))));
end if;
Analyze (N);
@@ -15141,16 +15199,22 @@ package body Sem_Prag is
Ent := Find_Lib_Unit_Name;
Check_Duplicate_Pragma (Ent);
- -- This filters out pragmas inside generic parent then
- -- show up inside instantiation
+ -- This filters out pragmas inside generic parents that show up
+ -- inside instantiations. Pragmas that come from aspects in the
+ -- unit are not ignored.
- if Present (Ent)
- and then not (Pk = N_Package_Specification
- and then Present (Generic_Parent (Pa)))
- then
- if not Debug_Flag_U then
- Set_Is_Preelaborated (Ent);
- Set_Suppress_Elaboration_Warnings (Ent);
+ if Present (Ent) then
+ if Pk = N_Package_Specification
+ and then Present (Generic_Parent (Pa))
+ and then not From_Aspect_Specification (N)
+ then
+ null;
+
+ else
+ if not Debug_Flag_U then
+ Set_Is_Preelaborated (Ent);
+ Set_Suppress_Elaboration_Warnings (Ent);
+ end if;
end if;
end if;
end Preelaborate;
@@ -16338,7 +16402,7 @@ package body Sem_Prag is
-- SPARK_Mode --
----------------
- -- pragma SPARK_Mode (On | Off | Auto);
+ -- pragma SPARK_Mode [(On | Off | Auto)];
when Pragma_SPARK_Mode => SPARK_Mod : declare
procedure Chain_Pragma (Context : Entity_Id; Prag : Node_Id);
@@ -16347,7 +16411,7 @@ package body Sem_Prag is
-- the consistency between modes of visible/private declarations
-- and body declarations/statements.
- procedure Check_Conformance
+ procedure Check_Spark_Mode_Conformance
(Governing_Id : Entity_Id;
New_Id : Entity_Id);
-- Verify the "monotonicity" of SPARK modes between two entities.
@@ -16391,11 +16455,11 @@ package body Sem_Prag is
end if;
end Chain_Pragma;
- -----------------------
- -- Check_Conformance --
- -----------------------
+ ----------------------------------
+ -- Check_Spark_Mode_Conformance --
+ ----------------------------------
- procedure Check_Conformance
+ procedure Check_Spark_Mode_Conformance
(Governing_Id : Entity_Id;
New_Id : Entity_Id)
is
@@ -16427,7 +16491,7 @@ package body Sem_Prag is
(Governing_Mode => Gov_Prag,
New_Mode => New_Prag);
end if;
- end Check_Conformance;
+ end Check_Spark_Mode_Conformance;
------------------------------
-- Check_Pragma_Conformance --
@@ -16574,11 +16638,52 @@ package body Sem_Prag is
Stmt := Prev (Stmt);
end loop;
- -- If we get here, then we ran out of preceding statements. The
- -- pragma is immediately within a body.
+ -- Handle all cases where the pragma is actually an aspect and
+ -- applies to a library-level package spec, body or subprogram.
+
+ -- function F ... with SPARK_Mode => ...;
+ -- package P with SPARK_Mode => ...;
+ -- package body P with SPARK_Mode => ... is
- if Nkind_In (Context, N_Package_Body,
- N_Subprogram_Body)
+ -- The following circuitry simply prepares the proper context
+ -- for the general pragma processing mechanism below.
+
+ if Nkind (Context) = N_Compilation_Unit_Aux then
+ Context := Unit (Parent (Context));
+
+ if Nkind_In (Context, N_Package_Declaration,
+ N_Subprogram_Declaration)
+ then
+ Context := Specification (Context);
+ end if;
+ end if;
+
+ -- The pragma is at the top level of a package spec or appears
+ -- as an aspect on a subprogram.
+
+ -- function F ... with SPARK_Mode => ...;
+
+ -- package P is
+ -- pragma SPARK_Mode;
+
+ if Nkind_In (Context, N_Function_Specification,
+ N_Package_Specification,
+ N_Procedure_Specification)
+ then
+ Spec_Id := Defining_Unit_Name (Context);
+ Chain_Pragma (Spec_Id, N);
+
+ -- The pragma is immediately within a package or subprogram
+ -- body.
+
+ -- function F ... is
+ -- pragma SPARK_Mode;
+
+ -- package body P is
+ -- pragma SPARK_Mode;
+
+ elsif Nkind_In (Context, N_Package_Body,
+ N_Subprogram_Body)
then
Spec_Id := Corresponding_Spec (Context);
@@ -16589,16 +16694,20 @@ package body Sem_Prag is
Body_Id := Defining_Unit_Name (Context);
Chain_Pragma (Body_Id, N);
- Check_Conformance (Spec_Id, Body_Id);
- -- The pragma is at the top level of a package spec
+ -- Verify that the SPARK modes are consistent between
+ -- body and spec, if any.
- elsif Nkind (Context) = N_Package_Specification then
- Spec_Id := Defining_Unit_Name (Context);
- Chain_Pragma (Spec_Id, N);
+ if Present (Spec_Id) then
+ Check_Spark_Mode_Conformance (Spec_Id, Body_Id);
+ end if;
-- The pragma applies to the statements of a package body
+ -- package body P is
+ -- begin
+ -- pragma SPARK_Mode;
+
elsif Nkind (Context) = N_Handled_Sequence_Of_Statements
and then Nkind (Parent (Context)) = N_Package_Body
then
@@ -16607,10 +16716,9 @@ package body Sem_Prag is
Body_Id := Defining_Unit_Name (Context);
Chain_Pragma (Body_Id, N);
- Check_Conformance (Spec_Id, Body_Id);
+ Check_Spark_Mode_Conformance (Spec_Id, Body_Id);
- -- The pragma does not apply to a legal construct, issue an
- -- error.
+ -- The pragma does not apply to a legal construct, issue error
else
Pragma_Misplaced;
@@ -17855,6 +17963,10 @@ package body Sem_Prag is
then
Check_Arg_Is_Static_Expression (Last_Arg, Standard_String);
Arg_Count := Arg_Count - 1;
+
+ -- Not allowed in compiler units (bootstrap issues)
+
+ Check_Compiler_Unit (N);
end if;
end;
@@ -18286,17 +18398,33 @@ package body Sem_Prag is
Pnm : constant Name_Id := Chars (Get_Pragma_Arg (First (PPA)));
begin
- if Ename = Pnm or else Pnm = Name_Assertion then
+ if Ename = Pnm
+ or else Pnm = Name_Assertion
+ or else (Pnm = Name_Statement_Assertions
+ and then (Ename = Name_Assert or else
+ Ename = Name_Assert_And_Cut or else
+ Ename = Name_Assume or else
+ Ename = Name_Loop_Invariant))
+ then
Policy := Chars (Get_Pragma_Arg (Last (PPA)));
case Policy is
when Name_Off | Name_Ignore =>
Set_Is_Ignored (N, True);
+ Set_Is_Checked (N, False);
+
+ when Name_On | Name_Check =>
+ Set_Is_Checked (N, True);
+ Set_Is_Ignored (N, False);
when Name_Disable =>
Set_Is_Ignored (N, True);
+ Set_Is_Checked (N, False);
Set_Is_Disabled (N, True);
+ -- That should be exhaustive, the null here is a defence
+ -- against a malformed tree from previous errors.
+
when others =>
null;
end case;
@@ -18313,8 +18441,12 @@ package body Sem_Prag is
-- compatibility with the RM for the cases of assertion, invariant,
-- precondition, predicate, and postcondition.
- if not Assertions_Enabled then
- Set_Is_Ignored (N);
+ if Assertions_Enabled then
+ Set_Is_Checked (N, True);
+ Set_Is_Ignored (N, False);
+ else
+ Set_Is_Checked (N, False);
+ Set_Is_Ignored (N, True);
end if;
end Check_Applicable_Policy;
@@ -18369,7 +18501,10 @@ package body Sem_Prag is
begin
-- Single global item declaration
- if Nkind_In (List, N_Identifier, N_Selected_Component) then
+ if Nkind_In (List, N_Expanded_Name,
+ N_Identifier,
+ N_Selected_Component)
+ then
Collect_Global_Item (List, Mode);
-- Simple global list or moded global list declaration
@@ -18596,16 +18731,24 @@ package body Sem_Prag is
-----------------------
function Get_SPARK_Mode_Id (N : Node_Id) return SPARK_Mode_Id is
+ Args : List_Id;
Mode : Node_Id;
begin
- pragma Assert
- (Nkind (N) = N_Pragma
- and then Present (Pragma_Argument_Associations (N)));
+ pragma Assert (Nkind (N) = N_Pragma);
+ Args := Pragma_Argument_Associations (N);
+
+ -- Extract the mode from the argument list
- Mode := First (Pragma_Argument_Associations (N));
+ if Present (Args) then
+ Mode := First (Pragma_Argument_Associations (N));
+ return Get_SPARK_Mode_Id (Chars (Get_Pragma_Arg (Mode)));
- return Get_SPARK_Mode_Id (Chars (Get_Pragma_Arg (Mode)));
+ -- When SPARK_Mode appears without an argument, the default is ON
+
+ else
+ return SPARK_On;
+ end if;
end Get_SPARK_Mode_Id;
----------------
diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads
index fcbe9889861..ecfb3eda75a 100644
--- a/gcc/ada/sem_prag.ads
+++ b/gcc/ada/sem_prag.ads
@@ -63,25 +63,6 @@ package Sem_Prag is
-- expressions in the pragma as "spec expressions" (see section in Sem
-- "Handling of Default and Per-Object Expressions...").
- function Check_Kind (Nam : Name_Id) return Name_Id;
- -- This function is used in connection with pragmas Assert, Check,
- -- and assertion aspects and pragmas, to determine if Check pragmas
- -- (or corresponding assertion aspects or pragmas) are currently active
- -- as determined by the presence of -gnata on the command line (which
- -- sets the default), and the appearance of pragmas Check_Policy and
- -- Assertion_Policy as configuration pragmas either in a configuration
- -- pragma file, or at the start of the current unit, or locally given
- -- Check_Policy and Assertion_Policy pragmas that are currently active.
- --
- -- The value returned is one of the names Check, Ignore, Disable (On
- -- returns Check, and Off returns Ignore).
- --
- -- Note: for assertion kinds Pre'Class, Post'Class, Invariant'Class,
- -- and Type_Invariant'Class, the name passed is Name_uPre, Name_uPost,
- -- Name_uInvariant, or Name_uType_Invariant, which corresponds to _Pre,
- -- _Post, _Invariant, or _Type_Invariant, which are special names used
- -- in identifiers to represent these attribute references.
-
procedure Check_Applicable_Policy (N : Node_Id);
-- N is either an N_Aspect or an N_Pragma node. There are two cases. If
-- the name of the aspect or pragma is not one of those recognized as
@@ -95,9 +76,10 @@ package Sem_Prag is
-- If the name is a valid assertion kind name, then the Check_Policy pragma
-- chain is checked for a matching entry (or for an Assertion entry which
-- matches all possibilities). If a matching entry is found then the policy
- -- is checked. If it is Off, Ignore, or Disable, then the Is_Ignored flag
- -- is set in the aspect or pragma node. Additionally for policy Disable,
- -- the Is_Disabled flag is set.
+ -- is checked. If it is On or Check, then the Is_Checked flag is set in
+ -- the aspect or pragma node. If it is Off, Ignore, or Disable, then the
+ -- Is_Ignored flag is set in the aspect or pragma node. Additionally for
+ -- policy Disable, the Is_Disabled flag is set.
--
-- If no matching Check_Policy pragma is found then the effect depends on
-- whether -gnata was used, if so, then the call has no effect, otherwise
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 61f7712a090..387e06f31db 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -1583,15 +1583,16 @@ package body Sem_Res is
if ASIS_Mode and then Nkind (N) in N_Op then
if Is_Binary then
- Set_Parameter_Associations
- (Original_Node (N),
- New_List (New_Copy_Tree (Left_Opnd (N)),
- New_Copy_Tree (Right_Opnd (N))));
+ Rewrite (First (Parameter_Associations (Original_Node (N))),
+ New_Copy_Tree (Left_Opnd (N)));
+ Rewrite (Next (First (Parameter_Associations (Original_Node (N)))),
+ New_Copy_Tree (Right_Opnd (N)));
else
- Set_Parameter_Associations
- (Original_Node (N),
- New_List (New_Copy_Tree (Right_Opnd (N))));
+ Rewrite (First (Parameter_Associations (Original_Node (N))),
+ New_Copy_Tree (Right_Opnd (N)));
end if;
+
+ Set_Parent (Original_Node (N), Parent (N));
end if;
end Make_Call_Into_Operator;
@@ -5459,7 +5460,13 @@ package body Sem_Res is
("cannot disambiguate function call and indexing", N);
else
New_Subp := Relocate_Node (Subp);
- Set_Entity (Subp, Nam);
+
+ -- The called entity may be an explicit dereference, in which
+ -- case there is no entity to set.
+
+ if Nkind (New_Subp) /= N_Explicit_Dereference then
+ Set_Entity (Subp, Nam);
+ end if;
if (Is_Array_Type (Ret_Type)
and then Component_Type (Ret_Type) /= Any_Type)
diff --git a/gcc/ada/sinfo.adb b/gcc/ada/sinfo.adb
index c8eab8a9536..6cb18c1890c 100644
--- a/gcc/ada/sinfo.adb
+++ b/gcc/ada/sinfo.adb
@@ -1732,6 +1732,15 @@ package body Sinfo is
return Flag16 (N);
end Is_Boolean_Aspect;
+ function Is_Checked
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Aspect_Specification
+ or else NT (N).Nkind = N_Pragma);
+ return Flag11 (N);
+ end Is_Checked;
+
function Is_Component_Left_Opnd
(N : Node_Id) return Boolean is
begin
@@ -4840,6 +4849,15 @@ package body Sinfo is
Set_Flag16 (N, Val);
end Set_Is_Boolean_Aspect;
+ procedure Set_Is_Checked
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Aspect_Specification
+ or else NT (N).Nkind = N_Pragma);
+ Set_Flag11 (N, Val);
+ end Set_Is_Checked;
+
procedure Set_Is_Component_Left_Opnd
(N : Node_Id; Val : Boolean := True) is
begin
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index e8c9805cc31..112f8fc00ab 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -455,6 +455,59 @@ package Sinfo is
-- code is being generated, since they involved expander actions that
-- destroy the tree.
+ ---------------
+ -- ASIS Mode --
+ ---------------
+
+ -- When a file is compiled in ASIS mode (-gnatct), expansion is skipped,
+ -- and the analysis must generate a tree in a form that meets all ASIS
+ -- requirements.
+
+ -- ASIS must be able to recover the original tree that corresponds to the
+ -- source. It relies heavily on Original_Node for this purpose, which as
+ -- described in Atree, records the history when a node is rewritten. ASIS
+ -- uses Original_Node to recover the original node before the Rewrite.
+
+ -- At least in ASIS mode (not really important in non-ASIS mode), when
+ -- N1 is rewritten as N2:
+
+ -- The subtree rooted by the original node N1 should be fully decorated,
+ -- i.e. all semantic fields noted in sinfo.ads should be set properly
+ -- and any referenced entities should be complete (with exceptions for
+ -- representation information, noted below).
+
+ -- For all the direct descendants of N1 (original node) their Parent
+ -- links should point not to N1, but to N2 (rewriting node).
+
+ -- The Parent links of rewritten nodes (N1 in this example) are set in
+ -- some cases (to point to the rewritten parent), but in other cases
+ -- they are set to Empty. This needs sorting out ??? It would be much
+ -- cleaner if they could always be set in the original node ???
+
+ -- Representation Information
+
+ -- For the purposes of the data description annex, the representation
+ -- information for source declared entities must be complete in the
+ -- ASIS tree.
+
+ -- This requires that the front end call the back end (gigi/gcc) in
+ -- a special "back annotate only" mode to obtain information on layout
+ -- from the back end.
+
+ -- For the purposes of this special "back annotate only" mode, the
+ -- requirements that would normally need to be met to generate code
+ -- are relaxed as follows:
+
+ -- Anonymous types need not have full representation information (e.g.
+ -- sizes need not be set for types where the front end would normally
+ -- set the sizes), since anonymous types can be ignored in this mode.
+
+ -- In this mode, gigi will see at least fragments of a fully annotated
+ -- unexpanded tree. This means that it will encounter nodes it does
+ -- not normally handle (such as stubs, task bodies etc). It should
+ -- simply ignore these nodes, since they are not relevant to the task
+ -- of back annotating representation information.
+
------------------------
-- Common Flag Fields --
------------------------
@@ -1269,6 +1322,15 @@ package Sinfo is
-- Present in N_Aspect_Specification node. Set if the aspect is for a
-- boolean aspect (i.e. Aspect_Id is in Boolean_Aspect subtype).
+ -- Is_Checked (Flag11-Sem)
+ -- Present in N_Aspect_Specification and N_Pragma nodes. Set for an
+ -- assertion aspect or pragma, or check pragma for an assertion, that
+ -- is to be checked at run time. If either Is_Checked or Is_Ignored
+ -- is set (they cannot both be set), then this means that the status of
+ -- the pragma has been checked at the appropriate point and should not
+ -- be further modified (in some cases these flags are copied when a
+ -- pragma is rewritten).
+
-- Is_Component_Left_Opnd (Flag13-Sem)
-- Is_Component_Right_Opnd (Flag14-Sem)
-- Present in concatenation nodes, to indicate that the corresponding
@@ -2116,6 +2178,7 @@ package Sinfo is
-- Is_Delayed_Aspect (Flag14-Sem)
-- Is_Disabled (Flag15-Sem)
-- Is_Ignored (Flag9-Sem)
+ -- Is_Checked (Flag11-Sem)
-- Import_Interface_Present (Flag16-Sem)
-- Split_PPC (Flag17) set if corresponding aspect had Split_PPC set
@@ -4765,7 +4828,8 @@ package Sinfo is
-- and put in its proper section when we know exactly where that is!
-- EXPRESSION_FUNCTION ::=
- -- FUNCTION SPECIFICATION IS (EXPRESSION);
+ -- FUNCTION SPECIFICATION IS (EXPRESSION)
+ -- [ASPECT_SPECIFICATIONS];
-- N_Expression_Function
-- Sloc points to FUNCTION
@@ -5000,7 +5064,8 @@ package Sinfo is
-- PRIVATE_TYPE_DECLARATION ::=
-- type DEFINING_IDENTIFIER [DISCRIMINANT_PART]
- -- is [[abstract] tagged] [limited] private;
+ -- is [[abstract] tagged] [limited] private
+ -- [ASPECT_SPECIFICATIONS];
-- Note: TAGGED is not permitted in Ada 83 mode
@@ -5022,7 +5087,7 @@ package Sinfo is
-- type DEFINING_IDENTIFIER [DISCRIMINANT_PART] is
-- [abstract] [limited | synchronized]
-- new ancestor_SUBTYPE_INDICATION [and INTERFACE_LIST]
- -- with private;
+ -- with private [ASPECT_SPECIFICATIONS];
-- Note: LIMITED, and private extension declarations are not allowed
-- in Ada 83 mode.
@@ -5092,9 +5157,11 @@ package Sinfo is
-- OBJECT_RENAMING_DECLARATION ::=
-- DEFINING_IDENTIFIER :
- -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME;
+ -- [NULL_EXCLUSION] SUBTYPE_MARK renames object_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | DEFINING_IDENTIFIER :
- -- ACCESS_DEFINITION renames object_NAME;
+ -- ACCESS_DEFINITION renames object_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- Note: Access_Definition is an optional field that gives support to
-- Ada 2005 (AI-230). The parser generates nodes that have either the
@@ -5114,7 +5181,8 @@ package Sinfo is
-----------------------------------------
-- EXCEPTION_RENAMING_DECLARATION ::=
- -- DEFINING_IDENTIFIER : exception renames exception_NAME;
+ -- DEFINING_IDENTIFIER : exception renames exception_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- N_Exception_Renaming_Declaration
-- Sloc points to first identifier
@@ -5126,7 +5194,8 @@ package Sinfo is
---------------------------------------
-- PACKAGE_RENAMING_DECLARATION ::=
- -- package DEFINING_PROGRAM_UNIT_NAME renames package_NAME;
+ -- package DEFINING_PROGRAM_UNIT_NAME renames package_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- N_Package_Renaming_Declaration
-- Sloc points to PACKAGE
@@ -5139,7 +5208,8 @@ package Sinfo is
------------------------------------------
-- SUBPROGRAM_RENAMING_DECLARATION ::=
- -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME;
+ -- SUBPROGRAM_SPECIFICATION renames callable_entity_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- N_Subprogram_Renaming_Declaration
-- Sloc points to RENAMES
@@ -5157,10 +5227,13 @@ package Sinfo is
-- GENERIC_RENAMING_DECLARATION ::=
-- generic package DEFINING_PROGRAM_UNIT_NAME
-- renames generic_package_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | generic procedure DEFINING_PROGRAM_UNIT_NAME
-- renames generic_procedure_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- | generic function DEFINING_PROGRAM_UNIT_NAME
-- renames generic_function_NAME
+ -- [ASPECT_SPECIFICATIONS];
-- N_Generic_Package_Renaming_Declaration
-- Sloc points to GENERIC
@@ -5374,7 +5447,8 @@ package Sinfo is
-- ENTRY_DECLARATION ::=
-- [[not] overriding]
-- entry DEFINING_IDENTIFIER
- -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE;
+ -- [(DISCRETE_SUBTYPE_DEFINITION)] PARAMETER_PROFILE
+ -- [ASPECT_SPECIFICATIONS];
-- N_Entry_Declaration
-- Sloc points to ENTRY
@@ -5975,7 +6049,8 @@ package Sinfo is
----------------------------------
-- SUBPROGRAM_BODY_STUB ::=
- -- SUBPROGRAM_SPECIFICATION is separate;
+ -- SUBPROGRAM_SPECIFICATION is separate
+ -- [ASPECT_SPECIFICATION];
-- N_Subprogram_Body_Stub
-- Sloc points to FUNCTION or PROCEDURE
@@ -5988,7 +6063,8 @@ package Sinfo is
-------------------------------
-- PACKAGE_BODY_STUB ::=
- -- package body DEFINING_IDENTIFIER is separate;
+ -- package body DEFINING_IDENTIFIER is separate
+ -- [ASPECT_SPECIFICATION];
-- N_Package_Body_Stub
-- Sloc points to PACKAGE
@@ -6001,7 +6077,8 @@ package Sinfo is
----------------------------
-- TASK_BODY_STUB ::=
- -- task body DEFINING_IDENTIFIER is separate;
+ -- task body DEFINING_IDENTIFIER is separate
+ -- [ASPECT_SPECIFICATION];
-- N_Task_Body_Stub
-- Sloc points to TASK
@@ -6014,7 +6091,8 @@ package Sinfo is
---------------------------------
-- PROTECTED_BODY_STUB ::=
- -- protected body DEFINING_IDENTIFIER is separate;
+ -- protected body DEFINING_IDENTIFIER is separate
+ -- [ASPECT_SPECIFICATION];
-- Note: protected body stubs are not allowed in Ada 83 mode
@@ -6215,7 +6293,8 @@ package Sinfo is
------------------------------------------
-- GENERIC_SUBPROGRAM_DECLARATION ::=
- -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION;
+ -- GENERIC_FORMAL_PART SUBPROGRAM_SPECIFICATION
+ -- [ASPECT_SPECIFICATIONS];
-- Note: Generic_Formal_Declarations can include pragmas
@@ -6763,6 +6842,7 @@ package Sinfo is
-- Next_Rep_Item (Node5-Sem)
-- Split_PPC (Flag17) Set if split pre/post attribute
-- Is_Boolean_Aspect (Flag16-Sem)
+ -- Is_Checked (Flag11-Sem)
-- Is_Delayed_Aspect (Flag14-Sem)
-- Is_Disabled (Flag15-Sem)
-- Is_Ignored (Flag9-Sem)
@@ -7049,16 +7129,21 @@ package Sinfo is
-- Pre_Post_Conditions contains a collection of pragmas that correspond
-- to pre- and postconditions associated with an entry or a subprogram.
-- The pragmas can either come from source or be the byproduct of aspect
- -- expansion. The ordering in the list is of LIFO fashion.
+ -- expansion. The ordering in the list is in LIFO fashion.
+
+ -- Note that there might be multiple preconditions or postconditions
+ -- in this list, either because they come from separate pragmas in the
+ -- source, or because a Pre (resp. Post) aspect specification has been
+ -- broken into AND THEN sections. See Split_PPC for details.
-- Contract_Test_Cases contains a collection of pragmas that correspond
-- to aspects/pragmas Contract_Cases and Test_Case. The ordering in the
- -- list is of LIFO fashion.
+ -- list is in LIFO fashion.
-- Classifications contains pragmas that either categorize subprogram
-- inputs and outputs or establish dependencies between them. Currently
-- pragmas Depends and Global are stored in this list. The ordering is
- -- of LIFO fashion.
+ -- in LIFO fashion.
-------------------
-- Expanded_Name --
@@ -8720,6 +8805,9 @@ package Sinfo is
function Is_Boolean_Aspect
(N : Node_Id) return Boolean; -- Flag16
+ function Is_Checked
+ (N : Node_Id) return Boolean; -- Flag11
+
function Is_Component_Left_Opnd
(N : Node_Id) return Boolean; -- Flag13
@@ -9710,6 +9798,9 @@ package Sinfo is
procedure Set_Is_Boolean_Aspect
(N : Node_Id; Val : Boolean := True); -- Flag16
+ procedure Set_Is_Checked
+ (N : Node_Id; Val : Boolean := True); -- Flag11
+
procedure Set_Is_Component_Left_Opnd
(N : Node_Id; Val : Boolean := True); -- Flag13
@@ -12095,6 +12186,7 @@ package Sinfo is
pragma Inline (Is_Accessibility_Actual);
pragma Inline (Is_Asynchronous_Call_Block);
pragma Inline (Is_Boolean_Aspect);
+ pragma Inline (Is_Checked);
pragma Inline (Is_Component_Left_Opnd);
pragma Inline (Is_Component_Right_Opnd);
pragma Inline (Is_Controlling_Actual);
@@ -12420,6 +12512,7 @@ package Sinfo is
pragma Inline (Set_Is_Accessibility_Actual);
pragma Inline (Set_Is_Asynchronous_Call_Block);
pragma Inline (Set_Is_Boolean_Aspect);
+ pragma Inline (Set_Is_Checked);
pragma Inline (Set_Is_Component_Left_Opnd);
pragma Inline (Set_Is_Component_Right_Opnd);
pragma Inline (Set_Is_Controlling_Actual);
diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb
index 29be59ac688..a01c045d91f 100644
--- a/gcc/ada/sinput.adb
+++ b/gcc/ada/sinput.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2013, 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- --
@@ -258,10 +258,20 @@ package body Sinput is
BOM : BOM_Kind;
Len : Natural;
Tst : String (1 .. 5);
+ C : Character;
begin
for J in 1 .. 5 loop
- Tst (J) := Source (Scan_Ptr + Source_Ptr (J) - 1);
+ C := Source (Scan_Ptr + Source_Ptr (J) - 1);
+
+ -- Definitely no BOM if EOF character marks either end of file, or
+ -- an illegal non-BOM character if not at the end of file.
+
+ if C = EOF then
+ return;
+ end if;
+
+ Tst (J) := C;
end loop;
Read_BOM (Tst, Len, BOM, False);
diff --git a/gcc/ada/sprint.adb b/gcc/ada/sprint.adb
index 8526716e08e..5259dd776ff 100644
--- a/gcc/ada/sprint.adb
+++ b/gcc/ada/sprint.adb
@@ -2479,6 +2479,18 @@ package body Sprint is
Sprint_Node_Sloc (Specification (Node));
Write_Char (';');
+ -- If this is an instantiation, get the aspects from the original
+ -- instantiation node.
+
+ if Is_Generic_Instance (Defining_Entity (Node))
+ and then Has_Aspects
+ (Package_Instantiation (Defining_Entity (Node)))
+ then
+ Sprint_Aspect_Specifications
+ (Package_Instantiation (Defining_Entity (Node)),
+ Semicolon => True);
+ end if;
+
when N_Package_Instantiation =>
Extra_Blank_Line;
Write_Indent_Str_Sloc ("package ");
@@ -2499,12 +2511,27 @@ package body Sprint is
Write_Str_With_Col_Check_Sloc ("package ");
Sprint_Node (Defining_Unit_Name (Node));
- if Nkind_In (Parent (Node), N_Package_Declaration,
- N_Generic_Package_Declaration)
+ if Nkind (Parent (Node)) = N_Generic_Package_Declaration
and then Has_Aspects (Parent (Node))
then
Sprint_Aspect_Specifications
(Parent (Node), Semicolon => False);
+
+ -- An instantiation is rewritten as a package declaration, but
+ -- the aspects belong to the instantiation node.
+
+ elsif Nkind (Parent (Node)) = N_Package_Declaration then
+ declare
+ Pack : constant Entity_Id := Defining_Entity (Node);
+
+ begin
+ if not Is_Generic_Instance (Pack) then
+ if Has_Aspects (Parent (Node)) then
+ Sprint_Aspect_Specifications
+ (Parent (Node), Semicolon => False);
+ end if;
+ end if;
+ end;
end if;
Write_Str (" is");
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 0fc6bdb2188..197be06a19e 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -31,9 +31,9 @@ with Debug; use Debug;
with Lib; use Lib;
with Osint; use Osint;
with Opt; use Opt;
-with Validsw; use Validsw;
with Stylesw; use Stylesw;
with Ttypes; use Ttypes;
+with Validsw; use Validsw;
with Warnsw; use Warnsw;
with Ada.Unchecked_Deallocation;
@@ -310,6 +310,15 @@ package body Switch.C is
("-gnatc must be first if combined with other switches");
end if;
+ -- Not allowed if previous -gnatR given
+
+ if List_Representation_Info /= 0
+ or else List_Representation_Info_Mechanisms
+ then
+ Osint.Fail
+ ("-gnatc not allowed since -gnatR given previously");
+ end if;
+
Ptr := Ptr + 1;
Operating_Mode := Check_Semantics;
@@ -772,8 +781,9 @@ package body Switch.C is
-- implicit setting here, since for example, we want
-- Preelaborate_05 treated as Preelaborate
- Ada_Version := Ada_2012;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_2012;
+ Ada_Version_Explicit := Ada_2012;
+ Ada_Version_Pragma := Empty;
-- Set default warnings and style checks for -gnatg
@@ -1013,6 +1023,14 @@ package body Switch.C is
("-gnatR not permitted since -gnatD given previously");
end if;
+ -- Not allowed if previous -gnatc was given, since we must
+ -- call the code generator to determine rep information.
+
+ if Operating_Mode = Check_Semantics then
+ Osint.Fail
+ ("-gnatR not permitted since -gnatc given previously");
+ end if;
+
-- Set to annotate rep info, and set default -gnatR mode
Back_Annotate_Rep_Info := True;
@@ -1197,6 +1215,7 @@ package body Switch.C is
Extensions_Allowed := True;
Ada_Version := Ada_Version_Type'Last;
Ada_Version_Explicit := Ada_Version_Type'Last;
+ Ada_Version_Pragma := Empty;
-- -gnaty (style checks)
@@ -1309,8 +1328,9 @@ package body Switch.C is
Bad_Switch ("-gnat8" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
- Ada_Version := Ada_83;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_83;
+ Ada_Version_Explicit := Ada_83;
+ Ada_Version_Pragma := Empty;
end if;
-- -gnat95
@@ -1326,8 +1346,9 @@ package body Switch.C is
Bad_Switch ("-gnat9" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
- Ada_Version := Ada_95;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_95;
+ Ada_Version_Explicit := Ada_95;
+ Ada_Version_Pragma := Empty;
end if;
-- -gnat05
@@ -1343,8 +1364,9 @@ package body Switch.C is
Bad_Switch ("-gnat0" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
- Ada_Version := Ada_2005;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_2005;
+ Ada_Version_Explicit := Ada_2005;
+ Ada_Version_Pragma := Empty;
end if;
-- -gnat12
@@ -1360,8 +1382,9 @@ package body Switch.C is
Bad_Switch ("-gnat1" & Switch_Chars (Ptr .. Max));
else
Ptr := Ptr + 1;
- Ada_Version := Ada_2012;
- Ada_Version_Explicit := Ada_Version;
+ Ada_Version := Ada_2012;
+ Ada_Version_Explicit := Ada_2012;
+ Ada_Version_Pragma := Empty;
end if;
-- -gnat2005 and -gnat2012
@@ -1381,6 +1404,7 @@ package body Switch.C is
end if;
Ada_Version_Explicit := Ada_Version;
+ Ada_Version_Pragma := Empty;
Ptr := Ptr + 4;
-- Switch cancellation, currently only -gnat-p is allowed.
diff --git a/gcc/ada/tree_io.ads b/gcc/ada/tree_io.ads
index 3692d1ec650..bab7f9e6a4a 100644
--- a/gcc/ada/tree_io.ads
+++ b/gcc/ada/tree_io.ads
@@ -47,7 +47,7 @@ package Tree_IO is
Tree_Format_Error : exception;
-- Raised if a format error is detected in the input file
- ASIS_Version_Number : constant := 32;
+ ASIS_Version_Number : constant := 33;
-- ASIS Version. This is used to check for consistency between the compiler
-- used to generate trees and an ASIS application that is reading the
-- trees. It must be incremented whenever a change is made to the tree
@@ -62,6 +62,8 @@ package Tree_IO is
-- 31 Remove read/write of Debug_Pragmas_Disabled/Debug_Pragmas_Enabled
-- 32 Change the way entities are changed through Next_Entity field in
-- the hierarchy of child units
+ -- 33 Add copying subtrees for rewriting infix calls of operator
+ -- functions for the corresponding original nodes.
procedure Tree_Read_Initialize (Desc : File_Descriptor);
-- Called to initialize reading of a tree file. This call must be made
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index dd0f2af33e4..ffcd7246905 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -381,7 +381,8 @@ begin
-- Lines for -gnatR switch
Write_Switch_Char ("R?");
- Write_Line ("List rep info (?=0/1/2/3 for none/types/all/variable)");
+ Write_Line
+ ("List rep info (?=0/1/2/3/m for none/types/all/variable/mechanisms)");
Write_Switch_Char ("R?s");
Write_Line ("List rep info to file.rep instead of standard output");
@@ -626,8 +627,8 @@ begin
Write_Line (" l check reference manual layout");
Write_Line (" Lnn check max nest level < nn ");
Write_Line (" m check line length <= 79 characters");
- Write_Line (" n check casing of package Standard identifiers");
Write_Line (" Mnn check line length <= nn characters");
+ Write_Line (" n check casing of package Standard identifiers");
Write_Line (" N turn off all checks");
Write_Line (" o check subprogram bodies in alphabetical order");
Write_Line (" O check overriding indicators");
diff --git a/gcc/ada/vms_data.ads b/gcc/ada/vms_data.ads
index 91ee51db119..f92788af69b 100644
--- a/gcc/ada/vms_data.ads
+++ b/gcc/ada/vms_data.ads
@@ -2299,7 +2299,11 @@ package VMS_Data is
"SYMBOLIC " &
"-gnatR3 " &
"SYMBOLIC_FILE " &
- "-gnatR3s";
+ "-gnatR3s " &
+ "MECHANISMS " &
+ "-gnatRm " &
+ "MECHANISMS_FILE " &
+ "-gnatRms";
-- /NOREPRESENTATION_INFO (D)
-- /REPRESENTATION_INFO[=(keyword[,...])]
--
@@ -2330,6 +2334,13 @@ package VMS_Data is
-- with the name 'file_rep' where 'file' is the name
-- of the corresponding source file.
--
+ -- MECHANISMS List convention and argument passing mechanisms
+ -- for all subprograms
+ --
+ -- MECHANISMS_FILE Similar to MECHANISMS, but the output is to a file
+ -- with the name 'file_rep' where file is the name
+ -- of the corresponding source file.
+ --
-- DEFAULT Equivalent to ARRAYS.
S_GCC_RepinfX : aliased constant S := "/NOREPRESENTATION_INFO " &
@@ -2491,7 +2502,7 @@ package VMS_Data is
"XTRA_PARENS " &
"-gnaty-x " &
"NOXTRA_PARENS " &
- "-gnaty-x ";
+ "-gnaty-x";
-- /NOSTYLE_CHECKS (D)
-- /STYLE_CHECKS[=(keyword,[...])]
--
diff --git a/gcc/ada/warnsw.adb b/gcc/ada/warnsw.adb
index c194b3182c1..36360f96d63 100644
--- a/gcc/ada/warnsw.adb
+++ b/gcc/ada/warnsw.adb
@@ -25,9 +25,197 @@
with Err_Vars; use Err_Vars;
with Opt; use Opt;
-with Targparm; use Targparm;
+
package body Warnsw is
+ ----------------------
+ -- Restore_Warnings --
+ ----------------------
+
+ procedure Restore_Warnings (W : Warning_Record) is
+ begin
+ Address_Clause_Overlay_Warnings :=
+ W.Address_Clause_Overlay_Warnings;
+ Check_Unreferenced :=
+ W.Check_Unreferenced;
+ Check_Unreferenced_Formals :=
+ W.Check_Unreferenced_Formals;
+ Check_Withs :=
+ W.Check_Withs;
+ Constant_Condition_Warnings :=
+ W.Constant_Condition_Warnings;
+ Elab_Warnings :=
+ W.Elab_Warnings;
+ Implementation_Unit_Warnings :=
+ W.Implementation_Unit_Warnings;
+ Ineffective_Inline_Warnings :=
+ W.Ineffective_Inline_Warnings;
+ List_Inherited_Aspects :=
+ W.List_Inherited_Aspects;
+ Warning_Doc_Switch :=
+ W.Warning_Doc_Switch;
+ Warn_On_Ada_2005_Compatibility :=
+ W.Warn_On_Ada_2005_Compatibility;
+ Warn_On_Ada_2012_Compatibility :=
+ W.Warn_On_Ada_2012_Compatibility;
+ Warn_On_All_Unread_Out_Parameters :=
+ W.Warn_On_All_Unread_Out_Parameters;
+ Warn_On_Assertion_Failure :=
+ W.Warn_On_Assertion_Failure;
+ Warn_On_Assumed_Low_Bound :=
+ W.Warn_On_Assumed_Low_Bound;
+ Warn_On_Atomic_Synchronization :=
+ W.Warn_On_Atomic_Synchronization;
+ Warn_On_Bad_Fixed_Value :=
+ W.Warn_On_Bad_Fixed_Value;
+ Warn_On_Biased_Representation :=
+ W.Warn_On_Biased_Representation;
+ Warn_On_Constant :=
+ W.Warn_On_Constant;
+ Warn_On_Deleted_Code :=
+ W.Warn_On_Deleted_Code;
+ Warn_On_Dereference :=
+ W.Warn_On_Dereference;
+ Warn_On_Export_Import :=
+ W.Warn_On_Export_Import;
+ Warn_On_Hiding :=
+ W.Warn_On_Hiding;
+ Warn_On_Modified_Unread :=
+ W.Warn_On_Modified_Unread;
+ Warn_On_No_Value_Assigned :=
+ W.Warn_On_No_Value_Assigned;
+ Warn_On_Non_Local_Exception :=
+ W.Warn_On_Non_Local_Exception;
+ Warn_On_Object_Renames_Function :=
+ W.Warn_On_Object_Renames_Function;
+ Warn_On_Obsolescent_Feature :=
+ W.Warn_On_Obsolescent_Feature;
+ Warn_On_Overlap :=
+ W.Warn_On_Overlap;
+ Warn_On_Overridden_Size :=
+ W.Warn_On_Overridden_Size;
+ Warn_On_Parameter_Order :=
+ W.Warn_On_Parameter_Order;
+ Warn_On_Questionable_Missing_Parens :=
+ W.Warn_On_Questionable_Missing_Parens;
+ Warn_On_Record_Holes :=
+ W.Warn_On_Record_Holes;
+ Warn_On_Redundant_Constructs :=
+ W.Warn_On_Redundant_Constructs;
+ Warn_On_Reverse_Bit_Order :=
+ W.Warn_On_Reverse_Bit_Order;
+ Warn_On_Standard_Redefinition :=
+ W.Warn_On_Standard_Redefinition;
+ Warn_On_Suspicious_Contract :=
+ W.Warn_On_Suspicious_Contract;
+ Warn_On_Unchecked_Conversion :=
+ W.Warn_On_Unchecked_Conversion;
+ Warn_On_Unordered_Enumeration_Type :=
+ W.Warn_On_Unordered_Enumeration_Type;
+ Warn_On_Unrecognized_Pragma :=
+ W.Warn_On_Unrecognized_Pragma;
+ Warn_On_Unrepped_Components :=
+ W.Warn_On_Unrepped_Components;
+ Warn_On_Warnings_Off :=
+ W.Warn_On_Warnings_Off;
+ end Restore_Warnings;
+
+ -------------------
+ -- Save_Warnings --
+ -------------------
+
+ function Save_Warnings return Warning_Record is
+ W : Warning_Record;
+
+ begin
+ W.Address_Clause_Overlay_Warnings :=
+ Address_Clause_Overlay_Warnings;
+ W.Check_Unreferenced :=
+ Check_Unreferenced;
+ W.Check_Unreferenced_Formals :=
+ Check_Unreferenced_Formals;
+ W.Check_Withs :=
+ Check_Withs;
+ W.Constant_Condition_Warnings :=
+ Constant_Condition_Warnings;
+ W.Elab_Warnings :=
+ Elab_Warnings;
+ W.Implementation_Unit_Warnings :=
+ Implementation_Unit_Warnings;
+ W.Ineffective_Inline_Warnings :=
+ Ineffective_Inline_Warnings;
+ W.List_Inherited_Aspects :=
+ List_Inherited_Aspects;
+ W.Warning_Doc_Switch :=
+ Warning_Doc_Switch;
+ W.Warn_On_Ada_2005_Compatibility :=
+ Warn_On_Ada_2005_Compatibility;
+ W.Warn_On_Ada_2012_Compatibility :=
+ Warn_On_Ada_2012_Compatibility;
+ W.Warn_On_All_Unread_Out_Parameters :=
+ Warn_On_All_Unread_Out_Parameters;
+ W.Warn_On_Assertion_Failure :=
+ Warn_On_Assertion_Failure;
+ W.Warn_On_Assumed_Low_Bound :=
+ Warn_On_Assumed_Low_Bound;
+ W.Warn_On_Atomic_Synchronization :=
+ Warn_On_Atomic_Synchronization;
+ W.Warn_On_Bad_Fixed_Value :=
+ Warn_On_Bad_Fixed_Value;
+ W.Warn_On_Biased_Representation :=
+ Warn_On_Biased_Representation;
+ W.Warn_On_Constant :=
+ Warn_On_Constant;
+ W.Warn_On_Deleted_Code :=
+ Warn_On_Deleted_Code;
+ W.Warn_On_Dereference :=
+ Warn_On_Dereference;
+ W.Warn_On_Export_Import :=
+ Warn_On_Export_Import;
+ W.Warn_On_Hiding :=
+ Warn_On_Hiding;
+ W.Warn_On_Modified_Unread :=
+ Warn_On_Modified_Unread;
+ W.Warn_On_No_Value_Assigned :=
+ Warn_On_No_Value_Assigned;
+ W.Warn_On_Non_Local_Exception :=
+ Warn_On_Non_Local_Exception;
+ W.Warn_On_Object_Renames_Function :=
+ Warn_On_Object_Renames_Function;
+ W.Warn_On_Obsolescent_Feature :=
+ Warn_On_Obsolescent_Feature;
+ W.Warn_On_Overlap :=
+ Warn_On_Overlap;
+ W.Warn_On_Overridden_Size :=
+ Warn_On_Overridden_Size;
+ W.Warn_On_Parameter_Order :=
+ Warn_On_Parameter_Order;
+ W.Warn_On_Questionable_Missing_Parens :=
+ Warn_On_Questionable_Missing_Parens;
+ W.Warn_On_Record_Holes :=
+ Warn_On_Record_Holes;
+ W.Warn_On_Redundant_Constructs :=
+ Warn_On_Redundant_Constructs;
+ W.Warn_On_Reverse_Bit_Order :=
+ Warn_On_Reverse_Bit_Order;
+ W.Warn_On_Standard_Redefinition :=
+ Warn_On_Standard_Redefinition;
+ W.Warn_On_Suspicious_Contract :=
+ Warn_On_Suspicious_Contract;
+ W.Warn_On_Unchecked_Conversion :=
+ Warn_On_Unchecked_Conversion;
+ W.Warn_On_Unordered_Enumeration_Type :=
+ Warn_On_Unordered_Enumeration_Type;
+ W.Warn_On_Unrecognized_Pragma :=
+ Warn_On_Unrecognized_Pragma;
+ W.Warn_On_Unrepped_Components :=
+ Warn_On_Unrepped_Components;
+ W.Warn_On_Warnings_Off :=
+ Warn_On_Warnings_Off;
+
+ return W;
+ end Save_Warnings;
+
----------------------------
-- Set_Dot_Warning_Switch --
----------------------------
@@ -54,17 +242,9 @@ package body Warnsw is
Warn_On_Unrepped_Components := False;
when 'd' =>
- if OpenVMS_On_Target then
- return False;
- end if;
-
Warning_Doc_Switch := True;
when 'D' =>
- if OpenVMS_On_Target then
- return False;
- end if;
-
Warning_Doc_Switch := False;
when 'e' =>
@@ -77,11 +257,7 @@ package body Warnsw is
Implementation_Unit_Warnings := True;
Ineffective_Inline_Warnings := True;
List_Inherited_Aspects := True;
-
- if not OpenVMS_On_Target then
- Warning_Doc_Switch := True;
- end if;
-
+ Warning_Doc_Switch := True;
Warn_On_Ada_2005_Compatibility := True;
Warn_On_Ada_2012_Compatibility := True;
Warn_On_All_Unread_Out_Parameters := True;
diff --git a/gcc/ada/warnsw.ads b/gcc/ada/warnsw.ads
index 45983e95114..b39f545802d 100644
--- a/gcc/ada/warnsw.ads
+++ b/gcc/ada/warnsw.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1999-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -35,7 +35,8 @@ package Warnsw is
-- whether warnings of a given class will be generated or not.
-- Note: most of these flags are still in opt, but the plan is to move them
- -- here as time goes by.
+ -- here as time goes by. And in fact a really nice idea would be to put
+ -- them all in a Warn_Record so that they would be easy to save/restore.
Warn_On_Record_Holes : Boolean := False;
-- Warn when explicit record component clauses leave uncovered holes (gaps)
@@ -52,6 +53,63 @@ package Warnsw is
-- Standard. Off by default, modified by use of -gnatw.k/.K, but not
-- affected by -gnatwa.
+ -----------------------------------
+ -- Saving and Restoring Warnings --
+ -----------------------------------
+
+ -- Type used to save and restore warnings
+
+ type Warning_Record is record
+ Address_Clause_Overlay_Warnings : Boolean;
+ Check_Unreferenced : Boolean;
+ Check_Unreferenced_Formals : Boolean;
+ Check_Withs : Boolean;
+ Constant_Condition_Warnings : Boolean;
+ Elab_Warnings : Boolean;
+ Implementation_Unit_Warnings : Boolean;
+ Ineffective_Inline_Warnings : Boolean;
+ List_Inherited_Aspects : Boolean;
+ Warning_Doc_Switch : Boolean;
+ Warn_On_Ada_2005_Compatibility : Boolean;
+ Warn_On_Ada_2012_Compatibility : Boolean;
+ Warn_On_All_Unread_Out_Parameters : Boolean;
+ Warn_On_Assertion_Failure : Boolean;
+ Warn_On_Assumed_Low_Bound : Boolean;
+ Warn_On_Atomic_Synchronization : Boolean;
+ Warn_On_Bad_Fixed_Value : Boolean;
+ Warn_On_Biased_Representation : Boolean;
+ Warn_On_Constant : Boolean;
+ Warn_On_Deleted_Code : Boolean;
+ Warn_On_Dereference : Boolean;
+ Warn_On_Export_Import : Boolean;
+ Warn_On_Hiding : Boolean;
+ Warn_On_Modified_Unread : Boolean;
+ Warn_On_No_Value_Assigned : Boolean;
+ Warn_On_Non_Local_Exception : Boolean;
+ Warn_On_Object_Renames_Function : Boolean;
+ Warn_On_Obsolescent_Feature : Boolean;
+ Warn_On_Overlap : Boolean;
+ Warn_On_Overridden_Size : Boolean;
+ Warn_On_Parameter_Order : Boolean;
+ Warn_On_Questionable_Missing_Parens : Boolean;
+ Warn_On_Record_Holes : Boolean;
+ Warn_On_Redundant_Constructs : Boolean;
+ Warn_On_Reverse_Bit_Order : Boolean;
+ Warn_On_Standard_Redefinition : Boolean;
+ Warn_On_Suspicious_Contract : Boolean;
+ Warn_On_Unchecked_Conversion : Boolean;
+ Warn_On_Unordered_Enumeration_Type : Boolean;
+ Warn_On_Unrecognized_Pragma : Boolean;
+ Warn_On_Unrepped_Components : Boolean;
+ Warn_On_Warnings_Off : Boolean;
+ end record;
+
+ function Save_Warnings return Warning_Record;
+ -- Returns current settingh of warnings
+
+ procedure Restore_Warnings (W : Warning_Record);
+ -- Restores current settings of warning flags from W
+
-----------------
-- Subprograms --
-----------------
diff --git a/gcc/alias.c b/gcc/alias.c
index 19fe8d840a8..a48bb51ed96 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "df.h"
#include "tree-ssa-alias.h"
#include "pointer-set.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
/* The aliasing API provided here solves related but different problems:
@@ -500,51 +500,70 @@ objects_must_conflict_p (tree t1, tree t2)
return alias_sets_must_conflict_p (set1, set2);
}
-/* Return true if all nested component references handled by
- get_inner_reference in T are such that we should use the alias set
- provided by the object at the heart of T.
-
- This is true for non-addressable components (which don't have their
- own alias set), as well as components of objects in alias set zero.
- This later point is a special case wherein we wish to override the
- alias set used by the component, but we don't have per-FIELD_DECL
- assignable alias sets. */
-
-bool
-component_uses_parent_alias_set (const_tree t)
+/* Return the outermost parent of component present in the chain of
+ component references handled by get_inner_reference in T with the
+ following property:
+ - the component is non-addressable, or
+ - the parent has alias set zero,
+ or NULL_TREE if no such parent exists. In the former cases, the alias
+ set of this parent is the alias set that must be used for T itself. */
+
+tree
+component_uses_parent_alias_set_from (const_tree t)
{
- while (1)
- {
- /* If we're at the end, it vacuously uses its own alias set. */
- if (!handled_component_p (t))
- return false;
+ const_tree found = NULL_TREE;
+ while (handled_component_p (t))
+ {
switch (TREE_CODE (t))
{
case COMPONENT_REF:
if (DECL_NONADDRESSABLE_P (TREE_OPERAND (t, 1)))
- return true;
+ found = t;
break;
case ARRAY_REF:
case ARRAY_RANGE_REF:
if (TYPE_NONALIASED_COMPONENT (TREE_TYPE (TREE_OPERAND (t, 0))))
- return true;
+ found = t;
break;
case REALPART_EXPR:
case IMAGPART_EXPR:
break;
- default:
+ case BIT_FIELD_REF:
+ case VIEW_CONVERT_EXPR:
/* Bitfields and casts are never addressable. */
- return true;
+ found = t;
+ break;
+
+ default:
+ gcc_unreachable ();
}
+ if (get_alias_set (TREE_TYPE (TREE_OPERAND (t, 0))) == 0)
+ found = t;
+
t = TREE_OPERAND (t, 0);
- if (get_alias_set (TREE_TYPE (t)) == 0)
- return true;
}
+
+ if (found)
+ return TREE_OPERAND (found, 0);
+
+ return NULL_TREE;
+}
+
+
+/* Return whether the pointer-type T effective for aliasing may
+ access everything and thus the reference has to be assigned
+ alias-set zero. */
+
+static bool
+ref_all_alias_ptr_type_p (const_tree t)
+{
+ return (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE
+ || TYPE_REF_CAN_ALIAS_ALL (t));
}
/* Return the alias set for the memory pointed to by T, which may be
@@ -554,11 +573,6 @@ component_uses_parent_alias_set (const_tree t)
static alias_set_type
get_deref_alias_set_1 (tree t)
{
- /* If we're not doing any alias analysis, just assume everything
- aliases everything else. */
- if (!flag_strict_aliasing)
- return 0;
-
/* All we care about is the type. */
if (! TYPE_P (t))
t = TREE_TYPE (t);
@@ -566,8 +580,7 @@ get_deref_alias_set_1 (tree t)
/* If we have an INDIRECT_REF via a void pointer, we don't
know anything about what that might alias. Likewise if the
pointer is marked that way. */
- if (TREE_CODE (TREE_TYPE (t)) == VOID_TYPE
- || TYPE_REF_CAN_ALIAS_ALL (t))
+ if (ref_all_alias_ptr_type_p (t))
return 0;
return -1;
@@ -579,6 +592,11 @@ get_deref_alias_set_1 (tree t)
alias_set_type
get_deref_alias_set (tree t)
{
+ /* If we're not doing any alias analysis, just assume everything
+ aliases everything else. */
+ if (!flag_strict_aliasing)
+ return 0;
+
alias_set_type set = get_deref_alias_set_1 (t);
/* Fall back to the alias-set of the pointed-to type. */
@@ -592,6 +610,98 @@ get_deref_alias_set (tree t)
return set;
}
+/* Return the pointer-type relevant for TBAA purposes from the
+ memory reference tree *T or NULL_TREE in which case *T is
+ adjusted to point to the outermost component reference that
+ can be used for assigning an alias set. */
+
+static tree
+reference_alias_ptr_type_1 (tree *t)
+{
+ tree inner;
+
+ /* Get the base object of the reference. */
+ inner = *t;
+ while (handled_component_p (inner))
+ {
+ /* If there is a VIEW_CONVERT_EXPR in the chain we cannot use
+ the type of any component references that wrap it to
+ determine the alias-set. */
+ if (TREE_CODE (inner) == VIEW_CONVERT_EXPR)
+ *t = TREE_OPERAND (inner, 0);
+ inner = TREE_OPERAND (inner, 0);
+ }
+
+ /* Handle pointer dereferences here, they can override the
+ alias-set. */
+ if (INDIRECT_REF_P (inner)
+ && ref_all_alias_ptr_type_p (TREE_TYPE (TREE_OPERAND (inner, 0))))
+ return TREE_TYPE (TREE_OPERAND (inner, 0));
+ else if (TREE_CODE (inner) == TARGET_MEM_REF)
+ return TREE_TYPE (TMR_OFFSET (inner));
+ else if (TREE_CODE (inner) == MEM_REF
+ && ref_all_alias_ptr_type_p (TREE_TYPE (TREE_OPERAND (inner, 1))))
+ return TREE_TYPE (TREE_OPERAND (inner, 1));
+
+ /* If the innermost reference is a MEM_REF that has a
+ conversion embedded treat it like a VIEW_CONVERT_EXPR above,
+ using the memory access type for determining the alias-set. */
+ if (TREE_CODE (inner) == MEM_REF
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (inner))
+ != TYPE_MAIN_VARIANT
+ (TREE_TYPE (TREE_TYPE (TREE_OPERAND (inner, 1))))))
+ return TREE_TYPE (TREE_OPERAND (inner, 1));
+
+ /* Otherwise, pick up the outermost object that we could have
+ a pointer to. */
+ tree tem = component_uses_parent_alias_set_from (*t);
+ if (tem)
+ *t = tem;
+
+ return NULL_TREE;
+}
+
+/* Return the pointer-type relevant for TBAA purposes from the
+ gimple memory reference tree T. This is the type to be used for
+ the offset operand of MEM_REF or TARGET_MEM_REF replacements of T
+ and guarantees that get_alias_set will return the same alias
+ set for T and the replacement. */
+
+tree
+reference_alias_ptr_type (tree t)
+{
+ tree ptype = reference_alias_ptr_type_1 (&t);
+ /* If there is a given pointer type for aliasing purposes, return it. */
+ if (ptype != NULL_TREE)
+ return ptype;
+
+ /* Otherwise build one from the outermost component reference we
+ may use. */
+ if (TREE_CODE (t) == MEM_REF
+ || TREE_CODE (t) == TARGET_MEM_REF)
+ return TREE_TYPE (TREE_OPERAND (t, 1));
+ else
+ return build_pointer_type (TYPE_MAIN_VARIANT (TREE_TYPE (t)));
+}
+
+/* Return whether the pointer-types T1 and T2 used to determine
+ two alias sets of two references will yield the same answer
+ from get_deref_alias_set. */
+
+bool
+alias_ptr_types_compatible_p (tree t1, tree t2)
+{
+ if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
+ return true;
+
+ if (ref_all_alias_ptr_type_p (t1)
+ || ref_all_alias_ptr_type_p (t2))
+ return false;
+
+ return (TYPE_MAIN_VARIANT (TREE_TYPE (t1))
+ == TYPE_MAIN_VARIANT (TREE_TYPE (t2)));
+}
+
/* Return the alias set for T, which may be either a type or an
expression. Call language-specific routine for help, if needed. */
@@ -615,8 +725,6 @@ get_alias_set (tree t)
aren't types. */
if (! TYPE_P (t))
{
- tree inner;
-
/* Give the language a chance to do something with this tree
before we look at it. */
STRIP_NOPS (t);
@@ -624,51 +732,11 @@ get_alias_set (tree t)
if (set != -1)
return set;
- /* Get the base object of the reference. */
- inner = t;
- while (handled_component_p (inner))
- {
- /* If there is a VIEW_CONVERT_EXPR in the chain we cannot use
- the type of any component references that wrap it to
- determine the alias-set. */
- if (TREE_CODE (inner) == VIEW_CONVERT_EXPR)
- t = TREE_OPERAND (inner, 0);
- inner = TREE_OPERAND (inner, 0);
- }
-
- /* Handle pointer dereferences here, they can override the
- alias-set. */
- if (INDIRECT_REF_P (inner))
- {
- set = get_deref_alias_set_1 (TREE_OPERAND (inner, 0));
- if (set != -1)
- return set;
- }
- else if (TREE_CODE (inner) == TARGET_MEM_REF)
- return get_deref_alias_set (TMR_OFFSET (inner));
- else if (TREE_CODE (inner) == MEM_REF)
- {
- set = get_deref_alias_set_1 (TREE_OPERAND (inner, 1));
- if (set != -1)
- return set;
- }
-
- /* If the innermost reference is a MEM_REF that has a
- conversion embedded treat it like a VIEW_CONVERT_EXPR above,
- using the memory access type for determining the alias-set. */
- if (TREE_CODE (inner) == MEM_REF
- && TYPE_MAIN_VARIANT (TREE_TYPE (inner))
- != TYPE_MAIN_VARIANT
- (TREE_TYPE (TREE_TYPE (TREE_OPERAND (inner, 1)))))
- return get_deref_alias_set (TREE_OPERAND (inner, 1));
-
- /* Otherwise, pick up the outermost object that we could have a pointer
- to, processing conversions as above. */
- while (component_uses_parent_alias_set (t))
- {
- t = TREE_OPERAND (t, 0);
- STRIP_NOPS (t);
- }
+ /* Get the alias pointer-type to use or the outermost object
+ that we could have a pointer to. */
+ tree ptype = reference_alias_ptr_type_1 (&t);
+ if (ptype != NULL)
+ return get_deref_alias_set (ptype);
/* If we've already determined the alias set for a decl, just return
it. This is necessary for C++ anonymous unions, whose component
diff --git a/gcc/alias.h b/gcc/alias.h
index af739a8eef6..ff190eb094e 100644
--- a/gcc/alias.h
+++ b/gcc/alias.h
@@ -33,7 +33,7 @@ extern alias_set_type get_alias_set (tree);
extern alias_set_type get_deref_alias_set (tree);
extern alias_set_type get_varargs_alias_set (void);
extern alias_set_type get_frame_alias_set (void);
-extern bool component_uses_parent_alias_set (const_tree);
+extern tree component_uses_parent_alias_set_from (const_tree);
extern bool alias_set_subset_of (alias_set_type, alias_set_type);
extern void record_alias_subset (alias_set_type, alias_set_type);
extern void record_component_aliases (tree);
@@ -41,6 +41,8 @@ extern int alias_sets_conflict_p (alias_set_type, alias_set_type);
extern int alias_sets_must_conflict_p (alias_set_type, alias_set_type);
extern int objects_must_conflict_p (tree, tree);
extern int nonoverlapping_memrefs_p (const_rtx, const_rtx, bool);
+tree reference_alias_ptr_type (tree);
+bool alias_ptr_types_compatible_p (tree, tree);
/* This alias set can be used to force a memory to conflict with all
other memories, creating a barrier across which no memory reference
diff --git a/gcc/alloc-pool.c b/gcc/alloc-pool.c
index 65907544565..64535685de0 100644
--- a/gcc/alloc-pool.c
+++ b/gcc/alloc-pool.c
@@ -316,7 +316,7 @@ pool_alloc (alloc_pool pool)
/* Pull the first free element from the free list, and return it. */
header = pool->returned_free_list;
- VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (header, sizeof(*header)));
+ VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (header, sizeof (*header)));
pool->returned_free_list = header->next;
pool->elts_free--;
diff --git a/gcc/asan.c b/gcc/asan.c
index afe52602232..c037ebfd62f 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "gimple.h"
#include "tree-iterator.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "asan.h"
#include "gimple-pretty-print.h"
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "hash-table.h"
#include "alloc-pool.h"
#include "cfgloop.h"
+#include "gimple-builder.h"
/* AddressSanitizer finds out-of-bounds and use-after-free bugs
with <2x slowdown on average.
@@ -908,7 +909,7 @@ asan_clear_shadow (rtx shadow_mem, HOST_WIDE_INT len)
emit_cmp_and_jump_insns (addr, end, LT, NULL_RTX, Pmode, true, top_label);
jump = get_last_insn ();
gcc_assert (JUMP_P (jump));
- add_reg_note (jump, REG_BR_PROB, GEN_INT (REG_BR_PROB_BASE * 80 / 100));
+ add_int_reg_note (jump, REG_BR_PROB, REG_BR_PROB_BASE * 80 / 100);
}
/* Insert code to protect stack vars. The prologue sequence should be emitted
@@ -2267,12 +2268,12 @@ const pass_data pass_data_asan =
class pass_asan : public gimple_opt_pass
{
public:
- pass_asan(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_asan, ctxt)
+ pass_asan (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_asan, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_asan (ctxt_); }
+ opt_pass * clone () { return new pass_asan (m_ctxt); }
bool gate () { return gate_asan (); }
unsigned int execute () { return asan_instrument (); }
@@ -2313,8 +2314,8 @@ const pass_data pass_data_asan_O0 =
class pass_asan_O0 : public gimple_opt_pass
{
public:
- pass_asan_O0(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_asan_O0, ctxt)
+ pass_asan_O0 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_asan_O0, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c
index 0d92b1d79b5..6006b70c085 100644
--- a/gcc/auto-inc-dec.c
+++ b/gcc/auto-inc-dec.c
@@ -1452,9 +1452,9 @@ merge_in_block (int max_reg, basic_block bb)
{
/* In this case, we must clear these vectors since the trick of
testing if the stale insn in the block will not work. */
- memset (reg_next_use, 0, max_reg * sizeof(rtx));
- memset (reg_next_inc_use, 0, max_reg * sizeof(rtx));
- memset (reg_next_def, 0, max_reg * sizeof(rtx));
+ memset (reg_next_use, 0, max_reg * sizeof (rtx));
+ memset (reg_next_inc_use, 0, max_reg * sizeof (rtx));
+ memset (reg_next_def, 0, max_reg * sizeof (rtx));
df_recompute_luids (bb);
merge_in_block (max_reg, bb);
}
@@ -1526,8 +1526,8 @@ const pass_data pass_data_inc_dec =
class pass_inc_dec : public rtl_opt_pass
{
public:
- pass_inc_dec(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_inc_dec, ctxt)
+ pass_inc_dec (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_inc_dec, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index ad04d4de83e..acb5ea8d54a 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -214,8 +214,8 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d
struct rtl_bb_info, so that inlining the former into basic_block_def
is the better choice. */
typedef int __assert_gimple_bb_smaller_rtl_bb
- [(int)sizeof(struct rtl_bb_info)
- - (int)sizeof (struct gimple_bb_info)];
+ [(int) sizeof (struct rtl_bb_info)
+ - (int) sizeof (struct gimple_bb_info)];
#define BB_FREQ_MAX 10000
@@ -324,9 +324,9 @@ struct GTY(()) control_flow_graph {
#define profile_status_for_function(FN) ((FN)->cfg->x_profile_status)
#define BASIC_BLOCK_FOR_FUNCTION(FN,N) \
- ((*basic_block_info_for_function(FN))[(N)])
+ ((*basic_block_info_for_function (FN))[(N)])
#define SET_BASIC_BLOCK_FOR_FUNCTION(FN,N,BB) \
- ((*basic_block_info_for_function(FN))[(N)] = (BB))
+ ((*basic_block_info_for_function (FN))[(N)] = (BB))
/* Defines for textual backward source compatibility. */
#define ENTRY_BLOCK_PTR (cfun->cfg->x_entry_block_ptr)
@@ -353,7 +353,7 @@ struct GTY(()) control_flow_graph {
#define FOR_EACH_BB_REVERSE_FN(BB, FN) \
FOR_BB_BETWEEN (BB, (FN)->cfg->x_exit_block_ptr->prev_bb, (FN)->cfg->x_entry_block_ptr, prev_bb)
-#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN(BB, cfun)
+#define FOR_EACH_BB_REVERSE(BB) FOR_EACH_BB_REVERSE_FN (BB, cfun)
/* For iterating over insns in basic block. */
#define FOR_BB_INSNS(BB, INSN) \
@@ -479,7 +479,7 @@ private:
void clear_control_dependence_bitmap (basic_block);
void find_control_dependence (int);
vec<bitmap> control_dependence_map;
- edge_list *el;
+ edge_list *m_el;
};
/* The base value for branch probability notes and edge probabilities. */
@@ -951,7 +951,7 @@ extern void default_rtl_profile (void);
/* In profile.c. */
typedef struct gcov_working_set_info gcov_working_set_t;
-extern gcov_working_set_t *find_working_set(unsigned pct_times_10);
+extern gcov_working_set_t *find_working_set (unsigned pct_times_10);
/* Check tha probability is sane. */
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 6b034aba5c9..b89f9855e77 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2329,8 +2329,8 @@ const pass_data pass_data_reorder_blocks =
class pass_reorder_blocks : public rtl_opt_pass
{
public:
- pass_reorder_blocks(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_reorder_blocks, ctxt)
+ pass_reorder_blocks (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_reorder_blocks, ctxt)
{}
/* opt_pass methods: */
@@ -2495,8 +2495,8 @@ const pass_data pass_data_duplicate_computed_gotos =
class pass_duplicate_computed_gotos : public rtl_opt_pass
{
public:
- pass_duplicate_computed_gotos(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_duplicate_computed_gotos, ctxt)
+ pass_duplicate_computed_gotos (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_duplicate_computed_gotos, ctxt)
{}
/* opt_pass methods: */
@@ -2719,8 +2719,8 @@ const pass_data pass_data_partition_blocks =
class pass_partition_blocks : public rtl_opt_pass
{
public:
- pass_partition_blocks(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_partition_blocks, ctxt)
+ pass_partition_blocks (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_partition_blocks, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 2c5d228fdd1..ecaca42d00e 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -811,7 +811,7 @@ bitmap_first_set_bit (const_bitmap a)
bit_no += ix * BITMAP_WORD_BITS;
#if GCC_VERSION >= 3004
- gcc_assert (sizeof(long) == sizeof (word));
+ gcc_assert (sizeof (long) == sizeof (word));
bit_no += __builtin_ctzl (word);
#else
/* Binary search for the first set bit. */
@@ -863,7 +863,7 @@ bitmap_last_set_bit (const_bitmap a)
found_bit:
bit_no += ix * BITMAP_WORD_BITS;
#if GCC_VERSION >= 3004
- gcc_assert (sizeof(long) == sizeof (word));
+ gcc_assert (sizeof (long) == sizeof (word));
bit_no += BITMAP_WORD_BITS - __builtin_clzl (word) - 1;
#else
/* Hopefully this is a twos-complement host... */
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index ada414d8836..b3cb5da98e9 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -300,7 +300,7 @@ extern unsigned bitmap_first_set_bit (const_bitmap);
extern unsigned bitmap_last_set_bit (const_bitmap);
/* Compute bitmap hash (for purposes of hashing etc.) */
-extern hashval_t bitmap_hash(const_bitmap);
+extern hashval_t bitmap_hash (const_bitmap);
/* Allocate a bitmap from a bit obstack. */
#define BITMAP_ALLOC(OBSTACK) bitmap_obstack_alloc (OBSTACK)
diff --git a/gcc/bt-load.c b/gcc/bt-load.c
index b53435680ec..5384d01d525 100644
--- a/gcc/bt-load.c
+++ b/gcc/bt-load.c
@@ -605,7 +605,7 @@ compute_defs_uses_and_gen (fibheap_t all_btr_defs, btr_def *def_array,
}
if (dump_file)
- dump_btrs_live(i);
+ dump_btrs_live (i);
}
}
@@ -691,13 +691,13 @@ link_btr_uses (btr_def *def_array, btr_user *use_array, sbitmap *bb_out,
for this one. */
bitmap_and_compl (reaching_defs, reaching_defs,
btr_defset[def->btr - first_btr]);
- bitmap_set_bit(reaching_defs, insn_uid);
+ bitmap_set_bit (reaching_defs, insn_uid);
}
if (user != NULL)
{
/* Find all the reaching defs for this use. */
- sbitmap reaching_defs_of_reg = sbitmap_alloc(max_uid);
+ sbitmap reaching_defs_of_reg = sbitmap_alloc (max_uid);
unsigned int uid = 0;
sbitmap_iterator sbi;
@@ -1363,7 +1363,7 @@ migrate_btr_def (btr_def def, int min_cost)
if (btr != -1)
{
move_btr_def (attempt, btr, def, live_range, &btrs_live_in_range);
- bitmap_copy(live_range, def->live_range);
+ bitmap_copy (live_range, def->live_range);
btr_used_near_def = 0;
def_moved = 1;
def_basic_block_freq = basic_block_freq (def->bb);
@@ -1406,11 +1406,11 @@ migrate_btr_defs (enum reg_class btr_class, int allow_callee_save)
for (i = NUM_FIXED_BLOCKS; i < last_basic_block; i++)
{
basic_block bb = BASIC_BLOCK (i);
- fprintf(dump_file,
- "Basic block %d: count = " HOST_WIDEST_INT_PRINT_DEC
- " loop-depth = %d idom = %d\n",
- i, (HOST_WIDEST_INT) bb->count, bb_loop_depth (bb),
- get_immediate_dominator (CDI_DOMINATORS, bb)->index);
+ fprintf (dump_file,
+ "Basic block %d: count = " HOST_WIDEST_INT_PRINT_DEC
+ " loop-depth = %d idom = %d\n",
+ i, (HOST_WIDEST_INT) bb->count, bb_loop_depth (bb),
+ get_immediate_dominator (CDI_DOMINATORS, bb)->index);
}
}
@@ -1524,8 +1524,8 @@ const pass_data pass_data_branch_target_load_optimize1 =
class pass_branch_target_load_optimize1 : public rtl_opt_pass
{
public:
- pass_branch_target_load_optimize1(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_branch_target_load_optimize1, ctxt)
+ pass_branch_target_load_optimize1 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_branch_target_load_optimize1, ctxt)
{}
/* opt_pass methods: */
@@ -1593,8 +1593,8 @@ const pass_data pass_data_branch_target_load_optimize2 =
class pass_branch_target_load_optimize2 : public rtl_opt_pass
{
public:
- pass_branch_target_load_optimize2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_branch_target_load_optimize2, ctxt)
+ pass_branch_target_load_optimize2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_branch_target_load_optimize2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 3cee9e9282d..3b16d592db4 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "basic-block.h"
#include "tree-mudflap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "value-prof.h"
#include "diagnostic-core.h"
#include "builtins.h"
@@ -1703,7 +1703,7 @@ expand_builtin_apply (rtx function, rtx arguments, rtx argsize)
else
#endif
emit_stack_restore (SAVE_BLOCK, old_stack_level);
- fixup_args_size_notes (call_insn, get_last_insn(), 0);
+ fixup_args_size_notes (call_insn, get_last_insn (), 0);
OK_DEFER_POP;
@@ -4172,7 +4172,7 @@ std_canonical_va_list_type (tree type)
if (INDIRECT_REF_P (type))
type = TREE_TYPE (type);
- else if (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE(type)))
+ else if (POINTER_TYPE_P (type) && POINTER_TYPE_P (TREE_TYPE (type)))
type = TREE_TYPE (type);
wtype = va_list_type_node;
htype = type;
@@ -5342,7 +5342,7 @@ get_memmodel (tree exp)
return MEMMODEL_SEQ_CST;
}
- if ((INTVAL(op) & MEMMODEL_MASK) >= MEMMODEL_LAST)
+ if ((INTVAL (op) & MEMMODEL_MASK) >= MEMMODEL_LAST)
{
warning (OPT_Winvalid_memory_model,
"invalid memory model argument to builtin");
@@ -5546,7 +5546,7 @@ expand_builtin_atomic_fetch_op (enum machine_mode mode, tree exp, rtx target,
STRIP_NOPS (addr);
gcc_assert (TREE_OPERAND (addr, 0) == fndecl);
- TREE_OPERAND (addr, 0) = builtin_decl_explicit(ext_call);
+ TREE_OPERAND (addr, 0) = builtin_decl_explicit (ext_call);
/* Expand the call here so we can emit trailing code. */
ret = expand_call (exp, target, ignore);
@@ -9644,8 +9644,8 @@ static tree
fold_builtin_fma (location_t loc, tree arg0, tree arg1, tree arg2, tree type)
{
if (validate_arg (arg0, REAL_TYPE)
- && validate_arg(arg1, REAL_TYPE)
- && validate_arg(arg2, REAL_TYPE))
+ && validate_arg (arg1, REAL_TYPE)
+ && validate_arg (arg2, REAL_TYPE))
{
tree tem = fold_fma (loc, type, arg0, arg1, arg2);
if (tem)
@@ -10313,7 +10313,10 @@ fold_builtin_0 (location_t loc, tree fndecl, bool ignore ATTRIBUTE_UNUSED)
return fold_builtin_classify_type (NULL_TREE);
case BUILT_IN_UNREACHABLE:
- if (flag_sanitize & SANITIZE_UNREACHABLE)
+ if (flag_sanitize & SANITIZE_UNREACHABLE
+ && (current_function_decl == NULL
+ || !lookup_attribute ("no_sanitize_undefined",
+ DECL_ATTRIBUTES (current_function_decl))))
return ubsan_instrument_unreachable (loc);
break;
@@ -10384,13 +10387,13 @@ fold_builtin_1 (location_t loc, tree fndecl, tree arg0, bool ignore)
break;
CASE_FLT_FN (BUILT_IN_CCOS):
- return fold_builtin_ccos(loc, arg0, type, fndecl, /*hyper=*/ false);
+ return fold_builtin_ccos (loc, arg0, type, fndecl, /*hyper=*/ false);
CASE_FLT_FN (BUILT_IN_CCOSH):
- return fold_builtin_ccos(loc, arg0, type, fndecl, /*hyper=*/ true);
+ return fold_builtin_ccos (loc, arg0, type, fndecl, /*hyper=*/ true);
CASE_FLT_FN (BUILT_IN_CPROJ):
- return fold_builtin_cproj(loc, arg0, type);
+ return fold_builtin_cproj (loc, arg0, type);
CASE_FLT_FN (BUILT_IN_CSIN):
if (validate_arg (arg0, COMPLEX_TYPE)
@@ -10765,26 +10768,26 @@ fold_builtin_2 (location_t loc, tree fndecl, tree arg0, tree arg1, bool ignore)
CASE_FLT_FN (BUILT_IN_DREM):
CASE_FLT_FN (BUILT_IN_REMAINDER):
if (validate_arg (arg0, REAL_TYPE)
- && validate_arg(arg1, REAL_TYPE))
+ && validate_arg (arg1, REAL_TYPE))
return do_mpfr_arg2 (arg0, arg1, type, mpfr_remainder);
break;
CASE_FLT_FN_REENT (BUILT_IN_GAMMA): /* GAMMA_R */
CASE_FLT_FN_REENT (BUILT_IN_LGAMMA): /* LGAMMA_R */
if (validate_arg (arg0, REAL_TYPE)
- && validate_arg(arg1, POINTER_TYPE))
+ && validate_arg (arg1, POINTER_TYPE))
return do_mpfr_lgamma_r (arg0, arg1, type);
break;
CASE_FLT_FN (BUILT_IN_ATAN2):
if (validate_arg (arg0, REAL_TYPE)
- && validate_arg(arg1, REAL_TYPE))
+ && validate_arg (arg1, REAL_TYPE))
return do_mpfr_arg2 (arg0, arg1, type, mpfr_atan2);
break;
CASE_FLT_FN (BUILT_IN_FDIM):
if (validate_arg (arg0, REAL_TYPE)
- && validate_arg(arg1, REAL_TYPE))
+ && validate_arg (arg1, REAL_TYPE))
return do_mpfr_arg2 (arg0, arg1, type, mpfr_dim);
break;
@@ -10966,8 +10969,8 @@ fold_builtin_3 (location_t loc, tree fndecl,
CASE_FLT_FN (BUILT_IN_REMQUO):
if (validate_arg (arg0, REAL_TYPE)
- && validate_arg(arg1, REAL_TYPE)
- && validate_arg(arg2, POINTER_TYPE))
+ && validate_arg (arg1, REAL_TYPE)
+ && validate_arg (arg2, POINTER_TYPE))
return do_mpfr_remquo (arg0, arg1, arg2);
break;
@@ -13940,7 +13943,7 @@ do_mpfr_bessel_n (tree arg1, tree arg2, tree type,
&& host_integerp (arg1, 0)
&& TREE_CODE (arg2) == REAL_CST && !TREE_OVERFLOW (arg2))
{
- const HOST_WIDE_INT n = tree_low_cst(arg1, 0);
+ const HOST_WIDE_INT n = tree_low_cst (arg1, 0);
const REAL_VALUE_TYPE *const ra = &TREE_REAL_CST (arg2);
if (n == (long)n
@@ -14068,7 +14071,7 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type)
negative integer. */
if (real_isfinite (ra)
&& ra->cl != rvc_zero
- && !(real_isneg(ra) && real_isinteger(ra, TYPE_MODE (type))))
+ && !(real_isneg (ra) && real_isinteger (ra, TYPE_MODE (type))))
{
const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
const int prec = fmt->p;
@@ -14137,8 +14140,8 @@ do_mpc_arg1 (tree arg, tree type, int (*func)(mpc_ptr, mpc_srcptr, mpc_rnd_t))
mpc_t m;
mpc_init2 (m, prec);
- mpfr_from_real (mpc_realref(m), re, rnd);
- mpfr_from_real (mpc_imagref(m), im, rnd);
+ mpfr_from_real (mpc_realref (m), re, rnd);
+ mpfr_from_real (mpc_imagref (m), im, rnd);
mpfr_clear_flags ();
inexact = func (m, m, crnd);
result = do_mpc_ckconv (m, type, inexact, /*force_convert=*/ 0);
@@ -14193,10 +14196,10 @@ do_mpc_arg2 (tree arg0, tree arg1, tree type, int do_nonfinite,
mpc_init2 (m0, prec);
mpc_init2 (m1, prec);
- mpfr_from_real (mpc_realref(m0), re0, rnd);
- mpfr_from_real (mpc_imagref(m0), im0, rnd);
- mpfr_from_real (mpc_realref(m1), re1, rnd);
- mpfr_from_real (mpc_imagref(m1), im1, rnd);
+ mpfr_from_real (mpc_realref (m0), re0, rnd);
+ mpfr_from_real (mpc_imagref (m0), im0, rnd);
+ mpfr_from_real (mpc_realref (m1), re1, rnd);
+ mpfr_from_real (mpc_imagref (m1), im1, rnd);
mpfr_clear_flags ();
inexact = func (m0, m0, m1, crnd);
result = do_mpc_ckconv (m0, type, inexact, do_nonfinite);
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 4a93498299a..c7a8c7872cc 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,29 @@
+2013-09-25 Marek Polacek <polacek@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/58413
+ * c-ubsan.c (ubsan_instrument_shift): Don't instrument
+ an expression if we can prove it is correct.
+ (ubsan_instrument_division): Likewise. Remove unnecessary
+ check.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58411
+ * c-common.c (handle_no_sanitize_undefined_attribute): New function.
+ Declare it.
+ (struct attribute_spec c_common_att): Add no_sanitize_undefined.
+
+2013-09-14 Iain Sandoe <iain@codesourcery.com>
+
+ PR target/48094
+ * c.opt (fgnu-runtime, fnext-runtime, fobjc-abi-version,
+ fobjc-gc, freplace-objc-classes): Accept for LTO.
+
+2013-09-13 Jacek Caban <jacek@codeweavers.com>
+
+ * c-target.def: New hook
+
2013-09-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/43452
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 62aa9fcec2b..8ecb70cfa7c 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -311,6 +311,8 @@ static tree handle_no_sanitize_address_attribute (tree *, tree, tree,
int, bool *);
static tree handle_no_address_safety_analysis_attribute (tree *, tree, tree,
int, bool *);
+static tree handle_no_sanitize_undefined_attribute (tree *, tree, tree, int,
+ bool *);
static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
static tree handle_noclone_attribute (tree *, tree, tree, int, bool *);
static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
@@ -722,6 +724,9 @@ const struct attribute_spec c_common_attribute_table[] =
{ "no_sanitize_address", 0, 0, true, false, false,
handle_no_sanitize_address_attribute,
false },
+ { "no_sanitize_undefined", 0, 0, true, false, false,
+ handle_no_sanitize_undefined_attribute,
+ false },
{ "warning", 1, 1, true, false, false,
handle_error_attribute, false },
{ "error", 1, 1, true, false, false,
@@ -6575,6 +6580,22 @@ handle_no_address_safety_analysis_attribute (tree *node, tree name, tree, int,
return NULL_TREE;
}
+/* Handle a "no_sanitize_undefined" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_no_sanitize_undefined_attribute (tree *node, tree name, tree, int,
+ bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "noinline" attribute; arguments as in
struct attribute_spec.handler. */
diff --git a/gcc/c-family/c-target.def b/gcc/c-family/c-target.def
index 80042df40e7..925dbd14cc4 100644
--- a/gcc/c-family/c-target.def
+++ b/gcc/c-family/c-target.def
@@ -102,5 +102,15 @@ DEFHOOK
than just the compiler.",
const char *, (void),
hook_constcharptr_void_null)
+
+DEFHOOK
+(cxx_implicit_extern_c,
+ "Define this hook to add target-specific C++ implicit extern C functions.\
+ If this function returns true for the name of a file-scope function, that\
+ function implicitly gets extern \"C\" linkage rather than whatever language\
+ linkage the declaration would normally have. An example of such function\
+ is WinMain on Win32 targets.",
+ bool, (const char*),
+ NULL)
HOOK_VECTOR_END (C90_EMPTY_HACK)
diff --git a/gcc/c-family/c-ubsan.c b/gcc/c-family/c-ubsan.c
index 9f43f6d55b8..0bfc660cdd5 100644
--- a/gcc/c-family/c-ubsan.c
+++ b/gcc/c-family/c-ubsan.c
@@ -51,14 +51,6 @@ ubsan_instrument_division (location_t loc, tree op0, tree op1)
if (TREE_CODE (type) != INTEGER_TYPE)
return NULL_TREE;
- /* If we *know* that the divisor is not -1 or 0, we don't have to
- instrument this expression.
- ??? We could use decl_constant_value to cover up more cases. */
- if (TREE_CODE (op1) == INTEGER_CST
- && integer_nonzerop (op1)
- && !integer_minus_onep (op1))
- return NULL_TREE;
-
t = fold_build2 (EQ_EXPR, boolean_type_node,
op1, build_int_cst (type, 0));
@@ -74,6 +66,11 @@ ubsan_instrument_division (location_t loc, tree op0, tree op1)
t = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, t, x);
}
+ /* If the condition was folded to 0, no need to instrument
+ this expression. */
+ if (integer_zerop (t))
+ return NULL_TREE;
+
/* In case we have a SAVE_EXPR in a conditional context, we need to
make sure it gets evaluated before the condition. */
t = fold_build2 (COMPOUND_EXPR, TREE_TYPE (t), op0, t);
@@ -138,6 +135,11 @@ ubsan_instrument_shift (location_t loc, enum tree_code code,
tt = fold_build2 (TRUTH_OR_EXPR, boolean_type_node, x, tt);
}
+ /* If the condition was folded to 0, no need to instrument
+ this expression. */
+ if (integer_zerop (t) && (tt == NULL_TREE || integer_zerop (tt)))
+ return NULL_TREE;
+
/* In case we have a SAVE_EXPR in a conditional context, we need to
make sure it gets evaluated before the condition. */
t = fold_build2 (COMPOUND_EXPR, TREE_TYPE (t), op0, t);
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index f390f342c91..24d1b87d11f 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -945,7 +945,7 @@ C++ ObjC++ Var(flag_no_gnu_keywords, 0)
Recognize GNU-defined keywords
fgnu-runtime
-ObjC ObjC++ Report RejectNegative Var(flag_next_runtime,0) Init(NEXT_OBJC_RUNTIME)
+ObjC ObjC++ LTO Report RejectNegative Var(flag_next_runtime,0) Init(NEXT_OBJC_RUNTIME)
Generate code for GNU runtime environment
fgnu89-inline
@@ -1019,7 +1019,7 @@ fnew-abi
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
fnext-runtime
-ObjC ObjC++ Report RejectNegative Var(flag_next_runtime)
+ObjC ObjC++ LTO Report RejectNegative Var(flag_next_runtime)
Generate code for NeXT (Apple Mac OS X) runtime environment
fnil-receivers
@@ -1037,7 +1037,7 @@ C++ ObjC++ Optimization Var(flag_nothrow_opt)
Treat a throw() exception specification as noexcept to improve code size
fobjc-abi-version=
-ObjC ObjC++ Joined Report RejectNegative UInteger Var(flag_objc_abi)
+ObjC ObjC++ LTO Joined Report RejectNegative UInteger Var(flag_objc_abi)
Specify which ABI to use for Objective-C family code and meta-data generation.
; Generate special '- .cxx_construct' and '- .cxx_destruct' methods
@@ -1057,7 +1057,7 @@ ObjC ObjC++ Var(flag_objc_exceptions)
Enable Objective-C exception and synchronization syntax
fobjc-gc
-ObjC ObjC++ Var(flag_objc_gc)
+ObjC ObjC++ LTO Var(flag_objc_gc)
Enable garbage collection (GC) in Objective-C/Objective-C++ programs
fobjc-nilcheck
@@ -1117,7 +1117,7 @@ C++ ObjC++ Var(flag_pretty_templates) Init(1)
-fno-pretty-templates Do not pretty-print template specializations as the template signature followed by the arguments
freplace-objc-classes
-ObjC ObjC++ Var(flag_replace_objc_classes)
+ObjC ObjC++ LTO Var(flag_replace_objc_classes)
Used in Fix-and-Continue mode to indicate that object files may be swapped in at runtime
frepo
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 1b4b2977294..a22d51d8121 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,34 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (c/gccspec.o): Remove.
+ (CFLAGS-c/gccspec.o): New variable.
+ (cc1-checksum.o, C_TREE_H, c/c-aux-info.o, c/c-convert.o)
+ (c/c-decl.o, c/c-errors.o, c/c-lang.o, c/c-objc-common.o)
+ (c/c-parser.o, c/c-typeck.o, c/c-array-notation.o): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (c/gccspec.o): Don't use subshell.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitize/58443
+ * c-typeck.c (build_binary_op): Properly honor -fsanitize options.
+ Remove unnecessary check.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58411
+ * c-typeck.c (build_binary_op): Don't sanitize function if it has the
+ no_sanitize_undefined attribute.
+
+2013-09-13 Kai Tietz <ktietz@redhat.com>
+
+ PR target/57848
+ * c-decl.c (c_builtin_function_ext_scope): Remove
+ wrong assumption that it is never called on prexisting
+ symbol.
+
2013-09-08 Joern Rennecke <joern.rennecke@embecosm.com>
* c-typeck.c (build_binary_op): Use vector_types_compatible_elements_p.
diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in
index 1161742c274..d79fc4f410c 100644
--- a/gcc/c/Make-lang.in
+++ b/gcc/c/Make-lang.in
@@ -44,12 +44,7 @@ c: cc1$(exeext)
# The C front end driver. This is different from the drivers for other
# front ends, because there is no C language specific driver (i.e. nothing
# is to cc1 as e.g. g++ is to cc1plus, or gfortran is to f951).
-c/gccspec.o: c/gccspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
- $(OPTS_H)
- (SHLIB='$(SHLIB)'; \
- $(COMPILER) $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $(DRIVER_DEFINES) \
- -c $(srcdir)/c/gccspec.c $(OUTPUT_OPTION))
+CFLAGS-c/gccspec.o += $(DRIVER_DEFINES)
# The C compiler itself.
@@ -72,8 +67,6 @@ cc1-checksum.c : build/genchecksum$(build_exeext) checksum-options \
checksum-options > cc1-checksum.c.tmp && \
$(srcdir)/../move-if-change cc1-checksum.c.tmp cc1-checksum.c
-cc1-checksum.o : cc1-checksum.c $(CONFIG_H) $(SYSTEM_H)
-
cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) \
cc1-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
@@ -145,55 +138,3 @@ c.stageprofile: stageprofile-start
c.stagefeedback: stagefeedback-start
-mv c/*$(objext) stagefeedback/c
-#
-# .o: .h dependencies.
-# C language specific files.
-C_TREE_H = c/c-tree.h $(C_COMMON_H) $(DIAGNOSTIC_H)
-c/c-aux-info.o : c/c-aux-info.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(C_TREE_H) $(TREE_H) $(FLAGS_H)
-
-c/c-convert.o : c/c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(C_TREE_H) $(FLAGS_H) $(C_COMMON_H) convert.h \
- langhooks.h $(TARGET_H)
-
-c/c-decl.o : c/c-decl.c c/c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(C_TREE_H) $(GGC_H) $(TARGET_H) $(FLAGS_H) $(FUNCTION_H) \
- output.h debug.h toplev.h intl.h $(TM_P_H) $(TREE_INLINE_H) \
- $(TIMEVAR_H) $(OPTS_H) $(C_PRAGMA_H) gt-c-c-decl.h $(CGRAPH_H) \
- $(HASH_TABLE_H) $(LANGHOOKS_DEF_H) \
- dumpfile.h $(C_COMMON_H) $(CPPLIB_H) $(DIAGNOSTIC_CORE_H) \
- $(INPUT_H) langhooks.h pointer-set.h tree-iterator.h \
- $(PLUGIN_H) c-family/c-ada-spec.h c-family/c-objc.h
-
-c/c-errors.o: c/c-errors.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) $(TM_P_H)
-
-c/c-lang.o : c/c-lang.c c/c-objc-common.h \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
- $(C_TREE_H) $(DIAGNOSTIC_CORE_H) \
- langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
- $(C_PRAGMA_H) $(TREE_INLINE_H)
-
-c/c-objc-common.o : c/c-objc-common.c c/c-objc-common.h \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(C_TREE_H) $(FLAGS_H) $(DIAGNOSTIC_H) \
- langhooks.h $(GGC_H) $(C_PRETTY_PRINT_H) intl.h \
- $(TREE_PRETTY_PRINT_H)
-
-c/c-parser.o : c/c-parser.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(C_TREE_H) $(C_COMMON_H) $(C_PRAGMA_H) $(CPPLIB_H) \
- $(GGC_H) $(TIMEVAR_H) $(INPUT_H) $(FLAGS_H) \
- gt-c-c-parser.h langhooks.h \
- $(VEC_H) $(TARGET_H) $(CGRAPH_H) $(PLUGIN_H) \
- c-family/c-objc.h
-
-c/c-typeck.o : c/c-typeck.c c/c-lang.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(C_TREE_H) $(TARGET_H) $(FLAGS_H) intl.h \
- langhooks.h tree-iterator.h $(BITMAP_H) $(GIMPLE_H) \
- c-family/c-objc.h c-family/c-common.h
-
-c/c-array-notation.o: c/c-array-notation.c c/c-lang.h $(CONFIG_H) \
- $(SYSTEM_H) coretypes.h $(TREE_H) $(C_TREE_H) $(TARGET_H) \
- intl.h output.h $(EXPR_H) langhooks.h tree-iterator.h $(BITMAP_H) \
- $(GIMPLE_H) c-family/c-objc.h
-
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index f7ae648f024..f26334829d8 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -3629,9 +3629,6 @@ c_builtin_function_ext_scope (tree decl)
const char *name = IDENTIFIER_POINTER (id);
C_DECL_BUILTIN_PROTOTYPE (decl) = prototype_p (type);
- /* Should never be called on a symbol with a preexisting meaning. */
- gcc_assert (!I_SYMBOL_BINDING (id));
-
bind (id, decl, external_scope, /*invisible=*/false, /*nested=*/false,
UNKNOWN_LOCATION);
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index e52533ecd6d..7ecafe4894c 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -10496,8 +10496,10 @@ build_binary_op (location_t location, enum tree_code code,
return error_mark_node;
}
- if (flag_sanitize & SANITIZE_UNDEFINED
+ if ((flag_sanitize & (SANITIZE_SHIFT | SANITIZE_DIVIDE))
&& current_function_decl != 0
+ && !lookup_attribute ("no_sanitize_undefined",
+ DECL_ATTRIBUTES (current_function_decl))
&& (doing_div_or_mod || doing_shift))
{
/* OP0 and/or OP1 might have side-effects. */
@@ -10505,9 +10507,9 @@ build_binary_op (location_t location, enum tree_code code,
op1 = c_save_expr (op1);
op0 = c_fully_fold (op0, false, NULL);
op1 = c_fully_fold (op1, false, NULL);
- if (doing_div_or_mod)
+ if (doing_div_or_mod && (flag_sanitize & SANITIZE_DIVIDE))
instrument_expr = ubsan_instrument_division (location, op0, op1);
- else if (doing_shift)
+ else if (doing_shift && (flag_sanitize & SANITIZE_SHIFT))
instrument_expr = ubsan_instrument_shift (location, code, op0, op1);
}
@@ -10535,7 +10537,7 @@ build_binary_op (location_t location, enum tree_code code,
ret = build1 (EXCESS_PRECISION_EXPR, semantic_result_type, ret);
protected_set_expr_location (ret, location);
- if ((flag_sanitize & SANITIZE_UNDEFINED) && instrument_expr != NULL)
+ if (instrument_expr != NULL)
ret = fold_build2 (COMPOUND_EXPR, TREE_TYPE (ret),
instrument_expr, ret);
diff --git a/gcc/calls.c b/gcc/calls.c
index 0c7f22566bc..f489f4baf75 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "except.h"
#include "dbgcnt.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
/* Like PREFERRED_STACK_BOUNDARY but in units of bytes, not bits. */
#define STACK_BYTES (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT)
@@ -1026,7 +1026,7 @@ store_unaligned_arguments_into_pseudos (struct arg_data *args, int num_actuals)
int bitsize = MIN (bytes * BITS_PER_UNIT, BITS_PER_WORD);
args[i].aligned_regs[j] = reg;
- word = extract_bit_field (word, bitsize, 0, 1, false, NULL_RTX,
+ word = extract_bit_field (word, bitsize, 0, 1, NULL_RTX,
word_mode, word_mode);
/* There is no need to restrict this code to loading items
@@ -1732,7 +1732,8 @@ internal_arg_pointer_based_exp_scan (void)
if (val != NULL_RTX)
{
if (idx >= internal_arg_pointer_exp_state.cache.length ())
- internal_arg_pointer_exp_state.cache.safe_grow_cleared(idx + 1);
+ internal_arg_pointer_exp_state.cache
+ .safe_grow_cleared (idx + 1);
internal_arg_pointer_exp_state.cache[idx] = val;
}
}
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index c4ea7dd0a1f..56853b9be13 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -389,18 +389,18 @@ control_dependences::find_control_dependence (int edge_index)
basic_block current_block;
basic_block ending_block;
- gcc_assert (INDEX_EDGE_PRED_BB (el, edge_index) != EXIT_BLOCK_PTR);
+ gcc_assert (INDEX_EDGE_PRED_BB (m_el, edge_index) != EXIT_BLOCK_PTR);
- if (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR)
+ if (INDEX_EDGE_PRED_BB (m_el, edge_index) == ENTRY_BLOCK_PTR)
ending_block = single_succ (ENTRY_BLOCK_PTR);
else
- ending_block = find_pdom (INDEX_EDGE_PRED_BB (el, edge_index));
+ ending_block = find_pdom (INDEX_EDGE_PRED_BB (m_el, edge_index));
- for (current_block = INDEX_EDGE_SUCC_BB (el, edge_index);
+ for (current_block = INDEX_EDGE_SUCC_BB (m_el, edge_index);
current_block != ending_block && current_block != EXIT_BLOCK_PTR;
current_block = find_pdom (current_block))
{
- edge e = INDEX_EDGE (el, edge_index);
+ edge e = INDEX_EDGE (m_el, edge_index);
/* For abnormal edges, we don't make current_block control
dependent because instructions that throw are always necessary
@@ -416,13 +416,13 @@ control_dependences::find_control_dependence (int edge_index)
list EL, ala Morgan, Section 3.6. */
control_dependences::control_dependences (struct edge_list *edges)
- : el (edges)
+ : m_el (edges)
{
timevar_push (TV_CONTROL_DEPENDENCES);
control_dependence_map.create (last_basic_block);
for (int i = 0; i < last_basic_block; ++i)
control_dependence_map.quick_push (BITMAP_ALLOC (NULL));
- for (int i = 0; i < NUM_EDGES (el); ++i)
+ for (int i = 0; i < NUM_EDGES (m_el); ++i)
find_control_dependence (i);
timevar_pop (TV_CONTROL_DEPENDENCES);
}
@@ -434,7 +434,7 @@ control_dependences::~control_dependences ()
for (unsigned i = 0; i < control_dependence_map.length (); ++i)
BITMAP_FREE (control_dependence_map[i]);
control_dependence_map.release ();
- free_edge_list (el);
+ free_edge_list (m_el);
}
/* Returns the bitmap of edges the basic-block I is dependent on. */
@@ -450,7 +450,7 @@ control_dependences::get_edges_dependent_on (int i)
edge
control_dependences::get_edge (int i)
{
- return INDEX_EDGE (el, i);
+ return INDEX_EDGE (m_el, i);
}
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index ac6aefb86df..a9ed5f14b17 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -542,7 +542,7 @@ compute_outgoing_frequencies (basic_block b)
if (note)
{
- probability = INTVAL (XEXP (note, 0));
+ probability = XINT (note, 0);
e = BRANCH_EDGE (b);
e->probability = probability;
e->count = apply_probability (b->count, probability);
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 6836a9e6e84..53a99755010 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -925,6 +925,24 @@ merge_memattrs (rtx x, rtx y)
set_mem_align (y, MEM_ALIGN (x));
}
}
+ if (code == MEM)
+ {
+ if (MEM_READONLY_P (x) != MEM_READONLY_P (y))
+ {
+ MEM_READONLY_P (x) = 0;
+ MEM_READONLY_P (y) = 0;
+ }
+ if (MEM_NOTRAP_P (x) != MEM_NOTRAP_P (y))
+ {
+ MEM_NOTRAP_P (x) = 0;
+ MEM_NOTRAP_P (y) = 0;
+ }
+ if (MEM_VOLATILE_P (x) != MEM_VOLATILE_P (y))
+ {
+ MEM_VOLATILE_P (x) = 1;
+ MEM_VOLATILE_P (y) = 1;
+ }
+ }
fmt = GET_RTX_FORMAT (code);
for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
@@ -3071,8 +3089,8 @@ const pass_data pass_data_jump =
class pass_jump : public rtl_opt_pass
{
public:
- pass_jump(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_jump, ctxt)
+ pass_jump (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_jump, ctxt)
{}
/* opt_pass methods: */
@@ -3115,8 +3133,8 @@ const pass_data pass_data_jump2 =
class pass_jump2 : public rtl_opt_pass
{
public:
- pass_jump2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_jump2, ctxt)
+ pass_jump2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_jump2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 4da5e7ea0cf..afb02a0801b 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "expr.h"
#include "langhooks.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "except.h"
#include "flags.h"
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "value-prof.h"
#include "target.h"
-#include "ssaexpand.h"
+#include "tree-outof-ssa.h"
#include "bitmap.h"
#include "sbitmap.h"
#include "cfgloop.h"
@@ -569,7 +569,7 @@ add_partitioned_vars_to_ptset (struct pt_solution *pt,
|| pt->vars == NULL
/* The pointed-to vars bitmap is shared, it is enough to
visit it once. */
- || pointer_set_insert(visited, pt->vars))
+ || pointer_set_insert (visited, pt->vars))
return;
bitmap_clear (temp);
@@ -1184,7 +1184,7 @@ expand_one_var (tree var, bool toplevel, bool really_expand)
{
/* stack_alignment_estimated shouldn't change after stack
realign decision made */
- gcc_assert(!crtl->stack_realign_processed);
+ gcc_assert (!crtl->stack_realign_processed);
crtl->stack_alignment_estimated = align;
}
@@ -1723,7 +1723,7 @@ expand_used_vars (void)
case SPCT_FLAG_DEFAULT:
if (cfun->calls_alloca || has_protected_decls)
- create_stack_guard();
+ create_stack_guard ();
break;
default:
@@ -1770,7 +1770,7 @@ expand_used_vars (void)
var_end_seq
= asan_emit_stack_protection (virtual_stack_vars_rtx,
data.asan_vec.address (),
- data.asan_decl_vec. address(),
+ data.asan_decl_vec. address (),
data.asan_vec.length ());
}
@@ -3154,7 +3154,12 @@ expand_debug_expr (tree exp)
&& GET_MODE (op0) != VOIDmode && GET_MODE (op1) != VOIDmode
&& GET_MODE (op0) != GET_MODE (op1))
{
- if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1)))
+ if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1))
+ /* If OP0 is a partial mode, then we must truncate, even if it has
+ the same bitsize as OP1 as GCC's representation of partial modes
+ is opaque. */
+ || (GET_MODE_CLASS (GET_MODE (op0)) == MODE_PARTIAL_INT
+ && GET_MODE_BITSIZE (GET_MODE (op0)) == GET_MODE_BITSIZE (GET_MODE (op1))))
op1 = simplify_gen_unary (TRUNCATE, GET_MODE (op0), op1,
GET_MODE (op1));
else
@@ -4929,8 +4934,8 @@ const pass_data pass_data_expand =
class pass_expand : public rtl_opt_pass
{
public:
- pass_expand(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_expand, ctxt)
+ pass_expand (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_expand, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 8331fa0e956..c12a62fca50 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "rtl.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "timevar.h"
#include "diagnostic-core.h"
#include "cfgloop.h"
@@ -1443,6 +1443,6 @@ account_profile_record (struct profile_record *record, int after_pass)
|| bb == EXIT_BLOCK_PTR_FOR_FUNCTION (cfun))
continue;
gcc_assert (cfg_hooks->account_profile_record);
- cfg_hooks->account_profile_record(bb, after_pass, record);
+ cfg_hooks->account_profile_record (bb, after_pass, record);
}
}
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 01287246c33..f39b1944ab6 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "flags.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "pointer-set.h"
#include "ggc.h"
#include "dumpfile.h"
@@ -433,7 +433,7 @@ flow_loops_find (struct loops *loops)
/* Gather all loop headers in reverse completion order and allocate
loop structures for loops that are not already present. */
- larray.create (loops->larray->length());
+ larray.create (loops->larray->length ());
for (b = 0; b < n_basic_blocks - NUM_FIXED_BLOCKS; b++)
{
basic_block header = BASIC_BLOCK (rc_order[b]);
@@ -509,7 +509,7 @@ flow_loops_find (struct loops *loops)
}
}
- larray.release();
+ larray.release ();
return loops;
}
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index cd2f527bb47..33d96fe5263 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -515,7 +515,7 @@ static inline unsigned
number_of_loops (struct function *fn)
{
struct loops *loops = loops_for_fn (fn);
- if (!fn)
+ if (!loops)
return 0;
return vec_safe_length (loops->larray);
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c
index cce5d467f57..b4840dcf014 100644
--- a/gcc/cfgloopmanip.c
+++ b/gcc/cfgloopmanip.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "rtl.h"
#include "basic-block.h"
#include "cfgloop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
static void copy_loops_to (struct loop **, int,
@@ -950,7 +950,7 @@ unloop (struct loop *loop, bool *irred_invalidated,
remove_bb_from_loops (body[i]);
add_bb_to_loop (body[i], loop_outer (loop));
}
- free(body);
+ free (body);
while (loop->inner)
{
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index eb6b312d5c8..85738a43f36 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -479,8 +479,8 @@ const pass_data pass_data_free_cfg =
class pass_free_cfg : public rtl_opt_pass
{
public:
- pass_free_cfg(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_free_cfg, ctxt)
+ pass_free_cfg (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_free_cfg, ctxt)
{}
/* opt_pass methods: */
@@ -1441,7 +1441,7 @@ void
emit_barrier_after_bb (basic_block bb)
{
rtx barrier = emit_barrier_after (BB_END (bb));
- gcc_assert (current_ir_type() == IR_RTL_CFGRTL
+ gcc_assert (current_ir_type () == IR_RTL_CFGRTL
|| current_ir_type () == IR_RTL_CFGLAYOUT);
if (current_ir_type () == IR_RTL_CFGLAYOUT)
BB_FOOTER (bb) = unlink_insn_chain (barrier, barrier);
@@ -1480,7 +1480,7 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
note = find_reg_note (BB_END (e->src), REG_BR_PROB, NULL_RTX);
if (note)
{
- int prob = INTVAL (XEXP (note, 0));
+ int prob = XINT (note, 0);
b->probability = prob;
/* Update this to use GCOV_COMPUTE_SCALE. */
@@ -2207,9 +2207,9 @@ update_br_prob_note (basic_block bb)
if (!JUMP_P (BB_END (bb)))
return;
note = find_reg_note (BB_END (bb), REG_BR_PROB, NULL_RTX);
- if (!note || INTVAL (XEXP (note, 0)) == BRANCH_EDGE (bb)->probability)
+ if (!note || XINT (note, 0) == BRANCH_EDGE (bb)->probability)
return;
- XEXP (note, 0) = GEN_INT (BRANCH_EDGE (bb)->probability);
+ XINT (note, 0) = BRANCH_EDGE (bb)->probability;
}
/* Get the last insn associated with block BB (that includes barriers and
@@ -2346,7 +2346,7 @@ verify_hot_cold_block_grouping (void)
again (in compgoto). Ensure we don't call this before going back
into linearized RTL when any layout fixes would have been committed. */
if (!crtl->bb_reorder_complete
- || current_ir_type() != IR_RTL_CFGRTL)
+ || current_ir_type () != IR_RTL_CFGRTL)
return err;
FOR_EACH_BB (bb)
@@ -2399,11 +2399,11 @@ rtl_verify_edges (void)
&& EDGE_COUNT (bb->succs) >= 2
&& any_condjump_p (BB_END (bb)))
{
- if (INTVAL (XEXP (note, 0)) != BRANCH_EDGE (bb)->probability
+ if (XINT (note, 0) != BRANCH_EDGE (bb)->probability
&& profile_status != PROFILE_ABSENT)
{
- error ("verify_flow_info: REG_BR_PROB does not match cfg %wi %i",
- INTVAL (XEXP (note, 0)), BRANCH_EDGE (bb)->probability);
+ error ("verify_flow_info: REG_BR_PROB does not match cfg %i %i",
+ XINT (note, 0), BRANCH_EDGE (bb)->probability);
err = 1;
}
}
@@ -3104,7 +3104,7 @@ purge_dead_edges (basic_block bb)
b = BRANCH_EDGE (bb);
f = FALLTHRU_EDGE (bb);
- b->probability = INTVAL (XEXP (note, 0));
+ b->probability = XINT (note, 0);
f->probability = REG_BR_PROB_BASE - b->probability;
/* Update these to use GCOV_COMPUTE_SCALE. */
b->count = bb->count * b->probability / REG_BR_PROB_BASE;
@@ -3484,8 +3484,8 @@ const pass_data pass_data_into_cfg_layout_mode =
class pass_into_cfg_layout_mode : public rtl_opt_pass
{
public:
- pass_into_cfg_layout_mode(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_into_cfg_layout_mode, ctxt)
+ pass_into_cfg_layout_mode (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_into_cfg_layout_mode, ctxt)
{}
/* opt_pass methods: */
@@ -3521,8 +3521,8 @@ const pass_data pass_data_outof_cfg_layout_mode =
class pass_outof_cfg_layout_mode : public rtl_opt_pass
{
public:
- pass_outof_cfg_layout_mode(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_outof_cfg_layout_mode, ctxt)
+ pass_outof_cfg_layout_mode (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_outof_cfg_layout_mode, ctxt)
{}
/* opt_pass methods: */
@@ -3735,7 +3735,7 @@ fixup_reorder_chain (void)
rtx note = find_reg_note (bb_end_insn, REG_BR_PROB, 0);
if (note
- && INTVAL (XEXP (note, 0)) < REG_BR_PROB_BASE / 2
+ && XINT (note, 0) < REG_BR_PROB_BASE / 2
&& invert_jump (bb_end_insn,
(e_fall->dest == EXIT_BLOCK_PTR
? NULL_RTX
@@ -4887,7 +4887,7 @@ rtl_lv_add_condition_to_bb (basic_block first_head ,
end_sequence ();
/* Add the new cond , in the new head. */
- emit_insn_after(seq, BB_END(cond_bb));
+ emit_insn_after (seq, BB_END (cond_bb));
}
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index f12bf1ba4be..124ee0adf85 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "timevar.h"
#include "dumpfile.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "value-prof.h"
#include "except.h"
#include "diagnostic-core.h"
@@ -870,12 +870,12 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
edge->call_stmt_cannot_inline_p = true;
else
edge->call_stmt_cannot_inline_p = false;
- if (call_stmt && caller->call_site_hash)
- cgraph_add_edge_to_call_site_hash (edge);
edge->indirect_info = NULL;
edge->indirect_inlining_edge = 0;
edge->speculative = false;
+ if (call_stmt && caller->call_site_hash)
+ cgraph_add_edge_to_call_site_hash (edge);
return edge;
}
@@ -1188,7 +1188,9 @@ cgraph_resolve_speculation (struct cgraph_edge *edge, tree callee_decl)
gcc_assert (edge->speculative);
cgraph_speculative_call_info (edge, e2, edge, ref);
- if (ref->referred->symbol.decl != callee_decl)
+ if (!callee_decl
+ || !symtab_semantically_equivalent_p ((symtab_node) ref->referred,
+ symtab_get_node (callee_decl)))
{
if (dump_file)
{
@@ -1633,7 +1635,7 @@ release_function_body (tree decl)
}
if (cfun->value_histograms)
free_histograms ();
- pop_cfun();
+ pop_cfun ();
gimple_set_body (decl, NULL);
/* Struct function hangs a lot of data that would leak if we didn't
removed all pointers to it. */
@@ -1760,7 +1762,7 @@ cgraph_remove_node (struct cgraph_node *node)
/* Clear out the node to NULL all pointers and add the node to the free
list. */
- memset (node, 0, sizeof(*node));
+ memset (node, 0, sizeof (*node));
node->symbol.type = SYMTAB_FUNCTION;
node->uid = uid;
SET_NEXT_FREE_NODE (node, free_nodes);
@@ -1945,13 +1947,13 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, "(%.2f per call) ",
edge->frequency / (double)CGRAPH_FREQ_BASE);
if (edge->speculative)
- fprintf(f, "(speculative) ");
+ fprintf (f, "(speculative) ");
if (!edge->inline_failed)
- fprintf(f, "(inlined) ");
+ fprintf (f, "(inlined) ");
if (edge->indirect_inlining_edge)
- fprintf(f, "(indirect_inlining) ");
+ fprintf (f, "(indirect_inlining) ");
if (edge->can_throw_external)
- fprintf(f, "(can throw external) ");
+ fprintf (f, "(can throw external) ");
}
fprintf (f, "\n Calls: ");
@@ -1960,11 +1962,11 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, "%s/%i ", cgraph_node_asm_name (edge->callee),
edge->callee->symbol.order);
if (edge->speculative)
- fprintf(f, "(speculative) ");
+ fprintf (f, "(speculative) ");
if (!edge->inline_failed)
- fprintf(f, "(inlined) ");
+ fprintf (f, "(inlined) ");
if (edge->indirect_inlining_edge)
- fprintf(f, "(indirect_inlining) ");
+ fprintf (f, "(indirect_inlining) ");
if (edge->count)
fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ",
(HOST_WIDEST_INT)edge->count);
@@ -1972,7 +1974,7 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node)
fprintf (f, "(%.2f per call) ",
edge->frequency / (double)CGRAPH_FREQ_BASE);
if (edge->can_throw_external)
- fprintf(f, "(can throw external) ");
+ fprintf (f, "(can throw external) ");
}
fprintf (f, "\n");
@@ -2048,6 +2050,8 @@ cgraph_function_body_availability (struct cgraph_node *node)
avail = AVAIL_LOCAL;
else if (node->symbol.alias && node->symbol.weakref)
cgraph_function_or_thunk_node (node, &avail);
+ else if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (node->symbol.decl)))
+ avail = AVAIL_OVERWRITABLE;
else if (!node->symbol.externally_visible)
avail = AVAIL_AVAILABLE;
/* Inline functions are safe to be analyzed even if their symbol can
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index a6a0a2438f7..afdeaba4c3d 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -757,7 +757,7 @@ void fixup_same_cpp_alias_visibility (symtab_node, symtab_node target, tree);
IN_SSA is true if the gimple is in SSA. */
basic_block init_lowered_empty_function (tree, bool);
void cgraph_reset_node (struct cgraph_node *);
-void expand_thunk (struct cgraph_node *);
+bool expand_thunk (struct cgraph_node *, bool);
/* In cgraphclones.c */
@@ -901,21 +901,21 @@ cgraph_node_asm_name (struct cgraph_node *node)
/* Return asm name of varpool node. */
static inline const char *
-varpool_node_asm_name(struct varpool_node *node)
+varpool_node_asm_name (struct varpool_node *node)
{
return symtab_node_asm_name ((symtab_node)node);
}
/* Return name of cgraph node. */
static inline const char *
-cgraph_node_name(struct cgraph_node *node)
+cgraph_node_name (struct cgraph_node *node)
{
return symtab_node_name ((symtab_node)node);
}
/* Return name of varpool node. */
static inline const char *
-varpool_node_name(struct varpool_node *node)
+varpool_node_name (struct varpool_node *node)
{
return symtab_node_name ((symtab_node)node);
}
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index b9c112fef4d..1b73a144f08 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "langhooks.h"
#include "pointer-set.h"
#include "cgraph.h"
@@ -393,8 +393,8 @@ const pass_data pass_data_build_cgraph_edges =
class pass_build_cgraph_edges : public gimple_opt_pass
{
public:
- pass_build_cgraph_edges(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_build_cgraph_edges, ctxt)
+ pass_build_cgraph_edges (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_build_cgraph_edges, ctxt)
{}
/* opt_pass methods: */
@@ -525,12 +525,12 @@ const pass_data pass_data_rebuild_cgraph_edges =
class pass_rebuild_cgraph_edges : public gimple_opt_pass
{
public:
- pass_rebuild_cgraph_edges(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_rebuild_cgraph_edges, ctxt)
+ pass_rebuild_cgraph_edges (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_rebuild_cgraph_edges, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_rebuild_cgraph_edges (ctxt_); }
+ opt_pass * clone () { return new pass_rebuild_cgraph_edges (m_ctxt); }
unsigned int execute () { return rebuild_cgraph_edges (); }
}; // class pass_rebuild_cgraph_edges
@@ -573,13 +573,13 @@ const pass_data pass_data_remove_cgraph_callee_edges =
class pass_remove_cgraph_callee_edges : public gimple_opt_pass
{
public:
- pass_remove_cgraph_callee_edges(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_remove_cgraph_callee_edges, ctxt)
+ pass_remove_cgraph_callee_edges (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_remove_cgraph_callee_edges, ctxt)
{}
/* opt_pass methods: */
opt_pass * clone () {
- return new pass_remove_cgraph_callee_edges (ctxt_);
+ return new pass_remove_cgraph_callee_edges (m_ctxt);
}
unsigned int execute () { return remove_cgraph_callee_edges (); }
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 54b97b91c78..cad10a7dcb0 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -70,7 +70,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "rtl.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "langhooks.h"
#include "pointer-set.h"
@@ -750,8 +750,8 @@ cgraph_function_versioning (struct cgraph_node *old_version_node,
SET_DECL_RTL (new_decl, NULL);
/* When the old decl was a con-/destructor make sure the clone isn't. */
- DECL_STATIC_CONSTRUCTOR(new_decl) = 0;
- DECL_STATIC_DESTRUCTOR(new_decl) = 0;
+ DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
+ DECL_STATIC_DESTRUCTOR (new_decl) = 0;
/* Create the new version's call-graph node.
and update the edges of the new node. */
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 9681df518cd..e01918cfbd4 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -164,7 +164,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "output.h"
#include "rtl.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "langhooks.h"
#include "pointer-set.h"
@@ -592,15 +592,21 @@ analyze_function (struct cgraph_node *node)
location_t saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (decl);
- if (node->symbol.alias)
- symtab_resolve_alias
- ((symtab_node) node, (symtab_node) cgraph_get_node (node->symbol.alias_target));
- else if (node->thunk.thunk_p)
+ if (node->thunk.thunk_p)
{
cgraph_create_edge (node, cgraph_get_node (node->thunk.alias),
- NULL, 0, CGRAPH_FREQ_BASE);
+ NULL, 0, CGRAPH_FREQ_BASE);
+ if (!expand_thunk (node, false))
+ {
+ node->thunk.alias = NULL;
+ node->symbol.analyzed = true;
+ return;
+ }
node->thunk.alias = NULL;
}
+ if (node->symbol.alias)
+ symtab_resolve_alias
+ ((symtab_node) node, (symtab_node) cgraph_get_node (node->symbol.alias_target));
else if (node->dispatcher_function)
{
/* Generate the dispatcher body of multi-versioned functions. */
@@ -844,7 +850,7 @@ walk_polymorphic_call_targets (pointer_set_t *reachable_call_targets,
dump_possible_polymorphic_call_targets
(cgraph_dump_file, edge);
- for (i = 0; i < targets.length(); i++)
+ for (i = 0; i < targets.length (); i++)
{
/* Do not bother to mark virtual methods in anonymous namespace;
either we will find use of virtual table defining it, or it is
@@ -866,7 +872,7 @@ walk_polymorphic_call_targets (pointer_set_t *reachable_call_targets,
make the edge direct. */
if (final)
{
- if (targets.length() <= 1)
+ if (targets.length () <= 1)
{
cgraph_node *target;
if (targets.length () == 1)
@@ -916,9 +922,11 @@ analyze_functions (void)
int i;
struct ipa_ref *ref;
bool changed = true;
+ location_t saved_loc = input_location;
bitmap_obstack_initialize (NULL);
cgraph_state = CGRAPH_STATE_CONSTRUCTION;
+ input_location = UNKNOWN_LOCATION;
/* Ugly, but the fixup can not happen at a time same body alias is created;
C++ FE is confused about the COMDAT groups being right. */
@@ -1099,6 +1107,8 @@ analyze_functions (void)
used by it. */
if (!seen_error ())
symtab_initialize_asm_name_hash ();
+
+ input_location = saved_loc;
}
/* Translate the ugly representation of aliases as alias pairs into nice
@@ -1428,10 +1438,12 @@ thunk_adjust (gimple_stmt_iterator * bsi,
return ret;
}
-/* Produce assembler for thunk NODE. */
+/* Expand thunk NODE to gimple if possible.
+ When OUTPUT_ASM_THUNK is true, also produce assembler for
+ thunks that are not lowered. */
-void
-expand_thunk (struct cgraph_node *node)
+bool
+expand_thunk (struct cgraph_node *node, bool output_asm_thunks)
{
bool this_adjusting = node->thunk.this_adjusting;
HOST_WIDE_INT fixed_offset = node->thunk.fixed_offset;
@@ -1441,14 +1453,6 @@ expand_thunk (struct cgraph_node *node)
tree thunk_fndecl = node->symbol.decl;
tree a;
- if (in_lto_p)
- cgraph_get_body (node);
- a = DECL_ARGUMENTS (thunk_fndecl);
-
- current_function_decl = thunk_fndecl;
-
- /* Ensure thunks are emitted in their correct sections. */
- resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
if (this_adjusting
&& targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset,
@@ -1457,10 +1461,23 @@ expand_thunk (struct cgraph_node *node)
const char *fnname;
tree fn_block;
tree restype = TREE_TYPE (TREE_TYPE (thunk_fndecl));
+
+ if (!output_asm_thunks)
+ return false;
+
+ if (in_lto_p)
+ cgraph_get_body (node);
+ a = DECL_ARGUMENTS (thunk_fndecl);
+ current_function_decl = thunk_fndecl;
+
+ /* Ensure thunks are emitted in their correct sections. */
+ resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
+
DECL_RESULT (thunk_fndecl)
= build_decl (DECL_SOURCE_LOCATION (thunk_fndecl),
RESULT_DECL, 0, restype);
+ DECL_CONTEXT (DECL_RESULT (thunk_fndecl)) = thunk_fndecl;
fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl));
/* The back end expects DECL_INITIAL to contain a BLOCK, so we
@@ -1502,6 +1519,15 @@ expand_thunk (struct cgraph_node *node)
gimple call;
gimple ret;
+ if (in_lto_p)
+ cgraph_get_body (node);
+ a = DECL_ARGUMENTS (thunk_fndecl);
+
+ current_function_decl = thunk_fndecl;
+
+ /* Ensure thunks are emitted in their correct sections. */
+ resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
+
DECL_IGNORED_P (thunk_fndecl) = 1;
bitmap_obstack_initialize (NULL);
@@ -1516,6 +1542,7 @@ expand_thunk (struct cgraph_node *node)
DECL_ARTIFICIAL (resdecl) = 1;
DECL_IGNORED_P (resdecl) = 1;
DECL_RESULT (thunk_fndecl) = resdecl;
+ DECL_CONTEXT (DECL_RESULT (thunk_fndecl)) = thunk_fndecl;
}
else
resdecl = DECL_RESULT (thunk_fndecl);
@@ -1552,6 +1579,7 @@ expand_thunk (struct cgraph_node *node)
for (i = 1, arg = DECL_CHAIN (a); i < nargs; i++, arg = DECL_CHAIN (arg))
vargs.quick_push (arg);
call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
+ node->callees->call_stmt = call;
vargs.release ();
gimple_call_set_from_thunk (call, true);
if (restmp)
@@ -1620,6 +1648,9 @@ expand_thunk (struct cgraph_node *node)
remove_edge (single_succ_edge (bb));
}
+ cfun->gimple_df->in_ssa_p = true;
+ /* FIXME: C++ FE should stop setting TREE_ASM_WRITTEN on thunks. */
+ TREE_ASM_WRITTEN (thunk_fndecl) = false;
delete_unreachable_blocks ();
update_ssa (TODO_update_ssa);
#ifdef ENABLE_CHECKING
@@ -1629,12 +1660,12 @@ expand_thunk (struct cgraph_node *node)
/* Since we want to emit the thunk, we explicitly mark its name as
referenced. */
node->thunk.thunk_p = false;
- rebuild_cgraph_edges ();
- cgraph_add_new_function (thunk_fndecl, true);
+ node->lowered = true;
bitmap_obstack_release (NULL);
}
current_function_decl = NULL;
set_cfun (NULL);
+ return true;
}
/* Assemble thunks and aliases associated to NODE. */
@@ -1653,7 +1684,7 @@ assemble_thunks_and_aliases (struct cgraph_node *node)
e = e->next_caller;
assemble_thunks_and_aliases (thunk);
- expand_thunk (thunk);
+ expand_thunk (thunk, true);
}
else
e = e->next_caller;
diff --git a/gcc/cif-code.def b/gcc/cif-code.def
index d1c49417325..e71123dc609 100644
--- a/gcc/cif-code.def
+++ b/gcc/cif-code.def
@@ -37,6 +37,9 @@ DEFCIFCODE(UNSPECIFIED , "")
functions that have not been rejected for inlining yet. */
DEFCIFCODE(FUNCTION_NOT_CONSIDERED, N_("function not considered for inlining"))
+/* Caller is compiled with optimizations disabled. */
+DEFCIFCODE(FUNCTION_NOT_OPTIMIZED, N_("caller is not optimized"))
+
/* Inlining failed owing to unavailable function body. */
DEFCIFCODE(BODY_NOT_AVAILABLE, N_("function body not available"))
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 43b9defafd8..84cf6b476e4 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -602,7 +602,7 @@ is_ctor_dtor (const char *s)
{
if (ch == p->name[0]
&& (!p->two_underscores || ((s - orig_s) >= 2))
- && strncmp(s, p->name, p->len) == 0)
+ && strncmp (s, p->name, p->len) == 0)
{
return p->ret;
}
@@ -777,7 +777,7 @@ maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst,
plus number of partitions. */
for (lto_ld_argv_size = 0; lto_ld_argv[lto_ld_argv_size]; lto_ld_argv_size++)
;
- out_lto_ld_argv = XCNEWVEC(char *, num_files + lto_ld_argv_size + 1);
+ out_lto_ld_argv = XCNEWVEC (char *, num_files + lto_ld_argv_size + 1);
out_lto_ld_argv_size = 0;
/* After running the LTO back end, we will relink, substituting
@@ -1644,9 +1644,9 @@ main (int argc, char **argv)
"%d destructors found\n",
destructors.number),
destructors.number);
- notice_translated (ngettext("%d frame table found\n",
- "%d frame tables found\n",
- frame_tables.number),
+ notice_translated (ngettext ("%d frame table found\n",
+ "%d frame tables found\n",
+ frame_tables.number),
frame_tables.number);
}
@@ -1698,7 +1698,7 @@ main (int argc, char **argv)
sort_ids (&constructors);
sort_ids (&destructors);
- maybe_unlink(output_file);
+ maybe_unlink (output_file);
outf = fopen (c_file, "w");
if (outf == (FILE *) 0)
fatal_error ("fopen %s: %m", c_file);
@@ -1812,8 +1812,8 @@ collect_wait (const char *prog, struct pex_obj *pex)
{
int sig = WTERMSIG (status);
error ("%s terminated with signal %d [%s]%s",
- prog, sig, strsignal(sig),
- WCOREDUMP(status) ? ", core dumped" : "");
+ prog, sig, strsignal (sig),
+ WCOREDUMP (status) ? ", core dumped" : "");
exit (FATAL_EXIT_CODE);
}
@@ -2255,8 +2255,8 @@ write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED)
if (shared_obj)
{
- COLLECT_SHARED_INIT_FUNC(stream, initname);
- COLLECT_SHARED_FINI_FUNC(stream, fininame);
+ COLLECT_SHARED_INIT_FUNC (stream, initname);
+ COLLECT_SHARED_FINI_FUNC (stream, fininame);
}
}
@@ -2727,16 +2727,16 @@ scan_libraries (const char *prog_name)
#if defined (EXTENDED_COFF)
-# define GCC_SYMBOLS(X) (SYMHEADER(X).isymMax + SYMHEADER(X).iextMax)
+# define GCC_SYMBOLS(X) (SYMHEADER (X).isymMax + SYMHEADER (X).iextMax)
# define GCC_SYMENT SYMR
# define GCC_OK_SYMBOL(X) ((X).st == stProc || (X).st == stGlobal)
# define GCC_SYMINC(X) (1)
-# define GCC_SYMZERO(X) (SYMHEADER(X).isymMax)
-# define GCC_CHECK_HDR(X) (PSYMTAB(X) != 0)
+# define GCC_SYMZERO(X) (SYMHEADER (X).isymMax)
+# define GCC_CHECK_HDR(X) (PSYMTAB (X) != 0)
#else
-# define GCC_SYMBOLS(X) (HEADER(ldptr).f_nsyms)
+# define GCC_SYMBOLS(X) (HEADER (ldptr).f_nsyms)
# define GCC_SYMENT SYMENT
# if defined (C_WEAKEXT)
# define GCC_OK_SYMBOL(X) \
@@ -2994,7 +2994,7 @@ scan_prog_file (const char *prog_name, scanpass which_pass,
while (ldclose (ldptr) == FAILURE);
#else
/* Otherwise we simply close ldptr. */
- (void) ldclose(ldptr);
+ (void) ldclose (ldptr);
#endif
}
#endif /* OBJECT_FORMAT_COFF */
@@ -3014,7 +3014,7 @@ resolve_lib_name (const char *name)
if (libpaths[i]->max_len > l)
l = libpaths[i]->max_len;
- lib_buf = XNEWVEC (char, l + strlen(name) + 10);
+ lib_buf = XNEWVEC (char, l + strlen (name) + 10);
for (i = 0; libpaths[i]; i++)
{
@@ -3025,7 +3025,7 @@ resolve_lib_name (const char *name)
may contain directories both with trailing DIR_SEPARATOR and
without it. */
const char *p = "";
- if (!IS_DIR_SEPARATOR (list->prefix[strlen(list->prefix)-1]))
+ if (!IS_DIR_SEPARATOR (list->prefix[strlen (list->prefix)-1]))
p = "/";
for (j = 0; j < 2; j++)
{
diff --git a/gcc/combine-stack-adj.c b/gcc/combine-stack-adj.c
index be47665ebc0..5ca131f346a 100644
--- a/gcc/combine-stack-adj.c
+++ b/gcc/combine-stack-adj.c
@@ -663,8 +663,8 @@ const pass_data pass_data_stack_adjustments =
class pass_stack_adjustments : public rtl_opt_pass
{
public:
- pass_stack_adjustments(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_stack_adjustments, ctxt)
+ pass_stack_adjustments (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_stack_adjustments, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/combine.c b/gcc/combine.c
index 335d3ddd6cd..fcf60cd08aa 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -735,7 +735,7 @@ do_SUBST (rtx *into, rtx newval)
buf->next = undobuf.undos, undobuf.undos = buf;
}
-#define SUBST(INTO, NEWVAL) do_SUBST(&(INTO), (NEWVAL))
+#define SUBST(INTO, NEWVAL) do_SUBST (&(INTO), (NEWVAL))
/* Similar to SUBST, but NEWVAL is an int expression. Note that substitution
for the value of a HOST_WIDE_INT value (including CONST_INT) is
@@ -763,7 +763,7 @@ do_SUBST_INT (int *into, int newval)
buf->next = undobuf.undos, undobuf.undos = buf;
}
-#define SUBST_INT(INTO, NEWVAL) do_SUBST_INT(&(INTO), (NEWVAL))
+#define SUBST_INT(INTO, NEWVAL) do_SUBST_INT (&(INTO), (NEWVAL))
/* Similar to SUBST, but just substitute the mode. This is used when
changing the mode of a pseudo-register, so that any other
@@ -792,7 +792,7 @@ do_SUBST_MODE (rtx *into, enum machine_mode newval)
buf->next = undobuf.undos, undobuf.undos = buf;
}
-#define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE(&(INTO), (NEWVAL))
+#define SUBST_MODE(INTO, NEWVAL) do_SUBST_MODE (&(INTO), (NEWVAL))
#ifndef HAVE_cc0
/* Similar to SUBST, but NEWVAL is a LOG_LINKS expression. */
@@ -1197,8 +1197,8 @@ combine_instructions (rtx f, unsigned int nregs)
INSN_COST (insn) = insn_rtx_cost (PATTERN (insn),
optimize_this_for_speed_p);
if (dump_file)
- fprintf(dump_file, "insn_cost %d: %d\n",
- INSN_UID (insn), INSN_COST (insn));
+ fprintf (dump_file, "insn_cost %d: %d\n",
+ INSN_UID (insn), INSN_COST (insn));
}
}
@@ -2328,7 +2328,7 @@ can_change_dest_mode (rtx x, int added_sets, enum machine_mode mode)
{
unsigned int regno;
- if (!REG_P(x))
+ if (!REG_P (x))
return false;
regno = REGNO (x);
@@ -4279,7 +4279,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
df_insn_rescan (undobuf.other_insn);
}
- if (i0 && !(NOTE_P(i0) && (NOTE_KIND (i0) == NOTE_INSN_DELETED)))
+ if (i0 && !(NOTE_P (i0) && (NOTE_KIND (i0) == NOTE_INSN_DELETED)))
{
if (dump_file)
{
@@ -4289,7 +4289,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
df_insn_rescan (i0);
}
- if (i1 && !(NOTE_P(i1) && (NOTE_KIND (i1) == NOTE_INSN_DELETED)))
+ if (i1 && !(NOTE_P (i1) && (NOTE_KIND (i1) == NOTE_INSN_DELETED)))
{
if (dump_file)
{
@@ -4299,7 +4299,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
df_insn_rescan (i1);
}
- if (i2 && !(NOTE_P(i2) && (NOTE_KIND (i2) == NOTE_INSN_DELETED)))
+ if (i2 && !(NOTE_P (i2) && (NOTE_KIND (i2) == NOTE_INSN_DELETED)))
{
if (dump_file)
{
@@ -4309,7 +4309,7 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
df_insn_rescan (i2);
}
- if (i3 && !(NOTE_P(i3) && (NOTE_KIND (i3) == NOTE_INSN_DELETED)))
+ if (i3 && !(NOTE_P (i3) && (NOTE_KIND (i3) == NOTE_INSN_DELETED)))
{
if (dump_file)
{
@@ -11015,7 +11015,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
this shift are known to be zero for both inputs and if the type of
comparison is compatible with the shift. */
if (GET_CODE (op0) == GET_CODE (op1)
- && HWI_COMPUTABLE_MODE_P (GET_MODE(op0))
+ && HWI_COMPUTABLE_MODE_P (GET_MODE (op0))
&& ((GET_CODE (op0) == ROTATE && (code == NE || code == EQ))
|| ((GET_CODE (op0) == LSHIFTRT || GET_CODE (op0) == ASHIFT)
&& (code != GT && code != LT && code != GE && code != LE))
@@ -13677,7 +13677,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2,
}
if (place2)
- add_reg_note (place2, REG_NOTE_KIND (note), XEXP (note, 0));
+ add_shallow_copy_of_reg_note (place2, note);
}
}
@@ -13875,8 +13875,8 @@ const pass_data pass_data_combine =
class pass_combine : public rtl_opt_pass
{
public:
- pass_combine(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_combine, ctxt)
+ pass_combine (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_combine, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/common.opt b/gcc/common.opt
index 6ed743f148a..7f6f20d1982 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2325,23 +2325,47 @@ Perform variable tracking and also tag variables that are uninitialized
ftree-vectorize
Common Report Var(flag_tree_vectorize) Optimization
-Enable loop vectorization on trees
+Enable vectorization on trees
ftree-vectorizer-verbose=
Common RejectNegative Joined UInteger Var(common_deferred_options) Defer
-ftree-vectorizer-verbose=<number> This switch is deprecated. Use -fopt-info instead.
+ftree-loop-vectorize
+Common Report Var(flag_tree_loop_vectorize) Optimization
+Enable loop vectorization on trees
+
ftree-slp-vectorize
-Common Report Var(flag_tree_slp_vectorize) Init(2) Optimization
+Common Report Var(flag_tree_slp_vectorize) Optimization
Enable basic block vectorization (SLP) on trees
+fvect-cost-model=
+Common Joined RejectNegative Enum(vect_cost_model) Var(flag_vect_cost_model) Init(VECT_COST_MODEL_DEFAULT)
+Specifies the cost model for vectorization
+
+Enum
+Name(vect_cost_model) Type(enum vect_cost_model) UnknownError(unknown vectorizer cost model %qs)
+
+EnumValue
+Enum(vect_cost_model) String(unlimited) Value(VECT_COST_MODEL_UNLIMITED)
+
+EnumValue
+Enum(vect_cost_model) String(dynamic) Value(VECT_COST_MODEL_DYNAMIC)
+
+EnumValue
+Enum(vect_cost_model) String(cheap) Value(VECT_COST_MODEL_CHEAP)
+
fvect-cost-model
-Common Report Var(flag_vect_cost_model) Optimization
-Enable use of cost model in vectorization
+Common RejectNegative Alias(fvect-cost-model=,dynamic)
+Enables the dynamic vectorizer cost model. Preserved for backward compatibility.
+
+fno-vect-cost-model
+Common RejectNegative Alias(fvect-cost-model=,unlimited)
+Enables the unlimited vectorizer cost model. Preserved for backward compatibility.
ftree-vect-loop-version
-Common Report Var(flag_tree_vect_loop_version) Init(1) Optimization
-Enable loop versioning when doing loop vectorization on trees
+Common Ignore
+Does nothing. Preserved for backward compatibility.
ftree-scev-cprop
Common Report Var(flag_tree_scev_cprop) Init(1) Optimization
diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c
index 8ca74b9be49..341637b4a10 100644
--- a/gcc/common/config/i386/i386-common.c
+++ b/gcc/common/config/i386/i386-common.c
@@ -811,7 +811,6 @@ ix86_option_init_struct (struct gcc_options *opts)
opts->x_flag_pcc_struct_return = 2;
opts->x_flag_asynchronous_unwind_tables = 2;
- opts->x_flag_vect_cost_model = 1;
}
/* On the x86 -fsplit-stack and -fstack-protector both use the same
diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c
index e907376c577..847c89128b4 100644
--- a/gcc/compare-elim.c
+++ b/gcc/compare-elim.c
@@ -243,13 +243,21 @@ find_flags_uses_in_insn (struct comparison *cmp, rtx insn)
cmp->missing_uses = true;
}
+class find_comparison_dom_walker : public dom_walker
+{
+public:
+ find_comparison_dom_walker (cdi_direction direction)
+ : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+};
+
/* Identify comparison instructions within BB. If the flags from the last
compare in the BB is live at the end of the block, install the compare
- in BB->AUX. Called via walk_dominators_tree. */
+ in BB->AUX. Called via dom_walker.walk (). */
-static void
-find_comparisons_in_bb (struct dom_walk_data *data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+find_comparison_dom_walker::before_dom_children (basic_block bb)
{
struct comparison *last_cmp;
rtx insn, next, last_clobber;
@@ -403,17 +411,10 @@ find_comparisons_in_bb (struct dom_walk_data *data ATTRIBUTE_UNUSED,
static void
find_comparisons (void)
{
- struct dom_walk_data data;
-
- memset (&data, 0, sizeof(data));
- data.dom_direction = CDI_DOMINATORS;
- data.before_dom_children = find_comparisons_in_bb;
-
calculate_dominance_info (CDI_DOMINATORS);
- init_walk_dominator_tree (&data);
- walk_dominator_tree (&data, ENTRY_BLOCK_PTR);
- fini_walk_dominator_tree (&data);
+ find_comparison_dom_walker (CDI_DOMINATORS)
+ .walk (cfun->cfg->x_entry_block_ptr);
clear_aux_for_blocks ();
free_dominance_info (CDI_DOMINATORS);
@@ -672,8 +673,8 @@ const pass_data pass_data_compare_elim_after_reload =
class pass_compare_elim_after_reload : public rtl_opt_pass
{
public:
- pass_compare_elim_after_reload(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_compare_elim_after_reload, ctxt)
+ pass_compare_elim_after_reload (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_compare_elim_after_reload, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 21e1fac1b6e..a4492af5ab3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1560,6 +1560,9 @@ x86_64-*-cygwin*)
i[34567]86-*-mingw* | x86_64-*-mingw*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/cygming.h"
xm_file=i386/xm-mingw32.h
+ c_target_objs="${c_target_objs} winnt-c.o"
+ cxx_target_objs="${cxx_target_objs} winnt-c.o"
+ target_has_targetcm="yes"
case ${target} in
x86_64-*-* | *-w64-*)
need_64bit_isa=yes
@@ -1599,7 +1602,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
esac
tm_file="${tm_file} i386/mingw-stdint.h"
- tmake_file="${tmake_file} i386/t-cygming t-slibgcc"
+ tmake_file="${tmake_file} t-winnt i386/t-cygming t-slibgcc"
case ${target} in
x86_64-w64-*)
tmake_file="${tmake_file} i386/t-mingw-w64"
@@ -2064,6 +2067,13 @@ mn10300-*-*)
use_collect2=no
use_gcc_stdint=wrap
;;
+msp430*-*-*)
+ tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
+ c_target_objs="msp430-c.o"
+ cxx_target_objs="msp430-c.o"
+ target_has_targetm_common=no
+ tmake_file="${tmake_file} msp430/t-msp430"
+ ;;
pdp11-*-*)
tm_file="${tm_file} newlib-stdint.h"
use_gcc_stdint=wrap
@@ -3898,7 +3908,9 @@ case ${target} in
;;
i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
;;
- i[34567]86-*-cygwin* | i[34567]86-*-mingw* | x86_64-*-mingw*)
+ i[34567]86-*-cygwin* | x86_64-*-cygwin*)
+ ;;
+ i[34567]86-*-mingw* | x86_64-*-mingw*)
;;
i[34567]86-*-freebsd* | x86_64-*-freebsd*)
;;
diff --git a/gcc/config.in b/gcc/config.in
index 23bc29aedef..75b1383b292 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -1723,12 +1723,6 @@
#endif
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#ifndef USED_FOR_TARGET
-#undef NO_MINUS_C_MINUS_O
-#endif
-
-
/* Define to the address where bug reports for this package should be sent. */
#ifndef USED_FOR_TARGET
#undef PACKAGE_BUGREPORT
diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c
index 6816b9cfdaa..0df5b3b0d77 100644
--- a/gcc/config/aarch64/aarch64-builtins.c
+++ b/gcc/config/aarch64/aarch64-builtins.c
@@ -989,6 +989,8 @@ aarch64_simd_expand_args (rtx target, int icode, int have_retval,
switch (thisarg)
{
case SIMD_ARG_COPY_TO_REG:
+ if (POINTER_TYPE_P (TREE_TYPE (arg[argc])))
+ op[argc] = convert_memory_address (Pmode, op[argc]);
/*gcc_assert (GET_MODE (op[argc]) == mode[argc]); */
if (!(*insn_data[icode].operand[argc + have_retval].predicate)
(op[argc], mode[argc]))
diff --git a/gcc/config/aarch64/aarch64-generic.md b/gcc/config/aarch64/aarch64-generic.md
index cbb75600389..12faac84348 100644
--- a/gcc/config/aarch64/aarch64-generic.md
+++ b/gcc/config/aarch64/aarch64-generic.md
@@ -30,9 +30,11 @@
(const_string "no")))
(define_insn_reservation "load" 2
- (eq_attr "is_load" "yes")
+ (and (eq_attr "generic_sched" "yes")
+ (eq_attr "is_load" "yes"))
"core")
(define_insn_reservation "nonload" 1
- (eq_attr "is_load" "no")
+ (and (eq_attr "generic_sched" "yes")
+ (eq_attr "is_load" "no"))
"core")
diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def
index 4046d7a7001..35897f39395 100644
--- a/gcc/config/aarch64/aarch64-simd-builtins.def
+++ b/gcc/config/aarch64/aarch64-simd-builtins.def
@@ -359,3 +359,6 @@
/* Implemented by aarch64_st1<VALL:mode>. */
BUILTIN_VALL (STORE1, st1, 0)
+ /* Implemented by fma<mode>4. */
+ BUILTIN_VDQF (TERNOP, fma, 4)
+
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 9805197a22b..f13cd5b7cdb 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -582,6 +582,59 @@
(set_attr "simd_mode" "<MODE>")]
)
+(define_insn "*aarch64_mul3_elt<mode>"
+ [(set (match_operand:VMUL 0 "register_operand" "=w")
+ (mult:VMUL
+ (vec_duplicate:VMUL
+ (vec_select:<VEL>
+ (match_operand:VMUL 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VMUL 3 "register_operand" "w")))]
+ "TARGET_SIMD"
+ "<f>mul\\t%0.<Vtype>, %3.<Vtype>, %1.<Vetype>[%2]"
+ [(set_attr "simd_type" "simd_<f>mul_elt")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_mul3_elt_<vswap_width_name><mode>"
+ [(set (match_operand:VMUL_CHANGE_NLANES 0 "register_operand" "=w")
+ (mult:VMUL_CHANGE_NLANES
+ (vec_duplicate:VMUL_CHANGE_NLANES
+ (vec_select:<VEL>
+ (match_operand:<VSWAP_WIDTH> 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VMUL_CHANGE_NLANES 3 "register_operand" "w")))]
+ "TARGET_SIMD"
+ "<f>mul\\t%0.<Vtype>, %3.<Vtype>, %1.<Vetype>[%2]"
+ [(set_attr "simd_type" "simd_<f>mul_elt")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_mul3_elt_to_128df"
+ [(set (match_operand:V2DF 0 "register_operand" "=w")
+ (mult:V2DF
+ (vec_duplicate:V2DF
+ (match_operand:DF 2 "register_operand" "w"))
+ (match_operand:V2DF 1 "register_operand" "w")))]
+ "TARGET_SIMD"
+ "fmul\\t%0.2d, %1.2d, %2.d[0]"
+ [(set_attr "simd_type" "simd_fmul_elt")
+ (set_attr "simd_mode" "V2DF")]
+)
+
+(define_insn "*aarch64_mul3_elt_to_64v2df"
+ [(set (match_operand:DF 0 "register_operand" "=w")
+ (mult:DF
+ (vec_select:DF
+ (match_operand:V2DF 1 "register_operand" "w")
+ (parallel [(match_operand:SI 2 "immediate_operand")]))
+ (match_operand:DF 3 "register_operand" "w")))]
+ "TARGET_SIMD"
+ "fmul\\t%0.2d, %3.2d, %1.d[%2]"
+ [(set_attr "simd_type" "simd_fmul_elt")
+ (set_attr "simd_mode" "V2DF")]
+)
+
(define_insn "neg<mode>2"
[(set (match_operand:VDQ 0 "register_operand" "=w")
(neg:VDQ (match_operand:VDQ 1 "register_operand" "w")))]
@@ -1017,6 +1070,38 @@
(set_attr "simd_mode" "<MODE>")]
)
+(define_insn "*aarch64_mla_elt<mode>"
+ [(set (match_operand:VDQHS 0 "register_operand" "=w")
+ (plus:VDQHS
+ (mult:VDQHS
+ (vec_duplicate:VDQHS
+ (vec_select:<VEL>
+ (match_operand:VDQHS 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQHS 3 "register_operand" "w"))
+ (match_operand:VDQHS 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "mla\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_mla")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_mla_elt_<vswap_width_name><mode>"
+ [(set (match_operand:VDQHS 0 "register_operand" "=w")
+ (plus:VDQHS
+ (mult:VDQHS
+ (vec_duplicate:VDQHS
+ (vec_select:<VEL>
+ (match_operand:<VSWAP_WIDTH> 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQHS 3 "register_operand" "w"))
+ (match_operand:VDQHS 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "mla\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_mla")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
(define_insn "aarch64_mls<mode>"
[(set (match_operand:VQ_S 0 "register_operand" "=w")
(minus:VQ_S (match_operand:VQ_S 1 "register_operand" "0")
@@ -1028,6 +1113,38 @@
(set_attr "simd_mode" "<MODE>")]
)
+(define_insn "*aarch64_mls_elt<mode>"
+ [(set (match_operand:VDQHS 0 "register_operand" "=w")
+ (minus:VDQHS
+ (match_operand:VDQHS 4 "register_operand" "0")
+ (mult:VDQHS
+ (vec_duplicate:VDQHS
+ (vec_select:<VEL>
+ (match_operand:VDQHS 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQHS 3 "register_operand" "w"))))]
+ "TARGET_SIMD"
+ "mls\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_mla")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_mls_elt_<vswap_width_name><mode>"
+ [(set (match_operand:VDQHS 0 "register_operand" "=w")
+ (minus:VDQHS
+ (match_operand:VDQHS 4 "register_operand" "0")
+ (mult:VDQHS
+ (vec_duplicate:VDQHS
+ (vec_select:<VEL>
+ (match_operand:<VSWAP_WIDTH> 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQHS 3 "register_operand" "w"))))]
+ "TARGET_SIMD"
+ "mls\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_mla")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
;; Max/Min operations.
(define_insn "<su><maxmin><mode>3"
[(set (match_operand:VQ_S 0 "register_operand" "=w")
@@ -1430,6 +1547,137 @@
(set_attr "simd_mode" "<MODE>")]
)
+(define_insn "*aarch64_fma4_elt<mode>"
+ [(set (match_operand:VDQF 0 "register_operand" "=w")
+ (fma:VDQF
+ (vec_duplicate:VDQF
+ (vec_select:<VEL>
+ (match_operand:VDQF 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQF 3 "register_operand" "w")
+ (match_operand:VDQF 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmla\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_fma4_elt_<vswap_width_name><mode>"
+ [(set (match_operand:VDQSF 0 "register_operand" "=w")
+ (fma:VDQSF
+ (vec_duplicate:VDQSF
+ (vec_select:<VEL>
+ (match_operand:<VSWAP_WIDTH> 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQSF 3 "register_operand" "w")
+ (match_operand:VDQSF 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmla\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_fma4_elt_to_128df"
+ [(set (match_operand:V2DF 0 "register_operand" "=w")
+ (fma:V2DF
+ (vec_duplicate:V2DF
+ (match_operand:DF 1 "register_operand" "w"))
+ (match_operand:V2DF 2 "register_operand" "w")
+ (match_operand:V2DF 3 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmla\\t%0.2d, %2.2d, %1.2d[0]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "V2DF")]
+)
+
+(define_insn "*aarch64_fma4_elt_to_64v2df"
+ [(set (match_operand:DF 0 "register_operand" "=w")
+ (fma:DF
+ (vec_select:DF
+ (match_operand:V2DF 1 "register_operand" "w")
+ (parallel [(match_operand:SI 2 "immediate_operand")]))
+ (match_operand:DF 3 "register_operand" "w")
+ (match_operand:DF 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmla\\t%0.2d, %3.2d, %1.2d[%2]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "V2DF")]
+)
+
+(define_insn "fnma<mode>4"
+ [(set (match_operand:VDQF 0 "register_operand" "=w")
+ (fma:VDQF
+ (match_operand:VDQF 1 "register_operand" "w")
+ (neg:VDQF
+ (match_operand:VDQF 2 "register_operand" "w"))
+ (match_operand:VDQF 3 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmls\\t%0.<Vtype>, %1.<Vtype>, %2.<Vtype>"
+ [(set_attr "simd_type" "simd_fmla")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_fnma4_elt<mode>"
+ [(set (match_operand:VDQF 0 "register_operand" "=w")
+ (fma:VDQF
+ (neg:VDQF
+ (match_operand:VDQF 3 "register_operand" "w"))
+ (vec_duplicate:VDQF
+ (vec_select:<VEL>
+ (match_operand:VDQF 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQF 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmls\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_fnma4_elt_<vswap_width_name><mode>"
+ [(set (match_operand:VDQSF 0 "register_operand" "=w")
+ (fma:VDQSF
+ (neg:VDQSF
+ (match_operand:VDQSF 3 "register_operand" "w"))
+ (vec_duplicate:VDQSF
+ (vec_select:<VEL>
+ (match_operand:<VSWAP_WIDTH> 1 "register_operand" "<h_con>")
+ (parallel [(match_operand:SI 2 "immediate_operand")])))
+ (match_operand:VDQSF 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmls\\t%0.<Vtype>, %3.<Vtype>, %1.<Vtype>[%2]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "<MODE>")]
+)
+
+(define_insn "*aarch64_fnma4_elt_to_128df"
+ [(set (match_operand:V2DF 0 "register_operand" "=w")
+ (fma:V2DF
+ (neg:V2DF
+ (match_operand:V2DF 2 "register_operand" "w"))
+ (vec_duplicate:V2DF
+ (match_operand:DF 1 "register_operand" "w"))
+ (match_operand:V2DF 3 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmls\\t%0.2d, %2.2d, %1.2d[0]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "V2DF")]
+)
+
+(define_insn "*aarch64_fnma4_elt_to_64v2df"
+ [(set (match_operand:DF 0 "register_operand" "=w")
+ (fma:DF
+ (vec_select:DF
+ (match_operand:V2DF 1 "register_operand" "w")
+ (parallel [(match_operand:SI 2 "immediate_operand")]))
+ (neg:DF
+ (match_operand:DF 3 "register_operand" "w"))
+ (match_operand:DF 4 "register_operand" "0")))]
+ "TARGET_SIMD"
+ "fmls\\t%0.2d, %3.2d, %1.2d[%2]"
+ [(set_attr "simd_type" "simd_fmla_elt")
+ (set_attr "simd_mode" "V2DF")]
+)
+
;; Vector versions of the floating-point frint patterns.
;; Expands to btrunc, ceil, floor, nearbyint, rint, round.
(define_insn "<frint_pattern><mode>2"
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index e8ae20ad3d2..ee2cb4cd6df 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -109,6 +109,7 @@ enum aarch64_code_model aarch64_cmodel;
#define TARGET_HAVE_TLS 1
#endif
+static bool aarch64_lra_p (void);
static bool aarch64_composite_type_p (const_tree, enum machine_mode);
static bool aarch64_vfp_is_call_or_return_candidate (enum machine_mode,
const_tree,
@@ -3857,13 +3858,6 @@ aarch64_print_operand_address (FILE *f, rtx x)
output_addr_const (f, x);
}
-void
-aarch64_function_profiler (FILE *f ATTRIBUTE_UNUSED,
- int labelno ATTRIBUTE_UNUSED)
-{
- sorry ("function profiling");
-}
-
bool
aarch64_label_mentioned_p (rtx x)
{
@@ -6092,6 +6086,13 @@ aapcs_vfp_sub_candidate (const_tree type, enum machine_mode *modep)
return -1;
}
+/* Return true if we use LRA instead of reload pass. */
+static bool
+aarch64_lra_p (void)
+{
+ return aarch64_lra_flag;
+}
+
/* Return TRUE if the type, as described by TYPE and MODE, is a composite
type as described in AAPCS64 \S 4.3. This includes aggregate, union and
array types. The C99 floating-point complex types are also considered
@@ -7162,10 +7163,10 @@ aarch64_emit_store_exclusive (enum machine_mode mode, rtx bval,
static void
aarch64_emit_unlikely_jump (rtx insn)
{
- rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1);
+ int very_unlikely = REG_BR_PROB_BASE / 100 - 1;
insn = emit_jump_insn (insn);
- add_reg_note (insn, REG_BR_PROB, very_unlikely);
+ add_int_reg_note (insn, REG_BR_PROB, very_unlikely);
}
/* Expand a compare and swap pattern. */
@@ -8268,6 +8269,9 @@ aarch64_vectorize_vec_perm_const_ok (enum machine_mode vmode,
#undef TARGET_LIBGCC_CMP_RETURN_MODE
#define TARGET_LIBGCC_CMP_RETURN_MODE aarch64_libgcc_cmp_return_mode
+#undef TARGET_LRA_P
+#define TARGET_LRA_P aarch64_lra_p
+
#undef TARGET_MANGLE_TYPE
#define TARGET_MANGLE_TYPE aarch64_mangle_type
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index d8012f88049..da2b46d14cf 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -783,8 +783,22 @@ do { \
#define PRINT_OPERAND_ADDRESS(STREAM, X) \
aarch64_print_operand_address (STREAM, X)
-#define FUNCTION_PROFILER(STREAM, LABELNO) \
- aarch64_function_profiler (STREAM, LABELNO)
+#define MCOUNT_NAME "_mcount"
+
+#define NO_PROFILE_COUNTERS 1
+
+/* Emit rtl for profiling. Output assembler code to FILE
+ to call "_mcount" for profiling a function entry. */
+#define PROFILE_HOOK(LABEL) \
+{ \
+ rtx fun,lr; \
+ lr = get_hard_reg_initial_val (Pmode, LR_REGNUM); \
+ fun = gen_rtx_SYMBOL_REF (Pmode, MCOUNT_NAME); \
+ emit_library_call (fun, LCT_NORMAL, VOIDmode, 1, lr, Pmode); \
+}
+
+/* All the work done in PROFILE_HOOK, but still required. */
+#define FUNCTION_PROFILER(STREAM, LABELNO) do { } while (0)
/* For some reason, the Linux headers think they know how to define
these macros. They don't!!! */
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 0cd7da7a399..797c9f422c4 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -308,6 +308,14 @@
;; Processor types.
(include "aarch64-tune.md")
+;; True if the generic scheduling description should be used.
+
+(define_attr "generic_sched" "yes,no"
+ (const (if_then_else
+ (eq_attr "tune" "large,small,cortexa53")
+ (const_string "no")
+ (const_string "yes"))))
+
;; Scheduling
(include "aarch64-generic.md")
(include "large.md")
diff --git a/gcc/config/aarch64/aarch64.opt b/gcc/config/aarch64/aarch64.opt
index 8ff6ca12592..3b3e6c3b94d 100644
--- a/gcc/config/aarch64/aarch64.opt
+++ b/gcc/config/aarch64/aarch64.opt
@@ -103,6 +103,10 @@ mabi=
Target RejectNegative Joined Enum(aarch64_abi) Var(aarch64_abi) Init(AARCH64_ABI_DEFAULT)
-mabi=ABI Generate code that conforms to the specified ABI
+mlra
+Target Report Var(aarch64_lra_flag) Init(1) Save
+Use LRA instead of reload (transitional)
+
Enum
Name(aarch64_abi) Type(int)
Known AArch64 ABIs (for use with the -mabi= option):
diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index c7e882a3d23..cb5860206a1 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -5756,12 +5756,12 @@ vcvtx_f32_f64 (float64x2_t a)
}
__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
-vcvtx_high_f32_f64 (float64x2_t a)
+vcvtx_high_f32_f64 (float32x2_t a, float64x2_t b)
{
float32x4_t result;
__asm__ ("fcvtxn2 %0.4s,%1.2d"
: "=w"(result)
- : "w"(a)
+ : "w" (b), "0"(a)
: /* No clobbers */);
return result;
}
@@ -6100,33 +6100,6 @@ vfma_f32 (float32x2_t a, float32x2_t b, float32x2_t c)
return result;
}
-#define vfma_lane_f32(a, b, c, d) \
- __extension__ \
- ({ \
- float32x2_t c_ = (c); \
- float32x2_t b_ = (b); \
- float32x2_t a_ = (a); \
- float32x2_t result; \
- __asm__ ("fmla %0.2s,%2.2s,%3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vfmad_lane_f64(a, b, c) \
- __extension__ \
- ({ \
- float64x2_t b_ = (b); \
- float64_t a_ = (a); \
- float64_t result; \
- __asm__ ("fmla %d0,%d1,%2.d[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
vfmaq_f32 (float32x4_t a, float32x4_t b, float32x4_t c)
{
@@ -6149,47 +6122,6 @@ vfmaq_f64 (float64x2_t a, float64x2_t b, float64x2_t c)
return result;
}
-#define vfmaq_lane_f32(a, b, c, d) \
- __extension__ \
- ({ \
- float32x4_t c_ = (c); \
- float32x4_t b_ = (b); \
- float32x4_t a_ = (a); \
- float32x4_t result; \
- __asm__ ("fmla %0.4s,%2.4s,%3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vfmaq_lane_f64(a, b, c, d) \
- __extension__ \
- ({ \
- float64x2_t c_ = (c); \
- float64x2_t b_ = (b); \
- float64x2_t a_ = (a); \
- float64x2_t result; \
- __asm__ ("fmla %0.2d,%2.2d,%3.d[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vfmas_lane_f32(a, b, c) \
- __extension__ \
- ({ \
- float32x4_t b_ = (b); \
- float32_t a_ = (a); \
- float32_t result; \
- __asm__ ("fmla %s0,%s1,%2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
vfma_n_f32 (float32x2_t a, float32x2_t b, float32_t c)
{
@@ -6234,19 +6166,6 @@ vfms_f32 (float32x2_t a, float32x2_t b, float32x2_t c)
return result;
}
-#define vfmsd_lane_f64(a, b, c) \
- __extension__ \
- ({ \
- float64x2_t b_ = (b); \
- float64_t a_ = (a); \
- float64_t result; \
- __asm__ ("fmls %d0,%d1,%2.d[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
vfmsq_f32 (float32x4_t a, float32x4_t b, float32x4_t c)
{
@@ -6269,19 +6188,6 @@ vfmsq_f64 (float64x2_t a, float64x2_t b, float64x2_t c)
return result;
}
-#define vfmss_lane_f32(a, b, c) \
- __extension__ \
- ({ \
- float32x4_t b_ = (b); \
- float32_t a_ = (a); \
- float32_t result; \
- __asm__ ("fmls %s0,%s1,%2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
vget_high_f32 (float32x4_t a)
{
@@ -7122,133 +7028,6 @@ vld1q_dup_u64 (const uint64_t * a)
result; \
})
-#define vmla_lane_f32(a, b, c, d) \
- __extension__ \
- ({ \
- float32x2_t c_ = (c); \
- float32x2_t b_ = (b); \
- float32x2_t a_ = (a); \
- float32x2_t result; \
- float32x2_t t1; \
- __asm__ ("fmul %1.2s, %3.2s, %4.s[%5]; fadd %0.2s, %0.2s, %1.2s" \
- : "=w"(result), "=w"(t1) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_lane_s16(a, b, c, d) \
- __extension__ \
- ({ \
- int16x4_t c_ = (c); \
- int16x4_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x4_t result; \
- __asm__ ("mla %0.4h, %2.4h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_lane_s32(a, b, c, d) \
- __extension__ \
- ({ \
- int32x2_t c_ = (c); \
- int32x2_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x2_t result; \
- __asm__ ("mla %0.2s, %2.2s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_lane_u16(a, b, c, d) \
- __extension__ \
- ({ \
- uint16x4_t c_ = (c); \
- uint16x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x4_t result; \
- __asm__ ("mla %0.4h, %2.4h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_lane_u32(a, b, c, d) \
- __extension__ \
- ({ \
- uint32x2_t c_ = (c); \
- uint32x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x2_t result; \
- __asm__ ("mla %0.2s, %2.2s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_laneq_s16(a, b, c, d) \
- __extension__ \
- ({ \
- int16x8_t c_ = (c); \
- int16x4_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x4_t result; \
- __asm__ ("mla %0.4h, %2.4h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_laneq_s32(a, b, c, d) \
- __extension__ \
- ({ \
- int32x4_t c_ = (c); \
- int32x2_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x2_t result; \
- __asm__ ("mla %0.2s, %2.2s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_laneq_u16(a, b, c, d) \
- __extension__ \
- ({ \
- uint16x8_t c_ = (c); \
- uint16x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x4_t result; \
- __asm__ ("mla %0.4h, %2.4h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmla_laneq_u32(a, b, c, d) \
- __extension__ \
- ({ \
- uint32x4_t c_ = (c); \
- uint32x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x2_t result; \
- __asm__ ("mla %0.2s, %2.2s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
vmla_n_f32 (float32x2_t a, float32x2_t b, float32_t c)
{
@@ -7815,133 +7594,6 @@ vmlal_u32 (uint64x2_t a, uint32x2_t b, uint32x2_t c)
return result;
}
-#define vmlaq_lane_f32(a, b, c, d) \
- __extension__ \
- ({ \
- float32x4_t c_ = (c); \
- float32x4_t b_ = (b); \
- float32x4_t a_ = (a); \
- float32x4_t result; \
- float32x4_t t1; \
- __asm__ ("fmul %1.4s, %3.4s, %4.s[%5]; fadd %0.4s, %0.4s, %1.4s" \
- : "=w"(result), "=w"(t1) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_lane_s16(a, b, c, d) \
- __extension__ \
- ({ \
- int16x8_t c_ = (c); \
- int16x8_t b_ = (b); \
- int16x8_t a_ = (a); \
- int16x8_t result; \
- __asm__ ("mla %0.8h, %2.8h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_lane_s32(a, b, c, d) \
- __extension__ \
- ({ \
- int32x4_t c_ = (c); \
- int32x4_t b_ = (b); \
- int32x4_t a_ = (a); \
- int32x4_t result; \
- __asm__ ("mla %0.4s, %2.4s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_lane_u16(a, b, c, d) \
- __extension__ \
- ({ \
- uint16x8_t c_ = (c); \
- uint16x8_t b_ = (b); \
- uint16x8_t a_ = (a); \
- uint16x8_t result; \
- __asm__ ("mla %0.8h, %2.8h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_lane_u32(a, b, c, d) \
- __extension__ \
- ({ \
- uint32x4_t c_ = (c); \
- uint32x4_t b_ = (b); \
- uint32x4_t a_ = (a); \
- uint32x4_t result; \
- __asm__ ("mla %0.4s, %2.4s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_laneq_s16(a, b, c, d) \
- __extension__ \
- ({ \
- int16x8_t c_ = (c); \
- int16x8_t b_ = (b); \
- int16x8_t a_ = (a); \
- int16x8_t result; \
- __asm__ ("mla %0.8h, %2.8h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_laneq_s32(a, b, c, d) \
- __extension__ \
- ({ \
- int32x4_t c_ = (c); \
- int32x4_t b_ = (b); \
- int32x4_t a_ = (a); \
- int32x4_t result; \
- __asm__ ("mla %0.4s, %2.4s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_laneq_u16(a, b, c, d) \
- __extension__ \
- ({ \
- uint16x8_t c_ = (c); \
- uint16x8_t b_ = (b); \
- uint16x8_t a_ = (a); \
- uint16x8_t result; \
- __asm__ ("mla %0.8h, %2.8h, %3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlaq_laneq_u32(a, b, c, d) \
- __extension__ \
- ({ \
- uint32x4_t c_ = (c); \
- uint32x4_t b_ = (b); \
- uint32x4_t a_ = (a); \
- uint32x4_t result; \
- __asm__ ("mla %0.4s, %2.4s, %3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
vmlaq_n_f32 (float32x4_t a, float32x4_t b, float32_t c)
{
@@ -8076,77 +7728,6 @@ vmlaq_u32 (uint32x4_t a, uint32x4_t b, uint32x4_t c)
return result;
}
-#define vmls_lane_f32(a, b, c, d) \
- __extension__ \
- ({ \
- float32x2_t c_ = (c); \
- float32x2_t b_ = (b); \
- float32x2_t a_ = (a); \
- float32x2_t result; \
- float32x2_t t1; \
- __asm__ ("fmul %1.2s, %3.2s, %4.s[%5]; fsub %0.2s, %0.2s, %1.2s" \
- : "=w"(result), "=w"(t1) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmls_lane_s16(a, b, c, d) \
- __extension__ \
- ({ \
- int16x4_t c_ = (c); \
- int16x4_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x4_t result; \
- __asm__ ("mls %0.4h,%2.4h,%3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmls_lane_s32(a, b, c, d) \
- __extension__ \
- ({ \
- int32x2_t c_ = (c); \
- int32x2_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x2_t result; \
- __asm__ ("mls %0.2s,%2.2s,%3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmls_lane_u16(a, b, c, d) \
- __extension__ \
- ({ \
- uint16x4_t c_ = (c); \
- uint16x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x4_t result; \
- __asm__ ("mls %0.4h,%2.4h,%3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmls_lane_u32(a, b, c, d) \
- __extension__ \
- ({ \
- uint32x2_t c_ = (c); \
- uint32x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x2_t result; \
- __asm__ ("mls %0.2s,%2.2s,%3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
vmls_n_f32 (float32x2_t a, float32x2_t b, float32_t c)
{
@@ -8713,148 +8294,6 @@ vmlsl_u32 (uint64x2_t a, uint32x2_t b, uint32x2_t c)
return result;
}
-#define vmlsq_lane_f32(a, b, c, d) \
- __extension__ \
- ({ \
- float32x4_t c_ = (c); \
- float32x4_t b_ = (b); \
- float32x4_t a_ = (a); \
- float32x4_t result; \
- float32x4_t t1; \
- __asm__ ("fmul %1.4s, %3.4s, %4.s[%5]; fsub %0.4s, %0.4s, %1.4s" \
- : "=w"(result), "=w"(t1) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlsq_lane_s16(a, b, c, d) \
- __extension__ \
- ({ \
- int16x8_t c_ = (c); \
- int16x8_t b_ = (b); \
- int16x8_t a_ = (a); \
- int16x8_t result; \
- __asm__ ("mls %0.8h,%2.8h,%3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlsq_lane_s32(a, b, c, d) \
- __extension__ \
- ({ \
- int32x4_t c_ = (c); \
- int32x4_t b_ = (b); \
- int32x4_t a_ = (a); \
- int32x4_t result; \
- __asm__ ("mls %0.4s,%2.4s,%3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlsq_lane_u16(a, b, c, d) \
- __extension__ \
- ({ \
- uint16x8_t c_ = (c); \
- uint16x8_t b_ = (b); \
- uint16x8_t a_ = (a); \
- uint16x8_t result; \
- __asm__ ("mls %0.8h,%2.8h,%3.h[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "x"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlsq_lane_u32(a, b, c, d) \
- __extension__ \
- ({ \
- uint32x4_t c_ = (c); \
- uint32x4_t b_ = (b); \
- uint32x4_t a_ = (a); \
- uint32x4_t result; \
- __asm__ ("mls %0.4s,%2.4s,%3.s[%4]" \
- : "=w"(result) \
- : "0"(a_), "w"(b_), "w"(c_), "i"(d) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmlsq_laneq_f32(__a, __b, __c, __d) \
- __extension__ \
- ({ \
- float32x4_t __c_ = (__c); \
- float32x4_t __b_ = (__b); \
- float32x4_t __a_ = (__a); \
- float32x4_t __result; \
- float32x4_t __t1; \
- __asm__ ("fmul %1.4s, %3.4s, %4.s[%5]; fsub %0.4s, %0.4s, %1.4s" \
- : "=w"(__result), "=w"(__t1) \
- : "0"(__a_), "w"(__b_), "w"(__c_), "i"(__d) \
- : /* No clobbers */); \
- __result; \
- })
-
-#define vmlsq_laneq_s16(__a, __b, __c, __d) \
- __extension__ \
- ({ \
- int16x8_t __c_ = (__c); \
- int16x8_t __b_ = (__b); \
- int16x8_t __a_ = (__a); \
- int16x8_t __result; \
- __asm__ ("mls %0.8h, %2.8h, %3.h[%4]" \
- : "=w"(__result) \
- : "0"(__a_), "w"(__b_), "x"(__c_), "i"(__d) \
- : /* No clobbers */); \
- __result; \
- })
-
-#define vmlsq_laneq_s32(__a, __b, __c, __d) \
- __extension__ \
- ({ \
- int32x4_t __c_ = (__c); \
- int32x4_t __b_ = (__b); \
- int32x4_t __a_ = (__a); \
- int32x4_t __result; \
- __asm__ ("mls %0.4s, %2.4s, %3.s[%4]" \
- : "=w"(__result) \
- : "0"(__a_), "w"(__b_), "w"(__c_), "i"(__d) \
- : /* No clobbers */); \
- __result; \
- })
-
-#define vmlsq_laneq_u16(__a, __b, __c, __d) \
- __extension__ \
- ({ \
- uint16x8_t __c_ = (__c); \
- uint16x8_t __b_ = (__b); \
- uint16x8_t __a_ = (__a); \
- uint16x8_t __result; \
- __asm__ ("mls %0.8h, %2.8h, %3.h[%4]" \
- : "=w"(__result) \
- : "0"(__a_), "w"(__b_), "x"(__c_), "i"(__d) \
- : /* No clobbers */); \
- __result; \
- })
-
-#define vmlsq_laneq_u32(__a, __b, __c, __d) \
- __extension__ \
- ({ \
- uint32x4_t __c_ = (__c); \
- uint32x4_t __b_ = (__b); \
- uint32x4_t __a_ = (__a); \
- uint32x4_t __result; \
- __asm__ ("mls %0.4s, %2.4s, %3.s[%4]" \
- : "=w"(__result) \
- : "0"(__a_), "w"(__b_), "w"(__c_), "i"(__d) \
- : /* No clobbers */); \
- __result; \
- })
-
__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
vmlsq_n_f32 (float32x4_t a, float32x4_t b, float32_t c)
{
@@ -9501,136 +8940,6 @@ vmovq_n_u64 (uint64_t a)
return result;
}
-#define vmul_lane_f32(a, b, c) \
- __extension__ \
- ({ \
- float32x2_t b_ = (b); \
- float32x2_t a_ = (a); \
- float32x2_t result; \
- __asm__ ("fmul %0.2s,%1.2s,%2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_lane_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x4_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x4_t result; \
- __asm__ ("mul %0.4h,%1.4h,%2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_lane_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x2_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x2_t result; \
- __asm__ ("mul %0.2s,%1.2s,%2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_lane_u16(a, b, c) \
- __extension__ \
- ({ \
- uint16x4_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x4_t result; \
- __asm__ ("mul %0.4h,%1.4h,%2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_lane_u32(a, b, c) \
- __extension__ \
- ({ \
- uint32x2_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x2_t result; \
- __asm__ ("mul %0.2s, %1.2s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_laneq_f32(a, b, c) \
- __extension__ \
- ({ \
- float32x4_t b_ = (b); \
- float32x2_t a_ = (a); \
- float32x2_t result; \
- __asm__ ("fmul %0.2s, %1.2s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_laneq_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x8_t b_ = (b); \
- int16x4_t a_ = (a); \
- int16x4_t result; \
- __asm__ ("mul %0.4h, %1.4h, %2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_laneq_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x4_t b_ = (b); \
- int32x2_t a_ = (a); \
- int32x2_t result; \
- __asm__ ("mul %0.2s, %1.2s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_laneq_u16(a, b, c) \
- __extension__ \
- ({ \
- uint16x8_t b_ = (b); \
- uint16x4_t a_ = (a); \
- uint16x4_t result; \
- __asm__ ("mul %0.4h, %1.4h, %2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmul_laneq_u32(a, b, c) \
- __extension__ \
- ({ \
- uint32x4_t b_ = (b); \
- uint32x2_t a_ = (a); \
- uint32x2_t result; \
- __asm__ ("mul %0.2s, %1.2s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
vmul_n_f32 (float32x2_t a, float32_t b)
{
@@ -10149,162 +9458,6 @@ vmull_u32 (uint32x2_t a, uint32x2_t b)
return result;
}
-#define vmulq_lane_f32(a, b, c) \
- __extension__ \
- ({ \
- float32x2_t b_ = (b); \
- float32x4_t a_ = (a); \
- float32x4_t result; \
- __asm__ ("fmul %0.4s, %1.4s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_lane_f64(a, b, c) \
- __extension__ \
- ({ \
- float64x1_t b_ = (b); \
- float64x2_t a_ = (a); \
- float64x2_t result; \
- __asm__ ("fmul %0.2d,%1.2d,%2.d[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_lane_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x4_t b_ = (b); \
- int16x8_t a_ = (a); \
- int16x8_t result; \
- __asm__ ("mul %0.8h,%1.8h,%2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "x"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_lane_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x2_t b_ = (b); \
- int32x4_t a_ = (a); \
- int32x4_t result; \
- __asm__ ("mul %0.4s,%1.4s,%2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_lane_u16(a, b, c) \
- __extension__ \
- ({ \
- uint16x4_t b_ = (b); \
- uint16x8_t a_ = (a); \
- uint16x8_t result; \
- __asm__ ("mul %0.8h,%1.8h,%2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "x"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_lane_u32(a, b, c) \
- __extension__ \
- ({ \
- uint32x2_t b_ = (b); \
- uint32x4_t a_ = (a); \
- uint32x4_t result; \
- __asm__ ("mul %0.4s, %1.4s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_laneq_f32(a, b, c) \
- __extension__ \
- ({ \
- float32x4_t b_ = (b); \
- float32x4_t a_ = (a); \
- float32x4_t result; \
- __asm__ ("fmul %0.4s, %1.4s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_laneq_f64(a, b, c) \
- __extension__ \
- ({ \
- float64x2_t b_ = (b); \
- float64x2_t a_ = (a); \
- float64x2_t result; \
- __asm__ ("fmul %0.2d,%1.2d,%2.d[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_laneq_s16(a, b, c) \
- __extension__ \
- ({ \
- int16x8_t b_ = (b); \
- int16x8_t a_ = (a); \
- int16x8_t result; \
- __asm__ ("mul %0.8h, %1.8h, %2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "x"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_laneq_s32(a, b, c) \
- __extension__ \
- ({ \
- int32x4_t b_ = (b); \
- int32x4_t a_ = (a); \
- int32x4_t result; \
- __asm__ ("mul %0.4s, %1.4s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_laneq_u16(a, b, c) \
- __extension__ \
- ({ \
- uint16x8_t b_ = (b); \
- uint16x8_t a_ = (a); \
- uint16x8_t result; \
- __asm__ ("mul %0.8h, %1.8h, %2.h[%3]" \
- : "=w"(result) \
- : "w"(a_), "x"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
-#define vmulq_laneq_u32(a, b, c) \
- __extension__ \
- ({ \
- uint32x4_t b_ = (b); \
- uint32x4_t a_ = (a); \
- uint32x4_t result; \
- __asm__ ("mul %0.4s, %1.4s, %2.s[%3]" \
- : "=w"(result) \
- : "w"(a_), "w"(b_), "i"(c) \
- : /* No clobbers */); \
- result; \
- })
-
__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
vmulq_n_f32 (float32x4_t a, float32_t b)
{
@@ -19900,6 +19053,210 @@ vdupd_laneq_u64 (uint64x2_t __a, const int __b)
return __aarch64_vgetq_lane_u64 (__a, __b);
}
+/* vfma_lane */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vfma_lane_f32 (float32x2_t __a, float32x2_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2sf (__b,
+ __aarch64_vdup_lane_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfma_lane_f64 (float64_t __a, float64_t __b,
+ float64_t __c, const int __lane)
+{
+ return __builtin_fma (__b, __c, __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfmad_lane_f64 (float64_t __a, float64_t __b,
+ float64_t __c, const int __lane)
+{
+ return __builtin_fma (__b, __c, __a);
+}
+
+__extension__ static __inline float32_t __attribute__ ((__always_inline__))
+vfmas_lane_f32 (float32_t __a, float32_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return __builtin_fmaf (__b, __aarch64_vget_lane_f32 (__c, __lane), __a);
+}
+
+/* vfma_laneq */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vfma_laneq_f32 (float32x2_t __a, float32x2_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2sf (__b,
+ __aarch64_vdup_laneq_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfma_laneq_f64 (float64_t __a, float64_t __b,
+ float64x2_t __c, const int __lane)
+{
+ return __builtin_fma (__b, __aarch64_vgetq_lane_f64 (__c, __lane), __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfmad_laneq_f64 (float64_t __a, float64_t __b,
+ float64x2_t __c, const int __lane)
+{
+ return __builtin_fma (__b, __aarch64_vgetq_lane_f64 (__c, __lane), __a);
+}
+
+__extension__ static __inline float32_t __attribute__ ((__always_inline__))
+vfmas_laneq_f32 (float32_t __a, float32_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return __builtin_fmaf (__b, __aarch64_vgetq_lane_f32 (__c, __lane), __a);
+}
+
+/* vfmaq_lane */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vfmaq_lane_f32 (float32x4_t __a, float32x4_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav4sf (__b,
+ __aarch64_vdupq_lane_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
+vfmaq_lane_f64 (float64x2_t __a, float64x2_t __b,
+ float64_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2df (__b, vdupq_n_f64 (__c), __a);
+}
+
+/* vfmaq_laneq */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vfmaq_laneq_f32 (float32x4_t __a, float32x4_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav4sf (__b,
+ __aarch64_vdupq_laneq_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
+vfmaq_laneq_f64 (float64x2_t __a, float64x2_t __b,
+ float64x2_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2df (__b,
+ __aarch64_vdupq_laneq_f64 (__c, __lane),
+ __a);
+}
+
+/* vfms_lane */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vfms_lane_f32 (float32x2_t __a, float32x2_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2sf (-__b,
+ __aarch64_vdup_lane_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfms_lane_f64 (float64_t __a, float64_t __b,
+ float64_t __c, const int __lane)
+{
+ return __builtin_fma (-__b, __c, __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfmsd_lane_f64 (float64_t __a, float64_t __b,
+ float64_t __c, const int __lane)
+{
+ return __builtin_fma (-__b, __c, __a);
+}
+
+__extension__ static __inline float32_t __attribute__ ((__always_inline__))
+vfmss_lane_f32 (float32_t __a, float32_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return __builtin_fmaf (-__b, __aarch64_vget_lane_f32 (__c, __lane), __a);
+}
+
+/* vfms_laneq */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vfms_laneq_f32 (float32x2_t __a, float32x2_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2sf (-__b,
+ __aarch64_vdup_laneq_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfms_laneq_f64 (float64_t __a, float64_t __b,
+ float64x2_t __c, const int __lane)
+{
+ return __builtin_fma (-__b, __aarch64_vgetq_lane_f64 (__c, __lane), __a);
+}
+
+__extension__ static __inline float64_t __attribute__ ((__always_inline__))
+vfmsd_laneq_f64 (float64_t __a, float64_t __b,
+ float64x2_t __c, const int __lane)
+{
+ return __builtin_fma (-__b, __aarch64_vgetq_lane_f64 (__c, __lane), __a);
+}
+
+__extension__ static __inline float32_t __attribute__ ((__always_inline__))
+vfmss_laneq_f32 (float32_t __a, float32_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return __builtin_fmaf (-__b, __aarch64_vgetq_lane_f32 (__c, __lane), __a);
+}
+
+/* vfmsq_lane */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vfmsq_lane_f32 (float32x4_t __a, float32x4_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav4sf (-__b,
+ __aarch64_vdupq_lane_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
+vfmsq_lane_f64 (float64x2_t __a, float64x2_t __b,
+ float64_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2df (-__b, vdupq_n_f64 (__c), __a);
+}
+
+/* vfmsq_laneq */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vfmsq_laneq_f32 (float32x4_t __a, float32x4_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav4sf (-__b,
+ __aarch64_vdupq_laneq_f32 (__c, __lane),
+ __a);
+}
+
+__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
+vfmsq_laneq_f64 (float64x2_t __a, float64x2_t __b,
+ float64x2_t __c, const int __lane)
+{
+ return __builtin_aarch64_fmav2df (-__b,
+ __aarch64_vdupq_laneq_f64 (__c, __lane),
+ __a);
+}
+
/* vld1 */
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
@@ -21417,6 +20774,156 @@ vmlaq_f64 (float64x2_t a, float64x2_t b, float64x2_t c)
return a + b * c;
}
+/* vmla_lane */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vmla_lane_f32 (float32x2_t __a, float32x2_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+vmla_lane_s16 (int16x4_t __a, int16x4_t __b,
+ int16x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+vmla_lane_s32 (int32x2_t __a, int32x2_t __b,
+ int32x2_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+vmla_lane_u16 (uint16x4_t __a, uint16x4_t __b,
+ uint16x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+vmla_lane_u32 (uint32x2_t __a, uint32x2_t __b,
+ uint32x2_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_u32 (__c, __lane)));
+}
+
+/* vmla_laneq */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vmla_laneq_f32 (float32x2_t __a, float32x2_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+vmla_laneq_s16 (int16x4_t __a, int16x4_t __b,
+ int16x8_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+vmla_laneq_s32 (int32x2_t __a, int32x2_t __b,
+ int32x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+vmla_laneq_u16 (uint16x4_t __a, uint16x4_t __b,
+ uint16x8_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+vmla_laneq_u32 (uint32x2_t __a, uint32x2_t __b,
+ uint32x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_u32 (__c, __lane)));
+}
+
+/* vmlaq_lane */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vmlaq_lane_f32 (float32x4_t __a, float32x4_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x8_t __attribute__ ((__always_inline__))
+vmlaq_lane_s16 (int16x8_t __a, int16x8_t __b,
+ int16x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x4_t __attribute__ ((__always_inline__))
+vmlaq_lane_s32 (int32x4_t __a, int32x4_t __b,
+ int32x2_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
+vmlaq_lane_u16 (uint16x8_t __a, uint16x8_t __b,
+ uint16x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__))
+vmlaq_lane_u32 (uint32x4_t __a, uint32x4_t __b,
+ uint32x2_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vget_lane_u32 (__c, __lane)));
+}
+
+ /* vmlaq_laneq */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vmlaq_laneq_f32 (float32x4_t __a, float32x4_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x8_t __attribute__ ((__always_inline__))
+vmlaq_laneq_s16 (int16x8_t __a, int16x8_t __b,
+ int16x8_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x4_t __attribute__ ((__always_inline__))
+vmlaq_laneq_s32 (int32x4_t __a, int32x4_t __b,
+ int32x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
+vmlaq_laneq_u16 (uint16x8_t __a, uint16x8_t __b,
+ uint16x8_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__))
+vmlaq_laneq_u32 (uint32x4_t __a, uint32x4_t __b,
+ uint32x4_t __c, const int __lane)
+{
+ return (__a + (__b * __aarch64_vgetq_lane_u32 (__c, __lane)));
+}
+
+/* vmls */
+
__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
vmls_f32 (float32x2_t a, float32x2_t b, float32x2_t c)
{
@@ -21435,6 +20942,305 @@ vmlsq_f64 (float64x2_t a, float64x2_t b, float64x2_t c)
return a - b * c;
}
+/* vmls_lane */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vmls_lane_f32 (float32x2_t __a, float32x2_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+vmls_lane_s16 (int16x4_t __a, int16x4_t __b,
+ int16x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+vmls_lane_s32 (int32x2_t __a, int32x2_t __b,
+ int32x2_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+vmls_lane_u16 (uint16x4_t __a, uint16x4_t __b,
+ uint16x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+vmls_lane_u32 (uint32x2_t __a, uint32x2_t __b,
+ uint32x2_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_u32 (__c, __lane)));
+}
+
+/* vmls_laneq */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vmls_laneq_f32 (float32x2_t __a, float32x2_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+vmls_laneq_s16 (int16x4_t __a, int16x4_t __b,
+ int16x8_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+vmls_laneq_s32 (int32x2_t __a, int32x2_t __b,
+ int32x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+vmls_laneq_u16 (uint16x4_t __a, uint16x4_t __b,
+ uint16x8_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+vmls_laneq_u32 (uint32x2_t __a, uint32x2_t __b,
+ uint32x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_u32 (__c, __lane)));
+}
+
+/* vmlsq_lane */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vmlsq_lane_f32 (float32x4_t __a, float32x4_t __b,
+ float32x2_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x8_t __attribute__ ((__always_inline__))
+vmlsq_lane_s16 (int16x8_t __a, int16x8_t __b,
+ int16x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x4_t __attribute__ ((__always_inline__))
+vmlsq_lane_s32 (int32x4_t __a, int32x4_t __b,
+ int32x2_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_s32 (__c, __lane)));
+}
+
+__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
+vmlsq_lane_u16 (uint16x8_t __a, uint16x8_t __b,
+ uint16x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__))
+vmlsq_lane_u32 (uint32x4_t __a, uint32x4_t __b,
+ uint32x2_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vget_lane_u32 (__c, __lane)));
+}
+
+ /* vmlsq_laneq */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vmlsq_laneq_f32 (float32x4_t __a, float32x4_t __b,
+ float32x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_f32 (__c, __lane)));
+}
+
+__extension__ static __inline int16x8_t __attribute__ ((__always_inline__))
+vmlsq_laneq_s16 (int16x8_t __a, int16x8_t __b,
+ int16x8_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_s16 (__c, __lane)));
+}
+
+__extension__ static __inline int32x4_t __attribute__ ((__always_inline__))
+vmlsq_laneq_s32 (int32x4_t __a, int32x4_t __b,
+ int32x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_s32 (__c, __lane)));
+}
+__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
+vmlsq_laneq_u16 (uint16x8_t __a, uint16x8_t __b,
+ uint16x8_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_u16 (__c, __lane)));
+}
+
+__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__))
+vmlsq_laneq_u32 (uint32x4_t __a, uint32x4_t __b,
+ uint32x4_t __c, const int __lane)
+{
+ return (__a - (__b * __aarch64_vgetq_lane_u32 (__c, __lane)));
+}
+
+/* vmul_lane */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vmul_lane_f32 (float32x2_t __a, float32x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_f32 (__b, __lane);
+}
+
+__extension__ static __inline float64x1_t __attribute__ ((__always_inline__))
+vmul_lane_f64 (float64x1_t __a, float64x1_t __b, const int __lane)
+{
+ return __a * __b;
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+vmul_lane_s16 (int16x4_t __a, int16x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_s16 (__b, __lane);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+vmul_lane_s32 (int32x2_t __a, int32x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_s32 (__b, __lane);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+vmul_lane_u16 (uint16x4_t __a, uint16x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_u16 (__b, __lane);
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+vmul_lane_u32 (uint32x2_t __a, uint32x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_u32 (__b, __lane);
+}
+
+/* vmul_laneq */
+
+__extension__ static __inline float32x2_t __attribute__ ((__always_inline__))
+vmul_laneq_f32 (float32x2_t __a, float32x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_f32 (__b, __lane);
+}
+
+__extension__ static __inline float64x1_t __attribute__ ((__always_inline__))
+vmul_laneq_f64 (float64x1_t __a, float64x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_f64 (__b, __lane);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+vmul_laneq_s16 (int16x4_t __a, int16x8_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_s16 (__b, __lane);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+vmul_laneq_s32 (int32x2_t __a, int32x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_s32 (__b, __lane);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+vmul_laneq_u16 (uint16x4_t __a, uint16x8_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_u16 (__b, __lane);
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+vmul_laneq_u32 (uint32x2_t __a, uint32x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_u32 (__b, __lane);
+}
+
+/* vmulq_lane */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vmulq_lane_f32 (float32x4_t __a, float32x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_f32 (__b, __lane);
+}
+
+__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
+vmulq_lane_f64 (float64x2_t __a, float64x1_t __b, const int __lane)
+{
+ return __a * __b;
+}
+
+__extension__ static __inline int16x8_t __attribute__ ((__always_inline__))
+vmulq_lane_s16 (int16x8_t __a, int16x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_s16 (__b, __lane);
+}
+
+__extension__ static __inline int32x4_t __attribute__ ((__always_inline__))
+vmulq_lane_s32 (int32x4_t __a, int32x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_s32 (__b, __lane);
+}
+
+__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
+vmulq_lane_u16 (uint16x8_t __a, uint16x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_u16 (__b, __lane);
+}
+
+__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__))
+vmulq_lane_u32 (uint32x4_t __a, uint32x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vget_lane_u32 (__b, __lane);
+}
+
+/* vmulq_laneq */
+
+__extension__ static __inline float32x4_t __attribute__ ((__always_inline__))
+vmulq_laneq_f32 (float32x4_t __a, float32x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_f32 (__b, __lane);
+}
+
+__extension__ static __inline float64x2_t __attribute__ ((__always_inline__))
+vmulq_laneq_f64 (float64x2_t __a, float64x2_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_f64 (__b, __lane);
+}
+
+__extension__ static __inline int16x8_t __attribute__ ((__always_inline__))
+vmulq_laneq_s16 (int16x8_t __a, int16x8_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_s16 (__b, __lane);
+}
+
+__extension__ static __inline int32x4_t __attribute__ ((__always_inline__))
+vmulq_laneq_s32 (int32x4_t __a, int32x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_s32 (__b, __lane);
+}
+
+__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__))
+vmulq_laneq_u16 (uint16x8_t __a, uint16x8_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_u16 (__b, __lane);
+}
+
+__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__))
+vmulq_laneq_u32 (uint32x4_t __a, uint32x4_t __b, const int __lane)
+{
+ return __a * __aarch64_vgetq_lane_u32 (__b, __lane);
+}
+
/* vqabs */
__extension__ static __inline int64x2_t __attribute__ ((__always_inline__))
diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md
index ffe125b5583..ec8d813fa3f 100644
--- a/gcc/config/aarch64/iterators.md
+++ b/gcc/config/aarch64/iterators.md
@@ -89,6 +89,9 @@
;; Vector Float modes.
(define_mode_iterator VDQF [V2SF V4SF V2DF])
+;; Vector single Float modes.
+(define_mode_iterator VDQSF [V2SF V4SF])
+
;; Modes suitable to use as the return type of a vcond expression.
(define_mode_iterator VDQF_COND [V2SF V2SI V4SF V4SI V2DF V2DI])
@@ -169,6 +172,12 @@
;; Double scalar modes
(define_mode_iterator DX [DI DF])
+;; Modes available for <f>mul lane operations.
+(define_mode_iterator VMUL [V4HI V8HI V2SI V4SI V2SF V4SF V2DF])
+
+;; Modes available for <f>mul lane operations changing lane count.
+(define_mode_iterator VMUL_CHANGE_NLANES [V4HI V8HI V2SI V4SI V2SF V4SF])
+
;; ------------------------------------------------------------------
;; Unspec enumerations for Advance SIMD. These could well go into
;; aarch64.md but for their use in int_iterators here.
@@ -358,7 +367,7 @@
(V2SI "SI") (V4SI "SI")
(DI "DI") (V2DI "DI")
(V2SF "SF") (V4SF "SF")
- (V2DF "DF")
+ (V2DF "DF") (DF "DF")
(SI "SI") (HI "HI")
(QI "QI")])
@@ -541,6 +550,22 @@
(V2SF "to_128") (V4SF "to_64")
(DF "to_128") (V2DF "to_64")])
+;; For certain vector-by-element multiplication instructions we must
+;; constrain the HI cases to use only V0-V15. This is covered by
+;; the 'x' constraint. All other modes may use the 'w' constraint.
+(define_mode_attr h_con [(V2SI "w") (V4SI "w")
+ (V4HI "x") (V8HI "x")
+ (V2SF "w") (V4SF "w")
+ (V2DF "w") (DF "w")])
+
+;; Defined to 'f' for types whose element type is a float type.
+(define_mode_attr f [(V8QI "") (V16QI "")
+ (V4HI "") (V8HI "")
+ (V2SI "") (V4SI "")
+ (DI "") (V2DI "")
+ (V2SF "f") (V4SF "f")
+ (V2DF "f") (DF "f")])
+
;; -------------------------------------------------------------------
;; Code Iterators
;; -------------------------------------------------------------------
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index a8fb92964eb..095b8fc7305 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "splay-tree.h"
#include "gimple.h"
#include "tree-flow.h"
+#include "tree-ssanames.h"
#include "tree-stdarg.h"
#include "tm-constrs.h"
#include "df.h"
@@ -4227,12 +4228,12 @@ alpha_expand_builtin_vector_binop (rtx (*gen) (rtx, rtx, rtx),
static void
emit_unlikely_jump (rtx cond, rtx label)
{
- rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1);
+ int very_unlikely = REG_BR_PROB_BASE / 100 - 1;
rtx x;
x = gen_rtx_IF_THEN_ELSE (VOIDmode, cond, label, pc_rtx);
x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x));
- add_reg_note (x, REG_BR_PROB, very_unlikely);
+ add_int_reg_note (x, REG_BR_PROB, very_unlikely);
}
/* A subroutine of the atomic operation splitters. Emit a load-locked
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index f9027ddd2e7..cc3eec767ae 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -14265,9 +14265,10 @@ thumb1_reorg (void)
FOR_EACH_BB (bb)
{
- rtx set, dest, src;
- rtx pat, op0;
+ rtx dest, src;
+ rtx pat, op0, set = NULL;
rtx prev, insn = BB_END (bb);
+ bool insn_clobbered = false;
while (insn != BB_HEAD (bb) && DEBUG_INSN_P (insn))
insn = PREV_INSN (insn);
@@ -14276,13 +14277,29 @@ thumb1_reorg (void)
if (INSN_CODE (insn) != CODE_FOR_cbranchsi4_insn)
continue;
- /* Find the first non-note insn before INSN in basic block BB. */
+ /* Get the register with which we are comparing. */
+ pat = PATTERN (insn);
+ op0 = XEXP (XEXP (SET_SRC (pat), 0), 0);
+
+ /* Find the first flag setting insn before INSN in basic block BB. */
gcc_assert (insn != BB_HEAD (bb));
- prev = PREV_INSN (insn);
- while (prev != BB_HEAD (bb) && (NOTE_P (prev) || DEBUG_INSN_P (prev)))
- prev = PREV_INSN (prev);
+ for (prev = PREV_INSN (insn);
+ (!insn_clobbered
+ && prev != BB_HEAD (bb)
+ && (NOTE_P (prev)
+ || DEBUG_INSN_P (prev)
+ || ((set = single_set (prev)) != NULL
+ && get_attr_conds (prev) == CONDS_NOCOND)));
+ prev = PREV_INSN (prev))
+ {
+ if (reg_set_p (op0, prev))
+ insn_clobbered = true;
+ }
+
+ /* Skip if op0 is clobbered by insn other than prev. */
+ if (insn_clobbered)
+ continue;
- set = single_set (prev);
if (!set)
continue;
@@ -14292,12 +14309,9 @@ thumb1_reorg (void)
|| !low_register_operand (src, SImode))
continue;
- pat = PATTERN (insn);
- op0 = XEXP (XEXP (SET_SRC (pat), 0), 0);
/* Rewrite move into subtract of 0 if its operand is compared with ZERO
- in INSN. Don't need to check dest since cprop_hardreg pass propagates
- src into INSN. */
- if (REGNO (op0) == REGNO (src))
+ in INSN. Both src and dest of the move insn are checked. */
+ if (REGNO (op0) == REGNO (src) || REGNO (op0) == REGNO (dest))
{
dest = copy_rtx (dest);
src = copy_rtx (src);
@@ -17955,7 +17969,8 @@ arm_get_frame_offsets (void)
if (! any_sibcall_could_use_r3 ()
&& arm_size_return_regs () <= 12
&& (offsets->saved_regs_mask & (1 << 3)) == 0
- && (TARGET_THUMB2 || !current_tune->prefer_ldrd_strd))
+ && (TARGET_THUMB2
+ || !(TARGET_LDRD && current_tune->prefer_ldrd_strd)))
{
reg = 3;
}
@@ -18380,7 +18395,8 @@ arm_expand_prologue (void)
}
}
- if (current_tune->prefer_ldrd_strd
+ if (TARGET_LDRD
+ && current_tune->prefer_ldrd_strd
&& !optimize_function_for_size_p (cfun))
{
if (TARGET_THUMB2)
@@ -24649,7 +24665,8 @@ arm_expand_epilogue (bool really_return)
}
else
{
- if (current_tune->prefer_ldrd_strd
+ if (TARGET_LDRD
+ && current_tune->prefer_ldrd_strd
&& !optimize_function_for_size_p (cfun))
{
if (TARGET_THUMB2)
@@ -26086,13 +26103,14 @@ arm_unwind_emit (FILE * asm_out_file, rtx insn)
for (note = REG_NOTES (insn); note ; note = XEXP (note, 1))
{
- pat = XEXP (note, 0);
switch (REG_NOTE_KIND (note))
{
case REG_FRAME_RELATED_EXPR:
+ pat = XEXP (note, 0);
goto found;
case REG_CFA_REGISTER:
+ pat = XEXP (note, 0);
if (pat == NULL)
{
pat = PATTERN (insn);
@@ -27011,10 +27029,10 @@ arm_emit_store_exclusive (enum machine_mode mode, rtx bval, rtx rval,
static void
emit_unlikely_jump (rtx insn)
{
- rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1);
+ int very_unlikely = REG_BR_PROB_BASE / 100 - 1;
insn = emit_jump_insn (insn);
- add_reg_note (insn, REG_BR_PROB, very_unlikely);
+ add_int_reg_note (insn, REG_BR_PROB, very_unlikely);
}
/* Expand a compare and swap pattern. */
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 8a482b570ec..b094cff0d7e 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -4169,18 +4169,18 @@
)
(define_insn "*arm_shiftsi3"
- [(set (match_operand:SI 0 "s_register_operand" "=l,r,r")
+ [(set (match_operand:SI 0 "s_register_operand" "=l,l,r,r")
(match_operator:SI 3 "shift_operator"
- [(match_operand:SI 1 "s_register_operand" "0,r,r")
- (match_operand:SI 2 "reg_or_int_operand" "l,M,r")]))]
+ [(match_operand:SI 1 "s_register_operand" "0,l,r,r")
+ (match_operand:SI 2 "reg_or_int_operand" "l,M,M,r")]))]
"TARGET_32BIT"
"* return arm_output_shift(operands, 0);"
[(set_attr "predicable" "yes")
- (set_attr "arch" "t2,*,*")
- (set_attr "predicable_short_it" "yes,no,no")
+ (set_attr "arch" "t2,t2,*,*")
+ (set_attr "predicable_short_it" "yes,yes,no,no")
(set_attr "length" "4")
(set_attr "shift" "1")
- (set_attr "type" "alu_shift_reg,alu_shift_imm,alu_shift_reg")]
+ (set_attr "type" "alu_shift_reg,alu_shift_imm,alu_shift_imm,alu_shift_reg")]
)
(define_insn "*shiftsi3_compare"
@@ -8239,19 +8239,21 @@
(define_insn "*arm_cmpsi_insn"
[(set (reg:CC CC_REGNUM)
- (compare:CC (match_operand:SI 0 "s_register_operand" "l,r,r,r")
- (match_operand:SI 1 "arm_add_operand" "Py,r,rI,L")))]
+ (compare:CC (match_operand:SI 0 "s_register_operand" "l,r,r,r,r")
+ (match_operand:SI 1 "arm_add_operand" "Py,r,r,I,L")))]
"TARGET_32BIT"
"@
cmp%?\\t%0, %1
cmp%?\\t%0, %1
cmp%?\\t%0, %1
+ cmp%?\\t%0, %1
cmn%?\\t%0, #%n1"
[(set_attr "conds" "set")
- (set_attr "arch" "t2,t2,any,any")
- (set_attr "length" "2,2,4,4")
+ (set_attr "arch" "t2,t2,any,any,any")
+ (set_attr "length" "2,2,4,4,4")
(set_attr "predicable" "yes")
- (set_attr "type" "alus_reg,alus_reg,alus_reg,alus_imm")]
+ (set_attr "predicable_short_it" "yes,yes,yes,no,no")
+ (set_attr "type" "alus_imm,alus_reg,alus_reg,alus_imm,alus_imm")]
)
(define_insn "*cmpsi_shiftsi"
@@ -8261,7 +8263,7 @@
[(match_operand:SI 1 "s_register_operand" "r,r,r")
(match_operand:SI 2 "shift_amount_operand" "M,r,M")])))]
"TARGET_32BIT"
- "cmp%?\\t%0, %1%S3"
+ "cmp\\t%0, %1%S3"
[(set_attr "conds" "set")
(set_attr "shift" "1")
(set_attr "arch" "32,a,a")
diff --git a/gcc/config/arm/vfp.md b/gcc/config/arm/vfp.md
index 9318e49d9ea..0b10c130d70 100644
--- a/gcc/config/arm/vfp.md
+++ b/gcc/config/arm/vfp.md
@@ -1217,19 +1217,20 @@
(set_attr "type" "fcmpd")]
)
-;; Fixed point to floating point conversions.
+;; Fixed point to floating point conversions.
(define_code_iterator FCVT [unsigned_float float])
(define_code_attr FCVTI32typename [(unsigned_float "u32") (float "s32")])
(define_insn "*combine_vcvt_f32_<FCVTI32typename>"
[(set (match_operand:SF 0 "s_register_operand" "=t")
(mult:SF (FCVT:SF (match_operand:SI 1 "s_register_operand" "0"))
- (match_operand 2
+ (match_operand 2
"const_double_vcvt_power_of_two_reciprocal" "Dt")))]
"TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP3 && !flag_rounding_math"
- "vcvt.f32.<FCVTI32typename>\\t%0, %1, %v2"
- [(set_attr "predicable" "no")
- (set_attr "type" "f_cvti2f")]
+ "vcvt%?.f32.<FCVTI32typename>\\t%0, %1, %v2"
+ [(set_attr "predicable" "yes")
+ (set_attr "predicable_short_it" "no")
+ (set_attr "type" "f_cvti2f")]
)
;; Not the ideal way of implementing this. Ideally we would be able to split
@@ -1237,17 +1238,19 @@
(define_insn "*combine_vcvt_f64_<FCVTI32typename>"
[(set (match_operand:DF 0 "s_register_operand" "=x,x,w")
(mult:DF (FCVT:DF (match_operand:SI 1 "s_register_operand" "r,t,r"))
- (match_operand 2
+ (match_operand 2
"const_double_vcvt_power_of_two_reciprocal" "Dt,Dt,Dt")))]
- "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP3 && !flag_rounding_math
+ "TARGET_32BIT && TARGET_HARD_FLOAT && TARGET_VFP3 && !flag_rounding_math
&& !TARGET_VFP_SINGLE"
"@
- vmov.f32\\t%0, %1\;vcvt.f64.<FCVTI32typename>\\t%P0, %P0, %v2
- vmov.f32\\t%0, %1\;vcvt.f64.<FCVTI32typename>\\t%P0, %P0, %v2
- vmov.f64\\t%P0, %1, %1\;vcvt.f64.<FCVTI32typename>\\t%P0, %P0, %v2"
- [(set_attr "predicable" "no")
- (set_attr "type" "f_cvti2f")
- (set_attr "length" "8")]
+ vmov%?.f32\\t%0, %1\;vcvt%?.f64.<FCVTI32typename>\\t%P0, %P0, %v2
+ vmov%?.f32\\t%0, %1\;vcvt%?.f64.<FCVTI32typename>\\t%P0, %P0, %v2
+ vmov%?.f64\\t%P0, %1, %1\;vcvt%?.f64.<FCVTI32typename>\\t%P0, %P0, %v2"
+ [(set_attr "predicable" "yes")
+ (set_attr "ce_count" "2")
+ (set_attr "predicable_short_it" "no")
+ (set_attr "type" "f_cvti2f")
+ (set_attr "length" "8")]
)
;; Store multiple insn used in function prologue.
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 18457f8f7b6..558f4c18bef 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -2438,7 +2438,7 @@ cbranch_predicted_taken_p (rtx insn)
if (x)
{
- int pred_val = INTVAL (XEXP (x, 0));
+ int pred_val = XINT (x, 0);
return pred_val >= REG_BR_PROB_BASE / 2;
}
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 36d16b9e57a..fe43ef39aeb 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -26,6 +26,7 @@ extern void machopic_output_function_base_name (FILE *);
extern const char *machopic_indirection_name (rtx, bool);
extern const char *machopic_mcount_stub_name (void);
extern bool machopic_should_output_picbase_label (void);
+extern const char *machopic_get_function_picbase (void);
#ifdef RTX_CODE
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 6c5d9c00623..cb1bc38a3be 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -405,6 +405,19 @@ machopic_output_function_base_name (FILE *file)
fprintf (file, "L%d$pb", current_pic_label_num);
}
+char curr_picbasename[32];
+
+const char *
+machopic_get_function_picbase (void)
+{
+ /* If dynamic-no-pic is on, we should not get here. */
+ gcc_assert (!MACHO_DYNAMIC_NO_PIC_P);
+
+ update_pic_label_number_if_needed ();
+ snprintf (curr_picbasename, 32, "L%d$pb", current_pic_label_num);
+ return (const char *) curr_picbasename;
+}
+
bool
machopic_should_output_picbase_label (void)
{
@@ -1329,6 +1342,9 @@ is_objc_metadata (tree decl)
return NULL_TREE;
}
+static int classes_seen;
+static int objc_metadata_seen;
+
/* Return the section required for Objective C ABI 2 metadata. */
static section *
darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
@@ -1338,12 +1354,9 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
gcc_assert (TREE_CODE (ident) == IDENTIFIER_NODE);
p = IDENTIFIER_POINTER (ident);
- /* If we are in LTO, then we don't know the state of flag_next_runtime
- or flag_objc_abi when the code was generated. We set these from the
- meta-data - which is needed to deal with const string constructors. */
+ gcc_checking_assert (flag_next_runtime == 1 && flag_objc_abi == 2);
- flag_next_runtime = 1;
- flag_objc_abi = 2;
+ objc_metadata_seen = 1;
if (base == data_section)
base = darwin_sections[objc2_metadata_section];
@@ -1366,7 +1379,10 @@ darwin_objc2_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
else if (!strncmp (p, "V2_NLCL", 7))
return darwin_sections[objc2_nonlazy_class_section];
else if (!strncmp (p, "V2_CLAB", 7))
- return darwin_sections[objc2_classlist_section];
+ {
+ classes_seen = 1;
+ return darwin_sections[objc2_classlist_section];
+ }
else if (!strncmp (p, "V2_SRFS", 7))
return darwin_sections[objc2_selector_refs_section];
else if (!strncmp (p, "V2_NLCA", 7))
@@ -1401,12 +1417,9 @@ darwin_objc1_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
gcc_assert (TREE_CODE (ident) == IDENTIFIER_NODE);
p = IDENTIFIER_POINTER (ident);
- /* If we are in LTO, then we don't know the state of flag_next_runtime
- or flag_objc_abi when the code was generated. We set these from the
- meta-data - which is needed to deal with const string constructors. */
- flag_next_runtime = 1;
- if (!global_options_set.x_flag_objc_abi)
- flag_objc_abi = 1;
+ gcc_checking_assert (flag_next_runtime == 1 && flag_objc_abi < 2);
+
+ objc_metadata_seen = 1;
/* String sections first, cos there are lots of strings. */
if (!strncmp (p, "V1_STRG", 7))
@@ -1419,7 +1432,10 @@ darwin_objc1_section (tree decl ATTRIBUTE_UNUSED, tree meta, section * base)
return darwin_sections[objc_meth_var_types_section];
else if (!strncmp (p, "V1_CLAS", 7))
- return darwin_sections[objc_class_section];
+ {
+ classes_seen = 1;
+ return darwin_sections[objc_class_section];
+ }
else if (!strncmp (p, "V1_META", 7))
return darwin_sections[objc_meta_class_section];
else if (!strncmp (p, "V1_CATG", 7))
@@ -1603,8 +1619,6 @@ machopic_select_section (tree decl,
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
- /* FIXME: This is unsatisfactory for LTO, since it relies on other
- metadata determining the source FE. */
if (!strcmp (IDENTIFIER_POINTER (name), "__builtin_ObjCString"))
{
if (flag_next_runtime)
@@ -2845,6 +2859,33 @@ darwin_file_end (void)
finalize_ctors ();
if (!vec_safe_is_empty (dtors))
finalize_dtors ();
+
+ /* If we are expecting to output NeXT ObjC meta-data, (and we actually see
+ some) then we output the fix-and-continue marker (Image Info).
+ This applies to Objective C, Objective C++ and LTO with either language
+ as part of the input. */
+ if (flag_next_runtime && objc_metadata_seen)
+ {
+ unsigned int flags = 0;
+ if (flag_objc_abi >= 2)
+ {
+ flags = 16;
+ output_section_asm_op
+ (darwin_sections[objc2_image_info_section]->unnamed.data);
+ }
+ else
+ output_section_asm_op
+ (darwin_sections[objc_image_info_section]->unnamed.data);
+
+ ASM_OUTPUT_ALIGN (asm_out_file, 2);
+ fputs ("L_OBJC_ImageInfo:\n", asm_out_file);
+
+ flags |= (flag_replace_objc_classes && classes_seen) ? 1 : 0;
+ flags |= flag_objc_gc ? 2 : 0;
+
+ fprintf (asm_out_file, "\t.long\t0\n\t.long\t%u\n", flags);
+ }
+
machopic_finish (asm_out_file);
if (strcmp (lang_hooks.name, "GNU C++") == 0)
{
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index b0e8c91c93d..376a0bbe7a6 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -2643,7 +2643,7 @@ frv_print_operand_jump_hint (rtx insn)
rtx note;
rtx labelref;
int ret;
- HOST_WIDE_INT prob = -1;
+ int prob = -1;
enum { UNKNOWN, BACKWARD, FORWARD } jump_type = UNKNOWN;
gcc_assert (JUMP_P (insn));
@@ -2669,7 +2669,7 @@ frv_print_operand_jump_hint (rtx insn)
else
{
- prob = INTVAL (XEXP (note, 0));
+ prob = XINT (note, 0);
ret = ((prob >= (REG_BR_PROB_BASE / 2))
? FRV_JUMP_LIKELY
: FRV_JUMP_NOT_LIKELY);
@@ -2690,10 +2690,10 @@ frv_print_operand_jump_hint (rtx insn)
}
fprintf (stderr,
- "%s: uid %ld, %s, probability = %ld, max prob. = %ld, hint = %d\n",
+ "%s: uid %ld, %s, probability = %d, max prob. = %d, hint = %d\n",
IDENTIFIER_POINTER (DECL_NAME (current_function_decl)),
- (long)INSN_UID (insn), direction, (long)prob,
- (long)REG_BR_PROB_BASE, ret);
+ (long)INSN_UID (insn), direction, prob,
+ REG_BR_PROB_BASE, ret);
}
#endif
diff --git a/gcc/config/i386/athlon.md b/gcc/config/i386/athlon.md
index d872b8f434c..8bbde33dc1c 100644
--- a/gcc/config/i386/athlon.md
+++ b/gcc/config/i386/athlon.md
@@ -151,11 +151,11 @@
;; Jump instructions are executed in the branch unit completely transparent to us
(define_insn_reservation "athlon_branch" 0
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "ibr"))
"athlon-direct,athlon-ieu")
(define_insn_reservation "athlon_call" 0
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "type" "call,callv"))
"athlon-vector,athlon-ieu")
(define_insn_reservation "athlon_call_amdfam10" 0
@@ -166,15 +166,15 @@
;; Latency of push operation is 3 cycles, but ESP value is available
;; earlier
(define_insn_reservation "athlon_push" 2
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "push"))
"athlon-direct,athlon-agu,athlon-store")
(define_insn_reservation "athlon_pop" 4
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "type" "pop"))
"athlon-vector,athlon-load,athlon-ieu")
(define_insn_reservation "athlon_pop_k8" 3
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(eq_attr "type" "pop"))
"athlon-double,(athlon-ieu+athlon-load)")
(define_insn_reservation "athlon_pop_amdfam10" 3
@@ -186,13 +186,13 @@
(eq_attr "type" "leave"))
"athlon-vector,(athlon-ieu+athlon-load)")
(define_insn_reservation "athlon_leave_k8" 3
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(eq_attr "type" "leave"))
"athlon-double,(athlon-ieu+athlon-load)")
;; Lea executes in AGU unit with 2 cycles latency.
(define_insn_reservation "athlon_lea" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "type" "lea"))
"athlon-direct,athlon-agu,nothing")
;; Lea executes in AGU unit with 1 cycle latency on AMDFAM10
@@ -209,13 +209,13 @@
"athlon-vector,athlon-ieu0,athlon-mult,nothing,nothing,athlon-ieu0")
;; ??? Widening multiply is vector or double.
(define_insn_reservation "athlon_imul_k8_DI" 4
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "imul")
(and (eq_attr "mode" "DI")
(eq_attr "memory" "none,unknown"))))
"athlon-direct0,athlon-ieu0,athlon-mult,nothing,athlon-ieu0")
(define_insn_reservation "athlon_imul_k8" 3
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "imul")
(eq_attr "memory" "none,unknown")))
"athlon-direct0,athlon-ieu0,athlon-mult,athlon-ieu0")
@@ -231,13 +231,13 @@
(eq_attr "memory" "load,both")))
"athlon-vector,athlon-load,athlon-ieu,athlon-mult,nothing,nothing,athlon-ieu")
(define_insn_reservation "athlon_imul_mem_k8_DI" 7
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "imul")
(and (eq_attr "mode" "DI")
(eq_attr "memory" "load,both"))))
"athlon-vector,athlon-load,athlon-ieu,athlon-mult,nothing,athlon-ieu")
(define_insn_reservation "athlon_imul_mem_k8" 6
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "imul")
(eq_attr "memory" "load,both")))
"athlon-vector,athlon-load,athlon-ieu,athlon-mult,athlon-ieu")
@@ -251,12 +251,12 @@
;; Using the same heuristics for amdfam10 as K8 with idiv
(define_insn_reservation "athlon_idiv" 6
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "idiv")
(eq_attr "memory" "none,unknown")))
"athlon-vector,(athlon-ieu0*6+(athlon-fpsched,athlon-fvector))")
(define_insn_reservation "athlon_idiv_mem" 9
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "idiv")
(eq_attr "memory" "load,both")))
"athlon-vector,((athlon-load,athlon-ieu0*6)+(athlon-fpsched,athlon-fvector))")
@@ -264,13 +264,13 @@
;; as idiv to create smaller automata. This probably does not matter much.
;; Using the same heuristics for amdfam10 as K8 with idiv
(define_insn_reservation "athlon_str" 6
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "str")
(eq_attr "memory" "load,both,store")))
"athlon-vector,athlon-load,athlon-ieu0*6")
(define_insn_reservation "athlon_idirect" 1
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "direct")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "none,unknown"))))
@@ -282,7 +282,7 @@
(eq_attr "memory" "none,unknown"))))
"athlon-direct,athlon-ieu")
(define_insn_reservation "athlon_ivector" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "none,unknown"))))
@@ -295,13 +295,13 @@
"athlon-vector,athlon-ieu,athlon-ieu")
(define_insn_reservation "athlon_idirect_loadmov" 3
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "imov")
(eq_attr "memory" "load")))
"athlon-direct,athlon-load")
(define_insn_reservation "athlon_idirect_load" 4
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "direct")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "load"))))
@@ -313,7 +313,7 @@
(eq_attr "memory" "load"))))
"athlon-direct,athlon-load,athlon-ieu")
(define_insn_reservation "athlon_ivector_load" 6
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "load"))))
@@ -326,13 +326,13 @@
"athlon-vector,athlon-load,athlon-ieu,athlon-ieu")
(define_insn_reservation "athlon_idirect_movstore" 1
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "imov")
(eq_attr "memory" "store")))
"athlon-direct,athlon-agu,athlon-store")
(define_insn_reservation "athlon_idirect_both" 4
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "direct")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "both"))))
@@ -349,7 +349,7 @@
athlon-store")
(define_insn_reservation "athlon_ivector_both" 6
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "both"))))
@@ -368,7 +368,7 @@
athlon-store")
(define_insn_reservation "athlon_idirect_store" 1
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "direct")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "store"))))
@@ -383,7 +383,7 @@
athlon-store")
(define_insn_reservation "athlon_ivector_store" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "unit" "integer,unknown")
(eq_attr "memory" "store"))))
@@ -405,7 +405,7 @@
(eq_attr "mode" "XF"))))
"athlon-vector,athlon-fpload2,athlon-fvector*9")
(define_insn_reservation "athlon_fldxf_k8" 13
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fmov")
(and (eq_attr "memory" "load")
(eq_attr "mode" "XF"))))
@@ -417,7 +417,7 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fany")
(define_insn_reservation "athlon_fld_k8" 2
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fmov")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fstore")
@@ -429,7 +429,7 @@
(eq_attr "mode" "XF"))))
"athlon-vector,(athlon-fpsched+athlon-agu),(athlon-store2+(athlon-fvector*7))")
(define_insn_reservation "athlon_fstxf_k8" 8
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fmov")
(and (eq_attr "memory" "store,both")
(eq_attr "mode" "XF"))))
@@ -440,16 +440,16 @@
(eq_attr "memory" "store,both")))
"athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)")
(define_insn_reservation "athlon_fst_k8" 2
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fmov")
(eq_attr "memory" "store,both")))
"athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)")
(define_insn_reservation "athlon_fist" 4
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fistp,fisttp"))
"athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)")
(define_insn_reservation "athlon_fmov" 2
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fmov"))
"athlon-direct,athlon-fpsched,athlon-faddmul")
(define_insn_reservation "athlon_fadd_load" 4
@@ -458,12 +458,12 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fadd")
(define_insn_reservation "athlon_fadd_load_k8" 6
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fop")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fadd")
(define_insn_reservation "athlon_fadd" 4
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fop"))
"athlon-direct,athlon-fpsched,athlon-fadd")
(define_insn_reservation "athlon_fmul_load" 4
@@ -472,16 +472,16 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fmul")
(define_insn_reservation "athlon_fmul_load_k8" 6
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fmul")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fmul")
(define_insn_reservation "athlon_fmul" 4
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fmul"))
"athlon-direct,athlon-fpsched,athlon-fmul")
(define_insn_reservation "athlon_fsgn" 2
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fsgn"))
"athlon-direct,athlon-fpsched,athlon-fmul")
(define_insn_reservation "athlon_fdiv_load" 24
@@ -490,7 +490,7 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fmul")
(define_insn_reservation "athlon_fdiv_load_k8" 13
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fdiv")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fmul")
@@ -499,16 +499,16 @@
(eq_attr "type" "fdiv"))
"athlon-direct,athlon-fpsched,athlon-fmul")
(define_insn_reservation "athlon_fdiv_k8" 11
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(eq_attr "type" "fdiv"))
"athlon-direct,athlon-fpsched,athlon-fmul")
(define_insn_reservation "athlon_fpspc_load" 103
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "fpspc")
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload,athlon-fvector")
(define_insn_reservation "athlon_fpspc" 100
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fpspc"))
"athlon-vector,athlon-fpsched,athlon-fvector")
(define_insn_reservation "athlon_fcmov_load" 7
@@ -521,12 +521,12 @@
(eq_attr "type" "fcmov"))
"athlon-vector,athlon-fpsched,athlon-fvector")
(define_insn_reservation "athlon_fcmov_load_k8" 17
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fcmov")
(eq_attr "memory" "load")))
"athlon-vector,athlon-fploadk8,athlon-fvector")
(define_insn_reservation "athlon_fcmov_k8" 15
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(eq_attr "type" "fcmov"))
"athlon-vector,athlon-fpsched,athlon-fvector")
;; fcomi is vector decoded by uses only one pipe.
@@ -537,13 +537,13 @@
(eq_attr "memory" "load"))))
"athlon-vector,athlon-fpload,athlon-fadd")
(define_insn_reservation "athlon_fcomi_load_k8" 5
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fcmp")
(and (eq_attr "athlon_decode" "vector")
(eq_attr "memory" "load"))))
"athlon-vector,athlon-fploadk8,athlon-fadd")
(define_insn_reservation "athlon_fcomi" 3
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "athlon_decode" "vector")
(eq_attr "type" "fcmp")))
"athlon-vector,athlon-fpsched,athlon-fadd")
@@ -553,18 +553,18 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fadd")
(define_insn_reservation "athlon_fcom_load_k8" 4
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "fcmp")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fadd")
(define_insn_reservation "athlon_fcom" 2
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(eq_attr "type" "fcmp"))
"athlon-direct,athlon-fpsched,athlon-fadd")
;; Never seen by the scheduler because we still don't do post reg-stack
;; scheduling.
;(define_insn_reservation "athlon_fxch" 2
-; (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+; (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
; (eq_attr "type" "fxch"))
; "athlon-direct,athlon-fpsched,athlon-fany")
@@ -580,13 +580,13 @@
(and (eq_attr "type" "ssemov")
(match_operand:DF 1 "memory_operand")))
"athlon-direct,athlon-fploadk8,athlon-fstore")
-(define_insn_reservation "athlon_movsd_load_generic64" 2
- (and (eq_attr "cpu" "generic64")
+(define_insn_reservation "athlon_movsd_load_generic" 2
+ (and (eq_attr "cpu" "generic")
(and (eq_attr "type" "ssemov")
(match_operand:DF 1 "memory_operand")))
"athlon-double,athlon-fploadk8,(athlon-fstore+athlon-fmul)")
(define_insn_reservation "athlon_movaps_load_k8" 2
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssemov")
(and (eq_attr "mode" "V4SF,V2DF,TI")
(eq_attr "memory" "load"))))
@@ -604,7 +604,7 @@
(eq_attr "memory" "load"))))
"athlon-vector,athlon-fpload,(athlon-fany*2)")
(define_insn_reservation "athlon_movss_load_k8" 1
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssemov")
(and (eq_attr "mode" "SF,DI")
(eq_attr "memory" "load"))))
@@ -615,7 +615,7 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fany")
(define_insn_reservation "athlon_mmxsseld_k8" 2
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "mmxmov,ssemov")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fstore")
@@ -637,19 +637,19 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8, athlon-fany")
(define_insn_reservation "athlon_mmxssest" 3
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "mmxmov,ssemov")
(and (eq_attr "mode" "V4SF,V2DF,TI")
(eq_attr "memory" "store,both"))))
"athlon-vector,(athlon-fpsched+athlon-agu),((athlon-fstore+athlon-store2)*2)")
(define_insn_reservation "athlon_mmxssest_k8" 3
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "mmxmov,ssemov")
(and (eq_attr "mode" "V4SF,V2DF,TI")
(eq_attr "memory" "store,both"))))
"athlon-double,(athlon-fpsched+athlon-agu),((athlon-fstore+athlon-store2)*2)")
(define_insn_reservation "athlon_mmxssest_short" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "mmxmov,ssemov")
(eq_attr "memory" "store,both")))
"athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)")
@@ -673,7 +673,7 @@
(eq_attr "memory" "store,both")))
"athlon-direct,(athlon-fpsched+athlon-agu),(athlon-fstore+athlon-store)")
(define_insn_reservation "athlon_movaps_k8" 2
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssemov")
(eq_attr "mode" "V4SF,V2DF,TI")))
"athlon-double,athlon-fpsched,((athlon-faddmul+athlon-faddmul) | (athlon-faddmul, athlon-faddmul))")
@@ -683,25 +683,25 @@
(eq_attr "mode" "V4SF,V2DF,TI")))
"athlon-vector,athlon-fpsched,(athlon-faddmul+athlon-faddmul)")
(define_insn_reservation "athlon_mmxssemov" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "type" "mmxmov,ssemov"))
"athlon-direct,athlon-fpsched,athlon-faddmul")
(define_insn_reservation "athlon_mmxmul_load" 4
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "mmxmul")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-fmul")
(define_insn_reservation "athlon_mmxmul" 3
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "type" "mmxmul"))
"athlon-direct,athlon-fpsched,athlon-fmul")
(define_insn_reservation "athlon_mmx_load" 3
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "unit" "mmx")
(eq_attr "memory" "load")))
"athlon-direct,athlon-fpload,athlon-faddmul")
(define_insn_reservation "athlon_mmx" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "unit" "mmx"))
"athlon-direct,athlon-fpsched,athlon-faddmul")
;; SSE operations are handled by the i387 unit as well. The latency
@@ -713,7 +713,7 @@
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload2,(athlon-fmul*2)")
(define_insn_reservation "athlon_sselog_load_k8" 5
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1")
(eq_attr "memory" "load")))
"athlon-double,athlon-fpload2k8,(athlon-fmul*2)")
@@ -727,7 +727,7 @@
(eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1"))
"athlon-vector,athlon-fpsched,athlon-fmul*2")
(define_insn_reservation "athlon_sselog_k8" 3
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(eq_attr "type" "sselog,sselog1,sseshuf,sseshuf1"))
"athlon-double,athlon-fpsched,athlon-fmul")
(define_insn_reservation "athlon_sselog_amdfam10" 2
@@ -743,13 +743,13 @@
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fpload,athlon-fadd")
(define_insn_reservation "athlon_ssecmp_load_k8" 4
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "ssecmp")
(and (eq_attr "mode" "SF,DF,DI,TI")
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fploadk8,athlon-fadd")
(define_insn_reservation "athlon_ssecmp" 2
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "ssecmp")
(eq_attr "mode" "SF,DF,DI,TI")))
"athlon-direct,athlon-fpsched,athlon-fadd")
@@ -759,7 +759,7 @@
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload2,(athlon-fadd*2)")
(define_insn_reservation "athlon_ssecmpvector_load_k8" 5
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssecmp")
(eq_attr "memory" "load")))
"athlon-double,athlon-fpload2k8,(athlon-fadd*2)")
@@ -773,7 +773,7 @@
(eq_attr "type" "ssecmp"))
"athlon-vector,athlon-fpsched,(athlon-fadd*2)")
(define_insn_reservation "athlon_ssecmpvector_k8" 3
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(eq_attr "type" "ssecmp"))
"athlon-double,athlon-fpsched,(athlon-fadd*2)")
(define_insn_reservation "athlon_ssecmpvector_amdfam10" 2
@@ -786,7 +786,7 @@
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload,athlon-fadd")
(define_insn_reservation "athlon_ssecomi_load_k8" 6
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssecomi")
(eq_attr "memory" "load")))
"athlon-vector,athlon-fploadk8,athlon-fadd")
@@ -796,7 +796,7 @@
(eq_attr "memory" "load")))
"athlon-direct,athlon-fploadk8,athlon-fadd")
(define_insn_reservation "athlon_ssecomi" 4
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(eq_attr "type" "ssecomi"))
"athlon-vector,athlon-fpsched,athlon-fadd")
(define_insn_reservation "athlon_ssecomi_amdfam10" 3
@@ -811,13 +811,13 @@
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fpload,athlon-fadd")
(define_insn_reservation "athlon_sseadd_load_k8" 6
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "sseadd,sseadd1")
(and (eq_attr "mode" "SF,DF,DI")
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fploadk8,athlon-fadd")
(define_insn_reservation "athlon_sseadd" 4
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "sseadd,sseadd1")
(eq_attr "mode" "SF,DF,DI")))
"athlon-direct,athlon-fpsched,athlon-fadd")
@@ -827,7 +827,7 @@
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload2,(athlon-fadd*2)")
(define_insn_reservation "athlon_sseaddvector_load_k8" 7
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "sseadd,sseadd1")
(eq_attr "memory" "load")))
"athlon-double,athlon-fpload2k8,(athlon-fadd*2)")
@@ -841,7 +841,7 @@
(eq_attr "type" "sseadd,sseadd1"))
"athlon-vector,athlon-fpsched,(athlon-fadd*2)")
(define_insn_reservation "athlon_sseaddvector_k8" 5
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(eq_attr "type" "sseadd,sseadd1"))
"athlon-double,athlon-fpsched,(athlon-fadd*2)")
(define_insn_reservation "athlon_sseaddvector_amdfam10" 4
@@ -855,7 +855,7 @@
;; cvtss2sd
(define_insn_reservation "athlon_ssecvt_cvtss2sd_load_k8" 4
- (and (eq_attr "cpu" "k8,athlon,generic64")
+ (and (eq_attr "cpu" "k8,athlon,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "direct")
(and (eq_attr "mode" "DF")
@@ -869,7 +869,7 @@
(eq_attr "memory" "load")))))
"athlon-double,athlon-fploadk8,(athlon-faddmul+athlon-fstore)")
(define_insn_reservation "athlon_ssecvt_cvtss2sd" 2
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "direct")
(eq_attr "mode" "DF"))))
@@ -882,7 +882,7 @@
"athlon-vector,athlon-fpsched,athlon-faddmul,(athlon-fstore*2)")
;; cvtps2pd. Model same way the other double decoded FP conversions.
(define_insn_reservation "athlon_ssecvt_cvtps2pd_load_k8" 5
- (and (eq_attr "cpu" "k8,athlon,generic64")
+ (and (eq_attr "cpu" "k8,athlon,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "double")
(and (eq_attr "mode" "V2DF,V4SF,TI")
@@ -896,7 +896,7 @@
(eq_attr "memory" "load")))))
"athlon-direct,athlon-fploadk8,athlon-fstore")
(define_insn_reservation "athlon_ssecvt_cvtps2pd_k8" 3
- (and (eq_attr "cpu" "k8,athlon,generic64")
+ (and (eq_attr "cpu" "k8,athlon,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "double")
(eq_attr "mode" "V2DF,V4SF,TI"))))
@@ -932,7 +932,7 @@
(eq_attr "memory" "load")))))
"athlon-vector,athlon-fpload,(athlon-fstore*2)")
(define_insn_reservation "athlon_sseicvt_cvtsi2ss_load_k8" 9
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "sseicvt")
(and (eq_attr "athlon_decode" "double")
(and (eq_attr "mode" "SF,DF")
@@ -947,7 +947,7 @@
"athlon-double,athlon-fploadk8,(athlon-faddmul+athlon-fstore)")
;; cvtsi2sd reg,reg is double decoded (vector on Athlon)
(define_insn_reservation "athlon_sseicvt_cvtsi2sd_k8" 11
- (and (eq_attr "cpu" "k8,athlon,generic64")
+ (and (eq_attr "cpu" "k8,athlon,generic")
(and (eq_attr "type" "sseicvt")
(and (eq_attr "athlon_decode" "double")
(and (eq_attr "mode" "SF,DF")
@@ -962,7 +962,7 @@
"athlon-vector,athlon-fploadk8,(athlon-faddmul+athlon-fstore)")
;; cvtsi2ss reg, reg is doublepath
(define_insn_reservation "athlon_sseicvt_cvtsi2ss" 14
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "sseicvt")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "mode" "SF,DF")
@@ -977,7 +977,7 @@
"athlon-vector,athlon-fploadk8,(athlon-faddmul+athlon-fstore)")
;; cvtsd2ss mem,reg is doublepath, troughput unknown, latency 9
(define_insn_reservation "athlon_ssecvt_cvtsd2ss_load_k8" 9
- (and (eq_attr "cpu" "k8,athlon,generic64")
+ (and (eq_attr "cpu" "k8,athlon,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "double")
(and (eq_attr "mode" "SF")
@@ -992,7 +992,7 @@
"athlon-double,athlon-fploadk8,(athlon-faddmul+athlon-fstore)")
;; cvtsd2ss reg,reg is vectorpath, troughput unknown, latency 12
(define_insn_reservation "athlon_ssecvt_cvtsd2ss" 12
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "mode" "SF")
@@ -1006,7 +1006,7 @@
(eq_attr "memory" "none")))))
"athlon-vector,athlon-fpsched,athlon-faddmul,(athlon-fstore*2)")
(define_insn_reservation "athlon_ssecvt_cvtpd2ps_load_k8" 8
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "mode" "V4SF,V2DF,TI")
@@ -1022,7 +1022,7 @@
;; cvtpd2ps mem,reg is vectorpath, troughput unknown, latency 10
;; ??? Why it is fater than cvtsd2ss?
(define_insn_reservation "athlon_ssecvt_cvtpd2ps" 8
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "ssecvt")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "mode" "V4SF,V2DF,TI")
@@ -1037,7 +1037,7 @@
"athlon-double,athlon-fpsched,(athlon-faddmul+athlon-fstore)")
;; cvtsd2si mem,reg is doublepath, troughput 1, latency 9
(define_insn_reservation "athlon_secvt_cvtsX2si_load" 9
- (and (eq_attr "cpu" "athlon,k8,generic64")
+ (and (eq_attr "cpu" "athlon,k8,generic")
(and (eq_attr "type" "sseicvt")
(and (eq_attr "athlon_decode" "vector")
(and (eq_attr "mode" "SI,DI")
@@ -1059,7 +1059,7 @@
(eq_attr "memory" "none")))))
"athlon-vector,athlon-fpsched,athlon-fvector")
(define_insn_reservation "athlon_ssecvt_cvtsX2si_k8" 9
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "sseicvt")
(and (eq_attr "athlon_decode" "double")
(and (eq_attr "mode" "SI,DI")
@@ -1097,13 +1097,13 @@
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fpload,athlon-fmul")
(define_insn_reservation "athlon_ssemul_load_k8" 6
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "ssemul")
(and (eq_attr "mode" "SF,DF")
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fploadk8,athlon-fmul")
(define_insn_reservation "athlon_ssemul" 4
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "ssemul")
(eq_attr "mode" "SF,DF")))
"athlon-direct,athlon-fpsched,athlon-fmul")
@@ -1113,7 +1113,7 @@
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload2,(athlon-fmul*2)")
(define_insn_reservation "athlon_ssemulvector_load_k8" 7
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssemul")
(eq_attr "memory" "load")))
"athlon-double,athlon-fpload2k8,(athlon-fmul*2)")
@@ -1127,7 +1127,7 @@
(eq_attr "type" "ssemul"))
"athlon-vector,athlon-fpsched,(athlon-fmul*2)")
(define_insn_reservation "athlon_ssemulvector_k8" 5
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(eq_attr "type" "ssemul"))
"athlon-double,athlon-fpsched,(athlon-fmul*2)")
(define_insn_reservation "athlon_ssemulvector_amdfam10" 4
@@ -1142,13 +1142,13 @@
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fpload,athlon-fmul*17")
(define_insn_reservation "athlon_ssediv_load_k8" 22
- (and (eq_attr "cpu" "k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "k8,generic,amdfam10")
(and (eq_attr "type" "ssediv")
(and (eq_attr "mode" "SF,DF")
(eq_attr "memory" "load"))))
"athlon-direct,athlon-fploadk8,athlon-fmul*17")
(define_insn_reservation "athlon_ssediv" 20
- (and (eq_attr "cpu" "athlon,k8,generic64,amdfam10")
+ (and (eq_attr "cpu" "athlon,k8,generic,amdfam10")
(and (eq_attr "type" "ssediv")
(eq_attr "mode" "SF,DF")))
"athlon-direct,athlon-fpsched,athlon-fmul*17")
@@ -1158,7 +1158,7 @@
(eq_attr "memory" "load")))
"athlon-vector,athlon-fpload2,athlon-fmul*34")
(define_insn_reservation "athlon_ssedivvector_load_k8" 35
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(and (eq_attr "type" "ssediv")
(eq_attr "memory" "load")))
"athlon-double,athlon-fpload2k8,athlon-fmul*34")
@@ -1172,7 +1172,7 @@
(eq_attr "type" "ssediv"))
"athlon-vector,athlon-fmul*34")
(define_insn_reservation "athlon_ssedivvector_k8" 39
- (and (eq_attr "cpu" "k8,generic64")
+ (and (eq_attr "cpu" "k8,generic")
(eq_attr "type" "ssediv"))
"athlon-double,athlon-fmul*34")
(define_insn_reservation "athlon_ssedivvector_amdfam10" 20
diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md
index 28e626ff3be..92e0c053fac 100644
--- a/gcc/config/i386/constraints.md
+++ b/gcc/config/i386/constraints.md
@@ -19,7 +19,7 @@
;;; Unused letters:
;;; B H T
-;;; h jk
+;;; h j
;; Integer register constraints.
;; It is not necessary to define 'r' here.
@@ -78,6 +78,12 @@
"TARGET_80387 || TARGET_FLOAT_RETURNS_IN_80387 ? FP_SECOND_REG : NO_REGS"
"Second from top of 80387 floating-point stack (@code{%st(1)}).")
+(define_register_constraint "k" "TARGET_AVX512F ? MASK_EVEX_REGS : NO_REGS"
+"@internal Any mask register that can be used as predicate, i.e. k1-k7.")
+
+(define_register_constraint "Yk" "TARGET_AVX512F ? MASK_REGS : NO_REGS"
+"@internal Any mask register.")
+
;; Vector registers (also used for plain floating point nowadays).
(define_register_constraint "y" "TARGET_MMX ? MMX_REGS : NO_REGS"
"Any MMX register.")
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 4cb9907b5ed..823f92da8c3 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -578,13 +578,13 @@ const char *host_detect_local_cpu (int argc, const char **argv)
case 6:
if (model > 9)
/* Use the default detection procedure. */
- processor = PROCESSOR_GENERIC32;
+ processor = PROCESSOR_GENERIC;
else if (model == 9)
cpu = "c3-2";
else if (model >= 6)
cpu = "c3";
else
- processor = PROCESSOR_GENERIC32;
+ processor = PROCESSOR_GENERIC;
break;
case 5:
if (has_3dnow)
@@ -592,11 +592,11 @@ const char *host_detect_local_cpu (int argc, const char **argv)
else if (has_mmx)
cpu = "winchip2-c6";
else
- processor = PROCESSOR_GENERIC32;
+ processor = PROCESSOR_GENERIC;
break;
default:
/* We have no idea. */
- processor = PROCESSOR_GENERIC32;
+ processor = PROCESSOR_GENERIC;
}
}
}
@@ -618,7 +618,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
break;
default:
/* We have no idea. */
- processor = PROCESSOR_GENERIC32;
+ processor = PROCESSOR_GENERIC;
}
}
diff --git a/gcc/config/i386/i386-c.c b/gcc/config/i386/i386-c.c
index 14349be0af5..2e764e79987 100644
--- a/gcc/config/i386/i386-c.c
+++ b/gcc/config/i386/i386-c.c
@@ -156,8 +156,7 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
/* use PROCESSOR_max to not set/unset the arch macro. */
case PROCESSOR_max:
break;
- case PROCESSOR_GENERIC32:
- case PROCESSOR_GENERIC64:
+ case PROCESSOR_GENERIC:
gcc_unreachable ();
}
@@ -248,8 +247,7 @@ ix86_target_macros_internal (HOST_WIDE_INT isa_flag,
case PROCESSOR_SLM:
def_or_undef (parse_in, "__tune_slm__");
break;
- case PROCESSOR_GENERIC32:
- case PROCESSOR_GENERIC64:
+ case PROCESSOR_GENERIC:
break;
/* use PROCESSOR_max to not set/unset the tune macro. */
case PROCESSOR_max:
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index e2fa71a369a..21fc5314861 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1644,18 +1644,21 @@ struct processor_costs slm_cost = {
1, /* cond_not_taken_branch_cost. */
};
-/* Generic64 should produce code tuned for Nocona and K8. */
+/* Generic should produce code tuned for Core-i7 (and newer chips)
+ and btver1 (and newer chips). */
-static stringop_algs generic64_memcpy[2] = {
- DUMMY_STRINGOP_ALGS,
+static stringop_algs generic_memcpy[2] = {
+ {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
+ {-1, libcall, false}}},
{libcall, {{32, loop, false}, {8192, rep_prefix_8_byte, false},
{-1, libcall, false}}}};
-static stringop_algs generic64_memset[2] = {
- DUMMY_STRINGOP_ALGS,
+static stringop_algs generic_memset[2] = {
+ {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
+ {-1, libcall, false}}},
{libcall, {{32, loop, false}, {8192, rep_prefix_8_byte, false},
{-1, libcall, false}}}};
static const
-struct processor_costs generic64_cost = {
+struct processor_costs generic_cost = {
COSTS_N_INSNS (1), /* cost of an add instruction */
/* On all chips taken into consideration lea is 2 cycles and more. With
this cost however our current implementation of synth_mult results in
@@ -1713,8 +1716,8 @@ struct processor_costs generic64_cost = {
COSTS_N_INSNS (8), /* cost of FABS instruction. */
COSTS_N_INSNS (8), /* cost of FCHS instruction. */
COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
- generic64_memcpy,
- generic64_memset,
+ generic_memcpy,
+ generic_memset,
1, /* scalar_stmt_cost. */
1, /* scalar load_cost. */
1, /* scalar_store_cost. */
@@ -1814,83 +1817,6 @@ struct processor_costs core_cost = {
1, /* cond_not_taken_branch_cost. */
};
-/* Generic32 should produce code tuned for PPro, Pentium4, Nocona,
- Athlon and K8. */
-static stringop_algs generic32_memcpy[2] = {
- {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
- {-1, libcall, false}}},
- DUMMY_STRINGOP_ALGS};
-static stringop_algs generic32_memset[2] = {
- {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
- {-1, libcall, false}}},
- DUMMY_STRINGOP_ALGS};
-static const
-struct processor_costs generic32_cost = {
- COSTS_N_INSNS (1), /* cost of an add instruction */
- COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
- COSTS_N_INSNS (1), /* variable shift costs */
- COSTS_N_INSNS (1), /* constant shift costs */
- {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
- COSTS_N_INSNS (4), /* HI */
- COSTS_N_INSNS (3), /* SI */
- COSTS_N_INSNS (4), /* DI */
- COSTS_N_INSNS (2)}, /* other */
- 0, /* cost of multiply per each bit set */
- {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
- COSTS_N_INSNS (26), /* HI */
- COSTS_N_INSNS (42), /* SI */
- COSTS_N_INSNS (74), /* DI */
- COSTS_N_INSNS (74)}, /* other */
- COSTS_N_INSNS (1), /* cost of movsx */
- COSTS_N_INSNS (1), /* cost of movzx */
- 8, /* "large" insn */
- 17, /* MOVE_RATIO */
- 4, /* cost for loading QImode using movzbl */
- {4, 4, 4}, /* cost of loading integer registers
- in QImode, HImode and SImode.
- Relative to reg-reg move (2). */
- {4, 4, 4}, /* cost of storing integer registers */
- 4, /* cost of reg,reg fld/fst */
- {12, 12, 12}, /* cost of loading fp registers
- in SFmode, DFmode and XFmode */
- {6, 6, 8}, /* cost of storing fp registers
- in SFmode, DFmode and XFmode */
- 2, /* cost of moving MMX register */
- {8, 8}, /* cost of loading MMX registers
- in SImode and DImode */
- {8, 8}, /* cost of storing MMX registers
- in SImode and DImode */
- 2, /* cost of moving SSE register */
- {8, 8, 8}, /* cost of loading SSE registers
- in SImode, DImode and TImode */
- {8, 8, 8}, /* cost of storing SSE registers
- in SImode, DImode and TImode */
- 5, /* MMX or SSE register to integer */
- 32, /* size of l1 cache. */
- 256, /* size of l2 cache. */
- 64, /* size of prefetch block */
- 6, /* number of parallel prefetches */
- 3, /* Branch cost */
- COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */
- COSTS_N_INSNS (8), /* cost of FMUL instruction. */
- COSTS_N_INSNS (20), /* cost of FDIV instruction. */
- COSTS_N_INSNS (8), /* cost of FABS instruction. */
- COSTS_N_INSNS (8), /* cost of FCHS instruction. */
- COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
- generic32_memcpy,
- generic32_memset,
- 1, /* scalar_stmt_cost. */
- 1, /* scalar load_cost. */
- 1, /* scalar_store_cost. */
- 1, /* vec_stmt_cost. */
- 1, /* vec_to_scalar_cost. */
- 1, /* scalar_to_vec_cost. */
- 1, /* vec_align_load_cost. */
- 2, /* vec_unalign_load_cost. */
- 1, /* vec_store_cost. */
- 3, /* cond_taken_branch_cost. */
- 1, /* cond_not_taken_branch_cost. */
-};
/* Set by -mtune. */
const struct processor_costs *ix86_tune_cost = &pentium_cost;
@@ -1929,12 +1855,7 @@ const struct processor_costs *ix86_cost = &pentium_cost;
#define m_BTVER (m_BTVER1 | m_BTVER2)
#define m_AMD_MULTIPLE (m_ATHLON_K8 | m_AMDFAM10 | m_BDVER | m_BTVER)
-#define m_GENERIC32 (1<<PROCESSOR_GENERIC32)
-#define m_GENERIC64 (1<<PROCESSOR_GENERIC64)
-
-/* Generic instruction choice should be common subset of supported CPUs
- (PPro/PENT4/NOCONA/CORE2/Athlon/K8). */
-#define m_GENERIC (m_GENERIC32 | m_GENERIC64)
+#define m_GENERIC (1<<PROCESSOR_GENERIC)
const char* ix86_tune_feature_names[X86_TUNE_LAST] = {
#undef DEF_TUNE
@@ -1978,7 +1899,7 @@ static unsigned int initial_ix86_arch_features[X86_ARCH_LAST] = {
};
static const unsigned int x86_accumulate_outgoing_args
- = m_PPRO | m_P4_NOCONA | m_ATOM | m_SLM | m_CORE_ALL | m_AMD_MULTIPLE | m_GENERIC;
+ = m_PPRO | m_P4_NOCONA | m_ATOM | m_SLM | m_AMD_MULTIPLE | m_GENERIC;
static const unsigned int x86_arch_always_fancy_math_387
= m_PENT | m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_AMD_MULTIPLE | m_GENERIC;
@@ -2032,6 +1953,9 @@ enum reg_class const regclass_map[FIRST_PSEUDO_REGISTER] =
EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS,
EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS,
EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS, EVEX_SSE_REGS,
+ /* Mask registers. */
+ MASK_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS,
+ MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS, MASK_EVEX_REGS,
};
/* The "default" register map used in 32bit mode. */
@@ -2047,6 +1971,7 @@ int const dbx_register_map[FIRST_PSEUDO_REGISTER] =
-1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */
-1, -1, -1, -1, -1, -1, -1, -1, /* AVX-512 registers 16-23*/
-1, -1, -1, -1, -1, -1, -1, -1, /* AVX-512 registers 24-31*/
+ 93, 94, 95, 96, 97, 98, 99, 100, /* Mask registers */
};
/* The "default" register map used in 64bit mode. */
@@ -2062,6 +1987,7 @@ int const dbx64_register_map[FIRST_PSEUDO_REGISTER] =
25, 26, 27, 28, 29, 30, 31, 32, /* extended SSE registers */
67, 68, 69, 70, 71, 72, 73, 74, /* AVX-512 registers 16-23 */
75, 76, 77, 78, 79, 80, 81, 82, /* AVX-512 registers 24-31 */
+ 118, 119, 120, 121, 122, 123, 124, 125, /* Mask registers */
};
/* Define the register numbers to be used in Dwarf debugging information.
@@ -2129,6 +2055,7 @@ int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER] =
-1, -1, -1, -1, -1, -1, -1, -1, /* extended SSE registers */
-1, -1, -1, -1, -1, -1, -1, -1, /* AVX-512 registers 16-23*/
-1, -1, -1, -1, -1, -1, -1, -1, /* AVX-512 registers 24-31*/
+ 93, 94, 95, 96, 97, 98, 99, 100, /* Mask registers */
};
/* Define parameter passing and return registers. */
@@ -2378,8 +2305,7 @@ static const struct ptt processor_target_table[PROCESSOR_max] =
{&core_cost, 16, 10, 16, 10, 16},
/* Core avx2 */
{&core_cost, 16, 10, 16, 10, 16},
- {&generic32_cost, 16, 7, 16, 7, 16},
- {&generic64_cost, 16, 10, 16, 10, 16},
+ {&generic_cost, 16, 10, 16, 10, 16},
{&amdfam10_cost, 32, 24, 32, 7, 32},
{&bdver1_cost, 16, 10, 16, 7, 11},
{&bdver2_cost, 16, 10, 16, 7, 11},
@@ -3176,7 +3102,7 @@ ix86_option_override_internal (bool main_args_p)
| PTA_XOP | PTA_LWP | PTA_BMI | PTA_TBM | PTA_F16C
| PTA_FMA | PTA_PRFCHW | PTA_FXSR | PTA_XSAVE
| PTA_XSAVEOPT | PTA_FSGSBASE},
- {"btver1", PROCESSOR_BTVER1, CPU_GENERIC64,
+ {"btver1", PROCESSOR_BTVER1, CPU_GENERIC,
PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3
| PTA_SSSE3 | PTA_SSE4A |PTA_ABM | PTA_CX16 | PTA_PRFCHW
| PTA_FXSR | PTA_XSAVE},
@@ -3187,9 +3113,7 @@ ix86_option_override_internal (bool main_args_p)
| PTA_BMI | PTA_F16C | PTA_MOVBE | PTA_PRFCHW
| PTA_FXSR | PTA_XSAVE | PTA_XSAVEOPT},
- {"generic32", PROCESSOR_GENERIC32, CPU_PENTIUMPRO,
- PTA_HLE /* flags are only used for -march switch. */ },
- {"generic64", PROCESSOR_GENERIC64, CPU_GENERIC64,
+ {"generic", PROCESSOR_GENERIC, CPU_GENERIC,
PTA_64BIT
| PTA_HLE /* flags are only used for -march switch. */ },
};
@@ -3289,16 +3213,12 @@ ix86_option_override_internal (bool main_args_p)
-mtune=native, as it was changed by the driver. */
|| !strcmp (ix86_tune_string, "native"))
{
- if (TARGET_64BIT)
- ix86_tune_string = "generic64";
- else
- ix86_tune_string = "generic32";
+ ix86_tune_string = "generic";
}
/* If this call is for setting the option attribute, allow the
- generic32/generic64 that was previously set. */
+ generic that was previously set. */
else if (!main_args_p
- && (!strcmp (ix86_tune_string, "generic32")
- || !strcmp (ix86_tune_string, "generic64")))
+ && !strcmp (ix86_tune_string, "generic"))
;
else if (!strncmp (ix86_tune_string, "generic", 7))
error ("bad value (%s) for %stune=%s %s",
@@ -3324,10 +3244,7 @@ ix86_option_override_internal (bool main_args_p)
|| !strcmp (ix86_tune_string, "x86-64")
|| !strcmp (ix86_tune_string, "i686"))
{
- if (TARGET_64BIT)
- ix86_tune_string = "generic64";
- else
- ix86_tune_string = "generic32";
+ ix86_tune_string = "generic";
}
}
@@ -3357,6 +3274,12 @@ ix86_option_override_internal (bool main_args_p)
if (!global_options_set.x_ix86_abi)
ix86_abi = DEFAULT_ABI;
+ /* For targets using ms ABI enable ms-extensions, if not
+ explicit turned off. For non-ms ABI we turn off this
+ option. */
+ if (!global_options_set.x_flag_ms_extensions)
+ flag_ms_extensions = (MS_ABI == DEFAULT_ABI);
+
if (global_options_set.x_ix86_cmodel)
{
switch (ix86_cmodel)
@@ -3618,20 +3541,6 @@ ix86_option_override_internal (bool main_args_p)
"instruction set");
}
}
- else
- {
- /* Adjust tuning when compiling for 32-bit ABI. */
- switch (ix86_tune)
- {
- case PROCESSOR_GENERIC64:
- ix86_tune = PROCESSOR_GENERIC32;
- ix86_schedule = CPU_PENTIUMPRO;
- break;
-
- default:
- break;
- }
- }
/* Intel CPUs have always interpreted SSE prefetch instructions as
NOPs; so, we can enable SSE prefetch instructions even when
-mtune (rather than -march) points us to a processor that has them.
@@ -4218,8 +4127,13 @@ ix86_conditional_register_usage (void)
/* If AVX512F is disabled, squash the registers. */
if (! TARGET_AVX512F)
- for (i = FIRST_EXT_REX_SSE_REG; i <= LAST_EXT_REX_SSE_REG; i++)
- fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = "";
+ {
+ for (i = FIRST_EXT_REX_SSE_REG; i <= LAST_EXT_REX_SSE_REG; i++)
+ fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = "";
+
+ for (i = FIRST_MASK_REG; i <= LAST_MASK_REG; i++)
+ fixed_regs[i] = call_used_regs[i] = 1, reg_names[i] = "";
+ }
}
@@ -5706,17 +5620,9 @@ ix86_function_arg_regno_p (int regno)
&& (regno < FIRST_SSE_REG + SSE_REGPARM_MAX)));
}
- if (TARGET_MACHO)
- {
- if (SSE_REGNO_P (regno) && TARGET_SSE)
- return true;
- }
- else
- {
- if (TARGET_SSE && SSE_REGNO_P (regno)
- && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX))
- return true;
- }
+ if (TARGET_SSE && SSE_REGNO_P (regno)
+ && (regno < FIRST_SSE_REG + SSE_REGPARM_MAX))
+ return true;
/* TODO: The function should depend on current function ABI but
builtins.c would need updating then. Therefore we use the
@@ -11605,8 +11511,8 @@ ix86_expand_split_stack_prologue (void)
JUMP_LABEL (jump_insn) = label;
/* Mark the jump as very likely to be taken. */
- add_reg_note (jump_insn, REG_BR_PROB,
- GEN_INT (REG_BR_PROB_BASE - REG_BR_PROB_BASE / 100));
+ add_int_reg_note (jump_insn, REG_BR_PROB,
+ REG_BR_PROB_BASE - REG_BR_PROB_BASE / 100);
if (split_stack_fn == NULL_RTX)
split_stack_fn = gen_rtx_SYMBOL_REF (Pmode, "__morestack");
@@ -14902,7 +14808,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
x = find_reg_note (current_output_insn, REG_BR_PROB, 0);
if (x)
{
- int pred_val = INTVAL (XEXP (x, 0));
+ int pred_val = XINT (x, 0);
if (pred_val < REG_BR_PROB_BASE * 45 / 100
|| pred_val > REG_BR_PROB_BASE * 55 / 100)
@@ -16551,8 +16457,8 @@ ix86_avx256_split_vector_move_misalign (rtx op0, rtx op1)
gcc_unreachable ();
case V32QImode:
extract = gen_avx_vextractf128v32qi;
- load_unaligned = gen_avx_loaddqu256;
- store_unaligned = gen_avx_storedqu256;
+ load_unaligned = gen_avx_loaddquv32qi;
+ store_unaligned = gen_avx_storedquv32qi;
mode = V16QImode;
break;
case V8SFmode:
@@ -16655,10 +16561,56 @@ void
ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
{
rtx op0, op1, m;
+ rtx (*load_unaligned) (rtx, rtx);
+ rtx (*store_unaligned) (rtx, rtx);
op0 = operands[0];
op1 = operands[1];
+ if (GET_MODE_SIZE (mode) == 64)
+ {
+ switch (GET_MODE_CLASS (mode))
+ {
+ case MODE_VECTOR_INT:
+ case MODE_INT:
+ op0 = gen_lowpart (V16SImode, op0);
+ op1 = gen_lowpart (V16SImode, op1);
+ /* FALLTHRU */
+
+ case MODE_VECTOR_FLOAT:
+ switch (GET_MODE (op0))
+ {
+ default:
+ gcc_unreachable ();
+ case V16SImode:
+ load_unaligned = gen_avx512f_loaddquv16si;
+ store_unaligned = gen_avx512f_storedquv16si;
+ break;
+ case V16SFmode:
+ load_unaligned = gen_avx512f_loadups512;
+ store_unaligned = gen_avx512f_storeups512;
+ break;
+ case V8DFmode:
+ load_unaligned = gen_avx512f_loadupd512;
+ store_unaligned = gen_avx512f_storeupd512;
+ break;
+ }
+
+ if (MEM_P (op1))
+ emit_insn (load_unaligned (op0, op1));
+ else if (MEM_P (op0))
+ emit_insn (store_unaligned (op0, op1));
+ else
+ gcc_unreachable ();
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ return;
+ }
+
if (TARGET_AVX
&& GET_MODE_SIZE (mode) == 32)
{
@@ -16691,7 +16643,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
op0 = gen_lowpart (V16QImode, op0);
op1 = gen_lowpart (V16QImode, op1);
/* We will eventually emit movups based on insn attributes. */
- emit_insn (gen_sse2_loaddqu (op0, op1));
+ emit_insn (gen_sse2_loaddquv16qi (op0, op1));
}
else if (TARGET_SSE2 && mode == V2DFmode)
{
@@ -16766,7 +16718,7 @@ ix86_expand_vector_move_misalign (enum machine_mode mode, rtx operands[])
op0 = gen_lowpart (V16QImode, op0);
op1 = gen_lowpart (V16QImode, op1);
/* We will eventually emit movups based on insn attributes. */
- emit_insn (gen_sse2_storedqu (op0, op1));
+ emit_insn (gen_sse2_storedquv16qi (op0, op1));
}
else if (TARGET_SSE2 && mode == V2DFmode)
{
@@ -17460,13 +17412,23 @@ distance_agu_use_in_bb (unsigned int regno,
rtx insn, int distance, rtx start,
bool *found, bool *redefined)
{
- basic_block bb = start ? BLOCK_FOR_INSN (start) : NULL;
+ basic_block bb = NULL;
rtx next = start;
rtx prev = NULL;
*found = false;
*redefined = false;
+ if (start != NULL_RTX)
+ {
+ bb = BLOCK_FOR_INSN (start);
+ if (start != BB_HEAD (bb))
+ /* If insn and start belong to the same bb, set prev to insn,
+ so the call to increase_distance will increase the distance
+ between insns by 1. */
+ prev = insn;
+ }
+
while (next
&& next != insn
&& distance < LEA_SEARCH_THRESHOLD)
@@ -19538,7 +19500,7 @@ ix86_split_fp_branch (enum rtx_code code, rtx op1, rtx op2,
gen_rtx_IF_THEN_ELSE (VOIDmode,
condition, target1, target2)));
if (split_branch_probability >= 0)
- add_reg_note (i, REG_BR_PROB, GEN_INT (split_branch_probability));
+ add_int_reg_note (i, REG_BR_PROB, split_branch_probability);
}
void
@@ -22045,7 +22007,7 @@ predict_jump (int prob)
{
rtx insn = get_last_insn ();
gcc_assert (JUMP_P (insn));
- add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
+ add_int_reg_note (insn, REG_BR_PROB, prob);
}
/* Helper function for the string operations below. Dest VARIABLE whether
@@ -23329,7 +23291,7 @@ ix86_expand_movmem (rtx dst, rtx src, rtx count_exp, rtx align_exp,
if (count_exp != const0_rtx && epilogue_size_needed > 1)
expand_movmem_epilogue (dst, src, destreg, srcreg, count_exp,
- size_needed);
+ epilogue_size_needed);
if (jump_around_label)
emit_label (jump_around_label);
return true;
@@ -24484,8 +24446,7 @@ ix86_issue_rate (void)
case PROCESSOR_K8:
case PROCESSOR_AMDFAM10:
case PROCESSOR_NOCONA:
- case PROCESSOR_GENERIC32:
- case PROCESSOR_GENERIC64:
+ case PROCESSOR_GENERIC:
case PROCESSOR_BDVER1:
case PROCESSOR_BDVER2:
case PROCESSOR_BDVER3:
@@ -24749,8 +24710,7 @@ ix86_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost)
case PROCESSOR_BTVER1:
case PROCESSOR_BTVER2:
case PROCESSOR_ATOM:
- case PROCESSOR_GENERIC32:
- case PROCESSOR_GENERIC64:
+ case PROCESSOR_GENERIC:
memory = get_attr_memory (insn);
/* Show ability of reorder buffer to hide latency of load by executing
@@ -27486,13 +27446,13 @@ static const struct builtin_description bdesc_special_args[] =
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_lfence, "__builtin_ia32_lfence", IX86_BUILTIN_LFENCE, UNKNOWN, (int) VOID_FTYPE_VOID },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_mfence, 0, IX86_BUILTIN_MFENCE, UNKNOWN, (int) VOID_FTYPE_VOID },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_storeupd, "__builtin_ia32_storeupd", IX86_BUILTIN_STOREUPD, UNKNOWN, (int) VOID_FTYPE_PDOUBLE_V2DF },
- { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_storedqu, "__builtin_ia32_storedqu", IX86_BUILTIN_STOREDQU, UNKNOWN, (int) VOID_FTYPE_PCHAR_V16QI },
+ { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_storedquv16qi, "__builtin_ia32_storedqu", IX86_BUILTIN_STOREDQU, UNKNOWN, (int) VOID_FTYPE_PCHAR_V16QI },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntv2df, "__builtin_ia32_movntpd", IX86_BUILTIN_MOVNTPD, UNKNOWN, (int) VOID_FTYPE_PDOUBLE_V2DF },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntv2di, "__builtin_ia32_movntdq", IX86_BUILTIN_MOVNTDQ, UNKNOWN, (int) VOID_FTYPE_PV2DI_V2DI },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_movntisi, "__builtin_ia32_movnti", IX86_BUILTIN_MOVNTI, UNKNOWN, (int) VOID_FTYPE_PINT_INT },
{ OPTION_MASK_ISA_SSE2 | OPTION_MASK_ISA_64BIT, CODE_FOR_sse2_movntidi, "__builtin_ia32_movnti64", IX86_BUILTIN_MOVNTI64, UNKNOWN, (int) VOID_FTYPE_PLONGLONG_LONGLONG },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_loadupd, "__builtin_ia32_loadupd", IX86_BUILTIN_LOADUPD, UNKNOWN, (int) V2DF_FTYPE_PCDOUBLE },
- { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_loaddqu, "__builtin_ia32_loaddqu", IX86_BUILTIN_LOADDQU, UNKNOWN, (int) V16QI_FTYPE_PCCHAR },
+ { OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_loaddquv16qi, "__builtin_ia32_loaddqu", IX86_BUILTIN_LOADDQU, UNKNOWN, (int) V16QI_FTYPE_PCCHAR },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_loadhpd_exp, "__builtin_ia32_loadhpd", IX86_BUILTIN_LOADHPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_PCDOUBLE },
{ OPTION_MASK_ISA_SSE2, CODE_FOR_sse2_loadlpd_exp, "__builtin_ia32_loadlpd", IX86_BUILTIN_LOADLPD, UNKNOWN, (int) V2DF_FTYPE_V2DF_PCDOUBLE },
@@ -27521,8 +27481,8 @@ static const struct builtin_description bdesc_special_args[] =
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_loadups256, "__builtin_ia32_loadups256", IX86_BUILTIN_LOADUPS256, UNKNOWN, (int) V8SF_FTYPE_PCFLOAT },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_storeupd256, "__builtin_ia32_storeupd256", IX86_BUILTIN_STOREUPD256, UNKNOWN, (int) VOID_FTYPE_PDOUBLE_V4DF },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_storeups256, "__builtin_ia32_storeups256", IX86_BUILTIN_STOREUPS256, UNKNOWN, (int) VOID_FTYPE_PFLOAT_V8SF },
- { OPTION_MASK_ISA_AVX, CODE_FOR_avx_loaddqu256, "__builtin_ia32_loaddqu256", IX86_BUILTIN_LOADDQU256, UNKNOWN, (int) V32QI_FTYPE_PCCHAR },
- { OPTION_MASK_ISA_AVX, CODE_FOR_avx_storedqu256, "__builtin_ia32_storedqu256", IX86_BUILTIN_STOREDQU256, UNKNOWN, (int) VOID_FTYPE_PCHAR_V32QI },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_avx_loaddquv32qi, "__builtin_ia32_loaddqu256", IX86_BUILTIN_LOADDQU256, UNKNOWN, (int) V32QI_FTYPE_PCCHAR },
+ { OPTION_MASK_ISA_AVX, CODE_FOR_avx_storedquv32qi, "__builtin_ia32_storedqu256", IX86_BUILTIN_STOREDQU256, UNKNOWN, (int) VOID_FTYPE_PCHAR_V32QI },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_lddqu256, "__builtin_ia32_lddqu256", IX86_BUILTIN_LDDQU256, UNKNOWN, (int) V32QI_FTYPE_PCCHAR },
{ OPTION_MASK_ISA_AVX, CODE_FOR_avx_movntv4di, "__builtin_ia32_movntdq256", IX86_BUILTIN_MOVNTDQ256, UNKNOWN, (int) VOID_FTYPE_PV4DI_V4DI },
@@ -33912,10 +33872,12 @@ ix86_preferred_reload_class (rtx x, reg_class_t regclass)
return regclass;
/* Force constants into memory if we are loading a (nonzero) constant into
- an MMX or SSE register. This is because there are no MMX/SSE instructions
- to load from a constant. */
+ an MMX, SSE or MASK register. This is because there are no MMX/SSE/MASK
+ instructions to load from a constant. */
if (CONSTANT_P (x)
- && (MAYBE_MMX_CLASS_P (regclass) || MAYBE_SSE_CLASS_P (regclass)))
+ && (MAYBE_MMX_CLASS_P (regclass)
+ || MAYBE_SSE_CLASS_P (regclass)
+ || MAYBE_MASK_CLASS_P (regclass)))
return NO_REGS;
/* Prefer SSE regs only, if we can use them for math. */
@@ -34019,10 +33981,11 @@ ix86_secondary_reload (bool in_p, rtx x, reg_class_t rclass,
/* QImode spills from non-QI registers require
intermediate register on 32bit targets. */
- if (!TARGET_64BIT
- && !in_p && mode == QImode
- && INTEGER_CLASS_P (rclass)
- && MAYBE_NON_Q_CLASS_P (rclass))
+ if (mode == QImode
+ && (MAYBE_MASK_CLASS_P (rclass)
+ || (!TARGET_64BIT && !in_p
+ && INTEGER_CLASS_P (rclass)
+ && MAYBE_NON_Q_CLASS_P (rclass))))
{
int regno;
@@ -34444,6 +34407,8 @@ ix86_hard_regno_mode_ok (int regno, enum machine_mode mode)
return false;
if (STACK_REGNO_P (regno))
return VALID_FP_MODE_P (mode);
+ if (MASK_REGNO_P (regno))
+ return VALID_MASK_REG_MODE (mode);
if (SSE_REGNO_P (regno))
{
/* We implement the move patterns for all vector modes into and
@@ -35253,6 +35218,10 @@ x86_order_regs_for_local_alloc (void)
for (i = FIRST_EXT_REX_SSE_REG; i <= LAST_EXT_REX_SSE_REG; i++)
reg_alloc_order [pos++] = i;
+ /* Mask register. */
+ for (i = FIRST_MASK_REG; i <= LAST_MASK_REG; i++)
+ reg_alloc_order [pos++] = i;
+
/* x87 registers. */
if (TARGET_SSE_MATH)
for (i = FIRST_STACK_REG; i <= LAST_STACK_REG; i++)
@@ -42813,20 +42782,17 @@ ix86_add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
unsigned *cost = (unsigned *) data;
unsigned retval = 0;
- if (flag_vect_cost_model)
- {
- tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
- int stmt_cost = ix86_builtin_vectorization_cost (kind, vectype, misalign);
+ tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
+ int stmt_cost = ix86_builtin_vectorization_cost (kind, vectype, misalign);
- /* Statements in an inner loop relative to the loop being
- vectorized are weighted more heavily. The value here is
- arbitrary and could potentially be improved with analysis. */
- if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
- count *= 50; /* FIXME. */
+ /* Statements in an inner loop relative to the loop being
+ vectorized are weighted more heavily. The value here is
+ arbitrary and could potentially be improved with analysis. */
+ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
+ count *= 50; /* FIXME. */
- retval = (unsigned) (count * stmt_cost);
- cost[where] += retval;
- }
+ retval = (unsigned) (count * stmt_cost);
+ cost[where] += retval;
return retval;
}
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index e820aa65ac5..440844e7735 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -251,9 +251,7 @@ extern const struct processor_costs ix86_size_cost;
#define TARGET_CORE2 (ix86_tune == PROCESSOR_CORE2)
#define TARGET_COREI7 (ix86_tune == PROCESSOR_COREI7)
#define TARGET_HASWELL (ix86_tune == PROCESSOR_HASWELL)
-#define TARGET_GENERIC32 (ix86_tune == PROCESSOR_GENERIC32)
-#define TARGET_GENERIC64 (ix86_tune == PROCESSOR_GENERIC64)
-#define TARGET_GENERIC (TARGET_GENERIC32 || TARGET_GENERIC64)
+#define TARGET_GENERIC (ix86_tune == PROCESSOR_GENERIC)
#define TARGET_AMDFAM10 (ix86_tune == PROCESSOR_AMDFAM10)
#define TARGET_BDVER1 (ix86_tune == PROCESSOR_BDVER1)
#define TARGET_BDVER2 (ix86_tune == PROCESSOR_BDVER2)
@@ -893,7 +891,7 @@ enum target_cpu_default
eliminated during reloading in favor of either the stack or frame
pointer. */
-#define FIRST_PSEUDO_REGISTER 69
+#define FIRST_PSEUDO_REGISTER 77
/* Number of hardware registers that go into the DWARF-2 unwind info.
If not defined, equals FIRST_PSEUDO_REGISTER. */
@@ -923,7 +921,9 @@ enum target_cpu_default
/*xmm16,xmm17,xmm18,xmm19,xmm20,xmm21,xmm22,xmm23*/ \
0, 0, 0, 0, 0, 0, 0, 0, \
/*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/ \
- 0, 0, 0, 0, 0, 0, 0, 0 }
+ 0, 0, 0, 0, 0, 0, 0, 0, \
+/* k0, k1, k2, k3, k4, k5, k6, k7*/ \
+ 0, 0, 0, 0, 0, 0, 0, 0 }
/* 1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any
@@ -955,7 +955,9 @@ enum target_cpu_default
/*xmm16,xmm17,xmm18,xmm19,xmm20,xmm21,xmm22,xmm23*/ \
6, 6, 6, 6, 6, 6, 6, 6, \
/*xmm24,xmm25,xmm26,xmm27,xmm28,xmm29,xmm30,xmm31*/ \
- 6, 6, 6, 6, 6, 6, 6, 6 }
+ 6, 6, 6, 6, 6, 6, 6, 6, \
+ /* k0, k1, k2, k3, k4, k5, k6, k7*/ \
+ 1, 1, 1, 1, 1, 1, 1, 1 }
/* Order in which to allocate registers. Each register must be
listed once, even those in FIXED_REGISTERS. List frame pointer
@@ -971,7 +973,7 @@ enum target_cpu_default
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, \
33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, \
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, \
- 63, 64, 65, 66, 67, 68 }
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 }
/* ADJUST_REG_ALLOC_ORDER is a macro which permits reg_alloc_order
to be rearranged based on a particular function. When using sse math,
@@ -1068,6 +1070,8 @@ enum target_cpu_default
|| (MODE) == V16SImode || (MODE) == V32HImode || (MODE) == V8DFmode \
|| (MODE) == V16SFmode)
+#define VALID_MASK_REG_MODE(MODE) ((MODE) == HImode || (MODE) == QImode)
+
/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. */
#define HARD_REGNO_MODE_OK(REGNO, MODE) \
@@ -1093,8 +1097,10 @@ enum target_cpu_default
(CC_REGNO_P (REGNO) ? VOIDmode \
: (MODE) == VOIDmode && (NREGS) != 1 ? VOIDmode \
: (MODE) == VOIDmode ? choose_hard_reg_mode ((REGNO), (NREGS), false) \
- : (MODE) == HImode && !TARGET_PARTIAL_REG_STALL ? SImode \
- : (MODE) == QImode && !(TARGET_64BIT || QI_REGNO_P (REGNO)) ? SImode \
+ : (MODE) == HImode && !(TARGET_PARTIAL_REG_STALL \
+ || MASK_REGNO_P (REGNO)) ? SImode \
+ : (MODE) == QImode && !(TARGET_64BIT || QI_REGNO_P (REGNO) \
+ || MASK_REGNO_P (REGNO)) ? SImode \
: (MODE))
/* The only ABI that saves SSE registers across calls is Win64 (thus no
@@ -1141,6 +1147,9 @@ enum target_cpu_default
#define FIRST_EXT_REX_SSE_REG (LAST_REX_SSE_REG + 1) /*53*/
#define LAST_EXT_REX_SSE_REG (FIRST_EXT_REX_SSE_REG + 15) /*68*/
+#define FIRST_MASK_REG (LAST_EXT_REX_SSE_REG + 1) /*69*/
+#define LAST_MASK_REG (FIRST_MASK_REG + 7) /*76*/
+
/* Override this in other tm.h files to cope with various OS lossage
requiring a frame pointer. */
#ifndef SUBTARGET_FRAME_POINTER_REQUIRED
@@ -1229,6 +1238,8 @@ enum reg_class
FLOAT_INT_REGS,
INT_SSE_REGS,
FLOAT_INT_SSE_REGS,
+ MASK_EVEX_REGS,
+ MASK_REGS,
ALL_REGS, LIM_REG_CLASSES
};
@@ -1250,6 +1261,8 @@ enum reg_class
reg_classes_intersect_p ((CLASS), ALL_SSE_REGS)
#define MAYBE_MMX_CLASS_P(CLASS) \
reg_classes_intersect_p ((CLASS), MMX_REGS)
+#define MAYBE_MASK_CLASS_P(CLASS) \
+ reg_classes_intersect_p ((CLASS), MASK_REGS)
#define Q_CLASS_P(CLASS) \
reg_class_subset_p ((CLASS), Q_REGS)
@@ -1282,6 +1295,8 @@ enum reg_class
"FLOAT_INT_REGS", \
"INT_SSE_REGS", \
"FLOAT_INT_SSE_REGS", \
+ "MASK_EVEX_REGS", \
+ "MASK_REGS", \
"ALL_REGS" }
/* Define which registers fit in which classes. This is an initializer
@@ -1319,7 +1334,9 @@ enum reg_class
{ 0x11ffff, 0x1fe0, 0x0 }, /* FLOAT_INT_REGS */ \
{ 0x1ff100ff,0xffffffe0, 0x1f }, /* INT_SSE_REGS */ \
{ 0x1ff1ffff,0xffffffe0, 0x1f }, /* FLOAT_INT_SSE_REGS */ \
-{ 0xffffffff,0xffffffff, 0x1f } \
+ { 0x0, 0x0,0x1fc0 }, /* MASK_EVEX_REGS */ \
+ { 0x0, 0x0,0x1fe0 }, /* MASK_REGS */ \
+{ 0xffffffff,0xffffffff,0x1fff } \
}
/* The same information, inverted:
@@ -1377,6 +1394,8 @@ enum reg_class
: (N) <= LAST_REX_SSE_REG ? (FIRST_REX_SSE_REG + (N) - 8) \
: (FIRST_EXT_REX_SSE_REG + (N) - 16))
+#define MASK_REGNO_P(N) IN_RANGE ((N), FIRST_MASK_REG, LAST_MASK_REG)
+#define ANY_MASK_REG_P(X) (REG_P (X) && MASK_REGNO_P (REGNO (X)))
#define SSE_FLOAT_MODE_P(MODE) \
((TARGET_SSE && (MODE) == SFmode) || (TARGET_SSE2 && (MODE) == DFmode))
@@ -1933,7 +1952,8 @@ do { \
"xmm16", "xmm17", "xmm18", "xmm19", \
"xmm20", "xmm21", "xmm22", "xmm23", \
"xmm24", "xmm25", "xmm26", "xmm27", \
- "xmm28", "xmm29", "xmm30", "xmm31" }
+ "xmm28", "xmm29", "xmm30", "xmm31", \
+ "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7" }
#define REGISTER_NAMES HI_REGISTER_NAMES
@@ -2119,8 +2139,7 @@ enum processor_type
PROCESSOR_CORE2,
PROCESSOR_COREI7,
PROCESSOR_HASWELL,
- PROCESSOR_GENERIC32,
- PROCESSOR_GENERIC64,
+ PROCESSOR_GENERIC,
PROCESSOR_AMDFAM10,
PROCESSOR_BDVER1,
PROCESSOR_BDVER2,
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 3307b081aaa..03b38426c4b 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -328,6 +328,14 @@
(XMM29_REG 66)
(XMM30_REG 67)
(XMM31_REG 68)
+ (MASK0_REG 69)
+ (MASK1_REG 70)
+ (MASK2_REG 71)
+ (MASK3_REG 72)
+ (MASK4_REG 73)
+ (MASK5_REG 74)
+ (MASK6_REG 75)
+ (MASK7_REG 76)
])
;; Insns whose names begin with "x86_" are emitted by gen_FOO calls
@@ -341,7 +349,7 @@
;; Processor type.
(define_attr "cpu" "none,pentium,pentiumpro,geode,k6,athlon,k8,core2,corei7,
- atom,slm,generic64,amdfam10,bdver1,bdver2,bdver3,btver1,btver2"
+ atom,slm,generic,amdfam10,bdver1,bdver2,bdver3,btver1,btver2"
(const (symbol_ref "ix86_schedule")))
;; A basic instruction type. Refinements due to arguments to be
@@ -360,7 +368,7 @@
sseishft,sseishft1,ssecmp,ssecomi,
ssecvt,ssecvt1,sseicvt,sseins,
sseshuf,sseshuf1,ssemuladd,sse4arg,
- lwp,
+ lwp,mskmov,msklog,
mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
(const_string "other"))
@@ -379,7 +387,7 @@
ssemul,sseimul,ssediv,sselog,sselog1,
sseishft,sseishft1,ssecmp,ssecomi,
ssecvt,ssecvt1,sseicvt,sseins,
- sseshuf,sseshuf1,ssemuladd,sse4arg")
+ sseshuf,sseshuf1,ssemuladd,sse4arg,mskmov")
(const_string "sse")
(eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
(const_string "mmx")
@@ -390,7 +398,7 @@
;; The (bounding maximum) length of an instruction immediate.
(define_attr "length_immediate" ""
(cond [(eq_attr "type" "incdec,setcc,icmov,str,lea,other,multi,idiv,leave,
- bitmanip,imulx")
+ bitmanip,imulx,msklog,mskmov")
(const_int 0)
(eq_attr "unit" "i387,sse,mmx")
(const_int 0)
@@ -451,7 +459,7 @@
;; Set when 0f opcode prefix is used.
(define_attr "prefix_0f" ""
(if_then_else
- (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip")
+ (ior (eq_attr "type" "imovx,setcc,icmov,bitmanip,msklog,mskmov")
(eq_attr "unit" "sse,mmx"))
(const_int 1)
(const_int 0)))
@@ -651,7 +659,7 @@
fmov,fcmp,fsgn,
sse,ssemov,ssecmp,ssecomi,ssecvt,ssecvt1,sseicvt,
sselog1,sseshuf1,sseadd1,sseiadd1,sseishft1,
- mmx,mmxmov,mmxcmp,mmxcvt")
+ mmx,mmxmov,mmxcmp,mmxcvt,mskmov,msklog")
(match_operand 2 "memory_operand"))
(const_string "load")
(and (eq_attr "type" "icmov,ssemuladd,sse4arg")
@@ -695,7 +703,7 @@
;; Used to control the "enabled" attribute on a per-instruction basis.
(define_attr "isa" "base,x64,x64_sse4,x64_sse4_noavx,x64_avx,nox64,
sse2,sse2_noavx,sse3,sse4,sse4_noavx,avx,noavx,
- avx2,noavx2,bmi2,fma4,fma,avx512f,noavx512f,fma_avx512f"
+ avx2,noavx2,bmi,bmi2,fma4,fma,avx512f,noavx512f,fma_avx512f"
(const_string "base"))
(define_attr "enabled" ""
@@ -718,6 +726,7 @@
(eq_attr "isa" "noavx") (symbol_ref "!TARGET_AVX")
(eq_attr "isa" "avx2") (symbol_ref "TARGET_AVX2")
(eq_attr "isa" "noavx2") (symbol_ref "!TARGET_AVX2")
+ (eq_attr "isa" "bmi") (symbol_ref "TARGET_BMI")
(eq_attr "isa" "bmi2") (symbol_ref "TARGET_BMI2")
(eq_attr "isa" "fma4") (symbol_ref "TARGET_FMA4")
(eq_attr "isa" "fma") (symbol_ref "TARGET_FMA")
@@ -770,6 +779,7 @@
;; Mapping of logic operators
(define_code_iterator any_logic [and ior xor])
(define_code_iterator any_or [ior xor])
+(define_code_iterator fpint_logic [and xor])
;; Base name for insn mnemonic.
(define_code_attr logic [(and "and") (ior "or") (xor "xor")])
@@ -2213,8 +2223,8 @@
(const_string "SI")))])
(define_insn "*movhi_internal"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r ,r ,m")
- (match_operand:HI 1 "general_operand" "r ,rn,rm,rn"))]
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,r ,r ,m ,Yk,Yk,rm")
+ (match_operand:HI 1 "general_operand" "r ,rn,rm,rn,rm,Yk,Yk"))]
"!(MEM_P (operands[0]) && MEM_P (operands[1]))"
{
switch (get_attr_type (insn))
@@ -2223,6 +2233,16 @@
/* movzwl is faster than movw on p2 due to partial word stalls,
though not as fast as an aligned movl. */
return "movz{wl|x}\t{%1, %k0|%k0, %1}";
+
+ case TYPE_MSKMOV:
+ switch (which_alternative)
+ {
+ case 4: return "kmovw\t{%k1, %0|%0, %k1}";
+ case 5: return "kmovw\t{%1, %0|%0, %1}";
+ case 6: return "kmovw\t{%1, %k0|%k0, %1}";
+ default: gcc_unreachable ();
+ }
+
default:
if (get_attr_mode (insn) == MODE_SI)
return "mov{l}\t{%k1, %k0|%k0, %k1}";
@@ -2240,11 +2260,17 @@
(and (eq_attr "alternative" "1,2")
(match_operand:HI 1 "aligned_operand"))
(const_string "imov")
+ (eq_attr "alternative" "4,5,6")
+ (const_string "mskmov")
(and (match_test "TARGET_MOVX")
(eq_attr "alternative" "0,2"))
(const_string "imovx")
]
(const_string "imov")))
+ (set (attr "prefix")
+ (if_then_else (eq_attr "alternative" "4,5,6")
+ (const_string "vex")
+ (const_string "orig")))
(set (attr "mode")
(cond [(eq_attr "type" "imovx")
(const_string "SI")
@@ -2269,8 +2295,8 @@
;; register stall machines with, where we use QImode instructions, since
;; partial register stall can be caused there. Then we use movzx.
(define_insn "*movqi_internal"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m")
- (match_operand:QI 1 "general_operand" "q ,qn,qm,q,rn,qm,qn"))]
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=q,q ,q ,r,r ,?r,m ,Yk,Yk,r")
+ (match_operand:QI 1 "general_operand" "q ,qn,qm,q,rn,qm,qn,r ,Yk,Yk"))]
"!(MEM_P (operands[0]) && MEM_P (operands[1]))"
{
switch (get_attr_type (insn))
@@ -2278,6 +2304,16 @@
case TYPE_IMOVX:
gcc_assert (ANY_QI_REG_P (operands[1]) || MEM_P (operands[1]));
return "movz{bl|x}\t{%1, %k0|%k0, %1}";
+
+ case TYPE_MSKMOV:
+ switch (which_alternative)
+ {
+ case 7: return "kmovw\t{%k1, %0|%0, %k1}";
+ case 8: return "kmovw\t{%1, %0|%0, %1}";
+ case 9: return "kmovw\t{%1, %k0|%k0, %1}";
+ default: gcc_unreachable ();
+ }
+
default:
if (get_attr_mode (insn) == MODE_SI)
return "mov{l}\t{%k1, %k0|%k0, %k1}";
@@ -2297,11 +2333,17 @@
(const_string "imov")
(eq_attr "alternative" "3,5")
(const_string "imovx")
+ (eq_attr "alternative" "7,8,9")
+ (const_string "mskmov")
(and (match_test "TARGET_MOVX")
(eq_attr "alternative" "2"))
(const_string "imovx")
]
(const_string "imov")))
+ (set (attr "prefix")
+ (if_then_else (eq_attr "alternative" "7,8,9")
+ (const_string "vex")
+ (const_string "orig")))
(set (attr "mode")
(cond [(eq_attr "alternative" "3,4,5")
(const_string "SI")
@@ -7494,6 +7536,26 @@
operands[3] = gen_lowpart (QImode, operands[3]);
})
+(define_split
+ [(set (match_operand:SWI12 0 "mask_reg_operand")
+ (any_logic:SWI12 (match_operand:SWI12 1 "mask_reg_operand")
+ (match_operand:SWI12 2 "mask_reg_operand")))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_AVX512F && reload_completed"
+ [(set (match_dup 0)
+ (any_logic:SWI12 (match_dup 1)
+ (match_dup 2)))])
+
+(define_insn "*k<logic><mode>"
+ [(set (match_operand:SWI12 0 "mask_reg_operand" "=Yk")
+ (any_logic:SWI12 (match_operand:SWI12 1 "mask_reg_operand" "Yk")
+ (match_operand:SWI12 2 "mask_reg_operand" "Yk")))]
+ "TARGET_AVX512F"
+ "k<logic>w\t{%2, %1, %0|%0, %1, %2}";
+ [(set_attr "mode" "<MODE>")
+ (set_attr "type" "msklog")
+ (set_attr "prefix" "vex")])
+
;; %%% This used to optimize known byte-wide and operations to memory,
;; and sometimes to QImode registers. If this is considered useful,
;; it should be done with splitters.
@@ -7617,9 +7679,9 @@
(set_attr "mode" "SI")])
(define_insn "*andhi_1"
- [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,Ya")
- (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm")
- (match_operand:HI 2 "general_operand" "rn,rm,L")))
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,r,Ya,!Yk")
+ (and:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0,qm,Yk")
+ (match_operand:HI 2 "general_operand" "rn,rm,L,Yk")))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (AND, HImode, operands)"
{
@@ -7628,34 +7690,38 @@
case TYPE_IMOVX:
return "#";
+ case TYPE_MSKLOG:
+ return "kandw\t{%2, %1, %0|%0, %1, %2}";
+
default:
gcc_assert (rtx_equal_p (operands[0], operands[1]));
return "and{w}\t{%2, %0|%0, %2}";
}
}
- [(set_attr "type" "alu,alu,imovx")
- (set_attr "length_immediate" "*,*,0")
+ [(set_attr "type" "alu,alu,imovx,msklog")
+ (set_attr "length_immediate" "*,*,0,*")
(set (attr "prefix_rex")
(if_then_else
(and (eq_attr "type" "imovx")
(match_operand 1 "ext_QIreg_operand"))
(const_string "1")
(const_string "*")))
- (set_attr "mode" "HI,HI,SI")])
+ (set_attr "mode" "HI,HI,SI,HI")])
;; %%% Potential partial reg stall on alternative 2. What to do?
(define_insn "*andqi_1"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r")
- (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
- (match_operand:QI 2 "general_operand" "qn,qmn,rn")))
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,q,r,!Yk")
+ (and:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,Yk")
+ (match_operand:QI 2 "general_operand" "qn,qmn,rn,Yk")))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (AND, QImode, operands)"
"@
and{b}\t{%2, %0|%0, %2}
and{b}\t{%2, %0|%0, %2}
- and{l}\t{%k2, %k0|%k0, %k2}"
- [(set_attr "type" "alu")
- (set_attr "mode" "QI,QI,SI")])
+ and{l}\t{%k2, %k0|%k0, %k2}
+ kandw\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "alu,alu,alu,msklog")
+ (set_attr "mode" "QI,QI,SI,HI")])
(define_insn "*andqi_1_slp"
[(set (strict_low_part (match_operand:QI 0 "nonimmediate_operand" "+qm,q"))
@@ -7668,6 +7734,40 @@
[(set_attr "type" "alu1")
(set_attr "mode" "QI")])
+(define_insn "kandn<mode>"
+ [(set (match_operand:SWI12 0 "register_operand" "=r,&r,!Yk")
+ (and:SWI12
+ (not:SWI12
+ (match_operand:SWI12 1 "register_operand" "r,0,Yk"))
+ (match_operand:SWI12 2 "register_operand" "r,r,Yk")))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_AVX512F"
+ "@
+ andn\t{%k2, %k1, %k0|%k0, %k1, %k2}
+ #
+ kandnw\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "isa" "bmi,*,avx512f")
+ (set_attr "type" "bitmanip,*,msklog")
+ (set_attr "prefix" "*,*,vex")
+ (set_attr "btver2_decode" "direct,*,*")
+ (set_attr "mode" "<MODE>")])
+
+(define_split
+ [(set (match_operand:SWI12 0 "general_reg_operand")
+ (and:SWI12
+ (not:SWI12
+ (match_dup 0))
+ (match_operand:SWI12 1 "general_reg_operand")))
+ (clobber (reg:CC FLAGS_REG))]
+ "TARGET_AVX512F && !TARGET_BMI && reload_completed"
+ [(set (match_dup 0)
+ (not:HI (match_dup 0)))
+ (parallel [(set (match_dup 0)
+ (and:HI (match_dup 0)
+ (match_dup 1)))
+ (clobber (reg:CC FLAGS_REG))])]
+ "")
+
;; Turn *anddi_1 into *andsi_1_zext if possible.
(define_split
[(set (match_operand:DI 0 "register_operand")
@@ -7999,29 +8099,44 @@
"ix86_expand_binary_operator (<CODE>, <MODE>mode, operands); DONE;")
(define_insn "*<code><mode>_1"
- [(set (match_operand:SWI248 0 "nonimmediate_operand" "=r,rm")
- (any_or:SWI248
- (match_operand:SWI248 1 "nonimmediate_operand" "%0,0")
- (match_operand:SWI248 2 "<general_operand>" "<g>,r<i>")))
+ [(set (match_operand:SWI48 0 "nonimmediate_operand" "=r,rm")
+ (any_or:SWI48
+ (match_operand:SWI48 1 "nonimmediate_operand" "%0,0")
+ (match_operand:SWI48 2 "<general_operand>" "<g>,r<i>")))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
"<logic>{<imodesuffix>}\t{%2, %0|%0, %2}"
[(set_attr "type" "alu")
(set_attr "mode" "<MODE>")])
+(define_insn "*<code>hi_1"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,rm,!Yk")
+ (any_or:HI
+ (match_operand:HI 1 "nonimmediate_operand" "%0,0,Yk")
+ (match_operand:HI 2 "general_operand" "<g>,r<i>,Yk")))
+ (clobber (reg:CC FLAGS_REG))]
+ "ix86_binary_operator_ok (<CODE>, HImode, operands)"
+ "@
+ <logic>{w}\t{%2, %0|%0, %2}
+ <logic>{w}\t{%2, %0|%0, %2}
+ k<logic>w\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "alu,alu,msklog")
+ (set_attr "mode" "HI")])
+
;; %%% Potential partial reg stall on alternative 2. What to do?
(define_insn "*<code>qi_1"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r")
- (any_or:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0")
- (match_operand:QI 2 "general_operand" "qmn,qn,rn")))
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=q,m,r,!Yk")
+ (any_or:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0,0,Yk")
+ (match_operand:QI 2 "general_operand" "qmn,qn,rn,Yk")))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (<CODE>, QImode, operands)"
"@
<logic>{b}\t{%2, %0|%0, %2}
<logic>{b}\t{%2, %0|%0, %2}
- <logic>{l}\t{%k2, %k0|%k0, %k2}"
- [(set_attr "type" "alu")
- (set_attr "mode" "QI,QI,SI")])
+ <logic>{l}\t{%k2, %k0|%k0, %k2}
+ k<logic>w\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "alu,alu,alu,msklog")
+ (set_attr "mode" "QI,QI,SI,HI")])
;; See comment for addsi_1_zext why we do use nonimmediate_operand
(define_insn "*<code>si_1_zext"
@@ -8071,6 +8186,74 @@
[(set_attr "type" "alu")
(set_attr "mode" "<MODE>")])
+(define_insn "kxnor<mode>"
+ [(set (match_operand:SWI12 0 "register_operand" "=r,!Yk")
+ (not:SWI12
+ (xor:SWI12
+ (match_operand:SWI12 1 "register_operand" "0,Yk")
+ (match_operand:SWI12 2 "register_operand" "r,Yk"))))]
+ "TARGET_AVX512F"
+ "@
+ #
+ kxnorw\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "*,msklog")
+ (set_attr "prefix" "*,vex")
+ (set_attr "mode" "<MODE>")])
+
+(define_split
+ [(set (match_operand:SWI12 0 "general_reg_operand")
+ (not:SWI12
+ (xor:SWI12
+ (match_dup 0)
+ (match_operand:SWI12 1 "general_reg_operand"))))]
+ "TARGET_AVX512F && reload_completed"
+ [(parallel [(set (match_dup 0)
+ (xor:HI (match_dup 0)
+ (match_dup 1)))
+ (clobber (reg:CC FLAGS_REG))])
+ (set (match_dup 0)
+ (not:HI (match_dup 0)))]
+ "")
+
+(define_insn "kortestzhi"
+ [(set (reg:CCZ FLAGS_REG)
+ (compare:CCZ
+ (ior:HI
+ (match_operand:HI 0 "register_operand" "Yk")
+ (match_operand:HI 1 "register_operand" "Yk"))
+ (const_int 0)))]
+ "TARGET_AVX512F && ix86_match_ccmode (insn, CCZmode)"
+ "kortestw\t{%1, %0|%0, %1}"
+ [(set_attr "mode" "HI")
+ (set_attr "type" "msklog")
+ (set_attr "prefix" "vex")])
+
+(define_insn "kortestchi"
+ [(set (reg:CCC FLAGS_REG)
+ (compare:CCC
+ (ior:HI
+ (match_operand:HI 0 "register_operand" "Yk")
+ (match_operand:HI 1 "register_operand" "Yk"))
+ (const_int -1)))]
+ "TARGET_AVX512F && ix86_match_ccmode (insn, CCCmode)"
+ "kortestw\t{%1, %0|%0, %1}"
+ [(set_attr "mode" "HI")
+ (set_attr "type" "msklog")
+ (set_attr "prefix" "vex")])
+
+(define_insn "kunpckhi"
+ [(set (match_operand:HI 0 "register_operand" "=Yk")
+ (ior:HI
+ (ashift:HI
+ (match_operand:HI 1 "register_operand" "Yk")
+ (const_int 8))
+ (zero_extend:HI (match_operand:QI 2 "register_operand" "Yk"))))]
+ "TARGET_AVX512F"
+ "kunpckbw\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "mode" "HI")
+ (set_attr "type" "msklog")
+ (set_attr "prefix" "vex")])
+
;; See comment for addsi_1_zext why we do use nonimmediate_operand
;; ??? Special case for immediate operand is missing - it is tricky.
(define_insn "*<code>si_2_zext"
@@ -8640,23 +8823,38 @@
"ix86_expand_unary_operator (NOT, <MODE>mode, operands); DONE;")
(define_insn "*one_cmpl<mode>2_1"
- [(set (match_operand:SWI248 0 "nonimmediate_operand" "=rm")
- (not:SWI248 (match_operand:SWI248 1 "nonimmediate_operand" "0")))]
+ [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm")
+ (not:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0")))]
"ix86_unary_operator_ok (NOT, <MODE>mode, operands)"
"not{<imodesuffix>}\t%0"
[(set_attr "type" "negnot")
(set_attr "mode" "<MODE>")])
+(define_insn "*one_cmplhi2_1"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm,!Yk")
+ (not:HI (match_operand:HI 1 "nonimmediate_operand" "0,Yk")))]
+ "ix86_unary_operator_ok (NOT, HImode, operands)"
+ "@
+ not{w}\t%0
+ knotw\t{%1, %0|%0, %1}"
+ [(set_attr "isa" "*,avx512f")
+ (set_attr "type" "negnot,msklog")
+ (set_attr "prefix" "*,vex")
+ (set_attr "mode" "HI")])
+
;; %%% Potential partial reg stall on alternative 1. What to do?
(define_insn "*one_cmplqi2_1"
- [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r")
- (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=qm,r,!Yk")
+ (not:QI (match_operand:QI 1 "nonimmediate_operand" "0,0,Yk")))]
"ix86_unary_operator_ok (NOT, QImode, operands)"
"@
not{b}\t%0
- not{l}\t%k0"
- [(set_attr "type" "negnot")
- (set_attr "mode" "QI,SI")])
+ not{l}\t%k0
+ knotw\t{%1, %0|%0, %1}"
+ [(set_attr "isa" "*,*,avx512f")
+ (set_attr "type" "negnot,negnot,msklog")
+ (set_attr "prefix" "*,*,vex")
+ (set_attr "mode" "QI,SI,QI")])
;; ??? Currently never generated - xor is used instead.
(define_insn "*one_cmplsi2_1_zext"
@@ -16423,11 +16621,11 @@
})
;; Avoid redundant prefixes by splitting HImode arithmetic to SImode.
-
+;; Do not split instructions with mask registers.
(define_split
- [(set (match_operand 0 "register_operand")
+ [(set (match_operand 0 "general_reg_operand")
(match_operator 3 "promotable_binary_operator"
- [(match_operand 1 "register_operand")
+ [(match_operand 1 "general_reg_operand")
(match_operand 2 "aligned_operand")]))
(clobber (reg:CC FLAGS_REG))]
"! TARGET_PARTIAL_REG_STALL && reload_completed
@@ -16522,9 +16720,10 @@
operands[1] = gen_lowpart (SImode, operands[1]);
})
+;; Do not split instructions with mask regs.
(define_split
- [(set (match_operand 0 "register_operand")
- (not (match_operand 1 "register_operand")))]
+ [(set (match_operand 0 "general_reg_operand")
+ (not (match_operand 1 "general_reg_operand")))]
"! TARGET_PARTIAL_REG_STALL && reload_completed
&& (GET_MODE (operands[0]) == HImode
|| (GET_MODE (operands[0]) == QImode
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 3959c3892e4..18f425c4b87 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -32,6 +32,11 @@
(and (match_code "reg")
(not (match_test "ANY_FP_REGNO_P (REGNO (op))"))))
+;; True if the operand is a GENERAL class register.
+(define_predicate "general_reg_operand"
+ (and (match_code "reg")
+ (match_test "GENERAL_REG_P (op)")))
+
;; Return true if OP is a register operand other than an i387 fp register.
(define_predicate "register_and_not_fp_reg_operand"
(and (match_code "reg")
@@ -52,6 +57,10 @@
(and (match_code "reg")
(match_test "EXT_REX_SSE_REGNO_P (REGNO (op))")))
+;; True if the operand is an AVX-512 mask register.
+(define_predicate "mask_reg_operand"
+ (and (match_code "reg")
+ (match_test "MASK_REGNO_P (REGNO (op))")))
;; True if the operand is a Q_REGS class register.
(define_predicate "q_regs_operand"
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 9d9469e2c62..10637cc22e8 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -97,13 +97,13 @@
;; All vector modes including V?TImode, used in move patterns.
(define_mode_iterator VMOVE
- [(V32QI "TARGET_AVX") V16QI
- (V16HI "TARGET_AVX") V8HI
- (V8SI "TARGET_AVX") V4SI
- (V4DI "TARGET_AVX") V2DI
+ [(V64QI "TARGET_AVX512F") (V32QI "TARGET_AVX") V16QI
+ (V32HI "TARGET_AVX512F") (V16HI "TARGET_AVX") V8HI
+ (V16SI "TARGET_AVX512F") (V8SI "TARGET_AVX") V4SI
+ (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") V2DI
(V2TI "TARGET_AVX") V1TI
- (V8SF "TARGET_AVX") V4SF
- (V4DF "TARGET_AVX") V2DF])
+ (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
+ (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") V2DF])
;; All vector modes
(define_mode_iterator V
@@ -124,6 +124,11 @@
;; All vector float modes
(define_mode_iterator VF
+ [(V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
+ (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
+
+;; 128- and 256-bit float vector modes
+(define_mode_iterator VF_128_256
[(V8SF "TARGET_AVX") V4SF
(V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
@@ -143,6 +148,10 @@
(define_mode_iterator VF_256
[V8SF V4DF])
+;; All 512bit vector float modes
+(define_mode_iterator VF_512
+ [V16SF V8DF])
+
;; All vector integer modes
(define_mode_iterator VI
[(V32QI "TARGET_AVX") V16QI
@@ -160,6 +169,10 @@
(define_mode_iterator VI1
[(V32QI "TARGET_AVX") V16QI])
+(define_mode_iterator VI_UNALIGNED_LOADSTORE
+ [(V32QI "TARGET_AVX") V16QI
+ (V16SI "TARGET_AVX512F") (V8DI "TARGET_AVX512F")])
+
;; All DImode vector integer modes
(define_mode_iterator VI8
[(V4DI "TARGET_AVX") V2DI])
@@ -212,11 +225,18 @@
(V4SI "TARGET_AVX2") (V2DI "TARGET_AVX2")
(V8SI "TARGET_AVX2") (V4DI "TARGET_AVX2")])
+(define_mode_attr sse2_avx_avx512f
+ [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
+ (V4SI "sse2") (V8SI "avx") (V16SI "avx512f")
+ (V8DI "avx512f")
+ (V16SF "avx512f") (V8SF "avx") (V4SF "avx")
+ (V8DF "avx512f") (V4DF "avx") (V2DF "avx")])
+
(define_mode_attr sse2_avx2
[(V16QI "sse2") (V32QI "avx2")
(V8HI "sse2") (V16HI "avx2")
- (V4SI "sse2") (V8SI "avx2")
- (V2DI "sse2") (V4DI "avx2")
+ (V4SI "sse2") (V8SI "avx2") (V16SI "avx512f")
+ (V2DI "sse2") (V4DI "avx2") (V8DI "avx512f")
(V1TI "sse2") (V2TI "avx2")])
(define_mode_attr ssse3_avx2
@@ -229,7 +249,7 @@
(define_mode_attr sse4_1_avx2
[(V16QI "sse4_1") (V32QI "avx2")
(V8HI "sse4_1") (V16HI "avx2")
- (V4SI "sse4_1") (V8SI "avx2")
+ (V4SI "sse4_1") (V8SI "avx2") (V16SI "avx512f")
(V2DI "sse4_1") (V4DI "avx2")])
(define_mode_attr avx_avx2
@@ -244,6 +264,12 @@
(V4SI "vec") (V8SI "avx2")
(V2DI "vec") (V4DI "avx2")])
+(define_mode_attr avx2_avx512f
+ [(V4SI "avx2") (V8SI "avx2") (V16SI "avx512f")
+ (V2DI "avx2") (V4DI "avx2") (V8DI "avx512f")
+ (V8SF "avx2") (V16SF "avx512f")
+ (V4DF "avx2") (V8DF "avx512f")])
+
(define_mode_attr shuffletype
[(V16SF "f") (V16SI "i") (V8DF "f") (V8DI "i")
(V8SF "f") (V8SI "i") (V4DF "f") (V4DI "i")
@@ -287,22 +313,26 @@
(define_mode_attr sse
[(SF "sse") (DF "sse2")
(V4SF "sse") (V2DF "sse2")
- (V8SF "avx") (V4DF "avx")])
+ (V16SF "avx512f") (V8SF "avx")
+ (V8DF "avx512f") (V4DF "avx")])
(define_mode_attr sse2
- [(V16QI "sse2") (V32QI "avx")
- (V2DI "sse2") (V4DI "avx")])
+ [(V16QI "sse2") (V32QI "avx") (V64QI "avx512f")
+ (V2DI "sse2") (V4DI "avx") (V8DI "avx512f")])
(define_mode_attr sse3
[(V16QI "sse3") (V32QI "avx")])
(define_mode_attr sse4_1
[(V4SF "sse4_1") (V2DF "sse4_1")
- (V8SF "avx") (V4DF "avx")])
+ (V8SF "avx") (V4DF "avx")
+ (V8DF "avx512f")])
(define_mode_attr avxsizesuffix
- [(V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
+ [(V64QI "512") (V32HI "512") (V16SI "512") (V8DI "512")
+ (V32QI "256") (V16HI "256") (V8SI "256") (V4DI "256")
(V16QI "") (V8HI "") (V4SI "") (V2DI "")
+ (V16SF "512") (V8DF "512")
(V8SF "256") (V4DF "256")
(V4SF "") (V2DF "")])
@@ -318,11 +348,13 @@
;; Mapping of vector float modes to an integer mode of the same size
(define_mode_attr sseintvecmode
- [(V8SF "V8SI") (V4DF "V4DI")
- (V4SF "V4SI") (V2DF "V2DI")
- (V8SI "V8SI") (V4DI "V4DI")
- (V4SI "V4SI") (V2DI "V2DI")
- (V16HI "V16HI") (V8HI "V8HI")
+ [(V16SF "V16SI") (V8DF "V8DI")
+ (V8SF "V8SI") (V4DF "V4DI")
+ (V4SF "V4SI") (V2DF "V2DI")
+ (V16SI "V16SI") (V8DI "V8DI")
+ (V8SI "V8SI") (V4DI "V4DI")
+ (V4SI "V4SI") (V2DI "V2DI")
+ (V16HI "V16HI") (V8HI "V8HI")
(V32QI "V32QI") (V16QI "V16QI")])
(define_mode_attr sseintvecmodelower
@@ -349,8 +381,10 @@
;; Mapping of vector modes ti packed single mode of the same size
(define_mode_attr ssePSmode
- [(V32QI "V8SF") (V16QI "V4SF")
- (V16HI "V8SF") (V8HI "V4SF")
+ [(V16SI "V16SF") (V8DF "V16SF")
+ (V16SF "V16SF") (V8DI "V16SF")
+ (V64QI "V16SF") (V32QI "V8SF") (V16QI "V4SF")
+ (V32HI "V16SF") (V16HI "V8SF") (V8HI "V4SF")
(V8SI "V8SF") (V4SI "V4SF")
(V4DI "V8SF") (V2DI "V4SF")
(V2TI "V8SF") (V1TI "V4SF")
@@ -665,12 +699,13 @@
(define_insn "<sse>_loadu<ssemodesuffix><avxsizesuffix>"
[(set (match_operand:VF 0 "register_operand" "=v")
(unspec:VF
- [(match_operand:VF 1 "memory_operand" "m")]
+ [(match_operand:VF 1 "nonimmediate_operand" "vm")]
UNSPEC_LOADU))]
"TARGET_SSE"
{
switch (get_attr_mode (insn))
{
+ case MODE_V16SF:
case MODE_V8SF:
case MODE_V4SF:
return "%vmovups\t{%1, %0|%0, %1}";
@@ -694,12 +729,13 @@
(define_insn "<sse>_storeu<ssemodesuffix><avxsizesuffix>"
[(set (match_operand:VF 0 "memory_operand" "=m")
(unspec:VF
- [(match_operand:VF 1 "register_operand" "x")]
+ [(match_operand:VF 1 "register_operand" "v")]
UNSPEC_STOREU))]
"TARGET_SSE"
{
switch (get_attr_mode (insn))
{
+ case MODE_V16SF:
case MODE_V8SF:
case MODE_V4SF:
return "%vmovups\t{%1, %0|%0, %1}";
@@ -721,10 +757,11 @@
]
(const_string "<MODE>")))])
-(define_insn "<sse2>_loaddqu<avxsizesuffix>"
- [(set (match_operand:VI1 0 "register_operand" "=v")
- (unspec:VI1 [(match_operand:VI1 1 "memory_operand" "m")]
- UNSPEC_LOADU))]
+(define_insn "<sse2_avx_avx512f>_loaddqu<mode>"
+ [(set (match_operand:VI_UNALIGNED_LOADSTORE 0 "register_operand" "=v")
+ (unspec:VI_UNALIGNED_LOADSTORE
+ [(match_operand:VI_UNALIGNED_LOADSTORE 1 "nonimmediate_operand" "vm")]
+ UNSPEC_LOADU))]
"TARGET_SSE2"
{
switch (get_attr_mode (insn))
@@ -732,6 +769,11 @@
case MODE_V8SF:
case MODE_V4SF:
return "%vmovups\t{%1, %0|%0, %1}";
+ case MODE_XI:
+ if (<MODE>mode == V8DImode)
+ return "vmovdqu64\t{%1, %0|%0, %1}";
+ else
+ return "vmovdqu32\t{%1, %0|%0, %1}";
default:
return "%vmovdqu\t{%1, %0|%0, %1}";
}
@@ -754,10 +796,11 @@
]
(const_string "<sseinsnmode>")))])
-(define_insn "<sse2>_storedqu<avxsizesuffix>"
- [(set (match_operand:VI1 0 "memory_operand" "=m")
- (unspec:VI1 [(match_operand:VI1 1 "register_operand" "v")]
- UNSPEC_STOREU))]
+(define_insn "<sse2_avx_avx512f>_storedqu<mode>"
+ [(set (match_operand:VI_UNALIGNED_LOADSTORE 0 "memory_operand" "=m")
+ (unspec:VI_UNALIGNED_LOADSTORE
+ [(match_operand:VI_UNALIGNED_LOADSTORE 1 "register_operand" "v")]
+ UNSPEC_STOREU))]
"TARGET_SSE2"
{
switch (get_attr_mode (insn))
@@ -765,6 +808,11 @@
case MODE_V8SF:
case MODE_V4SF:
return "%vmovups\t{%1, %0|%0, %1}";
+ case MODE_XI:
+ if (<MODE>mode == V8DImode)
+ return "vmovdqu64\t{%1, %0|%0, %1}";
+ else
+ return "vmovdqu32\t{%1, %0|%0, %1}";
default:
return "%vmovdqu\t{%1, %0|%0, %1}";
}
@@ -821,8 +869,9 @@
(define_insn "<sse>_movnt<mode>"
[(set (match_operand:VF 0 "memory_operand" "=m")
- (unspec:VF [(match_operand:VF 1 "register_operand" "x")]
- UNSPEC_MOVNT))]
+ (unspec:VF
+ [(match_operand:VF 1 "register_operand" "v")]
+ UNSPEC_MOVNT))]
"TARGET_SSE"
"%vmovnt<ssemodesuffix>\t{%1, %0|%0, %1}"
[(set_attr "type" "ssemov")
@@ -852,9 +901,9 @@
(define_mode_iterator STORENT_MODE
[(DI "TARGET_SSE2 && TARGET_64BIT") (SI "TARGET_SSE2")
(SF "TARGET_SSE4A") (DF "TARGET_SSE4A")
- (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
- (V8SF "TARGET_AVX") V4SF
- (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
+ (V8DI "TARGET_AVX512F") (V4DI "TARGET_AVX") (V2DI "TARGET_SSE2")
+ (V16SF "TARGET_AVX512F") (V8SF "TARGET_AVX") V4SF
+ (V8DF "TARGET_AVX512F") (V4DF "TARGET_AVX") (V2DF "TARGET_SSE2")])
(define_expand "storent<mode>"
[(set (match_operand:STORENT_MODE 0 "memory_operand")
@@ -877,10 +926,10 @@
"ix86_expand_fp_absneg_operator (<CODE>, <MODE>mode, operands); DONE;")
(define_insn_and_split "*absneg<mode>2"
- [(set (match_operand:VF 0 "register_operand" "=x,x,x,x")
+ [(set (match_operand:VF 0 "register_operand" "=x,x,v,v")
(match_operator:VF 3 "absneg_operator"
- [(match_operand:VF 1 "nonimmediate_operand" "0, xm,x, m")]))
- (use (match_operand:VF 2 "nonimmediate_operand" "xm,0, xm,x"))]
+ [(match_operand:VF 1 "nonimmediate_operand" "0, xm, v, m")]))
+ (use (match_operand:VF 2 "nonimmediate_operand" "xm, 0, vm,v"))]
"TARGET_SSE"
"#"
"&& reload_completed"
@@ -962,10 +1011,10 @@
"ix86_fixup_binary_operands_no_copy (MULT, <MODE>mode, operands);")
(define_insn "*mul<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
+ [(set (match_operand:VF 0 "register_operand" "=x,v")
(mult:VF
- (match_operand:VF 1 "nonimmediate_operand" "%0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")))]
+ (match_operand:VF 1 "nonimmediate_operand" "%0,v")
+ (match_operand:VF 2 "nonimmediate_operand" "xm,vm")))]
"TARGET_SSE && ix86_binary_operator_ok (MULT, <MODE>mode, operands)"
"@
mul<ssemodesuffix>\t{%2, %0|%0, %2}
@@ -1239,10 +1288,10 @@
;; presence of -0.0 and NaN.
(define_insn "*ieee_smin<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
+ [(set (match_operand:VF 0 "register_operand" "=v,v")
(unspec:VF
- [(match_operand:VF 1 "register_operand" "0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")]
+ [(match_operand:VF 1 "register_operand" "0,v")
+ (match_operand:VF 2 "nonimmediate_operand" "vm,vm")]
UNSPEC_IEEE_MIN))]
"TARGET_SSE"
"@
@@ -1254,10 +1303,10 @@
(set_attr "mode" "<MODE>")])
(define_insn "*ieee_smax<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
+ [(set (match_operand:VF 0 "register_operand" "=v,v")
(unspec:VF
- [(match_operand:VF 1 "register_operand" "0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")]
+ [(match_operand:VF 1 "register_operand" "0,v")
+ (match_operand:VF 2 "nonimmediate_operand" "vm,vm")]
UNSPEC_IEEE_MAX))]
"TARGET_SSE"
"@
@@ -1632,10 +1681,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define_insn "avx_cmp<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x")
- (unspec:VF
- [(match_operand:VF 1 "register_operand" "x")
- (match_operand:VF 2 "nonimmediate_operand" "xm")
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x")
+ (unspec:VF_128_256
+ [(match_operand:VF_128_256 1 "register_operand" "x")
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "xm")
(match_operand:SI 3 "const_0_to_31_operand" "n")]
UNSPEC_PCMP))]
"TARGET_AVX"
@@ -1663,10 +1712,10 @@
(set_attr "mode" "<ssescalarmode>")])
(define_insn "*<sse>_maskcmp<mode>3_comm"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
- (match_operator:VF 3 "sse_comparison_operator"
- [(match_operand:VF 1 "register_operand" "%0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")]))]
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
+ (match_operator:VF_128_256 3 "sse_comparison_operator"
+ [(match_operand:VF_128_256 1 "register_operand" "%0,x")
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "xm,xm")]))]
"TARGET_SSE
&& GET_RTX_CLASS (GET_CODE (operands[3])) == RTX_COMM_COMPARE"
"@
@@ -1679,10 +1728,10 @@
(set_attr "mode" "<MODE>")])
(define_insn "<sse>_maskcmp<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
- (match_operator:VF 3 "sse_comparison_operator"
- [(match_operand:VF 1 "register_operand" "0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")]))]
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
+ (match_operator:VF_128_256 3 "sse_comparison_operator"
+ [(match_operand:VF_128_256 1 "register_operand" "0,x")
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "xm,xm")]))]
"TARGET_SSE"
"@
cmp%D3<ssemodesuffix>\t{%2, %0|%0, %2}
@@ -1792,11 +1841,11 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define_insn "<sse>_andnot<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
+ [(set (match_operand:VF 0 "register_operand" "=x,v")
(and:VF
(not:VF
- (match_operand:VF 1 "register_operand" "0,x"))
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")))]
+ (match_operand:VF 1 "register_operand" "0,v"))
+ (match_operand:VF 2 "nonimmediate_operand" "xm,vm")))]
"TARGET_SSE"
{
static char buf[32];
@@ -1825,12 +1874,19 @@
gcc_unreachable ();
}
+ /* There is no vandnp[sd]. Use vpandnq. */
+ if (GET_MODE_SIZE (<MODE>mode) == 64)
+ {
+ suffix = "q";
+ ops = "vpandn%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
+ }
+
snprintf (buf, sizeof (buf), ops, suffix);
return buf;
}
[(set_attr "isa" "noavx,avx")
(set_attr "type" "sselog")
- (set_attr "prefix" "orig,vex")
+ (set_attr "prefix" "orig,maybe_evex")
(set (attr "mode")
(cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
(const_string "<ssePSmode>")
@@ -1842,13 +1898,21 @@
(const_string "<MODE>")))])
(define_expand "<code><mode>3"
- [(set (match_operand:VF 0 "register_operand")
- (any_logic:VF
- (match_operand:VF 1 "nonimmediate_operand")
- (match_operand:VF 2 "nonimmediate_operand")))]
+ [(set (match_operand:VF_128_256 0 "register_operand")
+ (any_logic:VF_128_256
+ (match_operand:VF_128_256 1 "nonimmediate_operand")
+ (match_operand:VF_128_256 2 "nonimmediate_operand")))]
"TARGET_SSE"
"ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
+(define_expand "<code><mode>3"
+ [(set (match_operand:VF_512 0 "register_operand")
+ (fpint_logic:VF_512
+ (match_operand:VF_512 1 "nonimmediate_operand")
+ (match_operand:VF_512 2 "nonimmediate_operand")))]
+ "TARGET_AVX512F"
+ "ix86_fixup_binary_operands_no_copy (<CODE>, <MODE>mode, operands);")
+
(define_insn "*<code><mode>3"
[(set (match_operand:VF 0 "register_operand" "=x,v")
(any_logic:VF
@@ -1882,12 +1946,19 @@
gcc_unreachable ();
}
+ /* There is no v<logic>p[sd]. Use vp<logic>q. */
+ if (GET_MODE_SIZE (<MODE>mode) == 64)
+ {
+ suffix = "q";
+ ops = "vp<logic>%s\t{%%2, %%1, %%0|%%0, %%1, %%2}";
+ }
+
snprintf (buf, sizeof (buf), ops, suffix);
return buf;
}
[(set_attr "isa" "noavx,avx")
(set_attr "type" "sselog")
- (set_attr "prefix" "orig,vex")
+ (set_attr "prefix" "orig,maybe_evex")
(set (attr "mode")
(cond [(match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL")
(const_string "<ssePSmode>")
@@ -2105,6 +2176,23 @@
]
(const_string "TI")))])
+;; There are no floating point xor for V16SF and V8DF in avx512f
+;; but we need them for negation. Instead we use int versions of
+;; xor. Maybe there could be a better way to do that.
+
+(define_mode_attr avx512flogicsuff
+ [(V16SF "d") (V8DF "q")])
+
+(define_insn "avx512f_<logic><mode>"
+ [(set (match_operand:VF_512 0 "register_operand" "=v")
+ (fpint_logic:VF_512
+ (match_operand:VF_512 1 "register_operand" "v")
+ (match_operand:VF_512 2 "nonimmediate_operand" "vm")))]
+ "TARGET_AVX512F"
+ "vp<logic><avx512flogicsuff>\t{%2, %1, %0|%0, %1, %2}"
+ [(set_attr "type" "sselog")
+ (set_attr "prefix" "evex")])
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; FMA floating point multiply/accumulate instructions. These include
@@ -7747,7 +7835,7 @@
(define_insn "<sse>_movmsk<ssemodesuffix><avxsizesuffix>"
[(set (match_operand:SI 0 "register_operand" "=r")
(unspec:SI
- [(match_operand:VF 1 "register_operand" "x")]
+ [(match_operand:VF_128_256 1 "register_operand" "x")]
UNSPEC_MOVMSK))]
"TARGET_SSE"
"%vmovmsk<ssemodesuffix>\t{%1, %0|%0, %1}"
@@ -8537,10 +8625,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define_insn "<sse4_1>_blend<ssemodesuffix><avxsizesuffix>"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
- (vec_merge:VF
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")
- (match_operand:VF 1 "register_operand" "0,x")
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
+ (vec_merge:VF_128_256
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "xm,xm")
+ (match_operand:VF_128_256 1 "register_operand" "0,x")
(match_operand:SI 3 "const_0_to_<blendbits>_operand")))]
"TARGET_SSE4_1"
"@
@@ -8555,11 +8643,11 @@
(set_attr "mode" "<MODE>")])
(define_insn "<sse4_1>_blendv<ssemodesuffix><avxsizesuffix>"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
- (unspec:VF
- [(match_operand:VF 1 "register_operand" "0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")
- (match_operand:VF 3 "register_operand" "Yz,x")]
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
+ (unspec:VF_128_256
+ [(match_operand:VF_128_256 1 "register_operand" "0,x")
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "xm,xm")
+ (match_operand:VF_128_256 3 "register_operand" "Yz,x")]
UNSPEC_BLENDV))]
"TARGET_SSE4_1"
"@
@@ -8575,10 +8663,10 @@
(set_attr "mode" "<MODE>")])
(define_insn "<sse4_1>_dp<ssemodesuffix><avxsizesuffix>"
- [(set (match_operand:VF 0 "register_operand" "=x,x")
- (unspec:VF
- [(match_operand:VF 1 "nonimmediate_operand" "%0,x")
- (match_operand:VF 2 "nonimmediate_operand" "xm,xm")
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x,x")
+ (unspec:VF_128_256
+ [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,x")
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "xm,xm")
(match_operand:SI 3 "const_0_to_255_operand" "n,n")]
UNSPEC_DP))]
"TARGET_SSE4_1"
@@ -8909,8 +8997,8 @@
;; setting FLAGS_REG. But it is not a really compare instruction.
(define_insn "avx_vtest<ssemodesuffix><avxsizesuffix>"
[(set (reg:CC FLAGS_REG)
- (unspec:CC [(match_operand:VF 0 "register_operand" "x")
- (match_operand:VF 1 "nonimmediate_operand" "xm")]
+ (unspec:CC [(match_operand:VF_128_256 0 "register_operand" "x")
+ (match_operand:VF_128_256 1 "nonimmediate_operand" "xm")]
UNSPEC_VTESTP))]
"TARGET_AVX"
"vtest<ssemodesuffix>\t{%1, %0|%0, %1}"
@@ -8947,9 +9035,9 @@
(set_attr "mode" "TI")])
(define_insn "<sse4_1>_round<ssemodesuffix><avxsizesuffix>"
- [(set (match_operand:VF 0 "register_operand" "=x")
- (unspec:VF
- [(match_operand:VF 1 "nonimmediate_operand" "xm")
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x")
+ (unspec:VF_128_256
+ [(match_operand:VF_128_256 1 "nonimmediate_operand" "xm")
(match_operand:SI 2 "const_0_to_15_operand" "n")]
UNSPEC_ROUND))]
"TARGET_ROUND"
@@ -10341,10 +10429,10 @@
(set_attr "mode" "TI")])
(define_insn "xop_vpermil2<mode>3"
- [(set (match_operand:VF 0 "register_operand" "=x")
- (unspec:VF
- [(match_operand:VF 1 "register_operand" "x")
- (match_operand:VF 2 "nonimmediate_operand" "%x")
+ [(set (match_operand:VF_128_256 0 "register_operand" "=x")
+ (unspec:VF_128_256
+ [(match_operand:VF_128_256 1 "register_operand" "x")
+ (match_operand:VF_128_256 2 "nonimmediate_operand" "%x")
(match_operand:<sseintvecmode> 3 "nonimmediate_operand" "xm")
(match_operand:SI 4 "const_0_to_3_operand" "n")]
UNSPEC_VPERMIL2))]
@@ -10794,7 +10882,7 @@
= gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
})
-(define_insn "*avx_vpermilp<mode>"
+(define_insn "*<sse2_avx_avx512f>_vpermilp<mode>"
[(set (match_operand:VF 0 "register_operand" "=v")
(vec_select:VF
(match_operand:VF 1 "nonimmediate_operand" "vm")
@@ -10811,9 +10899,9 @@
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
(set_attr "prefix" "vex")
- (set_attr "mode" "<MODE>")])
+ (set_attr "mode" "<sseinsnmode>")])
-(define_insn "avx_vpermilvar<mode>3"
+(define_insn "<sse2_avx_avx512f>_vpermilvar<mode>3"
[(set (match_operand:VF 0 "register_operand" "=v")
(unspec:VF
[(match_operand:VF 1 "register_operand" "v")
@@ -10823,9 +10911,10 @@
"vpermil<ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
- (set_attr "prefix" "vex")
(set_attr "btver2_decode" "vector")
- (set_attr "mode" "<MODE>")])
+ (set_attr "prefix" "vex")
+ (set_attr "mode" "<sseinsnmode>")])
+
(define_expand "avx_vperm2f128<mode>3"
[(set (match_operand:AVX256MODE2P 0 "register_operand")
diff --git a/gcc/config/i386/t-i386 b/gcc/config/i386/t-i386
index 07624cc575e..1a76c4152f6 100644
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@ -16,22 +16,9 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-i386.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h dumpfile.h $(TM_H) \
- $(RTL_H) $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h \
- $(REAL_H) insn-config.h conditions.h output.h insn-codes.h \
- $(INSN_ATTR_H) $(FLAGS_H) $(C_COMMON_H) except.h $(FUNCTION_H) \
- $(RECOG_H) $(EXPR_H) $(OPTABS_H) toplev.h $(BASIC_BLOCK_H) \
- $(GGC_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h $(CGRAPH_H) \
- $(TREE_GIMPLE_H) $(DWARF2_H) $(DF_H) tm-constrs.h $(PARAMS_H) \
- i386-builtin-types.inc debug.h dwarf2out.h sbitmap.h $(FIBHEAP_H) \
- $(OPTS_H) $(DIAGNOSTIC_H) $(COMMON_TARGET_H) $(CONTEXT_H) $(PASS_MANAGER_H)
-
-i386-c.o: $(srcdir)/config/i386/i386-c.c \
- $(srcdir)/config/i386/i386-protos.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(TM_P_H) $(FLAGS_H) $(C_COMMON_H) $(GGC_H) \
- $(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/i386/i386-c.c
+i386-c.o: $(srcdir)/config/i386/i386-c.c i386-builtin-types.inc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
i386-builtin-types.inc: s-i386-bt ; @true
diff --git a/gcc/config/i386/winnt-cxx.c b/gcc/config/i386/winnt-cxx.c
index 323844afe41..92de46abd59 100644
--- a/gcc/config/i386/winnt-cxx.c
+++ b/gcc/config/i386/winnt-cxx.c
@@ -65,6 +65,13 @@ i386_pe_type_dllexport_p (tree decl)
if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE
&& DECL_ARTIFICIAL (decl) && !DECL_THUNK_P (decl))
return false;
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DECLARED_INLINE_P (decl))
+ {
+ if (DECL_REALLY_EXTERN (decl)
+ || !flag_keep_inline_dllexport)
+ return false;
+ }
return true;
}
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index c9e3aa98a37..58e95a3790b 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -110,6 +110,11 @@ i386_pe_determine_dllexport_p (tree decl)
if (!TREE_PUBLIC (decl))
return false;
+ if (TREE_CODE (decl) == FUNCTION_DECL
+ && DECL_DECLARED_INLINE_P (decl)
+ && !flag_keep_inline_dllexport)
+ return false;
+
if (lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true;
@@ -1173,10 +1178,10 @@ i386_pe_seh_unwind_emit (FILE *asm_out_file, rtx insn)
for (note = REG_NOTES (insn); note ; note = XEXP (note, 1))
{
- pat = XEXP (note, 0);
switch (REG_NOTE_KIND (note))
{
case REG_FRAME_RELATED_EXPR:
+ pat = XEXP (note, 0);
goto found;
case REG_CFA_DEF_CFA:
@@ -1190,6 +1195,7 @@ i386_pe_seh_unwind_emit (FILE *asm_out_file, rtx insn)
gcc_unreachable ();
case REG_CFA_ADJUST_CFA:
+ pat = XEXP (note, 0);
if (pat == NULL)
{
pat = PATTERN (insn);
@@ -1201,6 +1207,7 @@ i386_pe_seh_unwind_emit (FILE *asm_out_file, rtx insn)
break;
case REG_CFA_OFFSET:
+ pat = XEXP (note, 0);
if (pat == NULL)
pat = single_set (insn);
seh_cfa_offset (asm_out_file, seh, pat);
diff --git a/gcc/config/i386/x-darwin b/gcc/config/i386/x-darwin
index f0196bac41d..4967d695ce9 100644
--- a/gcc/config/i386/x-darwin
+++ b/gcc/config/i386/x-darwin
@@ -1,4 +1,3 @@
-host-i386-darwin.o : $(srcdir)/config/i386/host-i386-darwin.c \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h hosthooks.h $(HOSTHOOKS_DEF_H) \
- config/host-darwin.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+host-i386-darwin.o : $(srcdir)/config/i386/host-i386-darwin.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def
index e3a34ee7b2e..c3cf00f53b4 100644
--- a/gcc/config/i386/x86-tune.def
+++ b/gcc/config/i386/x86-tune.def
@@ -23,209 +23,379 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
tradeoff. We can't enable it for 32bit generic because it does not
work well with PPro base chips. */
DEF_TUNE (X86_TUNE_USE_LEAVE, "use_leave",
- m_386 | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE | m_GENERIC64)
+ m_386 | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE | m_GENERIC)
+
+/* X86_TUNE_PUSH_MEMORY: Enable generation of "push mem" instructions.
+ Some chips, like 486 and Pentium have problems with these sequences. */
DEF_TUNE (X86_TUNE_PUSH_MEMORY, "push_memory",
m_386 | m_P4_NOCONA | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE
| m_GENERIC)
+
+/* X86_TUNE_ZERO_EXTEND_WITH_AND: Use AND instruction instead
+ of mozbl/movwl. */
DEF_TUNE (X86_TUNE_ZERO_EXTEND_WITH_AND, "zero_extend_with_and", m_486 | m_PENT)
+
+/* X86_TUNE_UNROLL_STRLEN: Produce (quite lame) unrolled sequence for
+ inline strlen. This affects only -minline-all-stringops mode. By
+ default we always dispatch to a library since our internal strlen
+ is bad. */
DEF_TUNE (X86_TUNE_UNROLL_STRLEN, "unroll_strlen",
m_486 | m_PENT | m_PPRO | m_ATOM | m_SLM | m_CORE_ALL | m_K6
| m_AMD_MULTIPLE | m_GENERIC)
+
/* X86_TUNE_BRANCH_PREDICTION_HINTS: Branch hints were put in P4 based
on simulation result. But after P4 was made, no performance benefit
was observed with branch hints. It also increases the code size.
As a result, icc never generates branch hints. */
DEF_TUNE (X86_TUNE_BRANCH_PREDICTION_HINTS, "branch_prediction_hints", 0)
+
+/* X86_TUNE_DOUBLE_WITH_ADD: Use add instead of sal to double value in
+ an integer register. */
DEF_TUNE (X86_TUNE_DOUBLE_WITH_ADD, "double_with_add", ~m_386)
+
+/* X86_TUNE_USE_SAHF: Controls use of SAHF. */
DEF_TUNE (X86_TUNE_USE_SAHF, "use_sahf",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_K6_GEODE
| m_K8 | m_AMDFAM10 | m_BDVER | m_BTVER | m_GENERIC)
+
/* X86_TUNE_MOVX: Enable to zero extend integer registers to avoid
partial dependencies. */
DEF_TUNE (X86_TUNE_MOVX, "movx",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_GEODE
| m_AMD_MULTIPLE | m_GENERIC)
-/* X86_TUNE_PARTIAL_REG_STALL: We probably ought to watch for partial
- register stalls on Generic32 compilation setting as well. However
- in current implementation the partial register stalls are not eliminated
+
+/* X86_TUNE_PARTIAL_REG_STALL: Pentium pro, unlike later chips, handled
+ use of partial registers by renaming. This improved performance of 16bit
+ code where upper halves of registers are not used. It also leads to
+ an penalty whenever a 16bit store is followed by 32bit use. This flag
+ disables production of such sequences in common cases.
+ See also X86_TUNE_HIMODE_MATH.
+
+ In current implementation the partial register stalls are not eliminated
very well - they can be introduced via subregs synthesized by combine
- and can happen in caller/callee saving sequences. Because this option
- pays back little on PPro based chips and is in conflict with partial reg
- dependencies used by Athlon/P4 based chips, it is better to leave it off
- for generic32 for now. */
+ and can happen in caller/callee saving sequences. */
DEF_TUNE (X86_TUNE_PARTIAL_REG_STALL, "partial_reg_stall", m_PPRO)
+
+/* X86_TUNE_PARTIAL_FLAG_REG_STALL: this flag disables use of of flags
+ set by instructions affecting just some flags (in particular shifts).
+ This is because Core2 resolves dependencies on whole flags register
+ and such sequences introduce false dependency on previous instruction
+ setting full flags.
+
+ The flags does not affect generation of INC and DEC that is controlled
+ by X86_TUNE_USE_INCDEC.
+
+ This flag may be dropped from generic once core2-corei5 machines are
+ rare enough. */
DEF_TUNE (X86_TUNE_PARTIAL_FLAG_REG_STALL, "partial_flag_reg_stall",
- m_CORE_ALL | m_GENERIC)
+ m_CORE2 | m_GENERIC)
+
/* X86_TUNE_LCP_STALL: Avoid an expensive length-changing prefix stall
- * on 16-bit immediate moves into memory on Core2 and Corei7. */
+ on 16-bit immediate moves into memory on Core2 and Corei7. */
DEF_TUNE (X86_TUNE_LCP_STALL, "lcp_stall", m_CORE_ALL | m_GENERIC)
+
+/* X86_TUNE_USE_HIMODE_FIOP: Enables use of x87 instructions with 16bit
+ integer operand.
+ FIXME: Why this is disabled for modern chips? */
DEF_TUNE (X86_TUNE_USE_HIMODE_FIOP, "use_himode_fiop",
m_386 | m_486 | m_K6_GEODE)
+
+/* X86_TUNE_USE_SIMODE_FIOP: Enables use of x87 instructions with 32bit
+ integer operand. */
DEF_TUNE (X86_TUNE_USE_SIMODE_FIOP, "use_simode_fiop",
~(m_PENT | m_PPRO | m_CORE_ALL | m_ATOM
| m_SLM | m_AMD_MULTIPLE | m_GENERIC))
+
+/* X86_TUNE_USE_MOV0: Use "mov $0, reg" instead of "xor reg, reg" to clear
+ integer register. */
DEF_TUNE (X86_TUNE_USE_MOV0, "use_mov0", m_K6)
+
+/* X86_TUNE_USE_CLTD: Controls use of CLTD and CTQO instructions. */
DEF_TUNE (X86_TUNE_USE_CLTD, "use_cltd", ~(m_PENT | m_ATOM | m_SLM | m_K6))
+
/* X86_TUNE_USE_XCHGB: Use xchgb %rh,%rl instead of rolw/rorw $8,rx. */
DEF_TUNE (X86_TUNE_USE_XCHGB, "use_xchgb", m_PENT4)
+
+/* X86_TUNE_SPLIT_LONG_MOVES: Avoid instructions moving immediates
+ directly to memory. */
DEF_TUNE (X86_TUNE_SPLIT_LONG_MOVES, "split_long_moves", m_PPRO)
+
+/* X86_TUNE_READ_MODIFY_WRITE: Enable use of read modify write instructions
+ such as "add $1, mem". */
DEF_TUNE (X86_TUNE_READ_MODIFY_WRITE, "read_modify_write", ~m_PENT)
+
+/* X86_TUNE_READ_MODIFY: Enable use of read-modify instructions such
+ as "add mem, reg". */
DEF_TUNE (X86_TUNE_READ_MODIFY, "read_modify", ~(m_PENT | m_PPRO))
+
+/* X86_TUNE_PROMOTE_QIMODE: When it is cheap, turn 8bit arithmetic to
+ corresponding 32bit arithmetic. */
DEF_TUNE (X86_TUNE_PROMOTE_QIMODE, "promote_qimode",
m_386 | m_486 | m_PENT | m_CORE_ALL | m_ATOM | m_SLM
| m_K6_GEODE | m_AMD_MULTIPLE | m_GENERIC)
+
+/* X86_TUNE_FAST_PREFIX: Enable demoting some 32bit or 64bit arithmetic
+ into 16bit/8bit when resulting sequence is shorter. For example
+ for "and $-65536, reg" to 16bit store of 0. */
DEF_TUNE (X86_TUNE_FAST_PREFIX, "fast_prefix", ~(m_386 | m_486 | m_PENT))
+
+/* X86_TUNE_SINGLE_STRINGOP: Enable use of single string operations, such
+ as MOVS and STOS (without a REP prefix) to move/set sequences of bytes. */
DEF_TUNE (X86_TUNE_SINGLE_STRINGOP, "single_stringop", m_386 | m_P4_NOCONA)
+
+/* X86_TUNE_QIMODE_MATH: Enable use of 8bit arithmetic. */
DEF_TUNE (X86_TUNE_QIMODE_MATH, "qimode_math", ~0)
-/* X86_TUNE_HIMODE_MATH: On PPro this flag is meant to avoid partial
- register stalls. Just like X86_TUNE_PARTIAL_REG_STALL this option
- might be considered for Generic32 if our scheme for avoiding partial
- stalls was more effective. */
+
+/* X86_TUNE_HIMODE_MATH: Enable use of 16bit arithmetic.
+ On PPro this flag is meant to avoid partial register stalls. */
DEF_TUNE (X86_TUNE_HIMODE_MATH, "himode_math", ~m_PPRO)
+
+/* X86_TUNE_PROMOTE_QI_REGS: This enables generic code that promotes all 8bit
+ arithmetic to 32bit via PROMOTE_MODE macro. This code generation scheme
+ is usually used for RISC targets. */
DEF_TUNE (X86_TUNE_PROMOTE_QI_REGS, "promote_qi_regs", 0)
+
+/* X86_TUNE_PROMOTE_HI_REGS: Same, but for 16bit artihmetic. Again we avoid
+ partial register stalls on PentiumPro targets. */
DEF_TUNE (X86_TUNE_PROMOTE_HI_REGS, "promote_hi_regs", m_PPRO)
+
/* X86_TUNE_SINGLE_POP: Enable if single pop insn is preferred
over esp addition. */
DEF_TUNE (X86_TUNE_SINGLE_POP, "single_pop", m_386 | m_486 | m_PENT | m_PPRO)
+
/* X86_TUNE_DOUBLE_POP: Enable if double pop insn is preferred
over esp addition. */
DEF_TUNE (X86_TUNE_DOUBLE_POP, "double_pop", m_PENT)
+
/* X86_TUNE_SINGLE_PUSH: Enable if single push insn is preferred
over esp subtraction. */
DEF_TUNE (X86_TUNE_SINGLE_PUSH, "single_push", m_386 | m_486 | m_PENT
| m_K6_GEODE)
+
/* X86_TUNE_DOUBLE_PUSH. Enable if double push insn is preferred
over esp subtraction. */
DEF_TUNE (X86_TUNE_DOUBLE_PUSH, "double_push", m_PENT | m_K6_GEODE)
+
/* X86_TUNE_INTEGER_DFMODE_MOVES: Enable if integer moves are preferred
for DFmode copies */
DEF_TUNE (X86_TUNE_INTEGER_DFMODE_MOVES, "integer_dfmode_moves",
~(m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM
| m_GEODE | m_AMD_MULTIPLE | m_GENERIC))
+
+/* X86_TUNE_PARTIAL_REG_DEPENDENCY: Enable more register renaming
+ on modern chips. Preffer stores affecting whole integer register
+ over partial stores. For example preffer MOVZBL or MOVQ to load 8bit
+ value over movb. */
DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency",
m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_AMD_MULTIPLE
| m_GENERIC)
-/* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: In the Generic model we have a
- conflict here in between PPro/Pentium4 based chips that thread 128bit
- SSE registers as single units versus K8 based chips that divide SSE
- registers to two 64bit halves. This knob promotes all store destinations
- to be 128bit to allow register renaming on 128bit SSE units, but usually
- results in one extra microop on 64bit SSE units. Experimental results
- shows that disabling this option on P4 brings over 20% SPECfp regression,
- while enabling it on K8 brings roughly 2.4% regression that can be partly
- masked by careful scheduling of moves. */
+
+/* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: This knob promotes all store
+ destinations to be 128bit to allow register renaming on 128bit SSE units,
+ but usually results in one extra microop on 64bit SSE units.
+ Experimental results shows that disabling this option on P4 brings over 20%
+ SPECfp regression, while enabling it on K8 brings roughly 2.4% regression
+ that can be partly masked by careful scheduling of moves. */
DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY, "sse_partial_reg_dependency",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_AMDFAM10
| m_BDVER | m_GENERIC)
+
+/* X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL: Use movups for misaligned loads instead
+ of a sequence loading registers by parts. */
DEF_TUNE (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL, "sse_unaligned_load_optimal",
- m_COREI7 | m_AMDFAM10 | m_BDVER | m_BTVER | m_SLM)
+ m_COREI7 | m_AMDFAM10 | m_BDVER | m_BTVER | m_SLM | m_GENERIC)
+
+/* X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL: Use movups for misaligned stores instead
+ of a sequence loading registers by parts. */
DEF_TUNE (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL, "sse_unaligned_store_optimal",
- m_COREI7 | m_BDVER | m_SLM)
+ m_COREI7 | m_BDVER | m_SLM | m_GENERIC)
+
+/* Use packed single precision instructions where posisble. I.e. movups instead
+ of movupd. */
DEF_TUNE (X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL, "sse_packed_single_insn_optimal",
m_BDVER)
+
/* X86_TUNE_SSE_SPLIT_REGS: Set for machines where the type and dependencies
are resolved on SSE register parts instead of whole registers, so we may
maintain just lower part of scalar values in proper format leaving the
upper part undefined. */
DEF_TUNE (X86_TUNE_SSE_SPLIT_REGS, "sse_split_regs", m_ATHLON_K8)
-DEF_TUNE (X86_TUNE_SSE_TYPELESS_STORES, "sse_typeless_stores", m_AMD_MULTIPLE)
-DEF_TUNE (X86_TUNE_SSE_LOAD0_BY_PXOR, "sse_load0_by_pxor", m_PPRO | m_P4_NOCONA)
+
+/* X86_TUNE_SSE_TYPELESS_STORES: Always movaps/movups for 128bit stores.
+ FIXME: Shall we enable it for generic? */
+DEF_TUNE (X86_TUNE_SSE_TYPELESS_STORES, "sse_typeless_stores",
+ m_AMD_MULTIPLE | m_CORE_ALL)
+
+/* X86_TUNE_SSE_LOAD0_BY_PXOR: Always use pxor to load0 as opposed to
+ xorps/xorpd and other variants.
+ FIXME: Shall we enable it buldozers and for generic? */
+DEF_TUNE (X86_TUNE_SSE_LOAD0_BY_PXOR, "sse_load0_by_pxor",
+ m_PPRO | m_P4_NOCONA | m_CORE_ALL)
+
+/* X86_TUNE_MEMORY_MISMATCH_STALL: Avoid partial stores that are followed by
+ full sized loads. */
DEF_TUNE (X86_TUNE_MEMORY_MISMATCH_STALL, "memory_mismatch_stall",
m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_AMD_MULTIPLE | m_GENERIC)
+
+/* X86_TUNE_PROLOGUE_USING_MOVE: Do not use push/pop in prologues that are
+ considered on critical path. */
DEF_TUNE (X86_TUNE_PROLOGUE_USING_MOVE, "prologue_using_move",
m_PPRO | m_ATHLON_K8)
+
+/* X86_TUNE_PROLOGUE_USING_MOVE: Do not use push/pop in epilogues that are
+ considered on critical path. */
DEF_TUNE (X86_TUNE_EPILOGUE_USING_MOVE, "epilogue_using_move",
m_PPRO | m_ATHLON_K8)
+
+/* X86_TUNE_SHIFT1: Enables use of short encoding of "sal reg" instead of
+ longer "sal $1, reg". */
DEF_TUNE (X86_TUNE_SHIFT1, "shift1", ~m_486)
+
+/* X86_TUNE_USE_FFREEP: Use freep instruction instead of fstp. */
DEF_TUNE (X86_TUNE_USE_FFREEP, "use_ffreep", m_AMD_MULTIPLE)
+
+/* X86_TUNE_INTER_UNIT_MOVES_TO_VEC: Enable moves in from integer
+ to SSE registers. If disabled, the moves will be done by storing
+ the value to memory and reloading. */
DEF_TUNE (X86_TUNE_INTER_UNIT_MOVES_TO_VEC, "inter_unit_moves_to_vec",
~(m_AMD_MULTIPLE | m_GENERIC))
+
+/* X86_TUNE_INTER_UNIT_MOVES_TO_VEC: Enable moves in from SSE
+ to integer registers. If disabled, the moves will be done by storing
+ the value to memory and reloading. */
DEF_TUNE (X86_TUNE_INTER_UNIT_MOVES_FROM_VEC, "inter_unit_moves_from_vec",
~m_ATHLON_K8)
+
+/* X86_TUNE_INTER_UNIT_CONVERSIONS: Enable float<->integer conversions
+ to use both SSE and integer registers at a same time.
+ FIXME: revisit importance of this for generic. */
DEF_TUNE (X86_TUNE_INTER_UNIT_CONVERSIONS, "inter_unit_conversions",
- ~(m_AMDFAM10 | m_BDVER ))
+ ~(m_AMDFAM10 | m_BDVER))
+
/* X86_TUNE_FOUR_JUMP_LIMIT: Some CPU cores are not able to predict more
than 4 branch instructions in the 16 byte window. */
DEF_TUNE (X86_TUNE_FOUR_JUMP_LIMIT, "four_jump_limit",
- m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM| m_AMD_MULTIPLE
- | m_GENERIC)
+ m_PPRO | m_P4_NOCONA | m_ATOM | m_SLM | m_ATHLON_K8 | m_AMDFAM10)
+
+/* X86_TUNE_SCHEDULE: Enable scheduling. */
DEF_TUNE (X86_TUNE_SCHEDULE, "schedule",
m_PENT | m_PPRO | m_CORE_ALL | m_ATOM | m_SLM | m_K6_GEODE
| m_AMD_MULTIPLE | m_GENERIC)
+
+/* X86_TUNE_USE_BT: Enable use of BT (bit test) instructions. */
DEF_TUNE (X86_TUNE_USE_BT, "use_bt",
m_CORE_ALL | m_ATOM | m_SLM | m_AMD_MULTIPLE | m_GENERIC)
+
+/* X86_TUNE_USE_INCDEC: Enable use of inc/dec instructions. */
DEF_TUNE (X86_TUNE_USE_INCDEC, "use_incdec",
~(m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_GENERIC))
+
+/* X86_TUNE_PAD_RETURNS: Place NOP before every RET that is a destination
+ of conditional jump or directly preceded by other jump instruction.
+ This is important for AND K8-AMDFAM10 because the branch prediction
+ architecture expect at most one jump per 2 byte window. Failing to
+ pad returns leads to misaligned return stack. */
DEF_TUNE (X86_TUNE_PAD_RETURNS, "pad_returns",
- m_CORE_ALL | m_AMD_MULTIPLE | m_GENERIC)
+ m_ATHLON_K8 | m_AMDFAM10 | m_GENERIC)
+
+/* X86_TUNE_PAD_SHORT_FUNCTION: Make every function to be at least 4
+ instructions long. */
DEF_TUNE (X86_TUNE_PAD_SHORT_FUNCTION, "pad_short_function", m_ATOM)
+
+/* X86_TUNE_EXT_80387_CONSTANTS: Use fancy 80387 constants, such as PI. */
DEF_TUNE (X86_TUNE_EXT_80387_CONSTANTS, "ext_80387_constants",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_ATOM | m_SLM | m_K6_GEODE
| m_ATHLON_K8 | m_GENERIC)
+
+/* X86_TUNE_AVOID_VECTOR_DECODE: Enable splitters that avoid vector decoded
+ forms of instructions on K8 targets. */
DEF_TUNE (X86_TUNE_AVOID_VECTOR_DECODE, "avoid_vector_decode",
- m_CORE_ALL | m_K8 | m_GENERIC64)
+ m_K8)
+
/* X86_TUNE_PROMOTE_HIMODE_IMUL: Modern CPUs have same latency for HImode
and SImode multiply, but 386 and 486 do HImode multiply faster. */
DEF_TUNE (X86_TUNE_PROMOTE_HIMODE_IMUL, "promote_himode_imul",
~(m_386 | m_486))
+
/* X86_TUNE_SLOW_IMUL_IMM32_MEM: Imul of 32-bit constant and memory is
- vector path on AMD machines. */
+ vector path on AMD machines.
+ FIXME: Do we need to enable this for core? */
DEF_TUNE (X86_TUNE_SLOW_IMUL_IMM32_MEM, "slow_imul_imm32_mem",
- m_CORE_ALL | m_K8 | m_AMDFAM10 | m_BDVER | m_BTVER | m_GENERIC64)
+ m_CORE_ALL | m_K8 | m_AMDFAM10 | m_BDVER | m_BTVER | m_GENERIC)
+
/* X86_TUNE_SLOW_IMUL_IMM8: Imul of 8-bit constant is vector path on AMD
- machines. */
+ machines.
+ FIXME: Do we need to enable this for core? */
DEF_TUNE (X86_TUNE_SLOW_IMUL_IMM8, "slow_imul_imm8",
- m_CORE_ALL | m_K8 | m_AMDFAM10 | m_BDVER | m_BTVER | m_GENERIC64)
+ m_CORE_ALL | m_K8 | m_AMDFAM10 | m_BDVER | m_BTVER | m_GENERIC)
+
/* X86_TUNE_MOVE_M1_VIA_OR: On pentiums, it is faster to load -1 via OR
than a MOV. */
DEF_TUNE (X86_TUNE_MOVE_M1_VIA_OR, "move_m1_via_or", m_PENT)
+
/* X86_TUNE_NOT_UNPAIRABLE: NOT is not pairable on Pentium, while XOR is,
but one byte longer. */
DEF_TUNE (X86_TUNE_NOT_UNPAIRABLE, "not_unpairable", m_PENT)
+
/* X86_TUNE_NOT_VECTORMODE: On AMD K6, NOT is vector decoded with memory
operand that cannot be represented using a modRM byte. The XOR
replacement is long decoded, so this split helps here as well. */
DEF_TUNE (X86_TUNE_NOT_VECTORMODE, "not_vectormode", m_K6)
+
/* X86_TUNE_USE_VECTOR_FP_CONVERTS: Prefer vector packed SSE conversion
- from FP to FP. */
+ from FP to FP. This form of instructions avoids partial write to the
+ destination. */
DEF_TUNE (X86_TUNE_USE_VECTOR_FP_CONVERTS, "use_vector_fp_converts",
m_CORE_ALL | m_AMDFAM10 | m_GENERIC)
+
/* X86_TUNE_USE_VECTOR_CONVERTS: Prefer vector packed SSE conversion
from integer to FP. */
DEF_TUNE (X86_TUNE_USE_VECTOR_CONVERTS, "use_vector_converts", m_AMDFAM10)
+
/* X86_TUNE_FUSE_CMP_AND_BRANCH: Fuse a compare or test instruction
with a subsequent conditional jump instruction into a single
- compare-and-branch uop. */
-DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH, "fuse_cmp_and_branch", m_BDVER)
+ compare-and-branch uop.
+ FIXME: revisit for generic. */
+DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH, "fuse_cmp_and_branch", m_BDVER | m_CORE_ALL)
+
/* X86_TUNE_OPT_AGU: Optimize for Address Generation Unit. This flag
will impact LEA instruction selection. */
DEF_TUNE (X86_TUNE_OPT_AGU, "opt_agu", m_ATOM | m_SLM)
+
/* X86_TUNE_VECTORIZE_DOUBLE: Enable double precision vector
instructions. */
DEF_TUNE (X86_TUNE_VECTORIZE_DOUBLE, "vectorize_double", ~m_ATOM)
+
/* X86_TUNE_SOFTWARE_PREFETCHING_BENEFICIAL: Enable software prefetching
at -O3. For the moment, the prefetching seems badly tuned for Intel
chips. */
DEF_TUNE (X86_TUNE_SOFTWARE_PREFETCHING_BENEFICIAL, "software_prefetching_beneficial",
m_K6_GEODE | m_AMD_MULTIPLE)
+
/* X86_TUNE_AVX128_OPTIMAL: Enable 128-bit AVX instruction generation for
the auto-vectorizer. */
DEF_TUNE (X86_TUNE_AVX128_OPTIMAL, "avx128_optimal", m_BDVER | m_BTVER2)
+
/* X86_TUNE_REASSOC_INT_TO_PARALLEL: Try to produce parallel computations
during reassociation of integer computation. */
DEF_TUNE (X86_TUNE_REASSOC_INT_TO_PARALLEL, "reassoc_int_to_parallel",
m_ATOM)
+
/* X86_TUNE_REASSOC_FP_TO_PARALLEL: Try to produce parallel computations
during reassociation of fp computation. */
DEF_TUNE (X86_TUNE_REASSOC_FP_TO_PARALLEL, "reassoc_fp_to_parallel",
- m_ATOM | m_SLM | m_HASWELL | m_BDVER1 | m_BDVER2)
+ m_ATOM | m_SLM | m_HASWELL | m_BDVER1 | m_BDVER2 | m_GENERIC)
+
/* X86_TUNE_GENERAL_REGS_SSE_SPILL: Try to spill general regs to SSE
regs instead of memory. */
DEF_TUNE (X86_TUNE_GENERAL_REGS_SSE_SPILL, "general_regs_sse_spill",
m_CORE_ALL)
+
/* X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE: Try to avoid memory operands for
a conditional move. */
-DEF_TUNE (X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE, "avoid_mem_opnd_for_cmove", m_ATOM)
+DEF_TUNE (X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE, "avoid_mem_opnd_for_cmove",
+ m_ATOM | m_SLM)
+
/* X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS: Try to split memory operand for
fp converts to destination register. */
DEF_TUNE (X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS, "split_mem_opnd_for_fp_converts",
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index a128b19c7ca..273cd39065f 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -1754,7 +1754,7 @@ ia64_expand_compare (rtx *expr, rtx *op0, rtx *op1)
else if (TARGET_HPUX && GET_MODE (*op0) == TFmode)
{
enum qfcmp_magic {
- QCMP_INV = 1, /* Raise FP_INVALID on SNaN as a side effect. */
+ QCMP_INV = 1, /* Raise FP_INVALID on NaNs as a side effect. */
QCMP_UNORD = 2,
QCMP_EQ = 4,
QCMP_LT = 8,
@@ -1768,21 +1768,27 @@ ia64_expand_compare (rtx *expr, rtx *op0, rtx *op1)
switch (code)
{
/* 1 = equal, 0 = not equal. Equality operators do
- not raise FP_INVALID when given an SNaN operand. */
+ not raise FP_INVALID when given a NaN operand. */
case EQ: magic = QCMP_EQ; ncode = NE; break;
case NE: magic = QCMP_EQ; ncode = EQ; break;
/* isunordered() from C99. */
case UNORDERED: magic = QCMP_UNORD; ncode = NE; break;
case ORDERED: magic = QCMP_UNORD; ncode = EQ; break;
/* Relational operators raise FP_INVALID when given
- an SNaN operand. */
+ a NaN operand. */
case LT: magic = QCMP_LT |QCMP_INV; ncode = NE; break;
case LE: magic = QCMP_LT|QCMP_EQ|QCMP_INV; ncode = NE; break;
case GT: magic = QCMP_GT |QCMP_INV; ncode = NE; break;
case GE: magic = QCMP_GT|QCMP_EQ|QCMP_INV; ncode = NE; break;
- /* FUTURE: Implement UNEQ, UNLT, UNLE, UNGT, UNGE, LTGT.
- Expanders for buneq etc. weuld have to be added to ia64.md
- for this to be useful. */
+ /* Unordered relational operators do not raise FP_INVALID
+ when given a NaN operand. */
+ case UNLT: magic = QCMP_LT |QCMP_UNORD; ncode = NE; break;
+ case UNLE: magic = QCMP_LT|QCMP_EQ|QCMP_UNORD; ncode = NE; break;
+ case UNGT: magic = QCMP_GT |QCMP_UNORD; ncode = NE; break;
+ case UNGE: magic = QCMP_GT|QCMP_EQ|QCMP_UNORD; ncode = NE; break;
+ /* Not supported. */
+ case UNEQ:
+ case LTGT:
default: gcc_unreachable ();
}
@@ -5277,6 +5283,9 @@ ia64_print_operand (FILE * file, rtx x, int code)
case UNGE:
str = "nlt";
break;
+ case UNEQ:
+ case LTGT:
+ gcc_unreachable ();
default:
str = GET_RTX_NAME (GET_CODE (x));
break;
@@ -5454,7 +5463,7 @@ ia64_print_operand (FILE * file, rtx x, int code)
x = find_reg_note (current_output_insn, REG_BR_PROB, 0);
if (x)
{
- int pred_val = INTVAL (XEXP (x, 0));
+ int pred_val = XINT (x, 0);
/* Guess top and bottom 10% statically predicted. */
if (pred_val < REG_BR_PROB_BASE / 50
diff --git a/gcc/config/ia64/predicates.md b/gcc/config/ia64/predicates.md
index adfb15ff7b7..af7bc8ee4c2 100644
--- a/gcc/config/ia64/predicates.md
+++ b/gcc/config/ia64/predicates.md
@@ -568,9 +568,15 @@
(match_test "op == CONST0_RTX (GET_MODE (op))"))))
;; Return 1 if OP is a valid comparison operator for "cbranch" instructions.
+;; If we're assuming that FP operations cannot generate user-visible traps,
+;; then we can use the FP unordered-signaling instructions to implement the
+;; FP unordered-quiet comparison predicates.
(define_predicate "ia64_cbranch_operator"
- (ior (match_operand 0 "ordered_comparison_operator")
- (match_code "ordered,unordered")))
+ (if_then_else (match_test "flag_trapping_math")
+ (ior (match_operand 0 "ordered_comparison_operator")
+ (match_code "ordered,unordered"))
+ (and (match_operand 0 "comparison_operator")
+ (not (match_code "uneq,ltgt")))))
;; True if this is a comparison operator, which accepts a normal 8-bit
;; signed immediate operand.
diff --git a/gcc/config/mcore/t-mcore b/gcc/config/mcore/t-mcore
index 92fefb1cc9b..e5f37ee741b 100644
--- a/gcc/config/mcore/t-mcore
+++ b/gcc/config/mcore/t-mcore
@@ -16,9 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# We have values for float.h.
-CROSS_FLOAT_H = $(srcdir)/config/mcore/gfloat.h
-
# If support for -m4align is ever re-enabled then comment out the
# following line and uncomment the multilib lines below.
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index bd37067dfc4..34b4fea7503 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -1531,7 +1531,7 @@ mmix_print_operand (FILE *stream, rtx x, int code)
if (TARGET_BRANCH_PREDICT)
{
x = find_reg_note (current_output_insn, REG_BR_PROB, 0);
- if (x && INTVAL (XEXP (x, 0)) > REG_BR_PROB_BASE / 2)
+ if (x && XINT (x, 0) > REG_BR_PROB_BASE / 2)
putc ('P', stream);
}
return;
diff --git a/gcc/config/msp430/README.txt b/gcc/config/msp430/README.txt
new file mode 100644
index 00000000000..e7343cfcaf1
--- /dev/null
+++ b/gcc/config/msp430/README.txt
@@ -0,0 +1,7 @@
+Random Notes
+------------
+
+The MSP430 port does not use leading underscores. However, the
+assembler has no way of differentiating between, for example, register
+R12 and symbol R12. So, if you do "int r12;" in your C program, you
+may get an assembler error, and will certainly have runtime problems.
diff --git a/gcc/config/msp430/constraints.md b/gcc/config/msp430/constraints.md
new file mode 100644
index 00000000000..ea53481bfdb
--- /dev/null
+++ b/gcc/config/msp430/constraints.md
@@ -0,0 +1,72 @@
+;; Machine Description for TI MSP43* processors
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Contributed by Red Hat.
+
+;; 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_register_constraint "R12" "R12_REGS"
+ "Register R12.")
+
+(define_register_constraint "R13" "R13_REGS"
+ "Register R13.")
+
+(define_constraint "K"
+ "Integer constant 1."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 1, 1)")))
+
+(define_constraint "L"
+ "Integer constant -1^20..1^19."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, -1 << 20, 1 << 19)")))
+
+(define_constraint "M"
+ "Integer constant 1-4."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 1, 4)")))
+
+;; We do not allow arbitrary constants, eg symbols or labels,
+;; because their address may be above the 16-bit address limit
+;; supported by the offset used in the MOVA instruction.
+(define_constraint "Ya"
+ "Memory reference, any type, but restricted range of constants"
+ (and (match_code "mem")
+ (ior (match_code "reg" "0")
+ (and (match_code "plus" "0")
+ (match_code "reg" "00")
+ (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))")))
+ (match_test "CONSTANT_P (XEXP (op, 0))")
+ )))
+
+(define_constraint "Yl"
+ "Memory reference, labels only."
+ (and (match_code "mem")
+ (match_code "label_ref" "0")))
+
+
+;; These are memory references that are safe to use with the X suffix,
+;; because we know/assume they need not index across the 64k boundary.
+(define_constraint "Ys"
+ "Memory reference, stack only."
+ (and (match_code "mem")
+ (ior
+ (and (match_code "plus" "0")
+ (and (match_code "reg" "00")
+ (match_test ("CONST_INT_P (XEXP (XEXP (op, 0), 1))"))
+ (match_test ("IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), -1 << 15, (1 << 15)-1)"))))
+ (match_code "reg" "0")
+ )))
diff --git a/gcc/config/msp430/msp430-c.c b/gcc/config/msp430/msp430-c.c
new file mode 100644
index 00000000000..808e02c5ffd
--- /dev/null
+++ b/gcc/config/msp430/msp430-c.c
@@ -0,0 +1,36 @@
+/* MSP430 C-specific support
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ Contributed by Red Hat, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3. If not see
+ <http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "c-family/c-common.h"
+#include "msp430-protos.h"
+
+/* Implements REGISTER_TARGET_PRAGMAS. */
+void
+msp430_register_pragmas (void)
+{
+ c_register_addr_space ("__near", ADDR_SPACE_NEAR);
+ if (msp430x)
+ c_register_addr_space ("__far", ADDR_SPACE_FAR);
+}
diff --git a/gcc/config/msp430/msp430-modes.def b/gcc/config/msp430/msp430-modes.def
new file mode 100644
index 00000000000..9e7b70127fd
--- /dev/null
+++ b/gcc/config/msp430/msp430-modes.def
@@ -0,0 +1,3 @@
+/* 20-bit address */
+PARTIAL_INT_MODE (SI);
+
diff --git a/gcc/config/msp430/msp430-protos.h b/gcc/config/msp430/msp430-protos.h
new file mode 100644
index 00000000000..f116855ecae
--- /dev/null
+++ b/gcc/config/msp430/msp430-protos.h
@@ -0,0 +1,46 @@
+/* Exported function prototypes from the TI MSP430 backend.
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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_MSP430_PROTOS_H
+#define GCC_MSP430_PROTOS_H
+
+rtx msp430_eh_return_stackadj_rtx (void);
+void msp430_expand_eh_return (rtx);
+void msp430_expand_epilogue (int);
+void msp430_expand_helper (rtx *operands, const char *, bool);
+void msp430_expand_prologue (void);
+const char * msp430x_extendhisi (rtx *);
+void msp430_fixup_compare_operands (enum machine_mode, rtx *);
+int msp430_hard_regno_mode_ok (int, enum machine_mode);
+int msp430_hard_regno_nregs (int, enum machine_mode);
+rtx msp430_incoming_return_addr_rtx (void);
+void msp430_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
+int msp430_initial_elimination_offset (int, int);
+bool msp430_is_interrupt_func (void);
+const char * msp430x_logical_shift_right (rtx);
+bool msp430_modes_tieable_p (enum machine_mode, enum machine_mode);
+void msp430_output_labelref (FILE *, const char *);
+void msp430_register_pragmas (void);
+rtx msp430_return_addr_rtx (int);
+void msp430_split_movsi (rtx *);
+rtx msp430_subreg (enum machine_mode, rtx, enum machine_mode, int);
+void msp430_start_function (FILE *, const char *, tree);
+
+#endif /* GCC_MSP430_PROTOS_H */
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
new file mode 100644
index 00000000000..a1e2f81e648
--- /dev/null
+++ b/gcc/config/msp430/msp430.c
@@ -0,0 +1,2134 @@
+/* Subroutines used for code generation on TI MSP430 processors.
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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 "tree.h"
+#include "rtl.h"
+#include "regs.h"
+#include "hard-reg-set.h"
+#include "insn-config.h"
+#include "conditions.h"
+#include "output.h"
+#include "insn-attr.h"
+#include "flags.h"
+#include "function.h"
+#include "expr.h"
+#include "optabs.h"
+#include "libfuncs.h"
+#include "recog.h"
+#include "diagnostic-core.h"
+#include "toplev.h"
+#include "reload.h"
+#include "df.h"
+#include "ggc.h"
+#include "tm_p.h"
+#include "debug.h"
+#include "target.h"
+#include "target-def.h"
+#include "langhooks.h"
+#include "msp430-protos.h"
+#include "dumpfile.h"
+#include "opts.h"
+
+
+
+static void msp430_compute_frame_info (void);
+
+
+
+/* Run-time Target Specification */
+
+bool msp430x = false;
+
+struct GTY(()) machine_function
+{
+ /* If set, the rest of the fields have been computed. */
+ int computed;
+ /* Which registers need to be saved in the pro/epilogue. */
+ int need_to_save [FIRST_PSEUDO_REGISTER];
+
+ /* These fields describe the frame layout... */
+ /* arg pointer */
+ /* 2/4 bytes for saved PC */
+ int framesize_regs;
+ /* frame pointer */
+ int framesize_locals;
+ int framesize_outgoing;
+ /* stack pointer */
+ int framesize;
+
+ /* How much we adjust the stack when returning from an exception
+ handler. */
+ rtx eh_stack_adjust;
+};
+
+/* This is our init_machine_status, as set in
+ msp_option_override. */
+static struct machine_function *
+msp430_init_machine_status (void)
+{
+ struct machine_function *m;
+
+ m = ggc_alloc_cleared_machine_function ();
+
+ return m;
+}
+
+#undef TARGET_HANDLE_OPTION
+#define TARGET_HANDLE_OPTION msp430_handle_option
+
+bool
+msp430_handle_option (struct gcc_options *opts ATTRIBUTE_UNUSED,
+ struct gcc_options *opts_set ATTRIBUTE_UNUSED,
+ const struct cl_decoded_option *decoded ATTRIBUTE_UNUSED,
+ location_t loc ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+#undef TARGET_OPTION_OVERRIDE
+#define TARGET_OPTION_OVERRIDE msp430_option_override
+
+static const char * msp430x_names [] =
+{
+ "msp430x", /* Generic name. */
+ "msp430xv2", /* Generic name. */
+
+ /* These names have been provided by TI and match the names currently
+ supported by GAS.
+
+ NB/ This list should be kept in sync with the ones in:
+ gcc/config/msp430/t-msp430
+ gas/config/tc-msp430.c
+
+ FIXME: We ought to read the names in from a file at run, rather
+ than having them built in like this. Also such a file should be
+ shared with gas. */
+
+ "msp430cg4616", "msp430cg4617", "msp430cg4618", "msp430cg4619", "msp430f2416",
+ "msp430f2417", "msp430f2418", "msp430f2419", "msp430f2616", "msp430f2617",
+ "msp430f2618", "msp430f2619", "msp430f47126", "msp430f47127", "msp430f47163",
+ "msp430f47173", "msp430f47183", "msp430f47193", "msp430f47166", "msp430f47176",
+ "msp430f47186", "msp430f47196", "msp430f47167", "msp430f47177", "msp430f47187",
+ "msp430f47197", "msp430f46161", "msp430f46171", "msp430f46181", "msp430f46191",
+ "msp430f4616", "msp430f4617", "msp430f4618", "msp430f4619", "msp430fg4616",
+ "msp430fg4617", "msp430fg4618", "msp430fg4619", "msp430f5418", "msp430f5419",
+ "msp430f5435", "msp430f5436", "msp430f5437", "msp430f5438", "msp430f5418a",
+ "msp430f5419a", "msp430f5435a", "msp430f5436a", "msp430f5437a", "msp430f5438a",
+ "msp430f5212", "msp430f5213", "msp430f5214", "msp430f5217", "msp430f5218",
+ "msp430f5219", "msp430f5222", "msp430f5223", "msp430f5224", "msp430f5227",
+ "msp430f5228", "msp430f5229", "msp430f5304", "msp430f5308", "msp430f5309",
+ "msp430f5310", "msp430f5340", "msp430f5341", "msp430f5342", "msp430f5324",
+ "msp430f5325", "msp430f5326", "msp430f5327", "msp430f5328", "msp430f5329",
+ "msp430f5500", "msp430f5501", "msp430f5502", "msp430f5503", "msp430f5504",
+ "msp430f5505", "msp430f5506", "msp430f5507", "msp430f5508", "msp430f5509",
+ "msp430f5510", "msp430f5513", "msp430f5514", "msp430f5515", "msp430f5517",
+ "msp430f5519", "msp430f5521", "msp430f5522", "msp430f5524", "msp430f5525",
+ "msp430f5526", "msp430f5527", "msp430f5528", "msp430f5529", "cc430f5133",
+ "cc430f5135", "cc430f5137", "cc430f6125", "cc430f6126", "cc430f6127",
+ "cc430f6135", "cc430f6137", "cc430f5123", "cc430f5125", "cc430f5143",
+ "cc430f5145", "cc430f5147", "cc430f6143", "cc430f6145", "cc430f6147",
+ "msp430f5333", "msp430f5335", "msp430f5336", "msp430f5338", "msp430f5630",
+ "msp430f5631", "msp430f5632", "msp430f5633", "msp430f5634", "msp430f5635",
+ "msp430f5636", "msp430f5637", "msp430f5638", "msp430f6433", "msp430f6435",
+ "msp430f6436", "msp430f6438", "msp430f6630", "msp430f6631", "msp430f6632",
+ "msp430f6633", "msp430f6634", "msp430f6635", "msp430f6636", "msp430f6637",
+ "msp430f6638", "msp430f5358", "msp430f5359", "msp430f5658", "msp430f5659",
+ "msp430f6458", "msp430f6459", "msp430f6658", "msp430f6659", "msp430f5131",
+ "msp430f5151", "msp430f5171", "msp430f5132", "msp430f5152", "msp430f5172",
+ "msp430f6720", "msp430f6721", "msp430f6723", "msp430f6724", "msp430f6725",
+ "msp430f6726", "msp430f6730", "msp430f6731", "msp430f6733", "msp430f6734",
+ "msp430f6735", "msp430f6736", "msp430f67451", "msp430f67651", "msp430f67751",
+ "msp430f67461", "msp430f67661", "msp430f67761", "msp430f67471", "msp430f67671",
+ "msp430f67771", "msp430f67481", "msp430f67681", "msp430f67781", "msp430f67491",
+ "msp430f67691", "msp430f67791", "msp430f6745", "msp430f6765", "msp430f6775",
+ "msp430f6746", "msp430f6766", "msp430f6776", "msp430f6747", "msp430f6767",
+ "msp430f6777", "msp430f6748", "msp430f6768", "msp430f6778", "msp430f6749",
+ "msp430f6769", "msp430f6779", "msp430fr5720", "msp430fr5721", "msp430fr5722",
+ "msp430fr5723", "msp430fr5724", "msp430fr5725", "msp430fr5726", "msp430fr5727",
+ "msp430fr5728", "msp430fr5729", "msp430fr5730", "msp430fr5731", "msp430fr5732",
+ "msp430fr5733", "msp430fr5734", "msp430fr5735", "msp430fr5736", "msp430fr5737",
+ "msp430fr5738", "msp430fr5739", "msp430bt5190", "msp430fr5949", "msp430fr5969",
+ "msp430sl5438a"
+};
+
+static void
+msp430_option_override (void)
+{
+ init_machine_status = msp430_init_machine_status;
+
+ if (target_cpu)
+ {
+ unsigned i;
+
+ for (i = ARRAY_SIZE (msp430x_names); i--;)
+ if (strcasecmp (target_cpu, msp430x_names[i]))
+ {
+ msp430x = true;
+ break;
+ }
+ /* Note - it is not an error if we did not recognize the MCU
+ name. The msp430x_names array only contains those MCU names
+ which are currently known to use the MSP430X ISA. There are
+ lots of other MCUs which just use the MSP430 ISA. */
+ }
+
+ if (TARGET_LARGE && !msp430x)
+ error ("-mlarge requires a 430X-compatible -mmcu=");
+
+ if (flag_exceptions || flag_non_call_exceptions
+ || flag_unwind_tables || flag_asynchronous_unwind_tables)
+ flag_omit_frame_pointer = false;
+ else
+ flag_omit_frame_pointer = true;
+
+ /* This is a hack to work around a problem with the newlib build
+ mechanism. Newlib always appends CFLAGS to the end of the GCC
+ command line and always sets -O2 in CFLAGS. Thus it is not
+ possible to build newlib with -Os enabled. Until now... */
+ if (TARGET_OPT_SPACE && optimize < 3)
+ optimize_size = 1;
+}
+
+
+
+/* Storage Layout */
+
+#undef TARGET_MS_BITFIELD_LAYOUT_P
+#define TARGET_MS_BITFIELD_LAYOUT_P msp430_ms_bitfield_layout_p
+
+bool
+msp430_ms_bitfield_layout_p (const_tree record_type ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
+
+
+/* Register Usage */
+
+/* Implements HARD_REGNO_NREGS. MSP430X registers can hold a single
+ PSImode value, but not an SImode value. */
+int
+msp430_hard_regno_nregs (int regno ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
+{
+ if (mode == PSImode && msp430x)
+ return 1;
+ return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1)
+ / UNITS_PER_WORD);
+}
+
+/* Implements HARD_REGNO_MODE_OK. */
+int
+msp430_hard_regno_mode_ok (int regno ATTRIBUTE_UNUSED,
+ enum machine_mode mode)
+{
+ return regno <= (ARG_POINTER_REGNUM - msp430_hard_regno_nregs (regno, mode));
+}
+
+/* Implements MODES_TIEABLE_P. */
+bool
+msp430_modes_tieable_p (enum machine_mode mode1, enum machine_mode mode2)
+{
+ if ((mode1 == PSImode || mode2 == SImode)
+ || (mode1 == SImode || mode2 == PSImode))
+ return false;
+
+ return ((GET_MODE_CLASS (mode1) == MODE_FLOAT
+ || GET_MODE_CLASS (mode1) == MODE_COMPLEX_FLOAT)
+ == (GET_MODE_CLASS (mode2) == MODE_FLOAT
+ || GET_MODE_CLASS (mode2) == MODE_COMPLEX_FLOAT));
+}
+
+#undef TARGET_FRAME_POINTER_REQUIRED
+#define TARGET_FRAME_POINTER_REQUIRED msp430_frame_pointer_required
+
+static bool
+msp430_frame_pointer_required (void)
+{
+ return false;
+}
+
+#undef TARGET_CAN_ELIMINATE
+#define TARGET_CAN_ELIMINATE msp430_can_eliminate
+
+static bool
+msp430_can_eliminate (const int from_reg ATTRIBUTE_UNUSED,
+ const int to_reg ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+/* Implements INITIAL_ELIMINATION_OFFSET. */
+int
+msp430_initial_elimination_offset (int from, int to)
+{
+ int rv = 0; /* As if arg to arg. */
+
+ msp430_compute_frame_info ();
+
+ switch (to)
+ {
+ case STACK_POINTER_REGNUM:
+ rv += cfun->machine->framesize_outgoing;
+ rv += cfun->machine->framesize_locals;
+ /* Fall through. */
+ case FRAME_POINTER_REGNUM:
+ rv += cfun->machine->framesize_regs;
+ /* Allow for the saved return address. */
+ rv += (TARGET_LARGE ? 4 : 2);
+ /* NB/ No need to allow for crtl->args.pretend_args_size.
+ GCC does that for us. */
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ switch (from)
+ {
+ case FRAME_POINTER_REGNUM:
+ /* Allow for the fall through above. */
+ rv -= (TARGET_LARGE ? 4 : 2);
+ rv -= cfun->machine->framesize_regs;
+ case ARG_POINTER_REGNUM:
+ break;
+ default:
+ gcc_unreachable ();
+ }
+
+ return rv;
+}
+
+/* Named Address Space support */
+
+
+/* Return the appropriate mode for a named address pointer. */
+#undef TARGET_ADDR_SPACE_POINTER_MODE
+#define TARGET_ADDR_SPACE_POINTER_MODE msp430_addr_space_pointer_mode
+#undef TARGET_ADDR_SPACE_ADDRESS_MODE
+#define TARGET_ADDR_SPACE_ADDRESS_MODE msp430_addr_space_pointer_mode
+
+static enum machine_mode
+msp430_addr_space_pointer_mode (addr_space_t addrspace)
+{
+ switch (addrspace)
+ {
+ default:
+ case ADDR_SPACE_GENERIC:
+ return Pmode;
+ case ADDR_SPACE_NEAR:
+ return HImode;
+ case ADDR_SPACE_FAR:
+ return PSImode;
+ }
+}
+
+/* Function pointers are stored in unwind_word sized
+ variables, so make sure that unwind_word is big enough. */
+#undef TARGET_UNWIND_WORD_MODE
+#define TARGET_UNWIND_WORD_MODE msp430_unwind_word_mode
+
+static enum machine_mode
+msp430_unwind_word_mode (void)
+{
+ return TARGET_LARGE ? SImode : HImode;
+}
+
+/* Determine if one named address space is a subset of another. */
+#undef TARGET_ADDR_SPACE_SUBSET_P
+#define TARGET_ADDR_SPACE_SUBSET_P msp430_addr_space_subset_p
+static bool
+msp430_addr_space_subset_p (addr_space_t subset, addr_space_t superset)
+{
+ if (subset == superset)
+ return true;
+ else
+ return (subset != ADDR_SPACE_FAR && superset == ADDR_SPACE_FAR);
+}
+
+#undef TARGET_ADDR_SPACE_CONVERT
+#define TARGET_ADDR_SPACE_CONVERT msp430_addr_space_convert
+/* Convert from one address space to another. */
+static rtx
+msp430_addr_space_convert (rtx op, tree from_type, tree to_type)
+{
+ addr_space_t from_as = TYPE_ADDR_SPACE (TREE_TYPE (from_type));
+ addr_space_t to_as = TYPE_ADDR_SPACE (TREE_TYPE (to_type));
+ rtx result;
+
+ if (to_as != ADDR_SPACE_FAR && from_as == ADDR_SPACE_FAR)
+ {
+ /* This is unpredictable, as we're truncating off usable address
+ bits. */
+
+ if (CONSTANT_P (op))
+ return gen_rtx_CONST (HImode, op);
+
+ result = gen_reg_rtx (HImode);
+ emit_insn (gen_truncpsihi2 (result, op));
+ return result;
+ }
+ else if (to_as == ADDR_SPACE_FAR && from_as != ADDR_SPACE_FAR)
+ {
+ /* This always works. */
+
+ if (CONSTANT_P (op))
+ return gen_rtx_CONST (PSImode, op);
+
+ result = gen_reg_rtx (PSImode);
+ emit_insn (gen_zero_extendhipsi2 (result, op));
+ return result;
+ }
+ else
+ gcc_unreachable ();
+}
+
+/* Stack Layout and Calling Conventions. */
+
+/* For each function, we list the gcc version and the TI version on
+ each line, where we're converting the function names. */
+static char const * const special_convention_function_names [] =
+{
+ "__muldi3", "__mspabi_mpyll",
+ "__udivdi3", "__mspabi_divull",
+ "__umoddi3", "__mspabi_remull",
+ "__divdi3", "__mspabi_divlli",
+ "__moddi3", "__mspabi_remlli",
+ "__mspabi_srall",
+ "__mspabi_srlll",
+ "__mspabi_sllll",
+ "__adddf3", "__mspabi_addd",
+ "__subdf3", "__mspabi_subd",
+ "__muldf3", "__mspabi_mpyd",
+ "__divdf3", "__mspabi_divd",
+ "__mspabi_cmpd",
+ NULL
+};
+
+/* TRUE if the function passed is a "speical" function. Special
+ functions pass two DImode parameters in registers. */
+static bool
+msp430_special_register_convention_p (const char *name)
+{
+ int i;
+
+ for (i = 0; special_convention_function_names [i]; i++)
+ if (! strcmp (name, special_convention_function_names [i]))
+ return true;
+
+ return false;
+}
+
+#undef TARGET_FUNCTION_VALUE_REGNO_P
+#define TARGET_FUNCTION_VALUE_REGNO_P msp430_function_value_regno_p
+
+bool
+msp430_function_value_regno_p (unsigned int regno)
+{
+ return regno == 12;
+}
+
+
+#undef TARGET_FUNCTION_VALUE
+#define TARGET_FUNCTION_VALUE msp430_function_value
+
+rtx
+msp430_function_value (const_tree ret_type,
+ const_tree fn_decl_or_type ATTRIBUTE_UNUSED,
+ bool outgoing ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (TYPE_MODE (ret_type), 12);
+}
+
+#undef TARGET_LIBCALL_VALUE
+#define TARGET_LIBCALL_VALUE msp430_libcall_value
+
+rtx
+msp430_libcall_value (enum machine_mode mode, const_rtx fun ATTRIBUTE_UNUSED)
+{
+ return gen_rtx_REG (mode, 12);
+}
+
+/* Implements INIT_CUMULATIVE_ARGS. */
+void
+msp430_init_cumulative_args (CUMULATIVE_ARGS *ca,
+ tree fntype ATTRIBUTE_UNUSED,
+ rtx libname ATTRIBUTE_UNUSED,
+ tree fndecl ATTRIBUTE_UNUSED,
+ int n_named_args ATTRIBUTE_UNUSED)
+{
+ const char *fname;
+ memset (ca, 0, sizeof(*ca));
+
+ ca->can_split = 1;
+
+ if (fndecl)
+ fname = IDENTIFIER_POINTER (DECL_NAME (fndecl));
+ else if (libname)
+ fname = XSTR (libname, 0);
+ else
+ fname = NULL;
+
+ if (fname && msp430_special_register_convention_p (fname))
+ ca->special_p = 1;
+}
+
+/* Helper function for argument passing; this function is the common
+ code that determines where an argument will be passed. */
+static void
+msp430_evaluate_arg (cumulative_args_t cap,
+ enum machine_mode mode,
+ const_tree type ATTRIBUTE_UNUSED,
+ bool named)
+{
+ CUMULATIVE_ARGS *ca = get_cumulative_args (cap);
+ int nregs = GET_MODE_SIZE (mode);
+ int i;
+
+ ca->reg_count = 0;
+ ca->mem_count = 0;
+
+ if (!named)
+ return;
+
+ if (mode == PSImode)
+ nregs = 1;
+ else
+ nregs = (nregs + 1) / 2;
+
+ if (ca->special_p)
+ {
+ /* Function is passed two DImode operands, in R8:R11 and
+ R12:15. */
+ ca->start_reg = 8;
+ ca->reg_count = 4;
+ return;
+ }
+
+ switch (nregs)
+ {
+ case 1:
+ for (i = 0; i < 4; i++)
+ if (! ca->reg_used [i])
+ {
+ ca->reg_count = 1;
+ ca->start_reg = CA_FIRST_REG + i;
+ return;
+ }
+ break;
+ case 2:
+ for (i = 0; i < 3; i++)
+ if (! ca->reg_used [i] && ! ca->reg_used [i + 1])
+ {
+ ca->reg_count = 2;
+ ca->start_reg = CA_FIRST_REG + i;
+ return;
+ }
+ if (! ca->reg_used [3] && ca->can_split)
+ {
+ ca->reg_count = 1;
+ ca->mem_count = 2;
+ ca->start_reg = CA_FIRST_REG + 3;
+ return;
+ }
+ break;
+ case 3:
+ case 4:
+ ca->can_split = 0;
+ if (! ca->reg_used [0]
+ && ! ca->reg_used [1]
+ && ! ca->reg_used [2]
+ && ! ca->reg_used [3])
+ {
+ ca->reg_count = 4;
+ ca->start_reg = CA_FIRST_REG;
+ return;
+ }
+ break;
+ }
+}
+
+#undef TARGET_PROMOTE_PROTOTYPES
+#define TARGET_PROMOTE_PROTOTYPES msp430_promote_prototypes
+
+bool
+msp430_promote_prototypes (const_tree fntype ATTRIBUTE_UNUSED)
+{
+ return false;
+}
+
+#undef TARGET_FUNCTION_ARG
+#define TARGET_FUNCTION_ARG msp430_function_arg
+
+rtx
+msp430_function_arg (cumulative_args_t cap,
+ enum machine_mode mode,
+ const_tree type,
+ bool named)
+{
+ CUMULATIVE_ARGS *ca = get_cumulative_args (cap);
+
+ msp430_evaluate_arg (cap, mode, type, named);
+
+ if (ca->reg_count)
+ return gen_rtx_REG (mode, ca->start_reg);
+
+ return 0;
+}
+
+#undef TARGET_ARG_PARTIAL_BYTES
+#define TARGET_ARG_PARTIAL_BYTES msp430_arg_partial_bytes
+
+int
+msp430_arg_partial_bytes (cumulative_args_t cap,
+ enum machine_mode mode,
+ tree type,
+ bool named)
+{
+ CUMULATIVE_ARGS *ca = get_cumulative_args (cap);
+
+ msp430_evaluate_arg (cap, mode, type, named);
+
+ if (ca->reg_count && ca->mem_count)
+ return ca->reg_count * UNITS_PER_WORD;
+
+ return 0;
+}
+
+#undef TARGET_PASS_BY_REFERENCE
+#define TARGET_PASS_BY_REFERENCE msp430_pass_by_reference
+
+static bool
+msp430_pass_by_reference (cumulative_args_t cap ATTRIBUTE_UNUSED,
+ enum machine_mode mode,
+ const_tree type,
+ bool named ATTRIBUTE_UNUSED)
+{
+ return (mode == BLKmode
+ || (type && TREE_CODE (type) == RECORD_TYPE)
+ || (type && TREE_CODE (type) == UNION_TYPE));
+}
+
+#undef TARGET_CALLEE_COPIES
+#define TARGET_CALLEE_COPIES msp430_callee_copies
+
+static bool
+msp430_callee_copies (cumulative_args_t cap ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ const_tree type ATTRIBUTE_UNUSED,
+ bool named ATTRIBUTE_UNUSED)
+{
+ return true;
+}
+
+#undef TARGET_FUNCTION_ARG_ADVANCE
+#define TARGET_FUNCTION_ARG_ADVANCE msp430_function_arg_advance
+
+void
+msp430_function_arg_advance (cumulative_args_t cap,
+ enum machine_mode mode,
+ const_tree type,
+ bool named)
+{
+ CUMULATIVE_ARGS *ca = get_cumulative_args (cap);
+ int i;
+
+ msp430_evaluate_arg (cap, mode, type, named);
+
+ if (ca->start_reg >= CA_FIRST_REG)
+ for (i = 0; i < ca->reg_count; i ++)
+ ca->reg_used [i + ca->start_reg - CA_FIRST_REG] = 1;
+
+ ca->special_p = 0;
+}
+
+#undef TARGET_FUNCTION_ARG_BOUNDARY
+#define TARGET_FUNCTION_ARG_BOUNDARY msp430_function_arg_boundary
+
+static unsigned int
+msp430_function_arg_boundary (enum machine_mode mode, const_tree type)
+{
+ if (mode == BLKmode
+ && int_size_in_bytes (type) > 1)
+ return 16;
+ if (GET_MODE_BITSIZE (mode) > 8)
+ return 16;
+ return 8;
+}
+
+#undef TARGET_RETURN_IN_MEMORY
+#define TARGET_RETURN_IN_MEMORY msp430_return_in_memory
+
+static bool
+msp430_return_in_memory (const_tree ret_type, const_tree fntype ATTRIBUTE_UNUSED)
+{
+ enum machine_mode mode = TYPE_MODE (ret_type);
+
+ if (mode == BLKmode
+ || (fntype && TREE_CODE (TREE_TYPE (fntype)) == RECORD_TYPE)
+ || (fntype && TREE_CODE (TREE_TYPE (fntype)) == UNION_TYPE))
+ return true;
+
+ if (GET_MODE_SIZE (mode) > 8)
+ return true;
+
+ return false;
+}
+
+#undef TARGET_GET_RAW_ARG_MODE
+#define TARGET_GET_RAW_ARG_MODE msp430_get_raw_arg_mode
+
+static enum machine_mode
+msp430_get_raw_arg_mode (int regno)
+{
+ return (regno == ARG_POINTER_REGNUM) ? VOIDmode : Pmode;
+}
+
+#undef TARGET_GET_RAW_RESULT_MODE
+#define TARGET_GET_RAW_RESULT_MODE msp430_get_raw_result_mode
+
+static enum machine_mode
+msp430_get_raw_result_mode (int regno ATTRIBUTE_UNUSED)
+{
+ return Pmode;
+}
+
+/* Addressing Modes */
+
+#undef TARGET_LEGITIMATE_ADDRESS_P
+#define TARGET_LEGITIMATE_ADDRESS_P msp430_legitimate_address_p
+
+static bool
+reg_ok_for_addr (rtx r, bool strict)
+{
+ int rn = REGNO (r);
+
+ if (strict && rn >= FIRST_PSEUDO_REGISTER)
+ rn = reg_renumber [rn];
+ if (strict && 0 <= rn && rn < FIRST_PSEUDO_REGISTER)
+ return true;
+ if (!strict)
+ return true;
+ return false;
+}
+
+bool
+msp430_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
+ rtx x ATTRIBUTE_UNUSED,
+ bool strict ATTRIBUTE_UNUSED)
+{
+ switch (GET_CODE (x))
+ {
+ case MEM:
+ return false;
+
+ case PLUS:
+ if (REG_P (XEXP (x, 0)))
+ {
+ if (GET_MODE (x) != GET_MODE (XEXP (x, 0)))
+ return false;
+ if (!reg_ok_for_addr (XEXP (x, 0), strict))
+ return false;
+ switch (GET_CODE (XEXP (x, 1)))
+ {
+ case CONST:
+ case SYMBOL_REF:
+ case CONST_INT:
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+
+ case REG:
+ if (!reg_ok_for_addr (x, strict))
+ return false;
+ /* else... */
+ case CONST:
+ case SYMBOL_REF:
+ case CONST_INT:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+#undef TARGET_LEGITIMATE_CONSTANT_P
+#define TARGET_LEGITIMATE_CONSTANT_P msp430_legitimate_constant
+
+static bool
+msp430_legitimate_constant (enum machine_mode mode, rtx x)
+{
+ return ! CONST_INT_P (x)
+ || mode != PSImode
+ /* GCC does not know the width of the PSImode, so make
+ sure that it does not try to use a constant value that
+ is out of range. */
+ || (INTVAL (x) < (1 << 20) && INTVAL (x) >= (-1 << 20));
+}
+
+
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS msp430_rtx_costs
+
+static bool msp430_rtx_costs (rtx x ATTRIBUTE_UNUSED,
+ int code,
+ int outer_code ATTRIBUTE_UNUSED,
+ int opno ATTRIBUTE_UNUSED,
+ int * total,
+ bool speed ATTRIBUTE_UNUSED)
+{
+ switch (code)
+ {
+ case SIGN_EXTEND:
+ if (GET_MODE (x) == SImode && outer_code == SET)
+ {
+ *total = COSTS_N_INSNS (4);
+ return true;
+ }
+ break;
+ case ASHIFT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+ if (!msp430x)
+ {
+ *total = COSTS_N_INSNS (100);
+ return true;
+ }
+ break;
+ }
+ return false;
+}
+
+/* Function Entry and Exit */
+
+/* The MSP430 call frame looks like this:
+
+ <higher addresses>
+ +--------------------+
+ | |
+ | Stack Arguments |
+ | |
+ +--------------------+ <-- "arg pointer"
+ | |
+ | PC from call | (2 bytes for 430, 4 for TARGET_LARGE)
+ | |
+ +--------------------+
+ | SR if this func has|
+ | been called via an |
+ | interrupt. |
+ +--------------------+ <-- SP before prologue, also AP
+ | |
+ | Saved Regs | (2 bytes per reg for 430, 4 per for TARGET_LARGE)
+ | |
+ +--------------------+ <-- "frame pointer"
+ | |
+ | Locals |
+ | |
+ +--------------------+
+ | |
+ | Outgoing Args |
+ | |
+ +--------------------+ <-- SP during function
+ <lower addresses>
+
+*/
+
+/* We use this to wrap all emitted insns in the prologue, so they get
+ the "frame-related" (/f) flag set. */
+static rtx
+F (rtx x)
+{
+ RTX_FRAME_RELATED_P (x) = 1;
+ return x;
+}
+
+/* This is the one spot that decides if a register is to be saved and
+ restored in the prologue/epilogue. */
+static bool
+msp430_preserve_reg_p (int regno)
+{
+ /* PC, SP, SR, and the constant generator. */
+ if (regno <= 3)
+ return false;
+
+ /* FIXME: add interrupt, EH, etc. */
+ if (crtl->calls_eh_return)
+ return true;
+
+ /* Shouldn't be more than the above, but just in case... */
+ if (fixed_regs [regno])
+ return false;
+
+ /* Interrupt handlers save all registers they use, even
+ ones which are call saved. If they call other functions
+ then *every* register is saved. */
+ if (msp430_is_interrupt_func ())
+ return ! crtl->is_leaf || df_regs_ever_live_p (regno);
+
+ if (!call_used_regs [regno]
+ && df_regs_ever_live_p (regno))
+ return true;
+
+ return false;
+}
+
+/* Compute all the frame-related fields in our machine_function
+ structure. */
+static void
+msp430_compute_frame_info (void)
+{
+ int i;
+
+ cfun->machine->computed = 1;
+ cfun->machine->framesize_regs = 0;
+ cfun->machine->framesize_locals = get_frame_size ();
+ cfun->machine->framesize_outgoing = crtl->outgoing_args_size;
+
+ for (i = 0; i < ARG_POINTER_REGNUM; i ++)
+ if (msp430_preserve_reg_p (i))
+ {
+ cfun->machine->need_to_save [i] = 1;
+ cfun->machine->framesize_regs += (TARGET_LARGE ? 4 : 2);
+ }
+ else
+ cfun->machine->need_to_save [i] = 0;
+
+ if ((cfun->machine->framesize_locals + cfun->machine->framesize_outgoing) & 1)
+ cfun->machine->framesize_locals ++;
+
+ cfun->machine->framesize = (cfun->machine->framesize_regs
+ + cfun->machine->framesize_locals
+ + cfun->machine->framesize_outgoing);
+}
+
+static inline bool
+is_attr_func (const char * attr)
+{
+ return lookup_attribute (attr, DECL_ATTRIBUTES (current_function_decl)) != NULL_TREE;
+}
+
+/* Returns true if the current function has the "interrupt" attribute. */
+
+bool
+msp430_is_interrupt_func (void)
+{
+ return is_attr_func ("interrupt");
+}
+
+static inline bool
+is_naked_func (void)
+{
+ return is_attr_func ("naked");
+}
+
+static inline bool
+is_reentrant_func (void)
+{
+ return is_attr_func ("reentrant");
+}
+
+static inline bool
+is_critical_func (void)
+{
+ return is_attr_func ("critical");
+}
+
+#undef TARGET_ASM_FUNCTION_PROLOGUE
+#define TARGET_ASM_FUNCTION_PROLOGUE msp430_start_function
+
+static void
+msp430_start_function (FILE *outfile, HOST_WIDE_INT hwi_local ATTRIBUTE_UNUSED)
+{
+ int r, n;
+
+ fprintf (outfile, "; start of function\n");
+
+ if (DECL_ATTRIBUTES (current_function_decl) != NULL_TREE)
+ {
+ fprintf (outfile, "; attributes: ");
+ if (is_naked_func ())
+ fprintf (outfile, "naked ");
+ if (msp430_is_interrupt_func ())
+ fprintf (outfile, "interrupt ");
+ if (is_reentrant_func ())
+ fprintf (outfile, "reentrant ");
+ if (is_critical_func ())
+ fprintf (outfile, "critical ");
+ fprintf (outfile, "\n");
+ }
+
+ fprintf (outfile, "; framesize_regs: %d\n", cfun->machine->framesize_regs);
+ fprintf (outfile, "; framesize_locals: %d\n", cfun->machine->framesize_locals);
+ fprintf (outfile, "; framesize_outgoing: %d\n", cfun->machine->framesize_outgoing);
+ fprintf (outfile, "; framesize: %d\n", cfun->machine->framesize);
+ fprintf (outfile, "; elim ap -> fp %d\n", msp430_initial_elimination_offset (ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM));
+ fprintf (outfile, "; elim fp -> sp %d\n", msp430_initial_elimination_offset (FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM));
+
+ n = 0;
+ fprintf (outfile, "; saved regs:");
+ for (r = 0; r < ARG_POINTER_REGNUM; r++)
+ if (cfun->machine->need_to_save [r])
+ {
+ fprintf (outfile, " %s", reg_names [r]);
+ n = 1;
+ }
+ if (n == 0)
+ fprintf (outfile, "(none)");
+ fprintf (outfile, "\n");
+}
+
+/* Common code to change the stack pointer. */
+static void
+increment_stack (HOST_WIDE_INT amount)
+{
+ rtx inc;
+ rtx sp = stack_pointer_rtx;
+
+ if (amount == 0)
+ return;
+
+ if (amount < 0)
+ {
+ inc = GEN_INT (- amount);
+ if (TARGET_LARGE)
+ F (emit_insn (gen_subpsi3 (sp, sp, inc)));
+ else
+ F (emit_insn (gen_subhi3 (sp, sp, inc)));
+ }
+ else
+ {
+ inc = GEN_INT (amount);
+ if (TARGET_LARGE)
+ emit_insn (gen_addpsi3 (sp, sp, inc));
+ else
+ emit_insn (gen_addhi3 (sp, sp, inc));
+ }
+}
+
+/* Verify MSP430 specific attributes. */
+
+static tree
+msp430_attr (tree * node,
+ tree name,
+ tree args,
+ int flags ATTRIBUTE_UNUSED,
+ bool * no_add_attrs)
+{
+ gcc_assert (DECL_P (* node));
+
+ if (args != NULL)
+ {
+ tree value = TREE_VALUE (args);
+
+ switch (TREE_CODE (value))
+ {
+ case STRING_CST:
+ if ( strcmp (TREE_STRING_POINTER (value), "reset")
+ && strcmp (TREE_STRING_POINTER (value), "nmi")
+ && strcmp (TREE_STRING_POINTER (value), "watchdog"))
+ /* Allow the attribute to be added - the linker script
+ being used may still recognise this name. */
+ warning (OPT_Wattributes,
+ "unrecognised interrupt vector argument of %qE attribute",
+ name);
+ break;
+
+ case INTEGER_CST:
+ if (TREE_INT_CST_LOW (value) > 31)
+ /* Allow the attribute to be added - the linker script
+ being used may still recognise this value. */
+ warning (OPT_Wattributes,
+ "numeric argument of %qE attribute must be in range 0..31",
+ name);
+ break;
+
+ default:
+ warning (OPT_Wattributes,
+ "argument of %qE attribute is not a string constant or number",
+ name);
+ *no_add_attrs = true;
+ break;
+ }
+ }
+
+ if (TREE_CODE (* node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute only applies to functions",
+ name);
+ * no_add_attrs = true;
+ }
+
+ /* FIXME: We ought to check that the interrupt handler
+ attribute has been applied to a void function. */
+ /* FIXME: We should check that reentrant and critical
+ functions are not naked and that critical functions
+ are not reentrant. */
+
+ return NULL_TREE;
+}
+
+#undef TARGET_ATTRIBUTE_TABLE
+#define TARGET_ATTRIBUTE_TABLE msp430_attribute_table
+
+/* Table of MSP430-specific attributes. */
+const struct attribute_spec msp430_attribute_table[] =
+{
+ /* Name min_len decl_req, fn_type_req, affects_type_identity
+ max_len, type_req, handler. */
+ { "interrupt", 0, 1, true, false, false, msp430_attr, false },
+ { "naked", 0, 0, true, false, false, msp430_attr, false },
+ { "reentrant", 0, 0, true, false, false, msp430_attr, false },
+ { "critical", 0, 0, true, false, false, msp430_attr, false },
+ { NULL, 0, 0, false, false, false, NULL, false }
+};
+
+void
+msp430_start_function (FILE *file, const char *name, tree decl)
+{
+ tree int_attr;
+
+ int_attr = lookup_attribute ("interrupt", DECL_ATTRIBUTES (decl));
+ if (int_attr != NULL_TREE)
+ {
+ tree intr_vector = TREE_VALUE (int_attr);
+
+ if (intr_vector != NULL_TREE)
+ {
+ char buf[101];
+
+ intr_vector = TREE_VALUE (intr_vector);
+
+ /* The interrupt attribute has a vector value. Turn this into a
+ section name, switch to that section and put the address of
+ the current function into that vector slot. Note msp430_attr()
+ has already verified the vector name for us. */
+ if (TREE_CODE (intr_vector) == STRING_CST)
+ sprintf (buf, "__interrupt_vector_%.80s",
+ TREE_STRING_POINTER (intr_vector));
+ else /* TREE_CODE (intr_vector) == INTEGER_CST */
+ sprintf (buf, "__interrupt_vector_%u",
+ (unsigned int) TREE_INT_CST_LOW (intr_vector));
+
+ switch_to_section (get_section (buf, SECTION_CODE, decl));
+ fputs ("\t.word\t", file);
+ assemble_name (file, name);
+ fputc ('\n', file);
+ fputc ('\t', file);
+ }
+ }
+
+ switch_to_section (function_section (decl));
+ ASM_OUTPUT_FUNCTION_LABEL (file, name, decl);
+}
+
+static section *
+msp430_function_section (tree decl, enum node_frequency freq, bool startup, bool exit)
+{
+ /* In large mode we must make sure that interrupt handlers are put into
+ low memory as the vector table only accepts 16-bit addresses. */
+ if (TARGET_LARGE
+ && lookup_attribute ("interrupt", DECL_ATTRIBUTES (decl)))
+ return get_section (".lowtext", SECTION_CODE | SECTION_WRITE , decl);
+
+ /* Otherwise, use the default function section. */
+ return default_function_section (decl, freq, startup, exit);
+}
+
+#undef TARGET_ASM_FUNCTION_SECTION
+#define TARGET_ASM_FUNCTION_SECTION msp430_function_section
+
+enum msp430_builtin
+{
+ MSP430_BUILTIN_BIC_SR,
+ MSP430_BUILTIN_BIS_SR,
+ MSP430_BUILTIN_max
+};
+
+static GTY(()) tree msp430_builtins [(int) MSP430_BUILTIN_max];
+
+static void
+msp430_init_builtins (void)
+{
+ tree void_ftype_int = build_function_type_list (void_type_node, integer_type_node, NULL);
+
+ msp430_builtins[MSP430_BUILTIN_BIC_SR] =
+ add_builtin_function ( "__bic_SR_register_on_exit", void_ftype_int,
+ MSP430_BUILTIN_BIC_SR, BUILT_IN_MD, NULL, NULL_TREE);
+
+ msp430_builtins[MSP430_BUILTIN_BIS_SR] =
+ add_builtin_function ( "__bis_SR_register_on_exit", void_ftype_int,
+ MSP430_BUILTIN_BIS_SR, BUILT_IN_MD, NULL, NULL_TREE);
+}
+
+static tree
+msp430_builtin_decl (unsigned code, bool initialize ATTRIBUTE_UNUSED)
+{
+ switch (code)
+ {
+ case MSP430_BUILTIN_BIC_SR:
+ case MSP430_BUILTIN_BIS_SR:
+ return msp430_builtins[code];
+ default:
+ return error_mark_node;
+ }
+}
+
+static rtx
+msp430_expand_builtin (tree exp,
+ rtx target ATTRIBUTE_UNUSED,
+ rtx subtarget ATTRIBUTE_UNUSED,
+ enum machine_mode mode ATTRIBUTE_UNUSED,
+ int ignore ATTRIBUTE_UNUSED)
+{
+ tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
+ unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
+ rtx arg1 = expand_normal (CALL_EXPR_ARG (exp, 0));
+
+ if (! msp430_is_interrupt_func ())
+ {
+ error ("MSP430 builtin functions only work inside interrupt handlers");
+ return NULL_RTX;
+ }
+
+ if (! REG_P (arg1) && ! CONSTANT_P (arg1))
+ arg1 = force_reg (mode, arg1);
+
+ switch (fcode)
+ {
+ case MSP430_BUILTIN_BIC_SR: emit_insn (gen_bic_SR (arg1)); break;
+ case MSP430_BUILTIN_BIS_SR: emit_insn (gen_bis_SR (arg1)); break;
+ default:
+ internal_error ("bad builtin code");
+ break;
+ }
+ return NULL_RTX;
+}
+
+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS msp430_init_builtins
+
+#undef TARGET_EXPAND_BUILTIN
+#define TARGET_EXPAND_BUILTIN msp430_expand_builtin
+
+#undef TARGET_BUILTIN_DECL
+#define TARGET_BUILTIN_DECL msp430_builtin_decl
+
+void
+msp430_expand_prologue (void)
+{
+ int i, j;
+ int fs;
+ /* Always use stack_pointer_rtx instead of calling
+ rtx_gen_REG ourselves. Code elsewhere in GCC assumes
+ that there is a single rtx representing the stack pointer,
+ namely stack_pointer_rtx, and uses == to recognize it. */
+ rtx sp = stack_pointer_rtx;
+ rtx p;
+
+ if (is_naked_func ())
+ return;
+
+ emit_insn (gen_prologue_start_marker ());
+
+ if (is_critical_func ())
+ {
+ emit_insn (gen_push_intr_state ());
+ emit_insn (gen_disable_interrupts ());
+ }
+ else if (is_reentrant_func ())
+ emit_insn (gen_disable_interrupts ());
+
+ if (!cfun->machine->computed)
+ msp430_compute_frame_info ();
+
+ if (flag_stack_usage_info)
+ current_function_static_stack_size = cfun->machine->framesize;
+
+ if (crtl->args.pretend_args_size)
+ {
+ rtx note;
+
+ gcc_assert (crtl->args.pretend_args_size == 2);
+
+ p = emit_insn (gen_grow_and_swap ());
+
+ /* Document the stack decrement... */
+ note = F (gen_rtx_SET (Pmode, stack_pointer_rtx,
+ gen_rtx_MINUS (Pmode, stack_pointer_rtx, GEN_INT (2))));
+ add_reg_note (p, REG_FRAME_RELATED_EXPR, note);
+
+ /* ...and the establishment of a new location for the return address. */
+ note = F (gen_rtx_SET (Pmode, gen_rtx_MEM (Pmode,
+ gen_rtx_PLUS (Pmode, stack_pointer_rtx, GEN_INT (-2))),
+ pc_rtx));
+ add_reg_note (p, REG_CFA_OFFSET, note);
+ F (p);
+ }
+
+ for (i = 15; i >= 4; i--)
+ if (cfun->machine->need_to_save [i])
+ {
+ int seq, count;
+ rtx note;
+
+ for (seq = i - 1; seq >= 4 && cfun->machine->need_to_save[seq]; seq --)
+ ;
+ count = i - seq;
+
+ if (msp430x)
+ {
+ /* Note: with TARGET_LARGE we still use PUSHM as PUSHX.A is two bytes bigger. */
+ p = F (emit_insn (gen_pushm (gen_rtx_REG (Pmode, i),
+ GEN_INT (count))));
+
+ note = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (count + 1));
+
+ XVECEXP (note, 0, 0)
+ = F (gen_rtx_SET (VOIDmode,
+ stack_pointer_rtx,
+ gen_rtx_PLUS (Pmode,
+ stack_pointer_rtx,
+ GEN_INT (count * (TARGET_LARGE ? -4 : -2)))));
+
+ /* *sp-- = R[i-j] */
+ /* sp+N R10
+ ...
+ sp R4 */
+ for (j = 0; j < count; j ++)
+ {
+ rtx addr;
+ int ofs = (count - j - 1) * (TARGET_LARGE ? 4 : 2);
+
+ if (ofs)
+ addr = gen_rtx_PLUS (Pmode, sp, GEN_INT (ofs));
+ else
+ addr = stack_pointer_rtx;
+
+ XVECEXP (note, 0, j + 1) =
+ F (gen_rtx_SET (VOIDmode,
+ gen_rtx_MEM (Pmode, addr),
+ gen_rtx_REG (Pmode, i - j)) );
+ }
+
+ add_reg_note (p, REG_FRAME_RELATED_EXPR, note);
+ i -= count - 1;
+ }
+ else
+ F (emit_insn (gen_push (gen_rtx_REG (Pmode, i))));
+ }
+
+ if (frame_pointer_needed)
+ F (emit_move_insn (gen_rtx_REG (Pmode, FRAME_POINTER_REGNUM), sp));
+
+ fs = cfun->machine->framesize_locals + cfun->machine->framesize_outgoing;
+
+ increment_stack (- fs);
+
+ emit_insn (gen_prologue_end_marker ());
+}
+
+void
+msp430_expand_epilogue (int is_eh)
+{
+ int i;
+ int fs;
+ int helper_n = 0;
+
+ if (is_naked_func ())
+ return;
+
+ if (cfun->machine->need_to_save [10])
+ {
+ /* Check for a helper function. */
+ helper_n = 7; /* For when the loop below never sees a match. */
+ for (i = 9; i >= 4; i--)
+ if (!cfun->machine->need_to_save [i])
+ {
+ helper_n = 10 - i;
+ for (; i >= 4; i--)
+ if (cfun->machine->need_to_save [i])
+ {
+ helper_n = 0;
+ break;
+ }
+ break;
+ }
+ }
+
+ emit_insn (gen_epilogue_start_marker ());
+
+ fs = cfun->machine->framesize_locals + cfun->machine->framesize_outgoing;
+
+ increment_stack (fs);
+
+ if (is_eh)
+ {
+ /* We need to add the right "SP" register save just after the
+ regular ones, so that when we pop it off we're in the EH
+ return frame, not this one. This overwrites our own return
+ address, but we're not going to be returning anyway. */
+ rtx r12 = gen_rtx_REG (Pmode, 12);
+ rtx (*addPmode)(rtx, rtx, rtx) = TARGET_LARGE ? gen_addpsi3 : gen_addhi3;
+
+ /* R12 will hold the new SP. */
+ i = cfun->machine->framesize_regs;
+ emit_move_insn (r12, stack_pointer_rtx);
+ emit_insn (addPmode (r12, r12, EH_RETURN_STACKADJ_RTX));
+ emit_insn (addPmode (r12, r12, GEN_INT (i)));
+ emit_move_insn (gen_rtx_MEM (Pmode, plus_constant (Pmode, stack_pointer_rtx, i)), r12);
+ }
+
+ for (i = 4; i <= 15; i++)
+ if (cfun->machine->need_to_save [i])
+ {
+ int seq, count;
+
+ for (seq = i + 1; seq <= 15 && cfun->machine->need_to_save[seq]; seq ++)
+ ;
+ count = seq - i;
+
+ if (msp430x)
+ {
+ /* Note: With TARGET_LARGE we still use POPM as POPX.A is two
+ bytes bigger.
+ Note: See the popm pattern for the explanation of the strange
+ arguments. */
+ emit_insn (gen_popm (stack_pointer_rtx, GEN_INT (~(seq - 1)),
+ GEN_INT (count)));
+ i += count - 1;
+ }
+ else if (i == 11 - helper_n
+ && ! msp430_is_interrupt_func ()
+ && ! is_reentrant_func ()
+ && ! is_critical_func ()
+ && crtl->args.pretend_args_size == 0
+ /* Calling the helper takes as many bytes as the POP;RET sequence. */
+ && helper_n > 1
+ && !is_eh)
+ {
+ emit_insn (gen_epilogue_helper (GEN_INT (helper_n)));
+ return;
+ }
+ else
+ emit_insn (gen_pop (gen_rtx_REG (Pmode, i)));
+ }
+
+ if (is_eh)
+ {
+ /* Also pop SP, which puts us into the EH return frame. Except
+ that you can't "pop" sp, you have to just load it off the
+ stack. */
+ emit_move_insn (stack_pointer_rtx, gen_rtx_MEM (Pmode, stack_pointer_rtx));
+ }
+
+ if (crtl->args.pretend_args_size)
+ emit_insn (gen_swap_and_shrink ());
+
+ if (is_critical_func ())
+ emit_insn (gen_pop_intr_state ());
+ else if (is_reentrant_func ())
+ emit_insn (gen_enable_interrupts ());
+
+ emit_jump_insn (gen_msp_return ());
+}
+
+/* Implements EH_RETURN_STACKADJ_RTX. Saved and used later in
+ m32c_emit_eh_epilogue. */
+rtx
+msp430_eh_return_stackadj_rtx (void)
+{
+ if (!cfun->machine->eh_stack_adjust)
+ {
+ rtx sa;
+
+ sa = gen_rtx_REG (Pmode, 15);
+ cfun->machine->eh_stack_adjust = sa;
+ }
+ return cfun->machine->eh_stack_adjust;
+}
+
+/* This function is called before reload, to "fix" the stack in
+ preparation for an EH return. */
+void
+msp430_expand_eh_return (rtx eh_handler)
+{
+ /* These are all Pmode */
+ rtx ap, sa, ra, tmp;
+
+ ap = arg_pointer_rtx;
+ sa = msp430_eh_return_stackadj_rtx ();
+ ra = eh_handler;
+
+ tmp = ap;
+ tmp = gen_rtx_PLUS (Pmode, ap, sa);
+ tmp = plus_constant (Pmode, tmp, TARGET_LARGE ? -4 : -2);
+ tmp = gen_rtx_MEM (Pmode, tmp);
+ emit_move_insn (tmp, ra);
+}
+
+/* This is a list of MD patterns that implement fixed-count shifts. */
+static struct
+{
+ const char *name;
+ int count;
+ int need_430x;
+ rtx (*genfunc)(rtx,rtx);
+}
+ const_shift_helpers[] =
+{
+#define CSH(N,C,X,G) { "__mspabi_"N, C, X, gen_##G }
+
+ CSH ("slli", 1, 1, slli_1),
+ CSH ("slll", 1, 1, slll_1),
+ CSH ("slll", 2, 1, slll_2),
+
+ CSH ("srai", 1, 0, srai_1),
+ CSH ("sral", 1, 0, sral_1),
+ CSH ("sral", 2, 0, sral_2),
+
+ CSH ("srll", 1, 0, srll_1),
+ CSH ("srll", 2, 1, srll_2x),
+ { 0, 0, 0, 0 }
+#undef CSH
+};
+
+/* The MSP430 ABI defines a number of helper functions that should be
+ used for, for example, 32-bit shifts. This function is called to
+ emit such a function, using the table above to optimize some
+ cases. */
+void
+msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variants)
+{
+ rtx c, f;
+ char *helper_const = NULL;
+ int arg2 = 13;
+ int arg1sz = 1;
+ enum machine_mode arg0mode = GET_MODE (operands[0]);
+ enum machine_mode arg1mode = GET_MODE (operands[1]);
+ enum machine_mode arg2mode = GET_MODE (operands[2]);
+ int have_430x = msp430x ? 1 : 0;
+
+ if (CONST_INT_P (operands[2]))
+ {
+ int i;
+
+ for (i=0; const_shift_helpers[i].name; i++)
+ {
+ if (const_shift_helpers[i].need_430x <= have_430x
+ && strcmp (helper_name, const_shift_helpers[i].name) == 0
+ && INTVAL (operands[2]) == const_shift_helpers[i].count)
+ {
+ emit_insn (const_shift_helpers[i].genfunc (operands[0], operands[1]));
+ return;
+ }
+ }
+ }
+
+ if (arg1mode == VOIDmode)
+ arg1mode = arg0mode;
+ if (arg2mode == VOIDmode)
+ arg2mode = arg0mode;
+
+ if (arg1mode == SImode)
+ {
+ arg2 = 14;
+ arg1sz = 2;
+ }
+
+ if (const_variants
+ && CONST_INT_P (operands[2])
+ && INTVAL (operands[2]) >= 1
+ && INTVAL (operands[2]) <= 15)
+ {
+ /* Note that the INTVAL is limited in value and length by the conditional above. */
+ int len = strlen (helper_name) + 4;
+ helper_const = (char *) xmalloc (len);
+ snprintf (helper_const, len, "%s_%d", helper_name, (int) INTVAL (operands[2]));
+ }
+
+ emit_move_insn (gen_rtx_REG (arg1mode, 12),
+ operands[1]);
+ if (!helper_const)
+ emit_move_insn (gen_rtx_REG (arg2mode, arg2),
+ operands[2]);
+
+ c = gen_call_value_internal (gen_rtx_REG (arg0mode, 12),
+ gen_rtx_SYMBOL_REF (VOIDmode, helper_const ? helper_const : helper_name),
+ GEN_INT (0));
+ c = emit_call_insn (c);
+ RTL_CONST_CALL_P (c) = 1;
+
+ f = 0;
+ use_regs (&f, 12, arg1sz);
+ if (!helper_const)
+ use_regs (&f, arg2, 1);
+ add_function_usage_to (c, f);
+
+ emit_move_insn (operands[0],
+ gen_rtx_REG (arg0mode, 12));
+}
+
+/* Called by cbranch<mode>4 to coerce operands into usable forms. */
+void
+msp430_fixup_compare_operands (enum machine_mode my_mode, rtx * operands)
+{
+ /* constants we're looking for, not constants which are allowed. */
+ int const_op_idx = 1;
+
+ if (msp430_reversible_cmp_operator (operands[0], VOIDmode))
+ const_op_idx = 2;
+
+ if (GET_CODE (operands[const_op_idx]) != REG
+ && GET_CODE (operands[const_op_idx]) != MEM)
+ operands[const_op_idx] = copy_to_mode_reg (my_mode, operands[const_op_idx]);
+}
+
+/* Simplify_gen_subreg() doesn't handle memory references the way we
+ need it to below, so we use this function for when we must get a
+ valid subreg in a "natural" state. */
+rtx
+msp430_subreg (enum machine_mode mode, rtx r, enum machine_mode omode, int byte)
+{
+ rtx rv;
+
+ if (GET_CODE (r) == SUBREG
+ && SUBREG_BYTE (r) == 0)
+ {
+ rtx ireg = SUBREG_REG (r);
+ enum machine_mode imode = GET_MODE (ireg);
+
+ /* special case for (HI (SI (PSI ...), 0)) */
+ if (imode == PSImode
+ && mode == HImode
+ && byte == 0)
+ rv = gen_rtx_SUBREG (mode, ireg, byte);
+ else
+ rv = simplify_gen_subreg (mode, ireg, imode, byte);
+ }
+ else if (GET_CODE (r) == MEM)
+ rv = adjust_address (r, mode, byte);
+ else
+ rv = simplify_gen_subreg (mode, r, omode, byte);
+
+ if (!rv)
+ gcc_unreachable ();
+
+ return rv;
+}
+
+/* Called by movsi_x to generate the HImode operands. */
+void
+msp430_split_movsi (rtx *operands)
+{
+ rtx op00, op02, op10, op12;
+
+ op00 = msp430_subreg (HImode, operands[0], SImode, 0);
+ op02 = msp430_subreg (HImode, operands[0], SImode, 2);
+
+ if (GET_CODE (operands[1]) == CONST
+ || GET_CODE (operands[1]) == SYMBOL_REF)
+ {
+ op10 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16), GEN_INT (0));
+ op10 = gen_rtx_CONST (HImode, op10);
+ op12 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16), GEN_INT (16));
+ op12 = gen_rtx_CONST (HImode, op12);
+ }
+ else
+ {
+ op10 = msp430_subreg (HImode, operands[1], SImode, 0);
+ op12 = msp430_subreg (HImode, operands[1], SImode, 2);
+ }
+
+ if (rtx_equal_p (operands[0], operands[1]))
+ {
+ operands[2] = op02;
+ operands[4] = op12;
+ operands[3] = op00;
+ operands[5] = op10;
+ }
+ else if (rtx_equal_p (op00, op12)
+ /* Catch the case where we are loading (rN, rN+1) from mem (rN). */
+ || (REG_P (op00) && reg_mentioned_p (op00, op10))
+ /* Or storing (rN) into mem (rN). */
+ || (REG_P (op10) && reg_mentioned_p (op10, op00))
+ )
+ {
+ operands[2] = op02;
+ operands[4] = op12;
+ operands[3] = op00;
+ operands[5] = op10;
+ }
+ else
+ {
+ operands[2] = op00;
+ operands[4] = op10;
+ operands[3] = op02;
+ operands[5] = op12;
+ }
+}
+
+
+/* The MSPABI specifies the names of various helper functions, many of
+ which are compatible with GCC's helpers. This table maps the GCC
+ name to the MSPABI name. */
+static const struct
+{
+ char const * const gcc_name;
+ char const * const ti_name;
+}
+ helper_function_name_mappings [] =
+{
+ /* Floating point to/from integer conversions. */
+ { "__truncdfsf2", "__mspabi_cvtdf" },
+ { "__extendsfdf2", "__mspabi_cvtfd" },
+ { "__fixdfhi", "__mspabi_fixdi" },
+ { "__fixdfsi", "__mspabi_fixdli" },
+ { "__fixdfdi", "__mspabi_fixdlli" },
+ { "__fixunsdfhi", "__mspabi_fixdu" },
+ { "__fixunsdfsi", "__mspabi_fixdul" },
+ { "__fixunsdfdi", "__mspabi_fixdull" },
+ { "__fixsfhi", "__mspabi_fixfi" },
+ { "__fixsfsi", "__mspabi_fixfli" },
+ { "__fixsfdi", "__mspabi_fixflli" },
+ { "__fixunsfhi", "__mspabi_fixfu" },
+ { "__fixunsfsi", "__mspabi_fixful" },
+ { "__fixunsfdi", "__mspabi_fixfull" },
+ { "__floathisf", "__mspabi_fltif" },
+ { "__floatsisf", "__mspabi_fltlif" },
+ { "__floatdisf", "__mspabi_fltllif" },
+ { "__floathidf", "__mspabi_fltid" },
+ { "__floatsidf", "__mspabi_fltlid" },
+ { "__floatdidf", "__mspabi_fltllid" },
+ { "__floatunhisf", "__mspabi_fltuf" },
+ { "__floatunsisf", "__mspabi_fltulf" },
+ { "__floatundisf", "__mspabi_fltullf" },
+ { "__floatunhidf", "__mspabi_fltud" },
+ { "__floatunsidf", "__mspabi_fltuld" },
+ { "__floatundidf", "__mspabi_fltulld" },
+
+ /* Floating point comparisons. */
+ /* GCC uses individual functions for each comparison, TI uses one
+ compare <=> function. */
+
+ /* Floating point arithmatic */
+ { "__adddf3", "__mspabi_addd" },
+ { "__addsf3", "__mspabi_addf" },
+ { "__divdf3", "__mspabi_divd" },
+ { "__divsf3", "__mspabi_divf" },
+ { "__muldf3", "__mspabi_mpyd" },
+ { "__mulsf3", "__mspabi_mpyf" },
+ { "__subdf3", "__mspabi_subd" },
+ { "__subsf3", "__mspabi_subf" },
+ /* GCC does not use helper functions for negation */
+
+ /* Integer multiply, divide, remainder. */
+ /* Note: gcc doesn't know about hardware multiply options (yet?) */
+ { "__mulhi3", "__mspabi_mpyi" },
+ { "__mulsi3", "__mspabi_mpyl" },
+ { "__muldi3", "__mspabi_mpyll" },
+#if 0
+ /* Clarify signed vs unsigned first. */
+ { "__mulhisi3", "__mspabi_mpysl" }, /* gcc doesn't use widening multiply (yet?) */
+ { "__mulsidi3", "__mspabi_mpysll" }, /* gcc doesn't use widening multiply (yet?) */
+#endif
+
+ { "__divhi3", "__mspabi_divi" },
+ { "__divsi3", "__mspabi_divli" },
+ { "__divdi3", "__mspabi_divlli" },
+ { "__udivhi3", "__mspabi_divu" },
+ { "__udivsi3", "__mspabi_divlu" },
+ { "__udivdi3", "__mspabi_divllu" },
+ { "__modhi3", "__mspabi_remi" },
+ { "__modsi3", "__mspabi_remli" },
+ { "__moddi3", "__mspabi_remlli" },
+ { "__umodhi3", "__mspabi_remu" },
+ { "__umodsi3", "__mspabi_remul" },
+ { "__umoddi3", "__mspabi_remull" },
+
+ /* Bitwise operations. */
+ /* Rotation - no rotation support yet. */
+ /* Logical left shift - gcc already does these itself. */
+ /* Arithmetic left shift - gcc already does these itself. */
+ /* Arithmetic right shift - gcc already does these itself. */
+
+ { NULL, NULL }
+};
+
+/* This function does the same as the default, but it will replace GCC
+ function names with the MSPABI-specified ones. */
+void
+msp430_output_labelref (FILE *file, const char *name)
+{
+ int i;
+
+ for (i = 0; helper_function_name_mappings [i].gcc_name; i++)
+ if (! strcmp (helper_function_name_mappings [i].gcc_name, name))
+ {
+ fputs (helper_function_name_mappings [i].ti_name, file);
+ return;
+ }
+
+ fputs (name, file);
+}
+
+/* Common code for msp430_print_operand... */
+
+static void
+msp430_print_operand_raw (FILE * file, rtx op)
+{
+ int i;
+
+ switch (GET_CODE (op))
+ {
+ case REG:
+ fprintf (file, "%s", reg_names [REGNO (op)]);
+ break;
+
+ case CONST_INT:
+ i = INTVAL (op);
+ if (TARGET_ASM_HEX)
+ fprintf (file, "%#x", i);
+ else
+ fprintf (file, "%d", i);
+ break;
+
+ case CONST:
+ case PLUS:
+ case MINUS:
+ case SYMBOL_REF:
+ case LABEL_REF:
+ output_addr_const (file, op);
+ break;
+
+ default:
+ print_rtl (file, op);
+ break;
+ }
+}
+
+#undef TARGET_PRINT_OPERAND_ADDRESS
+#define TARGET_PRINT_OPERAND_ADDRESS msp430_print_operand_addr
+
+/* Output to stdio stream FILE the assembler syntax for an
+ instruction operand that is a memory reference whose address
+ is ADDR. */
+
+static void
+msp430_print_operand_addr (FILE * file, rtx addr)
+{
+ switch (GET_CODE (addr))
+ {
+ case PLUS:
+ msp430_print_operand_raw (file, XEXP (addr, 1));
+ gcc_assert (REG_P (XEXP (addr, 0)));
+ fprintf (file, "(%s)", reg_names [REGNO (XEXP (addr, 0))]);
+ return;
+
+ case REG:
+ fprintf (file, "@");
+ break;
+
+ case CONST:
+ case CONST_INT:
+ case SYMBOL_REF:
+ case LABEL_REF:
+ fprintf (file, "&");
+ break;
+
+ default:
+ break;
+ }
+
+ msp430_print_operand_raw (file, addr);
+}
+
+#undef TARGET_PRINT_OPERAND
+#define TARGET_PRINT_OPERAND msp430_print_operand
+
+static void
+msp430_print_operand (FILE * file, rtx op, int letter)
+{
+ rtx addr;
+
+ /* We can't use c, n, a, or l. */
+ switch (letter)
+ {
+ case 'Z':
+ gcc_assert (CONST_INT_P (op));
+ /* Print the constant value, less one. */
+ fprintf (file, "#%ld", INTVAL (op) - 1);
+ return;
+ case 'Y':
+ gcc_assert (CONST_INT_P (op));
+ /* Print the constant value, less four. */
+ fprintf (file, "#%ld", INTVAL (op) - 4);
+ return;
+ /* case 'D': used for "decimal without '#'" */
+ case 'I':
+ if (GET_CODE (op) == CONST_INT)
+ {
+ /* Inverse of constants */
+ int i = INTVAL (op);
+ fprintf (file, "%d", ~i);
+ return;
+ }
+ op = XEXP (op, 0);
+ break;
+ case 'r': /* Conditional jump where the condition is reversed. */
+ switch (GET_CODE (op))
+ {
+ case EQ: fprintf (file, "NE"); break;
+ case NE: fprintf (file, "EQ"); break;
+ case GEU: fprintf (file, "LO"); break;
+ case LTU: fprintf (file, "HS"); break;
+ case GE: fprintf (file, "L"); break;
+ case LT: fprintf (file, "GE"); break;
+ /* Assume these have reversed operands. */
+ case GTU: fprintf (file, "HS"); break;
+ case LEU: fprintf (file, "LO"); break;
+ case GT: fprintf (file, "GE"); break;
+ case LE: fprintf (file, "L"); break;
+ default:
+ msp430_print_operand_raw (file, op);
+ break;
+ }
+ return;
+ case 'R': /* Conditional jump where the operands are reversed. */
+ switch (GET_CODE (op))
+ {
+ case GTU: fprintf (file, "LO"); break;
+ case LEU: fprintf (file, "HS"); break;
+ case GT: fprintf (file, "L"); break;
+ case LE: fprintf (file, "GE"); break;
+ default:
+ msp430_print_operand_raw (file, op);
+ break;
+ }
+ return;
+ case 'p': /* Bit position. 0 == 0x01, 3 = 0x08 etc. */
+ gcc_assert (CONST_INT_P (op));
+ fprintf (file, "#%d", 1 << INTVAL (op));
+ return;
+ case 'B':
+ switch (GET_MODE (op))
+ {
+ case QImode: fprintf (file, ".B"); return;
+ case HImode: fprintf (file, ".W"); return;
+ case PSImode: fprintf (file, ".A"); return;
+ case SImode: fprintf (file, ".A"); return;
+ default:
+ return;
+ }
+ case 'L': /* Low half. */
+ switch (GET_CODE (op))
+ {
+ case MEM:
+ op = adjust_address (op, Pmode, 0);
+ break;
+ case REG:
+ break;
+ case CONST_INT:
+ op = GEN_INT (INTVAL (op) & 0xffff);
+ letter = 0;
+ break;
+ default:
+ /* If you get here, figure out a test case :-) */
+ gcc_unreachable ();
+ }
+ break;
+ case 'H': /* high half */
+ switch (GET_CODE (op))
+ {
+ case MEM:
+ op = adjust_address (op, Pmode, 2);
+ break;
+ case REG:
+ op = gen_rtx_REG (Pmode, REGNO (op) + 1);
+ break;
+ case CONST_INT:
+ op = GEN_INT (INTVAL (op) >> 16);
+ letter = 0;
+ break;
+ default:
+ /* If you get here, figure out a test case :-) */
+ gcc_unreachable ();
+ }
+ break;
+
+ case 'X':
+ /* This is used to turn, for example, an ADD opcode into an ADDX
+ opcode when we're using 20-bit addresses. */
+ if (TARGET_LARGE)
+ fprintf (file, "X");
+ /* We don't care which operand we use, but we want 'X' in the MD
+ file, so we do it this way. */
+ return;
+
+ case 'x':
+ /* Similarly, but only for PSImodes. BIC, for example, needs this. */
+ if (TARGET_LARGE && GET_MODE (op) == PSImode)
+ fprintf (file, "X");
+ return;
+
+ case 'A':
+ /* Likewise, for BR -> BRA. */
+ if (TARGET_LARGE)
+ fprintf (file, "A");
+ return;
+
+ case 'O':
+ /* Computes the offset to the top of the stack for the current frame.
+ This has to be done here rather than in, say, msp430_expand_builtin()
+ because builtins are expanded before the frame layout is determined. */
+ fprintf (file, "%d",
+ msp430_initial_elimination_offset (ARG_POINTER_REGNUM, STACK_POINTER_REGNUM)
+ - 2);
+ return;
+ }
+
+ switch (GET_CODE (op))
+ {
+ case REG:
+ msp430_print_operand_raw (file, op);
+ break;
+
+ case MEM:
+ addr = XEXP (op, 0);
+ msp430_print_operand_addr (file, addr);
+ break;
+
+ case CONST_INT:
+ case CONST:
+ case SYMBOL_REF:
+ case LABEL_REF:
+ if (letter == 0)
+ fprintf (file, "#");
+ msp430_print_operand_raw (file, op);
+ break;
+
+ case EQ: fprintf (file, "EQ"); break;
+ case NE: fprintf (file, "NE"); break;
+ case GEU: fprintf (file, "HS"); break;
+ case LTU: fprintf (file, "LO"); break;
+ case GE: fprintf (file, "GE"); break;
+ case LT: fprintf (file, "L"); break;
+
+ default:
+ print_rtl (file, op);
+ break;
+ }
+}
+
+
+/* Frame stuff. */
+
+rtx
+msp430_return_addr_rtx (int count)
+{
+ int ra_size;
+ if (count)
+ return NULL_RTX;
+
+ ra_size = TARGET_LARGE ? 4 : 2;
+ if (crtl->args.pretend_args_size)
+ ra_size += 2;
+
+ return gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx, GEN_INT (- ra_size)));
+}
+
+rtx
+msp430_incoming_return_addr_rtx (void)
+{
+ return gen_rtx_MEM (Pmode, stack_pointer_rtx);
+}
+
+/* Instruction generation stuff. */
+
+/* Generate a sequence of instructions to sign-extend an HI
+ value into an SI value. Handles the tricky case where
+ we are overwriting the destination. */
+
+const char *
+msp430x_extendhisi (rtx * operands)
+{
+ if (REGNO (operands[0]) == REGNO (operands[1]))
+ /* Low word of dest == source word. */
+ return "BIT.W #0x8000, %L0 { SUBC.W %H0, %H0 { INV.W %H0, %H0"; /* 8-bytes. */
+
+ if (! msp430x)
+ /* Note: This sequence is approximately the same length as invoking a helper
+ function to perform the sign-extension, as in:
+
+ MOV.W %1, %L0
+ MOV.W %1, r12
+ CALL __mspabi_srai_15
+ MOV.W r12, %H0
+
+ but this version does not involve any function calls or using argument
+ registers, so it reduces register pressure. */
+ return "MOV.W %1, %L0 { BIT.W #0x8000, %L0 { SUBC.W %H0, %H0 { INV.W %H0, %H0"; /* 10-bytes. */
+
+ if (REGNO (operands[0]) + 1 == REGNO (operands[1]))
+ /* High word of dest == source word. */
+ return "MOV.W %1, %L0 { RPT #15 { RRAX.W %H0"; /* 6-bytes. */
+
+ /* No overlap between dest and source. */
+ return "MOV.W %1, %L0 { MOV.W %1, %H0 { RPT #15 { RRAX.W %H0"; /* 8-bytes. */
+}
+
+/* Likewise for logical right shifts. */
+const char *
+msp430x_logical_shift_right (rtx amount)
+{
+ /* The MSP430X's logical right shift instruction - RRUM - does
+ not use an extension word, so we cannot encode a repeat count.
+ Try various alternatives to work around this. If the count
+ is in a register we are stuck, hence the assert. */
+ gcc_assert (CONST_INT_P (amount));
+
+ if (INTVAL (amount) <= 0
+ || INTVAL (amount) >= 16)
+ return "# nop logical shift.";
+
+ if (INTVAL (amount) > 0
+ && INTVAL (amount) < 5)
+ return "rrum.w\t%2, %0"; /* Two bytes. */
+
+ if (INTVAL (amount) > 4
+ && INTVAL (amount) < 9)
+ return "rrum.w\t#4, %0 { rrum.w\t%Y2, %0 "; /* Four bytes. */
+
+ /* First we logically shift right by one. Now we know
+ that the top bit is zero and we can use the arithmetic
+ right shift instruction to perform the rest of the shift. */
+ return "rrum.w\t#1, %0 { rpt\t%Z2 { rrax.w\t%0"; /* Six bytes. */
+}
+
+struct gcc_target targetm = TARGET_INITIALIZER;
+
+#include "gt-msp430.h"
diff --git a/gcc/config/msp430/msp430.h b/gcc/config/msp430/msp430.h
new file mode 100644
index 00000000000..f5289b551e3
--- /dev/null
+++ b/gcc/config/msp430/msp430.h
@@ -0,0 +1,406 @@
+/* GCC backend definitions for the TI MSP430 Processor
+ Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+
+/* Run-time Target Specification */
+
+/* True if the MSP430x extensions are enabled. */
+#ifndef IN_LIBGCC2
+extern bool msp430x;
+#endif
+
+#define TARGET_CPU_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("NO_TRAMPOLINES"); \
+ builtin_define ("__MSP430__"); \
+ if (msp430x) \
+ { \
+ builtin_define ("__MSP430X__"); \
+ builtin_assert ("cpu=MSP430X"); \
+ if (TARGET_LARGE) \
+ builtin_define ("__MSP430X_LARGE__"); \
+ } \
+ else \
+ builtin_assert ("cpu=MSP430"); \
+ } \
+ while (0)
+
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:crt0.o%s} crtbegin.o%s"
+
+/* -lgcc is included because crtend.o needs __mspabi_func_epilog_1. */
+#undef ENDFILE_SPEC
+#define ENDFILE_SPEC "crtend.o%s crtn.o%s -lgcc"
+
+#define ASM_SPEC "-mP " /* Enable polymorphic instructions. */ \
+ "%{mmcu=msp430x:-mmcu=msp430X;mmcu=*:-mmcu=%*} " /* Pass the MCU type on to the assembler. */ \
+ "%{mrelax=-mQ} " /* Pass the relax option on to the assembler. */ \
+ "%{mlarge:-ml} " /* Tell the assembler if we are building for the LARGE pointer model. */ \
+ "%{!msim:-md} %{msim:%{mlarge:-md}}" /* Copy data from ROM to RAM if necessary. */ \
+ "%{ffunction-sections:-gdwarf-sections}" /* If function sections are being created then create DWARF line number sections as well. */
+
+/* Enable linker section garbage collection by default, unless we
+ are creating a relocatable binary (gc does not work) or debugging
+ is enabled (the GDB testsuite relies upon unused entities not being deleted). */
+#define LINK_SPEC "%{mrelax:--relax} %{mlarge:%{!r:%{!g:--gc-sections}}}"
+
+#undef LIB_SPEC
+#define LIB_SPEC " \
+--start-group \
+-lc \
+-lgcc \
+%{msim:-lsim} \
+%{!msim:-lnosys} \
+--end-group \
+%{!T*: %{msim: %{mlarge:%Tmsp430xl-sim.ld}%{!mlarge:%Tmsp430-sim.ld}}%{!msim:%Tmsp430.ld}} \
+"
+
+
+/* Storage Layout */
+
+#define BITS_BIG_ENDIAN 0
+#define BYTES_BIG_ENDIAN 0
+#define WORDS_BIG_ENDIAN 0
+
+
+#ifdef IN_LIBGCC2
+/* This is to get correct SI and DI modes in libgcc2.c (32 and 64 bits). */
+#define UNITS_PER_WORD 4
+/* We have a problem with libgcc2. It only defines two versions of
+ each function, one for "int" and one for "long long". Ie it assumes
+ that "sizeof (int) == sizeof (long)". For the MSP430 this is not true
+ and we need a third set of functions. We explicitly define
+ LIBGCC2_UNITS_PER_WORD here so that it is clear that we are expecting
+ to get the SI and DI versions from the libgcc2.c sources, and we
+ provide our own set of HI functions, which is why this
+ definition is surrounded by #ifndef..#endif. */
+#ifndef LIBGCC2_UNITS_PER_WORD
+#define LIBGCC2_UNITS_PER_WORD 4
+#endif
+#else
+/* Actual width of a word, in units (bytes). */
+#define UNITS_PER_WORD 2
+#endif
+
+#define SHORT_TYPE_SIZE 16
+#define INT_TYPE_SIZE 16
+#define LONG_TYPE_SIZE 32
+#define LONG_LONG_TYPE_SIZE 64
+
+#define FLOAT_TYPE_SIZE 32
+#define DOUBLE_TYPE_SIZE 64
+#define LONG_DOUBLE_TYPE_SIZE 64 /*DOUBLE_TYPE_SIZE*/
+
+#define LIBGCC2_HAS_DF_MODE 1
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
+
+#define DEFAULT_SIGNED_CHAR 0
+
+#define STRICT_ALIGNMENT 1
+#define FUNCTION_BOUNDARY 16
+#define BIGGEST_ALIGNMENT 16
+#define STACK_BOUNDARY 16
+#define PARM_BOUNDARY 8
+#define PCC_BITFIELD_TYPE_MATTERS 1
+
+#define STACK_GROWS_DOWNWARD 1
+#define FRAME_GROWS_DOWNWARD 1
+#define FIRST_PARM_OFFSET(FNDECL) 0
+
+#define MAX_REGS_PER_ADDRESS 1
+
+#define Pmode (TARGET_LARGE ? PSImode : HImode)
+/* Note: 32 is a lie. Large pointers are actually 20-bits wide. But gcc
+ thinks that any non-power-of-2 pointer size equates to BLKmode, which
+ causes all kinds of problems... */
+#define POINTER_SIZE (TARGET_LARGE ? 32 : 16)
+#define POINTERS_EXTEND_UNSIGNED 1
+
+#define ADDR_SPACE_NEAR 1
+#define ADDR_SPACE_FAR 2
+
+#define REGISTER_TARGET_PRAGMAS() msp430_register_pragmas()
+
+#if 1 /* XXX */
+/* Define this macro if it is advisable to hold scalars in registers
+ in a wider mode than that declared by the program. In such cases,
+ the value is constrained to be within the bounds of the declared
+ type, but kept valid in the wider mode. The signedness of the
+ extension may differ from that of the type. */
+
+#define PROMOTE_MODE(MODE, UNSIGNEDP, TYPE) \
+ if (GET_MODE_CLASS (MODE) == MODE_INT \
+ && GET_MODE_SIZE (MODE) < 2) \
+ (MODE) = HImode;
+#endif
+
+/* Layout of Source Language Data Types */
+
+#undef SIZE_TYPE
+#define SIZE_TYPE (TARGET_LARGE ? "long unsigned int" : "unsigned int")
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE (TARGET_LARGE ? "long int" : "int")
+#undef WCHAR_TYPE
+#define WCHAR_TYPE "long int"
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE BITS_PER_WORD
+#define FUNCTION_MODE HImode
+#define CASE_VECTOR_MODE Pmode
+#define HAS_LONG_COND_BRANCH 0
+#define HAS_LONG_UNCOND_BRANCH 0
+
+#define LOAD_EXTEND_OP(M) ZERO_EXTEND
+/*#define WORD_REGISTER_OPERATIONS 1*/
+
+#define MOVE_MAX 8
+#define STARTING_FRAME_OFFSET 0
+
+#define INCOMING_RETURN_ADDR_RTX \
+ msp430_incoming_return_addr_rtx ()
+
+#define RETURN_ADDR_RTX(COUNT, FA) \
+ msp430_return_addr_rtx (COUNT)
+
+#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+
+#define SLOW_BYTE_ACCESS 0
+
+
+/* Register Usage */
+
+/* gas doesn't recognize PC (R0), SP (R1), and SR (R2) as register
+ names. */
+#define REGISTER_NAMES \
+{ \
+ "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", \
+ "R8", "R9", "R10", "R11", "R12", "R13", "R14", "R15", \
+ "argptr" \
+}
+
+enum reg_class
+{
+ NO_REGS,
+ R12_REGS,
+ R13_REGS,
+ GEN_REGS,
+ ALL_REGS,
+ LIM_REG_CLASSES
+};
+
+#define REG_CLASS_NAMES \
+{ \
+ "NO_REGS", \
+ "R12_REGS", \
+ "R13_REGS", \
+ "GEN_REGS", \
+ "ALL_REGS" \
+}
+
+#define REG_CLASS_CONTENTS \
+{ \
+ 0x00000000, \
+ 0x00001000, \
+ 0x00002000, \
+ 0x0000fff2, \
+ 0x0001ffff \
+}
+
+#define GENERAL_REGS GEN_REGS
+#define BASE_REG_CLASS GEN_REGS
+#define INDEX_REG_CLASS GEN_REGS
+#define N_REG_CLASSES (int) LIM_REG_CLASSES
+
+#define PC_REGNUM 0
+#define STACK_POINTER_REGNUM 1
+#define CC_REGNUM 2
+#define FRAME_POINTER_REGNUM 4 /* not usually used, call preserved */
+#define ARG_POINTER_REGNUM 16
+#define STATIC_CHAIN_REGNUM 5 /* FIXME */
+
+#define FIRST_PSEUDO_REGISTER 17
+
+#define REGNO_REG_CLASS(REGNO) ((REGNO) < 17 \
+ ? GEN_REGS : NO_REGS)
+
+#define TRAMPOLINE_SIZE 4 /* FIXME */
+#define TRAMPOLINE_ALIGNMENT 16 /* FIXME */
+
+#define ELIMINABLE_REGS \
+{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
+ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM }, \
+ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }}
+
+#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
+ (OFFSET) = msp430_initial_elimination_offset ((FROM), (TO))
+
+
+#define FUNCTION_ARG_REGNO_P(N) ((N) >= 8 && (N) < ARG_POINTER_REGNUM)
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* 1 == register can't be used by gcc, in general
+ 0 == register can be used by gcc, in general */
+#define FIXED_REGISTERS \
+{ \
+ 1,0,1,1, 0,0,0,0, \
+ 0,0,0,0, 0,0,0,0, \
+ 1, \
+}
+
+/* 1 == value changes across function calls
+ 0 == value is the same after a call */
+/* R4 through R10 are callee-saved */
+#define CALL_USED_REGISTERS \
+{ \
+ 1,0,1,1, 0,0,0,0, \
+ 0,0,0,1, 1,1,1,1, \
+ 1, \
+}
+
+#define REG_ALLOC_ORDER \
+ { 12, 13, 14, 15, 10, 9, 8, 7, 6, 5, 4, 11, 0, 1, 2, 3, 16 }
+/* { 11, 15, 14, 13, 12, 10, 9, 8, 7, 6, 5, 4, 0, 1, 2, 3, 16 }*/
+
+#define REGNO_OK_FOR_BASE_P(regno) 1
+#define REGNO_OK_FOR_INDEX_P(regno) 1
+
+
+
+typedef struct
+{
+ /* These two are the current argument status. */
+ char reg_used[4];
+#define CA_FIRST_REG 12
+ char can_split;
+ /* These two are temporaries used internally. */
+ char start_reg;
+ char reg_count;
+ char mem_count;
+ char special_p;
+} CUMULATIVE_ARGS;
+
+#define INIT_CUMULATIVE_ARGS(CA, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
+ msp430_init_cumulative_args (&CA, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS)
+
+
+/* FIXME */
+#define NO_PROFILE_COUNTERS 1
+#define PROFILE_BEFORE_PROLOGUE 1
+
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ fprintf (FILE, "\tcall\t__mcount\n");
+
+#define HARD_REGNO_NREGS(REGNO, MODE) \
+ msp430_hard_regno_nregs (REGNO, MODE)
+
+#define HARD_REGNO_MODE_OK(REGNO, MODE) \
+ msp430_hard_regno_mode_ok (REGNO, MODE)
+
+#define MODES_TIEABLE_P(MODE1, MODE2) \
+ msp430_modes_tieable_p (MODE1, MODE2)
+
+/* Exception Handling */
+
+/* R12,R13,R14 - EH data
+ R15 - stack adjustment */
+
+#define EH_RETURN_DATA_REGNO(N) \
+ (((N) < 3) ? ((N) + 12) : INVALID_REGNUM)
+
+#define EH_RETURN_HANDLER_RTX \
+ gen_rtx_MEM(Pmode, gen_rtx_PLUS (Pmode, gen_rtx_REG(Pmode, SP_REGNO), gen_rtx_REG (Pmode, 15)))
+
+#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 15)
+
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_udata4
+
+
+/* Stack Layout and Calling Conventions */
+
+
+/* Addressing Modes */
+
+
+
+#define TEXT_SECTION_ASM_OP ".text"
+#define DATA_SECTION_ASM_OP ".data"
+#define BSS_SECTION_ASM_OP "\t.section .bss"
+
+#define ASM_COMMENT_START " ;"
+#define ASM_APP_ON ""
+#define ASM_APP_OFF ""
+#define LOCAL_LABEL_PREFIX ".L"
+#undef USER_LABEL_PREFIX
+#define USER_LABEL_PREFIX ""
+
+#define GLOBAL_ASM_OP "\t.global\t"
+
+#define ASM_OUTPUT_LABELREF(FILE, SYM) msp430_output_labelref ((FILE), (SYM))
+
+#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
+ fprintf (FILE, "\t.long .L%d\n", VALUE)
+
+/* This is how to output an element of a case-vector that is relative.
+ Note: The local label referenced by the "3b" below is emitted by
+ the tablejump insn. */
+
+#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
+ fprintf (FILE, "\t.long .L%d - 1b\n", VALUE)
+
+
+#define ASM_OUTPUT_ALIGN(STREAM, LOG) \
+ do \
+ { \
+ if ((LOG) == 0) \
+ break; \
+ fprintf (STREAM, "\t.balign %d\n", 1 << (LOG)); \
+ } \
+ while (0)
+
+#define JUMP_TABLES_IN_TEXT_SECTION 1
+
+#undef DWARF2_ADDR_SIZE
+#define DWARF2_ADDR_SIZE 4
+
+#define INCOMING_FRAME_SP_OFFSET (POINTER_SIZE / BITS_PER_UNIT)
+
+#undef PREFERRED_DEBUGGING_TYPE
+#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
+
+#define DWARF2_ASM_LINE_DEBUG_INFO 1
+
+/* Prevent reload (and others) from choosing HImode stack slots
+ when spilling hard registers when they may contain PSImode values. */
+#define HARD_REGNO_CALLER_SAVE_MODE(REGNO,NREGS,MODE) \
+ ((TARGET_LARGE && ((NREGS) <= 2)) ? PSImode : choose_hard_reg_mode ((REGNO), (NREGS), false))
+
+/* Also stop GCC from thinking that it can eliminate (SUBREG:PSI (SI)). */
+#define CANNOT_CHANGE_MODE_CLASS(FROM,TO,CLASS) \
+ ( ((TO) == PSImode && (FROM) == SImode) \
+ || ((TO) == SImode && (FROM) == PSImode) \
+ || ((TO) == DImode && (FROM) == PSImode) \
+ || ((TO) == PSImode && (FROM) == DImode) \
+ )
+
+#define ACCUMULATE_OUTGOING_ARGS 1
+
+#undef ASM_DECLARE_FUNCTION_NAME
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+ msp430_start_function ((FILE), (NAME), (DECL))
diff --git a/gcc/config/msp430/msp430.md b/gcc/config/msp430/msp430.md
new file mode 100644
index 00000000000..22a3953bf97
--- /dev/null
+++ b/gcc/config/msp430/msp430.md
@@ -0,0 +1,1311 @@
+;; Machine Description for TI MSP43* processors
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Contributed by Red Hat.
+
+;; 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_constants
+ [
+ (PC_REGNO 0)
+ (SP_REGNO 1)
+ (CARRY 2)
+ ])
+
+(define_c_enum "unspec"
+ [
+ UNS_PROLOGUE_START_MARKER
+ UNS_PROLOGUE_END_MARKER
+ UNS_EPILOGUE_START_MARKER
+ UNS_EPILOGUE_HELPER
+
+ UNS_PUSHM
+ UNS_POPM
+
+ UNS_GROW_AND_SWAP
+ UNS_SWAP_AND_SHRINK
+
+ UNS_DINT
+ UNS_EINT
+ UNS_PUSH_INTR
+ UNS_POP_INTR
+ UNS_BIC_SR
+ UNS_BIS_SR
+ ])
+
+(include "predicates.md")
+(include "constraints.md")
+
+(define_mode_iterator QHI [QI HI PSI])
+
+;; There are two basic "family" tests we do here:
+;;
+;; msp430x - true if 430X instructions are available.
+;; TARGET_LARGE - true if pointers are 20-bits
+;;
+;; Note that there are three supported cases, since the base 430
+;; doesn't have 20-bit pointers:
+;;
+;; 1. MSP430 cpu, small model
+;; 2. MSP430X cpu, small model.
+;; 3. MSP430X cpu, large model.
+
+;;------------------------------------------------------------
+;; Moves
+
+;; Push/Pop must be before the generic move patterns
+
+(define_insn "push"
+ [(set (mem:HI (pre_dec:HI (reg:HI SP_REGNO)))
+ (match_operand:HI 0 "register_operand" "r"))]
+ ""
+ "PUSH\t%0"
+ )
+
+(define_insn "pusha"
+ [(set (mem:PSI (pre_dec:PSI (reg:PSI SP_REGNO)))
+ (match_operand:PSI 0 "register_operand" "r"))]
+ "TARGET_LARGE"
+ "PUSHX.A\t%0"
+ )
+
+(define_insn "pushm"
+ [(unspec_volatile [(match_operand 0 "register_operand" "r")
+ (match_operand 1 "immediate_operand" "n")] UNS_PUSHM)]
+ ""
+ "PUSHM%B0\t%1, %0"
+ )
+
+(define_insn "pop"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (mem:HI (post_inc:HI (reg:HI SP_REGNO))))]
+ ""
+ "POP\t%0"
+ )
+
+(define_insn "popa"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (mem:PSI (post_inc:PSI (reg:PSI SP_REGNO))))]
+ "TARGET_LARGE"
+ "POPX.A\t%0"
+ )
+
+;; This is nasty. Operand0 is bogus. It is only there so that we can get a
+;; mode for the %B0 to work. We should use operand1 for this, but that does
+;; not have a mode.
+;;
+;; Operand1 is actually a register, but we cannot accept (REG...) because the
+;; cprop_hardreg pass can and will renumber registers even inside
+;; unspec_volatiles. So we take an integer register number parameter and
+;; fudge it to be a register name when we generate the assembler. We use %I
+;; because that is the only operator that will omit the # prefix to an
+;; integer value. Unfortunately it also inverts the integer value, so we
+;; have pre-invert it when generating this insn. (We could of course add a
+;; new operator, eg %D, just for this pattern...)
+;;
+;; The pushm pattern does not have this problem because of all of the
+;; frame info cruft attached to it, so cprop_hardreg leaves it alone.
+(define_insn "popm"
+ [(unspec_volatile [(match_operand 0 "register_operand" "r")
+ (match_operand 1 "immediate_operand" "i")
+ (match_operand 2 "immediate_operand" "i")] UNS_POPM)]
+ ""
+ "POPM%B0\t%2, r%I1"
+ )
+
+;; The next two patterns are here to support a "feature" of how GCC implements
+;; varargs. When a function uses varargs and the *second* to last named
+;; argument is split between argument registers and the stack, gcc expects the
+;; callee to allocate space on the stack that can contain the register-based
+;; part of the argument. This space *has* to be just before the remaining
+;; arguments (ie the ones that are fully on the stack).
+;;
+;; The problem is that the MSP430 CALL instruction pushes the return address
+;; onto the stack in the exact place where the callee wants to allocate
+;; this extra space. So we need a sequence of instructions that can allocate
+;; the extra space and then move the return address down the stack, so that
+;; the extra space is now adjacent to the remaining arguments.
+;;
+;; This could be constructed through regular insns, but they might be split up
+;; by a misguided optimization, so an unspec volatile is used instead.
+
+(define_insn "grow_and_swap"
+ [(unspec_volatile [(const_int 0)] UNS_GROW_AND_SWAP)]
+ ""
+ { if (TARGET_LARGE)
+ return "SUBA\t#2, r1 \n MOVX.A\t2(r1), 0(r1)";
+ return "SUB\t#2, r1 \n MOV.W\t2(r1), 0(r1)";
+ }
+ )
+
+(define_insn "swap_and_shrink"
+ [(unspec_volatile [(const_int 0)] UNS_SWAP_AND_SHRINK)]
+ ""
+ { return TARGET_LARGE
+ ? "MOVX.A\t0(r1), 2(r1) \n ADDA\t#2, SP"
+ : "MOV.W\t0(r1), 2(r1) \n ADD\t#2, SP";
+ })
+
+; I set LOAD_EXTEND_OP and WORD_REGISTER_OPERATIONS, but gcc puts in a
+; zero_extend anyway. Catch it here.
+(define_insn "movqihi"
+ [(set (match_operand:HI 0 "register_operand" "=r,r")
+ (zero_extend:HI (match_operand:QI 1 "memory_operand" "Ys,m")))]
+ ""
+ "@
+ MOV.B\t%1, %0
+ MOV%X1.B\t%1, %0"
+)
+
+(define_insn "movqi"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=rYs,rm")
+ (match_operand:QI 1 "general_operand" "riYs,rmi"))]
+ ""
+ "@
+ MOV.B\t%1, %0
+ MOV%X0.B\t%1, %0"
+)
+
+(define_insn "movhi"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rYs,rm")
+ (match_operand:HI 1 "general_operand" "riYs,rmi"))]
+ ""
+ "@
+ MOV.W\t%1, %0
+ MOV%X0.W\t%1, %0"
+)
+
+(define_expand "movsi"
+ [(set (match_operand:SI 0 "nonimmediate_operand")
+ (match_operand:SI 1 "general_operand"))]
+ ""
+ ""
+ )
+
+(define_insn_and_split "movsi_x"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (match_operand:SI 1 "general_operand" "rmi"))]
+ ""
+ "#"
+ "reload_completed"
+ [(set (match_operand:HI 2 "nonimmediate_operand")
+ (match_operand:HI 4 "general_operand"))
+ (set (match_operand:HI 3 "nonimmediate_operand")
+ (match_operand:HI 5 "general_operand"))]
+ "msp430_split_movsi (operands);"
+)
+
+;; Some MOVX.A cases can be done with MOVA, this is only a few of them.
+(define_insn "movpsi"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r,Ya,rm")
+ (match_operand:PSI 1 "general_operand" "riYa,r,rmi"))]
+ ""
+ "@
+ MOV%A0\t%1, %0
+ MOV%A0\t%1, %0
+ MOV%X0.%A0\t%1, %0")
+
+; This pattern is identical to the truncsipsi2 pattern except
+; that it uses a SUBREG instead of a TRUNC. It is needed in
+; order to prevent reload from converting (set:SI (SUBREG:PSI (SI)))
+; into (SET:PSI (PSI)).
+;
+; Note: using POPM.A #1 is two bytes smaller than using POPX.A....
+
+(define_insn "movsipsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (subreg:PSI (match_operand:SI 1 "register_operand" "r") 0))]
+ "TARGET_LARGE"
+ "PUSH.W\t%H1 { PUSH.W %L1 { POPM.A #1, %0 ; Move reg-pair %L1:%H1 into pointer %0"
+)
+
+;;------------------------------------------------------------
+;; Math
+
+(define_insn "addpsi3"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r,rm")
+ (plus:PSI (match_operand:PSI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:PSI 2 "general_operand" "rLs,rmi")))]
+ ""
+ "@
+ ADDA\t%2, %0
+ ADDX.A\t%2, %0"
+)
+
+(define_insn "addqi3"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=rYs,rm")
+ (plus:QI (match_operand:QI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:QI 2 "general_operand" "riYs,rmi")))]
+ ""
+ "@
+ ADD.B\t%2, %0
+ ADD%X0.B\t%2, %0"
+)
+
+(define_insn "addhi3"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rYs,rm")
+ (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:HI 2 "general_operand" "riYs,rmi")))]
+ ""
+ "@
+ ADD.W\t%2, %0
+ ADD%X0.W\t%2, %0"
+)
+
+; This pattern is needed in order to avoid reload problems.
+; It takes an SI pair of registers, adds a value to them, and
+; then converts them into a single PSI register.
+
+(define_insn "addsipsi3"
+ [(set (subreg:SI (match_operand:PSI 0 "register_operand" "=&r") 0)
+ (plus:SI (match_operand:SI 1 "register_operand" "0")
+ (match_operand 2 "general_operand" "rmi")))]
+ ""
+ "ADD.W\t%L2, %L0 { ADDC.W\t%H2, %H0 { PUSH.W %H0 { PUSH.W %L0 { POPM.A #1, %0"
+)
+
+(define_insn "addsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=&r,rm")
+ (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:SI 2 "general_operand" "r,mi")))]
+ ""
+ "@
+ ADD\t%L2, %L0 { ADDC\t%H2, %H0
+ ADD%X0\t%L2, %L0 { ADDC%X0\t%H2, %H0"
+)
+
+; Version of addhi that exposes the carry operations, for SImode adds.
+;
+; NOTE - we are playing a dangerous game with GCC here. We have these two
+; add patterns and the splitter that follows because our tests have shown
+; that this results in a significant reduction in code size - because GCC is
+; able to discard any unused part of the addition. We have to annotate the
+; patterns with the set and use of the carry flag because otherwise GCC will
+; discard parts of the addition when they are actually needed. But we have
+; not annotated all the other patterns that set the CARRY flag as doing so
+; results in an overall increase in code size[1]. Instead we just *hope*
+; that GCC will not move a carry-setting instruction in between the first
+; and second adds.
+;
+; So far our experiments have shown that GCC is likely to move MOV and CMP
+; instructions in between the two adds, but not other instructions. MOV is
+; safe, CMP is not. So we have annotated the CMP patterns and left the
+; subtract, shift and other add patterns alone. At the moment this is
+; working, but with future changes to the generic parts of GCC that might
+; change.
+;
+; [1] It is not clear exactly why the code size increases. The cause appears
+; to be that reload is more prevelent to spilling a variable onto the stack
+; but why it does this is unknown. Possibly the additional CLOBBERs necessary
+; to correctly annotate the other patterns makes reload think that there is
+; increased register pressure. Or possibly reload does not handle ADD patterns
+; that are not single_set() very well.
+
+(define_insn "addhi3_cy"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
+ (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:HI 2 "general_operand" "r,rm")))
+ (set (reg:BI CARRY)
+ (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1))
+ (zero_extend:SI (match_dup 2)))
+ (const_int 16))))
+ ]
+ ""
+ "@
+ ADD\t%2, %1 ; cy
+ ADD%X0\t%2, %1 ; cy"
+ )
+
+(define_insn "addhi3_cy_i"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
+ (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:HI 2 "general_operand" "i,i")))
+ (set (reg:BI CARRY)
+ (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 1))
+ (match_operand 3 "immediate_operand" "i,i"))
+ (const_int 16))))
+ ]
+ ""
+ "@
+ ADD\t%2, %1 ; cy
+ ADD%X0\t%2, %1 ; cy"
+ )
+
+; Version of addhi that adds the carry, for SImode adds.
+(define_insn "addchi4_cy"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=r,rm")
+ (plus:HI (plus:HI (match_operand:HI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:HI 2 "general_operand" "ri,rmi"))
+ (zero_extend:HI (reg:BI CARRY))))
+ ]
+ ""
+ "@
+ ADDC\t%2, %1
+ ADDC%X0\t%2, %1"
+ )
+
+; Split an SImode add into two HImode adds, keeping track of the carry
+; so that gcc knows when it can and can't optimize away the two
+; halves.
+(define_split
+ [(set (match_operand:SI 0 "msp430_nonsubreg_operand" "=&rm")
+ (plus:SI (match_operand:SI 1 "nonimmediate_operand" "%0")
+ (match_operand:SI 2 "general_operand" "rmi")))
+ ]
+ ""
+ [(parallel [(set (match_operand:HI 3 "nonimmediate_operand" "=&rm")
+ (plus:HI (match_dup 4)
+ (match_dup 5)))
+ (set (reg:BI CARRY)
+ (truncate:BI (lshiftrt:SI (plus:SI (zero_extend:SI (match_dup 4))
+ (match_dup 9))
+ (const_int 16))))
+ ])
+ (set (match_operand:HI 6 "nonimmediate_operand" "=&rm")
+ (plus:HI (plus:HI (match_dup 7)
+ (match_dup 8))
+ (zero_extend:HI (reg:BI CARRY))))
+ ]
+ "
+ operands[3] = msp430_subreg (HImode, operands[0], SImode, 0);
+ operands[4] = msp430_subreg (HImode, operands[1], SImode, 0);
+ operands[5] = msp430_subreg (HImode, operands[2], SImode, 0);
+ operands[6] = msp430_subreg (HImode, operands[0], SImode, 2);
+ operands[7] = msp430_subreg (HImode, operands[1], SImode, 2);
+ operands[8] = msp430_subreg (HImode, operands[2], SImode, 2);
+ if (GET_CODE (operands[5]) == CONST_INT)
+ {
+ operands[9] = GEN_INT (INTVAL (operands[5]) & 0xffff);
+ }
+ else
+ {
+ operands[9] = gen_rtx_ZERO_EXTEND (SImode, operands[5]);
+ }
+ "
+ )
+
+
+;; Alternatives 2 and 3 are to handle cases generated by reload.
+(define_insn "subpsi3"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r, rm, &?r, ?&r")
+ (minus:PSI (match_operand:PSI 1 "general_operand" "0, 0, !r, !i")
+ (match_operand:PSI 2 "general_operand" "rLs, rmi, rmi, r")))]
+ ""
+ "@
+ SUBA\t%2, %0
+ SUBX.A\t%2, %0
+ MOVX.A\t%1, %0 { SUBX.A\t%2, %0
+ MOVX.A\t%1, %0 { SUBA\t%2, %0"
+)
+
+;; Alternatives 2 and 3 are to handle cases generated by reload.
+(define_insn "subqi3"
+ [(set (match_operand:QI 0 "nonimmediate_operand" "=rYs, rm, &?r, ?&r")
+ (minus:QI (match_operand:QI 1 "general_operand" "0, 0, !r, !i")
+ (match_operand:QI 2 "general_operand" " riYs, rmi, rmi, r")))]
+ ""
+ "@
+ SUB.B\t%2, %0
+ SUB%X0.B\t%2, %0
+ MOV%X0.B\t%1, %0 { SUB%X0.B\t%2, %0
+ MOV%X0.B\t%1, %0 { SUB%X0.B\t%2, %0"
+)
+
+;; Alternatives 2 and 3 are to handle cases generated by reload.
+(define_insn "subhi3"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rYs, rm, &?r, ?&r")
+ (minus:HI (match_operand:HI 1 "general_operand" "0, 0, !r, !i")
+ (match_operand:HI 2 "general_operand" " riYs, rmi, rmi, r")))]
+ ""
+ "@
+ SUB.W\t%2, %0
+ SUB%X0.W\t%2, %0
+ MOV%X0.W\t%1, %0 { SUB%X0.W\t%2, %0
+ MOV%X0.W\t%1, %0 { SUB%X0.W\t%2, %0"
+)
+
+(define_insn "subsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=&rm")
+ (minus:SI (match_operand:SI 1 "nonimmediate_operand" "0")
+ (match_operand:SI 2 "general_operand" "rmi")))]
+ ""
+ "SUB%X0\t%L2, %L0 { SUBC%X0\t%H2, %H0"
+)
+
+(define_insn "*bic<mode>_cg"
+ [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,m")
+ (and:QHI (match_operand:QHI 1 "msp_general_operand" "0,0")
+ (match_operand 2 "msp430_inv_constgen_operator" "n,n")))]
+ ""
+ "@
+ BIC%x0%B0\t#%I2, %0
+ BIC%X0%B0\t#%I2, %0"
+)
+
+(define_insn "bic<mode>3"
+ [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,rm")
+ (and:QHI (not:QHI (match_operand:QHI 1 "msp_general_operand" "rYs,rmn"))
+ (match_operand:QHI 2 "msp_nonimmediate_operand" "0,0")))]
+ ""
+ "@
+ BIC%x0%B0\t%1, %0
+ BIC%X0%B0\t%1, %0"
+)
+
+(define_insn "and<mode>3"
+ [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,rm")
+ (and:QHI (match_operand:QHI 1 "msp_nonimmediate_operand" "%0,0")
+ (match_operand:QHI 2 "msp_general_operand" "riYs,rmi")))]
+ ""
+ "@
+ AND%x0%B0\t%2, %0
+ AND%X0%B0\t%2, %0"
+)
+
+(define_insn "ior<mode>3"
+ [(set (match_operand:QHI 0 "msp_nonimmediate_operand" "=rYs,rm")
+ (ior:QHI (match_operand:QHI 1 "msp_nonimmediate_operand" "%0,0")
+ (match_operand:QHI 2 "msp_general_operand" "riYs,rmi")))]
+ ""
+ "@
+ BIS%x0%B0\t%2, %0
+ BIS%X0%B0\t%2, %0"
+)
+
+(define_insn "xor<mode>3"
+ [(set (match_operand:QHI 0 "nonimmediate_operand" "=rYs,rm")
+ (xor:QHI (match_operand:QHI 1 "nonimmediate_operand" "%0,0")
+ (match_operand:QHI 2 "general_operand" "riYs,rmi")))]
+ ""
+ "@
+ XOR%x0%B0\t%2, %0
+ XOR%X0%B0\t%2, %0"
+)
+
+;; Macro : XOR #~0, %0
+(define_insn "one_cmpl<mode>2"
+ [(set (match_operand:QHI 0 "nonimmediate_operand" "=rYs,m")
+ (not:QHI (match_operand:QHI 1 "nonimmediate_operand" "0,0")))]
+ ""
+ "@
+ INV%x0%B0\t%0
+ INV%X0%B0\t%0"
+)
+
+(define_insn "extendqihi2"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rYs,m")
+ (sign_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
+ ""
+ "@
+ SXT%X0\t%0
+ SXT%X0\t%0"
+)
+
+(define_insn "zero_extendqihi2"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rYs,m")
+ (zero_extend:HI (match_operand:QI 1 "nonimmediate_operand" "0,0")))]
+ ""
+ "@
+ AND\t#0xff, %0
+ AND%X0\t#0xff, %0"
+)
+
+;; Eliminate extraneous zero-extends mysteriously created by gcc.
+(define_peephole2
+ [(set (match_operand:HI 0 "register_operand")
+ (zero_extend:HI (match_operand:QI 1 "general_operand")))
+ (set (match_operand:HI 2 "register_operand")
+ (zero_extend:HI (match_operand:QI 3 "register_operand")))]
+ "REGNO (operands[0]) == REGNO (operands[2]) && REGNO (operands[2]) == REGNO (operands[3])"
+ [(set (match_dup 0)
+ (zero_extend:HI (match_dup 1)))]
+)
+
+(define_insn "zero_extendhipsi2"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r,m")
+ (zero_extend:PSI (match_operand:HI 1 "nonimmediate_operand" "rm,r")))]
+ ""
+ "MOVX\t%1, %0"
+)
+
+(define_insn "truncpsihi2"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
+ (truncate:HI (match_operand:PSI 1 "register_operand" "r")))]
+ ""
+ "MOVX\t%1, %0"
+)
+
+(define_insn "extendhisi2"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
+ (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "r")))]
+ ""
+ { return msp430x_extendhisi (operands); }
+)
+
+(define_insn "extendhipsi2"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r")
+ (subreg:PSI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0")) 0))]
+ "TARGET_LARGE"
+ "RLAM #4, %0 { RRAM #4, %0"
+)
+
+;; Look for cases where integer/pointer conversions are suboptimal due
+;; to missing patterns, despite us not having opcodes for these
+;; patterns. Doing these manually allows for alternate optimization
+;; paths.
+(define_insn "zero_extendhisi2"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0")))]
+ "TARGET_LARGE"
+ "MOV.W\t#0,%H0"
+)
+
+(define_insn "zero_extendhisipsi2"
+ [(set (match_operand:PSI 0 "nonimmediate_operand" "=r,r")
+ (subreg:PSI (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r")) 0))]
+ "TARGET_LARGE"
+ "@
+ AND.W\t#-1,%0
+ MOV.W\t%1,%0"
+)
+
+(define_insn "extend_and_shift1_hipsi2"
+ [(set (subreg:SI (match_operand:PSI 0 "nonimmediate_operand" "=r") 0)
+ (ashift:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0"))
+ (const_int 1)))]
+ "TARGET_LARGE"
+ "RLAM #4, %0 { RRAM #3, %0"
+)
+
+(define_insn "extend_and_shift2_hipsi2"
+ [(set (subreg:SI (match_operand:PSI 0 "nonimmediate_operand" "=r") 0)
+ (ashift:SI (sign_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0"))
+ (const_int 2)))]
+ "TARGET_LARGE"
+ "RLAM #4, %0 { RRAM #2, %0"
+)
+
+; Nasty - we are sign-extending a 20-bit PSI value in one register into
+; two adjacent 16-bit registers to make an SI value. There is no MSP430X
+; instruction that will do this, so we push the 20-bit value onto the stack
+; and then pop it off as two 16-bit values.
+;
+; FIXME: The MSP430X documentation does not specify if zero-extension or
+; sign-extension happens when the 20-bit value is pushed onto the stack.
+; It is probably zero-extension, but if not this pattern will not work
+; when the PSI value is negative..
+;
+; Note: using PUSHM.A #1 is two bytes smaller than using PUSHX.A....
+
+(define_insn "zero_extendpsisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (zero_extend:SI (match_operand:PSI 1 "register_operand" "r")))]
+ ""
+ "*
+ if (REGNO (operands[1]) == SP_REGNO)
+ /* If the source register is the stack pointer, the value
+ stored in the stack slot will be the value *after* the
+ stack pointer has been decremented. So allow for that
+ here. */
+ return \"PUSHM.A\t#1, %1 { ADDX.W #4, @r1 { POPX.W %L0 { POPX.W %H0 ; get stack pointer into %L0:%H0\";
+ else
+ return \"PUSHM.A\t#1, %1 { POPX.W %L0 { POPX.W %H0 ; move pointer in %1 into reg-pair %L0:%H0\";
+ "
+)
+
+;; We also need to be able to sign-extend pointer types (eg ptrdiff_t).
+;; Since (we assume) pushing a 20-bit value onto the stack zero-extends
+;; it, we use a different method here.
+
+(define_insn "extendpsisi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (sign_extend:SI (match_operand:PSI 1 "register_operand" "r")))]
+ "TARGET_LARGE"
+ "*
+ /* The intention here is that we copy the bottom 16-bits of
+ %1 into %L0 (zeroing the top four bits). Then we copy the
+ entire 20-bits of %1 into %H0 and then arithmetically shift
+ it right by 16 bits, to get the top four bits of the pointer
+ sign-extended in %H0. */
+ if (REGNO (operands[0]) == REGNO (operands[1]))
+ return \"MOVX.A\t%1, %H0 { MOV.W %1, %L0 { RPT #16 { RRAX.A %H0 ; sign extend pointer in %1 into %L0:%H0\";
+ else
+ return \"MOV.W \t%1, %L0 { MOVX.A %1, %H0 { RPT #16 { RRAX.A %H0 ; sign extend pointer in %1 into %L0:%H0\";
+ "
+)
+
+; See the movsipsi2 pattern above for another way that GCC performs this
+; conversion.
+(define_insn "truncsipsi2"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (truncate:PSI (match_operand:SI 1 "register_operand" "r")))]
+ ""
+ "PUSH.W %H1 { PUSH.W %1 { POPM.A #1, %0"
+)
+
+;;------------------------------------------------------------
+;; Shift Functions
+
+;; Note: We do not use the RPT ... SHIFT instruction sequence
+;; when the repeat count is in a register, because even though RPT
+;; accepts counts in registers, it does not work if the count is
+;; zero, and the actual count in the register has to be one less
+;; than the required number of iterations. We could encode a
+;; seqeunce like this:
+;;
+;; bit #0xf, Rn
+;; bz 1f
+;; dec Rn
+;; rpt Rn
+;; <shift> Rm
+;; inc Rn
+;; 1:
+;;
+;; But is longer than calling a helper function, and we are mostly
+;; concerned with code size. FIXME: Maybe enable a sequence like
+;; this at -O3 and above ?
+;;
+;; Note - we ignore shift counts of less than one or more than 15.
+;; This is permitted by the ISO C99 standard as such shifts result
+;; in "undefined" behaviour. [6.5.7 (3)]
+
+;; signed A << C
+
+(define_expand "ashlhi3"
+ [(set (match_operand:HI 0 "nonimmediate_operand")
+ (ashift:HI (match_operand:HI 1 "general_operand")
+ (match_operand:HI 2 "general_operand")))]
+ ""
+ {
+ if (msp430x
+ && REG_P (operands[0])
+ && REG_P (operands[1])
+ && CONST_INT_P (operands[2]))
+ emit_insn (gen_430x_shift_left (operands[0], operands[1], operands[2]));
+ else
+ msp430_expand_helper (operands, \"__mspabi_slli\", true);
+ DONE;
+ }
+)
+
+(define_insn "slli_1"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
+ (ashift:HI (match_operand:HI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "RLA.W\t%0" ;; Note - this is a macro for ADD
+)
+
+(define_insn "430x_shift_left"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (ashift:HI (match_operand:HI 1 "register_operand" "0")
+ (match_operand 2 "immediate_operand" "n")))]
+ "msp430x"
+ "*
+ if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 16)
+ return \"rpt\t%2 { rlax.w\t%0\";
+ return \"# nop left shift\";
+ "
+)
+
+(define_insn "slll_1"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (ashift:SI (match_operand:SI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "RLA.W\t%L0 { RLC.W\t%H0"
+)
+
+(define_insn "slll_2"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (ashift:SI (match_operand:SI 1 "general_operand" "0")
+ (const_int 2)))]
+ ""
+ "RLA.W\t%L0 { RLC.W\t%H0 { RLA.W\t%L0 { RLC.W\t%H0"
+)
+
+(define_expand "ashlsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand")
+ (ashift:SI (match_operand:SI 1 "general_operand")
+ (match_operand:SI 2 "general_operand")))]
+ ""
+ "msp430_expand_helper (operands, \"__mspabi_slll\", true);
+ DONE;"
+)
+
+;;----------
+
+;; signed A >> C
+
+(define_expand "ashrhi3"
+ [(set (match_operand:HI 0 "nonimmediate_operand")
+ (ashiftrt:HI (match_operand:HI 1 "general_operand")
+ (match_operand:HI 2 "general_operand")))]
+ ""
+ {
+ if (msp430x
+ && REG_P (operands[0])
+ && REG_P (operands[1])
+ && CONST_INT_P (operands[2]))
+ emit_insn (gen_430x_arithmetic_shift_right (operands[0], operands[1], operands[2]));
+ else
+ msp430_expand_helper (operands, \"__mspabi_srai\", true);
+ DONE;
+ }
+)
+
+(define_insn "srai_1"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
+ (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "RRA.W\t%0"
+)
+
+(define_insn "430x_arithmetic_shift_right"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (ashiftrt:HI (match_operand:HI 1 "register_operand" "0")
+ (match_operand 2 "immediate_operand" "n")))]
+ "msp430x"
+ "*
+ if (INTVAL (operands[2]) > 0 && INTVAL (operands[2]) < 16)
+ return \"rpt\t%2 { rrax.w\t%0\";
+ return \"# nop arith right shift\";
+ "
+)
+
+(define_insn "srap_1"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (ashiftrt:PSI (match_operand:PSI 1 "general_operand" "0")
+ (const_int 1)))]
+ "msp430x"
+ "RRAM.A #1,%0"
+)
+
+(define_insn "srap_2"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (ashiftrt:PSI (match_operand:PSI 1 "general_operand" "0")
+ (const_int 2)))]
+ "msp430x"
+ "RRAM.A #2,%0"
+)
+
+(define_insn "sral_1"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "RRA.W\t%H0 { RRC.W\t%L0"
+)
+
+(define_insn "sral_2"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
+ (const_int 2)))]
+ ""
+ "RRA.W\t%H0 { RRC.W\t%L0 { RRA.W\t%H0 { RRC.W\t%L0"
+)
+
+(define_expand "ashrsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand")
+ (ashiftrt:SI (match_operand:SI 1 "general_operand")
+ (match_operand:SI 2 "general_operand")))]
+ ""
+ "msp430_expand_helper (operands, \"__mspabi_sral\", true);
+ DONE;"
+)
+
+;;----------
+
+;; unsigned A >> C
+
+(define_expand "lshrhi3"
+ [(set (match_operand:HI 0 "nonimmediate_operand")
+ (lshiftrt:HI (match_operand:HI 1 "general_operand")
+ (match_operand:HI 2 "general_operand")))]
+ ""
+ {
+ if (msp430x
+ && REG_P (operands[0])
+ && REG_P (operands[1])
+ && CONST_INT_P (operands[2]))
+ emit_insn (gen_430x_logical_shift_right (operands[0], operands[1], operands[2]));
+ else
+ msp430_expand_helper (operands, \"__mspabi_srli\", true);
+ DONE;
+ }
+)
+
+(define_insn "srli_1"
+ [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
+ (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "CLRC { RRC.W\t%0"
+)
+
+(define_insn "430x_logical_shift_right"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (lshiftrt:HI (match_operand:HI 1 "register_operand" "0")
+ (match_operand 2 "immediate_operand" "n")))]
+ "msp430x"
+ {
+ return msp430x_logical_shift_right (operands[2]);
+ }
+)
+
+(define_insn "srlp_1"
+ [(set (match_operand:PSI 0 "register_operand" "=r")
+ (lshiftrt:PSI (match_operand:PSI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "RRUM.A #1,%0"
+)
+
+(define_insn "srll_1"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
+ (const_int 1)))]
+ ""
+ "CLRC { RRC.W\t%H0 { RRC.W\t%L0"
+)
+
+(define_insn "srll_2x"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=r")
+ (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
+ (const_int 2)))]
+ "msp430x"
+ "RRUX.W\t%H0 { RRC.W\t%L0 { RRUX.W\t%H0 { RRC.W\t%L0"
+)
+
+(define_expand "lshrsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand")
+ (lshiftrt:SI (match_operand:SI 1 "general_operand")
+ (match_operand:SI 2 "general_operand")))]
+ ""
+ "msp430_expand_helper (operands, \"__mspabi_srll\", true);
+ DONE;"
+)
+
+;;------------------------------------------------------------
+;; Function Entry/Exit
+
+(define_expand "prologue"
+ [(const_int 0)]
+ ""
+ "msp430_expand_prologue (); DONE;"
+ )
+
+(define_expand "epilogue"
+ [(const_int 0)]
+ ""
+ "msp430_expand_epilogue (0); DONE;"
+ )
+
+
+(define_insn "epilogue_helper"
+ [(unspec_volatile [(match_operand 0 "immediate_operand" "i")] UNS_EPILOGUE_HELPER)]
+ ""
+ "BR%A0\t#__mspabi_func_epilog_%D0"
+ )
+
+
+(define_insn "prologue_start_marker"
+ [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_START_MARKER)]
+ ""
+ "; start of prologue"
+ )
+
+(define_insn "prologue_end_marker"
+ [(unspec_volatile [(const_int 0)] UNS_PROLOGUE_END_MARKER)]
+ ""
+ "; end of prologue"
+ )
+
+(define_insn "epilogue_start_marker"
+ [(unspec_volatile [(const_int 0)] UNS_EPILOGUE_START_MARKER)]
+ ""
+ "; start of epilogue"
+ )
+
+;;------------------------------------------------------------
+;; Jumps
+
+(define_expand "call"
+ [(call:HI (match_operand 0 "")
+ (match_operand 1 ""))]
+ ""
+ ""
+)
+
+(define_insn "call_internal"
+ [(call (mem:HI (match_operand 0 "general_operand" "rmi"))
+ (match_operand 1 ""))]
+ ""
+ "CALL%A0\t%0"
+)
+
+(define_expand "call_value"
+ [(set (match_operand 0 "register_operand")
+ (call:HI (match_operand 1 "general_operand")
+ (match_operand 2 "")))]
+ ""
+ ""
+)
+
+(define_insn "call_value_internal"
+ [(set (match_operand 0 "register_operand" "=r")
+ (call (mem:HI (match_operand 1 "general_operand" "rmi"))
+ (match_operand 2 "")))]
+ ""
+ "CALL%A0\t%1"
+)
+
+(define_insn "msp_return"
+ [(return)]
+ ""
+ { return msp430_is_interrupt_func () ? "RETI" : (TARGET_LARGE ? "RETA" : "RET"); }
+)
+
+;; This pattern is NOT, as expected, a return pattern. It's called
+;; before reload and must only store its operands, and emit a
+;; placeholder where the epilog needs to be. AFTER reload, the
+;; placeholder should get expanded into a regular-type epilogue that
+;; also does the EH return.
+(define_expand "eh_return"
+ [(match_operand:HI 0 "")]
+ ""
+ "msp430_expand_eh_return (operands[0]);
+ emit_jump_insn (gen_msp430_eh_epilogue ());
+ emit_barrier ();
+ DONE;"
+)
+
+;; This is the actual EH epilogue. We emit it in the pattern above,
+;; before reload, and convert it to a real epilogue after reload.
+(define_insn_and_split "msp430_eh_epilogue"
+ [(eh_return)]
+ ""
+ "#"
+ "reload_completed"
+ [(const_int 0)]
+ "msp430_expand_epilogue (1); DONE;"
+ )
+
+(define_insn "jump"
+ [(set (pc)
+ (label_ref (match_operand 0 "" "")))]
+ ""
+ "BR%A0\t#%l0"
+)
+
+;; FIXME: GCC currently (8/feb/2013) cannot handle symbol_refs
+;; in indirect jumps (cf gcc.c-torture/compile/991213-3.c).
+(define_insn "indirect_jump"
+ [(set (pc)
+ (match_operand 0 "nonimmediate_operand" "rYl"))]
+ ""
+ "BR%A0\t%0"
+)
+
+;;------------------------------------------------------------
+;; Various Conditionals
+
+(define_expand "cbranch<mode>4"
+ [(parallel [(set (pc) (if_then_else
+ (match_operator 0 ""
+ [(match_operand:QHI 1 "nonimmediate_operand")
+ (match_operand:QHI 2 "general_operand")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))]
+ )]
+ ""
+ "msp430_fixup_compare_operands (<MODE>mode, operands);"
+ )
+
+(define_insn "cbranchpsi4_real"
+ [(set (pc) (if_then_else
+ (match_operator 0 "msp430_cmp_operator"
+ [(match_operand:PSI 1 "nonimmediate_operand" "r,rYs,rm")
+ (match_operand:PSI 2 "general_operand" "rLs,rYsi,rmi")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ CMP%A0\t%2, %1 { J%0\t%l3
+ CMPX.A\t%2, %1 { J%0\t%l3
+ CMPX.A\t%2, %1 { J%0\t%l3"
+ )
+
+(define_insn "cbranchqi4_real"
+ [(set (pc) (if_then_else
+ (match_operator 0 "msp430_cmp_operator"
+ [(match_operand:QI 1 "nonimmediate_operand" "rYs,rm")
+ (match_operand:QI 2 "general_operand" "rYsi,rmi")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ CMP.B\t%2, %1 { J%0\t%l3
+ CMP%X0.B\t%2, %1 { J%0\t%l3"
+ )
+
+(define_insn "cbranchhi4_real"
+ [(set (pc) (if_then_else
+ (match_operator 0 "msp430_cmp_operator"
+ [(match_operand:HI 1 "nonimmediate_operand" "rYs,rm")
+ (match_operand:HI 2 "general_operand" "rYsi,rmi")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ CMP.W\t%2, %1 { J%0\t%l3
+ CMP%X0.W\t%2, %1 { J%0\t%l3"
+ )
+
+(define_insn "cbranchpsi4_reversed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "msp430_reversible_cmp_operator"
+ [(match_operand:PSI 1 "general_operand" "rLs,rYsi,rmi")
+ (match_operand:PSI 2 "general_operand" "r,rYs,rm")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ CMP%A0\t%1, %2 { J%R0\t%l3
+ CMPX.A\t%1, %2 { J%R0\t%l3
+ CMPX.A\t%1, %2 { J%R0\t%l3"
+ )
+
+(define_insn "cbranchqi4_reversed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "msp430_reversible_cmp_operator"
+ [(match_operand:QI 1 "general_operand" "rYsi,rmi")
+ (match_operand:QI 2 "general_operand" "rYs,rm")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ CMP.B\t%1, %2 { J%R0\t%l3
+ CMP%X0.B\t%1, %2 { J%R0\t%l3"
+ )
+
+(define_insn "cbranchhi4_reversed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "msp430_reversible_cmp_operator"
+ [(match_operand:HI 1 "general_operand" "rYsi,rmi")
+ (match_operand:HI 2 "general_operand" "rYs,rm")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ CMP.W\t%1, %2 { J%R0\t%l3
+ CMP%X0.W\t%1, %2 { J%R0\t%l3"
+ )
+
+(define_insn "*bitbranch<mode>4"
+ [(set (pc) (if_then_else
+ (ne (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rYs,rm")
+ (match_operand:QHI 1 "msp_general_operand" "rYsi,rmi"))
+ (const_int 0))
+ (label_ref (match_operand 2 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ BIT%x0%B0\t%1, %0 { JNE\t%l2
+ BIT%X0%B0\t%1, %0 { JNE\t%l2"
+ )
+
+(define_insn "*bitbranch<mode>4"
+ [(set (pc) (if_then_else
+ (eq (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
+ (match_operand:QHI 1 "msp_general_operand" "rmi"))
+ (const_int 0))
+ (label_ref (match_operand 2 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "BIT%x0%X0%B0\t%1, %0 { JEQ\t%l2"
+ )
+
+(define_insn "*bitbranch<mode>4"
+ [(set (pc) (if_then_else
+ (eq (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
+ (match_operand:QHI 1 "msp_general_operand" "rmi"))
+ (const_int 0))
+ (pc)
+ (label_ref (match_operand 2 "" ""))))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "BIT%X0%B0\t%1, %0 { JNE\t%l2"
+ )
+
+(define_insn "*bitbranch<mode>4"
+ [(set (pc) (if_then_else
+ (ne (and:QHI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
+ (match_operand:QHI 1 "msp_general_operand" "rmi"))
+ (const_int 0))
+ (pc)
+ (label_ref (match_operand 2 "" ""))))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "BIT%X0%B0\t%1, %0 { JEQ\t%l2"
+ )
+
+;;------------------------------------------------------------
+;; zero-extract versions of the above
+
+(define_insn "*bitbranch<mode>4_z"
+ [(set (pc) (if_then_else
+ (ne (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rYs,rm")
+ (const_int 1)
+ (match_operand 1 "msp430_bitpos" "i,i"))
+ (const_int 0))
+ (label_ref (match_operand 2 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "@
+ BIT%x0%B0\t%p1, %0 { JNE\t%l2
+ BIT%X0%B0\t%p1, %0 { JNE\t%l2"
+ )
+
+(define_insn "*bitbranch<mode>4_z"
+ [(set (pc) (if_then_else
+ (eq (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
+ (const_int 1)
+ (match_operand 1 "msp430_bitpos" "i"))
+ (const_int 0))
+ (label_ref (match_operand 2 "" ""))
+ (pc)))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "BIT%x0%X0%B0\t%p1, %0 { JEQ\t%l2"
+ )
+
+(define_insn "*bitbranch<mode>4_z"
+ [(set (pc) (if_then_else
+ (eq (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
+ (const_int 1)
+ (match_operand 1 "msp430_bitpos" "i"))
+ (const_int 0))
+ (pc)
+ (label_ref (match_operand 2 "" ""))))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "BIT%X0%B0\t%p1, %0 { JNE\t%l2"
+ )
+
+(define_insn "*bitbranch<mode>4_z"
+ [(set (pc) (if_then_else
+ (ne (zero_extract:HI (match_operand:QHI 0 "msp_nonimmediate_operand" "rm")
+ (const_int 1)
+ (match_operand 1 "msp430_bitpos" "i"))
+ (const_int 0))
+ (pc)
+ (label_ref (match_operand 2 "" ""))))
+ (clobber (reg:BI CARRY))
+ ]
+ ""
+ "BIT%X0%B0\t%p1, %0 { JEQ\t%l2"
+ )
+
+;;------------------------------------------------------------
+;; Misc
+
+(define_insn "nop"
+ [(const_int 0)]
+ "1"
+ "NOP"
+)
+
+(define_insn "disable_interrupts"
+ [(unspec_volatile [(const_int 0)] UNS_DINT)]
+ ""
+ "DINT"
+ )
+
+(define_insn "enable_interrupts"
+ [(unspec_volatile [(const_int 0)] UNS_EINT)]
+ ""
+ "EINT"
+ )
+
+(define_insn "push_intr_state"
+ [(unspec_volatile [(const_int 0)] UNS_PUSH_INTR)]
+ ""
+ "PUSH\tSR"
+ )
+
+(define_insn "pop_intr_state"
+ [(unspec_volatile [(const_int 0)] UNS_POP_INTR)]
+ ""
+ "POP\tSR"
+ )
+
+;; Clear bits in the copy of the status register that is currently
+;; saved on the stack at the top of the interrupt handler.
+(define_insn "bic_SR"
+ [(unspec_volatile [(match_operand 0 "nonmemory_operand" "ir")] UNS_BIC_SR)]
+ ""
+ "BIC.W\t%0, %O0(SP)"
+ )
+
+;; Set bits in the copy of the status register that is currently
+;; saved on the stack at the top of the interrupt handler.
+(define_insn "bis_SR"
+ [(unspec_volatile [(match_operand 0 "nonmemory_operand" "ir")] UNS_BIS_SR)]
+ ""
+ "BIS.W\t%0, %O0(SP)"
+ )
+
+;; For some reason GCC is generating (set (reg) (and (neg (reg)) (int)))
+;; very late on in the compilation and not splitting it into separate
+;; instructions, so we provide a pattern to support it here.
+(define_insn "andneghi3"
+ [(set (match_operand:HI 0 "register_operand" "=r")
+ (and:HI (neg:HI (match_operand:HI 1 "register_operand" "r"))
+ (match_operand 2 "immediate_operand" "n")))]
+ ""
+ "*
+ if (REGNO (operands[0]) != REGNO (operands[1]))
+ return \"MOV.W\t%1, %0 { SUB.W #0, %0 { AND.W %2, %0\";
+ else
+ return \"SUB.W\t#0, %0 { AND.W %2, %0\";
+ "
+ )
diff --git a/gcc/config/msp430/msp430.opt b/gcc/config/msp430/msp430.opt
new file mode 100644
index 00000000000..6d4fc347e1a
--- /dev/null
+++ b/gcc/config/msp430/msp430.opt
@@ -0,0 +1,26 @@
+msim
+Target
+Use simulator runtime
+
+masm-hex
+Target Mask(ASM_HEX)
+Force assembly output to always use hex constants
+
+mmcu=
+Target Joined RejectNegative Var(target_cpu)
+Specify the cpu to build for. If the name begins with 'msp430x' then the 430X instructions are enabled
+
+mlarge
+Target Mask(LARGE) RejectNegative
+Select large model - 20-bit addresses/pointers
+
+msmall
+Target InverseMask(LARGE) RejectNegative
+Select small model - 16-bit addresses/pointers (default)
+
+mrelax
+Target Report
+Optimize opcode sizes at link time
+
+mOs
+Target Undocumented Mask(OPT_SPACE)
diff --git a/gcc/config/msp430/predicates.md b/gcc/config/msp430/predicates.md
new file mode 100644
index 00000000000..6f99caa94eb
--- /dev/null
+++ b/gcc/config/msp430/predicates.md
@@ -0,0 +1,80 @@
+;; Machine Description for TI MSP43* processors
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+;; Contributed by Red Hat.
+
+;; 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_predicate "msp_volatile_memory_operand"
+ (and (match_code "mem")
+ (match_test ("memory_address_addr_space_p (GET_MODE (op), XEXP (op, 0), MEM_ADDR_SPACE (op))")))
+)
+
+; TRUE for any valid general operand. We do this because
+; general_operand refuses to match volatile memory refs.
+
+(define_predicate "msp_general_operand"
+ (ior (match_operand 0 "general_operand")
+ (match_operand 0 "msp_volatile_memory_operand"))
+)
+
+; Likewise for nonimmediate_operand.
+
+(define_predicate "msp_nonimmediate_operand"
+ (ior (match_operand 0 "nonimmediate_operand")
+ (match_operand 0 "msp_volatile_memory_operand"))
+)
+
+(define_predicate "ubyte_operand"
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (INTVAL (op), 0, 255)")))
+
+; TRUE for comparisons we support.
+(define_predicate "msp430_cmp_operator"
+ (match_code "eq,ne,lt,ltu,ge,geu"))
+
+; TRUE for comparisons we need to reverse.
+(define_predicate "msp430_reversible_cmp_operator"
+ (match_code "gt,gtu,le,leu"))
+
+; TRUE for constants the constant generator can produce
+(define_predicate "msp430_constgen_operator"
+ (and (match_code "const_int")
+ (match_test (" INTVAL (op) == 0
+ || INTVAL (op) == 1
+ || INTVAL (op) == 2
+ || INTVAL (op) == 4
+ || INTVAL (op) == 8
+ || INTVAL (op) == -1 "))))
+
+; TRUE for constants the constant generator can produce
+(define_predicate "msp430_inv_constgen_operator"
+ (and (match_code "const_int")
+ (match_test (" INTVAL (op) == ~0
+ || INTVAL (op) == ~1
+ || INTVAL (op) == ~2
+ || INTVAL (op) == ~4
+ || INTVAL (op) == ~8
+ || INTVAL (op) == ~(-1) "))))
+
+(define_predicate "msp430_nonsubreg_operand"
+ (match_code "reg,mem"))
+
+; TRUE for constants which are bit positions for zero_extract
+(define_predicate "msp430_bitpos"
+ (and (match_code "const_int")
+ (match_test (" INTVAL (op) >= 0
+ && INTVAL (op) <= 15 "))))
diff --git a/gcc/config/msp430/t-msp430 b/gcc/config/msp430/t-msp430
new file mode 100644
index 00000000000..52f0f4c1845
--- /dev/null
+++ b/gcc/config/msp430/t-msp430
@@ -0,0 +1,264 @@
+# Makefile fragment for building GCC for the TI MSP430 target.
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+# Contributed by Red Hat.
+#
+# 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 multilibs:
+
+MULTILIB_OPTIONS = mmcu=msp430x mlarge
+MULTILIB_DIRNAMES = 430x large
+
+# Match msp430X with msp430x.
+MULTILIB_MATCHES = mmcu?msp430x=mmcu?msp430X
+
+# each supported X or Xv2 MCU needs a line like this:
+# MULTILIB_MATCHES += mmcu?msp430x=mmcu?xxxxxxxxxx
+
+# NB/ This list should be kept in sync with the ones in:
+# gcc/config/msp430/msp430.c
+# gas/config/tc-msp430.c
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430xv2
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430cg4616
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430cg4617
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430cg4618
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430cg4619
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2416
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2417
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2418
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2419
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2616
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2617
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2618
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f2619
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47126
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47127
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47163
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47173
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47183
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47193
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47166
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47176
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47186
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47196
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47167
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47177
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47187
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f47197
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f46161
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f46171
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f46181
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f46191
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f4616
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f4617
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f4618
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f4619
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fg4616
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fg4617
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fg4618
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fg4619
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5418
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5419
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5435
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5436
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5437
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5438
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5418a
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5419a
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5435a
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5436a
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5437a
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5438a
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5212
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5213
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5214
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5217
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5218
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5219
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5222
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5223
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5224
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5227
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5228
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5229
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5304
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5308
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5309
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5310
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5340
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5341
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5342
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5324
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5325
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5326
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5327
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5328
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5329
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5500
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5501
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5502
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5503
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5504
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5505
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5506
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5507
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5508
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5509
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5510
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5513
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5514
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5515
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5517
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5519
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5521
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5522
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5524
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5525
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5526
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5527
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5528
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5529
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5133
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5135
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5137
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6125
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6126
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6127
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6135
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6137
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5123
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5125
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5143
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5145
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f5147
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6143
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6145
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?cc430f6147
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5333
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5335
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5336
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5338
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5630
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5631
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5632
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5633
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5634
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5635
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5636
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5637
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5638
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6433
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6435
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6436
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6438
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6630
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6631
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6632
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6633
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6634
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6635
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6636
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6637
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6638
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5358
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5359
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5658
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5659
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6458
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6459
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6658
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6659
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5131
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5151
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5171
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5132
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5152
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f5172
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6720
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6721
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6723
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6724
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6725
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6726
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6730
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6731
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6733
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6734
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6735
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6736
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67451
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67651
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67751
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67461
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67661
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67761
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67471
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67671
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67771
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67481
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67681
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67781
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67491
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67691
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f67791
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6745
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6765
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6775
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6746
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6766
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6776
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6747
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6767
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6777
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6748
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6768
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6778
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6749
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6769
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430f6779
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5720
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5721
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5722
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5723
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5724
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5725
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5726
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5727
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5728
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5729
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5730
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5731
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5732
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5733
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5734
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5735
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5736
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5737
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5738
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5739
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430bt5190
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5949
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430fr5969
+MULTILIB_MATCHES += mmcu?msp430x=mmcu?msp430sl5438a
+
+
+MULTILIB_EXCEPTIONS = mlarge
+
+MULTILIB_EXTRA_OPTS =
+
+msp430-c.o: $(srcdir)/config/msp430/msp430-c.c $(RTL_H) $(TREE_H) $(CONFIG_H) $(TM_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h
index fd4d22a7aad..c20c7ccd02f 100644
--- a/gcc/config/pa/pa-linux.h
+++ b/gcc/config/pa/pa-linux.h
@@ -22,6 +22,9 @@ along with GCC; see the file COPYING3. If not see
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); \
+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); \
+ builtin_define ("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); \
GNU_USER_TARGET_OS_CPP_BUILTINS(); \
builtin_assert ("machine=bigendian"); \
} \
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 74a99e36a01..260830f00d7 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -513,6 +513,12 @@ pa_option_override (void)
write_symbols = NO_DEBUG;
}
+#ifdef AUTO_INC_DEC
+ /* FIXME: Disable auto increment and decrement processing until reload
+ is completed. See PR middle-end 56791. */
+ flag_auto_inc_dec = reload_completed;
+#endif
+
/* We only support the "big PIC" model now. And we always generate PIC
code when in 64bit mode. */
if (flag_pic == 1 || TARGET_64BIT)
@@ -4035,7 +4041,8 @@ pa_expand_prologue (void)
|| (! TARGET_64BIT && df_regs_ever_live_p (i + 1)))
{
rtx addr, insn, reg;
- addr = gen_rtx_MEM (DFmode, gen_rtx_POST_INC (DFmode, tmpreg));
+ addr = gen_rtx_MEM (DFmode,
+ gen_rtx_POST_INC (word_mode, tmpreg));
reg = gen_rtx_REG (DFmode, i);
insn = emit_move_insn (addr, reg);
if (DO_FRAME_NOTES)
@@ -4328,7 +4335,8 @@ pa_expand_epilogue (void)
if (df_regs_ever_live_p (i)
|| (! TARGET_64BIT && df_regs_ever_live_p (i + 1)))
{
- rtx src = gen_rtx_MEM (DFmode, gen_rtx_POST_INC (DFmode, tmpreg));
+ rtx src = gen_rtx_MEM (DFmode,
+ gen_rtx_POST_INC (word_mode, tmpreg));
rtx dest = gen_rtx_REG (DFmode, i);
emit_move_insn (dest, src);
}
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index 80c4d43401d..c990950f111 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -836,7 +836,7 @@
[(match_operand:SI 1 "reg_or_0_operand" "rM")
(match_operand:SI 2 "arith11_operand" "rI")]))]
""
- "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi 1,%0"
+ "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi 1,%0"
[(set_attr "type" "binary")
(set_attr "length" "8")])
@@ -846,7 +846,7 @@
[(match_operand:DI 1 "reg_or_0_operand" "rM")
(match_operand:DI 2 "arith11_operand" "rI")]))]
"TARGET_64BIT"
- "cmp%I2clr,*%B3 %2,%1,%0\;ldi 1,%0"
+ "cmp%I2clr,*%B3 %2,%r1,%0\;ldi 1,%0"
[(set_attr "type" "binary")
(set_attr "length" "8")])
@@ -859,7 +859,7 @@
[(match_operand:SI 4 "reg_or_0_operand" "rM")
(match_operand:SI 5 "arith11_operand" "rI")])))]
""
- "{com%I2clr|cmp%I2clr},%S3 %2,%1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%4,%0\;ldi 1,%0"
+ "{com%I2clr|cmp%I2clr},%S3 %2,%r1,%%r0\;{com%I5clr|cmp%I5clr},%B6 %5,%r4,%0\;ldi 1,%0"
[(set_attr "type" "binary")
(set_attr "length" "12")])
@@ -872,7 +872,7 @@
[(match_operand:DI 4 "reg_or_0_operand" "rM")
(match_operand:DI 5 "arith11_operand" "rI")])))]
"TARGET_64BIT"
- "cmp%I2clr,*%S3 %2,%1,%%r0\;cmp%I5clr,*%B6 %5,%4,%0\;ldi 1,%0"
+ "cmp%I2clr,*%S3 %2,%r1,%%r0\;cmp%I5clr,*%B6 %5,%r4,%0\;ldi 1,%0"
[(set_attr "type" "binary")
(set_attr "length" "12")])
@@ -884,7 +884,7 @@
[(match_operand:SI 1 "reg_or_0_operand" "rM")
(match_operand:SI 2 "arith11_operand" "rI")])))]
""
- "{com%I2clr|cmp%I2clr},%B3 %2,%1,%0\;ldi -1,%0"
+ "{com%I2clr|cmp%I2clr},%B3 %2,%r1,%0\;ldi -1,%0"
[(set_attr "type" "binary")
(set_attr "length" "8")])
@@ -894,7 +894,7 @@
[(match_operand:DI 1 "reg_or_0_operand" "rM")
(match_operand:DI 2 "arith11_operand" "rI")])))]
"TARGET_64BIT"
- "cmp%I2clr,*%B3 %2,%1,%0\;ldi -1,%0"
+ "cmp%I2clr,*%B3 %2,%r1,%0\;ldi -1,%0"
[(set_attr "type" "binary")
(set_attr "length" "8")])
diff --git a/gcc/config/rl78/constraints.md b/gcc/config/rl78/constraints.md
index 8b03cf32211..1785c666cb3 100644
--- a/gcc/config/rl78/constraints.md
+++ b/gcc/config/rl78/constraints.md
@@ -43,6 +43,7 @@
; Y - any valid memory
; Wxx - various memory addressing modes
; Qxx - conditionals
+; U = usual memory references mov-able to/from AX
; v = virtual registers
; Zxx = specific virtual registers
@@ -56,6 +57,60 @@
(and (match_code "const_int")
(match_test "IN_RANGE (ival, 1, 7)")))
+(define_constraint "Iv08"
+ "@internal
+ Integer constant equal to 8."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 8, 8)")))
+
+(define_constraint "Iv16"
+ "@internal
+ Integer constant equal to 16."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 16, 16)")))
+
+(define_constraint "Iv24"
+ "@internal
+ Integer constant equal to 24."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 24, 24)")))
+
+(define_constraint "Is09"
+ "@internal
+ Integer constant in the range 9 @dots{} 15 (for shifts)."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 9, 15)")))
+
+(define_constraint "Is17"
+ "@internal
+ Integer constant in the range 17 @dots{} 23 (for shifts)."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 17, 23)")))
+
+(define_constraint "Is25"
+ "@internal
+ Integer constant in the range 25 @dots{} 31 (for shifts)."
+ (and (match_code "const_int")
+ (match_test "IN_RANGE (ival, 25, 31)")))
+
+(define_constraint "ISsi"
+ "@internal
+ Integer constant with bit 31 set."
+ (and (match_code "const_int")
+ (match_test "(ival & 0x80000000) != 0")))
+
+(define_constraint "IShi"
+ "@internal
+ Integer constant with bit 15 set."
+ (and (match_code "const_int")
+ (match_test "(ival & 0x8000) != 0")))
+
+(define_constraint "ISqi"
+ "@internal
+ Integer constant with bit 7 set."
+ (and (match_code "const_int")
+ (match_test "(ival & 0x80) != 0")))
+
(define_constraint "J"
"Integer constant in the range -255 @dots{} 0"
(and (match_code "const_int")
@@ -152,17 +207,24 @@
; All the memory addressing schemes the RL78 supports
; of the form W {register} {bytes of offset}
; or W {register} {register}
+; Additionally, the Cxx forms are the same as the Wxx forms, but without
+; the ES: override.
; absolute address
-(define_memory_constraint "Wab"
+(define_memory_constraint "Cab"
"[addr]"
(and (match_code "mem")
(ior (match_test "CONSTANT_P (XEXP (op, 0))")
(match_test "GET_CODE (XEXP (op, 0)) == PLUS && GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF"))
)
)
+(define_memory_constraint "Wab"
+ "es:[addr]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Cab (rl78_es_base (op)))
+ || satisfies_constraint_Cab (op)")
+ )
-(define_memory_constraint "Wbc"
+(define_memory_constraint "Cbc"
"word16[BC]"
(and (match_code "mem")
(ior
@@ -174,29 +236,49 @@
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
)
+(define_memory_constraint "Wbc"
+ "es:word16[BC]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Cbc (rl78_es_base (op)))
+ || satisfies_constraint_Cbc (op)")
+ )
-(define_memory_constraint "Wde"
+(define_memory_constraint "Cde"
"[DE]"
(and (match_code "mem")
(and (match_code "reg" "0")
(match_test "REGNO (XEXP (op, 0)) == DE_REG")))
)
+(define_memory_constraint "Wde"
+ "es:[DE]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Cde (rl78_es_base (op)))
+ || satisfies_constraint_Cde (op)")
+ )
-(define_memory_constraint "Wca"
+(define_memory_constraint "Cca"
"[AX..HL] for calls"
(and (match_code "mem")
(and (match_code "reg" "0")
(match_test "REGNO (XEXP (op, 0)) <= HL_REG")))
)
+(define_memory_constraint "Wca"
+ "es:[AX..HL] for calls"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Cca (rl78_es_base (op)))
+ || satisfies_constraint_Cca (op)")
+ )
-(define_memory_constraint "Wcv"
- "[AX..HL,r8-r23] for calls"
+(define_memory_constraint "Ccv"
+ "[AX..HL,r8-r31] for calls"
(and (match_code "mem")
(and (match_code "reg" "0")
- (match_test "REGNO (XEXP (op, 0)) < 24")))
+ (match_test "REGNO (XEXP (op, 0)) < 32")))
+ )
+(define_memory_constraint "Wcv"
+ "es:[AX..HL,r8-r31] for calls"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Ccv (rl78_es_base (op)))
+ || satisfies_constraint_Ccv (op)")
)
-(define_memory_constraint "Wd2"
+(define_memory_constraint "Cd2"
"word16[DE]"
(and (match_code "mem")
(ior
@@ -208,15 +290,25 @@
(match_test "uword_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
)
+(define_memory_constraint "Wd2"
+ "es:word16[DE]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Cd2 (rl78_es_base (op)))
+ || satisfies_constraint_Cd2 (op)")
+ )
-(define_memory_constraint "Whl"
+(define_memory_constraint "Chl"
"[HL]"
(and (match_code "mem")
(and (match_code "reg" "0")
(match_test "REGNO (XEXP (op, 0)) == HL_REG")))
)
+(define_memory_constraint "Whl"
+ "es:[HL]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Chl (rl78_es_base (op)))
+ || satisfies_constraint_Chl (op)")
+ )
-(define_memory_constraint "Wh1"
+(define_memory_constraint "Ch1"
"byte8[HL]"
(and (match_code "mem")
(and (match_code "plus" "0")
@@ -224,14 +316,24 @@
(match_test "REGNO (XEXP (XEXP (op, 0), 0)) == HL_REG"))
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
+(define_memory_constraint "Wh1"
+ "es:byte8[HL]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Ch1 (rl78_es_base (op)))
+ || satisfies_constraint_Ch1 (op)")
+ )
-(define_memory_constraint "Whb"
+(define_memory_constraint "Chb"
"[HL+B]"
(and (match_code "mem")
(match_test "rl78_hl_b_c_addr_p (XEXP (op, 0))"))
)
+(define_memory_constraint "Whb"
+ "es:[HL+B]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Chb (rl78_es_base (op)))
+ || satisfies_constraint_Chb (op)")
+ )
-(define_memory_constraint "Ws1"
+(define_memory_constraint "Cs1"
"word8[SP]"
(and (match_code "mem")
(ior
@@ -243,6 +345,11 @@
(match_test "ubyte_operand (XEXP (XEXP (op, 0), 1), VOIDmode)"))))
)
)
+(define_memory_constraint "Ws1"
+ "es:word8[SP]"
+ (match_test "(rl78_es_addr (op) && satisfies_constraint_Cs1 (rl78_es_base (op)))
+ || satisfies_constraint_Cs1 (op)")
+ )
(define_memory_constraint "Wfr"
"ES/CS far pointer"
diff --git a/gcc/config/rl78/predicates.md b/gcc/config/rl78/predicates.md
index 33ce900bffa..99ee656aad5 100644
--- a/gcc/config/rl78/predicates.md
+++ b/gcc/config/rl78/predicates.md
@@ -46,6 +46,8 @@
(and (match_code "const_int")
(match_test "IN_RANGE (INTVAL (op), 0, 65536)"))))
+(define_predicate "rl78_cmp_operator_signed"
+ (match_code "gt,ge,lt,le"))
(define_predicate "rl78_cmp_operator_real"
(match_code "eq,ne,gtu,ltu,geu,leu"))
(define_predicate "rl78_cmp_operator"
@@ -58,3 +60,12 @@
(define_predicate "rl78_addw_operand"
(and (match_code "reg")
(match_test "REGNO (op) == AX_REG || REGNO (op) == SP_REG || REGNO (op) >= FIRST_PSEUDO_REGISTER")))
+
+(define_predicate "rl78_stack_based_mem"
+ (and (match_code "mem")
+ (ior (and (match_code "reg" "0")
+ (match_test "REGNO (XEXP (op, 0)) == SP_REG"))
+ (and (match_code "plus" "0")
+ (and (match_code "reg" "00")
+ (match_test "REGNO (XEXP (XEXP (op, 0), 0)) == SP_REG")
+ (match_code "const_int" "01"))))))
diff --git a/gcc/config/rl78/rl78-expand.md b/gcc/config/rl78/rl78-expand.md
index 3f24b150bab..fa5857ca69a 100644
--- a/gcc/config/rl78/rl78-expand.md
+++ b/gcc/config/rl78/rl78-expand.md
@@ -35,9 +35,16 @@
if (GET_CODE (operand1) == SUBREG
&& GET_CODE (XEXP (operand1, 0)) == SYMBOL_REF)
FAIL;
+ /* Similarly for (SUBREG (CONST (PLUS (SYMBOL_REF)))).
+ cf. g++.dg/abi/packed.C. */
+ if (GET_CODE (operand1) == SUBREG
+ && GET_CODE (XEXP (operand1, 0)) == CONST
+ && GET_CODE (XEXP (XEXP (operand1, 0), 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (XEXP (operand1, 0), 0), 0)) == SYMBOL_REF)
+ FAIL;
if (CONST_INT_P (operand1) && ! IN_RANGE (INTVAL (operand1), (-1 << 8) + 1, (1 << 8) - 1))
- gcc_unreachable();
+ FAIL;
}
)
@@ -56,17 +63,27 @@
if (GET_CODE (operand1) == SUBREG
&& GET_CODE (XEXP (operand1, 0)) == SYMBOL_REF)
FAIL;
+ /* Similarly for (SUBREG (CONST (PLUS (SYMBOL_REF)))). */
+ if (GET_CODE (operand1) == SUBREG
+ && GET_CODE (XEXP (operand1, 0)) == CONST
+ && GET_CODE (XEXP (XEXP (operand1, 0), 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (XEXP (operand1, 0), 0), 0)) == SYMBOL_REF)
+ FAIL;
}
)
-(define_expand "movsi"
- [(set (match_operand:SI 0 "nonimmediate_operand")
- (match_operand:SI 1 "general_operand"))]
+(define_insn_and_split "movsi"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=vYS,v,Wfr")
+ (match_operand:SI 1 "general_operand" "viYS,Wfr,v"))]
""
- {
- rl78_expand_movsi (operands);
- DONE;
- }
+ "#"
+ ""
+ [(set (match_operand:HI 2 "nonimmediate_operand")
+ (match_operand:HI 4 "general_operand"))
+ (set (match_operand:HI 3 "nonimmediate_operand")
+ (match_operand:HI 5 "general_operand"))]
+ "rl78_split_movsi (operands);"
+ [(set_attr "valloc" "op1")]
)
;;---------- Conversions ------------------------
@@ -200,13 +217,33 @@
)
(define_expand "ashrsi3"
- [(set (match_operand:SI 0 "register_operand")
- (ashiftrt:SI (match_operand:SI 1 "register_operand")
- (match_operand:SI 2 "immediate_operand")))
+ [(parallel [(set (match_operand:SI 0 "nonimmediate_operand")
+ (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand")
+ (match_operand:SI 2 "nonmemory_operand")))
+ (clobber (reg:HI X_REG))])
+ ]
+ ""
+ ""
+)
+
+(define_expand "lshrsi3"
+ [(parallel [(set (match_operand:SI 0 "nonimmediate_operand")
+ (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand")
+ (match_operand:SI 2 "nonmemory_operand")))
+ (clobber (reg:HI X_REG))])
]
""
- "if (GET_CODE (operands[2]) != CONST_INT)
- FAIL;"
+ ""
+)
+
+(define_expand "ashlsi3"
+ [(parallel [(set (match_operand:SI 0 "nonimmediate_operand")
+ (ashift:SI (match_operand:SI 1 "nonimmediate_operand")
+ (match_operand:SI 2 "nonmemory_operand")))
+ (clobber (reg:HI X_REG))])
+ ]
+ ""
+ ""
)
;;---------- Branching ------------------------
@@ -254,3 +291,16 @@
""
"rl78_expand_compare (operands);"
)
+
+(define_expand "cbranchsi4"
+ [(parallel [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator"
+ [(match_operand:SI 1 "general_operand")
+ (match_operand:SI 2 "nonmemory_operand")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:HI AX_REG))
+ ])]
+ "1"
+ "rl78_expand_compare (operands);"
+)
diff --git a/gcc/config/rl78/rl78-protos.h b/gcc/config/rl78/rl78-protos.h
index b13c65065d1..1f30e637b72 100644
--- a/gcc/config/rl78/rl78-protos.h
+++ b/gcc/config/rl78/rl78-protos.h
@@ -21,6 +21,7 @@
void rl78_emit_eh_epilogue (rtx);
void rl78_expand_compare (rtx *);
void rl78_expand_movsi (rtx *);
+void rl78_split_movsi (rtx *);
int rl78_force_nonfar_2 (rtx *, rtx (*gen)(rtx,rtx));
int rl78_force_nonfar_3 (rtx *, rtx (*gen)(rtx,rtx,rtx));
void rl78_expand_eh_epilogue (rtx);
@@ -41,3 +42,6 @@ void rl78_register_pragmas (void);
bool rl78_regno_mode_code_ok_for_base_p (int, enum machine_mode, addr_space_t, int, int);
void rl78_setup_peep_movhi (rtx *);
bool rl78_virt_insns_ok (void);
+
+bool rl78_es_addr (rtx);
+rtx rl78_es_base (rtx);
diff --git a/gcc/config/rl78/rl78-real.md b/gcc/config/rl78/rl78-real.md
index 76daaf17e84..a16d3524f08 100644
--- a/gcc/config/rl78/rl78-real.md
+++ b/gcc/config/rl78/rl78-real.md
@@ -312,11 +312,25 @@
call\t%A1"
)
+(define_insn "*cbranchqi4_real_signed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_signed"
+ [(match_operand:QI 1 "general_operand" "A,A,A")
+ (match_operand:QI 2 "general_operand" "ISqi,i,v")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "rl78_real_insns_ok ()"
+ "@
+ cmp\t%1, %2 \;xor1 CY,%1.7\;not1 CY\;sk%c0 \;br\t!!%3
+ cmp\t%1, %2 \;xor1 CY,%1.7\;sk%c0 \;br\t!!%3
+ cmp\t%1, %2 \;xor1 CY,%1.7\;xor1 CY,%2.7\;sk%c0 \;br\t!!%3"
+ )
+
(define_insn "*cbranchqi4_real"
[(set (pc) (if_then_else
(match_operator 0 "rl78_cmp_operator_real"
- [(match_operand:QI 1 "general_operand" "Wabvaxbc,a, v,bcdehl")
- (match_operand:QI 2 "general_operand" "M, irWhlWh1Whb,i,a")])
+ [(match_operand:QI 1 "general_operand" "Wabvaxbc,a, v,bcdehl")
+ (match_operand:QI 2 "general_operand" "M, irvWabWhlWh1Whb,i,a")])
(label_ref (match_operand 3 "" ""))
(pc)))]
"rl78_real_insns_ok ()"
@@ -327,13 +341,211 @@
cmp\t%1, %2 \;sk%c0 \;br\t!!%3"
)
-(define_insn "*cbranchhi4_real"
+(define_insn "*cbranchhi4_real_signed"
[(set (pc) (if_then_else
- (match_operator 0 "rl78_cmp_operator_real"
- [(match_operand:HI 1 "general_operand" "A")
- (match_operand:HI 2 "general_operand" "iBDTWhlWh1")])
- (label_ref (match_operand 3 "" ""))
+ (match_operator 0 "rl78_cmp_operator_signed"
+ [(match_operand:HI 1 "general_operand" "A,A,A,vR")
+ (match_operand:HI 2 "general_operand" "IShi,i,v,1")])
+ (label_ref (match_operand 3))
(pc)))]
"rl78_real_insns_ok ()"
+ "@
+ cmpw\t%1, %2 \;xor1 CY,%Q1.7\;not1 CY\;sk%c0 \;br\t!!%3
+ cmpw\t%1, %2 \;xor1 CY,%Q1.7\;sk%c0 \;br\t!!%3
+ cmpw\t%1, %2 \;xor1 CY,%Q1.7\;xor1 CY,%Q2.7\;sk%c0 \;br\t!!%3
+ %z0\t!!%3"
+ )
+
+(define_insn "cbranchhi4_real"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_real"
+ [(match_operand:HI 1 "general_operand" "A,vR")
+ (match_operand:HI 2 "general_operand" "iBDTvWabWhlWh1,1")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "rl78_real_insns_ok ()"
+ "@
+ cmpw\t%1, %2 \;sk%c0 \;br\t!!%3
+ %z0\t!!%3"
+ )
+
+(define_insn "cbranchhi4_real_inverted"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_real"
+ [(match_operand:HI 1 "general_operand" "A")
+ (match_operand:HI 2 "general_operand" "iBDTvWabWhlWh1")])
+ (pc)
+ (label_ref (match_operand 3 "" ""))))]
+ "rl78_real_insns_ok ()"
"cmpw\t%1, %2 \;sk%c0 \;br\t!!%3"
)
+
+(define_insn "*cbranchsi4_real_lt"
+ [(set (pc) (if_then_else
+ (lt (match_operand:SI 0 "general_operand" "U,vWabWhlWh1")
+ (const_int 0))
+ (label_ref (match_operand 1 "" ""))
+ (pc)))
+ (clobber (reg:HI AX_REG))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ mov a, %E0 \;mov1 CY,a.7 \;sknc \;br\t!!%1
+ mov1 CY,%E0.7 \;sknc \;br\t!!%1"
+ )
+
+(define_insn "*cbranchsi4_real_ge"
+ [(set (pc) (if_then_else
+ (ge (match_operand:SI 0 "general_operand" "U,vWabWhlWh1")
+ (const_int 0))
+ (label_ref (match_operand 1 "" ""))
+ (pc)))
+ (clobber (reg:HI AX_REG))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ mov a, %E0 \;mov1 CY,a.7 \;skc \;br\t!!%1
+ mov1 CY,%E0.7 \;skc \;br\t!!%1"
+ )
+
+(define_insn "*cbranchsi4_real_signed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_signed"
+ [(match_operand:SI 1 "nonimmediate_operand" "vU,vU,vU")
+ (match_operand:SI 2 "nonmemory_operand" "ISsi,i,v")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:HI AX_REG))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ movw ax,%H1 \;cmpw ax, %H2 \;xor1 CY,a.7\;not1 CY\; movw ax,%h1 \;sknz \;cmpw ax, %h2 \;sk%c0 \;br\t!!%3
+ movw ax,%H1 \;cmpw ax, %H2 \;xor1 CY,a.7\; movw ax,%h1 \;sknz \;cmpw ax, %h2 \;sk%c0 \;br\t!!%3
+ movw ax,%H1 \;cmpw ax, %H2 \;xor1 CY,a.7\;xor1 CY,%E2.7\;movw ax,%h1 \;sknz \;cmpw ax, %h2 \;sk%c0 \;br\t!!%3"
+ )
+
+(define_insn "*cbranchsi4_real"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_real"
+ [(match_operand:SI 1 "general_operand" "vUi")
+ (match_operand:SI 2 "general_operand" "iWhlWh1v")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:HI AX_REG))
+ ]
+ "rl78_real_insns_ok ()"
+ "movw ax,%H1 \;cmpw ax, %H2 \;movw ax,%h1 \;sknz \;cmpw ax, %h2 \;sk%c0 \;br\t!!%3"
+ )
+
+;; Peephole to match:
+;;
+;; (set (mem (sp)) (ax))
+;; (set (ax) (mem (sp)))
+;; or:
+;; (set (mem (plus (sp) (const)) (ax))
+;; (set (ax) (mem (plus (sp) (const))))
+;;
+;; which can be generated as the last instruction of the conversion
+;; of one virtual insn into a real insn and the first instruction of
+;; the conversion of the following virtual insn.
+
+(define_peephole2
+ [(set (match_operand:HI 0 "rl78_stack_based_mem")
+ (reg:HI AX_REG))
+ (set (reg:HI AX_REG)
+ (match_dup 0))]
+ ""
+ [(set (match_dup 0) (reg:HI AX_REG))]
+ )
+
+;; Bit test and branch insns.
+
+;; NOTE: These patterns will work for bits in other places, not just A.
+
+(define_insn "bf"
+ [(set (pc)
+ (if_then_else (eq (and (reg:QI A_REG)
+ (match_operand 0 "immediate_operand" "n"))
+ (const_int 0))
+ (label_ref (match_operand 1 "" ""))
+ (pc)))]
+ ""
+ "bf\tA.%B0, $%1"
+)
+
+(define_insn "bt"
+ [(set (pc)
+ (if_then_else (ne (and (reg:QI A_REG)
+ (match_operand 0 "immediate_operand" "n"))
+ (const_int 0))
+ (label_ref (match_operand 1 "" ""))
+ (pc)))]
+ ""
+ "bt\tA.%B0, $%1"
+)
+
+;; NOTE: These peepholes are fragile. They rely upon GCC generating
+;; a specific sequence on insns, based upon examination of test code.
+;; Improvements to GCC or using code other than the test code can result
+;; in the peephole not matching and the optimization being missed.
+
+(define_peephole2
+ [(set (match_operand:QI 0 "register_operand") (reg:QI A_REG))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_operand 1 "immediate_operand")))
+ (set (pc) (if_then_else (eq (match_dup 0) (const_int 0))
+ (label_ref (match_operand 2 ""))
+ (pc)))]
+ "peep2_regno_dead_p (3, REGNO (operands[0]))
+ && exact_log2 (INTVAL (operands[1])) >= 0"
+ [(set (pc) (if_then_else (eq (and (reg:QI A_REG) (match_dup 1)) (const_int 0))
+ (label_ref (match_dup 2))
+ (pc)))]
+ )
+
+(define_peephole2
+ [(set (match_operand:QI 0 "register_operand") (reg:QI A_REG))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_operand 1 "immediate_operand")))
+ (set (pc) (if_then_else (ne (match_dup 0) (const_int 0))
+ (label_ref (match_operand 2 ""))
+ (pc)))]
+ "peep2_regno_dead_p (3, REGNO (operands[0]))
+ && exact_log2 (INTVAL (operands[1])) >= 0"
+ [(set (pc) (if_then_else (ne (and (reg:QI A_REG) (match_dup 1)) (const_int 0))
+ (label_ref (match_dup 2))
+ (pc)))]
+ )
+
+;; Eliminate needless register copies.
+(define_peephole2
+ [(set (match_operand:HI 0 "register_operand") (match_operand:HI 1 "register_operand"))
+ (set (match_operand:HI 2 "register_operand") (match_dup 0))]
+ "peep2_regno_dead_p (2, REGNO (operands[0]))
+ && (REGNO (operands[1]) < 8 || REGNO (operands[2]) < 8)"
+ [(set (match_dup 2) (match_dup 1))]
+ )
+
+;; Eliminate needless register copying when performing bit manipulations.
+(define_peephole2
+ [(set (match_operand:QI 0 "register_operand") (reg:QI A_REG))
+ (set (match_dup 0) (ior:QI (match_dup 0) (match_operand 1 "immediate_operand")))
+ (set (reg:QI A_REG) (match_dup 0))]
+ "peep2_regno_dead_p (3, REGNO (operands[0]))"
+ [(set (reg:QI A_REG) (ior:QI (reg:QI A_REG) (match_dup 1)))]
+ )
+
+(define_peephole2
+ [(set (match_operand:QI 0 "register_operand") (reg:QI A_REG))
+ (set (match_dup 0) (xor:QI (match_dup 0) (match_operand 1 "immediate_operand")))
+ (set (reg:QI A_REG) (match_dup 0))]
+ "peep2_regno_dead_p (3, REGNO (operands[0]))"
+ [(set (reg:QI A_REG) (xor:QI (reg:QI A_REG) (match_dup 1)))]
+ )
+
+(define_peephole2
+ [(set (match_operand:QI 0 "register_operand") (reg:QI A_REG))
+ (set (match_dup 0) (and:QI (match_dup 0) (match_operand 1 "immediate_operand")))
+ (set (reg:QI A_REG) (match_dup 0))]
+ "peep2_regno_dead_p (3, REGNO (operands[0]))"
+ [(set (reg:QI A_REG) (and:QI (reg:QI A_REG) (match_dup 1)))]
+ )
+
diff --git a/gcc/config/rl78/rl78-virt.md b/gcc/config/rl78/rl78-virt.md
index d73a51484ba..170d14a261d 100644
--- a/gcc/config/rl78/rl78-virt.md
+++ b/gcc/config/rl78/rl78-virt.md
@@ -161,20 +161,130 @@
"v.shr\t%0, %1, %2"
)
-;; really a macro
-(define_insn "*ashrsi3_virt"
- [(set (match_operand:SI 0 "register_operand" "=v,v,v")
- (ashiftrt:SI (match_operand:SI 1 "register_operand" "0,v,0")
- (match_operand:SI 2 "immediate_operand" "M,K,i")))
+;; This is complex mostly because the RL78 has no SImode operations,
+;; and very limited HImode operations, and no variable shifts. This
+;; pattern is optimized for each constant shift count and operand
+;; types, so as to use a hand-optimized pattern. For readability, the
+;; usual \t\; syntax is not used here. Also, there's no easy way to
+;; constrain to avoid partial overlaps, hence the duplication.
+(define_insn "ashrsi3_virt" ;; 0 1 2-7 8 9-15 16 17-23 24 25-31 var
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,vU,&vU,v, &vU, &vU, v, &vU, v, &vU, &vU, vU, v,&vU, vU, vU, vU")
+ (ashiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0, 0, vU,0, vWab, U, 0, vU, 0, vWab,U, vU, 0, vU, vU, vU, 0")
+ (match_operand:SI 2 "nonmemory_operand" "M, K, K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Is17,Is17,Iv24,Is25, iv")))
+ (clobber (reg:HI X_REG))
+ ]
+ ""
+ "@
+ ; ashrsi %0, 0
+
+ movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
+ movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
+
+ movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
+ movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
+ movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
+
+ mov x,%Q1 \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; sarw ax,8 \; movw %H0,ax
+ mov a,%Q1 \; mov x, a \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; sarw ax,8 \; movw %H0,ax
+
+ mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
+ mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
+ mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; sarw ax,%u2 \; movw %H0,ax
+
+ movw ax,%H1 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
+
+ movw ax,%H1 \; sarw ax,%S2 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
+ movw ax,%H1 \; sarw ax,%S2 \; movw %0,ax \; sarw ax,15 \; movw %H0,ax
+
+ movw ax,%H1 \; mov %0,a \; sarw ax,15 \; movw %H0,ax \; mov %Q0,a
+
+ movw ax,%H1 \; sar a,%s2 \; mov %0,a \; sarw ax,15 \; movw %H0,ax \; mov %Q0,a
+
+ mov b,%2 \; cmp0 b \; bz $2f \; 1: \; movw ax,%H1 \; sarw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a \; dec b \; bnz $1b \; 2:"
+ [(set_attr "valloc" "macax")]
+)
+
+;; Likewise.
+(define_insn "lshrsi3_virt" ;; 0 1 2-7 8 9-15 16 17-23 24 25-31 var
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,vU,&vU,v, &vU, &vU, v, &vU, v, &vU, &vU, vU, v,&vU, vU, vU, vU")
+ (lshiftrt:SI (match_operand:SI 1 "nonimmediate_operand" "0, 0, vU,0, vWab, U, 0, vU, 0, vWab,U, vU, 0, vU, vU, vU, 0")
+ (match_operand:SI 2 "nonmemory_operand" "M, K, K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Is17,Is17,Iv24,Is25, iv")))
+ (clobber (reg:HI X_REG))
]
""
"@
- ; ashrsi %0, 0
- movw\tax,%H1\;sarw\tax,1\;movw\t%H0,ax\;mov\ta,%Q1\;rorc\ta,1\;mov\t%Q0,a\;mov\ta,%q1\;rorc\ta,1\;mov\t%q0,a
- mov\tb,%2\;1:\;movw\tax,%H1\;sarw\tax,1\;movw\t%H0,ax\;mov\ta,%Q1\;rorc\ta,1\;mov\t%Q0,a\;mov\ta,%q1\;rorc\ta,1\;mov\t%q0,a\;dec\tb\;bnz $1b"
+ ; lshrsi %0, 0
+
+ movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
+ movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a
+
+ movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
+ movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
+ movw ax,%1 \; shlw ax,%r2 \; mov %0,a \; mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
+
+ mov x,%Q1 \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; shrw ax,8 \; movw %H0,ax
+ mov a,%Q1 \; mov x, a \; mov a,%H1 \; movw %0,ax \; movw ax,%H1 \; shrw ax,8 \; movw %H0,ax
+
+ mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
+ mov x,%Q1 \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
+ mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%r2 \; mov %0,a \; movw ax,%H1 \; shlw ax,%r2 \; mov %Q0,a \; movw ax,%H1 \; shrw ax,%u2 \; movw %H0,ax
+
+ movw ax,%H1 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
+
+ movw ax,%H1 \; shrw ax,%S2 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
+ movw ax,%H1 \; shrw ax,%S2 \; movw %0,ax \; movw ax,#0 \; movw %H0,ax
+
+ movw ax,%H1 \; mov %0,a \; movw ax,#0 \; movw %H0,ax \; mov %Q0,a
+
+ movw ax,%H1 \; shr a,%s2 \; mov %0,a \; movw ax,#0 \; movw %H0,ax \; mov %Q0,a
+
+ mov b,%2 \; cmp0 b \; bz $2f \; 1: \; movw ax,%H1 \; shrw ax,1 \; movw %H0,ax \; mov a,%Q1 \; rorc a,1 \; mov %Q0,a \; mov a,%q1 \; rorc a,1 \; mov %q0,a \; dec b \; bnz $1b \; 2:"
[(set_attr "valloc" "macax")]
)
+;; Likewise.
+(define_insn "ashlsi3_virt" ;; 0 1 2-7 8 9-15 16 17-23 24 25-31 var
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,vU,&vU,v, &vU, &vU, v, &vU, v, &vU, &vU, v, U, v,&vU, v, U, v, U, vWab,vU, vU")
+ (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0, 0, vU,0, vWab, U, 0, vU, 0, vWab,U, vU, vU, 0, vU, vU, vU, vU, vU, 0, vWab,U")
+ (match_operand:SI 2 "nonmemory_operand" "M, K, K, Int3,Int3,Int3,Iv08,Iv08,Is09,Is09,Is09,Iv16,Iv16,Is17,Is17,Iv24,Iv24,Is25,Is25,iv, iv, iv")))
+ (clobber (reg:HI X_REG))
+ ]
+ ""
+ "@
+ ; lshrsi %0, 0
+
+ movw ax,%1 \; shlw ax,1 \; movw %0,ax \; movw ax,%H1 \; rolwc ax,1 \; movw %H0,ax
+ movw ax,%1 \; shlw ax,1 \; movw %0,ax \; movw ax,%H1 \; rolwc ax,1 \; movw %H0,ax
+
+ movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov x,%Q1 \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
+ movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov x,%Q1 \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
+ movw ax,%H1 \; shlw ax,%u2 \; mov %E0,a \; mov a,%Q1 \; mov x,a \; mov a, %H1 \; shlw ax,%S2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
+
+ mov x,%Q1 \; mov a,%H1 \; movw %H0,ax \; movw ax,%1 \; shlw ax,8 \; movw %0,ax
+ mov a,%Q1 \; mov x,a \; mov a,%H1 \; movw %H0,ax \; movw ax,%1 \; shlw ax,8 \; movw %0,ax
+
+ mov x,%Q1 \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
+ mov x,%Q1 \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
+ mov a,%Q1 \; mov x,a \; mov a,%H1 \; shlw ax,%s2 \; movw %H0,ax \; movw ax,%1 \; shlw ax,%s2 \; mov %H0,a \; movw ax,%1 \; shlw ax,%u2 \; movw %0,ax
+
+ movw ax,%1 \; movw %H0,ax \; movw %0,#0
+ movw ax,%1 \; movw %H0,ax \; movw ax,#0 \; movw %0,ax
+
+ movw ax,%1 \; shlw ax,%S2 \; movw %H0,ax \; movw %0,#0
+ movw ax,%1 \; shlw ax,%S2 \; movw %H0,ax \; movw ax,#0 \; movw %0,ax
+
+ mov a,%1 \; movw %H0,ax \; mov %H0,#0 \; movw %0,#0
+ mov a,%1 \; movw %H0,ax \; movw ax,#0 \; mov %H0,a \; movW %0,ax
+
+ mov a,%1 \; shl a,%s2 \; movw %H0,ax \; mov %H0,#0 \; movw %0,#0
+ mov a,%1 \; shl a,%s2 \; movw %H0,ax \; movw ax,#0 \; mov %H0,a \; movW %0,ax
+
+ mov a,%2 \; cmp0 a \; bz $2f \; mov d,a \; movw ax,%H1 \; movw bc,%1 \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; movw %H0,ax \; movw ax,bc \; movw %0,ax \; 2:
+ mov a,%2 \; mov d,a \; movw ax,%H1 \; movw bc,%1 \; cmp0 0xFFEFD \; bz $2f \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; 2: \; movw %H0,ax \; movw ax,bc \; movw %0,ax
+ mov a,%2 \; mov d,a \; movw ax,%1 \; movw bc,ax \; movw ax,%H1 \; cmp0 0xFFEFD \; bz $2f \; 1: \; shlw bc,1 \; rolwc ax,1 \; dec d \; bnz $1b \; 2: \; movw %H0,ax \; movw ax,bc \; movw %0,ax"
+ [(set_attr "valloc" "macax")]
+ )
+
;;---------- Branching ------------------------
(define_insn "*indirect_jump_virt"
@@ -202,6 +312,18 @@
[(set_attr "valloc" "op1")]
)
+(define_insn "*cbranchqi4_virt_signed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_signed"
+ [(match_operand:QI 1 "general_operand" "vim")
+ (match_operand:QI 2 "nonmemory_operand" "vi")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "rl78_virt_insns_ok ()"
+ "v.cmp\t%1, %2\\n\tv.b%c0\t%3"
+ [(set_attr "valloc" "cmp")]
+ )
+
(define_insn "*cbranchqi4_virt"
[(set (pc) (if_then_else
(match_operator 0 "rl78_cmp_operator_real"
@@ -214,6 +336,18 @@
[(set_attr "valloc" "cmp")]
)
+(define_insn "*cbranchhi4_virt_signed"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator_signed"
+ [(match_operand:HI 1 "general_operand" "vim")
+ (match_operand:HI 2 "nonmemory_operand" "vi")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))]
+ "rl78_virt_insns_ok ()"
+ "v.cmpw\t%1, %2\\n\tv.b%c0\t%3"
+ [(set_attr "valloc" "cmp")]
+ )
+
(define_insn "*cbranchhi4_virt"
[(set (pc) (if_then_else
(match_operator 0 "rl78_cmp_operator_real"
@@ -226,6 +360,20 @@
[(set_attr "valloc" "cmp")]
)
+(define_insn "*cbranchsi4_virt"
+ [(set (pc) (if_then_else
+ (match_operator 0 "rl78_cmp_operator"
+ [(match_operand:SI 1 "general_operand" "vim")
+ (match_operand:SI 2 "nonmemory_operand" "vi")])
+ (label_ref (match_operand 3 "" ""))
+ (pc)))
+ (clobber (reg:HI AX_REG))
+ ]
+ "rl78_virt_insns_ok ()"
+ "v.cmpd\t%1, %2\\n\tv.b%c0\t%3"
+ [(set_attr "valloc" "macax")]
+ )
+
;;---------- Peepholes ------------------------
(define_peephole2
diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index d7cacc16352..fb987b2eae9 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -50,6 +50,8 @@
#include "dumpfile.h"
#include "tree-pass.h"
#include "context.h"
+#include "tm-constrs.h" /* for satisfies_constraint_*(). */
+#include "insn-flags.h" /* for gen_*(). */
static inline bool is_interrupt_func (const_tree decl);
static inline bool is_brk_interrupt_func (const_tree decl);
@@ -168,6 +170,89 @@ make_pass_rl78_devirt (gcc::context *ctxt)
return new pass_rl78_devirt (ctxt);
}
+/* Redundant move elimination pass. Must be run after the basic block
+ reordering pass for the best effect. */
+
+static unsigned int
+move_elim_pass (void)
+{
+ rtx insn, ninsn, prev = NULL_RTX;
+
+ for (insn = get_insns (); insn; insn = ninsn)
+ {
+ rtx set;
+
+ ninsn = next_nonnote_nondebug_insn (insn);
+
+ if ((set = single_set (insn)) == NULL_RTX)
+ {
+ prev = NULL_RTX;
+ continue;
+ }
+
+ /* If we have two SET insns in a row (without anything
+ between them) and the source of the second one is the
+ destination of the first one, and vice versa, then we
+ can eliminate the second SET. */
+ if (prev
+ && rtx_equal_p (SET_DEST (prev), SET_SRC (set))
+ && rtx_equal_p (SET_DEST (set), SET_SRC (prev))
+ )
+ {
+ if (dump_file)
+ fprintf (dump_file, " Delete insn %d because it is redundant\n",
+ INSN_UID (insn));
+
+ delete_insn (insn);
+ prev = NULL_RTX;
+ }
+ else
+ prev = set;
+ }
+
+ if (dump_file)
+ print_rtl_with_bb (dump_file, get_insns (), 0);
+
+ return 0;
+}
+
+namespace {
+
+const pass_data pass_data_rl78_move_elim =
+{
+ RTL_PASS, /* type */
+ "move_elim", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ true, /* has_gate */
+ true, /* has_execute */
+ TV_MACH_DEP, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_rl78_move_elim : public rtl_opt_pass
+{
+public:
+ pass_rl78_move_elim(gcc::context *ctxt)
+ : rtl_opt_pass(pass_data_rl78_move_elim, ctxt)
+ {
+ }
+
+ /* opt_pass methods: */
+ bool gate () { return devirt_gate (); }
+ unsigned int execute () { return move_elim_pass (); }
+};
+
+} // anon namespace
+
+rtl_opt_pass *
+make_pass_rl78_move_elim (gcc::context *ctxt)
+{
+ return new pass_rl78_move_elim (ctxt);
+}
#undef TARGET_ASM_FILE_START
#define TARGET_ASM_FILE_START rl78_asm_file_start
@@ -177,22 +262,43 @@ rl78_asm_file_start (void)
{
int i;
- for (i = 0; i < 8; i++)
+ if (TARGET_G10)
+ {
+ /* The memory used is 0xffec8 to 0xffedf; real registers are in
+ 0xffee0 to 0xffee7. */
+ for (i = 8; i < 32; i++)
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", i, 0xffec0 + i);
+ }
+ else
{
- fprintf (asm_out_file, "r%d\t=\t0x%x\n", 8 + i, 0xffef0 + i);
- fprintf (asm_out_file, "r%d\t=\t0x%x\n", 16 + i, 0xffee8 + i);
+ for (i = 0; i < 8; i++)
+ {
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", 8 + i, 0xffef0 + i);
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", 16 + i, 0xffee8 + i);
+ fprintf (asm_out_file, "r%d\t=\t0x%x\n", 24 + i, 0xffee0 + i);
+ }
}
opt_pass *rl78_devirt_pass = make_pass_rl78_devirt (g);
- struct register_pass_info rl78_devirt_info =
+ static struct register_pass_info rl78_devirt_info =
{
rl78_devirt_pass,
- "vartrack",
+ "pro_and_epilogue",
1,
PASS_POS_INSERT_BEFORE
};
+ opt_pass *rl78_move_elim_pass = make_pass_rl78_move_elim (g);
+ static struct register_pass_info rl78_move_elim_info =
+ {
+ rl78_move_elim_pass,
+ "bbro",
+ 1,
+ PASS_POS_INSERT_AFTER
+ };
+
register_pass (& rl78_devirt_info);
+ register_pass (& rl78_move_elim_info);
}
@@ -207,6 +313,14 @@ rl78_option_override (void)
flag_split_wide_types = 0;
init_machine_status = rl78_init_machine_status;
+
+ if (TARGET_ALLREGS)
+ {
+ int i;
+
+ for (i = 24; i < 32; i++)
+ fixed_regs[i] = 0;
+ }
}
/* Most registers are 8 bits. Some are 16 bits because, for example,
@@ -332,6 +446,47 @@ rl78_expand_movsi (rtx *operands)
}
}
+/* Generate code to move an SImode value. */
+void
+rl78_split_movsi (rtx *operands)
+{
+ rtx op00, op02, op10, op12;
+
+ op00 = rl78_subreg (HImode, operands[0], SImode, 0);
+ op02 = rl78_subreg (HImode, operands[0], SImode, 2);
+
+ if (GET_CODE (operands[1]) == CONST
+ || GET_CODE (operands[1]) == SYMBOL_REF)
+ {
+ op10 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16), GEN_INT (0));
+ op10 = gen_rtx_CONST (HImode, op10);
+ op12 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16), GEN_INT (16));
+ op12 = gen_rtx_CONST (HImode, op12);
+ }
+ else
+ {
+ op10 = rl78_subreg (HImode, operands[1], SImode, 0);
+ op12 = rl78_subreg (HImode, operands[1], SImode, 2);
+ }
+
+ if (rtx_equal_p (operands[0], operands[1]))
+ ;
+ else if (rtx_equal_p (op00, op12))
+ {
+ operands[2] = op02;
+ operands[4] = op12;
+ operands[3] = op00;
+ operands[5] = op10;
+ }
+ else
+ {
+ operands[2] = op00;
+ operands[4] = op10;
+ operands[3] = op02;
+ operands[5] = op12;
+ }
+}
+
/* Used by various two-operand expanders which cannot accept all
operands in the "far" namespace. Force some such operands into
registers so that each pattern has at most one far operand. */
@@ -398,34 +553,43 @@ rl78_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to ATTRIBUTE_UNUS
return true;
}
-/* Returns nonzero if the given register needs to be saved by the
+/* Returns true if the given register needs to be saved by the
current function. */
-static int
-need_to_save (int regno)
+static bool
+need_to_save (unsigned int regno)
{
if (is_interrupt_func (cfun->decl))
{
+ /* We don't know what devirt will need */
if (regno < 8)
- return 1; /* don't know what devirt will need */
+ return true;
+
+ /* We don't need to save registers that have
+ been reserved for interrupt handlers. */
if (regno > 23)
- return 0; /* don't need to save interrupt registers */
- if (crtl->is_leaf)
- {
- return df_regs_ever_live_p (regno);
- }
- else
- return 1;
+ return false;
+
+ /* If the handler is a non-leaf function then it may call
+ non-interrupt aware routines which will happily clobber
+ any call_used registers, so we have to preserve them. */
+ if (!crtl->is_leaf && call_used_regs[regno])
+ return true;
+
+ /* Otherwise we only have to save a register, call_used
+ or not, if it is used by this handler. */
+ return df_regs_ever_live_p (regno);
}
+
if (regno == FRAME_POINTER_REGNUM && frame_pointer_needed)
- return 1;
+ return true;
if (fixed_regs[regno])
- return 0;
+ return false;
if (crtl->calls_eh_return)
- return 1;
+ return true;
if (df_regs_ever_live_p (regno)
&& !call_used_regs[regno])
- return 1;
- return 0;
+ return true;
+ return false;
}
/* We use this to wrap all emitted insns in the prologue. */
@@ -541,6 +705,10 @@ characterize_address (rtx x, rtx *base, rtx *index, rtx *addend)
*index = NULL_RTX;
*addend = NULL_RTX;
+ if (GET_CODE (x) == UNSPEC
+ && XINT (x, 1) == UNS_ES_ADDR)
+ x = XVECEXP (x, 0, 1);
+
if (GET_CODE (x) == REG)
{
*base = x;
@@ -646,11 +814,11 @@ rl78_hl_b_c_addr_p (rtx op)
int
rl78_far_p (rtx x)
{
- if (GET_CODE (x) != MEM)
+ if (! MEM_P (x))
return 0;
#if DEBUG0
- fprintf(stderr, "\033[35mrl78_far_p: "); debug_rtx(x);
- fprintf(stderr, " = %d\033[0m\n", MEM_ADDR_SPACE (x) == ADDR_SPACE_FAR);
+ fprintf (stderr, "\033[35mrl78_far_p: "); debug_rtx(x);
+ fprintf (stderr, " = %d\033[0m\n", MEM_ADDR_SPACE (x) == ADDR_SPACE_FAR);
#endif
return MEM_ADDR_SPACE (x) == ADDR_SPACE_FAR;
}
@@ -715,9 +883,17 @@ rl78_as_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x,
bool strict ATTRIBUTE_UNUSED, addr_space_t as ATTRIBUTE_UNUSED)
{
rtx base, index, addend;
+ bool is_far_addr = false;
+
+ if (GET_CODE (x) == UNSPEC
+ && XINT (x, 1) == UNS_ES_ADDR)
+ {
+ x = XVECEXP (x, 0, 1);
+ is_far_addr = true;
+ }
if (as == ADDR_SPACE_GENERIC
- && GET_MODE (x) == SImode)
+ && (GET_MODE (x) == SImode || is_far_addr))
return false;
if (! characterize_address (x, &base, &index, &addend))
@@ -744,6 +920,10 @@ rl78_as_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x,
if (strict && base && GET_CODE (base) == REG && REGNO (base) >= FIRST_PSEUDO_REGISTER)
return false;
+ if (! cfun->machine->virt_insns_ok && base && GET_CODE (base) == REG
+ && REGNO (base) >= 8 && REGNO (base) <= 31)
+ return false;
+
return true;
}
@@ -789,8 +969,6 @@ rl78_addr_space_convert (rtx op, tree from_type, tree to_type)
{
/* This always works. */
result = gen_reg_rtx (SImode);
- debug_rtx(result);
- debug_rtx(op);
emit_move_insn (rl78_subreg (HImode, result, SImode, 0), op);
emit_move_insn (rl78_subreg (HImode, result, SImode, 2), const0_rtx);
return result;
@@ -878,32 +1056,52 @@ rl78_expand_prologue (void)
if (rl78_is_naked_func ())
return;
- if (!cfun->machine->computed)
- rl78_compute_frame_info ();
+ /* Always re-compute the frame info - the register usage may have changed. */
+ rl78_compute_frame_info ();
if (flag_stack_usage_info)
current_function_static_stack_size = cfun->machine->framesize;
- if (is_interrupt_func (cfun->decl))
- emit_insn (gen_sel_rb (GEN_INT (0)));
+ if (is_interrupt_func (cfun->decl) && !TARGET_G10)
+ for (i = 0; i < 4; i++)
+ if (cfun->machine->need_to_push [i])
+ {
+ /* Select Bank 0 if we are using any registers from Bank 0. */
+ emit_insn (gen_sel_rb (GEN_INT (0)));
+ break;
+ }
for (i = 0; i < 16; i++)
if (cfun->machine->need_to_push [i])
{
- int need_bank = i/4;
- if (need_bank != rb)
+ if (TARGET_G10)
{
- emit_insn (gen_sel_rb (GEN_INT (need_bank)));
- rb = need_bank;
+ emit_move_insn (gen_rtx_REG (HImode, 0), gen_rtx_REG (HImode, i*2));
+ F (emit_insn (gen_push (gen_rtx_REG (HImode, 0))));
+ }
+ else
+ {
+ int need_bank = i/4;
+
+ if (need_bank != rb)
+ {
+ emit_insn (gen_sel_rb (GEN_INT (need_bank)));
+ rb = need_bank;
+ }
+ F (emit_insn (gen_push (gen_rtx_REG (HImode, i*2))));
}
- F (emit_insn (gen_push (gen_rtx_REG (HImode, i*2))));
}
+
if (rb != 0)
emit_insn (gen_sel_rb (GEN_INT (0)));
if (frame_pointer_needed)
- F (emit_move_insn (gen_rtx_REG (HImode, FRAME_POINTER_REGNUM),
- gen_rtx_REG (HImode, STACK_POINTER_REGNUM)));
+ {
+ F (emit_move_insn (gen_rtx_REG (HImode, AX_REG),
+ gen_rtx_REG (HImode, STACK_POINTER_REGNUM)));
+ F (emit_move_insn (gen_rtx_REG (HImode, FRAME_POINTER_REGNUM),
+ gen_rtx_REG (HImode, AX_REG)));
+ }
fs = cfun->machine->framesize_locals + cfun->machine->framesize_outgoing;
while (fs > 0)
@@ -927,8 +1125,10 @@ rl78_expand_epilogue (void)
if (frame_pointer_needed)
{
- emit_move_insn (gen_rtx_REG (HImode, STACK_POINTER_REGNUM),
+ emit_move_insn (gen_rtx_REG (HImode, AX_REG),
gen_rtx_REG (HImode, FRAME_POINTER_REGNUM));
+ emit_move_insn (gen_rtx_REG (HImode, STACK_POINTER_REGNUM),
+ gen_rtx_REG (HImode, AX_REG));
}
else
{
@@ -945,14 +1145,22 @@ rl78_expand_epilogue (void)
for (i = 15; i >= 0; i--)
if (cfun->machine->need_to_push [i])
{
- int need_bank = i / 4;
-
- if (need_bank != rb)
+ if (TARGET_G10)
{
- emit_insn (gen_sel_rb (GEN_INT (need_bank)));
- rb = need_bank;
+ emit_insn (gen_pop (gen_rtx_REG (HImode, 0)));
+ emit_move_insn (gen_rtx_REG (HImode, i*2), gen_rtx_REG (HImode, 0));
+ }
+ else
+ {
+ int need_bank = i / 4;
+
+ if (need_bank != rb)
+ {
+ emit_insn (gen_sel_rb (GEN_INT (need_bank)));
+ rb = need_bank;
+ }
+ emit_insn (gen_pop (gen_rtx_REG (HImode, i * 2)));
}
- emit_insn (gen_pop (gen_rtx_REG (HImode, i * 2)));
}
if (rb != 0)
@@ -998,7 +1206,7 @@ rl78_start_function (FILE *file, HOST_WIDE_INT hwi_local ATTRIBUTE_UNUSED)
for (i = 0; i < 16; i ++)
if (cfun->machine->need_to_push[i])
fprintf (file, " %s", word_regnames[i*2]);
- fprintf(file, "\n");
+ fprintf (file, "\n");
}
if (frame_pointer_needed)
@@ -1094,12 +1302,18 @@ rl78_function_arg_boundary (enum machine_mode mode ATTRIBUTE_UNUSED,
v - real register corresponding to a virtual register
m - minus - negative of CONST_INT value.
c - inverse of a conditional (NE vs EQ for example)
+ z - collapsed conditional
+ s - shift count mod 8
+ S - shift count mod 16
+ r - reverse shift count (8-(count mod 8))
+ B - bit position
h - bottom HI of an SI
H - top HI of an SI
q - bottom QI of an HI
Q - top QI of an HI
e - third QI of an SI (i.e. where the ES register gets values from)
+ E - fourth QI of an SI (i.e. MSB)
*/
@@ -1120,7 +1334,10 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
else
{
if (rl78_far_p (op))
- fprintf(file, "es:");
+ {
+ fprintf (file, "es:");
+ op = gen_rtx_MEM (GET_MODE (op), XVECEXP (XEXP (op, 0), 0, 1));
+ }
if (letter == 'H')
{
op = adjust_address (op, HImode, 2);
@@ -1146,15 +1363,20 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
op = adjust_address (op, QImode, 2);
letter = 0;
}
+ if (letter == 'E')
+ {
+ op = adjust_address (op, QImode, 3);
+ letter = 0;
+ }
if (CONSTANT_P (XEXP (op, 0)))
{
- fprintf(file, "!");
+ fprintf (file, "!");
rl78_print_operand_1 (file, XEXP (op, 0), letter);
}
else if (GET_CODE (XEXP (op, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF)
{
- fprintf(file, "!");
+ fprintf (file, "!");
rl78_print_operand_1 (file, XEXP (op, 0), letter);
}
else if (GET_CODE (XEXP (op, 0)) == PLUS
@@ -1162,15 +1384,15 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
&& REGNO (XEXP (XEXP (op, 0), 0)) == 2)
{
rl78_print_operand_1 (file, XEXP (XEXP (op, 0), 1), 'u');
- fprintf(file, "[");
+ fprintf (file, "[");
rl78_print_operand_1 (file, XEXP (XEXP (op, 0), 0), 0);
- fprintf(file, "]");
+ fprintf (file, "]");
}
else
{
- fprintf(file, "[");
+ fprintf (file, "[");
rl78_print_operand_1 (file, XEXP (op, 0), letter);
- fprintf(file, "]");
+ fprintf (file, "]");
}
}
break;
@@ -1184,6 +1406,8 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
fprintf (file, "%s", reg_names [REGNO (op) & ~1]);
else if (letter == 'e')
fprintf (file, "%s", reg_names [REGNO (op) + 2]);
+ else if (letter == 'E')
+ fprintf (file, "%s", reg_names [REGNO (op) + 3]);
else if (letter == 'S')
fprintf (file, "0x%x", 0xffef8 + REGNO (op));
else if (GET_MODE (op) == HImode
@@ -1209,10 +1433,22 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
fprintf (file, "%ld", INTVAL (op) & 0xffff);
else if (letter == 'e')
fprintf (file, "%ld", (INTVAL (op) >> 16) & 0xff);
+ else if (letter == 'B')
+ fprintf (file, "%d", exact_log2 (INTVAL (op)));
+ else if (letter == 'E')
+ fprintf (file, "%ld", (INTVAL (op) >> 24) & 0xff);
else if (letter == 'm')
fprintf (file, "%ld", - INTVAL (op));
+ else if (letter == 's')
+ fprintf (file, "%ld", INTVAL (op) % 8);
+ else if (letter == 'S')
+ fprintf (file, "%ld", INTVAL (op) % 16);
+ else if (letter == 'r')
+ fprintf (file, "%ld", 8 - (INTVAL (op) % 8));
+ else if (letter == 'C')
+ fprintf (file, "%ld", (INTVAL (op) ^ 0x8000) & 0xffff);
else
- fprintf(file, "%ld", INTVAL (op));
+ fprintf (file, "%ld", INTVAL (op));
break;
case CONST:
@@ -1316,22 +1552,68 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
break;
case LTU:
- fprintf (file, letter == 'c' ? "nc" : "c");
+ if (letter == 'z')
+ fprintf (file, "#comparison eliminated");
+ else
+ fprintf (file, letter == 'c' ? "nc" : "c");
break;
case LEU:
- fprintf (file, letter == 'c' ? "h" : "nh");
+ if (letter == 'z')
+ fprintf (file, "br");
+ else
+ fprintf (file, letter == 'c' ? "h" : "nh");
break;
case GEU:
- fprintf (file, letter == 'c' ? "c" : "nc");
+ if (letter == 'z')
+ fprintf (file, "br");
+ else
+ fprintf (file, letter == 'c' ? "c" : "nc");
break;
case GTU:
- fprintf (file, letter == 'c' ? "nh" : "h");
+ if (letter == 'z')
+ fprintf (file, "#comparison eliminated");
+ else
+ fprintf (file, letter == 'c' ? "nh" : "h");
break;
case EQ:
- fprintf (file, letter == 'c' ? "nz" : "z");
+ if (letter == 'z')
+ fprintf (file, "br");
+ else
+ fprintf (file, letter == 'c' ? "nz" : "z");
break;
case NE:
- fprintf (file, letter == 'c' ? "z" : "nz");
+ if (letter == 'z')
+ fprintf (file, "#comparison eliminated");
+ else
+ fprintf (file, letter == 'c' ? "z" : "nz");
+ break;
+
+ /* Note: these assume appropriate adjustments were made so that
+ unsigned comparisons, which is all this chip has, will
+ work. */
+ case LT:
+ if (letter == 'z')
+ fprintf (file, "#comparison eliminated");
+ else
+ fprintf (file, letter == 'c' ? "nc" : "c");
+ break;
+ case LE:
+ if (letter == 'z')
+ fprintf (file, "br");
+ else
+ fprintf (file, letter == 'c' ? "h" : "nh");
+ break;
+ case GE:
+ if (letter == 'z')
+ fprintf (file, "br");
+ else
+ fprintf (file, letter == 'c' ? "c" : "nc");
+ break;
+ case GT:
+ if (letter == 'z')
+ fprintf (file, "#comparison eliminated");
+ else
+ fprintf (file, letter == 'c' ? "nh" : "h");
break;
default:
@@ -1346,7 +1628,7 @@ rl78_print_operand_1 (FILE * file, rtx op, int letter)
static void
rl78_print_operand (FILE * file, rtx op, int letter)
{
- if (CONSTANT_P (op) && letter != 'u')
+ if (CONSTANT_P (op) && letter != 'u' && letter != 's' && letter != 'r' && letter != 'S' && letter != 'B')
fprintf (file, "#");
rl78_print_operand_1 (file, op, letter);
}
@@ -1391,66 +1673,8 @@ rl78_trampoline_adjust_address (rtx m_tramp)
void
rl78_expand_compare (rtx *operands)
{
- /* RL78 does not have signed comparisons. We must modify the
- operands to be in the unsigned range, and emit an unsigned
- comparison. */
-
- enum machine_mode mode;
- rtx high_bit;
- int i;
- RTX_CODE new_cond;
-
- switch (GET_CODE (operands[0]))
- {
- case GE:
- new_cond = GEU;
- break;
- case LE:
- new_cond = LEU;
- break;
- case GT:
- new_cond = GTU;
- break;
- case LT:
- new_cond = LTU;
- break;
- default:
- return;
- }
-
-#if DEBUG0
- fprintf (stderr, "\033[38;5;129mrl78_expand_compare\n");
- debug_rtx (operands[0]);
- fprintf (stderr, "\033[0m");
-#endif
-
- mode = GET_MODE (operands[1]);
- if (mode == VOIDmode)
- mode = GET_MODE (operands[2]);
- high_bit = GEN_INT (~0 << (GET_MODE_BITSIZE (mode) - 1));
-
- /* 0: conditional 1,2: operands */
- for (i = 1; i <= 2; i ++)
- {
- rtx r = operands[i];
-
- if (GET_CODE (r) == CONST_INT)
- r = GEN_INT (INTVAL (r) ^ INTVAL (high_bit));
- else
- {
- r = gen_rtx_PLUS (mode, operands[i], high_bit);
- r = copy_to_mode_reg (mode, r);
- }
- operands[i] = r;
- }
-
- operands[0] = gen_rtx_fmt_ee (new_cond, GET_MODE (operands[0]), operands[1], operands[2]);
-
-#if DEBUG0
- fprintf (stderr, "\033[38;5;142mrl78_expand_compare\n");
- debug_rtx (operands[0]);
- fprintf (stderr, "\033[0m");
-#endif
+ if (GET_CODE (operands[2]) == MEM)
+ operands[2] = copy_to_mode_reg (GET_MODE (operands[2]), operands[2]);
}
@@ -1471,15 +1695,28 @@ rl78_peep_movhi_p (rtx *operands)
/* (set (op0) (op1))
(set (op2) (op3)) */
+ if (! rl78_virt_insns_ok ())
+ return false;
+
#if DEBUG_PEEP
fprintf (stderr, "\033[33m");
- debug_rtx(operands[0]);
- debug_rtx(operands[1]);
- debug_rtx(operands[2]);
- debug_rtx(operands[3]);
+ debug_rtx (operands[0]);
+ debug_rtx (operands[1]);
+ debug_rtx (operands[2]);
+ debug_rtx (operands[3]);
fprintf (stderr, "\033[0m");
#endif
+ /* You can move a constant to memory as QImode, but not HImode. */
+ if (GET_CODE (operands[0]) == MEM
+ && GET_CODE (operands[1]) != REG)
+ {
+#if DEBUG_PEEP
+ fprintf (stderr, "no peep: move constant to memory\n");
+#endif
+ return false;
+ }
+
if (rtx_equal_p (operands[0], operands[3]))
{
#if DEBUG_PEEP
@@ -1662,14 +1899,269 @@ re-run regmove, but that has not yet been attempted.
*/
#define DEBUG_ALLOC 0
+#define OP(x) (*recog_data.operand_loc[x])
+
+/* This array is used to hold knowledge about the contents of the
+ real registers (A ... H), the memory-based registers (r8 ... r31)
+ and the first NUM_STACK_LOCS words on the stack. We use this to
+ avoid generating redundant move instructions.
+
+ A value in the range 0 .. 31 indicates register A .. r31.
+ A value in the range 32 .. 63 indicates stack slot (value - 32).
+ A value of NOT_KNOWN indicates that the contents of that location
+ are not known. */
+
+#define NUM_STACK_LOCS 32
+#define NOT_KNOWN 127
+
+static unsigned char content_memory [32 + NUM_STACK_LOCS];
+
+static unsigned char saved_update_index = NOT_KNOWN;
+static unsigned char saved_update_value;
+static enum machine_mode saved_update_mode;
+
+
+static inline void
+clear_content_memory (void)
+{
+ memset (content_memory, NOT_KNOWN, sizeof content_memory);
+ if (dump_file)
+ fprintf (dump_file, " clear content memory\n");
+ saved_update_index = NOT_KNOWN;
+}
+
+/* Convert LOC into an index into the content_memory array.
+ If LOC cannot be converted, return NOT_KNOWN. */
+
+static unsigned char
+get_content_index (rtx loc)
+{
+ enum machine_mode mode;
+
+ if (loc == NULL_RTX)
+ return NOT_KNOWN;
+
+ if (REG_P (loc))
+ {
+ if (REGNO (loc) < 32)
+ return REGNO (loc);
+ return NOT_KNOWN;
+ }
+
+ mode = GET_MODE (loc);
+
+ if (! rl78_stack_based_mem (loc, mode))
+ return NOT_KNOWN;
+
+ loc = XEXP (loc, 0);
+
+ if (REG_P (loc))
+ /* loc = MEM (SP) */
+ return 32;
+
+ /* loc = MEM (PLUS (SP, INT)). */
+ loc = XEXP (loc, 1);
+
+ if (INTVAL (loc) < NUM_STACK_LOCS)
+ return 32 + INTVAL (loc);
+
+ return NOT_KNOWN;
+}
+
+/* Return a string describing content INDEX in mode MODE.
+ WARNING: Can return a pointer to a static buffer. */
+static const char *
+get_content_name (unsigned char index, enum machine_mode mode)
+{
+ static char buffer [128];
+
+ if (index == NOT_KNOWN)
+ return "Unknown";
+
+ if (index > 31)
+ sprintf (buffer, "stack slot %d", index - 32);
+ else if (mode == HImode)
+ sprintf (buffer, "%s%s",
+ reg_names [index + 1], reg_names [index]);
+ else
+ return reg_names [index];
+
+ return buffer;
+}
+
+#if DEBUG_ALLOC
+
+static void
+display_content_memory (FILE * file)
+{
+ unsigned int i;
+
+ fprintf (file, " Known memory contents:\n");
+
+ for (i = 0; i < sizeof content_memory; i++)
+ if (content_memory[i] != NOT_KNOWN)
+ {
+ fprintf (file, " %s contains a copy of ", get_content_name (i, QImode));
+ fprintf (file, "%s\n", get_content_name (content_memory [i], QImode));
+ }
+}
+#endif
+
+static void
+update_content (unsigned char index, unsigned char val, enum machine_mode mode)
+{
+ unsigned int i;
+
+ gcc_assert (index < sizeof content_memory);
+
+ content_memory [index] = val;
+ if (val != NOT_KNOWN)
+ content_memory [val] = index;
+
+ /* Make the entry in dump_file *before* VAL is increased below. */
+ if (dump_file)
+ {
+ fprintf (dump_file, " %s now contains ", get_content_name (index, mode));
+ if (val == NOT_KNOWN)
+ fprintf (dump_file, "Unknown\n");
+ else
+ fprintf (dump_file, "%s and vice versa\n", get_content_name (val, mode));
+ }
+
+ if (mode == HImode)
+ {
+ val = val == NOT_KNOWN ? val : val + 1;
+
+ content_memory [index + 1] = val;
+ if (val != NOT_KNOWN)
+ {
+ content_memory [val] = index + 1;
+ -- val;
+ }
+ }
+
+ /* Any other places that had INDEX recorded as their contents are now invalid. */
+ for (i = 0; i < sizeof content_memory; i++)
+ {
+ if (i == index
+ || (val != NOT_KNOWN && i == val))
+ {
+ if (mode == HImode)
+ ++ i;
+ continue;
+ }
+
+ if (content_memory[i] == index
+ || (val != NOT_KNOWN && content_memory[i] == val))
+ {
+ content_memory[i] = NOT_KNOWN;
+
+ if (dump_file)
+ fprintf (dump_file, " %s cleared\n", get_content_name (i, mode));
+
+ if (mode == HImode)
+ content_memory[++ i] = NOT_KNOWN;
+ }
+ }
+}
+
+/* Record that LOC contains VALUE.
+ For HImode locations record that LOC+1 contains VALUE+1.
+ If LOC is not a register or stack slot, do nothing.
+ If VALUE is not a register or stack slot, clear the recorded content. */
+
+static void
+record_content (rtx loc, rtx value)
+{
+ enum machine_mode mode;
+ unsigned char index;
+ unsigned char val;
+
+ if ((index = get_content_index (loc)) == NOT_KNOWN)
+ return;
+
+ val = get_content_index (value);
+
+ mode = GET_MODE (loc);
+
+ if (val == index)
+ {
+ if (! optimize)
+ return;
+
+ /* This should not happen when optimizing. */
+#if 1
+ fprintf (stderr, "ASSIGNMENT of location to itself detected! [%s]\n",
+ get_content_name (val, mode));
+ return;
+#else
+ gcc_unreachable ();
+#endif
+ }
+
+ update_content (index, val, mode);
+}
+
+/* Returns TRUE if LOC already contains a copy of VALUE. */
+
+static bool
+already_contains (rtx loc, rtx value)
+{
+ unsigned char index;
+ unsigned char val;
+
+ if ((index = get_content_index (loc)) == NOT_KNOWN)
+ return false;
+
+ if ((val = get_content_index (value)) == NOT_KNOWN)
+ return false;
+
+ if (content_memory [index] != val)
+ return false;
+
+ if (GET_MODE (loc) == HImode)
+ return content_memory [index + 1] == val + 1;
+
+ return true;
+}
+
+bool
+rl78_es_addr (rtx addr)
+{
+ if (GET_CODE (addr) == MEM)
+ addr = XEXP (addr, 0);
+ if (GET_CODE (addr) != UNSPEC)
+ return false;
+ if (XINT (addr, 1) != UNS_ES_ADDR)
+ return false;
+ return true;
+}
+
+rtx
+rl78_es_base (rtx addr)
+{
+ if (GET_CODE (addr) == MEM)
+ addr = XEXP (addr, 0);
+ addr = XVECEXP (addr, 0, 1);
+ if (GET_CODE (addr) == CONST
+ && GET_CODE (XEXP (addr, 0)) == ZERO_EXTRACT)
+ addr = XEXP (XEXP (addr, 0), 0);
+ /* Mode doesn't matter here. */
+ return gen_rtx_MEM (HImode, addr);
+}
+
/* Rescans an insn to see if it's recognized again. This is done
carefully to ensure that all the constraint information is accurate
for the newly matched insn. */
static bool
insn_ok_now (rtx insn)
{
+ rtx pattern = PATTERN (insn);
+ int i;
+
INSN_CODE (insn) = -1;
- if (recog (PATTERN (insn), insn, 0) > -1)
+
+ if (recog (pattern, insn, 0) > -1)
{
extract_insn (insn);
if (constrain_operands (1))
@@ -1679,15 +2171,42 @@ insn_ok_now (rtx insn)
debug_rtx (insn);
fprintf (stderr, "\033[0m");
#endif
+ if (SET_P (pattern))
+ record_content (SET_DEST (pattern), SET_SRC (pattern));
+
+ /* We need to detect far addresses that haven't been
+ converted to es/lo16 format. */
+ for (i=0; i<recog_data.n_operands; i++)
+ if (GET_CODE (OP (i)) == MEM
+ && GET_MODE (XEXP (OP (i), 0)) == SImode
+ && GET_CODE (XEXP (OP (i), 0)) != UNSPEC)
+ return false;
+
return true;
}
}
else
{
- fprintf (stderr, "\033[41;30m Unrecognized insn \033[0m\n");
+ /* We need to re-recog the insn with virtual registers to get
+ the operands. */
+ cfun->machine->virt_insns_ok = 1;
+ if (recog (pattern, insn, 0) > -1)
+ {
+ extract_insn (insn);
+ if (constrain_operands (0))
+ {
+ cfun->machine->virt_insns_ok = 0;
+ return false;
+ }
+ }
+
+#if DEBUG_ALLOC
+ fprintf (stderr, "\033[41;30m Unrecognized *virtual* insn \033[0m\n");
debug_rtx (insn);
+#endif
gcc_unreachable ();
}
+
#if DEBUG_ALLOC
fprintf (stderr, "\033[31m");
debug_rtx (insn);
@@ -1697,41 +2216,39 @@ insn_ok_now (rtx insn)
}
#if DEBUG_ALLOC
-#define WORKED fprintf (stderr, "\033[48;5;22m Worked at line %d \033[0m\n", __LINE__)
+#define WORKED fprintf (stderr, "\033[48;5;22m Worked at line %d \033[0m\n", __LINE__)
#define FAILEDSOFAR fprintf (stderr, "\033[48;5;52m FAILED at line %d \033[0m\n", __LINE__)
-#define FAILED fprintf (stderr, "\033[48;5;52m FAILED at line %d \033[0m\n", __LINE__), gcc_unreachable()
+#define FAILED fprintf (stderr, "\033[48;5;52m FAILED at line %d \033[0m\n", __LINE__), gcc_unreachable()
#define MAYBE_OK(insn) if (insn_ok_now (insn)) { WORKED; return; } else { FAILEDSOFAR; }
+#define MUST_BE_OK(insn) if (insn_ok_now (insn)) { WORKED; return; } FAILED
#else
-#define WORKED
-#define FAILEDSOFAR
#define FAILED gcc_unreachable ()
#define MAYBE_OK(insn) if (insn_ok_now (insn)) return;
+#define MUST_BE_OK(insn) if (insn_ok_now (insn)) return; FAILED
#endif
/* Registers into which we move the contents of virtual registers. */
-#define X gen_rtx_REG (QImode, 0)
-#define A gen_rtx_REG (QImode, 1)
-#define C gen_rtx_REG (QImode, 2)
-#define B gen_rtx_REG (QImode, 3)
-#define E gen_rtx_REG (QImode, 4)
-#define D gen_rtx_REG (QImode, 5)
-#define L gen_rtx_REG (QImode, 6)
-#define H gen_rtx_REG (QImode, 7)
-
-#define AX gen_rtx_REG (HImode, 0)
-#define BC gen_rtx_REG (HImode, 2)
-#define DE gen_rtx_REG (HImode, 4)
-#define HL gen_rtx_REG (HImode, 6)
-
-#define OP(x) (*recog_data.operand_loc[x])
+#define X gen_rtx_REG (QImode, X_REG)
+#define A gen_rtx_REG (QImode, A_REG)
+#define C gen_rtx_REG (QImode, C_REG)
+#define B gen_rtx_REG (QImode, B_REG)
+#define E gen_rtx_REG (QImode, E_REG)
+#define D gen_rtx_REG (QImode, D_REG)
+#define L gen_rtx_REG (QImode, L_REG)
+#define H gen_rtx_REG (QImode, H_REG)
+
+#define AX gen_rtx_REG (HImode, AX_REG)
+#define BC gen_rtx_REG (HImode, BC_REG)
+#define DE gen_rtx_REG (HImode, DE_REG)
+#define HL gen_rtx_REG (HImode, HL_REG)
/* Returns TRUE if R is a virtual register. */
-static bool
+static inline bool
is_virtual_register (rtx r)
{
return (GET_CODE (r) == REG
&& REGNO (r) >= 8
- && REGNO (r) < 24);
+ && REGNO (r) < 32);
}
/* In all these alloc routines, we expect the following: the insn
@@ -1763,14 +2280,20 @@ EM2 (int line ATTRIBUTE_UNUSED, rtx r)
static rtx
rl78_lo16 (rtx addr)
{
+ rtx r;
+
if (GET_CODE (addr) == SYMBOL_REF
|| GET_CODE (addr) == CONST)
{
- rtx r = gen_rtx_ZERO_EXTRACT (HImode, addr, GEN_INT (16), GEN_INT (0));
+ r = gen_rtx_ZERO_EXTRACT (HImode, addr, GEN_INT (16), GEN_INT (0));
r = gen_rtx_CONST (HImode, r);
- return r;
}
- return rl78_subreg (HImode, addr, SImode, 0);
+ else
+ r = rl78_subreg (HImode, addr, SImode, 0);
+
+ r = gen_es_addr (r);
+
+ return r;
}
/* Return a suitable RTX for the high half's lower byte of a __far address. */
@@ -1787,35 +2310,123 @@ rl78_hi8 (rtx addr)
return rl78_subreg (QImode, addr, SImode, 2);
}
-/* Copy any register values into real registers and return an RTX for
- the same memory, now addressed by real registers. Any needed insns
- are emitted before BEFORE. */
+static void
+add_postponed_content_update (rtx to, rtx value)
+{
+ unsigned char index;
+
+ if ((index = get_content_index (to)) == NOT_KNOWN)
+ return;
+
+ gcc_assert (saved_update_index == NOT_KNOWN);
+ saved_update_index = index;
+ saved_update_value = get_content_index (value);
+ saved_update_mode = GET_MODE (to);
+}
+
+static void
+process_postponed_content_update (void)
+{
+ if (saved_update_index != NOT_KNOWN)
+ {
+ update_content (saved_update_index, saved_update_value, saved_update_mode);
+ saved_update_index = NOT_KNOWN;
+ }
+}
+
+/* Generate and emit a move of (register) FROM into TO. if WHERE is not NULL
+ then if BEFORE is true then emit the insn before WHERE, otherwise emit it
+ after WHERE. If TO already contains FROM then do nothing. Returns TO if
+ BEFORE is true, FROM otherwise. */
+static rtx
+gen_and_emit_move (rtx to, rtx from, rtx where, bool before)
+{
+ enum machine_mode mode = GET_MODE (to);
+
+ if (optimize && before && already_contains (to, from))
+ {
+#if DEBUG_ALLOC
+ display_content_memory (stderr);
+#endif
+ if (dump_file)
+ {
+ fprintf (dump_file, " Omit move of %s into ",
+ get_content_name (get_content_index (from), mode));
+ fprintf (dump_file, "%s as it already contains this value\n",
+ get_content_name (get_content_index (to), mode));
+ }
+ }
+ else
+ {
+ rtx move = mode == QImode ? gen_movqi (to, from) : gen_movhi (to, from);
+
+ EM (move);
+
+ if (where == NULL_RTX)
+ emit_insn (move);
+ else if (before)
+ emit_insn_before (move, where);
+ else
+ {
+ rtx note = find_reg_note (where, REG_EH_REGION, NULL_RTX);
+
+ /* If necessary move REG_EH_REGION notes forward.
+ cf. compiling gcc.dg/pr44545.c. */
+ if (note != NULL_RTX)
+ {
+ add_reg_note (move, REG_EH_REGION, XEXP (note, 0));
+ remove_note (where, note);
+ }
+
+ emit_insn_after (move, where);
+ }
+
+ if (before)
+ record_content (to, from);
+ else
+ add_postponed_content_update (to, from);
+ }
+
+ return before ? to : from;
+}
+
+/* If M is MEM(REG) or MEM(PLUS(REG,INT)) and REG is virtual then
+ copy it into NEWBASE and return the updated MEM. Otherwise just
+ return M. Any needed insns are emitted before BEFORE. */
static rtx
transcode_memory_rtx (rtx m, rtx newbase, rtx before)
{
rtx base, index, addendr;
int addend = 0;
+ int need_es = 0;
- if (GET_CODE (m) != MEM)
+ if (! MEM_P (m))
return m;
if (GET_MODE (XEXP (m, 0)) == SImode)
{
+ rtx new_m;
rtx seg = rl78_hi8 (XEXP (m, 0));
+
#if DEBUG_ALLOC
fprintf (stderr, "setting ES:\n");
debug_rtx(seg);
#endif
- emit_insn_before (EM(gen_movqi (A, seg)), before);
- emit_insn_before (EM(gen_movqi_es (A)), before);
- m = change_address (m, GET_MODE (m), rl78_lo16 (XEXP (m, 0)));
+ emit_insn_before (EM (gen_movqi (A, seg)), before);
+ emit_insn_before (EM (gen_movqi_es (A)), before);
+ record_content (A, NULL_RTX);
+
+ new_m = gen_rtx_MEM (GET_MODE (m), rl78_lo16 (XEXP (m, 0)));
+ MEM_COPY_ATTRIBUTES (new_m, m);
+ m = new_m;
+ need_es = 1;
}
- characterize_address (XEXP (m, 0), &base, &index, &addendr);
+ characterize_address (XEXP (m, 0), & base, & index, & addendr);
gcc_assert (index == NULL_RTX);
#if DEBUG_ALLOC
- fprintf (stderr, "\033[33m"); debug_rtx(m); fprintf (stderr, "\033[0m");
+ fprintf (stderr, "\033[33m"); debug_rtx (m); fprintf (stderr, "\033[0m");
debug_rtx (base);
#endif
if (base == NULL_RTX)
@@ -1824,6 +2435,9 @@ transcode_memory_rtx (rtx m, rtx newbase, rtx before)
if (addendr && GET_CODE (addendr) == CONST_INT)
addend = INTVAL (addendr);
+ gcc_assert (REG_P (base));
+ gcc_assert (REG_P (newbase));
+
if (REGNO (base) == SP_REG)
{
if (addend >= 0 && addend <= 255)
@@ -1844,23 +2458,31 @@ transcode_memory_rtx (rtx m, rtx newbase, rtx before)
EM (emit_insn_before (gen_movhi (AX, base), before));
EM (emit_insn_before (gen_addhi3 (AX, AX, addendr), before));
EM (emit_insn_before (gen_movhi (newbase, AX), before));
+ record_content (AX, NULL_RTX);
+ record_content (newbase, NULL_RTX);
+
base = newbase;
addend = 0;
}
else
{
- EM (emit_insn_before (gen_movhi (newbase, base), before));
- base = newbase;
+ base = gen_and_emit_move (newbase, base, before, true);
}
if (addend)
- base = gen_rtx_PLUS (HImode, base, GEN_INT (addend));
+ {
+ record_content (base, NULL_RTX);
+ base = gen_rtx_PLUS (HImode, base, GEN_INT (addend));
+ }
#if DEBUG_ALLOC
fprintf (stderr, "\033[33m");
debug_rtx (m);
#endif
- m = change_address (m, GET_MODE (m), base);
+ if (need_es)
+ m = change_address (m, GET_MODE (m), gen_es_addr (base));
+ else
+ m = change_address (m, GET_MODE (m), base);
#if DEBUG_ALLOC
debug_rtx (m);
fprintf (stderr, "\033[0m");
@@ -1870,58 +2492,54 @@ transcode_memory_rtx (rtx m, rtx newbase, rtx before)
/* Copy SRC to accumulator (A or AX), placing any generated insns
before BEFORE. Returns accumulator RTX. */
-
static rtx
move_to_acc (int opno, rtx before)
{
- rtx src = OP(opno);
+ rtx src = OP (opno);
enum machine_mode mode = GET_MODE (src);
- if (GET_CODE (src) == REG
- && REGNO (src) < 2)
+ if (REG_P (src) && REGNO (src) < 2)
return src;
if (mode == VOIDmode)
mode = recog_data.operand_mode[opno];
- if (mode == QImode)
- {
- EM (emit_insn_before (gen_movqi (A, src), before));
- return A;
- }
- else
- {
- EM (emit_insn_before (gen_movhi (AX, src), before));
- return AX;
- }
+ return gen_and_emit_move (mode == QImode ? A : AX, src, before, true);
+}
+
+static void
+force_into_acc (rtx src, rtx before)
+{
+ enum machine_mode mode = GET_MODE (src);
+ rtx move;
+
+ if (REG_P (src) && REGNO (src) < 2)
+ return;
+
+ move = mode == QImode ? gen_movqi (A, src) : gen_movhi (AX, src);
+
+ EM (move);
+
+ emit_insn_before (move, before);
+ record_content (AX, NULL_RTX);
}
/* Copy accumulator (A or AX) to DEST, placing any generated insns
after AFTER. Returns accumulator RTX. */
-
static rtx
-move_from_acc (rtx dest, rtx after)
+move_from_acc (unsigned int opno, rtx after)
{
+ rtx dest = OP (opno);
enum machine_mode mode = GET_MODE (dest);
if (REG_P (dest) && REGNO (dest) < 2)
return dest;
- if (mode == QImode)
- {
- EM (emit_insn_after (gen_movqi (dest, A), after));
- return A;
- }
- else
- {
- EM (emit_insn_after (gen_movhi (dest, AX), after));
- return AX;
- }
+ return gen_and_emit_move (dest, mode == QImode ? A : AX, after, false);
}
/* Copy accumulator (A or AX) to REGNO, placing any generated insns
before BEFORE. Returns reg RTX. */
-
static rtx
move_acc_to_reg (rtx acc, int regno, rtx before)
{
@@ -1930,25 +2548,15 @@ move_acc_to_reg (rtx acc, int regno, rtx before)
reg = gen_rtx_REG (mode, regno);
- if (mode == QImode)
- {
- EM (emit_insn_before (gen_movqi (reg, A), before));
- return reg;
- }
- else
- {
- EM (emit_insn_before (gen_movhi (reg, AX), before));
- return reg;
- }
+ return gen_and_emit_move (reg, acc, before, true);
}
/* Copy SRC to X, placing any generated insns before BEFORE.
Returns X RTX. */
-
static rtx
move_to_x (int opno, rtx before)
{
- rtx src = OP(opno);
+ rtx src = OP (opno);
enum machine_mode mode = GET_MODE (src);
rtx reg;
@@ -1958,22 +2566,16 @@ move_to_x (int opno, rtx before)
if (mode == QImode || ! is_virtual_register (OP (opno)))
{
- OP(opno) = move_to_acc (opno, before);
- OP(opno) = move_acc_to_reg (OP(opno), X_REG, before);
+ OP (opno) = move_to_acc (opno, before);
+ OP (opno) = move_acc_to_reg (OP (opno), X_REG, before);
return reg;
}
- if (mode == QImode)
- EM (emit_insn_before (gen_movqi (reg, src), before));
- else
- EM (emit_insn_before (gen_movhi (reg, src), before));
-
- return reg;
+ return gen_and_emit_move (reg, src, before, true);
}
-/* Copy OP(opno) to H or HL, placing any generated insns before BEFORE.
+/* Copy OP (opno) to H or HL, placing any generated insns before BEFORE.
Returns H/HL RTX. */
-
static rtx
move_to_hl (int opno, rtx before)
{
@@ -1992,17 +2594,11 @@ move_to_hl (int opno, rtx before)
return reg;
}
- if (mode == QImode)
- EM (emit_insn_before (gen_movqi (reg, src), before));
- else
- EM (emit_insn_before (gen_movhi (reg, src), before));
-
- return reg;
+ return gen_and_emit_move (reg, src, before, true);
}
-/* Copy OP(opno) to E or DE, placing any generated insns before BEFORE.
+/* Copy OP (opno) to E or DE, placing any generated insns before BEFORE.
Returns E/DE RTX. */
-
static rtx
move_to_de (int opno, rtx before)
{
@@ -2022,9 +2618,7 @@ move_to_de (int opno, rtx before)
}
else
{
- rtx move = mode == QImode ? gen_movqi (reg, src) : gen_movhi (reg, src);
-
- EM (emit_insn_before (move, before));
+ gen_and_emit_move (reg, src, before, true);
}
return reg;
@@ -2038,63 +2632,104 @@ rl78_alloc_physical_registers_op1 (rtx insn)
/* We first try using A as the destination, then copying it
back. */
- if (rtx_equal_p (OP(0), OP(1)))
+ if (rtx_equal_p (OP (0), OP (1)))
{
- OP(0) =
- OP(1) = transcode_memory_rtx (OP(1), DE, insn);
+ OP (0) =
+ OP (1) = transcode_memory_rtx (OP (1), DE, insn);
}
else
{
- OP(0) = transcode_memory_rtx (OP(0), BC, insn);
- OP(1) = transcode_memory_rtx (OP(1), HL, insn);
+ /* If necessary, load the operands into BC and HL.
+ Check to see if we already have OP (0) in HL
+ and if so, swap the order. */
+ if (MEM_P (OP (0))
+ && already_contains (HL, XEXP (OP (0), 0)))
+ {
+ OP (0) = transcode_memory_rtx (OP (0), HL, insn);
+ OP (1) = transcode_memory_rtx (OP (1), BC, insn);
+ }
+ else
+ {
+ OP (0) = transcode_memory_rtx (OP (0), BC, insn);
+ OP (1) = transcode_memory_rtx (OP (1), HL, insn);
+ }
}
MAYBE_OK (insn);
- OP(0) = move_from_acc (OP(0), insn);
+ OP (0) = move_from_acc (0, insn);
MAYBE_OK (insn);
/* Try copying the src to acc first, then. This is for, for
example, ZERO_EXTEND or NOT. */
- OP(1) = move_to_acc (1, insn);
+ OP (1) = move_to_acc (1, insn);
- MAYBE_OK (insn);
+ MUST_BE_OK (insn);
+}
+
+/* Returns true if operand OPNUM contains a constraint of type CONSTRAINT.
+ Assumes that the current insn has already been recognised and hence the
+ constraint data has been filled in. */
+static bool
+has_constraint (unsigned int opnum, enum constraint_num constraint)
+{
+ const char * p = recog_data.constraints[opnum];
+
+ /* No constraints means anything is accepted. */
+ if (p == NULL || *p == 0 || *p == ',')
+ return true;
+
+ do
+ {
+ char c;
+ unsigned int len;
+
+ c = *p;
+ len = CONSTRAINT_LEN (c, p);
+ gcc_assert (len > 0);
- FAILED;
+ switch (c)
+ {
+ case 0:
+ case ',':
+ return false;
+ default:
+ if (lookup_constraint (p) == constraint)
+ return true;
+ }
+ p += len;
+ }
+ while (1);
}
-/* Devirtualize an insn of the form (SET (op) (unop (op) (op))). */
+/* Devirtualize an insn of the form (SET (op) (binop (op) (op))). */
static void
rl78_alloc_physical_registers_op2 (rtx insn)
{
- /* op[0] = op[1] func op[2] */
- rtx prev = prev_nonnote_nondebug_insn (insn);
+ rtx prev;
rtx first;
bool hl_used;
+ int tmp_id;
+ rtx saved_op1;
- if (rtx_equal_p (OP(0), OP(1)))
+ if (rtx_equal_p (OP (0), OP (1)))
{
- OP(0) =
- OP(1) = transcode_memory_rtx (OP(1), DE, insn);
- prev = next_nonnote_nondebug_insn (prev);
- OP(2) = transcode_memory_rtx (OP(2), HL, insn);
- prev = prev_nonnote_nondebug_insn (prev);
+ OP (0) =
+ OP (1) = transcode_memory_rtx (OP (1), DE, insn);
+ OP (2) = transcode_memory_rtx (OP (2), HL, insn);
}
- else if (rtx_equal_p (OP(0), OP(2)))
+ else if (rtx_equal_p (OP (0), OP (2)))
{
- OP(1) = transcode_memory_rtx (OP(1), DE, insn);
- prev = next_nonnote_nondebug_insn (prev);
- OP(0) =
- OP(2) = transcode_memory_rtx (OP(2), HL, insn);
- prev = prev_nonnote_nondebug_insn (prev);
+ OP (1) = transcode_memory_rtx (OP (1), DE, insn);
+ OP (0) =
+ OP (2) = transcode_memory_rtx (OP (2), HL, insn);
}
else
{
- OP(0) = transcode_memory_rtx (OP(0), BC, insn);
- OP(1) = transcode_memory_rtx (OP(1), DE, insn);
- prev = next_nonnote_nondebug_insn (prev);
- OP(2) = transcode_memory_rtx (OP(2), HL, insn);
+ OP (0) = transcode_memory_rtx (OP (0), BC, insn);
+ OP (1) = transcode_memory_rtx (OP (1), DE, insn);
+ OP (2) = transcode_memory_rtx (OP (2), HL, insn);
}
MAYBE_OK (insn);
@@ -2110,17 +2745,105 @@ rl78_alloc_physical_registers_op2 (rtx insn)
OP (2) = tmp;
}
- /* Make a note of wether (H)L is being used. It matters
- because if OP(2) alsoneeds reloading, then we must take
+ /* Make a note of whether (H)L is being used. It matters
+ because if OP (2) alsoneeds reloading, then we must take
care not to corrupt HL. */
hl_used = reg_mentioned_p (L, OP (0)) || reg_mentioned_p (L, OP (1));
- OP(0) = move_from_acc (OP (0), insn);
- OP(1) = move_to_acc (1, insn);
+ /* If HL is not currently being used and dest == op1 then there are
+ some possible optimizations available by reloading one of the
+ operands into HL, before trying to use the accumulator. */
+ if (optimize
+ && ! hl_used
+ && rtx_equal_p (OP (0), OP (1)))
+ {
+ /* If op0 is a Ws1 type memory address then switching the base
+ address register to HL might allow us to perform an in-memory
+ operation. (eg for the INCW instruction).
+
+ FIXME: Adding the move into HL is costly if this optimization is not
+ going to work, so for now, make sure that we know that the new insn will
+ match the requirements of the addhi3_real pattern. Really we ought to
+ generate a candidate sequence, test that, and then install it if the
+ results are good. */
+ if (satisfies_constraint_Ws1 (OP (0))
+ && has_constraint (0, CONSTRAINT_Wh1)
+ && (satisfies_constraint_K (OP (2)) || satisfies_constraint_L (OP (2))))
+ {
+ rtx base, index, addend, newbase;
+
+ characterize_address (XEXP (OP (0), 0), & base, & index, & addend);
+ gcc_assert (index == NULL_RTX);
+ gcc_assert (REG_P (base) && REGNO (base) == SP_REG);
+
+ /* Ws1 addressing allows an offset of 0, Wh1 addressing requires a non-zero offset. */
+ if (addend != NULL_RTX)
+ {
+ newbase = gen_and_emit_move (HL, base, insn, true);
+ record_content (newbase, NULL_RTX);
+ newbase = gen_rtx_PLUS (HImode, newbase, addend);
+
+ OP (0) = OP (1) = change_address (OP (0), VOIDmode, newbase);
+
+ /* We do not want to fail here as this means that
+ we have inserted useless insns into the stream. */
+ MUST_BE_OK (insn);
+ }
+ }
+ else if (REG_P (OP (0))
+ && satisfies_constraint_Ws1 (OP (2))
+ && has_constraint (2, CONSTRAINT_Wh1))
+ {
+ rtx base, index, addend, newbase;
+
+ characterize_address (XEXP (OP (2), 0), & base, & index, & addend);
+ gcc_assert (index == NULL_RTX);
+ gcc_assert (REG_P (base) && REGNO (base) == SP_REG);
+
+ /* Ws1 addressing allows an offset of 0, Wh1 addressing requires a non-zero offset. */
+ if (addend != NULL_RTX)
+ {
+ gen_and_emit_move (HL, base, insn, true);
+
+ if (REGNO (OP (0)) != X_REG)
+ {
+ OP (1) = move_to_acc (1, insn);
+ OP (0) = move_from_acc (0, insn);
+ }
+
+ record_content (HL, NULL_RTX);
+ newbase = gen_rtx_PLUS (HImode, HL, addend);
+
+ OP (2) = change_address (OP (2), VOIDmode, newbase);
+
+ /* We do not want to fail here as this means that
+ we have inserted useless insns into the stream. */
+ MUST_BE_OK (insn);
+ }
+ }
+ }
+
+ OP (0) = move_from_acc (0, insn);
+
+ tmp_id = get_max_insn_count ();
+ saved_op1 = OP (1);
+
+ if (rtx_equal_p (OP (1), OP (2)))
+ OP (2) = OP (1) = move_to_acc (1, insn);
+ else
+ OP (1) = move_to_acc (1, insn);
MAYBE_OK (insn);
- /* We have to copy op2 to HL, but that involves AX, which
+ /* If we omitted the move of OP1 into the accumulator (because
+ it was already there from a previous insn), then force the
+ generation of the move instruction now. We know that we
+ are about to emit a move into HL (or DE) via AX, and hence
+ our optimization to remove the load of OP1 is no longer valid. */
+ if (tmp_id == get_max_insn_count ())
+ force_into_acc (saved_op1, insn);
+
+ /* We have to copy op2 to HL (or DE), but that involves AX, which
already has a live value. Emit it before those insns. */
if (prev)
@@ -2131,89 +2854,157 @@ rl78_alloc_physical_registers_op2 (rtx insn)
OP (2) = hl_used ? move_to_de (2, first) : move_to_hl (2, first);
- MAYBE_OK (insn);
-
- FAILED;
+ MUST_BE_OK (insn);
}
-/* Devirtualize an insn of the form (SET () (unop (op))). */
-
+/* Devirtualize an insn of the form SET (PC) (MEM/REG). */
static void
rl78_alloc_physical_registers_ro1 (rtx insn)
{
- /* (void) op[0] */
- OP(0) = transcode_memory_rtx (OP(0), BC, insn);
+ OP (0) = transcode_memory_rtx (OP (0), BC, insn);
MAYBE_OK (insn);
- OP(0) = move_to_acc (0, insn);
-
- MAYBE_OK (insn);
+ OP (0) = move_to_acc (0, insn);
- FAILED;
+ MUST_BE_OK (insn);
}
/* Devirtualize a compare insn. */
static void
rl78_alloc_physical_registers_cmp (rtx insn)
{
- /* op[1] cmp_op[0] op[2] */
+ int tmp_id;
+ rtx saved_op1;
rtx prev = prev_nonnote_nondebug_insn (insn);
rtx first;
- OP(1) = transcode_memory_rtx (OP(1), DE, insn);
- OP(2) = transcode_memory_rtx (OP(2), HL, insn);
+ OP (1) = transcode_memory_rtx (OP (1), DE, insn);
+ OP (2) = transcode_memory_rtx (OP (2), HL, insn);
+ /* HI compares have to have OP (1) in AX, but QI
+ compares do not, so it is worth checking here. */
MAYBE_OK (insn);
- OP(1) = move_to_acc (1, insn);
+ /* For an HImode compare, OP (1) must always be in AX.
+ But if OP (1) is a REG (and not AX), then we can avoid
+ a reload of OP (1) if we reload OP (2) into AX and invert
+ the comparison. */
+ if (REG_P (OP (1))
+ && REGNO (OP (1)) != AX_REG
+ && GET_MODE (OP (1)) == HImode
+ && MEM_P (OP (2)))
+ {
+ rtx cmp = XEXP (SET_SRC (PATTERN (insn)), 0);
+
+ OP (2) = move_to_acc (2, insn);
+
+ switch (GET_CODE (cmp))
+ {
+ case EQ:
+ case NE:
+ break;
+ case LTU: cmp = gen_rtx_GTU (HImode, OP (2), OP (1)); break;
+ case GTU: cmp = gen_rtx_LTU (HImode, OP (2), OP (1)); break;
+ case LEU: cmp = gen_rtx_GEU (HImode, OP (2), OP (1)); break;
+ case GEU: cmp = gen_rtx_LEU (HImode, OP (2), OP (1)); break;
+
+ case LT:
+ case GT:
+ case LE:
+ case GE:
+#if DEBUG_ALLOC
+ debug_rtx (insn);
+#endif
+ default:
+ gcc_unreachable ();
+ }
+
+ if (GET_CODE (cmp) == EQ || GET_CODE (cmp) == NE)
+ PATTERN (insn) = gen_cbranchhi4_real (cmp, OP (2), OP (1), OP (3));
+ else
+ PATTERN (insn) = gen_cbranchhi4_real_inverted (cmp, OP (2), OP (1), OP (3));
+
+ MUST_BE_OK (insn);
+ }
+
+ /* Surprisingly, gcc can generate a comparison of a register with itself, but this
+ should be handled by the second alternative of the cbranchhi_real pattern. */
+ if (rtx_equal_p (OP (1), OP (2)))
+ {
+ OP (1) = OP (2) = BC;
+ MUST_BE_OK (insn);
+ }
+
+ tmp_id = get_max_insn_count ();
+ saved_op1 = OP (1);
+
+ OP (1) = move_to_acc (1, insn);
MAYBE_OK (insn);
+ /* If we omitted the move of OP1 into the accumulator (because
+ it was already there from a previous insn), then force the
+ generation of the move instruction now. We know that we
+ are about to emit a move into HL via AX, and hence our
+ optimization to remove the load of OP1 is no longer valid. */
+ if (tmp_id == get_max_insn_count ())
+ force_into_acc (saved_op1, insn);
+
/* We have to copy op2 to HL, but that involves the acc, which
already has a live value. Emit it before those insns. */
-
if (prev)
first = next_nonnote_nondebug_insn (prev);
else
for (first = insn; prev_nonnote_nondebug_insn (first); first = prev_nonnote_nondebug_insn (first))
;
- OP(2) = move_to_hl (2, first);
-
- MAYBE_OK (insn);
+ OP (2) = move_to_hl (2, first);
- FAILED;
+ MUST_BE_OK (insn);
}
/* Like op2, but AX = A op X. */
static void
rl78_alloc_physical_registers_umul (rtx insn)
{
- /* op[0] = op[1] func op[2] */
rtx prev = prev_nonnote_nondebug_insn (insn);
rtx first;
+ int tmp_id;
+ rtx saved_op1;
- OP(0) = transcode_memory_rtx (OP(0), BC, insn);
- OP(1) = transcode_memory_rtx (OP(1), DE, insn);
- OP(2) = transcode_memory_rtx (OP(2), HL, insn);
+ OP (0) = transcode_memory_rtx (OP (0), BC, insn);
+ OP (1) = transcode_memory_rtx (OP (1), DE, insn);
+ OP (2) = transcode_memory_rtx (OP (2), HL, insn);
MAYBE_OK (insn);
if (recog_data.constraints[1][0] == '%'
- && is_virtual_register (OP(1))
- && !is_virtual_register (OP(2))
- && !CONSTANT_P (OP(2)))
+ && is_virtual_register (OP (1))
+ && !is_virtual_register (OP (2))
+ && !CONSTANT_P (OP (2)))
{
- rtx tmp = OP(1);
- OP(1) = OP(2);
- OP(2) = tmp;
+ rtx tmp = OP (1);
+ OP (1) = OP (2);
+ OP (2) = tmp;
}
- OP(0) = move_from_acc (OP(0), insn);
- OP(1) = move_to_acc (1, insn);
+ OP (0) = move_from_acc (0, insn);
+
+ tmp_id = get_max_insn_count ();
+ saved_op1 = OP (1);
+
+ OP (1) = move_to_acc (1, insn);
MAYBE_OK (insn);
+ /* If we omitted the move of OP1 into the accumulator (because
+ it was already there from a previous insn), then force the
+ generation of the move instruction now. We know that we
+ are about to emit a move into HL (or DE) via AX, and hence
+ our optimization to remove the load of OP1 is no longer valid. */
+ if (tmp_id == get_max_insn_count ())
+ force_into_acc (saved_op1, insn);
+
/* We have to copy op2 to X, but that involves the acc, which
already has a live value. Emit it before those insns. */
@@ -2222,11 +3013,66 @@ rl78_alloc_physical_registers_umul (rtx insn)
else
for (first = insn; prev_nonnote_nondebug_insn (first); first = prev_nonnote_nondebug_insn (first))
;
- OP(2) = move_to_x (2, first);
+ OP (2) = move_to_x (2, first);
+
+ MUST_BE_OK (insn);
+}
+
+static void
+rl78_alloc_address_registers_macax (rtx insn)
+{
+ int which, op;
+ bool replace_in_op0 = false;
+ bool replace_in_op1 = false;
MAYBE_OK (insn);
- FAILED;
+ /* Two different MEMs are not allowed. */
+ which = 0;
+ for (op = 2; op >= 0; op --)
+ {
+ if (MEM_P (OP (op)))
+ {
+ if (op == 0 && replace_in_op0)
+ continue;
+ if (op == 1 && replace_in_op1)
+ continue;
+
+ switch (which)
+ {
+ case 0:
+ /* If we replace a MEM, make sure that we replace it for all
+ occurrences of the same MEM in the insn. */
+ replace_in_op0 = (op > 0 && rtx_equal_p (OP (op), OP (0)));
+ replace_in_op1 = (op > 1 && rtx_equal_p (OP (op), OP (1)));
+
+ OP (op) = transcode_memory_rtx (OP (op), HL, insn);
+ if (op == 2
+ && MEM_P (OP (op))
+ && (REGNO (XEXP (OP (op), 0)) == SP_REG
+ || (GET_CODE (XEXP (OP (op), 0)) == PLUS
+ && REGNO (XEXP (XEXP (OP (op), 0), 0)) == SP_REG)))
+ {
+ emit_insn_before (gen_movhi (HL, gen_rtx_REG (HImode, SP_REG)), insn);
+ OP (op) = replace_rtx (OP (op), gen_rtx_REG (HImode, SP_REG), HL);
+ }
+ if (replace_in_op0)
+ OP (0) = OP (op);
+ if (replace_in_op1)
+ OP (1) = OP (op);
+ break;
+ case 1:
+ OP (op) = transcode_memory_rtx (OP (op), DE, insn);
+ break;
+ case 2:
+ OP (op) = transcode_memory_rtx (OP (op), BC, insn);
+ break;
+ }
+ which ++;
+ }
+ }
+
+ MUST_BE_OK (insn);
}
/* Scan all insns and devirtualize them. */
@@ -2266,23 +3112,46 @@ rl78_alloc_physical_registers (void)
cfun->machine->virt_insns_ok = 0;
cfun->machine->real_insns_ok = 1;
+ clear_content_memory ();
+
for (insn = get_insns (); insn; insn = curr)
{
+ rtx pattern;
+
curr = insn ? next_nonnote_nondebug_insn (insn) : NULL;
if (!INSN_P (insn))
- continue;
- if (GET_CODE (PATTERN (insn)) != SET
- && GET_CODE (PATTERN (insn)) != CALL)
- continue;
+ {
+ if (LABEL_P (insn))
+ clear_content_memory ();
+
+ continue;
+ }
- if (GET_CODE (PATTERN (insn)) == SET
- && GET_CODE (SET_SRC (PATTERN (insn))) == ASM_OPERANDS)
+ if (dump_file)
+ fprintf (dump_file, "Converting insn %d\n", INSN_UID (insn));
+
+ pattern = PATTERN (insn);
+ if (GET_CODE (pattern) == PARALLEL)
+ pattern = XVECEXP (pattern, 0, 0);
+ if (JUMP_P (insn) || CALL_P (insn) || GET_CODE (pattern) == CALL)
+ clear_content_memory ();
+ if (GET_CODE (pattern) != SET
+ && GET_CODE (pattern) != CALL)
+ continue;
+ if (GET_CODE (SET_SRC (pattern)) == ASM_OPERANDS)
continue;
valloc_method = get_attr_valloc (insn);
- PATTERN (insn)= copy_rtx_if_shared (PATTERN (insn));
+ PATTERN (insn) = copy_rtx_if_shared (PATTERN (insn));
+
+ if (valloc_method == VALLOC_MACAX)
+ {
+ record_content (AX, NULL_RTX);
+ record_content (BC, NULL_RTX);
+ record_content (DE, NULL_RTX);
+ }
if (insn_ok_now (insn))
continue;
@@ -2312,10 +3181,20 @@ rl78_alloc_physical_registers (void)
rl78_alloc_physical_registers_umul (insn);
break;
case VALLOC_MACAX:
- /* Macro that clobbers AX */
+ /* Macro that clobbers AX. */
+ rl78_alloc_address_registers_macax (insn);
+ record_content (AX, NULL_RTX);
+ record_content (BC, NULL_RTX);
+ record_content (DE, NULL_RTX);
break;
}
+
+ if (JUMP_P (insn) || CALL_P (insn) || GET_CODE (pattern) == CALL)
+ clear_content_memory ();
+ else
+ process_postponed_content_update ();
}
+
#if DEBUG_ALLOC
fprintf (stderr, "\033[0m");
#endif
@@ -2426,7 +3305,7 @@ rl78_calculate_death_notes (void)
fprintf (dump_file, "\nDead:");
for (i = 0; i < FIRST_PSEUDO_REGISTER; i ++)
if (dead[i])
- fprintf(dump_file, " %s", reg_names[i]);
+ fprintf (dump_file, " %s", reg_names[i]);
fprintf (dump_file, "\n");
print_rtl_single (dump_file, insn);
}
@@ -2651,13 +3530,13 @@ rl78_propogate_register_origins (void)
}
}
- /* Special case - our ADDSI3 macro uses AX */
+ /* Special case - our ADDSI3 macro uses AX and sometimes BC. */
if (get_attr_valloc (insn) == VALLOC_MACAX)
{
if (dump_file)
- fprintf (dump_file, "Resetting origin of AX for macro.\n");
+ fprintf (dump_file, "Resetting origin of AX/BC for macro.\n");
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (i <= 1 || origins[i] <= 1)
+ if (i <= 3 || origins[i] <= 3)
{
origins[i] = i;
age[i] = 0;
@@ -2684,6 +3563,16 @@ rl78_propogate_register_origins (void)
}
}
}
+ else if (GET_CODE (pat) == CLOBBER)
+ {
+ if (REG_P (XEXP (pat, 0)))
+ {
+ unsigned int reg = REGNO (XEXP (pat, 0));
+
+ origins[reg] = reg;
+ age[reg] = 0;
+ }
+ }
}
}
}
@@ -2712,13 +3601,15 @@ rl78_remove_unused_sets (void)
}
}
-#undef xTARGET_MACHINE_DEPENDENT_REORG
-#define xTARGET_MACHINE_DEPENDENT_REORG rl78_reorg
-
/* This is the top of the devritualization pass. */
static void
rl78_reorg (void)
{
+ /* split2 only happens when optimizing, but we need all movSIs to be
+ split now. */
+ if (optimize <= 0)
+ split_all_insns ();
+
rl78_alloc_physical_registers ();
if (dump_file)
@@ -2753,7 +3644,7 @@ rl78_reorg (void)
df_analyze ();
}
-#undef TARGET_RETURN_IN_MEMORY
+#undef TARGET_RETURN_IN_MEMORY
#define TARGET_RETURN_IN_MEMORY rl78_return_in_memory
static bool
@@ -2764,6 +3655,63 @@ rl78_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
}
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS rl78_rtx_costs
+
+static bool rl78_rtx_costs (rtx x,
+ int code,
+ int outer_code ATTRIBUTE_UNUSED,
+ int opno ATTRIBUTE_UNUSED,
+ int * total,
+ bool speed ATTRIBUTE_UNUSED)
+{
+ if (code == IF_THEN_ELSE)
+ return COSTS_N_INSNS (10);
+ if (GET_MODE (x) == SImode)
+ {
+ switch (code)
+ {
+ case MULT:
+ if (RL78_MUL_RL78)
+ *total = COSTS_N_INSNS (14);
+ else if (RL78_MUL_G13)
+ *total = COSTS_N_INSNS (29);
+ else
+ *total = COSTS_N_INSNS (500);
+ return true;
+ case PLUS:
+ *total = COSTS_N_INSNS (8);
+ return true;
+ case ASHIFT:
+ case ASHIFTRT:
+ case LSHIFTRT:
+ if (GET_CODE (XEXP (x, 1)) == CONST_INT)
+ {
+ switch (INTVAL (XEXP (x, 1)))
+ {
+ case 0: *total = COSTS_N_INSNS (0); break;
+ case 1: *total = COSTS_N_INSNS (6); break;
+ case 2: case 3: case 4: case 5: case 6: case 7:
+ *total = COSTS_N_INSNS (10); break;
+ case 8: *total = COSTS_N_INSNS (6); break;
+ case 9: case 10: case 11: case 12: case 13: case 14: case 15:
+ *total = COSTS_N_INSNS (10); break;
+ case 16: *total = COSTS_N_INSNS (3); break;
+ case 17: case 18: case 19: case 20: case 21: case 22: case 23:
+ *total = COSTS_N_INSNS (4); break;
+ case 24: *total = COSTS_N_INSNS (4); break;
+ case 25: case 26: case 27: case 28: case 29: case 30: case 31:
+ *total = COSTS_N_INSNS (5); break;
+ }
+ }
+ else
+ *total = COSTS_N_INSNS (10+4*16);
+ return true;
+ }
+ }
+ return false;
+}
+
#undef TARGET_UNWIND_WORD_MODE
#define TARGET_UNWIND_WORD_MODE rl78_unwind_word_mode
@@ -2774,6 +3722,7 @@ rl78_unwind_word_mode (void)
return HImode;
}
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-rl78.h"
diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
index 57c34ab763f..3a656de626c 100644
--- a/gcc/config/rl78/rl78.h
+++ b/gcc/config/rl78/rl78.h
@@ -32,6 +32,8 @@
builtin_define ("__RL78_MUL_RL78__"); \
if (RL78_MUL_G13) \
builtin_define ("__RL78_MUL_G13__"); \
+ if (TARGET_G10) \
+ builtin_define ("__RL78_G10__"); \
} \
while (0)
@@ -41,6 +43,18 @@
#undef ENDFILE_SPEC
#define ENDFILE_SPEC "crtend.o%s crtn.o%s"
+#undef ASM_SPEC
+#define ASM_SPEC "\
+%{mrelax:-relax} \
+%{mg10} \
+"
+
+#undef LINK_SPEC
+#define LINK_SPEC "\
+%{mrelax:-relax} \
+%{!r:--gc-sections} \
+"
+
#undef LIB_SPEC
#define LIB_SPEC " \
--start-group \
@@ -252,7 +266,7 @@ enum reg_class
{ 0x00000300, 0x00000000 }, /* R8 - HImode */ \
{ 0x00000c00, 0x00000000 }, /* R10 - HImode */ \
{ 0xff000000, 0x00000000 }, /* INT - HImode */ \
- { 0x007fff00, 0x00000000 }, /* Virtual registers. */ \
+ { 0xff7fff00, 0x00000000 }, /* Virtual registers. */ \
{ 0xff7fffff, 0x00000002 }, /* General registers. */ \
{ 0x04000000, 0x00000004 }, /* PSW. */ \
{ 0xff7fffff, 0x0000001f } /* All registers. */ \
@@ -339,7 +353,7 @@ enum reg_class
&& reg_renumber[(REGNO)] <= (MAX)))
#ifdef REG_OK_STRICT
-#define REGNO_OK_FOR_BASE_P(regno) REGNO_IN_RANGE (regno, 16, 23)
+#define REGNO_OK_FOR_BASE_P(regno) REGNO_IN_RANGE (regno, 16, 31)
#else
#define REGNO_OK_FOR_BASE_P(regno) 1
#endif
diff --git a/gcc/config/rl78/rl78.md b/gcc/config/rl78/rl78.md
index efc26210498..a43b41b472f 100644
--- a/gcc/config/rl78/rl78.md
+++ b/gcc/config/rl78/rl78.md
@@ -35,7 +35,7 @@
(FP_REG 22)
(SP_REG 32)
- (CC_REG 33)
+ (CC_REG 34)
(ES_REG 35)
(CS_REG 36)
@@ -45,6 +45,7 @@
(UNS_RETB 3)
(UNS_SET_RB 10)
+ (UNS_ES_ADDR 11)
(UNS_TRAMPOLINE_INIT 20)
(UNS_TRAMPOLINE_UNINIT 21)
@@ -141,7 +142,7 @@
(define_insn "sel_rb"
[(unspec_volatile [(match_operand 0 "immediate_operand" "")] UNS_SET_RB)]
- ""
+ "!TARGET_G10"
"sel\trb%u0"
)
@@ -205,33 +206,76 @@
;; efficient than anything else.
(define_expand "addsi3"
- [(set (match_operand:SI 0 "register_operand" "=&v")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "vi")
- (match_operand 2 "nonmemory_operand" "vi")))
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=&vm")
+ (plus:SI (match_operand:SI 1 "general_operand" "vim")
+ (match_operand 2 "general_operand" "vim")))
]
""
- "if (!nonmemory_operand (operands[1], SImode))
- operands[1] = force_reg (SImode, operands[1]);
- if (!nonmemory_operand (operands[1], SImode))
- operands[2] = force_reg (SImode, operands[2]);"
+ "emit_insn (gen_addsi3_internal_virt (operands[0], operands[1], operands[2]));
+ DONE;"
)
-(define_insn "addsi3_internal"
- [(set (match_operand:SI 0 "register_operand" "=&v")
- (plus:SI (match_operand:SI 1 "nonmemory_operand" "vi")
- (match_operand:SI 2 "nonmemory_operand" "vi")))
+(define_insn "addsi3_internal_virt"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,&vm, vm")
+ (plus:SI (match_operand:SI 1 "general_operand" "0, vim, vim")
+ (match_operand 2 "general_operand" "vim,vim,vim")))
+ (clobber (reg:HI AX_REG))
+ (clobber (reg:HI BC_REG))
]
+ "rl78_virt_insns_ok ()"
""
- "; addSI macro %0 = %1 + %2
- movw ax, %h1
- addw ax, %h2
- movw %h0, ax
- movw ax,%H1
- sknc
- incw ax
- addw ax,%H2
- movw %H0,ax
- ; end of addSI macro"
+ [(set_attr "valloc" "macax")]
+)
+
+(define_insn "addsi3_internal_real"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,&vU, vU")
+ (plus:SI (match_operand:SI 1 "general_operand" "+0, viU, viU")
+ (match_operand 2 "general_operand" "viWabWhlWh1,viWabWhlWh1,viWabWhlWh1")))
+ (clobber (reg:HI AX_REG))
+ (clobber (reg:HI BC_REG))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ movw ax,%h1 \;addw ax,%h2 \;movw %h0, ax \;movw ax,%H1 \;sknc \;incw ax \;addw ax,%H2 \;movw %H0,ax
+ movw ax,%h1 \;addw ax,%h2 \;movw %h0, ax \;movw ax,%H1 \;sknc \;incw ax \;addw ax,%H2 \;movw %H0,ax
+ movw ax,%h1 \;addw ax,%h2 \;movw bc, ax \;movw ax,%H1 \;sknc \;incw ax \;addw ax,%H2 \;movw %H0,ax \;movw ax,bc \;movw %h0, ax"
+ [(set_attr "valloc" "macax")]
+)
+
+(define_expand "subsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=&vm")
+ (minus:SI (match_operand:SI 1 "general_operand" "vim")
+ (match_operand 2 "general_operand" "vim")))
+ ]
+ ""
+ "emit_insn (gen_subsi3_internal_virt (operands[0], operands[1], operands[2]));
+ DONE;"
+)
+
+(define_insn "subsi3_internal_virt"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,&vm, vm")
+ (minus:SI (match_operand:SI 1 "general_operand" "0, vim, vim")
+ (match_operand 2 "general_operand" "vim,vim,vim")))
+ (clobber (reg:HI AX_REG))
+ (clobber (reg:HI BC_REG))
+ ]
+ "rl78_virt_insns_ok ()"
+ ""
+ [(set_attr "valloc" "macax")]
+)
+
+(define_insn "subsi3_internal_real"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=v,&vU, vU")
+ (minus:SI (match_operand:SI 1 "general_operand" "+0, viU, viU")
+ (match_operand 2 "general_operand" "viWabWhlWh1,viWabWhlWh1,viWabWhlWh1")))
+ (clobber (reg:HI AX_REG))
+ (clobber (reg:HI BC_REG))
+ ]
+ "rl78_real_insns_ok ()"
+ "@
+ movw ax,%h1 \;subw ax,%h2 \;movw %h0, ax \;movw ax,%H1 \;sknc \;decw ax \;subw ax,%H2 \;movw %H0,ax
+ movw ax,%h1 \;subw ax,%h2 \;movw %h0, ax \;movw ax,%H1 \;sknc \;decw ax \;subw ax,%H2 \;movw %H0,ax
+ movw ax,%h1 \;subw ax,%h2 \;movw bc, ax \;movw ax,%H1 \;sknc \;decw ax \;subw ax,%H2 \;movw %H0,ax \;movw ax,bc \;movw %h0, ax"
[(set_attr "valloc" "macax")]
)
@@ -255,7 +299,7 @@
(define_expand "mulsi3"
[(set (match_operand:SI 0 "register_operand" "=&v")
- (mult:SI (match_operand:SI 1 "nonmemory_operand" "vi")
+ (mult:SI (match_operand:SI 1 "general_operand" "+vim")
(match_operand:SI 2 "nonmemory_operand" "vi")))
]
"! RL78_MUL_NONE"
@@ -319,8 +363,8 @@
;; bits of the result).
(define_insn "mulsi3_rl78"
[(set (match_operand:SI 0 "register_operand" "=&v")
- (mult:SI (match_operand:SI 1 "nonmemory_operand" "vi")
- (match_operand:SI 2 "nonmemory_operand" "vi")))
+ (mult:SI (match_operand:SI 1 "general_operand" "+viU")
+ (match_operand:SI 2 "general_operand" "vi")))
]
"RL78_MUL_RL78"
"; mulsi macro %0 = %1 * %2
@@ -349,8 +393,8 @@
;; Warning: this matches the silicon not the documentation.
(define_insn "mulsi3_g13"
[(set (match_operand:SI 0 "register_operand" "=&v")
- (mult:SI (match_operand:SI 1 "nonmemory_operand" "vi")
- (match_operand:SI 2 "nonmemory_operand" "vi")))
+ (mult:SI (match_operand:SI 1 "general_operand" "viU")
+ (match_operand:SI 2 "general_operand" "viU")))
]
"RL78_MUL_G13"
"; mulsi macro %0 = %1 * %2
@@ -389,3 +433,11 @@
; end of mulsi macro"
[(set_attr "valloc" "macax")]
)
+
+(define_expand "es_addr"
+ [(unspec:SI [(reg:QI ES_REG)
+ (match_operand:HI 0 "" "")
+ ] UNS_ES_ADDR)]
+ ""
+ ""
+)
diff --git a/gcc/config/rl78/rl78.opt b/gcc/config/rl78/rl78.opt
index c528ae47be6..ebcf903126d 100644
--- a/gcc/config/rl78/rl78.opt
+++ b/gcc/config/rl78/rl78.opt
@@ -23,7 +23,7 @@ HeaderInclude
config/rl78/rl78-opts.h
msim
-Target
+Target Report
Use the simulator runtime.
mmul=
@@ -41,3 +41,15 @@ Enum(rl78_mul_types) String(rl78) Value(MUL_RL78)
EnumValue
Enum(rl78_mul_types) String(g13) Value(MUL_G13)
+
+mallregs
+Target Mask(ALLREGS) Report Optimization
+Use all registers, reserving none for interrupt handlers.
+
+mrelax
+Target Report Optimization
+Enable assembler and linker relaxation. Enabled by default at -Os.
+
+mg10
+Target Mask(G10) Report
+Target the RL78/G10 series
diff --git a/gcc/config/rl78/t-rl78 b/gcc/config/rl78/t-rl78
index ed7ee74448b..30705b3e5e5 100644
--- a/gcc/config/rl78/t-rl78
+++ b/gcc/config/rl78/t-rl78
@@ -20,3 +20,8 @@
rl78-c.o: $(srcdir)/config/rl78/rl78-c.c $(RTL_H) $(TREE_H) $(CONFIG_H) $(TM_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+# Enable multilibs:
+
+MULTILIB_OPTIONS = mg10
+MULTILIB_DIRNAMES = g10
diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md
index fa53cbb9de7..4467b9e3d8b 100644
--- a/gcc/config/rs6000/constraints.md
+++ b/gcc/config/rs6000/constraints.md
@@ -52,29 +52,18 @@
"@internal")
;; Use w as a prefix to add VSX modes
-;; vector double (V2DF)
+;; any VSX register
+(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
+ "Any VSX register if the -mvsx option was used or NO_REGS.")
+
(define_register_constraint "wd" "rs6000_constraints[RS6000_CONSTRAINT_wd]"
- "@internal")
+ "VSX vector register to hold vector double data or NO_REGS.")
-;; vector float (V4SF)
(define_register_constraint "wf" "rs6000_constraints[RS6000_CONSTRAINT_wf]"
- "@internal")
-
-;; scalar double (DF)
-(define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]"
- "@internal")
-
-;; TImode in VSX registers
-(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
- "@internal")
-
-;; any VSX register
-(define_register_constraint "wa" "rs6000_constraints[RS6000_CONSTRAINT_wa]"
- "@internal")
+ "VSX vector register to hold vector float data or NO_REGS.")
-;; Register constraints to simplify move patterns
(define_register_constraint "wg" "rs6000_constraints[RS6000_CONSTRAINT_wg]"
- "Floating point register if -mmfpgpr is used, or NO_REGS.")
+ "If -mmfpgpr was used, a floating point register or NO_REGS.")
(define_register_constraint "wl" "rs6000_constraints[RS6000_CONSTRAINT_wl]"
"Floating point register if the LFIWAX instruction is enabled or NO_REGS.")
@@ -82,23 +71,38 @@
(define_register_constraint "wm" "rs6000_constraints[RS6000_CONSTRAINT_wm]"
"VSX register if direct move instructions are enabled, or NO_REGS.")
+;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use
+;; direct move directly, and movsf can't to move between the register sets.
+;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode
+(define_register_constraint "wn" "NO_REGS" "No register (NO_REGS).")
+
(define_register_constraint "wr" "rs6000_constraints[RS6000_CONSTRAINT_wr]"
"General purpose register if 64-bit instructions are enabled or NO_REGS.")
+(define_register_constraint "ws" "rs6000_constraints[RS6000_CONSTRAINT_ws]"
+ "VSX vector register to hold scalar double values or NO_REGS.")
+
+(define_register_constraint "wt" "rs6000_constraints[RS6000_CONSTRAINT_wt]"
+ "VSX vector register to hold 128 bit integer or NO_REGS.")
+
+(define_register_constraint "wu" "rs6000_constraints[RS6000_CONSTRAINT_wu]"
+ "Altivec register to use for float/32-bit int loads/stores or NO_REGS.")
+
(define_register_constraint "wv" "rs6000_constraints[RS6000_CONSTRAINT_wv]"
- "Altivec register if -mpower8-vector is used or NO_REGS.")
+ "Altivec register to use for double loads/stores or NO_REGS.")
+
+(define_register_constraint "ww" "rs6000_constraints[RS6000_CONSTRAINT_ww]"
+ "FP or VSX register to perform float operations under -mvsx or NO_REGS.")
(define_register_constraint "wx" "rs6000_constraints[RS6000_CONSTRAINT_wx]"
"Floating point register if the STFIWX instruction is enabled or NO_REGS.")
+(define_register_constraint "wy" "rs6000_constraints[RS6000_CONSTRAINT_wy]"
+ "VSX vector register to hold scalar float values or NO_REGS.")
+
(define_register_constraint "wz" "rs6000_constraints[RS6000_CONSTRAINT_wz]"
"Floating point register if the LFIWZX instruction is enabled or NO_REGS.")
-;; NO_REGs register constraint, used to merge mov{sd,sf}, since movsd can use
-;; direct move directly, and movsf can't to move between the register sets.
-;; There is a mode_attr that resolves to wm for SDmode and wn for SFmode
-(define_register_constraint "wn" "NO_REGS")
-
;; Lq/stq validates the address for load/store quad
(define_memory_constraint "wQ"
"Memory operand suitable for the load/store quad instructions"
diff --git a/gcc/config/rs6000/darwin.md b/gcc/config/rs6000/darwin.md
index 24e8cfaafe1..2f15c5389c6 100644
--- a/gcc/config/rs6000/darwin.md
+++ b/gcc/config/rs6000/darwin.md
@@ -260,7 +260,14 @@ You should have received a copy of the GNU General Public License
(unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
(pc)] UNSPEC_LD_MPIC))]
"(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
- "bcl 20,31,%0\\n%0:"
+{
+#if TARGET_MACHO
+ machopic_should_output_picbase_label (); /* Update for new func. */
+#else
+ gcc_unreachable ();
+#endif
+ return "bcl 20,31,%0\\n%0:";
+}
[(set_attr "type" "branch")
(set_attr "length" "4")])
@@ -269,7 +276,14 @@ You should have received a copy of the GNU General Public License
(unspec:DI [(match_operand:DI 0 "immediate_operand" "s")
(pc)] UNSPEC_LD_MPIC))]
"(DEFAULT_ABI == ABI_DARWIN) && flag_pic && TARGET_64BIT"
- "bcl 20,31,%0\\n%0:"
+{
+#if TARGET_MACHO
+ machopic_should_output_picbase_label (); /* Update for new func. */
+#else
+ gcc_unreachable ();
+#endif
+ return "bcl 20,31,%0\\n%0:";
+}
[(set_attr "type" "branch")
(set_attr "length" "4")])
@@ -370,3 +384,97 @@ You should have received a copy of the GNU General Public License
}
[(set_attr "type" "branch,branch")
(set_attr "length" "4,8")])
+
+(define_expand "reload_macho_picbase"
+ [(set (reg:SI 65)
+ (unspec [(match_operand 0 "" "")]
+ UNSPEC_RELD_MPIC))]
+ "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
+{
+ if (TARGET_32BIT)
+ emit_insn (gen_reload_macho_picbase_si (operands[0]));
+ else
+ emit_insn (gen_reload_macho_picbase_di (operands[0]));
+
+ DONE;
+})
+
+(define_insn "reload_macho_picbase_si"
+ [(set (reg:SI 65)
+ (unspec:SI [(match_operand:SI 0 "immediate_operand" "s")
+ (pc)] UNSPEC_RELD_MPIC))]
+ "(DEFAULT_ABI == ABI_DARWIN) && flag_pic"
+{
+#if TARGET_MACHO
+ if (machopic_should_output_picbase_label ())
+ {
+ static char tmp[64];
+ const char *cnam = machopic_get_function_picbase ();
+ snprintf (tmp, 64, "bcl 20,31,%s\\n%s:\\n%%0:", cnam, cnam);
+ return tmp;
+ }
+ else
+#else
+ gcc_unreachable ();
+#endif
+ return "bcl 20,31,%0\\n%0:";
+}
+ [(set_attr "type" "branch")
+ (set_attr "length" "4")])
+
+(define_insn "reload_macho_picbase_di"
+ [(set (reg:DI 65)
+ (unspec:DI [(match_operand:DI 0 "immediate_operand" "s")
+ (pc)] UNSPEC_RELD_MPIC))]
+ "(DEFAULT_ABI == ABI_DARWIN) && flag_pic && TARGET_64BIT"
+{
+#if TARGET_MACHO
+ if (machopic_should_output_picbase_label ())
+ {
+ static char tmp[64];
+ const char *cnam = machopic_get_function_picbase ();
+ snprintf (tmp, 64, "bcl 20,31,%s\\n%s:\\n%%0:", cnam, cnam);
+ return tmp;
+ }
+ else
+#else
+ gcc_unreachable ();
+#endif
+ return "bcl 20,31,%0\\n%0:";
+}
+ [(set_attr "type" "branch")
+ (set_attr "length" "4")])
+
+;; We need to restore the PIC register, at the site of nonlocal label.
+
+(define_insn_and_split "nonlocal_goto_receiver"
+ [(unspec_volatile [(const_int 0)] UNSPECV_NLGR)]
+ "TARGET_MACHO && flag_pic"
+ "#"
+ "&& reload_completed"
+ [(const_int 0)]
+{
+#if TARGET_MACHO
+ if (crtl->uses_pic_offset_table)
+ {
+ static unsigned n = 0;
+ rtx picrtx = gen_rtx_SYMBOL_REF (Pmode, MACHOPIC_FUNCTION_BASE_NAME);
+ rtx picreg = gen_rtx_REG (Pmode, RS6000_PIC_OFFSET_TABLE_REGNUM);
+ rtx tmplrtx;
+ char tmplab[20];
+
+ ASM_GENERATE_INTERNAL_LABEL(tmplab, "Lnlgr", ++n);
+ tmplrtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (tmplab));
+
+ emit_insn (gen_reload_macho_picbase (tmplrtx));
+ emit_move_insn (picreg, gen_rtx_REG (Pmode, LR_REGNO));
+ emit_insn (gen_macho_correct_pic (picreg, picreg, picrtx, tmplrtx));
+ }
+ else
+ /* Not using PIC reg, no reload needed. */
+ emit_note (NOTE_INSN_DELETED);
+#else
+ gcc_unreachable ();
+#endif
+ DONE;
+})
diff --git a/gcc/config/rs6000/driver-rs6000.c b/gcc/config/rs6000/driver-rs6000.c
index 1a173d0b1cc..e608dce184c 100644
--- a/gcc/config/rs6000/driver-rs6000.c
+++ b/gcc/config/rs6000/driver-rs6000.c
@@ -167,7 +167,7 @@ elf_platform (void)
if (fd != -1)
{
- static char buf[1024];
+ char buf[1024];
ElfW(auxv_t) *av;
ssize_t n;
diff --git a/gcc/config/rs6000/paired.md b/gcc/config/rs6000/paired.md
index 24397b23960..5cb8cf006cc 100644
--- a/gcc/config/rs6000/paired.md
+++ b/gcc/config/rs6000/paired.md
@@ -462,8 +462,8 @@
}")
(define_expand "movmisalignv2sf"
- [(set (match_operand:V2SF 0 "gpc_reg_operand" "=f")
- (match_operand:V2SF 1 "gpc_reg_operand" "f"))]
+ [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
+ (match_operand:V2SF 1 "any_operand" ""))]
"TARGET_PAIRED_FLOAT"
{
paired_expand_vector_move (operands);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index c1acbd825ea..763847c0854 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -189,9 +189,6 @@ unsigned char rs6000_hard_regno_nregs[NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
/* Map register number to register class. */
enum reg_class rs6000_regno_regclass[FIRST_PSEUDO_REGISTER];
-/* Reload functions based on the type and the vector unit. */
-static enum insn_code rs6000_vector_reload[NUM_MACHINE_MODES][2];
-
static int dbg_cost_ctrl;
/* Built in types. */
@@ -316,11 +313,16 @@ static enum rs6000_reg_type reg_class_to_reg_type[N_REG_CLASSES];
#define IS_FP_VECT_REG_TYPE(RTYPE) IN_RANGE(RTYPE, VSX_REG_TYPE, FPR_REG_TYPE)
-/* Direct moves to/from vsx/gpr registers that need an additional register to
- do the move. */
-static enum insn_code reload_fpr_gpr[NUM_MACHINE_MODES];
-static enum insn_code reload_gpr_vsx[NUM_MACHINE_MODES];
-static enum insn_code reload_vsx_gpr[NUM_MACHINE_MODES];
+/* Register type masks based on the type, of valid addressing modes. */
+struct rs6000_reg_addr {
+ enum insn_code reload_load; /* INSN to reload for loading. */
+ enum insn_code reload_store; /* INSN to reload for storing. */
+ enum insn_code reload_fpr_gpr; /* INSN to move from FPR to GPR. */
+ enum insn_code reload_gpr_vsx; /* INSN to move from GPR to VSX. */
+ enum insn_code reload_vsx_gpr; /* INSN to move from VSX to GPR. */
+};
+
+static struct rs6000_reg_addr reg_addr[NUM_MACHINE_MODES];
/* Target cpu costs. */
@@ -1624,19 +1626,28 @@ rs6000_hard_regno_mode_ok (int regno, enum machine_mode mode)
/* VSX registers that overlap the FPR registers are larger than for non-VSX
implementations. Don't allow an item to be split between a FP register
- and an Altivec register. */
- if (VECTOR_MEM_VSX_P (mode))
+ and an Altivec register. Allow TImode in all VSX registers if the user
+ asked for it. */
+ if (TARGET_VSX && VSX_REGNO_P (regno)
+ && (VECTOR_MEM_VSX_P (mode)
+ || (TARGET_VSX_SCALAR_FLOAT && mode == SFmode)
+ || (TARGET_VSX_SCALAR_DOUBLE && (mode == DFmode || mode == DImode))
+ || (TARGET_VSX_TIMODE && mode == TImode)))
{
if (FP_REGNO_P (regno))
return FP_REGNO_P (last_regno);
if (ALTIVEC_REGNO_P (regno))
- return ALTIVEC_REGNO_P (last_regno);
- }
+ {
+ if (mode == SFmode && !TARGET_UPPER_REGS_SF)
+ return 0;
- /* Allow TImode in all VSX registers if the user asked for it. */
- if (mode == TImode && TARGET_VSX_TIMODE && VSX_REGNO_P (regno))
- return 1;
+ if ((mode == DFmode || mode == DImode) && !TARGET_UPPER_REGS_DF)
+ return 0;
+
+ return ALTIVEC_REGNO_P (last_regno);
+ }
+ }
/* The GPRs can hold any mode, but values bigger than one register
cannot go past R31. */
@@ -1891,8 +1902,11 @@ rs6000_debug_reg_global (void)
"wr reg_class = %s\n"
"ws reg_class = %s\n"
"wt reg_class = %s\n"
+ "wu reg_class = %s\n"
"wv reg_class = %s\n"
+ "ww reg_class = %s\n"
"wx reg_class = %s\n"
+ "wy reg_class = %s\n"
"wz reg_class = %s\n"
"\n",
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_d]],
@@ -1907,14 +1921,17 @@ rs6000_debug_reg_global (void)
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wr]],
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ws]],
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wt]],
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wu]],
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wv]],
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_ww]],
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wx]],
+ reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wy]],
reg_class_names[rs6000_constraints[RS6000_CONSTRAINT_wz]]);
for (m = 0; m < NUM_MACHINE_MODES; ++m)
if (rs6000_vector_unit[m] || rs6000_vector_mem[m]
- || (rs6000_vector_reload[m][0] != CODE_FOR_nothing)
- || (rs6000_vector_reload[m][1] != CODE_FOR_nothing))
+ || (reg_addr[m].reload_load != CODE_FOR_nothing)
+ || (reg_addr[m].reload_store != CODE_FOR_nothing))
{
nl = "\n";
fprintf (stderr,
@@ -1923,8 +1940,8 @@ rs6000_debug_reg_global (void)
GET_MODE_NAME (m),
rs6000_debug_vector_unit[ rs6000_vector_unit[m] ],
rs6000_debug_vector_unit[ rs6000_vector_mem[m] ],
- (rs6000_vector_reload[m][0] != CODE_FOR_nothing) ? 'y' : 'n',
- (rs6000_vector_reload[m][1] != CODE_FOR_nothing) ? 'y' : 'n');
+ (reg_addr[m].reload_store != CODE_FOR_nothing) ? 'y' : 'n',
+ (reg_addr[m].reload_load != CODE_FOR_nothing) ? 'y' : 'n');
}
if (nl)
@@ -2168,7 +2185,7 @@ rs6000_debug_reg_global (void)
static void
rs6000_init_hard_regno_mode_ok (bool global_init_p)
{
- int r, m, c;
+ ssize_t r, m, c;
int align64;
int align32;
@@ -2233,13 +2250,17 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
reg_class_to_reg_type[(int)ALTIVEC_REGS] = ALTIVEC_REG_TYPE;
}
- /* Precalculate vector information, this must be set up before the
- rs6000_hard_regno_nregs_internal below. */
+ /* Precalculate the valid memory formats as well as the vector information,
+ this must be set up before the rs6000_hard_regno_nregs_internal calls
+ below. */
for (m = 0; m < NUM_MACHINE_MODES; ++m)
{
rs6000_vector_unit[m] = rs6000_vector_mem[m] = VECTOR_NONE;
- rs6000_vector_reload[m][0] = CODE_FOR_nothing;
- rs6000_vector_reload[m][1] = CODE_FOR_nothing;
+ reg_addr[m].reload_load = CODE_FOR_nothing;
+ reg_addr[m].reload_store = CODE_FOR_nothing;
+ reg_addr[m].reload_fpr_gpr = CODE_FOR_nothing;
+ reg_addr[m].reload_gpr_vsx = CODE_FOR_nothing;
+ reg_addr[m].reload_vsx_gpr = CODE_FOR_nothing;
}
for (c = 0; c < (int)(int)RS6000_CONSTRAINT_MAX; c++)
@@ -2320,7 +2341,7 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
{
rs6000_vector_unit[DFmode] = VECTOR_VSX;
rs6000_vector_mem[DFmode]
- = (TARGET_VSX_SCALAR_MEMORY ? VECTOR_VSX : VECTOR_NONE);
+ = (TARGET_UPPER_REGS_DF ? VECTOR_VSX : VECTOR_NONE);
rs6000_vector_align[DFmode] = align64;
}
@@ -2334,7 +2355,34 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
/* TODO add SPE and paired floating point vector support. */
/* Register class constraints for the constraints that depend on compile
- switches. */
+ switches. When the VSX code was added, different constraints were added
+ based on the type (DFmode, V2DFmode, V4SFmode). For the vector types, all
+ of the VSX registers are used. The register classes for scalar floating
+ point types is set, based on whether we allow that type into the upper
+ (Altivec) registers. GCC has register classes to target the Altivec
+ registers for load/store operations, to select using a VSX memory
+ operation instead of the traditional floating point operation. The
+ constraints are:
+
+ d - Register class to use with traditional DFmode instructions.
+ f - Register class to use with traditional SFmode instructions.
+ v - Altivec register.
+ wa - Any VSX register.
+ wd - Preferred register class for V2DFmode.
+ wf - Preferred register class for V4SFmode.
+ wg - Float register for power6x move insns.
+ wl - Float register if we can do 32-bit signed int loads.
+ wm - VSX register for ISA 2.07 direct move operations.
+ wr - GPR if 64-bit mode is permitted.
+ ws - Register class to do ISA 2.06 DF operations.
+ wu - Altivec register for ISA 2.07 VSX SF/SI load/stores.
+ wv - Altivec register for ISA 2.06 VSX DF/DI load/stores.
+ wt - VSX register for TImode in VSX registers.
+ ww - Register class to do SF conversions in with VSX operations.
+ wx - Float register if we can do 32-bit int stores.
+ wy - Register class to do ISA 2.07 SF operations.
+ wz - Float register if we can do 32-bit unsigned int loads. */
+
if (TARGET_HARD_FLOAT && TARGET_FPRS)
rs6000_constraints[RS6000_CONSTRAINT_f] = FLOAT_REGS;
@@ -2343,19 +2391,20 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
if (TARGET_VSX)
{
- /* At present, we just use VSX_REGS, but we have different constraints
- based on the use, in case we want to fine tune the default register
- class used. wa = any VSX register, wf = register class to use for
- V4SF, wd = register class to use for V2DF, and ws = register classs to
- use for DF scalars. */
rs6000_constraints[RS6000_CONSTRAINT_wa] = VSX_REGS;
- rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS;
rs6000_constraints[RS6000_CONSTRAINT_wd] = VSX_REGS;
- rs6000_constraints[RS6000_CONSTRAINT_ws] = (TARGET_VSX_SCALAR_MEMORY
- ? VSX_REGS
- : FLOAT_REGS);
+ rs6000_constraints[RS6000_CONSTRAINT_wf] = VSX_REGS;
+
if (TARGET_VSX_TIMODE)
rs6000_constraints[RS6000_CONSTRAINT_wt] = VSX_REGS;
+
+ if (TARGET_UPPER_REGS_DF)
+ {
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = VSX_REGS;
+ rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS;
+ }
+ else
+ rs6000_constraints[RS6000_CONSTRAINT_ws] = FLOAT_REGS;
}
/* Add conditional constraints based on various options, to allow us to
@@ -2375,8 +2424,19 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
if (TARGET_POWERPC64)
rs6000_constraints[RS6000_CONSTRAINT_wr] = GENERAL_REGS;
- if (TARGET_P8_VECTOR)
- rs6000_constraints[RS6000_CONSTRAINT_wv] = ALTIVEC_REGS;
+ if (TARGET_P8_VECTOR && TARGET_UPPER_REGS_SF)
+ {
+ rs6000_constraints[RS6000_CONSTRAINT_wu] = ALTIVEC_REGS;
+ rs6000_constraints[RS6000_CONSTRAINT_wy] = VSX_REGS;
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = VSX_REGS;
+ }
+ else if (TARGET_P8_VECTOR)
+ {
+ rs6000_constraints[RS6000_CONSTRAINT_wy] = FLOAT_REGS;
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
+ }
+ else if (TARGET_VSX)
+ rs6000_constraints[RS6000_CONSTRAINT_ww] = FLOAT_REGS;
if (TARGET_STFIWX)
rs6000_constraints[RS6000_CONSTRAINT_wx] = FLOAT_REGS;
@@ -2384,112 +2444,104 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
if (TARGET_LFIWZX)
rs6000_constraints[RS6000_CONSTRAINT_wz] = FLOAT_REGS;
- /* Setup the direct move combinations. */
- for (m = 0; m < NUM_MACHINE_MODES; ++m)
- {
- reload_fpr_gpr[m] = CODE_FOR_nothing;
- reload_gpr_vsx[m] = CODE_FOR_nothing;
- reload_vsx_gpr[m] = CODE_FOR_nothing;
- }
-
/* Set up the reload helper and direct move functions. */
if (TARGET_VSX || TARGET_ALTIVEC)
{
if (TARGET_64BIT)
{
- rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_di_store;
- rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_di_load;
- rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_di_store;
- rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_di_load;
- rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_di_store;
- rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_di_load;
- rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_di_store;
- rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_di_load;
- rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_di_store;
- rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_di_load;
- rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_di_store;
- rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_di_load;
- if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
+ reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_di_store;
+ reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_di_load;
+ reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_di_store;
+ reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_di_load;
+ reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_di_store;
+ reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_di_load;
+ reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_di_store;
+ reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_di_load;
+ reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_di_store;
+ reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_di_load;
+ reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_di_store;
+ reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_di_load;
+ if (TARGET_VSX && TARGET_UPPER_REGS_DF)
{
- rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_di_store;
- rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_di_load;
- rs6000_vector_reload[DDmode][0] = CODE_FOR_reload_dd_di_store;
- rs6000_vector_reload[DDmode][1] = CODE_FOR_reload_dd_di_load;
+ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_di_store;
+ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_di_load;
+ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_di_store;
+ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_di_load;
}
if (TARGET_P8_VECTOR)
{
- rs6000_vector_reload[SFmode][0] = CODE_FOR_reload_sf_di_store;
- rs6000_vector_reload[SFmode][1] = CODE_FOR_reload_sf_di_load;
- rs6000_vector_reload[SDmode][0] = CODE_FOR_reload_sd_di_store;
- rs6000_vector_reload[SDmode][1] = CODE_FOR_reload_sd_di_load;
+ reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_di_store;
+ reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_di_load;
+ reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_di_store;
+ reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_di_load;
}
if (TARGET_VSX_TIMODE)
{
- rs6000_vector_reload[TImode][0] = CODE_FOR_reload_ti_di_store;
- rs6000_vector_reload[TImode][1] = CODE_FOR_reload_ti_di_load;
+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_di_store;
+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_di_load;
}
if (TARGET_DIRECT_MOVE)
{
if (TARGET_POWERPC64)
{
- reload_gpr_vsx[TImode] = CODE_FOR_reload_gpr_from_vsxti;
- reload_gpr_vsx[V2DFmode] = CODE_FOR_reload_gpr_from_vsxv2df;
- reload_gpr_vsx[V2DImode] = CODE_FOR_reload_gpr_from_vsxv2di;
- reload_gpr_vsx[V4SFmode] = CODE_FOR_reload_gpr_from_vsxv4sf;
- reload_gpr_vsx[V4SImode] = CODE_FOR_reload_gpr_from_vsxv4si;
- reload_gpr_vsx[V8HImode] = CODE_FOR_reload_gpr_from_vsxv8hi;
- reload_gpr_vsx[V16QImode] = CODE_FOR_reload_gpr_from_vsxv16qi;
- reload_gpr_vsx[SFmode] = CODE_FOR_reload_gpr_from_vsxsf;
-
- reload_vsx_gpr[TImode] = CODE_FOR_reload_vsx_from_gprti;
- reload_vsx_gpr[V2DFmode] = CODE_FOR_reload_vsx_from_gprv2df;
- reload_vsx_gpr[V2DImode] = CODE_FOR_reload_vsx_from_gprv2di;
- reload_vsx_gpr[V4SFmode] = CODE_FOR_reload_vsx_from_gprv4sf;
- reload_vsx_gpr[V4SImode] = CODE_FOR_reload_vsx_from_gprv4si;
- reload_vsx_gpr[V8HImode] = CODE_FOR_reload_vsx_from_gprv8hi;
- reload_vsx_gpr[V16QImode] = CODE_FOR_reload_vsx_from_gprv16qi;
- reload_vsx_gpr[SFmode] = CODE_FOR_reload_vsx_from_gprsf;
+ reg_addr[TImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxti;
+ reg_addr[V2DFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2df;
+ reg_addr[V2DImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv2di;
+ reg_addr[V4SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4sf;
+ reg_addr[V4SImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv4si;
+ reg_addr[V8HImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv8hi;
+ reg_addr[V16QImode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxv16qi;
+ reg_addr[SFmode].reload_gpr_vsx = CODE_FOR_reload_gpr_from_vsxsf;
+
+ reg_addr[TImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprti;
+ reg_addr[V2DFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2df;
+ reg_addr[V2DImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv2di;
+ reg_addr[V4SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4sf;
+ reg_addr[V4SImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv4si;
+ reg_addr[V8HImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv8hi;
+ reg_addr[V16QImode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprv16qi;
+ reg_addr[SFmode].reload_vsx_gpr = CODE_FOR_reload_vsx_from_gprsf;
}
else
{
- reload_fpr_gpr[DImode] = CODE_FOR_reload_fpr_from_gprdi;
- reload_fpr_gpr[DDmode] = CODE_FOR_reload_fpr_from_gprdd;
- reload_fpr_gpr[DFmode] = CODE_FOR_reload_fpr_from_gprdf;
+ reg_addr[DImode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdi;
+ reg_addr[DDmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdd;
+ reg_addr[DFmode].reload_fpr_gpr = CODE_FOR_reload_fpr_from_gprdf;
}
}
}
else
{
- rs6000_vector_reload[V16QImode][0] = CODE_FOR_reload_v16qi_si_store;
- rs6000_vector_reload[V16QImode][1] = CODE_FOR_reload_v16qi_si_load;
- rs6000_vector_reload[V8HImode][0] = CODE_FOR_reload_v8hi_si_store;
- rs6000_vector_reload[V8HImode][1] = CODE_FOR_reload_v8hi_si_load;
- rs6000_vector_reload[V4SImode][0] = CODE_FOR_reload_v4si_si_store;
- rs6000_vector_reload[V4SImode][1] = CODE_FOR_reload_v4si_si_load;
- rs6000_vector_reload[V2DImode][0] = CODE_FOR_reload_v2di_si_store;
- rs6000_vector_reload[V2DImode][1] = CODE_FOR_reload_v2di_si_load;
- rs6000_vector_reload[V4SFmode][0] = CODE_FOR_reload_v4sf_si_store;
- rs6000_vector_reload[V4SFmode][1] = CODE_FOR_reload_v4sf_si_load;
- rs6000_vector_reload[V2DFmode][0] = CODE_FOR_reload_v2df_si_store;
- rs6000_vector_reload[V2DFmode][1] = CODE_FOR_reload_v2df_si_load;
- if (TARGET_VSX && TARGET_VSX_SCALAR_MEMORY)
+ reg_addr[V16QImode].reload_store = CODE_FOR_reload_v16qi_si_store;
+ reg_addr[V16QImode].reload_load = CODE_FOR_reload_v16qi_si_load;
+ reg_addr[V8HImode].reload_store = CODE_FOR_reload_v8hi_si_store;
+ reg_addr[V8HImode].reload_load = CODE_FOR_reload_v8hi_si_load;
+ reg_addr[V4SImode].reload_store = CODE_FOR_reload_v4si_si_store;
+ reg_addr[V4SImode].reload_load = CODE_FOR_reload_v4si_si_load;
+ reg_addr[V2DImode].reload_store = CODE_FOR_reload_v2di_si_store;
+ reg_addr[V2DImode].reload_load = CODE_FOR_reload_v2di_si_load;
+ reg_addr[V4SFmode].reload_store = CODE_FOR_reload_v4sf_si_store;
+ reg_addr[V4SFmode].reload_load = CODE_FOR_reload_v4sf_si_load;
+ reg_addr[V2DFmode].reload_store = CODE_FOR_reload_v2df_si_store;
+ reg_addr[V2DFmode].reload_load = CODE_FOR_reload_v2df_si_load;
+ if (TARGET_VSX && TARGET_UPPER_REGS_DF)
{
- rs6000_vector_reload[DFmode][0] = CODE_FOR_reload_df_si_store;
- rs6000_vector_reload[DFmode][1] = CODE_FOR_reload_df_si_load;
- rs6000_vector_reload[DDmode][0] = CODE_FOR_reload_dd_si_store;
- rs6000_vector_reload[DDmode][1] = CODE_FOR_reload_dd_si_load;
+ reg_addr[DFmode].reload_store = CODE_FOR_reload_df_si_store;
+ reg_addr[DFmode].reload_load = CODE_FOR_reload_df_si_load;
+ reg_addr[DDmode].reload_store = CODE_FOR_reload_dd_si_store;
+ reg_addr[DDmode].reload_load = CODE_FOR_reload_dd_si_load;
}
if (TARGET_P8_VECTOR)
{
- rs6000_vector_reload[SFmode][0] = CODE_FOR_reload_sf_si_store;
- rs6000_vector_reload[SFmode][1] = CODE_FOR_reload_sf_si_load;
- rs6000_vector_reload[SDmode][0] = CODE_FOR_reload_sd_si_store;
- rs6000_vector_reload[SDmode][1] = CODE_FOR_reload_sd_si_load;
+ reg_addr[SFmode].reload_store = CODE_FOR_reload_sf_si_store;
+ reg_addr[SFmode].reload_load = CODE_FOR_reload_sf_si_load;
+ reg_addr[SDmode].reload_store = CODE_FOR_reload_sd_si_store;
+ reg_addr[SDmode].reload_load = CODE_FOR_reload_sd_si_load;
}
if (TARGET_VSX_TIMODE)
{
- rs6000_vector_reload[TImode][0] = CODE_FOR_reload_ti_si_store;
- rs6000_vector_reload[TImode][1] = CODE_FOR_reload_ti_si_load;
+ reg_addr[TImode].reload_store = CODE_FOR_reload_ti_si_store;
+ reg_addr[TImode].reload_load = CODE_FOR_reload_ti_si_load;
}
}
}
@@ -5926,7 +5978,7 @@ toc_relative_expr_p (const_rtx op, bool strict)
tocrel_base = op;
tocrel_offset = const0_rtx;
- if (GET_CODE (op) == PLUS && CONST_INT_P (XEXP (op, 1)))
+ if (GET_CODE (op) == PLUS && add_cint_operand (XEXP (op, 1), GET_MODE (op)))
{
tocrel_base = XEXP (op, 0);
tocrel_offset = XEXP (op, 1);
@@ -7195,10 +7247,13 @@ rs6000_debug_legitimate_address_p (enum machine_mode mode, rtx x,
bool ret = rs6000_legitimate_address_p (mode, x, reg_ok_strict);
fprintf (stderr,
"\nrs6000_legitimate_address_p: return = %s, mode = %s, "
- "strict = %d, code = %s\n",
+ "strict = %d, reload = %s, code = %s\n",
ret ? "true" : "false",
GET_MODE_NAME (mode),
reg_ok_strict,
+ (reload_completed
+ ? "after"
+ : (reload_in_progress ? "progress" : "before")),
GET_RTX_NAME (GET_CODE (x)));
debug_rtx (x);
@@ -14705,7 +14760,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
{
cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */
- icode = reload_vsx_gpr[(int)mode];
+ icode = reg_addr[mode].reload_vsx_gpr;
}
/* Handle moving 128-bit values from VSX point registers to GPRs on
@@ -14714,7 +14769,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
{
cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */
- icode = reload_gpr_vsx[(int)mode];
+ icode = reg_addr[mode].reload_gpr_vsx;
}
}
@@ -14723,13 +14778,13 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
{
cost = 3; /* xscvdpspn, mfvsrd, and. */
- icode = reload_gpr_vsx[(int)mode];
+ icode = reg_addr[mode].reload_gpr_vsx;
}
else if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
{
cost = 2; /* mtvsrz, xscvspdpn. */
- icode = reload_vsx_gpr[(int)mode];
+ icode = reg_addr[mode].reload_vsx_gpr;
}
}
}
@@ -14742,7 +14797,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE)
{
cost = 3; /* 2 mtvsrd's, 1 xxpermdi. */
- icode = reload_vsx_gpr[(int)mode];
+ icode = reg_addr[mode].reload_vsx_gpr;
}
/* Handle moving 128-bit values from VSX point registers to GPRs on
@@ -14751,7 +14806,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
else if (to_type == GPR_REG_TYPE && from_type == VSX_REG_TYPE)
{
cost = 3; /* 2 mfvsrd's, 1 xxpermdi. */
- icode = reload_gpr_vsx[(int)mode];
+ icode = reg_addr[mode].reload_gpr_vsx;
}
}
@@ -14767,7 +14822,7 @@ rs6000_secondary_reload_direct_move (enum rs6000_reg_type to_type,
if (to_type == VSX_REG_TYPE && from_type == GPR_REG_TYPE && !altivec_p)
{
cost = 3; /* 2 mtvsrwz's, 1 fmrgow. */
- icode = reload_fpr_gpr[(int)mode];
+ icode = reg_addr[mode].reload_fpr_gpr;
}
}
@@ -14850,7 +14905,9 @@ rs6000_secondary_reload (bool in_p,
bool default_p = false;
sri->icode = CODE_FOR_nothing;
- icode = rs6000_vector_reload[mode][in_p != false];
+ icode = ((in_p)
+ ? reg_addr[mode].reload_load
+ : reg_addr[mode].reload_store);
if (REG_P (x) || register_operand (x, mode))
{
@@ -14865,6 +14922,7 @@ rs6000_secondary_reload (bool in_p,
from_type = exchange;
}
+ /* Can we do a direct move of some sort? */
if (rs6000_secondary_reload_move (to_type, from_type, mode, sri,
altivec_p))
{
@@ -17541,7 +17599,7 @@ output_cbranch (rtx op, const char *label, int reversed, rtx insn)
if (note != NULL_RTX)
{
/* PROB is the difference from 50%. */
- int prob = INTVAL (XEXP (note, 0)) - REG_BR_PROB_BASE / 2;
+ int prob = XINT (note, 0) - REG_BR_PROB_BASE / 2;
/* Only hint for highly probable/improbable branches on newer
cpus as static prediction overrides processor dynamic
@@ -18147,12 +18205,12 @@ rs6000_emit_minmax (rtx dest, enum rtx_code code, rtx op0, rtx op1)
static void
emit_unlikely_jump (rtx cond, rtx label)
{
- rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1);
+ int very_unlikely = REG_BR_PROB_BASE / 100 - 1;
rtx x;
x = gen_rtx_IF_THEN_ELSE (VOIDmode, cond, label, pc_rtx);
x = emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, x));
- add_reg_note (x, REG_BR_PROB, very_unlikely);
+ add_int_reg_note (x, REG_BR_PROB, very_unlikely);
}
/* A subroutine of the atomic operation splitters. Emit a load-locked
@@ -28992,6 +29050,27 @@ rs6000_init_dwarf_reg_sizes_extra (tree address)
emit_move_insn (adjust_address (mem, mode, offset), value);
}
}
+
+ if (TARGET_MACHO && ! TARGET_ALTIVEC)
+ {
+ int i;
+ enum machine_mode mode = TYPE_MODE (char_type_node);
+ rtx addr = expand_expr (address, NULL_RTX, VOIDmode, EXPAND_NORMAL);
+ rtx mem = gen_rtx_MEM (BLKmode, addr);
+ rtx value = gen_int_mode (16, mode);
+
+ /* On Darwin, libgcc may be built to run on both G3 and G4/5.
+ The unwinder still needs to know the size of Altivec registers. */
+
+ for (i = FIRST_ALTIVEC_REGNO; i < LAST_ALTIVEC_REGNO+1; i++)
+ {
+ int column = DWARF_REG_TO_UNWIND_COLUMN (i);
+ HOST_WIDE_INT offset
+ = DWARF_FRAME_REGNUM (column) * GET_MODE_SIZE (mode);
+
+ emit_move_insn (adjust_address (mem, mode, offset), value);
+ }
+ }
}
/* Map internal gcc register numbers to DWARF2 register numbers. */
@@ -29162,6 +29241,8 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
{ "recip-precision", OPTION_MASK_RECIP_PRECISION, false, true },
{ "string", OPTION_MASK_STRING, false, true },
{ "update", OPTION_MASK_NO_UPDATE, true , true },
+ { "upper-regs-df", OPTION_MASK_UPPER_REGS_DF, false, false },
+ { "upper-regs-sf", OPTION_MASK_UPPER_REGS_SF, false, false },
{ "vsx", OPTION_MASK_VSX, false, true },
{ "vsx-timode", OPTION_MASK_VSX_TIMODE, false, true },
#ifdef OPTION_MASK_64BIT
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index a5a7a859426..34647033b8a 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1403,15 +1403,18 @@ enum r6000_reg_class_enum {
RS6000_CONSTRAINT_v, /* Altivec registers */
RS6000_CONSTRAINT_wa, /* Any VSX register */
RS6000_CONSTRAINT_wd, /* VSX register for V2DF */
- RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */
RS6000_CONSTRAINT_wf, /* VSX register for V4SF */
+ RS6000_CONSTRAINT_wg, /* FPR register for -mmfpgpr */
RS6000_CONSTRAINT_wl, /* FPR register for LFIWAX */
RS6000_CONSTRAINT_wm, /* VSX register for direct move */
RS6000_CONSTRAINT_wr, /* GPR register if 64-bit */
RS6000_CONSTRAINT_ws, /* VSX register for DF */
RS6000_CONSTRAINT_wt, /* VSX register for TImode */
- RS6000_CONSTRAINT_wv, /* Altivec register for power8 vector */
+ RS6000_CONSTRAINT_wu, /* Altivec register for float load/stores. */
+ RS6000_CONSTRAINT_wv, /* Altivec register for double load/stores. */
+ RS6000_CONSTRAINT_ww, /* FP or VSX register for vsx float ops. */
RS6000_CONSTRAINT_wx, /* FPR register for STFIWX */
+ RS6000_CONSTRAINT_wy, /* VSX register for SF */
RS6000_CONSTRAINT_wz, /* FPR register for LFIWZX */
RS6000_CONSTRAINT_MAX
};
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 9f749f9a591..4bd3389fcf7 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -87,6 +87,7 @@
UNSPEC_FRIP
UNSPEC_FRIZ
UNSPEC_LD_MPIC ; load_macho_picbase
+ UNSPEC_RELD_MPIC ; re-load_macho_picbase
UNSPEC_MPIC_CORRECT ; macho_correct_pic
UNSPEC_TLSGD
UNSPEC_TLSLD
@@ -150,6 +151,7 @@
UNSPECV_EH_RR ; eh_reg_restore
UNSPECV_ISYNC ; isync instruction
UNSPECV_MFTB ; move from time base
+ UNSPECV_NLGR ; non-local goto receiver
])
@@ -314,13 +316,13 @@
(define_mode_attr f32_lr [(SF "f") (SD "wz")])
(define_mode_attr f32_lm [(SF "m") (SD "Z")])
(define_mode_attr f32_li [(SF "lfs%U1%X1 %0,%1") (SD "lfiwzx %0,%y1")])
-(define_mode_attr f32_lv [(SF "lxsspx %0,%y1") (SD "lxsiwzx %0,%y1")])
+(define_mode_attr f32_lv [(SF "lxsspx %x0,%y1") (SD "lxsiwzx %x0,%y1")])
; Definitions for store from 32-bit fpr register
(define_mode_attr f32_sr [(SF "f") (SD "wx")])
(define_mode_attr f32_sm [(SF "m") (SD "Z")])
(define_mode_attr f32_si [(SF "stfs%U0%X0 %1,%0") (SD "stfiwx %1,%y0")])
-(define_mode_attr f32_sv [(SF "stxsspx %1,%y0") (SD "stxsiwzx %1,%y0")])
+(define_mode_attr f32_sv [(SF "stxsspx %x1,%y0") (SD "stxsiwzx %x1,%y0")])
; Definitions for 32-bit fpr direct move
(define_mode_attr f32_dm [(SF "wn") (SD "wm")])
@@ -541,7 +543,7 @@
"")
(define_insn "*zero_extendsidi2_lfiwzx"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wm")
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wz,!wu")
(zero_extend:DI (match_operand:SI 1 "reg_or_mem_operand" "m,r,r,Z,Z")))]
"TARGET_POWERPC64 && TARGET_LFIWZX"
"@
@@ -711,7 +713,7 @@
"")
(define_insn "*extendsidi2_lfiwax"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wm")
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=r,r,??wm,!wl,!wu")
(sign_extend:DI (match_operand:SI 1 "lwa_operand" "m,r,r,Z,Z")))]
"TARGET_POWERPC64 && TARGET_LFIWAX"
"@
@@ -5066,13 +5068,16 @@
"")
(define_insn_and_split "*extendsfdf2_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
- (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d,wy,?wy,wv")
+ (float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m,0,wz,Z")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"@
#
fmr %0,%1
- lfs%U1%X1 %0,%1"
+ lfs%U1%X1 %0,%1
+ #
+ xxlor %x0,%x1,%x1
+ lxsspx %x0,%y1"
"&& reload_completed && REG_P (operands[1]) && REGNO (operands[0]) == REGNO (operands[1])"
[(const_int 0)]
{
@@ -5088,7 +5093,16 @@
(if_then_else
(match_test "update_address_mem (operands[1], VOIDmode)")
(const_string "fpload_u")
- (const_string "fpload")))])])
+ (const_string "fpload")))
+ (const_string "fp")
+ (const_string "vecsimple")
+ (if_then_else
+ (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
+ (const_string "fpload_ux")
+ (if_then_else
+ (match_test "update_address_mem (operands[1], VOIDmode)")
+ (const_string "fpload_u")
+ (const_string "fpload")))])])
(define_expand "truncdfsf2"
[(set (match_operand:SF 0 "gpc_reg_operand" "")
@@ -9290,8 +9304,8 @@
}")
(define_insn "mov<mode>_hardfloat"
- [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,wm,Z,?<f32_dm>,?r,*c*l,!r,*h,!r,!r")
- (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,Z,wm,r,<f32_dm>,r,h,0,G,Fn"))]
+ [(set (match_operand:FMOVE32 0 "nonimmediate_operand" "=!r,!r,m,f,wa,wa,<f32_lr>,<f32_sm>,wu,Z,?<f32_dm>,?r,*c*l,!r,*h,!r,!r")
+ (match_operand:FMOVE32 1 "input_operand" "r,m,r,f,wa,j,<f32_lm>,<f32_sr>,Z,wu,r,<f32_dm>,r,h,0,G,Fn"))]
"(gpc_reg_operand (operands[0], <MODE>mode)
|| gpc_reg_operand (operands[1], <MODE>mode))
&& (TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT)"
@@ -9492,8 +9506,8 @@
;; reloading.
(define_insn "*mov<mode>_hardfloat32"
- [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,!r,!r,!r")
- (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,G,H,F"))]
+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,!r,!r,!r")
+ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,G,H,F"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], <MODE>mode)
|| gpc_reg_operand (operands[1], <MODE>mode))"
@@ -9502,11 +9516,8 @@
lfd%U1%X1 %0,%1
fmr %0,%1
lxsd%U1x %x0,%y1
- lxsd%U1x %x0,%y1
- stxsd%U0x %x1,%y0
stxsd%U0x %x1,%y0
xxlor %x0,%x1,%x1
- xxlor %x0,%x1,%x1
xxlxor %x0,%x0,%x0
#
#
@@ -9535,27 +9546,18 @@
(const_string "fpload_ux")
(const_string "fpload"))
(if_then_else
- (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
- (const_string "fpload_ux")
- (const_string "fpload"))
- (if_then_else
- (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
- (const_string "fpstore_ux")
- (const_string "fpstore"))
- (if_then_else
(match_test "update_indexed_address_mem (operands[0], VOIDmode)")
(const_string "fpstore_ux")
(const_string "fpstore"))
(const_string "vecsimple")
(const_string "vecsimple")
- (const_string "vecsimple")
(const_string "store")
(const_string "load")
(const_string "two")
(const_string "fp")
(const_string "fp")
(const_string "*")])
- (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8,8,8,8,12,16")])
+ (set_attr "length" "4,4,4,4,4,4,4,8,8,8,8,12,16")])
(define_insn "*mov<mode>_softfloat32"
[(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,r,r,r")
@@ -9572,8 +9574,8 @@
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*mov<mode>_hardfloat64"
- [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,ws,?wa,Z,?Z,ws,?wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm")
- (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,Z,ws,wa,ws,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))]
+ [(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=m,d,d,wv,Z,wa,wa,Y,r,!r,*c*l,!r,*h,!r,!r,!r,r,wg,r,wm")
+ (match_operand:FMOVE64 1 "input_operand" "d,m,d,Z,wv,wa,j,r,Y,r,r,h,0,G,H,F,wg,r,wm,r"))]
"TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], <MODE>mode)
|| gpc_reg_operand (operands[1], <MODE>mode))"
@@ -9582,11 +9584,8 @@
lfd%U1%X1 %0,%1
fmr %0,%1
lxsd%U1x %x0,%y1
- lxsd%U1x %x0,%y1
- stxsd%U0x %x1,%y0
stxsd%U0x %x1,%y0
xxlor %x0,%x1,%x1
- xxlor %x0,%x1,%x1
xxlxor %x0,%x0,%x0
std%U0%X0 %1,%0
ld%U1%X1 %0,%1
@@ -9622,20 +9621,11 @@
(const_string "fpload_ux")
(const_string "fpload"))
(if_then_else
- (match_test "update_indexed_address_mem (operands[1], VOIDmode)")
- (const_string "fpload_ux")
- (const_string "fpload"))
- (if_then_else
- (match_test "update_indexed_address_mem (operands[0], VOIDmode)")
- (const_string "fpstore_ux")
- (const_string "fpstore"))
- (if_then_else
(match_test "update_indexed_address_mem (operands[0], VOIDmode)")
(const_string "fpstore_ux")
(const_string "fpstore"))
(const_string "vecsimple")
(const_string "vecsimple")
- (const_string "vecsimple")
(if_then_else
(match_test "update_indexed_address_mem (operands[0], VOIDmode)")
(const_string "store_ux")
@@ -9661,7 +9651,7 @@
(const_string "mffgpr")
(const_string "mftgpr")
(const_string "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,4,4")])
+ (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,4,4,8,12,16,4,4,4,4")])
(define_insn "*mov<mode>_softfloat64"
[(set (match_operand:FMOVE64 0 "nonimmediate_operand" "=Y,r,r,cl,r,r,r,r,*h")
@@ -10324,8 +10314,8 @@
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
(define_insn "*movdi_internal64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,?Z,?wa,?wa,r,*h,*h,?wa,r,?*wg,r,?*wm")
- (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wa,Z,wa,*h,r,0,O,*wg,r,*wm,r"))]
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,?m,?*d,?*d,?Z,?wv,?wa,r,*h,*h,?wa,r,?*wg,r,?*wm")
+ (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,d,m,d,wv,Z,wa,*h,r,0,O,*wg,r,*wm,r"))]
"TARGET_POWERPC64
&& (gpc_reg_operand (operands[0], DImode)
|| gpc_reg_operand (operands[1], DImode))"
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index cd83cb2d206..eae75f57680 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -181,13 +181,16 @@ mvsx
Target Report Mask(VSX) Var(rs6000_isa_flags)
Use vector/scalar (VSX) instructions
+mvsx-scalar-float
+Target Undocumented Report Var(TARGET_VSX_SCALAR_FLOAT) Init(1)
+; If -mpower8-vector, use VSX arithmetic instructions for SFmode (on by default)
+
mvsx-scalar-double
-Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(-1)
-; If -mvsx, use VSX arithmetic instructions for scalar double (on by default)
+Target Undocumented Report Var(TARGET_VSX_SCALAR_DOUBLE) Init(1)
+; If -mvsx, use VSX arithmetic instructions for DFmode (on by default)
mvsx-scalar-memory
-Target Undocumented Report Var(TARGET_VSX_SCALAR_MEMORY)
-; If -mvsx, use VSX scalar memory reference instructions for scalar double (off by default)
+Target Undocumented Report Alias(mupper-regs-df)
mvsx-align-128
Target Undocumented Report Var(TARGET_VSX_ALIGN_128)
@@ -550,3 +553,11 @@ Generate the quad word memory instructions (lq/stq/lqarx/stqcx).
mcompat-align-parm
Target Report Var(rs6000_compat_align_parm) Init(0) Save
Generate aggregate parameter passing code with at most 64-bit alignment.
+
+mupper-regs-df
+Target Undocumented Mask(UPPER_REGS_DF) Var(rs6000_isa_flags)
+Allow double variables in upper registers with -mcpu=power7 or -mvsx
+
+mupper-regs-sf
+Target Undocumented Mask(UPPER_REGS_SF) Var(rs6000_isa_flags)
+Allow float variables in upper registers with -mcpu=power8 or -mp8-vector
diff --git a/gcc/config/rs6000/t-rs6000 b/gcc/config/rs6000/t-rs6000
index 81372dfb140..3123521bd06 100644
--- a/gcc/config/rs6000/t-rs6000
+++ b/gcc/config/rs6000/t-rs6000
@@ -20,21 +20,9 @@
TM_H += $(srcdir)/config/rs6000/rs6000-builtin.def
-rs6000.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(REGS_H) hard-reg-set.h \
- real.h insn-config.h conditions.h insn-attr.h flags.h $(RECOG_H) \
- $(OBSTACK_H) $(TREE_H) $(EXPR_H) $(OPTABS_H) except.h function.h \
- output.h dbxout.h $(BASIC_BLOCK_H) toplev.h $(GGC_H) $(HASHTAB_H) \
- $(TM_P_H) $(TARGET_H) $(TARGET_DEF_H) langhooks.h reload.h gt-rs6000.h \
- cfgloop.h $(OPTS_H) $(COMMON_TARGET_H) dumpfile.h \
- $(srcdir)/config/rs6000/rs6000-cpus.def
-
-rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c \
- $(srcdir)/config/rs6000/rs6000-protos.h \
- $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPPLIB_H) \
- $(TM_P_H) $(C_PRAGMA_H) errors.h coretypes.h $(TM_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/rs6000/rs6000-c.c
+rs6000-c.o: $(srcdir)/config/rs6000/rs6000-c.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
$(srcdir)/config/rs6000/rs6000-tables.opt: $(srcdir)/config/rs6000/genopt.sh \
$(srcdir)/config/rs6000/rs6000-cpus.def
diff --git a/gcc/config/rs6000/x-darwin b/gcc/config/rs6000/x-darwin
index 5672c698b1e..9d92ef547c8 100644
--- a/gcc/config/rs6000/x-darwin
+++ b/gcc/config/rs6000/x-darwin
@@ -1,5 +1,3 @@
-host-ppc-darwin.o : $(srcdir)/config/rs6000/host-darwin.c \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h hosthooks.h $(HOSTHOOKS_DEF_H) toplev.h \
- config/host-darwin.h $(DIAGNOSTIC_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $(INCLUDES) $< -o $@
+host-ppc-darwin.o : $(srcdir)/config/rs6000/host-darwin.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/rs6000/x-darwin64 b/gcc/config/rs6000/x-darwin64
index 921d555ba01..093277147bc 100644
--- a/gcc/config/rs6000/x-darwin64
+++ b/gcc/config/rs6000/x-darwin64
@@ -1,5 +1,3 @@
-host-ppc64-darwin.o : $(srcdir)/config/rs6000/host-ppc64-darwin.c \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h hosthooks.h $(HOSTHOOKS_DEF_H) toplev.h \
- config/host-darwin.h $(DIAGNOSTIC_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $(INCLUDES) $< -o $@
+host-ppc64-darwin.o : $(srcdir)/config/rs6000/host-ppc64-darwin.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 1ea52af0f2b..3bb70f48502 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9589,7 +9589,7 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
rtx retry_reg = gen_reg_rtx (SImode);
rtx retry_label = NULL_RTX;
rtx jump;
- rtx very_unlikely = GEN_INT (REG_BR_PROB_BASE / 100 - 1);
+ int very_unlikely = REG_BR_PROB_BASE / 100 - 1;
if (retry != NULL_RTX)
{
@@ -9612,7 +9612,7 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
JUMP_LABEL (jump) = abort_label;
LABEL_NUSES (abort_label) = 1;
- add_reg_note (jump, REG_BR_PROB, very_unlikely);
+ add_int_reg_note (jump, REG_BR_PROB, very_unlikely);
/* Initialize CC return value. */
emit_move_insn (dest, const0_rtx);
@@ -9632,7 +9632,7 @@ s390_expand_tbegin (rtx dest, rtx tdb, rtx retry, bool clobber_fprs_p)
gen_rtx_REG (CCRAWmode, CC_REGNUM),
gen_rtx_CONST_INT (VOIDmode, CC1 | CC3)));
LABEL_NUSES (leave_label) = 2;
- add_reg_note (jump, REG_BR_PROB, very_unlikely);
+ add_int_reg_note (jump, REG_BR_PROB, very_unlikely);
/* CC2 - transient failure. Perform retry with ppa. */
emit_move_insn (count, retry);
diff --git a/gcc/config/sh/predicates.md b/gcc/config/sh/predicates.md
index 998ba7300ad..10d741abc46 100644
--- a/gcc/config/sh/predicates.md
+++ b/gcc/config/sh/predicates.md
@@ -154,7 +154,7 @@
return (regno != T_REG && regno != PR_REG
&& ! TARGET_REGISTER_P (regno)
- && (regno != FPUL_REG || TARGET_SH4)
+ && regno != FPUL_REG
&& regno != MACH_REG && regno != MACL_REG);
}
/* Allow a no-op sign extension - compare LOAD_EXTEND_OP.
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 60f45452036..e603e740cd0 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -1146,7 +1146,7 @@ sh_print_operand (FILE *stream, rtx x, int code)
{
rtx note = find_reg_note (current_output_insn, REG_BR_PROB, 0);
- if (note && INTVAL (XEXP (note, 0)) * 2 < REG_BR_PROB_BASE)
+ if (note && XINT (note, 0) * 2 < REG_BR_PROB_BASE)
fputs ("/u", stream);
break;
}
@@ -2082,7 +2082,7 @@ expand_cbranchsi4 (rtx *operands, enum rtx_code comparison, int probability)
operands[1], operands[2])));
rtx jump = emit_jump_insn (branch_expander (operands[3]));
if (probability >= 0)
- add_reg_note (jump, REG_BR_PROB, GEN_INT (probability));
+ add_int_reg_note (jump, REG_BR_PROB, probability);
}
/* ??? How should we distribute probabilities when more than one branch
@@ -10741,8 +10741,7 @@ sh_adjust_cost (rtx insn, rtx link ATTRIBUTE_UNUSED, rtx dep_insn, int cost)
{
int orig_cost = cost;
rtx note = find_reg_note (insn, REG_BR_PROB, 0);
- rtx target = ((! note
- || INTVAL (XEXP (note, 0)) * 2 < REG_BR_PROB_BASE)
+ rtx target = ((!note || XINT (note, 0) * 2 < REG_BR_PROB_BASE)
? insn : JUMP_LABEL (insn));
/* On the likely path, the branch costs 1, on the unlikely path,
it costs 3. */
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 8a140687654..7f4a272556e 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -783,7 +783,7 @@
tst %0,%0
cmp/eq %1,%0
cmp/eq %1,%0"
- [(set_attr "type" "mt_group")])
+ [(set_attr "type" "mt_group")])
;; FIXME: For some reason, on SH4A and SH2A combine fails to simplify this
;; pattern by itself. What this actually does is:
@@ -809,7 +809,7 @@
"@
cmp/pl %0
cmp/gt %1,%0"
- [(set_attr "type" "mt_group")])
+ [(set_attr "type" "mt_group")])
(define_insn "cmpgesi_t"
[(set (reg:SI T_REG)
@@ -819,7 +819,7 @@
"@
cmp/pz %0
cmp/ge %1,%0"
- [(set_attr "type" "mt_group")])
+ [(set_attr "type" "mt_group")])
;; FIXME: This is actually wrong. There is no way to literally move a
;; general reg to t reg. Luckily, it seems that this pattern will be only
@@ -831,7 +831,7 @@
[(set (reg:SI T_REG) (match_operand:SI 0 "arith_reg_operand" "r"))]
"TARGET_SH1"
"cmp/pl %0"
- [(set_attr "type" "mt_group")])
+ [(set_attr "type" "mt_group")])
;; Some integer sign comparison patterns can be realized with the div0s insn.
;; div0s Rm,Rn T = (Rm >> 31) ^ (Rn >> 31)
@@ -6878,10 +6878,11 @@ label:
;; If movqi_reg_reg is specified as an alternative of movqi, movqi will be
;; selected to copy QImode regs. If one of them happens to be allocated
;; on the stack, reload will stick to movqi insn and generate wrong
-;; displacement addressing because of the generic m alternatives.
-;; With the movqi_reg_reg being specified before movqi it will be initially
-;; picked to load/store regs. If the regs regs are on the stack reload will
-;; try other insns and not stick to movqi_reg_reg.
+;; displacement addressing because of the generic m alternatives.
+;; With the movqi_reg_reg being specified before movqi it will be initially
+;; picked to load/store regs. If the regs regs are on the stack reload
+;; try other insns and not stick to movqi_reg_reg, unless there were spilled
+;; pseudos in which case 'm' constraints pertain.
;; The same applies to the movhi variants.
;;
;; Notice, that T bit is not allowed as a mov src operand here. This is to
@@ -6893,11 +6894,14 @@ label:
;; reloading MAC subregs otherwise. For that probably special patterns
;; would be required.
(define_insn "*mov<mode>_reg_reg"
- [(set (match_operand:QIHI 0 "arith_reg_dest" "=r")
- (match_operand:QIHI 1 "register_operand" "r"))]
+ [(set (match_operand:QIHI 0 "arith_reg_dest" "=r,m,*z")
+ (match_operand:QIHI 1 "register_operand" "r,*z,m"))]
"TARGET_SH1 && !t_reg_operand (operands[1], VOIDmode)"
- "mov %1,%0"
- [(set_attr "type" "move")])
+ "@
+ mov %1,%0
+ mov.<bw> %1,%0
+ mov.<bw> %1,%0"
+ [(set_attr "type" "move,store,load")])
;; FIXME: The non-SH2A and SH2A variants should be combined by adding
;; "enabled" attribute as it is done in other targets.
@@ -8199,15 +8203,9 @@ label:
(use (match_operand:PSI 2 "fpscr_operand" "c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c"))
(clobber (match_scratch:SI 3 "=X,X,Bsc,Bsc,&z,X,X,X,X,X,X,X,X,y,X,X,X,X,X"))]
"TARGET_SH2E
- && (arith_reg_operand (operands[0], SFmode)
- || arith_reg_operand (operands[1], SFmode)
- || arith_reg_operand (operands[3], SImode)
- || (fpul_operand (operands[0], SFmode)
- && memory_operand (operands[1], SFmode)
- && GET_CODE (XEXP (operands[1], 0)) == POST_INC)
- || (fpul_operand (operands[1], SFmode)
- && memory_operand (operands[0], SFmode)
- && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC))"
+ && (arith_reg_operand (operands[0], SFmode) || fpul_operand (operands[0], SFmode)
+ || arith_reg_operand (operands[1], SFmode) || fpul_operand (operands[1], SFmode)
+ || arith_reg_operand (operands[3], SImode))"
"@
fmov %1,%0
mov %1,%0
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e5b4662512d..e9b2bcf5aac 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -7724,7 +7724,7 @@ output_cbranch (rtx op, rtx dest, int label, int reversed, int annul,
if (*labelno && insn && (note = find_reg_note (insn, REG_BR_PROB, NULL_RTX)))
{
strcpy (p,
- ((INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2) ^ far)
+ ((XINT (note, 0) >= REG_BR_PROB_BASE / 2) ^ far)
? ",pt" : ",pn");
p += 3;
spaces -= 3;
@@ -8195,7 +8195,7 @@ output_v9branch (rtx op, rtx dest, int reg, int label, int reversed,
if (insn && (note = find_reg_note (insn, REG_BR_PROB, NULL_RTX)))
{
strcpy (p,
- ((INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2) ^ far)
+ ((XINT (note, 0) >= REG_BR_PROB_BASE / 2) ^ far)
? ",pt" : ",pn");
p += 3;
}
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 130f5219194..7b431bc6577 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -93,6 +93,18 @@
"membar\t%1"
[(set_attr "type" "multi")])
+(define_peephole2
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0) (match_operand:SI 1 "const_int_operand")]
+ UNSPEC_MEMBAR))
+ (set (match_operand:BLK 2 "" "")
+ (unspec:BLK [(match_dup 2) (match_operand:SI 3 "const_int_operand")]
+ UNSPEC_MEMBAR))]
+ ""
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_dup 0) (match_dup 1)] UNSPEC_MEMBAR))]
+{ operands[1] = GEN_INT (UINTVAL (operands[1]) | UINTVAL (operands[3])); })
+
(define_expand "atomic_load<mode>"
[(match_operand:I 0 "register_operand" "")
(match_operand:I 1 "memory_operand" "")
diff --git a/gcc/config/sparc/t-rtems b/gcc/config/sparc/t-rtems
index 63d021770b5..f1a3d845e32 100644
--- a/gcc/config/sparc/t-rtems
+++ b/gcc/config/sparc/t-rtems
@@ -17,6 +17,6 @@
# <http://www.gnu.org/licenses/>.
#
-MULTILIB_OPTIONS = msoft-float mcpu=v8
-MULTILIB_DIRNAMES = soft v8
+MULTILIB_OPTIONS = msoft-float mcpu=v8/mcpu=leon3
+MULTILIB_DIRNAMES = soft v8 leon3
MULTILIB_MATCHES = msoft-float=mno-fpu
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 6cbd3f82337..c32e48a6fc2 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2197,7 +2197,7 @@ get_branch_target (rtx branch)
{
/* If the more probable case is not a fall through, then
try a branch hint. */
- HOST_WIDE_INT prob = INTVAL (XEXP (note, 0));
+ int prob = XINT (note, 0);
if (prob > (REG_BR_PROB_BASE * 6 / 10)
&& GET_CODE (XEXP (src, 1)) != PC)
lab = XEXP (src, 1);
@@ -4342,7 +4342,7 @@ ea_load_store_inline (rtx mem, bool is_store, rtx ea_addr, rtx data_addr)
hit_ref, pc_rtx)));
/* Say that this branch is very likely to happen. */
v = REG_BR_PROB_BASE - REG_BR_PROB_BASE / 100 - 1;
- add_reg_note (insn, REG_BR_PROB, GEN_INT (v));
+ add_int_reg_note (insn, REG_BR_PROB, v);
ea_load_store (mem, is_store, ea_addr, data_addr);
cont_label = gen_label_rtx ();
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index fdd52c2f29d..87d5df7a935 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -18,25 +18,19 @@
TM_H += $(srcdir)/config/darwin-sections.def
-darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(REAL_H) insn-config.h \
- conditions.h insn-flags.h output.h insn-attr.h flags.h $(TREE_H) expr.h \
- reload.h function.h $(GGC_H) langhooks.h $(TARGET_H) $(TM_P_H) gt-darwin.h \
- config/darwin-sections.def
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/darwin.c
+darwin.o: $(srcdir)/config/darwin.c config/darwin-sections.def
+ $(COMPILE) $<
+ $(POSTCOMPILE)
-darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(TM_P_H) \
- incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H) $(CPP_INTERNAL_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
+darwin-c.o: $(srcdir)/config/darwin-c.c
+ $(COMPILE) $(PREPROCESSOR_DEFINES) $<
+ $(POSTCOMPILE)
-darwin-f.o: $(srcdir)/config/darwin-f.c $(CONFIG_H) $(SYSTEM_H) coretypes.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/darwin-f.c $(PREPROCESSOR_DEFINES)
-darwin-driver.o: $(srcdir)/config/darwin-driver.c \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) opts.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/darwin-driver.c
+darwin-f.o: $(srcdir)/config/darwin-f.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+darwin-driver.o: $(srcdir)/config/darwin-driver.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-glibc b/gcc/config/t-glibc
index 032c68d07d6..ae7bf7abfa0 100644
--- a/gcc/config/t-glibc
+++ b/gcc/config/t-glibc
@@ -16,7 +16,6 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-glibc-c.o: config/glibc-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(C_TARGET_H) $(C_TARGET_DEF_H)
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
- $< $(OUTPUT_OPTION)
+glibc-c.o: config/glibc-c.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/config/t-winnt b/gcc/config/t-winnt
new file mode 100644
index 00000000000..1751622661b
--- /dev/null
+++ b/gcc/config/t-winnt
@@ -0,0 +1,22 @@
+# Copyright (C) 2013 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/>.
+
+winnt-c.o: config/winnt-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(C_TARGET_H) $(C_TARGET_DEF_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
+ $< $(OUTPUT_OPTION)
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index beb1012cf2c..e15755e5cf4 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -1872,7 +1872,7 @@ tilegx_expand_unaligned_load (rtx dest_reg, rtx mem, HOST_WIDE_INT bitsize,
rtx extracted =
extract_bit_field (gen_lowpart (DImode, wide_result),
bitsize, bit_offset % BITS_PER_UNIT,
- !sign, false, gen_lowpart (DImode, dest_reg),
+ !sign, gen_lowpart (DImode, dest_reg),
DImode, DImode);
if (extracted != dest_reg)
@@ -2529,7 +2529,7 @@ cbranch_predicted_p (rtx insn)
if (x)
{
- int pred_val = INTVAL (XEXP (x, 0));
+ int pred_val = XINT (x, 0);
return pred_val >= REG_BR_PROB_BASE / 2;
}
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 59618e4384b..99ce5a06857 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -1676,7 +1676,7 @@ tilepro_expand_unaligned_load (rtx dest_reg, rtx mem, HOST_WIDE_INT bitsize,
rtx extracted =
extract_bit_field (gen_lowpart (SImode, wide_result),
bitsize, bit_offset % BITS_PER_UNIT,
- !sign, false, gen_lowpart (SImode, dest_reg),
+ !sign, gen_lowpart (SImode, dest_reg),
SImode, SImode);
if (extracted != dest_reg)
@@ -2411,7 +2411,7 @@ cbranch_predicted_p (rtx insn)
if (x)
{
- int pred_val = INTVAL (XEXP (x, 0));
+ int pred_val = XINT (x, 0);
return pred_val >= REG_BR_PROB_BASE / 2;
}
diff --git a/gcc/config/vax/constraints.md b/gcc/config/vax/constraints.md
index a4774d4d575..66d6bf07f38 100644
--- a/gcc/config/vax/constraints.md
+++ b/gcc/config/vax/constraints.md
@@ -114,5 +114,6 @@
(define_constraint "T"
"@internal satisfies CONSTANT_P and, if pic is enabled, is not a SYMBOL_REF, LABEL_REF, or CONST."
- (ior (not (match_code "const,symbol_ref,label_ref"))
- (match_test "!flag_pic")))
+ (and (match_test ("CONSTANT_P (op)"))
+ (ior (not (match_code "symbol_ref,label_ref,const"))
+ (match_test "!flag_pic"))))
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 53189a7e7d6..6b643d1af5d 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -1187,7 +1187,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands,
{
operands[1] = GEN_INT (lval);
operands[2] = GEN_INT (n);
- return "ashq %2,%1,%0";
+ return "ashq %2,%D1,%0";
}
#if HOST_BITS_PER_WIDE_INT == 32
}
@@ -1199,7 +1199,7 @@ vax_output_int_move (rtx insn ATTRIBUTE_UNUSED, rtx *operands,
{
operands[1] = GEN_INT (hval >> n);
operands[2] = GEN_INT (n + 32);
- return "ashq %2,%1,%0";
+ return "ashq %2,%D1,%0";
#endif
}
}
diff --git a/gcc/config/vax/vax.md b/gcc/config/vax/vax.md
index eadde18ad43..2c05d007dae 100644
--- a/gcc/config/vax/vax.md
+++ b/gcc/config/vax/vax.md
@@ -697,14 +697,14 @@
(ashift:DI (match_operand:DI 1 "general_operand" "g")
(match_operand:QI 2 "general_operand" "g")))]
""
- "ashq %2,%1,%0")
+ "ashq %2,%D1,%0")
(define_insn ""
[(set (match_operand:DI 0 "nonimmediate_operand" "=g")
(ashiftrt:DI (match_operand:DI 1 "general_operand" "g")
(neg:QI (match_operand:QI 2 "general_operand" "g"))))]
""
- "ashq %2,%1,%0")
+ "ashq %2,%D1,%0")
;; We used to have expand_shift handle logical right shifts by using extzv,
;; but this make it very difficult to do lshrdi3. Since the VAX is the
diff --git a/gcc/config/winnt-c.c b/gcc/config/winnt-c.c
new file mode 100644
index 00000000000..d52db62afd2
--- /dev/null
+++ b/gcc/config/winnt-c.c
@@ -0,0 +1,39 @@
+/* Default C-family target hooks initializer.
+ Copyright (C) 2013
+ Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "c-family/c-target.h"
+#include "c-family/c-target-def.h"
+
+static bool
+winnt_implicit_extern_c (const char *ident)
+{
+ return !strcmp(ident, "wmain")
+ || !strcmp(ident, "DllMain")
+ || !strcmp(ident, "WinMain")
+ || !strcmp(ident, "wWinMain");
+}
+
+#undef TARGET_CXX_IMPLICIT_EXTERN_C
+#define TARGET_CXX_IMPLICIT_EXTERN_C winnt_implicit_extern_c
+
+struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
diff --git a/gcc/config/x-darwin b/gcc/config/x-darwin
index f671d911f0d..c6226c04883 100644
--- a/gcc/config/x-darwin
+++ b/gcc/config/x-darwin
@@ -1,3 +1,3 @@
-host-darwin.o : $(srcdir)/config/host-darwin.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h toplev.h config/host-darwin.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+host-darwin.o : $(srcdir)/config/host-darwin.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
diff --git a/gcc/configure b/gcc/configure
index f038a01381b..e7ea122f874 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -735,6 +735,9 @@ LDEXP_LIB
EXTRA_GCC_LIBS
GNAT_LIBEXC
COLLECT2_LIBS
+CCDEPMODE
+DEPDIR
+am__leading_dot
CXXCPP
AR
NM
@@ -788,8 +791,6 @@ EGREP
GREP
CPP
PICFLAG_FOR_TARGET
-OUTPUT_OPTION
-NO_MINUS_C_MINUS_O
GNATMAKE
GNATBIND
ac_ct_CXX
@@ -4263,135 +4264,6 @@ 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 "x$CC" != xcc; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
-$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
-$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
-fi
-set dummy $CC; ac_cc=`$as_echo "$2" |
- sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-rm -f conftest2.*
-if { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } &&
- test -f conftest2.$ac_objext && { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; };
-then
- eval ac_cv_prog_cc_${ac_cc}_c_o=yes
- if test "x$CC" != xcc; then
- # Test first that cc exists at all.
- if { ac_try='cc -c conftest.$ac_ext >&5'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
- rm -f conftest2.*
- if { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } &&
- test -f conftest2.$ac_objext && { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; };
- then
- # cc works too.
- :
- else
- # cc exists but doesn't like -o.
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
- fi
- fi
- fi
-else
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
-fi
-rm -f core conftest*
-
-fi
-if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
-
-fi
-
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
-if test "$am_t" != yes; then
- # Losing compiler, so override with the script.
- # FIXME: It is wrong to rewrite CC.
- # But if we don't then we get into trouble of one sort or another.
- # A longer-term fix would be to have automake use am__CC in this case,
- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
- CC="$am_aux_dir/compile $CC"
-fi
-
-
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4869,15 +4741,6 @@ else
fi
-# autoconf is lame and doesn't give us any substitution variable for this.
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
- NO_MINUS_C_MINUS_O=yes
-else
- OUTPUT_OPTION='-o $@'
-fi
-
-
-
# Remove the -O2: for historical reasons, unless bootstrapping we prefer
# optimizations to be activated explicitly by the toplevel.
case "$CC" in
@@ -8899,6 +8762,136 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# --------
+# Dependency checking.
+# --------
+
+ac_ext=cpp
+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'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depdir"
+
+
+ac_config_commands="$ac_config_commands gccdepdir"
+
+
+depcc="$CC" am_compiler_list=
+
+am_depcomp=$ac_aux_dir/depcomp
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ if test $depmode = none; then break; fi
+
+ $as_echo "$as_me:$LINENO: trying $depmode" >&5
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "include sub/conftest.Po" > confmf
+
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ depcmd="depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c"
+ echo "| $depcmd" | sed -e 's/ */ /g' >&5
+ if env $depcmd > conftest.err 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po >>conftest.err 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po >>conftest.err 2>&1 &&
+ ${MAKE-make} -s -f confmf >>conftest.err 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ $as_echo "$as_me:$LINENO: success" >&5
+ break
+ fi
+ fi
+ $as_echo "$as_me:$LINENO: failure, diagnostics are:" >&5
+ sed -e 's/^/| /' < conftest.err >&5
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+if test x${am_cv_CC_dependencies_compiler_type-none} = xnone
+then as_fn_error "no usable dependency style found" "$LINENO" 5
+else CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+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
+
+
+# --------
# UNSORTED
# --------
@@ -13682,7 +13675,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -13707,7 +13700,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -13726,7 +13722,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -17935,7 +17934,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 17938 "configure"
+#line 17937 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18041,7 +18040,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 18044 "configure"
+#line 18043 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -28484,6 +28483,8 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
+ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR
+subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR
subdirs='$subdirs'
_ACEOF
@@ -28495,6 +28496,8 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"auto-host.h") CONFIG_HEADERS="$CONFIG_HEADERS auto-host.h:config.in" ;;
+ "depdir") CONFIG_COMMANDS="$CONFIG_COMMANDS depdir" ;;
+ "gccdepdir") CONFIG_COMMANDS="$CONFIG_COMMANDS gccdepdir" ;;
"as") CONFIG_FILES="$CONFIG_FILES as:exec-tool.in" ;;
"collect-ld") CONFIG_FILES="$CONFIG_FILES collect-ld:exec-tool.in" ;;
"nm") CONFIG_FILES="$CONFIG_FILES nm:exec-tool.in" ;;
@@ -29078,6 +29081,13 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
case $ac_file$ac_mode in
+ "depdir":C) $SHELL $ac_aux_dir/mkinstalldirs $DEPDIR ;;
+ "gccdepdir":C)
+ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
+ for lang in $subdirs c-family common
+ do
+ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
+ done ;;
"as":F) chmod +x as ;;
"collect-ld":F) chmod +x collect-ld ;;
"nm":F) chmod +x nm ;;
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 61f63126a24..bbf506da103 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -278,19 +278,9 @@ rm -f a.out a.exe b.out
# Find the native compiler
AC_PROG_CC
-AM_PROG_CC_C_O
AC_PROG_CXX
ACX_PROG_GNAT([-I"$srcdir"/ada])
-# autoconf is lame and doesn't give us any substitution variable for this.
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = no"; then
- NO_MINUS_C_MINUS_O=yes
-else
- OUTPUT_OPTION='-o $@'
-fi
-AC_SUBST(NO_MINUS_C_MINUS_O)
-AC_SUBST(OUTPUT_OPTION)
-
# Remove the -O2: for historical reasons, unless bootstrapping we prefer
# optimizations to be activated explicitly by the toplevel.
case "$CC" in
@@ -987,6 +977,22 @@ AC_CHECK_HEADERS(ext/hash_map)
AC_LANG_POP(C++)
# --------
+# Dependency checking.
+# --------
+
+AC_LANG_PUSH(C++)
+ZW_CREATE_DEPDIR
+AC_CONFIG_COMMANDS([gccdepdir],[
+ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs build/$DEPDIR
+ for lang in $subdirs c-family common
+ do
+ ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/mkinstalldirs $lang/$DEPDIR
+ done], [subdirs="$subdirs" ac_aux_dir=$ac_aux_dir DEPDIR=$DEPDIR])
+
+ZW_PROG_COMPILER_DEPENDENCIES([CC])
+AC_LANG_POP(C++)
+
+# --------
# UNSORTED
# --------
diff --git a/gcc/context.c b/gcc/context.c
index b5152419a97..09e1f898f7a 100644
--- a/gcc/context.c
+++ b/gcc/context.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
/* The singleton holder of global state: */
gcc::context *g;
-gcc::context::context()
+gcc::context::context ()
{
- passes_ = new gcc::pass_manager (this);
+ m_passes = new gcc::pass_manager (this);
}
diff --git a/gcc/context.h b/gcc/context.h
index 66260cd279a..4aab6de9a9a 100644
--- a/gcc/context.h
+++ b/gcc/context.h
@@ -30,15 +30,15 @@ class pass_manager;
class context
{
public:
- context();
+ context ();
/* Pass-management. */
- pass_manager *get_passes () { gcc_assert (passes_); return passes_; }
+ pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; }
private:
/* Pass-management. */
- pass_manager *passes_;
+ pass_manager *m_passes;
}; // class context
diff --git a/gcc/coverage.c b/gcc/coverage.c
index d662e8d0946..9bc23c4bd9f 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -347,9 +347,9 @@ get_coverage_counts (unsigned counter, unsigned expected,
if (!warned++ && dump_enabled_p ())
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,
(flag_guess_branch_prob
- ? "file %s not found, execution counts estimated"
+ ? "file %s not found, execution counts estimated\n"
: "file %s not found, execution counts assumed to "
- "be zero"),
+ "be zero\n"),
da_file_name);
return NULL;
}
@@ -379,20 +379,20 @@ get_coverage_counts (unsigned counter, unsigned expected,
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,
"use -Wno-error=coverage-mismatch to tolerate "
"the mismatch but performance may drop if the "
- "function is hot");
+ "function is hot\n");
if (!seen_error ()
&& !warned++)
{
dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,
- "coverage mismatch ignored");
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,
- flag_guess_branch_prob
- ? G_("execution counts estimated")
- : G_("execution counts assumed to be zero"));
+ "coverage mismatch ignored\n");
+ dump_printf (MSG_OPTIMIZED_LOCATIONS,
+ flag_guess_branch_prob
+ ? G_("execution counts estimated\n")
+ : G_("execution counts assumed to be zero\n"));
if (!flag_guess_branch_prob)
- dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, input_location,
- "this can result in poorly optimized code");
+ dump_printf (MSG_OPTIMIZED_LOCATIONS,
+ "this can result in poorly optimized code\n");
}
}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cca0229dc0a..01867fb350a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,215 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (CXX_TREE_H, CXX_PARSER_H, CXX_PRETTY_PRINT_H):
+ Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (g++spec.o): Remove.
+ (CFLAGS-cp/g++spec.o): New variable.
+ (GXX_OBJS): Reference cp/g++spec.o.
+ (cc1plus-checksum.o, cp/lex.o, cp/cp-array-notation.o)
+ (cp/cp-lang.o, cp/decl.o, cp/decl2.o, cp/cp-objcp-common.o)
+ (cp/typeck2.o, cp/typeck.o, cp/class.o, cp/call.o)
+ (cp/friend.o, cp/init.o, cp/method.o, cp/cvt.o, cp/search.o)
+ (cp/tree.o, cp/ptree.o, cp/rtti.o, cp/except.o, cp/expr.o)
+ (cp/pt.o, cp/error.o, cp/repo.o, cp/semantics.o, cp/dump.o)
+ (cp/optimize.o, cp/mangle.o, cp/parser.o, cp/cp-gimplify.o)
+ (cp/name-lookup.o, cp/cxx-pretty-print.o): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (g++spec.o): Don't use subshell.
+
+2013-09-25 Marek Polacek <polacek@redhat.com>
+
+ PR c++/58516
+ * semantics.c (finish_transaction_stmt): Check for EXPR_P before
+ setting the expr location.
+
+2013-09-23 Adam Butcher <adam@jessamine.co.uk>
+
+ PR c++/58500
+ * type-utils.h (find_type_usage): Only traverse one type level into
+ member function pointers.
+
+2013-09-23 Adam Butcher <adam@jessamine.co.uk>
+
+ * parser.c (cp_parser_init_declarator): Defer calling
+ finish_fully_implicit_template for forward declarations until after
+ other decl processing is complete. Cleanup for clarity: Extract 'else'
+ case after 'if' containing unconditional return.
+
+2013-09-23 Adam Butcher <adam@jessamine.co.uk>
+
+ * parser.c (make_generic_type_name): Spell generic type names '<autoN>'
+ rather than '__GenN'.
+
+2013-09-23 Adam Butcher <adam@jessamine.co.uk>
+
+ * lambda.c (maybe_add_lambda_conv_op): Don't check for instantiated
+ callop in the case of generic lambdas.
+
+2013-09-23 Adam Butcher <adam@jessamine.co.uk>
+
+ * parser.c (make_generic_type_name): Use global count rather than
+ parameter and ...
+ (add_implicit_template_parms): ... propagate interface change here.
+
+2013-09-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58481
+ * pt.c (tsubst_copy): Use current_nonlambda_class_type to
+ call tsubst_baselink.
+
+2013-09-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58457
+ * class.c (instantiate_type): Loosen a bit the gcc_assert.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitize/58443
+ * typeck.c (cp_build_binary_op): Properly honor -fsanitize options.
+ Remove unnecessary check.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58411
+ * typeck.c (cp_build_binary_op): Don't sanitize function if it has the
+ no_sanitize_undefined attribute.
+
+2013-09-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58435
+ * pt.c (tsubst, [BOUND_TEMPLATE_TEMPLATE_PARM]): Take into account
+ the cp_type_quals (r) too.
+
+2013-09-16 Adam Butcher <adam@jessamine.co.uk>
+
+ * cp-tree.h (type_uses_auto_or_concept): Declare.
+ (is_auto_or_concept): Declare.
+ * decl.c (grokdeclarator): Allow 'auto' parameters in lambdas with
+ -std=gnu++1y or -std=c++1y or, as a GNU extension, in plain functions.
+ * type-utils.h: New header defining ...
+ (find_type_usage): ... this new function based on pt.c (type_uses_auto)
+ for searching a type tree given a predicate.
+ * pt.c (type_uses_auto): Reimplement via type-utils.h (find_type_usage).
+ (is_auto_or_concept): New function.
+ (type_uses_auto_or_concept): New function.
+ * parser.h (struct cp_parser): Add fully_implicit_function_template_p.
+ * parser.c (cp_parser_new): Initialize
+ fully_implicit_function_template_p.
+ (cp_parser_new): Initialize fully_implicit_function_template_p.
+ (cp_parser_lambda_expression): Copy and restore value of
+ fully_implicit_function_template_p as per other parser fields.
+ (cp_parser_parameter_declaration_list): Count generic
+ parameters and call ...
+ (add_implicit_template_parms): ... this new function to synthesize them
+ with help from type-utils.h (find_type_usage), ...
+ (tree_type_is_auto_or_concept): ... this new static function and ...
+ (make_generic_type_name): ... this new static function.
+ (cp_parser_direct_declarator): Account for implicit template parameters.
+ (cp_parser_lambda_declarator_opt): Finish fully implicit template if
+ necessary by calling ...
+ (finish_fully_implicit_template): ... this new function.
+ (cp_parser_init_declarator): Likewise.
+ (cp_parser_function_definition_after_declarator): Likewise.
+ (cp_parser_member_declaration): Likewise.
+ * Make-lang.in (cp/pt.o): Add dependency on type-utils.h.
+ (cp/parser.o): Likewise.
+
+2013-09-16 Adam Butcher <adam@jessamine.co.uk>
+
+ * parser.c (cp_parser_lambda_declarator_opt): Accept template parameter
+ list with std=c++1y or std=gnu++1y.
+ (cp_parser_lambda_body): Don't call 'expand_or_defer_fn' for lambda call
+ operator template to avoid adding template result to symbol table.
+ * lambda.c (lambda_function): Return template result if call operator is
+ a template.
+ (maybe_add_lambda_conv_op): Move declarations to point of use. Refactor
+ operator call building in order to support conversion of a non-capturing
+ lambda template to a function pointer with help from ...
+ (prepare_op_call): ... this new function.
+ * decl2.c (check_member_template): Don't reject lambda call operator
+ template in local [lambda] class.
+ * pt.c (instantiate_class_template_1): Don't instantiate lambda call
+ operator template when instantiating lambda class.
+
+2013-09-16 Adam Butcher <adam@jessamine.co.uk>
+
+ * pt.c (make_auto_1): Use input_location rather than BUILTINS_LOCATION.
+
+2013-09-15 Jason Merrill <jason@redhat.com>
+
+ Core DR 904
+ PR c++/41933
+ * parser.c (cp_parser_lambda_introducer): Handle variadic capture.
+ * lambda.c (add_capture): Handle variadic capture.
+ (add_default_capture, lambda_capture_field_type): Likewise.
+ (build_capture_proxy, register_capture_members): Likewise.
+ * pt.c (register_specialization): Allow FIELD_DECL.
+ (retrieve_specialization): Likewise.
+ (find_parameter_packs_r): Handle FIELD_DECL and VAR_DECL.
+ (tsubst_pack_expansion): Handle FIELD_DECL packs.
+ (gen_elem_of_pack_expansion_instantiation): Likewise.
+ (instantiate_class_template_1): Likewise.
+ (tsubst_decl, tsubst_copy): Likewise.
+ (tsubst_expr) [DECL_EXPR]: Handle capture proxy packs.
+ (tsubst_copy_and_build) [VAR_DECL]: Likewise.
+ * semantics.c (finish_non_static_data_member): Don't try to represent
+ the type of a COMPOUND_REF of a FIELD_DECL pack.
+
+ PR c++/41933
+ * cp-tree.h (DECL_PACK_P): Replace FUNCTION_PARAMETER_PACK_P.
+ * cxx-pretty-print.c (direct_declarator): Adjust.
+ * decl2.c (cp_build_parm_decl): Adjust.
+ * pt.c (function_parameter_pack_p): Adjust.
+ (find_parameter_packs_r, push_template_decl_real): Adjust.
+ (tsubst_pack_expansion, tsubst_decl): Adjust.
+ (regenerate_decl_from_template, instantiate_decl): Adjust.
+
+ * lambda.c (add_capture): Don't add DECL_LANG_SPECIFIC.
+
+2013-09-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/58273
+ * pt.c (any_type_dependent_elements_p): Actually check for
+ type-dependence, not value-dependence.
+
+2013-09-13 Jacek Caban <jacek@codeweavers.com>
+
+ * decl.c: Use new cxx_implicit_extern_c hook
+
+2013-09-12 Brooks Moses <bmoses@google.com>
+
+ PR driver/42955
+ * Make-lang.in: Do not install driver binaries in $(target)/bin.
+
+2013-09-12 Adam Butcher <adam@jessamine.co.uk>
+
+ * pt.c (instantiate_decl): Save/restore cp_unevaluated_operand and
+ c_inhibit_evaluation_warnings. Reset if instantiating within a
+ function-local template.
+
+2013-09-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * semantics.c (finish_pseudo_destructor_expr): Add location_t
+ parameter.
+ * pt.c (unify_arg_conversion): Use EXPR_LOC_OR_HERE.
+ (tsubst_copy_and_build): Adjust finish_pseudo_destructor_expr
+ calls.
+ * parser.c (cp_parser_postfix_dot_deref_expression): Likewise.
+ (cp_parser_postfix_expression): Pass the proper location to
+ cp_parser_postfix_dot_deref_expression.
+ * cp-tree.h (finish_pseudo_destructor_expr): Update declaration.
+
+2013-09-10 Jan Hubicka <jh@suse.cz>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ * error.c (print_instantiation_partial_context_line): If
+ loc == UNKNOWN_LOCATION return immediately.
+
2013-09-09 Jakub Jelinek <jakub@redhat.com>
PR c++/58325
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 65dfe081e0b..9bcea20bd02 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -51,14 +51,10 @@ c++: cc1plus$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: c++
-g++spec.o: $(srcdir)/cp/g++spec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
- $(CONFIG_H) $(OPTS_H)
- (SHLIB='$(SHLIB)'; \
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
- $(INCLUDES) $(srcdir)/cp/g++spec.c)
+CFLAGS-cp/g++spec.o += $(DRIVER_DEFINES)
# Create the compiler driver for g++.
-GXX_OBJS = $(GCC_OBJS) g++spec.o
+GXX_OBJS = $(GCC_OBJS) cp/g++spec.o
xg++$(exeext): $(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(GXX_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
@@ -98,8 +94,6 @@ cc1plus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
checksum-options > cc1plus-checksum.c.tmp && \
$(srcdir)/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c
-cc1plus-checksum.o : cc1plus-checksum.c $(CONFIG_H) $(SYSTEM_H)
-
cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
@@ -167,8 +161,8 @@ check_g++_parallelize = old-deja.exp dg.exp dg-torture.exp
# Install hooks:
# cc1plus is installed elsewhere as part of $(COMPILERS).
-# Install the driver program as $(target)-g++
-# and also as either g++ (if native) or $(tooldir)/bin/g++.
+# Install the driver program as $(target)-g++ and $(target)-c++, and
+# also as g++ and c++ if native.
c++.install-common: installdirs
-rm -f $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
-$(INSTALL_PROGRAM) xg++$(exeext) $(DESTDIR)$(bindir)/$(GXX_INSTALL_NAME)$(exeext)
@@ -177,15 +171,7 @@ c++.install-common: installdirs
-( cd $(DESTDIR)$(bindir) && \
$(LN) $(GXX_INSTALL_NAME)$(exeext) $(CXX_INSTALL_NAME)$(exeext) )
-if [ -f cc1plus$(exeext) ] ; then \
- if [ -f g++-cross$(exeext) ] ; then \
- if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
- rm -f $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
- $(INSTALL_PROGRAM) g++-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/g++$(exeext); \
- rm -f $(DESTDIR)$(gcc_tooldir)/bin/c++$(exeext); \
- ( cd $(DESTDIR)$(gcc_tooldir)/bin && \
- $(LN) g++$(exeext) c++$(exeext) ); \
- else true; fi; \
- else \
+ if [ ! -f g++-cross$(exeext) ] ; then \
rm -f $(DESTDIR)$(bindir)/$(GXX_TARGET_INSTALL_NAME)$(exeext); \
( cd $(DESTDIR)$(bindir) && \
$(LN) $(GXX_INSTALL_NAME)$(exeext) $(GXX_TARGET_INSTALL_NAME)$(exeext) ); \
@@ -254,104 +240,3 @@ c++.stageprofile: stageprofile-start
-mv cp/*$(objext) stageprofile/cp
c++.stagefeedback: stagefeedback-start
-mv cp/*$(objext) stagefeedback/cp
-
-#
-# .o: .h dependencies.
-CXX_TREE_H = $(TREE_H) cp/name-lookup.h cp/cp-tree.h $(C_COMMON_H) \
- $(FUNCTION_H) \
- $(SYSTEM_H) coretypes.h $(CONFIG_H) $(TARGET_H) $(GGC_H) \
- $(srcdir)/../include/hashtab.h
-CXX_PARSER_H = tree.h $(CXX_TREE_H) c-family/c-pragma.h cp/parser.h
-CXX_PRETTY_PRINT_H = cp/cxx-pretty-print.h $(C_PRETTY_PRINT_H)
-
-cp/lex.o: cp/lex.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- $(C_PRAGMA_H) input.h cp/operators.def $(TM_P_H) \
- c-family/c-objc.h
-cp/cp-array-notation.o: cp/cp-array-notation.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_H) $(CXX_TREE_H) $(DIAGNOSTIC_H) tree-iterator.h vec.h \
- $(GIMPLE_H) c-family/array-notation-common.o $(C_COMMON_H)
-cp/cp-lang.o: cp/cp-lang.c $(CXX_TREE_H) $(TM_H) debug.h langhooks.h \
- $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-cp.h gt-cp-cp-lang.h \
- cp/cp-objcp-common.h $(EXPR_H) $(TARGET_H) $(CXX_PARSER_H)
-cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
- output.h toplev.h $(HASHTAB_H) $(RTL_H) \
- cp/operators.def $(TM_P_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(C_PRAGMA_H) \
- debug.h gt-cp-decl.h $(TIMEVAR_H) $(TARGET_H) $(PLUGIN_H) \
- intl.h tree-iterator.h pointer-set.h $(SPLAY_TREE_H) \
- c-family/c-objc.h
-cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) cp/decl.h \
- toplev.h $(C_COMMON_H) gt-cp-decl2.h $(CGRAPH_H) \
- $(C_PRAGMA_H) dumpfile.h intl.h $(TARGET_H) $(GIMPLE_H) pointer-set.h \
- $(SPLAY_TREE_H) c-family/c-ada-spec.h \
- c-family/c-objc.h
-cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) $(C_COMMON_H) \
- langhooks.h $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h \
- $(CXX_PRETTY_PRINT_H) cp/cp-objcp-common.h gt-cp-cp-objcp-common.h
-cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- $(TM_P_H) $(DIAGNOSTIC_CORE_H) gt-cp-typeck2.h $(REAL_H) intl.h
-cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(PARAMS_H) \
- toplev.h $(DIAGNOSTIC_H) convert.h $(C_COMMON_H) $(TARGET_H) \
- c-family/c-objc.h
-cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
- $(TARGET_H) convert.h $(CGRAPH_H) dumpfile.h gt-cp-class.h \
- $(SPLAY_TREE_H) pointer-set.h $(HASH_TABLE_H)
-cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
- $(DIAGNOSTIC_CORE_H) intl.h gt-cp-call.h convert.h $(TARGET_H) langhooks.h \
- $(TIMEVAR_H) c-family/c-objc.h
-cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H)
-cp/init.o: cp/init.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- $(EXCEPT_H) $(TARGET_H)
-cp/method.o: cp/method.c $(CXX_TREE_H) $(TM_H) toplev.h \
- $(TM_P_H) $(TARGET_H) $(DIAGNOSTIC_H) gt-cp-method.h $(GIMPLE_H) \
- $(COMMON_TARGET_H)
-cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h $(FLAGS_H) \
- convert.h $(TARGET_H) intl.h
-cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h \
- intl.h
-cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- $(TREE_INLINE_H) $(REAL_H) gt-cp-tree.h \
- $(TARGET_H) debug.h $(CGRAPH_H) $(SPLAY_TREE_H) $(GIMPLE_H) $(HASH_TABLE_H)
-cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
-cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) convert.h \
- $(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h intl.h
-cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) \
- cp/cfns.h $(TREE_INLINE_H) $(TARGET_H) gt-cp-except.h
-cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(TM_P_H)
-cp/pt.o: cp/pt.c $(CXX_TREE_H) $(TM_H) cp/decl.h cp/cp-objcp-common.h \
- toplev.h $(TREE_INLINE_H) pointer-set.h gt-cp-pt.h intl.h \
- c-family/c-objc.h
-cp/error.o: cp/error.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_H) \
- $(FLAGS_H) $(REAL_H) $(LANGHOOKS_DEF_H) $(CXX_PRETTY_PRINT_H) \
- tree-diagnostic.h tree-pretty-print.h pointer-set.h c-family/c-objc.h
-cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_CORE_H) \
- gt-cp-repo.h
-cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) toplev.h \
- $(FLAGS_H) $(RTL_H) $(TIMEVAR_H) \
- $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H) \
- bitmap.h gt-cp-semantics.h c-family/c-objc.h $(HASH_TABLE_H)
-cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) $(TREE_DUMP_H)
-cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) \
- input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \
- $(TARGET_H) tree-iterator.h $(CGRAPH_H) $(DIAGNOSTIC_CORE_H) \
- dumpfile.h
-cp/mangle.o: cp/mangle.c $(CXX_TREE_H) $(TM_H) $(REAL_H) \
- gt-cp-mangle.h $(TARGET_H) $(TM_P_H) $(CGRAPH_H)
-cp/parser.o: cp/parser.c $(CXX_TREE_H) $(TM_H) $(DIAGNOSTIC_CORE_H) \
- gt-cp-parser.h $(TARGET_H) $(PLUGIN_H) intl.h cp/decl.h \
- c-family/c-objc.h tree-pretty-print.h $(CXX_PARSER_H) $(TIMEVAR_H)
-cp/cp-gimplify.o: cp/cp-gimplify.c $(CXX_TREE_H) $(C_COMMON_H) \
- $(TM_H) coretypes.h pointer-set.h tree-iterator.h $(SPLAY_TREE_H)
-cp/vtable-class-hierarchy.o: cp/vtable-class-hierarchy.c \
- $(TM_H) $(TIMEVAR_H) $(CXX_TREE_H) intl.h $(CXX_PARSER_H) cp/decl.h \
- $(FLAGS_H) $(DIAGNOSTIC_CORE_H) output.h $(CGRAPH_H) c-family/c-common.h \
- c-family/c-objc.h $(PLUGIN_H) \
- tree-iterator.h vtable-verify.h $(GIMPLE_H) \
- gt-cp-vtable-class-hierarchy.h
-cp/name-lookup.o: cp/name-lookup.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(CXX_TREE_H) $(TIMEVAR_H) gt-cp-name-lookup.h $(PARAMS_H) \
- $(DIAGNOSTIC_CORE_H) $(FLAGS_H) debug.h pointer-set.h
-cp/lambda.o: cp/lambda.c $(CXX_TREE_H) $(CGRAPH_H) $(VEC_H) $(SYSTEM_H) coretypes.h
-
-cp/cxx-pretty-print.o: cp/cxx-pretty-print.c $(CXX_PRETTY_PRINT_H) \
- $(CONFIG_H) $(SYSTEM_H) $(TM_H) coretypes.h $(CXX_TREE_H) tree-pretty-print.h
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 3d34b92cfb1..9e0229fcba3 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -7627,7 +7627,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
dependent on overload resolution. */
gcc_assert (TREE_CODE (rhs) == ADDR_EXPR
|| TREE_CODE (rhs) == COMPONENT_REF
- || really_overloaded_fn (rhs)
+ || is_overloaded_fn (rhs)
|| (flag_ms_extensions && TREE_CODE (rhs) == FUNCTION_DECL));
/* This should really only be used when attempting to distinguish
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 3e4f188b93f..d7840aff89f 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -138,7 +138,6 @@ c-common.h, not after.
1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
- FUNCTION_PARAMETER_PACK_P (in PARM_DECL)
USING_DECL_TYPENAME_P (in USING_DECL)
DECL_VLA_CAPTURE_P (in FIELD_DECL)
2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
@@ -2874,10 +2873,9 @@ extern void decl_shadowed_for_var_insert (tree, tree);
the class definition is complete. */
#define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
-/* Determine if a parameter (i.e., a PARM_DECL) is a function
- parameter pack. */
-#define FUNCTION_PARAMETER_PACK_P(NODE) \
- (DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE)))
+/* Determine if a declaration (PARM_DECL or FIELD_DECL) is a pack. */
+#define DECL_PACK_P(NODE) \
+ (DECL_P (NODE) && PACK_EXPANSION_P (TREE_TYPE (NODE)))
/* Determines if NODE is an expansion of one or more parameter packs,
e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION. */
@@ -5455,10 +5453,12 @@ extern tree make_auto (void);
extern tree make_decltype_auto (void);
extern tree do_auto_deduction (tree, tree, tree);
extern tree type_uses_auto (tree);
+extern tree type_uses_auto_or_concept (tree);
extern void append_type_to_template_for_access_check (tree, tree, tree,
location_t);
extern tree splice_late_return_type (tree, tree);
extern bool is_auto (const_tree);
+extern bool is_auto_or_concept (const_tree);
extern tree process_template_parm (tree, location_t, tree,
bool, bool);
extern tree end_template_parm_list (tree);
@@ -5734,7 +5734,7 @@ extern tree finish_call_expr (tree, vec<tree, va_gc> **, bool,
bool, tsubst_flags_t);
extern tree finish_increment_expr (tree, enum tree_code);
extern tree finish_this_expr (void);
-extern tree finish_pseudo_destructor_expr (tree, tree, tree);
+extern tree finish_pseudo_destructor_expr (tree, tree, tree, location_t);
extern tree finish_unary_op_expr (location_t, enum tree_code, tree,
tsubst_flags_t);
extern tree finish_compound_literal (tree, tree, tsubst_flags_t);
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 86d8b471e7f..bcef8760ad7 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1527,7 +1527,7 @@ cxx_pretty_printer::direct_declarator (tree t)
{
pp_cxx_space_for_pointer_operator (this, TREE_TYPE (t));
- if ((TREE_CODE (t) == PARM_DECL && FUNCTION_PARAMETER_PACK_P (t))
+ if ((TREE_CODE (t) == PARM_DECL && DECL_PACK_P (t))
|| template_parameter_pack_p (t))
/* A function parameter pack or non-type template
parameter pack. */
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 89eb4f80ceb..fdd711619cd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-family/c-common.h"
#include "c-family/c-objc.h"
#include "c-family/c-pragma.h"
+#include "c-family/c-target.h"
#include "diagnostic.h"
#include "intl.h"
#include "debug.h"
@@ -7457,7 +7458,9 @@ grokfndecl (tree ctype,
|| (IDENTIFIER_LENGTH (declarator) > 10
&& IDENTIFIER_POINTER (declarator)[0] == '_'
&& IDENTIFIER_POINTER (declarator)[1] == '_'
- && strncmp (IDENTIFIER_POINTER (declarator)+2, "builtin_", 8) == 0))
+ && strncmp (IDENTIFIER_POINTER (declarator)+2, "builtin_", 8) == 0)
+ || (targetcm.cxx_implicit_extern_c
+ && targetcm.cxx_implicit_extern_c(IDENTIFIER_POINTER (declarator))))
&& current_lang_name == lang_name_cplusplus
&& ctype == NULL_TREE
&& DECL_FILE_SCOPE_P (decl))
@@ -10329,8 +10332,33 @@ grokdeclarator (const cp_declarator *declarator,
if (type_uses_auto (type))
{
- error ("parameter declared %<auto%>");
- type = error_mark_node;
+ if (template_parm_flag)
+ {
+ error ("template parameter declared %<auto%>");
+ type = error_mark_node;
+ }
+ else if (decl_context == CATCHPARM)
+ {
+ error ("catch parameter declared %<auto%>");
+ type = error_mark_node;
+ }
+ else if (current_class_type && LAMBDA_TYPE_P (current_class_type))
+ {
+ if (cxx_dialect < cxx1y)
+ pedwarn (location_of (type), 0,
+ "use of %<auto%> in lambda parameter declaration "
+ "only available with "
+ "-std=c++1y or -std=gnu++1y");
+ }
+ else if (cxx_dialect < cxx1y)
+ pedwarn (location_of (type), 0,
+ "use of %<auto%> in parameter declaration "
+ "only available with "
+ "-std=c++1y or -std=gnu++1y");
+ else
+ pedwarn (location_of (type), OPT_Wpedantic,
+ "ISO C++ forbids use of %<auto%> in parameter "
+ "declaration");
}
/* A parameter declared as an array of T is really a pointer to T.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index d5d29127cfd..4ac9445ecc9 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -188,11 +188,6 @@ cp_build_parm_decl (tree name, tree type)
if (!processing_template_decl)
DECL_ARG_TYPE (parm) = type_passed_as (type);
- /* If the type is a pack expansion, then we have a function
- parameter pack. */
- if (type && TREE_CODE (type) == TYPE_PACK_EXPANSION)
- FUNCTION_PARAMETER_PACK_P (parm) = 1;
-
return parm;
}
@@ -507,8 +502,9 @@ check_member_template (tree tmpl)
|| (TREE_CODE (decl) == TYPE_DECL
&& MAYBE_CLASS_TYPE_P (TREE_TYPE (decl))))
{
- /* The parser rejects template declarations in local classes. */
- gcc_assert (!current_function_decl);
+ /* The parser rejects template declarations in local classes
+ (with the exception of generic lambdas). */
+ gcc_assert (!current_function_decl || LAMBDA_FUNCTION_P (decl));
/* The parser rejects any use of virtual in a function template. */
gcc_assert (!(TREE_CODE (decl) == FUNCTION_DECL
&& DECL_VIRTUAL_P (decl)));
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 02ec6c7608f..62e39d3bcbf 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -3200,8 +3200,10 @@ print_instantiation_partial_context_line (diagnostic_context *context,
const struct tinst_level *t,
location_t loc, bool recursive_p)
{
- expanded_location xloc;
- xloc = expand_location (loc);
+ if (loc == UNKNOWN_LOCATION)
+ return;
+
+ expanded_location xloc = expand_location (loc);
if (context->show_column)
pp_verbatim (context->printer, _("%r%s:%d:%d:%R "),
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index a53e692d48b..2ffa7e01d78 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -196,7 +196,7 @@ lambda_function (tree lambda)
/*protect=*/0, /*want_type=*/false,
tf_warning_or_error);
if (lambda)
- lambda = BASELINK_FUNCTIONS (lambda);
+ lambda = STRIP_TEMPLATE (get_first_fn (lambda));
return lambda;
}
@@ -215,7 +215,8 @@ lambda_capture_field_type (tree expr, bool explicit_init_p)
}
else
type = non_reference (unlowered_expr_type (expr));
- if (!type || WILDCARD_TYPE_P (type) || type_uses_auto (type))
+ if (!type || WILDCARD_TYPE_P (type) || type_uses_auto (type)
+ || DECL_PACK_P (expr))
{
type = cxx_make_type (DECLTYPE_TYPE);
DECLTYPE_TYPE_EXPR (type) = expr;
@@ -320,15 +321,21 @@ tree
lambda_proxy_type (tree ref)
{
tree type;
+ if (ref == error_mark_node)
+ return error_mark_node;
if (REFERENCE_REF_P (ref))
ref = TREE_OPERAND (ref, 0);
+ gcc_assert (TREE_CODE (ref) == COMPONENT_REF);
type = TREE_TYPE (ref);
- if (type && !WILDCARD_TYPE_P (non_reference (type)))
- return type;
- type = cxx_make_type (DECLTYPE_TYPE);
- DECLTYPE_TYPE_EXPR (type) = ref;
- DECLTYPE_FOR_LAMBDA_PROXY (type) = true;
- SET_TYPE_STRUCTURAL_EQUALITY (type);
+ if (!type || WILDCARD_TYPE_P (non_reference (type)))
+ {
+ type = cxx_make_type (DECLTYPE_TYPE);
+ DECLTYPE_TYPE_EXPR (type) = ref;
+ DECLTYPE_FOR_LAMBDA_PROXY (type) = true;
+ SET_TYPE_STRUCTURAL_EQUALITY (type);
+ }
+ if (DECL_PACK_P (TREE_OPERAND (ref, 1)))
+ type = make_pack_expansion (type);
return type;
}
@@ -341,6 +348,9 @@ build_capture_proxy (tree member)
{
tree var, object, fn, closure, name, lam, type;
+ if (PACK_EXPANSION_P (member))
+ member = PACK_EXPANSION_PATTERN (member);
+
closure = DECL_CONTEXT (member);
fn = lambda_function (closure);
lam = CLASSTYPE_LAMBDA_EXPR (closure);
@@ -422,12 +432,20 @@ vla_capture_type (tree array_type)
and return it. */
tree
-add_capture (tree lambda, tree id, tree initializer, bool by_reference_p,
+add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,
bool explicit_init_p)
{
char *buf;
tree type, member, name;
bool vla = false;
+ bool variadic = false;
+ tree initializer = orig_init;
+
+ if (PACK_EXPANSION_P (initializer))
+ {
+ initializer = PACK_EXPANSION_PATTERN (initializer);
+ variadic = true;
+ }
if (TREE_CODE (initializer) == TREE_LIST)
initializer = build_x_compound_expr_from_list (initializer, ELK_INIT,
@@ -498,8 +516,11 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p,
IDENTIFIER_MARKED (name) = true;
}
+ if (variadic)
+ type = make_pack_expansion (type);
+
/* Make member variable. */
- member = build_lang_decl (FIELD_DECL, name, type);
+ member = build_decl (input_location, FIELD_DECL, name, type);
DECL_VLA_CAPTURE_P (member) = vla;
if (!explicit_init_p)
@@ -518,8 +539,14 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p,
&& current_class_type == LAMBDA_EXPR_CLOSURE (lambda))
finish_member_declaration (member);
+ tree listmem = member;
+ if (variadic)
+ {
+ listmem = make_pack_expansion (member);
+ initializer = orig_init;
+ }
LAMBDA_EXPR_CAPTURE_LIST (lambda)
- = tree_cons (member, initializer, LAMBDA_EXPR_CAPTURE_LIST (lambda));
+ = tree_cons (listmem, initializer, LAMBDA_EXPR_CAPTURE_LIST (lambda));
if (LAMBDA_EXPR_CLOSURE (lambda))
return build_capture_proxy (member);
@@ -538,9 +565,14 @@ register_capture_members (tree captures)
return;
register_capture_members (TREE_CHAIN (captures));
+
+ tree field = TREE_PURPOSE (captures);
+ if (PACK_EXPANSION_P (field))
+ field = PACK_EXPANSION_PATTERN (field);
+
/* We set this in add_capture to avoid duplicates. */
- IDENTIFIER_MARKED (DECL_NAME (TREE_PURPOSE (captures))) = false;
- finish_member_declaration (TREE_PURPOSE (captures));
+ IDENTIFIER_MARKED (DECL_NAME (field)) = false;
+ finish_member_declaration (field);
}
/* Similar to add_capture, except this works on a stack of nested lambdas.
@@ -565,6 +597,8 @@ add_default_capture (tree lambda_stack, tree id, tree initializer)
tree lambda = TREE_VALUE (node);
current_class_type = LAMBDA_EXPR_CLOSURE (lambda);
+ if (DECL_PACK_P (initializer))
+ initializer = make_pack_expansion (initializer);
var = add_capture (lambda,
id,
initializer,
@@ -741,6 +775,22 @@ nonlambda_method_basetype (void)
return TYPE_METHOD_BASETYPE (TREE_TYPE (fn));
}
+/* Helper function for maybe_add_lambda_conv_op; build a CALL_EXPR with
+ indicated FN and NARGS, but do not initialize the return type or any of the
+ argument slots. */
+
+static tree
+prepare_op_call (tree fn, int nargs)
+{
+ tree t;
+
+ t = build_vl_exp (CALL_EXPR, nargs + 3);
+ CALL_EXPR_FN (t) = fn;
+ CALL_EXPR_STATIC_CHAIN (t) = NULL;
+
+ return t;
+}
+
/* If the closure TYPE has a static op(), also add a conversion to function
pointer. */
@@ -749,9 +799,6 @@ maybe_add_lambda_conv_op (tree type)
{
bool nested = (current_function_decl != NULL_TREE);
tree callop = lambda_function (type);
- tree rettype, name, fntype, fn, body, compound_stmt;
- tree thistype, stattype, statfn, convfn, call, arg;
- vec<tree, va_gc> *argvec;
if (LAMBDA_EXPR_CAPTURE_LIST (CLASSTYPE_LAMBDA_EXPR (type)) != NULL_TREE)
return;
@@ -759,23 +806,135 @@ maybe_add_lambda_conv_op (tree type)
if (processing_template_decl)
return;
- if (DECL_INITIAL (callop) == NULL_TREE)
+ bool const generic_lambda_p
+ = (DECL_TEMPLATE_INFO (callop)
+ && DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (callop)) == callop);
+
+ if (!generic_lambda_p && DECL_INITIAL (callop) == NULL_TREE)
{
/* If the op() wasn't instantiated due to errors, give up. */
gcc_assert (errorcount || sorrycount);
return;
}
- stattype = build_function_type (TREE_TYPE (TREE_TYPE (callop)),
- FUNCTION_ARG_CHAIN (callop));
+ /* Non-template conversion operators are defined directly with build_call_a
+ and using DIRECT_ARGVEC for arguments (including 'this'). Templates are
+ deferred and the CALL is built in-place. In the case of a deduced return
+ call op, the decltype expression, DECLTYPE_CALL, used as a substitute for
+ the return type is also built in-place. The arguments of DECLTYPE_CALL in
+ the return expression may differ in flags from those in the body CALL. In
+ particular, parameter pack expansions are marked PACK_EXPANSION_LOCAL_P in
+ the body CALL, but not in DECLTYPE_CALL. */
+
+ vec<tree, va_gc> *direct_argvec = 0;
+ tree decltype_call = 0, call = 0;
+ tree fn_result = TREE_TYPE (TREE_TYPE (callop));
+
+ if (generic_lambda_p)
+ {
+ /* Prepare the dependent member call for the static member function
+ '_FUN' and, potentially, prepare another call to be used in a decltype
+ return expression for a deduced return call op to allow for simple
+ implementation of the conversion operator. */
+
+ tree instance = build_nop (type, null_pointer_node);
+ tree objfn = build_min (COMPONENT_REF, NULL_TREE,
+ instance, DECL_NAME (callop), NULL_TREE);
+ int nargs = list_length (DECL_ARGUMENTS (callop)) - 1;
+
+ call = prepare_op_call (objfn, nargs);
+ if (type_uses_auto (fn_result))
+ decltype_call = prepare_op_call (objfn, nargs);
+ }
+ else
+ {
+ direct_argvec = make_tree_vector ();
+ direct_argvec->quick_push (build1 (NOP_EXPR,
+ TREE_TYPE (DECL_ARGUMENTS (callop)),
+ null_pointer_node));
+ }
+
+ /* Copy CALLOP's argument list (as per 'copy_list') as FN_ARGS in order to
+ declare the static member function "_FUN" below. For each arg append to
+ DIRECT_ARGVEC (for the non-template case) or populate the pre-allocated
+ call args (for the template case). If a parameter pack is found, expand
+ it, flagging it as PACK_EXPANSION_LOCAL_P for the body call. */
+
+ tree fn_args = NULL_TREE;
+ {
+ int ix = 0;
+ tree src = DECL_CHAIN (DECL_ARGUMENTS (callop));
+ tree tgt;
+
+ while (src)
+ {
+ tree new_node = copy_node (src);
+
+ if (!fn_args)
+ fn_args = tgt = new_node;
+ else
+ {
+ TREE_CHAIN (tgt) = new_node;
+ tgt = new_node;
+ }
+
+ mark_exp_read (tgt);
+
+ if (generic_lambda_p)
+ {
+ if (DECL_PACK_P (tgt))
+ {
+ tree a = make_pack_expansion (tgt);
+ if (decltype_call)
+ CALL_EXPR_ARG (decltype_call, ix) = copy_node (a);
+ PACK_EXPANSION_LOCAL_P (a) = true;
+ CALL_EXPR_ARG (call, ix) = a;
+ }
+ else
+ {
+ tree a = convert_from_reference (tgt);
+ CALL_EXPR_ARG (call, ix) = a;
+ if (decltype_call)
+ CALL_EXPR_ARG (decltype_call, ix) = copy_node (a);
+ }
+ ++ix;
+ }
+ else
+ vec_safe_push (direct_argvec, tgt);
+
+ src = TREE_CHAIN (src);
+ }
+ }
+
+
+ if (generic_lambda_p)
+ {
+ if (decltype_call)
+ {
+ ++processing_template_decl;
+ fn_result = finish_decltype_type
+ (decltype_call, /*id_expression_or_member_access_p=*/false,
+ tf_warning_or_error);
+ --processing_template_decl;
+ }
+ }
+ else
+ call = build_call_a (callop,
+ direct_argvec->length (),
+ direct_argvec->address ());
+
+ CALL_FROM_THUNK_P (call) = 1;
+
+ tree stattype = build_function_type (fn_result, FUNCTION_ARG_CHAIN (callop));
/* First build up the conversion op. */
- rettype = build_pointer_type (stattype);
- name = mangle_conv_op_name_for_type (rettype);
- thistype = cp_build_qualified_type (type, TYPE_QUAL_CONST);
- fntype = build_method_type_directly (thistype, rettype, void_list_node);
- fn = convfn = build_lang_decl (FUNCTION_DECL, name, fntype);
+ tree rettype = build_pointer_type (stattype);
+ tree name = mangle_conv_op_name_for_type (rettype);
+ tree thistype = cp_build_qualified_type (type, TYPE_QUAL_CONST);
+ tree fntype = build_method_type_directly (thistype, rettype, void_list_node);
+ tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype);
+ tree fn = convfn;
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
@@ -794,6 +953,9 @@ maybe_add_lambda_conv_op (tree type)
if (nested)
DECL_INTERFACE_KNOWN (fn) = 1;
+ if (generic_lambda_p)
+ fn = add_inherited_template_parms (fn, DECL_TI_TEMPLATE (callop));
+
add_method (type, fn, NULL_TREE);
/* Generic thunk code fails for varargs; we'll complain in mark_used if
@@ -807,7 +969,8 @@ maybe_add_lambda_conv_op (tree type)
/* Now build up the thunk to be returned. */
name = get_identifier ("_FUN");
- fn = statfn = build_lang_decl (FUNCTION_DECL, name, stattype);
+ tree statfn = build_lang_decl (FUNCTION_DECL, name, stattype);
+ fn = statfn;
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);
if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn
&& DECL_ALIGN (fn) < 2 * BITS_PER_UNIT)
@@ -820,8 +983,8 @@ maybe_add_lambda_conv_op (tree type)
DECL_NOT_REALLY_EXTERN (fn) = 1;
DECL_DECLARED_INLINE_P (fn) = 1;
DECL_STATIC_FUNCTION_P (fn) = 1;
- DECL_ARGUMENTS (fn) = copy_list (DECL_CHAIN (DECL_ARGUMENTS (callop)));
- for (arg = DECL_ARGUMENTS (fn); arg; arg = DECL_CHAIN (arg))
+ DECL_ARGUMENTS (fn) = fn_args;
+ for (tree arg = fn_args; arg; arg = DECL_CHAIN (arg))
{
/* Avoid duplicate -Wshadow warnings. */
DECL_NAME (arg) = NULL_TREE;
@@ -830,6 +993,9 @@ maybe_add_lambda_conv_op (tree type)
if (nested)
DECL_INTERFACE_KNOWN (fn) = 1;
+ if (generic_lambda_p)
+ fn = add_inherited_template_parms (fn, DECL_TI_TEMPLATE (callop));
+
add_method (type, fn, NULL_TREE);
if (nested)
@@ -850,29 +1016,23 @@ maybe_add_lambda_conv_op (tree type)
((symtab_node) cgraph_get_create_node (statfn),
(symtab_node) cgraph_get_create_node (callop));
}
- body = begin_function_body ();
- compound_stmt = begin_compound_stmt (0);
-
- arg = build1 (NOP_EXPR, TREE_TYPE (DECL_ARGUMENTS (callop)),
- null_pointer_node);
- argvec = make_tree_vector ();
- argvec->quick_push (arg);
- for (arg = DECL_ARGUMENTS (statfn); arg; arg = DECL_CHAIN (arg))
+ tree body = begin_function_body ();
+ tree compound_stmt = begin_compound_stmt (0);
+ if (!generic_lambda_p)
{
- mark_exp_read (arg);
- vec_safe_push (argvec, arg);
+ set_flags_from_callee (call);
+ if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
+ call = build_cplus_new (TREE_TYPE (call), call, tf_warning_or_error);
}
- call = build_call_a (callop, argvec->length (), argvec->address ());
- CALL_FROM_THUNK_P (call) = 1;
- if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
- call = build_cplus_new (TREE_TYPE (call), call, tf_warning_or_error);
call = convert_from_reference (call);
finish_return_stmt (call);
finish_compound_stmt (compound_stmt);
finish_function_body (body);
- expand_or_defer_fn (finish_function (2));
+ fn = finish_function (/*inline*/2);
+ if (!generic_lambda_p)
+ expand_or_defer_fn (fn);
/* Generate the body of the conversion op. */
@@ -888,7 +1048,9 @@ maybe_add_lambda_conv_op (tree type)
finish_compound_stmt (compound_stmt);
finish_function_body (body);
- expand_or_defer_fn (finish_function (2));
+ fn = finish_function (/*inline*/2);
+ if (!generic_lambda_p)
+ expand_or_defer_fn (fn);
if (nested)
pop_function_context ();
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 923277b6daa..f3133f39301 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "plugin.h"
#include "tree-pretty-print.h"
#include "parser.h"
+#include "type-utils.h"
/* The lexer. */
@@ -2063,6 +2064,11 @@ static vec<constructor_elt, va_gc> *cp_parser_initializer_list
static bool cp_parser_ctor_initializer_opt_and_function_body
(cp_parser *, bool);
+static tree add_implicit_template_parms
+ (cp_parser *, size_t, tree);
+static tree finish_fully_implicit_template
+ (cp_parser *, tree);
+
/* Classes [gram.class] */
static tree cp_parser_class_name
@@ -3385,6 +3391,9 @@ cp_parser_new (void)
/* No template parameters apply. */
parser->num_template_parameter_lists = 0;
+ /* Not declaring an implicit function template. */
+ parser->fully_implicit_function_template_p = false;
+
return parser;
}
@@ -5533,6 +5542,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
cp_id_kind * pidk_return)
{
cp_token *token;
+ location_t loc;
enum rid keyword;
cp_id_kind idk = CP_ID_KIND_NONE;
tree postfix_expression = NULL_TREE;
@@ -5540,6 +5550,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
+ loc = token->location;
/* Some of the productions are determined by keywords. */
keyword = token->keyword;
switch (keyword)
@@ -5685,7 +5696,6 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
vec<tree, va_gc> *vec;
unsigned int i;
tree p;
- location_t loc = token->location;
cp_lexer_consume_token (parser->lexer);
vec = cp_parser_parenthesized_expression_list (parser, non_attr,
@@ -6018,8 +6028,7 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p, bool cast_p,
postfix_expression
= cp_parser_postfix_dot_deref_expression (parser, token->type,
postfix_expression,
- false, &idk,
- token->location);
+ false, &idk, loc);
is_member_access = true;
break;
@@ -6338,7 +6347,7 @@ cp_parser_postfix_dot_deref_expression (cp_parser *parser,
pseudo_destructor_p = true;
postfix_expression
= finish_pseudo_destructor_expr (postfix_expression,
- s, type);
+ s, type, location);
}
}
@@ -8549,10 +8558,12 @@ cp_parser_lambda_expression (cp_parser* parser)
= parser->num_template_parameter_lists;
unsigned char in_statement = parser->in_statement;
bool in_switch_statement_p = parser->in_switch_statement_p;
+ bool fully_implicit_function_template_p = parser->fully_implicit_function_template_p;
parser->num_template_parameter_lists = 0;
parser->in_statement = 0;
parser->in_switch_statement_p = false;
+ parser->fully_implicit_function_template_p = false;
/* By virtue of defining a local class, a lambda expression has access to
the private variables of enclosing classes. */
@@ -8576,6 +8587,7 @@ cp_parser_lambda_expression (cp_parser* parser)
parser->num_template_parameter_lists = saved_num_template_parameter_lists;
parser->in_statement = in_statement;
parser->in_switch_statement_p = in_switch_statement_p;
+ parser->fully_implicit_function_template_p = fully_implicit_function_template_p;
}
pop_deferring_access_checks ();
@@ -8753,6 +8765,14 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
/*template_arg_p=*/false,
&error_msg,
capture_token->location);
+
+ if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
+ {
+ cp_lexer_consume_token (parser->lexer);
+ capture_init_expr = make_pack_expansion (capture_init_expr);
+ }
+ else
+ check_for_bare_parameter_packs (capture_init_expr);
}
if (LAMBDA_EXPR_DEFAULT_CAPTURE_MODE (lambda_expr) != CPLD_NONE
@@ -8783,6 +8803,7 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
/* Parse the (optional) middle of a lambda expression.
lambda-declarator:
+ < template-parameter-list [opt] >
( parameter-declaration-clause [opt] )
attribute-specifier [opt]
mutable [opt]
@@ -8802,9 +8823,30 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
tree param_list = void_list_node;
tree attributes = NULL_TREE;
tree exception_spec = NULL_TREE;
+ tree template_param_list = NULL_TREE;
- /* The lambda-declarator is optional, but must begin with an opening
- parenthesis if present. */
+ /* The template-parameter-list is optional, but must begin with
+ an opening angle if present. */
+ if (cp_lexer_next_token_is (parser->lexer, CPP_LESS))
+ {
+ if (cxx_dialect < cxx1y)
+ pedwarn (parser->lexer->next_token->location, 0,
+ "lambda templates are only available with "
+ "-std=c++1y or -std=gnu++1y");
+
+ cp_lexer_consume_token (parser->lexer);
+
+ template_param_list = cp_parser_template_parameter_list (parser);
+
+ cp_parser_skip_to_end_of_template_parameter_list (parser);
+
+ /* We just processed one more parameter list. */
+ ++parser->num_template_parameter_lists;
+ }
+
+ /* The parameter-declaration-clause is optional (unless
+ template-parameter-list was given), but must begin with an
+ opening parenthesis if present. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
{
cp_lexer_consume_token (parser->lexer);
@@ -8847,6 +8889,8 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
trailing-return-type in case of decltype. */
pop_bindings_and_leave_scope ();
}
+ else if (template_param_list != NULL_TREE) // generate diagnostic
+ cp_parser_require (parser, CPP_OPEN_PAREN, RT_OPEN_PAREN);
/* Create the function call operator.
@@ -8890,6 +8934,14 @@ cp_parser_lambda_declarator_opt (cp_parser* parser, tree lambda_expr)
DECL_ARTIFICIAL (fco) = 1;
/* Give the object parameter a different name. */
DECL_NAME (DECL_ARGUMENTS (fco)) = get_identifier ("__closure");
+ if (template_param_list)
+ {
+ fco = finish_member_template_decl (fco);
+ finish_template_decl (template_param_list);
+ --parser->num_template_parameter_lists;
+ }
+ else if (parser->fully_implicit_function_template_p)
+ fco = finish_fully_implicit_template (parser, fco);
}
finish_member_declaration (fco);
@@ -9012,7 +9064,11 @@ cp_parser_lambda_body (cp_parser* parser, tree lambda_expr)
finish_lambda_scope ();
/* Finish the function and generate code for it if necessary. */
- expand_or_defer_fn (finish_function (/*inline*/2));
+ tree fn = finish_function (/*inline*/2);
+
+ /* Only expand if the call op is not a template. */
+ if (!DECL_TEMPLATE_INFO (fco))
+ expand_or_defer_fn (fn);
}
parser->local_variables_forbidden_p = local_variables_forbidden_p;
@@ -16247,21 +16303,22 @@ cp_parser_init_declarator (cp_parser* parser,
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
- /* Check to see if the token indicates the start of a
- function-definition. */
- if (function_declarator_p (declarator)
- && cp_parser_token_starts_function_definition_p (token))
+
+ if (function_declarator_p (declarator))
{
- if (!function_definition_allowed_p)
- {
- /* If a function-definition should not appear here, issue an
- error message. */
- cp_parser_error (parser,
- "a function-definition is not allowed here");
- return error_mark_node;
- }
- else
+ /* Check to see if the token indicates the start of a
+ function-definition. */
+ if (cp_parser_token_starts_function_definition_p (token))
{
+ if (!function_definition_allowed_p)
+ {
+ /* If a function-definition should not appear here, issue an
+ error message. */
+ cp_parser_error (parser,
+ "a function-definition is not allowed here");
+ return error_mark_node;
+ }
+
location_t func_brace_location
= cp_lexer_peek_token (parser->lexer)->location;
@@ -16273,7 +16330,8 @@ cp_parser_init_declarator (cp_parser* parser,
"on a function-definition");
if (attributes)
error_at (attributes_start_token->location,
- "attributes are not allowed on a function-definition");
+ "attributes are not allowed "
+ "on a function-definition");
/* This is a function-definition. */
*function_definition_p = true;
@@ -16284,9 +16342,9 @@ cp_parser_init_declarator (cp_parser* parser,
declarator,
prefix_attributes);
else
- decl
- = (cp_parser_function_definition_from_specifiers_and_declarator
- (parser, decl_specifiers, prefix_attributes, declarator));
+ decl =
+ (cp_parser_function_definition_from_specifiers_and_declarator
+ (parser, decl_specifiers, prefix_attributes, declarator));
if (decl != error_mark_node && DECL_STRUCT_FUNCTION (decl))
{
@@ -16519,6 +16577,15 @@ cp_parser_init_declarator (cp_parser* parser,
if (!friend_p && pushed_scope)
pop_scope (pushed_scope);
+ if (function_declarator_p (declarator)
+ && parser->fully_implicit_function_template_p)
+ {
+ if (member_p)
+ decl = finish_fully_implicit_template (parser, decl);
+ else
+ finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
+ }
+
return decl;
}
@@ -16756,8 +16823,10 @@ cp_parser_direct_declarator (cp_parser* parser,
/* Parse the parameter-declaration-clause. */
params = cp_parser_parameter_declaration_clause (parser);
+ /* Restore saved template parameter lists accounting for implicit
+ template parameters. */
parser->num_template_parameter_lists
- = saved_num_template_parameter_lists;
+ += saved_num_template_parameter_lists;
/* Consume the `)'. */
cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN);
@@ -17855,6 +17924,7 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
tree *tail = &parameters;
bool saved_in_unbraced_linkage_specification_p;
int index = 0;
+ int implicit_template_parms = 0;
/* Assume all will go well. */
*is_error = false;
@@ -17882,11 +17952,18 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
deprecated_state = DEPRECATED_SUPPRESS;
if (parameter)
- decl = grokdeclarator (parameter->declarator,
- &parameter->decl_specifiers,
- PARM,
- parameter->default_argument != NULL_TREE,
- &parameter->decl_specifiers.attributes);
+ {
+ decl = grokdeclarator (parameter->declarator,
+ &parameter->decl_specifiers,
+ PARM,
+ parameter->default_argument != NULL_TREE,
+ &parameter->decl_specifiers.attributes);
+
+ if (TREE_TYPE (decl) != error_mark_node
+ && parameter->decl_specifiers.type
+ && is_auto_or_concept (parameter->decl_specifiers.type))
+ ++implicit_template_parms;
+ }
deprecated_state = DEPRECATED_NORMAL;
@@ -17974,6 +18051,11 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
parser->in_unbraced_linkage_specification_p
= saved_in_unbraced_linkage_specification_p;
+ if (parameters != error_mark_node && implicit_template_parms)
+ parameters = add_implicit_template_parms (parser,
+ implicit_template_parms,
+ parameters);
+
return parameters;
}
@@ -19980,7 +20062,11 @@ cp_parser_member_declaration (cp_parser* parser)
attributes);
/* If the member was not a friend, declare it here. */
if (!friend_p)
- finish_member_declaration (decl);
+ {
+ if (parser->fully_implicit_function_template_p)
+ decl = finish_fully_implicit_template (parser, decl);
+ finish_member_declaration (decl);
+ }
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
/* If the next token is a semicolon, consume it. */
@@ -19996,6 +20082,8 @@ cp_parser_member_declaration (cp_parser* parser)
initializer, /*init_const_expr_p=*/true,
asm_specification,
attributes);
+ if (parser->fully_implicit_function_template_p)
+ decl = finish_fully_implicit_template (parser, decl);
}
/* Reset PREFIX_ATTRIBUTES. */
@@ -22263,6 +22351,9 @@ cp_parser_function_definition_after_declarator (cp_parser* parser,
= saved_num_template_parameter_lists;
parser->in_function_body = saved_in_function_body;
+ if (parser->fully_implicit_function_template_p)
+ finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
+
return fn;
}
@@ -28808,4 +28899,150 @@ c_parse_file (void)
the_parser = NULL;
}
+/* Create an identifier for a generic parameter type (a synthesized
+ template parameter implied by `auto' or a concept identifier). */
+
+static GTY(()) int generic_parm_count;
+static tree
+make_generic_type_name ()
+{
+ char buf[32];
+ sprintf (buf, "<auto%d>", ++generic_parm_count);
+ return get_identifier (buf);
+}
+
+/* Predicate that behaves as is_auto_or_concept but matches the parent
+ node of the generic type rather than the generic type itself. This
+ allows for type transformation in add_implicit_template_parms. */
+
+static inline bool
+tree_type_is_auto_or_concept (const_tree t)
+{
+ return TREE_TYPE (t) && is_auto_or_concept (TREE_TYPE (t));
+}
+
+/* Add EXPECT_COUNT implicit template parameters gleaned from the generic
+ type parameters in PARAMETERS to the CURRENT_TEMPLATE_PARMS (creating a new
+ template parameter list if necessary). Returns PARAMETERS suitably rewritten
+ to reference the newly created types or ERROR_MARK_NODE on failure. */
+
+tree
+add_implicit_template_parms (cp_parser *parser, size_t expect_count,
+ tree parameters)
+{
+ gcc_assert (current_binding_level->kind == sk_function_parms);
+
+ cp_binding_level *fn_parms_scope = current_binding_level;
+
+ bool become_template =
+ fn_parms_scope->level_chain->kind != sk_template_parms;
+
+ size_t synth_count = 0;
+
+ /* Roll back a scope level and either introduce a new template parameter list
+ or update an existing one. The function scope is added back after template
+ parameter synthesis below. */
+ current_binding_level = fn_parms_scope->level_chain;
+
+ /* TPARMS tracks the function's template parameter list. This is either a new
+ chain in the case of a fully implicit function template or an extension of
+ the function's explicitly specified template parameter list. */
+ tree tparms = NULL_TREE;
+
+ if (become_template)
+ {
+ push_deferring_access_checks (dk_deferred);
+ begin_template_parm_list ();
+
+ parser->fully_implicit_function_template_p = true;
+ ++parser->num_template_parameter_lists;
+ }
+ else
+ {
+ /* Roll back the innermost template parameter list such that it may be
+ extended in the loop below as if it were being explicitly declared. */
+
+ gcc_assert (current_template_parms);
+
+ /* Pop the innermost template parms into TPARMS. */
+ tree inner_vec = INNERMOST_TEMPLATE_PARMS (current_template_parms);
+ current_template_parms = TREE_CHAIN (current_template_parms);
+
+ size_t inner_vec_len = TREE_VEC_LENGTH (inner_vec);
+ if (inner_vec_len != 0)
+ {
+ tree t = tparms = TREE_VEC_ELT (inner_vec, 0);
+ for (size_t n = 1; n < inner_vec_len; ++n)
+ t = TREE_CHAIN (t) = TREE_VEC_ELT (inner_vec, n);
+ }
+
+ ++processing_template_parmlist;
+ }
+
+ for (tree p = parameters; p && synth_count < expect_count; p = TREE_CHAIN (p))
+ {
+ tree generic_type_ptr
+ = find_type_usage (TREE_VALUE (p), tree_type_is_auto_or_concept);
+
+ if (!generic_type_ptr)
+ continue;
+
+ ++synth_count;
+
+ tree synth_id = make_generic_type_name ();
+ tree synth_tmpl_parm = finish_template_type_parm (class_type_node,
+ synth_id);
+ tparms = process_template_parm (tparms, DECL_SOURCE_LOCATION (TREE_VALUE
+ (p)),
+ build_tree_list (NULL_TREE,
+ synth_tmpl_parm),
+ /*non_type=*/false,
+ /*param_pack=*/false);
+
+ /* Rewrite the type of P to be the template_parm added above (getdecls is
+ used to retrieve it since it is the most recent declaration in this
+ scope). Qualifiers need to be preserved also. */
+
+ tree& cur_type = TREE_TYPE (generic_type_ptr);
+ tree new_type = TREE_TYPE (getdecls ());
+
+ if (TYPE_QUALS (cur_type))
+ cur_type = cp_build_qualified_type (new_type, TYPE_QUALS (cur_type));
+ else
+ cur_type = new_type;
+ }
+
+ gcc_assert (synth_count == expect_count);
+
+ push_binding_level (fn_parms_scope);
+
+ end_template_parm_list (tparms);
+
+ return parameters;
+}
+
+/* Finish the declaration of a fully implicit function template. Such a
+ template has no explicit template parameter list so has not been through the
+ normal template head and tail processing. add_implicit_template_parms tries
+ to do the head; this tries to do the tail. MEMBER_DECL_OPT should be
+ provided if the declaration is a class member such that its template
+ declaration can be completed. If MEMBER_DECL_OPT is provided the finished
+ form is returned. Otherwise NULL_TREE is returned. */
+
+tree
+finish_fully_implicit_template (cp_parser *parser, tree member_decl_opt)
+{
+ gcc_assert (parser->fully_implicit_function_template_p);
+
+ pop_deferring_access_checks ();
+ if (member_decl_opt)
+ member_decl_opt = finish_member_template_decl (member_decl_opt);
+ end_template_decl ();
+
+ parser->fully_implicit_function_template_p = false;
+ --parser->num_template_parameter_lists;
+
+ return member_decl_opt;
+}
+
#include "gt-cp-parser.h"
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h
index 3d8bb742d22..ffdddaf4a08 100644
--- a/gcc/cp/parser.h
+++ b/gcc/cp/parser.h
@@ -341,6 +341,12 @@ typedef struct GTY(()) cp_parser {
/* The number of template parameter lists that apply directly to the
current declaration. */
unsigned num_template_parameter_lists;
+
+ /* TRUE if the function being declared was made a template due to its
+ parameter list containing generic type specifiers (`auto' or concept
+ identifiers) rather than an explicit template parameter list. */
+ bool fully_implicit_function_template_p;
+
} cp_parser;
/* In parser.c */
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e937318d227..b330b78cbc8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "timevar.h"
#include "tree-iterator.h"
+#include "type-utils.h"
/* The type of functions taking a tree, and some additional data, and
returning an int. */
@@ -1004,7 +1005,10 @@ optimize_specialization_lookup_p (tree tmpl)
If TMPL is a type template and CLASS_SPECIALIZATIONS_P is true,
then we search for a partial specialization matching ARGS. This
- parameter is ignored if TMPL is not a class template. */
+ parameter is ignored if TMPL is not a class template.
+
+ We can also look up a FIELD_DECL, if it is a lambda capture pack; the
+ result is a NONTYPE_ARGUMENT_PACK. */
static tree
retrieve_specialization (tree tmpl, tree args, hashval_t hash)
@@ -1015,12 +1019,15 @@ retrieve_specialization (tree tmpl, tree args, hashval_t hash)
if (args == error_mark_node)
return NULL_TREE;
- gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL);
+ gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL
+ || TREE_CODE (tmpl) == FIELD_DECL);
/* There should be as many levels of arguments as there are
levels of parameters. */
gcc_assert (TMPL_ARGS_DEPTH (args)
- == TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl)));
+ == (TREE_CODE (tmpl) == TEMPLATE_DECL
+ ? TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (tmpl))
+ : template_class_depth (DECL_CONTEXT (tmpl))));
if (optimize_specialization_lookup_p (tmpl))
{
@@ -1311,7 +1318,10 @@ is_specialization_of_friend (tree decl, tree friend_decl)
/* Register the specialization SPEC as a specialization of TMPL with
the indicated ARGS. IS_FRIEND indicates whether the specialization
is actually just a friend declaration. Returns SPEC, or an
- equivalent prior declaration, if available. */
+ equivalent prior declaration, if available.
+
+ We also store instantiations of field packs in the hash table, even
+ though they are not themselves templates, to make lookup easier. */
static tree
register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
@@ -1321,7 +1331,9 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
void **slot = NULL;
spec_entry elt;
- gcc_assert (TREE_CODE (tmpl) == TEMPLATE_DECL && DECL_P (spec));
+ gcc_assert ((TREE_CODE (tmpl) == TEMPLATE_DECL && DECL_P (spec))
+ || (TREE_CODE (tmpl) == FIELD_DECL
+ && TREE_CODE (spec) == NONTYPE_ARGUMENT_PACK));
if (TREE_CODE (spec) == FUNCTION_DECL
&& uses_template_parms (DECL_TI_ARGS (spec)))
@@ -1443,7 +1455,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
/* A specialization must be declared in the same namespace as the
template it is specializing. */
- if (DECL_TEMPLATE_SPECIALIZATION (spec)
+ if (DECL_P (spec) && DECL_TEMPLATE_SPECIALIZATION (spec)
&& !check_specialization_namespace (tmpl))
DECL_CONTEXT (spec) = DECL_CONTEXT (tmpl);
@@ -2852,7 +2864,7 @@ bool
function_parameter_pack_p (const_tree t)
{
if (t && TREE_CODE (t) == PARM_DECL)
- return FUNCTION_PARAMETER_PACK_P (t);
+ return DECL_PACK_P (t);
return false;
}
@@ -3084,8 +3096,9 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
parameter_pack_p = true;
break;
+ case FIELD_DECL:
case PARM_DECL:
- if (FUNCTION_PARAMETER_PACK_P (t))
+ if (DECL_PACK_P (t))
{
/* We don't want to walk into the type of a PARM_DECL,
because we don't want to see the type parameter pack. */
@@ -3094,6 +3107,18 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
}
break;
+ /* Look through a lambda capture proxy to the field pack. */
+ case VAR_DECL:
+ if (DECL_HAS_VALUE_EXPR_P (t))
+ {
+ tree v = DECL_VALUE_EXPR (t);
+ cp_walk_tree (&v,
+ &find_parameter_packs_r,
+ ppd, ppd->visited);
+ *walk_subtrees = 0;
+ }
+ break;
+
case BASES:
parameter_pack_p = true;
break;
@@ -4646,7 +4671,7 @@ push_template_decl_real (tree decl, bool is_friend)
while (arg && argtype)
{
- if (!FUNCTION_PARAMETER_PACK_P (arg)
+ if (!DECL_PACK_P (arg)
&& check_for_bare_parameter_packs (TREE_TYPE (arg)))
{
/* This is a PARM_DECL that contains unexpanded parameter
@@ -5398,7 +5423,8 @@ unify_arg_conversion (bool explain_p, tree to_type,
tree from_type, tree arg)
{
if (explain_p)
- inform (input_location, " cannot convert %qE (type %qT) to type %qT",
+ inform (EXPR_LOC_OR_HERE (arg),
+ " cannot convert %qE (type %qT) to type %qT",
arg, from_type, to_type);
return 1;
}
@@ -8912,6 +8938,8 @@ instantiate_class_template_1 (tree type)
else if (TREE_CODE (t) != CONST_DECL)
{
tree r;
+ tree vec = NULL_TREE;
+ int len = 1;
/* The file and line for this declaration, to
assist in error message reporting. Since we
@@ -8924,55 +8952,68 @@ instantiate_class_template_1 (tree type)
r = tsubst (t, args, tf_warning_or_error, NULL_TREE);
if (TREE_CODE (t) == TEMPLATE_DECL)
--processing_template_decl;
- if (VAR_P (r))
+
+ if (TREE_CODE (r) == TREE_VEC)
{
- /* In [temp.inst]:
-
- [t]he initialization (and any associated
- side-effects) of a static data member does
- not occur unless the static data member is
- itself used in a way that requires the
- definition of the static data member to
- exist.
-
- Therefore, we do not substitute into the
- initialized for the static data member here. */
- finish_static_data_member_decl
- (r,
- /*init=*/NULL_TREE,
- /*init_const_expr_p=*/false,
- /*asmspec_tree=*/NULL_TREE,
- /*flags=*/0);
- /* Instantiate members marked with attribute used. */
- if (r != error_mark_node && DECL_PRESERVE_P (r))
- mark_used (r);
+ /* A capture pack became multiple fields. */
+ vec = r;
+ len = TREE_VEC_LENGTH (vec);
}
- else if (TREE_CODE (r) == FIELD_DECL)
+
+ for (int i = 0; i < len; ++i)
{
- /* Determine whether R has a valid type and can be
- completed later. If R is invalid, then its type is
- replaced by error_mark_node. */
- tree rtype = TREE_TYPE (r);
- if (can_complete_type_without_circularity (rtype))
- complete_type (rtype);
-
- if (!COMPLETE_TYPE_P (rtype))
+ if (vec)
+ r = TREE_VEC_ELT (vec, i);
+ if (VAR_P (r))
{
- cxx_incomplete_type_error (r, rtype);
- TREE_TYPE (r) = error_mark_node;
+ /* In [temp.inst]:
+
+ [t]he initialization (and any associated
+ side-effects) of a static data member does
+ not occur unless the static data member is
+ itself used in a way that requires the
+ definition of the static data member to
+ exist.
+
+ Therefore, we do not substitute into the
+ initialized for the static data member here. */
+ finish_static_data_member_decl
+ (r,
+ /*init=*/NULL_TREE,
+ /*init_const_expr_p=*/false,
+ /*asmspec_tree=*/NULL_TREE,
+ /*flags=*/0);
+ /* Instantiate members marked with attribute used. */
+ if (r != error_mark_node && DECL_PRESERVE_P (r))
+ mark_used (r);
+ }
+ else if (TREE_CODE (r) == FIELD_DECL)
+ {
+ /* Determine whether R has a valid type and can be
+ completed later. If R is invalid, then its type
+ is replaced by error_mark_node. */
+ tree rtype = TREE_TYPE (r);
+ if (can_complete_type_without_circularity (rtype))
+ complete_type (rtype);
+
+ if (!COMPLETE_TYPE_P (rtype))
+ {
+ cxx_incomplete_type_error (r, rtype);
+ TREE_TYPE (r) = error_mark_node;
+ }
}
- }
- /* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE,
- such a thing will already have been added to the field
- list by tsubst_enum in finish_member_declaration in the
- CLASSTYPE_NESTED_UTDS case above. */
- if (!(TREE_CODE (r) == TYPE_DECL
- && TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
- && DECL_ARTIFICIAL (r)))
- {
- set_current_access_from_decl (r);
- finish_member_declaration (r);
+ /* If it is a TYPE_DECL for a class-scoped ENUMERAL_TYPE,
+ such a thing will already have been added to the field
+ list by tsubst_enum in finish_member_declaration in the
+ CLASSTYPE_NESTED_UTDS case above. */
+ if (!(TREE_CODE (r) == TYPE_DECL
+ && TREE_CODE (TREE_TYPE (r)) == ENUMERAL_TYPE
+ && DECL_ARTIFICIAL (r)))
+ {
+ set_current_access_from_decl (r);
+ finish_member_declaration (r);
+ }
}
}
}
@@ -9102,7 +9143,9 @@ instantiate_class_template_1 (tree type)
tree decl = lambda_function (type);
if (decl)
{
- instantiate_decl (decl, false, false);
+ if (!DECL_TEMPLATE_INFO (decl)
+ || DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (decl)) != decl)
+ instantiate_decl (decl, false, false);
/* We need to instantiate the capture list from the template
after we've instantiated the closure members, but before we
@@ -9366,7 +9409,8 @@ gen_elem_of_pack_expansion_instantiation (tree pattern,
argument_pack_element_is_expansion_p (arg_pack, index);
/* Select the Ith argument from the pack. */
- if (TREE_CODE (parm) == PARM_DECL)
+ if (TREE_CODE (parm) == PARM_DECL
+ || TREE_CODE (parm) == FIELD_DECL)
{
if (index == 0)
{
@@ -9471,7 +9515,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
have the wrong value for a recursive call. Just make a
dummy decl, since it's only used for its type. */
arg_pack = tsubst_decl (parm_pack, args, complain);
- if (arg_pack && FUNCTION_PARAMETER_PACK_P (arg_pack))
+ if (arg_pack && DECL_PACK_P (arg_pack))
/* Partial instantiation of the parm_pack, we can't build
up an argument pack yet. */
arg_pack = NULL_TREE;
@@ -9480,6 +9524,8 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
need_local_specializations = true;
}
}
+ else if (TREE_CODE (parm_pack) == FIELD_DECL)
+ arg_pack = tsubst_copy (parm_pack, args, complain, in_decl);
else
{
int idx;
@@ -9604,7 +9650,8 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
{
tree parm = TREE_PURPOSE (pack);
- if (TREE_CODE (parm) == PARM_DECL)
+ if (TREE_CODE (parm) == PARM_DECL
+ || TREE_CODE (parm) == FIELD_DECL)
register_local_specialization (TREE_TYPE (pack), parm);
else
{
@@ -10464,7 +10511,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
tree prev_r = NULL_TREE;
tree first_r = NULL_TREE;
- if (FUNCTION_PARAMETER_PACK_P (t))
+ if (DECL_PACK_P (t))
{
/* If there is a local specialization that isn't a
parameter pack, it means that we're doing a "simple"
@@ -10499,7 +10546,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
}
}
- /* Loop through all of the parameter's we'll build. When T is
+ /* Loop through all of the parameters we'll build. When T is
a function parameter pack, LEN is the number of expanded
types in EXPANDED_TYPES; otherwise, LEN is 1. */
r = NULL_TREE;
@@ -10514,10 +10561,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
/* We're on the Ith parameter of the function parameter
pack. */
{
- /* An argument of a function parameter pack is not a parameter
- pack. */
- FUNCTION_PARAMETER_PACK_P (r) = false;
-
/* Get the Ith type. */
type = TREE_VEC_ELT (expanded_types, i);
@@ -10575,39 +10618,88 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
case FIELD_DECL:
{
- tree type;
+ tree type = NULL_TREE;
+ tree vec = NULL_TREE;
+ tree expanded_types = NULL_TREE;
+ int len = 1;
- r = copy_decl (t);
- type = tsubst (TREE_TYPE (t), args, complain, in_decl);
- if (type == error_mark_node)
- RETURN (error_mark_node);
- TREE_TYPE (r) = type;
- cp_apply_type_quals_to_decl (cp_type_quals (type), r);
+ if (PACK_EXPANSION_P (TREE_TYPE (t)))
+ {
+ /* This field is a lambda capture pack. Return a TREE_VEC of
+ the expanded fields to instantiate_class_template_1 and
+ store them in the specializations hash table as a
+ NONTYPE_ARGUMENT_PACK so that tsubst_copy can find them. */
+ expanded_types = tsubst_pack_expansion (TREE_TYPE (t), args,
+ complain, in_decl);
+ if (TREE_CODE (expanded_types) == TREE_VEC)
+ {
+ len = TREE_VEC_LENGTH (expanded_types);
+ vec = make_tree_vec (len);
+ }
+ else
+ {
+ /* All we did was update the type. Make a note of that. */
+ type = expanded_types;
+ expanded_types = NULL_TREE;
+ }
+ }
- if (DECL_C_BIT_FIELD (r))
- /* For bit-fields, DECL_INITIAL gives the number of bits. For
- non-bit-fields DECL_INITIAL is a non-static data member
- initializer, which gets deferred instantiation. */
- DECL_INITIAL (r)
- = tsubst_expr (DECL_INITIAL (t), args,
- complain, in_decl,
- /*integral_constant_expression_p=*/true);
- else if (DECL_INITIAL (t))
+ for (int i = 0; i < len; ++i)
{
- /* Set up DECL_TEMPLATE_INFO so that we can get at the
- NSDMI in perform_member_init. Still set DECL_INITIAL
- so that we know there is one. */
- DECL_INITIAL (r) = void_zero_node;
- gcc_assert (DECL_LANG_SPECIFIC (r) == NULL);
- retrofit_lang_decl (r);
- DECL_TEMPLATE_INFO (r) = build_template_info (t, args);
+ r = copy_decl (t);
+ if (expanded_types)
+ {
+ type = TREE_VEC_ELT (expanded_types, i);
+ DECL_NAME (r)
+ = make_ith_pack_parameter_name (DECL_NAME (r), i);
+ }
+ else if (!type)
+ type = tsubst (TREE_TYPE (t), args, complain, in_decl);
+
+ if (type == error_mark_node)
+ RETURN (error_mark_node);
+ TREE_TYPE (r) = type;
+ cp_apply_type_quals_to_decl (cp_type_quals (type), r);
+
+ if (DECL_C_BIT_FIELD (r))
+ /* For bit-fields, DECL_INITIAL gives the number of bits. For
+ non-bit-fields DECL_INITIAL is a non-static data member
+ initializer, which gets deferred instantiation. */
+ DECL_INITIAL (r)
+ = tsubst_expr (DECL_INITIAL (t), args,
+ complain, in_decl,
+ /*integral_constant_expression_p=*/true);
+ else if (DECL_INITIAL (t))
+ {
+ /* Set up DECL_TEMPLATE_INFO so that we can get at the
+ NSDMI in perform_member_init. Still set DECL_INITIAL
+ so that we know there is one. */
+ DECL_INITIAL (r) = void_zero_node;
+ gcc_assert (DECL_LANG_SPECIFIC (r) == NULL);
+ retrofit_lang_decl (r);
+ DECL_TEMPLATE_INFO (r) = build_template_info (t, args);
+ }
+ /* We don't have to set DECL_CONTEXT here; it is set by
+ finish_member_declaration. */
+ DECL_CHAIN (r) = NULL_TREE;
+
+ apply_late_template_attributes (&r, DECL_ATTRIBUTES (r), 0,
+ args, complain, in_decl);
+
+ if (vec)
+ TREE_VEC_ELT (vec, i) = r;
}
- /* We don't have to set DECL_CONTEXT here; it is set by
- finish_member_declaration. */
- DECL_CHAIN (r) = NULL_TREE;
- apply_late_template_attributes (&r, DECL_ATTRIBUTES (r), 0,
- args, complain, in_decl);
+ if (vec)
+ {
+ r = vec;
+ tree pack = make_node (NONTYPE_ARGUMENT_PACK);
+ tree tpack = cxx_make_type (TYPE_ARGUMENT_PACK);
+ SET_ARGUMENT_PACK_ARGS (pack, vec);
+ SET_ARGUMENT_PACK_ARGS (tpack, expanded_types);
+ TREE_TYPE (pack) = tpack;
+ register_specialization (pack, t, args, false, 0);
+ }
}
break;
@@ -10756,14 +10848,14 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
{
/* It may seem that this case cannot occur, since:
- typedef void f();
- void g() { f x; }
+ typedef void f();
+ void g() { f x; }
declares a function, not a variable. However:
- typedef void f();
- template <typename T> void g() { T t; }
- template void g<f>();
+ typedef void f();
+ template <typename T> void g() { T t; }
+ template void g<f>();
is an attempt to declare a variable with function
type. */
@@ -11448,7 +11540,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/*entering_scope=*/0,
complain);
return cp_build_qualified_type_real
- (r, cp_type_quals (t), complain);
+ (r, cp_type_quals (t) | cp_type_quals (r), complain);
}
else
/* TEMPLATE_TEMPLATE_PARM or TEMPLATE_PARM_INDEX. */
@@ -12264,6 +12356,23 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
return t;
case FIELD_DECL:
+ if (PACK_EXPANSION_P (TREE_TYPE (t)))
+ {
+ /* Check for a local specialization set up by
+ tsubst_pack_expansion. */
+ tree r = retrieve_local_specialization (t);
+ if (r)
+ {
+ if (TREE_CODE (r) == ARGUMENT_PACK_SELECT)
+ r = ARGUMENT_PACK_SELECT_ARG (r);
+ return r;
+ }
+
+ /* Otherwise return the full NONTYPE_ARGUMENT_PACK that
+ tsubst_decl put in the hash table. */
+ return retrieve_specialization (t, args, 0);
+ }
+
if (DECL_CONTEXT (t))
{
tree ctx;
@@ -12325,7 +12434,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
return t;
case BASELINK:
- return tsubst_baselink (t, current_class_type, args, complain, in_decl);
+ return tsubst_baselink (t, current_nonlambda_class_type (),
+ args, complain, in_decl);
case TEMPLATE_DECL:
if (DECL_TEMPLATE_TEMPLATE_PARM_P (t))
@@ -13023,6 +13133,12 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
else
do_local_using_decl (decl, scope, name);
}
+ else if (DECL_PACK_P (decl))
+ {
+ /* Don't build up decls for a variadic capture proxy, we'll
+ instantiate the elements directly as needed. */
+ break;
+ }
else
{
init = DECL_INITIAL (decl);
@@ -14292,9 +14408,10 @@ tsubst_copy_and_build (tree t,
case PSEUDO_DTOR_EXPR:
RETURN (finish_pseudo_destructor_expr
- (RECUR (TREE_OPERAND (t, 0)),
- RECUR (TREE_OPERAND (t, 1)),
- tsubst (TREE_OPERAND (t, 2), args, complain, in_decl)));
+ (RECUR (TREE_OPERAND (t, 0)),
+ RECUR (TREE_OPERAND (t, 1)),
+ tsubst (TREE_OPERAND (t, 2), args, complain, in_decl),
+ input_location));
case TREE_LIST:
{
@@ -14423,7 +14540,8 @@ tsubst_copy_and_build (tree t,
{
dtor = TREE_OPERAND (dtor, 0);
if (TYPE_P (dtor))
- RETURN (finish_pseudo_destructor_expr (object, s, dtor));
+ RETURN (finish_pseudo_destructor_expr
+ (object, s, dtor, input_location));
}
}
}
@@ -14586,6 +14704,14 @@ tsubst_copy_and_build (tree t,
case VAR_DECL:
if (!args)
RETURN (t);
+ else if (DECL_PACK_P (t))
+ {
+ /* We don't build decls for an instantiation of a
+ variadic capture proxy, we instantiate the elements
+ when needed. */
+ gcc_assert (DECL_HAS_VALUE_EXPR_P (t));
+ return RECUR (DECL_VALUE_EXPR (t));
+ }
/* Fall through */
case PARM_DECL:
@@ -18702,7 +18828,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
pattern_parm
= skip_artificial_parms_for (code_pattern,
DECL_ARGUMENTS (code_pattern));
- while (decl_parm && !FUNCTION_PARAMETER_PACK_P (pattern_parm))
+ while (decl_parm && !DECL_PACK_P (pattern_parm))
{
tree parm_type;
tree attributes;
@@ -18725,7 +18851,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
}
/* Merge any parameters that match with the function parameter
pack. */
- if (pattern_parm && FUNCTION_PARAMETER_PACK_P (pattern_parm))
+ if (pattern_parm && DECL_PACK_P (pattern_parm))
{
int i, len;
tree expanded_types;
@@ -18944,6 +19070,8 @@ instantiate_decl (tree d, int defer_ok,
tree gen_tmpl;
bool pattern_defined;
location_t saved_loc = input_location;
+ int saved_unevaluated_operand = cp_unevaluated_operand;
+ int saved_inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
bool external_p;
tree fn_context;
bool nested;
@@ -19155,8 +19283,13 @@ instantiate_decl (tree d, int defer_ok,
nested = (current_function_decl != NULL_TREE);
if (!fn_context)
push_to_top_level ();
- else if (nested)
- push_function_context ();
+ else
+ {
+ if (nested)
+ push_function_context ();
+ cp_unevaluated_operand = 0;
+ c_inhibit_evaluation_warnings = 0;
+ }
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
@@ -19237,7 +19370,7 @@ instantiate_decl (tree d, int defer_ok,
}
for (; tmpl_parm; tmpl_parm = DECL_CHAIN (tmpl_parm))
{
- if (!FUNCTION_PARAMETER_PACK_P (tmpl_parm))
+ if (!DECL_PACK_P (tmpl_parm))
{
register_local_specialization (spec_parm, tmpl_parm);
spec_parm = DECL_CHAIN (spec_parm);
@@ -19280,6 +19413,8 @@ instantiate_decl (tree d, int defer_ok,
out:
input_location = saved_loc;
+ cp_unevaluated_operand = saved_unevaluated_operand;
+ c_inhibit_evaluation_warnings = saved_inhibit_evaluation_warnings;
pop_deferring_access_checks ();
pop_tinst_level ();
@@ -20444,7 +20579,7 @@ bool
any_type_dependent_elements_p (const_tree list)
{
for (; list; list = TREE_CHAIN (list))
- if (value_dependent_expression_p (TREE_VALUE (list)))
+ if (type_dependent_expression_p (TREE_VALUE (list)))
return true;
return false;
@@ -20910,7 +21045,7 @@ static tree
make_auto_1 (tree name)
{
tree au = cxx_make_type (TEMPLATE_TYPE_PARM);
- TYPE_NAME (au) = build_decl (BUILTINS_LOCATION,
+ TYPE_NAME (au) = build_decl (input_location,
TYPE_DECL, name, au);
TYPE_STUB_DECL (au) = TYPE_NAME (au);
TEMPLATE_TYPE_PARM_INDEX (au) = build_template_parm_index
@@ -21096,31 +21231,35 @@ is_auto (const_tree type)
return false;
}
-/* Returns true iff TYPE contains a use of 'auto'. Since auto can only
- appear as a type-specifier for the declaration in question, we don't
- have to look through the whole type. */
+/* Returns the TEMPLATE_TYPE_PARM in TYPE representing `auto' iff TYPE contains
+ a use of `auto'. Returns NULL_TREE otherwise. */
tree
type_uses_auto (tree type)
{
- enum tree_code code;
- if (is_auto (type))
- return type;
+ return find_type_usage (type, is_auto);
+}
- code = TREE_CODE (type);
+/* Returns true iff TYPE is a TEMPLATE_TYPE_PARM representing 'auto',
+ 'decltype(auto)' or a concept. */
- if (code == POINTER_TYPE || code == REFERENCE_TYPE
- || code == OFFSET_TYPE || code == FUNCTION_TYPE
- || code == METHOD_TYPE || code == ARRAY_TYPE)
- return type_uses_auto (TREE_TYPE (type));
+bool
+is_auto_or_concept (const_tree type)
+{
+ return is_auto (type); // or concept
+}
- if (TYPE_PTRMEMFUNC_P (type))
- return type_uses_auto (TREE_TYPE (TREE_TYPE
- (TYPE_PTRMEMFUNC_FN_TYPE (type))));
+/* Returns the TEMPLATE_TYPE_PARM in TYPE representing a generic type (`auto' or
+ a concept identifier) iff TYPE contains a use of a generic type. Returns
+ NULL_TREE otherwise. */
- return NULL_TREE;
+tree
+type_uses_auto_or_concept (tree type)
+{
+ return find_type_usage (type, is_auto_or_concept);
}
+
/* For a given template T, return the vector of typedefs referenced
in T for which access check is needed at T instantiation time.
T is either a FUNCTION_DECL or a RECORD_TYPE.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ee3503cdd77..13277948bf4 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1604,6 +1604,9 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
if (TREE_CODE (type) == REFERENCE_TYPE)
/* Quals on the object don't matter. */;
+ else if (PACK_EXPANSION_P (type))
+ /* Don't bother trying to represent this. */
+ type = NULL_TREE;
else
{
/* Set the cv qualifiers. */
@@ -2361,7 +2364,8 @@ finish_this_expr (void)
was of the form `OBJECT.SCOPE::~DESTRUCTOR'. */
tree
-finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
+finish_pseudo_destructor_expr (tree object, tree scope, tree destructor,
+ location_t loc)
{
if (object == error_mark_node || destructor == error_mark_node)
return error_mark_node;
@@ -2372,15 +2376,16 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
{
if (scope == error_mark_node)
{
- error ("invalid qualifying scope in pseudo-destructor name");
+ error_at (loc, "invalid qualifying scope in pseudo-destructor name");
return error_mark_node;
}
if (is_auto (destructor))
destructor = TREE_TYPE (object);
if (scope && TYPE_P (scope) && !check_dtor_name (scope, destructor))
{
- error ("qualified type %qT does not match destructor name ~%qT",
- scope, destructor);
+ error_at (loc,
+ "qualified type %qT does not match destructor name ~%qT",
+ scope, destructor);
return error_mark_node;
}
@@ -2401,12 +2406,13 @@ finish_pseudo_destructor_expr (tree object, tree scope, tree destructor)
if (!same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (object),
destructor))
{
- error ("%qE is not of type %qT", object, destructor);
+ error_at (loc, "%qE is not of type %qT", object, destructor);
return error_mark_node;
}
}
- return build3 (PSEUDO_DTOR_EXPR, void_type_node, object, scope, destructor);
+ return build3_loc (loc, PSEUDO_DTOR_EXPR, void_type_node, object,
+ scope, destructor);
}
/* Finish an expression of the form CODE EXPR. */
@@ -5193,7 +5199,9 @@ finish_transaction_stmt (tree stmt, tree compound_stmt, int flags, tree noex)
{
tree body = build_must_not_throw_expr (TRANSACTION_EXPR_BODY (stmt),
noex);
- SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
+ /* This may not be true when the STATEMENT_LIST is empty. */
+ if (EXPR_P (body))
+ SET_EXPR_LOCATION (body, EXPR_LOCATION (TRANSACTION_EXPR_BODY (stmt)));
TREE_SIDE_EFFECTS (body) = 1;
TRANSACTION_EXPR_BODY (stmt) = body;
}
diff --git a/gcc/cp/type-utils.h b/gcc/cp/type-utils.h
new file mode 100644
index 00000000000..2febce76075
--- /dev/null
+++ b/gcc/cp/type-utils.h
@@ -0,0 +1,55 @@
+/* Utilities for querying and manipulating type trees.
+ Copyright (C) 2013 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/>. */
+
+#ifndef GCC_CP_TYPE_UTILS_H
+#define GCC_CP_TYPE_UTILS_H
+
+/* Returns the first tree within T that is directly matched by PRED. T may be a
+ type or PARM_DECL and is incrementally decomposed toward its type-specifier
+ until a match is found. NULL_TREE is returned if PRED does not match any
+ part of T.
+
+ This is primarily intended for detecting whether T uses `auto' or a concept
+ identifier. Since either of these can only appear as a type-specifier for
+ the declaration in question, only top-level qualifications are traversed;
+ find_type_usage does not look through the whole type. */
+
+inline tree
+find_type_usage (tree t, bool (*pred) (const_tree))
+{
+ enum tree_code code;
+ if (pred (t))
+ return t;
+
+ code = TREE_CODE (t);
+
+ if (code == POINTER_TYPE || code == REFERENCE_TYPE
+ || code == PARM_DECL || code == OFFSET_TYPE
+ || code == FUNCTION_TYPE || code == METHOD_TYPE
+ || code == ARRAY_TYPE)
+ return find_type_usage (TREE_TYPE (t), pred);
+
+ if (TYPE_PTRMEMFUNC_P (t))
+ return find_type_usage
+ (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (t)), pred);
+
+ return NULL_TREE;
+}
+
+#endif // GCC_CP_TYPE_UTILS_H
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 6c48f242dd7..bcb87825a1e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4884,9 +4884,11 @@ cp_build_binary_op (location_t location,
if (build_type == NULL_TREE)
build_type = result_type;
- if ((flag_sanitize & SANITIZE_UNDEFINED)
+ if ((flag_sanitize & (SANITIZE_SHIFT | SANITIZE_DIVIDE))
&& !processing_template_decl
&& current_function_decl != 0
+ && !lookup_attribute ("no_sanitize_undefined",
+ DECL_ATTRIBUTES (current_function_decl))
&& (doing_div_or_mod || doing_shift))
{
/* OP0 and/or OP1 might have side-effects. */
@@ -4896,7 +4898,7 @@ cp_build_binary_op (location_t location,
tf_none));
op1 = maybe_constant_value (fold_non_dependent_expr_sfinae (op1,
tf_none));
- if (doing_div_or_mod)
+ if (doing_div_or_mod && (flag_sanitize & SANITIZE_DIVIDE))
{
/* For diagnostics we want to use the promoted types without
shorten_binary_op. So convert the arguments to the
@@ -4910,7 +4912,7 @@ cp_build_binary_op (location_t location,
}
instrument_expr = ubsan_instrument_division (location, cop0, cop1);
}
- else if (doing_shift)
+ else if (doing_shift && (flag_sanitize & SANITIZE_SHIFT))
instrument_expr = ubsan_instrument_shift (location, code, op0, op1);
}
@@ -4924,7 +4926,7 @@ cp_build_binary_op (location_t location,
&& !TREE_OVERFLOW_P (op1))
overflow_warning (location, result);
- if ((flag_sanitize & SANITIZE_UNDEFINED) && instrument_expr != NULL)
+ if (instrument_expr != NULL)
result = fold_build2 (COMPOUND_EXPR, TREE_TYPE (result),
instrument_expr, result);
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 3518fd839ce..358fca9171a 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -246,7 +246,8 @@ insert_set_in_table (rtx dest, rtx src, rtx insn, struct hash_table_d *table,
/* Record bitmap_index of the implicit set in implicit_set_indexes. */
if (implicit)
- implicit_set_indexes[BLOCK_FOR_INSN(insn)->index] = cur_expr->bitmap_index;
+ implicit_set_indexes[BLOCK_FOR_INSN (insn)->index]
+ = cur_expr->bitmap_index;
}
/* Determine whether the rtx X should be treated as a constant for CPROP.
@@ -1402,9 +1403,9 @@ find_implicit_sets (void)
implicit_sets[dest->index] = new_rtx;
if (dump_file)
{
- fprintf(dump_file, "Implicit set of reg %d in ",
- REGNO (XEXP (cond, 0)));
- fprintf(dump_file, "basic block %d\n", dest->index);
+ fprintf (dump_file, "Implicit set of reg %d in ",
+ REGNO (XEXP (cond, 0)));
+ fprintf (dump_file, "basic block %d\n", dest->index);
}
count++;
}
@@ -1934,12 +1935,12 @@ const pass_data pass_data_rtl_cprop =
class pass_rtl_cprop : public rtl_opt_pass
{
public:
- pass_rtl_cprop(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_cprop, ctxt)
+ pass_rtl_cprop (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_cprop, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_rtl_cprop (ctxt_); }
+ opt_pass * clone () { return new pass_rtl_cprop (m_ctxt); }
bool gate () { return gate_rtl_cprop (); }
unsigned int execute () { return execute_rtl_cprop (); }
diff --git a/gcc/cse.c b/gcc/cse.c
index b96af19f9e4..43fa1e8191f 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -468,7 +468,7 @@ struct table_elt
a cost of 2. Aside from these special cases, call `rtx_cost'. */
#define CHEAP_REGNO(N) \
- (REGNO_PTR_FRAME_P(N) \
+ (REGNO_PTR_FRAME_P (N) \
|| (HARD_REGISTER_NUM_P (N) \
&& FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS))
@@ -1354,6 +1354,11 @@ try_const_anchors (rtx src_const, enum machine_mode mode)
rtx lower_exp = NULL_RTX, upper_exp = NULL_RTX;
unsigned lower_old, upper_old;
+ /* CONST_INT is used for CC modes, but we should leave those alone. */
+ if (GET_MODE_CLASS (mode) == MODE_CC)
+ return NULL_RTX;
+
+ gcc_assert (SCALAR_INT_MODE_P (mode));
if (!compute_const_anchors (src_const, &lower_base, &lower_offs,
&upper_base, &upper_offs))
return NULL_RTX;
@@ -4834,7 +4839,7 @@ cse_insn (rtx insn)
/* Set what we are trying to extend and the operation it might
have been extended with. */
- memset (memory_extend_rtx, 0, sizeof(*memory_extend_rtx));
+ memset (memory_extend_rtx, 0, sizeof (*memory_extend_rtx));
PUT_CODE (memory_extend_rtx, LOAD_EXTEND_OP (mode));
XEXP (memory_extend_rtx, 0) = src;
@@ -6063,9 +6068,12 @@ cse_process_notes_1 (rtx x, rtx object, bool *changed)
return x;
case EXPR_LIST:
- case INSN_LIST:
if (REG_NOTE_KIND (x) == REG_EQUAL)
XEXP (x, 0) = cse_process_notes (XEXP (x, 0), NULL_RTX, changed);
+ /* Fall through. */
+
+ case INSN_LIST:
+ case INT_LIST:
if (XEXP (x, 1))
XEXP (x, 1) = cse_process_notes (XEXP (x, 1), NULL_RTX, changed);
return x;
@@ -6731,6 +6739,7 @@ count_reg_usage (rtx x, int *counts, rtx dest, int incr)
return;
case INSN_LIST:
+ case INT_LIST:
gcc_unreachable ();
default:
@@ -7470,8 +7479,8 @@ const pass_data pass_data_cse =
class pass_cse : public rtl_opt_pass
{
public:
- pass_cse(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_cse, ctxt)
+ pass_cse (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_cse, ctxt)
{}
/* opt_pass methods: */
@@ -7550,8 +7559,8 @@ const pass_data pass_data_cse2 =
class pass_cse2 : public rtl_opt_pass
{
public:
- pass_cse2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_cse2, ctxt)
+ pass_cse2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_cse2, ctxt)
{}
/* opt_pass methods: */
@@ -7628,8 +7637,8 @@ const pass_data pass_data_cse_after_global_opts =
class pass_cse_after_global_opts : public rtl_opt_pass
{
public:
- pass_cse_after_global_opts(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_cse_after_global_opts, ctxt)
+ pass_cse_after_global_opts (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_cse_after_global_opts, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/cselib.c b/gcc/cselib.c
index c3431af1246..e201f5e7c49 100644
--- a/gcc/cselib.c
+++ b/gcc/cselib.c
@@ -259,10 +259,10 @@ void (*cselib_record_sets_hook) (rtx insn, struct cselib_set *sets,
int n_sets);
#define PRESERVED_VALUE_P(RTX) \
- (RTL_FLAG_CHECK1("PRESERVED_VALUE_P", (RTX), VALUE)->unchanging)
+ (RTL_FLAG_CHECK1 ("PRESERVED_VALUE_P", (RTX), VALUE)->unchanging)
#define SP_BASED_VALUE_P(RTX) \
- (RTL_FLAG_CHECK1("SP_BASED_VALUE_P", (RTX), VALUE)->jump)
+ (RTL_FLAG_CHECK1 ("SP_BASED_VALUE_P", (RTX), VALUE)->jump)
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 1cc5d524205..9b5e23f6d71 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -636,7 +636,7 @@ dbxout_begin_complex_stabs_noforcetext (void)
#define stabstr_C(chr) obstack_1grow (&stabstr_ob, chr)
/* Add STR, a normal C string, to the string being built. */
-#define stabstr_S(str) obstack_grow (&stabstr_ob, str, strlen(str))
+#define stabstr_S(str) obstack_grow (&stabstr_ob, str, strlen (str))
/* Add the text of ID, an IDENTIFIER_NODE, to the string being built. */
#define stabstr_I(id) obstack_grow (&stabstr_ob, \
@@ -2434,7 +2434,7 @@ dbxout_class_name_qualifiers (tree decl)
tree context = decl_type_context (decl);
if (context != NULL_TREE
- && TREE_CODE(context) == RECORD_TYPE
+ && TREE_CODE (context) == RECORD_TYPE
&& TYPE_NAME (context) != 0
&& (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE
|| (DECL_NAME (TYPE_NAME (context)) != 0)))
@@ -3302,8 +3302,8 @@ dbxout_common_check (tree decl, int *value)
for thread-local symbols. Can be handled via same mechanism as used
in dwarf2out.c. */
if (TREE_CODE (decl) != VAR_DECL
- || !TREE_STATIC(decl)
- || !DECL_HAS_VALUE_EXPR_P(decl)
+ || !TREE_STATIC (decl)
+ || !DECL_HAS_VALUE_EXPR_P (decl)
|| DECL_THREAD_LOCAL_P (decl)
|| !is_fortran ())
return NULL;
@@ -3337,21 +3337,21 @@ dbxout_common_check (tree decl, int *value)
if (CONST_INT_P (XEXP (sym_addr, 0)))
{
name =
- targetm.strip_name_encoding(XSTR (XEXP (sym_addr, 1), 0));
+ targetm.strip_name_encoding (XSTR (XEXP (sym_addr, 1), 0));
*value = INTVAL (XEXP (sym_addr, 0));
cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 1));
}
else
{
name =
- targetm.strip_name_encoding(XSTR (XEXP (sym_addr, 0), 0));
+ targetm.strip_name_encoding (XSTR (XEXP (sym_addr, 0), 0));
*value = INTVAL (XEXP (sym_addr, 1));
cdecl = SYMBOL_REF_DECL (XEXP (sym_addr, 0));
}
break;
case SYMBOL_REF:
- name = targetm.strip_name_encoding(XSTR (sym_addr, 0));
+ name = targetm.strip_name_encoding (XSTR (sym_addr, 0));
*value = 0;
cdecl = SYMBOL_REF_DECL (sym_addr);
break;
@@ -3364,7 +3364,7 @@ dbxout_common_check (tree decl, int *value)
/* Check area common symbol is offset into. If this is not public, then
it is not a symbol in a common block. It must be a .lcomm symbol, not
a .comm symbol. */
- if (cdecl == NULL || !TREE_PUBLIC(cdecl))
+ if (cdecl == NULL || !TREE_PUBLIC (cdecl))
name = NULL;
}
else
diff --git a/gcc/dce.c b/gcc/dce.c
index fa22316b5cc..5c11cbeef0d 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -806,8 +806,8 @@ const pass_data pass_data_ud_rtl_dce =
class pass_ud_rtl_dce : public rtl_opt_pass
{
public:
- pass_ud_rtl_dce(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_ud_rtl_dce, ctxt)
+ pass_ud_rtl_dce (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_ud_rtl_dce, ctxt)
{}
/* opt_pass methods: */
@@ -1239,8 +1239,8 @@ const pass_data pass_data_fast_rtl_dce =
class pass_fast_rtl_dce : public rtl_opt_pass
{
public:
- pass_fast_rtl_dce(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_fast_rtl_dce, ctxt)
+ pass_fast_rtl_dce (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_fast_rtl_dce, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/defaults.h b/gcc/defaults.h
index 3fa105d113d..37e8a08ac5a 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -76,7 +76,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
int c = p[i]; \
if (c == '\"' || c == '\\') \
putc ('\\', asm_out_file); \
- if (ISPRINT(c)) \
+ if (ISPRINT (c)) \
putc (c, asm_out_file); \
else \
{ \
@@ -86,7 +86,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
The VAX assembler fails to stop reading the escape \
after three digits, so this is the only way we \
can get it to parse the data properly. */ \
- if (i < thissize - 1 && ISDIGIT(p[i + 1])) \
+ if (i < thissize - 1 && ISDIGIT (p[i + 1])) \
fprintf (asm_out_file, "\"\n\t.ascii \""); \
} \
} \
@@ -351,7 +351,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* If we have named sections, and we're using crtstuff to run ctors,
use them for registering eh frame information. */
#if defined (TARGET_ASM_NAMED_SECTION) && DWARF2_UNWIND_INFO \
- && !defined(EH_FRAME_IN_DATA_SECTION)
+ && !defined (EH_FRAME_IN_DATA_SECTION)
#ifndef EH_FRAME_SECTION_NAME
#define EH_FRAME_SECTION_NAME ".eh_frame"
#endif
@@ -1278,7 +1278,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
SET_RATIO or more simple move-instruction sequences, we will do a movmem
or libcall instead. */
#ifndef SET_RATIO
-#define SET_RATIO(speed) MOVE_RATIO(speed)
+#define SET_RATIO(speed) MOVE_RATIO (speed)
#endif
/* Supply a default definition for FUNCTION_ARG_PADDING:
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 95df1c1b056..deea7551053 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -549,7 +549,7 @@ df_set_blocks (bitmap blocks)
{
basic_block bb;
bitmap_initialize (&blocks_to_reset, &df_bitmap_obstack);
- FOR_ALL_BB(bb)
+ FOR_ALL_BB (bb)
{
bitmap_set_bit (&blocks_to_reset, bb->index);
}
@@ -766,8 +766,8 @@ const pass_data pass_data_df_initialize_opt =
class pass_df_initialize_opt : public rtl_opt_pass
{
public:
- pass_df_initialize_opt(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_df_initialize_opt, ctxt)
+ pass_df_initialize_opt (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_df_initialize_opt, ctxt)
{}
/* opt_pass methods: */
@@ -812,8 +812,8 @@ const pass_data pass_data_df_initialize_no_opt =
class pass_df_initialize_no_opt : public rtl_opt_pass
{
public:
- pass_df_initialize_no_opt(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_df_initialize_no_opt, ctxt)
+ pass_df_initialize_no_opt (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_df_initialize_no_opt, ctxt)
{}
/* opt_pass methods: */
@@ -878,8 +878,8 @@ const pass_data pass_data_df_finish =
class pass_df_finish : public rtl_opt_pass
{
public:
- pass_df_finish(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_df_finish, ctxt)
+ pass_df_finish (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_df_finish, ctxt)
{}
/* opt_pass methods: */
@@ -2078,7 +2078,7 @@ df_dump_start (FILE *file)
{
df_dump_problem_function fun = dflow->problem->dump_start_fun;
if (fun)
- fun(file);
+ fun (file);
}
}
}
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index e647b5ad0a0..59fc2f64444 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -326,7 +326,7 @@ df_rd_bb_local_compute_process_def (struct df_rd_bb_info *bb_info,
if (n_defs > DF_SPARSE_THRESHOLD)
{
bitmap_set_bit (&bb_info->sparse_kill, regno);
- bitmap_clear_range(&bb_info->gen, begin, n_defs);
+ bitmap_clear_range (&bb_info->gen, begin, n_defs);
}
else
{
@@ -594,7 +594,7 @@ df_rd_start_dump (FILE *file)
{
struct df_rd_problem_data *problem_data
= (struct df_rd_problem_data *) df_rd->problem_data;
- unsigned int m = DF_REG_SIZE(df);
+ unsigned int m = DF_REG_SIZE (df);
unsigned int regno;
if (!df_rd->block_info)
@@ -622,7 +622,7 @@ df_rd_dump_defs_set (bitmap defs_set, const char *prefix, FILE *file)
{
bitmap_head tmp;
unsigned int regno;
- unsigned int m = DF_REG_SIZE(df);
+ unsigned int m = DF_REG_SIZE (df);
bool first_reg = true;
fprintf (file, "%s\t(%d) ", prefix, (int) bitmap_count_bits (defs_set));
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 3a8e9ca7ec4..f2e8ab27136 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -191,9 +191,9 @@ df_scan_free_internal (void)
/* The vectors that hold the refs are not pool allocated because
they come in many sizes. This makes them impossible to delete
all at once. */
- for (i = 0; i < DF_INSN_SIZE(); i++)
+ for (i = 0; i < DF_INSN_SIZE (); i++)
{
- struct df_insn_info *insn_info = DF_INSN_UID_GET(i);
+ struct df_insn_info *insn_info = DF_INSN_UID_GET (i);
/* Skip the insns that have no insn_info or have been
deleted. */
if (insn_info)
@@ -233,7 +233,7 @@ df_scan_free_internal (void)
free (df->eq_use_regs);
df->eq_use_regs = NULL;
df->regs_size = 0;
- DF_REG_SIZE(df) = 0;
+ DF_REG_SIZE (df) = 0;
free (df->insns);
df->insns = NULL;
@@ -2188,7 +2188,7 @@ df_notes_rescan (rtx insn)
df_grow_bb_info (df_scan);
df_grow_reg_info ();
- insn_info = DF_INSN_UID_SAFE_GET (INSN_UID(insn));
+ insn_info = DF_INSN_UID_SAFE_GET (INSN_UID (insn));
/* The client has deferred rescanning. */
if (df->changeable_flags & DF_DEFER_INSN_RESCAN)
@@ -4558,11 +4558,11 @@ df_scan_verify (void)
for (i = 0; i < DF_REG_SIZE (df); i++)
{
gcc_assert (df_reg_chain_mark (DF_REG_DEF_CHAIN (i), i, true, false)
- == DF_REG_DEF_COUNT(i));
+ == DF_REG_DEF_COUNT (i));
gcc_assert (df_reg_chain_mark (DF_REG_USE_CHAIN (i), i, false, false)
- == DF_REG_USE_COUNT(i));
+ == DF_REG_USE_COUNT (i));
gcc_assert (df_reg_chain_mark (DF_REG_EQ_USE_CHAIN (i), i, false, true)
- == DF_REG_EQ_USE_COUNT(i));
+ == DF_REG_EQ_USE_COUNT (i));
}
/* (2) There are various bitmaps whose value may change over the
diff --git a/gcc/df.h b/gcc/df.h
index 716ce0c8d72..e3ca67b6841 100644
--- a/gcc/df.h
+++ b/gcc/df.h
@@ -607,29 +607,29 @@ struct df_d
bool redo_entry_and_exit;
};
-#define DF_SCAN_BB_INFO(BB) (df_scan_get_bb_info((BB)->index))
-#define DF_RD_BB_INFO(BB) (df_rd_get_bb_info((BB)->index))
-#define DF_LR_BB_INFO(BB) (df_lr_get_bb_info((BB)->index))
-#define DF_LIVE_BB_INFO(BB) (df_live_get_bb_info((BB)->index))
-#define DF_WORD_LR_BB_INFO(BB) (df_word_lr_get_bb_info((BB)->index))
-#define DF_MD_BB_INFO(BB) (df_md_get_bb_info((BB)->index))
+#define DF_SCAN_BB_INFO(BB) (df_scan_get_bb_info ((BB)->index))
+#define DF_RD_BB_INFO(BB) (df_rd_get_bb_info ((BB)->index))
+#define DF_LR_BB_INFO(BB) (df_lr_get_bb_info ((BB)->index))
+#define DF_LIVE_BB_INFO(BB) (df_live_get_bb_info ((BB)->index))
+#define DF_WORD_LR_BB_INFO(BB) (df_word_lr_get_bb_info ((BB)->index))
+#define DF_MD_BB_INFO(BB) (df_md_get_bb_info ((BB)->index))
/* Most transformations that wish to use live register analysis will
use these macros. This info is the and of the lr and live sets. */
-#define DF_LIVE_IN(BB) (&DF_LIVE_BB_INFO(BB)->in)
-#define DF_LIVE_OUT(BB) (&DF_LIVE_BB_INFO(BB)->out)
+#define DF_LIVE_IN(BB) (&DF_LIVE_BB_INFO (BB)->in)
+#define DF_LIVE_OUT(BB) (&DF_LIVE_BB_INFO (BB)->out)
/* These macros are used by passes that are not tolerant of
uninitialized variables. This intolerance should eventually
be fixed. */
-#define DF_LR_IN(BB) (&DF_LR_BB_INFO(BB)->in)
-#define DF_LR_OUT(BB) (&DF_LR_BB_INFO(BB)->out)
+#define DF_LR_IN(BB) (&DF_LR_BB_INFO (BB)->in)
+#define DF_LR_OUT(BB) (&DF_LR_BB_INFO (BB)->out)
/* These macros are used by passes that are not tolerant of
uninitialized variables. This intolerance should eventually
be fixed. */
-#define DF_WORD_LR_IN(BB) (&DF_WORD_LR_BB_INFO(BB)->in)
-#define DF_WORD_LR_OUT(BB) (&DF_WORD_LR_BB_INFO(BB)->out)
+#define DF_WORD_LR_IN(BB) (&DF_WORD_LR_BB_INFO (BB)->in)
+#define DF_WORD_LR_OUT(BB) (&DF_WORD_LR_BB_INFO (BB)->out)
/* Macros to access the elements within the ref structure. */
@@ -640,10 +640,11 @@ struct df_d
#define DF_REF_REAL_LOC(REF) (GET_CODE (*((REF)->regular_ref.loc)) == SUBREG \
? &SUBREG_REG (*((REF)->regular_ref.loc)) : ((REF)->regular_ref.loc))
#define DF_REF_REG(REF) ((REF)->base.reg)
-#define DF_REF_LOC(REF) (DF_REF_CLASS(REF) == DF_REF_REGULAR ? \
+#define DF_REF_LOC(REF) (DF_REF_CLASS (REF) == DF_REF_REGULAR ? \
(REF)->regular_ref.loc : NULL)
-#define DF_REF_BB(REF) (DF_REF_IS_ARTIFICIAL(REF) ? \
- (REF)->artificial_ref.bb : BLOCK_FOR_INSN (DF_REF_INSN(REF)))
+#define DF_REF_BB(REF) (DF_REF_IS_ARTIFICIAL (REF) \
+ ? (REF)->artificial_ref.bb \
+ : BLOCK_FOR_INSN (DF_REF_INSN (REF)))
#define DF_REF_BBNO(REF) (DF_REF_BB (REF)->index)
#define DF_REF_INSN_INFO(REF) ((REF)->base.insn_info)
#define DF_REF_INSN(REF) ((REF)->base.insn_info->insn)
@@ -660,7 +661,7 @@ struct df_d
/* If DF_REF_IS_ARTIFICIAL () is true, this is not a real
definition/use, but an artificial one created to model always live
registers, eh uses, etc. */
-#define DF_REF_IS_ARTIFICIAL(REF) (DF_REF_CLASS(REF) == DF_REF_ARTIFICIAL)
+#define DF_REF_IS_ARTIFICIAL(REF) (DF_REF_CLASS (REF) == DF_REF_ARTIFICIAL)
#define DF_REF_REG_MARK(REF) (DF_REF_FLAGS_SET ((REF),DF_REF_REG_MARKER))
#define DF_REF_REG_UNMARK(REF) (DF_REF_FLAGS_CLEAR ((REF),DF_REF_REG_MARKER))
#define DF_REF_IS_REG_MARKED(REF) (DF_REF_FLAGS_IS_SET ((REF),DF_REF_REG_MARKER))
@@ -722,35 +723,35 @@ struct df_d
/* Macros to access the elements within the reg_info structure table. */
#define DF_REGNO_FIRST_DEF(REGNUM) \
-(DF_REG_DEF_GET(REGNUM) ? DF_REG_DEF_GET(REGNUM) : 0)
+(DF_REG_DEF_GET(REGNUM) ? DF_REG_DEF_GET (REGNUM) : 0)
#define DF_REGNO_LAST_USE(REGNUM) \
-(DF_REG_USE_GET(REGNUM) ? DF_REG_USE_GET(REGNUM) : 0)
+(DF_REG_USE_GET(REGNUM) ? DF_REG_USE_GET (REGNUM) : 0)
/* Macros to access the elements within the insn_info structure table. */
#define DF_INSN_SIZE() ((df)->insns_size)
-#define DF_INSN_INFO_GET(INSN) (df->insns[(INSN_UID(INSN))])
+#define DF_INSN_INFO_GET(INSN) (df->insns[(INSN_UID (INSN))])
#define DF_INSN_INFO_SET(INSN,VAL) (df->insns[(INSN_UID (INSN))]=(VAL))
#define DF_INSN_INFO_LUID(II) ((II)->luid)
#define DF_INSN_INFO_DEFS(II) ((II)->defs)
#define DF_INSN_INFO_USES(II) ((II)->uses)
#define DF_INSN_INFO_EQ_USES(II) ((II)->eq_uses)
-#define DF_INSN_LUID(INSN) (DF_INSN_INFO_LUID (DF_INSN_INFO_GET(INSN)))
-#define DF_INSN_DEFS(INSN) (DF_INSN_INFO_DEFS (DF_INSN_INFO_GET(INSN)))
-#define DF_INSN_USES(INSN) (DF_INSN_INFO_USES (DF_INSN_INFO_GET(INSN)))
-#define DF_INSN_EQ_USES(INSN) (DF_INSN_INFO_EQ_USES (DF_INSN_INFO_GET(INSN)))
+#define DF_INSN_LUID(INSN) (DF_INSN_INFO_LUID (DF_INSN_INFO_GET (INSN)))
+#define DF_INSN_DEFS(INSN) (DF_INSN_INFO_DEFS (DF_INSN_INFO_GET (INSN)))
+#define DF_INSN_USES(INSN) (DF_INSN_INFO_USES (DF_INSN_INFO_GET (INSN)))
+#define DF_INSN_EQ_USES(INSN) (DF_INSN_INFO_EQ_USES (DF_INSN_INFO_GET (INSN)))
#define DF_INSN_UID_GET(UID) (df->insns[(UID)])
#define DF_INSN_UID_SET(UID,VAL) (df->insns[(UID)]=(VAL))
-#define DF_INSN_UID_SAFE_GET(UID) (((unsigned)(UID) < DF_INSN_SIZE()) \
+#define DF_INSN_UID_SAFE_GET(UID) (((unsigned)(UID) < DF_INSN_SIZE ()) \
? DF_INSN_UID_GET (UID) \
: NULL)
-#define DF_INSN_UID_LUID(INSN) (DF_INSN_UID_GET(INSN)->luid)
-#define DF_INSN_UID_DEFS(INSN) (DF_INSN_UID_GET(INSN)->defs)
-#define DF_INSN_UID_USES(INSN) (DF_INSN_UID_GET(INSN)->uses)
-#define DF_INSN_UID_EQ_USES(INSN) (DF_INSN_UID_GET(INSN)->eq_uses)
-#define DF_INSN_UID_MWS(INSN) (DF_INSN_UID_GET(INSN)->mw_hardregs)
+#define DF_INSN_UID_LUID(INSN) (DF_INSN_UID_GET (INSN)->luid)
+#define DF_INSN_UID_DEFS(INSN) (DF_INSN_UID_GET (INSN)->defs)
+#define DF_INSN_UID_USES(INSN) (DF_INSN_UID_GET (INSN)->uses)
+#define DF_INSN_UID_EQ_USES(INSN) (DF_INSN_UID_GET (INSN)->eq_uses)
+#define DF_INSN_UID_MWS(INSN) (DF_INSN_UID_GET (INSN)->mw_hardregs)
/* An obstack for bitmap not related to specific dataflow problems.
This obstack should e.g. be used for bitmaps with a short life time
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 295bbb6e045..36094a19c9a 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -267,7 +267,7 @@ adjust_line (const char *line, int max_width, int *column_p)
int line_width = strlen (line);
int column = *column_p;
- right_margin = MIN(line_width - column, right_margin);
+ right_margin = MIN (line_width - column, right_margin);
right_margin = max_width - right_margin;
if (line_width >= max_width && column > right_margin)
{
@@ -354,7 +354,7 @@ bt_callback (void *data, uintptr_t pc, const char *filename, int lineno,
/* Skip functions in diagnostic.c. */
if (*pcount == 0
&& filename != NULL
- && strcmp (lbasename(filename), "diagnostic.c") == 0)
+ && strcmp (lbasename (filename), "diagnostic.c") == 0)
return 0;
/* Print up to 20 functions. We could make this a --param, but
@@ -881,7 +881,7 @@ diagnostic_append_note (diagnostic_context *context,
pp_destroy_prefix (context->printer);
pp_set_prefix (context->printer, saved_prefix);
diagnostic_show_locus (context, &diagnostic);
- va_end(ap);
+ va_end (ap);
}
bool
diff --git a/gcc/doc/contrib.texi b/gcc/doc/contrib.texi
index 5577c04f011..9dd2c26287c 100644
--- a/gcc/doc/contrib.texi
+++ b/gcc/doc/contrib.texi
@@ -176,7 +176,7 @@ The @uref{http://www.gnu.org/software/classpath/,,GNU Classpath project}
for all of their merged runtime code.
@item
-Nick Clifton for arm, mcore, fr30, v850, m32r, rx work,
+Nick Clifton for arm, mcore, fr30, v850, m32r, msp430 rx work,
@option{--help}, and other random hacking.
@item
@@ -218,7 +218,7 @@ Mo DeJong for GCJ and libgcj bug fixes.
@item
DJ Delorie for the DJGPP port, build and libiberty maintenance,
-various bug fixes, and the M32C, MeP, and RL78 ports.
+various bug fixes, and the M32C, MeP, MSP430, and RL78 ports.
@item
Arnaud Desitter for helping to debug GNU Fortran.
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 151b7e9d56a..edf0e2851bc 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -30,7 +30,7 @@ extensions, accepted by GCC in C90 mode and in C++.
* Constructing Calls:: Dispatching a call to another function.
* Typeof:: @code{typeof}: referring to the type of an expression.
* Conditionals:: Omitting the middle operand of a @samp{?:} expression.
-* __int128:: 128-bit integers---@code{__int128}.
+* __int128:: 128-bit integers---@code{__int128}.
* Long Long:: Double-word integers---@code{long long int}.
* Complex:: Data types for complex numbers.
* Floating Types:: Additional Floating Types.
@@ -2136,6 +2136,7 @@ attributes are currently defined for functions on all targets:
@code{warn_unused_result}, @code{nonnull}, @code{gnu_inline},
@code{externally_visible}, @code{hot}, @code{cold}, @code{artificial},
@code{no_sanitize_address}, @code{no_address_safety_analysis},
+@code{no_sanitize_undefined},
@code{error} and @code{warning}.
Several other attributes are defined for functions on particular
target systems. Other attributes, including @code{section} are
@@ -2813,7 +2814,7 @@ least version 2.20.1), and GNU C library (at least version 2.11.1).
@item interrupt
@cindex interrupt handler functions
Use this attribute on the ARM, AVR, CR16, Epiphany, M32C, M32R/D, m68k, MeP, MIPS,
-RL78, RX and Xstormy16 ports to indicate that the specified function is an
+MSP430, RL78, RX and Xstormy16 ports to indicate that the specified function is an
interrupt handler. The compiler generates function entry and exit
sequences suitable for use in an interrupt handler when this attribute
is present. With Epiphany targets it may also generate a special section with
@@ -2844,6 +2845,35 @@ Permissible values for this parameter are: @code{IRQ}, @code{FIQ},
On ARMv7-M the interrupt type is ignored, and the attribute means the function
may be called with a word-aligned stack pointer.
+Note, for the MSP430 you can provide an argument to the interrupt
+attribute which specifies a name or number. If the argument is a
+number it indicates the slot in the interrupt vector table (0 - 31) to
+which this handler should be assigned. If the argument is a name it
+is treated as a symbolic name for the vector slot. These names should
+match up with appropriate entries in the linker script. By default
+the names @code{watchdog} for vector 26, @code{nmi} for vector 30 and
+@code{reset} for vector 31 are recognised.
+
+You can also use the following function attributes to modify how
+normal functions interact with interrupt functions:
+
+@table @code
+@item critical
+@cindex @code{critical} attribute
+Critical functions disable interrupts upon entry and restore the
+previous interrupt state upon exit. Critical functions cannot also
+have the @code{naked} or @code{reentrant} attributes. They can have
+the @code{interrupt} attribute.
+
+@item reentrant
+@cindex @code{reentrant} attribute
+Reentrant functions disable interrupts upon entry and enable them
+upon exit. Reentrant functions cannot also have the @code{naked}
+or @code{critical} attributes. They can have the @code{interrupt}
+attribute.
+
+@end table
+
On Epiphany targets one or more optional parameters can be added like this:
@smallexample
@@ -3143,7 +3173,7 @@ and newer.
@item naked
@cindex function without a prologue/epilogue code
-Use this attribute on the ARM, AVR, MCORE, RL78, RX and SPU ports to indicate that
+Use this attribute on the ARM, AVR, MCORE, MSP430, RL78, RX and SPU ports to indicate that
the specified function does not need prologue/epilogue sequences generated by
the compiler. It is up to the programmer to provide these sequences. The
only statements that can be safely included in naked functions are
@@ -3471,6 +3501,12 @@ The @code{no_address_safety_analysis} is a deprecated alias of the
@code{no_sanitize_address} attribute, new code should use
@code{no_sanitize_address}.
+@item no_sanitize_undefined
+@cindex @code{no_sanitize_undefined} function attribute
+The @code{no_sanitize_undefined} attribute on functions is used
+to inform the compiler that it should not check for undefined behavior
+in the function when compiling with the @option{-fsanitize=undefined} option.
+
@item regparm (@var{number})
@cindex @code{regparm} attribute
@cindex functions that are passed arguments in registers on the 386
@@ -4855,8 +4891,9 @@ to be possibly unused. GCC does not produce a warning for this
variable.
@item used
-This attribute, attached to a variable, means that the variable must be
-emitted even if it appears that the variable is not referenced.
+This attribute, attached to a variable with the static storage, means that
+the variable must be emitted even if it appears that the variable is not
+referenced.
When applied to a static data member of a C++ class template, the
attribute also means that the member is instantiated if the
@@ -8844,6 +8881,7 @@ instructions, but allow the compiler to schedule those calls.
* MIPS Paired-Single Support::
* MIPS Loongson Built-in Functions::
* Other MIPS Built-in Functions::
+* MSP430 Built-in Functions::
* picoChip Built-in Functions::
* PowerPC Built-in Functions::
* PowerPC AltiVec/VSX Built-in Functions::
@@ -10204,8 +10242,7 @@ void __builtin_ia32_mwait (unsigned int, unsigned int)
@end smallexample
The following built-in functions are available when @option{-mssse3} is used.
-All of them generate the machine instruction that is part of the name
-with MMX registers.
+All of them generate the machine instruction that is part of the name.
@smallexample
v2si __builtin_ia32_phaddd (v2si, v2si)
@@ -10227,8 +10264,7 @@ v4hi __builtin_ia32_pabsw (v4hi)
@end smallexample
The following built-in functions are available when @option{-mssse3} is used.
-All of them generate the machine instruction that is part of the name
-with SSE registers.
+All of them generate the machine instruction that is part of the name.
@smallexample
v4si __builtin_ia32_phaddd128 (v4si, v4si)
@@ -10876,42 +10912,41 @@ v8hi __builtin_ia32_vpshlw (v8hi, v8hi)
@end smallexample
The following built-in functions are available when @option{-mfma4} is used.
-All of them generate the machine instruction that is part of the name
-with MMX registers.
-
-@smallexample
-v2df __builtin_ia32_fmaddpd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fmaddps (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fmaddsd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fmaddss (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fmsubpd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fmsubps (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fmsubsd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fmsubss (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fnmaddpd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fnmaddps (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fnmaddsd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fnmaddss (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fnmsubpd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fnmsubps (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fnmsubsd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fnmsubss (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fmaddsubpd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fmaddsubps (v4sf, v4sf, v4sf)
-v2df __builtin_ia32_fmsubaddpd (v2df, v2df, v2df)
-v4sf __builtin_ia32_fmsubaddps (v4sf, v4sf, v4sf)
-v4df __builtin_ia32_fmaddpd256 (v4df, v4df, v4df)
-v8sf __builtin_ia32_fmaddps256 (v8sf, v8sf, v8sf)
-v4df __builtin_ia32_fmsubpd256 (v4df, v4df, v4df)
-v8sf __builtin_ia32_fmsubps256 (v8sf, v8sf, v8sf)
-v4df __builtin_ia32_fnmaddpd256 (v4df, v4df, v4df)
-v8sf __builtin_ia32_fnmaddps256 (v8sf, v8sf, v8sf)
-v4df __builtin_ia32_fnmsubpd256 (v4df, v4df, v4df)
-v8sf __builtin_ia32_fnmsubps256 (v8sf, v8sf, v8sf)
-v4df __builtin_ia32_fmaddsubpd256 (v4df, v4df, v4df)
-v8sf __builtin_ia32_fmaddsubps256 (v8sf, v8sf, v8sf)
-v4df __builtin_ia32_fmsubaddpd256 (v4df, v4df, v4df)
-v8sf __builtin_ia32_fmsubaddps256 (v8sf, v8sf, v8sf)
+All of them generate the machine instruction that is part of the name.
+
+@smallexample
+v2df __builtin_ia32_vfmaddpd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfmaddps (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfmaddsd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfmaddss (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfmsubpd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfmsubps (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfmsubsd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfmsubss (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfnmaddpd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfnmaddps (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfnmaddsd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfnmaddss (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfnmsubpd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfnmsubps (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfnmsubsd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfnmsubss (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfmaddsubpd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfmaddsubps (v4sf, v4sf, v4sf)
+v2df __builtin_ia32_vfmsubaddpd (v2df, v2df, v2df)
+v4sf __builtin_ia32_vfmsubaddps (v4sf, v4sf, v4sf)
+v4df __builtin_ia32_vfmaddpd256 (v4df, v4df, v4df)
+v8sf __builtin_ia32_vfmaddps256 (v8sf, v8sf, v8sf)
+v4df __builtin_ia32_vfmsubpd256 (v4df, v4df, v4df)
+v8sf __builtin_ia32_vfmsubps256 (v8sf, v8sf, v8sf)
+v4df __builtin_ia32_vfnmaddpd256 (v4df, v4df, v4df)
+v8sf __builtin_ia32_vfnmaddps256 (v8sf, v8sf, v8sf)
+v4df __builtin_ia32_vfnmsubpd256 (v4df, v4df, v4df)
+v8sf __builtin_ia32_vfnmsubps256 (v8sf, v8sf, v8sf)
+v4df __builtin_ia32_vfmaddsubpd256 (v4df, v4df, v4df)
+v8sf __builtin_ia32_vfmaddsubps256 (v8sf, v8sf, v8sf)
+v4df __builtin_ia32_vfmsubaddpd256 (v4df, v4df, v4df)
+v8sf __builtin_ia32_vfmsubaddps256 (v8sf, v8sf, v8sf)
@end smallexample
@@ -10958,6 +10993,31 @@ unsigned int __builtin_ia32_lzcnt_u32(unsigned int);
unsigned long long __builtin_ia32_lzcnt_u64 (unsigned long long);
@end smallexample
+The following built-in functions are available when @option{-mfxsr} is used.
+All of them generate the machine instruction that is part of the name.
+@smallexample
+void __builtin_ia32_fxsave (void *)
+void __builtin_ia32_fxrstor (void *)
+void __builtin_ia32_fxsave64 (void *)
+void __builtin_ia32_fxrstor64 (void *)
+@end smallexample
+
+The following built-in functions are available when @option{-mxsave} is used.
+All of them generate the machine instruction that is part of the name.
+@smallexample
+void __builtin_ia32_xsave (void *, long long)
+void __builtin_ia32_xrstor (void *, long long)
+void __builtin_ia32_xsave64 (void *, long long)
+void __builtin_ia32_xrstor64 (void *, long long)
+@end smallexample
+
+The following built-in functions are available when @option{-mxsaveopt} is used.
+All of them generate the machine instruction that is part of the name.
+@smallexample
+void __builtin_ia32_xsaveopt (void *, long long)
+void __builtin_ia32_xsaveopt64 (void *, long long)
+@end smallexample
+
The following built-in functions are available when @option{-mtbm} is used.
Both of them generate the immediate form of the bextr machine instruction.
@smallexample
@@ -11831,6 +11891,26 @@ GCC defines the preprocessor macro @code{___GCC_HAVE_BUILTIN_MIPS_CACHE}
when this function is available.
@end table
+@node MSP430 Built-in Functions
+@subsection MSP430 Built-in Functions
+
+GCC provides a couple of special builtin functions to aid in the
+writing of interrupt handlers in C.
+
+@table @code
+@item __bic_SR_register_on_exit (int @var{mask})
+This clears the indicated bits in the saved copy of the status register
+currently residing on the stack. This only works inside interrupt
+handlers and the changes to the status register will only take affect
+once the handler returns.
+
+@item __bis_SR_register_on_exit (int @var{mask})
+This sets the indicated bits in the saved copy of the status register
+currently residing on the stack. This only works inside interrupt
+handlers and the changes to the status register will only take affect
+once the handler returns.
+@end table
+
@node picoChip Built-in Functions
@subsection picoChip Built-in Functions
diff --git a/gcc/doc/implement-cxx.texi b/gcc/doc/implement-cxx.texi
index e9236cab6f4..43a8a597ab6 100644
--- a/gcc/doc/implement-cxx.texi
+++ b/gcc/doc/implement-cxx.texi
@@ -9,8 +9,8 @@
A conforming implementation of ISO C++ is required to document its
choice of behavior in each of the areas that are designated
``implementation defined''. The following lists all such areas,
-along with the section numbers from the ISO/IEC 14822:1998 and ISO/IEC
-14822:2003 standards. Some areas are only implementation-defined in
+along with the section numbers from the ISO/IEC 14882:1998 and ISO/IEC
+14882:2003 standards. Some areas are only implementation-defined in
one version of the standard.
Some choices depend on the externally determined ABI for the platform
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 7ae06952db6..18ac5da2622 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -4014,6 +4014,13 @@ The moxie processor.
@html
<hr />
@end html
+@heading @anchor{msp430-x-elf}msp430-*-elf
+TI MSP430 processor.
+This configuration is intended for embedded systems.
+
+@html
+<hr />
+@end html
@heading @anchor{powerpc-x-x}powerpc-*-*
You can specify a default version for the @option{-mcpu=@var{cpu_type}}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8b3954fcb5f..e5790c32965 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -419,10 +419,11 @@ Objective-C and Objective-C++ Dialects}.
-ftree-loop-if-convert-stores -ftree-loop-im @gol
-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
+-ftree-loop-vectorize @gol
-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
--ftree-switch-conversion -ftree-tail-merge @gol
--ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
+-ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
+-ftree-vectorize -ftree-vrp @gol
-funit-at-a-time -funroll-all-loops -funroll-loops @gol
-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
@@ -651,10 +652,10 @@ Objective-C and Objective-C++ Dialects}.
-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd @gol
-maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma @gol
-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
--mbmi2 -mrtm -mlwp -mthreads @gol
+-mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mthreads @gol
-mno-align-stringops -minline-all-stringops @gol
-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
--mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy}
+-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy}
-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
-m96bit-long-double -mlong-double-64 -mlong-double-80 @gol
-mregparm=@var{num} -msseregparm @gol
@@ -804,6 +805,9 @@ Objective-C and Objective-C++ Dialects}.
@emph{Moxie Options}
@gccoptlist{-meb -mel -mno-crt0}
+@emph{MSP430 Options}
+@gccoptlist{-msim -masm-hex -mmcu= -mlarge -msmall -mrelax}
+
@emph{PDP-11 Options}
@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
@@ -1865,6 +1869,8 @@ Some cases of unnamed fields in structures and unions are only
accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
fields within structs/unions}, for details.
+Note that this option is off for all targets but i?86 and x86_64
+targets using ms-abi.
@item -fplan9-extensions
Accept some non-standard constructs used in Plan 9 code.
@@ -6755,8 +6761,8 @@ invoking @option{-O2} on programs that use computed gotos.
Optimize yet more. @option{-O3} turns on all optimizations specified
by @option{-O2} and also turns on the @option{-finline-functions},
@option{-funswitch-loops}, @option{-fpredictive-commoning},
-@option{-fgcse-after-reload}, @option{-ftree-vectorize},
-@option{-fvect-cost-model},
+@option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
+@option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
@item -O0
@@ -6773,7 +6779,7 @@ optimizations designed to reduce code size.
@option{-Os} disables the following optimization flags:
@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
--fprefetch-loop-arrays -ftree-vect-loop-version}
+-fprefetch-loop-arrays}
@item -Ofast
@opindex Ofast
@@ -8015,27 +8021,33 @@ higher.
@item -ftree-vectorize
@opindex ftree-vectorize
+Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
+and @option{-ftree-slp-vectorize} if not explicitly specified.
+
+@item -ftree-loop-vectorize
+@opindex ftree-loop-vectorize
Perform loop vectorization on trees. This flag is enabled by default at
-@option{-O3}.
+@option{-O3} and when @option{-ftree-vectorize} is enabled.
@item -ftree-slp-vectorize
@opindex ftree-slp-vectorize
Perform basic block vectorization on trees. This flag is enabled by default at
@option{-O3} and when @option{-ftree-vectorize} is enabled.
-@item -ftree-vect-loop-version
-@opindex ftree-vect-loop-version
-Perform loop versioning when doing loop vectorization on trees. When a loop
-appears to be vectorizable except that data alignment or data dependence cannot
-be determined at compile time, then vectorized and non-vectorized versions of
-the loop are generated along with run-time checks for alignment or dependence
-to control which version is executed. This option is enabled by default
-except at level @option{-Os} where it is disabled.
-
-@item -fvect-cost-model
+@item -fvect-cost-model=@var{model}
@opindex fvect-cost-model
-Enable cost model for vectorization. This option is enabled by default at
-@option{-O3}.
+Alter the cost model used for vectorization. The @var{model} argument
+should be one of @code{unlimited}, @code{dynamic} or @code{cheap}.
+With the @code{unlimited} model the vectorized code-path is assumed
+to be profitable while with the @code{dynamic} model a runtime check
+will guard the vectorized code-path to enable it only for iteration
+counts that will likely execute faster than when executing the original
+scalar loop. The @code{cheap} model will disable vectorization of
+loops where doing so would be cost prohibitive for example due to
+required runtime checks for data dependence or alignment but otherwise
+is equal to the @code{dynamic} model.
+The default cost model depends on other optimization flags and is
+either @code{dynamic} or @code{cheap}.
@item -ftree-vrp
@opindex ftree-vrp
@@ -9441,13 +9453,15 @@ constraints. The default value is 0.
@item vect-max-version-for-alignment-checks
The maximum number of run-time checks that can be performed when
-doing loop versioning for alignment in the vectorizer. See option
-@option{-ftree-vect-loop-version} for more information.
+doing loop versioning for alignment in the vectorizer.
@item vect-max-version-for-alias-checks
The maximum number of run-time checks that can be performed when
-doing loop versioning for alias in the vectorizer. See option
-@option{-ftree-vect-loop-version} for more information.
+doing loop versioning for alias in the vectorizer.
+
+@item vect-max-peeling-for-alignment
+The maximum number of loop peels to enhance access alignment
+for vectorizer. Value -1 means 'no limit'.
@item max-iterations-to-track
The maximum number of iterations of a loop the brute-force algorithm
@@ -11048,6 +11062,7 @@ platform.
* MMIX Options::
* MN10300 Options::
* Moxie Options::
+* MSP430 Options::
* PDP-11 Options::
* picoChip Options::
* PowerPC Options::
@@ -12046,7 +12061,7 @@ generic or @code{__flash} is used, then @code{RAMPZ} is set
as needed before the operation.
@item
-If the device supports RAM larger than 64@tie{KiB} and the compiler
+If the device supports RAM larger than 64@tie{}KiB and the compiler
needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
is reset to zero after the operation.
@@ -12056,7 +12071,7 @@ prologue/epilogue saves/restores that SFR and initializes it with
zero in case the ISR code might (implicitly) use it.
@item
-RAM larger than 64@tie{KiB} is not supported by GCC for AVR targets.
+RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
If you use inline assembler to read from locations outside the
16-bit address range and change one of the @code{RAMP} registers,
you must reset it to zero after the access.
@@ -14463,6 +14478,9 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
@itemx -mno-bmi2
@itemx -mlzcnt
@itemx -mno-lzcnt
+@itemx -mfxsr
+@itemx -mxsave
+@itemx -mxsaveopt
@itemx -mrtm
@itemx -mtbm
@itemx -mno-tbm
@@ -14475,7 +14493,7 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}.
These switches enable or disable the use of instructions in the MMX, SSE,
SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM, BMI, BMI2,
-LZCNT, RTM or 3DNow!@:
+FXSR, XSAVE, XSAVEOPT, LZCNT, RTM or 3DNow!@:
extended instruction sets.
These extensions are also available as built-in functions: see
@ref{X86 Built-in Functions}, for details of the functions enabled and
@@ -16035,7 +16053,7 @@ Link the SDRAM-based runtime instead of the default ROM-based runtime.
@item -msim
@opindex msim
-Link the simulator runtime libraries.
+Link the simulator run-time libraries.
@item -msimnovec
@opindex msimnovec
@@ -17299,6 +17317,46 @@ Do not link in the C run-time initialization object file.
@end table
+@node MSP430 Options
+@subsection MSP430 Options
+@cindex MSP430 Options
+
+These options are defined for the MSP430:
+
+@table @gcctabopt
+
+@item -msim
+@opindex msim
+Link the simulator runtime libraries.
+
+@item -masm-hex
+@opindex masm-hex
+Force assembly output to always use hex constants. Normally such
+constants are signed decimals, but this option is available for
+testsuite and/or aesthetic purposes.
+
+@item -mmcu=
+@opindex mmcu=
+Select the MCU to target. Note that there are two ``generic'' MCUs,
+@code{msp430} and @code{msp430x}, which should be used most of the
+time. This option is also passed to the assembler.
+
+@item -mlarge
+@opindex mlarge
+Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
+
+@item -msmall
+@opindex msmall
+Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
+
+@item -mrelax
+@opindex mrelax
+This option is passed to the assembler and linker, and allows the
+linker to perform certain optimizations that cannot be done until
+the final link.
+
+@end table
+
@node PDP-11 Options
@subsection PDP-11 Options
@cindex PDP-11 Options
@@ -21125,14 +21183,6 @@ instruction, even though that accesses bytes that do not contain
any portion of the bit-field, or memory-mapped registers unrelated to
the one being updated.
-If the target requires strict alignment, and honoring the field
-type would require violating this alignment, a warning is issued.
-If the field has @code{packed} attribute, the access is done without
-honoring the field type. If the field doesn't have @code{packed}
-attribute, the access is done honoring the field type. In both cases,
-GCC assumes that the user knows something about the target hardware
-that it is unaware of.
-
The default value of this option is determined by the application binary
interface for the target processor.
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 04f76fe901e..45ea45a4fe8 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -2067,40 +2067,52 @@ Floating point register (containing 32-bit value)
Altivec vector register
@item wa
-Any VSX register
+Any VSX register if the -mvsx option was used or NO_REGS.
@item wd
-VSX vector register to hold vector double data
+VSX vector register to hold vector double data or NO_REGS.
@item wf
-VSX vector register to hold vector float data
+VSX vector register to hold vector float data or NO_REGS.
@item wg
-If @option{-mmfpgpr} was used, a floating point register
+If @option{-mmfpgpr} was used, a floating point register or NO_REGS.
@item wl
-If the LFIWAX instruction is enabled, a floating point register
+Floating point register if the LFIWAX instruction is enabled or NO_REGS.
@item wm
-If direct moves are enabled, a VSX register.
+VSX register if direct move instructions are enabled, or NO_REGS.
@item wn
-No register.
+No register (NO_REGS).
@item wr
-General purpose register if 64-bit mode is used
+General purpose register if 64-bit instructions are enabled or NO_REGS.
@item ws
-VSX vector register to hold scalar float data
+VSX vector register to hold scalar double values or NO_REGS.
@item wt
-VSX vector register to hold 128 bit integer
+VSX vector register to hold 128 bit integer or NO_REGS.
+
+@item wu
+Altivec register to use for float/32-bit int loads/stores or NO_REGS.
+
+@item wv
+Altivec register to use for double loads/stores or NO_REGS.
+
+@item ww
+FP or VSX register to perform float operations under @option{-mvsx} or NO_REGS.
@item wx
-If the STFIWX instruction is enabled, a floating point register
+Floating point register if the STFIWX instruction is enabled or NO_REGS.
+
+@item wy
+VSX vector register to hold scalar float values or NO_REGS.
@item wz
-If the LFIWZX instruction is enabled, a floating point register
+Floating point register if the LFIWZX instruction is enabled or NO_REGS.
@item wQ
A memory address that will work with the @code{lq} and @code{stq}
@@ -3063,6 +3075,35 @@ A constant in the range of 0 to @minus{}255.
@end table
+@item MSP430--@file{config/msp430/constraints.md}
+@table @code
+
+@item R12
+Register R12.
+
+@item R13
+Register R13.
+
+@item K
+Integer constant 1.
+
+@item L
+Integer constant -1^20..1^19.
+
+@item M
+Integer constant 1-4.
+
+@item Ya
+Memory references which do not require an extended MOVX instruction.
+
+@item Yl
+Memory reference, labels only.
+
+@item Ys
+Memory reference, stack only.
+
+@end table
+
@item PDP-11---@file{config/pdp11/constraints.md}
@table @code
@item a
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 1d6222382b8..84c0444ad9c 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -3732,8 +3732,8 @@ Def-use and use-def chains are now preferred.
@findex REG_NOTES
@item REG_NOTES (@var{i})
-A list (chain of @code{expr_list} and @code{insn_list} expressions)
-giving miscellaneous information about the insn. It is often
+A list (chain of @code{expr_list}, @code{insn_list} and @code{int_list}
+expressions) giving miscellaneous information about the insn. It is often
information pertaining to the registers used in this insn.
@end table
@@ -3752,10 +3752,10 @@ analysis pass adds a link to insns which store into registers values
that are used for the first time in this insn.
The @code{REG_NOTES} field of an insn is a chain similar to the
-@code{LOG_LINKS} field but it includes @code{expr_list} expressions in
-addition to @code{insn_list} expressions. There are several kinds of
-register notes, which are distinguished by the machine mode, which in a
-register note is really understood as being an @code{enum reg_note}.
+@code{LOG_LINKS} field but it includes @code{expr_list} and @code{int_list}
+expressions in addition to @code{insn_list} expressions. There are several
+kinds of register notes, which are distinguished by the machine mode, which
+in a register note is really understood as being an @code{enum reg_note}.
The first operand @var{op} of the note is data whose meaning depends on
the kind of note.
@@ -3956,16 +3956,16 @@ This indicates an anti dependence (a write after read dependence).
@end table
These notes describe information gathered from gcov profile data. They
-are stored in the @code{REG_NOTES} field of an insn as an
-@code{expr_list}.
+are stored in the @code{REG_NOTES} field of an insn.
@table @code
@findex REG_BR_PROB
@item REG_BR_PROB
This is used to specify the ratio of branches to non-branches of a
-branch insn according to the profile data. The value is stored as a
-value between 0 and REG_BR_PROB_BASE; larger values indicate a higher
-probability that the branch will be taken.
+branch insn according to the profile data. The note is represented
+as an @code{int_list} expression whose integer value is between 0 and
+REG_BR_PROB_BASE. Larger values indicate a higher probability that
+the branch will be taken.
@findex REG_BR_PRED
@item REG_BR_PRED
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index d15f53ce5ae..8d220f31b51 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5896,7 +5896,6 @@ interested in most macros in this section.
@menu
* CC0 Condition Codes:: Old style representation of condition codes.
* MODE_CC Condition Codes:: Modern representation of condition codes.
-* Cond Exec Macros:: Macros to control conditional execution.
@end menu
@node CC0 Condition Codes
@@ -6106,15 +6105,6 @@ same. If they are, it returns that mode. If they are different, it
returns @code{VOIDmode}.
@end deftypefn
-@node Cond Exec Macros
-@subsection Macros to control conditional execution
-@findex conditional execution
-@findex predication
-
-There is one macro that may need to be defined for targets
-supporting conditional execution, independent of how they
-represent conditional branches.
-
@node Costs
@section Describing Relative Costs of Operations
@cindex costs of instructions
@@ -10651,6 +10641,10 @@ Define this hook to return the name of a header file to be included at the start
This hook can be used together with a header provided by the system C library to implement ISO C requirements for certain macros to be predefined that describe properties of the whole implementation rather than just the compiler.
@end deftypefn
+@deftypefn {C Target Hook} bool TARGET_CXX_IMPLICIT_EXTERN_C (const char*@var{})
+Define this hook to add target-specific C++ implicit extern C functions. If this function returns true for the name of a file-scope function, that function implicitly gets extern "C" linkage rather than whatever language linkage the declaration would normally have. An example of such function is WinMain on Win32 targets.
+@end deftypefn
+
@defmac NO_IMPLICIT_EXTERN_C
Define this macro if the system header files support C++ as well as C@.
This macro inhibits the usual method of using system header files in
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in
index b51d7b38800..863e843af3d 100644
--- a/gcc/doc/tm.texi.in
+++ b/gcc/doc/tm.texi.in
@@ -4496,7 +4496,6 @@ interested in most macros in this section.
@menu
* CC0 Condition Codes:: Old style representation of condition codes.
* MODE_CC Condition Codes:: Modern representation of condition codes.
-* Cond Exec Macros:: Macros to control conditional execution.
@end menu
@node CC0 Condition Codes
@@ -4662,15 +4661,6 @@ like:
@hook TARGET_CC_MODES_COMPATIBLE
-@node Cond Exec Macros
-@subsection Macros to control conditional execution
-@findex conditional execution
-@findex predication
-
-There is one macro that may need to be defined for targets
-supporting conditional execution, independent of how they
-represent conditional branches.
-
@node Costs
@section Describing Relative Costs of Operations
@cindex costs of instructions
@@ -7985,6 +7975,8 @@ files @code{__STDC__} will always expand to 1.
@hook TARGET_C_PREINCLUDE
+@hook TARGET_CXX_IMPLICIT_EXTERN_C
+
@defmac NO_IMPLICIT_EXTERN_C
Define this macro if the system header files support C++ as well as C@.
This macro inhibits the usual method of using system header files in
diff --git a/gcc/doc/tree-ssa.texi b/gcc/doc/tree-ssa.texi
index fc479d63629..aaf741b33f1 100644
--- a/gcc/doc/tree-ssa.texi
+++ b/gcc/doc/tree-ssa.texi
@@ -725,33 +725,6 @@ Returns the version number of the @code{SSA_NAME} object @var{var}.
@end defmac
-@subsection Walking use-def chains
-
-@deftypefn {Tree SSA function} void walk_use_def_chains (@var{var}, @var{fn}, @var{data})
-
-Walks use-def chains starting at the @code{SSA_NAME} node @var{var}.
-Calls function @var{fn} at each reaching definition found. Function
-@var{FN} takes three arguments: @var{var}, its defining statement
-(@var{def_stmt}) and a generic pointer to whatever state information
-that @var{fn} may want to maintain (@var{data}). Function @var{fn} is
-able to stop the walk by returning @code{true}, otherwise in order to
-continue the walk, @var{fn} should return @code{false}.
-
-Note, that if @var{def_stmt} is a @code{PHI} node, the semantics are
-slightly different. For each argument @var{arg} of the PHI node, this
-function will:
-
-@enumerate
-@item Walk the use-def chains for @var{arg}.
-@item Call @code{FN (@var{arg}, @var{phi}, @var{data})}.
-@end enumerate
-
-Note how the first argument to @var{fn} is no longer the original
-variable @var{var}, but the PHI argument currently being examined.
-If @var{fn} wants to get at @var{var}, it should call
-@code{PHI_RESULT} (@var{phi}).
-@end deftypefn
-
@subsection Walking the dominator tree
@deftypefn {Tree SSA function} void walk_dominator_tree (@var{walk_data}, @var{bb})
diff --git a/gcc/domwalk.c b/gcc/domwalk.c
index 8c1ddc69490..4816b4c8d85 100644
--- a/gcc/domwalk.c
+++ b/gcc/domwalk.c
@@ -144,23 +144,17 @@ cmp_bb_postorder (const void *a, const void *b)
}
/* Recursively walk the dominator tree.
-
- WALK_DATA contains a set of callbacks to perform pass-specific
- actions during the dominator walk as well as a stack of block local
- data maintained during the dominator walk.
-
BB is the basic block we are currently visiting. */
void
-walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
+dom_walker::walk (basic_block bb)
{
- void *bd = NULL;
basic_block dest;
basic_block *worklist = XNEWVEC (basic_block, n_basic_blocks * 2);
int sp = 0;
int *postorder, postorder_num;
- if (walk_data->dom_direction == CDI_DOMINATORS)
+ if (m_dom_direction == CDI_DOMINATORS)
{
postorder = XNEWVEC (int, n_basic_blocks);
postorder_num = inverted_post_order_compute (postorder);
@@ -177,37 +171,9 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
|| bb == ENTRY_BLOCK_PTR
|| bb == EXIT_BLOCK_PTR)
{
- /* Callback to initialize the local data structure. */
- if (walk_data->initialize_block_local_data)
- {
- bool recycled;
-
- /* First get some local data, reusing any local data
- pointer we may have saved. */
- if (walk_data->free_block_data.length () > 0)
- {
- bd = walk_data->free_block_data.pop ();
- recycled = 1;
- }
- else
- {
- bd = xcalloc (1, walk_data->block_local_data_size);
- recycled = 0;
- }
-
- /* Push the local data into the local data stack. */
- walk_data->block_data_stack.safe_push (bd);
-
- /* Call the initializer. */
- walk_data->initialize_block_local_data (walk_data, bb,
- recycled);
-
- }
-
- /* Callback for operations to execute before we have walked the
- dominator children, but before we walk statements. */
- if (walk_data->before_dom_children)
- (*walk_data->before_dom_children) (walk_data, bb);
+ /* Callback for subclasses to do custom things before we have walked
+ the dominator children, but before we walk statements. */
+ before_dom_children (bb);
/* Mark the current BB to be popped out of the recursion stack
once children are processed. */
@@ -215,10 +181,10 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
worklist[sp++] = NULL;
int saved_sp = sp;
- for (dest = first_dom_son (walk_data->dom_direction, bb);
- dest; dest = next_dom_son (walk_data->dom_direction, dest))
+ for (dest = first_dom_son (m_dom_direction, bb);
+ dest; dest = next_dom_son (m_dom_direction, dest))
worklist[sp++] = dest;
- if (walk_data->dom_direction == CDI_DOMINATORS)
+ if (m_dom_direction == CDI_DOMINATORS)
switch (sp - saved_sp)
{
case 0:
@@ -235,48 +201,19 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb)
--sp;
bb = worklist[--sp];
- /* Callback for operations to execute after we have walked the
- dominator children, but before we walk statements. */
- if (walk_data->after_dom_children)
- (*walk_data->after_dom_children) (walk_data, bb);
-
- if (walk_data->initialize_block_local_data)
- {
- /* And finally pop the record off the block local data stack. */
- bd = walk_data->block_data_stack.pop ();
- /* And save the block data so that we can re-use it. */
- walk_data->free_block_data.safe_push (bd);
- }
+ /* Callback allowing subclasses to do custom things after we have
+ walked dominator children, but before we walk statements. */
+ after_dom_children (bb);
}
if (sp)
bb = worklist[--sp];
else
break;
}
- if (walk_data->dom_direction == CDI_DOMINATORS)
+ if (m_dom_direction == CDI_DOMINATORS)
{
free (bb_postorder);
bb_postorder = NULL;
}
free (worklist);
}
-
-void
-init_walk_dominator_tree (struct dom_walk_data *walk_data)
-{
- walk_data->free_block_data.create (0);
- walk_data->block_data_stack.create (0);
-}
-
-void
-fini_walk_dominator_tree (struct dom_walk_data *walk_data)
-{
- if (walk_data->initialize_block_local_data)
- {
- while (walk_data->free_block_data.length () > 0)
- free (walk_data->free_block_data.pop ());
- }
-
- walk_data->free_block_data.release ();
- walk_data->block_data_stack.release ();
-}
diff --git a/gcc/domwalk.h b/gcc/domwalk.h
index 54b7f3c86d9..43c15740f7a 100644
--- a/gcc/domwalk.h
+++ b/gcc/domwalk.h
@@ -18,57 +18,35 @@ 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/>. */
-typedef void *void_p;
-
-/* This is the main data structure for the dominator walker. It provides
- the callback hooks as well as a convenient place to hang block local
- data and pass-global data. */
-
-struct dom_walk_data
+#ifndef GCC_DOM_WALK_H
+#define GCC_DOM_WALK_H
+
+/**
+ * This is the main class for the dominator walker. It is expected that
+ * consumers will have a custom class inheriting from it, which will over ride
+ * at least one of before_dom_children and after_dom_children to implement the
+ * custom behavior.
+ */
+class dom_walker
{
- /* This is the direction of the dominator tree we want to walk. i.e.,
- if it is set to CDI_DOMINATORS, then we walk the dominator tree,
- if it is set to CDI_POST_DOMINATORS, then we walk the post
- dominator tree. */
- ENUM_BITFIELD (cdi_direction) dom_direction : 2;
-
- /* Function to initialize block local data.
+public:
+ dom_walker (cdi_direction direction) : m_dom_direction (direction) {}
- Note that the dominator walker infrastructure may provide a new
- fresh, and zero'd block local data structure, or it may re-use an
- existing block local data structure.
-
- If the block local structure has items such as virtual arrays, then
- that allows your optimizer to re-use those arrays rather than
- creating new ones. */
- void (*initialize_block_local_data) (struct dom_walk_data *,
- basic_block, bool);
+ /* Walk the dominator tree. */
+ void walk (basic_block);
/* Function to call before the recursive walk of the dominator children. */
- void (*before_dom_children) (struct dom_walk_data *, basic_block);
+ virtual void before_dom_children (basic_block) {}
/* Function to call after the recursive walk of the dominator children. */
- void (*after_dom_children) (struct dom_walk_data *, basic_block);
-
- /* Global data for a walk through the dominator tree. */
- void *global_data;
+ virtual void after_dom_children (basic_block) {}
- /* Stack of any data we need to keep on a per-block basis.
-
- If you have no local data, then BLOCK_DATA_STACK will be NULL. */
- vec<void_p> block_data_stack;
-
- /* Size of the block local data. If this is zero, then it is assumed
- you have no local data and thus no BLOCK_DATA_STACK as well. */
- size_t block_local_data_size;
-
- /* From here below are private data. Please do not use this
- information/data outside domwalk.c. */
-
- /* Stack of available block local structures. */
- vec<void_p> free_block_data;
+private:
+ /* This is the direction of the dominator tree we want to walk. i.e.,
+ if it is set to CDI_DOMINATORS, then we walk the dominator tree,
+ if it is set to CDI_POST_DOMINATORS, then we walk the post
+ dominator tree. */
+ const ENUM_BITFIELD (cdi_direction) m_dom_direction : 2;
};
-void walk_dominator_tree (struct dom_walk_data *, basic_block);
-void init_walk_dominator_tree (struct dom_walk_data *);
-void fini_walk_dominator_tree (struct dom_walk_data *);
+#endif
diff --git a/gcc/double-int.c b/gcc/double-int.c
index 7eaad659279..32dc514a3dd 100644
--- a/gcc/double-int.c
+++ b/gcc/double-int.c
@@ -1555,11 +1555,11 @@ mpz_get_double_int (const_tree type, mpz_t val, bool wrap)
for representing the value. The code to calculate count is
extracted from the GMP manual, section "Integer Import and Export":
http://gmplib.org/manual/Integer-Import-and-Export.html */
- numb = 8*sizeof(HOST_WIDE_INT);
+ numb = 8 * sizeof (HOST_WIDE_INT);
count = (mpz_sizeinbase (val, 2) + numb-1) / numb;
if (count < 2)
count = 2;
- vp = (unsigned HOST_WIDE_INT *) alloca (count * sizeof(HOST_WIDE_INT));
+ vp = (unsigned HOST_WIDE_INT *) alloca (count * sizeof (HOST_WIDE_INT));
vp[0] = 0;
vp[1] = 0;
diff --git a/gcc/dse.c b/gcc/dse.c
index 8b132eb2c91..1d04a252583 100644
--- a/gcc/dse.c
+++ b/gcc/dse.c
@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "target.h"
#include "params.h"
-#include "tree-flow.h" /* for may_be_aliased */
+#include "tree-ssa.h" /* for may_be_aliased */
/* This file contains three techniques for performing Dead Store
Elimination (dse).
@@ -2916,8 +2916,8 @@ dse_step2_nospill (void)
if (group == clear_alias_group)
continue;
- memset (group->offset_map_n, 0, sizeof(int) * group->offset_map_size_n);
- memset (group->offset_map_p, 0, sizeof(int) * group->offset_map_size_p);
+ memset (group->offset_map_n, 0, sizeof (int) * group->offset_map_size_n);
+ memset (group->offset_map_p, 0, sizeof (int) * group->offset_map_size_p);
bitmap_clear (group->group_kill);
EXECUTE_IF_SET_IN_BITMAP (group->store2_n, 0, j, bi)
@@ -3749,8 +3749,8 @@ const pass_data pass_data_rtl_dse1 =
class pass_rtl_dse1 : public rtl_opt_pass
{
public:
- pass_rtl_dse1(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_dse1, ctxt)
+ pass_rtl_dse1 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_dse1, ctxt)
{}
/* opt_pass methods: */
@@ -3787,8 +3787,8 @@ const pass_data pass_data_rtl_dse2 =
class pass_rtl_dse2 : public rtl_opt_pass
{
public:
- pass_rtl_dse2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_dse2, ctxt)
+ pass_rtl_dse2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_dse2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 6ac15ddf6f3..435d22dc8eb 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -240,10 +240,10 @@ dump_open_alternate_stream (struct dump_file_info *dfi)
if (dfi->alt_stream)
return dfi->alt_stream;
- stream = strcmp("stderr", dfi->alt_filename) == 0
+ stream = strcmp ("stderr", dfi->alt_filename) == 0
? stderr
- : strcmp("stdout", dfi->alt_filename) == 0
- ? stdout
+ : strcmp ("stdout", dfi->alt_filename) == 0
+ ? stdout
: fopen (dfi->alt_filename, dfi->alt_state < 0 ? "w" : "a");
if (!stream)
@@ -262,10 +262,10 @@ dump_loc (int dump_kind, FILE *dfile, source_location loc)
if (dump_kind)
{
if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
- fprintf (dfile, "\n%s:%d:%d: note: ", LOCATION_FILE (loc),
+ fprintf (dfile, "%s:%d:%d: note: ", LOCATION_FILE (loc),
LOCATION_LINE (loc), LOCATION_COLUMN (loc));
else if (current_function_decl)
- fprintf (dfile, "\n%s:%d:%d: note: ",
+ fprintf (dfile, "%s:%d:%d: note: ",
DECL_SOURCE_FILE (current_function_decl),
DECL_SOURCE_LINE (current_function_decl),
DECL_SOURCE_COLUMN (current_function_decl));
@@ -404,10 +404,10 @@ dump_start (int phase, int *flag_ptr)
name = get_dump_file_name (phase);
if (name)
{
- stream = strcmp("stderr", name) == 0
+ stream = strcmp ("stderr", name) == 0
? stderr
- : strcmp("stdout", name) == 0
- ? stdout
+ : strcmp ("stdout", name) == 0
+ ? stdout
: fopen (name, dfi->pstate < 0 ? "w" : "a");
if (!stream)
error ("could not open dump file %qs: %m", name);
@@ -451,12 +451,12 @@ dump_finish (int phase)
return;
dfi = get_dump_file_info (phase);
if (dfi->pstream && (!dfi->pfilename
- || (strcmp("stderr", dfi->pfilename) != 0
- && strcmp("stdout", dfi->pfilename) != 0)))
+ || (strcmp ("stderr", dfi->pfilename) != 0
+ && strcmp ("stdout", dfi->pfilename) != 0)))
fclose (dfi->pstream);
- if (dfi->alt_stream && strcmp("stderr", dfi->alt_filename) != 0
- && strcmp("stdout", dfi->alt_filename) != 0)
+ if (dfi->alt_stream && strcmp ("stderr", dfi->alt_filename) != 0
+ && strcmp ("stdout", dfi->alt_filename) != 0)
fclose (dfi->alt_stream);
dfi->alt_stream = NULL;
@@ -488,10 +488,10 @@ dump_begin (int phase, int *flag_ptr)
return NULL;
dfi = get_dump_file_info (phase);
- stream = strcmp("stderr", name) == 0
+ stream = strcmp ("stderr", name) == 0
? stderr
- : strcmp("stdout", name) == 0
- ? stdout
+ : strcmp ("stdout", name) == 0
+ ? stdout
: fopen (name, dfi->pstate < 0 ? "w" : "a");
if (!stream)
diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c
index 37dc8959bdc..69907f9fbf2 100644
--- a/gcc/dwarf2asm.c
+++ b/gcc/dwarf2asm.c
@@ -315,7 +315,7 @@ dw2_asm_output_nstring (const char *str, size_t orig_len,
int c = str[i];
if (c == '\"' || c == '\\')
fputc ('\\', asm_out_file);
- if (ISPRINT(c))
+ if (ISPRINT (c))
fputc (c, asm_out_file);
else
fprintf (asm_out_file, "\\%o", c);
diff --git a/gcc/dwarf2cfi.c b/gcc/dwarf2cfi.c
index 12256bcec39..5a096adcd0f 100644
--- a/gcc/dwarf2cfi.c
+++ b/gcc/dwarf2cfi.c
@@ -2841,14 +2841,14 @@ create_cie_data (void)
dw_stack_pointer_regnum = DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM);
dw_frame_pointer_regnum = DWARF_FRAME_REGNUM (HARD_FRAME_POINTER_REGNUM);
- memset (&cie_trace, 0, sizeof(cie_trace));
+ memset (&cie_trace, 0, sizeof (cie_trace));
cur_trace = &cie_trace;
add_cfi_vec = &cie_cfi_vec;
cie_cfi_row = cur_row = new_cfi_row ();
/* On entry, the Canonical Frame Address is at SP. */
- memset(&loc, 0, sizeof (loc));
+ memset (&loc, 0, sizeof (loc));
loc.reg = dw_stack_pointer_regnum;
loc.offset = INCOMING_FRAME_SP_OFFSET;
def_cfa_1 (&loc);
@@ -3268,7 +3268,7 @@ dump_cfi_row (FILE *f, dw_cfi_row *row)
if (!cfi)
{
dw_cfa_location dummy;
- memset(&dummy, 0, sizeof(dummy));
+ memset (&dummy, 0, sizeof (dummy));
dummy.reg = INVALID_REGNUM;
cfi = def_cfa_0 (&dummy, &row->cfa);
}
@@ -3391,8 +3391,8 @@ const pass_data pass_data_dwarf2_frame =
class pass_dwarf2_frame : public rtl_opt_pass
{
public:
- pass_dwarf2_frame(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_dwarf2_frame, ctxt)
+ pass_dwarf2_frame (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_dwarf2_frame, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7bf739d154f..8d865d38d0e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -365,11 +365,15 @@ should_emit_struct_debug (tree type, enum debug_info_usage usage)
type_decl = TYPE_STUB_DECL (TYPE_MAIN_VARIANT (type));
- if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl))
- return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
+ if (type_decl != NULL)
+ {
+ if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl))
+ return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
+
+ if (matches_main_base (DECL_SOURCE_FILE (type_decl)))
+ return DUMP_GSTRUCT (type, usage, criterion, generic, true, true);
+ }
- if (matches_main_base (DECL_SOURCE_FILE (type_decl)))
- return DUMP_GSTRUCT (type, usage, criterion, generic, true, true);
return DUMP_GSTRUCT (type, usage, criterion, generic, false, false);
}
@@ -4241,7 +4245,7 @@ index_addr_table_entry (void **h, void *v)
if (node->refcount == 0)
return 1;
- gcc_assert(node->index == NO_INDEX_ASSIGNED);
+ gcc_assert (node->index == NO_INDEX_ASSIGNED);
node->index = *index;
*index += 1;
@@ -6159,7 +6163,7 @@ generate_type_signature (dw_die_ref die, comdat_type_node *type_node)
context, if any. This is stored in the type unit DIE for link-time
ODR (one-definition rule) checking. */
- if (is_cxx() && name != NULL)
+ if (is_cxx () && name != NULL)
{
md5_init_ctx (&ctx);
@@ -6245,7 +6249,7 @@ same_dw_val_p (const dw_val_node *v1, const dw_val_node *v2, int *mark)
case dw_val_class_flag:
return v1->v.val_flag == v2->v.val_flag;
case dw_val_class_str:
- return !strcmp(v1->v.val_str->str, v2->v.val_str->str);
+ return !strcmp (v1->v.val_str->str, v2->v.val_str->str);
case dw_val_class_addr:
r1 = v1->v.val_addr;
@@ -6784,7 +6788,7 @@ contains_subprogram_definition (dw_die_ref die)
if (die->die_tag == DW_TAG_subprogram && ! is_declaration_die (die))
return 1;
- FOR_EACH_CHILD (die, c, if (contains_subprogram_definition(c)) return 1);
+ FOR_EACH_CHILD (die, c, if (contains_subprogram_definition (c)) return 1);
return 0;
}
@@ -6856,7 +6860,7 @@ clone_tree (dw_die_ref die)
dw_die_ref c;
dw_die_ref clone = clone_die (die);
- FOR_EACH_CHILD (die, c, add_child_die (clone, clone_tree(c)));
+ FOR_EACH_CHILD (die, c, add_child_die (clone, clone_tree (c)));
return clone;
}
@@ -7048,7 +7052,7 @@ copy_declaration_context (dw_die_ref unit, dw_die_ref die)
add_dwarf_attr (die, a);
}
- FOR_EACH_CHILD (decl, c, add_child_die (die, clone_tree(c)));
+ FOR_EACH_CHILD (decl, c, add_child_die (die, clone_tree (c)));
}
if (decl->die_parent != NULL
@@ -19105,7 +19109,7 @@ gen_compile_unit_die (const char *filename)
else if (strcmp (common_lang, TRANSLATION_UNIT_LANGUAGE (t)) == 0)
;
else if (strncmp (common_lang, "GNU C", 5) == 0
- && strncmp(TRANSLATION_UNIT_LANGUAGE (t), "GNU C", 5) == 0)
+ && strncmp (TRANSLATION_UNIT_LANGUAGE (t), "GNU C", 5) == 0)
/* Mixing C and C++ is ok, use C++ in that case. */
common_lang = "GNU C++";
else
@@ -21992,7 +21996,7 @@ index_string (void **h, void *v)
find_string_form (node);
if (node->form == DW_FORM_GNU_str_index && node->refcount > 0)
{
- gcc_assert(node->index == NO_INDEX_ASSIGNED);
+ gcc_assert (node->index == NO_INDEX_ASSIGNED);
node->index = *index;
*index += 1;
}
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 8a7b8a563d5..85714f5d8a5 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1704,7 +1704,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
/* If this expression uses it's parent's alias set, mark it such
that we won't change it. */
- if (component_uses_parent_alias_set (t))
+ if (component_uses_parent_alias_set_from (t) != NULL_TREE)
MEM_KEEP_ALIAS_SET_P (ref) = 1;
/* If this is a decl, set the attributes of the MEM from it. */
@@ -3461,7 +3461,7 @@ try_split (rtx pat, rtx trial, int last)
if (any_condjump_p (trial)
&& (note = find_reg_note (trial, REG_BR_PROB, 0)))
- split_branch_probability = INTVAL (XEXP (note, 0));
+ split_branch_probability = XINT (note, 0);
probability = split_branch_probability;
seq = split_insns (pat, trial);
@@ -3512,7 +3512,7 @@ try_split (rtx pat, rtx trial, int last)
is responsible for this step using
split_branch_probability variable. */
gcc_assert (njumps == 1);
- add_reg_note (insn, REG_BR_PROB, GEN_INT (probability));
+ add_int_reg_note (insn, REG_BR_PROB, probability);
}
}
}
@@ -4090,7 +4090,7 @@ reorder_insns_nobb (rtx from, rtx to, rtx after)
NEXT_INSN (to) = NEXT_INSN (after);
PREV_INSN (from) = after;
NEXT_INSN (after) = from;
- if (after == get_last_insn())
+ if (after == get_last_insn ())
set_last_insn (to);
}
@@ -4300,7 +4300,7 @@ emit_insn_after_1 (rtx first, rtx after, basic_block bb)
if (after_after)
PREV_INSN (after_after) = last;
- if (after == get_last_insn())
+ if (after == get_last_insn ())
set_last_insn (last);
return last;
@@ -4700,7 +4700,7 @@ emit_debug_insn_before (rtx pattern, rtx before)
rtx
emit_insn (rtx x)
{
- rtx last = get_last_insn();
+ rtx last = get_last_insn ();
rtx insn;
if (x == NULL_RTX)
@@ -4747,7 +4747,7 @@ emit_insn (rtx x)
rtx
emit_debug_insn (rtx x)
{
- rtx last = get_last_insn();
+ rtx last = get_last_insn ();
rtx insn;
if (x == NULL_RTX)
@@ -5804,9 +5804,9 @@ init_emit_once (void)
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
}
@@ -5815,9 +5815,9 @@ init_emit_once (void)
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
}
@@ -5826,17 +5826,17 @@ init_emit_once (void)
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
/* We store the value 1. */
- FCONST1(mode).data.high = 0;
- FCONST1(mode).data.low = 0;
- FCONST1(mode).mode = mode;
- FCONST1(mode).data
+ FCONST1 (mode).data.high = 0;
+ FCONST1 (mode).data.low = 0;
+ FCONST1 (mode).mode = mode;
+ FCONST1 (mode).data
= double_int_one.lshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
@@ -5848,17 +5848,17 @@ init_emit_once (void)
mode != VOIDmode;
mode = GET_MODE_WIDER_MODE (mode))
{
- FCONST0(mode).data.high = 0;
- FCONST0(mode).data.low = 0;
- FCONST0(mode).mode = mode;
+ FCONST0 (mode).data.high = 0;
+ FCONST0 (mode).data.low = 0;
+ FCONST0 (mode).mode = mode;
const_tiny_rtx[0][(int) mode] = CONST_FIXED_FROM_FIXED_VALUE (
FCONST0 (mode), mode);
/* We store the value 1. */
- FCONST1(mode).data.high = 0;
- FCONST1(mode).data.low = 0;
- FCONST1(mode).mode = mode;
- FCONST1(mode).data
+ FCONST1 (mode).data.high = 0;
+ FCONST1 (mode).data.low = 0;
+ FCONST1 (mode).mode = mode;
+ FCONST1 (mode).data
= double_int_one.lshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
@@ -5968,7 +5968,7 @@ emit_copy_of_insn_after (rtx insn, rtx after)
add_reg_note (new_rtx, REG_NOTE_KIND (link),
copy_insn_1 (XEXP (link, 0)));
else
- add_reg_note (new_rtx, REG_NOTE_KIND (link), XEXP (link, 0));
+ add_shallow_copy_of_reg_note (new_rtx, link);
}
INSN_CODE (new_rtx) = INSN_CODE (insn);
diff --git a/gcc/errors.c b/gcc/errors.c
index cac7dcb9c09..5e0bc720e6f 100644
--- a/gcc/errors.c
+++ b/gcc/errors.c
@@ -48,7 +48,7 @@ warning (const char *format, ...)
fprintf (stderr, "%s: warning: ", progname);
vfprintf (stderr, format, ap);
va_end (ap);
- fputc('\n', stderr);
+ fputc ('\n', stderr);
}
@@ -63,7 +63,7 @@ error (const char *format, ...)
fprintf (stderr, "%s: ", progname);
vfprintf (stderr, format, ap);
va_end (ap);
- fputc('\n', stderr);
+ fputc ('\n', stderr);
have_error = 1;
}
@@ -80,7 +80,7 @@ fatal (const char *format, ...)
fprintf (stderr, "%s: ", progname);
vfprintf (stderr, format, ap);
va_end (ap);
- fputc('\n', stderr);
+ fputc ('\n', stderr);
exit (FATAL_EXIT_CODE);
}
diff --git a/gcc/except.c b/gcc/except.c
index c4ed944cf7a..fb47fbb06cb 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -139,7 +139,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-pretty-print.h"
#include "tree-pass.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
/* Provide defaults for stuff that may not be defined when using
@@ -641,7 +641,7 @@ eh_region_outermost (struct function *ifun, eh_region region_a,
gcc_assert (ifun->eh->region_array);
gcc_assert (ifun->eh->region_tree);
- b_outer = sbitmap_alloc (ifun->eh->region_array->length());
+ b_outer = sbitmap_alloc (ifun->eh->region_array->length ());
bitmap_clear (b_outer);
do
@@ -2021,8 +2021,8 @@ const pass_data pass_data_set_nothrow_function_flags =
class pass_set_nothrow_function_flags : public rtl_opt_pass
{
public:
- pass_set_nothrow_function_flags(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_set_nothrow_function_flags, ctxt)
+ pass_set_nothrow_function_flags (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_set_nothrow_function_flags, ctxt)
{}
/* opt_pass methods: */
@@ -2652,8 +2652,8 @@ const pass_data pass_data_convert_to_eh_region_ranges =
class pass_convert_to_eh_region_ranges : public rtl_opt_pass
{
public:
- pass_convert_to_eh_region_ranges(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_convert_to_eh_region_ranges, ctxt)
+ pass_convert_to_eh_region_ranges (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_convert_to_eh_region_ranges, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/expmed.c b/gcc/expmed.c
index ba9a7b68c42..92c293879d5 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -54,7 +54,7 @@ static void store_split_bit_field (rtx, unsigned HOST_WIDE_INT,
rtx);
static rtx extract_fixed_bit_field (enum machine_mode, rtx,
unsigned HOST_WIDE_INT,
- unsigned HOST_WIDE_INT, rtx, int, bool);
+ unsigned HOST_WIDE_INT, rtx, int);
static rtx mask_rtx (enum machine_mode, int, int, int);
static rtx lshift_value (enum machine_mode, unsigned HOST_WIDE_INT, int);
static rtx extract_split_bit_field (rtx, unsigned HOST_WIDE_INT,
@@ -1128,7 +1128,7 @@ store_split_bit_field (rtx op0, unsigned HOST_WIDE_INT bitsize,
endianness compensation) to fetch the piece we want. */
part = extract_fixed_bit_field (word_mode, value, thissize,
total_bits - bitsize + bitsdone,
- NULL_RTX, 1, false);
+ NULL_RTX, 1);
}
}
else
@@ -1140,7 +1140,7 @@ store_split_bit_field (rtx op0, unsigned HOST_WIDE_INT bitsize,
& (((HOST_WIDE_INT) 1 << thissize) - 1));
else
part = extract_fixed_bit_field (word_mode, value, thissize,
- bitsdone, NULL_RTX, 1, false);
+ bitsdone, NULL_RTX, 1);
}
/* If OP0 is a register, then handle OFFSET here.
@@ -1301,8 +1301,7 @@ extract_bit_field_using_extv (const extraction_insn *extv, rtx op0,
static rtx
extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
- unsigned HOST_WIDE_INT bitnum,
- int unsignedp, bool packedp, rtx target,
+ unsigned HOST_WIDE_INT bitnum, int unsignedp, rtx target,
enum machine_mode mode, enum machine_mode tmode,
bool fallback_p)
{
@@ -1517,7 +1516,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
rtx result_part
= extract_bit_field_1 (op0, MIN (BITS_PER_WORD,
bitsize - i * BITS_PER_WORD),
- bitnum + bit_offset, 1, false, target_part,
+ bitnum + bit_offset, 1, target_part,
mode, word_mode, fallback_p);
gcc_assert (target_part);
@@ -1621,7 +1620,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
{
xop0 = copy_to_reg (xop0);
rtx result = extract_bit_field_1 (xop0, bitsize, bitpos,
- unsignedp, packedp, target,
+ unsignedp, target,
mode, tmode, false);
if (result)
return result;
@@ -1641,7 +1640,7 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
gcc_assert (int_mode != BLKmode);
target = extract_fixed_bit_field (int_mode, op0, bitsize, bitnum,
- target, unsignedp, packedp);
+ target, unsignedp);
return convert_extracted_bit_field (target, mode, tmode, unsignedp);
}
@@ -1652,7 +1651,6 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
STR_RTX is the structure containing the byte (a REG or MEM).
UNSIGNEDP is nonzero if this is an unsigned bit field.
- PACKEDP is nonzero if the field has the packed attribute.
MODE is the natural mode of the field value once extracted.
TMODE is the mode the caller would like the value to have;
but the value may be returned with type MODE instead.
@@ -1664,10 +1662,10 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
rtx
extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
- unsigned HOST_WIDE_INT bitnum, int unsignedp, bool packedp,
- rtx target, enum machine_mode mode, enum machine_mode tmode)
+ unsigned HOST_WIDE_INT bitnum, int unsignedp, rtx target,
+ enum machine_mode mode, enum machine_mode tmode)
{
- return extract_bit_field_1 (str_rtx, bitsize, bitnum, unsignedp, packedp,
+ return extract_bit_field_1 (str_rtx, bitsize, bitnum, unsignedp,
target, mode, tmode, true);
}
@@ -1675,8 +1673,6 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
from bit BITNUM of OP0.
UNSIGNEDP is nonzero for an unsigned bit field (don't sign-extend value).
- PACKEDP is true if the field has the packed attribute.
-
If TARGET is nonzero, attempts to store the value there
and return TARGET, but this is not guaranteed.
If TARGET is not used, create a pseudo-reg of mode TMODE for the value. */
@@ -1685,7 +1681,7 @@ static rtx
extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
unsigned HOST_WIDE_INT bitsize,
unsigned HOST_WIDE_INT bitnum, rtx target,
- int unsignedp, bool packedp)
+ int unsignedp)
{
enum machine_mode mode;
@@ -1726,45 +1722,10 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
&& bitnum % BITS_PER_UNIT + bitsize <= total_bits
&& bitnum % GET_MODE_BITSIZE (mode) + bitsize > total_bits)
{
+ /* If the target doesn't support unaligned access, give up and
+ split the access into two. */
if (STRICT_ALIGNMENT)
- {
- static bool informed_about_misalignment = false;
-
- if (packedp)
- {
- if (bitsize == total_bits)
- warning_at (input_location, OPT_fstrict_volatile_bitfields,
- "multiple accesses to volatile structure"
- " member because of packed attribute");
- else
- warning_at (input_location, OPT_fstrict_volatile_bitfields,
- "multiple accesses to volatile structure"
- " bitfield because of packed attribute");
-
- return extract_split_bit_field (op0, bitsize, bitnum,
- unsignedp);
- }
-
- if (bitsize == total_bits)
- warning_at (input_location, OPT_fstrict_volatile_bitfields,
- "mis-aligned access used for structure member");
- else
- warning_at (input_location, OPT_fstrict_volatile_bitfields,
- "mis-aligned access used for structure bitfield");
-
- if (! informed_about_misalignment)
- {
- informed_about_misalignment = true;
- inform (input_location,
- "when a volatile object spans multiple type-sized"
- " locations, the compiler must choose between using"
- " a single mis-aligned access to preserve the"
- " volatility, or using multiple aligned accesses"
- " to avoid runtime faults; this code may fail at"
- " runtime if the hardware does not allow this"
- " access");
- }
- }
+ return extract_split_bit_field (op0, bitsize, bitnum, unsignedp);
bit_offset = bitnum - bitnum % BITS_PER_UNIT;
}
op0 = adjust_bitfield_address (op0, mode, bit_offset / BITS_PER_UNIT);
@@ -1940,7 +1901,7 @@ extract_split_bit_field (rtx op0, unsigned HOST_WIDE_INT bitsize,
whose meaning is determined by BYTES_PER_UNIT.
OFFSET is in UNITs, and UNIT is in bits. */
part = extract_fixed_bit_field (word_mode, word, thissize,
- offset * unit + thispos, 0, 1, false);
+ offset * unit + thispos, 0, 1);
bitsdone += thissize;
/* Shift this part into place for the result. */
@@ -2845,7 +2806,7 @@ choose_mult_variant (enum machine_mode mode, HOST_WIDE_INT val,
`unsigned int' */
if (HOST_BITS_PER_INT >= GET_MODE_UNIT_BITSIZE (mode))
{
- op_cost = neg_cost(speed, mode);
+ op_cost = neg_cost (speed, mode);
if (MULT_COST_LESS (&alg->cost, mult_cost))
{
limit.cost = alg->cost.cost - op_cost;
@@ -3163,7 +3124,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
calculation of the synth_mult. */
coeff = -(unsigned HOST_WIDE_INT) coeff;
max_cost = (set_src_cost (gen_rtx_MULT (mode, fake_reg, op1), speed)
- - neg_cost(speed, mode));
+ - neg_cost (speed, mode));
if (max_cost <= 0)
goto skip_synth;
@@ -3916,7 +3877,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
{
if (rem_flag)
return const0_rtx;
- return expand_unop (mode, flag_trapv && GET_MODE_CLASS(mode) == MODE_INT
+ return expand_unop (mode, flag_trapv && GET_MODE_CLASS (mode) == MODE_INT
? negv_optab : neg_optab, op0, target, 0);
}
diff --git a/gcc/expr.c b/gcc/expr.c
index 0887391ca38..01cd9e66bdf 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -43,13 +43,13 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "tm_p.h"
#include "tree-iterator.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "target.h"
#include "common/common-target.h"
#include "timevar.h"
#include "df.h"
#include "diagnostic.h"
-#include "ssaexpand.h"
+#include "tree-outof-ssa.h"
#include "target-globals.h"
#include "params.h"
@@ -1710,7 +1710,7 @@ emit_group_load_1 (rtx *tmps, rtx dst, rtx orig_src, tree type, int ssize)
&& (!REG_P (tmps[i]) || GET_MODE (tmps[i]) != mode))
tmps[i] = extract_bit_field (tmps[i], bytelen * BITS_PER_UNIT,
(bytepos % slen0) * BITS_PER_UNIT,
- 1, false, NULL_RTX, mode, mode);
+ 1, NULL_RTX, mode, mode);
}
else
{
@@ -1720,7 +1720,7 @@ emit_group_load_1 (rtx *tmps, rtx dst, rtx orig_src, tree type, int ssize)
mem = assign_stack_temp (GET_MODE (src), slen);
emit_move_insn (mem, src);
tmps[i] = extract_bit_field (mem, bytelen * BITS_PER_UNIT,
- 0, 1, false, NULL_RTX, mode, mode);
+ 0, 1, NULL_RTX, mode, mode);
}
}
/* FIXME: A SIMD parallel will eventually lead to a subreg of a
@@ -1738,7 +1738,7 @@ emit_group_load_1 (rtx *tmps, rtx dst, rtx orig_src, tree type, int ssize)
}
else if (CONSTANT_P (src) && GET_MODE (dst) != BLKmode
&& XVECLEN (dst, 0) > 1)
- tmps[i] = simplify_gen_subreg (mode, src, GET_MODE(dst), bytepos);
+ tmps[i] = simplify_gen_subreg (mode, src, GET_MODE (dst), bytepos);
else if (CONSTANT_P (src))
{
HOST_WIDE_INT len = (HOST_WIDE_INT) bytelen;
@@ -1761,7 +1761,7 @@ emit_group_load_1 (rtx *tmps, rtx dst, rtx orig_src, tree type, int ssize)
tmps[i] = src;
else
tmps[i] = extract_bit_field (src, bytelen * BITS_PER_UNIT,
- bytepos * BITS_PER_UNIT, 1, false, NULL_RTX,
+ bytepos * BITS_PER_UNIT, 1, NULL_RTX,
mode, mode);
if (shift)
@@ -2204,7 +2204,7 @@ copy_blkmode_from_reg (rtx target, rtx srcreg, tree type)
bitpos for the destination store (left justified). */
store_bit_field (dst, bitsize, bitpos % BITS_PER_WORD, 0, 0, copy_mode,
extract_bit_field (src, bitsize,
- xbitpos % BITS_PER_WORD, 1, false,
+ xbitpos % BITS_PER_WORD, 1,
NULL_RTX, copy_mode, copy_mode));
}
}
@@ -2281,7 +2281,7 @@ copy_blkmode_to_reg (enum machine_mode mode, tree src)
store_bit_field (dst_word, bitsize, xbitpos % BITS_PER_WORD,
0, 0, word_mode,
extract_bit_field (src_word, bitsize,
- bitpos % BITS_PER_WORD, 1, false,
+ bitpos % BITS_PER_WORD, 1,
NULL_RTX, word_mode, word_mode));
}
@@ -3029,7 +3029,7 @@ read_complex_part (rtx cplx, bool imag_p)
}
return extract_bit_field (cplx, ibitsize, imag_p ? ibitsize : 0,
- true, false, NULL_RTX, imode, imode);
+ true, NULL_RTX, imode, imode);
}
/* A subroutine of emit_move_insn_1. Yet another lowpart generator.
@@ -3247,10 +3247,10 @@ emit_move_complex (enum machine_mode mode, rtx x, rtx y)
&& optab_handler (mov_optab, GET_MODE_INNER (mode)) != CODE_FOR_nothing
&& !(REG_P (x)
&& HARD_REGISTER_P (x)
- && hard_regno_nregs[REGNO(x)][mode] == 1)
+ && hard_regno_nregs[REGNO (x)][mode] == 1)
&& !(REG_P (y)
&& HARD_REGISTER_P (y)
- && hard_regno_nregs[REGNO(y)][mode] == 1))
+ && hard_regno_nregs[REGNO (y)][mode] == 1))
try_int = false;
/* Not possible if the values are inherently not adjacent. */
else if (GET_CODE (x) == CONCAT || GET_CODE (y) == CONCAT)
@@ -4709,8 +4709,6 @@ expand_assignment (tree to, tree from, bool nontemporal)
int unsignedp;
int volatilep = 0;
tree tem;
- bool misalignp;
- rtx mem = NULL_RTX;
push_temp_slots ();
tem = get_inner_reference (to, &bitsize, &bitpos, &offset, &mode1,
@@ -4720,40 +4718,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
&& DECL_BIT_FIELD_TYPE (TREE_OPERAND (to, 1)))
get_bit_range (&bitregion_start, &bitregion_end, to, &bitpos, &offset);
- /* If we are going to use store_bit_field and extract_bit_field,
- make sure to_rtx will be safe for multiple use. */
- mode = TYPE_MODE (TREE_TYPE (tem));
- if (TREE_CODE (tem) == MEM_REF
- && mode != BLKmode
- && ((align = get_object_alignment (tem))
- < GET_MODE_ALIGNMENT (mode))
- && ((icode = optab_handler (movmisalign_optab, mode))
- != CODE_FOR_nothing))
- {
- struct expand_operand ops[2];
-
- misalignp = true;
- to_rtx = gen_reg_rtx (mode);
- mem = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
-
- /* If the misaligned store doesn't overwrite all bits, perform
- rmw cycle on MEM. */
- if (bitsize != GET_MODE_BITSIZE (mode))
- {
- create_input_operand (&ops[0], to_rtx, mode);
- create_fixed_operand (&ops[1], mem);
- /* The movmisalign<mode> pattern cannot fail, else the assignment
- would silently be omitted. */
- expand_insn (icode, 2, ops);
-
- mem = copy_rtx (mem);
- }
- }
- else
- {
- misalignp = false;
- to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
- }
+ to_rtx = expand_expr (tem, NULL_RTX, VOIDmode, EXPAND_WRITE);
/* If the bitfield is volatile, we want to access it in the
field's mode, not the computed mode.
@@ -4871,11 +4836,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
/* If the field is at offset zero, we could have been given the
DECL_RTX of the parent struct. Don't munge it. */
to_rtx = shallow_copy_rtx (to_rtx);
-
set_mem_attributes_minus_bitpos (to_rtx, to, 0, bitpos);
-
- /* Deal with volatile and readonly fields. The former is only
- done for MEM. Also set MEM_KEEP_ALIAS_SET_P if needed. */
if (volatilep)
MEM_VOLATILE_P (to_rtx) = 1;
}
@@ -4892,17 +4853,6 @@ expand_assignment (tree to, tree from, bool nontemporal)
get_alias_set (to), nontemporal);
}
- if (misalignp)
- {
- struct expand_operand ops[2];
-
- create_fixed_operand (&ops[0], mem);
- create_input_operand (&ops[1], to_rtx, mode);
- /* The movmisalign<mode> pattern cannot fail, else the assignment
- would silently be omitted. */
- expand_insn (icode, 2, ops);
- }
-
if (result)
preserve_temp_slots (result);
pop_temp_slots ();
@@ -6520,7 +6470,7 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
temp_target = gen_reg_rtx (mode);
temp_target
= extract_bit_field (temp, size * BITS_PER_UNIT, 0, 1,
- false, temp_target, mode, mode);
+ temp_target, mode, mode);
temp = temp_target;
}
}
@@ -7610,7 +7560,7 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
if (TREE_ADDRESSABLE (exp)
&& ! MEM_P (result)
- && ! targetm.calls.allocate_stack_slots_for_args())
+ && ! targetm.calls.allocate_stack_slots_for_args ())
{
error ("local frame unavailable (naked function?)");
return result;
@@ -9176,6 +9126,24 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
}
#undef REDUCE_BIT_FIELD
+
+/* Return TRUE if expression STMT is suitable for replacement.
+ Never consider memory loads as replaceable, because those don't ever lead
+ into constant expressions. */
+
+static bool
+stmt_is_replaceable_p (gimple stmt)
+{
+ if (ssa_is_replaceable_p (stmt))
+ {
+ /* Don't move around loads. */
+ if (!gimple_assign_single_p (stmt)
+ || is_gimple_val (gimple_assign_rhs1 (stmt)))
+ return true;
+ }
+ return false;
+}
+
rtx
expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
enum expand_modifier modifier, rtx *alt_rtl)
@@ -9704,8 +9672,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
else if (SLOW_UNALIGNED_ACCESS (mode, align))
temp = extract_bit_field (temp, GET_MODE_BITSIZE (mode),
0, TYPE_UNSIGNED (TREE_TYPE (exp)),
- true, (modifier == EXPAND_STACK_PARM
- ? NULL_RTX : target),
+ (modifier == EXPAND_STACK_PARM
+ ? NULL_RTX : target),
mode, mode);
}
return temp;
@@ -9896,7 +9864,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
HOST_WIDE_INT bitsize, bitpos;
tree offset;
int volatilep = 0, must_force_mem;
- bool packedp = false;
tree tem = get_inner_reference (exp, &bitsize, &bitpos, &offset,
&mode1, &unsignedp, &volatilep, true);
rtx orig_op0, memloc;
@@ -9907,11 +9874,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
infinitely recurse. */
gcc_assert (tem != exp);
- if (TYPE_PACKED (TREE_TYPE (TREE_OPERAND (exp, 0)))
- || (TREE_CODE (TREE_OPERAND (exp, 1)) == FIELD_DECL
- && DECL_PACKED (TREE_OPERAND (exp, 1))))
- packedp = true;
-
/* If TEM's type is a union of variable size, pass TARGET to the inner
computation, since it will need a temporary and TARGET is known
to have to do. This occurs in unchecked conversion in Ada. */
@@ -10136,7 +10098,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
if (MEM_P (op0) && REG_P (XEXP (op0, 0)))
mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0));
- op0 = extract_bit_field (op0, bitsize, bitpos, unsignedp, packedp,
+ op0 = extract_bit_field (op0, bitsize, bitpos, unsignedp,
(modifier == EXPAND_STACK_PARM
? NULL_RTX : target),
ext_mode, ext_mode);
diff --git a/gcc/expr.h b/gcc/expr.h
index 15fcb471d8d..218984402c5 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -704,7 +704,7 @@ extern void store_bit_field (rtx, unsigned HOST_WIDE_INT,
unsigned HOST_WIDE_INT,
enum machine_mode, rtx);
extern rtx extract_bit_field (rtx, unsigned HOST_WIDE_INT,
- unsigned HOST_WIDE_INT, int, bool, rtx,
+ unsigned HOST_WIDE_INT, int, rtx,
enum machine_mode, enum machine_mode);
extern rtx extract_low_bits (enum machine_mode, enum machine_mode, rtx);
extern rtx expand_mult (enum machine_mode, rtx, rtx, rtx, int);
diff --git a/gcc/file-find.c b/gcc/file-find.c
index bc6b4349ef5..3952349e989 100644
--- a/gcc/file-find.c
+++ b/gcc/file-find.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
static bool debug = false;
void
-find_file_set_debug(bool debug_state)
+find_file_set_debug (bool debug_state)
{
debug = debug_state;
}
diff --git a/gcc/final.c b/gcc/final.c
index d1c8d7c77fb..641ebe48eee 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -70,7 +70,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "expr.h"
#include "tree-pass.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "coverage.h"
#include "df.h"
@@ -704,7 +704,7 @@ compute_alignments (void)
freq_threshold = freq_max / PARAM_VALUE (PARAM_ALIGN_THRESHOLD);
if (dump_file)
- fprintf(dump_file, "freq_max: %i\n",freq_max);
+ fprintf (dump_file, "freq_max: %i\n",freq_max);
FOR_EACH_BB (bb)
{
rtx label = BB_HEAD (bb);
@@ -716,9 +716,10 @@ compute_alignments (void)
|| optimize_bb_for_size_p (bb))
{
if (dump_file)
- fprintf(dump_file, "BB %4i freq %4i loop %2i loop_depth %2i skipped.\n",
- bb->index, bb->frequency, bb->loop_father->num,
- bb_loop_depth (bb));
+ fprintf (dump_file,
+ "BB %4i freq %4i loop %2i loop_depth %2i skipped.\n",
+ bb->index, bb->frequency, bb->loop_father->num,
+ bb_loop_depth (bb));
continue;
}
max_log = LABEL_ALIGN (label);
@@ -733,10 +734,11 @@ compute_alignments (void)
}
if (dump_file)
{
- fprintf(dump_file, "BB %4i freq %4i loop %2i loop_depth %2i fall %4i branch %4i",
- bb->index, bb->frequency, bb->loop_father->num,
- bb_loop_depth (bb),
- fallthru_frequency, branch_frequency);
+ fprintf (dump_file, "BB %4i freq %4i loop %2i loop_depth"
+ " %2i fall %4i branch %4i",
+ bb->index, bb->frequency, bb->loop_father->num,
+ bb_loop_depth (bb),
+ fallthru_frequency, branch_frequency);
if (!bb->loop_father->inner && bb->loop_father->num)
fprintf (dump_file, " inner_loop");
if (bb->loop_father->header == bb)
@@ -762,7 +764,7 @@ compute_alignments (void)
{
log = JUMP_ALIGN (label);
if (dump_file)
- fprintf(dump_file, " jump alignment added.\n");
+ fprintf (dump_file, " jump alignment added.\n");
if (max_log < log)
{
max_log = log;
@@ -779,7 +781,7 @@ compute_alignments (void)
{
log = LOOP_ALIGN (label);
if (dump_file)
- fprintf(dump_file, " internal loop alignment added.\n");
+ fprintf (dump_file, " internal loop alignment added.\n");
if (max_log < log)
{
max_log = log;
@@ -862,8 +864,8 @@ const pass_data pass_data_compute_alignments =
class pass_compute_alignments : public rtl_opt_pass
{
public:
- pass_compute_alignments(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_compute_alignments, ctxt)
+ pass_compute_alignments (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_compute_alignments, ctxt)
{}
/* opt_pass methods: */
@@ -1123,7 +1125,7 @@ shorten_branches (rtx first)
INSN_ADDRESSES (uid) = insn_current_address + insn_lengths[uid];
if (NOTE_P (insn) || BARRIER_P (insn)
- || LABEL_P (insn) || DEBUG_INSN_P(insn))
+ || LABEL_P (insn) || DEBUG_INSN_P (insn))
continue;
if (INSN_DELETED_P (insn))
continue;
@@ -4489,8 +4491,8 @@ const pass_data pass_data_final =
class pass_final : public rtl_opt_pass
{
public:
- pass_final(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_final, ctxt)
+ pass_final (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_final, ctxt)
{}
/* opt_pass methods: */
@@ -4535,8 +4537,8 @@ const pass_data pass_data_shorten_branches =
class pass_shorten_branches : public rtl_opt_pass
{
public:
- pass_shorten_branches(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_shorten_branches, ctxt)
+ pass_shorten_branches (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_shorten_branches, ctxt)
{}
/* opt_pass methods: */
@@ -4699,8 +4701,8 @@ const pass_data pass_data_clean_state =
class pass_clean_state : public rtl_opt_pass
{
public:
- pass_clean_state(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_clean_state, ctxt)
+ pass_clean_state (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_clean_state, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/fixed-value.c b/gcc/fixed-value.c
index 8ba78769c79..91ec5880119 100644
--- a/gcc/fixed-value.c
+++ b/gcc/fixed-value.c
@@ -97,7 +97,7 @@ fixed_from_double_int (double_int payload, enum machine_mode mode)
else if (UNSIGNED_SCALAR_FIXED_POINT_MODE_P (mode))
value.data = payload.zext (GET_MODE_IBIT (mode) + GET_MODE_FBIT (mode));
else
- gcc_unreachable();
+ gcc_unreachable ();
value.mode = mode;
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index 45616bc74f5..a2be8bb1ad2 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -191,6 +191,15 @@ enum fp_contract_mode {
FP_CONTRACT_FAST = 2
};
+/* Vectorizer cost-model. */
+enum vect_cost_model {
+ VECT_COST_MODEL_UNLIMITED = 0,
+ VECT_COST_MODEL_CHEAP = 1,
+ VECT_COST_MODEL_DYNAMIC = 2,
+ VECT_COST_MODEL_DEFAULT = 3
+};
+
+
/* Different instrumentation modes. */
enum sanitize_code {
/* AddressSanitizer. */
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9956b2c9f07..fc29291c01d 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -58,7 +58,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "md5.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
/* Nonzero if we are folding constants inside an initializer; zero
otherwise. */
@@ -2693,8 +2693,9 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
&& operand_equal_p (TYPE_SIZE (TREE_TYPE (arg0)),
TYPE_SIZE (TREE_TYPE (arg1)), flags)))
&& types_compatible_p (TREE_TYPE (arg0), TREE_TYPE (arg1))
- && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg0, 1)))
- == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (arg1, 1))))
+ && alias_ptr_types_compatible_p
+ (TREE_TYPE (TREE_OPERAND (arg0, 1)),
+ TREE_TYPE (TREE_OPERAND (arg1, 1)))
&& OP_SAME (0) && OP_SAME (1));
case ARRAY_REF:
@@ -4299,7 +4300,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p,
}
if (low == 0 && high == 0)
- return build_int_cst (type, 1);
+ return omit_one_operand_loc (loc, type, build_int_cst (type, 1), exp);
if (low == 0)
return fold_build2_loc (loc, LE_EXPR, type, exp,
@@ -9942,6 +9943,24 @@ exact_inverse (tree type, tree cst)
}
}
+/* Mask out the tz least significant bits of X of type TYPE where
+ tz is the number of trailing zeroes in Y. */
+static double_int
+mask_with_tz (tree type, double_int x, double_int y)
+{
+ int tz = y.trailing_zeros ();
+
+ if (tz > 0)
+ {
+ double_int mask;
+
+ mask = ~double_int::mask (tz);
+ mask = mask.ext (TYPE_PRECISION (type), TYPE_UNSIGNED (type));
+ return mask & x;
+ }
+ return x;
+}
+
/* Fold a binary expression of code CODE and type TYPE with operands
OP0 and OP1. LOC is the location of the resulting expression.
Return the folded expression if folding is successful. Otherwise,
@@ -11266,6 +11285,8 @@ fold_binary_loc (location_t loc,
{
double_int c1, c2, c3, msk;
int width = TYPE_PRECISION (type), w;
+ bool try_simplify = true;
+
c1 = tree_to_double_int (TREE_OPERAND (arg0, 1));
c2 = tree_to_double_int (arg1);
@@ -11300,7 +11321,21 @@ fold_binary_loc (location_t loc,
break;
}
}
- if (c3 != c1)
+
+ /* If X is a tree of the form (Y * K1) & K2, this might conflict
+ with that optimization from the BIT_AND_EXPR optimizations.
+ This could end up in an infinite recursion. */
+ if (TREE_CODE (TREE_OPERAND (arg0, 0)) == MULT_EXPR
+ && TREE_CODE (TREE_OPERAND (TREE_OPERAND (arg0, 0), 1))
+ == INTEGER_CST)
+ {
+ tree t = TREE_OPERAND (TREE_OPERAND (arg0, 0), 1);
+ double_int masked = mask_with_tz (type, c3, tree_to_double_int (t));
+
+ try_simplify = (masked != c1);
+ }
+
+ if (try_simplify && c3 != c1)
return fold_build2_loc (loc, BIT_IOR_EXPR, type,
fold_build2_loc (loc, BIT_AND_EXPR, type,
TREE_OPERAND (arg0, 0),
@@ -11676,8 +11711,8 @@ fold_binary_loc (location_t loc,
if (TREE_CODE (arg1) == INTEGER_CST)
{
double_int cst1 = tree_to_double_int (arg1);
- double_int ncst1 = (-cst1).ext(TYPE_PRECISION (TREE_TYPE (arg1)),
- TYPE_UNSIGNED (TREE_TYPE (arg1)));
+ double_int ncst1 = (-cst1).ext (TYPE_PRECISION (TREE_TYPE (arg1)),
+ TYPE_UNSIGNED (TREE_TYPE (arg1)));
if ((cst1 & ncst1) == ncst1
&& multiple_of_p (type, arg0,
double_int_to_tree (TREE_TYPE (arg1), ncst1)))
@@ -11690,22 +11725,16 @@ fold_binary_loc (location_t loc,
&& TREE_CODE (arg0) == MULT_EXPR
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
{
- int arg1tz
- = tree_to_double_int (TREE_OPERAND (arg0, 1)).trailing_zeros ();
- if (arg1tz > 0)
- {
- double_int arg1mask, masked;
- arg1mask = ~double_int::mask (arg1tz);
- arg1mask = arg1mask.ext (TYPE_PRECISION (type),
- TYPE_UNSIGNED (type));
- masked = arg1mask & tree_to_double_int (arg1);
- if (masked.is_zero ())
- return omit_two_operands_loc (loc, type, build_zero_cst (type),
- arg0, arg1);
- else if (masked != tree_to_double_int (arg1))
- return fold_build2_loc (loc, code, type, op0,
- double_int_to_tree (type, masked));
- }
+ double_int masked
+ = mask_with_tz (type, tree_to_double_int (arg1),
+ tree_to_double_int (TREE_OPERAND (arg0, 1)));
+
+ if (masked.is_zero ())
+ return omit_two_operands_loc (loc, type, build_zero_cst (type),
+ arg0, arg1);
+ else if (masked != tree_to_double_int (arg1))
+ return fold_build2_loc (loc, code, type, op0,
+ double_int_to_tree (type, masked));
}
/* For constants M and N, if M == (1LL << cst) - 1 && (N & M) == M,
@@ -14167,14 +14196,29 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
&& integer_zerop (op2)
&& (tem = sign_bit_p (TREE_OPERAND (arg0, 0), arg1)))
{
+ /* sign_bit_p looks through both zero and sign extensions,
+ but for this optimization only sign extensions are
+ usable. */
+ tree tem2 = TREE_OPERAND (arg0, 0);
+ while (tem != tem2)
+ {
+ if (TREE_CODE (tem2) != NOP_EXPR
+ || TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (tem2, 0))))
+ {
+ tem = NULL_TREE;
+ break;
+ }
+ tem2 = TREE_OPERAND (tem2, 0);
+ }
/* sign_bit_p only checks ARG1 bits within A's precision.
If <sign bit of A> has wider type than A, bits outside
of A's precision in <sign bit of A> need to be checked.
If they are all 0, this optimization needs to be done
in unsigned A's type, if they are all 1 in signed A's type,
otherwise this can't be done. */
- if (TYPE_PRECISION (TREE_TYPE (tem))
- < TYPE_PRECISION (TREE_TYPE (arg1))
+ if (tem
+ && TYPE_PRECISION (TREE_TYPE (tem))
+ < TYPE_PRECISION (TREE_TYPE (arg1))
&& TYPE_PRECISION (TREE_TYPE (tem))
< TYPE_PRECISION (type))
{
@@ -15404,7 +15448,7 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
if (TREE_CODE (inner_type) == REAL_TYPE)
return tree_expr_nonnegative_warnv_p (op0,
strict_overflow_p);
- if (TREE_CODE (inner_type) == INTEGER_TYPE)
+ if (INTEGRAL_TYPE_P (inner_type))
{
if (TYPE_UNSIGNED (inner_type))
return true;
@@ -15412,12 +15456,12 @@ tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
strict_overflow_p);
}
}
- else if (TREE_CODE (outer_type) == INTEGER_TYPE)
+ else if (INTEGRAL_TYPE_P (outer_type))
{
if (TREE_CODE (inner_type) == REAL_TYPE)
return tree_expr_nonnegative_warnv_p (op0,
strict_overflow_p);
- if (TREE_CODE (inner_type) == INTEGER_TYPE)
+ if (INTEGRAL_TYPE_P (inner_type))
return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type)
&& TYPE_UNSIGNED (inner_type);
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index dba8032c712..ecdccab1c7c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,87 @@
+2013-09-27 Janne Blomqvist <jb@gcc.gnu.org>
+
+ * intrinsic.texi (DATE_AND_TIME): Fix example.
+
+2013-09-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58436
+ * class.c (generate_finalization_wrapper): Handle CLASS(*).
+
+2013-09-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ PR fortran/58469
+ * resolve.c (generate_component_assignments): Avoid double free
+ at runtime and freeing a still-being used expr.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (fortran_OBJS): Use fortran/gfortranspec.o.
+ (gfortranspec.o): Remove.
+ (CFLAGS-fortran/gfortranspec.o): New variable.
+ (GFORTRAN_D_OBJS): Update.
+ ($(F95_PARSER_OBJS), fortran/openmp.o, GFORTRAN_TRANS_DEPS)
+ (fortran/f95-lang.o, fortran/scanner.o, fortran/convert.o)
+ (fortran/frontend-passes.o, fortran/trans.o, fortran/trans-decl.o)
+ (fortran/trans-types, fortran/trans-const.o, fortran/trans-expr.o)
+ (fortran/trans-stmt.o, fortran/trans-openmp.o, fortran/trans-io.o)
+ (fortran/trans-array.o, fortran/trans-intrinsic.o)
+ (fortran/dependency.o, fortran/trans-common.o, fortran/resolve.o)
+ (fortran/data.o, fortran/options.o, fortran/cpp.o)
+ (fortran/scanner.o, fortran/module.o): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (gfortranspec.o): Don't use subshell.
+
+2013-09-23 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/58355
+ * decl.c (check_extended_derived_type): Prevent segfault, modify error
+ message.
+
+2013-09-20 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/58099
+ * expr.c (gfc_check_pointer_assign): Remove second call to
+ 'gfc_compare_interfaces' with swapped arguments.
+ * interface.c (gfc_compare_interfaces): Symmetrize the call to
+ 'check_result_characteristics' by calling it with swapped arguments.
+
+2013-09-18 Tobias Burnus <burnus@net-b.de>
+
+ * expr.c (gfc_check_assign_symbol): Free lvalue.ref.
+
+2013-09-18 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/43366
+ * primary.c (gfc_variable_attr): Also handle codimension.
+ * resolve.c (resolve_ordinary_assign): Add invalid-diagnostic for
+ polymorphic assignment.
+
+2013-09-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58356
+ * class.c (generate_finalization_wrapper): Init proc_tree if
+ not yet resolved.
+
+2013-09-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ * resolve.c (generate_component_assignments): Correctly handle the
+ case that the LHS is not allocated.
+
+2013-09-15 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ * resolve.c (generate_component_assignments): Handle unallocated
+ LHS with defined assignment of components.
+
+2013-09-12 Brooks Moses <bmoses@google.com>
+
+ PR driver/42955
+ * Make-lang.in: Do not install driver binaries in $(target)/bin.
+
2013-09-09 Tobias Burnus <burnus@net-b.de>
* invoke.texi (Error and Warning Options): Add hyphen.
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index ee704233bba..41abe0f7ef2 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -67,7 +67,7 @@ F95_OBJS = $(F95_PARSER_OBJS) $(FORTRAN_TARGET_OBJS) \
fortran/trans-intrinsic.o fortran/trans-io.o fortran/trans-openmp.o \
fortran/trans-stmt.o fortran/trans-types.o fortran/frontend-passes.o
-fortran_OBJS = $(F95_OBJS) gfortranspec.o
+fortran_OBJS = $(F95_OBJS) fortran/gfortranspec.o
#
# Define the names for selecting gfortran in LANGUAGES.
@@ -76,14 +76,10 @@ fortran: f951$(exeext)
# Tell GNU make to ignore files by these names if they exist.
.PHONY: fortran
-gfortranspec.o: $(srcdir)/fortran/gfortranspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \
- $(CONFIG_H) coretypes.h intl.h $(OPTS_H)
- (SHLIB='$(SHLIB)'; \
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
- $(INCLUDES) $(srcdir)/fortran/gfortranspec.c)
+CFLAGS-fortran/gfortranspec.o += $(DRIVER_DEFINES)
# Create the compiler driver gfortran.
-GFORTRAN_D_OBJS = $(GCC_OBJS) gfortranspec.o
+GFORTRAN_D_OBJS = $(GCC_OBJS) fortran/gfortranspec.o
gfortran$(exeext): $(GFORTRAN_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
$(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
@@ -241,19 +237,14 @@ install-finclude-dir: installdirs
# Install hooks:
# f951 is installed elsewhere as part of $(COMPILERS).
-# Install the driver program as $(target)-gfortran
-# and also as either gfortran (if native) or $(tooldir)/bin/gfortran.
+# Install the driver program as $(target)-gfortran, and also as gfortran
+# if native.
fortran.install-common: install-finclude-dir installdirs
-if [ -f f951$(exeext) ] ; then \
rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
$(INSTALL_PROGRAM) gfortran$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
chmod a+x $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext); \
- if [ -f gfortran-cross$(exeext) ] ; then \
- if [ -d $(DESTDIR)$(gcc_tooldir)/bin/. ] ; then \
- rm -f $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
- $(INSTALL_PROGRAM) gfortran-cross$(exeext) $(DESTDIR)$(gcc_tooldir)/bin/gfortran$(exeext); \
- else true; fi; \
- else \
+ if [ ! -f gfortran-cross$(exeext) ] ; then \
rm -f $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
$(LN) $(DESTDIR)$(bindir)/$(GFORTRAN_INSTALL_NAME)$(exeext) $(DESTDIR)$(bindir)/$(GFORTRAN_TARGET_INSTALL_NAME)$(exeext); \
fi ; \
@@ -317,59 +308,6 @@ fortran.stagefeedback: stageprofile-start
-mv fortran/*$(objext) stagefeedback/fortran
#
-# .o: .h dependencies.
-
-# Everything depends on gfortran.h, but only a few files depend on
-# the other headers. So at some point we'll have to split out
-# which objects depend on what. FIXME
-# TODO: Add dependencies on the backend/tree header files
-
-$(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \
- fortran/intrinsic.h fortran/match.h fortran/constructor.h \
- fortran/parse.h fortran/arith.h fortran/target-memory.h \
- $(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
- dumpfile.h $(TREE_H) dumpfile.h $(GGC_H) $(VEC_H) \
- $(FLAGS_H) $(DIAGNOSTIC_H) errors.h $(FUNCTION_H) \
- fortran/iso-c-binding.def fortran/iso-fortran-env.def
-fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
-
-GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \
- fortran/intrinsic.h fortran/trans-array.h \
- fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
- fortran/trans-stmt.h fortran/trans-types.h \
- $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H) \
- fortran/iso-c-binding.def fortran/iso-fortran-env.def
CFLAGS-fortran/cpp.o += $(TARGET_SYSTEM_ROOT_DEFINE)
-fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
- gt-fortran-f95-lang.h gtype-fortran.h $(CGRAPH_H) $(TARGET_H) fortran/cpp.h \
- $(BUILTINS_DEF) fortran/types.def \
- $(TM_H) debug.h langhooks.h $(FLAGS_H) $(EXPR_H) $(LANGHOOKS_DEF_H) \
- libfuncs.h expr.h $(DIAGNOSTIC_H)
-fortran/scanner.o: toplev.h fortran/cpp.h
-fortran/convert.o: $(GFORTRAN_TRANS_DEPS) convert.h
-fortran/frontend-passes.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans.o: $(GFORTRAN_TRANS_DEPS) tree-iterator.h
-fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \
- $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(GIMPLE_H) \
- $(TREE_DUMP_H) debug.h pointer-set.h
-fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \
- $(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H) dwarf2out.h
-fortran/trans-const.o: $(GFORTRAN_TRANS_DEPS) realmpfr.h
-fortran/trans-expr.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
-fortran/trans-stmt.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
-fortran/trans-openmp.o: $(GFORTRAN_TRANS_DEPS)
-fortran/trans-io.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-io.h \
- fortran/ioparm.def
-fortran/trans-array.o: $(GFORTRAN_TRANS_DEPS) $(GIMPLE_H)
-fortran/trans-intrinsic.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \
- gt-fortran-trans-intrinsic.h
-fortran/dependency.o: $(GFORTRAN_TRANS_DEPS) fortran/dependency.h
-fortran/trans-common.o: $(GFORTRAN_TRANS_DEPS) $(TARGET_H) $(RTL_H)
-fortran/resolve.o: fortran/dependency.h fortran/data.h fortran/target-memory.h
-fortran/data.o: fortran/data.h
-fortran/options.o: $(PARAMS_H) $(TARGET_H) fortran/cpp.h
-fortran/cpp.o: fortran/cpp.c incpath.h incpath.o cppbuiltin.h
-fortran/scanner.o: fortran/scanner.h
CFLAGS-fortran/module.o += $(ZLIBINC)
-fortran/module.o: fortran/scanner.h
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 629b052fb32..be4959a7dee 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -1427,6 +1427,12 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
gfc_expr *ancestor_wrapper = NULL, *rank;
gfc_iterator *iter;
+ if (derived->attr.unlimited_polymorphic)
+ {
+ vtab_final->initializer = gfc_get_null_expr (NULL);
+ return;
+ }
+
/* Search for the ancestor's finalizers. */
if (derived->attr.extension && derived->components
&& (!derived->components->ts.u.derived->attr.abstract
@@ -1881,6 +1887,8 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns,
for (fini = derived->f2k_derived->finalizers; fini; fini = fini->next)
{
+ if (!fini->proc_tree)
+ fini->proc_tree = gfc_find_sym_in_symtree (fini->proc_sym);
if (fini->proc_tree->n.sym->attr.elemental)
{
fini_elem = fini;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 152511962d9..3a8175f3ff2 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -7390,6 +7390,7 @@ syntax:
/* Check a derived type that is being extended. */
+
static gfc_symbol*
check_extended_derived_type (char *name)
{
@@ -7401,14 +7402,15 @@ check_extended_derived_type (char *name)
return NULL;
}
+ extended = gfc_find_dt_in_generic (extended);
+
+ /* F08:C428. */
if (!extended)
{
- gfc_error ("No such symbol in TYPE definition at %C");
+ gfc_error ("Symbol '%s' at %C has not been previously defined", name);
return NULL;
}
- extended = gfc_find_dt_in_generic (extended);
-
if (extended->attr.flavor != FL_DERIVED)
{
gfc_error ("'%s' in EXTENDS expression at %C is not a "
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 61f0f8275cc..b2af32816e5 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3581,14 +3581,6 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
return false;
}
- if (!gfc_compare_interfaces (s2, s1, name, 0, 1,
- err, sizeof(err), NULL, NULL))
- {
- gfc_error ("Interface mismatch in procedure pointer assignment "
- "at %L: %s", &rvalue->where, err);
- return false;
- }
-
return true;
}
@@ -3824,6 +3816,7 @@ gfc_check_assign_symbol (gfc_symbol *sym, gfc_component *comp, gfc_expr *rvalue)
r = gfc_check_assign (&lvalue, rvalue, 1);
free (lvalue.symtree);
+ free (lvalue.ref);
if (!r)
return r;
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index aa88b3c3fa6..b8786440fbe 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -1416,7 +1416,8 @@ gfc_compare_interfaces (gfc_symbol *s1, gfc_symbol *s2, const char *name2,
if (s1->attr.function && s2->attr.function)
{
/* If both are functions, check result characteristics. */
- if (!check_result_characteristics (s1, s2, errmsg, err_len))
+ if (!check_result_characteristics (s1, s2, errmsg, err_len)
+ || !check_result_characteristics (s2, s1, errmsg, err_len))
return 0;
}
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index db4d748c876..afe96711843 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -3461,7 +3461,7 @@ program test_time_and_date
call date_and_time(TIME=time)
call date_and_time(VALUES=values)
print '(a,2x,a,2x,a)', date, time, zone
- print '(8i5))', values
+ print '(8i5)', values
end program test_time_and_date
@end smallexample
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 1276abb3aa7..80d45eaea12 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2134,7 +2134,7 @@ check_substring:
symbol_attribute
gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
{
- int dimension, pointer, allocatable, target;
+ int dimension, codimension, pointer, allocatable, target;
symbol_attribute attr;
gfc_ref *ref;
gfc_symbol *sym;
@@ -2149,12 +2149,14 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
{
dimension = CLASS_DATA (sym)->attr.dimension;
+ codimension = CLASS_DATA (sym)->attr.codimension;
pointer = CLASS_DATA (sym)->attr.class_pointer;
allocatable = CLASS_DATA (sym)->attr.allocatable;
}
else
{
dimension = attr.dimension;
+ codimension = attr.codimension;
pointer = attr.pointer;
allocatable = attr.allocatable;
}
@@ -2209,11 +2211,13 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
if (comp->ts.type == BT_CLASS)
{
+ codimension = CLASS_DATA (comp)->attr.codimension;
pointer = CLASS_DATA (comp)->attr.class_pointer;
allocatable = CLASS_DATA (comp)->attr.allocatable;
}
else
{
+ codimension = comp->attr.codimension;
pointer = comp->attr.pointer;
allocatable = comp->attr.allocatable;
}
@@ -2228,6 +2232,7 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
}
attr.dimension = dimension;
+ attr.codimension = codimension;
attr.pointer = pointer;
attr.allocatable = allocatable;
attr.target = target;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 2929679aecc..4befb9fdda4 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -9014,6 +9014,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
int rlen = 0;
int n;
gfc_ref *ref;
+ symbol_attribute attr;
if (gfc_extend_assign (code, ns))
{
@@ -9178,14 +9179,35 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
gfc_current_ns->proc_name->attr.implicit_pure = 0;
}
- /* F03:7.4.1.2. */
- /* FIXME: Valid in Fortran 2008, unless the LHS is both polymorphic
- and coindexed; cf. F2008, 7.2.1.2 and PR 43366. */
- if (lhs->ts.type == BT_CLASS)
+ /* F2008, 7.2.1.2. */
+ attr = gfc_expr_attr (lhs);
+ if (lhs->ts.type == BT_CLASS && attr.allocatable)
{
- gfc_error ("Variable must not be polymorphic in intrinsic assignment at "
- "%L - check that there is a matching specific subroutine "
- "for '=' operator", &lhs->where);
+ if (attr.codimension)
+ {
+ gfc_error ("Assignment to polymorphic coarray at %L is not "
+ "permitted", &lhs->where);
+ return false;
+ }
+ if (!gfc_notify_std (GFC_STD_F2008, "Assignment to an allocatable "
+ "polymorphic variable at %L", &lhs->where))
+ return false;
+ if (!gfc_option.flag_realloc_lhs)
+ {
+ gfc_error ("Assignment to an allocatable polymorphic variable at %L "
+ "requires -frealloc-lhs", &lhs->where);
+ return false;
+ }
+ /* See PR 43366. */
+ gfc_error ("Assignment to an allocatable polymorphic variable at %L "
+ "is not yet supported", &lhs->where);
+ return false;
+ }
+ else if (lhs->ts.type == BT_CLASS)
+ {
+ gfc_error ("Nonallocatable variable must not be polymorphic in intrinsic "
+ "assignment at %L - check that there is a matching specific "
+ "subroutine for '=' operator", &lhs->where);
return false;
}
@@ -9546,6 +9568,24 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns)
temp_code = build_assignment (EXEC_ASSIGN,
t1, (*code)->expr1,
NULL, NULL, (*code)->loc);
+
+ /* For allocatable LHS, check whether it is allocated. Note
+ that allocatable components with defined assignment are
+ not yet support. See PR 57696. */
+ if ((*code)->expr1->symtree->n.sym->attr.allocatable)
+ {
+ gfc_code *block;
+ gfc_expr *e =
+ gfc_lval_expr_from_sym ((*code)->expr1->symtree->n.sym);
+ block = gfc_get_code (EXEC_IF);
+ block->block = gfc_get_code (EXEC_IF);
+ block->block->expr1
+ = gfc_build_intrinsic_call (ns,
+ GFC_ISYM_ALLOCATED, "allocated",
+ (*code)->loc, 1, e);
+ block->block->next = temp_code;
+ temp_code = block;
+ }
add_code_to_chain (&temp_code, &tmp_head, &tmp_tail);
}
@@ -9554,8 +9594,35 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns)
gfc_free_expr (this_code->ext.actual->expr);
this_code->ext.actual->expr = gfc_copy_expr (t1);
add_comp_ref (this_code->ext.actual->expr, comp1);
+
+ /* If the LHS variable is allocatable and wasn't allocated and
+ the temporary is allocatable, pointer assign the address of
+ the freshly allocated LHS to the temporary. */
+ if ((*code)->expr1->symtree->n.sym->attr.allocatable
+ && gfc_expr_attr ((*code)->expr1).allocatable)
+ {
+ gfc_code *block;
+ gfc_expr *cond;
+
+ cond = gfc_get_expr ();
+ cond->ts.type = BT_LOGICAL;
+ cond->ts.kind = gfc_default_logical_kind;
+ cond->expr_type = EXPR_OP;
+ cond->where = (*code)->loc;
+ cond->value.op.op = INTRINSIC_NOT;
+ cond->value.op.op1 = gfc_build_intrinsic_call (ns,
+ GFC_ISYM_ALLOCATED, "allocated",
+ (*code)->loc, 1, gfc_copy_expr (t1));
+ block = gfc_get_code (EXEC_IF);
+ block->block = gfc_get_code (EXEC_IF);
+ block->block->expr1 = cond;
+ block->block->next = build_assignment (EXEC_POINTER_ASSIGN,
+ t1, (*code)->expr1,
+ NULL, NULL, (*code)->loc);
+ add_code_to_chain (&block, &head, &tail);
+ }
}
- }
+ }
else if (this_code->op == EXEC_ASSIGN && !this_code->next)
{
/* Don't add intrinsic assignments since they are already
@@ -9577,13 +9644,6 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns)
}
}
- /* This is probably not necessary. */
- if (this_code)
- {
- gfc_free_statements (this_code);
- this_code = NULL;
- }
-
/* Put the temporary assignments at the top of the generated code. */
if (tmp_head && component_assignment_level == 1)
{
@@ -9592,6 +9652,28 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns)
tmp_head = tmp_tail = NULL;
}
+ // If we did a pointer assignment - thus, we need to ensure that the LHS is
+ // not accidentally deallocated. Hence, nullify t1.
+ if (t1 && (*code)->expr1->symtree->n.sym->attr.allocatable
+ && gfc_expr_attr ((*code)->expr1).allocatable)
+ {
+ gfc_code *block;
+ gfc_expr *cond;
+ gfc_expr *e;
+
+ e = gfc_lval_expr_from_sym ((*code)->expr1->symtree->n.sym);
+ cond = gfc_build_intrinsic_call (ns, GFC_ISYM_ASSOCIATED, "associated",
+ (*code)->loc, 2, gfc_copy_expr (t1), e);
+ block = gfc_get_code (EXEC_IF);
+ block->block = gfc_get_code (EXEC_IF);
+ block->block->expr1 = cond;
+ block->block->next = build_assignment (EXEC_POINTER_ASSIGN,
+ t1, gfc_get_null_expr (&(*code)->loc),
+ NULL, NULL, (*code)->loc);
+ gfc_append_code (tail, block);
+ tail = block;
+ }
+
/* Now attach the remaining code chain to the input code. Step on
to the end of the new code since resolution is complete. */
gcc_assert ((*code)->op == EXEC_ASSIGN);
@@ -9601,7 +9683,8 @@ generate_component_assignments (gfc_code **code, gfc_namespace *ns)
gfc_free_expr ((*code)->expr1);
gfc_free_expr ((*code)->expr2);
**code = *head;
- free (head);
+ if (head != tail)
+ free (head);
*code = tail;
component_assignment_level--;
diff --git a/gcc/function.c b/gcc/function.c
index c7d259c73ff..eb8aca91aaa 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1970,8 +1970,8 @@ const pass_data pass_data_instantiate_virtual_regs =
class pass_instantiate_virtual_regs : public rtl_opt_pass
{
public:
- pass_instantiate_virtual_regs(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_instantiate_virtual_regs, ctxt)
+ pass_instantiate_virtual_regs (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_instantiate_virtual_regs, ctxt)
{}
/* opt_pass methods: */
@@ -2078,7 +2078,7 @@ aggregate_value_p (const_tree exp, const_tree fntype)
bool
use_register_for_decl (const_tree decl)
{
- if (!targetm.calls.allocate_stack_slots_for_args())
+ if (!targetm.calls.allocate_stack_slots_for_args ())
return true;
/* Honor volatile. */
@@ -7022,8 +7022,8 @@ const pass_data pass_data_leaf_regs =
class pass_leaf_regs : public rtl_opt_pass
{
public:
- pass_leaf_regs(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_leaf_regs, ctxt)
+ pass_leaf_regs (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_leaf_regs, ctxt)
{}
/* opt_pass methods: */
@@ -7079,8 +7079,8 @@ const pass_data pass_data_thread_prologue_and_epilogue =
class pass_thread_prologue_and_epilogue : public rtl_opt_pass
{
public:
- pass_thread_prologue_and_epilogue(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_thread_prologue_and_epilogue, ctxt)
+ pass_thread_prologue_and_epilogue (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_thread_prologue_and_epilogue, ctxt)
{}
/* opt_pass methods: */
@@ -7298,8 +7298,8 @@ const pass_data pass_data_match_asm_constraints =
class pass_match_asm_constraints : public rtl_opt_pass
{
public:
- pass_match_asm_constraints(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_match_asm_constraints, ctxt)
+ pass_match_asm_constraints (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_match_asm_constraints, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/fwprop.c b/gcc/fwprop.c
index 8fe02ac2a43..d08710c9614 100644
--- a/gcc/fwprop.c
+++ b/gcc/fwprop.c
@@ -205,10 +205,17 @@ process_uses (df_ref *use_rec, int top_flag)
}
}
+class single_def_use_dom_walker : public dom_walker
+{
+public:
+ single_def_use_dom_walker (cdi_direction direction)
+ : dom_walker (direction) {}
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+};
-static void
-single_def_use_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+single_def_use_dom_walker::before_dom_children (basic_block bb)
{
int bb_index = bb->index;
struct df_md_bb_info *md_bb_info = df_md_get_bb_info (bb_index);
@@ -245,9 +252,8 @@ single_def_use_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Pop the definitions created in this basic block when leaving its
dominated parts. */
-static void
-single_def_use_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb ATTRIBUTE_UNUSED)
+void
+single_def_use_dom_walker::after_dom_children (basic_block bb ATTRIBUTE_UNUSED)
{
df_ref saved_def;
while ((saved_def = reg_defs_stack.pop ()) != NULL)
@@ -269,8 +275,6 @@ single_def_use_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
static void
build_single_def_use_links (void)
{
- struct dom_walk_data walk_data;
-
/* We use the multiple definitions problem to compute our restricted
use-def chains. */
df_set_flags (DF_EQ_NOTES);
@@ -291,14 +295,8 @@ build_single_def_use_links (void)
/* Walk the dominator tree looking for single reaching definitions
dominating the uses. This is similar to how SSA form is built. */
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = single_def_use_enter_block;
- walk_data.after_dom_children = single_def_use_leave_block;
-
- init_walk_dominator_tree (&walk_data);
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
- fini_walk_dominator_tree (&walk_data);
+ single_def_use_dom_walker (CDI_DOMINATORS)
+ .walk (cfun->cfg->x_entry_block_ptr);
BITMAP_FREE (local_lr);
BITMAP_FREE (local_md);
@@ -1506,8 +1504,8 @@ const pass_data pass_data_rtl_fwprop =
class pass_rtl_fwprop : public rtl_opt_pass
{
public:
- pass_rtl_fwprop(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_fwprop, ctxt)
+ pass_rtl_fwprop (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_fwprop, ctxt)
{}
/* opt_pass methods: */
@@ -1572,8 +1570,8 @@ const pass_data pass_data_rtl_fwprop_addr =
class pass_rtl_fwprop_addr : public rtl_opt_pass
{
public:
- pass_rtl_fwprop_addr(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_fwprop_addr, ctxt)
+ pass_rtl_fwprop_addr (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_fwprop_addr, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c
index ef425c1cb30..d7e05e3f35c 100644
--- a/gcc/gcc-ar.c
+++ b/gcc/gcc-ar.c
@@ -123,7 +123,7 @@ setup_prefixes (const char *exec_path)
}
int
-main(int ac, char **av)
+main (int ac, char **av)
{
const char *exe_name;
char *plugin;
@@ -166,7 +166,7 @@ main(int ac, char **av)
nargv[1] = "--plugin";
nargv[2] = plugin;
if (is_ar && av[1] && av[1][0] != '-')
- av[1] = concat("-", av[1], NULL);
+ av[1] = concat ("-", av[1], NULL);
for (k = 1; k < ac; k++)
nargv[2 + k] = av[k];
nargv[2 + k] = NULL;
@@ -176,18 +176,18 @@ main(int ac, char **av)
err_msg = pex_one (PEX_LAST|PEX_SEARCH,
exe_name,
CONST_CAST2 (char * const *, const char **, nargv),
- concat("gcc-", exe_name, NULL),
+ concat ("gcc-", exe_name, NULL),
NULL,NULL, &status, &err);
if (err_msg)
- fprintf(stderr, "Error running %s: %s\n", exe_name, err_msg);
+ fprintf (stderr, "Error running %s: %s\n", exe_name, err_msg);
else if (status)
{
if (WIFSIGNALED (status))
{
int sig = WTERMSIG (status);
fprintf (stderr, "%s terminated with signal %d [%s]%s\n",
- exe_name, sig, strsignal(sig),
- WCOREDUMP(status) ? ", core dumped" : "");
+ exe_name, sig, strsignal (sig),
+ WCOREDUMP (status) ? ", core dumped" : "");
}
else if (WIFEXITED (status))
exit_code = WEXITSTATUS (status);
diff --git a/gcc/gcc.c b/gcc/gcc.c
index b3ed8d29546..084998f9114 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1556,7 +1556,7 @@ init_spec (void)
/* Prepend "--traditional-format" to whatever asm_spec we had before. */
{
static const char tf[] = "--traditional-format ";
- obstack_grow (&obstack, tf, sizeof(tf) - 1);
+ obstack_grow (&obstack, tf, sizeof (tf) - 1);
obstack_grow0 (&obstack, asm_spec, strlen (asm_spec));
asm_spec = XOBFINISH (&obstack, const char *);
}
@@ -1566,19 +1566,19 @@ init_spec (void)
defined LINKER_HASH_STYLE
# ifdef LINK_BUILDID_SPEC
/* Prepend LINK_BUILDID_SPEC to whatever link_spec we had before. */
- obstack_grow (&obstack, LINK_BUILDID_SPEC, sizeof(LINK_BUILDID_SPEC) - 1);
+ obstack_grow (&obstack, LINK_BUILDID_SPEC, sizeof (LINK_BUILDID_SPEC) - 1);
# endif
# ifdef LINK_EH_SPEC
/* Prepend LINK_EH_SPEC to whatever link_spec we had before. */
- obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
+ obstack_grow (&obstack, LINK_EH_SPEC, sizeof (LINK_EH_SPEC) - 1);
# endif
# ifdef LINKER_HASH_STYLE
/* Prepend --hash-style=LINKER_HASH_STYLE to whatever link_spec we had
before. */
{
static const char hash_style[] = "--hash-style=";
- obstack_grow (&obstack, hash_style, sizeof(hash_style) - 1);
- obstack_grow (&obstack, LINKER_HASH_STYLE, sizeof(LINKER_HASH_STYLE) - 1);
+ obstack_grow (&obstack, hash_style, sizeof (hash_style) - 1);
+ obstack_grow (&obstack, LINKER_HASH_STYLE, sizeof (LINKER_HASH_STYLE) - 1);
obstack_1grow (&obstack, ' ');
}
# endif
@@ -1644,7 +1644,7 @@ set_spec (const char *name, const char *spec, bool user_p)
/* Free the old spec. */
if (old_spec && sl->alloc_p)
- free (CONST_CAST(char *, old_spec));
+ free (CONST_CAST (char *, old_spec));
sl->user_p = user_p;
sl->alloc_p = true;
@@ -2490,7 +2490,7 @@ find_a_file (const struct path_prefix *pprefix, const char *name, int mode,
#endif
#ifdef DEFAULT_LINKER
- if (! strcmp(name, "ld") && access (DEFAULT_LINKER, mode) == 0)
+ if (! strcmp (name, "ld") && access (DEFAULT_LINKER, mode) == 0)
return xstrdup (DEFAULT_LINKER);
#endif
@@ -5748,11 +5748,11 @@ handle_braces (const char *p)
a_is_negated = false;
a_is_spectype = false;
- SKIP_WHITE();
+ SKIP_WHITE ();
if (*p == '!')
p++, a_is_negated = true;
- SKIP_WHITE();
+ SKIP_WHITE ();
if (*p == '%' && p[1] == ':')
{
atom = NULL;
@@ -5767,7 +5767,7 @@ handle_braces (const char *p)
p++, a_is_spectype = true;
atom = p;
- while (ISIDNUM(*p) || *p == '-' || *p == '+' || *p == '='
+ while (ISIDNUM (*p) || *p == '-' || *p == '+' || *p == '='
|| *p == ',' || *p == '.' || *p == '@')
p++;
end_atom = p;
@@ -5776,7 +5776,7 @@ handle_braces (const char *p)
p++, a_is_starred = 1;
}
- SKIP_WHITE();
+ SKIP_WHITE ();
switch (*p)
{
case '&': case '}':
@@ -6081,13 +6081,13 @@ give_switch (int switchnum, int omit_first_word)
while (length-- && !IS_DIR_SEPARATOR (arg[length]))
if (arg[length] == '.')
{
- (CONST_CAST(char *, arg))[length] = 0;
+ (CONST_CAST (char *, arg))[length] = 0;
dot = 1;
break;
}
do_spec_1 (arg, 1, NULL);
if (dot)
- (CONST_CAST(char *, arg))[length] = '.';
+ (CONST_CAST (char *, arg))[length] = '.';
do_spec_1 (suffix_subst, 1, NULL);
}
else
@@ -8402,7 +8402,7 @@ get_random_number (void)
}
#endif
- return ret ^ getpid();
+ return ret ^ getpid ();
}
/* %:compare-debug-dump-opt spec function. Save the last argument,
@@ -8614,7 +8614,7 @@ replace_extension_spec_func (int argc, const char **argv)
name = xstrdup (argv[0]);
- for (i = strlen(name) - 1; i >= 0; i--)
+ for (i = strlen (name) - 1; i >= 0; i--)
if (IS_DIR_SEPARATOR (name[i]))
break;
diff --git a/gcc/gcov-io.c b/gcc/gcov-io.c
index 441aad92833..5a21c1f0691 100644
--- a/gcc/gcov-io.c
+++ b/gcc/gcov-io.c
@@ -386,7 +386,7 @@ gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
h_cnt++;
}
}
- gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH(h_cnt));
+ gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH (h_cnt));
gcov_write_unsigned (summary->checksum);
for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
{
@@ -559,7 +559,7 @@ gcov_read_summary (struct gcov_summary *summary)
while (!cur_bitvector)
{
h_ix = bv_ix * 32;
- gcc_assert(bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE);
+ gcc_assert (bv_ix < GCOV_HISTOGRAM_BITVECTOR_SIZE);
cur_bitvector = histo_bitvector[bv_ix++];
}
while (!(cur_bitvector & 0x1))
@@ -567,7 +567,7 @@ gcov_read_summary (struct gcov_summary *summary)
h_ix++;
cur_bitvector >>= 1;
}
- gcc_assert(h_ix < GCOV_HISTOGRAM_SIZE);
+ gcc_assert (h_ix < GCOV_HISTOGRAM_SIZE);
csum->histogram[h_ix].num_counters = gcov_read_unsigned ();
csum->histogram[h_ix].min_value = gcov_read_counter ();
@@ -709,7 +709,7 @@ static void gcov_histogram_merge (gcov_bucket_type *tgt_histo,
gcov_bucket_type tmp_histo[GCOV_HISTOGRAM_SIZE];
int src_done = 0;
- memset(tmp_histo, 0, sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
+ memset (tmp_histo, 0, sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
/* Assume that the counters are in the same relative order in both
histograms. Walk the histograms from largest to smallest entry,
@@ -797,7 +797,7 @@ static void gcov_histogram_merge (gcov_bucket_type *tgt_histo,
/* The merged counters get placed in the new merged histogram
at the entry for the merged min_value. */
- tmp_i = gcov_histo_index(merge_min);
+ tmp_i = gcov_histo_index (merge_min);
gcc_assert (tmp_i < GCOV_HISTOGRAM_SIZE);
tmp_histo[tmp_i].num_counters += merge_num;
tmp_histo[tmp_i].cum_value += merge_cum;
@@ -829,12 +829,13 @@ static void gcov_histogram_merge (gcov_bucket_type *tgt_histo,
}
/* At this point, tmp_i should be the smallest non-zero entry in the
tmp_histo. */
- gcc_assert(tmp_i >= 0 && tmp_i < GCOV_HISTOGRAM_SIZE
- && tmp_histo[tmp_i].num_counters > 0);
+ gcc_assert (tmp_i >= 0 && tmp_i < GCOV_HISTOGRAM_SIZE
+ && tmp_histo[tmp_i].num_counters > 0);
tmp_histo[tmp_i].cum_value += src_cum;
/* Finally, copy the merged histogram into tgt_histo. */
- memcpy(tgt_histo, tmp_histo, sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
+ memcpy (tgt_histo, tmp_histo,
+ sizeof (gcov_bucket_type) * GCOV_HISTOGRAM_SIZE);
}
#endif /* !IN_GCOV */
diff --git a/gcc/gcov-io.h b/gcc/gcov-io.h
index db1a6bf4c30..ea8d9a7b769 100644
--- a/gcc/gcov-io.h
+++ b/gcc/gcov-io.h
@@ -382,7 +382,7 @@ typedef unsigned HOST_WIDEST_INT gcov_type_unsigned;
/* Return nonzero if SUB is an immediate subtag of TAG. */
#define GCOV_TAG_IS_SUBTAG(TAG,SUB) \
(GCOV_TAG_MASK (TAG) >> 8 == GCOV_TAG_MASK (SUB) \
- && !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK(TAG)))
+ && !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK (TAG)))
/* Return nonzero if SUB is at a sublevel to TAG. */
#define GCOV_TAG_IS_SUBLEVEL(TAG,SUB) \
diff --git a/gcc/gcov.c b/gcc/gcov.c
index 6aa48fd26c2..9458812d86b 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -398,7 +398,7 @@ static void executed_summary (unsigned, unsigned);
static void function_summary (const coverage_t *, const char *);
static const char *format_gcov (gcov_type, gcov_type, int);
static void accumulate_line_counts (source_t *);
-static void output_gcov_file(const char *, source_t *);
+static void output_gcov_file (const char *, source_t *);
static int output_branch_count (FILE *, int, const arc_t *);
static void output_lines (FILE *, const source_t *);
static char *make_gcov_file_name (const char *, const char *);
@@ -448,8 +448,8 @@ main (int argc, char **argv)
for (; argno != argc; argno++)
{
if (flag_display_progress)
- printf("Processing file %d out of %d\n",
- argno - first_arg + 1, argc - first_arg);
+ printf ("Processing file %d out of %d\n",
+ argno - first_arg + 1, argc - first_arg);
process_file (argv[argno]);
}
@@ -621,7 +621,7 @@ get_gcov_intermediate_filename (const char *file_name)
/* Find the 'basename'. */
cptr = lbasename (file_name);
- result = XNEWVEC(char, strlen (cptr) + strlen (gcov) + 1);
+ result = XNEWVEC (char, strlen (cptr) + strlen (gcov) + 1);
sprintf (result, "%s%s", cptr, gcov);
return result;
@@ -699,7 +699,7 @@ output_intermediate_file (FILE *gcov_file, source_t *src)
branch_type = (arc->count > 0) ? "taken" : "nottaken";
else
branch_type = "notexec";
- fprintf(gcov_file, "branch:%d,%s\n", line_num, branch_type);
+ fprintf (gcov_file, "branch:%d,%s\n", line_num, branch_type);
}
}
}
@@ -782,7 +782,7 @@ process_file (const char *file_name)
}
static void
-output_gcov_file(const char *file_name, source_t *src)
+output_gcov_file (const char *file_name, source_t *src)
{
char *gcov_file_name = make_gcov_file_name (file_name, src->coverage.name);
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 422d6f060eb..bb9ba15ea8b 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4169,8 +4169,8 @@ const pass_data pass_data_rtl_pre =
class pass_rtl_pre : public rtl_opt_pass
{
public:
- pass_rtl_pre(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_pre, ctxt)
+ pass_rtl_pre (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_pre, ctxt)
{}
/* opt_pass methods: */
@@ -4208,8 +4208,8 @@ const pass_data pass_data_rtl_hoist =
class pass_rtl_hoist : public rtl_opt_pass
{
public:
- pass_rtl_hoist(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_hoist, ctxt)
+ pass_rtl_hoist (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_hoist, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/genattr-common.c b/gcc/genattr-common.c
index 69bfcae48c7..b0848cff7ec 100644
--- a/gcc/genattr-common.c
+++ b/gcc/genattr-common.c
@@ -33,7 +33,7 @@ static void
write_upcase (const char *str)
{
for (; *str; str++)
- putchar (TOUPPER(*str));
+ putchar (TOUPPER (*str));
}
static void
diff --git a/gcc/genattr.c b/gcc/genattr.c
index e16cad9c79a..0b92243a86d 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -361,10 +361,10 @@ main (int argc, char **argv)
/* Output flag masks for use by reorg.
Flags are used to hold branch direction for use by eligible_for_... */
- printf("\n#define ATTR_FLAG_forward\t0x1\n");
- printf("#define ATTR_FLAG_backward\t0x2\n");
+ printf ("\n#define ATTR_FLAG_forward\t0x1\n");
+ printf ("#define ATTR_FLAG_backward\t0x2\n");
- puts("\n#endif /* GCC_INSN_ATTR_H */");
+ puts ("\n#endif /* GCC_INSN_ATTR_H */");
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 8fcbb1610e6..973cade3fc2 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -90,9 +90,9 @@ along with GCC; see the file COPYING3. If not see
`return_val' (ATTR_PERMANENT_P): This rtx is permanent and unique
(see attr_rtx). */
-#define ATTR_IND_SIMPLIFIED_P(RTX) (RTX_FLAG((RTX), unchanging))
-#define ATTR_CURR_SIMPLIFIED_P(RTX) (RTX_FLAG((RTX), in_struct))
-#define ATTR_PERMANENT_P(RTX) (RTX_FLAG((RTX), return_val))
+#define ATTR_IND_SIMPLIFIED_P(RTX) (RTX_FLAG ((RTX), unchanging))
+#define ATTR_CURR_SIMPLIFIED_P(RTX) (RTX_FLAG ((RTX), in_struct))
+#define ATTR_PERMANENT_P(RTX) (RTX_FLAG ((RTX), return_val))
#if 0
#define strcmp_check(S1, S2) ((S1) == (S2) \
@@ -2815,7 +2815,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
x = evaluate_eq_attr (exp, attr, av->value,
insn_code, insn_index);
x = SIMPLIFY_TEST_EXP (x, insn_code, insn_index);
- if (attr_rtx_cost(x) < 7)
+ if (attr_rtx_cost (x) < 7)
return x;
}
}
@@ -4403,7 +4403,7 @@ write_upcase (FILE *outf, const char *str)
while (*str)
{
/* The argument of TOUPPER should not have side effects. */
- fputc (TOUPPER(*str), outf);
+ fputc (TOUPPER (*str), outf);
str++;
}
}
@@ -5285,7 +5285,7 @@ main (int argc, char **argv)
{
FILE *outf;
-#define IS_ATTR_GROUP(X) (!strncmp(attr->name,X,strlen(X)))
+#define IS_ATTR_GROUP(X) (!strncmp (attr->name, X, strlen (X)))
if (IS_ATTR_GROUP ("*internal_dfa_insn_code"))
outf = dfa_file;
else if (IS_ATTR_GROUP ("*insn_default_latency"))
diff --git a/gcc/genautomata.c b/gcc/genautomata.c
index add4624ba17..a0bf0767aa9 100644
--- a/gcc/genautomata.c
+++ b/gcc/genautomata.c
@@ -5533,7 +5533,7 @@ static reserv_sets_t
form_reservs_matter (automaton_t automaton)
{
int cycle, unit;
- reserv_sets_t reservs_matter = alloc_empty_reserv_sets();
+ reserv_sets_t reservs_matter = alloc_empty_reserv_sets ();
for (cycle = 0; cycle < max_cycles_num; cycle++)
for (unit = 0; unit < description->units_num; unit++)
@@ -7558,7 +7558,7 @@ output_trans_table (automaton_t automaton)
{
size_t i;
arc_t arc;
- vla_hwint_t transition_vect = vla_hwint_t();
+ vla_hwint_t transition_vect = vla_hwint_t ();
undefined_vect_el_value = automaton->achieved_states_num;
automaton->trans_table = create_state_ainsn_table (automaton);
@@ -7742,7 +7742,7 @@ output_dead_lock_vect (automaton_t automaton)
{
size_t i;
arc_t arc;
- vla_hwint_t dead_lock_vect = vla_hwint_t();
+ vla_hwint_t dead_lock_vect = vla_hwint_t ();
/* Create vect of pointers to states ordered by num of
transitions from the state (state with the maximum num is the
@@ -7787,7 +7787,7 @@ output_dead_lock_vect (automaton_t automaton)
static void
output_reserved_units_table (automaton_t automaton)
{
- vla_hwint_t reserved_units_table = vla_hwint_t();
+ vla_hwint_t reserved_units_table = vla_hwint_t ();
int state_byte_size;
int reserved_units_size;
size_t n;
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 81edc7466ab..498dd72e375 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -355,7 +355,7 @@ main (int argc, char **argv)
printf ("#define MAX_INSNS_PER_PEEP2 %d\n", max_insns_per_peep2);
}
- puts("\n#endif /* GCC_INSN_CONFIG_H */");
+ puts ("\n#endif /* GCC_INSN_CONFIG_H */");
if (ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
diff --git a/gcc/genemit.c b/gcc/genemit.c
index 692ef526abf..d4bb301320d 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -68,7 +68,7 @@ print_code (RTX_CODE code)
{
const char *p1;
for (p1 = GET_RTX_NAME (code); *p1; p1++)
- putchar (TOUPPER(*p1));
+ putchar (TOUPPER (*p1));
}
static void
diff --git a/gcc/genextract.c b/gcc/genextract.c
index 6d2d3d2d0bb..35fc91e8806 100644
--- a/gcc/genextract.c
+++ b/gcc/genextract.c
@@ -165,9 +165,9 @@ gen_insn (rtx insn, int insn_code_number)
p->duplocs = p->oplocs + op_count;
p->dupnums = (int *)(p->duplocs + dup_count);
- memcpy(p->oplocs, acc.oplocs.address(), op_count*sizeof(locstr));
- memcpy(p->duplocs, acc.duplocs.address(), dup_count*sizeof(locstr));
- memcpy(p->dupnums, acc.dupnums.address(), dup_count*sizeof(int));
+ memcpy (p->oplocs, acc.oplocs.address (), op_count * sizeof (locstr));
+ memcpy (p->duplocs, acc.duplocs.address (), dup_count * sizeof (locstr));
+ memcpy (p->dupnums, acc.dupnums.address (), dup_count * sizeof (int));
done:
acc.oplocs.release ();
@@ -334,7 +334,7 @@ print_path (const char *path)
{
if (ISLOWER (path[i]))
printf (", 0, %d)", path[i] - 'a');
- else if (ISDIGIT(path[i]))
+ else if (ISDIGIT (path[i]))
printf (", %d)", path[i] - '0');
else
gcc_unreachable ();
diff --git a/gcc/genflags.c b/gcc/genflags.c
index df329b5a806..80d8315e41b 100644
--- a/gcc/genflags.c
+++ b/gcc/genflags.c
@@ -109,7 +109,7 @@ gen_macro (const char *name, int real, int expect)
for (i = 0; name[i]; i++)
putchar (TOUPPER (name[i]));
- putchar('(');
+ putchar ('(');
for (i = 0; i < expect - 1; i++)
printf ("%c, ", i + 'A');
printf ("%c) gen_%s (", i + 'A', name);
@@ -290,7 +290,7 @@ main (int argc, char **argv)
for (insn_ptr = insns; *insn_ptr; insn_ptr++)
gen_proto (*insn_ptr);
- puts("\n#endif /* GCC_INSN_FLAGS_H */");
+ puts ("\n#endif /* GCC_INSN_FLAGS_H */");
if (have_error || ferror (stdout) || fflush (stdout) || fclose (stdout))
return FATAL_EXIT_CODE;
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index 5b5a3ca0308..4a35683c896 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -37,7 +37,7 @@ static const struct rtx_definition defs[] =
{
#include "rtl.def" /* rtl expressions are documented here */
};
-#define NUM_RTX_CODE ARRAY_SIZE(defs)
+#define NUM_RTX_CODE ARRAY_SIZE (defs)
static const char *formats[NUM_RTX_CODE];
diff --git a/gcc/gengtype-state.c b/gcc/gengtype-state.c
index ba7948a1ff0..96ecc7cdaf8 100644
--- a/gcc/gengtype-state.c
+++ b/gcc/gengtype-state.c
@@ -142,7 +142,7 @@ static long state_bol = 0; /* offset of beginning of line */
class s_expr_writer
{
public:
- s_expr_writer();
+ s_expr_writer ();
void write_new_line ();
void write_any_indent (int leading_spaces);
@@ -151,15 +151,15 @@ public:
void end_s_expr ();
private:
- int indent_amount_;
- int had_recent_newline_;
+ int m_indent_amount;
+ int m_had_recent_newline;
}; // class s_expr_writer
/* A class for writing out "gtype.state". */
class state_writer : public s_expr_writer
{
public:
- state_writer();
+ state_writer ();
private:
void write_state_fileloc (struct fileloc *floc);
@@ -200,14 +200,14 @@ private:
private:
/* Counter of written types. */
- int state_written_type_count;
+ int m_state_written_type_count;
}; // class state_writer
/* class s_expr_writer's trivial constructor. */
-s_expr_writer::s_expr_writer()
- : indent_amount_(0),
- had_recent_newline_(0)
+s_expr_writer::s_expr_writer ()
+ : m_indent_amount (0),
+ m_had_recent_newline (0)
{
}
@@ -216,10 +216,10 @@ void
s_expr_writer::write_new_line (void)
{
/* Don't add a newline if we've just had one. */
- if (!had_recent_newline_)
+ if (!m_had_recent_newline)
{
fprintf (state_file, "\n");
- had_recent_newline_ = 1;
+ m_had_recent_newline = 1;
}
}
@@ -236,11 +236,11 @@ void
s_expr_writer::write_any_indent (int leading_spaces)
{
int i;
- int amount = indent_amount_ - leading_spaces;
- if (had_recent_newline_)
+ int amount = m_indent_amount - leading_spaces;
+ if (m_had_recent_newline)
for (i = 0; i < amount; i++)
fprintf (state_file, " ");
- had_recent_newline_ = 0;
+ m_had_recent_newline = 0;
}
/* Write the beginning of a new s-expresion e.g. "(!foo "
@@ -253,7 +253,7 @@ s_expr_writer::begin_s_expr (const char *tag)
write_new_line ();
write_any_indent (0);
fprintf (state_file, "(!%s ", tag);
- indent_amount_++;
+ m_indent_amount++;
}
/* Write out the end of an s-expression: any necssessary indentation,
@@ -261,7 +261,7 @@ s_expr_writer::begin_s_expr (const char *tag)
void
s_expr_writer::end_s_expr (void)
{
- indent_amount_--;
+ m_indent_amount--;
write_any_indent (0);
fprintf (state_file, ")");
write_new_line ();
@@ -269,9 +269,9 @@ s_expr_writer::end_s_expr (void)
/* class state_writer's trivial constructor. */
-state_writer::state_writer()
- : s_expr_writer(),
- state_written_type_count(0)
+state_writer::state_writer ()
+ : s_expr_writer (),
+ m_state_written_type_count (0)
{
}
@@ -309,7 +309,7 @@ fatal_reading_state (struct state_token_st* tok, const char*msg)
else \
fatal ("%s:%d: Invalid state file; " Fmt, \
state_path, state_line, __VA_ARGS__); \
- } while(0)
+ } while (0)
/* Find or allocate an identifier in our name hash table. */
@@ -1136,10 +1136,10 @@ state_writer::write_state_type (type_p current)
}
else
{
- state_written_type_count++;
- DBGPRINTF ("writing type #%d @%p old number %d", state_written_type_count,
+ m_state_written_type_count++;
+ DBGPRINTF ("writing type #%d @%p old number %d", m_state_written_type_count,
(void *) current, current->state_number);
- current->state_number = state_written_type_count;
+ current->state_number = m_state_written_type_count;
switch (current->kind)
{
case TYPE_NONE:
@@ -1441,7 +1441,7 @@ write_state (const char *state_path)
if (verbosity_level >= 1)
printf ("%s wrote state file %s of %ld bytes with %d GTY-ed types\n",
- progname, state_path, statelen, sw.state_written_type_count);
+ progname, state_path, statelen, sw.m_state_written_type_count);
}
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index c12a4e2393d..b9bef4df76c 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -617,7 +617,7 @@ type_for_name (const char *s)
extern GTY(()) gcc::some_type *some_ptr;
where the autogenerated functions will refer to simply "some_type",
where they can be resolved into their namespace. */
- if (0 == strncmp(s, "gcc::", 5))
+ if (0 == strncmp (s, "gcc::", 5))
s += 5;
for (p = typedefs; p != NULL; p = p->next)
@@ -953,7 +953,7 @@ create_field_at (pair_p next, type_p type, const char *name, options_p opt,
/* Create a fake field with the given type and name. NEXT is the next
field in the chain. */
#define create_field(next,type,name) \
- create_field_all(next,type,name, 0, this_file, __LINE__)
+ create_field_all (next,type,name, 0, this_file, __LINE__)
/* Like create_field, but the field is only valid when condition COND
is true. */
@@ -1736,7 +1736,7 @@ open_base_files (void)
"tree.h", "rtl.h", "function.h", "insn-config.h", "expr.h",
"hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
- "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
+ "tree-ssa.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
"except.h", "output.h", "gimple.h", "cfgloop.h",
"target.h", "ipa-prop.h", "lto-streamer.h", "target-globals.h",
"ipa-inline.h", "dwarf2out.h", NULL
@@ -2004,14 +2004,21 @@ struct file_rule_st files_rules[] = {
REG_EXTENDED, NULL_REGEX,
"gt-objc-objc-map.h", "objc/objc-map.c", NULL_FRULACT },
- /* General cases. For header *.h and source *.c files, we need
- * special actions to handle the language. */
+ /* General cases. For header *.h and source *.c or *.cc files, we
+ * need special actions to handle the language. */
/* Source *.c files are using get_file_gtfilename to compute their
output_name and get_file_basename to compute their for_name
through the source_dot_c_frul action. */
{ DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.c$",
REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.c", source_dot_c_frul},
+
+ /* Source *.cc files are using get_file_gtfilename to compute their
+ output_name and get_file_basename to compute their for_name
+ through the source_dot_c_frul action. */
+ { DIR_PREFIX_REGEX "([[:alnum:]_-]*)\\.cc$",
+ REG_EXTENDED, NULL_REGEX, "gt-$3.h", "$3.cc", source_dot_c_frul},
+
/* Common header files get "gtype-desc.c" as their output_name,
* while language specific header files are handled specially. So
* we need the header_dot_h_frul action. */
@@ -2124,7 +2131,7 @@ matching_file_name_substitute (const char *filnam, regmatch_t pmatch[10],
else
{
/* This can happen only when files_rules is buggy! */
- gcc_unreachable();
+ gcc_unreachable ();
}
/* Always skip the character after the dollar. */
pt++;
@@ -2269,9 +2276,9 @@ get_output_file_with_visibility (input_file *inpf)
}
if (!output_name || !for_name)
{
- /* This is impossible, and could only happen if the files_rules is
- incomplete or buggy. */
- gcc_unreachable ();
+ /* This should not be possible, and could only happen if the
+ files_rules is incomplete or buggy. */
+ fatal ("failed to compute output name for %s", inpfname);
}
/* Look through to see if we've ever seen this output filename
@@ -2537,7 +2544,7 @@ output_mangled_typename (outf_p of, const_type_p t)
oprintf (of, "%lu%s", (unsigned long) strlen (id_for_tag),
id_for_tag);
if (id_for_tag != t->u.s.tag)
- free (CONST_CAST(char *, id_for_tag));
+ free (CONST_CAST (char *, id_for_tag));
}
break;
case TYPE_PARAM_STRUCT:
@@ -3322,7 +3329,7 @@ write_marker_function_name (outf_p of, type_p s, const char *prefix)
const char *id_for_tag = filter_type_name (s->u.s.tag);
oprintf (of, "gt_%sx_%s", prefix, id_for_tag);
if (id_for_tag != s->u.s.tag)
- free (CONST_CAST(char *, id_for_tag));
+ free (CONST_CAST (char *, id_for_tag));
}
else if (s->kind == TYPE_PARAM_STRUCT)
{
@@ -3656,7 +3663,7 @@ write_types (outf_p output_header, type_p structures, type_p param_structs,
"#define gt_%sx_%s gt_%sx_%s\n",
wtd->prefix, s->u.s.tag, wtd->prefix, t_id_for_tag);
if (t_id_for_tag != t->u.s.tag)
- free (CONST_CAST(char *, t_id_for_tag));
+ free (CONST_CAST (char *, t_id_for_tag));
}
else
error_at_line (&s->u.s.line,
@@ -3672,7 +3679,7 @@ write_types (outf_p output_header, type_p structures, type_p param_structs,
wtd->prefix, s_id_for_tag);
if (s_id_for_tag != s->u.s.tag)
- free (CONST_CAST(char *, s_id_for_tag));
+ free (CONST_CAST (char *, s_id_for_tag));
if (s->u.s.line.file == NULL)
{
@@ -4366,7 +4373,7 @@ write_root (outf_p f, pair_p v, type_p type, const char *name, int has_length,
else
oprintf (f, " NULL");
if (id_for_tag != tp->u.s.tag)
- free (CONST_CAST(char *, id_for_tag));
+ free (CONST_CAST (char *, id_for_tag));
}
else if (!has_length && tp->kind == TYPE_PARAM_STRUCT)
{
@@ -4782,7 +4789,7 @@ write_typed_alloc_def (outf_p f,
oprintf (f, ", n");
oprintf (f, " MEM_STAT_INFO)))\n");
if (type_name_as_id != type_name)
- free (CONST_CAST(char *, type_name_as_id));
+ free (CONST_CAST (char *, type_name_as_id));
}
/* Writes a typed allocator definition into output F for a struct or
@@ -4849,7 +4856,7 @@ write_typed_alloc_defns (outf_p f,
relevant to plugin input files. */
if (nb_plugin_files > 0)
{
- struct fileloc* filoc = type_fileloc(s);
+ struct fileloc* filoc = type_fileloc (s);
if (!filoc || !filoc->file->inpisplugin)
continue;
};
@@ -5463,7 +5470,7 @@ main (int argc, char **argv)
we can see them. We should initialize them before calling
read_input_list. */
#define POS_HERE(Call) do { pos.file = this_file; pos.line = __LINE__; \
- Call;} while(0)
+ Call;} while (0)
POS_HERE (do_scalar_typedef ("CUMULATIVE_ARGS", &pos));
POS_HERE (do_scalar_typedef ("REAL_VALUE_TYPE", &pos));
POS_HERE (do_scalar_typedef ("FIXED_VALUE_TYPE", &pos));
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index dc384833871..a0b2f21f11b 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -418,7 +418,7 @@ complete_all_modes (void)
}
/* For each mode in class CLASS, construct a corresponding complex mode. */
-#define COMPLEX_MODES(C) make_complex_modes(MODE_##C, __FILE__, __LINE__)
+#define COMPLEX_MODES(C) make_complex_modes (MODE_##C, __FILE__, __LINE__)
static void
make_complex_modes (enum mode_class cl,
const char *file, unsigned int line)
@@ -474,7 +474,7 @@ make_complex_modes (enum mode_class cl,
/* For all modes in class CL, construct vector modes of width
WIDTH, having as many components as necessary. */
-#define VECTOR_MODES(C, W) make_vector_modes(MODE_##C, W, __FILE__, __LINE__)
+#define VECTOR_MODES(C, W) make_vector_modes (MODE_##C, W, __FILE__, __LINE__)
static void ATTRIBUTE_UNUSED
make_vector_modes (enum mode_class cl, unsigned int width,
const char *file, unsigned int line)
@@ -522,7 +522,8 @@ make_vector_modes (enum mode_class cl, unsigned int width,
/* Input. */
-#define _SPECIAL_MODE(C, N) make_special_mode(MODE_##C, #N, __FILE__, __LINE__)
+#define _SPECIAL_MODE(C, N) \
+ make_special_mode (MODE_##C, #N, __FILE__, __LINE__)
#define RANDOM_MODE(N) _SPECIAL_MODE (RANDOM, N)
#define CC_MODE(N) _SPECIAL_MODE (CC, N)
@@ -704,11 +705,11 @@ make_vector_mode (enum mode_class bclass,
#define _ADD_ADJUST(A, M, X, C1, C2) \
new_adjust (#M, &adj_##A, #A, #X, MODE_##C1, MODE_##C2, __FILE__, __LINE__)
-#define ADJUST_BYTESIZE(M, X) _ADD_ADJUST(bytesize, M, X, RANDOM, RANDOM)
-#define ADJUST_ALIGNMENT(M, X) _ADD_ADJUST(alignment, M, X, RANDOM, RANDOM)
-#define ADJUST_FLOAT_FORMAT(M, X) _ADD_ADJUST(format, M, X, FLOAT, FLOAT)
-#define ADJUST_IBIT(M, X) _ADD_ADJUST(ibit, M, X, ACCUM, UACCUM)
-#define ADJUST_FBIT(M, X) _ADD_ADJUST(fbit, M, X, FRACT, UACCUM)
+#define ADJUST_BYTESIZE(M, X) _ADD_ADJUST (bytesize, M, X, RANDOM, RANDOM)
+#define ADJUST_ALIGNMENT(M, X) _ADD_ADJUST (alignment, M, X, RANDOM, RANDOM)
+#define ADJUST_FLOAT_FORMAT(M, X) _ADD_ADJUST (format, M, X, FLOAT, FLOAT)
+#define ADJUST_IBIT(M, X) _ADD_ADJUST (ibit, M, X, ACCUM, UACCUM)
+#define ADJUST_FBIT(M, X) _ADD_ADJUST (fbit, M, X, FRACT, UACCUM)
static void
create_modes (void)
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index fb8071765dd..9c7cf2c06a4 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -194,7 +194,7 @@ match_pattern (pattern *p, const char *name, const char *pat)
for (i = (MAX_MACHINE_MODE) - 1; i >= 0; i--)
{
const char *p, *q;
- for (p = GET_MODE_NAME(i), q = name; *p; p++, q++)
+ for (p = GET_MODE_NAME (i), q = name; *p; p++, q++)
if (TOLOWER (*p) != *q)
break;
if (*p == 0
@@ -372,7 +372,7 @@ main (int argc, char **argv)
/* Sort the (real) optabs. Better than forcing the optabs.def file to
remain sorted by kind. We also scrogged any real ordering with the
purging of the X patterns above. */
- qsort (optabs, n, sizeof(optab_def), optab_kind_cmp);
+ qsort (optabs, n, sizeof (optab_def), optab_kind_cmp);
/* Emit the optab enumeration for the header file. */
fprintf (h_file, "enum optab_tag {\n");
diff --git a/gcc/genoutput.c b/gcc/genoutput.c
index 59afaa452aa..c3a0936fc97 100644
--- a/gcc/genoutput.c
+++ b/gcc/genoutput.c
@@ -286,9 +286,9 @@ output_operand_data (void)
pred = lookup_predicate (d->predicate);
printf (" %d\n", pred && pred->codes[MEM]);
- printf(" },\n");
+ printf (" },\n");
}
- printf("};\n\n\n");
+ printf ("};\n\n\n");
}
static void
@@ -415,7 +415,7 @@ output_insn_data (void)
printf (" %d,\n", d->n_alternatives);
printf (" %d\n", d->output_format);
- printf(" },\n");
+ printf (" },\n");
}
printf ("};\n\n\n");
}
@@ -1112,7 +1112,7 @@ main (int argc, char **argv)
next_index_number++;
}
- printf("\n\n");
+ printf ("\n\n");
output_operand_data ();
output_insn_data ();
output_get_insn_name ();
@@ -1223,7 +1223,7 @@ note_constraint (rtx exp, int lineno)
}
}
new_cdata = XNEWVAR (struct constraint_data, sizeof (struct constraint_data) + namelen);
- strcpy (CONST_CAST(char *, new_cdata->name), name);
+ strcpy (CONST_CAST (char *, new_cdata->name), name);
new_cdata->namelen = namelen;
new_cdata->lineno = lineno;
new_cdata->next_this_letter = *slot;
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index 81bd9df64bb..a14d061a50b 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -334,7 +334,7 @@ print_code (RTX_CODE code)
{
const char *p1;
for (p1 = GET_RTX_NAME (code); *p1; p1++)
- putchar (TOUPPER(*p1));
+ putchar (TOUPPER (*p1));
}
extern int main (int, char **);
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index 98488e30b8b..f3d9dac9c55 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -529,7 +529,7 @@ write_match_code_switch (rtx exp)
putchar (TOUPPER (*code));
code++;
}
- fputs(":\n", stdout);
+ fputs (":\n", stdout);
}
}
@@ -596,9 +596,9 @@ write_predicate_stmts (rtx exp)
break;
}
- fputs(" return ",stdout);
+ fputs (" return ",stdout);
write_predicate_expr (exp);
- fputs(";\n", stdout);
+ fputs (";\n", stdout);
}
/* Given a predicate, write out a complete C function to compute it. */
@@ -932,7 +932,7 @@ write_lookup_constraint (void)
" switch (str[0])\n"
" {");
- for (i = 0; i < ARRAY_SIZE(constraints_by_letter_table); i++)
+ for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++)
{
struct constraint_data *c = constraints_by_letter_table[i];
if (!c)
@@ -975,7 +975,7 @@ write_insn_constraint_len (void)
" switch (fc)\n"
" {");
- for (i = 0; i < ARRAY_SIZE(constraints_by_letter_table); i++)
+ for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++)
{
struct constraint_data *c = constraints_by_letter_table[i];
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 691b0281175..814be7d17e3 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -58,7 +58,7 @@
#include "gensupport.h"
#define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
- printf("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER))
+ printf ("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER))
/* Ways of obtaining an rtx to be tested. */
enum position_type {
@@ -1619,7 +1619,7 @@ write_afterward (struct decision *start, struct decision *afterward,
const char *indent)
{
if (!afterward || start->subroutine_number > 0)
- printf("%sgoto ret0;\n", indent);
+ printf ("%sgoto ret0;\n", indent);
else
{
change_state (start->position, afterward->position, indent);
@@ -1669,7 +1669,7 @@ write_switch (struct decision *start, int depth)
struct decision *ret;
RTX_CODE code;
- memset (codemap, 0, sizeof(codemap));
+ memset (codemap, 0, sizeof (codemap));
printf (" switch (GET_CODE (x%d))\n {\n", depth);
code = p->tests->u.code;
@@ -1762,7 +1762,8 @@ write_switch (struct decision *start, int depth)
if (type == DT_elt_zero_wide_safe)
{
indent = " ";
- printf(" if ((int) XWINT (x%d, 0) == XWINT (x%d, 0))\n", depth, depth);
+ printf (" if ((int) XWINT (x%d, 0) == XWINT (x%d, 0))\n",
+ depth, depth);
}
printf ("%s switch (", indent);
switch (type)
@@ -1937,7 +1938,7 @@ write_action (struct decision *p, struct decision_test *test,
if (test->type == DT_accept_op)
{
- printf("%soperands[%d] = x%d;\n", indent, test->u.opno, depth);
+ printf ("%soperands[%d] = x%d;\n", indent, test->u.opno, depth);
/* Only allow DT_accept_insn to follow. */
if (test->next)
@@ -1992,7 +1993,7 @@ write_action (struct decision *p, struct decision_test *test,
}
else
{
- printf("%sgoto L%d;\n", indent, success->number);
+ printf ("%sgoto L%d;\n", indent, success->number);
success->need_label = 1;
}
@@ -2357,7 +2358,7 @@ make_insn_sequence (rtx insn, enum routine_type type)
validate_pattern (x, insn, NULL_RTX, 0);
- memset(&head, 0, sizeof(head));
+ memset (&head, 0, sizeof (head));
last = add_to_sequence (x, &head, &root_pos, type, 1);
/* Find the end of the test chain on the last node. */
@@ -2423,7 +2424,7 @@ make_insn_sequence (rtx insn, enum routine_type type)
}
/* Recognize it. */
- memset (&clobber_head, 0, sizeof(clobber_head));
+ memset (&clobber_head, 0, sizeof (clobber_head));
last = add_to_sequence (new_rtx, &clobber_head, &root_pos,
type, 1);
@@ -2493,7 +2494,7 @@ process_tree (struct decision_head *head, enum routine_type subroutine_type)
/* We run this after find_afterward, because find_afterward needs
the redundant DT_mode tests on predicates to determine whether
two tests can both be true or not. */
- simplify_tests(head);
+ simplify_tests (head);
write_subroutines (head, subroutine_type);
}
@@ -2601,12 +2602,12 @@ debug_decision_2 (struct decision_test *test)
break;
case DT_pred:
fprintf (stderr, "pred=(%s,%s)",
- test->u.pred.name, GET_MODE_NAME(test->u.pred.mode));
+ test->u.pred.name, GET_MODE_NAME (test->u.pred.mode));
break;
case DT_c_test:
{
char sub[16+4];
- strncpy (sub, test->u.c_test, sizeof(sub));
+ strncpy (sub, test->u.c_test, sizeof (sub));
memcpy (sub+16, "...", 4);
fprintf (stderr, "c_test=\"%s\"", sub);
}
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index c7a27c42617..28165e37137 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -392,7 +392,7 @@ static struct queue_elem *
queue_pattern (rtx pattern, struct queue_elem ***list_tail,
const char *filename, int lineno)
{
- struct queue_elem *e = XNEW(struct queue_elem);
+ struct queue_elem *e = XNEW (struct queue_elem);
e->data = pattern;
e->filename = filename;
e->lineno = lineno;
@@ -429,7 +429,7 @@ remove_from_queue (struct queue_elem *elem, struct queue_elem **queue)
static void
add_define_attr (const char *name)
{
- struct queue_elem *e = XNEW(struct queue_elem);
+ struct queue_elem *e = XNEW (struct queue_elem);
rtx t1 = rtx_alloc (DEFINE_ATTR);
XSTR (t1, 0) = name;
XSTR (t1, 1) = "no,yes";
@@ -2870,7 +2870,7 @@ record_insn_name (int code, const char *name)
new_size = (insn_name_ptr_size ? insn_name_ptr_size * 2 : 512);
insn_name_ptr = XRESIZEVEC (char *, insn_name_ptr, new_size);
memset (insn_name_ptr + insn_name_ptr_size, 0,
- sizeof(char *) * (new_size - insn_name_ptr_size));
+ sizeof (char *) * (new_size - insn_name_ptr_size));
insn_name_ptr_size = new_size;
}
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 0bb2eb19f23..dcabd61433d 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -488,7 +488,7 @@ gt_pch_save (FILE *f)
char *this_object = NULL;
size_t this_object_size = 0;
struct mmap_info mmi;
- const size_t mmap_offset_alignment = host_hooks.gt_pch_alloc_granularity();
+ const size_t mmap_offset_alignment = host_hooks.gt_pch_alloc_granularity ();
gt_pch_save_stringpool ();
@@ -749,7 +749,7 @@ default_gt_pch_use_address (void *base, size_t size, int fd ATTRIBUTE_UNUSED,
size_t
default_gt_pch_alloc_granularity (void)
{
- return getpagesize();
+ return getpagesize ();
}
#if HAVE_MMAP_FILE
@@ -837,7 +837,7 @@ ggc_rlimit_bound (double limit)
static int
ggc_min_expand_heuristic (void)
{
- double min_expand = physmem_total();
+ double min_expand = physmem_total ();
/* Adjust for rlimits. */
min_expand = ggc_rlimit_bound (min_expand);
@@ -856,7 +856,7 @@ ggc_min_expand_heuristic (void)
static int
ggc_min_heapsize_heuristic (void)
{
- double phys_kbytes = physmem_total();
+ double phys_kbytes = physmem_total ();
double limit_kbytes = ggc_rlimit_bound (phys_kbytes * 2);
phys_kbytes /= 1024; /* Convert to Kbytes. */
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index eab7b676e97..249aa010507 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc-internal.h"
#include "timevar.h"
#include "params.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "plugin.h"
@@ -462,7 +462,7 @@ static struct globals
/* The size in bytes required to maintain a bitmap for the objects
on a page-entry. */
#define BITMAP_SIZE(Num_objects) \
- (CEIL ((Num_objects), HOST_BITS_PER_LONG) * sizeof(long))
+ (CEIL ((Num_objects), HOST_BITS_PER_LONG) * sizeof (long))
/* Allocate pages in chunks of this size, to throttle calls to memory
allocation routines. The first page is used, the rest go onto the
@@ -785,7 +785,7 @@ alloc_page (unsigned order)
page = alloc_anon (NULL, G.pagesize * GGC_QUIRE_SIZE, false);
if (page == NULL)
{
- page = alloc_anon(NULL, G.pagesize, true);
+ page = alloc_anon (NULL, G.pagesize, true);
entries = 1;
}
@@ -1644,7 +1644,7 @@ init_ggc (void)
{
unsigned order;
- G.pagesize = getpagesize();
+ G.pagesize = getpagesize ();
G.lg_pagesize = exact_log2 (G.pagesize);
#ifdef HAVE_MMAP_DEV_ZERO
@@ -2163,7 +2163,7 @@ ggc_print_statistics (void)
}
fprintf (stderr, "%-5s %10lu%c %10lu%c %10lu%c\n", "Total",
SCALE (G.bytes_mapped), STAT_LABEL (G.bytes_mapped),
- SCALE (G.allocated), STAT_LABEL(G.allocated),
+ SCALE (G.allocated), STAT_LABEL (G.allocated),
SCALE (total_overhead), STAT_LABEL (total_overhead));
if (GATHER_STATISTICS)
@@ -2315,13 +2315,13 @@ ggc_pch_write_object (struct ggc_pch_data *d,
if (size != OBJECT_SIZE (order))
{
- unsigned padding = OBJECT_SIZE(order) - size;
+ unsigned padding = OBJECT_SIZE (order) - size;
/* To speed small writes, we use a nulled-out array that's larger
than most padding requests as the source for our null bytes. This
permits us to do the padding with fwrite() rather than fseek(), and
limits the chance the OS may try to flush any outstanding writes. */
- if (padding <= sizeof(emptyBytes))
+ if (padding <= sizeof (emptyBytes))
{
if (fwrite (emptyBytes, 1, padding, f) != padding)
fatal_error ("can%'t write PCH file");
@@ -2419,7 +2419,7 @@ ggc_pch_read (FILE *f, void *addr)
#endif
/* Since we free all the allocated objects, the free list becomes
useless. Validate it now, which will also clear it. */
- validate_free_objects();
+ validate_free_objects ();
/* No object read from a PCH file should ever be freed. So, set the
context depth to 1, and set the depth of all the currently-allocated
diff --git a/gcc/gimple-builder.c b/gcc/gimple-builder.c
new file mode 100644
index 00000000000..665c8020b93
--- /dev/null
+++ b/gcc/gimple-builder.c
@@ -0,0 +1,118 @@
+/* Functions for high level gimple building routines.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tree.h"
+#include "gimple.h"
+#include "tree-ssa.h"
+
+
+/* Return the expression type to use based on the CODE and type of
+ the given operand OP. If the expression CODE is a comparison,
+ the returned type is boolean_type_node. Otherwise, it returns
+ the type of OP. */
+
+static tree
+get_expr_type (enum tree_code code, tree op)
+{
+ return (TREE_CODE_CLASS (code) == tcc_comparison)
+ ? boolean_type_node
+ : TREE_TYPE (op);
+}
+
+
+/* Build a new gimple assignment. The LHS of the assignment is a new
+ temporary whose type matches the given expression. MODE indicates
+ whether the LHS should be an SSA or a normal temporary. CODE is
+ the expression code for the RHS. OP1 is the first operand and VAL
+ is an integer value to be used as the second operand. */
+
+gimple
+build_assign (enum tree_code code, tree op1, int val, tree lhs)
+{
+ tree op2 = build_int_cst (TREE_TYPE (op1), val);
+ if (lhs == NULL_TREE)
+ lhs = make_ssa_name (get_expr_type (code, op1), NULL);
+ return gimple_build_assign_with_ops (code, lhs, op1, op2);
+}
+
+gimple
+build_assign (enum tree_code code, gimple g, int val, tree lhs )
+{
+ return build_assign (code, gimple_assign_lhs (g), val, lhs);
+}
+
+
+/* Build and return a new GIMPLE assignment. The new assignment will
+ have the opcode CODE and operands OP1 and OP2. The type of the
+ expression on the RHS is inferred to be the type of OP1.
+
+ The LHS of the statement will be an SSA name or a GIMPLE temporary
+ in normal form depending on the type of builder invoking this
+ function. */
+
+gimple
+build_assign (enum tree_code code, tree op1, tree op2, tree lhs)
+{
+ if (lhs == NULL_TREE)
+ lhs = make_ssa_name (get_expr_type (code, op1), NULL);
+ return gimple_build_assign_with_ops (code, lhs, op1, op2);
+}
+
+gimple
+build_assign (enum tree_code code, gimple op1, tree op2, tree lhs)
+{
+ return build_assign (code, gimple_assign_lhs (op1), op2, lhs);
+}
+
+gimple
+build_assign (enum tree_code code, tree op1, gimple op2, tree lhs)
+{
+ return build_assign (code, op1, gimple_assign_lhs (op2), lhs);
+}
+
+gimple
+build_assign (enum tree_code code, gimple op1, gimple op2, tree lhs)
+{
+ return build_assign (code, gimple_assign_lhs (op1), gimple_assign_lhs (op2),
+ lhs);
+}
+
+
+/* Create and return a type cast assignment. This creates a NOP_EXPR
+ that converts OP to TO_TYPE. */
+
+gimple
+build_type_cast (tree to_type, tree op, tree lhs)
+{
+ if (lhs == NULL_TREE)
+ lhs = make_ssa_name (to_type, NULL);
+ return gimple_build_assign_with_ops (NOP_EXPR, lhs, op, NULL_TREE);
+}
+
+gimple
+build_type_cast (tree to_type, gimple op, tree lhs)
+{
+ return build_type_cast (to_type, gimple_assign_lhs (op), lhs);
+}
+
+
+
diff --git a/gcc/gimple-builder.h b/gcc/gimple-builder.h
new file mode 100644
index 00000000000..532c04e2189
--- /dev/null
+++ b/gcc/gimple-builder.h
@@ -0,0 +1,34 @@
+/* Header file for high level statement building routines.
+ Copyright (C) 2013 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/>. */
+
+
+#ifndef GCC_GIMPLE_BUILDER_H
+#define GCC_GIMPLE_BUILDER_H
+
+tree create_gimple_tmp (tree, tree lhs = NULL_TREE);
+gimple build_assign (enum tree_code, tree, int, tree lhs = NULL_TREE);
+gimple build_assign (enum tree_code, gimple, int, tree lhs = NULL_TREE);
+gimple build_assign (enum tree_code, tree, tree, tree lhs = NULL_TREE);
+gimple build_assign (enum tree_code, gimple, tree, tree lhs = NULL_TREE);
+gimple build_assign (enum tree_code, tree, gimple, tree lhs = NULL_TREE);
+gimple build_assign (enum tree_code, gimple, gimple, tree lhs = NULL_TREE);
+gimple build_type_cast (tree, tree, tree lhs = NULL_TREE);
+gimple build_type_cast (tree, gimple, tree lhs = NULL_TREE);
+
+#endif /* GCC_GIMPLE_BUILDER_H */
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index e6baabfa03d..dd2aed73e77 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -26,10 +26,12 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "function.h"
#include "dumpfile.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
#include "target.h"
#include "gimple-fold.h"
+#include "ipa-utils.h"
+#include "gimple-pretty-print.h"
/* Return true when DECL can be referenced from current unit.
FROM_DECL (if non-null) specify constructor of variable DECL was taken from.
@@ -60,6 +62,24 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl)
struct cgraph_node *node;
symtab_node snode;
+ if (DECL_ABSTRACT (decl))
+ return false;
+
+ /* We are concerned only about static/external vars and functions. */
+ if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
+ || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL))
+ return true;
+
+ /* Static objects can be referred only if they was not optimized out yet. */
+ if (!TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl))
+ {
+ snode = symtab_get_node (decl);
+ if (!snode)
+ return false;
+ node = dyn_cast <cgraph_node> (snode);
+ return !node || !node->global.inlined_to;
+ }
+
/* We will later output the initializer, so we can refer to it.
So we are concerned only when DECL comes from initializer of
external var. */
@@ -69,10 +89,6 @@ can_refer_decl_in_current_unit_p (tree decl, tree from_decl)
|| (flag_ltrans
&& symtab_get_node (from_decl)->symbol.in_other_partition))
return true;
- /* We are concerned only about static/external vars and functions. */
- if ((!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
- || (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL))
- return true;
/* We are folding reference from external vtable. The vtable may reffer
to a symbol keyed to other compilation unit. The other compilation
unit may be in separate DSO and the symbol may be hidden. */
@@ -1102,6 +1118,19 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
{
if (gimple_call_addr_fndecl (OBJ_TYPE_REF_EXPR (callee)) != NULL_TREE)
{
+ if (dump_file && virtual_method_call_p (callee)
+ && !possible_polymorphic_call_target_p
+ (callee, cgraph_get_node (gimple_call_addr_fndecl
+ (OBJ_TYPE_REF_EXPR (callee)))))
+ {
+ fprintf (dump_file,
+ "Type inheritnace inconsistent devirtualization of ");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ fprintf (dump_file, " to ");
+ print_generic_expr (dump_file, callee, TDF_SLIM);
+ fprintf (dump_file, "\n");
+ }
+
gimple_call_set_fn (stmt, OBJ_TYPE_REF_EXPR (callee));
changed = true;
}
@@ -1117,6 +1146,11 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace)
tree fndecl = gimple_get_virt_method_for_binfo (token, binfo);
if (fndecl)
{
+#ifdef ENABLE_CHECKING
+ gcc_assert (possible_polymorphic_call_target_p
+ (callee, cgraph_get_node (fndecl)));
+
+#endif
gimple_call_set_fndecl (stmt, fndecl);
changed = true;
}
@@ -2791,7 +2825,7 @@ fold_array_ctor_reference (tree type, tree ctor,
else
low_bound = double_int_zero;
/* Static constructors for variably sized objects makes no sense. */
- gcc_assert (TREE_CODE(TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor))))
+ gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor))))
== INTEGER_CST);
elt_size =
tree_to_double_int (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ctor))));
@@ -3135,7 +3169,7 @@ gimple_get_virt_method_for_binfo (HOST_WIDE_INT token, tree known_binfo)
size = tree_low_cst (TYPE_SIZE (TREE_TYPE (TREE_TYPE (v))), 1);
offset += token * size;
fn = fold_ctor_reference (TREE_TYPE (TREE_TYPE (v)), init,
- offset, size, vtable);
+ offset, size, v);
if (!fn || integer_zerop (fn))
return NULL_TREE;
gcc_assert (TREE_CODE (fn) == ADDR_EXPR
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index 0b0151f8437..574e31f298f 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "value-prof.h"
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 2884b6ff6fb..cf6bac2b35e 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "tree-iterator.h"
#include "tree-inline.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "flags.h"
#include "function.h"
#include "diagnostic-core.h"
@@ -118,7 +118,8 @@ lower_function_body (void)
need to do anything special. Otherwise build one by hand. */
if (gimple_seq_may_fallthru (lowered_body)
&& (data.return_statements.is_empty ()
- || gimple_return_retval (data.return_statements.last().stmt) != NULL))
+ || (gimple_return_retval (data.return_statements.last().stmt)
+ != NULL)))
{
x = gimple_build_return (NULL);
gimple_set_location (x, cfun->function_end_locus);
@@ -197,8 +198,8 @@ const pass_data pass_data_lower_cf =
class pass_lower_cf : public gimple_opt_pass
{
public:
- pass_lower_cf(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_cf, ctxt)
+ pass_lower_cf (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_cf, ctxt)
{}
/* opt_pass methods: */
@@ -707,7 +708,7 @@ block_may_fallthru (const_tree block)
{
/* This CONST_CAST is okay because expr_last returns its argument
unmodified and we assign it to a const_tree. */
- const_tree stmt = expr_last (CONST_CAST_TREE(block));
+ const_tree stmt = expr_last (CONST_CAST_TREE (block));
switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
{
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 3ab558cae38..1e985e0dbd7 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "gimple-pretty-print.h"
#include "hashtab.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h" /* for dump_flags */
#include "gimple.h"
#include "value-prof.h"
@@ -524,7 +524,7 @@ dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
else
gcc_unreachable ();
if (!(flags & TDF_RHS_ONLY))
- pp_semicolon(buffer);
+ pp_semicolon (buffer);
}
}
@@ -1600,23 +1600,20 @@ dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags)
}
}
-
-/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
- The caller is responsible for calling pp_flush on BUFFER to finalize
- pretty printer. */
+/* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
+ SPC spaces of indent. */
static void
-dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
+dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
{
- size_t i;
- tree lhs = gimple_phi_result (phi);
+ if (TREE_CODE (node) != SSA_NAME)
+ return;
- if (flags & TDF_ALIAS
- && POINTER_TYPE_P (TREE_TYPE (lhs))
- && SSA_NAME_PTR_INFO (lhs))
+ if (POINTER_TYPE_P (TREE_TYPE (node))
+ && SSA_NAME_PTR_INFO (node))
{
unsigned int align, misalign;
- struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
+ struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
pp_string (buffer, "PT = ");
pp_points_to_solution (buffer, &pi->pt);
newline_and_indent (buffer, spc);
@@ -1628,9 +1625,44 @@ dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
pp_string (buffer, "# ");
}
+ if (!POINTER_TYPE_P (TREE_TYPE (node))
+ && SSA_NAME_RANGE_INFO (node))
+ {
+ double_int min, max;
+ value_range_type range_type = get_range_info (node, &min, &max);
+
+ if (range_type == VR_VARYING)
+ pp_printf (buffer, "# RANGE VR_VARYING");
+ else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE)
+ {
+ pp_printf (buffer, "# RANGE ");
+ pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~");
+ pp_double_int (buffer, min, TYPE_UNSIGNED (TREE_TYPE (node)));
+ pp_printf (buffer, ", ");
+ pp_double_int (buffer, max, TYPE_UNSIGNED (TREE_TYPE (node)));
+ pp_printf (buffer, "]");
+ newline_and_indent (buffer, spc);
+ }
+ }
+}
+
+
+/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
+ The caller is responsible for calling pp_flush on BUFFER to finalize
+ pretty printer. */
+
+static void
+dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
+{
+ size_t i;
+ tree lhs = gimple_phi_result (phi);
+
+ if (flags & TDF_ALIAS)
+ dump_ssaname_info (buffer, lhs, spc);
+
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
- gimple_phi_result (phi));
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
+ gimple_phi_result (phi));
else
{
dump_generic_node (buffer, lhs, spc, flags, false);
@@ -1908,27 +1940,9 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
&& gimple_has_mem_ops (gs))
dump_gimple_mem_ops (buffer, gs, spc, flags);
- if ((flags & TDF_ALIAS)
- && gimple_has_lhs (gs))
- {
- tree lhs = gimple_get_lhs (gs);
- if (TREE_CODE (lhs) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (lhs))
- && SSA_NAME_PTR_INFO (lhs))
- {
- unsigned int align, misalign;
- struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
- pp_string (buffer, "# PT = ");
- pp_points_to_solution (buffer, &pi->pt);
- newline_and_indent (buffer, spc);
- if (get_ptr_info_alignment (pi, &align, &misalign))
- {
- pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
- align, misalign);
- newline_and_indent (buffer, spc);
- }
- }
- }
+ if (gimple_has_lhs (gs)
+ && (flags & TDF_ALIAS))
+ dump_ssaname_info (buffer, gimple_get_lhs (gs), spc);
switch (gimple_code (gs))
{
@@ -2271,7 +2285,7 @@ gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
pp_newline_and_flush (buffer);
gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl));
dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl),
- pp_buffer(buffer)->stream, stmt);
+ pp_buffer (buffer)->stream, stmt);
}
dump_implicit_edges (buffer, bb, indent, flags);
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index e85e6293db4..139a4a16472 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "cfgloop.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "domwalk.h"
#include "pointer-set.h"
#include "expmed.h"
@@ -750,6 +750,57 @@ slsr_process_phi (gimple phi, bool speed)
add_cand_for_stmt (phi, c);
}
+/* Given PBASE which is a pointer to tree, look up the defining
+ statement for it and check whether the candidate is in the
+ form of:
+
+ X = B + (1 * S), S is integer constant
+ X = B + (i * S), S is integer one
+
+ If so, set PBASE to the candidate's base_expr and return double
+ int (i * S).
+ Otherwise, just return double int zero. */
+
+static double_int
+backtrace_base_for_ref (tree *pbase)
+{
+ tree base_in = *pbase;
+ slsr_cand_t base_cand;
+
+ STRIP_NOPS (base_in);
+ if (TREE_CODE (base_in) != SSA_NAME)
+ return tree_to_double_int (integer_zero_node);
+
+ base_cand = base_cand_from_table (base_in);
+
+ while (base_cand && base_cand->kind != CAND_PHI)
+ {
+ if (base_cand->kind == CAND_ADD
+ && base_cand->index.is_one ()
+ && TREE_CODE (base_cand->stride) == INTEGER_CST)
+ {
+ /* X = B + (1 * S), S is integer constant. */
+ *pbase = base_cand->base_expr;
+ return tree_to_double_int (base_cand->stride);
+ }
+ else if (base_cand->kind == CAND_ADD
+ && TREE_CODE (base_cand->stride) == INTEGER_CST
+ && integer_onep (base_cand->stride))
+ {
+ /* X = B + (i * S), S is integer one. */
+ *pbase = base_cand->base_expr;
+ return base_cand->index;
+ }
+
+ if (base_cand->next_interp)
+ base_cand = lookup_cand (base_cand->next_interp);
+ else
+ base_cand = NULL;
+ }
+
+ return tree_to_double_int (integer_zero_node);
+}
+
/* Look for the following pattern:
*PBASE: MEM_REF (T1, C1)
@@ -767,7 +818,14 @@ slsr_process_phi (gimple phi, bool speed)
*PBASE: T1
*POFFSET: MULT_EXPR (T2, C3)
- *PINDEX: C1 + (C2 * C3) + C4 */
+ *PINDEX: C1 + (C2 * C3) + C4
+
+ When T2 is recorded by a CAND_ADD in the form of (T2' + C5), it
+ will be further restructured to:
+
+ *PBASE: T1
+ *POFFSET: MULT_EXPR (T2', C3)
+ *PINDEX: C1 + (C2 * C3) + C4 + (C5 * C3) */
static bool
restructure_reference (tree *pbase, tree *poffset, double_int *pindex,
@@ -777,7 +835,7 @@ restructure_reference (tree *pbase, tree *poffset, double_int *pindex,
double_int index = *pindex;
double_int bpu = double_int::from_uhwi (BITS_PER_UNIT);
tree mult_op0, mult_op1, t1, t2, type;
- double_int c1, c2, c3, c4;
+ double_int c1, c2, c3, c4, c5;
if (!base
|| !offset
@@ -823,11 +881,12 @@ restructure_reference (tree *pbase, tree *poffset, double_int *pindex,
}
c4 = index.udiv (bpu, FLOOR_DIV_EXPR);
+ c5 = backtrace_base_for_ref (&t2);
*pbase = t1;
- *poffset = fold_build2 (MULT_EXPR, sizetype, t2,
+ *poffset = fold_build2 (MULT_EXPR, sizetype, fold_convert (sizetype, t2),
double_int_to_tree (sizetype, c3));
- *pindex = c1 + c2 * c3 + c4;
+ *pindex = c1 + c2 * c3 + c4 + c5 * c3;
*ptype = type;
return true;
@@ -1512,11 +1571,18 @@ slsr_process_copy (gimple gs, tree rhs1, bool speed)
add_cand_for_stmt (gs, c);
}
+class find_candidates_dom_walker : public dom_walker
+{
+public:
+ find_candidates_dom_walker (cdi_direction direction)
+ : dom_walker (direction) {}
+ virtual void before_dom_children (basic_block);
+};
+
/* Find strength-reduction candidates in block BB. */
-static void
-find_candidates_in_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+find_candidates_dom_walker::before_dom_children (basic_block bb)
{
bool speed = optimize_bb_for_speed_p (bb);
gimple_stmt_iterator gsi;
@@ -3429,8 +3495,6 @@ analyze_candidates_and_replace (void)
static unsigned
execute_strength_reduction (void)
{
- struct dom_walk_data walk_data;
-
/* Create the obstack where candidates will reside. */
gcc_obstack_init (&cand_obstack);
@@ -3450,18 +3514,10 @@ execute_strength_reduction (void)
back edges, and this gives us dominator information as well. */
loop_optimizer_init (AVOID_CFG_MODIFICATIONS);
- /* Set up callbacks for the generic dominator tree walker. */
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = find_candidates_in_block;
- walk_data.after_dom_children = NULL;
- walk_data.global_data = NULL;
- walk_data.block_local_data_size = 0;
- init_walk_dominator_tree (&walk_data);
-
/* Walk the CFG in predominator order looking for strength reduction
candidates. */
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+ find_candidates_dom_walker (CDI_DOMINATORS)
+ .walk (cfun->cfg->x_entry_block_ptr);
if (dump_file && (dump_flags & TDF_DETAILS))
{
@@ -3472,8 +3528,6 @@ execute_strength_reduction (void)
/* Analyze costs and make appropriate replacements. */
analyze_candidates_and_replace ();
- /* Free resources. */
- fini_walk_dominator_tree (&walk_data);
loop_optimizer_finalize ();
base_cand_map.dispose ();
obstack_free (&chain_obstack, NULL);
@@ -3510,8 +3564,8 @@ const pass_data pass_data_strength_reduction =
class pass_strength_reduction : public gimple_opt_pass
{
public:
- pass_strength_reduction(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_strength_reduction, ctxt)
+ pass_strength_reduction (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_strength_reduction, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/gimple-streamer-in.c b/gcc/gimple-streamer-in.c
index 29e8bd04c83..8161a087656 100644
--- a/gcc/gimple-streamer-in.c
+++ b/gcc/gimple-streamer-in.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "diagnostic.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "data-streamer.h"
#include "tree-streamer.h"
#include "gimple-streamer.h"
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 0b8d8c1d251..33699bbbfa9 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "data-streamer.h"
#include "gimple-streamer.h"
#include "lto-streamer.h"
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 4dbcdda31b9..e12f7d92c2e 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -54,7 +54,7 @@ EXPORTED_CONST size_t gimple_ops_offset_[] = {
};
#undef DEFGSSTRUCT
-#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) sizeof(struct STRUCT),
+#define DEFGSSTRUCT(SYM, STRUCT, HAS_TREE_OP) sizeof (struct STRUCT),
static const size_t gsstruct_code_size[] = {
#include "gsstruct.def"
};
@@ -2153,42 +2153,9 @@ gimple_set_lhs (gimple stmt, tree lhs)
else if (code == GIMPLE_CALL)
gimple_call_set_lhs (stmt, lhs);
else
- gcc_unreachable();
+ gcc_unreachable ();
}
-/* Replace the LHS of STMT, an assignment, either a GIMPLE_ASSIGN or a
- GIMPLE_CALL, with NLHS, in preparation for modifying the RHS to an
- expression with a different value.
-
- This will update any annotations (say debug bind stmts) referring
- to the original LHS, so that they use the RHS instead. This is
- done even if NLHS and LHS are the same, for it is understood that
- the RHS will be modified afterwards, and NLHS will not be assigned
- an equivalent value.
-
- Adjusting any non-annotation uses of the LHS, if needed, is a
- responsibility of the caller.
-
- The effect of this call should be pretty much the same as that of
- inserting a copy of STMT before STMT, and then removing the
- original stmt, at which time gsi_remove() would have update
- annotations, but using this function saves all the inserting,
- copying and removing. */
-
-void
-gimple_replace_lhs (gimple stmt, tree nlhs)
-{
- if (MAY_HAVE_DEBUG_STMTS)
- {
- tree lhs = gimple_get_lhs (stmt);
-
- gcc_assert (SSA_NAME_DEF_STMT (lhs) == stmt);
-
- insert_debug_temp_for_var_def (NULL, lhs);
- }
-
- gimple_set_lhs (stmt, nlhs);
-}
/* Return a deep copy of statement STMT. All the operands from STMT
are reallocated and copied using unshare_expr. The DEF, USE, VDEF
@@ -3739,96 +3706,6 @@ gimple_get_alias_set (tree t)
}
-/* Data structure used to count the number of dereferences to PTR
- inside an expression. */
-struct count_ptr_d
-{
- tree ptr;
- unsigned num_stores;
- unsigned num_loads;
-};
-
-/* Helper for count_uses_and_derefs. Called by walk_tree to look for
- (ALIGN/MISALIGNED_)INDIRECT_REF nodes for the pointer passed in DATA. */
-
-static tree
-count_ptr_derefs (tree *tp, int *walk_subtrees, void *data)
-{
- struct walk_stmt_info *wi_p = (struct walk_stmt_info *) data;
- struct count_ptr_d *count_p = (struct count_ptr_d *) wi_p->info;
-
- /* Do not walk inside ADDR_EXPR nodes. In the expression &ptr->fld,
- pointer 'ptr' is *not* dereferenced, it is simply used to compute
- the address of 'fld' as 'ptr + offsetof(fld)'. */
- if (TREE_CODE (*tp) == ADDR_EXPR)
- {
- *walk_subtrees = 0;
- return NULL_TREE;
- }
-
- if (TREE_CODE (*tp) == MEM_REF && TREE_OPERAND (*tp, 0) == count_p->ptr)
- {
- if (wi_p->is_lhs)
- count_p->num_stores++;
- else
- count_p->num_loads++;
- }
-
- return NULL_TREE;
-}
-
-/* Count the number of direct and indirect uses for pointer PTR in
- statement STMT. The number of direct uses is stored in
- *NUM_USES_P. Indirect references are counted separately depending
- on whether they are store or load operations. The counts are
- stored in *NUM_STORES_P and *NUM_LOADS_P. */
-
-void
-count_uses_and_derefs (tree ptr, gimple stmt, unsigned *num_uses_p,
- unsigned *num_loads_p, unsigned *num_stores_p)
-{
- ssa_op_iter i;
- tree use;
-
- *num_uses_p = 0;
- *num_loads_p = 0;
- *num_stores_p = 0;
-
- /* Find out the total number of uses of PTR in STMT. */
- FOR_EACH_SSA_TREE_OPERAND (use, stmt, i, SSA_OP_USE)
- if (use == ptr)
- (*num_uses_p)++;
-
- /* Now count the number of indirect references to PTR. This is
- truly awful, but we don't have much choice. There are no parent
- pointers inside INDIRECT_REFs, so an expression like
- '*x_1 = foo (x_1, *x_1)' needs to be traversed piece by piece to
- find all the indirect and direct uses of x_1 inside. The only
- shortcut we can take is the fact that GIMPLE only allows
- INDIRECT_REFs inside the expressions below. */
- if (is_gimple_assign (stmt)
- || gimple_code (stmt) == GIMPLE_RETURN
- || gimple_code (stmt) == GIMPLE_ASM
- || is_gimple_call (stmt))
- {
- struct walk_stmt_info wi;
- struct count_ptr_d count;
-
- count.ptr = ptr;
- count.num_stores = 0;
- count.num_loads = 0;
-
- memset (&wi, 0, sizeof (wi));
- wi.info = &count;
- walk_gimple_op (stmt, count_ptr_derefs, &wi);
-
- *num_stores_p = count.num_stores;
- *num_loads_p = count.num_loads;
- }
-
- gcc_assert (*num_uses_p >= *num_loads_p + *num_stores_p);
-}
-
/* From a tree operand OP return the base of a load or store operation
or NULL_TREE if OP is not a load or a store. */
@@ -4225,103 +4102,259 @@ gimple_asm_clobbers_memory_p (const_gimple stmt)
}
-/* Create and return an unnamed temporary. MODE indicates whether
- this should be an SSA or NORMAL temporary. TYPE is the type to use
- for the new temporary. */
+/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
+ useless type conversion, otherwise return false.
-tree
-create_gimple_tmp (tree type, enum ssa_mode mode)
-{
- return (mode == M_SSA)
- ? make_ssa_name (type, NULL)
- : create_tmp_var (type, NULL);
-}
+ 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.
-/* Return the expression type to use based on the CODE and type of
- the given operand OP. If the expression CODE is a comparison,
- the returned type is boolean_type_node. Otherwise, it returns
- the type of OP. */
+ 2) useless_type_conversion_p is not symmetric.
+ From a < b does not follow a > b.
-static tree
-get_expr_type (enum tree_code code, tree op)
+ 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)
{
- return (TREE_CODE_CLASS (code) == tcc_comparison)
- ? boolean_type_node
- : TREE_TYPE (op);
-}
+ /* Do the following before stripping toplevel qualifiers. */
+ if (POINTER_TYPE_P (inner_type)
+ && POINTER_TYPE_P (outer_type))
+ {
+ /* Do not lose casts between pointers to different address spaces. */
+ if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
+ != TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
+ return false;
+ }
+ /* From now on qualifiers on value types do not matter. */
+ inner_type = TYPE_MAIN_VARIANT (inner_type);
+ outer_type = TYPE_MAIN_VARIANT (outer_type);
-/* Build a new gimple assignment. The LHS of the assignment is a new
- temporary whose type matches the given expression. MODE indicates
- whether the LHS should be an SSA or a normal temporary. CODE is
- the expression code for the RHS. OP1 is the first operand and VAL
- is an integer value to be used as the second operand. */
+ if (inner_type == outer_type)
+ return true;
-gimple
-build_assign (enum tree_code code, tree op1, int val, enum ssa_mode mode)
-{
- tree op2 = build_int_cst (TREE_TYPE (op1), val);
- tree lhs = create_gimple_tmp (get_expr_type (code, op1), mode);
- return gimple_build_assign_with_ops (code, lhs, op1, op2);
-}
+ /* If we know the canonical types, compare them. */
+ if (TYPE_CANONICAL (inner_type)
+ && TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type))
+ return true;
-gimple
-build_assign (enum tree_code code, gimple g, int val, enum ssa_mode mode)
-{
- return build_assign (code, gimple_assign_lhs (g), val, mode);
-}
+ /* 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
+ conversion is not necessary if they have the same mode and
+ signedness and precision, and both or neither are boolean. */
+ if (INTEGRAL_TYPE_P (inner_type)
+ && INTEGRAL_TYPE_P (outer_type))
+ {
+ /* Preserve changes in signedness or precision. */
+ if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
+ || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
+ return false;
+ /* Preserve conversions to/from BOOLEAN_TYPE if types are not
+ of precision one. */
+ if (((TREE_CODE (inner_type) == BOOLEAN_TYPE)
+ != (TREE_CODE (outer_type) == BOOLEAN_TYPE))
+ && TYPE_PRECISION (outer_type) != 1)
+ return false;
-/* Build and return a new GIMPLE assignment. The new assignment will
- have the opcode CODE and operands OP1 and OP2. The type of the
- expression on the RHS is inferred to be the type of OP1.
+ /* We don't need to preserve changes in the types minimum or
+ maximum value in general as these do not generate code
+ unless the types precisions are different. */
+ return true;
+ }
- The LHS of the statement will be an SSA name or a GIMPLE temporary
- in normal form depending on the type of builder invoking this
- function. */
+ /* Scalar floating point types with the same mode are compatible. */
+ else if (SCALAR_FLOAT_TYPE_P (inner_type)
+ && SCALAR_FLOAT_TYPE_P (outer_type))
+ return true;
-gimple
-build_assign (enum tree_code code, tree op1, tree op2, enum ssa_mode mode)
-{
- tree lhs = create_gimple_tmp (get_expr_type (code, op1), mode);
- return gimple_build_assign_with_ops (code, lhs, op1, op2);
-}
+ /* 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;
-gimple
-build_assign (enum tree_code code, gimple op1, tree op2, enum ssa_mode mode)
-{
- return build_assign (code, gimple_assign_lhs (op1), op2, mode);
-}
+ /* We need to take special care recursing to pointed-to types. */
+ else if (POINTER_TYPE_P (inner_type)
+ && POINTER_TYPE_P (outer_type))
+ {
+ /* Do not lose casts to function pointer types. */
+ if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
+ && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE
+ || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE))
+ return false;
-gimple
-build_assign (enum tree_code code, tree op1, gimple op2, enum ssa_mode mode)
-{
- return build_assign (code, op1, gimple_assign_lhs (op2), mode);
-}
+ /* We do not care for const qualification of the pointed-to types
+ as const qualification has no semantic value to the middle-end. */
-gimple
-build_assign (enum tree_code code, gimple op1, gimple op2, enum ssa_mode mode)
-{
- return build_assign (code, gimple_assign_lhs (op1), gimple_assign_lhs (op2),
- mode);
-}
+ /* Otherwise pointers/references are equivalent. */
+ return true;
+ }
+ /* Recurse for complex types. */
+ else if (TREE_CODE (inner_type) == COMPLEX_TYPE
+ && TREE_CODE (outer_type) == COMPLEX_TYPE)
+ return useless_type_conversion_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
+
+ /* Recurse for vector types with the same number of subparts. */
+ else if (TREE_CODE (inner_type) == VECTOR_TYPE
+ && TREE_CODE (outer_type) == VECTOR_TYPE
+ && TYPE_PRECISION (inner_type) == TYPE_PRECISION (outer_type))
+ return useless_type_conversion_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type));
+
+ else if (TREE_CODE (inner_type) == ARRAY_TYPE
+ && TREE_CODE (outer_type) == ARRAY_TYPE)
+ {
+ /* Preserve string attributes. */
+ if (TYPE_STRING_FLAG (inner_type) != TYPE_STRING_FLAG (outer_type))
+ return false;
-/* Create and return a type cast assignment. This creates a NOP_EXPR
- that converts OP to TO_TYPE. */
+ /* Conversions from array types with unknown extent to
+ array types with known extent are not useless. */
+ if (!TYPE_DOMAIN (inner_type)
+ && TYPE_DOMAIN (outer_type))
+ return false;
-gimple
-build_type_cast (tree to_type, tree op, enum ssa_mode mode)
-{
- tree lhs = create_gimple_tmp (to_type, mode);
- return gimple_build_assign_with_ops (NOP_EXPR, lhs, op, NULL_TREE);
+ /* 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;
+
+ /* 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));
+ }
+
+ 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;
+
+ /* If the return types are not compatible bail out. */
+ if (!useless_type_conversion_p (TREE_TYPE (outer_type),
+ TREE_TYPE (inner_type)))
+ return false;
+
+ /* 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;
+
+ /* A conversion to an unprototyped argument list is ok. */
+ if (!prototype_p (outer_type))
+ return true;
+
+ /* If the unqualified 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
+ (TYPE_MAIN_VARIANT (TREE_VALUE (outer_parm)),
+ TYPE_MAIN_VARIANT (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;
+
+ /* Defer to the target if necessary. */
+ if (TYPE_ATTRIBUTES (inner_type) || TYPE_ATTRIBUTES (outer_type))
+ return comp_type_attributes (outer_type, inner_type) != 0;
+
+ return true;
+ }
+
+ /* 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;
}
-gimple
-build_type_cast (tree to_type, gimple op, enum ssa_mode mode)
+/* Return true if a conversion from either type of TYPE1 and TYPE2
+ to the other is not required. Otherwise return false. */
+
+bool
+types_compatible_p (tree type1, tree type2)
{
- return build_type_cast (to_type, gimple_assign_lhs (op), mode);
+ return (type1 == type2
+ || (useless_type_conversion_p (type1, type2)
+ && useless_type_conversion_p (type2, type1)));
}
+
#include "gt-gimple.h"
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 9f29561eb37..376fda2c6f2 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -34,15 +34,6 @@ along with GCC; see the file COPYING3. If not see
typedef gimple gimple_seq_node;
-/* Types of supported temporaries. GIMPLE temporaries may be symbols
- in normal form (i.e., regular decls) or SSA names. This enum is
- used by create_gimple_tmp to tell it what kind of temporary the
- caller wants. */
-enum ssa_mode {
- M_SSA = 0,
- M_NORMAL
-};
-
/* For each block, the PHI nodes that need to be rewritten are stored into
these vectors. */
typedef vec<gimple> gimple_vec;
@@ -730,19 +721,6 @@ union GTY ((desc ("gimple_statement_structure (&%h)"),
struct gimple_statement_transaction GTY((tag ("GSS_TRANSACTION"))) gimple_transaction;
};
-/* In gimple.c. */
-
-/* Helper functions to build GIMPLE statements. */
-tree create_gimple_tmp (tree, enum ssa_mode = M_SSA);
-gimple build_assign (enum tree_code, tree, int, enum ssa_mode = M_SSA);
-gimple build_assign (enum tree_code, gimple, int, enum ssa_mode = M_SSA);
-gimple build_assign (enum tree_code, tree, tree, enum ssa_mode = M_SSA);
-gimple build_assign (enum tree_code, gimple, tree, enum ssa_mode = M_SSA);
-gimple build_assign (enum tree_code, tree, gimple, enum ssa_mode = M_SSA);
-gimple build_assign (enum tree_code, gimple, gimple, enum ssa_mode = M_SSA);
-gimple build_type_cast (tree, tree, enum ssa_mode = M_SSA);
-gimple build_type_cast (tree, gimple, enum ssa_mode = M_SSA);
-
/* Offset in bytes to the location of the operand vector.
Zero if there is no operand vector for this tuple structure. */
extern size_t const gimple_ops_offset_[];
@@ -909,8 +887,6 @@ extern void free_gimple_type_tables (void);
extern tree gimple_unsigned_type (tree);
extern tree gimple_signed_type (tree);
extern alias_set_type gimple_get_alias_set (tree);
-extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
- unsigned *);
extern bool walk_stmt_load_store_addr_ops (gimple, void *,
bool (*)(gimple, tree, void *),
bool (*)(gimple, tree, void *),
@@ -922,6 +898,8 @@ extern bool gimple_ior_addresses_taken (bitmap, gimple);
extern bool gimple_call_builtin_p (gimple, enum built_in_class);
extern bool gimple_call_builtin_p (gimple, enum built_in_function);
extern bool gimple_asm_clobbers_memory_p (const_gimple);
+extern bool useless_type_conversion_p (tree, tree);
+extern bool types_compatible_p (tree, tree);
/* In gimplify.c */
extern tree create_tmp_var_raw (tree, const char *);
@@ -1098,12 +1076,6 @@ extern tree gimple_assign_rhs_to_tree (gimple);
/* In builtins.c */
extern bool validate_gimple_arglist (const_gimple, ...);
-/* In tree-ssa.c */
-extern bool tree_ssa_useless_type_conversion (tree);
-extern tree tree_ssa_strip_useless_type_conversions (tree);
-extern bool useless_type_conversion_p (tree, tree);
-extern bool types_compatible_p (tree, tree);
-
/* In tree-ssa-coalesce.c */
extern bool gimple_can_coalesce_p (tree, tree);
@@ -5065,7 +5037,7 @@ gsi_start_1 (gimple_seq *seq)
return i;
}
-#define gsi_start(x) gsi_start_1(&(x))
+#define gsi_start(x) gsi_start_1 (&(x))
static inline gimple_stmt_iterator
gsi_none (void)
@@ -5108,7 +5080,7 @@ gsi_last_1 (gimple_seq *seq)
return i;
}
-#define gsi_last(x) gsi_last_1(&(x))
+#define gsi_last(x) gsi_last_1 (&(x))
/* Return a new iterator pointing to the last statement in basic block BB. */
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 3b3adb34317..86bda77692f 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-pretty-print.h"
#include "langhooks.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "timevar.h"
#include "hashtab.h"
@@ -5419,11 +5419,21 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
vec_safe_push (inputs, link);
}
- for (link = ASM_CLOBBERS (expr); link; ++i, link = TREE_CHAIN (link))
- vec_safe_push (clobbers, link);
+ link_next = NULL_TREE;
+ for (link = ASM_CLOBBERS (expr); link; ++i, link = link_next)
+ {
+ link_next = TREE_CHAIN (link);
+ TREE_CHAIN (link) = NULL_TREE;
+ vec_safe_push (clobbers, link);
+ }
- for (link = ASM_LABELS (expr); link; ++i, link = TREE_CHAIN (link))
- vec_safe_push (labels, link);
+ link_next = NULL_TREE;
+ for (link = ASM_LABELS (expr); link; ++i, link = link_next)
+ {
+ link_next = TREE_CHAIN (link);
+ TREE_CHAIN (link) = NULL_TREE;
+ vec_safe_push (labels, link);
+ }
/* Do not add ASMs with errors to the gimple IL stream. */
if (ret != GS_ERROR)
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index c730ecaa183..8c3a3bda041 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,31 @@
+2013-09-30 Chris Manghane <cmang@google.com>
+
+ * go-gcc.cc (Backend::error_expression): New function.
+ (Backend::var_expression): New function.
+ (Backend::indirect_expression): New function.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (gospec.o): Remove.
+ (CFLAGS-go/gospec.o): New variable.
+ (GCCGO_OBJS): Update to use go/gospec.o.
+ (go_OBJS): Define.
+ (GO_SYSTEM_H, GO_C_H, GO_LINEMAP_H, GO_LEX_H, GO_PARSE_H)
+ (GO_GOGO_H, GO_TYPES_H, GO_STATEMENTS_H, GO_EXPRESSIONS_H)
+ (GO_EXPORT_H, GO_IMPORT_H, GO_RUNTIME_H, GO_AST_DUMP_H)
+ (go/go-backend.o, go/go-lang.o, go/go-gcc.o, go/go-linemap.o)
+ (go/ast-dump.o, go/dataflow.o, go/export.o, go/expressions.o)
+ (go/go.o, go/go-dump.o, go/go-optimize.o, go/gogo-tree.o)
+ (go/gogo.o, go/import.o, go/import-archive.o, go/lex.o)
+ (go/parse.o, go/runtime.o, go/statements.o, go/types.o)
+ (go/unsafe.o): Remove.
+ (CFLAGS-go/go-gcc.o, CFLAGS-go/go-linemap.o): New variables.
+ (go/%.o: go/gofrontend/%.cc): Use COMPILE and POSTCOMPILE.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (gospec.o): Don't use subshell.
+
2013-08-28 Ian Lance Taylor <iant@google.com>
* go-gcc.cc (Gcc_backend::immutable_struct): Set TREE_PUBLIC if
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
index 3cb18d6adcf..e4bceb21c08 100644
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -30,13 +30,9 @@ go: go1$(exeext)
.PHONY: go
-gospec.o: $(srcdir)/go/gospec.c $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H) \
- $(CONFIG_H) opts.h
- (SHLIB='$(SHLIB)'; \
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
- $(INCLUDES) $(srcdir)/go/gospec.c)
+CFLAGS-go/gospec.o += $(DRIVER_DEFINES)
-GCCGO_OBJS = $(GCC_OBJS) gospec.o
+GCCGO_OBJS = $(GCC_OBJS) go/gospec.o
gccgo$(exeext): $(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(GCCGO_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \
@@ -75,6 +71,8 @@ GO_OBJS = \
go/types.o \
go/unsafe.o
+go_OBJS = $(GO_OBJS) go/gospec.o
+
go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
@@ -223,96 +221,14 @@ go.stageprofile: stageprofile-start
go.stagefeedback: stagefeedback-start
-mv go/*$(objext) stagefeedback/go
-GO_SYSTEM_H = go/go-system.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DIAGNOSTIC_CORE_H) $(INPUT_H) intl.h
-
-GO_C_H = go/go-c.h $(MACHMODE_H)
-GO_LINEMAP_H = go/gofrontend/go-linemap.h $(GO_SYSTEM_H) go/go-location.h
-GO_LEX_H = go/gofrontend/lex.h go/gofrontend/operator.h $(GO_LINEMAP_H)
-GO_PARSE_H = go/gofrontend/parse.h
-GO_GOGO_H = go/gofrontend/gogo.h $(GO_LINEMAP_H)
-GO_TYPES_H = go/gofrontend/types.h $(GO_LINEMAP_H)
-GO_STATEMENTS_H = go/gofrontend/statements.h go/gofrontend/operator.h
-GO_EXPRESSIONS_H = go/gofrontend/expressions.h go/gofrontend/operator.h
-GO_EXPORT_H = go/gofrontend/export.h go/gofrontend/string-dump.h
-GO_IMPORT_H = go/gofrontend/import.h $(GO_EXPORT_H) $(GO_LINEMAP_H)
-GO_RUNTIME_H = go/gofrontend/runtime.h go/gofrontend/runtime.def
-GO_AST_DUMP_H = go/gofrontend/ast-dump.h go/gofrontend/string-dump.h
-
-go/go-backend.o: go/go-backend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TM_H) $(TREE_H) $(TM_P_H) output.h $(TARGET_H) \
- $(COMMON_TARGET_H)
-
CFLAGS-go/go-lang.o += -DDEFAULT_TARGET_VERSION=\"$(version)\" \
-DDEFAULT_TARGET_MACHINE=\"$(target_noncanonical)\"
-go/go-lang.o: go/go-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
- $(TREE_H) $(GIMPLE_H) $(GGC_H) $(TOPLEV_H) debug.h options.h \
- $(FLAGS_H) convert.h $(DIAGNOSTIC_H) langhooks.h \
- $(LANGHOOKS_DEF_H) $(TARGET_H) $(GO_C_H) \
- gt-go-go-lang.h gtype-go.h $(COMMON_TARGET_H)
GOINCLUDES = -I $(srcdir)/go -I $(srcdir)/go/gofrontend
-go/go-gcc.o: go/go-gcc.cc $(GO_SYSTEM_H) $(TREE_H) tree-iterator.h \
- $(GIMPLE_H) toplev.h output.h $(GO_C_H) $(GO_GOGO_H) \
- go/gofrontend/backend.h
- $(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
-
-go/go-linemap.o: go/go-linemap.cc $(GO_SYSTEM_H) $(GO_LINEMAP_H)
- $(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
+CFLAGS-go/go-gcc.o += $(GOINCLUDES)
+CFLAGS-go/go-linemap.o += $(GOINCLUDES)
go/%.o: go/gofrontend/%.cc
- $(CXX) -c $(GOINCLUDES) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $< $(OUTPUT_OPTION)
-
-go/ast-dump.o: go/gofrontend/ast-dump.cc $(GO_SYSTME_H) $(GO_GOGO_H) \
- $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_TYPES_H) \
- $(GO_AST_DUMP_H) $(GO_C_H) go/gofrontend/go-dump.h
-go/dataflow.o: go/gofrontend/dataflow.cc $(GO_SYSTEM_H) $(GO_GOGO_H) \
- $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) go/gofrontend/dataflow.h
-go/export.o: go/gofrontend/export.cc $(GO_SYSTEM_H) \
- $(srcdir)/../include/sha1.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
- $(GO_STATEMENTS_H) $(GO_EXPORT_H)
-go/expressions.o: go/gofrontend/expressions.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
- intl.h $(TREE_H) $(GIMPLE_H) tree-iterator.h convert.h $(REAL_H) \
- realmpfr.h $(GO_C_H) $(GO_GOGO_H) $(GO_TYPES_H) \
- $(GO_EXPORT_H) $(GO_IMPORT_H) $(GO_STATEMENTS_H) $(GO_LEX_H) \
- $(GO_RUNTIME_H) go/gofrontend/backend.h $(GO_EXPRESSIONS_H) \
- $(GO_AST_DUMP_H)
-go/go.o: go/gofrontend/go.cc $(GO_SYSTEM_H) $(GO_C_H) $(GO_LEX_H) \
- $(GO_PARSE_H) go/gofrontend/backend.h $(GO_GOGO_H)
-go/go-dump.o: go/gofrontend/go-dump.cc $(GO_SYSTEM_H) $(GO_C_H) \
- go/gofrontend/go-dump.h
-go/go-optimize.o: go/gofrontend/go-optimize.cc $(GO_SYSTEM_H) $(GO_C_H) \
- go/gofrontend/go-optimize.h
-go/gogo-tree.o: go/gofrontend/gogo-tree.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
- $(TREE_H) $(GIMPLE_H) tree-iterator.h $(CGRAPH_H) langhooks.h \
- convert.h output.h $(DIAGNOSTIC_H) $(GO_TYPES_H) \
- $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_RUNTIME_H) \
- go/gofrontend/backend.h $(GO_GOGO_H)
-go/gogo.o: go/gofrontend/gogo.cc $(GO_SYSTEM_H) \
- $(srcdir)/../include/filenames.h $(GO_C_H) go/gofrontend/go-dump.h \
- $(GO_LEX_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) $(GO_EXPRESSIONS_H) \
- go/gofrontend/dataflow.h $(GO_RUNTIME_H) $(GO_IMPORT_H) \
- $(GO_EXPORT_H) go/gofrontend/backend.h $(GO_GOGO_H)
-go/import.o: go/gofrontend/import.cc $(GO_SYSTEM_H) \
- $(srcdir)/../include/filenames.h $(srcdir)/../include/simple-object.h \
- $(GO_C_H) $(GO_GOGO_H) $(GO_LEX_H) $(GO_TYPES_H) $(GO_EXPORT_H) \
- $(GO_IMPORT_H)
-go/import-archive.o: go/gofrontend/import-archive.cc $(GO_SYSTEM_H) \
- $(GO_IMPORT_H)
-go/lex.o: go/gofrontend/lex.cc $(GO_LEX_H) $(GO_SYSTEM_H)
-go/parse.o: go/gofrontend/parse.cc $(GO_SYSTEM_H) $(GO_LEX_H) $(GO_GOGO_H) \
- $(GO_TYPES_H) $(GO_STATEMENTS_H) $(GO_EXPRESSIONS_H) $(GO_PARSE_H)
-go/runtime.o: go/gofrontend/runtime.cc $(GO_SYSTEM_H) $(GO_GOGO_H) \
- $(GO_TYPES_H) $(GO_EXPRESSIONS_H) $(GO_RUNTIME_H) \
- go/gofrontend/runtime.def
-go/statements.o: go/gofrontend/statements.cc $(GO_SYSTEM_H) \
- $(GO_C_H) $(GO_TYPES_H) $(GO_EXPRESSIONS_H) $(GO_GOGO_H) \
- $(GO_RUNTIME_H) go/gofrontend/backend.h $(GO_STATEMENTS_H) \
- $(GO_AST_DUMP_H)
-go/types.o: go/gofrontend/types.cc $(GO_SYSTEM_H) $(TOPLEV_H) intl.h $(TREE_H) \
- $(GIMPLE_H) $(REAL_H) convert.h $(GO_C_H) $(GO_GOGO_H) \
- go/gofrontend/operator.h $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) \
- $(GO_EXPORT_H) $(GO_IMPORT_H) go/gofrontend/backend.h $(GO_TYPES_H)
-go/unsafe.o: go/gofrontend/unsafe.cc $(GO_SYSTEM_H) $(GO_C_H) $(GO_TYPES_H) \
- $(GO_GOGO_H)
+ $(COMPILE) $(GOINCLUDES) $<
+ $(POSTCOMPILE)
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 025bb2bdca0..df8c4fc6d94 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -208,6 +208,16 @@ class Gcc_backend : public Backend
Bexpression*
zero_expression(Btype*);
+ Bexpression*
+ error_expression()
+ { return this->make_expression(error_mark_node); }
+
+ Bexpression*
+ var_expression(Bvariable* var, Location);
+
+ Bexpression*
+ indirect_expression(Bexpression* expr, bool known_valid, Location);
+
// Statements.
Bstatement*
@@ -848,6 +858,30 @@ Gcc_backend::zero_expression(Btype* btype)
return tree_to_expr(ret);
}
+// An expression that references a variable.
+
+Bexpression*
+Gcc_backend::var_expression(Bvariable* var, Location)
+{
+ tree ret = var->get_tree();
+ if (ret == error_mark_node)
+ return this->error_expression();
+ return tree_to_expr(ret);
+}
+
+// An expression that indirectly references an expression.
+
+Bexpression*
+Gcc_backend::indirect_expression(Bexpression* expr, bool known_valid,
+ Location location)
+{
+ tree ret = build_fold_indirect_ref_loc(location.gcc_location(),
+ expr->get_tree());
+ if (known_valid)
+ TREE_THIS_NOTRAP(ret) = 1;
+ return tree_to_expr(ret);
+}
+
// An expression as a statement.
Bstatement*
diff --git a/gcc/go/gofrontend/backend.h b/gcc/go/gofrontend/backend.h
index ac29b03e453..18a594736c4 100644
--- a/gcc/go/gofrontend/backend.h
+++ b/gcc/go/gofrontend/backend.h
@@ -231,6 +231,22 @@ class Backend
virtual Bexpression*
zero_expression(Btype*) = 0;
+ // Create an error expression. This is used for cases which should
+ // not occur in a correct program, in order to keep the compilation
+ // going without crashing.
+ virtual Bexpression*
+ error_expression() = 0;
+
+ // Create a reference to a variable.
+ virtual Bexpression*
+ var_expression(Bvariable* var, Location) = 0;
+
+ // Create an expression that indirects through the pointer expression EXPR
+ // (i.e., return the expression for *EXPR). KNOWN_VALID is true if the pointer
+ // is known to point to a valid memory location.
+ virtual Bexpression*
+ indirect_expression(Bexpression* expr, bool known_valid, Location) = 0;
+
// Statements.
// Create an error statement. This is used for cases which should
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 0b010334229..430422c3876 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -978,22 +978,19 @@ Var_expression::do_get_tree(Translate_context* context)
{
Bvariable* bvar = this->variable_->get_backend_variable(context->gogo(),
context->function());
- tree ret = var_to_tree(bvar);
- if (ret == error_mark_node)
- return error_mark_node;
bool is_in_heap;
+ Location loc = this->location();
if (this->variable_->is_variable())
is_in_heap = this->variable_->var_value()->is_in_heap();
else if (this->variable_->is_result_variable())
is_in_heap = this->variable_->result_var_value()->is_in_heap();
else
go_unreachable();
+
+ Bexpression* ret = context->backend()->var_expression(bvar, loc);
if (is_in_heap)
- {
- ret = build_fold_indirect_ref_loc(this->location().gcc_location(), ret);
- TREE_THIS_NOTRAP(ret) = 1;
- }
- return ret;
+ ret = context->backend()->indirect_expression(ret, true, loc);
+ return expr_to_tree(ret);
}
// Ast dump for variable expression.
@@ -7752,8 +7749,6 @@ Builtin_call_expression::do_numeric_constant_value(Numeric_constant* nc) const
return false;
if (arg_type->is_abstract())
return false;
- if (arg_type->named_type() != NULL)
- arg_type->named_type()->convert(this->gogo_);
unsigned int ret;
if (this->code_ == BUILTIN_SIZEOF)
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index 69797f93342..a95f2901509 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -1009,6 +1009,16 @@ Named_object::get_id(Gogo* gogo)
else
package_name = this->package_->package_name();
+ // Note that this will be misleading if this is an unexported
+ // method generated for an embedded imported type. In that case
+ // the unexported method should have the package name of the
+ // package from which it is imported, but we are going to give
+ // it our package name. Fixing this would require knowing the
+ // package name, but we only know the package path. It might be
+ // better to use package paths here anyhow. This doesn't affect
+ // the assembler code, because we always set that name in
+ // Function::get_or_make_decl anyhow. FIXME.
+
decl_name = package_name + '.' + Gogo::unpack_hidden_name(this->name_);
Function_type* fntype;
@@ -1051,6 +1061,12 @@ Named_object::get_tree(Gogo* gogo, Named_object* function)
if (this->tree_ != NULL_TREE)
return this->tree_;
+ if (Gogo::is_erroneous_name(this->name_))
+ {
+ this->tree_ = error_mark_node;
+ return error_mark_node;
+ }
+
tree name;
if (this->classification_ == NAMED_OBJECT_TYPE)
name = NULL_TREE;
@@ -1317,7 +1333,21 @@ Function::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
|| this->type_->is_method())
{
TREE_PUBLIC(decl) = 1;
- std::string asm_name = gogo->pkgpath_symbol();
+ std::string pkgpath = gogo->pkgpath_symbol();
+ if (this->type_->is_method()
+ && Gogo::is_hidden_name(no->name())
+ && Gogo::hidden_name_pkgpath(no->name()) != gogo->pkgpath())
+ {
+ // This is a method we created for an unexported
+ // method of an imported embedded type. We need to
+ // use the pkgpath of the imported package to avoid
+ // a possible name collision. See bug478 for a test
+ // case.
+ pkgpath = Gogo::hidden_name_pkgpath(no->name());
+ pkgpath = Gogo::pkgpath_for_symbol(pkgpath);
+ }
+
+ std::string asm_name = pkgpath;
asm_name.append(1, '.');
asm_name.append(Gogo::unpack_hidden_name(no->name()));
if (this->type_->is_method())
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index be8ec5939f3..9f918cb81c7 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -1192,6 +1192,27 @@ Gogo::record_interface_type(Interface_type* itype)
this->interface_types_.push_back(itype);
}
+// Return an erroneous name that indicates that an error has already
+// been reported.
+
+std::string
+Gogo::erroneous_name()
+{
+ static int erroneous_count;
+ char name[50];
+ snprintf(name, sizeof name, "$erroneous%d", erroneous_count);
+ ++erroneous_count;
+ return name;
+}
+
+// Return whether a name is an erroneous name.
+
+bool
+Gogo::is_erroneous_name(const std::string& name)
+{
+ return name.compare(0, 10, "$erroneous") == 0;
+}
+
// Return a name for a thunk object.
std::string
@@ -2367,7 +2388,7 @@ Shortcuts::convert_shortcut(Block* enclosing, Expression** pshortcut)
Block* retblock = new Block(enclosing, loc);
retblock->set_end_location(loc);
- Temporary_statement* ts = Statement::make_temporary(Type::lookup_bool_type(),
+ Temporary_statement* ts = Statement::make_temporary(shortcut->type(),
left, loc);
retblock->add_statement(ts);
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h
index 6a87f2d562c..23968d4a191 100644
--- a/gcc/go/gofrontend/gogo.h
+++ b/gcc/go/gofrontend/gogo.h
@@ -387,6 +387,16 @@ class Gogo
void
mark_locals_used();
+ // Return a name to use for an error case. This should only be used
+ // after reporting an error, and is used to avoid useless knockon
+ // errors.
+ static std::string
+ erroneous_name();
+
+ // Return whether the name indicates an error.
+ static bool
+ is_erroneous_name(const std::string&);
+
// Return a name to use for a thunk function. A thunk function is
// one we create during the compilation, for a go statement or a
// defer statement or a method expression.
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 9d112850fee..e68f1753f87 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -213,7 +213,7 @@ Parse::qualified_ident(std::string* pname, Named_object** ppackage)
if (name == "_")
{
error_at(this->location(), "invalid use of %<_%>");
- name = "blank";
+ name = Gogo::erroneous_name();
}
if (package->name() == this->gogo_->package_name())
@@ -1940,12 +1940,9 @@ Parse::init_var(const Typed_identifier& tid, Type* type, Expression* init,
{
if (this->gogo_->in_global_scope())
return this->create_dummy_global(type, init, location);
- else if (type == NULL)
- this->gogo_->add_statement(Statement::make_statement(init, true));
else
{
- // With both a type and an initializer, create a dummy
- // variable so that we will check whether the
+ // Create a dummy variable so that we will check whether the
// initializer can be assigned to the type.
Variable* var = new Variable(type, init, false, false, false,
location);
@@ -3107,7 +3104,7 @@ Parse::selector(Expression* left, bool* is_type_switch)
if (token->identifier() == "_")
{
error_at(this->location(), "invalid use of %<_%>");
- name = this->gogo_->pack_hidden_name("blank", false);
+ name = Gogo::erroneous_name();
}
this->advance_token();
return Expression::make_selector(left, name, location);
@@ -4932,7 +4929,7 @@ Parse::send_or_recv_stmt(bool* is_send, Expression** channel, Expression** val,
{
error_at(recv_var_loc,
"no new variables on left side of %<:=%>");
- recv_var = "blank";
+ recv_var = Gogo::erroneous_name();
}
*is_send = false;
*varname = gogo->pack_hidden_name(recv_var, is_rv_exported);
@@ -4968,7 +4965,7 @@ Parse::send_or_recv_stmt(bool* is_send, Expression** channel, Expression** val,
{
error_at(recv_var_loc,
"no new variables on left side of %<:=%>");
- recv_var = "blank";
+ recv_var = Gogo::erroneous_name();
}
*is_send = false;
if (recv_var != "_")
@@ -5505,7 +5502,7 @@ Parse::package_clause()
if (name == "_")
{
error_at(this->location(), "invalid package name _");
- name = "blank";
+ name = Gogo::erroneous_name();
}
this->advance_token();
}
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 0261f9d4882..a5102c0c450 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -594,6 +594,15 @@ Assignment_statement::do_check_types(Gogo*)
Type* lhs_type = this->lhs_->type();
Type* rhs_type = this->rhs_->type();
+
+ // Invalid assignment of nil to the blank identifier.
+ if (lhs_type->is_sink_type()
+ && rhs_type->is_nil_type())
+ {
+ this->report_error(_("use of untyped nil"));
+ return;
+ }
+
std::string reason;
bool ok;
if (this->are_hidden_fields_ok_)
@@ -975,7 +984,10 @@ Tuple_assignment_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
if ((*plhs)->is_sink_expression())
{
- b->add_statement(Statement::make_statement(*prhs, true));
+ if ((*prhs)->type()->is_nil_type())
+ this->report_error(_("use of untyped nil"));
+ else
+ b->add_statement(Statement::make_statement(*prhs, true));
continue;
}
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 9ce329d5503..a4a60706b7a 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -2288,9 +2288,7 @@ Type::is_backend_type_size_known(Gogo* gogo)
}
case TYPE_NAMED:
- // Begin converting this type to the backend representation.
- // This will create a placeholder if necessary.
- this->get_backend(gogo);
+ this->named_type()->convert(gogo);
return this->named_type()->is_named_backend_type_size_known();
case TYPE_FORWARD:
@@ -4229,6 +4227,11 @@ Struct_field::is_embedded_builtin(Gogo* gogo) const
Struct_type::Identical_structs Struct_type::identical_structs;
+// A hash table used to merge method sets for identical unnamed
+// structs.
+
+Struct_type::Struct_method_tables Struct_type::struct_method_tables;
+
// Traversal.
int
@@ -4693,9 +4696,24 @@ Struct_type::interface_method_table(Gogo* gogo,
const Interface_type* interface,
bool is_pointer)
{
+ std::pair<Struct_type*, Struct_type::Struct_method_table_pair*>
+ val(this, NULL);
+ std::pair<Struct_type::Struct_method_tables::iterator, bool> ins =
+ Struct_type::struct_method_tables.insert(val);
+
+ Struct_method_table_pair* smtp;
+ if (!ins.second)
+ smtp = ins.first->second;
+ else
+ {
+ smtp = new Struct_method_table_pair();
+ smtp->first = NULL;
+ smtp->second = NULL;
+ ins.first->second = smtp;
+ }
+
return Type::interface_method_table(gogo, this, interface, is_pointer,
- &this->interface_method_tables_,
- &this->pointer_interface_method_tables_);
+ &smtp->first, &smtp->second);
}
// Convert struct fields to the backend representation. This is not
@@ -9251,7 +9269,11 @@ Type::bind_field_or_method(Gogo* gogo, const Type* type, Expression* expr,
}
else
{
- if (!ambig1.empty())
+ if (Gogo::is_erroneous_name(name))
+ {
+ // An error was already reported.
+ }
+ else if (!ambig1.empty())
error_at(location, "%qs is ambiguous via %qs and %qs",
Gogo::message_name(name).c_str(), ambig1.c_str(),
ambig2.c_str());
diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h
index d207fe5a375..d8a3080f586 100644
--- a/gcc/go/gofrontend/types.h
+++ b/gcc/go/gofrontend/types.h
@@ -2041,8 +2041,7 @@ class Struct_type : public Type
public:
Struct_type(Struct_field_list* fields, Location location)
: Type(TYPE_STRUCT),
- fields_(fields), location_(location), all_methods_(NULL),
- interface_method_tables_(NULL), pointer_interface_method_tables_(NULL)
+ fields_(fields), location_(location), all_methods_(NULL)
{ }
// Return the field NAME. This only looks at local fields, not at
@@ -2200,6 +2199,16 @@ class Struct_type : public Type
static Identical_structs identical_structs;
+ // Used to manage method tables for identical unnamed structs.
+ typedef std::pair<Interface_method_tables*, Interface_method_tables*>
+ Struct_method_table_pair;
+
+ typedef Unordered_map_hash(Struct_type*, Struct_method_table_pair*,
+ Type_hash_identical, Type_identical)
+ Struct_method_tables;
+
+ static Struct_method_tables struct_method_tables;
+
// Used to avoid infinite loops in field_reference_depth.
struct Saw_named_type
{
@@ -2218,13 +2227,6 @@ class Struct_type : public Type
Location location_;
// If this struct is unnamed, a list of methods.
Methods* all_methods_;
- // A mapping from interfaces to the associated interface method
- // tables for this type. Only used if this struct is unnamed.
- Interface_method_tables* interface_method_tables_;
- // A mapping from interfaces to the associated interface method
- // tables for pointers to this type. Only used if this struct is
- // unnamed.
- Interface_method_tables* pointer_interface_method_tables_;
};
// The type of an array.
diff --git a/gcc/godump.c b/gcc/godump.c
index 81efa2877cb..0303e4f0628 100644
--- a/gcc/godump.c
+++ b/gcc/godump.c
@@ -1213,7 +1213,7 @@ go_finish (const char *filename)
break;
default:
- gcc_unreachable();
+ gcc_unreachable ();
}
}
diff --git a/gcc/graphite-blocking.c b/gcc/graphite-blocking.c
index ed2cf8d2e0b..9226da00eae 100644
--- a/gcc/graphite-blocking.c
+++ b/gcc/graphite-blocking.c
@@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "cfgloop.h"
#include "tree-chrec.h"
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 663cc825908..d0e23021f5d 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "diagnostic-core.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "tree-chrec.h"
@@ -1306,7 +1306,7 @@ translate_clast (loop_p context_loop, struct clast_stmt *stmt, edge next_e,
next_e = translate_clast_assignment ((struct clast_assignment *) stmt,
next_e, level, ip);
else
- gcc_unreachable();
+ gcc_unreachable ();
recompute_all_dominators ();
graphite_verify ();
@@ -1409,7 +1409,7 @@ init_cloog_input_file (int scop_number)
/* Extend the scattering to NEW_DIMS scattering dimensions. */
static
-isl_map *extend_scattering(isl_map *scattering, int new_dims)
+isl_map *extend_scattering (isl_map *scattering, int new_dims)
{
int old_dims, i;
isl_space *space;
@@ -1462,12 +1462,13 @@ build_cloog_union_domain (scop_p scop, int nb_scattering_dims)
/* Dead code elimination: when the domain of a PBB is empty,
don't generate code for the PBB. */
- if (isl_set_is_empty(pbb->domain))
+ if (isl_set_is_empty (pbb->domain))
continue;
- domain = cloog_domain_from_isl_set(isl_set_copy(pbb->domain));
- scattering = cloog_scattering_from_isl_map(extend_scattering(isl_map_copy(pbb->transformed),
- nb_scattering_dims));
+ domain = cloog_domain_from_isl_set (isl_set_copy (pbb->domain));
+ scattering = cloog_scattering_from_isl_map
+ (extend_scattering (isl_map_copy (pbb->transformed),
+ nb_scattering_dims));
union_domain = cloog_union_domain_add_domain (union_domain, "", domain,
scattering, pbb);
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 7fd4081e926..5139e69b942 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "tree-chrec.h"
diff --git a/gcc/graphite-interchange.c b/gcc/graphite-interchange.c
index 05147e18ab5..289c1d9568f 100644
--- a/gcc/graphite-interchange.c
+++ b/gcc/graphite-interchange.c
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "cfgloop.h"
#include "tree-chrec.h"
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index 318f80c1e0d..b9b21566fb5 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "cfgloop.h"
#include "tree-chrec.h"
@@ -114,7 +114,7 @@ scop_get_dependences (scop_p scop)
*/
static isl_basic_map *
-getTileMap(isl_ctx *ctx, int scheduleDimensions, int tileSize)
+getTileMap (isl_ctx *ctx, int scheduleDimensions, int tileSize)
{
int x;
/* We construct
@@ -124,11 +124,11 @@ getTileMap(isl_ctx *ctx, int scheduleDimensions, int tileSize)
s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32}
and project out the auxilary dimensions a0 and a1. */
- isl_space *Space = isl_space_alloc(ctx, 0, scheduleDimensions,
- scheduleDimensions * 3);
- isl_basic_map *tileMap = isl_basic_map_universe(isl_space_copy(Space));
+ isl_space *Space = isl_space_alloc (ctx, 0, scheduleDimensions,
+ scheduleDimensions * 3);
+ isl_basic_map *tileMap = isl_basic_map_universe (isl_space_copy (Space));
- isl_local_space *LocalSpace = isl_local_space_from_space(Space);
+ isl_local_space *LocalSpace = isl_local_space_from_space (Space);
for (x = 0; x < scheduleDimensions; x++)
{
@@ -140,29 +140,29 @@ getTileMap(isl_ctx *ctx, int scheduleDimensions, int tileSize)
isl_constraint *c;
/* sX = aX * tileSize; */
- c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, sX, 1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, aX, -tileSize);
- tileMap = isl_basic_map_add_constraint(tileMap, c);
+ c = isl_equality_alloc (isl_local_space_copy (LocalSpace));
+ isl_constraint_set_coefficient_si (c, isl_dim_out, sX, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tileSize);
+ tileMap = isl_basic_map_add_constraint (tileMap, c);
/* pX = sX; */
- c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, pX, 1);
- isl_constraint_set_coefficient_si(c, isl_dim_in, sX, -1);
- tileMap = isl_basic_map_add_constraint(tileMap, c);
+ c = isl_equality_alloc (isl_local_space_copy (LocalSpace));
+ isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_in, sX, -1);
+ tileMap = isl_basic_map_add_constraint (tileMap, c);
/* tX <= pX */
- c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, pX, 1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, tX, -1);
- tileMap = isl_basic_map_add_constraint(tileMap, c);
+ c = isl_inequality_alloc (isl_local_space_copy (LocalSpace));
+ isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, tX, -1);
+ tileMap = isl_basic_map_add_constraint (tileMap, c);
/* pX <= tX + (tileSize - 1) */
- c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, tX, 1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, pX, -1);
- isl_constraint_set_constant_si(c, tileSize - 1);
- tileMap = isl_basic_map_add_constraint(tileMap, c);
+ c = isl_inequality_alloc (isl_local_space_copy (LocalSpace));
+ isl_constraint_set_coefficient_si (c, isl_dim_out, tX, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, pX, -1);
+ isl_constraint_set_constant_si (c, tileSize - 1);
+ tileMap = isl_basic_map_add_constraint (tileMap, c);
}
/* Project out auxiliary dimensions.
@@ -170,10 +170,10 @@ getTileMap(isl_ctx *ctx, int scheduleDimensions, int tileSize)
The auxiliary dimensions are transformed into existentially quantified ones.
This reduces the number of visible scattering dimensions and allows Cloog
to produces better code. */
- tileMap = isl_basic_map_project_out(tileMap, isl_dim_out,
- 2 * scheduleDimensions,
- scheduleDimensions);
- isl_local_space_free(LocalSpace);
+ tileMap = isl_basic_map_project_out (tileMap, isl_dim_out,
+ 2 * scheduleDimensions,
+ scheduleDimensions);
+ isl_local_space_free (LocalSpace);
return tileMap;
}
@@ -185,7 +185,7 @@ getTileMap(isl_ctx *ctx, int scheduleDimensions, int tileSize)
static bool DisableTiling = false;
static isl_union_map *
-getScheduleForBand(isl_band *Band, int *Dimensions)
+getScheduleForBand (isl_band *Band, int *Dimensions)
{
isl_union_map *PartialSchedule;
isl_ctx *ctx;
@@ -193,8 +193,8 @@ getScheduleForBand(isl_band *Band, int *Dimensions)
isl_basic_map *TileMap;
isl_union_map *TileUMap;
- PartialSchedule = isl_band_get_partial_schedule(Band);
- *Dimensions = isl_band_n_member(Band);
+ PartialSchedule = isl_band_get_partial_schedule (Band);
+ *Dimensions = isl_band_n_member (Band);
if (DisableTiling)
return PartialSchedule;
@@ -203,15 +203,15 @@ getScheduleForBand(isl_band *Band, int *Dimensions)
if (*Dimensions == 1)
return PartialSchedule;
- ctx = isl_union_map_get_ctx(PartialSchedule);
- Space = isl_union_map_get_space(PartialSchedule);
+ ctx = isl_union_map_get_ctx (PartialSchedule);
+ Space = isl_union_map_get_space (PartialSchedule);
- TileMap = getTileMap(ctx, *Dimensions, 32);
- TileUMap = isl_union_map_from_map(isl_map_from_basic_map(TileMap));
- TileUMap = isl_union_map_align_params(TileUMap, Space);
+ TileMap = getTileMap (ctx, *Dimensions, 32);
+ TileUMap = isl_union_map_from_map (isl_map_from_basic_map (TileMap));
+ TileUMap = isl_union_map_align_params (TileUMap, Space);
*Dimensions = 2 * *Dimensions;
- return isl_union_map_apply_range(PartialSchedule, TileUMap);
+ return isl_union_map_apply_range (PartialSchedule, TileUMap);
}
/* Create a map that pre-vectorizes one scheduling dimension.
@@ -253,9 +253,9 @@ getScheduleForBand(isl_band *Band, int *Dimensions)
currently constant and not yet target specific. This function does not reason
about parallelism. */
static isl_map *
-getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
- int ScheduleDimensions,
- int VectorWidth)
+getPrevectorMap (isl_ctx *ctx, int DimToVectorize,
+ int ScheduleDimensions,
+ int VectorWidth)
{
isl_space *Space;
isl_local_space *LocalSpace, *LocalSpaceRange;
@@ -270,9 +270,9 @@ getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
/* assert (0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);*/
- Space = isl_space_alloc(ctx, 0, ScheduleDimensions, ScheduleDimensions + 1);
- TilingMap = isl_map_universe(isl_space_copy(Space));
- LocalSpace = isl_local_space_from_space(Space);
+ Space = isl_space_alloc (ctx, 0, ScheduleDimensions, ScheduleDimensions + 1);
+ TilingMap = isl_map_universe (isl_space_copy (Space));
+ LocalSpace = isl_local_space_from_space (Space);
PointDimension = ScheduleDimensions;
TileDimension = DimToVectorize;
@@ -280,43 +280,43 @@ getPrevectorMap(isl_ctx *ctx, int DimToVectorize,
DimToVectorize to the point loop at the innermost dimension. */
for (i = 0; i < ScheduleDimensions; i++)
{
- c = isl_equality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_in, i, -1);
+ c = isl_equality_alloc (isl_local_space_copy (LocalSpace));
+ isl_constraint_set_coefficient_si (c, isl_dim_in, i, -1);
if (i == DimToVectorize)
- isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, 1);
else
- isl_constraint_set_coefficient_si(c, isl_dim_out, i, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1);
- TilingMap = isl_map_add_constraint(TilingMap, c);
+ TilingMap = isl_map_add_constraint (TilingMap, c);
}
/* it % 'VectorWidth' = 0 */
- LocalSpaceRange = isl_local_space_range(isl_local_space_copy(LocalSpace));
- Aff = isl_aff_zero_on_domain(LocalSpaceRange);
- Aff = isl_aff_set_constant_si(Aff, VectorWidth);
- Aff = isl_aff_set_coefficient_si(Aff, isl_dim_in, TileDimension, 1);
- isl_int_init(VectorWidthMP);
- isl_int_set_si(VectorWidthMP, VectorWidth);
- Aff = isl_aff_mod(Aff, VectorWidthMP);
- isl_int_clear(VectorWidthMP);
- Modulo = isl_pw_aff_zero_set(isl_pw_aff_from_aff(Aff));
- TilingMap = isl_map_intersect_range(TilingMap, Modulo);
+ LocalSpaceRange = isl_local_space_range (isl_local_space_copy (LocalSpace));
+ Aff = isl_aff_zero_on_domain (LocalSpaceRange);
+ Aff = isl_aff_set_constant_si (Aff, VectorWidth);
+ Aff = isl_aff_set_coefficient_si (Aff, isl_dim_in, TileDimension, 1);
+ isl_int_init (VectorWidthMP);
+ isl_int_set_si (VectorWidthMP, VectorWidth);
+ Aff = isl_aff_mod (Aff, VectorWidthMP);
+ isl_int_clear (VectorWidthMP);
+ Modulo = isl_pw_aff_zero_set (isl_pw_aff_from_aff (Aff));
+ TilingMap = isl_map_intersect_range (TilingMap, Modulo);
/* it <= ip */
- c = isl_inequality_alloc(isl_local_space_copy(LocalSpace));
- isl_constraint_set_coefficient_si(c, isl_dim_out, TileDimension, -1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, 1);
- TilingMap = isl_map_add_constraint(TilingMap, c);
+ c = isl_inequality_alloc (isl_local_space_copy (LocalSpace));
+ isl_constraint_set_coefficient_si (c, isl_dim_out, TileDimension, -1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, 1);
+ TilingMap = isl_map_add_constraint (TilingMap, c);
/* ip <= it + ('VectorWidth' - 1) */
- c = isl_inequality_alloc(LocalSpace);
- isl_constraint_set_coefficient_si(c, isl_dim_out, TileDimension, 1);
- isl_constraint_set_coefficient_si(c, isl_dim_out, PointDimension, -1);
- isl_constraint_set_constant_si(c, VectorWidth - 1);
- TilingMap = isl_map_add_constraint(TilingMap, c);
+ c = isl_inequality_alloc (LocalSpace);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, TileDimension, 1);
+ isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, -1);
+ isl_constraint_set_constant_si (c, VectorWidth - 1);
+ TilingMap = isl_map_add_constraint (TilingMap, c);
- isl_map_dump(TilingMap);
+ isl_map_dump (TilingMap);
return TilingMap;
}
@@ -329,15 +329,15 @@ static bool EnablePollyVector = false;
individual bands to the overall schedule. In case tiling is requested,
the individual bands are tiled. */
static isl_union_map *
-getScheduleForBandList(isl_band_list *BandList)
+getScheduleForBandList (isl_band_list *BandList)
{
int NumBands, i;
isl_union_map *Schedule;
isl_ctx *ctx;
- ctx = isl_band_list_get_ctx(BandList);
- NumBands = isl_band_list_n_band(BandList);
- Schedule = isl_union_map_empty(isl_space_params_alloc(ctx, 0));
+ ctx = isl_band_list_get_ctx (BandList);
+ NumBands = isl_band_list_n_band (BandList);
+ Schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0));
for (i = 0; i < NumBands; i++)
{
@@ -346,61 +346,61 @@ getScheduleForBandList(isl_band_list *BandList)
int ScheduleDimensions;
isl_space *Space;
- Band = isl_band_list_get_band(BandList, i);
- PartialSchedule = getScheduleForBand(Band, &ScheduleDimensions);
- Space = isl_union_map_get_space(PartialSchedule);
+ Band = isl_band_list_get_band (BandList, i);
+ PartialSchedule = getScheduleForBand (Band, &ScheduleDimensions);
+ Space = isl_union_map_get_space (PartialSchedule);
- if (isl_band_has_children(Band))
+ if (isl_band_has_children (Band))
{
isl_band_list *Children;
isl_union_map *SuffixSchedule;
- Children = isl_band_get_children(Band);
- SuffixSchedule = getScheduleForBandList(Children);
- PartialSchedule = isl_union_map_flat_range_product(PartialSchedule,
- SuffixSchedule);
- isl_band_list_free(Children);
+ Children = isl_band_get_children (Band);
+ SuffixSchedule = getScheduleForBandList (Children);
+ PartialSchedule = isl_union_map_flat_range_product (PartialSchedule,
+ SuffixSchedule);
+ isl_band_list_free (Children);
}
else if (EnablePollyVector)
{
for (i = ScheduleDimensions - 1 ; i >= 0 ; i--)
{
- if (isl_band_member_is_zero_distance(Band, i))
+ if (isl_band_member_is_zero_distance (Band, i))
{
isl_map *TileMap;
isl_union_map *TileUMap;
- TileMap = getPrevectorMap(ctx, i, ScheduleDimensions, 4);
- TileUMap = isl_union_map_from_map(TileMap);
- TileUMap = isl_union_map_align_params(TileUMap,
- isl_space_copy(Space));
- PartialSchedule = isl_union_map_apply_range(PartialSchedule,
- TileUMap);
+ TileMap = getPrevectorMap (ctx, i, ScheduleDimensions, 4);
+ TileUMap = isl_union_map_from_map (TileMap);
+ TileUMap = isl_union_map_align_params
+ (TileUMap, isl_space_copy (Space));
+ PartialSchedule = isl_union_map_apply_range
+ (PartialSchedule, TileUMap);
break;
}
}
}
- Schedule = isl_union_map_union(Schedule, PartialSchedule);
+ Schedule = isl_union_map_union (Schedule, PartialSchedule);
- isl_band_free(Band);
- isl_space_free(Space);
+ isl_band_free (Band);
+ isl_space_free (Space);
}
return Schedule;
}
static isl_union_map *
-getScheduleMap(isl_schedule *Schedule)
+getScheduleMap (isl_schedule *Schedule)
{
- isl_band_list *BandList = isl_schedule_get_band_forest(Schedule);
- isl_union_map *ScheduleMap = getScheduleForBandList(BandList);
- isl_band_list_free(BandList);
+ isl_band_list *BandList = isl_schedule_get_band_forest (Schedule);
+ isl_union_map *ScheduleMap = getScheduleForBandList (BandList);
+ isl_band_list_free (BandList);
return ScheduleMap;
}
static int
-getSingleMap(__isl_take isl_map *map, void *user)
+getSingleMap (__isl_take isl_map *map, void *user)
{
isl_map **singleMap = (isl_map **) user;
*singleMap = map;
@@ -420,12 +420,13 @@ apply_schedule_map_to_scop (scop_p scop, isl_union_map *schedule_map)
isl_union_map *stmtBand;
isl_map *stmtSchedule;
- stmtBand = isl_union_map_intersect_domain(isl_union_map_copy(schedule_map),
- isl_union_set_from_set(domain));
- isl_union_map_foreach_map(stmtBand, getSingleMap, &stmtSchedule);
- isl_map_free(pbb->transformed);
+ stmtBand = isl_union_map_intersect_domain
+ (isl_union_map_copy (schedule_map),
+ isl_union_set_from_set (domain));
+ isl_union_map_foreach_map (stmtBand, getSingleMap, &stmtSchedule);
+ isl_map_free (pbb->transformed);
pbb->transformed = stmtSchedule;
- isl_union_map_free(stmtBand);
+ isl_union_map_free (stmtBand);
}
}
@@ -442,20 +443,20 @@ optimize_isl (scop_p scop)
domain = scop_get_domains (scop);
dependences = scop_get_dependences (scop);
- dependences = isl_union_map_gist_domain(dependences,
- isl_union_set_copy(domain));
- dependences = isl_union_map_gist_range(dependences,
- isl_union_set_copy(domain));
+ dependences = isl_union_map_gist_domain (dependences,
+ isl_union_set_copy (domain));
+ dependences = isl_union_map_gist_range (dependences,
+ isl_union_set_copy (domain));
validity = dependences;
proximity = isl_union_map_copy (validity);
- isl_options_set_schedule_max_constant_term(scop->ctx, CONSTANT_BOUND);
- isl_options_set_schedule_maximize_band_depth(scop->ctx, 1);
- isl_options_set_schedule_fuse(scop->ctx, ISL_SCHEDULE_FUSE_MIN);
- isl_options_set_on_error(scop->ctx, ISL_ON_ERROR_CONTINUE);
+ isl_options_set_schedule_max_constant_term (scop->ctx, CONSTANT_BOUND);
+ isl_options_set_schedule_maximize_band_depth (scop->ctx, 1);
+ isl_options_set_schedule_fuse (scop->ctx, ISL_SCHEDULE_FUSE_MIN);
+ isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE);
schedule = isl_union_set_compute_schedule (domain, validity, proximity);
- isl_options_set_on_error(scop->ctx, ISL_ON_ERROR_ABORT);
+ isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_ABORT);
if (!schedule)
return false;
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index c44791ca592..35fe3ba2342 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "diagnostic-core.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "gimple-pretty-print.h"
#include "cfgloop.h"
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 52d6b1cdc53..9720f3f60f5 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -403,7 +403,7 @@ extern int scop_do_interchange (scop_p);
extern int scop_do_strip_mine (scop_p, int);
extern bool scop_do_block (scop_p);
extern bool flatten_all_loops (scop_p);
-extern bool optimize_isl(scop_p);
+extern bool optimize_isl (scop_p);
extern void pbb_number_of_iterations_at_time (poly_bb_p, graphite_dim_t, mpz_t);
extern void debug_gmp_value (mpz_t);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index ab2897d5c43..d2b8a2d0424 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "tree-data-ref.h"
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index c4c3eb40449..2d882060ab5 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "tree-chrec.h"
@@ -665,7 +665,7 @@ extract_affine_name (scop_p s, tree e, __isl_take isl_space *space)
id = isl_id_for_ssa_name (s, e);
dimension = isl_space_find_dim_by_id (space, isl_dim_param, id);
- isl_id_free(id);
+ isl_id_free (id);
dom = isl_set_universe (isl_space_copy (space));
aff = isl_aff_zero_on_domain (isl_local_space_from_space (space));
aff = isl_aff_add_coefficient_si (aff, isl_dim_param, dimension, 1);
@@ -994,7 +994,7 @@ build_loop_iteration_domains (scop_p scop, struct loop *loop,
if (TREE_CODE (nb_iters) == INTEGER_CST)
{
c = isl_inequality_alloc
- (isl_local_space_from_space(isl_space_copy (space)));
+ (isl_local_space_from_space (isl_space_copy (space)));
c = isl_constraint_set_coefficient_si (c, isl_dim_set, pos, -1);
tree_int_to_gmp (nb_iters, g);
isl_int_set_gmp (v, g);
@@ -1132,8 +1132,8 @@ add_condition_to_pbb (poly_bb_p pbb, gimple stmt, enum tree_code code)
break;
default:
- isl_pw_aff_free(lhs);
- isl_pw_aff_free(rhs);
+ isl_pw_aff_free (lhs);
+ isl_pw_aff_free (rhs);
return;
}
@@ -1191,14 +1191,6 @@ add_conditions_to_constraints (scop_p scop)
add_conditions_to_domain (pbb);
}
-/* Structure used to pass data to dom_walk. */
-
-struct bsc
-{
- vec<gimple> *conditions, *cases;
- sese region;
-};
-
/* Returns a COND_EXPR statement when BB has a single predecessor, the
edge between BB and its predecessor is not a loop exit edge, and
the last statement of the single predecessor is a COND_EXPR. */
@@ -1224,20 +1216,43 @@ single_pred_cond_non_loop_exit (basic_block bb)
return NULL;
}
+class sese_dom_walker : public dom_walker
+{
+public:
+ sese_dom_walker (cdi_direction, sese);
+ ~sese_dom_walker ();
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+
+private:
+ vec<gimple> m_conditions, m_cases;
+ sese m_region;
+};
+
+sese_dom_walker::sese_dom_walker (cdi_direction direction, sese region)
+ : dom_walker (direction), m_region (region)
+{
+ m_conditions.create (3);
+ m_cases.create (3);
+}
+
+sese_dom_walker::~sese_dom_walker ()
+{
+ m_conditions.release ();
+ m_cases.release ();
+}
+
/* 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)
+void
+sese_dom_walker::before_dom_children (basic_block bb)
{
- struct bsc *data = (struct bsc *) dw_data->global_data;
- vec<gimple> *conditions = data->conditions;
- vec<gimple> *cases = data->cases;
gimple_bb_p gbb;
gimple stmt;
- if (!bb_in_sese_p (bb, data->region))
+ if (!bb_in_sese_p (bb, m_region))
return;
stmt = single_pred_cond_non_loop_exit (bb);
@@ -1246,75 +1261,39 @@ build_sese_conditions_before (struct dom_walk_data *dw_data,
{
edge e = single_pred_edge (bb);
- conditions->safe_push (stmt);
+ m_conditions.safe_push (stmt);
if (e->flags & EDGE_TRUE_VALUE)
- cases->safe_push (stmt);
+ m_cases.safe_push (stmt);
else
- cases->safe_push (NULL);
+ m_cases.safe_push (NULL);
}
gbb = gbb_from_bb (bb);
if (gbb)
{
- GBB_CONDITIONS (gbb) = conditions->copy ();
- GBB_CONDITION_CASES (gbb) = cases->copy ();
+ GBB_CONDITIONS (gbb) = m_conditions.copy ();
+ GBB_CONDITION_CASES (gbb) = m_cases.copy ();
}
}
/* 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)
+void
+sese_dom_walker::after_dom_children (basic_block bb)
{
- struct bsc *data = (struct bsc *) dw_data->global_data;
- vec<gimple> *conditions = data->conditions;
- vec<gimple> *cases = data->cases;
-
- if (!bb_in_sese_p (bb, data->region))
+ if (!bb_in_sese_p (bb, m_region))
return;
if (single_pred_cond_non_loop_exit (bb))
{
- conditions->pop ();
- cases->pop ();
+ m_conditions.pop ();
+ m_cases.pop ();
}
}
-/* Record all conditions in REGION. */
-
-static void
-build_sese_conditions (sese region)
-{
- struct dom_walk_data walk_data;
- vec<gimple> conditions;
- conditions.create (3);
- vec<gimple> cases;
- cases.create (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);
-
- conditions.release ();
- cases.release ();
-}
-
/* Add constraints on the possible values of parameter P from the type
of P. */
@@ -3179,7 +3158,8 @@ build_poly_scop (scop_p scop)
rewrite_commutative_reductions_out_of_ssa (scop);
build_sese_loop_nests (region);
- build_sese_conditions (region);
+ /* Record all conditions in REGION. */
+ sese_dom_walker (CDI_DOMINATORS, region).walk (cfun->cfg->x_entry_block_ptr);
find_scop_parameters (scop);
max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index f9536639412..cbd0b5a1568 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "diagnostic-core.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-dump.h"
#include "cfgloop.h"
#include "tree-chrec.h"
@@ -265,7 +265,7 @@ graphite_transform_loops (void)
return;
ctx = isl_ctx_alloc ();
- isl_options_set_on_error(ctx, ISL_ON_ERROR_ABORT);
+ isl_options_set_on_error (ctx, ISL_ON_ERROR_ABORT);
if (!graphite_initialize (ctx))
return;
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 61eaaefa418..aab5748f67b 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2605,7 +2605,7 @@ rank_for_schedule (const void *x, const void *y)
}
info_val = (*current_sched_info->rank) (tmp, tmp2);
- if(flag_sched_rank_heuristic && info_val)
+ if (flag_sched_rank_heuristic && info_val)
return info_val;
/* Compare insns based on their relation to the last scheduled
@@ -7879,7 +7879,7 @@ create_check_block_twin (rtx insn, bool mutate_p)
/* Fix priorities. If MUTATE_P is nonzero, this is not necessary,
because it'll be done later in add_to_speculative_block. */
{
- rtx_vec_t priorities_roots = rtx_vec_t();
+ rtx_vec_t priorities_roots = rtx_vec_t ();
clear_priorities (twin, &priorities_roots);
calc_priorities (priorities_roots);
diff --git a/gcc/hash-table.c b/gcc/hash-table.c
index d3cb7b10818..1cf7b234862 100644
--- a/gcc/hash-table.c
+++ b/gcc/hash-table.c
@@ -111,7 +111,7 @@ unsigned int
hash_table_higher_prime_index (unsigned long n)
{
unsigned int low = 0;
- unsigned int high = sizeof(prime_tab) / sizeof(prime_tab[0]);
+ unsigned int high = sizeof (prime_tab) / sizeof (prime_tab[0]);
while (low != high)
{
diff --git a/gcc/hash-table.h b/gcc/hash-table.h
index 00637789923..5f80efb6bf4 100644
--- a/gcc/hash-table.h
+++ b/gcc/hash-table.h
@@ -419,8 +419,8 @@ public:
inline iterator &operator ++ ();
inline bool operator != (const iterator &) const;
private:
- value_type **slot_;
- value_type **limit_;
+ value_type **m_slot;
+ value_type **m_limit;
};
private:
@@ -456,8 +456,8 @@ public:
int (*Callback) (value_type **slot, Argument argument)>
void traverse (Argument argument);
- iterator begin();
- iterator end();
+ iterator begin ();
+ iterator end ();
};
@@ -522,7 +522,7 @@ hash_table <Descriptor, Allocator>::remove_elt (const value_type *value)
template <typename Descriptor,
template <typename Type> class Allocator>
inline size_t
-hash_table <Descriptor, Allocator>::size()
+hash_table <Descriptor, Allocator>::size ()
{
return htab->size;
}
@@ -556,7 +556,7 @@ hash_table <Descriptor, Allocator>::elements_with_deleted ()
template <typename Descriptor,
template <typename Type> class Allocator>
inline double
-hash_table <Descriptor, Allocator>::collisions()
+hash_table <Descriptor, Allocator>::collisions ()
{
if (htab->searches == 0)
return 0.0;
@@ -959,7 +959,7 @@ template <typename Descriptor,
template <typename Type> class Allocator>
inline
hash_table <Descriptor, Allocator>::iterator::iterator ()
-: slot_ (NULL), limit_ (NULL)
+: m_slot (NULL), m_limit (NULL)
{
}
@@ -970,7 +970,7 @@ template <typename Descriptor,
inline
hash_table <Descriptor, Allocator>::iterator::iterator
(value_type **slot, value_type **limit)
-: slot_ (slot), limit_ (limit)
+: m_slot (slot), m_limit (limit)
{
}
@@ -981,7 +981,7 @@ template <typename Descriptor,
inline typename hash_table <Descriptor, Allocator>::value_type &
hash_table <Descriptor, Allocator>::iterator::operator * ()
{
- return **slot_;
+ return **m_slot;
}
/* Slide down the iterator slots until an active entry is found. */
@@ -991,14 +991,14 @@ template <typename Descriptor,
void
hash_table <Descriptor, Allocator>::iterator::slide ()
{
- for ( ; slot_ < limit_; ++slot_ )
+ for ( ; m_slot < m_limit; ++m_slot )
{
- value_type *x = *slot_;
+ value_type *x = *m_slot;
if (x != HTAB_EMPTY_ENTRY && x != HTAB_DELETED_ENTRY)
return;
}
- slot_ = NULL;
- limit_ = NULL;
+ m_slot = NULL;
+ m_limit = NULL;
}
/* Bump the iterator. */
@@ -1008,7 +1008,7 @@ template <typename Descriptor,
inline typename hash_table <Descriptor, Allocator>::iterator &
hash_table <Descriptor, Allocator>::iterator::operator ++ ()
{
- ++slot_;
+ ++m_slot;
slide ();
return *this;
}
@@ -1021,7 +1021,7 @@ inline bool
hash_table <Descriptor, Allocator>::iterator::
operator != (const iterator &other) const
{
- return slot_ != other.slot_ || limit_ != other.limit_;
+ return m_slot != other.m_slot || m_limit != other.m_limit;
}
/* Hash table iterator producers. */
diff --git a/gcc/hwint.c b/gcc/hwint.c
index 134fe1da2cc..9e99dd99e0b 100644
--- a/gcc/hwint.c
+++ b/gcc/hwint.c
@@ -93,7 +93,7 @@ ctz_hwi (unsigned HOST_WIDE_INT x)
int
clz_hwi (unsigned HOST_WIDE_INT x)
{
- return HOST_BITS_PER_WIDE_INT - 1 - floor_log2(x);
+ return HOST_BITS_PER_WIDE_INT - 1 - floor_log2 (x);
}
/* Similar to ctz_hwi, except that the least significant bit is numbered
diff --git a/gcc/hwint.h b/gcc/hwint.h
index 9930baac100..d2c2ec377b0 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -37,7 +37,7 @@
# if GCC_VERSION >= 3000
# define HAVE_LONG_LONG 1
# define SIZEOF_LONG_LONG 8
-extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1];
+extern char sizeof_long_long_must_be_8[sizeof (long long) == 8 ? 1 : -1];
# endif
#endif
@@ -110,11 +110,11 @@ extern char sizeof_long_long_must_be_8[sizeof(long long) == 8 ? 1 : -1];
#endif
-#define HOST_WIDE_INT_UC(X) HOST_WIDE_INT_C(X ## U)
-#define HOST_WIDE_INT_1 HOST_WIDE_INT_C(1)
-#define HOST_WIDE_INT_1U HOST_WIDE_INT_UC(1)
-#define HOST_WIDE_INT_M1 HOST_WIDE_INT_C(-1)
-#define HOST_WIDE_INT_M1U HOST_WIDE_INT_UC(-1)
+#define HOST_WIDE_INT_UC(X) HOST_WIDE_INT_C (X ## U)
+#define HOST_WIDE_INT_1 HOST_WIDE_INT_C (1)
+#define HOST_WIDE_INT_1U HOST_WIDE_INT_UC (1)
+#define HOST_WIDE_INT_M1 HOST_WIDE_INT_C (-1)
+#define HOST_WIDE_INT_M1U HOST_WIDE_INT_UC (-1)
/* This is a magic identifier which allows GCC to figure out the type
of HOST_WIDE_INT for %wd specifier checks. You must issue this
@@ -168,7 +168,7 @@ typedef HOST_WIDE_INT __gcc_host_wide_int__;
# define HOST_WIDEST_INT_PRINT_UNSIGNED HOST_WIDE_INT_PRINT_UNSIGNED
# define HOST_WIDEST_INT_PRINT_HEX HOST_WIDE_INT_PRINT_HEX
# define HOST_WIDEST_INT_PRINT_DOUBLE_HEX HOST_WIDE_INT_PRINT_DOUBLE_HEX
-# define HOST_WIDEST_INT_C(X) HOST_WIDE_INT(X)
+# define HOST_WIDEST_INT_C(X) HOST_WIDE_INT (X)
#else
# if HOST_BITS_PER_LONGLONG >= 64
# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index ebc4f1c3e54..fafff9d0925 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -91,7 +91,7 @@ static rtx last_active_insn (basic_block, int);
static rtx find_active_insn_before (basic_block, rtx);
static rtx find_active_insn_after (basic_block, rtx);
static basic_block block_fallthru (basic_block);
-static int cond_exec_process_insns (ce_if_block_t *, rtx, rtx, rtx, rtx, int);
+static int cond_exec_process_insns (ce_if_block_t *, rtx, rtx, rtx, int, int);
static rtx cond_exec_get_condition (rtx);
static rtx noce_get_condition (rtx, rtx *, bool);
static int noce_operand_ok (const_rtx);
@@ -316,7 +316,7 @@ cond_exec_process_insns (ce_if_block_t *ce_info ATTRIBUTE_UNUSED,
/* if block information */rtx start,
/* first insn to look at */rtx end,
/* last insn to look at */rtx test,
- /* conditional execution test */rtx prob_val,
+ /* conditional execution test */int prob_val,
/* probability of branch taken. */int mod_ok)
{
int must_be_last = FALSE;
@@ -336,7 +336,7 @@ cond_exec_process_insns (ce_if_block_t *ce_info ATTRIBUTE_UNUSED,
if (NOTE_P (insn) || DEBUG_INSN_P (insn))
goto insn_done;
- gcc_assert(NONJUMP_INSN_P (insn) || CALL_P (insn));
+ gcc_assert (NONJUMP_INSN_P (insn) || CALL_P (insn));
/* Remove USE insns that get in the way. */
if (reload_completed && GET_CODE (PATTERN (insn)) == USE)
@@ -387,10 +387,10 @@ cond_exec_process_insns (ce_if_block_t *ce_info ATTRIBUTE_UNUSED,
validate_change (insn, &PATTERN (insn), pattern, 1);
- if (CALL_P (insn) && prob_val)
+ if (CALL_P (insn) && prob_val >= 0)
validate_change (insn, &REG_NOTES (insn),
- alloc_EXPR_LIST (REG_BR_PROB, prob_val,
- REG_NOTES (insn)), 1);
+ gen_rtx_INT_LIST ((enum machine_mode) REG_BR_PROB,
+ prob_val, REG_NOTES (insn)), 1);
insn_done:
if (insn == end)
@@ -449,14 +449,15 @@ cond_exec_process_if_block (ce_if_block_t * ce_info,
int then_mod_ok; /* whether conditional mods are ok in THEN */
rtx true_expr; /* test for else block insns */
rtx false_expr; /* test for then block insns */
- rtx true_prob_val; /* probability of else block */
- rtx false_prob_val; /* probability of then block */
+ int true_prob_val; /* probability of else block */
+ int false_prob_val; /* probability of then block */
rtx then_last_head = NULL_RTX; /* Last match at the head of THEN */
rtx else_last_head = NULL_RTX; /* Last match at the head of ELSE */
rtx then_first_tail = NULL_RTX; /* First match at the tail of THEN */
rtx else_first_tail = NULL_RTX; /* First match at the tail of ELSE */
int then_n_insns, else_n_insns, n_insns;
enum rtx_code false_code;
+ rtx note;
/* If test is comprised of && or || elements, and we've failed at handling
all of them together, just use the last test if it is the special case of
@@ -588,14 +589,17 @@ cond_exec_process_if_block (ce_if_block_t * ce_info,
goto fail;
#endif
- true_prob_val = find_reg_note (BB_END (test_bb), REG_BR_PROB, NULL_RTX);
- if (true_prob_val)
+ note = find_reg_note (BB_END (test_bb), REG_BR_PROB, NULL_RTX);
+ if (note)
{
- true_prob_val = XEXP (true_prob_val, 0);
- false_prob_val = GEN_INT (REG_BR_PROB_BASE - INTVAL (true_prob_val));
+ true_prob_val = XINT (note, 0);
+ false_prob_val = REG_BR_PROB_BASE - true_prob_val;
}
else
- false_prob_val = NULL_RTX;
+ {
+ true_prob_val = -1;
+ false_prob_val = -1;
+ }
/* If we have && or || tests, do them here. These tests are in the adjacent
blocks after the first block containing the test. */
@@ -4113,15 +4117,14 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
All that's left is making sure the insns involved can actually
be predicated. */
- rtx cond, prob_val;
+ rtx cond;
cond = cond_exec_get_condition (jump);
if (! cond)
return FALSE;
- prob_val = find_reg_note (jump, REG_BR_PROB, NULL_RTX);
- if (prob_val)
- prob_val = XEXP (prob_val, 0);
+ rtx note = find_reg_note (jump, REG_BR_PROB, NULL_RTX);
+ int prob_val = (note ? XINT (note, 0) : -1);
if (reversep)
{
@@ -4130,8 +4133,8 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb,
return FALSE;
cond = gen_rtx_fmt_ee (rev, GET_MODE (cond), XEXP (cond, 0),
XEXP (cond, 1));
- if (prob_val)
- prob_val = GEN_INT (REG_BR_PROB_BASE - INTVAL (prob_val));
+ if (prob_val >= 0)
+ prob_val = REG_BR_PROB_BASE - prob_val;
}
if (cond_exec_process_insns (NULL, head, end, cond, prob_val, 0)
@@ -4500,8 +4503,8 @@ const pass_data pass_data_rtl_ifcvt =
class pass_rtl_ifcvt : public rtl_opt_pass
{
public:
- pass_rtl_ifcvt(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_ifcvt, ctxt)
+ pass_rtl_ifcvt (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_ifcvt, ctxt)
{}
/* opt_pass methods: */
@@ -4555,8 +4558,8 @@ const pass_data pass_data_if_after_combine =
class pass_if_after_combine : public rtl_opt_pass
{
public:
- pass_if_after_combine(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_if_after_combine, ctxt)
+ pass_if_after_combine (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_if_after_combine, ctxt)
{}
/* opt_pass methods: */
@@ -4609,8 +4612,8 @@ const pass_data pass_data_if_after_reload =
class pass_if_after_reload : public rtl_opt_pass
{
public:
- pass_if_after_reload(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_if_after_reload, ctxt)
+ pass_if_after_reload (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_if_after_reload, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/incpath.c b/gcc/incpath.c
index 018da982c14..54b636034f3 100644
--- a/gcc/incpath.c
+++ b/gcc/incpath.c
@@ -33,7 +33,7 @@
VMS has non-numeric inodes. */
#ifdef VMS
# define INO_T_EQ(A, B) (!memcmp (&(A), &(B), sizeof (A)))
-# define INO_T_COPY(DEST, SRC) memcpy(&(DEST), &(SRC), sizeof (SRC))
+# define INO_T_COPY(DEST, SRC) memcpy (&(DEST), &(SRC), sizeof (SRC))
#elif !defined (HOST_LACKS_INODE_NUMBERS)
# define INO_T_EQ(A, B) ((A) == (B))
# define INO_T_COPY(DEST, SRC) (DEST) = (SRC)
@@ -41,7 +41,7 @@
#if defined INO_T_EQ
#define DIRS_EQ(A, B) ((A)->dev == (B)->dev \
- && INO_T_EQ((A)->ino, (B)->ino))
+ && INO_T_EQ ((A)->ino, (B)->ino))
#else
#define DIRS_EQ(A, B) (!filename_cmp ((A)->canonical_name, (B)->canonical_name))
#endif
@@ -128,7 +128,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
const char *imultilib, int cxx_stdinc)
{
const struct default_include *p;
- int relocated = cpp_relocated();
+ int relocated = cpp_relocated ();
size_t len;
if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0)
diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index ddb0b3792ba..2a15b3e0a6f 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -158,8 +158,8 @@ const pass_data pass_data_initialize_regs =
class pass_initialize_regs : public rtl_opt_pass
{
public:
- pass_initialize_regs(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_initialize_regs, ctxt)
+ pass_initialize_regs (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_initialize_regs, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/input.h b/gcc/input.h
index 56f6de0e0e4..8fdc7b28d92 100644
--- a/gcc/input.h
+++ b/gcc/input.h
@@ -37,7 +37,7 @@ extern char builtins_location_check[(BUILTINS_LOCATION
< RESERVED_LOCATION_COUNT) ? 1 : -1];
extern expanded_location expand_location (source_location);
-extern const char * location_get_source_line(expanded_location xloc);
+extern const char *location_get_source_line (expanded_location xloc);
extern expanded_location expand_location_to_spelling_point (source_location);
extern source_location expansion_point_location_if_in_system_header (source_location);
@@ -51,10 +51,11 @@ extern location_t input_location;
#define LOCATION_LINE(LOC) ((expand_location (LOC)).line)
#define LOCATION_COLUMN(LOC)((expand_location (LOC)).column)
#define LOCATION_LOCUS(LOC) \
- ((IS_ADHOC_LOC(LOC)) ? get_location_from_adhoc_loc (line_table, LOC) : (LOC))
+ ((IS_ADHOC_LOC (LOC)) ? get_location_from_adhoc_loc (line_table, LOC) \
+ : (LOC))
#define LOCATION_BLOCK(LOC) \
((tree) ((IS_ADHOC_LOC (LOC)) ? get_data_from_adhoc_loc (line_table, (LOC)) \
- : NULL))
+ : NULL))
#define input_line LOCATION_LINE (input_location)
#define input_filename LOCATION_FILE (input_location)
diff --git a/gcc/intl.c b/gcc/intl.c
index 262745f8049..aa443509a6f 100644
--- a/gcc/intl.c
+++ b/gcc/intl.c
@@ -140,7 +140,7 @@ char *
get_spaces (const char *str)
{
size_t len = gcc_gettext_width (str);
- char *spaces = XNEWVEC(char, len + 1);
+ char *spaces = XNEWVEC (char, len + 1);
memset (spaces, ' ', len);
spaces[len] = '\0';
return spaces;
diff --git a/gcc/intl.h b/gcc/intl.h
index e1c6c2b22f6..d34973e88fc 100644
--- a/gcc/intl.h
+++ b/gcc/intl.h
@@ -38,12 +38,12 @@ extern size_t gcc_gettext_width (const char *);
# define bindtextdomain(domain, directory) (domain)
# undef gettext
# define gettext(msgid) (msgid)
-# define ngettext(singular,plural,n) fake_ngettext(singular,plural,n)
+# define ngettext(singular,plural,n) fake_ngettext (singular, plural, n)
# define gcc_init_libintl() /* nothing */
-# define gcc_gettext_width(s) strlen(s)
+# define gcc_gettext_width(s) strlen (s)
-extern const char *fake_ngettext(const char *singular,const char *plural,
- unsigned long int n);
+extern const char *fake_ngettext (const char *singular, const char *plural,
+ unsigned long int n);
#endif
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 78dee15aad8..c38ba82e5f0 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -108,7 +108,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "cgraph.h"
#include "ipa-prop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "flags.h"
#include "diagnostic.h"
@@ -1484,6 +1484,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
HOST_WIDE_INT token, anc_offset;
tree otr_type;
tree t;
+ tree target;
if (param_index == -1
|| known_vals.length () <= (unsigned int) param_index)
@@ -1552,7 +1553,7 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
binfo = get_binfo_at_offset (binfo, anc_offset, otr_type);
if (!binfo)
return NULL_TREE;
- return gimple_get_virt_method_for_binfo (token, binfo);
+ target = gimple_get_virt_method_for_binfo (token, binfo);
}
else
{
@@ -1561,8 +1562,15 @@ ipa_get_indirect_edge_target_1 (struct cgraph_edge *ie,
binfo = get_binfo_at_offset (t, anc_offset, otr_type);
if (!binfo)
return NULL_TREE;
- return gimple_get_virt_method_for_binfo (token, binfo);
+ target = gimple_get_virt_method_for_binfo (token, binfo);
}
+#ifdef ENABLE_CHECKING
+ if (target)
+ gcc_assert (possible_polymorphic_call_target_p
+ (ie, cgraph_get_node (target)));
+#endif
+
+ return target;
}
@@ -2113,23 +2121,17 @@ propagate_constants_topo (struct topo_info *topo)
for (i = topo->nnodes - 1; i >= 0; i--)
{
+ unsigned j;
struct cgraph_node *v, *node = topo->order[i];
- struct ipa_dfs_info *node_dfs_info;
-
- if (!cgraph_function_with_gimple_body_p (node))
- continue;
+ vec<cgraph_node_ptr> cycle_nodes = ipa_get_nodes_in_cycle (node);
- node_dfs_info = (struct ipa_dfs_info *) node->symbol.aux;
/* First, iteratively propagate within the strongly connected component
until all lattices stabilize. */
- v = node_dfs_info->next_cycle;
- while (v)
- {
+ FOR_EACH_VEC_ELT (cycle_nodes, j, v)
+ if (cgraph_function_with_gimple_body_p (v))
push_node_to_stack (topo, v);
- v = ((struct ipa_dfs_info *) v->symbol.aux)->next_cycle;
- }
- v = node;
+ v = pop_node_from_stack (topo);
while (v)
{
struct cgraph_edge *cs;
@@ -2144,19 +2146,18 @@ propagate_constants_topo (struct topo_info *topo)
/* Afterwards, propagate along edges leading out of the SCC, calculates
the local effects of the discovered constants and all valid values to
their topological sort. */
- v = node;
- while (v)
- {
- struct cgraph_edge *cs;
-
- estimate_local_effects (v);
- add_all_node_vals_to_toposort (v);
- for (cs = v->callees; cs; cs = cs->next_callee)
- if (!edge_within_scc (cs))
- propagate_constants_accross_call (cs);
+ FOR_EACH_VEC_ELT (cycle_nodes, j, v)
+ if (cgraph_function_with_gimple_body_p (v))
+ {
+ struct cgraph_edge *cs;
- v = ((struct ipa_dfs_info *) v->symbol.aux)->next_cycle;
- }
+ estimate_local_effects (v);
+ add_all_node_vals_to_toposort (v);
+ for (cs = v->callees; cs; cs = cs->next_callee)
+ if (!edge_within_scc (cs))
+ propagate_constants_accross_call (cs);
+ }
+ cycle_nodes.release ();
}
}
@@ -3022,7 +3023,7 @@ intersect_aggregates_with_edge (struct cgraph_edge *cs, int index,
}
else
{
- inter.release();
+ inter.release ();
return vec<ipa_agg_jf_item_t>();
}
return inter;
@@ -3193,7 +3194,7 @@ cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs,
return false;
values = intersect_aggregates_with_edge (cs, i, values);
- if (!values.exists())
+ if (!values.exists ())
return false;
for (struct ipa_agg_replacement_value *av = aggval; av; av = av->next)
@@ -3212,7 +3213,7 @@ cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs,
}
if (!found)
{
- values.release();
+ values.release ();
return false;
}
}
@@ -3678,19 +3679,19 @@ const pass_data pass_data_ipa_cp =
class pass_ipa_cp : public ipa_opt_pass_d
{
public:
- pass_ipa_cp(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_cp, ctxt,
- ipcp_generate_summary, /* generate_summary */
- ipcp_write_summary, /* write_summary */
- ipcp_read_summary, /* read_summary */
- ipa_prop_write_all_agg_replacement, /*
- write_optimization_summary */
- ipa_prop_read_all_agg_replacement, /*
- read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- ipcp_transform_function, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_cp (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_cp, ctxt,
+ ipcp_generate_summary, /* generate_summary */
+ ipcp_write_summary, /* write_summary */
+ ipcp_read_summary, /* read_summary */
+ ipa_prop_write_all_agg_replacement, /*
+ write_optimization_summary */
+ ipa_prop_read_all_agg_replacement, /*
+ read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ ipcp_transform_function, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 96622b25b1b..10499e1cfc0 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -373,7 +373,7 @@ add_type_duplicate (odr_type val, tree type)
unsigned int i;
TYPE_BINFO (val->type) = TYPE_BINFO (type);
- for (i = 0; i < val->types->length(); i++)
+ for (i = 0; i < val->types->length (); i++)
{
if (TYPE_BINFO ((*val->types)[i])
== master_binfo)
@@ -438,7 +438,7 @@ get_odr_type (tree type, bool insert)
}
/* First record bases, then add into array so ids are increasing. */
if (odr_types_ptr)
- val->id = odr_types.length();
+ val->id = odr_types.length ();
vec_safe_push (odr_types_ptr, val);
}
return val;
@@ -460,17 +460,17 @@ dump_odr_type (FILE *f, odr_type t, int indent=0)
DECL_SOURCE_FILE (TYPE_NAME (t->type)),
DECL_SOURCE_LINE (TYPE_NAME (t->type)));
}
- if (t->bases.length())
+ if (t->bases.length ())
{
fprintf (f, "%*s base odr type ids: ", indent * 2, "");
- for (i = 0; i < t->bases.length(); i++)
+ for (i = 0; i < t->bases.length (); i++)
fprintf (f, " %i", t->bases[i]->id);
fprintf (f, "\n");
}
- if (t->derived_types.length())
+ if (t->derived_types.length ())
{
fprintf (f, "%*s derived types:\n", indent * 2, "");
- for (i = 0; i < t->derived_types.length(); i++)
+ for (i = 0; i < t->derived_types.length (); i++)
dump_odr_type (f, t->derived_types[i], indent + 1);
}
fprintf (f, "\n");
@@ -485,19 +485,19 @@ dump_type_inheritance_graph (FILE *f)
if (!odr_types_ptr)
return;
fprintf (f, "\n\nType inheritance graph:\n");
- for (i = 0; i < odr_types.length(); i++)
+ for (i = 0; i < odr_types.length (); i++)
{
- if (odr_types[i]->bases.length() == 0)
+ if (odr_types[i]->bases.length () == 0)
dump_odr_type (f, odr_types[i]);
}
- for (i = 0; i < odr_types.length(); i++)
+ for (i = 0; i < odr_types.length (); i++)
{
- if (odr_types[i]->types && odr_types[i]->types->length())
+ if (odr_types[i]->types && odr_types[i]->types->length ())
{
unsigned int j;
fprintf (f, "Duplicate tree types for odr type %i\n", i);
print_node (f, "", odr_types[i]->type, 0);
- for (j = 0; j < odr_types[i]->types->length(); j++)
+ for (j = 0; j < odr_types[i]->types->length (); j++)
{
tree t;
fprintf (f, "duplicate #%i\n", j);
@@ -665,7 +665,7 @@ possible_polymorphic_call_targets_1 (vec <cgraph_node *> &nodes,
record_binfo (nodes, binfo, otr_type, binfo, otr_token, inserted,
matched_vtables, type->anonymous_namespace);
- for (i = 0; i < type->derived_types.length(); i++)
+ for (i = 0; i < type->derived_types.length (); i++)
possible_polymorphic_call_targets_1 (nodes, inserted,
matched_vtables,
otr_type,
@@ -854,7 +854,7 @@ possible_polymorphic_call_targets (tree otr_type,
/* Walk recursively all derived types. Here we need to lookup proper basetype
via their BINFO walk that is done by record_binfo */
- for (i = 0; i < type->derived_types.length(); i++)
+ for (i = 0; i < type->derived_types.length (); i++)
possible_polymorphic_call_targets_1 (nodes, inserted,
matched_vtables,
otr_type, type->derived_types[i],
@@ -905,13 +905,19 @@ possible_polymorphic_call_target_p (tree otr_type,
{
vec <cgraph_node *> targets;
unsigned int i;
+ bool final;
if (!odr_hash.is_created ())
return true;
- targets = possible_polymorphic_call_targets (otr_type, otr_token);
+ targets = possible_polymorphic_call_targets (otr_type, otr_token, &final);
for (i = 0; i < targets.length (); i++)
if (n == targets[i])
return true;
+
+ /* At a moment we allow middle end to dig out new external declarations
+ as a targets of polymorphic calls. */
+ if (!final && !n->symbol.definition)
+ return true;
return false;
}
@@ -1024,7 +1030,7 @@ ipa_devirt (void)
nmultiple++;
continue;
}
- for (i = 0; i < targets.length(); i++)
+ for (i = 0; i < targets.length (); i++)
if (likely_target_p (targets[i]))
{
if (likely_target)
@@ -1098,7 +1104,13 @@ ipa_devirt (void)
cgraph_node_name (likely_target),
likely_target->symbol.order);
if (!symtab_can_be_discarded ((symtab_node) likely_target))
- likely_target = cgraph (symtab_nonoverwritable_alias ((symtab_node)likely_target));
+ {
+ cgraph_node *alias;
+ alias = cgraph (symtab_nonoverwritable_alias
+ ((symtab_node)likely_target));
+ if (alias)
+ likely_target = alias;
+ }
nconverted++;
update = true;
cgraph_turn_edge_to_speculative
@@ -1128,7 +1140,7 @@ ipa_devirt (void)
static bool
gate_ipa_devirt (void)
{
- return flag_devirtualize_speculatively && !in_lto_p && optimize;
+ return flag_devirtualize_speculatively && optimize;
}
namespace {
@@ -1151,17 +1163,17 @@ const pass_data pass_data_ipa_devirt =
class pass_ipa_devirt : public ipa_opt_pass_d
{
public:
- pass_ipa_devirt(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_devirt, ctxt,
- NULL, /* generate_summary */
- NULL, /* write_summary */
- NULL, /* read_summary */
- NULL, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_devirt (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_devirt, ctxt,
+ NULL, /* generate_summary */
+ NULL, /* write_summary */
+ NULL, /* read_summary */
+ NULL, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index fb0c8382020..7ca09ad0b91 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -79,7 +79,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "coverage.h"
#include "ggc.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "ipa-prop.h"
#include "lto-streamer.h"
#include "data-streamer.h"
@@ -2664,7 +2664,11 @@ compute_inline_parameters (struct cgraph_node *node, bool early)
info->stack_frame_offset = 0;
/* Can this function be inlined at all? */
- info->inlinable = tree_inlinable_function_p (node->symbol.decl);
+ if (!optimize && !lookup_attribute ("always_inline",
+ DECL_ATTRIBUTES (node->symbol.decl)))
+ info->inlinable = false;
+ else
+ info->inlinable = tree_inlinable_function_p (node->symbol.decl);
/* Type attributes can use parameter indices to describe them. */
if (TYPE_ATTRIBUTES (TREE_TYPE (node->symbol.decl)))
@@ -2735,12 +2739,12 @@ const pass_data pass_data_inline_parameters =
class pass_inline_parameters : public gimple_opt_pass
{
public:
- pass_inline_parameters(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_inline_parameters, ctxt)
+ pass_inline_parameters (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_inline_parameters, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_inline_parameters (ctxt_); }
+ opt_pass * clone () { return new pass_inline_parameters (m_ctxt); }
unsigned int execute () {
return compute_inline_parameters_for_current ();
}
@@ -3580,6 +3584,7 @@ estimate_size_after_inlining (struct cgraph_node *node,
struct growth_data
{
+ struct cgraph_node *node;
bool self_recursive;
int growth;
};
@@ -3597,9 +3602,9 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
{
gcc_checking_assert (e->inline_failed);
- if (e->caller == node
+ if (e->caller == d->node
|| (e->caller->global.inlined_to
- && e->caller->global.inlined_to == node))
+ && e->caller->global.inlined_to == d->node))
d->self_recursive = true;
d->growth += estimate_edge_growth (e);
}
@@ -3612,7 +3617,7 @@ do_estimate_growth_1 (struct cgraph_node *node, void *data)
int
do_estimate_growth (struct cgraph_node *node)
{
- struct growth_data d = { 0, false };
+ struct growth_data d = { node, 0, false };
struct inline_summary *info = inline_summary (node);
cgraph_for_node_and_aliases (node, do_estimate_growth_1, &d, true);
@@ -3677,6 +3682,22 @@ inline_analyze_function (struct cgraph_node *node)
if (optimize && !node->thunk.thunk_p)
inline_indirect_intraprocedural_analysis (node);
compute_inline_parameters (node, false);
+ if (!optimize)
+ {
+ struct cgraph_edge *e;
+ for (e = node->callees; e; e = e->next_callee)
+ {
+ if (e->inline_failed == CIF_FUNCTION_NOT_CONSIDERED)
+ e->inline_failed = CIF_FUNCTION_NOT_OPTIMIZED;
+ e->call_stmt_cannot_inline_p = true;
+ }
+ for (e = node->indirect_calls; e; e = e->next_callee)
+ {
+ if (e->inline_failed == CIF_FUNCTION_NOT_CONSIDERED)
+ e->inline_failed = CIF_FUNCTION_NOT_OPTIMIZED;
+ e->call_stmt_cannot_inline_p = true;
+ }
+ }
pop_cfun ();
}
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index 2bada90bc8a..d8a637cb850 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -38,7 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "coverage.h"
#include "ggc.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "ipa-prop.h"
#include "ipa-inline.h"
#include "tree-inline.h"
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 1e22d6eb87b..7735bb9da7b 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -107,7 +107,7 @@ along with GCC; see the file COPYING3. If not see
#include "coverage.h"
#include "ggc.h"
#include "rtl.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "ipa-prop.h"
#include "except.h"
#include "target.h"
@@ -275,7 +275,8 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
}
else if (e->call_stmt_cannot_inline_p)
{
- e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
+ if (e->inline_failed != CIF_FUNCTION_NOT_OPTIMIZED)
+ e->inline_failed = CIF_MISMATCHED_ARGUMENTS;
inlinable = false;
}
/* Don't inline if the functions have different EH personalities. */
@@ -740,14 +741,22 @@ want_inline_self_recursive_call_p (struct cgraph_edge *edge,
return want_inline;
}
-/* Return true when NODE has caller other than EDGE.
+/* Return true when NODE has uninlinable caller;
+ set HAS_HOT_CALL if it has hot call.
Worker for cgraph_for_node_and_aliases. */
static bool
-check_caller_edge (struct cgraph_node *node, void *edge)
+check_callers (struct cgraph_node *node, void *has_hot_call)
{
- return (node->callers
- && node->callers != edge);
+ struct cgraph_edge *e;
+ for (e = node->callers; e; e = e->next_caller)
+ {
+ if (!can_inline_edge_p (e, true))
+ return true;
+ if (!has_hot_call && cgraph_maybe_hot_edge_p (e))
+ *(bool *)has_hot_call = true;
+ }
+ return false;
}
/* If NODE has a caller, return true. */
@@ -768,7 +777,6 @@ static bool
want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold)
{
struct cgraph_node *function = cgraph_function_or_thunk_node (node, NULL);
- struct cgraph_edge *e;
bool has_hot_call = false;
/* Does it have callers? */
@@ -782,18 +790,9 @@ want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold)
/* Inlining into all callers would increase size? */
if (estimate_growth (node) > 0)
return false;
- /* Maybe other aliases has more direct calls. */
- if (cgraph_for_node_and_aliases (node, check_caller_edge, node->callers, true))
- return false;
/* All inlines must be possible. */
- for (e = node->callers; e; e = e->next_caller)
- {
- if (!can_inline_edge_p (e, true))
- return false;
- if (!has_hot_call && cgraph_maybe_hot_edge_p (e))
- has_hot_call = 1;
- }
-
+ if (cgraph_for_node_and_aliases (node, check_callers, &has_hot_call, true))
+ return false;
if (!cold && !has_hot_call)
return false;
return true;
@@ -905,8 +904,8 @@ edge_badness (struct cgraph_edge *edge, bool dump)
sreal tmp, relbenefit_real, growth_real;
int relbenefit = relative_time_benefit (callee_info, edge, edge_time);
- sreal_init(&relbenefit_real, relbenefit, 0);
- sreal_init(&growth_real, growth, 0);
+ sreal_init (&relbenefit_real, relbenefit, 0);
+ sreal_init (&growth_real, growth, 0);
/* relative_edge_count. */
sreal_init (&tmp, edge->count, 0);
@@ -1949,7 +1948,7 @@ inline_to_all_callers (struct cgraph_node *node, void *data)
{
if (dump_file)
fprintf (dump_file, "New calls found; giving up.\n");
- break;
+ return true;
}
}
return false;
@@ -2312,8 +2311,8 @@ const pass_data pass_data_early_inline =
class pass_early_inline : public gimple_opt_pass
{
public:
- pass_early_inline(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_early_inline, ctxt)
+ pass_early_inline (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_early_inline, ctxt)
{}
/* opt_pass methods: */
@@ -2362,17 +2361,17 @@ const pass_data pass_data_ipa_inline =
class pass_ipa_inline : public ipa_opt_pass_d
{
public:
- pass_ipa_inline(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_inline, ctxt,
- inline_generate_summary, /* generate_summary */
- inline_write_summary, /* write_summary */
- inline_read_summary, /* read_summary */
- NULL, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- inline_transform, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_inline (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_inline, ctxt,
+ inline_generate_summary, /* generate_summary */
+ inline_write_summary, /* write_summary */
+ inline_read_summary, /* read_summary */
+ NULL, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ inline_transform, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
diff --git a/gcc/ipa-profile.c b/gcc/ipa-profile.c
index 2b22333d1b9..bae9aecd3b1 100644
--- a/gcc/ipa-profile.c
+++ b/gcc/ipa-profile.c
@@ -240,7 +240,7 @@ ipa_profile_write_summary (void)
= lto_create_simple_output_block (LTO_section_ipa_profile);
unsigned int i;
- streamer_write_uhwi_stream (ob->main_stream, histogram.length());
+ streamer_write_uhwi_stream (ob->main_stream, histogram.length ());
for (i = 0; i < histogram.length (); i++)
{
streamer_write_gcov_count_stream (ob->main_stream, histogram[i]->count);
@@ -560,7 +560,7 @@ ipa_profile (void)
set_hot_bb_threshold (threshold);
}
}
- histogram.release();
+ histogram.release ();
free_alloc_pool (histogram_pool);
/* Produce speculative calls: we saved common traget from porfiling into
@@ -625,7 +625,13 @@ ipa_profile (void)
of N2. Speculate on the local alias to allow inlining.
*/
if (!symtab_can_be_discarded ((symtab_node) n2))
- n2 = cgraph (symtab_nonoverwritable_alias ((symtab_node)n2));
+ {
+ cgraph_node *alias;
+ alias = cgraph (symtab_nonoverwritable_alias
+ ((symtab_node)n2));
+ if (alias)
+ n2 = alias;
+ }
nconverted++;
cgraph_turn_edge_to_speculative
(e, n2,
@@ -726,17 +732,17 @@ const pass_data pass_data_ipa_profile =
class pass_ipa_profile : public ipa_opt_pass_d
{
public:
- pass_ipa_profile(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_profile, ctxt,
- ipa_profile_generate_summary, /* generate_summary */
- ipa_profile_write_summary, /* write_summary */
- ipa_profile_read_summary, /* read_summary */
- NULL, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_profile (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_profile, ctxt,
+ ipa_profile_generate_summary, /* generate_summary */
+ ipa_profile_write_summary, /* write_summary */
+ ipa_profile_read_summary, /* read_summary */
+ NULL, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index ad82d759fce..2fbc9d41541 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "cgraph.h"
#include "ipa-prop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-inline.h"
#include "ipa-inline.h"
@@ -38,6 +38,7 @@ along with GCC; see the file COPYING3. If not see
#include "data-streamer.h"
#include "tree-streamer.h"
#include "params.h"
+#include "ipa-utils.h"
/* Intermediate information about a parameter that is only useful during the
run of ipa_analyze_node and is not kept afterwards. */
@@ -1551,6 +1552,8 @@ ipa_compute_jump_functions_for_edge (struct param_analysis_info *parms_ainfo,
return;
vec_safe_grow_cleared (args->jump_functions, arg_num);
+ if (gimple_call_internal_p (call))
+ return;
if (ipa_func_spec_opts_forbid_analysis_p (cs->caller))
return;
@@ -2194,6 +2197,11 @@ ipa_intraprocedural_devirtualization (gimple call)
token = OBJ_TYPE_REF_TOKEN (otr);
fndecl = gimple_get_virt_method_for_binfo (tree_low_cst (token, 1),
binfo);
+#ifdef ENABLE_CHECKING
+ if (fndecl)
+ gcc_assert (possible_polymorphic_call_target_p
+ (otr, cgraph_get_node (fndecl)));
+#endif
return fndecl;
}
@@ -2506,6 +2514,8 @@ remove_described_reference (symtab_node symbol, struct ipa_cst_ref_desc *rdesc)
struct cgraph_edge *origin;
origin = rdesc->cs;
+ if (!origin)
+ return false;
to_del = ipa_find_reference ((symtab_node) origin->caller, symbol,
origin->call_stmt, origin->lto_stmt_uid);
if (!to_del)
@@ -2601,7 +2611,8 @@ try_make_edge_direct_simple_call (struct cgraph_edge *ie,
{
bool ok;
gcc_checking_assert (cs->callee
- && (jfunc->type != IPA_JF_CONST
+ && (cs != ie
+ || jfunc->type != IPA_JF_CONST
|| !cgraph_node_for_jfunc (jfunc)
|| cs->callee == cgraph_node_for_jfunc (jfunc)));
ok = try_decrement_rdesc_refcount (jfunc);
@@ -2646,7 +2657,13 @@ try_make_edge_direct_virtual_call (struct cgraph_edge *ie,
return NULL;
if (target)
- return ipa_make_edge_direct_to_target (ie, target);
+ {
+#ifdef ENABLE_CHECKING
+ gcc_assert (possible_polymorphic_call_target_p
+ (ie, cgraph_get_node (target)));
+#endif
+ return ipa_make_edge_direct_to_target (ie, target);
+ }
else
return NULL;
}
@@ -3019,7 +3036,14 @@ ipa_edge_removal_hook (struct cgraph_edge *cs, void *data ATTRIBUTE_UNUSED)
struct ipa_jump_func *jf;
int i;
FOR_EACH_VEC_ELT (*args->jump_functions, i, jf)
- try_decrement_rdesc_refcount (jf);
+ {
+ struct ipa_cst_ref_desc *rdesc;
+ try_decrement_rdesc_refcount (jf);
+ if (jf->type == IPA_JF_CONST
+ && (rdesc = ipa_get_jf_constant_rdesc (jf))
+ && rdesc->cs == cs)
+ rdesc->cs = NULL;
+ }
}
ipa_free_edge_args_substructures (IPA_EDGE_REF (cs));
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index ed4deae64fe..7e44d51ca59 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "tree-pass.h"
#include "langhooks.h"
@@ -759,7 +759,7 @@ analyze_function (struct cgraph_node *fn, bool ipa)
gimple_stmt_iterator gsi;
struct walk_stmt_info wi;
- memset (&wi, 0, sizeof(wi));
+ memset (&wi, 0, sizeof (wi));
for (gsi = gsi_start_bb (this_block);
!gsi_end_p (gsi);
gsi_next (&gsi))
@@ -1520,17 +1520,17 @@ const pass_data pass_data_ipa_pure_const =
class pass_ipa_pure_const : public ipa_opt_pass_d
{
public:
- pass_ipa_pure_const(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_pure_const, ctxt,
- pure_const_generate_summary, /* generate_summary */
- pure_const_write_summary, /* write_summary */
- pure_const_read_summary, /* read_summary */
- NULL, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_pure_const (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_pure_const, ctxt,
+ pure_const_generate_summary, /* generate_summary */
+ pure_const_write_summary, /* write_summary */
+ pure_const_read_summary, /* read_summary */
+ NULL, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
@@ -1704,12 +1704,12 @@ const pass_data pass_data_local_pure_const =
class pass_local_pure_const : public gimple_opt_pass
{
public:
- pass_local_pure_const(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_local_pure_const, ctxt)
+ pass_local_pure_const (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_local_pure_const, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_local_pure_const (ctxt_); }
+ opt_pass * clone () { return new pass_local_pure_const (m_ctxt); }
bool gate () { return gate_pure_const (); }
unsigned int execute () { return local_pure_const (); }
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index 3742474ed65..d9463804ea2 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -41,7 +41,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "tree-pass.h"
#include "pointer-set.h"
@@ -578,8 +578,7 @@ generate_summary (void)
EXECUTE_IF_SET_IN_BITMAP (l->statics_written,
0, index, bi)
{
- fprintf(dump_file, "%s ",
- get_static_name (index));
+ fprintf (dump_file, "%s ", get_static_name (index));
}
}
}
@@ -949,7 +948,7 @@ stream_out_bitmap (struct lto_simple_output_block *ob,
EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
{
tree decl = (tree)splay_tree_lookup (reference_vars_to_consider, index)->value;
- lto_output_var_decl_index(ob->decl_state, ob->main_stream, decl);
+ lto_output_var_decl_index (ob->decl_state, ob->main_stream, decl);
}
}
@@ -1175,20 +1174,20 @@ const pass_data pass_data_ipa_reference =
class pass_ipa_reference : public ipa_opt_pass_d
{
public:
- pass_ipa_reference(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_reference, ctxt,
- NULL, /* generate_summary */
- NULL, /* write_summary */
- NULL, /* read_summary */
- ipa_reference_write_optimization_summary, /*
- write_optimization_summary */
- ipa_reference_read_optimization_summary, /*
- read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
- {}
+ pass_ipa_reference (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_reference, ctxt,
+ NULL, /* generate_summary */
+ NULL, /* write_summary */
+ NULL, /* read_summary */
+ ipa_reference_write_optimization_summary, /*
+ write_optimization_summary */
+ ipa_reference_read_optimization_summary, /*
+ read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
+ {}
/* opt_pass methods: */
bool gate () { return gate_reference (); }
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 5df14ecb703..874e7b83542 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -81,7 +81,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "cgraph.h"
#include "ipa-prop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "flags.h"
#include "diagnostic.h"
@@ -1650,8 +1650,8 @@ const pass_data pass_data_split_functions =
class pass_split_functions : public gimple_opt_pass
{
public:
- pass_split_functions(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_split_functions, ctxt)
+ pass_split_functions (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_split_functions, ctxt)
{}
/* opt_pass methods: */
@@ -1710,8 +1710,8 @@ const pass_data pass_data_feedback_split_functions =
class pass_feedback_split_functions : public gimple_opt_pass
{
public:
- pass_feedback_split_functions(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_feedback_split_functions, ctxt)
+ pass_feedback_split_functions (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_feedback_split_functions, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index e2e169043bc..b59be8c6392 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "dumpfile.h"
#include "langhooks.h"
@@ -54,9 +54,9 @@ ipa_print_order (FILE* out,
fprintf (out, "\n\n ordered call graph: %s\n", note);
for (i = count - 1; i >= 0; i--)
- dump_cgraph_node(dump_file, order[i]);
+ dump_cgraph_node (dump_file, order[i]);
fprintf (out, "\n");
- fflush(out);
+ fflush (out);
}
diff --git a/gcc/ipa-utils.h b/gcc/ipa-utils.h
index d6f390daf15..27949e19270 100644
--- a/gcc/ipa-utils.h
+++ b/gcc/ipa-utils.h
@@ -108,6 +108,19 @@ possible_polymorphic_call_target_p (struct cgraph_edge *e,
return possible_polymorphic_call_target_p (e->indirect_info->otr_type,
e->indirect_info->otr_token, n);
}
+
+/* Return true if N can be possibly target of a polymorphic call of
+ OBJ_TYPE_REF expression CALL. */
+
+inline bool
+possible_polymorphic_call_target_p (tree call,
+ struct cgraph_node *n)
+{
+ return possible_polymorphic_call_target_p (obj_type_ref_class (call),
+ tree_low_cst
+ (OBJ_TYPE_REF_TOKEN (call), 1),
+ n);
+}
#endif /* GCC_IPA_UTILS_H */
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 91d63eb9f85..92343fb22c9 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -173,7 +173,7 @@ walk_polymorphic_call_targets (pointer_set_t *reachable_call_targets,
if (!pointer_set_insert (reachable_call_targets,
cache_token))
{
- for (i = 0; i < targets.length(); i++)
+ for (i = 0; i < targets.length (); i++)
{
struct cgraph_node *n = targets[i];
@@ -204,7 +204,7 @@ walk_polymorphic_call_targets (pointer_set_t *reachable_call_targets,
make the edge direct. */
if (final)
{
- if (targets.length() <= 1)
+ if (targets.length () <= 1)
{
cgraph_node *target, *node = edge->caller;
if (targets.length () == 1)
@@ -882,7 +882,7 @@ function_and_variable_visibility (bool whole_program)
struct varpool_node *vnode;
/* All aliases should be procssed at this point. */
- gcc_checking_assert (!alias_pairs || !alias_pairs->length());
+ gcc_checking_assert (!alias_pairs || !alias_pairs->length ());
FOR_EACH_FUNCTION (node)
{
@@ -998,7 +998,7 @@ function_and_variable_visibility (bool whole_program)
{
struct cgraph_node *alias = cgraph (symtab_nonoverwritable_alias ((symtab_node) node));
- if (alias != node)
+ if (alias && alias != node)
{
while (node->callers)
{
@@ -1122,8 +1122,9 @@ const pass_data pass_data_ipa_function_and_variable_visibility =
class pass_ipa_function_and_variable_visibility : public simple_ipa_opt_pass
{
public:
- pass_ipa_function_and_variable_visibility(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_function_and_variable_visibility, ctxt)
+ pass_ipa_function_and_variable_visibility (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_function_and_variable_visibility,
+ ctxt)
{}
/* opt_pass methods: */
@@ -1170,8 +1171,8 @@ const pass_data pass_data_ipa_free_inline_summary =
class pass_ipa_free_inline_summary : public simple_ipa_opt_pass
{
public:
- pass_ipa_free_inline_summary(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_free_inline_summary, ctxt)
+ pass_ipa_free_inline_summary (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_free_inline_summary, ctxt)
{}
/* opt_pass methods: */
@@ -1226,17 +1227,17 @@ const pass_data pass_data_ipa_whole_program_visibility =
class pass_ipa_whole_program_visibility : public ipa_opt_pass_d
{
public:
- pass_ipa_whole_program_visibility(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_whole_program_visibility, ctxt,
- NULL, /* generate_summary */
- NULL, /* write_summary */
- NULL, /* read_summary */
- NULL, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_whole_program_visibility (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_whole_program_visibility, ctxt,
+ NULL, /* generate_summary */
+ NULL, /* write_summary */
+ NULL, /* read_summary */
+ NULL, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
@@ -1559,17 +1560,17 @@ const pass_data pass_data_ipa_cdtor_merge =
class pass_ipa_cdtor_merge : public ipa_opt_pass_d
{
public:
- pass_ipa_cdtor_merge(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_cdtor_merge, ctxt,
- NULL, /* generate_summary */
- NULL, /* write_summary */
- NULL, /* read_summary */
- NULL, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_cdtor_merge (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_cdtor_merge, ctxt,
+ NULL, /* generate_summary */
+ NULL, /* write_summary */
+ NULL, /* read_summary */
+ NULL, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 0e2fd0c5510..32aec6f1da4 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -2408,8 +2408,8 @@ remove_unnecessary_regions (bool all_p)
mark_all_loops_for_removal ();
else
mark_loops_for_removal ();
- children_vec.create(last_basic_block + number_of_loops (cfun));
- removed_loop_vec.create(last_basic_block + number_of_loops (cfun));
+ children_vec.create (last_basic_block + number_of_loops (cfun));
+ removed_loop_vec.create (last_basic_block + number_of_loops (cfun));
remove_uneccesary_loop_nodes_from_loop_tree (ira_loop_tree_root);
children_vec.release ();
if (all_p)
diff --git a/gcc/ira.c b/gcc/ira.c
index 44fa0bc2835..203fbff6a26 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3515,7 +3515,7 @@ setup_reg_equiv (void)
static void
print_insn_chain (FILE *file, struct insn_chain *c)
{
- fprintf (file, "insn=%d, ", INSN_UID(c->insn));
+ fprintf (file, "insn=%d, ", INSN_UID (c->insn));
bitmap_print (file, &c->live_throughout, "live_throughout: ", ", ");
bitmap_print (file, &c->dead_or_set, "dead_or_set: ", "\n");
}
@@ -4391,9 +4391,9 @@ allocate_initial_values (void)
/* Update global register liveness information. */
FOR_EACH_BB (bb)
{
- if (REGNO_REG_SET_P(df_get_live_in (bb), regno))
+ if (REGNO_REG_SET_P (df_get_live_in (bb), regno))
SET_REGNO_REG_SET (df_get_live_in (bb), new_regno);
- if (REGNO_REG_SET_P(df_get_live_out (bb), regno))
+ if (REGNO_REG_SET_P (df_get_live_out (bb), regno))
SET_REGNO_REG_SET (df_get_live_out (bb), new_regno);
}
}
@@ -4792,8 +4792,8 @@ const pass_data pass_data_ira =
class pass_ira : public rtl_opt_pass
{
public:
- pass_ira(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_ira, ctxt)
+ pass_ira (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_ira, ctxt)
{}
/* opt_pass methods: */
@@ -4836,8 +4836,8 @@ const pass_data pass_data_reload =
class pass_reload : public rtl_opt_pass
{
public:
- pass_reload(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_reload, ctxt)
+ pass_reload (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_reload, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 9cc34c51a5a..65554bafa9d 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,21 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (jvspec.o): Remove.
+ (CFLAGS-java/jvspec.o): New variable.
+ ($(XGCJ)$(exeext), java_OBJS): Use java/jvspec.o
+ (java/jvspec.o-warn): Rename from jvspec.o-warn.
+ (JAVA_TREE_H, java/jcf-dump.o, java/boehm.o, java/builtins.o)
+ (java/class.o, java/constants.o, java/decl.o, java/except.o)
+ (java/expr.o, java/jcf-depend.o, java/jcf-parse.o)
+ (java/jvgenmain.o, java/lang.o, java/mangle.o, java/mangle_name.o)
+ (java/resource.o java/typeck.o, java/win32-host.o)
+ (java/verify-glue.o, java/verify-impl.o, java/zextract.o)
+ (java/java-gimplify.o, java/jcf-io.o, java/jcf-path.o): Remove.
+
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (jvspec.o): Don't use subshell.
+
2013-06-05 Jan Hubicka <jh@suse.cz>
* class.c (emit_register_classes_in_jcr_section): Use DECL_PRESERVE_P
diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in
index 8a6210fea3b..5ed344cc0d2 100644
--- a/gcc/java/Make-lang.in
+++ b/gcc/java/Make-lang.in
@@ -55,17 +55,13 @@ JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump
# Tell GNU make to ignore these if they exist.
.PHONY: java
-jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
- $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H)
- (SHLIB='$(SHLIB)'; \
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
- $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
+CFLAGS-java/jvspec.o += $(DRIVER_DEFINES)
# Create the compiler driver for $(XGCJ).
-$(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o \
+$(XGCJ)$(exeext): $(GCC_OBJS) java/jvspec.o java/jcf-path.o \
libcommon-target.a $(LIBDEPS) $(EXTRA_GCC_OBJS)
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
- jvspec.o java/jcf-path.o $(EXTRA_GCC_OBJS) libcommon-target.a \
+ java/jvspec.o java/jcf-path.o $(EXTRA_GCC_OBJS) libcommon-target.a \
$(EXTRA_GCC_LIBS) $(LIBS)
# Create a version of the $(XGCJ) driver which calls the cross-compiler.
@@ -89,13 +85,13 @@ JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o
-java_OBJS = $(sort $(JAVA_OBJS) $(JCFDUMP_OBJS) $(JVGENMAIN_OBJS)) jvspec.o
+java_OBJS = $(sort $(JAVA_OBJS) $(JCFDUMP_OBJS) $(JVGENMAIN_OBJS)) java/jvspec.o
# Use strict warnings for this front end.
java-warn = $(STRICT_WARN)
# String length warnings
-jvspec.o-warn = -Wno-error
+java/jvspec.o-warn = -Wno-error
jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o
rm -f $@
@@ -263,76 +259,14 @@ java.stagefeedback: stageprofile-start
-mv java/*$(objext) stagefeedback/java
#
-# .o:.h dependencies.
-JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) java/java-tree.h
-
-java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(JAVA_TREE_H) \
- java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \
- version.h $(GGC_H) intl.h java/zipfile.h $(DIAGNOSTIC_H)
-java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(TREE_H) $(JAVA_TREE_H) java/parse.h
-java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(JAVA_TREE_H) $(GGC_H) $(FLAGS_H) $(OPTABS_H) $(EXPR_H) langhooks.h \
- gt-java-builtins.h
-java/class.o: java/class.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(JAVA_TREE_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
- $(FUNCTION_H) gt-java-class.h
-java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
- toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-constants.h
-java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
- toplev.h $(FLAGS_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- java/java-except.h $(GGC_H) $(REAL_H) gt-java-decl.h \
- $(TARGET_H) $(CGRAPH_H) langhooks.h
-java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
- java/javaop.h java/java-opcodes.h java/java-except.h \
- toplev.h $(SYSTEM_H) coretypes.h
-java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
- java/javaop.h java/java-opcodes.h \
- java/java-except.h java/java-except.h java/parse.h \
- $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h $(TARGET_H) \
- tree-iterator.h
-java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- java/jcf.h
-java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(FLAGS_H) \
- input.h java/java-except.h $(SYSTEM_H) coretypes.h \
- java/parse.h $(GGC_H) debug.h $(REAL_H) gt-java-jcf-parse.h \
- java/jcf-reader.c java/zipfile.h java/jcf.h $(BITMAP_H)
-java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) intl.h $(DIAGNOSTIC_H)
-java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
- $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_H) \
- langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h $(OPTS_H) $(OPTIONS_H) \
- $(TARGET_H)
-java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
- coretypes.h $(TM_H) $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
-java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
- $(SYSTEM_H) coretypes.h $(GGC_H)
-java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(JAVA_TREE_H) java/jcf.h java/parse.h toplev.h $(GGC_H) \
- $(TARGET_H) $(FUNCTION_H) gt-java-resource.h
-java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
- $(SYSTEM_H) coretypes.h $(GGC_H) $(REAL_H)
-java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
-java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
- coretypes.h java/verify.h
-java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
- coretypes.h java/jcf.h $(JAVA_TREE_H)
-java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- java/zipfile.h
-java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h dumpfile.h $(JAVA_TREE_H) $(GIMPLE_H)
# jcf-io.o needs $(ZLIBINC) added to cflags.
CFLAGS-java/jcf-io.o += $(ZLIBINC)
-java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(JAVA_TREE_H) java/zipfile.h $(HASH_TABLE_H)
# jcf-path.o needs a -D.
CFLAGS-java/jcf-path.o += \
-DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
-DDEFAULT_TARGET_VERSION=\"$(version)\"
-java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- java/jcf.h
TEXI_JAVA_FILES = java/gcj.texi $(gcc_docdir)/include/fdl.texi \
$(gcc_docdir)/include/gpl_v3.texi $(gcc_docdir)/include/gcc-common.texi \
diff --git a/gcc/jump.c b/gcc/jump.c
index 6f7bcb72d1c..a27aaa94b8d 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -159,8 +159,8 @@ const pass_data pass_data_cleanup_barriers =
class pass_cleanup_barriers : public rtl_opt_pass
{
public:
- pass_cleanup_barriers(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_cleanup_barriers, ctxt)
+ pass_cleanup_barriers (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_cleanup_barriers, ctxt)
{}
/* opt_pass methods: */
@@ -401,9 +401,9 @@ reversed_comparison_code_parts (enum rtx_code code, const_rtx arg0,
/* These CONST_CAST's are okay because prev_nonnote_insn just
returns its argument and we assign it to a const_rtx
variable. */
- for (prev = prev_nonnote_insn (CONST_CAST_RTX(insn));
+ for (prev = prev_nonnote_insn (CONST_CAST_RTX (insn));
prev != 0 && !LABEL_P (prev);
- prev = prev_nonnote_insn (CONST_CAST_RTX(prev)))
+ prev = prev_nonnote_insn (CONST_CAST_RTX (prev)))
{
const_rtx set = set_of (arg0, prev);
if (set && GET_CODE (set) == SET
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index b47901b69b7..b989454ed9e 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -381,7 +381,7 @@ add_test (rtx cond, edge *e, basic_block dest)
JUMP_LABEL (jump) = label;
/* The jump is supposed to handle an unlikely special case. */
- add_reg_note (jump, REG_BR_PROB, const0_rtx);
+ add_int_reg_note (jump, REG_BR_PROB, 0);
LABEL_NUSES (label)++;
@@ -556,7 +556,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc,
|| !iter.fits_shwi ())
iter_rtx = const0_rtx;
else
- iter_rtx = GEN_INT (iter.to_shwi());
+ iter_rtx = GEN_INT (iter.to_shwi ());
init = gen_doloop_begin (counter_reg,
desc->const_iter ? desc->niter_expr : const0_rtx,
iter_rtx,
@@ -594,8 +594,7 @@ doloop_modify (struct loop *loop, struct niter_desc *desc,
if (true_prob_val)
{
/* Seems safer to use the branch probability. */
- add_reg_note (jump_insn, REG_BR_PROB,
- GEN_INT (desc->in_edge->probability));
+ add_int_reg_note (jump_insn, REG_BR_PROB, desc->in_edge->probability);
}
}
@@ -674,7 +673,7 @@ doloop_optimize (struct loop *loop)
|| !iter.fits_shwi ())
iterations_max = const0_rtx;
else
- iterations_max = GEN_INT (iter.to_shwi());
+ iterations_max = GEN_INT (iter.to_shwi ());
level = get_loop_level (loop) + 1;
/* Generate looping insn. If the pattern FAILs then give up trying
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 80c31ef70cd..c7aee1da6b9 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "df.h"
#include "ggc.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
/* Apply FLAGS to the loop state. */
@@ -336,8 +336,8 @@ const pass_data pass_data_loop2 =
class pass_loop2 : public rtl_opt_pass
{
public:
- pass_loop2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_loop2, ctxt)
+ pass_loop2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_loop2, ctxt)
{}
/* opt_pass methods: */
@@ -390,8 +390,8 @@ const pass_data pass_data_rtl_loop_init =
class pass_rtl_loop_init : public rtl_opt_pass
{
public:
- pass_rtl_loop_init(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_loop_init, ctxt)
+ pass_rtl_loop_init (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_loop_init, ctxt)
{}
/* opt_pass methods: */
@@ -448,8 +448,8 @@ const pass_data pass_data_rtl_loop_done =
class pass_rtl_loop_done : public rtl_opt_pass
{
public:
- pass_rtl_loop_done(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_loop_done, ctxt)
+ pass_rtl_loop_done (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_loop_done, ctxt)
{}
/* opt_pass methods: */
@@ -502,8 +502,8 @@ const pass_data pass_data_rtl_move_loop_invariants =
class pass_rtl_move_loop_invariants : public rtl_opt_pass
{
public:
- pass_rtl_move_loop_invariants(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_move_loop_invariants, ctxt)
+ pass_rtl_move_loop_invariants (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_move_loop_invariants, ctxt)
{}
/* opt_pass methods: */
@@ -556,8 +556,8 @@ const pass_data pass_data_rtl_unswitch =
class pass_rtl_unswitch : public rtl_opt_pass
{
public:
- pass_rtl_unswitch(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_unswitch, ctxt)
+ pass_rtl_unswitch (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_unswitch, ctxt)
{}
/* opt_pass methods: */
@@ -623,8 +623,8 @@ const pass_data pass_data_rtl_unroll_and_peel_loops =
class pass_rtl_unroll_and_peel_loops : public rtl_opt_pass
{
public:
- pass_rtl_unroll_and_peel_loops(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_unroll_and_peel_loops, ctxt)
+ pass_rtl_unroll_and_peel_loops (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_unroll_and_peel_loops, ctxt)
{}
/* opt_pass methods: */
@@ -683,8 +683,8 @@ const pass_data pass_data_rtl_doloop =
class pass_rtl_doloop : public rtl_opt_pass
{
public:
- pass_rtl_doloop(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_doloop, ctxt)
+ pass_rtl_doloop (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_doloop, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 73200e199b2..c5d6b5ac29d 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -180,7 +180,7 @@ static vec<invariant_p> invariants;
static void
check_invariant_table_size (void)
{
- if (invariant_table_size < DF_DEFS_TABLE_SIZE())
+ if (invariant_table_size < DF_DEFS_TABLE_SIZE ())
{
unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4);
invariant_table = XRESIZEVEC (struct invariant *, invariant_table, new_size);
@@ -274,13 +274,13 @@ invariant_for_use (df_ref use)
return NULL;
def = defs->ref;
check_invariant_table_size ();
- if (!invariant_table[DF_REF_ID(def)])
+ if (!invariant_table[DF_REF_ID (def)])
return NULL;
def_bb = DF_REF_BB (def);
if (!dominated_by_p (CDI_DOMINATORS, bb, def_bb))
return NULL;
- return invariant_table[DF_REF_ID(def)];
+ return invariant_table[DF_REF_ID (def)];
}
/* Computes hash value for invariant expression X in INSN. */
@@ -807,7 +807,7 @@ check_dependency (basic_block bb, df_ref use, bitmap depends_on)
def = defs->ref;
check_invariant_table_size ();
- inv = invariant_table[DF_REF_ID(def)];
+ inv = invariant_table[DF_REF_ID (def)];
if (!inv)
return false;
@@ -908,7 +908,7 @@ find_invariant_insn (rtx insn, bool always_reached, bool always_executed)
{
ref = df_find_def (insn, dest);
check_invariant_table_size ();
- invariant_table[DF_REF_ID(ref)] = inv;
+ invariant_table[DF_REF_ID (ref)] = inv;
}
}
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 9112e886318..07f28e3affe 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -99,8 +99,8 @@ static unsigned int iv_ref_table_size = 0;
static struct rtx_iv ** iv_ref_table;
/* Induction variable stored at the reference. */
-#define DF_REF_IV(REF) iv_ref_table[DF_REF_ID(REF)]
-#define DF_REF_IV_SET(REF, IV) iv_ref_table[DF_REF_ID(REF)] = (IV)
+#define DF_REF_IV(REF) iv_ref_table[DF_REF_ID (REF)]
+#define DF_REF_IV_SET(REF, IV) iv_ref_table[DF_REF_ID (REF)] = (IV)
/* The current loop. */
@@ -212,7 +212,7 @@ lowpart_subreg (enum machine_mode outer_mode, rtx expr,
static void
check_iv_ref_table_size (void)
{
- if (iv_ref_table_size < DF_DEFS_TABLE_SIZE())
+ if (iv_ref_table_size < DF_DEFS_TABLE_SIZE ())
{
unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4);
iv_ref_table = XRESIZEVEC (struct rtx_iv *, iv_ref_table, new_size);
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index 213e74d515a..23057d8694b 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -126,7 +126,7 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
JUMP_LABEL (jump) = label;
LABEL_NUSES (label)++;
}
- add_reg_note (jump, REG_BR_PROB, GEN_INT (prob));
+ add_int_reg_note (jump, REG_BR_PROB, prob);
seq = get_insns ();
end_sequence ();
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index ac67398a2db..57b4b3c2467 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -1709,8 +1709,8 @@ const pass_data pass_data_lower_subreg =
class pass_lower_subreg : public rtl_opt_pass
{
public:
- pass_lower_subreg(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_lower_subreg, ctxt)
+ pass_lower_subreg (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_lower_subreg, ctxt)
{}
/* opt_pass methods: */
@@ -1748,8 +1748,8 @@ const pass_data pass_data_lower_subreg2 =
class pass_lower_subreg2 : public rtl_opt_pass
{
public:
- pass_lower_subreg2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_lower_subreg2, ctxt)
+ pass_lower_subreg2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_lower_subreg2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 4d59b5a6ff2..f9652c773cd 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3309,15 +3309,19 @@ curr_insn_transform (void)
reg, we might improve the code through inheritance. If
it does not get a hard register we coalesce memory/memory
moves later. Ignore move insns to avoid cycling. */
- if (0 && ! lra_simple_p
+ if (! lra_simple_p
&& lra_undo_inheritance_iter < LRA_MAX_INHERITANCE_PASSES
&& goal_alt[i] != NO_REGS && REG_P (op)
&& (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER
+ && ! lra_former_scratch_p (regno)
&& reg_renumber[regno] < 0
&& (curr_insn_set == NULL_RTX
- || !(REG_P (SET_SRC (curr_insn_set))
- || MEM_P (SET_SRC (curr_insn_set))
- || GET_CODE (SET_SRC (curr_insn_set)) == SUBREG)))
+ || !((REG_P (SET_SRC (curr_insn_set))
+ || MEM_P (SET_SRC (curr_insn_set))
+ || GET_CODE (SET_SRC (curr_insn_set)) == SUBREG)
+ && (REG_P (SET_DEST (curr_insn_set))
+ || MEM_P (SET_DEST (curr_insn_set))
+ || GET_CODE (SET_DEST (curr_insn_set)) == SUBREG))))
optional_p = true;
else
continue;
@@ -4331,7 +4335,9 @@ need_for_call_save_p (int regno)
return (usage_insns[regno].calls_num < calls_num
&& (overlaps_hard_reg_set_p
(call_used_reg_set,
- PSEUDO_REGNO_MODE (regno), reg_renumber[regno])));
+ PSEUDO_REGNO_MODE (regno), reg_renumber[regno])
+ || HARD_REGNO_CALL_PART_CLOBBERED (reg_renumber[regno],
+ PSEUDO_REGNO_MODE (regno))));
}
/* Global registers occurring in the current EBB. */
@@ -5441,7 +5447,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
static bool
undo_optional_reloads (void)
{
- bool change_p;
+ bool change_p, keep_p;
unsigned int regno, uid;
bitmap_iterator bi, bi2;
rtx insn, set, src, dest;
@@ -5450,27 +5456,44 @@ undo_optional_reloads (void)
bitmap_initialize (&removed_optional_reload_pseudos, &reg_obstack);
bitmap_copy (&removed_optional_reload_pseudos, &lra_optional_reload_pseudos);
EXECUTE_IF_SET_IN_BITMAP (&lra_optional_reload_pseudos, 0, regno, bi)
- if (reg_renumber[regno] >= 0)
- EXECUTE_IF_SET_IN_BITMAP (&lra_reg_info[regno].insn_bitmap, 0, uid, bi2)
+ {
+ keep_p = false;
+ /* Keep optional reloads from previous subpasses. */
+ if (lra_reg_info[regno].restore_regno < 0
+ /* If the original pseudo changed its allocation, just
+ removing the optional pseudo is dangerous as the original
+ pseudo will have longer live range. */
+ || reg_renumber[lra_reg_info[regno].restore_regno] >= 0)
+ keep_p = true;
+ else if (reg_renumber[regno] >= 0)
+ EXECUTE_IF_SET_IN_BITMAP (&lra_reg_info[regno].insn_bitmap, 0, uid, bi2)
+ {
+ insn = lra_insn_recog_data[uid]->insn;
+ if ((set = single_set (insn)) == NULL_RTX)
+ continue;
+ src = SET_SRC (set);
+ dest = SET_DEST (set);
+ if (! REG_P (src) || ! REG_P (dest))
+ continue;
+ if (REGNO (dest) == regno
+ /* Ignore insn for optional reloads itself. */
+ && lra_reg_info[regno].restore_regno != (int) REGNO (src)
+ /* Check only inheritance on last inheritance pass. */
+ && (int) REGNO (src) >= new_regno_start
+ /* Check that the optional reload was inherited. */
+ && bitmap_bit_p (&lra_inheritance_pseudos, REGNO (src)))
+ {
+ keep_p = true;
+ break;
+ }
+ }
+ if (keep_p)
{
- insn = lra_insn_recog_data[uid]->insn;
- if ((set = single_set (insn)) == NULL_RTX)
- continue;
- src = SET_SRC (set);
- dest = SET_DEST (set);
- if (! REG_P (src) || ! REG_P (dest))
- continue;
- if ((REGNO (src) == regno
- && lra_reg_info[regno].restore_regno != (int) REGNO (dest))
- || (REGNO (dest) == regno
- && lra_reg_info[regno].restore_regno != (int) REGNO (src)))
- {
- /* Optional reload was inherited. Keep it. */
- bitmap_clear_bit (&removed_optional_reload_pseudos, regno);
- if (lra_dump_file != NULL)
- fprintf (lra_dump_file, "Keep optional reload reg %d\n", regno);
- }
+ bitmap_clear_bit (&removed_optional_reload_pseudos, regno);
+ if (lra_dump_file != NULL)
+ fprintf (lra_dump_file, "Keep optional reload reg %d\n", regno);
}
+ }
change_p = ! bitmap_empty_p (&removed_optional_reload_pseudos);
bitmap_initialize (&insn_bitmap, &reg_obstack);
EXECUTE_IF_SET_IN_BITMAP (&removed_optional_reload_pseudos, 0, regno, bi)
@@ -5552,7 +5575,11 @@ lra_undo_inheritance (void)
if (lra_reg_info[regno].restore_regno >= 0)
{
n_all_inherit++;
- if (reg_renumber[regno] < 0)
+ if (reg_renumber[regno] < 0
+ /* If the original pseudo changed its allocation, just
+ removing inheritance is dangerous as for changing
+ allocation we used shorter live-ranges. */
+ && reg_renumber[lra_reg_info[regno].restore_regno] < 0)
bitmap_set_bit (&remove_pseudos, regno);
else
n_inherit++;
diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c
index a59ab6eacca..1a069feaaec 100644
--- a/gcc/lra-eliminations.c
+++ b/gcc/lra-eliminations.c
@@ -471,6 +471,7 @@ lra_eliminate_regs_1 (rtx x, enum machine_mode mem_mode,
/* ... fall through ... */
case INSN_LIST:
+ case INT_LIST:
/* Now do eliminations in the rest of the chain. If this was
an EXPR_LIST, this might result in allocating more memory than is
strictly needed, but it simplifies the code. */
@@ -745,13 +746,42 @@ mark_not_eliminable (rtx x)
+#ifdef HARD_FRAME_POINTER_REGNUM
+
+/* Find offset equivalence note for reg WHAT in INSN and return the
+ found elmination offset. If the note is not found, return NULL.
+ Remove the found note. */
+static rtx
+remove_reg_equal_offset_note (rtx insn, rtx what)
+{
+ rtx link, *link_loc;
+
+ for (link_loc = &REG_NOTES (insn);
+ (link = *link_loc) != NULL_RTX;
+ link_loc = &XEXP (link, 1))
+ if (REG_NOTE_KIND (link) == REG_EQUAL
+ && GET_CODE (XEXP (link, 0)) == PLUS
+ && XEXP (XEXP (link, 0), 0) == what
+ && CONST_INT_P (XEXP (XEXP (link, 0), 1)))
+ {
+ *link_loc = XEXP (link, 1);
+ return XEXP (XEXP (link, 0), 1);
+ }
+ return NULL_RTX;
+}
+
+#endif
+
/* Scan INSN and eliminate all eliminable hard registers in it.
If REPLACE_P is true, do the replacement destructively. Also
delete the insn as dead it if it is setting an eliminable register.
If REPLACE_P is false, just update the offsets while keeping the
- base register the same. */
+ base register the same. Attach the note about used elimination for
+ insns setting frame pointer to update elimination easy (without
+ parsing already generated elimination insns to find offset
+ previously used) in future. */
static void
eliminate_regs_in_insn (rtx insn, bool replace_p)
@@ -790,59 +820,44 @@ eliminate_regs_in_insn (rtx insn, bool replace_p)
if (ep->from == FRAME_POINTER_REGNUM
&& ep->to == HARD_FRAME_POINTER_REGNUM)
{
+ rtx src = SET_SRC (old_set);
+ rtx off = remove_reg_equal_offset_note (insn, ep->to_rtx);
+
if (replace_p)
{
SET_DEST (old_set) = ep->to_rtx;
lra_update_insn_recog_data (insn);
return;
}
- else
+ else if (off != NULL_RTX
+ || src == ep->to_rtx
+ || (GET_CODE (src) == PLUS
+ && XEXP (src, 1) == ep->to_rtx
+ && CONST_INT_P (XEXP (src, 1))))
{
- rtx base = SET_SRC (old_set);
- HOST_WIDE_INT offset = 0;
- rtx base_insn = insn;
-
- while (base != ep->to_rtx)
+ HOST_WIDE_INT offset = (off != NULL_RTX
+ ? INTVAL (off)
+ : src == ep->to_rtx
+ ? 0 : INTVAL (XEXP (src, 1)));
+
+ offset -= (ep->offset - ep->previous_offset);
+ src = plus_constant (Pmode, ep->to_rtx, offset);
+
+ /* First see if this insn remains valid when we make
+ the change. If not, keep the INSN_CODE the same
+ and let the constraint pass fit it up. */
+ validate_change (insn, &SET_SRC (old_set), src, 1);
+ validate_change (insn, &SET_DEST (old_set),
+ ep->from_rtx, 1);
+ if (! apply_change_group ())
{
- rtx prev_insn, prev_set;
-
- if (GET_CODE (base) == PLUS && CONST_INT_P (XEXP (base, 1)))
- {
- offset += INTVAL (XEXP (base, 1));
- base = XEXP (base, 0);
- }
- else if ((prev_insn = prev_nonnote_insn (base_insn)) != 0
- && (prev_set = single_set (prev_insn)) != 0
- && rtx_equal_p (SET_DEST (prev_set), base))
- {
- base = SET_SRC (prev_set);
- base_insn = prev_insn;
- }
- else
- break;
- }
-
- if (base == ep->to_rtx)
- {
- rtx src;
-
- offset -= (ep->offset - ep->previous_offset);
- src = plus_constant (Pmode, ep->to_rtx, offset);
-
- /* First see if this insn remains valid when we make
- the change. If not, keep the INSN_CODE the same
- and let the constraint pass fit it up. */
- validate_change (insn, &SET_SRC (old_set), src, 1);
- validate_change (insn, &SET_DEST (old_set),
- ep->from_rtx, 1);
- if (! apply_change_group ())
- {
- SET_SRC (old_set) = src;
- SET_DEST (old_set) = ep->from_rtx;
- }
- lra_update_insn_recog_data (insn);
- return;
+ SET_SRC (old_set) = src;
+ SET_DEST (old_set) = ep->from_rtx;
}
+ lra_update_insn_recog_data (insn);
+ /* Add offset note for future updates. */
+ add_reg_note (insn, REG_EQUAL, src);
+ return;
}
@@ -1145,9 +1160,9 @@ update_reg_eliminate (bitmap insns_with_changed_offsets)
static void
init_elim_table (void)
{
- bool value_p;
struct elim_table *ep;
#ifdef ELIMINABLE_REGS
+ bool value_p;
const struct elim_table_1 *ep1;
#endif
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index 6eaeb2d7779..f3bad974a87 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -457,11 +457,17 @@ lra_setup_reload_pseudo_preferenced_hard_reg (int regno,
static inline void
check_pseudos_live_through_calls (int regno)
{
+ int hr;
+
if (! sparseset_bit_p (pseudos_live_through_calls, regno))
return;
sparseset_clear_bit (pseudos_live_through_calls, regno);
IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs,
call_used_reg_set);
+
+ for (hr = 0; hr < FIRST_PSEUDO_REGISTER; hr++)
+ if (HARD_REGNO_CALL_PART_CLOBBERED (hr, PSEUDO_REGNO_MODE (regno)))
+ SET_HARD_REG_BIT (lra_reg_info[regno].conflict_hard_regs, hr);
#ifdef ENABLE_CHECKING
lra_reg_info[regno].call_p = true;
#endif
diff --git a/gcc/lra.c b/gcc/lra.c
index ef69526b0ec..532d3de3e09 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2163,7 +2163,9 @@ update_inc_notes (void)
pnote = &REG_NOTES (insn);
while (*pnote != 0)
{
- if (REG_NOTE_KIND (*pnote) == REG_INC)
+ if (REG_NOTE_KIND (*pnote) == REG_DEAD
+ || REG_NOTE_KIND (*pnote) == REG_UNUSED
+ || REG_NOTE_KIND (*pnote) == REG_INC)
*pnote = XEXP (*pnote, 1);
else
pnote = &XEXP (*pnote, 1);
@@ -2365,8 +2367,10 @@ lra (FILE *f)
if (! live_p)
lra_clear_live_ranges ();
}
- bitmap_clear (&lra_optional_reload_pseudos);
}
+ /* Don't clear optional reloads bitmap until all constraints are
+ satisfied as we need to differ them from regular reloads. */
+ bitmap_clear (&lra_optional_reload_pseudos);
bitmap_clear (&lra_subreg_reload_pseudos);
bitmap_clear (&lra_inheritance_pseudos);
bitmap_clear (&lra_split_regs);
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index fcba1b92acd..211eda97269 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "hashtab.h"
#include "langhooks.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "function.h"
#include "ggc.h"
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "profile.h"
#include "context.h"
#include "pass_manager.h"
+#include "ipa-utils.h"
static void output_cgraph_opt_summary (void);
static void input_cgraph_opt_summary (vec<symtab_node> nodes);
@@ -766,6 +767,7 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
int i;
lto_symtab_encoder_t encoder;
lto_symtab_encoder_iterator lsei;
+ struct pointer_set_t *reachable_call_targets = pointer_set_create ();
encoder = lto_symtab_encoder_new (false);
@@ -837,9 +839,40 @@ compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
add_node_to (encoder, callee, false);
}
}
+ /* Add all possible targets for late devirtualization. */
+ if (flag_devirtualize)
+ for (edge = node->indirect_calls; edge; edge = edge->next_callee)
+ if (edge->indirect_info->polymorphic)
+ {
+ unsigned int i;
+ void *cache_token;
+ bool final;
+ vec <cgraph_node *>targets
+ = possible_polymorphic_call_targets
+ (edge, &final, &cache_token);
+ if (!pointer_set_insert (reachable_call_targets,
+ cache_token))
+ {
+ for (i = 0; i < targets.length (); i++)
+ {
+ struct cgraph_node *callee = targets[i];
+
+ /* Adding an external declarations into the unit serves
+ no purpose and just increases its boundary. */
+ if (callee->symbol.definition
+ && !lto_symtab_encoder_in_partition_p
+ (encoder, (symtab_node)callee))
+ {
+ gcc_assert (!callee->global.inlined_to);
+ add_node_to (encoder, callee, false);
+ }
+ }
+ }
+ }
}
- lto_symtab_encoder_delete (in_encoder);
- return encoder;
+ lto_symtab_encoder_delete (in_encoder);
+ pointer_set_destroy (reachable_call_targets);
+ return encoder;
}
/* Output the part of the symtab in SET and VSET. */
@@ -1527,7 +1560,8 @@ input_symtab (void)
ib = lto_create_simple_input_block (file_data, LTO_section_refs,
&data, &len);
if (!ib)
- fatal_error("cannot find LTO section refs in %s", file_data->file_name);
+ fatal_error ("cannot find LTO section refs in %s",
+ file_data->file_name);
input_refs (ib, nodes);
lto_destroy_simple_input_block (file_data, LTO_section_refs,
ib, data, len);
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index 5821030d4cf..d96cdb47548 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#include "hashtab.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "function.h"
#include "ggc.h"
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 8145ec33354..59eed716630 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#include "hashtab.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "function.h"
#include "ggc.h"
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 7fa5bb34e58..72d450ca9d9 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#include "hashtab.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cgraph.h"
#include "function.h"
@@ -652,7 +652,7 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
index = streamer_read_hwi (ib);
}
- p_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(fn);
+ p_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION (fn);
index = streamer_read_hwi (ib);
while (index != -1)
{
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index c46f71032af..20d8bfa9c42 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#include "hashtab.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cgraph.h"
#include "function.h"
@@ -2034,17 +2034,17 @@ const pass_data pass_data_ipa_lto_gimple_out =
class pass_ipa_lto_gimple_out : public ipa_opt_pass_d
{
public:
- pass_ipa_lto_gimple_out(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_lto_gimple_out, ctxt,
- NULL, /* generate_summary */
- lto_output, /* write_summary */
- NULL, /* read_summary */
- lto_output, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_lto_gimple_out (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_lto_gimple_out, ctxt,
+ NULL, /* generate_summary */
+ lto_output, /* write_summary */
+ NULL, /* read_summary */
+ lto_output, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
@@ -2248,7 +2248,7 @@ write_symbol (struct streamer_tree_cache_d *cache,
&& !targetm.binds_local_p (t))
visibility = GCCPV_DEFAULT;
else
- switch (DECL_VISIBILITY(t))
+ switch (DECL_VISIBILITY (t))
{
case VISIBILITY_DEFAULT:
visibility = GCCPV_DEFAULT;
@@ -2458,7 +2458,7 @@ produce_asm_for_decls (void)
lto_output_decl_state_refs (ob, decl_state_stream, fn_out_state);
}
lto_write_stream (decl_state_stream);
- free(decl_state_stream);
+ free (decl_state_stream);
lto_write_stream (ob->main_stream);
lto_write_stream (ob->string_stream);
@@ -2506,17 +2506,17 @@ const pass_data pass_data_ipa_lto_finish_out =
class pass_ipa_lto_finish_out : public ipa_opt_pass_d
{
public:
- pass_ipa_lto_finish_out(gcc::context *ctxt)
- : ipa_opt_pass_d(pass_data_ipa_lto_finish_out, ctxt,
- NULL, /* generate_summary */
- produce_asm_for_decls, /* write_summary */
- NULL, /* read_summary */
- produce_asm_for_decls, /* write_optimization_summary */
- NULL, /* read_optimization_summary */
- NULL, /* stmt_fixup */
- 0, /* function_transform_todo_flags_start */
- NULL, /* function_transform */
- NULL) /* variable_transform */
+ pass_ipa_lto_finish_out (gcc::context *ctxt)
+ : ipa_opt_pass_d (pass_data_ipa_lto_finish_out, ctxt,
+ NULL, /* generate_summary */
+ produce_asm_for_decls, /* write_summary */
+ NULL, /* read_summary */
+ produce_asm_for_decls, /* write_optimization_summary */
+ NULL, /* read_optimization_summary */
+ NULL, /* stmt_fixup */
+ 0, /* function_transform_todo_flags_start */
+ NULL, /* function_transform */
+ NULL) /* variable_transform */
{}
/* opt_pass methods: */
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index e7b66c167b5..cdc75de9bae 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "tree.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "diagnostic-core.h"
#include "bitmap.h"
#include "vec.h"
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 15a34dd6956..755993ca634 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -744,7 +744,7 @@ run_gcc (unsigned argc, char *argv[])
if (lto_mode == LTO_MODE_LTO)
{
- printf("%s\n", flto_out);
+ printf ("%s\n", flto_out);
free (flto_out);
flto_out = NULL;
}
@@ -820,9 +820,9 @@ cont:
{
char *dumpbase
= (char *) xmalloc (strlen (linker_output)
- + sizeof(DUMPBASE_SUFFIX) + 1);
+ + sizeof (DUMPBASE_SUFFIX) + 1);
snprintf (dumpbase,
- strlen (linker_output) + sizeof(DUMPBASE_SUFFIX),
+ strlen (linker_output) + sizeof (DUMPBASE_SUFFIX),
"%s.ltrans%u", linker_output, i);
argv_ptr[0] = dumpbase;
}
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 8ac0f8d60a4..f4a57b2f8cd 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (LTO_H, LINKER_PLUGIN_API_H, LTO_TREE_H)
+ (lto/lto-lang.o, lto/lto.o, lto/lto-partition.o)
+ (lto/lto-object.o): Remove.
+
2013-09-06 Richard Biener <rguenther@suse.de>
* lto-symtab.c: Move from gcc/
diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in
index c67c58e7f83..66b0015f2bd 100644
--- a/gcc/lto/Make-lang.in
+++ b/gcc/lto/Make-lang.in
@@ -23,10 +23,7 @@
LTO_EXE = lto1$(exeext)
# The LTO-specific object files inclued in $(LTO_EXE).
LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o
-LTO_H = lto/lto.h $(HASHTAB_H)
-LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
-LTO_TREE_H = lto/lto-tree.h $(LINKER_PLUGIN_API_H)
-
+lto_OBJS = $(LTO_OBJS)
# Rules
@@ -74,30 +71,5 @@ $(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(LTO_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS)
-# Dependencies
-lto/lto-lang.o: lto/lto-lang.c $(CONFIG_H) coretypes.h debug.h \
- flags.h $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(SYSTEM_H) \
- $(TARGET_H) $(LTO_H) $(GIMPLE_H) gtype-lto.h gt-lto-lto-lang.h \
- $(EXPR_H) $(LTO_STREAMER_H)
-lto/lto.o: lto/lto.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
- toplev.h $(TREE_H) $(TREE_FLOW_H) $(DIAGNOSTIC_CORE_H) $(TM_H) \
- $(CGRAPH_H) $(GGC_H) tree-ssa-operands.h $(TREE_PASS_H) \
- langhooks.h $(VEC_H) $(BITMAP_H) pointer-set.h $(IPA_PROP_H) \
- $(COMMON_H) debug.h $(GIMPLE_H) $(LTO_H) $(LTO_TREE_H) \
- $(LTO_TAGS_H) $(LTO_STREAMER_H) $(SPLAY_TREE_H) gt-lto-lto.h \
- $(TREE_STREAMER_H) $(DATA_STREAMER_H) lto/lto-partition.h \
- $(CONTEXT_H) $(PIPELINE_H)
-lto/lto-partition.o: lto/lto-partition.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- toplev.h $(TREE_H) $(TM_H) \
- $(CGRAPH_H) $(TIMEVAR_H) \
- $(LTO_STREAMER_H) $(SPLAY_TREE_H) gt-lto-lto.h $(PARAMS_H) \
- ipa-inline.h $(IPA_UTILS_H) lto/lto-partition.h
-lto/lto-object.o: lto/lto-object.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(DIAGNOSTIC_CORE_H) $(LTO_H) $(TM_H) $(LTO_STREAMER_H) \
- ../include/simple-object.h
-lto/lto-symtab.o: lto/lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(GIMPLE_H) $(GGC_H) $(HASHTAB_H) \
- $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H)
-
# LTO testing is done as part of C/C++/Fortran etc. testing.
check-lto:
diff --git a/gcc/machmode.h b/gcc/machmode.h
index 981ee92a87a..da0923a81a2 100644
--- a/gcc/machmode.h
+++ b/gcc/machmode.h
@@ -269,16 +269,16 @@ public:
bool prefer_smaller_modes ();
private:
- enum machine_mode mode_;
+ enum machine_mode m_mode;
/* We use signed values here because the bit position can be negative
for invalid input such as gcc.dg/pr48335-8.c. */
- HOST_WIDE_INT bitsize_;
- HOST_WIDE_INT bitpos_;
- HOST_WIDE_INT bitregion_start_;
- HOST_WIDE_INT bitregion_end_;
- unsigned int align_;
- bool volatilep_;
- int count_;
+ HOST_WIDE_INT m_bitsize;
+ HOST_WIDE_INT m_bitpos;
+ HOST_WIDE_INT m_bitregion_start;
+ HOST_WIDE_INT m_bitregion_end;
+ unsigned int m_align;
+ bool m_volatilep;
+ int m_count;
};
/* Find the best mode to use to access a bit field. */
diff --git a/gcc/mcf.c b/gcc/mcf.c
index 7a716f58177..52020b8c2f8 100644
--- a/gcc/mcf.c
+++ b/gcc/mcf.c
@@ -385,7 +385,7 @@ add_fixup_edge (fixup_graph_type *fixup_graph, int src, int dest,
edge_type type, gcov_type weight, gcov_type cost,
gcov_type max_capacity)
{
- fixup_edge_p curr_edge = add_edge(fixup_graph, src, dest, cost);
+ fixup_edge_p curr_edge = add_edge (fixup_graph, src, dest, cost);
curr_edge->type = type;
curr_edge->weight = weight;
curr_edge->max_capacity = max_capacity;
diff --git a/gcc/mode-switching.c b/gcc/mode-switching.c
index 56c4d0fef9a..483566b25f6 100644
--- a/gcc/mode-switching.c
+++ b/gcc/mode-switching.c
@@ -804,14 +804,14 @@ const pass_data pass_data_mode_switching =
class pass_mode_switching : public rtl_opt_pass
{
public:
- pass_mode_switching(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_mode_switching, ctxt)
+ pass_mode_switching (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_mode_switching, ctxt)
{}
/* opt_pass methods: */
/* The epiphany backend creates a second instance of this pass, so we need
a clone method. */
- opt_pass * clone () { return new pass_mode_switching (ctxt_); }
+ opt_pass * clone () { return new pass_mode_switching (m_ctxt); }
bool gate () { return gate_mode_switching (); }
unsigned int execute () { return rest_of_handle_mode_switching (); }
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 3ad2ec77f1e..599c025f57d 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -3374,8 +3374,8 @@ const pass_data pass_data_sms =
class pass_sms : public rtl_opt_pass
{
public:
- pass_sms(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_sms, ctxt)
+ pass_sms (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_sms, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 30b6d17d82b..f3fa0e06ded 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,19 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (START_HDRS, cc1obj-checksum.o, objc/objc-lang.o)
+ (objc/objc-runtime-shared-support.o)
+ (objc/objc-gnu-runtime-abi-01.o, objc/objc-next-runtime-abi-01.o)
+ (objc/objc-next-runtime-abi-02.o, objc/objc-act.o)
+ (objc/objc-encoding.o, objc/objc-map.o): Remove.
+
+2013-09-14 Iain Sandoe <iain@codesourcery.com>
+
+ PR target/48094
+ * objc-next-runtime-abi-01.c (generate_objc_image_info): Remove.
+ (objc_generate_v1_next_metadata): Remove generation of ImageInfo.
+ * objc-next-runtime-abi-02.c (generate_v2_objc_image_info): Remove.
+ (objc_generate_v2_next_metadata): Remove generation of ImageInfo.
+
2013-07-21 Ondřej Bílka <neleai@seznam.cz>
* objc-act.c: Fix typos.
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in
index f04d60686c8..02e78fbfc3a 100644
--- a/gcc/objc/Make-lang.in
+++ b/gcc/objc/Make-lang.in
@@ -42,9 +42,6 @@ objc: cc1obj$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: objc
-START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \
- c/c-lang.h langhooks.h c-family/c-objc.h objc/objc-act.h
-
# Use maximal warnings for this front end.
objc-warn = $(STRICT_WARN)
@@ -65,87 +62,11 @@ cc1obj-checksum.c : build/genchecksum$(build_exeext) checksum-options \
$(BACKEND) $(LIBDEPS) checksum-options > cc1obj-checksum.c.tmp && \
$(srcdir)/../move-if-change cc1obj-checksum.c.tmp cc1obj-checksum.c
-cc1obj-checksum.o : cc1obj-checksum.c $(CONFIG_H) $(SYSTEM_H)
-
cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o \
$(BACKEND) $(LIBS) $(BACKENDLIBS)
-# Objective C language specific files.
-
-# When editing, please keep the objc/ header dependencies in
-# alphabetical order, and try to use a similar logical order for the
-# other files between the different targets.
-
-objc/objc-lang.o : objc/objc-lang.c \
- $(START_HDRS) \
- $(GGC_H) \
- $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-objc.h \
- c/c-objc-common.h
-
-objc/objc-runtime-shared-support.o : objc/objc-runtime-shared-support.c \
- gt-objc-objc-runtime-shared-support.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- objc/objc-encoding.h \
- objc/objc-next-metadata-tags.h \
- objc/objc-runtime-shared-support.h
-
-objc/objc-gnu-runtime-abi-01.o: objc/objc-gnu-runtime-abi-01.c \
- gt-objc-objc-gnu-runtime-abi-01.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- toplev.h \
- objc/objc-encoding.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h
-
-objc/objc-next-runtime-abi-01.o: objc/objc-next-runtime-abi-01.c \
- gt-objc-objc-next-runtime-abi-01.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(TARGET_H) \
- objc/objc-encoding.h \
- objc/objc-next-metadata-tags.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h
-
-objc/objc-next-runtime-abi-02.o: objc/objc-next-runtime-abi-02.c \
- gt-objc-objc-next-runtime-abi-02.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(TARGET_H) \
- objc/objc-encoding.h \
- objc/objc-next-metadata-tags.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h
-
-objc/objc-act.o : objc/objc-act.c \
- gt-objc-objc-act.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- toplev.h $(FUNCTION_H) debug.h $(LANGHOOKS_DEF_H) \
- $(HASH_TABLE_H) $(GIMPLE_H) \
- $(C_PRAGMA_H) $(C_TARGET_H) \
- objc/objc-encoding.h \
- objc/objc-map.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h
-
-objc/objc-encoding.o : objc/objc-encoding.c \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(OBSTACK_H) \
- objc/objc-encoding.h \
- objc/objc-runtime-shared-support.h
-
-objc/objc-map.o : objc/objc-map.c \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(OBSTACK_H) \
- objc/objc-map.h
-
objc.srcextra:
#
diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c
index 27ba615ca0e..000256d8311 100644
--- a/gcc/objc/objc-next-runtime-abi-01.c
+++ b/gcc/objc/objc-next-runtime-abi-01.c
@@ -2332,36 +2332,6 @@ generate_classref_translation_entry (tree chain)
return;
}
-
-/* The Fix-and-Continue functionality available in Mac OS X 10.3 and
- later requires that ObjC translation units participating in F&C be
- specially marked. The following routine accomplishes this. */
-
-/* static int _OBJC_IMAGE_INFO[2] = { 0, 1 }; */
-
-static void
-generate_objc_image_info (void)
-{
- tree decl;
- int flags
- = ((flag_replace_objc_classes && imp_count ? 1 : 0)
- | (flag_objc_gc ? 2 : 0));
- vec<constructor_elt, va_gc> *v = NULL;
- tree array_type;
-
- array_type = build_sized_array_type (integer_type_node, 2);
-
- decl = start_var_decl (array_type, "_OBJC_ImageInfo");
-
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node);
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, flags));
- /* The runtime wants this and refers to it in a manner hidden from the compiler.
- So we must force the output. */
- DECL_PRESERVE_P (decl) = 1;
- OBJCMETA (decl, objc_meta, meta_info);
- finish_var_decl (decl, objc_build_constructor (TREE_TYPE (decl), v));
-}
-
static void
objc_generate_v1_next_metadata (void)
{
@@ -2412,9 +2382,6 @@ objc_generate_v1_next_metadata (void)
attr = build_tree_list (objc_meta, meta_modules);
build_module_descriptor (vers, attr);
- /* This conveys information on GC usage and zero-link. */
- generate_objc_image_info ();
-
/* Dump the class references. This forces the appropriate classes
to be linked into the executable image, preserving unix archive
semantics. */
diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index 4bb02c76737..09600068ca6 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -3331,31 +3331,6 @@ build_v2_ivar_offset_ref_table (void)
finish_var_decl (ref->decl, ref->offset);
}
-/* static int _OBJC_IMAGE_INFO[2] = { 0, 16 | flags }; */
-
-static void
-generate_v2_objc_image_info (void)
-{
- tree decl, array_type;
- vec<constructor_elt, va_gc> *v = NULL;
- int flags =
- ((flag_replace_objc_classes && imp_count ? 1 : 0)
- | (flag_objc_gc ? 2 : 0));
-
- flags |= 16;
-
- array_type = build_sized_array_type (integer_type_node, 2);
-
- decl = start_var_decl (array_type, "_OBJC_ImageInfo");
-
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node);
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, flags));
- /* The Runtime wants this. */
- DECL_PRESERVE_P (decl) = 1;
- OBJCMETA (decl, objc_meta, meta_info);
- finish_var_decl (decl, objc_build_constructor (TREE_TYPE (decl), v));
-}
-
static void
objc_generate_v2_next_metadata (void)
{
@@ -3407,9 +3382,6 @@ objc_generate_v2_next_metadata (void)
build_v2_address_table (nonlazy_category_list, "_OBJC_NonLazyCategoryList$",
meta_label_nonlazy_categorylist);
- /* This conveys information on GC usage and zero-link. */
- generate_v2_objc_image_info ();
-
/* Generate catch objects for eh, if any are needed. */
build_v2_eh_catch_objects ();
diff --git a/gcc/objcp/ChangeLog b/gcc/objcp/ChangeLog
index 7369195624a..af4e4b3f49d 100644
--- a/gcc/objcp/ChangeLog
+++ b/gcc/objcp/ChangeLog
@@ -1,3 +1,13 @@
+2013-09-25 Tom Tromey <tromey@redhat.com>
+
+ * Make-lang.in (START_HDRS, cc1objplus-checksum.o)
+ (objcp/objcp-lang.o, objcp/objcp-decl.o
+ (objcp/objc-runtime-shared-support.o)
+ (objcp/objc-gnu-runtime-abi-01.o objcp/objc-next-runtime-abi-01.o)
+ (objcp/objc-next-runtime-abi-02.o, objcp/objcp-act.o)
+ (objcp/objc-encoding.o, objcp/objc-map.o): Use COMPILE and
+ POSTCOMPILE. Remove explicit dependencies.
+
2013-05-16 Jason Merrill <jason@redhat.com>
* Make-lang.in (cc1objplus$(exeext)): Use link mutex.
diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in
index ec10fc890c2..439bfa223af 100644
--- a/gcc/objcp/Make-lang.in
+++ b/gcc/objcp/Make-lang.in
@@ -43,9 +43,6 @@ obj-c++: cc1objplus$(exeext)
# Tell GNU make to ignore these if they exist.
.PHONY: obj-c++
-START_HDRS = $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
- $(CXX_PARSER_H) $(CXX_PRETTY_PRINT_H) langhooks.h c-family/c-objc.h objc/objc-act.h
-
# Use maximal warnings for this front end. Also, make ObjC and C++
# headers accessible.
objcp-warn = $(STRICT_WARN) -DOBJCPLUS -I$(srcdir)/objc -I$(srcdir)/cp
@@ -69,110 +66,39 @@ cc1objplus-checksum.c : build/genchecksum$(build_exeext) checksum-options \
$(srcdir)/../move-if-change cc1objplus-checksum.c.tmp \
cc1objplus-checksum.c
-cc1objplus-checksum.o : cc1objplus-checksum.c $(CONFIG_H) $(SYSTEM_H)
-
cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
$(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
# Objective C++ language specific files.
-objcp/objcp-lang.o : objcp/objcp-lang.c \
- $(START_HDRS) \
- $(GGC_H) \
- $(C_COMMON_H) $(LANGHOOKS_DEF_H) cp/cp-objcp-common.h \
- $(TARGET_H) gtype-objcp.h
-
-objcp/objcp-decl.o : objcp/objcp-decl.c \
- $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(CXX_TREE_H) \
- objc/objc-act.h c-family/c-objc.h \
- objcp/objcp-decl.h
-
-objcp/objc-runtime-shared-support.o : objc/objc-runtime-shared-support.c \
- gt-objc-objc-runtime-shared-support.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- objc/objc-encoding.h \
- objc/objc-next-metadata-tags.h \
- objc/objc-runtime-shared-support.h \
- objcp/objcp-decl.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-objcp/objc-gnu-runtime-abi-01.o: objc/objc-gnu-runtime-abi-01.c \
- gt-objc-objc-gnu-runtime-abi-01.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- toplev.h \
- objc/objc-encoding.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h \
- objcp/objcp-decl.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-objcp/objc-next-runtime-abi-01.o: objc/objc-next-runtime-abi-01.c \
- gt-objc-objc-next-runtime-abi-01.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(TARGET_H) output.h \
- objc/objc-encoding.h \
- objc/objc-next-metadata-tags.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h \
- objcp/objcp-decl.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-objcp/objc-next-runtime-abi-02.o: objc/objc-next-runtime-abi-02.c \
- gt-objc-objc-next-runtime-abi-02.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(TARGET_H) \
- objc/objc-encoding.h \
- objc/objc-next-metadata-tags.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h \
- objcp/objcp-decl.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-
-# The following must be an explicit rule; please keep in sync with the implicit
-# one in Makefile.in.
-objcp/objcp-act.o : objc/objc-act.c \
- gt-objc-objc-act.h \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_H) $(FLAGS_H) input.h \
- toplev.h $(FUNCTION_H) output.h debug.h $(LANGHOOKS_DEF_H) \
- $(HASHTAB_H) $(GIMPLE_H) \
- $(RTL_H) $(EXPR_H) $(TARGET_H) \
- objcp/objcp-decl.h \
- objc/objc-encoding.h \
- objc/objc-map.h \
- objc/objc-runtime-hooks.h \
- objc/objc-runtime-shared-support.h \
- objcp/objcp-decl.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-objcp/objc-encoding.o : objc/objc-encoding.c \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(OBSTACK_H) \
- objc/objc-encoding.h \
- objc/objc-runtime-shared-support.h \
- objcp/objcp-decl.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
-
-objcp/objc-map.o : objc/objc-map.c \
- $(START_HDRS) \
- $(GGC_H) $(DIAGNOSTIC_CORE_H) $(FLAGS_H) input.h \
- $(OBSTACK_H) \
- objc/objc-map.h
- $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< \
- $(OUTPUT_OPTION)
+objcp/objc-runtime-shared-support.o: objc/objc-runtime-shared-support.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+objcp/objc-gnu-runtime-abi-01.o: objc/objc-gnu-runtime-abi-01.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+objcp/objc-next-runtime-abi-01.o: objc/objc-next-runtime-abi-01.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+objcp/objc-next-runtime-abi-02.o: objc/objc-next-runtime-abi-02.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+objcp/objcp-act.o: objc/objc-act.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+objcp/objc-encoding.o: objc/objc-encoding.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
+objcp/objc-map.o: objc/objc-map.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
po-generated:
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6da219e6869..84b2357b754 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "langhooks.h"
#include "diagnostic-core.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "flags.h"
#include "function.h"
#include "expr.h"
@@ -853,6 +853,7 @@ copy_var_decl (tree var, tree name, tree type)
TREE_NO_WARNING (copy) = TREE_NO_WARNING (var);
TREE_USED (copy) = 1;
DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;
+ DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var);
return copy;
}
@@ -942,7 +943,7 @@ build_outer_var_ref (tree var, omp_context *ctx)
if (ctx->outer && is_taskreg_ctx (ctx))
x = lookup_decl (var, ctx->outer);
else if (ctx->outer)
- x = maybe_lookup_decl (var, ctx->outer);
+ x = maybe_lookup_decl_in_outer_ctx (var, ctx);
if (x == NULL_TREE)
x = var;
}
@@ -2305,8 +2306,9 @@ omp_max_vf (void)
{
if (!optimize
|| optimize_debug
- || (!flag_tree_vectorize
- && global_options_set.x_flag_tree_vectorize))
+ || (!flag_tree_loop_vectorize
+ && (global_options_set.x_flag_tree_loop_vectorize
+ || global_options_set.x_flag_tree_vectorize)))
return 1;
int vs = targetm.vectorize.autovectorize_vector_sizes ();
@@ -2773,6 +2775,9 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
if (lane)
{
tree uid = create_tmp_var (ptr_type_node, "simduid");
+ /* Don't want uninit warnings on simduid, it is always uninitialized,
+ but we use it not for the value, but for the DECL_UID only. */
+ TREE_NO_WARNING (uid) = 1;
gimple g
= gimple_build_call_internal (IFN_GOMP_SIMD_LANE, 1, uid);
gimple_call_set_lhs (g, lane);
@@ -5684,10 +5689,11 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
loop->simduid = OMP_CLAUSE__SIMDUID__DECL (simduid);
cfun->has_simduid_loops = true;
}
- /* If not -fno-tree-vectorize, hint that we want to vectorize
+ /* If not -fno-tree-loop-vectorize, hint that we want to vectorize
the loop. */
- if ((flag_tree_vectorize
- || !global_options_set.x_flag_tree_vectorize)
+ if ((flag_tree_loop_vectorize
+ || (!global_options_set.x_flag_tree_loop_vectorize
+ && !global_options_set.x_flag_tree_vectorize))
&& loop->safelen > 1)
{
loop->force_vect = true;
@@ -5866,8 +5872,7 @@ expand_omp_sections (struct omp_region *region)
{
/* If we are not inside a combined parallel+sections region,
call GOMP_sections_start. */
- t = build_int_cst (unsigned_type_node,
- exit_reachable ? len - 1 : len);
+ t = build_int_cst (unsigned_type_node, len - 1);
u = builtin_decl_explicit (BUILT_IN_GOMP_SECTIONS_START);
stmt = gimple_build_call (u, 1, t);
}
@@ -6855,8 +6860,8 @@ const pass_data pass_data_expand_omp =
class pass_expand_omp : public gimple_opt_pass
{
public:
- pass_expand_omp(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_expand_omp, ctxt)
+ pass_expand_omp (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_expand_omp, ctxt)
{}
/* opt_pass methods: */
@@ -8051,8 +8056,8 @@ const pass_data pass_data_lower_omp =
class pass_lower_omp : public gimple_opt_pass
{
public:
- pass_lower_omp(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_omp, ctxt)
+ pass_lower_omp (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_omp, ctxt)
{}
/* opt_pass methods: */
@@ -8332,8 +8337,8 @@ const pass_data pass_data_diagnose_omp_blocks =
class pass_diagnose_omp_blocks : public gimple_opt_pass
{
public:
- pass_diagnose_omp_blocks(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_diagnose_omp_blocks, ctxt)
+ pass_diagnose_omp_blocks (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_diagnose_omp_blocks, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 1d0659e1361..06a626c839b 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -401,8 +401,8 @@ optab_for_tree_code (enum tree_code code, const_tree type,
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
case EXACT_DIV_EXPR:
- if (TYPE_SATURATING(type))
- return TYPE_UNSIGNED(type) ? usdiv_optab : ssdiv_optab;
+ if (TYPE_SATURATING (type))
+ return TYPE_UNSIGNED (type) ? usdiv_optab : ssdiv_optab;
return TYPE_UNSIGNED (type) ? udiv_optab : sdiv_optab;
case LSHIFT_EXPR:
@@ -413,8 +413,8 @@ optab_for_tree_code (enum tree_code code, const_tree type,
gcc_assert (subtype == optab_scalar);
}
- if (TYPE_SATURATING(type))
- return TYPE_UNSIGNED(type) ? usashl_optab : ssashl_optab;
+ if (TYPE_SATURATING (type))
+ return TYPE_UNSIGNED (type) ? usashl_optab : ssashl_optab;
return ashl_optab;
case RSHIFT_EXPR:
@@ -556,23 +556,23 @@ optab_for_tree_code (enum tree_code code, const_tree type,
{
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
- if (TYPE_SATURATING(type))
- return TYPE_UNSIGNED(type) ? usadd_optab : ssadd_optab;
+ if (TYPE_SATURATING (type))
+ return TYPE_UNSIGNED (type) ? usadd_optab : ssadd_optab;
return trapv ? addv_optab : add_optab;
case MINUS_EXPR:
- if (TYPE_SATURATING(type))
- return TYPE_UNSIGNED(type) ? ussub_optab : sssub_optab;
+ if (TYPE_SATURATING (type))
+ return TYPE_UNSIGNED (type) ? ussub_optab : sssub_optab;
return trapv ? subv_optab : sub_optab;
case MULT_EXPR:
- if (TYPE_SATURATING(type))
- return TYPE_UNSIGNED(type) ? usmul_optab : ssmul_optab;
+ if (TYPE_SATURATING (type))
+ return TYPE_UNSIGNED (type) ? usmul_optab : ssmul_optab;
return trapv ? smulv_optab : smul_optab;
case NEGATE_EXPR:
- if (TYPE_SATURATING(type))
- return TYPE_UNSIGNED(type) ? usneg_optab : ssneg_optab;
+ if (TYPE_SATURATING (type))
+ return TYPE_UNSIGNED (type) ? usneg_optab : ssneg_optab;
return trapv ? negv_optab : neg_optab;
case ABS_EXPR:
@@ -4288,7 +4288,7 @@ emit_cmp_and_jump_insn_1 (rtx test, enum machine_mode mode, rtx label, int prob)
&& JUMP_P (insn)
&& any_condjump_p (insn)
&& !find_reg_note (insn, REG_BR_PROB, 0))
- add_reg_note (insn, REG_BR_PROB, GEN_INT (prob));
+ add_int_reg_note (insn, REG_BR_PROB, prob);
}
/* Generate code to compare X with Y so that the condition codes are
@@ -5714,7 +5714,7 @@ gen_interclass_conv_libfunc (convert_optab tab,
fname = GET_MODE_NAME (fmode);
tname = GET_MODE_NAME (tmode);
- if (DECIMAL_FLOAT_MODE_P(fmode) || DECIMAL_FLOAT_MODE_P(tmode))
+ if (DECIMAL_FLOAT_MODE_P (fmode) || DECIMAL_FLOAT_MODE_P (tmode))
{
libfunc_name = dec_name;
suffix = dec_suffix;
@@ -5847,7 +5847,7 @@ gen_intraclass_conv_libfunc (convert_optab tab, const char *opname,
fname = GET_MODE_NAME (fmode);
tname = GET_MODE_NAME (tmode);
- if (DECIMAL_FLOAT_MODE_P(fmode) || DECIMAL_FLOAT_MODE_P(tmode))
+ if (DECIMAL_FLOAT_MODE_P (fmode) || DECIMAL_FLOAT_MODE_P (tmode))
{
libfunc_name = dec_name;
suffix = dec_suffix;
@@ -7585,7 +7585,7 @@ expand_atomic_store (rtx mem, rtx val, enum memmodel model, bool use_release)
/* If the size of the object is greater than word size on this target,
a default store will not be atomic, Try a mem_exchange and throw away
the result. If that doesn't work, don't do anything. */
- if (GET_MODE_PRECISION(mode) > BITS_PER_WORD)
+ if (GET_MODE_PRECISION (mode) > BITS_PER_WORD)
{
rtx target = maybe_emit_atomic_exchange (NULL_RTX, mem, val, model);
if (!target)
diff --git a/gcc/opts.c b/gcc/opts.c
index 53c9886f756..87451ccbe68 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -169,7 +169,7 @@ base_of_path (const char *path, const char **base_out)
char c = *p;
while (c)
{
- if (IS_DIR_SEPARATOR(c))
+ if (IS_DIR_SEPARATOR (c))
{
base = p + 1;
dot = 0;
@@ -486,6 +486,7 @@ static const struct default_options default_options_table[] =
{ OPT_LEVELS_2_PLUS, OPT_falign_labels, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_falign_functions, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_ftree_tail_merge, NULL, 1 },
+ { OPT_LEVELS_2_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_CHEAP },
{ OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_foptimize_strlen, NULL, 1 },
{ OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
@@ -498,8 +499,9 @@ static const struct default_options default_options_table[] =
{ OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_ftree_vectorize, NULL, 1 },
- { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model, NULL, 1 },
+ { OPT_LEVELS_3_PLUS, OPT_ftree_loop_vectorize, NULL, 1 },
+ { OPT_LEVELS_3_PLUS, OPT_ftree_slp_vectorize, NULL, 1 },
+ { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model_, NULL, VECT_COST_MODEL_DYNAMIC },
{ OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
@@ -824,9 +826,21 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
}
}
+ /* Tune vectorization related parametees according to cost model. */
+ if (opts->x_flag_vect_cost_model == VECT_COST_MODEL_CHEAP)
+ {
+ maybe_set_param_value (PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS,
+ 6, opts->x_param_values, opts_set->x_param_values);
+ maybe_set_param_value (PARAM_VECT_MAX_VERSION_FOR_ALIGNMENT_CHECKS,
+ 0, opts->x_param_values, opts_set->x_param_values);
+ maybe_set_param_value (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT,
+ 0, opts->x_param_values, opts_set->x_param_values);
+ }
+
/* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion
is disabled. */
- if (!opts->x_flag_tree_vectorize || !opts->x_flag_tree_loop_if_convert)
+ if ((!opts->x_flag_tree_loop_vectorize && !opts->x_flag_tree_slp_vectorize)
+ || !opts->x_flag_tree_loop_if_convert)
maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
opts->x_param_values, opts_set->x_param_values);
@@ -874,7 +888,7 @@ wrap_help (const char *help,
}
}
- printf( " %-*.*s %.*s\n", col_width, item_width, item, len, help);
+ printf (" %-*.*s %.*s\n", col_width, item_width, item, len, help);
item_width = 0;
while (help[len] == ' ')
len++;
@@ -1660,10 +1674,14 @@ common_handle_option (struct gcc_options *opts,
opts->x_flag_unswitch_loops = value;
if (!opts_set->x_flag_gcse_after_reload)
opts->x_flag_gcse_after_reload = value;
- if (!opts_set->x_flag_tree_vectorize)
- opts->x_flag_tree_vectorize = value;
+ if (!opts_set->x_flag_tree_loop_vectorize
+ && !opts_set->x_flag_tree_vectorize)
+ opts->x_flag_tree_loop_vectorize = value;
+ if (!opts_set->x_flag_tree_slp_vectorize
+ && !opts_set->x_flag_tree_vectorize)
+ opts->x_flag_tree_slp_vectorize = value;
if (!opts_set->x_flag_vect_cost_model)
- opts->x_flag_vect_cost_model = value;
+ opts->x_flag_vect_cost_model = VECT_COST_MODEL_DYNAMIC;
if (!opts_set->x_flag_tree_loop_distribute_patterns)
opts->x_flag_tree_loop_distribute_patterns = value;
/* Indirect call profiling should do all useful transformations
@@ -1691,6 +1709,12 @@ common_handle_option (struct gcc_options *opts,
opts->x_flag_ipa_reference = false;
break;
+ case OPT_ftree_vectorize:
+ if (!opts_set->x_flag_tree_loop_vectorize)
+ opts->x_flag_tree_loop_vectorize = value;
+ if (!opts_set->x_flag_tree_slp_vectorize)
+ opts->x_flag_tree_slp_vectorize = value;
+ break;
case OPT_fshow_column:
dc->show_column = value;
break;
diff --git a/gcc/params.def b/gcc/params.def
index 3c5265160c6..27491378d11 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -544,6 +544,11 @@ DEFPARAM(PARAM_VECT_MAX_VERSION_FOR_ALIAS_CHECKS,
"Bound on number of runtime checks inserted by the vectorizer's loop versioning for alias check",
10, 0, 0)
+DEFPARAM(PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT,
+ "vect-max-peeling-for-alignment",
+ "Max number of loop peels to enhancement alignment of data references in a loop",
+ -1, -1, 64)
+
DEFPARAM(PARAM_MAX_CSELIB_MEMORY_LOCATIONS,
"max-cselib-memory-locations",
"The maximum memory locations recorded by cselib",
diff --git a/gcc/pass_manager.h b/gcc/pass_manager.h
index 04c6237d791..77d78eb11f5 100644
--- a/gcc/pass_manager.h
+++ b/gcc/pass_manager.h
@@ -49,7 +49,7 @@ class pass_manager
public:
void *operator new (size_t sz);
- pass_manager(context *ctxt);
+ pass_manager (context *ctxt);
void register_pass (struct register_pass_info *pass_info);
void register_one_dump_file (struct opt_pass *pass);
@@ -97,7 +97,7 @@ private:
void register_dump_files (struct opt_pass *pass, int properties);
private:
- context *ctxt_;
+ context *m_ctxt;
/* References to all of the individual passes.
These fields are generated via macro expansion.
diff --git a/gcc/passes.c b/gcc/passes.c
index 5b4975267eb..e7b7b9a992f 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -61,7 +61,7 @@ along with GCC; see the file COPYING3. If not see
#include "coverage.h"
#include "value-prof.h"
#include "tree-inline.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-dump.h"
#include "df.h"
@@ -107,12 +107,12 @@ opt_pass::execute ()
return 0;
}
-opt_pass::opt_pass(const pass_data &data, context *ctxt)
- : pass_data(data),
- sub(NULL),
- next(NULL),
- static_pass_number(0),
- ctxt_(ctxt)
+opt_pass::opt_pass (const pass_data &data, context *ctxt)
+ : pass_data (data),
+ sub (NULL),
+ next (NULL),
+ static_pass_number (0),
+ m_ctxt (ctxt)
{
}
@@ -350,8 +350,8 @@ const pass_data pass_data_early_local_passes =
class pass_early_local_passes : public simple_ipa_opt_pass
{
public:
- pass_early_local_passes(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_early_local_passes, ctxt)
+ pass_early_local_passes (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_early_local_passes, ctxt)
{}
/* opt_pass methods: */
@@ -398,8 +398,8 @@ const pass_data pass_data_all_early_optimizations =
class pass_all_early_optimizations : public gimple_opt_pass
{
public:
- pass_all_early_optimizations(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_all_early_optimizations, ctxt)
+ pass_all_early_optimizations (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_all_early_optimizations, ctxt)
{}
/* opt_pass methods: */
@@ -443,8 +443,8 @@ const pass_data pass_data_all_optimizations =
class pass_all_optimizations : public gimple_opt_pass
{
public:
- pass_all_optimizations(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_all_optimizations, ctxt)
+ pass_all_optimizations (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_all_optimizations, ctxt)
{}
/* opt_pass methods: */
@@ -488,8 +488,8 @@ const pass_data pass_data_all_optimizations_g =
class pass_all_optimizations_g : public gimple_opt_pass
{
public:
- pass_all_optimizations_g(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_all_optimizations_g, ctxt)
+ pass_all_optimizations_g (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_all_optimizations_g, ctxt)
{}
/* opt_pass methods: */
@@ -533,8 +533,8 @@ const pass_data pass_data_rest_of_compilation =
class pass_rest_of_compilation : public rtl_opt_pass
{
public:
- pass_rest_of_compilation(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rest_of_compilation, ctxt)
+ pass_rest_of_compilation (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rest_of_compilation, ctxt)
{}
/* opt_pass methods: */
@@ -576,8 +576,8 @@ const pass_data pass_data_postreload =
class pass_postreload : public rtl_opt_pass
{
public:
- pass_postreload(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_postreload, ctxt)
+ pass_postreload (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_postreload, ctxt)
{}
/* opt_pass methods: */
@@ -836,7 +836,7 @@ dump_one_pass (struct opt_pass *pass, int pass_indent)
const char *pn;
bool is_on, is_really_on;
- is_on = pass->has_gate ? pass->gate() : true;
+ is_on = pass->has_gate ? pass->gate () : true;
is_really_on = override_gate_status (pass, current_function_decl, is_on);
if (pass->static_pass_number <= 0)
@@ -879,7 +879,7 @@ pass_manager::dump_passes () const
{
struct cgraph_node *n, *node = NULL;
- create_pass_tab();
+ create_pass_tab ();
FOR_EACH_FUNCTION (n)
if (DECL_STRUCT_FUNCTION (n->symbol.decl))
@@ -1485,10 +1485,10 @@ pass_manager::operator new (size_t sz)
}
pass_manager::pass_manager (context *ctxt)
-: all_passes(NULL), all_small_ipa_passes(NULL), all_lowering_passes(NULL),
- all_regular_ipa_passes(NULL), all_lto_gen_passes(NULL),
- all_late_ipa_passes(NULL), passes_by_id(NULL), passes_by_id_size(0),
- ctxt_(ctxt)
+: all_passes (NULL), all_small_ipa_passes (NULL), all_lowering_passes (NULL),
+ all_regular_ipa_passes (NULL), all_lto_gen_passes (NULL),
+ all_late_ipa_passes (NULL), passes_by_id (NULL), passes_by_id_size (0),
+ m_ctxt (ctxt)
{
struct opt_pass **p;
@@ -1513,7 +1513,7 @@ pass_manager::pass_manager (context *ctxt)
do { \
gcc_assert (NULL == PASS ## _ ## NUM); \
if ((NUM) == 1) \
- PASS ## _1 = make_##PASS (ctxt_); \
+ PASS ## _1 = make_##PASS (m_ctxt); \
else \
{ \
gcc_assert (PASS ## _1); \
@@ -2090,7 +2090,7 @@ apply_ipa_transforms (void *data)
if (!node->global.inlined_to && node->ipa_transforms_to_apply.exists ())
{
*(bool *)data = true;
- execute_all_ipa_transforms();
+ execute_all_ipa_transforms ();
rebuild_cgraph_edges ();
}
}
@@ -2139,7 +2139,7 @@ execute_one_pass (struct opt_pass *pass)
/* Check whether gate check should be avoided.
User controls the value of the gate through the parameter "gate_status". */
- gate_status = pass->has_gate ? pass->gate() : true;
+ gate_status = pass->has_gate ? pass->gate () : true;
gate_status = override_gate_status (pass, current_function_decl, gate_status);
/* Override gate with plugin. */
diff --git a/gcc/passes.def b/gcc/passes.def
index 736a28b64dc..84eb3f37e57 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -239,7 +239,13 @@ along with GCC; see the file COPYING3. If not see
NEXT_PASS (pass_vrp);
NEXT_PASS (pass_cd_dce);
NEXT_PASS (pass_tracer);
-
+ NEXT_PASS (pass_dse);
+ NEXT_PASS (pass_forwprop);
+ NEXT_PASS (pass_phiopt);
+ NEXT_PASS (pass_fold_builtins);
+ NEXT_PASS (pass_optimize_widening_mul);
+ NEXT_PASS (pass_tail_calls);
+ NEXT_PASS (pass_rename_ssa_copies);
/* FIXME: If DCE is not run before checking for uninitialized uses,
we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c).
However, this also causes us to misdiagnose cases that should be
@@ -249,14 +255,10 @@ along with GCC; see the file COPYING3. If not see
account for the predicates protecting the set and the use of each
variable. Using a representation like Gated Single Assignment
may help. */
+ /* Split critical edges before late uninit warning to reduce the
+ number of false positives from it. */
+ NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_late_warn_uninitialized);
- NEXT_PASS (pass_dse);
- NEXT_PASS (pass_forwprop);
- NEXT_PASS (pass_phiopt);
- NEXT_PASS (pass_fold_builtins);
- NEXT_PASS (pass_optimize_widening_mul);
- NEXT_PASS (pass_tail_calls);
- NEXT_PASS (pass_rename_ssa_copies);
NEXT_PASS (pass_uncprop);
NEXT_PASS (pass_local_pure_const);
POP_INSERT_PASSES ()
@@ -282,6 +284,9 @@ along with GCC; see the file COPYING3. If not see
/* ??? We do want some kind of loop invariant motion, but we possibly
need to adjust LIM to be more friendly towards preserving accurate
debug information here. */
+ /* Split critical edges before late uninit warning to reduce the
+ number of false positives from it. */
+ NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_late_warn_uninitialized);
NEXT_PASS (pass_uncprop);
NEXT_PASS (pass_local_pure_const);
diff --git a/gcc/plugin.c b/gcc/plugin.c
index b269dfa3971..d7dcb5f4d36 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -241,16 +241,13 @@ parse_plugin_arg_opt (const char *arg)
}
else if (*ptr == '=')
{
- if (key_parsed)
- {
- error ("malformed option -fplugin-arg-%s (multiple '=' signs)",
- arg);
- return;
- }
- key_len = len;
- len = 0;
- value_start = ptr + 1;
- key_parsed = true;
+ if (!key_parsed)
+ {
+ key_len = len;
+ len = 0;
+ value_start = ptr + 1;
+ key_parsed = true;
+ }
continue;
}
else
@@ -806,7 +803,7 @@ dump_active_plugins (FILE *file)
for (ci = plugin_callbacks[event]; ci; ci = ci->next)
fprintf (file, " %s", ci->plugin_name);
- putc('\n', file);
+ putc ('\n', file);
}
}
diff --git a/gcc/postreload-gcse.c b/gcc/postreload-gcse.c
index 0f3ed7acda6..941007f5220 100644
--- a/gcc/postreload-gcse.c
+++ b/gcc/postreload-gcse.c
@@ -892,7 +892,7 @@ get_avail_load_store_reg (rtx insn)
{
if (REG_P (SET_DEST (PATTERN (insn))))
/* A load. */
- return SET_DEST(PATTERN(insn));
+ return SET_DEST (PATTERN (insn));
else
{
/* A store. */
@@ -1344,8 +1344,8 @@ const pass_data pass_data_gcse2 =
class pass_gcse2 : public rtl_opt_pass
{
public:
- pass_gcse2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_gcse2, ctxt)
+ pass_gcse2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_gcse2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 97d7e5d0332..b0c63422357 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -2359,8 +2359,8 @@ const pass_data pass_data_postreload_cse =
class pass_postreload_cse : public rtl_opt_pass
{
public:
- pass_postreload_cse(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_postreload_cse, ctxt)
+ pass_postreload_cse (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_postreload_cse, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/predict.c b/gcc/predict.c
index affed79ae9d..4815e75248e 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -50,7 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "target.h"
#include "cfgloop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "ggc.h"
#include "tree-pass.h"
#include "tree-scalar-evolution.h"
@@ -528,7 +528,7 @@ bool
br_prob_note_reliable_p (const_rtx note)
{
gcc_assert (REG_NOTE_KIND (note) == REG_BR_PROB);
- return probability_reliable_p (INTVAL (XEXP (note, 0)));
+ return probability_reliable_p (XINT (note, 0));
}
static void
@@ -682,7 +682,7 @@ invert_br_probabilities (rtx insn)
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
if (REG_NOTE_KIND (note) == REG_BR_PROB)
- XEXP (note, 0) = GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (note, 0)));
+ XINT (note, 0) = REG_BR_PROB_BASE - XINT (note, 0);
else if (REG_NOTE_KIND (note) == REG_BR_PRED)
XEXP (XEXP (note, 0), 1)
= GEN_INT (REG_BR_PROB_BASE - INTVAL (XEXP (XEXP (note, 0), 1)));
@@ -836,7 +836,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
if (!prob_note)
{
- add_reg_note (insn, REG_BR_PROB, GEN_INT (combined_probability));
+ add_int_reg_note (insn, REG_BR_PROB, combined_probability);
/* Save the prediction into CFG in case we are seeing non-degenerated
conditional jump. */
@@ -849,7 +849,7 @@ combine_predictions_for_insn (rtx insn, basic_block bb)
}
else if (!single_succ_p (bb))
{
- int prob = INTVAL (XEXP (prob_note, 0));
+ int prob = XINT (prob_note, 0);
BRANCH_EDGE (bb)->probability = prob;
FALLTHRU_EDGE (bb)->probability = REG_BR_PROB_BASE - prob;
@@ -2957,8 +2957,8 @@ const pass_data pass_data_profile =
class pass_profile : public gimple_opt_pass
{
public:
- pass_profile(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_profile, ctxt)
+ pass_profile (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_profile, ctxt)
{}
/* opt_pass methods: */
@@ -2995,12 +2995,12 @@ const pass_data pass_data_strip_predict_hints =
class pass_strip_predict_hints : public gimple_opt_pass
{
public:
- pass_strip_predict_hints(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_strip_predict_hints, ctxt)
+ pass_strip_predict_hints (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_strip_predict_hints, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_strip_predict_hints (ctxt_); }
+ opt_pass * clone () { return new pass_strip_predict_hints (m_ctxt); }
unsigned int execute () { return strip_predict_hints (); }
}; // class pass_strip_predict_hints
diff --git a/gcc/prefix.c b/gcc/prefix.c
index 058e19156c5..6092fbf1987 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -250,7 +250,7 @@ update_path (const char *path, const char *key)
const int len = strlen (std_prefix);
if (! filename_ncmp (path, std_prefix, len)
- && (IS_DIR_SEPARATOR(path[len])
+ && (IS_DIR_SEPARATOR (path[len])
|| path[len] == '\0')
&& key != 0)
{
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index 05f345ca2a8..8cec71b762a 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -773,7 +773,7 @@ pretty_printer::pretty_printer (const char *p, int l)
format_decoder (),
emitted_prefix (),
need_newline (),
- translate_identifiers(true),
+ translate_identifiers (true),
show_color ()
{
pp_line_cutoff (this) = l;
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index d2bda9ec84c..7d712c1562d 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -150,7 +150,8 @@ print_rtx (const_rtx in_rtx)
/* Print REG_NOTE names for EXPR_LIST and INSN_LIST. */
if ((GET_CODE (in_rtx) == EXPR_LIST
- || GET_CODE (in_rtx) == INSN_LIST)
+ || GET_CODE (in_rtx) == INSN_LIST
+ || GET_CODE (in_rtx) == INT_LIST)
&& (int)GET_MODE (in_rtx) < REG_NOTE_MAX)
fprintf (outfile, ":%s",
GET_REG_NOTE_NAME (GET_MODE (in_rtx)));
@@ -398,7 +399,8 @@ print_rtx (const_rtx in_rtx)
redundant with line number information and do not print anything
when there is no location information available. */
if (INSN_LOCATION (in_rtx) && insn_file (in_rtx))
- fprintf(outfile, " %s:%i", insn_file (in_rtx), insn_line (in_rtx));
+ fprintf (outfile, " %s:%i", insn_file (in_rtx),
+ insn_line (in_rtx));
#endif
}
else if (i == 6 && GET_CODE (in_rtx) == ASM_OPERANDS)
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 1ee27428714..4ded0d6360a 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-iterator.h"
#include "diagnostic.h"
#include "gimple-pretty-print.h" /* FIXME */
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-dump.h"
#include "dumpfile.h"
@@ -818,7 +818,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
if (ch >= ' ' && ch < 127)
putc (ch, file);
else
- fprintf(file, "\\%03o", ch & 0xFF);
+ fprintf (file, "\\%03o", ch & 0xFF);
}
fputc ('\"', file);
}
diff --git a/gcc/profile.c b/gcc/profile.c
index 2abde8aec03..edc202cf767 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -61,7 +61,7 @@ along with GCC; see the file COPYING3. If not see
#include "coverage.h"
#include "value-prof.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "dumpfile.h"
@@ -275,11 +275,11 @@ get_exec_counts (unsigned cfg_checksum, unsigned lineno_checksum)
if (!counts)
return NULL;
- get_working_sets();
+ get_working_sets ();
if (dump_file && profile_info)
- fprintf(dump_file, "Merged %u profiles with maximal count %u.\n",
- profile_info->runs, (unsigned) profile_info->sum_max);
+ fprintf (dump_file, "Merged %u profiles with maximal count %u.\n",
+ profile_info->runs, (unsigned) profile_info->sum_max);
return counts;
}
@@ -434,7 +434,8 @@ read_profile_edge_counts (gcov_type *exec_counts)
static bool informed = 0;
if (dump_enabled_p () && !informed)
dump_printf_loc (MSG_NOTE, input_location,
- "corrupted profile info: edge count exceeds maximal count");
+ "corrupted profile info: edge count"
+ " exceeds maximal count\n");
informed = 1;
}
else
@@ -696,7 +697,7 @@ compute_branch_probabilities (unsigned cfg_checksum, unsigned lineno_checksum)
{
informed = 1;
dump_printf_loc (MSG_NOTE, input_location,
- "correcting inconsistent profile data");
+ "correcting inconsistent profile data\n");
}
correct_negative_edge_counts ();
/* Set bb counts to the sum of the outgoing edge counts */
@@ -975,7 +976,7 @@ branch_prob (void)
unsigned num_edges, ignored_edges;
unsigned num_instrumented;
struct edge_list *el;
- histogram_values values = histogram_values();
+ histogram_values values = histogram_values ();
unsigned cfg_checksum, lineno_checksum;
total_num_times_called++;
diff --git a/gcc/read-md.c b/gcc/read-md.c
index d32072be7a5..c108d51fd06 100644
--- a/gcc/read-md.c
+++ b/gcc/read-md.c
@@ -672,7 +672,7 @@ scan_comma_elt (const char **pstr)
if (*p == ',')
p++;
- while (ISSPACE(*p))
+ while (ISSPACE (*p))
p++;
if (*p == '\0')
diff --git a/gcc/real.c b/gcc/real.c
index b80aeac843f..b59be66af94 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -2855,7 +2855,7 @@ real_hash (const REAL_VALUE_TYPE *r)
gcc_unreachable ();
}
- if (sizeof(unsigned long) > sizeof(unsigned int))
+ if (sizeof (unsigned long) > sizeof (unsigned int))
for (i = 0; i < SIGSZ; ++i)
{
unsigned long s = r->sig[i];
diff --git a/gcc/real.h b/gcc/real.h
index 2ff84f6d295..b92453411d7 100644
--- a/gcc/real.h
+++ b/gcc/real.h
@@ -73,7 +73,7 @@ struct GTY(()) real_value {
/* Verify the guess. */
extern char test_real_width
- [sizeof(REAL_VALUE_TYPE) <= REAL_WIDTH*sizeof(HOST_WIDE_INT) ? 1 : -1];
+ [sizeof (REAL_VALUE_TYPE) <= REAL_WIDTH * sizeof (HOST_WIDE_INT) ? 1 : -1];
/* Calculate the format for CONST_DOUBLE. We need as many slots as
are necessary to overlay a REAL_VALUE_TYPE on them. This could be
diff --git a/gcc/recog.c b/gcc/recog.c
index 690b20e4751..a3ca98c62fd 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3801,14 +3801,14 @@ const pass_data pass_data_peephole2 =
class pass_peephole2 : public rtl_opt_pass
{
public:
- pass_peephole2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_peephole2, ctxt)
+ pass_peephole2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_peephole2, ctxt)
{}
/* opt_pass methods: */
/* The epiphany backend creates a second instance of this pass, so we need
a clone method. */
- opt_pass * clone () { return new pass_peephole2 (ctxt_); }
+ opt_pass * clone () { return new pass_peephole2 (m_ctxt); }
bool gate () { return gate_handle_peephole2 (); }
unsigned int execute () { return rest_of_handle_peephole2 (); }
@@ -3849,14 +3849,14 @@ const pass_data pass_data_split_all_insns =
class pass_split_all_insns : public rtl_opt_pass
{
public:
- pass_split_all_insns(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_split_all_insns, ctxt)
+ pass_split_all_insns (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_split_all_insns, ctxt)
{}
/* opt_pass methods: */
/* The epiphany backend creates a second instance of this pass, so
we need a clone method. */
- opt_pass * clone () { return new pass_split_all_insns (ctxt_); }
+ opt_pass * clone () { return new pass_split_all_insns (m_ctxt); }
unsigned int execute () { return rest_of_handle_split_all_insns (); }
}; // class pass_split_all_insns
@@ -3900,8 +3900,8 @@ const pass_data pass_data_split_after_reload =
class pass_split_after_reload : public rtl_opt_pass
{
public:
- pass_split_after_reload(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_split_after_reload, ctxt)
+ pass_split_after_reload (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_split_after_reload, ctxt)
{}
/* opt_pass methods: */
@@ -3962,8 +3962,8 @@ const pass_data pass_data_split_before_regstack =
class pass_split_before_regstack : public rtl_opt_pass
{
public:
- pass_split_before_regstack(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_split_before_regstack, ctxt)
+ pass_split_before_regstack (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_split_before_regstack, ctxt)
{}
/* opt_pass methods: */
@@ -4021,8 +4021,8 @@ const pass_data pass_data_split_before_sched2 =
class pass_split_before_sched2 : public rtl_opt_pass
{
public:
- pass_split_before_sched2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_split_before_sched2, ctxt)
+ pass_split_before_sched2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_split_before_sched2, ctxt)
{}
/* opt_pass methods: */
@@ -4071,8 +4071,8 @@ const pass_data pass_data_split_for_shorten_branches =
class pass_split_for_shorten_branches : public rtl_opt_pass
{
public:
- pass_split_for_shorten_branches(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_split_for_shorten_branches, ctxt)
+ pass_split_for_shorten_branches (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_split_for_shorten_branches, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/ree.c b/gcc/ree.c
index 541bdb5a131..fa05feed749 100644
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -800,7 +800,7 @@ add_removable_extension (const_rtx expr, rtx insn,
/* Second, make sure the reaching definitions don't feed another and
different extension. FIXME: this obviously can be improved. */
for (def = defs; def; def = def->next)
- if ((idx = def_map[INSN_UID(DF_REF_INSN (def->ref))])
+ if ((idx = def_map[INSN_UID (DF_REF_INSN (def->ref))])
&& (cand = &(*insn_list)[idx - 1])
&& cand->code != code)
{
@@ -820,7 +820,7 @@ add_removable_extension (const_rtx expr, rtx insn,
idx = insn_list->length ();
for (def = defs; def; def = def->next)
- def_map[INSN_UID(DF_REF_INSN (def->ref))] = idx;
+ def_map[INSN_UID (DF_REF_INSN (def->ref))] = idx;
}
}
@@ -961,8 +961,8 @@ const pass_data pass_data_ree =
class pass_ree : public rtl_opt_pass
{
public:
- pass_ree(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_ree, ctxt)
+ pass_ree (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_ree, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/reg-notes.def b/gcc/reg-notes.def
index 3b1d27ca8a7..fd7e337c2d6 100644
--- a/gcc/reg-notes.def
+++ b/gcc/reg-notes.def
@@ -18,9 +18,9 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* This file defines all the codes that may appear on individual
- EXPR_LIST rtxes in the REG_NOTES chain of an insn. The codes are
- stored in the mode field of the EXPR_LIST. Source files define
- DEF_REG_NOTE appropriately before including this file. */
+ EXPR_LIST, INSN_LIST and INT_LIST rtxes in the REG_NOTES chain of an insn.
+ The codes are stored in the mode field of the rtx. Source files
+ define DEF_REG_NOTE appropriately before including this file. */
/* Shorthand. */
#define REG_NOTE(NAME) DEF_REG_NOTE (REG_##NAME)
@@ -94,9 +94,9 @@ REG_NOTE (DEP_ANTI)
REG_NOTE (DEP_CONTROL)
/* REG_BR_PROB is attached to JUMP_INSNs and CALL_INSNs. It has an
- integer value. For jumps, it is the probability that this is a
- taken branch. For calls, it is the probability that this call
- won't return. */
+ integer value (in an INT_LIST). For jumps, it is the probability
+ that this is a taken branch. For calls, it is the probability that
+ this call won't return. */
REG_NOTE (BR_PROB)
/* Attached to a call insn; indicates that the call is malloc-like and
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index b3574e66d17..1917c46fe96 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -253,7 +253,7 @@ static void replace_reg (rtx *, int);
static void remove_regno_note (rtx, enum reg_note, unsigned int);
static int get_hard_regnum (stack_ptr, rtx);
static rtx emit_pop_insn (rtx, stack_ptr, rtx, enum emit_where);
-static void swap_to_top(rtx, stack_ptr, rtx, rtx);
+static void swap_to_top (rtx, stack_ptr, rtx, rtx);
static bool move_for_stack_reg (rtx, stack_ptr, rtx);
static bool move_nan_for_stack_reg (rtx, stack_ptr, rtx);
static int swap_rtx_condition_1 (rtx);
@@ -2058,6 +2058,8 @@ subst_asm_stack_regs (rtx insn, stack_ptr regstack)
n_notes = 0;
for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
{
+ if (GET_CODE (note) != EXPR_LIST)
+ continue;
rtx reg = XEXP (note, 0);
rtx *loc = & XEXP (note, 0);
@@ -3312,8 +3314,8 @@ const pass_data pass_data_stack_regs =
class pass_stack_regs : public rtl_opt_pass
{
public:
- pass_stack_regs(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_stack_regs, ctxt)
+ pass_stack_regs (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_stack_regs, ctxt)
{}
/* opt_pass methods: */
@@ -3361,8 +3363,8 @@ const pass_data pass_data_stack_regs_run =
class pass_stack_regs_run : public rtl_opt_pass
{
public:
- pass_stack_regs_run(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_stack_regs_run, ctxt)
+ pass_stack_regs_run (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_stack_regs_run, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/regcprop.c b/gcc/regcprop.c
index 19f33495170..0fa0afbc824 100644
--- a/gcc/regcprop.c
+++ b/gcc/regcprop.c
@@ -1256,8 +1256,8 @@ const pass_data pass_data_cprop_hardreg =
class pass_cprop_hardreg : public rtl_opt_pass
{
public:
- pass_cprop_hardreg(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_cprop_hardreg, ctxt)
+ pass_cprop_hardreg (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_cprop_hardreg, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 49a7a5864e2..26318dc503a 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -447,7 +447,7 @@ init_reg_sets_1 (void)
}
}
- COPY_HARD_REG_SET(call_fixed_reg_set, fixed_reg_set);
+ COPY_HARD_REG_SET (call_fixed_reg_set, fixed_reg_set);
/* Preserve global registers if called more than once. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
@@ -495,7 +495,7 @@ init_reg_modes_target (void)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
for (j = 0; j < MAX_MACHINE_MODE; j++)
- hard_regno_nregs[i][j] = HARD_REGNO_NREGS(i, (enum machine_mode)j);
+ hard_regno_nregs[i][j] = HARD_REGNO_NREGS (i, (enum machine_mode)j);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
@@ -980,8 +980,8 @@ const pass_data pass_data_reginfo_init =
class pass_reginfo_init : public rtl_opt_pass
{
public:
- pass_reginfo_init(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_reginfo_init, ctxt)
+ pass_reginfo_init (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_reginfo_init, ctxt)
{}
/* opt_pass methods: */
@@ -1075,6 +1075,7 @@ reg_scan_mark_refs (rtx x, rtx insn)
break;
case INSN_LIST:
+ case INT_LIST:
if (XEXP (x, 1))
reg_scan_mark_refs (XEXP (x, 1), insn);
break;
diff --git a/gcc/regmove.c b/gcc/regmove.c
index e579a7a234d..85c7ff490c8 100644
--- a/gcc/regmove.c
+++ b/gcc/regmove.c
@@ -652,7 +652,7 @@ copy_src_to_dest (rtx insn, rtx src, rtx dest)
for (link = REG_NOTES (insn); link != NULL_RTX; link = next)
{
next = XEXP (link, 1);
- if (XEXP (link, 0) == src)
+ if (GET_CODE (link) == EXPR_LIST && XEXP (link, 0) == src)
{
*p_move_notes = link;
p_move_notes = &XEXP (link, 1);
@@ -1382,8 +1382,8 @@ const pass_data pass_data_regmove =
class pass_regmove : public rtl_opt_pass
{
public:
- pass_regmove(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_regmove, ctxt)
+ pass_regmove (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_regmove, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/regrename.c b/gcc/regrename.c
index 6830bd8389a..5b2c85799bb 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -1862,8 +1862,8 @@ const pass_data pass_data_regrename =
class pass_regrename : public rtl_opt_pass
{
public:
- pass_regrename(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_regrename, ctxt)
+ pass_regrename (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_regrename, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/regs.h b/gcc/regs.h
index 090d6b64e83..b5fa3f3995f 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -69,7 +69,7 @@ extern struct regstat_n_sets_and_refs_t *regstat_n_sets_and_refs;
/* Indexed by n, gives number of times (REG n) is used or set. */
static inline int
-REG_N_REFS(int regno)
+REG_N_REFS (int regno)
{
return regstat_n_sets_and_refs[regno].refs;
}
diff --git a/gcc/regstat.c b/gcc/regstat.c
index 5b1f3c421ee..85678a70f68 100644
--- a/gcc/regstat.c
+++ b/gcc/regstat.c
@@ -172,7 +172,7 @@ regstat_bb_compute_ri (unsigned int bb_index,
while (link)
{
if (REG_NOTE_KIND (link) == REG_DEAD)
- REG_N_DEATHS(REGNO (XEXP (link, 0)))++;
+ REG_N_DEATHS (REGNO (XEXP (link, 0)))++;
link = XEXP (link, 1);
}
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 7a82c07ef21..bb13bf802d1 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -2325,7 +2325,7 @@ mark_home_live_1 (int regno, enum machine_mode mode)
return;
lim = end_hard_regno (mode, i);
while (i < lim)
- df_set_regs_ever_live(i++, true);
+ df_set_regs_ever_live (i++, true);
}
/* Mark the slots in regs_ever_live for the hard regs
@@ -2776,6 +2776,7 @@ eliminate_regs_1 (rtx x, enum machine_mode mem_mode, rtx insn,
/* ... fall through ... */
case INSN_LIST:
+ case INT_LIST:
/* Now do eliminations in the rest of the chain. If this was
an EXPR_LIST, this might result in allocating more memory than is
strictly needed, but it simplifies the code. */
diff --git a/gcc/reorg.c b/gcc/reorg.c
index d39cc7d8a4a..e9aa889b17d 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -876,7 +876,7 @@ mostly_true_jump (rtx jump_insn)
rtx note = find_reg_note (jump_insn, REG_BR_PROB, 0);
if (note)
{
- int prob = INTVAL (XEXP (note, 0));
+ int prob = XINT (note, 0);
if (prob >= REG_BR_PROB_BASE * 9 / 10)
return 2;
@@ -2173,7 +2173,7 @@ fill_simple_delay_slots (int non_jumps_p)
&& ! (maybe_never && may_trap_or_fault_p (pat))
&& (trial = try_split (pat, trial, 0))
&& eligible_for_delay (insn, slots_filled, trial, flags)
- && ! can_throw_internal(trial))
+ && ! can_throw_internal (trial))
{
next_trial = next_nonnote_insn (trial);
delay_list = add_to_delay_list (trial, delay_list);
@@ -2363,8 +2363,8 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
int flags;
/* Validate our arguments. */
- gcc_assert(condition != const_true_rtx || thread_if_true);
- gcc_assert(own_thread || thread_if_true);
+ gcc_assert (condition != const_true_rtx || thread_if_true);
+ gcc_assert (own_thread || thread_if_true);
flags = get_jump_flags (insn, JUMP_LABEL (insn));
@@ -3888,8 +3888,8 @@ const pass_data pass_data_delay_slots =
class pass_delay_slots : public rtl_opt_pass
{
public:
- pass_delay_slots(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_delay_slots, ctxt)
+ pass_delay_slots (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_delay_slots, ctxt)
{}
/* opt_pass methods: */
@@ -3941,8 +3941,8 @@ const pass_data pass_data_machine_reorg =
class pass_machine_reorg : public rtl_opt_pass
{
public:
- pass_machine_reorg(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_machine_reorg, ctxt)
+ pass_machine_reorg (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_machine_reorg, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/rtl.c b/gcc/rtl.c
index b2d88f783b7..52b7747b693 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -222,7 +222,7 @@ shared_const_p (const_rtx orig)
a LABEL_REF, it isn't sharable. */
return (GET_CODE (XEXP (orig, 0)) == PLUS
&& GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
- && CONST_INT_P(XEXP (XEXP (orig, 0), 1)));
+ && CONST_INT_P (XEXP (XEXP (orig, 0), 1)));
}
diff --git a/gcc/rtl.def b/gcc/rtl.def
index b4ce1b99f3f..15a997b8c25 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -95,13 +95,16 @@ DEF_RTL_EXPR(DEBUG_EXPR, "debug_expr", "0", RTX_OBJ)
Expressions used in constructing lists.
--------------------------------------------------------------------- */
-/* a linked list of expressions */
+/* A linked list of expressions. */
DEF_RTL_EXPR(EXPR_LIST, "expr_list", "ee", RTX_EXTRA)
-/* a linked list of instructions.
+/* A linked list of instructions.
The insns are represented in print by their uids. */
DEF_RTL_EXPR(INSN_LIST, "insn_list", "ue", RTX_EXTRA)
+/* A linked list of integers. */
+DEF_RTL_EXPR(INT_LIST, "int_list", "ie", RTX_EXTRA)
+
/* SEQUENCE is used in late passes of the compiler to group insns for
one reason or another.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index b5bfdffebc1..247a0d06701 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -544,7 +544,7 @@ struct GTY((variable_size)) rtvec_def {
if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
__FUNCTION__); \
- if (GET_RTX_FORMAT(_code)[_n] != C1) \
+ if (GET_RTX_FORMAT (_code)[_n] != C1) \
rtl_check_failed_type1 (_rtx, _n, C1, __FILE__, __LINE__, \
__FUNCTION__); \
&_rtx->u.fld[_n]; }))
@@ -555,8 +555,8 @@ struct GTY((variable_size)) rtvec_def {
if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
__FUNCTION__); \
- if (GET_RTX_FORMAT(_code)[_n] != C1 \
- && GET_RTX_FORMAT(_code)[_n] != C2) \
+ if (GET_RTX_FORMAT (_code)[_n] != C1 \
+ && GET_RTX_FORMAT (_code)[_n] != C2) \
rtl_check_failed_type2 (_rtx, _n, C1, C2, __FILE__, __LINE__, \
__FUNCTION__); \
&_rtx->u.fld[_n]; }))
@@ -589,7 +589,7 @@ struct GTY((variable_size)) rtvec_def {
if (_n < 0 || _n >= GET_RTX_LENGTH (_code)) \
rtl_check_failed_bounds (_rtx, _n, __FILE__, __LINE__, \
__FUNCTION__); \
- if (GET_RTX_FORMAT(_code)[_n] != 'w') \
+ if (GET_RTX_FORMAT (_code)[_n] != 'w') \
rtl_check_failed_type1 (_rtx, _n, 'w', __FILE__, __LINE__, \
__FUNCTION__); \
&_rtx->u.hwint[_n]; }))
@@ -679,39 +679,39 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
#if defined ENABLE_RTL_FLAG_CHECKING && (GCC_VERSION >= 2007)
#define RTL_FLAG_CHECK1(NAME, RTX, C1) __extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1) \
+ if (GET_CODE (_rtx) != C1) \
rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
#define RTL_FLAG_CHECK2(NAME, RTX, C1, C2) __extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2) \
rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
#define RTL_FLAG_CHECK3(NAME, RTX, C1, C2, C3) __extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
- && GET_CODE(_rtx) != C3) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
+ && GET_CODE (_rtx) != C3) \
rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
#define RTL_FLAG_CHECK4(NAME, RTX, C1, C2, C3, C4) __extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
- && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE(_rtx) != C2 \
+ && GET_CODE (_rtx) != C3 && GET_CODE(_rtx) != C4) \
rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
#define RTL_FLAG_CHECK5(NAME, RTX, C1, C2, C3, C4, C5) __extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
- && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
- && GET_CODE(_rtx) != C5) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
+ && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
+ && GET_CODE (_rtx) != C5) \
rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
@@ -719,9 +719,9 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
#define RTL_FLAG_CHECK6(NAME, RTX, C1, C2, C3, C4, C5, C6) \
__extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
- && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
- && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
+ && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
+ && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6) \
rtl_check_failed_flag (NAME,_rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
@@ -729,10 +729,10 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
#define RTL_FLAG_CHECK7(NAME, RTX, C1, C2, C3, C4, C5, C6, C7) \
__extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
- && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
- && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6 \
- && GET_CODE(_rtx) != C7) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
+ && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
+ && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
+ && GET_CODE (_rtx) != C7) \
rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
@@ -740,10 +740,10 @@ extern void rtvec_check_failed_bounds (const_rtvec, int, const char *, int,
#define RTL_FLAG_CHECK8(NAME, RTX, C1, C2, C3, C4, C5, C6, C7, C8) \
__extension__ \
({ __typeof (RTX) const _rtx = (RTX); \
- if (GET_CODE(_rtx) != C1 && GET_CODE(_rtx) != C2 \
- && GET_CODE(_rtx) != C3 && GET_CODE(_rtx) != C4 \
- && GET_CODE(_rtx) != C5 && GET_CODE(_rtx) != C6 \
- && GET_CODE(_rtx) != C7 && GET_CODE(_rtx) != C8) \
+ if (GET_CODE (_rtx) != C1 && GET_CODE (_rtx) != C2 \
+ && GET_CODE (_rtx) != C3 && GET_CODE (_rtx) != C4 \
+ && GET_CODE (_rtx) != C5 && GET_CODE (_rtx) != C6 \
+ && GET_CODE (_rtx) != C7 && GET_CODE (_rtx) != C8) \
rtl_check_failed_flag (NAME, _rtx, __FILE__, __LINE__, \
__FUNCTION__); \
_rtx; })
@@ -844,56 +844,57 @@ extern void rtl_check_failed_flag (const char *, const_rtx, const char *,
#define INSN_CODE(INSN) XINT (INSN, 6)
#define RTX_FRAME_RELATED_P(RTX) \
- (RTL_FLAG_CHECK6("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
- CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
+ (RTL_FLAG_CHECK6 ("RTX_FRAME_RELATED_P", (RTX), DEBUG_INSN, INSN, \
+ CALL_INSN, JUMP_INSN, BARRIER, SET)->frame_related)
/* 1 if RTX is an insn that has been deleted. */
#define INSN_DELETED_P(RTX) \
- (RTL_FLAG_CHECK8("INSN_DELETED_P", (RTX), DEBUG_INSN, INSN, \
- CALL_INSN, JUMP_INSN, JUMP_TABLE_DATA, \
- CODE_LABEL, BARRIER, NOTE)->volatil)
+ (RTL_FLAG_CHECK8 ("INSN_DELETED_P", (RTX), DEBUG_INSN, INSN, \
+ CALL_INSN, JUMP_INSN, JUMP_TABLE_DATA, \
+ CODE_LABEL, BARRIER, NOTE)->volatil)
/* 1 if RTX is a call to a const function. Built from ECF_CONST and
TREE_READONLY. */
#define RTL_CONST_CALL_P(RTX) \
- (RTL_FLAG_CHECK1("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
+ (RTL_FLAG_CHECK1 ("RTL_CONST_CALL_P", (RTX), CALL_INSN)->unchanging)
/* 1 if RTX is a call to a pure function. Built from ECF_PURE and
DECL_PURE_P. */
#define RTL_PURE_CALL_P(RTX) \
- (RTL_FLAG_CHECK1("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
+ (RTL_FLAG_CHECK1 ("RTL_PURE_CALL_P", (RTX), CALL_INSN)->return_val)
/* 1 if RTX is a call to a const or pure function. */
#define RTL_CONST_OR_PURE_CALL_P(RTX) \
- (RTL_CONST_CALL_P(RTX) || RTL_PURE_CALL_P(RTX))
+ (RTL_CONST_CALL_P (RTX) || RTL_PURE_CALL_P (RTX))
/* 1 if RTX is a call to a looping const or pure function. Built from
ECF_LOOPING_CONST_OR_PURE and DECL_LOOPING_CONST_OR_PURE_P. */
#define RTL_LOOPING_CONST_OR_PURE_CALL_P(RTX) \
- (RTL_FLAG_CHECK1("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
+ (RTL_FLAG_CHECK1 ("CONST_OR_PURE_CALL_P", (RTX), CALL_INSN)->call)
/* 1 if RTX is a call_insn for a sibling call. */
#define SIBLING_CALL_P(RTX) \
- (RTL_FLAG_CHECK1("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
+ (RTL_FLAG_CHECK1 ("SIBLING_CALL_P", (RTX), CALL_INSN)->jump)
/* 1 if RTX is a jump_insn, call_insn, or insn that is an annulling branch. */
#define INSN_ANNULLED_BRANCH_P(RTX) \
- (RTL_FLAG_CHECK1("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
+ (RTL_FLAG_CHECK1 ("INSN_ANNULLED_BRANCH_P", (RTX), JUMP_INSN)->unchanging)
/* 1 if RTX is an insn in a delay slot and is from the target of the branch.
If the branch insn has INSN_ANNULLED_BRANCH_P set, this insn should only be
executed if the branch is taken. For annulled branches with this bit
clear, the insn should be executed only if the branch is not taken. */
#define INSN_FROM_TARGET_P(RTX) \
- (RTL_FLAG_CHECK3("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, CALL_INSN)->in_struct)
+ (RTL_FLAG_CHECK3 ("INSN_FROM_TARGET_P", (RTX), INSN, JUMP_INSN, \
+ CALL_INSN)->in_struct)
/* In an ADDR_DIFF_VEC, the flags for RTX for use by branch shortening.
See the comments for ADDR_DIFF_VEC in rtl.def. */
-#define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS(RTX, 4)
+#define ADDR_DIFF_VEC_FLAGS(RTX) X0ADVFLAGS (RTX, 4)
/* In a VALUE, the value cselib has assigned to RTX.
This is a "struct cselib_val_struct", see cselib.h. */
-#define CSELIB_VAL_PTR(RTX) X0CSELIB(RTX, 0)
+#define CSELIB_VAL_PTR(RTX) X0CSELIB (RTX, 0)
/* Holds a list of notes on what this insn does to various REGs.
It is a chain of EXPR_LIST rtx's, where the second operand is the
@@ -1003,7 +1004,7 @@ extern const char * const reg_note_name[];
/* 1 if RTX is emitted after a call, but it should take effect before
the call returns. */
#define NOTE_DURING_CALL_P(RTX) \
- (RTL_FLAG_CHECK1("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
+ (RTL_FLAG_CHECK1 ("NOTE_VAR_LOCATION_DURING_CALL_P", (RTX), NOTE)->call)
/* DEBUG_EXPR_DECL corresponding to a DEBUG_EXPR RTX. */
#define DEBUG_EXPR_TREE_DECL(RTX) XCTREE (RTX, 0, DEBUG_EXPR)
@@ -1109,7 +1110,8 @@ enum label_kind
/* For a REG rtx, REGNO extracts the register number. REGNO can only
be used on RHS. Use SET_REGNO to change the value. */
#define REGNO(RTX) (rhs_regno(RTX))
-#define SET_REGNO(RTX,N) (df_ref_change_reg_with_loc (REGNO(RTX), N, RTX), XCUINT (RTX, 0, REG) = N)
+#define SET_REGNO(RTX,N) \
+ (df_ref_change_reg_with_loc (REGNO (RTX), N, RTX), XCUINT (RTX, 0, REG) = N)
#define SET_REGNO_RAW(RTX,N) (XCUINT (RTX, 0, REG) = N)
/* ORIGINAL_REGNO holds the number the register originally had; for a
@@ -1128,19 +1130,19 @@ rhs_regno (const_rtx x)
/* 1 if RTX is a reg or parallel that is the current function's return
value. */
#define REG_FUNCTION_VALUE_P(RTX) \
- (RTL_FLAG_CHECK2("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
+ (RTL_FLAG_CHECK2 ("REG_FUNCTION_VALUE_P", (RTX), REG, PARALLEL)->return_val)
/* 1 if RTX is a reg that corresponds to a variable declared by the user. */
#define REG_USERVAR_P(RTX) \
- (RTL_FLAG_CHECK1("REG_USERVAR_P", (RTX), REG)->volatil)
+ (RTL_FLAG_CHECK1 ("REG_USERVAR_P", (RTX), REG)->volatil)
/* 1 if RTX is a reg that holds a pointer value. */
#define REG_POINTER(RTX) \
- (RTL_FLAG_CHECK1("REG_POINTER", (RTX), REG)->frame_related)
+ (RTL_FLAG_CHECK1 ("REG_POINTER", (RTX), REG)->frame_related)
/* 1 if RTX is a mem that holds a pointer value. */
#define MEM_POINTER(RTX) \
- (RTL_FLAG_CHECK1("MEM_POINTER", (RTX), MEM)->frame_related)
+ (RTL_FLAG_CHECK1 ("MEM_POINTER", (RTX), MEM)->frame_related)
/* 1 if the given register REG corresponds to a hard register. */
#define HARD_REGISTER_P(REG) (HARD_REGISTER_NUM_P (REGNO (REG)))
@@ -1149,7 +1151,7 @@ rhs_regno (const_rtx x)
#define HARD_REGISTER_NUM_P(REG_NO) ((REG_NO) < FIRST_PSEUDO_REGISTER)
/* For a CONST_INT rtx, INTVAL extracts the integer. */
-#define INTVAL(RTX) XCWINT(RTX, 0, CONST_INT)
+#define INTVAL(RTX) XCWINT (RTX, 0, CONST_INT)
#define UINTVAL(RTX) ((unsigned HOST_WIDE_INT) INTVAL (RTX))
/* For a CONST_DOUBLE:
@@ -1165,9 +1167,9 @@ rhs_regno (const_rtx x)
#define CONST_FIXED_VALUE(r) \
((const struct fixed_value *) XCNMPFV (r, CONST_FIXED, VOIDmode))
#define CONST_FIXED_VALUE_HIGH(r) \
- ((HOST_WIDE_INT) (CONST_FIXED_VALUE(r)->data.high))
+ ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.high))
#define CONST_FIXED_VALUE_LOW(r) \
- ((HOST_WIDE_INT) (CONST_FIXED_VALUE(r)->data.low))
+ ((HOST_WIDE_INT) (CONST_FIXED_VALUE (r)->data.low))
/* For a CONST_VECTOR, return element #n. */
#define CONST_VECTOR_ELT(RTX, N) XCVECEXP (RTX, 0, N, CONST_VECTOR)
@@ -1387,11 +1389,12 @@ get_full_set_src_cost (rtx x, struct full_rtx_costs *c)
when assigning to SUBREG_REG. */
#define SUBREG_PROMOTED_VAR_P(RTX) \
- (RTL_FLAG_CHECK1("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
+ (RTL_FLAG_CHECK1 ("SUBREG_PROMOTED", (RTX), SUBREG)->in_struct)
#define SUBREG_PROMOTED_UNSIGNED_SET(RTX, VAL) \
do { \
- rtx const _rtx = RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_SET", (RTX), SUBREG); \
+ rtx const _rtx = RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_SET", \
+ (RTX), SUBREG); \
if ((VAL) < 0) \
_rtx->volatil = 1; \
else { \
@@ -1409,13 +1412,13 @@ do { \
emit special code (ptr_extend insns) on some architectures. */
#define SUBREG_PROMOTED_UNSIGNED_P(RTX) \
- ((RTL_FLAG_CHECK1("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
+ ((RTL_FLAG_CHECK1 ("SUBREG_PROMOTED_UNSIGNED_P", (RTX), SUBREG)->volatil) \
? -1 : (int) (RTX)->unchanging)
/* True if the subreg was generated by LRA for reload insns. Such
subregs are valid only during LRA. */
#define LRA_SUBREG_P(RTX) \
- (RTL_FLAG_CHECK1("LRA_SUBREG_P", (RTX), SUBREG)->jump)
+ (RTL_FLAG_CHECK1 ("LRA_SUBREG_P", (RTX), SUBREG)->jump)
/* Access various components of an ASM_OPERANDS rtx. */
@@ -1440,22 +1443,22 @@ do { \
/* 1 if RTX is a mem that is statically allocated in read-only memory. */
#define MEM_READONLY_P(RTX) \
- (RTL_FLAG_CHECK1("MEM_READONLY_P", (RTX), MEM)->unchanging)
+ (RTL_FLAG_CHECK1 ("MEM_READONLY_P", (RTX), MEM)->unchanging)
/* 1 if RTX is a mem and we should keep the alias set for this mem
unchanged when we access a component. Set to 1, or example, when we
are already in a non-addressable component of an aggregate. */
#define MEM_KEEP_ALIAS_SET_P(RTX) \
- (RTL_FLAG_CHECK1("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
+ (RTL_FLAG_CHECK1 ("MEM_KEEP_ALIAS_SET_P", (RTX), MEM)->jump)
/* 1 if RTX is a mem or asm_operand for a volatile reference. */
#define MEM_VOLATILE_P(RTX) \
- (RTL_FLAG_CHECK3("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
- ASM_INPUT)->volatil)
+ (RTL_FLAG_CHECK3 ("MEM_VOLATILE_P", (RTX), MEM, ASM_OPERANDS, \
+ ASM_INPUT)->volatil)
/* 1 if RTX is a mem that cannot trap. */
#define MEM_NOTRAP_P(RTX) \
- (RTL_FLAG_CHECK1("MEM_NOTRAP_P", (RTX), MEM)->call)
+ (RTL_FLAG_CHECK1 ("MEM_NOTRAP_P", (RTX), MEM)->call)
/* The memory attribute block. We provide access macros for each value
in the block and provide defaults if none specified. */
@@ -1521,25 +1524,24 @@ do { \
/* Likewise in an expr_list for a REG_LABEL_OPERAND or
REG_LABEL_TARGET note. */
#define LABEL_REF_NONLOCAL_P(RTX) \
- (RTL_FLAG_CHECK1("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
+ (RTL_FLAG_CHECK1 ("LABEL_REF_NONLOCAL_P", (RTX), LABEL_REF)->volatil)
/* 1 if RTX is a code_label that should always be considered to be needed. */
#define LABEL_PRESERVE_P(RTX) \
- (RTL_FLAG_CHECK2("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
+ (RTL_FLAG_CHECK2 ("LABEL_PRESERVE_P", (RTX), CODE_LABEL, NOTE)->in_struct)
/* During sched, 1 if RTX is an insn that must be scheduled together
with the preceding insn. */
#define SCHED_GROUP_P(RTX) \
- (RTL_FLAG_CHECK4("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
- JUMP_INSN, CALL_INSN \
- )->in_struct)
+ (RTL_FLAG_CHECK4 ("SCHED_GROUP_P", (RTX), DEBUG_INSN, INSN, \
+ JUMP_INSN, CALL_INSN)->in_struct)
/* For a SET rtx, SET_DEST is the place that is set
and SET_SRC is the value it is set to. */
-#define SET_DEST(RTX) XC2EXP(RTX, 0, SET, CLOBBER)
-#define SET_SRC(RTX) XCEXP(RTX, 1, SET)
+#define SET_DEST(RTX) XC2EXP (RTX, 0, SET, CLOBBER)
+#define SET_SRC(RTX) XCEXP (RTX, 1, SET)
#define SET_IS_RETURN_P(RTX) \
- (RTL_FLAG_CHECK1("SET_IS_RETURN_P", (RTX), SET)->jump)
+ (RTL_FLAG_CHECK1 ("SET_IS_RETURN_P", (RTX), SET)->jump)
/* For a TRAP_IF rtx, TRAP_CONDITION is an expression. */
#define TRAP_CONDITION(RTX) XCEXP (RTX, 0, TRAP_IF)
@@ -1554,26 +1556,26 @@ do { \
/* 1 if RTX is a symbol_ref that addresses this function's rtl
constants pool. */
#define CONSTANT_POOL_ADDRESS_P(RTX) \
- (RTL_FLAG_CHECK1("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
+ (RTL_FLAG_CHECK1 ("CONSTANT_POOL_ADDRESS_P", (RTX), SYMBOL_REF)->unchanging)
/* 1 if RTX is a symbol_ref that addresses a value in the file's
tree constant pool. This information is private to varasm.c. */
#define TREE_CONSTANT_POOL_ADDRESS_P(RTX) \
- (RTL_FLAG_CHECK1("TREE_CONSTANT_POOL_ADDRESS_P", \
- (RTX), SYMBOL_REF)->frame_related)
+ (RTL_FLAG_CHECK1 ("TREE_CONSTANT_POOL_ADDRESS_P", \
+ (RTX), SYMBOL_REF)->frame_related)
/* Used if RTX is a symbol_ref, for machine-specific purposes. */
#define SYMBOL_REF_FLAG(RTX) \
- (RTL_FLAG_CHECK1("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
+ (RTL_FLAG_CHECK1 ("SYMBOL_REF_FLAG", (RTX), SYMBOL_REF)->volatil)
/* 1 if RTX is a symbol_ref that has been the library function in
emit_library_call. */
#define SYMBOL_REF_USED(RTX) \
- (RTL_FLAG_CHECK1("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
+ (RTL_FLAG_CHECK1 ("SYMBOL_REF_USED", (RTX), SYMBOL_REF)->used)
/* 1 if RTX is a symbol_ref for a weak symbol. */
#define SYMBOL_REF_WEAK(RTX) \
- (RTL_FLAG_CHECK1("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
+ (RTL_FLAG_CHECK1 ("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->return_val)
/* A pointer attached to the SYMBOL_REF; either SYMBOL_REF_DECL or
SYMBOL_REF_CONSTANT. */
@@ -1656,7 +1658,7 @@ do { \
/* True if RTX is flagged to be a scheduling barrier. */
#define PREFETCH_SCHEDULE_BARRIER_P(RTX) \
- (RTL_FLAG_CHECK1("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
+ (RTL_FLAG_CHECK1 ("PREFETCH_SCHEDULE_BARRIER_P", (RTX), PREFETCH)->volatil)
/* Indicate whether the machine has any sort of auto increment addressing.
If not, we can avoid checking for REG_INC notes. */
@@ -2055,6 +2057,8 @@ extern int find_reg_fusage (const_rtx, enum rtx_code, const_rtx);
extern int find_regno_fusage (const_rtx, enum rtx_code, unsigned int);
extern rtx alloc_reg_note (enum reg_note, rtx, rtx);
extern void add_reg_note (rtx, enum reg_note, rtx);
+extern void add_int_reg_note (rtx, enum reg_note, int);
+extern void add_shallow_copy_of_reg_note (rtx, rtx);
extern void remove_note (rtx, const_rtx);
extern void remove_reg_equal_equiv_notes (rtx);
extern void remove_reg_equal_equiv_notes_for_regno (unsigned int);
@@ -2070,7 +2074,7 @@ extern bool insn_could_throw_p (const_rtx);
extern bool insn_nothrow_p (const_rtx);
extern bool can_nonlocal_goto (const_rtx);
extern void copy_reg_eh_region_note_forward (rtx, rtx, rtx);
-extern void copy_reg_eh_region_note_backward(rtx, rtx, rtx);
+extern void copy_reg_eh_region_note_backward (rtx, rtx, rtx);
extern int inequality_comparisons_p (const_rtx);
extern rtx replace_rtx (rtx, rtx, rtx);
extern int replace_label (rtx *, void *);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index c15037e9645..9769b69bdb5 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1923,6 +1923,14 @@ find_regno_fusage (const_rtx insn, enum rtx_code code, unsigned int regno)
}
+/* Return true if KIND is an integer REG_NOTE. */
+
+static bool
+int_reg_note_p (enum reg_note kind)
+{
+ return kind == REG_BR_PROB;
+}
+
/* Allocate a register note with kind KIND and datum DATUM. LIST is
stored as the pointer to the next register note. */
@@ -1931,6 +1939,7 @@ alloc_reg_note (enum reg_note kind, rtx datum, rtx list)
{
rtx note;
+ gcc_checking_assert (!int_reg_note_p (kind));
switch (kind)
{
case REG_CC_SETTER:
@@ -1961,6 +1970,27 @@ add_reg_note (rtx insn, enum reg_note kind, rtx datum)
REG_NOTES (insn) = alloc_reg_note (kind, datum, REG_NOTES (insn));
}
+/* Add an integer register note with kind KIND and datum DATUM to INSN. */
+
+void
+add_int_reg_note (rtx insn, enum reg_note kind, int datum)
+{
+ gcc_checking_assert (int_reg_note_p (kind));
+ REG_NOTES (insn) = gen_rtx_INT_LIST ((enum machine_mode) kind,
+ datum, REG_NOTES (insn));
+}
+
+/* Add a register note like NOTE to INSN. */
+
+void
+add_shallow_copy_of_reg_note (rtx insn, rtx note)
+{
+ if (GET_CODE (note) == INT_LIST)
+ add_int_reg_note (insn, REG_NOTE_KIND (note), XINT (note, 0));
+ else
+ add_reg_note (insn, REG_NOTE_KIND (note), XEXP (note, 0));
+}
+
/* Remove register note NOTE from the REG_NOTES of INSN. */
void
@@ -3683,7 +3713,7 @@ keep_with_call_p (const_rtx insn)
/* This CONST_CAST is okay because next_nonnote_insn just
returns its argument and we assign it to a const_rtx
variable. */
- const_rtx i2 = next_nonnote_insn (CONST_CAST_RTX(insn));
+ const_rtx i2 = next_nonnote_insn (CONST_CAST_RTX (insn));
if (i2 && keep_with_call_p (i2))
return true;
}
@@ -5437,12 +5467,29 @@ split_double (rtx value, rtx *first, rtx *second)
}
}
+/* Return true if X is a sign_extract or zero_extract from the least
+ significant bit. */
+
+static bool
+lsb_bitfield_op_p (rtx x)
+{
+ if (GET_RTX_CLASS (GET_CODE (x)) == RTX_BITFIELD_OPS)
+ {
+ enum machine_mode mode = GET_MODE (XEXP (x, 0));
+ HOST_WIDE_INT len = INTVAL (XEXP (x, 1));
+ HOST_WIDE_INT pos = INTVAL (XEXP (x, 2));
+
+ return (pos == (BITS_BIG_ENDIAN ? GET_MODE_PRECISION (mode) - len : 0));
+ }
+ return false;
+}
+
/* Strip outer address "mutations" from LOC and return a pointer to the
inner value. If OUTER_CODE is nonnull, store the code of the innermost
stripped expression there.
"Mutations" either convert between modes or apply some kind of
- alignment. */
+ extension, truncation or alignment. */
rtx *
strip_address_mutations (rtx *loc, enum rtx_code *outer_code)
@@ -5454,6 +5501,10 @@ strip_address_mutations (rtx *loc, enum rtx_code *outer_code)
/* Things like SIGN_EXTEND, ZERO_EXTEND and TRUNCATE can be
used to convert between pointer sizes. */
loc = &XEXP (*loc, 0);
+ else if (lsb_bitfield_op_p (*loc))
+ /* A [SIGN|ZERO]_EXTRACT from the least significant bit effectively
+ acts as a combined truncation and extension. */
+ loc = &XEXP (*loc, 0);
else if (code == AND && CONST_INT_P (XEXP (*loc, 1)))
/* (and ... (const_int -X)) is used to align to X bytes. */
loc = &XEXP (*loc, 0);
@@ -5470,20 +5521,50 @@ strip_address_mutations (rtx *loc, enum rtx_code *outer_code)
}
}
-/* Return true if X must be a base rather than an index. */
+/* Return true if CODE applies some kind of scale. The scaled value is
+ is the first operand and the scale is the second. */
static bool
-must_be_base_p (rtx x)
+binary_scale_code_p (enum rtx_code code)
{
- return GET_CODE (x) == LO_SUM;
+ return (code == MULT
+ || code == ASHIFT
+ /* Needed by ARM targets. */
+ || code == ASHIFTRT
+ || code == LSHIFTRT
+ || code == ROTATE
+ || code == ROTATERT);
}
-/* Return true if X must be an index rather than a base. */
+/* If *INNER can be interpreted as a base, return a pointer to the inner term
+ (see address_info). Return null otherwise. */
-static bool
-must_be_index_p (rtx x)
+static rtx *
+get_base_term (rtx *inner)
+{
+ if (GET_CODE (*inner) == LO_SUM)
+ inner = strip_address_mutations (&XEXP (*inner, 0));
+ if (REG_P (*inner)
+ || MEM_P (*inner)
+ || GET_CODE (*inner) == SUBREG)
+ return inner;
+ return 0;
+}
+
+/* If *INNER can be interpreted as an index, return a pointer to the inner term
+ (see address_info). Return null otherwise. */
+
+static rtx *
+get_index_term (rtx *inner)
{
- return GET_CODE (x) == MULT || GET_CODE (x) == ASHIFT;
+ /* At present, only constant scales are allowed. */
+ if (binary_scale_code_p (GET_CODE (*inner)) && CONSTANT_P (XEXP (*inner, 1)))
+ inner = strip_address_mutations (&XEXP (*inner, 0));
+ if (REG_P (*inner)
+ || MEM_P (*inner)
+ || GET_CODE (*inner) == SUBREG)
+ return inner;
+ return 0;
}
/* Set the segment part of address INFO to LOC, given that INNER is the
@@ -5492,8 +5573,6 @@ must_be_index_p (rtx x)
static void
set_address_segment (struct address_info *info, rtx *loc, rtx *inner)
{
- gcc_checking_assert (GET_CODE (*inner) == UNSPEC);
-
gcc_assert (!info->segment);
info->segment = loc;
info->segment_term = inner;
@@ -5505,12 +5584,6 @@ set_address_segment (struct address_info *info, rtx *loc, rtx *inner)
static void
set_address_base (struct address_info *info, rtx *loc, rtx *inner)
{
- if (GET_CODE (*inner) == LO_SUM)
- inner = strip_address_mutations (&XEXP (*inner, 0));
- gcc_checking_assert (REG_P (*inner)
- || MEM_P (*inner)
- || GET_CODE (*inner) == SUBREG);
-
gcc_assert (!info->base);
info->base = loc;
info->base_term = inner;
@@ -5522,13 +5595,6 @@ set_address_base (struct address_info *info, rtx *loc, rtx *inner)
static void
set_address_index (struct address_info *info, rtx *loc, rtx *inner)
{
- if ((GET_CODE (*inner) == MULT || GET_CODE (*inner) == ASHIFT)
- && CONSTANT_P (XEXP (*inner, 1)))
- inner = strip_address_mutations (&XEXP (*inner, 0));
- gcc_checking_assert (REG_P (*inner)
- || MEM_P (*inner)
- || GET_CODE (*inner) == SUBREG);
-
gcc_assert (!info->index);
info->index = loc;
info->index_term = inner;
@@ -5540,8 +5606,6 @@ set_address_index (struct address_info *info, rtx *loc, rtx *inner)
static void
set_address_disp (struct address_info *info, rtx *loc, rtx *inner)
{
- gcc_checking_assert (CONSTANT_P (*inner));
-
gcc_assert (!info->disp);
info->disp = loc;
info->disp_term = inner;
@@ -5621,12 +5685,6 @@ static int
baseness (rtx x, enum machine_mode mode, addr_space_t as,
enum rtx_code outer_code, enum rtx_code index_code)
{
- /* See whether we can be certain. */
- if (must_be_base_p (x))
- return 3;
- if (must_be_index_p (x))
- return -3;
-
/* Believe *_POINTER unless the address shape requires otherwise. */
if (REG_P (x) && REG_POINTER (x))
return 2;
@@ -5661,8 +5719,8 @@ decompose_normal_address (struct address_info *info)
if (n_ops > 1)
info->base_outer_code = PLUS;
- /* Separate the parts that contain a REG or MEM from those that don't.
- Record the latter in INFO and leave the former in OPS. */
+ /* Try to classify each sum operand now. Leave those that could be
+ either a base or an index in OPS. */
rtx *inner_ops[4];
size_t out = 0;
for (size_t in = 0; in < n_ops; ++in)
@@ -5675,18 +5733,31 @@ decompose_normal_address (struct address_info *info)
set_address_segment (info, loc, inner);
else
{
- ops[out] = loc;
- inner_ops[out] = inner;
- ++out;
+ /* The only other possibilities are a base or an index. */
+ rtx *base_term = get_base_term (inner);
+ rtx *index_term = get_index_term (inner);
+ gcc_assert (base_term || index_term);
+ if (!base_term)
+ set_address_index (info, loc, index_term);
+ else if (!index_term)
+ set_address_base (info, loc, base_term);
+ else
+ {
+ gcc_assert (base_term == index_term);
+ ops[out] = loc;
+ inner_ops[out] = base_term;
+ ++out;
+ }
}
}
/* Classify the remaining OPS members as bases and indexes. */
if (out == 1)
{
- /* Assume that the remaining value is a base unless the shape
- requires otherwise. */
- if (!must_be_index_p (*inner_ops[0]))
+ /* If we haven't seen a base or an index yet, assume that this is
+ the base. If we were confident that another term was the base
+ or index, treat the remaining operand as the other kind. */
+ if (!info->base)
set_address_base (info, ops[0], inner_ops[0]);
else
set_address_index (info, ops[0], inner_ops[0]);
diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c
index bc77d43a617..ceadd09edda 100644
--- a/gcc/sbitmap.c
+++ b/gcc/sbitmap.c
@@ -30,15 +30,15 @@ along with GCC; see the file COPYING3. If not see
#if GCC_VERSION >= 3400
# if SBITMAP_ELT_BITS == HOST_BITS_PER_LONG
-# define do_popcount(x) __builtin_popcountl(x)
+# define do_popcount(x) __builtin_popcountl (x)
# elif SBITMAP_ELT_BITS == HOST_BITS_PER_LONGLONG
-# define do_popcount(x) __builtin_popcountll(x)
+# define do_popcount(x) __builtin_popcountll (x)
# else
# error "internal error: sbitmap.h and hwint.h are inconsistent"
# endif
#else
static unsigned long sbitmap_elt_popcount (SBITMAP_ELT_TYPE);
-# define do_popcount(x) sbitmap_elt_popcount((x))
+# define do_popcount(x) sbitmap_elt_popcount (x)
#endif
typedef SBITMAP_ELT_TYPE *sbitmap_ptr;
diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c
index e1a2dce16a2..bf9b10df3a9 100644
--- a/gcc/sched-rgn.c
+++ b/gcc/sched-rgn.c
@@ -3638,8 +3638,8 @@ const pass_data pass_data_sched =
class pass_sched : public rtl_opt_pass
{
public:
- pass_sched(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_sched, ctxt)
+ pass_sched (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_sched, ctxt)
{}
/* opt_pass methods: */
@@ -3677,8 +3677,8 @@ const pass_data pass_data_sched2 =
class pass_sched2 : public rtl_opt_pass
{
public:
- pass_sched2(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_sched2, ctxt)
+ pass_sched2 (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_sched2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index eb2410cbc4f..a965c4d54d6 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -751,7 +751,10 @@ print_insn_with_notes (pretty_printer *pp, const_rtx x)
{
pp_printf (pp, "%s %s ", print_rtx_head,
GET_REG_NOTE_NAME (REG_NOTE_KIND (note)));
- print_pattern (pp, XEXP (note, 0), 1);
+ if (GET_CODE (note) == INT_LIST)
+ pp_printf (pp, "%d", XINT (note, 0));
+ else
+ print_pattern (pp, XEXP (note, 0), 1);
pp_newline (pp);
}
}
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 13c11c29682..1eedde3f520 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -155,7 +155,7 @@ static void sdbout_global_decl (tree);
#endif
#ifndef PUT_SDB_SCL
-#define PUT_SDB_SCL(a) fprintf(asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
+#define PUT_SDB_SCL(a) fprintf (asm_out_file, "\t.scl\t%d%s", (a), SDB_DELIM)
#endif
#ifndef PUT_SDB_INT_VAL
@@ -182,15 +182,16 @@ do { fprintf (asm_out_file, "\t.def\t"); \
#endif
#ifndef PUT_SDB_PLAIN_DEF
-#define PUT_SDB_PLAIN_DEF(a) fprintf(asm_out_file,"\t.def\t.%s%s",a, SDB_DELIM)
+#define PUT_SDB_PLAIN_DEF(a) \
+ fprintf (asm_out_file, "\t.def\t.%s%s", a, SDB_DELIM)
#endif
#ifndef PUT_SDB_ENDEF
-#define PUT_SDB_ENDEF fputs("\t.endef\n", asm_out_file)
+#define PUT_SDB_ENDEF fputs ("\t.endef\n", asm_out_file)
#endif
#ifndef PUT_SDB_TYPE
-#define PUT_SDB_TYPE(a) fprintf(asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
+#define PUT_SDB_TYPE(a) fprintf (asm_out_file, "\t.type\t0%o%s", a, SDB_DELIM)
#endif
#ifndef PUT_SDB_SIZE
@@ -198,19 +199,19 @@ do { fprintf (asm_out_file, "\t.def\t"); \
do { \
fprintf (asm_out_file, "\t.size\t" HOST_WIDE_INT_PRINT_DEC "%s", \
(HOST_WIDE_INT) (a), SDB_DELIM); \
- } while(0)
+ } while (0)
#endif
#ifndef PUT_SDB_START_DIM
-#define PUT_SDB_START_DIM fprintf(asm_out_file, "\t.dim\t")
+#define PUT_SDB_START_DIM fprintf (asm_out_file, "\t.dim\t")
#endif
#ifndef PUT_SDB_NEXT_DIM
-#define PUT_SDB_NEXT_DIM(a) fprintf(asm_out_file, "%d,", a)
+#define PUT_SDB_NEXT_DIM(a) fprintf (asm_out_file, "%d,", a)
#endif
#ifndef PUT_SDB_LAST_DIM
-#define PUT_SDB_LAST_DIM(a) fprintf(asm_out_file, "%d%s", a, SDB_DELIM)
+#define PUT_SDB_LAST_DIM(a) fprintf (asm_out_file, "%d%s", a, SDB_DELIM)
#endif
#ifndef PUT_SDB_TAG
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 47e769534db..4eb27c5da5d 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -4881,7 +4881,7 @@ in_same_ebb_p (insn_t insn, insn_t succ)
{
basic_block ptr = BLOCK_FOR_INSN (insn);
- for(;;)
+ for (;;)
{
if (ptr == BLOCK_FOR_INSN (succ))
return true;
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 46c66b4f3ed..08fdc772292 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -509,12 +509,12 @@ typedef vec<vinsn_t> vinsn_vec_t;
can't be moved up due to bookkeeping created during code motion to another
fence. See comment near the call to update_and_record_unavailable_insns
for the detailed explanations. */
-static vinsn_vec_t vec_bookkeeping_blocked_vinsns = vinsn_vec_t();
+static vinsn_vec_t vec_bookkeeping_blocked_vinsns = vinsn_vec_t ();
/* This vector has vinsns which are scheduled with renaming on the first fence
and then seen on the second. For expressions with such vinsns, target
availability information may be wrong. */
-static vinsn_vec_t vec_target_unavailable_vinsns = vinsn_vec_t();
+static vinsn_vec_t vec_target_unavailable_vinsns = vinsn_vec_t ();
/* Vector to store temporary nops inserted in move_op to prevent removal
of empty bbs. */
@@ -809,7 +809,7 @@ count_occurrences_1 (rtx *cur_rtx, void *arg)
/* Bail out if mode is different or more than one register is used. */
if (GET_MODE (*cur_rtx) != GET_MODE (p->x)
|| (HARD_REGISTER_P (*cur_rtx)
- && hard_regno_nregs[REGNO(*cur_rtx)][GET_MODE (*cur_rtx)] > 1))
+ && hard_regno_nregs[REGNO (*cur_rtx)][GET_MODE (*cur_rtx)] > 1))
{
p->n = 0;
return 1;
diff --git a/gcc/sese.c b/gcc/sese.c
index 10ccee274fb..d5ffa25bbb9 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "hash-table.h"
#include "tree-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "tree-data-ref.h"
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 9ec41a5dbd4..432842ecf0b 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -825,7 +825,8 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
/* Similarly, (not (neg X)) is (plus X -1). */
if (GET_CODE (op) == NEG)
- return plus_constant (mode, XEXP (op, 0), -1);
+ return simplify_gen_binary (PLUS, mode, XEXP (op, 0),
+ CONSTM1_RTX (mode));
/* (not (xor X C)) for C constant is (xor X D) with D = ~C. */
if (GET_CODE (op) == XOR
@@ -932,7 +933,8 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
/* Similarly, (neg (not X)) is (plus X 1). */
if (GET_CODE (op) == NOT)
- return plus_constant (mode, XEXP (op, 0), 1);
+ return simplify_gen_binary (PLUS, mode, XEXP (op, 0),
+ CONST1_RTX (mode));
/* (neg (minus X Y)) can become (minus Y X). This transformation
isn't safe for modes with signed zeros, since if X and Y are
diff --git a/gcc/sparseset.c b/gcc/sparseset.c
index 3c25a6de355..279c22bf72b 100644
--- a/gcc/sparseset.c
+++ b/gcc/sparseset.c
@@ -30,7 +30,7 @@ sparseset_alloc (SPARSESET_ELT_TYPE n_elms)
unsigned int n_bytes = sizeof (struct sparseset_def)
+ ((n_elms - 1) * 2 * sizeof (SPARSESET_ELT_TYPE));
- sparseset set = XNEWVAR(struct sparseset_def, n_bytes);
+ sparseset set = XNEWVAR (struct sparseset_def, n_bytes);
/* Mark the sparseset as defined to silence some valgrind uninitialized
read errors when accessing set->sparse[n] when "n" is not, and never has
diff --git a/gcc/stack-ptr-mod.c b/gcc/stack-ptr-mod.c
index 737a07f5727..68ccd1619ed 100644
--- a/gcc/stack-ptr-mod.c
+++ b/gcc/stack-ptr-mod.c
@@ -110,8 +110,8 @@ const pass_data pass_data_stack_ptr_mod =
class pass_stack_ptr_mod : public rtl_opt_pass
{
public:
- pass_stack_ptr_mod(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_stack_ptr_mod, ctxt)
+ pass_stack_ptr_mod (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_stack_ptr_mod, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/statistics.c b/gcc/statistics.c
index b198b3455fa..62590ba3528 100644
--- a/gcc/statistics.c
+++ b/gcc/statistics.c
@@ -76,7 +76,7 @@ stats_counter_hasher::equal (const value_type *c1, const compare_type *c2)
inline void
stats_counter_hasher::remove (value_type *v)
{
- free (CONST_CAST(char *, v->id));
+ free (CONST_CAST (char *, v->id));
free (v);
}
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 1dc447a5c85..2e17db1cfae 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -806,7 +806,10 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
|| ! allows_reg
|| is_inout)
{
- op = expand_expr (val, NULL_RTX, VOIDmode, EXPAND_WRITE);
+ op = expand_expr (val, NULL_RTX, VOIDmode,
+ !allows_reg ? EXPAND_MEMORY
+ : !is_inout ? EXPAND_WRITE
+ : EXPAND_NORMAL);
if (MEM_P (op))
op = validize_mem (op);
@@ -1638,11 +1641,11 @@ dump_case_nodes (FILE *f, struct case_node *root,
fputs (";; ", f);
if (high == low)
- fprintf(f, "%*s" HOST_WIDE_INT_PRINT_DEC,
- indent_step * indent_level, "", low);
+ fprintf (f, "%*s" HOST_WIDE_INT_PRINT_DEC,
+ indent_step * indent_level, "", low);
else
- fprintf(f, "%*s" HOST_WIDE_INT_PRINT_DEC " ... " HOST_WIDE_INT_PRINT_DEC,
- indent_step * indent_level, "", low, high);
+ fprintf (f, "%*s" HOST_WIDE_INT_PRINT_DEC " ... " HOST_WIDE_INT_PRINT_DEC,
+ indent_step * indent_level, "", low, high);
fputs ("\n", f);
dump_case_nodes (f, root->right, indent_step, indent_level);
@@ -1799,7 +1802,7 @@ get_outgoing_edge_probs (basic_block bb)
int prob_sum = 0;
if (!bb)
return 0;
- FOR_EACH_EDGE(e, ei, bb->succs)
+ FOR_EACH_EDGE (e, ei, bb->succs)
prob_sum += e->probability;
return prob_sum;
}
@@ -1848,7 +1851,7 @@ emit_case_dispatch_table (tree index_expr, tree index_type,
rtx fallback_label = label_rtx (case_list->code_label);
rtx table_label = gen_label_rtx ();
bool has_gaps = false;
- edge default_edge = stmt_bb ? EDGE_SUCC(stmt_bb, 0) : NULL;
+ edge default_edge = stmt_bb ? EDGE_SUCC (stmt_bb, 0) : NULL;
int default_prob = default_edge ? default_edge->probability : 0;
int base = get_outgoing_edge_probs (stmt_bb);
bool try_with_tablejump = false;
@@ -1973,7 +1976,7 @@ reset_out_edges_aux (basic_block bb)
{
edge e;
edge_iterator ei;
- FOR_EACH_EDGE(e, ei, bb->succs)
+ FOR_EACH_EDGE (e, ei, bb->succs)
e->aux = (void *)0;
}
@@ -2039,7 +2042,7 @@ expand_case (gimple stmt)
/* Find the default case target label. */
default_label = label_rtx (CASE_LABEL (gimple_switch_default_label (stmt)));
- edge default_edge = EDGE_SUCC(bb, 0);
+ edge default_edge = EDGE_SUCC (bb, 0);
int default_prob = default_edge->probability;
/* Get upper and lower bounds of case values. */
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 6f6b3107841..6584b575e0f 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1352,7 +1352,7 @@ place_field (record_layout_info rli, tree field)
/* Cause a new bitfield to be captured, either this time (if
currently a bitfield) or next time we see one. */
- if (!DECL_BIT_FIELD_TYPE(field)
+ if (!DECL_BIT_FIELD_TYPE (field)
|| integer_zerop (DECL_SIZE (field)))
rli->prev_field = NULL;
}
@@ -2627,12 +2627,12 @@ bit_field_mode_iterator
HOST_WIDE_INT bitregion_start,
HOST_WIDE_INT bitregion_end,
unsigned int align, bool volatilep)
-: mode_ (GET_CLASS_NARROWEST_MODE (MODE_INT)), bitsize_ (bitsize),
- bitpos_ (bitpos), bitregion_start_ (bitregion_start),
- bitregion_end_ (bitregion_end), align_ (align),
- volatilep_ (volatilep), count_ (0)
+: m_mode (GET_CLASS_NARROWEST_MODE (MODE_INT)), m_bitsize (bitsize),
+ m_bitpos (bitpos), m_bitregion_start (bitregion_start),
+ m_bitregion_end (bitregion_end), m_align (align),
+ m_volatilep (volatilep), m_count (0)
{
- if (!bitregion_end_)
+ if (!m_bitregion_end)
{
/* We can assume that any aligned chunk of ALIGN bits that overlaps
the bitfield is mapped and won't trap, provided that ALIGN isn't
@@ -2642,8 +2642,8 @@ bit_field_mode_iterator
= MIN (align, MAX (BIGGEST_ALIGNMENT, BITS_PER_WORD));
if (bitsize <= 0)
bitsize = 1;
- bitregion_end_ = bitpos + bitsize + units - 1;
- bitregion_end_ -= bitregion_end_ % units + 1;
+ m_bitregion_end = bitpos + bitsize + units - 1;
+ m_bitregion_end -= m_bitregion_end % units + 1;
}
}
@@ -2654,12 +2654,12 @@ bit_field_mode_iterator
bool
bit_field_mode_iterator::next_mode (enum machine_mode *out_mode)
{
- for (; mode_ != VOIDmode; mode_ = GET_MODE_WIDER_MODE (mode_))
+ for (; m_mode != VOIDmode; m_mode = GET_MODE_WIDER_MODE (m_mode))
{
- unsigned int unit = GET_MODE_BITSIZE (mode_);
+ unsigned int unit = GET_MODE_BITSIZE (m_mode);
/* Skip modes that don't have full precision. */
- if (unit != GET_MODE_PRECISION (mode_))
+ if (unit != GET_MODE_PRECISION (m_mode))
continue;
/* Stop if the mode is too wide to handle efficiently. */
@@ -2668,31 +2668,31 @@ bit_field_mode_iterator::next_mode (enum machine_mode *out_mode)
/* Don't deliver more than one multiword mode; the smallest one
should be used. */
- if (count_ > 0 && unit > BITS_PER_WORD)
+ if (m_count > 0 && unit > BITS_PER_WORD)
break;
/* Skip modes that are too small. */
- unsigned HOST_WIDE_INT substart = (unsigned HOST_WIDE_INT) bitpos_ % unit;
- unsigned HOST_WIDE_INT subend = substart + bitsize_;
+ unsigned HOST_WIDE_INT substart = (unsigned HOST_WIDE_INT) m_bitpos % unit;
+ unsigned HOST_WIDE_INT subend = substart + m_bitsize;
if (subend > unit)
continue;
/* Stop if the mode goes outside the bitregion. */
- HOST_WIDE_INT start = bitpos_ - substart;
- if (bitregion_start_ && start < bitregion_start_)
+ HOST_WIDE_INT start = m_bitpos - substart;
+ if (m_bitregion_start && start < m_bitregion_start)
break;
HOST_WIDE_INT end = start + unit;
- if (end > bitregion_end_ + 1)
+ if (end > m_bitregion_end + 1)
break;
/* Stop if the mode requires too much alignment. */
- if (GET_MODE_ALIGNMENT (mode_) > align_
- && SLOW_UNALIGNED_ACCESS (mode_, align_))
+ if (GET_MODE_ALIGNMENT (m_mode) > m_align
+ && SLOW_UNALIGNED_ACCESS (m_mode, m_align))
break;
- *out_mode = mode_;
- mode_ = GET_MODE_WIDER_MODE (mode_);
- count_++;
+ *out_mode = m_mode;
+ m_mode = GET_MODE_WIDER_MODE (m_mode);
+ m_count++;
return true;
}
return false;
@@ -2704,7 +2704,7 @@ bit_field_mode_iterator::next_mode (enum machine_mode *out_mode)
bool
bit_field_mode_iterator::prefer_smaller_modes ()
{
- return (volatilep_
+ return (m_volatilep
? targetm.narrow_volatile_bitfield ()
: !SLOW_BYTE_ACCESS);
}
diff --git a/gcc/store-motion.c b/gcc/store-motion.c
index e0b58477d4c..68f293c6252 100644
--- a/gcc/store-motion.c
+++ b/gcc/store-motion.c
@@ -271,7 +271,7 @@ store_ops_ok (const_rtx x, int *regs_set)
for (; x; x = XEXP (x, 1))
{
reg = XEXP (x, 0);
- if (regs_set[REGNO(reg)])
+ if (regs_set[REGNO (reg)])
return false;
}
@@ -1256,8 +1256,8 @@ const pass_data pass_data_rtl_store_motion =
class pass_rtl_store_motion : public rtl_opt_pass
{
public:
- pass_rtl_store_motion(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_rtl_store_motion, ctxt)
+ pass_rtl_store_motion (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_rtl_store_motion, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/streamer-hooks.h b/gcc/streamer-hooks.h
index 11e00b20155..d989cc90452 100644
--- a/gcc/streamer-hooks.h
+++ b/gcc/streamer-hooks.h
@@ -61,19 +61,19 @@ struct streamer_hooks {
};
#define stream_write_tree(OB, EXPR, REF_P) \
- streamer_hooks.write_tree(OB, EXPR, REF_P, REF_P)
+ streamer_hooks.write_tree (OB, EXPR, REF_P, REF_P)
#define stream_write_tree_shallow_non_ref(OB, EXPR, REF_P) \
- streamer_hooks.write_tree(OB, EXPR, REF_P, false)
+ streamer_hooks.write_tree (OB, EXPR, REF_P, false)
#define stream_read_tree(IB, DATA_IN) \
- streamer_hooks.read_tree(IB, DATA_IN)
+ streamer_hooks.read_tree (IB, DATA_IN)
#define stream_input_location(BP, DATA_IN) \
- streamer_hooks.input_location(BP, DATA_IN)
+ streamer_hooks.input_location (BP, DATA_IN)
#define stream_output_location(OB, BP, LOC) \
- streamer_hooks.output_location(OB, BP, LOC)
+ streamer_hooks.output_location (OB, BP, LOC)
/* Streamer hooks. */
extern struct streamer_hooks streamer_hooks;
diff --git a/gcc/symtab.c b/gcc/symtab.c
index 8dc61d0c7af..62fe166bd61 100644
--- a/gcc/symtab.c
+++ b/gcc/symtab.c
@@ -1083,6 +1083,10 @@ symtab_nonoverwritable_alias (symtab_node node)
(void *)&new_node, true);
if (new_node)
return new_node;
+#ifndef ASM_OUTPUT_DEF
+ /* If aliases aren't supported by the assembler, fail. */
+ return NULL;
+#endif
/* Otherwise create a new one. */
new_decl = copy_node (node->symbol.decl);
diff --git a/gcc/system.h b/gcc/system.h
index b735a96c10b..fab1c7bb32f 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#ifndef va_copy
# ifdef __va_copy
-# define va_copy(d,s) __va_copy((d),(s))
+# define va_copy(d,s) __va_copy (d, s)
# else
# define va_copy(d,s) ((d) = (s))
# endif
@@ -53,9 +53,9 @@ along with GCC; see the file COPYING3. If not see
#undef fopen
#undef freopen
-#define fopen(PATH,MODE) fopen_unlocked(PATH,MODE)
-#define fdopen(FILDES,MODE) fdopen_unlocked(FILDES,MODE)
-#define freopen(PATH,MODE,STREAM) freopen_unlocked(PATH,MODE,STREAM)
+#define fopen(PATH, MODE) fopen_unlocked (PATH, MODE)
+#define fdopen(FILDES, MODE) fdopen_unlocked (FILDES, MODE)
+#define freopen(PATH, MODE, STREAM) freopen_unlocked (PATH, MODE, STREAM)
/* The compiler is not a multi-threaded application and therefore we
do not have to use the locking functions. In fact, using the locking
@@ -294,7 +294,7 @@ extern int errno;
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
It is necessary at least when t == time_t. */
#define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof(t) * CHAR_BIT - 1) : (t) 0))
+ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
/* Use that infrastructure to provide a few constants. */
@@ -536,7 +536,7 @@ extern int snprintf (char *, size_t, const char *, ...);
#endif
#if defined (HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
-extern int vsnprintf(char *, size_t, const char *, va_list);
+extern int vsnprintf (char *, size_t, const char *, va_list);
#endif
#ifdef __cplusplus
@@ -611,11 +611,11 @@ extern int vsnprintf(char *, size_t, const char *, va_list);
/* Some systems have mkdir that takes a single argument. */
#ifdef MKDIR_TAKES_ONE_ARG
-# define mkdir(a,b) mkdir(a)
+# define mkdir(a,b) mkdir (a)
#endif
#ifndef HAVE_KILL
-# define kill(p,s) raise(s)
+# define kill(p,s) raise (s)
#endif
/* Provide a way to print an address via printf. */
@@ -693,7 +693,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
#elif (GCC_VERSION >= 4005)
#define gcc_assert(EXPR) \
- ((void)(__builtin_expect(!(EXPR), 0) ? __builtin_unreachable(), 0 : 0))
+ ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
#else
/* Include EXPR, so that unused variable warnings do not occur. */
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
@@ -708,7 +708,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* Use gcc_unreachable() to mark unreachable locations (like an
unreachable default case of a switch. Do not use gcc_assert(0). */
#if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
-#define gcc_unreachable() __builtin_unreachable()
+#define gcc_unreachable() __builtin_unreachable ()
#else
#define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
#endif
@@ -1011,11 +1011,11 @@ helper_const_non_const_cast (const char *p)
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
#endif
#endif
-#define CONST_CAST(TYPE,X) CONST_CAST2(TYPE, const TYPE, (X))
-#define CONST_CAST_TREE(X) CONST_CAST(union tree_node *, (X))
-#define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X))
-#define CONST_CAST_BB(X) CONST_CAST(struct basic_block_def *, (X))
-#define CONST_CAST_GIMPLE(X) CONST_CAST(union gimple_statement_d *, (X))
+#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
+#define CONST_CAST_TREE(X) CONST_CAST (union tree_node *, (X))
+#define CONST_CAST_RTX(X) CONST_CAST (struct rtx_def *, (X))
+#define CONST_CAST_BB(X) CONST_CAST (struct basic_block_def *, (X))
+#define CONST_CAST_GIMPLE(X) CONST_CAST (union gimple_statement_d *, (X))
/* Activate certain diagnostics as warnings (not errors via the
-Werror flag). */
diff --git a/gcc/target-hooks-macros.h b/gcc/target-hooks-macros.h
index fb392c292d5..602b2a42d28 100644
--- a/gcc/target-hooks-macros.h
+++ b/gcc/target-hooks-macros.h
@@ -37,7 +37,7 @@
HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
name for nested use. */
#ifndef HOOK_VECTOR_1
-#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
+#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT (FRAGMENT)
#endif
#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index d3a3f5fdd42..ec73a6406d2 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -68,7 +68,7 @@ along with GCC; see the file COPYING3. If not see
#include "recog.h"
#include "intl.h"
#include "opts.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-ssa-alias.h"
#include "insn-codes.h"
@@ -93,7 +93,7 @@ void
default_external_libcall (rtx fun ATTRIBUTE_UNUSED)
{
#ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
- ASM_OUTPUT_EXTERNAL_LIBCALL(asm_out_file, fun);
+ ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
#endif
}
@@ -1057,20 +1057,17 @@ default_add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,
unsigned *cost = (unsigned *) data;
unsigned retval = 0;
- if (flag_vect_cost_model)
- {
- tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
- int stmt_cost = default_builtin_vectorization_cost (kind, vectype,
+ tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;
+ int stmt_cost = default_builtin_vectorization_cost (kind, vectype,
misalign);
- /* Statements in an inner loop relative to the loop being
- vectorized are weighted more heavily. The value here is
- arbitrary and could potentially be improved with analysis. */
- if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
- count *= 50; /* FIXME. */
-
- retval = (unsigned) (count * stmt_cost);
- cost[where] += retval;
- }
+ /* Statements in an inner loop relative to the loop being
+ vectorized are weighted more heavily. The value here is
+ arbitrary and could potentially be improved with analysis. */
+ if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
+ count *= 50; /* FIXME. */
+
+ retval = (unsigned) (count * stmt_cost);
+ cost[where] += retval;
return retval;
}
@@ -1430,7 +1427,7 @@ default_debug_unwind_info (void)
mode for registers used in apply_builtin_return and apply_builtin_arg. */
enum machine_mode
-default_get_reg_raw_mode(int regno)
+default_get_reg_raw_mode (int regno)
{
return reg_raw_mode[regno];
}
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index aaddae93209..b3bd15503cd 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -193,7 +193,7 @@ extern int default_label_align_max_skip (rtx);
extern int default_jump_align_max_skip (rtx);
extern section * default_function_section(tree decl, enum node_frequency freq,
bool startup, bool exit);
-extern enum machine_mode default_get_reg_raw_mode(int);
+extern enum machine_mode default_get_reg_raw_mode (int);
extern void *default_get_pch_validity (size_t *);
extern const char *default_pch_valid_p (const void *, size_t);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ecfd09142f7..3b22081878e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,443 @@
+2013-09-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/58564
+ * gcc.c-torture/execute/pr58564.c: New test.
+
+2013-09-30 Teresa Johnson <tejohnson@google.com>
+
+ * testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c (expand_one_var):
+ Update for additional dump message.
+
+2013-09-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58554
+ * gcc.dg/torture/pr58554.c: New testcase.
+
+2013-09-30 Simon Cook <simon.cook@embecosm.com>
+ Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * gcc.target/arc/barrel-shifter-1.c: New test.
+ * gcc.target/arc/barrel-shifter-2.c: Likewise.
+ * gcc.target/arc/long-calls.c, gcc.target/arc/mA6.c: Likewise.
+ * gcc.target/arc/mA7.c, gcc.target/arc/mARC600.c: Likewise.
+ * gcc.target/arc/mARC601.c, gcc.target/arc/mARC700.c: Likewise.
+ * gcc.target/arc/mcpu-arc600.c, gcc.target/arc/mcpu-arc601.c: Likewise.
+ * gcc.target/arc/mcpu-arc700.c, gcc.target/arc/mcrc.c: Likewise.
+ * gcc.target/arc/mdpfp.c, gcc.target/arc/mdsp-packa.c: Likewise.
+ * gcc.target/arc/mdvbf.c, gcc.target/arc/mlock.c: Likewise.
+ * gcc.target/arc/mmac-24.c, gcc.target/arc/mmac-d16.c: Likewise.
+ * gcc.target/arc/mno-crc.c, gcc.target/arc/mno-dsp-packa.c: Likewise.
+ * gcc.target/arc/mno-dvbf.c, gcc.target/arc/mno-lock.c: Likewise.
+ * gcc.target/arc/mno-mac-24.c, gcc.target/arc/mno-mac-d16.c: Likewise.
+ * gcc.target/arc/mno-rtsc.c, gcc.target/arc/mno-swape.c: Likewise.
+ * gcc.target/arc/mno-xy.c, gcc.target/arc/mrtsc.c: Likewise.
+ * gcc.target/arc/mspfp.c, gcc.target/arc/mswape.c: Likewise.
+ * gcc.target/arc/mtune-ARC600.c: Likewise.
+ * gcc.target/arc/mtune-ARC601.c: Likewise.
+ * gcc.target/arc/mtune-ARC700-xmac: Likewise.
+ * gcc.target/arc/mtune-ARC700.c: Likewise.
+ * gcc.target/arc/mtune-ARC725D.c: Likewise.
+ * gcc.target/arc/mtune-ARC750D.c: Likewise.
+ * gcc.target/arc/mul64.c, gcc.target/arc/mxy.c: Likewise.
+ * gcc.target/arc/no-dpfp-lrsr.c: Likewise.
+
+2013-09-30 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58532
+ * g++.dg/torture/pr58552.C: New testcase.
+
+2013-09-27 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/p8vector-ldst.c: New test for -mupper-regs-sf
+ and -mupper-regs-df.
+
+2013-09-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/58551
+ * c-c++-common/gomp/pr58551.c: New test.
+
+2013-09-27 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58459
+ * gcc.dg/tree-ssa/ssa-pre-31.c: New testcase.
+
+2013-09-26 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR fortran/58113
+ * gfortran.dg/round_4.f90: Check for rounding support.
+
+2013-09-26 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * g++.dg/vect/pr58513.cc (op): Make static.
+
+2013-09-26 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/coalesce-2.c: New testcase.
+
+2013-09-26 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58539
+ * gcc.dg/torture/pr58539.c: New testcase.
+
+2013-09-25 Jeff Law <law@redhat.com>
+
+ * gcc.dg/tree-ssa/ssa-dom-thread-3.c: Update expected output.
+
+2013-09-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58436
+ * gfortran.dg/finalize_21.f90: New.
+
+2013-09-25 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ PR fortran/58469
+ * gfortran.dg/defined_assignment_8.f90: New.
+ * gfortran.dg/defined_assignment_9.f90: New.
+
+2013-09-25 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58413
+ * c-c++-common/ubsan/shift-5.c: New test.
+ * c-c++-common/ubsan/shift-6.c: New test.
+ * c-c++-common/ubsan/div-by-zero-5.c: New test.
+ * gcc.dg/ubsan/c-shift-1.c: New test.
+
+2013-09-25 Marek Polacek <polacek@redhat.com>
+
+ PR c++/58516
+ * g++.dg/tm/pr58516.C: New test.
+
+2013-09-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * lib/target-supports.exp (check_effective_target_arm_cond_exec):
+ New procedure.
+ * gcc.target/arm/minmax_minus.c: Check for cond_exec target.
+
+2013-09-24 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58513
+ * g++.dg/vect/pr58513.cc: New testcase.
+
+2013-09-24 Yvan Roux <yvan.roux@linaro.org>
+
+ * gcc.target/arm/atomic-comp-swap-release-acquire.c: Adjust expected
+ output.
+
+2013-09-23 Adam Butcher <adam@jessamine.co.uk>
+
+ PR c++/58500
+ * g++.dg/cpp1y/pr58500.C: New testcase.
+
+2013-09-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt28.ad[sb]: New test.
+ * gnat.dg/opt28_pkg.ads: New helper.
+
+2013-09-23 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58464
+ * g++.dg/torture/pr58464.C: New testcase.
+
+2013-09-23 Christian Bruel <christian.bruel@st.com>
+
+ PR target/58475
+ * gcc.target/sh/torture/pr58475.c: New test.
+
+2013-09-23 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/58355
+ * gfortran.dg/extends_15.f90: New.
+
+2013-09-20 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58481
+ * g++.dg/cpp0x/lambda/lambda-this17.C: New.
+
+2013-09-20 Jan-Benedict Glaw <jbglaw@lug-owl.de>
+
+ PR target/56875
+ * gcc.target/vax/vax.exp: New.
+ * gcc.target/vax/pr56875.c: Ditto.
+
+2013-09-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58484
+ * gfortran.dg/pr58484.f: New testcase.
+
+2013-09-20 Jeff Law <law@redhat.com>
+
+ * gcc.dg/tree-ssa/ssa-dom-thread-3.c: Add missing dg-final clause.
+
+2013-09-20 Bernd Edlinger <bernd.edlinger@hotmail.de>
+
+ PR middle-end/57748
+ * gcc.dg/torture/pr57748-1.c: New test.
+ * gcc.dg/torture/pr57748-2.c: New test.
+
+2013-09-20 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58413
+ * c-c++-common/ubsan/shift-4.c: New test.
+
+2013-09-20 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58453
+ * gcc.dg/tree-ssa/ldist-23.c: New testcase.
+
+2013-09-20 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/58099
+ * gfortran.dg/proc_ptr_43.f90: New.
+
+2013-09-18 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ * gfortran.dg/defined_assignment_11.f90: New.
+
+2013-09-18 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/58438
+ * g++.dg/pr58438.C: New test.
+
+2013-09-18 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/43366
+ * gfortran.dg/class_39.f03: Update dg-error.
+ * gfortran.dg/class_5.f03: Ditto.
+ * gfortran.dg/class_53.f90: Ditto.
+ * gfortran.dg/realloc_on_assign_20.f90: New.
+ * gfortran.dg/realloc_on_assign_21.f90: New.
+ * gfortran.dg/realloc_on_assign_22.f90: New.
+
+2013-09-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58457
+ * g++.dg/parse/using4.C: New.
+
+2013-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.c-torture/execute/pr58419.c (b): Change type to signed char.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitize/58443
+ * g++.dg/ubsan/div-by-zero-1.C: Use the integer-divide-by-zero option
+ instead of the shift option.
+ * c-c++-common/ubsan/pr58443-1.c: New test.
+ * c-c++-common/ubsan/pr58443-3.c: New test.
+ * c-c++-common/ubsan/pr58443-2.c: New test.
+
+2013-09-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58417
+ * gcc.dg/torture/pr58417.c: New testcase.
+
+2013-09-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/array_bounds_test2.adb: New test.
+
+2013-09-18 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * g++.dg/debug/dwarf2/omp-fesdr.C: Check for fopenmp effective target.
+ * gcc.dg/debug/dwarf2/omp-fesdr.c: Likewise.
+
+2013-09-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/in_out_parameter4.adb: New test.
+
+2013-09-18 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/58411
+ * c-c++-common/ubsan/attrib-1.c: New test.
+
+2013-09-17 Cong Hou <congh@google.com>
+
+ * gcc.dg/vect/vect-reduc-dot-s16c.c: Add a test case with dot product
+ on two arrays with short and int types. This should not be recognized
+ as a dot product pattern.
+
+2013-09-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58435
+ * pt.c (tsubst, [BOUND_TEMPLATE_TEMPLATE_PARM]): Take into account
+ the cp_type_quals (r) too.
+
+2013-09-17 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/58332
+ * gcc.c-torture/compile/pr58332.c: New testcase.
+
+2013-09-17 Jeff Law <law@redhat.com>
+
+ * gcc.c-torture/execute/pr58387.c: New test.
+
+2013-09-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR tree-optimization/58088
+ * gcc.c-torture/compile/pr58088.c: New test.
+
+2013-09-17 Nick Clifton <nickc@redhat.com>
+
+ * lib/target-supports.exp (check_effective_target_trampolines):
+ Add MSP430 to the list of targets that do not support
+ trampolines.
+ (check_profiling_available): Add MSP430 to the list of targets
+ that do not support profiling.
+ (check_effective_target_tls_runtime): Add MSP430 to the list of
+ targets that do not support TLS.
+
+2013-09-17 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt27.adb: New test.
+ * gnat.dg/opt27_pkg.ad[sb]: New helper.
+
+2013-09-17 Andreas Schwab <schwab@suse.de>
+
+ * gcc.dg/tree-ssa/ldist-22.c (main): Return zero.
+
+2013-09-17 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58432
+ * gcc.dg/pr58432.c: New testcase.
+
+2013-09-17 Bin Cheng <bin.cheng@arm.com>
+
+ * gcc.dg/tree-ssa/slsr-39.c: New test.
+
+2013-09-16 Xinliang David Li <davidxl@google.com>
+
+ * gcc.misc-tests/help.exp: Optimizer help change.
+
+2013-09-16 Jeff Law <law@redhat.com>
+
+ * gcc.c-torture/execute/pr58419.c: New test.
+ * gcc.c-torture/execute/pr58431.c: New test.
+
+2013-09-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58356
+ * gfortran.dg/finalize_19.f90: New.
+
+2013-09-16 Vladimir Makarov <vmakarov@redhat.com>
+
+ * gcc.target/i386/pr58418.c: New.
+
+2013-09-16 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * gcc.target/aarch64/fmla-intrinsic.c: New.
+ * gcc.target/aarch64/mla-intrinsic.c: Likewise.
+ * gcc.target/aarch64/fmls-intrinsic.c: Likewise.
+ * gcc.target/aarch64/mls-intrinsic.c: Likewise.
+
+2013-09-16 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * gcc.target/aarch64/mul_intrinsic_1.c: New.
+ * gcc.target/aarch64/fmul_intrinsic_1.c: Likewise.
+
+2013-09-16 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ldist-22.c: New testcase.
+
+2013-09-16 Adam Butcher <adam@jessamine.co.uk>
+
+ * g++.dg/cpp0x/auto9.C: Downgrade two previously expected errors (now
+ interpreted as implicit templates) to be expected pedwarns instead.
+
+2013-09-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ * gfortran.dg/defined_assignment_10.f90: Comment print statement.
+
+2013-09-15 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57697
+ * gfortran.dg/defined_assignment_10.f90: New.
+
+2013-09-13 Evgeny Gavrin <e.gavrin@samsung.com>
+
+ * gcc.dg/debug/dwarf2/omp-fesdr.c: Add test.
+ * g++.dg/debug/dwarf2/omp-fesdr.C: Add test.
+
+2013-09-13 Jacek Caban <jacek@codeweavers.com>
+
+ * g++.dg/abi/main.C: Added implicit C linkage tests
+
+2013-09-13 Kai Tietz <ktietz@redhat.com>
+
+ gcc.target/i386/pr57848.c: New file.
+
+2013-09-13 Christian Bruel <christian.bruel@st.com>
+
+ PR target/58314
+ * gcc.target/sh/torture/pr58314.c: New test.
+
+2013-09-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/torture/pr58380.C: Suppress warnings with "-w".
+
+2013-09-12 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/58389
+ * g++.dg/pr58389.C: New test.
+
+2013-09-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/template/pseudodtor2.C: Add column number to dg-error
+ strings.
+ * g++.dg/template/pseudodtor3.C: Likewise.
+
+2013-09-12 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/58404
+ * g++.dg/tree-ssa/pr58404.C: New testcase.
+
+2013-09-12 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/58371
+ * g++.dg/ipa/pr58371.C: New test.
+
+2013-09-12 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/ldist-4.c: Remove undefined behavior. Adjust
+ expected outcome and comment why that happens.
+
+2013-09-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58377
+ * g++.dg/uninit-pred-4.C: New testcase.
+
+2013-09-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/58385
+ * gcc.c-torture/execute/pr58385.c: New test.
+
+2013-09-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/arm/thumb-ifcvt-2.c: New test.
+
+2013-09-10 Jeff Law <law@redhat.com>
+
+ * g++.dg/torture/pr58380.C: New test.
+
+2013-09-10 Jan Hubicka <jh@suse.cz>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/template/cond2.C: Tweak, do not expect a "required from".
+
+2013-09-10 Jeff Law <law@redhat.com>
+
+ * gcc.c-torture/compile/pr58343.c: New test.
+
+2013-09-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/58365
+ * gcc.c-torture/execute/pr58365.c: New test.
+
+2013-09-10 Michael Zolotukhin <michael.v.zolotukhin@gmail.com>
+
+ * gcc.dg/torture/memcpy-1.c: New test.
+
2013-09-10 Alan Modra <amodra@gmail.com>
* gcc.target/powerpc/pr58330.c: New.
diff --git a/gcc/testsuite/c-c++-common/gomp/pr58551.c b/gcc/testsuite/c-c++-common/gomp/pr58551.c
new file mode 100644
index 00000000000..e2db70f9e86
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr58551.c
@@ -0,0 +1,33 @@
+/* PR middle-end/58551 */
+/* { dg-do compile } */
+/* { dg-options "-O0 -fopenmp" } */
+
+void
+foo (int *a)
+{
+ int i;
+ for (i = 0; i < 8; i++)
+ #pragma omp task
+ if (a[i])
+ __builtin_abort ();
+}
+
+void bar (int, int);
+
+void
+baz (int *a)
+{
+ int i;
+ for (i = 0; i < 8; i++)
+ #pragma omp task
+ if (a[i])
+ {
+ int j, k;
+ for (j = 0; j < 10; j++)
+ for (k = 0; k < 8; k++)
+ bar (j, k);
+ for (k = 0; k < 12; k++)
+ bar (-1, k);
+ __builtin_abort ();
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/attrib-1.c b/gcc/testsuite/c-c++-common/ubsan/attrib-1.c
new file mode 100644
index 00000000000..2e9141ca040
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/attrib-1.c
@@ -0,0 +1,33 @@
+/* PR sanitizer/58411 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -w" } */
+
+__attribute__((no_sanitize_undefined)) int
+f1 (int i)
+{
+ return 16 << i;
+}
+
+int f2 (int i);
+int f2 (int i) __attribute__((no_sanitize_undefined));
+int f2 (int i) __attribute__((no_sanitize_undefined));
+int f2 (int i);
+
+int
+f2 (int i)
+{
+ return 1 / i;
+}
+
+void f3 (void);
+__typeof (f3) f3 __attribute__((__no_sanitize_undefined__));
+
+void
+f3 (void)
+{
+ __builtin_unreachable ();
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle_shift_out_of_bounds" } } */
+/* { dg-final { scan-assembler-not "__ubsan_handle_divrem_overflow" } } */
+/* { dg-final { scan-assembler-not "__ubsan_handle_builtin_unreachable" } } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c b/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c
new file mode 100644
index 00000000000..7a28bacd14b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/div-by-zero-5.c
@@ -0,0 +1,8 @@
+/* { dg-do compile} */
+/* { dg-options "-fsanitize=integer-divide-by-zero" } */
+
+void
+foo (void)
+{
+ int A[-2 / -1] = {};
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c b/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c
new file mode 100644
index 00000000000..76f1dda07a5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr58443-1.c
@@ -0,0 +1,11 @@
+/* PR sanitizer/58443 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift,unreachable -w" } */
+
+int
+foo (int u, int o)
+{
+ return u / o;
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle_divrem_overflow" } } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c b/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c
new file mode 100644
index 00000000000..a135758a86f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr58443-2.c
@@ -0,0 +1,11 @@
+/* PR sanitizer/58443 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=unreachable,integer-divide-by-zero -w" } */
+
+int
+foo (int u, int o)
+{
+ return u >> o;
+}
+
+/* { dg-final { scan-assembler-not "__ubsan_handle_shift_out_of_bounds" } } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c b/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c
new file mode 100644
index 00000000000..5696a62dffa
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr58443-3.c
@@ -0,0 +1,18 @@
+/* PR sanitizer/58443 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -w" } */
+
+int
+foo (int u, int o)
+{
+ return u >> o;
+}
+
+int
+bar (int u, int o)
+{
+ return u / o;
+}
+
+/* { dg-final { scan-assembler "__ubsan_handle_divrem_overflow" } } */
+/* { dg-final { scan-assembler "__ubsan_handle_shift_out_of_bounds" } } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/shift-4.c b/gcc/testsuite/c-c++-common/ubsan/shift-4.c
new file mode 100644
index 00000000000..239c0131fb9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/shift-4.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+struct S { unsigned long long int b:40; } s;
+
+int
+main ()
+{
+ s.b = 2;
+ s.b <<= 120;
+ return 0;
+}
+
+/* { dg-output "shift exponent 120 is too large\[^\n\r]*(\n|\r\n|\r)" } */
diff --git a/gcc/testsuite/c-c++-common/ubsan/shift-5.c b/gcc/testsuite/c-c++-common/ubsan/shift-5.c
new file mode 100644
index 00000000000..6f9c52a7288
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/shift-5.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int x;
+int
+foo (void)
+{
+ /* None of the following should pass. */
+ switch (x)
+ {
+ case 1 >> -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 12 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 12 } */
+ case -1 >> -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 15 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 15 } */
+ case 1 << -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 18 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 18 } */
+ case -1 << -1:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 21 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 21 } */
+ case -1 >> 200:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 24 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 24 } */
+ case 1 << 200:
+/* { dg-error "case label does not reduce to an integer constant" "" {target c } 27 } */
+/* { dg-error "is not a constant expression" "" { target c++ } 27 } */
+ return 1;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/shift-6.c b/gcc/testsuite/c-c++-common/ubsan/shift-6.c
new file mode 100644
index 00000000000..a0e2e20acc1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/shift-6.c
@@ -0,0 +1,30 @@
+/* PR sanitizer/58413 */
+/* { dg-do run { target int32plus } } */
+/* { dg-options "-fsanitize=shift -w" } */
+
+int x = 7;
+int
+main (void)
+{
+ /* All of the following should pass. */
+ int A[128 >> 5] = {};
+ int B[128 << 5] = {};
+
+ static int e =
+ ((int)
+ (0x00000000 | ((31 & ((1 << (4)) - 1)) << (((15) + 6) + 4)) |
+ ((0) << ((15) + 6)) | ((0) << (15))));
+
+ if (e != 503316480)
+ __builtin_abort ();
+
+ switch (x)
+ {
+ case 1 >> 4:
+ case 1 << 4:
+ case 128 << (4 + 1):
+ case 128 >> (4 + 1):
+ return 1;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/abi/main.C b/gcc/testsuite/g++.dg/abi/main.C
new file mode 100644
index 00000000000..4c5f1ea213c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/main.C
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+
+/* Check if entry points get implicit C linkage. If they don't, compiler will
+ * error on incompatible declarations */
+
+int main();
+extern "C" int main();
+
+#ifdef __MINGW32__
+
+int wmain();
+extern "C" int wmain();
+
+int DllMain();
+extern "C" int DllMain();
+
+int WinMain();
+extern "C" int WinMain();
+
+int wWinMain();
+extern "C" int wWinMain();
+
+#endif
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-38.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-38.C
new file mode 100644
index 00000000000..bc98737b849
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-38.C
@@ -0,0 +1,41 @@
+// PR c++/58435
+// { dg-do compile { target c++11 } }
+
+template<typename T, typename U>
+struct same { static const bool value = false; };
+template<typename T>
+struct same<T, T> { static const bool value = true; };
+
+template <template <typename> class F, typename T> struct apply
+{ typedef F<T> type; };
+template <template <typename> class F, typename T> struct applyc
+{ typedef const F<T> type; };
+template <template <typename> class F, typename T> struct applyv
+{ typedef volatile F<T> type; };
+template <template <typename> class F, typename T> struct applycv
+{ typedef const volatile F<T> type; };
+
+template <typename T> using map = T;
+template <typename T> using mapc = const T;
+template <typename T> using mapv = volatile T;
+template <typename T> using mapcv = const volatile T;
+
+static_assert(same<apply<map, int>::type, int>::value, "");
+static_assert(same<apply<mapc, int>::type, const int>::value, "");
+static_assert(same<apply<mapv, int>::type, volatile int>::value, "");
+static_assert(same<apply<mapcv, int>::type, const volatile int>::value, "");
+
+static_assert(same<applyc<map, int>::type, const int>::value, "");
+static_assert(same<applyc<mapc, int>::type, const int>::value, "");
+static_assert(same<applyc<mapv, int>::type, const volatile int>::value, "");
+static_assert(same<applyc<mapcv, int>::type, const volatile int>::value, "");
+
+static_assert(same<applyv<map, int>::type, volatile int>::value, "");
+static_assert(same<applyv<mapc, int>::type, const volatile int>::value, "");
+static_assert(same<applyv<mapv, int>::type, volatile int>::value, "");
+static_assert(same<applyv<mapcv, int>::type, const volatile int>::value, "");
+
+static_assert(same<applycv<map, int>::type, const volatile int>::value, "");
+static_assert(same<applycv<mapc, int>::type, const volatile int>::value, "");
+static_assert(same<applycv<mapv, int>::type, const volatile int>::value, "");
+static_assert(same<applycv<mapcv, int>::type, const volatile int>::value, "");
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C
index 190bfa6e8f0..f357f2b9663 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C
@@ -117,8 +117,8 @@ template <auto V = 4> struct G {}; // { dg-error "auto" }
template <typename T> struct H { H (); ~H (); };
H<auto> h; // { dg-error "invalid" }
-void qq (auto); // { dg-error "auto" }
-void qr (auto*); // { dg-error "auto" }
+void qq (auto); // { dg-warning "auto" }
+void qr (auto*); // { dg-warning "auto" }
// PR c++/46145
typedef auto autot; // { dg-error "auto" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C
new file mode 100644
index 00000000000..2386e6b1eb8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this17.C
@@ -0,0 +1,21 @@
+// PR c++/58481
+// { dg-require-effective-target c++11 }
+
+struct Test {
+ template<typename... Args> inline void triggerTest (Args&&... fargs) { }
+};
+
+struct TestPickled : Test {
+ template<typename... Args> void triggerTest (Args&&... fargs) {
+ [=](Args... as) {
+ Test::triggerTest (as...);
+ } ();
+ }
+};
+
+int main()
+{
+ TestPickled test;
+ test.triggerTest ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic2.C
new file mode 100644
index 00000000000..fab1f6ca6ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic2.C
@@ -0,0 +1,57 @@
+// { dg-do run { target c++11 } }
+
+int g() { return 0; }
+template <class T, class... U>
+int g(T t, U... u)
+{
+ return t + g(u...);
+}
+
+template <class... T>
+int f1(T... t)
+{
+ return [t...] {
+ return g(t...);
+ }();
+}
+
+template <class... T>
+int f2(T... t)
+{
+ return [&t...] {
+ return g(t...);
+ }();
+}
+
+template <class... T>
+int f3(T... t)
+{
+ return [=] {
+ return g(t...);
+ }();
+}
+
+template <class... T>
+int f4(T... t)
+{
+ return [&] {
+ return g(t...);
+ }();
+}
+
+#define assert(E) do { if (!(E)) __builtin_abort(); } while(0)
+int main()
+{
+ assert (f1() == 0);
+ assert (f2() == 0);
+ assert (f3() == 0);
+ assert (f4() == 0);
+ assert (f1(42) == 42);
+ assert (f2(42) == 42);
+ assert (f3(42) == 42);
+ assert (f4(42) == 42);
+ assert (f1(1,2,3) == 6);
+ assert (f2(1,2,3) == 6);
+ assert (f3(1,2,3) == 6);
+ assert (f4(1,2,3) == 6);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr58500.C b/gcc/testsuite/g++.dg/cpp1y/pr58500.C
new file mode 100644
index 00000000000..b9d4a26d415
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/pr58500.C
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+
+// PR c++/58500
+
+struct A {};
+
+void foo(auto (A::*)());
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C b/gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C
new file mode 100644
index 00000000000..b3b65e91888
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/omp-fesdr.C
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fopenmp } */
+/* { dg-options "-g -fopenmp -gdwarf-2 -femit-struct-debug-reduced" } */
+
+struct aa
+{
+ int a;
+};
+
+int
+f7 (void)
+{
+ int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
+
+ #pragma omp parallel
+ {
+ #pragma omp master
+ v7o++;
+ #pragma omp for private (v7i) firstprivate (v7k) reduction (+:v7l)
+ for (v7n = 0; v7n < 3; v7n++)
+ {
+ int v7m = v7j + v7k;
+ v7i = 8;
+ v7l++;
+ }
+ }
+
+ return v7i + v7j + v7k + v7l + v7n;
+}
+
+int
+main (void)
+{
+ f7 ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/ipa/pr58371.C b/gcc/testsuite/g++.dg/ipa/pr58371.C
new file mode 100644
index 00000000000..00cfbb831fc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr58371.C
@@ -0,0 +1,204 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+
+typedef int size_t;
+namespace {
+template < typename > struct char_traits;
+}
+namespace __gnu_cxx {
+template < typename > class new_allocator {
+};
+}
+namespace std {
+template < typename _Tp > class allocator:__gnu_cxx::new_allocator < _Tp > {
+public:
+ size_t size_type;
+ typedef _Tp & const_reference;
+ template < typename > struct rebind {
+ typedef allocator other;
+ };
+};
+}
+namespace __gnu_cxx {
+template < typename _Alloc > struct __alloc_traits {
+ typedef typename _Alloc::const_reference const_reference;
+ template < typename _Tp > struct rebind {
+ typedef typename _Alloc::template rebind < _Tp >::other other;
+ };
+};
+}
+namespace std {
+struct __numeric_limits_base {
+};
+template < typename _Tp > struct numeric_limits:__numeric_limits_base {
+ static _Tp max () {
+ }
+};
+template < typename _Tp, typename _Alloc > struct _Vector_base {
+ typedef typename __gnu_cxx::__alloc_traits < _Alloc >::template rebind <
+ _Tp >::other _Tp_alloc_type;
+};
+template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector:_Vector_base < _Tp,
+ _Alloc
+ > {
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
+ typedef __gnu_cxx::__alloc_traits < _Tp_alloc_type > _Alloc_traits;
+public:
+ _Tp value_type;
+ typedef typename _Alloc_traits::const_reference const_reference;
+ typedef size_t size_type;
+ size_type size () {
+ } const_reference operator[] (size_type) {
+ }
+};
+template < typename _CharT, typename =
+char_traits < _CharT > >class basic_ostream;
+typedef basic_ostream < int >ostream;
+class ios_base {
+};
+template < typename, typename > class basic_ios:ios_base {
+};
+template < typename _CharT, typename _Traits > class basic_ostream:basic_ios < _CharT,
+ _Traits
+ > {
+public:
+ _CharT char_type;
+ typedef basic_ostream __ostream_type;
+ __ostream_type & operator<< (const void *) {
+ }
+};
+}
+namespace logging {
+int GetMinLogLevel ();
+typedef int LogSeverity;
+LogSeverity LOG_ERROR_REPORT;
+LogSeverity LOG_DCHECK;
+class LogMessage {
+public:
+ LogMessage (const char *, int, LogSeverity);
+ std::ostream & stream () {
+ }
+};
+class LogMessageVoidify {
+public:
+ LogMessageVoidify () {
+ } void operator& (std::ostream &) {
+ }
+};
+}
+namespace base {
+namespace internal {
+class WeakPtrBase {
+};
+class SupportsWeakPtrBase {
+};
+} template < typename T > class WeakPtr:internal::WeakPtrBase {
+public:
+ WeakPtr () :ptr_ () {
+ } T *operator-> () {
+ logging:0 &&
+ logging::LOG_DCHECK >=
+ logging::GetMinLogLevel () ? (void) 0 : logging::
+ LogMessageVoidify () & logging::
+ LogMessage ("../../base/memory/weak_ptr.h", 0,
+ logging::LOG_ERROR_REPORT).stream () << ". ";
+ } T *ptr_;
+};
+template < class > class SupportsWeakPtr:internal::SupportsWeakPtrBase {
+};
+}
+template < class ObserverType > class ObserverListBase:base::SupportsWeakPtr < ObserverListBase < ObserverType >
+ > {
+public:
+ class Iterator {
+ public:
+ Iterator (ObserverListBase & list) :max_index_ (0 ? std::numeric_limits <
+ size_t >::max () : list.observers_.
+ size () ) {
+ } ObserverType *
+ GetNext () {
+ ListType & observers = list_->observers_;
+ if (observers[0])
+ ++index_;
+ }
+ base::WeakPtr < ObserverListBase > list_;
+ size_t
+ index_;
+ size_t
+ max_index_;
+ };
+ typedef
+ std::vector <
+ ObserverType * >
+ ListType;
+ ListType
+ observers_;
+};
+template < class ObserverType, bool > class ObserverList:public ObserverListBase <
+ ObserverType > {
+};
+namespace
+ ProxyPrefs {
+enum ConfigState
+{ };
+}
+namespace
+ net {
+class
+ ProxyConfig {
+};
+class
+ ProxyConfigService {
+public:
+ enum ConfigAvailability
+ { };
+ class
+ Observer {
+ public:
+ Observer () {
+ } virtual void
+ OnProxyConfigChanged (const ProxyConfig &, ConfigAvailability) = 0;
+ };
+ virtual void
+ OnLazyPoll () {
+ }
+};
+}
+class
+ ChromeProxyConfigService:
+ net::ProxyConfigService,
+ net::ProxyConfigService::Observer {
+ ConfigAvailability
+ GetLatestProxyConfig (net::ProxyConfig *);
+ void
+ UpdateProxyConfig (ProxyPrefs::ConfigState, const net::ProxyConfig &);
+ void
+ OnProxyConfigChanged (const net::ProxyConfig &, ConfigAvailability);
+ ObserverList <
+ net::ProxyConfigService::Observer,
+ 0 >
+ observers_;
+};
+void
+ChromeProxyConfigService::UpdateProxyConfig (ProxyPrefs::ConfigState,
+ const net::ProxyConfig &) {
+ net::ProxyConfig new_config;
+ ConfigAvailability availability = GetLatestProxyConfig (0);
+net:
+ ProxyConfigService::Observer * obs;
+ obs->OnProxyConfigChanged (new_config, availability);
+}
+void
+ChromeProxyConfigService::OnProxyConfigChanged (const net::ProxyConfig &,
+ ConfigAvailability
+ availability) {
+ net::ProxyConfig actual_config;
+ ObserverListBase <
+ net::ProxyConfigService::Observer >::Iterator it (observers_);
+net:
+ ProxyConfigService::Observer * obs;
+ if (it.GetNext () )
+ obs->OnProxyConfigChanged (actual_config, availability);
+}
diff --git a/gcc/testsuite/g++.dg/parse/using4.C b/gcc/testsuite/g++.dg/parse/using4.C
new file mode 100644
index 00000000000..2abe399f8dc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/using4.C
@@ -0,0 +1,20 @@
+// PR c++/58457
+
+struct allocator
+{
+ void operator delete (void*);
+ void* operator new (__SIZE_TYPE__, void*);
+};
+
+struct type : public allocator
+{
+ type() {}
+ using allocator::operator new;
+ using allocator::operator delete;
+};
+
+int main()
+{
+ new (0) type;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr58389.C b/gcc/testsuite/g++.dg/pr58389.C
new file mode 100644
index 00000000000..648c145459b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr58389.C
@@ -0,0 +1,54 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+template <typename _RandomAccessIterator, typename _Compare>
+void __insertion_sort(_RandomAccessIterator, _Compare);
+template <typename _RandomAccessIterator, typename _Compare>
+void __final_insertion_sort(_RandomAccessIterator p1, _Compare p2) {
+ _RandomAccessIterator a;
+ if (p1 - a)
+ ;
+ else
+ std:
+ __insertion_sort(0, p2);
+}
+template <typename _RandomAccessIterator, typename _Size, typename _Compare>
+void __introsort_loop(_RandomAccessIterator, _Size, _Compare);
+template <typename _RandomAccessIterator, typename _Compare>
+void sort(_RandomAccessIterator, _RandomAccessIterator p2, _Compare p3) {
+std:
+ __introsort_loop(0, 0, p3);
+ __final_insertion_sort(p2, p3);
+}
+class A {
+public:
+ int m_fn1();
+ void __lg();
+ class B {
+ public:
+ int i;
+ int operator-(B);
+ };
+};
+class C;
+class D {
+public:
+ C *operator->();
+};
+class F {
+ A m_fn1() const;
+ D d_ptr;
+};
+class C {
+ friend F;
+ void m_fn1();
+ A children;
+};
+void qt_notclosestLeaf();
+inline void C::m_fn1() {
+ A::B b, c;
+ if (children.m_fn1()) {
+ sort(c, b, qt_notclosestLeaf);
+ }
+}
+A F::m_fn1() const { const_cast<F *>(this)->d_ptr->m_fn1(); }
diff --git a/gcc/testsuite/g++.dg/pr58438.C b/gcc/testsuite/g++.dg/pr58438.C
new file mode 100644
index 00000000000..4c62cb26ce8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr58438.C
@@ -0,0 +1,45 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-march=amdfam10 -O3 -fprofile-generate" } */
+enum gimple_code {};
+struct A {
+ gimple_code code;
+};
+struct B {
+ A gsbase;
+};
+int **a;
+int b, d, e, f, g, h, i, j, k, l, m, n, o;
+gimple_code c, p;
+class C {
+ virtual unsigned m_fn1();
+};
+B q;
+static int fn1() {
+ int r;
+ if (k)
+ i = 0;
+ for (; i; j++) {
+ b = c <= 0;
+ if (b)
+ n = *a[0];
+ b = p && c;
+ if (b)
+ r = *a[0];
+ b = q.gsbase.code && c;
+ if (b)
+ o = *a[0];
+ m = o;
+ if (e || 1 & r || d || l)
+ return 0;
+ }
+}
+
+class D : C {
+ unsigned m_fn1() {
+ fn1();
+ for (; h; g++)
+ for (;; f++)
+ ;
+ }
+};
+void fn2() { new D; }
diff --git a/gcc/testsuite/g++.dg/template/cond2.C b/gcc/testsuite/g++.dg/template/cond2.C
index fad86bebe51..e6bd19d40fa 100644
--- a/gcc/testsuite/g++.dg/template/cond2.C
+++ b/gcc/testsuite/g++.dg/template/cond2.C
@@ -6,5 +6,5 @@ template<int X> class c;
template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" }
void test(c<2>*c2) {
- test<0, 2>(*c2); // { dg-message "required" }
+ test<0, 2>(*c2);
}
diff --git a/gcc/testsuite/g++.dg/template/inherit9.C b/gcc/testsuite/g++.dg/template/inherit9.C
new file mode 100644
index 00000000000..926343b4e23
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/inherit9.C
@@ -0,0 +1,15 @@
+// PR c++/58273
+
+class A {};
+class B
+{
+ int goo(A);
+};
+template<typename E>
+class D : public B
+{
+ void foo(A t)
+ {
+ int const i(B::goo(t));
+ }
+};
diff --git a/gcc/testsuite/g++.dg/template/pseudodtor2.C b/gcc/testsuite/g++.dg/template/pseudodtor2.C
index 796aff0785b..d4a9ac1cbc8 100644
--- a/gcc/testsuite/g++.dg/template/pseudodtor2.C
+++ b/gcc/testsuite/g++.dg/template/pseudodtor2.C
@@ -6,7 +6,7 @@ template<typename S> struct D
typedef int T;
S foo ();
- D () { foo ().~T(); } // { dg-error "is not of type" }
+ D () { foo ().~T(); } // { dg-error "10:is not of type" }
};
struct Z
diff --git a/gcc/testsuite/g++.dg/template/pseudodtor3.C b/gcc/testsuite/g++.dg/template/pseudodtor3.C
index 5f392f4e492..202182f5337 100644
--- a/gcc/testsuite/g++.dg/template/pseudodtor3.C
+++ b/gcc/testsuite/g++.dg/template/pseudodtor3.C
@@ -5,13 +5,13 @@ struct A
{
typedef int T;
T &foo ();
- A () { foo.~T (); } // { dg-error "does not have class type|expected" }
+ A () { foo.~T (); } // { dg-error "10:does not have class type|expected" }
};
template <typename T> struct B
{
T &foo ();
- B () { foo.~T (); } // { dg-error "invalid use of member" }
+ B () { foo.~T (); } // { dg-error "10:invalid use of member" }
};
B<int> b;
@@ -19,7 +19,7 @@ B<int> b;
template <typename T, typename S> struct C
{
T t;
- C () { t.~S (); } // { dg-error "is not of type" }
+ C () { t.~S (); } // { dg-error "10:is not of type" }
};
C<int, long int> c;
@@ -28,7 +28,7 @@ template <typename T> struct D
{
T t;
typedef long int U;
- D () { t.~U (); } // { dg-error "is not of type" }
+ D () { t.~U (); } // { dg-error "10:is not of type" }
};
D<int> d;
@@ -37,7 +37,7 @@ template <typename T> struct E
{
T &foo ();
typedef long int U;
- E () { foo.~U (); } // { dg-error "is not of type" }
+ E () { foo.~U (); } // { dg-error "10:is not of type" }
};
E<int> e;
diff --git a/gcc/testsuite/g++.dg/tm/pr58516.C b/gcc/testsuite/g++.dg/tm/pr58516.C
new file mode 100644
index 00000000000..b1ada3c8c1d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tm/pr58516.C
@@ -0,0 +1,7 @@
+// { dg-do compile }
+// { dg-options "-std=c++11 -fgnu-tm" }
+
+void foo()
+{
+ __transaction_atomic noexcept(false) {}
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr58380.C b/gcc/testsuite/g++.dg/torture/pr58380.C
new file mode 100644
index 00000000000..3a6ca942067
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr58380.C
@@ -0,0 +1,173 @@
+// { dg-do compile }
+// { dg-options "-w" }
+
+class iplugin_factory;
+class idocument_plugin_factory {
+ virtual idocument_plugin_factory *create_plugin(iplugin_factory &, int &);
+};
+template <typename _Iterator, typename> class __normal_iterator {
+ _Iterator _M_current;
+
+public:
+ _Iterator iterator_type;
+ __normal_iterator(const _Iterator &p1) : _M_current(p1) {}
+ void operator++();
+ _Iterator &base() { return _M_current; }
+};
+
+template <typename _IteratorL, typename _IteratorR, typename _Container>
+int operator!=(__normal_iterator<_IteratorL, _Container> &p1,
+ __normal_iterator<_IteratorR, _Container> &p2) {
+ return p1.base() != p2.base();
+}
+
+class new_allocator {
+public:
+ typedef int *const_pointer;
+ int *allocate();
+};
+template <typename> class allocator : public new_allocator {};
+
+class basic_string {
+public:
+ basic_string(char *);
+};
+struct __uninitialized_copy {
+ template <typename _InputIterator, typename _ForwardIterator>
+ static _ForwardIterator __uninit_copy(_InputIterator p1, _InputIterator p2,
+ _ForwardIterator p3) try {
+ for (; p1 != p2; ++p1, ++p3)
+ ;
+ return p3;
+ }
+ catch (...) {
+ }
+};
+
+template <typename _InputIterator, typename _ForwardIterator>
+_ForwardIterator uninitialized_copy(_InputIterator p1, _InputIterator p2,
+ _ForwardIterator p3) {
+ return __uninitialized_copy::__uninit_copy(p1, p2, p3);
+}
+
+template <typename _InputIterator, typename _ForwardIterator, typename _Tp>
+_ForwardIterator __uninitialized_copy_a(_InputIterator p1, _InputIterator p2,
+ _ForwardIterator p3, allocator<_Tp> &) {
+ return uninitialized_copy(p1, p2, p3);
+}
+
+struct _Vector_base {
+ struct _Vector_impl : allocator<int> {
+ int *_M_start;
+ int *_M_finish;
+ };
+ allocator<int> &_M_get_Tp_allocator() {}
+ _Vector_base() {}
+ _Vector_base(int p1) { _M_create_storage(p1); }
+ _Vector_impl _M_impl;
+ int *_M_allocate(int p1) { p1 ? _M_impl.allocate() : 0; }
+ void _M_create_storage(int p1) {
+ this->_M_impl._M_start = this->_M_allocate(p1);
+ }
+};
+
+class vector : _Vector_base {
+ _Vector_base _Base;
+
+public:
+ vector() {}
+ vector(const vector &p1) : _Base(p1.size()) {
+ this->_M_impl._M_finish = __uninitialized_copy_a(
+ p1.begin(), p1.end(), this->_M_impl._M_start, _M_get_Tp_allocator());
+ }
+ ~vector();
+ __normal_iterator<typename allocator<int>::const_pointer, int> begin() const {
+ return this->_M_impl._M_start;
+ }
+ __normal_iterator<typename allocator<int>::const_pointer, int> end() const {
+ return this->_M_impl._M_finish;
+ }
+ int size() const { return this->_M_impl._M_finish - this->_M_impl._M_start; }
+};
+class iplugin_factory {
+public:
+ typedef enum {
+ STABLE,
+ EXPERIMENTAL
+ } quality_t;
+};
+class plugin_factory : public iplugin_factory {
+public:
+ plugin_factory(const int &, const basic_string &, const basic_string &,
+ const basic_string &, quality_t);
+};
+template <typename plugin_t>
+class document_plugin_factory : plugin_factory, idocument_plugin_factory {
+public:
+ document_plugin_factory(const int &p1, const basic_string &,
+ const basic_string &, const basic_string &, quality_t)
+ : plugin_factory(0, 0, 0, 0, STABLE) {}
+ idocument_plugin_factory *create_plugin(iplugin_factory &p1, int &p2) {
+ plugin_t(p1, p2);
+ }
+};
+
+class container {
+public:
+ template <typename init_t> container(init_t &);
+};
+template <class init_t> class initializer_t : init_t {
+public:
+ initializer_t(const init_t &p1) : init_t(p1) {}
+};
+
+class composition_t {};
+template <typename lhs_t, typename rhs_t>
+const initializer_t<composition_t> operator+(const initializer_t<lhs_t> &,
+ const initializer_t<rhs_t> &);
+template <typename value_t> class value_initializer_t {
+public:
+ value_initializer_t(const value_t &p1) : m_value(p1) {}
+ value_t m_value;
+};
+
+template <typename value_t>
+initializer_t<value_initializer_t<value_t> > init_value(const value_t &p1) {
+ initializer_t<value_initializer_t<value_t> >(
+ value_initializer_t<value_t>(p1));
+}
+
+class name_t {};
+class label_t {};
+class description_t {};
+class owner_initializer_t {};
+template <typename owner_t>
+initializer_t<owner_initializer_t> init_owner(owner_t &);
+class set : vector {};
+class node {
+public:
+ node(iplugin_factory &, int &);
+};
+initializer_t<name_t> init_name();
+initializer_t<label_t> init_label();
+initializer_t<description_t> init_description();
+template <typename base_t> class mesh_selection_sink : base_t {
+public:
+ mesh_selection_sink(iplugin_factory &p1, int &p2)
+ : base_t(p1, p2),
+ m_mesh_selection(init_owner(*this) + init_name() + init_label() +
+ init_description() + init_value(set())) {}
+ container m_mesh_selection;
+};
+
+class selection_to_stdout : mesh_selection_sink<node> {
+public:
+ selection_to_stdout(iplugin_factory &p1, int &p2)
+ : mesh_selection_sink(p1, p2) {}
+ static iplugin_factory &get_factory() {
+ document_plugin_factory<selection_to_stdout>(0, "", 0, "",
+ iplugin_factory::EXPERIMENTAL);
+ }
+};
+
+void selection_to_stdout_factory() { selection_to_stdout::get_factory(); }
diff --git a/gcc/testsuite/g++.dg/torture/pr58464.C b/gcc/testsuite/g++.dg/torture/pr58464.C
new file mode 100644
index 00000000000..3d9a2279d99
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr58464.C
@@ -0,0 +1,268 @@
+// { dg-do compile }
+
+typedef __SIZE_TYPE__ size_t;
+extern "C" void *memcpy(void *, const void *, size_t);
+void *xmalloc(size_t);
+enum {
+ _sch_isdigit, _sch_isidst, _sch_isidnum
+};
+extern const unsigned _sch_istable[256];
+typedef struct ht cpp_hash_table;
+typedef struct ht_identifier *hashnode;
+enum ht_lookup_option {
+ HT_NO_INSERT
+};
+struct ht {
+ struct cpp_reader *pfile;
+};
+hashnode ht_lookup_with_hash(cpp_hash_table *, unsigned char *, size_t, unsigned, ht_lookup_option);
+typedef unsigned source_location;
+enum cpp_ttype {
+ CPP_OTHER, CPP_STRING, CPP_STRING16, CPP_UTF8STRING
+};
+struct cpp_token {
+ source_location src_loc;
+};
+typedef int cppchar_t;
+struct cpp_options {
+ char user_literals;
+ unsigned warn_literal_suffix;
+};
+enum node_type { };
+struct cpp_hashnode {
+ node_type type:6;
+};
+enum {
+ CPP_DL_ERROR
+};
+enum {
+ CPP_W_LITERAL_SUFFIX
+};
+bool cpp_error_with_line(cpp_reader *, int, source_location, unsigned, ...);
+bool cpp_warning_with_line(cpp_reader *, int, source_location, unsigned, const char *);
+cpp_ttype cpp_userdef_string_add_type(cpp_ttype);
+cpp_ttype cpp_userdef_char_add_type(cpp_ttype);
+typedef unsigned char uchar;
+struct _cpp_buff {
+ _cpp_buff *next;
+ unsigned char *base, *cur, *limit;
+};
+_cpp_buff *_cpp_get_buff(cpp_reader *, size_t);
+void _cpp_release_buff(cpp_reader *, _cpp_buff *);
+unsigned char *_cpp_unaligned_alloc(cpp_reader *, size_t);
+struct lexer_state {
+ unsigned skipping;
+ unsigned angled_headers;
+};
+struct _cpp_line_note {
+ unsigned pos;
+ unsigned type;
+};
+struct cpp_buffer {
+ unsigned char *cur;
+ unsigned char *line_base;
+ _cpp_line_note *notes;
+ unsigned cur_note;
+};
+struct cpp_reader {
+ cpp_buffer *buffer;
+ lexer_state state;
+ _cpp_buff *u_buff;
+ _cpp_buff *free_buffs;
+ ht *hash_table;
+ cpp_options opts;
+};
+static void create_literal(cpp_reader *pfile, cpp_token *, uchar *, unsigned len, cpp_ttype type)
+{
+ uchar *dest = _cpp_unaligned_alloc(pfile, len + 1);
+ dest[len] = type;
+}
+static void bufring_append(cpp_reader *pfile, uchar *base, size_t len, _cpp_buff **first_buff_p, _cpp_buff **last_buff_p)
+{
+ _cpp_buff *first_buff = *first_buff_p;
+ _cpp_buff *last_buff = *last_buff_p;
+ if (!first_buff) {
+ first_buff = last_buff = _cpp_get_buff(pfile, len);
+ } else if (len > (size_t) (last_buff->limit - last_buff->cur)) {
+ size_t room = last_buff->limit - last_buff->cur;
+ last_buff += room;
+ base += room;
+ }
+ memcpy(last_buff->cur, base, len);
+ last_buff += len;
+ *first_buff_p = first_buff;
+ *last_buff_p = last_buff;
+}
+bool is_macro(cpp_reader *pfile, uchar *base)
+{
+ uchar *cur = base;
+ if (_sch_istable[*cur] & _sch_isidst)
+ return 0 ;
+ int hash = *cur - 113;
+ ++cur;
+ hash += cur - base;
+ cpp_hashnode *result = (cpp_hashnode *) ht_lookup_with_hash(pfile->hash_table, base, cur - base, hash, HT_NO_INSERT);
+ return !result ? 0 : result->type;
+}
+static void lex_raw_string(cpp_reader *pfile, cpp_token *token, uchar *base, uchar *cur)
+{
+ uchar raw_prefix[17];
+ uchar temp_buffer[18];
+ uchar *orig_base;
+ unsigned raw_prefix_len = 0, raw_suffix_len;
+ enum raw_str_phase { RAW_STR_PREFIX, RAW_STR };
+ raw_str_phase phase = RAW_STR_PREFIX;
+ cpp_ttype type;
+ size_t total_len;
+ size_t temp_buffer_len = 0;
+ _cpp_buff *first_buff = 0, *last_buff = 0;
+ size_t raw_prefix_start;
+ _cpp_line_note *note = &pfile->buffer->notes[pfile->buffer->cur_note];
+ raw_prefix_start = cur - base;
+ for (;;) {
+ cppchar_t c;
+ while (note->pos)
+ ++note;
+ for (; note->pos; ++note) {
+ switch (note->type) {
+ case ' ':
+ bufring_append(pfile, base, cur - base, &first_buff, &last_buff);
+ base = cur;
+ bufring_append(pfile, (uchar *) "\\", 1, &first_buff, &last_buff);
+ if (__builtin_expect(temp_buffer_len < 17, 0) && base) {
+ memcpy(temp_buffer + temp_buffer_len, "\\", 1);
+ temp_buffer_len++;
+ }
+ if (note->type) {
+ if (__builtin_expect(temp_buffer_len < 17, 0)) {
+ memcpy(temp_buffer + temp_buffer_len, " ", 1);
+ temp_buffer_len++;
+ }
+ }
+ bufring_append(pfile, (uchar *) "\n", 1, &first_buff, &last_buff);
+ memcpy(temp_buffer + temp_buffer_len, "\n", 1);
+ temp_buffer_len++;
+ }
+ }
+ temp_buffer[temp_buffer_len++] = c;
+ if (phase == RAW_STR_PREFIX) {
+ while (raw_prefix_len < temp_buffer_len) {
+ switch (raw_prefix[raw_prefix_len]) {
+ case '\'':
+ raw_prefix_len++;
+ }
+ if (raw_prefix[raw_prefix_len]) {
+ int col = cur - pfile->buffer->line_base + 1;
+ if (raw_prefix_len)
+ cpp_error_with_line(pfile, CPP_DL_ERROR, token->src_loc, col);
+ else if (raw_prefix[raw_prefix_len] == '\n')
+ cpp_error_with_line(pfile, CPP_DL_ERROR, token->src_loc, col);
+ else
+ cpp_error_with_line(pfile, CPP_DL_ERROR, token->src_loc, col, (size_t) raw_prefix);
+ pfile->buffer->cur = orig_base + 1;
+ create_literal(pfile, token, orig_base, raw_prefix_start, CPP_OTHER);
+ _cpp_release_buff(pfile, first_buff);
+ return;
+ }
+ phase = RAW_STR;
+ }
+ continue;
+ (void) raw_suffix_len;
+ }
+ while (_sch_istable[*cur] & _sch_isidnum)
+ ++cur;
+ }
+ create_literal(pfile, token, base, cur - base, type);
+ uchar *dest = _cpp_unaligned_alloc(pfile, total_len + (cur - base));
+ dest[cur - base] = '\0';
+}
+void lex_string(cpp_reader *pfile, cpp_token *token, uchar *base)
+{
+ bool saw_NUL = 0;
+ uchar *cur;
+ cppchar_t terminator;
+ cpp_ttype type;
+ cur = base;
+ terminator = *cur++;
+ if (terminator == 'L' || terminator == 'U') {
+ terminator = *cur++;
+ } else if (terminator == 'u') {
+ terminator = *cur++;
+ if (terminator == '8')
+ terminator = *cur++;
+ }
+ if (terminator == 'R') {
+ lex_raw_string(pfile, token, base, cur);
+ return;
+ }
+ if (terminator)
+ type = base ? (base[1] ? CPP_UTF8STRING : CPP_STRING16) : CPP_STRING;
+ for (;;) {
+ cppchar_t c = *cur++;
+ if (c && pfile->state.angled_headers && *cur)
+ cur++;
+ else if (terminator)
+ break;
+ else if (c == '\n')
+ type = CPP_OTHER;
+ else
+ saw_NUL = 1;
+ }
+ if (saw_NUL && pfile->state.skipping)
+ if (pfile->opts.user_literals) {
+ if (is_macro(pfile, cur))
+ if (pfile->opts.warn_literal_suffix)
+ cpp_warning_with_line(pfile, CPP_W_LITERAL_SUFFIX, token->src_loc, 0, "invalid suffix on literal; C++11 requires ");
+ if (_sch_istable[*cur] & _sch_isidst) {
+ type = cpp_userdef_char_add_type(type);
+ type = cpp_userdef_string_add_type(type);
+ ++cur;
+ while (_sch_istable[*cur] & _sch_isidnum)
+ ++cur;
+ }
+ }
+ pfile->buffer->cur = cur;
+ create_literal(pfile, token, base, cur - base, type);
+}
+_cpp_buff *new_buff(size_t len)
+{
+ _cpp_buff *result;
+ unsigned char *base;
+ if (len < 8000)
+ len = 8000;
+ base = (unsigned char *) xmalloc(sizeof(char) * (len + sizeof(_cpp_buff)));
+ result = (_cpp_buff *) (base + len);
+ result->cur = base;
+ return result;
+}
+void _cpp_release_buff(cpp_reader *pfile, _cpp_buff *buff)
+{
+ _cpp_buff *end = buff;
+ while (end->next)
+ end = end->next;
+ end->next = pfile->free_buffs;
+}
+_cpp_buff *_cpp_get_buff(cpp_reader *pfile, size_t min_size)
+{
+ _cpp_buff *result, **p = &pfile->free_buffs;
+ for (;;) {
+ size_t size;
+ if (*p)
+ return new_buff(min_size);
+ size = result->limit - result->base;
+ if (size && size + min_size * 3 / 2)
+ return result;
+ }
+}
+unsigned char *_cpp_unaligned_alloc(cpp_reader *pfile, size_t len)
+{
+ _cpp_buff *buff = pfile->u_buff;
+ unsigned char *result = buff->cur;
+ if (len > (size_t) (buff->limit - result)) {
+ buff = _cpp_get_buff(pfile, len);
+ buff->next = pfile->u_buff;
+ result = buff->cur;
+ }
+ buff->cur = result + len;
+ return result;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr58552.C b/gcc/testsuite/g++.dg/torture/pr58552.C
new file mode 100644
index 00000000000..17c0d1cf624
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr58552.C
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-additional-options "-fcompare-debug" }
+
+extern void fancy_abort () __attribute__ ((__noreturn__));
+extern "C" {
+ struct __jmp_buf_tag { };
+ typedef struct __jmp_buf_tag jmp_buf[1];
+ extern int _setjmp (struct __jmp_buf_tag __env[1]) throw ();
+}
+extern void *gfc_state_stack;
+static jmp_buf eof_buf;
+static void push_state ()
+{
+ if (!gfc_state_stack)
+ fancy_abort ();
+}
+bool gfc_parse_file (void)
+{
+ int seen_program=0;
+ if (_setjmp (eof_buf))
+ return false;
+ if (seen_program)
+ goto duplicate_main;
+ seen_program = 1;
+ push_state ();
+ push_state ();
+duplicate_main:
+ return true;
+}
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr58404.C b/gcc/testsuite/g++.dg/tree-ssa/pr58404.C
new file mode 100644
index 00000000000..aa8fb796c6f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr58404.C
@@ -0,0 +1,20 @@
+// { dg-do compile }
+// { dg-options "-O -fdump-tree-cddce1" }
+
+struct S { int s; };
+S a[1024];
+
+void
+foo ()
+{
+ for (int i = 0; i < 1024; i++)
+ {
+ S &r = a[i];
+ r.s++;
+ }
+}
+
+// We should propagate the reference into both memory accesses
+// during the first forwprop pass
+// { dg-final { scan-tree-dump-times "= &a" 0 "cddce1" } }
+// { dg-final { cleanup-tree-dump "cddce1" } }
diff --git a/gcc/testsuite/g++.dg/ubsan/div-by-zero-1.C b/gcc/testsuite/g++.dg/ubsan/div-by-zero-1.C
index d7d2c8f1565..88acfa1517e 100644
--- a/gcc/testsuite/g++.dg/ubsan/div-by-zero-1.C
+++ b/gcc/testsuite/g++.dg/ubsan/div-by-zero-1.C
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-fsanitize=shift -w" } */
+/* { dg-options "-fsanitize=integer-divide-by-zero -w" } */
void
foo (int i)
diff --git a/gcc/testsuite/g++.dg/uninit-pred-4.C b/gcc/testsuite/g++.dg/uninit-pred-4.C
new file mode 100644
index 00000000000..94ab13c50d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pred-4.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Og" } */
+
+int pop ();
+int pop_first_bucket;
+
+int my_pop ()
+{
+ int out; // { dg-bogus "uninitialized" "uninitialized variable warning" }
+
+ while (pop_first_bucket)
+ if (pop_first_bucket && (out = pop()))
+ return out;
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr58513.cc b/gcc/testsuite/g++.dg/vect/pr58513.cc
new file mode 100644
index 00000000000..08a175c8e74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr58513.cc
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// { dg-require-effective-target vect_int }
+
+static int op (const int& x, const int& y) { return x + y; }
+
+void foo(int* a)
+{
+ for (int i = 0; i < 1000; ++i)
+ a[i] = op(a[i], 1);
+}
+
+// { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } }
+// { dg-final { cleanup-tree-dump "vect" } }
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58088.c b/gcc/testsuite/gcc.c-torture/compile/pr58088.c
new file mode 100644
index 00000000000..07a9c68a7ff
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr58088.c
@@ -0,0 +1,5 @@
+int
+bar (int i)
+{
+ return 1 | ((i * 2) & 254);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58332.c b/gcc/testsuite/gcc.c-torture/compile/pr58332.c
new file mode 100644
index 00000000000..22c586cb866
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr58332.c
@@ -0,0 +1,2 @@
+static inline int foo (int x) { return x + 1; }
+__attribute__ ((__optimize__ (0))) int bar (void) { return foo (100); }
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr58343.c b/gcc/testsuite/gcc.c-torture/compile/pr58343.c
new file mode 100644
index 00000000000..cdd2ce9f4a6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr58343.c
@@ -0,0 +1,15 @@
+int a;
+
+int main ()
+{
+ int b = a;
+
+ for (a = 1; a > 0; a--)
+ ;
+
+ lbl:
+ if (b && a)
+ goto lbl;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58365.c b/gcc/testsuite/gcc.c-torture/execute/pr58365.c
new file mode 100644
index 00000000000..1e6079d8429
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58365.c
@@ -0,0 +1,35 @@
+/* PR rtl-optimization/58365 */
+
+extern void abort (void);
+
+struct S
+{
+ volatile int a;
+ int b, c, d, e;
+} f;
+static struct S g, h;
+int i = 1;
+
+char
+foo (void)
+{
+ return i;
+}
+
+static struct S
+bar (void)
+{
+ if (foo ())
+ return f;
+ return g;
+}
+
+int
+main ()
+{
+ h = bar ();
+ f.b = 1;
+ if (h.b != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58385.c b/gcc/testsuite/gcc.c-torture/execute/pr58385.c
new file mode 100644
index 00000000000..8d7da6fc972
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58385.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/58385 */
+
+extern void abort (void);
+
+int a, b = 1;
+
+int
+foo ()
+{
+ b = 0;
+ return 0;
+}
+
+int
+main ()
+{
+ ((0 || a) & foo () >= 0) <= 1 && 1;
+ if (b)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58387.c b/gcc/testsuite/gcc.c-torture/execute/pr58387.c
new file mode 100644
index 00000000000..74c32dfaf10
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58387.c
@@ -0,0 +1,11 @@
+extern void abort(void);
+
+int a = -1;
+
+int main ()
+{
+ int b = a == 0 ? 0 : -a;
+ if (b < 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58419.c b/gcc/testsuite/gcc.c-torture/execute/pr58419.c
new file mode 100644
index 00000000000..69cc0401dc1
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58419.c
@@ -0,0 +1,36 @@
+int printf(const char *, ...);
+
+int a, g, i, k, *p;
+signed char b;
+char e;
+short c, h;
+static short *d = &c;
+
+char
+foo (int p1, int p2)
+{
+ return p1 - p2;
+}
+
+int
+bar ()
+{
+ short *q = &c;
+ *q = 1;
+ *p = 0;
+ return 0;
+}
+
+int
+main ()
+{
+ for (b = -22; b >= -29; b--)
+ {
+ short *l = &h;
+ char *m = &e;
+ *l = a;
+ g = foo (*m = k && *d, 1 > i) || bar ();
+ }
+ getpid();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58431.c b/gcc/testsuite/gcc.c-torture/execute/pr58431.c
new file mode 100644
index 00000000000..1a992c5fc8d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58431.c
@@ -0,0 +1,33 @@
+char a, h;
+int b, d, e, g, j, k;
+volatile int c;
+short i;
+
+int
+main ()
+{
+ int m;
+
+ m = i ^= 1;
+ for (b = 0; b < 1; b++)
+ {
+ char o = m;
+ g = k;
+ j = j || c;
+ if (a != o)
+ for (; d < 1; d++)
+ ;
+ else
+ {
+ char *p = &h;
+ *p = 1;
+ for (; e; e++)
+ ;
+ }
+ }
+
+ if (h != 0)
+ __builtin_abort();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr58564.c b/gcc/testsuite/gcc.c-torture/execute/pr58564.c
new file mode 100644
index 00000000000..967ee95d4ab
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr58564.c
@@ -0,0 +1,14 @@
+/* PR middle-end/58564 */
+
+extern void abort (void);
+int a, b;
+short *c, **d = &c;
+
+int
+main ()
+{
+ b = (0, 0 > ((&c == d) & (1 && (a ^ 1)))) | 0U;
+ if (b != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c b/gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c
new file mode 100644
index 00000000000..d7b03192be2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/omp-fesdr.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target fopenmp } */
+/* { dg-options "-g -fopenmp -gdwarf-2 -femit-struct-debug-reduced" } */
+
+struct aa
+{
+ int a;
+};
+
+int
+f7 (void)
+{
+ int v7i = 6, v7j = 7, v7k = 9, v7l = 0, v7n = 0, v7o = 1;
+
+ #pragma omp parallel
+ {
+ #pragma omp master
+ v7o++;
+ #pragma omp for private (v7i) firstprivate (v7k) reduction (+:v7l)
+ for (v7n = 0; v7n < 3; v7n++)
+ {
+ int v7m = v7j + v7k;
+ v7i = 8;
+ v7l++;
+ }
+ }
+
+ return v7i + v7j + v7k + v7l + v7n;
+}
+
+int
+main (void)
+{
+ f7 ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr58432.c b/gcc/testsuite/gcc.dg/pr58432.c
new file mode 100644
index 00000000000..22a720f142f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr58432.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-require-profiling "-fprofile-generate" } */
+/* { dg-options "-O3 -fprofile-generate" } */
+
+struct {
+ int prefix;
+ int dir_idx;
+} *a;
+int b;
+void fn1() {
+ int *c, *d;
+ for (; b; b++)
+ if (d[b]) {
+ c[b] = d[b];
+ a[0].dir_idx = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr58463.c b/gcc/testsuite/gcc.dg/pr58463.c
new file mode 100644
index 00000000000..e2b44119347
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr58463.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-ealias-details -O2" } */
+
+typedef struct
+{
+ int data16;
+}
+list_data;
+void
+fn1 (list_data * p1)
+{
+ p1->data16 = p1->data16 & 1 & p1->data16 >> 1;
+}
+
+/* { dg-final { cleanup-tree-dump "ealias" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/memcpy-1.c b/gcc/testsuite/gcc.dg/torture/memcpy-1.c
new file mode 100644
index 00000000000..290c78923e4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/memcpy-1.c
@@ -0,0 +1,22 @@
+/* { dg-do run } */
+/* { dg-additional-options "-mtune=pentiumpro" { target ia32 } } */
+/* { dg-additional-options "-minline-all-stringops" { target { i?86-*-* x86_64-*-* } } } */
+
+static void __attribute__((noinline, noclone))
+my_memcpy (char *dest, const char *src, int n)
+{
+ __builtin_memcpy (dest, src, n);
+}
+
+int
+main (void)
+{
+ char a1[4], a2[4];
+ __builtin_memset (a1, 'a', 4);
+ __builtin_memset (a2, 'b', 4);
+ my_memcpy (a2, a1, 4);
+ if (a2[0] != 'a')
+ __builtin_abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr57748-1.c b/gcc/testsuite/gcc.dg/torture/pr57748-1.c
new file mode 100644
index 00000000000..dc0fcdc3b85
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr57748-1.c
@@ -0,0 +1,49 @@
+/* PR middle-end/57748 */
+/* { dg-do run } */
+/* ICE in expand_assignment:
+ misalignp == true, !MEM_P (to_rtx), offset != 0,
+ => gcc_assert (TREE_CODE (offset) == INTEGER_CST) */
+
+#include <stdlib.h>
+
+extern void abort (void);
+
+typedef long long V
+ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
+
+typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
+
+struct __attribute__((packed)) T { char c; P s; };
+
+void __attribute__((noinline, noclone))
+check (struct T *t)
+{
+ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
+ abort ();
+}
+
+int __attribute__((noinline, noclone))
+get_i (void)
+{
+ return 0;
+}
+
+void __attribute__((noinline, noclone))
+foo (P *p)
+{
+ V a = { 3, 4 };
+ int i = get_i ();
+ p->b[i] = a;
+}
+
+int
+main ()
+{
+ struct T *t = (struct T *) calloc (128, 1);
+
+ foo (&t->s);
+ check (t);
+
+ free (t);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr57748-2.c b/gcc/testsuite/gcc.dg/torture/pr57748-2.c
new file mode 100644
index 00000000000..4e3b4b88468
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr57748-2.c
@@ -0,0 +1,43 @@
+/* PR middle-end/57748 */
+/* { dg-do run } */
+/* wrong code in expand_assignment:
+ misalignp == true, !MEM_P (to_rtx),
+ offset == 0, bitpos >= GET_MODE_PRECISION,
+ => result = NULL. */
+
+#include <stdlib.h>
+
+extern void abort (void);
+
+typedef long long V
+ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
+
+typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
+
+struct __attribute__((packed)) T { char c; P s; };
+
+void __attribute__((noinline, noclone))
+check (struct T *t)
+{
+ if (t->s.b[0][0] != 3 || t->s.b[0][1] != 4)
+ abort ();
+}
+
+void __attribute__((noinline, noclone))
+foo (P *p)
+{
+ V a = { 3, 4 };
+ p->b[0] = a;
+}
+
+int
+main ()
+{
+ struct T *t = (struct T *) calloc (128, 1);
+
+ foo (&t->s);
+ check (t);
+
+ free (t);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr58417.c b/gcc/testsuite/gcc.dg/torture/pr58417.c
new file mode 100644
index 00000000000..5cb0ddb0275
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr58417.c
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+long long arr[6] = {0, 1, 2, 3, 4, 5};
+extern void abort (void);
+void __attribute__((noinline,noclone))
+foo (long long sum)
+{
+ asm ("");
+}
+int main()
+{
+ int i, n = 5;
+ long long sum = 0, prevsum = 0;
+
+ for(i = 1; i <= n; i++)
+ {
+ foo (sum);
+ sum = (i - 1) * arr[i] - prevsum;
+ prevsum += arr[i];
+ }
+
+ if (sum != 10)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr58539.c b/gcc/testsuite/gcc.dg/torture/pr58539.c
new file mode 100644
index 00000000000..a016150f18e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr58539.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+int a, b;
+
+extern void baz (int);
+
+int foo (int p)
+{
+ return p ? p : 1;
+}
+
+void bar ()
+{
+ int *c = &a, *d = &a;
+ for (b = 0; b < 12; b++)
+ *d |= 1;
+ foo (*c);
+ baz (*c && 1);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr58554.c b/gcc/testsuite/gcc.dg/torture/pr58554.c
new file mode 100644
index 00000000000..269171ae941
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr58554.c
@@ -0,0 +1,20 @@
+/* { dg-do run } */
+
+extern void abort (void);
+void __attribute__((noinline,noclone))
+clear_board(unsigned char *board, int board_size)
+{
+ int k;
+ for (k = 0; k < 421; k++)
+ if (k < board_size )
+ board[k] = 3;
+}
+int main()
+{
+ unsigned char board[421];
+ board[420] = 1;
+ clear_board (board, 420);
+ if (board[420] != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/coalesce-2.c b/gcc/testsuite/gcc.dg/tree-ssa/coalesce-2.c
new file mode 100644
index 00000000000..56c5ccccc7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/coalesce-2.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-rtl-expand-details" } */
+
+float total = 0.2;
+void foo(int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ total += i;
+}
+
+/* Verify that out-of-ssa coalescing did its job by verifying there are not
+ any partition copies inserted. */
+
+/* { dg-final { scan-rtl-dump-not "partition copy" "expand"} } */
+/* { dg-final { cleanup-rtl-dump "expand" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-22.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-22.c
new file mode 100644
index 00000000000..afc792f6503
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-22.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-tree-ldist-details" } */
+
+extern void abort (void);
+
+int a[1024], b[1024];
+
+void __attribute__((noinline,noclone))
+foo (void)
+{
+ int i;
+ for (i = 0; i < 1024; ++i)
+ {
+ a[i] = 0;
+ if (i > 100)
+ b[i] = i;
+ }
+}
+
+int main()
+{
+ b[100] = 1;
+ foo ();
+ if (b[100] != 1 || b[101] != 101)
+ abort ();
+ if (a[0] != 0 || a[101] != 0)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "generated memset zero" "ldist" } } */
+/* { dg-final { cleanup-tree-dump "ldist" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
new file mode 100644
index 00000000000..22b82d9920d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-23.c
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-O3 -fdump-tree-ldist-details" } */
+
+extern void abort (void);
+
+int a[128], b[128], c[128], d[128];
+
+void __attribute__((noinline,noclone))
+foo (void)
+{
+ int i;
+ for (i = 0; i < 128; ++i)
+ {
+ a[i] = a[i] + 1;
+ b[i] = d[i];
+ c[i] = a[i] / d[i];
+ }
+}
+int main()
+{
+ int i;
+ for (i = 0; i < 128; ++i)
+ a[i] = i;
+ for (i = 0; i < 128; ++i)
+ d[i] = 1;
+ foo ();
+ if (c[0] != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "split to 2 loops" "ldist" } } */
+/* { dg-final { scan-tree-dump "generated memcpy" "ldist" } } */
+/* { dg-final { cleanup-tree-dump "ldist" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c
index a744fea020a..80626bdacac 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c
@@ -10,20 +10,18 @@ int loop1 (int k)
a[0] = k;
for (i = 1; i < 100; i ++)
{
- for (j = 0; j < 100; j++)
+ for (j = 1; j < 100; j++)
{
a[j] = k * i;
b[i][j] = a[j-1] + k;
}
}
- return b[100-1][0];
+ return b[100-1][1];
}
-/* We used to distribute also innermost loops, but these could produce
- too much code in the outer loop, degrading performance of scalar
- code. So this test was XFAILed because the cost model of the stand
- alone distribution pass has evolved. Now it passes. */
-/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" { target ilp32 } } } */
-/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 1 "ldist" { target lp64 } } } */
+/* The current cost model fuses the two partitions because they have
+ similar memory accesses. */
+/* { dg-final { scan-tree-dump "similar memory accesses" "ldist" } } */
+/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" } } */
/* { dg-final { cleanup-tree-dump "ldist" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c
new file mode 100644
index 00000000000..8cc279857c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c
@@ -0,0 +1,26 @@
+/* Verify straight-line strength reduction for back-tracing
+ CAND_ADD for T2 in:
+
+ *PBASE: T1
+ *POFFSET: MULT_EXPR (T2, C3)
+ *PINDEX: C1 + (C2 * C3) + C4 */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-slsr" } */
+
+typedef int arr_2[50][50];
+
+void foo (arr_2 a2, int v1)
+{
+ int i, j;
+
+ i = v1 + 5;
+ j = i;
+ a2 [i] [j++] = i;
+ a2 [i] [j++] = i;
+ a2 [i] [i-1] += 1;
+ return;
+}
+
+/* { dg-final { scan-tree-dump-times "MEM" 4 "slsr" } } */
+/* { dg-final { cleanup-tree-dump "slsr" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c
index c2efd15eb33..0d53f501d84 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c
@@ -42,6 +42,7 @@ expand_one_var (tree var, unsigned char toplevel, unsigned char really_expand)
abort ();
}
/* We should thread the jump, through an intermediate block. */
-/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom1"} } */
-/* { dg-final { scan-tree-dump-times "Registering jump thread .through joiner block.: \\(.*\\); \\(.*\\); \\(.*\\);" 1 "dom1"} } */
+/* { dg-final { scan-tree-dump-times "Threaded" 2 "dom1"} } */
+/* { dg-final { scan-tree-dump-times "Registering jump thread: \\(.*\\) incoming edge; \\(.*\\) joiner; \\(.*\\) nocopy;" 1 "dom1"} } */
+/* { dg-final { cleanup-tree-dump "dom1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-31.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-31.c
new file mode 100644
index 00000000000..2094de4ca89
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-31.c
@@ -0,0 +1,47 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-pre" } */
+
+typedef struct {
+ unsigned int key;
+} S;
+typedef struct s1 {
+ unsigned int key;
+ unsigned int bits;
+ struct s1 *left, *right;
+}S1;
+extern S a[1024];
+static inline int bar( S* p, S1* n )
+{
+ S1 *curr;
+ S1 *next;
+
+ if ( n->left == n )
+ return (int)(p->key == n->key);
+
+ curr = n;
+ next = n->left;
+
+ while (curr->bits > next->bits ) {
+ curr = next;
+ if (p->key & (1 << curr->bits))
+ next = curr->right;
+ else
+ next = curr->left;
+ }
+
+ return (int)(p->key == next->key);
+
+}
+
+int foo (S1 *root, int N)
+{
+ volatile int r;
+ int i,j;
+ for (i=0; i<N; i++)
+ for (j=0;j<1024; j++)
+ r = bar(&a[j], root);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "key" 4 "pre" } } */
+/* { dg-final { cleanup-tree-dump "pre" } } */
diff --git a/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c b/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c
new file mode 100644
index 00000000000..61b90105364
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/c-shift-1.c
@@ -0,0 +1,18 @@
+/* { dg-do compile} */
+/* { dg-options "-fsanitize=shift -w" } */
+/* { dg-shouldfail "ubsan" } */
+
+int x;
+int
+main (void)
+{
+ /* None of the following should pass. */
+ int A[1 >> -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+ int B[-1 >> -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+ int D[1 << -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+ int E[-1 << -1] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+ int F[-1 >> 200] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+ int G[1 << 200] = {}; /* { dg-error "variable-sized object may not be initialized" } */
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c
new file mode 100644
index 00000000000..8ba823b044c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s16c.c
@@ -0,0 +1,73 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+#define DOT 43680
+
+signed short X[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed int Y[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+/* (short, int)->int->int dot product.
+ Not detected as a dot-product pattern. */
+
+__attribute__ ((noinline)) int
+foo (int len)
+{
+ int i;
+ int result = 0;
+
+ for (i = 0; i < len; i++)
+ {
+ result += (X[i] * Y[i]);
+ }
+ return result;
+}
+
+
+/* (int, short)->int->int dot product.
+ Not detected as a dot-product pattern. */
+
+__attribute__ ((noinline)) int
+bar (int len)
+{
+ int i;
+ int result = 0;
+
+ for (i = 0; i < len; i++)
+ {
+ result += (Y[i] * X[i]);
+ }
+ return result;
+}
+
+int
+main (void)
+{
+ int i;
+ int dot;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ X[i] = i;
+ Y[i] = N - i;
+ __asm__ volatile ("");
+ }
+
+ dot = foo (N);
+ if (dot != DOT)
+ abort ();
+
+ dot = bar (N);
+ if (dot != DOT)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_unpack } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.misc-tests/help.exp b/gcc/testsuite/gcc.misc-tests/help.exp
index 7ad53926a53..20153d12496 100644
--- a/gcc/testsuite/gcc.misc-tests/help.exp
+++ b/gcc/testsuite/gcc.misc-tests/help.exp
@@ -55,11 +55,11 @@ check_for_options c "--help=target,optimizers" "" "" ""
check_for_options c "--help=warnings,^joined,^undocumented" "" "" ""
check_for_options c "-Q -O2 --help=optimizers" {
-O
--ftree-vectorize[^\n]*disabled
+-ftree-loop-vectorize[^\n]*disabled
} " -g " ""
check_for_options c "-Q -O3 --help=optimizers" {
-O
--ftree-vectorize[^\n]*enabled
+-ftree-loop-vectorize[^\n]*enabled
} " -g " ""
# Try repeated --help=.
check_for_options c "--help=params --help=optimizers" {
diff --git a/gcc/testsuite/gcc.target/aarch64/fmla_intrinsic_1.c b/gcc/testsuite/gcc.target/aarch64/fmla_intrinsic_1.c
new file mode 100644
index 00000000000..0bf1b86b79e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/fmla_intrinsic_1.c
@@ -0,0 +1,116 @@
+/* { dg-do run } */
+/* { dg-options "-O3 --save-temps" } */
+
+#include <arm_neon.h>
+
+#define DELTA 0.0001
+
+extern double fabs (double);
+
+extern void abort (void);
+
+#define TEST_VMLA(q1, q2, size, in1_lanes, in2_lanes) \
+static void \
+test_vfma##q1##_lane##q2##_f##size (float##size##_t * res, \
+ const float##size##_t *in1, \
+ const float##size##_t *in2) \
+{ \
+ float##size##x##in1_lanes##_t a = vld1##q1##_f##size (res); \
+ float##size##x##in1_lanes##_t b = vld1##q1##_f##size (in1); \
+ float##size##x##in2_lanes##_t c; \
+ if (in2_lanes > 1) \
+ { \
+ c = vld1##q2##_f##size (in2); \
+ a = vfma##q1##_lane##q2##_f##size (a, b, c, 1); \
+ } \
+ else \
+ { \
+ c = vld1##q2##_f##size (in2 + 1); \
+ a = vfma##q1##_lane##q2##_f##size (a, b, c, 0); \
+ } \
+ vst1##q1##_f##size (res, a); \
+}
+
+#define BUILD_VARS(width, n_lanes, n_half_lanes) \
+TEST_VMLA ( , , width, n_half_lanes, n_half_lanes) \
+TEST_VMLA (q, , width, n_lanes, n_half_lanes) \
+TEST_VMLA ( , q, width, n_half_lanes, n_lanes) \
+TEST_VMLA (q, q, width, n_lanes, n_lanes) \
+
+BUILD_VARS (32, 4, 2)
+BUILD_VARS (64, 2, 1)
+
+#define POOL2 {0.0, 1.0}
+#define POOL4 {0.0, 1.0, 2.0, 3.0}
+#define EMPTY2 {0.0, 0.0}
+#define EMPTY4 {0.0, 0.0, 0.0, 0.0}
+
+#define BUILD_TEST(size, lanes) \
+static void \
+test_f##size (void) \
+{ \
+ int i; \
+ float##size##_t pool[lanes] = POOL##lanes; \
+ float##size##_t res[lanes] = EMPTY##lanes; \
+ float##size##_t res2[lanes] = EMPTY##lanes; \
+ float##size##_t res3[lanes] = EMPTY##lanes; \
+ float##size##_t res4[lanes] = EMPTY##lanes; \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vfma_lane_f##size (res, pool, pool); \
+ for (i = 0; i < lanes / 2; i++) \
+ if (fabs (res[i] - pool[i]) > DELTA) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vfmaq_lane_f##size (res2, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (fabs (res2[i] - pool[i]) > DELTA) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vfma_laneq_f##size (res3, pool, pool); \
+ for (i = 0; i < lanes / 2; i++) \
+ if (fabs (res3[i] - pool[i]) > DELTA) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vfmaq_laneq_f##size (res4, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (fabs (res4[i] - pool[i]) > DELTA) \
+ abort (); \
+}
+
+BUILD_TEST (32, 4)
+BUILD_TEST (64, 2)
+
+int
+main (int argc, char **argv)
+{
+ test_f32 ();
+ test_f64 ();
+ return 0;
+}
+
+/* vfma_laneq_f32.
+ vfma_lane_f32. */
+/* { dg-final { scan-assembler-times "fmla\\tv\[0-9\]+\.2s, v\[0-9\]+\.2s, v\[0-9\]+\.2s\\\[\[0-9\]+\\\]" 2 } } */
+
+/* vfmaq_lane_f32.
+ vfmaq_laneq_f32. */
+/* { dg-final { scan-assembler-times "fmla\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s\\\[\[0-9\]+\\\]" 2 } } */
+
+/* vfma_lane_f64. */
+/* { dg-final { scan-assembler-times "fmadd\\td\[0-9\]+\, d\[0-9\]+\, d\[0-9\]+\, d\[0-9\]+" 1 } } */
+
+/* vfmaq_lane_f64.
+ vfma_laneq_f64.
+ vfmaq_laneq_f64. */
+/* { dg-final { scan-assembler-times "fmla\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, v\[0-9\]+\.2d\\\[\[0-9\]+\\\]" 3 } } */
+
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/fmls_intrinsic_1.c b/gcc/testsuite/gcc.target/aarch64/fmls_intrinsic_1.c
new file mode 100644
index 00000000000..8cc2942f8f1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/fmls_intrinsic_1.c
@@ -0,0 +1,117 @@
+/* { dg-do run } */
+/* { dg-options "-O3 --save-temps" } */
+
+#include <arm_neon.h>
+
+#define DELTA 0.0001
+
+extern double fabs (double);
+
+extern void abort (void);
+
+#define TEST_VMLS(q1, q2, size, in1_lanes, in2_lanes) \
+static void \
+test_vfms##q1##_lane##q2##_f##size (float##size##_t * res, \
+ const float##size##_t *in1, \
+ const float##size##_t *in2) \
+{ \
+ float##size##x##in1_lanes##_t a = vld1##q1##_f##size (res); \
+ float##size##x##in1_lanes##_t b = vld1##q1##_f##size (in1); \
+ float##size##x##in2_lanes##_t c; \
+ if (in2_lanes > 1) \
+ { \
+ c = vld1##q2##_f##size (in2); \
+ a = vfms##q1##_lane##q2##_f##size (a, b, c, 1); \
+ } \
+ else \
+ { \
+ c = vld1##q2##_f##size (in2 + 1); \
+ a = vfms##q1##_lane##q2##_f##size (a, b, c, 0); \
+ } \
+ vst1##q1##_f##size (res, a); \
+}
+
+#define BUILD_VARS(width, n_lanes, n_half_lanes) \
+TEST_VMLS ( , , width, n_half_lanes, n_half_lanes) \
+TEST_VMLS (q, , width, n_lanes, n_half_lanes) \
+TEST_VMLS ( , q, width, n_half_lanes, n_lanes) \
+TEST_VMLS (q, q, width, n_lanes, n_lanes) \
+
+BUILD_VARS (32, 4, 2)
+BUILD_VARS (64, 2, 1)
+
+#define POOL2 {0.0, 1.0}
+#define POOL4 {0.0, 1.0, 2.0, 3.0}
+#define EMPTY2 {0.0, 0.0}
+#define EMPTY4 {0.0, 0.0, 0.0, 0.0}
+
+#define BUILD_TEST(size, lanes) \
+static void \
+test_f##size (void) \
+{ \
+ int i; \
+ float##size##_t pool[lanes] = POOL##lanes; \
+ float##size##_t res[lanes] = EMPTY##lanes; \
+ float##size##_t res2[lanes] = EMPTY##lanes; \
+ float##size##_t res3[lanes] = EMPTY##lanes; \
+ float##size##_t res4[lanes] = EMPTY##lanes; \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vfms_lane_f##size (res, pool, pool); \
+ asm volatile ("" : :"Q" (res) : "memory"); \
+ for (i = 0; i < lanes / 2; i++) \
+ if (fabs (res[i] + pool[i]) > DELTA) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ test_vfmsq_lane_f##size (res2, pool, pool); \
+ asm volatile ("" : :"Q" (res2) : "memory"); \
+ for (i = 0; i < lanes; i++) \
+ if (fabs (res2[i] + pool[i]) > DELTA) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ test_vfms_laneq_f##size (res3, pool, pool); \
+ asm volatile ("" : :"Q" (res3) : "memory"); \
+ for (i = 0; i < lanes / 2; i++) \
+ if (fabs (res3[i] + pool[i]) > DELTA) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ test_vfmsq_laneq_f##size (res4, pool, pool); \
+ asm volatile ("" : :"Q" (res4) : "memory"); \
+ for (i = 0; i < lanes; i++) \
+ if (fabs (res4[i] + pool[i]) > DELTA) \
+ abort (); \
+}
+
+BUILD_TEST (32, 4)
+BUILD_TEST (64, 2)
+
+int
+main (int argc, char **argv)
+{
+ test_f32 ();
+ test_f64 ();
+ return 0;
+}
+
+/* vfms_laneq_f32.
+ vfms_lane_f32. */
+/* { dg-final { scan-assembler-times "fmls\\tv\[0-9\]+\.2s, v\[0-9\]+\.2s, v\[0-9\]+\.2s\\\[\[0-9\]+\\\]" 2 } } */
+
+/* vfmsq_lane_f32.
+ vfmsq_laneq_f32. */
+/* { dg-final { scan-assembler-times "fmls\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s\\\[\[0-9\]+\\\]" 2 } } */
+
+/* vfms_lane_f64. */
+/* { dg-final { scan-assembler-times "fmsub\\td\[0-9\]+\, d\[0-9\]+\, d\[0-9\]+\, d\[0-9\]+" 1 } } */
+
+/* vfmsq_lane_f64.
+ vfms_laneq_f64.
+ vfmsq_laneq_f64. */
+/* { dg-final { scan-assembler-times "fmls\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, v\[0-9\]+\.2d\\\[\[0-9\]+\\\]" 3 } } */
+
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/fmul_intrinsic_1.c b/gcc/testsuite/gcc.target/aarch64/fmul_intrinsic_1.c
new file mode 100644
index 00000000000..f6e32f4bf77
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/fmul_intrinsic_1.c
@@ -0,0 +1,116 @@
+/* { dg-do run } */
+/* { dg-options "-O3 --save-temps" } */
+
+#include <arm_neon.h>
+
+#define DELTA 0.0001
+extern void abort (void);
+extern double fabs (double);
+
+#define TEST_VMUL(q1, q2, size, in1_lanes, in2_lanes) \
+static void \
+test_vmul##q1##_lane##q2##_f##size (float##size##_t * res, \
+ const float##size##_t *in1, \
+ const float##size##_t *in2) \
+{ \
+ float##size##x##in1_lanes##_t a = vld1##q1##_f##size (res); \
+ float##size##x##in1_lanes##_t b = vld1##q1##_f##size (in1); \
+ float##size##x##in2_lanes##_t c; \
+ if (in2_lanes > 1) \
+ { \
+ c = vld1##q2##_f##size (in2); \
+ a = vmul##q1##_lane##q2##_f##size (b, c, 1); \
+ } \
+ else \
+ { \
+ c = vld1##q2##_f##size (in2 + 1); \
+ a = vmul##q1##_lane##q2##_f##size (b, c, 0); \
+ } \
+ vst1##q1##_f##size (res, a); \
+}
+
+#define BUILD_VARS(width, n_lanes, n_half_lanes) \
+TEST_VMUL ( , , width, n_half_lanes, n_half_lanes) \
+TEST_VMUL (q, , width, n_lanes, n_half_lanes) \
+TEST_VMUL ( , q, width, n_half_lanes, n_lanes) \
+TEST_VMUL (q, q, width, n_lanes, n_lanes)
+
+BUILD_VARS (32, 4, 2)
+BUILD_VARS (64, 2, 1)
+
+#define POOL2 {0.0, 1.0}
+#define POOL4 {0.0, 1.0, 2.0, 3.0}
+#define EMPTY2 {0.0, 0.0}
+#define EMPTY4 {0.0, 0.0, 0.0, 0.0}
+
+#define BUILD_TEST(size, lanes) \
+static void \
+test_f##size (void) \
+{ \
+ int i; \
+ float##size##_t pool[lanes] = POOL##lanes; \
+ float##size##_t res[lanes] = EMPTY##lanes; \
+ float##size##_t res2[lanes] = EMPTY##lanes; \
+ float##size##_t res3[lanes] = EMPTY##lanes; \
+ float##size##_t res4[lanes] = EMPTY##lanes; \
+ \
+ /* Avoid constant folding the multiplication. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmul_lane_f##size (res, pool, pool); \
+ /* Avoid fusing multiplication and subtraction. */ \
+ asm volatile ("" : :"Q" (res) : "memory"); \
+ for (i = 0; i < lanes / 2; i++) \
+ if (fabs (res[i] - pool[i]) > DELTA) \
+ abort (); \
+ \
+ test_vmulq_lane_f##size (res2, pool, pool); \
+ /* Avoid fusing multiplication and subtraction. */ \
+ asm volatile ("" : :"Q" (res2) : "memory"); \
+ for (i = 0; i < lanes; i++) \
+ if (fabs (res2[i] - pool[i]) > DELTA) \
+ abort (); \
+ \
+ test_vmul_laneq_f##size (res3, pool, pool); \
+ /* Avoid fusing multiplication and subtraction. */ \
+ asm volatile ("" : :"Q" (res3) : "memory"); \
+ for (i = 0; i < lanes / 2; i++) \
+ if (fabs (res3[i] - pool[i]) > DELTA) \
+ abort (); \
+ \
+ test_vmulq_laneq_f##size (res4, pool, pool); \
+ /* Avoid fusing multiplication and subtraction. */ \
+ asm volatile ("" : :"Q" (res4) : "memory"); \
+ for (i = 0; i < lanes; i++) \
+ if (fabs (res4[i] - pool[i]) > DELTA) \
+ abort (); \
+}
+
+BUILD_TEST (32, 4)
+BUILD_TEST (64, 2)
+
+int
+main (int argc, char **argv)
+{
+ test_f32 ();
+ test_f64 ();
+ return 0;
+}
+
+/* vmul_laneq_f32.
+ vmul_lane_f32. */
+/* { dg-final { scan-assembler-times "fmul\\tv\[0-9\]+\.2s, v\[0-9\]+\.2s, v\[0-9\]+\.s\\\[\[0-9\]+\\\]" 2 } } */
+
+/* vmulq_lane_f32.
+ vmulq_laneq_f32. */
+/* { dg-final { scan-assembler-times "fmul\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.s\\\[\[0-9\]+\\\]" 2 } } */
+
+/* vmul_lane_f64. */
+/* { dg-final { scan-assembler-times "fmul\\td\[0-9\]+, d\[0-9\]+, d\[0-9\]+" 1 } } */
+
+/* vmul_laneq_f64.
+ vmulq_lane_f64.
+ vmulq_laneq_f64. */
+/* { dg-final { scan-assembler-times "fmul\\tv\[0-9\]+\.2d, v\[0-9\]+\.2d, v\[0-9\]+\.d\\\[\[0-9\]+\\\]" 3 } } */
+
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/mla_intrinsic_1.c b/gcc/testsuite/gcc.target/aarch64/mla_intrinsic_1.c
new file mode 100644
index 00000000000..fce41387354
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/mla_intrinsic_1.c
@@ -0,0 +1,84 @@
+/* { dg-do run } */
+/* { dg-options "-O3 --save-temps" } */
+
+#include <arm_neon.h>
+
+extern void abort (void);
+
+#define MAPs(size, xx) int##size##xx##_t
+#define MAPu(size, xx) uint##size##xx##_t
+
+
+#define TEST_VMLA(q, su, size, in1_lanes, in2_lanes) \
+static void \
+test_vmlaq_lane##q##_##su##size (MAP##su (size, ) * res, \
+ const MAP##su(size, ) *in1, \
+ const MAP##su(size, ) *in2) \
+{ \
+ MAP##su (size, x##in1_lanes) a = vld1q_##su##size (res); \
+ MAP##su (size, x##in1_lanes) b = vld1q_##su##size (in1); \
+ MAP##su (size, x##in2_lanes) c = vld1##q##_##su##size (in2); \
+ a = vmlaq_lane##q##_##su##size (a, b, c, 1); \
+ vst1q_##su##size (res, a); \
+}
+
+#define BUILD_VARS(width, n_lanes, n_half_lanes) \
+TEST_VMLA (, s, width, n_lanes, n_half_lanes) \
+TEST_VMLA (q, s, width, n_lanes, n_lanes) \
+TEST_VMLA (, u, width, n_lanes, n_half_lanes) \
+TEST_VMLA (q, u, width, n_lanes, n_lanes) \
+
+BUILD_VARS (32, 4, 2)
+BUILD_VARS (16, 8, 4)
+
+#define POOL4 {0, 1, 2, 3}
+#define POOL8 {0, 1, 2, 3, 4, 5, 6, 7}
+#define EMPTY4 {0, 0, 0, 0}
+#define EMPTY8 {0, 0, 0, 0, 0, 0, 0, 0}
+
+#define BUILD_TEST(su, size, lanes) \
+static void \
+test_##su##size (void) \
+{ \
+ int i; \
+ MAP##su (size,) pool[lanes] = POOL##lanes; \
+ MAP##su (size,) res[lanes] = EMPTY##lanes; \
+ MAP##su (size,) res2[lanes] = EMPTY##lanes; \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmlaq_lane_##su##size (res, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (res[i] != pool[i]) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmlaq_laneq_##su##size (res2, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (res2[i] != pool[i]) \
+ abort (); \
+}
+
+#undef BUILD_VARS
+#define BUILD_VARS(size, lanes) \
+BUILD_TEST (s, size, lanes) \
+BUILD_TEST (u, size, lanes)
+
+BUILD_VARS (32, 4)
+BUILD_VARS (16, 8)
+
+int
+main (int argc, char **argv)
+{
+ test_s32 ();
+ test_u32 ();
+ test_s16 ();
+ test_u16 ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times "mla\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s\\\[\[0-9\]+\\\]" 4 } } */
+/* { dg-final { scan-assembler-times "mla\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h\\\[\[0-9\]+\\\]" 4 } } */
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/mls_intrinsic_1.c b/gcc/testsuite/gcc.target/aarch64/mls_intrinsic_1.c
new file mode 100644
index 00000000000..8bf95b641c8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/mls_intrinsic_1.c
@@ -0,0 +1,89 @@
+/* { dg-do run } */
+/* { dg-options "-O3 --save-temps" } */
+
+#include <arm_neon.h>
+
+extern void abort (void);
+
+#define MAPs(size, xx) int##size##xx##_t
+#define MAPu(size, xx) uint##size##xx##_t
+
+
+#define TEST_VMLS(q, su, size, in1_lanes, in2_lanes) \
+static void \
+test_vmlsq_lane##q##_##su##size (MAP##su (size, ) * res, \
+ const MAP##su(size, ) *in1, \
+ const MAP##su(size, ) *in2) \
+{ \
+ MAP##su (size, x##in1_lanes) a = vld1q_##su##size (res); \
+ MAP##su (size, x##in1_lanes) b = vld1q_##su##size (in1); \
+ MAP##su (size, x##in2_lanes) c = vld1##q##_##su##size (in2); \
+ a = vmlsq_lane##q##_##su##size (a, b, c, 1); \
+ vst1q_##su##size (res, a); \
+}
+
+#define BUILD_VARS(width, n_lanes, n_half_lanes) \
+TEST_VMLS (, s, width, n_lanes, n_half_lanes) \
+TEST_VMLS (q, s, width, n_lanes, n_lanes) \
+TEST_VMLS (, u, width, n_lanes, n_half_lanes) \
+TEST_VMLS (q, u, width, n_lanes, n_lanes) \
+
+BUILD_VARS (32, 4, 2)
+BUILD_VARS (16, 8, 4)
+
+#define MAP_OPs +
+#define MAP_OPu -
+
+#define POOL4 {0, 1, 2, 3}
+#define POOL8 {0, 1, 2, 3, 4, 5, 6, 7}
+#define EMPTY4s {0, 0, 0, 0}
+#define EMPTY8s {0, 0, 0, 0, 0, 0, 0, 0}
+#define EMPTY4u {0, 2, 4, 6}
+#define EMPTY8u {0, 2, 4, 6, 8, 10, 12, 14}
+
+#define BUILD_TEST(su, size, lanes) \
+static void \
+test_##su##size (void) \
+{ \
+ int i; \
+ MAP##su (size,) pool[lanes] = POOL##lanes; \
+ MAP##su (size,) res[lanes] = EMPTY##lanes##su; \
+ MAP##su (size,) res2[lanes] = EMPTY##lanes##su; \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmlsq_lane_##su##size (res, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (res[i] MAP_OP##su pool[i] != 0) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmlsq_laneq_##su##size (res2, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (res2[i] MAP_OP##su pool[i] != 0) \
+ abort (); \
+}
+
+#undef BUILD_VARS
+#define BUILD_VARS(size, lanes) \
+BUILD_TEST (s, size, lanes) \
+BUILD_TEST (u, size, lanes)
+
+BUILD_VARS (32, 4)
+BUILD_VARS (16, 8)
+
+int
+main (int argc, char **argv)
+{
+ test_s32 ();
+ test_u32 ();
+ test_s16 ();
+ test_u16 ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times "mls\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.4s\\\[\[0-9\]+\\\]" 4 } } */
+/* { dg-final { scan-assembler-times "mls\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.8h\\\[\[0-9\]+\\\]" 4 } } */
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/aarch64/mul_intrinsic_1.c b/gcc/testsuite/gcc.target/aarch64/mul_intrinsic_1.c
new file mode 100644
index 00000000000..dabe10e15e5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/mul_intrinsic_1.c
@@ -0,0 +1,83 @@
+/* { dg-do run } */
+/* { dg-options "-O3 --save-temps" } */
+
+#include <arm_neon.h>
+
+extern void abort (void);
+
+#define MAPs(size, xx) int##size##xx##_t
+#define MAPu(size, xx) uint##size##xx##_t
+
+
+#define TEST_VMUL(q, su, size, in1_lanes, in2_lanes) \
+static void \
+test_vmulq_lane##q##_##su##size (MAP##su (size, ) * res, \
+ const MAP##su(size, ) *in1, \
+ const MAP##su(size, ) *in2) \
+{ \
+ MAP##su (size, x##in1_lanes) a = vld1q_##su##size (in1); \
+ MAP##su (size, x##in2_lanes) b = vld1##q##_##su##size (in2); \
+ a = vmulq_lane##q##_##su##size (a, b, 1); \
+ vst1q_##su##size (res, a); \
+}
+
+#define BUILD_VARS(width, n_lanes, n_half_lanes) \
+TEST_VMUL (, s, width, n_lanes, n_half_lanes) \
+TEST_VMUL (q, s, width, n_lanes, n_lanes) \
+TEST_VMUL (, u, width, n_lanes, n_half_lanes) \
+TEST_VMUL (q, u, width, n_lanes, n_lanes) \
+
+BUILD_VARS (32, 4, 2)
+BUILD_VARS (16, 8, 4)
+
+#define POOL4 {0, 1, 2, 3}
+#define POOL8 {0, 1, 2, 3, 4, 5, 6, 7}
+#define EMPTY4 {0, 0, 0, 0}
+#define EMPTY8 {0, 0, 0, 0, 0, 0, 0, 0}
+
+#define BUILD_TEST(su, size, lanes) \
+static void \
+test_##su##size (void) \
+{ \
+ int i; \
+ MAP##su (size,) pool[lanes] = POOL##lanes; \
+ MAP##su (size,) res[lanes] = EMPTY##lanes; \
+ MAP##su (size,) res2[lanes] = EMPTY##lanes; \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmulq_lane_##su##size (res, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (res[i] != pool[i]) \
+ abort (); \
+ \
+ /* Forecfully avoid optimization. */ \
+ asm volatile ("" : : : "memory"); \
+ test_vmulq_laneq_##su##size (res2, pool, pool); \
+ for (i = 0; i < lanes; i++) \
+ if (res2[i] != pool[i]) \
+ abort (); \
+}
+
+#undef BUILD_VARS
+#define BUILD_VARS(size, lanes) \
+BUILD_TEST (s, size, lanes) \
+BUILD_TEST (u, size, lanes)
+
+BUILD_VARS (32, 4)
+BUILD_VARS (16, 8)
+
+int
+main (int argc, char **argv)
+{
+ test_s32 ();
+ test_u32 ();
+ test_s16 ();
+ test_u16 ();
+ return 0;
+}
+
+/* { dg-final { scan-assembler-times "mul\\tv\[0-9\]+\.4s, v\[0-9\]+\.4s, v\[0-9\]+\.s\\\[\[0-9\]+\\\]" 4 } } */
+/* { dg-final { scan-assembler-times "mul\\tv\[0-9\]+\.8h, v\[0-9\]+\.8h, v\[0-9\]+\.h\\\[\[0-9\]+\\\]" 4 } } */
+/* { dg-final { cleanup-saved-temps } } */
+
diff --git a/gcc/testsuite/gcc.target/arc/barrel-shifter-1.c b/gcc/testsuite/gcc.target/arc/barrel-shifter-1.c
new file mode 100644
index 00000000000..a0eb6d70c39
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/barrel-shifter-1.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcpu=ARC601 -mbarrel-shifter" } */
+int i;
+
+int f (void)
+{
+ i >>= 2;
+}
+
+/* { dg-final { scan-assembler "asr_s" } } */
diff --git a/gcc/testsuite/gcc.target/arc/barrel-shifter-2.c b/gcc/testsuite/gcc.target/arc/barrel-shifter-2.c
new file mode 100644
index 00000000000..97998fbf1a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/barrel-shifter-2.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+int i;
+
+int f (void)
+{
+ i >>= 2;
+}
+
+/* { dg-final { scan-assembler "asr_s" } } */
diff --git a/gcc/testsuite/gcc.target/arc/long-calls.c b/gcc/testsuite/gcc.target/arc/long-calls.c
new file mode 100644
index 00000000000..63fafbcc674
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/long-calls.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-calls" } */
+
+int g (void);
+
+int f (void)
+{
+ g();
+}
+
+/* { dg-final { scan-assembler "j @g" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mA6.c b/gcc/testsuite/gcc.target/arc/mA6.c
new file mode 100644
index 00000000000..2e15a86f8a4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mA6.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mA6" } */
+
+/* { dg-final { scan-assembler ".cpu ARC600" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mA7.c b/gcc/testsuite/gcc.target/arc/mA7.c
new file mode 100644
index 00000000000..c4430f43b41
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mA7.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mA7" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mARC600.c b/gcc/testsuite/gcc.target/arc/mARC600.c
new file mode 100644
index 00000000000..20e086aa754
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mARC600.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mARC600" } */
+
+/* { dg-final { scan-assembler ".cpu ARC600" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mARC601.c b/gcc/testsuite/gcc.target/arc/mARC601.c
new file mode 100644
index 00000000000..1d30da4cafb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mARC601.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mARC601" } */
+
+/* { dg-final { scan-assembler ".cpu ARC601" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mARC700.c b/gcc/testsuite/gcc.target/arc/mARC700.c
new file mode 100644
index 00000000000..43e9baa3f30
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mARC700.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mARC700" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mcpu-arc600.c b/gcc/testsuite/gcc.target/arc/mcpu-arc600.c
new file mode 100644
index 00000000000..4c915fda0e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mcpu-arc600.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ARC600" } */
+
+/* { dg-final { scan-assembler ".cpu ARC600" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mcpu-arc601.c b/gcc/testsuite/gcc.target/arc/mcpu-arc601.c
new file mode 100644
index 00000000000..7c93c9dc4ac
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mcpu-arc601.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ARC601" } */
+
+/* { dg-final { scan-assembler ".cpu ARC601" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mcpu-arc700.c b/gcc/testsuite/gcc.target/arc/mcpu-arc700.c
new file mode 100644
index 00000000000..c805a5af76b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mcpu-arc700.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=ARC700" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mcrc.c b/gcc/testsuite/gcc.target/arc/mcrc.c
new file mode 100644
index 00000000000..d3780bb00d6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mcrc.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mcrc" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("crc %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mdpfp.c b/gcc/testsuite/gcc.target/arc/mdpfp.c
new file mode 100644
index 00000000000..4bbc9057b85
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mdpfp.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdpfp" } */
+
+double i;
+
+int f (void)
+{
+ i *= 2.0;
+}
+
+/* { dg-final { scan-assembler "daddh" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mdsp-packa.c b/gcc/testsuite/gcc.target/arc/mdsp-packa.c
new file mode 100644
index 00000000000..f013a6dd1ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mdsp-packa.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mdsp-packa" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("minidl %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mdvbf.c b/gcc/testsuite/gcc.target/arc/mdvbf.c
new file mode 100644
index 00000000000..e2e545e8bb3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mdvbf.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mdvbf" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("vbfdw %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mlock.c b/gcc/testsuite/gcc.target/arc/mlock.c
new file mode 100644
index 00000000000..3a8b050c30e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mlock.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mlock" } */
+/* { dg-do assemble } */
+
+int f (void *p)
+{
+ int i;
+
+ __asm__("llock %0, [%1]\n\t"
+ "scond %0, [%1]" : "=&r"(i) : "r"(p));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mmac-24.c b/gcc/testsuite/gcc.target/arc/mmac-24.c
new file mode 100644
index 00000000000..30cb6981a03
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mmac-24.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mmac-24" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("mult %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mmac-d16.c b/gcc/testsuite/gcc.target/arc/mmac-d16.c
new file mode 100644
index 00000000000..0570011fd26
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mmac-d16.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mmac-d16" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("muldw %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-crc.c b/gcc/testsuite/gcc.target/arc/mno-crc.c
new file mode 100644
index 00000000000..70ab9c11761
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-crc.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-crc" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("crc %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-dsp-packa.c b/gcc/testsuite/gcc.target/arc/mno-dsp-packa.c
new file mode 100644
index 00000000000..eb21522af06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-dsp-packa.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-dsp-packa" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("minidl %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-dvbf.c b/gcc/testsuite/gcc.target/arc/mno-dvbf.c
new file mode 100644
index 00000000000..ea96d987c18
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-dvbf.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-dvbf" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("vbfdw %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-lock.c b/gcc/testsuite/gcc.target/arc/mno-lock.c
new file mode 100644
index 00000000000..62ac885ba99
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-lock.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-lock" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (void *p)
+{
+ int i;
+
+ __asm__("llock %0, [%1]\n\t"
+ "scond %0, [%1]" : "=&r"(i) : "r"(p));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-mac-24.c b/gcc/testsuite/gcc.target/arc/mno-mac-24.c
new file mode 100644
index 00000000000..b4839579b12
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-mac-24.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-mac-24" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("mult %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-mac-d16.c b/gcc/testsuite/gcc.target/arc/mno-mac-d16.c
new file mode 100644
index 00000000000..68a20f4f55a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-mac-d16.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-mac-d16" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("muldw %1, %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-rtsc.c b/gcc/testsuite/gcc.target/arc/mno-rtsc.c
new file mode 100644
index 00000000000..d74a60e9351
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-rtsc.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-rtsc" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("rtsc %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-swape.c b/gcc/testsuite/gcc.target/arc/mno-swape.c
new file mode 100644
index 00000000000..c853ab4bdcc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-swape.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-swape" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+int f (int i)
+{
+ __asm__("swape %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mno-xy.c b/gcc/testsuite/gcc.target/arc/mno-xy.c
new file mode 100644
index 00000000000..e378b3fc9b6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mno-xy.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-mno-xy" } */
+/* Would also like to assemble and check that we get the expected
+ "Error: bad instruction" assembler messages, but at the moment our
+ testharness can't do that. */
+
+void f (int i)
+{
+ __asm__("add x0_u0, x0_u0, %0" : : "r" (i));
+}
diff --git a/gcc/testsuite/gcc.target/arc/mrtsc.c b/gcc/testsuite/gcc.target/arc/mrtsc.c
new file mode 100644
index 00000000000..31852a5e479
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mrtsc.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mrtsc" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("rtsc %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mspfp.c b/gcc/testsuite/gcc.target/arc/mspfp.c
new file mode 100644
index 00000000000..0e41ff89d35
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mspfp.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mspfp" } */
+
+float i;
+
+int f (void)
+{
+ i *= 2.0;
+}
+
+/* { dg-final { scan-assembler "fadd" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mswape.c b/gcc/testsuite/gcc.target/arc/mswape.c
new file mode 100644
index 00000000000..692e6a2bb6e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mswape.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-mswape" } */
+/* { dg-do assemble } */
+
+int f (int i)
+{
+ __asm__("swape %1, %1" : "=r"(i) : "r"(i));
+ return i;
+}
diff --git a/gcc/testsuite/gcc.target/arc/mtune-ARC600.c b/gcc/testsuite/gcc.target/arc/mtune-ARC600.c
new file mode 100644
index 00000000000..a483d1435ca
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mtune-ARC600.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=ARC600" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mtune-ARC601.c b/gcc/testsuite/gcc.target/arc/mtune-ARC601.c
new file mode 100644
index 00000000000..ed57bd7092d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mtune-ARC601.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=ARC601" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mtune-ARC700-xmac b/gcc/testsuite/gcc.target/arc/mtune-ARC700-xmac
new file mode 100644
index 00000000000..2f1e137be4d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mtune-ARC700-xmac
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=ARC700-xmac" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mtune-ARC700.c b/gcc/testsuite/gcc.target/arc/mtune-ARC700.c
new file mode 100644
index 00000000000..851ea7305e0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mtune-ARC700.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=ARC700" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mtune-ARC725D.c b/gcc/testsuite/gcc.target/arc/mtune-ARC725D.c
new file mode 100644
index 00000000000..e2aa4846291
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mtune-ARC725D.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=ARC725D" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mtune-ARC750D.c b/gcc/testsuite/gcc.target/arc/mtune-ARC750D.c
new file mode 100644
index 00000000000..20923300ee1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mtune-ARC750D.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-mtune=ARC750D" } */
+
+/* { dg-final { scan-assembler ".cpu ARC700" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mul64.c b/gcc/testsuite/gcc.target/arc/mul64.c
new file mode 100644
index 00000000000..3678b2799d5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mul64.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcpu=ARC600 -mmul64" } */
+#include <stdint.h>
+
+int64_t i;
+int j, k;
+
+int f (void)
+{
+ i = j * k;
+}
+
+/* { dg-final { scan-assembler "mul64" } } */
diff --git a/gcc/testsuite/gcc.target/arc/mxy.c b/gcc/testsuite/gcc.target/arc/mxy.c
new file mode 100644
index 00000000000..1ecc34d2bdb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/mxy.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-mxy" } */
+/* { dg-do assemble } */
+
+void f (int i)
+{
+ __asm__("add x0_u0, x0_u0, %0" : : "r" (i));
+}
diff --git a/gcc/testsuite/gcc.target/arc/no-dpfp-lrsr.c b/gcc/testsuite/gcc.target/arc/no-dpfp-lrsr.c
new file mode 100644
index 00000000000..e4e23e4a40f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/no-dpfp-lrsr.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mdpfp -mno-dpfp-lrsr" } */
+
+double i;
+
+int f (void)
+{
+ i *= 2.0;
+}
+
+/* { dg-final { scan-assembler-not "\tlr" } } */
diff --git a/gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire.c b/gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire.c
index 1eabb26ef4d..ea6fdd96db1 100644
--- a/gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire.c
+++ b/gcc/testsuite/gcc.target/arm/atomic-comp-swap-release-acquire.c
@@ -5,6 +5,6 @@
#include "../aarch64/atomic-comp-swap-release-acquire.x"
-/* { dg-final { scan-assembler-times "ldaex\tr\[0-9\]+, \\\[r\[0-9\]+\\\]" 4 } } */
+/* { dg-final { scan-assembler-times "ldaex" 4 } } */
/* { dg-final { scan-assembler-times "stlex" 4 } } */
/* { dg-final { scan-assembler-not "dmb" } } */
diff --git a/gcc/testsuite/gcc.target/arm/minmax_minus.c b/gcc/testsuite/gcc.target/arm/minmax_minus.c
index 4c2dcdf8ec0..906342a87cf 100644
--- a/gcc/testsuite/gcc.target/arm/minmax_minus.c
+++ b/gcc/testsuite/gcc.target/arm/minmax_minus.c
@@ -1,4 +1,5 @@
/* { dg-do compile } */
+/* { dg-require-effective-target arm_cond_exec } */
/* { dg-options "-O2" } */
#define MAX(a, b) (a > b ? a : b)
diff --git a/gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c b/gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c
new file mode 100644
index 00000000000..3da9ef080f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/thumb-ifcvt-2.c
@@ -0,0 +1,18 @@
+/* Check that Thumb 16-bit shifts by immediate can be if-converted. */
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+/* { dg-options "-O2 -mthumb" } */
+
+int
+foo (int a, int b)
+{
+ if (a != b)
+ a = a << 1;
+ else
+ a = a >> 1;
+
+ return a + b;
+}
+
+/* { dg-final { scan-assembler "lslne" } } */
+/* { dg-final { scan-assembler "asreq" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr57848.c b/gcc/testsuite/gcc.target/i386/pr57848.c
new file mode 100644
index 00000000000..d26b84c1b48
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr57848.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -m32" } */
+
+extern unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int);
+#pragma GCC target("sse4.2")
+
diff --git a/gcc/testsuite/gcc.target/i386/pr58418.c b/gcc/testsuite/gcc.target/i386/pr58418.c
new file mode 100644
index 00000000000..27634c9c2f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr58418.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+int a, b, *c = &b, d = -1, e, f, *g, *h = &f, **i = &g, j;
+
+unsigned int
+foo (unsigned int p)
+{
+ return p == 0 ? 0 : 1 / p;
+}
+
+static int *
+bar ()
+{
+ *c = *h = foo (d) & (-9 < d);
+ for (e = 0; e; e++)
+ ;
+ return 0;
+}
+
+int
+main ()
+{
+ for (; j; j++)
+ for (;; a--)
+ ;
+ *i = bar ();
+ if (f != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
new file mode 100644
index 00000000000..d0b3eb09ef7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c
@@ -0,0 +1,42 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */
+
+float load_sf (float *p)
+{
+ float f = *p;
+ __asm__ ("# reg %x0" : "+v" (f));
+ return f;
+}
+
+double load_df (double *p)
+{
+ double d = *p;
+ __asm__ ("# reg %x0" : "+v" (d));
+ return d;
+}
+
+double load_dfsf (float *p)
+{
+ double d = (double) *p;
+ __asm__ ("# reg %x0" : "+v" (d));
+ return d;
+}
+
+void store_sf (float *p, float f)
+{
+ __asm__ ("# reg %x0" : "+v" (f));
+ *p = f;
+}
+
+void store_df (double *p, double d)
+{
+ __asm__ ("# reg %x0" : "+v" (d));
+ *p = d;
+}
+
+/* { dg-final { scan-assembler-times "lxsspx" 2 } } */
+/* { dg-final { scan-assembler-times "lxsdx" 1 } } */
+/* { dg-final { scan-assembler-times "stxsspx" 1 } } */
+/* { dg-final { scan-assembler-times "stxsdx" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr58330.c b/gcc/testsuite/gcc.target/powerpc/pr58330.c
new file mode 100644
index 00000000000..76983dd55ab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr58330.c
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-options "-O -mno-popcntb" } */
+/* { dg-final { scan-assembler-not "stwbrx" } } */
+
+void
+write_reverse (unsigned long *addr, unsigned long val)
+{
+ unsigned long reverse = __builtin_bswap64 (val);
+ __atomic_store_n (addr, reverse, __ATOMIC_RELAXED);
+}
diff --git a/gcc/testsuite/gcc.target/sh/torture/pr58314.c b/gcc/testsuite/gcc.target/sh/torture/pr58314.c
new file mode 100644
index 00000000000..61447d84ff9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/torture/pr58314.c
@@ -0,0 +1,102 @@
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-Os" } */
+
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+
+typedef signed short s16;
+
+
+static inline __attribute__((always_inline)) __attribute__((__const__)) __u16 __arch_swab16(__u16 x)
+{
+ __asm__(
+ "swap.b %1, %0"
+ : "=r" (x)
+ : "r" (x));
+ return x;
+}
+
+void u16_add_cpu(__u16 *var)
+{
+ *var = __arch_swab16(*var);
+}
+
+typedef struct xfs_mount {
+ int m_attr_magicpct;
+} xfs_mount_t;
+
+typedef struct xfs_da_args {
+ struct xfs_mount *t_mountp;
+ int index;
+} xfs_da_args_t;
+
+typedef struct xfs_dabuf {
+ void *data;
+} xfs_dabuf_t;
+
+typedef struct xfs_attr_leaf_map {
+ __u16 base;
+ __u16 size;
+} xfs_attr_leaf_map_t;
+typedef struct xfs_attr_leaf_hdr {
+ __u16 count;
+ xfs_attr_leaf_map_t freemap[3];
+} xfs_attr_leaf_hdr_t;
+
+typedef struct xfs_attr_leaf_entry {
+ __u16 nameidx;
+} xfs_attr_leaf_entry_t;
+
+typedef struct xfs_attr_leafblock {
+ xfs_attr_leaf_hdr_t hdr;
+ xfs_attr_leaf_entry_t entries[1];
+} xfs_attr_leafblock_t;
+
+int
+xfs_attr_leaf_remove(xfs_attr_leafblock_t *leaf, xfs_da_args_t *args)
+{
+ xfs_attr_leaf_hdr_t *hdr;
+ xfs_attr_leaf_map_t *map;
+ xfs_attr_leaf_entry_t *entry;
+ int before, after, smallest, entsize;
+ int tablesize, tmp, i;
+ xfs_mount_t *mp;
+ hdr = &leaf->hdr;
+ mp = args->t_mountp;
+
+ entry = &leaf->entries[args->index];
+
+ tablesize = __arch_swab16(hdr->count);
+
+ map = &hdr->freemap[0];
+ tmp = map->size;
+ before = after = -1;
+ smallest = 3 - 1;
+ entsize = xfs_attr_leaf_entsize(leaf, args->index);
+
+ for (i = 0; i < 2; map++, i++) {
+
+ if (map->base == tablesize)
+ u16_add_cpu(&map->base);
+
+ if (__arch_swab16(map->base) + __arch_swab16(map->size) == __arch_swab16(entry->nameidx))
+ before = i;
+ else if (map->base == entsize)
+ after = i;
+ else if (__arch_swab16(map->size) < tmp)
+ smallest = i;
+ }
+
+ if (before >= 0)
+ {
+ map = &hdr->freemap[after];
+ map->base = entry->nameidx;
+
+ }
+
+ map = &hdr->freemap[smallest];
+
+ map->base = __arch_swab16(entry->nameidx);
+
+ return(tmp < mp->m_attr_magicpct);
+}
diff --git a/gcc/testsuite/gcc.target/sh/torture/pr58475.c b/gcc/testsuite/gcc.target/sh/torture/pr58475.c
new file mode 100644
index 00000000000..a1153da8ddb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/torture/pr58475.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target "sh*-*-*" } } */
+
+int
+kerninfo(int __bsx, double tscale)
+{
+ return (
+ (int)(__extension__
+ ({
+ ((((__bsx) & 0xff000000u) >> 24)
+ | (((__bsx) & 0x00ff0000) >> 8)
+ | (((__bsx) & 0x0000ff00) << 8)
+ | (((__bsx) & 0x000000ff) << 24)
+ ); }))
+ * tscale);
+}
diff --git a/gcc/testsuite/gcc.target/vax/pr56875.c b/gcc/testsuite/gcc.target/vax/pr56875.c
new file mode 100644
index 00000000000..f409afe88e7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/vax/pr56875.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+/* { dg-final { scan-assembler "ashq .*,\\\$0xffffffffffffffff," } } */
+/* { dg-final { scan-assembler-not "ashq .*,\\\$-1," } } */
+
+void
+a (void)
+{
+ unsigned long i = 1;
+ unsigned long long v;
+
+ v = ~ (unsigned long long) 0 << i;
+}
diff --git a/gcc/testsuite/gcc.target/vax/vax.exp b/gcc/testsuite/gcc.target/vax/vax.exp
new file mode 100644
index 00000000000..2aec4eec192
--- /dev/null
+++ b/gcc/testsuite/gcc.target/vax/vax.exp
@@ -0,0 +1,41 @@
+# Copyright (C) 2013 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 a VAX target.
+if ![istarget vax-*-*] then {
+ return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# 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
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gfortran.dg/class_39.f03 b/gcc/testsuite/gfortran.dg/class_39.f03
index 6fe762ba35d..c29a3b06a63 100644
--- a/gcc/testsuite/gfortran.dg/class_39.f03
+++ b/gcc/testsuite/gfortran.dg/class_39.f03
@@ -8,6 +8,6 @@
end type T
contains
class(T) function add() ! { dg-error "must be dummy, allocatable or pointer" }
- add = 1 ! { dg-error "Variable must not be polymorphic in intrinsic assignment" }
+ add = 1 ! { dg-error "Nonallocatable variable must not be polymorphic in intrinsic assignment" }
end function
end
diff --git a/gcc/testsuite/gfortran.dg/class_5.f03 b/gcc/testsuite/gfortran.dg/class_5.f03
index 087d745aec7..0307cae4f89 100644
--- a/gcc/testsuite/gfortran.dg/class_5.f03
+++ b/gcc/testsuite/gfortran.dg/class_5.f03
@@ -20,7 +20,7 @@
x = t2(45,478)
allocate(t2 :: cp)
- cp = x ! { dg-error "Variable must not be polymorphic" }
+ cp = x ! { dg-error "Nonallocatable variable must not be polymorphic" }
select type (cp)
type is (t2)
@@ -28,4 +28,3 @@
end select
end
- \ No newline at end of file
diff --git a/gcc/testsuite/gfortran.dg/class_53.f90 b/gcc/testsuite/gfortran.dg/class_53.f90
index 0a8c9620808..83f55712d0b 100644
--- a/gcc/testsuite/gfortran.dg/class_53.f90
+++ b/gcc/testsuite/gfortran.dg/class_53.f90
@@ -13,6 +13,6 @@ end type
type(arr_t) :: this
class(arr_t) :: elem ! { dg-error "must be dummy, allocatable or pointer" }
-elem = this ! { dg-error "Variable must not be polymorphic in intrinsic assignment" }
+elem = this ! { dg-error "Nonallocatable variable must not be polymorphic in intrinsic assignment" }
end
diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_10.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_10.f90
new file mode 100644
index 00000000000..4385925dcd1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/defined_assignment_10.f90
@@ -0,0 +1,35 @@
+! { dg-do run }
+!
+! PR fortran/57697
+!
+! Further test of typebound defined assignment
+!
+module m0
+ implicit none
+ type component
+ integer :: i = 42
+ contains
+ procedure :: assign0
+ generic :: assignment(=) => assign0
+ end type
+ type parent
+ type(component) :: foo
+ end type
+contains
+ elemental subroutine assign0(lhs,rhs)
+ class(component), intent(INout) :: lhs
+ class(component), intent(in) :: rhs
+ lhs%i = 20
+ end subroutine
+end module
+
+program main
+ use m0
+ implicit none
+ type(parent), allocatable :: left
+ type(parent) :: right
+! print *, right%foo
+ left = right
+! print *, left%foo
+ if (left%foo%i /= 20) call abort()
+end
diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_11.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_11.f90
new file mode 100644
index 00000000000..ec297d5492a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/defined_assignment_11.f90
@@ -0,0 +1,43 @@
+! { dg-do run }
+!
+! PR fortran/57697
+!
+! Further test of typebound defined assignment
+!
+module m0
+ implicit none
+ type :: component
+ integer :: i = 42
+ integer, allocatable :: b
+ contains
+ procedure :: assign0
+ generic :: assignment(=) => assign0
+ end type
+ type, extends(component) :: comp2
+ real :: aa
+ end type comp2
+ type parent
+ type(component) :: foo
+ real :: cc
+ end type
+ type p2
+ type(parent) :: x
+ end type p2
+contains
+ elemental subroutine assign0(lhs,rhs)
+ class(component), intent(INout) :: lhs
+ class(component), intent(in) :: rhs
+ lhs%i = 20
+ end subroutine
+end module
+
+program main
+ use m0
+ implicit none
+ type(p2), allocatable :: left
+ type(p2) :: right
+! print *, right%x%foo%i
+ left = right
+! print *, left%x%foo%i
+ if (left%x%foo%i /= 20) call abort()
+end
diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_8.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_8.f90
new file mode 100644
index 00000000000..aab808583ad
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/defined_assignment_8.f90
@@ -0,0 +1,40 @@
+! { dg-do compile }
+!
+! PR fortran/58469
+!
+! Related: PR fortran/57697
+!
+! Was ICEing before
+!
+module m0
+ implicit none
+ type :: component
+ integer :: i = 42
+ contains
+ procedure :: assign0
+ generic :: assignment(=) => assign0
+ end type
+ type, extends(component) :: comp2
+ real :: aa
+ end type comp2
+ type parent
+ type(comp2) :: foo
+ end type
+contains
+ elemental subroutine assign0(lhs,rhs)
+ class(component), intent(INout) :: lhs
+ class(component), intent(in) :: rhs
+ lhs%i = 20
+ end subroutine
+end module
+
+program main
+ use m0
+ implicit none
+ type(parent), allocatable :: left
+ type(parent) :: right
+ print *, right%foo
+ left = right
+ print *, left%foo
+ if (left%foo%i /= 42) call abort()
+end
diff --git a/gcc/testsuite/gfortran.dg/defined_assignment_9.f90 b/gcc/testsuite/gfortran.dg/defined_assignment_9.f90
new file mode 100644
index 00000000000..50fa0070f18
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/defined_assignment_9.f90
@@ -0,0 +1,45 @@
+! { dg-do run }
+!
+! PR fortran/57697
+!
+! Further test of typebound defined assignment
+!
+module m0
+ implicit none
+ type component
+ integer :: i = 42
+ contains
+ procedure :: assign0
+ generic :: assignment(=) => assign0
+ end type
+ type parent
+ type(component) :: foo
+ end type
+contains
+ elemental subroutine assign0(lhs,rhs)
+ class(component), intent(INout) :: lhs
+ class(component), intent(in) :: rhs
+ lhs%i = 20
+ end subroutine
+end module
+
+program main
+ use m0
+ implicit none
+ block
+ type(parent), allocatable :: left
+ type(parent) :: right
+! print *, right%foo
+ left = right
+! print *, left%foo
+ if (left%foo%i /= 20) call abort()
+ end block
+ block
+ type(parent), allocatable :: left(:)
+ type(parent) :: right(5)
+! print *, right%foo
+ left = right
+! print *, left%foo
+ if (any (left%foo%i /= 20)) call abort()
+ end block
+end
diff --git a/gcc/testsuite/gfortran.dg/extends_15.f90 b/gcc/testsuite/gfortran.dg/extends_15.f90
new file mode 100644
index 00000000000..06c31799a00
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/extends_15.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+!
+! PR 58355: [4.7/4.8/4.9 Regression] [F03] ICE with TYPE, EXTENDS before parent TYPE defined
+!
+! Contributed by Andrew Benson <abensonca@gmail.com>
+
+module ct
+ public :: t1
+
+ type, extends(t1) :: t2 ! { dg-error "has not been previously defined" }
+
+ type :: t1
+ end type
+end
+
+! { dg-final { cleanup-modules "ct" } }
diff --git a/gcc/testsuite/gfortran.dg/finalize_19.f90 b/gcc/testsuite/gfortran.dg/finalize_19.f90
new file mode 100644
index 00000000000..1eeb6af658e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/finalize_19.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+!
+! PR fortran/58356
+!
+! Contributed by Andrew Benson
+!
+module ct
+ type :: cfl
+ contains
+ final :: cfld
+ end type cfl
+ type, extends(cfl) :: cfde
+ contains
+ end type cfde
+contains
+ subroutine cfld(self)
+ implicit none
+ type(cfl), intent(inout) :: self
+ return
+ end subroutine cfld
+end module ct
diff --git a/gcc/testsuite/gfortran.dg/finalize_21.f90 b/gcc/testsuite/gfortran.dg/finalize_21.f90
new file mode 100644
index 00000000000..6f6ede3e46a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/finalize_21.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! PR fortran/58436
+!
+! The following was ICEing and lacking _final=0
+!
+class(*), allocatable :: var
+end
+
+! { dg-final { scan-tree-dump "static struct __vtype__STAR __vtab__STAR = {._hash=0, ._size=., ._extends=0B, ._def_init=0B, ._copy=0B, ._final=0B};" "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/pr58484.f b/gcc/testsuite/gfortran.dg/pr58484.f
new file mode 100644
index 00000000000..2fd791347e9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr58484.f
@@ -0,0 +1,15 @@
+! { dg-do compile }
+! { dg-options "-O2" }
+ SUBROUTINE UMPSE(AIBJ,NOC,NDIM,NOCA,NVIRA,NOCCA,E2)
+ DIMENSION AIBJ(NOC,NDIM,*)
+ DO 20 MA=1,NVIRA
+ DO 20 MI=1,NOCA
+ DO 10 MB=1,MA
+ MBI = MI+NOCA*(MB-1)
+ DO 10 MJ=1,NOCCA
+ DUM = AIBJ(MJ,MAI,MB)-AIBJ(MJ,MBI,MA)
+ E2A = E2A-DUM
+ 10 CONTINUE
+ 20 CONTINUE
+ E2 = E2+E2A
+ END
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_43.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_43.f90
new file mode 100644
index 00000000000..b1f77a06ec6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_43.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR 58099: [4.8/4.9 Regression] [F03] over-zealous procedure-pointer error checking
+!
+! Contributed by Daniel Price <daniel.price@monash.edu>
+
+ implicit none
+ procedure(real), pointer :: wfunc
+
+ wfunc => w_cubic
+
+contains
+
+ pure real function w_cubic(q2)
+ real, intent(in) :: q2
+ w_cubic = 0.
+ end function
+
+end
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_20.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_20.f90
new file mode 100644
index 00000000000..d4cfaf841c6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_20.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/43366
+!
+! Invalid assignment to an allocatable polymorphic var.
+!
+type t
+end type t
+class(t), allocatable :: var
+
+var = t() ! { dg-error "Fortran 2008: Assignment to an allocatable polymorphic variable" }
+end
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_21.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_21.f90
new file mode 100644
index 00000000000..fd8f9aca939
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_21.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fno-realloc-lhs" }
+!
+! PR fortran/43366
+!
+! Invalid assignment to an allocatable polymorphic var.
+!
+type t
+end type t
+class(t), allocatable :: var
+
+var = t() ! { dg-error "Assignment to an allocatable polymorphic variable at .1. requires -frealloc-lhs" }
+end
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_22.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_22.f90
new file mode 100644
index 00000000000..f759c6aca00
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_22.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! PR fortran/43366
+!
+! Invalid assignment to an allocatable polymorphic var.
+!
+type t
+end type t
+class(t), allocatable :: caf[:]
+
+caf = t() ! { dg-error "Assignment to polymorphic coarray at .1. is not permitted" }
+end
diff --git a/gcc/testsuite/gfortran.dg/round_4.f90 b/gcc/testsuite/gfortran.dg/round_4.f90
index 8a7d95bb456..093d04ea796 100644
--- a/gcc/testsuite/gfortran.dg/round_4.f90
+++ b/gcc/testsuite/gfortran.dg/round_4.f90
@@ -6,12 +6,18 @@
! Test whether I/O rounding works. Uses internally (libgfortran) strtod
! for the conversion - and sets the CPU rounding mode accordingly.
!
+! Only few strtod implementations currently support rounding. Therefore
+! we use a heuristic to determine if the rounding support is available.
+! The assumption is that if strtod gives *different* results for up/down
+! rounding, then it will give *correct* results for nearest/zero/up/down
+! rounding too. And that is what is effectively checked.
+!
! If it doesn't work on your system, please check whether strtod handles
-! rounding and whether your system is supported in libgfortran/config/fpu*.c
+! rounding correctly and whether your system is supported in
+! libgfortran/config/fpu*.c
!
! Please only add ... run { target { ! { triplets } } } if it is unfixable
-! on your target - and a note why (strtod doesn't handle it, no rounding
-! support, etc.)
+! on your target - and a note why (strtod has broken rounding support, etc.)
!
program main
use iso_fortran_env
@@ -27,6 +33,17 @@ program main
real(xp) :: r10p, r10m, ref10u, ref10d
real(qp) :: r16p, r16m, ref16u, ref16d
character(len=20) :: str, round
+ logical :: rnd4, rnd8, rnd10, rnd16
+
+ ! Test for which types glibc's strtod function supports rounding
+ str = '0.01 0.01 0.01 0.01'
+ read (str, *, round='up') r4p, r8p, r10p, r16p
+ read (str, *, round='down') r4m, r8m, r10m, r16m
+ rnd4 = r4p /= r4m
+ rnd8 = r8p /= r8m
+ rnd10 = r10p /= r10m
+ rnd16 = r16p /= r16m
+! write (*, *) rnd4, rnd8, rnd10, rnd16
ref4u = 0.100000001_4
ref8u = 0.10000000000000001_8
@@ -55,40 +72,40 @@ program main
round = 'up'
call t()
- if (r4p /= ref4u .or. r4m /= -ref4d) call abort()
- if (r8p /= ref8u .or. r8m /= -ref8d) call abort()
- if (r10p /= ref10u .or. r10m /= -ref10d) call abort()
- if (r16p /= ref16u .or. r16m /= -ref16d) call abort()
+ if (rnd4 .and. (r4p /= ref4u .or. r4m /= -ref4d)) call abort()
+ if (rnd8 .and. (r8p /= ref8u .or. r8m /= -ref8d)) call abort()
+ if (rnd10 .and. (r10p /= ref10u .or. r10m /= -ref10d)) call abort()
+ if (rnd16 .and. (r16p /= ref16u .or. r16m /= -ref16d)) call abort()
round = 'down'
call t()
- if (r4p /= ref4d .or. r4m /= -ref4u) call abort()
- if (r8p /= ref8d .or. r8m /= -ref8u) call abort()
- if (r10p /= ref10d .or. r10m /= -ref10u) call abort()
- if (r16p /= ref16d .or. r16m /= -ref16u) call abort()
+ if (rnd4 .and. (r4p /= ref4d .or. r4m /= -ref4u)) call abort()
+ if (rnd8 .and. (r8p /= ref8d .or. r8m /= -ref8u)) call abort()
+ if (rnd10 .and. (r10p /= ref10d .or. r10m /= -ref10u)) call abort()
+ if (rnd16 .and. (r16p /= ref16d .or. r16m /= -ref16u)) call abort()
round = 'zero'
call t()
- if (r4p /= ref4d .or. r4m /= -ref4d) call abort()
- if (r8p /= ref8d .or. r8m /= -ref8d) call abort()
- if (r10p /= ref10d .or. r10m /= -ref10d) call abort()
- if (r16p /= ref16d .or. r16m /= -ref16d) call abort()
+ if (rnd4 .and. (r4p /= ref4d .or. r4m /= -ref4d)) call abort()
+ if (rnd8 .and. (r8p /= ref8d .or. r8m /= -ref8d)) call abort()
+ if (rnd10 .and. (r10p /= ref10d .or. r10m /= -ref10d)) call abort()
+ if (rnd16 .and. (r16p /= ref16d .or. r16m /= -ref16d)) call abort()
round = 'nearest'
call t()
- if (r4p /= ref4u .or. r4m /= -ref4u) call abort()
- if (r8p /= ref8u .or. r8m /= -ref8u) call abort()
- if (r10p /= ref10u .or. r10m /= -ref10u) call abort()
- if (r16p /= ref16u .or. r16m /= -ref16u) call abort()
+ if (rnd4 .and. (r4p /= ref4u .or. r4m /= -ref4u)) call abort()
+ if (rnd8 .and. (r8p /= ref8u .or. r8m /= -ref8u)) call abort()
+ if (rnd10 .and. (r10p /= ref10u .or. r10m /= -ref10u)) call abort()
+ if (rnd16 .and. (r16p /= ref16u .or. r16m /= -ref16u)) call abort()
! Same as nearest (but rounding towards zero if there is a tie
! [does not apply here])
round = 'compatible'
call t()
- if (r4p /= ref4u .or. r4m /= -ref4u) call abort()
- if (r8p /= ref8u .or. r8m /= -ref8u) call abort()
- if (r10p /= ref10u .or. r10m /= -ref10u) call abort()
- if (r16p /= ref16u .or. r16m /= -ref16u) call abort()
+ if (rnd4 .and. (r4p /= ref4u .or. r4m /= -ref4u)) call abort()
+ if (rnd8 .and. (r8p /= ref8u .or. r8m /= -ref8u)) call abort()
+ if (rnd10 .and. (r10p /= ref10u .or. r10m /= -ref10u)) call abort()
+ if (rnd16 .and. (r16p /= ref16u .or. r16m /= -ref16u)) call abort()
contains
subroutine t()
! print *, round
diff --git a/gcc/testsuite/gnat.dg/array_bounds_test2.adb b/gcc/testsuite/gnat.dg/array_bounds_test2.adb
new file mode 100644
index 00000000000..43e1ed3ced0
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array_bounds_test2.adb
@@ -0,0 +1,25 @@
+-- { dg-do run }
+
+with Ada.Unchecked_Deallocation;
+
+procedure Array_Bounds_Test2 is
+
+ type String_Ptr_T is access String;
+ procedure Free is new Ada.Unchecked_Deallocation (String, String_Ptr_T);
+ String_Data : String_Ptr_T := new String'("Hello World");
+
+ function Peek return String_Ptr_T is
+ begin
+ return String_Data;
+ end Peek;
+
+begin
+ declare
+ Corrupted_String : String := Peek.all;
+ begin
+ Free(String_Data);
+ if Corrupted_String'First /= 1 then
+ raise Program_Error;
+ end if;
+ end;
+end;
diff --git a/gcc/testsuite/gnat.dg/in_out_parameter4.adb b/gcc/testsuite/gnat.dg/in_out_parameter4.adb
new file mode 100644
index 00000000000..4f5cc218198
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/in_out_parameter4.adb
@@ -0,0 +1,30 @@
+-- { dg-do run }
+-- { dg-options "-gnat12 -gnatVa" }
+
+procedure In_Out_Parameter4 is
+
+ type Enum is (E_Undetermined, E_Down, E_Up);
+ subtype Status_T is Enum range E_Down .. E_Up;
+
+ function Recurse (Val : in out Integer) return Status_T is
+
+ Result : Status_T;
+
+ procedure Dummy (I : in out Integer) is begin null; end;
+
+ begin
+ if Val > 500 then
+ Val := Val - 1;
+ Result := Recurse (Val);
+ return Result;
+ else
+ return E_UP;
+ end if;
+ end;
+
+ Val : Integer := 501;
+ S : Status_T;
+
+begin
+ S := Recurse (Val);
+end;
diff --git a/gcc/testsuite/gnat.dg/opt27.adb b/gcc/testsuite/gnat.dg/opt27.adb
new file mode 100644
index 00000000000..be1980076a4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt27.adb
@@ -0,0 +1,29 @@
+-- { dg-do run }
+-- { dg-options "-O" }
+
+with Opt27_Pkg;
+
+procedure Opt27 is
+
+ type Rec_T is record
+ A, B, C, D, E : Integer;
+ end record;
+
+ package List is new Opt27_Pkg (Rec_T);
+
+ My_List : List.List_T;
+
+ function Is_Match (Element : Rec_T; Template : Integer) return Boolean is
+ begin
+ return (Element.C = Template);
+ end;
+
+ function Find_Int is new List.Find_Elem (Integer, Is_Match);
+
+ Node : List.Node_T := Find_Int (10, My_List);
+
+begin
+ if not List.Is_Null (Node) then
+ raise Program_Error;
+ end if;
+end;
diff --git a/gcc/testsuite/gnat.dg/opt27_pkg.adb b/gcc/testsuite/gnat.dg/opt27_pkg.adb
new file mode 100644
index 00000000000..17ffb731db2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt27_pkg.adb
@@ -0,0 +1,32 @@
+package body Opt27_Pkg is
+
+ type Node_Rec_T is record
+ Element : Element_T;
+ Left : Node_T;
+ Right : Node_T;
+ end record;
+
+ function Is_Null (Node : in Node_T) return Boolean is
+ begin
+ return (Node = null);
+ end Is_Null;
+
+ function Find_Elem (Template : Template_T; List : List_T) return Node_T is
+ Element_Found : Boolean := False;
+ Node_Walker : Node_T := null;
+ begin
+ Node_Walker := List.First_Node;
+
+ while not Element_Found and (Node_Walker /= null) loop
+
+ if Is_Match (Node_Walker.Element, Template) then
+ Element_Found := True;
+ else
+ Node_Walker := Node_Walker.Right;
+ end if;
+ end loop;
+
+ return Node_Walker;
+ end;
+
+end Opt27_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt27_pkg.ads b/gcc/testsuite/gnat.dg/opt27_pkg.ads
new file mode 100644
index 00000000000..01b3a909c6d
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt27_pkg.ads
@@ -0,0 +1,33 @@
+generic
+
+ type Element_T is private;
+
+package Opt27_Pkg is
+
+ type Node_T is private;
+
+ type List_T is private;
+
+ function Is_Null (Node : in Node_T) return Boolean;
+
+ generic
+
+ type Template_T is private;
+
+ with function Is_Match
+ (Element : in Element_T;
+ Template : in Template_T) return Boolean is <>;
+
+ function Find_Elem (Template : Template_T; List : List_T) return Node_T;
+
+private
+
+ type Node_Rec_T;
+ type Node_T is access Node_Rec_T;
+
+ type List_T is record
+ First_Node : Node_T := null;
+ Last_Node : Node_T := null;
+ end record;
+
+end Opt27_Pkg;
diff --git a/gcc/testsuite/gnat.dg/opt28.adb b/gcc/testsuite/gnat.dg/opt28.adb
new file mode 100644
index 00000000000..74a4c5c3be9
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt28.adb
@@ -0,0 +1,31 @@
+with Opt28_Pkg; use Opt28_Pkg;
+
+package body Opt28 is
+
+ function Full_Filename (Filename : String) return String is
+ Path : constant String := "PATH";
+ Posix_Path : constant Posix_String := To_Posix (Path);
+ begin
+
+ declare
+ M : constant Posix_String := Value_Of (Posix_Path);
+ N : constant Posix_String (1 .. M'Length) := M;
+ Var : constant String := To_String (Str => N);
+ Start_Pos : Natural := 1;
+ End_Pos : Natural := 1;
+ begin
+ while Start_Pos <= Var'Length loop
+ End_Pos := Position (Var (Start_Pos .. Var'Length));
+
+ if Is_File (To_Posix (Var (Start_Pos .. End_Pos - 1) & Filename)) then
+ return Var (Start_Pos .. End_Pos - 1) & Filename;
+ else
+ Start_Pos := End_Pos + 1;
+ end if;
+ end loop;
+ end;
+
+ return "";
+ end;
+
+end Opt28;
diff --git a/gcc/testsuite/gnat.dg/opt28.ads b/gcc/testsuite/gnat.dg/opt28.ads
new file mode 100644
index 00000000000..4887c214845
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt28.ads
@@ -0,0 +1,8 @@
+-- { dg-do compile }
+-- { dg-options "-O2" }
+
+package Opt28 is
+
+ function Full_Filename (Filename : String) return String;
+
+end Opt28;
diff --git a/gcc/testsuite/gnat.dg/opt28_pkg.ads b/gcc/testsuite/gnat.dg/opt28_pkg.ads
new file mode 100644
index 00000000000..c3c32fe1c34
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt28_pkg.ads
@@ -0,0 +1,11 @@
+package Opt28_Pkg is
+
+ type Posix_String is array (Positive range <>) of aliased Character;
+
+ function To_Posix (Str : String) return Posix_String;
+ function To_String (Str : Posix_String) return String;
+ function Is_File (Str : Posix_String) return Boolean;
+ function Value_Of (Name : Posix_String) return Posix_String;
+ function Position (In_Line : String) return Natural;
+
+end Opt28_Pkg;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 0905821587b..f9970310656 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -435,9 +435,10 @@ proc check_effective_target_trampolines { } {
return 0
}
if { [istarget avr-*-*]
+ || [istarget msp430-*-*]
|| [istarget hppa2.0w-hp-hpux11.23]
- || [istarget hppa64-hp-hpux11.23] } {
- return 0;
+ || [istarget hppa64-hp-hpux11.23] } {
+ return 0;
}
return 1
}
@@ -493,13 +494,6 @@ proc check_profiling_available { test_what } {
return 0
}
- # We don't yet support profiling for AArch64.
- if { [istarget aarch64*-*-*]
- && ([lindex $test_what 1] == "-p"
- || [lindex $test_what 1] == "-pg") } {
- return 0
- }
-
# cygwin does not support -p.
if { [istarget *-*-cygwin*] && $test_what == "-p" } {
return 0
@@ -535,6 +529,7 @@ proc check_profiling_available { test_what } {
|| [istarget mmix-*-*]
|| [istarget mn10300-*-elf*]
|| [istarget moxie-*-elf*]
+ || [istarget msp430-*-*]
|| [istarget picochip-*-*]
|| [istarget powerpc-*-eabi*]
|| [istarget powerpc-*-elf]
@@ -652,6 +647,11 @@ proc check_effective_target_tls_emulated {} {
# Return 1 if TLS executables can run correctly, 0 otherwise.
proc check_effective_target_tls_runtime {} {
+ # MSP430 runtime does not have TLS support, but just
+ # running the test below is insufficient to show this.
+ if { [istarget msp430-*-*] } {
+ return 0
+ }
return [check_runtime tls_runtime {
__thread int thr = 0;
int main (void) { return thr; }
@@ -2222,7 +2222,7 @@ proc check_effective_target_arm_v8_vfp_ok {} {
# options.
proc check_effective_target_arm_hard_vfp_ok { } {
- if { [check_effective_target_arm32]
+ if { [check_effective_target_arm32]
&& ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
return [check_no_compiler_messages arm_hard_vfp_ok executable {
int main() { return 0;}
@@ -2592,6 +2592,17 @@ proc check_effective_target_arm_thumb2 { } {
} ""]
}
+# Return 1 if this is an ARM target where conditional execution is available.
+
+proc check_effective_target_arm_cond_exec { } {
+ return [check_no_compiler_messages arm_cond_exec assembly {
+ #if defined(__arm__) && defined(__thumb__) && !defined(__thumb2__)
+ #error FOO
+ #endif
+ int i;
+ } ""]
+}
+
# Return 1 if this is an ARM cortex-M profile cpu
proc check_effective_target_arm_cortex_m { } {
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 3473211efb1..feba0510f61 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -706,17 +706,19 @@ print_version (FILE *file, const char *indent)
two string formats, "i.j.k" and "i.j" when k is zero. As of
gmp-4.3.0, GMP always uses the 3 number format. */
#define GCC_GMP_STRINGIFY_VERSION3(X) #X
-#define GCC_GMP_STRINGIFY_VERSION2(X) GCC_GMP_STRINGIFY_VERSION3(X)
+#define GCC_GMP_STRINGIFY_VERSION2(X) GCC_GMP_STRINGIFY_VERSION3 (X)
#define GCC_GMP_VERSION_NUM(X,Y,Z) (((X) << 16L) | ((Y) << 8) | (Z))
#define GCC_GMP_VERSION \
GCC_GMP_VERSION_NUM(__GNU_MP_VERSION, __GNU_MP_VERSION_MINOR, __GNU_MP_VERSION_PATCHLEVEL)
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,0) && __GNU_MP_VERSION_PATCHLEVEL == 0
-#define GCC_GMP_STRINGIFY_VERSION GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION) "." \
- GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_MINOR)
+#define GCC_GMP_STRINGIFY_VERSION \
+ GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION) "." \
+ GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION_MINOR)
#else
-#define GCC_GMP_STRINGIFY_VERSION GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION) "." \
- GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_MINOR) "." \
- GCC_GMP_STRINGIFY_VERSION2(__GNU_MP_VERSION_PATCHLEVEL)
+#define GCC_GMP_STRINGIFY_VERSION \
+ GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION) "." \
+ GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION_MINOR) "." \
+ GCC_GMP_STRINGIFY_VERSION2 (__GNU_MP_VERSION_PATCHLEVEL)
#endif
fprintf (file,
file == stderr ? _(fmt2) : fmt2,
@@ -1170,11 +1172,11 @@ general_init (const char *argv0)
/* This must be done after global_init_params but before argument
processing. */
- init_ggc_heuristics();
+ init_ggc_heuristics ();
/* Create the singleton holder for global state.
Doing so also creates the pass manager and with it the passes. */
- g = new gcc::context();
+ g = new gcc::context ();
statistics_early_init ();
finish_params ();
diff --git a/gcc/tracer.c b/gcc/tracer.c
index 0139669aa16..57055662ea5 100644
--- a/gcc/tracer.c
+++ b/gcc/tracer.c
@@ -46,7 +46,7 @@
#include "params.h"
#include "coverage.h"
#include "tree-pass.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "cfgloop.h"
@@ -417,8 +417,8 @@ const pass_data pass_data_tracer =
class pass_tracer : public gimple_opt_pass
{
public:
- pass_tracer(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tracer, ctxt)
+ pass_tracer (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tracer, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 220ded277b5..82f3ee08a39 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -23,7 +23,7 @@
#include "hash-table.h"
#include "tree.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-inline.h"
#include "diagnostic-core.h"
@@ -821,8 +821,8 @@ const pass_data pass_data_diagnose_tm_blocks =
class pass_diagnose_tm_blocks : public gimple_opt_pass
{
public:
- pass_diagnose_tm_blocks(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_diagnose_tm_blocks, ctxt)
+ pass_diagnose_tm_blocks (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_diagnose_tm_blocks, ctxt)
{}
/* opt_pass methods: */
@@ -1631,7 +1631,7 @@ lower_transaction (gimple_stmt_iterator *gsi, struct walk_stmt_info *wi)
/* If the transaction calls abort or if this is an outer transaction,
add an "over" label afterwards. */
if ((this_state & (GTMA_HAVE_ABORT))
- || (gimple_transaction_subcode(stmt) & GTMA_IS_OUTER))
+ || (gimple_transaction_subcode (stmt) & GTMA_IS_OUTER))
{
tree label = create_artificial_label (UNKNOWN_LOCATION);
gimple_transaction_set_label (stmt, label);
@@ -1744,8 +1744,8 @@ const pass_data pass_data_lower_tm =
class pass_lower_tm : public gimple_opt_pass
{
public:
- pass_lower_tm(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_tm, ctxt)
+ pass_lower_tm (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_tm, ctxt)
{}
/* opt_pass methods: */
@@ -2024,8 +2024,8 @@ const pass_data pass_data_tm_init =
class pass_tm_init : public gimple_opt_pass
{
public:
- pass_tm_init(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tm_init, ctxt)
+ pass_tm_init (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tm_init, ctxt)
{}
/* opt_pass methods: */
@@ -2753,8 +2753,8 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
ei->probability = PROB_ALWAYS;
et->probability = PROB_LIKELY;
ef->probability = PROB_UNLIKELY;
- et->count = apply_probability(test_bb->count, et->probability);
- ef->count = apply_probability(test_bb->count, ef->probability);
+ et->count = apply_probability (test_bb->count, et->probability);
+ ef->count = apply_probability (test_bb->count, ef->probability);
code_bb->count = et->count;
code_bb->frequency = EDGE_FREQUENCY (et);
@@ -2793,14 +2793,14 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
fallthru_edge->flags = EDGE_FALSE_VALUE;
fallthru_edge->probability = PROB_VERY_LIKELY;
fallthru_edge->count
- = apply_probability(test_bb->count, fallthru_edge->probability);
+ = apply_probability (test_bb->count, fallthru_edge->probability);
// Abort/over edge.
redirect_edge_pred (abort_edge, test_bb);
abort_edge->flags = EDGE_TRUE_VALUE;
abort_edge->probability = PROB_VERY_UNLIKELY;
abort_edge->count
- = apply_probability(test_bb->count, abort_edge->probability);
+ = apply_probability (test_bb->count, abort_edge->probability);
transaction_bb = test_bb;
}
@@ -2842,13 +2842,13 @@ expand_transaction (struct tm_region *region, void *data ATTRIBUTE_UNUSED)
inst_edge->flags = EDGE_FALSE_VALUE;
inst_edge->probability = REG_BR_PROB_BASE / 2;
inst_edge->count
- = apply_probability(test_bb->count, inst_edge->probability);
+ = apply_probability (test_bb->count, inst_edge->probability);
redirect_edge_pred (uninst_edge, test_bb);
uninst_edge->flags = EDGE_TRUE_VALUE;
uninst_edge->probability = REG_BR_PROB_BASE / 2;
uninst_edge->count
- = apply_probability(test_bb->count, uninst_edge->probability);
+ = apply_probability (test_bb->count, uninst_edge->probability);
}
// If we have no previous special cases, and we have PHIs at the beginning
@@ -3000,8 +3000,8 @@ const pass_data pass_data_tm_mark =
class pass_tm_mark : public gimple_opt_pass
{
public:
- pass_tm_mark(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tm_mark, ctxt)
+ pass_tm_mark (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tm_mark, ctxt)
{}
/* opt_pass methods: */
@@ -3183,8 +3183,8 @@ const pass_data pass_data_tm_edges =
class pass_tm_edges : public gimple_opt_pass
{
public:
- pass_tm_edges(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tm_edges, ctxt)
+ pass_tm_edges (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tm_edges, ctxt)
{}
/* opt_pass methods: */
@@ -3923,8 +3923,8 @@ const pass_data pass_data_tm_memopt =
class pass_tm_memopt : public gimple_opt_pass
{
public:
- pass_tm_memopt(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tm_memopt, ctxt)
+ pass_tm_memopt (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tm_memopt, ctxt)
{}
/* opt_pass methods: */
@@ -4287,7 +4287,7 @@ ipa_tm_scan_irr_block (basic_block bb)
if (find_tm_replacement_function (fn))
break;
- node = cgraph_get_node(fn);
+ node = cgraph_get_node (fn);
d = get_cg_data (&node, true);
/* Return true if irrevocable, but above all, believe
@@ -4991,7 +4991,7 @@ ipa_tm_insert_gettmclone_call (struct cgraph_node *node,
cgraph_create_edge (node, cgraph_get_create_node (gettm_fn), g, 0,
compute_call_stmt_bb_frequency (node->symbol.decl,
- gimple_bb(g)));
+ gimple_bb (g)));
/* Cast return value from tm_gettmclone* into appropriate function
pointer. */
@@ -5272,9 +5272,9 @@ ipa_tm_transform_clone (struct cgraph_node *node)
static unsigned int
ipa_tm_execute (void)
{
- cgraph_node_queue tm_callees = cgraph_node_queue();
+ cgraph_node_queue tm_callees = cgraph_node_queue ();
/* List of functions that will go irrevocable. */
- cgraph_node_queue irr_worklist = cgraph_node_queue();
+ cgraph_node_queue irr_worklist = cgraph_node_queue ();
struct cgraph_node *node;
struct tm_ipa_cg_data *d;
@@ -5558,8 +5558,8 @@ const pass_data pass_data_ipa_tm =
class pass_ipa_tm : public simple_ipa_opt_pass
{
public:
- pass_ipa_tm(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_tm, ctxt)
+ pass_ipa_tm (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_tm, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-browser.c b/gcc/tree-browser.c
index b236cabd8df..dad06a5175a 100644
--- a/gcc/tree-browser.c
+++ b/gcc/tree-browser.c
@@ -46,7 +46,7 @@ struct tb_command {
TB_CODE comm_code;
};
-#define DEFTBCODE(code, str, help) { help, str, sizeof(str) - 1, code },
+#define DEFTBCODE(code, str, help) { help, str, sizeof (str) - 1, code },
static const struct tb_command tb_commands[] =
{
#include "tree-browser.def"
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 1396388676b..c38f694a5db 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "tree.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-pass.h"
#include "flags.h"
@@ -946,8 +946,8 @@ const pass_data pass_data_call_cdce =
class pass_call_cdce : public gimple_opt_pass
{
public:
- pass_call_cdce(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_call_cdce, ctxt)
+ pass_call_cdce (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_call_cdce, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index c74b9885933..b72ac61373c 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "ggc.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-dump.h"
#include "tree-pass.h"
#include "diagnostic-core.h"
@@ -273,8 +273,8 @@ const pass_data pass_data_build_cfg =
class pass_build_cfg : public gimple_opt_pass
{
public:
- pass_build_cfg(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_build_cfg, ctxt)
+ pass_build_cfg (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_build_cfg, ctxt)
{}
/* opt_pass methods: */
@@ -1013,6 +1013,9 @@ make_abnormal_goto_edges (basic_block bb, bool for_call)
break;
}
}
+ if (!gsi_end_p (gsi)
+ && is_gimple_debug (gsi_stmt (gsi)))
+ gsi_next_nondebug (&gsi);
if (!gsi_end_p (gsi))
{
/* Make an edge to every setjmp-like call. */
@@ -3360,7 +3363,7 @@ verify_gimple_assign_unary (gimple stmt)
{
if ((!INTEGRAL_TYPE_P (rhs1_type) || !SCALAR_FLOAT_TYPE_P (lhs_type))
&& (!VECTOR_INTEGER_TYPE_P (rhs1_type)
- || !VECTOR_FLOAT_TYPE_P(lhs_type)))
+ || !VECTOR_FLOAT_TYPE_P (lhs_type)))
{
error ("invalid types in conversion to floating point");
debug_generic_expr (lhs_type);
@@ -3375,7 +3378,7 @@ verify_gimple_assign_unary (gimple stmt)
{
if ((!INTEGRAL_TYPE_P (lhs_type) || !SCALAR_FLOAT_TYPE_P (rhs1_type))
&& (!VECTOR_INTEGER_TYPE_P (lhs_type)
- || !VECTOR_FLOAT_TYPE_P(rhs1_type)))
+ || !VECTOR_FLOAT_TYPE_P (rhs1_type)))
{
error ("invalid types in conversion to integer");
debug_generic_expr (lhs_type);
@@ -5563,6 +5566,7 @@ gimple_duplicate_bb (basic_block bb)
copy = create_phi_node (NULL_TREE, new_bb);
create_new_def_for (gimple_phi_result (phi), copy,
gimple_phi_result_ptr (copy));
+ gimple_set_uid (copy, gimple_uid (phi));
}
gsi_tgt = gsi_start_bb (new_bb);
@@ -6661,12 +6665,13 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
struct function *saved_cfun = cfun;
int *entry_flag, *exit_flag;
unsigned *entry_prob, *exit_prob;
- unsigned i, num_entry_edges, num_exit_edges;
+ unsigned i, num_entry_edges, num_exit_edges, num_nodes;
edge e;
edge_iterator ei;
htab_t new_label_map;
struct pointer_map_t *vars_map, *eh_map;
struct loop *loop = entry_bb->loop_father;
+ struct loop *loop0 = get_loop (saved_cfun, 0);
struct move_stmt_d d;
/* If ENTRY does not strictly dominate EXIT, this cannot be an SESE
@@ -6759,16 +6764,29 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
set_loops_for_fn (dest_cfun, loops);
/* Move the outlined loop tree part. */
+ num_nodes = bbs.length ();
FOR_EACH_VEC_ELT (bbs, i, bb)
{
- if (bb->loop_father->header == bb
- && loop_outer (bb->loop_father) == loop)
+ if (bb->loop_father->header == bb)
{
- struct loop *loop = bb->loop_father;
- flow_loop_tree_node_remove (bb->loop_father);
- flow_loop_tree_node_add (get_loop (dest_cfun, 0), loop);
- fixup_loop_arrays_after_move (saved_cfun, cfun, loop);
+ struct loop *this_loop = bb->loop_father;
+ struct loop *outer = loop_outer (this_loop);
+ if (outer == loop
+ /* If the SESE region contains some bbs ending with
+ a noreturn call, those are considered to belong
+ to the outermost loop in saved_cfun, rather than
+ the entry_bb's loop_father. */
+ || outer == loop0)
+ {
+ if (outer != loop)
+ num_nodes -= this_loop->num_nodes;
+ flow_loop_tree_node_remove (bb->loop_father);
+ flow_loop_tree_node_add (get_loop (dest_cfun, 0), this_loop);
+ fixup_loop_arrays_after_move (saved_cfun, cfun, this_loop);
+ }
}
+ else if (bb->loop_father == loop0 && loop0 != loop)
+ num_nodes--;
/* Remove loop exits from the outlined region. */
if (loops_for_fn (saved_cfun)->exits)
@@ -6788,6 +6806,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
/* Setup a mapping to be used by move_block_to_fn. */
loop->aux = current_loops->tree_root;
+ loop0->aux = current_loops->tree_root;
pop_cfun ();
@@ -6816,11 +6835,30 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
}
loop->aux = NULL;
+ loop0->aux = NULL;
/* Loop sizes are no longer correct, fix them up. */
- loop->num_nodes -= bbs.length ();
+ loop->num_nodes -= num_nodes;
for (struct loop *outer = loop_outer (loop);
outer; outer = loop_outer (outer))
- outer->num_nodes -= bbs.length ();
+ outer->num_nodes -= num_nodes;
+ loop0->num_nodes -= bbs.length () - num_nodes;
+
+ if (saved_cfun->has_simduid_loops || saved_cfun->has_force_vect_loops)
+ {
+ struct loop *aloop;
+ for (i = 0; vec_safe_iterate (loops->larray, i, &aloop); i++)
+ if (aloop != NULL)
+ {
+ if (aloop->simduid)
+ {
+ replace_by_duplicate_decl (&aloop->simduid, d.vars_map,
+ d.to_context);
+ dest_cfun->has_simduid_loops = true;
+ }
+ if (aloop->force_vect)
+ dest_cfun->has_force_vect_loops = true;
+ }
+ }
/* Rewire BLOCK_SUBBLOCKS of orig_block. */
if (orig_block)
@@ -7922,13 +7960,14 @@ const pass_data pass_data_split_crit_edges =
class pass_split_crit_edges : public gimple_opt_pass
{
public:
- pass_split_crit_edges(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_split_crit_edges, ctxt)
+ pass_split_crit_edges (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_split_crit_edges, ctxt)
{}
/* opt_pass methods: */
unsigned int execute () { return split_critical_edges (); }
+ opt_pass * clone () { return new pass_split_crit_edges (m_ctxt); }
}; // class pass_split_crit_edges
} // anon namespace
@@ -8093,8 +8132,8 @@ const pass_data pass_data_warn_function_return =
class pass_warn_function_return : public gimple_opt_pass
{
public:
- pass_warn_function_return(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_warn_function_return, ctxt)
+ pass_warn_function_return (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_warn_function_return, ctxt)
{}
/* opt_pass methods: */
@@ -8147,8 +8186,8 @@ const pass_data pass_data_warn_function_noreturn =
class pass_warn_function_noreturn : public gimple_opt_pass
{
public:
- pass_warn_function_noreturn(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_warn_function_noreturn, ctxt)
+ pass_warn_function_noreturn (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_warn_function_noreturn, ctxt)
{}
/* opt_pass methods: */
@@ -8264,8 +8303,8 @@ const pass_data pass_data_warn_unused_result =
class pass_warn_unused_result : public gimple_opt_pass
{
public:
- pass_warn_unused_result(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_warn_unused_result, ctxt)
+ pass_warn_unused_result (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_warn_unused_result, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 8917f855705..cd4307ec9b8 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "ggc.h"
#include "langhooks.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "except.h"
#include "cfgloop.h"
@@ -1009,12 +1009,12 @@ const pass_data pass_data_merge_phi =
class pass_merge_phi : public gimple_opt_pass
{
public:
- pass_merge_phi(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_merge_phi, ctxt)
+ pass_merge_phi (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_merge_phi, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_merge_phi (ctxt_); }
+ opt_pass * clone () { return new pass_merge_phi (m_ctxt); }
bool gate () { return gate_merge_phi (); }
unsigned int execute () { return merge_phi_nodes (); }
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index c18ccd3f933..16df51bbbef 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree-pretty-print.h"
#include "cfgloop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-chrec.h"
#include "dumpfile.h"
#include "params.h"
@@ -268,9 +268,14 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
switch (TREE_CODE (op0))
{
case POLYNOMIAL_CHREC:
+ gcc_checking_assert
+ (!chrec_contains_symbols_defined_in_loop (op0, CHREC_VARIABLE (op0)));
switch (TREE_CODE (op1))
{
case POLYNOMIAL_CHREC:
+ gcc_checking_assert
+ (!chrec_contains_symbols_defined_in_loop (op1,
+ CHREC_VARIABLE (op1)));
return chrec_fold_plus_poly_poly (code, type, op0, op1);
CASE_CONVERT:
@@ -298,6 +303,9 @@ chrec_fold_plus_1 (enum tree_code code, tree type,
switch (TREE_CODE (op1))
{
case POLYNOMIAL_CHREC:
+ gcc_checking_assert
+ (!chrec_contains_symbols_defined_in_loop (op1,
+ CHREC_VARIABLE (op1)));
if (code == PLUS_EXPR || code == POINTER_PLUS_EXPR)
return build_polynomial_chrec
(CHREC_VARIABLE (op1),
@@ -396,9 +404,14 @@ chrec_fold_multiply (tree type,
switch (TREE_CODE (op0))
{
case POLYNOMIAL_CHREC:
+ gcc_checking_assert
+ (!chrec_contains_symbols_defined_in_loop (op0, CHREC_VARIABLE (op0)));
switch (TREE_CODE (op1))
{
case POLYNOMIAL_CHREC:
+ gcc_checking_assert
+ (!chrec_contains_symbols_defined_in_loop (op1,
+ CHREC_VARIABLE (op1)));
return chrec_fold_multiply_poly_poly (type, op0, op1);
CASE_CONVERT:
@@ -431,6 +444,9 @@ chrec_fold_multiply (tree type,
switch (TREE_CODE (op1))
{
case POLYNOMIAL_CHREC:
+ gcc_checking_assert
+ (!chrec_contains_symbols_defined_in_loop (op1,
+ CHREC_VARIABLE (op1)));
return build_polynomial_chrec
(CHREC_VARIABLE (op1),
chrec_fold_multiply (type, CHREC_LEFT (op1), op0),
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index ad39a6b22d3..c69183b966e 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -137,15 +137,18 @@ build_polynomial_chrec (unsigned loop_num,
|| !val)
return chrec_dont_know;
- /* Pointer types should occur only on the left hand side, i.e. in
- the base of the chrec, and not in the step. */
- gcc_assert (!POINTER_TYPE_P (TREE_TYPE (right)));
-
- /* Types of left and right sides of a chrec should be compatible. */
+ /* Types of left and right sides of a chrec should be compatible, but
+ pointer CHRECs are special in that the evolution is of ptroff type. */
if (POINTER_TYPE_P (TREE_TYPE (left)))
- gcc_assert (ptrofftype_p (TREE_TYPE (right)));
+ gcc_checking_assert (ptrofftype_p (TREE_TYPE (right)));
else
- gcc_assert (TREE_TYPE (left) == TREE_TYPE (right));
+ {
+ /* Pointer types should occur only on the left hand side, i.e. in
+ the base of the chrec, and not in the step. */
+ gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (right))
+ && types_compatible_p (TREE_TYPE (left),
+ TREE_TYPE (right)));
+ }
if (chrec_zerop (right))
return left;
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 225728fdaeb..7d9b696d9a8 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "tree.h"
#include "flags.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-iterator.h"
#include "tree-pass.h"
@@ -1657,12 +1657,12 @@ const pass_data pass_data_lower_complex =
class pass_lower_complex : public gimple_opt_pass
{
public:
- pass_lower_complex(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_complex, ctxt)
+ pass_lower_complex (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_complex, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_lower_complex (ctxt_); }
+ opt_pass * clone () { return new pass_lower_complex (m_ctxt); }
unsigned int execute () { return tree_lower_complex (); }
}; // class pass_lower_complex
@@ -1704,8 +1704,8 @@ const pass_data pass_data_lower_complex_O0 =
class pass_lower_complex_O0 : public gimple_opt_pass
{
public:
- pass_lower_complex_O0(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_complex_O0, ctxt)
+ pass_lower_complex_O0 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_complex_O0, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index b1bc56ae29f..0b3314bc55e 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -43,6 +43,7 @@ struct function;
struct real_value;
struct fixed_value;
struct ptr_info_def;
+struct range_info_def;
struct die_struct;
struct pointer_set_t;
@@ -780,6 +781,9 @@ struct GTY(()) tree_base {
OMP_CLAUSE_PRIVATE_DEBUG in
OMP_CLAUSE_PRIVATE
+ OMP_CLAUSE_LINEAR_NO_COPYIN in
+ OMP_CLAUSE_LINEAR
+
TRANSACTION_EXPR_RELAXED in
TRANSACTION_EXPR
@@ -800,6 +804,9 @@ struct GTY(()) tree_base {
OMP_CLAUSE_PRIVATE_OUTER_REF in
OMP_CLAUSE_PRIVATE
+ OMP_CLAUSE_LINEAR_NO_COPYOUT in
+ OMP_CLAUSE_LINEAR
+
TYPE_REF_IS_RVALUE in
REFERENCE_TYPE
@@ -935,6 +942,9 @@ struct GTY(()) tree_base {
DECL_NONLOCAL_FRAME in
VAR_DECL
+
+ TYPE_FINAL_P in
+ RECORD_TYPE, UNION_TYPE and QUAL_UNION_TYPE
*/
struct GTY(()) tree_typed {
@@ -1041,8 +1051,14 @@ struct GTY(()) tree_ssa_name {
/* Statement that defines this SSA name. */
gimple def_stmt;
- /* Pointer attributes used for alias analysis. */
- struct ptr_info_def *ptr_info;
+ /* Value range information. */
+ union ssa_name_info_type {
+ /* Pointer attributes used for alias analysis. */
+ struct GTY ((tag ("0"))) ptr_info_def *ptr_info;
+ /* Value range attributes used for zero/sign extension elimination. */
+ struct GTY ((tag ("1"))) range_info_def *range_info;
+ } GTY ((desc ("%1.typed.type ?" \
+ "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info;
/* Immediate uses list for this SSA_NAME. */
struct ssa_use_operand_d imm_uses;
@@ -1197,8 +1213,7 @@ struct GTY(()) tree_decl_common {
unsigned lang_flag_7 : 1;
unsigned lang_flag_8 : 1;
- /* In LABEL_DECL, this is DECL_ERROR_ISSUED.
- In VAR_DECL and PARM_DECL, this is DECL_REGISTER. */
+ /* In VAR_DECL and PARM_DECL, this is DECL_REGISTER. */
unsigned decl_flag_0 : 1;
/* In FIELD_DECL, this is DECL_BIT_FIELD
In VAR_DECL and FUNCTION_DECL, this is DECL_EXTERNAL.
@@ -1403,6 +1418,9 @@ struct GTY(()) tree_statement_list
struct tree_statement_list_node *tail;
};
+
+/* Optimization options used by a function. */
+
struct GTY(()) tree_optimization_option {
struct tree_common common;
@@ -1418,6 +1436,8 @@ struct GTY(()) tree_optimization_option {
struct target_optabs *GTY ((skip)) base_optabs;
};
+/* Target options used by a function. */
+
struct GTY(()) tree_target_option {
struct tree_common common;
@@ -1563,6 +1583,8 @@ struct GTY(()) tree_map_base {
tree from;
};
+/* Map from a tree to another tree. */
+
struct GTY(()) tree_map {
struct tree_map_base base;
unsigned int hash;
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 5bd7719516b..530f00d82d0 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -77,7 +77,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
@@ -1136,13 +1136,13 @@ common_affine_function (conflict_function *cf)
affine_fn comm;
if (!CF_NONTRIVIAL_P (cf))
- return affine_fn();
+ return affine_fn ();
comm = cf->fns[0];
for (i = 1; i < cf->n; i++)
if (!affine_function_equal_p (comm, cf->fns[i]))
- return affine_fn();
+ return affine_fn ();
return comm;
}
@@ -1637,12 +1637,12 @@ conflict_fn (unsigned n, ...)
va_list ap;
gcc_assert (0 < n && n <= MAX_DIM);
- va_start(ap, n);
+ va_start (ap, n);
ret->n = n;
for (i = 0; i < n; i++)
ret->fns[i] = va_arg (ap, affine_fn);
- va_end(ap);
+ va_end (ap);
return ret;
}
@@ -4798,446 +4798,3 @@ free_data_refs (vec<data_reference_p> datarefs)
free_data_ref (dr);
datarefs.release ();
}
-
-
-
-/* Dump vertex I in RDG to FILE. */
-
-static void
-dump_rdg_vertex (FILE *file, struct graph *rdg, int i)
-{
- struct vertex *v = &(rdg->vertices[i]);
- struct graph_edge *e;
-
- fprintf (file, "(vertex %d: (%s%s) (in:", i,
- RDG_MEM_WRITE_STMT (rdg, i) ? "w" : "",
- RDG_MEM_READS_STMT (rdg, i) ? "r" : "");
-
- if (v->pred)
- for (e = v->pred; e; e = e->pred_next)
- fprintf (file, " %d", e->src);
-
- fprintf (file, ") (out:");
-
- if (v->succ)
- for (e = v->succ; e; e = e->succ_next)
- fprintf (file, " %d", e->dest);
-
- fprintf (file, ")\n");
- print_gimple_stmt (file, RDGV_STMT (v), 0, TDF_VOPS|TDF_MEMSYMS);
- fprintf (file, ")\n");
-}
-
-/* Call dump_rdg_vertex on stderr. */
-
-DEBUG_FUNCTION void
-debug_rdg_vertex (struct graph *rdg, int i)
-{
- dump_rdg_vertex (stderr, rdg, i);
-}
-
-/* Dump component C of RDG to FILE. If DUMPED is non-null, set the
- dumped vertices to that bitmap. */
-
-static void
-dump_rdg_component (FILE *file, struct graph *rdg, int c, bitmap dumped)
-{
- int i;
-
- fprintf (file, "(%d\n", c);
-
- for (i = 0; i < rdg->n_vertices; i++)
- if (rdg->vertices[i].component == c)
- {
- if (dumped)
- bitmap_set_bit (dumped, i);
-
- dump_rdg_vertex (file, rdg, i);
- }
-
- fprintf (file, ")\n");
-}
-
-/* Call dump_rdg_vertex on stderr. */
-
-DEBUG_FUNCTION void
-debug_rdg_component (struct graph *rdg, int c)
-{
- dump_rdg_component (stderr, rdg, c, NULL);
-}
-
-/* Dump the reduced dependence graph RDG to FILE. */
-
-void
-dump_rdg (FILE *file, struct graph *rdg)
-{
- int i;
- bitmap dumped = BITMAP_ALLOC (NULL);
-
- fprintf (file, "(rdg\n");
-
- for (i = 0; i < rdg->n_vertices; i++)
- if (!bitmap_bit_p (dumped, i))
- dump_rdg_component (file, rdg, rdg->vertices[i].component, dumped);
-
- fprintf (file, ")\n");
- BITMAP_FREE (dumped);
-}
-
-/* Call dump_rdg on stderr. */
-
-DEBUG_FUNCTION void
-debug_rdg (struct graph *rdg)
-{
- dump_rdg (stderr, rdg);
-}
-
-static void
-dot_rdg_1 (FILE *file, struct graph *rdg)
-{
- int i;
-
- fprintf (file, "digraph RDG {\n");
-
- for (i = 0; i < rdg->n_vertices; i++)
- {
- struct vertex *v = &(rdg->vertices[i]);
- struct graph_edge *e;
-
- /* Highlight reads from memory. */
- if (RDG_MEM_READS_STMT (rdg, i))
- fprintf (file, "%d [style=filled, fillcolor=green]\n", i);
-
- /* Highlight stores to memory. */
- if (RDG_MEM_WRITE_STMT (rdg, i))
- fprintf (file, "%d [style=filled, fillcolor=red]\n", i);
-
- if (v->succ)
- for (e = v->succ; e; e = e->succ_next)
- switch (RDGE_TYPE (e))
- {
- case input_dd:
- fprintf (file, "%d -> %d [label=input] \n", i, e->dest);
- break;
-
- case output_dd:
- fprintf (file, "%d -> %d [label=output] \n", i, e->dest);
- break;
-
- case flow_dd:
- /* These are the most common dependences: don't print these. */
- fprintf (file, "%d -> %d \n", i, e->dest);
- break;
-
- case anti_dd:
- fprintf (file, "%d -> %d [label=anti] \n", i, e->dest);
- break;
-
- default:
- gcc_unreachable ();
- }
- }
-
- fprintf (file, "}\n\n");
-}
-
-/* Display the Reduced Dependence Graph using dotty. */
-extern void dot_rdg (struct graph *);
-
-DEBUG_FUNCTION void
-dot_rdg (struct graph *rdg)
-{
- /* When debugging, enable the following code. This cannot be used
- in production compilers because it calls "system". */
-#if 0
- FILE *file = fopen ("/tmp/rdg.dot", "w");
- gcc_assert (file != NULL);
-
- dot_rdg_1 (file, rdg);
- fclose (file);
-
- system ("dotty /tmp/rdg.dot &");
-#else
- dot_rdg_1 (stderr, rdg);
-#endif
-}
-
-/* Returns the index of STMT in RDG. */
-
-int
-rdg_vertex_for_stmt (struct graph *rdg ATTRIBUTE_UNUSED, gimple stmt)
-{
- int index = gimple_uid (stmt);
- gcc_checking_assert (index == -1 || RDG_STMT (rdg, index) == stmt);
- return index;
-}
-
-/* Creates an edge in RDG for each distance vector from DDR. The
- order that we keep track of in the RDG is the order in which
- statements have to be executed. */
-
-static void
-create_rdg_edge_for_ddr (struct graph *rdg, ddr_p ddr)
-{
- struct graph_edge *e;
- int va, vb;
- data_reference_p dra = DDR_A (ddr);
- data_reference_p drb = DDR_B (ddr);
- unsigned level = ddr_dependence_level (ddr);
-
- /* For non scalar dependences, when the dependence is REVERSED,
- statement B has to be executed before statement A. */
- if (level > 0
- && !DDR_REVERSED_P (ddr))
- {
- data_reference_p tmp = dra;
- dra = drb;
- drb = tmp;
- }
-
- va = rdg_vertex_for_stmt (rdg, DR_STMT (dra));
- vb = rdg_vertex_for_stmt (rdg, DR_STMT (drb));
-
- if (va < 0 || vb < 0)
- return;
-
- e = add_edge (rdg, va, vb);
- e->data = XNEW (struct rdg_edge);
-
- RDGE_LEVEL (e) = level;
- RDGE_RELATION (e) = ddr;
-
- /* Determines the type of the data dependence. */
- if (DR_IS_READ (dra) && DR_IS_READ (drb))
- RDGE_TYPE (e) = input_dd;
- else if (DR_IS_WRITE (dra) && DR_IS_WRITE (drb))
- RDGE_TYPE (e) = output_dd;
- else if (DR_IS_WRITE (dra) && DR_IS_READ (drb))
- RDGE_TYPE (e) = flow_dd;
- else if (DR_IS_READ (dra) && DR_IS_WRITE (drb))
- RDGE_TYPE (e) = anti_dd;
-}
-
-/* Creates dependence edges in RDG for all the uses of DEF. IDEF is
- the index of DEF in RDG. */
-
-static void
-create_rdg_edges_for_scalar (struct graph *rdg, tree def, int idef)
-{
- use_operand_p imm_use_p;
- imm_use_iterator iterator;
-
- FOR_EACH_IMM_USE_FAST (imm_use_p, iterator, def)
- {
- struct graph_edge *e;
- int use = rdg_vertex_for_stmt (rdg, USE_STMT (imm_use_p));
-
- if (use < 0)
- continue;
-
- e = add_edge (rdg, idef, use);
- e->data = XNEW (struct rdg_edge);
- RDGE_TYPE (e) = flow_dd;
- RDGE_RELATION (e) = NULL;
- }
-}
-
-/* Creates the edges of the reduced dependence graph RDG. */
-
-static void
-create_rdg_edges (struct graph *rdg, vec<ddr_p> ddrs)
-{
- int i;
- struct data_dependence_relation *ddr;
- def_operand_p def_p;
- ssa_op_iter iter;
-
- FOR_EACH_VEC_ELT (ddrs, i, ddr)
- if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
- create_rdg_edge_for_ddr (rdg, ddr);
-
- for (i = 0; i < rdg->n_vertices; i++)
- FOR_EACH_PHI_OR_STMT_DEF (def_p, RDG_STMT (rdg, i),
- iter, SSA_OP_DEF)
- create_rdg_edges_for_scalar (rdg, DEF_FROM_PTR (def_p), i);
-}
-
-/* Build the vertices of the reduced dependence graph RDG. */
-
-static void
-create_rdg_vertices (struct graph *rdg, vec<gimple> stmts, loop_p loop)
-{
- int i, j;
- gimple stmt;
-
- FOR_EACH_VEC_ELT (stmts, i, stmt)
- {
- vec<data_ref_loc, va_stack> references;
- data_ref_loc *ref;
- struct vertex *v = &(rdg->vertices[i]);
-
- /* Record statement to vertex mapping. */
- gimple_set_uid (stmt, i);
-
- v->data = XNEW (struct rdg_vertex);
- RDGV_STMT (v) = stmt;
- RDGV_DATAREFS (v).create (0);
- RDGV_HAS_MEM_WRITE (v) = false;
- RDGV_HAS_MEM_READS (v) = false;
- if (gimple_code (stmt) == GIMPLE_PHI)
- continue;
-
- vec_stack_alloc (data_ref_loc, references, 2);
- get_references_in_stmt (stmt, &references);
- FOR_EACH_VEC_ELT (references, j, ref)
- {
- data_reference_p dr;
- if (!ref->is_read)
- RDGV_HAS_MEM_WRITE (v) = true;
- else
- RDGV_HAS_MEM_READS (v) = true;
- dr = create_data_ref (loop, loop_containing_stmt (stmt),
- *ref->pos, stmt, ref->is_read);
- if (dr)
- RDGV_DATAREFS (v).safe_push (dr);
- }
- references.release ();
- }
-}
-
-/* Initialize STMTS with all the statements of LOOP. When
- INCLUDE_PHIS is true, include also the PHI nodes. The order in
- which we discover statements is important as
- generate_loops_for_partition is using the same traversal for
- identifying statements. */
-
-static void
-stmts_from_loop (struct loop *loop, vec<gimple> *stmts)
-{
- unsigned int i;
- basic_block *bbs = get_loop_body_in_dom_order (loop);
-
- for (i = 0; i < loop->num_nodes; i++)
- {
- basic_block bb = bbs[i];
- gimple_stmt_iterator bsi;
- gimple stmt;
-
- for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- stmts->safe_push (gsi_stmt (bsi));
-
- for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- {
- stmt = gsi_stmt (bsi);
- if (gimple_code (stmt) != GIMPLE_LABEL && !is_gimple_debug (stmt))
- stmts->safe_push (stmt);
- }
- }
-
- free (bbs);
-}
-
-/* Returns true when all the dependences are computable. */
-
-static bool
-known_dependences_p (vec<ddr_p> dependence_relations)
-{
- ddr_p ddr;
- unsigned int i;
-
- FOR_EACH_VEC_ELT (dependence_relations, i, ddr)
- if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
- return false;
-
- return true;
-}
-
-/* Build the Reduced Dependence Graph (RDG) with one vertex per
- statement of the loop nest, and one edge per data dependence or
- scalar dependence. */
-
-struct graph *
-build_empty_rdg (int n_stmts)
-{
- struct graph *rdg = new_graph (n_stmts);
- return rdg;
-}
-
-/* Build the Reduced Dependence Graph (RDG) with one vertex per
- statement of the loop nest, and one edge per data dependence or
- scalar dependence. */
-
-struct graph *
-build_rdg (struct loop *loop,
- vec<loop_p> *loop_nest,
- vec<ddr_p> *dependence_relations,
- vec<data_reference_p> *datarefs)
-{
- struct graph *rdg = NULL;
-
- if (compute_data_dependences_for_loop (loop, false, loop_nest, datarefs,
- dependence_relations)
- && known_dependences_p (*dependence_relations))
- {
- vec<gimple> stmts;
- stmts.create (10);
- stmts_from_loop (loop, &stmts);
- rdg = build_empty_rdg (stmts.length ());
- create_rdg_vertices (rdg, stmts, loop);
- create_rdg_edges (rdg, *dependence_relations);
- stmts.release ();
- }
-
- return rdg;
-}
-
-/* Free the reduced dependence graph RDG. */
-
-void
-free_rdg (struct graph *rdg)
-{
- int i;
-
- for (i = 0; i < rdg->n_vertices; i++)
- {
- struct vertex *v = &(rdg->vertices[i]);
- struct graph_edge *e;
-
- for (e = v->succ; e; e = e->succ_next)
- free (e->data);
-
- gimple_set_uid (RDGV_STMT (v), -1);
- free_data_refs (RDGV_DATAREFS (v));
- free (v->data);
- }
-
- free_graph (rdg);
-}
-
-/* Determines whether the statement from vertex V of the RDG has a
- definition used outside the loop that contains this statement. */
-
-bool
-rdg_defs_used_in_other_loops_p (struct graph *rdg, int v)
-{
- gimple stmt = RDG_STMT (rdg, v);
- struct loop *loop = loop_containing_stmt (stmt);
- use_operand_p imm_use_p;
- imm_use_iterator iterator;
- ssa_op_iter it;
- def_operand_p def_p;
-
- if (!loop)
- return true;
-
- FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, it, SSA_OP_DEF)
- {
- FOR_EACH_IMM_USE_FAST (imm_use_p, iterator, DEF_FROM_PTR (def_p))
- {
- if (loop_containing_stmt (USE_STMT (imm_use_p)) != loop)
- return true;
- }
- }
-
- return false;
-}
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index 27737262b1f..14a5a21af83 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -144,7 +144,7 @@ struct access_matrix
#define AM_NB_INDUCTION_VARS(M) (M)->nb_induction_vars
#define AM_PARAMETERS(M) (M)->parameters
#define AM_MATRIX(M) (M)->matrix
-#define AM_NB_PARAMETERS(M) (AM_PARAMETERS(M)).length ()
+#define AM_NB_PARAMETERS(M) (AM_PARAMETERS (M)).length ()
#define AM_CONST_COLUMN_INDEX(M) (AM_NB_INDUCTION_VARS (M) + AM_NB_PARAMETERS (M))
#define AM_NB_COLUMNS(M) (AM_NB_INDUCTION_VARS (M) + AM_NB_PARAMETERS (M) + 1)
#define AM_GET_SUBSCRIPT_ACCESS_VECTOR(M, I) AM_MATRIX (M)[I]
@@ -162,7 +162,7 @@ am_vector_index_for_loop (struct access_matrix *access_matrix, int loop_num)
if (l->num == loop_num)
return i;
- gcc_unreachable();
+ gcc_unreachable ();
}
struct data_reference
@@ -482,6 +482,21 @@ ddrs_have_anti_deps (vec<ddr_p> dependence_relations)
return false;
}
+/* Returns true when all the dependences are computable. */
+
+inline bool
+known_dependences_p (vec<ddr_p> dependence_relations)
+{
+ ddr_p ddr;
+ unsigned int i;
+
+ FOR_EACH_VEC_ELT (dependence_relations, i, ddr)
+ if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
+ return false;
+
+ return true;
+}
+
/* Returns the dependence level for a vector DIST of size LENGTH.
LEVEL = 0 means a lexicographic dependence, i.e. a dependence due
to the sequence of statements, not carried by any loop. */
@@ -515,83 +530,6 @@ ddr_dependence_level (ddr_p ddr)
return level;
}
-
-
-/* A Reduced Dependence Graph (RDG) vertex representing a statement. */
-typedef struct rdg_vertex
-{
- /* The statement represented by this vertex. */
- gimple stmt;
-
- /* Vector of data-references in this statement. */
- vec<data_reference_p> datarefs;
-
- /* True when the statement contains a write to memory. */
- bool has_mem_write;
-
- /* True when the statement contains a read from memory. */
- bool has_mem_reads;
-} *rdg_vertex_p;
-
-#define RDGV_STMT(V) ((struct rdg_vertex *) ((V)->data))->stmt
-#define RDGV_DATAREFS(V) ((struct rdg_vertex *) ((V)->data))->datarefs
-#define RDGV_HAS_MEM_WRITE(V) ((struct rdg_vertex *) ((V)->data))->has_mem_write
-#define RDGV_HAS_MEM_READS(V) ((struct rdg_vertex *) ((V)->data))->has_mem_reads
-#define RDG_STMT(RDG, I) RDGV_STMT (&(RDG->vertices[I]))
-#define RDG_DATAREFS(RDG, I) RDGV_DATAREFS (&(RDG->vertices[I]))
-#define RDG_MEM_WRITE_STMT(RDG, I) RDGV_HAS_MEM_WRITE (&(RDG->vertices[I]))
-#define RDG_MEM_READS_STMT(RDG, I) RDGV_HAS_MEM_READS (&(RDG->vertices[I]))
-
-void debug_rdg_vertex (struct graph *, int);
-void debug_rdg_component (struct graph *, int);
-void dump_rdg (FILE *, struct graph *);
-void debug_rdg (struct graph *);
-int rdg_vertex_for_stmt (struct graph *, gimple);
-
-/* Data dependence type. */
-
-enum rdg_dep_type
-{
- /* Read After Write (RAW). */
- flow_dd = 'f',
-
- /* Write After Read (WAR). */
- anti_dd = 'a',
-
- /* Write After Write (WAW). */
- output_dd = 'o',
-
- /* Read After Read (RAR). */
- input_dd = 'i'
-};
-
-/* Dependence information attached to an edge of the RDG. */
-
-typedef struct rdg_edge
-{
- /* Type of the dependence. */
- enum rdg_dep_type type;
-
- /* Levels of the dependence: the depth of the loops that carry the
- dependence. */
- unsigned level;
-
- /* Dependence relation between data dependences, NULL when one of
- the vertices is a scalar. */
- ddr_p relation;
-} *rdg_edge_p;
-
-#define RDGE_TYPE(E) ((struct rdg_edge *) ((E)->data))->type
-#define RDGE_LEVEL(E) ((struct rdg_edge *) ((E)->data))->level
-#define RDGE_RELATION(E) ((struct rdg_edge *) ((E)->data))->relation
-
-struct graph *build_rdg (struct loop *,
- vec<loop_p> *,
- vec<ddr_p> *,
- vec<data_reference_p> *);
-struct graph *build_empty_rdg (int);
-void free_rdg (struct graph *);
-
/* Return the index of the variable VAR in the LOOP_NEST array. */
static inline int
@@ -608,8 +546,6 @@ index_in_loop_nest (int var, vec<loop_p> loop_nest)
return var_index;
}
-bool rdg_defs_used_in_other_loops_p (struct graph *, int);
-
/* Returns true when the data reference DR the form "A[i] = ..."
with a stride equal to its unit type size. */
@@ -630,19 +566,8 @@ adjacent_dr_p (struct data_reference *dr)
TYPE_SIZE_UNIT (TREE_TYPE (DR_REF (dr))));
}
-/* In tree-data-ref.c */
void split_constant_offset (tree , tree *, tree *);
-/* Strongly connected components of the reduced data dependence graph. */
-
-typedef struct rdg_component
-{
- int num;
- vec<int> vertices;
-} *rdgc;
-
-
-
/* Compute the greatest common divisor of a VECTOR of SIZE numbers. */
static inline int
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 57aae95a074..bc825be8232 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "tree-pretty-print.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "tree-pass.h"
#include "convert.h"
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 6ffbd266711..1ad5baf5828 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "except.h"
#include "pointer-set.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "tree-pass.h"
#include "langhooks.h"
@@ -1737,7 +1737,7 @@ lower_try_finally (struct leh_state *state, gimple tp)
{
gimple_seq new_eh_seq = eh_seq;
eh_seq = old_eh_seq;
- gimple_seq_add_seq(&eh_seq, new_eh_seq);
+ gimple_seq_add_seq (&eh_seq, new_eh_seq);
}
}
@@ -2177,8 +2177,8 @@ const pass_data pass_data_lower_eh =
class pass_lower_eh : public gimple_opt_pass
{
public:
- pass_lower_eh(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_eh, ctxt)
+ pass_lower_eh (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_eh, ctxt)
{}
/* opt_pass methods: */
@@ -3054,8 +3054,8 @@ const pass_data pass_data_refactor_eh =
class pass_refactor_eh : public gimple_opt_pass
{
public:
- pass_refactor_eh(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_refactor_eh, ctxt)
+ pass_refactor_eh (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_refactor_eh, ctxt)
{}
/* opt_pass methods: */
@@ -3281,8 +3281,8 @@ const pass_data pass_data_lower_resx =
class pass_lower_resx : public gimple_opt_pass
{
public:
- pass_lower_resx(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_resx, ctxt)
+ pass_lower_resx (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_resx, ctxt)
{}
/* opt_pass methods: */
@@ -3692,8 +3692,8 @@ const pass_data pass_data_lower_eh_dispatch =
class pass_lower_eh_dispatch : public gimple_opt_pass
{
public:
- pass_lower_eh_dispatch(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_eh_dispatch, ctxt)
+ pass_lower_eh_dispatch (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_eh_dispatch, ctxt)
{}
/* opt_pass methods: */
@@ -4536,12 +4536,12 @@ const pass_data pass_data_cleanup_eh =
class pass_cleanup_eh : public gimple_opt_pass
{
public:
- pass_cleanup_eh(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_cleanup_eh, ctxt)
+ pass_cleanup_eh (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_cleanup_eh, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_cleanup_eh (ctxt_); }
+ opt_pass * clone () { return new pass_cleanup_eh (m_ctxt); }
bool gate () { return gate_cleanup_eh (); }
unsigned int execute () { return execute_cleanup_eh (); }
diff --git a/gcc/tree-emutls.c b/gcc/tree-emutls.c
index ed8edc3569c..73592953912 100644
--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "langhooks.h"
#include "target.h"
@@ -606,7 +606,7 @@ static inline void
clear_access_vars (void)
{
memset (access_vars.address (), 0,
- access_vars.length () * sizeof(tree));
+ access_vars.length () * sizeof (tree));
}
/* Lower the entire function NODE. */
@@ -831,8 +831,8 @@ const pass_data pass_data_ipa_lower_emutls =
class pass_ipa_lower_emutls : public simple_ipa_opt_pass
{
public:
- pass_ipa_lower_emutls(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_lower_emutls, ctxt)
+ pass_ipa_lower_emutls (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_lower_emutls, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index d5b2185102c..03c4840bf1a 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -1158,70 +1158,6 @@ gimple_ssa_operands (const struct function *fun)
return &fun->gimple_df->ssa_operands;
}
-/* Given an edge_var_map V, return the PHI arg definition. */
-
-static inline tree
-redirect_edge_var_map_def (edge_var_map *v)
-{
- return v->def;
-}
-
-/* Given an edge_var_map V, return the PHI result. */
-
-static inline tree
-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. */
-
-static inline tree
-make_ssa_name (tree var, gimple stmt)
-{
- return make_ssa_name_fn (cfun, var, stmt);
-}
-
-/* Return an SSA_NAME node using the template SSA name NAME defined in
- statement STMT in function cfun. */
-
-static inline tree
-copy_ssa_name (tree var, gimple stmt)
-{
- return copy_ssa_name_fn (cfun, var, stmt);
-}
-
-/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
- in function cfun. */
-
-static inline tree
-duplicate_ssa_name (tree var, gimple stmt)
-{
- return duplicate_ssa_name_fn (cfun, var, stmt);
-}
-
-/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
- in function cfun. Arrange so that it uses NAME in dumps. */
-
-static inline tree
-make_temp_ssa_name (tree type, gimple stmt, const char *name)
-{
- tree ssa_name;
- gcc_checking_assert (TYPE_P (type));
- ssa_name = make_ssa_name_fn (cfun, type, stmt);
- SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name));
- return ssa_name;
-}
/* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
denotes the starting address of the memory access EXP.
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 333e1687e5d..3f3c3be3830 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -92,12 +92,6 @@ struct GTY(()) gimple_df {
htab_t GTY ((param_is (struct tm_restart_node))) tm_restart;
};
-/* Accessors for internal use only. Generic code should use abstraction
- provided by tree-flow-inline.h or specific modules. */
-#define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames
-#define SSANAMES(fun) (fun)->gimple_df->ssa_names
-#define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
-#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
typedef struct
{
@@ -113,41 +107,6 @@ typedef struct
!end_htab_p (&(ITER)); \
RESULT = (TYPE) next_htab_element (&(ITER)))
-/*---------------------------------------------------------------------------
- Attributes for SSA_NAMEs.
-
- NOTE: These structures are stored in struct tree_ssa_name
- but are only used by the tree optimizers, so it makes better sense
- to declare them here to avoid recompiling unrelated files when
- making changes.
----------------------------------------------------------------------------*/
-
-/* Aliasing information for SSA_NAMEs representing pointer variables. */
-
-struct GTY(()) ptr_info_def
-{
- /* The points-to solution. */
- struct pt_solution pt;
-
- /* Alignment and misalignment of the pointer in bytes. Together
- align and misalign specify low known bits of the pointer.
- ptr & (align - 1) == misalign. */
-
- /* When known, this is the power-of-two byte alignment of the object this
- pointer points into. This is usually DECL_ALIGN_UNIT for decls and
- MALLOC_ABI_ALIGNMENT for allocated storage. When the alignment is not
- known, it is zero. Do not access directly but use functions
- get_ptr_info_alignment, set_ptr_info_alignment,
- mark_ptr_info_alignment_unknown and similar. */
- unsigned int align;
-
- /* When alignment is known, the byte offset this pointer differs from the
- above alignment. Access only through the same helper functions as align
- above. */
- unsigned int misalign;
-};
-
-
/* It is advantageous to avoid things like life analysis for variables which
do not need PHI nodes. This enum describes whether or not a particular
variable may need a PHI node. */
@@ -282,9 +241,6 @@ struct int_tree_map {
tree to;
};
-#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
-#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
-
/* Macros for showing usage statistics. */
#define SCALE(x) ((unsigned long) ((x) < 1024*10 \
? (x) \
@@ -465,48 +421,6 @@ extern bool gimple_seq_may_fallthru (gimple_seq);
extern bool gimple_stmt_may_fallthru (gimple);
extern bool gimple_check_call_matching_types (gimple, tree, bool);
-
-/* In tree-ssa.c */
-
-/* Mapping for redirected edges. */
-struct _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;
-
-
-/* A vector of var maps. */
-typedef vec<edge_var_map, va_heap, vl_embed> edge_var_map_vector;
-
-extern void init_tree_ssa (struct function *);
-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);
-extern void redirect_edge_var_map_destroy (void);
-
-extern edge ssa_redirect_edge (edge, basic_block);
-extern void flush_pending_stmts (edge);
-extern void verify_ssa (bool);
-extern void delete_tree_ssa (void);
-extern bool ssa_undefined_value_p (tree);
-extern void warn_uninit (enum opt_code, tree, tree, tree, const char *, void *);
-extern unsigned int warn_uninitialized_vars (bool);
-extern void execute_update_addresses_taken (void);
-
-/* Call-back function for walk_use_def_chains(). At each reaching
- definition, a function with this prototype is called. */
-typedef bool (*walk_use_def_chains_fn) (tree, gimple, void *);
-
-extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
-
-void insert_debug_temps_for_defs (gimple_stmt_iterator *);
-void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree);
-void reset_debug_uses (gimple);
-void release_defs_bitset (bitmap toremove);
-
/* In tree-into-ssa.c */
void update_ssa (unsigned);
void delete_update_ssa (void);
@@ -518,26 +432,6 @@ void mark_virtual_operands_for_renaming (struct function *);
tree get_current_def (tree);
void set_current_def (tree, tree);
-/* In tree-ssanames.c */
-extern void init_ssanames (struct function *, int);
-extern void fini_ssanames (void);
-extern tree make_ssa_name_fn (struct function *, tree, gimple);
-extern tree copy_ssa_name_fn (struct function *, tree, gimple);
-extern tree duplicate_ssa_name_fn (struct function *, tree, gimple);
-extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
-extern void release_ssa_name (tree);
-extern void release_defs (gimple);
-extern void replace_ssa_name_symbol (tree, tree);
-extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
- unsigned int *);
-extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
-extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
- unsigned int);
-extern void adjust_ptr_info_misalignment (struct ptr_info_def *,
- unsigned int);
-
-extern void ssanames_print_statistics (void);
-
/* In tree-ssa-ccp.c */
tree fold_const_aggregate_ref (tree);
tree gimple_fold_stmt_to_constant (gimple, tree (*)(tree));
@@ -675,8 +569,8 @@ extern void threadedge_initialize_values (void);
extern void threadedge_finalize_values (void);
extern vec<tree> ssa_name_values;
#define SSA_NAME_VALUE(x) \
- (SSA_NAME_VERSION(x) < ssa_name_values.length () \
- ? ssa_name_values[SSA_NAME_VERSION(x)] \
+ (SSA_NAME_VERSION (x) < ssa_name_values.length () \
+ ? ssa_name_values[SSA_NAME_VERSION (x)] \
: NULL_TREE)
extern void set_ssa_name_value (tree, tree);
extern bool potentially_threadable_block (basic_block);
@@ -747,10 +641,6 @@ bool multiplier_allowed_in_address_p (HOST_WIDE_INT, enum machine_mode,
addr_space_t);
bool may_be_nonaddressable_p (tree expr);
-/* In tree-ssa-threadupdate.c. */
-extern bool thread_through_all_blocks (bool);
-extern void register_jump_thread (vec<edge>, bool);
-
/* In gimplify.c */
tree force_gimple_operand_1 (tree, gimple_seq *, gimple_predicate, tree);
tree force_gimple_operand (tree, gimple_seq *, bool, tree);
@@ -789,9 +679,6 @@ bool fixup_noreturn_call (gimple stmt);
/* In ipa-pure-const.c */
void warn_function_noreturn (tree);
-/* In tree-ssa-ter.c */
-bool stmt_is_replaceable_p (gimple);
-
/* In tree-parloops.c */
bool parallelized_function_p (tree);
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 3ef356a0ac7..b487381e4be 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -88,7 +88,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "tree-data-ref.h"
@@ -1789,7 +1789,7 @@ main_tree_if_conversion (void)
FOR_EACH_LOOP (li, loop, 0)
if (flag_tree_loop_if_convert == 1
|| flag_tree_loop_if_convert_stores == 1
- || flag_tree_vectorize
+ || flag_tree_loop_vectorize
|| loop->force_vect)
changed |= tree_if_conversion (loop);
@@ -1815,7 +1815,7 @@ main_tree_if_conversion (void)
static bool
gate_tree_if_conversion (void)
{
- return (((flag_tree_vectorize || cfun->has_force_vect_loops)
+ return (((flag_tree_loop_vectorize || cfun->has_force_vect_loops)
&& flag_tree_loop_if_convert != 0)
|| flag_tree_loop_if_convert == 1
|| flag_tree_loop_if_convert_stores == 1);
@@ -1842,8 +1842,8 @@ const pass_data pass_data_if_conversion =
class pass_if_conversion : public gimple_opt_pass
{
public:
- pass_if_conversion(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_if_conversion, ctxt)
+ pass_if_conversion (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_if_conversion, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 40eb3807119..ebb4b918813 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -36,9 +36,9 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "intl.h"
#include "tree-mudflap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "function.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pretty-print.h"
#include "except.h"
#include "debug.h"
@@ -751,6 +751,20 @@ copy_gimple_bind (gimple stmt, copy_body_data *id)
return new_bind;
}
+/* Return true if DECL is a parameter or a SSA_NAME for a parameter. */
+
+static bool
+is_parm (tree decl)
+{
+ if (TREE_CODE (decl) == SSA_NAME)
+ {
+ decl = SSA_NAME_VAR (decl);
+ if (!decl)
+ return false;
+ }
+
+ return (TREE_CODE (decl) == PARM_DECL);
+}
/* Remap the GIMPLE operand pointed to by *TP. DATA is really a
'struct walk_stmt_info *'. DATA->INFO is a 'copy_body_data *'.
@@ -840,20 +854,24 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data)
if (TREE_CODE (*tp) == MEM_REF)
{
- tree ptr = TREE_OPERAND (*tp, 0);
- tree type = remap_type (TREE_TYPE (*tp), id);
- tree old = *tp;
-
/* We need to re-canonicalize MEM_REFs from inline substitutions
that can happen when a pointer argument is an ADDR_EXPR.
Recurse here manually to allow that. */
+ tree ptr = TREE_OPERAND (*tp, 0);
+ tree type = remap_type (TREE_TYPE (*tp), id);
+ tree old = *tp;
walk_tree (&ptr, remap_gimple_op_r, data, NULL);
- *tp = fold_build2 (MEM_REF, type,
- ptr, TREE_OPERAND (*tp, 1));
- TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
+ *tp = fold_build2 (MEM_REF, type, ptr, TREE_OPERAND (*tp, 1));
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
+ /* We cannot propagate the TREE_THIS_NOTRAP flag if we have
+ remapped a parameter as the property might be valid only
+ for the parameter itself. */
+ if (TREE_THIS_NOTRAP (old)
+ && (!is_parm (TREE_OPERAND (old, 0))
+ || (!id->transform_parameter && is_parm (ptr))))
+ TREE_THIS_NOTRAP (*tp) = 1;
*walk_subtrees = 0;
return NULL;
}
@@ -1043,45 +1061,44 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
/* Get rid of *& from inline substitutions that can happen when a
pointer argument is an ADDR_EXPR. */
tree decl = TREE_OPERAND (*tp, 0);
- tree *n;
-
- n = (tree *) pointer_map_contains (id->decl_map, decl);
+ tree *n = (tree *) pointer_map_contains (id->decl_map, decl);
if (n)
{
- tree new_tree;
- tree old;
/* If we happen to get an ADDR_EXPR in n->value, strip
it manually here as we'll eventually get ADDR_EXPRs
which lie about their types pointed to. In this case
build_fold_indirect_ref wouldn't strip the INDIRECT_REF,
but we absolutely rely on that. As fold_indirect_ref
does other useful transformations, try that first, though. */
- tree type = TREE_TYPE (TREE_TYPE (*n));
- if (id->do_not_unshare)
- new_tree = *n;
- else
- new_tree = unshare_expr (*n);
- old = *tp;
- *tp = gimple_fold_indirect_ref (new_tree);
+ tree type = TREE_TYPE (*tp);
+ tree ptr = id->do_not_unshare ? *n : unshare_expr (*n);
+ tree old = *tp;
+ *tp = gimple_fold_indirect_ref (ptr);
if (! *tp)
{
- if (TREE_CODE (new_tree) == ADDR_EXPR)
+ if (TREE_CODE (ptr) == ADDR_EXPR)
{
- *tp = fold_indirect_ref_1 (EXPR_LOCATION (new_tree),
- type, new_tree);
+ *tp
+ = fold_indirect_ref_1 (EXPR_LOCATION (ptr), type, ptr);
/* ??? We should either assert here or build
a VIEW_CONVERT_EXPR instead of blindly leaking
incompatible types to our IL. */
if (! *tp)
- *tp = TREE_OPERAND (new_tree, 0);
+ *tp = TREE_OPERAND (ptr, 0);
}
else
{
- *tp = build1 (INDIRECT_REF, type, new_tree);
+ *tp = build1 (INDIRECT_REF, type, ptr);
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
TREE_READONLY (*tp) = TREE_READONLY (old);
- TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
+ /* We cannot propagate the TREE_THIS_NOTRAP flag if we
+ have remapped a parameter as the property might be
+ valid only for the parameter itself. */
+ if (TREE_THIS_NOTRAP (old)
+ && (!is_parm (TREE_OPERAND (old, 0))
+ || (!id->transform_parameter && is_parm (ptr))))
+ TREE_THIS_NOTRAP (*tp) = 1;
}
}
*walk_subtrees = 0;
@@ -1090,20 +1107,24 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data)
}
else if (TREE_CODE (*tp) == MEM_REF)
{
- tree ptr = TREE_OPERAND (*tp, 0);
- tree type = remap_type (TREE_TYPE (*tp), id);
- tree old = *tp;
-
/* We need to re-canonicalize MEM_REFs from inline substitutions
that can happen when a pointer argument is an ADDR_EXPR.
Recurse here manually to allow that. */
+ tree ptr = TREE_OPERAND (*tp, 0);
+ tree type = remap_type (TREE_TYPE (*tp), id);
+ tree old = *tp;
walk_tree (&ptr, copy_tree_body_r, data, NULL);
- *tp = fold_build2 (MEM_REF, type,
- ptr, TREE_OPERAND (*tp, 1));
- TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old);
+ *tp = fold_build2 (MEM_REF, type, ptr, TREE_OPERAND (*tp, 1));
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old);
+ /* We cannot propagate the TREE_THIS_NOTRAP flag if we have
+ remapped a parameter as the property might be valid only
+ for the parameter itself. */
+ if (TREE_THIS_NOTRAP (old)
+ && (!is_parm (TREE_OPERAND (old, 0))
+ || (!id->transform_parameter && is_parm (ptr))))
+ TREE_THIS_NOTRAP (*tp) = 1;
*walk_subtrees = 0;
return NULL;
}
@@ -2241,14 +2262,14 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb)
as siblings of DEST_PARENT. */
static void
-copy_loops (bitmap blocks_to_copy,
+copy_loops (copy_body_data *id,
struct loop *dest_parent, struct loop *src_parent)
{
struct loop *src_loop = src_parent->inner;
while (src_loop)
{
- if (!blocks_to_copy
- || bitmap_bit_p (blocks_to_copy, src_loop->header->index))
+ if (!id->blocks_to_copy
+ || bitmap_bit_p (id->blocks_to_copy, src_loop->header->index))
{
struct loop *dest_loop = alloc_loop ();
@@ -2272,8 +2293,19 @@ copy_loops (bitmap blocks_to_copy,
place_new_loop (cfun, dest_loop);
flow_loop_tree_node_add (dest_parent, dest_loop);
+ if (src_loop->simduid)
+ {
+ dest_loop->simduid = remap_decl (src_loop->simduid, id);
+ cfun->has_simduid_loops = true;
+ }
+ if (src_loop->force_vect)
+ {
+ dest_loop->force_vect = true;
+ cfun->has_force_vect_loops = true;
+ }
+
/* Recurse. */
- copy_loops (blocks_to_copy, dest_loop, src_loop);
+ copy_loops (id, dest_loop, src_loop);
}
src_loop = src_loop->next;
}
@@ -2302,7 +2334,7 @@ redirect_all_calls (copy_body_data * id, basic_block bb)
static tree
copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
basic_block entry_block_map, basic_block exit_block_map,
- bitmap blocks_to_copy, basic_block new_entry)
+ basic_block new_entry)
{
tree callee_fndecl = id->src_fn;
/* Original cfun for the callee, doesn't change. */
@@ -2366,7 +2398,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
/* Use aux pointers to map the original blocks to copy. */
FOR_EACH_BB_FN (bb, cfun_to_copy)
- if (!blocks_to_copy || bitmap_bit_p (blocks_to_copy, bb->index))
+ if (!id->blocks_to_copy || bitmap_bit_p (id->blocks_to_copy, bb->index))
{
basic_block new_bb = copy_bb (id, bb, frequency_scale, count_scale);
bb->aux = new_bb;
@@ -2380,8 +2412,8 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
bool can_make_abormal_goto
= id->gimple_call && stmt_can_make_abnormal_goto (id->gimple_call);
FOR_ALL_BB_FN (bb, cfun_to_copy)
- if (!blocks_to_copy
- || (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
+ if (!id->blocks_to_copy
+ || (bb->index > 0 && bitmap_bit_p (id->blocks_to_copy, bb->index)))
need_debug_cleanup |= copy_edges_for_bb (bb, count_scale, exit_block_map,
can_make_abormal_goto);
@@ -2396,12 +2428,10 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
if (loops_for_fn (src_cfun) != NULL
&& current_loops != NULL)
{
- copy_loops (blocks_to_copy, entry_block_map->loop_father,
+ copy_loops (id, entry_block_map->loop_father,
get_loop (src_cfun, 0));
/* Defer to cfgcleanup to update loop-father fields of basic-blocks. */
loops_state_set (LOOPS_NEED_FIXUP);
- cfun->has_force_vect_loops |= src_cfun->has_force_vect_loops;
- cfun->has_simduid_loops |= src_cfun->has_simduid_loops;
}
/* If the loop tree in the source function needed fixup, mark the
@@ -2411,8 +2441,8 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
if (gimple_in_ssa_p (cfun))
FOR_ALL_BB_FN (bb, cfun_to_copy)
- if (!blocks_to_copy
- || (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
+ if (!id->blocks_to_copy
+ || (bb->index > 0 && bitmap_bit_p (id->blocks_to_copy, bb->index)))
copy_phis_for_bb (bb, id);
FOR_ALL_BB_FN (bb, cfun_to_copy)
@@ -2584,7 +2614,7 @@ copy_tree_body (copy_body_data *id)
static tree
copy_body (copy_body_data *id, gcov_type count, int frequency_scale,
basic_block entry_block_map, basic_block exit_block_map,
- bitmap blocks_to_copy, basic_block new_entry)
+ basic_block new_entry)
{
tree fndecl = id->src_fn;
tree body;
@@ -2592,7 +2622,7 @@ copy_body (copy_body_data *id, gcov_type count, int frequency_scale,
/* If this body has a CFG, walk CFG and copy. */
gcc_assert (ENTRY_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (fndecl)));
body = copy_cfg_body (id, count, frequency_scale, entry_block_map, exit_block_map,
- blocks_to_copy, new_entry);
+ new_entry);
copy_debug_stmts (id);
return body;
@@ -4201,7 +4231,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
duplicate our body before altering anything. */
copy_body (id, bb->count,
GCOV_COMPUTE_SCALE (cg_edge->frequency, CGRAPH_FREQ_BASE),
- bb, return_block, NULL, NULL);
+ bb, return_block, NULL);
/* Reset the escaped solution. */
if (cfun->gimple_df)
@@ -4443,6 +4473,7 @@ optimize_inline_calls (tree fn)
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = false;
id.transform_return_to_modify = true;
+ id.transform_parameter = true;
id.transform_lang_insert_block = NULL;
id.statements_to_fold = pointer_set_create ();
@@ -4748,6 +4779,7 @@ copy_gimple_seq_and_replace_locals (gimple_seq seq)
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = false;
id.transform_return_to_modify = false;
+ id.transform_parameter = false;
id.transform_lang_insert_block = NULL;
/* Walk the tree once to find local labels. */
@@ -5207,6 +5239,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
= update_clones ? CB_CGE_MOVE_CLONES : CB_CGE_MOVE;
id.transform_new_cfg = true;
id.transform_return_to_modify = false;
+ id.transform_parameter = false;
id.transform_lang_insert_block = NULL;
old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION
@@ -5328,7 +5361,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
/* Copy the Function's body. */
copy_body (&id, old_entry_block->count, REG_BR_PROB_BASE,
- ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, blocks_to_copy, new_entry);
+ ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, new_entry);
/* Renumber the lexical scoping (non-code) blocks consecutively. */
number_blocks (new_decl);
@@ -5431,6 +5464,7 @@ maybe_inline_call_in_expr (tree exp)
id.transform_call_graph_edges = CB_CGE_DUPLICATE;
id.transform_new_cfg = false;
id.transform_return_to_modify = true;
+ id.transform_parameter = true;
id.transform_lang_insert_block = NULL;
/* Make sure not to unshare trees behind the front-end's back
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index 620ec977768..a78e4b69f0e 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -97,6 +97,10 @@ typedef struct copy_body_data
by manipulating the CFG rather than a statement. */
bool transform_return_to_modify;
+ /* True if the parameters of the source function are transformed.
+ Only true for inlining. */
+ bool transform_parameter;
+
/* True if this statement will need to be regimplified. */
bool regimplify;
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index 33d4ba8c623..18b00a888ea 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "gimple-pretty-print.h"
#include "bitmap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-inline.h"
#include "hash-table.h"
@@ -1399,14 +1399,22 @@ rewrite_add_phi_arguments (basic_block bb)
}
}
+class rewrite_dom_walker : public dom_walker
+{
+public:
+ rewrite_dom_walker (cdi_direction direction) : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+};
+
/* SSA Rewriting Step 1. Initialization, create a block local stack
of reaching definitions for new SSA names produced in this block
(BLOCK_DEFS). Register new definitions for every PHI node in the
block. */
-static void
-rewrite_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+rewrite_dom_walker::before_dom_children (basic_block bb)
{
gimple_stmt_iterator gsi;
@@ -1444,9 +1452,8 @@ rewrite_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Called after visiting all the statements in basic block BB and all
of its dominator children. Restore CURRDEFS to its original value. */
-static void
-rewrite_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb ATTRIBUTE_UNUSED)
+void
+rewrite_dom_walker::after_dom_children (basic_block bb ATTRIBUTE_UNUSED)
{
/* Restore CURRDEFS to its original state. */
while (block_defs_stack.length () > 0)
@@ -2065,15 +2072,22 @@ rewrite_update_phi_arguments (basic_block bb)
}
}
+class rewrite_update_dom_walker : public dom_walker
+{
+public:
+ rewrite_update_dom_walker (cdi_direction direction) : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+};
/* Initialization of block data structures for the incremental SSA
update pass. Create a block local stack of reaching definitions
for new SSA names produced in this block (BLOCK_DEFS). Register
new definitions for every PHI node in the block. */
-static void
-rewrite_update_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+rewrite_update_dom_walker::before_dom_children (basic_block bb)
{
bool is_abnormal_phi;
gimple_stmt_iterator gsi;
@@ -2146,9 +2160,8 @@ rewrite_update_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
unwinding must be done in the opposite order to what is done in
register_new_update_set. */
-static void
-rewrite_update_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb ATTRIBUTE_UNUSED)
+void
+rewrite_update_dom_walker::after_dom_children (basic_block bb ATTRIBUTE_UNUSED)
{
while (block_defs_stack.length () > 0)
{
@@ -2183,41 +2196,20 @@ rewrite_update_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
static void
rewrite_blocks (basic_block entry, enum rewrite_mode what)
{
- struct dom_walk_data walk_data;
-
/* Rewrite all the basic blocks in the program. */
timevar_push (TV_TREE_SSA_REWRITE_BLOCKS);
- /* Setup callbacks for the generic dominator tree walker. */
- memset (&walk_data, 0, sizeof (walk_data));
-
- walk_data.dom_direction = CDI_DOMINATORS;
+ block_defs_stack.create (10);
+ /* Recursively walk the dominator tree rewriting each statement in
+ each basic block. */
if (what == REWRITE_ALL)
- {
- walk_data.before_dom_children = rewrite_enter_block;
- walk_data.after_dom_children = rewrite_leave_block;
- }
+ rewrite_dom_walker (CDI_DOMINATORS).walk (entry);
else if (what == REWRITE_UPDATE)
- {
- walk_data.before_dom_children = rewrite_update_enter_block;
- walk_data.after_dom_children = rewrite_update_leave_block;
- }
+ rewrite_update_dom_walker (CDI_DOMINATORS).walk (entry);
else
gcc_unreachable ();
- block_defs_stack.create (10);
-
- /* Initialize the dominator walker. */
- init_walk_dominator_tree (&walk_data);
-
- /* Recursively walk the dominator tree rewriting each statement in
- each basic block. */
- walk_dominator_tree (&walk_data, entry);
-
- /* Finalize the dominator walker. */
- fini_walk_dominator_tree (&walk_data);
-
/* Debugging dumps. */
if (dump_file && (dump_flags & TDF_STATS))
{
@@ -2231,69 +2223,44 @@ rewrite_blocks (basic_block entry, enum rewrite_mode what)
timevar_pop (TV_TREE_SSA_REWRITE_BLOCKS);
}
-
-/* Block processing routine for mark_def_sites. Clear the KILLS bitmap
- at the start of each block, and call mark_def_sites for each statement. */
-
-static void
-mark_def_sites_block (struct dom_walk_data *walk_data, basic_block bb)
+class mark_def_dom_walker : public dom_walker
{
- struct mark_def_sites_global_data *gd;
- bitmap kills;
- gimple_stmt_iterator gsi;
-
- gd = (struct mark_def_sites_global_data *) walk_data->global_data;
- kills = gd->kills;
-
- bitmap_clear (kills);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_def_sites (bb, gsi_stmt (gsi), kills);
-}
-
-
-/* Mark the definition site blocks for each variable, so that we know
- where the variable is actually live.
-
- The INTERESTING_BLOCKS global will be filled in with all the blocks
- that should be processed by the renamer. It is assumed that the
- caller has already initialized and zeroed it. */
-
-static void
-mark_def_site_blocks (void)
-{
- struct dom_walk_data walk_data;
- struct mark_def_sites_global_data mark_def_sites_global_data;
+public:
+ mark_def_dom_walker (cdi_direction direction);
+ ~mark_def_dom_walker ();
- /* Setup callbacks for the generic dominator tree walker to find and
- mark definition sites. */
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = mark_def_sites_block;
- walk_data.after_dom_children = NULL;
+ virtual void before_dom_children (basic_block);
+private:
/* Notice that this bitmap is indexed using variable UIDs, so it must be
large enough to accommodate all the variables referenced in the
function, not just the ones we are renaming. */
- mark_def_sites_global_data.kills = BITMAP_ALLOC (NULL);
- walk_data.global_data = &mark_def_sites_global_data;
+ bitmap m_kills;
+};
- /* We do not have any local data. */
- walk_data.block_local_data_size = 0;
+mark_def_dom_walker::mark_def_dom_walker (cdi_direction direction)
+ : dom_walker (direction), m_kills (BITMAP_ALLOC (NULL))
+{
+}
- /* Initialize the dominator walker. */
- init_walk_dominator_tree (&walk_data);
+mark_def_dom_walker::~mark_def_dom_walker ()
+{
+ BITMAP_FREE (m_kills);
+}
- /* Recursively walk the dominator tree. */
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+/* Block processing routine for mark_def_sites. Clear the KILLS bitmap
+ at the start of each block, and call mark_def_sites for each statement. */
- /* Finalize the dominator walker. */
- fini_walk_dominator_tree (&walk_data);
+void
+mark_def_dom_walker::before_dom_children (basic_block bb)
+{
+ gimple_stmt_iterator gsi;
- /* We no longer need this bitmap, clear and free it. */
- BITMAP_FREE (mark_def_sites_global_data.kills);
+ bitmap_clear (m_kills);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ mark_def_sites (bb, gsi_stmt (gsi), m_kills);
}
-
/* Initialize internal data needed during renaming. */
static void
@@ -2331,8 +2298,7 @@ fini_ssa_renamer (void)
insert PHI nodes and rename the function in dominator tree
order.
- 2- Find and mark all the blocks that define variables
- (mark_def_site_blocks).
+ 2- Find and mark all the blocks that define variables.
3- Insert PHI nodes at dominance frontiers (insert_phi_nodes).
@@ -2370,7 +2336,7 @@ rewrite_into_ssa (void)
compute_dominance_frontiers (dfs);
/* 2- Find and mark definition sites. */
- mark_def_site_blocks ();
+ mark_def_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
/* 3- Insert PHI nodes at dominance frontiers of definition blocks. */
insert_phi_nodes (dfs);
@@ -2400,15 +2366,21 @@ rewrite_into_ssa (void)
if (decl
&& TREE_CODE (decl) == VAR_DECL
&& !VAR_DECL_IS_VIRTUAL_OPERAND (decl)
- && DECL_ARTIFICIAL (decl)
- && DECL_IGNORED_P (decl)
- && !DECL_NAME (decl))
- SET_SSA_NAME_VAR_OR_IDENTIFIER (name, NULL_TREE);
+ && DECL_IGNORED_P (decl))
+ SET_SSA_NAME_VAR_OR_IDENTIFIER (name, DECL_NAME (decl));
}
return 0;
}
+/* Gate for IPCP optimization. */
+
+static bool
+gate_into_ssa (void)
+{
+ /* Do nothing for funcions that was produced already in SSA form. */
+ return !(cfun->curr_properties & PROP_ssa);
+}
namespace {
@@ -2417,7 +2389,7 @@ const pass_data pass_data_build_ssa =
GIMPLE_PASS, /* type */
"ssa", /* name */
OPTGROUP_NONE, /* optinfo_flags */
- false, /* has_gate */
+ true, /* has_gate */
true, /* has_execute */
TV_TREE_SSA_OTHER, /* tv_id */
PROP_cfg, /* properties_required */
@@ -2430,11 +2402,12 @@ const pass_data pass_data_build_ssa =
class pass_build_ssa : public gimple_opt_pass
{
public:
- pass_build_ssa(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_build_ssa, ctxt)
+ pass_build_ssa (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_build_ssa, ctxt)
{}
/* opt_pass methods: */
+ bool gate () { return gate_into_ssa (); }
unsigned int execute () { return rewrite_into_ssa (); }
}; // class pass_build_ssa
diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c
index 7359684cf3c..53347b54dc6 100644
--- a/gcc/tree-iterator.c
+++ b/gcc/tree-iterator.c
@@ -39,7 +39,7 @@ alloc_stmt_list (void)
if (!vec_safe_is_empty (stmt_list_cache))
{
list = stmt_list_cache->pop ();
- memset (list, 0, sizeof(struct tree_base));
+ memset (list, 0, sizeof (struct tree_base));
TREE_SET_CODE (list, STATEMENT_LIST);
}
else
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 95c4d5f753a..964131a1950 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -44,12 +44,517 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
#include "tree-pass.h"
+#include "gimple-pretty-print.h"
+
+
+/* A Reduced Dependence Graph (RDG) vertex representing a statement. */
+typedef struct rdg_vertex
+{
+ /* The statement represented by this vertex. */
+ gimple stmt;
+
+ /* Vector of data-references in this statement. */
+ vec<data_reference_p> datarefs;
+
+ /* True when the statement contains a write to memory. */
+ bool has_mem_write;
+
+ /* True when the statement contains a read from memory. */
+ bool has_mem_reads;
+} *rdg_vertex_p;
+
+#define RDGV_STMT(V) ((struct rdg_vertex *) ((V)->data))->stmt
+#define RDGV_DATAREFS(V) ((struct rdg_vertex *) ((V)->data))->datarefs
+#define RDGV_HAS_MEM_WRITE(V) ((struct rdg_vertex *) ((V)->data))->has_mem_write
+#define RDGV_HAS_MEM_READS(V) ((struct rdg_vertex *) ((V)->data))->has_mem_reads
+#define RDG_STMT(RDG, I) RDGV_STMT (&(RDG->vertices[I]))
+#define RDG_DATAREFS(RDG, I) RDGV_DATAREFS (&(RDG->vertices[I]))
+#define RDG_MEM_WRITE_STMT(RDG, I) RDGV_HAS_MEM_WRITE (&(RDG->vertices[I]))
+#define RDG_MEM_READS_STMT(RDG, I) RDGV_HAS_MEM_READS (&(RDG->vertices[I]))
+
+/* Data dependence type. */
+
+enum rdg_dep_type
+{
+ /* Read After Write (RAW). */
+ flow_dd = 'f',
+
+ /* Write After Read (WAR). */
+ anti_dd = 'a',
+
+ /* Write After Write (WAW). */
+ output_dd = 'o',
+
+ /* Read After Read (RAR). */
+ input_dd = 'i',
+
+ /* Control dependence (execute conditional on). */
+ control_dd = 'c'
+};
+
+/* Dependence information attached to an edge of the RDG. */
+
+typedef struct rdg_edge
+{
+ /* Type of the dependence. */
+ enum rdg_dep_type type;
+
+ /* Levels of the dependence: the depth of the loops that carry the
+ dependence. */
+ unsigned level;
+
+ /* Dependence relation between data dependences, NULL when one of
+ the vertices is a scalar. */
+ ddr_p relation;
+} *rdg_edge_p;
+
+#define RDGE_TYPE(E) ((struct rdg_edge *) ((E)->data))->type
+#define RDGE_LEVEL(E) ((struct rdg_edge *) ((E)->data))->level
+#define RDGE_RELATION(E) ((struct rdg_edge *) ((E)->data))->relation
+
+/* Dump vertex I in RDG to FILE. */
+
+static void
+dump_rdg_vertex (FILE *file, struct graph *rdg, int i)
+{
+ struct vertex *v = &(rdg->vertices[i]);
+ struct graph_edge *e;
+
+ fprintf (file, "(vertex %d: (%s%s) (in:", i,
+ RDG_MEM_WRITE_STMT (rdg, i) ? "w" : "",
+ RDG_MEM_READS_STMT (rdg, i) ? "r" : "");
+
+ if (v->pred)
+ for (e = v->pred; e; e = e->pred_next)
+ fprintf (file, " %d", e->src);
+
+ fprintf (file, ") (out:");
+
+ if (v->succ)
+ for (e = v->succ; e; e = e->succ_next)
+ fprintf (file, " %d", e->dest);
+
+ fprintf (file, ")\n");
+ print_gimple_stmt (file, RDGV_STMT (v), 0, TDF_VOPS|TDF_MEMSYMS);
+ fprintf (file, ")\n");
+}
+
+/* Call dump_rdg_vertex on stderr. */
+
+DEBUG_FUNCTION void
+debug_rdg_vertex (struct graph *rdg, int i)
+{
+ dump_rdg_vertex (stderr, rdg, i);
+}
+
+/* Dump the reduced dependence graph RDG to FILE. */
+
+static void
+dump_rdg (FILE *file, struct graph *rdg)
+{
+ fprintf (file, "(rdg\n");
+ for (int i = 0; i < rdg->n_vertices; i++)
+ dump_rdg_vertex (file, rdg, i);
+ fprintf (file, ")\n");
+}
+
+/* Call dump_rdg on stderr. */
+
+DEBUG_FUNCTION void
+debug_rdg (struct graph *rdg)
+{
+ dump_rdg (stderr, rdg);
+}
+
+static void
+dot_rdg_1 (FILE *file, struct graph *rdg)
+{
+ int i;
+ pretty_printer buffer;
+ pp_needs_newline (&buffer) = false;
+ buffer.buffer->stream = file;
+
+ fprintf (file, "digraph RDG {\n");
+
+ for (i = 0; i < rdg->n_vertices; i++)
+ {
+ struct vertex *v = &(rdg->vertices[i]);
+ struct graph_edge *e;
+
+ fprintf (file, "%d [label=\"[%d] ", i, i);
+ pp_gimple_stmt_1 (&buffer, RDGV_STMT (v), 0, TDF_SLIM);
+ pp_flush (&buffer);
+ fprintf (file, "\"]\n");
+
+ /* Highlight reads from memory. */
+ if (RDG_MEM_READS_STMT (rdg, i))
+ fprintf (file, "%d [style=filled, fillcolor=green]\n", i);
+
+ /* Highlight stores to memory. */
+ if (RDG_MEM_WRITE_STMT (rdg, i))
+ fprintf (file, "%d [style=filled, fillcolor=red]\n", i);
+
+ if (v->succ)
+ for (e = v->succ; e; e = e->succ_next)
+ switch (RDGE_TYPE (e))
+ {
+ case input_dd:
+ fprintf (file, "%d -> %d [label=input] \n", i, e->dest);
+ break;
+
+ case output_dd:
+ fprintf (file, "%d -> %d [label=output] \n", i, e->dest);
+ break;
+
+ case flow_dd:
+ /* These are the most common dependences: don't print these. */
+ fprintf (file, "%d -> %d \n", i, e->dest);
+ break;
+
+ case anti_dd:
+ fprintf (file, "%d -> %d [label=anti] \n", i, e->dest);
+ break;
+
+ case control_dd:
+ fprintf (file, "%d -> %d [label=control] \n", i, e->dest);
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ fprintf (file, "}\n\n");
+}
+
+/* Display the Reduced Dependence Graph using dotty. */
+
+DEBUG_FUNCTION void
+dot_rdg (struct graph *rdg)
+{
+ /* When debugging, you may want to enable the following code. */
+#if 1
+ FILE *file = popen ("dot -Tx11", "w");
+ if (!file)
+ return;
+ dot_rdg_1 (file, rdg);
+ fflush (file);
+ close (fileno (file));
+ pclose (file);
+#else
+ dot_rdg_1 (stderr, rdg);
+#endif
+}
+
+/* Returns the index of STMT in RDG. */
+
+static int
+rdg_vertex_for_stmt (struct graph *rdg ATTRIBUTE_UNUSED, gimple stmt)
+{
+ int index = gimple_uid (stmt);
+ gcc_checking_assert (index == -1 || RDG_STMT (rdg, index) == stmt);
+ return index;
+}
+
+/* Creates an edge in RDG for each distance vector from DDR. The
+ order that we keep track of in the RDG is the order in which
+ statements have to be executed. */
+
+static void
+create_rdg_edge_for_ddr (struct graph *rdg, ddr_p ddr)
+{
+ struct graph_edge *e;
+ int va, vb;
+ data_reference_p dra = DDR_A (ddr);
+ data_reference_p drb = DDR_B (ddr);
+ unsigned level = ddr_dependence_level (ddr);
+
+ /* For non scalar dependences, when the dependence is REVERSED,
+ statement B has to be executed before statement A. */
+ if (level > 0
+ && !DDR_REVERSED_P (ddr))
+ {
+ data_reference_p tmp = dra;
+ dra = drb;
+ drb = tmp;
+ }
+
+ va = rdg_vertex_for_stmt (rdg, DR_STMT (dra));
+ vb = rdg_vertex_for_stmt (rdg, DR_STMT (drb));
+
+ if (va < 0 || vb < 0)
+ return;
+
+ e = add_edge (rdg, va, vb);
+ e->data = XNEW (struct rdg_edge);
+
+ RDGE_LEVEL (e) = level;
+ RDGE_RELATION (e) = ddr;
+
+ /* Determines the type of the data dependence. */
+ if (DR_IS_READ (dra) && DR_IS_READ (drb))
+ RDGE_TYPE (e) = input_dd;
+ else if (DR_IS_WRITE (dra) && DR_IS_WRITE (drb))
+ RDGE_TYPE (e) = output_dd;
+ else if (DR_IS_WRITE (dra) && DR_IS_READ (drb))
+ RDGE_TYPE (e) = flow_dd;
+ else if (DR_IS_READ (dra) && DR_IS_WRITE (drb))
+ RDGE_TYPE (e) = anti_dd;
+}
+
+/* Creates dependence edges in RDG for all the uses of DEF. IDEF is
+ the index of DEF in RDG. */
+
+static void
+create_rdg_edges_for_scalar (struct graph *rdg, tree def, int idef)
+{
+ use_operand_p imm_use_p;
+ imm_use_iterator iterator;
+
+ FOR_EACH_IMM_USE_FAST (imm_use_p, iterator, def)
+ {
+ struct graph_edge *e;
+ int use = rdg_vertex_for_stmt (rdg, USE_STMT (imm_use_p));
+
+ if (use < 0)
+ continue;
+
+ e = add_edge (rdg, idef, use);
+ e->data = XNEW (struct rdg_edge);
+ RDGE_TYPE (e) = flow_dd;
+ RDGE_RELATION (e) = NULL;
+ }
+}
+
+/* Creates an edge for the control dependences of BB to the vertex V. */
+
+static void
+create_edge_for_control_dependence (struct graph *rdg, basic_block bb,
+ int v, control_dependences *cd)
+{
+ bitmap_iterator bi;
+ unsigned edge_n;
+ EXECUTE_IF_SET_IN_BITMAP (cd->get_edges_dependent_on (bb->index),
+ 0, edge_n, bi)
+ {
+ basic_block cond_bb = cd->get_edge (edge_n)->src;
+ gimple stmt = last_stmt (cond_bb);
+ if (stmt && is_ctrl_stmt (stmt))
+ {
+ struct graph_edge *e;
+ int c = rdg_vertex_for_stmt (rdg, stmt);
+ if (c < 0)
+ continue;
+
+ e = add_edge (rdg, c, v);
+ e->data = XNEW (struct rdg_edge);
+ RDGE_TYPE (e) = control_dd;
+ RDGE_RELATION (e) = NULL;
+ }
+ }
+}
+
+/* Creates the edges of the reduced dependence graph RDG. */
+
+static void
+create_rdg_edges (struct graph *rdg, vec<ddr_p> ddrs, control_dependences *cd)
+{
+ int i;
+ struct data_dependence_relation *ddr;
+ def_operand_p def_p;
+ ssa_op_iter iter;
+
+ FOR_EACH_VEC_ELT (ddrs, i, ddr)
+ if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE)
+ create_rdg_edge_for_ddr (rdg, ddr);
+ else
+ free_dependence_relation (ddr);
+
+ for (i = 0; i < rdg->n_vertices; i++)
+ FOR_EACH_PHI_OR_STMT_DEF (def_p, RDG_STMT (rdg, i),
+ iter, SSA_OP_DEF)
+ create_rdg_edges_for_scalar (rdg, DEF_FROM_PTR (def_p), i);
+
+ if (cd)
+ for (i = 0; i < rdg->n_vertices; i++)
+ {
+ gimple stmt = RDG_STMT (rdg, i);
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ {
+ edge_iterator ei;
+ edge e;
+ FOR_EACH_EDGE (e, ei, gimple_bb (stmt)->preds)
+ create_edge_for_control_dependence (rdg, e->src, i, cd);
+ }
+ else
+ create_edge_for_control_dependence (rdg, gimple_bb (stmt), i, cd);
+ }
+}
+
+/* Build the vertices of the reduced dependence graph RDG. Return false
+ if that failed. */
+
+static bool
+create_rdg_vertices (struct graph *rdg, vec<gimple> stmts, loop_p loop,
+ vec<data_reference_p> *datarefs)
+{
+ int i;
+ gimple stmt;
+
+ FOR_EACH_VEC_ELT (stmts, i, stmt)
+ {
+ struct vertex *v = &(rdg->vertices[i]);
+
+ /* Record statement to vertex mapping. */
+ gimple_set_uid (stmt, i);
+
+ v->data = XNEW (struct rdg_vertex);
+ RDGV_STMT (v) = stmt;
+ RDGV_DATAREFS (v).create (0);
+ RDGV_HAS_MEM_WRITE (v) = false;
+ RDGV_HAS_MEM_READS (v) = false;
+ if (gimple_code (stmt) == GIMPLE_PHI)
+ continue;
+
+ unsigned drp = datarefs->length ();
+ if (!find_data_references_in_stmt (loop, stmt, datarefs))
+ return false;
+ for (unsigned j = drp; j < datarefs->length (); ++j)
+ {
+ data_reference_p dr = (*datarefs)[j];
+ if (DR_IS_READ (dr))
+ RDGV_HAS_MEM_READS (v) = true;
+ else
+ RDGV_HAS_MEM_WRITE (v) = true;
+ RDGV_DATAREFS (v).safe_push (dr);
+ }
+ }
+ return true;
+}
+
+/* Initialize STMTS with all the statements of LOOP. The order in
+ which we discover statements is important as
+ generate_loops_for_partition is using the same traversal for
+ identifying statements in loop copies. */
+
+static void
+stmts_from_loop (struct loop *loop, vec<gimple> *stmts)
+{
+ unsigned int i;
+ basic_block *bbs = get_loop_body_in_dom_order (loop);
+
+ for (i = 0; i < loop->num_nodes; i++)
+ {
+ basic_block bb = bbs[i];
+ gimple_stmt_iterator bsi;
+ gimple stmt;
+
+ for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ if (!virtual_operand_p (gimple_phi_result (gsi_stmt (bsi))))
+ stmts->safe_push (gsi_stmt (bsi));
+
+ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
+ {
+ stmt = gsi_stmt (bsi);
+ if (gimple_code (stmt) != GIMPLE_LABEL && !is_gimple_debug (stmt))
+ stmts->safe_push (stmt);
+ }
+ }
+
+ free (bbs);
+}
+
+/* Build the Reduced Dependence Graph (RDG) with one vertex per
+ statement of the loop nest, and one edge per data dependence or
+ scalar dependence. */
+
+struct graph *
+build_empty_rdg (int n_stmts)
+{
+ struct graph *rdg = new_graph (n_stmts);
+ return rdg;
+}
+
+/* Free the reduced dependence graph RDG. */
+
+static void
+free_rdg (struct graph *rdg)
+{
+ int i;
+
+ for (i = 0; i < rdg->n_vertices; i++)
+ {
+ struct vertex *v = &(rdg->vertices[i]);
+ struct graph_edge *e;
+
+ for (e = v->succ; e; e = e->succ_next)
+ {
+ free_dependence_relation (RDGE_RELATION (e));
+ free (e->data);
+ }
+
+ if (v->data)
+ {
+ gimple_set_uid (RDGV_STMT (v), -1);
+ free_data_refs (RDGV_DATAREFS (v));
+ free (v->data);
+ }
+ }
+
+ free_graph (rdg);
+}
+
+/* Build the Reduced Dependence Graph (RDG) with one vertex per
+ statement of the loop nest LOOP_NEST, and one edge per data dependence or
+ scalar dependence. */
+
+static struct graph *
+build_rdg (vec<loop_p> loop_nest, control_dependences *cd)
+{
+ struct graph *rdg;
+ vec<gimple> stmts;
+ vec<data_reference_p> datarefs;
+ vec<ddr_p> dependence_relations;
+
+ /* Create the RDG vertices from the stmts of the loop nest. */
+ stmts.create (10);
+ stmts_from_loop (loop_nest[0], &stmts);
+ rdg = build_empty_rdg (stmts.length ());
+ datarefs.create (10);
+ if (!create_rdg_vertices (rdg, stmts, loop_nest[0], &datarefs))
+ {
+ stmts.release ();
+ datarefs.release ();
+ free_rdg (rdg);
+ return NULL;
+ }
+ stmts.release ();
+
+ /* Create the RDG edges from the data dependences in the loop nest. */
+ dependence_relations.create (100);
+ if (!compute_all_dependences (datarefs, &dependence_relations, loop_nest,
+ false)
+ || !known_dependences_p (dependence_relations))
+ {
+ free_dependence_relations (dependence_relations);
+ datarefs.release ();
+ free_rdg (rdg);
+ return NULL;
+ }
+ create_rdg_edges (rdg, dependence_relations, cd);
+ dependence_relations.release ();
+ datarefs.release ();
+
+ return rdg;
+}
+
+
enum partition_kind {
PKIND_NORMAL, PKIND_REDUCTION, PKIND_MEMSET, PKIND_MEMCPY
@@ -58,6 +563,7 @@ enum partition_kind {
typedef struct partition_s
{
bitmap stmts;
+ bitmap loops;
bool has_writes;
enum partition_kind kind;
/* data-references a kind != PKIND_NORMAL partition is about. */
@@ -69,10 +575,11 @@ typedef struct partition_s
/* Allocate and initialize a partition from BITMAP. */
static partition_t
-partition_alloc (bitmap stmts)
+partition_alloc (bitmap stmts, bitmap loops)
{
partition_t partition = XCNEW (struct partition_s);
partition->stmts = stmts ? stmts : BITMAP_ALLOC (NULL);
+ partition->loops = loops ? loops : BITMAP_ALLOC (NULL);
partition->has_writes = false;
partition->kind = PKIND_NORMAL;
return partition;
@@ -84,6 +591,7 @@ static void
partition_free (partition_t partition)
{
BITMAP_FREE (partition->stmts);
+ BITMAP_FREE (partition->loops);
free (partition);
}
@@ -103,17 +611,6 @@ partition_has_writes (partition_t partition)
return partition->has_writes;
}
-/* If bit I is not set, it means that this node represents an
- operation that has already been performed, and that should not be
- performed again. This is the subgraph of remaining important
- computations that is passed to the DFS algorithm for avoiding to
- include several times the same stores in different loops. */
-static bitmap remaining_stmts;
-
-/* A node of the RDG is marked in this bitmap when it has as a
- predecessor a node that writes to memory. */
-static bitmap upstream_mem_writes;
-
/* Returns true when DEF is an SSA_NAME defined in LOOP and used after
the LOOP. */
@@ -193,7 +690,7 @@ static void
generate_loops_for_partition (struct loop *loop, partition_t partition,
bool copy_p)
{
- unsigned i, x;
+ unsigned i;
gimple_stmt_iterator bsi;
basic_block *bbs;
@@ -205,58 +702,75 @@ generate_loops_for_partition (struct loop *loop, partition_t partition,
create_bb_after_loop (loop);
}
- /* Remove stmts not in the PARTITION bitmap. The order in which we
- visit the phi nodes and the statements is exactly as in
- stmts_from_loop. */
+ /* Remove stmts not in the PARTITION bitmap. */
bbs = get_loop_body_in_dom_order (loop);
if (MAY_HAVE_DEBUG_STMTS)
- for (x = 0, i = 0; i < loop->num_nodes; i++)
+ for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
- if (!bitmap_bit_p (partition->stmts, x++))
- reset_debug_uses (gsi_stmt (bsi));
+ {
+ gimple phi = gsi_stmt (bsi);
+ if (!virtual_operand_p (gimple_phi_result (phi))
+ && !bitmap_bit_p (partition->stmts, gimple_uid (phi)))
+ reset_debug_uses (phi);
+ }
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL
&& !is_gimple_debug (stmt)
- && !bitmap_bit_p (partition->stmts, x++))
+ && !bitmap_bit_p (partition->stmts, gimple_uid (stmt)))
reset_debug_uses (stmt);
}
}
- for (x = 0, i = 0; i < loop->num_nodes; i++)
+ for (i = 0; i < loop->num_nodes; i++)
{
basic_block bb = bbs[i];
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
- if (!bitmap_bit_p (partition->stmts, x++))
- {
- gimple phi = gsi_stmt (bsi);
- if (virtual_operand_p (gimple_phi_result (phi)))
- mark_virtual_phi_result_for_renaming (phi);
+ {
+ gimple phi = gsi_stmt (bsi);
+ if (!virtual_operand_p (gimple_phi_result (phi))
+ && !bitmap_bit_p (partition->stmts, gimple_uid (phi)))
remove_phi_node (&bsi, true);
- }
- else
- gsi_next (&bsi);
+ else
+ gsi_next (&bsi);
+ }
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
{
gimple stmt = gsi_stmt (bsi);
if (gimple_code (stmt) != GIMPLE_LABEL
&& !is_gimple_debug (stmt)
- && !bitmap_bit_p (partition->stmts, x++))
+ && !bitmap_bit_p (partition->stmts, gimple_uid (stmt)))
{
- unlink_stmt_vdef (stmt);
- gsi_remove (&bsi, true);
- release_defs (stmt);
+ /* Choose an arbitrary path through the empty CFG part
+ that this unnecessary control stmt controls. */
+ if (gimple_code (stmt) == GIMPLE_COND)
+ {
+ gimple_cond_make_false (stmt);
+ update_stmt (stmt);
+ }
+ else if (gimple_code (stmt) == GIMPLE_SWITCH)
+ {
+ gimple_switch_set_index
+ (stmt, CASE_LOW (gimple_switch_label (stmt, 1)));
+ update_stmt (stmt);
+ }
+ else
+ {
+ unlink_stmt_vdef (stmt);
+ gsi_remove (&bsi, true);
+ release_defs (stmt);
+ continue;
+ }
}
- else
- gsi_next (&bsi);
+ gsi_next (&bsi);
}
}
@@ -538,168 +1052,17 @@ rdg_cannot_recompute_vertex_p (struct graph *rdg, int v)
static inline bool
already_processed_vertex_p (bitmap processed, int v)
{
- return (bitmap_bit_p (processed, v)
- || !bitmap_bit_p (remaining_stmts, v));
-}
-
-/* Returns NULL when there is no anti-dependence or output-dependence
- among the successors of vertex V, otherwise returns the edge with the
- dependency. */
-
-static struct graph_edge *
-has_anti_or_output_dependence (struct vertex *v)
-{
- struct graph_edge *e;
-
- if (v->succ)
- for (e = v->succ; e; e = e->succ_next)
- if (RDGE_TYPE (e) == anti_dd
- || RDGE_TYPE (e) == output_dd)
- return e;
-
- return NULL;
-}
-
-/* Returns true when V has an anti-dependence edge among its successors. */
-
-static bool
-predecessor_has_mem_write (struct graph *rdg, struct vertex *v)
-{
- struct graph_edge *e;
-
- if (v->pred)
- for (e = v->pred; e; e = e->pred_next)
- if (bitmap_bit_p (upstream_mem_writes, e->src)
- /* Don't consider flow channels: a write to memory followed
- by a read from memory. These channels allow the split of
- the RDG in different partitions. */
- && !RDG_MEM_WRITE_STMT (rdg, e->src))
- return true;
-
- return false;
-}
-
-/* Initializes the upstream_mem_writes bitmap following the
- information from RDG. */
-
-static void
-mark_nodes_having_upstream_mem_writes (struct graph *rdg)
-{
- int v, x;
- bitmap seen = BITMAP_ALLOC (NULL);
-
- for (v = rdg->n_vertices - 1; v >= 0; v--)
- if (!bitmap_bit_p (seen, v))
- {
- unsigned i;
- vec<int> nodes;
- nodes.create (3);
-
- graphds_dfs (rdg, &v, 1, &nodes, false, NULL);
-
- FOR_EACH_VEC_ELT (nodes, i, x)
- {
- if (!bitmap_set_bit (seen, x))
- continue;
-
- if (RDG_MEM_WRITE_STMT (rdg, x)
- || predecessor_has_mem_write (rdg, &(rdg->vertices[x]))
- /* In anti dependences the read should occur before
- the write, this is why both the read and the write
- should be placed in the same partition. In output
- dependences the writes order need to be preserved. */
- || has_anti_or_output_dependence (&(rdg->vertices[x])))
- bitmap_set_bit (upstream_mem_writes, x);
- }
-
- nodes.release ();
- }
-}
-
-/* Returns true when vertex u has a memory write node as a predecessor
- in RDG. */
-
-static bool
-has_upstream_mem_writes (int u)
-{
- return bitmap_bit_p (upstream_mem_writes, u);
+ return bitmap_bit_p (processed, v);
}
static void rdg_flag_vertex_and_dependent (struct graph *, int, partition_t,
- bitmap, bitmap);
-
-/* Flag the uses of U stopping following the information from
- upstream_mem_writes. */
-
-static void
-rdg_flag_uses (struct graph *rdg, int u, partition_t partition, bitmap loops,
- bitmap processed)
-{
- use_operand_p use_p;
- struct vertex *x = &(rdg->vertices[u]);
- gimple stmt = RDGV_STMT (x);
- struct graph_edge *anti_dep = has_anti_or_output_dependence (x);
-
- /* Keep in the same partition the destination of an antidependence,
- because this is a store to the exact same location. Putting this
- in another partition is bad for cache locality. */
- if (anti_dep)
- {
- int v = anti_dep->dest;
-
- if (!already_processed_vertex_p (processed, v))
- rdg_flag_vertex_and_dependent (rdg, v, partition, loops,
- processed);
- }
-
- if (gimple_code (stmt) != GIMPLE_PHI)
- {
- if ((use_p = gimple_vuse_op (stmt)) != NULL_USE_OPERAND_P)
- {
- tree use = USE_FROM_PTR (use_p);
-
- if (TREE_CODE (use) == SSA_NAME
- && !SSA_NAME_IS_DEFAULT_DEF (use))
- {
- gimple def_stmt = SSA_NAME_DEF_STMT (use);
- int v = rdg_vertex_for_stmt (rdg, def_stmt);
-
- if (v >= 0
- && !already_processed_vertex_p (processed, v))
- rdg_flag_vertex_and_dependent (rdg, v, partition, loops,
- processed);
- }
- }
- }
-
- if (is_gimple_assign (stmt) && has_upstream_mem_writes (u))
- {
- tree op0 = gimple_assign_lhs (stmt);
-
- /* Scalar channels don't have enough space for transmitting data
- between tasks, unless we add more storage by privatizing. */
- if (is_gimple_reg (op0))
- {
- use_operand_p use_p;
- imm_use_iterator iter;
-
- FOR_EACH_IMM_USE_FAST (use_p, iter, op0)
- {
- int v = rdg_vertex_for_stmt (rdg, USE_STMT (use_p));
-
- if (!already_processed_vertex_p (processed, v))
- rdg_flag_vertex_and_dependent (rdg, v, partition, loops,
- processed);
- }
- }
- }
-}
+ bitmap);
/* Flag V from RDG as part of PARTITION, and also flag its loop number
in LOOPS. */
static void
-rdg_flag_vertex (struct graph *rdg, int v, partition_t partition, bitmap loops)
+rdg_flag_vertex (struct graph *rdg, int v, partition_t partition)
{
struct loop *loop;
@@ -707,13 +1070,10 @@ rdg_flag_vertex (struct graph *rdg, int v, partition_t partition, bitmap loops)
return;
loop = loop_containing_stmt (RDG_STMT (rdg, v));
- bitmap_set_bit (loops, loop->num);
+ bitmap_set_bit (partition->loops, loop->num);
if (rdg_cannot_recompute_vertex_p (rdg, v))
- {
- partition->has_writes = true;
- bitmap_clear_bit (remaining_stmts, v);
- }
+ partition->has_writes = true;
}
/* Flag in the bitmap PARTITION the vertex V and all its predecessors.
@@ -721,164 +1081,35 @@ rdg_flag_vertex (struct graph *rdg, int v, partition_t partition, bitmap loops)
static void
rdg_flag_vertex_and_dependent (struct graph *rdg, int v, partition_t partition,
- bitmap loops, bitmap processed)
+ bitmap processed)
{
unsigned i;
vec<int> nodes;
nodes.create (3);
int x;
- bitmap_set_bit (processed, v);
- rdg_flag_uses (rdg, v, partition, loops, processed);
- graphds_dfs (rdg, &v, 1, &nodes, false, remaining_stmts);
- rdg_flag_vertex (rdg, v, partition, loops);
+ graphds_dfs (rdg, &v, 1, &nodes, false, NULL);
FOR_EACH_VEC_ELT (nodes, i, x)
- if (!already_processed_vertex_p (processed, x))
- rdg_flag_vertex_and_dependent (rdg, x, partition, loops, processed);
+ if (bitmap_set_bit (processed, x))
+ rdg_flag_vertex (rdg, x, partition);
nodes.release ();
}
-/* Initialize CONDS with all the condition statements from the basic
- blocks of LOOP. */
-
-static void
-collect_condition_stmts (struct loop *loop, vec<gimple> *conds)
-{
- unsigned i;
- edge e;
- vec<edge> exits = get_loop_exit_edges (loop);
-
- FOR_EACH_VEC_ELT (exits, i, e)
- {
- gimple cond = last_stmt (e->src);
-
- if (cond)
- conds->safe_push (cond);
- }
-
- exits.release ();
-}
-
-/* Add to PARTITION all the exit condition statements for LOOPS
- together with all their dependent statements determined from
- RDG. */
-
-static void
-rdg_flag_loop_exits (struct graph *rdg, bitmap loops, partition_t partition,
- bitmap processed)
-{
- unsigned i;
- bitmap_iterator bi;
- vec<gimple> conds;
- conds.create (3);
-
- EXECUTE_IF_SET_IN_BITMAP (loops, 0, i, bi)
- collect_condition_stmts (get_loop (cfun, i), &conds);
-
- while (!conds.is_empty ())
- {
- gimple cond = conds.pop ();
- int v = rdg_vertex_for_stmt (rdg, cond);
- bitmap new_loops = BITMAP_ALLOC (NULL);
-
- if (!already_processed_vertex_p (processed, v))
- rdg_flag_vertex_and_dependent (rdg, v, partition, new_loops, processed);
-
- EXECUTE_IF_SET_IN_BITMAP (new_loops, 0, i, bi)
- if (bitmap_set_bit (loops, i))
- collect_condition_stmts (get_loop (cfun, i), &conds);
-
- BITMAP_FREE (new_loops);
- }
-
- conds.release ();
-}
-
-/* Returns a bitmap in which all the statements needed for computing
- the strongly connected component C of the RDG are flagged, also
- including the loop exit conditions. */
+/* Returns a partition with all the statements needed for computing
+ the vertex V of the RDG, also including the loop exit conditions. */
static partition_t
-build_rdg_partition_for_component (struct graph *rdg, rdgc c)
+build_rdg_partition_for_vertex (struct graph *rdg, int v)
{
- int i, v;
- partition_t partition = partition_alloc (NULL);
- bitmap loops = BITMAP_ALLOC (NULL);
+ partition_t partition = partition_alloc (NULL, NULL);
bitmap processed = BITMAP_ALLOC (NULL);
-
- FOR_EACH_VEC_ELT (c->vertices, i, v)
- if (!already_processed_vertex_p (processed, v))
- rdg_flag_vertex_and_dependent (rdg, v, partition, loops, processed);
-
- rdg_flag_loop_exits (rdg, loops, partition, processed);
-
+ rdg_flag_vertex_and_dependent (rdg, v, partition, processed);
BITMAP_FREE (processed);
- BITMAP_FREE (loops);
return partition;
}
-/* Free memory for COMPONENTS. */
-
-static void
-free_rdg_components (vec<rdgc> components)
-{
- int i;
- rdgc x;
-
- FOR_EACH_VEC_ELT (components, i, x)
- {
- x->vertices.release ();
- free (x);
- }
-
- components.release ();
-}
-
-/* Build the COMPONENTS vector with the strongly connected components
- of RDG in which the STARTING_VERTICES occur. */
-
-static void
-rdg_build_components (struct graph *rdg, vec<int> starting_vertices,
- vec<rdgc> *components)
-{
- int i, v;
- bitmap saved_components = BITMAP_ALLOC (NULL);
- int n_components = graphds_scc (rdg, NULL);
- /* ??? Macros cannot process template types with more than one
- argument, so we need this typedef. */
- typedef vec<int> vec_int_heap;
- vec<int> *all_components = XNEWVEC (vec_int_heap, n_components);
-
- for (i = 0; i < n_components; i++)
- all_components[i].create (3);
-
- for (i = 0; i < rdg->n_vertices; i++)
- all_components[rdg->vertices[i].component].safe_push (i);
-
- FOR_EACH_VEC_ELT (starting_vertices, i, v)
- {
- int c = rdg->vertices[v].component;
-
- if (bitmap_set_bit (saved_components, c))
- {
- rdgc x = XCNEW (struct rdg_component);
- x->num = c;
- x->vertices = all_components[c];
-
- components->safe_push (x);
- }
- }
-
- for (i = 0; i < n_components; i++)
- if (!bitmap_bit_p (saved_components, i))
- all_components[i].release ();
-
- free (all_components);
- BITMAP_FREE (saved_components);
-}
-
/* Classifies the builtin kind we can generate for PARTITION of RDG and LOOP.
For the moment we detect only the memset zero pattern. */
@@ -975,7 +1206,9 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
&& !SSA_NAME_IS_DEFAULT_DEF (rhs)
&& flow_bb_inside_loop_p (loop, gimple_bb (SSA_NAME_DEF_STMT (rhs))))
return;
- if (!adjacent_dr_p (single_store))
+ if (!adjacent_dr_p (single_store)
+ || !dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (stmt)))
return;
partition->kind = PKIND_MEMSET;
partition->main_dr = single_store;
@@ -991,7 +1224,9 @@ classify_partition (loop_p loop, struct graph *rdg, partition_t partition)
if (!adjacent_dr_p (single_store)
|| !adjacent_dr_p (single_load)
|| !operand_equal_p (DR_STEP (single_store),
- DR_STEP (single_load), 0))
+ DR_STEP (single_load), 0)
+ || !dominated_by_p (CDI_DOMINATORS,
+ loop->latch, gimple_bb (store)))
return;
/* Now check that if there is a dependence this dependence is
of a suitable form for memmove. */
@@ -1095,23 +1330,28 @@ similar_memory_accesses (struct graph *rdg, partition_t partition1,
distributed in different loops. */
static void
-rdg_build_partitions (struct graph *rdg, vec<rdgc> components,
- vec<int> *other_stores,
- vec<partition_t> *partitions, bitmap processed)
+rdg_build_partitions (struct graph *rdg,
+ vec<gimple> starting_stmts,
+ vec<partition_t> *partitions)
{
+ bitmap processed = BITMAP_ALLOC (NULL);
int i;
- rdgc x;
- partition_t partition = partition_alloc (NULL);
+ gimple stmt;
+ partition_t partition = partition_alloc (NULL, NULL);
- FOR_EACH_VEC_ELT (components, i, x)
+ FOR_EACH_VEC_ELT (starting_stmts, i, stmt)
{
partition_t np;
- int v = x->vertices[0];
+ int v = rdg_vertex_for_stmt (rdg, stmt);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "ldist asked to generate code for vertex %d\n", v);
if (bitmap_bit_p (processed, v))
continue;
- np = build_rdg_partition_for_component (rdg, x);
+ np = build_rdg_partition_for_vertex (rdg, v);
bitmap_ior_into (partition->stmts, np->stmts);
partition->has_writes = partition_has_writes (np);
bitmap_ior_into (processed, np->stmts);
@@ -1126,40 +1366,27 @@ rdg_build_partitions (struct graph *rdg, vec<rdgc> components,
}
partitions->safe_push (partition);
- partition = partition_alloc (NULL);
+ partition = partition_alloc (NULL, NULL);
}
}
- /* Add the nodes from the RDG that were not marked as processed, and
- that are used outside the current loop. These are scalar
- computations that are not yet part of previous partitions. */
- for (i = 0; i < rdg->n_vertices; i++)
- if (!bitmap_bit_p (processed, i)
- && rdg_defs_used_in_other_loops_p (rdg, i))
- other_stores->safe_push (i);
-
- /* If there are still statements left in the OTHER_STORES array,
- create other components and partitions with these stores and
- their dependences. */
- if (other_stores->length () > 0)
- {
- vec<rdgc> comps;
- comps.create (3);
- vec<int> foo;
- foo.create (3);
+ /* All vertices should have been assigned to at least one partition now,
+ other than vertices belonging to dead code. */
- rdg_build_components (rdg, *other_stores, &comps);
- rdg_build_partitions (rdg, comps, &foo, partitions, processed);
+ if (!bitmap_empty_p (partition->stmts))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "remaining partition:\n");
+ dump_bitmap (dump_file, partition->stmts);
+ }
- foo.release ();
- free_rdg_components (comps);
+ partitions->safe_push (partition);
}
-
- /* If there is something left in the last partition, save it. */
- if (bitmap_count_bits (partition->stmts) > 0)
- partitions->safe_push (partition);
else
partition_free (partition);
+
+ BITMAP_FREE (processed);
}
/* Dump to FILE the PARTITIONS. */
@@ -1242,56 +1469,47 @@ partition_contains_all_rw (struct graph *rdg,
return false;
}
-/* Generate code from STARTING_VERTICES in RDG. Returns the number of
- distributed loops. */
+
+/* Distributes the code from LOOP in such a way that producer
+ statements are placed before consumer statements. Tries to separate
+ only the statements from STMTS into separate loops.
+ Returns the number of distributed loops. */
static int
-ldist_gen (struct loop *loop, struct graph *rdg,
- vec<int> starting_vertices)
+distribute_loop (struct loop *loop, vec<gimple> stmts,
+ control_dependences *cd)
{
- int i, nbp;
- vec<rdgc> components;
- components.create (3);
+ struct graph *rdg;
+ vec<loop_p> loop_nest;
vec<partition_t> partitions;
- partitions.create (3);
- vec<int> other_stores;
- other_stores.create (3);
partition_t partition;
- bitmap processed = BITMAP_ALLOC (NULL);
bool any_builtin;
+ int i, nbp;
- remaining_stmts = BITMAP_ALLOC (NULL);
- upstream_mem_writes = BITMAP_ALLOC (NULL);
-
- for (i = 0; i < rdg->n_vertices; i++)
+ loop_nest.create (3);
+ if (!find_loop_nest (loop, &loop_nest))
{
- bitmap_set_bit (remaining_stmts, i);
-
- /* Save in OTHER_STORES all the memory writes that are not in
- STARTING_VERTICES. */
- if (RDG_MEM_WRITE_STMT (rdg, i))
- {
- int v;
- unsigned j;
- bool found = false;
+ loop_nest.release ();
+ return 0;
+ }
- FOR_EACH_VEC_ELT (starting_vertices, j, v)
- if (i == v)
- {
- found = true;
- break;
- }
+ rdg = build_rdg (loop_nest, cd);
+ if (!rdg)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ "Loop %d not distributed: failed to build the RDG.\n",
+ loop->num);
- if (!found)
- other_stores.safe_push (i);
- }
+ loop_nest.release ();
+ return 0;
}
- mark_nodes_having_upstream_mem_writes (rdg);
- rdg_build_components (rdg, starting_vertices, &components);
- rdg_build_partitions (rdg, components, &other_stores, &partitions,
- processed);
- BITMAP_FREE (processed);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ dump_rdg (dump_file, rdg);
+
+ partitions.create (3);
+ rdg_build_partitions (rdg, stmts, &partitions);
any_builtin = false;
FOR_EACH_VEC_ELT (partitions, i, partition)
@@ -1300,18 +1518,51 @@ ldist_gen (struct loop *loop, struct graph *rdg,
any_builtin |= partition_builtin_p (partition);
}
+ /* If we did not detect any builtin but are not asked to apply
+ regular loop distribution simply bail out. */
+ if (!flag_tree_loop_distribution
+ && !any_builtin)
+ {
+ nbp = 0;
+ goto ldist_done;
+ }
+
+ /* Apply our simple cost model - fuse partitions with similar
+ memory accesses. */
+ partition_t into;
+ for (i = 0; partitions.iterate (i, &into); ++i)
+ {
+ if (partition_builtin_p (into))
+ continue;
+ for (int j = i + 1;
+ partitions.iterate (j, &partition); ++j)
+ {
+ if (!partition_builtin_p (partition)
+ && similar_memory_accesses (rdg, into, partition))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "fusing partitions\n");
+ dump_bitmap (dump_file, into->stmts);
+ dump_bitmap (dump_file, partition->stmts);
+ fprintf (dump_file, "because they have similar "
+ "memory accesses\n");
+ }
+ bitmap_ior_into (into->stmts, partition->stmts);
+ if (partition->kind == PKIND_REDUCTION)
+ into->kind = PKIND_REDUCTION;
+ partitions.ordered_remove (j);
+ partition_free (partition);
+ j--;
+ }
+ }
+ }
+
/* If we are only distributing patterns fuse all partitions that
- were not properly classified as builtins. Else fuse partitions
- with similar memory accesses. */
+ were not properly classified as builtins. */
if (!flag_tree_loop_distribution)
{
partition_t into;
- /* If we did not detect any builtin simply bail out. */
- if (!any_builtin)
- {
- nbp = 0;
- goto ldist_done;
- }
/* Only fuse adjacent non-builtin partitions, see PR53616.
??? Use dependence information to improve partition ordering. */
i = 0;
@@ -1335,41 +1586,6 @@ ldist_gen (struct loop *loop, struct graph *rdg,
}
while ((unsigned) i < partitions.length ());
}
- else
- {
- partition_t into;
- int j;
- for (i = 0; partitions.iterate (i, &into); ++i)
- {
- if (partition_builtin_p (into))
- continue;
- for (j = i + 1;
- partitions.iterate (j, &partition); ++j)
- {
- if (!partition_builtin_p (partition)
- /* ??? The following is horribly inefficient,
- we are re-computing and analyzing data-references
- of the stmts in the partitions all the time. */
- && similar_memory_accesses (rdg, into, partition))
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- fprintf (dump_file, "fusing partitions\n");
- dump_bitmap (dump_file, into->stmts);
- dump_bitmap (dump_file, partition->stmts);
- fprintf (dump_file, "because they have similar "
- "memory accesses\n");
- }
- bitmap_ior_into (into->stmts, partition->stmts);
- if (partition->kind == PKIND_REDUCTION)
- into->kind = PKIND_REDUCTION;
- partitions.ordered_remove (j);
- partition_free (partition);
- j--;
- }
- }
- }
- }
/* Fuse all reduction partitions into the last. */
if (partitions.length () > 1)
@@ -1412,80 +1628,13 @@ ldist_gen (struct loop *loop, struct graph *rdg,
ldist_done:
- BITMAP_FREE (remaining_stmts);
- BITMAP_FREE (upstream_mem_writes);
-
FOR_EACH_VEC_ELT (partitions, i, partition)
partition_free (partition);
-
- other_stores.release ();
partitions.release ();
- free_rdg_components (components);
- return nbp;
-}
-
-/* Distributes the code from LOOP in such a way that producer
- statements are placed before consumer statements. When STMTS is
- NULL, performs the maximal distribution, if STMTS is not NULL,
- tries to separate only these statements from the LOOP's body.
- Returns the number of distributed loops. */
-
-static int
-distribute_loop (struct loop *loop, vec<gimple> stmts)
-{
- int res = 0;
- struct graph *rdg;
- gimple s;
- unsigned i;
- vec<int> vertices;
- vec<ddr_p> dependence_relations;
- vec<data_reference_p> datarefs;
- vec<loop_p> loop_nest;
-
- datarefs.create (10);
- dependence_relations.create (100);
- loop_nest.create (3);
- rdg = build_rdg (loop, &loop_nest, &dependence_relations, &datarefs);
-
- if (!rdg)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- "FIXME: Loop %d not distributed: failed to build the RDG.\n",
- loop->num);
-
- free_dependence_relations (dependence_relations);
- free_data_refs (datarefs);
- loop_nest.release ();
- return res;
- }
-
- vertices.create (3);
- if (dump_file && (dump_flags & TDF_DETAILS))
- dump_rdg (dump_file, rdg);
-
- FOR_EACH_VEC_ELT (stmts, i, s)
- {
- int v = rdg_vertex_for_stmt (rdg, s);
-
- if (v >= 0)
- {
- vertices.safe_push (v);
-
- if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file,
- "ldist asked to generate code for vertex %d\n", v);
- }
- }
-
- res = ldist_gen (loop, rdg, vertices);
- vertices.release ();
free_rdg (rdg);
- free_dependence_relations (dependence_relations);
- free_data_refs (datarefs);
loop_nest.release ();
- return res;
+ return nbp;
}
/* Distribute all loops in the current function. */
@@ -1497,6 +1646,7 @@ tree_loop_distribution (void)
loop_iterator li;
bool changed = false;
basic_block bb;
+ control_dependences *cd = NULL;
FOR_ALL_BB (bb)
{
@@ -1526,18 +1676,34 @@ tree_loop_distribution (void)
if (!optimize_loop_for_speed_p (loop))
continue;
- /* Only distribute loops with a header and latch for now. */
- if (loop->num_nodes > 2)
- continue;
-
/* Initialize the worklist with stmts we seed the partitions with. */
bbs = get_loop_body_in_dom_order (loop);
for (i = 0; i < loop->num_nodes; ++i)
{
gimple_stmt_iterator gsi;
+ for (gsi = gsi_start_phis (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+ if (virtual_operand_p (gimple_phi_result (phi)))
+ continue;
+ /* Distribute stmts which have defs that are used outside of
+ the loop. */
+ if (!stmt_has_scalar_dependences_outside_loop (loop, phi))
+ continue;
+ work_list.safe_push (phi);
+ }
for (gsi = gsi_start_bb (bbs[i]); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
+
+ /* If there is a stmt with side-effects bail out - we
+ cannot and should not distribute this loop. */
+ if (gimple_has_side_effects (stmt))
+ {
+ work_list.truncate (0);
+ goto out;
+ }
+
/* Distribute stmts which have defs that are used outside of
the loop. */
if (stmt_has_scalar_dependences_outside_loop (loop, stmt))
@@ -1550,10 +1716,20 @@ tree_loop_distribution (void)
work_list.safe_push (stmt);
}
}
+out:
free (bbs);
if (work_list.length () > 0)
- nb_generated_loops = distribute_loop (loop, work_list);
+ {
+ if (!cd)
+ {
+ calculate_dominance_info (CDI_DOMINATORS);
+ calculate_dominance_info (CDI_POST_DOMINATORS);
+ cd = new control_dependences (create_edge_list ());
+ free_dominance_info (CDI_POST_DOMINATORS);
+ }
+ nb_generated_loops = distribute_loop (loop, work_list, cd);
+ }
if (nb_generated_loops > 0)
changed = true;
@@ -1570,6 +1746,9 @@ tree_loop_distribution (void)
work_list.release ();
}
+ if (cd)
+ delete cd;
+
if (changed)
{
mark_virtual_operands_for_renaming (cfun);
@@ -1610,8 +1789,8 @@ const pass_data pass_data_loop_distribution =
class pass_loop_distribution : public gimple_opt_pass
{
public:
- pass_loop_distribution(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_loop_distribution, ctxt)
+ pass_loop_distribution (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_loop_distribution, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 87431e7237c..9616762f24e 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "gimple.h"
#include "tree-iterator.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-mudflap.h"
#include "tree-pass.h"
#include "hashtab.h"
@@ -1390,8 +1390,8 @@ const pass_data pass_data_mudflap_1 =
class pass_mudflap_1 : public gimple_opt_pass
{
public:
- pass_mudflap_1(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_mudflap_1, ctxt)
+ pass_mudflap_1 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_mudflap_1, ctxt)
{}
/* opt_pass methods: */
@@ -1429,8 +1429,8 @@ const pass_data pass_data_mudflap_2 =
class pass_mudflap_2 : public gimple_opt_pass
{
public:
- pass_mudflap_2(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_mudflap_2, ctxt)
+ pass_mudflap_2 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_mudflap_2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index fe44679a013..c6703b78acf 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -28,7 +28,7 @@
#include "tree-inline.h"
#include "gimple.h"
#include "tree-iterator.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cgraph.h"
#include "expr.h" /* FIXME: For STACK_SAVEAREA_MODE and SAVE_NONLOCAL. */
#include "langhooks.h"
@@ -2304,7 +2304,7 @@ remap_vla_decls (tree block, struct nesting_info *root)
static bool
fold_mem_refs (const void *e, void *data ATTRIBUTE_UNUSED)
{
- tree *ref_p = CONST_CAST2(tree *, const tree *, (const tree *)e);
+ tree *ref_p = CONST_CAST2 (tree *, const tree *, (const tree *)e);
*ref_p = fold (*ref_p);
return true;
}
diff --git a/gcc/tree-nomudflap.c b/gcc/tree-nomudflap.c
index 6659f05f5b1..fe9ea6058bd 100644
--- a/gcc/tree-nomudflap.c
+++ b/gcc/tree-nomudflap.c
@@ -105,8 +105,8 @@ const pass_data pass_data_mudflap_1 =
class pass_mudflap_1 : public gimple_opt_pass
{
public:
- pass_mudflap_1(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_mudflap_1, ctxt)
+ pass_mudflap_1 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_mudflap_1, ctxt)
{}
/* opt_pass methods: */
@@ -142,8 +142,8 @@ const pass_data pass_data_mudflap_2 =
class pass_mudflap_2 : public gimple_opt_pass
{
public:
- pass_mudflap_2(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_mudflap_2, ctxt)
+ pass_mudflap_2 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_mudflap_2, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 2acb2ebaa34..1fec697589c 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "basic-block.h"
#include "tree-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "langhooks.h"
#include "flags.h" /* For "optimize" in gate_pass_return_slot.
@@ -289,8 +289,8 @@ const pass_data pass_data_nrv =
class pass_nrv : public gimple_opt_pass
{
public:
- pass_nrv(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_nrv, ctxt)
+ pass_nrv (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_nrv, ctxt)
{}
/* opt_pass methods: */
@@ -393,8 +393,8 @@ const pass_data pass_data_return_slot =
class pass_return_slot : public gimple_opt_pass
{
public:
- pass_return_slot(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_return_slot, ctxt)
+ pass_return_slot (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_return_slot, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 1a52a416a63..0bdbc489f8c 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "diagnostic-core.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
@@ -392,7 +392,8 @@ alloc_object_size (const_gimple call, int object_size_type)
if (!callee)
return unknown[object_size_type];
- alloc_size = lookup_attribute ("alloc_size", TYPE_ATTRIBUTES (TREE_TYPE(callee)));
+ alloc_size = lookup_attribute ("alloc_size",
+ TYPE_ATTRIBUTES (TREE_TYPE (callee)));
if (alloc_size && TREE_VALUE (alloc_size))
{
tree p = TREE_VALUE (alloc_size);
@@ -1282,12 +1283,12 @@ const pass_data pass_data_object_sizes =
class pass_object_sizes : public gimple_opt_pass
{
public:
- pass_object_sizes(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_object_sizes, ctxt)
+ pass_object_sizes (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_object_sizes, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_object_sizes (ctxt_); }
+ opt_pass * clone () { return new pass_object_sizes (m_ctxt); }
unsigned int execute () { return compute_object_sizes (); }
}; // class pass_object_sizes
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 9c99ec23a2e..445bd7c7a91 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "flags.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "function.h"
#include "langhooks.h"
#include "diagnostic-core.h"
@@ -108,8 +108,8 @@ const pass_data pass_data_cleanup_cfg_post_optimizing =
class pass_cleanup_cfg_post_optimizing : public gimple_opt_pass
{
public:
- pass_cleanup_cfg_post_optimizing(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_cleanup_cfg_post_optimizing, ctxt)
+ pass_cleanup_cfg_post_optimizing (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_cleanup_cfg_post_optimizing, ctxt)
{}
/* opt_pass methods: */
@@ -250,12 +250,12 @@ const pass_data pass_data_fixup_cfg =
class pass_fixup_cfg : public gimple_opt_pass
{
public:
- pass_fixup_cfg(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_fixup_cfg, ctxt)
+ pass_fixup_cfg (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_fixup_cfg, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_fixup_cfg (ctxt_); }
+ opt_pass * clone () { return new pass_fixup_cfg (m_ctxt); }
unsigned int execute () { return execute_fixup_cfg (); }
}; // class pass_fixup_cfg
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index ff3e058a978..42c90d49a18 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -27,15 +27,70 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "bitmap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "diagnostic-core.h"
-#include "ssaexpand.h"
+#include "tree-outof-ssa.h"
/* FIXME: A lot of code here deals with expanding to RTL. All that code
should be in cfgexpand.c. */
#include "expr.h"
+/* Return TRUE if expression STMT is suitable for replacement. */
+
+bool
+ssa_is_replaceable_p (gimple stmt)
+{
+ use_operand_p use_p;
+ tree def;
+ gimple use_stmt;
+
+ /* Only consider modify stmts. */
+ if (!is_gimple_assign (stmt))
+ return false;
+
+ /* If the statement may throw an exception, it cannot be replaced. */
+ if (stmt_could_throw_p (stmt))
+ return false;
+
+ /* Punt if there is more than 1 def. */
+ def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
+ if (!def)
+ return false;
+
+ /* Only consider definitions which have a single use. */
+ if (!single_imm_use (def, &use_p, &use_stmt))
+ return false;
+
+ /* Used in this block, but at the TOP of the block, not the end. */
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
+ return false;
+
+ /* There must be no VDEFs. */
+ if (gimple_vdef (stmt))
+ return false;
+
+ /* Float expressions must go through memory if float-store is on. */
+ if (flag_float_store
+ && FLOAT_TYPE_P (gimple_expr_type (stmt)))
+ return false;
+
+ /* An assignment with a register variable on the RHS is not
+ replaceable. */
+ if (gimple_assign_rhs_code (stmt) == VAR_DECL
+ && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt)))
+ return false;
+
+ /* No function calls can be replaced. */
+ if (is_gimple_call (stmt))
+ return false;
+
+ /* Leave any stmt with volatile operands alone as well. */
+ if (gimple_has_volatile_ops (stmt))
+ return false;
+
+ return true;
+}
/* Used to hold all the components required to do SSA PHI elimination.
diff --git a/gcc/ssaexpand.h b/gcc/tree-outof-ssa.h
index 0bdc8d48097..d0af95f0f3b 100644
--- a/gcc/ssaexpand.h
+++ b/gcc/tree-outof-ssa.h
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#define _SSAEXPAND_H 1
#include "tree-ssa-live.h"
+#include "tree-ssa-ter.h"
/* This structure (of which only a singleton SA exists) is used to
pass around information between the outof-SSA functions, cfgexpand
@@ -71,9 +72,9 @@ get_gimple_for_ssa_name (tree exp)
return NULL;
}
-/* In tree-outof-ssa.c. */
-void finish_out_of_ssa (struct ssaexpand *sa);
-unsigned int rewrite_out_of_ssa (struct ssaexpand *sa);
-void expand_phi_nodes (struct ssaexpand *sa);
+extern bool ssa_is_replaceable_p (gimple stmt);
+extern void finish_out_of_ssa (struct ssaexpand *sa);
+extern unsigned int rewrite_out_of_ssa (struct ssaexpand *sa);
+extern void expand_phi_nodes (struct ssaexpand *sa);
#endif
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 9d413c7fb42..94843cae52b 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index ea1a62f4368..e72fe9aeee4 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -102,7 +102,7 @@ public:
virtual unsigned int execute ();
protected:
- opt_pass(const pass_data&, gcc::context *);
+ opt_pass (const pass_data&, gcc::context *);
public:
/* A list of sub-passes to run, dependent on gate predicate. */
@@ -115,15 +115,15 @@ public:
int static_pass_number;
protected:
- gcc::context *ctxt_;
+ gcc::context *m_ctxt;
};
/* Description of GIMPLE pass. */
class gimple_opt_pass : public opt_pass
{
protected:
- gimple_opt_pass(const pass_data& data, gcc::context *ctxt)
- : opt_pass(data, ctxt)
+ gimple_opt_pass (const pass_data& data, gcc::context *ctxt)
+ : opt_pass (data, ctxt)
{
}
};
@@ -132,8 +132,8 @@ protected:
class rtl_opt_pass : public opt_pass
{
protected:
- rtl_opt_pass(const pass_data& data, gcc::context *ctxt)
- : opt_pass(data, ctxt)
+ rtl_opt_pass (const pass_data& data, gcc::context *ctxt)
+ : opt_pass (data, ctxt)
{
}
};
@@ -174,27 +174,26 @@ public:
void (*variable_transform) (struct varpool_node *);
protected:
- ipa_opt_pass_d(const pass_data& data, gcc::context *ctxt,
- void (*generate_summary) (void),
- void (*write_summary) (void),
- void (*read_summary) (void),
- void (*write_optimization_summary) (void),
- void (*read_optimization_summary) (void),
- void (*stmt_fixup) (struct cgraph_node *, gimple *),
- unsigned int function_transform_todo_flags_start,
- unsigned int (*function_transform) (struct cgraph_node *),
- void (*variable_transform) (struct varpool_node *))
- : opt_pass(data, ctxt),
- generate_summary(generate_summary),
- write_summary(write_summary),
- read_summary(read_summary),
- write_optimization_summary(write_optimization_summary),
- read_optimization_summary(read_optimization_summary),
- stmt_fixup(stmt_fixup),
- function_transform_todo_flags_start(
- function_transform_todo_flags_start),
- function_transform(function_transform),
- variable_transform(variable_transform)
+ ipa_opt_pass_d (const pass_data& data, gcc::context *ctxt,
+ void (*generate_summary) (void),
+ void (*write_summary) (void),
+ void (*read_summary) (void),
+ void (*write_optimization_summary) (void),
+ void (*read_optimization_summary) (void),
+ void (*stmt_fixup) (struct cgraph_node *, gimple *),
+ unsigned int function_transform_todo_flags_start,
+ unsigned int (*function_transform) (struct cgraph_node *),
+ void (*variable_transform) (struct varpool_node *))
+ : opt_pass (data, ctxt),
+ generate_summary (generate_summary),
+ write_summary (write_summary),
+ read_summary (read_summary),
+ write_optimization_summary (write_optimization_summary),
+ read_optimization_summary (read_optimization_summary),
+ stmt_fixup (stmt_fixup),
+ function_transform_todo_flags_start (function_transform_todo_flags_start),
+ function_transform (function_transform),
+ variable_transform (variable_transform)
{
}
};
@@ -204,8 +203,8 @@ protected:
class simple_ipa_opt_pass : public opt_pass
{
protected:
- simple_ipa_opt_pass(const pass_data& data, gcc::context *ctxt)
- : opt_pass(data, ctxt)
+ simple_ipa_opt_pass (const pass_data& data, gcc::context *ctxt)
+ : opt_pass (data, ctxt)
{
}
};
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 44997537ccb..0bd5085ba99 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "ggc.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "diagnostic-core.h"
#include "gimple.h"
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index dceea8cc89a..2f21bb7404a 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -191,7 +191,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm_p.h"
#include "cfgloop.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "ggc.h"
#include "tree-data-ref.h"
#include "tree-scalar-evolution.h"
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 69e40060727..c357b06f978 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tree-pretty-print.h"
#include "hashtab.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "langhooks.h"
#include "tree-iterator.h"
#include "tree-chrec.h"
@@ -46,7 +46,7 @@ static void do_niy (pretty_printer *, const_tree);
#define INDENT(SPACE) do { \
int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
-#define NIY do_niy(buffer,node)
+#define NIY do_niy (buffer, node)
static pretty_printer buffer;
static int initialized = 0;
@@ -1062,29 +1062,9 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
pp_string (buffer, "B"); /* pseudo-unit */
}
- else if (host_integerp (node, 0))
- pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
- else if (host_integerp (node, 1))
- pp_unsigned_wide_integer (buffer, TREE_INT_CST_LOW (node));
else
- {
- tree val = node;
- unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (val);
- HOST_WIDE_INT high = TREE_INT_CST_HIGH (val);
-
- if (tree_int_cst_sgn (val) < 0)
- {
- pp_minus (buffer);
- high = ~high + !low;
- low = -low;
- }
- /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
- systems? */
- sprintf (pp_buffer (buffer)->digit_buffer,
- HOST_WIDE_INT_PRINT_DOUBLE_HEX,
- (unsigned HOST_WIDE_INT) high, low);
- pp_string (buffer, pp_buffer (buffer)->digit_buffer);
- }
+ pp_double_int (buffer, tree_to_double_int (node),
+ TYPE_UNSIGNED (TREE_TYPE (node)));
break;
case REAL_CST:
@@ -3196,3 +3176,31 @@ dump_function_header (FILE *dump_file, tree fdecl, int flags)
else
fprintf (dump_file, ")\n\n");
}
+
+/* Dump double_int D to pretty_printer PP. UNS is true
+ if D is unsigned and false otherwise. */
+void
+pp_double_int (pretty_printer *pp, double_int d, bool uns)
+{
+ if (d.fits_shwi ())
+ pp_wide_integer (pp, d.low);
+ else if (d.fits_uhwi ())
+ pp_unsigned_wide_integer (pp, d.low);
+ else
+ {
+ unsigned HOST_WIDE_INT low = d.low;
+ HOST_WIDE_INT high = d.high;
+ if (!uns && d.is_negative ())
+ {
+ pp_minus (pp);
+ high = ~high + !low;
+ low = -low;
+ }
+ /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
+ systems? */
+ sprintf (pp_buffer (pp)->digit_buffer,
+ HOST_WIDE_INT_PRINT_DOUBLE_HEX,
+ (unsigned HOST_WIDE_INT) high, low);
+ pp_string (pp, pp_buffer (pp)->digit_buffer);
+ }
+}
diff --git a/gcc/tree-pretty-print.h b/gcc/tree-pretty-print.h
index 7da8000d5b8..ec421fa938f 100644
--- a/gcc/tree-pretty-print.h
+++ b/gcc/tree-pretty-print.h
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
#define GCC_TREE_PRETTY_PRINT_H
#include "pretty-print.h"
+#include "double-int.h"
#define pp_unsupported_tree(PP, T) \
pp_verbatim (PP, "#%qs not supported by %s#", \
@@ -46,6 +47,7 @@ extern void debug_generic_stmt (tree);
extern void debug_tree_chain (tree);
extern void percent_K_format (text_info *);
extern void dump_function_header (FILE *, tree, int);
+extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
/* In c-pretty-print.c */
extern void debug_c_tree (tree);
diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c
index dd164b53a74..a0e49b53047 100644
--- a/gcc/tree-profile.c
+++ b/gcc/tree-profile.c
@@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic-core.h"
#include "coverage.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "value-prof.h"
#include "cgraph.h"
@@ -607,7 +607,7 @@ tree_profiling (void)
pop_cfun ();
}
- del_node_map();
+ del_node_map ();
return 0;
}
@@ -641,8 +641,8 @@ const pass_data pass_data_ipa_tree_profile =
class pass_ipa_tree_profile : public simple_ipa_opt_pass
{
public:
- pass_ipa_tree_profile(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_tree_profile, ctxt)
+ pass_ipa_tree_profile (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_tree_profile, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c
index bed621fe052..06379024450 100644
--- a/gcc/tree-scalar-evolution.c
+++ b/gcc/tree-scalar-evolution.c
@@ -258,7 +258,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "hash-table.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "tree-scalar-evolution.h"
@@ -269,13 +269,13 @@ static tree analyze_scalar_evolution_1 (struct loop *, tree, tree);
static tree analyze_scalar_evolution_for_address_of (struct loop *loop,
tree var);
-/* The cached information about an SSA name VAR, claiming that below
- basic block INSTANTIATED_BELOW, the value of VAR can be expressed
- as CHREC. */
+/* The cached information about an SSA name with version NAME_VERSION,
+ claiming that below basic block with index INSTANTIATED_BELOW, the
+ value of the SSA name can be expressed as CHREC. */
struct GTY(()) scev_info_str {
- basic_block instantiated_below;
- tree var;
+ unsigned int name_version;
+ int instantiated_below;
tree chrec;
};
@@ -309,9 +309,9 @@ new_scev_info_str (basic_block instantiated_below, tree var)
struct scev_info_str *res;
res = ggc_alloc_scev_info_str ();
- res->var = var;
+ res->name_version = SSA_NAME_VERSION (var);
res->chrec = chrec_not_analyzed_yet;
- res->instantiated_below = instantiated_below;
+ res->instantiated_below = instantiated_below->index;
return res;
}
@@ -319,9 +319,10 @@ new_scev_info_str (basic_block instantiated_below, tree var)
/* Computes a hash function for database element ELT. */
static inline hashval_t
-hash_scev_info (const void *elt)
+hash_scev_info (const void *elt_)
{
- return SSA_NAME_VERSION (((const struct scev_info_str *) elt)->var);
+ const struct scev_info_str *elt = (const struct scev_info_str *) elt_;
+ return elt->name_version ^ elt->instantiated_below;
}
/* Compares database elements E1 and E2. */
@@ -332,7 +333,7 @@ eq_scev_info (const void *e1, const void *e2)
const struct scev_info_str *elt1 = (const struct scev_info_str *) e1;
const struct scev_info_str *elt2 = (const struct scev_info_str *) e2;
- return (elt1->var == elt2->var
+ return (elt1->name_version == elt2->name_version
&& elt1->instantiated_below == elt2->instantiated_below);
}
@@ -355,8 +356,8 @@ find_var_scev_info (basic_block instantiated_below, tree var)
struct scev_info_str tmp;
PTR *slot;
- tmp.var = var;
- tmp.instantiated_below = instantiated_below;
+ tmp.name_version = SSA_NAME_VERSION (var);
+ tmp.instantiated_below = instantiated_below->index;
slot = htab_find_slot (scalar_evolution_info, &tmp, INSERT);
if (!*slot)
@@ -1648,6 +1649,8 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
chrec2 = analyze_scalar_evolution (loop, rhs2);
chrec1 = chrec_convert (type, chrec1, at_stmt);
chrec2 = chrec_convert (TREE_TYPE (rhs2), chrec2, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
+ chrec2 = instantiate_parameters (loop, chrec2);
res = chrec_fold_plus (type, chrec1, chrec2);
}
else
@@ -1661,6 +1664,7 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
{
chrec2 = analyze_scalar_evolution (loop, offset);
chrec2 = chrec_convert (TREE_TYPE (offset), chrec2, at_stmt);
+ chrec2 = instantiate_parameters (loop, chrec2);
res = chrec_fold_plus (type, res, chrec2);
}
@@ -1671,6 +1675,7 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
unitpos = size_int (bitpos / BITS_PER_UNIT);
chrec3 = analyze_scalar_evolution (loop, unitpos);
chrec3 = chrec_convert (TREE_TYPE (unitpos), chrec3, at_stmt);
+ chrec3 = instantiate_parameters (loop, chrec3);
res = chrec_fold_plus (type, res, chrec3);
}
}
@@ -1683,6 +1688,8 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
chrec2 = analyze_scalar_evolution (loop, rhs2);
chrec1 = chrec_convert (type, chrec1, at_stmt);
chrec2 = chrec_convert (TREE_TYPE (rhs2), chrec2, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
+ chrec2 = instantiate_parameters (loop, chrec2);
res = chrec_fold_plus (type, chrec1, chrec2);
break;
@@ -1691,6 +1698,8 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
chrec2 = analyze_scalar_evolution (loop, rhs2);
chrec1 = chrec_convert (type, chrec1, at_stmt);
chrec2 = chrec_convert (type, chrec2, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
+ chrec2 = instantiate_parameters (loop, chrec2);
res = chrec_fold_plus (type, chrec1, chrec2);
break;
@@ -1699,6 +1708,8 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
chrec2 = analyze_scalar_evolution (loop, rhs2);
chrec1 = chrec_convert (type, chrec1, at_stmt);
chrec2 = chrec_convert (type, chrec2, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
+ chrec2 = instantiate_parameters (loop, chrec2);
res = chrec_fold_minus (type, chrec1, chrec2);
break;
@@ -1706,6 +1717,7 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec1 = chrec_convert (type, chrec1, at_stmt);
/* TYPE may be integer, real or complex, so use fold_convert. */
+ chrec1 = instantiate_parameters (loop, chrec1);
res = chrec_fold_multiply (type, chrec1,
fold_convert (type, integer_minus_one_node));
break;
@@ -1714,6 +1726,7 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
/* Handle ~X as -1 - X. */
chrec1 = analyze_scalar_evolution (loop, rhs1);
chrec1 = chrec_convert (type, chrec1, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
res = chrec_fold_minus (type,
fold_convert (type, integer_minus_one_node),
chrec1);
@@ -1724,6 +1737,8 @@ interpret_rhs_expr (struct loop *loop, gimple at_stmt,
chrec2 = analyze_scalar_evolution (loop, rhs2);
chrec1 = chrec_convert (type, chrec1, at_stmt);
chrec2 = chrec_convert (type, chrec2, at_stmt);
+ chrec1 = instantiate_parameters (loop, chrec1);
+ chrec2 = instantiate_parameters (loop, chrec2);
res = chrec_fold_multiply (type, chrec1, chrec2);
break;
@@ -2051,84 +2066,76 @@ analyze_scalar_evolution_in_loop (struct loop *wrto_loop, struct loop *use_loop,
instantiating a CHREC or resolving mixers. For this use
instantiated_below is always the same. */
-struct instantiate_cache_entry
-{
- tree name;
- tree chrec;
-};
-
-struct instantiate_cache_entry_hasher : typed_noop_remove <uintptr_t>
-{
- typedef uintptr_t value_type;
- typedef instantiate_cache_entry compare_type;
- static inline hashval_t hash (const value_type *);
- static inline bool equal (const value_type *, const compare_type *);
-};
-
struct instantiate_cache_type
{
- hash_table <instantiate_cache_entry_hasher> htab;
- vec<instantiate_cache_entry> entries;
+ htab_t map;
+ vec<scev_info_str> entries;
+ instantiate_cache_type () : map (NULL), entries (vNULL) {}
~instantiate_cache_type ();
+ tree get (unsigned slot) { return entries[slot].chrec; }
+ void set (unsigned slot, tree chrec) { entries[slot].chrec = chrec; }
};
instantiate_cache_type::~instantiate_cache_type ()
{
- if (htab.is_created ())
+ if (map != NULL)
{
- htab.dispose ();
+ htab_delete (map);
entries.release ();
}
}
-static instantiate_cache_type *ctbl;
+/* Cache to avoid infinite recursion when instantiating an SSA name.
+ Live during the outermost instantiate_scev or resolve_mixers call. */
+static instantiate_cache_type *global_cache;
+
+/* Computes a hash function for database element ELT. */
-inline hashval_t
-instantiate_cache_entry_hasher::hash (const value_type *idx)
+static inline hashval_t
+hash_idx_scev_info (const void *elt_)
{
- instantiate_cache_entry *elt
- = &ctbl->entries[reinterpret_cast <uintptr_t> (idx) - 2];
- return SSA_NAME_VERSION (elt->name);
+ unsigned idx = ((size_t) elt_) - 2;
+ return hash_scev_info (&global_cache->entries[idx]);
}
-inline bool
-instantiate_cache_entry_hasher::equal (const value_type *idx1,
- const compare_type *elt2)
+/* Compares database elements E1 and E2. */
+
+static inline int
+eq_idx_scev_info (const void *e1, const void *e2)
{
- compare_type *elt1 = &ctbl->entries[reinterpret_cast <uintptr_t> (idx1) - 2];
- return elt1->name == elt2->name;
+ unsigned idx1 = ((size_t) e1) - 2;
+ return eq_scev_info (&global_cache->entries[idx1], e2);
}
-/* Returns from CACHE a pointer to the cached chrec for NAME. */
+/* Returns from CACHE the slot number of the cached chrec for NAME. */
-static tree *
-get_instantiated_value_entry (instantiate_cache_type &cache, tree name)
+static unsigned
+get_instantiated_value_entry (instantiate_cache_type &cache,
+ tree name, basic_block instantiate_below)
{
- struct instantiate_cache_entry e;
- uintptr_t **slot;
-
- if (!cache.htab.is_created ())
+ if (!cache.map)
{
- cache.htab.create (10);
+ cache.map = htab_create (10, hash_idx_scev_info, eq_idx_scev_info, NULL);
cache.entries.create (10);
}
- ctbl = &cache;
-
- e.name = name;
- slot = cache.htab.find_slot_with_hash (&e, SSA_NAME_VERSION (name), INSERT);
+ scev_info_str e;
+ e.name_version = SSA_NAME_VERSION (name);
+ e.instantiated_below = instantiate_below->index;
+ void **slot = htab_find_slot_with_hash (cache.map, &e,
+ hash_scev_info (&e), INSERT);
if (!*slot)
{
e.chrec = chrec_not_analyzed_yet;
+ *slot = (void *)(size_t)(cache.entries.length () + 2);
cache.entries.safe_push (e);
- *slot = reinterpret_cast <uintptr_t *>
- ((uintptr_t) cache.entries.length () + 1);
}
- return &cache.entries[reinterpret_cast <uintptr_t> (*slot) - 2].chrec;
+ return ((size_t)*slot) - 2;
}
+
/* Return the closed_loop_phi node for VAR. If there is none, return
NULL_TREE. */
@@ -2160,7 +2167,7 @@ loop_closed_phi_def (tree var)
}
static tree instantiate_scev_r (basic_block, struct loop *, struct loop *,
- tree, bool, instantiate_cache_type &, int);
+ tree, bool, int);
/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW
and EVOLUTION_LOOP, that were left under a symbolic form.
@@ -2180,7 +2187,7 @@ static tree
instantiate_scev_name (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
+ bool fold_conversions,
int size_expr)
{
tree res;
@@ -2203,13 +2210,13 @@ instantiate_scev_name (basic_block instantiate_below,
| a_2 -> {0, +, 1, +, a_2}_1 */
- tree *si;
- si = get_instantiated_value_entry (cache, chrec);
- if (*si != chrec_not_analyzed_yet)
- return *si;
+ unsigned si = get_instantiated_value_entry (*global_cache,
+ chrec, instantiate_below);
+ if (global_cache->get (si) != chrec_not_analyzed_yet)
+ return global_cache->get (si);
/* On recursion return chrec_dont_know. */
- *si = chrec_dont_know;
+ global_cache->set (si, chrec_dont_know);
def_loop = find_common_loop (evolution_loop, def_bb->loop_father);
@@ -2242,7 +2249,7 @@ instantiate_scev_name (basic_block instantiate_below,
res = compute_overall_effect_of_inner_loop (loop, res);
res = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, res,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
}
else if (!dominated_by_p (CDI_DOMINATORS, instantiate_below,
gimple_bb (SSA_NAME_DEF_STMT (res))))
@@ -2259,11 +2266,11 @@ instantiate_scev_name (basic_block instantiate_below,
else
res = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, res,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
}
/* Store the correct value to the cache. */
- *si = res;
+ global_cache->set (si, res);
return res;
}
@@ -2284,21 +2291,19 @@ instantiate_scev_name (basic_block instantiate_below,
static tree
instantiate_scev_poly (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *,
- tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ tree chrec, bool fold_conversions, int size_expr)
{
tree op1;
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
get_chrec_loop (chrec),
- CHREC_LEFT (chrec), fold_conversions, cache,
+ CHREC_LEFT (chrec), fold_conversions,
size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
op1 = instantiate_scev_r (instantiate_below, evolution_loop,
get_chrec_loop (chrec),
- CHREC_RIGHT (chrec), fold_conversions, cache,
+ CHREC_RIGHT (chrec), fold_conversions,
size_expr);
if (op1 == chrec_dont_know)
return chrec_dont_know;
@@ -2332,20 +2337,16 @@ instantiate_scev_binary (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec, enum tree_code code,
tree type, tree c0, tree c1,
- bool fold_conversions,
- instantiate_cache_type &cache,
- int size_expr)
+ bool fold_conversions, int size_expr)
{
tree op1;
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop, inner_loop,
- c0, fold_conversions, cache,
- size_expr);
+ c0, fold_conversions, size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
op1 = instantiate_scev_r (instantiate_below, evolution_loop, inner_loop,
- c1, fold_conversions, cache,
- size_expr);
+ c1, fold_conversions, size_expr);
if (op1 == chrec_dont_know)
return chrec_dont_know;
@@ -2392,15 +2393,13 @@ instantiate_scev_binary (basic_block instantiate_below,
static tree
instantiate_array_ref (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
- tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ tree chrec, bool fold_conversions, int size_expr)
{
tree res;
tree index = TREE_OPERAND (chrec, 1);
tree op1 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, index,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op1 == chrec_dont_know)
return chrec_dont_know;
@@ -2431,14 +2430,12 @@ instantiate_array_ref (basic_block instantiate_below,
static tree
instantiate_scev_convert (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
- tree chrec,
- tree type, tree op,
- bool fold_conversions,
- instantiate_cache_type &cache, int size_expr)
+ tree chrec, tree type, tree op,
+ bool fold_conversions, int size_expr)
{
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, op,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
@@ -2483,12 +2480,11 @@ instantiate_scev_not (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
enum tree_code code, tree type, tree op,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ bool fold_conversions, int size_expr)
{
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, op,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
@@ -2533,25 +2529,24 @@ static tree
instantiate_scev_3 (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ bool fold_conversions, int size_expr)
{
tree op1, op2;
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, TREE_OPERAND (chrec, 0),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
op1 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, TREE_OPERAND (chrec, 1),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op1 == chrec_dont_know)
return chrec_dont_know;
op2 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, TREE_OPERAND (chrec, 2),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op2 == chrec_dont_know)
return chrec_dont_know;
@@ -2582,19 +2577,18 @@ static tree
instantiate_scev_2 (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ bool fold_conversions, int size_expr)
{
tree op1;
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, TREE_OPERAND (chrec, 0),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
op1 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, TREE_OPERAND (chrec, 1),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op1 == chrec_dont_know)
return chrec_dont_know;
@@ -2623,12 +2617,11 @@ static tree
instantiate_scev_1 (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ bool fold_conversions, int size_expr)
{
tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
inner_loop, TREE_OPERAND (chrec, 0),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
if (op0 == chrec_dont_know)
return chrec_dont_know;
@@ -2657,8 +2650,7 @@ static tree
instantiate_scev_r (basic_block instantiate_below,
struct loop *evolution_loop, struct loop *inner_loop,
tree chrec,
- bool fold_conversions, instantiate_cache_type &cache,
- int size_expr)
+ bool fold_conversions, int size_expr)
{
/* Give up if the expression is larger than the MAX that we allow. */
if (size_expr++ > PARAM_VALUE (PARAM_SCEV_MAX_EXPR_SIZE))
@@ -2674,12 +2666,12 @@ instantiate_scev_r (basic_block instantiate_below,
case SSA_NAME:
return instantiate_scev_name (instantiate_below, evolution_loop,
inner_loop, chrec,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case POLYNOMIAL_CHREC:
return instantiate_scev_poly (instantiate_below, evolution_loop,
inner_loop, chrec,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
@@ -2690,13 +2682,13 @@ instantiate_scev_r (basic_block instantiate_below,
TREE_CODE (chrec), chrec_type (chrec),
TREE_OPERAND (chrec, 0),
TREE_OPERAND (chrec, 1),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
CASE_CONVERT:
return instantiate_scev_convert (instantiate_below, evolution_loop,
inner_loop, chrec,
TREE_TYPE (chrec), TREE_OPERAND (chrec, 0),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case NEGATE_EXPR:
case BIT_NOT_EXPR:
@@ -2704,7 +2696,7 @@ instantiate_scev_r (basic_block instantiate_below,
inner_loop, chrec,
TREE_CODE (chrec), TREE_TYPE (chrec),
TREE_OPERAND (chrec, 0),
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case ADDR_EXPR:
case SCEV_NOT_KNOWN:
@@ -2716,7 +2708,7 @@ instantiate_scev_r (basic_block instantiate_below,
case ARRAY_REF:
return instantiate_array_ref (instantiate_below, evolution_loop,
inner_loop, chrec,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
default:
break;
@@ -2730,17 +2722,17 @@ instantiate_scev_r (basic_block instantiate_below,
case 3:
return instantiate_scev_3 (instantiate_below, evolution_loop,
inner_loop, chrec,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case 2:
return instantiate_scev_2 (instantiate_below, evolution_loop,
inner_loop, chrec,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case 1:
return instantiate_scev_1 (instantiate_below, evolution_loop,
inner_loop, chrec,
- fold_conversions, cache, size_expr);
+ fold_conversions, size_expr);
case 0:
return chrec;
@@ -2764,7 +2756,6 @@ instantiate_scev (basic_block instantiate_below, struct loop *evolution_loop,
tree chrec)
{
tree res;
- instantiate_cache_type cache;
if (dump_file && (dump_flags & TDF_SCEV))
{
@@ -2776,8 +2767,21 @@ instantiate_scev (basic_block instantiate_below, struct loop *evolution_loop,
fprintf (dump_file, ")\n");
}
+ bool destr = false;
+ if (!global_cache)
+ {
+ global_cache = new instantiate_cache_type;
+ destr = true;
+ }
+
res = instantiate_scev_r (instantiate_below, evolution_loop,
- NULL, chrec, false, cache, 0);
+ NULL, chrec, false, 0);
+
+ if (destr)
+ {
+ delete global_cache;
+ global_cache = NULL;
+ }
if (dump_file && (dump_flags & TDF_SCEV))
{
@@ -2797,9 +2801,22 @@ instantiate_scev (basic_block instantiate_below, struct loop *evolution_loop,
tree
resolve_mixers (struct loop *loop, tree chrec)
{
- instantiate_cache_type cache;
+ bool destr = false;
+ if (!global_cache)
+ {
+ global_cache = new instantiate_cache_type;
+ destr = true;
+ }
+
tree ret = instantiate_scev_r (block_before_loop (loop), loop, NULL,
- chrec, true, cache, 0);
+ chrec, true, 0);
+
+ if (destr)
+ {
+ delete global_cache;
+ global_cache = NULL;
+ }
+
return ret;
}
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 7ed166857e5..a2529cb4b55 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -80,7 +80,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple.h"
#include "cgraph.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "ipa-prop.h"
#include "statistics.h"
@@ -3468,8 +3468,8 @@ const pass_data pass_data_sra_early =
class pass_sra_early : public gimple_opt_pass
{
public:
- pass_sra_early(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_sra_early, ctxt)
+ pass_sra_early (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_sra_early, ctxt)
{}
/* opt_pass methods: */
@@ -3506,8 +3506,8 @@ const pass_data pass_data_sra =
class pass_sra : public gimple_opt_pass
{
public:
- pass_sra(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_sra, ctxt)
+ pass_sra (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_sra, ctxt)
{}
/* opt_pass methods: */
@@ -4292,7 +4292,7 @@ analyze_all_param_acesses (void)
repr_state = splice_all_param_accesses (representatives);
if (repr_state == NO_GOOD_ACCESS)
- return ipa_parm_adjustment_vec();
+ return ipa_parm_adjustment_vec ();
/* If there are any parameters passed by reference which are not modified
directly, we need to check whether they can be modified indirectly. */
@@ -4356,7 +4356,7 @@ analyze_all_param_acesses (void)
adjustments = turn_representatives_into_adjustments (representatives,
adjustments_count);
else
- adjustments = ipa_parm_adjustment_vec();
+ adjustments = ipa_parm_adjustment_vec ();
representatives.release ();
return adjustments;
@@ -4952,7 +4952,7 @@ ipa_sra_preliminary_function_checks (struct cgraph_node *node)
}
if ((DECL_COMDAT (node->symbol.decl) || DECL_EXTERNAL (node->symbol.decl))
- && inline_summary(node)->size >= MAX_INLINE_INSNS_AUTO)
+ && inline_summary (node)->size >= MAX_INLINE_INSNS_AUTO)
{
if (dump_file)
fprintf (dump_file, "Function too big to be made truly local.\n");
@@ -5088,8 +5088,8 @@ const pass_data pass_data_early_ipa_sra =
class pass_early_ipa_sra : public gimple_opt_pass
{
public:
- pass_early_ipa_sra(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_early_ipa_sra, ctxt)
+ pass_early_ipa_sra (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_early_ipa_sra, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index cfd42ad21d5..1ea6d2d050b 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "tree-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "flags.h"
#include "tree-inline.h"
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 2ecd13915bc..0d3c15c447d 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -34,7 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pretty-print.h"
#include "dumpfile.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "params.h"
#include "vec.h"
@@ -404,6 +404,7 @@ dump_alias_info (FILE *file)
struct ptr_info_def *pi;
if (ptr == NULL_TREE
+ || !POINTER_TYPE_P (TREE_TYPE (ptr))
|| SSA_NAME_IN_FREE_LIST (ptr))
continue;
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index 96d01928e9d..e560685028b 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -116,7 +116,6 @@ extern void *walk_non_aliased_vuses (ao_ref *, tree,
extern unsigned int walk_aliased_vdefs (ao_ref *, tree,
bool (*)(ao_ref *, tree, void *),
void *, bitmap *);
-extern struct ptr_info_def *get_ptr_info (tree);
extern void dump_alias_info (FILE *);
extern void debug_alias_info (void);
extern void dump_points_to_solution (FILE *, struct pt_solution *);
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 3ba321d6181..fe21c0727a1 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -119,7 +119,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "function.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
#include "value-prof.h"
@@ -1728,6 +1728,9 @@ insert_clobber_before_stack_restore (tree saved_val, tree var,
insert_clobber_before_stack_restore (gimple_phi_result (stmt), var,
visited);
}
+ else if (gimple_assign_ssa_name_copy_p (stmt))
+ insert_clobber_before_stack_restore (gimple_assign_lhs (stmt), var,
+ visited);
else
gcc_assert (is_gimple_debug (stmt));
}
@@ -2163,12 +2166,12 @@ const pass_data pass_data_ccp =
class pass_ccp : public gimple_opt_pass
{
public:
- pass_ccp(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_ccp, ctxt)
+ pass_ccp (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_ccp, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_ccp (ctxt_); }
+ opt_pass * clone () { return new pass_ccp (m_ctxt); }
bool gate () { return gate_ccp (); }
unsigned int execute () { return do_ssa_ccp (); }
@@ -2580,12 +2583,12 @@ const pass_data pass_data_fold_builtins =
class pass_fold_builtins : public gimple_opt_pass
{
public:
- pass_fold_builtins(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_fold_builtins, ctxt)
+ pass_fold_builtins (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_fold_builtins, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_fold_builtins (ctxt_); }
+ opt_pass * clone () { return new pass_fold_builtins (m_ctxt); }
unsigned int execute () { return execute_fold_all_builtins (); }
}; // class pass_fold_builtins
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index d6471918d51..087272fe13a 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pretty-print.h"
#include "bitmap.h"
#include "dumpfile.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "hash-table.h"
#include "tree-ssa-live.h"
#include "diagnostic-core.h"
@@ -635,7 +635,7 @@ new_live_track (var_map map)
ptr->map = map;
lim = num_basevars (map);
bitmap_obstack_initialize (&ptr->obstack);
- ptr->live_base_partitions = (bitmap *) xmalloc(sizeof (bitmap *) * lim);
+ ptr->live_base_partitions = (bitmap *) xmalloc (sizeof (bitmap *) * lim);
ptr->live_base_var = BITMAP_ALLOC (&ptr->obstack);
for (x = 0; x < lim; x++)
ptr->live_base_partitions[x] = BITMAP_ALLOC (&ptr->obstack);
@@ -980,10 +980,7 @@ create_outofssa_var_map (coalesce_list_p cl, bitmap used_in_copy)
{
tree lhs = gimple_assign_lhs (stmt);
tree rhs1 = gimple_assign_rhs1 (stmt);
-
- if (gimple_assign_copy_p (stmt)
- && TREE_CODE (lhs) == SSA_NAME
- && TREE_CODE (rhs1) == SSA_NAME
+ if (gimple_assign_ssa_name_copy_p (stmt)
&& gimple_can_coalesce_p (lhs, rhs1))
{
v1 = SSA_NAME_VERSION (lhs);
@@ -1347,7 +1344,11 @@ gimple_can_coalesce_p (tree name1, tree name2)
{
/* First check the SSA_NAME's associated DECL. We only want to
coalesce if they have the same DECL or both have no associated DECL. */
- if (SSA_NAME_VAR (name1) != SSA_NAME_VAR (name2))
+ tree var1 = SSA_NAME_VAR (name1);
+ tree var2 = SSA_NAME_VAR (name2);
+ var1 = (var1 && (!VAR_P (var1) || !DECL_IGNORED_P (var1))) ? var1 : NULL_TREE;
+ var2 = (var2 && (!VAR_P (var2) || !DECL_IGNORED_P (var2))) ? var2 : NULL_TREE;
+ if (var1 != var2)
return false;
/* Now check the types. If the types are the same, then we should
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 9bc455c61a7..5ab5389a7fa 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "function.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
#include "langhooks.h"
@@ -767,11 +767,19 @@ fini_copy_prop (void)
of the representative to the first solution we find if
it doesn't have one already. */
if (copy_of[i].value != var
- && TREE_CODE (copy_of[i].value) == SSA_NAME
- && POINTER_TYPE_P (TREE_TYPE (var))
- && SSA_NAME_PTR_INFO (var)
- && !SSA_NAME_PTR_INFO (copy_of[i].value))
- duplicate_ssa_name_ptr_info (copy_of[i].value, SSA_NAME_PTR_INFO (var));
+ && TREE_CODE (copy_of[i].value) == SSA_NAME)
+ {
+ if (POINTER_TYPE_P (TREE_TYPE (var))
+ && SSA_NAME_PTR_INFO (var)
+ && !SSA_NAME_PTR_INFO (copy_of[i].value))
+ duplicate_ssa_name_ptr_info (copy_of[i].value,
+ SSA_NAME_PTR_INFO (var));
+ else if (!POINTER_TYPE_P (TREE_TYPE (var))
+ && SSA_NAME_RANGE_INFO (var)
+ && !SSA_NAME_RANGE_INFO (copy_of[i].value))
+ duplicate_ssa_name_range_info (copy_of[i].value,
+ SSA_NAME_RANGE_INFO (var));
+ }
}
/* Don't do DCE if SCEV is initialized. It would destroy the scev cache. */
@@ -850,12 +858,12 @@ const pass_data pass_data_copy_prop =
class pass_copy_prop : public gimple_opt_pass
{
public:
- pass_copy_prop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_copy_prop, ctxt)
+ pass_copy_prop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_copy_prop, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_copy_prop (ctxt_); }
+ opt_pass * clone () { return new pass_copy_prop (m_ctxt); }
bool gate () { return gate_copy_prop (); }
unsigned int execute () { return execute_copy_prop (); }
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 990598ef29b..d8660c56e62 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "tree-pretty-print.h"
#include "bitmap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-inline.h"
#include "hashtab.h"
@@ -455,12 +455,12 @@ const pass_data pass_data_rename_ssa_copies =
class pass_rename_ssa_copies : public gimple_opt_pass
{
public:
- pass_rename_ssa_copies(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_rename_ssa_copies, ctxt)
+ pass_rename_ssa_copies (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_rename_ssa_copies, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_rename_ssa_copies (ctxt_); }
+ opt_pass * clone () { return new pass_rename_ssa_copies (m_ctxt); }
bool gate () { return gate_copyrename (); }
unsigned int execute () { return rename_ssa_copies (); }
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index ecc8c6f2264..c20a13a04c8 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -50,7 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple-pretty-print.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-pass.h"
#include "flags.h"
@@ -1560,12 +1560,12 @@ const pass_data pass_data_dce =
class pass_dce : public gimple_opt_pass
{
public:
- pass_dce(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_dce, ctxt)
+ pass_dce (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_dce, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_dce (ctxt_); }
+ opt_pass * clone () { return new pass_dce (m_ctxt); }
bool gate () { return gate_dce (); }
unsigned int execute () { return tree_ssa_dce (); }
@@ -1599,12 +1599,12 @@ const pass_data pass_data_dce_loop =
class pass_dce_loop : public gimple_opt_pass
{
public:
- pass_dce_loop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_dce_loop, ctxt)
+ pass_dce_loop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_dce_loop, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_dce_loop (ctxt_); }
+ opt_pass * clone () { return new pass_dce_loop (m_ctxt); }
bool gate () { return gate_dce (); }
unsigned int execute () { return tree_ssa_dce_loop (); }
@@ -1638,12 +1638,12 @@ const pass_data pass_data_cd_dce =
class pass_cd_dce : public gimple_opt_pass
{
public:
- pass_cd_dce(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_cd_dce, ctxt)
+ pass_cd_dce (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_cd_dce, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_cd_dce (ctxt_); }
+ opt_pass * clone () { return new pass_cd_dce (m_ctxt); }
bool gate () { return gate_dce (); }
unsigned int execute () { return tree_ssa_cd_dce (); }
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index f999a648e26..7013f43e6a6 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -30,10 +30,11 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "function.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "domwalk.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
+#include "tree-ssa-threadupdate.h"
#include "langhooks.h"
#include "params.h"
@@ -244,9 +245,6 @@ static void record_equivalences_from_phis (basic_block);
static void record_equivalences_from_incoming_edge (basic_block);
static void eliminate_redundant_computations (gimple_stmt_iterator *);
static void record_equivalences_from_stmt (gimple, int);
-static void dom_thread_across_edge (struct dom_walk_data *, edge);
-static void dom_opt_leave_block (struct dom_walk_data *, basic_block);
-static void dom_opt_enter_block (struct dom_walk_data *, basic_block);
static void remove_local_expressions_from_table (void);
static void restore_vars_to_original_value (void);
static edge single_incoming_edge_ignoring_loop_edges (basic_block);
@@ -773,6 +771,21 @@ free_all_edge_infos (void)
}
}
+class dom_opt_dom_walker : public dom_walker
+{
+public:
+ dom_opt_dom_walker (cdi_direction direction)
+ : dom_walker (direction), m_dummy_cond (NULL) {}
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+
+private:
+ void thread_across_edge (edge);
+
+ gimple m_dummy_cond;
+};
+
/* Jump threading, redundancy elimination and const/copy propagation.
This pass may expose new symbols that need to be renamed into SSA. For
@@ -782,8 +795,6 @@ free_all_edge_infos (void)
static unsigned int
tree_ssa_dominator_optimize (void)
{
- struct dom_walk_data walk_data;
-
memset (&opt_stats, 0, sizeof (opt_stats));
/* Create our hash tables. */
@@ -792,20 +803,6 @@ tree_ssa_dominator_optimize (void)
const_and_copies_stack.create (20);
need_eh_cleanup = BITMAP_ALLOC (NULL);
- /* Setup callbacks for the generic dominator tree walker. */
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = dom_opt_enter_block;
- walk_data.after_dom_children = dom_opt_leave_block;
- /* Right now we only attach a dummy COND_EXPR to the global data pointer.
- When we attach more stuff we'll need to fill this out with a real
- structure. */
- walk_data.global_data = NULL;
- walk_data.block_local_data_size = 0;
-
- /* Now initialize the dominator walker. */
- init_walk_dominator_tree (&walk_data);
-
calculate_dominance_info (CDI_DOMINATORS);
cfg_altered = false;
@@ -824,7 +821,7 @@ tree_ssa_dominator_optimize (void)
mark_dfs_back_edges ();
/* Recursively walk the dominator tree optimizing statements. */
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
+ dom_opt_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
{
gimple_stmt_iterator gsi;
@@ -897,9 +894,6 @@ tree_ssa_dominator_optimize (void)
/* Delete our main hashtable. */
avail_exprs.dispose ();
- /* And finalize the dominator walker. */
- fini_walk_dominator_tree (&walk_data);
-
/* Free asserted bitmaps and stacks. */
BITMAP_FREE (need_eh_cleanup);
@@ -941,12 +935,12 @@ const pass_data pass_data_dominator =
class pass_dominator : public gimple_opt_pass
{
public:
- pass_dominator(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_dominator, ctxt)
+ pass_dominator (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_dominator, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_dominator (ctxt_); }
+ opt_pass * clone () { return new pass_dominator (m_ctxt); }
bool gate () { return gate_dominator (); }
unsigned int execute () { return tree_ssa_dominator_optimize (); }
@@ -1077,25 +1071,69 @@ simplify_stmt_for_jump_threading (gimple stmt,
return lookup_avail_expr (stmt, false);
}
+/* Record into the equivalence tables any equivalences implied by
+ traversing edge E (which are cached in E->aux).
+
+ Callers are responsible for managing the unwinding markers. */
+static void
+record_temporary_equivalences (edge e)
+{
+ int i;
+ struct edge_info *edge_info = (struct edge_info *) e->aux;
+
+ /* If we have info associated with this edge, record it into
+ our equivalence tables. */
+ if (edge_info)
+ {
+ cond_equivalence *eq;
+ tree lhs = edge_info->lhs;
+ tree rhs = edge_info->rhs;
+
+ /* If we have a simple NAME = VALUE equivalence, record it. */
+ if (lhs && TREE_CODE (lhs) == SSA_NAME)
+ record_const_or_copy (lhs, rhs);
+
+ /* If we have 0 = COND or 1 = COND equivalences, record them
+ into our expression hash tables. */
+ for (i = 0; edge_info->cond_equivalences.iterate (i, &eq); ++i)
+ record_cond (eq);
+ }
+}
+
/* Wrapper for common code to attempt to thread an edge. For example,
it handles lazily building the dummy condition and the bookkeeping
when jump threading is successful. */
-static void
-dom_thread_across_edge (struct dom_walk_data *walk_data, edge e)
+void
+dom_opt_dom_walker::thread_across_edge (edge e)
{
- if (! walk_data->global_data)
- {
- gimple dummy_cond =
+ if (! m_dummy_cond)
+ m_dummy_cond =
gimple_build_cond (NE_EXPR,
integer_zero_node, integer_zero_node,
NULL, NULL);
- walk_data->global_data = dummy_cond;
- }
- thread_across_edge ((gimple) walk_data->global_data, e, false,
- &const_and_copies_stack,
- simplify_stmt_for_jump_threading);
+ /* Push a marker on both stacks so we can unwind the tables back to their
+ current state. */
+ avail_exprs_stack.safe_push (NULL);
+ const_and_copies_stack.safe_push (NULL_TREE);
+
+ /* Traversing E may result in equivalences we can utilize. */
+ record_temporary_equivalences (e);
+
+ /* With all the edge equivalences in the tables, go ahead and attempt
+ to thread through E->dest. */
+ ::thread_across_edge (m_dummy_cond, e, false,
+ &const_and_copies_stack,
+ simplify_stmt_for_jump_threading);
+
+ /* And restore the various tables to their state before
+ we threaded this edge.
+
+ XXX The code in tree-ssa-threadedge.c will restore the state of
+ the const_and_copies table. We we just have to restore the expression
+ table. */
+ remove_local_expressions_from_table ();
}
/* PHI nodes can create equivalences too.
@@ -1235,7 +1273,7 @@ record_equivalences_from_incoming_edge (basic_block bb)
/* If the conversion widens the original value and
the constant is in the range of the type of OLD_RHS,
- then convert the constant and record the equivalence.
+ then convert the constant and record the equivalence.
Note that int_fits_type_p does not check the precision
if the upper and lower bounds are OK. */
@@ -1650,7 +1688,7 @@ cprop_into_successor_phis (basic_block bb)
table back to its original state after processing this edge. */
const_and_copies_stack.safe_push (NULL_TREE);
- /* Extract and record any simple NAME = VALUE equivalences.
+ /* Extract and record any simple NAME = VALUE equivalences.
Don't bother with [01] = COND equivalences, they're not useful
here. */
@@ -1864,9 +1902,8 @@ record_edge_info (basic_block bb)
}
}
-static void
-dom_opt_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+dom_opt_dom_walker::before_dom_children (basic_block bb)
{
gimple_stmt_iterator gsi;
@@ -1903,8 +1940,8 @@ dom_opt_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
any finalization actions in preparation for leaving this node in
the dominator tree. */
-static void
-dom_opt_leave_block (struct dom_walk_data *walk_data, basic_block bb)
+void
+dom_opt_dom_walker::after_dom_children (basic_block bb)
{
gimple last;
@@ -1916,10 +1953,7 @@ dom_opt_leave_block (struct dom_walk_data *walk_data, basic_block bb)
&& (single_succ_edge (bb)->flags & EDGE_ABNORMAL) == 0
&& potentially_threadable_block (single_succ (bb)))
{
- /* Push a marker on the stack, which thread_across_edge expects
- and will remove. */
- const_and_copies_stack.safe_push (NULL_TREE);
- dom_thread_across_edge (walk_data, single_succ_edge (bb));
+ thread_across_edge (single_succ_edge (bb));
}
else if ((last = last_stmt (bb))
&& gimple_code (last) == GIMPLE_COND
@@ -1934,79 +1968,15 @@ dom_opt_leave_block (struct dom_walk_data *walk_data, basic_block bb)
/* Only try to thread the edge if it reaches a target block with
more than one predecessor and more than one successor. */
if (potentially_threadable_block (true_edge->dest))
- {
- struct edge_info *edge_info;
- unsigned int i;
-
- /* Push a marker onto the available expression stack so that we
- unwind any expressions related to the TRUE arm before processing
- the false arm below. */
- avail_exprs_stack.safe_push (NULL);
- const_and_copies_stack.safe_push (NULL_TREE);
-
- edge_info = (struct edge_info *) true_edge->aux;
-
- /* If we have info associated with this edge, record it into
- our equivalence tables. */
- if (edge_info)
- {
- cond_equivalence *eq;
- tree lhs = edge_info->lhs;
- tree rhs = edge_info->rhs;
-
- /* If we have a simple NAME = VALUE equivalence, record it. */
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- record_const_or_copy (lhs, rhs);
-
- /* If we have 0 = COND or 1 = COND equivalences, record them
- into our expression hash tables. */
- for (i = 0; edge_info->cond_equivalences.iterate (i, &eq); ++i)
- record_cond (eq);
- }
-
- dom_thread_across_edge (walk_data, true_edge);
-
- /* And restore the various tables to their state before
- we threaded this edge. */
- remove_local_expressions_from_table ();
- }
+ thread_across_edge (true_edge);
/* Similarly for the ELSE arm. */
if (potentially_threadable_block (false_edge->dest))
- {
- struct edge_info *edge_info;
- unsigned int i;
-
- const_and_copies_stack.safe_push (NULL_TREE);
- edge_info = (struct edge_info *) false_edge->aux;
+ thread_across_edge (false_edge);
- /* If we have info associated with this edge, record it into
- our equivalence tables. */
- if (edge_info)
- {
- cond_equivalence *eq;
- tree lhs = edge_info->lhs;
- tree rhs = edge_info->rhs;
-
- /* If we have a simple NAME = VALUE equivalence, record it. */
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- record_const_or_copy (lhs, rhs);
-
- /* If we have 0 = COND or 1 = COND equivalences, record them
- into our expression hash tables. */
- for (i = 0; edge_info->cond_equivalences.iterate (i, &eq); ++i)
- record_cond (eq);
- }
-
- /* Now thread the edge. */
- dom_thread_across_edge (walk_data, false_edge);
-
- /* No need to remove local expressions from our tables
- or restore vars to their original value as that will
- be done immediately below. */
- }
}
+ /* These remove expressions local to BB from the tables. */
remove_local_expressions_from_table ();
restore_vars_to_original_value ();
}
@@ -3158,12 +3128,12 @@ const pass_data pass_data_phi_only_cprop =
class pass_phi_only_cprop : public gimple_opt_pass
{
public:
- pass_phi_only_cprop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_phi_only_cprop, ctxt)
+ pass_phi_only_cprop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_phi_only_cprop, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_phi_only_cprop (ctxt_); }
+ opt_pass * clone () { return new pass_phi_only_cprop (m_ctxt); }
bool gate () { return gate_dominator (); }
unsigned int execute () { return eliminate_degenerate_phis (); }
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 65787582a28..700824cade8 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "domwalk.h"
#include "flags.h"
@@ -68,7 +68,6 @@ static bitmap need_eh_cleanup;
static bool gate_dse (void);
static unsigned int tree_ssa_dse (void);
-static void dse_enter_block (struct dom_walk_data *, basic_block);
/* A helper of dse_optimize_stmt.
@@ -292,9 +291,16 @@ dse_optimize_stmt (gimple_stmt_iterator *gsi)
}
}
-static void
-dse_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+class dse_dom_walker : public dom_walker
+{
+public:
+ dse_dom_walker (cdi_direction direction) : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+};
+
+void
+dse_dom_walker::before_dom_children (basic_block bb)
{
gimple_stmt_iterator gsi;
@@ -313,8 +319,6 @@ dse_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
static unsigned int
tree_ssa_dse (void)
{
- struct dom_walk_data walk_data;
-
need_eh_cleanup = BITMAP_ALLOC (NULL);
renumber_gimple_stmt_uids ();
@@ -328,22 +332,7 @@ tree_ssa_dse (void)
/* Dead store elimination is fundamentally a walk of the post-dominator
tree and a backwards walk of statements within each block. */
- walk_data.dom_direction = CDI_POST_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = dse_enter_block;
- walk_data.after_dom_children = NULL;
-
- walk_data.block_local_data_size = 0;
- walk_data.global_data = NULL;
-
- /* Initialize the dominator walker. */
- init_walk_dominator_tree (&walk_data);
-
- /* Recursively walk the dominator tree. */
- walk_dominator_tree (&walk_data, EXIT_BLOCK_PTR);
-
- /* Finalize the dominator walker. */
- fini_walk_dominator_tree (&walk_data);
+ dse_dom_walker (CDI_POST_DOMINATORS).walk (cfun->cfg->x_exit_block_ptr);
/* Removal of stores may make some EH edges dead. Purge such edges from
the CFG as needed. */
@@ -386,12 +375,12 @@ const pass_data pass_data_dse =
class pass_dse : public gimple_opt_pass
{
public:
- pass_dse(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_dse, ctxt)
+ pass_dse (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_dse, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_dse (ctxt_); }
+ opt_pass * clone () { return new pass_dse (m_ctxt); }
bool gate () { return gate_dse (); }
unsigned int execute () { return tree_ssa_dse (); }
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index c3e0fac0775..8807db16a1b 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "langhooks.h"
#include "flags.h"
@@ -786,9 +786,10 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
/* Now strip away any outer COMPONENT_REF/ARRAY_REF nodes from the LHS.
ADDR_EXPR will not appear on the LHS. */
- lhs = gimple_assign_lhs (use_stmt);
- while (handled_component_p (lhs))
- lhs = TREE_OPERAND (lhs, 0);
+ tree *lhsp = gimple_assign_lhs_ptr (use_stmt);
+ while (handled_component_p (*lhsp))
+ lhsp = &TREE_OPERAND (*lhsp, 0);
+ lhs = *lhsp;
/* Now see if the LHS node is a MEM_REF using NAME. If so,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
@@ -822,11 +823,13 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
/* If the LHS is a plain dereference and the value type is the same as
that of the pointed-to type of the address we can put the
dereferenced address on the LHS preserving the original alias-type. */
- else if (gimple_assign_lhs (use_stmt) == lhs
- && integer_zerop (TREE_OPERAND (lhs, 1))
- && useless_type_conversion_p
- (TREE_TYPE (TREE_OPERAND (def_rhs, 0)),
- TREE_TYPE (gimple_assign_rhs1 (use_stmt)))
+ else if (integer_zerop (TREE_OPERAND (lhs, 1))
+ && ((gimple_assign_lhs (use_stmt) == lhs
+ && useless_type_conversion_p
+ (TREE_TYPE (TREE_OPERAND (def_rhs, 0)),
+ TREE_TYPE (gimple_assign_rhs1 (use_stmt))))
+ || types_compatible_p (TREE_TYPE (lhs),
+ TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
/* Don't forward anything into clobber stmts if it would result
in the lhs no longer being a MEM_REF. */
&& (!gimple_clobber_p (use_stmt)
@@ -854,7 +857,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
TREE_SIDE_EFFECTS (*def_rhs_basep) = TREE_SIDE_EFFECTS (lhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (lhs);
new_lhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
- gimple_assign_set_lhs (use_stmt, new_lhs);
+ *lhsp = new_lhs;
TREE_THIS_VOLATILE (new_lhs) = TREE_THIS_VOLATILE (lhs);
TREE_SIDE_EFFECTS (new_lhs) = TREE_SIDE_EFFECTS (lhs);
*def_rhs_basep = saved;
@@ -873,11 +876,12 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
/* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
nodes from the RHS. */
- rhs = gimple_assign_rhs1 (use_stmt);
- if (TREE_CODE (rhs) == ADDR_EXPR)
- rhs = TREE_OPERAND (rhs, 0);
- while (handled_component_p (rhs))
- rhs = TREE_OPERAND (rhs, 0);
+ tree *rhsp = gimple_assign_rhs1_ptr (use_stmt);
+ if (TREE_CODE (*rhsp) == ADDR_EXPR)
+ rhsp = &TREE_OPERAND (*rhsp, 0);
+ while (handled_component_p (*rhsp))
+ rhsp = &TREE_OPERAND (*rhsp, 0);
+ rhs = *rhsp;
/* Now see if the RHS node is a MEM_REF using NAME. If so,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
@@ -909,11 +913,13 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
/* If the RHS is a plain dereference and the value type is the same as
that of the pointed-to type of the address we can put the
dereferenced address on the RHS preserving the original alias-type. */
- else if (gimple_assign_rhs1 (use_stmt) == rhs
- && integer_zerop (TREE_OPERAND (rhs, 1))
- && useless_type_conversion_p
- (TREE_TYPE (gimple_assign_lhs (use_stmt)),
- TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
+ else if (integer_zerop (TREE_OPERAND (rhs, 1))
+ && ((gimple_assign_rhs1 (use_stmt) == rhs
+ && useless_type_conversion_p
+ (TREE_TYPE (gimple_assign_lhs (use_stmt)),
+ TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
+ || types_compatible_p (TREE_TYPE (rhs),
+ TREE_TYPE (TREE_OPERAND (def_rhs, 0)))))
{
tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
tree new_offset, new_base, saved, new_rhs;
@@ -937,7 +943,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
TREE_SIDE_EFFECTS (*def_rhs_basep) = TREE_SIDE_EFFECTS (rhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (rhs);
new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
- gimple_assign_set_rhs1 (use_stmt, new_rhs);
+ *rhsp = new_rhs;
TREE_THIS_VOLATILE (new_rhs) = TREE_THIS_VOLATILE (rhs);
TREE_SIDE_EFFECTS (new_rhs) = TREE_SIDE_EFFECTS (rhs);
*def_rhs_basep = saved;
@@ -995,7 +1001,6 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
static bool
forward_propagate_addr_expr (tree name, tree rhs)
{
- int stmt_loop_depth = bb_loop_depth (gimple_bb (SSA_NAME_DEF_STMT (name)));
imm_use_iterator iter;
gimple use_stmt;
bool all = true;
@@ -1008,37 +1013,24 @@ forward_propagate_addr_expr (tree name, tree rhs)
/* If the use is not in a simple assignment statement, then
there is nothing we can do. */
- if (gimple_code (use_stmt) != GIMPLE_ASSIGN)
+ if (!is_gimple_assign (use_stmt))
{
if (!is_gimple_debug (use_stmt))
all = false;
continue;
}
- /* If the use is in a deeper loop nest, then we do not want
- to propagate non-invariant ADDR_EXPRs into the loop as that
- is likely adding expression evaluations into the loop. */
- if (bb_loop_depth (gimple_bb (use_stmt)) > stmt_loop_depth
- && !is_gimple_min_invariant (rhs))
+ gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
+ single_use_p);
+ /* If the use has moved to a different statement adjust
+ the update machinery for the old statement too. */
+ if (use_stmt != gsi_stmt (gsi))
{
- all = false;
- continue;
+ update_stmt (use_stmt);
+ use_stmt = gsi_stmt (gsi);
}
-
- {
- gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
- result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
- single_use_p);
- /* If the use has moved to a different statement adjust
- the update machinery for the old statement too. */
- if (use_stmt != gsi_stmt (gsi))
- {
- update_stmt (use_stmt);
- use_stmt = gsi_stmt (gsi);
- }
-
- update_stmt (use_stmt);
- }
+ update_stmt (use_stmt);
all &= result;
/* Remove intermediate now unused copy and conversion chains. */
@@ -3185,9 +3177,9 @@ simplify_permutation (gimple_stmt_iterator *gsi)
return 0;
arg1 = arg0;
}
- opt = fold_ternary (VEC_PERM_EXPR, TREE_TYPE(op0), arg0, arg1, op2);
+ opt = fold_ternary (VEC_PERM_EXPR, TREE_TYPE (op0), arg0, arg1, op2);
if (!opt
- || (TREE_CODE (opt) != CONSTRUCTOR && TREE_CODE(opt) != VECTOR_CST))
+ || (TREE_CODE (opt) != CONSTRUCTOR && TREE_CODE (opt) != VECTOR_CST))
return 0;
gimple_assign_set_rhs_from_tree (gsi, opt);
update_stmt (gsi_stmt (*gsi));
@@ -3568,12 +3560,12 @@ const pass_data pass_data_forwprop =
class pass_forwprop : public gimple_opt_pass
{
public:
- pass_forwprop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_forwprop, ctxt)
+ pass_forwprop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_forwprop, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_forwprop (ctxt_); }
+ opt_pass * clone () { return new pass_forwprop (m_ctxt); }
bool gate () { return gate_forwprop (); }
unsigned int execute () { return ssa_forward_propagate_and_combine (); }
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c
index 984a7634ef6..2a7745194e3 100644
--- a/gcc/tree-ssa-ifcombine.c
+++ b/gcc/tree-ssa-ifcombine.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "basic-block.h"
#include "tree-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
/* This pass combines COND_EXPRs to simplify control flow. It
@@ -668,8 +668,8 @@ const pass_data pass_data_tree_ifcombine =
class pass_tree_ifcombine : public gimple_opt_pass
{
public:
- pass_tree_ifcombine(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tree_ifcombine, ctxt)
+ pass_tree_ifcombine (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tree_ifcombine, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index a624d0055c2..7705f1312b8 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple-pretty-print.h"
#include "bitmap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "timevar.h"
#include "dumpfile.h"
#include "tree-ssa-live.h"
@@ -104,7 +104,9 @@ var_map_base_init (var_map map)
struct tree_int_map **slot;
unsigned baseindex;
var = partition_to_var (map, x);
- if (SSA_NAME_VAR (var))
+ if (SSA_NAME_VAR (var)
+ && (!VAR_P (SSA_NAME_VAR (var))
+ || !DECL_IGNORED_P (SSA_NAME_VAR (var))))
m->base.from = SSA_NAME_VAR (var);
else
/* This restricts what anonymous SSA names we can coalesce
@@ -990,9 +992,10 @@ loe_visit_block (tree_live_info_p live, basic_block bb, sbitmap visited,
edge_iterator ei;
basic_block pred_bb;
bitmap loe;
- gcc_assert (!bitmap_bit_p (visited, bb->index));
+ gcc_checking_assert (!bitmap_bit_p (visited, bb->index));
bitmap_set_bit (visited, bb->index);
+
loe = live_on_entry (live, bb);
FOR_EACH_EDGE (e, ei, bb->preds)
@@ -1234,7 +1237,7 @@ dump_var_map (FILE *f, var_map map)
{
if (t++ == 0)
{
- fprintf(f, "Partition %d (", x);
+ fprintf (f, "Partition %d (", x);
print_generic_expr (f, partition_to_var (map, p), TDF_SLIM);
fprintf (f, " - ");
}
diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h
index 8fd1e80d549..542f6a1944e 100644
--- a/gcc/tree-ssa-live.h
+++ b/gcc/tree-ssa-live.h
@@ -325,10 +325,4 @@ make_live_on_entry (tree_live_info_p live, basic_block bb , int p)
/* From tree-ssa-coalesce.c */
extern var_map coalesce_ssa_name (void);
-
-/* From tree-ssa-ter.c */
-extern bitmap find_replaceable_exprs (var_map);
-extern void dump_replaceable_exprs (FILE *, bitmap);
-
-
#endif /* _TREE_SSA_LIVE_H */
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index f500761c9c2..faa6bbcc585 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "tree-inline.h"
@@ -277,8 +277,8 @@ const pass_data pass_data_ch =
class pass_ch : public gimple_opt_pass
{
public:
- pass_ch(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_ch, ctxt)
+ pass_ch (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_ch, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index e5e502b2901..fc255289f24 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "domwalk.h"
#include "params.h"
@@ -227,7 +227,7 @@ get_lim_data (gimple stmt)
static void
free_lim_aux_data (struct lim_aux_data *data)
{
- data->depends.release();
+ data->depends.release ();
free (data);
}
@@ -1040,14 +1040,25 @@ rewrite_bittest (gimple_stmt_iterator *bsi)
return stmt;
}
+/* For each statement determines the outermost loop in that it is invariant,
+ - statements on whose motion it depends and the cost of the computation.
+ - This information is stored to the LIM_DATA structure associated with
+ - each statement. */
+class invariantness_dom_walker : public dom_walker
+{
+public:
+ invariantness_dom_walker (cdi_direction direction)
+ : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+};
/* Determine the outermost loops in that statements in basic block BB are
invariant, and record them to the LIM_DATA associated with the statements.
- Callback for walk_dominator_tree. */
+ Callback for dom_walker. */
-static void
-determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+invariantness_dom_walker::before_dom_children (basic_block bb)
{
enum move_pos pos;
gimple_stmt_iterator bsi;
@@ -1177,32 +1188,23 @@ determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED,
}
}
-/* For each statement determines the outermost loop in that it is invariant,
- statements on whose motion it depends and the cost of the computation.
- This information is stored to the LIM_DATA structure associated with
- each statement. */
-
-static void
-determine_invariantness (void)
+class move_computations_dom_walker : public dom_walker
{
- struct dom_walk_data walk_data;
+public:
+ move_computations_dom_walker (cdi_direction direction)
+ : dom_walker (direction), todo_ (0) {}
- memset (&walk_data, 0, sizeof (struct dom_walk_data));
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.before_dom_children = determine_invariantness_stmt;
+ virtual void before_dom_children (basic_block);
- init_walk_dominator_tree (&walk_data);
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
- fini_walk_dominator_tree (&walk_data);
-}
+ unsigned int todo_;
+};
/* Hoist the statements in basic block BB out of the loops prescribed by
data stored in LIM_DATA structures associated with each statement. Callback
for walk_dominator_tree. */
-static void
-move_computations_stmt (struct dom_walk_data *dw_data,
- basic_block bb)
+void
+move_computations_dom_walker::before_dom_children (basic_block bb)
{
struct loop *level;
gimple_stmt_iterator bsi;
@@ -1266,7 +1268,7 @@ move_computations_stmt (struct dom_walk_data *dw_data,
gimple_phi_result (stmt),
t, arg0, arg1);
SSA_NAME_DEF_STMT (gimple_phi_result (stmt)) = new_stmt;
- *((unsigned int *)(dw_data->global_data)) |= TODO_cleanup_cfg;
+ todo_ |= TODO_cleanup_cfg;
}
gsi_insert_on_edge (loop_preheader_edge (level), new_stmt);
remove_phi_node (&bsi, false);
@@ -1337,23 +1339,14 @@ move_computations_stmt (struct dom_walk_data *dw_data,
static unsigned int
move_computations (void)
{
- struct dom_walk_data walk_data;
- unsigned int todo = 0;
-
- memset (&walk_data, 0, sizeof (struct dom_walk_data));
- walk_data.global_data = &todo;
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.before_dom_children = move_computations_stmt;
-
- init_walk_dominator_tree (&walk_data);
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
- fini_walk_dominator_tree (&walk_data);
+ move_computations_dom_walker walker (CDI_DOMINATORS);
+ walker.walk (cfun->cfg->x_entry_block_ptr);
gsi_commit_edge_inserts ();
if (need_ssa_update_p (cfun))
rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa);
- return todo;
+ return walker.todo_;
}
/* Checks whether the statement defining variable *INDEX can be hoisted
@@ -1702,12 +1695,12 @@ for_all_locs_in_loop (struct loop *loop, mem_ref_p ref, FN fn)
struct rewrite_mem_ref_loc
{
rewrite_mem_ref_loc (tree tmp_var_) : tmp_var (tmp_var_) {}
- bool operator()(mem_ref_loc_p loc);
+ bool operator () (mem_ref_loc_p loc);
tree tmp_var;
};
bool
-rewrite_mem_ref_loc::operator()(mem_ref_loc_p loc)
+rewrite_mem_ref_loc::operator () (mem_ref_loc_p loc)
{
*loc->ref = tmp_var;
update_stmt (loc->stmt);
@@ -1727,12 +1720,12 @@ rewrite_mem_refs (struct loop *loop, mem_ref_p ref, tree tmp_var)
struct first_mem_ref_loc_1
{
first_mem_ref_loc_1 (mem_ref_loc_p *locp_) : locp (locp_) {}
- bool operator()(mem_ref_loc_p loc);
+ bool operator () (mem_ref_loc_p loc);
mem_ref_loc_p *locp;
};
bool
-first_mem_ref_loc_1::operator()(mem_ref_loc_p loc)
+first_mem_ref_loc_1::operator () (mem_ref_loc_p loc)
{
*locp = loc;
return true;
@@ -2008,12 +2001,12 @@ execute_sm_if_changed (edge ex, tree mem, tree tmp_var, tree flag)
struct sm_set_flag_if_changed
{
sm_set_flag_if_changed (tree flag_) : flag (flag_) {}
- bool operator()(mem_ref_loc_p loc);
+ bool operator () (mem_ref_loc_p loc);
tree flag;
};
bool
-sm_set_flag_if_changed::operator()(mem_ref_loc_p loc)
+sm_set_flag_if_changed::operator () (mem_ref_loc_p loc)
{
/* Only set the flag for writes. */
if (is_gimple_assign (loc->stmt)
@@ -2137,14 +2130,14 @@ struct ref_always_accessed
{
ref_always_accessed (struct loop *loop_, tree base_, bool stored_p_)
: loop (loop_), base (base_), stored_p (stored_p_) {}
- bool operator()(mem_ref_loc_p loc);
+ bool operator () (mem_ref_loc_p loc);
struct loop *loop;
tree base;
bool stored_p;
};
bool
-ref_always_accessed::operator()(mem_ref_loc_p loc)
+ref_always_accessed::operator () (mem_ref_loc_p loc)
{
struct loop *must_exec;
@@ -2632,7 +2625,8 @@ tree_ssa_lim (void)
/* For each statement determine the outermost loop in that it is
invariant and cost for computing the invariant. */
- determine_invariantness ();
+ invariantness_dom_walker (CDI_DOMINATORS)
+ .walk (cfun->cfg->x_entry_block_ptr);
/* Execute store motion. Force the necessary invariants to be moved
out of the loops as well. */
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index f2acc4c15f1..d5249baeab0 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-pass.h"
#include "tree-chrec.h"
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index c45f3167f2f..7b684a62819 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -69,7 +69,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-pass.h"
#include "ggc.h"
@@ -3920,7 +3920,7 @@ get_loop_invariant_expr_id (struct ivopts_data *data, tree ubase,
if (ratio == 1)
{
- if(operand_equal_p (ubase, cbase, 0))
+ if (operand_equal_p (ubase, cbase, 0))
return -1;
if (TREE_CODE (ubase) == ADDR_EXPR
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index edc5b7b5fdd..e44458e4a0f 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "gimple-pretty-print.h"
#include "cfgloop.h"
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 9d6f9efb089..adbfe8e8c21 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "intl.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "cfgloop.h"
#include "ggc.h"
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 4d313040fad..d75155d15d6 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "tree-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-pass.h"
#include "insn-config.h"
@@ -555,7 +555,7 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
fprintf (dump_file, "Memory expression %p\n",(void *) ref );
print_generic_expr (dump_file, ref, TDF_TREE);
fprintf (dump_file,":");
- dump_mem_details( dump_file, base, step, delta, write_p);
+ dump_mem_details (dump_file, base, step, delta, write_p);
fprintf (dump_file,
"Ignoring %p, non-constant step prefetching is "
"limited to inner most loops \n",
@@ -572,7 +572,7 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs,
fprintf (dump_file, "Memory expression %p\n",(void *) ref );
print_generic_expr (dump_file, ref, TDF_TREE);
fprintf (dump_file,":");
- dump_mem_details(dump_file, base, step, delta, write_p);
+ dump_mem_details (dump_file, base, step, delta, write_p);
fprintf (dump_file,
"Not prefetching, ignoring %p due to "
"loop variant step\n",
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 5c32b564d4d..6ce06c1326c 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "params.h"
#include "tree-pass.h"
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 8bcfd060e60..3952029d0ea 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm_p.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "flags.h"
@@ -61,8 +61,8 @@ const pass_data pass_data_tree_loop =
class pass_tree_loop : public gimple_opt_pass
{
public:
- pass_tree_loop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tree_loop, ctxt)
+ pass_tree_loop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tree_loop, ctxt)
{}
/* opt_pass methods: */
@@ -117,8 +117,8 @@ const pass_data pass_data_tree_loop_init =
class pass_tree_loop_init : public gimple_opt_pass
{
public:
- pass_tree_loop_init(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tree_loop_init, ctxt)
+ pass_tree_loop_init (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tree_loop_init, ctxt)
{}
/* opt_pass methods: */
@@ -171,12 +171,12 @@ const pass_data pass_data_lim =
class pass_lim : public gimple_opt_pass
{
public:
- pass_lim(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lim, ctxt)
+ pass_lim (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lim, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_lim (ctxt_); }
+ opt_pass * clone () { return new pass_lim (m_ctxt); }
bool gate () { return gate_tree_ssa_loop_im (); }
unsigned int execute () { return tree_ssa_loop_im (); }
@@ -227,8 +227,8 @@ const pass_data pass_data_tree_unswitch =
class pass_tree_unswitch : public gimple_opt_pass
{
public:
- pass_tree_unswitch(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tree_unswitch, ctxt)
+ pass_tree_unswitch (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tree_unswitch, ctxt)
{}
/* opt_pass methods: */
@@ -282,8 +282,8 @@ const pass_data pass_data_predcom =
class pass_predcom : public gimple_opt_pass
{
public:
- pass_predcom(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_predcom, ctxt)
+ pass_predcom (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_predcom, ctxt)
{}
/* opt_pass methods: */
@@ -303,7 +303,7 @@ make_pass_predcom (gcc::context *ctxt)
/* Loop autovectorization. */
static unsigned int
-tree_vectorize (void)
+tree_loop_vectorize (void)
{
if (number_of_loops (cfun) <= 1)
return 0;
@@ -312,9 +312,9 @@ tree_vectorize (void)
}
static bool
-gate_tree_vectorize (void)
+gate_tree_loop_vectorize (void)
{
- return flag_tree_vectorize || cfun->has_force_vect_loops;
+ return flag_tree_loop_vectorize || cfun->has_force_vect_loops;
}
namespace {
@@ -337,13 +337,13 @@ const pass_data pass_data_vectorize =
class pass_vectorize : public gimple_opt_pass
{
public:
- pass_vectorize(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_vectorize, ctxt)
+ pass_vectorize (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_vectorize, ctxt)
{}
/* opt_pass methods: */
- bool gate () { return gate_tree_vectorize (); }
- unsigned int execute () { return tree_vectorize (); }
+ bool gate () { return gate_tree_loop_vectorize (); }
+ unsigned int execute () { return tree_loop_vectorize (); }
}; // class pass_vectorize
@@ -404,8 +404,8 @@ const pass_data pass_data_graphite =
class pass_graphite : public gimple_opt_pass
{
public:
- pass_graphite(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_graphite, ctxt)
+ pass_graphite (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_graphite, ctxt)
{}
/* opt_pass methods: */
@@ -441,8 +441,8 @@ const pass_data pass_data_graphite_transforms =
class pass_graphite_transforms : public gimple_opt_pass
{
public:
- pass_graphite_transforms(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_graphite_transforms, ctxt)
+ pass_graphite_transforms (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_graphite_transforms, ctxt)
{}
/* opt_pass methods: */
@@ -497,8 +497,8 @@ const pass_data pass_data_check_data_deps =
class pass_check_data_deps : public gimple_opt_pass
{
public:
- pass_check_data_deps(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_check_data_deps, ctxt)
+ pass_check_data_deps (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_check_data_deps, ctxt)
{}
/* opt_pass methods: */
@@ -552,8 +552,8 @@ const pass_data pass_data_iv_canon =
class pass_iv_canon : public gimple_opt_pass
{
public:
- pass_iv_canon(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_iv_canon, ctxt)
+ pass_iv_canon (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_iv_canon, ctxt)
{}
/* opt_pass methods: */
@@ -599,8 +599,8 @@ const pass_data pass_data_scev_cprop =
class pass_scev_cprop : public gimple_opt_pass
{
public:
- pass_scev_cprop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_scev_cprop, ctxt)
+ pass_scev_cprop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_scev_cprop, ctxt)
{}
/* opt_pass methods: */
@@ -650,8 +650,8 @@ const pass_data pass_data_record_bounds =
class pass_record_bounds : public gimple_opt_pass
{
public:
- pass_record_bounds(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_record_bounds, ctxt)
+ pass_record_bounds (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_record_bounds, ctxt)
{}
/* opt_pass methods: */
@@ -706,8 +706,8 @@ const pass_data pass_data_complete_unroll =
class pass_complete_unroll : public gimple_opt_pass
{
public:
- pass_complete_unroll(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_complete_unroll, ctxt)
+ pass_complete_unroll (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_complete_unroll, ctxt)
{}
/* opt_pass methods: */
@@ -771,8 +771,8 @@ const pass_data pass_data_complete_unrolli =
class pass_complete_unrolli : public gimple_opt_pass
{
public:
- pass_complete_unrolli(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_complete_unrolli, ctxt)
+ pass_complete_unrolli (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_complete_unrolli, ctxt)
{}
/* opt_pass methods: */
@@ -828,8 +828,8 @@ const pass_data pass_data_parallelize_loops =
class pass_parallelize_loops : public gimple_opt_pass
{
public:
- pass_parallelize_loops(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_parallelize_loops, ctxt)
+ pass_parallelize_loops (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_parallelize_loops, ctxt)
{}
/* opt_pass methods: */
@@ -883,8 +883,8 @@ const pass_data pass_data_loop_prefetch =
class pass_loop_prefetch : public gimple_opt_pass
{
public:
- pass_loop_prefetch(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_loop_prefetch, ctxt)
+ pass_loop_prefetch (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_loop_prefetch, ctxt)
{}
/* opt_pass methods: */
@@ -939,8 +939,8 @@ const pass_data pass_data_iv_optimize =
class pass_iv_optimize : public gimple_opt_pass
{
public:
- pass_iv_optimize(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_iv_optimize, ctxt)
+ pass_iv_optimize (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_iv_optimize, ctxt)
{}
/* opt_pass methods: */
@@ -988,8 +988,8 @@ const pass_data pass_data_tree_loop_done =
class pass_tree_loop_done : public gimple_opt_pass
{
public:
- pass_tree_loop_done(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tree_loop_done, ctxt)
+ pass_tree_loop_done (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tree_loop_done, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index f871e928a19..f7f8ec91fce 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -90,7 +90,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm.h"
#include "flags.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "alloc-pool.h"
#include "basic-block.h"
@@ -608,7 +608,7 @@ execute_cse_reciprocals (void)
if (fail)
continue;
- gimple_replace_lhs (stmt1, arg1);
+ gimple_replace_ssa_lhs (stmt1, arg1);
gimple_call_set_fndecl (stmt1, fndecl);
update_stmt (stmt1);
reciprocal_stats.rfuncs_inserted++;
@@ -657,8 +657,8 @@ const pass_data pass_data_cse_reciprocals =
class pass_cse_reciprocals : public gimple_opt_pass
{
public:
- pass_cse_reciprocals(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_cse_reciprocals, ctxt)
+ pass_cse_reciprocals (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_cse_reciprocals, ctxt)
{}
/* opt_pass methods: */
@@ -1575,8 +1575,8 @@ const pass_data pass_data_cse_sincos =
class pass_cse_sincos : public gimple_opt_pass
{
public:
- pass_cse_sincos(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_cse_sincos, ctxt)
+ pass_cse_sincos (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_cse_sincos, ctxt)
{}
/* opt_pass methods: */
@@ -2065,8 +2065,8 @@ const pass_data pass_data_optimize_bswap =
class pass_optimize_bswap : public gimple_opt_pass
{
public:
- pass_optimize_bswap(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_optimize_bswap, ctxt)
+ pass_optimize_bswap (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_optimize_bswap, ctxt)
{}
/* opt_pass methods: */
@@ -2871,8 +2871,8 @@ const pass_data pass_data_optimize_widening_mul =
class pass_optimize_widening_mul : public gimple_opt_pass
{
public:
- pass_optimize_widening_mul(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_optimize_widening_mul, ctxt)
+ pass_optimize_widening_mul (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_optimize_widening_mul, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 0915080c71c..6bb36729617 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "function.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "timevar.h"
#include "dumpfile.h"
@@ -1203,7 +1203,7 @@ verify_imm_links (FILE *f, tree var)
fprintf (f, " IMM ERROR : (use_p : tree - %p:%p)", (void *)ptr,
(void *)ptr->use);
print_generic_expr (f, USE_FROM_PTR (ptr), TDF_SLIM);
- fprintf(f, "\n");
+ fprintf (f, "\n");
return true;
}
@@ -1238,7 +1238,7 @@ dump_immediate_uses_for (FILE *file, tree var)
else
print_gimple_stmt (file, USE_STMT (use_p), 0, TDF_SLIM);
}
- fprintf(file, "\n");
+ fprintf (file, "\n");
}
@@ -1253,7 +1253,7 @@ dump_immediate_uses (FILE *file)
fprintf (file, "Immediate_uses: \n\n");
for (x = 1; x < num_ssa_names; x++)
{
- var = ssa_name(x);
+ var = ssa_name (x);
if (!var)
continue;
dump_immediate_uses_for (file, var);
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index ddcd040ba7c..c39419f0716 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "tm_p.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "langhooks.h"
#include "pointer-set.h"
@@ -1264,9 +1264,6 @@ struct ssa_names_hasher : typed_free_remove <name_to_bb>
Hash entries with phase < nt_call_phase are invalid. */
static unsigned int nt_call_phase;
-/* The set of MEM_REFs which can't trap. */
-static struct pointer_set_t *nontrap_set;
-
/* The hash function. */
inline hashval_t
@@ -1378,9 +1375,22 @@ nonfreeing_call_p (gimple call)
return false;
}
+class nontrapping_dom_walker : public dom_walker
+{
+public:
+ nontrapping_dom_walker (cdi_direction direction, pointer_set_t *ps)
+ : dom_walker (direction), m_nontrapping (ps) {}
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+
+private:
+ pointer_set_t *m_nontrapping;
+};
+
/* Called by walk_dominator_tree, when entering the block BB. */
-static void
-nt_init_block (struct dom_walk_data *data ATTRIBUTE_UNUSED, basic_block bb)
+void
+nontrapping_dom_walker::before_dom_children (basic_block bb)
{
edge e;
edge_iterator ei;
@@ -1406,15 +1416,15 @@ nt_init_block (struct dom_walk_data *data ATTRIBUTE_UNUSED, basic_block bb)
nt_call_phase++;
else if (gimple_assign_single_p (stmt) && !gimple_has_volatile_ops (stmt))
{
- add_or_mark_expr (bb, gimple_assign_lhs (stmt), nontrap_set, true);
- add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), nontrap_set, false);
+ add_or_mark_expr (bb, gimple_assign_lhs (stmt), m_nontrapping, true);
+ add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), m_nontrapping, false);
}
}
}
/* Called by walk_dominator_tree, when basic block BB is exited. */
-static void
-nt_fini_block (struct dom_walk_data *data ATTRIBUTE_UNUSED, basic_block bb)
+void
+nontrapping_dom_walker::after_dom_children (basic_block bb)
{
/* This BB isn't on the path to dominator root anymore. */
bb->aux = (void*)2;
@@ -1427,28 +1437,16 @@ nt_fini_block (struct dom_walk_data *data ATTRIBUTE_UNUSED, basic_block bb)
static struct pointer_set_t *
get_non_trapping (void)
{
- struct pointer_set_t *nontrap;
- struct dom_walk_data walk_data;
-
nt_call_phase = 0;
- nontrap = pointer_set_create ();
+ pointer_set_t *nontrap = pointer_set_create ();
seen_ssa_names.create (128);
/* We're going to do a dominator walk, so ensure that we have
dominance information. */
calculate_dominance_info (CDI_DOMINATORS);
- /* Setup callbacks for the generic dominator tree walker. */
- nontrap_set = nontrap;
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = nt_init_block;
- walk_data.after_dom_children = nt_fini_block;
- walk_data.global_data = NULL;
- walk_data.block_local_data_size = 0;
-
- init_walk_dominator_tree (&walk_data);
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
- fini_walk_dominator_tree (&walk_data);
+ nontrapping_dom_walker (CDI_DOMINATORS, nontrap)
+ .walk (cfun->cfg->x_entry_block_ptr);
+
seen_ssa_names.dispose ();
clear_aux_for_blocks ();
@@ -2036,12 +2034,12 @@ const pass_data pass_data_phiopt =
class pass_phiopt : public gimple_opt_pass
{
public:
- pass_phiopt(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_phiopt, ctxt)
+ pass_phiopt (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_phiopt, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_phiopt (ctxt_); }
+ opt_pass * clone () { return new pass_phiopt (m_ctxt); }
bool gate () { return gate_phiopt (); }
unsigned int execute () { return tree_ssa_phiopt (); }
@@ -2082,8 +2080,8 @@ const pass_data pass_data_cselim =
class pass_cselim : public gimple_opt_pass
{
public:
- pass_cselim(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_cselim, ctxt)
+ pass_cselim (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_cselim, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 1257334f51b..f3ea552795d 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "langhooks.h"
#include "flags.h"
@@ -414,8 +414,8 @@ const pass_data pass_data_phiprop =
class pass_phiprop : public gimple_opt_pass
{
public:
- pass_phiprop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_phiprop, ctxt)
+ pass_phiprop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_phiprop, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 56b05734e16..bd13476d31d 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "tree-inline.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "hash-table.h"
#include "tree-iterator.h"
@@ -360,10 +360,10 @@ typedef struct bitmap_set
} *bitmap_set_t;
#define FOR_EACH_EXPR_ID_IN_SET(set, id, bi) \
- EXECUTE_IF_SET_IN_BITMAP(&(set)->expressions, 0, (id), (bi))
+ EXECUTE_IF_SET_IN_BITMAP (&(set)->expressions, 0, (id), (bi))
#define FOR_EACH_VALUE_ID_IN_SET(set, id, bi) \
- EXECUTE_IF_SET_IN_BITMAP(&(set)->values, 0, (id), (bi))
+ EXECUTE_IF_SET_IN_BITMAP (&(set)->values, 0, (id), (bi))
/* Mapping from value id to expressions with that value_id. */
static vec<bitmap> value_expressions;
@@ -525,46 +525,31 @@ expr_pred_trans_d::equal (const value_type *ve1,
expression and predecessor. */
static hash_table <expr_pred_trans_d> phi_translate_table;
-/* Search in the phi translation table for the translation of
- expression E in basic block PRED.
- Return the translated value, if found, NULL otherwise. */
-
-static inline pre_expr
-phi_trans_lookup (pre_expr e, basic_block pred)
-{
- expr_pred_trans_t *slot;
- struct expr_pred_trans_d ept;
-
- ept.e = e;
- ept.pred = pred;
- ept.hashcode = iterative_hash_hashval_t (pre_expr_d::hash (e), pred->index);
- slot = phi_translate_table.find_slot_with_hash (&ept, ept.hashcode,
- NO_INSERT);
- if (!slot)
- return NULL;
- else
- return (*slot)->v;
-}
-
-
/* Add the tuple mapping from {expression E, basic block PRED} to
- value V, to the phi translation table. */
+ the phi translation table and return whether it pre-existed. */
-static inline void
-phi_trans_add (pre_expr e, pre_expr v, basic_block pred)
+static inline bool
+phi_trans_add (expr_pred_trans_t *entry, pre_expr e, basic_block pred)
{
expr_pred_trans_t *slot;
- expr_pred_trans_t new_pair = XNEW (struct expr_pred_trans_d);
- new_pair->e = e;
- new_pair->pred = pred;
- new_pair->v = v;
- new_pair->hashcode = iterative_hash_hashval_t (pre_expr_d::hash (e),
- pred->index);
-
- slot = phi_translate_table.find_slot_with_hash (new_pair,
- new_pair->hashcode, INSERT);
- free (*slot);
- *slot = new_pair;
+ expr_pred_trans_d tem;
+ hashval_t hash = iterative_hash_hashval_t (pre_expr_d::hash (e),
+ pred->index);
+ tem.e = e;
+ tem.pred = pred;
+ tem.hashcode = hash;
+ slot = phi_translate_table.find_slot_with_hash (&tem, hash, INSERT);
+ if (*slot)
+ {
+ *entry = *slot;
+ return true;
+ }
+
+ *entry = *slot = XNEW (struct expr_pred_trans_d);
+ (*entry)->e = e;
+ (*entry)->pred = pred;
+ (*entry)->hashcode = hash;
+ return false;
}
@@ -1359,7 +1344,7 @@ get_expr_type (const pre_expr e)
case NARY:
return PRE_EXPR_NARY (e)->type;
}
- gcc_unreachable();
+ gcc_unreachable ();
}
/* Get a representative SSA_NAME for a given expression.
@@ -1420,7 +1405,7 @@ get_representative_for (const pre_expr e)
print_generic_expr (dump_file, name, 0);
fprintf (dump_file, " for expression:");
print_pre_expr (dump_file, e);
- fprintf (dump_file, "\n");
+ fprintf (dump_file, " (%04d)\n", value_id);
}
return name;
@@ -1503,7 +1488,7 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
else
{
new_val_id = get_next_value_id ();
- value_expressions.safe_grow_cleared (get_max_value_id() + 1);
+ value_expressions.safe_grow_cleared (get_max_value_id () + 1);
nary = vn_nary_op_insert_pieces (newnary->length,
newnary->opcode,
newnary->type,
@@ -1561,23 +1546,16 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
leader = find_leader_in_sets (op_val_id, set1, set2);
if (!leader)
break;
- /* Make sure we do not recursively translate ourselves
- like for translating a[n_1] with the leader for
- n_1 being a[n_1]. */
- if (get_expression_id (leader) != get_expression_id (expr))
+ opresult = phi_translate (leader, set1, set2, pred, phiblock);
+ if (!opresult)
+ break;
+ if (opresult != leader)
{
- opresult = phi_translate (leader, set1, set2,
- pred, phiblock);
- if (!opresult)
+ tree name = get_representative_for (opresult);
+ if (!name)
break;
- if (opresult != leader)
- {
- tree name = get_representative_for (opresult);
- if (!name)
- break;
- changed |= name != op[n];
- op[n] = name;
- }
+ changed |= name != op[n];
+ op[n] = name;
}
}
if (n != 3)
@@ -1695,7 +1673,8 @@ phi_translate_1 (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
if (changed || !same_valid)
{
new_val_id = get_next_value_id ();
- value_expressions.safe_grow_cleared(get_max_value_id() + 1);
+ value_expressions.safe_grow_cleared
+ (get_max_value_id () + 1);
}
else
new_val_id = ref->value_id;
@@ -1751,6 +1730,7 @@ static pre_expr
phi_translate (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
basic_block pred, basic_block phiblock)
{
+ expr_pred_trans_t slot = NULL;
pre_expr phitrans;
if (!expr)
@@ -1763,21 +1743,21 @@ phi_translate (pre_expr expr, bitmap_set_t set1, bitmap_set_t set2,
if (value_id_constant_p (get_expr_value_id (expr)))
return expr;
+ /* Don't add translations of NAMEs as those are cheap to translate. */
if (expr->kind != NAME)
{
- phitrans = phi_trans_lookup (expr, pred);
- if (phitrans)
- return phitrans;
+ if (phi_trans_add (&slot, expr, pred))
+ return slot->v;
+ /* Store NULL for the value we want to return in the case of
+ recursing. */
+ slot->v = NULL;
}
/* Translate. */
phitrans = phi_translate_1 (expr, set1, set2, pred, phiblock);
- /* Don't add empty translations to the cache. Neither add
- translations of NAMEs as those are cheap to translate. */
- if (phitrans
- && expr->kind != NAME)
- phi_trans_add (expr, phitrans, pred);
+ if (slot)
+ slot->v = phitrans;
return phitrans;
}
@@ -1822,9 +1802,8 @@ phi_translate_set (bitmap_set_t dest, bitmap_set_t set, basic_block pred,
}
/* Find the leader for a value (i.e., the name representing that
- value) in a given set, and return it. If STMT is non-NULL it
- makes sure the defining statement for the leader dominates it.
- Return NULL if no leader is found. */
+ value) in a given set, and return it. Return NULL if no leader
+ is found. */
static pre_expr
bitmap_find_leader (bitmap_set_t set, unsigned int val)
@@ -3005,7 +2984,8 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
{
fprintf (dump_file, "Inserted ");
print_gimple_stmt (dump_file, newstmt, 0, 0);
- fprintf (dump_file, " in predecessor %d\n", block->index);
+ fprintf (dump_file, " in predecessor %d (%04d)\n",
+ block->index, value_id);
}
return name;
@@ -3026,7 +3006,7 @@ inhibit_phi_insertion (basic_block bb, pre_expr expr)
unsigned i;
/* If we aren't going to vectorize we don't inhibit anything. */
- if (!flag_tree_vectorize)
+ if (!flag_tree_loop_vectorize)
return false;
/* Otherwise we inhibit the insertion when the address of the
@@ -3280,7 +3260,7 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
{
fprintf (dump_file, "Created phi ");
print_gimple_stmt (dump_file, phi, 0, 0);
- fprintf (dump_file, " in block %d\n", block->index);
+ fprintf (dump_file, " in block %d (%04d)\n", block->index, val);
}
pre_stats.phis++;
return true;
@@ -4051,10 +4031,19 @@ eliminate_insert (gimple_stmt_iterator *gsi, tree val)
return res;
}
+class eliminate_dom_walker : public dom_walker
+{
+public:
+ eliminate_dom_walker (cdi_direction direction) : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+};
+
/* Perform elimination for the basic-block B during the domwalk. */
-static void
-eliminate_bb (dom_walk_data *, basic_block b)
+void
+eliminate_dom_walker::before_dom_children (basic_block b)
{
gimple_stmt_iterator gsi;
gimple stmt;
@@ -4403,8 +4392,8 @@ eliminate_bb (dom_walk_data *, basic_block b)
/* Make no longer available leaders no longer available. */
-static void
-eliminate_leave_block (dom_walk_data *, basic_block)
+void
+eliminate_dom_walker::after_dom_children (basic_block)
{
tree entry;
while ((entry = el_avail_stack.pop ()) != NULL_TREE)
@@ -4416,7 +4405,6 @@ eliminate_leave_block (dom_walk_data *, basic_block)
static unsigned int
eliminate (void)
{
- struct dom_walk_data walk_data;
gimple_stmt_iterator gsi;
gimple stmt;
unsigned i;
@@ -4430,15 +4418,7 @@ eliminate (void)
el_avail.create (0);
el_avail_stack.create (0);
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = eliminate_bb;
- walk_data.after_dom_children = eliminate_leave_block;
- walk_data.global_data = NULL;
- walk_data.block_local_data_size = 0;
- init_walk_dominator_tree (&walk_data);
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
- fini_walk_dominator_tree (&walk_data);
+ eliminate_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
el_avail.release ();
el_avail_stack.release ();
@@ -4650,7 +4630,7 @@ init_pre (void)
expressions.create (0);
expressions.safe_push (NULL);
value_expressions.create (get_max_value_id () + 1);
- value_expressions.safe_grow_cleared (get_max_value_id() + 1);
+ value_expressions.safe_grow_cleared (get_max_value_id () + 1);
name_to_id.create (0);
inserted_exprs = BITMAP_ALLOC (NULL);
@@ -4810,8 +4790,8 @@ const pass_data pass_data_pre =
class pass_pre : public gimple_opt_pass
{
public:
- pass_pre(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_pre, ctxt)
+ pass_pre (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_pre, ctxt)
{}
/* opt_pass methods: */
@@ -4880,12 +4860,12 @@ const pass_data pass_data_fre =
class pass_fre : public gimple_opt_pass
{
public:
- pass_fre(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_fre, ctxt)
+ pass_fre (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_fre, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_fre (ctxt_); }
+ opt_pass * clone () { return new pass_fre (m_ctxt); }
bool gate () { return gate_fre (); }
unsigned int execute () { return execute_fre (); }
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index afd7233c213..e5dfabcb41c 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -29,7 +29,7 @@
#include "function.h"
#include "gimple-pretty-print.h"
#include "dumpfile.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
#include "langhooks.h"
#include "vec.h"
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index b4a3b0a2df9..cbf3a2d337e 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "tree-inline.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-iterator.h"
#include "tree-pass.h"
@@ -3682,7 +3682,7 @@ repropagate_negates (void)
tree a = gimple_assign_rhs1 (feed);
tree rhs2 = gimple_assign_rhs2 (user);
gimple_stmt_iterator gsi = gsi_for_stmt (feed), gsi2;
- gimple_replace_lhs (feed, negate);
+ gimple_replace_ssa_lhs (feed, negate);
gimple_assign_set_rhs_with_ops (&gsi, PLUS_EXPR, a, rhs2);
update_stmt (gsi_stmt (gsi));
gsi2 = gsi_for_stmt (user);
@@ -4480,12 +4480,12 @@ const pass_data pass_data_reassoc =
class pass_reassoc : public gimple_opt_pass
{
public:
- pass_reassoc(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_reassoc, ctxt)
+ pass_reassoc (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_reassoc, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_reassoc (ctxt_); }
+ opt_pass * clone () { return new pass_reassoc (m_ctxt); }
bool gate () { return gate_tree_ssa_reassoc (); }
unsigned int execute () { return execute_reassoc (); }
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 6886efbe3eb..bd2feb46ef2 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "tree-inline.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "dumpfile.h"
#include "hash-table.h"
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index e8540e80534..e3d62fb9b4e 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "tree-inline.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "hashtab.h"
#include "tree-iterator.h"
@@ -607,8 +607,8 @@ const pass_data pass_data_sink_code =
class pass_sink_code : public gimple_opt_pass
{
public:
- pass_sink_code(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_sink_code, ctxt)
+ pass_sink_code (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_sink_code, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c
index 5c21b92ec68..5df1ddf59bd 100644
--- a/gcc/tree-ssa-strlen.c
+++ b/gcc/tree-ssa-strlen.c
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "hash-table.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "domwalk.h"
#include "alloc-pool.h"
@@ -1926,12 +1926,20 @@ do_invalidate (basic_block dombb, gimple phi, bitmap visited, int *count)
}
}
+class strlen_dom_walker : public dom_walker
+{
+public:
+ strlen_dom_walker (cdi_direction direction) : dom_walker (direction) {}
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+};
+
/* Callback for walk_dominator_tree. Attempt to optimize various
string ops by remembering string lenths pointed by pointer SSA_NAMEs. */
-static void
-strlen_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+strlen_dom_walker::before_dom_children (basic_block bb)
{
gimple_stmt_iterator gsi;
basic_block dombb = get_immediate_dominator (CDI_DOMINATORS, bb);
@@ -2014,9 +2022,8 @@ strlen_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
/* Callback for walk_dominator_tree. Free strinfo vector if it is
owned by the current bb, clear bb->aux. */
-static void
-strlen_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+strlen_dom_walker::after_dom_children (basic_block bb)
{
if (bb->aux)
{
@@ -2040,8 +2047,6 @@ strlen_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
static unsigned int
tree_ssa_strlen (void)
{
- struct dom_walk_data walk_data;
-
ssa_ver_to_stridx.safe_grow_cleared (num_ssa_names);
max_stridx = 1;
strinfo_pool = create_alloc_pool ("strinfo_struct pool",
@@ -2051,21 +2056,7 @@ tree_ssa_strlen (void)
/* String length optimization is implemented as a walk of the dominator
tree and a forward walk of statements within each block. */
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = strlen_enter_block;
- walk_data.after_dom_children = strlen_leave_block;
- walk_data.block_local_data_size = 0;
- walk_data.global_data = NULL;
-
- /* Initialize the dominator walker. */
- init_walk_dominator_tree (&walk_data);
-
- /* Recursively walk the dominator tree. */
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
-
- /* Finalize the dominator walker. */
- fini_walk_dominator_tree (&walk_data);
+ strlen_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
ssa_ver_to_stridx.release ();
free_alloc_pool (strinfo_pool);
@@ -2107,8 +2098,8 @@ const pass_data pass_data_strlen =
class pass_strlen : public gimple_opt_pass
{
public:
- pass_strlen(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_strlen, ctxt)
+ pass_strlen (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_strlen, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 991a6b5800e..46acc9ab9ad 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -28,7 +28,7 @@
#include "flags.h"
#include "basic-block.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-inline.h"
#include "diagnostic-core.h"
#include "gimple.h"
@@ -1747,7 +1747,7 @@ do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta)
{
if (c->rhs.type == ADDRESSOF)
{
- gcc_unreachable();
+ gcc_unreachable ();
}
else
{
@@ -2096,7 +2096,7 @@ label_visit (constraint_graph_t graph, struct scc_info *si, unsigned int n)
}
}
else
- bitmap_ior_into(graph->points_to[n], graph->points_to[w]);
+ bitmap_ior_into (graph->points_to[n], graph->points_to[w]);
}
}
@@ -4301,8 +4301,8 @@ find_func_aliases_for_builtin_call (gimple t)
rhsc.safe_push (nul);
get_constraint_for (gimple_call_lhs (t), &lhsc);
process_all_all_constraints (lhsc, rhsc);
- lhsc.release();
- rhsc.release();
+ lhsc.release ();
+ rhsc.release ();
}
return true;
/* Trampolines are special - they set up passing the static
@@ -6980,8 +6980,8 @@ const pass_data pass_data_build_alias =
class pass_build_alias : public gimple_opt_pass
{
public:
- pass_build_alias(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_build_alias, ctxt)
+ pass_build_alias (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_build_alias, ctxt)
{}
/* opt_pass methods: */
@@ -7020,8 +7020,8 @@ const pass_data pass_data_build_ealias =
class pass_build_ealias : public gimple_opt_pass
{
public:
- pass_build_ealias(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_build_ealias, ctxt)
+ pass_build_ealias (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_build_ealias, ctxt)
{}
/* opt_pass methods: */
@@ -7414,8 +7414,8 @@ const pass_data pass_data_ipa_pta =
class pass_ipa_pta : public simple_ipa_opt_pass
{
public:
- pass_ipa_pta(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_pta, ctxt)
+ pass_ipa_pta (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_pta, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index fa6de9c3531..4998b7e616c 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -194,7 +194,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "flags.h"
#include "function.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "bitmap.h"
#include "tree-ssa-alias.h"
#include "params.h"
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 2a2e143de38..3659cf0c428 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -26,9 +26,9 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "gimple-pretty-print.h"
#include "bitmap.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
-#include "tree-ssa-live.h"
+#include "tree-outof-ssa.h"
#include "flags.h"
@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3. If not see
information is tracked.
Variables which only have one use, and whose defining stmt is considered
- a replaceable expression (see is_replaceable_p) are tracked to see whether
+ a replaceable expression (see ssa_is_replaceable_p) are tracked to see whether
they can be replaced at their use location.
n_12 = C * 10
@@ -359,111 +359,6 @@ add_dependence (temp_expr_table_p tab, int version, tree var)
}
-/* Return TRUE if expression STMT is suitable for replacement.
- TER is true if is_replaceable_p is called from within TER, false
- when used from within stmt_is_replaceable_p, i.e. EXPAND_INITIALIZER
- expansion. The differences are that with !TER some tests are skipped
- to make it more aggressive (doesn't require the same bb, or for -O0
- same locus and same BLOCK), on the other side never considers memory
- loads as replaceable, because those don't ever lead into constant
- expressions. */
-
-static inline bool
-is_replaceable_p (gimple stmt, bool ter)
-{
- use_operand_p use_p;
- tree def;
- gimple use_stmt;
- location_t locus1, locus2;
- tree block1, block2;
-
- /* Only consider modify stmts. */
- if (!is_gimple_assign (stmt))
- return false;
-
- /* If the statement may throw an exception, it cannot be replaced. */
- if (stmt_could_throw_p (stmt))
- return false;
-
- /* Punt if there is more than 1 def. */
- def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
- if (!def)
- return false;
-
- /* Only consider definitions which have a single use. */
- if (!single_imm_use (def, &use_p, &use_stmt))
- return false;
-
- /* If the use isn't in this block, it wont be replaced either. */
- if (ter && gimple_bb (use_stmt) != gimple_bb (stmt))
- return false;
-
- locus1 = gimple_location (stmt);
- block1 = LOCATION_BLOCK (locus1);
- locus1 = LOCATION_LOCUS (locus1);
-
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- locus2 = gimple_phi_arg_location (use_stmt, PHI_ARG_INDEX_FROM_USE (use_p));
- else
- locus2 = gimple_location (use_stmt);
- block2 = LOCATION_BLOCK (locus2);
- locus2 = LOCATION_LOCUS (locus2);
-
- if ((!optimize || optimize_debug)
- && ter
- && ((locus1 != UNKNOWN_LOCATION
- && locus1 != locus2)
- || (block1 != NULL_TREE
- && block1 != block2)))
- return false;
-
- /* Used in this block, but at the TOP of the block, not the end. */
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- return false;
-
- /* There must be no VDEFs. */
- if (gimple_vdef (stmt))
- return false;
-
- /* Without alias info we can't move around loads. */
- if ((!optimize || !ter)
- && gimple_assign_single_p (stmt)
- && !is_gimple_val (gimple_assign_rhs1 (stmt)))
- return false;
-
- /* Float expressions must go through memory if float-store is on. */
- if (flag_float_store
- && FLOAT_TYPE_P (gimple_expr_type (stmt)))
- return false;
-
- /* An assignment with a register variable on the RHS is not
- replaceable. */
- if (gimple_assign_rhs_code (stmt) == VAR_DECL
- && DECL_HARD_REGISTER (gimple_assign_rhs1 (stmt)))
- return false;
-
- /* No function calls can be replaced. */
- if (is_gimple_call (stmt))
- return false;
-
- /* Leave any stmt with volatile operands alone as well. */
- if (gimple_has_volatile_ops (stmt))
- return false;
-
- return true;
-}
-
-
-/* Variant of is_replaceable_p test for use in EXPAND_INITIALIZER
- expansion. */
-
-bool
-stmt_is_replaceable_p (gimple stmt)
-{
- return is_replaceable_p (stmt, false);
-}
-
-
/* This function will remove the expression for VERSION from replacement
consideration in table TAB. If FREE_EXPR is true, then remove the
expression from consideration as well by freeing the decl uid bitmap. */
@@ -487,6 +382,62 @@ finished_with_expr (temp_expr_table_p tab, int version, bool free_expr)
}
+/* Return TRUE if expression STMT is suitable for replacement.
+ In addition to ssa_is_replaceable_p, require the same bb, and for -O0
+ same locus and same BLOCK), Considers memory loads as replaceable if aliasing
+ is available. */
+
+static inline bool
+ter_is_replaceable_p (gimple stmt)
+{
+
+ if (ssa_is_replaceable_p (stmt))
+ {
+ use_operand_p use_p;
+ tree def;
+ gimple use_stmt;
+ location_t locus1, locus2;
+ tree block1, block2;
+
+ /* Only consider definitions which have a single use. ssa_is_replaceable_p
+ already performed this check, but the use stmt pointer is required for
+ further checks. */
+ def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
+ if (!single_imm_use (def, &use_p, &use_stmt))
+ return false;
+
+ /* If the use isn't in this block, it wont be replaced either. */
+ if (gimple_bb (use_stmt) != gimple_bb (stmt))
+ return false;
+
+ locus1 = gimple_location (stmt);
+ block1 = LOCATION_BLOCK (locus1);
+ locus1 = LOCATION_LOCUS (locus1);
+
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
+ locus2 = gimple_phi_arg_location (use_stmt,
+ PHI_ARG_INDEX_FROM_USE (use_p));
+ else
+ locus2 = gimple_location (use_stmt);
+ block2 = LOCATION_BLOCK (locus2);
+ locus2 = LOCATION_LOCUS (locus2);
+
+ if ((!optimize || optimize_debug)
+ && ((locus1 != UNKNOWN_LOCATION && locus1 != locus2)
+ || (block1 != NULL_TREE && block1 != block2)))
+ return false;
+
+ /* Without alias info we can't move around loads. */
+ if (!optimize && gimple_assign_single_p (stmt)
+ && !is_gimple_val (gimple_assign_rhs1 (stmt)))
+ return false;
+
+ return true;
+ }
+ return false;
+}
+
+
/* Create an expression entry for a replaceable expression. */
static void
@@ -497,7 +448,7 @@ process_replaceable (temp_expr_table_p tab, gimple stmt, int call_cnt)
ssa_op_iter iter;
bitmap def_vars, use_vars;
- gcc_checking_assert (is_replaceable_p (stmt, true));
+ gcc_checking_assert (ter_is_replaceable_p (stmt));
def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
version = SSA_NAME_VERSION (def);
@@ -612,7 +563,7 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
if (is_gimple_debug (stmt))
continue;
- stmt_replaceable = is_replaceable_p (stmt, true);
+ stmt_replaceable = ter_is_replaceable_p (stmt);
/* Determine if this stmt finishes an existing expression. */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
diff --git a/gcc/tree-ssa-ter.h b/gcc/tree-ssa-ter.h
new file mode 100644
index 00000000000..4565db16b86
--- /dev/null
+++ b/gcc/tree-ssa-ter.h
@@ -0,0 +1,52 @@
+/* Header file for tree-ssa-ter.c exports.
+ Copyright (C) 2013 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/>. */
+
+#ifndef GCC_TREE_SSA_TER_H
+#define GCC_TREE_SSA_TER_H
+
+extern bitmap find_replaceable_exprs (var_map);
+extern void dump_replaceable_exprs (FILE *, bitmap);
+
+#endif /* GCC_TREE_SSA_TER_H */
+/* Header file for tree-ssa-ter.c exports.
+ Copyright (C) 2013 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/>. */
+
+#ifndef GCC_TREE_SSA_TER_H
+#define GCC_TREE_SSA_TER_H
+
+extern bitmap find_replaceable_exprs (var_map);
+extern void dump_replaceable_exprs (FILE *, bitmap);
+
+#endif /* GCC_TREE_SSA_TER_H */
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index f2051d7e7d0..cf62785c316 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -30,8 +30,9 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "timevar.h"
#include "dumpfile.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-ssa-propagate.h"
+#include "tree-ssa-threadupdate.h"
#include "langhooks.h"
#include "params.h"
@@ -753,7 +754,7 @@ thread_around_empty_blocks (edge taken_edge,
bool handle_dominating_asserts,
tree (*simplify) (gimple, gimple),
bitmap visited,
- vec<edge> *path)
+ vec<jump_thread_edge *> *path)
{
basic_block bb = taken_edge->dest;
gimple_stmt_iterator gsi;
@@ -764,13 +765,25 @@ thread_around_empty_blocks (edge taken_edge,
when threading. Thus they can not have visible side effects such
as PHI nodes. */
if (!gsi_end_p (gsi_start_phis (bb)))
- return NULL;
+ return false;
/* Skip over DEBUG statements at the start of the block. */
gsi = gsi_start_nondebug_bb (bb);
/* If the block has no statements, but does have a single successor, then
- it's just a forwarding block and we can thread through it trivially. */
+ it's just a forwarding block and we can thread through it trivially.
+
+ However, note that just threading through empty blocks with single
+ successors is not inherently profitable. For the jump thread to
+ be profitable, we must avoid a runtime conditional.
+
+ By taking the return value from the recursive call, we get the
+ desired effect of returning TRUE when we found a profitable jump
+ threading opportunity and FALSE otherwise.
+
+ This is particularly important when this routine is called after
+ processing a joiner block. Returning TRUE too aggressively in
+ that case results in pointless duplication of the joiner block. */
if (gsi_end_p (gsi))
{
if (single_succ_p (bb))
@@ -779,17 +792,20 @@ thread_around_empty_blocks (edge taken_edge,
if ((taken_edge->flags & EDGE_DFS_BACK) == 0
&& !bitmap_bit_p (visited, taken_edge->dest->index))
{
+ jump_thread_edge *x
+ = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK);
+ path->safe_push (x);
bitmap_set_bit (visited, taken_edge->dest->index);
- path->safe_push (taken_edge);
- thread_around_empty_blocks (taken_edge,
- dummy_cond,
- handle_dominating_asserts,
- simplify,
- visited,
- path);
- return true;
+ return thread_around_empty_blocks (taken_edge,
+ dummy_cond,
+ handle_dominating_asserts,
+ simplify,
+ visited,
+ path);
}
}
+
+ /* We have a block with no statements, but multiple successors? */
return false;
}
@@ -815,7 +831,11 @@ thread_around_empty_blocks (edge taken_edge,
if (bitmap_bit_p (visited, taken_edge->dest->index))
return false;
bitmap_set_bit (visited, taken_edge->dest->index);
- path->safe_push (taken_edge);
+
+ jump_thread_edge *x
+ = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK);
+ path->safe_push (x);
+
thread_around_empty_blocks (taken_edge,
dummy_cond,
handle_dominating_asserts,
@@ -828,28 +848,6 @@ thread_around_empty_blocks (edge taken_edge,
return false;
}
-/* E1 and E2 are edges into the same basic block. Return TRUE if the
- PHI arguments associated with those edges are equal or there are no
- PHI arguments, otherwise return FALSE. */
-
-static bool
-phi_args_equal_on_edges (edge e1, edge e2)
-{
- gimple_stmt_iterator gsi;
- int indx1 = e1->dest_idx;
- int indx2 = e2->dest_idx;
-
- for (gsi = gsi_start_phis (e1->dest); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple phi = gsi_stmt (gsi);
-
- if (!operand_equal_p (gimple_phi_arg_def (phi, indx1),
- gimple_phi_arg_def (phi, indx2), 0))
- return false;
- }
- return true;
-}
-
/* We are exiting E->src, see if E->dest ends with a conditional
jump which has a known value when reached via E.
@@ -931,9 +929,13 @@ thread_across_edge (gimple dummy_cond,
if (dest == NULL || dest == e->dest)
goto fail;
- vec<edge> path = vNULL;
- path.safe_push (e);
- path.safe_push (taken_edge);
+ vec<jump_thread_edge *> path = vNULL;
+ jump_thread_edge *x
+ = new jump_thread_edge (e, EDGE_START_JUMP_THREAD);
+ path.safe_push (x);
+
+ x = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_BLOCK);
+ path.safe_push (x);
/* See if we can thread through DEST as well, this helps capture
secondary effects of threading without having to re-run DOM or
@@ -956,9 +958,11 @@ thread_across_edge (gimple dummy_cond,
}
remove_temporary_equivalences (stack);
- propagate_threaded_block_debug_into (path[path.length () - 1]->dest,
+ propagate_threaded_block_debug_into (path.last ()->e->dest,
e->dest);
- register_jump_thread (path, false);
+ register_jump_thread (path);
+ for (unsigned int i = 0; i < path.length (); i++)
+ delete path[i];
path.release ();
return;
}
@@ -988,15 +992,18 @@ thread_across_edge (gimple dummy_cond,
bitmap_clear (visited);
bitmap_set_bit (visited, taken_edge->dest->index);
bitmap_set_bit (visited, e->dest->index);
- vec<edge> path = vNULL;
+ vec<jump_thread_edge *> path = vNULL;
/* Record whether or not we were able to thread through a successor
of E->dest. */
- path.safe_push (e);
- path.safe_push (taken_edge);
+ jump_thread_edge *x = new jump_thread_edge (e, EDGE_START_JUMP_THREAD);
+ path.safe_push (x);
+
+ x = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_JOINER_BLOCK);
+ path.safe_push (x);
found = false;
if ((e->flags & EDGE_DFS_BACK) == 0
- || ! cond_arg_set_in_bb (path[path.length () - 1], e->dest))
+ || ! cond_arg_set_in_bb (path.last ()->e, e->dest))
found = thread_around_empty_blocks (taken_edge,
dummy_cond,
handle_dominating_asserts,
@@ -1008,21 +1015,14 @@ thread_across_edge (gimple dummy_cond,
record the jump threading opportunity. */
if (found)
{
- edge tmp;
- /* If there is already an edge from the block to be duplicated
- (E2->src) to the final target (E3->dest), then make sure that
- the PHI args associated with the edges E2 and E3 are the
- same. */
- tmp = find_edge (taken_edge->src, path[path.length () - 1]->dest);
- if (!tmp || phi_args_equal_on_edges (tmp, path[path.length () - 1]))
- {
- propagate_threaded_block_debug_into (path[path.length () - 1]->dest,
- taken_edge->dest);
- register_jump_thread (path, true);
- }
+ propagate_threaded_block_debug_into (path.last ()->e->dest,
+ taken_edge->dest);
+ register_jump_thread (path);
}
- path.release();
+ for (unsigned int i = 0; i < path.length (); i++)
+ delete path[i];
+ path.release ();
}
BITMAP_FREE (visited);
}
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index 8e40f6668cf..15d4d04066e 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -26,7 +26,8 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "function.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
+#include "tree-ssa-threadupdate.h"
#include "dumpfile.h"
#include "cfgloop.h"
#include "hash-table.h"
@@ -363,8 +364,8 @@ create_edge_and_update_destination_phis (struct redirection_data *rd,
if (rd->outgoing_edge->aux)
{
e->aux = XNEWVEC (edge, 2);
- THREAD_TARGET(e) = THREAD_TARGET (rd->outgoing_edge);
- THREAD_TARGET2(e) = THREAD_TARGET2 (rd->outgoing_edge);
+ THREAD_TARGET (e) = THREAD_TARGET (rd->outgoing_edge);
+ THREAD_TARGET2 (e) = THREAD_TARGET2 (rd->outgoing_edge);
}
else
{
@@ -402,6 +403,7 @@ ssa_fix_duplicate_block_edges (struct redirection_data *rd,
threading through. That's the edge we want to redirect. */
victim = find_edge (rd->dup_block, THREAD_TARGET (e)->dest);
e2 = redirect_edge_and_branch (victim, THREAD_TARGET2 (e)->dest);
+ e2->count = THREAD_TARGET2 (e)->count;
/* If we redirected the edge, then we need to copy PHI arguments
at the target. If the edge already existed (e2 != victim case),
@@ -496,18 +498,8 @@ ssa_redirect_edges (struct redirection_data **slot,
free (el);
thread_stats.num_threaded_edges++;
- /* If we are threading through a joiner block, then we have to
- find the edge we want to redirect and update some PHI nodes. */
- if (THREAD_TARGET2 (e))
- {
- edge e2;
- /* We want to redirect the incoming edge to the joiner block (E)
- to instead reach the duplicate of the joiner block. */
- e2 = redirect_edge_and_branch (e, rd->dup_block);
- flush_pending_stmts (e2);
- }
- else if (rd->dup_block)
+ if (rd->dup_block)
{
edge e2;
@@ -521,9 +513,15 @@ ssa_redirect_edges (struct redirection_data **slot,
the computation overflows. */
if (rd->dup_block->frequency < BB_FREQ_MAX * 2)
rd->dup_block->frequency += EDGE_FREQUENCY (e);
- EDGE_SUCC (rd->dup_block, 0)->count += e->count;
- /* Redirect the incoming edge to the appropriate duplicate
- block. */
+
+ /* In the case of threading through a joiner block, the outgoing
+ edges from the duplicate block were updated when they were
+ redirected during ssa_fix_duplicate_block_edges. */
+ if (!THREAD_TARGET2 (e))
+ EDGE_SUCC (rd->dup_block, 0)->count += e->count;
+
+ /* Redirect the incoming edge (possibly to the joiner block) to the
+ appropriate duplicate block. */
e2 = redirect_edge_and_branch (e, rd->dup_block);
gcc_assert (e == e2);
flush_pending_stmts (e2);
@@ -640,14 +638,38 @@ thread_block (basic_block bb, bool noloop_only)
else
e2 = THREAD_TARGET (e);
- if (!e2
+ if (!e2 || noloop_only)
+ {
/* If NOLOOP_ONLY is true, we only allow threading through the
- header of a loop to exit edges. */
- || (noloop_only
- && bb == bb->loop_father->header
+ header of a loop to exit edges.
+
+ There are two cases to consider. The first when BB is the
+ loop header. We will attempt to thread this elsewhere, so
+ we can just continue here. */
+
+ if (bb == bb->loop_father->header
&& (!loop_exit_edge_p (bb->loop_father, e2)
- || THREAD_TARGET2 (e))))
- continue;
+ || THREAD_TARGET2 (e)))
+ continue;
+
+
+ /* The second occurs when there was loop header buried in a jump
+ threading path. We do not try and thread this elsewhere, so
+ just cancel the jump threading request by clearing the AUX
+ field now. */
+ if ((bb->loop_father != e2->src->loop_father
+ && !loop_exit_edge_p (e2->src->loop_father, e2))
+ || (e2->src->loop_father != e2->dest->loop_father
+ && !loop_exit_edge_p (e2->src->loop_father, e2)))
+ {
+ /* Since this case is not handled by our special code
+ to thread through a loop header, we must explicitly
+ cancel the threading request here. */
+ free (e->aux);
+ e->aux = NULL;
+ continue;
+ }
+ }
if (e->dest == e2->src)
update_bb_profile_for_threading (e->dest, EDGE_FREQUENCY (e),
@@ -1123,6 +1145,28 @@ fail:
return false;
}
+/* E1 and E2 are edges into the same basic block. Return TRUE if the
+ PHI arguments associated with those edges are equal or there are no
+ PHI arguments, otherwise return FALSE. */
+
+static bool
+phi_args_equal_on_edges (edge e1, edge e2)
+{
+ gimple_stmt_iterator gsi;
+ int indx1 = e1->dest_idx;
+ int indx2 = e2->dest_idx;
+
+ for (gsi = gsi_start_phis (e1->dest); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple phi = gsi_stmt (gsi);
+
+ if (!operand_equal_p (gimple_phi_arg_def (phi, indx1),
+ gimple_phi_arg_def (phi, indx2), 0))
+ return false;
+ }
+ return true;
+}
+
/* Walk through the registered jump threads and convert them into a
form convenient for this pass.
@@ -1195,6 +1239,46 @@ mark_threaded_blocks (bitmap threaded_blocks)
}
}
+ /* If we have a joiner block (J) which has two successors S1 and S2 and
+ we are threading though S1 and the final destination of the thread
+ is S2, then we must verify that any PHI nodes in S2 have the same
+ PHI arguments for the edge J->S2 and J->S1->...->S2.
+
+ We used to detect this prior to registering the jump thread, but
+ that prohibits propagation of edge equivalences into non-dominated
+ PHI nodes as the equivalency test might occur before propagation.
+
+ This works for now, but will need improvement as part of the FSA
+ optimization.
+
+ Note since we've moved the thread request data to the edges,
+ we have to iterate on those rather than the threaded_edges vector. */
+ EXECUTE_IF_SET_IN_BITMAP (tmp, 0, i, bi)
+ {
+ bb = BASIC_BLOCK (i);
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ if (e->aux)
+ {
+ bool have_joiner = THREAD_TARGET2 (e) != NULL;
+
+ if (have_joiner)
+ {
+ basic_block joiner = e->dest;
+ edge final_edge = THREAD_TARGET2 (e);
+ basic_block final_dest = final_edge->dest;
+ edge e2 = find_edge (joiner, final_dest);
+
+ if (e2 && !phi_args_equal_on_edges (e2, final_edge))
+ {
+ free (e->aux);
+ e->aux = NULL;
+ }
+ }
+ }
+ }
+ }
+
/* If optimizing for size, only thread through block if we don't have
to duplicate it or it's an otherwise empty redirection block. */
@@ -1219,7 +1303,7 @@ mark_threaded_blocks (bitmap threaded_blocks)
else
bitmap_copy (threaded_blocks, tmp);
- BITMAP_FREE(tmp);
+ BITMAP_FREE (tmp);
}
@@ -1294,6 +1378,39 @@ thread_through_all_blocks (bool may_peel_loop_headers)
return retval;
}
+/* Dump a jump threading path, including annotations about each
+ edge in the path. */
+
+static void
+dump_jump_thread_path (FILE *dump_file, vec<jump_thread_edge *> path)
+{
+ fprintf (dump_file,
+ " Registering jump thread: (%d, %d) incoming edge; ",
+ path[0]->e->src->index, path[0]->e->dest->index);
+
+ for (unsigned int i = 1; i < path.length (); i++)
+ {
+ /* We can get paths with a NULL edge when the final destination
+ of a jump thread turns out to be a constant address. We dump
+ those paths when debugging, so we have to be prepared for that
+ possibility here. */
+ if (path[i]->e == NULL)
+ continue;
+
+ if (path[i]->type == EDGE_COPY_SRC_JOINER_BLOCK)
+ fprintf (dump_file, " (%d, %d) joiner; ",
+ path[i]->e->src->index, path[i]->e->dest->index);
+ if (path[i]->type == EDGE_COPY_SRC_BLOCK)
+ fprintf (dump_file, " (%d, %d) normal;",
+ path[i]->e->src->index, path[i]->e->dest->index);
+ if (path[i]->type == EDGE_NO_COPY_SRC_BLOCK)
+ fprintf (dump_file, " (%d, %d) nocopy;",
+ path[i]->e->src->index, path[i]->e->dest->index);
+ }
+ fputc ('\n', dump_file);
+}
+
+
/* Register a jump threading opportunity. We queue up all the jump
threading opportunities discovered by a pass and update the CFG
and SSA form all at once.
@@ -1303,43 +1420,47 @@ thread_through_all_blocks (bool may_peel_loop_headers)
after fixing the SSA graph. */
void
-register_jump_thread (vec<edge> path, bool through_joiner)
+register_jump_thread (vec<jump_thread_edge *> path)
{
- /* Convert PATH into 3 edge representation we've been using. This
- is temporary until we convert this file to use a path representation
- throughout. */
- edge e = path[0];
- edge e2 = path[1];
- edge e3;
-
- if (!through_joiner)
- e3 = NULL;
- else
- e3 = path[path.length () - 1];
+ /* First make sure there are no NULL outgoing edges on the jump threading
+ path. That can happen for jumping to a constant address. */
+ for (unsigned int i = 0; i < path.length (); i++)
+ if (path[i]->e == NULL)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file,
+ "Found NULL edge in jump threading path. Cancelling jump thread:\n");
+ dump_jump_thread_path (dump_file, path);
+ }
+ return;
+ }
- /* This can occur if we're jumping to a constant address or
- or something similar. Just get out now. */
- if (e2 == NULL)
- return;
+ if (!threaded_edges.exists ())
+ threaded_edges.create (15);
if (dump_file && (dump_flags & TDF_DETAILS))
- {
- unsigned int i;
+ dump_jump_thread_path (dump_file, path);
- fprintf (dump_file,
- " Registering jump thread %s:",
- through_joiner ? "(through joiner block)" : "");
+ /* The first entry in the vector is always the start of the
+ jump threading path. */
+ threaded_edges.safe_push (path[0]->e);
- for (i = 0; i < path.length (); i++)
- fprintf (dump_file, " (%d, %d); ",
- path[i]->src->index, path[i]->dest->index);
- fputc ('\n', dump_file);
- }
-
- if (!threaded_edges.exists ())
- threaded_edges.create (15);
+ /* In our 3-edge representation, the joiner, if it exists is always the
+ 2nd edge and the final block on the path is the 3rd edge. If no
+ jointer exists, then the final block on the path is the 2nd edge
+ and the 3rd edge is NULL.
- threaded_edges.safe_push (e);
- threaded_edges.safe_push (e2);
- threaded_edges.safe_push (e3);
+ With upcoming improvements, we're going to be holding onto the entire
+ path, so we'll be able to clean this wart up shortly. */
+ if (path[1]->type == EDGE_COPY_SRC_JOINER_BLOCK)
+ {
+ threaded_edges.safe_push (path[1]->e);
+ threaded_edges.safe_push (path.last ()->e);
+ }
+ else
+ {
+ threaded_edges.safe_push (path.last ()->e);
+ threaded_edges.safe_push (NULL);
+ }
}
diff --git a/gcc/tree-ssa-threadupdate.h b/gcc/tree-ssa-threadupdate.h
new file mode 100644
index 00000000000..723f5bbe0eb
--- /dev/null
+++ b/gcc/tree-ssa-threadupdate.h
@@ -0,0 +1,45 @@
+/* Communication between registering jump thread requests and
+ updating the SSA/CFG for jump threading.
+ Copyright (C) 2013 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/>. */
+
+#ifndef _TREE_SSA_THREADUPDATE_H
+#define _TREE_SSA_THREADUPDATE_H 1
+
+/* In tree-ssa-threadupdate.c. */
+extern bool thread_through_all_blocks (bool);
+enum jump_thread_edge_type
+{
+ EDGE_START_JUMP_THREAD,
+ EDGE_COPY_SRC_BLOCK,
+ EDGE_COPY_SRC_JOINER_BLOCK,
+ EDGE_NO_COPY_SRC_BLOCK
+};
+
+class jump_thread_edge
+{
+public:
+ jump_thread_edge (edge e, enum jump_thread_edge_type type)
+ : e (e), type (type) {}
+
+ edge e;
+ enum jump_thread_edge_type type;
+};
+
+extern void register_jump_thread (vec<class jump_thread_edge *>);
+#endif
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 837c4eaf066..28ff546c627 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "function.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "domwalk.h"
#include "tree-pass.h"
#include "tree-ssa-propagate.h"
@@ -259,11 +259,6 @@ associate_equivalences_with_edges (void)
so with each value we have a list of SSA_NAMEs that have the
same value. */
-/* As we enter each block we record the value for any edge equivalency
- leading to this block. If no such edge equivalency exists, then we
- record NULL. These equivalences are live until we leave the dominator
- subtree rooted at the block where we record the equivalency. */
-static vec<tree> equiv_stack;
/* Main structure for recording equivalences into our hash table. */
struct equiv_hash_elt
@@ -316,8 +311,6 @@ val_ssa_equiv_hasher::remove (value_type *elt)
able to reuse tree-vn for this code. */
static hash_table <val_ssa_equiv_hasher> val_ssa_equiv;
-static void uncprop_enter_block (struct dom_walk_data *, basic_block);
-static void uncprop_leave_block (struct dom_walk_data *, basic_block);
static void uncprop_into_successor_phis (basic_block);
/* Remove the most recently recorded equivalency for VALUE. */
@@ -361,47 +354,54 @@ record_equiv (tree value, tree equivalence)
an_equiv_elt_p->equivalences.safe_push (equivalence);
}
+class uncprop_dom_walker : public dom_walker
+{
+public:
+ uncprop_dom_walker (cdi_direction direction)
+ : dom_walker (direction)
+ {
+ m_equiv_stack.create (2);
+ }
+ ~uncprop_dom_walker ()
+ {
+ m_equiv_stack.release ();
+ }
+
+ virtual void before_dom_children (basic_block);
+ virtual void after_dom_children (basic_block);
+
+private:
+
+ /* As we enter each block we record the value for any edge equivalency
+ leading to this block. If no such edge equivalency exists, then we
+ record NULL. These equivalences are live until we leave the dominator
+ subtree rooted at the block where we record the equivalency. */
+ vec<tree> m_equiv_stack;
+};
+
/* Main driver for un-cprop. */
static unsigned int
tree_ssa_uncprop (void)
{
- struct dom_walk_data walk_data;
basic_block bb;
associate_equivalences_with_edges ();
/* Create our global data structures. */
val_ssa_equiv.create (1024);
- equiv_stack.create (2);
/* We're going to do a dominator walk, so ensure that we have
dominance information. */
calculate_dominance_info (CDI_DOMINATORS);
- /* Setup callbacks for the generic dominator tree walker. */
- walk_data.dom_direction = CDI_DOMINATORS;
- walk_data.initialize_block_local_data = NULL;
- walk_data.before_dom_children = uncprop_enter_block;
- walk_data.after_dom_children = uncprop_leave_block;
- walk_data.global_data = NULL;
- walk_data.block_local_data_size = 0;
-
- /* Now initialize the dominator walker. */
- init_walk_dominator_tree (&walk_data);
-
/* Recursively walk the dominator tree undoing unprofitable
constant/copy propagations. */
- walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
-
- /* Finalize and clean up. */
- fini_walk_dominator_tree (&walk_data);
+ uncprop_dom_walker (CDI_DOMINATORS).walk (cfun->cfg->x_entry_block_ptr);
- /* EQUIV_STACK should already be empty at this point, so we just
- need to empty elements out of the hash table, free EQUIV_STACK,
- and cleanup the AUX field on the edges. */
+ /* we just need to empty elements out of the hash table, and cleanup the
+ AUX field on the edges. */
val_ssa_equiv.dispose ();
- equiv_stack.release ();
FOR_EACH_BB (bb)
{
edge e;
@@ -424,12 +424,11 @@ tree_ssa_uncprop (void)
any finalization actions in preparation for leaving this node in
the dominator tree. */
-static void
-uncprop_leave_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb ATTRIBUTE_UNUSED)
+void
+uncprop_dom_walker::after_dom_children (basic_block bb ATTRIBUTE_UNUSED)
{
/* Pop the topmost value off the equiv stack. */
- tree value = equiv_stack.pop ();
+ tree value = m_equiv_stack.pop ();
/* If that value was non-null, then pop the topmost equivalency off
its equivalency stack. */
@@ -547,9 +546,8 @@ single_incoming_edge_ignoring_loop_edges (basic_block bb)
return retval;
}
-static void
-uncprop_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
- basic_block bb)
+void
+uncprop_dom_walker::before_dom_children (basic_block bb)
{
basic_block parent;
edge e;
@@ -568,13 +566,13 @@ uncprop_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux;
record_equiv (equiv->rhs, equiv->lhs);
- equiv_stack.safe_push (equiv->rhs);
+ m_equiv_stack.safe_push (equiv->rhs);
recorded = true;
}
}
if (!recorded)
- equiv_stack.safe_push (NULL_TREE);
+ m_equiv_stack.safe_push (NULL_TREE);
uncprop_into_successor_phis (bb);
}
@@ -605,12 +603,12 @@ const pass_data pass_data_uncprop =
class pass_uncprop : public gimple_opt_pass
{
public:
- pass_uncprop(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_uncprop, ctxt)
+ pass_uncprop (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_uncprop, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_uncprop (ctxt_); }
+ opt_pass * clone () { return new pass_uncprop (m_ctxt); }
bool gate () { return gate_uncprop (); }
unsigned int execute () { return tree_ssa_uncprop (); }
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 6d2d768a243..0174ee1748a 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "bitmap.h"
#include "pointer-set.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-inline.h"
#include "hashtab.h"
@@ -74,46 +74,173 @@ get_mask_first_set_bit (unsigned mask)
}
#define MASK_FIRST_SET_BIT(mask) get_mask_first_set_bit (mask)
-
/* Return true if T, an SSA_NAME, has an undefined value. */
-
-bool
-ssa_undefined_value_p (tree t)
+static bool
+has_undefined_value_p (tree t)
{
- tree var = SSA_NAME_VAR (t);
-
- if (!var)
- ;
- /* Parameters get their initial value from the function entry. */
- else if (TREE_CODE (var) == PARM_DECL)
- return false;
- /* When returning by reference the return address is actually a hidden
- parameter. */
- else if (TREE_CODE (var) == RESULT_DECL && DECL_BY_REFERENCE (var))
- return false;
- /* Hard register variables get their initial value from the ether. */
- else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
- return false;
-
- /* The value is undefined iff its definition statement is empty. */
- return (gimple_nop_p (SSA_NAME_DEF_STMT (t))
+ return (ssa_undefined_value_p (t)
|| (possibly_undefined_names
&& pointer_set_contains (possibly_undefined_names, t)));
}
-/* Like ssa_undefined_value_p, but don't return true if TREE_NO_WARNING
+
+
+/* Like has_undefined_value_p, but don't return true if TREE_NO_WARNING
is set on SSA_NAME_VAR. */
static inline bool
-uninit_undefined_value_p (tree t)
-{
- if (!ssa_undefined_value_p (t))
+uninit_undefined_value_p (tree t) {
+ if (!has_undefined_value_p (t))
return false;
if (SSA_NAME_VAR (t) && TREE_NO_WARNING (SSA_NAME_VAR (t)))
return false;
return true;
}
+/* Emit warnings for uninitialized variables. This is done in two passes.
+
+ The first pass notices real uses of SSA names with undefined values.
+ Such uses are unconditionally uninitialized, and we can be certain that
+ such a use is a mistake. This pass is run before most optimizations,
+ so that we catch as many as we can.
+
+ The second pass follows PHI nodes to find uses that are potentially
+ uninitialized. In this case we can't necessarily prove that the use
+ is really uninitialized. This pass is run after most optimizations,
+ so that we thread as many jumps and possible, and delete as much dead
+ code as possible, in order to reduce false positives. We also look
+ again for plain uninitialized variables, since optimization may have
+ changed conditionally uninitialized to unconditionally uninitialized. */
+
+/* Emit a warning for EXPR based on variable VAR at the point in the
+ program T, an SSA_NAME, is used being uninitialized. The exact
+ warning text is in MSGID and LOCUS may contain a location or be null.
+ WC is the warning code. */
+
+static void
+warn_uninit (enum opt_code wc, tree t,
+ tree expr, tree var, const char *gmsgid, void *data)
+{
+ gimple context = (gimple) data;
+ location_t location, cfun_loc;
+ expanded_location xloc, floc;
+
+ if (!has_undefined_value_p (t))
+ return;
+
+ /* TREE_NO_WARNING either means we already warned, or the front end
+ wishes to suppress the warning. */
+ if ((context
+ && (gimple_no_warning_p (context)
+ || (gimple_assign_single_p (context)
+ && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
+ || TREE_NO_WARNING (expr))
+ return;
+
+ location = (context != NULL && gimple_has_location (context))
+ ? gimple_location (context)
+ : DECL_SOURCE_LOCATION (var);
+ location = linemap_resolve_location (line_table, location,
+ LRK_SPELLING_LOCATION,
+ NULL);
+ cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
+ xloc = expand_location (location);
+ floc = expand_location (cfun_loc);
+ if (warning_at (location, wc, gmsgid, expr))
+ {
+ TREE_NO_WARNING (expr) = 1;
+
+ if (location == DECL_SOURCE_LOCATION (var))
+ return;
+ if (xloc.file != floc.file
+ || linemap_location_before_p (line_table,
+ location, cfun_loc)
+ || linemap_location_before_p (line_table,
+ cfun->function_end_locus,
+ location))
+ inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
+ }
+}
+
+static unsigned int
+warn_uninitialized_vars (bool warn_possibly_uninitialized)
+{
+ gimple_stmt_iterator gsi;
+ basic_block bb;
+
+ FOR_EACH_BB (bb)
+ {
+ bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
+ single_succ (ENTRY_BLOCK_PTR), bb);
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ use_operand_p use_p;
+ ssa_op_iter op_iter;
+ tree use;
+
+ if (is_gimple_debug (stmt))
+ continue;
+
+ /* We only do data flow with SSA_NAMEs, so that's all we
+ can warn about. */
+ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, op_iter, SSA_OP_USE)
+ {
+ use = USE_FROM_PTR (use_p);
+ if (always_executed)
+ warn_uninit (OPT_Wuninitialized, use,
+ SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+ "%qD is used uninitialized in this function",
+ stmt);
+ else if (warn_possibly_uninitialized)
+ warn_uninit (OPT_Wmaybe_uninitialized, use,
+ SSA_NAME_VAR (use), SSA_NAME_VAR (use),
+ "%qD may be used uninitialized in this function",
+ stmt);
+ }
+
+ /* For memory the only cheap thing we can do is see if we
+ have a use of the default def of the virtual operand.
+ ??? Note that at -O0 we do not have virtual operands.
+ ??? Not so cheap would be to use the alias oracle via
+ walk_aliased_vdefs, if we don't find any aliasing vdef
+ warn as is-used-uninitialized, if we don't find an aliasing
+ vdef that kills our use (stmt_kills_ref_p), warn as
+ may-be-used-uninitialized. But this walk is quadratic and
+ so must be limited which means we would miss warning
+ opportunities. */
+ use = gimple_vuse (stmt);
+ if (use
+ && gimple_assign_single_p (stmt)
+ && !gimple_vdef (stmt)
+ && SSA_NAME_IS_DEFAULT_DEF (use))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ tree base = get_base_address (rhs);
+
+ /* Do not warn if it can be initialized outside this function. */
+ if (TREE_CODE (base) != VAR_DECL
+ || DECL_HARD_REGISTER (base)
+ || is_global_var (base))
+ continue;
+
+ if (always_executed)
+ warn_uninit (OPT_Wuninitialized, use,
+ gimple_assign_rhs1 (stmt), base,
+ "%qE is used uninitialized in this function",
+ stmt);
+ else if (warn_possibly_uninitialized)
+ warn_uninit (OPT_Wmaybe_uninitialized, use,
+ gimple_assign_rhs1 (stmt), base,
+ "%qE may be used uninitialized in this function",
+ stmt);
+ }
+ }
+ }
+
+ return 0;
+}
+
/* Checks if the operand OPND of PHI is defined by
another phi with one operand defined by this PHI,
but the rest operands are all defined. If yes,
@@ -2066,12 +2193,12 @@ const pass_data pass_data_late_warn_uninitialized =
class pass_late_warn_uninitialized : public gimple_opt_pass
{
public:
- pass_late_warn_uninitialized(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_late_warn_uninitialized, ctxt)
+ pass_late_warn_uninitialized (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_late_warn_uninitialized, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_late_warn_uninitialized (ctxt_); }
+ opt_pass * clone () { return new pass_late_warn_uninitialized (m_ctxt); }
bool gate () { return gate_warn_uninitialized (); }
unsigned int execute () { return execute_late_warn_uninitialized (); }
@@ -2084,3 +2211,65 @@ make_pass_late_warn_uninitialized (gcc::context *ctxt)
{
return new pass_late_warn_uninitialized (ctxt);
}
+
+
+static unsigned int
+execute_early_warn_uninitialized (void)
+{
+ /* Currently, this pass runs always but
+ execute_late_warn_uninitialized only runs with optimization. With
+ optimization we want to warn about possible uninitialized as late
+ as possible, thus don't do it here. However, without
+ optimization we need to warn here about "may be uninitialized".
+ */
+ calculate_dominance_info (CDI_POST_DOMINATORS);
+
+ warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
+
+ /* Post-dominator information can not be reliably updated. Free it
+ after the use. */
+
+ free_dominance_info (CDI_POST_DOMINATORS);
+ return 0;
+}
+
+
+namespace {
+
+const pass_data pass_data_early_warn_uninitialized =
+{
+ GIMPLE_PASS, /* type */
+ "*early_warn_uninitialized", /* name */
+ OPTGROUP_NONE, /* optinfo_flags */
+ true, /* has_gate */
+ true, /* has_execute */
+ TV_TREE_UNINIT, /* tv_id */
+ PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+};
+
+class pass_early_warn_uninitialized : public gimple_opt_pass
+{
+public:
+ pass_early_warn_uninitialized (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_early_warn_uninitialized, ctxt)
+ {}
+
+ /* opt_pass methods: */
+ bool gate () { return gate_warn_uninitialized (); }
+ unsigned int execute () { return execute_early_warn_uninitialized (); }
+
+}; // class pass_early_warn_uninitialized
+
+} // anon namespace
+
+gimple_opt_pass *
+make_pass_early_warn_uninitialized (gcc::context *ctxt)
+{
+ return new pass_early_warn_uninitialized (ctxt);
+}
+
+
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 83a265c43ac..421e200da9f 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "bitmap.h"
#include "pointer-set.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-inline.h"
#include "hashtab.h"
@@ -231,6 +231,135 @@ flush_pending_stmts (edge e)
redirect_edge_var_map_clear (e);
}
+
+/* Data structure used to count the number of dereferences to PTR
+ inside an expression. */
+struct count_ptr_d
+{
+ tree ptr;
+ unsigned num_stores;
+ unsigned num_loads;
+};
+
+
+/* Helper for count_uses_and_derefs. Called by walk_tree to look for
+ (ALIGN/MISALIGNED_)INDIRECT_REF nodes for the pointer passed in DATA. */
+
+static tree
+count_ptr_derefs (tree *tp, int *walk_subtrees, void *data)
+{
+ struct walk_stmt_info *wi_p = (struct walk_stmt_info *) data;
+ struct count_ptr_d *count_p = (struct count_ptr_d *) wi_p->info;
+
+ /* Do not walk inside ADDR_EXPR nodes. In the expression &ptr->fld,
+ pointer 'ptr' is *not* dereferenced, it is simply used to compute
+ the address of 'fld' as 'ptr + offsetof(fld)'. */
+ if (TREE_CODE (*tp) == ADDR_EXPR)
+ {
+ *walk_subtrees = 0;
+ return NULL_TREE;
+ }
+
+ if (TREE_CODE (*tp) == MEM_REF && TREE_OPERAND (*tp, 0) == count_p->ptr)
+ {
+ if (wi_p->is_lhs)
+ count_p->num_stores++;
+ else
+ count_p->num_loads++;
+ }
+
+ return NULL_TREE;
+}
+
+
+/* Count the number of direct and indirect uses for pointer PTR in
+ statement STMT. The number of direct uses is stored in
+ *NUM_USES_P. Indirect references are counted separately depending
+ on whether they are store or load operations. The counts are
+ stored in *NUM_STORES_P and *NUM_LOADS_P. */
+
+void
+count_uses_and_derefs (tree ptr, gimple stmt, unsigned *num_uses_p,
+ unsigned *num_loads_p, unsigned *num_stores_p)
+{
+ ssa_op_iter i;
+ tree use;
+
+ *num_uses_p = 0;
+ *num_loads_p = 0;
+ *num_stores_p = 0;
+
+ /* Find out the total number of uses of PTR in STMT. */
+ FOR_EACH_SSA_TREE_OPERAND (use, stmt, i, SSA_OP_USE)
+ if (use == ptr)
+ (*num_uses_p)++;
+
+ /* Now count the number of indirect references to PTR. This is
+ truly awful, but we don't have much choice. There are no parent
+ pointers inside INDIRECT_REFs, so an expression like
+ '*x_1 = foo (x_1, *x_1)' needs to be traversed piece by piece to
+ find all the indirect and direct uses of x_1 inside. The only
+ shortcut we can take is the fact that GIMPLE only allows
+ INDIRECT_REFs inside the expressions below. */
+ if (is_gimple_assign (stmt)
+ || gimple_code (stmt) == GIMPLE_RETURN
+ || gimple_code (stmt) == GIMPLE_ASM
+ || is_gimple_call (stmt))
+ {
+ struct walk_stmt_info wi;
+ struct count_ptr_d count;
+
+ count.ptr = ptr;
+ count.num_stores = 0;
+ count.num_loads = 0;
+
+ memset (&wi, 0, sizeof (wi));
+ wi.info = &count;
+ walk_gimple_op (stmt, count_ptr_derefs, &wi);
+
+ *num_stores_p = count.num_stores;
+ *num_loads_p = count.num_loads;
+ }
+
+ gcc_assert (*num_uses_p >= *num_loads_p + *num_stores_p);
+}
+
+
+/* Replace the LHS of STMT, an assignment, either a GIMPLE_ASSIGN or a
+ GIMPLE_CALL, with NLHS, in preparation for modifying the RHS to an
+ expression with a different value.
+
+ This will update any annotations (say debug bind stmts) referring
+ to the original LHS, so that they use the RHS instead. This is
+ done even if NLHS and LHS are the same, for it is understood that
+ the RHS will be modified afterwards, and NLHS will not be assigned
+ an equivalent value.
+
+ Adjusting any non-annotation uses of the LHS, if needed, is a
+ responsibility of the caller.
+
+ The effect of this call should be pretty much the same as that of
+ inserting a copy of STMT before STMT, and then removing the
+ original stmt, at which time gsi_remove() would have update
+ annotations, but using this function saves all the inserting,
+ copying and removing. */
+
+void
+gimple_replace_ssa_lhs (gimple stmt, tree nlhs)
+{
+ if (MAY_HAVE_DEBUG_STMTS)
+ {
+ tree lhs = gimple_get_lhs (stmt);
+
+ gcc_assert (SSA_NAME_DEF_STMT (lhs) == stmt);
+
+ insert_debug_temp_for_var_def (NULL, lhs);
+ }
+
+ gimple_set_lhs (stmt, nlhs);
+}
+
+
/* Given a tree for an expression for which we might want to emit
locations or values in debug information (generally a variable, but
we might deal with other kinds of trees in the future), return the
@@ -1084,10 +1213,20 @@ static unsigned int
execute_init_datastructures (void)
{
/* Allocate hash tables, arrays and other structures. */
+ gcc_assert (!cfun->gimple_df);
init_tree_ssa (cfun);
return 0;
}
+/* Gate for IPCP optimization. */
+
+static bool
+gate_init_datastructures (void)
+{
+ /* Do nothing for funcions that was produced already in SSA form. */
+ return !(cfun->curr_properties & PROP_ssa);
+}
+
namespace {
const pass_data pass_data_init_datastructures =
@@ -1095,7 +1234,7 @@ const pass_data pass_data_init_datastructures =
GIMPLE_PASS, /* type */
"*init_datastructures", /* name */
OPTGROUP_NONE, /* optinfo_flags */
- false, /* has_gate */
+ true, /* has_gate */
true, /* has_execute */
TV_NONE, /* tv_id */
PROP_cfg, /* properties_required */
@@ -1108,11 +1247,12 @@ const pass_data pass_data_init_datastructures =
class pass_init_datastructures : public gimple_opt_pass
{
public:
- pass_init_datastructures(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_init_datastructures, ctxt)
+ pass_init_datastructures (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_init_datastructures, ctxt)
{}
/* opt_pass methods: */
+ bool gate () { return gate_init_datastructures (); }
unsigned int execute () { return execute_init_datastructures (); }
}; // class pass_init_datastructures
@@ -1149,260 +1289,6 @@ delete_tree_ssa (void)
redirect_edge_var_map_destroy ();
}
-/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a
- useless type conversion, otherwise return false.
-
- 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))
- {
- /* Do not lose casts between pointers to different address spaces. */
- if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
- != TYPE_ADDR_SPACE (TREE_TYPE (inner_type)))
- return false;
- }
-
- /* From now on qualifiers on value types do not matter. */
- inner_type = TYPE_MAIN_VARIANT (inner_type);
- outer_type = TYPE_MAIN_VARIANT (outer_type);
-
- if (inner_type == outer_type)
- return true;
-
- /* If we know the canonical types, compare them. */
- if (TYPE_CANONICAL (inner_type)
- && TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type))
- return true;
-
- /* 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
- conversion is not necessary if they have the same mode and
- signedness and precision, and both or neither are boolean. */
- if (INTEGRAL_TYPE_P (inner_type)
- && INTEGRAL_TYPE_P (outer_type))
- {
- /* Preserve changes in signedness or precision. */
- if (TYPE_UNSIGNED (inner_type) != TYPE_UNSIGNED (outer_type)
- || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
- return false;
-
- /* Preserve conversions to/from BOOLEAN_TYPE if types are not
- of precision one. */
- if (((TREE_CODE (inner_type) == BOOLEAN_TYPE)
- != (TREE_CODE (outer_type) == BOOLEAN_TYPE))
- && TYPE_PRECISION (outer_type) != 1)
- return false;
-
- /* We don't need to preserve changes in the types minimum or
- maximum value in general as these do not generate code
- unless the types precisions are different. */
- return true;
- }
-
- /* Scalar floating point types with the same mode are compatible. */
- else if (SCALAR_FLOAT_TYPE_P (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))
- {
- /* Do not lose casts to function pointer types. */
- if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE)
- && !(TREE_CODE (TREE_TYPE (inner_type)) == FUNCTION_TYPE
- || TREE_CODE (TREE_TYPE (inner_type)) == METHOD_TYPE))
- return false;
-
- /* We do not care for const qualification of the pointed-to types
- as const qualification has no semantic value to the middle-end. */
-
- /* Otherwise pointers/references are equivalent. */
- return true;
- }
-
- /* Recurse for complex types. */
- else if (TREE_CODE (inner_type) == COMPLEX_TYPE
- && TREE_CODE (outer_type) == COMPLEX_TYPE)
- return useless_type_conversion_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
-
- /* Recurse for vector types with the same number of subparts. */
- else if (TREE_CODE (inner_type) == VECTOR_TYPE
- && TREE_CODE (outer_type) == VECTOR_TYPE
- && TYPE_PRECISION (inner_type) == TYPE_PRECISION (outer_type))
- return useless_type_conversion_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type));
-
- else if (TREE_CODE (inner_type) == ARRAY_TYPE
- && TREE_CODE (outer_type) == ARRAY_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 (!TYPE_DOMAIN (inner_type)
- && TYPE_DOMAIN (outer_type))
- return false;
-
- /* 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;
-
- /* 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));
- }
-
- 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;
-
- /* If the return types are not compatible bail out. */
- if (!useless_type_conversion_p (TREE_TYPE (outer_type),
- TREE_TYPE (inner_type)))
- return false;
-
- /* 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;
-
- /* A conversion to an unprototyped argument list is ok. */
- if (!prototype_p (outer_type))
- return true;
-
- /* If the unqualified 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
- (TYPE_MAIN_VARIANT (TREE_VALUE (outer_parm)),
- TYPE_MAIN_VARIANT (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;
-
- /* Defer to the target if necessary. */
- if (TYPE_ATTRIBUTES (inner_type) || TYPE_ATTRIBUTES (outer_type))
- return comp_type_attributes (outer_type, inner_type) != 0;
-
- return true;
- }
-
- /* 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
- to the other is not required. Otherwise return false. */
-
-bool
-types_compatible_p (tree type1, tree type2)
-{
- return (type1 == type2
- || (useless_type_conversion_p (type1, type2)
- && useless_type_conversion_p (type2, type1)));
-}
-
/* Return true if EXPR is a useless type conversion, otherwise return
false. */
@@ -1436,321 +1322,28 @@ tree_ssa_strip_useless_type_conversions (tree exp)
}
-/* Internal helper for walk_use_def_chains. VAR, FN and DATA are as
- described in walk_use_def_chains.
-
- VISITED is a pointer set used to mark visited SSA_NAMEs to avoid
- infinite loops. We used to have a bitmap for this to just mark
- SSA versions we had visited. But non-sparse bitmaps are way too
- expensive, while sparse bitmaps may cause quadratic behavior.
-
- IS_DFS is true if the caller wants to perform a depth-first search
- when visiting PHI nodes. A DFS will visit each PHI argument and
- call FN after each one. Otherwise, all the arguments are
- visited first and then FN is called with each of the visited
- arguments in a separate pass. */
+/* Return true if T, an SSA_NAME, has an undefined value. */
-static bool
-walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data,
- struct pointer_set_t *visited, bool is_dfs)
+bool
+ssa_undefined_value_p (tree t)
{
- gimple def_stmt;
+ tree var = SSA_NAME_VAR (t);
- if (pointer_set_insert (visited, var))
+ if (!var)
+ ;
+ /* Parameters get their initial value from the function entry. */
+ else if (TREE_CODE (var) == PARM_DECL)
+ return false;
+ /* When returning by reference the return address is actually a hidden
+ parameter. */
+ else if (TREE_CODE (var) == RESULT_DECL && DECL_BY_REFERENCE (var))
+ return false;
+ /* Hard register variables get their initial value from the ether. */
+ else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
return false;
- def_stmt = SSA_NAME_DEF_STMT (var);
-
- if (gimple_code (def_stmt) != GIMPLE_PHI)
- {
- /* If we reached the end of the use-def chain, call FN. */
- return fn (var, def_stmt, data);
- }
- else
- {
- size_t i;
-
- /* When doing a breadth-first search, call FN before following the
- use-def links for each argument. */
- if (!is_dfs)
- for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
- if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data))
- return true;
-
- /* Follow use-def links out of each PHI argument. */
- for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
- {
- tree arg = gimple_phi_arg_def (def_stmt, i);
-
- /* ARG may be NULL for newly introduced PHI nodes. */
- if (arg
- && TREE_CODE (arg) == SSA_NAME
- && walk_use_def_chains_1 (arg, fn, data, visited, is_dfs))
- return true;
- }
-
- /* When doing a depth-first search, call FN after following the
- use-def links for each argument. */
- if (is_dfs)
- for (i = 0; i < gimple_phi_num_args (def_stmt); i++)
- if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data))
- return true;
- }
-
- return false;
-}
-
-
-
-/* Walk use-def chains starting at the SSA variable VAR. Call
- function FN at each reaching definition found. FN takes three
- arguments: VAR, its defining statement (DEF_STMT) and a generic
- pointer to whatever state information that FN may want to maintain
- (DATA). FN is able to stop the walk by returning true, otherwise
- in order to continue the walk, FN should return false.
-
- Note, that if DEF_STMT is a PHI node, the semantics are slightly
- different. The first argument to FN is no longer the original
- variable VAR, but the PHI argument currently being examined. If FN
- wants to get at VAR, it should call PHI_RESULT (PHI).
-
- If IS_DFS is true, this function will:
-
- 1- walk the use-def chains for all the PHI arguments, and,
- 2- call (*FN) (ARG, PHI, DATA) on all the PHI arguments.
-
- If IS_DFS is false, the two steps above are done in reverse order
- (i.e., a breadth-first search). */
-
-void
-walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data,
- bool is_dfs)
-{
- gimple def_stmt;
-
- gcc_assert (TREE_CODE (var) == SSA_NAME);
-
- def_stmt = SSA_NAME_DEF_STMT (var);
-
- /* We only need to recurse if the reaching definition comes from a PHI
- node. */
- if (gimple_code (def_stmt) != GIMPLE_PHI)
- (*fn) (var, def_stmt, data);
- else
- {
- struct pointer_set_t *visited = pointer_set_create ();
- walk_use_def_chains_1 (var, fn, data, visited, is_dfs);
- pointer_set_destroy (visited);
- }
-}
-
-
-/* Emit warnings for uninitialized variables. This is done in two passes.
-
- The first pass notices real uses of SSA names with undefined values.
- Such uses are unconditionally uninitialized, and we can be certain that
- such a use is a mistake. This pass is run before most optimizations,
- so that we catch as many as we can.
-
- The second pass follows PHI nodes to find uses that are potentially
- uninitialized. In this case we can't necessarily prove that the use
- is really uninitialized. This pass is run after most optimizations,
- so that we thread as many jumps and possible, and delete as much dead
- code as possible, in order to reduce false positives. We also look
- again for plain uninitialized variables, since optimization may have
- changed conditionally uninitialized to unconditionally uninitialized. */
-
-/* Emit a warning for EXPR based on variable VAR at the point in the
- program T, an SSA_NAME, is used being uninitialized. The exact
- warning text is in MSGID and LOCUS may contain a location or be null.
- WC is the warning code. */
-
-void
-warn_uninit (enum opt_code wc, tree t,
- tree expr, tree var, const char *gmsgid, void *data)
-{
- gimple context = (gimple) data;
- location_t location, cfun_loc;
- expanded_location xloc, floc;
-
- if (!ssa_undefined_value_p (t))
- return;
-
- /* TREE_NO_WARNING either means we already warned, or the front end
- wishes to suppress the warning. */
- if ((context
- && (gimple_no_warning_p (context)
- || (gimple_assign_single_p (context)
- && TREE_NO_WARNING (gimple_assign_rhs1 (context)))))
- || TREE_NO_WARNING (expr))
- return;
-
- location = (context != NULL && gimple_has_location (context))
- ? gimple_location (context)
- : DECL_SOURCE_LOCATION (var);
- location = linemap_resolve_location (line_table, location,
- LRK_SPELLING_LOCATION,
- NULL);
- cfun_loc = DECL_SOURCE_LOCATION (cfun->decl);
- xloc = expand_location (location);
- floc = expand_location (cfun_loc);
- if (warning_at (location, wc, gmsgid, expr))
- {
- TREE_NO_WARNING (expr) = 1;
-
- if (location == DECL_SOURCE_LOCATION (var))
- return;
- if (xloc.file != floc.file
- || linemap_location_before_p (line_table,
- location, cfun_loc)
- || linemap_location_before_p (line_table,
- cfun->function_end_locus,
- location))
- inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var);
- }
-}
-
-unsigned int
-warn_uninitialized_vars (bool warn_possibly_uninitialized)
-{
- gimple_stmt_iterator gsi;
- basic_block bb;
-
- FOR_EACH_BB (bb)
- {
- bool always_executed = dominated_by_p (CDI_POST_DOMINATORS,
- single_succ (ENTRY_BLOCK_PTR), bb);
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- {
- gimple stmt = gsi_stmt (gsi);
- use_operand_p use_p;
- ssa_op_iter op_iter;
- tree use;
-
- if (is_gimple_debug (stmt))
- continue;
-
- /* We only do data flow with SSA_NAMEs, so that's all we
- can warn about. */
- FOR_EACH_SSA_USE_OPERAND (use_p, stmt, op_iter, SSA_OP_USE)
- {
- use = USE_FROM_PTR (use_p);
- if (always_executed)
- warn_uninit (OPT_Wuninitialized, use,
- SSA_NAME_VAR (use), SSA_NAME_VAR (use),
- "%qD is used uninitialized in this function",
- stmt);
- else if (warn_possibly_uninitialized)
- warn_uninit (OPT_Wmaybe_uninitialized, use,
- SSA_NAME_VAR (use), SSA_NAME_VAR (use),
- "%qD may be used uninitialized in this function",
- stmt);
- }
-
- /* For memory the only cheap thing we can do is see if we
- have a use of the default def of the virtual operand.
- ??? Note that at -O0 we do not have virtual operands.
- ??? Not so cheap would be to use the alias oracle via
- walk_aliased_vdefs, if we don't find any aliasing vdef
- warn as is-used-uninitialized, if we don't find an aliasing
- vdef that kills our use (stmt_kills_ref_p), warn as
- may-be-used-uninitialized. But this walk is quadratic and
- so must be limited which means we would miss warning
- opportunities. */
- use = gimple_vuse (stmt);
- if (use
- && gimple_assign_single_p (stmt)
- && !gimple_vdef (stmt)
- && SSA_NAME_IS_DEFAULT_DEF (use))
- {
- tree rhs = gimple_assign_rhs1 (stmt);
- tree base = get_base_address (rhs);
-
- /* Do not warn if it can be initialized outside this function. */
- if (TREE_CODE (base) != VAR_DECL
- || DECL_HARD_REGISTER (base)
- || is_global_var (base))
- continue;
-
- if (always_executed)
- warn_uninit (OPT_Wuninitialized, use,
- gimple_assign_rhs1 (stmt), base,
- "%qE is used uninitialized in this function",
- stmt);
- else if (warn_possibly_uninitialized)
- warn_uninit (OPT_Wmaybe_uninitialized, use,
- gimple_assign_rhs1 (stmt), base,
- "%qE may be used uninitialized in this function",
- stmt);
- }
- }
- }
-
- return 0;
-}
-
-static unsigned int
-execute_early_warn_uninitialized (void)
-{
- /* Currently, this pass runs always but
- execute_late_warn_uninitialized only runs with optimization. With
- optimization we want to warn about possible uninitialized as late
- as possible, thus don't do it here. However, without
- optimization we need to warn here about "may be uninitialized".
- */
- calculate_dominance_info (CDI_POST_DOMINATORS);
-
- warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize);
-
- /* Post-dominator information can not be reliably updated. Free it
- after the use. */
-
- free_dominance_info (CDI_POST_DOMINATORS);
- return 0;
-}
-
-static bool
-gate_warn_uninitialized (void)
-{
- return warn_uninitialized != 0;
-}
-
-namespace {
-
-const pass_data pass_data_early_warn_uninitialized =
-{
- GIMPLE_PASS, /* type */
- "*early_warn_uninitialized", /* name */
- OPTGROUP_NONE, /* optinfo_flags */
- true, /* has_gate */
- true, /* has_execute */
- TV_TREE_UNINIT, /* tv_id */
- PROP_ssa, /* properties_required */
- 0, /* properties_provided */
- 0, /* properties_destroyed */
- 0, /* todo_flags_start */
- 0, /* todo_flags_finish */
-};
-
-class pass_early_warn_uninitialized : public gimple_opt_pass
-{
-public:
- pass_early_warn_uninitialized(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_early_warn_uninitialized, ctxt)
- {}
-
- /* opt_pass methods: */
- bool gate () { return gate_warn_uninitialized (); }
- unsigned int execute () { return execute_early_warn_uninitialized (); }
-
-}; // class pass_early_warn_uninitialized
-
-} // anon namespace
-
-gimple_opt_pass *
-make_pass_early_warn_uninitialized (gcc::context *ctxt)
-{
- return new pass_early_warn_uninitialized (ctxt);
+ /* The value is undefined iff its definition statement is empty. */
+ return gimple_nop_p (SSA_NAME_DEF_STMT (t));
}
@@ -2185,8 +1778,8 @@ const pass_data pass_data_update_address_taken =
class pass_update_address_taken : public gimple_opt_pass
{
public:
- pass_update_address_taken(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_update_address_taken, ctxt)
+ pass_update_address_taken (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_update_address_taken, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssa.h b/gcc/tree-ssa.h
new file mode 100644
index 00000000000..bca35b58755
--- /dev/null
+++ b/gcc/tree-ssa.h
@@ -0,0 +1,87 @@
+/* Header file for any pass which requires SSA routines.
+ Copyright (C) 2013 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/>. */
+
+#ifndef GCC_TREE_SSA_H
+#define GCC_TREE_SSA_H
+
+#include "tree-flow.h"
+#include "tree-ssanames.h"
+
+/* Mapping for redirected edges. */
+struct _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;
+
+/* A vector of var maps. */
+typedef vec<edge_var_map, va_heap, vl_embed> edge_var_map_vector;
+
+
+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);
+extern void redirect_edge_var_map_destroy (void);
+extern edge ssa_redirect_edge (edge, basic_block);
+extern void flush_pending_stmts (edge);
+extern void count_uses_and_derefs (tree, gimple, unsigned *, unsigned *,
+ unsigned *);
+extern void gimple_replace_ssa_lhs (gimple, tree);
+extern tree target_for_debug_bind (tree);
+extern void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree);
+extern void insert_debug_temps_for_defs (gimple_stmt_iterator *);
+extern void reset_debug_uses (gimple);
+extern void release_defs_bitset (bitmap toremove);
+extern void verify_ssa (bool);
+extern void init_tree_ssa (struct function *);
+extern void delete_tree_ssa (void);
+extern bool tree_ssa_useless_type_conversion (tree);
+extern tree tree_ssa_strip_useless_type_conversions (tree);
+
+extern bool ssa_undefined_value_p (tree);
+extern void execute_update_addresses_taken (void);
+
+/* Given an edge_var_map V, return the PHI arg definition. */
+
+static inline tree
+redirect_edge_var_map_def (edge_var_map *v)
+{
+ return v->def;
+}
+
+/* Given an edge_var_map V, return the PHI result. */
+
+static inline tree
+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;
+}
+
+
+#endif /* GCC_TREE_SSA_H */
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index a6af3da192c..a51f60307ec 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
/* Rewriting a function into SSA form can create a huge number of SSA_NAMEs,
@@ -60,6 +60,9 @@ along with GCC; see the file COPYING3. If not see
unsigned int ssa_name_nodes_reused;
unsigned int ssa_name_nodes_created;
+#define FREE_SSANAMES(fun) (fun)->gimple_df->free_ssanames
+
+
/* Initialize management of SSA_NAMEs to default SIZE. If SIZE is
zero use default. */
@@ -151,7 +154,11 @@ make_ssa_name_fn (struct function *fn, tree var, gimple stmt)
SET_SSA_NAME_VAR_OR_IDENTIFIER (t, var);
}
SSA_NAME_DEF_STMT (t) = stmt;
- SSA_NAME_PTR_INFO (t) = NULL;
+ if (POINTER_TYPE_P (TREE_TYPE (t)))
+ SSA_NAME_PTR_INFO (t) = NULL;
+ else
+ SSA_NAME_RANGE_INFO (t) = NULL;
+
SSA_NAME_IN_FREE_LIST (t) = 0;
SSA_NAME_IS_DEFAULT_DEF (t) = 0;
imm = &(SSA_NAME_IMM_USE_NODE (t));
@@ -163,6 +170,62 @@ make_ssa_name_fn (struct function *fn, tree var, gimple stmt)
return t;
}
+/* Store range information MIN, and MAX to tree ssa_name NAME. */
+
+void
+set_range_info (tree name, double_int min, double_int max)
+{
+ gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
+ range_info_def *ri = SSA_NAME_RANGE_INFO (name);
+
+ /* Allocate if not available. */
+ if (ri == NULL)
+ {
+ ri = ggc_alloc_cleared_range_info_def ();
+ SSA_NAME_RANGE_INFO (name) = ri;
+ }
+
+ /* Set the values. */
+ ri->min = min;
+ ri->max = max;
+}
+
+
+/* Gets range information MIN, MAX and returns enum value_range_type
+ corresponding to tree ssa_name NAME. enum value_range_type returned
+ is used to determine if MIN and MAX are valid values. */
+
+enum value_range_type
+get_range_info (tree name, double_int *min, double_int *max)
+{
+ enum value_range_type range_type;
+ gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
+ gcc_assert (min && max);
+ range_info_def *ri = SSA_NAME_RANGE_INFO (name);
+
+ /* Return VR_VARYING for SSA_NAMEs with NULL RANGE_INFO or SSA_NAMEs
+ with integral types width > 2 * HOST_BITS_PER_WIDE_INT precision. */
+ if (!ri || (GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (name)))
+ > 2 * HOST_BITS_PER_WIDE_INT))
+ return VR_VARYING;
+
+ /* If min > max, it is VR_ANTI_RANGE. */
+ if (ri->min.cmp (ri->max, TYPE_UNSIGNED (TREE_TYPE (name))) == 1)
+ {
+ /* VR_ANTI_RANGE ~[min, max] is encoded as [max + 1, min - 1]. */
+ range_type = VR_ANTI_RANGE;
+ *min = ri->max + double_int_one;
+ *max = ri->min - double_int_one;
+ }
+ else
+ {
+ /* Otherwise (when min <= max), it is VR_RANGE. */
+ range_type = VR_RANGE;
+ *min = ri->min;
+ *max = ri->max;
+ }
+ return range_type;
+}
/* We no longer need the SSA_NAME expression VAR, release it so that
it may be reused.
@@ -359,6 +422,26 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
SSA_NAME_PTR_INFO (name) = new_ptr_info;
}
+/* Creates a duplicate of the range_info_def at RANGE_INFO for use by
+ the SSA name NAME. */
+void
+duplicate_ssa_name_range_info (tree name, struct range_info_def *range_info)
+{
+ struct range_info_def *new_range_info;
+
+ gcc_assert (!POINTER_TYPE_P (TREE_TYPE (name)));
+ gcc_assert (!SSA_NAME_RANGE_INFO (name));
+
+ if (!range_info)
+ return;
+
+ new_range_info = ggc_alloc_range_info_def ();
+ *new_range_info = *range_info;
+
+ SSA_NAME_RANGE_INFO (name) = new_range_info;
+}
+
+
/* Creates a duplicate of a ssa name NAME tobe defined by statement STMT
in function FN. */
@@ -367,10 +450,20 @@ tree
duplicate_ssa_name_fn (struct function *fn, tree name, gimple stmt)
{
tree new_name = copy_ssa_name_fn (fn, name, stmt);
- struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
+ if (POINTER_TYPE_P (TREE_TYPE (name)))
+ {
+ struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
- if (old_ptr_info)
- duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
+ if (old_ptr_info)
+ duplicate_ssa_name_ptr_info (new_name, old_ptr_info);
+ }
+ else
+ {
+ struct range_info_def *old_range_info = SSA_NAME_RANGE_INFO (name);
+
+ if (old_range_info)
+ duplicate_ssa_name_range_info (new_name, old_range_info);
+ }
return new_name;
}
@@ -460,8 +553,8 @@ const pass_data pass_data_release_ssa_names =
class pass_release_ssa_names : public gimple_opt_pass
{
public:
- pass_release_ssa_names(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_release_ssa_names, ctxt)
+ pass_release_ssa_names (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_release_ssa_names, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h
new file mode 100644
index 00000000000..f80e0b2ce33
--- /dev/null
+++ b/gcc/tree-ssanames.h
@@ -0,0 +1,138 @@
+/* SSA name expresssons routines
+ Copyright (C) 2013 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/>. */
+
+#ifndef GCC_TREE_SSANAMES_H
+#define GCC_TREE_SSANAMES_H
+
+/* Aliasing information for SSA_NAMEs representing pointer variables. */
+
+struct GTY(()) ptr_info_def
+{
+ /* The points-to solution. */
+ struct pt_solution pt;
+
+ /* Alignment and misalignment of the pointer in bytes. Together
+ align and misalign specify low known bits of the pointer.
+ ptr & (align - 1) == misalign. */
+
+ /* When known, this is the power-of-two byte alignment of the object this
+ pointer points into. This is usually DECL_ALIGN_UNIT for decls and
+ MALLOC_ABI_ALIGNMENT for allocated storage. When the alignment is not
+ known, it is zero. Do not access directly but use functions
+ get_ptr_info_alignment, set_ptr_info_alignment,
+ mark_ptr_info_alignment_unknown and similar. */
+ unsigned int align;
+
+ /* When alignment is known, the byte offset this pointer differs from the
+ above alignment. Access only through the same helper functions as align
+ above. */
+ unsigned int misalign;
+};
+
+/* Value range information for SSA_NAMEs representing non-pointer variables. */
+
+struct GTY (()) range_info_def {
+ /* Minimum for value range. */
+ double_int min;
+ /* Maximum for value range. */
+ double_int max;
+};
+
+
+#define SSANAMES(fun) (fun)->gimple_df->ssa_names
+#define MODIFIED_NORETURN_CALLS(fun) (fun)->gimple_df->modified_noreturn_calls
+#define DEFAULT_DEFS(fun) (fun)->gimple_df->default_defs
+
+#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
+#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
+
+
+/* Type of value ranges. See value_range_d In tree-vrp.c for a
+ description of these types. */
+enum value_range_type { VR_UNDEFINED, VR_RANGE, VR_ANTI_RANGE, VR_VARYING };
+
+/* Sets the value range to SSA. */
+extern void set_range_info (tree ssa, double_int min, double_int max);
+/* Gets the value range from SSA. */
+extern enum value_range_type get_range_info (tree name, double_int *min,
+ double_int *max);
+extern void init_ssanames (struct function *, int);
+extern void fini_ssanames (void);
+extern void ssanames_print_statistics (void);
+extern tree make_ssa_name_fn (struct function *, tree, gimple);
+extern void release_ssa_name (tree);
+extern bool get_ptr_info_alignment (struct ptr_info_def *, unsigned int *,
+ unsigned int *);
+extern void mark_ptr_info_alignment_unknown (struct ptr_info_def *);
+extern void set_ptr_info_alignment (struct ptr_info_def *, unsigned int,
+ unsigned int);
+extern void adjust_ptr_info_misalignment (struct ptr_info_def *,
+ unsigned int);
+extern struct ptr_info_def *get_ptr_info (tree);
+
+extern tree copy_ssa_name_fn (struct function *, tree, gimple);
+extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
+extern tree duplicate_ssa_name_fn (struct function *, tree, gimple);
+extern void duplicate_ssa_name_range_info (tree, struct range_info_def *);
+extern void release_defs (gimple);
+extern void replace_ssa_name_symbol (tree, tree);
+
+
+/* Return an SSA_NAME node for variable VAR defined in statement STMT
+ in function cfun. */
+
+static inline tree
+make_ssa_name (tree var, gimple stmt)
+{
+ return make_ssa_name_fn (cfun, var, stmt);
+}
+
+/* Return an SSA_NAME node using the template SSA name NAME defined in
+ statement STMT in function cfun. */
+
+static inline tree
+copy_ssa_name (tree var, gimple stmt)
+{
+ return copy_ssa_name_fn (cfun, var, stmt);
+}
+
+/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
+ in function cfun. */
+
+static inline tree
+duplicate_ssa_name (tree var, gimple stmt)
+{
+ return duplicate_ssa_name_fn (cfun, var, stmt);
+}
+
+/* Return an anonymous SSA_NAME node for type TYPE defined in statement STMT
+ in function cfun. Arrange so that it uses NAME in dumps. */
+
+static inline tree
+make_temp_ssa_name (tree type, gimple stmt, const char *name)
+{
+ tree ssa_name;
+ gcc_checking_assert (TYPE_P (type));
+ ssa_name = make_ssa_name_fn (cfun, type, stmt);
+ SET_SSA_NAME_VAR_OR_IDENTIFIER (ssa_name, get_identifier (name));
+ return ssa_name;
+}
+
+
+#endif /* GCC_TREE_SSANAMES_H */
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index e4eb60ae042..d7cd291f3a8 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "gimple-pretty-print.h"
#include "target.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-stdarg.h"
@@ -1005,8 +1005,8 @@ const pass_data pass_data_stdarg =
class pass_stdarg : public gimple_opt_pass
{
public:
- pass_stdarg(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_stdarg, ctxt)
+ pass_stdarg (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_stdarg, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c
index a86bcd87c1a..c36d4f6368c 100644
--- a/gcc/tree-streamer-in.c
+++ b/gcc/tree-streamer-in.c
@@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "diagnostic.h"
#include "tree.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-streamer.h"
#include "data-streamer.h"
#include "streamer-hooks.h"
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 0d128981e38..a0d33067a8f 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -31,7 +31,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "flags.h"
#include "tree.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-flow-inline.h"
#include "tree-ssa-operands.h"
#include "tree-pass.h"
@@ -365,7 +365,7 @@ emit_case_bit_tests (gimple swtch, tree index_expr,
test[k].lo |= (HOST_WIDE_INT) 1 << j;
}
- qsort (test, count, sizeof(*test), case_bit_test_cmp);
+ qsort (test, count, sizeof (*test), case_bit_test_cmp);
/* We generate two jumps to the default case label.
Split the default edge, so that we don't have to do any PHI node
@@ -1485,8 +1485,8 @@ const pass_data pass_data_convert_switch =
class pass_convert_switch : public gimple_opt_pass
{
public:
- pass_convert_switch(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_convert_switch, ctxt)
+ pass_convert_switch (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_convert_switch, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index 289b75a09bc..721c8314b4a 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "function.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple-pretty-print.h"
#include "except.h"
#include "tree-pass.h"
@@ -1083,12 +1083,12 @@ const pass_data pass_data_tail_recursion =
class pass_tail_recursion : public gimple_opt_pass
{
public:
- pass_tail_recursion(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tail_recursion, ctxt)
+ pass_tail_recursion (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tail_recursion, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_tail_recursion (ctxt_); }
+ opt_pass * clone () { return new pass_tail_recursion (m_ctxt); }
bool gate () { return gate_tail_calls (); }
unsigned int execute () { return execute_tail_recursion (); }
@@ -1122,8 +1122,8 @@ const pass_data pass_data_tail_calls =
class pass_tail_calls : public gimple_opt_pass
{
public:
- pass_tail_calls(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tail_calls, ctxt)
+ pass_tail_calls (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tail_calls, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 230e302acf6..e7b2f334401 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "dumpfile.h"
#include "cfgloop.h"
#include "tree-chrec.h"
@@ -59,8 +59,8 @@ vect_lanes_optab_supported_p (const char *name, convert_optab optab,
if (array_mode == BLKmode)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no array mode for %s[" HOST_WIDE_INT_PRINT_DEC "]",
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "no array mode for %s[" HOST_WIDE_INT_PRINT_DEC "]\n",
GET_MODE_NAME (mode), count);
return false;
}
@@ -69,14 +69,14 @@ vect_lanes_optab_supported_p (const char *name, convert_optab optab,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "cannot use %s<%s><%s>", name,
+ "cannot use %s<%s><%s>\n", name,
GET_MODE_NAME (array_mode), GET_MODE_NAME (mode));
return false;
}
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "can use %s<%s><%s>", name, GET_MODE_NAME (array_mode),
+ "can use %s<%s><%s>\n", name, GET_MODE_NAME (array_mode),
GET_MODE_NAME (mode));
return true;
@@ -182,13 +182,15 @@ vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo)
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr)));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr)));
+ dump_printf (MSG_NOTE, "\n");
}
if (optimize_loop_nest_for_size_p (loop))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "versioning not supported when optimizing for size.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "versioning not supported when optimizing"
+ " for size.\n");
return false;
}
@@ -196,8 +198,8 @@ vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo)
if (loop->inner)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "versioning not yet supported for outer-loops.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "versioning not yet supported for outer-loops.\n");
return false;
}
@@ -207,9 +209,9 @@ vect_mark_for_runtime_alias_test (ddr_p ddr, loop_vec_info loop_vinfo)
|| TREE_CODE (DR_STEP (DDR_B (ddr))) != INTEGER_CST)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"versioning not yet supported for non-constant "
- "step");
+ "step\n");
return false;
}
@@ -276,6 +278,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
dump_printf (MSG_MISSED_OPTIMIZATION, " and ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
DR_REF (drb));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return true;
}
@@ -290,6 +293,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
dump_printf (MSG_MISSED_OPTIMIZATION, " and ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
DR_REF (drb));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Add to list of ddrs that need to be tested at run-time. */
@@ -321,18 +325,20 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
dump_printf (MSG_MISSED_OPTIMIZATION, " and ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
DR_REF (drb));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return true;
}
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"versioning for alias required: "
"bad dist vector for ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_MISSED_OPTIMIZATION, " and ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Add to list of ddrs that need to be tested at run-time. */
return !vect_mark_for_runtime_alias_test (ddr, loop_vinfo);
@@ -345,17 +351,18 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "dependence distance = %d.", dist);
+ "dependence distance = %d.\n", dist);
if (dist == 0)
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_NOTE, vect_location,
- "dependence distance == 0 between ");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "dependence distance == 0 between ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* When we perform grouped accesses and perform implicit CSE
@@ -383,7 +390,8 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "READ_WRITE dependence in interleaving.");
+ "READ_WRITE dependence in interleaving."
+ "\n");
return true;
}
}
@@ -398,7 +406,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
distance is negative. */
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "dependence distance negative.");
+ "dependence distance negative.\n");
continue;
}
@@ -410,8 +418,8 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
*max_vf = abs (dist);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "adjusting maximal vectorization factor to %i",
- *max_vf);
+ "adjusting maximal vectorization factor to %i\n",
+ *max_vf);
}
if (abs (dist) >= *max_vf)
@@ -420,18 +428,19 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
vectorization is concerned, in this case. */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "dependence distance >= VF.");
+ "dependence distance >= VF.\n");
continue;
}
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized, possible dependence "
- "between data-refs ");
+ "not vectorized, possible dependence "
+ "between data-refs ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_NOTE, "\n");
}
return true;
@@ -454,7 +463,7 @@ vect_analyze_data_ref_dependences (loop_vec_info loop_vinfo, int *max_vf)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_analyze_data_ref_dependences ===");
+ "=== vect_analyze_data_ref_dependences ===\n");
if (!compute_all_dependences (LOOP_VINFO_DATAREFS (loop_vinfo),
&LOOP_VINFO_DDRS (loop_vinfo),
@@ -515,6 +524,7 @@ vect_slp_analyze_data_ref_dependence (struct data_dependence_relation *ddr)
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_MISSED_OPTIMIZATION, " and ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* We do not vectorize basic blocks with write-write dependencies. */
@@ -536,6 +546,7 @@ vect_slp_analyze_data_ref_dependence (struct data_dependence_relation *ddr)
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_NOTE, "\n");
}
/* Do not vectorize basic blocks with write-write dependences. */
@@ -600,7 +611,7 @@ vect_slp_analyze_data_ref_dependences (bb_vec_info bb_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_slp_analyze_data_ref_dependences ===");
+ "=== vect_slp_analyze_data_ref_dependences ===\n");
if (!compute_all_dependences (BB_VINFO_DATAREFS (bb_vinfo),
&BB_VINFO_DDRS (bb_vinfo),
@@ -643,7 +654,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_compute_data_ref_alignment:");
+ "vect_compute_data_ref_alignment:\n");
if (loop_vinfo)
loop = LOOP_VINFO_LOOP (loop_vinfo);
@@ -676,7 +687,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "inner step divides the vector-size.");
+ "inner step divides the vector-size.\n");
misalign = STMT_VINFO_DR_INIT (stmt_info);
aligned_to = STMT_VINFO_DR_ALIGNED_TO (stmt_info);
base_addr = STMT_VINFO_DR_BASE_ADDRESS (stmt_info);
@@ -685,7 +696,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "inner step doesn't divide the vector-size.");
+ "inner step doesn't divide the vector-size.\n");
misalign = NULL_TREE;
}
}
@@ -703,8 +714,8 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
if (dr_step % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "SLP: step doesn't divide the vector-size.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "SLP: step doesn't divide the vector-size.\n");
misalign = NULL_TREE;
}
}
@@ -718,8 +729,9 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Unknown alignment for access: ");
+ "Unknown alignment for access: ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, base);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return true;
}
@@ -748,8 +760,9 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
- "can't force alignment of ref: ");
+ "can't force alignment of ref: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, ref);
+ dump_printf (MSG_NOTE, "\n");
}
return true;
}
@@ -761,6 +774,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
{
dump_printf_loc (MSG_NOTE, vect_location, "force alignment of ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, ref);
+ dump_printf (MSG_NOTE, "\n");
}
((dataref_aux *)dr->aux)->base_decl = base;
@@ -788,7 +802,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
/* Negative or overflowed misalignment value. */
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unexpected misalign value");
+ "unexpected misalign value\n");
return false;
}
@@ -799,6 +813,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"misalign = %d bytes of ref ", DR_MISALIGNMENT (dr));
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, ref);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return true;
@@ -895,7 +910,7 @@ vect_update_misalignment_for_peel (struct data_reference *dr,
}
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "Setting misalignment to -1.");
+ dump_printf_loc (MSG_NOTE, vect_location, "Setting misalignment to -1.\n");
SET_DR_MISALIGNMENT (dr, -1);
}
@@ -953,12 +968,13 @@ vect_verify_datarefs_alignment (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
DR_REF (dr));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
if (supportable_dr_alignment != dr_aligned && dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Vectorizing an unaligned access.");
+ "Vectorizing an unaligned access.\n");
}
return true;
}
@@ -1015,16 +1031,16 @@ vector_alignment_reachable_p (struct data_reference *dr)
int_cst_value (TYPE_SIZE_UNIT (TREE_TYPE (vectype)));
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_NOTE, vect_location,
- "data size =" HOST_WIDE_INT_PRINT_DEC, elmsize);
- dump_printf (MSG_NOTE,
- ". misalignment = %d. ", DR_MISALIGNMENT (dr));
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "data size =" HOST_WIDE_INT_PRINT_DEC, elmsize);
+ dump_printf (MSG_NOTE,
+ ". misalignment = %d.\n", DR_MISALIGNMENT (dr));
}
if (DR_MISALIGNMENT (dr) % elmsize)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "data size does not divide the misalignment.\n");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "data size does not divide the misalignment.\n");
return false;
}
}
@@ -1034,8 +1050,8 @@ vector_alignment_reachable_p (struct data_reference *dr)
tree type = TREE_TYPE (DR_REF (dr));
bool is_packed = not_size_aligned (DR_REF (dr));
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Unknown misalignment, is_packed = %d",is_packed);
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Unknown misalignment, is_packed = %d\n",is_packed);
if ((TYPE_USER_ALIGN (type) && !is_packed)
|| targetm.vectorize.vector_alignment_reachable (type, is_packed))
return true;
@@ -1071,7 +1087,7 @@ vect_get_data_access_cost (struct data_reference *dr,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_get_data_access_cost: inside_cost = %d, "
- "outside_cost = %d.", *inside_cost, *outside_cost);
+ "outside_cost = %d.\n", *inside_cost, *outside_cost);
}
@@ -1099,7 +1115,7 @@ vect_peeling_hash_insert (loop_vec_info loop_vinfo, struct data_reference *dr,
*new_slot = slot;
}
- if (!supportable_dr_alignment && !flag_vect_cost_model)
+ if (!supportable_dr_alignment && unlimited_cost_model ())
slot->count += VECT_MAX_COST;
}
@@ -1207,9 +1223,9 @@ vect_peeling_hash_choose_best_peeling (loop_vec_info loop_vinfo,
struct _vect_peel_extended_info res;
res.peel_info.dr = NULL;
- res.body_cost_vec = stmt_vector_for_cost();
+ res.body_cost_vec = stmt_vector_for_cost ();
- if (flag_vect_cost_model)
+ if (!unlimited_cost_model ())
{
res.inside_cost = INT_MAX;
res.outside_cost = INT_MAX;
@@ -1342,11 +1358,11 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
unsigned possible_npeel_number = 1;
tree vectype;
unsigned int nelements, mis, same_align_drs_max = 0;
- stmt_vector_for_cost body_cost_vec = stmt_vector_for_cost();
+ stmt_vector_for_cost body_cost_vec = stmt_vector_for_cost ();
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_enhance_data_refs_alignment ===");
+ "=== vect_enhance_data_refs_alignment ===\n");
/* While cost model enhancements are expected in the future, the high level
view of the code at this time is as follows:
@@ -1438,7 +1454,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
vectorization factor.
We do this automtically for cost model, since we calculate cost
for every peeling option. */
- if (!flag_vect_cost_model)
+ if (unlimited_cost_model ())
possible_npeel_number = vf /nelements;
/* Handle the aligned case. We may decide to align some other
@@ -1446,7 +1462,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (DR_MISALIGNMENT (dr) == 0)
{
npeel_tmp = 0;
- if (!flag_vect_cost_model)
+ if (unlimited_cost_model ())
possible_npeel_number++;
}
@@ -1515,8 +1531,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (!aligned_access_p (dr))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "vector alignment may not be reachable");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "vector alignment may not be reachable\n");
break;
}
}
@@ -1652,7 +1668,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Try peeling by %d", npeel);
+ "Try peeling by %d\n", npeel);
}
/* Ensure that all data refs can be vectorized after the peel. */
@@ -1702,6 +1718,30 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (do_peeling)
{
+ unsigned max_allowed_peel
+ = PARAM_VALUE (PARAM_VECT_MAX_PEELING_FOR_ALIGNMENT);
+ if (max_allowed_peel != (unsigned)-1)
+ {
+ unsigned max_peel = npeel;
+ if (max_peel == 0)
+ {
+ gimple dr_stmt = DR_STMT (dr0);
+ stmt_vec_info vinfo = vinfo_for_stmt (dr_stmt);
+ tree vtype = STMT_VINFO_VECTYPE (vinfo);
+ max_peel = TYPE_VECTOR_SUBPARTS (vtype) - 1;
+ }
+ if (max_peel > max_allowed_peel)
+ {
+ do_peeling = false;
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Disable peeling, max peels reached: %d\n", max_peel);
+ }
+ }
+ }
+
+ if (do_peeling)
+ {
stmt_info_for_cost *si;
void *data = LOOP_VINFO_TARGET_COST_DATA (loop_vinfo);
@@ -1725,9 +1765,9 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
- "Alignment of access forced using peeling.");
+ "Alignment of access forced using peeling.\n");
dump_printf_loc (MSG_NOTE, vect_location,
- "Peeling for alignment will be applied.");
+ "Peeling for alignment will be applied.\n");
}
/* We've delayed passing the inside-loop peeling costs to the
target cost model until we were sure peeling would happen.
@@ -1755,16 +1795,14 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
/* (2) Versioning to force alignment. */
/* Try versioning if:
- 1) flag_tree_vect_loop_version is TRUE
- 2) optimize loop for speed
- 3) there is at least one unsupported misaligned data ref with an unknown
+ 1) optimize loop for speed
+ 2) there is at least one unsupported misaligned data ref with an unknown
misalignment, and
- 4) all misaligned data refs with a known misalignment are supported, and
- 5) the number of runtime alignment checks is within reason. */
+ 3) all misaligned data refs with a known misalignment are supported, and
+ 4) the number of runtime alignment checks is within reason. */
do_versioning =
- flag_tree_vect_loop_version
- && optimize_loop_nest_for_speed_p (loop)
+ optimize_loop_nest_for_speed_p (loop)
&& (!loop->inner); /* FORNOW */
if (do_versioning)
@@ -1847,13 +1885,13 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
dr = STMT_VINFO_DATA_REF (stmt_info);
SET_DR_MISALIGNMENT (dr, 0);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "Alignment of access forced using versioning.");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Alignment of access forced using versioning.\n");
}
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "Versioning for alignment will be applied.");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Versioning for alignment will be applied.\n");
/* Peeling and versioning can't be done together at this time. */
gcc_assert (! (do_peeling && do_versioning));
@@ -1919,7 +1957,7 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "dependence distance = %d.", dist);
+ "dependence distance = %d.\n", dist);
/* Same loop iteration. */
if (dist == 0
@@ -1930,13 +1968,14 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr,
STMT_VINFO_SAME_ALIGN_REFS (stmtinfo_b).safe_push (dra);
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_NOTE, vect_location,
- "accesses have the same alignment.");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "accesses have the same alignment.\n");
dump_printf (MSG_NOTE,
- "dependence distance modulo vf == 0 between ");
+ "dependence distance modulo vf == 0 between ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_NOTE, "\n");
}
}
}
@@ -1954,7 +1993,7 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_analyze_data_refs_alignment ===");
+ "=== vect_analyze_data_refs_alignment ===\n");
/* Mark groups of data references with same alignment using
data dependence information. */
@@ -1971,9 +2010,9 @@ vect_analyze_data_refs_alignment (loop_vec_info loop_vinfo,
if (!vect_compute_data_refs_alignment (loop_vinfo, bb_vinfo))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: can't calculate alignment "
- "for data ref.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: can't calculate alignment "
+ "for data ref.\n");
return false;
}
@@ -2025,25 +2064,26 @@ vect_analyze_group_access (struct data_reference *dr)
GROUP_SIZE (vinfo_for_stmt (stmt)) = groupsize;
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_NOTE, vect_location,
- "Detected single element interleaving ");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Detected single element interleaving ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dr));
dump_printf (MSG_NOTE, " step ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, step);
+ dump_printf (MSG_NOTE, "\n");
}
if (loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Data access with gaps requires scalar "
- "epilogue loop");
+ "Data access with gaps requires scalar "
+ "epilogue loop\n");
if (loop->inner)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Peeling for outer loop is not"
- " supported");
+ " supported\n");
return false;
}
@@ -2056,8 +2096,9 @@ vect_analyze_group_access (struct data_reference *dr)
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not consecutive access ");
- dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ "not consecutive access ");
+ dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -2094,8 +2135,8 @@ vect_analyze_group_access (struct data_reference *dr)
if (DR_IS_WRITE (data_ref))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Two store stmts share the same dr.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Two store stmts share the same dr.\n");
return false;
}
@@ -2124,8 +2165,8 @@ vect_analyze_group_access (struct data_reference *dr)
if (DR_IS_WRITE (data_ref))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "interleaved store with gaps");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "interleaved store with gaps\n");
return false;
}
@@ -2155,9 +2196,11 @@ vect_analyze_group_access (struct data_reference *dr)
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"interleaving size is greater than step for ");
- dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, DR_REF (dr));
+ dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
+ DR_REF (dr));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -2178,8 +2221,8 @@ vect_analyze_group_access (struct data_reference *dr)
else
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "interleaved store with gaps");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "interleaved store with gaps\n");
return false;
}
}
@@ -2196,6 +2239,7 @@ vect_analyze_group_access (struct data_reference *dr)
dump_printf (MSG_MISSED_OPTIMIZATION, " size ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
TYPE_SIZE_UNIT (scalar_type));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -2205,8 +2249,8 @@ vect_analyze_group_access (struct data_reference *dr)
GROUP_SIZE (vinfo_for_stmt (stmt)) = groupsize;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "Detected interleaving of size %d", (int)groupsize);
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "Detected interleaving of size %d\n", (int)groupsize);
/* SLP: create an SLP data structure for every interleaving group of
stores for further analysis in vect_analyse_slp. */
@@ -2223,13 +2267,13 @@ vect_analyze_group_access (struct data_reference *dr)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Data access with gaps requires scalar "
- "epilogue loop");
+ "Data access with gaps requires scalar "
+ "epilogue loop\n");
if (loop->inner)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Peeling for outer loop is not supported");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Peeling for outer loop is not supported\n");
return false;
}
@@ -2261,8 +2305,8 @@ vect_analyze_data_ref_access (struct data_reference *dr)
if (loop_vinfo && !step)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data-ref access in loop");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "bad data-ref access in loop\n");
return false;
}
@@ -2274,7 +2318,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "zero step in inner loop of nest");
+ "zero step in inner loop of nest\n");
return false;
}
return DR_IS_READ (dr);
@@ -2292,7 +2336,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "zero step in outer loop.");
+ "zero step in outer loop.\n");
if (DR_IS_READ (dr))
return true;
else
@@ -2318,7 +2362,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "grouped access in outer loop.");
+ "grouped access in outer loop.\n");
return false;
}
@@ -2482,7 +2526,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_analyze_data_ref_accesses ===");
+ "=== vect_analyze_data_ref_accesses ===\n");
if (loop_vinfo)
datarefs = LOOP_VINFO_DATAREFS (loop_vinfo);
@@ -2494,7 +2538,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
/* Sort the array of datarefs to make building the interleaving chains
linear. */
- qsort (datarefs.address(), datarefs.length (),
+ qsort (datarefs.address (), datarefs.length (),
sizeof (data_reference_p), dr_group_sort_cmp);
/* Build the interleaving chains. */
@@ -2567,6 +2611,7 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dra));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (drb));
+ dump_printf (MSG_NOTE, "\n");
}
/* Link the found element into the group list. */
@@ -2586,8 +2631,8 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
&& !vect_analyze_data_ref_access (dr))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: complicated access pattern.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: complicated access pattern.\n");
if (bb_vinfo)
{
@@ -2617,7 +2662,7 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_prune_runtime_alias_test_list ===");
+ "=== vect_prune_runtime_alias_test_list ===\n");
for (i = 0; i < ddrs.length (); )
{
@@ -2636,14 +2681,19 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location,
- "found equal ranges ");
- dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr_i)));
+ "found equal ranges ");
+ dump_generic_expr (MSG_NOTE, TDF_SLIM,
+ DR_REF (DDR_A (ddr_i)));
dump_printf (MSG_NOTE, ", ");
- dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr_i)));
+ dump_generic_expr (MSG_NOTE, TDF_SLIM,
+ DR_REF (DDR_B (ddr_i)));
dump_printf (MSG_NOTE, " and ");
- dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_A (ddr_j)));
+ dump_generic_expr (MSG_NOTE, TDF_SLIM,
+ DR_REF (DDR_A (ddr_j)));
dump_printf (MSG_NOTE, ", ");
- dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (DDR_B (ddr_j)));
+ dump_generic_expr (MSG_NOTE, TDF_SLIM,
+ DR_REF (DDR_B (ddr_j)));
+ dump_printf (MSG_NOTE, "\n");
}
found = true;
break;
@@ -2663,9 +2713,9 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "disable versioning for alias - max number of "
- "generated checks exceeded.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "disable versioning for alias - max number of "
+ "generated checks exceeded.\n");
}
LOOP_VINFO_MAY_ALIAS_DDRS (loop_vinfo).truncate (0);
@@ -2908,9 +2958,9 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
(loop, &LOOP_VINFO_DATAREFS (loop_vinfo)))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: loop contains function calls"
- " or data references that cannot be analyzed");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: loop contains function calls"
+ " or data references that cannot be analyzed\n");
return false;
}
@@ -2957,7 +3007,7 @@ again:
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: unhandled data-ref ");
+ "not vectorized: unhandled data-ref\n");
return false;
}
@@ -3039,6 +3089,8 @@ again:
{
DR_OFFSET (newdr) = ssize_int (0);
DR_STEP (newdr) = step;
+ DR_ALIGNED_TO (newdr)
+ = size_int (BIGGEST_ALIGNMENT);
dr = newdr;
simd_lane_access = true;
}
@@ -3060,10 +3112,11 @@ again:
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: data ref analysis "
"failed ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3078,7 +3131,7 @@ again:
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: base addr of dr is a "
- "constant");
+ "constant\n");
if (bb_vinfo)
break;
@@ -3095,6 +3148,7 @@ again:
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: volatile type ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3111,6 +3165,7 @@ again:
"not vectorized: statement can throw an "
"exception ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3130,6 +3185,7 @@ again:
"not vectorized: statement is bitfield "
"access ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3149,8 +3205,9 @@ again:
if (dump_enabled_p ())
{
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: dr in a call ");
+ "not vectorized: dr in a call ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3190,6 +3247,7 @@ again:
dump_printf_loc (MSG_NOTE, vect_location,
"analyze in outer-loop: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, inner_base);
+ dump_printf (MSG_NOTE, "\n");
}
outer_base = get_inner_reference (inner_base, &pbitsize, &pbitpos,
@@ -3209,7 +3267,7 @@ again:
&base_iv, false))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"failed: evolution of base is not affine.\n");
return false;
}
@@ -3232,7 +3290,7 @@ again:
&offset_iv, false))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"evolution of offset is not affine.\n");
return false;
}
@@ -3275,6 +3333,7 @@ again:
dump_printf (MSG_NOTE, "\n\touter aligned to: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM,
STMT_VINFO_DR_ALIGNED_TO (stmt_info));
+ dump_printf (MSG_NOTE, "\n");
}
}
@@ -3286,6 +3345,7 @@ again:
"not vectorized: more than one data ref "
"in stmt: ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3311,12 +3371,13 @@ again:
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: no vectype for stmt: ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
dump_printf (MSG_MISSED_OPTIMIZATION, " scalar_type: ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_DETAILS,
scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
if (bb_vinfo)
@@ -3338,6 +3399,7 @@ again:
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
dump_generic_expr (MSG_NOTE, TDF_SLIM,
STMT_VINFO_VECTYPE (stmt_info));
+ dump_printf (MSG_NOTE, "\n");
}
}
@@ -3365,6 +3427,7 @@ again:
"not vectorized: not suitable for gather "
"load ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -3384,6 +3447,7 @@ again:
"not vectorized: not suitable for strided "
"load ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -3569,6 +3633,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
{
dump_printf_loc (MSG_NOTE, vect_location, "created ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, addr_base);
+ dump_printf (MSG_NOTE, "\n");
}
return addr_base;
@@ -3700,6 +3765,7 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop,
else
dump_printf (MSG_NOTE, " vectorizing a pointer ref: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_BASE_OBJECT (dr));
+ dump_printf (MSG_NOTE, "\n");
}
/* (1) Create the new aggregate-pointer variable.
@@ -4005,7 +4071,7 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"the size of the group of accesses"
- " is not a power of 2");
+ " is not a power of 2\n");
return false;
}
@@ -4030,7 +4096,7 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (dump_enabled_p ())
dump_printf (MSG_MISSED_OPTIMIZATION,
- "interleave op not supported by target.");
+ "interleave op not supported by target.\n");
return false;
}
@@ -4452,7 +4518,7 @@ vect_grouped_load_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"the size of the group of accesses"
- " is not a power of 2");
+ " is not a power of 2\n");
return false;
}
@@ -4475,7 +4541,7 @@ vect_grouped_load_supported (tree vectype, unsigned HOST_WIDE_INT count)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "extract even/odd not supported by target");
+ "extract even/odd not supported by target\n");
return false;
}
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index b2a6944687c..df2f894e0f4 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "tm.h"
#include "langhooks.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "gimple.h"
#include "tree-iterator.h"
#include "tree-pass.h"
@@ -1477,8 +1477,8 @@ const pass_data pass_data_lower_vector =
class pass_lower_vector : public gimple_opt_pass
{
public:
- pass_lower_vector(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_vector, ctxt)
+ pass_lower_vector (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_vector, ctxt)
{}
/* opt_pass methods: */
@@ -1518,12 +1518,12 @@ const pass_data pass_data_lower_vector_ssa =
class pass_lower_vector_ssa : public gimple_opt_pass
{
public:
- pass_lower_vector_ssa(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_lower_vector_ssa, ctxt)
+ pass_lower_vector_ssa (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_lower_vector_ssa, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_lower_vector_ssa (ctxt_); }
+ opt_pass * clone () { return new pass_lower_vector_ssa (m_ctxt); }
unsigned int execute () { return expand_vector_operations (); }
}; // class pass_lower_vector_ssa
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c
index 2bebdeab34c..574446a7dde 100644
--- a/gcc/tree-vect-loop-manip.c
+++ b/gcc/tree-vect-loop-manip.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "diagnostic-core.h"
@@ -683,6 +683,7 @@ slpeel_make_loop_iterate_ntimes (struct loop *loop, tree niters)
dump_printf (MSG_NOTE, "\nloop at %s:%d: ", LOC_FILE (loop_loc),
LOC_LINE (loop_loc));
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, cond_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
loop->nb_iterations = niters;
}
@@ -922,10 +923,10 @@ set_prologue_iterations (basic_block bb_before_first_loop,
unshare_expr (LOOP_VINFO_NITERS_UNCHANGED (loop_vec_info_for_loop (loop)));
e = single_pred_edge (bb_before_first_loop);
- cond_bb = split_edge(e);
+ cond_bb = split_edge (e);
e = single_pred_edge (bb_before_first_loop);
- then_bb = split_edge(e);
+ then_bb = split_edge (e);
set_immediate_dominator (CDI_DOMINATORS, then_bb, cond_bb);
e_false = make_single_succ_edge (cond_bb, bb_before_first_loop,
@@ -1552,7 +1553,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
/* Analyze phi functions of the loop header. */
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "vect_can_advance_ivs_p:");
+ dump_printf_loc (MSG_NOTE, vect_location, "vect_can_advance_ivs_p:\n");
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
tree evolution_part;
@@ -1562,6 +1563,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Skip virtual phi's. The data dependences that are associated with
@@ -1571,7 +1573,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "virtual phi. skip.");
+ "virtual phi. skip.\n");
continue;
}
@@ -1581,7 +1583,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "reduc phi. skip.");
+ "reduc phi. skip.\n");
continue;
}
@@ -1593,7 +1595,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf (MSG_MISSED_OPTIMIZATION,
- "No access function or evolution.");
+ "No access function or evolution.\n");
return false;
}
@@ -1682,6 +1684,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
dump_printf_loc (MSG_NOTE, vect_location,
"vect_update_ivs_after_vectorizer: phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Skip virtual phi's. */
@@ -1689,7 +1692,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "virtual phi. skip.");
+ "virtual phi. skip.\n");
continue;
}
@@ -1699,7 +1702,7 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree niters,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "reduc phi. skip.");
+ "reduc phi. skip.\n");
continue;
}
@@ -1762,7 +1765,7 @@ vect_do_peeling_for_loop_bound (loop_vec_info loop_vinfo, tree *ratio,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_do_peeling_for_loop_bound ===");
+ "=== vect_do_peeling_for_loop_bound ===\n");
initialize_original_copy_tables ();
@@ -1881,7 +1884,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters, int
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "known peeling = %d.", npeel);
+ "known peeling = %d.\n", npeel);
iters = build_int_cst (niters_type, npeel);
*bound = LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo);
@@ -1938,6 +1941,7 @@ vect_gen_niters_for_prolog_loop (loop_vec_info loop_vinfo, tree loop_niters, int
dump_printf_loc (MSG_NOTE, vect_location,
"niters for prolog loop: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, iters);
+ dump_printf (MSG_NOTE, "\n");
}
var = create_tmp_var (niters_type, "prolog_loop_niters");
@@ -1993,7 +1997,7 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_update_inits_of_dr ===");
+ "=== vect_update_inits_of_dr ===\n");
FOR_EACH_VEC_ELT (datarefs, i, dr)
vect_update_init_of_dr (dr, niters);
@@ -2338,6 +2342,7 @@ vect_create_cond_for_alias_checks (loop_vec_info loop_vinfo, tree * cond_expr)
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dr_a));
dump_printf (MSG_NOTE, " and ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, DR_REF (dr_b));
+ dump_printf (MSG_NOTE, "\n");
}
seg_a_min = addr_base_a;
@@ -2444,7 +2449,7 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
"alignment\n");
}
- free_original_copy_tables();
+ free_original_copy_tables ();
/* Loop versioning violates an assumption we try to maintain during
vectorization - that the loop exit block has a single predecessor.
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 9b4b1892984..baea8b7f827 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "expr.h"
@@ -188,7 +188,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_determine_vectorization_factor ===");
+ "=== vect_determine_vectorization_factor ===\n");
for (i = 0; i < nbbs; i++)
{
@@ -202,6 +202,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "==> examining phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
gcc_assert (stmt_info);
@@ -216,6 +217,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
+ dump_printf (MSG_NOTE, "\n");
}
vectype = get_vectype_for_scalar_type (scalar_type);
@@ -228,6 +230,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
"data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -237,11 +240,13 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "vectype: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype);
+ dump_printf (MSG_NOTE, "\n");
}
nunits = TYPE_VECTOR_SUBPARTS (vectype);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "nunits = %d", nunits);
+ dump_printf_loc (MSG_NOTE, vect_location, "nunits = %d\n",
+ nunits);
if (!vectorization_factor
|| (nunits > vectorization_factor))
@@ -265,6 +270,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"==> examining statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
gcc_assert (stmt_info);
@@ -286,12 +292,13 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"==> examining pattern statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
}
else
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "skip.");
+ dump_printf_loc (MSG_NOTE, vect_location, "skip.\n");
gsi_next (&si);
continue;
}
@@ -336,6 +343,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
"==> examining pattern def stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM,
pattern_def_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
stmt = pattern_def_stmt;
@@ -359,6 +367,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
"not vectorized: irregular stmt.");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt,
0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -370,6 +379,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: vector stmt in loop:");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -394,6 +404,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
+ dump_printf (MSG_NOTE, "\n");
}
vectype = get_vectype_for_scalar_type (scalar_type);
if (!vectype)
@@ -405,6 +416,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
"data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -415,6 +427,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "vectype: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype);
+ dump_printf (MSG_NOTE, "\n");
}
}
@@ -428,6 +441,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
+ dump_printf (MSG_NOTE, "\n");
}
vf_vectype = get_vectype_for_scalar_type (scalar_type);
if (!vf_vectype)
@@ -438,6 +452,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
"not vectorized: unsupported data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -455,6 +470,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
dump_printf (MSG_MISSED_OPTIMIZATION, " and ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
vf_vectype);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -463,11 +479,12 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "vectype: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, vf_vectype);
+ dump_printf (MSG_NOTE, "\n");
}
nunits = TYPE_VECTOR_SUBPARTS (vf_vectype);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "nunits = %d", nunits);
+ dump_printf_loc (MSG_NOTE, vect_location, "nunits = %d\n", nunits);
if (!vectorization_factor
|| (nunits > vectorization_factor))
vectorization_factor = nunits;
@@ -482,13 +499,13 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
/* TODO: Analyze cost. Decide if worth while to vectorize. */
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "vectorization factor = %d",
+ dump_printf_loc (MSG_NOTE, vect_location, "vectorization factor = %d\n",
vectorization_factor);
if (vectorization_factor <= 1)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: unsupported data-type");
+ "not vectorized: unsupported data-type\n");
return false;
}
LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
@@ -530,6 +547,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
dump_generic_expr (MSG_NOTE, TDF_SLIM, step_expr);
dump_printf (MSG_NOTE, ", init: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, init_expr);
+ dump_printf (MSG_NOTE, "\n");
}
*init = init_expr;
@@ -547,7 +565,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "step unknown.");
+ "step unknown.\n");
return false;
}
@@ -573,7 +591,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_analyze_scalar_cycles ===");
+ "=== vect_analyze_scalar_cycles ===\n");
/* First - identify all inductions. Reduction detection assumes that all the
inductions have been identified, therefore, this order must not be
@@ -589,6 +607,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Skip virtual phi's. The data dependences that are associated with
@@ -608,6 +627,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
dump_printf_loc (MSG_NOTE, vect_location,
"Access function of PHI: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, access_fn);
+ dump_printf (MSG_NOTE, "\n");
}
STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo)
= evolution_part_in_loop_num (access_fn, loop->num);
@@ -625,7 +645,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
gcc_assert (STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo) != NULL_TREE);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "Detected induction.");
+ dump_printf_loc (MSG_NOTE, vect_location, "Detected induction.\n");
STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_induction_def;
}
@@ -643,6 +663,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
gcc_assert (!virtual_operand_p (def)
@@ -657,7 +678,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Detected double reduction.");
+ "Detected double reduction.\n");
STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_double_reduction_def;
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (reduc_stmt)) =
@@ -669,7 +690,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Detected vectorizable nested cycle.");
+ "Detected vectorizable nested cycle.\n");
STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_nested_cycle;
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (reduc_stmt)) =
@@ -679,7 +700,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Detected reduction.");
+ "Detected reduction.\n");
STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_reduction_def;
STMT_VINFO_DEF_TYPE (vinfo_for_stmt (reduc_stmt)) =
@@ -693,7 +714,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
else
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Unknown def-use cycle pattern.");
+ "Unknown def-use cycle pattern.\n");
}
worklist.release ();
@@ -755,7 +776,7 @@ vect_get_loop_niters (struct loop *loop, tree *number_of_iterations)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== get_loop_niters ===");
+ "=== get_loop_niters ===\n");
niters = number_of_exit_cond_executions (loop);
if (niters != NULL_TREE
@@ -767,6 +788,7 @@ vect_get_loop_niters (struct loop *loop, tree *number_of_iterations)
{
dump_printf_loc (MSG_NOTE, vect_location, "==> get_loop_niters:");
dump_generic_expr (MSG_NOTE, TDF_SLIM, *number_of_iterations);
+ dump_printf (MSG_NOTE, "\n");
}
}
@@ -996,7 +1018,7 @@ vect_analyze_loop_1 (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "===== analyze_loop_nest_1 =====");
+ "===== analyze_loop_nest_1 =====\n");
/* Check the CFG characteristics of the loop (nesting, entry/exit, etc. */
@@ -1005,7 +1027,7 @@ vect_analyze_loop_1 (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad inner-loop form.");
+ "bad inner-loop form.\n");
return NULL;
}
@@ -1031,7 +1053,7 @@ vect_analyze_loop_form (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_analyze_loop_form ===");
+ "=== vect_analyze_loop_form ===\n");
/* Different restrictions apply when we are considering an inner-most loop,
vs. an outer (nested) loop.
@@ -1055,7 +1077,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: control flow in loop.");
+ "not vectorized: control flow in loop.\n");
return NULL;
}
@@ -1063,7 +1085,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: empty loop.");
+ "not vectorized: empty loop.\n");
return NULL;
}
}
@@ -1093,7 +1115,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: multiple nested loops.");
+ "not vectorized: multiple nested loops.\n");
return NULL;
}
@@ -1103,7 +1125,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: Bad inner loop.");
+ "not vectorized: Bad inner loop.\n");
return NULL;
}
@@ -1111,8 +1133,9 @@ vect_analyze_loop_form (struct loop *loop)
LOOP_VINFO_NITERS (inner_loop_vinfo)))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: inner-loop count not invariant.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: inner-loop count not"
+ " invariant.\n");
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
}
@@ -1121,7 +1144,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: control flow in loop.");
+ "not vectorized: control flow in loop.\n");
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
}
@@ -1136,15 +1159,15 @@ vect_analyze_loop_form (struct loop *loop)
|| single_exit (innerloop)->dest != EDGE_PRED (loop->latch, 0)->src)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: unsupported outerloop form.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: unsupported outerloop form.\n");
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
}
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Considering outer-loop vectorization.");
+ "Considering outer-loop vectorization.\n");
}
if (!single_exit (loop)
@@ -1154,10 +1177,10 @@ vect_analyze_loop_form (struct loop *loop)
{
if (!single_exit (loop))
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: multiple exits.");
+ "not vectorized: multiple exits.\n");
else if (EDGE_COUNT (loop->header->preds) != 2)
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: too many incoming edges.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: too many incoming edges.\n");
}
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
@@ -1173,7 +1196,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: latch block not empty.");
+ "not vectorized: latch block not empty.\n");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1187,13 +1210,13 @@ vect_analyze_loop_form (struct loop *loop)
{
split_loop_exit_edge (e);
if (dump_enabled_p ())
- dump_printf (MSG_NOTE, "split exit edge.");
+ dump_printf (MSG_NOTE, "split exit edge.\n");
}
else
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: abnormal loop exit edge.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: abnormal loop exit edge.\n");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1204,8 +1227,8 @@ vect_analyze_loop_form (struct loop *loop)
if (!loop_cond)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: complicated exit condition.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: complicated exit condition.\n");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1214,9 +1237,9 @@ vect_analyze_loop_form (struct loop *loop)
if (!number_of_iterations)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: number of iterations cannot be "
- "computed.");
+ "computed.\n");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1226,7 +1249,7 @@ vect_analyze_loop_form (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Infinite number of iterations.");
+ "Infinite number of iterations.\n");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1239,13 +1262,14 @@ vect_analyze_loop_form (struct loop *loop)
dump_printf_loc (MSG_NOTE, vect_location,
"Symbolic number of iterations is ");
dump_generic_expr (MSG_NOTE, TDF_DETAILS, number_of_iterations);
+ dump_printf (MSG_NOTE, "\n");
}
}
else if (TREE_INT_CST_LOW (number_of_iterations) == 0)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: number of iterations = 0.");
+ "not vectorized: number of iterations = 0.\n");
if (inner_loop_vinfo)
destroy_loop_vec_info (inner_loop_vinfo, true);
return NULL;
@@ -1293,7 +1317,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_analyze_loop_operations ===");
+ "=== vect_analyze_loop_operations ===\n");
gcc_assert (LOOP_VINFO_VECT_FACTOR (loop_vinfo));
vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -1329,7 +1353,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
LOOP_VINFO_VECT_FACTOR (loop_vinfo) = vectorization_factor;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Updating vectorization factor to %d ",
+ "Updating vectorization factor to %d\n",
vectorization_factor);
}
@@ -1347,6 +1371,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
dump_printf_loc (MSG_NOTE, vect_location, "examining phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Inner-loop loop-closed exit phi in outer-loop vectorization
@@ -1363,9 +1388,9 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
!= vect_double_reduction_def)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Unsupported loop-closed phi in "
- "outer-loop.");
+ "outer-loop.\n");
return false;
}
@@ -1406,7 +1431,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
/* FORNOW: not yet supported. */
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: value used after loop.");
+ "not vectorized: value used after loop.\n");
return false;
}
@@ -1415,8 +1440,8 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
/* A scalar-dependence cycle that we don't support. */
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: scalar dependence cycle.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: scalar dependence cycle.\n");
return false;
}
@@ -1431,10 +1456,11 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: relevant phi not "
"supported: ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, phi, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -1458,18 +1484,18 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "All the computation can be taken out of the loop.");
+ "All the computation can be taken out of the loop.\n");
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: redundant loop. no profit to "
- "vectorize.");
+ "vectorize.\n");
return false;
}
if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) && dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vectorization_factor = %d, niters = "
- HOST_WIDE_INT_PRINT_DEC, vectorization_factor,
+ HOST_WIDE_INT_PRINT_DEC "\n", vectorization_factor,
LOOP_VINFO_INT_NITERS (loop_vinfo));
if ((LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
@@ -1479,11 +1505,11 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: iteration count too small.");
+ "not vectorized: iteration count too small.\n");
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: iteration count smaller than "
- "vectorization factor.");
+ "vectorization factor.\n");
return false;
}
@@ -1501,11 +1527,11 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: vectorization not profitable.");
+ "not vectorized: vectorization not profitable.\n");
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: vector version will never be "
- "profitable.");
+ "profitable.\n");
return false;
}
@@ -1527,12 +1553,12 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: vectorization not profitable.");
+ "not vectorized: vectorization not profitable.\n");
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"not vectorized: iteration count smaller than user "
"specified loop bound parameter or minimum profitable "
- "iterations (whichever is more conservative).");
+ "iterations (whichever is more conservative).\n");
return false;
}
@@ -1543,13 +1569,13 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: estimated iteration count too "
- "small.");
+ "small.\n");
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"not vectorized: estimated iteration count smaller "
"than specified loop bound parameter or minimum "
"profitable iterations (whichever is more "
- "conservative).");
+ "conservative).\n");
return false;
}
@@ -1558,19 +1584,19 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
|| LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "epilog loop required.");
+ dump_printf_loc (MSG_NOTE, vect_location, "epilog loop required.\n");
if (!vect_can_advance_ivs_p (loop_vinfo))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: can't create epilog loop 1.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: can't create epilog loop 1.\n");
return false;
}
if (!slpeel_can_duplicate_loop_p (loop, single_exit (loop)))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: can't create epilog loop 2.");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: can't create epilog loop 2.\n");
return false;
}
}
@@ -1603,7 +1629,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data references.");
+ "bad data references.\n");
return false;
}
@@ -1615,7 +1641,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data access.");
+ "bad data access.\n");
return false;
}
@@ -1633,7 +1659,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unexpected pattern.");
+ "unexpected pattern.\n");
return false;
}
@@ -1648,7 +1674,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data dependence.");
+ "bad data dependence.\n");
return false;
}
@@ -1657,14 +1683,14 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "can't determine vectorization factor.");
+ "can't determine vectorization factor.\n");
return false;
}
if (max_vf < LOOP_VINFO_VECT_FACTOR (loop_vinfo))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data dependence.");
+ "bad data dependence.\n");
return false;
}
@@ -1676,7 +1702,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data alignment.");
+ "bad data alignment.\n");
return false;
}
@@ -1689,7 +1715,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"too long list of versioning for alias "
- "run-time tests.");
+ "run-time tests.\n");
return false;
}
@@ -1701,7 +1727,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad data alignment.");
+ "bad data alignment.\n");
return false;
}
@@ -1726,7 +1752,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad operation or unsupported loop bound.");
+ "bad operation or unsupported loop bound.\n");
return false;
}
@@ -1750,7 +1776,7 @@ vect_analyze_loop (struct loop *loop)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "===== analyze_loop_nest =====");
+ "===== analyze_loop_nest =====\n");
if (loop_outer (loop)
&& loop_vec_info_for_loop (loop_outer (loop))
@@ -1758,7 +1784,7 @@ vect_analyze_loop (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "outer-loop already vectorized.");
+ "outer-loop already vectorized.\n");
return NULL;
}
@@ -1770,7 +1796,7 @@ vect_analyze_loop (struct loop *loop)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bad loop form.");
+ "bad loop form.\n");
return NULL;
}
@@ -1851,6 +1877,7 @@ report_vect_op (int msg_type, gimple stmt, const char *msg)
{
dump_printf_loc (msg_type, vect_location, "%s", msg);
dump_gimple_stmt (msg_type, TDF_SLIM, stmt, 0);
+ dump_printf (msg_type, "\n");
}
@@ -2026,6 +2053,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple phi, gimple first_stmt)
{
dump_printf_loc (MSG_NOTE, vect_location, "swapping oprnds: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, next_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
swap_tree_operands (next_stmt,
@@ -2126,7 +2154,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "intermediate value used outside loop.");
+ "intermediate value used outside loop.\n");
return NULL;
}
@@ -2138,7 +2166,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "reduction used in loop.");
+ "reduction used in loop.\n");
return NULL;
}
}
@@ -2150,6 +2178,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"reduction: not ssa_name: ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, loop_arg);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return NULL;
}
@@ -2159,14 +2188,17 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "reduction: no def_stmt.");
+ "reduction: no def_stmt.\n");
return NULL;
}
if (!is_gimple_assign (def_stmt) && gimple_code (def_stmt) != GIMPLE_PHI)
{
if (dump_enabled_p ())
- dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0);
+ {
+ dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
+ }
return NULL;
}
@@ -2195,7 +2227,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "reduction used in loop.");
+ "reduction used in loop.\n");
return NULL;
}
}
@@ -2211,7 +2243,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported phi node definition.");
+ "unsupported phi node definition.\n");
return NULL;
}
@@ -2334,6 +2366,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
dump_generic_expr (MSG_NOTE, TDF_SLIM,
TREE_TYPE (op4));
}
+ dump_printf (MSG_NOTE, "\n");
}
return NULL;
@@ -2591,7 +2624,7 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"cost model: epilogue peel iters set to vf/2 "
- "because loop iterations are unknown .");
+ "because loop iterations are unknown .\n");
/* If peeled iterations are known but number of scalar loop
iterations are unknown, count a taken branch per peeled loop. */
@@ -2647,9 +2680,9 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
void *target_cost_data = LOOP_VINFO_TARGET_COST_DATA (loop_vinfo);
/* Cost model disabled. */
- if (!flag_vect_cost_model)
+ if (unlimited_cost_model ())
{
- dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled.");
+ dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled.\n");
*ret_min_profitable_niters = 0;
*ret_min_profitable_estimate = 0;
return;
@@ -2707,14 +2740,14 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
{
peel_iters_prologue = vf/2;
dump_printf (MSG_NOTE, "cost model: "
- "prologue peel iters set to vf/2.");
+ "prologue peel iters set to vf/2.\n");
/* If peeling for alignment is unknown, loop bound of main loop becomes
unknown. */
peel_iters_epilogue = vf/2;
dump_printf (MSG_NOTE, "cost model: "
"epilogue peel iters set to vf/2 because "
- "peeling for alignment is unknown.");
+ "peeling for alignment is unknown.\n");
/* If peeled iterations are unknown, count a taken branch and a not taken
branch per peeled loop. Even if scalar loop iterations are known,
@@ -2884,7 +2917,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"cost model: the vector iteration cost = %d "
"divided by the scalar iteration cost = %d "
- "is greater or equal to the vectorization factor = %d.",
+ "is greater or equal to the vectorization factor = %d"
+ ".\n",
vec_inside_cost, scalar_single_iter_cost, vf);
*ret_min_profitable_niters = -1;
*ret_min_profitable_estimate = -1;
@@ -2910,9 +2944,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
peel_iters_prologue);
dump_printf (MSG_NOTE, " epilogue iterations: %d\n",
peel_iters_epilogue);
- dump_printf (MSG_NOTE,
+ dump_printf (MSG_NOTE,
" Calculated minimum iters for profitability: %d\n",
min_profitable_iters);
+ dump_printf (MSG_NOTE, "\n");
}
min_profitable_iters =
@@ -2925,7 +2960,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- " Runtime profitability threshold = %d\n", min_profitable_iters);
+ " Runtime profitability threshold = %d\n",
+ min_profitable_iters);
*ret_min_profitable_niters = min_profitable_iters;
@@ -3014,6 +3050,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
"unsupported data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
TREE_TYPE (reduction_op));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -3082,7 +3119,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, enum tree_code reduc_code,
if (dump_enabled_p ())
dump_printf (MSG_NOTE,
"vect_model_reduction_cost: inside_cost = %d, "
- "prologue_cost = %d, epilogue_cost = %d .", inside_cost,
+ "prologue_cost = %d, epilogue_cost = %d .\n", inside_cost,
prologue_cost, epilogue_cost);
return true;
@@ -3111,7 +3148,7 @@ vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_induction_cost: inside_cost = %d, "
- "prologue_cost = %d .", inside_cost, prologue_cost);
+ "prologue_cost = %d .\n", inside_cost, prologue_cost);
}
@@ -3258,6 +3295,7 @@ get_initial_def_for_induction (gimple iv_phi)
dump_printf_loc (MSG_NOTE, vect_location,
"created new init_stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, init_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
constant_p = false;
}
@@ -3426,6 +3464,7 @@ get_initial_def_for_induction (gimple iv_phi)
dump_printf_loc (MSG_NOTE, vect_location,
"vector of inductions after inner-loop:");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, new_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
}
}
@@ -3439,6 +3478,7 @@ get_initial_def_for_induction (gimple iv_phi)
dump_printf (MSG_NOTE, "\n");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM,
SSA_NAME_DEF_STMT (vec_def), 0);
+ dump_printf (MSG_NOTE, "\n");
}
STMT_VINFO_VEC_STMT (phi_info) = induction_phi;
@@ -3846,6 +3886,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
dump_printf (MSG_NOTE, "\n");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, SSA_NAME_DEF_STMT (def), 0);
+ dump_printf (MSG_NOTE, "\n");
}
phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi));
@@ -4042,7 +4083,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Reduce using direct vector reduction.");
+ "Reduce using direct vector reduction.\n");
vec_dest = vect_create_destination_var (scalar_dest, vectype);
tmp = build1 (reduc_code, vectype, new_phi_result);
@@ -4093,7 +4134,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Reduce using vector shifts");
+ "Reduce using vector shifts\n");
vec_dest = vect_create_destination_var (scalar_dest, vectype);
new_temp = new_phi_result;
@@ -4134,7 +4175,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Reduce using scalar code. ");
+ "Reduce using scalar code.\n");
vec_size_in_bits = tree_low_cst (TYPE_SIZE (vectype), 1);
FOR_EACH_VEC_ELT (new_phis, i, new_phi)
@@ -4225,7 +4266,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "extract scalar result");
+ "extract scalar result\n");
if (BYTES_BIG_ENDIAN)
bitpos = size_binop (MULT_EXPR,
@@ -4370,7 +4411,8 @@ vect_finalize_reduction:
result. (The reduction result is expected to have two immediate uses -
one at the latch block, and one at the loop exit). */
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
- if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
+ if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p)))
+ && !is_gimple_debug (USE_STMT (use_p)))
phis.safe_push (USE_STMT (use_p));
/* While we expect to have found an exit_phi because of loop-closed-ssa
@@ -4464,6 +4506,7 @@ vect_finalize_reduction:
dump_printf_loc (MSG_NOTE, vect_location,
"created double reduction phi node: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, vect_phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
vect_phi_res = PHI_RESULT (vect_phi);
@@ -4499,7 +4542,10 @@ vect_finalize_reduction:
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest)
{
if (!flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
- phis.safe_push (USE_STMT (use_p));
+ {
+ if (!is_gimple_debug (USE_STMT (use_p)))
+ phis.safe_push (USE_STMT (use_p));
+ }
else
{
if (double_reduc && gimple_code (USE_STMT (use_p)) == GIMPLE_PHI)
@@ -4509,7 +4555,8 @@ vect_finalize_reduction:
FOR_EACH_IMM_USE_FAST (phi_use_p, phi_imm_iter, phi_res)
{
if (!flow_bb_inside_loop_p (loop,
- gimple_bb (USE_STMT (phi_use_p))))
+ gimple_bb (USE_STMT (phi_use_p)))
+ && !is_gimple_debug (USE_STMT (phi_use_p)))
phis.safe_push (USE_STMT (phi_use_p));
}
}
@@ -4819,7 +4866,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported condition in reduction");
+ "unsupported condition in reduction\n");
return false;
}
@@ -4835,7 +4882,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
not vectorizable_reduction. */
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported shift or rotation.");
+ "unsupported shift or rotation.\n");
return false;
}
@@ -4845,7 +4892,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no optab.");
+ "no optab.\n");
return false;
}
@@ -4853,7 +4900,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
if (optab_handler (optab, vec_mode) == CODE_FOR_nothing)
{
if (dump_enabled_p ())
- dump_printf (MSG_NOTE, "op not supported by target.");
+ dump_printf (MSG_NOTE, "op not supported by target.\n");
if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD
|| LOOP_VINFO_VECT_FACTOR (loop_vinfo)
@@ -4861,7 +4908,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
return false;
if (dump_enabled_p ())
- dump_printf (MSG_NOTE, "proceeding using word mode.");
+ dump_printf (MSG_NOTE, "proceeding using word mode.\n");
}
/* Worthwhile without SIMD support? */
@@ -4871,7 +4918,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not worthwhile without SIMD support.");
+ "not worthwhile without SIMD support.\n");
return false;
}
@@ -4952,7 +4999,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no optab for reduction.");
+ "no optab for reduction.\n");
epilog_reduc_code = ERROR_MARK;
}
@@ -4962,7 +5009,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "reduc op not supported by target.");
+ "reduc op not supported by target.\n");
epilog_reduc_code = ERROR_MARK;
}
@@ -4973,7 +5020,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no reduc code for scalar code.");
+ "no reduc code for scalar code.\n");
return false;
}
@@ -4983,7 +5030,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "multiple types in double reduction");
+ "multiple types in double reduction\n");
return false;
}
@@ -5002,7 +5049,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "invalid types in dot-prod");
+ "invalid types in dot-prod\n");
return false;
}
@@ -5019,7 +5066,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi,
/** Transform. **/
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "transform reduction.");
+ dump_printf_loc (MSG_NOTE, vect_location, "transform reduction.\n");
/* FORNOW: Multiple types are not supported for condition. */
if (code == COND_EXPR)
@@ -5306,7 +5353,7 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "multiple types in nested loop.");
+ "multiple types in nested loop.\n");
return false;
}
@@ -5329,9 +5376,9 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
&& !STMT_VINFO_LIVE_P (exit_phi_vinfo)))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"inner-loop induction only used outside "
- "of the outer vectorized loop.");
+ "of the outer vectorized loop.\n");
return false;
}
}
@@ -5354,7 +5401,7 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
STMT_VINFO_TYPE (stmt_info) = induc_vec_info_type;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vectorizable_induction ===");
+ "=== vectorizable_induction ===\n");
vect_model_induction_cost (stmt_info, ncopies);
return true;
}
@@ -5362,7 +5409,7 @@ vectorizable_induction (gimple phi, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
/** Transform. **/
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "transform induction phi.");
+ dump_printf_loc (MSG_NOTE, vect_location, "transform induction phi.\n");
vec_def = get_initial_def_for_induction (phi);
*vec_stmt = SSA_NAME_DEF_STMT (vec_def);
@@ -5462,7 +5509,7 @@ vectorizable_live_operation (gimple stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
@@ -5501,7 +5548,7 @@ vect_loop_kill_debug_uses (struct loop *loop, gimple stmt)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "killing debug use");
+ "killing debug use\n");
gimple_debug_bind_reset_value (ustmt);
update_stmt (ustmt);
@@ -5542,7 +5589,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
gcov_type expected_iterations = expected_loop_iterations_unbounded (loop);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "=== vec_transform_loop ===");
+ dump_printf_loc (MSG_NOTE, vect_location, "=== vec_transform_loop ===\n");
/* If profile is inprecise, we have chance to fix it up. */
if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
@@ -5561,7 +5608,8 @@ vect_transform_loop (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Profitability threshold is %d loop iterations.", th);
+ "Profitability threshold is %d loop iterations.\n",
+ th);
check_profitability = true;
}
@@ -5628,6 +5676,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"------>vectorizing phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
stmt_info = vinfo_for_stmt (phi);
if (!stmt_info)
@@ -5643,12 +5692,12 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if ((TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info))
!= (unsigned HOST_WIDE_INT) vectorization_factor)
&& dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "multiple-types.");
+ dump_printf_loc (MSG_NOTE, vect_location, "multiple-types.\n");
if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "transform phi.");
+ dump_printf_loc (MSG_NOTE, vect_location, "transform phi.\n");
vect_transform_stmt (phi, NULL, NULL, NULL, NULL);
}
}
@@ -5678,6 +5727,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location,
"------>vectorizing statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
stmt_info = vinfo_for_stmt (stmt);
@@ -5752,6 +5802,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
"stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM,
pattern_def_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
stmt = pattern_def_stmt;
@@ -5776,7 +5827,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
/* For SLP VF is set according to unrolling factor, and not to
vector size, hence for SLP this print is not valid. */
dump_printf_loc (MSG_NOTE, vect_location,
- "multiple-types.");
+ "multiple-types.\n");
/* SLP. Schedule all the SLP instances when the first SLP stmt is
reached. */
@@ -5788,7 +5839,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== scheduling SLP instances ===");
+ "=== scheduling SLP instances ===\n");
vect_schedule_slp (loop_vinfo, NULL);
}
@@ -5807,7 +5858,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
/* -------- vectorize statement ------------ */
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "transform statement.");
+ dump_printf_loc (MSG_NOTE, vect_location, "transform statement.\n");
grouped_store = false;
is_store = vect_transform_stmt (stmt, &si, &grouped_store, NULL, NULL);
@@ -5870,5 +5921,6 @@ vect_transform_loop (loop_vec_info loop_vinfo)
if (loop->inner)
dump_printf_loc (MSG_NOTE, vect_location,
"OUTER LOOP VECTORIZED\n");
+ dump_printf (MSG_NOTE, "\n");
}
}
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 0a48727821a..0a4e812fd82 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "expr.h"
#include "optabs.h"
@@ -397,7 +397,7 @@ vect_recog_dot_prod_pattern (vec<gimple> *stmts, tree *type_in,
|| !promotion)
return NULL;
oprnd00 = gimple_assign_rhs1 (def_stmt);
- if (!type_conversion_p (oprnd0, stmt, true, &half_type1, &def_stmt,
+ if (!type_conversion_p (oprnd1, stmt, true, &half_type1, &def_stmt,
&promotion)
|| !promotion)
return NULL;
@@ -422,6 +422,7 @@ vect_recog_dot_prod_pattern (vec<gimple> *stmts, tree *type_in,
dump_printf_loc (MSG_NOTE, vect_location,
"vect_recog_dot_prod_pattern: detected: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* We don't allow changing the order of the computation in the inner-loop
@@ -682,7 +683,7 @@ vect_recog_widen_mult_pattern (vec<gimple> *stmts,
/* Pattern detected. */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_widen_mult_pattern: detected: ");
+ "vect_recog_widen_mult_pattern: detected:\n");
/* Check target support */
vectype = get_vectype_for_scalar_type (half_type0);
@@ -921,6 +922,7 @@ vect_recog_widen_sum_pattern (vec<gimple> *stmts, tree *type_in,
dump_printf_loc (MSG_NOTE, vect_location,
"vect_recog_widen_sum_pattern: detected: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* We don't allow changing the order of the computation in the inner-loop
@@ -1226,6 +1228,7 @@ vect_recog_over_widening_pattern (vec<gimple> *stmts,
dump_printf_loc (MSG_NOTE, vect_location,
"created pattern stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
type = gimple_expr_type (stmt);
@@ -1294,6 +1297,7 @@ vect_recog_over_widening_pattern (vec<gimple> *stmts,
dump_printf_loc (MSG_NOTE, vect_location,
"vect_recog_over_widening_pattern: detected: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
return pattern_stmt;
@@ -1427,7 +1431,7 @@ vect_recog_widen_shift_pattern (vec<gimple> *stmts,
/* Pattern detected. */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_widen_shift_pattern: detected: ");
+ "vect_recog_widen_shift_pattern: detected:\n");
/* Check target support. */
vectype = get_vectype_for_scalar_type (half_type0);
@@ -1694,7 +1698,7 @@ vect_recog_rotate_pattern (vec<gimple> *stmts, tree *type_in, tree *type_out)
/* Pattern detected. */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_rotate_pattern: detected: ");
+ "vect_recog_rotate_pattern: detected:\n");
/* Pattern supported. Create a stmt to be used to replace the pattern. */
var = vect_recog_temp_ssa_var (type, NULL);
@@ -1824,7 +1828,7 @@ vect_recog_vector_vector_shift_pattern (vec<gimple> *stmts,
/* Pattern detected. */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_vector_vector_shift_pattern: detected: ");
+ "vect_recog_vector_vector_shift_pattern: detected:\n");
/* Pattern supported. Create a stmt to be used to replace the pattern. */
var = vect_recog_temp_ssa_var (TREE_TYPE (oprnd0), NULL);
@@ -1942,7 +1946,7 @@ vect_recog_divmod_pattern (vec<gimple> *stmts,
/* Pattern detected. */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_divmod_pattern: detected: ");
+ "vect_recog_divmod_pattern: detected:\n");
cond = build2 (LT_EXPR, boolean_type_node, oprnd0,
build_int_cst (itype, 0));
@@ -2291,6 +2295,7 @@ vect_recog_divmod_pattern (vec<gimple> *stmts,
dump_printf_loc (MSG_NOTE, vect_location,
"vect_recog_divmod_pattern: detected: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
stmts->safe_push (last_stmt);
@@ -2456,7 +2461,7 @@ vect_recog_mixed_size_cond_pattern (vec<gimple> *stmts, tree *type_in,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_mixed_size_cond_pattern: detected: ");
+ "vect_recog_mixed_size_cond_pattern: detected:\n");
return pattern_stmt;
}
@@ -2849,7 +2854,7 @@ vect_recog_bool_pattern (vec<gimple> *stmts, tree *type_in,
stmts->safe_push (last_stmt);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_bool_pattern: detected: ");
+ "vect_recog_bool_pattern: detected:\n");
return pattern_stmt;
}
@@ -2895,7 +2900,7 @@ vect_recog_bool_pattern (vec<gimple> *stmts, tree *type_in,
stmts->safe_push (last_stmt);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_recog_bool_pattern: detected: ");
+ "vect_recog_bool_pattern: detected:\n");
return pattern_stmt;
}
else
@@ -3048,6 +3053,7 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func,
dump_printf_loc (MSG_NOTE, vect_location,
"pattern recognized: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Mark the stmts that are involved in the pattern. */
@@ -3074,6 +3080,7 @@ vect_pattern_recog_1 (vect_recog_func_ptr vect_recog_func,
dump_printf_loc (MSG_NOTE, vect_location,
"additional pattern stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
vect_mark_pattern_stmts (stmt, pattern_stmt, NULL_TREE);
@@ -3173,7 +3180,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_pattern_recog ===");
+ "=== vect_pattern_recog ===\n");
if (loop_vinfo)
{
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 4217f2be54c..b3b3abec110 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
#include "expr.h"
@@ -257,6 +257,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: can't find def for ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -283,6 +284,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: some of the stmts"
" are in a pattern, and others are not ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, oprnd);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -295,7 +297,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Unsupported pattern.");
+ "Unsupported pattern.\n");
return false;
}
@@ -312,7 +314,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
default:
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported defining stmt: ");
+ "unsupported defining stmt:\n");
return false;
}
}
@@ -342,7 +344,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: different types ");
+ "Build SLP failed: different types\n");
return false;
}
@@ -367,6 +369,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: illegal type of def ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, def);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -415,6 +418,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
dump_printf_loc (MSG_NOTE, vect_location, "Build SLP for ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Fail to vectorize statements marked as unvectorizable. */
@@ -425,6 +429,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unvectorizable statement ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -440,6 +445,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: not GIMPLE_ASSIGN nor "
"GIMPLE_CALL ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -457,6 +463,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: condition is not "
"comparison ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -473,6 +480,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: unsupported data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -501,6 +509,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported call type ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -538,7 +547,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: no optab.");
+ "Build SLP failed: no optab.\n");
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -549,7 +558,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: "
- "op not supported by target.");
+ "op not supported by target.\n");
/* Fatal mismatch. */
matches[0] = false;
return false;
@@ -588,6 +597,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: different operation "
"in stmt ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Mismatch. */
continue;
@@ -602,6 +612,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: different shift "
"arguments in ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Mismatch. */
continue;
@@ -622,6 +633,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: different calls in ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Mismatch. */
continue;
@@ -661,6 +673,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"loads have gaps ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -685,6 +698,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"the SLP group size ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -707,6 +721,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"interleaving chains in one node ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Mismatch. */
continue;
@@ -731,6 +746,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"unaligned load ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -749,6 +765,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: not grouped load ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* FORNOW: Not grouped loads are not supported. */
@@ -769,6 +786,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
"Build SLP failed: operation");
dump_printf (MSG_MISSED_OPTIMIZATION, " unsupported ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Fatal mismatch. */
matches[0] = false;
@@ -790,6 +808,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
" operation");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
/* Mismatch. */
continue;
@@ -1076,6 +1095,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn)
else
for (i = 0; i < group_size; ++i)
dump_printf (MSG_NOTE, "%d ", i);
+ dump_printf (MSG_NOTE, "\n");
}
/* In case of reduction every load permutation is allowed, since the order
@@ -1187,6 +1207,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn)
"unsupported unaligned load ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
first_load, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -1449,6 +1470,7 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -1465,9 +1487,9 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (unrolling_factor != 1 && !loop_vinfo)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unrolling required in basic"
- " block SLP");
+ " block SLP\n");
return false;
}
@@ -1514,9 +1536,9 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
if (unrolling_factor != 1 && !loop_vinfo)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unrolling required in basic"
- " block SLP");
+ " block SLP\n");
vect_free_slp_tree (node);
loads.release ();
return false;
@@ -1567,10 +1589,11 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported load "
"permutation ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
vect_free_slp_instance (new_instance);
return false;
@@ -1618,7 +1641,7 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
bool ok = false;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "=== vect_analyze_slp ===");
+ dump_printf_loc (MSG_NOTE, vect_location, "=== vect_analyze_slp ===\n");
if (loop_vinfo)
{
@@ -1638,7 +1661,7 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Failed to SLP the basic block.");
+ "Failed to SLP the basic block.\n");
return false;
}
@@ -1680,7 +1703,8 @@ vect_make_slp_decision (loop_vec_info loop_vinfo)
int decided_to_slp = 0;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "=== vect_make_slp_decision ===");
+ dump_printf_loc (MSG_NOTE, vect_location, "=== vect_make_slp_decision ==="
+ "\n");
FOR_EACH_VEC_ELT (slp_instances, i, instance)
{
@@ -1699,7 +1723,7 @@ vect_make_slp_decision (loop_vec_info loop_vinfo)
if (decided_to_slp && dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Decided to SLP %d instances. Unrolling factor %d",
+ "Decided to SLP %d instances. Unrolling factor %d\n",
decided_to_slp, unrolling_factor);
return (decided_to_slp > 0);
@@ -1763,7 +1787,8 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo)
slp_instance instance;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "=== vect_detect_hybrid_slp ===");
+ dump_printf_loc (MSG_NOTE, vect_location, "=== vect_detect_hybrid_slp ==="
+ "\n");
FOR_EACH_VEC_ELT (slp_instances, i, instance)
vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance));
@@ -2016,7 +2041,7 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo)
vec_inside_cost);
dump_printf (MSG_NOTE, " Vector prologue cost: %d\n", vec_prologue_cost);
dump_printf (MSG_NOTE, " Vector epilogue cost: %d\n", vec_epilogue_cost);
- dump_printf (MSG_NOTE, " Scalar cost of basic block: %d", scalar_cost);
+ dump_printf (MSG_NOTE, " Scalar cost of basic block: %d\n", scalar_cost);
}
/* Vectorization is profitable if its cost is less than the cost of scalar
@@ -2135,7 +2160,7 @@ vect_slp_analyze_bb_1 (basic_block bb)
if (!vect_slp_analyze_operations (bb_vinfo))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"not vectorized: bad operation in basic block.\n");
destroy_bb_vec_info (bb_vinfo);
@@ -2143,7 +2168,7 @@ vect_slp_analyze_bb_1 (basic_block bb)
}
/* Cost model: check if the vectorization is worthwhile. */
- if (flag_vect_cost_model
+ if (!unlimited_cost_model ()
&& !vect_bb_vectorization_profitable_p (bb_vinfo))
{
if (dump_enabled_p ())
@@ -2239,7 +2264,7 @@ vect_update_slp_costs_according_to_vf (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_update_slp_costs_according_to_vf ===");
+ "=== vect_update_slp_costs_according_to_vf ===\n");
FOR_EACH_VEC_ELT (slp_instances, i, instance)
{
@@ -2739,9 +2764,10 @@ vect_get_mask_element (gimple stmt, int first_mask_element, int m,
{
if (dump_enabled_p ())
{
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"permutation requires at least two vectors ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -2761,6 +2787,7 @@ vect_get_mask_element (gimple stmt, int first_mask_element, int m,
"permutation requires at "
"least three vectors ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -2828,6 +2855,7 @@ vect_transform_slp_perm_load (slp_tree node, vec<tree> dr_chain,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"no vect permute for ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -2998,6 +3026,7 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
dump_printf_loc (MSG_NOTE,vect_location,
"------>vectorizing SLP node starting from: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Loads should be inserted before the first load. */
@@ -3104,7 +3133,7 @@ vect_schedule_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
instance, vf);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vectorizing stmts using SLP.");
+ "vectorizing stmts using SLP.\n");
}
FOR_EACH_VEC_ELT (slp_instances, i, instance)
@@ -3168,6 +3197,7 @@ vect_slp_transform_bb (basic_block bb)
dump_printf_loc (MSG_NOTE, vect_location,
"------>SLPing statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
stmt_info = vinfo_for_stmt (stmt);
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index bc4ea1e3097..7d9c9ed8d7d 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "expr.h"
#include "recog.h" /* FIXME: for insn_data */
@@ -191,7 +191,7 @@ vect_mark_relevant (vec<gimple> *worklist, gimple stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "mark relevant %d, live %d.", relevant, live_p);
+ "mark relevant %d, live %d.\n", relevant, live_p);
/* If this stmt is an original stmt in a pattern, we might need to mark its
related pattern stmt instead of the original stmt. However, such stmts
@@ -248,7 +248,7 @@ vect_mark_relevant (vec<gimple> *worklist, gimple stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"last stmt in pattern. don't mark"
- " relevant/live.");
+ " relevant/live.\n");
stmt_info = vinfo_for_stmt (pattern_stmt);
gcc_assert (STMT_VINFO_RELATED_STMT (stmt_info) == stmt);
save_relevant = STMT_VINFO_RELEVANT (stmt_info);
@@ -266,7 +266,7 @@ vect_mark_relevant (vec<gimple> *worklist, gimple stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "already marked relevant/live.");
+ "already marked relevant/live.\n");
return;
}
@@ -311,7 +311,7 @@ vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vec_stmt_relevant_p: stmt has vdefs.");
+ "vec_stmt_relevant_p: stmt has vdefs.\n");
*relevant = vect_used_in_scope;
}
@@ -325,7 +325,7 @@ vect_stmt_relevant_p (gimple stmt, loop_vec_info loop_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vec_stmt_relevant_p: used out of loop.");
+ "vec_stmt_relevant_p: used out of loop.\n");
if (is_gimple_debug (USE_STMT (use_p)))
continue;
@@ -438,7 +438,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: unsupported use in stmt.");
+ "not vectorized: unsupported use in stmt.\n");
return false;
}
@@ -449,7 +449,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
if (!flow_bb_inside_loop_p (loop, def_bb))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "def_stmt is out of loop.");
+ dump_printf_loc (MSG_NOTE, vect_location, "def_stmt is out of loop.\n");
return true;
}
@@ -468,7 +468,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "reduc-stmt defining reduc-phi in the same nest.");
+ "reduc-stmt defining reduc-phi in the same nest.\n");
if (STMT_VINFO_IN_PATTERN_P (dstmt_vinfo))
dstmt_vinfo = vinfo_for_stmt (STMT_VINFO_RELATED_STMT (dstmt_vinfo));
gcc_assert (STMT_VINFO_RELEVANT (dstmt_vinfo) < vect_used_by_reduction);
@@ -488,7 +488,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "outer-loop def-stmt defining inner-loop stmt.");
+ "outer-loop def-stmt defining inner-loop stmt.\n");
switch (relevant)
{
@@ -526,7 +526,7 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "inner-loop def-stmt defining outer-loop stmt.");
+ "inner-loop def-stmt defining outer-loop stmt.\n");
switch (relevant)
{
@@ -590,7 +590,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vect_mark_stmts_to_be_vectorized ===");
+ "=== vect_mark_stmts_to_be_vectorized ===\n");
worklist.create (64);
@@ -605,6 +605,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "init: phi relevant? ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
+ dump_printf (MSG_NOTE, "\n");
}
if (vect_stmt_relevant_p (phi, loop_vinfo, &relevant, &live_p))
@@ -617,6 +618,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "init: stmt relevant? ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
if (vect_stmt_relevant_p (stmt, loop_vinfo, &relevant, &live_p))
@@ -635,6 +637,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
dump_printf_loc (MSG_NOTE, vect_location, "worklist: examine stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Examine the USEs of STMT. For each USE, mark the stmt that defines it
@@ -678,7 +681,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
default:
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported use of reduction.");
+ "unsupported use of reduction.\n");
worklist.release ();
return false;
}
@@ -693,7 +696,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported use of nested cycle.");
+ "unsupported use of nested cycle.\n");
worklist.release ();
return false;
@@ -708,7 +711,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported use of double reduction.");
+ "unsupported use of double reduction.\n");
worklist.release ();
return false;
@@ -832,7 +835,7 @@ vect_model_simple_cost (stmt_vec_info stmt_info, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_simple_cost: inside_cost = %d, "
- "prologue_cost = %d .", inside_cost, prologue_cost);
+ "prologue_cost = %d .\n", inside_cost, prologue_cost);
}
@@ -878,7 +881,7 @@ vect_model_promotion_demotion_cost (stmt_vec_info stmt_info,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_promotion_demotion_cost: inside_cost = %d, "
- "prologue_cost = %d .", inside_cost, prologue_cost);
+ "prologue_cost = %d .\n", inside_cost, prologue_cost);
}
/* Function vect_cost_group_size
@@ -961,7 +964,7 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_store_cost: strided group_size = %d .",
+ "vect_model_store_cost: strided group_size = %d .\n",
group_size);
}
@@ -971,7 +974,7 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_store_cost: inside_cost = %d, "
- "prologue_cost = %d .", inside_cost, prologue_cost);
+ "prologue_cost = %d .\n", inside_cost, prologue_cost);
}
@@ -995,7 +998,7 @@ vect_get_store_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_store_cost: aligned.");
+ "vect_model_store_cost: aligned.\n");
break;
}
@@ -1008,7 +1011,7 @@ vect_get_store_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_store_cost: unaligned supported by "
- "hardware.");
+ "hardware.\n");
break;
}
@@ -1018,7 +1021,7 @@ vect_get_store_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "vect_model_store_cost: unsupported access.");
+ "vect_model_store_cost: unsupported access.\n");
break;
}
@@ -1076,8 +1079,8 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies,
stmt_info, 0, vect_body);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_load_cost: strided group_size = %d .",
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_load_cost: strided group_size = %d .\n",
group_size);
}
@@ -1102,7 +1105,7 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_load_cost: inside_cost = %d, "
- "prologue_cost = %d .", inside_cost, prologue_cost);
+ "prologue_cost = %d .\n", inside_cost, prologue_cost);
}
@@ -1128,7 +1131,7 @@ vect_get_load_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_load_cost: aligned.");
+ "vect_model_load_cost: aligned.\n");
break;
}
@@ -1142,7 +1145,7 @@ vect_get_load_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_load_cost: unaligned supported by "
- "hardware.");
+ "hardware.\n");
break;
}
@@ -1161,17 +1164,17 @@ vect_get_load_cost (struct data_reference *dr, int ncopies,
stmt_info, 0, vect_body);
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_load_cost: explicit realign");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "vect_model_load_cost: explicit realign\n");
break;
}
case dr_explicit_realign_optimized:
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location,
+ dump_printf_loc (MSG_NOTE, vect_location,
"vect_model_load_cost: unaligned software "
- "pipelined.");
+ "pipelined.\n");
/* Unaligned software pipeline has a load of an address, an initial
load, and possibly a mask operation to "prime" the loop. However,
@@ -1198,7 +1201,8 @@ vect_get_load_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vect_model_load_cost: explicit realign optimized");
+ "vect_model_load_cost: explicit realign optimized"
+ "\n");
break;
}
@@ -1209,7 +1213,7 @@ vect_get_load_cost (struct data_reference *dr, int ncopies,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "vect_model_load_cost: unsupported access.");
+ "vect_model_load_cost: unsupported access.\n");
break;
}
@@ -1262,6 +1266,7 @@ vect_init_vector_1 (gimple stmt, gimple new_stmt, gimple_stmt_iterator *gsi)
dump_printf_loc (MSG_NOTE, vect_location,
"created new init_stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, new_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
}
@@ -1344,6 +1349,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
dump_printf_loc (MSG_NOTE, vect_location,
"vect_get_vec_def_for_operand: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, op);
+ dump_printf (MSG_NOTE, "\n");
}
is_simple_use = vect_is_simple_use (op, stmt, loop_vinfo, NULL,
@@ -1357,6 +1363,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
dump_printf_loc (MSG_NOTE, vect_location, "def = ");
loc_printed = 1;
dump_generic_expr (MSG_NOTE, TDF_SLIM, def);
+ dump_printf (MSG_NOTE, "\n");
}
if (def_stmt)
{
@@ -1365,6 +1372,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
else
dump_printf_loc (MSG_NOTE, vect_location, " def_stmt = ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
}
@@ -1383,7 +1391,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
/* Create 'vect_cst_ = {cst,cst,...,cst}' */
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Create vector_cst. nunits = %d", nunits);
+ "Create vector_cst. nunits = %d\n", nunits);
return vect_init_vector (stmt, op, vector_type, NULL);
}
@@ -1399,7 +1407,7 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def)
/* Create 'vec_inv = {inv,inv,..,inv}' */
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "Create vector_inv.");
+ dump_printf_loc (MSG_NOTE, vect_location, "Create vector_inv.\n");
return vect_init_vector (stmt, def, vector_type, NULL);
}
@@ -1666,6 +1674,7 @@ vect_finish_stmt_generation (gimple stmt, gimple vec_stmt,
{
dump_printf_loc (MSG_NOTE, vect_location, "add new stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, vec_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
gimple_set_location (vec_stmt, gimple_location (stmt));
@@ -1775,7 +1784,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "argument types differ.");
+ "argument types differ.\n");
return false;
}
if (!rhs_type)
@@ -1786,7 +1795,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
@@ -1797,7 +1806,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "argument vector types differ.");
+ "argument vector types differ.\n");
return false;
}
}
@@ -1814,6 +1823,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"no vectype for scalar type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, rhs_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -1855,7 +1865,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "function is not vectorizable.");
+ "function is not vectorizable.\n");
return false;
}
}
@@ -1877,7 +1887,8 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
STMT_VINFO_TYPE (stmt_info) = call_vec_info_type;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_call ===");
+ dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_call ==="
+ "\n");
vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL);
return true;
}
@@ -1885,7 +1896,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
/** Transform. **/
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "transform call.");
+ dump_printf_loc (MSG_NOTE, vect_location, "transform call.\n");
/* Handle def. */
scalar_dest = gimple_call_lhs (stmt);
@@ -2408,7 +2419,8 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "type conversion to/from bit-precision unsupported.");
+ "type conversion to/from bit-precision unsupported."
+ "\n");
return false;
}
@@ -2418,7 +2430,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
if (op_type == binary_op)
@@ -2440,7 +2452,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
}
@@ -2458,6 +2470,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"no vectype for scalar type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, rhs_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -2499,7 +2512,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
unsupported:
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "conversion not supported by target.");
+ "conversion not supported by target.\n");
return false;
case WIDEN:
@@ -2598,7 +2611,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vectorizable_conversion ===");
+ "=== vectorizable_conversion ===\n");
if (code == FIX_TRUNC_EXPR || code == FLOAT_EXPR)
{
STMT_VINFO_TYPE (stmt_info) = type_conversion_vec_info_type;
@@ -2621,7 +2634,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
/** Transform. **/
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "transform conversion. ncopies = %d.", ncopies);
+ "transform conversion. ncopies = %d.\n", ncopies);
if (op_type == binary_op)
{
@@ -2662,7 +2675,7 @@ vectorizable_conversion (gimple stmt, gimple_stmt_iterator *gsi,
{
if (modifier == WIDEN)
{
- vec_oprnds0.create (multi_step_cvt ? vect_pow2(multi_step_cvt) : 1);
+ vec_oprnds0.create (multi_step_cvt ? vect_pow2 (multi_step_cvt) : 1);
if (op_type == binary_op)
vec_oprnds1.create (1);
}
@@ -2967,7 +2980,7 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
@@ -2997,7 +3010,7 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"type conversion to/from bit-precision "
- "unsupported.");
+ "unsupported.\n");
return false;
}
@@ -3006,14 +3019,14 @@ vectorizable_assignment (gimple stmt, gimple_stmt_iterator *gsi,
STMT_VINFO_TYPE (stmt_info) = assignment_vec_info_type;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vectorizable_assignment ===");
+ "=== vectorizable_assignment ===\n");
vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL);
return true;
}
/** Transform. **/
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "transform assignment.");
+ dump_printf_loc (MSG_NOTE, vect_location, "transform assignment.\n");
/* Handle def. */
vec_dest = vect_create_destination_var (scalar_dest, vectype);
@@ -3162,7 +3175,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bit-precision shifts not supported.");
+ "bit-precision shifts not supported.\n");
return false;
}
@@ -3172,7 +3185,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
/* If op0 is an external or constant def use a vector type with
@@ -3185,7 +3198,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no vectype for scalar type ");
+ "no vectype for scalar type\n");
return false;
}
@@ -3200,7 +3213,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
@@ -3245,7 +3258,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "operand mode requires invariant argument.");
+ "operand mode requires invariant argument.\n");
return false;
}
@@ -3255,7 +3268,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
optab = optab_for_tree_code (code, vectype, optab_vector);
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vector/vector shift/rotate found.");
+ "vector/vector shift/rotate found.\n");
if (!op1_vectype)
op1_vectype = get_same_sized_vectype (TREE_TYPE (op1), vectype_out);
@@ -3265,7 +3278,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"unusable type for last operand in"
- " vector/vector shift/rotate.");
+ " vector/vector shift/rotate.\n");
return false;
}
}
@@ -3279,7 +3292,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vector/scalar shift/rotate found.");
+ "vector/scalar shift/rotate found.\n");
}
else
{
@@ -3292,7 +3305,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "vector/vector shift/rotate found.");
+ "vector/vector shift/rotate found.\n");
/* Unlike the other binary operators, shifts/rotates have
the rhs being int, instead of the same type as the lhs,
@@ -3310,7 +3323,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"unusable type for last operand in"
- " vector/vector shift/rotate.");
+ " vector/vector shift/rotate.\n");
return false;
}
if (vec_stmt && !slp_node)
@@ -3329,7 +3342,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no optab.");
+ "no optab.\n");
return false;
}
vec_mode = TYPE_MODE (vectype);
@@ -3338,14 +3351,15 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "op not supported by target.");
+ "op not supported by target.\n");
/* Check only during analysis. */
if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD
|| (vf < vect_min_worthwhile_factor (code)
&& !vec_stmt))
return false;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "proceeding using word mode.");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "proceeding using word mode.\n");
}
/* Worthwhile without SIMD support? Check only during analysis. */
@@ -3355,7 +3369,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not worthwhile without SIMD support.");
+ "not worthwhile without SIMD support.\n");
return false;
}
@@ -3363,7 +3377,8 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
STMT_VINFO_TYPE (stmt_info) = shift_vec_info_type;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "=== vectorizable_shift ===");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "=== vectorizable_shift ===\n");
vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL);
return true;
}
@@ -3372,7 +3387,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "transform binary/unary operation.");
+ "transform binary/unary operation.\n");
/* Handle def. */
vec_dest = vect_create_destination_var (scalar_dest, vectype);
@@ -3394,7 +3409,7 @@ vectorizable_shift (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "operand 1 using scalar mode.");
+ "operand 1 using scalar mode.\n");
vec_oprnd1 = op1;
vec_oprnds1.create (slp_node ? slp_node->vec_stmts_size : 1);
vec_oprnds1.quick_push (vec_oprnd1);
@@ -3525,7 +3540,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "num. args = %d (not unary/binary/ternary op).",
+ "num. args = %d (not unary/binary/ternary op).\n",
op_type);
return false;
}
@@ -3544,7 +3559,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "bit-precision arithmetic not supported.");
+ "bit-precision arithmetic not supported.\n");
return false;
}
@@ -3554,7 +3569,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
/* If op0 is an external or constant def use a vector type with
@@ -3571,6 +3586,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
"no vectype for scalar type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
TREE_TYPE (op0));
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -3589,7 +3605,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
}
@@ -3601,7 +3617,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
}
@@ -3643,7 +3659,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no optab.");
+ "no optab.\n");
return false;
}
icode = (int) optab_handler (optab, vec_mode);
@@ -3653,13 +3669,14 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "op not supported by target.");
+ "op not supported by target.\n");
/* Check only during analysis. */
if (GET_MODE_SIZE (vec_mode) != UNITS_PER_WORD
|| (!vec_stmt && vf < vect_min_worthwhile_factor (code)))
return false;
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "proceeding using word mode.");
+ dump_printf_loc (MSG_NOTE, vect_location,
+ "proceeding using word mode.\n");
}
/* Worthwhile without SIMD support? Check only during analysis. */
@@ -3669,7 +3686,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not worthwhile without SIMD support.");
+ "not worthwhile without SIMD support.\n");
return false;
}
@@ -3678,7 +3695,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
STMT_VINFO_TYPE (stmt_info) = op_vec_info_type;
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "=== vectorizable_operation ===");
+ "=== vectorizable_operation ===\n");
vect_model_simple_cost (stmt_info, ncopies, dt, NULL, NULL);
return true;
}
@@ -3687,7 +3704,7 @@ vectorizable_operation (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "transform binary/unary operation.");
+ "transform binary/unary operation.\n");
/* Handle def. */
vec_dest = vect_create_destination_var (scalar_dest, vectype);
@@ -3897,7 +3914,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "multiple types in nested loop.");
+ "multiple types in nested loop.\n");
return false;
}
@@ -3932,7 +3949,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
@@ -3953,7 +3970,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "negative step for store.");
+ "negative step for store.\n");
return false;
}
@@ -3984,7 +4001,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "use not simple.");
+ "use not simple.\n");
return false;
}
next_stmt = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt));
@@ -4048,7 +4065,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "transform store. ncopies = %d", ncopies);
+ "transform store. ncopies = %d\n", ncopies);
dr_chain.create (group_size);
oprnds.create (group_size);
@@ -4165,6 +4182,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
dataref_ptr = unshare_expr (DR_BASE_ADDRESS (first_dr));
dataref_offset = build_int_cst (reference_alias_ptr_type
(DR_REF (first_dr)), 0);
+ inv_p = false;
}
else
dataref_ptr
@@ -4459,7 +4477,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "multiple types in nested loop.");
+ "multiple types in nested loop.\n");
return false;
}
@@ -4500,7 +4518,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Aligned load, but unsupported type.");
+ "Aligned load, but unsupported type.\n");
return false;
}
@@ -4536,7 +4554,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "gather index use not simple.");
+ "gather index use not simple.\n");
return false;
}
}
@@ -4552,7 +4570,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "multiple types with negative step.");
+ "multiple types with negative step.\n");
return false;
}
@@ -4562,7 +4580,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "negative step for group load not supported");
+ "negative step for group load not supported"
+ "\n");
return false;
}
alignment_support_scheme = vect_supportable_dr_alignment (dr, false);
@@ -4571,14 +4590,15 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "negative step but alignment required.");
+ "negative step but alignment required.\n");
return false;
}
if (!perm_mask_for_reverse (vectype))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "negative step and reversing not supported.");
+ "negative step and reversing not supported."
+ "\n");
return false;
}
}
@@ -4593,7 +4613,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "transform load. ncopies = %d", ncopies);
+ "transform load. ncopies = %d\n", ncopies);
/** Transform. **/
@@ -4770,7 +4790,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
(unshare_expr (DR_BASE_ADDRESS (dr)),
size_binop (PLUS_EXPR,
convert_to_ptrofftype (unshare_expr (DR_OFFSET (dr))),
- convert_to_ptrofftype (DR_INIT(dr))));
+ convert_to_ptrofftype (DR_INIT (dr))));
stride_step = fold_convert (sizetype, unshare_expr (DR_STEP (dr)));
/* For a load with loop-invariant (but other than power-of-2)
@@ -5058,6 +5078,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
dataref_ptr = unshare_expr (DR_BASE_ADDRESS (first_dr));
dataref_offset = build_int_cst (reference_alias_ptr_type
(DR_REF (first_dr)), 0);
+ inv_p = false;
}
else
dataref_ptr
@@ -5444,7 +5465,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "value used after loop.");
+ "value used after loop.\n");
return false;
}
@@ -5654,13 +5675,14 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
{
dump_printf_loc (MSG_NOTE, vect_location, "==> examining statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
if (gimple_has_volatile_ops (stmt))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: stmt has volatile operands");
+ "not vectorized: stmt has volatile operands\n");
return false;
}
@@ -5696,12 +5718,13 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
dump_printf_loc (MSG_NOTE, vect_location,
"==> examining pattern statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
}
else
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "irrelevant.");
+ dump_printf_loc (MSG_NOTE, vect_location, "irrelevant.\n");
return true;
}
@@ -5718,6 +5741,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
dump_printf_loc (MSG_NOTE, vect_location,
"==> examining pattern statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
if (!vect_analyze_stmt (pattern_stmt, need_to_vectorize, node))
@@ -5742,6 +5766,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
dump_printf_loc (MSG_NOTE, vect_location,
"==> examining pattern def statement: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, pattern_def_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
if (!vect_analyze_stmt (pattern_def_stmt,
@@ -5781,6 +5806,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
dump_printf_loc (MSG_NOTE, vect_location,
"get vectype for scalar type: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, scalar_type);
+ dump_printf (MSG_NOTE, "\n");
}
vectype = get_vectype_for_scalar_type (scalar_type);
@@ -5792,6 +5818,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
"not SLPed: unsupported data-type ");
dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM,
scalar_type);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
}
@@ -5800,6 +5827,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
{
dump_printf_loc (MSG_NOTE, vect_location, "vectype: ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, vectype);
+ dump_printf (MSG_NOTE, "\n");
}
STMT_VINFO_VECTYPE (stmt_info) = vectype;
@@ -5846,6 +5874,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
"not vectorized: relevant stmt not ");
dump_printf (MSG_MISSED_OPTIMIZATION, "supported: ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -5868,6 +5897,7 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node)
"not vectorized: live stmt not ");
dump_printf (MSG_MISSED_OPTIMIZATION, "supported: ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+ dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
}
return false;
@@ -5964,7 +5994,7 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "stmt not supported.");
+ "stmt not supported.\n");
gcc_unreachable ();
}
}
@@ -5989,7 +6019,7 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi,
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location,
- "Record the vdef for outer-loop vectorization.");
+ "Record the vdef for outer-loop vectorization.\n");
/* Find the relevant loop-exit phi-node, and reord the vec_stmt there
(to be used when vectorizing outer-loop stmts that use the DEF of
@@ -6303,6 +6333,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
dump_printf_loc (MSG_NOTE, vect_location,
"vect_is_simple_use: operand ");
dump_generic_expr (MSG_NOTE, TDF_SLIM, operand);
+ dump_printf (MSG_NOTE, "\n");
}
if (CONSTANT_CLASS_P (operand))
@@ -6321,7 +6352,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
if (TREE_CODE (operand) == PAREN_EXPR)
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "non-associatable copy.");
+ dump_printf_loc (MSG_NOTE, vect_location, "non-associatable copy.\n");
operand = TREE_OPERAND (operand, 0);
}
@@ -6329,7 +6360,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not ssa-name.");
+ "not ssa-name.\n");
return false;
}
@@ -6338,7 +6369,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "no def_stmt.");
+ "no def_stmt.\n");
return false;
}
@@ -6346,6 +6377,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
{
dump_printf_loc (MSG_NOTE, vect_location, "def_stmt: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, *def_stmt, 0);
+ dump_printf (MSG_NOTE, "\n");
}
/* Empty stmt is expected only in case of a function argument.
@@ -6376,12 +6408,12 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Unsupported pattern.");
+ "Unsupported pattern.\n");
return false;
}
if (dump_enabled_p ())
- dump_printf_loc (MSG_NOTE, vect_location, "type of def: %d.", *dt);
+ dump_printf_loc (MSG_NOTE, vect_location, "type of def: %d.\n", *dt);
switch (gimple_code (*def_stmt))
{
@@ -6401,7 +6433,7 @@ vect_is_simple_use (tree operand, gimple stmt, loop_vec_info loop_vinfo,
default:
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "unsupported defining stmt: ");
+ "unsupported defining stmt:\n");
return false;
}
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 575cb756245..87404cf0536 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -62,7 +62,7 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "tree.h"
#include "tree-pretty-print.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-vectorizer.h"
#include "tree-pass.h"
@@ -341,7 +341,7 @@ vectorize_loops (void)
than all previously defined loops. This fact allows us to run
only over initial loops skipping newly generated ones. */
FOR_EACH_LOOP (li, loop, 0)
- if ((flag_tree_vectorize && optimize_loop_nest_for_speed_p (loop))
+ if ((flag_tree_loop_vectorize && optimize_loop_nest_for_speed_p (loop))
|| loop->force_vect)
{
loop_vec_info loop_vinfo;
@@ -486,10 +486,7 @@ execute_vect_slp (void)
static bool
gate_vect_slp (void)
{
- /* Apply SLP either if the vectorizer is on and the user didn't specify
- whether to run SLP or not, or if the SLP flag was set by the user. */
- return ((flag_tree_vectorize != 0 && flag_tree_slp_vectorize != 0)
- || flag_tree_slp_vectorize == 1);
+ return flag_tree_slp_vectorize != 0;
}
namespace {
@@ -513,8 +510,8 @@ const pass_data pass_data_slp_vectorize =
class pass_slp_vectorize : public gimple_opt_pass
{
public:
- pass_slp_vectorize(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_slp_vectorize, ctxt)
+ pass_slp_vectorize (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_slp_vectorize, ctxt)
{}
/* opt_pass methods: */
@@ -553,7 +550,7 @@ increase_alignment (void)
tree t;
unsigned int alignment;
- t = TREE_TYPE(decl);
+ t = TREE_TYPE (decl);
if (TREE_CODE (t) != ARRAY_TYPE)
continue;
vectype = get_vectype_for_scalar_type (strip_array_types (t));
@@ -579,7 +576,7 @@ increase_alignment (void)
static bool
gate_increase_alignment (void)
{
- return flag_section_anchors && flag_tree_vectorize;
+ return flag_section_anchors && flag_tree_loop_vectorize;
}
@@ -603,8 +600,8 @@ const pass_data pass_data_ipa_increase_alignment =
class pass_ipa_increase_alignment : public simple_ipa_opt_pass
{
public:
- pass_ipa_increase_alignment(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_increase_alignment, ctxt)
+ pass_ipa_increase_alignment (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_increase_alignment, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 9c7753e2eaf..a5cef5a58ad 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -27,7 +27,7 @@ along with GCC; see the file COPYING3. If not see
typedef source_location LOC;
#define UNKNOWN_LOC UNKNOWN_LOCATION
-#define EXPR_LOC(e) EXPR_LOCATION(e)
+#define EXPR_LOC(e) EXPR_LOCATION (e)
#define LOC_FILE(l) LOCATION_FILE (l)
#define LOC_LINE(l) LOCATION_LINE (l)
@@ -356,7 +356,7 @@ typedef struct _loop_vec_info {
&& TREE_INT_CST_LOW ((n)) > 0)
#define LOOP_VINFO_NITERS_KNOWN_P(L) \
-NITERS_KNOWN_P((L)->num_iters)
+NITERS_KNOWN_P ((L)->num_iters)
static inline loop_vec_info
loop_vec_info_for_loop (struct loop *loop)
@@ -880,6 +880,14 @@ known_alignment_for_access_p (struct data_reference *data_ref_info)
return (DR_MISALIGNMENT (data_ref_info) != -1);
}
+
+/* Return true if the vect cost model is unlimited. */
+static inline bool
+unlimited_cost_model ()
+{
+ return flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED;
+}
+
/* Source location */
extern LOC vect_location;
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index d5548ff55eb..52d90080c19 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "tree.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-dump.h"
#include "gimple-pretty-print.h"
@@ -36,14 +36,12 @@ along with GCC; see the file COPYING3. If not see
#include "tree-scalar-evolution.h"
#include "tree-ssa-propagate.h"
#include "tree-chrec.h"
+#include "tree-ssa-threadupdate.h"
#include "gimple-fold.h"
#include "expr.h"
#include "optabs.h"
-/* Type of value ranges. See value_range_d for a description of these
- types. */
-enum value_range_type { VR_UNDEFINED, VR_RANGE, VR_ANTI_RANGE, VR_VARYING };
/* Range of values that can be associated with an SSA_NAME after VRP
has executed. */
@@ -5856,7 +5854,7 @@ find_assert_locations_1 (basic_block bb, sbitmap live)
}
/* Traverse all PHI nodes in BB, updating live. */
- for (si = gsi_start_phis (bb); !gsi_end_p(si); gsi_next (&si))
+ for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
use_operand_p arg_p;
ssa_op_iter i;
@@ -9452,6 +9450,51 @@ vrp_finalize (void)
the datastructures built by VRP. */
identify_jump_threads ();
+ /* Set value range to non pointer SSA_NAMEs. */
+ for (i = 0; i < num_vr_values; i++)
+ if (vr_value[i])
+ {
+ tree name = ssa_name (i);
+
+ if (!name
+ || POINTER_TYPE_P (TREE_TYPE (name))
+ || (vr_value[i]->type == VR_VARYING)
+ || (vr_value[i]->type == VR_UNDEFINED))
+ continue;
+
+ if ((TREE_CODE (vr_value[i]->min) == INTEGER_CST)
+ && (TREE_CODE (vr_value[i]->max) == INTEGER_CST))
+ {
+ if (vr_value[i]->type == VR_RANGE)
+ set_range_info (name,
+ tree_to_double_int (vr_value[i]->min),
+ tree_to_double_int (vr_value[i]->max));
+ else if (vr_value[i]->type == VR_ANTI_RANGE)
+ {
+ /* VR_ANTI_RANGE ~[min, max] is encoded compactly as
+ [max + 1, min - 1] without additional attributes.
+ When min value > max value, we know that it is
+ VR_ANTI_RANGE; it is VR_RANGE otherwise. */
+
+ /* ~[0,0] anti-range is represented as
+ range. */
+ if (TYPE_UNSIGNED (TREE_TYPE (name))
+ && integer_zerop (vr_value[i]->min)
+ && integer_zerop (vr_value[i]->max))
+ set_range_info (name,
+ double_int_one,
+ double_int::max_value
+ (TYPE_PRECISION (TREE_TYPE (name)), true));
+ else
+ set_range_info (name,
+ tree_to_double_int (vr_value[i]->max)
+ + double_int_one,
+ tree_to_double_int (vr_value[i]->min)
+ - double_int_one);
+ }
+ }
+ }
+
/* Free allocated memory. */
for (i = 0; i < num_vr_values; i++)
if (vr_value[i])
@@ -9622,12 +9665,12 @@ const pass_data pass_data_vrp =
class pass_vrp : public gimple_opt_pass
{
public:
- pass_vrp(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_vrp, ctxt)
+ pass_vrp (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_vrp, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_vrp (ctxt_); }
+ opt_pass * clone () { return new pass_vrp (m_ctxt); }
bool gate () { return gate_vrp (); }
unsigned int execute () { return execute_vrp (); }
diff --git a/gcc/tree.c b/gcc/tree.c
index 61815046fae..ebee116f0c5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -47,7 +47,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-iterator.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "params.h"
#include "pointer-set.h"
#include "tree-pass.h"
@@ -1007,7 +1007,7 @@ copy_node_stat (tree node MEM_STAT_DECL)
TYPE_SYMTAB_ADDRESS (t) = 0;
/* Do not copy the values cache. */
- if (TYPE_CACHED_VALUES_P(t))
+ if (TYPE_CACHED_VALUES_P (t))
{
TYPE_CACHED_VALUES_P (t) = 0;
TYPE_CACHED_VALUES (t) = NULL_TREE;
@@ -1112,7 +1112,7 @@ force_fit_type_double (tree type, double_int cst, int overflowable,
bool sign_extended_type = !TYPE_UNSIGNED (type);
/* If we need to set overflow flags, return a new unshared node. */
- if (overflowed || !double_int_fits_to_tree_p(type, cst))
+ if (overflowed || !double_int_fits_to_tree_p (type, cst))
{
if (overflowed
|| overflowable < 0
@@ -1726,7 +1726,7 @@ build_one_cst (tree type)
case FIXED_POINT_TYPE:
/* We can only generate 1 for accum types. */
gcc_assert (ALL_SCALAR_ACCUM_MODE_P (TYPE_MODE (type)));
- return build_fixed (type, FCONST1(TYPE_MODE (type)));
+ return build_fixed (type, FCONST1 (TYPE_MODE (type)));
case VECTOR_TYPE:
{
@@ -4118,8 +4118,8 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
read_only = 1;
side_effects = TREE_SIDE_EFFECTS (t);
- PROCESS_ARG(0);
- PROCESS_ARG(1);
+ PROCESS_ARG (0);
+ PROCESS_ARG (1);
TREE_READONLY (t) = read_only;
TREE_CONSTANT (t) = constant;
@@ -4158,9 +4158,9 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
else
side_effects = TREE_SIDE_EFFECTS (t);
- PROCESS_ARG(0);
- PROCESS_ARG(1);
- PROCESS_ARG(2);
+ PROCESS_ARG (0);
+ PROCESS_ARG (1);
+ PROCESS_ARG (2);
if (code == COND_EXPR)
TREE_READONLY (t) = read_only;
@@ -4187,10 +4187,10 @@ build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
side_effects = TREE_SIDE_EFFECTS (t);
- PROCESS_ARG(0);
- PROCESS_ARG(1);
- PROCESS_ARG(2);
- PROCESS_ARG(3);
+ PROCESS_ARG (0);
+ PROCESS_ARG (1);
+ PROCESS_ARG (2);
+ PROCESS_ARG (3);
TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
@@ -4214,11 +4214,11 @@ build5_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
side_effects = TREE_SIDE_EFFECTS (t);
- PROCESS_ARG(0);
- PROCESS_ARG(1);
- PROCESS_ARG(2);
- PROCESS_ARG(3);
- PROCESS_ARG(4);
+ PROCESS_ARG (0);
+ PROCESS_ARG (1);
+ PROCESS_ARG (2);
+ PROCESS_ARG (3);
+ PROCESS_ARG (4);
TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
@@ -4263,24 +4263,6 @@ mem_ref_offset (const_tree t)
return tree_to_double_int (toff).sext (TYPE_PRECISION (TREE_TYPE (toff)));
}
-/* Return the pointer-type relevant for TBAA purposes from the
- gimple memory reference tree T. This is the type to be used for
- the offset operand of MEM_REF or TARGET_MEM_REF replacements of T. */
-
-tree
-reference_alias_ptr_type (const_tree t)
-{
- const_tree base = t;
- while (handled_component_p (base))
- base = TREE_OPERAND (base, 0);
- if (TREE_CODE (base) == MEM_REF)
- return TREE_TYPE (TREE_OPERAND (base, 1));
- else if (TREE_CODE (base) == TARGET_MEM_REF)
- return TREE_TYPE (TMR_OFFSET (base));
- else
- return build_pointer_type (TYPE_MAIN_VARIANT (TREE_TYPE (base)));
-}
-
/* Return an invariant ADDR_EXPR of type TYPE taking the address of BASE
offsetted by OFFSET units. */
@@ -5533,8 +5515,8 @@ const pass_data pass_data_ipa_free_lang_data =
class pass_ipa_free_lang_data : public simple_ipa_opt_pass
{
public:
- pass_ipa_free_lang_data(gcc::context *ctxt)
- : simple_ipa_opt_pass(pass_data_ipa_free_lang_data, ctxt)
+ pass_ipa_free_lang_data (gcc::context *ctxt)
+ : simple_ipa_opt_pass (pass_data_ipa_free_lang_data, ctxt)
{}
/* opt_pass methods: */
@@ -6698,9 +6680,11 @@ attribute_list_contained (const_tree l1, const_tree l2)
/* This CONST_CAST is okay because lookup_attribute does not
modify its argument and the return value is assigned to a
const_tree. */
- for (attr = lookup_ident_attribute (get_attribute_name (t2), CONST_CAST_TREE(l1));
+ for (attr = lookup_ident_attribute (get_attribute_name (t2),
+ CONST_CAST_TREE (l1));
attr != NULL_TREE && !attribute_value_equal (t2, attr);
- attr = lookup_ident_attribute (get_attribute_name (t2), TREE_CHAIN (attr)))
+ attr = lookup_ident_attribute (get_attribute_name (t2),
+ TREE_CHAIN (attr)))
;
if (attr == NULL_TREE)
@@ -7298,21 +7282,6 @@ iterative_hash_expr (const_tree t, hashval_t val)
}
return val;
}
- case MEM_REF:
- {
- /* The type of the second operand is relevant, except for
- its top-level qualifiers. */
- tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (t, 1)));
-
- val = iterative_hash_object (TYPE_HASH (type), val);
-
- /* We could use the standard hash computation from this point
- on. */
- val = iterative_hash_object (code, val);
- val = iterative_hash_expr (TREE_OPERAND (t, 1), val);
- val = iterative_hash_expr (TREE_OPERAND (t, 0), val);
- return val;
- }
case FUNCTION_DECL:
/* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
Otherwise nodes that compare equal according to operand_equal_p might
@@ -7834,9 +7803,9 @@ strip_array_types (tree type)
true) or would not differ from ARGTYPES. */
static tree
-maybe_canonicalize_argtypes(tree argtypes,
- bool *any_structural_p,
- bool *any_noncanonical_p)
+maybe_canonicalize_argtypes (tree argtypes,
+ bool *any_structural_p,
+ bool *any_noncanonical_p)
{
tree arg;
bool any_noncanonical_argtypes_p = false;
@@ -9375,7 +9344,7 @@ tree_contains_struct_check_failed (const_tree node,
{
internal_error
("tree check: expected tree that contains %qs structure, have %qs in %s, at %s:%d",
- TS_ENUM_NAME(en),
+ TS_ENUM_NAME (en),
tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
}
@@ -11031,7 +11000,8 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data,
unsigned HOST_WIDE_INT idx;
constructor_elt *ce;
- for (idx = 0; vec_safe_iterate(CONSTRUCTOR_ELTS (*tp), idx, &ce); idx++)
+ for (idx = 0; vec_safe_iterate (CONSTRUCTOR_ELTS (*tp), idx, &ce);
+ idx++)
WALK_SUBTREE (ce->value);
}
break;
@@ -11337,7 +11307,7 @@ stdarg_p (const_tree fntype)
if (!fntype)
return false;
- FOREACH_FUNCTION_ARGS(fntype, t, args_iter)
+ FOREACH_FUNCTION_ARGS (fntype, t, args_iter)
{
n = t;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index 7c1f57b829b..4cd7e9e9f65 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -577,7 +577,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
exit of a function. Calls for which this is true are candidates for tail
call optimizations. */
#define CALL_EXPR_TAILCALL(NODE) \
- (CALL_EXPR_CHECK(NODE)->base.addressable_flag)
+ (CALL_EXPR_CHECK (NODE)->base.addressable_flag)
/* Used as a temporary field on a CASE_LABEL_EXPR to indicate that the
CASE_LOW operand has been processed. */
@@ -585,9 +585,9 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
(CASE_LABEL_EXPR_CHECK (NODE)->base.addressable_flag)
#define PREDICT_EXPR_OUTCOME(NODE) \
- ((enum prediction) (PREDICT_EXPR_CHECK(NODE)->base.addressable_flag))
+ ((enum prediction) (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag))
#define SET_PREDICT_EXPR_OUTCOME(NODE, OUTCOME) \
- (PREDICT_EXPR_CHECK(NODE)->base.addressable_flag = (int) OUTCOME)
+ (PREDICT_EXPR_CHECK (NODE)->base.addressable_flag = (int) OUTCOME)
#define PREDICT_EXPR_PREDICTOR(NODE) \
((enum br_predictor)tree_low_cst (TREE_OPERAND (PREDICT_EXPR_CHECK (NODE), 0), 0))
@@ -659,7 +659,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
/* In a _TYPE, indicates whether TYPE_CACHED_VALUES contains a vector
of cached values, or is something else. */
-#define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK(NODE)->base.public_flag)
+#define TYPE_CACHED_VALUES_P(NODE) (TYPE_CHECK (NODE)->base.public_flag)
/* In a SAVE_EXPR, indicates that the original expression has already
been substituted with a VAR_DECL that contains the value. */
@@ -669,7 +669,7 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
/* Set on a CALL_EXPR if this stdarg call should be passed the argument
pack. */
#define CALL_EXPR_VA_ARG_PACK(NODE) \
- (CALL_EXPR_CHECK(NODE)->base.public_flag)
+ (CALL_EXPR_CHECK (NODE)->base.public_flag)
/* In any expression, decl, or constant, nonzero means it has side effects or
reevaluation of the whole expression could produce a different value.
@@ -848,19 +848,19 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
/* These flags are available for each language front end to use internally. */
#define TREE_LANG_FLAG_0(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_0)
#define TREE_LANG_FLAG_1(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_1)
#define TREE_LANG_FLAG_2(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_2)
#define TREE_LANG_FLAG_3(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_3)
#define TREE_LANG_FLAG_4(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_4)
#define TREE_LANG_FLAG_5(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_5)
#define TREE_LANG_FLAG_6(NODE) \
- (TREE_NOT_CHECK2(NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6)
+ (TREE_NOT_CHECK2 (NODE, TREE_VEC, SSA_NAME)->base.u.bits.lang_flag_6)
/* Define additional fields and accessors for nodes representing constants. */
@@ -1131,7 +1131,7 @@ extern void protected_set_expr_location (tree, location_t);
#define CALL_EXPR_FN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 1)
#define CALL_EXPR_STATIC_CHAIN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 2)
#define CALL_EXPR_ARG(NODE, I) TREE_OPERAND (CALL_EXPR_CHECK (NODE), (I) + 3)
-#define call_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3)
+#define call_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH (NODE) - 3)
/* CALL_EXPR_ARGP returns a pointer to the argument vector for NODE.
We can't use &CALL_EXPR_ARG (NODE, 0) because that will complain if
@@ -1336,7 +1336,11 @@ extern void protected_set_expr_location (tree, location_t);
/* Attributes for SSA_NAMEs for pointer-type variables. */
#define SSA_NAME_PTR_INFO(N) \
- SSA_NAME_CHECK (N)->ssa_name.ptr_info
+ SSA_NAME_CHECK (N)->ssa_name.info.ptr_info
+
+/* Value range info attributes for SSA_NAMEs of non pointer-type variables. */
+#define SSA_NAME_RANGE_INFO(N) \
+ SSA_NAME_CHECK (N)->ssa_name.info.range_info
/* Return the immediate_use information for an SSA_NAME. */
#define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.imm_uses
@@ -1650,10 +1654,10 @@ extern enum machine_mode vector_type_mode (const_tree);
#define TYPE_DOMAIN(NODE) (ARRAY_TYPE_CHECK (NODE)->type_non_common.values)
#define TYPE_FIELDS(NODE) \
(RECORD_OR_UNION_CHECK (NODE)->type_non_common.values)
-#define TYPE_CACHED_VALUES(NODE) (TYPE_CHECK(NODE)->type_non_common.values)
+#define TYPE_CACHED_VALUES(NODE) (TYPE_CHECK (NODE)->type_non_common.values)
#define TYPE_ARG_TYPES(NODE) \
(FUNC_OR_METHOD_CHECK (NODE)->type_non_common.values)
-#define TYPE_VALUES_RAW(NODE) (TYPE_CHECK(NODE)->type_non_common.values)
+#define TYPE_VALUES_RAW(NODE) (TYPE_CHECK (NODE)->type_non_common.values)
#define TYPE_METHODS(NODE) \
(RECORD_OR_UNION_CHECK (NODE)->type_non_common.maxval)
@@ -1682,11 +1686,11 @@ extern enum machine_mode vector_type_mode (const_tree);
/* For record and union types, information about this type, as a base type
for itself. */
-#define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK(NODE)->type_non_common.binfo)
+#define TYPE_BINFO(NODE) (RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo)
/* For non record and union types, used in a language-dependent way. */
#define TYPE_LANG_SLOT_1(NODE) \
- (NOT_RECORD_OR_UNION_CHECK(NODE)->type_non_common.binfo)
+ (NOT_RECORD_OR_UNION_CHECK (NODE)->type_non_common.binfo)
/* Define accessor macros for information about type inheritance
and basetypes.
@@ -1709,16 +1713,16 @@ extern enum machine_mode vector_type_mode (const_tree);
#define BINFO_VIRTUAL_P(NODE) (TREE_BINFO_CHECK (NODE)->base.static_flag)
/* Flags for language dependent use. */
-#define BINFO_MARKED(NODE) TREE_LANG_FLAG_0(TREE_BINFO_CHECK(NODE))
-#define BINFO_FLAG_1(NODE) TREE_LANG_FLAG_1(TREE_BINFO_CHECK(NODE))
-#define BINFO_FLAG_2(NODE) TREE_LANG_FLAG_2(TREE_BINFO_CHECK(NODE))
-#define BINFO_FLAG_3(NODE) TREE_LANG_FLAG_3(TREE_BINFO_CHECK(NODE))
-#define BINFO_FLAG_4(NODE) TREE_LANG_FLAG_4(TREE_BINFO_CHECK(NODE))
-#define BINFO_FLAG_5(NODE) TREE_LANG_FLAG_5(TREE_BINFO_CHECK(NODE))
-#define BINFO_FLAG_6(NODE) TREE_LANG_FLAG_6(TREE_BINFO_CHECK(NODE))
+#define BINFO_MARKED(NODE) TREE_LANG_FLAG_0 (TREE_BINFO_CHECK (NODE))
+#define BINFO_FLAG_1(NODE) TREE_LANG_FLAG_1 (TREE_BINFO_CHECK (NODE))
+#define BINFO_FLAG_2(NODE) TREE_LANG_FLAG_2 (TREE_BINFO_CHECK (NODE))
+#define BINFO_FLAG_3(NODE) TREE_LANG_FLAG_3 (TREE_BINFO_CHECK (NODE))
+#define BINFO_FLAG_4(NODE) TREE_LANG_FLAG_4 (TREE_BINFO_CHECK (NODE))
+#define BINFO_FLAG_5(NODE) TREE_LANG_FLAG_5 (TREE_BINFO_CHECK (NODE))
+#define BINFO_FLAG_6(NODE) TREE_LANG_FLAG_6 (TREE_BINFO_CHECK (NODE))
/* The actual data type node being inherited in this basetype. */
-#define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK(NODE))
+#define BINFO_TYPE(NODE) TREE_TYPE (TREE_BINFO_CHECK (NODE))
/* The offset where this basetype appears in its containing type.
BINFO_OFFSET slot holds the offset (in bytes)
@@ -1726,19 +1730,19 @@ extern enum machine_mode vector_type_mode (const_tree);
object that is allocated on behalf of this `type'.
This is always 0 except when there is multiple inheritance. */
-#define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK(NODE)->binfo.offset)
+#define BINFO_OFFSET(NODE) (TREE_BINFO_CHECK (NODE)->binfo.offset)
#define BINFO_OFFSET_ZEROP(NODE) (integer_zerop (BINFO_OFFSET (NODE)))
/* The virtual function table belonging to this basetype. Virtual
function tables provide a mechanism for run-time method dispatching.
The entries of a virtual function table are language-dependent. */
-#define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vtable)
+#define BINFO_VTABLE(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtable)
/* The virtual functions in the virtual function table. This is
a TREE_LIST that is used as an initial approximation for building
a virtual function table for this basetype. */
-#define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK(NODE)->binfo.virtuals)
+#define BINFO_VIRTUALS(NODE) (TREE_BINFO_CHECK (NODE)->binfo.virtuals)
/* A vector of binfos for the direct basetypes inherited by this
basetype.
@@ -1746,7 +1750,7 @@ extern enum machine_mode vector_type_mode (const_tree);
If this basetype describes type D as inherited in C, and if the
basetypes of D are E and F, then this vector contains binfos for
inheritance of E and F by C. */
-#define BINFO_BASE_BINFOS(NODE) (&TREE_BINFO_CHECK(NODE)->binfo.base_binfos)
+#define BINFO_BASE_BINFOS(NODE) (&TREE_BINFO_CHECK (NODE)->binfo.base_binfos)
/* The number of basetypes for NODE. */
#define BINFO_N_BASE_BINFOS(NODE) (BINFO_BASE_BINFOS (NODE)->length ())
@@ -1764,12 +1768,13 @@ extern enum machine_mode vector_type_mode (const_tree);
base. The actual contents are language-dependent. In the C++
front-end this field is an INTEGER_CST giving an offset into the
vtable where the offset to the virtual base can be found. */
-#define BINFO_VPTR_FIELD(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vptr_field)
+#define BINFO_VPTR_FIELD(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vptr_field)
/* Indicates the accesses this binfo has to its bases. The values are
access_public_node, access_protected_node or access_private_node.
If this array is not present, public access is implied. */
-#define BINFO_BASE_ACCESSES(NODE) (TREE_BINFO_CHECK(NODE)->binfo.base_accesses)
+#define BINFO_BASE_ACCESSES(NODE) \
+ (TREE_BINFO_CHECK (NODE)->binfo.base_accesses)
#define BINFO_BASE_ACCESS(NODE,N) \
(*BINFO_BASE_ACCESSES (NODE))[(N)]
@@ -1778,18 +1783,18 @@ extern enum machine_mode vector_type_mode (const_tree);
/* The index in the VTT where this subobject's sub-VTT can be found.
NULL_TREE if there is no sub-VTT. */
-#define BINFO_SUBVTT_INDEX(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vtt_subvtt)
+#define BINFO_SUBVTT_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_subvtt)
/* The index in the VTT where the vptr for this subobject can be
found. NULL_TREE if there is no secondary vptr in the VTT. */
-#define BINFO_VPTR_INDEX(NODE) (TREE_BINFO_CHECK(NODE)->binfo.vtt_vptr)
+#define BINFO_VPTR_INDEX(NODE) (TREE_BINFO_CHECK (NODE)->binfo.vtt_vptr)
/* The BINFO_INHERITANCE_CHAIN points at the binfo for the base
inheriting this base for non-virtual bases. For virtual bases it
points either to the binfo for which this is a primary binfo, or to
the binfo of the most derived type. */
#define BINFO_INHERITANCE_CHAIN(NODE) \
- (TREE_BINFO_CHECK(NODE)->binfo.inheritance)
+ (TREE_BINFO_CHECK (NODE)->binfo.inheritance)
/* Define fields and accessors for nodes representing declared names. */
@@ -2714,7 +2719,7 @@ inline tree
contains_struct_check (tree __t, const enum tree_node_structure_enum __s,
const char *__f, int __l, const char *__g)
{
- if (tree_contains_struct[TREE_CODE(__t)][__s] != 1)
+ if (tree_contains_struct[TREE_CODE (__t)][__s] != 1)
tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
return __t;
}
@@ -2723,7 +2728,7 @@ inline tree
tree_class_check (tree __t, const enum tree_code_class __class,
const char *__f, int __l, const char *__g)
{
- if (TREE_CODE_CLASS (TREE_CODE(__t)) != __class)
+ if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class)
tree_class_check_failed (__t, __class, __f, __l, __g);
return __t;
}
@@ -2924,7 +2929,7 @@ inline const_tree
contains_struct_check (const_tree __t, const enum tree_node_structure_enum __s,
const char *__f, int __l, const char *__g)
{
- if (tree_contains_struct[TREE_CODE(__t)][__s] != 1)
+ if (tree_contains_struct[TREE_CODE (__t)][__s] != 1)
tree_contains_struct_check_failed (__t, __s, __f, __l, __g);
return __t;
}
@@ -2933,7 +2938,7 @@ inline const_tree
tree_class_check (const_tree __t, const enum tree_code_class __class,
const char *__f, int __l, const char *__g)
{
- if (TREE_CODE_CLASS (TREE_CODE(__t)) != __class)
+ if (TREE_CODE_CLASS (TREE_CODE (__t)) != __class)
tree_class_check_failed (__t, __class, __f, __l, __g);
return __t;
}
@@ -3472,13 +3477,13 @@ extern tree build_all_ones_cst (tree);
extern tree build_zero_cst (tree);
extern tree build_string (int, const char *);
extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);
-#define build_tree_list(t,q) build_tree_list_stat(t,q MEM_STAT_INFO)
+#define build_tree_list(t, q) build_tree_list_stat (t, q MEM_STAT_INFO)
extern tree build_tree_list_vec_stat (const vec<tree, va_gc> *MEM_STAT_DECL);
#define build_tree_list_vec(v) build_tree_list_vec_stat (v MEM_STAT_INFO)
extern tree build_decl_stat (location_t, enum tree_code,
tree, tree MEM_STAT_DECL);
extern tree build_fn_decl (const char *, tree);
-#define build_decl(l,c,t,q) build_decl_stat (l,c,t,q MEM_STAT_INFO)
+#define build_decl(l,c,t,q) build_decl_stat (l, c, t, q MEM_STAT_INFO)
extern tree build_translation_unit_decl (tree);
extern tree build_block (tree, tree, tree, tree);
extern tree build_empty_stmt (location_t);
@@ -3486,7 +3491,7 @@ extern tree build_omp_clause (location_t, enum omp_clause_code);
extern tree find_omp_clause (tree, enum omp_clause_code);
extern tree build_vl_exp_stat (enum tree_code, int MEM_STAT_DECL);
-#define build_vl_exp(c,n) build_vl_exp_stat (c,n MEM_STAT_INFO)
+#define build_vl_exp(c, n) build_vl_exp_stat (c, n MEM_STAT_INFO)
extern tree build_call_nary (tree, tree, int, ...);
extern tree build_call_valist (tree, tree, int, va_list);
@@ -4297,7 +4302,7 @@ extern tree fold_build_call_array_loc (location_t, tree, tree, int, tree *);
extern tree fold_build_call_array_initializer_loc (location_t, tree, tree, int, tree *);
extern bool fold_convertible_p (const_tree, const_tree);
#define fold_convert(T1,T2)\
- fold_convert_loc(UNKNOWN_LOCATION, T1, T2)
+ fold_convert_loc (UNKNOWN_LOCATION, T1, T2)
extern tree fold_convert_loc (location_t, tree, tree);
extern tree fold_single_bit_test (location_t, enum tree_code, tree, tree, tree);
extern tree fold_ignored_result (tree);
@@ -4317,7 +4322,7 @@ extern tree omit_one_operand_loc (location_t, tree, tree, tree);
omit_two_operands_loc (UNKNOWN_LOCATION, T1, T2, T3, T4)
extern tree omit_two_operands_loc (location_t, tree, tree, tree, tree);
#define invert_truthvalue(T)\
- invert_truthvalue_loc(UNKNOWN_LOCATION, T)
+ invert_truthvalue_loc (UNKNOWN_LOCATION, T)
extern tree invert_truthvalue_loc (location_t, tree);
extern tree fold_unary_to_constant (enum tree_code, tree, tree);
extern tree fold_binary_to_constant (enum tree_code, tree, tree, tree);
@@ -4341,7 +4346,6 @@ extern tree build_simple_mem_ref_loc (location_t, tree);
#define build_simple_mem_ref(T)\
build_simple_mem_ref_loc (UNKNOWN_LOCATION, T)
extern double_int mem_ref_offset (const_tree);
-extern tree reference_alias_ptr_type (const_tree);
extern tree build_invariant_address (tree, tree, HOST_WIDE_INT);
extern tree constant_boolean_node (bool, tree);
extern tree div_if_zero_remainder (enum tree_code, const_tree, const_tree);
@@ -4741,10 +4745,6 @@ extern unsigned int tree_decl_map_hash (const void *);
#define tree_vec_map_hash tree_decl_map_hash
#define tree_vec_map_marked_p tree_map_base_marked_p
-/* In tree-ssa.c */
-
-tree target_for_debug_bind (tree);
-
/* In tree-ssa-address.c. */
extern tree tree_mem_ref_addr (tree, tree);
extern void copy_ref_info (tree, tree);
diff --git a/gcc/tsan.c b/gcc/tsan.c
index fb91129eb67..3619f25045d 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "gimple.h"
#include "function.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "tree-iterator.h"
#include "langhooks.h"
@@ -753,12 +753,12 @@ const pass_data pass_data_tsan =
class pass_tsan : public gimple_opt_pass
{
public:
- pass_tsan(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tsan, ctxt)
+ pass_tsan (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tsan, ctxt)
{}
/* opt_pass methods: */
- opt_pass * clone () { return new pass_tsan (ctxt_); }
+ opt_pass * clone () { return new pass_tsan (m_ctxt); }
bool gate () { return tsan_gate (); }
unsigned int execute () { return tsan_pass (); }
@@ -798,8 +798,8 @@ const pass_data pass_data_tsan_O0 =
class pass_tsan_O0 : public gimple_opt_pass
{
public:
- pass_tsan_O0(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_tsan_O0, ctxt)
+ pass_tsan_O0 (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_tsan_O0, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/tsystem.h b/gcc/tsystem.h
index 157bc225e12..bc628a076d8 100644
--- a/gcc/tsystem.h
+++ b/gcc/tsystem.h
@@ -129,7 +129,7 @@ extern int errno;
#define gcc_unreachable() (abort ())
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
-#define CONST_CAST(TYPE,X) CONST_CAST2(TYPE, const TYPE, (X))
+#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
/* Filename handling macros. */
#include "filenames.h"
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index b8d40d52128..9dc19c9d29a 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -233,10 +233,9 @@ ubsan_source_location (location_t loc)
static unsigned short
get_ubsan_type_info_for_type (tree type)
{
- int prec = exact_log2 (TYPE_PRECISION (type));
- if (prec == -1)
- error ("unexpected size of type %qT", type);
-
+ gcc_assert (TYPE_SIZE (type) && host_integerp (TYPE_SIZE (type), 1));
+ int prec = exact_log2 (tree_low_cst (TYPE_SIZE (type), 1));
+ gcc_assert (prec != -1);
return (prec << 1) | !TYPE_UNSIGNED (type);
}
@@ -260,11 +259,18 @@ ubsan_type_descriptor (tree type)
unsigned short tkind, tinfo;
/* At least for INTEGER_TYPE/REAL_TYPE/COMPLEX_TYPE, this should work.
- ??? For e.g. type_unsigned_for (type), the TYPE_NAME would be NULL. */
+ For e.g. type_unsigned_for (type) or bit-fields, the TYPE_NAME
+ would be NULL. */
if (TYPE_NAME (type) != NULL)
- tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ {
+ if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
+ tname = IDENTIFIER_POINTER (TYPE_NAME (type));
+ else
+ tname = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)));
+ }
else
tname = "<unknown>";
+
if (TREE_CODE (type) == INTEGER_TYPE)
{
/* For INTEGER_TYPE, this is 0x0000. */
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index 498eb907e81..597e9c0f5c0 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "optabs.h"
#include "regs.h"
#include "ggc.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-flow-inline.h"
#include "diagnostic.h"
#include "gimple-pretty-print.h"
@@ -249,7 +249,7 @@ dump_histogram_value (FILE *dump_file, histogram_value hist)
if (hist->hvalue.counters)
{
unsigned int i;
- fprintf(dump_file, " [");
+ fprintf (dump_file, " [");
for (i = 0; i < hist->hdata.intvl.steps; i++)
fprintf (dump_file, " %d:"HOST_WIDEST_INT_PRINT_DEC,
hist->hdata.intvl.int_start + i,
@@ -589,7 +589,7 @@ check_counter (gimple stmt, const char * name,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus,
"correcting inconsistent value profile: %s "
"profiler overall count (%d) does not match BB "
- "count (%d)", name, (int)*all, (int)bb_count);
+ "count (%d)\n", name, (int)*all, (int)bb_count);
*all = bb_count;
if (*count > *all)
*count = *all;
@@ -1275,7 +1275,7 @@ check_ic_target (gimple call_stmt, struct cgraph_node *target)
locus = gimple_location (call_stmt);
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, locus,
- "Skipping target %s with mismatching types for icall ",
+ "Skipping target %s with mismatching types for icall\n",
cgraph_node_name (target));
return false;
}
@@ -1568,7 +1568,7 @@ gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
fndecl = gimple_call_fndecl (vcall_stmt);
if (!interesting_stringop_to_profile_p (fndecl, vcall_stmt, &size_arg))
- gcc_unreachable();
+ gcc_unreachable ();
cond_bb = gimple_bb (vcall_stmt);
gsi = gsi_for_stmt (vcall_stmt);
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index 6f8b08dfcc2..24c61ccd2a2 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -104,7 +104,7 @@
#include "regs.h"
#include "expr.h"
#include "tree-pass.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "cselib.h"
#include "target.h"
#include "params.h"
@@ -2877,7 +2877,7 @@ variable_union (variable src, dataflow_set *set)
/* The most common case, much simpler, no qsort is needed. */
location_chain dstnode = dst->var_part[j].loc_chain;
dst->var_part[k].loc_chain = dstnode;
- VAR_PART_OFFSET (dst, k) = VAR_PART_OFFSET(dst, j);
+ VAR_PART_OFFSET (dst, k) = VAR_PART_OFFSET (dst, j);
node2 = dstnode;
for (node = src->var_part[i].loc_chain; node; node = node->next)
if (!((REG_P (dstnode->loc)
@@ -10256,8 +10256,8 @@ const pass_data pass_data_variable_tracking =
class pass_variable_tracking : public rtl_opt_pass
{
public:
- pass_variable_tracking(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_variable_tracking, ctxt)
+ pass_variable_tracking (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_variable_tracking, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 0504eeb4f39..12fb7c46b33 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3085,7 +3085,7 @@ compare_constant (const tree t1, const tree t2)
case MINUS_EXPR:
case RANGE_EXPR:
return (compare_constant (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0))
- && compare_constant(TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1)));
+ && compare_constant (TREE_OPERAND (t1, 1), TREE_OPERAND (t2, 1)));
CASE_CONVERT:
case VIEW_CONVERT_EXPR:
@@ -5546,9 +5546,9 @@ void
do_assemble_alias (tree decl, tree target)
{
/* Emulated TLS had better not get this var. */
- gcc_assert(!(!targetm.have_tls
- && TREE_CODE (decl) == VAR_DECL
- && DECL_THREAD_LOCAL_P (decl)));
+ gcc_assert (!(!targetm.have_tls
+ && TREE_CODE (decl) == VAR_DECL
+ && DECL_THREAD_LOCAL_P (decl)));
if (TREE_ASM_WRITTEN (decl))
return;
diff --git a/gcc/varpool.c b/gcc/varpool.c
index 2e47d288536..d5324adb52b 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "output.h"
#include "gimple.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "flags.h"
/* List of hooks triggered on varpool_node events. */
diff --git a/gcc/vec.c b/gcc/vec.c
index 979ecc81ba5..1303d531c0f 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -183,8 +183,8 @@ vec_prefix::calculate_allocation (vec_prefix *pfx, unsigned reserve,
if (pfx)
{
- alloc = pfx->alloc_;
- num = pfx->num_;
+ alloc = pfx->m_alloc;
+ num = pfx->m_num;
}
else if (!reserve)
/* If there's no vector, and we've not requested anything, then we
diff --git a/gcc/vec.h b/gcc/vec.h
index 09a1d0a4d86..60b77ec0ffc 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -235,8 +235,8 @@ struct vec_prefix
friend struct va_heap;
friend struct va_stack;
- unsigned alloc_;
- unsigned num_;
+ unsigned m_alloc;
+ unsigned m_num;
};
template<typename, typename, typename> struct vec;
@@ -285,7 +285,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
MEM_STAT_DECL)
{
unsigned alloc
- = vec_prefix::calculate_allocation (v ? &v->vecpfx_ : 0, reserve, exact);
+ = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact);
if (!alloc)
{
release (v);
@@ -293,7 +293,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
}
if (GATHER_STATISTICS && v)
- v->vecpfx_.release_overhead ();
+ v->m_vecpfx.release_overhead ();
size_t size = vec<T, va_heap, vl_embed>::embedded_size (alloc);
unsigned nelem = v ? v->length () : 0;
@@ -301,7 +301,7 @@ va_heap::reserve (vec<T, va_heap, vl_embed> *&v, unsigned reserve, bool exact
v->embedded_init (alloc, nelem);
if (GATHER_STATISTICS)
- v->vecpfx_.register_overhead (size FINAL_PASS_MEM_STAT);
+ v->m_vecpfx.register_overhead (size FINAL_PASS_MEM_STAT);
}
@@ -315,7 +315,7 @@ va_heap::release (vec<T, va_heap, vl_embed> *&v)
return;
if (GATHER_STATISTICS)
- v->vecpfx_.release_overhead ();
+ v->m_vecpfx.release_overhead ();
::free (v);
v = NULL;
}
@@ -364,7 +364,7 @@ va_gc::reserve (vec<T, A, vl_embed> *&v, unsigned reserve, bool exact
MEM_STAT_DECL)
{
unsigned alloc
- = vec_prefix::calculate_allocation (v ? &v->vecpfx_ : 0, reserve, exact);
+ = vec_prefix::calculate_allocation (v ? &v->m_vecpfx : 0, reserve, exact);
if (!alloc)
{
::ggc_free (v);
@@ -433,9 +433,9 @@ void
va_stack::alloc (vec<T, va_stack, vl_ptr> &v, unsigned nelems,
vec<T, va_stack, vl_embed> *space)
{
- v.vec_ = space;
- register_stack_vec (static_cast<void *> (v.vec_));
- v.vec_->embedded_init (nelems, 0);
+ v.m_vec = space;
+ register_stack_vec (static_cast<void *> (v.m_vec));
+ v.m_vec->embedded_init (nelems, 0);
}
@@ -462,16 +462,16 @@ va_stack::reserve (vec<T, va_stack, vl_embed> *&v, unsigned nelems, bool exact
}
/* Move VEC_ to the heap. */
- nelems += v->vecpfx_.num_;
+ nelems += v->m_vecpfx.m_num;
vec<T, va_stack, vl_embed> *oldvec = v;
v = NULL;
va_heap::reserve (reinterpret_cast<vec<T, va_heap, vl_embed> *&>(v), nelems,
exact PASS_MEM_STAT);
if (v && oldvec)
{
- v->vecpfx_.num_ = oldvec->length ();
- memcpy (v->vecdata_,
- oldvec->vecdata_,
+ v->m_vecpfx.m_num = oldvec->length ();
+ memcpy (v->m_vecdata,
+ oldvec->m_vecdata,
oldvec->length () * sizeof (T));
}
}
@@ -562,11 +562,11 @@ template<typename T, typename A>
struct GTY((user)) vec<T, A, vl_embed>
{
public:
- unsigned allocated (void) const { return vecpfx_.alloc_; }
- unsigned length (void) const { return vecpfx_.num_; }
- bool is_empty (void) const { return vecpfx_.num_ == 0; }
- T *address (void) { return vecdata_; }
- const T *address (void) const { return vecdata_; }
+ unsigned allocated (void) const { return m_vecpfx.m_alloc; }
+ unsigned length (void) const { return m_vecpfx.m_num; }
+ bool is_empty (void) const { return m_vecpfx.m_num == 0; }
+ T *address (void) { return m_vecdata; }
+ const T *address (void) const { return m_vecdata; }
const T &operator[] (unsigned) const;
T &operator[] (unsigned);
T &last (void);
@@ -601,8 +601,8 @@ public:
/* FIXME - These fields should be private, but we need to cater to
compilers that have stricter notions of PODness for types. */
- vec_prefix vecpfx_;
- T vecdata_[1];
+ vec_prefix m_vecpfx;
+ T m_vecdata[1];
};
@@ -719,7 +719,7 @@ vec_safe_grow_cleared (vec<T, A, vl_embed> *&v, unsigned len CXX_MEM_STAT_INFO)
{
unsigned oldlen = vec_safe_length (v);
vec_safe_grow (v, len PASS_MEM_STAT);
- memset (&(v->address()[oldlen]), 0, sizeof (T) * (len - oldlen));
+ memset (&(v->address ()[oldlen]), 0, sizeof (T) * (len - oldlen));
}
@@ -816,16 +816,16 @@ template<typename T, typename A>
inline const T &
vec<T, A, vl_embed>::operator[] (unsigned ix) const
{
- gcc_checking_assert (ix < vecpfx_.num_);
- return vecdata_[ix];
+ gcc_checking_assert (ix < m_vecpfx.m_num);
+ return m_vecdata[ix];
}
template<typename T, typename A>
inline T &
vec<T, A, vl_embed>::operator[] (unsigned ix)
{
- gcc_checking_assert (ix < vecpfx_.num_);
- return vecdata_[ix];
+ gcc_checking_assert (ix < m_vecpfx.m_num);
+ return m_vecdata[ix];
}
@@ -835,8 +835,8 @@ template<typename T, typename A>
inline T &
vec<T, A, vl_embed>::last (void)
{
- gcc_checking_assert (vecpfx_.num_ > 0);
- return (*this)[vecpfx_.num_ - 1];
+ gcc_checking_assert (m_vecpfx.m_num > 0);
+ return (*this)[m_vecpfx.m_num - 1];
}
@@ -850,7 +850,7 @@ template<typename T, typename A>
inline bool
vec<T, A, vl_embed>::space (unsigned nelems) const
{
- return vecpfx_.alloc_ - vecpfx_.num_ >= nelems;
+ return m_vecpfx.m_alloc - m_vecpfx.m_num >= nelems;
}
@@ -858,16 +858,16 @@ vec<T, A, vl_embed>::space (unsigned nelems) const
element of this vector. Use this to iterate over the elements of a
vector as follows,
- for (ix = 0; vec<T, A>::iterate(v, ix, &ptr); ix++)
+ for (ix = 0; vec<T, A>::iterate (v, ix, &ptr); ix++)
continue; */
template<typename T, typename A>
inline bool
vec<T, A, vl_embed>::iterate (unsigned ix, T *ptr) const
{
- if (ix < vecpfx_.num_)
+ if (ix < m_vecpfx.m_num)
{
- *ptr = vecdata_[ix];
+ *ptr = m_vecdata[ix];
return true;
}
else
@@ -882,7 +882,7 @@ vec<T, A, vl_embed>::iterate (unsigned ix, T *ptr) const
IX'th element of this vector. Use this to iterate over the
elements of a vector as follows,
- for (ix = 0; v->iterate(ix, &ptr); ix++)
+ for (ix = 0; v->iterate (ix, &ptr); ix++)
continue;
This variant is for vectors of objects. */
@@ -891,9 +891,9 @@ template<typename T, typename A>
inline bool
vec<T, A, vl_embed>::iterate (unsigned ix, T **ptr) const
{
- if (ix < vecpfx_.num_)
+ if (ix < m_vecpfx.m_num)
{
- *ptr = CONST_CAST (T *, &vecdata_[ix]);
+ *ptr = CONST_CAST (T *, &m_vecdata[ix]);
return true;
}
else
@@ -916,7 +916,7 @@ vec<T, A, vl_embed>::copy (ALONE_MEM_STAT_DECL) const
{
vec_alloc (new_vec, len PASS_MEM_STAT);
new_vec->embedded_init (len, len);
- memcpy (new_vec->address(), vecdata_, sizeof (T) * len);
+ memcpy (new_vec->address (), m_vecdata, sizeof (T) * len);
}
return new_vec;
}
@@ -929,12 +929,12 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::splice (vec<T, A, vl_embed> &src)
{
- unsigned len = src.length();
+ unsigned len = src.length ();
if (len)
{
gcc_checking_assert (space (len));
- memcpy (address() + length(), src.address(), len * sizeof (T));
- vecpfx_.num_ += len;
+ memcpy (address () + length (), src.address (), len * sizeof (T));
+ m_vecpfx.m_num += len;
}
}
@@ -956,7 +956,7 @@ inline T *
vec<T, A, vl_embed>::quick_push (const T &obj)
{
gcc_checking_assert (space (1));
- T *slot = &vecdata_[vecpfx_.num_++];
+ T *slot = &m_vecdata[m_vecpfx.m_num++];
*slot = obj;
return slot;
}
@@ -969,7 +969,7 @@ inline T &
vec<T, A, vl_embed>::pop (void)
{
gcc_checking_assert (length () > 0);
- return vecdata_[--vecpfx_.num_];
+ return m_vecdata[--m_vecpfx.m_num];
}
@@ -981,7 +981,7 @@ inline void
vec<T, A, vl_embed>::truncate (unsigned size)
{
gcc_checking_assert (length () >= size);
- vecpfx_.num_ = size;
+ m_vecpfx.m_num = size;
}
@@ -994,8 +994,8 @@ vec<T, A, vl_embed>::quick_insert (unsigned ix, const T &obj)
{
gcc_checking_assert (length () < allocated ());
gcc_checking_assert (ix <= length ());
- T *slot = &vecdata_[ix];
- memmove (slot + 1, slot, (vecpfx_.num_++ - ix) * sizeof (T));
+ T *slot = &m_vecdata[ix];
+ memmove (slot + 1, slot, (m_vecpfx.m_num++ - ix) * sizeof (T));
*slot = obj;
}
@@ -1008,9 +1008,9 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::ordered_remove (unsigned ix)
{
- gcc_checking_assert (ix < length());
- T *slot = &vecdata_[ix];
- memmove (slot, slot + 1, (--vecpfx_.num_ - ix) * sizeof (T));
+ gcc_checking_assert (ix < length ());
+ T *slot = &m_vecdata[ix];
+ memmove (slot, slot + 1, (--m_vecpfx.m_num - ix) * sizeof (T));
}
@@ -1021,8 +1021,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::unordered_remove (unsigned ix)
{
- gcc_checking_assert (ix < length());
- vecdata_[ix] = vecdata_[--vecpfx_.num_];
+ gcc_checking_assert (ix < length ());
+ m_vecdata[ix] = m_vecdata[--m_vecpfx.m_num];
}
@@ -1033,10 +1033,10 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::block_remove (unsigned ix, unsigned len)
{
- gcc_checking_assert (ix + len <= length());
- T *slot = &vecdata_[ix];
- vecpfx_.num_ -= len;
- memmove (slot, slot + len, (vecpfx_.num_ - ix) * sizeof (T));
+ gcc_checking_assert (ix + len <= length ());
+ T *slot = &m_vecdata[ix];
+ m_vecpfx.m_num -= len;
+ memmove (slot, slot + len, (m_vecpfx.m_num - ix) * sizeof (T));
}
@@ -1047,7 +1047,7 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::qsort (int (*cmp) (const void *, const void *))
{
- ::qsort (address(), length(), sizeof (T), cmp);
+ ::qsort (address (), length (), sizeof (T), cmp);
}
@@ -1091,7 +1091,7 @@ vec<T, A, vl_embed>::lower_bound (T obj, bool (*lessthan)(const T &, const T &))
final member):
size_t vec<T, A, vl_embed>::embedded_size (unsigned alloc);
- void v->embedded_init(unsigned alloc, unsigned num);
+ void v->embedded_init (unsigned alloc, unsigned num);
These allow the caller to perform the memory allocation. */
@@ -1100,7 +1100,7 @@ inline size_t
vec<T, A, vl_embed>::embedded_size (unsigned alloc)
{
typedef vec<T, A, vl_embed> vec_embedded;
- return offsetof (vec_embedded, vecdata_) + alloc * sizeof (T);
+ return offsetof (vec_embedded, m_vecdata) + alloc * sizeof (T);
}
@@ -1111,8 +1111,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::embedded_init (unsigned alloc, unsigned num)
{
- vecpfx_.alloc_ = alloc;
- vecpfx_.num_ = num;
+ m_vecpfx.m_alloc = alloc;
+ m_vecpfx.m_num = num;
}
@@ -1123,8 +1123,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_embed>::quick_grow (unsigned len)
{
- gcc_checking_assert (length () <= len && len <= vecpfx_.alloc_);
- vecpfx_.num_ = len;
+ gcc_checking_assert (length () <= len && len <= m_vecpfx.m_alloc);
+ m_vecpfx.m_num = len;
}
@@ -1137,7 +1137,7 @@ vec<T, A, vl_embed>::quick_grow_cleared (unsigned len)
{
unsigned oldlen = length ();
quick_grow (len);
- memset (&(address()[oldlen]), 0, sizeof (T) * (len - oldlen));
+ memset (&(address ()[oldlen]), 0, sizeof (T) * (len - oldlen));
}
@@ -1229,37 +1229,37 @@ public:
/* Vector operations. */
bool exists (void) const
- { return vec_ != NULL; }
+ { return m_vec != NULL; }
bool is_empty (void) const
- { return vec_ ? vec_->is_empty() : true; }
+ { return m_vec ? m_vec->is_empty () : true; }
unsigned length (void) const
- { return vec_ ? vec_->length() : 0; }
+ { return m_vec ? m_vec->length () : 0; }
T *address (void)
- { return vec_ ? vec_->vecdata_ : NULL; }
+ { return m_vec ? m_vec->m_vecdata : NULL; }
const T *address (void) const
- { return vec_ ? vec_->vecdata_ : NULL; }
+ { return m_vec ? m_vec->m_vecdata : NULL; }
const T &operator[] (unsigned ix) const
- { return (*vec_)[ix]; }
+ { return (*m_vec)[ix]; }
bool operator!=(const vec &other) const
{ return !(*this == other); }
bool operator==(const vec &other) const
- { return address() == other.address(); }
+ { return address () == other.address (); }
T &operator[] (unsigned ix)
- { return (*vec_)[ix]; }
+ { return (*m_vec)[ix]; }
T &last (void)
- { return vec_->last(); }
+ { return m_vec->last (); }
bool space (int nelems) const
- { return vec_ ? vec_->space (nelems) : nelems == 0; }
+ { return m_vec ? m_vec->space (nelems) : nelems == 0; }
bool iterate (unsigned ix, T *p) const;
bool iterate (unsigned ix, T **p) const;
@@ -1285,12 +1285,12 @@ public:
unsigned lower_bound (T, bool (*)(const T &, const T &)) const;
template<typename T1>
- friend void va_stack::alloc(vec<T1, va_stack, vl_ptr>&, unsigned,
- vec<T1, va_stack, vl_embed> *);
+ friend void va_stack::alloc (vec<T1, va_stack, vl_ptr>&, unsigned,
+ vec<T1, va_stack, vl_embed> *);
/* FIXME - This field should be private, but we need to cater to
compilers that have stricter notions of PODness for types. */
- vec<T, A, vl_embed> *vec_;
+ vec<T, A, vl_embed> *m_vec;
};
@@ -1386,15 +1386,15 @@ vec_free (vec<T> *&v)
element of this vector. Use this to iterate over the elements of a
vector as follows,
- for (ix = 0; v.iterate(ix, &ptr); ix++)
+ for (ix = 0; v.iterate (ix, &ptr); ix++)
continue; */
template<typename T, typename A>
inline bool
vec<T, A, vl_ptr>::iterate (unsigned ix, T *ptr) const
{
- if (vec_)
- return vec_->iterate (ix, ptr);
+ if (m_vec)
+ return m_vec->iterate (ix, ptr);
else
{
*ptr = 0;
@@ -1407,7 +1407,7 @@ vec<T, A, vl_ptr>::iterate (unsigned ix, T *ptr) const
IX'th element of this vector. Use this to iterate over the
elements of a vector as follows,
- for (ix = 0; v->iterate(ix, &ptr); ix++)
+ for (ix = 0; v->iterate (ix, &ptr); ix++)
continue;
This variant is for vectors of objects. */
@@ -1416,8 +1416,8 @@ template<typename T, typename A>
inline bool
vec<T, A, vl_ptr>::iterate (unsigned ix, T **ptr) const
{
- if (vec_)
- return vec_->iterate (ix, ptr);
+ if (m_vec)
+ return m_vec->iterate (ix, ptr);
else
{
*ptr = 0;
@@ -1457,7 +1457,7 @@ vec<T, A, vl_ptr>::copy (ALONE_MEM_STAT_DECL) const
{
vec<T, A, vl_ptr> new_vec = vNULL;
if (length ())
- new_vec.vec_ = vec_->copy ();
+ new_vec.m_vec = m_vec->copy ();
return new_vec;
}
@@ -1477,7 +1477,7 @@ vec<T, A, vl_ptr>::reserve (unsigned nelems, bool exact MEM_STAT_DECL)
{
bool extend = nelems ? !space (nelems) : false;
if (extend)
- A::reserve (vec_, nelems, exact PASS_MEM_STAT);
+ A::reserve (m_vec, nelems, exact PASS_MEM_STAT);
return extend;
}
@@ -1504,7 +1504,7 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::create (unsigned nelems MEM_STAT_DECL)
{
- vec_ = NULL;
+ m_vec = NULL;
if (nelems > 0)
reserve_exact (nelems PASS_MEM_STAT);
}
@@ -1516,8 +1516,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::release (void)
{
- if (vec_)
- A::release (vec_);
+ if (m_vec)
+ A::release (m_vec);
}
@@ -1530,8 +1530,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::splice (vec<T, A, vl_ptr> &src)
{
- if (src.vec_)
- vec_->splice (*(src.vec_));
+ if (src.m_vec)
+ m_vec->splice (*(src.m_vec));
}
@@ -1544,9 +1544,9 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::safe_splice (vec<T, A, vl_ptr> &src MEM_STAT_DECL)
{
- if (src.length())
+ if (src.length ())
{
- reserve_exact (src.length());
+ reserve_exact (src.length ());
splice (src);
}
}
@@ -1560,7 +1560,7 @@ template<typename T, typename A>
inline T *
vec<T, A, vl_ptr>::quick_push (const T &obj)
{
- return vec_->quick_push (obj);
+ return m_vec->quick_push (obj);
}
@@ -1583,7 +1583,7 @@ template<typename T, typename A>
inline T &
vec<T, A, vl_ptr>::pop (void)
{
- return vec_->pop ();
+ return m_vec->pop ();
}
@@ -1594,8 +1594,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::truncate (unsigned size)
{
- if (vec_)
- vec_->truncate (size);
+ if (m_vec)
+ m_vec->truncate (size);
else
gcc_checking_assert (size == 0);
}
@@ -1612,7 +1612,7 @@ vec<T, A, vl_ptr>::safe_grow (unsigned len MEM_STAT_DECL)
unsigned oldlen = length ();
gcc_checking_assert (oldlen <= len);
reserve_exact (len - oldlen PASS_MEM_STAT);
- vec_->quick_grow (len);
+ m_vec->quick_grow (len);
}
@@ -1626,7 +1626,7 @@ vec<T, A, vl_ptr>::safe_grow_cleared (unsigned len MEM_STAT_DECL)
{
unsigned oldlen = length ();
safe_grow (len PASS_MEM_STAT);
- memset (&(address()[oldlen]), 0, sizeof (T) * (len - oldlen));
+ memset (&(address ()[oldlen]), 0, sizeof (T) * (len - oldlen));
}
@@ -1637,8 +1637,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::quick_grow (unsigned len)
{
- gcc_checking_assert (vec_);
- vec_->quick_grow (len);
+ gcc_checking_assert (m_vec);
+ m_vec->quick_grow (len);
}
@@ -1650,8 +1650,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::quick_grow_cleared (unsigned len)
{
- gcc_checking_assert (vec_);
- vec_->quick_grow_cleared (len);
+ gcc_checking_assert (m_vec);
+ m_vec->quick_grow_cleared (len);
}
@@ -1662,7 +1662,7 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::quick_insert (unsigned ix, const T &obj)
{
- vec_->quick_insert (ix, obj);
+ m_vec->quick_insert (ix, obj);
}
@@ -1686,7 +1686,7 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::ordered_remove (unsigned ix)
{
- vec_->ordered_remove (ix);
+ m_vec->ordered_remove (ix);
}
@@ -1697,7 +1697,7 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::unordered_remove (unsigned ix)
{
- vec_->unordered_remove (ix);
+ m_vec->unordered_remove (ix);
}
@@ -1708,7 +1708,7 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::block_remove (unsigned ix, unsigned len)
{
- vec_->block_remove (ix, len);
+ m_vec->block_remove (ix, len);
}
@@ -1719,8 +1719,8 @@ template<typename T, typename A>
inline void
vec<T, A, vl_ptr>::qsort (int (*cmp) (const void *, const void *))
{
- if (vec_)
- vec_->qsort (cmp);
+ if (m_vec)
+ m_vec->qsort (cmp);
}
@@ -1734,11 +1734,11 @@ inline unsigned
vec<T, A, vl_ptr>::lower_bound (T obj, bool (*lessthan)(const T &, const T &))
const
{
- return vec_ ? vec_->lower_bound (obj, lessthan) : 0;
+ return m_vec ? m_vec->lower_bound (obj, lessthan) : 0;
}
#if (GCC_VERSION >= 3000)
-# pragma GCC poison vec_ vecpfx_ vecdata_
+# pragma GCC poison m_vec m_vecpfx m_vecdata
#endif
#endif // GCC_VEC_H
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 9f05c1cd32b..9f308a6fdf2 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -221,9 +221,9 @@ const struct gcc_debug_hooks vmsdbg_debug_hooks
#ifndef UNALIGNED_OFFSET_ASM_OP
#define UNALIGNED_OFFSET_ASM_OP(OFFSET) \
- (NUMBYTES(OFFSET) == 4 \
+ (NUMBYTES (OFFSET) == 4 \
? VMS_UNALIGNED_LONG_ASM_OP \
- : (NUMBYTES(OFFSET) == 2 ? VMS_UNALIGNED_SHORT_ASM_OP : VMS_ASM_BYTE_OP))
+ : (NUMBYTES (OFFSET) == 2 ? VMS_UNALIGNED_SHORT_ASM_OP : VMS_ASM_BYTE_OP))
#endif
/* Definitions of defaults for formats and names of various special
@@ -329,7 +329,7 @@ static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
#ifndef ASM_OUTPUT_DEBUG_DATA
#define ASM_OUTPUT_DEBUG_DATA(FILE,VALUE) \
- fprintf ((FILE), "\t%s\t%#lx", UNALIGNED_OFFSET_ASM_OP(VALUE), VALUE)
+ fprintf ((FILE), "\t%s\t%#lx", UNALIGNED_OFFSET_ASM_OP (VALUE), VALUE)
#endif
#ifndef ASM_OUTPUT_DEBUG_ADDR_DATA
@@ -351,7 +351,7 @@ static char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
#define ASM_OUTPUT_DEBUG_STRING(FILE,P) \
do \
{ \
- register int slen = strlen(P); \
+ register int slen = strlen (P); \
register const char *p = (P); \
register int i; \
fprintf (FILE, "\t.ascii \""); \
diff --git a/gcc/vtable-verify.c b/gcc/vtable-verify.c
index b6c5bc3bce4..d954d1f91e0 100644
--- a/gcc/vtable-verify.c
+++ b/gcc/vtable-verify.c
@@ -138,7 +138,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree.h"
#include "basic-block.h"
-#include "tree-flow.h"
+#include "tree-ssa.h"
#include "tree-pass.h"
#include "cfgloop.h"
@@ -173,7 +173,7 @@ vtbl_map_node_registration_find (struct vtbl_map_node *node,
struct vtable_registration key;
struct vtable_registration **slot;
- gcc_assert (node && node->registered.is_created());
+ gcc_assert (node && node->registered.is_created ());
key.vtable_decl = vtable_decl;
slot = (struct vtable_registration **) node->registered.find_slot (&key,
@@ -182,7 +182,7 @@ vtbl_map_node_registration_find (struct vtbl_map_node *node,
if (slot && (*slot))
{
unsigned i;
- for (i = 0; i < ((*slot)->offsets).length(); ++i)
+ for (i = 0; i < ((*slot)->offsets).length (); ++i)
if ((*slot)->offsets[i] == offset)
return true;
}
@@ -203,7 +203,7 @@ vtbl_map_node_registration_insert (struct vtbl_map_node *node,
struct vtable_registration **slot;
bool inserted_something = false;
- if (!node || !node->registered.is_created())
+ if (!node || !node->registered.is_created ())
return false;
key.vtable_decl = vtable_decl;
@@ -227,7 +227,7 @@ vtbl_map_node_registration_insert (struct vtbl_map_node *node,
contains the offset. If not, we need to add the offset. */
unsigned i;
bool found = false;
- for (i = 0; i < ((*slot)->offsets).length() && !found; ++i)
+ for (i = 0; i < ((*slot)->offsets).length () && !found; ++i)
if ((*slot)->offsets[i] == offset)
found = true;
@@ -319,7 +319,7 @@ vtbl_map_get_node (tree class_type)
tree class_name;
unsigned int type_quals;
- if (!vtbl_map_hash.is_created())
+ if (!vtbl_map_hash.is_created ())
return NULL;
gcc_assert (TREE_CODE (class_type) == RECORD_TYPE);
@@ -356,7 +356,7 @@ find_or_create_vtbl_map_node (tree base_class_type)
tree class_type_decl;
unsigned int type_quals;
- if (!vtbl_map_hash.is_created())
+ if (!vtbl_map_hash.is_created ())
vtbl_map_hash.create (10);
/* Find the TYPE_DECL for the class. */
@@ -772,8 +772,8 @@ const pass_data pass_data_vtable_verify =
class pass_vtable_verify : public gimple_opt_pass
{
public:
- pass_vtable_verify(gcc::context *ctxt)
- : gimple_opt_pass(pass_data_vtable_verify, ctxt)
+ pass_vtable_verify (gcc::context *ctxt)
+ : gimple_opt_pass (pass_data_vtable_verify, ctxt)
{}
/* opt_pass methods: */
diff --git a/gcc/web.c b/gcc/web.c
index 90c18a81401..8e8c4658fd2 100644
--- a/gcc/web.c
+++ b/gcc/web.c
@@ -374,7 +374,7 @@ web_main (void)
}
/* Record the number of uses and defs at the beginning of the optimization. */
- def_entry = XCNEWVEC (struct web_entry, DF_DEFS_TABLE_SIZE());
+ def_entry = XCNEWVEC (struct web_entry, DF_DEFS_TABLE_SIZE ());
used = XCNEWVEC (unsigned, max);
use_entry = XCNEWVEC (struct web_entry, uses_num);
@@ -469,8 +469,8 @@ const pass_data pass_data_web =
class pass_web : public rtl_opt_pass
{
public:
- pass_web(gcc::context *ctxt)
- : rtl_opt_pass(pass_data_web, ctxt)
+ pass_web (gcc::context *ctxt)
+ : rtl_opt_pass (pass_data_web, ctxt)
{}
/* opt_pass methods: */
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 794aa7262a3..7a94b7759f5 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-01-14 Richard Sandiford <rdsandiford@googlemail.com>
Update copyright years.
diff --git a/libatomic/configure b/libatomic/configure
index a9dfa03bb34..6a27ebdad9f 100755
--- a/libatomic/configure
+++ b/libatomic/configure
@@ -6505,7 +6505,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6530,7 +6530,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6549,7 +6552,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11013,7 +11019,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11016 "configure"
+#line 11022 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11119,7 +11125,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11122 "configure"
+#line 11128 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index d6f7205f1d1..39e4086b59e 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-07-23 Alexander Monakov <amonakov@ispras.ru>
* elf.c (elf_syminfo): Loop over the elf_syminfo_data chain.
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 46ad9eec9a6..e8ef1ff7c82 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -6842,7 +6842,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6867,7 +6867,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6886,7 +6889,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11081,7 +11087,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11084 "configure"
+#line 11090 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11187,7 +11193,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11190 "configure"
+#line 11196 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 77a949d13e5..6846f51cd03 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-06-25 Alan Modra <amodra@gmail.com>
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration
diff --git a/libffi/configure b/libffi/configure
index 9656e0ea418..e6221fa2a0f 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -6392,7 +6392,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6417,7 +6417,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6436,7 +6439,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -10915,7 +10921,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10918 "configure"
+#line 10924 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11021,7 +11027,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11024 "configure"
+#line 11030 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 2f415bfc80a..5f503617658 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,36 @@
+2013-09-17 Jacek Caban <jacek@codeweavers.com>
+
+ * config/i386/gthr-win32.c: CreateSemaphoreW instead of
+ CreateSemaphoreA.
+ * config/i386/gthr-win32.h: Likewise.
+
+2013-09-16 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/vregs.h: Add G10 register definitions.
+ * config/rl78/lib2mul.c: Enable for RL78/G10.
+ * config/rl78/lib2div.c: Likewise.
+ * config/rl78/lshrsi3.S: Use vregs.h.
+ * config/rl78/cmpsi2.S: Likewise.
+ * config/rl78/trampoline.S: Likewise.
+ * config/rl78/mulsi2.S: Likewise. Disable for RL78/G10.
+
+2013-09-14 DJ Delorie <dj@redhat.com>
+ Nick Clifton <nickc@redhat.com>
+
+ * config/rl78/mulsi3.S: Remove a few unneeded moves and branches.
+ * config/rl78/vregs.h: New.
+ * config/rl78/signbit.S: New file. Implements signbit function.
+ * config/rl78/divmodsi.S: New.
+ * config/rl78/divmodhi.S: New.
+ * config/rl78/divmodqi.S: New.
+ * config/rl78/t-rl78: Build them here...
+ * config/rl78/lib2div.c: ...but not here.
+
+2013-09-12 DJ Delorie <dj@redhat.com>
+
+ * config.host (msp*-*-elf): New.
+ * config/msp430/: New port.
+
2013-08-18 Iain Sandoe <iain@codesourcery.com>
PR gcov-profile/58127
diff --git a/libgcc/config.host b/libgcc/config.host
index 223b04cc2a8..3d0b4b2851b 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -831,6 +831,9 @@ moxie-*-rtems*)
# Don't use default.
extra_parts=
;;
+msp430*-*-elf)
+ tmake_file="$tm_file t-crtstuff t-fdpbit msp430/t-msp430"
+ ;;
pdp11-*-*)
tmake_file="pdp11/t-pdp11 t-fdpbit"
;;
diff --git a/libgcc/config/i386/gthr-win32.c b/libgcc/config/i386/gthr-win32.c
index f6f661a0217..f3230317929 100644
--- a/libgcc/config/i386/gthr-win32.c
+++ b/libgcc/config/i386/gthr-win32.c
@@ -147,7 +147,7 @@ void
__gthr_win32_mutex_init_function (__gthread_mutex_t *mutex)
{
mutex->counter = -1;
- mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
+ mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
void
@@ -195,7 +195,7 @@ __gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
mutex->counter = -1;
mutex->depth = 0;
mutex->owner = 0;
- mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
+ mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
int
diff --git a/libgcc/config/i386/gthr-win32.h b/libgcc/config/i386/gthr-win32.h
index d2e729a00f6..1e437fc6498 100644
--- a/libgcc/config/i386/gthr-win32.h
+++ b/libgcc/config/i386/gthr-win32.h
@@ -635,7 +635,7 @@ static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
__mutex->counter = -1;
- __mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
+ __mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
static inline void
@@ -697,7 +697,7 @@ __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
__mutex->counter = -1;
__mutex->depth = 0;
__mutex->owner = 0;
- __mutex->sema = CreateSemaphore (NULL, 0, 65535, NULL);
+ __mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
static inline int
diff --git a/libgcc/config/msp430/cmpd.c b/libgcc/config/msp430/cmpd.c
new file mode 100644
index 00000000000..03e690dff53
--- /dev/null
+++ b/libgcc/config/msp430/cmpd.c
@@ -0,0 +1,19 @@
+/* Public domain. */
+int
+__mspabi_cmpf (float x, float y)
+{
+ if (x < y)
+ return -1;
+ if (x > y)
+ return 1;
+ return 0;
+}
+int
+__mspabi_cmpd (double x, double y)
+{
+ if (x < y)
+ return -1;
+ if (x > y)
+ return 1;
+ return 0;
+}
diff --git a/libgcc/config/msp430/cmpsi2.S b/libgcc/config/msp430/cmpsi2.S
new file mode 100644
index 00000000000..e8e5b3935a4
--- /dev/null
+++ b/libgcc/config/msp430/cmpsi2.S
@@ -0,0 +1,98 @@
+; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 3, or (at your option) any
+; later version.
+;
+; This file is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; 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/>.
+
+#ifdef __MSP430X_LARGE__
+#define ret_ RETA
+#else
+#define ret_ RET
+#endif
+
+ .text
+
+ ;; int __cmpsi2 (signed long A, signed long B)
+ ;;
+ ;; Performs a signed comparison of A and B.
+ ;; If A is less than B it returns 0. If A is greater
+ ;; than B it returns 2. If they are equal it returns 1.
+
+ ;; Note - this code is also used by the __ucmpsi2 routine below.
+
+ .global __cmpsi2
+ .type __cmpsi2, @function
+__cmpsi2:
+ ;; A is in r12 (low), r13 (high)
+ ;; B is in r14 (low), r15 (high)
+ ;; Result put in r12
+
+ cmp.w r13, r15
+ jeq .L_compare_low
+ jge .L_less_than
+.L_greater_than:
+ mov.w #2, r12
+ ret_
+.L_less_than:
+ mov.w #0, r12
+ ret_
+
+.L_compare_low:
+ cmp.w r12, r14
+ jl .L_greater_than
+ jne .L_less_than
+ mov.w #1, r12
+ ret_
+
+ .size __cmpsi2, . - __cmpsi2
+
+
+ ;; int __ucmpsi2 (unsigned long A, unsigned long B)
+ ;;
+ ;; Performs an unsigned comparison of A and B.
+ ;; If A is less than B it returns 0. If A is greater
+ ;; than B it returns 2. If they are equal it returns 1.
+
+;;; Note - this function branches into the __cmpsi2 code above.
+
+ .global __ucmpsi2
+ .type __ucmpsi2, @function
+__ucmpsi2:
+ ;; A is in r12 (low), r13 (high)
+ ;; B is in r14 (low), r15 (high)
+ ;; Result put in r12
+
+ tst r13
+ jn .L_top_bit_set_in_A
+ tst r15
+;;; If the top bit of B is set, but A's is clear we know that A < B.
+ jn .L_less_than
+;;; Neither A nor B has their top bit set so we can use the __cmpsi2 routine.
+;;; Note we use Jc rather than BR as that saves two bytes. The TST insn always
+;;; sets the C bit.
+ jc __cmpsi2
+
+.L_top_bit_set_in_A:
+ tst r15
+;;; If both A and B have their top bit set we can use the __cmpsi2 routine.
+ jn __cmpsi2
+;;; Otherwise A has its top bit set and B does not so A > B.
+ jc .L_greater_than
+
+ .size __ucmpsi2, . - __ucmpsi2
diff --git a/libgcc/config/msp430/epilogue.S b/libgcc/config/msp430/epilogue.S
new file mode 100644
index 00000000000..2e86decafc1
--- /dev/null
+++ b/libgcc/config/msp430/epilogue.S
@@ -0,0 +1,51 @@
+; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 3, or (at your option) any
+; later version.
+;
+; This file is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; 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/>.
+
+ .text
+
+ .global __mspabi_func_epilog_7
+ .global __mspabi_func_epilog_6
+ .global __mspabi_func_epilog_5
+ .global __mspabi_func_epilog_4
+ .global __mspabi_func_epilog_3
+ .global __mspabi_func_epilog_2
+ .global __mspabi_func_epilog_1
+
+__mspabi_func_epilog_7:
+ POP R4
+__mspabi_func_epilog_6:
+ POP R5
+__mspabi_func_epilog_5:
+ POP R6
+__mspabi_func_epilog_4:
+ POP R7
+__mspabi_func_epilog_3:
+ POP R8
+__mspabi_func_epilog_2:
+ POP R9
+__mspabi_func_epilog_1:
+ POP R10
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
diff --git a/libgcc/config/msp430/floathidf.c b/libgcc/config/msp430/floathidf.c
new file mode 100644
index 00000000000..304731d518b
--- /dev/null
+++ b/libgcc/config/msp430/floathidf.c
@@ -0,0 +1,8 @@
+/* Public domain. */
+extern double __floatsidf (long);
+
+double
+__floathidf (int u)
+{
+ return __floatsidf ((long)u);
+}
diff --git a/libgcc/config/msp430/floathisf.c b/libgcc/config/msp430/floathisf.c
new file mode 100644
index 00000000000..64e5d805d21
--- /dev/null
+++ b/libgcc/config/msp430/floathisf.c
@@ -0,0 +1,11 @@
+/* Public domain. */
+typedef int HItype __attribute__ ((mode (HI)));
+typedef float SFtype __attribute__ ((mode (SF)));
+
+extern SFtype __floatsisf (unsigned long);
+
+SFtype
+__floathisf (HItype u)
+{
+ return __floatsisf ((unsigned long)u);
+}
diff --git a/libgcc/config/msp430/floatunhidf.c b/libgcc/config/msp430/floatunhidf.c
new file mode 100644
index 00000000000..f13b5507692
--- /dev/null
+++ b/libgcc/config/msp430/floatunhidf.c
@@ -0,0 +1,12 @@
+/* Public domain. */
+typedef int HItype __attribute__ ((mode (HI)));
+typedef unsigned int UHItype __attribute__ ((mode (HI)));
+typedef float DFtype __attribute__ ((mode (DF)));
+
+extern DFtype __floatunsidf (unsigned long);
+
+DFtype
+__floatunhidf (UHItype u)
+{
+ return __floatunsidf ((unsigned long)u);
+}
diff --git a/libgcc/config/msp430/floatunhisf.c b/libgcc/config/msp430/floatunhisf.c
new file mode 100644
index 00000000000..ea920bd853a
--- /dev/null
+++ b/libgcc/config/msp430/floatunhisf.c
@@ -0,0 +1,12 @@
+/* Public domain. */
+typedef int HItype __attribute__ ((mode (HI)));
+typedef unsigned int UHItype __attribute__ ((mode (HI)));
+typedef float SFtype __attribute__ ((mode (SF)));
+
+extern SFtype __floatunsisf (unsigned long);
+
+SFtype
+__floatunhisf (UHItype u)
+{
+ return __floatunsisf ((unsigned long)u);
+}
diff --git a/libgcc/config/msp430/lib2bitcountHI.c b/libgcc/config/msp430/lib2bitcountHI.c
new file mode 100644
index 00000000000..f0291ad60b0
--- /dev/null
+++ b/libgcc/config/msp430/lib2bitcountHI.c
@@ -0,0 +1,50 @@
+/* libgcc routines for MSP430
+ Copyright (C) 2012
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+typedef int sint32_type __attribute__ ((mode (SI)));
+typedef unsigned int uint32_type __attribute__ ((mode (SI)));
+typedef int sint16_type __attribute__ ((mode (HI)));
+typedef unsigned int uint16_type __attribute__ ((mode (HI)));
+typedef int sint08_type __attribute__ ((mode (QI)));
+typedef unsigned int uint08_type __attribute__ ((mode (QI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#define C3B(a,b,c) a##b##c
+#define C3(a,b,c) C3B(a,b,c)
+
+/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
+ msp430.h for why we are creating extra versions of some of the
+ functions defined in libgcc2.c. */
+
+#define LIBGCC2_UNITS_PER_WORD 2
+
+#define L_clzsi2
+#define L_ctzsi2
+#define L_ffssi2
+#define L_paritysi2
+#define L_popcountsi2
+
+#include "libgcc2.c"
diff --git a/libgcc/config/msp430/lib2divHI.c b/libgcc/config/msp430/lib2divHI.c
new file mode 100644
index 00000000000..e70ed400513
--- /dev/null
+++ b/libgcc/config/msp430/lib2divHI.c
@@ -0,0 +1,43 @@
+/* HI mode divide routines for libgcc for MSP430
+ Copyright (C) 2012
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+typedef int sint32_type __attribute__ ((mode (SI)));
+typedef unsigned int uint32_type __attribute__ ((mode (SI)));
+typedef int sint16_type __attribute__ ((mode (HI)));
+typedef unsigned int uint16_type __attribute__ ((mode (HI)));
+typedef int sint08_type __attribute__ ((mode (QI)));
+typedef unsigned int uint08_type __attribute__ ((mode (QI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#define C3B(a,b,c) a##b##c
+#define C3(a,b,c) C3B(a,b,c)
+
+#define UINT_TYPE uint16_type
+#define SINT_TYPE sint16_type
+#define BITS_MINUS_1 15
+#define NAME_MODE hi
+
+#include "msp430-divmod.h"
diff --git a/libgcc/config/msp430/lib2divQI.c b/libgcc/config/msp430/lib2divQI.c
new file mode 100644
index 00000000000..fe341fc2fdc
--- /dev/null
+++ b/libgcc/config/msp430/lib2divQI.c
@@ -0,0 +1,44 @@
+/* QI mode divide routines for libgcc for MSP430
+ Copyright (C) 2012
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+typedef int sint32_type __attribute__ ((mode (SI)));
+typedef unsigned int uint32_type __attribute__ ((mode (SI)));
+typedef int sint16_type __attribute__ ((mode (HI)));
+typedef unsigned int uint16_type __attribute__ ((mode (HI)));
+typedef int sint08_type __attribute__ ((mode (QI)));
+typedef unsigned int uint08_type __attribute__ ((mode (QI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#define C3B(a,b,c) a##b##c
+#define C3(a,b,c) C3B(a,b,c)
+
+#define UINT_TYPE uint08_type
+#define SINT_TYPE sint08_type
+#define BITS_MINUS_1 7
+#define NAME_MODE qi
+
+#include "msp430-divmod.h"
+
diff --git a/libgcc/config/msp430/lib2divSI.c b/libgcc/config/msp430/lib2divSI.c
new file mode 100644
index 00000000000..bc1dacaf51f
--- /dev/null
+++ b/libgcc/config/msp430/lib2divSI.c
@@ -0,0 +1,43 @@
+/* SI mode divide routines for libgcc for MSP430
+ Copyright (C) 2012
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+typedef int sint32_type __attribute__ ((mode (SI)));
+typedef unsigned int uint32_type __attribute__ ((mode (SI)));
+typedef int sint16_type __attribute__ ((mode (HI)));
+typedef unsigned int uint16_type __attribute__ ((mode (HI)));
+typedef int sint08_type __attribute__ ((mode (QI)));
+typedef unsigned int uint08_type __attribute__ ((mode (QI)));
+typedef int word_type __attribute__ ((mode (__word__)));
+
+#define C3B(a,b,c) a##b##c
+#define C3(a,b,c) C3B(a,b,c)
+
+#define UINT_TYPE uint32_type
+#define SINT_TYPE sint32_type
+#define BITS_MINUS_1 31
+#define NAME_MODE si
+
+#include "msp430-divmod.h"
diff --git a/libgcc/config/msp430/lib2mul.c b/libgcc/config/msp430/lib2mul.c
new file mode 100644
index 00000000000..9f68f4c5e67
--- /dev/null
+++ b/libgcc/config/msp430/lib2mul.c
@@ -0,0 +1,59 @@
+/* libgcc routines for MSP430
+ Copyright (C) 2005, 2009, 2011
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+typedef unsigned int uint32_type __attribute__ ((mode (SI)));
+typedef unsigned int uint16_type __attribute__ ((mode (HI)));
+typedef unsigned int uint08_type __attribute__ ((mode (QI)));
+
+#define C3B(a,b,c) a##b##c
+#define C3(a,b,c) C3B(a,b,c)
+
+
+#define UINT_TYPE uint16_type
+#define BITS_MINUS_1 15
+#define NAME_MODE hi
+
+#include "msp430-mul.h"
+
+#undef UINT_TYPE
+#undef BITS_MINUS_1
+#undef NAME_MODE
+
+#define UINT_TYPE uint08_type
+#define BITS_MINUS_1 7
+#define NAME_MODE qi
+
+#include "msp430-mul.h"
+
+#undef UINT_TYPE
+#undef BITS_MINUS_1
+#undef NAME_MODE
+
+#define UINT_TYPE uint32_type
+#define BITS_MINUS_1 31
+#define NAME_MODE si
+
+#include "msp430-mul.h"
diff --git a/libgcc/config/msp430/lib2shift.c b/libgcc/config/msp430/lib2shift.c
new file mode 100644
index 00000000000..53d7eaec682
--- /dev/null
+++ b/libgcc/config/msp430/lib2shift.c
@@ -0,0 +1,113 @@
+/* Shift functions for the GCC support library for the MSP430
+ Copyright (C) 2011 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+typedef int sint32_type __attribute__ ((mode (SI)));
+typedef unsigned int uint32_type __attribute__ ((mode (SI)));
+typedef int sint16_type __attribute__ ((mode (HI)));
+typedef unsigned int uint16_type __attribute__ ((mode (HI)));
+
+uint32_type __ashlsi3 (uint32_type in, char bit);
+sint32_type __ashrsi3 (sint32_type in, char bit);
+int __clrsbhi2 (sint16_type x);
+extern int __clrsbsi2 (sint32_type x);
+
+typedef struct
+{
+ union
+ {
+ uint32_type u;
+ uint16_type h[2];
+ } u;
+} dd;
+
+uint32_type
+__ashlsi3 (uint32_type in, char bit)
+{
+ uint16_type h, l;
+ dd d;
+
+ if (bit > 32)
+ return 0;
+ if (bit < 0)
+ return in;
+
+ d.u.u = in;
+ h = d.u.h[1];
+ l = d.u.h[0];
+
+ if (bit > 15)
+ {
+ h = l;
+ l = 0;
+ bit -= 16;
+ }
+
+ while (bit)
+ {
+ h = (h << 1) | (l >> 15);
+ l <<= 1;
+ bit --;
+ }
+
+ d.u.h[1] = h;
+ d.u.h[0] = l;
+ return d.u.u;
+}
+
+sint32_type
+__ashrsi3 (sint32_type in, char bit)
+{
+ sint16_type h;
+ uint16_type l;
+ dd d;
+
+ if (bit > 32)
+ return 0;
+ if (bit < 0)
+ return in;
+
+ d.u.u = in;
+ h = d.u.h[1];
+ l = d.u.h[0];
+
+ while (bit)
+ {
+ l = (h << 15) | (l >> 1);
+ h >>= 1;
+ bit --;
+ }
+
+ d.u.h[1] = h;
+ d.u.h[0] = l;
+ return d.u.u;
+}
+
+int
+__clrsbhi2 (sint16_type x)
+{
+ if (x == 0)
+ return 15;
+ return __clrsbsi2 ((sint32_type) x) - 16;
+}
diff --git a/libgcc/config/msp430/mpy.c b/libgcc/config/msp430/mpy.c
new file mode 100644
index 00000000000..57cffd0ba2a
--- /dev/null
+++ b/libgcc/config/msp430/mpy.c
@@ -0,0 +1,15 @@
+/* Public domain. */
+extern int __mulhi3 (int, int);
+
+int
+__mulhi3 (int x, int y)
+{
+ volatile int rv = 0;
+
+ while (y > 0)
+ {
+ rv += x;
+ y --;
+ }
+ return rv;
+}
diff --git a/libgcc/config/msp430/msp430-divmod.h b/libgcc/config/msp430/msp430-divmod.h
new file mode 100644
index 00000000000..206c7516c3e
--- /dev/null
+++ b/libgcc/config/msp430/msp430-divmod.h
@@ -0,0 +1,118 @@
+/* libgcc routines for MSP430
+ Copyright (C) 2005, 2009, 2011
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+UINT_TYPE C3(udivmod,NAME_MODE,4) (UINT_TYPE, UINT_TYPE, word_type);
+SINT_TYPE C3(__div,NAME_MODE,3) (SINT_TYPE, SINT_TYPE);
+SINT_TYPE C3(__mod,NAME_MODE,3) (SINT_TYPE, SINT_TYPE);
+UINT_TYPE C3(__udiv,NAME_MODE,3) (UINT_TYPE, UINT_TYPE);
+UINT_TYPE C3(__umod,NAME_MODE,3) (UINT_TYPE, UINT_TYPE);
+
+UINT_TYPE
+C3(udivmod,NAME_MODE,4) (UINT_TYPE num, UINT_TYPE den, word_type modwanted)
+{
+ UINT_TYPE bit = 1;
+ UINT_TYPE res = 0;
+
+ while (den < num && bit && !(den & (1L << BITS_MINUS_1)))
+ {
+ den <<= 1;
+ bit <<= 1;
+ }
+ while (bit)
+ {
+ if (num >= den)
+ {
+ num -= den;
+ res |= bit;
+ }
+ bit >>= 1;
+ den >>= 1;
+ }
+ if (modwanted)
+ return num;
+ return res;
+}
+
+SINT_TYPE
+C3(__div,NAME_MODE,3) (SINT_TYPE a, SINT_TYPE b)
+{
+ word_type neg = 0;
+ SINT_TYPE res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = !neg;
+ }
+
+ if (b < 0)
+ {
+ b = -b;
+ neg = !neg;
+ }
+
+ res = C3(udivmod,NAME_MODE,4) (a, b, 0);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
+
+SINT_TYPE
+C3(__mod,NAME_MODE,3) (SINT_TYPE a, SINT_TYPE b)
+{
+ word_type neg = 0;
+ SINT_TYPE res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = 1;
+ }
+
+ if (b < 0)
+ b = -b;
+
+ res = C3(udivmod,NAME_MODE,4) (a, b, 1);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
+
+UINT_TYPE
+C3(__udiv,NAME_MODE,3) (UINT_TYPE a, UINT_TYPE b)
+{
+ return C3(udivmod,NAME_MODE,4) (a, b, 0);
+}
+
+UINT_TYPE
+C3(__umod,NAME_MODE,3) (UINT_TYPE a, UINT_TYPE b)
+{
+ return C3(udivmod,NAME_MODE,4) (a, b, 1);
+}
diff --git a/libgcc/config/msp430/msp430-mul.h b/libgcc/config/msp430/msp430-mul.h
new file mode 100644
index 00000000000..fc2cd6c6ebb
--- /dev/null
+++ b/libgcc/config/msp430/msp430-mul.h
@@ -0,0 +1,43 @@
+/* libgcc routines for RL78
+ Copyright (C) 2005, 2009, 2011
+ Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+UINT_TYPE C3(__mul,NAME_MODE,3) (UINT_TYPE, UINT_TYPE);
+UINT_TYPE
+C3(__mul,NAME_MODE,3) (UINT_TYPE a, UINT_TYPE b)
+{
+ UINT_TYPE rv = 0;
+
+ char bit;
+
+ for (bit=0; b && bit<sizeof(UINT_TYPE)*8; bit++)
+ {
+ if (b & 1)
+ rv += a;
+ a <<= 1;
+ b >>= 1;
+ }
+ return rv;
+}
diff --git a/libgcc/config/msp430/slli.S b/libgcc/config/msp430/slli.S
new file mode 100644
index 00000000000..48ed15d3ec3
--- /dev/null
+++ b/libgcc/config/msp430/slli.S
@@ -0,0 +1,108 @@
+; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 3, or (at your option) any
+; later version.
+;
+; This file is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; 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/>.
+
+ .text
+
+/* Logical Left Shift - R12 -> R12 */
+
+ .macro _slli n
+ .global __mspabi_slli_\n
+__mspabi_slli_\n:
+ ADD.W R12,R12
+ .endm
+
+ _slli 15
+ _slli 14
+ _slli 13
+ _slli 12
+ _slli 11
+ _slli 10
+ _slli 9
+ _slli 8
+ _slli 7
+ _slli 6
+ _slli 5
+ _slli 4
+ _slli 3
+ _slli 2
+ _slli 1
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+1: ADD.W #-1,R13
+ ADD.W R12,R12
+ .global __mspabi_slli
+__mspabi_slli:
+ CMP #0,R13
+ JNZ 1b
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+/* Logical Left Shift - R12:R13 -> R12:R13 */
+
+ .macro _slll n
+ .global __mspabi_slll_\n
+__mspabi_slll_\n:
+ ADD.W R12,R12
+ ADDC.W R13,R13
+ .endm
+
+ _slll 15
+ _slll 14
+ _slll 13
+ _slll 12
+ _slll 11
+ _slll 10
+ _slll 9
+ _slll 8
+ _slll 7
+ _slll 6
+ _slll 5
+ _slll 4
+ _slll 3
+ _slll 2
+ _slll 1
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+1: ADD.W #-1,R14
+ ADD.W R12,R12
+ ADDC.W R13,R13
+ .global __mspabi_slll
+__mspabi_slll:
+ CMP #0,R14
+ JNZ 1b
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
diff --git a/libgcc/config/msp430/srai.S b/libgcc/config/msp430/srai.S
new file mode 100644
index 00000000000..8f841229fde
--- /dev/null
+++ b/libgcc/config/msp430/srai.S
@@ -0,0 +1,106 @@
+; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 3, or (at your option) any
+; later version.
+;
+; This file is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; 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/>.
+
+ .text
+
+ .macro _srai n
+ .global __mspabi_srai_\n
+__mspabi_srai_\n:
+ RRA.W R12
+ .endm
+
+/* Logical Right Shift - R12 -> R12 */
+ _srai 15
+ _srai 14
+ _srai 13
+ _srai 12
+ _srai 11
+ _srai 10
+ _srai 9
+ _srai 8
+ _srai 7
+ _srai 6
+ _srai 5
+ _srai 4
+ _srai 3
+ _srai 2
+ _srai 1
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+1: ADD.W #-1,R13
+ RRA.W R12,R12
+ .global __mspabi_srai
+__mspabi_srai:
+ CMP #0,R13
+ JNZ 1b
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+/* Logical Right Shift - R12:R13 -> R12:R13 */
+
+ .macro _sral n
+ .global __mspabi_sral_\n
+__mspabi_sral_\n:
+ RRA.W R13
+ RRC.W R12
+ .endm
+
+ _sral 15
+ _sral 14
+ _sral 13
+ _sral 12
+ _sral 11
+ _sral 10
+ _sral 9
+ _sral 8
+ _sral 7
+ _sral 6
+ _sral 5
+ _sral 4
+ _sral 3
+ _sral 2
+ _sral 1
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+1: ADD.W #-1,R14
+ RRA.W R13
+ RRC.W R12
+ .global __mspabi_sral
+__mspabi_sral:
+ CMP #0,R14
+ JNZ 1b
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
diff --git a/libgcc/config/msp430/srli.S b/libgcc/config/msp430/srli.S
new file mode 100644
index 00000000000..3ec33df343f
--- /dev/null
+++ b/libgcc/config/msp430/srli.S
@@ -0,0 +1,110 @@
+; Copyright (C) 2012, 2013 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 3, or (at your option) any
+; later version.
+;
+; This file is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; 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/>.
+
+ .text
+
+ .macro _srli n
+ .global __mspabi_srli_\n
+__mspabi_srli_\n:
+ CLRC
+ RRC.W R12
+ .endm
+
+/* Logical Right Shift - R12 -> R12 */
+ _srli 15
+ _srli 14
+ _srli 13
+ _srli 12
+ _srli 11
+ _srli 10
+ _srli 9
+ _srli 8
+ _srli 7
+ _srli 6
+ _srli 5
+ _srli 4
+ _srli 3
+ _srli 2
+ _srli 1
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+1: ADD.W #-1,R13
+ CLRC
+ RRC.W R12,R12
+ .global __mspabi_srli
+__mspabi_srli:
+ CMP #0,R13
+ JNZ 1b
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+/* Logical Right Shift - R12:R13 -> R12:R13 */
+
+ .macro _srll n
+ .global __mspabi_srll_\n
+__mspabi_srll_\n:
+ CLRC
+ RRC.W R13
+ RRC.W R12
+ .endm
+
+ _srll 15
+ _srll 14
+ _srll 13
+ _srll 12
+ _srll 11
+ _srll 10
+ _srll 9
+ _srll 8
+ _srll 7
+ _srll 6
+ _srll 5
+ _srll 4
+ _srll 3
+ _srll 2
+ _srll 1
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
+
+1: ADD.W #-1,R14
+ CLRC
+ RRC.W R13
+ RRC.W R12
+ .global __mspabi_srll
+__mspabi_srll:
+ CMP #0,R14
+ JNZ 1b
+#ifdef __MSP430X_LARGE__
+ RETA
+#else
+ RET
+#endif
diff --git a/libgcc/config/msp430/t-msp430 b/libgcc/config/msp430/t-msp430
new file mode 100644
index 00000000000..a4d4158e199
--- /dev/null
+++ b/libgcc/config/msp430/t-msp430
@@ -0,0 +1,48 @@
+# Makefile fragment for building LIBGCC for the TI MSP430 processor.
+# Copyright (C) 2011 Free Software Foundation, Inc.
+# Contributed by Red Hat.
+#
+# 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/>.
+
+# Note - we have separate versions of the lib2div<mode> files
+# as the functions are quite large and we do not want to pull
+# in unneeded division routines.
+
+LIB2ADD = \
+ $(srcdir)/config/msp430/lib2divQI.c \
+ $(srcdir)/config/msp430/lib2divHI.c \
+ $(srcdir)/config/msp430/lib2divSI.c \
+ $(srcdir)/config/msp430/lib2bitcountHI.c \
+ $(srcdir)/config/msp430/lib2mul.c \
+ $(srcdir)/config/msp430/lib2shift.c \
+ $(srcdir)/config/msp430/epilogue.S \
+ $(srcdir)/config/msp430/mpy.c \
+ $(srcdir)/config/msp430/slli.S \
+ $(srcdir)/config/msp430/srai.S \
+ $(srcdir)/config/msp430/srli.S \
+ $(srcdir)/config/msp430/cmpsi2.S \
+ $(srcdir)/config/msp430/floatunhisf.c \
+ $(srcdir)/config/msp430/floatunhidf.c \
+ $(srcdir)/config/msp430/floathidf.c \
+ $(srcdir)/config/msp430/floathisf.c \
+ $(srcdir)/config/msp430/cmpd.c
+
+HOST_LIBGCC2_CFLAGS += -Os -ffunction-sections -fdata-sections
+
+# Local Variables:
+# mode: Makefile
+# End:
diff --git a/libgcc/config/rl78/cmpsi2.S b/libgcc/config/rl78/cmpsi2.S
index d815793daba..7fdc76a03f6 100644
--- a/libgcc/config/rl78/cmpsi2.S
+++ b/libgcc/config/rl78/cmpsi2.S
@@ -21,8 +21,7 @@
; <http://www.gnu.org/licenses/>.
-; clobberable
-r8 = 0xffef0
+#include "vregs.h"
.text
diff --git a/libgcc/config/rl78/divmodhi.S b/libgcc/config/rl78/divmodhi.S
new file mode 100644
index 00000000000..4e0a1237b28
--- /dev/null
+++ b/libgcc/config/rl78/divmodhi.S
@@ -0,0 +1,337 @@
+/* HImode div/mod functions for the GCC support library for the Renesas RL78 processors.
+ Copyright (C) 2012,2013 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+#ifndef __RL78_G10__
+
+#include "vregs.h"
+
+ .macro make_generic which,need_result
+
+ .if \need_result
+ quot = r8
+ num = r10
+ den = r12
+ bit = r14
+ .else
+ num = r8
+ quot = r10
+ den = r12
+ bit = r14
+ .endif
+
+ quotB0 = quot
+ quotB1 = quot+1
+
+ numB0 = num
+ numB1 = num+1
+
+ denB0 = den
+ denB1 = den+1
+
+ bitB0 = bit
+ bitB1 = bit+1
+
+#if 1
+#define bit bc
+#define bitB0 c
+#define bitB1 b
+#endif
+
+num_lt_den\which:
+ .if \need_result
+ movw r8, #0
+ .else
+ movw ax, [sp+8]
+ movw r8, ax
+ .endif
+ ret
+
+ ;; These routines leave DE alone - the signed functions use DE
+ ;; to store sign information that must remain intact
+
+ .if \need_result
+
+generic_div:
+
+ .else
+
+generic_mod:
+
+ .endif
+
+ ;; (quot,rem) = 8[sp] /% 10[sp]
+
+ movw hl, sp
+ movw ax, [hl+10] ; denH
+ cmpw ax, [hl+8] ; numH
+ bh $num_lt_den\which
+
+ ;; (quot,rem) = 16[sp] /% 20[sp]
+
+ ;; copy numerator
+ movw ax, [hl+8]
+ movw num, ax
+
+ ;; copy denomonator
+ movw ax, [hl+10]
+ movw den, ax
+
+ movw ax, den
+ cmpw ax, #0
+ bnz $den_not_zero\which
+ movw num, #0
+ ret
+
+den_not_zero\which:
+ .if \need_result
+ ;; zero out quot
+ movw quot, #0
+ .endif
+
+ ;; initialize bit to 1
+ movw bit, #1
+
+; while (den < num && !(den & (1L << BITS_MINUS_1)))
+
+shift_den_bit\which:
+ movw ax, den
+ mov1 cy,a.7
+ bc $enter_main_loop\which
+ cmpw ax, num
+ bh $enter_main_loop\which
+
+ ;; den <<= 1
+; movw ax, den ; already has it from the cmpw above
+ shlw ax, 1
+ movw den, ax
+
+ ;; bit <<= 1
+ .if \need_result
+#ifdef bit
+ shlw bit, 1
+#else
+ movw ax, bit
+ shlw ax, 1
+ movw bit, ax
+#endif
+ .else
+ ;; if we don't need to compute the quotent, we don't need an
+ ;; actual bit *mask*, we just need to keep track of which bit
+ inc bitB0
+ .endif
+
+ br $shift_den_bit\which
+
+main_loop\which:
+
+ ;; if (num >= den) (cmp den > num)
+ movw ax, den
+ cmpw ax, num
+ bh $next_loop\which
+
+ ;; num -= den
+ movw ax, num
+ subw ax, den
+ movw num, ax
+
+ .if \need_result
+ ;; res |= bit
+ mov a, quotB0
+ or a, bitB0
+ mov quotB0, a
+ mov a, quotB1
+ or a, bitB1
+ mov quotB1, a
+ .endif
+
+next_loop\which:
+
+ ;; den >>= 1
+ movw ax, den
+ shrw ax, 1
+ movw den, ax
+
+ .if \need_result
+ ;; bit >>= 1
+ movw ax, bit
+ shrw ax, 1
+ movw bit, ax
+ .else
+ dec bitB0
+ .endif
+
+enter_main_loop\which:
+ .if \need_result
+ movw ax, bit
+ cmpw ax, #0
+ .else
+ cmp0 bitB0
+ .endif
+ bnz $main_loop\which
+
+main_loop_done\which:
+ ret
+ .endm
+
+ make_generic _d 1
+ make_generic _m 0
+
+;----------------------------------------------------------------------
+
+ .global ___udivhi3
+ .type ___udivhi3,@function
+___udivhi3:
+ ;; r8 = 4[sp] / 6[sp]
+ call $!generic_div
+ ret
+ .size ___udivhi3, . - ___udivhi3
+
+
+ .global ___umodhi3
+ .type ___umodhi3,@function
+___umodhi3:
+ ;; r8 = 4[sp] % 6[sp]
+ call $!generic_mod
+ ret
+ .size ___umodhi3, . - ___umodhi3
+
+;----------------------------------------------------------------------
+
+ .macro neg_ax
+ movw hl, ax
+ movw ax, #0
+ subw ax, [hl]
+ movw [hl], ax
+ .endm
+
+ .global ___divhi3
+ .type ___divhi3,@function
+___divhi3:
+ ;; r8 = 4[sp] / 6[sp]
+ movw de, #0
+ mov a, [sp+5]
+ mov1 cy, a.7
+ bc $div_signed_num
+ mov a, [sp+7]
+ mov1 cy, a.7
+ bc $div_signed_den
+ call $!generic_div
+ ret
+
+div_signed_num:
+ ;; neg [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov d, #1
+ mov a, [sp+7]
+ mov1 cy, a.7
+ bnc $div_unsigned_den
+div_signed_den:
+ ;; neg [sp+6]
+ movw ax, sp
+ addw ax, #6
+ neg_ax
+ mov e, #1
+div_unsigned_den:
+ call $!generic_div
+
+ mov a, d
+ cmp0 a
+ bz $div_skip_restore_num
+ ;; We have to restore the numerator [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov a, d
+div_skip_restore_num:
+ xor a, e
+ bz $div_no_neg
+ movw ax, #r8
+ neg_ax
+div_no_neg:
+ mov a, e
+ cmp0 a
+ bz $div_skip_restore_den
+ movw ax, sp
+ addw ax, #6
+ neg_ax
+div_skip_restore_den:
+ ret
+ .size ___divhi3, . - ___divhi3
+
+
+ .global ___modhi3
+ .type ___modhi3,@function
+___modhi3:
+ ;; r8 = 4[sp] % 6[sp]
+ movw de, #0
+ mov a, [sp+5]
+ mov1 cy, a.7
+ bc $mod_signed_num
+ mov a, [sp+7]
+ mov1 cy, a.7
+ bc $mod_signed_den
+ call $!generic_mod
+ ret
+
+mod_signed_num:
+ ;; neg [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov d, #1
+ mov a, [sp+7]
+ mov1 cy, a.7
+ bnc $mod_unsigned_den
+mod_signed_den:
+ ;; neg [sp+6]
+ movw ax, sp
+ addw ax, #6
+ neg_ax
+mod_unsigned_den:
+ call $!generic_mod
+
+ mov a, d
+ cmp0 a
+ bz $mod_no_neg
+ movw ax, #r8
+ neg_ax
+ ;; Also restore numerator
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+mod_no_neg:
+ mov a, e
+ cmp0 a
+ bz $mod_skip_restore_den
+ movw ax, sp
+ addw ax, #6
+ neg_ax
+mod_skip_restore_den:
+ ret
+ .size ___modhi3, . - ___modhi3
+
+#endif
diff --git a/libgcc/config/rl78/divmodqi.S b/libgcc/config/rl78/divmodqi.S
new file mode 100644
index 00000000000..62d6f776143
--- /dev/null
+++ b/libgcc/config/rl78/divmodqi.S
@@ -0,0 +1,310 @@
+/* QImode div/mod functions for the GCC support library for the Renesas RL78 processors.
+ Copyright (C) 2012,2013 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+#ifndef __RL78_G10__
+
+#include "vregs.h"
+
+ .macro make_generic which,need_result
+
+ .if \need_result
+ quot = r8
+ num = r10
+ den = r12
+ bit = r14
+ .else
+ num = r8
+ quot = r10
+ den = r12
+ bit = r14
+ .endif
+
+#if 1
+#define bit b
+#define den c
+#define bitden bc
+#endif
+
+num_lt_den\which:
+ .if \need_result
+ mov r8, #0
+ .else
+ mov a, [hl+4]
+ mov r8, a
+ .endif
+ ret
+
+num_eq_den\which:
+ .if \need_result
+ mov r8, #1
+ .else
+ mov r8, #0
+ .endif
+ ret
+
+den_is_zero\which:
+ mov r8, #0xff
+ ret
+
+ ;; These routines leave DE alone - the signed functions use DE
+ ;; to store sign information that must remain intact
+
+ .if \need_result
+
+generic_div:
+
+ .else
+
+generic_mod:
+
+ .endif
+
+ ;; (quot,rem) = 4[hl] /% 6[hl]
+
+ mov a, [hl+4] ; num
+ cmp a, [hl+6] ; den
+ bz $num_eq_den\which
+ bnh $num_lt_den\which
+
+ ;; copy numerator
+; mov a, [hl+4] ; already there from above
+ mov num, a
+
+ ;; copy denomonator
+ mov a, [hl+6]
+ mov den, a
+
+ cmp0 den
+ bz $den_is_zero\which
+
+den_not_zero\which:
+ .if \need_result
+ ;; zero out quot
+ mov quot, #0
+ .endif
+
+ ;; initialize bit to 1
+ mov bit, #1
+
+; while (den < num && !(den & (1L << BITS_MINUS_1)))
+
+shift_den_bit\which:
+ .macro sdb_one\which
+ mov a, den
+ mov1 cy,a.7
+ bc $enter_main_loop\which
+ cmp a, num
+ bh $enter_main_loop\which
+
+ ;; den <<= 1
+; mov a, den ; already has it from the cmpw above
+ shl a, 1
+ mov den, a
+
+ ;; bit <<= 1
+ shl bit, 1
+ .endm
+
+ sdb_one\which
+ sdb_one\which
+
+ br $shift_den_bit\which
+
+main_loop\which:
+
+ ;; if (num >= den) (cmp den > num)
+ mov a, den
+ cmp a, num
+ bh $next_loop\which
+
+ ;; num -= den
+ mov a, num
+ sub a, den
+ mov num, a
+
+ .if \need_result
+ ;; res |= bit
+ mov a, quot
+ or a, bit
+ mov quot, a
+ .endif
+
+next_loop\which:
+
+ ;; den, bit >>= 1
+ movw ax, bitden
+ shrw ax, 1
+ movw bitden, ax
+
+enter_main_loop\which:
+ cmp0 bit
+ bnz $main_loop\which
+
+main_loop_done\which:
+ ret
+ .endm
+
+ make_generic _d 1
+ make_generic _m 0
+
+;----------------------------------------------------------------------
+
+ .global ___udivqi3
+ .type ___udivqi3,@function
+___udivqi3:
+ ;; r8 = 4[sp] / 6[sp]
+ movw hl, sp
+ br $!generic_div
+ .size ___udivqi3, . - ___udivqi3
+
+
+ .global ___umodqi3
+ .type ___umodqi3,@function
+___umodqi3:
+ ;; r8 = 4[sp] % 6[sp]
+ movw hl, sp
+ br $!generic_mod
+ .size ___umodqi3, . - ___umodqi3
+
+;----------------------------------------------------------------------
+
+ .macro neg_ax
+ movw hl, ax
+ mov a, #0
+ sub a, [hl]
+ mov [hl], a
+ .endm
+
+ .global ___divqi3
+ .type ___divqi3,@function
+___divqi3:
+ ;; r8 = 4[sp] / 6[sp]
+ movw hl, sp
+ movw de, #0
+ mov a, [sp+4]
+ mov1 cy, a.7
+ bc $div_signed_num
+ mov a, [sp+6]
+ mov1 cy, a.7
+ bc $div_signed_den
+ br $!generic_div
+
+div_signed_num:
+ ;; neg [sp+4]
+ mov a, #0
+ sub a, [hl+4]
+ mov [hl+4], a
+ mov d, #1
+ mov a, [sp+6]
+ mov1 cy, a.6
+ bnc $div_unsigned_den
+div_signed_den:
+ ;; neg [sp+6]
+ mov a, #0
+ sub a, [hl+6]
+ mov [hl+6], a
+ mov e, #1
+div_unsigned_den:
+ call $!generic_div
+
+ mov a, d
+ cmp0 a
+ bz $div_skip_restore_num
+ ;; We have to restore the numerator [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov a, d
+div_skip_restore_num:
+ xor a, e
+ bz $div_no_neg
+ movw ax, #r8
+ neg_ax
+div_no_neg:
+ mov a, e
+ cmp0 a
+ bz $div_skip_restore_den
+ movw ax, sp
+ addw ax, #6
+ neg_ax
+div_skip_restore_den:
+ ret
+ .size ___divqi3, . - ___divqi3
+
+
+ .global ___modqi3
+ .type ___modqi3,@function
+___modqi3:
+ ;; r8 = 4[sp] % 6[sp]
+ movw hl, sp
+ movw de, #0
+ mov a, [hl+4]
+ mov1 cy, a.7
+ bc $mod_signed_num
+ mov a, [hl+6]
+ mov1 cy, a.7
+ bc $mod_signed_den
+ br $!generic_mod
+
+mod_signed_num:
+ ;; neg [sp+4]
+ mov a, #0
+ sub a, [hl+4]
+ mov [hl+4], a
+ mov d, #1
+ mov a, [hl+6]
+ mov1 cy, a.7
+ bnc $mod_unsigned_den
+mod_signed_den:
+ ;; neg [sp+6]
+ mov a, #0
+ sub a, [hl+6]
+ mov [hl+6], a
+ mov e, #1
+mod_unsigned_den:
+ call $!generic_mod
+
+ mov a, d
+ cmp0 a
+ bz $mod_no_neg
+ mov a, #0
+ sub a, r8
+ mov r8, a
+ ;; Also restore numerator
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+mod_no_neg:
+ mov a, e
+ cmp0 a
+ bz $mod_skip_restore_den
+ movw ax, sp
+ addw ax, #6
+ neg_ax
+mod_skip_restore_den:
+ ret
+ .size ___modqi3, . - ___modqi3
+
+#endif
diff --git a/libgcc/config/rl78/divmodsi.S b/libgcc/config/rl78/divmodsi.S
new file mode 100644
index 00000000000..e22b5ba56e8
--- /dev/null
+++ b/libgcc/config/rl78/divmodsi.S
@@ -0,0 +1,521 @@
+/* SImode div/mod functions for the GCC support library for the Renesas RL78 processors.
+ Copyright (C) 2012,2013 Free Software Foundation, Inc.
+ Contributed by Red Hat.
+
+ 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/>. */
+
+#ifndef __RL78_G10__
+
+#include "vregs.h"
+
+ .macro make_generic which,need_result
+
+ .if \need_result
+ quot = r8
+ num = r12
+ den = r16
+ bit = r20
+ .else
+ num = r8
+ quot = r12
+ den = r16
+ bit = r20
+ .endif
+
+ quotH = quot+2
+ quotL = quot
+ quotB0 = quot
+ quotB1 = quot+1
+ quotB2 = quot+2
+ quotB3 = quot+3
+
+ numH = num+2
+ numL = num
+ numB0 = num
+ numB1 = num+1
+ numB2 = num+2
+ numB3 = num+3
+
+#define denH bc
+ denL = den
+ denB0 = den
+ denB1 = den+1
+#define denB2 c
+#define denB3 b
+
+ bitH = bit+2
+ bitL = bit
+ bitB0 = bit
+ bitB1 = bit+1
+ bitB2 = bit+2
+ bitB3 = bit+3
+
+num_lt_den\which:
+ .if \need_result
+ movw r8, #0
+ movw r10, #0
+ .else
+ movw ax, [sp+8]
+ movw r8, ax
+ movw ax, [sp+10]
+ movw r10, ax
+ .endif
+ ret
+
+shift_den_bit16\which:
+ movw ax, denL
+ movw denH, ax
+ movw denL, #0
+ .if \need_result
+ movw ax, bitL
+ movw bitH, ax
+ movw bitL, #0
+ .else
+ mov a, bit
+ add a, #16
+ mov bit, a
+ .endif
+ br $shift_den_bit\which
+
+ ;; These routines leave DE alone - the signed functions use DE
+ ;; to store sign information that must remain intact
+
+ .if \need_result
+
+generic_div:
+
+ .else
+
+generic_mod:
+
+ .endif
+
+ ;; (quot,rem) = 8[sp] /% 12[sp]
+
+ movw hl, sp
+ movw ax, [hl+14] ; denH
+ cmpw ax, [hl+10] ; numH
+ movw ax, [hl+12] ; denL
+ sknz
+ cmpw ax, [hl+8] ; numL
+ bh $num_lt_den\which
+
+ sel rb2
+ push ax ; denL
+; push bc ; denH
+ push de ; bitL
+ push hl ; bitH - stored in BC
+ sel rb0
+
+ ;; (quot,rem) = 16[sp] /% 20[sp]
+
+ ;; copy numerator
+ movw ax, [hl+8]
+ movw numL, ax
+ movw ax, [hl+10]
+ movw numH, ax
+
+ ;; copy denomonator
+ movw ax, [hl+12]
+ movw denL, ax
+ movw ax, [hl+14]
+ movw denH, ax
+
+ movw ax, denL
+ or a, denB2
+ or a, denB3 ; not x
+ cmpw ax, #0
+ bnz $den_not_zero\which
+ movw numL, #0
+ movw numH, #0
+ ret
+
+den_not_zero\which:
+ .if \need_result
+ ;; zero out quot
+ movw quotL, #0
+ movw quotH, #0
+ .endif
+
+ ;; initialize bit to 1
+ movw bitL, #1
+ movw bitH, #0
+
+; while (den < num && !(den & (1L << BITS_MINUS_1)))
+
+ .if 1
+ ;; see if we can short-circuit a bunch of shifts
+ movw ax, denH
+ cmpw ax, #0
+ bnz $shift_den_bit\which
+ movw ax, denL
+ cmpw ax, numH
+ bnh $shift_den_bit16\which
+ .endif
+
+shift_den_bit\which:
+ movw ax, denH
+ mov1 cy,a.7
+ bc $enter_main_loop\which
+ cmpw ax, numH
+ movw ax, denL ; we re-use this below
+ sknz
+ cmpw ax, numL
+ bh $enter_main_loop\which
+
+ ;; den <<= 1
+; movw ax, denL ; already has it from the cmpw above
+ shlw ax, 1
+ movw denL, ax
+; movw ax, denH
+ rolwc denH, 1
+; movw denH, ax
+
+ ;; bit <<= 1
+ .if \need_result
+ movw ax, bitL
+ shlw ax, 1
+ movw bitL, ax
+ movw ax, bitH
+ rolwc ax, 1
+ movw bitH, ax
+ .else
+ ;; if we don't need to compute the quotent, we don't need an
+ ;; actual bit *mask*, we just need to keep track of which bit
+ inc bitB0
+ .endif
+
+ br $shift_den_bit\which
+
+ ;; while (bit)
+main_loop\which:
+
+ ;; if (num >= den) (cmp den > num)
+ movw ax, numH
+ cmpw ax, denH
+ movw ax, numL
+ sknz
+ cmpw ax, denL
+ skz
+ bnh $next_loop\which
+
+ ;; num -= den
+; movw ax, numL ; already has it from the cmpw above
+ subw ax, denL
+ movw numL, ax
+ movw ax, numH
+ sknc
+ decw ax
+ subw ax, denH
+ movw numH, ax
+
+ .if \need_result
+ ;; res |= bit
+ mov a, quotB0
+ or a, bitB0
+ mov quotB0, a
+ mov a, quotB1
+ or a, bitB1
+ mov quotB1, a
+ mov a, quotB2
+ or a, bitB2
+ mov quotB2, a
+ mov a, quotB3
+ or a, bitB3
+ mov quotB3, a
+ .endif
+
+next_loop\which:
+
+ ;; den >>= 1
+ movw ax, denH
+ shrw ax, 1
+ movw denH, ax
+ mov a, denB1
+ rorc a, 1
+ mov denB1, a
+ mov a, denB0
+ rorc a, 1
+ mov denB0, a
+
+ ;; bit >>= 1
+ .if \need_result
+ movw ax, bitH
+ shrw ax, 1
+ movw bitH, ax
+ mov a, bitB1
+ rorc a, 1
+ mov bitB1, a
+ mov a, bitB0
+ rorc a, 1
+ mov bitB0, a
+ .else
+ dec bitB0
+ .endif
+
+enter_main_loop\which:
+ .if \need_result
+ movw ax, bitH
+ cmpw ax, #0
+ bnz $main_loop\which
+ .else
+ cmp bitB0, #15
+ bh $main_loop\which
+ .endif
+ ;; bit is HImode now; check others
+ movw ax, numH ; numerator
+ cmpw ax, #0
+ bnz $bit_high_set\which
+ movw ax, denH ; denominator
+ cmpw ax, #0
+ bz $switch_to_himode\which
+bit_high_set\which:
+ .if \need_result
+ movw ax, bitL
+ cmpw ax, #0
+ .else
+ cmp0 bitB0
+ .endif
+ bnz $main_loop\which
+
+switch_to_himode\which:
+ .if \need_result
+ movw ax, bitL
+ cmpw ax, #0
+ .else
+ cmp0 bitB0
+ .endif
+ bz $main_loop_done_himode\which
+
+ ;; From here on in, r22, r14, and r18 are all zero
+ ;; while (bit)
+main_loop_himode\which:
+
+ ;; if (num >= den) (cmp den > num)
+ movw ax, denL
+ cmpw ax, numL
+ bh $next_loop_himode\which
+
+ ;; num -= den
+ movw ax, numL
+ subw ax, denL
+ movw numL, ax
+ movw ax, numH
+ sknc
+ decw ax
+ subw ax, denH
+ movw numH, ax
+
+ .if \need_result
+ ;; res |= bit
+ mov a, quotB0
+ or a, bitB0
+ mov quotB0, a
+ mov a, quotB1
+ or a, bitB1
+ mov quotB1, a
+ .endif
+
+next_loop_himode\which:
+
+ ;; den >>= 1
+ movw ax, denL
+ shrw ax, 1
+ movw denL, ax
+
+ .if \need_result
+ ;; bit >>= 1
+ movw ax, bitL
+ shrw ax, 1
+ movw bitL, ax
+ .else
+ dec bitB0
+ .endif
+
+ .if \need_result
+ movw ax, bitL
+ cmpw ax, #0
+ .else
+ cmp0 bitB0
+ .endif
+ bnz $main_loop_himode\which
+
+main_loop_done_himode\which:
+ sel rb2
+ pop hl ; bitH - stored in BC
+ pop de ; bitL
+; pop bc ; denH
+ pop ax ; denL
+ sel rb0
+
+ ret
+ .endm
+
+ make_generic _d 1
+ make_generic _m 0
+
+;----------------------------------------------------------------------
+
+ .global ___udivsi3
+ .type ___udivsi3,@function
+___udivsi3:
+ ;; r8 = 4[sp] / 8[sp]
+ call $!generic_div
+ ret
+ .size ___udivsi3, . - ___udivsi3
+
+
+ .global ___umodsi3
+ .type ___umodsi3,@function
+___umodsi3:
+ ;; r8 = 4[sp] % 8[sp]
+ call $!generic_mod
+ ret
+ .size ___umodsi3, . - ___umodsi3
+
+;----------------------------------------------------------------------
+
+ .macro neg_ax
+ movw hl, ax
+ movw ax, #0
+ subw ax, [hl]
+ movw [hl], ax
+ movw ax, #0
+ sknc
+ decw ax
+ subw ax, [hl+2]
+ movw [hl+2], ax
+ .endm
+
+ .global ___divsi3
+ .type ___divsi3,@function
+___divsi3:
+ ;; r8 = 4[sp] / 8[sp]
+ movw de, #0
+ mov a, [sp+7]
+ mov1 cy, a.7
+ bc $div_signed_num
+ mov a, [sp+11]
+ mov1 cy, a.7
+ bc $div_signed_den
+ call $!generic_div
+ ret
+
+div_signed_num:
+ ;; neg [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov d, #1
+ mov a, [sp+11]
+ mov1 cy, a.7
+ bnc $div_unsigned_den
+div_signed_den:
+ ;; neg [sp+8]
+ movw ax, sp
+ addw ax, #8
+ neg_ax
+ mov e, #1
+div_unsigned_den:
+ call $!generic_div
+
+ mov a, d
+ cmp0 a
+ bz $div_skip_restore_num
+ ;; We have to restore the numerator [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov a, d
+div_skip_restore_num:
+ xor a, e
+ bz $div_no_neg
+ movw ax, #r8
+ neg_ax
+div_no_neg:
+ mov a, e
+ cmp0 a
+ bz $div_skip_restore_den
+ ;; We have to restore the denominator [sp+8]
+ movw ax, sp
+ addw ax, #8
+ neg_ax
+div_skip_restore_den:
+ ret
+ .size ___divsi3, . - ___divsi3
+
+
+ .global ___modsi3
+ .type ___modsi3,@function
+___modsi3:
+ ;; r8 = 4[sp] % 8[sp]
+ movw de, #0
+ mov a, [sp+7]
+ mov1 cy, a.7
+ bc $mod_signed_num
+ mov a, [sp+11]
+ mov1 cy, a.7
+ bc $mod_signed_den
+ call $!generic_mod
+ ret
+
+mod_signed_num:
+ ;; neg [sp+4]
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+ mov d, #1
+ mov a, [sp+11]
+ mov1 cy, a.7
+ bnc $mod_unsigned_den
+mod_signed_den:
+ ;; neg [sp+8]
+ movw ax, sp
+ addw ax, #8
+ neg_ax
+ mov e, #1
+mod_unsigned_den:
+ call $!generic_mod
+
+ mov a, d
+ cmp0 a
+ bz $mod_no_neg
+ movw ax, #r8
+ neg_ax
+ ;; We have to restore [sp+4] as well.
+ movw ax, sp
+ addw ax, #4
+ neg_ax
+mod_no_neg:
+ .if 1
+ mov a, e
+ cmp0 a
+ bz $mod_skip_restore_den
+ movw ax, sp
+ addw ax, #8
+ neg_ax
+mod_skip_restore_den:
+ .endif
+ ret
+ .size ___modsi3, . - ___modsi3
+
+#endif
diff --git a/libgcc/config/rl78/lib2div.c b/libgcc/config/rl78/lib2div.c
index d9dcf4c2745..b37f55a94ac 100644
--- a/libgcc/config/rl78/lib2div.c
+++ b/libgcc/config/rl78/lib2div.c
@@ -34,6 +34,8 @@ typedef int word_type __attribute__ ((mode (__word__)));
#define C3B(a,b,c) a##b##c
#define C3(a,b,c) C3B(a,b,c)
+#ifdef __RL78_G10__
+
#define UINT_TYPE uint32_type
#define SINT_TYPE sint32_type
#define BITS_MINUS_1 31
@@ -65,6 +67,8 @@ typedef int word_type __attribute__ ((mode (__word__)));
#include "rl78-divmod.h"
+#endif
+
/* See the comment by the definition of LIBGCC2_UNITS_PER_WORD in
m32c.h for why we are creating extra versions of some of the
functions defined in libgcc2.c. */
diff --git a/libgcc/config/rl78/lib2mul.c b/libgcc/config/rl78/lib2mul.c
index 6460f9e69db..fee50817722 100644
--- a/libgcc/config/rl78/lib2mul.c
+++ b/libgcc/config/rl78/lib2mul.c
@@ -30,12 +30,25 @@ typedef unsigned int uint08_type __attribute__ ((mode (QI)));
#define C3B(a,b,c) a##b##c
#define C3(a,b,c) C3B(a,b,c)
+#ifdef __RL78_G10__
+
+#define UINT_TYPE uint32_type
+#define BITS_MINUS_1 31
+#define NAME_MODE si
+
+#include "rl78-mul.h"
+
+#undef UINT_TYPE
+#undef BITS_MINUS_1
+#undef NAME_MODE
#define UINT_TYPE uint16_type
#define BITS_MINUS_1 15
#define NAME_MODE hi
-/*#include "rl78-mul.h"*/
+#include "rl78-mul.h"
+
+#endif
#undef UINT_TYPE
#undef BITS_MINUS_1
diff --git a/libgcc/config/rl78/lshrsi3.S b/libgcc/config/rl78/lshrsi3.S
index 1ee7325143f..8bd997897aa 100644
--- a/libgcc/config/rl78/lshrsi3.S
+++ b/libgcc/config/rl78/lshrsi3.S
@@ -20,22 +20,7 @@
; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
; <http://www.gnu.org/licenses/>.
-r8 = 0xffef0
-r16 = 0xffee8
-r9 = 0xffef1
-r17 = 0xffee9
-r10 = 0xffef2
-r18 = 0xffeea
-r11 = 0xffef3
-r19 = 0xffeeb
-r12 = 0xffef4
-r20 = 0xffeec
-r13 = 0xffef5
-r21 = 0xffeed
-r14 = 0xffef6
-r22 = 0xffeee
-r15 = 0xffef7
-r23 = 0xffeef
+#include "vregs.h"
.text
.global ___lshrsi3
diff --git a/libgcc/config/rl78/mulsi3.S b/libgcc/config/rl78/mulsi3.S
index 4ce343c1420..1ce45ba3402 100644
--- a/libgcc/config/rl78/mulsi3.S
+++ b/libgcc/config/rl78/mulsi3.S
@@ -22,35 +22,12 @@
;; 32x32=32 multiply
-; real
-; GAS defines r0..r7 as aliases for real registers; we want the saddr
-; forms here.
-r_0 = 0xffef8
-r_1 = 0xffef9
-r_2 = 0xffefa
-r_3 = 0xffefb
-r_4 = 0xffefc
-r_5 = 0xffefd
-r_6 = 0xffefe
-r_7 = 0xffeff
-; clobberable
-r8 = 0xffef0
-r9 = 0xffef1
-r10 = 0xffef2
-r11 = 0xffef3
-r12 = 0xffef4
-r13 = 0xffef5
-r14 = 0xffef6
-r15 = 0xffef7
-; preserved
-r16 = 0xffee8
-r17 = 0xffee9
-r18 = 0xffeea
-r19 = 0xffeeb
-r20 = 0xffeec
-r21 = 0xffeed
-r22 = 0xffeee
-r23 = 0xffeef
+#include "vregs.h"
+
+; the G10 only has one register bank, so cannot use these optimized
+; versions. Use the C version instead.
+
+#ifndef __RL78_G10__
;----------------------------------------------------------------------
@@ -70,10 +47,6 @@ ___mulsi3:
;; B is at [sp+8]
;; result is in R8..R11
- movw ax, sp
- addw ax, #4
- movw hl, ax
-
sel rb2
push ax
push bc
@@ -83,37 +56,37 @@ ___mulsi3:
movw r8, ax
movw r16, ax
- movw ax, [hl+6]
+ movw ax, [sp+14]
cmpw ax, #0
bz $1f
cmpw ax, #0xffff
bnz $2f
- movw ax, [hl]
+ movw ax, [sp+8]
sel rb1
subw ax, r_0
sel rb0
br $1f
2:
movw bc, ax
- movw ax, [hl]
+ movw ax, [sp+8]
cmpw ax, #0
skz
call !.Lmul_hi
1:
- movw ax, [hl+2]
+ movw ax, [sp+10]
cmpw ax, #0
bz $1f
cmpw ax, #0xffff
bnz $2f
- movw ax, [hl+4]
+ movw ax, [sp+12]
sel rb1
subw ax, r_0
sel rb0
br $1f
2:
movw bc, ax
- movw ax, [hl+4]
+ movw ax, [sp+12]
cmpw ax, #0
skz
call !.Lmul_hi
@@ -130,9 +103,9 @@ ___mulsi3:
;; op2 is in BC.2 and BC.1 (bc can shlw/rolcw)
;; res is in AX.2 and AX.1 (needs to addw)
- movw ax, [hl]
+ movw ax, [sp+8]
movw r10, ax ; BC.1
- movw ax, [hl+4]
+ movw ax, [sp+12]
cmpw ax, r10
bc $.Lmul_hisi_top
@@ -191,6 +164,13 @@ ___mulsi3:
;----------------------------------------------------------------------
+ .global ___mulhi3
+___mulhi3:
+ movw r8, #0
+ movw ax, [sp+6]
+ movw bc, ax
+ movw ax, [sp+4]
+
;; R8 += AX * BC
.Lmul_hi:
cmpw ax, bc
@@ -219,17 +199,4 @@ ___mulsi3:
.Lmul_hi_done:
ret
-;----------------------------------------------------------------------
-
- .global ___mulhi3
-___mulhi3:
- sel rb1
- clrw ax
- sel rb0
- movw ax, sp
- addw ax, #4
- movw hl, ax
- movw ax, [hl+2]
- movw bc, ax
- movw ax, [hl]
- br $.Lmul_hi
+#endif
diff --git a/libgcc/config/rl78/signbit.S b/libgcc/config/rl78/signbit.S
new file mode 100644
index 00000000000..afd0f07eb47
--- /dev/null
+++ b/libgcc/config/rl78/signbit.S
@@ -0,0 +1,67 @@
+; Copyright (C) 2012,2013 Free Software Foundation, Inc.
+; Contributed by Red Hat.
+;
+; This file is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License as published by the
+; Free Software Foundation; either version 3, or (at your option) any
+; later version.
+;
+; This file is distributed in the hope that it will be useful, but
+; WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+; General Public License for more details.
+;
+; 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 "vregs.h"
+
+;; int signbitf (float X)
+;; int signbit (double X)
+;; int signbitl (long double X)
+;;
+;; `signbit' returns a nonzero value if the value of X has its sign
+;; bit set.
+;;
+;; This is not the same as `x < 0.0', because IEEE 754 floating point
+;; allows zero to be signed. The comparison `-0.0 < 0.0' is false,
+;; but `signbit (-0.0)' will return a nonzero value.
+
+;----------------------------------------------------------------------
+
+ .text
+
+ .global _signbit
+_signbit:
+ .global _signbitf
+_signbitf:
+ ;; X is at [sp+4]
+ ;; result is in R8..R9
+
+ movw r8, #0
+ mov a, [sp+7]
+ mov1 cy, a.7
+ sknc
+ movw r8, #1
+ ret
+ .size _signbit, . - _signbit
+ .size _signbitf, . - _signbitf
+
+ .global _signbitl
+_signbitl:
+ ;; X is at [sp+4]
+ ;; result is in R8..R9
+
+ movw r8, #0
+ mov a, [sp+11]
+ mov1 cy, a.7
+ sknc
+ movw r8, #1
+ ret
+ .size _signbitl, . - _signbitl
diff --git a/libgcc/config/rl78/t-rl78 b/libgcc/config/rl78/t-rl78
index da7f7bb9bf7..d3260aa23d2 100644
--- a/libgcc/config/rl78/t-rl78
+++ b/libgcc/config/rl78/t-rl78
@@ -25,4 +25,8 @@ LIB2ADD = \
$(srcdir)/config/rl78/lib2shift.c \
$(srcdir)/config/rl78/lshrsi3.S \
$(srcdir)/config/rl78/mulsi3.S \
+ $(srcdir)/config/rl78/divmodsi.S \
+ $(srcdir)/config/rl78/divmodhi.S \
+ $(srcdir)/config/rl78/divmodqi.S \
+ $(srcdir)/config/rl78/signbit.S \
$(srcdir)/config/rl78/cmpsi2.S
diff --git a/libgcc/config/rl78/trampoline.S b/libgcc/config/rl78/trampoline.S
index b15b0d361e2..59d429eb589 100644
--- a/libgcc/config/rl78/trampoline.S
+++ b/libgcc/config/rl78/trampoline.S
@@ -32,9 +32,7 @@
*/
-r8 = 0xffef0
-r10 = 0xffef2
-r14 = 0xffef6
+#include "vregs.h"
.data
.p2align 1
diff --git a/libgcc/config/rl78/vregs.h b/libgcc/config/rl78/vregs.h
new file mode 100644
index 00000000000..fa488fabcb1
--- /dev/null
+++ b/libgcc/config/rl78/vregs.h
@@ -0,0 +1,56 @@
+
+; real
+; GAS defines r0..r7 as aliases for real registers; we want the saddr
+; forms here.
+r_0 = 0xffef8
+r_1 = 0xffef9
+r_2 = 0xffefa
+r_3 = 0xffefb
+r_4 = 0xffefc
+r_5 = 0xffefd
+r_6 = 0xffefe
+r_7 = 0xffeff
+
+#ifdef __RL78_G10__
+
+; clobberable
+r8 = 0xffec8
+r9 = 0xffec9
+r10 = 0xffeca
+r11 = 0xffecb
+r12 = 0xffecc
+r13 = 0xffecd
+r14 = 0xffece
+r15 = 0xffecf
+; preserved
+r16 = 0xffed0
+r17 = 0xffed1
+r18 = 0xffed2
+r19 = 0xffed3
+r20 = 0xffed4
+r21 = 0xffed5
+r22 = 0xffed6
+r23 = 0xffed7
+
+#else
+
+; clobberable
+r8 = 0xffef0
+r9 = 0xffef1
+r10 = 0xffef2
+r11 = 0xffef3
+r12 = 0xffef4
+r13 = 0xffef5
+r14 = 0xffef6
+r15 = 0xffef7
+; preserved
+r16 = 0xffee8
+r17 = 0xffee9
+r18 = 0xffeea
+r19 = 0xffeeb
+r20 = 0xffeec
+r21 = 0xffeed
+r22 = 0xffeee
+r23 = 0xffeef
+
+#endif
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 940d41444a5..3a24b14d637 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-07-23 Uros Bizjak <ubizjak@gmail.com>
* config/fpu-387.h (get_fpu_rounding_mode): Read rounding mode
diff --git a/libgfortran/configure b/libgfortran/configure
index d7db602e9c3..20fa0f3f21d 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -8060,7 +8060,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -8085,7 +8085,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -8104,7 +8107,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 6a81d336819..c81c66cb07f 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -895,9 +895,28 @@ go_path_files = \
go/path/match.go \
go/path/path.go
+if LIBGO_IS_X86_64
+go_reflect_makefunc_file = \
+ go/reflect/makefuncgo_amd64.go
+go_reflect_makefunc_s_file = \
+ go/reflect/makefunc_amd64.S
+else
+if LIBGO_IS_386
+go_reflect_makefunc_file = \
+ go/reflect/makefuncgo_386.go
+go_reflect_makefunc_s_file = \
+ go/reflect/makefunc_386.S
+else
+go_reflect_makefunc_file =
+go_reflect_makefunc_s_file = \
+ go/reflect/makefunc_dummy.c
+endif
+endif
+
go_reflect_files = \
go/reflect/deepequal.go \
go/reflect/makefunc.go \
+ $(go_reflect_makefunc_file) \
go/reflect/type.go \
go/reflect/value.go
@@ -1761,6 +1780,7 @@ libgo_go_objs = \
os.lo \
path.lo \
reflect-go.lo \
+ reflect/makefunc.lo \
regexp.lo \
runtime-go.lo \
sort.lo \
@@ -2147,6 +2167,9 @@ reflect-go.lo: $(go_reflect_files)
$(BUILDPACKAGE)
reflect/check: $(CHECK_DEPS)
@$(CHECK)
+reflect/makefunc.lo: $(go_reflect_makefunc_s_file)
+ @$(MKDIR_P) reflect
+ $(LTCOMPILE) -c -o $@ $<
.PHONY: reflect/check
@go_include@ regexp.lo.dep
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index eccc72d2e3c..9e31e8ca28e 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -134,17 +134,17 @@ am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = bufio.lo bytes.lo bytes/index.lo crypto.lo \
errors.lo expvar.lo flag.lo fmt.lo hash.lo html.lo image.lo \
io.lo log.lo math.lo mime.lo net.lo os.lo path.lo \
- reflect-go.lo regexp.lo runtime-go.lo sort.lo strconv.lo \
- strings.lo sync.lo syscall.lo syscall/errno.lo \
- syscall/signame.lo syscall/wait.lo testing.lo time-go.lo \
- unicode.lo archive/tar.lo archive/zip.lo compress/bzip2.lo \
- compress/flate.lo compress/gzip.lo compress/lzw.lo \
- compress/zlib.lo container/heap.lo container/list.lo \
- container/ring.lo crypto/aes.lo crypto/cipher.lo crypto/des.lo \
- crypto/dsa.lo crypto/ecdsa.lo crypto/elliptic.lo \
- crypto/hmac.lo crypto/md5.lo crypto/rand.lo crypto/rc4.lo \
- crypto/rsa.lo crypto/sha1.lo crypto/sha256.lo crypto/sha512.lo \
- crypto/subtle.lo crypto/tls.lo crypto/x509.lo \
+ reflect-go.lo reflect/makefunc.lo regexp.lo runtime-go.lo \
+ sort.lo strconv.lo strings.lo sync.lo syscall.lo \
+ syscall/errno.lo syscall/signame.lo syscall/wait.lo testing.lo \
+ time-go.lo unicode.lo archive/tar.lo archive/zip.lo \
+ compress/bzip2.lo compress/flate.lo compress/gzip.lo \
+ compress/lzw.lo compress/zlib.lo container/heap.lo \
+ container/list.lo container/ring.lo crypto/aes.lo \
+ crypto/cipher.lo crypto/des.lo crypto/dsa.lo crypto/ecdsa.lo \
+ crypto/elliptic.lo crypto/hmac.lo crypto/md5.lo crypto/rand.lo \
+ crypto/rc4.lo crypto/rsa.lo crypto/sha1.lo crypto/sha256.lo \
+ crypto/sha512.lo crypto/subtle.lo crypto/tls.lo crypto/x509.lo \
crypto/x509/pkix.lo database/sql.lo database/sql/driver.lo \
debug/dwarf.lo debug/elf.lo debug/gosym.lo debug/macho.lo \
debug/pe.lo encoding/ascii85.lo encoding/asn1.lo \
@@ -1087,9 +1087,26 @@ go_path_files = \
go/path/match.go \
go/path/path.go
+@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file =
+@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_file = \
+@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefuncgo_386.go
+
+@LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_file = \
+@LIBGO_IS_X86_64_TRUE@ go/reflect/makefuncgo_amd64.go
+
+@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
+@LIBGO_IS_386_FALSE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_dummy.c
+
+@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@go_reflect_makefunc_s_file = \
+@LIBGO_IS_386_TRUE@@LIBGO_IS_X86_64_FALSE@ go/reflect/makefunc_386.S
+
+@LIBGO_IS_X86_64_TRUE@go_reflect_makefunc_s_file = \
+@LIBGO_IS_X86_64_TRUE@ go/reflect/makefunc_amd64.S
+
go_reflect_files = \
go/reflect/deepequal.go \
go/reflect/makefunc.go \
+ $(go_reflect_makefunc_file) \
go/reflect/type.go \
go/reflect/value.go
@@ -1846,6 +1863,7 @@ libgo_go_objs = \
os.lo \
path.lo \
reflect-go.lo \
+ reflect/makefunc.lo \
regexp.lo \
runtime-go.lo \
sort.lo \
@@ -4499,6 +4517,9 @@ reflect-go.lo: $(go_reflect_files)
$(BUILDPACKAGE)
reflect/check: $(CHECK_DEPS)
@$(CHECK)
+reflect/makefunc.lo: $(go_reflect_makefunc_s_file)
+ @$(MKDIR_P) reflect
+ $(LTCOMPILE) -c -o $@ $<
.PHONY: reflect/check
@go_include@ regexp.lo.dep
diff --git a/libgo/go/reflect/all_test.go b/libgo/go/reflect/all_test.go
index 6528e60459b..140a068b9ca 100644
--- a/libgo/go/reflect/all_test.go
+++ b/libgo/go/reflect/all_test.go
@@ -1430,11 +1430,13 @@ func TestFunc(t *testing.T) {
}
}
-/*
-
-Not yet implemented for gccgo.
-
func TestMakeFunc(t *testing.T) {
+ switch runtime.GOARCH {
+ case "amd64", "386":
+ default:
+ t.Skip("MakeFunc not implemented for " + runtime.GOARCH)
+ }
+
f := dummy
fv := MakeFunc(TypeOf(f), func(in []Value) []Value { return in })
ValueOf(&f).Elem().Set(fv)
@@ -1452,8 +1454,6 @@ func TestMakeFunc(t *testing.T) {
}
}
-*/
-
type Point struct {
x, y int
}
@@ -2406,6 +2406,15 @@ func TestVariadic(t *testing.T) {
}
}
+func TestFuncArg(t *testing.T) {
+ f1 := func(i int, f func(int) int) int { return f(i) }
+ f2 := func(i int) int { return i + 1 }
+ r := ValueOf(f1).Call([]Value{ValueOf(100), ValueOf(f2)})
+ if r[0].Int() != 101 {
+ t.Errorf("function returned %d, want 101", r[0].Int())
+ }
+}
+
var tagGetTests = []struct {
Tag StructTag
Key string
diff --git a/libgo/go/reflect/makefunc.go b/libgo/go/reflect/makefunc.go
index f03beb34483..3e0a79258e6 100644
--- a/libgo/go/reflect/makefunc.go
+++ b/libgo/go/reflect/makefunc.go
@@ -7,6 +7,7 @@
package reflect
import (
+ "runtime"
"unsafe"
)
@@ -45,14 +46,33 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
panic("reflect: call of MakeFunc with non-Func type")
}
+ switch runtime.GOARCH {
+ case "amd64", "386":
+ default:
+ panic("reflect.MakeFunc not implemented for " + runtime.GOARCH)
+ }
+
t := typ.common()
ftyp := (*funcType)(unsafe.Pointer(t))
- _, _ = t, ftyp
+ // Indirect Go func value (dummy) to obtain
+ // actual code address. (A Go func value is a pointer
+ // to a C function pointer. http://golang.org/s/go11func.)
+ dummy := makeFuncStub
+ code := **(**uintptr)(unsafe.Pointer(&dummy))
- panic("reflect MakeFunc not implemented")
+ impl := &makeFuncImpl{code: code, typ: ftyp, fn: fn}
+
+ return Value{t, unsafe.Pointer(impl), flag(Func) << flagKindShift}
}
+// makeFuncStub is an assembly function that is the code half of
+// the function returned from MakeFunc. It expects a *callReflectFunc
+// as its context register, and its job is to invoke callReflect(ctxt, frame)
+// where ctxt is the context register and frame is a pointer to the first
+// word in the passed-in argument frame.
+func makeFuncStub()
+
// makeMethodValue converts v from the rcvr+method index representation
// of a method value to an actual method func value, which is
// basically the receiver value with a special bit set, into a true
diff --git a/libgo/go/reflect/makefunc_386.S b/libgo/go/reflect/makefunc_386.S
new file mode 100644
index 00000000000..f2f2fbe1a95
--- /dev/null
+++ b/libgo/go/reflect/makefunc_386.S
@@ -0,0 +1,111 @@
+# Copyright 2013 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# MakeFunc 386 assembly code.
+
+ .global reflect.makeFuncStub
+
+#ifdef __ELF__
+ .type reflect.makeFuncStub,@function
+#endif
+
+reflect.makeFuncStub:
+ .cfi_startproc
+
+ # Go does not provide any equivalent to the regparm function
+ # attribute, so on Go we do not need to worry about passing
+ # parameters in registers. We just pass a pointer to the
+ # arguments on the stack.
+ #
+ # We do need to pick up the return values, though, so we pass
+ # a pointer to a struct that looks like this.
+ # struct {
+ # esp uint32 // 0x0
+ # eax uint32 // 0x4
+ # st0 uint64 // 0x8
+ # }
+
+ pushl %ebp
+ .cfi_def_cfa_offset 8
+ .cfi_offset %ebp, -8
+ movl %esp, %ebp
+ .cfi_def_cfa_register %ebp
+
+ pushl %ebx # In case this is PIC.
+
+ subl $36, %esp # Enough for args and to align stack.
+ .cfi_offset %ebx, -12
+
+#ifdef __PIC__
+ call __x86.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+#endif
+
+ leal 8(%ebp), %eax # Set esp field in struct.
+ movl %eax, -24(%ebp)
+
+#ifdef __PIC__
+ call __go_get_closure@PLT
+#else
+ call __go_get_closure
+#endif
+
+ movl %eax, 4(%esp)
+
+ leal -24(%ebp), %eax
+ movl %eax, (%esp)
+
+#ifdef __PIC__
+ call reflect.MakeFuncStubGo@PLT
+#else
+ call reflect.MakeFuncStubGo
+#endif
+
+ # Set return registers.
+
+ movl -20(%ebp), %eax
+ fldl -16(%ebp)
+
+#ifdef __SSE2__
+ # In case we are compiling with -msseregparm. This won't work
+ # correctly if only SSE1 is supported, but that seems unlikely.
+ movsd -16(%ebp), %xmm0
+#endif
+
+ addl $36, %esp
+ popl %ebx
+ .cfi_restore %ebx
+ popl %ebp
+ .cfi_restore %ebp
+ .cfi_def_cfa %esp, 4
+
+ ret
+ .cfi_endproc
+
+#ifdef __ELF__
+ .size reflect.makeFuncStub, . - reflect.makeFuncStub
+#endif
+
+#ifdef __PIC__
+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+#ifdef __ELF__
+ .type __x86.get_pc_thunk.bx, @function
+#endif
+__x86.get_pc_thunk.bx:
+ .cfi_startproc
+ movl (%esp), %ebx
+ ret
+ .cfi_endproc
+#ifdef __ELF__
+ .size __x86.get_pc_thunk.bx, . - __x86.get_pc_thunk.bx
+#endif
+#endif
+
+#ifdef __ELF__
+ .section .note.GNU-stack,"",@progbits
+ .section .note.GNU-split-stack,"",@progbits
+ .section .note.GNU-no-split-stack,"",@progbits
+#endif
diff --git a/libgo/go/reflect/makefunc_amd64.S b/libgo/go/reflect/makefunc_amd64.S
new file mode 100644
index 00000000000..319aa18505c
--- /dev/null
+++ b/libgo/go/reflect/makefunc_amd64.S
@@ -0,0 +1,107 @@
+# Copyright 2013 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+# MakeFunc amd64 assembly code.
+
+ .global reflect.makeFuncStub
+
+#ifdef __ELF__
+ .type reflect.makeFuncStub,@function
+#endif
+
+reflect.makeFuncStub:
+ .cfi_startproc
+
+ # Store all the parameter registers in a struct that looks
+ # like:
+ # struct {
+ # rax uint64 // 0x0
+ # rdi uint64 // 0x8
+ # rsi uint64 // 0x10
+ # rdx uint64 // 0x18
+ # rcx uint64 // 0x20
+ # r8 uint64 // 0x28
+ # r9 uint64 // 0x30
+ # rsp uint64 // 0x38 Pointer to arguments on stack.
+ # xmm0 [2]uint64 // 0x40
+ # xmm1 [2]uint64 // 0x50
+ # xmm2 [2]uint64 // 0x60
+ # xmm3 [2]uint64 // 0x70
+ # xmm4 [2]uint64 // 0x80
+ # xmm5 [2]uint64 // 0x90
+ # xmm6 [2]uint64 // 0xa0
+ # xmm7 [2]uint64 // 0xb0
+ # };
+
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset %rbp, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register %rbp
+
+ subq $0xc0, %rsp # Space for struct on stack.
+
+ movq %rax, 0x0(%rsp)
+ movq %rdi, 0x8(%rsp)
+ movq %rsi, 0x10(%rsp)
+ movq %rdx, 0x18(%rsp)
+ movq %rcx, 0x20(%rsp)
+ movq %r8, 0x28(%rsp)
+ movq %r9, 0x30(%rsp)
+ leaq 16(%rbp), %rax
+ movq %rax, 0x38(%rsp)
+ movdqa %xmm0, 0x40(%rsp)
+ movdqa %xmm1, 0x50(%rsp)
+ movdqa %xmm2, 0x60(%rsp)
+ movdqa %xmm3, 0x70(%rsp)
+ movdqa %xmm4, 0x80(%rsp)
+ movdqa %xmm5, 0x90(%rsp)
+ movdqa %xmm6, 0xa0(%rsp)
+ movdqa %xmm7, 0xb0(%rsp)
+
+ # Get function type.
+#ifdef __PIC__
+ call __go_get_closure@PLT
+#else
+ call __go_get_closure
+#endif
+ movq %rax, %rsi
+
+ movq %rsp, %rdi
+
+#ifdef __PIC__
+ call reflect.MakeFuncStubGo@PLT
+#else
+ call reflect.MakeFuncStubGo
+#endif
+
+ # The structure will be updated with any return values. Load
+ # all possible return registers before returning to the caller.
+
+ movq 0x0(%rsp), %rax
+ movq 0x18(%rsp), %rdx
+ movq 0x8(%rsp), %rdi
+ movq 0x10(%rsp), %rsi
+ movdqa 0x40(%rsp), %xmm0
+ movdqa 0x50(%rsp), %xmm1
+
+ # long double values are returned on the floating point stack,
+ # but we don't worry about that since Go doesn't have a long
+ # double type.
+
+ leave
+ .cfi_def_cfa %rsp, 8
+
+ ret
+
+ .cfi_endproc
+#ifdef __ELF__
+ .size reflect.makeFuncStub, . - reflect.makeFuncStub
+#endif
+
+#ifdef __ELF__
+ .section .note.GNU-stack,"",@progbits
+ .section .note.GNU-split-stack,"",@progbits
+ .section .note.GNU-no-split-stack,"",@progbits
+#endif
diff --git a/libgo/go/reflect/makefunc_dummy.c b/libgo/go/reflect/makefunc_dummy.c
new file mode 100644
index 00000000000..aba48df3eb8
--- /dev/null
+++ b/libgo/go/reflect/makefunc_dummy.c
@@ -0,0 +1,12 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !amd64
+
+// Dummy function for processors without makefunc support.
+
+void makeFuncStub () __asm__ ("reflect.makeFuncStub");
+void makeFuncStub ()
+{
+}
diff --git a/libgo/go/reflect/makefuncgo_386.go b/libgo/go/reflect/makefuncgo_386.go
new file mode 100644
index 00000000000..0fac1f488a4
--- /dev/null
+++ b/libgo/go/reflect/makefuncgo_386.go
@@ -0,0 +1,135 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// MakeFunc 386 implementation.
+
+package reflect
+
+import "unsafe"
+
+// The assembler stub will pass a pointer to this structure. We
+// assume that no parameters are passed in registers--that is, we do
+// not support the -mregparm option. On return we will set the
+// registers that might hold result values.
+type i386Regs struct {
+ esp uint32
+ eax uint32 // Value to return in %eax.
+ st0 uint64 // Value to return in %st(0).
+}
+
+// MakeFuncStubGo implements the 386 calling convention for MakeFunc.
+// This should not be called. It is exported so that assembly code
+// can call it.
+
+func MakeFuncStubGo(regs *i386Regs, c *makeFuncImpl) {
+ ftyp := c.typ
+
+ // See if the result requires a struct. If it does, the first
+ // parameter is a pointer to the struct.
+ retStruct := false
+ retEmpty := false
+ switch len(ftyp.out) {
+ case 0:
+ retEmpty = true
+ case 1:
+ if ftyp.out[0].size == 0 {
+ retEmpty = true
+ } else {
+ switch ftyp.out[0].Kind() {
+ case Complex64, Complex128, Array, Interface, Slice, String, Struct:
+ retStruct = true
+ }
+ }
+ default:
+ size := uintptr(0)
+ for _, typ := range ftyp.out {
+ size += typ.size
+ }
+ if size == 0 {
+ retEmpty = true
+ } else {
+ retStruct = true
+ }
+ }
+
+ in := make([]Value, 0, len(ftyp.in))
+ ap := uintptr(regs.esp)
+
+ var retPtr unsafe.Pointer
+ if retStruct {
+ retPtr = *(*unsafe.Pointer)(unsafe.Pointer(ap))
+ ap += ptrSize
+ }
+
+ for _, rt := range ftyp.in {
+ ap = align(ap, ptrSize)
+
+ // We have to copy the argument onto the heap in case
+ // the function hangs on the reflect.Value we pass it.
+ p := unsafe_New(rt)
+ memmove(p, unsafe.Pointer(ap), rt.size)
+
+ v := Value{rt, p, flag(rt.Kind()<<flagKindShift) | flagIndir}
+ in = append(in, v)
+ ap += rt.size
+ }
+
+ // Call the real function.
+
+ out := c.fn(in)
+
+ if len(out) != len(ftyp.out) {
+ panic("reflect: wrong return count from function created by MakeFunc")
+ }
+
+ for i, typ := range ftyp.out {
+ v := out[i]
+ if v.typ != typ {
+ panic("reflect: function created by MakeFunc using " + funcName(c.fn) +
+ " returned wrong type: have " +
+ out[i].typ.String() + " for " + typ.String())
+ }
+ if v.flag&flagRO != 0 {
+ panic("reflect: function created by MakeFunc using " + funcName(c.fn) +
+ " returned value obtained from unexported field")
+ }
+ }
+
+ if retEmpty {
+ return
+ }
+
+ if retStruct {
+ off := uintptr(0)
+ for i, typ := range ftyp.out {
+ v := out[i]
+ off = align(off, uintptr(typ.fieldAlign))
+ addr := unsafe.Pointer(uintptr(retPtr) + off)
+ if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) {
+ storeIword(addr, iword(v.val), typ.size)
+ } else {
+ memmove(addr, v.val, typ.size)
+ }
+ off += typ.size
+ }
+ regs.eax = uint32(uintptr(retPtr))
+ return
+ }
+
+ if len(ftyp.out) != 1 {
+ panic("inconsistency")
+ }
+
+ v := out[0]
+ w := v.iword()
+ if v.Kind() != Ptr && v.Kind() != UnsafePointer {
+ w = loadIword(unsafe.Pointer(w), v.typ.size)
+ }
+ switch v.Kind() {
+ case Float32, Float64:
+ regs.st0 = uint64(uintptr(w))
+ default:
+ regs.eax = uint32(uintptr(w))
+ }
+}
diff --git a/libgo/go/reflect/makefuncgo_amd64.go b/libgo/go/reflect/makefuncgo_amd64.go
new file mode 100644
index 00000000000..ecc50a42520
--- /dev/null
+++ b/libgo/go/reflect/makefuncgo_amd64.go
@@ -0,0 +1,493 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// MakeFunc amd64 implementation.
+
+package reflect
+
+import "unsafe"
+
+// The assembler stub will pass a pointer to this structure.
+// This will come in holding all the registers that might hold
+// function parameters. On return we will set the registers that
+// might hold result values.
+type amd64Regs struct {
+ rax uint64
+ rdi uint64
+ rsi uint64
+ rdx uint64
+ rcx uint64
+ r8 uint64
+ r9 uint64
+ rsp uint64
+ xmm0 [2]uint64
+ xmm1 [2]uint64
+ xmm2 [2]uint64
+ xmm3 [2]uint64
+ xmm4 [2]uint64
+ xmm5 [2]uint64
+ xmm6 [2]uint64
+ xmm7 [2]uint64
+}
+
+// Argument classifications. The amd64 ELF ABI uses several more, but
+// these are the only ones that arise for Go types.
+type amd64Class int
+
+const (
+ amd64Integer amd64Class = iota
+ amd64SSE
+ amd64NoClass
+ amd64Memory
+)
+
+// amd64Classify returns the one or two register classes needed to
+// pass the value of type. Go types never need more than two
+// registers. amd64Memory means the value is stored in memory.
+// amd64NoClass means the register is not used.
+func amd64Classify(typ *rtype) (amd64Class, amd64Class) {
+ switch typ.Kind() {
+ default:
+ panic("internal error--unknown kind in amd64Classify")
+
+ case Bool, Int, Int8, Int16, Int32, Int64,
+ Uint, Uint8, Uint16, Uint32, Uint64,
+ Uintptr, Chan, Func, Map, Ptr, UnsafePointer:
+
+ return amd64Integer, amd64NoClass
+
+ case Float32, Float64, Complex64:
+ return amd64SSE, amd64NoClass
+
+ case Complex128:
+ return amd64SSE, amd64SSE
+
+ case Array:
+ if typ.size == 0 {
+ return amd64NoClass, amd64NoClass
+ } else if typ.size > 16 {
+ return amd64Memory, amd64NoClass
+ }
+ atyp := (*arrayType)(unsafe.Pointer(typ))
+ eclass1, eclass2 := amd64Classify(atyp.elem)
+ if eclass1 == amd64Memory {
+ return amd64Memory, amd64NoClass
+ }
+ if eclass2 == amd64NoClass && typ.size > 8 {
+ eclass2 = eclass1
+ }
+ return eclass1, eclass2
+
+ case Interface:
+ return amd64Integer, amd64Integer
+
+ case Slice:
+ return amd64Memory, amd64NoClass
+
+ case String:
+ return amd64Integer, amd64Integer
+
+ case Struct:
+ if typ.size == 0 {
+ return amd64NoClass, amd64NoClass
+ } else if typ.size > 16 {
+ return amd64Memory, amd64NoClass
+ }
+ var first, second amd64Class
+ f := amd64NoClass
+ onFirst := true
+ styp := (*structType)(unsafe.Pointer(typ))
+ for _, field := range styp.fields {
+ if onFirst && field.offset >= 8 {
+ first = f
+ f = amd64NoClass
+ onFirst = false
+ }
+ fclass1, fclass2 := amd64Classify(field.typ)
+ f = amd64MergeClasses(f, fclass1)
+ if fclass2 != amd64NoClass {
+ if !onFirst {
+ panic("amd64Classify inconsistent")
+ }
+ first = f
+ f = fclass2
+ onFirst = false
+ }
+ }
+ if onFirst {
+ first = f
+ second = amd64NoClass
+ } else {
+ second = f
+ }
+ if first == amd64Memory || second == amd64Memory {
+ return amd64Memory, amd64NoClass
+ }
+ return first, second
+ }
+}
+
+// amd64MergeClasses merges two register classes as described in the
+// amd64 ELF ABI.
+func amd64MergeClasses(c1, c2 amd64Class) amd64Class {
+ switch {
+ case c1 == c2:
+ return c1
+ case c1 == amd64NoClass:
+ return c2
+ case c2 == amd64NoClass:
+ return c1
+ case c1 == amd64Memory || c2 == amd64Memory:
+ return amd64Memory
+ case c1 == amd64Integer || c2 == amd64Integer:
+ return amd64Integer
+ default:
+ return amd64SSE
+ }
+}
+
+// MakeFuncStubGo implements the amd64 calling convention for
+// MakeFunc. This should not be called. It is exported so that
+// assembly code can call it.
+
+func MakeFuncStubGo(regs *amd64Regs, c *makeFuncImpl) {
+ ftyp := c.typ
+
+ // See if the result requires a struct. If it does, the first
+ // parameter is a pointer to the struct.
+ var ret1, ret2 amd64Class
+ switch len(ftyp.out) {
+ case 0:
+ ret1, ret2 = amd64NoClass, amd64NoClass
+ case 1:
+ ret1, ret2 = amd64Classify(ftyp.out[0])
+ default:
+ off := uintptr(0)
+ f := amd64NoClass
+ onFirst := true
+ for _, rt := range ftyp.out {
+ off = align(off, uintptr(rt.fieldAlign))
+
+ if onFirst && off >= 8 {
+ ret1 = f
+ f = amd64NoClass
+ onFirst = false
+ }
+
+ off += rt.size
+ if off > 16 {
+ break
+ }
+
+ fclass1, fclass2 := amd64Classify(rt)
+ f = amd64MergeClasses(f, fclass1)
+ if fclass2 != amd64NoClass {
+ if !onFirst {
+ panic("amd64Classify inconsistent")
+ }
+ ret1 = f
+ f = fclass2
+ onFirst = false
+ }
+ }
+ if off > 16 {
+ ret1, ret2 = amd64Memory, amd64NoClass
+ } else {
+ if onFirst {
+ ret1, ret2 = f, amd64NoClass
+ } else {
+ ret2 = f
+ }
+ }
+ if ret1 == amd64Memory || ret2 == amd64Memory {
+ ret1, ret2 = amd64Memory, amd64NoClass
+ }
+ }
+
+ in := make([]Value, 0, len(ftyp.in))
+ intreg := 0
+ ssereg := 0
+ ap := uintptr(regs.rsp)
+
+ maxIntregs := 6 // When we support Windows, this would be 4.
+ maxSSEregs := 8
+
+ if ret1 == amd64Memory {
+ // We are returning a value in memory, which means
+ // that the first argument is a hidden parameter
+ // pointing to that return area.
+ intreg++
+ }
+
+argloop:
+ for _, rt := range ftyp.in {
+ c1, c2 := amd64Classify(rt)
+
+ fl := flag(rt.Kind()) << flagKindShift
+ if c2 == amd64NoClass {
+
+ // Argument is passed in a single register or
+ // in memory.
+
+ switch c1 {
+ case amd64NoClass:
+ v := Value{rt, nil, fl | flagIndir}
+ in = append(in, v)
+ continue argloop
+ case amd64Integer:
+ if intreg < maxIntregs {
+ reg := amd64IntregVal(regs, intreg)
+ iw := unsafe.Pointer(reg)
+ if k := rt.Kind(); k != Ptr && k != UnsafePointer {
+ iw = unsafe.Pointer(&reg)
+ fl |= flagIndir
+ }
+ v := Value{rt, iw, fl}
+ in = append(in, v)
+ intreg++
+ continue argloop
+ }
+ case amd64SSE:
+ if ssereg < maxSSEregs {
+ reg := amd64SSEregVal(regs, ssereg)
+ v := Value{rt, unsafe.Pointer(&reg), fl | flagIndir}
+ in = append(in, v)
+ ssereg++
+ continue argloop
+ }
+ }
+
+ in, ap = amd64Memarg(in, ap, rt)
+ continue argloop
+ }
+
+ // Argument is passed in two registers.
+
+ nintregs := 0
+ nsseregs := 0
+ switch c1 {
+ case amd64Integer:
+ nintregs++
+ case amd64SSE:
+ nsseregs++
+ default:
+ panic("inconsistent")
+ }
+ switch c2 {
+ case amd64Integer:
+ nintregs++
+ case amd64SSE:
+ nsseregs++
+ default:
+ panic("inconsistent")
+ }
+
+ // If the whole argument does not fit in registers, it
+ // is passed in memory.
+
+ if intreg+nintregs > maxIntregs || ssereg+nsseregs > maxSSEregs {
+ in, ap = amd64Memarg(in, ap, rt)
+ continue argloop
+ }
+
+ var word1, word2 uintptr
+ switch c1 {
+ case amd64Integer:
+ word1 = amd64IntregVal(regs, intreg)
+ intreg++
+ case amd64SSE:
+ word1 = amd64SSEregVal(regs, ssereg)
+ ssereg++
+ }
+ switch c2 {
+ case amd64Integer:
+ word2 = amd64IntregVal(regs, intreg)
+ intreg++
+ case amd64SSE:
+ word2 = amd64SSEregVal(regs, ssereg)
+ ssereg++
+ }
+
+ p := unsafe_New(rt)
+ *(*uintptr)(p) = word1
+ *(*uintptr)(unsafe.Pointer(uintptr(p) + ptrSize)) = word2
+ v := Value{rt, p, fl | flagIndir}
+ in = append(in, v)
+ }
+
+ // All the real arguments have been found and turned into
+ // Value's. Call the real function.
+
+ out := c.fn(in)
+
+ if len(out) != len(ftyp.out) {
+ panic("reflect: wrong return count from function created by MakeFunc")
+ }
+
+ for i, typ := range ftyp.out {
+ v := out[i]
+ if v.typ != typ {
+ panic("reflect: function created by MakeFunc using " + funcName(c.fn) +
+ " returned wrong type: have " +
+ out[i].typ.String() + " for " + typ.String())
+ }
+ if v.flag&flagRO != 0 {
+ panic("reflect: function created by MakeFunc using " + funcName(c.fn) +
+ " returned value obtained from unexported field")
+ }
+ }
+
+ if ret1 == amd64NoClass {
+ return
+ }
+
+ if ret1 == amd64Memory {
+ // The address of the memory area was passed as a
+ // hidden parameter in %rdi.
+ ptr := unsafe.Pointer(uintptr(regs.rdi))
+ off := uintptr(0)
+ for i, typ := range ftyp.out {
+ v := out[i]
+ off = align(off, uintptr(typ.fieldAlign))
+ addr := unsafe.Pointer(uintptr(ptr) + off)
+ if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) {
+ storeIword(addr, iword(v.val), typ.size)
+ } else {
+ memmove(addr, v.val, typ.size)
+ }
+ off += typ.size
+ }
+ return
+ }
+
+ if len(out) == 1 && ret2 == amd64NoClass {
+ v := out[0]
+ w := v.iword()
+ if v.Kind() != Ptr && v.Kind() != UnsafePointer {
+ w = loadIword(unsafe.Pointer(w), v.typ.size)
+ }
+ switch ret1 {
+ case amd64Integer:
+ regs.rax = uint64(uintptr(w))
+ case amd64SSE:
+ regs.xmm0[0] = uint64(uintptr(w))
+ regs.xmm0[1] = 0
+ default:
+ panic("inconsistency")
+ }
+ return
+ }
+
+ var buf [2]unsafe.Pointer
+ ptr := unsafe.Pointer(&buf[0])
+ off := uintptr(0)
+ for i, typ := range ftyp.out {
+ v := out[i]
+ off = align(off, uintptr(typ.fieldAlign))
+ addr := unsafe.Pointer(uintptr(ptr) + off)
+ if v.flag&flagIndir == 0 && (v.kind() == Ptr || v.kind() == UnsafePointer) {
+ storeIword(addr, iword(v.val), typ.size)
+ } else {
+ memmove(addr, v.val, typ.size)
+ }
+ off += uintptr(typ.size)
+ }
+
+ switch ret1 {
+ case amd64Integer:
+ regs.rax = *(*uint64)(unsafe.Pointer(&buf[0]))
+ case amd64SSE:
+ regs.xmm0[0] = *(*uint64)(unsafe.Pointer(&buf[0]))
+ regs.xmm0[1] = 0
+ default:
+ panic("inconsistency")
+ }
+
+ switch ret2 {
+ case amd64Integer:
+ reg := *(*uint64)(unsafe.Pointer(&buf[1]))
+ if ret1 == amd64Integer {
+ regs.rdx = reg
+ } else {
+ regs.rax = reg
+ }
+ case amd64SSE:
+ reg := *(*uint64)(unsafe.Pointer(&buf[1]))
+ if ret1 == amd64Integer {
+ regs.xmm0[0] = reg
+ regs.xmm0[1] = 0
+ } else {
+ regs.xmm1[0] = reg
+ regs.xmm1[1] = 0
+ }
+ case amd64NoClass:
+ default:
+ panic("inconsistency")
+ }
+}
+
+// The amd64Memarg function adds an argument passed in memory.
+func amd64Memarg(in []Value, ap uintptr, rt *rtype) ([]Value, uintptr) {
+ ap = align(ap, ptrSize)
+ ap = align(ap, uintptr(rt.align))
+
+ // We have to copy the argument onto the heap in case the
+ // function hangs onto the reflect.Value we pass it.
+ p := unsafe_New(rt)
+ memmove(p, unsafe.Pointer(ap), rt.size)
+
+ v := Value{rt, p, flag(rt.Kind()<<flagKindShift) | flagIndir}
+ in = append(in, v)
+ ap += rt.size
+ return in, ap
+}
+
+// The amd64IntregVal function returns the value of integer register i.
+func amd64IntregVal(regs *amd64Regs, i int) uintptr {
+ var r uint64
+ switch i {
+ case 0:
+ r = regs.rdi
+ case 1:
+ r = regs.rsi
+ case 2:
+ r = regs.rdx
+ case 3:
+ r = regs.rcx
+ case 4:
+ r = regs.r8
+ case 5:
+ r = regs.r9
+ default:
+ panic("amd64IntregVal: bad index")
+ }
+ return uintptr(r)
+}
+
+// The amd64SSEregVal function returns the value of SSE register i.
+// Note that although SSE registers can hold two uinptr's, for the
+// types we use in Go we only ever use the least significant one. The
+// most significant one would only be used for 128 bit types.
+func amd64SSEregVal(regs *amd64Regs, i int) uintptr {
+ var r uint64
+ switch i {
+ case 0:
+ r = regs.xmm0[0]
+ case 1:
+ r = regs.xmm1[0]
+ case 2:
+ r = regs.xmm2[0]
+ case 3:
+ r = regs.xmm3[0]
+ case 4:
+ r = regs.xmm4[0]
+ case 5:
+ r = regs.xmm5[0]
+ case 6:
+ r = regs.xmm6[0]
+ case 7:
+ r = regs.xmm7[0]
+ }
+ return uintptr(r)
+}
diff --git a/libgo/go/reflect/value.go b/libgo/go/reflect/value.go
index 45a08587973..b199f70888c 100644
--- a/libgo/go/reflect/value.go
+++ b/libgo/go/reflect/value.go
@@ -433,7 +433,7 @@ func (v Value) call(op string, in []Value) []Value {
if v.flag&flagMethod != 0 {
nin++
}
- firstPointer := len(in) > 0 && Kind(t.In(0).(*rtype).kind) != Ptr && v.flag&flagMethod == 0 && isMethod(v.typ)
+ firstPointer := len(in) > 0 && t.In(0).Kind() != Ptr && v.flag&flagMethod == 0 && isMethod(v.typ)
params := make([]unsafe.Pointer, nin)
off := 0
if v.flag&flagMethod != 0 {
@@ -497,8 +497,10 @@ func isMethod(t *rtype) bool {
sawRet := false
for i, c := range s {
if c == '(' {
+ if parens == 0 {
+ params++
+ }
parens++
- params++
} else if c == ')' {
parens--
} else if parens == 0 && c == ' ' && s[i+1] != '(' && !sawRet {
@@ -509,75 +511,6 @@ func isMethod(t *rtype) bool {
return params > 2
}
-// callReflect is the call implementation used by a function
-// returned by MakeFunc. In many ways it is the opposite of the
-// method Value.call above. The method above converts a call using Values
-// into a call of a function with a concrete argument frame, while
-// callReflect converts a call of a function with a concrete argument
-// frame into a call using Values.
-// It is in this file so that it can be next to the call method above.
-// The remainder of the MakeFunc implementation is in makefunc.go.
-func callReflect(ctxt *makeFuncImpl, frame unsafe.Pointer) {
- ftyp := ctxt.typ
- f := ctxt.fn
-
- // Copy argument frame into Values.
- ptr := frame
- off := uintptr(0)
- in := make([]Value, 0, len(ftyp.in))
- for _, arg := range ftyp.in {
- typ := arg
- off += -off & uintptr(typ.align-1)
- v := Value{typ, nil, flag(typ.Kind()) << flagKindShift}
- if typ.size <= ptrSize {
- // value fits in word.
- v.val = unsafe.Pointer(loadIword(unsafe.Pointer(uintptr(ptr)+off), typ.size))
- } else {
- // value does not fit in word.
- // Must make a copy, because f might keep a reference to it,
- // and we cannot let f keep a reference to the stack frame
- // after this function returns, not even a read-only reference.
- v.val = unsafe_New(typ)
- memmove(v.val, unsafe.Pointer(uintptr(ptr)+off), typ.size)
- v.flag |= flagIndir
- }
- in = append(in, v)
- off += typ.size
- }
-
- // Call underlying function.
- out := f(in)
- if len(out) != len(ftyp.out) {
- panic("reflect: wrong return count from function created by MakeFunc")
- }
-
- // Copy results back into argument frame.
- if len(ftyp.out) > 0 {
- off += -off & (ptrSize - 1)
- for i, arg := range ftyp.out {
- typ := arg
- v := out[i]
- if v.typ != typ {
- panic("reflect: function created by MakeFunc using " + funcName(f) +
- " returned wrong type: have " +
- out[i].typ.String() + " for " + typ.String())
- }
- if v.flag&flagRO != 0 {
- panic("reflect: function created by MakeFunc using " + funcName(f) +
- " returned value obtained from unexported field")
- }
- off += -off & uintptr(typ.align-1)
- addr := unsafe.Pointer(uintptr(ptr) + off)
- if v.flag&flagIndir == 0 {
- storeIword(addr, iword(v.val), typ.size)
- } else {
- memmove(addr, v.val, typ.size)
- }
- off += typ.size
- }
- }
-}
-
// methodReceiver returns information about the receiver
// described by v. The Value v may or may not have the
// flagMethod bit set, so the kind cached in v.flag should
@@ -611,7 +544,13 @@ func methodReceiver(op string, v Value, methodIndex int) (t *rtype, fn unsafe.Po
}
fn = unsafe.Pointer(&m.tfn)
t = m.mtyp
- rcvr = v.iword()
+ // Can't call iword here, because it checks v.kind,
+ // and that is always Func.
+ if v.flag&flagIndir != 0 && (v.typ.Kind() == Ptr || v.typ.Kind() == UnsafePointer) {
+ rcvr = loadIword(v.val, v.typ.size)
+ } else {
+ rcvr = iword(v.val)
+ }
}
return
}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6687169f1ce..7646e5c05e2 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,17 @@
+2013-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/57605
+ * testsuite/lib/libgomp.exp: Add -fdiagnostics-color=never to
+ ALWAYS_CFLAGS.
+
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
+2013-09-19 Jakub Jelinek <jakub@redhat.com>
+
+ * testsuite/libgomp.c/sections-2.c: New test.
+
2013-06-28 Marcus Shawcroft <marcus.shawcroft@arm.com>
* testsuite/libgomp.fortran/strassen.f90:
diff --git a/libgomp/configure b/libgomp/configure
index 3e8192d4182..a126384d41d 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -6580,7 +6580,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6605,7 +6605,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6624,7 +6627,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index c661e1b01cb..ce77f962aec 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -166,6 +166,9 @@ proc libgomp_init { args } {
# Disable caret
lappend ALWAYS_CFLAGS "additional_flags=-fno-diagnostics-show-caret"
+ # Disable color diagnostics
+ lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
+
# And, gee, turn on OpenMP.
lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
}
diff --git a/libgomp/testsuite/libgomp.c/sections-2.c b/libgomp/testsuite/libgomp.c/sections-2.c
new file mode 100644
index 00000000000..38216befe0b
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/sections-2.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+__attribute__((noinline, noclone, noreturn))
+void
+foo ()
+{
+ sleep (4);
+ exit (0);
+}
+
+int
+main ()
+{
+ #pragma omp parallel
+ {
+ #pragma omp sections
+ {
+ foo ();
+ #pragma omp section
+ foo ();
+ #pragma omp section
+ foo ();
+ }
+ }
+ return 0;
+}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index e4ce0b9a637..89e108a8da6 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,48 @@
+2013-09-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR bootstrap/58386
+ Revert:
+
+ 2013-09-10 Gary Benson <gbenson@redhat.com>
+
+ * cp-demangle.c: Include hashtab.h.
+ (struct d_print_info): New field saved_scopes.
+ (d_print_init): Initialize the above.
+ (d_print_free): New function.
+ (cplus_demangle_print_callback): Call the above.
+ (struct d_saved_scope): New structure.
+ (d_store_scope): New function.
+ (d_free_scope) Likewise.
+ (d_restore_scope) Likewise.
+ (d_hash_saved_scope) Likewise.
+ (d_equal_saved_scope) Likewise.
+ (d_print_comp): New variable saved_scope.
+ [DEMANGLE_COMPONENT_REFERENCE,
+ DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
+ time the component is traversed, and use the captured scope for
+ subsequent traversals.
+ * testsuite/demangle-expected: Add regression test.
+
+2013-09-10 Gary Benson <gbenson@redhat.com>
+
+ * cp-demangle.c: Include hashtab.h.
+ (struct d_print_info): New field saved_scopes.
+ (d_print_init): Initialize the above.
+ (d_print_free): New function.
+ (cplus_demangle_print_callback): Call the above.
+ (struct d_saved_scope): New structure.
+ (d_store_scope): New function.
+ (d_free_scope) Likewise.
+ (d_restore_scope) Likewise.
+ (d_hash_saved_scope) Likewise.
+ (d_equal_saved_scope) Likewise.
+ (d_print_comp): New variable saved_scope.
+ [DEMANGLE_COMPONENT_REFERENCE,
+ DEMANGLE_COMPONENT_RVALUE_REFERENCE]: Capture scope the first
+ time the component is traversed, and use the captured scope for
+ subsequent traversals.
+ * testsuite/demangle-expected: Add regression test.
+
2013-08-20 Alan Modra <amodra@gmail.com>
* floatformat.c (floatformat_ibm_long_double): Rename to..
diff --git a/libitm/ChangeLog b/libitm/ChangeLog
index adf42308ef3..28f8a227f20 100644
--- a/libitm/ChangeLog
+++ b/libitm/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-08-30 Torvald Riegel <triegel@redhat.com>
* config/posix/rwlock.cc: Fix initialization order.
diff --git a/libitm/configure b/libitm/configure
index 21361b031ad..031c19ce337 100644
--- a/libitm/configure
+++ b/libitm/configure
@@ -7270,7 +7270,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7295,7 +7295,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -7314,7 +7317,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11779,7 +11785,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11782 "configure"
+#line 11788 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11885,7 +11891,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11888 "configure"
+#line 11894 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 23a6accf5df..cda2ed09fd9 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-06-20 Roland Lutz <rlutz@hedmen.org>
* contrib/aot-compile.in: Fix typo in option list.
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog
index 49815367045..4d9f1a6e49c 100644
--- a/libjava/classpath/ChangeLog
+++ b/libjava/classpath/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-05-22 Mark Mitchell <mark@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com>
diff --git a/libjava/classpath/configure b/libjava/classpath/configure
index 413ec15e9a8..75f99a19822 100755
--- a/libjava/classpath/configure
+++ b/libjava/classpath/configure
@@ -7630,7 +7630,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7655,7 +7655,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -7674,7 +7677,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11888,7 +11894,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11891 "configure"
+#line 11897 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11994,7 +12000,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11997 "configure"
+#line 12003 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -25368,7 +25374,7 @@ else
JAVA_TEST=Object.java
CLASS_TEST=Object.class
cat << \EOF > $JAVA_TEST
-/* #line 25371 "configure" */
+/* #line 25377 "configure" */
package java.lang;
public class Object
@@ -25461,7 +25467,7 @@ EOF
if uudecode$EXEEXT Test.uue; then
ac_cv_prog_uudecode_base64=yes
else
- echo "configure: 25464: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
+ echo "configure: 25470: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5
cat Test.uue >&5
ac_cv_prog_uudecode_base64=no
@@ -25489,7 +25495,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
-/* [#]line 25492 "configure" */
+/* [#]line 25498 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);
@@ -25697,7 +25703,7 @@ if test "x${use_glibj_zip}" = xfalse || \
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
- /* #line 25700 "configure" */
+ /* #line 25706 "configure" */
public class Test
{
public static void main(String args)
diff --git a/libjava/configure b/libjava/configure
index 42e8912e84a..087774cbe25 100755
--- a/libjava/configure
+++ b/libjava/configure
@@ -8842,7 +8842,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -8867,7 +8867,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -8886,7 +8889,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -13397,7 +13403,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13385 "configure"
+#line 13391 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13503,7 +13509,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13491 "configure"
+#line 13497 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19498,7 +19504,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then :
enableval=$enable_sjlj_exceptions; :
else
cat > conftest.$ac_ext << EOF
-#line 19486 "configure"
+#line 19492 "configure"
struct S { ~S(); };
void bar();
void foo()
diff --git a/libjava/libltdl/ChangeLog b/libjava/libltdl/ChangeLog
index df5ce43462d..c00e5192e3e 100644
--- a/libjava/libltdl/ChangeLog
+++ b/libjava/libltdl/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * acinclude.m4 (_LT_ENABLE_LOCK <ld -m flags>): Remove non-canonical
+ ppc host match. Support little-endian powerpc linux hosts.
+ * configure: Regenerate.
+
2011-11-21 Andreas Tobler <andreast@fgznet.ch>
* acinclude.m4: Additional FreeBSD 10 fixes.
diff --git a/libjava/libltdl/acinclude.m4 b/libjava/libltdl/acinclude.m4
index d77a1a3990d..f08911950fd 100644
--- a/libjava/libltdl/acinclude.m4
+++ b/libjava/libltdl/acinclude.m4
@@ -519,7 +519,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+x86_64-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
@@ -529,7 +529,10 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -545,7 +548,10 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*)
diff --git a/libjava/libltdl/configure b/libjava/libltdl/configure
index 35b89dc5551..146ca43299e 100755
--- a/libjava/libltdl/configure
+++ b/libjava/libltdl/configure
@@ -4806,7 +4806,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
+x86_64-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
@@ -4820,7 +4820,10 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -4836,7 +4839,10 @@ x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*)
@@ -6456,11 +6462,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6459: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6465: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6463: \$? = $ac_status" >&5
+ echo "$as_me:6469: \$? = $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.
@@ -6718,11 +6724,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6721: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6727: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:6725: \$? = $ac_status" >&5
+ echo "$as_me:6731: \$? = $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.
@@ -6780,11 +6786,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:6783: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:6789: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:6787: \$? = $ac_status" >&5
+ echo "$as_me:6793: \$? = $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
@@ -8099,7 +8105,7 @@ linux*)
libsuff=
case "$host_cpu" in
x86_64*|s390x*|powerpc64*)
- echo '#line 8102 "configure"' > conftest.$ac_ext
+ echo '#line 8108 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8652,7 +8658,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8655 "configure"
+#line 8661 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -8750,7 +8756,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 8753 "configure"
+#line 8759 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10591,7 +10597,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10594 "configure"
+#line 10600 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog
index 6e0d65c2fb7..333029fc9df 100644
--- a/libmudflap/ChangeLog
+++ b/libmudflap/ChangeLog
@@ -1,3 +1,13 @@
+2013-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/57605
+ * testsuite/lib/libmudflap.exp (libmudflap-init): Append
+ -fdiagnostics-color=never to cxxflags.
+
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-03-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/53265
diff --git a/libmudflap/configure b/libmudflap/configure
index a02241501f7..5d46be42add 100755
--- a/libmudflap/configure
+++ b/libmudflap/configure
@@ -6900,7 +6900,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6925,7 +6925,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6944,7 +6947,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11154,7 +11160,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11157 "configure"
+#line 11163 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11260,7 +11266,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11263 "configure"
+#line 11269 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libmudflap/testsuite/lib/libmudflap.exp b/libmudflap/testsuite/lib/libmudflap.exp
index f15dd658adf..639ce02b59a 100644
--- a/libmudflap/testsuite/lib/libmudflap.exp
+++ b/libmudflap/testsuite/lib/libmudflap.exp
@@ -98,7 +98,7 @@ proc libmudflap-init { language } {
append ld_library_path ":${blddir}/.libs"
set libs "-L${blddir}/.libs"
- set cxxflags "-ggdb3 -DDEBUG_ASSERT"
+ set cxxflags "-ggdb3 -DDEBUG_ASSERT -fdiagnostics-color=never"
set includes "-I${srcdir} -I${srcdir}/.. -I.."
if {$language == "c++"} {
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index c2e1a2887b5..85b864abe01 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-07-21 Ondřej Bílka <neleai@seznam.cz>
* class.c: Fix typos.
diff --git a/libobjc/configure b/libobjc/configure
index 15291c949f2..249038da8db 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -6056,7 +6056,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6081,7 +6081,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6100,7 +6103,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -10610,7 +10616,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10613 "configure"
+#line 10619 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10716,7 +10722,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10719 "configure"
+#line 10725 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11487,7 +11493,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then :
enableval=$enable_sjlj_exceptions; :
else
cat > conftest.$ac_ext << EOF
-#line 11490 "configure"
+#line 11496 "configure"
@interface Frob
@end
@implementation Frob
diff --git a/libquadmath/ChangeLog b/libquadmath/ChangeLog
index f04c70180b5..d3c17f67d5d 100644
--- a/libquadmath/ChangeLog
+++ b/libquadmath/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-03-06 Shakthi Kannan <shakthimaan@gmail.com>
PR libquadmath/55473
diff --git a/libquadmath/configure b/libquadmath/configure
index 709b13e5a48..b22f75cfcdd 100755
--- a/libquadmath/configure
+++ b/libquadmath/configure
@@ -6248,7 +6248,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6273,7 +6273,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6292,7 +6295,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -10536,7 +10542,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10539 "configure"
+#line 10545 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10642,7 +10648,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10645 "configure"
+#line 10651 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index f5162c90250..e8e57f94be3 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-09-01 Iain Sandoe <iain@codesourcery.com>
* ubsan/Makefile.am (libubsan_la_LIBADD): Revise to omit
diff --git a/libsanitizer/configure b/libsanitizer/configure
index 2cad869f458..5d393ca42f3 100755
--- a/libsanitizer/configure
+++ b/libsanitizer/configure
@@ -6604,7 +6604,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6629,7 +6629,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6648,7 +6651,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11111,7 +11117,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11114 "configure"
+#line 11120 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11217,7 +11223,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11220 "configure"
+#line 11226 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libssp/ChangeLog b/libssp/ChangeLog
index eb020d9dcf8..c127fce7f3f 100644
--- a/libssp/ChangeLog
+++ b/libssp/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2013-02-06 Richard Sandiford <rdsandiford@googlemail.com>
Revert previous patch.
diff --git a/libssp/configure b/libssp/configure
index 32d3ca68ea5..64532a4d5c2 100755
--- a/libssp/configure
+++ b/libssp/configure
@@ -4508,7 +4508,8 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf is usable" >&5
$as_echo_n "checking whether vsnprintf is usable... " >&6; }
if test "$cross_compiling" = yes; then :
- ssp_have_usable_vsnprintf=define
+ # Google-local: Assume this always works if cross-compiling.
+ssp_have_usable_vsnprintf=define
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -6385,7 +6386,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6410,7 +6411,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6429,7 +6433,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -10673,7 +10680,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10676 "configure"
+#line 10683 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10779,7 +10786,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10782 "configure"
+#line 10789 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 80e0139b483..3e5ca684f2a 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,579 @@
+2013-09-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/parallel/algo.h (__find_switch): Use __binder2nd.
+
+2013-09-30 Chris Jefferson <chris@bubblescope.net>
+
+ PR libstdc++/58437
+ * include/bits/stl_algo.h (__move_median_first): Rename to
+ __move_median_to_first, change to take an addition argument.
+ (__unguarded_partition_pivot): Adjust.
+ * testsuite/performance/25_algorithms/sort.cc: New.
+ * testsuite/performance/25_algorithms/sort_heap.cc: Likewise.
+ * testsuite/performance/25_algorithms/stable_sort.cc: Likewise.
+
+2013-09-28 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/stl_algo.h (remove_copy, remove_copy_if): Declare
+ inline.
+ (rotate_copy, stable_partition, partial_sort_copy): Likewise.
+ (lower_bound, upper_bound, equal_range, inplace_merge): Likewise.
+ (includes, next_permutation, prev_permutation): Likewise.
+ (replace_copy, replace_copy_if, is_sorted_until): Likewise.
+ (minmax_element, is_permutation, adjacent_find): Likewise.
+ (count, count_if, search, search_n, merge): Likewise.
+ (set_intersection, set_difference): Likewise.
+ (set_symmetric_difference, min_element, max_element): Likewise.
+ * include/bits/stl_algobase.h (lower_bound): Likewise.
+ (lexicographical_compare, mismatch): Likewise.
+
+2013-09-28 Tim Shen <timshen91@gmail.com>
+
+ * include/bits/regex_scanner.tcc (_Scanner<>::_M_eat_escape_posix):
+ Let ordinary char escaping in POSIX be valid.
+ * testsuite/28_regex/basic_regex/ctors/basic/raw_string.cc: Test this
+ change.
+
+2013-09-27 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/predefined_ops.h: New.
+ * include/bits/stl_heap.h: Include <bits/predefined_ops.h>.
+ (__is_heap_until, __push_heap, __adjust_heap, __pop_heap): Remove
+ algo duplication.
+ (__is_heap): Adapt.
+ (__make_heap): New.
+ (make_heap): Adapt to use latter.
+ (__sort_heap): New.
+ (sort_heap): Adapt to use latter.
+ * include/bits/algobase.h: Include <bits/predefined_ops.h>.
+ (__lexicographical_compare_impl): New.
+ (__lexicographical_compare<false>::__lc): Adapt to use latter.
+ (lexicographical_compare): Likewise.
+ (__lower_bound): New.
+ (lower_bound): Adapt to use latter.
+ (equal): Use _GLIBCXX_STD_A::equal in N3671 overloads.
+ (__mismatch): New.
+ (mismatch): Use latter.
+ * include/bits/algo.h: Include <bits/predefined_ops.h>. Remove
+ <functional> include.
+ (__move_median_first, __find, __find_if, __find_if_not): Remove
+ algo duplication.
+ (__find_end): Likewise.
+ (__search_n): Rename into ...
+ (__search_n_aux): ... this.
+ (__search_n): Renew, use latter.
+ (search_n): Use latter.
+ (__search): New.
+ (search): Use latter.
+ (__find_end): Likewise.
+ (__remove_copy_if): New.
+ (remove_copy): Use latter.
+ (__adjacent_find): New.
+ (adjacent_find): Use latter.
+ (__unique): New.
+ (unique): Use latter.
+ (__unique_copy): Remove algo duplication.
+ (__stable_partition): New.
+ (stable_partition): Use latter.
+ (__heap_select): Remove algo duplication, use __make_heap.
+ (__partial_sort): New, use latter.
+ (partial_sort): Use latter.
+ (__partial_sort_copy): New.
+ (partial_sort_copy): Use latter.
+ (__unguarded_linear_insert, __insertion_sort): Remove algo
+ duplication.
+ (__unguarded_insertion_sort, __final_insertion_sort): Likewise.
+ (__unguarded_partition, __unguarded_partition_pivot): Likewise.
+ (__partial_sort): New.
+ (partial_sort): Use latter.
+ (__sort): New.
+ (sort): Use latter.
+ (lower_bound): Use __lower_bound.
+ (__upper_bound): New.
+ (upper_bound): Use latter.
+ (__equal_range): New.
+ (equal_range): Use latter.
+ (__move_merge_adaptive, __move_merge_adaptive_backward): Remove
+ algo duplication.
+ (__merge_adaptive, __merge_without_buffer): Likewise.
+ (__inplace_merge): New.
+ (inplace_merge): Use latter.
+ (__move_merge, __merge_sort_loop, __chunk_insertion_sort): Remove
+ algo duplication.
+ (__merge_sort_with_buffer, __stable_sort_adaptive): Likewise.
+ (__inplace_stable_sort): Likewise.
+ (__include): New.
+ (includes): Use latter.
+ (__next_permutation): New.
+ (next_permutation): Use latter.
+ (__prev_permutation): New.
+ (prev_permutation): Use latter.
+ (__replace_copy_if): New.
+ (replace_copy): Use latter.
+ (__is_sorted_until): New.
+ (is_sorted_unitl): Use latter.
+ (__minmax_element): New.
+ (minmax_element): Use latter.
+ (__is_permutation): New.
+ (is_permutation): Use latter.
+ (__adjacent_find): New.
+ (adjacent_find): Use latter.
+ (__count_if): New.
+ (count): Use latter.
+ (count_if): Likewise.
+ (__merge): New.
+ (merge): Use latter.
+ (__stable_sort): New.
+ (stable_sort): Use latter.
+ (__set_union): New.
+ (set_union): Use latter.
+ (__set_intersection): New.
+ (set_intersection): Use latter.
+ (__set_difference): New.
+ (set_difference): Use latter.
+ (__set_symmetric_difference): New.
+ (set_symmetric_difference): Use latter.
+ (__min_element): New.
+ (min_element): Use latter.
+ (__max_element): New.
+ (max_element): Use latter.
+ * include/Makefile.am: Add predefined_ops.h.
+ * include/Makefile.in: Regenerate.
+ * include/parallel/algobase.h (equal, mismatch): Add overloads
+ from N3671.
+ * testsuite/25_algorithms/is_permutation/vectorbool.cc: New.
+ * testsuite/25_algorithms/adjacent_find/vectorbool.cc: Likewise.
+ * testsuite/25_algorithms/find/vectorbool.cc: Likewise.
+ * testsuite/25_algorithms/find_if/vectorbool.cc: Likewise.
+ * testsuite/25_algorithms/find_first_of/vectorbool.cc: Likewise.
+ * testsuite/25_algorithms/heap/vectorbool.cc: Likewise.
+ * testsuite/25_algorithms/find_end/vectorbool.cc: Likewise.
+ * testsuite/25_algorithms/find_if_not/vectorbool.cc: Likewise.
+
+2013-09-27 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/57465
+ * include/std/functional
+ (_Function_base::_Base_manager::_M_not_empty_function): Fix overload
+ for pointers.
+ * testsuite/20_util/function/cons/57465.cc: New.
+
+2013-09-26 Tim Shen <timshen91@gmail.com>
+
+ * regex_error.h: Remove _S_error_last to follow the standard.
+ * regex_scanner.tcc:
+ (_Scanner<_FwdIter>::_M_scan_in_brace): Change error_brace to
+ error_badbrace.
+ (_Scanner<>::_M_eat_escape_posix): Extended doesn't support
+ back-reference.
+ * testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc:
+ Move here from ../../extended.
+ * testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc:
+ Likewise.
+
+2013-09-25 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/forward_list.h (_Fwd_list_node_base::_M_transfer_after):
+ Mark as noexcept.
+ (_Fwd_list_iterator) [_Fwd_list_iterator, operator*, operator->,
+ operator++, operator==, operator!=, _M_next]: Likewise.
+ (_Fwd_list_const_iterator) [_Fwd_list_const_iterator, operator*,
+ operator->, operator++, operator==, operator!=, _M_next]: Likewise.
+ (operator==(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&),
+ operator!=(const _Fwd_list_iterator&, const _Fwd_list_const_iterator&)):
+ Likewise.
+ * include/bits/hashtable_policy.h (_Hash_node_base::_Hash_node_base,
+ _Hash_node::_M_next, _Node_iterator_base::_Node_iterator_base,
+ _Node_iterator_base::_M_incr, operator==(const _Node_iterator_base&,
+ const _Node_iterator_base&), operator!=(const _Node_iterator_base&,
+ const _Node_iterator_base&)): Likewise.
+ (_Node_iterator) [_Node_iterator, operator*, operator->, operator++]:
+ Likewise.
+ (_Node_const_iterator) [_Node_const_iterator, operator*, operator->,
+ operator++]: Likewise.
+ * include/debug/safe_iterator.h (_Safe_iterator) [_Safe_iterator,
+ operator=, operator*, operator->, operator++, operator--, operator[],
+ operator+=, operator+, operator-=, operator-, base, operator _Iterator]:
+ Likewise.
+ (operator==(const _Safe_iterator&, const _Safe_iterator&),
+ operator!=(const _Safe_iterator&, const _Safe_iterator&),
+ operator<(const _Safe_iterator&, const _Safe_iterator&),
+ operator<=(const _Safe_iterator&, const _Safe_iterator&),
+ operator>(const _Safe_iterator&, const _Safe_iterator&),
+ operator>=(const _Safe_iterator&, const _Safe_iterator&),
+ operator-(const _Safe_iterator&, const _Safe_iterator&),
+ operator+(difference_type, const _Safe_iterator&)): Likewise.
+ * include/profile/iterator_tracker.h (__iterator_tracker)
+ [__iterator_tracker, base, operator _Iterator, operator->, operator++,
+ operator--, operator=, operator*, operator[], operator+=, operator+,
+ operator-=, operator-]: Likewise.
+ (operator==(const __iterator_tracker&, const __iterator_tracker&),
+ operator!=(const __iterator_tracker&, const __iterator_tracker&),
+ operator<(const __iterator_tracker&, const __iterator_tracker&),
+ operator<=(const __iterator_tracker&, const __iterator_tracker&),
+ operator>(const __iterator_tracker&, const __iterator_tracker&),
+ operator>=(const __iterator_tracker&, const __iterator_tracker&),
+ operator-(const __iterator_tracker&, const __iterator_tracker&),
+ operator+(difference_type, const __iterator_tracker&)): Likewise.
+
+2013-09-24 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ PR libstdc++/56166
+ * include/bits/basic_string.h (basic_string)
+ [basic_string(basic_string&&)]: Make the noexcept conditional.
+ [operator=(basic_string&&), assign(basic_string&&)]: Link to PR 58265.
+ [begin(), end(), rbegin(), rend(), clear]: Remove noexcept.
+ [pop_back]: Comment on the lack of noexcept.
+ * include/debug/string (basic_string) [basic_string(const _Allocator&),
+ basic_string(basic_string&&), begin(), end(), rbegin(), rend(), clear,
+ operator[](size_type), pop_back]: Comment out noexcept, until vstring
+ replaces basic_string.
+
+2013-09-24 Tim Shen <timshen91@gmail.com>
+
+ * include/Makefile.am: Add regex.tcc.
+ * include/Makefile.in: Regenerate.
+ * include/bits/regex.h: Remove definitions to regex.tcc.
+ * include/bits/regex.tcc: New.
+ (match_results::format, regex_replace): Implement;
+ * include/bits/regex_compiler.h: Move _M_flags to the top of class
+ member list, because other members' initialization depend on it.
+ * include/bits/regex_compiler.tcc
+ (_Compiler<>::_Compiler): Adjust member initializations.
+ (_Compiler<>::_M_quantifier): Fix ungreedy interval quantifier.
+ * include/bits/regex_executor.h: Remove _RegexT from _*Executor classes.
+ In the future, all regex classes may refactor to *Impl style.
+ * include/bits/regex_executor.tcc (_Executor::_M_set_results):
+ Merge identical code from _*Executor classes.
+ * testsuite/28_regex/algorithms/regex_match/extended/
+ string_dispatch_01.cc (fake_match<>): Adjust the hacking-style testcase
+ caller for new __get_executors interface.
+ * testsuite/28_regex/algorithms/regex_replace/char/basic_replace.cc:
+ New.
+ * testsuite/28_regex/match_results/format.cc: New.
+ * testsuite/28_regex/traits/char/lookup_collatename.cc: Remove digraph
+ testcase.
+ * testsuite/28_regex/traits/wchar_t/lookup_collatename.cc: Likewise.
+
+2013-09-23 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * src/c++11/snprintf_lite.cc (__concat_size_t): Use
+ unsigned long long conditionally.
+
+2013-09-23 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * src/c++11/snprintf_lite.cc (__concat_size_t): Use only
+ std::__int_to_char<unsigned long long>()
+
+2013-09-21 Paul Pluzhnikov <ppluzhnikov@google.com>
+
+ * include/bits/functexcept.h (__throw_out_of_range_fmt): New.
+ * src/c++11/functexcept.cc (__throw_out_of_range_fmt): New.
+ * src/c++11/snprintf_lite.cc: New.
+ * src/c++11/Makefile.am: Add snprintf_lite.cc.
+ * src/c++11/Makefile.in: Regenerate.
+ * config/abi/pre/gnu.ver: Add _ZSt24__throw_out_of_range_fmtPKcz.
+ * include/std/array (at): Use __throw_out_of_range_fmt.
+ * include/debug/array (at): Likewise.
+ * include/profile/array (at): Likewise.
+ * include/std/bitset (_M_check_initial_position, _M_check): New.
+ (bitset::bitset): Use _M_check_initial_position.
+ (set, reset, flip, test): Use _M_check.
+ * include/ext/vstring.h (_M_check, at): Use __throw_out_of_range_fmt.
+ * include/bits/stl_vector.h (_M_range_check): Likewise.
+ * include/bits/stl_bvector.h (_M_range_check): Likewise.
+ * include/bits/stl_deque.h (_M_range_check): Likewise.
+ * include/bits/basic_string.h (_M_check, at): Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc:
+ Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc:
+ Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
+ Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
+ Likewise.
+ * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise.
+ * testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc:
+ Likewise.
+ * testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
+ * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Likewise.
+ * testsuite/util/exception/safety.h (generate): Use __throw_out_of_range_fmt.
+
+2013-09-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/57605
+ * testsuite/lib/libstdc++.exp (libstdc++_init): Prepend
+ -fdiagnostics-color=never to cxxflags.
+
+2013-09-20 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/allocator.h (__alloc_swap::_S_do_it,
+ __shrink_to_fit_aux::_S_do_it): Mark as noexcept.
+ * include/bits/basic_string.h (basic_string::_Rep) [_S_empty_rep,
+ _M_is_leaked, _M_is_shared, _M_set_leaked, _M_set_sharable,
+ _M_set_length_and_sharable, _M_dispose]: Likewise.
+ (basic_string::_Alloc_hider::_Alloc_hider): Likewise.
+ (basic_string) [_M_data, _M_rep, _M_ibegin, _M_iend, _M_limit,
+ _M_disjunct, _M_copy, _M_move, _M_assign, _S_copy_chars, _S_compare,
+ _S_empty_rep, shrink_to_fit, operator[] const, front const, back const]:
+ Likewise.
+ [clear]: Link to PR 56166.
+ [swap]: Link to PR 58265.
+ * include/bits/stl_deque.h (_Deque_iterator) [_S_buffer_size,
+ _Deque_iterator, _M_const_cast, operator*, operator->, operator++,
+ operator--, operator+=, operator+, operator-=, operator-, operator[],
+ _M_set_node]: Mark as noexcept.
+ (operator==(const _Deque_iterator&, const _Deque_iterator&),
+ operator!=(const _Deque_iterator&, const _Deque_iterator&),
+ operator<(const _Deque_iterator&, const _Deque_iterator&),
+ operator>(const _Deque_iterator&, const _Deque_iterator&),
+ operator<=(const _Deque_iterator&, const _Deque_iterator&),
+ operator>=(const _Deque_iterator&, const _Deque_iterator&),
+ operator-(const _Deque_iterator&, const _Deque_iterator&),
+ operator+(ptrdiff_t, const _Deque_iterator&)): Likewise.
+ (_Deque_base) [_Deque_base(const allocator_type&)]: Add missing call to
+ _M_initialize_map.
+ [~_Deque_base, _M_deallocate_node, _M_deallocate_map, _M_destroy_nodes]:
+ Mark as noexcept.
+ (_Deque_base::_Deque_impl) [_Deque_impl(const _Tp_alloc_type&),
+ _Deque_impl(_Tp_alloc_type&&)]: Likewise.
+ (deque) [_S_buffer_size, operator=(deque&&), shrink_to_fit, operator[],
+ front, back, pop_front, pop_back, swap]: Likewise.
+ [deque(), deque(const allocator_type&)]: Merge.
+ * include/debug/deque (deque) [operator=(deque&&), shrink_to_fit,
+ operator[], front, back, pop_front, pop_back, swap]: Mark as noexcept.
+ * include/profile/deque (deque) [operator=(deque&&), operator[], front,
+ back, pop_front, pop_back, swap]: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
+ Adjust line number.
+ * testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
+ Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
+ Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
+ Likewise.
+
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
+2013-09-19 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/stl_tree.h (_Rb_tree_node_base) [_S_minimum, _S_maximum]:
+ Mark as noexcept.
+ (_Rb_tree_iterator) [_Rb_tree_iterator, operator*, operator->,
+ operator++, operator--, operator==, operator!=]: Likewise.
+ (_Rb_tree_const_iterator) [_Rb_tree_const_iterator, _M_const_cast,
+ operator*, operator->, operator++, operator--, operator==, operator!=]:
+ Likewise.
+ (operator==(const _Rb_tree_iterator&, const _Rb_tree_const_iterator&),
+ operator!=(const _Rb_tree_iterator&, const _Rb_tree_const_iterator&)):
+ Likewise.
+ (_Rb_tree) [_M_put_node, _M_destroy_node, _M_root, _M_leftmost,
+ _M_rightmost, _M_begin, _M_end, _S_left, _S_right, _S_minimum,
+ _S_maximum]: Likewise.
+ * include/debug/string (basic_string) [basic_string(const _Allocator&),
+ shrink_to_fit, operator[], pop_back]: Likewise.
+ * include/ext/vstring.h (__versa_string) [_M_limit, _M_disjunct,
+ _M_ibegin, _M_iend, __versa_string(const _Alloc&),
+ operator=(__versa_string&&), shrink_to_fit, operator[], front,
+ back, assign(__versa_string&&), swap]: Likewise.
+ (__versa_string) [__versa_string(), __versa_string(const _Alloc&)]:
+ Merge.
+
+2013-09-18 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/stl_iterator.h (__normal_iterator) [__normal_iterator,
+ _M_const_cast, operator*, operator->, operator++, operator--,
+ operator[], operator+=, operator+, operator-=, operator-, base]:
+ Mark as noexcept.
+ (operator==(const __normal_iterator&, const __normal_iterator&),
+ operator!=(const __normal_iterator&, const __normal_iterator&),
+ operator<(const __normal_iterator&, const __normal_iterator&),
+ operator>(const __normal_iterator&, const __normal_iterator&),
+ operator<=(const __normal_iterator&, const __normal_iterator&),
+ operator>=(const __normal_iterator&, const __normal_iterator&),
+ operator-(const __normal_iterator&, const __normal_iterator&),
+ operator+(difference_type, const __normal_iterator&)): Likewise.
+ * include/bits/stl_list.h (list) [splice, _M_check_equal_allocators]:
+ Likewise.
+ (list::_M_check_equal_allocators): Abort instead of throwing.
+ * include/debug/array (array) [operator[], front, back]: Mark as
+ noexcept.
+ * include/profile/array (array) [operator[], front, back]: Likewise.
+ * include/std/array (array) [operator[], front, back]: Likewise.
+ * include/debug/list (list::splice): Likewise.
+ * include/profile/list (list::splice): Likewise.
+ * testsuite/23_containers/list/operations/5.cc: Remove file.
+ * testsuite/23_containers/list/operations/5.h: Likewise.
+
+2013-09-18 Tim Shen <timshen91@gmail.com>
+
+ * include/bits/regex.h: Add friend classes.
+ (match_results<>::position, regex_iterator<>::operator++):
+ Implement position specification in regex_iterator.
+ (regex_match<>, regex_search<>):
+ Move match_results initializations to these function. Remove `todo`.
+ * include/bits/regex_compiler.tcc:
+ (_Compiler<>::_M_quantifier): Fix greedy/ungreedy of interval matching.
+ * include/bits/regex_constants.h:
+ Fix indentation. Change match_flag_type to enum type.
+ * include/bits/regex_executor.h:
+ Merge identical code to the base class _Executor.
+ Support flags in regex_constants.
+ * include/bits/regex_executor.tcc: Likewise.
+ * include/bits/regex_scanner.h: Add comments.
+ * include/bits/regex_scanner.tcc: Same.
+ * testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc:
+ Add a testcase.
+ * testsuite/28_regex/algorithms/regex_search/ecma/flags.cc: New.
+ * testsuite/28_regex/iterators/regex_iterator/char/
+ string_position_01.cc: Remove `xfail`.
+ * testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc:
+ Remove `xfail` and make the case really work.
+
+2013-09-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * testsuite/performance/25_algorithms/search_n.cc: Fix typo.
+
+2013-09-18 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/list.tcc (_List_base::_M_clear, list::erase): Mark as
+ noexcept.
+ * include/bits/stl_list.h (_List_iterator) [_List_iterator,
+ _M_const_cast, operator*, operator->, operator++, operator--,
+ operator==, operator!=]: Likewise.
+ (_List_const_iterator) [_List_const_iterator, _M_const_cast, operator*,
+ operator->, operator++, operator--, operator==, operator!=]: Likewise.
+ (operator==(const _List_iterator&, const _List_const_iterator&),
+ operator!=(const _List_iterator&, const _List_const_iterator&)):
+ Likewise.
+ (_List_impl) [_List_impl(const _Node_alloc_type&),
+ _List_impl(_Node_alloc_type&&)]: Likewise.
+ (_List_base) [_M_put_node, _List_base(const _Node_alloc_type&),
+ _List_base(_List_base&&), _M_clear, _M_init]: Likewise.
+ (list) [list(), list(const allocator_type&)]: Merge.
+ (list) [list(const allocator_type&), front, back, pop_front, pop_back,
+ erase, _M_erase]: Mark as noexcept.
+ * include/debug/list (list) [list(const _Allocator&), front, back,
+ pop_front, pop_back, _M_erase, erase]: Likewise.
+ * include/profile/list (list) [list(const _Allocator&), front, back,
+ pop_front, pop_back, erase]: Likewise.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
+ Adjust line number.
+ * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
+ Likewise.
+
+2013-09-17 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/stl_vector.h (vector::vector(),
+ vector::vector(const allocator_type&)): Merge.
+ (_Vector_impl::_Vector_impl(_Tp_alloc_type const&),
+ _Vector_impl::_Vector_impl(_Tp_alloc_type&&),
+ _Vector_impl::_M_swap_data,
+ _Vector_base::_Vector_base(const allocator_type&),
+ _Vector_base::_Vector_base(allocator_type&&),
+ _Vector_base::_Vector_base(_Vector_base&&), _Vector_base::~_Vector_base,
+ vector::vector(const allocator_type&), vector::operator[],
+ vector::operator[] const, vector::front, vector::front const,
+ vector::back, vector::back const, vector::pop_back,
+ vector::_M_erase_at_end): Mark as noexcept.
+ * include/debug/vector (vector::vector(const _Allocator&),
+ vector::operator[], vector::operator[] const, vector::front,
+ vector::front const, vector::back, vector::back const, vector::pop_back,
+ _M_requires_reallocation, _M_update_guaranteed_capacity,
+ _M_invalidate_after_nth): Mark as noexcept.
+ * include/profile/vector (vector::vector(const _Allocator&),
+ vector::operator[], vector::operator[] const, vector::front,
+ vector::front const, vector::back, vector::back const): Mark as
+ noexcept.
+ (vector::vector(vector&&, const _Allocator&)): Remove wrong noexcept.
+ * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
+ Adjust line number.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+ Likewise.
+
+2013-09-14 Tim Shen <timshen91@gmail.com>
+
+ * include/bits/regex.h (regex_match<>, regex_search<>):
+ Change regex_executor caller. Now use their return value instead
+ of checking __m[0].matched to find out if it's successful.
+ (regex_search<>): Move the search logic to regex_executor.
+ * include/bits/regex_automaton.h: Add some new _Opcode. Refactor
+ _NFA::_M_insert_*.
+ * include/bits/regex_automaton.tcc: Add DEBUG dump for new
+ _Opcode. Refactor _NFA::_M_insert_*.
+ * include/bits/regex_compiler.h (_Compiler<>::_M_get_nfa):
+ Use make_shared instead of construct by hand.
+ * include/bits/regex_compiler.tcc: Implement _Compiler<>::_M_assertion.
+ * include/bits/regex_constants.h: Fix indentation and line breaking.
+ * include/bits/regex_executor.h: Add _ResultsEntry to support
+ greedy/ungreedy mode. Move regex_search logic here.
+ * include/bits/regex_executor.tcc: Implement assertions and
+ greedy/ungreedy matching.
+ * include/bits/regex_scanner.h: Add a new token _S_token_ungreedy.
+ * include/bits/regex_scanner.tcc: Parse a new token _S_token_ungreedy.
+ * testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc: New.
+ * testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc: New.
+ * testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc:
+ Fix comment.
+
+2013-09-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/58415
+ * include/ext/sso_string_base.h (__sso_string_base<>::
+ __sso_string_base(__sso_string_base&&)): Fix thinkos about
+ _M_length vs _M_set_length.
+ * testsuite/ext/vstring/cons/58415-1.cc: New.
+ * testsuite/ext/vstring/cons/58415-2.cc: Likewise.
+
+2013-09-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/58403
+ * include/bits/stl_iterator.h (__normal_iterator<>::operator[],
+ operator+=, operator+, operator-=, operator-): Take the argument
+ by value.
+ * testsuite/24_iterators/normal_iterator/58403.cc: New.
+
+2013-09-11 Mitsuru Kariya <kariya_mitsuru@hotmail.com>
+ Chris Jefferson <chris@bubblescope.net>
+
+ PR libstdc++/58358
+ * include/bits/stl_algo.h (search_n): Fix to guarantee a number
+ of comparisons <= number of elements in the range.
+ * testsuite/25_algorithms/search_n/58358.cc: New.
+ * testsuite/25_algorithms/search_n/iterator.cc: Extend.
+
+2013-09-10 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ * testsuite/28_regex/traits/wchar_t/value.cc: Change template args
+ from char to wchar_t, literals from 'x' to L'x'.
+
+2013-09-10 Kai Tietz <ktietz@redhat.com>
+
+ PR libstdc++/54314
+ * config/abi/pre/gnu-versioned-namespace.ver: Add thunk _ZTv0_n12_NS*
+ like in gnu.ver.
+
2013-09-07 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/58341
@@ -45,23 +621,23 @@
* regex_automaton.h: Rearrange _NFA's layout.
* include/bits/regex_compiler.h: Add _AnyMatcher and _CharMatcher.
- Rearrange _BracketMatcher's layout.
- (_BracketMatcher<>::_M_add_char): Use set instead of vector for
- _M_char_set.
- (_BracketMatcher<>::_M_add_collating_element): Likewise.
- (_BracketMatcher<>::_M_make_range): Likewise.
+ Rearrange _BracketMatcher's layout.
+ (_BracketMatcher<>::_M_add_char): Use set instead of vector for
+ _M_char_set.
+ (_BracketMatcher<>::_M_add_collating_element): Likewise.
+ (_BracketMatcher<>::_M_make_range): Likewise.
* include/bits/regex_compiler.tcc (_Compiler<>::_M_atom): Use
- apropriate constructors of matchers above.
+ appropriate constructors of matchers above.
* testsuite/28_regex/algorithms/regex_match/ecma/char/anymatcher.cc:
- New.
+ New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/backref.cc: New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/empty_range.cc:
- New.
+ New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/emptygroup.cc:
- New.
+ New.
* testsuite/28_regex/algorithms/regex_match/ecma/char/hex.cc: New.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/anymatcher.cc:
- New.
+ New.
* testsuite/28_regex/algorithms/regex_match/ecma/wchar_t/hex.cc: New.
2013-08-30 François Dumont <fdumont@gcc.gnu.org>
@@ -94,33 +670,33 @@
2013-08-29 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h (basic_regex<>::assign): Don't lose _M_traits.
- (regex_iterator<>::regex_iterator): Return nullptr when regex_search
- failed.
- (regex_token_iterator<>::_M_end_of_seq): Should be defined true when
- _M_result is(not isn't) nullptr.
+ (regex_iterator<>::regex_iterator): Return nullptr when regex_search
+ failed.
+ (regex_token_iterator<>::_M_end_of_seq): Should be defined true when
+ _M_result is(not isn't) nullptr.
* include/bits/regex_compiler.h: Store _Compiler::_M_traits by reference
- instead of by value.
+ instead of by value.
* include/bits/regex_executor.h (_DFSExecutor<>::_DFSExecutor): Add
- _M_traits to _DFSExecutor.
+ _M_traits to _DFSExecutor.
* include/bits/regex_executor.tcc (__get_executor<>): Pass traits to
- _DFSExecutor too.
+ _DFSExecutor too.
* testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc:
- New.
+ New.
* testsuite/28_regex/iterators/regex_token_iterator/wchar_t/
- wstring_02.cc: New.
+ wstring_02.cc: New.
2013-08-26 Tim Shen <timshen91@gmail.com>
* include/Makefile.am: Add regex_scanner.{h,tcc}.
* include/Makefile.in: Regenerate.
* include/bits/regex.h (match_search): Handle the `__first == __last`
- situation correctly.
+ situation correctly.
* include/bits/regex_compiler.h: Move _Scanner...
* include/bits/regex_scanner.h: ...to here. New.
* include/bits/regex_compiler.tcc: Move _Scanner...
* include/bits/regex_scanner.tcc: ...to here, too. New.
* include/bits/regex_executor.tcc: Use value instead of reference for
- submatch.
+ submatch.
* include/std/regex: Add regex_scanner.h
* testsuite/28_regex/algorithms/regex_match/awk/cstring_01.cc: New.
* testsuite/28_regex/algorithms/regex_match/basic/empty_range.cc: New.
diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
index 33a0068e2d7..b795a482557 100644
--- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
+++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
@@ -63,6 +63,7 @@ GLIBCXX_7.0 {
_ZTVN9__gnu_cxx3__718stdio_sync_filebufI[cw]NSt3__711char_traitsI[cw]EEEE;
# thunk
+ _ZTv0_n12_NS*;
_ZTv0_n24_NS*;
# typeinfo structure
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 8972fcfca88..d3c399f6bf2 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1365,6 +1365,9 @@ GLIBCXX_3.4.20 {
# std::get_unexpected()
_ZSt14get_unexpectedv;
+ # std::__throw_out_of_range_fmt(char const*, ...)
+ _ZSt24__throw_out_of_range_fmtPKcz;
+
} GLIBCXX_3.4.19;
# Symbols in the support library (libsupc++) have their own tag.
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index f70b3e2c49f..88ae4c338ab 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -7118,7 +7118,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7143,7 +7143,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -7162,7 +7165,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -11535,7 +11541,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11538 "configure"
+#line 11544 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11641,7 +11647,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11644 "configure"
+#line 11650 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15061,7 +15067,7 @@ fi
#
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
cat > conftest.$ac_ext << EOF
-#line 15064 "configure"
+#line 15070 "configure"
struct S { ~S(); };
void bar();
void foo()
@@ -15411,7 +15417,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15414 "configure"
+#line 15420 "configure"
int main()
{
typedef bool atomic_type;
@@ -15446,7 +15452,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15449 "configure"
+#line 15455 "configure"
int main()
{
typedef short atomic_type;
@@ -15481,7 +15487,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15484 "configure"
+#line 15490 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15517,7 +15523,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15520 "configure"
+#line 15526 "configure"
int main()
{
typedef long long atomic_type;
@@ -15596,7 +15602,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15599 "configure"
+#line 15605 "configure"
int main()
{
_Decimal32 d1;
@@ -15638,7 +15644,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15641 "configure"
+#line 15647 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15672,7 +15678,7 @@ $as_echo "$enable_int128" >&6; }
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15675 "configure"
+#line 15681 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 80ca13ad89e..9d3fdaa8cab 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -121,11 +121,13 @@ bits_headers = \
${bits_srcdir}/ostream_insert.h \
${bits_srcdir}/parse_numbers.h \
${bits_srcdir}/postypes.h \
+ ${bits_srcdir}/predefined_ops.h \
${bits_srcdir}/ptr_traits.h \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
${bits_srcdir}/range_access.h \
${bits_srcdir}/regex.h \
+ ${bits_srcdir}/regex.tcc \
${bits_srcdir}/regex_constants.h \
${bits_srcdir}/regex_error.h \
${bits_srcdir}/regex_scanner.h \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 74ddbf52eed..9eda27925e9 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -388,11 +388,13 @@ bits_headers = \
${bits_srcdir}/ostream_insert.h \
${bits_srcdir}/parse_numbers.h \
${bits_srcdir}/postypes.h \
+ ${bits_srcdir}/predefined_ops.h \
${bits_srcdir}/ptr_traits.h \
${bits_srcdir}/random.h \
${bits_srcdir}/random.tcc \
${bits_srcdir}/range_access.h \
${bits_srcdir}/regex.h \
+ ${bits_srcdir}/regex.tcc \
${bits_srcdir}/regex_constants.h \
${bits_srcdir}/regex_error.h \
${bits_srcdir}/regex_scanner.h \
diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h
index 28df242b1bc..c72859b6ed3 100644
--- a/libstdc++-v3/include/bits/allocator.h
+++ b/libstdc++-v3/include/bits/allocator.h
@@ -158,13 +158,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// To implement Option 3 of DR 431.
template<typename _Alloc, bool = __is_empty(_Alloc)>
struct __alloc_swap
- { static void _S_do_it(_Alloc&, _Alloc&) { } };
+ { static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
template<typename _Alloc>
struct __alloc_swap<_Alloc, false>
{
static void
- _S_do_it(_Alloc& __one, _Alloc& __two)
+ _S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
{
// Precondition: swappable allocators.
if (__one != __two)
@@ -194,13 +194,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= __or_<is_copy_constructible<typename _Tp::value_type>,
is_nothrow_move_constructible<typename _Tp::value_type>>::value>
struct __shrink_to_fit_aux
- { static bool _S_do_it(_Tp&) { return false; } };
+ { static bool _S_do_it(_Tp&) noexcept { return false; } };
template<typename _Tp>
struct __shrink_to_fit_aux<_Tp, true>
{
static bool
- _S_do_it(_Tp& __c)
+ _S_do_it(_Tp& __c) noexcept
{
__try
{
diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h
index c8723ededd9..db01eb7dace 100644
--- a/libstdc++-v3/include/bits/basic_string.h
+++ b/libstdc++-v3/include/bits/basic_string.h
@@ -178,7 +178,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static size_type _S_empty_rep_storage[];
static _Rep&
- _S_empty_rep()
+ _S_empty_rep() _GLIBCXX_NOEXCEPT
{
// NB: Mild hack to avoid strict-aliasing warnings. Note that
// _S_empty_rep_storage is never modified and the punning should
@@ -188,23 +188,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
bool
- _M_is_leaked() const
+ _M_is_leaked() const _GLIBCXX_NOEXCEPT
{ return this->_M_refcount < 0; }
bool
- _M_is_shared() const
+ _M_is_shared() const _GLIBCXX_NOEXCEPT
{ return this->_M_refcount > 0; }
void
- _M_set_leaked()
+ _M_set_leaked() _GLIBCXX_NOEXCEPT
{ this->_M_refcount = -1; }
void
- _M_set_sharable()
+ _M_set_sharable() _GLIBCXX_NOEXCEPT
{ this->_M_refcount = 0; }
void
- _M_set_length_and_sharable(size_type __n)
+ _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT
{
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
if (__builtin_expect(this != &_S_empty_rep(), false))
@@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_create(size_type, size_type, const _Alloc&);
void
- _M_dispose(const _Alloc& __a)
+ _M_dispose(const _Alloc& __a) _GLIBCXX_NOEXCEPT
{
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
if (__builtin_expect(this != &_S_empty_rep(), false))
@@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Use empty-base optimization: http://www.cantrip.org/emptyopt.html
struct _Alloc_hider : _Alloc
{
- _Alloc_hider(_CharT* __dat, const _Alloc& __a)
+ _Alloc_hider(_CharT* __dat, const _Alloc& __a) _GLIBCXX_NOEXCEPT
: _Alloc(__a), _M_p(__dat) { }
_CharT* _M_p; // The actual data.
@@ -289,25 +289,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
mutable _Alloc_hider _M_dataplus;
_CharT*
- _M_data() const
+ _M_data() const _GLIBCXX_NOEXCEPT
{ return _M_dataplus._M_p; }
_CharT*
- _M_data(_CharT* __p)
+ _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT
{ return (_M_dataplus._M_p = __p); }
_Rep*
- _M_rep() const
+ _M_rep() const _GLIBCXX_NOEXCEPT
{ return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
// For the internal use we have functions similar to `begin'/`end'
// but they do not call _M_leak.
iterator
- _M_ibegin() const
+ _M_ibegin() const _GLIBCXX_NOEXCEPT
{ return iterator(_M_data()); }
iterator
- _M_iend() const
+ _M_iend() const _GLIBCXX_NOEXCEPT
{ return iterator(_M_data() + this->size()); }
void
@@ -321,7 +321,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_check(size_type __pos, const char* __s) const
{
if (__pos > this->size())
- __throw_out_of_range(__N(__s));
+ __throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > "
+ "this->size() (which is %zu)"),
+ __s, __pos, this->size());
return __pos;
}
@@ -334,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: _M_limit doesn't check for a bad __pos value.
size_type
- _M_limit(size_type __pos, size_type __off) const
+ _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT
{
const bool __testoff = __off < this->size() - __pos;
return __testoff ? __off : this->size() - __pos;
@@ -342,7 +344,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// True if _Rep and source do not overlap.
bool
- _M_disjunct(const _CharT* __s) const
+ _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT
{
return (less<const _CharT*>()(__s, _M_data())
|| less<const _CharT*>()(_M_data() + this->size(), __s));
@@ -351,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// When __n = 1 way faster than the general multichar
// traits_type::copy/move/assign.
static void
- _M_copy(_CharT* __d, const _CharT* __s, size_type __n)
+ _M_copy(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
{
if (__n == 1)
traits_type::assign(*__d, *__s);
@@ -360,7 +362,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
static void
- _M_move(_CharT* __d, const _CharT* __s, size_type __n)
+ _M_move(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
{
if (__n == 1)
traits_type::assign(*__d, *__s);
@@ -369,7 +371,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
static void
- _M_assign(_CharT* __d, size_type __n, _CharT __c)
+ _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT
{
if (__n == 1)
traits_type::assign(*__d, __c);
@@ -382,29 +384,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _Iterator>
static void
_S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
+ _GLIBCXX_NOEXCEPT
{
for (; __k1 != __k2; ++__k1, ++__p)
traits_type::assign(*__p, *__k1); // These types are off.
}
static void
- _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2)
+ _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
{ _S_copy_chars(__p, __k1.base(), __k2.base()); }
static void
_S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
+ _GLIBCXX_NOEXCEPT
{ _S_copy_chars(__p, __k1.base(), __k2.base()); }
static void
- _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
+ _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
{ _M_copy(__p, __k1, __k2 - __k1); }
static void
_S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)
+ _GLIBCXX_NOEXCEPT
{ _M_copy(__p, __k1, __k2 - __k1); }
static int
- _S_compare(size_type __n1, size_type __n2)
+ _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
{
const difference_type __d = difference_type(__n1 - __n2);
@@ -423,7 +428,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_leak_hard();
static _Rep&
- _S_empty_rep()
+ _S_empty_rep() _GLIBCXX_NOEXCEPT
{ return _Rep::_S_empty_rep(); }
public:
@@ -504,7 +509,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* The newly-created string contains the exact contents of @a __str.
* @a __str is a valid, but unspecified string.
**/
- basic_string(basic_string&& __str) noexcept
+ basic_string(basic_string&& __str)
+#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
+ noexcept // FIXME C++11: should always be noexcept.
+#endif
: _M_dataplus(__str._M_dataplus)
{
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
@@ -576,6 +584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* The contents of @a str are moved into this string (without copying).
* @a str is a valid, but unspecified string.
**/
+ // PR 58265, this should be noexcept.
basic_string&
operator=(basic_string&& __str)
{
@@ -602,7 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the %string. Unshares the string.
*/
iterator
- begin() _GLIBCXX_NOEXCEPT
+ begin() // FIXME C++11: should be noexcept.
{
_M_leak();
return iterator(_M_data());
@@ -621,7 +630,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* character in the %string. Unshares the string.
*/
iterator
- end() _GLIBCXX_NOEXCEPT
+ end() // FIXME C++11: should be noexcept.
{
_M_leak();
return iterator(_M_data() + this->size());
@@ -641,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* order. Unshares the string.
*/
reverse_iterator
- rbegin() _GLIBCXX_NOEXCEPT
+ rbegin() // FIXME C++11: should be noexcept.
{ return reverse_iterator(this->end()); }
/**
@@ -659,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element order. Unshares the string.
*/
reverse_iterator
- rend() _GLIBCXX_NOEXCEPT
+ rend() // FIXME C++11: should be noexcept.
{ return reverse_iterator(this->begin()); }
/**
@@ -756,7 +765,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L
/// A non-binding request to reduce capacity() to size().
void
- shrink_to_fit()
+ shrink_to_fit() _GLIBCXX_NOEXCEPT
{
if (capacity() > size())
{
@@ -799,8 +808,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* Erases the string, making it empty.
*/
+ // PR 56166: this should not throw.
void
- clear() _GLIBCXX_NOEXCEPT
+ clear()
{ _M_mutate(0, this->size(), 0); }
/**
@@ -823,7 +833,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* see at().)
*/
const_reference
- operator[] (size_type __pos) const
+ operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_ASSERT(__pos <= size());
return _M_data()[__pos];
@@ -865,7 +875,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
at(size_type __n) const
{
if (__n >= this->size())
- __throw_out_of_range(__N("basic_string::at"));
+ __throw_out_of_range_fmt(__N("basic_string::at: __n "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
return _M_data()[__n];
}
@@ -884,7 +897,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
at(size_type __n)
{
if (__n >= size())
- __throw_out_of_range(__N("basic_string::at"));
+ __throw_out_of_range_fmt(__N("basic_string::at: __n "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
_M_leak();
return _M_data()[__n];
}
@@ -903,7 +919,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element of the %string.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return operator[](0); }
/**
@@ -919,7 +935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last element of the %string.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{ return operator[](this->size() - 1); }
#endif
@@ -1076,6 +1092,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* This function sets this string to the exact contents of @a __str.
* @a __str is a valid, but unspecified string.
*/
+ // PR 58265, this should be noexcept.
basic_string&
assign(basic_string&& __str)
{
@@ -1405,7 +1422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* The string must be non-empty.
*/
void
- pop_back()
+ pop_back() // FIXME C++11: should be noexcept.
{ erase(size()-1, 1); }
#endif // C++11
@@ -1787,6 +1804,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Exchanges the contents of this string with that of @a __s in constant
* time.
*/
+ // PR 58265, this should be noexcept.
void
swap(basic_string& __s);
diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h
index c3cee971399..9ac9d22523b 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -58,7 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Fwd_list_node_base*
_M_transfer_after(_Fwd_list_node_base* __begin,
- _Fwd_list_node_base* __end)
+ _Fwd_list_node_base* __end) noexcept
{
_Fwd_list_node_base* __keep = __begin->_M_next;
if (__end)
@@ -128,30 +128,30 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
- _Fwd_list_iterator()
+ _Fwd_list_iterator() noexcept
: _M_node() { }
explicit
- _Fwd_list_iterator(_Fwd_list_node_base* __n)
+ _Fwd_list_iterator(_Fwd_list_node_base* __n) noexcept
: _M_node(__n) { }
reference
- operator*() const
+ operator*() const noexcept
{ return *static_cast<_Node*>(this->_M_node)->_M_valptr(); }
pointer
- operator->() const
+ operator->() const noexcept
{ return static_cast<_Node*>(this->_M_node)->_M_valptr(); }
_Self&
- operator++()
+ operator++() noexcept
{
_M_node = _M_node->_M_next;
return *this;
}
_Self
- operator++(int)
+ operator++(int) noexcept
{
_Self __tmp(*this);
_M_node = _M_node->_M_next;
@@ -159,15 +159,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const noexcept
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const noexcept
{ return _M_node != __x._M_node; }
_Self
- _M_next() const
+ _M_next() const noexcept
{
if (_M_node)
return _Fwd_list_iterator(_M_node->_M_next);
@@ -196,33 +196,33 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
- _Fwd_list_const_iterator()
+ _Fwd_list_const_iterator() noexcept
: _M_node() { }
explicit
- _Fwd_list_const_iterator(const _Fwd_list_node_base* __n)
+ _Fwd_list_const_iterator(const _Fwd_list_node_base* __n) noexcept
: _M_node(__n) { }
- _Fwd_list_const_iterator(const iterator& __iter)
+ _Fwd_list_const_iterator(const iterator& __iter) noexcept
: _M_node(__iter._M_node) { }
reference
- operator*() const
+ operator*() const noexcept
{ return *static_cast<_Node*>(this->_M_node)->_M_valptr(); }
pointer
- operator->() const
+ operator->() const noexcept
{ return static_cast<_Node*>(this->_M_node)->_M_valptr(); }
_Self&
- operator++()
+ operator++() noexcept
{
_M_node = _M_node->_M_next;
return *this;
}
_Self
- operator++(int)
+ operator++(int) noexcept
{
_Self __tmp(*this);
_M_node = _M_node->_M_next;
@@ -230,15 +230,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const noexcept
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const noexcept
{ return _M_node != __x._M_node; }
_Self
- _M_next() const
+ _M_next() const noexcept
{
if (this->_M_node)
return _Fwd_list_const_iterator(_M_node->_M_next);
@@ -255,7 +255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp>
inline bool
operator==(const _Fwd_list_iterator<_Tp>& __x,
- const _Fwd_list_const_iterator<_Tp>& __y)
+ const _Fwd_list_const_iterator<_Tp>& __y) noexcept
{ return __x._M_node == __y._M_node; }
/**
@@ -264,7 +264,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp>
inline bool
operator!=(const _Fwd_list_iterator<_Tp>& __x,
- const _Fwd_list_const_iterator<_Tp>& __y)
+ const _Fwd_list_const_iterator<_Tp>& __y) noexcept
{ return __x._M_node != __y._M_node; }
/**
diff --git a/libstdc++-v3/include/bits/functexcept.h b/libstdc++-v3/include/bits/functexcept.h
index 16140583077..03e2040d96a 100644
--- a/libstdc++-v3/include/bits/functexcept.h
+++ b/libstdc++-v3/include/bits/functexcept.h
@@ -75,6 +75,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__throw_out_of_range(const char*) __attribute__((__noreturn__));
void
+ __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__))
+ __attribute__((__format__(__printf__, 1, 2)));
+
+ void
__throw_runtime_error(const char*) __attribute__((__noreturn__));
void
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 61b852f62df..ed9e9dd870a 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -230,9 +230,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_Hash_node_base* _M_nxt;
- _Hash_node_base() : _M_nxt() { }
+ _Hash_node_base() noexcept : _M_nxt() { }
- _Hash_node_base(_Hash_node_base* __next) : _M_nxt(__next) { }
+ _Hash_node_base(_Hash_node_base* __next) noexcept : _M_nxt(__next) { }
};
/**
@@ -281,7 +281,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::size_t _M_hash_code;
_Hash_node*
- _M_next() const { return static_cast<_Hash_node*>(this->_M_nxt); }
+ _M_next() const noexcept
+ { return static_cast<_Hash_node*>(this->_M_nxt); }
};
/**
@@ -293,7 +294,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct _Hash_node<_Value, false> : _Hash_node_value_base<_Value>
{
_Hash_node*
- _M_next() const { return static_cast<_Hash_node*>(this->_M_nxt); }
+ _M_next() const noexcept
+ { return static_cast<_Hash_node*>(this->_M_nxt); }
};
/// Base class for node iterators.
@@ -304,11 +306,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__node_type* _M_cur;
- _Node_iterator_base(__node_type* __p)
+ _Node_iterator_base(__node_type* __p) noexcept
: _M_cur(__p) { }
void
- _M_incr()
+ _M_incr() noexcept
{ _M_cur = _M_cur->_M_next(); }
};
@@ -316,12 +318,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator==(const _Node_iterator_base<_Value, _Cache_hash_code>& __x,
const _Node_iterator_base<_Value, _Cache_hash_code >& __y)
+ noexcept
{ return __x._M_cur == __y._M_cur; }
template<typename _Value, bool _Cache_hash_code>
inline bool
operator!=(const _Node_iterator_base<_Value, _Cache_hash_code>& __x,
const _Node_iterator_base<_Value, _Cache_hash_code>& __y)
+ noexcept
{ return __x._M_cur != __y._M_cur; }
/// Node iterators, used to iterate through all the hashtable.
@@ -344,30 +348,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using reference = typename std::conditional<__constant_iterators,
const _Value&, _Value&>::type;
- _Node_iterator()
+ _Node_iterator() noexcept
: __base_type(0) { }
explicit
- _Node_iterator(__node_type* __p)
+ _Node_iterator(__node_type* __p) noexcept
: __base_type(__p) { }
reference
- operator*() const
+ operator*() const noexcept
{ return this->_M_cur->_M_v(); }
pointer
- operator->() const
+ operator->() const noexcept
{ return this->_M_cur->_M_valptr(); }
_Node_iterator&
- operator++()
+ operator++() noexcept
{
this->_M_incr();
return *this;
}
_Node_iterator
- operator++(int)
+ operator++(int) noexcept
{
_Node_iterator __tmp(*this);
this->_M_incr();
@@ -392,34 +396,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef const _Value* pointer;
typedef const _Value& reference;
- _Node_const_iterator()
+ _Node_const_iterator() noexcept
: __base_type(0) { }
explicit
- _Node_const_iterator(__node_type* __p)
+ _Node_const_iterator(__node_type* __p) noexcept
: __base_type(__p) { }
_Node_const_iterator(const _Node_iterator<_Value, __constant_iterators,
- __cache>& __x)
+ __cache>& __x) noexcept
: __base_type(__x._M_cur) { }
reference
- operator*() const
+ operator*() const noexcept
{ return this->_M_cur->_M_v(); }
pointer
- operator->() const
+ operator->() const noexcept
{ return this->_M_cur->_M_valptr(); }
_Node_const_iterator&
- operator++()
+ operator++() noexcept
{
this->_M_incr();
return *this;
}
_Node_const_iterator
- operator++(int)
+ operator++(int) noexcept
{
_Node_const_iterator __tmp(*this);
this->_M_incr();
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index 4d8ce2351e8..718dcec1e09 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -63,7 +63,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
void
_List_base<_Tp, _Alloc>::
- _M_clear()
+ _M_clear() _GLIBCXX_NOEXCEPT
{
typedef _List_node<_Tp> _Node;
_Node* __cur = static_cast<_Node*>(_M_impl._M_node._M_next);
@@ -145,7 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::
#if __cplusplus >= 201103L
- erase(const_iterator __position)
+ erase(const_iterator __position) noexcept
#else
erase(iterator __position)
#endif
diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h
new file mode 100644
index 00000000000..30870b76383
--- /dev/null
+++ b/libstdc++-v3/include/bits/predefined_ops.h
@@ -0,0 +1,304 @@
+// Default predicates for internal use -*- C++ -*-
+
+// Copyright (C) 2013 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/>.
+
+/** @file predefined_ops.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_PREDEFINED_OPS_H
+#define _GLIBCXX_PREDEFINED_OPS_H 1
+
+namespace __gnu_cxx
+{
+namespace __ops
+{
+ struct _Iter_less_iter
+ {
+ template<typename _Iterator1, typename _Iterator2>
+ bool
+ operator()(_Iterator1 __it1, _Iterator2 __it2) const
+ { return *__it1 < *__it2; }
+ };
+
+ inline _Iter_less_iter
+ __iter_less_iter()
+ { return _Iter_less_iter(); }
+
+ struct _Iter_less_val
+ {
+ template<typename _Iterator, typename _Value>
+ bool
+ operator()(_Iterator __it, _Value& __val) const
+ { return *__it < __val; }
+ };
+
+ inline _Iter_less_val
+ __iter_less_val()
+ { return _Iter_less_val(); }
+
+ inline _Iter_less_val
+ __iter_comp_val(_Iter_less_iter)
+ { return _Iter_less_val(); }
+
+ struct _Val_less_iter
+ {
+ template<typename _Value, typename _Iterator>
+ bool
+ operator()(_Value& __val, _Iterator __it) const
+ { return __val < *__it; }
+ };
+
+ inline _Val_less_iter
+ __val_less_iter()
+ { return _Val_less_iter(); }
+
+ inline _Val_less_iter
+ __val_comp_iter(_Iter_less_iter)
+ { return _Val_less_iter(); }
+
+ struct _Iter_equal_to_iter
+ {
+ template<typename _Iterator1, typename _Iterator2>
+ bool
+ operator()(_Iterator1 __it1, _Iterator2 __it2) const
+ { return *__it1 == *__it2; }
+ };
+
+ inline _Iter_equal_to_iter
+ __iter_equal_to_iter()
+ { return _Iter_equal_to_iter(); }
+
+ struct _Iter_equal_to_val
+ {
+ template<typename _Iterator, typename _Value>
+ bool
+ operator()(_Iterator __it, _Value& __val) const
+ { return *__it == __val; }
+ };
+
+ inline _Iter_equal_to_val
+ __iter_equal_to_val()
+ { return _Iter_equal_to_val(); }
+
+ inline _Iter_equal_to_val
+ __iter_comp_val(_Iter_equal_to_iter)
+ { return _Iter_equal_to_val(); }
+
+ template<typename _Compare>
+ struct _Iter_comp_iter
+ {
+ _Compare _M_comp;
+
+ _Iter_comp_iter(_Compare __comp)
+ : _M_comp(__comp)
+ { }
+
+ template<typename _Iterator1, typename _Iterator2>
+ bool
+ operator()(_Iterator1 __it1, _Iterator2 __it2)
+ { return bool(_M_comp(*__it1, *__it2)); }
+ };
+
+ template<typename _Compare>
+ inline _Iter_comp_iter<_Compare>
+ __iter_comp_iter(_Compare __comp)
+ { return _Iter_comp_iter<_Compare>(__comp); }
+
+ template<typename _Compare>
+ struct _Iter_comp_val
+ {
+ _Compare _M_comp;
+
+ _Iter_comp_val(_Compare __comp)
+ : _M_comp(__comp)
+ { }
+
+ template<typename _Iterator, typename _Value>
+ bool
+ operator()(_Iterator __it, _Value& __val)
+ { return bool(_M_comp(*__it, __val)); }
+ };
+
+ template<typename _Compare>
+ inline _Iter_comp_val<_Compare>
+ __iter_comp_val(_Compare __comp)
+ { return _Iter_comp_val<_Compare>(__comp); }
+
+ template<typename _Compare>
+ inline _Iter_comp_val<_Compare>
+ __iter_comp_val(_Iter_comp_iter<_Compare> __comp)
+ { return _Iter_comp_val<_Compare>(__comp._M_comp); }
+
+ template<typename _Compare>
+ struct _Val_comp_iter
+ {
+ _Compare _M_comp;
+
+ _Val_comp_iter(_Compare __comp)
+ : _M_comp(__comp)
+ { }
+
+ template<typename _Value, typename _Iterator>
+ bool
+ operator()(_Value& __val, _Iterator __it)
+ { return bool(_M_comp(__val, *__it)); }
+ };
+
+ template<typename _Compare>
+ inline _Val_comp_iter<_Compare>
+ __val_comp_iter(_Compare __comp)
+ { return _Val_comp_iter<_Compare>(__comp); }
+
+ template<typename _Compare>
+ inline _Val_comp_iter<_Compare>
+ __val_comp_iter(_Iter_comp_iter<_Compare> __comp)
+ { return _Val_comp_iter<_Compare>(__comp._M_comp); }
+
+ template<typename _Value>
+ struct _Iter_equals_val
+ {
+ _Value& _M_value;
+
+ _Iter_equals_val(_Value& __value)
+ : _M_value(__value)
+ { }
+
+ template<typename _Iterator>
+ bool
+ operator()(_Iterator __it)
+ { return *__it == _M_value; }
+ };
+
+ template<typename _Value>
+ inline _Iter_equals_val<_Value>
+ __iter_equals_val(_Value& __val)
+ { return _Iter_equals_val<_Value>(__val); }
+
+ template<typename _Iterator1>
+ struct _Iter_equals_iter
+ {
+ typename std::iterator_traits<_Iterator1>::reference _M_ref;
+
+ _Iter_equals_iter(_Iterator1 __it1)
+ : _M_ref(*__it1)
+ { }
+
+ template<typename _Iterator2>
+ bool
+ operator()(_Iterator2 __it2)
+ { return *__it2 == _M_ref; }
+ };
+
+ template<typename _Iterator>
+ inline _Iter_equals_iter<_Iterator>
+ __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it)
+ { return _Iter_equals_iter<_Iterator>(__it); }
+
+ template<typename _Predicate>
+ struct _Iter_pred
+ {
+ _Predicate _M_pred;
+
+ _Iter_pred(_Predicate __pred)
+ : _M_pred(__pred)
+ { }
+
+ template<typename _Iterator>
+ bool
+ operator()(_Iterator __it)
+ { return bool(_M_pred(*__it)); }
+ };
+
+ template<typename _Predicate>
+ inline _Iter_pred<_Predicate>
+ __pred_iter(_Predicate __pred)
+ { return _Iter_pred<_Predicate>(__pred); }
+
+ template<typename _Compare, typename _Value>
+ struct _Iter_comp_to_val
+ {
+ _Compare _M_comp;
+ _Value& _M_value;
+
+ _Iter_comp_to_val(_Compare __comp, _Value& __value)
+ : _M_comp(__comp), _M_value(__value)
+ { }
+
+ template<typename _Iterator>
+ bool
+ operator()(_Iterator __it)
+ { return bool(_M_comp(*__it, _M_value)); }
+ };
+
+ template<typename _Compare, typename _Value>
+ _Iter_comp_to_val<_Compare, _Value>
+ __iter_comp_val(_Compare __comp, _Value &__val)
+ { return _Iter_comp_to_val<_Compare, _Value>(__comp, __val); }
+
+ template<typename _Compare, typename _Iterator1>
+ struct _Iter_comp_to_iter
+ {
+ _Compare _M_comp;
+ typename std::iterator_traits<_Iterator1>::reference _M_ref;
+
+ _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
+ : _M_comp(__comp), _M_ref(*__it1)
+ { }
+
+ template<typename _Iterator2>
+ bool
+ operator()(_Iterator2 __it2)
+ { return bool(_M_comp(*__it2, _M_ref)); }
+ };
+
+ template<typename _Compare, typename _Iterator>
+ inline _Iter_comp_to_iter<_Compare, _Iterator>
+ __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it)
+ { return _Iter_comp_to_iter<_Compare, _Iterator>(__comp._M_comp, __it); }
+
+ template<typename _Predicate>
+ struct _Iter_negate
+ {
+ _Predicate _M_pred;
+
+ _Iter_negate(_Predicate __pred)
+ : _M_pred(__pred)
+ { }
+
+ template<typename _Iterator>
+ bool
+ operator()(_Iterator __it)
+ { return !bool(_M_pred(*__it)); }
+ };
+
+ template<typename _Predicate>
+ inline _Iter_negate<_Predicate>
+ __negate(_Iter_pred<_Predicate> __pred)
+ { return _Iter_negate<_Predicate>(__pred._M_pred); }
+
+} // namespace __ops
+} // namespace __gnu_cxx
+
+#endif
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 412465adfa2..cbe903625b9 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -214,7 +214,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* is known and can be converted into a primary sort key
* then returns that key, otherwise returns an empty string.
*
- * @todo Implement this function.
+ * @todo Implement this function correctly.
*/
template<typename _Fwd_iter>
string_type
@@ -343,278 +343,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
locale_type _M_locale;
};
- template<typename _Ch_type>
- template<typename _Fwd_iter>
- typename regex_traits<_Ch_type>::string_type
- regex_traits<_Ch_type>::
- lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
- {
- typedef std::ctype<char_type> __ctype_type;
- const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
-
- static const char* __collatenames[] =
- {
- "NUL",
- "SOH",
- "STX",
- "ETX",
- "EOT",
- "ENQ",
- "ACK",
- "alert",
- "backspace",
- "tab",
- "newline",
- "vertical-tab",
- "form-feed",
- "carriage-return",
- "SO",
- "SI",
- "DLE",
- "DC1",
- "DC2",
- "DC3",
- "DC4",
- "NAK",
- "SYN",
- "ETB",
- "CAN",
- "EM",
- "SUB",
- "ESC",
- "IS4",
- "IS3",
- "IS2",
- "IS1",
- "space",
- "exclamation-mark",
- "quotation-mark",
- "number-sign",
- "dollar-sign",
- "percent-sign",
- "ampersand",
- "apostrophe",
- "left-parenthesis",
- "right-parenthesis",
- "asterisk",
- "plus-sign",
- "comma",
- "hyphen",
- "period",
- "slash",
- "zero",
- "one",
- "two",
- "three",
- "four",
- "five",
- "six",
- "seven",
- "eight",
- "nine",
- "colon",
- "semicolon",
- "less-than-sign",
- "equals-sign",
- "greater-than-sign",
- "question-mark",
- "commercial-at",
- "A",
- "B",
- "C",
- "D",
- "E",
- "F",
- "G",
- "H",
- "I",
- "J",
- "K",
- "L",
- "M",
- "N",
- "O",
- "P",
- "Q",
- "R",
- "S",
- "T",
- "U",
- "V",
- "W",
- "X",
- "Y",
- "Z",
- "left-square-bracket",
- "backslash",
- "right-square-bracket",
- "circumflex",
- "underscore",
- "grave-accent",
- "a",
- "b",
- "c",
- "d",
- "e",
- "f",
- "g",
- "h",
- "i",
- "j",
- "k",
- "l",
- "m",
- "n",
- "o",
- "p",
- "q",
- "r",
- "s",
- "t",
- "u",
- "v",
- "w",
- "x",
- "y",
- "z",
- "left-curly-bracket",
- "vertical-line",
- "right-curly-bracket",
- "tilde",
- "DEL",
- ""
- };
-
- // same as boost
- static const char* __digraphs[] =
- {
- "ae",
- "Ae",
- "AE",
- "ch",
- "Ch",
- "CH",
- "ll",
- "Ll",
- "LL",
- "ss",
- "Ss",
- "SS",
- "nj",
- "Nj",
- "NJ",
- "dz",
- "Dz",
- "DZ",
- "lj",
- "Lj",
- "LJ",
- ""
- };
-
- std::string __s(__last - __first, '?');
- __fctyp.narrow(__first, __last, '?', &*__s.begin());
-
- for (unsigned int __i = 0; *__collatenames[__i]; __i++)
- if (__s == __collatenames[__i])
- return string_type(1, __fctyp.widen((char)__i));
-
- for (unsigned int __i = 0; *__digraphs[__i]; __i++)
- {
- const char* __now = __digraphs[__i];
- if (__s == __now)
- {
- string_type ret(__s.size(), __fctyp.widen('?'));
- __fctyp.widen(__now, __now + 2/* ouch */, &*ret.begin());
- return ret;
- }
- }
- return string_type();
- }
-
- template<typename _Ch_type>
- template<typename _Fwd_iter>
- typename regex_traits<_Ch_type>::char_class_type
- regex_traits<_Ch_type>::
- lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const
- {
- typedef std::ctype<char_type> __ctype_type;
- typedef std::ctype<char> __cctype_type;
- typedef const pair<const char*, char_class_type> _ClassnameEntry;
- const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
- const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale));
-
- static _ClassnameEntry __classnames[] =
- {
- {"d", ctype_base::digit},
- {"w", {ctype_base::alnum, _RegexMask::_S_under}},
- {"s", ctype_base::space},
- {"alnum", ctype_base::alnum},
- {"alpha", ctype_base::alpha},
- {"blank", {0, _RegexMask::_S_blank}},
- {"cntrl", ctype_base::cntrl},
- {"digit", ctype_base::digit},
- {"graph", ctype_base::graph},
- {"lower", ctype_base::lower},
- {"print", ctype_base::print},
- {"punct", ctype_base::punct},
- {"space", ctype_base::space},
- {"upper", ctype_base::upper},
- {"xdigit", ctype_base::xdigit},
- };
-
- std::string __s(__last - __first, '?');
- __fctyp.narrow(__first, __last, '?', &__s[0]);
- __cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size());
- for (_ClassnameEntry* __it = __classnames;
- __it < *(&__classnames + 1);
- ++__it)
- {
- if (__s == __it->first)
- {
- if (__icase
- && ((__it->second
- & (ctype_base::lower | ctype_base::upper)) != 0))
- return ctype_base::alpha;
- return __it->second;
- }
- }
- return 0;
- }
-
- template<typename _Ch_type>
- bool
- regex_traits<_Ch_type>::
- isctype(_Ch_type __c, char_class_type __f) const
- {
- typedef std::ctype<char_type> __ctype_type;
- const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
-
- return __fctyp.is(__f._M_base, __c)
- // [[:w:]]
- || ((__f._M_extended & _RegexMask::_S_under)
- && __c == __fctyp.widen('_'))
- // [[:blank:]]
- || ((__f._M_extended & _RegexMask::_S_blank)
- && (__c == __fctyp.widen(' ')
- || __c == __fctyp.widen('\t')));
- }
-
- template<typename _Ch_type>
- int
- regex_traits<_Ch_type>::
- value(_Ch_type __ch, int __radix) const
- {
- std::basic_istringstream<char_type> __is(string_type(1, __ch));
- int __v;
- if (__radix == 8)
- __is >> std::oct;
- else if (__radix == 16)
- __is >> std::hex;
- __is >> __v;
- return __is.fail() ? -1 : __v;
- }
-
// [7.8] Class basic_regex
/**
* Objects of specializations of this class represent regular expressions
@@ -986,7 +714,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__detail::_Executor<_BiIter, _Alloc, _CharT, _TraitsT>>
__detail::__get_executor(_BiIter,
_BiIter,
- match_results<_BiIter, _Alloc>&,
+ std::vector<sub_match<_BiIter>, _Alloc>&,
const basic_regex<_CharT, _TraitsT>&,
regex_constants::match_flag_type);
@@ -1004,6 +732,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const basic_regex<_Cp, _Rp>&,
regex_constants::match_flag_type);
+ template<typename, typename, typename, typename>
+ friend class __detail::_Executor;
+
+ template<typename, typename, typename, typename>
+ friend class __detail::_DFSExecutor;
+
+ template<typename, typename, typename, typename>
+ friend class __detail::_BFSExecutor;
+
flag_type _M_flags;
_Rx_traits _M_traits;
_AutomatonPtr _M_automaton;
@@ -1783,21 +1520,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
explicit
match_results(const _Alloc& __a = _Alloc())
- : _Base_type(__a)
+ : _Base_type(__a), _M_in_iterator(false)
{ }
/**
* @brief Copy constructs a %match_results.
*/
match_results(const match_results& __rhs)
- : _Base_type(__rhs)
+ : _Base_type(__rhs), _M_in_iterator(false)
{ }
/**
* @brief Move constructs a %match_results.
*/
match_results(match_results&& __rhs) noexcept
- : _Base_type(std::move(__rhs))
+ : _Base_type(std::move(__rhs)), _M_in_iterator(false)
{ }
/**
@@ -1905,8 +1642,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
difference_type
position(size_type __sub = 0) const
{
- return __sub < size() ? std::distance(this->prefix().first,
- (*this)[__sub].first) : -1;
+ // [28.12.1.4.5]
+ if (_M_in_iterator)
+ return __sub < size() ? std::distance(_M_begin,
+ (*this)[__sub].first) : -1;
+ else
+ return __sub < size() ? std::distance(this->prefix().first,
+ (*this)[__sub].first) : -1;
}
/**
@@ -2018,14 +1760,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @pre ready() == true
- * @todo Implement this function.
*/
template<typename _Out_iter>
_Out_iter
format(_Out_iter __out, const char_type* __fmt_first,
const char_type* __fmt_last,
- match_flag_type __flags = regex_constants::format_default) const
- { return __out; }
+ match_flag_type __flags = regex_constants::format_default) const;
/**
* @pre ready() == true
@@ -2106,19 +1846,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename, typename, typename, typename>
friend class __detail::_BFSExecutor;
- template<typename _Bp, typename _Ap, typename _Ch_type, typename _Rx_traits>
+ template<typename, typename, typename>
+ friend class regex_iterator;
+
+ template<typename _Bp, typename _Ap,
+ typename _Ch_type, typename _Rx_traits>
friend bool
regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&,
const basic_regex<_Ch_type,
_Rx_traits>&,
regex_constants::match_flag_type);
- template<typename _Bp, typename _Ap, typename _Ch_type, typename _Rx_traits>
+ template<typename _Bp, typename _Ap,
+ typename _Ch_type, typename _Rx_traits>
friend bool
regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&,
const basic_regex<_Ch_type,
_Rx_traits>&,
regex_constants::match_flag_type);
+
+ _Bi_iter _M_begin;
+ bool _M_in_iterator;
};
typedef match_results<const char*> cmatch;
@@ -2198,8 +1946,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @retval false Otherwise.
*
* @throws an exception of type regex_error.
- *
- * @todo Implement this function.
*/
template<typename _Bi_iter, typename _Alloc,
typename _Ch_type, typename _Rx_traits>
@@ -2209,26 +1955,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
match_results<_Bi_iter, _Alloc>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- {
- if (__re._M_automaton == nullptr)
- return false;
- __detail::__get_executor(__s, __e, __m, __re, __flags)->_M_match();
- if (__m.size() > 0 && __m[0].matched)
- {
- for (auto __it : __m)
- if (!__it.matched)
- __it.first = __it.second = __e;
- __m.at(__m.size()).matched = false;
- __m.at(__m.size()).first = __s;
- __m.at(__m.size()).second = __s;
- __m.at(__m.size()+1).matched = false;
- __m.at(__m.size()+1).first = __e;
- __m.at(__m.size()+1).second = __e;
- return true;
- }
- return false;
- }
+ = regex_constants::match_default);
/**
* @brief Indicates if there is a match between the regular expression @p e
@@ -2245,7 +1972,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @throws an exception of type regex_error.
*/
template<typename _Bi_iter, typename _Ch_type, typename _Rx_traits>
- bool
+ inline bool
regex_match(_Bi_iter __first, _Bi_iter __last,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
@@ -2359,45 +2086,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* undefined.
*
* @throws an exception of type regex_error.
- *
- * @todo Implement this function.
*/
template<typename _Bi_iter, typename _Alloc,
typename _Ch_type, typename _Rx_traits>
- inline bool
+ bool
regex_search(_Bi_iter __first, _Bi_iter __last,
match_results<_Bi_iter, _Alloc>& __m,
const basic_regex<_Ch_type, _Rx_traits>& __re,
regex_constants::match_flag_type __flags
- = regex_constants::match_default)
- {
- if (__re._M_automaton == nullptr)
- return false;
- auto __cur = __first;
- // Continue when __cur == __last
- do
- {
- __detail::__get_executor(__cur, __last, __m, __re, __flags)
- ->_M_search_from_first();
- if (__m.size() > 0 && __m[0].matched)
- {
- for (auto __it : __m)
- if (!__it.matched)
- __it.first = __it.second = __last;
- __m.at(__m.size()).first = __first;
- __m.at(__m.size()).second = __m[0].first;
- __m.at(__m.size()+1).first = __m[0].second;
- __m.at(__m.size()+1).second = __last;
- __m.at(__m.size()).matched =
- (__m.prefix().first != __m.prefix().second);
- __m.at(__m.size()+1).matched =
- (__m.suffix().first != __m.suffix().second);
- return true;
- }
- }
- while (__cur++ != __last);
- return false;
- }
+ = regex_constants::match_default);
/**
* Searches for a regular expression within a range.
@@ -2506,45 +2203,96 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// std [28.11.4] Function template regex_replace
/**
- * @doctodo
- * @param __out
- * @param __first
- * @param __last
- * @param __e
- * @param __fmt
- * @param __flags
+ * @brief Search for a regular expression within a range for multiple times,
+ and replace the matched parts through filling a format string.
+ * @param __out [OUT] The output iterator.
+ * @param __first [IN] The start of the string to search.
+ * @param __last [IN] One-past-the-end of the string to search.
+ * @param __e [IN] The regular expression to search for.
+ * @param __fmt [IN] The format string.
+ * @param __flags [IN] Search and replace policy flags.
*
- * @returns out
+ * @returns __out
* @throws an exception of type regex_error.
- *
- * @todo Implement this function.
*/
template<typename _Out_iter, typename _Bi_iter,
- typename _Rx_traits, typename _Ch_type>
+ typename _Rx_traits, typename _Ch_type,
+ typename _St, typename _Sa>
inline _Out_iter
regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
const basic_regex<_Ch_type, _Rx_traits>& __e,
- const basic_string<_Ch_type>& __fmt,
+ const basic_string<_Ch_type, _St, _Sa>& __fmt,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
- { return __out; }
+ {
+ return regex_replace(__out, __first, __last, __e, __fmt.c_str(), __flags);
+ }
/**
- * @doctodo
- * @param __s
- * @param __e
- * @param __fmt
- * @param __flags
+ * @brief Search for a regular expression within a range for multiple times,
+ and replace the matched parts through filling a format C-string.
+ * @param __out [OUT] The output iterator.
+ * @param __first [IN] The start of the string to search.
+ * @param __last [IN] One-past-the-end of the string to search.
+ * @param __e [IN] The regular expression to search for.
+ * @param __fmt [IN] The format C-string.
+ * @param __flags [IN] Search and replace policy flags.
*
- * @returns a copy of string @p s with replacements.
+ * @returns __out
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Out_iter, typename _Bi_iter,
+ typename _Rx_traits, typename _Ch_type>
+ _Out_iter
+ regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const _Ch_type* __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default);
+
+ /**
+ * @brief Search for a regular expression within a string for multiple times,
+ and replace the matched parts through filling a format string.
+ * @param __s [IN] The string to search and replace.
+ * @param __e [IN] The regular expression to search for.
+ * @param __fmt [IN] The format string.
+ * @param __flags [IN] Search and replace policy flags.
*
+ * @returns The string after replacing.
* @throws an exception of type regex_error.
*/
- template<typename _Rx_traits, typename _Ch_type>
+ template<typename _Rx_traits, typename _Ch_type,
+ typename _St, typename _Sa, typename _Fst, typename _Fsa>
+ inline basic_string<_Ch_type>
+ regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type, _Fst, _Fsa>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ basic_string<_Ch_type> __result;
+ regex_replace(std::back_inserter(__result),
+ __s.begin(), __s.end(), __e, __fmt, __flags);
+ return __result;
+ }
+
+ /**
+ * @brief Search for a regular expression within a string for multiple times,
+ and replace the matched parts through filling a format C-string.
+ * @param __s [IN] The string to search and replace.
+ * @param __e [IN] The regular expression to search for.
+ * @param __fmt [IN] The format C-string.
+ * @param __flags [IN] Search and replace policy flags.
+ *
+ * @returns The string after replacing.
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Rx_traits, typename _Ch_type,
+ typename _St, typename _Sa>
inline basic_string<_Ch_type>
- regex_replace(const basic_string<_Ch_type>& __s,
+ regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s,
const basic_regex<_Ch_type, _Rx_traits>& __e,
- const basic_string<_Ch_type>& __fmt,
+ const _Ch_type* __fmt,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{
@@ -2554,6 +2302,59 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __result;
}
+ /**
+ * @brief Search for a regular expression within a C-string for multiple
+ times, and replace the matched parts through filling a format string.
+ * @param __s [IN] The C-string to search and replace.
+ * @param __e [IN] The regular expression to search for.
+ * @param __fmt [IN] The format string.
+ * @param __flags [IN] Search and replace policy flags.
+ *
+ * @returns The string after replacing.
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Rx_traits, typename _Ch_type,
+ typename _St, typename _Sa>
+ inline basic_string<_Ch_type>
+ regex_replace(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const basic_string<_Ch_type, _St, _Sa>& __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ basic_string<_Ch_type> __result;
+ regex_replace(std::back_inserter(__result), __s,
+ __s + char_traits<_Ch_type>::length(__s),
+ __e, __fmt, __flags);
+ return __result;
+ }
+
+ /**
+ * @brief Search for a regular expression within a C-string for multiple
+ times, and replace the matched parts through filling a format C-string.
+ * @param __s [IN] The C-string to search and replace.
+ * @param __e [IN] The regular expression to search for.
+ * @param __fmt [IN] The format C-string.
+ * @param __flags [IN] Search and replace policy flags.
+ *
+ * @returns The string after replacing.
+ * @throws an exception of type regex_error.
+ */
+ template<typename _Rx_traits, typename _Ch_type>
+ inline basic_string<_Ch_type>
+ regex_replace(const _Ch_type* __s,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const _Ch_type* __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ basic_string<_Ch_type> __result;
+ regex_replace(std::back_inserter(__result), __s,
+ __s + char_traits<_Ch_type>::length(__s),
+ __e, __fmt, __flags);
+ return __result;
+ }
+
//@}
// std [28.12] Class template regex_iterator
@@ -2661,59 +2462,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
match_results<_Bi_iter> _M_match;
};
- template<typename _Bi_iter,
- typename _Ch_type,
- typename _Rx_traits>
- bool
- regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
- operator==(const regex_iterator& __rhs) const
- {
- return (_M_match.empty() && __rhs._M_match.empty())
- || (_M_begin == __rhs._M_begin
- && _M_end == __rhs._M_end
- && _M_pregex == __rhs._M_pregex
- && _M_flags == __rhs._M_flags
- && _M_match[0] == __rhs._M_match[0]);
- }
-
- template<typename _Bi_iter,
- typename _Ch_type,
- typename _Rx_traits>
- regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
- regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
- operator++()
- {
- // FIXME: In all cases in which the call to regex_search returns true,
- // match.prefix().first shall be equal to the previous value of
- // match[0].second, and for each index i in the half-open range
- // [0, match.size()) for which match[i].matched is true,
- // match[i].position() shall return distance(begin, match[i].first).
- // [28.12.1.4.5]
- if (_M_match[0].matched)
- {
- auto __start = _M_match[0].second;
- if (_M_match[0].first == _M_match[0].second)
- if (__start == _M_end)
- {
- _M_match = value_type();
- return *this;
- }
- else
- {
- if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags
- | regex_constants::match_not_null
- | regex_constants::match_continuous))
- return *this;
- else
- ++__start;
- }
- _M_flags |= regex_constants::match_prev_avail;
- if (!regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags))
- _M_match = value_type();
- }
- return *this;
- }
-
typedef regex_iterator<const char*> cregex_iterator;
typedef regex_iterator<string::const_iterator> sregex_iterator;
#ifdef _GLIBCXX_USE_WCHAR_T
@@ -2924,104 +2672,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool _M_has_m1;
};
- template<typename _Bi_iter,
- typename _Ch_type,
- typename _Rx_traits>
- regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
- regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
- operator=(const regex_token_iterator& __rhs)
- {
- _M_position = __rhs._M_position;
- _M_subs = __rhs._M_subs;
- _M_n = __rhs._M_n;
- _M_result = __rhs._M_result;
- _M_suffix = __rhs._M_suffix;
- _M_has_m1 = __rhs._M_has_m1;
- if (__rhs._M_result == &__rhs._M_suffix)
- _M_result = &_M_suffix;
- }
-
- template<typename _Bi_iter,
- typename _Ch_type,
- typename _Rx_traits>
- bool
- regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
- operator==(const regex_token_iterator& __rhs) const
- {
- if (_M_end_of_seq() && __rhs._M_end_of_seq())
- return true;
- if (_M_suffix.matched && __rhs._M_suffix.matched
- && _M_suffix == __rhs._M_suffix)
- return true;
- if (_M_end_of_seq() || _M_suffix.matched
- || __rhs._M_end_of_seq() || __rhs._M_suffix.matched)
- return false;
- return _M_position == __rhs._M_position
- && _M_n == __rhs._M_n
- && _M_subs == __rhs._M_subs;
- }
-
- template<typename _Bi_iter,
- typename _Ch_type,
- typename _Rx_traits>
- regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
- regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
- operator++()
- {
- _Position __prev = _M_position;
- if (_M_suffix.matched)
- *this = regex_token_iterator();
- else if (_M_n + 1 < _M_subs.size())
- {
- _M_n++;
- _M_result = &_M_current_match();
- }
- else
- {
- _M_n = 0;
- ++_M_position;
- if (_M_position != _Position())
- _M_result = &_M_current_match();
- else if (_M_has_m1 && __prev->suffix().length() != 0)
- {
- _M_suffix.matched = true;
- _M_suffix.first = __prev->suffix().first;
- _M_suffix.second = __prev->suffix().second;
- _M_result = &_M_suffix;
- }
- else
- *this = regex_token_iterator();
- }
- return *this;
- }
-
- template<typename _Bi_iter,
- typename _Ch_type,
- typename _Rx_traits>
- void
- regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
- _M_init(_Bi_iter __a, _Bi_iter __b)
- {
- _M_has_m1 = false;
- for (auto __it : _M_subs)
- if (__it == -1)
- {
- _M_has_m1 = true;
- break;
- }
- if (_M_position != _Position())
- _M_result = &_M_current_match();
- else if (_M_has_m1)
- {
- _M_suffix.matched = true;
- _M_suffix.first = __a;
- _M_suffix.second = __b;
- _M_result = &_M_suffix;
- }
- else
- _M_result = nullptr;
- }
-
/** @brief Token iterator for C-style NULL-terminated strings. */
typedef regex_token_iterator<const char*> cregex_token_iterator;
@@ -3040,3 +2690,4 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
+#include <bits/regex.tcc>
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
new file mode 100644
index 00000000000..24316d26616
--- /dev/null
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -0,0 +1,677 @@
+// class template regex -*- C++ -*-
+
+// Copyright (C) 2013 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/>.
+
+/**
+ * @file bits/regex.tcc
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{regex}
+ */
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ template<typename _Ch_type>
+ template<typename _Fwd_iter>
+ typename regex_traits<_Ch_type>::string_type
+ regex_traits<_Ch_type>::
+ lookup_collatename(_Fwd_iter __first, _Fwd_iter __last) const
+ {
+ typedef std::ctype<char_type> __ctype_type;
+ const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
+
+ static const char* __collatenames[] =
+ {
+ "NUL",
+ "SOH",
+ "STX",
+ "ETX",
+ "EOT",
+ "ENQ",
+ "ACK",
+ "alert",
+ "backspace",
+ "tab",
+ "newline",
+ "vertical-tab",
+ "form-feed",
+ "carriage-return",
+ "SO",
+ "SI",
+ "DLE",
+ "DC1",
+ "DC2",
+ "DC3",
+ "DC4",
+ "NAK",
+ "SYN",
+ "ETB",
+ "CAN",
+ "EM",
+ "SUB",
+ "ESC",
+ "IS4",
+ "IS3",
+ "IS2",
+ "IS1",
+ "space",
+ "exclamation-mark",
+ "quotation-mark",
+ "number-sign",
+ "dollar-sign",
+ "percent-sign",
+ "ampersand",
+ "apostrophe",
+ "left-parenthesis",
+ "right-parenthesis",
+ "asterisk",
+ "plus-sign",
+ "comma",
+ "hyphen",
+ "period",
+ "slash",
+ "zero",
+ "one",
+ "two",
+ "three",
+ "four",
+ "five",
+ "six",
+ "seven",
+ "eight",
+ "nine",
+ "colon",
+ "semicolon",
+ "less-than-sign",
+ "equals-sign",
+ "greater-than-sign",
+ "question-mark",
+ "commercial-at",
+ "A",
+ "B",
+ "C",
+ "D",
+ "E",
+ "F",
+ "G",
+ "H",
+ "I",
+ "J",
+ "K",
+ "L",
+ "M",
+ "N",
+ "O",
+ "P",
+ "Q",
+ "R",
+ "S",
+ "T",
+ "U",
+ "V",
+ "W",
+ "X",
+ "Y",
+ "Z",
+ "left-square-bracket",
+ "backslash",
+ "right-square-bracket",
+ "circumflex",
+ "underscore",
+ "grave-accent",
+ "a",
+ "b",
+ "c",
+ "d",
+ "e",
+ "f",
+ "g",
+ "h",
+ "i",
+ "j",
+ "k",
+ "l",
+ "m",
+ "n",
+ "o",
+ "p",
+ "q",
+ "r",
+ "s",
+ "t",
+ "u",
+ "v",
+ "w",
+ "x",
+ "y",
+ "z",
+ "left-curly-bracket",
+ "vertical-line",
+ "right-curly-bracket",
+ "tilde",
+ "DEL",
+ ""
+ };
+
+ // same as boost
+ //static const char* __digraphs[] =
+ // {
+ // "ae",
+ // "Ae",
+ // "AE",
+ // "ch",
+ // "Ch",
+ // "CH",
+ // "ll",
+ // "Ll",
+ // "LL",
+ // "ss",
+ // "Ss",
+ // "SS",
+ // "nj",
+ // "Nj",
+ // "NJ",
+ // "dz",
+ // "Dz",
+ // "DZ",
+ // "lj",
+ // "Lj",
+ // "LJ",
+ // ""
+ // };
+
+ std::string __s(__last - __first, '?');
+ __fctyp.narrow(__first, __last, '?', &*__s.begin());
+
+ for (unsigned int __i = 0; *__collatenames[__i]; __i++)
+ if (__s == __collatenames[__i])
+ return string_type(1, __fctyp.widen(static_cast<char>(__i)));
+
+ //for (unsigned int __i = 0; *__digraphs[__i]; __i++)
+ // {
+ // const char* __now = __digraphs[__i];
+ // if (__s == __now)
+ // {
+ // string_type ret(__s.size(), __fctyp.widen('?'));
+ // __fctyp.widen(__now, __now + 2/* ouch */, &*ret.begin());
+ // return ret;
+ // }
+ // }
+ return string_type();
+ }
+
+ template<typename _Ch_type>
+ template<typename _Fwd_iter>
+ typename regex_traits<_Ch_type>::char_class_type
+ regex_traits<_Ch_type>::
+ lookup_classname(_Fwd_iter __first, _Fwd_iter __last, bool __icase) const
+ {
+ typedef std::ctype<char_type> __ctype_type;
+ typedef std::ctype<char> __cctype_type;
+ typedef const pair<const char*, char_class_type> _ClassnameEntry;
+ const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
+ const __cctype_type& __cctyp(use_facet<__cctype_type>(_M_locale));
+
+ static _ClassnameEntry __classnames[] =
+ {
+ {"d", ctype_base::digit},
+ {"w", {ctype_base::alnum, _RegexMask::_S_under}},
+ {"s", ctype_base::space},
+ {"alnum", ctype_base::alnum},
+ {"alpha", ctype_base::alpha},
+ {"blank", {0, _RegexMask::_S_blank}},
+ {"cntrl", ctype_base::cntrl},
+ {"digit", ctype_base::digit},
+ {"graph", ctype_base::graph},
+ {"lower", ctype_base::lower},
+ {"print", ctype_base::print},
+ {"punct", ctype_base::punct},
+ {"space", ctype_base::space},
+ {"upper", ctype_base::upper},
+ {"xdigit", ctype_base::xdigit},
+ };
+
+ std::string __s(__last - __first, '?');
+ __fctyp.narrow(__first, __last, '?', &__s[0]);
+ __cctyp.tolower(&*__s.begin(), &*__s.begin() + __s.size());
+ for (_ClassnameEntry* __it = __classnames;
+ __it < *(&__classnames + 1);
+ ++__it)
+ {
+ if (__s == __it->first)
+ {
+ if (__icase
+ && ((__it->second
+ & (ctype_base::lower | ctype_base::upper)) != 0))
+ return ctype_base::alpha;
+ return __it->second;
+ }
+ }
+ return 0;
+ }
+
+ template<typename _Ch_type>
+ bool
+ regex_traits<_Ch_type>::
+ isctype(_Ch_type __c, char_class_type __f) const
+ {
+ typedef std::ctype<char_type> __ctype_type;
+ const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale));
+
+ return __fctyp.is(__f._M_base, __c)
+ // [[:w:]]
+ || ((__f._M_extended & _RegexMask::_S_under)
+ && __c == __fctyp.widen('_'))
+ // [[:blank:]]
+ || ((__f._M_extended & _RegexMask::_S_blank)
+ && (__c == __fctyp.widen(' ')
+ || __c == __fctyp.widen('\t')));
+ }
+
+ template<typename _Ch_type>
+ int
+ regex_traits<_Ch_type>::
+ value(_Ch_type __ch, int __radix) const
+ {
+ std::basic_istringstream<char_type> __is(string_type(1, __ch));
+ int __v;
+ if (__radix == 8)
+ __is >> std::oct;
+ else if (__radix == 16)
+ __is >> std::hex;
+ __is >> __v;
+ return __is.fail() ? -1 : __v;
+ }
+
+ template<typename _Bi_iter, typename _Alloc>
+ template<typename _Out_iter>
+ _Out_iter match_results<_Bi_iter, _Alloc>::
+ format(_Out_iter __out,
+ const match_results<_Bi_iter, _Alloc>::char_type* __fmt_first,
+ const match_results<_Bi_iter, _Alloc>::char_type* __fmt_last,
+ match_flag_type __flags) const
+ {
+ _GLIBCXX_DEBUG_ASSERT( ready() );
+ regex_traits<char_type> __traits;
+ typedef std::ctype<char_type> __ctype_type;
+ const __ctype_type&
+ __fctyp(use_facet<__ctype_type>(__traits.getloc()));
+
+ auto __output = [&](int __idx)
+ {
+ auto& __sub = _Base_type::operator[](__idx);
+ if (__sub.matched)
+ std::copy(__sub.first, __sub.second, __out);
+ };
+
+ if (__flags & regex_constants::format_sed)
+ {
+ for (; __fmt_first != __fmt_last;)
+ if (*__fmt_first == '&')
+ {
+ __output(0);
+ ++__fmt_first;
+ }
+ else if (*__fmt_first == '\\')
+ {
+ if (++__fmt_first != __fmt_last
+ && __fctyp.is(__ctype_type::digit, *__fmt_first))
+ __output(__traits.value(*__fmt_first++, 10));
+ else
+ *__out++ = '\\';
+ }
+ else
+ *__out++ = *__fmt_first++;
+ }
+ else
+ {
+ while (1)
+ {
+ auto __next = std::find(__fmt_first, __fmt_last, '$');
+ if (__next == __fmt_last)
+ break;
+
+ std::copy(__fmt_first, __next, __out);
+
+ auto __eat = [&](char __ch) -> bool
+ {
+ if (*__next == __ch)
+ {
+ ++__next;
+ return true;
+ }
+ return false;
+ };
+
+ if (++__next == __fmt_last)
+ *__out++ = '$';
+ else if (__eat('$'))
+ *__out++ = '$';
+ else if (__eat('&'))
+ __output(0);
+ else if (__eat('`'))
+ __output(_Base_type::size()-2);
+ else if (__eat('\''))
+ __output(_Base_type::size()-1);
+ else if (__fctyp.is(__ctype_type::digit, *__next))
+ {
+ int __num = __traits.value(*__next, 10);
+ if (++__next != __fmt_last
+ && __fctyp.is(__ctype_type::digit, *__next))
+ {
+ __num *= 10;
+ __num += __traits.value(*__next++, 10);
+ }
+ if (0 <= __num && __num < this->size())
+ __output(__num);
+ }
+ else
+ *__out++ = '$';
+ __fmt_first = __next;
+ }
+ std::copy(__fmt_first, __fmt_last, __out);
+ }
+ return __out;
+ }
+
+ template<typename _Bi_iter, typename _Alloc,
+ typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_match(_Bi_iter __s,
+ _Bi_iter __e,
+ match_results<_Bi_iter, _Alloc>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ if (__re._M_automaton == nullptr)
+ return false;
+
+ typename match_results<_Bi_iter, _Alloc>::_Base_type& __res = __m;
+ auto __size = __re._M_automaton->_M_sub_count();
+ __size += 2;
+ __res.resize(__size);
+ for (decltype(__size) __i = 0; __i < __size; ++__i)
+ __res[__i].matched = false;
+
+ if (__detail::__get_executor(__s, __e, __res, __re, __flags)->_M_match())
+ {
+ for (auto __it : __res)
+ if (!__it.matched)
+ __it.first = __it.second = __e;
+ auto& __pre = __res[__res.size()-2];
+ auto& __suf = __res[__res.size()-1];
+ __pre.matched = false;
+ __pre.first = __s;
+ __pre.second = __s;
+ __suf.matched = false;
+ __suf.first = __e;
+ __suf.second = __e;
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _Bi_iter, typename _Alloc,
+ typename _Ch_type, typename _Rx_traits>
+ bool
+ regex_search(_Bi_iter __first, _Bi_iter __last,
+ match_results<_Bi_iter, _Alloc>& __m,
+ const basic_regex<_Ch_type, _Rx_traits>& __re,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ if (__re._M_automaton == nullptr)
+ return false;
+
+ typename match_results<_Bi_iter, _Alloc>::_Base_type& __res = __m;
+ auto __size = __re._M_automaton->_M_sub_count();
+ __size += 2;
+ __res.resize(__size);
+ for (decltype(__size) __i = 0; __i < __size; ++__i)
+ __res[__i].matched = false;
+
+ if (__detail::__get_executor(__first, __last, __res, __re, __flags)
+ ->_M_search())
+ {
+ for (auto __it : __res)
+ if (!__it.matched)
+ __it.first = __it.second = __last;
+ auto& __pre = __res[__res.size()-2];
+ auto& __suf = __res[__res.size()-1];
+ __pre.first = __first;
+ __pre.second = __res[0].first;
+ __pre.matched = (__pre.first != __pre.second);
+ __suf.first = __res[0].second;
+ __suf.second = __last;
+ __suf.matched = (__suf.first != __suf.second);
+ return true;
+ }
+ return false;
+ }
+
+ template<typename _Out_iter, typename _Bi_iter,
+ typename _Rx_traits, typename _Ch_type>
+ _Out_iter
+ regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
+ const basic_regex<_Ch_type, _Rx_traits>& __e,
+ const _Ch_type* __fmt,
+ regex_constants::match_flag_type __flags
+ = regex_constants::match_default)
+ {
+ typedef regex_iterator<_Bi_iter, _Ch_type, _Rx_traits> _IterT;
+ _IterT __i(__first, __last, __e, __flags);
+ _IterT __end;
+ if (__i == __end)
+ {
+ if (!(__flags & regex_constants::format_no_copy))
+ std::copy(__first, __last, __out);
+ }
+ else
+ {
+ sub_match<_Bi_iter> __last;
+ auto __len = char_traits<_Ch_type>::length(__fmt);
+ for (; __i != __end; ++__i)
+ {
+ if (!(__flags & regex_constants::format_no_copy))
+ std::copy(__i->prefix().first, __i->prefix().second, __out);
+ __out = __i->format(__out, __fmt, __fmt + __len, __flags);
+ __last = __i->suffix();
+ if (__flags & regex_constants::format_first_only)
+ break;
+ }
+ if (!(__flags & regex_constants::format_no_copy))
+ std::copy(__last.first, __last.second, __out);
+ }
+ return __out;
+ }
+
+ template<typename _Bi_iter,
+ typename _Ch_type,
+ typename _Rx_traits>
+ bool
+ regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
+ operator==(const regex_iterator& __rhs) const
+ {
+ return (_M_match.empty() && __rhs._M_match.empty())
+ || (_M_begin == __rhs._M_begin
+ && _M_end == __rhs._M_end
+ && _M_pregex == __rhs._M_pregex
+ && _M_flags == __rhs._M_flags
+ && _M_match[0] == __rhs._M_match[0]);
+ }
+
+ template<typename _Bi_iter,
+ typename _Ch_type,
+ typename _Rx_traits>
+ regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
+ regex_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
+ operator++()
+ {
+ // In all cases in which the call to regex_search returns true,
+ // match.prefix().first shall be equal to the previous value of
+ // match[0].second, and for each index i in the half-open range
+ // [0, match.size()) for which match[i].matched is true,
+ // match[i].position() shall return distance(begin, match[i].first).
+ // [28.12.1.4.5]
+ if (_M_match[0].matched)
+ {
+ auto __start = _M_match[0].second;
+ auto __prefix_first = _M_match[0].second;
+ if (_M_match[0].first == _M_match[0].second)
+ if (__start == _M_end)
+ {
+ _M_match = value_type();
+ return *this;
+ }
+ else
+ {
+ if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags
+ | regex_constants::match_not_null
+ | regex_constants::match_continuous))
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched);
+ _M_match.at(_M_match.size()).first = __prefix_first;
+ _M_match._M_in_iterator = true;
+ _M_match._M_begin = _M_begin;
+ return *this;
+ }
+ else
+ ++__start;
+ }
+ _M_flags |= regex_constants::match_prev_avail;
+ if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags))
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched);
+ _M_match.at(_M_match.size()).first = __prefix_first;
+ _M_match._M_in_iterator = true;
+ _M_match._M_begin = _M_begin;
+ }
+ else
+ _M_match = value_type();
+ }
+ return *this;
+ }
+
+ template<typename _Bi_iter,
+ typename _Ch_type,
+ typename _Rx_traits>
+ regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
+ regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
+ operator=(const regex_token_iterator& __rhs)
+ {
+ _M_position = __rhs._M_position;
+ _M_subs = __rhs._M_subs;
+ _M_n = __rhs._M_n;
+ _M_result = __rhs._M_result;
+ _M_suffix = __rhs._M_suffix;
+ _M_has_m1 = __rhs._M_has_m1;
+ if (__rhs._M_result == &__rhs._M_suffix)
+ _M_result = &_M_suffix;
+ }
+
+ template<typename _Bi_iter,
+ typename _Ch_type,
+ typename _Rx_traits>
+ bool
+ regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
+ operator==(const regex_token_iterator& __rhs) const
+ {
+ if (_M_end_of_seq() && __rhs._M_end_of_seq())
+ return true;
+ if (_M_suffix.matched && __rhs._M_suffix.matched
+ && _M_suffix == __rhs._M_suffix)
+ return true;
+ if (_M_end_of_seq() || _M_suffix.matched
+ || __rhs._M_end_of_seq() || __rhs._M_suffix.matched)
+ return false;
+ return _M_position == __rhs._M_position
+ && _M_n == __rhs._M_n
+ && _M_subs == __rhs._M_subs;
+ }
+
+ template<typename _Bi_iter,
+ typename _Ch_type,
+ typename _Rx_traits>
+ regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>&
+ regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
+ operator++()
+ {
+ _Position __prev = _M_position;
+ if (_M_suffix.matched)
+ *this = regex_token_iterator();
+ else if (_M_n + 1 < _M_subs.size())
+ {
+ _M_n++;
+ _M_result = &_M_current_match();
+ }
+ else
+ {
+ _M_n = 0;
+ ++_M_position;
+ if (_M_position != _Position())
+ _M_result = &_M_current_match();
+ else if (_M_has_m1 && __prev->suffix().length() != 0)
+ {
+ _M_suffix.matched = true;
+ _M_suffix.first = __prev->suffix().first;
+ _M_suffix.second = __prev->suffix().second;
+ _M_result = &_M_suffix;
+ }
+ else
+ *this = regex_token_iterator();
+ }
+ return *this;
+ }
+
+ template<typename _Bi_iter,
+ typename _Ch_type,
+ typename _Rx_traits>
+ void
+ regex_token_iterator<_Bi_iter, _Ch_type, _Rx_traits>::
+ _M_init(_Bi_iter __a, _Bi_iter __b)
+ {
+ _M_has_m1 = false;
+ for (auto __it : _M_subs)
+ if (__it == -1)
+ {
+ _M_has_m1 = true;
+ break;
+ }
+ if (_M_position != _Position())
+ _M_result = &_M_current_match();
+ else if (_M_has_m1)
+ {
+ _M_suffix.matched = true;
+ _M_suffix.first = __a;
+ _M_suffix.second = __b;
+ _M_result = &_M_suffix;
+ }
+ else
+ _M_result = nullptr;
+ }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
+
diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h
index 77551756f65..94a14ce96aa 100644
--- a/libstdc++-v3/include/bits/regex_automaton.h
+++ b/libstdc++-v3/include/bits/regex_automaton.h
@@ -51,14 +51,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// that represents the regular expression.
enum _Opcode
{
- _S_opcode_unknown = 0,
- _S_opcode_alternative = 1,
- _S_opcode_backref = 2,
- _S_opcode_subexpr_begin = 4,
- _S_opcode_subexpr_end = 5,
- _S_opcode_dummy = 6,
- _S_opcode_match = 100,
- _S_opcode_accept = 255
+ _S_opcode_unknown,
+ _S_opcode_alternative,
+ _S_opcode_backref,
+ _S_opcode_line_begin_assertion,
+ _S_opcode_line_end_assertion,
+ _S_opcode_word_boundry,
+ _S_opcode_subexpr_lookahead,
+ _S_opcode_subexpr_begin,
+ _S_opcode_subexpr_end,
+ _S_opcode_dummy,
+ _S_opcode_match,
+ _S_opcode_accept,
};
template<typename _CharT, typename _TraitsT>
@@ -72,35 +76,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateIdT _M_next; // outgoing transition
union // Since they are mutually exclusive.
{
- _StateIdT _M_alt; // for _S_opcode_alternative
unsigned int _M_subexpr; // for _S_opcode_subexpr_*
unsigned int _M_backref_index; // for _S_opcode_backref
+ struct
+ {
+ // for _S_opcode_alternative.
+ _StateIdT _M_quant_index;
+ // for _S_opcode_alternative or _S_opcode_subexpr_lookahead
+ _StateIdT _M_alt;
+ // for _S_opcode_word_boundry or _S_opcode_subexpr_lookahead or
+ // quantifiers(ungreedy if set true)
+ bool _M_neg;
+ };
};
- _MatcherT _M_matches; // for _S_opcode_match
+ _MatcherT _M_matches; // for _S_opcode_match
explicit _State(_OpcodeT __opcode)
: _M_opcode(__opcode), _M_next(_S_invalid_state_id)
{ }
- _State(const _MatcherT& __m)
- : _M_opcode(_S_opcode_match), _M_next(_S_invalid_state_id),
- _M_matches(__m)
- { }
-
- _State(_OpcodeT __opcode, unsigned __index)
- : _M_opcode(__opcode), _M_next(_S_invalid_state_id)
- {
- if (__opcode == _S_opcode_subexpr_begin
- || __opcode == _S_opcode_subexpr_end)
- _M_subexpr = __index;
- else if (__opcode == _S_opcode_backref)
- _M_backref_index = __index;
- }
-
- _State(_StateIdT __next, _StateIdT __alt)
- : _M_opcode(_S_opcode_alternative), _M_next(__next), _M_alt(__alt)
- { }
-
#ifdef _GLIBCXX_DEBUG
std::ostream&
_M_print(std::ostream& ostr) const;
@@ -141,7 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_NFA(_FlagT __f)
: _M_flags(__f), _M_start_state(0), _M_subexpr_count(0),
- _M_has_backref(false)
+ _M_has_backref(false), _M_quant_count(0)
{ }
_FlagT
@@ -163,23 +157,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateIdT
_M_insert_accept()
{
- this->push_back(_StateT(_S_opcode_accept));
- _M_accepting_states.insert(this->size()-1);
- return this->size()-1;
+ auto __ret = _M_insert_state(_StateT(_S_opcode_accept));
+ _M_accepting_states.insert(__ret);
+ return __ret;
}
_StateIdT
- _M_insert_alt(_StateIdT __next, _StateIdT __alt)
+ _M_insert_alt(_StateIdT __next, _StateIdT __alt, bool __neg)
{
- this->push_back(_StateT(__next, __alt));
- return this->size()-1;
+ _StateT __tmp(_S_opcode_alternative);
+ // It labels every quantifier to make greedy comparison easier in BFS
+ // approach.
+ __tmp._M_quant_index = _M_quant_count++;
+ __tmp._M_next = __next;
+ __tmp._M_alt = __alt;
+ __tmp._M_neg = __neg;
+ return _M_insert_state(__tmp);
}
_StateIdT
_M_insert_matcher(_MatcherT __m)
{
- this->push_back(_StateT(__m));
- return this->size()-1;
+ _StateT __tmp(_S_opcode_match);
+ __tmp._M_matches = __m;
+ return _M_insert_state(__tmp);
}
_StateIdT
@@ -187,29 +188,53 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
auto __id = _M_subexpr_count++;
_M_paren_stack.push_back(__id);
- this->push_back(_StateT(_S_opcode_subexpr_begin, __id));
- return this->size()-1;
+ _StateT __tmp(_S_opcode_subexpr_begin);
+ __tmp._M_subexpr = __id;
+ return _M_insert_state(__tmp);
}
_StateIdT
_M_insert_subexpr_end()
{
- this->push_back(_StateT(_S_opcode_subexpr_end, _M_paren_stack.back()));
+ _StateT __tmp(_S_opcode_subexpr_end);
+ __tmp._M_subexpr = _M_paren_stack.back();
_M_paren_stack.pop_back();
- return this->size()-1;
+ return _M_insert_state(__tmp);
}
_StateIdT
_M_insert_backref(unsigned int __index);
_StateIdT
- _M_insert_dummy()
+ _M_insert_line_begin()
+ { return _M_insert_state(_StateT(_S_opcode_line_begin_assertion)); }
+
+ _StateIdT
+ _M_insert_line_end()
+ { return _M_insert_state(_StateT(_S_opcode_line_end_assertion)); }
+
+ _StateIdT
+ _M_insert_word_bound(bool __neg)
{
- this->push_back(_StateT(_S_opcode_dummy));
- return this->size()-1;
+ _StateT __tmp(_S_opcode_word_boundry);
+ __tmp._M_neg = __neg;
+ return _M_insert_state(__tmp);
}
_StateIdT
+ _M_insert_lookahead(_StateIdT __alt, bool __neg)
+ {
+ _StateT __tmp(_S_opcode_subexpr_lookahead);
+ __tmp._M_alt = __alt;
+ __tmp._M_neg = __neg;
+ return _M_insert_state(__tmp);
+ }
+
+ _StateIdT
+ _M_insert_dummy()
+ { return _M_insert_state(_StateT(_S_opcode_dummy)); }
+
+ _StateIdT
_M_insert_state(_StateT __s)
{
this->push_back(__s);
@@ -230,6 +255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_FlagT _M_flags;
_StateIdT _M_start_state;
_SizeT _M_subexpr_count;
+ _SizeT _M_quant_count;
bool _M_has_backref;
};
diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc
index 2d34b95cdba..13af984c273 100644
--- a/libstdc++-v3/include/bits/regex_automaton.tcc
+++ b/libstdc++-v3/include/bits/regex_automaton.tcc
@@ -80,6 +80,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
<< __id << " -> " << _M_alt
<< " [label=\"epsilon\", tailport=\"n\"];\n";
break;
+ case _S_opcode_backref:
+ __ostr << __id << " [label=\"" << __id << "\\nBACKREF "
+ << _M_subexpr << "\"];\n"
+ << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
+ break;
+ case _S_opcode_line_begin_assertion:
+ __ostr << __id << " [label=\"" << __id << "\\nLINE_BEGIN \"];\n"
+ << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+ break;
+ case _S_opcode_line_end_assertion:
+ __ostr << __id << " [label=\"" << __id << "\\nLINE_END \"];\n"
+ << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+ break;
+ case _S_opcode_word_boundry:
+ __ostr << __id << " [label=\"" << __id << "\\nWORD_BOUNDRY "
+ << _M_neg << "\"];\n"
+ << __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
+ break;
+ case _S_opcode_subexpr_lookahead:
+ __ostr << __id << " [label=\"" << __id << "\\nLOOK_AHEAD\"];\n"
+ << __id << " -> " << _M_next
+ << " [label=\"epsilon\", tailport=\"s\"];\n"
+ << __id << " -> " << _M_alt
+ << " [label=\"<assert>\", tailport=\"n\"];\n";
+ break;
case _S_opcode_subexpr_begin:
__ostr << __id << " [label=\"" << __id << "\\nSBEGIN "
<< _M_subexpr << "\"];\n"
@@ -90,10 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
<< _M_subexpr << "\"];\n"
<< __id << " -> " << _M_next << " [label=\"epsilon\"];\n";
break;
- case _S_opcode_backref:
- __ostr << __id << " [label=\"" << __id << "\\nBACKREF "
- << _M_subexpr << "\"];\n"
- << __id << " -> " << _M_next << " [label=\"<match>\"];\n";
+ case _S_opcode_dummy:
break;
case _S_opcode_match:
__ostr << __id << " [label=\"" << __id << "\\nMATCH\"];\n"
@@ -102,8 +124,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
case _S_opcode_accept:
__ostr << __id << " [label=\"" << __id << "\\nACC\"];\n" ;
break;
- case _S_opcode_dummy:
- break;
default:
_GLIBCXX_DEBUG_ASSERT(false);
break;
@@ -141,8 +161,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__index == __it)
__throw_regex_error(regex_constants::error_backref);
_M_has_backref = true;
- this->push_back(_StateT(_S_opcode_backref, __index));
- return this->size()-1;
+ _StateT __tmp(_S_opcode_backref);
+ __tmp._M_backref_index = __index;
+ return _M_insert_state(__tmp);
}
template<typename _CharT, typename _TraitsT>
@@ -152,7 +173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (auto& __it : *this)
{
while (__it._M_next >= 0 && (*this)[__it._M_next]._M_opcode
- == _S_opcode_dummy)
+ == _S_opcode_dummy)
__it._M_next = (*this)[__it._M_next]._M_next;
if (__it._M_opcode == _S_opcode_alternative)
while (__it._M_alt >= 0 && (*this)[__it._M_alt]._M_opcode
diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index 96a0d294177..4e393e7be9a 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -56,7 +56,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::shared_ptr<_RegexT>
_M_get_nfa() const
- { return std::shared_ptr<_RegexT>(new _RegexT(_M_nfa)); }
+ { return make_shared<_RegexT>(_M_nfa); }
private:
typedef _Scanner<_FwdIter> _ScannerT;
@@ -120,13 +120,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return ret;
}
+ _FlagT _M_flags;
const _TraitsT& _M_traits;
const _CtypeT& _M_ctype;
_ScannerT _M_scanner;
_RegexT _M_nfa;
_StringT _M_value;
_StackT _M_stack;
- _FlagT _M_flags;
};
template<typename _CharT, typename _TraitsT>
@@ -207,7 +207,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__s.data() + __s.size());
if (__st.empty())
__throw_regex_error(regex_constants::error_collate);
- // TODO: digraph
_M_char_set.insert(_M_translate(__st[0]));
}
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index a574e8e5ddd..94f3d5ea86c 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -28,7 +28,7 @@
* Do not attempt to use it directly. @headername{regex}
*/
-// TODO make comments doxygen format.
+// FIXME make comments doxygen format.
// This compiler refers to "Regular Expression Matching Can Be Simple And Fast"
// (http://swtch.com/~rsc/regexp/regexp1.html"),
@@ -63,9 +63,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Compiler<_FwdIter, _CharT, _TraitsT>::
_Compiler(_FwdIter __b, _FwdIter __e,
const _TraitsT& __traits, _FlagT __flags)
- : _M_traits(__traits), _M_scanner(__b, __e, __flags, _M_traits.getloc()),
- _M_ctype(std::use_facet<std::ctype<_CharT>>(_M_traits.getloc())),
- _M_nfa(__flags), _M_flags(__flags)
+ : _M_flags((__flags
+ & (regex_constants::ECMAScript
+ | regex_constants::basic
+ | regex_constants::extended
+ | regex_constants::grep
+ | regex_constants::egrep
+ | regex_constants::awk))
+ ? __flags
+ : __flags | regex_constants::ECMAScript),
+ _M_traits(__traits),
+ _M_scanner(__b, __e, _M_flags, _M_traits.getloc()),
+ _M_ctype(std::use_facet<std::ctype<_CharT>>(_M_traits.getloc())),
+ _M_nfa(_M_flags)
{
_StateSeqT __r(_M_nfa, _M_nfa._M_start());
__r._M_append(_M_nfa._M_insert_subexpr_begin());
@@ -85,7 +95,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_disjunction()
{
this->_M_alternative();
- // TODO empty alternative like, um, "(|asdf)"
while (_M_match_token(_ScannerT::_S_token_or))
{
_StateSeqT __alt1 = _M_pop();
@@ -96,7 +105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__alt2._M_append(__end);
_M_stack.push(_StateSeqT(_M_nfa,
_M_nfa._M_insert_alt(__alt1._M_start,
- __alt2._M_start),
+ __alt2._M_start, false),
__end));
}
}
@@ -132,25 +141,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return false;
}
- // TODO Implement it.
template<typename _FwdIter, typename _CharT, typename _TraitsT>
bool
_Compiler<_FwdIter, _CharT, _TraitsT>::
_M_assertion()
{
- // temporary place holders.
if (_M_match_token(_ScannerT::_S_token_line_begin))
- _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_dummy()));
+ _M_stack.push(_StateSeqT(_M_nfa, _M_nfa.
+ _M_insert_line_begin()));
else if (_M_match_token(_ScannerT::_S_token_line_end))
- _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_dummy()));
+ _M_stack.push(_StateSeqT(_M_nfa, _M_nfa.
+ _M_insert_line_end()));
else if (_M_match_token(_ScannerT::_S_token_word_bound))
- _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_dummy()));
- else if (_M_match_token(_ScannerT::_S_token_neg_word_bound))
- _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_dummy()));
+ // _M_value[0] == 'n' means it's negtive, say "not word boundary".
+ _M_stack.push(_StateSeqT(_M_nfa, _M_nfa.
+ _M_insert_word_bound(_M_value[0] == 'n')));
else if (_M_match_token(_ScannerT::_S_token_subexpr_lookahead_begin))
- _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_dummy()));
- else if (_M_match_token(_ScannerT::_S_token_subexpr_neg_lookahead_begin))
- _M_stack.push(_StateSeqT(_M_nfa, _M_nfa._M_insert_dummy()));
+ {
+ auto __neg = _M_value[0] == 'n';
+ this->_M_disjunction();
+ if (!_M_match_token(_ScannerT::_S_token_subexpr_end))
+ __throw_regex_error(regex_constants::error_paren);
+ auto __tmp = _M_pop();
+ __tmp._M_append(_M_nfa._M_insert_accept());
+ _M_stack.push(
+ _StateSeqT(
+ _M_nfa,
+ _M_nfa._M_insert_lookahead(__tmp._M_start, __neg)));
+ }
else
return false;
return true;
@@ -161,32 +179,37 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Compiler<_FwdIter, _CharT, _TraitsT>::
_M_quantifier()
{
- if (_M_match_token(_ScannerT::_S_token_closure0))
+ bool __neg = (_M_flags & regex_constants::ECMAScript);
+ auto __init = [this, &__neg]()
{
if (_M_stack.empty())
__throw_regex_error(regex_constants::error_badrepeat);
+ __neg = __neg && _M_match_token(_ScannerT::_S_token_opt);
+ };
+ if (_M_match_token(_ScannerT::_S_token_closure0))
+ {
+ __init();
auto __e = _M_pop();
_StateSeqT __r(_M_nfa, _M_nfa._M_insert_alt(_S_invalid_state_id,
- __e._M_start));
+ __e._M_start, __neg));
__e._M_append(__r);
_M_stack.push(__r);
}
else if (_M_match_token(_ScannerT::_S_token_closure1))
{
- if (_M_stack.empty())
- __throw_regex_error(regex_constants::error_badrepeat);
+ __init();
auto __e = _M_pop();
- __e._M_append(_M_nfa._M_insert_alt(_S_invalid_state_id, __e._M_start));
+ __e._M_append(_M_nfa._M_insert_alt(_S_invalid_state_id, __e._M_start,
+ __neg));
_M_stack.push(__e);
}
else if (_M_match_token(_ScannerT::_S_token_opt))
{
- if (_M_stack.empty())
- __throw_regex_error(regex_constants::error_badrepeat);
+ __init();
auto __e = _M_pop();
auto __end = _M_nfa._M_insert_dummy();
_StateSeqT __r(_M_nfa, _M_nfa._M_insert_alt(_S_invalid_state_id,
- __e._M_start));
+ __e._M_start, __neg));
__e._M_append(__end);
__r._M_append(__end);
_M_stack.push(__r);
@@ -200,34 +223,59 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StateSeqT __r(_M_pop());
_StateSeqT __e(_M_nfa, _M_nfa._M_insert_dummy());
int __min_rep = _M_cur_int_value(10);
+ bool __infi = false;
+ int __n;
+
// {3
- for (int __i = 0; __i < __min_rep; ++__i)
- __e._M_append(__r._M_clone());
if (_M_match_token(_ScannerT::_S_token_comma))
if (_M_match_token(_ScannerT::_S_token_dup_count)) // {3,7}
- {
- int __n = _M_cur_int_value(10) - __min_rep;
- if (__n < 0)
- __throw_regex_error(regex_constants::error_badbrace);
- auto __end = _M_nfa._M_insert_dummy();
- for (int __i = 0; __i < __n; ++__i)
- {
- auto __tmp = __r._M_clone();
- __e._M_append(_StateSeqT(_M_nfa, _M_nfa.
- _M_insert_alt(__tmp._M_start, __end), __tmp._M_end));
- }
- __e._M_append(__end);
- }
- else // {3,}
- {
- auto __tmp = __r._M_clone();
- _StateSeqT __s(_M_nfa, _M_nfa._M_insert_alt(_S_invalid_state_id,
- __tmp._M_start));
- __tmp._M_append(__s);
- __e._M_append(__s);
- }
+ __n = _M_cur_int_value(10) - __min_rep;
+ else
+ __infi = true;
+ else
+ __n = 0;
if (!_M_match_token(_ScannerT::_S_token_interval_end))
__throw_regex_error(regex_constants::error_brace);
+
+ __neg = __neg && _M_match_token(_ScannerT::_S_token_opt);
+
+ for (int __i = 0; __i < __min_rep; ++__i)
+ __e._M_append(__r._M_clone());
+
+ if (__infi)
+ {
+ auto __tmp = __r._M_clone();
+ _StateSeqT __s(_M_nfa,
+ _M_nfa._M_insert_alt(_S_invalid_state_id,
+ __tmp._M_start, __neg));
+ __tmp._M_append(__s);
+ __e._M_append(__s);
+ }
+ else
+ {
+ if (__n < 0)
+ __throw_regex_error(regex_constants::error_badbrace);
+ auto __end = _M_nfa._M_insert_dummy();
+ // _M_alt is the "match more" branch, and _M_next is the
+ // "match less" one. Switch _M_alt and _M_next of all created
+ // nodes. This is a hacking but IMO works well.
+ std::stack<_StateIdT> __stack;
+ for (int __i = 0; __i < __n; ++__i)
+ {
+ auto __tmp = __r._M_clone();
+ auto __alt = _M_nfa._M_insert_alt(__tmp._M_start,
+ __end, __neg);
+ __stack.push(__alt);
+ __e._M_append(_StateSeqT(_M_nfa, __alt, __tmp._M_end));
+ }
+ __e._M_append(__end);
+ while (!__stack.empty())
+ {
+ auto& __tmp = _M_nfa[__stack.top()];
+ __stack.pop();
+ swap(__tmp._M_next, __tmp._M_alt);
+ }
+ }
_M_stack.push(__e);
}
}
diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h
index 23174becdf9..94c25e531b3 100644
--- a/libstdc++-v3/include/bits/regex_constants.h
+++ b/libstdc++-v3/include/bits/regex_constants.h
@@ -52,19 +52,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
//@{
enum __syntax_option
- {
- _S_icase,
- _S_nosubs,
- _S_optimize,
- _S_collate,
- _S_ECMAScript,
- _S_basic,
- _S_extended,
- _S_awk,
- _S_grep,
- _S_egrep,
- _S_syntax_last
- };
+ {
+ _S_icase,
+ _S_nosubs,
+ _S_optimize,
+ _S_collate,
+ _S_ECMAScript,
+ _S_basic,
+ _S_extended,
+ _S_awk,
+ _S_grep,
+ _S_egrep,
+ _S_syntax_last
+ };
/**
* @brief This is a bitmask type indicating how to interpret the regex.
@@ -78,87 +78,87 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* %set.
*/
enum syntax_option_type : unsigned int
- {
- /**
- * Specifies that the matching of regular expressions against a character
- * sequence shall be performed without regard to case.
- */
- icase = 1 << _S_icase,
-
- /**
- * Specifies that when a regular expression is matched against a character
- * container sequence, no sub-expression matches are to be stored in the
- * supplied match_results structure.
- */
- nosubs = 1 << _S_nosubs,
-
- /**
- * Specifies that the regular expression engine should pay more attention to
- * the speed with which regular expressions are matched, and less to the
- * speed with which regular expression objects are constructed. Otherwise
- * it has no detectable effect on the program output.
- */
- optimize = 1 << _S_optimize,
-
- /**
- * Specifies that character ranges of the form [a-b] should be locale
- * sensitive.
- */
- collate = 1 << _S_collate,
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
- * Language Specification, Standard Ecma-262, third edition, 1999], as
- * modified in section [28.13]. This grammar is similar to that defined
- * in the PERL scripting language but extended with elements found in the
- * POSIX regular expression grammar.
- */
- ECMAScript = 1 << _S_ECMAScript,
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
- * Portable Operating System Interface (POSIX), Base Definitions and
- * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
- * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
- */
- basic = 1 << _S_basic,
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
- * Portable Operating System Interface (POSIX), Base Definitions and Headers,
- * Section 9, Regular Expressions.
- */
- extended = 1 << _S_extended,
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
- * identical to syntax_option_type extended, except that C-style escape
- * sequences are supported. These sequences are:
- * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos,, &apos,,
- * and \\ddd (where ddd is one, two, or three octal digits).
- */
- awk = 1 << _S_awk,
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
- * identical to syntax_option_type basic, except that newlines are treated
- * as whitespace.
- */
- grep = 1 << _S_grep,
-
- /**
- * Specifies that the grammar recognized by the regular expression engine is
- * that used by POSIX utility grep when given the -E option in
- * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
- * extended, except that newlines are treated as whitespace.
- */
- egrep = 1 << _S_egrep,
- };
+ {
+ /**
+ * Specifies that the matching of regular expressions against a character
+ * sequence shall be performed without regard to case.
+ */
+ icase = 1 << _S_icase,
+
+ /**
+ * Specifies that when a regular expression is matched against a character
+ * container sequence, no sub-expression matches are to be stored in the
+ * supplied match_results structure.
+ */
+ nosubs = 1 << _S_nosubs,
+
+ /**
+ * Specifies that the regular expression engine should pay more attention to
+ * the speed with which regular expressions are matched, and less to the
+ * speed with which regular expression objects are constructed. Otherwise
+ * it has no detectable effect on the program output.
+ */
+ optimize = 1 << _S_optimize,
+
+ /**
+ * Specifies that character ranges of the form [a-b] should be locale
+ * sensitive.
+ */
+ collate = 1 << _S_collate,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by ECMAScript in ECMA-262 [Ecma International, ECMAScript
+ * Language Specification, Standard Ecma-262, third edition, 1999], as
+ * modified in section [28.13]. This grammar is similar to that defined
+ * in the PERL scripting language but extended with elements found in the
+ * POSIX regular expression grammar.
+ */
+ ECMAScript = 1 << _S_ECMAScript,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX basic regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions [IEEE, Information Technology --
+ * Portable Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ basic = 1 << _S_basic,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX extended regular expressions in IEEE Std 1003.1-2001,
+ * Portable Operating System Interface (POSIX), Base Definitions and
+ * Headers, Section 9, Regular Expressions.
+ */
+ extended = 1 << _S_extended,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility awk in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type extended, except that C-style escape
+ * sequences are supported. These sequences are:
+ * \\\\, \\a, \\b, \\f, \\n, \\r, \\t , \\v, \\&apos,, &apos,,
+ * and \\ddd (where ddd is one, two, or three octal digits).
+ */
+ awk = 1 << _S_awk,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep in IEEE Std 1003.1-2001. This option is
+ * identical to syntax_option_type basic, except that newlines are treated
+ * as whitespace.
+ */
+ grep = 1 << _S_grep,
+
+ /**
+ * Specifies that the grammar recognized by the regular expression engine is
+ * that used by POSIX utility grep when given the -E option in
+ * IEEE Std 1003.1-2001. This option is identical to syntax_option_type
+ * extended, except that newlines are treated as whitespace.
+ */
+ egrep = 1 << _S_egrep,
+ };
constexpr inline syntax_option_type
operator&(syntax_option_type __a, syntax_option_type __b)
@@ -211,20 +211,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
//@{
enum __match_flag
- {
- _S_not_bol,
- _S_not_eol,
- _S_not_bow,
- _S_not_eow,
- _S_any,
- _S_not_null,
- _S_continuous,
- _S_prev_avail,
- _S_sed,
- _S_no_copy,
- _S_first_only,
- _S_match_flag_last
- };
+ {
+ _S_not_bol,
+ _S_not_eol,
+ _S_not_bow,
+ _S_not_eow,
+ _S_any,
+ _S_not_null,
+ _S_continuous,
+ _S_prev_avail,
+ _S_sed,
+ _S_no_copy,
+ _S_first_only,
+ _S_match_flag_last
+ };
/**
* @brief This is a bitmask type indicating regex matching rules.
@@ -233,110 +233,148 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* perform bitwise operations on these values and expect the right thing to
* happen.
*/
- typedef std::bitset<_S_match_flag_last> match_flag_type;
-
- /**
- * The default matching rules.
- */
- constexpr match_flag_type match_default = 0;
-
- /**
- * The first character in the sequence [first, last) is treated as though it
- * is not at the beginning of a line, so the character (^) in the regular
- * expression shall not match [first, first).
- */
- constexpr match_flag_type match_not_bol = 1 << _S_not_bol;
-
- /**
- * The last character in the sequence [first, last) is treated as though it
- * is not at the end of a line, so the character ($) in the regular
- * expression shall not match [last, last).
- */
- constexpr match_flag_type match_not_eol = 1 << _S_not_eol;
-
- /**
- * The expression \\b is not matched against the sub-sequence
- * [first,first).
- */
- constexpr match_flag_type match_not_bow = 1 << _S_not_bow;
-
- /**
- * The expression \\b should not be matched against the sub-sequence
- * [last,last).
- */
- constexpr match_flag_type match_not_eow = 1 << _S_not_eow;
-
- /**
- * If more than one match is possible then any match is an acceptable
- * result.
- */
- constexpr match_flag_type match_any = 1 << _S_any;
-
- /**
- * The expression does not match an empty sequence.
- */
- constexpr match_flag_type match_not_null = 1 << _S_not_null;
+ enum match_flag_type : unsigned int
+ {
+ /**
+ * The default matching rules.
+ */
+ match_default = 0,
+
+ /**
+ * The first character in the sequence [first, last) is treated as though it
+ * is not at the beginning of a line, so the character (^) in the regular
+ * expression shall not match [first, first).
+ */
+ match_not_bol = 1 << _S_not_bol,
+
+ /**
+ * The last character in the sequence [first, last) is treated as though it
+ * is not at the end of a line, so the character ($) in the regular
+ * expression shall not match [last, last).
+ */
+ match_not_eol = 1 << _S_not_eol,
+
+ /**
+ * The expression \\b is not matched against the sub-sequence
+ * [first,first).
+ */
+ match_not_bow = 1 << _S_not_bow,
+
+ /**
+ * The expression \\b should not be matched against the sub-sequence
+ * [last,last).
+ */
+ match_not_eow = 1 << _S_not_eow,
+
+ /**
+ * If more than one match is possible then any match is an acceptable
+ * result.
+ */
+ match_any = 1 << _S_any,
+
+ /**
+ * The expression does not match an empty sequence.
+ */
+ match_not_null = 1 << _S_not_null,
+
+ /**
+ * The expression only matches a sub-sequence that begins at first .
+ */
+ match_continuous = 1 << _S_continuous,
+
+ /**
+ * --first is a valid iterator position. When this flag is set then the
+ * flags match_not_bol and match_not_bow are ignored by the regular
+ * expression algorithms 28.11 and iterators 28.12.
+ */
+ match_prev_avail = 1 << _S_prev_avail,
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the ECMAScript replace
+ * function in ECMA- 262 [Ecma International, ECMAScript Language
+ * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
+ * String.prototype.replace. In addition, during search and replace
+ * operations all non-overlapping occurrences of the regular expression
+ * are located and replaced, and sections of the input that did not match
+ * the expression are copied unchanged to the output string.
+ *
+ * Format strings (from ECMA-262 [15.5.4.11]):
+ * @li $$ The dollar-sign itself ($)
+ * @li $& The matched substring.
+ * @li $` The portion of @a string that precedes the matched substring.
+ * This would be match_results::prefix().
+ * @li $' The portion of @a string that follows the matched substring.
+ * This would be match_results::suffix().
+ * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
+ * decimal digit. If n <= match_results::size() and the nth capture
+ * is undefined, use the empty string instead. If n >
+ * match_results::size(), the result is implementation-defined.
+ * @li $nn The nnth capture, where nn is a two-digit decimal number on
+ * [01, 99]. If nn <= match_results::size() and the nth capture is
+ * undefined, use the empty string instead. If
+ * nn > match_results::size(), the result is implementation-defined.
+ */
+ format_default = 0,
+
+ /**
+ * When a regular expression match is to be replaced by a new string, the
+ * new string is constructed using the rules used by the POSIX sed utility
+ * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
+ * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
+ */
+ format_sed = 1 << _S_sed,
+
+ /**
+ * During a search and replace operation, sections of the character
+ * container sequence being searched that do not match the regular
+ * expression shall not be copied to the output string.
+ */
+ format_no_copy = 1 << _S_no_copy,
+
+ /**
+ * When specified during a search and replace operation, only the first
+ * occurrence of the regular expression shall be replaced.
+ */
+ format_first_only = 1 << _S_first_only,
+ };
+
+ constexpr inline match_flag_type
+ operator&(match_flag_type __a, match_flag_type __b)
+ {
+ return (match_flag_type)(static_cast<unsigned int>(__a)
+ & static_cast<unsigned int>(__b));
+ }
- /**
- * The expression only matches a sub-sequence that begins at first .
- */
- constexpr match_flag_type match_continuous = 1 << _S_continuous;
+ constexpr inline match_flag_type
+ operator|(match_flag_type __a, match_flag_type __b)
+ {
+ return (match_flag_type)(static_cast<unsigned int>(__a)
+ | static_cast<unsigned int>(__b));
+ }
- /**
- * --first is a valid iterator position. When this flag is set then the
- * flags match_not_bol and match_not_bow are ignored by the regular
- * expression algorithms 28.11 and iterators 28.12.
- */
- constexpr match_flag_type match_prev_avail = 1 << _S_prev_avail;
+ constexpr inline match_flag_type
+ operator^(match_flag_type __a, match_flag_type __b)
+ {
+ return (match_flag_type)(static_cast<unsigned int>(__a)
+ ^ static_cast<unsigned int>(__b));
+ }
- /**
- * When a regular expression match is to be replaced by a new string, the
- * new string is constructed using the rules used by the ECMAScript replace
- * function in ECMA- 262 [Ecma International, ECMAScript Language
- * Specification, Standard Ecma-262, third edition, 1999], part 15.5.4.11
- * String.prototype.replace. In addition, during search and replace
- * operations all non-overlapping occurrences of the regular expression
- * are located and replaced, and sections of the input that did not match
- * the expression are copied unchanged to the output string.
- *
- * Format strings (from ECMA-262 [15.5.4.11]):
- * @li $$ The dollar-sign itself ($)
- * @li $& The matched substring.
- * @li $` The portion of @a string that precedes the matched substring.
- * This would be match_results::prefix().
- * @li $' The portion of @a string that follows the matched substring.
- * This would be match_results::suffix().
- * @li $n The nth capture, where n is in [1,9] and $n is not followed by a
- * decimal digit. If n <= match_results::size() and the nth capture
- * is undefined, use the empty string instead. If n >
- * match_results::size(), the result is implementation-defined.
- * @li $nn The nnth capture, where nn is a two-digit decimal number on
- * [01, 99]. If nn <= match_results::size() and the nth capture is
- * undefined, use the empty string instead. If
- * nn > match_results::size(), the result is implementation-defined.
- */
- constexpr match_flag_type format_default = 0;
+ constexpr inline match_flag_type
+ operator~(match_flag_type __a)
+ { return (match_flag_type)(~static_cast<unsigned int>(__a)); }
- /**
- * When a regular expression match is to be replaced by a new string, the
- * new string is constructed using the rules used by the POSIX sed utility
- * in IEEE Std 1003.1- 2001 [IEEE, Information Technology -- Portable
- * Operating System Interface (POSIX), IEEE Standard 1003.1-2001].
- */
- constexpr match_flag_type format_sed = 1 << _S_sed;
+ inline match_flag_type&
+ operator&=(match_flag_type& __a, match_flag_type __b)
+ { return __a = __a & __b; }
- /**
- * During a search and replace operation, sections of the character
- * container sequence being searched that do not match the regular
- * expression shall not be copied to the output string.
- */
- constexpr match_flag_type format_no_copy = 1 << _S_no_copy;
+ inline match_flag_type&
+ operator|=(match_flag_type& __a, match_flag_type __b)
+ { return __a = __a | __b; }
- /**
- * When specified during a search and replace operation, only the first
- * occurrence of the regular expression shall be replaced.
- */
- constexpr match_flag_type format_first_only = 1 << _S_first_only;
+ inline match_flag_type&
+ operator^=(match_flag_type& __a, match_flag_type __b)
+ { return __a = __a ^ __b; }
//@}
diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h
index 7f06727bfae..a39a8ea1a8f 100644
--- a/libstdc++-v3/include/bits/regex_error.h
+++ b/libstdc++-v3/include/bits/regex_error.h
@@ -61,7 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_error_badrepeat,
_S_error_complexity,
_S_error_stack,
- _S_error_last
};
/** The expression contained an invalid collating element name. */
diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h
index 6d66d881584..a0149d2a548 100644
--- a/libstdc++-v3/include/bits/regex_executor.h
+++ b/libstdc++-v3/include/bits/regex_executor.h
@@ -28,7 +28,11 @@
* Do not attempt to use it directly. @headername{regex}
*/
-// TODO: convert comments to doxygen format.
+// FIXME convert comments to doxygen format.
+
+// TODO Put _DFSExecutor and _BFSExecutor into one class. They are becoming
+// much more similar. Also, make grouping seperated. The
+// regex_constants::nosubs enables much more simpler execution.
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -57,42 +61,113 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class _Executor
{
public:
- typedef match_results<_BiIter, _Alloc> _ResultsT;
+ typedef basic_regex<_CharT, _TraitsT> _RegexT;
typedef std::vector<sub_match<_BiIter>, _Alloc> _ResultsVec;
typedef regex_constants::match_flag_type _FlagT;
+ typedef typename _TraitsT::char_class_type _ClassT;
- virtual
- ~_Executor()
+ public:
+ _Executor(_BiIter __begin,
+ _BiIter __end,
+ _ResultsVec& __results,
+ const _RegexT& __re,
+ _FlagT __flags)
+ : _M_begin(__begin),
+ _M_end(__end),
+ _M_results(__results),
+ _M_re(__re),
+ _M_flags((__flags & regex_constants::match_prev_avail)
+ ? (__flags
+ & ~regex_constants::match_not_bol
+ & ~regex_constants::match_not_bow)
+ : __flags)
{ }
// Set matched when string exactly match the pattern.
- virtual void
- _M_match() = 0;
+ bool
+ _M_match()
+ {
+ _M_match_mode = true;
+ _M_init(_M_begin);
+ return _M_main();
+ }
// Set matched when some prefix of the string matches the pattern.
- virtual void
- _M_search_from_first() = 0;
-
- protected:
- typedef typename _NFA<_CharT, _TraitsT>::_SizeT _SizeT;
- _Executor(_BiIter __begin,
- _BiIter __end,
- _ResultsT& __results,
- _FlagT __flags,
- _SizeT __size)
- : _M_current(__begin), _M_end(__end), _M_results(__results),
- _M_flags(__flags)
+ bool
+ _M_search_from_first()
{
- __size += 2;
- _M_results.resize(__size);
- for (auto __i = 0; __i < __size; __i++)
- _M_results[__i].matched = false;
+ _M_match_mode = false;
+ _M_init(_M_begin);
+ return _M_main();
}
- _BiIter _M_current;
- _BiIter _M_end;
- _ResultsVec& _M_results;
- _FlagT _M_flags;
+ bool
+ _M_search()
+ {
+ if (_M_flags & regex_constants::match_continuous)
+ return _M_search_from_first();
+ auto __cur = _M_begin;
+ do
+ {
+ _M_match_mode = false;
+ _M_init(__cur);
+ if (_M_main())
+ return true;
+ }
+ // Continue when __cur == _M_end
+ while (__cur++ != _M_end);
+ return false;
+ }
+
+ bool
+ _M_is_word(_CharT __ch) const
+ {
+ static const _CharT __s = 'w';
+ return _M_re._M_traits.isctype
+ (__ch, _M_re._M_traits.lookup_classname(&__s, &__s+1));
+ }
+
+ bool
+ _M_at_begin() const
+ {
+ return _M_current == _M_begin
+ && !(_M_flags & (regex_constants::match_not_bol
+ | regex_constants::match_prev_avail));
+ }
+
+ bool
+ _M_at_end() const
+ {
+ return _M_current == _M_end
+ && !(_M_flags & regex_constants::match_not_eol);
+ }
+
+ bool
+ _M_word_boundry(_State<_CharT, _TraitsT> __state) const;
+
+ bool
+ _M_lookahead(_State<_CharT, _TraitsT> __state) const;
+
+ void
+ _M_set_results(_ResultsVec& __cur_results);
+
+ public:
+ virtual void
+ _M_init(_BiIter __cur) = 0;
+
+ virtual void
+ _M_set_start(_StateIdT __start) = 0;
+
+ virtual bool
+ _M_main() = 0;
+
+ _BiIter _M_current;
+ const _BiIter _M_begin;
+ const _BiIter _M_end;
+ const _RegexT& _M_re;
+ _ResultsVec& _M_results;
+ _FlagT _M_flags;
+ bool _M_match_mode;
};
// A _DFSExecutor perform a DFS on given NFA and input string. At the very
@@ -115,37 +190,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
typedef _Executor<_BiIter, _Alloc, _CharT, _TraitsT> _BaseT;
- typedef _NFA<_CharT, _TraitsT> _RegexT;
- typedef typename _BaseT::_ResultsT _ResultsT;
+ typedef _NFA<_CharT, _TraitsT> _NFAT;
+ typedef typename _BaseT::_RegexT _RegexT;
typedef typename _BaseT::_ResultsVec _ResultsVec;
- typedef regex_constants::match_flag_type _FlagT;
+ typedef typename _BaseT::_FlagT _FlagT;
+ public:
_DFSExecutor(_BiIter __begin,
_BiIter __end,
- _ResultsT& __results,
- const _RegexT& __nfa,
- const _TraitsT& __traits,
+ _ResultsVec& __results,
+ const _RegexT& __re,
_FlagT __flags)
- : _BaseT(__begin, __end, __results, __flags, __nfa._M_sub_count()),
- _M_traits(__traits), _M_nfa(__nfa), _M_results_ret(this->_M_results)
+ : _BaseT(__begin, __end, __results, __re, __flags),
+ _M_nfa(*std::static_pointer_cast<_NFA<_CharT, _TraitsT>>
+ (__re._M_automaton)),
+ _M_start_state(_M_nfa._M_start())
{ }
+ private:
void
- _M_match()
- { _M_dfs<true>(_M_nfa._M_start()); }
+ _M_init(_BiIter __cur)
+ {
+ _M_cur_results.resize(_M_nfa._M_sub_count() + 2);
+ this->_M_current = __cur;
+ }
void
- _M_search_from_first()
- { _M_dfs<false>(_M_nfa._M_start()); }
+ _M_set_start(_StateIdT __start)
+ { _M_start_state = __start; }
- private:
- template<bool __match_mode>
- bool
- _M_dfs(_StateIdT __i);
+ bool
+ _M_main()
+ { return _M_dfs(this->_M_start_state); }
+
+ bool
+ _M_dfs(_StateIdT __start);
- _ResultsVec _M_results_ret;
- const _TraitsT& _M_traits;
- const _RegexT& _M_nfa;
+ // To record current solution.
+ _ResultsVec _M_cur_results;
+ const _NFAT& _M_nfa;
+ _StateIdT _M_start_state;
};
// Like the DFS approach, it try every possible state transition; Unlike DFS,
@@ -168,38 +252,113 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
public:
typedef _Executor<_BiIter, _Alloc, _CharT, _TraitsT> _BaseT;
- typedef _NFA<_CharT, _TraitsT> _RegexT;
- typedef typename _BaseT::_ResultsT _ResultsT;
+ typedef _NFA<_CharT, _TraitsT> _NFAT;
+ typedef typename _BaseT::_RegexT _RegexT;
typedef typename _BaseT::_ResultsVec _ResultsVec;
- typedef std::unique_ptr<_ResultsVec> _ResultsPtr;
- typedef regex_constants::match_flag_type _FlagT;
-
- _BFSExecutor(_BiIter __begin,
- _BiIter __end,
- _ResultsT& __results,
- const _RegexT& __nfa,
- _FlagT __flags)
- : _BaseT(__begin, __end, __results, __flags, __nfa._M_sub_count()),
- _M_nfa(__nfa)
+ typedef typename _BaseT::_FlagT _FlagT;
+ // Here's a solution for greedy/ungreedy mode in BFS approach. We need to
+ // carefully work out how to compare to conflict matching states.
+ //
+ // A matching state is a pair(where, when); `where` is a NFA node; `when`
+ // is a _BiIter, indicating which char is the next to be matched. Two
+ // matching states conflict if they have equivalent `where` and `when`.
+ //
+ // Now we need to drop one and keep another, because at most one of them
+ // could be the final optimal solution. This behavior is affected by
+ // greedy policy.
+ //
+ // The definition of `greedy`:
+ // For the sequence of quantifiers in NFA sorted by there start position,
+ // now maintain a vector in every matching state, with equal length to
+ // quantifier seq, recording repeating times of every quantifier. Now to
+ // compare two matching states, we just lexically compare these two
+ // vectors. To win the compare(to survive), one matching state needs to
+ // make its greedy quantifier count larger, and ungreedy quantifiers
+ // count smaller.
+ //
+ // In the implementation, we recorded negtive counts for greedy
+ // quantifiers and positive counts of ungreedy ones. Now the implicit
+ // operator<() for lexicographical_compare will emit the answer.
+ //
+ // When two vectors equal, it means the `where`, `when` and quantifier
+ // counts are identical, and indicates the same solution; so just return
+ // false.
+ struct _ResultsEntry
+ : private _ResultsVec
{
- if (_M_nfa._M_start() != _S_invalid_state_id)
- _M_covered[_M_nfa._M_start()] =
- _ResultsPtr(new _ResultsVec(this->_M_results));
- _M_e_closure();
- }
+ public:
+ _ResultsEntry(unsigned int __res_sz, unsigned int __sz)
+ : _ResultsVec(__res_sz), _M_quant_keys(__sz)
+ { }
+
+ void
+ resize(unsigned int __n)
+ { _ResultsVec::resize(__n); }
+
+ unsigned int
+ size()
+ { return _ResultsVec::size(); }
+
+ sub_match<_BiIter>&
+ operator[](unsigned int __idx)
+ { return _ResultsVec::operator[](__idx); }
+
+ bool
+ operator<(const _ResultsEntry& __rhs) const
+ {
+ _GLIBCXX_DEBUG_ASSERT(_M_quant_keys.size()
+ == __rhs._M_quant_keys.size());
+ return lexicographical_compare(_M_quant_keys.begin(),
+ _M_quant_keys.end(),
+ __rhs._M_quant_keys.begin(),
+ __rhs._M_quant_keys.end());
+ }
+
+ void
+ _M_inc(unsigned int __idx, bool __neg)
+ { _M_quant_keys[__idx] += __neg ? 1 : -1; }
+
+ _ResultsVec&
+ _M_get()
+ { return *this; }
+
+ public:
+ std::vector<int> _M_quant_keys;
+ };
+ typedef std::unique_ptr<_ResultsEntry> _ResultsPtr;
+ public:
+ _BFSExecutor(_BiIter __begin,
+ _BiIter __end,
+ _ResultsVec& __results,
+ const _RegexT& __re,
+ _FlagT __flags)
+ : _BaseT(__begin, __end, __results, __re, __flags),
+ _M_nfa(*std::static_pointer_cast<_NFA<_CharT, _TraitsT>>
+ (__re._M_automaton)),
+ _M_start_state(_M_nfa._M_start())
+ { }
+
+ private:
void
- _M_match()
- { _M_main_loop<true>(); }
+ _M_init(_BiIter __cur)
+ {
+ _GLIBCXX_DEBUG_ASSERT(this->_M_start_state != _S_invalid_state_id);
+ this->_M_current = __cur;
+ _M_covered.clear();
+ _ResultsVec& __res(this->_M_results);
+ _M_covered[this->_M_start_state] =
+ _ResultsPtr(new _ResultsEntry(__res.size(),
+ _M_nfa._M_quant_count));
+ _M_e_closure();
+ }
void
- _M_search_from_first()
- { _M_main_loop<false>(); }
+ _M_set_start(_StateIdT __start)
+ { _M_start_state = __start; }
- private:
- template<bool __match_mode>
- void
- _M_main_loop();
+ bool
+ _M_main();
void
_M_e_closure();
@@ -208,15 +367,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_move();
bool
- _M_match_less_than(const _ResultsVec& __u, const _ResultsVec& __v) const;
+ _M_includes_some();
- bool
- _M_includes_some() const;
-
- std::map<_StateIdT, _ResultsPtr> _M_covered;
- const _RegexT& _M_nfa;
+ std::map<_StateIdT, _ResultsPtr> _M_covered;
+ // To record global optimal solution.
+ _ResultsPtr _M_cur_results;
+ const _NFAT& _M_nfa;
+ _StateIdT _M_start_state;
};
+ template<typename _BiIter, typename _Alloc,
+ typename _CharT, typename _TraitsT>
+ std::unique_ptr<_Executor<_BiIter, _Alloc, _CharT, _TraitsT>>
+ __get_executor(_BiIter __b,
+ _BiIter __e,
+ std::vector<sub_match<_BiIter>, _Alloc>& __m,
+ const basic_regex<_CharT, _TraitsT>& __re,
+ regex_constants::match_flag_type __flags);
+
//@} regex-detail
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc
index 788d65e54de..3a4080081b7 100644
--- a/libstdc++-v3/include/bits/regex_executor.tcc
+++ b/libstdc++-v3/include/bits/regex_executor.tcc
@@ -36,7 +36,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _BiIter, typename _Alloc,
typename _CharT, typename _TraitsT>
- template<bool __match_mode>
bool _DFSExecutor<_BiIter, _Alloc, _CharT, _TraitsT>::
_M_dfs(_StateIdT __i)
{
@@ -44,90 +43,112 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// This is not that certain. Need deeper investigate.
return false;
auto& __current = this->_M_current;
- auto& __end = this->_M_end;
- auto& __results = _M_results_ret;
const auto& __state = _M_nfa[__i];
bool __ret = false;
switch (__state._M_opcode)
{
case _S_opcode_alternative:
- // Greedy mode by default. For non-greedy mode,
- // swap _M_alt and _M_next.
- // TODO: Add greedy mode option.
- __ret = _M_dfs<__match_mode>(__state._M_alt)
- || _M_dfs<__match_mode>(__state._M_next);
+ // Greedy or not, this is a question ;)
+ if (!__state._M_neg)
+ __ret = _M_dfs(__state._M_alt)
+ || _M_dfs(__state._M_next);
+ else
+ __ret = _M_dfs(__state._M_next)
+ || _M_dfs(__state._M_alt);
break;
case _S_opcode_subexpr_begin:
// Here's the critical part: if there's nothing changed since last
// visit, do NOT continue. This prevents the executor from get into
// infinite loop when use "()*" to match "".
//
- // Every change on __results will be roll back after the recursion
- // step finished.
- if (!__results[__state._M_subexpr].matched
- || __results[__state._M_subexpr].first != __current)
+ // Every change on _M_cur_results will be roll back after the
+ // recursion step finished.
+ if (!_M_cur_results[__state._M_subexpr].matched
+ || _M_cur_results[__state._M_subexpr].first != __current)
{
auto __back = __current;
- __results[__state._M_subexpr].first = __current;
- __ret = _M_dfs<__match_mode>(__state._M_next);
- __results[__state._M_subexpr].first = __back;
+ _M_cur_results[__state._M_subexpr].first = __current;
+ __ret = _M_dfs(__state._M_next);
+ _M_cur_results[__state._M_subexpr].first = __back;
}
break;
case _S_opcode_subexpr_end:
- if (__results[__state._M_subexpr].second != __current
- || __results[__state._M_subexpr].matched != true)
+ if (_M_cur_results[__state._M_subexpr].second != __current
+ || _M_cur_results[__state._M_subexpr].matched != true)
{
- auto __back = __results[__state._M_subexpr];
- __results[__state._M_subexpr].second = __current;
- __results[__state._M_subexpr].matched = true;
- __ret = _M_dfs<__match_mode>(__state._M_next);
- __results[__state._M_subexpr] = __back;
+ auto __back = _M_cur_results[__state._M_subexpr];
+ _M_cur_results[__state._M_subexpr].second = __current;
+ _M_cur_results[__state._M_subexpr].matched = true;
+ __ret = _M_dfs(__state._M_next);
+ _M_cur_results[__state._M_subexpr] = __back;
}
else
- __ret = _M_dfs<__match_mode>(__state._M_next);
+ __ret = _M_dfs(__state._M_next);
+ break;
+ case _S_opcode_line_begin_assertion:
+ if (this->_M_at_begin())
+ __ret = _M_dfs(__state._M_next);
+ break;
+ case _S_opcode_line_end_assertion:
+ if (this->_M_at_end())
+ __ret = _M_dfs(__state._M_next);
+ break;
+ case _S_opcode_word_boundry:
+ if (this->_M_word_boundry(__state) == !__state._M_neg)
+ __ret = _M_dfs(__state._M_next);
+ break;
+ // Here __state._M_alt offers a single start node for a sub-NFA.
+ // We recursivly invoke our algorithm to match the sub-NFA.
+ case _S_opcode_subexpr_lookahead:
+ if (this->_M_lookahead(__state) == !__state._M_neg)
+ __ret = _M_dfs(__state._M_next);
break;
case _S_opcode_match:
- if (__current != __end && __state._M_matches(*__current))
+ if (__current != this->_M_end && __state._M_matches(*__current))
{
++__current;
- __ret = _M_dfs<__match_mode>(__state._M_next);
+ __ret = _M_dfs(__state._M_next);
--__current;
}
break;
- // First fetch the matched result from __results as __submatch;
+ // First fetch the matched result from _M_cur_results as __submatch;
// then compare it with
// (__current, __current + (__submatch.second - __submatch.first))
// If matched, keep going; else just return to try another state.
case _S_opcode_backref:
{
- auto& __submatch = __results[__state._M_backref_index];
+ auto& __submatch = _M_cur_results[__state._M_backref_index];
if (!__submatch.matched)
break;
auto __last = __current;
for (auto __tmp = __submatch.first;
- __last != __end && __tmp != __submatch.second;
+ __last != this->_M_end && __tmp != __submatch.second;
++__tmp)
++__last;
- if (_M_traits.transform(__submatch.first, __submatch.second)
- == _M_traits.transform(__current, __last))
+ if (this->_M_re._M_traits.transform(__submatch.first,
+ __submatch.second)
+ == this->_M_re._M_traits.transform(__current, __last))
if (__last != __current)
{
auto __backup = __current;
__current = __last;
- __ret = _M_dfs<__match_mode>(__state._M_next);
+ __ret = _M_dfs(__state._M_next);
__current = __backup;
}
else
- __ret = _M_dfs<__match_mode>(__state._M_next);
+ __ret = _M_dfs(__state._M_next);
}
break;
case _S_opcode_accept:
- if (__match_mode)
- __ret = __current == __end;
+ if (this->_M_match_mode)
+ __ret = __current == this->_M_end;
else
__ret = true;
+ if (__current == this->_M_begin
+ && (this->_M_flags & regex_constants::match_not_null))
+ __ret = false;
if (__ret)
- this->_M_results = __results;
+ this->_M_set_results(_M_cur_results);
break;
default:
_GLIBCXX_DEBUG_ASSERT(false);
@@ -137,20 +158,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _BiIter, typename _Alloc,
typename _CharT, typename _TraitsT>
- template<bool __match_mode>
- void _BFSExecutor<_BiIter, _Alloc, _CharT, _TraitsT>::
- _M_main_loop()
+ bool _BFSExecutor<_BiIter, _Alloc, _CharT, _TraitsT>::
+ _M_main()
{
+ bool __ret = false;
+ if (!this->_M_match_mode
+ && !(this->_M_flags & regex_constants::match_not_null))
+ __ret = _M_includes_some() || __ret;
while (this->_M_current != this->_M_end)
{
- if (!__match_mode)
- if (_M_includes_some())
- return;
_M_move();
++this->_M_current;
_M_e_closure();
+ if (!this->_M_match_mode)
+ // To keep regex_search greedy, no "return true" here.
+ __ret = _M_includes_some() || __ret;
}
- _M_includes_some();
+ if (this->_M_match_mode)
+ __ret = _M_includes_some();
+ if (__ret)
+ this->_M_set_results(_M_cur_results->_M_get());
+ return __ret;
}
template<typename _BiIter, typename _Alloc,
@@ -158,9 +186,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void _BFSExecutor<_BiIter, _Alloc, _CharT, _TraitsT>::
_M_e_closure()
{
- auto& __current = this->_M_current;
std::queue<_StateIdT> __q;
std::vector<bool> __in_q(_M_nfa.size(), false);
+ auto& __current = this->_M_current;
+
for (auto& __it : _M_covered)
{
__in_q[__it.first] = true;
@@ -173,18 +202,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__in_q[__u] = false;
const auto& __state = _M_nfa[__u];
- // Can be implemented using method, but there're too much arguments.
- // I would use macro function before C++11, but lambda is a better
- // choice, since hopefully compiler can inline it.
+ // Can be implemented using method, but there will be too many
+ // arguments. I would use macro function before C++11, but lambda is
+ // a better choice, since hopefully compiler can inline it.
auto __add_visited_state = [&](_StateIdT __v)
{
if (__v == _S_invalid_state_id)
return;
if (_M_covered.count(__u) != 0
&& (_M_covered.count(__v) == 0
- || _M_match_less_than(*_M_covered[__u], *_M_covered[__v])))
+ || *_M_covered[__u] < *_M_covered[__v]))
{
- _M_covered[__v] = _ResultsPtr(new _ResultsVec(*_M_covered[__u]));
+ _M_covered[__v] =
+ _ResultsPtr(new _ResultsEntry(*_M_covered[__u]));
// if a state is updated, it's outgoing neighbors should be
// reconsidered too. Push them to the queue.
if (!__in_q[__v])
@@ -195,19 +225,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
};
+ // Identical to DFS's switch part.
switch (__state._M_opcode)
{
+ // Needs to maintain quantifier count vector here. A quantifier
+ // must be concerned with a alt node.
case _S_opcode_alternative:
- __add_visited_state(__state._M_next);
- __add_visited_state(__state._M_alt);
+ {
+ __add_visited_state(__state._M_next);
+ auto __back =
+ _M_covered[__u]->_M_quant_keys[__state._M_quant_index];
+ _M_covered[__u]->_M_inc(__state._M_quant_index,
+ __state._M_neg);
+ __add_visited_state(__state._M_alt);
+ _M_covered[__u]->_M_quant_keys[__state._M_quant_index]
+ = __back;
+ }
break;
case _S_opcode_subexpr_begin:
{
- auto& __cu = *_M_covered[__u];
- auto __back = __cu[__state._M_subexpr].first;
- __cu[__state._M_subexpr].first = __current;
- __add_visited_state(__state._M_next);
- __cu[__state._M_subexpr].first = __back;
+ auto& __sub = (*_M_covered[__u])[__state._M_subexpr];
+ if (!__sub.matched || __sub.first != __current)
+ {
+ auto __back = __sub.first;
+ __sub.first = __current;
+ __add_visited_state(__state._M_next);
+ __sub.first = __back;
+ }
}
break;
case _S_opcode_subexpr_end:
@@ -220,10 +264,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__cu[__state._M_subexpr] = __back;
}
break;
+ case _S_opcode_line_begin_assertion:
+ if (this->_M_at_begin())
+ __add_visited_state(__state._M_next);
+ break;
+ case _S_opcode_line_end_assertion:
+ if (this->_M_at_end())
+ __add_visited_state(__state._M_next);
+ break;
+ case _S_opcode_word_boundry:
+ if (this->_M_word_boundry(__state) == !__state._M_neg)
+ __add_visited_state(__state._M_next);
+ break;
+ case _S_opcode_subexpr_lookahead:
+ if (this->_M_lookahead(__state) == !__state._M_neg)
+ __add_visited_state(__state._M_next);
+ break;
case _S_opcode_match:
break;
case _S_opcode_accept:
- __add_visited_state(__state._M_next);
break;
default:
_GLIBCXX_DEBUG_ASSERT(false);
@@ -244,7 +303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& __state._M_matches(*this->_M_current))
if (__state._M_next != _S_invalid_state_id)
if (__next.count(__state._M_next) == 0
- || _M_match_less_than(*__it.second, *__next[__state._M_next]))
+ || *__it.second < *__next[__state._M_next])
__next[__state._M_next] = move(__it.second);
}
_M_covered = move(__next);
@@ -253,37 +312,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _BiIter, typename _Alloc,
typename _CharT, typename _TraitsT>
bool _BFSExecutor<_BiIter, _Alloc, _CharT, _TraitsT>::
- _M_match_less_than(const _ResultsVec& __u, const _ResultsVec& __v) const
- {
- // TODO: Greedy and Non-greedy support
- _GLIBCXX_DEBUG_ASSERT(__u.size() == __v.size());
- auto __size = __u.size();
- for (auto __i = 0; __i < __size; __i++)
- {
- auto __uit = __u[__i], __vit = __v[__i];
- if (__uit.matched && !__vit.matched)
- return true;
- if (!__uit.matched && __vit.matched)
- return false;
- if (__uit.matched && __vit.matched)
- {
- // GREEDY
- if (__uit.first != __vit.first)
- return __uit.first < __vit.first;
- if (__uit.second != __vit.second)
- return __uit.second > __vit.second;
- }
- }
- return false;
- }
-
- template<typename _BiIter, typename _Alloc,
- typename _CharT, typename _TraitsT>
- bool _BFSExecutor<_BiIter, _Alloc, _CharT, _TraitsT>::
- _M_includes_some() const
+ _M_includes_some()
{
auto& __s = _M_nfa._M_final_states();
auto& __t = _M_covered;
+ bool __succ = false;
if (__s.size() > 0 && __t.size() > 0)
{
auto __first = __s.begin();
@@ -292,16 +325,75 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (*__first < __second->first)
++__first;
- else if (__second->first < *__first)
+ else if (*__first > __second->first)
++__second;
else
{
- this->_M_results = *__second->second;
- return true;
+ if (_M_cur_results == nullptr
+ || *__second->second < *_M_cur_results)
+ _M_cur_results =
+ _ResultsPtr(new _ResultsEntry(*__second->second));
+ __succ = true;
+ ++__first;
+ ++__second;
}
}
}
- return false;
+ return __succ;
+ }
+
+ // Return whether now is at some word boundry.
+ template<typename _BiIter, typename _Alloc,
+ typename _CharT, typename _TraitsT>
+ bool _Executor<_BiIter, _Alloc, _CharT, _TraitsT>::
+ _M_word_boundry(_State<_CharT, _TraitsT> __state) const
+ {
+ // By definition.
+ bool __ans = false;
+ auto __pre = _M_current;
+ --__pre;
+ if (!(_M_at_begin() && _M_at_end()))
+ if (_M_at_begin())
+ __ans = _M_is_word(*_M_current)
+ && !(_M_flags & regex_constants::match_not_bow);
+ else if (_M_at_end())
+ __ans = _M_is_word(*__pre)
+ && !(_M_flags & regex_constants::match_not_eow);
+ else
+ __ans = _M_is_word(*_M_current)
+ != _M_is_word(*__pre);
+ return __ans;
+ }
+
+ // Return whether now match the given sub-NFA.
+ template<typename _BiIter, typename _Alloc,
+ typename _CharT, typename _TraitsT>
+ bool _Executor<_BiIter, _Alloc, _CharT, _TraitsT>::
+ _M_lookahead(_State<_CharT, _TraitsT> __state) const
+ {
+ auto __sub = __get_executor(this->_M_current,
+ this->_M_end,
+ this->_M_results,
+ this->_M_re,
+ this->_M_flags);
+ __sub->_M_set_start(__state._M_alt);
+ return __sub->_M_search_from_first();
+ }
+
+ template<typename _BiIter, typename _Alloc,
+ typename _CharT, typename _TraitsT>
+ void _Executor<_BiIter, _Alloc, _CharT, _TraitsT>::
+ _M_set_results(_ResultsVec& __cur_results)
+ {
+ if (_M_re.flags() & regex_constants::nosubs)
+ {
+ // truncate
+ __cur_results.resize(3);
+ _M_results.resize(3);
+ }
+ for (unsigned int __i = 0; __i < __cur_results.size(); ++__i)
+ if (__cur_results[__i].matched)
+ _M_results[__i] = __cur_results[__i];
}
template<typename _BiIter, typename _Alloc,
@@ -309,7 +401,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::unique_ptr<_Executor<_BiIter, _Alloc, _CharT, _TraitsT>>
__get_executor(_BiIter __b,
_BiIter __e,
- match_results<_BiIter, _Alloc>& __m,
+ std::vector<sub_match<_BiIter>, _Alloc>& __m,
const basic_regex<_CharT, _TraitsT>& __re,
regex_constants::match_flag_type __flags)
{
@@ -320,9 +412,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
auto __p = std::static_pointer_cast<_NFA<_CharT, _TraitsT>>
(__re._M_automaton);
if (__p->_M_has_backref)
- return _ExecutorPtr(new _DFSExecutorT(__b, __e, __m, *__p,
- __re._M_traits, __flags));
- return _ExecutorPtr(new _BFSExecutorT(__b, __e, __m, *__p, __flags));
+ return _ExecutorPtr(new _DFSExecutorT(__b, __e, __m, __re, __flags));
+ return _ExecutorPtr(new _BFSExecutorT(__b, __e, __m, __re, __flags));
}
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/regex_scanner.h b/libstdc++-v3/include/bits/regex_scanner.h
index 064c1832796..09a18f634a0 100644
--- a/libstdc++-v3/include/bits/regex_scanner.h
+++ b/libstdc++-v3/include/bits/regex_scanner.h
@@ -68,8 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_token_backref,
_S_token_subexpr_begin,
_S_token_subexpr_no_group_begin,
- _S_token_subexpr_lookahead_begin,
- _S_token_subexpr_neg_lookahead_begin,
+ _S_token_subexpr_lookahead_begin, // neg if _M_value[0] == 'n'
_S_token_subexpr_end,
_S_token_bracket_begin,
_S_token_bracket_neg_begin,
@@ -84,10 +83,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_token_or,
_S_token_closure0,
_S_token_closure1,
+ _S_token_ungreedy,
_S_token_line_begin,
_S_token_line_end,
- _S_token_word_bound,
- _S_token_neg_word_bound,
+ _S_token_word_bound, // neg if _M_value[0] == 'n'
_S_token_comma,
_S_token_dup_count,
_S_token_eof,
@@ -175,7 +174,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_StringT _M_value;
bool _M_at_bracket_start;
public:
- // TODO: make them static when this file is stable.
+ // FIXME: make them static when this file is stable.
const std::map<char, _TokenT> _M_token_map;
const std::map<char, char> _M_ecma_escape_map;
const std::map<char, char> _M_awk_escape_map;
diff --git a/libstdc++-v3/include/bits/regex_scanner.tcc b/libstdc++-v3/include/bits/regex_scanner.tcc
index 3303aa56a38..fc8273878ce 100644
--- a/libstdc++-v3/include/bits/regex_scanner.tcc
+++ b/libstdc++-v3/include/bits/regex_scanner.tcc
@@ -28,7 +28,7 @@
* Do not attempt to use it directly. @headername{regex}
*/
-// TODO make comments doxygen format.
+// FIXME make comments doxygen format.
// N3376 specified 6 regex styles: ECMAScript, basic, extended, grep, egrep
// and awk
@@ -210,11 +210,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
++_M_current;
_M_token = _S_token_subexpr_lookahead_begin;
+ _M_value.assign(1, 'p');
}
else if (*_M_current == '!')
{
++_M_current;
- _M_token = _S_token_subexpr_neg_lookahead_begin;
+ _M_token = _S_token_subexpr_lookahead_begin;
+ _M_value.assign(1, 'n');
}
else
__throw_regex_error(regex_constants::error_paren);
@@ -343,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
++_M_current;
}
else
- __throw_regex_error(regex_constants::error_brace);
+ __throw_regex_error(regex_constants::error_badbrace);
}
else if (__c == '}')
{
@@ -351,7 +353,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_token = _S_token_interval_end;
}
else
- __throw_regex_error(regex_constants::error_brace);
+ __throw_regex_error(regex_constants::error_badbrace);
}
template<typename _FwdIter>
@@ -371,9 +373,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_value.assign(1, _M_escape_map.at(__c));
}
else if (__c == 'b')
- _M_token = _S_token_word_bound;
+ {
+ _M_token = _S_token_word_bound;
+ _M_value.assign(1, 'p');
+ }
else if (__c == 'B')
- _M_token = _S_token_neg_word_bound;
+ {
+ _M_token = _S_token_word_bound;
+ _M_value.assign(1, 'n');
+ }
// N3376 28.13
else if (__c == 'd'
|| __c == 'D'
@@ -420,6 +428,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
+ // Differences between styles:
+ // 1) Extended doesn't support backref, but basic does.
template<typename _FwdIter>
void
_Scanner<_FwdIter>::
@@ -441,13 +451,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_eat_escape_awk();
return;
}
- else if (_M_ctype.is(_CtypeT::digit, __c) && __c != '0')
+ else if (_M_is_basic() && _M_ctype.is(_CtypeT::digit, __c) && __c != '0')
{
_M_token = _S_token_backref;
_M_value.assign(1, __c);
}
else
- __throw_regex_error(regex_constants::error_escape);
+ {
+#ifdef __STRICT_ANSI__
+ __throw_regex_error(regex_constants::error_escape);
+#else
+ _M_token = _S_token_ord_char;
+ _M_value.assign(1, __c);
+#endif
+ }
++_M_current;
}
@@ -581,9 +598,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
case _S_token_subexpr_lookahead_begin:
ostr << "lookahead subexpr begin\n";
break;
- case _S_token_subexpr_neg_lookahead_begin:
- ostr << "neg lookahead subexpr begin\n";
- break;
case _S_token_subexpr_end:
ostr << "subexpr end\n";
break;
diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h
index d3759066096..d540e0e67fe 100644
--- a/libstdc++-v3/include/bits/stl_algo.h
+++ b/libstdc++-v3/include/bits/stl_algo.h
@@ -60,10 +60,10 @@
#include <bits/algorithmfwd.h>
#include <bits/stl_heap.h>
#include <bits/stl_tempbuf.h> // for _Temporary_buffer
+#include <bits/predefined_ops.h>
#if __cplusplus >= 201103L
#include <random> // for std::uniform_int_distribution
-#include <functional> // for std::bind
#endif
// See concept_check.h for the __glibcxx_*_requires macros.
@@ -72,129 +72,41 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- /// Swaps the median value of *__a, *__b and *__c to *__a
- template<typename _Iterator>
- void
- __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c)
- {
- // concept requirements
- __glibcxx_function_requires(_LessThanComparableConcept<
- typename iterator_traits<_Iterator>::value_type>)
-
- if (*__a < *__b)
- {
- if (*__b < *__c)
- std::iter_swap(__a, __b);
- else if (*__a < *__c)
- std::iter_swap(__a, __c);
- }
- else if (*__a < *__c)
- return;
- else if (*__b < *__c)
- std::iter_swap(__a, __c);
- else
- std::iter_swap(__a, __b);
- }
-
- /// Swaps the median value of *__a, *__b and *__c under __comp to *__a
+ /// Swaps the median value of *__a, *__b and *__c under __comp to *__result
template<typename _Iterator, typename _Compare>
void
- __move_median_first(_Iterator __a, _Iterator __b, _Iterator __c,
- _Compare __comp)
+ __move_median_to_first(_Iterator __result,_Iterator __a, _Iterator __b,
+ _Iterator __c, _Compare __comp)
{
- // concept requirements
- __glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
- typename iterator_traits<_Iterator>::value_type,
- typename iterator_traits<_Iterator>::value_type>)
-
- if (__comp(*__a, *__b))
+ if (__comp(__a, __b))
{
- if (__comp(*__b, *__c))
- std::iter_swap(__a, __b);
- else if (__comp(*__a, *__c))
- std::iter_swap(__a, __c);
+ if (__comp(__b, __c))
+ std::iter_swap(__result, __b);
+ else if (__comp(__a, __c))
+ std::iter_swap(__result, __c);
+ else
+ std::iter_swap(__result, __a);
}
- else if (__comp(*__a, *__c))
- return;
- else if (__comp(*__b, *__c))
- std::iter_swap(__a, __c);
+ else if (__comp(__a, __c))
+ std::iter_swap(__result, __a);
+ else if (__comp(__b, __c))
+ std::iter_swap(__result, __c);
else
- std::iter_swap(__a, __b);
+ std::iter_swap(__result, __b);
}
- // for_each
-
- /// This is an overload used by find() for the Input Iterator case.
- template<typename _InputIterator, typename _Tp>
- inline _InputIterator
- __find(_InputIterator __first, _InputIterator __last,
- const _Tp& __val, input_iterator_tag)
- {
- while (__first != __last && !(*__first == __val))
- ++__first;
- return __first;
- }
-
- /// This is an overload used by find_if() for the Input Iterator case.
+ /// This is an overload used by find algos for the Input Iterator case.
template<typename _InputIterator, typename _Predicate>
inline _InputIterator
__find_if(_InputIterator __first, _InputIterator __last,
_Predicate __pred, input_iterator_tag)
{
- while (__first != __last && !bool(__pred(*__first)))
+ while (__first != __last && !__pred(__first))
++__first;
return __first;
}
- /// This is an overload used by find() for the RAI case.
- template<typename _RandomAccessIterator, typename _Tp>
- _RandomAccessIterator
- __find(_RandomAccessIterator __first, _RandomAccessIterator __last,
- const _Tp& __val, random_access_iterator_tag)
- {
- typename iterator_traits<_RandomAccessIterator>::difference_type
- __trip_count = (__last - __first) >> 2;
-
- for (; __trip_count > 0; --__trip_count)
- {
- if (*__first == __val)
- return __first;
- ++__first;
-
- if (*__first == __val)
- return __first;
- ++__first;
-
- if (*__first == __val)
- return __first;
- ++__first;
-
- if (*__first == __val)
- return __first;
- ++__first;
- }
-
- switch (__last - __first)
- {
- case 3:
- if (*__first == __val)
- return __first;
- ++__first;
- case 2:
- if (*__first == __val)
- return __first;
- ++__first;
- case 1:
- if (*__first == __val)
- return __first;
- ++__first;
- case 0:
- default:
- return __last;
- }
- }
-
- /// This is an overload used by find_if() for the RAI case.
+ /// This is an overload used by find algos for the RAI case.
template<typename _RandomAccessIterator, typename _Predicate>
_RandomAccessIterator
__find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,
@@ -205,19 +117,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (; __trip_count > 0; --__trip_count)
{
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
}
@@ -225,15 +137,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
switch (__last - __first)
{
case 3:
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
case 2:
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
case 1:
- if (__pred(*__first))
+ if (__pred(__first))
return __first;
++__first;
case 0:
@@ -242,63 +154,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
- /// This is an overload used by find_if_not() for the Input Iterator case.
- template<typename _InputIterator, typename _Predicate>
- inline _InputIterator
- __find_if_not(_InputIterator __first, _InputIterator __last,
- _Predicate __pred, input_iterator_tag)
- {
- while (__first != __last && bool(__pred(*__first)))
- ++__first;
- return __first;
- }
-
- /// This is an overload used by find_if_not() for the RAI case.
- template<typename _RandomAccessIterator, typename _Predicate>
- _RandomAccessIterator
- __find_if_not(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Predicate __pred, random_access_iterator_tag)
+ template<typename _Iterator, typename _Predicate>
+ inline _Iterator
+ __find_if(_Iterator __first, _Iterator __last, _Predicate __pred)
{
- typename iterator_traits<_RandomAccessIterator>::difference_type
- __trip_count = (__last - __first) >> 2;
-
- for (; __trip_count > 0; --__trip_count)
- {
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
-
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
-
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
-
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
- }
-
- switch (__last - __first)
- {
- case 3:
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
- case 2:
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
- case 1:
- if (!bool(__pred(*__first)))
- return __first;
- ++__first;
- case 0:
- default:
- return __last;
- }
+ return __find_if(__first, __last, __pred,
+ std::__iterator_category(__first));
}
/// Provided for stable_partition to use.
@@ -307,8 +168,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__find_if_not(_InputIterator __first, _InputIterator __last,
_Predicate __pred)
{
- return std::__find_if_not(__first, __last, __pred,
- std::__iterator_category(__first));
+ return std::__find_if(__first, __last,
+ __gnu_cxx::__ops::__negate(__pred),
+ std::__iterator_category(__first));
}
/// Like find_if_not(), but uses and updates a count of the
@@ -319,7 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__find_if_not_n(_InputIterator __first, _Distance& __len, _Predicate __pred)
{
for (; __len; --__len, ++__first)
- if (!bool(__pred(*__first)))
+ if (!__pred(__first))
break;
return __first;
}
@@ -370,113 +232,74 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
# define __CheckedCompare(__comp) __comp
#endif
- /**
- * This is an uglified
- * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&)
- * overloaded for forward iterators.
- */
- template<typename _ForwardIterator, typename _Integer, typename _Tp>
- _ForwardIterator
- __search_n(_ForwardIterator __first, _ForwardIterator __last,
- _Integer __count, const _Tp& __val,
- std::forward_iterator_tag)
- {
- __first = _GLIBCXX_STD_A::find(__first, __last, __val);
- while (__first != __last)
- {
- typename iterator_traits<_ForwardIterator>::difference_type
- __n = __count;
- _ForwardIterator __i = __first;
- ++__i;
- while (__i != __last && __n != 1 && *__i == __val)
- {
- ++__i;
- --__n;
- }
- if (__n == 1)
- return __first;
- if (__i == __last)
- return __last;
- __first = _GLIBCXX_STD_A::find(++__i, __last, __val);
- }
- return __last;
- }
- /**
- * This is an uglified
- * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&)
- * overloaded for random access iterators.
- */
- template<typename _RandomAccessIter, typename _Integer, typename _Tp>
- _RandomAccessIter
- __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
- _Integer __count, const _Tp& __val,
- std::random_access_iterator_tag)
+ template<typename _ForwardIterator1, typename _ForwardIterator2,
+ typename _BinaryPredicate>
+ _ForwardIterator1
+ __search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate __predicate)
{
-
- typedef typename std::iterator_traits<_RandomAccessIter>::difference_type
- _DistanceType;
-
- _DistanceType __tailSize = __last - __first;
- const _DistanceType __pattSize = __count;
+ // Test for empty ranges
+ if (__first1 == __last1 || __first2 == __last2)
+ return __first1;
- if (__tailSize < __pattSize)
- return __last;
+ // Test for a pattern of length 1.
+ _ForwardIterator2 __p1(__first2);
+ if (++__p1 == __last2)
+ return std::__find_if(__first1, __last1,
+ __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
- const _DistanceType __skipOffset = __pattSize - 1;
- _RandomAccessIter __lookAhead = __first + __skipOffset;
- __tailSize -= __pattSize;
+ // General case.
+ _ForwardIterator2 __p;
+ _ForwardIterator1 __current = __first1;
- while (1) // the main loop...
+ for (;;)
{
- // __lookAhead here is always pointing to the last element of next
- // possible match.
- while (!(*__lookAhead == __val)) // the skip loop...
- {
- if (__tailSize < __pattSize)
- return __last; // Failure
- __lookAhead += __pattSize;
- __tailSize -= __pattSize;
- }
- _DistanceType __remainder = __skipOffset;
- for (_RandomAccessIter __backTrack = __lookAhead - 1;
- *__backTrack == __val; --__backTrack)
+ __first1 =
+ std::__find_if(__first1, __last1,
+ __gnu_cxx::__ops::__iter_comp_iter(__predicate, __first2));
+
+ if (__first1 == __last1)
+ return __last1;
+
+ __p = __p1;
+ __current = __first1;
+ if (++__current == __last1)
+ return __last1;
+
+ while (__predicate(__current, __p))
{
- if (--__remainder == 0)
- return (__lookAhead - __skipOffset); // Success
+ if (++__p == __last2)
+ return __first1;
+ if (++__current == __last1)
+ return __last1;
}
- if (__remainder > __tailSize)
- return __last; // Failure
- __lookAhead += __remainder;
- __tailSize -= __remainder;
+ ++__first1;
}
+ return __first1;
}
// search_n
/**
- * This is an uglified
- * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&,
- * _BinaryPredicate)
- * overloaded for forward iterators.
+ * This is an helper function for search_n overloaded for forward iterators.
*/
- template<typename _ForwardIterator, typename _Integer, typename _Tp,
- typename _BinaryPredicate>
+ template<typename _ForwardIterator, typename _Integer,
+ typename _UnaryPredicate>
_ForwardIterator
- __search_n(_ForwardIterator __first, _ForwardIterator __last,
- _Integer __count, const _Tp& __val,
- _BinaryPredicate __binary_pred, std::forward_iterator_tag)
+ __search_n_aux(_ForwardIterator __first, _ForwardIterator __last,
+ _Integer __count, _UnaryPredicate __unary_pred,
+ std::forward_iterator_tag)
{
- while (__first != __last && !bool(__binary_pred(*__first, __val)))
- ++__first;
-
+ __first = std::__find_if(__first, __last, __unary_pred);
while (__first != __last)
{
typename iterator_traits<_ForwardIterator>::difference_type
__n = __count;
_ForwardIterator __i = __first;
++__i;
- while (__i != __last && __n != 1 && bool(__binary_pred(*__i, __val)))
+ while (__i != __last && __n != 1 && __unary_pred(__i))
{
++__i;
--__n;
@@ -485,94 +308,63 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __first;
if (__i == __last)
return __last;
- __first = ++__i;
- while (__first != __last
- && !bool(__binary_pred(*__first, __val)))
- ++__first;
+ __first = std::__find_if(++__i, __last, __unary_pred);
}
return __last;
}
/**
- * This is an uglified
- * search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&,
- * _BinaryPredicate)
- * overloaded for random access iterators.
+ * This is an helper function for search_n overloaded for random access
+ * iterators.
*/
- template<typename _RandomAccessIter, typename _Integer, typename _Tp,
- typename _BinaryPredicate>
+ template<typename _RandomAccessIter, typename _Integer,
+ typename _UnaryPredicate>
_RandomAccessIter
- __search_n(_RandomAccessIter __first, _RandomAccessIter __last,
- _Integer __count, const _Tp& __val,
- _BinaryPredicate __binary_pred, std::random_access_iterator_tag)
+ __search_n_aux(_RandomAccessIter __first, _RandomAccessIter __last,
+ _Integer __count, _UnaryPredicate __unary_pred,
+ std::random_access_iterator_tag)
{
-
typedef typename std::iterator_traits<_RandomAccessIter>::difference_type
_DistanceType;
_DistanceType __tailSize = __last - __first;
- const _DistanceType __pattSize = __count;
-
- if (__tailSize < __pattSize)
- return __last;
+ _DistanceType __remainder = __count;
- const _DistanceType __skipOffset = __pattSize - 1;
- _RandomAccessIter __lookAhead = __first + __skipOffset;
- __tailSize -= __pattSize;
-
- while (1) // the main loop...
+ while (__remainder <= __tailSize) // the main loop...
{
- // __lookAhead here is always pointing to the last element of next
- // possible match.
- while (!bool(__binary_pred(*__lookAhead, __val))) // the skip loop...
- {
- if (__tailSize < __pattSize)
- return __last; // Failure
- __lookAhead += __pattSize;
- __tailSize -= __pattSize;
- }
- _DistanceType __remainder = __skipOffset;
- for (_RandomAccessIter __backTrack = __lookAhead - 1;
- __binary_pred(*__backTrack, __val); --__backTrack)
+ __first += __remainder;
+ __tailSize -= __remainder;
+ // __first here is always pointing to one past the last element of
+ // next possible match.
+ _RandomAccessIter __backTrack = __first;
+ while (__unary_pred(--__backTrack))
{
if (--__remainder == 0)
- return (__lookAhead - __skipOffset); // Success
+ return (__first - __count); // Success
}
- if (__remainder > __tailSize)
- return __last; // Failure
- __lookAhead += __remainder;
- __tailSize -= __remainder;
+ __remainder = __count + 1 - (__first - __backTrack);
}
+ return __last; // Failure
}
- // find_end for forward iterators.
- template<typename _ForwardIterator1, typename _ForwardIterator2>
- _ForwardIterator1
- __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2, _ForwardIterator2 __last2,
- forward_iterator_tag, forward_iterator_tag)
+ template<typename _ForwardIterator, typename _Integer,
+ typename _UnaryPredicate>
+ _ForwardIterator
+ __search_n(_ForwardIterator __first, _ForwardIterator __last,
+ _Integer __count,
+ _UnaryPredicate __unary_pred)
{
- if (__first2 == __last2)
- return __last1;
- else
- {
- _ForwardIterator1 __result = __last1;
- while (1)
- {
- _ForwardIterator1 __new_result
- = _GLIBCXX_STD_A::search(__first1, __last1, __first2, __last2);
- if (__new_result == __last1)
- return __result;
- else
- {
- __result = __new_result;
- __first1 = __new_result;
- ++__first1;
- }
- }
- }
+ if (__count <= 0)
+ return __first;
+
+ if (__count == 1)
+ return std::__find_if(__first, __last, __unary_pred);
+
+ return std::__search_n_aux(__first, __last, __count, __unary_pred,
+ std::__iterator_category(__first));
}
+ // find_end for forward iterators.
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
_ForwardIterator1
@@ -583,61 +375,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (__first2 == __last2)
return __last1;
- else
+
+ _ForwardIterator1 __result = __last1;
+ while (1)
{
- _ForwardIterator1 __result = __last1;
- while (1)
+ _ForwardIterator1 __new_result
+ = std::__search(__first1, __last1, __first2, __last2, __comp);
+ if (__new_result == __last1)
+ return __result;
+ else
{
- _ForwardIterator1 __new_result
- = _GLIBCXX_STD_A::search(__first1, __last1, __first2,
- __last2, __comp);
- if (__new_result == __last1)
- return __result;
- else
- {
- __result = __new_result;
- __first1 = __new_result;
- ++__first1;
- }
+ __result = __new_result;
+ __first1 = __new_result;
+ ++__first1;
}
}
}
// find_end for bidirectional iterators (much faster).
- template<typename _BidirectionalIterator1, typename _BidirectionalIterator2>
- _BidirectionalIterator1
- __find_end(_BidirectionalIterator1 __first1,
- _BidirectionalIterator1 __last1,
- _BidirectionalIterator2 __first2,
- _BidirectionalIterator2 __last2,
- bidirectional_iterator_tag, bidirectional_iterator_tag)
- {
- // concept requirements
- __glibcxx_function_requires(_BidirectionalIteratorConcept<
- _BidirectionalIterator1>)
- __glibcxx_function_requires(_BidirectionalIteratorConcept<
- _BidirectionalIterator2>)
-
- typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1;
- typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2;
-
- _RevIterator1 __rlast1(__first1);
- _RevIterator2 __rlast2(__first2);
- _RevIterator1 __rresult = _GLIBCXX_STD_A::search(_RevIterator1(__last1),
- __rlast1,
- _RevIterator2(__last2),
- __rlast2);
-
- if (__rresult == __rlast1)
- return __last1;
- else
- {
- _BidirectionalIterator1 __result = __rresult.base();
- std::advance(__result, -std::distance(__first2, __last2));
- return __result;
- }
- }
-
template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
typename _BinaryPredicate>
_BidirectionalIterator1
@@ -659,9 +414,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RevIterator1 __rlast1(__first1);
_RevIterator2 __rlast2(__first2);
- _RevIterator1 __rresult = std::search(_RevIterator1(__last1), __rlast1,
- _RevIterator2(__last2), __rlast2,
- __comp);
+ _RevIterator1 __rresult = std::__search(_RevIterator1(__last1), __rlast1,
+ _RevIterator2(__last2), __rlast2,
+ __comp);
if (__rresult == __rlast1)
return __last1;
@@ -690,7 +445,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* [__first2,__last2) and returns an iterator to the __first
* element of the sub-sequence, or @p __last1 if the sub-sequence
* is not found. The sub-sequence will be the last such
- * subsequence contained in [__first,__last1).
+ * subsequence contained in [__first1,__last1).
*
* Because the sub-sequence must lie completely within the range @p
* [__first1,__last1) it must start at a position less than @p
@@ -715,7 +470,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::__find_end(__first1, __last1, __first2, __last2,
std::__iterator_category(__first1),
- std::__iterator_category(__first2));
+ std::__iterator_category(__first2),
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -765,7 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::__find_end(__first1, __last1, __first2, __last2,
std::__iterator_category(__first1),
std::__iterator_category(__first2),
- __comp);
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
#if __cplusplus >= 201103L
@@ -841,7 +597,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__find_if_not(__first, __last, __pred);
+ return std::__find_if_not(__first, __last,
+ __gnu_cxx::__ops::__pred_iter(__pred));
}
/**
@@ -910,6 +667,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _Predicate>
+ _OutputIterator
+ __remove_copy_if(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _Predicate __pred)
+ {
+ for (; __first != __last; ++__first)
+ if (!__pred(__first))
+ {
+ *__result = *__first;
+ ++__result;
+ }
+ return __result;
+ }
/**
* @brief Copy a sequence, removing elements of a given value.
@@ -926,7 +697,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are copied is unchanged.
*/
template<typename _InputIterator, typename _OutputIterator, typename _Tp>
- _OutputIterator
+ inline _OutputIterator
remove_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, const _Tp& __value)
{
@@ -938,13 +709,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_InputIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- for (; __first != __last; ++__first)
- if (!(*__first == __value))
- {
- *__result = *__first;
- ++__result;
- }
- return __result;
+ return std::__remove_copy_if(__first, __last, __result,
+ __gnu_cxx::__ops::__iter_equals_val(__value));
}
/**
@@ -964,7 +730,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate>
- _OutputIterator
+ inline _OutputIterator
remove_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result, _Predicate __pred)
{
@@ -976,13 +742,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- for (; __first != __last; ++__first)
- if (!bool(__pred(*__first)))
- {
- *__result = *__first;
- ++__result;
- }
- return __result;
+ return std::__remove_copy_if(__first, __last, __result,
+ __gnu_cxx::__ops::__pred_iter(__pred));
}
#if __cplusplus >= 201103L
@@ -1024,7 +785,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __result;
}
-
template<typename _InputIterator, typename _Size, typename _OutputIterator>
_OutputIterator
__copy_n(_InputIterator __first, _Size __n,
@@ -1126,6 +886,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
#endif
+ template<typename _ForwardIterator, typename _Predicate>
+ _ForwardIterator
+ __remove_if(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred)
+ {
+ __first = std::__find_if(__first, __last, __pred);
+ if (__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ ++__first;
+ for (; __first != __last; ++__first)
+ if (!__pred(__first))
+ {
+ *__result = _GLIBCXX_MOVE(*__first);
+ ++__result;
+ }
+ return __result;
+ }
+
/**
* @brief Remove elements from a sequence.
* @ingroup mutating_algorithms
@@ -1144,7 +923,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Tp>
- _ForwardIterator
+ inline _ForwardIterator
remove(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __value)
{
@@ -1155,18 +934,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- __first = _GLIBCXX_STD_A::find(__first, __last, __value);
- if(__first == __last)
- return __first;
- _ForwardIterator __result = __first;
- ++__first;
- for(; __first != __last; ++__first)
- if(!(*__first == __value))
- {
- *__result = _GLIBCXX_MOVE(*__first);
- ++__result;
- }
- return __result;
+ return std::__remove_if(__first, __last,
+ __gnu_cxx::__ops::__iter_equals_val(__value));
}
/**
@@ -1187,7 +956,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _Predicate>
- _ForwardIterator
+ inline _ForwardIterator
remove_if(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
{
@@ -1198,18 +967,44 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- __first = _GLIBCXX_STD_A::find_if(__first, __last, __pred);
- if(__first == __last)
- return __first;
- _ForwardIterator __result = __first;
+ return std::__remove_if(__first, __last,
+ __gnu_cxx::__ops::__pred_iter(__pred));
+ }
+
+ template<typename _ForwardIterator, typename _BinaryPredicate>
+ _ForwardIterator
+ __adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
+ _BinaryPredicate __binary_pred)
+ {
+ if (__first == __last)
+ return __last;
+ _ForwardIterator __next = __first;
+ while (++__next != __last)
+ {
+ if (__binary_pred(__first, __next))
+ return __first;
+ __first = __next;
+ }
+ return __last;
+ }
+
+ template<typename _ForwardIterator, typename _BinaryPredicate>
+ _ForwardIterator
+ __unique(_ForwardIterator __first, _ForwardIterator __last,
+ _BinaryPredicate __binary_pred)
+ {
+ // Skip the beginning, if already unique.
+ __first = std::__adjacent_find(__first, __last, __binary_pred);
+ if (__first == __last)
+ return __last;
+
+ // Do the real copy work.
+ _ForwardIterator __dest = __first;
++__first;
- for(; __first != __last; ++__first)
- if(!bool(__pred(*__first)))
- {
- *__result = _GLIBCXX_MOVE(*__first);
- ++__result;
- }
- return __result;
+ while (++__first != __last)
+ if (!__binary_pred(__dest, __first))
+ *++__dest = _GLIBCXX_MOVE(*__first);
+ return ++__dest;
}
/**
@@ -1227,7 +1022,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator>
- _ForwardIterator
+ inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
@@ -1237,18 +1032,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- // Skip the beginning, if already unique.
- __first = _GLIBCXX_STD_A::adjacent_find(__first, __last);
- if (__first == __last)
- return __last;
-
- // Do the real copy work.
- _ForwardIterator __dest = __first;
- ++__first;
- while (++__first != __last)
- if (!(*__dest == *__first))
- *++__dest = _GLIBCXX_MOVE(*__first);
- return ++__dest;
+ return std::__unique(__first, __last,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -1267,7 +1052,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* are still present, but their value is unspecified.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
- _ForwardIterator
+ inline _ForwardIterator
unique(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
{
@@ -1279,83 +1064,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- // Skip the beginning, if already unique.
- __first = _GLIBCXX_STD_A::adjacent_find(__first, __last, __binary_pred);
- if (__first == __last)
- return __last;
-
- // Do the real copy work.
- _ForwardIterator __dest = __first;
- ++__first;
- while (++__first != __last)
- if (!bool(__binary_pred(*__dest, *__first)))
- *++__dest = _GLIBCXX_MOVE(*__first);
- return ++__dest;
- }
-
- /**
- * This is an uglified unique_copy(_InputIterator, _InputIterator,
- * _OutputIterator)
- * overloaded for forward iterators and output iterator as result.
- */
- template<typename _ForwardIterator, typename _OutputIterator>
- _OutputIterator
- __unique_copy(_ForwardIterator __first, _ForwardIterator __last,
- _OutputIterator __result,
- forward_iterator_tag, output_iterator_tag)
- {
- // concept requirements -- taken care of in dispatching function
- _ForwardIterator __next = __first;
- *__result = *__first;
- while (++__next != __last)
- if (!(*__first == *__next))
- {
- __first = __next;
- *++__result = *__first;
- }
- return ++__result;
- }
-
- /**
- * This is an uglified unique_copy(_InputIterator, _InputIterator,
- * _OutputIterator)
- * overloaded for input iterators and output iterator as result.
- */
- template<typename _InputIterator, typename _OutputIterator>
- _OutputIterator
- __unique_copy(_InputIterator __first, _InputIterator __last,
- _OutputIterator __result,
- input_iterator_tag, output_iterator_tag)
- {
- // concept requirements -- taken care of in dispatching function
- typename iterator_traits<_InputIterator>::value_type __value = *__first;
- *__result = __value;
- while (++__first != __last)
- if (!(__value == *__first))
- {
- __value = *__first;
- *++__result = __value;
- }
- return ++__result;
- }
-
- /**
- * This is an uglified unique_copy(_InputIterator, _InputIterator,
- * _OutputIterator)
- * overloaded for input iterators and forward iterator as result.
- */
- template<typename _InputIterator, typename _ForwardIterator>
- _ForwardIterator
- __unique_copy(_InputIterator __first, _InputIterator __last,
- _ForwardIterator __result,
- input_iterator_tag, forward_iterator_tag)
- {
- // concept requirements -- taken care of in dispatching function
- *__result = *__first;
- while (++__first != __last)
- if (!(*__result == *__first))
- *++__result = *__first;
- return ++__result;
+ return std::__unique(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
}
/**
@@ -1379,7 +1089,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_ForwardIterator __next = __first;
*__result = *__first;
while (++__next != __last)
- if (!bool(__binary_pred(*__first, *__next)))
+ if (!__binary_pred(__first, __next))
{
__first = __next;
*++__result = *__first;
@@ -1406,9 +1116,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_InputIterator>::value_type>)
typename iterator_traits<_InputIterator>::value_type __value = *__first;
+ __decltype(__gnu_cxx::__ops::__iter_comp_val(__binary_pred))
+ __rebound_pred
+ = __gnu_cxx::__ops::__iter_comp_val(__binary_pred);
*__result = __value;
while (++__first != __last)
- if (!bool(__binary_pred(__value, *__first)))
+ if (!__rebound_pred(__first, __value))
{
__value = *__first;
*++__result = __value;
@@ -1433,10 +1146,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
typename iterator_traits<_ForwardIterator>::value_type,
typename iterator_traits<_InputIterator>::value_type>)
-
*__result = *__first;
while (++__first != __last)
- if (!bool(__binary_pred(*__result, *__first)))
+ if (!__binary_pred(__result, __first))
*++__result = *__first;
return ++__result;
}
@@ -1738,9 +1450,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_valid_range(__first, __middle);
__glibcxx_requires_valid_range(__middle, __last);
- typedef typename iterator_traits<_ForwardIterator>::iterator_category
- _IterType;
- std::__rotate(__first, __middle, __last, _IterType());
+ std::__rotate(__first, __middle, __last,
+ std::__iterator_category(__first));
}
/**
@@ -1764,7 +1475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* for each @p n in the range @p [0,__last-__first).
*/
template<typename _ForwardIterator, typename _OutputIterator>
- _OutputIterator
+ inline _OutputIterator
rotate_copy(_ForwardIterator __first, _ForwardIterator __middle,
_ForwardIterator __last, _OutputIterator __result)
{
@@ -1863,10 +1574,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function...
- /// Requires __first != __last and !__pred(*__first)
+ /// Requires __first != __last and !__pred(__first)
/// and __len == distance(__first, __last).
///
- /// !__pred(*__first) allows us to guarantee that we don't
+ /// !__pred(__first) allows us to guarantee that we don't
/// move-assign an element onto itself.
template<typename _ForwardIterator, typename _Pointer, typename _Predicate,
typename _Distance>
@@ -1881,14 +1592,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_ForwardIterator __result1 = __first;
_Pointer __result2 = __buffer;
- // The precondition guarantees that !__pred(*__first), so
+ // The precondition guarantees that !__pred(__first), so
// move that element to the buffer before starting the loop.
// This ensures that we only call __pred once per element.
*__result2 = _GLIBCXX_MOVE(*__first);
++__result2;
++__first;
for (; __first != __last; ++__first)
- if (__pred(*__first))
+ if (__pred(__first))
{
*__result1 = _GLIBCXX_MOVE(*__first);
++__result1;
@@ -1925,6 +1636,34 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
+ template<typename _ForwardIterator, typename _Predicate>
+ _ForwardIterator
+ __stable_partition(_ForwardIterator __first, _ForwardIterator __last,
+ _Predicate __pred)
+ {
+ __first = std::__find_if_not(__first, __last, __pred);
+
+ if (__first == __last)
+ return __first;
+
+ typedef typename iterator_traits<_ForwardIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
+ _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first, __last);
+ if (__buf.size() > 0)
+ return
+ std::__stable_partition_adaptive(__first, __last, __pred,
+ _DistanceType(__buf.requested_size()),
+ __buf.begin(),
+ _DistanceType(__buf.size()));
+ else
+ return
+ std::__inplace_stable_partition(__first, __pred,
+ _DistanceType(__buf.requested_size()));
+ }
+
/**
* @brief Move elements for which a predicate is true to the beginning
* of a sequence, preserving relative ordering.
@@ -1943,7 +1682,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* relative ordering after calling @p stable_partition().
*/
template<typename _ForwardIterator, typename _Predicate>
- _ForwardIterator
+ inline _ForwardIterator
stable_partition(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred)
{
@@ -1954,43 +1693,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- __first = std::__find_if_not(__first, __last, __pred);
-
- if (__first == __last)
- return __first;
- else
- {
- typedef typename iterator_traits<_ForwardIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_ForwardIterator>::difference_type
- _DistanceType;
-
- _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first,
- __last);
- if (__buf.size() > 0)
- return
- std::__stable_partition_adaptive(__first, __last, __pred,
- _DistanceType(__buf.requested_size()),
- __buf.begin(),
- _DistanceType(__buf.size()));
- else
- return
- std::__inplace_stable_partition(__first, __pred,
- _DistanceType(__buf.requested_size()));
- }
- }
-
- /// This is a helper function for the sort routines.
- template<typename _RandomAccessIterator>
- void
- __heap_select(_RandomAccessIterator __first,
- _RandomAccessIterator __middle,
- _RandomAccessIterator __last)
- {
- std::make_heap(__first, __middle);
- for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)
- if (*__i < *__first)
- std::__pop_heap(__first, __middle, __i);
+ return std::__stable_partition(__first, __last,
+ __gnu_cxx::__ops::__pred_iter(__pred));
}
/// This is a helper function for the sort routines.
@@ -2000,14 +1704,51 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RandomAccessIterator __middle,
_RandomAccessIterator __last, _Compare __comp)
{
- std::make_heap(__first, __middle, __comp);
+ std::__make_heap(__first, __middle, __comp);
for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)
- if (__comp(*__i, *__first))
+ if (__comp(__i, __first))
std::__pop_heap(__first, __middle, __i, __comp);
}
// partial_sort
+ template<typename _InputIterator, typename _RandomAccessIterator,
+ typename _Compare>
+ _RandomAccessIterator
+ __partial_sort_copy(_InputIterator __first, _InputIterator __last,
+ _RandomAccessIterator __result_first,
+ _RandomAccessIterator __result_last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_InputIterator>::value_type
+ _InputValueType;
+ typedef iterator_traits<_RandomAccessIterator> _RItTraits;
+ typedef typename _RItTraits::difference_type _DistanceType;
+
+ if (__result_first == __result_last)
+ return __result_last;
+ _RandomAccessIterator __result_real_last = __result_first;
+ while (__first != __last && __result_real_last != __result_last)
+ {
+ *__result_real_last = *__first;
+ ++__result_real_last;
+ ++__first;
+ }
+
+ std::__make_heap(__result_first, __result_real_last, __comp);
+ while (__first != __last)
+ {
+ if (__comp(__first, __result_first))
+ std::__adjust_heap(__result_first, _DistanceType(0),
+ _DistanceType(__result_real_last
+ - __result_first),
+ _InputValueType(*__first), __comp);
+ ++__first;
+ }
+ std::__sort_heap(__result_first, __result_real_last, __comp);
+ return __result_real_last;
+ }
+
/**
* @brief Copy the smallest elements of a sequence.
* @ingroup sorting_algorithms
@@ -2027,7 +1768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* The value returned is @p __result_first+N.
*/
template<typename _InputIterator, typename _RandomAccessIterator>
- _RandomAccessIterator
+ inline _RandomAccessIterator
partial_sort_copy(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __result_first,
_RandomAccessIterator __result_last)
@@ -2049,27 +1790,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_valid_range(__result_first, __result_last);
- if (__result_first == __result_last)
- return __result_last;
- _RandomAccessIterator __result_real_last = __result_first;
- while(__first != __last && __result_real_last != __result_last)
- {
- *__result_real_last = *__first;
- ++__result_real_last;
- ++__first;
- }
- std::make_heap(__result_first, __result_real_last);
- while (__first != __last)
- {
- if (*__first < *__result_first)
- std::__adjust_heap(__result_first, _DistanceType(0),
- _DistanceType(__result_real_last
- - __result_first),
- _InputValueType(*__first));
- ++__first;
- }
- std::sort_heap(__result_first, __result_real_last);
- return __result_real_last;
+ return std::__partial_sort_copy(__first, __last,
+ __result_first, __result_last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -2092,8 +1815,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @p __comp(*j,*i) is false.
* The value returned is @p __result_first+N.
*/
- template<typename _InputIterator, typename _RandomAccessIterator, typename _Compare>
- _RandomAccessIterator
+ template<typename _InputIterator, typename _RandomAccessIterator,
+ typename _Compare>
+ inline _RandomAccessIterator
partial_sort_copy(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __result_first,
_RandomAccessIterator __result_last,
@@ -2119,48 +1843,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_valid_range(__result_first, __result_last);
- if (__result_first == __result_last)
- return __result_last;
- _RandomAccessIterator __result_real_last = __result_first;
- while(__first != __last && __result_real_last != __result_last)
- {
- *__result_real_last = *__first;
- ++__result_real_last;
- ++__first;
- }
- std::make_heap(__result_first, __result_real_last,
- __CheckedCompare(__comp));
- while (__first != __last)
- {
- if (__CheckedCompare(__comp)(*__first, *__result_first))
- std::__adjust_heap(__result_first, _DistanceType(0),
- _DistanceType(__result_real_last
- - __result_first),
- _InputValueType(*__first),
- __CheckedCompare(__comp));
- ++__first;
- }
- std::sort_heap(__result_first, __result_real_last,
- __CheckedCompare(__comp));
- return __result_real_last;
- }
-
- /// This is a helper function for the sort routine.
- template<typename _RandomAccessIterator>
- void
- __unguarded_linear_insert(_RandomAccessIterator __last)
- {
- typename iterator_traits<_RandomAccessIterator>::value_type
- __val = _GLIBCXX_MOVE(*__last);
- _RandomAccessIterator __next = __last;
- --__next;
- while (__val < *__next)
- {
- *__last = _GLIBCXX_MOVE(*__next);
- __last = __next;
- --__next;
- }
- *__last = _GLIBCXX_MOVE(__val);
+ return std::__partial_sort_copy(__first, __last,
+ __result_first, __result_last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
/// This is a helper function for the sort routine.
@@ -2173,7 +1858,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__val = _GLIBCXX_MOVE(*__last);
_RandomAccessIterator __next = __last;
--__next;
- while (__comp(__val, *__next))
+ while (__comp(__val, __next))
{
*__last = _GLIBCXX_MOVE(*__next);
__last = __next;
@@ -2183,29 +1868,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function for the sort routine.
- template<typename _RandomAccessIterator>
- void
- __insertion_sort(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
- {
- if (__first == __last)
- return;
-
- for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
- {
- if (*__i < *__first)
- {
- typename iterator_traits<_RandomAccessIterator>::value_type
- __val = _GLIBCXX_MOVE(*__i);
- _GLIBCXX_MOVE_BACKWARD3(__first, __i, __i + 1);
- *__first = _GLIBCXX_MOVE(__val);
- }
- else
- std::__unguarded_linear_insert(__i);
- }
- }
-
- /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
void
__insertion_sort(_RandomAccessIterator __first,
@@ -2215,7 +1877,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
{
- if (__comp(*__i, *__first))
+ if (__comp(__i, __first))
{
typename iterator_traits<_RandomAccessIterator>::value_type
__val = _GLIBCXX_MOVE(*__i);
@@ -2223,34 +1885,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*__first = _GLIBCXX_MOVE(__val);
}
else
- std::__unguarded_linear_insert(__i, __comp);
+ std::__unguarded_linear_insert(__i,
+ __gnu_cxx::__ops::__val_comp_iter(__comp));
}
}
/// This is a helper function for the sort routine.
- template<typename _RandomAccessIterator>
- inline void
- __unguarded_insertion_sort(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
- {
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
- for (_RandomAccessIterator __i = __first; __i != __last; ++__i)
- std::__unguarded_linear_insert(__i);
- }
-
- /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
inline void
__unguarded_insertion_sort(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
for (_RandomAccessIterator __i = __first; __i != __last; ++__i)
- std::__unguarded_linear_insert(__i, __comp);
+ std::__unguarded_linear_insert(__i,
+ __gnu_cxx::__ops::__val_comp_iter(__comp));
}
/**
@@ -2260,21 +1908,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
enum { _S_threshold = 16 };
/// This is a helper function for the sort routine.
- template<typename _RandomAccessIterator>
- void
- __final_insertion_sort(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
- {
- if (__last - __first > int(_S_threshold))
- {
- std::__insertion_sort(__first, __first + int(_S_threshold));
- std::__unguarded_insertion_sort(__first + int(_S_threshold), __last);
- }
- else
- std::__insertion_sort(__first, __last);
- }
-
- /// This is a helper function for the sort routine.
template<typename _RandomAccessIterator, typename _Compare>
void
__final_insertion_sort(_RandomAccessIterator __first,
@@ -2291,38 +1924,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function...
- template<typename _RandomAccessIterator, typename _Tp>
- _RandomAccessIterator
- __unguarded_partition(_RandomAccessIterator __first,
- _RandomAccessIterator __last, const _Tp& __pivot)
- {
- while (true)
- {
- while (*__first < __pivot)
- ++__first;
- --__last;
- while (__pivot < *__last)
- --__last;
- if (!(__first < __last))
- return __first;
- std::iter_swap(__first, __last);
- ++__first;
- }
- }
-
- /// This is a helper function...
- template<typename _RandomAccessIterator, typename _Tp, typename _Compare>
+ template<typename _RandomAccessIterator, typename _Compare>
_RandomAccessIterator
__unguarded_partition(_RandomAccessIterator __first,
_RandomAccessIterator __last,
- const _Tp& __pivot, _Compare __comp)
+ _RandomAccessIterator __pivot, _Compare __comp)
{
while (true)
{
- while (__comp(*__first, __pivot))
+ while (__comp(__first, __pivot))
++__first;
--__last;
- while (__comp(__pivot, *__last))
+ while (__comp(__pivot, __last))
--__last;
if (!(__first < __last))
return __first;
@@ -2332,48 +1945,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function...
- template<typename _RandomAccessIterator>
- inline _RandomAccessIterator
- __unguarded_partition_pivot(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
- {
- _RandomAccessIterator __mid = __first + (__last - __first) / 2;
- std::__move_median_first(__first, __mid, (__last - 1));
- return std::__unguarded_partition(__first + 1, __last, *__first);
- }
-
-
- /// This is a helper function...
template<typename _RandomAccessIterator, typename _Compare>
inline _RandomAccessIterator
__unguarded_partition_pivot(_RandomAccessIterator __first,
_RandomAccessIterator __last, _Compare __comp)
{
_RandomAccessIterator __mid = __first + (__last - __first) / 2;
- std::__move_median_first(__first, __mid, (__last - 1), __comp);
- return std::__unguarded_partition(__first + 1, __last, *__first, __comp);
+ std::__move_median_to_first(__first, __first + 1, __mid, (__last - 2),
+ __comp);
+ return std::__unguarded_partition(__first + 1, __last, __first, __comp);
}
- /// This is a helper function for the sort routine.
- template<typename _RandomAccessIterator, typename _Size>
- void
- __introsort_loop(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Size __depth_limit)
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ __partial_sort(_RandomAccessIterator __first,
+ _RandomAccessIterator __middle,
+ _RandomAccessIterator __last,
+ _Compare __comp)
{
- while (__last - __first > int(_S_threshold))
- {
- if (__depth_limit == 0)
- {
- _GLIBCXX_STD_A::partial_sort(__first, __last, __last);
- return;
- }
- --__depth_limit;
- _RandomAccessIterator __cut =
- std::__unguarded_partition_pivot(__first, __last);
- std::__introsort_loop(__cut, __last, __depth_limit);
- __last = __cut;
- }
+ std::__heap_select(__first, __middle, __last, __comp);
+ std::__sort_heap(__first, __middle, __comp);
}
/// This is a helper function for the sort routine.
@@ -2387,7 +1978,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
if (__depth_limit == 0)
{
- _GLIBCXX_STD_A::partial_sort(__first, __last, __last, __comp);
+ std::__partial_sort(__first, __last, __last, __comp);
return;
}
--__depth_limit;
@@ -2400,33 +1991,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// sort
- template<typename _RandomAccessIterator, typename _Size>
- void
- __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth,
- _RandomAccessIterator __last, _Size __depth_limit)
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
- while (__last - __first > 3)
+ if (__first != __last)
{
- if (__depth_limit == 0)
- {
- std::__heap_select(__first, __nth + 1, __last);
-
- // Place the nth largest element in its final position.
- std::iter_swap(__first, __nth);
- return;
- }
- --__depth_limit;
- _RandomAccessIterator __cut =
- std::__unguarded_partition_pivot(__first, __last);
- if (__cut <= __nth)
- __first = __cut;
- else
- __last = __cut;
+ std::__introsort_loop(__first, __last,
+ std::__lg(__last - __first) * 2,
+ __comp);
+ std::__final_insertion_sort(__first, __last, __comp);
}
- std::__insertion_sort(__first, __last);
}
template<typename _RandomAccessIterator, typename _Size, typename _Compare>
@@ -2435,9 +2011,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RandomAccessIterator __last, _Size __depth_limit,
_Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
while (__last - __first > 3)
{
if (__depth_limit == 0)
@@ -2479,14 +2052,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- _ForwardIterator
+ inline _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
{
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- typedef typename iterator_traits<_ForwardIterator>::difference_type
- _DistanceType;
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
@@ -2495,6 +2066,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_partitioned_lower_pred(__first, __last,
__val, __comp);
+ return std::__lower_bound(__first, __last, __val,
+ __gnu_cxx::__ops::__iter_comp_val(__CheckedCompare(__comp)));
+ }
+
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
+ _ForwardIterator
+ __upper_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val, _Compare __comp)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
_DistanceType __len = std::distance(__first, __last);
while (__len > 0)
@@ -2502,14 +2085,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_DistanceType __half = __len >> 1;
_ForwardIterator __middle = __first;
std::advance(__middle, __half);
- if (__CheckedCompare(__comp)(*__middle, __val))
+ if (__comp(__val, __middle))
+ __len = __half;
+ else
{
__first = __middle;
++__first;
__len = __len - __half - 1;
}
- else
- __len = __half;
}
return __first;
}
@@ -2526,37 +2109,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup binary_search_algorithms
*/
template<typename _ForwardIterator, typename _Tp>
- _ForwardIterator
+ inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
{
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- typedef typename iterator_traits<_ForwardIterator>::difference_type
- _DistanceType;
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)
__glibcxx_requires_partitioned_upper(__first, __last, __val);
- _DistanceType __len = std::distance(__first, __last);
-
- while (__len > 0)
- {
- _DistanceType __half = __len >> 1;
- _ForwardIterator __middle = __first;
- std::advance(__middle, __half);
- if (__val < *__middle)
- __len = __half;
- else
- {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- }
- return __first;
+ return std::__upper_bound(__first, __last, __val,
+ __gnu_cxx::__ops::__val_less_iter());
}
/**
@@ -2575,14 +2141,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the function used for the initial sort.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- _ForwardIterator
+ inline _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
{
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- typedef typename iterator_traits<_ForwardIterator>::difference_type
- _DistanceType;
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
@@ -2591,6 +2155,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_partitioned_upper_pred(__first, __last,
__val, __comp);
+ return std::__upper_bound(__first, __last, __val,
+ __gnu_cxx::__ops::__val_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _ForwardIterator, typename _Tp,
+ typename _CompareItTp, typename _CompareTpIt>
+ pair<_ForwardIterator, _ForwardIterator>
+ __equal_range(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val,
+ _CompareItTp __comp_it_val, _CompareTpIt __comp_val_it)
+ {
+ typedef typename iterator_traits<_ForwardIterator>::difference_type
+ _DistanceType;
+
_DistanceType __len = std::distance(__first, __last);
while (__len > 0)
@@ -2598,16 +2176,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_DistanceType __half = __len >> 1;
_ForwardIterator __middle = __first;
std::advance(__middle, __half);
- if (__CheckedCompare(__comp)(__val, *__middle))
- __len = __half;
- else
+ if (__comp_it_val(__middle, __val))
{
__first = __middle;
++__first;
__len = __len - __half - 1;
}
+ else if (__comp_val_it(__val, __middle))
+ __len = __half;
+ else
+ {
+ _ForwardIterator __left
+ = std::__lower_bound(__first, __middle, __val, __comp_it_val);
+ std::advance(__first, __len);
+ _ForwardIterator __right
+ = std::__upper_bound(++__middle, __first, __val, __comp_val_it);
+ return pair<_ForwardIterator, _ForwardIterator>(__left, __right);
+ }
}
- return __first;
+ return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
}
/**
@@ -2628,48 +2215,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* but does not actually call those functions.
*/
template<typename _ForwardIterator, typename _Tp>
- pair<_ForwardIterator, _ForwardIterator>
+ inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val)
{
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- typedef typename iterator_traits<_ForwardIterator>::difference_type
- _DistanceType;
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)
- __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)
+ __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)
__glibcxx_requires_partitioned_lower(__first, __last, __val);
__glibcxx_requires_partitioned_upper(__first, __last, __val);
- _DistanceType __len = std::distance(__first, __last);
-
- while (__len > 0)
- {
- _DistanceType __half = __len >> 1;
- _ForwardIterator __middle = __first;
- std::advance(__middle, __half);
- if (*__middle < __val)
- {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else if (__val < *__middle)
- __len = __half;
- else
- {
- _ForwardIterator __left = std::lower_bound(__first, __middle,
- __val);
- std::advance(__first, __len);
- _ForwardIterator __right = std::upper_bound(++__middle, __first,
- __val);
- return pair<_ForwardIterator, _ForwardIterator>(__left, __right);
- }
- }
- return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
+ return std::__equal_range(__first, __last, __val,
+ __gnu_cxx::__ops::__iter_less_val(),
+ __gnu_cxx::__ops::__val_less_iter());
}
/**
@@ -2690,14 +2252,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* but does not actually call those functions.
*/
template<typename _ForwardIterator, typename _Tp, typename _Compare>
- pair<_ForwardIterator, _ForwardIterator>
+ inline pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last,
const _Tp& __val, _Compare __comp)
{
typedef typename iterator_traits<_ForwardIterator>::value_type
_ValueType;
- typedef typename iterator_traits<_ForwardIterator>::difference_type
- _DistanceType;
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
@@ -2710,32 +2270,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_partitioned_upper_pred(__first, __last,
__val, __comp);
- _DistanceType __len = std::distance(__first, __last);
-
- while (__len > 0)
- {
- _DistanceType __half = __len >> 1;
- _ForwardIterator __middle = __first;
- std::advance(__middle, __half);
- if (__CheckedCompare(__comp)(*__middle, __val))
- {
- __first = __middle;
- ++__first;
- __len = __len - __half - 1;
- }
- else if (__CheckedCompare(__comp)(__val, *__middle))
- __len = __half;
- else
- {
- _ForwardIterator __left = std::lower_bound(__first, __middle,
- __val, __comp);
- std::advance(__first, __len);
- _ForwardIterator __right = std::upper_bound(++__middle, __first,
- __val, __comp);
- return pair<_ForwardIterator, _ForwardIterator>(__left, __right);
- }
- }
- return pair<_ForwardIterator, _ForwardIterator>(__first, __first);
+ return std::__equal_range(__first, __last, __val,
+ __gnu_cxx::__ops::__iter_comp_val(__CheckedCompare(__comp)),
+ __gnu_cxx::__ops::__val_comp_iter(__CheckedCompare(__comp)));
}
/**
@@ -2764,7 +2301,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_partitioned_lower(__first, __last, __val);
__glibcxx_requires_partitioned_upper(__first, __last, __val);
- _ForwardIterator __i = std::lower_bound(__first, __last, __val);
+ _ForwardIterator __i
+ = std::__lower_bound(__first, __last, __val,
+ __gnu_cxx::__ops::__iter_less_val());
return __i != __last && !(__val < *__i);
}
@@ -2800,40 +2339,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_partitioned_upper_pred(__first, __last,
__val, __comp);
- _ForwardIterator __i = std::lower_bound(__first, __last, __val, __comp);
- return __i != __last && !bool(__CheckedCompare(__comp)(__val, *__i));
+ _ForwardIterator __i
+ = std::__lower_bound(__first, __last, __val,
+ __gnu_cxx::__ops::__iter_comp_val(__CheckedCompare(__comp)));
+ return __i != __last && !bool(__comp(__val, *__i));
}
// merge
/// This is a helper function for the __merge_adaptive routines.
template<typename _InputIterator1, typename _InputIterator2,
- typename _OutputIterator>
- void
- __move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
- _OutputIterator __result)
- {
- while (__first1 != __last1 && __first2 != __last2)
- {
- if (*__first2 < *__first1)
- {
- *__result = _GLIBCXX_MOVE(*__first2);
- ++__first2;
- }
- else
- {
- *__result = _GLIBCXX_MOVE(*__first1);
- ++__first1;
- }
- ++__result;
- }
- if (__first1 != __last1)
- _GLIBCXX_MOVE3(__first1, __last1, __result);
- }
-
- /// This is a helper function for the __merge_adaptive routines.
- template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
void
__move_merge_adaptive(_InputIterator1 __first1, _InputIterator1 __last1,
@@ -2842,7 +2357,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(*__first2, *__first1))
+ if (__comp(__first2, __first1))
{
*__result = _GLIBCXX_MOVE(*__first2);
++__first2;
@@ -2860,48 +2375,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// This is a helper function for the __merge_adaptive routines.
template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
- typename _BidirectionalIterator3>
- void
- __move_merge_adaptive_backward(_BidirectionalIterator1 __first1,
- _BidirectionalIterator1 __last1,
- _BidirectionalIterator2 __first2,
- _BidirectionalIterator2 __last2,
- _BidirectionalIterator3 __result)
- {
- if (__first1 == __last1)
- {
- _GLIBCXX_MOVE_BACKWARD3(__first2, __last2, __result);
- return;
- }
- else if (__first2 == __last2)
- return;
-
- --__last1;
- --__last2;
- while (true)
- {
- if (*__last2 < *__last1)
- {
- *--__result = _GLIBCXX_MOVE(*__last1);
- if (__first1 == __last1)
- {
- _GLIBCXX_MOVE_BACKWARD3(__first2, ++__last2, __result);
- return;
- }
- --__last1;
- }
- else
- {
- *--__result = _GLIBCXX_MOVE(*__last2);
- if (__first2 == __last2)
- return;
- --__last2;
- }
- }
- }
-
- /// This is a helper function for the __merge_adaptive routines.
- template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,
typename _BidirectionalIterator3, typename _Compare>
void
__move_merge_adaptive_backward(_BidirectionalIterator1 __first1,
@@ -2923,7 +2396,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
--__last2;
while (true)
{
- if (__comp(*__last2, *__last1))
+ if (__comp(__last2, __last1))
{
*--__result = _GLIBCXX_MOVE(*__last1);
if (__first1 == __last1)
@@ -2986,62 +2459,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function for the merge routines.
- template<typename _BidirectionalIterator, typename _Distance,
- typename _Pointer>
- void
- __merge_adaptive(_BidirectionalIterator __first,
- _BidirectionalIterator __middle,
- _BidirectionalIterator __last,
- _Distance __len1, _Distance __len2,
- _Pointer __buffer, _Distance __buffer_size)
- {
- if (__len1 <= __len2 && __len1 <= __buffer_size)
- {
- _Pointer __buffer_end = _GLIBCXX_MOVE3(__first, __middle, __buffer);
- std::__move_merge_adaptive(__buffer, __buffer_end, __middle, __last,
- __first);
- }
- else if (__len2 <= __buffer_size)
- {
- _Pointer __buffer_end = _GLIBCXX_MOVE3(__middle, __last, __buffer);
- std::__move_merge_adaptive_backward(__first, __middle, __buffer,
- __buffer_end, __last);
- }
- else
- {
- _BidirectionalIterator __first_cut = __first;
- _BidirectionalIterator __second_cut = __middle;
- _Distance __len11 = 0;
- _Distance __len22 = 0;
- if (__len1 > __len2)
- {
- __len11 = __len1 / 2;
- std::advance(__first_cut, __len11);
- __second_cut = std::lower_bound(__middle, __last,
- *__first_cut);
- __len22 = std::distance(__middle, __second_cut);
- }
- else
- {
- __len22 = __len2 / 2;
- std::advance(__second_cut, __len22);
- __first_cut = std::upper_bound(__first, __middle,
- *__second_cut);
- __len11 = std::distance(__first, __first_cut);
- }
- _BidirectionalIterator __new_middle =
- std::__rotate_adaptive(__first_cut, __middle, __second_cut,
- __len1 - __len11, __len22, __buffer,
- __buffer_size);
- std::__merge_adaptive(__first, __first_cut, __new_middle, __len11,
- __len22, __buffer, __buffer_size);
- std::__merge_adaptive(__new_middle, __second_cut, __last,
- __len1 - __len11,
- __len2 - __len22, __buffer, __buffer_size);
- }
- }
-
- /// This is a helper function for the merge routines.
template<typename _BidirectionalIterator, typename _Distance,
typename _Pointer, typename _Compare>
void
@@ -3074,22 +2491,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
__len11 = __len1 / 2;
std::advance(__first_cut, __len11);
- __second_cut = std::lower_bound(__middle, __last, *__first_cut,
- __comp);
+ __second_cut
+ = std::__lower_bound(__middle, __last, *__first_cut,
+ __gnu_cxx::__ops::__iter_comp_val(__comp));
__len22 = std::distance(__middle, __second_cut);
}
else
{
__len22 = __len2 / 2;
std::advance(__second_cut, __len22);
- __first_cut = std::upper_bound(__first, __middle, *__second_cut,
- __comp);
+ __first_cut
+ = std::__upper_bound(__first, __middle, *__second_cut,
+ __gnu_cxx::__ops::__val_comp_iter(__comp));
__len11 = std::distance(__first, __first_cut);
}
- _BidirectionalIterator __new_middle =
- std::__rotate_adaptive(__first_cut, __middle, __second_cut,
- __len1 - __len11, __len22, __buffer,
- __buffer_size);
+ _BidirectionalIterator __new_middle
+ = std::__rotate_adaptive(__first_cut, __middle, __second_cut,
+ __len1 - __len11, __len22, __buffer,
+ __buffer_size);
std::__merge_adaptive(__first, __first_cut, __new_middle, __len11,
__len22, __buffer, __buffer_size, __comp);
std::__merge_adaptive(__new_middle, __second_cut, __last,
@@ -3100,49 +2519,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function for the merge routines.
- template<typename _BidirectionalIterator, typename _Distance>
- void
- __merge_without_buffer(_BidirectionalIterator __first,
- _BidirectionalIterator __middle,
- _BidirectionalIterator __last,
- _Distance __len1, _Distance __len2)
- {
- if (__len1 == 0 || __len2 == 0)
- return;
- if (__len1 + __len2 == 2)
- {
- if (*__middle < *__first)
- std::iter_swap(__first, __middle);
- return;
- }
- _BidirectionalIterator __first_cut = __first;
- _BidirectionalIterator __second_cut = __middle;
- _Distance __len11 = 0;
- _Distance __len22 = 0;
- if (__len1 > __len2)
- {
- __len11 = __len1 / 2;
- std::advance(__first_cut, __len11);
- __second_cut = std::lower_bound(__middle, __last, *__first_cut);
- __len22 = std::distance(__middle, __second_cut);
- }
- else
- {
- __len22 = __len2 / 2;
- std::advance(__second_cut, __len22);
- __first_cut = std::upper_bound(__first, __middle, *__second_cut);
- __len11 = std::distance(__first, __first_cut);
- }
- std::rotate(__first_cut, __middle, __second_cut);
- _BidirectionalIterator __new_middle = __first_cut;
- std::advance(__new_middle, std::distance(__middle, __second_cut));
- std::__merge_without_buffer(__first, __first_cut, __new_middle,
- __len11, __len22);
- std::__merge_without_buffer(__new_middle, __second_cut, __last,
- __len1 - __len11, __len2 - __len22);
- }
-
- /// This is a helper function for the merge routines.
template<typename _BidirectionalIterator, typename _Distance,
typename _Compare>
void
@@ -3156,7 +2532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return;
if (__len1 + __len2 == 2)
{
- if (__comp(*__middle, *__first))
+ if (__comp(__middle, __first))
std::iter_swap(__first, __middle);
return;
}
@@ -3168,16 +2544,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
__len11 = __len1 / 2;
std::advance(__first_cut, __len11);
- __second_cut = std::lower_bound(__middle, __last, *__first_cut,
- __comp);
+ __second_cut
+ = std::__lower_bound(__middle, __last, *__first_cut,
+ __gnu_cxx::__ops::__iter_comp_val(__comp));
__len22 = std::distance(__middle, __second_cut);
}
else
{
__len22 = __len2 / 2;
std::advance(__second_cut, __len22);
- __first_cut = std::upper_bound(__first, __middle, *__second_cut,
- __comp);
+ __first_cut
+ = std::__upper_bound(__first, __middle, *__second_cut,
+ __gnu_cxx::__ops::__val_comp_iter(__comp));
__len11 = std::distance(__first, __first_cut);
}
std::rotate(__first_cut, __middle, __second_cut);
@@ -3189,6 +2567,36 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__len1 - __len11, __len2 - __len22, __comp);
}
+ template<typename _BidirectionalIterator, typename _Compare>
+ void
+ __inplace_merge(_BidirectionalIterator __first,
+ _BidirectionalIterator __middle,
+ _BidirectionalIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_BidirectionalIterator>::difference_type
+ _DistanceType;
+
+ if (__first == __middle || __middle == __last)
+ return;
+
+ const _DistanceType __len1 = std::distance(__first, __middle);
+ const _DistanceType __len2 = std::distance(__middle, __last);
+
+ typedef _Temporary_buffer<_BidirectionalIterator, _ValueType> _TmpBuf;
+ _TmpBuf __buf(__first, __last);
+
+ if (__buf.begin() == 0)
+ std::__merge_without_buffer
+ (__first, __middle, __last, __len1, __len2, __comp);
+ else
+ std::__merge_adaptive
+ (__first, __middle, __last, __len1, __len2, __buf.begin(),
+ _DistanceType(__buf.size()), __comp);
+ }
+
/**
* @brief Merges two sorted ranges in place.
* @ingroup sorting_algorithms
@@ -3208,36 +2616,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* distance(__first,__last).
*/
template<typename _BidirectionalIterator>
- void
+ inline void
inplace_merge(_BidirectionalIterator __first,
_BidirectionalIterator __middle,
_BidirectionalIterator __last)
{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type
- _DistanceType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
_BidirectionalIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
__glibcxx_requires_sorted(__first, __middle);
__glibcxx_requires_sorted(__middle, __last);
- if (__first == __middle || __middle == __last)
- return;
-
- _DistanceType __len1 = std::distance(__first, __middle);
- _DistanceType __len2 = std::distance(__middle, __last);
-
- _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first,
- __last);
- if (__buf.begin() == 0)
- std::__merge_without_buffer(__first, __middle, __last, __len1, __len2);
- else
- std::__merge_adaptive(__first, __middle, __last, __len1, __len2,
- __buf.begin(), _DistanceType(__buf.size()));
+ std::__inplace_merge(__first, __middle, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -3263,81 +2656,37 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the function used for the initial sort.
*/
template<typename _BidirectionalIterator, typename _Compare>
- void
+ inline void
inplace_merge(_BidirectionalIterator __first,
_BidirectionalIterator __middle,
_BidirectionalIterator __last,
_Compare __comp)
{
- typedef typename iterator_traits<_BidirectionalIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_BidirectionalIterator>::difference_type
- _DistanceType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<
_BidirectionalIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType, _ValueType>)
+ typename iterator_traits<_BidirectionalIterator>::value_type,
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
__glibcxx_requires_sorted_pred(__first, __middle, __comp);
__glibcxx_requires_sorted_pred(__middle, __last, __comp);
- if (__first == __middle || __middle == __last)
- return;
-
- const _DistanceType __len1 = std::distance(__first, __middle);
- const _DistanceType __len2 = std::distance(__middle, __last);
-
- _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first,
- __last);
- if (__buf.begin() == 0)
- std::__merge_without_buffer(__first, __middle, __last, __len1,
- __len2, __CheckedCompare(__comp));
- else
- std::__merge_adaptive(__first, __middle, __last, __len1, __len2,
- __buf.begin(), _DistanceType(__buf.size()),
- __CheckedCompare(__comp));
+ std::__inplace_merge(__first, __middle, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
/// This is a helper function for the __merge_sort_loop routines.
- template<typename _InputIterator1, typename _InputIterator2,
- typename _OutputIterator>
- _OutputIterator
- __move_merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
- _OutputIterator __result)
- {
- while (__first1 != __last1 && __first2 != __last2)
- {
- if (*__first2 < *__first1)
- {
- *__result = _GLIBCXX_MOVE(*__first2);
- ++__first2;
- }
- else
- {
- *__result = _GLIBCXX_MOVE(*__first1);
- ++__first1;
- }
- ++__result;
- }
- return _GLIBCXX_MOVE3(__first2, __last2,
- _GLIBCXX_MOVE3(__first1, __last1,
- __result));
- }
-
- /// This is a helper function for the __merge_sort_loop routines.
- template<typename _InputIterator1, typename _InputIterator2,
- typename _OutputIterator, typename _Compare>
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _Compare>
_OutputIterator
- __move_merge(_InputIterator1 __first1, _InputIterator1 __last1,
- _InputIterator2 __first2, _InputIterator2 __last2,
+ __move_merge(_InputIterator __first1, _InputIterator __last1,
+ _InputIterator __first2, _InputIterator __last2,
_OutputIterator __result, _Compare __comp)
{
while (__first1 != __last1 && __first2 != __last2)
{
- if (__comp(*__first2, *__first1))
+ if (__comp(__first2, __first1))
{
*__result = _GLIBCXX_MOVE(*__first2);
++__first2;
@@ -3355,29 +2704,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _RandomAccessIterator1, typename _RandomAccessIterator2,
- typename _Distance>
- void
- __merge_sort_loop(_RandomAccessIterator1 __first,
- _RandomAccessIterator1 __last,
- _RandomAccessIterator2 __result,
- _Distance __step_size)
- {
- const _Distance __two_step = 2 * __step_size;
-
- while (__last - __first >= __two_step)
- {
- __result = std::__move_merge(__first, __first + __step_size,
- __first + __step_size,
- __first + __two_step, __result);
- __first += __two_step;
- }
-
- __step_size = std::min(_Distance(__last - __first), __step_size);
- std::__move_merge(__first, __first + __step_size,
- __first + __step_size, __last, __result);
- }
-
- template<typename _RandomAccessIterator1, typename _RandomAccessIterator2,
typename _Distance, typename _Compare>
void
__merge_sort_loop(_RandomAccessIterator1 __first,
@@ -3397,24 +2723,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
__step_size = std::min(_Distance(__last - __first), __step_size);
- std::__move_merge(__first,__first + __step_size,
+ std::__move_merge(__first, __first + __step_size,
__first + __step_size, __last, __result, __comp);
}
- template<typename _RandomAccessIterator, typename _Distance>
- void
- __chunk_insertion_sort(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Distance __chunk_size)
- {
- while (__last - __first >= __chunk_size)
- {
- std::__insertion_sort(__first, __first + __chunk_size);
- __first += __chunk_size;
- }
- std::__insertion_sort(__first, __last);
- }
-
template<typename _RandomAccessIterator, typename _Distance,
typename _Compare>
void
@@ -3432,30 +2744,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
enum { _S_chunk_size = 7 };
- template<typename _RandomAccessIterator, typename _Pointer>
- void
- __merge_sort_with_buffer(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Pointer __buffer)
- {
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type
- _Distance;
-
- const _Distance __len = __last - __first;
- const _Pointer __buffer_last = __buffer + __len;
-
- _Distance __step_size = _S_chunk_size;
- std::__chunk_insertion_sort(__first, __last, __step_size);
-
- while (__step_size < __len)
- {
- std::__merge_sort_loop(__first, __last, __buffer, __step_size);
- __step_size *= 2;
- std::__merge_sort_loop(__buffer, __buffer_last, __first, __step_size);
- __step_size *= 2;
- }
- }
-
template<typename _RandomAccessIterator, typename _Pointer, typename _Compare>
void
__merge_sort_with_buffer(_RandomAccessIterator __first,
@@ -3483,33 +2771,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
template<typename _RandomAccessIterator, typename _Pointer,
- typename _Distance>
- void
- __stable_sort_adaptive(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Pointer __buffer, _Distance __buffer_size)
- {
- const _Distance __len = (__last - __first + 1) / 2;
- const _RandomAccessIterator __middle = __first + __len;
- if (__len > __buffer_size)
- {
- std::__stable_sort_adaptive(__first, __middle,
- __buffer, __buffer_size);
- std::__stable_sort_adaptive(__middle, __last,
- __buffer, __buffer_size);
- }
- else
- {
- std::__merge_sort_with_buffer(__first, __middle, __buffer);
- std::__merge_sort_with_buffer(__middle, __last, __buffer);
- }
- std::__merge_adaptive(__first, __middle, __last,
- _Distance(__middle - __first),
- _Distance(__last - __middle),
- __buffer, __buffer_size);
- }
-
- template<typename _RandomAccessIterator, typename _Pointer,
typename _Distance, typename _Compare>
void
__stable_sort_adaptive(_RandomAccessIterator __first,
@@ -3539,25 +2800,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
/// This is a helper function for the stable sorting routines.
- template<typename _RandomAccessIterator>
- void
- __inplace_stable_sort(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
- {
- if (__last - __first < 15)
- {
- std::__insertion_sort(__first, __last);
- return;
- }
- _RandomAccessIterator __middle = __first + (__last - __first) / 2;
- std::__inplace_stable_sort(__first, __middle);
- std::__inplace_stable_sort(__middle, __last);
- std::__merge_without_buffer(__first, __middle, __last,
- __middle - __first,
- __last - __middle);
- }
-
- /// This is a helper function for the stable sorting routines.
template<typename _RandomAccessIterator, typename _Compare>
void
__inplace_stable_sort(_RandomAccessIterator __first,
@@ -3584,6 +2826,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// that their input ranges are sorted and the postcondition that their output
// ranges are sorted.
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _Compare>
+ bool
+ __includes(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _Compare __comp)
+ {
+ while (__first1 != __last1 && __first2 != __last2)
+ if (__comp(__first2, __first1))
+ return false;
+ else if (__comp(__first1, __first2))
+ ++__first1;
+ else
+ ++__first1, ++__first2;
+
+ return __first2 == __last2;
+ }
+
/**
* @brief Determines whether all elements of a sequence exists in a range.
* @param __first1 Start of search range.
@@ -3603,32 +2863,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* returned.
*/
template<typename _InputIterator1, typename _InputIterator2>
- bool
+ inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set(__first1, __last1, __first2);
__glibcxx_requires_sorted_set(__first2, __last2, __first1);
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first2 < *__first1)
- return false;
- else if(*__first1 < *__first2)
- ++__first1;
- else
- ++__first1, ++__first2;
-
- return __first2 == __last2;
+ return std::__includes(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -3654,35 +2906,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _Compare>
- bool
+ inline bool
includes(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_Compare __comp)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType1, _ValueType2>)
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
__glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
- while (__first1 != __last1 && __first2 != __last2)
- if (__CheckedCompare(__comp)(*__first2, *__first1))
- return false;
- else if(__CheckedCompare(__comp)(*__first1, *__first2))
- ++__first1;
- else
- ++__first1, ++__first2;
-
- return __first2 == __last2;
+ return std::__includes(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
// nth_element
@@ -3695,30 +2937,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// min_element
// max_element
- /**
- * @brief Permute range into the next @e dictionary ordering.
- * @ingroup sorting_algorithms
- * @param __first Start of range.
- * @param __last End of range.
- * @return False if wrapped to first permutation, true otherwise.
- *
- * Treats all permutations of the range as a set of @e dictionary sorted
- * sequences. Permutes the current sequence into the next one of this set.
- * Returns true if there are more sequences to generate. If the sequence
- * is the largest of the set, the smallest is generated and false returned.
- */
- template<typename _BidirectionalIterator>
+ template<typename _BidirectionalIterator, typename _Compare>
bool
- next_permutation(_BidirectionalIterator __first,
- _BidirectionalIterator __last)
+ __next_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last, _Compare __comp)
{
- // concept requirements
- __glibcxx_function_requires(_BidirectionalIteratorConcept<
- _BidirectionalIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<
- typename iterator_traits<_BidirectionalIterator>::value_type>)
- __glibcxx_requires_valid_range(__first, __last);
-
if (__first == __last)
return false;
_BidirectionalIterator __i = __first;
@@ -3732,24 +2955,54 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_BidirectionalIterator __ii = __i;
--__i;
- if (*__i < *__ii)
+ if (__comp(__i, __ii))
{
_BidirectionalIterator __j = __last;
- while (!(*__i < *--__j))
+ while (!__comp(__i, --__j))
{}
std::iter_swap(__i, __j);
- std::reverse(__ii, __last);
+ std::__reverse(__ii, __last,
+ std::__iterator_category(__first));
return true;
}
if (__i == __first)
{
- std::reverse(__first, __last);
+ std::__reverse(__first, __last,
+ std::__iterator_category(__first));
return false;
}
}
}
/**
+ * @brief Permute range into the next @e dictionary ordering.
+ * @ingroup sorting_algorithms
+ * @param __first Start of range.
+ * @param __last End of range.
+ * @return False if wrapped to first permutation, true otherwise.
+ *
+ * Treats all permutations of the range as a set of @e dictionary sorted
+ * sequences. Permutes the current sequence into the next one of this set.
+ * Returns true if there are more sequences to generate. If the sequence
+ * is the largest of the set, the smallest is generated and false returned.
+ */
+ template<typename _BidirectionalIterator>
+ inline bool
+ next_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_BidirectionalIteratorConcept<
+ _BidirectionalIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_BidirectionalIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return std::__next_permutation
+ (__first, __last, __gnu_cxx::__ops::__iter_less_iter());
+ }
+
+ /**
* @brief Permute range into the next @e dictionary ordering using
* comparison functor.
* @ingroup sorting_algorithms
@@ -3765,7 +3018,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* smallest is generated and false returned.
*/
template<typename _BidirectionalIterator, typename _Compare>
- bool
+ inline bool
next_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last, _Compare __comp)
{
@@ -3777,6 +3030,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_BidirectionalIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
+ return std::__next_permutation
+ (__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _BidirectionalIterator, typename _Compare>
+ bool
+ __prev_permutation(_BidirectionalIterator __first,
+ _BidirectionalIterator __last, _Compare __comp)
+ {
if (__first == __last)
return false;
_BidirectionalIterator __i = __first;
@@ -3790,18 +3052,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
_BidirectionalIterator __ii = __i;
--__i;
- if (__CheckedCompare(__comp)(*__i, *__ii))
+ if (__comp(__ii, __i))
{
_BidirectionalIterator __j = __last;
- while (!bool(__CheckedCompare(__comp)(*__i, *--__j)))
+ while (!__comp(--__j, __i))
{}
std::iter_swap(__i, __j);
- std::reverse(__ii, __last);
+ std::__reverse(__ii, __last,
+ std::__iterator_category(__first));
return true;
}
if (__i == __first)
{
- std::reverse(__first, __last);
+ std::__reverse(__first, __last,
+ std::__iterator_category(__first));
return false;
}
}
@@ -3821,7 +3085,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* returned.
*/
template<typename _BidirectionalIterator>
- bool
+ inline bool
prev_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last)
{
@@ -3832,34 +3096,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_BidirectionalIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return false;
- _BidirectionalIterator __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;)
- {
- _BidirectionalIterator __ii = __i;
- --__i;
- if (*__ii < *__i)
- {
- _BidirectionalIterator __j = __last;
- while (!(*--__j < *__i))
- {}
- std::iter_swap(__i, __j);
- std::reverse(__ii, __last);
- return true;
- }
- if (__i == __first)
- {
- std::reverse(__first, __last);
- return false;
- }
- }
+ return std::__prev_permutation(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -3878,7 +3116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* the largest is generated and false returned.
*/
template<typename _BidirectionalIterator, typename _Compare>
- bool
+ inline bool
prev_permutation(_BidirectionalIterator __first,
_BidirectionalIterator __last, _Compare __comp)
{
@@ -3890,39 +3128,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_BidirectionalIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return false;
- _BidirectionalIterator __i = __first;
- ++__i;
- if (__i == __last)
- return false;
- __i = __last;
- --__i;
-
- for(;;)
- {
- _BidirectionalIterator __ii = __i;
- --__i;
- if (__CheckedCompare(__comp)(*__ii, *__i))
- {
- _BidirectionalIterator __j = __last;
- while (!bool(__CheckedCompare(__comp)(*--__j, *__i)))
- {}
- std::iter_swap(__i, __j);
- std::reverse(__ii, __last);
- return true;
- }
- if (__i == __first)
- {
- std::reverse(__first, __last);
- return false;
- }
- }
+ return std::__prev_permutation(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
// replace
// replace_if
+ template<typename _InputIterator, typename _OutputIterator,
+ typename _Predicate, typename _Tp>
+ _OutputIterator
+ __replace_copy_if(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result,
+ _Predicate __pred, const _Tp& __new_value)
+ {
+ for (; __first != __last; ++__first, ++__result)
+ if (__pred(__first))
+ *__result = __new_value;
+ else
+ *__result = *__first;
+ return __result;
+ }
+
/**
* @brief Copy a sequence, replacing each element of one value with another
* value.
@@ -3938,7 +3165,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* equal to @p __old_value with @p __new_value.
*/
template<typename _InputIterator, typename _OutputIterator, typename _Tp>
- _OutputIterator
+ inline _OutputIterator
replace_copy(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
const _Tp& __old_value, const _Tp& __new_value)
@@ -3951,12 +3178,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_InputIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- for (; __first != __last; ++__first, ++__result)
- if (*__first == __old_value)
- *__result = __new_value;
- else
- *__result = *__first;
- return __result;
+ return std::__replace_copy_if(__first, __last, __result,
+ __gnu_cxx::__ops::__iter_equals_val(__old_value),
+ __new_value);
}
/**
@@ -3976,7 +3200,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _InputIterator, typename _OutputIterator,
typename _Predicate, typename _Tp>
- _OutputIterator
+ inline _OutputIterator
replace_copy_if(_InputIterator __first, _InputIterator __last,
_OutputIterator __result,
_Predicate __pred, const _Tp& __new_value)
@@ -3989,12 +3213,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- for (; __first != __last; ++__first, ++__result)
- if (__pred(*__first))
- *__result = __new_value;
- else
- *__result = *__first;
- return __result;
+ return std::__replace_copy_if(__first, __last, __result,
+ __gnu_cxx::__ops::__pred_iter(__pred),
+ __new_value);
+ }
+
+ template<typename _InputIterator, typename _Predicate>
+ typename iterator_traits<_InputIterator>::difference_type
+ __count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
+ {
+ typename iterator_traits<_InputIterator>::difference_type __n = 0;
+ for (; __first != __last; ++__first)
+ if (__pred(__first))
+ ++__n;
+ return __n;
}
#if __cplusplus >= 201103L
@@ -4025,6 +3257,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Compare __comp)
{ return std::is_sorted_until(__first, __last, __comp) == __last; }
+ template<typename _ForwardIterator, typename _Compare>
+ _ForwardIterator
+ __is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ if (__first == __last)
+ return __last;
+
+ _ForwardIterator __next = __first;
+ for (++__next; __next != __last; __first = __next, ++__next)
+ if (__comp(__next, __first))
+ return __next;
+ return __next;
+ }
+
/**
* @brief Determines the end of a sorted sequence.
* @ingroup sorting_algorithms
@@ -4034,7 +3281,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* for which the range [__first, i) is sorted.
*/
template<typename _ForwardIterator>
- _ForwardIterator
+ inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
@@ -4043,14 +3290,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __last;
-
- _ForwardIterator __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next)
- if (*__next < *__first)
- return __next;
- return __next;
+ return std::__is_sorted_until(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -4063,7 +3304,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* for which the range [__first, i) is sorted.
*/
template<typename _ForwardIterator, typename _Compare>
- _ForwardIterator
+ inline _ForwardIterator
is_sorted_until(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
{
@@ -4074,14 +3315,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __last;
-
- _ForwardIterator __next = __first;
- for (++__next; __next != __last; __first = __next, ++__next)
- if (__CheckedCompare(__comp)(*__next, *__first))
- return __next;
- return __next;
+ return std::__is_sorted_until(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
/**
@@ -4117,38 +3352,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
minmax(const _Tp& __a, const _Tp& __b, _Compare __comp)
{
return __CheckedCompare(__comp)(__b, __a)
- ? pair<const _Tp&, const _Tp&>(__b, __a)
- : pair<const _Tp&, const _Tp&>(__a, __b);
+ ? pair<const _Tp&, const _Tp&>(__b, __a)
+ : pair<const _Tp&, const _Tp&>(__a, __b);
}
- /**
- * @brief Return a pair of iterators pointing to the minimum and maximum
- * elements in a range.
- * @ingroup sorting_algorithms
- * @param __first Start of range.
- * @param __last End of range.
- * @return make_pair(m, M), where m is the first iterator i in
- * [__first, __last) such that no other element in the range is
- * smaller, and where M is the last iterator i in [__first, __last)
- * such that no other element in the range is larger.
- */
- template<typename _ForwardIterator>
+ template<typename _ForwardIterator, typename _Compare>
pair<_ForwardIterator, _ForwardIterator>
- minmax_element(_ForwardIterator __first, _ForwardIterator __last)
+ __minmax_element(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
{
- // concept requirements
- __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<
- typename iterator_traits<_ForwardIterator>::value_type>)
- __glibcxx_requires_valid_range(__first, __last);
-
_ForwardIterator __next = __first;
if (__first == __last
|| ++__next == __last)
return std::make_pair(__first, __first);
_ForwardIterator __min, __max;
- if (*__next < *__first)
+ if (__comp(__next, __first))
{
__min = __next;
__max = __first;
@@ -4167,25 +3386,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__next = __first;
if (++__next == __last)
{
- if (*__first < *__min)
+ if (__comp(__first, __min))
__min = __first;
- else if (!(*__first < *__max))
+ else if (!__comp(__first, __max))
__max = __first;
break;
}
- if (*__next < *__first)
+ if (__comp(__next, __first))
{
- if (*__next < *__min)
+ if (__comp(__next, __min))
__min = __next;
- if (!(*__first < *__max))
+ if (!__comp(__first, __max))
__max = __first;
}
else
{
- if (*__first < *__min)
+ if (__comp(__first, __min))
__min = __first;
- if (!(*__next < *__max))
+ if (!__comp(__next, __max))
__max = __next;
}
@@ -4202,6 +3421,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup sorting_algorithms
* @param __first Start of range.
* @param __last End of range.
+ * @return make_pair(m, M), where m is the first iterator i in
+ * [__first, __last) such that no other element in the range is
+ * smaller, and where M is the last iterator i in [__first, __last)
+ * such that no other element in the range is larger.
+ */
+ template<typename _ForwardIterator>
+ inline pair<_ForwardIterator, _ForwardIterator>
+ minmax_element(_ForwardIterator __first, _ForwardIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_ForwardIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ return std::__minmax_element(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
+ }
+
+ /**
+ * @brief Return a pair of iterators pointing to the minimum and maximum
+ * elements in a range.
+ * @ingroup sorting_algorithms
+ * @param __first Start of range.
+ * @param __last End of range.
* @param __comp Comparison functor.
* @return make_pair(m, M), where m is the first iterator i in
* [__first, __last) such that no other element in the range is
@@ -4209,7 +3453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* such that no other element in the range is larger.
*/
template<typename _ForwardIterator, typename _Compare>
- pair<_ForwardIterator, _ForwardIterator>
+ inline pair<_ForwardIterator, _ForwardIterator>
minmax_element(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
{
@@ -4220,58 +3464,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- _ForwardIterator __next = __first;
- if (__first == __last
- || ++__next == __last)
- return std::make_pair(__first, __first);
-
- _ForwardIterator __min, __max;
- if (__CheckedCompare(__comp)(*__next, *__first))
- {
- __min = __next;
- __max = __first;
- }
- else
- {
- __min = __first;
- __max = __next;
- }
-
- __first = __next;
- ++__first;
-
- while (__first != __last)
- {
- __next = __first;
- if (++__next == __last)
- {
- if (__CheckedCompare(__comp)(*__first, *__min))
- __min = __first;
- else if (!__CheckedCompare(__comp)(*__first, *__max))
- __max = __first;
- break;
- }
-
- if (__CheckedCompare(__comp)(*__next, *__first))
- {
- if (__CheckedCompare(__comp)(*__next, *__min))
- __min = __next;
- if (!__CheckedCompare(__comp)(*__first, *__max))
- __max = __first;
- }
- else
- {
- if (__CheckedCompare(__comp)(*__first, *__min))
- __min = __first;
- if (!__CheckedCompare(__comp)(*__next, *__max))
- __max = __next;
- }
-
- __first = __next;
- ++__first;
- }
-
- return std::make_pair(__min, __max);
+ return std::__minmax_element(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
// N2722 + DR 915.
@@ -4313,27 +3507,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::make_pair(*__p.first, *__p.second);
}
- /**
- * @brief Checks whether a permutaion of the second sequence is equal
- * to the first sequence.
- * @ingroup non_mutating_algorithms
- * @param __first1 Start of first range.
- * @param __last1 End of first range.
- * @param __first2 Start of second range.
- * @return true if there exists a permutation of the elements in the range
- * [__first2, __first2 + (__last1 - __first1)), beginning with
- * ForwardIterator2 begin, such that equal(__first1, __last1, begin)
- * returns true; otherwise, returns false.
- */
- template<typename _ForwardIterator1, typename _ForwardIterator2>
+ template<typename _ForwardIterator1, typename _ForwardIterator2,
+ typename _BinaryPredicate>
bool
- is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
- _ForwardIterator2 __first2)
+ __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _BinaryPredicate __pred)
{
// Efficiently compare identical prefixes: O(N) if sequences
// have the same elements in the same order.
for (; __first1 != __last1; ++__first1, ++__first2)
- if (!(*__first1 == *__first2))
+ if (!__pred(__first1, __first2))
break;
if (__first1 == __last1)
@@ -4345,12 +3528,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::advance(__last2, std::distance(__first1, __last1));
for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan)
{
- if (__scan != _GLIBCXX_STD_A::find(__first1, __scan, *__scan))
+ if (__scan != std::__find_if(__first1, __scan,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)))
continue; // We've seen this one before.
-
- auto __matches = std::count(__first2, __last2, *__scan);
- if (0 == __matches
- || std::count(__scan, __last1, *__scan) != __matches)
+
+ auto __matches
+ = std::__count_if(__first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan));
+ if (0 == __matches ||
+ std::__count_if(__scan, __last1,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))
+ != __matches)
return false;
}
return true;
@@ -4363,6 +3551,35 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @param __first1 Start of first range.
* @param __last1 End of first range.
* @param __first2 Start of second range.
+ * @return true if there exists a permutation of the elements in the range
+ * [__first2, __first2 + (__last1 - __first1)), beginning with
+ * ForwardIterator2 begin, such that equal(__first1, __last1, begin)
+ * returns true; otherwise, returns false.
+ */
+ template<typename _ForwardIterator1, typename _ForwardIterator2>
+ inline bool
+ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)
+ __glibcxx_function_requires(_EqualOpConcept<
+ typename iterator_traits<_ForwardIterator1>::value_type,
+ typename iterator_traits<_ForwardIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ return std::__is_permutation(__first1, __last1, __first2,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
+ }
+
+ /**
+ * @brief Checks whether a permutation of the second sequence is equal
+ * to the first sequence.
+ * @ingroup non_mutating_algorithms
+ * @param __first1 Start of first range.
+ * @param __last1 End of first range.
+ * @param __first2 Start of second range.
* @param __pred A binary predicate.
* @return true if there exists a permutation of the elements in
* the range [__first2, __first2 + (__last1 - __first1)),
@@ -4372,42 +3589,83 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- bool
+ inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _BinaryPredicate __pred)
{
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,
+ typename iterator_traits<_ForwardIterator1>::value_type,
+ typename iterator_traits<_ForwardIterator2>::value_type>)
+ __glibcxx_requires_valid_range(__first1, __last1);
+
+ return std::__is_permutation(__first1, __last1, __first2,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred));
+ }
+
+#if __cplusplus > 201103L
+ template<typename _ForwardIterator1, typename _ForwardIterator2,
+ typename _BinaryPredicate>
+ bool
+ __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
+ _ForwardIterator2 __first2, _ForwardIterator2 __last2,
+ _BinaryPredicate __pred)
+ {
+ using _Cat1
+ = typename iterator_traits<_ForwardIterator1>::iterator_category;
+ using _Cat2
+ = typename iterator_traits<_ForwardIterator2>::iterator_category;
+ using _It1_is_RA = is_same<_Cat1, random_access_iterator_tag>;
+ using _It2_is_RA = is_same<_Cat2, random_access_iterator_tag>;
+ constexpr bool __ra_iters = _It1_is_RA() && _It2_is_RA();
+ if (__ra_iters)
+ {
+ auto __d1 = std::distance(__first1, __last1);
+ auto __d2 = std::distance(__first2, __last2);
+ if (__d1 != __d2)
+ return false;
+ }
+
// Efficiently compare identical prefixes: O(N) if sequences
// have the same elements in the same order.
for (; __first1 != __last1; ++__first1, ++__first2)
- if (!bool(__pred(*__first1, *__first2)))
+ if (!__pred(__first1, __first2))
break;
- if (__first1 == __last1)
- return true;
+ if (__ra_iters)
+ {
+ if (__first1 == __last1)
+ return true;
+ }
+ else
+ {
+ auto __d1 = std::distance(__first1, __last1);
+ auto __d2 = std::distance(__first2, __last2);
+ if (__d1 == 0 && __d2 == 0)
+ return true;
+ if (__d1 != __d2)
+ return false;
+ }
- // Establish __last2 assuming equal ranges by iterating over the
- // rest of the list.
- _ForwardIterator2 __last2 = __first2;
- std::advance(__last2, std::distance(__first1, __last1));
for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan)
{
- using std::placeholders::_1;
-
- if (__scan != _GLIBCXX_STD_A::find_if(__first1, __scan,
- std::bind(__pred, _1, *__scan)))
+ if (__scan != std::__find_if(__first1, __scan,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan)))
continue; // We've seen this one before.
-
- auto __matches = std::count_if(__first2, __last2,
- std::bind(__pred, _1, *__scan));
+
+ auto __matches = std::__count_if(__first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan));
if (0 == __matches
- || std::count_if(__scan, __last1,
- std::bind(__pred, _1, *__scan)) != __matches)
+ || std::__count_if(__scan, __last1,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred, __scan))
+ != __matches)
return false;
}
return true;
}
-#if __cplusplus > 201103L
/**
* @brief Checks whether a permutaion of the second sequence is equal
* to the first sequence.
@@ -4422,47 +3680,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* otherwise, returns false.
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
- bool
+ inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
{
- using _Cat1
- = typename iterator_traits<_ForwardIterator1>::iterator_category;
- using _Cat2
- = typename iterator_traits<_ForwardIterator2>::iterator_category;
- using _It1_is_RA = is_same<_Cat1, random_access_iterator_tag>;
- using _It2_is_RA = is_same<_Cat2, random_access_iterator_tag>;
- if (_It1_is_RA() && _It2_is_RA())
- {
- auto __d1 = std::distance(__first1, __last1);
- auto __d2 = std::distance(__first2, __last2);
- if (__d1 != __d2)
- return false;
- }
-
- // Efficiently compare identical prefixes: O(N) if sequences
- // have the same elements in the same order.
- for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
- if (!(*__first1 == *__first2))
- break;
-
- if (__first1 == __last1 && __first2 == __last2)
- return true;
-
- if (std::distance(__first1, __last1) != std::distance(__first2, __last2))
- return false;
-
- for (auto __scan = __first1; __scan != __last1; ++__scan)
- {
- if (__scan != _GLIBCXX_STD_A::find(__first1, __scan, *__scan))
- continue; // We've seen this one before.
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
- auto __matches = std::count(__first2, __last2, *__scan);
- if (0 == __matches
- || std::count(__scan, __last1, *__scan) != __matches)
- return false;
- }
- return true;
+ return
+ std::__is_permutation(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -4481,63 +3708,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- bool
+ inline bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
_BinaryPredicate __pred)
{
- using _Cat1
- = typename iterator_traits<_ForwardIterator1>::iterator_category;
- using _Cat2
- = typename iterator_traits<_ForwardIterator2>::iterator_category;
- using _It1_is_RA = is_same<_Cat1, random_access_iterator_tag>;
- using _It2_is_RA = is_same<_Cat2, random_access_iterator_tag>;
- constexpr bool __ra_iters = _It1_is_RA() && _It2_is_RA();
- if (__ra_iters)
- {
- auto __d1 = std::distance(__first1, __last1);
- auto __d2 = std::distance(__first2, __last2);
- if (__d1 != __d2)
- return false;
- }
-
- // Efficiently compare identical prefixes: O(N) if sequences
- // have the same elements in the same order.
- for (; __first1 != __last1; ++__first1, ++__first2)
- if (!bool(__pred(*__first1, *__first2)))
- break;
-
- if (__ra_iters)
- {
- if (__first1 == __last1)
- return true;
- }
- else
- {
- auto __d1 = std::distance(__first1, __last1);
- auto __d2 = std::distance(__first2, __last2);
- if (__d1 == 0 && __d2 == 0)
- return true;
- if (__d1 != __d2)
- return false;
- }
-
- for (_ForwardIterator1 __scan = __first1; __scan != __last1; ++__scan)
- {
- using std::placeholders::_1;
-
- if (__scan != _GLIBCXX_STD_A::find_if(__first1, __scan,
- std::bind(__pred, _1, *__scan)))
- continue; // We've seen this one before.
+ __glibcxx_requires_valid_range(__first1, __last1);
+ __glibcxx_requires_valid_range(__first2, __last2);
- auto __matches = std::count_if(__first2, __last2,
- std::bind(__pred, _1, *__scan));
- if (0 == __matches
- || std::count_if(__scan, __last1,
- std::bind(__pred, _1, *__scan)) != __matches)
- return false;
- }
- return true;
+ return std::__is_permutation(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__pred));
}
#endif
@@ -4630,8 +3810,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_function_requires(_EqualOpConcept<
typename iterator_traits<_InputIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__find(__first, __last, __val,
- std::__iterator_category(__first));
+ return std::__find_if(__first, __last,
+ __gnu_cxx::__ops::__iter_equals_val(__val));
}
/**
@@ -4654,8 +3834,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return std::__find_if(__first, __last, __pred,
- std::__iterator_category(__first));
+
+ return std::__find_if(__first, __last,
+ __gnu_cxx::__ops::__pred_iter(__pred));
}
/**
@@ -4732,7 +3913,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
for (; __first1 != __last1; ++__first1)
for (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter)
- if (__comp(*__first1, *__iter))
+ if (__CheckedCompare(__comp)(*__first1, *__iter))
return __first1;
return __last1;
}
@@ -4747,7 +3928,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* or @p __last if no such iterator exists.
*/
template<typename _ForwardIterator>
- _ForwardIterator
+ inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
@@ -4755,16 +3936,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_function_requires(_EqualityComparableConcept<
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __last;
- _ForwardIterator __next = __first;
- while(++__next != __last)
- {
- if (*__first == *__next)
- return __first;
- __first = __next;
- }
- return __last;
+
+ return std::__adjacent_find(__first, __last,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -4779,7 +3953,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* exists.
*/
template<typename _ForwardIterator, typename _BinaryPredicate>
- _ForwardIterator
+ inline _ForwardIterator
adjacent_find(_ForwardIterator __first, _ForwardIterator __last,
_BinaryPredicate __binary_pred)
{
@@ -4789,16 +3963,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_ForwardIterator>::value_type,
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __last;
- _ForwardIterator __next = __first;
- while(++__next != __last)
- {
- if (__binary_pred(*__first, *__next))
- return __first;
- __first = __next;
- }
- return __last;
+
+ return std::__adjacent_find(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
}
/**
@@ -4811,19 +3978,17 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @c *i == @p __value
*/
template<typename _InputIterator, typename _Tp>
- typename iterator_traits<_InputIterator>::difference_type
+ inline typename iterator_traits<_InputIterator>::difference_type
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
__glibcxx_function_requires(_EqualOpConcept<
- typename iterator_traits<_InputIterator>::value_type, _Tp>)
+ typename iterator_traits<_InputIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- for (; __first != __last; ++__first)
- if (*__first == __value)
- ++__n;
- return __n;
+
+ return std::__count_if(__first, __last,
+ __gnu_cxx::__ops::__iter_equals_val(__value));
}
/**
@@ -4836,7 +4001,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* for which @p __pred(*i) is true.
*/
template<typename _InputIterator, typename _Predicate>
- typename iterator_traits<_InputIterator>::difference_type
+ inline typename iterator_traits<_InputIterator>::difference_type
count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)
{
// concept requirements
@@ -4844,11 +4009,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
typename iterator_traits<_InputIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- for (; __first != __last; ++__first)
- if (__pred(*__first))
- ++__n;
- return __n;
+
+ return std::__count_if(__first, __last,
+ __gnu_cxx::__ops::__pred_iter(__pred));
}
/**
@@ -4878,7 +4041,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @p [__first1,__last1-(__last2-__first2))
*/
template<typename _ForwardIterator1, typename _ForwardIterator2>
- _ForwardIterator1
+ inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
{
@@ -4891,40 +4054,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- // Test for empty ranges
- if (__first1 == __last1 || __first2 == __last2)
- return __first1;
-
- // Test for a pattern of length 1.
- _ForwardIterator2 __p1(__first2);
- if (++__p1 == __last2)
- return _GLIBCXX_STD_A::find(__first1, __last1, *__first2);
-
- // General case.
- _ForwardIterator2 __p;
- _ForwardIterator1 __current = __first1;
-
- for (;;)
- {
- __first1 = _GLIBCXX_STD_A::find(__first1, __last1, *__first2);
- if (__first1 == __last1)
- return __last1;
-
- __p = __p1;
- __current = __first1;
- if (++__current == __last1)
- return __last1;
-
- while (*__current == *__p)
- {
- if (++__p == __last2)
- return __first1;
- if (++__current == __last1)
- return __last1;
- }
- ++__first1;
- }
- return __first1;
+ return std::__search(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -4950,7 +4081,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _ForwardIterator1, typename _ForwardIterator2,
typename _BinaryPredicate>
- _ForwardIterator1
+ inline _ForwardIterator1
search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
_BinaryPredicate __predicate)
@@ -4964,50 +4095,10 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- // Test for empty ranges
- if (__first1 == __last1 || __first2 == __last2)
- return __first1;
-
- // Test for a pattern of length 1.
- _ForwardIterator2 __p1(__first2);
- if (++__p1 == __last2)
- {
- while (__first1 != __last1
- && !bool(__predicate(*__first1, *__first2)))
- ++__first1;
- return __first1;
- }
-
- // General case.
- _ForwardIterator2 __p;
- _ForwardIterator1 __current = __first1;
-
- for (;;)
- {
- while (__first1 != __last1
- && !bool(__predicate(*__first1, *__first2)))
- ++__first1;
- if (__first1 == __last1)
- return __last1;
-
- __p = __p1;
- __current = __first1;
- if (++__current == __last1)
- return __last1;
-
- while (__predicate(*__current, *__p))
- {
- if (++__p == __last2)
- return __first1;
- if (++__current == __last1)
- return __last1;
- }
- ++__first1;
- }
- return __first1;
+ return std::__search(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__predicate));
}
-
/**
* @brief Search a sequence for a number of consecutive values.
* @ingroup non_mutating_algorithms
@@ -5024,22 +4115,18 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* equal to @p __val.
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp>
- _ForwardIterator
+ inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_EqualOpConcept<
- typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
+ typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- if (__count <= 0)
- return __first;
- if (__count == 1)
- return _GLIBCXX_STD_A::find(__first, __last, __val);
- return std::__search_n(__first, __last, __count, __val,
- std::__iterator_category(__first));
+ return std::__search_n(__first, __last, __count,
+ __gnu_cxx::__ops::__iter_equals_val(__val));
}
@@ -5062,7 +4149,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _ForwardIterator, typename _Integer, typename _Tp,
typename _BinaryPredicate>
- _ForwardIterator
+ inline _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last,
_Integer __count, const _Tp& __val,
_BinaryPredicate __binary_pred)
@@ -5073,16 +4160,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
__glibcxx_requires_valid_range(__first, __last);
- if (__count <= 0)
- return __first;
- if (__count == 1)
- {
- while (__first != __last && !bool(__binary_pred(*__first, __val)))
- ++__first;
- return __first;
- }
- return std::__search_n(__first, __last, __count, __val, __binary_pred,
- std::__iterator_category(__first));
+ return std::__search_n(__first, __last, __count,
+ __gnu_cxx::__ops::__iter_comp_val(__binary_pred, __val));
}
@@ -5282,7 +4361,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
return __first;
}
-
/**
* @brief Copy a sequence, removing consecutive duplicate values.
* @ingroup mutating_algorithms
@@ -5320,6 +4398,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
if (__first == __last)
return __result;
return std::__unique_copy(__first, __last, __result,
+ __gnu_cxx::__ops::__iter_equal_to_iter(),
std::__iterator_category(__first),
std::__iterator_category(__result));
}
@@ -5358,12 +4437,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
if (__first == __last)
return __result;
- return std::__unique_copy(__first, __last, __result, __binary_pred,
+ return std::__unique_copy(__first, __last, __result,
+ __gnu_cxx::__ops::__iter_comp_iter(__binary_pred),
std::__iterator_category(__first),
std::__iterator_category(__result));
}
-
/**
* @brief Randomly shuffle the elements of a sequence.
* @ingroup mutating_algorithms
@@ -5456,7 +4535,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
}
-
/**
* @brief Sort the smallest elements of a sequence.
* @ingroup sorting_algorithms
@@ -5479,18 +4557,16 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
_RandomAccessIterator __middle,
_RandomAccessIterator __last)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __middle);
__glibcxx_requires_valid_range(__middle, __last);
- std::__heap_select(__first, __middle, __last);
- std::sort_heap(__first, __middle);
+ std::__partial_sort(__first, __middle, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -5519,19 +4595,17 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
_RandomAccessIterator __last,
_Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType, _ValueType>)
+ typename iterator_traits<_RandomAccessIterator>::value_type,
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __middle);
__glibcxx_requires_valid_range(__middle, __last);
- std::__heap_select(__first, __middle, __last, __CheckedCompare(__comp));
- std::sort_heap(__first, __middle, __CheckedCompare(__comp));
+ std::__partial_sort(__first, __middle, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
/**
@@ -5554,13 +4628,11 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,
_RandomAccessIterator __last)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __nth);
__glibcxx_requires_valid_range(__nth, __last);
@@ -5568,7 +4640,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
return;
std::__introselect(__first, __nth, __last,
- std::__lg(__last - __first) * 2);
+ std::__lg(__last - __first) * 2,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -5593,14 +4666,12 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,
_RandomAccessIterator __last, _Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType, _ValueType>)
+ typename iterator_traits<_RandomAccessIterator>::value_type,
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __nth);
__glibcxx_requires_valid_range(__nth, __last);
@@ -5609,10 +4680,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
std::__introselect(__first, __nth, __last,
std::__lg(__last - __first) * 2,
- __CheckedCompare(__comp));
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
-
/**
* @brief Sort the elements of a sequence.
* @ingroup sorting_algorithms
@@ -5631,21 +4701,14 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
inline void
sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first != __last)
- {
- std::__introsort_loop(__first, __last,
- std::__lg(__last - __first) * 2);
- std::__final_insertion_sort(__first, __last);
- }
+ std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -5668,24 +4731,40 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
- __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType,
- _ValueType>)
+ __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
+ typename iterator_traits<_RandomAccessIterator>::value_type,
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first != __last)
+ std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator, typename _Compare>
+ _OutputIterator
+ __merge(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
+ while (__first1 != __last1 && __first2 != __last2)
{
- std::__introsort_loop(__first, __last,
- std::__lg(__last - __first) * 2,
- __CheckedCompare(__comp));
- std::__final_insertion_sort(__first, __last,
- __CheckedCompare(__comp));
+ if (__comp(__first2, __first1))
+ {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ }
+ ++__result;
}
+ return std::copy(__first2, __last2,
+ std::copy(__first1, __last1, __result));
}
/**
@@ -5709,43 +4788,27 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
- _OutputIterator
+ inline _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set(__first1, __last1, __first2);
__glibcxx_requires_sorted_set(__first2, __last2, __first1);
- while (__first1 != __last1 && __first2 != __last2)
- {
- if (*__first2 < *__first1)
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- *__result = *__first1;
- ++__first1;
- }
- ++__result;
- }
- return std::copy(__first2, __last2, std::copy(__first1, __last1,
- __result));
+ return _GLIBCXX_STD_A::__merge(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -5773,46 +4836,48 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
- _OutputIterator
+ inline _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result, _Compare __comp)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType2>)
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
__glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
- while (__first1 != __last1 && __first2 != __last2)
- {
- if (__CheckedCompare(__comp)(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- *__result = *__first1;
- ++__first1;
- }
- ++__result;
- }
- return std::copy(__first2, __last2, std::copy(__first1, __last1,
- __result));
+ return _GLIBCXX_STD_A::__merge(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
+ template<typename _RandomAccessIterator, typename _Compare>
+ inline void
+ __stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_RandomAccessIterator>::value_type
+ _ValueType;
+ typedef typename iterator_traits<_RandomAccessIterator>::difference_type
+ _DistanceType;
+
+ typedef _Temporary_buffer<_RandomAccessIterator, _ValueType> _TmpBuf;
+ _TmpBuf __buf(__first, __last);
+
+ if (__buf.begin() == 0)
+ std::__inplace_stable_sort(__first, __last, __comp);
+ else
+ std::__stable_sort_adaptive(__first, __last, __buf.begin(),
+ _DistanceType(__buf.size()), __comp);
+ }
/**
* @brief Sort the elements of a sequence, preserving the relative order
@@ -5835,24 +4900,15 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
inline void
stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type
- _DistanceType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first,
- __last);
- if (__buf.begin() == 0)
- std::__inplace_stable_sort(__first, __last);
- else
- std::__stable_sort_adaptive(__first, __last, __buf.begin(),
- _DistanceType(__buf.size()));
+ _GLIBCXX_STD_A::__stable_sort(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -5878,29 +4934,49 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type
- _DistanceType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType,
- _ValueType>)
+ typename iterator_traits<_RandomAccessIterator>::value_type,
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first,
- __last);
- if (__buf.begin() == 0)
- std::__inplace_stable_sort(__first, __last, __CheckedCompare(__comp));
- else
- std::__stable_sort_adaptive(__first, __last, __buf.begin(),
- _DistanceType(__buf.size()),
- __CheckedCompare(__comp));
+ _GLIBCXX_STD_A::__stable_sort(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator,
+ typename _Compare>
+ _OutputIterator
+ __set_union(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
+ while (__first1 != __last1 && __first2 != __last2)
+ {
+ if (__comp(__first1, __first2))
+ {
+ *__result = *__first1;
+ ++__first1;
+ }
+ else if (__comp(__first2, __first1))
+ {
+ *__result = *__first2;
+ ++__first2;
+ }
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ }
+ ++__result;
+ }
+ return std::copy(__first2, __last2,
+ std::copy(__first1, __last1, __result));
+ }
/**
* @brief Return the union of two sorted ranges.
@@ -5922,50 +4998,30 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
- _OutputIterator
+ inline _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set(__first1, __last1, __first2);
__glibcxx_requires_sorted_set(__first2, __last2, __first1);
- while (__first1 != __last1 && __first2 != __last2)
- {
- if (*__first1 < *__first2)
- {
- *__result = *__first1;
- ++__first1;
- }
- else if (*__first2 < *__first1)
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- }
- ++__result;
- }
- return std::copy(__first2, __last2, std::copy(__first1, __last1,
- __result));
+ return _GLIBCXX_STD_A::__set_union(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -5989,52 +5045,53 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
- _OutputIterator
+ inline _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result, _Compare __comp)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType2>)
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType1, _ValueType2>)
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
__glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+ return _GLIBCXX_STD_A::__set_union(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator,
+ typename _Compare>
+ _OutputIterator
+ __set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
while (__first1 != __last1 && __first2 != __last2)
- {
- if (__CheckedCompare(__comp)(*__first1, *__first2))
- {
- *__result = *__first1;
- ++__first1;
- }
- else if (__CheckedCompare(__comp)(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__first2;
- }
- else
- {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- }
- ++__result;
- }
- return std::copy(__first2, __last2, std::copy(__first1, __last1,
- __result));
+ if (__comp(__first1, __first2))
+ ++__first1;
+ else if (__comp(__first2, __first1))
+ ++__first2;
+ else
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__first2;
+ ++__result;
+ }
+ return __result;
}
/**
@@ -6056,39 +5113,28 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
- _OutputIterator
+ inline _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set(__first1, __last1, __first2);
__glibcxx_requires_sorted_set(__first2, __last2, __first1);
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first1 < *__first2)
- ++__first1;
- else if (*__first2 < *__first1)
- ++__first2;
- else
- {
- *__result = *__first1;
- ++__first1;
- ++__first2;
- ++__result;
- }
- return __result;
+ return _GLIBCXX_STD_A::__set_intersection(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -6113,41 +5159,53 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
- _OutputIterator
+ inline _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result, _Compare __comp)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType1, _ValueType2>)
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
__glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+ return _GLIBCXX_STD_A::__set_intersection(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator,
+ typename _Compare>
+ _OutputIterator
+ __set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _OutputIterator __result, _Compare __comp)
+ {
while (__first1 != __last1 && __first2 != __last2)
- if (__CheckedCompare(__comp)(*__first1, *__first2))
- ++__first1;
- else if (__CheckedCompare(__comp)(*__first2, *__first1))
+ if (__comp(__first1, __first2))
+ {
+ *__result = *__first1;
+ ++__first1;
+ ++__result;
+ }
+ else if (__comp(__first2, __first1))
++__first2;
else
{
- *__result = *__first1;
++__first1;
++__first2;
- ++__result;
}
- return __result;
+ return std::copy(__first1, __last1, __result);
}
/**
@@ -6171,41 +5229,28 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
- _OutputIterator
+ inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set(__first1, __last1, __first2);
__glibcxx_requires_sorted_set(__first2, __last2, __first1);
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first1 < *__first2)
- {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (*__first2 < *__first1)
- ++__first2;
- else
- {
- ++__first1;
- ++__first2;
- }
- return std::copy(__first1, __last1, __result);
+ return _GLIBCXX_STD_A::__set_difference(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -6232,43 +5277,61 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
- _OutputIterator
+ inline _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result, _Compare __comp)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType1, _ValueType2>)
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
__glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
+ return _GLIBCXX_STD_A::__set_difference(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _OutputIterator,
+ typename _Compare>
+ _OutputIterator
+ __set_symmetric_difference(_InputIterator1 __first1,
+ _InputIterator1 __last1,
+ _InputIterator2 __first2,
+ _InputIterator2 __last2,
+ _OutputIterator __result,
+ _Compare __comp)
+ {
while (__first1 != __last1 && __first2 != __last2)
- if (__CheckedCompare(__comp)(*__first1, *__first2))
+ if (__comp(__first1, __first2))
{
*__result = *__first1;
++__first1;
++__result;
}
- else if (__CheckedCompare(__comp)(*__first2, *__first1))
- ++__first2;
+ else if (__comp(__first2, __first1))
+ {
+ *__result = *__first2;
+ ++__first2;
+ ++__result;
+ }
else
{
++__first1;
++__first2;
}
- return std::copy(__first1, __last1, __result);
+ return std::copy(__first2, __last2,
+ std::copy(__first1, __last1, __result));
}
/**
@@ -6290,48 +5353,30 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator>
- _OutputIterator
+ inline _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set(__first1, __last1, __first2);
__glibcxx_requires_sorted_set(__first2, __last2, __first1);
- while (__first1 != __last1 && __first2 != __last2)
- if (*__first1 < *__first2)
- {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (*__first2 < *__first1)
- {
- *__result = *__first2;
- ++__first2;
- ++__result;
- }
- else
- {
- ++__first1;
- ++__first2;
- }
- return std::copy(__first2, __last2, std::copy(__first1,
- __last1, __result));
+ return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -6356,53 +5401,46 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _OutputIterator, typename _Compare>
- _OutputIterator
+ inline _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_OutputIterator __result,
_Compare __comp)
{
- typedef typename iterator_traits<_InputIterator1>::value_type
- _ValueType1;
- typedef typename iterator_traits<_InputIterator2>::value_type
- _ValueType2;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType1>)
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
- _ValueType2>)
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType1, _ValueType2>)
+ typename iterator_traits<_InputIterator1>::value_type,
+ typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_function_requires(_BinaryPredicateConcept<_Compare,
- _ValueType2, _ValueType1>)
+ typename iterator_traits<_InputIterator2>::value_type,
+ typename iterator_traits<_InputIterator1>::value_type>)
__glibcxx_requires_sorted_set_pred(__first1, __last1, __first2, __comp);
__glibcxx_requires_sorted_set_pred(__first2, __last2, __first1, __comp);
- while (__first1 != __last1 && __first2 != __last2)
- if (__CheckedCompare(__comp)(*__first1, *__first2))
- {
- *__result = *__first1;
- ++__first1;
- ++__result;
- }
- else if (__CheckedCompare(__comp)(*__first2, *__first1))
- {
- *__result = *__first2;
- ++__first2;
- ++__result;
- }
- else
- {
- ++__first1;
- ++__first2;
- }
- return std::copy(__first2, __last2,
- std::copy(__first1, __last1, __result));
+ return _GLIBCXX_STD_A::__set_symmetric_difference(__first1, __last1,
+ __first2, __last2, __result,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
+ template<typename _ForwardIterator, typename _Compare>
+ _ForwardIterator
+ __min_element(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ if (__first == __last)
+ return __first;
+ _ForwardIterator __result = __first;
+ while (++__first != __last)
+ if (__comp(__first, __result))
+ __result = __first;
+ return __result;
+ }
/**
* @brief Return the minimum element in a range.
@@ -6413,7 +5451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _ForwardIterator>
_ForwardIterator
- min_element(_ForwardIterator __first, _ForwardIterator __last)
+ inline min_element(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
@@ -6421,13 +5459,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __first;
- _ForwardIterator __result = __first;
- while (++__first != __last)
- if (*__first < *__result)
- __result = __first;
- return __result;
+ return _GLIBCXX_STD_A::__min_element(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -6440,7 +5473,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* according to __comp.
*/
template<typename _ForwardIterator, typename _Compare>
- _ForwardIterator
+ inline _ForwardIterator
min_element(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
{
@@ -6451,11 +5484,19 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __first;
+ return _GLIBCXX_STD_A::__min_element(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
+ }
+
+ template<typename _ForwardIterator, typename _Compare>
+ _ForwardIterator
+ __max_element(_ForwardIterator __first, _ForwardIterator __last,
+ _Compare __comp)
+ {
+ if (__first == __last) return __first;
_ForwardIterator __result = __first;
while (++__first != __last)
- if (__CheckedCompare(__comp)(*__first, *__result))
+ if (__comp(__result, __first))
__result = __first;
return __result;
}
@@ -6468,7 +5509,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* @return Iterator referencing the first instance of the largest value.
*/
template<typename _ForwardIterator>
- _ForwardIterator
+ inline _ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last)
{
// concept requirements
@@ -6477,13 +5518,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last)
- return __first;
- _ForwardIterator __result = __first;
- while (++__first != __last)
- if (*__result < *__first)
- __result = __first;
- return __result;
+ return _GLIBCXX_STD_A::__max_element(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -6496,7 +5532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* according to __comp.
*/
template<typename _ForwardIterator, typename _Compare>
- _ForwardIterator
+ inline _ForwardIterator
max_element(_ForwardIterator __first, _ForwardIterator __last,
_Compare __comp)
{
@@ -6507,16 +5543,10 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- if (__first == __last) return __first;
- _ForwardIterator __result = __first;
- while (++__first != __last)
- if (__CheckedCompare(__comp)(*__result, *__first))
- __result = __first;
- return __result;
+ return _GLIBCXX_STD_A::__max_element(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__CheckedCompare(__comp)));
}
-#undef __CheckedCompare
-
_GLIBCXX_END_NAMESPACE_ALGO
} // namespace std
diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h
index 1c889356460..a7432da150c 100644
--- a/libstdc++-v3/include/bits/stl_algobase.h
+++ b/libstdc++-v3/include/bits/stl_algobase.h
@@ -68,6 +68,7 @@
#include <bits/concept_check.h>
#include <debug/debug.h>
#include <bits/move.h> // For std::swap and _GLIBCXX_MOVE
+#include <bits/predefined_ops.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -862,6 +863,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return true; }
};
+ template<typename _II1, typename _II2, typename _Compare>
+ bool
+ __lexicographical_compare_impl(_II1 __first1, _II1 __last1,
+ _II2 __first2, _II2 __last2,
+ _Compare __comp)
+ {
+ typedef typename iterator_traits<_II1>::iterator_category _Category1;
+ typedef typename iterator_traits<_II2>::iterator_category _Category2;
+ typedef std::__lc_rai<_Category1, _Category2> __rai_type;
+
+ __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
+ for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
+ ++__first1, ++__first2)
+ {
+ if (__comp(__first1, __first2))
+ return true;
+ if (__comp(__first2, __first1))
+ return false;
+ }
+ return __first1 == __last1 && __first2 != __last2;
+ }
+
template<bool _BoolType>
struct __lexicographical_compare
{
@@ -875,21 +898,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__lexicographical_compare<_BoolType>::
__lc(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
{
- typedef typename iterator_traits<_II1>::iterator_category _Category1;
- typedef typename iterator_traits<_II2>::iterator_category _Category2;
- typedef std::__lc_rai<_Category1, _Category2> __rai_type;
-
- __last1 = __rai_type::__newlast1(__first1, __last1,
- __first2, __last2);
- for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
- ++__first1, ++__first2)
- {
- if (*__first1 < *__first2)
- return true;
- if (*__first2 < *__first1)
- return false;
- }
- return __first1 == __last1 && __first2 != __last2;
+ return std::__lexicographical_compare_impl(__first1, __last1,
+ __first2, __last2,
+ __gnu_cxx::__ops::__iter_less_iter());
}
template<>
@@ -926,34 +937,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__first2, __last2);
}
- /**
- * @brief Finds the first position in which @a val could be inserted
- * without changing the ordering.
- * @param __first An iterator.
- * @param __last Another iterator.
- * @param __val The search term.
- * @return An iterator pointing to the first element <em>not less
- * than</em> @a val, or end() if every element is less than
- * @a val.
- * @ingroup binary_search_algorithms
- */
- template<typename _ForwardIterator, typename _Tp>
+ template<typename _ForwardIterator, typename _Tp, typename _Compare>
_ForwardIterator
- lower_bound(_ForwardIterator __first, _ForwardIterator __last,
- const _Tp& __val)
+ __lower_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val, _Compare __comp)
{
-#ifdef _GLIBCXX_CONCEPT_CHECKS
- typedef typename iterator_traits<_ForwardIterator>::value_type
- _ValueType;
-#endif
typedef typename iterator_traits<_ForwardIterator>::difference_type
_DistanceType;
- // concept requirements
- __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
- __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)
- __glibcxx_requires_partitioned_lower(__first, __last, __val);
-
_DistanceType __len = std::distance(__first, __last);
while (__len > 0)
@@ -961,7 +952,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_DistanceType __half = __len >> 1;
_ForwardIterator __middle = __first;
std::advance(__middle, __half);
- if (*__middle < __val)
+ if (__comp(__middle, __val))
{
__first = __middle;
++__first;
@@ -973,6 +964,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __first;
}
+ /**
+ * @brief Finds the first position in which @a val could be inserted
+ * without changing the ordering.
+ * @param __first An iterator.
+ * @param __last Another iterator.
+ * @param __val The search term.
+ * @return An iterator pointing to the first element <em>not less
+ * than</em> @a val, or end() if every element is less than
+ * @a val.
+ * @ingroup binary_search_algorithms
+ */
+ template<typename _ForwardIterator, typename _Tp>
+ inline _ForwardIterator
+ lower_bound(_ForwardIterator __first, _ForwardIterator __last,
+ const _Tp& __val)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
+ __glibcxx_function_requires(_LessThanOpConcept<
+ typename iterator_traits<_ForwardIterator>::value_type, _Tp>)
+ __glibcxx_requires_partitioned_lower(__first, __last, __val);
+
+ return std::__lower_bound(__first, __last, __val,
+ __gnu_cxx::__ops::__iter_less_val());
+ }
+
/// This is a helper function for the sort routines and for random.tcc.
// Precondition: __n > 0.
inline _GLIBCXX_CONSTEXPR int
@@ -1100,7 +1117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
auto __d2 = std::distance(__first2, __last2);
if (__d1 != __d2)
return false;
- return std::equal(__first1, __last1, __first2);
+ return _GLIBCXX_STD_A::equal(__first1, __last1, __first2);
}
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
@@ -1146,7 +1163,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
auto __d2 = std::distance(__first2, __last2);
if (__d1 != __d2)
return false;
- return std::equal(__first1, __last1, __first2, __binary_pred);
+ return _GLIBCXX_STD_A::equal(__first1, __last1, __first2,
+ __binary_pred);
}
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
@@ -1208,30 +1226,33 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* comp parameter instead of @c <.
*/
template<typename _II1, typename _II2, typename _Compare>
- bool
+ inline bool
lexicographical_compare(_II1 __first1, _II1 __last1,
_II2 __first2, _II2 __last2, _Compare __comp)
{
- typedef typename iterator_traits<_II1>::iterator_category _Category1;
- typedef typename iterator_traits<_II2>::iterator_category _Category2;
- typedef std::__lc_rai<_Category1, _Category2> __rai_type;
-
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_II1>)
__glibcxx_function_requires(_InputIteratorConcept<_II2>)
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2);
- for (; __first1 != __last1 && __rai_type::__cnd2(__first2, __last2);
- ++__first1, ++__first2)
- {
- if (__comp(*__first1, *__first2))
- return true;
- if (__comp(*__first2, *__first1))
- return false;
- }
- return __first1 == __last1 && __first2 != __last2;
+ return std::__lexicographical_compare_impl
+ (__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _BinaryPredicate>
+ pair<_InputIterator1, _InputIterator2>
+ __mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _BinaryPredicate __binary_pred)
+ {
+ while (__first1 != __last1 && __binary_pred(__first1, __first2))
+ {
+ ++__first1;
+ ++__first2;
+ }
+ return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
}
/**
@@ -1248,7 +1269,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* to by the iterators are not equal.
*/
template<typename _InputIterator1, typename _InputIterator2>
- pair<_InputIterator1, _InputIterator2>
+ inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2)
{
@@ -1260,12 +1281,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
typename iterator_traits<_InputIterator2>::value_type>)
__glibcxx_requires_valid_range(__first1, __last1);
- while (__first1 != __last1 && *__first1 == *__first2)
- {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+ return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -1286,7 +1303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
- pair<_InputIterator1, _InputIterator2>
+ inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _BinaryPredicate __binary_pred)
{
@@ -1295,7 +1312,21 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
__glibcxx_requires_valid_range(__first1, __last1);
- while (__first1 != __last1 && bool(__binary_pred(*__first1, *__first2)))
+ return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2,
+ __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
+ }
+
+#if __cplusplus > 201103L
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _BinaryPredicate>
+ pair<_InputIterator1, _InputIterator2>
+ __mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _BinaryPredicate __binary_pred)
+ {
+ while (__first1 != __last1 && __first2 != __last2
+ && __binary_pred(__first1, __first2))
{
++__first1;
++__first2;
@@ -1303,7 +1334,6 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
}
-#if __cplusplus > 201103L
/**
* @brief Finds the places in ranges which don't match.
* @ingroup non_mutating_algorithms
@@ -1319,7 +1349,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
* to by the iterators are not equal.
*/
template<typename _InputIterator1, typename _InputIterator2>
- pair<_InputIterator1, _InputIterator2>
+ inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
{
@@ -1332,13 +1362,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- while (__first1 != __last1 && __first2 != __last2
- && *__first1 == *__first2)
- {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+ return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_equal_to_iter());
}
/**
@@ -1360,7 +1385,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
*/
template<typename _InputIterator1, typename _InputIterator2,
typename _BinaryPredicate>
- pair<_InputIterator1, _InputIterator2>
+ inline pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_BinaryPredicate __binary_pred)
@@ -1371,13 +1396,8 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO
__glibcxx_requires_valid_range(__first1, __last1);
__glibcxx_requires_valid_range(__first2, __last2);
- while (__first1 != __last1 && __first2 != __last2
- && bool(__binary_pred(*__first1, *__first2)))
- {
- ++__first1;
- ++__first2;
- }
- return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
+ return _GLIBCXX_STD_A::__mismatch(__first1, __last1, __first2, __last2,
+ __gnu_cxx::__ops::__iter_comp_iter(__binary_pred));
}
#endif
diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index 35995eeb71e..394f4e498c1 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -875,7 +875,10 @@ template<typename _Alloc>
_M_range_check(size_type __n) const
{
if (__n >= this->size())
- __throw_out_of_range(__N("vector<bool>::_M_range_check"));
+ __throw_out_of_range_fmt(__N("vector<bool>::_M_range_check: __n "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
}
public:
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index e97918e3f18..b82e2088258 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -108,7 +108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
- static size_t _S_buffer_size()
+ static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT
{ return __deque_buf_size(sizeof(_Tp)); }
typedef std::random_access_iterator_tag iterator_category;
@@ -125,31 +125,31 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Tp* _M_last;
_Map_pointer _M_node;
- _Deque_iterator(_Tp* __x, _Map_pointer __y)
+ _Deque_iterator(_Tp* __x, _Map_pointer __y) _GLIBCXX_NOEXCEPT
: _M_cur(__x), _M_first(*__y),
_M_last(*__y + _S_buffer_size()), _M_node(__y) { }
- _Deque_iterator()
+ _Deque_iterator() _GLIBCXX_NOEXCEPT
: _M_cur(0), _M_first(0), _M_last(0), _M_node(0) { }
- _Deque_iterator(const iterator& __x)
+ _Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
: _M_cur(__x._M_cur), _M_first(__x._M_first),
_M_last(__x._M_last), _M_node(__x._M_node) { }
iterator
- _M_const_cast() const
+ _M_const_cast() const _GLIBCXX_NOEXCEPT
{ return iterator(_M_cur, _M_node); }
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return *_M_cur; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return _M_cur; }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
++_M_cur;
if (_M_cur == _M_last)
@@ -161,7 +161,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
++*this;
@@ -169,7 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
if (_M_cur == _M_first)
{
@@ -181,7 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
--*this;
@@ -189,7 +189,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self&
- operator+=(difference_type __n)
+ operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
{
const difference_type __offset = __n + (_M_cur - _M_first);
if (__offset >= 0 && __offset < difference_type(_S_buffer_size()))
@@ -208,25 +208,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self
- operator+(difference_type __n) const
+ operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
return __tmp += __n;
}
_Self&
- operator-=(difference_type __n)
+ operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
{ return *this += -__n; }
_Self
- operator-(difference_type __n) const
+ operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
return __tmp -= __n;
}
reference
- operator[](difference_type __n) const
+ operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
{ return *(*this + __n); }
/**
@@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* immediately afterwards, based on _M_first and _M_last.
*/
void
- _M_set_node(_Map_pointer __new_node)
+ _M_set_node(_Map_pointer __new_node) _GLIBCXX_NOEXCEPT
{
_M_node = __new_node;
_M_first = *__new_node;
@@ -249,33 +249,33 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_cur == __y._M_cur; }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_cur == __y._M_cur; }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x == __y); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x == __y); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
: (__x._M_node < __y._M_node); }
@@ -283,47 +283,47 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typename _RefR, typename _PtrR>
inline bool
operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
: (__x._M_node < __y._M_node); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return __y < __x; }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return __y < __x; }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return !(__y < __x); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return !(__y < __x); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x < __y); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x < __y); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -333,7 +333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Ref, typename _Ptr>
inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type
operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
- const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
+ const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{
return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type
(_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size())
@@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typename _RefR, typename _PtrR>
inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
- const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
+ const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{
return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
(_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size())
@@ -356,6 +356,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Ref, typename _Ptr>
inline _Deque_iterator<_Tp, _Ref, _Ptr>
operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
+ _GLIBCXX_NOEXCEPT
{ return __x + __n; }
template<typename _Tp>
@@ -466,7 +467,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Deque_base(const allocator_type& __a)
: _M_impl(__a)
- { }
+ { _M_initialize_map(0); }
#if __cplusplus >= 201103L
_Deque_base(_Deque_base&& __x)
@@ -483,7 +484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
#endif
- ~_Deque_base();
+ ~_Deque_base() _GLIBCXX_NOEXCEPT;
protected:
//This struct encapsulates the implementation of the std::deque
@@ -506,13 +507,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_start(), _M_finish()
{ }
- _Deque_impl(const _Tp_alloc_type& __a)
+ _Deque_impl(const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _Tp_alloc_type(__a), _M_map(0), _M_map_size(0),
_M_start(), _M_finish()
{ }
#if __cplusplus >= 201103L
- _Deque_impl(_Tp_alloc_type&& __a)
+ _Deque_impl(_Tp_alloc_type&& __a) _GLIBCXX_NOEXCEPT
: _Tp_alloc_type(std::move(__a)), _M_map(0), _M_map_size(0),
_M_start(), _M_finish()
{ }
@@ -538,7 +539,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
void
- _M_deallocate_node(_Tp* __p)
+ _M_deallocate_node(_Tp* __p) _GLIBCXX_NOEXCEPT
{
_M_impl._Tp_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp)));
}
@@ -548,13 +549,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_get_map_allocator().allocate(__n); }
void
- _M_deallocate_map(_Tp** __p, size_t __n)
+ _M_deallocate_map(_Tp** __p, size_t __n) _GLIBCXX_NOEXCEPT
{ _M_get_map_allocator().deallocate(__p, __n); }
protected:
void _M_initialize_map(size_t);
void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
- void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
+ void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) _GLIBCXX_NOEXCEPT;
enum { _S_initial_map_size = 8 };
_Deque_impl _M_impl;
@@ -562,7 +563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
_Deque_base<_Tp, _Alloc>::
- ~_Deque_base()
+ ~_Deque_base() _GLIBCXX_NOEXCEPT
{
if (this->_M_impl._M_map)
{
@@ -640,7 +641,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
void
_Deque_base<_Tp, _Alloc>::
- _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
+ _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) _GLIBCXX_NOEXCEPT
{
for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
_M_deallocate_node(*__n);
@@ -758,7 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
protected:
typedef pointer* _Map_pointer;
- static size_t _S_buffer_size()
+ static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT
{ return __deque_buf_size(sizeof(_Tp)); }
// Functions controlling memory layout, and nothing else.
@@ -781,18 +782,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// [23.2.1.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
- * @brief Default constructor creates no elements.
- */
- deque()
- : _Base() { }
-
- /**
* @brief Creates a %deque with no elements.
* @param __a An allocator object.
*/
explicit
- deque(const allocator_type& __a)
- : _Base(__a, 0) { }
+ deque(const allocator_type& __a = allocator_type())
+ : _Base(__a) { }
#if __cplusplus >= 201103L
/**
@@ -940,7 +935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @a __x is a valid, but unspecified %deque.
*/
deque&
- operator=(deque&& __x)
+ operator=(deque&& __x) noexcept
{
// NB: DR 1204.
// NB: DR 675.
@@ -1220,7 +1215,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus >= 201103L
/** A non-binding request to reduce memory use. */
void
- shrink_to_fit()
+ shrink_to_fit() noexcept
{ _M_shrink_to_fit(); }
#endif
@@ -1245,7 +1240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* see at().)
*/
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
_M_range_check(__n);
@@ -1265,7 +1260,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* see at().)
*/
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
_M_range_check(__n);
@@ -1279,7 +1274,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_range_check(size_type __n) const
{
if (__n >= this->size())
- __throw_out_of_range(__N("deque::_M_range_check"));
+ __throw_out_of_range_fmt(__N("deque::_M_range_check: __n "
+ "(which is %zu)>= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
}
public:
@@ -1324,7 +1322,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %deque.
*/
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
if (empty()) __throw_logic_error("front() on empty deque");
@@ -1337,7 +1335,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %deque.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
if (empty()) __throw_logic_error("front() on empty deque");
@@ -1350,7 +1348,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* %deque.
*/
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
if (empty()) __throw_logic_error("back() on empty deque");
@@ -1365,7 +1363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %deque.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
if (empty()) __throw_logic_error("back() on empty deque");
@@ -1448,7 +1446,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* needed, it should be retrieved before pop_front() is called.
*/
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
if (empty()) __throw_logic_error("pop_front() on empty deque");
@@ -1472,7 +1470,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* needed, it should be retrieved before pop_back() is called.
*/
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_deque
if (empty()) __throw_logic_error("pop_back() on empty deque");
@@ -1687,7 +1685,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* std::swap(d1,d2) will feed to this function.
*/
void
- swap(deque& __x)
+ swap(deque& __x) _GLIBCXX_NOEXCEPT
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
diff --git a/libstdc++-v3/include/bits/stl_heap.h b/libstdc++-v3/include/bits/stl_heap.h
index 807a8cf0525..a0c51ff7a1f 100644
--- a/libstdc++-v3/include/bits/stl_heap.h
+++ b/libstdc++-v3/include/bits/stl_heap.h
@@ -57,6 +57,7 @@
#include <debug/debug.h>
#include <bits/move.h>
+#include <bits/predefined_ops.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -67,21 +68,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup sorting_algorithms
*/
- template<typename _RandomAccessIterator, typename _Distance>
- _Distance
- __is_heap_until(_RandomAccessIterator __first, _Distance __n)
- {
- _Distance __parent = 0;
- for (_Distance __child = 1; __child < __n; ++__child)
- {
- if (__first[__parent] < __first[__child])
- return __child;
- if ((__child & 1) == 0)
- ++__parent;
- }
- return __n;
- }
-
template<typename _RandomAccessIterator, typename _Distance,
typename _Compare>
_Distance
@@ -91,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Distance __parent = 0;
for (_Distance __child = 1; __child < __n; ++__child)
{
- if (__comp(__first[__parent], __first[__child]))
+ if (__comp(__first + __parent, __first + __child))
return __child;
if ((__child & 1) == 0)
++__parent;
@@ -104,13 +90,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _RandomAccessIterator, typename _Distance>
inline bool
__is_heap(_RandomAccessIterator __first, _Distance __n)
- { return std::__is_heap_until(__first, __n) == __n; }
+ {
+ return std::__is_heap_until(__first, __n,
+ __gnu_cxx::__ops::__iter_less_iter()) == __n;
+ }
template<typename _RandomAccessIterator, typename _Compare,
typename _Distance>
inline bool
__is_heap(_RandomAccessIterator __first, _Compare __comp, _Distance __n)
- { return std::__is_heap_until(__first, __n, __comp) == __n; }
+ {
+ return std::__is_heap_until(__first, __n,
+ __gnu_cxx::__ops::__iter_comp_iter(__comp)) == __n;
+ }
template<typename _RandomAccessIterator>
inline bool
@@ -126,13 +118,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap,
// + is_heap and is_heap_until in C++0x.
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp>
+ template<typename _RandomAccessIterator, typename _Distance, typename _Tp,
+ typename _Compare>
void
__push_heap(_RandomAccessIterator __first,
- _Distance __holeIndex, _Distance __topIndex, _Tp __value)
+ _Distance __holeIndex, _Distance __topIndex, _Tp __value,
+ _Compare __comp)
{
_Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && *(__first + __parent) < __value)
+ while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
{
*(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
__holeIndex = __parent;
@@ -169,24 +163,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_ValueType __value = _GLIBCXX_MOVE(*(__last - 1));
std::__push_heap(__first, _DistanceType((__last - __first) - 1),
- _DistanceType(0), _GLIBCXX_MOVE(__value));
- }
-
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp,
- typename _Compare>
- void
- __push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __topIndex, _Tp __value, _Compare __comp)
- {
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex
- && __comp(*(__first + __parent), __value))
- {
- *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __parent));
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = _GLIBCXX_MOVE(__value);
+ _DistanceType(0), _GLIBCXX_MOVE(__value),
+ __gnu_cxx::__ops::__iter_less_val());
}
/**
@@ -219,20 +197,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_ValueType __value = _GLIBCXX_MOVE(*(__last - 1));
std::__push_heap(__first, _DistanceType((__last - __first) - 1),
- _DistanceType(0), _GLIBCXX_MOVE(__value), __comp);
+ _DistanceType(0), _GLIBCXX_MOVE(__value),
+ __gnu_cxx::__ops::__iter_comp_val(__comp));
}
- template<typename _RandomAccessIterator, typename _Distance, typename _Tp>
+ template<typename _RandomAccessIterator, typename _Distance,
+ typename _Tp, typename _Compare>
void
__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value)
+ _Distance __len, _Tp __value, _Compare __comp)
{
const _Distance __topIndex = __holeIndex;
_Distance __secondChild = __holeIndex;
while (__secondChild < (__len - 1) / 2)
{
__secondChild = 2 * (__secondChild + 1);
- if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
+ if (__comp(__first + __secondChild,
+ __first + (__secondChild - 1)))
__secondChild--;
*(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));
__holeIndex = __secondChild;
@@ -244,14 +225,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ (__secondChild - 1)));
__holeIndex = __secondChild - 1;
}
- std::__push_heap(__first, __holeIndex, __topIndex,
- _GLIBCXX_MOVE(__value));
+ std::__push_heap(__first, __holeIndex, __topIndex,
+ _GLIBCXX_MOVE(__value),
+ __gnu_cxx::__ops::__iter_comp_val(__comp));
}
- template<typename _RandomAccessIterator>
+ template<typename _RandomAccessIterator, typename _Compare>
inline void
__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result)
+ _RandomAccessIterator __result, _Compare __comp)
{
typedef typename iterator_traits<_RandomAccessIterator>::value_type
_ValueType;
@@ -262,7 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*__result = _GLIBCXX_MOVE(*__first);
std::__adjust_heap(__first, _DistanceType(0),
_DistanceType(__last - __first),
- _GLIBCXX_MOVE(__value));
+ _GLIBCXX_MOVE(__value), __comp);
}
/**
@@ -294,55 +276,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__last - __first > 1)
{
--__last;
- std::__pop_heap(__first, __last, __last);
+ std::__pop_heap(__first, __last, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
}
- template<typename _RandomAccessIterator, typename _Distance,
- typename _Tp, typename _Compare>
- void
- __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value, _Compare __comp)
- {
- const _Distance __topIndex = __holeIndex;
- _Distance __secondChild = __holeIndex;
- while (__secondChild < (__len - 1) / 2)
- {
- __secondChild = 2 * (__secondChild + 1);
- if (__comp(*(__first + __secondChild),
- *(__first + (__secondChild - 1))))
- __secondChild--;
- *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));
- __holeIndex = __secondChild;
- }
- if ((__len & 1) == 0 && __secondChild == (__len - 2) / 2)
- {
- __secondChild = 2 * (__secondChild + 1);
- *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first
- + (__secondChild - 1)));
- __holeIndex = __secondChild - 1;
- }
- std::__push_heap(__first, __holeIndex, __topIndex,
- _GLIBCXX_MOVE(__value), __comp);
- }
-
- template<typename _RandomAccessIterator, typename _Compare>
- inline void
- __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Compare __comp)
- {
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type
- _DistanceType;
-
- _ValueType __value = _GLIBCXX_MOVE(*__result);
- *__result = _GLIBCXX_MOVE(*__first);
- std::__adjust_heap(__first, _DistanceType(0),
- _DistanceType(__last - __first),
- _GLIBCXX_MOVE(__value), __comp);
- }
-
/**
* @brief Pop an element off a heap using comparison functor.
* @param __first Start of heap.
@@ -369,33 +307,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__last - __first > 1)
{
--__last;
- std::__pop_heap(__first, __last, __last, __comp);
+ std::__pop_heap(__first, __last, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__comp));
}
}
- /**
- * @brief Construct a heap over a range.
- * @param __first Start of heap.
- * @param __last End of heap.
- * @ingroup heap_algorithms
- *
- * This operation makes the elements in [__first,__last) into a heap.
- */
- template<typename _RandomAccessIterator>
+ template<typename _RandomAccessIterator, typename _Compare>
void
- make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
{
typedef typename iterator_traits<_RandomAccessIterator>::value_type
_ValueType;
typedef typename iterator_traits<_RandomAccessIterator>::difference_type
_DistanceType;
- // concept requirements
- __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
- _RandomAccessIterator>)
- __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)
- __glibcxx_requires_valid_range(__first, __last);
-
if (__last - __first < 2)
return;
@@ -404,12 +330,36 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
while (true)
{
_ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
- std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value));
+ std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
+ __comp);
if (__parent == 0)
return;
__parent--;
}
}
+
+ /**
+ * @brief Construct a heap over a range.
+ * @param __first Start of heap.
+ * @param __last End of heap.
+ * @ingroup heap_algorithms
+ *
+ * This operation makes the elements in [__first,__last) into a heap.
+ */
+ template<typename _RandomAccessIterator>
+ inline void
+ make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+ {
+ // concept requirements
+ __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
+ _RandomAccessIterator>)
+ __glibcxx_function_requires(_LessThanComparableConcept<
+ typename iterator_traits<_RandomAccessIterator>::value_type>)
+ __glibcxx_requires_valid_range(__first, __last);
+
+ std::__make_heap(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
+ }
/**
* @brief Construct a heap over a range using comparison functor.
@@ -422,33 +372,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Comparisons are made using __comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
- void
+ inline void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
{
- typedef typename iterator_traits<_RandomAccessIterator>::value_type
- _ValueType;
- typedef typename iterator_traits<_RandomAccessIterator>::difference_type
- _DistanceType;
-
// concept requirements
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__glibcxx_requires_valid_range(__first, __last);
- if (__last - __first < 2)
- return;
+ std::__make_heap(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__comp));
+ }
- const _DistanceType __len = __last - __first;
- _DistanceType __parent = (__len - 2) / 2;
- while (true)
+ template<typename _RandomAccessIterator, typename _Compare>
+ void
+ __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+ _Compare __comp)
+ {
+ while (__last - __first > 1)
{
- _ValueType __value = _GLIBCXX_MOVE(*(__first + __parent));
- std::__adjust_heap(__first, __parent, __len, _GLIBCXX_MOVE(__value),
- __comp);
- if (__parent == 0)
- return;
- __parent--;
+ --__last;
+ std::__pop_heap(__first, __last, __last, __comp);
}
}
@@ -461,7 +406,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* This operation sorts the valid heap in the range [__first,__last).
*/
template<typename _RandomAccessIterator>
- void
+ inline void
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
// concept requirements
@@ -472,11 +417,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_heap(__first, __last);
- while (__last - __first > 1)
- {
- --__last;
- std::__pop_heap(__first, __last, __last);
- }
+ std::__sort_heap(__first, __last,
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -490,7 +432,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Comparisons are made using __comp.
*/
template<typename _RandomAccessIterator, typename _Compare>
- void
+ inline void
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Compare __comp)
{
@@ -500,11 +442,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__glibcxx_requires_valid_range(__first, __last);
__glibcxx_requires_heap_pred(__first, __last, __comp);
- while (__last - __first > 1)
- {
- --__last;
- std::__pop_heap(__first, __last, __last, __comp);
- }
+ std::__sort_heap(__first, __last,
+ __gnu_cxx::__ops::__iter_comp_iter(__comp));
}
#if __cplusplus >= 201103L
@@ -529,8 +468,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last);
- return __first + std::__is_heap_until(__first, std::distance(__first,
- __last));
+ return __first +
+ std::__is_heap_until(__first, std::distance(__first, __last),
+ __gnu_cxx::__ops::__iter_less_iter());
}
/**
@@ -554,9 +494,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RandomAccessIterator>)
__glibcxx_requires_valid_range(__first, __last);
- return __first + std::__is_heap_until(__first, std::distance(__first,
- __last),
- __comp);
+ return __first
+ + std::__is_heap_until(__first, std::distance(__first, __last),
+ __gnu_cxx::__ops::__iter_comp_iter(__comp));
}
/**
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 9952c2c92d6..1f555a4ef28 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -721,22 +721,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename __traits_type::reference reference;
typedef typename __traits_type::pointer pointer;
- _GLIBCXX_CONSTEXPR __normal_iterator() : _M_current(_Iterator()) { }
+ _GLIBCXX_CONSTEXPR __normal_iterator() _GLIBCXX_NOEXCEPT
+ : _M_current(_Iterator()) { }
explicit
- __normal_iterator(const _Iterator& __i) : _M_current(__i) { }
+ __normal_iterator(const _Iterator& __i) _GLIBCXX_NOEXCEPT
+ : _M_current(__i) { }
// Allow iterator to const_iterator conversion
template<typename _Iter>
__normal_iterator(const __normal_iterator<_Iter,
typename __enable_if<
(std::__are_same<_Iter, typename _Container::pointer>::__value),
- _Container>::__type>& __i)
+ _Container>::__type>& __i) _GLIBCXX_NOEXCEPT
: _M_current(__i.base()) { }
#if __cplusplus >= 201103L
__normal_iterator<typename _Container::pointer, _Container>
- _M_const_cast() const
+ _M_const_cast() const noexcept
{
using _PTraits = std::pointer_traits<typename _Container::pointer>;
return __normal_iterator<typename _Container::pointer, _Container>
@@ -751,59 +753,59 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Forward iterator requirements
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return *_M_current; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return _M_current; }
__normal_iterator&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
++_M_current;
return *this;
}
__normal_iterator
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{ return __normal_iterator(_M_current++); }
// Bidirectional iterator requirements
__normal_iterator&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
--_M_current;
return *this;
}
__normal_iterator
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{ return __normal_iterator(_M_current--); }
// Random access iterator requirements
reference
- operator[](const difference_type& __n) const
+ operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
{ return _M_current[__n]; }
__normal_iterator&
- operator+=(const difference_type& __n)
+ operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
{ _M_current += __n; return *this; }
__normal_iterator
- operator+(const difference_type& __n) const
+ operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
{ return __normal_iterator(_M_current + __n); }
__normal_iterator&
- operator-=(const difference_type& __n)
+ operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
{ _M_current -= __n; return *this; }
__normal_iterator
- operator-(const difference_type& __n) const
+ operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
{ return __normal_iterator(_M_current - __n); }
const _Iterator&
- base() const
+ base() const _GLIBCXX_NOEXCEPT
{ return _M_current; }
};
@@ -820,24 +822,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() == __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() == __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() != __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() != __rhs.base(); }
// Random access iterator requirements
@@ -845,48 +851,56 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline bool
operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() < __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() < __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() > __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() > __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() <= __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() <= __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() >= __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() >= __rhs.base(); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -898,7 +912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// DR 685.
inline auto
operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
- const __normal_iterator<_IteratorR, _Container>& __rhs)
+ const __normal_iterator<_IteratorR, _Container>& __rhs) noexcept
-> decltype(__lhs.base() - __rhs.base())
#else
inline typename __normal_iterator<_IteratorL, _Container>::difference_type
@@ -911,12 +925,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline typename __normal_iterator<_Iterator, _Container>::difference_type
operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() - __rhs.base(); }
template<typename _Iterator, typename _Container>
inline __normal_iterator<_Iterator, _Container>
operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
__n, const __normal_iterator<_Iterator, _Container>& __i)
+ _GLIBCXX_NOEXCEPT
{ return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index 5e8312dc6ff..71ef819176c 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -133,35 +133,35 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef _Tp* pointer;
typedef _Tp& reference;
- _List_iterator()
+ _List_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
explicit
- _List_iterator(__detail::_List_node_base* __x)
+ _List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
_Self
- _M_const_cast() const
+ _M_const_cast() const _GLIBCXX_NOEXCEPT
{ return *this; }
// Must downcast from _List_node_base to _List_node to get to _M_data.
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Node*>(_M_node)->_M_data; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_next;
return *this;
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_next;
@@ -169,14 +169,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_prev;
return *this;
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_prev;
@@ -184,11 +184,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node != __x._M_node; }
// The only member points to the %list element.
@@ -213,39 +213,40 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef const _Tp* pointer;
typedef const _Tp& reference;
- _List_const_iterator()
+ _List_const_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
explicit
_List_const_iterator(const __detail::_List_node_base* __x)
+ _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
- _List_const_iterator(const iterator& __x)
+ _List_const_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
: _M_node(__x._M_node) { }
iterator
- _M_const_cast() const
+ _M_const_cast() const _GLIBCXX_NOEXCEPT
{ return iterator(const_cast<__detail::_List_node_base*>(_M_node)); }
// Must downcast from List_node_base to _List_node to get to
// _M_data.
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Node*>(_M_node)->_M_data; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_next;
return *this;
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_next;
@@ -253,14 +254,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_prev;
return *this;
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_prev;
@@ -268,11 +269,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node != __x._M_node; }
// The only member points to the %list element.
@@ -282,13 +283,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Val>
inline bool
operator==(const _List_iterator<_Val>& __x,
- const _List_const_iterator<_Val>& __y)
+ const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node == __y._M_node; }
template<typename _Val>
inline bool
operator!=(const _List_iterator<_Val>& __x,
- const _List_const_iterator<_Val>& __y)
+ const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
@@ -324,12 +325,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _Node_alloc_type(), _M_node()
{ }
- _List_impl(const _Node_alloc_type& __a)
+ _List_impl(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _Node_alloc_type(__a), _M_node()
{ }
#if __cplusplus >= 201103L
- _List_impl(_Node_alloc_type&& __a)
+ _List_impl(_Node_alloc_type&& __a) _GLIBCXX_NOEXCEPT
: _Node_alloc_type(std::move(__a)), _M_node()
{ }
#endif
@@ -342,7 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_impl._Node_alloc_type::allocate(1); }
void
- _M_put_node(_List_node<_Tp>* __p)
+ _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
{ _M_impl._Node_alloc_type::deallocate(__p, 1); }
public:
@@ -368,12 +369,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _M_impl()
{ _M_init(); }
- _List_base(const _Node_alloc_type& __a)
+ _List_base(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _M_impl(__a)
{ _M_init(); }
#if __cplusplus >= 201103L
- _List_base(_List_base&& __x)
+ _List_base(_List_base&& __x) noexcept
: _M_impl(std::move(__x._M_get_Node_allocator()))
{
_M_init();
@@ -386,10 +387,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ _M_clear(); }
void
- _M_clear();
+ _M_clear() _GLIBCXX_NOEXCEPT;
void
- _M_init()
+ _M_init() _GLIBCXX_NOEXCEPT
{
this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
@@ -526,17 +527,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// [23.2.2.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
- * @brief Default constructor creates no elements.
- */
- list()
- : _Base() { }
-
- /**
* @brief Creates a %list with no elements.
* @param __a An allocator object.
*/
explicit
- list(const allocator_type& __a)
+ list(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
: _Base(_Node_alloc_type(__a)) { }
#if __cplusplus >= 201103L
@@ -932,7 +927,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %list.
*/
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
@@ -940,7 +935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %list.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
@@ -948,7 +943,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* of the %list.
*/
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
iterator __tmp = end();
--__tmp;
@@ -960,7 +955,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %list.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
const_iterator __tmp = end();
--__tmp;
@@ -1006,7 +1001,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* called.
*/
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{ this->_M_erase(begin()); }
/**
@@ -1046,7 +1041,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* is needed, it should be retrieved before pop_back() is called.
*/
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{ this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
#if __cplusplus >= 201103L
@@ -1231,7 +1226,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position);
+ erase(const_iterator __position) noexcept;
#else
erase(iterator __position);
#endif
@@ -1256,7 +1251,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __first, const_iterator __last)
+ erase(const_iterator __first, const_iterator __last) noexcept
#else
erase(iterator __first, iterator __last)
#endif
@@ -1314,7 +1309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/
void
#if __cplusplus >= 201103L
- splice(const_iterator __position, list&& __x)
+ splice(const_iterator __position, list&& __x) noexcept
#else
splice(iterator __position, list& __x)
#endif
@@ -1330,7 +1325,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus >= 201103L
void
- splice(const_iterator __position, list& __x)
+ splice(const_iterator __position, list& __x) noexcept
{ splice(__position, std::move(__x)); }
#endif
@@ -1346,7 +1341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* inserts it into the current list before @a __position.
*/
void
- splice(const_iterator __position, list&& __x, const_iterator __i)
+ splice(const_iterator __position, list&& __x, const_iterator __i) noexcept
#else
/**
* @brief Insert element from another %list.
@@ -1385,7 +1380,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* inserts it into the current list before @a __position.
*/
void
- splice(const_iterator __position, list& __x, const_iterator __i)
+ splice(const_iterator __position, list& __x, const_iterator __i) noexcept
{ splice(__position, std::move(__x), __i); }
#endif
@@ -1405,7 +1400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/
void
splice(const_iterator __position, list&& __x, const_iterator __first,
- const_iterator __last)
+ const_iterator __last) noexcept
#else
/**
* @brief Insert range from another %list.
@@ -1451,7 +1446,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
*/
void
splice(const_iterator __position, list& __x, const_iterator __first,
- const_iterator __last)
+ const_iterator __last) noexcept
{ splice(__position, std::move(__x), __first, __last); }
#endif
@@ -1687,7 +1682,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Erases element at position given.
void
- _M_erase(iterator __position)
+ _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
{
__position._M_node->_M_unhook();
_Node* __n = static_cast<_Node*>(__position._M_node);
@@ -1701,11 +1696,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// To implement the splice (and merge) bits of N1599.
void
- _M_check_equal_allocators(list& __x)
+ _M_check_equal_allocators(list& __x) _GLIBCXX_NOEXCEPT
{
if (std::__alloc_neq<typename _Base::_Node_alloc_type>::
_S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator()))
- __throw_runtime_error(__N("list::_M_check_equal_allocators"));
+ __builtin_abort();
}
};
diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h
index 510d3753c30..1ecdc2a6224 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -99,28 +99,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Base_ptr _M_right;
static _Base_ptr
- _S_minimum(_Base_ptr __x)
+ _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{
while (__x->_M_left != 0) __x = __x->_M_left;
return __x;
}
static _Const_Base_ptr
- _S_minimum(_Const_Base_ptr __x)
+ _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
{
while (__x->_M_left != 0) __x = __x->_M_left;
return __x;
}
static _Base_ptr
- _S_maximum(_Base_ptr __x)
+ _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{
while (__x->_M_right != 0) __x = __x->_M_right;
return __x;
}
static _Const_Base_ptr
- _S_maximum(_Const_Base_ptr __x)
+ _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
{
while (__x->_M_right != 0) __x = __x->_M_right;
return __x;
@@ -167,31 +167,31 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;
typedef _Rb_tree_node<_Tp>* _Link_type;
- _Rb_tree_iterator()
+ _Rb_tree_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
explicit
- _Rb_tree_iterator(_Link_type __x)
+ _Rb_tree_iterator(_Link_type __x) _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(_M_node)->_M_value_field; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return std::__addressof(static_cast<_Link_type>
(_M_node)->_M_value_field); }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _Rb_tree_increment(_M_node);
return *this;
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _Rb_tree_increment(_M_node);
@@ -199,14 +199,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _Rb_tree_decrement(_M_node);
return *this;
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _Rb_tree_decrement(_M_node);
@@ -214,11 +214,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node != __x._M_node; }
_Base_ptr _M_node;
@@ -240,39 +240,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;
typedef const _Rb_tree_node<_Tp>* _Link_type;
- _Rb_tree_const_iterator()
+ _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
explicit
- _Rb_tree_const_iterator(_Link_type __x)
+ _Rb_tree_const_iterator(_Link_type __x) _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
- _Rb_tree_const_iterator(const iterator& __it)
+ _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT
: _M_node(__it._M_node) { }
iterator
- _M_const_cast() const
+ _M_const_cast() const _GLIBCXX_NOEXCEPT
{ return iterator(static_cast<typename iterator::_Link_type>
(const_cast<typename iterator::_Base_ptr>(_M_node))); }
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(_M_node)->_M_value_field; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return std::__addressof(static_cast<_Link_type>
(_M_node)->_M_value_field); }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _Rb_tree_increment(_M_node);
return *this;
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _Rb_tree_increment(_M_node);
@@ -280,14 +280,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _Rb_tree_decrement(_M_node);
return *this;
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _Rb_tree_decrement(_M_node);
@@ -295,11 +295,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node != __x._M_node; }
_Base_ptr _M_node;
@@ -308,13 +308,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Val>
inline bool
operator==(const _Rb_tree_iterator<_Val>& __x,
- const _Rb_tree_const_iterator<_Val>& __y)
+ const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node == __y._M_node; }
template<typename _Val>
inline bool
operator!=(const _Rb_tree_iterator<_Val>& __x,
- const _Rb_tree_const_iterator<_Val>& __y)
+ const _Rb_tree_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
void
@@ -370,7 +370,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _M_impl._Node_allocator::allocate(1); }
void
- _M_put_node(_Link_type __p)
+ _M_put_node(_Link_type __p) _GLIBCXX_NOEXCEPT
{ _M_impl._Node_allocator::deallocate(__p, 1); }
#if __cplusplus < 201103L
@@ -416,7 +416,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
void
- _M_destroy_node(_Link_type __p)
+ _M_destroy_node(_Link_type __p) noexcept
{
_M_get_Node_allocator().destroy(__p);
_M_put_node(__p);
@@ -514,46 +514,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
protected:
_Base_ptr&
- _M_root()
+ _M_root() _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_header._M_parent; }
_Const_Base_ptr
- _M_root() const
+ _M_root() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_header._M_parent; }
_Base_ptr&
- _M_leftmost()
+ _M_leftmost() _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_header._M_left; }
_Const_Base_ptr
- _M_leftmost() const
+ _M_leftmost() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_header._M_left; }
_Base_ptr&
- _M_rightmost()
+ _M_rightmost() _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_header._M_right; }
_Const_Base_ptr
- _M_rightmost() const
+ _M_rightmost() const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_header._M_right; }
_Link_type
- _M_begin()
+ _M_begin() _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); }
_Const_Link_type
- _M_begin() const
+ _M_begin() const _GLIBCXX_NOEXCEPT
{
return static_cast<_Const_Link_type>
(this->_M_impl._M_header._M_parent);
}
_Link_type
- _M_end()
+ _M_end() _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(&this->_M_impl._M_header); }
_Const_Link_type
- _M_end() const
+ _M_end() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }
static const_reference
@@ -565,19 +565,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _KeyOfValue()(_S_value(__x)); }
static _Link_type
- _S_left(_Base_ptr __x)
+ _S_left(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(__x->_M_left); }
static _Const_Link_type
- _S_left(_Const_Base_ptr __x)
+ _S_left(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return static_cast<_Const_Link_type>(__x->_M_left); }
static _Link_type
- _S_right(_Base_ptr __x)
+ _S_right(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return static_cast<_Link_type>(__x->_M_right); }
static _Const_Link_type
- _S_right(_Const_Base_ptr __x)
+ _S_right(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return static_cast<_Const_Link_type>(__x->_M_right); }
static const_reference
@@ -589,19 +589,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _KeyOfValue()(_S_value(__x)); }
static _Base_ptr
- _S_minimum(_Base_ptr __x)
+ _S_minimum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return _Rb_tree_node_base::_S_minimum(__x); }
static _Const_Base_ptr
- _S_minimum(_Const_Base_ptr __x)
+ _S_minimum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return _Rb_tree_node_base::_S_minimum(__x); }
static _Base_ptr
- _S_maximum(_Base_ptr __x)
+ _S_maximum(_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return _Rb_tree_node_base::_S_maximum(__x); }
static _Const_Base_ptr
- _S_maximum(_Const_Base_ptr __x)
+ _S_maximum(_Const_Base_ptr __x) _GLIBCXX_NOEXCEPT
{ return _Rb_tree_node_base::_S_maximum(__x); }
public:
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index 142f090fdb0..f9330498ca8 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -87,18 +87,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: _Tp_alloc_type(), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
- _Vector_impl(_Tp_alloc_type const& __a)
+ _Vector_impl(_Tp_alloc_type const& __a) _GLIBCXX_NOEXCEPT
: _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
#if __cplusplus >= 201103L
- _Vector_impl(_Tp_alloc_type&& __a)
+ _Vector_impl(_Tp_alloc_type&& __a) noexcept
: _Tp_alloc_type(std::move(__a)),
_M_start(0), _M_finish(0), _M_end_of_storage(0)
{ }
#endif
- void _M_swap_data(_Vector_impl& __x)
+ void _M_swap_data(_Vector_impl& __x) _GLIBCXX_NOEXCEPT
{
std::swap(_M_start, __x._M_start);
std::swap(_M_finish, __x._M_finish);
@@ -124,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Vector_base()
: _M_impl() { }
- _Vector_base(const allocator_type& __a)
+ _Vector_base(const allocator_type& __a) _GLIBCXX_NOEXCEPT
: _M_impl(__a) { }
_Vector_base(size_t __n)
@@ -136,10 +136,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ _M_create_storage(__n); }
#if __cplusplus >= 201103L
- _Vector_base(_Tp_alloc_type&& __a)
+ _Vector_base(_Tp_alloc_type&& __a) noexcept
: _M_impl(std::move(__a)) { }
- _Vector_base(_Vector_base&& __x)
+ _Vector_base(_Vector_base&& __x) noexcept
: _M_impl(std::move(__x._M_get_Tp_allocator()))
{ this->_M_impl._M_swap_data(__x._M_impl); }
@@ -156,7 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
#endif
- ~_Vector_base()
+ ~_Vector_base() _GLIBCXX_NOEXCEPT
{ _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage
- this->_M_impl._M_start);
#if __google_stl_debug_dangling_vector
@@ -273,17 +273,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// [23.2.4.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
- * @brief Default constructor creates no elements.
- */
- vector()
- : _Base() { }
-
- /**
* @brief Creates a %vector with no elements.
* @param __a An allocator object.
*/
explicit
- vector(const allocator_type& __a)
+ vector(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
@@ -835,7 +829,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* __google_stl_debug_vector is defined to non-zero.
*/
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_vector
_M_range_check(__n);
@@ -858,7 +852,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* __google_stl_debug_vector is defined to non-zero.
*/
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_vector
_M_range_check(__n);
@@ -872,7 +866,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_range_check(size_type __n) const
{
if (__n >= this->size())
- __throw_out_of_range(__N("vector::_M_range_check"));
+ __throw_out_of_range_fmt(__N("vector::_M_range_check: __n "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
}
public:
@@ -917,7 +914,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %vector.
*/
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_vector
if (empty()) __throw_logic_error("front() on empty vector");
@@ -930,7 +927,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %vector.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_vector
if (empty()) __throw_logic_error("front() on empty vector");
@@ -943,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %vector.
*/
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_vector
if (empty()) __throw_logic_error("back() on empty vector");
@@ -956,7 +953,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* last element of the %vector.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
#if __google_stl_debug_vector
if (empty()) __throw_logic_error("back() on empty vector");
@@ -1045,7 +1042,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* called.
*/
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
--this->_M_impl._M_finish;
_Alloc_traits::destroy(this->_M_impl, this->_M_impl._M_finish);
@@ -1536,7 +1533,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Called by erase(q1,q2), clear(), resize(), _M_fill_assign,
// _M_assign_aux.
void
- _M_erase_at_end(pointer __pos)
+ _M_erase_at_end(pointer __pos) _GLIBCXX_NOEXCEPT
{
std::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());
this->_M_impl._M_finish = __pos;
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
index bce10cf3f12..6ee23846518 100644
--- a/libstdc++-v3/include/debug/array
+++ b/libstdc++-v3/include/debug/array
@@ -147,7 +147,7 @@ namespace __debug
// Element access.
reference
- operator[](size_type __n)
+ operator[](size_type __n) noexcept
{
__glibcxx_check_subscript(__n);
return _AT_Type::_S_ref(_M_elems, __n);
@@ -165,7 +165,10 @@ namespace __debug
at(size_type __n)
{
if (__n >= _Nm)
- std::__throw_out_of_range(__N("array::at"));
+ std::__throw_out_of_range_fmt(__N("array::at: __n "
+ "(which is %zu) >= _Nm "
+ "(which is %zu)"),
+ __n, _Nm);
return _AT_Type::_S_ref(_M_elems, __n);
}
@@ -175,19 +178,21 @@ namespace __debug
// Result of conditional expression must be an lvalue so use
// boolean ? lvalue : (throw-expr, lvalue)
return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
- : (std::__throw_out_of_range(__N("array::at")),
+ : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
+ ">= _Nm (which is %zu)"),
+ __n, _Nm),
_AT_Type::_S_ref(_M_elems, 0));
}
reference
- front()
+ front() noexcept
{
__glibcxx_check_nonempty();
return *begin();
}
constexpr const_reference
- front() const
+ front() const noexcept
{
return _Nm ? _AT_Type::_S_ref(_M_elems, 0)
: (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()),
@@ -195,14 +200,14 @@ namespace __debug
}
reference
- back()
+ back() noexcept
{
__glibcxx_check_nonempty();
return _Nm ? *(end() - 1) : *end();
}
constexpr const_reference
- back() const
+ back() const noexcept
{
return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
: (_GLIBCXX_THROW_OR_ABORT(_Array_check_nonempty<_Nm>()),
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index e5e902dfc7b..3984f11ac6b 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -128,7 +128,7 @@ namespace __debug
#if __cplusplus >= 201103L
deque&
- operator=(deque&& __x)
+ operator=(deque&& __x) noexcept
{
// NB: DR 1204.
// NB: DR 675.
@@ -287,7 +287,7 @@ namespace __debug
#if __cplusplus >= 201103L
void
- shrink_to_fit()
+ shrink_to_fit() noexcept
{
if (_Base::_M_shrink_to_fit())
this->_M_invalidate_all();
@@ -298,14 +298,14 @@ namespace __debug
// element access:
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
}
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
@@ -314,28 +314,28 @@ namespace __debug
using _Base::at;
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
@@ -468,7 +468,7 @@ namespace __debug
#endif
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(_Base::begin()));
@@ -476,7 +476,7 @@ namespace __debug
}
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(--_Base::end()));
@@ -556,7 +556,7 @@ namespace __debug
}
void
- swap(deque& __x)
+ swap(deque& __x) _GLIBCXX_NOEXCEPT
{
_Base::swap(__x);
this->_M_swap(__x);
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index fd00b0148a9..89c26e425ae 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -70,7 +70,7 @@ namespace __debug
// 23.2.2.1 construct/copy/destroy:
explicit
- list(const _Allocator& __a = _Allocator())
+ list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
@@ -320,28 +320,28 @@ namespace __debug
// element access:
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
@@ -355,7 +355,7 @@ namespace __debug
#endif
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(_Base::begin()));
@@ -369,7 +369,7 @@ namespace __debug
#endif
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(--_Base::end()));
@@ -455,7 +455,7 @@ namespace __debug
private:
_Base_iterator
#if __cplusplus >= 201103L
- _M_erase(_Base_const_iterator __position)
+ _M_erase(_Base_const_iterator __position) noexcept
#else
_M_erase(_Base_iterator __position)
#endif
@@ -467,7 +467,7 @@ namespace __debug
public:
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position)
+ erase(const_iterator __position) noexcept
#else
erase(iterator __position)
#endif
@@ -478,7 +478,7 @@ namespace __debug
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __first, const_iterator __last)
+ erase(const_iterator __first, const_iterator __last) noexcept
#else
erase(iterator __first, iterator __last)
#endif
@@ -515,7 +515,7 @@ namespace __debug
// 23.2.2.4 list operations:
void
#if __cplusplus >= 201103L
- splice(const_iterator __position, list&& __x)
+ splice(const_iterator __position, list&& __x) noexcept
#else
splice(iterator __position, list& __x)
#endif
@@ -529,13 +529,13 @@ namespace __debug
#if __cplusplus >= 201103L
void
- splice(const_iterator __position, list& __x)
+ splice(const_iterator __position, list& __x) noexcept
{ splice(__position, std::move(__x)); }
#endif
void
#if __cplusplus >= 201103L
- splice(const_iterator __position, list&& __x, const_iterator __i)
+ splice(const_iterator __position, list&& __x, const_iterator __i) noexcept
#else
splice(iterator __position, list& __x, iterator __i)
#endif
@@ -561,14 +561,14 @@ namespace __debug
#if __cplusplus >= 201103L
void
- splice(const_iterator __position, list& __x, const_iterator __i)
+ splice(const_iterator __position, list& __x, const_iterator __i) noexcept
{ splice(__position, std::move(__x), __i); }
#endif
void
#if __cplusplus >= 201103L
splice(const_iterator __position, list&& __x, const_iterator __first,
- const_iterator __last)
+ const_iterator __last) noexcept
#else
splice(iterator __position, list& __x, iterator __first,
iterator __last)
@@ -608,7 +608,7 @@ namespace __debug
#if __cplusplus >= 201103L
void
splice(const_iterator __position, list& __x,
- const_iterator __first, const_iterator __last)
+ const_iterator __first, const_iterator __last) noexcept
{ splice(__position, std::move(__x), __first, __last); }
#endif
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index a1f7651b1bd..d5adefd0ace 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -139,7 +139,7 @@ namespace __gnu_debug
typedef typename _Traits::pointer pointer;
/// @post the iterator is singular and unattached
- _Safe_iterator() : _M_current() { }
+ _Safe_iterator() _GLIBCXX_NOEXCEPT : _M_current() { }
/**
* @brief Safe iterator construction from an unsafe iterator and
@@ -149,6 +149,7 @@ namespace __gnu_debug
* @post this is not singular
*/
_Safe_iterator(const _Iterator& __i, const _Sequence* __seq)
+ _GLIBCXX_NOEXCEPT
: _Safe_iterator_base(__seq, _M_constant()), _M_current(__i)
{
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
@@ -159,7 +160,7 @@ namespace __gnu_debug
/**
* @brief Copy construction.
*/
- _Safe_iterator(const _Safe_iterator& __x)
+ _Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -176,7 +177,7 @@ namespace __gnu_debug
* @brief Move construction.
* @post __x is singular and unattached
*/
- _Safe_iterator(_Safe_iterator&& __x) : _M_current()
+ _Safe_iterator(_Safe_iterator&& __x) noexcept : _M_current()
{
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
|| __x._M_current == _Iterator(),
@@ -198,7 +199,7 @@ namespace __gnu_debug
const _Safe_iterator<_MutableIterator,
typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator,
typename _Sequence::iterator::iterator_type>::__value),
- _Sequence>::__type>& __x)
+ _Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -214,7 +215,7 @@ namespace __gnu_debug
* @brief Copy assignment.
*/
_Safe_iterator&
- operator=(const _Safe_iterator& __x)
+ operator=(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 408. Is vector<reverse_iterator<char*> > forbidden?
@@ -234,7 +235,7 @@ namespace __gnu_debug
* @post __x is singular and unattached
*/
_Safe_iterator&
- operator=(_Safe_iterator&& __x)
+ operator=(_Safe_iterator&& __x) noexcept
{
_GLIBCXX_DEBUG_VERIFY(this != &__x,
_M_message(__msg_self_move_assign)
@@ -257,7 +258,7 @@ namespace __gnu_debug
* @pre iterator is dereferenceable
*/
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
_M_message(__msg_bad_deref)
@@ -271,7 +272,7 @@ namespace __gnu_debug
* @todo Make this correct w.r.t. iterators that return proxies
*/
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
_M_message(__msg_bad_deref)
@@ -285,7 +286,7 @@ namespace __gnu_debug
* @pre iterator is incrementable
*/
_Safe_iterator&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
_M_message(__msg_bad_inc)
@@ -299,7 +300,7 @@ namespace __gnu_debug
* @pre iterator is incrementable
*/
_Safe_iterator
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
_M_message(__msg_bad_inc)
@@ -315,7 +316,7 @@ namespace __gnu_debug
* @pre iterator is decrementable
*/
_Safe_iterator&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
_M_message(__msg_bad_dec)
@@ -329,7 +330,7 @@ namespace __gnu_debug
* @pre iterator is decrementable
*/
_Safe_iterator
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
_M_message(__msg_bad_dec)
@@ -341,7 +342,7 @@ namespace __gnu_debug
// ------ Random access iterator requirements ------
reference
- operator[](const difference_type& __n) const
+ operator[](const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
&& this->_M_can_advance(__n+1),
@@ -352,7 +353,7 @@ namespace __gnu_debug
}
_Safe_iterator&
- operator+=(const difference_type& __n)
+ operator+=(const difference_type& __n) _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n),
_M_message(__msg_advance_oob)
@@ -362,7 +363,7 @@ namespace __gnu_debug
}
_Safe_iterator
- operator+(const difference_type& __n) const
+ operator+(const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
_Safe_iterator __tmp(*this);
__tmp += __n;
@@ -370,7 +371,7 @@ namespace __gnu_debug
}
_Safe_iterator&
- operator-=(const difference_type& __n)
+ operator-=(const difference_type& __n) _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n),
_M_message(__msg_retreat_oob)
@@ -380,7 +381,7 @@ namespace __gnu_debug
}
_Safe_iterator
- operator-(const difference_type& __n) const
+ operator-(const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
_Safe_iterator __tmp(*this);
__tmp -= __n;
@@ -392,13 +393,13 @@ namespace __gnu_debug
* @brief Return the underlying iterator
*/
_Iterator
- base() const { return _M_current; }
+ base() const _GLIBCXX_NOEXCEPT { return _M_current; }
/**
* @brief Conversion to underlying non-debug iterator to allow
* better interaction with non-debug containers.
*/
- operator _Iterator() const { return _M_current; }
+ operator _Iterator() const _GLIBCXX_NOEXCEPT { return _M_current; }
/** Attach iterator to the given sequence. */
void
@@ -482,6 +483,7 @@ namespace __gnu_debug
inline bool
operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
@@ -498,6 +500,7 @@ namespace __gnu_debug
inline bool
operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
@@ -514,6 +517,7 @@ namespace __gnu_debug
inline bool
operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
@@ -530,6 +534,7 @@ namespace __gnu_debug
inline bool
operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
@@ -546,6 +551,7 @@ namespace __gnu_debug
inline bool
operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -562,6 +568,7 @@ namespace __gnu_debug
inline bool
operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -578,6 +585,7 @@ namespace __gnu_debug
inline bool
operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -594,6 +602,7 @@ namespace __gnu_debug
inline bool
operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -610,6 +619,7 @@ namespace __gnu_debug
inline bool
operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -626,6 +636,7 @@ namespace __gnu_debug
inline bool
operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -642,6 +653,7 @@ namespace __gnu_debug
inline bool
operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -658,6 +670,7 @@ namespace __gnu_debug
inline bool
operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
@@ -678,6 +691,7 @@ namespace __gnu_debug
inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type
operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_distance_bad)
@@ -694,6 +708,7 @@ namespace __gnu_debug
inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type
operator-(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_distance_bad)
@@ -709,7 +724,7 @@ namespace __gnu_debug
template<typename _Iterator, typename _Sequence>
inline _Safe_iterator<_Iterator, _Sequence>
operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n,
- const _Safe_iterator<_Iterator, _Sequence>& __i)
+ const _Safe_iterator<_Iterator, _Sequence>& __i) _GLIBCXX_NOEXCEPT
{ return __i + __n; }
} // namespace __gnu_debug
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 9e856c1ee8c..6d2c5395ade 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -70,6 +70,7 @@ namespace __gnu_debug
// 21.3.1 construct/copy/destroy:
explicit basic_string(const _Allocator& __a = _Allocator())
+ // _GLIBCXX_NOEXCEPT
: _Base(__a)
{ }
@@ -113,7 +114,7 @@ namespace __gnu_debug
{ }
#if __cplusplus >= 201103L
- basic_string(basic_string&& __str) noexcept
+ basic_string(basic_string&& __str) // noexcept
: _Base(std::move(__str))
{ }
@@ -171,7 +172,7 @@ namespace __gnu_debug
// 21.3.2 iterators:
iterator
- begin() _GLIBCXX_NOEXCEPT
+ begin() // _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
const_iterator
@@ -179,7 +180,7 @@ namespace __gnu_debug
{ return const_iterator(_Base::begin(), this); }
iterator
- end() _GLIBCXX_NOEXCEPT
+ end() // _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
const_iterator
@@ -187,7 +188,7 @@ namespace __gnu_debug
{ return const_iterator(_Base::end(), this); }
reverse_iterator
- rbegin() _GLIBCXX_NOEXCEPT
+ rbegin() // _GLIBCXX_NOEXCEPT
{ return reverse_iterator(end()); }
const_reverse_iterator
@@ -195,7 +196,7 @@ namespace __gnu_debug
{ return const_reverse_iterator(end()); }
reverse_iterator
- rend() _GLIBCXX_NOEXCEPT
+ rend() // _GLIBCXX_NOEXCEPT
{ return reverse_iterator(begin()); }
const_reverse_iterator
@@ -238,7 +239,7 @@ namespace __gnu_debug
#if __cplusplus >= 201103L
void
- shrink_to_fit()
+ shrink_to_fit() noexcept
{
if (capacity() > size())
{
@@ -257,7 +258,7 @@ namespace __gnu_debug
using _Base::reserve;
void
- clear() _GLIBCXX_NOEXCEPT
+ clear() // _GLIBCXX_NOEXCEPT
{
_Base::clear();
this->_M_invalidate_all();
@@ -267,7 +268,7 @@ namespace __gnu_debug
// 21.3.4 element access:
const_reference
- operator[](size_type __pos) const
+ operator[](size_type __pos) const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
_M_message(__gnu_debug::__msg_subscript_oob)
@@ -278,7 +279,7 @@ namespace __gnu_debug
}
reference
- operator[](size_type __pos)
+ operator[](size_type __pos) // _GLIBCXX_NOEXCEPT
{
#ifdef _GLIBCXX_DEBUG_PEDANTIC
__glibcxx_check_subscript(__pos);
@@ -582,7 +583,7 @@ namespace __gnu_debug
#if __cplusplus >= 201103L
void
- pop_back()
+ pop_back() // noexcept
{
__glibcxx_check_nonempty();
_Base::pop_back();
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index 7b28177c2a0..e5b80649b9a 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -76,7 +76,7 @@ namespace __debug
// 23.2.4.1 construct/copy/destroy:
explicit
- vector(const _Allocator& __a = _Allocator())
+ vector(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a), _M_guaranteed_capacity(0) { }
#if __cplusplus >= 201103L
@@ -341,14 +341,14 @@ namespace __debug
// element access:
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
}
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
@@ -357,28 +357,28 @@ namespace __debug
using _Base::at;
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
@@ -419,7 +419,7 @@ namespace __debug
#endif
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(--_Base::end()));
@@ -630,18 +630,18 @@ namespace __debug
size_type _M_guaranteed_capacity;
bool
- _M_requires_reallocation(size_type __elements)
+ _M_requires_reallocation(size_type __elements) _GLIBCXX_NOEXCEPT
{ return __elements > this->capacity(); }
void
- _M_update_guaranteed_capacity()
+ _M_update_guaranteed_capacity() _GLIBCXX_NOEXCEPT
{
if (this->size() > _M_guaranteed_capacity)
_M_guaranteed_capacity = this->size();
}
void
- _M_invalidate_after_nth(difference_type __n)
+ _M_invalidate_after_nth(difference_type __n) _GLIBCXX_NOEXCEPT
{
typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
this->_M_invalidate_if(_After_nth(__n, _Base::begin()));
diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h
index c02cb8b7f5a..85da722fb71 100644
--- a/libstdc++-v3/include/ext/sso_string_base.h
+++ b/libstdc++-v3/include/ext/sso_string_base.h
@@ -387,9 +387,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_capacity(__rcs._M_allocated_capacity);
}
- _M_length(__rcs._M_length());
- __rcs._M_length(0);
+ _M_set_length(__rcs._M_length());
__rcs._M_data(__rcs._M_local_data);
+ __rcs._M_set_length(0);
}
#endif
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h
index a5760d1f068..29cd319f7fa 100644
--- a/libstdc++-v3/include/ext/vstring.h
+++ b/libstdc++-v3/include/ext/vstring.h
@@ -100,7 +100,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_check(size_type __pos, const char* __s) const
{
if (__pos > this->size())
- std::__throw_out_of_range(__N(__s));
+ std::__throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > "
+ "this->size() (which is %zu)"),
+ __s, __pos, this->size());
return __pos;
}
@@ -113,7 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: _M_limit doesn't check for a bad __pos value.
size_type
- _M_limit(size_type __pos, size_type __off) const
+ _M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT
{
const bool __testoff = __off < this->size() - __pos;
return __testoff ? __off : this->size() - __pos;
@@ -121,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// True if _Rep and source do not overlap.
bool
- _M_disjunct(const _CharT* __s) const
+ _M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT
{
return (std::less<const _CharT*>()(__s, this->_M_data())
|| std::less<const _CharT*>()(this->_M_data()
@@ -131,11 +133,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// For the internal use we have functions similar to `begin'/`end'
// but they do not call _M_leak.
iterator
- _M_ibegin() const
+ _M_ibegin() const _GLIBCXX_NOEXCEPT
{ return iterator(this->_M_data()); }
iterator
- _M_iend() const
+ _M_iend() const _GLIBCXX_NOEXCEPT
{ return iterator(this->_M_data() + this->_M_length()); }
public:
@@ -144,16 +146,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// arguments, per 17.4.4.4 para. 2 item 2.
/**
- * @brief Default constructor creates an empty string.
- */
- __versa_string()
- : __vstring_base() { }
-
- /**
* @brief Construct an empty string using allocator @a a.
*/
explicit
- __versa_string(const _Alloc& __a)
+ __versa_string(const _Alloc& __a = _Alloc()) _GLIBCXX_NOEXCEPT
: __vstring_base(__a) { }
// NB: per LWG issue 42, semantics different from IS:
@@ -284,7 +280,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* copying). @a __str is a valid, but unspecified string.
*/
__versa_string&
- operator=(__versa_string&& __str)
+ operator=(__versa_string&& __str) noexcept
{
// NB: DR 1204.
this->swap(__str);
@@ -485,7 +481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L
/// A non-binding request to reduce capacity() to size().
void
- shrink_to_fit()
+ shrink_to_fit() noexcept
{
if (capacity() > size())
{
@@ -553,7 +549,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* see at().)
*/
const_reference
- operator[] (size_type __pos) const
+ operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
return this->_M_data()[__pos];
@@ -570,7 +566,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* see at().) Unshares the string.
*/
reference
- operator[](size_type __pos)
+ operator[](size_type __pos) _GLIBCXX_NOEXCEPT
{
// Allow pos == size() both in C++98 mode, as v3 extension,
// and in C++11 mode.
@@ -596,7 +592,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
at(size_type __n) const
{
if (__n >= this->size())
- std::__throw_out_of_range(__N("__versa_string::at"));
+ std::__throw_out_of_range_fmt(__N("__versa_string::at: __n "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
return this->_M_data()[__n];
}
@@ -615,7 +614,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
at(size_type __n)
{
if (__n >= this->size())
- std::__throw_out_of_range(__N("__versa_string::at"));
+ std::__throw_out_of_range_fmt(__N("__versa_string::at: __n "
+ "(which is %zu) >= this->size() "
+ "(which is %zu)"),
+ __n, this->size());
this->_M_leak();
return this->_M_data()[__n];
}
@@ -626,7 +628,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element of the %string.
*/
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{ return operator[](0); }
/**
@@ -634,7 +636,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element of the %string.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return operator[](0); }
/**
@@ -642,7 +644,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element of the %string.
*/
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{ return operator[](this->size() - 1); }
/**
@@ -650,7 +652,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last element of the %string.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{ return operator[](this->size() - 1); }
#endif
@@ -829,7 +831,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @a __str is a valid, but unspecified string.
*/
__versa_string&
- assign(__versa_string&& __str)
+ assign(__versa_string&& __str) noexcept
{
this->swap(__str);
return *this;
@@ -1646,7 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* constant time.
*/
void
- swap(__versa_string& __s)
+ swap(__versa_string& __s) _GLIBCXX_NOEXCEPT
{ this->_M_swap(__s); }
// String operations:
diff --git a/libstdc++-v3/include/parallel/algo.h b/libstdc++-v3/include/parallel/algo.h
index 00c24e5638c..13a35a7e046 100644
--- a/libstdc++-v3/include/parallel/algo.h
+++ b/libstdc++-v3/include/parallel/algo.h
@@ -150,7 +150,9 @@ namespace __parallel
if (_GLIBCXX_PARALLEL_CONDITION(true))
{
- std::binder2nd<__gnu_parallel::_EqualTo<_ValueType, const _Tp&> >
+ __gnu_parallel::__binder2nd<__gnu_parallel::_EqualTo<_ValueType,
+ const _Tp&>,
+ _ValueType, const _Tp&, bool>
__comp(__gnu_parallel::_EqualTo<_ValueType, const _Tp&>(), __val);
return __gnu_parallel::__find_template(
__begin, __end, __begin, __comp,
diff --git a/libstdc++-v3/include/parallel/algobase.h b/libstdc++-v3/include/parallel/algobase.h
index e3737cc8f70..d615065a555 100644
--- a/libstdc++-v3/include/parallel/algobase.h
+++ b/libstdc++-v3/include/parallel/algobase.h
@@ -122,6 +122,25 @@ namespace __parallel
_IteratorCategory1(), _IteratorCategory2());
}
+#if __cplusplus > 201103L
+ template<typename _InputIterator1, typename _InputIterator2>
+ inline pair<_InputIterator1, _InputIterator2>
+ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2)
+ { return _GLIBCXX_STD_A::mismatch(__first1, __last1, __first2, __last2); }
+
+ template<typename _InputIterator1, typename _InputIterator2,
+ typename _BinaryPredicate>
+ inline pair<_InputIterator1, _InputIterator2>
+ mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _InputIterator2 __last2,
+ _BinaryPredicate __binary_pred)
+ {
+ return _GLIBCXX_STD_A::mismatch(__first1, __last1, __first2, __last2,
+ __binary_pred);
+ }
+#endif
+
// Sequential fallback
template<typename _IIter1, typename _IIter2>
inline bool
@@ -155,6 +174,22 @@ namespace __parallel
== __end1;
}
+#if __cplusplus > 201103L
+ template<typename _II1, typename _II2>
+ inline bool
+ equal(_II1 __first1, _II1 __last1, _II2 __first2, _II2 __last2)
+ { return _GLIBCXX_STD_A::equal(__first1, __last1, __first2, __last2); }
+
+ template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
+ inline bool
+ equal(_IIter1 __first1, _IIter1 __last1,
+ _IIter2 __first2, _IIter2 __last2, _BinaryPredicate __binary_pred)
+ {
+ return _GLIBCXX_STD_A::equal(__first1, __last1, __first2, __last2,
+ __binary_pred);
+ }
+#endif
+
// Sequential fallback
template<typename _IIter1, typename _IIter2>
inline bool
diff --git a/libstdc++-v3/include/profile/array b/libstdc++-v3/include/profile/array
index bd6da6ca396..138ad311ed7 100644
--- a/libstdc++-v3/include/profile/array
+++ b/libstdc++-v3/include/profile/array
@@ -127,7 +127,7 @@ namespace __profile
// Element access.
reference
- operator[](size_type __n)
+ operator[](size_type __n) noexcept
{ return _AT_Type::_S_ref(_M_elems, __n); }
constexpr const_reference
@@ -138,7 +138,10 @@ namespace __profile
at(size_type __n)
{
if (__n >= _Nm)
- std::__throw_out_of_range(__N("array::at"));
+ std::__throw_out_of_range_fmt(__N("array::at: __n "
+ "(which is %zu) >= _Nm "
+ "(which is %zu)"),
+ __n, _Nm);
return _AT_Type::_S_ref(_M_elems, __n);
}
@@ -148,24 +151,26 @@ namespace __profile
// Result of conditional expression must be an lvalue so use
// boolean ? lvalue : (throw-expr, lvalue)
return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
- : (std::__throw_out_of_range(__N("array::at")),
+ : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
+ ">= _Nm (which is %zu)"),
+ __n, _Nm),
_AT_Type::_S_ref(_M_elems, 0));
}
reference
- front()
+ front() noexcept
{ return *begin(); }
constexpr const_reference
- front() const
+ front() const noexcept
{ return _AT_Type::_S_ref(_M_elems, 0); }
reference
- back()
+ back() noexcept
{ return _Nm ? *(end() - 1) : *end(); }
constexpr const_reference
- back() const
+ back() const noexcept
{
return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
: _AT_Type::_S_ref(_M_elems, 0);
diff --git a/libstdc++-v3/include/profile/deque b/libstdc++-v3/include/profile/deque
index c46618e27e4..52d474d4c11 100644
--- a/libstdc++-v3/include/profile/deque
+++ b/libstdc++-v3/include/profile/deque
@@ -117,7 +117,7 @@ namespace __profile
#if __cplusplus >= 201103L
deque&
- operator=(deque&& __x)
+ operator=(deque&& __x) noexcept
{
// NB: DR 1204.
// NB: DR 675.
@@ -245,13 +245,13 @@ namespace __profile
// element access:
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
return _M_base()[__n];
}
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
return _M_base()[__n];
}
@@ -259,25 +259,25 @@ namespace __profile
using _Base::at;
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
@@ -375,13 +375,13 @@ namespace __profile
#endif
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
_Base::pop_front();
}
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
_Base::pop_back();
}
@@ -409,7 +409,7 @@ namespace __profile
}
void
- swap(deque& __x)
+ swap(deque& __x) _GLIBCXX_NOEXCEPT
{
_Base::swap(__x);
}
diff --git a/libstdc++-v3/include/profile/iterator_tracker.h b/libstdc++-v3/include/profile/iterator_tracker.h
index 251eff7355f..c016f20db8b 100644
--- a/libstdc++-v3/include/profile/iterator_tracker.h
+++ b/libstdc++-v3/include/profile/iterator_tracker.h
@@ -56,13 +56,14 @@ namespace __profile
typedef typename _Traits::reference reference;
typedef typename _Traits::pointer pointer;
- __iterator_tracker()
+ __iterator_tracker() _GLIBCXX_NOEXCEPT
: _M_current(), _M_ds(0) { }
- __iterator_tracker(const _Iterator& __i, const _Sequence* __seq)
+ __iterator_tracker(const _Iterator& __i, const _Sequence* __seq)
+ _GLIBCXX_NOEXCEPT
: _M_current(__i), _M_ds(__seq) { }
- __iterator_tracker(const __iterator_tracker& __x)
+ __iterator_tracker(const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
: _M_current(__x._M_current), _M_ds(__x._M_ds) { }
template<typename _MutableIterator>
@@ -70,23 +71,23 @@ namespace __profile
typename __gnu_cxx::__enable_if
<(std::__are_same<_MutableIterator, typename
_Sequence::iterator::_Base_iterator>::__value),
- _Sequence>::__type>& __x)
+ _Sequence>::__type>& __x) _GLIBCXX_NOEXCEPT
: _M_current(__x.base()), _M_ds(__x._M_get_sequence()) { }
_Iterator
- base() const { return _M_current; }
+ base() const _GLIBCXX_NOEXCEPT { return _M_current; }
/**
* @brief Conversion to underlying non-debug iterator to allow
* better interaction with non-profile containers.
*/
- operator _Iterator() const { return _M_current; }
+ operator _Iterator() const _GLIBCXX_NOEXCEPT { return _M_current; }
pointer
- operator->() const { return &*_M_current; }
+ operator->() const _GLIBCXX_NOEXCEPT { return &*_M_current; }
__iterator_tracker&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate();
++_M_current;
@@ -94,7 +95,7 @@ namespace __profile
}
__iterator_tracker
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate();
__iterator_tracker __tmp(*this);
@@ -103,7 +104,7 @@ namespace __profile
}
__iterator_tracker&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate(1);
--_M_current;
@@ -111,7 +112,7 @@ namespace __profile
}
__iterator_tracker
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_M_ds->_M_profile_iterate(1);
__iterator_tracker __tmp(*this);
@@ -120,30 +121,30 @@ namespace __profile
}
__iterator_tracker&
- operator=(const __iterator_tracker& __x)
+ operator=(const __iterator_tracker& __x) _GLIBCXX_NOEXCEPT
{
_M_current = __x._M_current;
return *this;
}
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return *_M_current; }
// ------ Random access iterator requirements ------
reference
- operator[](const difference_type& __n) const
+ operator[](const difference_type& __n) const _GLIBCXX_NOEXCEPT
{ return _M_current[__n]; }
__iterator_tracker&
- operator+=(const difference_type& __n)
+ operator+=(const difference_type& __n) _GLIBCXX_NOEXCEPT
{
_M_current += __n;
return *this;
}
__iterator_tracker
- operator+(const difference_type& __n) const
+ operator+(const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
__iterator_tracker __tmp(*this);
__tmp += __n;
@@ -151,14 +152,14 @@ namespace __profile
}
__iterator_tracker&
- operator-=(const difference_type& __n)
+ operator-=(const difference_type& __n) _GLIBCXX_NOEXCEPT
{
_M_current += -__n;
return *this;
}
__iterator_tracker
- operator-(const difference_type& __n) const
+ operator-(const difference_type& __n) const _GLIBCXX_NOEXCEPT
{
__iterator_tracker __tmp(*this);
__tmp -= __n;
@@ -178,72 +179,84 @@ namespace __profile
inline bool
operator==(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() == __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator==(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() == __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator!=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() != __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator!=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() != __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator<(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() < __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator<(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() < __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator<=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() <= __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator<=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() <= __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator>(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() > __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator>(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() > __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator>=(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() >= __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline bool
operator>=(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() >= __rhs.base(); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -254,12 +267,14 @@ namespace __profile
inline typename __iterator_tracker<_IteratorL, _Sequence>::difference_type
operator-(const __iterator_tracker<_IteratorL, _Sequence>& __lhs,
const __iterator_tracker<_IteratorR, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() - __rhs.base(); }
template<typename _Iterator, typename _Sequence>
inline typename __iterator_tracker<_Iterator, _Sequence>::difference_type
operator-(const __iterator_tracker<_Iterator, _Sequence>& __lhs,
const __iterator_tracker<_Iterator, _Sequence>& __rhs)
+ _GLIBCXX_NOEXCEPT
{ return __lhs.base() - __rhs.base(); }
template<typename _Iterator, typename _Sequence>
@@ -267,6 +282,7 @@ namespace __profile
operator+(typename __iterator_tracker<_Iterator,_Sequence>::difference_type
__n,
const __iterator_tracker<_Iterator, _Sequence>& __i)
+ _GLIBCXX_NOEXCEPT
{ return __i + __n; }
} // namespace __profile
diff --git a/libstdc++-v3/include/profile/list b/libstdc++-v3/include/profile/list
index ac09aa3db26..6168c61ed18 100644
--- a/libstdc++-v3/include/profile/list
+++ b/libstdc++-v3/include/profile/list
@@ -65,7 +65,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
// 23.2.2.1 construct/copy/destroy:
explicit
- list(const _Allocator& __a = _Allocator())
+ list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a)
{
__profcxx_list_construct(this); // list2slist
@@ -276,22 +276,22 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
// element access:
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{ return _Base::front(); }
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return _Base::front(); }
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
__profcxx_list_rewind(this);
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
__profcxx_list_rewind(this);
return _Base::back();
@@ -311,7 +311,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
#endif
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
__profcxx_list_operation(this);
_Base::pop_front();
@@ -324,7 +324,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
#endif
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
iterator __victim = end();
--__victim;
@@ -411,7 +411,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position)
+ erase(const_iterator __position) noexcept
#else
erase(iterator __position)
#endif
@@ -419,7 +419,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position, const_iterator __last)
+ erase(const_iterator __position, const_iterator __last) noexcept
#else
erase(iterator __position, iterator __last)
#endif
@@ -440,7 +440,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
// 23.2.2.4 list operations:
void
#if __cplusplus >= 201103L
- splice(const_iterator __position, list&& __x)
+ splice(const_iterator __position, list&& __x) noexcept
#else
splice(iterator __position, list& __x)
#endif
@@ -448,7 +448,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
#if __cplusplus >= 201103L
void
- splice(const_iterator __position, list& __x)
+ splice(const_iterator __position, list& __x) noexcept
{ this->splice(__position, std::move(__x)); }
void
@@ -458,7 +458,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
void
#if __cplusplus >= 201103L
- splice(const_iterator __position, list&& __x, const_iterator __i)
+ splice(const_iterator __position, list&& __x, const_iterator __i) noexcept
#else
splice(iterator __position, list& __x, iterator __i)
#endif
@@ -474,7 +474,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
void
#if __cplusplus >= 201103L
splice(const_iterator __position, list&& __x, const_iterator __first,
- const_iterator __last)
+ const_iterator __last) noexcept
#else
splice(iterator __position, list& __x, iterator __first,
iterator __last)
@@ -490,7 +490,7 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
#if __cplusplus >= 201103L
void
splice(const_iterator __position, list& __x,
- const_iterator __first, const_iterator __last)
+ const_iterator __first, const_iterator __last) noexcept
{ this->splice(__position, std::move(__x), __first, __last); }
#endif
diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector
index 3ef04ff0a7c..8f79df7f07c 100644
--- a/libstdc++-v3/include/profile/vector
+++ b/libstdc++-v3/include/profile/vector
@@ -78,7 +78,7 @@ namespace __profile
// 23.2.4.1 construct/copy/destroy:
explicit
- vector(const _Allocator& __a = _Allocator())
+ vector(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a)
{
__profcxx_vector_construct(this, this->capacity());
@@ -156,7 +156,7 @@ namespace __profile
__profcxx_vector_construct2(this);
}
- vector(vector&& __x, const _Allocator& __a) noexcept
+ vector(vector&& __x, const _Allocator& __a)
: _Base(std::move(__x), __a)
{
__profcxx_vector_construct(this, this->capacity());
@@ -292,13 +292,13 @@ namespace __profile
// element access:
reference
- operator[](size_type __n)
+ operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__profcxx_vector_invalid_operator(this);
return _M_base()[__n];
}
const_reference
- operator[](size_type __n) const
+ operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__profcxx_vector_invalid_operator(this);
return _M_base()[__n];
@@ -307,25 +307,25 @@ namespace __profile
using _Base::at;
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index 0d2a71c8cbc..673d0e4b18d 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -169,7 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Element access.
reference
- operator[](size_type __n)
+ operator[](size_type __n) noexcept
{ return _AT_Type::_S_ref(_M_elems, __n); }
constexpr const_reference
@@ -180,7 +180,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
at(size_type __n)
{
if (__n >= _Nm)
- std::__throw_out_of_range(__N("array::at"));
+ std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
+ ">= _Nm (which is %zu)"),
+ __n, _Nm);
return _AT_Type::_S_ref(_M_elems, __n);
}
@@ -190,24 +192,26 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// Result of conditional expression must be an lvalue so use
// boolean ? lvalue : (throw-expr, lvalue)
return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n)
- : (std::__throw_out_of_range(__N("array::at")),
+ : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) "
+ ">= _Nm (which is %zu)"),
+ __n, _Nm),
_AT_Type::_S_ref(_M_elems, 0));
}
reference
- front()
+ front() noexcept
{ return *begin(); }
constexpr const_reference
- front() const
+ front() const noexcept
{ return _AT_Type::_S_ref(_M_elems, 0); }
reference
- back()
+ back() noexcept
{ return _Nm ? *(end() - 1) : *end(); }
constexpr const_reference
- back() const
+ back() const noexcept
{
return _Nm ? _AT_Type::_S_ref(_M_elems, _Nm - 1)
: _AT_Type::_S_ref(_M_elems, 0);
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 1da6baf332f..708a434af9e 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -752,6 +752,26 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base;
typedef unsigned long _WordT;
+ template<class _CharT, class _Traits, class _Alloc>
+ void
+ _M_check_initial_position(const std::basic_string<_CharT, _Traits, _Alloc>& __s,
+ size_t __position) const
+ {
+ if (__position > __s.size())
+ __throw_out_of_range_fmt(__N("bitset::bitset: __position "
+ "(which is %zu) > __s.size() "
+ "(which is %zu)"),
+ __position, __s.size());
+ }
+
+ void _M_check(size_t __position, const char *__s) const
+ {
+ if (__position >= _Nb)
+ __throw_out_of_range_fmt(__N("%s: __position (which is %zu) "
+ ">= _Nb (which is %zu)"),
+ __s, __position, _Nb);
+ }
+
void
_M_do_sanitize() _GLIBCXX_NOEXCEPT
{
@@ -867,9 +887,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
size_t __position = 0)
: _Base()
{
- if (__position > __s.size())
- __throw_out_of_range(__N("bitset::bitset initial position "
- "not valid"));
+ _M_check_initial_position(__s, __position);
_M_copy_from_string(__s, __position,
std::basic_string<_CharT, _Traits, _Alloc>::npos,
_CharT('0'), _CharT('1'));
@@ -890,9 +908,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
size_t __position, size_t __n)
: _Base()
{
- if (__position > __s.size())
- __throw_out_of_range(__N("bitset::bitset initial position "
- "not valid"));
+ _M_check_initial_position(__s, __position);
_M_copy_from_string(__s, __position, __n, _CharT('0'), _CharT('1'));
}
@@ -904,9 +920,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_CharT __zero, _CharT __one = _CharT('1'))
: _Base()
{
- if (__position > __s.size())
- __throw_out_of_range(__N("bitset::bitset initial position "
- "not valid"));
+ _M_check_initial_position(__s, __position);
_M_copy_from_string(__s, __position, __n, __zero, __one);
}
@@ -1067,8 +1081,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
bitset<_Nb>&
set(size_t __position, bool __val = true)
{
- if (__position >= _Nb)
- __throw_out_of_range(__N("bitset::set"));
+ this->_M_check(__position, __N("bitset::set"));
return _Unchecked_set(__position, __val);
}
@@ -1092,8 +1105,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
bitset<_Nb>&
reset(size_t __position)
{
- if (__position >= _Nb)
- __throw_out_of_range(__N("bitset::reset"));
+ this->_M_check(__position, __N("bitset::reset"));
return _Unchecked_reset(__position);
}
@@ -1116,8 +1128,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
bitset<_Nb>&
flip(size_t __position)
{
- if (__position >= _Nb)
- __throw_out_of_range(__N("bitset::flip"));
+ this->_M_check(__position, __N("bitset::flip"));
return _Unchecked_flip(__position);
}
@@ -1302,8 +1313,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
bool
test(size_t __position) const
{
- if (__position >= _Nb)
- __throw_out_of_range(__N("bitset::test"));
+ this->_M_check(__position, __N("bitset::test"));
return _Unchecked_test(__position);
}
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 63ba77793fd..73cddfe0f7a 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1932,7 +1932,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
template<typename _Tp>
static bool
- _M_not_empty_function(const _Tp*& __fp)
+ _M_not_empty_function(_Tp* const& __fp)
{ return __fp; }
template<typename _Class, typename _Tp>
diff --git a/libstdc++-v3/src/c++11/Makefile.am b/libstdc++-v3/src/c++11/Makefile.am
index 49d51746500..f42db2f18a9 100644
--- a/libstdc++-v3/src/c++11/Makefile.am
+++ b/libstdc++-v3/src/c++11/Makefile.am
@@ -42,6 +42,7 @@ sources = \
random.cc \
regex.cc \
shared_ptr.cc \
+ snprintf_lite.cc \
system_error.cc \
thread.cc
diff --git a/libstdc++-v3/src/c++11/Makefile.in b/libstdc++-v3/src/c++11/Makefile.in
index b989c086607..d39096e4292 100644
--- a/libstdc++-v3/src/c++11/Makefile.in
+++ b/libstdc++-v3/src/c++11/Makefile.in
@@ -70,7 +70,8 @@ libc__11convenience_la_LIBADD =
am__objects_1 = chrono.lo condition_variable.lo debug.lo \
functexcept.lo functional.lo future.lo hash_c++0x.lo \
hashtable_c++0x.lo limits.lo mutex.lo placeholders.lo \
- random.lo regex.lo shared_ptr.lo system_error.lo thread.lo
+ random.lo regex.lo shared_ptr.lo snprintf_lite.lo \
+ system_error.lo thread.lo
@ENABLE_EXTERN_TEMPLATE_TRUE@am__objects_2 = fstream-inst.lo \
@ENABLE_EXTERN_TEMPLATE_TRUE@ string-inst.lo wstring-inst.lo
am_libc__11convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2)
@@ -324,6 +325,7 @@ sources = \
random.cc \
regex.cc \
shared_ptr.cc \
+ snprintf_lite.cc \
system_error.cc \
thread.cc
diff --git a/libstdc++-v3/src/c++11/functexcept.cc b/libstdc++-v3/src/c++11/functexcept.cc
index b0c1804ae04..b18f8ad5706 100644
--- a/libstdc++-v3/src/c++11/functexcept.cc
+++ b/libstdc++-v3/src/c++11/functexcept.cc
@@ -31,6 +31,7 @@
#include <future>
#include <functional>
#include <bits/regex_error.h>
+#include <stdarg.h>
#ifdef _GLIBCXX_USE_NLS
# include <libintl.h>
@@ -39,6 +40,12 @@
# define _(msgid) (msgid)
#endif
+namespace __gnu_cxx
+{
+ int __snprintf_lite(char *__buf, size_t __bufsize, const char *__fmt,
+ va_list __ap);
+}
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -80,6 +87,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ _GLIBCXX_THROW_OR_ABORT(out_of_range(_(__s))); }
void
+ __throw_out_of_range_fmt(const char* __fmt, ...)
+ {
+ const size_t __len = __builtin_strlen(__fmt);
+ // We expect at most 2 numbers, and 1 short string. The additional
+ // 512 bytes should provide more than enough space for expansion.
+ const size_t __alloca_size = __len + 512;
+ char *const __s = static_cast<char*>(__builtin_alloca(__alloca_size));
+ va_list __ap;
+
+ va_start(__ap, __fmt);
+ __gnu_cxx::__snprintf_lite(__s, __alloca_size, __fmt, __ap);
+ _GLIBCXX_THROW_OR_ABORT(out_of_range(_(__s)));
+ va_end(__ap); // Not reached.
+ }
+
+ void
__throw_runtime_error(const char* __s __attribute__((unused)))
{ _GLIBCXX_THROW_OR_ABORT(runtime_error(_(__s))); }
diff --git a/libstdc++-v3/src/c++11/snprintf_lite.cc b/libstdc++-v3/src/c++11/snprintf_lite.cc
new file mode 100644
index 00000000000..1e0ccec813a
--- /dev/null
+++ b/libstdc++-v3/src/c++11/snprintf_lite.cc
@@ -0,0 +1,159 @@
+// Debugging support -*- C++ -*-
+
+// Copyright (C) 2013 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 <stdarg.h>
+#include <bits/functexcept.h>
+#include <bits/locale_facets.h>
+
+namespace std {
+ template<typename _CharT, typename _ValueT>
+ int
+ __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,
+ ios_base::fmtflags __flags, bool __dec);
+}
+
+namespace __gnu_cxx {
+
+ // Private helper to throw logic error if snprintf_lite runs out
+ // of space (which is not expected to ever happen).
+ // NUL-terminates __buf.
+ void
+ __throw_insufficient_space(const char *__buf, const char *__bufend)
+ __attribute__((__noreturn__));
+
+ void
+ __throw_insufficient_space(const char *__buf, const char *__bufend)
+ {
+ // Include space for trailing NUL.
+ const size_t __len = __bufend - __buf + 1;
+
+ const char __err[] = "not enough space for format expansion "
+ "(Please submit full bug report at http://gcc.gnu.org/bugs.html):\n ";
+ const size_t __errlen = sizeof(__err) - 1;
+
+ char *const __e
+ = static_cast<char*>(__builtin_alloca(__errlen + __len));
+
+ __builtin_memcpy(__e, __err, __errlen);
+ __builtin_memcpy(__e + __errlen, __buf, __len - 1);
+ __e[__errlen + __len - 1] = '\0';
+ std::__throw_logic_error(__e);
+ }
+
+
+ // Private routine to append decimal representation of VAL to the given
+ // BUFFER, but not more than BUFSIZE characters.
+ // Does not NUL-terminate the output buffer.
+ // Returns number of characters appended, or -1 if BUFSIZE is too small.
+ int __concat_size_t(char *__buf, size_t __bufsize, size_t __val)
+ {
+ // __int_to_char is explicitly instantiated and available only for
+ // some, but not all, types. See locale-inst.cc.
+#ifdef _GLIBCXX_USE_LONG_LONG
+ unsigned long long __val2 = __val;
+#else
+ unsigned long __val2 = __val;
+#endif
+ // Long enough for decimal representation.
+ int __ilen = 3 * sizeof(__val2);
+ char *__cs = static_cast<char*>(__builtin_alloca(__ilen));
+ size_t __len = std::__int_to_char(__cs + __ilen, __val2,
+ std::__num_base::_S_atoms_out,
+ std::ios_base::dec, true);
+ if (__bufsize < __len)
+ return -1;
+
+ __builtin_memcpy(__buf, __cs + __ilen - __len, __len);
+ return __len;
+ }
+
+
+ // Private routine to print into __buf arguments according to format,
+ // not to exceed __bufsize.
+ // Only '%%', '%s' and '%zu' format specifiers are understood.
+ // Returns number of characters printed (excluding terminating NUL).
+ // Always NUL-terminates __buf.
+ // Throws logic_error on insufficient space.
+ int __snprintf_lite(char *__buf, size_t __bufsize, const char *__fmt,
+ va_list __ap)
+ {
+ char *__d = __buf;
+ const char *__s = __fmt;
+ const char *const __limit = __d + __bufsize - 1; // Leave space for NUL.
+
+ while (__s[0] != '\0' && __d < __limit)
+ {
+ if (__s[0] == '%')
+ switch (__s[1])
+ {
+ default: // Stray '%'. Just print it.
+ break;
+ case '%': // '%%'
+ __s += 1;
+ break;
+ case 's': // '%s'.
+ {
+ const char *__v = va_arg(__ap, const char *);
+
+ while (__v[0] != '\0' && __d < __limit)
+ *__d++ = *__v++;
+
+ if (__v[0] != '\0')
+ // Not enough space for __fmt expansion.
+ __throw_insufficient_space(__buf, __d);
+
+ __s += 2; // Step over %s.
+ continue;
+ }
+ break;
+ case 'z':
+ if (__s[2] == 'u') // '%zu' -- expand next size_t arg.
+ {
+ const int __len = __concat_size_t(__d, __limit - __d,
+ va_arg(__ap, size_t));
+ if (__len > 0)
+ __d += __len;
+ else
+ // Not enough space for __fmt expansion.
+ __throw_insufficient_space(__buf, __d);
+
+ __s += 3; // Step over %zu
+ continue;
+ }
+ // Stray '%zX'. Just print it.
+ break;
+ }
+ *__d++ = *__s++;
+ }
+
+ if (__s[0] != '\0')
+ // Not enough space for __fmt expansion.
+ __throw_insufficient_space(__buf, __d);
+
+ *__d = '\0';
+ return __d - __buf;
+ }
+
+} // __gnu_cxx
diff --git a/libstdc++-v3/testsuite/20_util/exchange/1.cc b/libstdc++-v3/testsuite/20_util/exchange/1.cc
index d16d9e9642e..2157b69e7e9 100644
--- a/libstdc++-v3/testsuite/20_util/exchange/1.cc
+++ b/libstdc++-v3/testsuite/20_util/exchange/1.cc
@@ -55,6 +55,10 @@ test02()
VERIFY( old.value == 1 );
}
+int f(int) { return 0; }
+
+double f(double) { return 0; }
+
// Deduce type of overloaded function
void
test03()
@@ -62,8 +66,6 @@ test03()
bool test __attribute__((unused)) = true;
int (*fp)(int);
- int f(int);
- double f(double);
std::exchange(fp, &f);
VERIFY( fp != nullptr );
}
diff --git a/libstdc++-v3/testsuite/20_util/function/cons/57465.cc b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc
new file mode 100644
index 00000000000..44413fbd6ef
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 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/>.
+
+// libstdc++/57465
+
+// { dg-options "-std=gnu++11" }
+
+#include <functional>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ using F = void();
+ F* f = nullptr;
+ std::function<F> x(f);
+ VERIFY( !x );
+}
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
index 353577f6bbc..6667629e149 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
@@ -28,6 +28,6 @@ int n1 = std::get<1>(a);
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 266 }
-// { dg-error "static assertion failed" "" { target *-*-* } 275 }
-// { dg-error "static assertion failed" "" { target *-*-* } 283 }
+// { dg-error "static assertion failed" "" { target *-*-* } 271 }
+// { dg-error "static assertion failed" "" { target *-*-* } 280 }
+// { dg-error "static assertion failed" "" { target *-*-* } 288 }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
index d465cd296b9..ca6f9f84e82 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc
@@ -28,6 +28,6 @@ int n1 = std::get<1>(a);
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 270 }
-// { dg-error "static assertion failed" "" { target *-*-* } 279 }
-// { dg-error "static assertion failed" "" { target *-*-* } 287 }
+// { dg-error "static assertion failed" "" { target *-*-* } 274 }
+// { dg-error "static assertion failed" "" { target *-*-* } 283 }
+// { dg-error "static assertion failed" "" { target *-*-* } 291 }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
index 76ea230b14e..a8e0624ee6e 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
@@ -23,4 +23,4 @@
typedef std::tuple_element<1, std::array<int, 1>>::type type;
-// { dg-error "static assertion failed" "" { target *-*-* } 300 }
+// { dg-error "static assertion failed" "" { target *-*-* } 305 }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
index 3a52607deb6..0648bc1176e 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc
@@ -23,4 +23,4 @@
typedef std::tuple_element<1, std::array<int, 1>>::type type;
-// { dg-error "static assertion failed" "" { target *-*-* } 316 }
+// { dg-error "static assertion failed" "" { target *-*-* } 320 }
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 7558ac7d855..d0ccd4cec81 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1760 }
+// { dg-error "no matching" "" { target *-*-* } 1790 }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index ee6b721d9d3..9dfa9352051 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1693 }
+// { dg-error "no matching" "" { target *-*-* } 1723 }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index d36964efa4e..6435d40e60e 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1693 }
+// { dg-error "no matching" "" { target *-*-* } 1723 }
#include <deque>
#include <utility>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index cda684d29f5..7ae5ba58849 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1844 }
+// { dg-error "no matching" "" { target *-*-* } 1874 }
#include <deque>
@@ -32,4 +32,3 @@ void f()
std::deque<A> d;
d.insert(d.begin(), 10, 1);
}
-
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.h b/libstdc++-v3/testsuite/23_containers/list/operations/5.h
deleted file mode 100644
index 755ddd9eb1d..00000000000
--- a/libstdc++-v3/testsuite/23_containers/list/operations/5.h
+++ /dev/null
@@ -1,134 +0,0 @@
-// 2006-01-19 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2006-2013 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.2.4 list operations [lib.list.ops]
-
-#include <stdexcept>
-#include <testsuite_hooks.h>
-#include <testsuite_allocator.h>
-
-// Check the splice (and merge) bits of N1599.
-template<typename _Tp>
-void
-operations05()
-{
- bool test __attribute__((unused)) = true;
-
- typedef _Tp list_type;
- typedef typename list_type::allocator_type allocator_type;
-
- const int data1[] = {1, 2, 3, 4, 5};
- const int data2[] = {6, 7, 8, 9, 10};
- const size_t N1 = sizeof(data1) / sizeof(int);
- const size_t N2 = sizeof(data2) / sizeof(int);
-
- allocator_type alloc01(1), alloc02(2);
-
- list_type l01(data1, data1 + N1, alloc01);
- const list_type l01_ref = l01;
-
- list_type l02(data2, data2 + N2, alloc02);
- const list_type l02_ref = l02;
-
- bool catched = false;
-
- try
- {
- l01.splice(l01.begin(), l02);
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.splice(l01.begin(), l02, l02.begin());
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.splice(l01.begin(), l02, l02.begin(), l02.end());
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.merge(l02);
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.merge(l02, std::less<int>());
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-}
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 80cf1033d27..dd315f67a31 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 *-*-* } 1651 }
+// { dg-error "no matching" "" { target *-*-* } 1646 }
#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 333849252b1..9454c741a68 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 *-*-* } 1603 }
+// { dg-error "no matching" "" { target *-*-* } 1598 }
#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 fdf4fe9387f..9723db98a48 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 *-*-* } 1603 }
+// { dg-error "no matching" "" { target *-*-* } 1598 }
#include <list>
#include <utility>
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 3c33584e8de..fdc2f11d6e2 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 *-*-* } 1603 }
+// { dg-error "no matching" "" { target *-*-* } 1598 }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index f7353ab325c..3cd260d788a 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1308 }
+// { dg-error "no matching" "" { target *-*-* } 1426 }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index cfe19a8944d..afb5de60038 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1287 }
+// { dg-error "no matching" "" { target *-*-* } 1352 }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index 2afdd89dd4c..b4f7aa5de48 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1287 }
+// { dg-error "no matching" "" { target *-*-* } 1352 }
#include <vector>
#include <utility>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index ec32ec2b6ed..e6533f7ceb8 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1402 }
+// { dg-error "no matching" "" { target *-*-* } 1467 }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc b/libstdc++-v3/testsuite/24_iterators/normal_iterator/58403.cc
index fbb55b3ea3c..0c7e281af16 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
+++ b/libstdc++-v3/testsuite/24_iterators/normal_iterator/58403.cc
@@ -1,6 +1,7 @@
-// 2006-01-19 Paolo Carlini <pcarlini@suse.de>
+// { dg-options "-std=gnu++11" }
+// { dg-do link }
-// Copyright (C) 2006-2013 Free Software Foundation, Inc.
+// Copyright (C) 2013 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
@@ -17,15 +18,17 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#include "5.h"
-#include <list>
+#include <string>
+#include <iterator>
+
+struct A {
+ static constexpr std::iterator_traits<
+ std::string::iterator>::difference_type a = 1;
+};
int main()
{
- typedef int value_type;
- typedef __gnu_test::uneq_allocator<value_type> allocator_type;
- typedef std::list<value_type, allocator_type> list_type;
-
- operations05<list_type>();
- return 0;
+ std::string s = "foo";
+ auto it = s.begin();
+ it += A::a;
}
diff --git a/libstdc++-v3/testsuite/25_algorithms/adjacent_find/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/adjacent_find/vectorbool.cc
new file mode 100644
index 00000000000..c5278bbe974
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/adjacent_find/vectorbool.cc
@@ -0,0 +1,44 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.1.5 [lib.alg.adjacent_find]
+
+#include <vector>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<bool> v;
+ v.push_back(true);
+ v.push_back(false);
+ v.push_back(true);
+ v.push_back(false);
+ v.push_back(false);
+
+ VERIFY( std::adjacent_find(v.begin(), v.end()) == v.begin() + 3 );
+ VERIFY( std::adjacent_find(v.begin(), v.end() - 1) == v.end() - 1 );
+}
+
+int
+main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/find/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/find/vectorbool.cc
new file mode 100644
index 00000000000..13de9300c10
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/find/vectorbool.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.1.2 find
+
+#include <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+void
+test1()
+{
+ std::vector<bool> v;
+ v.push_back(false);
+ v.push_back(false);
+ v.push_back(true);
+ v.push_back(false);
+ VERIFY( std::find(v.begin(), v.end(), true) == v.begin() + 2 );
+}
+
+int
+main()
+{
+ test1();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/find_end/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/find_end/vectorbool.cc
new file mode 100644
index 00000000000..eabaa4c572c
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/find_end/vectorbool.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.1.3 [lib.alg.find.end]
+
+#include <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+void
+test1()
+{
+ std::vector<bool> v1;
+ v1.push_back(false);
+ v1.push_back(false);
+ v1.push_back(false);
+ v1.push_back(true);
+ v1.push_back(true);
+ v1.push_back(false);
+ v1.push_back(true);
+ v1.push_back(true);
+ v1.push_back(false);
+
+ std::vector<bool> v2;
+ v2.push_back(true);
+ v2.push_back(true);
+
+ VERIFY( std::find_end(v1.begin(), v1.end(), v2.begin(), v2.end())
+ == v1.begin() + 6 );
+}
+
+int
+main()
+{
+ test1();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/find_first_of/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/find_first_of/vectorbool.cc
new file mode 100644
index 00000000000..d43a391c843
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/find_first_of/vectorbool.cc
@@ -0,0 +1,50 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.1.4 [lib.alg.find.first.of]
+
+#include <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+void
+test1()
+{
+ std::vector<bool> v1;
+ v1.push_back(false);
+ v1.push_back(false);
+ v1.push_back(true);
+ v1.push_back(false);
+ v1.push_back(true);
+ v1.push_back(true);
+ v1.push_back(false);
+ v1.push_back(true);
+ v1.push_back(true);
+
+ std::vector<bool> v2;
+ v2.push_back(true);
+ v2.push_back(false);
+
+ VERIFY( std::find_first_of(v1.begin(), v1.end(), v2.begin(), v2.end())
+ == v1.begin() );
+}
+
+int
+main()
+{
+ test1();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/find_if/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/find_if/vectorbool.cc
new file mode 100644
index 00000000000..13de9300c10
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/find_if/vectorbool.cc
@@ -0,0 +1,39 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.1.2 find
+
+#include <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+void
+test1()
+{
+ std::vector<bool> v;
+ v.push_back(false);
+ v.push_back(false);
+ v.push_back(true);
+ v.push_back(false);
+ VERIFY( std::find(v.begin(), v.end(), true) == v.begin() + 2 );
+}
+
+int
+main()
+{
+ test1();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/find_if_not/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/find_if_not/vectorbool.cc
new file mode 100644
index 00000000000..f97a7e24256
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/find_if_not/vectorbool.cc
@@ -0,0 +1,40 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2013 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 <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+void
+test1()
+{
+ std::vector<bool> v;
+ v.push_back(false);
+ v.push_back(false);
+ v.push_back(true);
+ v.push_back(false);
+ VERIFY( std::find_if_not(v.begin(), v.end(), [](bool val){ return !val; })
+ == v.begin() + 2 );
+}
+
+int
+main()
+{
+ test1();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/heap/vectorbool.cc
new file mode 100644
index 00000000000..7f2bc61e1a0
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/heap/vectorbool.cc
@@ -0,0 +1,146 @@
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.3.6 Heap operations [lib.alg.heap.operations]
+
+#include <iterator>
+#include <vector>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+const bool A[] = { true, true, false, true, false, false, true, false };
+const int B[] = { false, false, false, false, true, true, true, true };
+const int C[] = { true, true, true, true, false, false, false, false };
+const int N = sizeof(A) / sizeof(bool);
+
+// This functor has the equivalent functionality of std::greater<>,
+// but there is no dependency on <functional> and it also tracks the
+// number of invocations since creation.
+class Gt
+{
+public:
+ static int count() { return _S_count; }
+ static void reset() { _S_count = 0; }
+
+ bool
+ operator()(bool x, bool y) const
+ {
+ ++_S_count;
+ return x > y;
+ }
+
+private:
+ static int _S_count;
+};
+
+int Gt::_S_count = 0;
+
+// Exercise all of the heap functions for operator<. The intermediate
+// results between push_heap and pop_heap and make_heap and sort_heap
+// are not checked (they could be).
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ // sort array s1 using push_heap/pop_heap
+ std::vector<bool> s1;
+ std::copy(A, A + N, std::back_inserter(s1));
+ VERIFY( std::equal(s1.begin(), s1.begin() + N, A) );
+
+ for (int i = 2; i <= N; ++i)
+ std::push_heap(s1.begin(), s1.begin() + i);
+
+ for (int i = N; i >= 2; --i)
+ std::pop_heap(s1.begin(), s1.begin() + i);
+
+ VERIFY( std::equal(s1.begin(), s1.begin() + N, B) );
+
+ // sort array s2 using make_heap/sort_heap
+ std::vector<bool> s2;
+ std::copy(A, A + N, std::back_inserter(s2));
+ VERIFY( std::equal(s2.begin(), s2.begin() + N, A) );
+
+ std::make_heap(s2.begin(), s2.begin() + N);
+ std::sort_heap(s2.begin(), s2.begin() + N);
+ VERIFY( std::equal(s2.begin(), s2.begin() + N, B) );
+}
+
+// Perform same tests as above but with the comparison predicate
+// versions, and add complexity constraint checks.
+void
+test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ Gt gt;
+
+#ifndef _GLIBCXX_DEBUG
+ //const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5);
+ const int logN = 3;
+#endif
+
+ std::vector<bool> s1;
+ std::copy(A, A + N, std::back_inserter(s1));
+ VERIFY(std::equal(s1.begin(), s1.begin() + N, A));
+
+ for (int i = 2; i <= N; ++i)
+ {
+ std::push_heap(s1.begin(), s1.begin() + i, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= logN);
+#endif
+ gt.reset();
+ }
+
+ for (int i = N; i >= 2; --i)
+ {
+ std::pop_heap(s1.begin(), s1.begin() + i, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= 2 * logN);
+#endif
+ gt.reset();
+ }
+
+ VERIFY(std::equal(s1.begin(), s1.begin() + N, C));
+
+ // sort array s2 using make_heap/sort_heap
+ std::vector<bool> s2;
+ std::copy(A, A + N, std::back_inserter(s2));
+ VERIFY(std::equal(s2.begin(), s2.begin() + N, A));
+
+ std::make_heap(s2.begin(), s2.begin() + N, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= 3 * N);
+#endif
+ gt.reset();
+
+ std::sort_heap(s2.begin(), s2.begin() + N, gt);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(gt.count() <= N * logN);
+#endif
+
+ VERIFY(std::equal(s2.begin(), s2.begin() + N, C));
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/is_permutation/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/is_permutation/vectorbool.cc
new file mode 100644
index 00000000000..be5b4ff531f
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/is_permutation/vectorbool.cc
@@ -0,0 +1,50 @@
+// { dg-options "-std=gnu++1y" }
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 25.2.12 [alg.is_permutation] Is permutation
+
+#include <vector>
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<bool> v1 = { true, false, true, false, true };
+ std::vector<bool> v2 = { false, true, false, true, true };
+ VERIFY( std::is_permutation(v1.begin(), v1.end(), v2.begin()) );
+ VERIFY( !std::is_permutation(v1.begin() + 1, v1.end(), v2.begin() + 1) );
+}
+
+void test02()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<bool> v1 = { true, false, true, false, true };
+ std::vector<bool> v2 = { false, true, false, true, true };
+ VERIFY( std::is_permutation(v1.begin(), v1.end(), v2.begin(), v2.end()) );
+ VERIFY( !std::is_permutation(v1.begin(), v1.end() - 1, v2.begin(), v2.end()) );
+}
+
+int main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc
new file mode 100644
index 00000000000..b5ae34617f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/25_algorithms/search_n/58358.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2013 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 "-std=gnu++11" }
+
+// 25.1.9 [lib.alg.search]
+
+#include <algorithm>
+#include <vector>
+#include <testsuite_hooks.h>
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ std::vector<int> a{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
+ int count = 0;
+ std::search_n(a.begin(), a.end(), 10, 1,
+ [&count](int t, int u) { ++count; return t == u; });
+ VERIFY( count <= 11 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc
index 27cffe74116..10616960dc2 100644
--- a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc
@@ -31,9 +31,11 @@
int array1[11] = {0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0};
int array2[TEST_DEPTH];
+int pred_count;
bool
pred(int i, int j)
{
+ ++pred_count;
return i == j;
}
@@ -90,16 +92,22 @@ int main()
int* t1 = search_n(forwardcon.begin(),
forwardcon.end(), j, 1).ptr;
+ pred_count = 0;
int* t2 = search_n(forwardcon.begin(),
forwardcon.end(), j, 1, pred).ptr;
+ VERIFY(pred_count <= i);
int* t3 = search_n(bidircon.begin(),
bidircon.end(), j, 1).ptr;
+ pred_count = 0;
int* t4 = search_n(bidircon.begin(),
bidircon.end(), j, 1, pred).ptr;
+ VERIFY(pred_count <= i);
int* t5 = search_n(randomcon.begin(),
randomcon.end(), j, 1).ptr;
+ pred_count = 0;
int* t6 = search_n(randomcon.begin(),
randomcon.end(), j, 1, pred).ptr;
+ VERIFY(pred_count <= i);
VERIFY((t1 == t2) && (t2 == t3) && (t3 == t4) &&
(t4 == t5) && (t5 == t6));
}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/53622.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc
index aee1dbe15dc..5f4b1d1b894 100644
--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/53622.cc
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/53622.cc
@@ -21,7 +21,6 @@
// <http://www.gnu.org/licenses/>.
// 28.11.2 regex_match
-// Tests Extended grouping against a std::string target.
#include <regex>
#include <testsuite_hooks.h>
@@ -33,7 +32,7 @@ test01()
bool test __attribute__((unused)) = true;
{
- std::regex re("zxcv/(one.*)abc", std::regex::extended);
+ std::regex re("zxcv/(one.*)abc", std::regex::ECMAScript);
std::string target("zxcv/onetwoabc");
std::smatch m;
@@ -46,7 +45,7 @@ test01()
}
{
- std::regex re("zxcv/(one.*)abc()\\2", std::regex::extended);
+ std::regex re("zxcv/(one.*)abc()\\2", std::regex::ECMAScript);
std::string target("zxcv/onetwoabc");
std::smatch m;
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/57173.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc
index cb3a54f4d88..b9a72c93f01 100644
--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/57173.cc
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/char/57173.cc
@@ -20,8 +20,7 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 28.11.3 regex_search
-// Tests Extended against a std::string target.
+// 28.11.2 regex_match
#include <regex>
#include <testsuite_hooks.h>
@@ -34,7 +33,7 @@ test01()
bool test __attribute__((unused)) = true;
{
- std::regex re("/asdf(/.*)", std::regex::extended);
+ std::regex re("/asdf(/.*)", std::regex::ECMAScript);
std::string target("/asdf/qwerty");
std::smatch m;
@@ -43,7 +42,7 @@ test01()
VERIFY( std::string(m[1].first, m[1].second) == "/qwerty");
}
{
- std::regex re("/asdf(/.*)()\\2", std::regex::extended);
+ std::regex re("/asdf(/.*)()\\2", std::regex::ECMAScript);
std::string target("/asdf/qwerty");
std::smatch m;
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc
index cb502eadfb4..4634c7d1d35 100644
--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/extended/string_dispatch_01.cc
@@ -38,9 +38,10 @@ template<typename _Bi_iter, typename _Alloc,
regex_constants::match_flag_type __flags
= regex_constants::match_default)
{
+ auto& __res = (vector<sub_match<_Bi_iter>, _Alloc>&)(__m);
VERIFY( (dynamic_cast
<__detail::_DFSExecutor<_Bi_iter, _Alloc, _Ch_type, _Rx_traits>*>
- (&*__detail::__get_executor(__s, __e, __m, __re, __flags))
+ (&*__detail::__get_executor(__s, __e, __res, __re, __flags))
!= nullptr) );
}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/basic_replace.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/basic_replace.cc
new file mode 100644
index 00000000000..ca3f16f7d23
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_replace/char/basic_replace.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-09-24 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 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/>.
+
+// 28.11.4 regex_replace
+// Tests ECMAScript regex_replace.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY(regex_replace(string("This is a string"), regex("\\b\\w*\\b"), "|$0|")
+ == "|This||| |is||| |a||| |string|||");
+ VERIFY(regex_replace(string("This is a string"), regex("\\b\\w*\\b"), "|$0|",
+ regex_constants::format_no_copy)
+ == "|This||||is||||a||||string|||");
+ VERIFY(regex_replace(string("This is a string"), regex("\\b\\w*\\b"), "|$0|",
+ regex_constants::format_first_only)
+ == "|This| is a string");
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc
new file mode 100644
index 00000000000..3064b3b26e4
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/assertion.cc
@@ -0,0 +1,94 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-09-14 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 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/>.
+
+// 28.11.3 regex_search
+// Tests ECMAScript assertion.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY(!regex_search("2123456", regex("^1234")));
+ VERIFY(regex_search("123456", regex("^1234")));
+ VERIFY(regex_search("123456", regex("(5|^)1234")));
+ VERIFY(regex_search("5123456", regex("(5|^)1234")));
+ VERIFY(!regex_search("1234562", regex("3456$")));
+ VERIFY(regex_search("123456", regex("3456$")));
+ VERIFY(!regex_search("123456", regex("(?=1234)56")));
+ VERIFY(regex_search("123456", regex("(?=1234)123456")));
+ VERIFY(regex_search("123456", regex("(?!1234)56")));
+ VERIFY(!regex_search("123456", regex("(?!1234)123456")));
+
+ VERIFY(regex_search("a-", regex("a\\b-")));
+ VERIFY(!regex_search("ab", regex("a\\bb")));
+ VERIFY(!regex_search("a-", regex("a\\B-")));
+ VERIFY(regex_search("ab", regex("a\\Bb")));
+
+ string s("This is a regular expression");
+ string sol[] =
+ {
+ "This",
+ "",
+ "is",
+ "",
+ "a",
+ "",
+ "regular",
+ "",
+ "expression",
+ "",
+ };
+
+ regex re("\\b\\w*\\b");
+ int i = 0;
+ for (auto it = sregex_iterator(s.begin(), s.end(), re);
+ it != sregex_iterator();
+ ++it)
+ {
+ string s((*it)[0].first, (*it)[0].second);
+ VERIFY(s == sol[i++]);
+ }
+ VERIFY(i == 10);
+
+ {
+ cmatch m;
+ regex re("(?=(as)df)as(df)");
+ regex_search("asdf", m, re);
+ VERIFY(m.size() == 3);
+ VERIFY(m[0].matched && string(m[0].first, m[0].second) == "asdf");
+ VERIFY(m[1].matched && string(m[1].first, m[1].second) == "as");
+ VERIFY(m[2].matched && string(m[2].first, m[2].second) == "df");
+ }
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/flags.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/flags.cc
new file mode 100644
index 00000000000..4be406cb072
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/flags.cc
@@ -0,0 +1,71 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-09-18 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 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/>.
+
+// 28.11.3 regex_search
+// Tests ECMAScript flags.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ cmatch m;
+ regex re("((as)(df))", regex_constants::ECMAScript | regex_constants::nosubs);
+ VERIFY(regex_search("asdf", m, re));
+ VERIFY(m.size() == 1);
+ VERIFY(m[0].matched && string(m[0].first, m[0].second) == "asdf");
+
+ VERIFY( regex_search("a", regex("^a")));
+ VERIFY(!regex_search("a", regex("^a"), regex_constants::match_not_bol));
+ VERIFY( regex_search("a", regex("a$")));
+ VERIFY(!regex_search("a", regex("a$"), regex_constants::match_not_eol));
+ VERIFY( regex_search("a", regex("\\ba")));
+ VERIFY(!regex_search("a", regex("\\ba"), regex_constants::match_not_bow));
+ VERIFY( regex_search("a", regex("a\\b")));
+ VERIFY(!regex_search("a", regex("a\\b"), regex_constants::match_not_eow));
+ VERIFY( regex_search("", regex("")));
+ VERIFY(!regex_search("", regex(""), regex_constants::match_not_null));
+ VERIFY( regex_search("", regex("^$")));
+ VERIFY(!regex_search("", regex("^$"), regex_constants::match_not_null));
+ VERIFY( regex_search("aaa", m, regex("a*?"),
+ regex_constants::match_not_null));
+ VERIFY(m[0].matched && string(m[0].first, m[0].second) == "a");
+ VERIFY( regex_search("asdf", regex("sdf")));
+ VERIFY(!regex_search("asdf", regex("sdf"),
+ regex_constants::match_continuous));
+ VERIFY( regex_search(" a"+1, regex("\\ba"),
+ regex_constants::match_prev_avail));
+ VERIFY( regex_search("ba"+1, regex("\\Ba"),
+ regex_constants::match_prev_avail));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc
new file mode 100644
index 00000000000..ad37ec8649a
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/greedy.cc
@@ -0,0 +1,71 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-09-14 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 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/>.
+
+// 28.11.3 regex_search
+// Tests ECMAScript greedy and ungreedy quantifiers.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ cmatch m;
+#define TEST(i, s) VERIFY(m[i].matched && string(m[i].first, m[i].second) == s)
+ VERIFY(regex_search("aaaa", m, regex("a*")));
+ TEST(0, "aaaa");
+ VERIFY(regex_search("aaaa", m, regex("a*?")));
+ TEST(0, "");
+ VERIFY(regex_search("aaaa", m, regex("a+")));
+ TEST(0, "aaaa");
+ VERIFY(regex_search("aaaa", m, regex("a+?")));
+ TEST(0, "a");
+ VERIFY(regex_search("a", m, regex("a?")));
+ TEST(0, "a");
+ VERIFY(regex_search("a", m, regex("a??")));
+ TEST(0, "");
+ VERIFY(regex_search("", m, regex("a??")));
+ TEST(0, "");
+ VERIFY(regex_search("aaaa", m, regex("(a+)(a+)")));
+ TEST(1, "aaa");
+ TEST(2, "a");
+ VERIFY(regex_search("aaaa", m, regex("(a+?)(a+)")));
+ TEST(1, "a");
+ TEST(2, "aaa");
+ VERIFY(regex_search("aaaa", m, regex("(a+?)(a+)")));
+ TEST(1, "a");
+ TEST(2, "aaa");
+ VERIFY(regex_search("aaaa", m, regex("(a+?)(a+?)")));
+ TEST(1, "a");
+ TEST(2, "a");
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc
index a2d290db283..ec25875fdee 100644
--- a/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc
@@ -21,7 +21,7 @@
// <http://www.gnu.org/licenses/>.
// 28.11.3 regex_search
-// Tests BRE against a std::string target.
+// Tests ECMAScript against a std::string target.
#include <regex>
#include <testsuite_hooks.h>
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/basic/raw_string.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/basic/raw_string.cc
index 68fd56af760..d005dc040eb 100644
--- a/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/basic/raw_string.cc
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/ctors/basic/raw_string.cc
@@ -1,5 +1,4 @@
-// { dg-options "-std=c++0x" }
-// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=gnu++11" }
// 2012-08-20 Benjamin Kosnik <bkoz@redhat.com>
//
diff --git a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc
index 75ef0584b8a..978565021cc 100644
--- a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc
+++ b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/char/string_position_01.cc
@@ -1,5 +1,4 @@
// { dg-options "-std=gnu++11" }
-// { dg-do run { xfail *-*-* } }
//
// 2013-07-25 Tim Shen <timshen91@gmail.com>
diff --git a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc
index cd2c68e33ee..9cb96f7a162 100644
--- a/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc
+++ b/libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/wchar_t/string_02.cc
@@ -1,6 +1,5 @@
// { dg-options "-std=gnu++11" }
// { dg-require-namedlocale "en_US.UTF-8" }
-// { dg-do run { xfail *-*-* } }
//
// 2013-09-05 Tim Shen <timshen91@gmail.com>
@@ -42,13 +41,19 @@ test01()
re2.assign(L"([[:lower:]]{0,1}[[:space:]]{0,1}[[:upper:]]{0,1})");
- std::wsregex_iterator p(str2.begin(), str2.end(), re2);
- auto a = p;
- ++p;
- VERIFY(a != p);
- //for (std::wsregex_iterator p(str2.begin(), str2.end(), re2);
- // p != std::wsregex_iterator{}; ++p)
- // std::wcout << (*p)[1] << std::endl;
+ std::wstring sol[] =
+ {
+ L"ä\u2009Ä",
+ L"\u2009",
+ L"ö\u2009Ö",
+ L"\u2009",
+ L"ü\u2009Ü",
+ L"",
+ };
+ int i = 0;
+ for (std::wsregex_iterator p(str2.begin(), str2.end(), re2);
+ p != std::wsregex_iterator{}; ++p)
+ VERIFY(std::wstring((*p)[1].first, (*p)[1].second) == sol[i++]);
}
int
diff --git a/libstdc++-v3/testsuite/28_regex/match_results/format.cc b/libstdc++-v3/testsuite/28_regex/match_results/format.cc
new file mode 100644
index 00000000000..be080162143
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/match_results/format.cc
@@ -0,0 +1,51 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-09-24 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 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/>.
+
+// 28.10.5 formatting
+// Tests ECMAScript format()
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ cmatch m;
+ VERIFY(regex_search("*** this is a string !!!", m,
+ regex("(\\w+) (\\w+) (\\w+) (\\w+)")));
+ VERIFY(m.format("$&|$`|$3|$4|$2|$1|$'$$$")
+ == "this is a string|*** |a|string|is|this| !!!$$");
+ VERIFY(m.format("&|\\3|\\4|\\2|\\1|\\",
+ regex_constants::format_sed)
+ == "this is a string|a|string|is|this|\\");
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc
index 7e0b259e0b7..dba0fc357e5 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/char/lookup_collatename.cc
@@ -35,12 +35,9 @@ test01()
typedef char CharT;
typedef std::regex_traits<CharT> traits;
- char name[] = "ll";
- traits t;
-
- traits::string_type sname = t.lookup_collatename(name, name+sizeof(name)-1);
-
- VERIFY( !sname.empty() );
+ traits t;
+ CharT name[] = "tilde";
+ VERIFY(t.lookup_collatename(name, name+sizeof(name)-1) == "~");
}
int main()
diff --git a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/lookup_collatename.cc b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/lookup_collatename.cc
index 197bb9b4a78..3d20cfaf9a0 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/lookup_collatename.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/lookup_collatename.cc
@@ -33,13 +33,9 @@ test01()
typedef wchar_t CharT;
typedef std::regex_traits<CharT> traits;
- wchar_t name[] = L"ll";
- traits t;
-
- traits::string_type sname =
- t.lookup_collatename(name, name+sizeof(name)/sizeof(*name)-1);
-
- VERIFY( !sname.empty() );
+ traits t;
+ CharT name[] = L"tilde";
+ VERIFY(t.lookup_collatename(name, name+sizeof(name)/sizeof(*name)-1) == L"~");
}
int main()
diff --git a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/value.cc b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/value.cc
index e68dac64e03..6d5885cc627 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/value.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/value.cc
@@ -25,20 +25,20 @@
#include <regex>
#include <testsuite_hooks.h>
-// Tests the value() function of the regex_traits<char> class.
+// Tests the value() function of the regex_traits<wchar_t> class.
void test01()
{
bool test __attribute__((unused)) = true;
- std::regex_traits<char> t;
- VERIFY( t.value('7', 8) == 7 );
- VERIFY( t.value('7', 10) == 7 );
- VERIFY( t.value('7', 16) == 7 );
- VERIFY( t.value('9', 8) == -1 );
- VERIFY( t.value('9', 10) == 9 );
- VERIFY( t.value('9', 16) == 9 );
- VERIFY( t.value('d', 8) == -1 );
- VERIFY( t.value('d', 10) == -1 );
- VERIFY( t.value('d', 16) == 13 );
+ std::regex_traits<wchar_t> t;
+ VERIFY( t.value(L'7', 8) == 7 );
+ VERIFY( t.value(L'7', 10) == 7 );
+ VERIFY( t.value(L'7', 16) == 7 );
+ VERIFY( t.value(L'9', 8) == -1 );
+ VERIFY( t.value(L'9', 10) == 9 );
+ VERIFY( t.value(L'9', 16) == 9 );
+ VERIFY( t.value(L'd', 8) == -1 );
+ VERIFY( t.value(L'd', 10) == -1 );
+ VERIFY( t.value(L'd', 16) == 13 );
}
int
diff --git a/libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc b/libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc
new file mode 100644
index 00000000000..cfcb8938e26
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/cons/58415-1.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2013 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 <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+typedef __gnu_cxx::__versa_string<char> string;
+
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ string s1("string");
+ string s2("");
+ std::swap(s1, s2);
+
+ VERIFY( s1.c_str()[0] == '\0' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc b/libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc
new file mode 100644
index 00000000000..9ba192ab228
--- /dev/null
+++ b/libstdc++-v3/testsuite/ext/vstring/cons/58415-2.cc
@@ -0,0 +1,38 @@
+// { dg-options "-std=gnu++11" }
+// { dg-require-string-conversions "" }
+
+// Copyright (C) 2013 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 <ext/vstring.h>
+#include <testsuite_hooks.h>
+
+typedef __gnu_cxx::__versa_string<char> string;
+
+void test01()
+{
+ string s1;
+ string s2 = std::move(s1);
+
+ VERIFY( s2.c_str()[0] == '\0' );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 83a3862fbd0..0dff98caa66 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -283,7 +283,7 @@ proc libstdc++_init { testfile } {
v3track cxxflags 2
# Always use MO files built by this test harness.
- set cxxflags "$cxxflags -DLOCALEDIR=\".\""
+ set cxxflags "-fdiagnostics-color=never $cxxflags -DLOCALEDIR=\".\""
set ccflags "$cxxflags -DLOCALEDIR=\".\""
# If a PCH file is available, use it. We must delay performing
diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/search_n.cc b/libstdc++-v3/testsuite/performance/25_algorithms/search_n.cc
index 183045b618c..79d0eea9417 100644
--- a/libstdc++-v3/testsuite/performance/25_algorithms/search_n.cc
+++ b/libstdc++-v3/testsuite/performance/25_algorithms/search_n.cc
@@ -57,7 +57,7 @@ main(void)
for(int i = 0; i < 100; i++)
search_n(rcon.begin(), rcon.end(), 10, 1);
stop_counters(time, resource);
- report_performance(__FILE__, "random acess iterator", time, resource);
+ report_performance(__FILE__, "random access iterator", time, resource);
clear_counters(time, resource);
}
diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/sort.cc b/libstdc++-v3/testsuite/performance/25_algorithms/sort.cc
new file mode 100644
index 00000000000..07062ab8b3f
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/25_algorithms/sort.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2013 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 <vector>
+#include <algorithm>
+#include <testsuite_performance.h>
+
+int main()
+{
+ using namespace __gnu_test;
+
+ time_counter time;
+ resource_counter resource;
+
+ const int max_size = 10000000;
+
+ std::vector<int> v(max_size);
+
+ for (int i = 0; i < max_size; ++i)
+ v[i] = -i;
+
+ start_counters(time, resource);
+ std::sort(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "reverse", time, resource);
+ clear_counters(time, resource);
+
+ for (int i = 0; i < max_size; ++i)
+ v[i] = i;
+
+ start_counters(time, resource);
+ std::sort(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "forwards", time, resource);
+ clear_counters(time, resource);
+
+ // a simple psuedo-random series which does not rely on rand() and friends
+ v[0] = 0;
+ for (int i = 1; i < max_size; ++i)
+ v[i] = (v[i-1] + 110211473) * 745988807;
+
+ start_counters(time, resource);
+ std::sort(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "random", time, resource);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc b/libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc
new file mode 100644
index 00000000000..63cb2248033
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/25_algorithms/sort_heap.cc
@@ -0,0 +1,73 @@
+// Copyright (C) 2013 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 <vector>
+#include <algorithm>
+#include <testsuite_performance.h>
+
+int main()
+{
+ using namespace __gnu_test;
+
+ time_counter time;
+ resource_counter resource;
+
+ const int max_size = 10000000;
+
+ std::vector<int> v(max_size);
+
+ for (int i = 0; i < max_size; ++i)
+ v[i] = -i;
+
+ start_counters(time, resource);
+ std::make_heap(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "make_heap_reverse", time, resource);
+ clear_counters(time, resource);
+
+ for (int i = 0; i < max_size; ++i)
+ v[i] = i;
+
+ start_counters(time, resource);
+ std::make_heap(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "make_heap_forwards", time, resource);
+ clear_counters(time, resource);
+
+ // a simple psuedo-random series which does not rely on rand() and friends
+ v[0] = 0;
+ for (int i = 1; i < max_size; ++i)
+ v[i] = (v[i-1] + 110211473) * 745988807;
+
+ start_counters(time, resource);
+ std::make_heap(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "make_heap_random", time, resource);
+
+
+ start_counters(time, resource);
+ std::sort_heap(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "sort_heap", time, resource);
+ clear_counters(time, resource);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc b/libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc
new file mode 100644
index 00000000000..6440eb35f8f
--- /dev/null
+++ b/libstdc++-v3/testsuite/performance/25_algorithms/stable_sort.cc
@@ -0,0 +1,65 @@
+// Copyright (C) 2013 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 <vector>
+#include <algorithm>
+#include <testsuite_performance.h>
+
+int main()
+{
+ using namespace __gnu_test;
+
+ time_counter time;
+ resource_counter resource;
+
+ const int max_size = 10000000;
+
+ std::vector<int> v(max_size);
+
+ for (int i = 0; i < max_size; ++i)
+ v[i] = -i;
+
+ start_counters(time, resource);
+ std::stable_sort(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "reverse", time, resource);
+ clear_counters(time, resource);
+
+ for (int i = 0; i < max_size; ++i)
+ v[i] = i;
+
+ start_counters(time, resource);
+ std::stable_sort(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "forwards", time, resource);
+ clear_counters(time, resource);
+
+ // a simple psuedo-random series which does not rely on rand() and friends
+ v[0] = 0;
+ for (int i = 1; i < max_size; ++i)
+ v[i] = (v[i-1] + 110211473) * 745988807;
+
+ start_counters(time, resource);
+ std::stable_sort(v.begin(), v.end());
+ stop_counters(time, resource);
+
+ report_performance(__FILE__, "random", time, resource);
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/exception/safety.h b/libstdc++-v3/testsuite/util/exception/safety.h
index 5ba9b13ce37..ca311797bad 100644
--- a/libstdc++-v3/testsuite/util/exception/safety.h
+++ b/libstdc++-v3/testsuite/util/exception/safety.h
@@ -47,22 +47,12 @@ namespace __gnu_test
const typename distribution_type::param_type p(0, __max_size);
size_type random = generator(p);
if (random < distribution.min() || random > distribution.max())
- {
- std::string __s("setup_base::generate");
- __s += "\n";
- __s += "random number generated is: ";
- char buf[40];
- __builtin_sprintf(buf, "%lu", (unsigned long)random);
- __s += buf;
- __s += " on range [";
- __builtin_sprintf(buf, "%lu", (unsigned long)distribution.min());
- __s += buf;
- __s += ", ";
- __builtin_sprintf(buf, "%lu", (unsigned long)distribution.max());
- __s += buf;
- __s += "]\n";
- std::__throw_out_of_range(__s.c_str());
- }
+ std::__throw_out_of_range_fmt(__N("setup_base::generate\n"
+ "random number generated is: %zu "
+ "out of range [%zu, %zu]\n"),
+ (size_t)random,
+ (size_t)distribution.min(),
+ (size_t)distribution.max());
return random;
}
diff --git a/libtool.m4 b/libtool.m4
index 8a14e2b22f9..797468f02a5 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -1220,7 +1220,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1241,7 +1241,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1260,7 +1263,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
diff --git a/libvtv/ChangeLog b/libvtv/ChangeLog
index 20092f4d0a3..3b3d960df6a 100644
--- a/libvtv/ChangeLog
+++ b/libvtv/ChangeLog
@@ -1,3 +1,34 @@
+2013-09-25 Caroline Tice <cmtice@google.com>
+
+ * Makefile.am: Reinstate ENABLE_VTABLE_VERIFY checks, to make
+ sure testsuite is not run if libstdc++ and libgcc were not built
+ with vtable verification.
+ * Makefile.in: Regenerated.
+ * configure.ac: Reinstate checks for --enable-vtable-verify flag,
+ to make sure testsuite is not run if libstdc++ and libgcc were not
+ built with vtable verification.
+ * configure: Regenerated.
+
+2013-09-24 Caroline Tice <cmtice@google.com>
+
+ * Makefile.am: Change libvtv_includedir to the directory used by
+ the other libraries rather than the top include directory.
+ * Makefile.in: Regenerated.
+
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
+2013-09-12 Alexander Ivchenko <alexander.ivchenko@intel.com>
+
+ * configure.tgt: Remove *-*-*android* from supported targets.
+
+2013-09-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR other/58374
+ * configure.ac: Move VTV_SUPPORTED check after AC_CANONICAL_SYSTEM.
+ * configure: Regenerated.
+
2013-09-08 Caroline Tice <cmtice@google.com>
* testsuite/event-main.cc: Move to libvtv.cc subdirectory.
diff --git a/libvtv/Makefile.am b/libvtv/Makefile.am
index c3983effb7d..886d7e6be8d 100644
--- a/libvtv/Makefile.am
+++ b/libvtv/Makefile.am
@@ -19,7 +19,11 @@
## along with this library; see the file COPYING3. If not see
## <http://www.gnu.org/licenses/>.
-SUBDIRS = testsuite
+if ENABLE_VTABLE_VERIFY
+ SUBDIRS = testsuite
+else
+ SUBDIRS=
+endif
ACLOCAL_AMFLAGS = -I .. -I ../config
@@ -51,7 +55,7 @@ vtv_sources = \
vtv_utils.cc \
vtv_end.c
-libvtv_includedir = $(includedir)
+libvtv_includedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
# Link in vtv_start and vtv_end.
BUILT_SOURCES = vtv_start.c vtv_end.c
@@ -63,8 +67,13 @@ vtv_end.c:
rm -f $@
$(LN_S) $(toplevel_srcdir)/libgcc/vtv_end.c $@
-libvtv_la_SOURCES = $(vtv_sources)
-libvtv_include_HEADERS = $(vtv_headers)
+if ENABLE_VTABLE_VERIFY
+ libvtv_la_SOURCES = $(vtv_sources)
+ libvtv_include_HEADERS = $(vtv_headers)
+else
+ libvtv_la_SOURCES =
+ libvtv_include_HEADERS =
+endif
# Least ordering for dependencies mean linking w/o libstdc++ for as
# long as the development of libvtv does not absolutely require it.
diff --git a/libvtv/Makefile.in b/libvtv/Makefile.in
index e021d42fd14..d77a41f0477 100644
--- a/libvtv/Makefile.in
+++ b/libvtv/Makefile.in
@@ -40,7 +40,7 @@ subdir = .
DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/../mkinstalldirs $(srcdir)/../depcomp \
- $(libvtv_include_HEADERS)
+ $(am__libvtv_include_HEADERS_DIST)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/depstand.m4 \
@@ -86,7 +86,7 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
libvtv_la_LIBADD =
am__objects_1 = vtv_start.lo vtv_malloc.lo vtv_rts.lo vtv_utils.lo \
vtv_end.lo
-am_libvtv_la_OBJECTS = $(am__objects_1)
+@ENABLE_VTABLE_VERIFY_TRUE@am_libvtv_la_OBJECTS = $(am__objects_1)
libvtv_la_OBJECTS = $(am_libvtv_la_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../depcomp
@@ -118,6 +118,8 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__libvtv_include_HEADERS_DIST = vtv_map.h vtv_malloc.h vtv_fail.h \
+ vtv_set.h vtv_utils.h vtv_rts.h
HEADERS = $(libvtv_include_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
@@ -125,7 +127,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS
ETAGS = etags
CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
+DIST_SUBDIRS = testsuite
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -263,7 +265,8 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
toplevel_builddir = @toplevel_builddir@
toplevel_srcdir = @toplevel_srcdir@
-SUBDIRS = testsuite
+@ENABLE_VTABLE_VERIFY_FALSE@SUBDIRS =
+@ENABLE_VTABLE_VERIFY_TRUE@SUBDIRS = testsuite
ACLOCAL_AMFLAGS = -I .. -I ../config
# May be used by toolexeclibdir.
@@ -289,12 +292,14 @@ vtv_sources = \
vtv_utils.cc \
vtv_end.c
-libvtv_includedir = $(includedir)
+libvtv_includedir = $(libdir)/gcc/$(target_alias)/$(gcc_version)/include
# Link in vtv_start and vtv_end.
BUILT_SOURCES = vtv_start.c vtv_end.c
-libvtv_la_SOURCES = $(vtv_sources)
-libvtv_include_HEADERS = $(vtv_headers)
+@ENABLE_VTABLE_VERIFY_FALSE@libvtv_la_SOURCES =
+@ENABLE_VTABLE_VERIFY_TRUE@libvtv_la_SOURCES = $(vtv_sources)
+@ENABLE_VTABLE_VERIFY_FALSE@libvtv_include_HEADERS =
+@ENABLE_VTABLE_VERIFY_TRUE@libvtv_include_HEADERS = $(vtv_headers)
# Least ordering for dependencies mean linking w/o libstdc++ for as
# long as the development of libvtv does not absolutely require it.
@@ -324,9 +329,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign ./Makefile
+ $(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
diff --git a/libvtv/configure b/libvtv/configure
index bb56cb0cb97..5a73f26ace7 100755
--- a/libvtv/configure
+++ b/libvtv/configure
@@ -684,6 +684,8 @@ am__isrc
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+ENABLE_VTABLE_VERIFY_FALSE
+ENABLE_VTABLE_VERIFY_TRUE
LIBSTDCXX_RAW_CXX_LDFLAGS
LIBSTDCXX_RAW_CXX_CXXFLAGS
target_noncanonical
@@ -741,6 +743,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_version_specific_runtime_libs
+enable_vtable_verify
enable_multilib
enable_maintainer_mode
enable_dependency_tracking
@@ -1382,6 +1385,7 @@ Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory
+ --enable-vtable-verify Enable vtable verification feature
--enable-multilib build many library versions (default)
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
@@ -2339,22 +2343,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $version_specific_libs" >&5
$as_echo "$version_specific_libs" >&6; }
-# See if supported.
-unset VTV_SUPPORTED
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for host support for vtable verification" >&5
-$as_echo_n "checking for host support for vtable verification... " >&6; }
-. ${srcdir}/configure.tgt
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VTV_SUPPORTED" >&5
-$as_echo "$VTV_SUPPORTED" >&6; }
-
-# Decide if it's usable.
-use_vtable_verify=no
-if test "x$VTV_SUPPORTED" = "xyes"; then
- use_vtable_verify=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: using vtable verification" >&5
-$as_echo "$as_me: using vtable verification" >&6;}
-fi
-
# Do not delete or change the following two lines. For why, see
# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
ac_aux_dir=
@@ -2522,6 +2510,49 @@ esac
+# Use same top-level configure hooks in libgcc/libstdc++/libvtv.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-vtable-verify" >&5
+$as_echo_n "checking for --enable-vtable-verify... " >&6; }
+# Check whether --enable-vtable-verify was given.
+if test "${enable_vtable_verify+set}" = set; then :
+ enableval=$enable_vtable_verify; case "$enableval" in
+ yes) enable_vtable_verify=yes ;;
+ no) enable_vtable_verify=no ;;
+ *) enable_vtable_verify=no;;
+ esac
+else
+ enable_vtable_verify=no
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_vtable_verify" >&5
+$as_echo "$enable_vtable_verify" >&6; }
+
+# See if supported.
+unset VTV_SUPPORTED
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for host support for vtable verification" >&5
+$as_echo_n "checking for host support for vtable verification... " >&6; }
+. ${srcdir}/configure.tgt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $VTV_SUPPORTED" >&5
+$as_echo "$VTV_SUPPORTED" >&6; }
+
+# Decide if it's usable.
+use_vtable_verify=no
+if test "x$VTV_SUPPORTED" = "xyes"; then
+ if test "x$enable_vtable_verify" = "xyes"; then
+ use_vtable_verify=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: using vtable verification" >&5
+$as_echo "$as_me: using vtable verification" >&6;}
+ fi
+fi
+ if test $use_vtable_verify = yes; then
+ ENABLE_VTABLE_VERIFY_TRUE=
+ ENABLE_VTABLE_VERIFY_FALSE='#'
+else
+ ENABLE_VTABLE_VERIFY_TRUE='#'
+ ENABLE_VTABLE_VERIFY_FALSE=
+fi
+
+
am__api_version='1.11'
# Find a good install program. We prefer a C program (faster),
@@ -7851,7 +7882,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -7876,7 +7907,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -7895,7 +7929,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -12090,7 +12127,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12093 "configure"
+#line 12099 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12196,7 +12233,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12199 "configure"
+#line 12205 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15469,7 +15506,7 @@ ac_config_files="$ac_config_files Makefile"
if test "x$VTV_SUPPORTED" = "xyes"; then
- ac_config_files="$ac_config_files ./Makefile testsuite/Makefile"
+ ac_config_files="$ac_config_files testsuite/Makefile"
fi
@@ -15606,6 +15643,10 @@ LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
+if test -z "${ENABLE_VTABLE_VERIFY_TRUE}" && test -z "${ENABLE_VTABLE_VERIFY_FALSE}"; then
+ as_fn_error "conditional \"ENABLE_VTABLE_VERIFY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -n "$EXEEXT"; then
am__EXEEXT_TRUE=
am__EXEEXT_FALSE='#'
@@ -16587,7 +16628,6 @@ do
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "./Makefile") CONFIG_FILES="$CONFIG_FILES ./Makefile" ;;
"testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
*) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
@@ -17920,17 +17960,6 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
_LT_EOF
;;
- "./Makefile":F) cat > vpsed$$ << \_EOF
-s!`test -f '$<' || echo '$(srcdir)/'`!!
-_EOF
- sed -f vpsed$$ $ac_file > tmp$$
- mv tmp$$ $ac_file
- rm vpsed$$
- echo 'MULTISUBDIR =' >> $ac_file
- ml_norecursion=yes
- . ${multi_basedir}/config-ml.in
- { ml_norecursion=; unset ml_norecursion;}
- ;;
"testsuite/Makefile":F) cat > vpsed$$ << \_EOF
s!`test -f '$<' || echo '$(srcdir)/'`!!
_EOF
diff --git a/libvtv/configure.ac b/libvtv/configure.ac
index 6db97dc60b8..12b4664de2e 100644
--- a/libvtv/configure.ac
+++ b/libvtv/configure.ac
@@ -20,6 +20,25 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
[version_specific_libs=no])
AC_MSG_RESULT($version_specific_libs)
+# Do not delete or change the following two lines. For why, see
+# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
+AC_CANONICAL_SYSTEM
+target_alias=${target_alias-$host_alias}
+AC_SUBST(target_alias)
+GCC_LIBSTDCXX_RAW_CXX_FLAGS
+
+# Use same top-level configure hooks in libgcc/libstdc++/libvtv.
+AC_MSG_CHECKING([for --enable-vtable-verify])
+AC_ARG_ENABLE(vtable-verify,
+[ --enable-vtable-verify Enable vtable verification feature ],
+[case "$enableval" in
+ yes) enable_vtable_verify=yes ;;
+ no) enable_vtable_verify=no ;;
+ *) enable_vtable_verify=no;;
+ esac],
+[enable_vtable_verify=no])
+AC_MSG_RESULT($enable_vtable_verify)
+
# See if supported.
unset VTV_SUPPORTED
AC_MSG_CHECKING([for host support for vtable verification])
@@ -29,16 +48,12 @@ AC_MSG_RESULT($VTV_SUPPORTED)
# Decide if it's usable.
use_vtable_verify=no
if test "x$VTV_SUPPORTED" = "xyes"; then
- use_vtable_verify=yes
- AC_MSG_NOTICE(using vtable verification)
+ if test "x$enable_vtable_verify" = "xyes"; then
+ use_vtable_verify=yes
+ AC_MSG_NOTICE(using vtable verification)
+ fi
fi
-
-# Do not delete or change the following two lines. For why, see
-# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
-AC_CANONICAL_SYSTEM
-target_alias=${target_alias-$host_alias}
-AC_SUBST(target_alias)
-GCC_LIBSTDCXX_RAW_CXX_FLAGS
+AM_CONDITIONAL(ENABLE_VTABLE_VERIFY, test $use_vtable_verify = yes)
AM_INIT_AUTOMAKE(foreign no-dist)
AM_ENABLE_MULTILIB(, ..)
@@ -126,7 +141,7 @@ fi
AC_CONFIG_FILES([Makefile])
if test "x$VTV_SUPPORTED" = "xyes"; then
- AC_CONFIG_FILES(AC_FOREACH([DIR], [. testsuite], [DIR/Makefile ]),
+ AC_CONFIG_FILES(AC_FOREACH([DIR], [testsuite], [DIR/Makefile ]),
[cat > vpsed$$ << \_EOF
s!`test -f '$<' || echo '$(srcdir)/'`!!
_EOF
diff --git a/libvtv/configure.tgt b/libvtv/configure.tgt
index 801d2f09564..046b4152429 100644
--- a/libvtv/configure.tgt
+++ b/libvtv/configure.tgt
@@ -21,6 +21,8 @@
# Filter out unsupported systems.
VTV_SUPPORTED=no
case "${target}" in
+ *-*-*android*)
+ ;;
x86_64-*-linux* | i?86-*-linux*)
VTV_SUPPORTED=yes
;;
diff --git a/lto-plugin/ChangeLog b/lto-plugin/ChangeLog
index c8ed0f3f6e7..070cf380817 100644
--- a/lto-plugin/ChangeLog
+++ b/lto-plugin/ChangeLog
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2012-09-14 David Edelsohn <dje.gcc@gmail.com>
* configure: Regenerated.
diff --git a/lto-plugin/configure b/lto-plugin/configure
index f018c7db309..96dc0b24441 100755
--- a/lto-plugin/configure
+++ b/lto-plugin/configure
@@ -6044,7 +6044,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -6069,7 +6069,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -6088,7 +6091,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -10567,7 +10573,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10570 "configure"
+#line 10576 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10673,7 +10679,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10676 "configure"
+#line 10682 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/zlib/ChangeLog.gcj b/zlib/ChangeLog.gcj
index 13b62a4a129..6025369262a 100644
--- a/zlib/ChangeLog.gcj
+++ b/zlib/ChangeLog.gcj
@@ -1,3 +1,7 @@
+2013-09-20 Alan Modra <amodra@gmail.com>
+
+ * configure: Regenerate.
+
2012-11-16 Matthias Klose <doko@ubuntu.com>
* Imported zlib 1.2.7; merged local changes.
diff --git a/zlib/configure b/zlib/configure
index 83bea8e4094..1c7d3ad0917 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -5853,7 +5853,7 @@ ia64-*-hpux*)
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -5878,7 +5878,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
;;
esac
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -5897,7 +5900,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
@@ -10409,7 +10415,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10412 "configure"
+#line 10418 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10515,7 +10521,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10518 "configure"
+#line 10524 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H